1 /* SCCS Id: @(#)dungeon.h 3.4 1999/07/02 */
2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3 /* NetHack may be freely redistributed. See license for details. */
8 typedef struct d_flags { /* dungeon/level type flags */
9 Bitfield(town, 1); /* is this a town? (levels only) */
10 Bitfield(hellish, 1); /* is this part of hell? */
11 Bitfield(maze_like, 1); /* is this a maze? */
12 Bitfield(rogue_like, 1); /* is this an old-fashioned presentation? */
13 Bitfield(align, 3); /* dungeon alignment. */
14 Bitfield(unused, 1); /* etc... */
17 typedef struct d_level { /* basic dungeon level element */
18 xchar dnum; /* dungeon number */
19 xchar dlevel; /* level number */
22 typedef struct s_level { /* special dungeon level element */
24 d_level dlevel; /* dungeon & level numbers */
25 char proto[15]; /* name of prototype file (eg. "tower") */
26 char boneid; /* character to id level in bones files */
27 uchar rndlevs; /* no. of randomly available similar levels */
28 d_flags flags; /* type flags */
31 typedef struct stairway { /* basic stairway identifier */
32 xchar sx, sy; /* x / y location of the stair */
33 d_level tolev; /* where does it go */
34 char up; /* what type of stairway (up/down) */
37 /* level region types */
38 #define LR_DOWNSTAIR 0
46 typedef struct dest_area { /* non-stairway level change indentifier */
47 xchar lx, ly; /* "lower" left corner (near [0,0]) */
48 xchar hx, hy; /* "upper" right corner (near [COLNO,ROWNO]) */
49 xchar nlx, nly; /* outline of invalid area */
50 xchar nhx, nhy; /* opposite corner of invalid area */
53 typedef struct dungeon { /* basic dungeon identifier */
54 char dname[24]; /* name of the dungeon (eg. "Hell") */
55 char proto[15]; /* name of prototype file (eg. "tower") */
56 char boneid; /* character to id dungeon in bones files */
57 d_flags flags; /* dungeon flags */
58 xchar entry_lev; /* entry level */
59 xchar num_dunlevs; /* number of levels in this dungeon */
60 xchar dunlev_ureached; /* how deep you have been in this dungeon */
61 int ledger_start, /* the starting depth in "real" terms */
62 depth_start; /* the starting depth in "logical" terms */
66 * A branch structure defines the connection between two dungeons. They
67 * will be ordered by the dungeon number/level number of 'end1'. Ties
68 * are resolved by 'end2'. 'Type' uses 'end1' arbitrarily as the primary
71 typedef struct branch {
72 struct branch *next; /* next in the branch chain */
73 int id; /* branch identifier */
74 int type; /* type of branch */
75 d_level end1; /* "primary" end point */
76 d_level end2; /* other end point */
77 boolean end1_up; /* does end1 go up? */
81 #define BR_STAIR 0 /* "Regular" connection, 2 staircases. */
82 #define BR_NO_END1 1 /* "Regular" connection. However, no stair from */
83 /* end1 to end2. There is a stair from end2 */
85 #define BR_NO_END2 2 /* "Regular" connection. However, no stair from */
86 /* end2 to end1. There is a stair from end1 */
88 #define BR_PORTAL 3 /* Connection by magic portals (traps) */
91 /* A particular dungeon contains num_dunlevs d_levels with dlevel 1..
92 * num_dunlevs. Ledger_start and depth_start are bases that are added
93 * to the dlevel of a particular d_level to get the effective ledger_no
94 * and depth for that d_level.
96 * Ledger_no is a bookkeeping number that gives a unique identifier for a
97 * particular d_level (for level.?? files, e.g.).
99 * Depth corresponds to the number of floors below the surface.
101 #define Is_astralevel(x) (on_level(x, &astral_level))
102 #define Is_earthlevel(x) (on_level(x, &earth_level))
103 #define Is_waterlevel(x) (on_level(x, &water_level))
104 #define Is_firelevel(x) (on_level(x, &fire_level))
105 #define Is_airlevel(x) (on_level(x, &air_level))
106 #define Is_medusa_level(x) (on_level(x, &medusa_level))
107 #define Is_oracle_level(x) (on_level(x, &oracle_level))
108 #define Is_valley(x) (on_level(x, &valley_level))
109 #define Is_juiblex_level(x) (on_level(x, &juiblex_level))
110 #define Is_asmo_level(x) (on_level(x, &asmodeus_level))
111 #define Is_baal_level(x) (on_level(x, &baalzebub_level))
112 #define Is_wiz1_level(x) (on_level(x, &wiz1_level))
113 #define Is_wiz2_level(x) (on_level(x, &wiz2_level))
114 #define Is_wiz3_level(x) (on_level(x, &wiz3_level))
115 #define Is_sanctum(x) (on_level(x, &sanctum_level))
116 #define Is_portal_level(x) (on_level(x, &portal_level))
117 #define Is_rogue_level(x) (on_level(x, &rogue_level))
118 #define Is_stronghold(x) (on_level(x, &stronghold_level))
119 #define Is_bigroom(x) (on_level(x, &bigroom_level))
120 #define Is_qstart(x) (on_level(x, &qstart_level))
121 #define Is_qlocate(x) (on_level(x, &qlocate_level))
122 #define Is_nemesis(x) (on_level(x, &nemesis_level))
123 #define Is_knox(x) (on_level(x, &knox_level))
125 #define In_sokoban(x) ((x)->dnum == sokoban_dnum)
126 #define Inhell In_hell(&u.uz) /* now gehennom */
127 #define In_endgame(x) ((x)->dnum == astral_level.dnum)
129 #define within_bounded_area(X,Y,LX,LY,HX,HY) \
130 ((X) >= (LX) && (X) <= (HX) && (Y) >= (LY) && (Y) <= (HY))
132 /* monster and object migration codes */
134 #define MIGR_NOWHERE (-1) /* failure flag for down_gate() */
135 #define MIGR_RANDOM 0
136 #define MIGR_APPROX_XY 1 /* approximate coordinates */
137 #define MIGR_EXACT_XY 2 /* specific coordinates */
138 #define MIGR_STAIRS_UP 3
139 #define MIGR_STAIRS_DOWN 4
140 #define MIGR_LADDER_UP 5
141 #define MIGR_LADDER_DOWN 6
142 #define MIGR_SSTAIRS 7 /* dungeon branch */
143 #define MIGR_PORTAL 8 /* magic portal */
144 #define MIGR_NEAR_PLAYER 9 /* mon: followers; obj: trap door */
146 /* level information (saved via ledger number) */
150 #define VISITED 0x01 /* hero has visited this level */
151 #define FORGOTTEN 0x02 /* hero will forget this level when reached */
152 #define LFILE_EXISTS 0x04 /* a level file exists for this level */
154 * Note: VISITED and LFILE_EXISTS are currently almost always set at the
155 * same time. However they _mean_ different things.
159 # define FROMPERM 1 /* for ramdisk use */
160 # define TOPERM 2 /* for ramdisk use */
169 #endif /* DUNGEON_H */