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
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;
107 };
108 
109 extern struct feature *f_info;
110 
112 {
113  LIGHTING_LOS = 0, /* line of sight */
114  LIGHTING_TORCH, /* torchlight */
115  LIGHTING_LIT, /* permanently lit (when not in line of sight) */
116  LIGHTING_DARK, /* dark */
118 };
119 
120 struct grid_data {
121  u32b m_idx; /* Monster index */
122  u32b f_idx; /* Feature index */
123  struct object_kind *first_kind; /* The kind of the first item on the grid */
124  struct trap *trap; /* Trap */
125  bool multiple_objects; /* Is there more than one item there? */
126  bool unseen_object; /* Is there an unaware object there? */
127  bool unseen_money; /* Is there some unaware money there? */
128 
129  enum grid_light_level lighting; /* Light level */
130  bool in_view; /* Can the player can currently see the grid? */
131  bool is_player;
133 };
134 
135 struct square {
139  struct object *obj;
140  struct trap *trap;
141 };
142 
143 struct heatmap {
145 };
146 
147 struct chunk {
148  char *name;
150  int depth;
151 
155  bool good_item;
156 
157  int height;
158  int width;
159 
160  u16b feeling_squares; /* How many feeling squares the player has visited */
162 
163  struct square **squares;
164  struct heatmap noise;
165  struct heatmap scent;
166 
167  struct object **objects;
169 
170  struct monster *monsters;
174 };
175 
176 /*** Feature Indexes (see "lib/gamedata/terrain.txt") ***/
177 
178 /* Nothing */
179 extern int FEAT_NONE;
180 
181 /* Various */
182 extern int FEAT_FLOOR;
183 extern int FEAT_CLOSED;
184 extern int FEAT_OPEN;
185 extern int FEAT_BROKEN;
186 extern int FEAT_LESS;
187 extern int FEAT_MORE;
188 
189 /* Secret door */
190 extern int FEAT_SECRET;
191 
192 /* Rubble */
193 extern int FEAT_RUBBLE;
194 extern int FEAT_PASS_RUBBLE;
195 
196 /* Mineral seams */
197 extern int FEAT_MAGMA;
198 extern int FEAT_QUARTZ;
199 extern int FEAT_MAGMA_K;
200 extern int FEAT_QUARTZ_K;
201 
202 /* Walls */
203 extern int FEAT_GRANITE;
204 extern int FEAT_PERM;
205 extern int FEAT_LAVA;
206 
207 
208 /* Current level */
209 extern struct chunk *cave;
210 /* Stored levels */
211 extern struct chunk **chunk_list;
212 extern u16b chunk_list_max;
213 
214 /* cave-view.c */
215 int distance(int y1, int x1, int y2, int x2);
216 bool los(struct chunk *c, int y1, int x1, int y2, int x2);
217 void update_view(struct chunk *c, struct player *p);
218 bool no_light(void);
219 
220 /* cave-map.c */
221 void map_info(unsigned x, unsigned y, struct grid_data *g);
222 void square_note_spot(struct chunk *c, int y, int x);
223 void square_light_spot(struct chunk *c, int y, int x);
224 void light_room(int y1, int x1, bool light);
225 void wiz_light(struct chunk *c, bool full);
226 void cave_illuminate(struct chunk *c, bool daytime);
227 void cave_update_flow(struct chunk *c);
228 void cave_forget_flow(struct chunk *c);
229 
230 /* cave-square.c */
235 typedef bool (*square_predicate)(struct chunk *c, int y, int x);
236 
237 /* FEATURE PREDICATES */
238 bool feat_is_magma(int feat);
239 bool feat_is_quartz(int feat);
240 bool feat_is_granite(int feat);
241 bool feat_is_treasure(int feat);
242 bool feat_is_wall(int feat);
243 bool feat_is_floor(int feat);
244 bool feat_is_trap_holding(int feat);
245 bool feat_is_object_holding(int feat);
246 bool feat_is_monster_walkable(int feat);
247 bool feat_is_shop(int feat);
248 bool feat_is_passable(int feat);
249 bool feat_is_projectable(int feat);
250 bool feat_is_torch(int feat);
251 bool feat_is_bright(int feat);
252 bool feat_is_fiery(int feat);
253 bool feat_is_no_flow(int feat);
254 bool feat_is_no_scent(int feat);
255 bool feat_is_smooth(int feat);
256 
257 /* SQUARE FEATURE PREDICATES */
258 bool square_isfloor(struct chunk *c, int y, int x);
259 bool square_istrappable(struct chunk *c, int y, int x);
260 bool square_isobjectholding(struct chunk *c, int y, int x);
261 bool square_isrock(struct chunk *c, int y, int x);
262 bool square_isgranite(struct chunk *c, int y, int x);
263 bool square_isperm(struct chunk *c, int y, int x);
264 bool square_ismagma(struct chunk *c, int y, int x);
265 bool square_isquartz(struct chunk *c, int y, int x);
266 bool square_ismineral(struct chunk *c, int y, int x);
267 bool square_hasgoldvein(struct chunk *c, int y, int x);
268 bool square_isrubble(struct chunk *c, int y, int x);
269 bool square_issecretdoor(struct chunk *c, int y, int x);
270 bool square_isopendoor(struct chunk *c, int y, int x);
271 bool square_iscloseddoor(struct chunk *c, int y, int x);
272 bool square_islockeddoor(struct chunk *c, int y, int x);
273 bool square_isbrokendoor(struct chunk *c, int y, int x);
274 bool square_isdoor(struct chunk *c, int y, int x);
275 bool square_isstairs(struct chunk *c, int y, int x);
276 bool square_isupstairs(struct chunk *c, int y, int x);
277 bool square_isdownstairs(struct chunk *c, int y, int x);
278 bool square_isshop(struct chunk *c, int y, int x);
279 bool square_isplayer(struct chunk *c, int y, int x);
280 bool square_isknown(struct chunk *c, int y, int x);
281 bool square_isnotknown(struct chunk *c, int y, int x);
282 
283 /* SQUARE INFO PREDICATES */
284 bool square_ismark(struct chunk *c, int y, int x);
285 bool square_isglow(struct chunk *c, int y, int x);
286 bool square_isvault(struct chunk *c, int y, int x);
287 bool square_isroom(struct chunk *c, int y, int x);
288 bool square_isseen(struct chunk *c, int y, int x);
289 bool square_isview(struct chunk *c, int y, int x);
290 bool square_wasseen(struct chunk *c, int y, int x);
291 bool square_isfeel(struct chunk *c, int y, int x);
292 bool square_istrap(struct chunk *c, int y, int x);
293 bool square_isinvis(struct chunk *c, int y, int x);
294 bool square_iswall_inner(struct chunk *c, int y, int x);
295 bool square_iswall_outer(struct chunk *c, int y, int x);
296 bool square_iswall_solid(struct chunk *c, int y, int x);
297 bool square_ismon_restrict(struct chunk *c, int y, int x);
298 bool square_isno_teleport(struct chunk *c, int y, int x);
299 bool square_isno_map(struct chunk *c, int y, int x);
300 bool square_isno_esp(struct chunk *c, int y, int x);
301 bool square_isproject(struct chunk *c, int y, int x);
302 
303 /* SQUARE BEHAVIOR PREDICATES */
304 bool square_isopen(struct chunk *c, int y, int x);
305 bool square_isempty(struct chunk *c, int y, int x);
306 bool square_canputitem(struct chunk *c, int y, int x);
307 bool square_isdiggable(struct chunk *c, int y, int x);
308 bool square_is_monster_walkable(struct chunk *c, int y, int x);
309 bool square_ispassable(struct chunk *c, int y, int x);
310 bool square_isprojectable(struct chunk *c, int y, int x);
311 bool square_iswall(struct chunk *c, int y, int x);
312 bool square_isstrongwall(struct chunk *c, int y, int x);
313 bool square_isbright(struct chunk *c, int y, int x);
314 bool square_isfiery(struct chunk *c, int y, int x);
315 bool square_isnoflow(struct chunk *c, int y, int x);
316 bool square_isnoscent(struct chunk *c, int y, int x);
317 bool square_iswarded(struct chunk *c, int y, int x);
318 bool square_canward(struct chunk *c, int y, int x);
319 bool square_seemslikewall(struct chunk *c, int y, int x);
320 bool square_isinteresting(struct chunk *c, int y, int x);
321 bool square_isplayertrap(struct chunk *c, int y, int x);
322 bool square_isvisibletrap(struct chunk *c, int y, int x);
323 bool square_issecrettrap(struct chunk *c, int y, int x);
324 bool square_isknowntrap(struct chunk *c, int y, int x);
325 bool square_isdisabledtrap(struct chunk *c, int y, int x);
326 bool square_changeable(struct chunk *c, int y, int x);
327 bool square_in_bounds(struct chunk *c, int y, int x);
328 bool square_in_bounds_fully(struct chunk *c, int y, int x);
329 
330 struct feature *square_feat(struct chunk *c, int y, int x);
331 struct monster *square_monster(struct chunk *c, int y, int x);
332 struct object *square_object(struct chunk *c, int y, int x);
333 struct trap *square_trap(struct chunk *c, int y, int x);
334 bool square_holds_object(struct chunk *c, int y, int x, struct object *obj);
335 void square_excise_object(struct chunk *c, int y, int x, struct object *obj);
336 void square_excise_pile(struct chunk *c, int y, int x);
337 void square_sense_pile(struct chunk *c, int y, int x);
338 void square_know_pile(struct chunk *c, int y, int x);
339 
340 void square_set_feat(struct chunk *c, int y, int x, int feat);
341 
342 /* Feature placers */
343 void square_add_trap(struct chunk *c, int y, int x);
344 void square_add_ward(struct chunk *c, int y, int x);
345 void square_add_stairs(struct chunk *c, int y, int x, int depth);
346 void square_add_door(struct chunk *c, int y, int x, bool closed);
347 
348 /* Feature modifiers */
349 void square_open_door(struct chunk *c, int y, int x);
350 void square_close_door(struct chunk *c, int y, int x);
351 void square_smash_door(struct chunk *c, int y, int x);
352 void square_lock_door(struct chunk *c, int y, int x, int power);
353 void square_unlock_door(struct chunk *c, int y, int x);
354 void square_destroy_door(struct chunk *c, int y, int x);
355 void square_show_trap(struct chunk *c, int y, int x, int type);
356 void square_destroy_trap(struct chunk *c, int y, int x);
357 void square_disable_trap(struct chunk *c, int y, int x);
358 void square_tunnel_wall(struct chunk *c, int y, int x);
359 void square_destroy_wall(struct chunk *c, int y, int x);
360 void square_destroy(struct chunk *c, int y, int x);
361 void square_earthquake(struct chunk *c, int y, int x);
362 void square_remove_ward(struct chunk *c, int y, int x);
363 void square_upgrade_mineral(struct chunk *c, int y, int x);
364 void square_destroy_rubble(struct chunk *c, int y, int x);
365 void square_force_floor(struct chunk *c, int y, int x);
366 
367 
368 int square_shopnum(struct chunk *c, int y, int x);
369 int square_digging(struct chunk *c, int y, int x);
370 const char *square_apparent_name(struct chunk *c, struct player *p, int y, int x);
371 
372 void square_memorize(struct chunk *c, int y, int x);
373 void square_forget(struct chunk *c, int y, int x);
374 void square_mark(struct chunk *c, int y, int x);
375 void square_unmark(struct chunk *c, int y, int x);
376 
377 /* cave.c */
378 int lookup_feat(const char *name);
379 void set_terrain(void);
380 struct chunk *cave_new(int height, int width);
381 void cave_free(struct chunk *c);
382 void list_object(struct chunk *c, struct object *obj);
383 void delist_object(struct chunk *c, struct object *obj);
384 void object_lists_check_integrity(struct chunk *c, struct chunk *c_k);
385 void scatter(struct chunk *c, int *yp, int *xp, int y, int x, int d, bool need_los);
386 
387 struct monster *cave_monster(struct chunk *c, int idx);
388 int cave_monster_max(struct chunk *c);
389 int cave_monster_count(struct chunk *c);
390 
391 int count_feats(int *y, int *x, bool (*test)(struct chunk *cave, int y, int x), bool under);
392 
393 void cave_generate(struct chunk **c, struct player *p);
394 bool is_quest(int level);
395 
396 void cave_known(struct player *p);
397 
398 #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:1103
enum grid_light_level lighting
Definition: cave.h:129
bool feat_is_monster_walkable(int feat)
True if a monster can walk through the feature.
Definition: cave-square.c:106
bool square_isrubble(struct chunk *c, int y, int x)
True if the square is rubble.
Definition: cave-square.c:281
Definition: cave.h:143
struct object ** objects
Definition: cave.h:167
void square_excise_pile(struct chunk *c, int y, int x)
Excise an entire floor pile.
Definition: cave-square.c:847
bool square_isobjectholding(struct chunk *c, int y, int x)
True if the square can hold an object.
Definition: cave-square.c:217
Definition: cave.h:77
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:527
bool square_isdisabledtrap(struct chunk *c, int y, int x)
True if the square is a known, disabled player trap.
Definition: cave-square.c:742
void square_add_ward(struct chunk *c, int y, int x)
Definition: cave-square.c:954
bool square_isdoor(struct chunk *c, int y, int x)
True if the square is a door.
Definition: cave-square.c:329
void square_remove_ward(struct chunk *c, int y, int x)
Definition: cave-square.c:1055
Definition: cave.h:114
void square_destroy(struct chunk *c, int y, int x)
Definition: cave-square.c:1023
bool square_isrock(struct chunk *c, int y, int x)
True if the square is a normal granite rock wall.
Definition: cave-square.c:225
int FEAT_CLOSED
Definition: cave.c:40
An actual trap.
Definition: trap.h:75
Low-level bit vector manipulation.
const int * dist_offsets_x[10]
Definition: cave.c:205
Use the roguelike command false Show damage player deals to false Always pickup false Show flavors in object false Highlight player with cursor between false Show walls as solid false false Center map false Automatically clear more false Allow mouse clicks to move the true false false false false false Generate a random artifact false Force player false Restrict creation of false Lose artifacts when leaving level
Definition: list-options.h:86
bool square_isproject(struct chunk *c, int y, int x)
True if cave square is marked for projection processing.
Definition: cave-square.c:543
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:839
Monster information, for a specific monster.
Definition: monster.h:323
void scatter(struct chunk *c, int *yp, int *xp, int y, int x, int d, bool need_los)
Standard "find me a location" function.
Definition: cave.c:456
struct feature * square_feat(struct chunk *c, int y, int x)
OTHER SQUARE FUNCTIONS.
Definition: cave-square.c:791
void square_lock_door(struct chunk *c, int y, int x, int power)
uint32_t u32b
Definition: h-basic.h:172
bool square_isvisibletrap(struct chunk *c, int y, int x)
True if there is a visible trap in this square.
Definition: cave-square.c:718
int mon_current
Definition: cave.h:173
bool square_isstairs(struct chunk *c, int y, int x)
True if square is any stair.
Definition: cave-square.c:338
grid_light_level
Definition: cave.h:111
Information about object kinds, including player knowledge.
Definition: object.h:158
void cave_update_flow(struct chunk *c)
void square_destroy_wall(struct chunk *c, int y, int x)
Definition: cave-square.c:1018
#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:293
bool square_istrap(struct chunk *c, int y, int x)
True if the square has a known trap.
Definition: cave-square.c:471
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
bool feat_is_shop(int feat)
True if the feature is a shop entrance.
Definition: cave-square.c:114
special grid flags
void square_tunnel_wall(struct chunk *c, int y, int x)
Definition: cave-square.c:1013
s32b created_at
Definition: cave.h:149
int count_feats(int *y, int *x, bool(*test)(struct chunk *cave, int y, int x), bool under)
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:772
bool square_ismon_restrict(struct chunk *c, int y, int x)
True if cave square has monster restrictions (generation)
Definition: cave-square.c:511
void square_add_door(struct chunk *c, int y, int x, bool closed)
Definition: cave-square.c:970
struct object * obj
Definition: cave.h:139
bool square_isplayer(struct chunk *c, int y, int x)
True if the square contains the player.
Definition: cave-square.c:373
bool good_item
Definition: cave.h:155
void square_set_feat(struct chunk *c, int y, int x, int feat)
Set the terrain type for a square.
Definition: cave-square.c:918
u16b feeling_squares
Definition: cave.h:160
struct square ** squares
Definition: cave.h:163
int square_shopnum(struct chunk *c, int y, int x)
Definition: cave-square.c:1084
void cave_generate(struct chunk **c, struct player *p)
Generate a random level.
Definition: generate.c:838
void square_add_stairs(struct chunk *c, int y, int x, int depth)
Definition: cave-square.c:960
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:640
byte power
Power for locks, visibility for traps.
Definition: trap.h:84
bool square_islockeddoor(struct chunk *c, int y, int x)
True if the square is a closed, locked door.
Definition: cave-square.c:702
bool square_isdownstairs(struct chunk *c, int y, int x)
True if square is a down stair.
Definition: cave-square.c:356
bool square_isseen(struct chunk *c, int y, int x)
True if the square has been seen by the player.
Definition: cave-square.c:439
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:726
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:83
void set_terrain(void)
Set terrain constants to the indices from terrain.txt.
Definition: cave.c:272
void square_show_trap(struct chunk *c, int y, int x, int type)
bool hallucinate
Definition: cave.h:132
struct heatmap scent
Definition: cave.h:165
void cave_known(struct player *p)
Make map features known, except wall/lava surrounded by wall/lava.
Definition: cave-map.c:548
bool square_isbrokendoor(struct chunk *c, int y, int x)
Definition: cave-square.c:316
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:240
bool square_changeable(struct chunk *c, int y, int x)
Determine if a given location may be "destroyed".
Definition: cave-square.c:753
int * feat_count
Definition: cave.h:161
Definition: cave.h:147
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:800
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:871
bool square_isinvis(struct chunk *c, int y, int x)
True if the square has an unknown trap.
Definition: cave-square.c:479
u32b obj_rating
Definition: cave.h:153
bool feat_is_floor(int feat)
True is the feature is a floor.
Definition: cave-square.c:82
bool feat_is_bright(int feat)
True if the feature is internally lit.
Definition: cave-square.c:146
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:362
bool square_isnoscent(struct chunk *c, int y, int x)
True if the cave square doesn't carry player scent.
Definition: cave-square.c:672
bool square_iswall_outer(struct chunk *c, int y, int x)
True if cave square is an outer wall (generation)
Definition: cave-square.c:495
u16b mon_cnt
Definition: cave.h:172
bool square_in_bounds_fully(struct chunk *c, int y, int x)
Definition: cave-square.c:778
bool square_ismark(struct chunk *c, int y, int x)
SQUARE INFO PREDICATES.
Definition: cave-square.c:405
char * name
Definition: cave.h:148
wchar_t d_char
Default feature character.
Definition: cave.h:106
Object information, for a specific object.
Definition: object.h:394
bool feat_is_passable(int feat)
True if the feature is passable by the player.
Definition: cave-square.c:122
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:831
bool feat_is_no_scent(int feat)
True if the feature doesn't carry player scent.
Definition: cave-square.c:170
bool square_hasgoldvein(struct chunk *c, int y, int x)
Definition: cave-square.c:273
struct monster * cave_monster(struct chunk *c, int idx)
Get a monster on the current level by its index.
Definition: cave.c:491
bool square_isglow(struct chunk *c, int y, int x)
True if the square is lit.
Definition: cave-square.c:413
struct feature * f_info
Definition: cave.c:35
int cave_monster_count(struct chunk *c)
The current number of monsters present on the level.
Definition: cave.c:506
int FEAT_LAVA
Definition: cave.c:54
int FEAT_QUARTZ_K
Definition: cave.c:51
bool square_canward(struct chunk *c, int y, int x)
Definition: cave-square.c:683
bool no_light(void)
Returns true if the player's grid is dark.
Definition: cave-view.c:666
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:664
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:629
u32b m_idx
Definition: cave.h:121
int FEAT_NONE
Definition: cave.c:38
int square_digging(struct chunk *c, int y, int x)
Definition: cave-square.c:1090
int distance(int y1, int x1, int y2, int x2)
Approximate distance between two points.
Definition: cave-view.c:36
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:447
bool feat_is_trap_holding(int feat)
True is the feature can hold a trap.
Definition: cave-square.c:90
void light_room(int y1, int x1, bool light)
Illuminate or darken any room containing the given location.
Definition: cave-map.c:377
bool feat_is_treasure(int feat)
True if the square is a mineral wall with treasure (magma/quartz).
Definition: cave-square.c:66
bool unseen_object
Definition: cave.h:126
void square_add_trap(struct chunk *c, int y, int x)
Definition: cave-square.c:948
bool square_isinteresting(struct chunk *c, int y, int x)
Definition: cave-square.c:693
void square_open_door(struct chunk *c, int y, int x)
Definition: cave-square.c:974
void square_disable_trap(struct chunk *c, int y, int x)
Definition: cave-square.c:1007
bool feat_is_no_flow(int feat)
True if the feature doesn't carry monster flow information.
Definition: cave-square.c:162
Definition: cave.h:135
Definition: cave.h:116
s16b mon
Definition: cave.h:138
u32b f_idx
Definition: cave.h:122
void cave_free(struct chunk *c)
Free a chunk.
Definition: cave.c:330
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:499
int FEAT_MORE
Definition: cave.c:44
void square_mark(struct chunk *c, int y, int x)
Definition: cave-square.c:1113
bool square_isprojectable(struct chunk *c, int y, int x)
True if any projectable can pass through the square.
Definition: cave-square.c:619
void square_note_spot(struct chunk *c, int y, int x)
Memorize interesting viewable object/features in the given grid.
Definition: cave-map.c:212
bool square_isperm(struct chunk *c, int y, int x)
True if the square is a permanent wall.
Definition: cave-square.c:234
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:380
bool square_istrappable(struct chunk *c, int y, int x)
True if the square can hold a trap.
Definition: cave-square.c:209
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:822
int FEAT_MAGMA
Definition: cave.c:48
bitflag * info
Definition: cave.h:137
const char ** p[]
Definition: name.c:40
byte bitflag
Definition: z-bitflag.h:27
char * desc
Definition: cave.h:92
const char * square_apparent_name(struct chunk *c, struct player *p, int y, int x)
Definition: cave-square.c:1096
void cave_illuminate(struct chunk *c, bool daytime)
Light or Darken the town.
Definition: cave-map.c:485
void square_destroy_door(struct chunk *c, int y, int x)
Definition: cave-square.c:996
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:455
u16b obj_max
Definition: cave.h:168
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:251
bool feat_is_magma(int feat)
FEATURE PREDICATES.
Definition: cave-square.c:42
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:600
bool square_ismagma(struct chunk *c, int y, int x)
True if the square is a magma wall.
Definition: cave-square.c:243
int16_t s16b
Definition: h-basic.h:170
struct chunk * cave
Definition: cave.c:36
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:235
bool square_isroom(struct chunk *c, int y, int x)
True if the square is part of a room.
Definition: cave-square.c:431
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:569
struct heatmap noise
Definition: cave.h:164
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:389
bool feat_is_quartz(int feat)
True if the square is a quartz wall.
Definition: cave-square.c:50
bool square_isupstairs(struct chunk *c, int y, int x)
True if square is an up stair.
Definition: cave-square.c:347
char * mimic
Name of feature to mimic.
Definition: cave.h:97
Definition: cave.h:115
bool square_iswall_inner(struct chunk *c, int y, int x)
True if cave square is an inner wall (generation)
Definition: cave-square.c:487
bool feat_is_wall(int feat)
True is the feature is a solid wall (not rubble).
Definition: cave-square.c:74
bool feat_is_fiery(int feat)
True if the feature is internally lit.
Definition: cave-square.c:154
Support various data types.
u16b mon_max
Definition: cave.h:171
u32b mon_rating
Definition: cave.h:154
bool multiple_objects
Definition: cave.h:125
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:814
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:267
bool in_view
Definition: cave.h:130
const s16b ddy_ddd[9]
Definition: cave.c:80
bool is_player
Definition: cave.h:131
byte feeling
Definition: cave.h:152
void square_smash_door(struct chunk *c, int y, int x)
Definition: cave-square.c:985
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:519
void square_upgrade_mineral(struct chunk *c, int y, int x)
Add visible treasure to a mineral square.
Definition: cave-square.c:1066
Information about terrain features.
Definition: cave.h:90
bool square_iswarded(struct chunk *c, int y, int x)
Definition: cave-square.c:677
void square_unlock_door(struct chunk *c, int y, int x)
Definition: cave-square.c:991
byte feat
Definition: cave.h:136
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:588
struct chunk * cave_new(int height, int width)
Allocate a new chunk of the world.
Definition: cave.c:296
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:423
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:710
bool square_isbright(struct chunk *c, int y, int x)
True if the cave square is internally lit.
Definition: cave-square.c:648
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:577
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:36
int fidx
Definition: cave.h:93
Definition: unit-test-types.h:10
Definition: cave.h:122
int FEAT_LESS
Definition: cave.c:43
void square_forget(struct chunk *c, int y, int x)
Definition: cave-square.c:1108
bool square_isvault(struct chunk *c, int y, int x)
True if the square is part of a vault.
Definition: cave-square.c:423
Definition: cave.h:120
bool unseen_money
Definition: cave.h:127
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:1079
void square_earthquake(struct chunk *c, int y, int x)
Definition: cave-square.c:1037
void update_view(struct chunk *c, struct player *p)
Update the player's current view.
Definition: cave-view.c:630
int32_t s32b
Definition: h-basic.h:173
void square_destroy_trap(struct chunk *c, int y, int x)
Definition: cave-square.c:1002
Definition: cave.h:117
Definition: cave.h:113
void wiz_light(struct chunk *c, bool full)
Light up the dungeon using "claravoyance".
Definition: cave-map.c:425
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:310
byte shopnum
Which shop does it take you to?
Definition: cave.h:100
Intialize random names
Definition: init.c:656
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:302
int width
Definition: cave.h:158
byte d_attr
Default feature attribute.
Definition: cave.h:105
Most of the "player" information goes here.
Definition: player.h:452
int lookup_feat(const char *name)
Find a terrain feature index by name.
Definition: cave.c:249
bool feat_is_object_holding(int feat)
True is the feature can hold an object.
Definition: cave-square.c:98
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:535
bool feat_is_smooth(int feat)
True if the feature should have smooth boundaries (for dungeon generation).
Definition: cave-square.c:178
void square_close_door(struct chunk *c, int y, int x)
Definition: cave-square.c:980
struct trap * trap
Definition: cave.h:140
struct object_kind * first_kind
Definition: cave.h:123
bool square_isfeel(struct chunk *c, int y, int x)
True if cave square is a feeling trigger square.
Definition: cave-square.c:463
int depth
Definition: cave.h:150
int FEAT_RUBBLE
Definition: cave.c:46
void square_unmark(struct chunk *c, int y, int x)
Definition: cave-square.c:1117
bool square_seemslikewall(struct chunk *c, int y, int x)
Definition: cave-square.c:688
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:856
struct trap * trap
Definition: cave.h:124
bool square_isgranite(struct chunk *c, int y, int x)
True if the square is granite.
Definition: cave-square.c:259
int height
Definition: cave.h:157
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:407
bool feat_is_granite(int feat)
True if the square is a granite wall.
Definition: cave-square.c:58
bool feat_is_projectable(int feat)
True if any projectable can pass through the feature.
Definition: cave-square.c:130
int FEAT_QUARTZ
Definition: cave.c:49
bool square_isfloor(struct chunk *c, int y, int x)
SQUARE FEATURE PREDICATES.
Definition: cave-square.c:201
struct monster * monsters
Definition: cave.h:170
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:656
bool square_ispassable(struct chunk *c, int y, int x)
True if the square is passable by the player.
Definition: cave-square.c:609
bool square_iswall_solid(struct chunk *c, int y, int x)
True if cave square is a solid wall (generation)
Definition: cave-square.c:503
bool square_isshop(struct chunk *c, int y, int x)
True if the square is a shop entrance.
Definition: cave-square.c:365
bool feat_is_torch(int feat)
True if the feature can be lit by light sources.
Definition: cave-square.c:138
u16b ** grids
Definition: cave.h:144
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 chunk ** chunk_list
list of pointers to saved chunks
Definition: gen-chunk.c:35
void square_destroy_rubble(struct chunk *c, int y, int x)
Definition: cave-square.c:1074
bool square_isknowntrap(struct chunk *c, int y, int x)
True if the square is a known player trap.
Definition: cave-square.c:734
bool square_isopen(struct chunk *c, int y, int x)
SQUARE BEHAVIOR PREDICATES.
Definition: cave-square.c:562
byte dig
How hard is it to dig through?
Definition: cave.h:101