fix part of #H9467 - clairvoyance vs sensed mons

When a monster is drawn on the map, remove any "remembered, unseen
monster" glyph being shown at the same spot.  Clairvoyance shows
all monsters in vicinty, then ones which can't be seen are replaced
with the 'I' glyph (which is on the object layer or the display,
not the monster layer show is subject to different update behavior).
But subsequent monster refresh didn't get rid of it when a sensed
monster was displayed over it.  (3.6.1 included a similar fix for
warned-of monsters.)

Also during clairvoyance, don't draw an 'I' at a spot that will
immediately be refreshed with a monster because 'I' clobbers any
remembered object at the same location.
This commit is contained in:
PatR
2019-11-27 11:24:23 -08:00
parent cc3152dc9a
commit 0c98a30b8d
3 changed files with 40 additions and 14 deletions

View File

@@ -1,4 +1,4 @@
$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.191 $ $NHDT-Date: 1574722861 2019/11/25 23:01:01 $
$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.192 $ $NHDT-Date: 1574882658 2019/11/27 19:24:18 $
This fixes36.3 file is here to capture information about updates in the 3.6.x
lineage following the release of 3.6.2 in May 2019. Please note, however,
@@ -306,6 +306,14 @@ look-at of mimics mimicking altars got an arbitary alignment from misuse of
underlying terrain
polymorph_sink creating an altar passed a call to rn2() as an argument to a
macro which evaluates its parameter more than once
if a monster (presumably sensed but not seen) was displayed at a location
showing "remembered, unseen monster", remove that since hero now knows
something else is there (3.6.1 had similar fix for warned-of monsters)
clairvoyance showed all monsters in range, then after player viewed the map,
replaced them with "remembered, unseen monster" glyph and finally
did a normal monster refresh; the 'I' glyph step clobbers remembered
object at same spot, so skip it for locations where monster refresh
is going to immediately redisplay a monster
unix: fix double DLB definition in linux hints file
windows: fix --showpaths output for the data file which relies on being
constructed programmatically to incorporate the version suffix

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 detect.c $NHDT-Date: 1562630266 2019/07/08 23:57:46 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.96 $ */
/* NetHack 3.6 detect.c $NHDT-Date: 1574882659 2019/11/27 19:24:19 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.99 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2018. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1416,8 +1416,13 @@ struct obj *sobj; /* scroll--actually fake spellbook--object */
continue;
newglyph = glyph_at(zx, zy);
if (glyph_is_monster(newglyph)
&& glyph_to_mon(newglyph) != PM_LONG_WORM_TAIL)
map_invisible(zx, zy);
&& glyph_to_mon(newglyph) != PM_LONG_WORM_TAIL) {
/* map_invisible() was unconditional here but that made
remembered objects be forgotten for the case where a
monster is immediately redrawn by see_monsters() */
if ((mtmp = m_at(zx, zy)) == 0 || !canspotmon(mtmp))
map_invisible(zx, zy);
}
}
see_monsters();

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 display.c $NHDT-Date: 1573934698 2019/11/16 20:04:58 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.107 $ */
/* NetHack 3.6 display.c $NHDT-Date: 1574882660 2019/11/27 19:24:20 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.108 $ */
/* Copyright (c) Dean Luick, with acknowledgements to Kevin Darcy */
/* and Dave Cohrs, 1990. */
/* NetHack may be freely redistributed. See license for details. */
@@ -123,6 +123,7 @@
*/
#include "hack.h"
STATIC_DCL void FDECL(show_mon_or_warn, (int, int, int));
STATIC_DCL void FDECL(display_monster,
(XCHAR_P, XCHAR_P, struct monst *, int, XCHAR_P));
STATIC_DCL int FDECL(swallow_to_glyph, (int, int));
@@ -361,6 +362,25 @@ int x, y, show;
_map_location(x, y, show);
}
/* display something on monster layer; may need to fixup object layer */
STATIC_OVL void
show_mon_or_warn(x, y, monglyph)
int x, y, monglyph;
{
struct obj *o;
/* "remembered, unseen monster" is tracked by object layer so if we're
putting something on monster layer at same spot, stop remembering
that; if an object is in view there, start remembering it instead */
if (glyph_is_invisible(levl[x][y].glyph)) {
unmap_object(x, y);
if (cansee(x, y) && (o = vobj_at(x, y)) != 0)
map_object(o, FALSE);
}
show_glyph(x, y, monglyph);
}
#define DETECTED 2
#define PHYSICALLY_SEEN 1
#define is_worm_tail(mon) ((mon) && ((x != (mon)->mx) || (y != (mon)->my)))
@@ -477,7 +497,7 @@ xchar worm_tail; /* mon is actually a worm tail */
else
num = mon_to_glyph(mon, rn2_on_display_rng);
}
show_glyph(x, y, num);
show_mon_or_warn(x, y, num);
}
}
@@ -507,14 +527,7 @@ register struct monst *mon;
impossible("display_warning did not match warning type?");
return;
}
/* warning glyph is drawn on the monster layer; unseen
monster glyph is drawn on the object/trap/floor layer;
if we see a 'warning' move onto 'remembered, unseen' we
need to explicitly remove that in order for it to not
reappear when the warned-of monster moves off that spot */
if (glyph_is_invisible(levl[x][y].glyph))
unmap_object(x, y);
show_glyph(x, y, glyph);
show_mon_or_warn(x, y, glyph);
}
int