Add hallucinatory trap names
This adds many funny, realistic, and nonsensical traps to the game, to be shown when the player is hallucinating. Architecturally, the biggest change is merging the what_trap macro and the "defsyms[trap_to_defsym(ttyp)].explanation" pattern into a single function "trapname", which returns the name of the trap, handling the hallucination case. There is also a second parameter used for overriding hallucination in the occasional cases where the actual trap name should always be returned. In addition, the what_trap and random_trap macros are now obsolete and not used anywhere, so they are removed.
This commit is contained in:
@@ -3363,10 +3363,8 @@ struct obj *no_wish;
|
||||
goto typfnd;
|
||||
} else if (trapped == 1 || *zp != '\0') {
|
||||
/* "trapped <foo>" or "<foo> trap" (actually "<foo>*") */
|
||||
int idx = trap_to_defsym(beartrap ? BEAR_TRAP : LANDMINE);
|
||||
|
||||
/* use canonical trap spelling, skip object matching */
|
||||
Strcpy(bp, defsyms[idx].explanation);
|
||||
Strcpy(bp, trapname(beartrap ? BEAR_TRAP : LANDMINE, TRUE));
|
||||
goto wiztrap;
|
||||
}
|
||||
/* [no prefix or suffix; we're going to end up matching
|
||||
@@ -3568,7 +3566,7 @@ wiztrap:
|
||||
struct trap *t;
|
||||
const char *tname;
|
||||
|
||||
tname = defsyms[trap_to_defsym(trap)].explanation;
|
||||
tname = trapname(trap, TRUE);
|
||||
if (strncmpi(tname, bp, strlen(tname)))
|
||||
continue;
|
||||
/* found it; avoid stupid mistakes */
|
||||
@@ -3576,7 +3574,7 @@ wiztrap:
|
||||
trap = ROCKTRAP;
|
||||
if ((t = maketrap(x, y, trap)) != 0) {
|
||||
trap = t->ttyp;
|
||||
tname = defsyms[trap_to_defsym(trap)].explanation;
|
||||
tname = trapname(trap, TRUE);
|
||||
pline("%s%s.", An(tname),
|
||||
(trap != MAGIC_PORTAL) ? "" : " to nowhere");
|
||||
} else
|
||||
|
||||
Reference in New Issue
Block a user