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

@@ -156,7 +156,8 @@
PCHAR( 49, '^', S_squeaky_board, "squeaky board", CLR(CLR_BROWN))
PCHAR( 50, '^', S_bear_trap, "bear trap", CLR(HI_METAL))
PCHAR( 51, '^', S_land_mine, "land mine", CLR(CLR_RED))
PCHAR( 52, '^', S_rolling_boulder_trap, "rolling boulder trap", CLR(CLR_GRAY))
PCHAR( 52, '^', S_rolling_boulder_trap, "rolling boulder trap",
CLR(CLR_GRAY))
PCHAR( 53, '^', S_sleeping_gas_trap, "sleeping gas trap", CLR(HI_ZAP))
PCHAR( 54, '^', S_rust_trap, "rust trap", CLR(CLR_BLUE))
PCHAR( 55, '^', S_fire_trap, "fire trap", CLR(CLR_ORANGE))
@@ -164,15 +165,19 @@
PCHAR( 57, '^', S_spiked_pit, "spiked pit", CLR(CLR_BLACK))
PCHAR( 58, '^', S_hole, "hole", CLR(CLR_BROWN))
PCHAR( 59, '^', S_trap_door, "trap door", CLR(CLR_BROWN))
PCHAR( 60, '^', S_teleportation_trap, "teleportation trap", CLR(CLR_MAGENTA))
PCHAR( 60, '^', S_teleportation_trap, "teleportation trap",
CLR(CLR_MAGENTA))
PCHAR( 61, '^', S_level_teleporter, "level teleporter", CLR(CLR_MAGENTA))
PCHAR( 62, '^', S_magic_portal, "magic portal", CLR(CLR_BRIGHT_MAGENTA))
PCHAR( 63, '"', S_web, "web", CLR(CLR_GRAY))
PCHAR( 64, '^', S_statue_trap, "statue trap", CLR(CLR_GRAY))
PCHAR( 65, '^', S_magic_trap, "magic trap", CLR(HI_ZAP))
PCHAR2(66, '^', S_anti_magic_trap, "anti magic trap", "anti-magic field", CLR(HI_ZAP))
PCHAR2(66, '^', S_anti_magic_trap, "anti magic trap", "anti-magic field",
CLR(HI_ZAP))
PCHAR( 67, '^', S_polymorph_trap, "polymorph trap", CLR(CLR_BRIGHT_GREEN))
PCHAR( 68, '~', S_vibrating_square, "vibrating square", CLR(CLR_MAGENTA))
PCHAR( 69, '^', S_trapped_door, "trapped door", CLR(CLR_ORANGE))
PCHAR( 70, '^', S_trapped_chest, "trapped chest", CLR(CLR_ORANGE))
/* end traps */
/* end cmap B */
/* */
@@ -180,22 +185,22 @@
/* */
/* zap colors are changed by reset_glyphmap() to match type of beam */
/* */
PCHAR2(69, '|', S_vbeam, "vertical beam", "", CLR(CLR_GRAY))
PCHAR2(70, '-', S_hbeam, "horizontal beam", "", CLR(CLR_GRAY))
PCHAR2(71, '\\', S_lslant, "left slant beam", "", CLR(CLR_GRAY))
PCHAR2(72, '/', S_rslant, "right slant beam", "", CLR(CLR_GRAY))
PCHAR2(71, '|', S_vbeam, "vertical beam", "", CLR(CLR_GRAY))
PCHAR2(72, '-', S_hbeam, "horizontal beam", "", CLR(CLR_GRAY))
PCHAR2(73, '\\', S_lslant, "left slant beam", "", CLR(CLR_GRAY))
PCHAR2(74, '/', S_rslant, "right slant beam", "", CLR(CLR_GRAY))
/* start cmap C */
PCHAR2(73, '*', S_digbeam, "dig beam", "", CLR(CLR_WHITE))
PCHAR2(74, '!', S_flashbeam, "flash beam", "", CLR(CLR_WHITE))
PCHAR2(75, ')', S_boomleft, "boom left", "", CLR(HI_WOOD))
PCHAR2(76, '(', S_boomright, "boom right", "", CLR(HI_WOOD))
PCHAR2(75, '*', S_digbeam, "dig beam", "", CLR(CLR_WHITE))
PCHAR2(76, '!', S_flashbeam, "flash beam", "", CLR(CLR_WHITE))
PCHAR2(77, ')', S_boomleft, "boom left", "", CLR(HI_WOOD))
PCHAR2(78, '(', S_boomright, "boom right", "", CLR(HI_WOOD))
/* 4 magic shield symbols */
PCHAR2(77, '0', S_ss1, "shield1", "", CLR(HI_ZAP))
PCHAR2(78, '#', S_ss2, "shield2", "", CLR(HI_ZAP))
PCHAR2(79, '@', S_ss3, "shield3", "", CLR(HI_ZAP))
PCHAR2(80, '*', S_ss4, "shield4", "", CLR(HI_ZAP))
PCHAR( 81, '#', S_poisoncloud, "poison cloud", CLR(CLR_BRIGHT_GREEN))
PCHAR( 82, '?', S_goodpos, "valid position", CLR(CLR_BRIGHT_GREEN))
PCHAR2(79, '0', S_ss1, "shield1", "", CLR(HI_ZAP))
PCHAR2(80, '#', S_ss2, "shield2", "", CLR(HI_ZAP))
PCHAR2(81, '@', S_ss3, "shield3", "", CLR(HI_ZAP))
PCHAR2(82, '*', S_ss4, "shield4", "", CLR(HI_ZAP))
PCHAR( 83, '#', S_poisoncloud, "poison cloud", CLR(CLR_BRIGHT_GREEN))
PCHAR( 84, '?', S_goodpos, "valid position", CLR(CLR_BRIGHT_GREEN))
/* end cmap C */
/* */
/* The 8 swallow symbols. Do NOT separate. */
@@ -209,14 +214,14 @@
/* 4 5 6 */
/* 7 8 9 */
/* */
PCHAR2(83, '/', S_sw_tl, "swallow top left", "", CLR(CLR_GREEN)) /* 1 */
PCHAR2(84, '-', S_sw_tc, "swallow top center", "", CLR(CLR_GREEN)) /* 2 */
PCHAR2(85, '\\', S_sw_tr, "swallow top right", "", CLR(CLR_GREEN)) /* 3 */
PCHAR2(86, '|', S_sw_ml, "swallow middle left", "", CLR(CLR_GREEN)) /* 4 */
PCHAR2(87, '|', S_sw_mr, "swallow middle right", "", CLR(CLR_GREEN)) /* 6 */
PCHAR2(88, '\\', S_sw_bl, "swallow bottom left", "", CLR(CLR_GREEN)) /* 7 */
PCHAR2(89, '-', S_sw_bc, "swallow bottom center", "", CLR(CLR_GREEN)) /* 8 */
PCHAR2(90, '/', S_sw_br, "swallow bottom right", "", CLR(CLR_GREEN)) /* 9 */
PCHAR2(85, '/', S_sw_tl, "swallow top left", "", CLR(CLR_GREEN)) /*1*/
PCHAR2(86, '-', S_sw_tc, "swallow top center", "", CLR(CLR_GREEN)) /*2*/
PCHAR2(87, '\\', S_sw_tr, "swallow top right", "", CLR(CLR_GREEN)) /*3*/
PCHAR2(88, '|', S_sw_ml, "swallow middle left", "", CLR(CLR_GREEN)) /*4*/
PCHAR2(89, '|', S_sw_mr, "swallow middle right", "", CLR(CLR_GREEN)) /*6*/
PCHAR2(90, '\\', S_sw_bl, "swallow bottom left", "", CLR(CLR_GREEN)) /*7*/
PCHAR2(91, '-', S_sw_bc, "swallow bottom center", "", CLR(CLR_GREEN))/*8*/
PCHAR2(92, '/', S_sw_br, "swallow bottom right", "", CLR(CLR_GREEN)) /*9*/
/* */
/* explosion colors are changed by reset_glyphmap() to match */
/* the type of expl. */
@@ -227,15 +232,15 @@
/* |@| */
/* \-/ */
/* */
PCHAR2(91, '/', S_expl_tl, "explosion top left", "", CLR(CLR_ORANGE))
PCHAR2(92, '-', S_expl_tc, "explosion top center", "", CLR(CLR_ORANGE))
PCHAR2(93, '\\', S_expl_tr, "explosion top right", "", CLR(CLR_ORANGE))
PCHAR2(94, '|', S_expl_ml, "explosion middle left", "", CLR(CLR_ORANGE))
PCHAR2(95, ' ', S_expl_mc, "explosion middle center", "", CLR(CLR_ORANGE))
PCHAR2(96, '|', S_expl_mr, "explosion middle right", "", CLR(CLR_ORANGE))
PCHAR2(97, '\\', S_expl_bl, "explosion bottom left", "", CLR(CLR_ORANGE))
PCHAR2(98, '-', S_expl_bc, "explosion bottom center", "", CLR(CLR_ORANGE))
PCHAR2(99, '/', S_expl_br, "explosion bottom right", "", CLR(CLR_ORANGE))
PCHAR2(93, '/', S_expl_tl, "explosion top left", "", CLR(CLR_ORANGE))
PCHAR2(94, '-', S_expl_tc, "explosion top center", "", CLR(CLR_ORANGE))
PCHAR2(95, '\\', S_expl_tr, "explosion top right", "", CLR(CLR_ORANGE))
PCHAR2(96, '|', S_expl_ml, "explosion middle left", "", CLR(CLR_ORANGE))
PCHAR2(97, ' ', S_expl_mc, "explosion middle center", "", CLR(CLR_ORANGE))
PCHAR2(98, '|', S_expl_mr, "explosion middle right", "", CLR(CLR_ORANGE))
PCHAR2(99, '\\', S_expl_bl, "explosion bottom left", "", CLR(CLR_ORANGE))
PCHAR2(100, '-', S_expl_bc, "explosion bottom center", "", CLR(CLR_ORANGE))
PCHAR2(101, '/', S_expl_br, "explosion bottom right", "", CLR(CLR_ORANGE))
#undef PCHAR
#undef PCHAR2
#endif /* PCHAR_S_ENUM || PCHAR_PARSE || PCHAR_DRAWING || PCHAR_TILES */

View File

@@ -404,8 +404,8 @@ enum glyphmap_change_triggers { gm_nochange, gm_newgame, gm_levelchange,
* Altars Altar (unaligned, chaotic, neutral, lawful, other)
* Count: 5
*
* cmap B S_grave through S_vibrating_square
* Count: (S_vibrating_square - S_grave) + 1 = 37
* cmap B S_grave through S_arrow_trap + TRAPNUM - 1
* Count: (S_arrow_trap + (TRAPNUM - 1) - S_grave) = 39
*
* zap beams set of four (there are four directions) HI_ZAP.
* Count: 4 * NUM_ZAP
@@ -497,7 +497,9 @@ enum glyph_offsets {
GLYPH_CMAP_A_OFF = (((S_trwall - S_vwall) + 1) + GLYPH_CMAP_SOKO_OFF),
GLYPH_ALTAR_OFF = (((S_brdnladder - S_ndoor) + 1) + GLYPH_CMAP_A_OFF),
GLYPH_CMAP_B_OFF = (5 + GLYPH_ALTAR_OFF),
GLYPH_ZAP_OFF = (((S_vibrating_square - S_grave) + 1) + GLYPH_CMAP_B_OFF),
/* (46 + (26 - 1)- 32 ) == 39 */
GLYPH_ZAP_OFF = ((S_arrow_trap + MAXTCHARS - S_grave)
+ GLYPH_CMAP_B_OFF),
GLYPH_CMAP_C_OFF = ((NUM_ZAP << 2) + GLYPH_ZAP_OFF),
GLYPH_SWALLOW_OFF = (((S_goodpos - S_digbeam) + 1) + GLYPH_CMAP_C_OFF),
GLYPH_EXPLODE_OFF = ((NUMMONS << 3) + GLYPH_SWALLOW_OFF),
@@ -932,7 +934,7 @@ enum glyph_offsets {
(GLYPH_CMAP_B_OFF + (S_arrow_trap - S_grave))
#define glyph_is_trap(glyph) \
((glyph) >= (GLYPH_TRAP_OFF) && \
(glyph) < ((GLYPH_TRAP_OFF) + (TRAPNUM - 1)))
(glyph) < ((GLYPH_TRAP_OFF) + MAXTCHARS))
#define glyph_is_warning(glyph) \
((glyph) >= GLYPH_WARNING_OFF \
&& (glyph) < (GLYPH_WARNING_OFF + WARNCOUNT))

View File

@@ -214,6 +214,7 @@ enum misc_arti_nums {
#include "rect.h"
#include "region.h"
#include "trap.h"
#include "display.h"
#include "decl.h"
#include "timeout.h"
@@ -265,7 +266,6 @@ typedef struct sortloot_item Loot;
typedef uint32_t mmflags_nht; /* makemon MM_ flags */
#include "trap.h"
#include "flag.h"
#include "vision.h"
#include "engrave.h"

View File

@@ -17,7 +17,7 @@
* Incrementing EDITLEVEL can be used to force invalidation of old bones
* and save files.
*/
#define EDITLEVEL 54
#define EDITLEVEL 55
/*
* Development status possibilities.

View File

@@ -75,13 +75,13 @@ struct symsetentry {
*/
#define MAXDCHARS (S_water - S_stone + 1) /* mapped dungeon characters */
#define MAXTCHARS (S_vibrating_square - S_arrow_trap + 1) /* trap chars */
#define MAXTCHARS (TRAPNUM - 1) /* trap chars */
#define MAXECHARS (S_expl_br - S_vbeam + 1) /* mapped effects characters */
#define MAXEXPCHARS 9 /* number of explosion characters */
#define DARKROOMSYM (Is_rogue_level(&u.uz) ? S_stone : S_darkroom)
#define is_cmap_trap(i) ((i) >= S_arrow_trap && (i) <= S_polymorph_trap)
#define is_cmap_trap(i) ((i) >= S_arrow_trap && (i) < S_arrow_trap + MAXTCHARS)
#define is_cmap_drawbridge(i) ((i) >= S_vodbridge && (i) <= S_hcdbridge)
#define is_cmap_door(i) ((i) >= S_vodoor && (i) <= S_hcdoor)
#define is_cmap_wall(i) ((i) >= S_stone && (i) <= S_trwall)

View File

@@ -77,9 +77,18 @@ enum trap_types {
MAGIC_TRAP = 20,
ANTI_MAGIC = 21,
POLY_TRAP = 22,
VIBRATING_SQUARE = 23,
VIBRATING_SQUARE = 23, /* not a trap but shown/remembered as if one
* once it has been discovered */
TRAPNUM = 24
/* trapped door and trapped chest aren't traps on the map, but they
might be shown/remembered as such after trap detection until hero
comes in view of them and sees the feature or object;
key-using or door-busting monsters who survive a door trap learn
to avoid other such doors [not implemented] */
TRAPPED_DOOR = 24, /* part of door; not present on map as a trap */
TRAPPED_CHEST = 25, /* part of object; not on map */
TRAPNUM = 26
};
/* some trap-related function return results */