From 8682cfd5447e4e0b176e9d9eaefd8d3b71de36c5 Mon Sep 17 00:00:00 2001 From: PatR Date: Sat, 4 Dec 2021 17:18:00 -0800 Subject: [PATCH] showrace again... I'm fairly sure that the 'showrace' and PC rogue cases are covered correctly now despite the approximation in deciding whether the specified glyph represents the hero. However, I'm not sure how the accessibility handling ought to work when the hero is not in normal form. Right now it kicks in if the glyph is any monster, so the hero is visible as a monster (whether normal or poly'd or on steed). It does not kick it when mimicking an object (after eating a mimic corpse or being poly'd into a mimic and then hiding) or furniture (only if poly'd into mimic) because execution won't make it into the is_you block in that situation. Same situation applies to setting the MG_HERO flag bit, but that doesn't seem to be used anywhere. --- src/display.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/display.c b/src/display.c index 21d047a06..f277d9dac 100644 --- a/src/display.c +++ b/src/display.c @@ -2173,8 +2173,12 @@ map_glyphinfo(xchar x, xchar y, int glyph, unsigned mgflags, int offset; boolean is_you = (x == u.ux && y == u.uy /* verify hero or steed (not something underneath - when hero is invisible without see invisible) */ - && canspotself()); + when hero is invisible without see invisible, + or a temporary display effect like an explosion); + this is only approximate, because hero might be + mimicking an object (after eating mimic corpse or + if polyd into mimic) or furniture (only if polyd) */ + && glyph_is_monster(glyph)); const glyph_map *gmap = &glyphmap[glyph]; glyphinfo->gm = *gmap; /* glyphflags, symidx, color, tileidx */ @@ -2188,13 +2192,14 @@ map_glyphinfo(xchar x, xchar y, int glyph, unsigned mgflags, */ if (is_you) { #ifdef TEXTCOLOR - if (!iflags.use_color || Upolyd) { - ; /* color tweak not needed (!use_color) or not wanted (Upolyd) */ + if (!iflags.use_color || glyph != hero_glyph) { + ; /* color tweak not needed (!use_color) or not wanted (poly'd + or riding--which uses steed's color, not hero's) */ } else if (HAS_ROGUE_IBM_GRAPHICS && g.symset[g.currentgraphics].nocolor == 0) { /* actually player should be yellow-on-gray if in corridor */ glyphinfo->gm.color = CLR_YELLOW; - } else if (flags.showrace && glyph == hero_glyph) { + } else if (flags.showrace) { /* for showrace, non-human hero is displayed by the symbol of corresponding type of monster rather than by '@' (handled by newsym()); we change the color to same as human hero */