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 
28 extern const s16b ddd[9];
29 extern const s16b ddx[10];
30 extern const s16b ddy[10];
31 extern const s16b ddx_ddd[9];
32 extern const s16b ddy_ddd[9];
33 extern const int *dist_offsets_y[10];
34 extern const int *dist_offsets_x[10];
35 extern const byte side_dirs[20][8];
36 
41 enum
42 {
43  #define SQUARE(a,b) SQUARE_##a,
44  #include "list-square-flags.h"
45  #undef SQUARE
47 };
48 
49 #define SQUARE_SIZE FLAG_SIZE(SQUARE_MAX)
50 
51 #define sqinfo_has(f, flag) flag_has_dbg(f, SQUARE_SIZE, flag, #f, #flag)
52 #define sqinfo_next(f, flag) flag_next(f, SQUARE_SIZE, flag)
53 #define sqinfo_is_empty(f) flag_is_empty(f, SQUARE_SIZE)
54 #define sqinfo_is_full(f) flag_is_full(f, SQUARE_SIZE)
55 #define sqinfo_is_inter(f1, f2) flag_is_inter(f1, f2, SQUARE_SIZE)
56 #define sqinfo_is_subset(f1, f2) flag_is_subset(f1, f2, SQUARE_SIZE)
57 #define sqinfo_is_equal(f1, f2) flag_is_equal(f1, f2, SQUARE_SIZE)
58 #define sqinfo_on(f, flag) flag_on_dbg(f, SQUARE_SIZE, flag, #f, #flag)
59 #define sqinfo_off(f, flag) flag_off(f, SQUARE_SIZE, flag)
60 #define sqinfo_wipe(f) flag_wipe(f, SQUARE_SIZE)
61 #define sqinfo_setall(f) flag_setall(f, SQUARE_SIZE)
62 #define sqinfo_negate(f) flag_negate(f, SQUARE_SIZE)
63 #define sqinfo_copy(f1, f2) flag_copy(f1, f2, SQUARE_SIZE)
64 #define sqinfo_union(f1, f2) flag_union(f1, f2, SQUARE_SIZE)
65 #define sqinfo_inter(f1, f2) flag_inter(f1, f2, SQUARE_SIZE)
66 #define sqinfo_diff(f1, f2) flag_diff(f1, f2, SQUARE_SIZE)
67 
68 
72 enum
73 {
74  #define TF(a,b) TF_##a,
75  #include "list-terrain-flags.h"
76  #undef TF
77  TF_MAX
78 };
79 
80 #define TF_SIZE FLAG_SIZE(TF_MAX)
81 
82 #define tf_has(f, flag) flag_has_dbg(f, TF_SIZE, flag, #f, #flag)
83 
90 struct feature {
91  char *name;
92  char *desc;
93  int fidx;
94 
95  struct feature *next;
96 
97  char *mimic;
106  wchar_t d_char;
108  char *walk_msg;
109  char *run_msg;
110  char *hurt_msg;
111  char *die_msg;
113 };
114 
115 extern struct feature *f_info;
116 
118 {
119  LIGHTING_LOS = 0, /* line of sight */
120  LIGHTING_TORCH, /* torchlight */
121  LIGHTING_LIT, /* permanently lit (when not in line of sight) */
122  LIGHTING_DARK, /* dark */
124 };
125 
126 struct grid_data {
127  u32b m_idx; /* Monster index */
128  u32b f_idx; /* Feature index */
129  struct object_kind *first_kind; /* The kind of the first item on the grid */
130  struct trap *trap; /* Trap */
131  bool multiple_objects; /* Is there more than one item there? */
132  bool unseen_object; /* Is there an unaware object there? */
133  bool unseen_money; /* Is there some unaware money there? */
134 
135  enum grid_light_level lighting; /* Light level */
136  bool in_view; /* Can the player can currently see the grid? */
137  bool is_player;
139 };
140 
141 struct square {
145  struct object *obj;
146  struct trap *trap;
147 };
148 
149 struct heatmap {
151 };
152 
153 struct connector {
154  struct loc grid;
157  struct connector *next;
158 };
159 
160 struct chunk {
161  char *name;
163  int depth;
164 
168  bool good_item;
169 
170  int height;
171  int width;
172 
173  u16b feeling_squares; /* How many feeling squares the player has visited */
175 
176  struct square **squares;
177  struct heatmap noise;
178  struct heatmap scent;
179  struct loc decoy;
180 
181  struct object **objects;
183 
184  struct monster *monsters;
188 
189  struct connector *join;
190 };
191 
192 /*** Feature Indexes (see "lib/gamedata/terrain.txt") ***/
193 
194 /* Nothing */
195 extern int FEAT_NONE;
196 
197 /* Various */
198 extern int FEAT_FLOOR;
199 extern int FEAT_CLOSED;
200 extern int FEAT_OPEN;
201 extern int FEAT_BROKEN;
202 extern int FEAT_LESS;
203 extern int FEAT_MORE;
204 
205 /* Secret door */
206 extern int FEAT_SECRET;
207 
208 /* Rubble */
209 extern int FEAT_RUBBLE;
210 extern int FEAT_PASS_RUBBLE;
211 
212 /* Mineral seams */
213 extern int FEAT_MAGMA;
214 extern int FEAT_QUARTZ;
215 extern int FEAT_MAGMA_K;
216 extern int FEAT_QUARTZ_K;
217 
218 /* Walls */
219 extern int FEAT_GRANITE;
220 extern int FEAT_PERM;
221 extern int FEAT_LAVA;
222 
223 
224 /* Current level */
225 extern struct chunk *cave;
226 /* Stored levels */
227 extern struct chunk **chunk_list;
228 extern u16b chunk_list_max;
229 
230 /* cave-view.c */
231 int distance(struct loc grid1, struct loc grid2);
232 bool los(struct chunk *c, int y1, int x1, int y2, int x2);
233 void update_view(struct chunk *c, struct player *p);
234 bool no_light(void);
235 
236 /* cave-map.c */
237 void map_info(unsigned x, unsigned y, struct grid_data *g);
238 void square_note_spot(struct chunk *c, int y, int x);
239 void square_light_spot(struct chunk *c, int y, int x);
240 void light_room(int y1, int x1, bool light);
241 void wiz_light(struct chunk *c, struct player *p, bool full);
242 void wiz_dark(struct chunk *c, struct player *p, bool full);
243 void cave_illuminate(struct chunk *c, bool daytime);
244 void cave_update_flow(struct chunk *c);
245 void cave_forget_flow(struct chunk *c);
246 
247 /* cave-square.c */
252 typedef bool (*square_predicate)(struct chunk *c, int y, int x);
253 
254 /* FEATURE PREDICATES */
255 bool feat_is_magma(int feat);
256 bool feat_is_quartz(int feat);
257 bool feat_is_granite(int feat);
258 bool feat_is_treasure(int feat);
259 bool feat_is_wall(int feat);
260 bool feat_is_floor(int feat);
261 bool feat_is_trap_holding(int feat);
262 bool feat_is_object_holding(int feat);
263 bool feat_is_monster_walkable(int feat);
264 bool feat_is_shop(int feat);
265 bool feat_is_passable(int feat);
266 bool feat_is_projectable(int feat);
267 bool feat_is_torch(int feat);
268 bool feat_is_bright(int feat);
269 bool feat_is_fiery(int feat);
270 bool feat_is_no_flow(int feat);
271 bool feat_is_no_scent(int feat);
272 bool feat_is_smooth(int feat);
273 
274 /* SQUARE FEATURE PREDICATES */
275 bool square_isfloor(struct chunk *c, int y, int x);
276 bool square_istrappable(struct chunk *c, int y, int x);
277 bool square_isobjectholding(struct chunk *c, int y, int x);
278 bool square_isrock(struct chunk *c, int y, int x);
279 bool square_isgranite(struct chunk *c, int y, int x);
280 bool square_isperm(struct chunk *c, int y, int x);
281 bool square_ismagma(struct chunk *c, int y, int x);
282 bool square_isquartz(struct chunk *c, int y, int x);
283 bool square_ismineral(struct chunk *c, int y, int x);
284 bool square_hasgoldvein(struct chunk *c, int y, int x);
285 bool square_isrubble(struct chunk *c, int y, int x);
286 bool square_issecretdoor(struct chunk *c, int y, int x);
287 bool square_isopendoor(struct chunk *c, int y, int x);
288 bool square_iscloseddoor(struct chunk *c, int y, int x);
289 bool square_islockeddoor(struct chunk *c, int y, int x);
290 bool square_isbrokendoor(struct chunk *c, int y, int x);
291 bool square_isdoor(struct chunk *c, int y, int x);
292 bool square_isstairs(struct chunk *c, int y, int x);
293 bool square_isupstairs(struct chunk *c, int y, int x);
294 bool square_isdownstairs(struct chunk *c, int y, int x);
295 bool square_isshop(struct chunk *c, int y, int x);
296 bool square_isplayer(struct chunk *c, int y, int x);
297 bool square_isoccupied(struct chunk *c, int y, int x);
298 bool square_isknown(struct chunk *c, int y, int x);
299 bool square_isnotknown(struct chunk *c, int y, int x);
300 
301 /* SQUARE INFO PREDICATES */
302 bool square_ismark(struct chunk *c, int y, int x);
303 bool square_isglow(struct chunk *c, int y, int x);
304 bool square_isvault(struct chunk *c, int y, int x);
305 bool square_isroom(struct chunk *c, int y, int x);
306 bool square_isseen(struct chunk *c, int y, int x);
307 bool square_isview(struct chunk *c, int y, int x);
308 bool square_wasseen(struct chunk *c, int y, int x);
309 bool square_isfeel(struct chunk *c, int y, int x);
310 bool square_istrap(struct chunk *c, int y, int x);
311 bool square_isinvis(struct chunk *c, int y, int x);
312 bool square_iswall_inner(struct chunk *c, int y, int x);
313 bool square_iswall_outer(struct chunk *c, int y, int x);
314 bool square_iswall_solid(struct chunk *c, int y, int x);
315 bool square_ismon_restrict(struct chunk *c, int y, int x);
316 bool square_isno_teleport(struct chunk *c, int y, int x);
317 bool square_isno_map(struct chunk *c, int y, int x);
318 bool square_isno_esp(struct chunk *c, int y, int x);
319 bool square_isproject(struct chunk *c, int y, int x);
320 bool square_isdtrap(struct chunk *c, int y, int x);
321 bool square_isno_stairs(struct chunk *c, int y, int x);
322 
323 /* SQUARE BEHAVIOR PREDICATES */
324 bool square_isopen(struct chunk *c, int y, int x);
325 bool square_isempty(struct chunk *c, int y, int x);
326 bool square_isarrivable(struct chunk *c, int y, int x);
327 bool square_canputitem(struct chunk *c, int y, int x);
328 bool square_isdiggable(struct chunk *c, int y, int x);
329 bool square_is_monster_walkable(struct chunk *c, int y, int x);
330 bool square_ispassable(struct chunk *c, int y, int x);
331 bool square_isprojectable(struct chunk *c, int y, int x);
332 bool square_iswall(struct chunk *c, int y, int x);
333 bool square_isstrongwall(struct chunk *c, int y, int x);
334 bool square_isbright(struct chunk *c, int y, int x);
335 bool square_isfiery(struct chunk *c, int y, int x);
336 bool square_islit(struct chunk *c, int y, int x);
337 bool square_isdamaging(struct chunk *c, int y, int x);
338 bool square_isnoflow(struct chunk *c, int y, int x);
339 bool square_isnoscent(struct chunk *c, int y, int x);
340 bool square_iswarded(struct chunk *c, int y, int x);
341 bool square_isdecoyed(struct chunk *c, int y, int x);
342 bool square_seemslikewall(struct chunk *c, int y, int x);
343 bool square_isinteresting(struct chunk *c, int y, int x);
344 bool square_isplayertrap(struct chunk *c, int y, int x);
345 bool square_isvisibletrap(struct chunk *c, int y, int x);
346 bool square_issecrettrap(struct chunk *c, int y, int x);
347 bool square_isdisabledtrap(struct chunk *c, int y, int x);
348 bool square_isdisarmabletrap(struct chunk *c, int y, int x);
349 bool square_dtrap_edge(struct chunk *c, int y, int x);
350 bool square_changeable(struct chunk *c, int y, int x);
351 bool square_in_bounds(struct chunk *c, int y, int x);
352 bool square_in_bounds_fully(struct chunk *c, int y, int x);
353 bool square_isbelievedwall(struct chunk *c, int y, int x);
354 bool square_suits_stairs_well(struct chunk *c, int y, int x);
355 bool square_suits_stairs_ok(struct chunk *c, int y, int x);
356 
357 
358 struct feature *square_feat(struct chunk *c, int y, int x);
359 struct monster *square_monster(struct chunk *c, int y, int x);
360 struct object *square_object(struct chunk *c, int y, int x);
361 struct trap *square_trap(struct chunk *c, int y, int x);
362 bool square_holds_object(struct chunk *c, int y, int x, struct object *obj);
363 void square_excise_object(struct chunk *c, int y, int x, struct object *obj);
364 void square_excise_pile(struct chunk *c, int y, int x);
365 void square_sense_pile(struct chunk *c, int y, int x);
366 void square_know_pile(struct chunk *c, int y, int x);
367 int square_num_walls_adjacent(struct chunk *c, int y, int x);
368 int square_num_walls_diagonal(struct chunk *c, int y, int x);
369 
370 void square_set_feat(struct chunk *c, int y, int x, int feat);
371 
372 /* Feature placers */
373 void square_add_trap(struct chunk *c, int y, int x);
374 void square_add_glyph(struct chunk *c, int y, int x, int type);
375 void square_add_stairs(struct chunk *c, int y, int x, int depth);
376 void square_add_door(struct chunk *c, int y, int x, bool closed);
377 
378 /* Feature modifiers */
379 void square_open_door(struct chunk *c, int y, int x);
380 void square_close_door(struct chunk *c, int y, int x);
381 void square_smash_door(struct chunk *c, int y, int x);
382 void square_lock_door(struct chunk *c, int y, int x, int power);
383 void square_unlock_door(struct chunk *c, int y, int x);
384 void square_destroy_door(struct chunk *c, int y, int x);
385 void square_show_trap(struct chunk *c, int y, int x, int type);
386 void square_destroy_trap(struct chunk *c, int y, int x);
387 void square_disable_trap(struct chunk *c, int y, int x);
388 void square_destroy_decoy(struct chunk *c, int y, int x);
389 void square_tunnel_wall(struct chunk *c, int y, int x);
390 void square_destroy_wall(struct chunk *c, int y, int x);
391 void square_destroy(struct chunk *c, int y, int x);
392 void square_earthquake(struct chunk *c, int y, int x);
393 void square_upgrade_mineral(struct chunk *c, int y, int x);
394 void square_destroy_rubble(struct chunk *c, int y, int x);
395 void square_force_floor(struct chunk *c, int y, int x);
396 
397 
398 int square_shopnum(struct chunk *c, int y, int x);
399 int square_digging(struct chunk *c, int y, int x);
400 const char *square_apparent_name(struct chunk *c, struct player *p, int y, int x);
401 
402 void square_memorize(struct chunk *c, int y, int x);
403 void square_forget(struct chunk *c, int y, int x);
404 void square_mark(struct chunk *c, int y, int x);
405 void square_unmark(struct chunk *c, int y, int x);
406 
407 /* cave.c */
408 int motion_dir(struct loc source, struct loc target);
409 int lookup_feat(const char *name);
410 void set_terrain(void);
411 struct chunk *cave_new(int height, int width);
412 void cave_free(struct chunk *c);
413 void list_object(struct chunk *c, struct object *obj);
414 void delist_object(struct chunk *c, struct object *obj);
415 void object_lists_check_integrity(struct chunk *c, struct chunk *c_k);
416 void scatter(struct chunk *c, int *yp, int *xp, int y, int x, int d, bool need_los);
417 
418 struct monster *cave_monster(struct chunk *c, int idx);
419 int cave_monster_max(struct chunk *c);
420 int cave_monster_count(struct chunk *c);
421 
422 int count_feats(int *y, int *x, bool (*test)(struct chunk *c, int y, int x), bool under);
423 struct loc cave_find_decoy(struct chunk *c);
424 void prepare_next_level(struct chunk **c, struct player *p);
425 bool is_quest(int level);
426 
427 void cave_known(struct player *p);
428 
429 #endif /* !CAVE_H */
uint16_t u16b
Definition: h-basic.h:169
void square_memorize(struct chunk *c, int y, int x)
Definition: cave-square.c:1294
bool feat_is_monster_walkable(int feat)
True if a monster can walk through the feature.
Definition: cave-square.c:107
bool square_isrubble(struct chunk *c, int y, int x)
True if the square is rubble.
Definition: cave-square.c:282
Definition: cave.h:149
struct object ** objects
Definition: cave.h:181
bool square_isdisarmabletrap(struct chunk *c, int y, int x)
True if the square is a known, disarmable player trap.
Definition: cave-square.c:816
void square_excise_pile(struct chunk *c, int y, int x)
Excise an entire floor pile.
Definition: cave-square.c:976
byte feat
Definition: cave.h:155
bool square_isobjectholding(struct chunk *c, int y, int x)
True if the square can hold an object.
Definition: cave-square.c:218
char * die_msg
Message on dying to feature.
Definition: cave.h:111
Definition: cave.h:79
bool square_isno_map(struct chunk *c, int y, int x)
True if cave square can't be magically mapped by the player.
Definition: cave-square.c:537
bool square_isdisabledtrap(struct chunk *c, int y, int x)
True if the square is a known, disabled player trap.
Definition: cave-square.c:807
bool square_isdoor(struct chunk *c, int y, int x)
True if the square is a door.
Definition: cave-square.c:330
Definition: cave.h:120
void square_destroy(struct chunk *c, int y, int x)
Definition: cave-square.c:1222
bool square_isrock(struct chunk *c, int y, int x)
True if the square is a normal granite rock wall.
Definition: cave-square.c:226
int FEAT_CLOSED
Definition: cave.c:40
An actual trap.
Definition: trap.h:82
Low-level bit vector manipulation.
const int * dist_offsets_x[10]
Definition: cave.c:205
bool square_isproject(struct chunk *c, int y, int x)
True if cave square is marked for projection processing.
Definition: cave-square.c:553
void square_excise_object(struct chunk *c, int y, int x, struct object *obj)
Excise an object from a floor pile, leaving it orphaned.
Definition: cave-square.c:968
Monster information, for a specific monster.
Definition: monster.h:325
void scatter(struct chunk *c, int *yp, int *xp, int y, int x, int d, bool need_los)
Standard "find me a location" function, now with all legal outputs!
Definition: cave.c:497
struct feature * square_feat(struct chunk *c, int y, int x)
OTHER SQUARE FUNCTIONS.
Definition: cave-square.c:920
char * walk_msg
Message on walking into feature.
Definition: cave.h:108
struct loc cave_find_decoy(struct chunk *c)
Definition: cave.c:591
void square_lock_door(struct chunk *c, int y, int x, int power)
uint32_t u32b
Definition: h-basic.h:172
char * run_msg
Message on running into feature.
Definition: cave.h:109
bool square_isvisibletrap(struct chunk *c, int y, int x)
True if there is a visible trap in this square.
Definition: cave-square.c:791
Definition: z-type.h:24
int mon_current
Definition: cave.h:187
bool square_isstairs(struct chunk *c, int y, int x)
True if square is any stair.
Definition: cave-square.c:339
grid_light_level
Definition: cave.h:117
Information about object kinds, including player knowledge.
Definition: object.h:163
bool square_islit(struct chunk *c, int y, int x)
True if the cave square is lit.
Definition: cave-square.c:702
void cave_update_flow(struct chunk *c)
void square_destroy_wall(struct chunk *c, int y, int x)
Definition: cave-square.c:1217
#define TF_SIZE
Definition: cave.h:80
bool square_issecretdoor(struct chunk *c, int y, int x)
True if the square is a hidden secret door.
Definition: cave-square.c:294
bool square_istrap(struct chunk *c, int y, int x)
True if the square has a known trap.
Definition: cave-square.c:481
bool is_quest(int level)
Check if the given level is a quest level.
Definition: player-quest.c:140
monster race blow effects
int FEAT_GRANITE
Definition: cave.c:52
void map_info(unsigned x, unsigned y, struct grid_data *g)
This function takes a grid location (x, y) and extracts information the player is allowed to know abo...
Definition: cave-map.c:79
void wiz_dark(struct chunk *c, struct player *p, bool full)
Compeletly darken the level, and know all objects.
Definition: cave-map.c:491
bool feat_is_shop(int feat)
True if the feature is a shop entrance.
Definition: cave-square.c:115
special grid flags
void square_tunnel_wall(struct chunk *c, int y, int x)
Definition: cave-square.c:1212
const s16b ddd[9]
Global array for looping through the "keypad directions".
Definition: cave.c:59
bool square_in_bounds(struct chunk *c, int y, int x)
Definition: cave-square.c:867
bool square_ismon_restrict(struct chunk *c, int y, int x)
True if cave square has monster restrictions (generation)
Definition: cave-square.c:521
void square_add_door(struct chunk *c, int y, int x, bool closed)
Definition: cave-square.c:1160
struct object * obj
Definition: cave.h:145
void wiz_light(struct chunk *c, struct player *p, bool full)
Light up the dungeon using "claravoyance".
Definition: cave-map.c:427
bool square_isplayer(struct chunk *c, int y, int x)
True if the square contains the player.
Definition: cave-square.c:374
bool good_item
Definition: cave.h:168
void square_set_feat(struct chunk *c, int y, int x, int feat)
Set the terrain type for a square.
Definition: cave-square.c:1088
bool square_isbelievedwall(struct chunk *c, int y, int x)
Checks if a square is thought by the player to block projections.
Definition: cave-square.c:882
int distance(struct loc grid1, struct loc grid2)
Approximate distance between two points.
Definition: cave-view.c:37
bool square_isno_stairs(struct chunk *c, int y, int x)
True if cave square is inappropriate to place stairs.
Definition: cave-square.c:569
u16b feeling_squares
Definition: cave.h:173
struct square ** squares
Definition: cave.h:176
int square_shopnum(struct chunk *c, int y, int x)
Definition: cave-square.c:1275
bitflag * info
Definition: cave.h:156
Definition: game-world.h:24
void square_add_stairs(struct chunk *c, int y, int x, int depth)
Definition: cave-square.c:1150
bitflag flags[TF_SIZE]
Terrain flags.
Definition: cave.h:103
uint8_t byte
Definition: h-basic.h:167
int FEAT_OPEN
Definition: cave.c:41
bool square_isstrongwall(struct chunk *c, int y, int x)
True if the square is a permanent wall or one of the "stronger" walls.
Definition: cave-square.c:678
byte power
Power for locks, visibility for traps.
Definition: trap.h:91
bool square_islockeddoor(struct chunk *c, int y, int x)
True if the square is a closed, locked door.
Definition: cave-square.c:775
bool square_isdownstairs(struct chunk *c, int y, int x)
True if square is a down stair.
Definition: cave-square.c:357
bool square_isseen(struct chunk *c, int y, int x)
True if the square has been seen by the player.
Definition: cave-square.c:449
int FEAT_MAGMA_K
Definition: cave.c:50
const int * dist_offsets_y[10]
Definition: cave.c:199
bool square_issecrettrap(struct chunk *c, int y, int x)
True if the square is an unknown player trap (it will appear as a floor tile)
Definition: cave-square.c:799
bool los(struct chunk *c, int y1, int x1, int y2, int x2)
A simple, fast, integer-based line-of-sight algorithm.
Definition: cave-view.c:84
void set_terrain(void)
Set terrain constants to the indices from terrain.txt.
Definition: cave.c:302
void square_show_trap(struct chunk *c, int y, int x, int type)
bool square_suits_stairs_ok(struct chunk *c, int y, int x)
Checks if a square is in a corridor.
Definition: cave-square.c:905
bool hallucinate
Definition: cave.h:138
void cave_known(struct player *p)
Make map features known, except wall/lava surrounded by wall/lava.
Definition: cave-map.c:614
bool square_isbrokendoor(struct chunk *c, int y, int x)
Definition: cave-square.c:317
void square_light_spot(struct chunk *c, int y, int x)
Tell the UI that a given map location has been updated.
Definition: cave-map.c:246
bool square_changeable(struct chunk *c, int y, int x)
Determine if a given location may be "destroyed".
Definition: cave-square.c:848
int * feat_count
Definition: cave.h:174
Definition: cave.h:160
int FEAT_SECRET
Definition: cave.c:45
int FEAT_BROKEN
Definition: cave.c:42
struct monster * square_monster(struct chunk *c, int y, int x)
Get a monster on the current level by its position.
Definition: cave-square.c:929
void square_know_pile(struct chunk *c, int y, int x)
Update the player's knowledge of the objects on a grid in the current level.
Definition: cave-square.c:1000
bool square_isinvis(struct chunk *c, int y, int x)
True if the square has an unknown trap.
Definition: cave-square.c:489
int resist_flag
Monster resist flag for entering feature.
Definition: cave.h:112
u32b obj_rating
Definition: cave.h:166
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:399
bool square_isnoscent(struct chunk *c, int y, int x)
True if the cave square doesn't carry player scent.
Definition: cave-square.c:744
bool square_iswall_outer(struct chunk *c, int y, int x)
True if cave square is an outer wall (generation)
Definition: cave-square.c:505
u16b mon_cnt
Definition: cave.h:186
bool square_in_bounds_fully(struct chunk *c, int y, int x)
Definition: cave-square.c:873
bool square_ismark(struct chunk *c, int y, int x)
SQUARE INFO PREDICATES.
Definition: cave-square.c:415
char * name
Definition: cave.h:161
wchar_t d_char
Default feature character.
Definition: cave.h:106
Definition: cave.h:153
Object information, for a specific object.
Definition: object.h:399
bool feat_is_passable(int feat)
True if the feature is passable by the player.
Definition: cave-square.c:123
bool square_holds_object(struct chunk *c, int y, int x, struct object *obj)
Return true if the given object is on the floor at this grid.
Definition: cave-square.c:960
bool feat_is_no_scent(int feat)
True if the feature doesn't carry player scent.
Definition: cave-square.c:171
bool square_hasgoldvein(struct chunk *c, int y, int x)
Definition: cave-square.c:274
struct monster * cave_monster(struct chunk *c, int idx)
Get a monster on the current level by its index.
Definition: cave.c:530
bool square_isglow(struct chunk *c, int y, int x)
True if the square is lit.
Definition: cave-square.c:423
struct feature * f_info
Definition: cave.c:35
void square_add_glyph(struct chunk *c, int y, int x, int type)
Definition: cave-square.c:1129
int cave_monster_count(struct chunk *c)
The current number of monsters present on the level.
Definition: cave.c:545
int FEAT_LAVA
Definition: cave.c:54
int square_num_walls_adjacent(struct chunk *c, int y, int x)
Return how many cardinal directions around (x, y) contain walls.
Definition: cave-square.c:1048
int FEAT_QUARTZ_K
Definition: cave.c:51
bool no_light(void)
Returns true if the player's grid is dark.
Definition: cave-view.c:682
bool square_isnoflow(struct chunk *c, int y, int x)
True if the cave square doesn't allow monster flow information.
Definition: cave-square.c:736
bool square_iswall(struct chunk *c, int y, int x)
True if the square is a wall square (impedes the player).
Definition: cave-square.c:667
u32b m_idx
Definition: cave.h:127
bool square_isoccupied(struct chunk *c, int y, int x)
True if the square contains the player or a monster.
Definition: cave-square.c:381
int FEAT_NONE
Definition: cave.c:38
int square_digging(struct chunk *c, int y, int x)
Definition: cave-square.c:1281
bool square_isview(struct chunk *c, int y, int x)
True if the cave square is currently viewable by the player.
Definition: cave-square.c:457
bool feat_is_trap_holding(int feat)
True if the feature can hold a trap.
Definition: cave-square.c:91
void light_room(int y1, int x1, bool light)
Illuminate or darken any room containing the given location.
Definition: cave-map.c:373
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:132
void square_add_trap(struct chunk *c, int y, int x)
Definition: cave-square.c:1123
bool square_isinteresting(struct chunk *c, int y, int x)
Definition: cave-square.c:766
void square_open_door(struct chunk *c, int y, int x)
Definition: cave-square.c:1164
void square_disable_trap(struct chunk *c, int y, int x)
Definition: cave-square.c:1197
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:141
Definition: cave.h:122
s16b mon
Definition: cave.h:144
u32b f_idx
Definition: cave.h:128
void cave_free(struct chunk *c)
Free a chunk.
Definition: cave.c:360
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:538
int FEAT_MORE
Definition: cave.c:44
void square_mark(struct chunk *c, int y, int x)
Definition: cave-square.c:1304
bool square_isprojectable(struct chunk *c, int y, int x)
True if any projectable can pass through the square.
Definition: cave-square.c:657
void square_note_spot(struct chunk *c, int y, int x)
Memorize interesting viewable object/features in the given grid.
Definition: cave-map.c:218
bool square_isperm(struct chunk *c, int y, int x)
True if the square is a permanent wall.
Definition: cave-square.c:235
bool square_isknown(struct chunk *c, int y, int x)
True if the the player knows the terrain of the square.
Definition: cave-square.c:388
bool square_istrappable(struct chunk *c, int y, int x)
True if the square can hold a trap.
Definition: cave-square.c:210
struct trap * square_trap(struct chunk *c, int y, int x)
Get the first (and currently only) trap in a position on the current level.
Definition: cave-square.c:951
int FEAT_MAGMA
Definition: cave.c:48
bitflag * info
Definition: cave.h:143
const char ** p[]
Definition: name.c:40
byte bitflag
Definition: z-bitflag.h:27
char * desc
Definition: cave.h:92
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:254
const char * square_apparent_name(struct chunk *c, struct player *p, int y, int x)
Definition: cave-square.c:1287
void cave_illuminate(struct chunk *c, bool daytime)
Light or Darken the town.
Definition: cave-map.c:551
void square_destroy_door(struct chunk *c, int y, int x)
Definition: cave-square.c:1186
bool square_wasseen(struct chunk *c, int y, int x)
True if the cave square was seen before the current update.
Definition: cave-square.c:465
u16b obj_max
Definition: cave.h:182
const s16b ddx[10]
Global arrays for converting "keypad direction" into "offsets".
Definition: cave.c:65
bool square_isquartz(struct chunk *c, int y, int x)
True if the square is a quartz wall.
Definition: cave-square.c:252
bool feat_is_magma(int feat)
FEATURE PREDICATES.
Definition: cave-square.c:43
bool square_is_monster_walkable(struct chunk *c, int y, int x)
True if a monster can walk through the tile.
Definition: cave-square.c:638
bool square_ismagma(struct chunk *c, int y, int x)
True if the square is a magma wall.
Definition: cave-square.c:244
bool square_isarrivable(struct chunk *c, int y, int x)
True if the square is empty (an open square without any items).
Definition: cave-square.c:603
void square_destroy_decoy(struct chunk *c, int y, int x)
Definition: cave-square.c:1203
int16_t s16b
Definition: h-basic.h:170
struct chunk * cave
Definition: cave.c:36
bool square_isroom(struct chunk *c, int y, int x)
True if the square is part of a room.
Definition: cave-square.c:441
bool square_isempty(struct chunk *c, int y, int x)
True if the square is empty (an open square without any items).
Definition: cave-square.c:595
bool square_isnotknown(struct chunk *c, int y, int x)
True if the the player's knowledge of the terrain of the square is wrong or missing.
Definition: cave-square.c:398
bool feat_is_quartz(int feat)
True if the square is a quartz wall.
Definition: cave-square.c:51
bool square_isupstairs(struct chunk *c, int y, int x)
True if square is an up stair.
Definition: cave-square.c:348
char * mimic
Name of feature to mimic.
Definition: cave.h:97
Definition: cave.h:121
bool square_iswall_inner(struct chunk *c, int y, int x)
True if cave square is an inner wall (generation)
Definition: cave-square.c:497
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
Support various data types.
u16b mon_max
Definition: cave.h:185
u32b mon_rating
Definition: cave.h:167
bool multiple_objects
Definition: cave.h:131
struct object * square_object(struct chunk *c, int y, int x)
Get the top object of a pile on the current level by its position.
Definition: cave-square.c:943
const s16b ddy[10]
Definition: cave.c:68
struct feature * next
Definition: cave.h:95
bool square_ismineral(struct chunk *c, int y, int x)
True if the square is a mineral wall (magma/quartz).
Definition: cave-square.c:268
bool in_view
Definition: cave.h:136
const s16b ddy_ddd[9]
Definition: cave.c:80
bool is_player
Definition: cave.h:137
struct connector * join
Definition: cave.h:189
byte feeling
Definition: cave.h:165
void square_smash_door(struct chunk *c, int y, int x)
Definition: cave-square.c:1175
char * name
Definition: cave.h:91
bool square_isno_teleport(struct chunk *c, int y, int x)
True if cave square can't be teleported from by the player.
Definition: cave-square.c:529
s32b turn
Definition: cave.h:162
bool square_isdecoyed(struct chunk *c, int y, int x)
Definition: cave-square.c:755
void square_upgrade_mineral(struct chunk *c, int y, int x)
Add visible treasure to a mineral square.
Definition: cave-square.c:1257
Information about terrain features.
Definition: cave.h:90
bool square_iswarded(struct chunk *c, int y, int x)
Definition: cave-square.c:749
void square_unlock_door(struct chunk *c, int y, int x)
Definition: cave-square.c:1181
byte feat
Definition: cave.h:142
bool square_isdiggable(struct chunk *c, int y, int x)
True if the square can be dug: this includes rubble and non-permanent walls.
Definition: cave-square.c:626
struct chunk * cave_new(int height, int width)
Allocate a new chunk of the world.
Definition: cave.c:326
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:462
bool square_isplayertrap(struct chunk *c, int y, int x)
True if there is a player trap (known or unknown) in this square.
Definition: cave-square.c:783
bool square_isbright(struct chunk *c, int y, int x)
True if the cave square is internally lit.
Definition: cave-square.c:686
bool square_canputitem(struct chunk *c, int y, int x)
True if the square is an untrapped floor square without items.
Definition: cave-square.c:615
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
int fidx
Definition: cave.h:93
Definition: unit-test-types.h:10
Definition: cave.h:121
int FEAT_LESS
Definition: cave.c:43
void square_forget(struct chunk *c, int y, int x)
Definition: cave-square.c:1299
bool square_isvault(struct chunk *c, int y, int x)
True if the square is part of a vault.
Definition: cave-square.c:433
Definition: cave.h:126
bool unseen_money
Definition: cave.h:133
png_infop png_uint_32 * width
Definition: libpng12/png.h:2341
void square_force_floor(struct chunk *c, int y, int x)
Definition: cave-square.c:1270
void square_earthquake(struct chunk *c, int y, int x)
Definition: cave-square.c:1236
void update_view(struct chunk *c, struct player *p)
Update the player's current view.
Definition: cave-view.c:641
int32_t s32b
Definition: h-basic.h:173
void square_destroy_trap(struct chunk *c, int y, int x)
Definition: cave-square.c:1192
bool square_suits_stairs_well(struct chunk *c, int y, int x)
Checks if a square is in a cul-de-sac.
Definition: cave-square.c:895
Definition: cave.h:123
Definition: cave.h:119
bool square_iscloseddoor(struct chunk *c, int y, int x)
True if the square is a closed door (possibly locked or jammed).
Definition: cave-square.c:311
byte shopnum
Which shop does it take you to?
Definition: cave.h:100
Intialize random names
Definition: init.c:838
int FEAT_FLOOR
Definition: cave.c:39
bool square_isopendoor(struct chunk *c, int y, int x)
True if the square is an open door.
Definition: cave-square.c:303
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:1168
bool square_isdamaging(struct chunk *c, int y, int x)
True if the cave square can damage the inhabitant - only lava so far.
Definition: cave-square.c:728
int width
Definition: cave.h:171
int count_feats(int *y, int *x, bool(*test)(struct chunk *c, int y, int x), bool under)
Return the number of doors/traps around (or under) the character.
Definition: cave.c:552
byte d_attr
Default feature attribute.
Definition: cave.h:105
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:279
bool feat_is_object_holding(int feat)
True if the feature can hold an object.
Definition: cave-square.c:99
bool square_isno_esp(struct chunk *c, int y, int x)
True if cave square can't be detected by player ESP.
Definition: cave-square.c:545
bool feat_is_smooth(int feat)
True if the feature should have smooth boundaries (for dungeon generation).
Definition: cave-square.c:179
void square_close_door(struct chunk *c, int y, int x)
Definition: cave-square.c:1170
struct trap * trap
Definition: cave.h:146
struct object_kind * first_kind
Definition: cave.h:129
bool square_isfeel(struct chunk *c, int y, int x)
True if cave square is a feeling trigger square.
Definition: cave-square.c:473
int depth
Definition: cave.h:163
bool square_dtrap_edge(struct chunk *c, int y, int x)
Checks if a square is at the (inner) edge of a trap detect area.
Definition: cave-square.c:825
int FEAT_RUBBLE
Definition: cave.c:46
void square_unmark(struct chunk *c, int y, int x)
Definition: cave-square.c:1308
bool square_seemslikewall(struct chunk *c, int y, int x)
Definition: cave-square.c:761
Definition: source.h:7
char * hurt_msg
Message on being hurt by feature.
Definition: cave.h:110
bool square_isdtrap(struct chunk *c, int y, int x)
True if cave square has been detected for traps.
Definition: cave-square.c:561
void square_sense_pile(struct chunk *c, int y, int x)
Sense the existence of objects on a grid in the current level.
Definition: cave-square.c:985
struct trap * trap
Definition: cave.h:130
bool square_isgranite(struct chunk *c, int y, int x)
True if the square is granite.
Definition: cave-square.c:260
int height
Definition: cave.h:170
int FEAT_PERM
Definition: cave.c:53
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:446
int square_num_walls_diagonal(struct chunk *c, int y, int x)
Return how many diagonal directions around (x, y) contain walls.
Definition: cave-square.c:1068
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
bool(* square_predicate)(struct chunk *c, int y, int x)
square_predicate is a function pointer which tests a given square to see if the predicate in question...
Definition: cave.h:252
int FEAT_QUARTZ
Definition: cave.c:49
bool square_isfloor(struct chunk *c, int y, int x)
SQUARE FEATURE PREDICATES.
Definition: cave-square.c:202
struct monster * monsters
Definition: cave.h:184
void cave_forget_flow(struct chunk *c)
int FEAT_PASS_RUBBLE
Definition: cave.c:47
bool square_isfiery(struct chunk *c, int y, int x)
True if the cave square is fire-based.
Definition: cave-square.c:694
bool square_ispassable(struct chunk *c, int y, int x)
True if the square is passable by the player.
Definition: cave-square.c:647
bool square_iswall_solid(struct chunk *c, int y, int x)
True if cave square is a solid wall (generation)
Definition: cave-square.c:513
bool square_isshop(struct chunk *c, int y, int x)
True if the square is a shop entrance.
Definition: cave-square.c:366
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:150
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:222
byte priority
Display priority.
Definition: cave.h:98
const s16b ddx_ddd[9]
Global arrays for optimizing "ddx[ddd[i]]" and "ddy[ddd[i]]".
Definition: cave.c:77
struct connector * next
Definition: cave.h:157
struct chunk ** chunk_list
list of pointers to saved chunks
Definition: gen-chunk.c:36
void square_destroy_rubble(struct chunk *c, int y, int x)
Definition: cave-square.c:1265
bool square_isopen(struct chunk *c, int y, int x)
SQUARE BEHAVIOR PREDICATES.
Definition: cave-square.c:588
byte dig
How hard is it to dig through?
Definition: cave.h:101