Add a funny message for smelling yourself

I know this is inane, especially for a little-used debug-mode-only
command, but I can't get it out of my head...

The use of the actual monster data instead of the glyph as a proxy ought
to make it somewhat more consistent as well (e.g. hallucination and
'showrace' won't affect the results), though I think that'd hardly be
worth it were it not for the incredibly funny message.
This commit is contained in:
Michael Meyer
2022-11-28 22:37:34 -05:00
committed by PatR
parent b3b7e8c19c
commit 8c831fcad0

View File

@@ -1916,14 +1916,14 @@ DISABLE_WARNING_CONDEXPR_IS_CONSTANT
static int static int
wiz_smell(void) wiz_smell(void)
{ {
struct monst *mtmp; /* monster being smelled */
struct permonst *mptr;
int ans = 0; int ans = 0;
int mndx; /* monster index */ coord cc; /* screen pos to sniff */
coord cc; /* screen pos of unknown glyph */ boolean is_you;
int glyph; /* glyph at selected position */
cc.x = u.ux; cc.x = u.ux;
cc.y = u.uy; cc.y = u.uy;
mndx = 0; /* gcc -Wall lint */
if (!olfaction(gy.youmonst.data)) { if (!olfaction(gy.youmonst.data)) {
You("are incapable of detecting odors in your present form."); You("are incapable of detecting odors in your present form.");
return ECMD_OK; return ECMD_OK;
@@ -1936,18 +1936,29 @@ wiz_smell(void)
if (ans < 0 || cc.x < 0) { if (ans < 0 || cc.x < 0) {
return ECMD_CANCEL; /* done */ return ECMD_CANCEL; /* done */
} }
/* Convert the glyph at the selected position to a mndxbol. */ is_you = FALSE;
glyph = glyph_at(cc.x, cc.y); if (u_at(cc.x, cc.y)) {
if (glyph_is_monster(glyph)) if (u.usteed) {
mndx = glyph_to_mon(glyph); mptr = u.usteed->data;
else } else {
mndx = 0; mptr = gy.youmonst.data;
is_you = TRUE;
}
} else if ((mtmp = m_at(cc.x, cc.y)) && canspotmon(mtmp)) {
mptr = mtmp->data;
} else {
mptr = (struct permonst *) 0;
}
/* Is it a monster? */ /* Is it a monster? */
if (mndx) { if (mptr) {
if (!usmellmon(&mons[mndx])) if (is_you)
pline("That monster seems to give off no smell."); You("surreptitiously sniff under your %s.", body_part(ARM));
} else if (!usmellmon(mptr))
pline("That is not a monster."); pline("%s to give off no smell.",
is_you ? "You seem" : "That monster seems");
} else {
You("see no monster there.");
}
} while (TRUE); } while (TRUE);
return ECMD_OK; return ECMD_OK;
} }