diff --git a/doc/fixes35.0 b/doc/fixes35.0 index 42098bd68..fd3ef1c65 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -55,7 +55,7 @@ player polymorphed as a ceiling hider cannot reach the floor, but automatically unhide on #sit trappers do not hide on the ceiling non-magical whistles do not work underwater -try to restrict whistle use to monsters that can blow a whistle +try to restrict whistles and musical instruments to monsters that can blow Platform- and/or Interface-Specific Fixes diff --git a/include/extern.h b/include/extern.h index 671e85f2e..81e6c958e 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1204,6 +1204,7 @@ E boolean FDECL(can_blnd, (struct monst *,struct monst *,UCHAR_P,struct obj *)); E boolean FDECL(ranged_attk, (struct permonst *)); E boolean FDECL(hates_silver, (struct permonst *)); E boolean FDECL(passes_bars, (struct permonst *)); +E boolean FDECL(can_blow, (struct monst *)); E boolean FDECL(can_track, (struct permonst *)); E boolean FDECL(breakarm, (struct permonst *)); E boolean FDECL(sliparm, (struct permonst *)); diff --git a/src/apply.c b/src/apply.c index ee2252337..81589770c 100644 --- a/src/apply.c +++ b/src/apply.c @@ -389,9 +389,7 @@ STATIC_OVL void use_whistle(obj) struct obj *obj; { - if ((is_silent(youmonst.data) || youmonst.data->msound == MS_BUZZ) && - (breathless(youmonst.data) || verysmall(youmonst.data) || - !has_head(youmonst.data) || youmonst.data->mlet == S_EEL)) { + if (!can_blow(&youmonst)) { You("are incapable of using the whistle."); } else if(Underwater) { You("blow bubbles through %s.", yname(obj)); @@ -407,9 +405,7 @@ struct obj *obj; { register struct monst *mtmp, *nextmon; - if ((is_silent(youmonst.data) || youmonst.data->msound == MS_BUZZ) && - (breathless(youmonst.data) || verysmall(youmonst.data) || - !has_head(youmonst.data) || youmonst.data->mlet == S_EEL)) { + if (!can_blow(&youmonst)) { You("are incapable of using the whistle."); } else if (obj->cursed && !rn2(2)) { You("produce a %shigh-pitched humming noise.", diff --git a/src/mondata.c b/src/mondata.c index b9fd5b3ed..b580c4d83 100644 --- a/src/mondata.c +++ b/src/mondata.c @@ -246,6 +246,18 @@ struct permonst *mptr; (slithy(mptr) && !bigmonst(mptr))); } +boolean +can_blow(mtmp) /* returns TRUE if monster can blow (whistle, etc) */ +register struct monst *mtmp; +{ + if ((is_silent(mtmp->data) || mtmp->data->msound == MS_BUZZ) && + (breathless(mtmp->data) || verysmall(mtmp->data) || + !has_head(mtmp->data) || mtmp->data->mlet == S_EEL)) + return FALSE; + if ((mtmp == &youmonst) && Strangled) return FALSE; + return TRUE; +} + boolean can_track(ptr) /* returns TRUE if monster can track well */ register struct permonst *ptr; diff --git a/src/music.c b/src/music.c index d3ba97e49..e0412a581 100644 --- a/src/music.c +++ b/src/music.c @@ -487,6 +487,12 @@ struct obj *instr; if (Underwater) { You_cant("play music underwater!"); return(0); + } else if ((instr->otyp == WOODEN_FLUTE || instr->otyp == MAGIC_FLUTE || + instr->otyp == TOOLED_HORN || instr->otyp == FROST_HORN || + instr->otyp == FIRE_HORN || instr->otyp == BUGLE) && + !can_blow(&youmonst)) { + You("are incapable of playing %s.", the(distant_name(instr, xname))); + return(0); } if (instr->otyp != LEATHER_DRUM && instr->otyp != DRUM_OF_EARTHQUAKE) { c = yn("Improvise?");