looking at hidden monsters

Sometimes you can see a hidden monster without bringing it out of
hiding (wand of probing, blessed potion of monster detection) but
look_at wasn't mentioning the fact that the monster was hidden and
probing described mimics accurately but lumped all hiders together
as "concealed".  Describe all hidden monsters more consistently.
This commit is contained in:
PatR
2016-02-16 17:36:51 -08:00
parent f5b2a8c373
commit f132a12a07
5 changed files with 79 additions and 30 deletions

View File

@@ -160,6 +160,8 @@ lookup "More Info?" prompt will now tell you what it will look for on 'y'
using 'R' on armor would bypass some restrictions imposed by 'T' (inner layer
could be taken off from under outer layer, embedded scales could be
attempted but triggered "select_off" impossible)
when examining hidden monsters (probing, persistent monster detection), tell
how they're hidden (under an object, on the ceiling, etc)
Platform- and/or Interface-Specific Fixes

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 extern.h $NHDT-Date: 1454485430 2016/02/03 07:43:50 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.545 $ */
/* NetHack 3.6 extern.h $NHDT-Date: 1455672983 2016/02/17 01:36:23 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.548 $ */
/* Copyright (c) Steve Creps, 1988. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1675,7 +1675,11 @@ E void NDECL(msgtype_free);
/* ### pager.c ### */
E char *FDECL(self_lookat, (char *));
E void FDECL(mhidden_description, (struct monst *, BOOLEAN_P, char *));
E boolean FDECL(object_from_map, (int,int,int,struct obj **));
E int FDECL(do_screen_description, (coord, BOOLEAN_P, int, char *,
const char **));
E int FDECL(do_look, (int, coord *));
E int NDECL(dowhatis);
E int NDECL(doquickwhatis);
E int NDECL(doidtrap);
@@ -1683,9 +1687,6 @@ E int NDECL(dowhatdoes);
E char *FDECL(dowhatdoes_core, (CHAR_P, char *));
E int NDECL(dohelp);
E int NDECL(dohistory);
E int FDECL(do_screen_description,
(coord, BOOLEAN_P, int, char *, const char **));
E int FDECL(do_look, (int, coord *));
/* ### pcmain.c ### */

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 objnam.c $NHDT-Date: 1452043772 2016/01/06 01:29:32 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.163 $ */
/* NetHack 3.6 objnam.c $NHDT-Date: 1455672990 2016/02/17 01:36:30 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.165 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -3636,12 +3636,11 @@ const char *
mimic_obj_name(mtmp)
struct monst *mtmp;
{
if (mtmp->m_ap_type == M_AP_OBJECT
&& mtmp->mappearance != STRANGE_OBJECT) {
int idx = objects[mtmp->mappearance].oc_descr_idx;
if (mtmp->m_ap_type == M_AP_OBJECT) {
if (mtmp->mappearance == GOLD_PIECE)
return "gold";
return obj_descr[idx].oc_name;
if (mtmp->mappearance != STRANGE_OBJECT)
return simple_typename(mtmp->mappearance);
}
return "whatcha-may-callit";
}

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 pager.c $NHDT-Date: 1448482543 2015/11/25 20:15:43 $ $NHDT-Branch: master $:$NHDT-Revision: 1.86 $ */
/* NetHack 3.6 pager.c $NHDT-Date: 1455672994 2016/02/17 01:36:34 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.92 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -77,6 +77,60 @@ char *outbuf;
return outbuf;
}
/* describe a hidden monster; used for look_at during extended monster
detection and for probing */
void
mhidden_description(mon, altmon, outbuf)
struct monst *mon;
boolean altmon; /* for probing: if mimicking a monster, say so */
char *outbuf;
{
struct obj *otmp;
boolean fakeobj;
int x = mon->mx, y = mon->my, glyph = levl[x][y].glyph;
*outbuf = '\0';
if (mon->m_ap_type == M_AP_FURNITURE
|| mon->m_ap_type == M_AP_OBJECT) {
Strcpy(outbuf, ", mimicking ");
if (mon->m_ap_type == M_AP_FURNITURE) {
Strcat(outbuf, an(defsyms[mon->mappearance].explanation));
} else if (mon->m_ap_type == M_AP_OBJECT
/* remembered glyph, not glyph_at() which is 'mon' */
&& glyph_is_object(glyph)) {
objfrommap:
otmp = (struct obj *) 0;
fakeobj = object_from_map(glyph, x, y, &otmp);
Strcat(outbuf, (otmp && otmp->otyp != STRANGE_OBJECT)
? ansimpleoname(otmp)
: an(obj_descr[STRANGE_OBJECT].oc_name));
if (fakeobj)
dealloc_obj(otmp);
} else if (mon->m_ap_type == M_AP_MONSTER && altmon) {
Strcat(outbuf, an(mons[mon->mappearance].mname));
} else {
Strcat(outbuf, something);
}
} else if (mon->mundetected) {
Strcpy(outbuf, ", hiding");
if (hides_under(mon->data)) {
Strcat(outbuf, " under ");
/* remembered glyph, not glyph_at() which is 'mon' */
if (glyph_is_object(glyph))
goto objfrommap;
Strcat(outbuf, something);
} else if (is_hider(mon->data)) {
Sprintf(eos(outbuf), " on the %s",
(is_flyer(mon->data) || mon->data->mlet == S_PIERCER)
? "ceiling"
: surface(x, y)); /* trapper */
} else {
if (mon->data->mlet == S_EEL && is_pool(x, y))
Strcat(outbuf, " in murky water");
}
}
}
/* extracted from lookat(); also used by namefloorobj() */
boolean
object_from_map(glyph, x, y, obj_p)
@@ -156,11 +210,9 @@ int x, y;
char *name, monnambuf[BUFSZ];
boolean accurate = !Hallucination;
if (mtmp->data == &mons[PM_COYOTE] && accurate)
name = coyotename(mtmp, monnambuf);
else
name = distant_monnam(mtmp, ARTICLE_NONE, monnambuf);
name = (mtmp->data == &mons[PM_COYOTE] && accurate)
? coyotename(mtmp, monnambuf)
: distant_monnam(mtmp, ARTICLE_NONE, monnambuf);
Sprintf(buf, "%s%s%s",
(mtmp->mx != x || mtmp->my != y)
? ((mtmp->isshk && accurate) ? "tail of " : "tail of a ")
@@ -187,6 +239,11 @@ int x, y;
an(defsyms[trap_to_defsym(tt)].explanation));
}
/* we know the hero sees a monster at this location, but if it's shown
due to persistant monster detection he might remember something else */
if (mtmp->mundetected || mtmp->m_ap_type)
mhidden_description(mtmp, FALSE, eos(buf));
if (monbuf) {
unsigned how_seen = howmonseen(mtmp);
@@ -479,7 +536,8 @@ boolean user_typed_name, without_asking;
impossible("can't read 'data' file");
(void) dlb_fclose(fp);
return;
} else if (sscanf(buf, "%8lx\n", &txt_offset) < 1 || txt_offset == 0L)
} else if (sscanf(buf, "%8lx\n", &txt_offset) < 1
|| txt_offset == 0L)
goto bad_data_file;
/* look for the appropriate entry */

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 pline.c $NHDT-Date: 1432512770 2015/05/25 00:12:50 $ $NHDT-Branch: master $:$NHDT-Revision: 1.42 $ */
/* NetHack 3.6 pline.c $NHDT-Date: 1455672995 2016/02/17 01:36:35 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.48 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -406,17 +406,8 @@ register struct monst *mtmp;
Strcat(info, ", eating");
/* a stethoscope exposes mimic before getting here so this
won't be relevant for it, but wand of probing doesn't */
if (mtmp->m_ap_type)
Sprintf(eos(info), ", mimicking %s",
(mtmp->m_ap_type == M_AP_FURNITURE)
? an(defsyms[mtmp->mappearance].explanation)
: (mtmp->m_ap_type == M_AP_OBJECT)
? ((mtmp->mappearance == GOLD_PIECE)
? "gold"
: an(simple_typename(mtmp->mappearance)))
: (mtmp->m_ap_type == M_AP_MONSTER)
? an(mons[mtmp->mappearance].mname)
: something); /* impossible... */
if (mtmp->mundetected || mtmp->m_ap_type)
mhidden_description(mtmp, TRUE, eos(info));
if (mtmp->mcan)
Strcat(info, ", cancelled");
if (mtmp->mconf)
@@ -445,8 +436,6 @@ register struct monst *mtmp;
Strcat(info, mtmp->mspeed == MFAST ? ", fast" : mtmp->mspeed == MSLOW
? ", slow"
: ", ???? speed");
if (mtmp->mundetected)
Strcat(info, ", concealed");
if (mtmp->minvis)
Strcat(info, ", invisible");
if (mtmp == u.ustuck)