]> granicus.if.org Git - nethack/commitdiff
ceiling hiders vs '>'
authorPatR <rankin@nethack.org>
Wed, 18 Dec 2019 03:08:26 +0000 (19:08 -0800)
committerPatR <rankin@nethack.org>
Wed, 18 Dec 2019 03:08:26 +0000 (19:08 -0800)
Poly'd hero hiding on the ceiling was told "you can't go down here"
if using '>' at a spot that didn't have down stairs, trap door, hole,
or pit.  Let '>' bring a ceiling hider out of hiding; lurker above
resumes flying, piercer falls to floor or whatever is underneath it.

doc/fixes36.4
src/do.c
src/hack.c
src/objnam.c
src/trap.c

index 25dd5bc0abaaa31207200358658c08b32696c010..0cd176e40720face96a2d39c2982aa7fba501aab 100644 (file)
@@ -1,4 +1,4 @@
-$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.11 $ $NHDT-Date: 1576635242 2019/12/18 02:14:02 $
+$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.12 $ $NHDT-Date: 1576638499 2019/12/18 03:08:19 $
 
 fixes36.4 contains a terse summary of changes made to 3.6.3 in order to
 produce 3.6.4.
@@ -19,6 +19,9 @@ fix potential buffer overflow when parsing run-time configuration file
 wizard mode wishing for terrain would leave it unmapped if done while blind
 wizard mode terrain wish could leave hero in water (severe vision limits) or
        in lava (trapped, sinking) which wasn't there any more
+flying hero can go down (via '>') holes or trap doors instead of escaping trap
+polymorphed hero hiding on the ceiling can now use '>' to unhide instead of
+       being told "you can't go down here"
 
 
 Platform- and/or Interface-Specific Fixes or Features
index b7bb737b90496e8e65084ee7796975eb7080915b..8bbed39de1cb04554569abedfb6d1da25e6aa42b 100644 (file)
--- a/src/do.c
+++ b/src/do.c
@@ -1,4 +1,4 @@
-/* NetHack 3.6 do.c    $NHDT-Date: 1576181796 2019/12/12 20:16:36 $  $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.197 $ */
+/* NetHack 3.6 do.c    $NHDT-Date: 1576638499 2019/12/18 03:08:19 $  $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.198 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /*-Copyright (c) Derek S. Ray, 2015. */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -1000,6 +1000,24 @@ dodown()
                                                     : surface(u.ux, u.uy));
         return 0; /* didn't move */
     }
+
+    if (Upolyd && ceiling_hider(&mons[u.umonnum]) && u.uundetected) {
+        u.uundetected = 0;
+        if (Flying) { /* lurker above */
+            You("fly out of hiding.");
+        } else { /* piercer */
+            You("drop to the %s.", surface(u.ux, u.uy));
+            if (is_pool_or_lava(u.ux, u.uy)) {
+                pooleffects(FALSE);
+            } else {
+                (void) pickup(1);
+                if ((trap = t_at(u.ux, u.uy)) != 0)
+                    dotrap(trap, TOOKPLUNGE);
+            }
+        }
+        return 1; /* came out of hiding; might need '>' again to go down */
+    }
+
     if (!stairs_down && !ladder_down) {
         trap = t_at(u.ux, u.uy);
         if (trap && (uteetering_at_seen_pit(trap) || uescaped_shaft(trap))) {
index a48b92cf58091f5c2de0659f844da3ef3ac0a47d..79fe7408c858a5c2754a173be2b7ed78e2eb5b65 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.6 hack.c  $NHDT-Date: 1568509227 2019/09/15 01:00:27 $  $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.216 $ */
+/* NetHack 3.6 hack.c  $NHDT-Date: 1576638500 2019/12/18 03:08:20 $  $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.220 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /*-Copyright (c) Derek S. Ray, 2015. */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -2124,6 +2124,10 @@ boolean newspot;             /* true if called by spoteffects */
         }
         /* not mounted */
 
+        /* if hiding on ceiling then don't automatically enter pool */
+        if (Upolyd && ceiling_hider(&mons[u.umonnum]) && u.uundetected)
+            return FALSE;
+
         /* drown(),lava_effects() return true if hero changes
            location while surviving the problem */
         if (is_lava(u.ux, u.uy)) {
index 4e7e3e2c67c8eb136124abf092bdd8002afa8805..aa5d7713d77b0fb7ce82bf22269e59961a670287 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.6 objnam.c        $NHDT-Date: 1576635242 2019/12/18 02:14:02 $  $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.256 $ */
+/* NetHack 3.6 objnam.c        $NHDT-Date: 1576638500 2019/12/18 03:08:20 $  $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.257 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /*-Copyright (c) Robert Patrick Rankin, 2011. */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -3733,7 +3733,7 @@ struct obj *no_wish;
             del_engr_at(x, y);
             pline("A pool of molten lava.");
             if (!(Levitation || Flying))
-                (void) lava_effects();
+                pooleffects(FALSE);
             madeterrain = TRUE;
         } else if (!BSTRCMPI(bp, p - 5, "altar")) {
             aligntyp al;
@@ -3770,12 +3770,15 @@ struct obj *no_wish;
         }
 
         if (madeterrain) {
-            feel_newsym(x, y);
-            if (u.uinwater && !is_pool(x, y)) {
+            feel_newsym(x, y); /* map the spot where the wish occurred */
+            /* hero started at <x,y> but might not be there anymore (create
+               lava, decline to die, and get teleported away to safety) */
+            if (u.uinwater && !is_pool(u.ux, u.uy)) {
                 u.uinwater = 0; /* leave the water */
                 docrt();
                 vision_full_recalc = 1;
-            } else if (u.utrap && u.utraptype == TT_LAVA && !is_lava(x, y)) {
+            } else if (u.utrap && u.utraptype == TT_LAVA
+                       && !is_lava(u.ux, u.uy)) {
                 reset_utrap(FALSE);
             }
             /* cast 'const' away; caller won't modify this */
index ea733633650fdbeafb20b98c1f53ea2be87aa7b6..b6db81148c0fc8e30fad87c9610f002f3634e66c 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.6 trap.c  $NHDT-Date: 1576635243 2019/12/18 02:14:03 $  $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.328 $ */
+/* NetHack 3.6 trap.c  $NHDT-Date: 1576638501 2019/12/18 03:08:21 $  $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.329 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /*-Copyright (c) Robert Patrick Rankin, 2013. */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -489,8 +489,9 @@ unsigned ftflags;
         ; /* KMH -- You can't escape the Sokoban level traps */
     else if (Levitation || u.ustuck
              || (!Can_fall_thru(&u.uz) && !levl[u.ux][u.uy].candig)
-             || ((Flying || is_clinger(youmonst.data))
-                    && !(ftflags & TOOKPLUNGE))
+             || ((Flying || is_clinger(youmonst.data)
+                  || (ceiling_hider(youmonst.data) && u.uundetected))
+                 && !(ftflags & TOOKPLUNGE))
              || (Inhell && !u.uevent.invoked && newlevel == bottom)) {
         dont_fall = "don't fall in.";
     } else if (youmonst.data->msize >= MZ_HUGE) {
@@ -5388,7 +5389,10 @@ sink_into_lava()
     static const char sink_deeper[] = "You sink deeper into the lava.";
 
     if (!u.utrap || u.utraptype != TT_LAVA) {
-        ; /* do nothing; this shouldn't happen */
+        ; /* do nothing; this usually won't happen but could after
+           * polymorphing from a flier into a ceiling hider and then hiding;
+           * allmain() only checks whether the hero is at a lava location,
+           * not whether he or she is currently sinking */
     } else if (!is_lava(u.ux, u.uy)) {
         reset_utrap(FALSE); /* this shouldn't happen either */
     } else if (!u.uinvulnerable) {