squeaky boards (trunk only)
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.
This commit is contained in:
65
src/trap.c
65
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;
|
||||
|
||||
Reference in New Issue
Block a user