Pets considered any noise made by hero as whistling

In 3.6.2 parts of the wakeup code were merged together, and this
caused pets consider any noise made by the hero - such as hitting
iron bars or digging - as whistling for them to come to the hero.

Change it to only consider actual whistling and ringing a bell.
This commit is contained in:
Pasi Kallinen
2024-04-03 12:42:38 +03:00
parent 6aaab97044
commit defb5d5f80
10 changed files with 31 additions and 23 deletions

View File

@@ -1390,6 +1390,7 @@ don't self-genocide if a monk picks "master-lich" or "masterlich" as target
(was matching "Master" rank)
Sunsword can be invoked to create a blinding ray
Excalibur is much harder to get if hero is not a knight
pets considered any noise made by hero made as whistling
Fixes to 3.7.0-x General Problems Exposed Via git Repository

View File

@@ -1716,7 +1716,7 @@ extern void m_respond(struct monst *) NONNULLARG1;
extern void setmangry(struct monst *, boolean) NONNULLARG1;
extern void wake_msg(struct monst *, boolean) NONNULLARG1;
extern void wakeup(struct monst *, boolean) NONNULLARG1;
extern void wake_nearby(void);
extern void wake_nearby(boolean);
extern void wake_nearto(coordxy, coordxy, int);
extern void seemimic(struct monst *) NONNULLARG1;
extern void normal_shape(struct monst *) NONNULLARG1;

View File

@@ -478,7 +478,7 @@ use_whistle(struct obj *obj)
else
You(whistle_str, obj->cursed ? "shrill" : "high");
Soundeffect(se_shrill_whistle, 50);
wake_nearby();
wake_nearby(TRUE);
if (obj->cursed)
vault_summon_gd();
}
@@ -492,7 +492,7 @@ use_magic_whistle(struct obj *obj)
} else if (obj->cursed && !rn2(2)) {
You("produce a %shigh-%s.", Underwater ? "very " : "",
Deaf ? "frequency vibration" : "pitched humming noise");
wake_nearby();
wake_nearby(TRUE);
} else {
/* it's magic! it works underwater too (at a higher pitch) */
You(Deaf ? alt_whistle_str : whistle_str,
@@ -1296,7 +1296,7 @@ use_bell(struct obj **optr)
obj->known = 1;
}
if (wakem)
wake_nearby();
wake_nearby(TRUE);
}
staticfn void

View File

@@ -313,7 +313,7 @@ dig(void)
Soundeffect(se_bang_weapon_side, 100);
pline("Bang! You hit with the broad side of %s!",
the(xname(uwep)));
wake_nearby();
wake_nearby(FALSE);
break;
default:
Your("swing misses its mark.");
@@ -511,7 +511,7 @@ dig(void)
if (!gd.did_dig_msg) {
You("hit the %s with all your might.", d_target[dig_target]);
wake_nearby();
wake_nearby(FALSE);
gd.did_dig_msg = TRUE;
}
}
@@ -674,7 +674,7 @@ digactualhole(coordxy x, coordxy y, struct monst *madeby, int ttyp)
else
add_damage(x, y, heros_fault ? SHOP_PIT_COST : 0L);
if (madeby_u)
wake_nearby();
wake_nearby(FALSE);
/* in case we're digging down while encased in solid rock
which is blocking levitation or flight */
switch_terrain();
@@ -864,7 +864,7 @@ dighole(boolean pit_only, boolean by_magic, coord *cc)
} else if (is_pool_or_lava(dig_x, dig_y)) {
pline_The("%s sloshes furiously for a moment, then subsides.",
hliquid(is_lava(dig_x, dig_y) ? "lava" : "water"));
wake_nearby(); /* splashing */
wake_nearby(FALSE); /* splashing */
} else if (old_typ == DRAWBRIDGE_DOWN
|| (is_drawbridge_wall(dig_x, dig_y) >= 0)) {
@@ -894,7 +894,7 @@ dighole(boolean pit_only, boolean by_magic, coord *cc)
*/
Soundeffect(se_kadoom_boulder_falls_in, 60);
pline("KADOOM! The boulder falls in!");
wake_nearby();
wake_nearby(FALSE);
(void) delfloortrap(ttmp);
}
delobj(boulder_here);
@@ -1160,7 +1160,7 @@ use_pick_axe2(struct obj *obj)
gn.nomovemsg = "You pull free.";
} else if (lev->typ == IRONBARS) {
pline("Clang!");
wake_nearby();
wake_nearby(FALSE);
} else if (IS_WATERWALL(lev->typ)) {
pline("Splash!");
} else if (lev->typ == LAVAWALL) {
@@ -1185,7 +1185,7 @@ use_pick_axe2(struct obj *obj)
if (vibrate)
losehp(Maybe_Half_Phys(2), "axing a hard object",
KILLED_BY);
wake_nearby();
wake_nearby(FALSE);
} else {
/* using a pick but dig_target is DIGTYPE_UNDIGGABLE
and there is at least one boulder or statue or both

View File

@@ -1366,7 +1366,7 @@ dokick(void)
return (gc.context.move ? ECMD_TIME : ECMD_OK);
}
wake_nearby();
wake_nearby(FALSE);
u_wipe_engr(2);
if (!isok(x, y)) {

View File

@@ -234,7 +234,7 @@ forcelock(void)
return ((gx.xlock.usedtime = 0));
}
} else /* blunt */
wake_nearby(); /* due to hammering on the container */
wake_nearby(FALSE); /* due to hammering on the container */
if (rn2(100) >= gx.xlock.chance)
return 1; /* still busy */

View File

@@ -24,6 +24,7 @@ staticfn void logdeadmon(struct monst *, int);
staticfn boolean ok_to_obliterate(struct monst *);
staticfn void qst_guardians_respond(void);
staticfn void peacefuls_respond(struct monst *);
staticfn void wake_nearto_core(coordxy, coordxy, int, boolean);
staticfn void m_restartcham(struct monst *);
staticfn boolean restrap(struct monst *);
staticfn int pick_animal(void);
@@ -4011,14 +4012,14 @@ wakeup(struct monst *mtmp, boolean via_attack)
/* Wake up nearby monsters without angering them. */
void
wake_nearby(void)
wake_nearby(boolean petcall)
{
wake_nearto(u.ux, u.uy, u.ulevel * 20);
wake_nearto_core(u.ux, u.uy, u.ulevel * 20, petcall);
}
/* Wake up monsters near some particular location. */
void
wake_nearto(coordxy x, coordxy y, int distance)
staticfn void
wake_nearto_core(coordxy x, coordxy y, int distance, boolean petcall)
{
struct monst *mtmp;
@@ -4032,7 +4033,7 @@ wake_nearto(coordxy x, coordxy y, int distance)
mtmp->msleeping = 0; /* wake indeterminate sleep */
if (!(mtmp->data->geno & G_UNIQ))
mtmp->mstrategy &= ~STRAT_WAITMASK; /* wake 'meditation' */
if (gc.context.mon_moving)
if (gc.context.mon_moving || !petcall)
continue;
if (mtmp->mtame) {
if (!mtmp->isminion)
@@ -4045,6 +4046,12 @@ wake_nearto(coordxy x, coordxy y, int distance)
disturb_buried_zombies(x, y);
}
void
wake_nearto(coordxy x, coordxy y, int distance)
{
wake_nearto_core(x, y, distance, FALSE);
}
/* NOTE: we must check for mimicry before calling this routine */
void
seemimic(struct monst *mtmp)

View File

@@ -2193,7 +2193,7 @@ prayer_done(void) /* M. Stephenson (1.0.3b) */
/* praying at an unaligned altar, not necessarily in Gehennom */
You("%s diabolical laughter all around you...",
!Deaf ? "hear" : "intuit");
wake_nearby();
wake_nearby(FALSE);
adjalign(-2);
exercise(A_WIS, FALSE);
if (!Inhell) {

View File

@@ -871,7 +871,7 @@ nh_timeout(void)
if ((inv_weight() > -500)) {
if (!Deaf)
You("make a lot of noise!");
wake_nearby();
wake_nearby(FALSE);
}
}
/* from outside means slippery ice; don't reset

View File

@@ -1374,7 +1374,7 @@ trapeffect_sqky_board(
Deaf ? "vibrates" : "squeaks ",
Deaf ? "" : trapnote(trap, FALSE),
Deaf ? "" : " loudly");
wake_nearby();
wake_nearby(FALSE);
}
} else {
boolean in_sight = canseemon(mtmp) || (mtmp == u.usteed);
@@ -6119,7 +6119,7 @@ chest_trap(
(boolean) shkp->mpeaceful, TRUE);
delobj(otmp);
}
wake_nearby();
wake_nearby(FALSE);
losehp(Maybe_Half_Phys(d(6, 6)), buf, KILLED_BY_AN);
exercise(A_STR, FALSE);
if (costly && loss) {
@@ -6418,7 +6418,7 @@ b_trapped(const char *item, int bodypart)
Soundeffect(se_kaboom, 80);
pline("KABOOM!! %s was booby-trapped!", The(item));
wake_nearby();
wake_nearby(FALSE);
losehp(Maybe_Half_Phys(dmg), "explosion", KILLED_BY_AN);
exercise(A_STR, FALSE);
if (bodypart != NO_PART)