Angband
cave.h
Go to the documentation of this file.
1 
19 #ifndef CAVE_H
20 #define CAVE_H
21 
22 #include "z-type.h"
23 #include "z-bitflag.h"
24 
25 struct player;
26 struct monster;
27 struct monster_group;
28 
29 extern const s16b ddd[9];
30 extern const s16b ddx[10];
31 extern const s16b ddy[10];
32 extern const struct loc ddgrid[10];
33 extern const s16b ddx_ddd[9];
34 extern const s16b ddy_ddd[9];
35 extern const struct loc ddgrid_ddd[9];
36 extern const int *dist_offsets_y[10];
37 extern const int *dist_offsets_x[10];
38 extern const byte side_dirs[20][8];
39 
40 enum {
42  DIR_NW = 7,
43  DIR_N = 8,
44  DIR_NE = 9,
45  DIR_W = 4,
47  DIR_NONE = 5,
48  DIR_E = 6,
49  DIR_SW = 1,
50  DIR_S = 2,
51  DIR_SE = 3,
52 };
53 
58 enum
59 {
60  #define SQUARE(a,b) SQUARE_##a,
61  #include "list-square-flags.h"
62  #undef SQUARE
64 };
65 
66 #define SQUARE_SIZE FLAG_SIZE(SQUARE_MAX)
67 
68 #define sqinfo_has(f, flag) flag_has_dbg(f, SQUARE_SIZE, flag, #f, #flag)
69 #define sqinfo_next(f, flag) flag_next(f, SQUARE_SIZE, flag)
70 #define sqinfo_is_empty(f) flag_is_empty(f, SQUARE_SIZE)
71 #define sqinfo_is_full(f) flag_is_full(f, SQUARE_SIZE)
72 #define sqinfo_is_inter(f1, f2) flag_is_inter(f1, f2, SQUARE_SIZE)
73 #define sqinfo_is_subset(f1, f2) flag_is_subset(f1, f2, SQUARE_SIZE)
74 #define sqinfo_is_equal(f1, f2) flag_is_equal(f1, f2, SQUARE_SIZE)
75 #define sqinfo_on(f, flag) flag_on_dbg(f, SQUARE_SIZE, flag, #f, #flag)
76 #define sqinfo_off(f, flag) flag_off(f, SQUARE_SIZE, flag)
77 #define sqinfo_wipe(f) flag_wipe(f, SQUARE_SIZE)
78 #define sqinfo_setall(f) flag_setall(f, SQUARE_SIZE)
79 #define sqinfo_negate(f) flag_negate(f, SQUARE_SIZE)
80 #define sqinfo_copy(f1, f2) flag_copy(f1, f2, SQUARE_SIZE)
81 #define sqinfo_union(f1, f2) flag_union(f1, f2, SQUARE_SIZE)
82 #define sqinfo_inter(f1, f2) flag_inter(f1, f2, SQUARE_SIZE)
83 #define sqinfo_diff(f1, f2) flag_diff(f1, f2, SQUARE_SIZE)
84 
85 
89 enum
90 {
91  #define TF(a,b) TF_##a,
92  #include "list-terrain-flags.h"
93  #undef TF
94  TF_MAX
95 };
96 
97 #define TF_SIZE FLAG_SIZE(TF_MAX)
98 
99 #define tf_has(f, flag) flag_has_dbg(f, TF_SIZE, flag, #f, #flag)
100 
107 struct feature {
108  char *name;
109  char *desc;
110  int fidx;
111 
112  struct feature *next;
113 
114  char *mimic;
123  wchar_t d_char;
125  char *walk_msg;
126  char *run_msg;
127  char *hurt_msg;
128  char *die_msg;
130 };
131 
132 extern struct feature *f_info;
133 
135 {
136  LIGHTING_LOS = 0, /* line of sight */
137  LIGHTING_TORCH, /* torchlight */
138  LIGHTING_LIT, /* permanently lit (when not in line of sight) */
139  LIGHTING_DARK, /* dark */
141 };
142 
143 struct grid_data {
144  u32b m_idx; /* Monster index */
145  u32b f_idx; /* Feature index */
146  struct object_kind *first_kind; /* The kind of the first item on the grid */
147  struct trap *trap; /* Trap */
148  bool multiple_objects; /* Is there more than one item there? */
149  bool unseen_object; /* Is there an unaware object there? */
150  bool unseen_money; /* Is there some unaware money there? */
151 
152  enum grid_light_level lighting; /* Light level */
153  bool in_view; /* Can the player can currently see the grid? */
154  bool is_player;
156 };
157 
158 struct square {
161  int light;
163  struct object *obj;
164  struct trap *trap;
165 };
166 
167 struct heatmap {
169 };
170 
171 struct connector {
172  struct loc grid;
175  struct connector *next;
176 };
177 
178 struct chunk {
179  char *name;
181  int depth;
182 
186  bool good_item;
187 
188  int height;
189  int width;
190 
191  u16b feeling_squares; /* How many feeling squares the player has visited */
193 
194  struct square **squares;
195  struct heatmap noise;
196  struct heatmap scent;
197  struct loc decoy;
198 
199  struct object **objects;
201 
202  struct monster *monsters;
207 
209 
210  struct connector *join;
211 };
212 
213 /*** Feature Indexes (see "lib/gamedata/terrain.txt") ***/
214 
215 /* Nothing */
216 extern int FEAT_NONE;
217 
218 /* Various */
219 extern int FEAT_FLOOR;
220 extern int FEAT_CLOSED;
221 extern int FEAT_OPEN;
222 extern int FEAT_BROKEN;
223 extern int FEAT_LESS;
224 extern int FEAT_MORE;
225 
226 /* Secret door */
227 extern int FEAT_SECRET;
228 
229 /* Rubble */
230 extern int FEAT_RUBBLE;
231 extern int FEAT_PASS_RUBBLE;
232 
233 /* Mineral seams */
234 extern int FEAT_MAGMA;
235 extern int FEAT_QUARTZ;
236 extern int FEAT_MAGMA_K;
237 extern int FEAT_QUARTZ_K;
238 
239 /* Walls */
240 extern int FEAT_GRANITE;
241 extern int FEAT_PERM;
242 extern int FEAT_LAVA;
243 
244 
245 /* Current level */
246 extern struct chunk *cave;
247 /* Stored levels */
248 extern struct chunk **chunk_list;
249 extern u16b chunk_list_max;
250 
251 /* cave-view.c */
252 int distance(struct loc grid1, struct loc grid2);
253 bool los(struct chunk *c, struct loc grid1, struct loc grid2);
254 void update_view(struct chunk *c, struct player *p);
255 bool no_light(void);
256 
257 /* cave-map.c */
258 void map_info(struct loc grid, struct grid_data *g);
259 void square_note_spot(struct chunk *c, struct loc grid);
260 void square_light_spot(struct chunk *c, struct loc grid);
261 void light_room(struct loc grid, bool light);
262 void wiz_light(struct chunk *c, struct player *p, bool full);
263 void wiz_dark(struct chunk *c, struct player *p, bool full);
264 void cave_illuminate(struct chunk *c, bool daytime);
265 void cave_update_flow(struct chunk *c);
266 void cave_forget_flow(struct chunk *c);
267 
268 /* cave-square.c */
273 typedef bool (*square_predicate)(struct chunk *c, struct loc grid);
274 
275 /* FEATURE PREDICATES */
276 bool feat_is_magma(int feat);
277 bool feat_is_quartz(int feat);
278 bool feat_is_granite(int feat);
279 bool feat_is_treasure(int feat);
280 bool feat_is_wall(int feat);
281 bool feat_is_floor(int feat);
282 bool feat_is_trap_holding(int feat);
283 bool feat_is_object_holding(int feat);
284 bool feat_is_monster_walkable(int feat);
285 bool feat_is_shop(int feat);
286 bool feat_is_passable(int feat);
287 bool feat_is_projectable(int feat);
288 bool feat_is_torch(int feat);
289 bool feat_is_bright(int feat);
290 bool feat_is_fiery(int feat);
291 bool feat_is_no_flow(int feat);
292 bool feat_is_no_scent(int feat);
293 bool feat_is_smooth(int feat);
294 
295 /* SQUARE FEATURE PREDICATES */
296 bool square_isfloor(struct chunk *c, struct loc grid);
297 bool square_istrappable(struct chunk *c, struct loc grid);
298 bool square_isobjectholding(struct chunk *c, struct loc grid);
299 bool square_isrock(struct chunk *c, struct loc grid);
300 bool square_isgranite(struct chunk *c, struct loc grid);
301 bool square_isperm(struct chunk *c, struct loc grid);
302 bool square_ismagma(struct chunk *c, struct loc grid);
303 bool square_isquartz(struct chunk *c, struct loc grid);
304 bool square_ismineral(struct chunk *c, struct loc grid);
305 bool square_hasgoldvein(struct chunk *c, struct loc grid);
306 bool square_isrubble(struct chunk *c, struct loc grid);
307 bool square_issecretdoor(struct chunk *c, struct loc grid);
308 bool square_isopendoor(struct chunk *c, struct loc grid);
309 bool square_iscloseddoor(struct chunk *c, struct loc grid);
310 bool square_isbrokendoor(struct chunk *c, struct loc grid);
311 bool square_isdoor(struct chunk *c, struct loc grid);
312 bool square_isstairs(struct chunk *c, struct loc grid);
313 bool square_isupstairs(struct chunk *c, struct loc grid);
314 bool square_isdownstairs(struct chunk *c, struct loc grid);
315 bool square_isshop(struct chunk *c, struct loc grid);
316 bool square_isplayer(struct chunk *c, struct loc grid);
317 bool square_isoccupied(struct chunk *c, struct loc grid);
318 bool square_isknown(struct chunk *c, struct loc grid);
319 bool square_isnotknown(struct chunk *c, struct loc grid);
320 
321 /* SQUARE INFO PREDICATES */
322 bool square_ismark(struct chunk *c, struct loc grid);
323 bool square_isglow(struct chunk *c, struct loc grid);
324 bool square_isvault(struct chunk *c, struct loc grid);
325 bool square_isroom(struct chunk *c, struct loc grid);
326 bool square_isseen(struct chunk *c, struct loc grid);
327 bool square_isview(struct chunk *c, struct loc grid);
328 bool square_wasseen(struct chunk *c, struct loc grid);
329 bool square_isfeel(struct chunk *c, struct loc grid);
330 bool square_istrap(struct chunk *c, struct loc grid);
331 bool square_isinvis(struct chunk *c, struct loc grid);
332 bool square_iswall_inner(struct chunk *c, struct loc grid);
333 bool square_iswall_outer(struct chunk *c, struct loc grid);
334 bool square_iswall_solid(struct chunk *c, struct loc grid);
335 bool square_ismon_restrict(struct chunk *c, struct loc grid);
336 bool square_isno_teleport(struct chunk *c, struct loc grid);
337 bool square_isno_map(struct chunk *c, struct loc grid);
338 bool square_isno_esp(struct chunk *c, struct loc grid);
339 bool square_isproject(struct chunk *c, struct loc grid);
340 bool square_isdtrap(struct chunk *c, struct loc grid);
341 bool square_isno_stairs(struct chunk *c, struct loc grid);
342 
343 /* SQUARE BEHAVIOR PREDICATES */
344 bool square_isopen(struct chunk *c, struct loc grid);
345 bool square_isempty(struct chunk *c, struct loc grid);
346 bool square_isarrivable(struct chunk *c, struct loc grid);
347 bool square_canputitem(struct chunk *c, struct loc grid);
348 bool square_isdiggable(struct chunk *c, struct loc grid);
349 bool square_iswebbable(struct chunk *c, struct loc grid);
350 bool square_is_monster_walkable(struct chunk *c, struct loc grid);
351 bool square_ispassable(struct chunk *c, struct loc grid);
352 bool square_isprojectable(struct chunk *c, struct loc grid);
353 bool square_iswall(struct chunk *c, struct loc grid);
354 bool square_isstrongwall(struct chunk *c, struct loc grid);
355 bool square_isbright(struct chunk *c, struct loc grid);
356 bool square_isfiery(struct chunk *c, struct loc grid);
357 bool square_islit(struct chunk *c, struct loc grid);
358 bool square_islitwall(struct chunk *c, struct loc grid);
359 bool square_isdamaging(struct chunk *c, struct loc grid);
360 bool square_isnoflow(struct chunk *c, struct loc grid);
361 bool square_isnoscent(struct chunk *c, struct loc grid);
362 bool square_iswarded(struct chunk *c, struct loc grid);
363 bool square_isdecoyed(struct chunk *c, struct loc grid);
364 bool square_iswebbed(struct chunk *c, struct loc grid);
365 bool square_seemslikewall(struct chunk *c, struct loc grid);
366 bool square_isinteresting(struct chunk *c, struct loc grid);
367 bool square_islockeddoor(struct chunk *c, struct loc grid);
368 bool square_isplayertrap(struct chunk *c, struct loc grid);
369 bool square_isvisibletrap(struct chunk *c, struct loc grid);
370 bool square_issecrettrap(struct chunk *c, struct loc grid);
371 bool square_isdisabledtrap(struct chunk *c, struct loc grid);
372 bool square_isdisarmabletrap(struct chunk *c, struct loc grid);
373 bool square_dtrap_edge(struct chunk *c, struct loc grid);
374 bool square_changeable(struct chunk *c, struct loc grid);
375 bool square_in_bounds(struct chunk *c, struct loc grid);
376 bool square_in_bounds_fully(struct chunk *c, struct loc grid);
377 bool square_isbelievedwall(struct chunk *c, struct loc grid);
378 bool square_suits_stairs_well(struct chunk *c, struct loc grid);
379 bool square_suits_stairs_ok(struct chunk *c, struct loc grid);
380 
381 
382 struct square square(struct chunk *c, struct loc grid);
383 struct feature *square_feat(struct chunk *c, struct loc grid);
384 int square_light(struct chunk *c, struct loc grid);
385 struct monster *square_monster(struct chunk *c, struct loc grid);
386 struct object *square_object(struct chunk *c, struct loc grid);
387 struct trap *square_trap(struct chunk *c, struct loc grid);
388 bool square_holds_object(struct chunk *c, struct loc grid, struct object *obj);
389 void square_excise_object(struct chunk *c, struct loc grid, struct object *obj);
390 void square_excise_pile(struct chunk *c, struct loc grid);
391 void square_sense_pile(struct chunk *c, struct loc grid);
392 void square_know_pile(struct chunk *c, struct loc grid);
393 int square_num_walls_adjacent(struct chunk *c, struct loc grid);
394 int square_num_walls_diagonal(struct chunk *c, struct loc grid);
395 
396 
397 /* Feature placers */
398 void square_set_feat(struct chunk *c, struct loc grid, int feat);
399 void square_set_mon(struct chunk *c, struct loc grid, int midx);
400 void square_set_obj(struct chunk *c, struct loc grid, struct object *obj);
401 void square_set_trap(struct chunk *c, struct loc grid, struct trap *trap);
402 void square_add_trap(struct chunk *c, struct loc grid);
403 void square_add_glyph(struct chunk *c, struct loc grid, int type);
404 void square_add_web(struct chunk *c, struct loc grid);
405 void square_add_stairs(struct chunk *c, struct loc grid, int depth);
406 void square_add_door(struct chunk *c, struct loc grid, bool closed);
407 
408 /* Feature modifiers */
409 void square_open_door(struct chunk *c, struct loc grid);
410 void square_close_door(struct chunk *c, struct loc grid);
411 void square_smash_door(struct chunk *c, struct loc grid);
412 void square_unlock_door(struct chunk *c, struct loc grid);
413 void square_destroy_door(struct chunk *c, struct loc grid);
414 void square_destroy_trap(struct chunk *c, struct loc grid);
415 void square_disable_trap(struct chunk *c, struct loc grid);
416 void square_destroy_decoy(struct chunk *c, struct loc grid);
417 void square_tunnel_wall(struct chunk *c, struct loc grid);
418 void square_destroy_wall(struct chunk *c, struct loc grid);
419 void square_smash_wall(struct chunk *c, struct loc grid);
420 void square_destroy(struct chunk *c, struct loc grid);
421 void square_earthquake(struct chunk *c, struct loc grid);
422 void square_upgrade_mineral(struct chunk *c, struct loc grid);
423 void square_destroy_rubble(struct chunk *c, struct loc grid);
424 void square_force_floor(struct chunk *c, struct loc grid);
425 
426 
427 int square_shopnum(struct chunk *c, struct loc grid);
428 int square_digging(struct chunk *c, struct loc grid);
429 const char *square_apparent_name(struct chunk *c, struct player *p, struct loc grid);
430 
431 void square_memorize(struct chunk *c, struct loc grid);
432 void square_forget(struct chunk *c, struct loc grid);
433 void square_mark(struct chunk *c, struct loc grid);
434 void square_unmark(struct chunk *c, struct loc grid);
435 
436 /* cave.c */
437 int motion_dir(struct loc source, struct loc target);
438 struct loc next_grid(struct loc grid, int dir);
439 int lookup_feat(const char *name);
440 void set_terrain(void);
441 struct chunk *cave_new(int height, int width);
442 void cave_free(struct chunk *c);
443 void list_object(struct chunk *c, struct object *obj);
444 void delist_object(struct chunk *c, struct object *obj);
445 void object_lists_check_integrity(struct chunk *c, struct chunk *c_k);
446 void scatter(struct chunk *c, struct loc *place, struct loc grid, int d,
447  bool need_los);
448 
449 struct monster *cave_monster(struct chunk *c, int idx);
450 int cave_monster_max(struct chunk *c);
451 int cave_monster_count(struct chunk *c);
452 
453 int count_feats(struct loc *grid,
454  bool (*test)(struct chunk *c, struct loc grid), bool under);
455 struct loc cave_find_decoy(struct chunk *c);
456 void prepare_next_level(struct chunk **c, struct player *p);
457 bool is_quest(int level);
458 
459 void cave_known(struct player *p);
460 
461 #endif /* !CAVE_H */
uint16_t u16b
Definition: h-basic.h:169
bool feat_is_monster_walkable(int feat)
True if a monster can walk through the feature.
Definition: cave-square.c:107
bool square_ismagma(struct chunk *c, struct loc grid)
True if the square is a magma wall.
Definition: cave-square.c:253
bool square_isgranite(struct chunk *c, struct loc grid)
True if the square is granite.
Definition: cave-square.c:236
Definition: cave.h:138
bool square_suits_stairs_well(struct chunk *c, struct loc grid)
Checks if a square is in a cul-de-sac.
Definition: cave-square.c:917
void square_smash_wall(struct chunk *c, struct loc grid)
Definition: cave-square.c:1294
Definition: cave.h:167
const struct loc ddgrid_ddd[9]
Definition: cave.c:90
struct object ** objects
Definition: cave.h:199
bool square_iswall_solid(struct chunk *c, struct loc grid)
True if cave square is a solid wall (generation)
Definition: cave-square.c:514
byte feat
Definition: cave.h:173
void square_set_mon(struct chunk *c, struct loc grid, int midx)
Set the occupying monster for a square.
Definition: cave-square.c:1168
void square_force_floor(struct chunk *c, struct loc grid)
Definition: cave-square.c:1369
bool square_isstairs(struct chunk *c, struct loc grid)
True if square is any stair.
Definition: cave-square.c:340
char * die_msg
Message on dying to feature.
Definition: cave.h:128
bool square_holds_object(struct chunk *c, struct loc grid, struct object *obj)
Return true if the given object is on the floor at this grid.
Definition: cave-square.c:994
void map_info(struct loc grid, struct grid_data *g)
This function takes a grid location and extracts information the player is allowed to know about it...
Definition: cave-map.c:80
void square_upgrade_mineral(struct chunk *c, struct loc grid)
Add visible treasure to a mineral square.
Definition: cave-square.c:1356
Definition: cave.h:137
bool square_ismark(struct chunk *c, struct loc grid)
SQUARE INFO PREDICATES.
Definition: cave-square.c:416
int FEAT_CLOSED
Definition: cave.c:41
const struct loc ddgrid[10]
Definition: cave.c:73
An actual trap.
Definition: trap.h:82
bool square_isview(struct chunk *c, struct loc grid)
True if the cave square is currently viewable by the player.
Definition: cave-square.c:458
bool square_iswebbed(struct chunk *c, struct loc grid)
Definition: cave-square.c:771
Low-level bit vector manipulation.
int square_digging(struct chunk *c, struct loc grid)
Definition: cave-square.c:1380
const int * dist_offsets_x[10]
Definition: cave.c:215
bool square_isglow(struct chunk *c, struct loc grid)
True if the square is lit.
Definition: cave-square.c:424
bool square_isdamaging(struct chunk *c, struct loc grid)
True if the cave square can damage the inhabitant - only lava so far.
Definition: cave-square.c:738
bool square_isquartz(struct chunk *c, struct loc grid)
True if the square is a quartz wall.
Definition: cave-square.c:261
Monster information, for a specific monster.
Definition: monster.h:369
void square_destroy(struct chunk *c, struct loc grid)
Definition: cave-square.c:1321
char * walk_msg
Message on walking into feature.
Definition: cave.h:125
struct loc cave_find_decoy(struct chunk *c)
Definition: cave.c:608
uint32_t u32b
Definition: h-basic.h:172
char * run_msg
Message on running into feature.
Definition: cave.h:126
int square_light(struct chunk *c, struct loc grid)
Definition: cave-square.c:954
Definition: z-type.h:24
int mon_current
Definition: cave.h:205
grid_light_level
Definition: cave.h:134
struct monster_group ** monster_groups
Definition: cave.h:208
bool square_wasseen(struct chunk *c, struct loc grid)
True if the cave square was seen before the current update.
Definition: cave-square.c:466
void square_smash_door(struct chunk *c, struct loc grid)
Definition: cave-square.c:1247
Information about object kinds, including player knowledge.
Definition: object.h:165
bool square_isvault(struct chunk *c, struct loc grid)
True if the square is part of a vault.
Definition: cave-square.c:434
Definition: cave.h:50
Definition: cave.h:46
void cave_update_flow(struct chunk *c)
void square_add_trap(struct chunk *c, struct loc grid)
Definition: cave-square.c:1189
#define TF_SIZE
Definition: cave.h:97
bool square_isdecoyed(struct chunk *c, struct loc grid)
Definition: cave-square.c:765
bool is_quest(int level)
Check if the given level is a quest level.
Definition: player-quest.c:140
Definition: cave.h:43
monster race blow effects
int FEAT_GRANITE
Definition: cave.c:53
void square_add_door(struct chunk *c, struct loc grid, bool closed)
Definition: cave-square.c:1232
void wiz_dark(struct chunk *c, struct player *p, bool full)
Compeletly darken the level, and know all objects.
Definition: cave-map.c:493
bool square_isplayer(struct chunk *c, struct loc grid)
True if the square contains the player.
Definition: cave-square.c:375
bool feat_is_shop(int feat)
True if the feature is a shop entrance.
Definition: cave-square.c:115
special grid flags
struct loc grid
position on map, or (0, 0)
Definition: object.h:412
bool square_isproject(struct chunk *c, struct loc grid)
True if cave square is marked for projection processing.
Definition: cave-square.c:554
Definition: cave.h:47
const s16b ddd[9]
Global array for looping through the "keypad directions".
Definition: cave.c:60
struct object * obj
Definition: cave.h:163
bool square_issecretdoor(struct chunk *c, struct loc grid)
True if the square is a hidden secret door.
Definition: cave-square.c:295
void wiz_light(struct chunk *c, struct player *p, bool full)
Light up the dungeon using "claravoyance".
Definition: cave-map.c:427
bool good_item
Definition: cave.h:186
int distance(struct loc grid1, struct loc grid2)
Approximate distance between two points.
Definition: cave-view.c:37
typedef int
Definition: libpng12/png.h:1135
u16b feeling_squares
Definition: cave.h:191
struct square ** squares
Definition: cave.h:194
bool square_iswarded(struct chunk *c, struct loc grid)
Definition: cave-square.c:759
struct loc grid
Definition: monster.h:374
bool square_iscloseddoor(struct chunk *c, struct loc grid)
True if the square is a closed door (possibly locked or jammed).
Definition: cave-square.c:312
bitflag * info
Definition: cave.h:174
Definition: game-world.h:24
bool square_isrubble(struct chunk *c, struct loc grid)
True if the square is rubble.
Definition: cave-square.c:283
bool square_isnotknown(struct chunk *c, struct loc grid)
True if the the player's knowledge of the terrain of the square is wrong or missing.
Definition: cave-square.c:399
bitflag flags[TF_SIZE]
Terrain flags.
Definition: cave.h:120
void square_destroy_trap(struct chunk *c, struct loc grid)
Definition: cave-square.c:1264
bool square_isfiery(struct chunk *c, struct loc grid)
True if the cave square is fire-based.
Definition: cave-square.c:703
uint8_t byte
Definition: h-basic.h:167
int FEAT_OPEN
Definition: cave.c:42
Definition: cave.h:44
void square_unmark(struct chunk *c, struct loc grid)
Definition: cave-square.c:1409
bool(* square_predicate)(struct chunk *c, struct loc grid)
square_predicate is a function pointer which tests a given square to see if the predicate in question...
Definition: cave.h:273
Definition: cave.h:49
int FEAT_MAGMA_K
Definition: cave.c:51
const int * dist_offsets_y[10]
Definition: cave.c:209
bool square_iswebbable(struct chunk *c, struct loc grid)
True if the square is a floor with no traps.
Definition: cave-square.c:636
bool square_iswall_inner(struct chunk *c, struct loc grid)
True if cave square is an inner wall (generation)
Definition: cave-square.c:498
void square_close_door(struct chunk *c, struct loc grid)
Definition: cave-square.c:1242
bool square_isno_map(struct chunk *c, struct loc grid)
True if cave square can't be magically mapped by the player.
Definition: cave-square.c:538
bool square_ismon_restrict(struct chunk *c, struct loc grid)
True if cave square has monster restrictions (generation)
Definition: cave-square.c:522
void set_terrain(void)
Set terrain constants to the indices from terrain.txt.
Definition: cave.c:319
void square_destroy_rubble(struct chunk *c, struct loc grid)
Definition: cave-square.c:1364
bool square_isdownstairs(struct chunk *c, struct loc grid)
True if square is a down stair.
Definition: cave-square.c:358
bool hallucinate
Definition: cave.h:155
void cave_known(struct player *p)
Make map features known, except wall/lava surrounded by wall/lava.
Definition: cave-map.c:618
int * feat_count
Definition: cave.h:192
Definition: cave.h:178
bool square_isarrivable(struct chunk *c, struct loc grid)
True if the square is empty (an open square without any items).
Definition: cave-square.c:605
int num_repro
Definition: cave.h:206
void square_set_obj(struct chunk *c, struct loc grid, struct object *obj)
Set the (first) object for a square.
Definition: cave-square.c:1176
int FEAT_SECRET
Definition: cave.c:46
int FEAT_BROKEN
Definition: cave.c:43
int resist_flag
Monster resist flag for entering feature.
Definition: cave.h:129
u32b obj_rating
Definition: cave.h:184
bool feat_is_floor(int feat)
True if the feature is a floor.
Definition: cave-square.c:83
bool feat_is_bright(int feat)
True if the feature is internally lit.
Definition: cave-square.c:147
void list_object(struct chunk *c, struct object *obj)
Enter an object in the list of objects for the current level/chunk.
Definition: cave.c:420
bool square_isno_stairs(struct chunk *c, struct loc grid)
True if cave square is inappropriate to place stairs.
Definition: cave-square.c:570
void square_light_spot(struct chunk *c, struct loc grid)
Tell the UI that a given map location has been updated.
Definition: cave-map.c:265
u16b mon_cnt
Definition: cave.h:204
char * name
Definition: cave.h:179
wchar_t d_char
Default feature character.
Definition: cave.h:123
Definition: cave.h:171
Object information, for a specific object.
Definition: object.h:401
bool square_canputitem(struct chunk *c, struct loc grid)
True if the square is an untrapped floor square without items.
Definition: cave-square.c:618
void square_earthquake(struct chunk *c, struct loc grid)
Definition: cave-square.c:1335
bool feat_is_passable(int feat)
True if the feature is passable by the player.
Definition: cave-square.c:123
bool feat_is_no_scent(int feat)
True if the feature doesn't carry player scent.
Definition: cave-square.c:171
struct feature * square_feat(struct chunk *c, struct loc grid)
Definition: cave-square.c:948
bool square_is_monster_walkable(struct chunk *c, struct loc grid)
True if a monster can walk through the tile.
Definition: cave-square.c:647
struct monster * cave_monster(struct chunk *c, int idx)
Get a monster on the current level by its index.
Definition: cave.c:549
struct feature * f_info
Definition: cave.c:36
struct trap * square_trap(struct chunk *c, struct loc grid)
Get the first (and currently only) trap in a position on the current level.
Definition: cave-square.c:985
int cave_monster_count(struct chunk *c)
The current number of monsters present on the level.
Definition: cave.c:564
int FEAT_LAVA
Definition: cave.c:55
void square_destroy_door(struct chunk *c, struct loc grid)
Definition: cave-square.c:1258
int FEAT_QUARTZ_K
Definition: cave.c:52
void square_know_pile(struct chunk *c, struct loc grid)
Update the player's knowledge of the objects on a grid in the current level.
Definition: cave-square.c:1034
struct loc grid
Location of trap.
Definition: trap.h:88
bool no_light(void)
Returns true if the player's grid is dark.
Definition: cave-view.c:712
bool square_isbright(struct chunk *c, struct loc grid)
True if the cave square is internally lit.
Definition: cave-square.c:695
u32b m_idx
Definition: cave.h:144
int FEAT_NONE
Definition: cave.c:39
bool square_isoccupied(struct chunk *c, struct loc grid)
True if the square contains the player or a monster.
Definition: cave-square.c:382
bool square_isno_teleport(struct chunk *c, struct loc grid)
True if cave square can't be teleported from by the player.
Definition: cave-square.c:530
bool square_iswall(struct chunk *c, struct loc grid)
True if the square is a wall square (impedes the player).
Definition: cave-square.c:676
bool feat_is_trap_holding(int feat)
True if the feature can hold a trap.
Definition: cave-square.c:91
bool feat_is_treasure(int feat)
True if the square is a mineral wall with treasure (magma/quartz).
Definition: cave-square.c:67
bool unseen_object
Definition: cave.h:149
int square_num_walls_adjacent(struct chunk *c, struct loc grid)
Return how many cardinal directions around (x, y) contain walls.
Definition: cave-square.c:1081
bool square_isdisarmabletrap(struct chunk *c, struct loc grid)
True if the square is a known, disarmable player trap.
Definition: cave-square.c:832
bool square_hasgoldvein(struct chunk *c, struct loc grid)
Definition: cave-square.c:275
bool square_isinvis(struct chunk *c, struct loc grid)
True if the square has an unknown trap.
Definition: cave-square.c:490
bool square_istrappable(struct chunk *c, struct loc grid)
True if the square can hold a trap.
Definition: cave-square.c:211
bool square_isbelievedwall(struct chunk *c, struct loc grid)
Checks if a square is thought by the player to block projections.
Definition: cave-square.c:904
bool feat_is_no_flow(int feat)
True if the feature doesn't carry monster flow information.
Definition: cave-square.c:163
Definition: cave.h:158
Definition: cave.h:139
bool square_isdtrap(struct chunk *c, struct loc grid)
True if cave square has been detected for traps.
Definition: cave-square.c:562
bool square_isnoflow(struct chunk *c, struct loc grid)
True if the cave square doesn't allow monster flow information.
Definition: cave-square.c:746
bool square_isseen(struct chunk *c, struct loc grid)
True if the square has been seen by the player.
Definition: cave-square.c:450
s16b mon
Definition: cave.h:162
void square_add_web(struct chunk *c, struct loc grid)
Definition: cave-square.c:1216
u32b f_idx
Definition: cave.h:145
void cave_free(struct chunk *c)
Free a chunk.
Definition: cave.c:380
bool square_isobjectholding(struct chunk *c, struct loc grid)
True if the square can hold an object.
Definition: cave-square.c:219
void square_destroy_wall(struct chunk *c, struct loc grid)
Definition: cave-square.c:1289
int type
Definition: mon-msg.c:80
int cave_monster_max(struct chunk *c)
The maximum number of monsters allowed in the level.
Definition: cave.c:557
int FEAT_MORE
Definition: cave.c:45
int square_shopnum(struct chunk *c, struct loc grid)
Definition: cave-square.c:1374
int light
Definition: cave.h:161
void square_set_trap(struct chunk *c, struct loc grid, struct trap *trap)
Set the (first) trap for a square.
Definition: cave-square.c:1184
bool square_isbrokendoor(struct chunk *c, struct loc grid)
Definition: cave-square.c:318
bool square_issecrettrap(struct chunk *c, struct loc grid)
True if the square is an unknown player trap (it will appear as a floor tile)
Definition: cave-square.c:815
bool square_isplayertrap(struct chunk *c, struct loc grid)
True if there is a player trap (known or unknown) in this square.
Definition: cave-square.c:799
bool los(struct chunk *c, struct loc grid1, struct loc grid2)
A simple, fast, integer-based line-of-sight algorithm.
Definition: cave-view.c:84
int FEAT_MAGMA
Definition: cave.c:49
bitflag * info
Definition: cave.h:160
void square_open_door(struct chunk *c, struct loc grid)
Definition: cave-square.c:1236
const char ** p[]
Definition: name.c:40
byte bitflag
Definition: z-bitflag.h:27
char * desc
Definition: cave.h:109
int motion_dir(struct loc source, struct loc target)
Given a "start" and "finish" location, extract a "direction", which will move one step from the "star...
Definition: cave.c:264
void cave_illuminate(struct chunk *c, bool daytime)
Light or Darken the town.
Definition: cave-map.c:555
Definition: cave.h:45
u16b obj_max
Definition: cave.h:200
bool square_isprojectable(struct chunk *c, struct loc grid)
True if any projectable can pass through the square.
Definition: cave-square.c:666
bool square_isopen(struct chunk *c, struct loc grid)
SQUARE BEHAVIOR PREDICATES.
Definition: cave-square.c:589
const s16b ddx[10]
Global arrays for converting "keypad direction" into "offsets".
Definition: cave.c:66
bool square_istrap(struct chunk *c, struct loc grid)
True if the square has a known trap.
Definition: cave-square.c:482
Definition: cave.h:41
bool feat_is_magma(int feat)
FEATURE PREDICATES.
Definition: cave-square.c:43
int16_t s16b
Definition: h-basic.h:170
void square_disable_trap(struct chunk *c, struct loc grid)
Definition: cave-square.c:1269
void square_excise_pile(struct chunk *c, struct loc grid)
Excise an entire floor pile.
Definition: cave-square.c:1010
void square_add_stairs(struct chunk *c, struct loc grid, int depth)
Definition: cave-square.c:1222
bool square_isno_esp(struct chunk *c, struct loc grid)
True if cave square can't be detected by player ESP.
Definition: cave-square.c:546
struct chunk * cave
Definition: cave.c:37
bool square_iswall_outer(struct chunk *c, struct loc grid)
True if cave square is an outer wall (generation)
Definition: cave-square.c:506
void square_set_feat(struct chunk *c, struct loc grid, int feat)
Set the terrain type for a square.
Definition: cave-square.c:1121
bool square_isvisibletrap(struct chunk *c, struct loc grid)
True if there is a visible trap in this square.
Definition: cave-square.c:807
bool square_isdiggable(struct chunk *c, struct loc grid)
True if the square can be dug: this includes rubble and non-permanent walls.
Definition: cave-square.c:627
bool feat_is_quartz(int feat)
True if the square is a quartz wall.
Definition: cave-square.c:51
char * mimic
Name of feature to mimic.
Definition: cave.h:114
void square_destroy_decoy(struct chunk *c, struct loc grid)
Definition: cave-square.c:1275
Definition: cave.h:138
bool feat_is_wall(int feat)
True if the feature is a solid wall (not rubble).
Definition: cave-square.c:75
bool feat_is_fiery(int feat)
True if the feature is internally lit.
Definition: cave-square.c:155
bool square_in_bounds_fully(struct chunk *c, struct loc grid)
Definition: cave-square.c:894
Support various data types.
bool square_isempty(struct chunk *c, struct loc grid)
True if the square is empty (an open square without any items).
Definition: cave-square.c:596
Definition: cave.h:42
u16b mon_max
Definition: cave.h:203
u32b mon_rating
Definition: cave.h:185
Definition: mon-group.h:28
bool square_isshop(struct chunk *c, struct loc grid)
True if the square is a shop entrance.
Definition: cave-square.c:367
void square_excise_object(struct chunk *c, struct loc grid, struct object *obj)
Excise an object from a floor pile, leaving it orphaned.
Definition: cave-square.c:1002
bool multiple_objects
Definition: cave.h:148
const s16b ddy[10]
Definition: cave.c:69
struct feature * next
Definition: cave.h:112
bool square_ismineral(struct chunk *c, struct loc grid)
True if the square is a mineral wall (magma/quartz/granite).
Definition: cave-square.c:269
bool in_view
Definition: cave.h:153
bool square_isdisabledtrap(struct chunk *c, struct loc grid)
True if the square is a known, disabled player trap.
Definition: cave-square.c:823
void square_memorize(struct chunk *c, struct loc grid)
Definition: cave-square.c:1394
bool square_isknown(struct chunk *c, struct loc grid)
True if the the player knows the terrain of the square.
Definition: cave-square.c:389
bool square_isrock(struct chunk *c, struct loc grid)
True if the square is a normal granite rock wall.
Definition: cave-square.c:227
const s16b ddy_ddd[9]
Definition: cave.c:87
bool is_player
Definition: cave.h:154
struct connector * join
Definition: cave.h:210
byte feeling
Definition: cave.h:183
char * name
Definition: cave.h:108
bool square_isdoor(struct chunk *c, struct loc grid)
True if the square is a door.
Definition: cave-square.c:331
int count_feats(struct loc *grid, bool(*test)(struct chunk *c, struct loc grid), bool under)
Return the number of doors/traps around (or under) the character.
Definition: cave.c:571
bool square_isstrongwall(struct chunk *c, struct loc grid)
True if the square is a permanent wall or one of the "stronger" walls.
Definition: cave-square.c:687
s32b turn
Definition: cave.h:180
void square_add_glyph(struct chunk *c, struct loc grid, int type)
Definition: cave-square.c:1195
bool square_seemslikewall(struct chunk *c, struct loc grid)
Definition: cave-square.c:777
bool square_in_bounds(struct chunk *c, struct loc grid)
Definition: cave-square.c:887
Information about terrain features.
Definition: cave.h:107
byte feat
Definition: cave.h:159
int square_num_walls_diagonal(struct chunk *c, struct loc grid)
Return how many diagonal directions around (x, y) contain walls.
Definition: cave-square.c:1101
struct loc next_grid(struct loc grid, int dir)
Given a grid and a direction, extract the adjacent grid in that direction.
Definition: cave.c:288
struct chunk * cave_new(int height, int width)
Allocate a new chunk of the world.
Definition: cave.c:343
void object_lists_check_integrity(struct chunk *c, struct chunk *c_k)
Check that a pair of object lists are consistent and relate to locations of objects correctly...
Definition: cave.c:483
bool square_changeable(struct chunk *c, struct loc grid)
Determine if a given location may be "destroyed".
Definition: cave-square.c:868
bool square_islit(struct chunk *c, struct loc grid)
True if the cave square is lit.
Definition: cave-square.c:711
png_infop png_uint_32 png_uint_32 * height
Definition: libpng12/png.h:2341
u16b chunk_list_max
current max actual chunk index
Definition: gen-chunk.c:37
Definition: cave.h:48
void square_tunnel_wall(struct chunk *c, struct loc grid)
Definition: cave-square.c:1284
bool square_isnoscent(struct chunk *c, struct loc grid)
True if the cave square doesn't carry player scent.
Definition: cave-square.c:754
void square_mark(struct chunk *c, struct loc grid)
Definition: cave-square.c:1405
int fidx
Definition: cave.h:110
Definition: unit-test-types.h:10
int FEAT_LESS
Definition: cave.c:44
struct monster * square_monster(struct chunk *c, struct loc grid)
Get a monster on the current level by its position.
Definition: cave-square.c:963
Definition: cave.h:143
bool unseen_money
Definition: cave.h:150
png_infop png_uint_32 * width
Definition: libpng12/png.h:2341
void update_view(struct chunk *c, struct player *p)
Update the player's current view.
Definition: cave-view.c:680
void light_room(struct loc grid, bool light)
Illuminate or darken any room containing the given location.
Definition: cave-map.c:382
int32_t s32b
Definition: h-basic.h:173
bool square_isupstairs(struct chunk *c, struct loc grid)
True if square is an up stair.
Definition: cave-square.c:349
bool square_suits_stairs_ok(struct chunk *c, struct loc grid)
Checks if a square is in a corridor.
Definition: cave-square.c:927
void square_sense_pile(struct chunk *c, struct loc grid)
Sense the existence of objects on a grid in the current level.
Definition: cave-square.c:1019
bool square_isperm(struct chunk *c, struct loc grid)
True if the square is a permanent wall.
Definition: cave-square.c:244
Definition: cave.h:51
Definition: cave.h:140
Definition: cave.h:136
byte shopnum
Which shop does it take you to?
Definition: cave.h:117
bool square_ispassable(struct chunk *c, struct loc grid)
True if the square is passable by the player.
Definition: cave-square.c:656
bool square_islockeddoor(struct chunk *c, struct loc grid)
True if the square is a closed, locked door.
Definition: cave-square.c:791
Intialize random names
Definition: init.c:847
int FEAT_FLOOR
Definition: cave.c:40
bool square_isfloor(struct chunk *c, struct loc grid)
SQUARE FEATURE PREDICATES.
Definition: cave-square.c:203
void prepare_next_level(struct chunk **c, struct player *p)
Prepare the level the player is about to enter, either by generating or reloading.
Definition: generate.c:1170
int width
Definition: cave.h:189
byte d_attr
Default feature attribute.
Definition: cave.h:122
Most of the "player" information goes here.
Definition: player.h:489
int lookup_feat(const char *name)
Find a terrain feature index by name.
Definition: cave.c:296
bool feat_is_object_holding(int feat)
True if the feature can hold an object.
Definition: cave-square.c:99
bool feat_is_smooth(int feat)
True if the feature should have smooth boundaries (for dungeon generation).
Definition: cave-square.c:179
const char * square_apparent_name(struct chunk *c, struct player *p, struct loc grid)
Definition: cave-square.c:1386
struct trap * trap
Definition: cave.h:164
struct object_kind * first_kind
Definition: cave.h:146
int depth
Definition: cave.h:181
int FEAT_RUBBLE
Definition: cave.c:47
Definition: source.h:7
char * hurt_msg
Message on being hurt by feature.
Definition: cave.h:127
bool square_isopendoor(struct chunk *c, struct loc grid)
True if the square is an open door.
Definition: cave-square.c:304
struct trap * trap
Definition: cave.h:147
int height
Definition: cave.h:188
int FEAT_PERM
Definition: cave.c:54
void delist_object(struct chunk *c, struct object *obj)
Remove an object from the list of objects for the current level/chunk.
Definition: cave.c:467
bool feat_is_granite(int feat)
True if the square is a granite wall.
Definition: cave-square.c:59
bool feat_is_projectable(int feat)
True if any projectable can pass through the feature.
Definition: cave-square.c:131
int FEAT_QUARTZ
Definition: cave.c:50
struct monster * monsters
Definition: cave.h:202
void cave_forget_flow(struct chunk *c)
int FEAT_PASS_RUBBLE
Definition: cave.c:48
void square_unlock_door(struct chunk *c, struct loc grid)
Definition: cave-square.c:1253
bool square_islitwall(struct chunk *c, struct loc grid)
True if a lit wall should appear lit.
Definition: cave-square.c:719
Definition: target.h:39
bool feat_is_torch(int feat)
True if the feature can be lit by light sources.
Definition: cave-square.c:139
u16b ** grids
Definition: cave.h:168
const byte side_dirs[20][8]
Given a central direction at position [dir #][0], return a series of directions radiating out on both...
Definition: cave.c:232
void scatter(struct chunk *c, struct loc *place, struct loc grid, int d, bool need_los)
Standard "find me a location" function, now with all legal outputs!
Definition: cave.c:519
byte priority
Display priority.
Definition: cave.h:115
Definition: cave.h:96
const s16b ddx_ddd[9]
Global arrays for optimizing "ddx[ddd[i]]", "ddy[ddd[i]]" and "loc(ddx[ddd[i]], ddy[ddd[i]])".
Definition: cave.c:84
struct connector * next
Definition: cave.h:175
struct chunk ** chunk_list
list of pointers to saved chunks
Definition: gen-chunk.c:36
bool square_isfeel(struct chunk *c, struct loc grid)
True if cave square is a feeling trigger square.
Definition: cave-square.c:474
void square_note_spot(struct chunk *c, struct loc grid)
Memorize interesting viewable object/features in the given grid.
Definition: cave-map.c:236
bool square_isinteresting(struct chunk *c, struct loc grid)
Definition: cave-square.c:782
void square_forget(struct chunk *c, struct loc grid)
Definition: cave-square.c:1400
bool square_isroom(struct chunk *c, struct loc grid)
True if the square is part of a room.
Definition: cave-square.c:442
bool square_dtrap_edge(struct chunk *c, struct loc grid)
Checks if a square is at the (inner) edge of a trap detect area.
Definition: cave-square.c:841
struct object * square_object(struct chunk *c, struct loc grid)
Get the top object of a pile on the current level by its position.
Definition: cave-square.c:977
byte dig
How hard is it to dig through?
Definition: cave.h:118