Angband
generate.h
Go to the documentation of this file.
1 
7 #ifndef GENERATE_H
8 #define GENERATE_H
9 
10 #include "monster.h"
11 
12 #if __STDC_VERSION__ < 199901L
13 #define ROOM_LOG if (OPT(cheat_room)) msg
14 #else
15 #define ROOM_LOG(...) if (OPT(cheat_room)) msg(__VA_ARGS__);
16 #endif
17 
21 enum
22 {
23  SET_CORR = 0x01,
24  SET_ROOM = 0x02,
25  SET_BOTH = 0x03
26 };
27 
28 enum
29 {
36 };
37 
43 
44  struct monster_base *base;
45 };
46 
52 
54 };
55 
61 
63 };
64 
68 typedef struct pit_profile {
69  struct pit_profile *next;
71  int pit_idx;
72  const char *name;
73  int room_type;
74  int ave;
75  int rarity;
76  int obj_rarity;
84 } pit_profile;
85 
86 extern struct pit_profile *pit_info;
87 
88 
92 struct dun_data {
94  const struct cave_profile *profile;
95 
97  int cent_n;
98  struct loc *cent;
99 
101  int door_n;
102  struct loc *door;
103 
105  int wall_n;
106  struct loc *wall;
107 
109  int tunn_n;
110  struct loc *tunn;
111 
113  int block_hgt;
114 
116  int block_wid;
117 
120  int col_blocks;
121 
123  bool **room_map;
124 
126  int pit_num;
127 
130 };
131 
132 
134  const char *name;
135  int rnd;
136  int chg;
137  int con;
138  int pen;
139  int jct;
140 };
141 
143  const char *name;
144  int den;
145  int rng;
146  int mag;
147  int mc;
148  int qua;
149  int qc;
150 };
151 
152 /*
153  * cave_builder is a function pointer which builds a level.
154  */
155 typedef struct chunk * (*cave_builder) (struct player *p);
156 
157 
158 struct cave_profile {
160 
161  const char *name;
164  int dun_rooms;
171  int cutoff;
172 };
173 
174 
179 typedef bool (*room_builder) (struct chunk *c, int y0, int x0);
180 
181 
186 struct room_profile {
188 
189  const char *name;
191  int height, width;
192  int level;
193  bool pit;
194  int rarity;
195  int cutoff;
196 };
197 
198 
199 /*
200  * Information about "vault generation"
201  */
202 struct vault {
203  struct vault *next;
204  unsigned int vidx;
205  char *name;
206  char *text;
217 };
218 
219 
220 
221 /*
222  * Information about "room generation"
223  */
224 typedef struct room_template {
225  struct room_template *next;
226  unsigned int tidx;
227  char *name;
228  char *text;
239 
240 struct dun_data *dun;
241 struct vault *vaults;
243 
244 /* gen-cave.c */
245 struct chunk *town_gen(struct player *p);
246 struct chunk *classic_gen(struct player *p);
247 struct chunk *labyrinth_gen(struct player *p);
248 void ensure_connectedness(struct chunk *c);
249 struct chunk *cavern_gen(struct player *p);
250 struct chunk *modified_gen(struct player *p);
251 struct chunk *moria_gen(struct player *p);
252 struct chunk *hard_centre_gen(struct player *p);
253 struct chunk *lair_gen(struct player *p);
254 struct chunk *gauntlet_gen(struct player *p);
255 
256 /* gen-chunk.c */
257 struct chunk *chunk_write(int y0, int x0, int height, int width, bool monsters,
258  bool objects, bool traps);
259 void chunk_list_add(struct chunk *c);
260 bool chunk_list_remove(char *name);
261 struct chunk *chunk_find_name(char *name);
262 bool chunk_find(struct chunk *c);
263 bool chunk_copy(struct chunk *dest, struct chunk *source, int y0, int x0,
264  int rotate, bool reflect);
265 
266 void chunk_validate_objects(struct chunk *c);
267 
268 
269 /* gen-room.c */
270 void fill_rectangle(struct chunk *c, int y1, int x1, int y2, int x2, int feat,
271  int flag);
272 void generate_mark(struct chunk *c, int y1, int x1, int y2, int x2, int flag);
273 void draw_rectangle(struct chunk *c, int y1, int x1, int y2, int x2, int feat,
274  int flag);
275 void set_marked_granite(struct chunk *c, int y, int x, int flag);
276 
277 struct vault *random_vault(int depth, int typ);
278 bool build_vault(struct chunk *c, int y0, int x0, struct vault *v);
279 
280 bool build_simple(struct chunk *c, int y0, int x0);
281 bool build_circular(struct chunk *c, int y0, int x0);
282 bool build_overlap(struct chunk *c, int y0, int x0);
283 bool build_crossed(struct chunk *c, int y0, int x0);
284 bool build_large(struct chunk *c, int y0, int x0);
285 bool mon_pit_hook(monster_race *r_ptr);
286 void set_pit_type(int depth, int type);
287 bool build_nest(struct chunk *c, int y0, int x0);
288 bool build_pit(struct chunk *c, int y0, int x0);
289 bool build_template(struct chunk *c, int y0, int x0);
290 bool build_interesting(struct chunk *c, int y0, int x0);
291 bool build_lesser_vault(struct chunk *c, int y0, int x0);
292 bool build_medium_vault(struct chunk *c, int y0, int x0);
293 bool build_greater_vault(struct chunk *c, int y0, int x0);
294 bool build_moria(struct chunk *c, int y0, int x0);
295 bool build_room_of_chambers(struct chunk *c, int y0, int x0);
296 bool build_huge(struct chunk *c, int y0, int x0);
297 bool room_build(struct chunk *c, int by0, int bx0, struct room_profile profile,
298  bool finds_own_space);
299 
300 
301 /* gen-util.c */
303 
304 int yx_to_i(int y, int x, int w);
305 void i_to_yx(int i, int w, int *y, int *x);
306 void shuffle(int *arr, int n);
307 bool cave_find(struct chunk *c, int *y, int *x, square_predicate pred);
308 bool find_empty(struct chunk *c, int *y, int *x);
309 bool find_empty_range(struct chunk *c, int *y, int y1, int y2, int *x, int x1, int x2);
310 bool find_nearby_grid(struct chunk *c, int *y, int y0, int yd, int *x, int x0, int xd);
311 void correct_dir(int *rdir, int *cdir, int y1, int x1, int y2, int x2);
312 void rand_dir(int *rdir, int *cdir);
313 void new_player_spot(struct chunk *c, struct player *p);
314 void place_object(struct chunk *c, int y, int x, int level, bool good,
315  bool great, byte origin, int tval);
316 void place_gold(struct chunk *c, int y, int x, int level, byte origin);
317 void place_secret_door(struct chunk *c, int y, int x);
318 void place_closed_door(struct chunk *c, int y, int x);
319 void place_random_door(struct chunk *c, int y, int x);
320 void place_random_stairs(struct chunk *c, int y, int x);
321 void alloc_stairs(struct chunk *c, int feat, int num, int walls);
322 void vault_objects(struct chunk *c, int y, int x, int depth, int num);
323 void vault_traps(struct chunk *c, int y, int x, int yd, int xd, int num);
324 void vault_monsters(struct chunk *c, int y1, int x1, int depth, int num);
325 void alloc_objects(struct chunk *c, int set, int typ, int num, int depth, byte origin);
326 bool alloc_object(struct chunk *c, int set, int typ, int depth, byte origin);
327 
328 /* gen-monster.c */
329 bool mon_restrict(const char *monster_type, int depth, bool unique_ok);
330 void spread_monsters(struct chunk *c, const char *type, int depth, int num,
331  int y0, int x0, int dy, int dx, byte origin);
332 void get_vault_monsters(struct chunk *c, char racial_symbol[], byte vault_type, const char *data, int y1, int y2, int x1, int x2);
333 void get_chamber_monsters(struct chunk *c, int y1, int x1, int y2, int x2, char *name, int area);
334 
335 
336 #endif /* !GENERATE_H */