black and white ice, sink

When moat and lava use the same screen symbol and color is Off, lava
is rendered in inverse video.  It used to be similar for floor and
ice, but that got broken last year.  Fix inverse ice, and now that
fountain and sink might be same symbol (recent IBMgraphics change),
render sinks in inverse if they match fountains and color is Off.

I started to give sink its own mapglyph flag but then got lazy and
used the same value as ice.  That can be amended if some interface
wants to use some more elaborate distinction than inverse video.
This commit is contained in:
PatR
2022-08-23 16:01:35 -07:00
parent 50b91bdcfa
commit 422a06f01f
5 changed files with 30 additions and 14 deletions

View File

@@ -1,4 +1,4 @@
HDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1021 $ $NHDT-Date: 1661202204 2022/08/22 21:03:24 $
HDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1023 $ $NHDT-Date: 1661295667 2022/08/23 23:01:07 $
General Fixes and Modified Features
-----------------------------------
@@ -1365,6 +1365,9 @@ using 'o'pen as a synonym for #loot of a container at the hero's location did
update '?' menu to reflect change to 'O' command
end of game with DUMPLOG could panic due to perm_invent handling, even when
the persistent inventory window wasn't in use
with color Off and the screen symbol for ice the same as for floor, the black
and white ice was supposed to be rendered in inverse video but that
got broken by the symbols and glyphs overhaul
curses: 'msg_window' option wasn't functional for curses unless the binary
also included tty support

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 display.h $NHDT-Date: 1652719570 2022/05/16 16:46:10 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.71 $ */
/* NetHack 3.7 display.h $NHDT-Date: 1661295667 2022/08/23 23:01:07 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.77 $ */
/* Copyright (c) Dean Luick, with acknowledgements to Kevin Darcy */
/* and Dave Cohrs, 1990. */
/* NetHack may be freely redistributed. See license for details. */
@@ -979,6 +979,8 @@ enum glyph_offsets {
#define MG_BW_LAVA 0x00100 /* 'black & white lava': highlight lava if it
* can't be distinguished from water by color */
#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_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 */

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 display.c $NHDT-Date: 1657918092 2022/07/15 20:48:12 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.190 $ */
/* NetHack 3.7 display.c $NHDT-Date: 1661295668 2022/08/23 23:01:08 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.192 $ */
/* Copyright (c) Dean Luick, with acknowledgements to Kevin Darcy */
/* and Dave Cohrs, 1990. */
/* NetHack may be freely redistributed. See license for details. */
@@ -2479,8 +2479,8 @@ reset_glyphmap(enum glyphmap_change_triggers trigger)
for (glyph = 0; glyph < MAX_GLYPH; ++glyph) {
glyph_map *gmap = &glyphmap[glyph];
gmap->glyphflags = 0U;
gmap->glyphflags = 0U;
/*
* Map the glyph to a character and color.
*
@@ -2599,6 +2599,7 @@ 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;
gmap->sym.symidx = cmap + SYM_OFF_P;
cmap_color(cmap);
if (!iflags.use_color) {
@@ -2610,14 +2611,21 @@ reset_glyphmap(enum glyphmap_change_triggers trigger)
|| g.showsyms[gmap->sym.symidx]
== g.showsyms[S_water + SYM_OFF_P])) {
gmap->glyphflags |= MG_BW_LAVA;
/* similar for floor [what about empty doorway?] and ice */
} else if (offset == S_ice
} else if (cmap == S_ice
&& (g.showsyms[gmap->sym.symidx]
== g.showsyms[S_room + SYM_OFF_P]
|| g.showsyms[gmap->sym.symidx]
== g.showsyms[S_darkroom
+ SYM_OFF_P])) {
gmap->glyphflags |= MG_BW_ICE;
/* and for fountain vs sink */
} else if (cmap == S_sink
&& (g.showsyms[gmap->sym.symidx]
== g.showsyms[S_fountain + SYM_OFF_P])) {
gmap->glyphflags |= MG_BW_SINK;
}
} else if (has_rogue_color) {
color = cmap_to_roguecolor(cmap);

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 symbols.c $NHDT-Date: 1654759698 2022/06/09 07:28:18 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.87 $ */
/* NetHack 3.7 symbols.c $NHDT-Date: 1661295669 2022/08/23 23:01:09 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.90 $ */
/* Copyright (c) NetHack Development Team 2020. */
/* NetHack may be freely redistributed. See license for details. */
@@ -708,7 +708,7 @@ savedsym_add(const char *name, const char *val, int which_set)
free(tmp->val);
tmp->val = dupstr(val);
} else {
tmp = (struct _savedsym *)alloc(sizeof(struct _savedsym));
tmp = (struct _savedsym *) alloc(sizeof *tmp);
tmp->name = dupstr(name);
tmp->val = dupstr(val);
tmp->which_set = which_set;
@@ -741,8 +741,14 @@ parsesymbols(register char *opts, int which_set)
const struct symparse *symp;
boolean is_glyph = FALSE;
/*
* FIXME:
* The parsing here (and next) yields incorrect results for
* "S_sample=','" or "S_sample=':'".
*/
if ((op = index(opts, ',')) != 0) {
*op++ = 0;
*op++ = '\0';
if (!parsesymbols(op, which_set))
return FALSE;
}
@@ -770,14 +776,11 @@ parsesymbols(register char *opts, int which_set)
return FALSE;
if (symp) {
if (symp->range && symp->range != SYM_CONTROL) {
#ifdef ENHANCED_SYMBOLS
int glyph;
#endif
if (g.symset[which_set].handling == H_UTF8
|| (lowc(strval[0]) == 'u' && strval[1] == '+')) {
#ifdef ENHANCED_SYMBOLS
char buf[BUFSZ];
int glyph;
Snprintf(buf, sizeof buf, "%s:%s", opts, strval);
glyphrep_to_custom_map_entries(buf, &glyph);

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 wintty.c $NHDT-Date: 1656014602 2022/06/23 20:03:22 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.306 $ */
/* NetHack 3.7 wintty.c $NHDT-Date: 1661295670 2022/08/23 23:01:10 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.326 $ */
/* Copyright (c) David Cohrs, 1991 */
/* NetHack may be freely redistributed. See license for details. */
@@ -4258,7 +4258,7 @@ tty_print_glyph(
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)) != 0
|| ((special & (MG_DETECT | MG_BW_LAVA | MG_BW_ICE | MG_BW_SINK)) != 0
&& iflags.use_inverse)) {
term_start_attr(ATR_INVERSE);
inverse_on = TRUE;