]> granicus.if.org Git - nethack/commitdiff
Convert the vibrating square to a trap
authorSean Hunt <scshunt@csclub.uwaterloo.ca>
Sun, 24 May 2015 15:32:45 +0000 (00:32 +0900)
committerSean Hunt <scshunt@csclub.uwaterloo.ca>
Mon, 25 May 2015 00:19:20 +0000 (09:19 +0900)
Patch due to ais523 in NetHack 4.

This is not ready to be merged yet; the vibrating square needs a tile
image for tiles builds.

12 files changed:
doc/fixes35.0
include/rm.h
include/trap.h
src/dig.c
src/dothrow.c
src/drawing.c
src/mklev.c
src/mkmaze.c
src/polyself.c
src/sp_lev.c
src/trap.c
util/lev_main.c

index a72aa514a38b0d5c822251dbb6d83e2263752258..7032dbc9d98c948f50b0dfc1957f020d3030beec 100644 (file)
@@ -917,6 +917,7 @@ uncursed enchant weapon now correctly fixes erosion
 scroll of earth messages cleaned up
 long worms can no longer be leashed
 the chest in the Castle containing the wishing wand can never be trapped
+the vibrating square is now a trap
 
 
 Platform- and/or Interface-Specific Fixes
index 0af8aa011c5c32c39a4708b0fe89410a509f2f96..58631bfbe988db51f157924f48fc5a179ae42432 100644 (file)
 
 /* end effects */
 
-#define MAXPCHARS      95      /* maximum number of mapped characters */
+#define MAXPCHARS      96      /* maximum number of mapped characters */
 #define MAXDCHARS      42      /* maximum of mapped dungeon characters */
 #define MAXTCHARS      22      /* maximum of mapped trap characters */
 #define MAXECHARS      31      /* maximum of mapped effects characters */
index 8aa989028df7cf8cc82821e49e4f9793d41b43ce..8234fc2c2a9da0f60bd9f3b514c3497e073b45e1 100644 (file)
@@ -78,6 +78,7 @@ extern struct trap *ftrap;
 #define MAGIC_TRAP     20
 #define ANTI_MAGIC     21
 #define POLY_TRAP      22
-#define TRAPNUM 23
+#define VIBRATING_SQUARE 23
+#define TRAPNUM 24
 
 #endif /* TRAP_H */
index a659ff130176fce8adb89eba7572547b51d463aa..9c194269fa304fd5438830e5cf0fe4ae31d437c9 100644 (file)
--- a/src/dig.c
+++ b/src/dig.c
@@ -220,6 +220,7 @@ int x, y;
                 && (levl[x][y].wall_info & W_NONDIGGABLE) != 0)
                || (ttmp
                    && (ttmp->ttyp == MAGIC_PORTAL
+                       || ttmp->ttyp == VIBRATING_SQUARE
                        || (!Can_dig_down(&u.uz) && !levl[x][y].candig)))) {
         if (verbose)
             pline_The("%s here is too hard to %s.", surface(x, y), verb);
@@ -778,7 +779,8 @@ coord *cc;
     lev = &levl[dig_x][dig_y];
     nohole = (!Can_dig_down(&u.uz) && !lev->candig);
 
-    if ((ttmp && (ttmp->ttyp == MAGIC_PORTAL || nohole))
+    if ((ttmp && (ttmp->ttyp == MAGIC_PORTAL
+                  || ttmp->ttyp == VIBRATING_SQUARE || nohole))
         || (IS_ROCK(lev->typ) && lev->typ != SDOOR
             && (lev->wall_info & W_NONDIGGABLE) != 0)) {
         pline_The("%s %shere is too hard to dig in.", surface(dig_x, dig_y),
index 0b6296058f469514301d1f4bb8b4a6eb4f5d8ae7..af25f096d4e8fa4d589d31b25dfe2168035281b7 100644 (file)
@@ -619,6 +619,9 @@ int x, y;
         if (ttmp->ttyp == MAGIC_PORTAL) {
             dotrap(ttmp, 0);
             return FALSE;
+        } else if (ttmp->ttyp == VIBRATING_SQUARE) {
+            pline("The ground vibrates as you pass it.");
+            dotrap(ttmp, 0); /* doesn't print messages */
         } else if (ttmp->ttyp == FIRE_TRAP) {
             dotrap(ttmp, 0);
         } else if ((ttmp->ttyp == PIT || ttmp->ttyp == SPIKED_PIT
index 60ee41685c890ea0fc9eaf071c090856fa897aa5..f46435c21088efb3a5763b454381cbed8bb156fe 100644 (file)
@@ -204,14 +204,15 @@ const struct symdef defsyms[MAXPCHARS] = {
     { '^', "magic trap", C(HI_ZAP) },               /* trap */
     { '^', "anti-magic field", C(HI_ZAP) },         /* trap */
     { '^', "polymorph trap", C(CLR_BRIGHT_GREEN) }, /* trap */
+    { '^', "vibrating square", C(CLR_YELLOW) },     /* trap */
     { '|', "wall", C(CLR_GRAY) },                   /* vbeam */
     { '-', "wall", C(CLR_GRAY) },                   /* hbeam */
     { '\\', "wall", C(CLR_GRAY) },                  /* lslant */
     { '/', "wall", C(CLR_GRAY) },                   /* rslant */
     { '*', "", C(CLR_WHITE) },                      /* dig beam */
     { '!', "", C(CLR_WHITE) },                      /* camera flash beam */
-    /*70*/ { ')', "", C(HI_WOOD) },                 /* boomerang open left */
-    { '(', "", C(HI_WOOD) },                        /* boomerang open right */
+    { ')', "", C(HI_WOOD) },                        /* boomerang open left */
+    /*70*/ { '(', "", C(HI_WOOD) },                 /* boomerang open right */
     { '0', "", C(HI_ZAP) }, /* 4 magic shield symbols */
     { '#', "", C(HI_ZAP) },
     { '@', "", C(HI_ZAP) },
@@ -222,8 +223,8 @@ const struct symdef defsyms[MAXPCHARS] = {
       C(CLR_BRIGHT_GREEN) },           /* valid position for targeting */
     { '/', "", C(CLR_GREEN) },         /* swallow top left     */
     { '-', "", C(CLR_GREEN) },         /* swallow top center   */
-    /*80*/ { '\\', "", C(CLR_GREEN) }, /* swallow top right    */
-    { '|', "", C(CLR_GREEN) },         /* swallow middle left  */
+    { '\\', "", C(CLR_GREEN) },        /* swallow top right    */
+    /*80*/ { '|', "", C(CLR_GREEN) },  /* swallow middle left  */
     { '|', "", C(CLR_GREEN) },         /* swallow middle right */
     { '\\', "", C(CLR_GREEN) },        /* swallow bottom left  */
     { '-', "", C(CLR_GREEN) },         /* swallow bottom center*/
@@ -232,8 +233,8 @@ const struct symdef defsyms[MAXPCHARS] = {
     { '-', "", C(CLR_ORANGE) },        /* explosion top center   */
     { '\\', "", C(CLR_ORANGE) },       /* explosion top right    */
     { '|', "", C(CLR_ORANGE) },        /* explosion middle left  */
-    /*90*/ { ' ', "", C(CLR_ORANGE) }, /* explosion middle center*/
-    { '|', "", C(CLR_ORANGE) },        /* explosion middle right */
+    { ' ', "", C(CLR_ORANGE) },        /* explosion middle center*/
+    /*90*/ { '|', "", C(CLR_ORANGE) }, /* explosion middle right */
     { '\\', "", C(CLR_ORANGE) },       /* explosion bottom left  */
     { '-', "", C(CLR_ORANGE) },        /* explosion bottom center*/
     { '/', "", C(CLR_ORANGE) },        /* explosion bottom right */
index 02d90200e3728361c4e250ee85b8e0019f22acb3..5d33569b0212fc673df263048e22b538af1d6026 100644 (file)
@@ -476,7 +476,7 @@ static NEARDATA const char *trap_engravings[TRAPNUM] = {
     (char *) 0,      (char *) 0,    (char *) 0,    (char *) 0,
     /* 14..16: trap door, teleport, level-teleport */
     "Vlad was here", "ad aerarium", "ad aerarium", (char *) 0, (char *) 0,
-    (char *) 0,      (char *) 0,    (char *) 0,    (char *) 0,
+    (char *) 0,      (char *) 0,    (char *) 0,    (char *) 0, (char *) 0,
 };
 
 STATIC_OVL void
@@ -1295,6 +1295,7 @@ coord *tm;
             /* reject "too hard" traps */
             switch (kind) {
             case MAGIC_PORTAL:
+            case VIBRATING_SQUARE:
                 kind = NO_TRAP;
                 break;
             case ROLLING_BOULDER_TRAP:
index 842e0f72a5d55bf8447d7931cd2625f77a9aede1..1b649ca87c8ad4b7b8653d3a13251cbfe3fa4b13 100644 (file)
@@ -298,7 +298,7 @@ d_level *lev;
                It might still fail if there's a dungeon feature here. */
             struct trap *t = t_at(x, y);
 
-            if (t && t->ttyp != MAGIC_PORTAL)
+            if (t && t->ttyp != MAGIC_PORTAL && t->ttyp != VIBRATING_SQUARE)
                 deltrap(t);
             if (bad_location(x, y, nlx, nly, nhx, nhy))
                 return FALSE;
@@ -619,6 +619,7 @@ register const char *s;
                  || !SPACE_POS(levl[x][y].typ) || occupied(x, y));
         inv_pos.x = x;
         inv_pos.y = y;
+        maketrap(inv_pos.x, inv_pos.y, VIBRATING_SQUARE);
 #undef INVPOS_X_MARGIN
 #undef INVPOS_Y_MARGIN
 #undef INVPOS_DISTANCE
index 0083a9c0722eed273c4c2c20dfc9d329b27de6b8..58e516882cd74434d6a325f2586bdfedd513f25f 100644 (file)
@@ -1173,6 +1173,7 @@ dospinweb()
         case TELEP_TRAP:
         case LEVEL_TELEP:
         case MAGIC_PORTAL:
+        case VIBRATING_SQUARE:
             Your("webbing vanishes!");
             return (0);
         case WEB:
index 6a3c643133cac2df76ded94adf1c8b1647b9da0a..2c92f0dd61f048bfa115bfe08847f1e7d4abccec 100644 (file)
@@ -735,6 +735,7 @@ rndtrap()
         rtrap = rnd(TRAPNUM - 1);
         switch (rtrap) {
         case HOLE: /* no random holes on special levels */
+        case VIBRATING_SQUARE:
         case MAGIC_PORTAL:
             rtrap = NO_TRAP;
             break;
index 0870bb76cb82f67c5e9dc95d5a0e034785cb0653..5123dff323dc927952b2dc19e6fb1fb52d2d1988 100644 (file)
@@ -314,7 +314,7 @@ register int x, y, typ;
     register boolean oldplace;
 
     if ((ttmp = t_at(x, y)) != 0) {
-        if (ttmp->ttyp == MAGIC_PORTAL)
+        if (ttmp->ttyp == MAGIC_PORTAL || ttmp->ttyp == VIBRATING_SQUARE)
             return (struct trap *) 0;
         oldplace = TRUE;
         if (u.utrap && (x == u.ux) && (y == u.uy)
@@ -826,8 +826,8 @@ unsigned trflags;
                 defsyms[trap_to_defsym(ttype)].explanation);
             return;
         }
-        if (!Fumbling && ttype != MAGIC_PORTAL && ttype != ANTI_MAGIC
-            && !forcebungle && !plunged && !adj_pit
+        if (!Fumbling && ttype != MAGIC_PORTAL && ttype != VIBRATING_SQUARE
+            && ttype != ANTI_MAGIC && !forcebungle && !plunged && !adj_pit
             && (!rn2(5) || ((ttype == PIT || ttype == SPIKED_PIT)
                             && is_clinger(youmonst.data)))) {
             You("escape %s %s.", (ttype == ARROW_TRAP && !trap->madeby_u)
@@ -1426,6 +1426,11 @@ unsigned trflags;
         feeltrap(trap);
         domagicportal(trap);
         break;
+    case VIBRATING_SQUARE:
+        seetrap(trap);
+        /* messages handled elsewhere; the trap symbol is merely to mark the
+         * square for future reference */
+        break;
 
     default:
         feeltrap(trap);
@@ -2590,6 +2595,18 @@ register struct monst *mtmp;
             }
             break;
 
+        case VIBRATING_SQUARE:
+            if (see_it && !Blind) {
+                if (in_sight)
+                    pline("You see a strange vibration beneath %s %s.",
+                          s_suffix(mon_nam(mtmp)),
+                          makeplural(mbodypart(mtmp, FOOT)));
+                else
+                    pline("You see the ground vibrate in the distance.");
+                seetrap(trap);
+            }
+            break;
+
         default:
             impossible("Some monster encountered a strange trap of type %d.",
                        tt);
index c2ce813c628ffb22c2e717e99a2c7c2e193437be..fa64ae905295f244509648f5b2cdcee94232db6b 100644 (file)
@@ -173,6 +173,7 @@ static struct {
                    { "magic", MAGIC_TRAP },
                    { "anti magic", ANTI_MAGIC },
                    { "polymorph", POLY_TRAP },
+                   { "vibrating square", VIBRATING_SQUARE },
                    { 0, 0 } };
 
 static struct {