fix H4101: can hear pets while deaf

This is a fix for H4101, bz192.

add non-audio (felt) outcome to yelp()

This also add #wizintrinsic command because testing this was a pain
without a simple, straightforward way to go deaf that didn't time-out
before the situation being tested recurred.
This commit is contained in:
nhmall
2015-12-18 12:50:25 -05:00
parent c5e2604cca
commit 7019a7da77
4 changed files with 67 additions and 12 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 cmd.c $NHDT-Date: 1450178549 2015/12/15 11:22:29 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.209 $ */
/* NetHack 3.6 cmd.c $NHDT-Date: 1450460999 2015/12/18 17:49:59 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.210 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -122,6 +122,7 @@ STATIC_PTR int NDECL(dotravel);
STATIC_PTR int NDECL(doterrain);
STATIC_PTR int NDECL(wiz_wish);
STATIC_PTR int NDECL(wiz_identify);
STATIC_PTR int NDECL(wiz_intrinsic);
STATIC_PTR int NDECL(wiz_map);
STATIC_PTR int NDECL(wiz_genesis);
STATIC_PTR int NDECL(wiz_where);
@@ -1102,6 +1103,48 @@ wiz_smell(VOID_ARGS)
return 0;
}
/* #wizinstrinsic command to set some intrinsics for testing */
STATIC_PTR int
wiz_intrinsic(VOID_ARGS)
{
if (wizard) {
winid win;
anything any;
int i, n, accelerator;
menu_item *pick_list = (menu_item *) 0;
static const char *const intrinsics[] = {
"deafness",
};
win = create_nhwindow(NHW_MENU);
start_menu(win);
accelerator = 0;
for (i = 0; i < SIZE(intrinsics); ++i) {
accelerator = intrinsics[i][0];
any.a_int = i + 1;
add_menu(win, NO_GLYPH, &any, accelerator, 0, ATR_NONE, intrinsics[i], FALSE);
}
end_menu(win, "Which intrinsic?");
n = select_menu(win, PICK_ONE, &pick_list);
destroy_nhwindow(win);
if (n >= 1) {
i = pick_list[0].item.a_int-1;
free((genericptr_t) pick_list);
}
if (!strcmp(intrinsics[i],"deafness")) {
You("go deaf.");
incr_itimeout(&HDeaf, 30);
}
} else
pline("Unavailable command '%s'.",
visctrl((int) cmd_from_func(wiz_intrinsic)));
return 0;
}
/* #wizrumorcheck command - verify each rumor access */
STATIC_PTR int
wiz_rumor_check(VOID_ARGS)
@@ -2771,6 +2814,7 @@ struct ext_func_tab extcmdlist[] = {
{ (char *) 0, (char *) 0, donull, TRUE }, /* vanquished */
{ (char *) 0, (char *) 0, donull, TRUE }, /* vision */
{ (char *) 0, (char *) 0, donull, TRUE }, /* wizsmell */
{ (char *) 0, (char *) 0, donull, TRUE }, /* wizintrinsic */
#ifdef DEBUG
{ (char *) 0, (char *) 0, donull, TRUE }, /* wizdebug_traveldisplay */
{ (char *) 0, (char *) 0, donull, TRUE }, /* wizdebug_bury */
@@ -2800,6 +2844,7 @@ static const struct ext_func_tab debug_extcmdlist[] = {
{ "vanquished", "list vanquished monsters", dovanquished, TRUE },
{ "vision", "show vision array", wiz_show_vision, TRUE },
{ "wizsmell", "smell monster", wiz_smell, TRUE },
{ "wizintrinsic", "set intrinsic", wiz_intrinsic, TRUE },
#ifdef DEBUG
{ "wizdebug_traveldisplay", "wizard debug: toggle travel display",
wiz_debug_cmd_traveldisplay, TRUE },

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 sounds.c $NHDT-Date: 1450306219 2015/12/16 22:50:19 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.75 $ */
/* NetHack 3.6 sounds.c $NHDT-Date: 1450461007 2015/12/18 17:50:07 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.76 $ */
/* Copyright (c) 1989 Janet Walz, Mike Threepoint */
/* NetHack may be freely redistributed. See license for details. */
@@ -387,23 +387,23 @@ register struct monst *mtmp;
else
switch (mtmp->data->msound) {
case MS_MEW:
yelp_verb = "yowl";
yelp_verb = (!Deaf) ? "yowl" : "arch";
break;
case MS_BARK:
case MS_GROWL:
yelp_verb = "yelp";
yelp_verb = (!Deaf) ? "yelp" : "recoil";
break;
case MS_ROAR:
yelp_verb = "snarl";
yelp_verb = (!Deaf) ? "snarl" : "bluff";
break;
case MS_SQEEK:
yelp_verb = "squeal";
yelp_verb = (!Deaf) ? "squeal" : "quivers";
break;
case MS_SQAWK:
yelp_verb = "screak";
yelp_verb = (!Deaf) ? "screak" : "thrash";
break;
case MS_WAIL:
yelp_verb = "wail";
yelp_verb = (!Deaf) ? "wail" : "cringe";
break;
}
if (yelp_verb) {

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 trap.c $NHDT-Date: 1449977947 2015/12/13 03:39:07 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.250 $ */
/* NetHack 3.6 trap.c $NHDT-Date: 1450461008 2015/12/18 17:50:08 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.251 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -3048,6 +3048,7 @@ domagictrap()
/* Most of the time, it creates some monsters. */
register int cnt = rnd(4);
/* blindness effects */
if (!resists_blnd(&youmonst)) {
You("are momentarily blinded by a flash of light!");
make_blinded((long) rn1(5, 10), FALSE);
@@ -3055,9 +3056,17 @@ domagictrap()
Your1(vision_clears);
} else if (!Blind) {
You_see("a flash of light!");
} else
}
/* deafness effects */
if (!Deaf) {
You_hear("a deafening roar!");
incr_itimeout(&HDeaf, rn1(20, 30));
incr_itimeout(&HDeaf, rn1(20, 30));
} else {
/* magic vibrations still hit you */
You_feel("rankled.");
incr_itimeout(&HDeaf, rn1(5, 15));
}
while (cnt--)
(void) makemon((struct permonst *) 0, u.ux, u.uy, NO_MM_FLAGS);
} else