expand the glyphs

The walls for the mines, gehennom, knox, and sokoban had been
changed at the "tile"-level, with no awareness of the core game,
or non-tile interfaces.
- Expand the glyphs to include a set of walls for the main level
as well as each of those mentioned above.

Altars had been adjusted at the map_glyphinfo() level to substitute
some color variations on-the-fly for unaligned, chaotic, neutral,
lawful altars, and shrines. The tile interface had no awareness of
the feature.
- Expand the glyphs to include each of the altar variations that
had been implemented in the display code for tty-only. This required
the addition of four placeholder tiles in other.txt. Someone with
artistic skill will hopefully alter the additional tiles to better
reflect their intended purpose.

Explosions had unique tiles in the tile window port, and the display
code for tty tinkered with the colors, but the game had very little
awareness of the different types of explosions.
- Expand the glyphs to include each of the explosion types: dark,
noxious, muddy, wet, magical, fiery and frosty.

Pile-markers to represent a pile had been introduced at the
display-level, without little to no awareness by the core game.
- Expand the glyphs to include piletops, including objects,
bodys, and statues.

Recently male and female variations of tiles and monsters had been
had been introduced, but the mechanics had been mostly done at the
display-level through a marker flag. The window port interface then
had to increment the tile mapped to the glyph to get the female version
of the tile.
- Expand the glyphs to include the male and female versions of the
monsters, and their corresponding pet versions, ridden, detected
versions and statues of them.

Direct references to GLYPH_BODY_OFF and GLYPH_STATUE_OFF
in object_from_map() in pager.c were getting incomplete results.
- Add macros glyph_to_body_corpsenm(glyph) and
glyph_to_statue_corpsenm(glyph) macros for obtaining the corpsenm
value after passing the glyph_is_body() or glyph_is_statue() test.

Other relevant notes:

- The tile ordering in the win/share/*.txt tile files has been altered,
other.txt in particular.

- tilemap.c has had a lot of alterations to accommodate the expanded
glyphs. Output that is useful for troubleshooting will end up in
tilemappings.lst if OBTAIN_TILEMAP is defined during build.
It lists all of the glyphs and which tile it gets mapped to, and also
lists each tile and some of the references to it by various glyphs.

- An array glyphmap[MAXGLYPH] is now used. It has an entry for each
glyph, ordered by glyph, and once reset_glyphs(glyph) has been run, it
contains the mapped symindex, default color, glyphflags, and tile
index.
If USE_TILES is defined during build, the tile.c produced from the
tilemap utility populates the tileidx field of each array element with
a glyph-to-tile mapping for the glyph. Later on, when reset_glyphmap()
is run, the other fields of each element will get populated.

- The glyph-to-tile mapping is an added field available to a window
port via the glyphinfo struct passed in the documented interface. The
old glyph2tile[] array is gone. The various active window ports that
had been using glyph2tile[] have been updated to use the new interface
mechanism. Disclaimer: There may be some bug fixing or tidying
required in the window port code.

- reset_glyphmap() is called after config file options parsing
has finished, because some config file settings can impact the results
produced by reset_glyphmap().

- Everything that passes the glyph_is_cmap(glyph) test must
return a valid cmap value from glyph_to_cmap(glyph).

- An 'extern glyph_info glyphmap[MAX_GLYPH];' is inserted into the
top of only the files which need awareness of it, not inserted into
display.h. Presently, the only files that actually need to directly
reference the glyphmap[] array are display.c, o_init.c (for shuffling
the tiles), and the generated tile.c (if USE_TILES is defined).

- Added an MG_MALE glyphflag to complement the MG_FEMALE glyphflag.

- Provide an array for wall colorizations. reset_glyphmap() will draw
the colors from this array: int array wallcolors[sokoban_walls + 1];
The indices of the wallcolors array are main_walls (0), mines_walls
(1), gehennom_walls (2), knox_walls (3), and sokoban_walls (4).
In future, a config file option for adjusting the wall colors and/or
an 'O' option menu to do the same could be added. Right now, the
initializaton of the wallcolors[] array entries in display.c leaves the
walls at CLR_GRAY, matching the defsym color.

- Most of the display-level kludges for some of the on-the-fly
interface features have been removed from map_glyphinfo() as they
aren't needed any longer. These glyph expansions adhere more closely to
the original glyph mechanics of the game.

- Because the glyphs are re-ordered and expanded, an update to
editlevel will be required upon merge of these changes.
This commit is contained in:
nhmall
2021-09-18 19:44:38 -04:00
parent 12800bf84b
commit 1f6c1d0f42
46 changed files with 3377 additions and 1929 deletions

View File

@@ -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 */

View File

@@ -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() */

View File

@@ -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 */

View File

@@ -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 ### */

View File

@@ -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

View File

@@ -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"

View File

@@ -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

View File

@@ -61,6 +61,7 @@ struct text_map_info_t {
struct tile_glyph_info_t {
unsigned short glyph;
unsigned short tileidx;
unsigned glyphflags;
};

View File

@@ -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);

View File

@@ -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) */