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:
copperwater
2019-01-06 00:56:05 -05:00
parent b2ad4651f3
commit 31ea7c1f62
13 changed files with 84 additions and 52 deletions

View File

@@ -2501,7 +2501,7 @@ struct obj *otmp;
ttyp = (otmp->otyp == LAND_MINE) ? LANDMINE : BEAR_TRAP;
if (otmp == trapinfo.tobj && u.ux == trapinfo.tx && u.uy == trapinfo.ty) {
You("resume setting %s%s.", shk_your(buf, otmp),
defsyms[trap_to_defsym(what_trap(ttyp))].explanation);
trapname(ttyp, FALSE));
set_occupation(set_trap, occutext, 0);
return;
}
@@ -2526,7 +2526,7 @@ struct obj *otmp;
chance = (rnl(10) > 5);
You("aren't very skilled at reaching from %s.", mon_nam(u.usteed));
Sprintf(buf, "Continue your attempt to set %s?",
the(defsyms[trap_to_defsym(what_trap(ttyp))].explanation));
the(trapname(ttyp, FALSE)));
if (yn(buf) == 'y') {
if (chance) {
switch (ttyp) {
@@ -2536,9 +2536,7 @@ struct obj *otmp;
break;
case BEAR_TRAP: /* drop it without arming it */
reset_trapset();
You("drop %s!",
the(defsyms[trap_to_defsym(what_trap(ttyp))]
.explanation));
You("drop %s!", the(trapname(ttyp, FALSE)));
dropx(otmp);
return;
}
@@ -2548,8 +2546,7 @@ struct obj *otmp;
return;
}
}
You("begin setting %s%s.", shk_your(buf, otmp),
defsyms[trap_to_defsym(what_trap(ttyp))].explanation);
You("begin setting %s%s.", shk_your(buf, otmp), trapname(ttyp, FALSE));
set_occupation(set_trap, occutext, 0);
return;
}
@@ -2581,8 +2578,7 @@ set_trap()
add_damage(u.ux, u.uy, 0L); /* schedule removal */
}
if (!trapinfo.force_bungle)
You("finish arming %s.",
the(defsyms[trap_to_defsym(what_trap(ttyp))].explanation));
You("finish arming %s.", the(trapname(ttyp, FALSE)));
if (((otmp->cursed || Fumbling) && (rnl(10) > 5))
|| trapinfo.force_bungle)
dotrap(ttmp,