diff --git a/dat/symbols b/dat/symbols index 2852a7b0f..6f6824a9c 100644 --- a/dat/symbols +++ b/dat/symbols @@ -355,8 +355,8 @@ start: IBMgraphics S_hbeam: \xc4 # meta-D, horizontal rule S_sw_ml: \xb3 # meta-3, vertical rule S_sw_mr: \xb3 # meta-3, vertical rule - S_expl_ml: \xb3 # meta-3, vertical rule - S_expl_mr: \xb3 # meta-3, vertical rule + S_expl_ml: \xb3 # meta-3, vertical rule + S_expl_mr: \xb3 # meta-3, vertical rule finish start: IBMGraphics_1 @@ -377,8 +377,8 @@ start: IBMGraphics_1 S_hbeam: \xc4 # meta-D, horizontal rule S_sw_ml: \xb3 # meta-3, vertical rule S_sw_mr: \xb3 # meta-3, vertical rule - S_expl_ml: \xb3 # meta-3, vertical rule - S_expl_mr: \xb3 # meta-3, vertical rule + S_expl_ml: \xb3 # meta-3, vertical rule + S_expl_mr: \xb3 # meta-3, vertical rule finish start: IBMGraphics_2 @@ -403,8 +403,8 @@ start: IBMGraphics_2 S_hbeam: \xc4 # meta-D, horizontal rule S_sw_ml: \xb3 # meta-3, vertical rule S_sw_mr: \xb3 # meta-3, vertical rule - S_expl_ml: \xb3 # meta-3, vertical rule - S_expl_mr: \xb3 # meta-3, vertical rule + S_expl_ml: \xb3 # meta-3, vertical rule + S_expl_mr: \xb3 # meta-3, vertical rule finish start: RogueIBM @@ -574,8 +574,8 @@ start: curses S_hbeam: \xf1 # meta-D, horizontal rule S_sw_ml: \xf8 # meta-3, vertical rule S_sw_mr: \xf8 # meta-3, vertical rule - S_expl_ml: \xf8 # meta-3, vertical rule - S_expl_mr: \xf8 # meta-3, vertical rule + S_expl_ml: \xf8 # meta-3, vertical rule + S_expl_mr: \xf8 # meta-3, vertical rule finish start: DECgraphics @@ -619,7 +619,7 @@ start: DECgraphics S_expl_tc: \xef # meta-o, high horizontal line S_expl_ml: \xf8 # meta-x, vertical rule S_expl_mr: \xf8 # meta-x, vertical rule - S_expl_bc: \xf3 # meta-s, low horizontal line + S_expl_bc: \xf3 # meta-s, low horizontal line finish start: MACgraphics diff --git a/include/decl.h b/include/decl.h index 88eb54e3b..5f3d2a825 100644 --- a/include/decl.h +++ b/include/decl.h @@ -224,11 +224,6 @@ E const int shield_static[]; #include "spell.h" -#include "color.h" -#ifdef TEXTCOLOR -E const int zapcolors[]; -#endif - E const struct class_sym def_oc_syms[MAXOCLASSES]; /* default class symbols */ E uchar oc_syms[MAXOCLASSES]; /* current class symbols */ E const struct class_sym def_monsyms[MAXMCLASSES]; /* default class symbols */ @@ -556,14 +551,6 @@ struct trapinfo { boolean force_bungle; }; -typedef struct { - xchar gnew; /* perhaps move this bit into the rm structure. */ - int glyph; -#ifndef UNBUFFERED_GLYPHINFO - glyph_info glyphinfo; -#endif -} gbuf_entry; - enum vanq_order_modes { VANQ_MLVL_MNDX = 0, VANQ_MSTR_MNDX, @@ -1074,6 +1061,7 @@ struct instance_globals { boolean opt_initial; boolean opt_from_file; boolean opt_need_redraw; /* for doset() */ + boolean opt_need_glyph_reset; /* use menucolors to show colors in the pick-a-color menu */ boolean save_menucolors; /* copy of iflags.use_menu_colors */ struct menucoloring *save_colorings; /* copy of g.menu_colorings */ @@ -1276,8 +1264,6 @@ struct const_globals { E const struct const_globals cg; -E const glyph_info nul_glyphinfo; - #undef E #endif /* DECL_H */ diff --git a/include/defsym.h b/include/defsym.h index 5076e2260..dad43f80e 100644 --- a/include/defsym.h +++ b/include/defsym.h @@ -103,6 +103,7 @@ PCHAR2( 9, '-', S_tdwall, "tdwall", "wall", CLR(CLR_GRAY)) PCHAR2(10, '|', S_tlwall, "tlwall", "wall", CLR(CLR_GRAY)) PCHAR2(11, '|', S_trwall, "trwall", "wall", CLR(CLR_GRAY)) + /* start cmap A */ PCHAR2(12, '.', S_ndoor, "no door", "doorway", CLR(CLR_GRAY)) PCHAR2(13, '-', S_vodoor, "vertical open door", "open door", CLR(CLR_BROWN)) PCHAR2(14, '|', S_hodoor, "horizontal open door", "open door", CLR(CLR_BROWN)) @@ -122,7 +123,9 @@ PCHAR( 28, '>', S_brdnstair, "branch staircase down", CLR(CLR_YELLOW)) PCHAR( 29, '<', S_brupladder, "branch ladder up", CLR(CLR_YELLOW)) PCHAR( 30, '>', S_brdnladder, "branch ladder down", CLR(CLR_YELLOW)) + /* end cmap A */ PCHAR( 31, '_', S_altar, "altar", CLR(CLR_GRAY)) + /* start cmap B */ PCHAR( 32, '|', S_grave, "grave", CLR(CLR_WHITE)) PCHAR2(33, '\\', S_throne, "throne", "opulent throne", CLR(HI_GOLD)) PCHAR( 34, '#', S_sink, "sink", CLR(CLR_GRAY)) @@ -169,6 +172,7 @@ PCHAR( 67, '^', S_polymorph_trap, "polymorph trap", CLR(CLR_BRIGHT_GREEN)) PCHAR( 68, '~', S_vibrating_square, "vibrating square", CLR(CLR_MAGENTA)) /* end traps */ + /* end cmap B */ /* */ /* begin special effects */ /* */ @@ -178,19 +182,19 @@ 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)) + /* 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)) - /* */ /* 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)) + /* end cmap C */ /* */ /* The 8 swallow symbols. Do NOT separate. */ /* To change order or add, see the function swallow_to_glyph() */ diff --git a/include/display.h b/include/display.h index cde1499b1..30a681351 100644 --- a/include/display.h +++ b/include/display.h @@ -13,18 +13,6 @@ #include "mondata.h" /* for mindless() */ #endif -/* types of explosions */ -enum explosion_types { - EXPL_DARK = 0, - EXPL_NOXIOUS = 1, - EXPL_MUDDY = 2, - EXPL_WET = 3, - EXPL_MAGICAL = 4, - EXPL_FIERY = 5, - EXPL_FROSTY = 6, - EXPL_MAX = 7 -}; - /* * vobj_at() * @@ -241,23 +229,26 @@ enum explosion_types { * Display the hero. It is assumed that all checks necessary to determine * _if_ the hero can be seen have already been done. */ -#define maybe_display_usteed(otherwise_self) \ - ((u.usteed && mon_visible(u.usteed)) \ - ? ridden_mon_to_glyph(u.usteed, rn2_on_display_rng) \ - : (otherwise_self)) +#define maybe_display_usteed(otherwise_self) \ + ((u.usteed && mon_visible(u.usteed)) \ + ? ridden_mon_to_glyph(u.usteed, rn2_on_display_rng) \ + : (otherwise_self)) -#define display_self() \ - show_glyph(u.ux, u.uy, \ - maybe_display_usteed((U_AP_TYPE == M_AP_NOTHING) \ - ? hero_glyph \ - : (U_AP_TYPE == M_AP_FURNITURE) \ - ? cmap_to_glyph(g.youmonst.mappearance) \ - : (U_AP_TYPE == M_AP_OBJECT) \ - ? objnum_to_glyph(g.youmonst.mappearance) \ - /* else U_AP_TYPE == M_AP_MONSTER */ \ - : monnum_to_glyph(g.youmonst.mappearance))) +#define display_self() \ + show_glyph(u.ux, u.uy, \ + maybe_display_usteed( \ + ((int) U_AP_TYPE == M_AP_NOTHING) ? hero_glyph \ + : ((int) U_AP_TYPE == M_AP_FURNITURE) \ + ? cmap_to_glyph((int) g.youmonst.mappearance) \ + : ((int) U_AP_TYPE == M_AP_OBJECT) \ + ? objnum_to_glyph( \ + (int) g.youmonst.mappearance) /* else U_AP_TYPE == \ + M_AP_MONSTER */ \ + : monnum_to_glyph((int) g.youmonst.mappearance, (int) Ugender))) /* + * NetHack glyphs + * * A glyph is an abstraction that represents a _unique_ monster, object, * dungeon part, or effect. The uniqueness is important. For example, * It is not enough to have four (one for each "direction") zap beam glyphs, @@ -266,68 +257,187 @@ enum explosion_types { * [print_glyph()] can produce something different for each type of glyph. * That is, a beam of cold and a beam of fire would not only be different * colors, but would also be represented by different symbols. - * + */ + +#define NUM_ZAP 8 /* number of zap beam types */ + +/* * Glyphs are grouped for easy accessibility: * - * monster Represents all the wild (not tame) monsters. Count: NUMMONS. + * male monsters Represents all the wild (not tame) male monsters. + * Count: NUMMONS. * - * pet Represents all of the tame monsters. Count: NUMMONS + * female monsters Represents all the wild (not tame) female monsters. + * Count: NUMMONS. * - * invisible Invisible monster placeholder. Count: 1 + * male pets Represents all of the male tame monsters. + * Count: NUMMONS. * - * detect Represents all detected monsters. Count: NUMMONS + * female pets Represents all of the female tame monsters. + * Count: NUMMONS. * - * corpse One for each monster. Count: NUMMONS + * invisible Invisible monster placeholder. + * Count: 1. * - * ridden Represents all monsters being ridden. Count: NUMMONS + * detect (male) Represents all detected male monsters. + * Count: NUMMONS. * - * object One for each object. Count: NUM_OBJECTS + * detect (female) Represents all detected female monsters. + * Count: NUMMONS. * - * cmap One for each entry in the character map. The character map - * is the dungeon features and other miscellaneous things. - * Count: MAXPCHARS + * corpse One for each monster (male/female not differentiated). + * Count: NUMMONS. * - * explosions A set of nine for each of the following seven explosion types: - * dark, noxious, muddy, wet, magical, fiery, frosty. - * The nine positions represent those surrounding the hero. - * Count: MAXEXPCHARS * EXPL_MAX + * ridden (male) Represents all male monsters being ridden. + * Count: NUMMONS * - * zap beam A set of four (there are four directions) for each beam type. - * The beam type is shifted over 2 positions and the direction - * is stored in the lower 2 bits. Count: NUM_ZAP << 2 + * ridden (female) Represents all female monsters being ridden. + * Count: NUMMONS * - * swallow A set of eight for each monster. The eight positions rep- - * resent those surrounding the hero. The monster number is - * shifted over 3 positions and the swallow position is stored - * in the lower three bits. Count: NUMMONS << 3 + * object One for each object. + * Count: NUM_OBJECTS * - * warning A set of six representing the different warning levels. + * Stone Stone + * Count: 1 * - * statue One for each monster. Count: NUMMONS + * main walls level walls (main) + * Count: (S_trwall - S_vwall) + 1 = 11 * - * unexplored One for unexplored areas of the map - * nothing Nothing but background + * mines walls level walls (mines) + * Count: (S_trwall - S_vwall) + 1 = 11 + * + * gehennom walls level walls (gehennom) + * Count: (S_trwall - S_vwall) + 1 = 11 + * + * knox walls level walls (knox) + * Count: (S_trwall - S_vwall) + 1 = 11 + * + * sokoban walls level walls (sokoban) + * Count: (S_trwall - S_vwall) + 1 = 11 + * + * cmap A S_ndoor through S_brdnladder + * Count: (S_brdnladder - S_ndoor) + 1 = 19 + * + * Altars Altar (Unaligned, Chaotic, Neutral, Lawful, shrine) + * Count: 5 + * + * cmap B S_grave through S_vibrating_square + * Count: (S_vibrating_square - S_grave) + 1 = 37 + * + * zap beams set of four (there are four directions) HI_ZAP. + * Count: 4 * NUM_ZAP + * + * cmap C S_digbeam through S_goodpos + * Count: (S_goodpos - S_digbeam) + 1 = 10 + * + * swallow A set of eight for each monster. The eight positions + * represent those surrounding the hero. The monster + * number is shifted over 3 positions and the swallow + * position is stored in the lower three bits. + * Count: NUMMONS << 3 + * + * dark explosions A set of nine. + * Count: MAXEXPCHAR + * + * noxious explosions A set of nine. + * Count: MAXEXPCHAR + * + * muddy explosions A set of nine. + * Count: MAXEXPCHAR + * + * wet explosions A set of nine. + * Count: MAXEXPCHAR + * + * magical explosions A set of nine. + * Count: MAXEXPCHAR + * + * fiery explosions A set of nine. + * Count: MAXEXPCHAR + * + * frosty explosions A set of nine. + * Count: MAXEXPCHAR + * + * warning A set of six representing the different warning levels. + * Count: 6 + * + * statues (male) One for each male monster. + * Count: NUMMONS + * + * statues (female) One for each female mo nster. + * Count: NUMMONS + * + * objects piletop Represents the top of a pile as well as + * the object. + * Count: NUM_OBJECTS + * + * bodies piletop Represents the top of a pile as well as + * the object, corpse in this case. + * Count: NUMMONS + * + * male statues piletop Represents the top of a pile as well as + * the statue of a male monster. + * Count: NUMMONS + * + * female statues piletop Represents the top of a pile as well as + * the statue of a female monster. + * Count: NUMMONS + * + * unexplored One for unexplored areas of the map + * nothing Nothing but background * * The following are offsets used to convert to and from a glyph. */ -#define NUM_ZAP 8 /* number of zap beam types */ -#define GLYPH_MON_OFF 0 -#define GLYPH_PET_OFF (NUMMONS + GLYPH_MON_OFF) -#define GLYPH_INVIS_OFF (NUMMONS + GLYPH_PET_OFF) -#define GLYPH_DETECT_OFF (1 + GLYPH_INVIS_OFF) -#define GLYPH_BODY_OFF (NUMMONS + GLYPH_DETECT_OFF) -#define GLYPH_RIDDEN_OFF (NUMMONS + GLYPH_BODY_OFF) -#define GLYPH_OBJ_OFF (NUMMONS + GLYPH_RIDDEN_OFF) -#define GLYPH_CMAP_OFF (NUM_OBJECTS + GLYPH_OBJ_OFF) -#define GLYPH_EXPLODE_OFF ((MAXPCHARS - MAXEXPCHARS) + GLYPH_CMAP_OFF) -#define GLYPH_ZAP_OFF ((MAXEXPCHARS * EXPL_MAX) + GLYPH_EXPLODE_OFF) -#define GLYPH_SWALLOW_OFF ((NUM_ZAP << 2) + GLYPH_ZAP_OFF) -#define GLYPH_WARNING_OFF ((NUMMONS << 3) + GLYPH_SWALLOW_OFF) -#define GLYPH_STATUE_OFF (WARNCOUNT + GLYPH_WARNING_OFF) -#define GLYPH_UNEXPLORED_OFF (NUMMONS + GLYPH_STATUE_OFF) -#define GLYPH_NOTHING_OFF (GLYPH_UNEXPLORED_OFF + 1) -#define MAX_GLYPH (GLYPH_NOTHING_OFF + 1) +enum glyph_offsets { + GLYPH_MON_OFF = 0, + GLYPH_MON_MALE_OFF = (GLYPH_MON_OFF), + GLYPH_MON_FEM_OFF = (NUMMONS + GLYPH_MON_MALE_OFF), + GLYPH_PET_OFF = (NUMMONS + GLYPH_MON_FEM_OFF), + GLYPH_PET_MALE_OFF = (GLYPH_PET_OFF), + GLYPH_PET_FEM_OFF = (NUMMONS + GLYPH_PET_MALE_OFF), + GLYPH_INVIS_OFF = (NUMMONS + GLYPH_PET_FEM_OFF), + GLYPH_DETECT_OFF = (1 + GLYPH_INVIS_OFF), + GLYPH_DETECT_MALE_OFF = (GLYPH_DETECT_OFF), + GLYPH_DETECT_FEM_OFF = (NUMMONS + GLYPH_DETECT_MALE_OFF), + GLYPH_BODY_OFF = (NUMMONS + GLYPH_DETECT_FEM_OFF), + GLYPH_RIDDEN_OFF = (NUMMONS + GLYPH_BODY_OFF), + GLYPH_RIDDEN_MALE_OFF = (GLYPH_RIDDEN_OFF), + GLYPH_RIDDEN_FEM_OFF = (NUMMONS + GLYPH_RIDDEN_MALE_OFF), + GLYPH_OBJ_OFF = (NUMMONS + GLYPH_RIDDEN_FEM_OFF), + GLYPH_CMAP_OFF = (NUM_OBJECTS + GLYPH_OBJ_OFF), + GLYPH_CMAP_STONE_OFF = (GLYPH_CMAP_OFF), + GLYPH_CMAP_MAIN_OFF = (1 + GLYPH_CMAP_STONE_OFF), + GLYPH_CMAP_MINES_OFF = (((S_trwall - S_vwall) + 1) + GLYPH_CMAP_MAIN_OFF), + GLYPH_CMAP_GEH_OFF = (((S_trwall - S_vwall) + 1) + GLYPH_CMAP_MINES_OFF), + GLYPH_CMAP_KNOX_OFF = (((S_trwall - S_vwall) + 1) + GLYPH_CMAP_GEH_OFF), + GLYPH_CMAP_SOKO_OFF = (((S_trwall - S_vwall) + 1) + GLYPH_CMAP_KNOX_OFF), + 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), + 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), + GLYPH_EXPLODE_DARK_OFF = (GLYPH_EXPLODE_OFF), + GLYPH_EXPLODE_NOXIOUS_OFF = (MAXEXPCHARS + GLYPH_EXPLODE_DARK_OFF), + GLYPH_EXPLODE_MUDDY_OFF = (MAXEXPCHARS + GLYPH_EXPLODE_NOXIOUS_OFF), + GLYPH_EXPLODE_WET_OFF = (MAXEXPCHARS + GLYPH_EXPLODE_MUDDY_OFF), + GLYPH_EXPLODE_MAGICAL_OFF = (MAXEXPCHARS + GLYPH_EXPLODE_WET_OFF), + GLYPH_EXPLODE_FIERY_OFF = (MAXEXPCHARS + GLYPH_EXPLODE_MAGICAL_OFF), + GLYPH_EXPLODE_FROSTY_OFF = (MAXEXPCHARS + GLYPH_EXPLODE_FIERY_OFF), + GLYPH_WARNING_OFF = (MAXEXPCHARS + GLYPH_EXPLODE_FROSTY_OFF), + GLYPH_STATUE_OFF = (WARNCOUNT + GLYPH_WARNING_OFF), + GLYPH_STATUE_MALE_OFF = (GLYPH_STATUE_OFF), + GLYPH_STATUE_FEM_OFF = (NUMMONS + GLYPH_STATUE_MALE_OFF), + GLYPH_PILETOP_OFF = (NUMMONS + GLYPH_STATUE_FEM_OFF), + GLYPH_OBJ_PILETOP_OFF = (GLYPH_PILETOP_OFF), + GLYPH_BODY_PILETOP_OFF = (NUM_OBJECTS + GLYPH_OBJ_PILETOP_OFF), + GLYPH_STATUE_MALE_PILETOP_OFF = (NUMMONS + GLYPH_BODY_PILETOP_OFF), + GLYPH_STATUE_FEM_PILETOP_OFF = (NUMMONS + GLYPH_STATUE_MALE_PILETOP_OFF), + GLYPH_UNEXPLORED_OFF = (NUMMONS + GLYPH_STATUE_FEM_PILETOP_OFF), + GLYPH_NOTHING_OFF = (GLYPH_UNEXPLORED_OFF + 1), + MAX_GLYPH +}; #define NO_GLYPH MAX_GLYPH #define GLYPH_INVISIBLE GLYPH_INVIS_OFF @@ -335,71 +445,100 @@ enum explosion_types { #define GLYPH_NOTHING GLYPH_NOTHING_OFF #define warning_to_glyph(mwarnlev) ((mwarnlev) + GLYPH_WARNING_OFF) -#define mon_to_glyph(mon, rng) \ - ((int) what_mon(monsndx((mon)->data), rng) + GLYPH_MON_OFF) -#define detected_mon_to_glyph(mon, rng) \ - ((int) what_mon(monsndx((mon)->data), rng) + GLYPH_DETECT_OFF) -#define ridden_mon_to_glyph(mon, rng) \ - ((int) what_mon(monsndx((mon)->data), rng) + GLYPH_RIDDEN_OFF) -#define pet_to_glyph(mon, rng) \ - ((int) what_mon(monsndx((mon)->data), rng) + GLYPH_PET_OFF) +#define mon_to_glyph(mon, rng) \ + ((int) what_mon(monsndx((mon)->data), rng) + \ + (((mon)->female == 0) ? GLYPH_MON_MALE_OFF : GLYPH_MON_FEM_OFF)) +#define detected_mon_to_glyph(mon, rng) \ + ((int) what_mon(monsndx((mon)->data), rng) + \ + (((mon)->female == 0) ? GLYPH_DETECT_MALE_OFF : GLYPH_DETECT_FEM_OFF)) +#define ridden_mon_to_glyph(mon, rng) \ + ((int) what_mon(monsndx((mon)->data), rng) + \ + (((mon)->female == 0) ? GLYPH_RIDDEN_MALE_OFF : GLYPH_RIDDEN_FEM_OFF)) +#define pet_to_glyph(mon, rng) \ + ((int) what_mon(monsndx((mon)->data), rng) + \ + (((mon)->female == 0) ? GLYPH_PET_MALE_OFF : GLYPH_PET_FEM_OFF)) -/* This has the unfortunate side effect of needing a global variable */ -/* to store a result. 'otg_temp' is defined and declared in decl.{ch}. */ -#define random_obj_to_glyph(rng) \ - ((g.otg_temp = random_object(rng)) == CORPSE \ - ? random_monster(rng) + GLYPH_BODY_OFF \ - : g.otg_temp + GLYPH_OBJ_OFF) +#define altar_to_glyph(amsk) \ + (((amsk & AM_NONE) == AM_NONE) \ + ? (GLYPH_ALTAR_OFF + 0) \ + : ((amsk & AM_CHAOTIC) == AM_CHAOTIC) \ + ? (GLYPH_ALTAR_OFF + 1) \ + : ((amsk & AM_NEUTRAL) == AM_NEUTRAL) \ + ? (GLYPH_ALTAR_OFF + 2) \ + : ((amsk & AM_NEUTRAL) == AM_LAWFUL) \ + ? (GLYPH_ALTAR_OFF + 3) \ + : ((amsk & AM_NEUTRAL) == AM_SHRINE) \ + ? (GLYPH_ALTAR_OFF + 4) \ + : (GLYPH_ALTAR_OFF + 2)) -#define obj_to_glyph(obj, rng) \ - (((obj)->otyp == STATUE) \ - ? statue_to_glyph(obj, rng) \ - : Hallucination \ - ? random_obj_to_glyph(rng) \ - : ((obj)->otyp == CORPSE) \ - ? (int) (obj)->corpsenm + GLYPH_BODY_OFF \ - : (int) (obj)->otyp + GLYPH_OBJ_OFF) +/* not used, nor is it correct +#define zap_to_glyph(zaptype, cmap_idx) \ + ((((cmap_idx) - S_vbeam) + 1) + GLYPH_ZAP_OFF) +*/ -/* MRKR: Statues now have glyphs corresponding to the monster they */ -/* represent and look like monsters when you are hallucinating. */ +#define explosion_to_glyph(expltyp, idx) \ + ((expltyp == EXPL_FROSTY) ? \ + (((idx) - S_expl_tl) + GLYPH_EXPLODE_FROSTY_OFF) \ + : (expltyp == EXPL_FIERY) ? \ + (((idx) - S_expl_tl) + GLYPH_EXPLODE_FIERY_OFF) \ + : (expltyp == EXPL_MAGICAL) ? \ + (((idx) - S_expl_tl) + GLYPH_EXPLODE_MAGICAL_OFF) \ + : (expltyp == EXPL_WET) ? \ + (((idx) - S_expl_tl) + GLYPH_EXPLODE_WET_OFF) \ + : (expltyp == EXPL_MUDDY) ? \ + (((idx) - S_expl_tl) + GLYPH_EXPLODE_MUDDY_OFF) \ + : (expltyp == EXPL_NOXIOUS) ? \ + (((idx) - S_expl_tl) + GLYPH_EXPLODE_NOXIOUS_OFF) \ + : (((idx) - S_expl_tl) + GLYPH_EXPLODE_FIERY_OFF)) -#define statue_to_glyph(obj, rng) \ - (Hallucination ? random_monster(rng) + GLYPH_MON_OFF \ - : (int) (obj)->corpsenm + GLYPH_STATUE_OFF) +#define cmap_walls_to_glyph(cmap_idx) \ + ( In_mines(&u.uz) ? (((cmap_idx) - S_vwall) + GLYPH_CMAP_MINES_OFF) \ + : In_hell(&u.uz) ? (((cmap_idx) - S_vwall) + GLYPH_CMAP_GEH_OFF) \ + : Is_knox(&u.uz) ? (((cmap_idx) - S_vwall) + GLYPH_CMAP_KNOX_OFF) \ + : In_sokoban(&u.uz) ? (((cmap_idx) - S_vwall) + GLYPH_CMAP_SOKO_OFF) \ + : (((cmap_idx) - S_vwall) + GLYPH_CMAP_MAIN_OFF)) -/* briefly used for Qt's "paper doll" inventory which shows map tiles for - equipped objects; those vary like floor items during hallucination now - so this isn't used anywhere */ -#define obj_to_true_glyph(obj) \ - (((obj)->otyp == STATUE) \ - ? ((int) (obj)->corpsenm + GLYPH_STATUE_OFF) \ - : ((obj)->otyp == CORPSE) \ - ? ((int) (obj)->corpsenm + GLYPH_BODY_OFF) \ - : ((int) (obj)->otyp + GLYPH_OBJ_OFF)) +#define cmap_a_to_glyph(cmap_idx) \ + (((cmap_idx) - S_ndoor) + GLYPH_CMAP_A_OFF) -#define cmap_to_glyph(cmap_idx) ((int) (cmap_idx) + GLYPH_CMAP_OFF) -#define explosion_to_glyph(expltype, idx) \ - ((((expltype) * MAXEXPCHARS) + ((idx) - S_expl_tl)) + GLYPH_EXPLODE_OFF) +#define cmap_b_to_glyph(cmap_idx) \ + (((cmap_idx) - S_grave) + GLYPH_CMAP_B_OFF) + +#define cmap_c_to_glyph(cmap_idx) \ + (((cmap_idx) - S_digbeam) + GLYPH_CMAP_C_OFF) + +#define cmap_to_glyph(cmap_idx) \ + ( ((cmap_idx) == S_stone) ? GLYPH_CMAP_STONE_OFF \ + : ((cmap_idx) <= S_trwall) ? cmap_walls_to_glyph(cmap_idx) \ + : ((cmap_idx) < S_altar) ? cmap_a_to_glyph(cmap_idx) \ + : ((cmap_idx) == S_altar) ? altar_to_glyph(AM_NEUTRAL) \ + : ((cmap_idx) <= S_vibrating_square) ? cmap_b_to_glyph(cmap_idx) \ + : ((cmap_idx) <= S_goodpos) ? cmap_c_to_glyph(cmap_idx) \ + : NO_GLYPH) #define trap_to_glyph(trap) \ - cmap_to_glyph(trap_to_defsym((trap)->ttyp)) + cmap_to_glyph(trap_to_defsym(((int) (trap)->ttyp))) /* Not affected by hallucination. Gives a generic body for CORPSE */ /* MRKR: ...and the generic statue */ #define objnum_to_glyph(onum) ((int) (onum) + GLYPH_OBJ_OFF) -#define monnum_to_glyph(mnum) ((int) (mnum) + GLYPH_MON_OFF) -#define detected_monnum_to_glyph(mnum) ((int) (mnum) + GLYPH_DETECT_OFF) -#define ridden_monnum_to_glyph(mnum) ((int) (mnum) + GLYPH_RIDDEN_OFF) -#define petnum_to_glyph(mnum) ((int) (mnum) + GLYPH_PET_OFF) +#define monnum_to_glyph(mnum,gnd) ((int) (mnum) + \ + ((gnd == MALE) ? GLYPH_MON_MALE_OFF : GLYPH_MON_FEM_OFF)) +#define detected_monnum_to_glyph(mnum,gnd) ((int) (mnum) + \ + ((gnd == MALE) ? GLYPH_DETECT_MALE_OFF : GLYPH_DETECT_FEM_OFF)) +#define ridden_monnum_to_glyph(mnum,gnd) ((int) (mnum) + \ + ((gnd == MALE) ? GLYPH_RIDDEN_MALE_OFF : GLYPH_RIDDEN_FEM_OFF)) +#define petnum_to_glyph(mnum,gnd) ((int) (mnum) + \ + ((gnd == MALE) ? GLYPH_PET_MALE_OFF : GLYPH_PET_FEM_OFF)) /* The hero's glyph when seen as a monster. */ -#define hero_glyph \ - monnum_to_glyph((Upolyd || !flags.showrace) \ - ? u.umonnum \ +#define hero_glyph \ + monnum_to_glyph((Upolyd || !flags.showrace) \ + ? u.umonnum \ : (flags.female && g.urace.femalenum != NON_PM) \ ? g.urace.femalenum \ - : g.urace.malenum) + : g.urace.malenum, (Ugender)) /* * Change the given glyph into it's given type. Note: @@ -413,98 +552,431 @@ enum explosion_types { * out of range, it will return zero (for lack of anything better * to return). */ -#define glyph_to_mon(glyph) \ - (glyph_is_normal_monster(glyph) \ - ? ((glyph) - GLYPH_MON_OFF) \ - : glyph_is_pet(glyph) \ - ? ((glyph) - GLYPH_PET_OFF) \ - : glyph_is_detected_monster(glyph) \ - ? ((glyph) - GLYPH_DETECT_OFF) \ - : glyph_is_ridden_monster(glyph) \ - ? ((glyph) - GLYPH_RIDDEN_OFF) \ - : glyph_is_statue(glyph) \ - ? ((glyph) - GLYPH_STATUE_OFF) \ - : NO_GLYPH) -#define glyph_to_obj(glyph) \ - (glyph_is_body(glyph) \ - ? CORPSE \ - : glyph_is_statue(glyph) \ - ? STATUE \ - : glyph_is_normal_object(glyph) \ - ? ((glyph) - GLYPH_OBJ_OFF) \ - : NO_GLYPH) -#define glyph_to_trap(glyph) \ - (glyph_is_trap(glyph) ? ((int) defsym_to_trap((glyph) - GLYPH_CMAP_OFF)) \ - : NO_GLYPH) + +#define glyph_to_trap(glyph) \ + (glyph_is_trap(glyph) \ + ? ((int) defsym_to_trap(((glyph) - GLYPH_TRAP_OFF) + S_arrow_trap)) \ + : NO_GLYPH) + +#define glyph_is_cmap_main(glyph) \ + ((glyph) >= GLYPH_CMAP_MAIN_OFF && \ + (glyph) < (((S_trwall - S_vwall) +1) + GLYPH_CMAP_MAIN_OFF)) +#define glyph_is_cmap_mines(glyph) \ + ((glyph) >= GLYPH_CMAP_MINES_OFF && \ + (glyph) < (((S_trwall - S_vwall) + 1) + GLYPH_CMAP_MINES_OFF)) +#define glyph_is_cmap_gehennom(glyph) \ + ((glyph) >= GLYPH_CMAP_GEH_OFF && \ + (glyph) < (((S_trwall - S_vwall) + 1) + GLYPH_CMAP_GEH_OFF)) +#define glyph_is_cmap_knox(glyph) \ + ((glyph) >= GLYPH_CMAP_KNOX_OFF && \ + (glyph) < (((S_trwall - S_vwall) + 1) + GLYPH_CMAP_KNOX_OFF)) +#define glyph_is_cmap_sokoban(glyph) \ + ((glyph) >= GLYPH_CMAP_SOKO_OFF && \ + (glyph) < (((S_trwall - S_vwall) + 1) + GLYPH_CMAP_SOKO_OFF)) +#define glyph_is_cmap_a(glyph) \ + ((glyph) >= GLYPH_CMAP_A_OFF && \ + (glyph) < (((S_brdnladder - S_ndoor) + 1) + GLYPH_CMAP_A_OFF)) +#define glyph_is_cmap_altar(glyph) \ + ((glyph) >= GLYPH_ALTAR_OFF && \ + (glyph) < (5 + GLYPH_ALTAR_OFF)) +#define glyph_is_cmap_b(glyph) \ + ((glyph) >= GLYPH_CMAP_B_OFF && \ + ((glyph) < (((S_vibrating_square - S_grave) + 1) + GLYPH_CMAP_B_OFF))) +#define glyph_is_cmap_zap(glyph) \ + ((glyph) >= GLYPH_ZAP_OFF && (glyph) < ((NUM_ZAP << 2) + GLYPH_ZAP_OFF)) +#define glyph_is_cmap_c(glyph) \ + ((glyph) >= GLYPH_CMAP_C_OFF && \ + (glyph) < (((S_goodpos - S_digbeam) + 1) + GLYPH_CMAP_C_OFF)) +#define glyph_is_swallow(glyph) \ + ((glyph) >= GLYPH_SWALLOW_OFF && (glyph) < (((NUMMONS << 3) + GLYPH_SWALLOW_OFF))) +#define glyph_is_explosion(glyph) \ + ((glyph) >= GLYPH_EXPLODE_OFF && \ + (glyph) < (MAXEXPCHARS + GLYPH_EXPLODE_FROSTY_OFF)) +#define glyph_is_cmap(glyph) \ + (((glyph) == GLYPH_CMAP_STONE_OFF) \ + || glyph_is_cmap_main(glyph) \ + || glyph_is_cmap_mines(glyph) \ + || glyph_is_cmap_gehennom(glyph) \ + || glyph_is_cmap_knox(glyph) \ + || glyph_is_cmap_sokoban(glyph) \ + || glyph_is_cmap_a(glyph) \ + || glyph_is_cmap_altar(glyph) \ + || glyph_is_cmap_b(glyph) \ + || glyph_is_cmap_c(glyph)) + #define glyph_to_cmap(glyph) \ - (glyph_is_cmap(glyph) ? ((glyph) - GLYPH_CMAP_OFF) : NO_GLYPH) + (((glyph) == GLYPH_CMAP_STONE_OFF) \ + ? S_stone \ + : glyph_is_cmap_main(glyph) \ + ? (((glyph) - GLYPH_CMAP_MAIN_OFF) + S_vwall) \ + : glyph_is_cmap_mines(glyph) \ + ? (((glyph) - GLYPH_CMAP_MINES_OFF) + S_vwall) \ + : glyph_is_cmap_gehennom(glyph) \ + ? (((glyph) - GLYPH_CMAP_GEH_OFF) + S_vwall) \ + : glyph_is_cmap_knox(glyph) \ + ? (((glyph) - GLYPH_CMAP_KNOX_OFF) + S_vwall) \ + : glyph_is_cmap_sokoban(glyph) \ + ? (((glyph) - GLYPH_CMAP_SOKO_OFF) + S_vwall) \ + : glyph_is_cmap_a(glyph) \ + ? (((glyph) - GLYPH_CMAP_A_OFF) + S_ndoor) \ + : glyph_is_cmap_altar(glyph) \ + ? (S_altar) \ + : glyph_is_cmap_b(glyph) \ + ? (((glyph) - GLYPH_CMAP_B_OFF) + S_grave) \ + : glyph_is_cmap_c(glyph) \ + ? (((glyph) - GLYPH_CMAP_C_OFF) + S_digbeam) \ + : NO_GLYPH) + #define glyph_to_swallow(glyph) \ (glyph_is_swallow(glyph) ? (((glyph) - GLYPH_SWALLOW_OFF) & 0x7) : 0) #define glyph_to_warning(glyph) \ - (glyph_is_warning(glyph) ? ((glyph) - GLYPH_WARNING_OFF) : NO_GLYPH); + (glyph_is_warning(glyph) ? ((glyph) - GLYPH_WARNING_OFF) : NO_GLYPH) /* * Return true if the given glyph is what we want. Note that bodies are * considered objects. */ +#define glyph_is_normal_male_monster(glyph) \ + ((glyph) >= GLYPH_MON_MALE_OFF && (glyph) < (GLYPH_MON_MALE_OFF + NUMMONS)) +#define glyph_is_normal_female_monster(glyph) \ + ((glyph) >= GLYPH_MON_FEM_OFF && (glyph) < (GLYPH_MON_FEM_OFF + NUMMONS)) +#define glyph_is_normal_monster(glyph) \ + (glyph_is_normal_male_monster(glyph) || glyph_is_normal_female_monster(glyph)) +#define glyph_is_female_pet(glyph) \ + ((glyph) >= GLYPH_PET_FEM_OFF && (glyph) < (GLYPH_PET_FEM_OFF + NUMMONS)) +#define glyph_is_male_pet(glyph) \ + ((glyph) >= GLYPH_PET_MALE_OFF && (glyph) < (GLYPH_PET_MALE_OFF + NUMMONS)) +#define glyph_is_pet(glyph) \ + (glyph_is_male_pet(glyph) || glyph_is_female_pet(glyph)) +#define glyph_is_ridden_female_monster(glyph) \ + ((glyph) >= GLYPH_RIDDEN_FEM_OFF && (glyph) < \ + (GLYPH_RIDDEN_FEM_OFF + NUMMONS)) +#define glyph_is_ridden_male_monster(glyph) \ + ((glyph) >= GLYPH_RIDDEN_MALE_OFF && (glyph) < \ + (GLYPH_RIDDEN_MALE_OFF + NUMMONS)) +#define glyph_is_ridden_monster(glyph) \ + (glyph_is_ridden_male_monster(glyph) \ + || glyph_is_ridden_female_monster(glyph)) +#define glyph_is_detected_female_monster(glyph) \ + ((glyph) >= GLYPH_DETECT_FEM_OFF && (glyph) < \ + (GLYPH_DETECT_FEM_OFF + NUMMONS)) +#define glyph_is_detected_male_monster(glyph) \ + ((glyph) >= GLYPH_DETECT_MALE_OFF && (glyph) < \ + (GLYPH_DETECT_MALE_OFF + NUMMONS)) +#define glyph_is_detected_monster(glyph) \ + (glyph_is_detected_male_monster(glyph) \ + || glyph_is_detected_female_monster(glyph)) #define glyph_is_monster(glyph) \ (glyph_is_normal_monster(glyph) || glyph_is_pet(glyph) \ || glyph_is_ridden_monster(glyph) || glyph_is_detected_monster(glyph)) -#define glyph_is_normal_monster(glyph) \ - ((glyph) >= GLYPH_MON_OFF && (glyph) < (GLYPH_MON_OFF + NUMMONS)) -#define glyph_is_pet(glyph) \ - ((glyph) >= GLYPH_PET_OFF && (glyph) < (GLYPH_PET_OFF + NUMMONS)) -#define glyph_is_body(glyph) \ - ((glyph) >= GLYPH_BODY_OFF && (glyph) < (GLYPH_BODY_OFF + NUMMONS)) - -#define glyph_is_statue(glyph) \ - ((glyph) >= GLYPH_STATUE_OFF && (glyph) < (GLYPH_STATUE_OFF + NUMMONS)) - -#define glyph_is_ridden_monster(glyph) \ - ((glyph) >= GLYPH_RIDDEN_OFF && (glyph) < (GLYPH_RIDDEN_OFF + NUMMONS)) -#define glyph_is_detected_monster(glyph) \ - ((glyph) >= GLYPH_DETECT_OFF && (glyph) < (GLYPH_DETECT_OFF + NUMMONS)) #define glyph_is_invisible(glyph) ((glyph) == GLYPH_INVISIBLE) + +#define glyph_to_mon(glyph) \ + (glyph_is_normal_female_monster(glyph) \ + ? ((glyph) - GLYPH_MON_FEM_OFF) \ + : glyph_is_normal_male_monster(glyph) \ + ? ((glyph) - GLYPH_MON_MALE_OFF) \ + : glyph_is_female_pet(glyph) \ + ? ((glyph) - GLYPH_PET_FEM_OFF) \ + : glyph_is_male_pet(glyph) \ + ? ((glyph) - GLYPH_PET_MALE_OFF) \ + : glyph_is_detected_female_monster(glyph) \ + ? ((glyph) - GLYPH_DETECT_FEM_OFF) \ + : glyph_is_detected_male_monster(glyph) \ + ? ((glyph) - GLYPH_DETECT_MALE_OFF) \ + : glyph_is_ridden_female_monster(glyph) \ + ? ((glyph) - GLYPH_RIDDEN_FEM_OFF) \ + : glyph_is_ridden_male_monster(glyph) \ + ? ((glyph) - GLYPH_RIDDEN_MALE_OFF) \ + : NO_GLYPH) + +#define obj_is_piletop(obj) \ + ((obj)->where == OBJ_FLOOR \ + && g.level.objects[(obj)->ox][(obj)->oy] \ + && g.level.objects[(obj)->ox][(obj)->oy]->nexthere) + +#define glyph_is_body_piletop(glyph) \ + (((glyph) >= GLYPH_BODY_PILETOP_OFF) \ + && ((glyph) < (GLYPH_BODY_PILETOP_OFF + NUMMONS))) +#define glyph_is_body(glyph) \ + ((((glyph) >= GLYPH_BODY_OFF) && ((glyph) < (GLYPH_BODY_OFF + NUMMONS))) \ + || glyph_is_body_piletop(glyph)) + +#define glyph_is_fem_statue_piletop(glyph) \ + (((glyph) >= GLYPH_STATUE_FEM_PILETOP_OFF) \ + && ((glyph) < (GLYPH_STATUE_FEM_PILETOP_OFF + NUMMONS))) +#define glyph_is_male_statue_piletop(glyph) \ + (((glyph) >= GLYPH_STATUE_MALE_PILETOP_OFF) \ + && ((glyph) < (GLYPH_STATUE_MALE_PILETOP_OFF + NUMMONS))) +#define glyph_is_fem_statue(glyph) \ + ((((glyph) >= GLYPH_STATUE_FEM_OFF) && \ + ((glyph) < (GLYPH_STATUE_FEM_OFF + NUMMONS))) \ + || glyph_is_fem_statue_piletop(glyph)) +#define glyph_is_male_statue(glyph) \ + ((((glyph) >= GLYPH_STATUE_MALE_OFF) && \ + ((glyph) < (GLYPH_STATUE_MALE_OFF + NUMMONS))) \ + || glyph_is_male_statue_piletop(glyph)) +#define glyph_is_statue(glyph) \ + (glyph_is_male_statue(glyph) || glyph_is_fem_statue(glyph)) +#define glyph_is_normal_piletop_obj(glyph) \ + (((glyph) >= GLYPH_OBJ_PILETOP_OFF) && \ + ((glyph) < (GLYPH_OBJ_PILETOP_OFF + NUM_OBJECTS))) #define glyph_is_normal_object(glyph) \ - ((glyph) >= GLYPH_OBJ_OFF && (glyph) < (GLYPH_OBJ_OFF + NUM_OBJECTS)) + ((((glyph) >= GLYPH_OBJ_OFF) && \ + ((glyph) < (GLYPH_OBJ_OFF + NUM_OBJECTS))) \ + || glyph_is_normal_piletop_obj(glyph)) + +#if 0 +#define glyph_is_object(glyph) \ +((((glyph) >= GLYPH_OBJ_OFF) && ((glyph) < (GLYPH_OBJ_OFF + NUM_OBJECTS))) \ + || (((glyph) >= GLYPH_OBJ_PILETOP_OFF) \ + && ((glyph) < (GLYPH_OBJ_PILETOP_OFF + NUM_OBJECTS))) \ + || (((glyph) >= GLYPH_STATUE_MALE_OFF) \ + && ((glyph) < (GLYPH_STATUE_MALE_OFF + NUMMONS))) \ + || (((glyph) >= GLYPH_STATUE_MALE_PILETOP_OFF) \ + && ((glyph) < (GLYPH_STATUE_MALE_PILETOP_OFF + NUMMONS))) \ + || (((glyph) >= GLYPH_STATUE_FEM_OFF) \ + && ((glyph) < (GLYPH_STATUE_FEM_OFF + NUMMONS))) \ + || (((glyph) >= GLYPH_STATUE_FEM_PILETOP_OFF) \ + && ((glyph) < (GLYPH_STATUE_FEM_PILETOP_OFF + NUMMONS))) \ + || (((glyph) >= GLYPH_BODY_OFF) && ((glyph) < (GLYPH_BODY_OFF + NUMMONS))) \ + || (((glyph) >= GLYPH_BODY_PILETOP_OFF) \ + && ((glyph) < (GLYPH_BODY_PILETOP_OFF + NUMMONS)))) +#endif #define glyph_is_object(glyph) \ (glyph_is_normal_object(glyph) || glyph_is_statue(glyph) \ || glyph_is_body(glyph)) -#define glyph_is_trap(glyph) \ - ((glyph) >= (GLYPH_CMAP_OFF + trap_to_defsym(1)) \ - && (glyph) < (GLYPH_CMAP_OFF + trap_to_defsym(1) + TRAPNUM)) -#define glyph_is_cmap(glyph) \ - ((glyph) >= GLYPH_CMAP_OFF && (glyph) < (GLYPH_CMAP_OFF + MAXPCHARS)) -#define glyph_is_swallow(glyph) \ - ((glyph) >= GLYPH_SWALLOW_OFF \ - && (glyph) < (GLYPH_SWALLOW_OFF + (NUMMONS << 3))) + +/* briefly used for Qt's "paper doll" inventory which shows map tiles for + equipped objects; those vary like floor items during hallucination now + so this isn't used anywhere */ +#define obj_to_true_glyph(obj) \ + (((obj)->otyp == STATUE) \ + ? ((int) (obj)->corpsenm + \ + (((obj)->spe & CORPSTAT_GENDER) == CORPSTAT_FEMALE) \ + ? (obj_is_piletop(obj) \ + ? (GLYPH_STATUE_FEM_PILETOP_OFF) \ + : (GLYPH_STATUE_FEM_OFF)) \ + : (obj_is_piletop(obj) \ + ? (GLYPH_STATUE_MALE_PILETOP_OFF) \ + : (GLYPH_STATUE_MALE_OFF)) \ + : (((obj)->otyp == CORPSE) \ + ? ((int) (obj)->corpsenm + \ + (obj_is_piletop(obj) \ + ? (GLYPH_BODY_PILETOP_OFF) \ + ? (GLYPH_BODY_OFF))) \ + : ((int) (obj)->otyp + GLYPH_OBJ_OFF)))) + +#define glyph_to_obj(glyph) \ + (glyph_is_body(glyph) \ + ? CORPSE \ + : glyph_is_statue(glyph) \ + ? STATUE \ + : glyph_is_normal_object(glyph) \ + ? ((glyph) - \ + (glyph_is_normal_piletop_obj(glyph) \ + ? GLYPH_OBJ_PILETOP_OFF \ + : GLYPH_OBJ_OFF)) \ + : NO_GLYPH) + +#define glyph_to_body_corpsenm(glyph) \ + (glyph_is_body_piletop(glyph) \ + ? ((glyph) - GLYPH_BODY_PILETOP_OFF) \ + : ((glyph) - GLYPH_BODY_OFF)) + +#define glyph_to_statue_corpsenm(glyph) \ + (glyph_is_fem_statue_piletop(glyph) \ + ? ((glyph) - GLYPH_STATUE_FEM_PILETOP_OFF) \ + : glyph_is_male_statue_piletop(glyph) \ + ? ((glyph) - GLYPH_STATUE_MALE_PILETOP_OFF) \ + : glyph_is_fem_statue(glyph) \ + ? ((glyph) - GLYPH_STATUE_FEM_OFF) \ + : glyph_is_male_statue(glyph) \ + ? ((glyph) - GLYPH_STATUE_MALE_OFF) \ + : NO_GLYPH) + +/* These have the unfortunate side effect of needing a global variable */ +/* to store a result. 'otg_temp' is defined and declared in decl.{ch}. */ +#define random_obj_to_glyph(rng) \ + ((g.otg_temp = random_object(rng)) == CORPSE \ + ? (random_monster(rng) + GLYPH_BODY_OFF) \ + : (g.otg_temp + GLYPH_OBJ_OFF)) +#define corpse_to_glyph(obj) \ + ((int) ((obj)->corpsenm + (obj_is_piletop(obj) \ + ? GLYPH_BODY_PILETOP_OFF \ + : GLYPH_BODY_OFF))) +#define normal_obj_to_glyph(obj) \ + ((int) ((obj)->otyp + (obj_is_piletop(obj) \ + ? GLYPH_OBJ_PILETOP_OFF \ + : GLYPH_OBJ_OFF))) + +/* MRKR: Statues now have glyphs corresponding to the monster they */ +/* represent and look like monsters when you are hallucinating. */ + +#define statue_to_glyph(obj, rng) \ + ((Hallucination) \ + ? ((random_monster(rng)) + \ + ((!(rng)(2)) ? GLYPH_MON_MALE_OFF : GLYPH_MON_FEM_OFF)) \ + : ((int) (obj)->corpsenm + \ + ((((obj)->spe & CORPSTAT_GENDER) == CORPSTAT_FEMALE) \ + ? (obj_is_piletop(obj) \ + ? GLYPH_STATUE_FEM_PILETOP_OFF \ + : GLYPH_STATUE_FEM_OFF) \ + : (obj_is_piletop(obj) \ + ? GLYPH_STATUE_MALE_PILETOP_OFF \ + : GLYPH_STATUE_MALE_OFF)))) + +#define obj_to_glyph(obj, rng) \ + (((obj)->otyp == STATUE) \ + ? statue_to_glyph(obj, rng) \ + : ((Hallucination) \ + ? random_obj_to_glyph(rng) \ + : (((obj)->otyp == CORPSE) \ + ? corpse_to_glyph(obj) \ + : normal_obj_to_glyph(obj)))) + +#define GLYPH_TRAP_OFF \ + (GLYPH_CMAP_B_OFF + (S_arrow_trap - S_grave)) +#define glyph_is_trap(glyph) \ + ((glyph) >= (GLYPH_TRAP_OFF) && \ + (glyph) < ((GLYPH_TRAP_OFF) + (TRAPNUM - 1))) #define glyph_is_warning(glyph) \ ((glyph) >= GLYPH_WARNING_OFF \ && (glyph) < (GLYPH_WARNING_OFF + WARNCOUNT)) #define glyph_is_unexplored(glyph) ((glyph) == GLYPH_UNEXPLORED) #define glyph_is_nothing(glyph) ((glyph) == GLYPH_NOTHING) -/* glyphflags for map_glyphinfo */ +/* +#define glyph_is_piletop(glyph) \ + (glyph_is_body_piletop(glyph) || glyph_is_statue_piletop(glyph) \ + || glyph_is_obj_piletop(glyph)) +*/ /* mgflags for altering map_glyphinfo() internal behaviour */ #define MG_FLAG_NORMAL 0x00 -#define MG_FLAG_NOOVERRIDE 0x01 -#define MG_FLAG_RETURNIDX 0x02 +#define MG_FLAG_NOOVERRIDE 0x01 /* disregard accessibility override values */ -/* Special mapped glyphflags encoded by map_glyphinfo() */ -#define MG_CORPSE 0x0001 -#define MG_INVIS 0x0002 -#define MG_DETECT 0x0004 -#define MG_PET 0x0008 -#define MG_RIDDEN 0x0010 -#define MG_STATUE 0x0020 -#define MG_OBJPILE 0x0040 /* more than one stack of objects */ -#define MG_BW_LAVA 0x0080 /* 'black & white lava': highlight lava if it - can't be distringuished from water by color */ -#define MG_BW_ICE 0x0100 /* similar for ice vs floor */ -#define MG_NOTHING 0x0200 /* char represents GLYPH_NOTHING */ -#define MG_UNEXPL 0x0400 /* char represents GLYPH_UNEXPLORED */ -#define MG_FEMALE 0x0800 /* represents a female mon,detected mon,pet,ridden */ -#define MG_BADXY 0x1000 /* bad coordinates were passed */ +/* Special mapped glyphflags encoded by reset_glyphmap() and/or map_glyphinfo() */ +#define MG_HERO 0x00001 /* represents the hero */ +#define MG_CORPSE 0x00002 /* represents a body */ +#define MG_INVIS 0x00004 /* represents invisible monster */ +#define MG_DETECT 0x00008 /* represents a detected monster */ +#define MG_PET 0x00010 /* represents a pet */ +#define MG_RIDDEN 0x00020 /* represents a ridden monster */ +#define MG_STATUE 0x00040 /* represents a statue */ +#define MG_OBJPILE 0x00080 /* more than one stack of objects */ +#define MG_BW_LAVA 0x00100 /* 'black & white lava': highlight lava if it + can't be distringuished from water by color */ +#define MG_BW_ICE 0x00200 /* similar for ice vs floor */ +#define MG_NOTHING 0x00400 /* char represents GLYPH_NOTHING */ +#define MG_UNEXPL 0x00800 /* char represents GLYPH_UNEXPLORED */ +#define MG_MALE 0x01000 /* represents a male mon variation or statue of one */ +#define MG_FEMALE 0x02000 /* represents a female mon variation or statue of one */ +#define MG_BADXY 0x04000 /* bad coordinates were passed */ + +#include "color.h" +#ifdef TEXTCOLOR + +/* 3.6.3: poison gas zap used to be yellow and acid zap was green, + which conflicted with the corresponding dragon colors */ +#endif /* TEXTCOLOR */ + +enum level_walls { main_walls, mines_walls, gehennom_walls, + knox_walls, sokoban_walls }; + +enum zap_colors { + zap_color_missile = HI_ZAP, + zap_color_fire = CLR_ORANGE, + zap_color_frost = CLR_WHITE, + zap_color_sleep = HI_ZAP, + zap_color_death = CLR_BLACK, + zap_color_lightning = CLR_WHITE, + zap_color_poison_gas = CLR_GREEN, + zap_color_acid = CLR_YELLOW +}; + +enum altar_colors { + altar_color_unaligned = CLR_RED, +#if 0 + /* On OSX with TERM=xterm-color256 these render as + * white -> tty: gray, curses: ok + * gray -> both tty and curses: black + * black -> both tty and curses: blue + * red -> both tty and curses: ok. + * Since the colors have specific associations (with the + * unicorns matched with each alignment), we shouldn't use + * scrambled colors and we don't have sufficient information + * to handle platform-specific color variations. + */ + altar_color_chaotic = CLR_BLACK, + altar_color_neutral = CLR_GRAY, + altar_color_lawful = CLR_WHITE, +#else + altar_color_chaotic = CLR_GRAY, + altar_color_neutral = CLR_GRAY, + altar_color_lawful = CLR_GRAY, +#endif + altar_color_shrine = CLR_BRIGHT_MAGENTA +}; + +/* types of explosions */ +enum explosion_types { + EXPL_DARK = 0, + EXPL_NOXIOUS = 1, + EXPL_MUDDY = 2, + EXPL_WET = 3, + EXPL_MAGICAL = 4, + EXPL_FIERY = 5, + EXPL_FROSTY = 6, + EXPL_MAX = 7 +}; + +/* above plus this redundant? */ +enum expl_types { + expl_dark, + expl_noxious, + expl_muddy, + expl_wet, + expl_magical, + expl_fiery, + expl_frosty, +}; + +enum explode_colors { + explode_color_dark = CLR_BLACK, + explode_color_noxious = CLR_GREEN, + explode_color_muddy = CLR_BROWN, + explode_color_wet = CLR_BLUE, + explode_color_magical = CLR_MAGENTA, + explode_color_fiery = CLR_ORANGE, + explode_color_frosty = CLR_WHITE +}; +enum altar_types { + altar_unaligned, + altar_chaotic, + altar_neutral, + altar_lawful, + shrine +}; + +enum { GM_FLAGS, GM_TTYCHAR, GM_COLOR, NUM_GLYPHMOD }; /* glyphmod entries */ +enum glyphmap_change_triggers { gm_nochange, gm_levelchange, gm_optionchange, + gm_symchange, gm_accessibility_change }; + +typedef struct { + xchar gnew; /* perhaps move this bit into the rm structure. */ + glyph_info glyphinfo; +} gbuf_entry; + +extern const int altarcolors[]; +extern const int zapcolors[]; +extern const int explodecolors[]; +extern int wallcolors[]; + +/* If USE_TILES is defined during build, this comes from the generated + * tile.c, complete with appropriate tile references in the initialization. + * Otherwise, it comes from display.c. + */ +extern const glyph_info nul_glyphinfo; #endif /* DISPLAY_H */ diff --git a/include/extern.h b/include/extern.h index 5e328c24b..8de2f898e 100644 --- a/include/extern.h +++ b/include/extern.h @@ -381,6 +381,7 @@ extern void set_wall_state(void); extern void unset_seenv(struct rm *, int, int, int, int); extern int warning_of(struct monst *); extern void map_glyphinfo(xchar, xchar, int, unsigned, glyph_info *); +extern void reset_glyphmap(enum glyphmap_change_triggers trigger); /* ### do.c ### */ diff --git a/include/global.h b/include/global.h index e732c74b8..2f38bdd1f 100644 --- a/include/global.h +++ b/include/global.h @@ -222,7 +222,7 @@ typedef uchar nhsym; || defined(WIN32) #ifndef NO_TILE_C #ifndef USE_TILES -#define USE_TILES /* glyph2tile[] will be available */ +#define USE_TILES /* glyphmap[] with prefilled tile mappings will be available */ #endif #endif #endif diff --git a/include/hack.h b/include/hack.h index 2e87e21e1..34eafe7a7 100644 --- a/include/hack.h +++ b/include/hack.h @@ -212,11 +212,9 @@ enum misc_arti_nums { #define SYM_OFF_X (SYM_OFF_W + WARNCOUNT) #define SYM_MAX (SYM_OFF_X + MAXOTHER) -/* glyphmod entries */ -enum { GM_FLAGS, GM_TTYCHAR, GM_COLOR, NUM_GLYPHMOD }; - #include "rect.h" #include "region.h" +#include "display.h" #include "decl.h" #include "timeout.h" @@ -268,7 +266,6 @@ typedef struct sortloot_item Loot; #include "trap.h" #include "flag.h" #include "vision.h" -#include "display.h" #include "engrave.h" #include "extern.h" diff --git a/include/sym.h b/include/sym.h index 6d8aa1f46..a029e4c54 100644 --- a/include/sym.h +++ b/include/sym.h @@ -27,7 +27,7 @@ enum mon_syms { #ifndef MAKEDEFS_C /* Default characters for dungeon surroundings and furniture */ -enum screen_symbols { +enum cmap_symbols { #define PCHAR_S_ENUM #include "defsym.h" #undef PCHAR_S_ENUM diff --git a/include/winX.h b/include/winX.h index c6c1dce73..3fae46052 100644 --- a/include/winX.h +++ b/include/winX.h @@ -61,6 +61,7 @@ struct text_map_info_t { struct tile_glyph_info_t { unsigned short glyph; + unsigned short tileidx; unsigned glyphflags; }; diff --git a/include/wintty.h b/include/wintty.h index 3c3d92a13..2c1e63046 100644 --- a/include/wintty.h +++ b/include/wintty.h @@ -125,7 +125,7 @@ E void tty_shutdown(void); E int xputc(int); E void xputs(const char *); #if defined(SCREEN_VGA) || defined(SCREEN_8514) -E void xputg(int, int, unsigned); +E void xputg(const glyph_info *); #endif E void cl_end(void); E void clear_screen(void); diff --git a/include/wintype.h b/include/wintype.h index 48c974e29..a9688f5e4 100644 --- a/include/wintype.h +++ b/include/wintype.h @@ -52,23 +52,6 @@ enum any_types { ANY_MASK32 /* 32-bit mask (stored as unsigned long) */ }; -/* glyph plus additional info - if you add fields or change the ordering, fix up the following: - g_info initialization in display.c - nul_glyphinfo initialization in decl.c - */ -typedef struct gi { - int glyph; /* the display entity */ - int color; /* color for window ports not using a tile */ - int ttychar; /* the character mapping for the original tty - interface. Most or all window ports wanted - and used this for various things so it is - provided in 3.7+ */ - short int symidx; /* offset into syms array */ - unsigned glyphflags; /* more detail about the nature of the entity */ -} glyph_info; -#define GLYPH_INFO_P struct gi - /* menu return list */ typedef struct mi { anything item; /* identifier */ @@ -77,6 +60,29 @@ typedef struct mi { } menu_item; #define MENU_ITEM_P struct mi +/* These would be in display.h if they weren't needed to define + the windowproc interface for X11 which doesn't seem to include + the main NetHack header files */ + +typedef struct glyph_map_entry { + int color; + int symidx; + unsigned glyphflags; + short int tileidx; +} glyph_map; + +/* glyph plus additional info + if you add fields or change the ordering, fix up the following: + g_info initialization in display.c + nul_glyphinfo initialization in diplay.c + */ +typedef struct gi { + int glyph; /* the display entity */ + int ttychar; + glyph_map gm; +} glyph_info; +#define GLYPH_INFO_P struct gi + /* select_menu() "how" argument types */ /* [MINV_PICKMASK in monst.h assumes these have values of 0, 1, 2] */ #define PICK_NONE 0 /* user picks nothing (display only) */ diff --git a/src/.gitignore b/src/.gitignore index bd8ac3b70..c34382fa9 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -13,3 +13,5 @@ nhdat o nhdat* date.nmk +tilemappings.lst + diff --git a/src/decl.c b/src/decl.c index a2ef2dca5..f9bc6fcfe 100644 --- a/src/decl.c +++ b/src/decl.c @@ -39,24 +39,6 @@ NEARDATA struct obj *uwep, *uarm, *uswapwep, struct engr *head_engr; -#ifdef TEXTCOLOR -/* - * This must be the same order as used for buzz() in zap.c. - */ -const int zapcolors[NUM_ZAP] = { - HI_ZAP, /* 0 - missile */ - CLR_ORANGE, /* 1 - fire */ - CLR_WHITE, /* 2 - frost */ - HI_ZAP, /* 3 - sleep */ - CLR_BLACK, /* 4 - death */ - CLR_WHITE, /* 5 - lightning */ - /* 3.6.3: poison gas zap used to be yellow and acid zap was green, - which conflicted with the corresponding dragon colors */ - CLR_GREEN, /* 6 - poison gas */ - CLR_YELLOW, /* 7 - acid */ -}; -#endif /* text color */ - const int shield_static[SHIELD_COUNT] = { S_ss1, S_ss2, S_ss3, S_ss2, S_ss1, S_ss2, S_ss4, /* 7 per row */ S_ss1, S_ss2, S_ss3, S_ss2, S_ss1, S_ss2, S_ss4, @@ -540,6 +522,7 @@ const struct instance_globals g_init = { FALSE, /* opt_initial */ FALSE, /* opt_from_file */ FALSE, /* opt_need_redraw */ + FALSE, /* opt_need_glyph_reset */ FALSE, /* save_menucolors */ (struct menucoloring *) 0, /* save_colorings */ (struct menucoloring *) 0, /* color_colorings */ @@ -713,10 +696,6 @@ const struct const_globals cg = { DUMMY, /* zeroany */ }; -/* glyph, color, ttychar, symidx, glyphflags */ -const glyph_info nul_glyphinfo = - { NO_GLYPH, NO_COLOR, ' ', 0, MG_UNEXPL }; - #define ZERO(x) memset(&x, 0, sizeof(x)) void diff --git a/src/display.c b/src/display.c index 5dae71118..411caaa0f 100644 --- a/src/display.c +++ b/src/display.c @@ -129,7 +129,7 @@ static int swallow_to_glyph(int, int); static void display_warning(struct monst *); static int check_pos(int, int, int); -static int get_bk_glyph(xchar, xchar); +static int get_bk_glyph(xchar x, xchar y); static int tether_glyph(int, int); #ifdef UNBUFFERED_GLYPHINFO static glyph_info *glyphinfo_at(xchar, xchar, int); @@ -450,7 +450,8 @@ display_monster(xchar x, xchar y, /* display position */ case M_AP_MONSTER: show_glyph(x, y, monnum_to_glyph(what_mon((int) mon->mappearance, - rn2_on_display_rng))); + rn2_on_display_rng), + mon->female ? FEMALE : MALE)); break; } } @@ -469,19 +470,22 @@ display_monster(xchar x, xchar y, /* display position */ */ if (mon->mtame && !Hallucination) { if (worm_tail) - num = petnum_to_glyph(PM_LONG_WORM_TAIL); + num = petnum_to_glyph(PM_LONG_WORM_TAIL, + mon->female ? FEMALE : MALE); else num = pet_to_glyph(mon, rn2_on_display_rng); } else if (sightflags == DETECTED) { if (worm_tail) num = detected_monnum_to_glyph( - what_mon(PM_LONG_WORM_TAIL, rn2_on_display_rng)); + what_mon(PM_LONG_WORM_TAIL, rn2_on_display_rng), + mon->female ? FEMALE : MALE); else num = detected_mon_to_glyph(mon, rn2_on_display_rng); } else { if (worm_tail) num = monnum_to_glyph( - what_mon(PM_LONG_WORM_TAIL, rn2_on_display_rng)); + what_mon(PM_LONG_WORM_TAIL, rn2_on_display_rng), + mon->female ? FEMALE : MALE); else num = mon_to_glyph(mon, rn2_on_display_rng); } @@ -1357,9 +1361,9 @@ see_traps(void) } } -/* glyph, color, ttychar, symidx, glyphflags */ +/* glyph, ttychar, {color, symidx, glyphflags, tileidx } */ static glyph_info no_ginfo = { - NO_GLYPH, NO_COLOR, ' ', 0, MG_BADXY + NO_GLYPH, ' ', { NO_COLOR, 0, MG_BADXY, 0 } }; #ifndef UNBUFFERED_GLYPHINFO #define Glyphinfo_at(x, y, glyph) \ @@ -1370,6 +1374,27 @@ static glyph_info ginfo; #define Glyphinfo_at(x, y, glyph) glyphinfo_at(x, y, glyph) #endif +#ifdef USE_TILES +extern const glyph_info nul_glyphinfo; /* tile.c */ +#else +/* glyph, ttychar, { color, symidx, glyphflags, tileidx} */ +const glyph_info nul_glyphinfo = { + NO_GLYPH, ' ', + { /* glyph_map */ + NO_COLOR, SYM_UNEXPLORED + SYM_OFF_X, + MG_UNEXPL, 0 + } +}; +#endif + +#ifdef USE_TILES +extern glyph_map glyphmap[MAX_GLYPH]; /* from tile.c */ +#else +glyph_map glyphmap[MAX_GLYPH] = { + {0, 0, 0U, 0 } +}; +#endif + /* * Put the cursor on the hero. Flush all accumulated glyphs before doing it. */ @@ -1539,8 +1564,8 @@ show_glyph(int x, int y, int glyph) * Check for bad positions and glyphs. */ if (!isok(x, y)) { - const char *text; - int offset; + const char *text = ""; + int offset = -1; /* column 0 is invalid, but it's often used as a flag, so ignore it */ if (x == 0) @@ -1551,43 +1576,85 @@ show_glyph(int x, int y, int glyph) * the definition. */ - if (glyph >= GLYPH_WARNING_OFF - && glyph < GLYPH_STATUE_OFF) { /* a warning */ - text = "warning"; - offset = glyph - GLYPH_WARNING_OFF; - } else if (glyph >= GLYPH_SWALLOW_OFF) { /* swallow border */ - text = "swallow border"; - offset = glyph - GLYPH_SWALLOW_OFF; - } else if (glyph >= GLYPH_ZAP_OFF) { /* zap beam */ - text = "zap beam"; - offset = glyph - GLYPH_ZAP_OFF; - } else if (glyph >= GLYPH_EXPLODE_OFF) { /* explosion */ - text = "explosion"; - offset = glyph - GLYPH_EXPLODE_OFF; - } else if (glyph >= GLYPH_CMAP_OFF) { /* cmap */ - text = "cmap_index"; - offset = glyph - GLYPH_CMAP_OFF; - } else if (glyph >= GLYPH_OBJ_OFF) { /* object */ + if ((offset = (glyph - GLYPH_NOTHING_OFF)) >= 0) { + text = "nothing"; + } else if ((offset = (glyph - GLYPH_UNEXPLORED_OFF)) >= 0) { + text = "unexplored"; + } else if ((offset = (glyph - GLYPH_STATUE_FEM_PILETOP_OFF))) { + text = "statue of a female monster at top of a pile"; + } else if ((offset = (glyph - GLYPH_STATUE_MALE_PILETOP_OFF))) { + text = "statue of a male monster at top of a pile"; + } else if ((offset = (glyph - GLYPH_BODY_PILETOP_OFF))) { + text = "body at top of a pile"; + } else if ((offset = (glyph - GLYPH_OBJ_PILETOP_OFF))) { + text = "object at top of a pile"; + } else if ((offset = (glyph - GLYPH_STATUE_FEM_OFF)) >= 0) { + text = "statue of female monster"; + } else if ((offset = (glyph - GLYPH_STATUE_MALE_OFF)) >= 0) { + text = "statue of male monster"; + } else if ((offset = (glyph - GLYPH_WARNING_OFF)) >= 0) { + /* warn flash */ + text = "warning explosion"; + } else if ((offset = (glyph - GLYPH_EXPLODE_FROSTY_OFF)) >= 0) { + text = "frosty explosion"; + } else if ((offset = (glyph - GLYPH_EXPLODE_FIERY_OFF)) >= 0) { + text = "fiery explosion"; + } else if ((offset = (glyph - GLYPH_EXPLODE_MAGICAL_OFF)) >= 0) { + text = "magical explosion"; + } else if ((offset = (glyph - GLYPH_EXPLODE_WET_OFF)) >= 0) { + text = "wet explosion"; + } else if ((offset = (glyph - GLYPH_EXPLODE_MUDDY_OFF)) >= 0) { + text = "muddy explosion"; + } else if ((offset = (glyph - GLYPH_EXPLODE_NOXIOUS_OFF)) >= 0) { + text = "noxious explosion"; + } else if ((offset = (glyph - GLYPH_EXPLODE_DARK_OFF)) >= 0) { + text = "dark explosion"; + } else if ((offset = (glyph - GLYPH_SWALLOW_OFF)) >= 0) { + text = "swallow"; + } else if ((offset = (glyph - GLYPH_CMAP_C_OFF)) >= 0) { + text = "cmap C"; + } else if ((offset = (glyph - GLYPH_ZAP_OFF)) >= 0) { + text = "zap"; + } else if ((offset = (glyph - GLYPH_CMAP_B_OFF)) >= 0) { + text = "cmap B"; + } else if ((offset = (glyph - GLYPH_ALTAR_OFF)) >= 0) { + text = "altar"; + } else if ((offset = (glyph - GLYPH_CMAP_A_OFF)) >= 0) { + text = "cmap A"; + } else if ((offset = (glyph - GLYPH_CMAP_SOKO_OFF)) >= 0) { + text = "sokoban dungeon walls"; + } else if ((offset = (glyph - GLYPH_CMAP_KNOX_OFF)) >= 0) { + text = "knox dungeon walls"; + } else if ((offset = (glyph - GLYPH_CMAP_GEH_OFF)) >= 0) { + text = "gehennom dungeon walls"; + } else if ((offset = (glyph - GLYPH_CMAP_MINES_OFF)) >= 0) { + text = "gnomish mines dungeon walls"; + } else if ((offset = (glyph - GLYPH_CMAP_MAIN_OFF)) >= 0) { + text = "main dungeon walls"; + } else if ((offset = (glyph - GLYPH_CMAP_STONE_OFF)) >= 0) { + text = "stone"; + } else if ((offset = (glyph - GLYPH_OBJ_OFF)) >= 0) { text = "object"; - offset = glyph - GLYPH_OBJ_OFF; - } else if (glyph >= GLYPH_RIDDEN_OFF) { /* ridden mon */ - text = "ridden mon"; - offset = glyph - GLYPH_RIDDEN_OFF; - } else if (glyph >= GLYPH_BODY_OFF) { /* a corpse */ - text = "corpse"; - offset = glyph - GLYPH_BODY_OFF; - } else if (glyph >= GLYPH_DETECT_OFF) { /* detected mon */ - text = "detected mon"; - offset = glyph - GLYPH_DETECT_OFF; - } else if (glyph >= GLYPH_INVIS_OFF) { /* invisible mon */ - text = "invisible mon"; - offset = glyph - GLYPH_INVIS_OFF; - } else if (glyph >= GLYPH_PET_OFF) { /* a pet */ - text = "pet"; - offset = glyph - GLYPH_PET_OFF; - } else { /* a monster */ - text = "monster"; - offset = glyph; + } else if ((offset = (glyph - GLYPH_RIDDEN_FEM_OFF)) >= 0) { + text = "ridden female monster"; + } else if ((offset = (glyph - GLYPH_RIDDEN_MALE_OFF)) >= 0) { + text = "ridden male monster"; + } else if ((offset = (glyph - GLYPH_BODY_OFF)) >= 0) { + text = "body"; + } else if ((offset = (glyph - GLYPH_DETECT_FEM_OFF)) >= 0) { + text = "detected female monster"; + } else if ((offset = (glyph - GLYPH_DETECT_MALE_OFF)) >= 0) { + text = "detected male monster"; + } else if ((offset = (glyph - GLYPH_INVIS_OFF)) >= 0) { + text = "invisible monster"; + } else if ((offset = (glyph - GLYPH_PET_FEM_OFF)) >= 0) { + text = "female pet"; + } else if ((offset = (glyph - GLYPH_PET_MALE_OFF)) >= 0) { + text = "male pet"; + } else if ((offset = (glyph - GLYPH_MON_FEM_OFF)) >= 0) { + text = "female monster"; + } else if ((offset = (glyph - GLYPH_MON_MALE_OFF)) >= 0) { + text = "male monster"; } impossible("show_glyph: bad pos %d %d with glyph %d [%s %d].", x, y, glyph, text, offset); @@ -1606,7 +1673,7 @@ show_glyph(int x, int y, int glyph) map_glyphinfo(x, y, glyph, 0, &glyphinfo); #endif - if (g.gbuf[y][x].glyph != glyph + if (g.gbuf[y][x].glyphinfo.glyph != glyph #ifndef UNBUFFERED_GLYPHINFO /* flags might change (single object vs pile, monster tamed or pet gone feral), color might change (altar's alignment converted by @@ -1614,18 +1681,18 @@ show_glyph(int x, int y, int glyph) glyph does too (changing boulder symbol would be an exception, but that triggers full redraw so doesn't matter here); still, be thorough and check everything */ - || g.gbuf[y][x].glyphinfo.glyphflags != glyphinfo.glyphflags || g.gbuf[y][x].glyphinfo.ttychar != glyphinfo.ttychar - || g.gbuf[y][x].glyphinfo.color != glyphinfo.color + || g.gbuf[y][x].glyphinfo.gm.glyphflags != glyphinfo.gm.glyphflags + || g.gbuf[y][x].glyphinfo.gm.color != glyphinfo.gm.color + || g.gbuf[y][x].glyphinfo.gm.tileidx != glyphinfo.gm.tileidx #endif || iflags.use_background_glyph) { - g.gbuf[y][x].glyph = glyph; + g.gbuf[y][x].glyphinfo.glyph = glyph; g.gbuf[y][x].gnew = 1; #ifndef UNBUFFERED_GLYPHINFO g.gbuf[y][x].glyphinfo.glyph = glyphinfo.glyph; - g.gbuf[y][x].glyphinfo.glyphflags = glyphinfo.glyphflags; g.gbuf[y][x].glyphinfo.ttychar = glyphinfo.ttychar; - g.gbuf[y][x].glyphinfo.color = glyphinfo.color; + g.gbuf[y][x].glyphinfo.gm = glyphinfo.gm; #endif if (g.gbuf_start[y] > x) g.gbuf_start[y] = x; @@ -1649,11 +1716,10 @@ show_glyph(int x, int y, int glyph) } static gbuf_entry nul_gbuf = { - 0, /* gnew */ - GLYPH_UNEXPLORED, /* glyph */ -#ifndef UNBUFFERED_GLYPHINFO - {(unsigned) ' ', (unsigned) NO_COLOR, MG_UNEXPL}, -#endif + 0, /* gnew */ + { GLYPH_UNEXPLORED, (unsigned) ' ', /* glyphinfo.glyph */ + { (unsigned) NO_COLOR, 0, MG_UNEXPL, 0 } /* glyphinfo.gm */ + } }; /* @@ -1674,12 +1740,13 @@ clear_glyph_buffer(void) #endif #ifndef UNBUFFERED_GLYPHINFO nul_gbuf.gnew = (giptr->ttychar != nul_gbuf.glyphinfo.ttychar - || giptr->color != nul_gbuf.glyphinfo.color - || giptr->glyphflags != nul_gbuf.glyphinfo.glyphflags) + || giptr->gm.color != nul_gbuf.glyphinfo.gm.color + || giptr->gm.glyphflags != nul_gbuf.glyphinfo.gm.glyphflags + || giptr->gm.tileidx != nul_gbuf.glyphinfo.gm.tileidx) #else - nul_gbuf.gnew = (giptr->ttychar != ' ' - || giptr->color != NO_COLOR - || (giptr->glyphflags & ~MG_UNEXPL) != 0) + nul_gbuf.gnew = (giptr->glyphinfo.ttychar != ' ' + || giptr->gm.color != NO_COLOR + || (giptr->gm.glyphflags & ~MG_UNEXPL) != 0) #endif ? 1 : 0; for (y = 0; y < ROWNO; y++) { @@ -1711,17 +1778,18 @@ row_refresh(int start, int stop, int y) #endif #ifndef UNBUFFERED_GLYPHINFO force = (giptr->ttychar != nul_gbuf.glyphinfo.ttychar - || giptr->color != nul_gbuf.glyphinfo.color - || giptr->glyphflags != nul_gbuf.glyphinfo.glyphflags) + || giptr->gm.color != nul_gbuf.glyphinfo.gm.color + || giptr->gm.glyphflags != nul_gbuf.glyphinfo.gm.glyphflags + || giptr->gm.tileidx != nul_gbuf.glyphinfo.gm.tileidx) #else force = (giptr->ttychar != ' ' - || giptr->color != NO_COLOR - || (giptr->glyphflags & ~MG_UNEXPL) != 0) + || giptr->gm.color != NO_COLOR + || (giptr->gm.glyphflags & ~MG_UNEXPL) != 0) #endif ? 1 : 0; for (x = start; x <= stop; x++) { gptr = &g.gbuf[y][x]; - glyph = gptr->glyph; + glyph = gptr->glyphinfo.glyph; if (force || glyph != GLYPH_UNEXPLORED) { bkglyphinfo.glyph = get_bk_glyph(x, y); print_glyph(WIN_MAP, x, y, @@ -1781,7 +1849,7 @@ flush_screen(int cursor_on_u) for (; x <= g.gbuf_stop[y]; gptr++, x++) if (gptr->gnew) { - bkglyphinfo.glyph = get_bk_glyph(x, y); + map_glyphinfo(x, y, get_bk_glyph(x, y), 0, &bkglyphinfo); print_glyph(WIN_MAP, x, y, Glyphinfo_at(x, y, gptr->glyph), &bkglyphinfo); gptr->gnew = 0; @@ -2001,7 +2069,7 @@ glyph_at(xchar x, xchar y) { if (x < 0 || y < 0 || x >= COLNO || y >= ROWNO) return cmap_to_glyph(S_room); /* XXX */ - return g.gbuf[y][x].glyph; + return g.gbuf[y][x].glyphinfo.glyph; } #ifdef UNBUFFERED_GLYPHINFO @@ -2033,7 +2101,7 @@ get_bk_glyph(xchar x, xchar y) struct rm *lev = &levl[x][y]; if (iflags.use_background_glyph && lev->seenv != 0 - && (g.gbuf[y][x].glyph != GLYPH_UNEXPLORED)) { + && (g.gbuf[y][x].glyphinfo.glyph != GLYPH_UNEXPLORED)) { switch (lev->typ) { case SCORR: case STONE: @@ -2084,18 +2152,93 @@ get_bk_glyph(xchar x, xchar y) return bkglyph; } +#if defined(USE_TILES) && defined(MSDOS) +#define HAS_ROGUE_IBM_GRAPHICS \ + (g.currentgraphics == ROGUESET && SYMHANDLING(H_IBM) && !iflags.grmode) +#else +#define HAS_ROGUE_IBM_GRAPHICS \ + (g.currentgraphics == ROGUESET && SYMHANDLING(H_IBM)) +#endif #define HI_DOMESTIC CLR_WHITE /* monst.c */ + +/* masks for per-level variances kept in g.glyphmap_perlevel_flags */ +#define GMAP_SET 0x0001 +#define GMAP_ROGUELEVEL 0x0002 +#define GMAP_ALTARCOLOR 0x0004 + +void +map_glyphinfo(xchar x, xchar y, int glyph, unsigned mgflags, + glyph_info *glyphinfo) +{ + int offset; + boolean is_you = (x == u.ux && y == u.uy); + const glyph_map *gmap = &glyphmap[glyph]; + + glyphinfo->gm = *gmap; /* glyphflags, symidx, color, tileidx */ + /* Only hero tinkering permitted on-the-fly (who). + Unique glyphs in glyphmap[] determine everything else (what). */ + if (is_you) { #ifdef TEXTCOLOR -static const int explcolors[] = { - CLR_BLACK, /* dark */ - CLR_GREEN, /* noxious */ - CLR_BROWN, /* muddy */ - CLR_BLUE, /* wet */ - CLR_MAGENTA, /* magical */ - CLR_ORANGE, /* fiery */ - CLR_WHITE, /* frosty */ + if (iflags.use_color && HAS_ROGUE_IBM_GRAPHICS + && g.symset[g.currentgraphics].nocolor == 0) { + /* actually player should be yellow-on-gray if in corridor */ + glyphinfo->gm.color = CLR_YELLOW; + } else if (iflags.use_color && flags.showrace && !Upolyd) { + /* special case the hero for `showrace' option */ + glyphinfo->gm.color = HI_DOMESTIC; + } +#endif + /* accessibility + This unchanging display character for hero was requested by + a blind player to enhance screen reader use */ + if (sysopt.accessibility == 1 && !(mgflags & MG_FLAG_NOOVERRIDE)) { + offset = SYM_HERO_OVERRIDE + SYM_OFF_X; + if ((g.glyphmap_perlevel_flags & GMAP_ROGUELEVEL) + ? g.ov_rogue_syms[offset] + : g.ov_primary_syms[offset]) + glyphinfo->gm.symidx = offset; + } + glyphinfo->gm.glyphflags |= MG_HERO; + } + if (sysopt.accessibility == 1 + && (mgflags & MG_FLAG_NOOVERRIDE) && glyph_is_pet(glyph)) { + /* one more accessiblity kludge */ + glyphinfo->gm.symidx = mons[glyph_to_mon(glyph)].mlet + SYM_OFF_M; + } + glyphinfo->ttychar = g.showsyms[glyphinfo->gm.symidx]; + glyphinfo->glyph = glyph; +} + +#ifdef TEXTCOLOR +/* + * This must be the same order as used for buzz() in zap.c. + * The zap_color_ and altar_color_ enums are in decl.h. + */ +const int zapcolors[NUM_ZAP] = { + zap_color_missile, zap_color_fire, zap_color_frost, + zap_color_sleep, zap_color_death, zap_color_lightning, + zap_color_poison_gas, zap_color_acid, +}; +const int altarcolors[5] = { + altar_color_unaligned, altar_color_chaotic, altar_color_neutral, + altar_color_lawful, altar_color_shrine, +}; +const int explodecolors[7] = { + explode_color_dark, explode_color_noxious, explode_color_muddy, + explode_color_wet, explode_color_magical, explode_color_fiery, + explode_color_frosty, }; +/* main_walls, mines_walls, gehennom_walls, knox_walls, sokoban_walls */ +int wallcolors[sokoban_walls + 1] = { + /* default init value is to match defsym[S_vwall + n].color (CLR_GRAY) */ + CLR_GRAY, CLR_GRAY, CLR_GRAY, CLR_GRAY, CLR_GRAY, + /* CLR_GRAY, CLR_BROWN, CLR_RED, CLR_GRAY, CLR_BRIGHT_BLUE, */ +}; + +#endif /* text color */ + +#ifdef TEXTCOLOR #define zap_color(n) color = iflags.use_color ? zapcolors[n] : NO_COLOR #define cmap_color(n) color = iflags.use_color ? defsyms[n].color : NO_COLOR #define obj_color(n) color = iflags.use_color ? objects[n].oc_color : NO_COLOR @@ -2104,7 +2247,9 @@ static const int explcolors[] = { #define pet_color(n) color = iflags.use_color ? mons[n].mcolor : NO_COLOR #define warn_color(n) \ color = iflags.use_color ? def_warnsyms[n].color : NO_COLOR -#define explode_color(n) color = iflags.use_color ? explcolors[n] : NO_COLOR +#define explode_color(n) \ + color = iflags.use_color ? explodecolors[n] : NO_COLOR +#define wall_color(n) color = iflags.use_color ? wallcolors[n] : NO_COLOR #else /* no text color */ @@ -2116,44 +2261,46 @@ static const int explcolors[] = { #define pet_color(c) #define warn_color(n) #define explode_color(n) +#define wall_color(n) #endif -#if defined(USE_TILES) && defined(MSDOS) -#define HAS_ROGUE_IBM_GRAPHICS \ - (g.currentgraphics == ROGUESET && SYMHANDLING(H_IBM) && !iflags.grmode) -#else -#define HAS_ROGUE_IBM_GRAPHICS \ - (g.currentgraphics == ROGUESET && SYMHANDLING(H_IBM)) +#if 0 +#define is_objpile(x, y) \ + (!Hallucination && g.level.objects[(x)][(y)] \ + && g.level.objects[(x)][(y)]->nexthere) #endif -#define is_objpile(x,y) (!Hallucination && g.level.objects[(x)][(y)] \ - && g.level.objects[(x)][(y)]->nexthere) +/* + reset_glyphmap(trigger) -#define GMAP_SET 0x00000001 -#define GMAP_ROGUELEVEL 0x00000002 -#define GMAP_ALTARCOLOR 0x00000004 + The glyphmap likely needs to be re-calculated for the following triggers: + + gm_levelchange called when the player has gone to a new level. + + gm_symchange called if someone has interactively altered the symbols for + the game, most likely at the options menu. + + gm_optionchange The game settings have been toggled and some of them + are configured to trigger a reset_glyphmap() + + gm_accessibility_change One of the accessibility flags has changed. + +*/ void -map_glyphinfo(xchar x, xchar y, int glyph, - unsigned mgflags, glyph_info *glyphinfo) +reset_glyphmap(enum glyphmap_change_triggers trigger) { - register int offset, idx; + int glyph; + register int offset; int color = NO_COLOR; - unsigned special = 0; - struct obj *obj; /* only used for STATUE */ /* condense multiple tests in macro version down to single */ boolean has_rogue_ibm_graphics = HAS_ROGUE_IBM_GRAPHICS, - is_you = (x == u.ux && y == u.uy), - has_rogue_color = (has_rogue_ibm_graphics - && g.symset[g.currentgraphics].nocolor == 0), - do_mon_checks = FALSE; - - if (x < 0 || y < 0 || x >= COLNO || y >= ROWNO) { - *glyphinfo = nul_glyphinfo; - glyphinfo->glyphflags |= MG_BADXY; - return; - } + has_rogue_color = + (has_rogue_ibm_graphics + && g.symset[g.currentgraphics].nocolor == 0); + if (trigger == gm_levelchange) + g.glyphmap_perlevel_flags = 0; if (!g.glyphmap_perlevel_flags) { /* @@ -2170,272 +2317,314 @@ map_glyphinfo(xchar x, xchar y, int glyph, } } - /* - * Map the glyph to a character and color. - * - * Warning: For speed, this makes an assumption on the order of - * offsets. The order is set in display.h. - */ - if ((offset = (glyph - GLYPH_NOTHING_OFF)) >= 0) { - idx = SYM_NOTHING + SYM_OFF_X; - color = NO_COLOR; - special |= MG_NOTHING; - } else if ((offset = (glyph - GLYPH_UNEXPLORED_OFF)) >= 0) { - idx = SYM_UNEXPLORED + SYM_OFF_X; - color = NO_COLOR; - special |= MG_UNEXPL; - } else if ((offset = (glyph - GLYPH_STATUE_OFF)) >= 0) { /* a statue */ - idx = mons[offset].mlet + SYM_OFF_M; - if (has_rogue_color) - color = CLR_RED; - else - obj_color(STATUE); - special |= MG_STATUE; - if (is_objpile(x,y)) - special |= MG_OBJPILE; - if ((obj = sobj_at(STATUE, x, y)) != 0 - && (obj->spe & CORPSTAT_GENDER) == CORPSTAT_FEMALE) - special |= MG_FEMALE; - } else if ((offset = (glyph - GLYPH_WARNING_OFF)) >= 0) { /* warn flash */ - idx = offset + SYM_OFF_W; - if (has_rogue_color) - color = NO_COLOR; - else - warn_color(offset); - } else if ((offset = (glyph - GLYPH_SWALLOW_OFF)) >= 0) { /* swallow */ - /* see swallow_to_glyph() in display.c */ - idx = (S_sw_tl + (offset & 0x7)) + SYM_OFF_P; - if (has_rogue_color && iflags.use_color) - color = NO_COLOR; - else - mon_color(offset >> 3); - } else if ((offset = (glyph - GLYPH_ZAP_OFF)) >= 0) { /* zap beam */ - /* see zapdir_to_glyph() in display.c */ - idx = (S_vbeam + (offset & 0x3)) + SYM_OFF_P; - if (has_rogue_color && iflags.use_color) - color = NO_COLOR; - else - zap_color((offset >> 2)); - } else if ((offset = (glyph - GLYPH_EXPLODE_OFF)) >= 0) { /* explosion */ - idx = ((offset % MAXEXPCHARS) + S_expl_tl) + SYM_OFF_P; - explode_color(offset / MAXEXPCHARS); - } else if ((offset = (glyph - GLYPH_CMAP_OFF)) >= 0) { /* cmap */ - idx = offset + SYM_OFF_P; - if (has_rogue_color && iflags.use_color) { - if (offset >= S_vwall && offset <= S_hcdoor) - color = CLR_BROWN; - else if (offset >= S_arrow_trap && offset <= S_polymorph_trap) - color = CLR_MAGENTA; - else if (offset == S_corr || offset == S_litcorr) - color = CLR_GRAY; - else if (offset >= S_room && offset <= S_water - && offset != S_darkroom) - color = CLR_GREEN; - else - color = NO_COLOR; -#ifdef TEXTCOLOR - /* provide a visible difference if normal and lit corridor - use the same symbol */ - } else if (iflags.use_color && offset == S_litcorr - && g.showsyms[idx] == g.showsyms[S_corr + SYM_OFF_P]) { - color = CLR_WHITE; -#endif - /* try to provide a visible difference between water and lava - if they use the same symbol and color is disabled */ - } else if (!iflags.use_color && offset == S_lava - && (g.showsyms[idx] == g.showsyms[S_pool + SYM_OFF_P] - || g.showsyms[idx] - == g.showsyms[S_water + SYM_OFF_P])) { - special |= MG_BW_LAVA; - /* similar for floor [what about empty doorway?] and ice */ - } else if (!iflags.use_color && offset == S_ice - && (g.showsyms[idx] == g.showsyms[S_room + SYM_OFF_P] - || g.showsyms[idx] - == g.showsyms[S_darkroom + SYM_OFF_P])) { - special |= MG_BW_ICE; - } else if (offset == S_altar && iflags.use_color) { - int amsk = altarmask_at(x, y); /* might be a mimic */ + for (glyph = 0; glyph < MAX_GLYPH; ++glyph) { + glyph_map *gmap = &glyphmap[glyph]; + gmap->glyphflags = 0U; - if ((g.glyphmap_perlevel_flags & GMAP_ALTARCOLOR) - && (amsk & AM_SHRINE) != 0) { - /* high altar */ - color = CLR_BRIGHT_MAGENTA; - } else { - switch (amsk & AM_MASK) { -#if 0 /* - * On OSX with TERM=xterm-color256 these render as - * white -> tty: gray, curses: ok - * gray -> both tty and curses: black - * black -> both tty and curses: blue - * red -> both tty and curses: ok. - * Since the colors have specific associations (with the - * unicorns matched with each alignment), we shouldn't use - * scrambled colors and we don't have sufficient information - * to handle platform-specific color variations. + /* + * Map the glyph to a character and color. + * + * Warning: For speed, this makes an assumption on the order of + * offsets. The order is set in display.h. */ - case AM_LAWFUL: /* 4 */ - color = CLR_WHITE; + if ((offset = (glyph - GLYPH_NOTHING_OFF)) >= 0) { + gmap->symidx = SYM_NOTHING + SYM_OFF_X; + color = NO_COLOR; + gmap->glyphflags |= MG_NOTHING; + } else if ((offset = (glyph - GLYPH_UNEXPLORED_OFF)) >= 0) { + gmap->symidx = SYM_UNEXPLORED + SYM_OFF_X; + color = NO_COLOR; + gmap->glyphflags |= MG_UNEXPL; + } else if ((offset = (glyph - GLYPH_STATUE_FEM_PILETOP_OFF)) >= 0) { + gmap->symidx = mons[offset].mlet + SYM_OFF_M; + if (has_rogue_color) + color = CLR_RED; + else + obj_color(STATUE); + gmap->glyphflags |= (MG_STATUE | MG_FEMALE | MG_OBJPILE); + } else if ((offset = (glyph - GLYPH_STATUE_MALE_PILETOP_OFF)) >= 0) { + gmap->symidx = mons[offset].mlet + SYM_OFF_M; + if (has_rogue_color) + color = CLR_RED; + else + obj_color(STATUE); + gmap->glyphflags |= (MG_STATUE | MG_MALE | MG_OBJPILE); + } else if ((offset = (glyph - GLYPH_BODY_PILETOP_OFF)) >= 0) { + gmap->symidx = objects[CORPSE].oc_class + SYM_OFF_O; + if (has_rogue_color && iflags.use_color) + color = CLR_RED; + else + mon_color(offset); + gmap->glyphflags |= (MG_CORPSE | MG_OBJPILE); + } else if ((offset = (glyph - GLYPH_OBJ_PILETOP_OFF)) >= 0) { + gmap->symidx = objects[offset].oc_class + SYM_OFF_O; + if (offset == BOULDER) + gmap->symidx = SYM_BOULDER + SYM_OFF_X; + if (has_rogue_color && iflags.use_color) { + switch (objects[offset].oc_class) { + case COIN_CLASS: + color = CLR_YELLOW; break; - case AM_NEUTRAL: /* 2 */ - color = CLR_GRAY; - break; - case AM_CHAOTIC: /* 1 */ - color = CLR_BLACK; - break; -#else /* !0: TEMP? */ - case AM_LAWFUL: /* 4 */ - case AM_NEUTRAL: /* 2 */ - case AM_CHAOTIC: /* 1 */ - cmap_color(S_altar); /* gray */ - break; -#endif /* 0 */ - case AM_NONE: /* 0 */ + case FOOD_CLASS: color = CLR_RED; break; - default: /* 3, 5..7 -- shouldn't happen but 3 was possible - * prior to 3.6.3 (due to faulty sink polymorph) */ - color = NO_COLOR; + default: + color = CLR_BRIGHT_BLUE; break; } - } - } else { - cmap_color(offset); - } - } else if ((offset = (glyph - GLYPH_OBJ_OFF)) >= 0) { /* object */ - idx = objects[offset].oc_class + SYM_OFF_O; - if (offset == BOULDER) - idx = SYM_BOULDER + SYM_OFF_X; - if (has_rogue_color && iflags.use_color) { - switch (objects[offset].oc_class) { - case COIN_CLASS: - color = CLR_YELLOW; - break; - case FOOD_CLASS: + } else + obj_color(offset); + gmap->glyphflags |= MG_OBJPILE; + } else if ((offset = (glyph - GLYPH_STATUE_FEM_OFF)) >= 0) { + gmap->symidx = mons[offset].mlet + SYM_OFF_M; + if (has_rogue_color) color = CLR_RED; - break; - default: - color = CLR_BRIGHT_BLUE; - break; - } - } else - obj_color(offset); - if (offset != BOULDER && is_objpile(x,y)) - special |= MG_OBJPILE; - } else if ((offset = (glyph - GLYPH_RIDDEN_OFF)) >= 0) { /* mon ridden */ - idx = mons[offset].mlet + SYM_OFF_M; - if (has_rogue_color) - /* This currently implies that the hero is here -- monsters */ - /* don't ride (yet...). Should we set it to yellow like in */ - /* the monster case below? There is no equivalent in rogue. */ - color = NO_COLOR; /* no need to check iflags.use_color */ - else - mon_color(offset); - special |= MG_RIDDEN; - do_mon_checks = TRUE; - } else if ((offset = (glyph - GLYPH_BODY_OFF)) >= 0) { /* a corpse */ - idx = objects[CORPSE].oc_class + SYM_OFF_O; - if (has_rogue_color && iflags.use_color) - color = CLR_RED; - else - mon_color(offset); - special |= MG_CORPSE; - if (is_objpile(x,y)) - special |= MG_OBJPILE; - } else if ((offset = (glyph - GLYPH_DETECT_OFF)) >= 0) { /* mon detect */ - idx = mons[offset].mlet + SYM_OFF_M; - if (has_rogue_color) - color = NO_COLOR; /* no need to check iflags.use_color */ - else - mon_color(offset); - /* Disabled for now; anyone want to get reverse video to work? */ - /* is_reverse = TRUE; */ - special |= MG_DETECT; - do_mon_checks = TRUE; - } else if ((offset = (glyph - GLYPH_INVIS_OFF)) >= 0) { /* invisible */ - idx = SYM_INVISIBLE + SYM_OFF_X; - if (has_rogue_color) - color = NO_COLOR; /* no need to check iflags.use_color */ - else - invis_color(offset); - special |= MG_INVIS; - } else if ((offset = (glyph - GLYPH_PET_OFF)) >= 0) { /* a pet */ - idx = mons[offset].mlet + SYM_OFF_M; - if (has_rogue_color) - color = NO_COLOR; /* no need to check iflags.use_color */ - else - pet_color(offset); - special |= MG_PET; - do_mon_checks = TRUE; - } else { /* a monster */ - idx = mons[glyph].mlet + SYM_OFF_M; - if (has_rogue_color && iflags.use_color) { - if (is_you) - /* actually player should be yellow-on-gray if in corridor */ - color = CLR_YELLOW; else + obj_color(STATUE); + gmap->glyphflags |= (MG_STATUE | MG_FEMALE); + } else if ((offset = (glyph - GLYPH_STATUE_MALE_OFF)) >= 0) { + gmap->symidx = mons[offset].mlet + SYM_OFF_M; + if (has_rogue_color) + color = CLR_RED; + else + obj_color(STATUE); + gmap->glyphflags |= (MG_STATUE | MG_MALE); + } else if ((offset = (glyph - GLYPH_WARNING_OFF)) + >= 0) { /* warn flash */ + gmap->symidx = offset + SYM_OFF_W; + if (has_rogue_color) color = NO_COLOR; - } else { - mon_color(glyph); + else + warn_color(offset); + } else if ((offset = (glyph - GLYPH_EXPLODE_FROSTY_OFF)) >= 0) { + gmap->symidx = S_expl_tl + offset + SYM_OFF_P; + explode_color(expl_frosty); + } else if ((offset = (glyph - GLYPH_EXPLODE_FIERY_OFF)) >= 0) { + gmap->symidx = S_expl_tl + offset + SYM_OFF_P; + explode_color(expl_fiery); + } else if ((offset = (glyph - GLYPH_EXPLODE_MAGICAL_OFF)) >= 0) { + gmap->symidx = S_expl_tl + offset + SYM_OFF_P; + explode_color(expl_magical); + } else if ((offset = (glyph - GLYPH_EXPLODE_WET_OFF)) >= 0) { + gmap->symidx = S_expl_tl + offset + SYM_OFF_P; + explode_color(expl_wet); + } else if ((offset = (glyph - GLYPH_EXPLODE_MUDDY_OFF)) >= 0) { + gmap->symidx = S_expl_tl + offset + SYM_OFF_P; + explode_color(expl_muddy); + } else if ((offset = (glyph - GLYPH_EXPLODE_NOXIOUS_OFF)) >= 0) { + gmap->symidx = S_expl_tl + offset + SYM_OFF_P; + explode_color(expl_noxious); + } else if ((offset = (glyph - GLYPH_EXPLODE_DARK_OFF)) >= 0) { + gmap->symidx = S_expl_tl + offset + SYM_OFF_P; + explode_color(expl_dark); + } else if ((offset = (glyph - GLYPH_SWALLOW_OFF)) >= 0) { + /* see swallow_to_glyph() in display.c */ + gmap->symidx = (S_sw_tl + (offset & 0x7)) + SYM_OFF_P; + if (has_rogue_color && iflags.use_color) + color = NO_COLOR; + else + mon_color(offset >> 3); + } else if ((offset = (glyph - GLYPH_CMAP_C_OFF)) >= 0) { + gmap->symidx = S_digbeam + offset + SYM_OFF_P; + cmap_color(S_digbeam + offset); + } else if ((offset = (glyph - GLYPH_ZAP_OFF)) >= 0) { + /* see zapdir_to_glyph() in display.c */ + gmap->symidx = (S_vbeam + (offset & 0x3)) + SYM_OFF_P; + zap_color((offset >> 2)); + } else if ((offset = (glyph - GLYPH_CMAP_B_OFF)) >= 0) { + gmap->symidx = S_grave + offset + SYM_OFF_P; + cmap_color(S_grave + offset); + } else if ((offset = (glyph - GLYPH_ALTAR_OFF)) >= 0) { + /* unaligned, chaotic, neutral, lawful, shrine */ + gmap->symidx = S_altar + SYM_OFF_P; + if (g.glyphmap_perlevel_flags & GMAP_ALTARCOLOR) + color = altarcolors[offset]; + else + cmap_color(S_altar); /* gray */ + } else if ((offset = (glyph - GLYPH_CMAP_A_OFF)) >= 0) { + int cmap = S_ndoor + offset; + gmap->symidx = cmap + SYM_OFF_P; + cmap_color(cmap); + /* + * Some speciality color mappings not hardcoded in data init + */ + if (iflags.use_color) { + if (has_rogue_color) { + if (cmap >= S_vwall && cmap <= S_hcdoor) + color = CLR_BROWN; + else if (cmap >= S_arrow_trap && cmap <= S_polymorph_trap) + color = CLR_MAGENTA; + else if (cmap == S_corr || cmap == S_litcorr) + color = CLR_GRAY; + else if (cmap >= S_room && cmap <= S_water + && cmap != S_darkroom) + color = CLR_GREEN; + else + color = NO_COLOR; #ifdef TEXTCOLOR - /* special case the hero for `showrace' option */ - if (iflags.use_color && is_you && flags.showrace && !Upolyd) - color = HI_DOMESTIC; + /* provide a visible difference if normal and lit corridor + use the same symbol */ + } else if ((cmap == S_litcorr) + && g.showsyms[gmap->symidx] + == g.showsyms[S_corr + SYM_OFF_P]) { + color = CLR_WHITE; #endif - } - do_mon_checks = TRUE; - } - - if (do_mon_checks) { - struct monst *m; - - if (is_you) { - if (Ugender == FEMALE) - special |= MG_FEMALE; - } else { - /* when hero is riding, steed will be shown at hero's location - but has not been placed on the map so m_at() won't find it */ - m = (x == u.ux && y == u.uy && u.usteed) ? u.usteed : m_at(x, y); - if (m) { - if (!Hallucination) { - if (m->female) - special |= MG_FEMALE; - } else if (rn2_on_display_rng(2)) { - special |= MG_FEMALE; + } + } else { /* !iflags.use_color */ + /* try to provide a visible difference between water and lava + if they use the same symbol and color is disabled */ + if (cmap == S_lava + && (g.showsyms[gmap->symidx] + == g.showsyms[S_pool + SYM_OFF_P] + || g.showsyms[gmap->symidx] + == g.showsyms[S_water + SYM_OFF_P])) { + gmap->glyphflags |= MG_BW_LAVA; + /* similar for floor [what about empty doorway?] and ice */ + } else if (offset == S_ice + && (g.showsyms[gmap->symidx] + == g.showsyms[S_room + SYM_OFF_P] + || g.showsyms[gmap->symidx] + == g.showsyms[S_darkroom + + SYM_OFF_P])) { + gmap->glyphflags |= MG_BW_ICE; } } + } else if ((offset = (glyph - GLYPH_CMAP_SOKO_OFF)) >= 0) { + gmap->symidx = S_vwall + offset + SYM_OFF_P; + wall_color(sokoban_walls); + } else if ((offset = (glyph - GLYPH_CMAP_KNOX_OFF)) >= 0) { + gmap->symidx = S_vwall + offset + SYM_OFF_P; + wall_color(knox_walls); + } else if ((offset = (glyph - GLYPH_CMAP_GEH_OFF)) >= 0) { + gmap->symidx = S_vwall + offset + SYM_OFF_P; + wall_color(gehennom_walls); + } else if ((offset = (glyph - GLYPH_CMAP_MINES_OFF)) >= 0) { + gmap->symidx = S_vwall + offset + SYM_OFF_P; + wall_color(mines_walls); + } else if ((offset = (glyph - GLYPH_CMAP_MAIN_OFF)) >= 0) { + gmap->symidx = S_vwall + offset + SYM_OFF_P; + wall_color(main_walls); + } else if ((offset = (glyph - GLYPH_CMAP_STONE_OFF)) >= 0) { + gmap->symidx = SYM_OFF_P; + cmap_color(S_stone); + } else if ((offset = (glyph - GLYPH_OBJ_OFF)) >= 0) { + gmap->symidx = objects[offset].oc_class + SYM_OFF_O; + if (offset == BOULDER) + gmap->symidx = SYM_BOULDER + SYM_OFF_X; + if (has_rogue_color && iflags.use_color) { + switch (objects[offset].oc_class) { + case COIN_CLASS: + color = CLR_YELLOW; + break; + case FOOD_CLASS: + color = CLR_RED; + break; + default: + color = CLR_BRIGHT_BLUE; + break; + } + } else + obj_color(offset); + } else if ((offset = (glyph - GLYPH_RIDDEN_FEM_OFF)) >= 0) { + gmap->symidx = mons[offset].mlet + SYM_OFF_M; + if (has_rogue_color) + /* This currently implies that the hero is here -- monsters */ + /* don't ride (yet...). Should we set it to yellow like in */ + /* the monster case below? There is no equivalent in rogue. + */ + color = NO_COLOR; /* no need to check iflags.use_color */ + else + mon_color(offset); + gmap->glyphflags |= (MG_RIDDEN | MG_FEMALE); + } else if ((offset = (glyph - GLYPH_RIDDEN_MALE_OFF)) >= 0) { + gmap->symidx = mons[offset].mlet + SYM_OFF_M; + if (has_rogue_color) + color = NO_COLOR; /* no need to check iflags.use_color */ + else + mon_color(offset); + gmap->glyphflags |= (MG_RIDDEN | MG_MALE); + } else if ((offset = (glyph - GLYPH_BODY_OFF)) >= 0) { + gmap->symidx = objects[CORPSE].oc_class + SYM_OFF_O; + if (has_rogue_color && iflags.use_color) + color = CLR_RED; + else + mon_color(offset); + gmap->glyphflags |= MG_CORPSE; + } else if ((offset = (glyph - GLYPH_DETECT_FEM_OFF)) >= 0) { + gmap->symidx = mons[offset].mlet + SYM_OFF_M; + if (has_rogue_color) + color = NO_COLOR; /* no need to check iflags.use_color */ + else + mon_color(offset); + /* Disabled for now; anyone want to get reverse video to work? */ + /* is_reverse = TRUE; */ + gmap->glyphflags |= (MG_DETECT | MG_FEMALE); + } else if ((offset = (glyph - GLYPH_DETECT_MALE_OFF)) >= 0) { + gmap->symidx = mons[offset].mlet + SYM_OFF_M; + if (has_rogue_color) + color = NO_COLOR; /* no need to check iflags.use_color */ + else + mon_color(offset); + /* Disabled for now; anyone want to get reverse video to work? */ + /* is_reverse = TRUE; */ + gmap->glyphflags |= (MG_DETECT | MG_MALE); + } else if ((offset = (glyph - GLYPH_INVIS_OFF)) >= 0) { + gmap->symidx = SYM_INVISIBLE + SYM_OFF_X; + if (has_rogue_color) + color = NO_COLOR; /* no need to check iflags.use_color */ + else + invis_color(offset); + gmap->glyphflags |= MG_INVIS; + } else if ((offset = (glyph - GLYPH_PET_FEM_OFF)) >= 0) { + gmap->symidx = mons[offset].mlet + SYM_OFF_M; + if (has_rogue_color) + color = NO_COLOR; /* no need to check iflags.use_color */ + else + pet_color(offset); + gmap->glyphflags |= (MG_PET | MG_FEMALE); + } else if ((offset = (glyph - GLYPH_PET_MALE_OFF)) >= 0) { + gmap->symidx = mons[offset].mlet + SYM_OFF_M; + if (has_rogue_color) + color = NO_COLOR; /* no need to check iflags.use_color */ + else + pet_color(offset); + gmap->glyphflags |= (MG_PET | MG_MALE); + } else if ((offset = (glyph - GLYPH_MON_FEM_OFF)) >= 0) { + gmap->symidx = mons[offset].mlet + SYM_OFF_M; + if (has_rogue_color && iflags.use_color) { + color = NO_COLOR; + } else { + mon_color(offset); + } + gmap->glyphflags |= MG_FEMALE; + } else if ((offset = (glyph - GLYPH_MON_MALE_OFF)) >= 0) { + gmap->symidx = mons[offset].mlet + SYM_OFF_M; + if (has_rogue_color && iflags.use_color) { + color = CLR_YELLOW; + } else { + mon_color(offset); + } + gmap->glyphflags |= MG_MALE; } - } - /* These were requested by a blind player to enhance screen reader use */ - if (sysopt.accessibility == 1 && !(mgflags & MG_FLAG_NOOVERRIDE)) { - int ovidx; - - if ((special & MG_PET) != 0) { - ovidx = SYM_PET_OVERRIDE + SYM_OFF_X; - if ((g.glyphmap_perlevel_flags & GMAP_ROGUELEVEL) - ? g.ov_rogue_syms[ovidx] - : g.ov_primary_syms[ovidx]) - idx = ovidx; + /* This was requested by a blind player to enhance screen reader use + */ + if (sysopt.accessibility == 1 && (gmap->glyphflags & MG_PET) != 0) { + int pet_override = ((g.glyphmap_perlevel_flags & GMAP_ROGUELEVEL) + ? g.ov_rogue_syms[SYM_PET_OVERRIDE + SYM_OFF_X] + : g.ov_primary_syms[SYM_PET_OVERRIDE + SYM_OFF_X]); + if (g.showsyms[pet_override] != ' ') + gmap->symidx = pet_override; } - if (is_you) { - ovidx = SYM_HERO_OVERRIDE + SYM_OFF_X; - if ((g.glyphmap_perlevel_flags & GMAP_ROGUELEVEL) - ? g.ov_rogue_syms[ovidx] - : g.ov_primary_syms[ovidx]) - idx = ovidx; - } - } - #ifdef TEXTCOLOR - /* Turn off color if no color defined, or rogue level w/o PC graphics. */ - if (!has_color(color) - || ((g.glyphmap_perlevel_flags & GMAP_ROGUELEVEL) && !has_rogue_color)) + /* Turn off color if no color defined, or rogue level w/o PC graphics. + */ + if (!has_color(color) + || ((g.glyphmap_perlevel_flags & GMAP_ROGUELEVEL) + && !has_rogue_color)) #endif - color = NO_COLOR; - glyphinfo->color = color; - glyphinfo->symidx = idx; - glyphinfo->ttychar = g.showsyms[idx]; - glyphinfo->glyphflags = special; - glyphinfo->glyph = glyph; + color = NO_COLOR; + gmap->color = color; + } } /* ------------------------------------------------------------------------ */ diff --git a/src/do.c b/src/do.c index 0747fe098..cd461616a 100644 --- a/src/do.c +++ b/src/do.c @@ -1455,9 +1455,7 @@ goto_level( if (Is_rogue_level(newlevel) || Is_rogue_level(&u.uz)) assign_graphics(Is_rogue_level(newlevel) ? ROGUESET : PRIMARY); -#ifdef USE_TILES - substitute_tiles(newlevel); -#endif + reset_glyphmap(gm_levelchange); check_gold_symbol(); /* record this level transition as a potential seen branch unless using * some non-standard means of transportation (level teleport). diff --git a/src/do_name.c b/src/do_name.c index 9fd143e11..e8a727db6 100644 --- a/src/do_name.c +++ b/src/do_name.c @@ -370,7 +370,8 @@ gather_locs_interesting(int x, int y, int gloc) /* unlike '/M', this skips monsters revealed by warning glyphs and remembered unseen ones */ return (glyph_is_monster(glyph) - && glyph != monnum_to_glyph(PM_LONG_WORM_TAIL)); + && glyph != monnum_to_glyph(PM_LONG_WORM_TAIL,MALE) && + glyph != monnum_to_glyph(PM_LONG_WORM_TAIL, FEMALE)); case GLOC_OBJS: return (glyph_is_object(glyph) && glyph != objnum_to_glyph(BOULDER) diff --git a/src/o_init.c b/src/o_init.c index ef1fd6036..00d60427b 100644 --- a/src/o_init.c +++ b/src/o_init.c @@ -13,8 +13,8 @@ static int QSORTCALLBACK discovered_cmp(const genericptr, const genericptr); static char *oclass_to_name(char, char *); #ifdef USE_TILES +extern glyph_map glyphmap[MAX_GLYPH]; static void shuffle_tiles(void); -extern short glyph2tile[]; /* from tile.c */ /* Shuffle tile assignments to match descriptions, so a red potion isn't * displayed with a blue tile and so on. @@ -29,13 +29,16 @@ static void shuffle_tiles(void) { int i; - short tmp_tilemap[NUM_OBJECTS]; + short tmp_tilemap[2][NUM_OBJECTS]; - for (i = 0; i < NUM_OBJECTS; i++) - tmp_tilemap[i] = glyph2tile[objects[i].oc_descr_idx + GLYPH_OBJ_OFF]; - - for (i = 0; i < NUM_OBJECTS; i++) - glyph2tile[i + GLYPH_OBJ_OFF] = tmp_tilemap[i]; + for (i = 0; i < NUM_OBJECTS; i++) { + tmp_tilemap[0][i] = glyphmap[objects[i].oc_descr_idx + GLYPH_OBJ_OFF].tileidx; + tmp_tilemap[1][i] = glyphmap[objects[i].oc_descr_idx + GLYPH_OBJ_PILETOP_OFF].tileidx; + } + for (i = 0; i < NUM_OBJECTS; i++) { + glyphmap[i + GLYPH_OBJ_OFF].tileidx = tmp_tilemap[0][i]; + glyphmap[i + GLYPH_OBJ_PILETOP_OFF].tileidx = tmp_tilemap[1][i]; + } } #endif /* USE_TILES */ diff --git a/src/options.c b/src/options.c index 913494e6d..99577e573 100644 --- a/src/options.c +++ b/src/options.c @@ -4129,6 +4129,7 @@ optfn_boolean(int optidx, int req, boolean negated, char *opts, char *op) case opt_ascii_map: case opt_tiled_map: g.opt_need_redraw = TRUE; + g.opt_need_glyph_reset = TRUE; break; case opt_hilite_pet: #ifdef CURSES_GRAPHICS @@ -4166,6 +4167,7 @@ optfn_boolean(int optidx, int req, boolean negated, char *opts, char *op) } #endif g.opt_need_redraw = TRUE; + g.opt_need_glyph_reset = TRUE; break; case opt_menucolors: case opt_guicolor: @@ -5839,7 +5841,7 @@ initoptions_finish(void) if (sym) g.showsyms[SYM_BOULDER + SYM_OFF_X] = sym; reglyph_darkroom(); - + reset_glyphmap(gm_optionchange); #ifdef STATUS_HILITES /* * A multi-interface binary might only support status highlighting @@ -7347,6 +7349,7 @@ doset(void) /* changing options via menu by Per Liboriussen */ #endif end_menu(tmpwin, "Set what options?"); g.opt_need_redraw = FALSE; + g.opt_need_glyph_reset = FALSE; if ((pick_cnt = select_menu(tmpwin, PICK_ANY, &pick_list)) > 0) { /* * Walk down the selection list and either invert the booleans @@ -7394,6 +7397,9 @@ doset(void) /* changing options via menu by Per Liboriussen */ } destroy_nhwindow(tmpwin); + if (g.opt_need_glyph_reset) { + reset_glyphmap(gm_optionchange); + } if (g.opt_need_redraw) { check_gold_symbol(); reglyph_darkroom(); diff --git a/src/pager.c b/src/pager.c index 266a9efef..da4569489 100644 --- a/src/pager.c +++ b/src/pager.c @@ -257,9 +257,9 @@ object_from_map(int glyph, int x, int y, struct obj **obj_p) else otmp->corpsenm = MCORPSENM(mtmp); } else if (otmp->otyp == CORPSE && glyph_is_body(glyph)) { - otmp->corpsenm = glyph - GLYPH_BODY_OFF; + otmp->corpsenm = glyph_to_body_corpsenm(glyph); } else if (otmp->otyp == STATUE && glyph_is_statue(glyph)) { - otmp->corpsenm = glyph - GLYPH_STATUE_OFF; + otmp->corpsenm = glyph_to_statue_corpsenm(glyph); } if (otmp->otyp == LEASH) otmp->leashmon = 0; diff --git a/src/restore.c b/src/restore.c index 4cff24723..f82abf688 100644 --- a/src/restore.c +++ b/src/restore.c @@ -11,10 +11,6 @@ extern int dotcnt; /* shared with save */ extern int dotrow; /* shared with save */ #endif -#ifdef USE_TILES -extern void substitute_tiles(d_level *); /* from tile.c */ -#endif - #ifdef ZEROCOMP static void zerocomp_minit(void); static void zerocomp_mread(int, genericptr_t, unsigned int); @@ -852,9 +848,7 @@ dorecover(NHFILE* nhfp) (void) delete_savefile(); if (Is_rogue_level(&u.uz)) assign_graphics(ROGUESET); -#ifdef USE_TILES - substitute_tiles(&u.uz); -#endif + reset_glyphmap(gm_levelchange); max_rank_sz(); /* to recompute g.mrank_sz (botl.c) */ init_oclass_probs(); /* recompute g.oclass_prob_totals[] */ /* take care of iron ball & chain */ diff --git a/src/windows.c b/src/windows.c index 48fe2ac94..3ca1aee2a 100644 --- a/src/windows.c +++ b/src/windows.c @@ -1375,7 +1375,7 @@ glyph2symidx(int glyph) glyph_info glyphinfo; map_glyphinfo(0, 0, glyph, 0, &glyphinfo); - return glyphinfo.symidx; + return glyphinfo.gm.symidx; } char * @@ -1419,7 +1419,7 @@ decode_mixed(char *buf, const char *str) else break; map_glyphinfo(0, 0, gv, 0, &glyphinfo); - so = glyphinfo.symidx; + so = glyphinfo.gm.symidx; *put++ = g.showsyms[so]; /* 'str' is ready for the next loop iteration and '*str' should not be copied at the end of this iteration */ diff --git a/src/worm.c b/src/worm.c index ca5b75f96..625c8ec7b 100644 --- a/src/worm.c +++ b/src/worm.c @@ -491,9 +491,12 @@ detect_wsegs(struct monst *worm, boolean use_detection_glyph) int what_tail = what_mon(PM_LONG_WORM_TAIL, newsym_rn2); while (curr != wheads[worm->wormno]) { - num = use_detection_glyph ? detected_monnum_to_glyph(what_tail) - : worm->mtame ? petnum_to_glyph(what_tail) - : monnum_to_glyph(what_tail); + num = use_detection_glyph ? detected_monnum_to_glyph(what_tail, + worm->female ? FEMALE : MALE) + : worm->mtame ? petnum_to_glyph(what_tail, + worm->female ? FEMALE : MALE) + : monnum_to_glyph(what_tail, + worm->female ? FEMALE : MALE); show_glyph(curr->wx, curr->wy, num); curr = curr->nseg; } diff --git a/sys/msdos/pctiles.h b/sys/msdos/pctiles.h index eb6dab602..5241be4dc 100644 --- a/sys/msdos/pctiles.h +++ b/sys/msdos/pctiles.h @@ -59,9 +59,6 @@ extern int ReadPlanarTileFile_O(int, struct overview_planar_cell_struct **); #ifdef PACKED_FILE extern int ReadPackedTileFile(int, char (*)[TILE_X]); #endif - -extern short glyph2tile[MAX_GLYPH]; /* in tile.c (made from tilemap.c) */ - #endif /* USE_TILES */ /* pctiles.h */ diff --git a/sys/msdos/pcvideo.h b/sys/msdos/pcvideo.h index 5653296be..cee982c22 100644 --- a/sys/msdos/pcvideo.h +++ b/sys/msdos/pcvideo.h @@ -276,7 +276,7 @@ extern void vga_tty_end_screen(void); extern void vga_tty_startup(int *, int *); extern void vga_xputs(const char *, int, int); extern void vga_xputc(char, int); -extern void vga_xputg(int, int, unsigned); +extern void vga_xputg(const glyph_info *); extern void vga_userpan(enum vga_pan_direction); extern void vga_overview(boolean); extern void vga_traditional(boolean); @@ -305,7 +305,7 @@ extern void vesa_tty_end_screen(void); extern void vesa_tty_startup(int *, int *); extern void vesa_xputs(const char *, int, int); extern void vesa_xputc(char, int); -extern void vesa_xputg(int, int, unsigned); +extern void vesa_xputg(const glyph_info *); extern void vesa_userpan(enum vga_pan_direction); extern void vesa_overview(boolean); extern void vesa_traditional(boolean); diff --git a/sys/msdos/video.c b/sys/msdos/video.c index 007e238dd..795c4611a 100644 --- a/sys/msdos/video.c +++ b/sys/msdos/video.c @@ -593,17 +593,17 @@ xputc(int ch) /* write out character (and attribute) */ } /* write out a glyph picture at current location */ -void xputg(int glyphnum, int ch, unsigned special) +void xputg(const glyph_info *glyphinfo) { if (!iflags.grmode || !iflags.tile_view) { - (void) xputc((char) ch); + (void) xputc((char) glyphinfo->ttychar); #ifdef SCREEN_VGA } else if (iflags.grmode && iflags.usevga) { - vga_xputg(glyphnum, ch, special); + vga_xputg(glyphinfo); #endif #ifdef SCREEN_VESA } else if (iflags.grmode && iflags.usevesa) { - vesa_xputg(glyphnum, ch, special); + vesa_xputg(glyphinfo); #endif } } diff --git a/sys/msdos/vidvesa.c b/sys/msdos/vidvesa.c index db31487e3..6d662bf35 100644 --- a/sys/msdos/vidvesa.c +++ b/sys/msdos/vidvesa.c @@ -85,6 +85,7 @@ static struct map_struct { int ch; int attr; unsigned special; + short int tileidx; } map[ROWNO][COLNO]; /* track the glyphs */ #define vesa_clearmap() \ @@ -667,14 +668,13 @@ vesa_xputc(char ch, int attr) #if defined(USE_TILES) /* Place tile represent. a glyph at current location */ void -vesa_xputg(int glyphnum, int ch, - unsigned special) /* special feature: corpse, invis, detected, pet, ridden - - hack.h */ +vesa_xputg(const glyph_info *glyphinfo) { + int glyphnum = glyphinfo->glyph, ch = glyphinfo->ttychar; + unsigned special = glyphinfo->gm.glyphflags; int col, row; int attr; int ry; - int tilenum = 0; row = currow; col = curcol; @@ -685,6 +685,7 @@ vesa_xputg(int glyphnum, int ch, map[ry][col].glyph = glyphnum; map[ry][col].ch = ch; map[ry][col].special = special; + map[ry][col].tileidx = glyphinfo->gm.tileidx; attr = (g_attribute == 0) ? attrib_gr_normal : g_attribute; map[ry][col].attr = attr; if (iflags.traditional_view) { @@ -696,10 +697,7 @@ vesa_xputg(int glyphnum, int ch, if (!iflags.over_view && map[ry][col].special) decal_packed(packcell, special); #endif - tilenum = glyph2tile[glyphnum]; - if (map[ry][col].special & MG_FEMALE) - tilenum++; - vesa_DisplayCell(tilenum, col - clipx, ry - clipy); + vesa_DisplayCell(glyphinfo->gm.tileidx, col - clipx, ry - clipy); } } if (col < (CO - 1)) @@ -807,7 +805,7 @@ vesa_redrawmap(void) for (cy = 0; cy < ROWNO; ++cy) { for (py = 0; py < vesa_oview_height; ++py) { for (cx = 0; cx < COLNO; ++cx) { - tile = vesa_oview_tiles[glyph2tile[map[cy][cx].glyph]]; + tile = vesa_oview_tiles[map[cy][cx].tileidx]; vesa_WritePixelRow(offset + p_row_width * cx, tile + p_row_width * py, p_row_width); } x = COLNO * vesa_oview_width; @@ -827,7 +825,7 @@ vesa_redrawmap(void) for (cy = clipy; cy <= (unsigned) clipymax && cy < ROWNO; ++cy) { for (py = 0; py < (unsigned) iflags.wc_tile_height; ++py) { for (cx = clipx; cx <= (unsigned) clipxmax && cx < COLNO; ++cx) { - tile = vesa_tiles[glyph2tile[map[cy][cx].glyph]]; + tile = vesa_tiles[map[cy][cx].tileidx]; vesa_WritePixelRow(offset + p_row_width * (cx - clipx), tile + p_row_width * py, p_row_width); } x = (cx - clipx) * iflags.wc_tile_width; diff --git a/sys/msdos/vidvga.c b/sys/msdos/vidvga.c index e2c8107a3..451a06695 100644 --- a/sys/msdos/vidvga.c +++ b/sys/msdos/vidvga.c @@ -102,8 +102,6 @@ #include #endif -extern short glyph2tile[]; - /* static void vga_NoBorder(int); */ void vga_gotoloc(int, int); /* This should be made a macro */ void vga_backsp(void); @@ -157,6 +155,7 @@ static struct map_struct { int ch; int attr; unsigned special; + short int tileidx; } map[ROWNO][COLNO]; /* track the glyphs */ #define vga_clearmap() \ @@ -168,6 +167,7 @@ static struct map_struct { map[y][x].ch = S_stone; \ map[y][x].attr = 0; \ map[y][x].special = 0; \ + map[y][x].tileidx = 0; \ } \ } #define TOP_MAP_ROW 1 @@ -356,18 +356,20 @@ void vga_xputc(char ch, int attr) #if defined(USE_TILES) /* Place tile represent. a glyph at current location */ void -vga_xputg(int glyphnum, int ch, - unsigned special) /* special feature: corpse, invis, detected, pet, ridden - - hack.h */ +vga_xputg(const glyph_info *glyphinfo) { + int glyphnum = glyphinfo->glyph, ch = glyphinfo->ttychar; + unsigned special = glyphinfo->gm.glyphflags; int col, row; int attr; int ry; /* If statue glyph, map to the generic statue */ +#if 0 if (GLYPH_STATUE_OFF <= glyphnum && glyphnum < GLYPH_STATUE_OFF + NUMMONS) { glyphnum = objnum_to_glyph(STATUE); } +#endif row = currow; col = curcol; @@ -380,6 +382,7 @@ vga_xputg(int glyphnum, int ch, map[ry][col].special = special; attr = (g_attribute == 0) ? attrib_gr_normal : g_attribute; map[ry][col].attr = attr; + map[ry][col].tileidx = glyphinfo->gm.tileidx; if (iflags.traditional_view) { vga_WriteChar((unsigned char) ch, col, row, attr); } else if (!iflags.over_view) { @@ -677,16 +680,14 @@ read_tile_indexes(unsigned glyph, unsigned char (*indexes)[TILE_X]) glyph = GLYPH_OBJ_OFF + STATUE; } - /* Get the tile from the image */ - tilenum = glyph2tile[glyph]; row = currow; col = curcol; if ((col < 0 || col >= COLNO) || (row < TOP_MAP_ROW || row >= (ROWNO + TOP_MAP_ROW))) return; ry = row - TOP_MAP_ROW; - if (map[ry][col].special & MG_FEMALE) - tilenum++; + /* Get the tile from the image */ + tilenum = map[ry][col].tileidx; tile = get_tile(tilenum); /* Map to a 16 bit palette; assume colors laid out as in default tileset */ diff --git a/sys/unix/Makefile.utl b/sys/unix/Makefile.utl index 40692f082..1998e3c2b 100644 --- a/sys/unix/Makefile.utl +++ b/sys/unix/Makefile.utl @@ -296,8 +296,9 @@ tile2beos: tile2beos.o $(TEXT_IO) # that without mucking about with extra OS-specific CFLAGS and/or LFLAGS #tilemap: ../win/share/tilemap.c $(HACK_H) # $(CC) $(CFLAGS) $(LFLAGS) -o tilemap ../win/share/tilemap.c $(LIBS) -tilemap: tilemap.o - $(CLINK) $(LFLAGS) -o tilemap tilemap.o $(LIBS) +tilemap: tilemap.o $(OBJDIR)/objects.o $(OBJDIR)/monst.o $(OBJDIR)/drawing.o + $(CLINK) $(LFLAGS) -o tilemap tilemap.o $(OBJDIR)/objects.o \ + $(OBJDIR)/monst.o $(OBJDIR)/drawing.o $(LIBS) ../src/tile.c: tilemap ./tilemap diff --git a/sys/windows/Makefile.msc b/sys/windows/Makefile.msc index 613689309..2cf063cc5 100644 --- a/sys/windows/Makefile.msc +++ b/sys/windows/Makefile.msc @@ -1429,9 +1429,10 @@ $(SRC)\tile.c: $(U)tilemap.exe @$(U)tilemap @echo A new $(@:\=/) has been created -$(U)tilemap.exe: $(O)tilemap.o +$(U)tilemap.exe: $(O)tilemap.o $(O)monst.o $(O)objects.o $(O)drawing.o @echo Linking $(@:\=/) - @$(link) $(lflagsBuild) /PDB:"$(O)$(@B).PDB" /MAP:"$(O)$(@B).MAP" -out:$@ $(O)tilemap.o + @$(link) $(lflagsBuild) /PDB:"$(O)$(@B).PDB" /MAP:"$(O)$(@B).MAP" -out:$@ \ + $(O)tilemap.o $(O)monst.o $(O)objects.o $(O)drawing.o $(O)tilemap.o: $(WSHR)\tilemap.c $(HACK_H) @$(cc) $(cflagsBuild) $(CROSSCOMPILE) -Fo$@ $(WSHR)\tilemap.c @@ -1924,30 +1925,30 @@ $(TARGETPFX)wintty.o: ..\win\tty\wintty.c $(HACK_H) $(INCL)\dlb.h \ $(INCL)\tcap.h $(INCL)\wintty.h $(TARGET_CC) $(TARGET_CFLAGS) -Fo$@ ..\win\tty\wintty.c $(TARGETPFX)cursmain.o: ..\win\curses\cursmain.c $(HACK_H) $(INCL)\wincurs.h - $(TARGET_CC) $(TARGET_CFLAGS) -Fo$@ ..\win\curses\cursmain.c +# $(TARGET_CC) $(TARGET_CFLAGS) -Fo$@ ..\win\curses\cursmain.c $(TARGETPFX)curswins.o: ..\win\curses\curswins.c $(HACK_H) \ $(INCL)\wincurs.h ..\win\curses\curswins.h - $(TARGET_CC) $(TARGET_CFLAGS) -Fo$@ ..\win\curses\curswins.c +# $(TARGET_CC) $(TARGET_CFLAGS) -Fo$@ ..\win\curses\curswins.c $(TARGETPFX)cursmisc.o: ..\win\curses\cursmisc.c $(HACK_H) \ $(INCL)\wincurs.h ..\win\curses\cursmisc.h \ $(INCL)\func_tab.h $(INCL)\dlb.h - $(TARGET_CC) $(TARGET_CFLAGS) -Fo$@ ..\win\curses\cursmisc.c +# $(TARGET_CC) $(TARGET_CFLAGS) -Fo$@ ..\win\curses\cursmisc.c $(TARGETPFX)cursdial.o: ..\win\curses\cursdial.c $(HACK_H) \ $(INCL)\wincurs.h ..\win\curses\cursdial.h \ $(INCL)\func_tab.h - $(TARGET_CC) $(TARGET_CFLAGS) -Fo$@ ..\win\curses\cursdial.c +# $(TARGET_CC) $(TARGET_CFLAGS) -Fo$@ ..\win\curses\cursdial.c $(TARGETPFX)cursstat.o: ..\win\curses\cursstat.c $(HACK_H) \ $(INCL)\wincurs.h ..\win\curses\cursstat.h - $(TARGET_CC) $(TARGET_CFLAGS) -Fo$@ ..\win\curses\cursstat.c +# $(TARGET_CC) $(TARGET_CFLAGS) -Fo$@ ..\win\curses\cursstat.c $(TARGETPFX)cursinit.o: ..\win\curses\cursinit.c $(HACK_H) \ $(INCL)\wincurs.h ..\win\curses\cursinit.h - $(TARGET_CC) $(TARGET_CFLAGS) -Fo$@ ..\win\curses\cursinit.c +# $(TARGET_CC) $(TARGET_CFLAGS) -Fo$@ ..\win\curses\cursinit.c $(TARGETPFX)cursmesg.o: ..\win\curses\cursmesg.c $(HACK_H) \ $(INCL)\wincurs.h ..\win\curses\cursmesg.h - $(TARGET_CC) $(TARGET_CFLAGS) -Fo$@ ..\win\curses\cursmesg.c +# $(TARGET_CC) $(TARGET_CFLAGS) -Fo$@ ..\win\curses\cursmesg.c $(TARGETPFX)cursinvt.o: ..\win\curses\cursinvt.c $(HACK_H) \ $(INCL)\wincurs.h ..\win\curses\cursinvt.h - $(TARGET_CC) $(TARGET_CFLAGS) -Fo$@ ..\win\curses\cursinvt.c +# $(TARGET_CC) $(TARGET_CFLAGS) -Fo$@ ..\win\curses\cursinvt.c #$(TARGETPFX)Window.o: ..\win\X11\Window.c $(INCL)\xwindowp.h \ # $(INCL)\xwindow.h $(CONFIG_H) $(INCL)\lint.h \ # $(INCL)\winX.h $(INCL)\color.h $(INCL)\wintype.h diff --git a/win/Qt/qt_glyph.cpp b/win/Qt/qt_glyph.cpp index c3657324d..e4057e59b 100644 --- a/win/Qt/qt_glyph.cpp +++ b/win/Qt/qt_glyph.cpp @@ -80,13 +80,18 @@ NetHackQtGlyphs::NetHackQtGlyphs() setSize(tilefile_tile_W, tilefile_tile_H); } -void NetHackQtGlyphs::drawGlyph(QPainter& painter, int glyph, int x, int y, - bool fem, bool reversed) +void NetHackQtGlyphs::drawGlyph(QPainter& painter, int glyph, int tileidx, + int x, int y, bool fem, bool reversed) { if (!reversed) { +#if 0 int tile = glyph2tile[glyph]; + /* this is not required with the new glyph representation */ if (fem) ++tile; +#else + int tile = tileidx; +#endif int px = (tile % tiles_per_row) * width(); int py = tile / tiles_per_row * height(); @@ -98,15 +103,16 @@ void NetHackQtGlyphs::drawGlyph(QPainter& painter, int glyph, int x, int y, } } -void NetHackQtGlyphs::drawCell(QPainter& painter, int glyph, +void NetHackQtGlyphs::drawCell(QPainter& painter, int glyph, int tileidx, int cellx, int celly, bool fem) { - drawGlyph(painter, glyph, cellx * width(), celly * height(), fem, false); + drawGlyph(painter, glyph, tileidx, cellx * width(), celly * height(), + fem, false); } void NetHackQtGlyphs::drawBorderedCell(QPainter& painter, int glyph, - int cellx, int celly, int border, - bool reversed, bool fem) + int tileidx, int cellx, int celly, + int border, bool reversed, bool fem) { int wd = width(), ht = height(), @@ -114,7 +120,7 @@ void NetHackQtGlyphs::drawBorderedCell(QPainter& painter, int glyph, lox = cellx * (wd + 2), loy = celly * (ht + 2) + yoffset; - drawGlyph(painter, glyph, lox + 1, loy + 1, fem, reversed); + drawGlyph(painter, glyph, tileidx, lox + 1, loy + 1, fem, reversed); #ifdef TEXTCOLOR if (border != NO_BORDER) { @@ -165,11 +171,15 @@ void NetHackQtGlyphs::drawBorderedCell(QPainter& painter, int glyph, } // mis-named routine to get the pixmap for a particular glyph -QPixmap NetHackQtGlyphs::glyph(int glyphindx, bool fem) +QPixmap NetHackQtGlyphs::glyph(int glyphindx UNUSED, int tileidx, bool fem UNUSED) { +#if 0 int tile = glyph2tile[glyphindx]; if (fem) ++tile; +#else + int tile = tileidx; +#endif int px = (tile % tiles_per_row) * tilefile_tile_W; int py = tile / tiles_per_row * tilefile_tile_H; @@ -178,9 +188,9 @@ QPixmap NetHackQtGlyphs::glyph(int glyphindx, bool fem) } // transpose a glyph's tile horizontally, scaled for use in paper doll -QPixmap NetHackQtGlyphs::reversed_pixmap(int glyphindx, bool fem) +QPixmap NetHackQtGlyphs::reversed_pixmap(int glyphindx, int tileidx, bool fem) { - QPixmap pxmp = glyph(glyphindx, fem); + QPixmap pxmp = glyph(glyphindx, tileidx, fem); #ifdef ENHANCED_PAPERDOLL qreal wid = (qreal) pxmp.width(), //hgt = (qreal) pxmp.height(), diff --git a/win/Qt/qt_glyph.h b/win/Qt/qt_glyph.h index afc2b92ca..2842d2d14 100644 --- a/win/Qt/qt_glyph.h +++ b/win/Qt/qt_glyph.h @@ -23,14 +23,16 @@ public: void toggleSize(); void setSize(int w, int h); - void drawGlyph(QPainter &, int glyph, int pixelx, int pixely, + void drawGlyph(QPainter &, int glyph, int tileidx, + int pixelx, int pixely, bool fem, bool reversed = false); - void drawCell(QPainter &, int glyph, int cellx, int celly, bool fem); - void drawBorderedCell(QPainter &, int glyph, + void drawCell(QPainter &, int glyph, int tileidx, + int cellx, int celly, bool fem); + void drawBorderedCell(QPainter &, int glyph, int tileidx, int cellx, int celly, int bordercode, bool reversed, bool fem = false); - QPixmap glyph(int glyphindx, bool fem = false); - QPixmap reversed_pixmap(int glyphindx, bool fem = false); + QPixmap glyph(int glyphindx, int tileidx, bool fem = false); + QPixmap reversed_pixmap(int glyphindx, int tileidx, bool fem = false); private: QImage img; diff --git a/win/Qt/qt_inv.cpp b/win/Qt/qt_inv.cpp index d309b6e52..0a0022faa 100644 --- a/win/Qt/qt_inv.cpp +++ b/win/Qt/qt_inv.cpp @@ -75,6 +75,7 @@ void NetHackQtInvUsageWindow::drawWorn(QPainter &painter, obj *nhobj, const char *alttip, int flags) { short int glyph; + glyph_info gi; int border; char tipstr[1 + BUFSZ + 1]; // extra room for leading and trailing space bool rev = (flags == dollReverse), @@ -112,6 +113,8 @@ void NetHackQtInvUsageWindow::drawWorn(QPainter &painter, obj *nhobj, tips[x][y] = dupstr(tipstr); #endif glyph = obj_to_glyph(nhobj, rn2_on_display_rng); + map_glyphinfo(0, 0, glyph, 0, &gi); /* this skirts the defined + interface unfortunately */ } else { border = NO_BORDER; #ifdef ENHANCED_PAPERDOLL @@ -133,7 +136,7 @@ void NetHackQtInvUsageWindow::drawWorn(QPainter &painter, obj *nhobj, // an empty slot is shown as floor tile unless it's always empty glyph = canbe ? cmap_to_glyph(S_room) : GLYPH_UNEXPLORED; } - qt_settings->glyphs().drawBorderedCell(painter, glyph, x, y, border, rev); + qt_settings->glyphs().drawBorderedCell(painter, glyph, gi.gm.tileidx, x, y, border, rev); } // called to update the paper doll inventory subset diff --git a/win/Qt/qt_map.cpp b/win/Qt/qt_map.cpp index 7ab314bd7..3eb766866 100644 --- a/win/Qt/qt_map.cpp +++ b/win/Qt/qt_map.cpp @@ -184,6 +184,7 @@ void NetHackQtMapViewport::paintEvent(QPaintEvent* event) unsigned short color = Glyphcolor(i, j); unsigned short ch = Glyphttychar(i, j); unsigned special = Glyphflags(i, j); +/* unsigned short tileidx = Glyphtileidx(i, j); */ ch = cp437(ch); #ifdef TEXTCOLOR painter.setPen( nhcolor_to_pen(color) ); @@ -213,8 +214,9 @@ void NetHackQtMapViewport::paintEvent(QPaintEvent* event) for (int i = garea.left(); i <= garea.right(); i++) { unsigned short g = Glyph(i,j); unsigned special = Glyphflags(i, j); + unsigned tileidx = Glyphtileidx(i, j); bool femflag = (special & MG_FEMALE) ? true : false; - glyphs.drawCell(painter, g, i, j, femflag); + glyphs.drawCell(painter, g, tileidx, i, j, femflag); if ((special & MG_PET) != 0 && ::iflags.hilite_pet) { painter.drawPixmap(QPoint(i * gW, j * gH), @@ -498,12 +500,14 @@ void NetHackQtMapViewport::Clear() Glyphttychar(0, j) = ' '; Glyphcolor(0, j) = NO_COLOR; Glyphflags(0, j) = 0U; + Glyphtileidx(0, j) = 0; for (int i = 1; i < COLNO; ++i) { Glyph(i, j) = GLYPH_UNEXPLORED; Glyphttychar(i, j) = ' '; Glyphcolor(i, j) = NO_COLOR; Glyphflags(i, j) = 0U; + Glyphtileidx(i, j) = 0; } } @@ -541,8 +545,9 @@ void NetHackQtMapViewport::PrintGlyph(int x, int y, { Glyph(x, y) = (unsigned short) glyphinfo->glyph; Glyphttychar(x, y) = (unsigned short) glyphinfo->ttychar; - Glyphcolor(x, y) = (unsigned short) glyphinfo->color; - Glyphflags(x, y) = glyphinfo->glyphflags; + Glyphcolor(x, y) = (unsigned short) glyphinfo->gm.color; + Glyphflags(x, y) = glyphinfo->gm.glyphflags; + Glyphtileidx(x, y) = (unsigned short) glyphinfo->gm.tileidx; Changed(x, y); } @@ -775,11 +780,13 @@ void NetHackQtMapWindow::Clear() Glyphcolor(0, j) = NO_COLOR; Glyphttychar(0, j) = ' '; Glyphflags(0, j) = 0; + Glyphtileidx(0, j) = 0; for (int i = 1; i < COLNO; ++i) { Glyph(i, j) = GLYPH_UNEXPLORED; Glyphcolor(i, j) = NO_COLOR; Glyphttychar(i, j) = ' '; Glyphflags(i, j) = 0; + Glyphtileidx(i, j) = 0; } } @@ -895,8 +902,10 @@ void NetHackQtMapWindow::paintEvent(QPaintEvent* event) int color = Glyphcolor(i,j); int ch = Glyphttychar(i,j); unsigned special = Glyphflags(i,j); + unsigned short tileidx = Glyphtileidx(i,j); bool femflag = (special & MG_FEMALE) ? true : false; - qt_settings->glyphs().drawCell(painter, g, i, j, femflag); + qt_settings->glyphs().drawCell(painter, g, tileidx, + i, j, femflag); #ifdef TEXTCOLOR if ((special & MG_PET) != 0 && ::iflags.hilite_pet) { painter.drawPixmap(QPoint(i*qt_settings->glyphs().width(), @@ -1011,6 +1020,7 @@ void NetHackQtMapWindow::PrintGlyph(int x,int y, const glyph_info *glyphinfo) Glyphttychar(x,y)=glyphinfo->ttychar; Glyphcolor(x,y)=glyphinfo->color; Glyphflags(x,y)=glyphinfo->glyphflags; + Glyphtileidx(x,y)=glyphinfo->tileidx; Changed(x,y); } diff --git a/win/Qt/qt_map.h b/win/Qt/qt_map.h index 0303b0ef9..819226747 100644 --- a/win/Qt/qt_map.h +++ b/win/Qt/qt_map.h @@ -46,6 +46,10 @@ private: unsigned int &Glyphflags(int x, int y) { return glyphflags[y][x]; } + unsigned short glyphtileidx[ROWNO][COLNO]; + unsigned short &Glyphtileidx(int x, int y) { + return glyphtileidx[y][x]; + } QPoint cursor; QPixmap pet_annotation; QPixmap pile_annotation; diff --git a/win/Qt/qt_menu.cpp b/win/Qt/qt_menu.cpp index 682a911cf..507e252dd 100644 --- a/win/Qt/qt_menu.cpp +++ b/win/Qt/qt_menu.cpp @@ -545,6 +545,7 @@ void NetHackQtMenuWindow::AddRow(int row, const MenuItem& mi) { QFontMetrics fm(table->font()); QTableWidgetItem *twi; + glyph_info gi; if (mi.Selectable() && how != PICK_NONE) { // Count @@ -569,7 +570,8 @@ void NetHackQtMenuWindow::AddRow(int row, const MenuItem& mi) } if (mi.glyph != NO_GLYPH) { // Icon - QPixmap pm(qt_settings->glyphs().glyph(mi.glyph)); + map_glyphinfo(0, 0, mi.glyph, 0, &gi); + QPixmap pm(qt_settings->glyphs().glyph(mi.glyph, gi.gm.tileidx)); twi = new QTableWidgetItem(QIcon(pm), ""); table->setItem(row, 2, twi); twi->setFlags(Qt::ItemIsEnabled); diff --git a/win/Qt/qt_plsel.cpp b/win/Qt/qt_plsel.cpp index e20735b56..c9fd09756 100644 --- a/win/Qt/qt_plsel.cpp +++ b/win/Qt/qt_plsel.cpp @@ -82,14 +82,14 @@ public: { } - void setGlyph(int g, bool fem) + void setGlyph(int g, int tileidx, bool fem) { NetHackQtGlyphs& glyphs = qt_settings->glyphs(); int gw = glyphs.width(); int gh = glyphs.height(); QPixmap pm(gw,gh); QPainter p(&pm); - glyphs.drawGlyph(p, g, 0, 0, fem); + glyphs.drawGlyph(p, g, tileidx, 0, 0, fem); p.end(); setIcon(QIcon(pm)); //RLC setHeight(std::max(pm.height()+1,height())); @@ -124,7 +124,10 @@ public: #endif ) { - setGlyph(monnum_to_glyph(roles[id].malenum), false); + glyph_info gi; + int glyph = monnum_to_glyph(roles[id].malenum, MALE); + map_glyphinfo(0, 0, glyph, 0, &gi); + setGlyph(glyph, gi.gm.tileidx, false); } }; @@ -139,7 +142,10 @@ public: #endif ) { - setGlyph(monnum_to_glyph(races[id].malenum), false); + glyph_info gi; + int glyph = monnum_to_glyph(races[id].malenum, MALE); + map_glyphinfo(0, 0, glyph, 0, &gi); + setGlyph(glyph, gi.gm.tileidx, false); } }; diff --git a/win/X11/winmap.c b/win/X11/winmap.c index 853dcb6a6..3d8bbb4c1 100644 --- a/win/X11/winmap.c +++ b/win/X11/winmap.c @@ -45,8 +45,7 @@ #endif /* from tile.c */ -extern short glyph2tile[]; -extern int total_tiles_used; +extern int total_tiles_used, Tile_corr; /* Define these if you really want a lot of junk on your screen. */ /* #define VERBOSE */ /* print various info & events as they happen */ @@ -87,10 +86,16 @@ X11_print_glyph(winid window, xchar x, xchar y, const glyph_info *glyphinfo, /* update both the tile and text backing stores */ { - unsigned short *t_ptr = &map_info->tile_map.glyphs[y][x].glyph; + unsigned short *g_ptr = &map_info->tile_map.glyphs[y][x].glyph, + *t_ptr = &map_info->tile_map.glyphs[y][x].tileidx; - if (*t_ptr != glyphinfo->glyph) { - *t_ptr = glyphinfo->glyph; + if (*g_ptr != glyphinfo->glyph) { + *g_ptr = glyphinfo->glyph; + if (map_info->is_tile) + update_bbox = TRUE; + } + if (*t_ptr != glyphinfo->gm.tileidx) { + *t_ptr = glyphinfo->gm.tileidx; if (map_info->is_tile) update_bbox = TRUE; } @@ -105,8 +110,8 @@ X11_print_glyph(winid window, xchar x, xchar y, const glyph_info *glyphinfo, register unsigned char *co_ptr; #endif - color = glyphinfo->color; - special = glyphinfo->glyphflags; + color = glyphinfo->gm.color; + special = glyphinfo->gm.glyphflags; och = glyphinfo->ttychar; ch = (uchar) och; @@ -530,7 +535,11 @@ ntiles %ld\n", values.foreground = WhitePixelOfScreen(screen) ^ XGetPixel(tile_image, 0, +#if 0 tile_height * glyph2tile[cmap_to_glyph(S_corr)]); +#else + tile_height * T_corr); +#endif values.function = GXxor; tile_info->white_gc = XtGetGC(wp->w, mask, &values); @@ -1251,14 +1260,21 @@ map_update(struct xwindow *wp, int start_row, int stop_row, int start_col, int s for (row = start_row; row <= stop_row; row++) { for (cur_col = start_col; cur_col <= stop_col; cur_col++) { +#if 0 int glyph = tile_map->glyphs[row][cur_col].glyph; int tile = glyph2tile[glyph]; +#else + int tile = tile_map->glyphs[row][cur_col].tileidx; +#endif int src_x, src_y; int dest_x = (cur_col - COL0_OFFSET) * tile_map->square_width; int dest_y = row * tile_map->square_height; +#if 0 + /* not required with the new glyph representations */ if ((tile_map->glyphs[row][cur_col].glyphflags & MG_FEMALE)) tile++; /* advance to the female tile variation */ +#endif src_x = (tile % TILES_PER_ROW) * tile_width; src_y = (tile / TILES_PER_ROW) * tile_height; XCopyArea(dpy, tile_pixmap, XtWindow(wp->w), diff --git a/win/curses/cursmain.c b/win/curses/cursmain.c index 72195dc26..6e9d73407 100644 --- a/win/curses/cursmain.c +++ b/win/curses/cursmain.c @@ -747,9 +747,9 @@ curses_print_glyph(winid wid, xchar x, xchar y, int attr = -1; glyph = glyphinfo->glyph; - special = glyphinfo->glyphflags; + special = glyphinfo->gm.glyphflags; ch = glyphinfo->ttychar; - color = glyphinfo->color; + color = glyphinfo->gm.color; if ((special & MG_PET) && iflags.hilite_pet) { attr = iflags.wc2_petattr; } diff --git a/win/share/other.txt b/win/share/other.txt index f6e2718da..e9c86bfe8 100644 --- a/win/share/other.txt +++ b/win/share/other.txt @@ -616,7 +616,7 @@ Z = (195, 195, 195) AAAAAAAAAAAAAA.A AAAAAAAAAAAAAAAA } -# tile 31 (altar) +# tile 31 (unaligned altar) { ................ ................ @@ -635,7 +635,83 @@ Z = (195, 195, 195) ...AAAAAAAAAAA.. ................ } -# tile 32 (grave) +# tile 32 (chaotic altar) +{ + ................ + ................ + ................ + ................ + ................ + ................ + ................ + ................ + ................ + ...PDPDPDPDP.... + ..PPPDPDDDPPP... + ...BBPPPDPP.AA.. + ...BPPPPPP..A... + ..PP.......PP... + ...AAAAAAAAAAA.. + ................ +} +# tile 33 (neutral altar) +{ + ................ + ................ + ................ + ................ + ................ + ................ + ................ + ................ + ................ + ...PDPDPDPDP.... + ..PPPDPDDDPPP... + ...BBPPPDPP.AA.. + ...BPPPPPP..A... + ..PP.......PP... + ...AAAAAAAAAAA.. + ................ +} +# tile 34 (lawful altar) +{ + ................ + ................ + ................ + ................ + ................ + ................ + ................ + ................ + ................ + ...PDPDPDPDP.... + ..PPPDPDDDPPP... + ...BBPPPDPP.AA.. + ...BPPPPPP..A... + ..PP.......PP... + ...AAAAAAAAAAA.. + ................ +} +# tile 35 (shrine) +{ + ................ + ................ + ................ + ................ + ................ + ................ + ................ + ................ + ................ + ...PDPDPDPDP.... + ..PPPDPDDDPPP... + ...BBPPPDPP.AA.. + ...BPPPPPP..A... + ..PP.......PP... + ...AAAAAAAAAAA.. + ................ +} +# tile 36 (grave) { ................ ................ @@ -654,7 +730,7 @@ Z = (195, 195, 195) FFFFFFFFFFFFFFF. ................ } -# tile 33 (throne) +# tile 37 (throne) { ................ .....HHHHH...... @@ -673,7 +749,7 @@ Z = (195, 195, 195) ................ ................ } -# tile 34 (sink) +# tile 38 (sink) { ................ ................ @@ -692,7 +768,7 @@ Z = (195, 195, 195) ................ ................ } -# tile 35 (fountain) +# tile 39 (fountain) { ....E....E...... ..EEEE..EEE..... @@ -711,7 +787,7 @@ Z = (195, 195, 195) ....AAAAAAAAA... ................ } -# tile 36 (pool) +# tile 40 (pool) { ..........NNN... .EEEE....NE.EN.. @@ -730,7 +806,7 @@ Z = (195, 195, 195) .E..EE...E..EEE. EE....EEE.....EE } -# tile 37 (ice) +# tile 41 (ice) { NNNNNNNNNNNNNNNN NNNNNNNNNNNNNNNN @@ -749,7 +825,7 @@ Z = (195, 195, 195) NNNNNNNNNNNNNNNN NNNNNNNNNNNNNNNN } -# tile 38 (molten lava) +# tile 42 (molten lava) { DDDDDDCDDDDDDDDD DDDDDCDKDDDDDDDD @@ -768,7 +844,7 @@ Z = (195, 195, 195) DDDDKKDDDDCDDDDD DDDDDDDDDDDKDDDD } -# tile 39 (vertical open drawbridge) +# tile 43 (vertical open drawbridge) { EKKAKKKKKKKAKKAE EJKKKKKKKKKKKJAA @@ -787,7 +863,7 @@ Z = (195, 195, 195) EEJJJJJJJJJJJAAA EJKKKKKKKKKKKJAA } -# tile 40 (horizontal open drawbridge) +# tile 44 (horizontal open drawbridge) { EEEEEEEEEEEEEEEE JEJKJEJKJEJKJEJK @@ -806,7 +882,7 @@ Z = (195, 195, 195) AAAAAAAAAAAAAAAA AAAEAAAEAAAEAAAE } -# tile 41 (vertical closed drawbridge) +# tile 45 (vertical closed drawbridge) { ................ ..JKJ.JKJ.JKJ... @@ -825,7 +901,7 @@ Z = (195, 195, 195) ...AAA.AAA.AAA.. ................ } -# tile 42 (horizontal closed drawbridge) +# tile 46 (horizontal closed drawbridge) { ................ ..JJJJJJJJJJJ... @@ -844,7 +920,7 @@ Z = (195, 195, 195) ...AAAAAAAAAAA.. ................ } -# tile 43 (air) +# tile 47 (air) { BBBBBBBBBBBBBBBB BBBBBBBBBBBBBBBB @@ -863,7 +939,7 @@ Z = (195, 195, 195) BBBBBBBBBBBBBBBB BBBBBBBBBBBBBBBB } -# tile 44 (cloud) +# tile 48 (cloud) { BBBBBBBBBBBBBBBB BBBBBNNNNNNNBBBB @@ -882,7 +958,7 @@ Z = (195, 195, 195) BBBBBBOOOOBBBBBB BBBBBBBBBBBBBBBB } -# tile 45 (water) +# tile 49 (water) { EEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEE @@ -901,7 +977,7 @@ Z = (195, 195, 195) EEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEE } -# tile 46 (arrow trap) +# tile 50 (arrow trap) { ................ .....DDDDD...... @@ -920,7 +996,7 @@ Z = (195, 195, 195) ......AAAAA..... ................ } -# tile 47 (dart trap) +# tile 51 (dart trap) { ................ .....DDDDD...... @@ -939,7 +1015,7 @@ Z = (195, 195, 195) ......AAAAA..... ................ } -# tile 48 (falling rock trap) +# tile 52 (falling rock trap) { ................ .....DDDDD...... @@ -958,7 +1034,7 @@ Z = (195, 195, 195) ......AAAAA..... ................ } -# tile 49 (squeaky board) +# tile 53 (squeaky board) { ................ .....DDDDD...... @@ -977,7 +1053,7 @@ Z = (195, 195, 195) ......AAAAA..... ................ } -# tile 50 (bear trap) +# tile 54 (bear trap) { ................ .....DDDDD...... @@ -996,7 +1072,7 @@ Z = (195, 195, 195) ......AAAAA..... ................ } -# tile 51 (land mine) +# tile 55 (land mine) { ................ .....DDDDD...... @@ -1015,7 +1091,7 @@ Z = (195, 195, 195) ......AAAAA..... ................ } -# tile 52 (rolling boulder trap) +# tile 56 (rolling boulder trap) { ................ .....DDDDD...... @@ -1034,7 +1110,7 @@ Z = (195, 195, 195) ......AAAAA..... ................ } -# tile 53 (sleeping gas trap) +# tile 57 (sleeping gas trap) { ................ .....DDDDD...... @@ -1053,7 +1129,7 @@ Z = (195, 195, 195) ......AAAAA..... ................ } -# tile 54 (rust trap) +# tile 58 (rust trap) { ................ .....DDDDD...... @@ -1072,7 +1148,7 @@ Z = (195, 195, 195) ......AAAAA..... ................ } -# tile 55 (fire trap) +# tile 59 (fire trap) { ................ .....DDDDD...... @@ -1091,7 +1167,7 @@ Z = (195, 195, 195) ......AAAAA..... ................ } -# tile 56 (pit) +# tile 60 (pit) { AAAAAAAAAAAAAAAA A.AAAAAAAAAAAABA @@ -1110,7 +1186,7 @@ Z = (195, 195, 195) A.PPPPPPPPPPPPPA AAAAAAAAAAAAAAAA } -# tile 57 (spiked pit) +# tile 61 (spiked pit) { AAAAAAAAAAAAAAAA A.AAAAAAAAAAAABA @@ -1129,7 +1205,7 @@ Z = (195, 195, 195) A.PPPPPPPPPPPPPA AAAAAAAAAAAAAAAA } -# tile 58 (hole) +# tile 62 (hole) { ................ ......AAAA...... @@ -1148,7 +1224,7 @@ Z = (195, 195, 195) ................ ................ } -# tile 59 (trap door) +# tile 63 (trap door) { AAAAAAAAAAAAAAAA A.AAAAAAAAAAAABA @@ -1167,7 +1243,7 @@ Z = (195, 195, 195) A.PPPPPPPPPPPPPA AAAAAAAAAAAAAAAA } -# tile 60 (teleportation trap) +# tile 64 (teleportation trap) { ................ .....DDDDD...... @@ -1186,7 +1262,7 @@ Z = (195, 195, 195) ......AAAAA..... ................ } -# tile 61 (level teleporter) +# tile 65 (level teleporter) { ................ .....DDADD...... @@ -1205,7 +1281,7 @@ Z = (195, 195, 195) ......AAAAA..... ................ } -# tile 62 (magic portal) +# tile 66 (magic portal) { ................ .....DDDDD...... @@ -1224,7 +1300,7 @@ Z = (195, 195, 195) ......AAAAA..... ................ } -# tile 63 (web) +# tile 67 (web) { OAOA.OA...O....O .O.NNNN.NOA..OOA @@ -1243,7 +1319,7 @@ Z = (195, 195, 195) .OA............. OA.............. } -# tile 64 (statue trap) +# tile 68 (statue trap) { ................ .....DDDDD...... @@ -1262,7 +1338,7 @@ Z = (195, 195, 195) ......AAAAA..... ................ } -# tile 65 (magic trap) +# tile 69 (magic trap) { ................ .....DDDDD...... @@ -1281,7 +1357,7 @@ Z = (195, 195, 195) ......AAAAA..... ................ } -# tile 66 (anti-magic field) +# tile 70 (anti-magic field) { ................ ......DDDDD..... @@ -1300,7 +1376,7 @@ Z = (195, 195, 195) .....AAAAA...... ................ } -# tile 67 (polymorph trap) +# tile 71 (polymorph trap) { ................ .....DDDDD...... @@ -1319,7 +1395,7 @@ Z = (195, 195, 195) ......AAAAA..... ................ } -# tile 68 (vibrating square) +# tile 72 (vibrating square) { ................ ................ @@ -1338,83 +1414,615 @@ Z = (195, 195, 195) ................ ................ } -# tile 69 (vertical beam) +# tile 73 (missile zap 1 0) { - .......NN....... - ......NN........ - .....NN......... - ......NN........ - .......NN....... - ........NN...... - .........NN..... - ........NN...... - .......NN....... - ......NN........ - .....NN......... - ......NN........ - .......NN....... - ........NN...... - .........NN..... - ........NN...... + .......II....... + ......IIII...... + ......IIII...... + .......II....... + .......II....... + ......IIII...... + ......IIII...... + .......II....... + .......II....... + ......IIII...... + ......IIII...... + .......II....... + .......II....... + ......IIII...... + ......IIII...... + .......II....... } -# tile 70 (horizontal beam) +# tile 74 (missile zap 1 1) { ................ ................ ................ ................ ................ - ..N.......N..... - .NNN.....NNN.... - NN.NN...NN.NN... - N...NN.NN...NN.N - .....NNN.....NNN - ......N.......N. + ................ + .II..II..II..II. + IIIIIIIIIIIIIIII + IIIIIIIIIIIIIIII + .II..II..II..II. + ................ ................ ................ ................ ................ ................ } -# tile 71 (left slant beam) +# tile 75 (missile zap 1 2) { - NNNNN........... - ....N........... - ....N........... - ....N........... - ....N........... - ....N........... - ....N........... - ....N........... - ....NNNNNNNNN... - ............N... - ............N... - ............N... - ............N... - ............N... - ............N... + III............. + IIII............ + IIII............ + .IIII........... + ...IIII......... + ....IIII........ + ....IIII........ + .....IIII....... + .......IIII..... + ........IIII.... + ........IIII.... + .........IIII... + ...........IIII. + ............IIII + ............IIII + .............III +} +# tile 76 (missile zap 1 3) +{ + .............III + ............IIII + ............IIII + ...........IIII. + .........IIII... + ........IIII.... + ........IIII.... + .......IIII..... + .....IIII....... + ....IIII........ + ....IIII........ + ...IIII......... + .IIII........... + IIII............ + IIII............ + III............. +} +# tile 77 (fire zap 2 0) +{ + .......CC....... + ......CCCC...... + ......CCCC...... + .......CC....... + .......CC....... + ......CCCC...... + ......CCCC...... + .......CC....... + .......CC....... + ......CCCC...... + ......CCCC...... + .......CC....... + .......CC....... + ......CCCC...... + ......CCCC...... + .......CC....... +} +# tile 78 (fire zap 2 1) +{ + ................ + ................ + ................ + ................ + ................ + ................ + .CC..CC..CC..CC. + CCCCCCCCCCCCCCCC + CCCCCCCCCCCCCCCC + .CC..CC..CC..CC. + ................ + ................ + ................ + ................ + ................ + ................ +} +# tile 79 (fire zap 2 2) +{ + CCC............. + CCCC............ + CCCC............ + .CCCC........... + ...CCCC......... + ....CCCC........ + ....CCCC........ + .....CCCC....... + .......CCCC..... + ........CCCC.... + ........CCCC.... + .........CCCC... + ...........CCCC. + ............CCCC + ............CCCC + .............CCC +} +# tile 80 (fire zap 2 3) +{ + .............CCC + ............CCCC + ............CCCC + ...........CCCC. + .........CCCC... + ........CCCC.... + ........CCCC.... + .......CCCC..... + .....CCCC....... + ....CCCC........ + ....CCCC........ + ...CCCC......... + .CCCC........... + CCCC............ + CCCC............ + CCC............. +} +# tile 81 (frost zap 3 0) +{ + .......NN....... + ......NNNN...... + ......NNNN...... + .......NN....... + .......NN....... + ......NNNN...... + ......NNNN...... + .......NN....... + .......NN....... + ......NNNN...... + ......NNNN...... + .......NN....... + .......NN....... + ......NNNN...... + ......NNNN...... + .......NN....... +} +# tile 82 (frost zap 3 1) +{ + ................ + ................ + ................ + ................ + ................ + ................ + .NN..NN..NN..NN. + NNNNNNNNNNNNNNNN + NNNNNNNNNNNNNNNN + .NN..NN..NN..NN. + ................ + ................ + ................ + ................ + ................ + ................ +} +# tile 83 (frost zap 3 2) +{ + NNN............. + NNNN............ + NNNN............ + .NNNN........... + ...NNNN......... + ....NNNN........ + ....NNNN........ + .....NNNN....... + .......NNNN..... + ........NNNN.... + ........NNNN.... + .........NNNN... + ...........NNNN. ............NNNN -} -# tile 72 (right slant beam) -{ ............NNNN - ............N... - ............N... - ............N... - ............N... - ............N... - ............N... - ....NNNNNNNNN... - ....N........... - ....N........... - ....N........... - ....N........... - ....N........... - ....N........... - ....N........... - NNNNN........... + .............NNN } -# tile 73 (dig beam) +# tile 84 (frost zap 3 3) +{ + .............NNN + ............NNNN + ............NNNN + ...........NNNN. + .........NNNN... + ........NNNN.... + ........NNNN.... + .......NNNN..... + .....NNNN....... + ....NNNN........ + ....NNNN........ + ...NNNN......... + .NNNN........... + NNNN............ + NNNN............ + NNN............. +} +# tile 85 (sleep zap 4 0) +{ + .......BB....... + ......BBBB...... + ......BBBB...... + .......BB....... + .......BB....... + ......BBBB...... + ......BBBB...... + .......BB....... + .......BB....... + ......BBBB...... + ......BBBB...... + .......BB....... + .......BB....... + ......BBBB...... + ......BBBB...... + .......BB....... +} +# tile 86 (sleep zap 4 1) +{ + ................ + ................ + ................ + ................ + ................ + ................ + .BB..BB..BB..BB. + BBBBBBBBBBBBBBBB + BBBBBBBBBBBBBBBB + .BB..BB..BB..BB. + ................ + ................ + ................ + ................ + ................ + ................ +} +# tile 87 (sleep zap 4 2) +{ + BBB............. + BBBB............ + BBBB............ + .BBBB........... + ...BBBB......... + ....BBBB........ + ....BBBB........ + .....BBBB....... + .......BBBB..... + ........BBBB.... + ........BBBB.... + .........BBBB... + ...........BBBB. + ............BBBB + ............BBBB + .............BBB +} +# tile 88 (sleep zap 4 3) +{ + .............BBB + ............BBBB + ............BBBB + ...........BBBB. + .........BBBB... + ........BBBB.... + ........BBBB.... + .......BBBB..... + .....BBBB....... + ....BBBB........ + ....BBBB........ + ...BBBB......... + .BBBB........... + BBBB............ + BBBB............ + BBB............. +} +# tile 89 (death zap 5 0) +{ + .......AA....... + ......AAAA...... + ......AAAA...... + .......AA....... + .......AA....... + ......AAAA...... + ......AAAA...... + .......AA....... + .......AA....... + ......AAAA...... + ......AAAA...... + .......AA....... + .......AA....... + ......AAAA...... + ......AAAA...... + .......AA....... +} +# tile 90 (death zap 5 1) +{ + ................ + ................ + ................ + ................ + ................ + ................ + .AA..AA..AA..AA. + AAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAA + .AA..AA..AA..AA. + ................ + ................ + ................ + ................ + ................ + ................ +} +# tile 91 (death zap 5 2) +{ + AAA............. + AAAA............ + AAAA............ + .AAAA........... + ...AAAA......... + ....AAAA........ + ....AAAA........ + .....AAAA....... + .......AAAA..... + ........AAAA.... + ........AAAA.... + .........AAAA... + ...........AAAA. + ............AAAA + ............AAAA + .............AAA +} +# tile 92 (death zap 5 3) +{ + .............AAA + ............AAAA + ............AAAA + ...........AAAA. + .........AAAA... + ........AAAA.... + ........AAAA.... + .......AAAA..... + .....AAAA....... + ....AAAA........ + ....AAAA........ + ...AAAA......... + .AAAA........... + AAAA............ + AAAA............ + AAA............. +} +# tile 93 (lightning zap 6 0) +{ + .......NN....... + ......NNNN...... + ......NNNN...... + .......NN....... + .......NN....... + ......NNNN...... + ......NNNN...... + .......NN....... + .......NN....... + ......NNNN...... + ......NNNN...... + .......NN....... + .......NN....... + ......NNNN...... + ......NNNN...... + .......NN....... +} +# tile 94 (lightning zap 6 1) +{ + ................ + ................ + ................ + ................ + ................ + ................ + .NN..NN..NN..NN. + NNNNNNNNNNNNNNNN + NNNNNNNNNNNNNNNN + .NN..NN..NN..NN. + ................ + ................ + ................ + ................ + ................ + ................ +} +# tile 95 (lightning zap 6 2) +{ + NNN............. + NNNN............ + NNNN............ + .NNNN........... + ...NNNN......... + ....NNNN........ + ....NNNN........ + .....NNNN....... + .......NNNN..... + ........NNNN.... + ........NNNN.... + .........NNNN... + ...........NNNN. + ............NNNN + ............NNNN + .............NNN +} +# tile 96 (lightning zap 6 3) +{ + .............NNN + ............NNNN + ............NNNN + ...........NNNN. + .........NNNN... + ........NNNN.... + ........NNNN.... + .......NNNN..... + .....NNNN....... + ....NNNN........ + ....NNNN........ + ...NNNN......... + .NNNN........... + NNNN............ + NNNN............ + NNN............. +} +# tile 97 (poison gas zap 7 0) +{ + .......FF....... + ......FFFF...... + ......FFFF...... + .......FF....... + .......FF....... + ......FFFF...... + ......FFFF...... + .......FF....... + .......FF....... + ......FFFF...... + ......FFFF...... + .......FF....... + .......FF....... + ......FFFF...... + ......FFFF...... + .......FF....... +} +# tile 98 (poison gas zap 7 1) +{ + ................ + ................ + ................ + ................ + ................ + ................ + .FF..FF..FF..FF. + FFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFF + .FF..FF..FF..FF. + ................ + ................ + ................ + ................ + ................ + ................ +} +# tile 99 (poison gas zap 7 2) +{ + FFF............. + FFFF............ + FFFF............ + .FFFF........... + ...FFFF......... + ....FFFF........ + ....FFFF........ + .....FFFF....... + .......FFFF..... + ........FFFF.... + ........FFFF.... + .........FFFF... + ...........FFFF. + ............FFFF + ............FFFF + .............FFF +} +# tile 100 (poison gas zap 7 3) +{ + .............FFF + ............FFFF + ............FFFF + ...........FFFF. + .........FFFF... + ........FFFF.... + ........FFFF.... + .......FFFF..... + .....FFFF....... + ....FFFF........ + ....FFFF........ + ...FFFF......... + .FFFF........... + FFFF............ + FFFF............ + FFF............. +} +# tile 101 (acid zap 8 0) +{ + .......GG....... + ......GGGG...... + ......GGGG...... + .......GG....... + .......GG....... + ......GGGG...... + ......GGGG...... + .......GG....... + .......GG....... + ......GGGG...... + ......GGGG...... + .......GG....... + .......GG....... + ......GGGG...... + ......GGGG...... + .......GG....... +} +# tile 102 (acid zap 8 1) +{ + ................ + ................ + ................ + ................ + ................ + ................ + .GG..GG..GG..GG. + GGGGGGGGGGGGGGGG + GGGGGGGGGGGGGGGG + .GG..GG..GG..GG. + ................ + ................ + ................ + ................ + ................ + ................ +} +# tile 103 (acid zap 8 2) +{ + GGG............. + GGGG............ + GGGG............ + .GGGG........... + ...GGGG......... + ....GGGG........ + ....GGGG........ + .....GGGG....... + .......GGGG..... + ........GGGG.... + ........GGGG.... + .........GGGG... + ...........GGGG. + ............GGGG + ............GGGG + .............GGG +} +# tile 104 (acid zap 8 3) +{ + .............GGG + ............GGGG + ............GGGG + ...........GGGG. + .........GGGG... + ........GGGG.... + ........GGGG.... + .......GGGG..... + .....GGGG....... + ....GGGG........ + ....GGGG........ + ...GGGG......... + .GGGG........... + GGGG............ + GGGG............ + GGG............. +} +# tile 105 (dig beam) { ....AAAA........ ..A....AA..AA... @@ -1433,7 +2041,7 @@ Z = (195, 195, 195) ....AA....AAA... ................ } -# tile 74 (flash beam) +# tile 106 (flash beam) { ................ .....NNNNNN..... @@ -1452,7 +2060,7 @@ Z = (195, 195, 195) .....NNNNNN..... ................ } -# tile 75 (boom left) +# tile 107 (boom left) { ................ ................ @@ -1471,7 +2079,7 @@ Z = (195, 195, 195) ................ ................ } -# tile 76 (boom right) +# tile 108 (boom right) { ................ ................ @@ -1490,7 +2098,7 @@ Z = (195, 195, 195) ................ ................ } -# tile 77 (shield1) +# tile 109 (shield1) { ................ .....I....I..... @@ -1509,7 +2117,7 @@ Z = (195, 195, 195) .....I....I..... ................ } -# tile 78 (shield2) +# tile 110 (shield2) { ................ .CCCCCCCCCCCCCCC @@ -1528,7 +2136,7 @@ Z = (195, 195, 195) .CCCCCCCCCCCCCC. ................ } -# tile 79 (shield3) +# tile 111 (shield3) { .......HH....... .......HH....... @@ -1547,7 +2155,7 @@ Z = (195, 195, 195) .......HH....... .......HH....... } -# tile 80 (shield4) +# tile 112 (shield4) { ................ ......NNNNN..... @@ -1566,7 +2174,7 @@ Z = (195, 195, 195) .....NNNNN...... ................ } -# tile 81 (poison cloud) +# tile 113 (poison cloud) { BBBBBBBBBBBBBBBB BBBBBFFFFFFFBBBB @@ -1585,7 +2193,7 @@ Z = (195, 195, 195) BBBBBBGGGGBBBBBB BBBBBBBBBBBBBBBB } -# tile 82 (valid position) +# tile 114 (valid position) { ................ ................ @@ -1604,7 +2212,7 @@ Z = (195, 195, 195) .......FF....... ................ } -# tile 83 (swallow top left) +# tile 115 (swallow top left) { AAAAAAADDDDDDAAA AAAAADDDDDDDDDDD @@ -1623,7 +2231,7 @@ Z = (195, 195, 195) AAAADDDDDD...... AAAADDDDDD...... } -# tile 84 (swallow top center) +# tile 116 (swallow top center) { AAAAAAAAAAAAAAAA DDAAAAAAAAAAAAAA @@ -1642,7 +2250,7 @@ Z = (195, 195, 195) ................ ................ } -# tile 85 (swallow top right) +# tile 117 (swallow top right) { AAAAAAAAAAAAAAAA AAADDDDDAAAAAAAA @@ -1661,7 +2269,7 @@ Z = (195, 195, 195) ....DDDDDDDDDDDD ....DDDDDDDDDDDA } -# tile 86 (swallow middle left) +# tile 118 (swallow middle left) { AAAADDDDDD...... AAAADDDDDDD..... @@ -1680,7 +2288,7 @@ Z = (195, 195, 195) DDDDDDD......... DDCCDDD......... } -# tile 87 (swallow middle right) +# tile 119 (swallow middle right) { ....DDDDDDDDDDDA ....DDDDDDDDDDDA @@ -1699,7 +2307,7 @@ Z = (195, 195, 195) ......DDDDDDDDAA .......DDDDDDDAA } -# tile 88 (swallow bottom left) +# tile 120 (swallow bottom left) { DDDCDDD......... DDDCDDD......... @@ -1718,7 +2326,7 @@ Z = (195, 195, 195) AAAAAAAAAAAADDDD AAAAAAAAAAAAAADD } -# tile 89 (swallow bottom center) +# tile 121 (swallow bottom center) { ................ ................ @@ -1737,7 +2345,7 @@ Z = (195, 195, 195) DDDDDDDDDDDDDDDD DDDDDDDDDDDDDDAA } -# tile 90 (swallow bottom right) +# tile 122 (swallow bottom right) { ......DDDDDDDDAA ......DDDDDDDDDA @@ -1756,7 +2364,7 @@ Z = (195, 195, 195) DDAAAAAAAAAAAAAA AAAAAAAAAAAAAAAA } -# tile 91 (explosion top left) +# tile 123 (explosion dark top left) { ................ ................ @@ -1775,7 +2383,7 @@ Z = (195, 195, 195) ..AAAA..AAAA.... ..AAA..AAAAA.... } -# tile 92 (explosion top center) +# tile 124 (explosion dark top center) { ................ ................ @@ -1794,7 +2402,7 @@ Z = (195, 195, 195) ........A.A.APAA .PA...APAAAAAAAA } -# tile 93 (explosion top right) +# tile 125 (explosion dark top right) { ................ ................ @@ -1813,7 +2421,7 @@ Z = (195, 195, 195) AA.A..A.AAAA.... A.AA..A.AAAAA... } -# tile 94 (explosion middle left) +# tile 126 (explosion dark middle left) { ..AAA.A.AAA..... ..AAA.AAAAA.AP.. @@ -1832,7 +2440,7 @@ Z = (195, 195, 195) ..A.A...AAP...PA ....A.........PA } -# tile 95 (explosion middle center) +# tile 127 (explosion dark middle center) { APAAA..PPAPAAAAA .APA..A.AAAPAAA. @@ -1851,7 +2459,7 @@ Z = (195, 195, 195) AAAAAAAAAAAAA.AA AAAAAAAAAAA.HH.. } -# tile 96 (explosion middle right) +# tile 128 (explosion dark middle right) { ..AAA.A.A.AAAA.. ..AAAAA.A.AAAA.. @@ -1870,7 +2478,7 @@ Z = (195, 195, 195) AAA...AAAAAAA... ....PPAAAAAAAA.. } -# tile 97 (explosion bottom left) +# tile 129 (explosion dark bottom left) { ....A.......A..P ....A.......AA.. @@ -1889,7 +2497,7 @@ Z = (195, 195, 195) ................ ................ } -# tile 98 (explosion bottom center) +# tile 130 (explosion dark bottom center) { PPPAAAAAPAAA.A.. AAPPAAPPPPA.A... @@ -1908,7 +2516,7 @@ Z = (195, 195, 195) ................ ................ } -# tile 99 (explosion bottom right) +# tile 131 (explosion dark bottom right) { ....P..AAAAAAA.. ..A..A.AA.A.AA.. @@ -1927,7 +2535,7 @@ Z = (195, 195, 195) ................ ................ } -# tile 100 (explosion noxious 0) +# tile 132 (explosion noxious top left) { ................ ................ @@ -1946,7 +2554,7 @@ Z = (195, 195, 195) ..FFFF..FFFF.... ..FFF..FFFFF.... } -# tile 101 (explosion noxious 1) +# tile 133 (explosion noxious top center) { ................ ................ @@ -1965,7 +2573,7 @@ Z = (195, 195, 195) ........F.F.FGFF .GH...HGHHFFFFFF } -# tile 102 (explosion noxious 2) +# tile 134 (explosion noxious top right) { ................ ................ @@ -1984,7 +2592,7 @@ Z = (195, 195, 195) FF.F..F.FFFF.... F.FF..F.FFFFF... } -# tile 103 (explosion noxious 3) +# tile 135 (explosion noxious middle left) { ..FFF.F.FFF..... ..FFF.FFFFF.FG.. @@ -2003,7 +2611,7 @@ Z = (195, 195, 195) ..F.F...FHG...GH ....F.........GH } -# tile 104 (explosion noxious 4) +# tile 136 (explosion noxious middle center) { FGHFF..GGFGHFFFF .HGH..F.FFHGFHF. @@ -2022,7 +2630,7 @@ Z = (195, 195, 195) HHHHNHNHN.GGG.GF GGGGNHHHGGG.HH.. } -# tile 105 (explosion noxious 5) +# tile 137 (explosion noxious middle right) { ..FFF.F.F.FFFF.. ..FFFFF.F.FFFF.. @@ -2041,7 +2649,7 @@ Z = (195, 195, 195) HFH...FFFFFFF... ....GGFFFFFFFF.. } -# tile 106 (explosion noxious 6) +# tile 138 (explosion noxious bottom left) { ....F.......H..G ....F.......FH.. @@ -2060,7 +2668,7 @@ Z = (195, 195, 195) ................ ................ } -# tile 107 (explosion noxious 7) +# tile 139 (explosion noxious bottom center) { GGGHHHHHGHHH.H.. HHGGHHGGGGH.F... @@ -2079,7 +2687,7 @@ Z = (195, 195, 195) ................ ................ } -# tile 108 (explosion noxious 8) +# tile 140 (explosion noxious bottom right) { ....G..FFFFFFF.. ..F..F.FF.F.FF.. @@ -2098,7 +2706,7 @@ Z = (195, 195, 195) ................ ................ } -# tile 109 (explosion muddy 0) +# tile 141 (explosion muddy top left) { ................ ................ @@ -2117,7 +2725,7 @@ Z = (195, 195, 195) ..JJJJKKJJJJKKKK ..JJJKKJJJJJKKKK } -# tile 110 (explosion muddy 1) +# tile 142 (explosion muddy top center) { ................ ................ @@ -2136,7 +2744,7 @@ Z = (195, 195, 195) KKKKKKKKJKJKJCJJ KCLKKKLCLLJJJJJJ } -# tile 111 (explosion muddy 2) +# tile 143 (explosion muddy top right) { ................ ................ @@ -2155,7 +2763,7 @@ Z = (195, 195, 195) JJKJKKJKJJJJ.... JKJJKKJKJJJJJ... } -# tile 112 (explosion muddy 3) +# tile 144 (explosion muddy middle left) { ..JJJKJKJJJKKKKK ..JJJKJJJJJKJCKK @@ -2174,7 +2782,7 @@ Z = (195, 195, 195) ..J.JKKKJLCKKKCL ....JKKKKKKKKKCL } -# tile 113 (explosion muddy 4) +# tile 145 (explosion muddy middle center) { JCLJJKKCCJCLJJJJ KLCLKKJKJJLCJLJK @@ -2193,7 +2801,7 @@ Z = (195, 195, 195) LLLLCLCLCKCCCKCJ CCCCCLLLCCCKLLKK } -# tile 114 (explosion muddy 5) +# tile 146 (explosion muddy middle right) { KKJJJKJKJKJJJJ.. KKJJJJJKJKJJJJ.. @@ -2212,7 +2820,7 @@ Z = (195, 195, 195) LJLKKKJJJJJJJ... KKKKCCJJJJJJJJ.. } -# tile 115 (explosion muddy 6) +# tile 147 (explosion muddy bottom left) { ....JKKKKKKKLKKC ....JKKKKKKKJLKK @@ -2231,7 +2839,7 @@ Z = (195, 195, 195) ................ ................ } -# tile 116 (explosion muddy 7) +# tile 148 (explosion muddy bottom center) { CCCLLLLLCLLLKLKK LLCCLLCCCCLKJKKK @@ -2250,7 +2858,7 @@ Z = (195, 195, 195) ................ ................ } -# tile 117 (explosion muddy 8) +# tile 149 (explosion muddy bottom right) { KKKKCKKJJJJJJJ.. KKJKKJKJJKJKJJ.. @@ -2269,7 +2877,7 @@ Z = (195, 195, 195) ................ ................ } -# tile 118 (explosion wet 0) +# tile 150 (explosion wet top left) { ................ ................ @@ -2288,7 +2896,7 @@ Z = (195, 195, 195) ..EEEEPPEEEEPPPP ..EEEPPEEEEEPPPP } -# tile 119 (explosion wet 1) +# tile 151 (explosion wet top center) { ................ ................ @@ -2307,7 +2915,7 @@ Z = (195, 195, 195) PPPPPPPPEPEPEBEE PBNPPPNBEEEEEEEE } -# tile 120 (explosion wet 2) +# tile 152 (explosion wet top right) { ................ ................ @@ -2326,7 +2934,7 @@ Z = (195, 195, 195) EEPEPPEPEEEE.... EPEEPPEPEEEEE... } -# tile 121 (explosion wet 3) +# tile 153 (explosion wet middle left) { ..EEEPEPEEEPPPPP ..EEEPEEEEEPEBPP @@ -2345,7 +2953,7 @@ Z = (195, 195, 195) ..E.EPPPENBPPPBE ....EPPPPPPPPPBE } -# tile 122 (explosion wet 4) +# tile 154 (explosion wet middle center) { EBNEEPPBBEBNEEEE PNBNPPEPEEEBENEP @@ -2364,7 +2972,7 @@ Z = (195, 195, 195) EEEEEEEEEPBBBPBE BBBBEEEEBBBPNNPP } -# tile 123 (explosion wet 5) +# tile 155 (explosion wet middle right) { PPEEEPEPEPEEEE.. PPEEEEEPEPEEEE.. @@ -2383,7 +2991,7 @@ Z = (195, 195, 195) NENPPPEEEEEEE... PPPPBBEEEEEEEE.. } -# tile 124 (explosion wet 6) +# tile 156 (explosion wet bottom left) { ....EPPPPPPPNPPB ....EPPPPPPPENPP @@ -2402,7 +3010,7 @@ Z = (195, 195, 195) ................ ................ } -# tile 125 (explosion wet 7) +# tile 157 (explosion wet bottom center) { BBBEEEEEBEEEPEPP EEBBEEBBBBEPEPPP @@ -2421,7 +3029,7 @@ Z = (195, 195, 195) ................ ................ } -# tile 126 (explosion wet 8) +# tile 158 (explosion wet bottom right) { PPPPBPPEEEEEEE.. PPEPPEPEEPEPEE.. @@ -2440,7 +3048,7 @@ Z = (195, 195, 195) ................ ................ } -# tile 127 (explosion magical 0) +# tile 159 (explosion magical top left) { ................ ................ @@ -2459,7 +3067,7 @@ Z = (195, 195, 195) ..EEEEIIEEEEIIII ..EEEIIEEEEEIIII } -# tile 128 (explosion magical 1) +# tile 160 (explosion magical top center) { ................ ................ @@ -2478,7 +3086,7 @@ Z = (195, 195, 195) IIIIIIIIEIEIELEE ILHIIIHLHHEEEEEE } -# tile 129 (explosion magical 2) +# tile 161 (explosion magical top right) { ................ ................ @@ -2497,7 +3105,7 @@ Z = (195, 195, 195) EEIEIIEIEEEE.... EIEEIIEIEEEEE... } -# tile 130 (explosion magical 3) +# tile 162 (explosion magical middle left) { ..EEEIEIEEEIIIII ..EEEIEEEEEIEIII @@ -2516,7 +3124,7 @@ Z = (195, 195, 195) ..E.EIIIENIIIIIN ....EIIIIIIIIIIN } -# tile 131 (explosion magical 4) +# tile 163 (explosion magical middle center) { EINEEIIIIEINEEEE ININIIEIEENIENEI @@ -2535,7 +3143,7 @@ Z = (195, 195, 195) NNNNNNNNNIIIIIIE IIIINNNNIIIINNII } -# tile 132 (explosion magical 5) +# tile 164 (explosion magical middle right) { IIEEEIEIEIEEEE.. IIEEEEEIEIEEEE.. @@ -2554,7 +3162,7 @@ Z = (195, 195, 195) NENIIIEEEEEEE... IIIIIIEEEEEEEE.. } -# tile 133 (explosion magical 6) +# tile 165 (explosion magical bottom left) { ....EIIIIIIIHIII ....EIIIIIIIEHII @@ -2573,7 +3181,7 @@ Z = (195, 195, 195) ................ ................ } -# tile 134 (explosion magical 7) +# tile 166 (explosion magical bottom center) { IIINNNNNINNNINII NNIINNIIIINIEIII @@ -2592,7 +3200,7 @@ Z = (195, 195, 195) ................ ................ } -# tile 135 (explosion magical 8) +# tile 167 (explosion magical bottom right) { IIIIIIIEEEEEEE.. IIEIIEIEEIEIEE.. @@ -2611,7 +3219,7 @@ Z = (195, 195, 195) ................ ................ } -# tile 136 (explosion fiery 0) +# tile 168 (explosion fiery top left) { ................ ................ @@ -2630,7 +3238,7 @@ Z = (195, 195, 195) ..DDDDCCDDDDCCCC ..DDDCCDDDDDCCCC } -# tile 137 (explosion fiery 1) +# tile 169 (explosion fiery top center) { ................ ................ @@ -2649,7 +3257,7 @@ Z = (195, 195, 195) CCCCCCCCDCDCDLDD CLHCCCHLHHDDDDDD } -# tile 138 (explosion fiery 2) +# tile 170 (explosion fiery top right) { ................ ................ @@ -2668,7 +3276,7 @@ Z = (195, 195, 195) DDCDCCDCDDDD.... DCDDCCDCDDDDD... } -# tile 139 (explosion fiery 3) +# tile 171 (explosion fiery middle left) { ..DDDCDCDDDCCCCC ..DDDCDDDDDCDLCC @@ -2687,7 +3295,7 @@ Z = (195, 195, 195) ..D.DCCCDHLCCCLH ....DCCCCCCCCCLH } -# tile 140 (explosion fiery 4) +# tile 172 (explosion fiery middle center) { DLHDDCCLLDLHDDDD CHLHCCDCDDHLDHDC @@ -2706,7 +3314,7 @@ Z = (195, 195, 195) HHHHNHNHNCLLLCLD LLLLNHHHLLLCHHCC } -# tile 141 (explosion fiery 5) +# tile 173 (explosion fiery middle right) { CCDDDCDCDCDDDD.. CCDDDDDCDCDDDD.. @@ -2725,7 +3333,7 @@ Z = (195, 195, 195) HDHCCCDDDDDDD... CCCCLLDDDDDDDD.. } -# tile 142 (explosion fiery 6) +# tile 174 (explosion fiery bottom left) { ....DCCCCCCCHCCL ....DCCCCCCCDHCC @@ -2744,7 +3352,7 @@ Z = (195, 195, 195) ................ ................ } -# tile 143 (explosion fiery 7) +# tile 175 (explosion fiery bottom center) { LLLHHHHHLHHHCHCC HHLLHHLLLLHCDCCC @@ -2763,7 +3371,7 @@ Z = (195, 195, 195) ................ ................ } -# tile 144 (explosion fiery 8) +# tile 176 (explosion fiery bottom right) { CCCCLCCDDDDDDD.. CCDCCDCDDCDCDD.. @@ -2782,7 +3390,7 @@ Z = (195, 195, 195) ................ ................ } -# tile 145 (explosion frosty 0) +# tile 177 (explosion frosty top left) { ................ ................ @@ -2801,7 +3409,7 @@ Z = (195, 195, 195) ..EEEEPPNBEEPPPP ..EEEPPEEEEEPPPP } -# tile 146 (explosion frosty 1) +# tile 178 (explosion frosty top center) { ................ ................ @@ -2820,7 +3428,7 @@ Z = (195, 195, 195) PPPPPPPPEPEPEBEE PBNPPPNBNNEEEEEE } -# tile 147 (explosion frosty 2) +# tile 179 (explosion frosty top right) { ................ ................ @@ -2839,7 +3447,7 @@ Z = (195, 195, 195) EEPEPPEPEEEE.... EPEEPPEPEEEEE... } -# tile 148 (explosion frosty 3) +# tile 180 (explosion frosty middle left) { ..EEEPEPEEEPPPPP ..EEEPEEEEEPEBPP @@ -2858,7 +3466,7 @@ Z = (195, 195, 195) ..E.EPPPENBPPPBN ....EPPPPPPPPPBN } -# tile 149 (explosion frosty 4) +# tile 181 (explosion frosty middle center) { EBNEEPPBBEBNEEEE PNBNPPEPEENBENEP @@ -2877,7 +3485,7 @@ Z = (195, 195, 195) NNNNNNNNNPBBBPBE BBBBNNNNBBBPNNPP } -# tile 150 (explosion frosty 5) +# tile 182 (explosion frosty middle right) { PPEEEPEPEPEEEE.. PPEEEEEPEPEEEE.. @@ -2896,7 +3504,7 @@ Z = (195, 195, 195) NENPPPEEEEEEE... PPPPBBEEEEEEEE.. } -# tile 151 (explosion frosty 6) +# tile 183 (explosion frosty bottom left) { ....EPPPPPPPNPPB ....EPPPPPPPENPP @@ -2915,7 +3523,7 @@ Z = (195, 195, 195) ................ ................ } -# tile 152 (explosion frosty 7) +# tile 184 (explosion frosty bottom center) { BBBNNNNNBNNNPNPP NNBBNNBBBBNPEPPP @@ -2934,7 +3542,7 @@ Z = (195, 195, 195) ................ ................ } -# tile 153 (explosion frosty 8) +# tile 185 (explosion frosty bottom right) { PPPPBPPEEEEEEE.. PPEPPEPEEPEPEE.. @@ -2953,614 +3561,6 @@ Z = (195, 195, 195) ...........N.... ................ } -# tile 154 (zap 0 0) -{ - .......II....... - ......IIII...... - ......IIII...... - .......II....... - .......II....... - ......IIII...... - ......IIII...... - .......II....... - .......II....... - ......IIII...... - ......IIII...... - .......II....... - .......II....... - ......IIII...... - ......IIII...... - .......II....... -} -# tile 155 (zap 0 1) -{ - ................ - ................ - ................ - ................ - ................ - ................ - .II..II..II..II. - IIIIIIIIIIIIIIII - IIIIIIIIIIIIIIII - .II..II..II..II. - ................ - ................ - ................ - ................ - ................ - ................ -} -# tile 156 (zap 0 2) -{ - III............. - IIII............ - IIII............ - .IIII........... - ...IIII......... - ....IIII........ - ....IIII........ - .....IIII....... - .......IIII..... - ........IIII.... - ........IIII.... - .........IIII... - ...........IIII. - ............IIII - ............IIII - .............III -} -# tile 157 (zap 0 3) -{ - .............III - ............IIII - ............IIII - ...........IIII. - .........IIII... - ........IIII.... - ........IIII.... - .......IIII..... - .....IIII....... - ....IIII........ - ....IIII........ - ...IIII......... - .IIII........... - IIII............ - IIII............ - III............. -} -# tile 158 (zap 1 0) -{ - .......CC....... - ......CCCC...... - ......CCCC...... - .......CC....... - .......CC....... - ......CCCC...... - ......CCCC...... - .......CC....... - .......CC....... - ......CCCC...... - ......CCCC...... - .......CC....... - .......CC....... - ......CCCC...... - ......CCCC...... - .......CC....... -} -# tile 159 (zap 1 1) -{ - ................ - ................ - ................ - ................ - ................ - ................ - .CC..CC..CC..CC. - CCCCCCCCCCCCCCCC - CCCCCCCCCCCCCCCC - .CC..CC..CC..CC. - ................ - ................ - ................ - ................ - ................ - ................ -} -# tile 160 (zap 1 2) -{ - CCC............. - CCCC............ - CCCC............ - .CCCC........... - ...CCCC......... - ....CCCC........ - ....CCCC........ - .....CCCC....... - .......CCCC..... - ........CCCC.... - ........CCCC.... - .........CCCC... - ...........CCCC. - ............CCCC - ............CCCC - .............CCC -} -# tile 161 (zap 1 3) -{ - .............CCC - ............CCCC - ............CCCC - ...........CCCC. - .........CCCC... - ........CCCC.... - ........CCCC.... - .......CCCC..... - .....CCCC....... - ....CCCC........ - ....CCCC........ - ...CCCC......... - .CCCC........... - CCCC............ - CCCC............ - CCC............. -} -# tile 162 (zap 2 0) -{ - .......NN....... - ......NNNN...... - ......NNNN...... - .......NN....... - .......NN....... - ......NNNN...... - ......NNNN...... - .......NN....... - .......NN....... - ......NNNN...... - ......NNNN...... - .......NN....... - .......NN....... - ......NNNN...... - ......NNNN...... - .......NN....... -} -# tile 163 (zap 2 1) -{ - ................ - ................ - ................ - ................ - ................ - ................ - .NN..NN..NN..NN. - NNNNNNNNNNNNNNNN - NNNNNNNNNNNNNNNN - .NN..NN..NN..NN. - ................ - ................ - ................ - ................ - ................ - ................ -} -# tile 164 (zap 2 2) -{ - NNN............. - NNNN............ - NNNN............ - .NNNN........... - ...NNNN......... - ....NNNN........ - ....NNNN........ - .....NNNN....... - .......NNNN..... - ........NNNN.... - ........NNNN.... - .........NNNN... - ...........NNNN. - ............NNNN - ............NNNN - .............NNN -} -# tile 165 (zap 2 3) -{ - .............NNN - ............NNNN - ............NNNN - ...........NNNN. - .........NNNN... - ........NNNN.... - ........NNNN.... - .......NNNN..... - .....NNNN....... - ....NNNN........ - ....NNNN........ - ...NNNN......... - .NNNN........... - NNNN............ - NNNN............ - NNN............. -} -# tile 166 (zap 3 0) -{ - .......BB....... - ......BBBB...... - ......BBBB...... - .......BB....... - .......BB....... - ......BBBB...... - ......BBBB...... - .......BB....... - .......BB....... - ......BBBB...... - ......BBBB...... - .......BB....... - .......BB....... - ......BBBB...... - ......BBBB...... - .......BB....... -} -# tile 167 (zap 3 1) -{ - ................ - ................ - ................ - ................ - ................ - ................ - .BB..BB..BB..BB. - BBBBBBBBBBBBBBBB - BBBBBBBBBBBBBBBB - .BB..BB..BB..BB. - ................ - ................ - ................ - ................ - ................ - ................ -} -# tile 168 (zap 3 2) -{ - BBB............. - BBBB............ - BBBB............ - .BBBB........... - ...BBBB......... - ....BBBB........ - ....BBBB........ - .....BBBB....... - .......BBBB..... - ........BBBB.... - ........BBBB.... - .........BBBB... - ...........BBBB. - ............BBBB - ............BBBB - .............BBB -} -# tile 169 (zap 3 3) -{ - .............BBB - ............BBBB - ............BBBB - ...........BBBB. - .........BBBB... - ........BBBB.... - ........BBBB.... - .......BBBB..... - .....BBBB....... - ....BBBB........ - ....BBBB........ - ...BBBB......... - .BBBB........... - BBBB............ - BBBB............ - BBB............. -} -# tile 170 (zap 4 0) -{ - .......AA....... - ......AAAA...... - ......AAAA...... - .......AA....... - .......AA....... - ......AAAA...... - ......AAAA...... - .......AA....... - .......AA....... - ......AAAA...... - ......AAAA...... - .......AA....... - .......AA....... - ......AAAA...... - ......AAAA...... - .......AA....... -} -# tile 171 (zap 4 1) -{ - ................ - ................ - ................ - ................ - ................ - ................ - .AA..AA..AA..AA. - AAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAA - .AA..AA..AA..AA. - ................ - ................ - ................ - ................ - ................ - ................ -} -# tile 172 (zap 4 2) -{ - AAA............. - AAAA............ - AAAA............ - .AAAA........... - ...AAAA......... - ....AAAA........ - ....AAAA........ - .....AAAA....... - .......AAAA..... - ........AAAA.... - ........AAAA.... - .........AAAA... - ...........AAAA. - ............AAAA - ............AAAA - .............AAA -} -# tile 173 (zap 4 3) -{ - .............AAA - ............AAAA - ............AAAA - ...........AAAA. - .........AAAA... - ........AAAA.... - ........AAAA.... - .......AAAA..... - .....AAAA....... - ....AAAA........ - ....AAAA........ - ...AAAA......... - .AAAA........... - AAAA............ - AAAA............ - AAA............. -} -# tile 174 (zap 5 0) -{ - .......NN....... - ......NNNN...... - ......NNNN...... - .......NN....... - .......NN....... - ......NNNN...... - ......NNNN...... - .......NN....... - .......NN....... - ......NNNN...... - ......NNNN...... - .......NN....... - .......NN....... - ......NNNN...... - ......NNNN...... - .......NN....... -} -# tile 175 (zap 5 1) -{ - ................ - ................ - ................ - ................ - ................ - ................ - .NN..NN..NN..NN. - NNNNNNNNNNNNNNNN - NNNNNNNNNNNNNNNN - .NN..NN..NN..NN. - ................ - ................ - ................ - ................ - ................ - ................ -} -# tile 176 (zap 5 2) -{ - NNN............. - NNNN............ - NNNN............ - .NNNN........... - ...NNNN......... - ....NNNN........ - ....NNNN........ - .....NNNN....... - .......NNNN..... - ........NNNN.... - ........NNNN.... - .........NNNN... - ...........NNNN. - ............NNNN - ............NNNN - .............NNN -} -# tile 177 (zap 5 3) -{ - .............NNN - ............NNNN - ............NNNN - ...........NNNN. - .........NNNN... - ........NNNN.... - ........NNNN.... - .......NNNN..... - .....NNNN....... - ....NNNN........ - ....NNNN........ - ...NNNN......... - .NNNN........... - NNNN............ - NNNN............ - NNN............. -} -# tile 178 (zap 6 0) -{ - .......FF....... - ......FFFF...... - ......FFFF...... - .......FF....... - .......FF....... - ......FFFF...... - ......FFFF...... - .......FF....... - .......FF....... - ......FFFF...... - ......FFFF...... - .......FF....... - .......FF....... - ......FFFF...... - ......FFFF...... - .......FF....... -} -# tile 179 (zap 6 1) -{ - ................ - ................ - ................ - ................ - ................ - ................ - .FF..FF..FF..FF. - FFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFF - .FF..FF..FF..FF. - ................ - ................ - ................ - ................ - ................ - ................ -} -# tile 180 (zap 6 2) -{ - FFF............. - FFFF............ - FFFF............ - .FFFF........... - ...FFFF......... - ....FFFF........ - ....FFFF........ - .....FFFF....... - .......FFFF..... - ........FFFF.... - ........FFFF.... - .........FFFF... - ...........FFFF. - ............FFFF - ............FFFF - .............FFF -} -# tile 181 (zap 6 3) -{ - .............FFF - ............FFFF - ............FFFF - ...........FFFF. - .........FFFF... - ........FFFF.... - ........FFFF.... - .......FFFF..... - .....FFFF....... - ....FFFF........ - ....FFFF........ - ...FFFF......... - .FFFF........... - FFFF............ - FFFF............ - FFF............. -} -# tile 182 (zap 7 0) -{ - .......GG....... - ......GGGG...... - ......GGGG...... - .......GG....... - .......GG....... - ......GGGG...... - ......GGGG...... - .......GG....... - .......GG....... - ......GGGG...... - ......GGGG...... - .......GG....... - .......GG....... - ......GGGG...... - ......GGGG...... - .......GG....... -} -# tile 183 (zap 7 1) -{ - ................ - ................ - ................ - ................ - ................ - ................ - .GG..GG..GG..GG. - GGGGGGGGGGGGGGGG - GGGGGGGGGGGGGGGG - .GG..GG..GG..GG. - ................ - ................ - ................ - ................ - ................ - ................ -} -# tile 184 (zap 7 2) -{ - GGG............. - GGGG............ - GGGG............ - .GGGG........... - ...GGGG......... - ....GGGG........ - ....GGGG........ - .....GGGG....... - .......GGGG..... - ........GGGG.... - ........GGGG.... - .........GGGG... - ...........GGGG. - ............GGGG - ............GGGG - .............GGG -} -# tile 185 (zap 7 3) -{ - .............GGG - ............GGGG - ............GGGG - ...........GGGG. - .........GGGG... - ........GGGG.... - ........GGGG.... - .......GGGG..... - .....GGGG....... - ....GGGG........ - ....GGGG........ - ...GGGG......... - .GGGG........... - GGGG............ - GGGG............ - GGG............. -} # tile 186 (warning 0) { ................ @@ -3713,7 +3713,7 @@ Z = (195, 195, 195) AAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAA } -# tile 194 (sub mine walls 0) +# tile 194 (mines walls vertical) { AJJKKKACJAAJJJAA AJKKKACLJJAJJJJA @@ -3732,7 +3732,7 @@ Z = (195, 195, 195) AAJACKCKKJJJAJAA AAJCKKJAAAJJJJJA } -# tile 195 (sub mine walls 1) +# tile 195 (mines walls horizontal) { AJAAAAAAJJAAAJAA JJJAAAJJJJJAAAAJ @@ -3751,7 +3751,7 @@ Z = (195, 195, 195) JJJJJJJJJJJJJJJJ AAAAAAAAAAAAAAAA } -# tile 196 (sub mine walls 2) +# tile 196 (mines walls tlcorn) { AAAAAAKCCKKJAAAA AAAAKKCLCJKJJAAA @@ -3770,7 +3770,7 @@ Z = (195, 195, 195) AAJACKCKKJJJAJAA AAJCKKJAAAJJJJJA } -# tile 197 (sub mine walls 3) +# tile 197 (mines walls trcorn) { AAAAAAKCCKKJAAAA AAAAKKCLCJKJJAAA @@ -3789,7 +3789,7 @@ Z = (195, 195, 195) AAJACKCKKJJJAJAA AAJCKKJAAAJJJJJA } -# tile 198 (sub mine walls 4) +# tile 198 (mines walls blcorn) { AKKKAAKKKKAAJJJA AKKAAKCCCJJJAAJA @@ -3808,7 +3808,7 @@ Z = (195, 195, 195) AJJJJJJJJJJJJJJJ AAAAAAAAAAAAAAAA } -# tile 199 (sub mine walls 5) +# tile 199 (mines walls brcorn) { AKKAAAKKAAAAJJJA AKAAKKLCKAAAAAJA @@ -3827,7 +3827,7 @@ Z = (195, 195, 195) JJJJJJJJJJJJJJJA AAAAAAAAAAAAAAAA } -# tile 200 (sub mine walls 6) +# tile 200 (mines walls cross wall) { AAAAAAKCCKKJAAAA AAAAKCCLCJKJJAAA @@ -3846,7 +3846,7 @@ Z = (195, 195, 195) AAJACKCKKJJJAJAA AAJCKKJAAAJJJJJA } -# tile 201 (sub mine walls 7) +# tile 201 (mines walls tuwall) { AKKAAAKKKKAAJJJA AKAAKKLCCJJJAAJA @@ -3865,7 +3865,7 @@ Z = (195, 195, 195) JJJJJJJJJJJJJJJJ AAAAAAAAAAAAAAAA } -# tile 202 (sub mine walls 8) +# tile 202 (mines walls tdwall) { AAAAAAKCCKKJAAAA AAAAKCCLCJKJJAAA @@ -3884,7 +3884,7 @@ Z = (195, 195, 195) AAJACKCKKJJJAJAA AAJCKKJAAAJJJJJA } -# tile 203 (sub mine walls 9) +# tile 203 (mines walls tlwall) { AKKAACKCCKKJAJJA AKACKKKLLJKJJAJA @@ -3903,7 +3903,7 @@ Z = (195, 195, 195) AAJACKCKKJJJAJAA AAJCKKJAAAJJJJJA } -# tile 204 (sub mine walls 10) +# tile 204 (mines walls trwall) { AKKAACKCCKKJAJJA AKACKKCLCJKJJAJA @@ -3922,7 +3922,7 @@ Z = (195, 195, 195) AAJACKCKKJJJAJAA AAJCKKJAAAJJJJJA } -# tile 205 (sub gehennom walls 0) +# tile 205 (gehennom walls vertical) { ALLDAJ11111JLLDA ADDDAJ1J11JJDDDA @@ -3941,7 +3941,7 @@ Z = (195, 195, 195) AJJJAJJ1111JJJJA AD11AJJ1111JD1JA } -# tile 206 (sub gehennom walls 1) +# tile 206 (gehennom walls horizontal) { AAALDDAAAAALDDAA DDDLDDAJDDDLDDAJ @@ -3960,7 +3960,7 @@ Z = (195, 195, 195) JJJJJJJJJJJJJJJJ AAAAAAAAAAAAAAAA } -# tile 207 (sub gehennom walls 2) +# tile 207 (gehennom walls tlcorn) { AAALLLLDDDDDDAAA LLLLAAJJ1111DJJJ @@ -3979,7 +3979,7 @@ Z = (195, 195, 195) AJJJAJJ1111JJJJA AD11AJJ1111JD1JA } -# tile 208 (sub gehennom walls 3) +# tile 208 (gehennom walls trcorn) { AAALLLLDDDDDDAAA LLLLAAJJ1111DJJJ @@ -3998,7 +3998,7 @@ Z = (195, 195, 195) AJJJAJJ1111JJJJA AD11AJJ1111JD1JA } -# tile 209 (sub gehennom walls 4) +# tile 209 (gehennom walls blcorn) { AAALLLLDDDDDDAAA LLLLAAJJ1111DJJJ @@ -4017,7 +4017,7 @@ Z = (195, 195, 195) JJJJJJJJJJJJJJJJ AAAAAAAAAAAAAAAA } -# tile 210 (sub gehennom walls 5) +# tile 210 (gehennom walls brcorn) { AAALLLLDDDDDDAAA LLLLAAJJ1111DJJJ @@ -4036,7 +4036,7 @@ Z = (195, 195, 195) JJJJJJJJJJJJJJJJ AAAAAAAAAAAAAAAA } -# tile 211 (sub gehennom walls 6) +# tile 211 (gehennom walls cross wall) { AAALLLLDDDDDDAAA LLLLAAJJ1111DJJJ @@ -4055,7 +4055,7 @@ Z = (195, 195, 195) AJJJAJJ1111JJJJA AD11AJJ1111JD1JA } -# tile 212 (sub gehennom walls 7) +# tile 212 (gehennom walls tuwall) { AAALLLLDDDDDDAAA LLLLAAJJ1111DJJJ @@ -4074,7 +4074,7 @@ Z = (195, 195, 195) JJJJJJJJJJJJJJJJ AAAAAAAAAAAAAAAA } -# tile 213 (sub gehennom walls 8) +# tile 213 (gehennom walls tdwall) { AAALLLLDDDDDDAAA LLLLAAJJ1111DJJJ @@ -4093,7 +4093,7 @@ Z = (195, 195, 195) AJJJAJJ1111JJJJA AD11AJJ1111JD1JA } -# tile 214 (sub gehennom walls 9) +# tile 214 (gehennom walls tlwall) { AAALLLLDDDDDDAAA LLLLAAJJ1111DJJJ @@ -4112,7 +4112,7 @@ Z = (195, 195, 195) AJJJAJJ1111JJJJA AD11AJJ1111JD1JA } -# tile 215 (sub gehennom walls 10) +# tile 215 (gehennom walls trwall) { AAALLLLDDDDDDAAA LLLLAAJJ1111DJJJ @@ -4131,7 +4131,7 @@ Z = (195, 195, 195) AJJJAJJ1111JJJJA AD11AJJ1111JD1JA } -# tile 216 (sub knox walls 0) +# tile 216 (knox walls vertical) { AJJJAAACJAAAJJJA AJJJAACLJJAAJJJA @@ -4150,7 +4150,7 @@ Z = (195, 195, 195) AAJAAACKKJAAAJAA ACJJAAAAAAAACJJA } -# tile 217 (sub knox walls 1) +# tile 217 (knox walls horizontal) { AJAAAJAAAJAAAJAA JJJAAAJAJJJAAAJA @@ -4169,7 +4169,7 @@ Z = (195, 195, 195) KJJACJJAKJJACJJA AAAAAAAAAAAAAAAA } -# tile 218 (sub knox walls 2) +# tile 218 (knox walls tlcorn) { AAAAAAKCJKAAAAAA AAAAKKCLKJKKAAAA @@ -4188,7 +4188,7 @@ Z = (195, 195, 195) AAJAAACKKJAAAJAA ACJJAAAAAAAACJJA } -# tile 219 (sub knox walls 3) +# tile 219 (knox walls trcorn) { AAAAAAKCJKAAAAAA AAAAKKCLKJKKAAAA @@ -4207,7 +4207,7 @@ Z = (195, 195, 195) AAJAAACKKJAAAJAA ACJJAAAAAAAACJJA } -# tile 220 (sub knox walls 4) +# tile 220 (knox walls blcorn) { AAAAAAKCJKAAAAAA AAAAKKCLKJKKAAAA @@ -4226,7 +4226,7 @@ Z = (195, 195, 195) KJJACJJAKJJACJJA AAAAAAAAAAAAAAAA } -# tile 221 (sub knox walls 5) +# tile 221 (knox walls brcorn) { AAAAAAKCJKAAAAAA AAAAKKCLKJKKAAAA @@ -4245,7 +4245,7 @@ Z = (195, 195, 195) KJJACJJAKJJACJJA AAAAAAAAAAAAAAAA } -# tile 222 (sub knox walls 6) +# tile 222 (knox walls cross wall) { AAAAAAKCJKAAAAAA AAAAKKCLKJKKAAAA @@ -4264,7 +4264,7 @@ Z = (195, 195, 195) AAJAAACKKJAAAJAA ACJJAAAAAAAACJJA } -# tile 223 (sub knox walls 7) +# tile 223 (knox walls tuwall) { AAAAAAKCJKAAAAAA AAAAKKCLKJKKAAAA @@ -4283,7 +4283,7 @@ Z = (195, 195, 195) KJJACJJAKJJACJJA AAAAAAAAAAAAAAAA } -# tile 224 (sub knox walls 8) +# tile 224 (knox walls tdwall) { AAAAAAKCJKAAAAAA AAAAKKCLKJKKAAAA @@ -4302,7 +4302,7 @@ Z = (195, 195, 195) AAJAAACKKJAAAJAA ACJJAAAAAAAACJJA } -# tile 225 (sub knox walls 9) +# tile 225 (knox walls tlwall) { AAAAAAKCJKAAAAAA AAAAKKCLKJKKAAAA @@ -4321,7 +4321,7 @@ Z = (195, 195, 195) AAJAAACKKJAAAJAA ACJJAAAAAAAACJJA } -# tile 226 (sub knox walls 10) +# tile 226 (knox walls trwall) { AAAAAAKCJKAAAAAA AAAAKKCLKJKKAAAA @@ -4340,7 +4340,7 @@ Z = (195, 195, 195) AAJAAACKKJAAAJAA ACJJAAAAAAAACJJA } -# tile 227 (sub sokoban walls 0) +# tile 227 (sokoban walls vertical) { ANNBA1EEEEE1NNBA ABBBA1E1EE11BBBA @@ -4359,7 +4359,7 @@ Z = (195, 195, 195) A111A11EEEE1111A ABEEA11EEEE1BE1A } -# tile 228 (sub sokoban walls 1) +# tile 228 (sokoban walls horizontal) { AAANBBAAAAANBBAA BBBNBBA1BBBNBBA1 @@ -4378,7 +4378,7 @@ Z = (195, 195, 195) 1111111111111111 AAAAAAAAAAAAAAAA } -# tile 229 (sub sokoban walls 2) +# tile 229 (sokoban walls tlcorn) { AAANNNNBBBBBBAAA NNNNAA11EEEEB111 @@ -4397,7 +4397,7 @@ Z = (195, 195, 195) A111A11EEEE1111A ABEEA11EEEE1BE1A } -# tile 230 (sub sokoban walls 3) +# tile 230 (sokoban walls trcorn) { AAANNNNBBBBBBAAA NNNNAA11EEEEB111 @@ -4416,7 +4416,7 @@ Z = (195, 195, 195) A111A11EEEE1111A ABEEA11EEEE1BE1A } -# tile 231 (sub sokoban walls 4) +# tile 231 (sokoban walls blcorn) { AAANNNNBBBBBBAAA NNNNAA11EEEEB111 @@ -4435,7 +4435,7 @@ Z = (195, 195, 195) 1111111111111111 AAAAAAAAAAAAAAAA } -# tile 232 (sub sokoban walls 5) +# tile 232 (sokoban walls brcorn) { AAANNNNBBBBBBAAA NNNNAA11EEEEB111 @@ -4454,7 +4454,7 @@ Z = (195, 195, 195) 1111111111111111 AAAAAAAAAAAAAAAA } -# tile 233 (sub sokoban walls 6) +# tile 233 (sokoban walls cross wall) { AAANNNNBBBBBBAAA NNNNAA11EEEEB111 @@ -4473,7 +4473,7 @@ Z = (195, 195, 195) A111A11EEEE1111A ABEEA11EEEE1BE1A } -# tile 234 (sub sokoban walls 7) +# tile 234 (sokoban walls tuwall) { AAANNNNBBBBBBAAA NNNNAA11EEEEB111 @@ -4492,7 +4492,7 @@ Z = (195, 195, 195) 1111111111111111 AAAAAAAAAAAAAAAA } -# tile 235 (sub sokoban walls 8) +# tile 235 (sokoban walls tdwall) { AAANNNNBBBBBBAAA NNNNAA11EEEEB111 @@ -4511,7 +4511,7 @@ Z = (195, 195, 195) A111A11EEEE1111A ABEEA11EEEE1BE1A } -# tile 236 (sub sokoban walls 9) +# tile 236 (sokoban walls tlwall) { AAANNNNBBBBBBAAA NNNNAA11EEEEB111 @@ -4530,7 +4530,7 @@ Z = (195, 195, 195) A111A11EEEE1111A ABEEA11EEEE1BE1A } -# tile 237 (sub sokoban walls 10) +# tile 237 (sokoban walls trwall) { AAANNNNBBBBBBAAA NNNNAA11EEEEB111 diff --git a/win/share/tile.doc b/win/share/tile.doc index 1ee5539f2..fabc6f295 100644 --- a/win/share/tile.doc +++ b/win/share/tile.doc @@ -120,10 +120,10 @@ boolean read_gif_tile(pixel[TILE_Y][TILE_X]); Array provided by shared code for NetHack use, by compiling and running tilemap.c to form tile.c: -short glyph2tile[MAXGLYPH]; - maps glyph number to tile number for display purposes, assuming - (non-blank) tiles are numbered sequentially through - monsters/objects/other +glyph_map glyphmap[MAXGLYPH]; + maps glyph number to tile number, ( and later to ttychar, symidx, + glyphflags) for display purposes, assuming (non-blank) tiles are + numbered sequentially through monsters/objects/other tilemap.c (shudder) accounts for things disappearing due to compilation options -- there should be a tile for everything appearing under any diff --git a/win/share/tilemap.c b/win/share/tilemap.c index 831f80d00..29ab8ed88 100644 --- a/win/share/tilemap.c +++ b/win/share/tilemap.c @@ -8,6 +8,7 @@ * then again with it defined to produce tiletxt.{o,obj}. */ +#if 0 #include "config.h" /* #include "onames.h" */ #include "permonst.h" @@ -15,9 +16,17 @@ /* #include "pm.h" */ #include "sym.h" #include "rm.h" +#else +#include "hack.h" #include "display.h" +#include +#endif #define Fprintf (void) fprintf +#define Snprintf(str, size, ...) \ + nh_snprintf(__func__, __LINE__, str, size, __VA_ARGS__) +void nh_snprintf(const char *func, int line, char *str, size_t size, + const char *fmt, ...); /* * Defining OBTAIN_TILEMAP to get a listing of the tile-mappings @@ -25,17 +34,12 @@ * the tilemap utility must also include: * objects.o, monst.o drawing.o */ -/* #define OBTAIN_TILEMAP */ +#define OBTAIN_TILEMAP #if defined(OBTAIN_TILEMAP) && !defined(TILETEXT) FILE *tilemap_file; #endif -const char *tilename(int, int, int); -void init_tilemap(void); -void process_substitutions(FILE *); -boolean acceptable_tilename(int, int, const char *, const char *); - #if defined(MICRO) || defined(WIN32) #undef exit #if !defined(MSDOS) && !defined(WIN32) @@ -43,10 +47,92 @@ extern void exit(int); #endif #endif +struct { + int idx; + const char *tilelabel; + const char *expectedlabel; +} altlabels[MAXPCHARS] = { +#define PCHAR_TILES +#include "defsym.h" +#undef PCHAR_TILES +}; + enum {MON_GLYPH, OBJ_GLYPH, OTH_GLYPH, TERMINATOR = -1}; #define EXTRA_SCROLL_DESCR_COUNT ((SCR_BLANK_PAPER - SCR_STINKING_CLOUD) - 1) +const char *altar_text[] = { + "unaligned", "chaotic", "neutral", "lawful", "shrine", +}; +enum wall_levels { main_dungeon, mines, gehennom, knox, sokoban }; -/* note that the ifdefs here should be the opposite sense from monst.c/ +int wall_offsets[] = { + GLYPH_CMAP_MAIN_OFF, GLYPH_CMAP_MINES_OFF, + GLYPH_CMAP_GEH_OFF, GLYPH_CMAP_KNOX_OFF, + GLYPH_CMAP_SOKO_OFF, +}; +const char *wall_texts[] = { + "main walls", "mines walls", "gehennom walls", + "knox walls", "sokoban walls", +}; +const char *walldesc[] = { + "vertical", "horizontal", "tlcorn", "trcorn", "blcorn", "brcorn", + "cross wall", "tuwall", "tdwall", "tlwall", "trwall", +}; + +int expl_offsets[] = { + GLYPH_EXPLODE_DARK_OFF, GLYPH_EXPLODE_NOXIOUS_OFF, + GLYPH_EXPLODE_MUDDY_OFF, GLYPH_EXPLODE_WET_OFF, + GLYPH_EXPLODE_MAGICAL_OFF, GLYPH_EXPLODE_FIERY_OFF, + GLYPH_EXPLODE_FROSTY_OFF, +}; +const char *expl_texts[] = { + "dark", "noxious", "muddy", "wet", "magical", "fiery", "frosty", +}; + +const char *zap_texts[] = { "missile", "fire", "frost", "sleep", + "death", "lightning", "poison gas", "acid" }; + +enum tilesrc {monsters_file, objects_file, other_file, generated}; +const char *tilesrc_texts[] = { "monsters.txt", "objects.txt", "other.txt", "generated" }; + +struct tilemap_t { + short tilenum; +#if defined(OBTAIN_TILEMAP) + char name[127]; + int glyph; +#endif +} tilemap[MAX_GLYPH]; + +#define MAX_TILENAM 30 + /* List of tiles encountered and their usage */ + struct tiles_used { + int tilenum; + enum tilesrc src; + int file_entry; + char tilenam[MAX_TILENAM]; + char references[120]; +}; +struct tiles_used *tilelist[2500] = { 0 }; + +/* Some special tiles used for init of some things */ +int TILE_stone = 0, /* will get set to correct tile later */ + TILE_unexplored = 0, /* will get set to correct tile later */ + TILE_nothing = 0, /* will get set to correct tile later */ + TILE_corr = 0; /* will get set to correct tile later; X11 uses it */ + +/* prototypes for functions in this file */ +const char *tilename(int, const int, int); +void init_tilemap(void); +void process_substitutions(FILE *); +boolean acceptable_tilename(int, int, const char *, const char *); +#if defined(OBTAIN_TILEMAP) +void precheck(int offset, const char *glyphtype); +void add_tileref(int n, int glyphref, enum tilesrc src, int tile_file_entry, + const char *nam, const char *prefix); +void dump_tilerefs(FILE *fp); +void free_tilerefs(void); +#endif + + /* note that the ifdefs here should be the opposite sense from monst.c/ * objects.c/rm.h */ @@ -88,193 +174,368 @@ struct conditionals_t { { TERMINATOR, 0, 0 } }; -/* - * Some entries in glyph2tile[] should be substituted for on various levels. - * The tiles used for the substitute entries will follow the usual ones in - * other.txt in the order given here, which should have every substitution - * for the same set of tiles grouped together. You will have to change - * more code in process_substitutions()/substitute_tiles() if the sets - * overlap in the future. - */ -struct substitute { - int first_glyph, last_glyph; - const char *sub_name; /* for explanations */ - const char *level_test; -} substitutes[] = { { GLYPH_CMAP_OFF + S_vwall, GLYPH_CMAP_OFF + S_trwall, - "mine walls", "In_mines(plev)" }, - { GLYPH_CMAP_OFF + S_vwall, GLYPH_CMAP_OFF + S_trwall, - "gehennom walls", "In_hell(plev)" }, - { GLYPH_CMAP_OFF + S_vwall, GLYPH_CMAP_OFF + S_trwall, - "knox walls", "Is_knox(plev)" }, - { GLYPH_CMAP_OFF + S_vwall, GLYPH_CMAP_OFF + S_trwall, - "sokoban walls", "In_sokoban(plev)" } }; - #if defined(TILETEXT) || defined(OBTAIN_TILEMAP) /* * file_entry is the position of the tile within the monsters/objects/other set */ const char * -tilename(int set, int file_entry, int gend) +tilename(int set, const int file_entry, int gend UNUSED) { - int i, j, condnum, tilenum, gendnum; + int i, k, cmap, condnum, tilenum, gendnum; static char buf[BUFSZ]; - +#if 0 + int offset; +#endif (void) def_char_to_objclass(']'); condnum = tilenum = gendnum = 0; - for (i = 0; i < NUMMONS; i++) { - if (set == MON_GLYPH && tilenum == file_entry && gend == 0) - return mons[i].pmnames[NEUTRAL]; - for (condnum = 0; conditionals[condnum].sequence != -1; ++condnum) { - if (conditionals[condnum].sequence == MON_GLYPH - && conditionals[condnum].predecessor == i) { - tilenum += 2; - if (set == MON_GLYPH && tilenum == file_entry) - return conditionals[condnum].name; - } - } - tilenum += 2; - } - if (set == MON_GLYPH && tilenum == file_entry) - return "invisible monster"; - - tilenum = 0; /* set-relative number */ - for (i = 0; i < NUM_OBJECTS; i++) { - /* prefer to give the description - that's all the tile's - * appearance should reveal */ - if (set == OBJ_GLYPH && tilenum == file_entry) { - if (!obj_descr[i].oc_descr) - return obj_descr[i].oc_name; - if (!obj_descr[i].oc_name) - return obj_descr[i].oc_descr; - - Sprintf(buf, "%s / %s", obj_descr[i].oc_descr, - obj_descr[i].oc_name); - return buf; - } - for (condnum = 0; conditionals[condnum].sequence != -1; ++condnum) { - if (conditionals[condnum].sequence == OBJ_GLYPH - && conditionals[condnum].predecessor == i) { - tilenum++; - if (set == OBJ_GLYPH && tilenum == file_entry) - return conditionals[condnum].name; - } - } - tilenum++; - } - - tilenum = 0; /* set-relative number */ - for (i = 0; i < (MAXPCHARS - MAXEXPCHARS); i++) { - if (set == OTH_GLYPH && tilenum == file_entry) { - if (*defsyms[i].explanation) { - return defsyms[i].explanation; - } else { - Sprintf(buf, "cmap %d", tilenum); + buf[0] = '\0'; + if (set == MON_GLYPH) { + for (i = 0; i < NUMMONS; i++) { + if (tilenum == file_entry) { + if (mons[i].pmnames[MALE]) + Snprintf(buf, sizeof buf, "%s {%s}", + mons[i].pmnames[NEUTRAL], mons[i].pmnames[MALE]); + else + Snprintf(buf, sizeof buf, "%s", mons[i].pmnames[NEUTRAL]); return buf; } + tilenum++; + if (tilenum == file_entry) { + if (mons[i].pmnames[FEMALE]) + Snprintf(buf, sizeof buf, "%s {%s}", + mons[i].pmnames[NEUTRAL], + mons[i].pmnames[FEMALE]); + else + Snprintf(buf, sizeof buf, "%s", mons[i].pmnames[NEUTRAL]); + return buf; + } + for (condnum = 0; conditionals[condnum].sequence != -1; + ++condnum) { + if (conditionals[condnum].sequence == MON_GLYPH + && conditionals[condnum].predecessor == i) { + tilenum += 2; + if (tilenum == file_entry) + return conditionals[condnum].name; + } + } + tilenum++; } - for (condnum = 0; conditionals[condnum].sequence != -1; ++condnum) { - if (conditionals[condnum].sequence == OTH_GLYPH - && conditionals[condnum].predecessor == i) { + if (tilenum == file_entry) + return "invisible monster"; + } /* MON_GLYPH */ + + if (set == OBJ_GLYPH) { + tilenum = 0; /* set-relative number */ + for (i = 0; i < NUM_OBJECTS; i++) { + /* prefer to give the description - that's all the tile's + * appearance should reveal */ + if (tilenum == file_entry) { + if (!obj_descr[i].oc_descr) + return obj_descr[i].oc_name; + if (!obj_descr[i].oc_name) + return obj_descr[i].oc_descr; + + Sprintf(buf, "%s / %s", obj_descr[i].oc_descr, + obj_descr[i].oc_name); + return buf; + } + for (condnum = 0; conditionals[condnum].sequence != -1; + ++condnum) { + if (conditionals[condnum].sequence == OBJ_GLYPH + && conditionals[condnum].predecessor == i) { + tilenum++; + if (tilenum == file_entry) + return conditionals[condnum].name; + } + } + tilenum++; + } + } /* OBJ_GLYPH */ + + if (set == OTH_GLYPH) { + tilenum = 0; /* set-relative number */ + + /* S_stone */ + for (cmap = S_stone; cmap <= S_stone; cmap++) { + if (tilenum == file_entry) { + if (*defsyms[cmap].explanation) { + return defsyms[cmap].explanation; + } else if (altlabels[cmap].tilelabel + && *altlabels[cmap].tilelabel) { + Sprintf(buf, "%s", altlabels[cmap].tilelabel); + return buf; + } else { + Sprintf(buf, "cmap %d %d", cmap, tilenum); + return buf; + } + } + for (condnum = 0; conditionals[condnum].sequence != -1; + condnum++) { + if (conditionals[condnum].sequence == OTH_GLYPH + && conditionals[condnum].predecessor == cmap) { + tilenum++; + } + } + tilenum++; + } + + /* walls - level specific */ + for (k = main_walls; k < mines_walls; k++) { + for (cmap = S_vwall; cmap <= S_trwall; cmap++) { + i = cmap - S_vwall; + if (tilenum == file_entry) { + Sprintf(buf, "%s %s", wall_texts[k], walldesc[i]); + return buf; + } + for (condnum = 0; conditionals[condnum].sequence != -1; + condnum++) { + if (conditionals[condnum].sequence == OTH_GLYPH + && conditionals[condnum].predecessor == cmap) { + tilenum++; + } + } tilenum++; - if (set == OTH_GLYPH && tilenum == file_entry) + } + } + + /* cmap A */ + for (cmap = S_ndoor; cmap <= S_brdnladder; cmap++) { + i = cmap - S_ndoor; + if (tilenum == file_entry) { + if (*defsyms[cmap].explanation) { + return defsyms[cmap].explanation; + } else if (altlabels[cmap].tilelabel + && *altlabels[cmap].tilelabel) { + Sprintf(buf, "%s", altlabels[cmap].tilelabel); + return buf; + } else { + Sprintf(buf, "cmap %d %d", cmap, tilenum); + return buf; + } + } + for (condnum = 0; conditionals[condnum].sequence != -1; + ++condnum) { + if (conditionals[condnum].sequence == OTH_GLYPH + && conditionals[condnum].predecessor == cmap) { + tilenum++; + if (tilenum == file_entry) + return conditionals[condnum].name; + } + } + tilenum++; + } + + /* Altars */ + cmap = S_altar; + for (k = altar_unaligned; k <= shrine; k++) { + /* Since defsyms only has one altar symbol, + it isn't much help in identifying details + these. Roll our own name. */ + if (tilenum == file_entry) { + Sprintf(buf, "%s altar", altar_text[k]); + return buf; + } + tilenum++; + } + for (condnum = 0; conditionals[condnum].sequence != -1; ++condnum) { + if (conditionals[condnum].sequence == OTH_GLYPH + && conditionals[condnum].predecessor == cmap) { + tilenum++; + if (tilenum == file_entry) return conditionals[condnum].name; } } - tilenum++; - } - /* explosions */ - tilenum = MAXPCHARS - MAXEXPCHARS; - i = file_entry - tilenum; - if (i < (MAXEXPCHARS * EXPL_MAX)) { - if (set == OTH_GLYPH) { - static const char *explosion_types[] = { - /* hack.h */ - "dark", "noxious", "muddy", "wet", "magical", "fiery", - "frosty" - }; - Sprintf(buf, "explosion %s %d", explosion_types[i / MAXEXPCHARS], - i % MAXEXPCHARS); - return buf; - } - } - tilenum += (MAXEXPCHARS * EXPL_MAX); + /* cmap B */ + for (cmap = S_grave; cmap <= S_vibrating_square; cmap++) { + i = cmap - S_grave; + if (tilenum == file_entry) { + if (*defsyms[cmap].explanation) { + return defsyms[cmap].explanation; + } else if (altlabels[cmap].tilelabel + && *altlabels[cmap].tilelabel) { + Sprintf(buf, "%s", altlabels[cmap].tilelabel); + return buf; + } else { + Sprintf(buf, "cmap %d %d", cmap, tilenum); + return buf; + } + } + + for (condnum = 0; conditionals[condnum].sequence != -1; + ++condnum) { + if (conditionals[condnum].sequence == OTH_GLYPH + && conditionals[condnum].predecessor == cmap) { + tilenum++; + if (tilenum == file_entry) + return conditionals[condnum].name; + } + } + tilenum++; + } + +#if 0 + /* zaps */ + for (k = 0; k < NUM_ZAP; k++) { + offset = GLYPH_ZAP_OFF + (k * ((S_rslant - S_vbeam) + 1)); + for (cmap = S_vbeam; cmap <= S_rslant; cmap++) { + i = cmap - S_vbeam; + if (tilenum == file_entry) { + Sprintf(buf, "%s zap %d %d", zap_texts[k], k + 1, i % 4); + return buf; + } + for (condnum = 0; conditionals[condnum].sequence != -1; + condnum++) { + if (conditionals[condnum].sequence == OTH_GLYPH + && conditionals[condnum].predecessor == cmap) { + tilenum++; + } + } + tilenum++; + } + } +#else i = file_entry - tilenum; if (i < (NUM_ZAP << 2)) { - if (set == OTH_GLYPH) { - Sprintf(buf, "zap %d %d", i / 4, i % 4); - return buf; - } + Sprintf(buf, "%s zap %d %d", zap_texts[i / 4], (i / 4) + 1, i % 4); + return buf; } tilenum += (NUM_ZAP << 2); +#endif - i = file_entry - tilenum; - if (i < WARNCOUNT) { - if (set == OTH_GLYPH) { + /* cmap C */ + for (cmap = S_digbeam; cmap <= S_goodpos; cmap++) { + i = cmap - S_digbeam; + if (tilenum == file_entry) { + if (*defsyms[cmap].explanation) { + return defsyms[cmap].explanation; + } else if (altlabels[cmap].tilelabel + && *altlabels[cmap].tilelabel) { + Sprintf(buf, "%s", altlabels[cmap].tilelabel); + return buf; + } else { + Sprintf(buf, "cmap %d %d", cmap, tilenum); + return buf; + } + } + for (condnum = 0; conditionals[condnum].sequence != -1; + ++condnum) { + if (conditionals[condnum].sequence == OTH_GLYPH + && conditionals[condnum].predecessor == cmap) { + tilenum++; + if (tilenum == file_entry) + return conditionals[condnum].name; + } + } + tilenum++; + } + + /* swallow */ + for (cmap = S_sw_tl; cmap <= S_sw_br; cmap++) { + i = cmap - S_sw_tl; + if (tilenum + i == file_entry) { + if (*defsyms[cmap].explanation) { + return defsyms[cmap].explanation; + } else if (altlabels[cmap].tilelabel + && *altlabels[cmap].tilelabel) { + Sprintf(buf, "%s", altlabels[cmap].tilelabel); + return buf; + } else { + Sprintf(buf, "cmap swallow %d", cmap); + return buf; + } + } + } + tilenum += ((S_sw_br - S_sw_tl) + 1); + + /* explosions */ + for (k = expl_dark; k <= expl_frosty; k++) { + for (cmap = S_expl_tl; cmap <= S_expl_br; cmap++) { + i = cmap - S_expl_tl; + if (tilenum == file_entry) { + /* substitute "explosion " in the tilelabel + with "explosion dark " etc */ + Sprintf(buf, "explosion %s %s", expl_texts[k], + &altlabels[cmap].tilelabel[10]); + return buf; + } + for (condnum = 0; conditionals[condnum].sequence != -1; + ++condnum) { + if (conditionals[condnum].sequence == OTH_GLYPH + && conditionals[condnum].predecessor == cmap) { + tilenum++; + if (tilenum == file_entry) + return conditionals[condnum].name; + } + } + tilenum++; + } + } + + /* warnings */ + i = file_entry - tilenum; + if (i < WARNCOUNT) { Sprintf(buf, "warning %d", i); return buf; } - } - tilenum += WARNCOUNT; + tilenum += WARNCOUNT; - i = file_entry - tilenum; - if (i < 1) { - if (set == OTH_GLYPH) { + i = file_entry - tilenum; + if (i < 1) { Sprintf(buf, "unexplored"); return buf; } - } - tilenum += 1; + tilenum += 1; - i = file_entry - tilenum; - if (i < 1) { - if (set == OTH_GLYPH) { + i = file_entry - tilenum; + if (i < 1) { Sprintf(buf, "nothing"); return buf; } - } - tilenum++; + tilenum++; - for (i = 0; i < SIZE(substitutes); i++) { - j = file_entry - tilenum; - if (j <= substitutes[i].last_glyph - substitutes[i].first_glyph) { - if (set == OTH_GLYPH) { - Sprintf(buf, "sub %s %d", substitutes[i].sub_name, j); - return buf; + /* other level walls */ + /* this batch starts at mines(1), not main(0) */ + for (k = mines_walls; k <= sokoban_walls; k++) { + for (cmap = S_vwall; cmap <= S_trwall; cmap++) { + i = cmap - S_vwall; + if (tilenum == file_entry) { + Sprintf(buf, "%s %s", wall_texts[k], walldesc[i]); + return buf; + } + for (condnum = 0; conditionals[condnum].sequence != -1; + condnum++) { + if (conditionals[condnum].sequence == OTH_GLYPH + && conditionals[condnum].predecessor == cmap) { + tilenum++; + } + } + tilenum++; } } - tilenum += substitutes[i].last_glyph - substitutes[i].first_glyph + 1; - } - + } /* OTH_GLYPH */ Sprintf(buf, "unknown %d %d", set, file_entry); return buf; } -#endif +#endif /* TILETEXT || OBTAIN_TILEMAP */ #ifndef TILETEXT #define TILE_FILE "tile.c" - #ifdef AMIGA #define SOURCE_TEMPLATE "NH:src/%s" +#define INCLUDE_TEMPLATE "NH:include/t.%s" #else #ifdef MAC #define SOURCE_TEMPLATE ":src:%s" +#define INCLUDE_TEMPLATE ":include:%s" #else #define SOURCE_TEMPLATE "../src/%s" +#define INCLUDE_TEMPLATE "../include/%s" #endif #endif -struct tilemap_t { - short tilenum; -#ifdef OBTAIN_TILEMAP - char name[80]; - int glyph; -#endif -} tilemap[MAX_GLYPH]; - - #ifndef STATUES_DONT_LOOK_LIKE_MONSTERS int lastmontile, lastobjtile, lastothtile, laststatuetile; #else @@ -298,11 +559,11 @@ int lastmontile, lastobjtile, lastothtile; void init_tilemap(void) { - int i, j, condnum, tilenum; + int i, j, k, cmap, condnum, tilenum, offset; int corpsetile, swallowbase; int file_entry = 0; -#ifdef OBTAIN_TILEMAP +#if defined(OBTAIN_TILEMAP) tilemap_file = fopen("tilemappings.lst", "w"); Fprintf(tilemap_file, "NUMMONS = %d\n", NUMMONS); Fprintf(tilemap_file, "NUM_OBJECTS = %d\n", NUM_OBJECTS); @@ -310,21 +571,92 @@ init_tilemap(void) Fprintf(tilemap_file, "MAXPCHARS = %d\n", MAXPCHARS); Fprintf(tilemap_file, "MAX_GLYPH = %d\n", MAX_GLYPH); Fprintf(tilemap_file, "GLYPH_MON_OFF = %d\n", GLYPH_MON_OFF); + Fprintf(tilemap_file, "GLYPH_MON_MALE_OFF = %d\n", GLYPH_MON_MALE_OFF); + Fprintf(tilemap_file, "GLYPH_MON_FEM_OFF = %d\n", GLYPH_MON_FEM_OFF); Fprintf(tilemap_file, "GLYPH_PET_OFF = %d\n", GLYPH_PET_OFF); + Fprintf(tilemap_file, "GLYPH_PET_MALE_OFF = %d\n", GLYPH_PET_MALE_OFF); + Fprintf(tilemap_file, "GLYPH_PET_FEM_OFF = %d\n", GLYPH_PET_FEM_OFF); + Fprintf(tilemap_file, "GLYPH_INVIS_OFF = %d\n", GLYPH_INVIS_OFF); Fprintf(tilemap_file, "GLYPH_DETECT_OFF = %d\n", GLYPH_DETECT_OFF); - Fprintf(tilemap_file, "GLYPH_RIDDEN_OFF = %d\n", GLYPH_RIDDEN_OFF); + Fprintf(tilemap_file, "GLYPH_DETECT_MALE_OFF = %d\n", + GLYPH_DETECT_MALE_OFF); + Fprintf(tilemap_file, "GLYPH_DETECT_FEM_OFF = %d\n", + GLYPH_DETECT_FEM_OFF); Fprintf(tilemap_file, "GLYPH_BODY_OFF = %d\n", GLYPH_BODY_OFF); + Fprintf(tilemap_file, "GLYPH_RIDDEN_OFF = %d\n", GLYPH_RIDDEN_OFF); + Fprintf(tilemap_file, "GLYPH_RIDDEN_MALE_OFF = %d\n", + GLYPH_RIDDEN_MALE_OFF); + Fprintf(tilemap_file, "GLYPH_RIDDEN_FEM_OFF = %d\n", + GLYPH_RIDDEN_FEM_OFF); + Fprintf(tilemap_file, "GLYPH_OBJ_OFF = %d\n", GLYPH_OBJ_OFF); + Fprintf(tilemap_file, "GLYPH_CMAP_OFF = %d\n", GLYPH_CMAP_OFF); + Fprintf(tilemap_file, "GLYPH_CMAP_STONE_OFF = %d\n", GLYPH_CMAP_STONE_OFF); + Fprintf(tilemap_file, "GLYPH_CMAP_MAIN_OFF = %d\n", GLYPH_CMAP_MAIN_OFF); + Fprintf(tilemap_file, "GLYPH_CMAP_MINES_OFF = %d\n", + GLYPH_CMAP_MINES_OFF); + Fprintf(tilemap_file, "GLYPH_CMAP_GEH_OFF = %d\n", GLYPH_CMAP_GEH_OFF); + Fprintf(tilemap_file, "GLYPH_CMAP_KNOX_OFF = %d\n", GLYPH_CMAP_KNOX_OFF); + Fprintf(tilemap_file, "GLYPH_CMAP_SOKO_OFF = %d\n", GLYPH_CMAP_SOKO_OFF); + Fprintf(tilemap_file, "GLYPH_CMAP_A_OFF = %d\n", GLYPH_CMAP_A_OFF); + Fprintf(tilemap_file, "GLYPH_ALTAR_OFF = %d\n", GLYPH_ALTAR_OFF); + Fprintf(tilemap_file, "GLYPH_CMAP_B_OFF = %d\n", GLYPH_CMAP_B_OFF); + Fprintf(tilemap_file, "GLYPH_ZAP_OFF = %d\n", GLYPH_ZAP_OFF); + Fprintf(tilemap_file, "GLYPH_CMAP_C_OFF = %d\n", GLYPH_CMAP_C_OFF); Fprintf(tilemap_file, "GLYPH_SWALLOW_OFF = %d\n", GLYPH_SWALLOW_OFF); + Fprintf(tilemap_file, "GLYPH_EXPLODE_OFF = %d\n", GLYPH_EXPLODE_OFF); + Fprintf(tilemap_file, "GLYPH_EXPLODE_DARK_OFF = %d\n", + GLYPH_EXPLODE_DARK_OFF); + Fprintf(tilemap_file, "GLYPH_EXPLODE_NOXIOUS_OFF = %d\n", + GLYPH_EXPLODE_NOXIOUS_OFF); + Fprintf(tilemap_file, "GLYPH_EXPLODE_MUDDY_OFF = %d\n", + GLYPH_EXPLODE_MUDDY_OFF); + Fprintf(tilemap_file, "GLYPH_EXPLODE_WET_OFF = %d\n", + GLYPH_EXPLODE_WET_OFF); + Fprintf(tilemap_file, "GLYPH_EXPLODE_MAGICAL_OFF = %d\n", + GLYPH_EXPLODE_MAGICAL_OFF); + Fprintf(tilemap_file, "GLYPH_EXPLODE_FIERY_OFF = %d\n", + GLYPH_EXPLODE_FIERY_OFF); + Fprintf(tilemap_file, "GLYPH_EXPLODE_FROSTY_OFF = %d\n", + GLYPH_EXPLODE_FROSTY_OFF); + Fprintf(tilemap_file, "GLYPH_WARNING_OFF = %d\n", GLYPH_WARNING_OFF); + Fprintf(tilemap_file, "GLYPH_STATUE_OFF = %d\n", GLYPH_STATUE_OFF); + Fprintf(tilemap_file, "GLYPH_STATUE_MALE_OFF = %d\n", + GLYPH_STATUE_MALE_OFF); + Fprintf(tilemap_file, "GLYPH_STATUE_FEM_OFF = %d\n", + GLYPH_STATUE_FEM_OFF); + Fprintf(tilemap_file, "GLYPH_OBJ_PILETOP_OFF = %d\n", GLYPH_OBJ_PILETOP_OFF); + Fprintf(tilemap_file, "GLYPH_BODY_PILETOP_OFF = %d\n", GLYPH_BODY_PILETOP_OFF); + Fprintf(tilemap_file, "GLYPH_STATUE_MALE_PILETOP_OFF = %d\n", + GLYPH_STATUE_MALE_PILETOP_OFF); + Fprintf(tilemap_file, "GLYPH_STATUE_FEM_PILETOP_OFF = %d\n", + GLYPH_STATUE_FEM_PILETOP_OFF); + Fprintf(tilemap_file, "GLYPH_UNEXPLORED_OFF = %d\n", + GLYPH_UNEXPLORED_OFF); + Fprintf(tilemap_file, "GLYPH_NOTHING_OFF = %d\n", GLYPH_NOTHING_OFF); #endif for (i = 0; i < MAX_GLYPH; i++) { tilemap[i].tilenum = -1; } - corpsetile = NUMMONS + NUMMONS + NUM_INVIS_TILES + CORPSE; - swallowbase = NUMMONS + NUMMONS + NUM_INVIS_TILES + NUM_OBJECTS + S_sw_tl; + corpsetile = NUMMONS + /* MON_MALE */ + NUMMONS + /* MON_FEM */ + NUM_INVIS_TILES + /* INVIS */ + CORPSE; /* within OBJ */ - /* add number compiled out */ + swallowbase = NUMMONS + /* MON_MALE */ + NUMMONS + /* MON_FEM */ + NUM_INVIS_TILES + /* INVIS */ + NUM_OBJECTS + /* Objects */ + 1 + /* Stone */ + ((S_trwall - S_vwall) + 1) + /* main walls */ + ((S_brdnladder - S_ndoor) + 1) + /* cmap A */ + 5 + /* 5 altar tiles */ + ((S_vibrating_square - S_grave) + 1) + /* cmap B */ + (NUM_ZAP << 2) + /* zaps */ + ((S_goodpos - S_digbeam) + 1); /* cmap C */ + + /* add number compiled out */ for (i = 0; conditionals[i].sequence != TERMINATOR; i++) { switch (conditionals[i].sequence) { case MON_GLYPH: @@ -345,80 +677,122 @@ init_tilemap(void) tilenum = 0; for (i = 0; i < NUMMONS; i++) { -#ifdef OBTAIN_TILEMAP +#if defined(OBTAIN_TILEMAP) char buf[256]; #endif - tilemap[GLYPH_MON_OFF + i].tilenum = tilenum; - tilemap[GLYPH_PET_OFF + i].tilenum = tilenum; - tilemap[GLYPH_DETECT_OFF + i].tilenum = tilenum; - tilemap[GLYPH_RIDDEN_OFF + i].tilenum = tilenum; + tilemap[GLYPH_MON_MALE_OFF + i].tilenum = tilenum; + tilemap[GLYPH_PET_MALE_OFF + i].tilenum = tilenum; + tilemap[GLYPH_DETECT_MALE_OFF + i].tilenum = tilenum; + tilemap[GLYPH_RIDDEN_MALE_OFF + i].tilenum = tilenum; tilemap[GLYPH_BODY_OFF + i].tilenum = corpsetile; - j = GLYPH_SWALLOW_OFF + 8 * i; - tilemap[j].tilenum = swallowbase; - tilemap[j + 1].tilenum = swallowbase + 1; - tilemap[j + 2].tilenum = swallowbase + 2; - tilemap[j + 3].tilenum = swallowbase + 3; - tilemap[j + 4].tilenum = swallowbase + 4; - tilemap[j + 5].tilenum = swallowbase + 5; - tilemap[j + 6].tilenum = swallowbase + 6; - tilemap[j + 7].tilenum = swallowbase + 7; -#ifdef OBTAIN_TILEMAP - Sprintf(buf, "%s (%d)", tilename(MON_GLYPH, file_entry, 0), file_entry); - Sprintf(tilemap[GLYPH_MON_OFF + i].name, - "%s (%d)", buf, i); - Sprintf(tilemap[GLYPH_PET_OFF + i].name, - "%s %s (%d)", buf, "pet", i); - Sprintf(tilemap[GLYPH_DETECT_OFF + i].name, - "%s %s (%d)", buf, "detected", i); - Sprintf(tilemap[GLYPH_RIDDEN_OFF + i].name, - "%s %s (%d)", buf, "ridden", i); - Sprintf(tilemap[GLYPH_BODY_OFF + i].name, - "%s %s (%d)", buf, "corpse", i); - Sprintf(tilemap[j + 0].name, "%s swallow0 (%d)", buf, i); - Sprintf(tilemap[j + 1].name, "%s swallow1 (%d)", buf, i); - Sprintf(tilemap[j + 2].name, "%s swallow2 (%d)", buf, i); - Sprintf(tilemap[j + 3].name, "%s swallow3 (%d)", buf, i); - Sprintf(tilemap[j + 4].name, "%s swallow4 (%d)", buf, i); - Sprintf(tilemap[j + 5].name, "%s swallow5 (%d)", buf, i); - Sprintf(tilemap[j + 6].name, "%s swallow6 (%d)", buf, i); - Sprintf(tilemap[j + 7].name, "%s swallow7 (%d)", buf, i); + tilemap[GLYPH_BODY_PILETOP_OFF + i].tilenum = corpsetile; +#if defined(OBTAIN_TILEMAP) + Sprintf(buf, "%s (mnum=%d)", tilename(MON_GLYPH, file_entry, 0), i); + Sprintf(tilemap[GLYPH_MON_MALE_OFF + i].name, "male %s", buf); + Sprintf(tilemap[GLYPH_PET_MALE_OFF + i].name, "%s male %s", "pet", buf); + Sprintf(tilemap[GLYPH_DETECT_MALE_OFF + i].name, "%s male %s", "detected", buf); + Sprintf(tilemap[GLYPH_RIDDEN_MALE_OFF + i].name, "%s male %s", "ridden", buf); + Sprintf(tilemap[GLYPH_BODY_OFF + i].name, "%s %s", "body of", buf); + Sprintf(tilemap[GLYPH_BODY_PILETOP_OFF + i].name, "%s %s", "piletop body of", buf); + add_tileref(tilenum, GLYPH_MON_MALE_OFF + i, monsters_file, + file_entry, tilemap[GLYPH_MON_MALE_OFF + i].name, ""); + add_tileref(tilenum, GLYPH_PET_MALE_OFF + i, monsters_file, + file_entry, tilemap[GLYPH_PET_MALE_OFF + i].name, ""); + add_tileref(tilenum, GLYPH_DETECT_MALE_OFF + i, monsters_file, + file_entry, tilemap[GLYPH_DETECT_MALE_OFF + i].name,""); + add_tileref(tilenum, GLYPH_RIDDEN_MALE_OFF + i, monsters_file, + file_entry, tilemap[GLYPH_RIDDEN_MALE_OFF + i].name, ""); + add_tileref(corpsetile, GLYPH_BODY_OFF + i, objects_file, CORPSE, + tilemap[GLYPH_BODY_OFF + i].name, ""); + add_tileref(corpsetile, GLYPH_BODY_PILETOP_OFF + i, objects_file, + CORPSE, tilemap[GLYPH_BODY_PILETOP_OFF + i].name, ""); #endif + tilenum++; + file_entry++; + tilemap[GLYPH_MON_FEM_OFF + i].tilenum = tilenum; + tilemap[GLYPH_PET_FEM_OFF + i].tilenum = tilenum; + tilemap[GLYPH_DETECT_FEM_OFF + i].tilenum = tilenum; + tilemap[GLYPH_RIDDEN_FEM_OFF + i].tilenum = tilenum; +#if defined(OBTAIN_TILEMAP) + Sprintf(buf, "%s (mnum=%d)", tilename(MON_GLYPH, file_entry, 0), i); + Sprintf(tilemap[GLYPH_MON_FEM_OFF + i].name, "female %s", buf); + Sprintf(tilemap[GLYPH_PET_FEM_OFF + i].name, "%s female %s", "pet", + buf); + Sprintf(tilemap[GLYPH_DETECT_FEM_OFF + i].name, "%s female %s", + "detected", buf); + Sprintf(tilemap[GLYPH_RIDDEN_FEM_OFF + i].name, "%s female %s", + "ridden", buf); + Sprintf(tilemap[GLYPH_BODY_OFF + i].name, "%s %s", "body of", buf); + Sprintf(tilemap[GLYPH_BODY_PILETOP_OFF + i].name, "%s %s", + "piletop body of", buf); + add_tileref(tilenum, GLYPH_MON_FEM_OFF + i, monsters_file, + file_entry, tilemap[GLYPH_MON_FEM_OFF + i].name, ""); + add_tileref(tilenum, GLYPH_PET_FEM_OFF + i, monsters_file, + file_entry, tilemap[GLYPH_PET_FEM_OFF + i].name, ""); + add_tileref(tilenum, GLYPH_DETECT_FEM_OFF + i, monsters_file, + file_entry, tilemap[GLYPH_DETECT_FEM_OFF + i].name, ""); + add_tileref(tilenum, GLYPH_RIDDEN_FEM_OFF + i, monsters_file, + file_entry, tilemap[GLYPH_RIDDEN_FEM_OFF + i].name, ""); + add_tileref(corpsetile, GLYPH_BODY_OFF + i, objects_file, CORPSE, + tilemap[GLYPH_BODY_OFF + i].name, ""); + add_tileref(corpsetile, GLYPH_BODY_PILETOP_OFF + i, objects_file, + corpsetile, tilemap[GLYPH_BODY_PILETOP_OFF + i].name, ""); +#endif + for (condnum = 0; conditionals[condnum].sequence != -1; condnum++) { if (conditionals[condnum].sequence == MON_GLYPH && conditionals[condnum].predecessor == i) { - tilenum += 2; + tilenum += 2; /* male and female */ file_entry += 2; -#ifdef OBTAIN_TILEMAP +#if defined(OBTAIN_TILEMAP) Fprintf(tilemap_file, "skipping monst %s (%d)\n", tilename(MON_GLYPH, file_entry, 0), file_entry); #endif } } - tilenum += 2; /* male + female tiles for each */ - file_entry += 2; + tilenum++; /* male + female tiles for each */ + file_entry++; } - tilemap[GLYPH_INVISIBLE].tilenum = tilenum++; - file_entry++; -#ifdef OBTAIN_TILEMAP - Sprintf(tilemap[GLYPH_INVISIBLE].name, - "%s (%d)", "invisible mon", file_entry); + tilemap[GLYPH_INVISIBLE].tilenum = tilenum; +#if defined(OBTAIN_TILEMAP) + Sprintf(tilemap[GLYPH_INVISIBLE].name, "%s (mnum=%d)", "invisible mon", + file_entry); + add_tileref(tilenum, GLYPH_INVISIBLE, monsters_file, + file_entry, tilemap[GLYPH_INVISIBLE].name, "invisible "); #endif - lastmontile = tilenum - 1; + lastmontile = tilenum; + tilenum++; + file_entry++; /* non-productive, but in case something ever gets + inserted right below here ahead of objects */ + /* start of objects */ file_entry = 0; for (i = 0; i < NUM_OBJECTS; i++) { tilemap[GLYPH_OBJ_OFF + i].tilenum = tilenum; -#ifdef OBTAIN_TILEMAP - Sprintf(tilemap[GLYPH_OBJ_OFF + i].name, "%s (%d)", - tilename(OBJ_GLYPH, file_entry, 0), file_entry); + tilemap[GLYPH_OBJ_PILETOP_OFF + i].tilenum = tilenum; +#if defined(OBTAIN_TILEMAP) + Snprintf(tilemap[GLYPH_OBJ_OFF + i].name, + sizeof tilemap[GLYPH_OBJ_OFF + i].name, + "%s (onum=%d)", + tilename(OBJ_GLYPH, file_entry, 0), i); + Snprintf(tilemap[GLYPH_OBJ_PILETOP_OFF + i].name, + sizeof tilemap[GLYPH_OBJ_PILETOP_OFF + i].name, + "%s %s (onum=%d)", + "piletop" ,tilename(OBJ_GLYPH, file_entry, 0), i); + add_tileref(tilenum, GLYPH_OBJ_OFF + i, + objects_file, file_entry, + tilemap[GLYPH_OBJ_OFF + i].name, ""); + add_tileref(tilenum, GLYPH_OBJ_PILETOP_OFF + i, + objects_file, file_entry, + tilemap[GLYPH_OBJ_PILETOP_OFF + i].name, ""); #endif for (condnum = 0; conditionals[condnum].sequence != -1; condnum++) { if (conditionals[condnum].sequence == OBJ_GLYPH && conditionals[condnum].predecessor == i) { tilenum++; file_entry++; -#ifdef OBTAIN_TILEMAP +#if defined(OBTAIN_TILEMAP) Fprintf(tilemap_file, "skipping obj %s (%d)\n", tilename(OBJ_GLYPH, file_entry, 0), file_entry); #endif @@ -430,41 +804,141 @@ init_tilemap(void) lastobjtile = tilenum - 1; file_entry = 0; - for (i = 0; i < (MAXPCHARS - MAXEXPCHARS); i++) { - tilemap[GLYPH_CMAP_OFF + i].tilenum = tilenum; -#ifdef OBTAIN_TILEMAP - Sprintf(tilemap[GLYPH_CMAP_OFF + i].name, "cmap %s (%d)", - tilename(OTH_GLYPH, file_entry, 0), file_entry); + /* S_stone */ + cmap = S_stone; + precheck((GLYPH_CMAP_STONE_OFF), "stone"); + tilemap[GLYPH_CMAP_STONE_OFF].tilenum = tilenum; +#if defined(OBTAIN_TILEMAP) + Snprintf(tilemap[GLYPH_CMAP_STONE_OFF].name, + sizeof tilemap[0].name, + "%s (cmap=%d)", + tilename(OTH_GLYPH, file_entry, 0), + cmap); + add_tileref(tilenum, GLYPH_CMAP_STONE_OFF, + other_file, file_entry, + tilemap[GLYPH_CMAP_STONE_OFF].name, ""); #endif - tilenum++; - file_entry++; - for (condnum = 0; conditionals[condnum].sequence != -1; condnum++) { - if (conditionals[condnum].sequence == OTH_GLYPH - && conditionals[condnum].predecessor == i) { - tilenum++; - file_entry++; -#ifdef OBTAIN_TILEMAP - Fprintf(tilemap_file, "skipping cmap %s (%d)\n", - tilename(OTH_GLYPH, file_entry, 0), file_entry); + TILE_stone = tilenum; /* Used to init nul_glyphinfo tileidx entry */ + tilenum++; + file_entry++; + + /* walls in the main dungeon */ + for (k = main_walls; k < mines_walls; k++) { + offset = wall_offsets[k]; + for (cmap = S_vwall; cmap <= S_trwall; cmap++) { + i = cmap - S_vwall; + precheck(offset + i, "walls"); + tilemap[offset + i].tilenum = tilenum; +#if defined(OBTAIN_TILEMAP) + Snprintf(tilemap[offset + i].name, + sizeof tilemap[0].name, + "%s (cmap=%d)", + tilename(OTH_GLYPH, file_entry, 0), + cmap); + add_tileref(tilenum, offset + i, other_file, file_entry, + tilemap[offset + i].name, ""); #endif + for (condnum = 0; conditionals[condnum].sequence != -1; + condnum++) { + if (conditionals[condnum].sequence == OTH_GLYPH + && conditionals[condnum].predecessor == cmap) { + tilenum++; + file_entry++; +#if defined(OBTAIN_TILEMAP) + Fprintf(tilemap_file, "skipping cmap %s (%d) (%d)\n", + tilename(OTH_GLYPH, file_entry, 0), file_entry, + cmap); +#endif + } } + tilenum++; + file_entry++; } } - for (i = 0; i < (MAXEXPCHARS * EXPL_MAX); i++) { - tilemap[GLYPH_EXPLODE_OFF + i].tilenum = tilenum; -#ifdef OBTAIN_TILEMAP - Sprintf(tilemap[GLYPH_EXPLODE_OFF + i].name, "explosion %s (%d)", - tilename(OTH_GLYPH, file_entry, 0), file_entry); + /* cmap A */ + for (cmap = S_ndoor; cmap <= S_brdnladder; cmap++) { + i = cmap - S_ndoor; + precheck((GLYPH_CMAP_A_OFF + i), "cmap A"); + tilemap[GLYPH_CMAP_A_OFF + i].tilenum = tilenum; +#if defined(OBTAIN_TILEMAP) + Snprintf(tilemap[GLYPH_CMAP_A_OFF + i].name, + sizeof tilemap[0].name, + "cmap A %s (cmap=%d)", + tilename(OTH_GLYPH, file_entry, 0), cmap); + add_tileref(tilenum, GLYPH_CMAP_A_OFF + i, other_file, file_entry, + tilemap[GLYPH_CMAP_A_OFF + i].name, ""); #endif for (condnum = 0; conditionals[condnum].sequence != -1; condnum++) { if (conditionals[condnum].sequence == OTH_GLYPH - && conditionals[condnum].predecessor == i + MAXPCHARS) { + && conditionals[condnum].predecessor == cmap) { tilenum++; file_entry++; -#ifdef OBTAIN_TILEMAP - Fprintf(tilemap_file, "skipping explosion %s (%d)\n", - tilename(OTH_GLYPH, file_entry, 0), file_entry); +#if defined(OBTAIN_TILEMAP) + Fprintf(tilemap_file, "skipping cmap A %s (%d) (%d)\n", + tilename(OTH_GLYPH, file_entry, 0), file_entry, cmap); +#endif + } + } + if (cmap == S_corr) + TILE_corr = tilenum; /* X11 references this tile during tile init */ + tilenum++; + file_entry++; + } + + /* Altars */ + cmap = S_altar; + j = 0; + for (k = altar_unaligned; k <= shrine; k++) { + offset = GLYPH_ALTAR_OFF + j; + precheck((offset), "altar"); + tilemap[offset].tilenum = tilenum; +#if defined(OBTAIN_TILEMAP) + Snprintf(tilemap[offset].name, + sizeof tilemap[0].name, + "%s %s (cmap=%d)", + altar_text[j], tilename(OTH_GLYPH, file_entry, 0), cmap); + add_tileref(tilenum, offset, other_file, file_entry, + tilemap[offset].name, ""); +#endif + for (condnum = 0; conditionals[condnum].sequence != -1; condnum++) { + if (conditionals[condnum].sequence == OTH_GLYPH + && conditionals[condnum].predecessor == cmap) { +#if defined(OBTAIN_TILEMAP) + Fprintf(tilemap_file, "skipping %s %s (%d)\n", + altar_text[j], + tilename(OTH_GLYPH, file_entry, 0), cmap); +#endif + tilenum++; + file_entry++; + } + } + j++; + tilenum++; + file_entry++; + } + + /* cmap B */ + for (cmap = S_grave; cmap <= S_vibrating_square; cmap++) { + i = cmap - S_grave; + precheck((GLYPH_CMAP_B_OFF + i), "cmap B"); + tilemap[GLYPH_CMAP_B_OFF + i].tilenum = tilenum; +#if defined(OBTAIN_TILEMAP) + Snprintf(tilemap[GLYPH_CMAP_B_OFF + i].name, + sizeof tilemap[0].name, + "%s (cmap=%d)", + tilename(OTH_GLYPH, file_entry, 0), cmap); + add_tileref(tilenum, GLYPH_CMAP_B_OFF + i, other_file, file_entry, + tilemap[GLYPH_CMAP_B_OFF + i].name, ""); +#endif + for (condnum = 0; conditionals[condnum].sequence != -1; condnum++) { + if (conditionals[condnum].sequence == OTH_GLYPH + && conditionals[condnum].predecessor == cmap) { + tilenum++; + file_entry++; +#if defined(OBTAIN_TILEMAP) + Fprintf(tilemap_file, "skipping cmap %s (%d) (%d)\n", + tilename(OTH_GLYPH, file_entry, 0), file_entry, cmap); #endif } } @@ -472,18 +946,57 @@ init_tilemap(void) file_entry++; } + /* zaps */ +#if 0 + for (k = 0; k < NUM_ZAP; k++) { + offset = GLYPH_ZAP_OFF + (k * ((S_rslant - S_vbeam) + 1)); + for (cmap = S_vbeam; cmap <= S_rslant; cmap++) { + i = cmap - S_vbeam; + precheck((offset + i), "zaps"); + tilemap[offset + i].tilenum = tilenum; +#if defined(OBTAIN_TILEMAP) + Snprintf(tilemap[offset + i].name, + sizeof tilemap[0].name, + "%s (%d) (%d)", + tilename(OTH_GLYPH, file_entry, 0), file_entry, cmap); + add_tileref(tilenum, offset + i, other_file, file_entry, + tilemap[offset + i].name, ""); +#endif + for (condnum = 0; conditionals[condnum].sequence != -1; + condnum++) { + if (conditionals[condnum].sequence == OTH_GLYPH + && conditionals[condnum].predecessor == cmap) { +#if defined(OBTAIN_TILEMAP) + Fprintf(tilemap_file, "skipping zap %s (%d) (%d)\n", + tilename(OTH_GLYPH, file_entry, 0), file_entry, + cmap); +#endif + file_entry++; + tilenum++; + } + + } + tilenum++; + file_entry++; + } + } +#else for (i = 0; i < NUM_ZAP << 2; i++) { tilemap[GLYPH_ZAP_OFF + i].tilenum = tilenum; -#ifdef OBTAIN_TILEMAP - Sprintf(tilemap[GLYPH_ZAP_OFF + i].name, "zap %s (%d)", - tilename(OTH_GLYPH, file_entry, 0), file_entry); +#if defined(OBTAIN_TILEMAP) + Snprintf(tilemap[GLYPH_ZAP_OFF + i].name, + sizeof tilemap[0].name, + "zap %s (cmap=%d)", + tilename(OTH_GLYPH, file_entry, 0), (i >> 2)); + add_tileref(tilenum, GLYPH_ZAP_OFF + i, other_file, file_entry, + tilemap[GLYPH_ZAP_OFF + i].name, ""); #endif tilenum++; file_entry++; for (condnum = 0; conditionals[condnum].sequence != -1; condnum++) { if (conditionals[condnum].sequence == OTH_GLYPH && conditionals[condnum].predecessor == (i + MAXEXPCHARS)) { -#ifdef OBTAIN_TILEMAP +#if defined(OBTAIN_TILEMAP) Fprintf(tilemap_file, "skipping zap %s (%d)\n", tilename(OTH_GLYPH, file_entry, 0), file_entry); #endif @@ -492,168 +1005,277 @@ init_tilemap(void) } } } +#endif + + /* cmap C */ + for (cmap = S_digbeam; cmap <= S_goodpos; cmap++) { + i = cmap - S_digbeam; + precheck((GLYPH_CMAP_C_OFF + i), "cmap C"); + tilemap[GLYPH_CMAP_C_OFF + i].tilenum = tilenum; +#if defined(OBTAIN_TILEMAP) + Snprintf(tilemap[GLYPH_CMAP_C_OFF + i].name, + sizeof tilemap[0].name, + "%s (cmap=%d)", + tilename(OTH_GLYPH, file_entry, 0), cmap); + add_tileref(tilenum, GLYPH_CMAP_C_OFF + i, other_file, file_entry, + tilemap[GLYPH_CMAP_C_OFF + i].name, ""); +#endif + for (condnum = 0; conditionals[condnum].sequence != -1; condnum++) { + if (conditionals[condnum].sequence == OTH_GLYPH + && conditionals[condnum].predecessor == cmap) { + tilenum++; + file_entry++; +#if defined(OBTAIN_TILEMAP) + Fprintf(tilemap_file, "skipping cmap %s (%d) (%d)\n", + tilename(OTH_GLYPH, file_entry, 0), file_entry, cmap); +#endif + } + } + tilenum++; + file_entry++; + } + /* swallow */ + const char *swallow_text[] = { + "swallow top left", "swallow top center", + "swallow top right", "swallow middle left", + "swallow middle right", "swallow bottom left", + "swallow bottom center", "swallow bottom right", + }; + + offset = GLYPH_SWALLOW_OFF; + for (k = 0; k < NUMMONS; k++) { +// if (k == 0) { +// swallowbase = tilenum; +// } + for (cmap = S_sw_tl; cmap <= S_sw_br; cmap++) { + i = cmap - S_sw_tl; + precheck((offset + i), "swallows"); + tilemap[offset + i].tilenum = swallowbase + i; +#if defined(OBTAIN_TILEMAP) + Snprintf(tilemap[offset + i].name, + sizeof tilemap[0].name, + "%s %s (cmap=%d)", + swallow_text[i], + mons[k].pmnames[NEUTRAL], cmap); + add_tileref(swallowbase + i, offset + i, + other_file, file_entry + i, + tilemap[offset + i].name, ""); +#endif + } + offset += ((S_sw_br - S_sw_tl) + 1); + } + tilenum += ((S_sw_br - S_sw_tl) + 1); + file_entry += ((S_sw_br - S_sw_tl) + 1); + + /* explosions */ + for (k = expl_dark; k <= expl_frosty; k++) { + offset = expl_offsets[k]; + for (cmap = S_expl_tl; cmap <= S_expl_br; cmap++) { + i = cmap - S_expl_tl; + precheck((offset + i), "explosions"); + tilemap[offset + i].tilenum = tilenum; +#if defined(OBTAIN_TILEMAP) + Snprintf(tilemap[offset + i].name, + sizeof tilemap[0].name, + "%s (cmap=%d)", + tilename(OTH_GLYPH, file_entry, 0), cmap); + add_tileref(tilenum, offset + i, other_file, file_entry, + tilemap[offset + i].name, ""); +#endif + + for (condnum = 0; conditionals[condnum].sequence != -1; + condnum++) { + if (conditionals[condnum].sequence == OTH_GLYPH + && conditionals[condnum].predecessor == cmap) { +#if defined(OBTAIN_TILEMAP) + Fprintf(tilemap_file, "skipping cmap %s (%d)\n", + tilename(OTH_GLYPH, file_entry, 0), cmap); +#endif + tilenum++; + file_entry++; + } + } + tilenum++; + file_entry++; + } + } for (i = 0; i < WARNCOUNT; i++) { + precheck((GLYPH_WARNING_OFF + i), "warnings"); tilemap[GLYPH_WARNING_OFF + i].tilenum = tilenum; -#ifdef OBTAIN_TILEMAP - Sprintf(tilemap[GLYPH_WARNING_OFF + i].name, "%s (%d)", - tilename(OTH_GLYPH, file_entry, 0), file_entry); +#if defined(OBTAIN_TILEMAP) + Snprintf(tilemap[GLYPH_WARNING_OFF + i].name, + sizeof tilemap[0].name, + "%s (warn=%d)", + tilename(OTH_GLYPH, file_entry, 0), file_entry); + add_tileref(tilenum, GLYPH_WARNING_OFF + i, other_file, file_entry, + tilemap[GLYPH_WARNING_OFF + i].name, ""); #endif tilenum++; file_entry++; } for (i = 0; i < 1; i++) { + precheck((GLYPH_UNEXPLORED_OFF + i), "unexplored"); tilemap[GLYPH_UNEXPLORED_OFF + i].tilenum = tilenum; -#ifdef OBTAIN_TILEMAP - Sprintf(tilemap[GLYPH_UNEXPLORED_OFF + i].name, "unexplored %s (%d)", - tilename(OTH_GLYPH, file_entry, 0), file_entry); +#if defined(OBTAIN_TILEMAP) + Snprintf(tilemap[GLYPH_UNEXPLORED_OFF + i].name, + sizeof tilemap[0].name, + "unexplored %s (%d)", + tilemap[GLYPH_UNEXPLORED_OFF + i].name, file_entry); + add_tileref(tilenum, GLYPH_UNEXPLORED_OFF + i, other_file, file_entry, + tilemap[GLYPH_UNEXPLORED_OFF + i].name, ""); #endif + TILE_unexplored = tilenum; /* for writing into tiledef.h */ tilenum++; file_entry++; } for (i = 0; i < 1; i++) { + precheck(GLYPH_NOTHING + i, "nothing"); tilemap[GLYPH_NOTHING + i].tilenum = tilenum; -#ifdef OBTAIN_TILEMAP - Sprintf(tilemap[GLYPH_NOTHING + i].name, " nothing %s (%d)", - tilename(OTH_GLYPH, file_entry, 0), file_entry); +#if defined(OBTAIN_TILEMAP) + Snprintf(tilemap[GLYPH_NOTHING + i].name, + sizeof tilemap[0].name, + " nothing %s (%d)", + tilename(OTH_GLYPH, file_entry, 0), file_entry); + add_tileref(tilenum, GLYPH_NOTHING + i, other_file, file_entry, + tilemap[GLYPH_NOTHING + i].name, ""); #endif + TILE_nothing = tilenum; /* for writing into tiledef.h */ tilenum++; file_entry++; } + /* other walls beyond the main walls */ + for (k = mines_walls; k <= sokoban_walls; k++) { + offset = wall_offsets[k]; + for (cmap = S_vwall; cmap <= S_trwall; cmap++) { + i = cmap - S_vwall; + precheck(offset + i, "walls"); + tilemap[offset + i].tilenum = tilenum; +#if defined(OBTAIN_TILEMAP) + Snprintf(tilemap[offset + i].name, + sizeof tilemap[0].name, + "%s (cmap=%d)", + tilename(OTH_GLYPH, file_entry, 0), + cmap); + add_tileref(tilenum, offset + i, other_file, file_entry, + tilemap[offset + i].name, ""); +#endif + for (condnum = 0; conditionals[condnum].sequence != -1; condnum++) { + if (conditionals[condnum].sequence == OTH_GLYPH + && conditionals[condnum].predecessor == cmap) { + tilenum++; + file_entry++; +#if defined(OBTAIN_TILEMAP) + Fprintf(tilemap_file, "skipping cmap %s (%d) (%d)\n", + tilename(OTH_GLYPH, file_entry, 0), file_entry, cmap); +#endif + } + } + tilenum++; + file_entry++; + } + } #ifdef STATUES_DONT_LOOK_LIKE_MONSTERS /* statue patch: statues still use the same glyph as in 3.4.x */ for (i = 0; i < NUMMONS; i++) { - tilemap[GLYPH_STATUE_OFF + i].tilenum - = tilemap[GLYPH_OBJ_OFF + STATUE].tilenum; + tilemap[GLYPH_STATUE_OFF + i].tilenum = + tilemap[GLYPH_OBJ_OFF + STATUE].tilenum; #ifdef OBTAIN_TILEMAP - Sprintf(tilemap[GLYPH_STATUE_OFF + i].name, "%s (%d)", - tilename(OTH_GLYPH, file_entry, 0), file_entry); + Snprintf(tilemap[GLYPH_STATUE_OFF + i].name, + sizeof tilemap[0].name, + "%s (%d)", + tilename(OTH_GLYPH, file_entry, 0), file_entry); #endif } #endif - lastothtile = tilenum - 1; #ifndef STATUES_DONT_LOOK_LIKE_MONSTERS + /* STATUES _DO_ LOOK LIKE MONSTERS */ file_entry = 0; - /* fast-forward over the substitutes to grayscale statues loc */ - for (i = 0; i < SIZE(substitutes); i++) { - tilenum += substitutes[i].last_glyph - substitutes[i].first_glyph + 1; - } - /* statue patch: statues look more like the monster */ for (i = 0; i < NUMMONS; i++) { - tilemap[GLYPH_STATUE_OFF + i].tilenum = tilenum; -#ifdef OBTAIN_TILEMAP - Sprintf(tilemap[GLYPH_STATUE_OFF + i].name, "statue of %s (%d)", + precheck(GLYPH_STATUE_MALE_OFF + i, "male statues"); + tilemap[GLYPH_STATUE_MALE_OFF + i].tilenum = tilenum; + precheck(GLYPH_STATUE_MALE_PILETOP_OFF + i, "male statue piletop"); + tilemap[GLYPH_STATUE_MALE_PILETOP_OFF + i].tilenum = tilenum; +#if defined(OBTAIN_TILEMAP) + Snprintf(tilemap[GLYPH_STATUE_MALE_OFF + i].name, + sizeof tilemap[0].name, + "statue of male %s (mnum=%d)", tilename(MON_GLYPH, file_entry, 0), file_entry); + Snprintf(tilemap[GLYPH_STATUE_MALE_PILETOP_OFF + i].name, + sizeof tilemap[0].name, + "piletop statue of male %s (mnum=%d)", + tilename(MON_GLYPH, file_entry, 0), file_entry); + add_tileref(tilenum, GLYPH_STATUE_MALE_OFF + i, generated, file_entry, + tilemap[GLYPH_STATUE_MALE_OFF + i].name, + ""); + add_tileref(tilenum, GLYPH_STATUE_MALE_PILETOP_OFF + i, generated, + file_entry, + tilemap[GLYPH_STATUE_MALE_PILETOP_OFF + i].name, + ""); +#endif + tilenum++; + file_entry++; + precheck(GLYPH_STATUE_FEM_OFF + i, "female statues"); + tilemap[GLYPH_STATUE_FEM_OFF + i].tilenum = tilenum; + precheck(GLYPH_STATUE_FEM_PILETOP_OFF + i, "female statue piletop"); + tilemap[GLYPH_STATUE_FEM_PILETOP_OFF + i].tilenum = tilenum; +#if defined(OBTAIN_TILEMAP) + Snprintf(tilemap[GLYPH_STATUE_FEM_OFF + i].name, + sizeof tilemap[0].name, + "statue of female %s (mnum=%d)", + tilename(MON_GLYPH, file_entry, 0), file_entry); + Sprintf(tilemap[GLYPH_STATUE_FEM_PILETOP_OFF + i].name, + "piletop statue of female %s (mnum=%d)", + tilename(MON_GLYPH, file_entry, 0), file_entry); + add_tileref(tilenum, GLYPH_STATUE_FEM_OFF + i, generated, file_entry, + tilemap[GLYPH_STATUE_FEM_OFF + i].name, ""); + add_tileref(tilenum, GLYPH_STATUE_FEM_PILETOP_OFF + i, generated, + file_entry, + tilemap[GLYPH_STATUE_FEM_PILETOP_OFF + i].name, ""); #endif for (condnum = 0; conditionals[condnum].sequence != -1; condnum++) { if (conditionals[condnum].sequence == MON_GLYPH && conditionals[condnum].predecessor == i) { - file_entry += 2; /* skip female tile too */ + file_entry += 2; /* skip female tile too */ tilenum += 2; -#ifdef OBTAIN_TILEMAP +#if defined(OBTAIN_TILEMAP) Fprintf(tilemap_file, "skipping statue of %s (%d)\n", tilename(MON_GLYPH, file_entry, 0), file_entry); #endif } } - tilenum += 2; - file_entry += 2; + tilenum++; + file_entry++; } - laststatuetile = tilenum - 2; + /* go beyond NUMMONS to cover off the invisible tile at the + end of monsters.txt so that the tile mapping matches things + the .bmp file (for example) */ + file_entry = 0; +#if defined(OBTAIN_TILEMAP) + add_tileref(tilenum, NO_GLYPH, monsters_file, file_entry, + "invisible statue", ""); +#endif + laststatuetile = tilenum - 1; #endif /* STATUES_DONT_LOOK_LIKE_MONSTERS */ -#ifdef OBTAIN_TILEMAP + +#if defined(OBTAIN_TILEMAP) for (i = 0; i < MAX_GLYPH; ++i) { - Fprintf(tilemap_file, "[%04d] [%04d] %-80s\n", - i, tilemap[i].tilenum, tilemap[i].name); + Fprintf(tilemap_file, "glyph[%04d] [%04d] %-80s\n", i, tilemap[i].tilenum, + tilemap[i].name); } + dump_tilerefs(tilemap_file); fclose(tilemap_file); #endif } -const char *prolog[] = { "", "void", "substitute_tiles(d_level *plev)", - "{", " int i;", "" }; - -const char *epilog[] = { " return;", "}" }; - -/* write out the substitutions in an easily-used form. */ -void -process_substitutions(FILE *ofp) -{ - static const char Dent[] = " "; /* 4 space indentation */ - int i, j, k, span, start; - - Fprintf(ofp, "\n"); - - j = 0; /* unnecessary */ - span = -1; - for (i = 0; i < SIZE(substitutes); i++) { - if (i == 0 || substitutes[i].first_glyph != substitutes[j].first_glyph - || substitutes[i].last_glyph != substitutes[j].last_glyph) { - j = i; - span++; - Fprintf(ofp, "short std_tiles%d[] = { ", span); - for (k = substitutes[i].first_glyph; - k < substitutes[i].last_glyph; k++) - Fprintf(ofp, "%d, ", tilemap[k].tilenum); - Fprintf(ofp, "%d };\n", tilemap[substitutes[i].last_glyph].tilenum); - } - } - - for (i = 0; i < SIZE(prolog); i++) { - Fprintf(ofp, "%s\n", prolog[i]); - } - j = -1; - span = -1; - start = lastothtile + 1; - for (i = 0; i < SIZE(substitutes); i++) { - if (i == 0 || substitutes[i].first_glyph != substitutes[j].first_glyph - || substitutes[i].last_glyph != substitutes[j].last_glyph) { - if (i != 0) { /* finish previous span */ - Fprintf(ofp, "%s} else {\n", Dent); - Fprintf(ofp, "%s%sfor (i = %d; i <= %d; i++)\n", Dent, Dent, - substitutes[j].first_glyph, substitutes[j].last_glyph); - Fprintf(ofp, "%s%s%sglyph2tile[i] = std_tiles%d[i - %d];\n", - Dent, Dent, Dent, span, substitutes[j].first_glyph); - Fprintf(ofp, "%s}\n\n", Dent); - } - j = i; - span++; - } - Fprintf(ofp, "%s%sif (%s) {\n", Dent, (i == j) ? "" : "} else ", - substitutes[i].level_test); - Fprintf(ofp, "%s%sfor (i = %d; i <= %d; i++)\n", Dent, Dent, - substitutes[i].first_glyph, substitutes[i].last_glyph); - Fprintf(ofp, "%s%s%sglyph2tile[i] = %d + i - %d;\n", - Dent, Dent, Dent, start, substitutes[i].first_glyph); - start += substitutes[i].last_glyph - substitutes[i].first_glyph + 1; - } - /* finish last span */ - Fprintf(ofp, "%s} else {\n", Dent); - Fprintf(ofp, "%s%sfor (i = %d; i <= %d; i++)\n", Dent, Dent, - substitutes[j].first_glyph, substitutes[j].last_glyph); - Fprintf(ofp, "%s%s%sglyph2tile[i] = std_tiles%d[i - %d];\n", - Dent, Dent, Dent, span, substitutes[j].first_glyph); - Fprintf(ofp, "%s}\n", Dent); - - for (i = 0; i < SIZE(epilog); i++) { - Fprintf(ofp, "%s\n", epilog[i]); - } - - lastothtile = start - 1; -#ifndef STATUES_DONT_LOOK_LIKE_MONSTERS - start = laststatuetile + 1; -#endif - Fprintf(ofp, "\nint total_tiles_used = %d;\n", start); -} - -#ifdef OBTAIN_TILEMAP +#if defined(OBTAIN_TILEMAP) extern void monst_globals_init(void); extern void objects_globals_init(void); #endif @@ -663,11 +1285,12 @@ DISABLE_WARNING_UNREACHABLE_CODE int main(int argc UNUSED, char *argv[] UNUSED) { - register int i; + int i, tilenum; char filename[30]; FILE *ofp; + const char indent[] = " "; -#ifdef OBTAIN_TILEMAP +#if defined(OBTAIN_TILEMAP) objects_globals_init(); monst_globals_init(); #endif @@ -677,7 +1300,7 @@ main(int argc UNUSED, char *argv[] UNUSED) /* * create the source file, "tile.c" */ - Sprintf(filename, SOURCE_TEMPLATE, TILE_FILE); + Snprintf(filename, sizeof filename, SOURCE_TEMPLATE, TILE_FILE); if (!(ofp = fopen(filename, "w"))) { perror(filename); exit(EXIT_FAILURE); @@ -685,26 +1308,34 @@ main(int argc UNUSED, char *argv[] UNUSED) Fprintf(ofp, "/* This file is automatically generated. Do not edit. */\n"); Fprintf(ofp, "\n#include \"hack.h\"\n"); - Fprintf(ofp, "\nshort glyph2tile[MAX_GLYPH] = {\n"); + Fprintf(ofp, "\nint total_tiles_used = %d,\n", laststatuetile + 1); + Fprintf(ofp, "%sTile_corr = %d,\n", indent, TILE_corr); /* X11 references it */ + Fprintf(ofp, "%sTile_stone = %d,\n", indent, TILE_stone); + Fprintf(ofp, "%sTile_unexplored = %d;\n\n", indent, TILE_unexplored); + Fprintf(ofp, "/* glyph, ttychar, { color, symidx, ovidx, glyphflags, tileidx} */\n"); + Fprintf(ofp, "const glyph_info nul_glyphinfo = { \n"); + Fprintf(ofp, "%sNO_GLYPH, ' ',\n", indent); + Fprintf(ofp, "%s%s{ /* glyph_map */\n", indent, indent); + Fprintf(ofp, "%s%s%sNO_COLOR, SYM_UNEXPLORED + SYM_OFF_X,\n", + indent, indent, indent); + Fprintf(ofp, "%s%s%sMG_UNEXPL, %d\n", indent, indent, indent, TILE_unexplored); + Fprintf(ofp, "%s%s}\n", indent, indent); + Fprintf(ofp, "};\n"); + Fprintf(ofp, "\nglyph_map glyphmap[MAX_GLYPH] = {\n"); for (i = 0; i < MAX_GLYPH; i++) { - Fprintf(ofp, " %4d,", tilemap[i].tilenum); - if ((i % 12) == 11 || i == MAX_GLYPH - 1) - Fprintf(ofp, "\n"); + tilenum = tilemap[i].tilenum; + Fprintf(ofp, " { 0, 0, 0U, %4d }, /* [%04d] %s=%03d %s */\n", + tilenum, i, + tilesrc_texts[tilelist[tilenum]->src], + tilelist[tilenum]->file_entry, + tilemap[i].name); } Fprintf(ofp, "};\n"); - - process_substitutions(ofp); - - Fprintf(ofp, "\n#define MAXMONTILE %d\n", lastmontile); - Fprintf(ofp, "#define MAXOBJTILE %d\n", lastobjtile); - Fprintf(ofp, "#define MAXOTHTILE %d\n", lastothtile); -#ifndef STATUES_DONT_LOOK_LIKE_MONSTERS - Fprintf(ofp, "/* #define MAXSTATUETILE %d */\n", laststatuetile); -#endif Fprintf(ofp, "\n/*tile.c*/\n"); (void) fclose(ofp); + free_tilerefs(); exit(EXIT_SUCCESS); /*NOTREACHED*/ return 0; @@ -714,35 +1345,165 @@ RESTORE_WARNINGS #endif /* TILETEXT */ -struct { - int idx; - const char *tilelabel; - const char *expectedlabel; -} altlabels[MAXPCHARS] = { -#define PCHAR_TILES -#include "defsym.h" -#undef PCHAR_TILES -}; - boolean acceptable_tilename(int glyph_set, int idx, const char *encountered, - const char *expected UNUSED) + const char *expected) { + int i; + size_t a, b; + char buf[BUFSZ]; + const char *pastprefix = encountered; + struct aliaslist { + const char *original; + const char *alias; + }; + struct aliaslist aliases[] = { + { "wall", "vertical wall" }, + { "wall", "horizontal wall" }, + { "wall", "top left corner wall" }, + { "wall", "top right corner wall" }, + { "wall", "bottom left corner wall" }, + { "wall", "bottom right corner wall" }, + { "open door", "vertical open door" }, + { "open door", "horizontal open door" }, + { "open door", "no door" }, + { "altar", "chaotic altar" }, + { "altar", "neutral altar" }, + { "altar", "lawful altar" }, + { "opulent throne", "throne" }, + { "water", "pool" }, + { "lowered drawbridge", "vertical open drawbridge" }, + { "lowered drawbridge", "horizontal open drawbridge" }, + { "raised drawbridge", "vertical closed drawbridge" }, + { "raised drawbridge", "horizontal closed drawbridge" }, + { "altar", "unaligned altar" }, + { "altar", "shrine" }, +#if 0 + { "dark part of a room", "stone" }, +#endif + }; + if (glyph_set == OTH_GLYPH) { if (idx >= 0 && idx < SIZE(altlabels)) { -#if 0 - if (!strcmp(altlabels[idx].expectedlabel, expected)) { - if (!strcmp(altlabels[idx].tilelabel, encountered)) + if (!strcmp(altlabels[idx].tilelabel, encountered)) + return TRUE; + } + a = strlen(encountered); + for (i = 0; i < SIZE(aliases); i++) { + if (!strcmp(pastprefix, aliases[i].alias)) + return TRUE; + pastprefix = encountered; + b = strlen(aliases[i].alias); + if (a > b) { + pastprefix = encountered + (a - b); + if (!strcmp(pastprefix, aliases[i].alias)) return TRUE; } -#else - if (!strcmp(altlabels[idx].tilelabel, encountered)) - return TRUE; -#endif + if (!strcmp(encountered, aliases[i].alias) + && !strcmp(expected, aliases[i].original)) { + return TRUE; + } } + Snprintf(buf, sizeof buf, "cmap tile %d", idx); + if (!strcmp(expected, buf)) + return TRUE; return FALSE; } return TRUE; } +#if defined(OBTAIN_TILEMAP) +void +precheck(int offset, const char *glyphtype) +{ + if (tilemap[offset].tilenum != -1) + Fprintf(stderr, "unexpected re-write of tile mapping [%s]\n", + glyphtype); +} + +void add_tileref(int n, int glyphref, enum tilesrc src, int entrynum, + const char *nam, const char *prefix) +{ + struct tiles_used temp = { 0 }; + static const char ellipsis[] UNUSED = "..."; + char buf[BUFSZ]; + + if (!tilelist[n]) { + tilelist[n] = malloc(sizeof temp); + tilelist[n]->tilenum = n; + tilelist[n]->src = src; + tilelist[n]->file_entry = entrynum; + /* leave room for trailing "...nnnn" */ + Snprintf(tilelist[n]->tilenam, sizeof tilelist[n]->tilenam - 7, + "%s%s", prefix, nam); + tilelist[n]->references[0] = '\0'; + } + Snprintf(temp.references, + sizeof temp.references - 7, /* room for "...nnnn" */ + "%s%s%d", tilelist[n]->references, + (tilelist[n]->references[0] != '\0') ? ", " : "", glyphref); + Snprintf(buf, sizeof buf, "...%4d", glyphref); + Snprintf(tilelist[n]->references, sizeof tilelist[n]->references, "%s%s", + temp.references, + (strlen(temp.references) >= (sizeof temp.references - 7) - 1) + ? buf + : ""); +} + +void +dump_tilerefs(FILE * fp) +{ + int i; + + Fprintf(fp, "\n"); + for (i = 0; i < SIZE(tilelist); i++) { + if (tilelist[i]) { + Fprintf(fp, "tile[%04d] %s[%04d] %-25s: %s\n", i, + tilesrc_texts[tilelist[i]->src], + tilelist[i]->file_entry, + tilelist[i]->tilenam, + tilelist[i]->references); + } + } +} + +void +free_tilerefs(void) +{ + int i; + + for (i = 0; i < SIZE(tilelist); i++) { + if (tilelist[i]) + free(tilelist[i]); + tilelist[i] = (struct tiles_used *) 0; + } +} + +#endif + + DISABLE_WARNING_FORMAT_NONLITERAL + +void +nh_snprintf(const char *func UNUSED, int line UNUSED, char *str, size_t size, + const char *fmt, ...) +{ + va_list ap; + int n; + + va_start(ap, fmt); +#ifdef NO_VSNPRINTF + n = vsprintf(str, fmt, ap); +#else + n = vsnprintf(str, size, fmt, ap); +#endif + va_end(ap); + + if (n < 0 || (size_t) n >= size) { /* is there a problem? */ + str[size - 1] = 0; /* make sure it is nul terminated */ + } +} + +RESTORE_WARNING_FORMAT_NONLITERAL + + /*tilemap.c*/ diff --git a/win/share/tiletext.c b/win/share/tiletext.c index 7df71ce31..c589d8e8d 100644 --- a/win/share/tiletext.c +++ b/win/share/tiletext.c @@ -50,9 +50,9 @@ static const int graymappings[] = { }; void -set_grayscale(int g) +set_grayscale(int gs) { - grayscale = g; + grayscale = gs; } static void diff --git a/win/tty/wintty.c b/win/tty/wintty.c index d9c0ef21d..1eaf4906b 100644 --- a/win/tty/wintty.c +++ b/win/tty/wintty.c @@ -40,7 +40,6 @@ extern void msmsg(const char *, ...); #define VT_ANSI_COMMAND 'z' #endif #ifdef TTY_TILES_ESCCODES -extern short glyph2tile[]; #define AVTC_GLYPH_START 0 #define AVTC_GLYPH_END 1 #define AVTC_SELECT_WINDOW 2 @@ -3359,7 +3358,7 @@ tty_print_glyph(winid window, xchar x, xchar y, { boolean inverse_on = FALSE; int ch, color; -#if defined(TTY_TILES_ESCCODES) || defined(MSDOS) +#if defined(TTY_TILES_ESCCODES) int glyph; #endif unsigned special; @@ -3372,19 +3371,19 @@ tty_print_glyph(winid window, xchar x, xchar y, } #endif /* get glyph ttychar, color, and special flags */ -#if defined(TTY_TILES_ESCCODES) || defined(MSDOS) +#if defined(TTY_TILES_ESCCODES) glyph = glyphinfo->glyph; #endif ch = glyphinfo->ttychar; - color = glyphinfo->color; - special = glyphinfo->glyphflags; + color = glyphinfo->gm.color; + special = glyphinfo->gm.glyphflags; print_vt_code2(AVTC_SELECT_WINDOW, window); /* Move the cursor. */ tty_curs(window, x, y); - print_vt_code3(AVTC_GLYPH_START, glyph2tile[glyph], special); + print_vt_code3(AVTC_GLYPH_START, glyphinfo->tileidx, special); #ifndef NO_TERMS if (ul_hack && ch == '_') { /* non-destructive underscore */ @@ -3424,7 +3423,7 @@ tty_print_glyph(winid window, xchar x, xchar y, #if defined(USE_TILES) && defined(MSDOS) if (iflags.grmode && iflags.tile_view) - xputg(glyph, ch, special); + xputg(glyphinfo); else #endif g_putch(ch); /* print the character */ diff --git a/win/win32/mhmap.c b/win/win32/mhmap.c index 85ba2da0a..6f13d2404 100644 --- a/win/win32/mhmap.c +++ b/win/win32/mhmap.c @@ -24,8 +24,6 @@ #define CURSOR_BLINK_INTERVAL 1000 // milliseconds #define CURSOR_HEIGHT 2 // pixels -extern short glyph2tile[]; - #define TILEBMP_X(ntile) \ ((ntile % GetNHApp()->mapTilesPerLine) * GetNHApp()->mapTile_X) #define TILEBMP_Y(ntile) \ @@ -825,7 +823,7 @@ paintTile(PNHMapWindow data, int i, int j, RECT * rect) } if (bkglyph != NO_GLYPH) { - ntile = glyph2tile[bkglyph]; + ntile = data->bkmap[i][j].gm.tileidx; t_x = TILEBMP_X(ntile); t_y = TILEBMP_Y(ntile); @@ -838,9 +836,7 @@ paintTile(PNHMapWindow data, int i, int j, RECT * rect) if ((glyph != NO_GLYPH) && (glyph != bkglyph)) { /* rely on NetHack core helper routine */ - ntile = glyph2tile[glyph]; - if (data->map[i][j].glyphflags & MG_FEMALE) - ntile++; + ntile = data->map[i][j].gm.tileidx; t_x = TILEBMP_X(ntile); t_y = TILEBMP_Y(ntile); @@ -861,7 +857,7 @@ paintTile(PNHMapWindow data, int i, int j, RECT * rect) } #ifdef USE_PILEMARK - if ((glyph != NO_GLYPH) && (data->map[i][j].glyphflags & MG_PET) + if ((glyph != NO_GLYPH) && (data->map[i][j].gm.glyphflags & MG_PET) #else if ((glyph != NO_GLYPH) && glyph_is_pet(glyph) #endif @@ -884,7 +880,7 @@ paintTile(PNHMapWindow data, int i, int j, RECT * rect) DeleteDC(hdcPetMark); } #ifdef USE_PILEMARK - if ((glyph != NO_GLYPH) && (data->map[i][j].glyphflags & MG_OBJPILE) + if ((glyph != NO_GLYPH) && (data->map[i][j].gm.glyphflags & MG_OBJPILE) && iflags.hilite_pile) { /* apply pilemark transparently over other image */ HDC hdcPileMark; @@ -934,9 +930,9 @@ paintGlyph(PNHMapWindow data, int i, int j, RECT * rect) OldFg = SetTextColor(hDC, nhcolor_to_RGB(color)); #else ch = (char) data->map[i][j].ttychar; - color = (int) data->map[i][j].color; - if (((data->map[i][j].glyphflags & MG_PET) && iflags.hilite_pet) - || ((data->map[i][j].glyphflags & (MG_DETECT | MG_BW_LAVA)) + color = (int) data->map[i][j].gm.color; + if (((data->map[i][j].gm.glyphflags & MG_PET) && iflags.hilite_pet) + || ((data->map[i][j].gm.glyphflags & (MG_DETECT | MG_BW_LAVA)) && iflags.use_inverse)) { back_brush = CreateSolidBrush(nhcolor_to_RGB(CLR_GRAY)); @@ -1004,8 +1000,9 @@ static void setGlyph(PNHMapWindow data, int i, int j, if ((data->map[i][j].glyph != fg->glyph) || (data->bkmap[i][j].glyph != bg->glyph) || data->map[i][j].ttychar != fg->ttychar - || data->map[i][j].color != fg->color - || data->map[i][j].glyphflags != fg->glyphflags) { + || data->map[i][j].gm.color != fg->gm.color + || data->map[i][j].gm.glyphflags != fg->gm.glyphflags + || data->map[i][j].gm.tileidx != fg->gm.tileidx) { data->map[i][j] = *fg; data->bkmap[i][j] = *bg; data->locDirty[i][j] = TRUE; diff --git a/win/win32/mhmenu.c b/win/win32/mhmenu.c index 6b3ce179a..17f9059bf 100644 --- a/win/win32/mhmenu.c +++ b/win/win32/mhmenu.c @@ -73,8 +73,6 @@ typedef struct mswin_nethack_menu_window { BOOL is_active; } NHMenuWindow, *PNHMenuWindow; -extern short glyph2tile[]; - static WNDPROC wndProcListViewOrig = NULL; static WNDPROC editControlWndProc = NULL; @@ -1087,7 +1085,7 @@ onDrawItem(HWND hWnd, WPARAM wParam, LPARAM lParam) monitorScale2 = win10_monitor_scale(hWnd); saveBmp = SelectObject(tileDC, GetNHApp()->bmpMapTiles); - ntile = glyph2tile[item->glyphinfo.glyph]; + ntile = item->glyphinfo.gm.tileidx; t_x = (ntile % GetNHApp()->mapTilesPerLine) * GetNHApp()->mapTile_X; t_y = diff --git a/win/win32/mswproc.c b/win/win32/mswproc.c index 15bda0b85..912078033 100644 --- a/win/win32/mswproc.c +++ b/win/win32/mswproc.c @@ -1136,7 +1136,7 @@ mswin_add_menu(winid wid, const glyph_info *glyphinfo, { boolean presel = ((itemflags & MENU_ITEMFLAGS_SELECTED) != 0); logDebug("mswin_add_menu(%d, %d, %u, %p, %c, %c, %d, %s, %u)\n", wid, - glyphinfo->glyph, glyphinfo->glyphflags, + glyphinfo->glyph, glyphinfo->gm.glyphflags, identifier, (char) accelerator, (char) group_accel, attr, str, itemflags); if ((wid >= 0) && (wid < MAXWINDOWS)