File: sp_lev.h

package info (click to toggle)
glhack 1.2-3
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 26,744 kB
  • ctags: 21,239
  • sloc: ansic: 208,571; cpp: 13,139; yacc: 2,005; makefile: 1,155; lex: 377; sh: 121; awk: 89; sed: 11
file content (246 lines) | stat: -rw-r--r-- 4,018 bytes parent folder | download | duplicates (13)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
/*	SCCS Id: @(#)sp_lev.h	3.4	1996/05/08	*/
/* Copyright (c) 1989 by Jean-Christophe Collet			  */
/* NetHack may be freely redistributed.  See license for details. */

#ifndef SP_LEV_H
#define SP_LEV_H

    /* wall directions */
#define W_NORTH		1
#define W_SOUTH		2
#define W_EAST		4
#define W_WEST		8
#define W_ANY		(W_NORTH|W_SOUTH|W_EAST|W_WEST)

    /* MAP limits */
#define MAP_X_LIM	76
#define MAP_Y_LIM	21

    /* Per level flags */
#define NOTELEPORT	1
#define HARDFLOOR	2
#define NOMMAP		4
#define SHORTSIGHTED	8
#define ARBOREAL	16

    /* special level types */
#define SP_LEV_ROOMS	1
#define SP_LEV_MAZE	2

/*
 * Structures manipulated by the special levels loader & compiler
 */

typedef union str_or_len {
	char *str;
	int   len;
} Str_or_Len;

typedef struct {
	boolean init_present, padding;
	char	fg, bg;
	boolean smoothed, joined;
	xchar	lit, walled;
} lev_init;

typedef struct {
	xchar x, y, mask;
} door;

typedef struct {
	xchar wall, pos, secret, mask;
} room_door;

typedef struct {
	xchar x, y, chance, type;
} trap;

typedef struct {
	Str_or_Len name, appear_as;
	short id;
	aligntyp align;
	xchar x, y, chance, class, appear;
	schar peaceful, asleep;
} monster;

typedef struct {
	Str_or_Len name;
	int   corpsenm;
	short id, spe;
	xchar x, y, chance, class, containment;
	schar curse_state;
} object;

typedef struct {
	xchar		x, y;
	aligntyp	align;
	xchar		shrine;
} altar;

typedef struct {
	xchar x, y, dir, db_open;
} drawbridge;

typedef struct {
	xchar x, y, dir;
} walk;

typedef struct {
	xchar x1, y1, x2, y2;
} digpos;

typedef struct {
	xchar x, y, up;
} lad;

typedef struct {
	xchar x, y, up;
} stair;

typedef struct {
	xchar x1, y1, x2, y2;
	xchar rtype, rlit, rirreg;
} region;

/* values for rtype are defined in dungeon.h */
typedef struct {
	struct { xchar x1, y1, x2, y2; } inarea;
	struct { xchar x1, y1, x2, y2; } delarea;
	boolean in_islev, del_islev;
	xchar rtype, padding;
	Str_or_Len rname;
} lev_region;

typedef struct {
	xchar x, y;
	int   amount;
} gold;

typedef struct {
	xchar x, y;
	Str_or_Len engr;
	xchar etype;
} engraving;

typedef struct {
	xchar x, y;
} fountain;

typedef struct {
	xchar x, y;
} sink;

typedef struct {
	xchar x, y;
} pool;

typedef struct {
	char halign, valign;
	char xsize, ysize;
	char **map;
	char nrobjects;
	char *robjects;
	char nloc;
	char *rloc_x;
	char *rloc_y;
	char nrmonst;
	char *rmonst;
	char nreg;
	region **regions;
	char nlreg;
	lev_region **lregions;
	char ndoor;
	door **doors;
	char ntrap;
	trap **traps;
	char nmonster;
	monster **monsters;
	char nobject;
	object **objects;
	char ndrawbridge;
	drawbridge **drawbridges;
	char nwalk;
	walk **walks;
	char ndig;
	digpos **digs;
	char npass;
	digpos **passs;
	char nlad;
	lad **lads;
	char nstair;
	stair **stairs;
	char naltar;
	altar **altars;
	char ngold;
	gold **golds;
	char nengraving;
	engraving **engravings;
	char nfountain;
	fountain **fountains;
} mazepart;

typedef struct {
	long flags;
	lev_init init_lev;
	schar filling;
	char numpart;
	mazepart **parts;
} specialmaze;

typedef struct _room {
	char  *name;
	char  *parent;
	xchar x, y, w, h;
	xchar xalign, yalign;
	xchar rtype, chance, rlit, filled;
	char ndoor;
	room_door **doors;
	char ntrap;
	trap **traps;
	char nmonster;
	monster **monsters;
	char nobject;
	object **objects;
	char naltar;
	altar **altars;
	char nstair;
	stair **stairs;
	char ngold;
	gold **golds;
	char nengraving;
	engraving **engravings;
	char nfountain;
	fountain **fountains;
	char nsink;
	sink **sinks;
	char npool;
	pool **pools;
	/* These three fields are only used when loading the level... */
	int nsubroom;
	struct _room *subrooms[MAX_SUBROOMS];
	struct mkroom *mkr;
} room;

typedef struct {
	struct {
		xchar room;
		xchar wall;
		xchar door;
	} src, dest;
} corridor;

/* used only by lev_comp */
typedef struct {
	long flags;
	lev_init init_lev;
	char nrobjects;
	char *robjects;
	char nrmonst;
	char *rmonst;
	xchar nroom;
	room **rooms;
	xchar ncorr;
	corridor **corrs;
} splev;

#endif /* SP_LEV_H */