From 926a0ca446fcf2f2573ba12551238f5411c86f37 Mon Sep 17 00:00:00 2001 From: PatR Date: Wed, 1 Jul 2020 18:01:30 -0700 Subject: [PATCH] talking walls Add the "if these walls could talk" gag. Use an array of message strings rather than switch/cases of pline calls, and add a couple more messages. Also, only give wall feedback if the map indicates a wall (so not while blind unless the wall is already known) and prevent chat from pinpointing secret doors (via lack of wall feedback when they're shown as walls). --- doc/fixes37.0 | 3 ++- src/sounds.c | 50 ++++++++++++++++++++++++++++++++++++++++---------- 2 files changed, 42 insertions(+), 11 deletions(-) diff --git a/doc/fixes37.0 b/doc/fixes37.0 index 494d75429..4fc92d8c1 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.236 $ $NHDT-Date: 1593614134 2020/07/01 14:35:34 $ +$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.237 $ $NHDT-Date: 1593651682 2020/07/02 01:01:22 $ General Fixes and Modified Features ----------------------------------- @@ -380,6 +380,7 @@ make camera flash which reveals previously unseen map features or objects or boolean options can optionally have the form "name:value" with value taken from among "true", "yes", "on", or "false", "no", "off" record number of wishes and artifact wishes in xlogfile +give feedback for '#chat' directed at walls Platform- and/or Interface-Specific New Features diff --git a/src/sounds.c b/src/sounds.c index 28c3369fd..cba0855e9 100644 --- a/src/sounds.c +++ b/src/sounds.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 sounds.c $NHDT-Date: 1590263455 2020/05/23 19:50:55 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.97 $ */ +/* NetHack 3.6 sounds.c $NHDT-Date: 1593651682 2020/07/02 01:01:22 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.98 $ */ /* Copyright (c) 1989 Janet Walz, Mike Threepoint */ /* NetHack may be freely redistributed. See license for details. */ @@ -1090,18 +1090,48 @@ dochat() mtmp = m_at(tx, ty); - if ((!mtmp || mtmp->mundetected) - && (otmp = vobj_at(tx, ty)) != 0 && otmp->otyp == STATUE) { - /* Talking to a statue */ - if (!Blind) { - pline_The("%s seems not to notice you.", - /* if hallucinating, you can't tell it's a statue */ - Hallucination ? rndmonnam((char *) 0) : "statue"); + if (!mtmp || mtmp->mundetected) { + if ((otmp = vobj_at(tx, ty)) != 0 && otmp->otyp == STATUE) { + /* Talking to a statue */ + if (!Blind) + pline_The("%s seems not to notice you.", + /* if hallucinating, you can't tell it's a statue */ + Hallucination ? rndmonnam((char *) 0) : "statue"); + return 0; + } + if (IS_WALL(levl[tx][ty].typ) || levl[tx][ty].typ == SDOOR) { + /* Talking to a wall; secret door remains hidden by behaving + like a wall; IS_WALL() test excludes solid rock even when + that serves as a wall bordering a corridor */ + if (Blind && !IS_WALL(g.lastseentyp[tx][ty])) { + /* when blind, you can only talk to a wall if it has + already been mapped as a wall */ + ; + } else if (!Hallucination) { + pline("It's like talking to a wall."); + } else { + static const char *const walltalk[] = { + "gripes about its job.", + "tells you a funny joke!", + "insults your heritage!", + "chuckles.", + "guffaws merrily!", + "deprecates your exploration efforts.", + "suggests a stint of rehab...", + "doesn't seem to be interested.", + }; + int idx = rn2(10); + + if (idx >= SIZE(walltalk)) + idx = SIZE(walltalk) - 1; + pline_The("wall %s", walltalk[idx]); + } + return 0; } - return 0; } - if (!mtmp || mtmp->mundetected || M_AP_TYPE(mtmp) == M_AP_FURNITURE + if (!mtmp || mtmp->mundetected + || M_AP_TYPE(mtmp) == M_AP_FURNITURE || M_AP_TYPE(mtmp) == M_AP_OBJECT) return 0;