From 6636db94e706c681bc66624c2da2ad124b0de57d Mon Sep 17 00:00:00 2001 From: PatR Date: Tue, 12 Sep 2023 01:34:47 -0700 Subject: [PATCH] corridor engravings in black and white The default engraving-in-corridor character is the same as the default corridor symbol (and also default lit corridor one), distinguished by color. Show it differently (in inverse vidoe, like lava vs water and sink vs fountain) if color is Off. It might be better to change the engraving-in-room symbol to be the same as the room one so that they'll be more consistent with corridors; color is probably sufficient without resorting to back-tick. But this update hasn't done that. --- include/display.h | 1 + src/display.c | 59 ++++++++++++++++++++++++------------------- win/X11/winmap.c | 6 +++-- win/curses/cursmain.c | 9 ++++--- win/tty/wintty.c | 13 +++++----- win/win32/mhmap.c | 5 ++-- 6 files changed, 54 insertions(+), 39 deletions(-) diff --git a/include/display.h b/include/display.h index 0307f65d2..1b4d887ae 100644 --- a/include/display.h +++ b/include/display.h @@ -1026,6 +1026,7 @@ enum glyph_offsets { #define MG_BW_ICE 0x00200 /* similar for ice vs floor */ #define MG_BW_SINK 0x00200 /* identical for sink vs fountain [note: someday * this may become a distinct flag */ +#define MG_BW_ENGR 0x00200 /* likewise for corridor engravings */ #define MG_NOTHING 0x00400 /* char represents GLYPH_NOTHING */ #define MG_UNEXPL 0x00800 /* char represents GLYPH_UNEXPLORED */ #define MG_MALE 0x01000 /* represents a male mon or statue of one */ diff --git a/src/display.c b/src/display.c index 9d5f2a16c..7b5ef20a3 100644 --- a/src/display.c +++ b/src/display.c @@ -2727,34 +2727,35 @@ reset_glyphmap(enum glyphmap_change_triggers trigger) zap_color((offset >> 2)); } else if ((offset = (glyph - GLYPH_CMAP_B_OFF)) >= 0) { int cmap = S_grave + offset; + int sym = gs.showsyms[cmap + SYM_OFF_P]; gmap->sym.symidx = cmap + SYM_OFF_P; cmap_color(cmap); if (!iflags.use_color) { + unsigned spec_cmap = 0; + /* try to provide a visible difference between water and lava - if they use the same symbol and color is disabled */ - if ((cmap == S_lava || cmap == S_lavawall) - && (gs.showsyms[gmap->sym.symidx] - == gs.showsyms[S_pool + SYM_OFF_P] - || gs.showsyms[gmap->sym.symidx] - == gs.showsyms[S_water + SYM_OFF_P])) { - gmap->glyphflags |= MG_BW_LAVA; - - /* similar for floor [what about empty doorway?] and ice */ - } else if (cmap == S_ice - && (gs.showsyms[gmap->sym.symidx] - == gs.showsyms[S_room + SYM_OFF_P] - || gs.showsyms[gmap->sym.symidx] - == gs.showsyms[S_darkroom - + SYM_OFF_P])) { - gmap->glyphflags |= MG_BW_ICE; - - /* and for fountain vs sink */ - } else if (cmap == S_sink - && (gs.showsyms[gmap->sym.symidx] - == gs.showsyms[S_fountain + SYM_OFF_P])) { - gmap->glyphflags |= MG_BW_SINK; + if they use the same symbol and color is disabled; + similar for floor and ice, for fountain vs sink, and for + corridor engravings (CMAP_A below) */ + switch (cmap) { + case S_lava: + case S_lavawall: + if (sym == gs.showsyms[S_pool + SYM_OFF_P] + || sym == gs.showsyms[S_water + SYM_OFF_P]) + spec_cmap = MG_BW_LAVA; + break; + case S_ice: + if (sym == gs.showsyms[S_room + SYM_OFF_P] + || sym == gs.showsyms[S_darkroom + SYM_OFF_P]) + spec_cmap = MG_BW_ICE; + break; + case S_sink: + if (sym == gs.showsyms[S_fountain + SYM_OFF_P]) + spec_cmap = MG_BW_SINK; + break; } + gmap->glyphflags |= spec_cmap; } else if (has_rogue_color) { color = cmap_to_roguecolor(cmap); } @@ -2766,9 +2767,11 @@ reset_glyphmap(enum glyphmap_change_triggers trigger) else altar_color(offset); } else if ((offset = (glyph - GLYPH_CMAP_A_OFF)) >= 0) { - int cmap = S_ndoor + offset; + int sym, cmap = S_ndoor + offset; + gmap->sym.symidx = cmap + SYM_OFF_P; cmap_color(cmap); + sym = gs.showsyms[gmap->sym.symidx]; /* * Some specialty color mappings not hardcoded in data init */ @@ -2777,11 +2780,15 @@ reset_glyphmap(enum glyphmap_change_triggers trigger) #ifdef TEXTCOLOR /* provide a visible difference if normal and lit corridor use the same symbol */ - } else if ((cmap == S_litcorr) - && gs.showsyms[gmap->sym.symidx] - == gs.showsyms[S_corr + SYM_OFF_P]) { + } else if (cmap == S_litcorr + && sym == gs.showsyms[S_corr + SYM_OFF_P]) { color = CLR_WHITE; #endif + /* likewise for corridor and engraving-in-corridor */ + } else if (cmap == S_engrcorr + && (sym == gs.showsyms[S_corr + SYM_OFF_P] + || sym == gs.showsyms[S_litcorr + SYM_OFF_P])) { + gmap->glyphflags |= MG_BW_ENGR; } } else if ((offset = (glyph - GLYPH_CMAP_SOKO_OFF)) >= 0) { gmap->sym.symidx = S_vwall + offset + SYM_OFF_P; diff --git a/win/X11/winmap.c b/win/X11/winmap.c index f344fd56d..f3fca5be6 100644 --- a/win/X11/winmap.c +++ b/win/X11/winmap.c @@ -154,12 +154,14 @@ X11_print_glyph( co_ptr = &map_info->text_map.colors[y][x]; colordif = (((special & MG_PET) != 0 && iflags.hilite_pet) || ((special & MG_OBJPILE) != 0 && iflags.hilite_pile) - || ((special & (MG_DETECT | MG_BW_LAVA | MG_BW_ICE)) != 0 + || ((special & (MG_DETECT | MG_BW_LAVA | MG_BW_ICE + | MG_BW_SINK | MG_BW_ENGR)) != 0 && iflags.use_inverse)) ? CLR_MAX : 0; color += colordif; #ifdef ENHANCED_SYMBOLS - if (SYMHANDLING(H_UTF8) && glyphinfo->gm.u != NULL && glyphinfo->gm.u->ucolor != 0) { + if (SYMHANDLING(H_UTF8) && glyphinfo->gm.u != NULL + && glyphinfo->gm.u->ucolor != 0) { color = glyphinfo->gm.u->ucolor | 0x80000000; if (colordif != 0) { color |= 0x40000000; diff --git a/win/curses/cursmain.c b/win/curses/cursmain.c index f042adef8..22329ea67 100644 --- a/win/curses/cursmain.c +++ b/win/curses/cursmain.c @@ -882,9 +882,12 @@ curses_print_glyph( else /* if (iflags.use_inverse) */ attr = A_REVERSE; } - /* water and lava look the same except for color; when color is off, - render lava in inverse video so that they look different */ - if ((special & (MG_BW_LAVA | MG_BW_ICE)) != 0 && iflags.use_inverse) { + /* water and lava look the same except for color; when color is off + (checked by core), render lava in inverse video so that it looks + different from water; similar for floor vs ice, fountain vs sink, + and corridor vs engranving-in-corridor */ + if ((special & (MG_BW_LAVA | MG_BW_ICE | MG_BW_SINK | MG_BW_ENGR)) + != 0 && iflags.use_inverse) { /* reset_glyphmap() only sets MG_BW_foo if color is off */ attr = A_REVERSE; } diff --git a/win/tty/wintty.c b/win/tty/wintty.c index d27d542b9..524f38caa 100644 --- a/win/tty/wintty.c +++ b/win/tty/wintty.c @@ -3518,7 +3518,7 @@ tty_print_glyph( } /* iflags.use_color aka iflags.wc_color */ /* must be after color check; term_end_color may turn off inverse too; - BW_LAVA and BW_ICE won't ever be set when color is on; + BW_LAVA, BW_ICE, BW_SINK, BW_ENGR won't ever be set when color is on; (tried bold for ice but it didn't look very good; inverse is easier to see although the Valkyrie quest ends up being hard on the eyes) */ if (iflags.use_color @@ -3527,11 +3527,12 @@ tty_print_glyph( ttyDisplay->framecolor = bkglyphinfo->framecolor; term_start_bgcolor(bkglyphinfo->framecolor); #endif - } else if (((special & MG_PET) != 0 && iflags.hilite_pet) - || ((special & MG_OBJPILE) != 0 && iflags.hilite_pile) - || ((special & MG_FEMALE) != 0 && wizard && iflags.wizmgender) - || ((special & (MG_DETECT | MG_BW_LAVA | MG_BW_ICE | MG_BW_SINK)) != 0 - && iflags.use_inverse)) { + } else if ((((special & MG_PET) != 0 && iflags.hilite_pet) + || ((special & MG_OBJPILE) != 0 && iflags.hilite_pile) + || ((special & MG_FEMALE) != 0 && wizard && iflags.wizmgender) + || ((special & (MG_DETECT | MG_BW_LAVA | MG_BW_ICE + | MG_BW_SINK | MG_BW_ENGR)) != 0)) + && iflags.use_inverse) { term_start_attr(ATR_INVERSE); inverse_on = TRUE; } diff --git a/win/win32/mhmap.c b/win/win32/mhmap.c index 8a1bd4207..0501f1c66 100644 --- a/win/win32/mhmap.c +++ b/win/win32/mhmap.c @@ -986,8 +986,9 @@ paintGlyph(PNHMapWindow data, int i, int j, RECT * rect) } #endif if (((data->map[i][j].gm.glyphflags & MG_PET) && iflags.hilite_pet) - || ((data->map[i][j].gm.glyphflags & (MG_DETECT | MG_BW_LAVA)) - && iflags.use_inverse)) { + || ((data->map[i][j].gm.glyphflags & (MG_DETECT | MG_BW_LAVA + | MW_BW_ICE | MG_BW_SINK + | MG_BW_ENGR)) != 0)) { back_brush = CreateSolidBrush(nhcolor_to_RGB(CLR_GRAY)); FillRect(data->backBufferDC, rect, back_brush);