fix #H9392 - deafness vs music

Music wasn't using You_hear() so needs to handle Deaf itself.  Have
it give alternate messages for sounds being emitted from instruments.

This doesn't implement the suggestion that a Deaf hero shouldn't be
able to produce the same music as a non-deaf one.
This commit is contained in:
PatR
2019-11-03 18:12:55 -08:00
parent 6b88a19365
commit f29a6b164d
2 changed files with 54 additions and 22 deletions

View File

@@ -1,4 +1,4 @@
$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.151 $ $NHDT-Date: 1572530225 2019/10/31 13:57:05 $
$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.155 $ $NHDT-Date: 1572833562 2019/11/04 02:12:42 $
This fixes36.3 file is here to capture information about updates in the 3.6.x
lineage following the release of 3.6.2 in May 2019. Please note, however,
@@ -212,6 +212,7 @@ when entering Astral level, initial rendering of guardian angel didn't show
it as tame; noticeable if the level was entered with 'hilite_pet' On
fix a leashed pet polymorphed into a long worm staying leashed
prevent leashing unsolid monsters and monsters with no extremities
playing musical instruments gave feedback which ignored deafness
Fixes to Post-3.6.2 Problems that Were Exposed Via git Repository

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 music.c $NHDT-Date: 1544442713 2018/12/10 11:51:53 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.57 $ */
/* NetHack 3.6 music.c $NHDT-Date: 1572833563 2019/11/04 02:12:43 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.58 $ */
/* Copyright (c) 1989 by Jean-Christophe Collet */
/* NetHack may be freely redistributed. See license for details. */
@@ -187,7 +187,7 @@ struct monst *bugler; /* monster that played instrument */
mtmp->mstrategy &= ~STRAT_WAITMASK;
if (canseemon(mtmp))
pline("%s is now ready for battle!", Monnam(mtmp));
else
else if (!Deaf)
Norep("You hear the rattle of battle gear being readied.");
} else if ((distm = ((bugler == &youmonst)
? distu(mtmp->mx, mtmp->my)
@@ -301,7 +301,7 @@ int force;
/*FALLTHRU*/
case ROOM:
case CORR: /* Try to make a pit */
do_pit:
do_pit:
chasm = maketrap(x, y, PIT);
if (!chasm)
break; /* no pit if portal at that location */
@@ -483,6 +483,7 @@ struct obj *instr;
itmp.otyp -= 1;
mundane = TRUE;
}
#ifdef MAC
mac_speaker(&itmp, "C");
#endif
@@ -514,10 +515,16 @@ struct obj *instr;
You("start playing %s.", yname(instr));
break;
case PLAY_STUNNED:
You("produce an obnoxious droning sound.");
if (!Deaf)
You("produce an obnoxious droning sound.");
else
You_feel("a monotonous vibration.");
break;
case PLAY_CONFUSED:
You("produce a raucous noise.");
if (!Deaf)
You("produce a raucous noise.");
else
You_feel("a jarring vibration.");
break;
case PLAY_HALLU:
You("produce a kaleidoscopic display of floating butterfiles.");
@@ -541,13 +548,17 @@ struct obj *instr;
case MAGIC_FLUTE: /* Make monster fall asleep */
consume_obj_charge(instr, TRUE);
You("produce %s music.", Hallucination ? "piped" : "soft");
You("%sproduce %s music.", !Deaf ? "" : "seem to ",
Hallucination ? "piped" : "soft");
put_monsters_to_sleep(u.ulevel * 5);
exercise(A_DEX, TRUE);
break;
case WOODEN_FLUTE: /* May charm snakes */
do_spec &= (rn2(ACURR(A_DEX)) + u.ulevel > 25);
pline("%s.", Tobjnam(instr, do_spec ? "trill" : "toot"));
if (!Deaf)
pline("%s.", Tobjnam(instr, do_spec ? "trill" : "toot"));
else
You_feel("%s %s.", yname(instr), do_spec ? "trill" : "toot");
if (do_spec)
charm_snakes(u.ulevel * 3);
exercise(A_DEX, TRUE);
@@ -573,26 +584,38 @@ struct obj *instr;
makeknown(instr->otyp);
break;
case TOOLED_HORN: /* Awaken or scare monsters */
You("produce a frightful, grave sound.");
if (!Deaf)
You("produce a frightful, grave sound.");
else
You("blow into the horn.");
awaken_monsters(u.ulevel * 30);
exercise(A_WIS, FALSE);
break;
case BUGLE: /* Awaken & attract soldiers */
You("extract a loud noise from %s.", yname(instr));
if (!Deaf)
You("extract a loud noise from %s.", yname(instr));
else
You("blow into the bugle.");
awaken_soldiers(&youmonst);
exercise(A_WIS, FALSE);
break;
case MAGIC_HARP: /* Charm monsters */
consume_obj_charge(instr, TRUE);
pline("%s very attractive music.", Tobjnam(instr, "produce"));
if (!Deaf)
pline("%s very attractive music.", Tobjnam(instr, "produce"));
else
You_feel("very soothing vibrations.");
charm_monsters((u.ulevel - 1) / 3 + 1);
exercise(A_DEX, TRUE);
break;
case WOODEN_HARP: /* May calm Nymph */
do_spec &= (rn2(ACURR(A_DEX)) + u.ulevel > 25);
pline("%s %s.", Yname2(instr),
do_spec ? "produces a lilting melody" : "twangs");
if (!Deaf)
pline("%s %s.", Yname2(instr),
do_spec ? "produces a lilting melody" : "twangs");
else
You_feel("soothing vibrations.");
if (do_spec)
calm_nymphs(u.ulevel * 3);
exercise(A_DEX, TRUE);
@@ -613,8 +636,12 @@ struct obj *instr;
break;
case LEATHER_DRUM: /* Awaken monsters */
if (!mundane) {
You("beat a deafening row!");
incr_itimeout(&HDeaf, rn1(20, 30));
if (!Deaf) {
You("beat a deafening row!");
incr_itimeout(&HDeaf, rn1(20, 30));
} else {
You("pound on the drum.");
}
exercise(A_WIS, FALSE);
} else
You("%s %s.",
@@ -685,7 +712,10 @@ struct obj *instr;
*s = 'B';
}
}
You("extract a strange sound from %s!", the(xname(instr)));
You(!Deaf ? "extract a strange sound from %s!"
: "can feel %s emitting vibrations.", the(xname(instr)));
#ifdef UNIX386MUSIC
/* if user is at the console, play through the console speaker */
if (atconsole())
@@ -725,8 +755,8 @@ struct obj *instr;
for (x = u.ux - 1; x <= u.ux + 1; x++)
if (isok(x, y))
if (find_drawbridge(&x, &y)) {
u.uevent.uheard_tune =
2; /* tune now fully known */
/* tune now fully known */
u.uevent.uheard_tune = 2;
if (levl[x][y].typ == DRAWBRIDGE_DOWN)
close_drawbridge(x, y);
else
@@ -759,7 +789,7 @@ struct obj *instr;
if (buf[x] == tune[x]) {
gears++;
matched[x] = TRUE;
} else
} else {
for (y = 0; y < 5; y++)
if (!matched[y] && buf[x] == tune[y]
&& buf[y] != tune[y]) {
@@ -767,8 +797,9 @@ struct obj *instr;
matched[y] = TRUE;
break;
}
}
}
if (tumblers)
if (tumblers) {
if (gears)
You_hear("%d tumbler%s click and %d gear%s turn.",
tumblers, plur(tumblers), gears,
@@ -776,7 +807,7 @@ struct obj *instr;
else
You_hear("%d tumbler%s click.", tumblers,
plur(tumblers));
else if (gears) {
} else if (gears) {
You_hear("%d gear%s turn.", gears, plur(gears));
/* could only get `gears == 5' by playing five
correct notes followed by excess; otherwise,
@@ -791,7 +822,7 @@ struct obj *instr;
} else
return do_improvisation(instr);
nevermind:
nevermind:
pline1(Never_mind);
return 0;
}