Add 'mdistu' macro

Short for distu(mtmp->mx, mtmp->my) (i.e. the distance between the hero
and the specified monster), which is a very common use of distu().  The
idea is that this would be a convenient shorthand for it; I actually
thought it (or something very similar) existed already, but couldn't
find it when I tried to use it earlier.  Based on the number of uses of
fully-spelled-out 'distu(mtmp->mx, mtmp->my)' replaced in this commit
I'm guessing I just imagined it.
This commit is contained in:
Michael Meyer
2022-11-18 23:42:47 -08:00
committed by PatR
parent a0dfc94bbe
commit 619781dbb8
19 changed files with 46 additions and 50 deletions
+5 -6
View File
@@ -47,15 +47,14 @@
/* OR 2b. hero is using a telepathy inducing */ \ /* OR 2b. hero is using a telepathy inducing */ \
/* object and in range */ \ /* object and in range */ \
|| (Unblind_telepat \ || (Unblind_telepat \
&& (distu(mon->mx, mon->my) <= (BOLT_LIM * BOLT_LIM))))) && (mdistu(mon) <= (BOLT_LIM * BOLT_LIM)))))
/* organized to perform cheaper tests first; /* organized to perform cheaper tests first;
is_pool() vs is_pool_or_lava(): hero who is underwater can see adjacent is_pool() vs is_pool_or_lava(): hero who is underwater can see adjacent
lava, but presumeably any monster there is on top so not sensed */ lava, but presumeably any monster there is on top so not sensed */
#define _sensemon(mon) \ #define _sensemon(mon) \
( (!u.uswallow || (mon) == u.ustuck) \ ( (!u.uswallow || (mon) == u.ustuck) \
&& (!Underwater || (distu((mon)->mx, (mon)->my) <= 2 \ && (!Underwater || (mdistu(mon) <= 2 && is_pool((mon)->mx, (mon)->my))) \
&& is_pool((mon)->mx, (mon)->my))) \
&& (Detect_monsters || tp_sensemon(mon) || MATCH_WARN_OF_MON(mon)) ) && (Detect_monsters || tp_sensemon(mon) || MATCH_WARN_OF_MON(mon)) )
/* /*
@@ -63,7 +62,7 @@
* vicinity, and a glyph representing the warning level is displayed. * vicinity, and a glyph representing the warning level is displayed.
*/ */
#define _mon_warning(mon) \ #define _mon_warning(mon) \
(Warning && !(mon)->mpeaceful && (distu((mon)->mx, (mon)->my) < 100) \ (Warning && !(mon)->mpeaceful && (mdistu(mon) < 100) \
&& (((int) ((mon)->m_lev / 4)) >= g.context.warnlevel)) && (((int) ((mon)->m_lev / 4)) >= g.context.warnlevel))
/* /*
@@ -149,7 +148,7 @@
&& ((cansee((mon)->mx, (mon)->my) \ && ((cansee((mon)->mx, (mon)->my) \
&& (See_invisible || Detect_monsters)) \ && (See_invisible || Detect_monsters)) \
|| (!Blind && (HTelepat & ~INTRINSIC) \ || (!Blind && (HTelepat & ~INTRINSIC) \
&& distu((mon)->mx, (mon)->my) <= (BOLT_LIM * BOLT_LIM)))) && mdistu(mon) <= (BOLT_LIM * BOLT_LIM))))
/* /*
* is_safemon(mon) * is_safemon(mon)
+2
View File
@@ -715,6 +715,8 @@ enum optset_restrictions {
#define makeknown(x) discover_object((x), TRUE, TRUE) #define makeknown(x) discover_object((x), TRUE, TRUE)
#define distu(xx, yy) dist2((int)(xx), (int)(yy), (int) u.ux, (int) u.uy) #define distu(xx, yy) dist2((int)(xx), (int)(yy), (int) u.ux, (int) u.uy)
#define mdistu(mon) \
dist2((int) (mon)->mx, (int) (mon)->my, (int) u.ux, (int) u.uy)
#define onlineu(xx, yy) online2((int)(xx), (int)(yy), (int) u.ux, (int) u.uy) #define onlineu(xx, yy) online2((int)(xx), (int)(yy), (int) u.ux, (int) u.uy)
#define rn1(x, y) (rn2(x) + (y)) #define rn1(x, y) (rn2(x) + (y))
+1 -2
View File
@@ -3288,8 +3288,7 @@ use_pole(struct obj *obj, boolean autohit)
cc.y = u.uy; cc.y = u.uy;
if (!find_poleable_mon(&cc, min_range, max_range) && hitm if (!find_poleable_mon(&cc, min_range, max_range) && hitm
&& !DEADMONSTER(hitm) && sensemon(hitm) && !DEADMONSTER(hitm) && sensemon(hitm)
&& distu(hitm->mx, hitm->my) <= max_range && mdistu(hitm) <= max_range && mdistu(hitm) >= min_range) {
&& distu(hitm->mx, hitm->my) >= min_range) {
cc.x = hitm->mx; cc.x = hitm->mx;
cc.y = hitm->my; cc.y = hitm->my;
} }
+1 -1
View File
@@ -2035,7 +2035,7 @@ revive_corpse(struct obj *corpse)
pline("%s claws itself out of the ground!", pline("%s claws itself out of the ground!",
canspotmon(mtmp) ? Amonnam(mtmp) : Something); canspotmon(mtmp) ? Amonnam(mtmp) : Something);
newsym(mtmp->mx, mtmp->my); newsym(mtmp->mx, mtmp->my);
} else if (distu(mtmp->mx, mtmp->my) < 5*5) } else if (mdistu(mtmp) < 5*5)
You_hear("scratching noises."); You_hear("scratching noises.");
break; break;
} }
+1 -1
View File
@@ -26,7 +26,7 @@ static int passivemm(struct monst *, struct monst *, boolean, int,
static void static void
noises(register struct monst *magr, register struct attack *mattk) noises(register struct monst *magr, register struct attack *mattk)
{ {
boolean farq = (distu(magr->mx, magr->my) > 15); boolean farq = (mdistu(magr) > 15);
if (!Deaf && (farq != g.far_noise || g.moves - g.noisetime > 10)) { if (!Deaf && (farq != g.far_noise || g.moves - g.noisetime > 10)) {
g.far_noise = farq; g.far_noise = farq;
+2 -2
View File
@@ -404,7 +404,7 @@ mattacku(register struct monst *mtmp)
* excessively verbose miss feedback when monster can do multiple * excessively verbose miss feedback when monster can do multiple
* attacks and would miss the same wrong spot each time.) * attacks and would miss the same wrong spot each time.)
*/ */
boolean ranged = (distu(mtmp->mx, mtmp->my) > 3), boolean ranged = (mdistu(mtmp) > 3),
range2 = !monnear(mtmp, mtmp->mux, mtmp->muy), range2 = !monnear(mtmp, mtmp->mux, mtmp->muy),
foundyou = u_at(mtmp->mux, mtmp->muy), foundyou = u_at(mtmp->mux, mtmp->muy),
youseeit = canseemon(mtmp), youseeit = canseemon(mtmp),
@@ -1606,7 +1606,7 @@ gazemu(struct monst *mtmp, struct attack *mattk)
break; break;
case AD_BLND: case AD_BLND:
if (canseemon(mtmp) && !resists_blnd(&g.youmonst) if (canseemon(mtmp) && !resists_blnd(&g.youmonst)
&& distu(mtmp->mx, mtmp->my) <= BOLT_LIM * BOLT_LIM) { && mdistu(mtmp) <= BOLT_LIM * BOLT_LIM) {
if (cancelled) { if (cancelled) {
react = rn1(2, 2); /* "puzzled" || "dazzled" */ react = rn1(2, 2); /* "puzzled" || "dazzled" */
already = (mtmp->mcansee == 0); already = (mtmp->mcansee == 0);
+4 -4
View File
@@ -1053,7 +1053,7 @@ movemon_singlemon(struct monst *mtmp)
* have died if it returns 1. * have died if it returns 1.
*/ */
if (cansee(mtmp->mx, mtmp->my) if (cansee(mtmp->mx, mtmp->my)
&& (distu(mtmp->mx, mtmp->my) <= BOLT_LIM * BOLT_LIM) && (mdistu(mtmp) <= BOLT_LIM * BOLT_LIM)
&& fightm(mtmp)) && fightm(mtmp))
return FALSE; /* mon might have died */ return FALSE; /* mon might have died */
} }
@@ -2988,7 +2988,7 @@ set_ustuck(struct monst *mtmp)
if (iflags.sanity_check || iflags.debug_fuzzer) { if (iflags.sanity_check || iflags.debug_fuzzer) {
if (mtmp && !next2u(mtmp->mx, mtmp->my)) if (mtmp && !next2u(mtmp->mx, mtmp->my))
impossible("Sticking to %s at distu %d?", impossible("Sticking to %s at distu %d?",
mon_nam(mtmp), distu(mtmp->mx, mtmp->my)); mon_nam(mtmp), mdistu(mtmp));
} }
g.context.botl = 1; g.context.botl = 1;
@@ -4212,7 +4212,7 @@ decide_to_shapeshift(struct monst *mon, int shiftflags)
} else if (mon->data == &mons[PM_FOG_CLOUD] } else if (mon->data == &mons[PM_FOG_CLOUD]
&& mon->mhp == mon->mhpmax && !rn2(4) && mon->mhp == mon->mhpmax && !rn2(4)
&& (!canseemon(mon) && (!canseemon(mon)
|| distu(mon->mx, mon->my) > BOLT_LIM * BOLT_LIM)) { || mdistu(mon) > BOLT_LIM * BOLT_LIM)) {
/* if a fog cloud, maybe change to wolf or vampire bat; /* if a fog cloud, maybe change to wolf or vampire bat;
those are more likely to take damage--at least when those are more likely to take damage--at least when
tame--and then switch back to vampire; they'll also tame--and then switch back to vampire; they'll also
@@ -4234,7 +4234,7 @@ decide_to_shapeshift(struct monst *mon, int shiftflags)
} else { } else {
if (mon->mhp >= 9 * mon->mhpmax / 10 && !rn2(6) if (mon->mhp >= 9 * mon->mhpmax / 10 && !rn2(6)
&& (!canseemon(mon) && (!canseemon(mon)
|| distu(mon->mx, mon->my) > BOLT_LIM * BOLT_LIM)) || mdistu(mon) > BOLT_LIM * BOLT_LIM))
dochng = TRUE; /* 'ptr' stays Null */ dochng = TRUE; /* 'ptr' stays Null */
} }
} }
+4 -5
View File
@@ -33,8 +33,7 @@ mb_trapped(struct monst *mtmp, boolean canseeit)
pline("KABOOM!! You see a door explode."); pline("KABOOM!! You see a door explode.");
else if (!Deaf) else if (!Deaf)
You_hear("a %s explosion.", You_hear("a %s explosion.",
(distu(mtmp->mx, mtmp->my) > 7 * 7) ? "distant" (mdistu(mtmp) > 7 * 7) ? "distant" : "nearby");
: "nearby");
} }
wake_nearto(mtmp->mx, mtmp->my, 7 * 7); wake_nearto(mtmp->mx, mtmp->my, 7 * 7);
mtmp->mstun = 1; mtmp->mstun = 1;
@@ -153,7 +152,7 @@ dochugw(
/* monster is hostile and can attack (or hallu distorts knowledge) */ /* monster is hostile and can attack (or hallu distorts knowledge) */
&& (Hallucination || (!mtmp->mpeaceful && !noattacks(mtmp->data))) && (Hallucination || (!mtmp->mpeaceful && !noattacks(mtmp->data)))
/* it's close enough to be a threat */ /* it's close enough to be a threat */
&& distu(mtmp->mx, mtmp->my) <= (BOLT_LIM + 1) * (BOLT_LIM + 1) && mdistu(mtmp) <= (BOLT_LIM + 1) * (BOLT_LIM + 1)
/* and either couldn't see it before, or it was too far away */ /* and either couldn't see it before, or it was too far away */
&& (!already_saw_mon || !couldsee(x, y) && (!already_saw_mon || !couldsee(x, y)
|| distu(x, y) > (BOLT_LIM + 1) * (BOLT_LIM + 1)) || distu(x, y) > (BOLT_LIM + 1) * (BOLT_LIM + 1))
@@ -257,7 +256,7 @@ disturb(register struct monst *mtmp)
* Aggravate or mon is (dog or human) or * Aggravate or mon is (dog or human) or
* (1/7 and mon is not mimicing furniture or object) * (1/7 and mon is not mimicing furniture or object)
*/ */
if (couldsee(mtmp->mx, mtmp->my) && distu(mtmp->mx, mtmp->my) <= 100 if (couldsee(mtmp->mx, mtmp->my) && mdistu(mtmp) <= 100
&& (!Stealth || (mtmp->data == &mons[PM_ETTIN] && rn2(10))) && (!Stealth || (mtmp->data == &mons[PM_ETTIN] && rn2(10)))
&& (!(mtmp->data->mlet == S_NYMPH && (!(mtmp->data->mlet == S_NYMPH
|| mtmp->data == &mons[PM_JABBERWOCK] || mtmp->data == &mons[PM_JABBERWOCK]
@@ -477,7 +476,7 @@ mind_blast(register struct monst* mtmp)
if (canseemon(mtmp)) if (canseemon(mtmp))
pline("%s concentrates.", Monnam(mtmp)); pline("%s concentrates.", Monnam(mtmp));
if (distu(mtmp->mx, mtmp->my) > BOLT_LIM * BOLT_LIM) { if (mdistu(mtmp) > BOLT_LIM * BOLT_LIM) {
You("sense a faint wave of psychic energy."); You("sense a faint wave of psychic energy.");
return; return;
} }
+1 -1
View File
@@ -826,7 +826,7 @@ spitmm(struct monst* mtmp, struct attack* mattk, struct monst* mtarg)
struct obj *otmp; struct obj *otmp;
if (mtmp->mcan) { if (mtmp->mcan) {
if (!Deaf && distu(mtmp->mx, mtmp->my) < BOLT_LIM * BOLT_LIM) { if (!Deaf && mdistu(mtmp) < BOLT_LIM * BOLT_LIM) {
if (canspotmon(mtmp)) { if (canspotmon(mtmp)) {
pline("A dry rattle comes from %s throat.", pline("A dry rattle comes from %s throat.",
s_suffix(mon_nam(mtmp))); s_suffix(mon_nam(mtmp)));
+5 -5
View File
@@ -133,7 +133,7 @@ precheck(struct monst* mon, struct obj* obj)
? (BOLT_LIM + 1) : (BOLT_LIM - 3); ? (BOLT_LIM + 1) : (BOLT_LIM - 3);
You_hear("a zap and an explosion %s.", You_hear("a zap and an explosion %s.",
(distu(mon->mx, mon->my) <= range * range) (mdistu(mon) <= range * range)
? "nearby" : "in the distance"); ? "nearby" : "in the distance");
} }
m_useup(mon, obj); m_useup(mon, obj);
@@ -164,7 +164,7 @@ mzapwand(
int range = couldsee(mtmp->mx, mtmp->my) /* 9 or 5 */ int range = couldsee(mtmp->mx, mtmp->my) /* 9 or 5 */
? (BOLT_LIM + 1) : (BOLT_LIM - 3); ? (BOLT_LIM + 1) : (BOLT_LIM - 3);
You_hear("a %s zap.", (distu(mtmp->mx, mtmp->my) <= range * range) You_hear("a %s zap.", (mdistu(mtmp) <= range * range)
? "nearby" : "distant"); ? "nearby" : "distant");
unknow_object(otmp); /* hero loses info when unseen obj is used */ unknow_object(otmp); /* hero loses info when unseen obj is used */
} else if (self) { } else if (self) {
@@ -192,8 +192,8 @@ mplayhorn(
? (BOLT_LIM + 1) : (BOLT_LIM - 3); ? (BOLT_LIM + 1) : (BOLT_LIM - 3);
You_hear("a horn being played %s.", You_hear("a horn being played %s.",
(distu(mtmp->mx, mtmp->my) <= range * range) (mdistu(mtmp) <= range * range)
? "nearby" : "in the distance"); ? "nearby" : "in the distance");
unknow_object(otmp); /* hero loses info when unseen obj is used */ unknow_object(otmp); /* hero loses info when unseen obj is used */
} else if (self) { } else if (self) {
otmp->dknown = 1; otmp->dknown = 1;
@@ -2063,7 +2063,7 @@ mloot_container(
takeout_count = 4; takeout_count = 4;
break; break;
} }
howfar = distu(mon->mx, mon->my); howfar = mdistu(mon);
nearby = (howfar <= 7 * 7); nearby = (howfar <= 7 * 7);
contnr_nam[0] = mpronounbuf[0] = '\0'; contnr_nam[0] = mpronounbuf[0] = '\0';
if (vismon) { if (vismon) {
+6 -6
View File
@@ -50,7 +50,7 @@ awaken_monsters(int distance)
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) { for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
if (DEADMONSTER(mtmp)) if (DEADMONSTER(mtmp))
continue; continue;
if ((distm = distu(mtmp->mx, mtmp->my)) < distance) { if ((distm = mdistu(mtmp)) < distance) {
mtmp->msleeping = 0; mtmp->msleeping = 0;
mtmp->mcanmove = 1; mtmp->mcanmove = 1;
mtmp->mfrozen = 0; mtmp->mfrozen = 0;
@@ -79,7 +79,7 @@ put_monsters_to_sleep(int distance)
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) { for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
if (DEADMONSTER(mtmp)) if (DEADMONSTER(mtmp))
continue; continue;
if (distu(mtmp->mx, mtmp->my) < distance if (mdistu(mtmp) < distance
&& sleep_monst(mtmp, d(10, 10), TOOL_CLASS)) { && sleep_monst(mtmp, d(10, 10), TOOL_CLASS)) {
mtmp->msleeping = 1; /* 10d10 turns + wake_nearby to rouse */ mtmp->msleeping = 1; /* 10d10 turns + wake_nearby to rouse */
slept_monst(mtmp); slept_monst(mtmp);
@@ -101,7 +101,7 @@ charm_snakes(int distance)
if (DEADMONSTER(mtmp)) if (DEADMONSTER(mtmp))
continue; continue;
if (mtmp->data->mlet == S_SNAKE && mtmp->mcanmove if (mtmp->data->mlet == S_SNAKE && mtmp->mcanmove
&& distu(mtmp->mx, mtmp->my) < distance) { && mdistu(mtmp) < distance) {
was_peaceful = mtmp->mpeaceful; was_peaceful = mtmp->mpeaceful;
mtmp->mpeaceful = 1; mtmp->mpeaceful = 1;
mtmp->mavenge = 0; mtmp->mavenge = 0;
@@ -134,7 +134,7 @@ calm_nymphs(int distance)
if (DEADMONSTER(mtmp)) if (DEADMONSTER(mtmp))
continue; continue;
if (mtmp->data->mlet == S_NYMPH && mtmp->mcanmove if (mtmp->data->mlet == S_NYMPH && mtmp->mcanmove
&& distu(mtmp->mx, mtmp->my) < distance) { && mdistu(mtmp) < distance) {
mtmp->msleeping = 0; mtmp->msleeping = 0;
mtmp->mpeaceful = 1; mtmp->mpeaceful = 1;
mtmp->mavenge = 0; mtmp->mavenge = 0;
@@ -170,7 +170,7 @@ awaken_soldiers(struct monst* bugler /* monster that played instrument */)
Norep("%s the rattle of battle gear being readied.", Norep("%s the rattle of battle gear being readied.",
"You hear"); /* Deaf-aware */ "You hear"); /* Deaf-aware */
} else if ((distm = ((bugler == &g.youmonst) } else if ((distm = ((bugler == &g.youmonst)
? distu(mtmp->mx, mtmp->my) ? mdistu(mtmp)
: dist2(bugler->mx, bugler->my, mtmp->mx, : dist2(bugler->mx, bugler->my, mtmp->mx,
mtmp->my))) < distance) { mtmp->my))) < distance) {
mtmp->msleeping = 0; mtmp->msleeping = 0;
@@ -204,7 +204,7 @@ charm_monsters(int distance)
if (DEADMONSTER(mtmp)) if (DEADMONSTER(mtmp))
continue; continue;
if (distu(mtmp->mx, mtmp->my) <= distance) { if (mdistu(mtmp) <= distance) {
/* a shopkeeper can't be tamed but tamedog() pacifies an angry /* a shopkeeper can't be tamed but tamedog() pacifies an angry
one; do that even if mtmp resists in order to behave the same one; do that even if mtmp resists in order to behave the same
as a non-cursed scroll of taming or spell of charm monster */ as a non-cursed scroll of taming or spell of charm monster */
+2 -2
View File
@@ -2188,8 +2188,8 @@ reverse_loot(void)
if (coffers->spe == 2) if (coffers->spe == 2)
break; /* a throne room chest */ break; /* a throne room chest */
if (!otmp if (!otmp
|| distu(coffers->ox, coffers->oy) || (distu(coffers->ox, coffers->oy)
< distu(otmp->ox, otmp->oy)) < distu(otmp->ox, otmp->oy)))
otmp = coffers; /* remember closest ordinary chest */ otmp = coffers; /* remember closest ordinary chest */
} }
if (!coffers) if (!coffers)
+1 -1
View File
@@ -1782,7 +1782,7 @@ domindblast(void)
nmon = mtmp->nmon; nmon = mtmp->nmon;
if (DEADMONSTER(mtmp)) if (DEADMONSTER(mtmp))
continue; continue;
if (distu(mtmp->mx, mtmp->my) > BOLT_LIM * BOLT_LIM) if (mdistu(mtmp) > BOLT_LIM * BOLT_LIM)
continue; continue;
if (mtmp->mpeaceful) if (mtmp->mpeaceful)
continue; continue;
+1 -1
View File
@@ -2192,7 +2192,7 @@ doturn(void)
#turn operating through walls, not to require that the hero be #turn operating through walls, not to require that the hero be
able to see the target location */ able to see the target location */
if (!couldsee(mtmp->mx, mtmp->my) if (!couldsee(mtmp->mx, mtmp->my)
|| distu(mtmp->mx, mtmp->my) > range) || mdistu(mtmp) > range)
continue; continue;
if (!mtmp->mpeaceful if (!mtmp->mpeaceful
+2 -3
View File
@@ -3650,8 +3650,7 @@ shk_fixes_damage(struct monst *shkp)
if (!dam) if (!dam)
return; return;
shk_closeby = (distu(shkp->mx, shkp->my) shk_closeby = (mdistu(shkp) <= (BOLT_LIM / 2) * (BOLT_LIM / 2));
<= (BOLT_LIM / 2) * (BOLT_LIM / 2));
if (canseemon(shkp)) if (canseemon(shkp))
pline("%s whispers %s.", Shknam(shkp), pline("%s whispers %s.", Shknam(shkp),
@@ -4221,7 +4220,7 @@ pay_for_damage(const char* dmgstr, boolean cant_mollify)
} }
if (!inhishop(tmp_shk)) if (!inhishop(tmp_shk))
continue; continue;
shk_distance = distu(tmp_shk->mx, tmp_shk->my); shk_distance = mdistu(tmp_shk);
if (shk_distance > nearest_shk) if (shk_distance > nearest_shk)
continue; continue;
if ((shk_distance == nearest_shk) && picks) { if ((shk_distance == nearest_shk) && picks) {
+1 -1
View File
@@ -302,7 +302,7 @@ deadbook(struct obj* book2)
&& cansee(mtmp->mx, mtmp->my)) { && cansee(mtmp->mx, mtmp->my)) {
mtmp->mpeaceful = TRUE; mtmp->mpeaceful = TRUE;
if (sgn(mtmp->data->maligntyp) == sgn(u.ualign.type) if (sgn(mtmp->data->maligntyp) == sgn(u.ualign.type)
&& distu(mtmp->mx, mtmp->my) < 4) && mdistu(mtmp) < 4)
if (mtmp->mtame) { if (mtmp->mtame) {
if (mtmp->mtame < 20) if (mtmp->mtame < 20)
mtmp->mtame++; mtmp->mtame++;
+5 -5
View File
@@ -1264,8 +1264,8 @@ trapeffect_sqky_board(
? (BOLT_LIM + 1) : (BOLT_LIM - 3); ? (BOLT_LIM + 1) : (BOLT_LIM - 3);
You_hear("%s squeak %s.", trapnote(trap, FALSE), You_hear("%s squeak %s.", trapnote(trap, FALSE),
(distu(mtmp->mx, mtmp->my) <= range * range) (mdistu(mtmp) <= range * range)
? "nearby" : "in the distance"); ? "nearby" : "in the distance");
} }
/* wake up nearby monsters */ /* wake up nearby monsters */
wake_nearto(mtmp->mx, mtmp->my, 40); wake_nearto(mtmp->mx, mtmp->my, 40);
@@ -2456,8 +2456,8 @@ trapeffect_vibrating_square(
/* notice something (hearing uses a larger threshold /* notice something (hearing uses a larger threshold
for 'nearby') */ for 'nearby') */
You_see("the ground vibrate %s.", You_see("the ground vibrate %s.",
(distu(mtmp->mx, mtmp->my) <= 2 * 2) (mdistu(mtmp) <= 2 * 2)
? "nearby" : "in the distance"); ? "nearby" : "in the distance");
} }
} }
} }
@@ -2860,7 +2860,7 @@ launch_obj(
You_hear("someone bowling."); You_hear("someone bowling.");
} else { } else {
You_hear("rumbling %s.", (distu(x1, y1) <= 4 * 4) ? "nearby" You_hear("rumbling %s.", (distu(x1, y1) <= 4 * 4) ? "nearby"
: "in the distance"); : "in the distance");
} }
} }
+1 -1
View File
@@ -2133,7 +2133,7 @@ howmonseen(struct monst *mon)
if (tp_sensemon(mon)) if (tp_sensemon(mon))
how_seen |= MONSEEN_TELEPAT; how_seen |= MONSEEN_TELEPAT;
/* xray */ /* xray */
if (useemon && xraydist > 0 && distu(mon->mx, mon->my) <= xraydist) if (useemon && xraydist > 0 && mdistu(mon) <= xraydist)
how_seen |= MONSEEN_XRAYVIS; how_seen |= MONSEEN_XRAYVIS;
/* extended detection */ /* extended detection */
if (Detect_monsters) if (Detect_monsters)
+1 -3
View File
@@ -863,9 +863,7 @@ mon_wield_item(struct monst *mon)
/* 3.6.3: artifact might be getting wielded by invisible monst */ /* 3.6.3: artifact might be getting wielded by invisible monst */
else if (cansee(mon->mx, mon->my)) else if (cansee(mon->mx, mon->my))
pline("Light begins shining %s.", pline("Light begins shining %s.",
(distu(mon->mx, mon->my) <= 5 * 5) (mdistu(mon) <= 5 * 5) ? "nearby" : "in the distance");
? "nearby"
: "in the distance");
} }
obj->owornmask = W_WEP; obj->owornmask = W_WEP;
return 1; return 1;