add glyphs+tiles for door+chest traps

When trap detection finds trapped doors and trapped chests, it shows
those as bear traps.  When the hero comes within view, they revert to
normal and the detected trap is forgotten.  This doesn't change that,
it is just groundwork to be able to show them distinctly.  Like the
TT_BEARTRAP patch, it increments EDITLEVEL so this seemed like a good
time to put the groudwork in place.

There shouldn't be any visible changes even though internal glyph and
tile values have been renumbered after inserting two new entries.
Adding traps after S_vibrating_square was quite a hassle and suffered
though a couple of off-by-one errors that weren't trivial to find and
fix.
This commit is contained in:
PatR
2022-04-27 11:22:12 -07:00
parent d194459c7d
commit d1217b9f25
13 changed files with 294 additions and 225 deletions

View File

@@ -572,6 +572,8 @@ static NEARDATA const char *trap_engravings[TRAPNUM] = {
/* 14..16: trap door, teleport, level-teleport */
"Vlad was here", "ad aerarium", "ad aerarium", (char *) 0, (char *) 0,
(char *) 0, (char *) 0, (char *) 0, (char *) 0, (char *) 0,
/* 24..25 */
(char *) 0, (char *) 0,
};
static void
@@ -1367,7 +1369,7 @@ mktrap(
if (tm && is_pool(tm->x, tm->y))
return;
if (num > 0 && num < TRAPNUM) {
if (num > NO_TRAP && num < TRAPNUM) {
kind = num;
} else if (Is_rogue_level(&u.uz)) {
switch (rn2(7)) {
@@ -1401,6 +1403,14 @@ mktrap(
kind = rnd(TRAPNUM - 1);
/* reject "too hard" traps */
switch (kind) {
/* these are controlled by the feature or object they guard,
not by the map so mustn't be created on it */
case TRAPPED_DOOR:
case TRAPPED_CHEST:
kind = NO_TRAP;
break;
/* these can have a random location but can't be generated
randomly */
case MAGIC_PORTAL:
case VIBRATING_SQUARE:
kind = NO_TRAP;