]> granicus.if.org Git - nethack/commitdiff
squeaky boards (trunk only)
authornethack.allison <nethack.allison>
Sun, 8 Oct 2006 21:37:58 +0000 (21:37 +0000)
committernethack.allison <nethack.allison>
Sun, 8 Oct 2006 21:37:58 +0000 (21:37 +0000)
There is a quote in data.base for squeaky board traps:
A floorboard creaked.  Galder had spent many hours tuning them,
always a wise precaution with an ambitious assistant who walked
like a cat.
D flat.  That meant he was just to the right of the door.
"Ah, Trymon," he said, without turning, and noted with some
satisfaction the faint indrawing of breath behind him.  "Good
of you to come.  Shut the door, will you?"
[ The Light Fantastic, by Terry Pratchett ]

This patch makes each squeaky board trap on a level produce
a unique sound. If you had visited the trap yourself prior
to hearing a monster on it, you could actually know where
a monster was by the unique pitch of the squeak.

If someone wants further refinement of the roles, this could
be adjusted to only work for musically adept roles/species,
with the others only hearing a generic squeak. As it stands
right now, everyone benefits.  Does anyone thing the
separation by role or species would be good? If so, which
roles/species are musically proficient, and which are not?

Since this patch increments editlevel anyway, it also sneaks in a
context structure change for an upcoming patch.

doc/fixes35.0
include/context.h
include/patchlevel.h
include/trap.h
src/trap.c

index 17edef8eea210f683cee89c5e6fa54c66b164ddb..7fb2f18eebcbb9636839b9d623e69c3e68d4cfc2 100644 (file)
@@ -245,6 +245,7 @@ closing magic activates bear traps and webs
 locking converts a hole into a trap door; striking does the opposite
 add Malcolm Ryan's Statue Glyphs patch
 lembas and cram never rot unless cursed
+multiple squeaks for squeaky boards
 
 
 Platform- and/or Interface-Specific New Features
index 3e8ae378101b3a01a1186decf0ef2c04ef638044..40ff77c70647fd0c2ce404e9515d2beaee4a0373 100644 (file)
@@ -80,6 +80,7 @@ struct context_info {
                                /* 8: travel */
        unsigned startingpet_mid;
        int      warnlevel;
+       int      rndencode;     /* randomized escape sequence introducer */
        long next_attrib_check; /* next attribute check */
        long stethoscope_move;
        short stethoscope_movement;
index 49d58c81b0751c7306b863f8acde4109ea065285..e7d580a1a4601821930b2d2bcf2a5b96dcbd4cb7 100644 (file)
@@ -13,7 +13,7 @@
  * Incrementing EDITLEVEL can be used to force invalidation of old bones
  * and save files.
  */
-#define EDITLEVEL      36
+#define EDITLEVEL      37
 
 #define COPYRIGHT_BANNER_A \
 "NetHack, Copyright 1985-2006"
index e672d43d3137bae269e90cc74e0fab3efa576b60..7378dc3e051b569320d3a36c870f8169b433f9de 100644 (file)
@@ -11,6 +11,7 @@ union vlaunchinfo {
        short v_launch_otyp;    /* type of object to be triggered */
        coord v_launch2;        /* secondary launch point (for boulders) */
        uchar v_conjoined;      /* conjoined pit locations */
+       short v_tnote;          /* boards: 12 notes        */
 };
 
 struct trap {
@@ -32,6 +33,7 @@ struct trap {
 #define launch_otyp    vl.v_launch_otyp
 #define launch2                vl.v_launch2
 #define conjoined       vl.v_conjoined
+#define tnote          vl.v_tnote
 };
 
 extern struct trap *ftrap;
index 6ff3521033b5059ceb61c677f95354e5d7ba505c..198524d0037952ff58bfc0efbf8a49aaf79af39e 100644 (file)
@@ -24,6 +24,7 @@ STATIC_DCL void FDECL(launch_drop_spot, (struct obj *, XCHAR_P, XCHAR_P));
 STATIC_DCL int FDECL(mkroll_launch,
                        (struct trap *,XCHAR_P,XCHAR_P,SHORT_P,long));
 STATIC_DCL boolean FDECL(isclearpath,(coord *, int, SCHAR_P, SCHAR_P));
+STATIC_DCL char *FDECL(trapnote, (struct trap *,BOOLEAN_P));
 #if 0
 STATIC_DCL void FDECL(join_adjacent_pits, (struct trap *));
 #endif
@@ -248,6 +249,28 @@ register int x, y, typ;
        }
        ttmp->ttyp = typ;
        switch(typ) {
+           case SQKY_BOARD:
+             {
+               int tavail[12], tpick[12], tcnt = 0, k;
+               struct trap *t;
+
+               for (k = 0; k < 12; ++k)
+                   tavail[k] = 0;
+               for (t = ftrap; t; t = t->ntrap)
+                   if (t->ttyp == SQKY_BOARD)
+                               tavail[t->tnote] = 1;
+
+               /* Now populate tpick with the available indexes */
+               for (k = 0; k < 12; ++k) {
+                   if (tavail[k] == 0)
+                               tpick[tcnt++] = k;
+               }
+               if (tcnt > 0)
+                   ttmp->tnote = (short)tpick[rn2(tcnt)];
+               else
+                   ttmp->tnote = (short)rn2(12); /* all in use anyway */
+               break;
+             }
            case STATUE_TRAP:       /* create a "living" statue */
              { struct monst *mtmp;
                struct obj *otmp, *statue;
@@ -806,7 +829,10 @@ unsigned trflags;
                    }
                } else {
                    seetrap(trap);
-                   pline("A board beneath you squeaks loudly.");
+                   pline("A board beneath you %s%s%s.",
+                       Deaf ? "vibrates" : "squeaks ",
+                       Deaf ? "" : trapnote(trap,0),
+                       Deaf ? "" : " loudly");
                    wake_nearby();
                }
                break;
@@ -1269,6 +1295,27 @@ glovecheck:              (void) rust_dmg(uarmg, "gauntlets", 1, TRUE, &youmonst);
        }
 }
 
+STATIC_OVL char *
+trapnote(trap, noprefix)
+struct trap *trap;
+boolean noprefix;
+{
+       static char tnbuf[12];
+       const char *tn, *tnnames[12] = {
+               "C note" , "D flat",  "D note",
+               "E flat" , "E note",  "F note",
+               "F sharp", "G note",  "G sharp",
+               "A note" , "B flat",  "B note"
+       };
+       tnbuf[0] = '\0';
+       tn = tnnames[trap->tnote];
+       if (!noprefix)
+           Sprintf(tnbuf, "%s ", 
+               (*tn == 'A' || *tn == 'E' || *tn == 'F') ? "an" : "a");
+       Sprintf(eos(tnbuf), "%s", tn);
+       return tnbuf;
+}
+
 #ifdef STEED
 STATIC_OVL int
 steedintrap(trap, otmp)
@@ -1925,10 +1972,18 @@ register struct monst *mtmp;
                        if(is_flyer(mptr)) break;
                        /* stepped on a squeaky board */
                        if (in_sight) {
-                           pline("A board beneath %s squeaks loudly.", mon_nam(mtmp));
-                           seetrap(trap);
-                       } else
-                          You_hear("a distant squeak.");
+                           if (!Deaf) {
+                               pline("A board beneath %s squeaks %s loudly.",
+                                       mon_nam(mtmp), trapnote(trap,0));
+                               seetrap(trap);
+                           } else {
+                               pline("%s stops momentarily and appears to cringe.",
+                                       Monnam(mtmp));
+                           }
+                       } else if (!Deaf) {
+                          You_hear("a distant %s squeak.",
+                               trapnote(trap,1));
+                       }
                        /* wake up nearby monsters */
                        wake_nearto(mtmp->mx, mtmp->my, 40);
                        break;