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 @@
/* 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);