From 52f4803a5a991456bfe9312fdc2b6d6441adc4e1 Mon Sep 17 00:00:00 2001 From: PatR Date: Sun, 5 Jan 2020 11:30:38 -0800 Subject: [PATCH] more earthquake When a drum of earthquake targets a secret door, reveal it (which is always followed by collapsing the door), and when it targets a secret corridor, reveal that corridor. Both situations also place a pit at the location. --- doc/fixes37.0 | 3 ++- src/detect.c | 10 ++++----- src/music.c | 57 +++++++++++++++++++++++++++++++++++++++------------ 3 files changed, 51 insertions(+), 19 deletions(-) diff --git a/doc/fixes37.0 b/doc/fixes37.0 index 891d81762..e6a332466 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.50 $ $NHDT-Date: 1578216006 2020/01/05 09:20:06 $ +$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.51 $ $NHDT-Date: 1578252630 2020/01/05 19:30:30 $ General Fixes and Modified Features ----------------------------------- @@ -31,6 +31,7 @@ don't allow twoweapon combat if either weapon is a bow, crossbow, or sling drum of earthquake feedback reported various things (fountains, thrones, &c) falling into a chasm but they remained intact because trap creation had been changed to not clobber such things (so couldn't make pits) +make earthquake which hits a secret door or a secret corridor reveal it Fixes to 3.7.0-x Problems that Were Exposed Via git Repository diff --git a/src/detect.c b/src/detect.c index 04a452663..28d430df8 100644 --- a/src/detect.c +++ b/src/detect.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 detect.c $NHDT-Date: 1577050472 2019/12/22 21:34:32 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.110 $ */ +/* NetHack 3.6 detect.c $NHDT-Date: 1578252630 2020/01/05 19:30:30 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.114 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2018. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1447,14 +1447,14 @@ struct rm *lev; { int newmask = lev->doormask & ~WM_MASK; - if (Is_rogue_level(&u.uz)) + if (Is_rogue_level(&u.uz)) { /* rogue didn't have doors, only doorways */ newmask = D_NODOOR; - else + } else { /* newly exposed door is closed */ if (!(newmask & D_LOCKED)) - newmask |= D_CLOSED; - + newmask |= D_CLOSED; + } lev->typ = DOOR; lev->doormask = newmask; } diff --git a/src/music.c b/src/music.c index 2a6123d10..50e1de995 100644 --- a/src/music.c +++ b/src/music.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 music.c $NHDT-Date: 1578216006 2020/01/05 09:20:06 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.66 $ */ +/* NetHack 3.6 music.c $NHDT-Date: 1578252632 2020/01/05 19:30:32 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.67 $ */ /* Copyright (c) 1989 by Jean-Christophe Collet */ /* NetHack may be freely redistributed. See license for details. */ @@ -268,6 +268,24 @@ int force; if (rn2(14 - force)) continue; + /* + * Possible extensions: + * When a door is trapped, explode it instead of silently + * turning it into an empty doorway. + * Trigger divine wrath when an altar is dumped into a chasm. + * Sometimes replace sink with fountain or fountain with pool + * instead of always producing a pit. + * Sometimes release monster and/or treasure from a grave or + * a throne instead of just dumping them into the chasm. + * Chance to destroy wall segments? Trees too? + * Honor non-diggable for locked doors, walls, and trees. + * Treat non-passwall as if it was non-diggable? + * Conjoin some of the umpteen pits when they're adjacent? + * + * Replace 'goto do_pit;' with 'do_pit = TRUE; break;' and + * move the pit code to after the switch. + */ + switch (levl[x][y].typ) { case FOUNTAIN: /* make the fountain disappear */ if (cansee(x, y)) @@ -278,6 +296,7 @@ int force; pline_The("kitchen sink falls%s.", into_a_chasm); goto do_pit; case ALTAR: + /* always preserve the high altars */ if (Is_astralevel(&u.uz) || Is_sanctum(&u.uz)) break; /* no need to check for high altar here; we've just @@ -295,19 +314,26 @@ int force; case THRONE: if (cansee(x, y)) pline_The("throne falls%s.", into_a_chasm); + goto do_pit; + case SCORR: + levl[x][y].typ = CORR; + unblock_point(x, y); + if (cansee(x, y)) + pline("A secret corridor is revealed."); /*FALLTHRU*/ - case ROOM: - case CORR: /* Try to make a pit */ + case CORR: + case ROOM: /* Try to make a pit. */ do_pit: /* maketrap() won't replace furniture with a trap, so remove the furniture first */ if (levl[x][y].typ != CORR) { - if (levl[x][y].typ != DOOR) + if (levl[x][y].typ != DOOR) { levl[x][y].typ = ROOM; - levl[x][y].flags = 0; /* clear doormask (D_NODOOR) or - * altarmask or looted throne */ - levl[x][y].horizontal = 0; /* clear blessed fountain, - * disturbed grave */ + /* clear blessed fountain, disturbed grave */ + levl[x][y].horizontal = 0; + } + /* clear doormask, altarmask, looted throne */ + levl[x][y].flags = 0; /* same as 'doormask = D_NODOOR' */ } chasm = maketrap(x, y, PIT); if (!chasm) @@ -415,18 +441,23 @@ int force; newsym(x, y); } break; + case SDOOR: + cvt_sdoor_to_door(&levl[x][y]); /* .typ = DOOR */ + if (cansee(x, y)) + pline("A secret door is revealed."); + /*FALLTHRU*/ case DOOR: /* make the door collapse */ + /* if already doorless, treat like room or corridor */ if (levl[x][y].doormask == D_NODOOR) goto do_pit; - /* TODO: if door is trapped, the trap should explode; - forcing D_NODOOR just makes trap silently go away */ + /* wasn't doorless, now it will be */ + levl[x][y].doormask = D_NODOOR; + unblock_point(x, y); + newsym(x, y); /* before pline */ if (cansee(x, y)) pline_The("door collapses."); if (*in_rooms(x, y, SHOPBASE)) add_damage(x, y, 0L); - levl[x][y].doormask = D_NODOOR; - unblock_point(x, y); - newsym(x, y); break; } }