diff --git a/doc/fixes35.0 b/doc/fixes35.0 index 17edef8ee..7fb2f18ee 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -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 diff --git a/include/context.h b/include/context.h index 3e8ae3781..40ff77c70 100644 --- a/include/context.h +++ b/include/context.h @@ -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; diff --git a/include/patchlevel.h b/include/patchlevel.h index 49d58c81b..e7d580a1a 100644 --- a/include/patchlevel.h +++ b/include/patchlevel.h @@ -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" diff --git a/include/trap.h b/include/trap.h index e672d43d3..7378dc3e0 100644 --- a/include/trap.h +++ b/include/trap.h @@ -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; diff --git a/src/trap.c b/src/trap.c index 6ff352103..198524d00 100644 --- a/src/trap.c +++ b/src/trap.c @@ -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;