introduce support for coloring the frame behind a map location

Also includes support by paxed for polearm targeting using the
frame color.

Also renames USE_TILES to TILES_IN_GLYPHMAP which is a more
accurate description.

Not all window interfaces have full support for the color framing
of the background square yet.

MS-DOS needs further work (to bring it to both VESA and VGA, with
and without tiles.

Windows GUI is missing support.

X11 and Qt have been started, but may require further refinement.
This commit is contained in:
nhmall
2023-01-01 19:55:02 -05:00
parent 1972c8447f
commit 2fc0d25d45
38 changed files with 365 additions and 133 deletions

View File

@@ -669,8 +669,8 @@ typedef unsigned char uchar;
/* End of Section 4 */
#ifdef TTY_TILES_ESCCODES
# ifndef USE_TILES
# define USE_TILES
# ifndef TILES_IN_GLYPHMAP
# define TILES_IN_GLYPHMAP
# endif
#endif

View File

@@ -830,7 +830,7 @@ struct instance_globals_c {
char *config_section_current;
boolean chosen_symset_start;
boolean chosen_symset_end;
/* invent.c */
/* for perm_invent when operating on a partial inventory display, so that
persistent one doesn't get shrunk during filtering for item selection
@@ -1603,6 +1603,9 @@ struct instance_globals_w {
/* mkmaze.c */
struct trap *wportal;
/* new */
struct win_settings wsettings; /* wintype.h */
boolean havestate;
unsigned long magic; /* validate that structure layout is preserved */
};

View File

@@ -1003,9 +1003,9 @@ extern const int explodecolors[];
extern int wallcolors[];
#endif
/* If USE_TILES is defined during build, this comes from the generated
* tile.c, complete with appropriate tile references in the initialization.
* Otherwise, it comes from display.c.
/* If TILES_IN_GLYPHMAP is defined during build, this is defined
* in the generated tile.c, complete with appropriate tile references in
* the initialization. Otherwise, it gets defined in display.c.
*/
extern const glyph_info nul_glyphinfo;

View File

@@ -545,6 +545,7 @@ extern const char *pmname(struct permonst *, int);
#endif
extern const char *mon_pmname(struct monst *);
extern const char *obj_pmname(struct obj *);
boolean mapxy_valid(coordxy x, coordxy y);
/* ### do_wear.c ### */
@@ -2775,7 +2776,7 @@ extern boolean u_teleport_mon(struct monst *, boolean);
/* ### tile.c ### */
#ifdef USE_TILES
#ifdef TILES_IN_GLYPHMAP
extern void substitute_tiles(d_level *);
#endif

View File

@@ -256,15 +256,15 @@ typedef uchar nhsym;
#if defined(X11_GRAPHICS) || defined(QT_GRAPHICS) || defined(GNOME_GRAPHICS) \
|| defined(MSWIN_GRAPHICS)
#ifndef NO_TILE_C
#ifndef USE_TILES
#define USE_TILES /* glyphmap[] with prefilled tile mappings will be available */
#ifndef TILES_IN_GLYPHMAP
#define TILES_IN_GLYPHMAP
#endif
#endif
#endif
#if defined(AMII_GRAPHICS) || defined(GEM_GRAPHICS)
#ifndef NO_TILE_C
#ifndef USE_TILES
#define USE_TILES
#ifndef TILES_IN_GLYPHMAP
#define TILES_IN_GLYPHMAP
#endif
#endif
#endif

View File

@@ -78,9 +78,9 @@ static int optfn_##a(int, int, boolean, char *, char *);
{ m, OptS_##sec, 0, b, opt_##a, s, OthrOpt, n, v, d, No, c, \
(boolean *) 0, &optfn_##a, al, z, (const char *) 0, On, On, 0 },
/* this is not reliable because USE_TILES might be defined in a
multi-interface binary but not apply to the current interface */
#ifdef USE_TILES
/* this is not reliable because TILES_IN_GLYPHMAP might be defined
* in a multi-interface binary but not apply to the current interface */
#ifdef TILES_IN_GLYPHMAP
#define tiled_map_Def On
#define ascii_map_Def Off
#else

View File

@@ -75,7 +75,7 @@
*/
#ifndef SUPPRESS_GRAPHICS
#if (defined(SCREEN_BIOS) || defined(SCREEN_DJGPPFAST)) && !defined(PC9800)
#ifdef USE_TILES
#ifdef TILES_IN_GLYPHMAP
#define SCREEN_VGA /* Include VGA graphics routines in the build */
#define SCREEN_VESA
#endif

View File

@@ -51,6 +51,8 @@ struct text_map_info_t {
X11_map_symbol text[ROWNO][COLNO]; /* Actual displayed screen. */
#ifdef TEXTCOLOR
X11_color colors[ROWNO][COLNO]; /* Color of each character. */
X11_color framecolors[ROWNO][COLNO]; /* Color of background
behind text */
GC color_gcs[CLR_MAX], /* GC for each color */
inv_color_gcs[CLR_MAX]; /* GC for each inverse color */
#define copy_gc color_gcs[NO_COLOR]
@@ -74,6 +76,7 @@ struct tile_glyph_info_t {
unsigned short glyph;
unsigned short tileidx;
unsigned glyphflags;
uint32 framecolor;
};
struct tile_map_info_t {

View File

@@ -129,10 +129,10 @@ extern void curs_destroy_all_wins(void);
#ifdef ENHANCED_SYMBOLS
extern void curses_putch(winid wid, int x, int y, int ch,
struct unicode_representation *u, int color,
int attrs);
int framecolor, int attrs);
#else
extern void curses_putch(winid wid, int x, int y, int ch, int color,
int attrs);
int framecolor, int attrs);
#endif
extern void curses_get_window_size(winid wid, int *height, int *width);
extern boolean curses_window_has_border(winid wid);

View File

@@ -92,6 +92,7 @@ struct DisplayDesc {
short curx, cury; /* current cursor position on the screen */
#ifdef TEXTCOLOR
int color; /* current color */
uint32 framecolor; /* current background color */
#endif
int attrs; /* attributes in effect */
int toplin; /* flag for topl stuff */
@@ -153,8 +154,8 @@ E void tty_shutdown(void);
#endif
E int xputc(int);
E void xputs(const char *);
#if defined(SCREEN_VGA) || defined(SCREEN_8514)
E void xputg(const glyph_info *);
#if defined(SCREEN_VGA) || defined(SCREEN_8514) || defined(SCREEN_VESA)
E void xputg(const glyph_info *, const glyph_info *);
#endif
E void cl_end(void);
E void clear_screen(void);
@@ -188,6 +189,7 @@ E void term_end_raw_bold(void);
#ifdef TEXTCOLOR
E void term_end_color(void);
E void term_start_color(int color);
E void term_start_bgcolor(int color);
#endif /* TEXTCOLOR */
#ifdef ENHANCED_SYMBOLS
extern void term_start_24bitcolor(struct unicode_representation *);

View File

@@ -101,6 +101,7 @@ typedef struct glyph_map_entry {
typedef struct gi {
int glyph; /* the display entity */
int ttychar;
uint32 framecolor;
glyph_map gm;
} glyph_info;
#define GLYPH_INFO_P struct gi
@@ -213,6 +214,22 @@ typedef struct win_request_info_t win_request_info;
/* #define CORE_INVENT */
/* In a binary with multiple window interfaces linked in, this is
* a structure to track certain interface capabilities that cannot be
* statically done at compile time. Some of them can be toggled and
* the core needs to know if they are active or not at the time.
*/
enum win_display_modes {
wdmode_traditional = 0,
wdmode_tiled
};
struct win_settings {
enum win_display_modes wdmode;
uint32 map_frame_color;
};
/* clang-format on */
#endif /* WINTYPE_H */