pull request #939 - revise #wizsmell command
Pull request from entrez: add a funny message if player targets hero with #wizsmell command. I've modified it to put a "remembered, unseen monster" symbol on the map if sniffing a non-monster location reports a monster's smell and to remove that symbol if sniffing it reports "no monster there". Closes #939
This commit is contained in:
48
src/cmd.c
48
src/cmd.c
@@ -1916,14 +1916,14 @@ DISABLE_WARNING_CONDEXPR_IS_CONSTANT
|
|||||||
static int
|
static int
|
||||||
wiz_smell(void)
|
wiz_smell(void)
|
||||||
{
|
{
|
||||||
int ans = 0;
|
struct monst *mtmp; /* monster being smelled */
|
||||||
int mndx; /* monster index */
|
struct permonst *mptr;
|
||||||
coord cc; /* screen pos of unknown glyph */
|
int ans, glyph;
|
||||||
int glyph; /* glyph at selected position */
|
coord cc; /* screen pos to sniff */
|
||||||
|
boolean is_you;
|
||||||
|
|
||||||
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,36 @@ 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;
|
||||||
|
if (u_at(cc.x, cc.y)) {
|
||||||
|
if (u.usteed) {
|
||||||
|
mptr = u.usteed->data;
|
||||||
|
} else {
|
||||||
|
mptr = gy.youmonst.data;
|
||||||
|
is_you = TRUE;
|
||||||
|
}
|
||||||
|
} else if ((mtmp = m_at(cc.x, cc.y)) != (struct monst *) 0) {
|
||||||
|
mptr = mtmp->data;
|
||||||
|
} else {
|
||||||
|
mptr = (struct permonst *) 0;
|
||||||
|
}
|
||||||
|
/* Buglet: mapping or unmapping "remembered, unseen monster" should
|
||||||
|
cause time to elapse; since we're in wizmode, don't bother */
|
||||||
glyph = glyph_at(cc.x, cc.y);
|
glyph = glyph_at(cc.x, cc.y);
|
||||||
if (glyph_is_monster(glyph))
|
|
||||||
mndx = glyph_to_mon(glyph);
|
|
||||||
else
|
|
||||||
mndx = 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 not give off any smell.",
|
||||||
|
is_you ? "You seem" : "That monster seems");
|
||||||
|
if (!glyph_is_monster(glyph))
|
||||||
|
map_invisible(cc.x, cc.y);
|
||||||
|
} else {
|
||||||
|
You("don't smell any monster there.");
|
||||||
|
if (glyph_is_invisible(glyph))
|
||||||
|
unmap_invisible(cc.x, cc.y);
|
||||||
|
}
|
||||||
} while (TRUE);
|
} while (TRUE);
|
||||||
return ECMD_OK;
|
return ECMD_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user