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
+2 -1
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 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, 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 it as tame; noticeable if the level was entered with 'hilite_pet' On
fix a leashed pet polymorphed into a long worm staying leashed fix a leashed pet polymorphed into a long worm staying leashed
prevent leashing unsolid monsters and monsters with no extremities 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 Fixes to Post-3.6.2 Problems that Were Exposed Via git Repository
+52 -21
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 */ /* Copyright (c) 1989 by Jean-Christophe Collet */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -187,7 +187,7 @@ struct monst *bugler; /* monster that played instrument */
mtmp->mstrategy &= ~STRAT_WAITMASK; mtmp->mstrategy &= ~STRAT_WAITMASK;
if (canseemon(mtmp)) if (canseemon(mtmp))
pline("%s is now ready for battle!", Monnam(mtmp)); pline("%s is now ready for battle!", Monnam(mtmp));
else else if (!Deaf)
Norep("You hear the rattle of battle gear being readied."); Norep("You hear the rattle of battle gear being readied.");
} else if ((distm = ((bugler == &youmonst) } else if ((distm = ((bugler == &youmonst)
? distu(mtmp->mx, mtmp->my) ? distu(mtmp->mx, mtmp->my)
@@ -301,7 +301,7 @@ int force;
/*FALLTHRU*/ /*FALLTHRU*/
case ROOM: case ROOM:
case CORR: /* Try to make a pit */ case CORR: /* Try to make a pit */
do_pit: do_pit:
chasm = maketrap(x, y, PIT); chasm = maketrap(x, y, PIT);
if (!chasm) if (!chasm)
break; /* no pit if portal at that location */ break; /* no pit if portal at that location */
@@ -483,6 +483,7 @@ struct obj *instr;
itmp.otyp -= 1; itmp.otyp -= 1;
mundane = TRUE; mundane = TRUE;
} }
#ifdef MAC #ifdef MAC
mac_speaker(&itmp, "C"); mac_speaker(&itmp, "C");
#endif #endif
@@ -514,10 +515,16 @@ struct obj *instr;
You("start playing %s.", yname(instr)); You("start playing %s.", yname(instr));
break; break;
case PLAY_STUNNED: case PLAY_STUNNED:
You("produce an obnoxious droning sound."); if (!Deaf)
You("produce an obnoxious droning sound.");
else
You_feel("a monotonous vibration.");
break; break;
case PLAY_CONFUSED: case PLAY_CONFUSED:
You("produce a raucous noise."); if (!Deaf)
You("produce a raucous noise.");
else
You_feel("a jarring vibration.");
break; break;
case PLAY_HALLU: case PLAY_HALLU:
You("produce a kaleidoscopic display of floating butterfiles."); You("produce a kaleidoscopic display of floating butterfiles.");
@@ -541,13 +548,17 @@ struct obj *instr;
case MAGIC_FLUTE: /* Make monster fall asleep */ case MAGIC_FLUTE: /* Make monster fall asleep */
consume_obj_charge(instr, TRUE); 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); put_monsters_to_sleep(u.ulevel * 5);
exercise(A_DEX, TRUE); exercise(A_DEX, TRUE);
break; break;
case WOODEN_FLUTE: /* May charm snakes */ case WOODEN_FLUTE: /* May charm snakes */
do_spec &= (rn2(ACURR(A_DEX)) + u.ulevel > 25); 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) if (do_spec)
charm_snakes(u.ulevel * 3); charm_snakes(u.ulevel * 3);
exercise(A_DEX, TRUE); exercise(A_DEX, TRUE);
@@ -573,26 +584,38 @@ struct obj *instr;
makeknown(instr->otyp); makeknown(instr->otyp);
break; break;
case TOOLED_HORN: /* Awaken or scare monsters */ 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); awaken_monsters(u.ulevel * 30);
exercise(A_WIS, FALSE); exercise(A_WIS, FALSE);
break; break;
case BUGLE: /* Awaken & attract soldiers */ 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); awaken_soldiers(&youmonst);
exercise(A_WIS, FALSE); exercise(A_WIS, FALSE);
break; break;
case MAGIC_HARP: /* Charm monsters */ case MAGIC_HARP: /* Charm monsters */
consume_obj_charge(instr, TRUE); 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); charm_monsters((u.ulevel - 1) / 3 + 1);
exercise(A_DEX, TRUE); exercise(A_DEX, TRUE);
break; break;
case WOODEN_HARP: /* May calm Nymph */ case WOODEN_HARP: /* May calm Nymph */
do_spec &= (rn2(ACURR(A_DEX)) + u.ulevel > 25); do_spec &= (rn2(ACURR(A_DEX)) + u.ulevel > 25);
pline("%s %s.", Yname2(instr), if (!Deaf)
do_spec ? "produces a lilting melody" : "twangs"); pline("%s %s.", Yname2(instr),
do_spec ? "produces a lilting melody" : "twangs");
else
You_feel("soothing vibrations.");
if (do_spec) if (do_spec)
calm_nymphs(u.ulevel * 3); calm_nymphs(u.ulevel * 3);
exercise(A_DEX, TRUE); exercise(A_DEX, TRUE);
@@ -613,8 +636,12 @@ struct obj *instr;
break; break;
case LEATHER_DRUM: /* Awaken monsters */ case LEATHER_DRUM: /* Awaken monsters */
if (!mundane) { if (!mundane) {
You("beat a deafening row!"); if (!Deaf) {
incr_itimeout(&HDeaf, rn1(20, 30)); You("beat a deafening row!");
incr_itimeout(&HDeaf, rn1(20, 30));
} else {
You("pound on the drum.");
}
exercise(A_WIS, FALSE); exercise(A_WIS, FALSE);
} else } else
You("%s %s.", You("%s %s.",
@@ -685,7 +712,10 @@ struct obj *instr;
*s = 'B'; *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 #ifdef UNIX386MUSIC
/* if user is at the console, play through the console speaker */ /* if user is at the console, play through the console speaker */
if (atconsole()) if (atconsole())
@@ -725,8 +755,8 @@ struct obj *instr;
for (x = u.ux - 1; x <= u.ux + 1; x++) for (x = u.ux - 1; x <= u.ux + 1; x++)
if (isok(x, y)) if (isok(x, y))
if (find_drawbridge(&x, &y)) { if (find_drawbridge(&x, &y)) {
u.uevent.uheard_tune = /* tune now fully known */
2; /* tune now fully known */ u.uevent.uheard_tune = 2;
if (levl[x][y].typ == DRAWBRIDGE_DOWN) if (levl[x][y].typ == DRAWBRIDGE_DOWN)
close_drawbridge(x, y); close_drawbridge(x, y);
else else
@@ -759,7 +789,7 @@ struct obj *instr;
if (buf[x] == tune[x]) { if (buf[x] == tune[x]) {
gears++; gears++;
matched[x] = TRUE; matched[x] = TRUE;
} else } else {
for (y = 0; y < 5; y++) for (y = 0; y < 5; y++)
if (!matched[y] && buf[x] == tune[y] if (!matched[y] && buf[x] == tune[y]
&& buf[y] != tune[y]) { && buf[y] != tune[y]) {
@@ -767,8 +797,9 @@ struct obj *instr;
matched[y] = TRUE; matched[y] = TRUE;
break; break;
} }
}
} }
if (tumblers) if (tumblers) {
if (gears) if (gears)
You_hear("%d tumbler%s click and %d gear%s turn.", You_hear("%d tumbler%s click and %d gear%s turn.",
tumblers, plur(tumblers), gears, tumblers, plur(tumblers), gears,
@@ -776,7 +807,7 @@ struct obj *instr;
else else
You_hear("%d tumbler%s click.", tumblers, You_hear("%d tumbler%s click.", tumblers,
plur(tumblers)); plur(tumblers));
else if (gears) { } else if (gears) {
You_hear("%d gear%s turn.", gears, plur(gears)); You_hear("%d gear%s turn.", gears, plur(gears));
/* could only get `gears == 5' by playing five /* could only get `gears == 5' by playing five
correct notes followed by excess; otherwise, correct notes followed by excess; otherwise,
@@ -791,7 +822,7 @@ struct obj *instr;
} else } else
return do_improvisation(instr); return do_improvisation(instr);
nevermind: nevermind:
pline1(Never_mind); pline1(Never_mind);
return 0; return 0;
} }