1 /*	SCCS Id: @(#)sp_lev.h	3.4	1996/05/08	*/
2 /* Copyright (c) 1989 by Jean-Christophe Collet			  */
3 /* NetHack may be freely redistributed.  See license for details. */
4 
5 #ifndef SP_LEV_H
6 #define SP_LEV_H
7 
8     /* wall directions */
9 #define W_NORTH		1
10 #define W_SOUTH		2
11 #define W_EAST		4
12 #define W_WEST		8
13 #define W_ANY		(W_NORTH|W_SOUTH|W_EAST|W_WEST)
14 
15     /* MAP limits */
16 #define MAP_X_LIM	76
17 #define MAP_Y_LIM	21
18 
19     /* Per level flags */
20 #define NOTELEPORT	1
21 #define HARDFLOOR	2
22 #define NOMMAP		4
23 #define SHORTSIGHTED	8
24 #define ARBOREAL	16
25 #define SPOOKY		32
26 #define LETHE		64		/* All water on level is Lethe-ized */
27 
28     /* special level types */
29 #define SP_LEV_ROOMS	1
30 #define SP_LEV_MAZE	2
31 
32     /* object flags */
33 #define OBJF_LIT	1
34 #define OBJF_BURIED	2
35 
36 /*
37  * Structures manipulated by the special levels loader & compiler
38  */
39 
40 typedef union str_or_len {
41 	char *str;
42 	int   len;
43 } Str_or_Len;
44 
45 typedef struct {
46 	boolean	init_present, padding;
47 	char	fg, bg;
48 	boolean	smoothed, joined;
49 	xchar   lit, walled;
50 } lev_init;
51 
52 typedef struct {
53 	xchar x, y, mask;
54 	short arti_key;		/* Index (ART_) of key for this door */
55 } door;
56 
57 typedef struct {
58 	xchar wall, pos, secret, mask;
59 	short arti_key;		/* Index (ART_) of key for this door */
60 } room_door;
61 
62 typedef struct {
63 	xchar x, y, chance, type;
64 } trap;
65 
66 typedef struct {
67 	Str_or_Len name, appear_as;
68 	short id;
69 	aligntyp align;
70 	xchar x, y, chance, class, appear;
71 	schar peaceful, asleep;
72 } monster;
73 
74 typedef struct {
75 	Str_or_Len name;
76 	int   corpsenm;
77 	short id, spe;
78 	xchar x, y, chance, class, containment;
79 	schar curse_state;
80 	long  oflags;		/* OBJF_foo flags */
81 } object;
82 
83 typedef struct {
84 	xchar		x, y;
85 	aligntyp	align;
86 	xchar		shrine;
87 } altar;
88 
89 typedef struct {
90 	xchar x, y, dir, db_open;
91 } drawbridge;
92 
93 typedef struct {
94 	xchar x, y, dir;
95 } walk;
96 
97 typedef struct {
98 	xchar x1, y1, x2, y2;
99 } digpos;
100 
101 typedef struct {
102 	xchar x, y, up;
103 } lad;
104 
105 typedef struct {
106 	xchar x, y, up;
107 } stair;
108 
109 typedef struct {
110 	xchar x1, y1, x2, y2;
111 	xchar rtype, rlit, rirreg;
112 } region;
113 
114 /* values for rtype are defined in dungeon.h */
115 typedef struct {
116 	struct { xchar x1, y1, x2, y2; } inarea;
117 	struct { xchar x1, y1, x2, y2; } delarea;
118 	boolean in_islev, del_islev;
119 	xchar rtype, padding;
120 	Str_or_Len rname;
121 } lev_region;
122 
123 typedef struct {
124 	xchar x, y;
125 	int   amount;
126 } gold;
127 
128 typedef struct {
129 	xchar x, y;
130 	Str_or_Len engr;
131 	xchar etype;
132 } engraving;
133 
134 typedef struct {
135 	xchar x, y;
136 } fountain;
137 
138 typedef struct {
139 	xchar x, y;
140 } sink;
141 
142 typedef struct {
143 	xchar x, y;
144 } pool;
145 
146 typedef struct {
147 	char halign, valign;
148 	char xsize, ysize;
149 	char **map;
150 	char nrobjects;
151 	char *robjects;
152 	char nlocset;
153 	char *nloc;
154 	char **rloc_x;
155 	char **rloc_y;
156 	char nrmonst;
157 	char *rmonst;
158 	char nreg;
159 	region **regions;
160 	char nlreg;
161 	lev_region **lregions;
162 	char nrndlreg;
163 	lev_region **rndlregions;
164 	char ndoor;
165 	door **doors;
166 	char ntrap;
167 	trap **traps;
168 	char nmonster;
169 	monster **monsters;
170 	char nobject;
171 	object **objects;
172 	char ndrawbridge;
173 	drawbridge **drawbridges;
174 	char nwalk;
175 	walk **walks;
176 	char ndig;
177 	digpos **digs;
178 	char npass;
179 	digpos **passs;
180 	char nlad;
181 	lad **lads;
182 	char nstair;
183 	stair **stairs;
184 	char naltar;
185 	altar **altars;
186 	char ngold;
187 	gold **golds;
188 	char nengraving;
189 	engraving **engravings;
190 	char nfountain;
191 	fountain **fountains;
192 } mazepart;
193 
194 typedef struct {
195 	long flags;
196 	lev_init init_lev;
197 	schar filling;
198 	char numpart;
199 	mazepart **parts;
200 } specialmaze;
201 
202 typedef struct _room {
203 	char  *name;
204 	char  *parent;
205 	xchar x, y, w, h;
206 	xchar xalign, yalign;
207 	xchar rtype, chance, rlit, filled;
208 	char ndoor;
209 	room_door **doors;
210 	char ntrap;
211 	trap **traps;
212 	char nmonster;
213 	monster **monsters;
214 	char nobject;
215 	object **objects;
216 	char naltar;
217 	altar **altars;
218 	char nstair;
219 	stair **stairs;
220 	char ngold;
221 	gold **golds;
222 	char nengraving;
223 	engraving **engravings;
224 	char nfountain;
225 	fountain **fountains;
226 	char nsink;
227 	sink **sinks;
228 	char npool;
229 	pool **pools;
230 	/* These three fields are only used when loading the level... */
231 	int nsubroom;
232 	struct _room *subrooms[MAX_SUBROOMS];
233 	struct mkroom *mkr;
234 } room;
235 
236 typedef struct {
237 	struct {
238 		xchar room;
239 		xchar wall;
240 		xchar door;
241 	} src, dest;
242 } corridor;
243 
244 #ifdef LEVEL_COMPILER
245 /* used only by lev_comp */
246 typedef struct {
247 	long flags;
248 	lev_init init_lev;
249 	char nrobjects;
250 	char *robjects;
251 	char nrmonst;
252 	char *rmonst;
253 	xchar nroom;
254 	room **rooms;
255 	xchar ncorr;
256 	corridor **corrs;
257 } splev;
258 
259 struct coord {
260 	int x, y;
261 };
262 #endif	/* LEVEL_COMPILER */
263 
264 #endif /* SP_LEV_H */
265