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 chunk {
154  char *name;
156  int depth;
157 
161  bool good_item;
162 
163  int height;
164  int width;
165 
166  u16b feeling_squares; /* How many feeling squares the player has visited */
168 
169  struct square **squares;
170  struct heatmap noise;
171  struct heatmap scent;
172 
173  struct object **objects;
175 
176  struct monster *monsters;
180 };
181 
182 /*** Feature Indexes (see "lib/gamedata/terrain.txt") ***/
183 
184 /* Nothing */
185 extern int FEAT_NONE;
186 
187 /* Various */
188 extern int FEAT_FLOOR;
189 extern int FEAT_CLOSED;
190 extern int FEAT_OPEN;
191 extern int FEAT_BROKEN;
192 extern int FEAT_LESS;
193 extern int FEAT_MORE;
194 
195 /* Secret door */
196 extern int FEAT_SECRET;
197 
198 /* Rubble */
199 extern int FEAT_RUBBLE;
200 extern int FEAT_PASS_RUBBLE;
201 
202 /* Mineral seams */
203 extern int FEAT_MAGMA;
204 extern int FEAT_QUARTZ;
205 extern int FEAT_MAGMA_K;
206 extern int FEAT_QUARTZ_K;
207 
208 /* Walls */
209 extern int FEAT_GRANITE;
210 extern int FEAT_PERM;
211 extern int FEAT_LAVA;
212 
213 
214 /* Current level */
215 extern struct chunk *cave;
216 /* Stored levels */
217 extern struct chunk **chunk_list;
218 extern u16b chunk_list_max;
219 
220 /* cave-view.c */
221 int distance(int y1, int x1, int y2, int x2);
222 bool los(struct chunk *c, int y1, int x1, int y2, int x2);
223 void update_view(struct chunk *c, struct player *p);
224 bool no_light(void);
225 
226 /* cave-map.c */
227 void map_info(unsigned x, unsigned y, struct grid_data *g);
228 void square_note_spot(struct chunk *c, int y, int x);
229 void square_light_spot(struct chunk *c, int y, int x);
230 void light_room(int y1, int x1, bool light);
231 void wiz_light(struct chunk *c, bool full);
232 void cave_illuminate(struct chunk *c, bool daytime);
233 void cave_update_flow(struct chunk *c);
234 void cave_forget_flow(struct chunk *c);
235 
236 /* cave-square.c */
241 typedef bool (*square_predicate)(struct chunk *c, int y, int x);
242 
243 /* FEATURE PREDICATES */
244 bool feat_is_magma(int feat);
245 bool feat_is_quartz(int feat);
246 bool feat_is_granite(int feat);
247 bool feat_is_treasure(int feat);
248 bool feat_is_wall(int feat);
249 bool feat_is_floor(int feat);
250 bool feat_is_trap_holding(int feat);
251 bool feat_is_object_holding(int feat);
252 bool feat_is_monster_walkable(int feat);
253 bool feat_is_shop(int feat);
254 bool feat_is_passable(int feat);
255 bool feat_is_projectable(int feat);
256 bool feat_is_torch(int feat);
257 bool feat_is_bright(int feat);
258 bool feat_is_fiery(int feat);
259 bool feat_is_no_flow(int feat);
260 bool feat_is_no_scent(int feat);
261 bool feat_is_smooth(int feat);
262 
263 /* SQUARE FEATURE PREDICATES */
264 bool square_isfloor(struct chunk *c, int y, int x);
265 bool square_istrappable(struct chunk *c, int y, int x);
266 bool square_isobjectholding(struct chunk *c, int y, int x);
267 bool square_isrock(struct chunk *c, int y, int x);
268 bool square_isgranite(struct chunk *c, int y, int x);
269 bool square_isperm(struct chunk *c, int y, int x);
270 bool square_ismagma(struct chunk *c, int y, int x);
271 bool square_isquartz(struct chunk *c, int y, int x);
272 bool square_ismineral(struct chunk *c, int y, int x);
273 bool square_hasgoldvein(struct chunk *c, int y, int x);
274 bool square_isrubble(struct chunk *c, int y, int x);
275 bool square_issecretdoor(struct chunk *c, int y, int x);
276 bool square_isopendoor(struct chunk *c, int y, int x);
277 bool square_iscloseddoor(struct chunk *c, int y, int x);
278 bool square_islockeddoor(struct chunk *c, int y, int x);
279 bool square_isbrokendoor(struct chunk *c, int y, int x);
280 bool square_isdoor(struct chunk *c, int y, int x);
281 bool square_isstairs(struct chunk *c, int y, int x);
282 bool square_isupstairs(struct chunk *c, int y, int x);
283 bool square_isdownstairs(struct chunk *c, int y, int x);
284 bool square_isshop(struct chunk *c, int y, int x);
285 bool square_isplayer(struct chunk *c, int y, int x);
286 bool square_isknown(struct chunk *c, int y, int x);
287 bool square_isnotknown(struct chunk *c, int y, int x);
288 
289 /* SQUARE INFO PREDICATES */
290 bool square_ismark(struct chunk *c, int y, int x);
291 bool square_isglow(struct chunk *c, int y, int x);
292 bool square_isvault(struct chunk *c, int y, int x);
293 bool square_isroom(struct chunk *c, int y, int x);
294 bool square_isseen(struct chunk *c, int y, int x);
295 bool square_isview(struct chunk *c, int y, int x);
296 bool square_wasseen(struct chunk *c, int y, int x);
297 bool square_isfeel(struct chunk *c, int y, int x);
298 bool square_istrap(struct chunk *c, int y, int x);
299 bool square_isinvis(struct chunk *c, int y, int x);
300 bool square_iswall_inner(struct chunk *c, int y, int x);
301 bool square_iswall_outer(struct chunk *c, int y, int x);
302 bool square_iswall_solid(struct chunk *c, int y, int x);
303 bool square_ismon_restrict(struct chunk *c, int y, int x);
304 bool square_isno_teleport(struct chunk *c, int y, int x);
305 bool square_isno_map(struct chunk *c, int y, int x);
306 bool square_isno_esp(struct chunk *c, int y, int x);
307 bool square_isproject(struct chunk *c, int y, int x);
308 bool square_isdtrap(struct chunk *c, int y, int x);
309 
310 /* SQUARE BEHAVIOR PREDICATES */
311 bool square_isopen(struct chunk *c, int y, int x);
312 bool square_isempty(struct chunk *c, int y, int x);
313 bool square_canputitem(struct chunk *c, int y, int x);
314 bool square_isdiggable(struct chunk *c, int y, int x);
315 bool square_is_monster_walkable(struct chunk *c, int y, int x);
316 bool square_ispassable(struct chunk *c, int y, int x);
317 bool square_isprojectable(struct chunk *c, int y, int x);
318 bool square_iswall(struct chunk *c, int y, int x);
319 bool square_isstrongwall(struct chunk *c, int y, int x);
320 bool square_isbright(struct chunk *c, int y, int x);
321 bool square_isfiery(struct chunk *c, int y, int x);
322 bool square_isdamaging(struct chunk *c, int y, int x);
323 bool square_isnoflow(struct chunk *c, int y, int x);
324 bool square_isnoscent(struct chunk *c, int y, int x);
325 bool square_iswarded(struct chunk *c, int y, int x);
326 bool square_canward(struct chunk *c, int y, int x);
327 bool square_seemslikewall(struct chunk *c, int y, int x);
328 bool square_isinteresting(struct chunk *c, int y, int x);
329 bool square_isplayertrap(struct chunk *c, int y, int x);
330 bool square_isvisibletrap(struct chunk *c, int y, int x);
331 bool square_issecrettrap(struct chunk *c, int y, int x);
332 bool square_isdisabledtrap(struct chunk *c, int y, int x);
333 bool square_isdisarmabletrap(struct chunk *c, int y, int x);
334 bool square_dtrap_edge(struct chunk *c, int y, int x);
335 bool square_changeable(struct chunk *c, int y, int x);
336 bool square_in_bounds(struct chunk *c, int y, int x);
337 bool square_in_bounds_fully(struct chunk *c, int y, int x);
338 
339 struct feature *square_feat(struct chunk *c, int y, int x);
340 struct monster *square_monster(struct chunk *c, int y, int x);
341 struct object *square_object(struct chunk *c, int y, int x);
342 struct trap *square_trap(struct chunk *c, int y, int x);
343 bool square_holds_object(struct chunk *c, int y, int x, struct object *obj);
344 void square_excise_object(struct chunk *c, int y, int x, struct object *obj);
345 void square_excise_pile(struct chunk *c, int y, int x);
346 void square_sense_pile(struct chunk *c, int y, int x);
347 void square_know_pile(struct chunk *c, int y, int x);
348 
349 void square_set_feat(struct chunk *c, int y, int x, int feat);
350 
351 /* Feature placers */
352 void square_add_trap(struct chunk *c, int y, int x);
353 void square_add_ward(struct chunk *c, int y, int x);
354 void square_add_stairs(struct chunk *c, int y, int x, int depth);
355 void square_add_door(struct chunk *c, int y, int x, bool closed);
356 
357 /* Feature modifiers */
358 void square_open_door(struct chunk *c, int y, int x);
359 void square_close_door(struct chunk *c, int y, int x);
360 void square_smash_door(struct chunk *c, int y, int x);
361 void square_lock_door(struct chunk *c, int y, int x, int power);
362 void square_unlock_door(struct chunk *c, int y, int x);
363 void square_destroy_door(struct chunk *c, int y, int x);
364 void square_show_trap(struct chunk *c, int y, int x, int type);
365 void square_destroy_trap(struct chunk *c, int y, int x);
366 void square_disable_trap(struct chunk *c, int y, int x);
367 void square_tunnel_wall(struct chunk *c, int y, int x);
368 void square_destroy_wall(struct chunk *c, int y, int x);
369 void square_destroy(struct chunk *c, int y, int x);
370 void square_earthquake(struct chunk *c, int y, int x);
371 void square_remove_ward(struct chunk *c, int y, int x);
372 void square_upgrade_mineral(struct chunk *c, int y, int x);
373 void square_destroy_rubble(struct chunk *c, int y, int x);
374 void square_force_floor(struct chunk *c, int y, int x);
375 
376 
377 int square_shopnum(struct chunk *c, int y, int x);
378 int square_digging(struct chunk *c, int y, int x);
379 const char *square_apparent_name(struct chunk *c, struct player *p, int y, int x);
380 
381 void square_memorize(struct chunk *c, int y, int x);
382 void square_forget(struct chunk *c, int y, int x);
383 void square_mark(struct chunk *c, int y, int x);
384 void square_unmark(struct chunk *c, int y, int x);
385 
386 /* cave.c */
387 int lookup_feat(const char *name);
388 void set_terrain(void);
389 struct chunk *cave_new(int height, int width);
390 void cave_free(struct chunk *c);
391 void list_object(struct chunk *c, struct object *obj);
392 void delist_object(struct chunk *c, struct object *obj);
393 void object_lists_check_integrity(struct chunk *c, struct chunk *c_k);
394 void scatter(struct chunk *c, int *yp, int *xp, int y, int x, int d, bool need_los);
395 
396 struct monster *cave_monster(struct chunk *c, int idx);
397 int cave_monster_max(struct chunk *c);
398 int cave_monster_count(struct chunk *c);
399 
400 int count_feats(int *y, int *x, bool (*test)(struct chunk *cave, int y, int x), bool under);
401 
402 void cave_generate(struct chunk **c, struct player *p);
403 bool is_quest(int level);
404 
405 void cave_known(struct player *p);
406 
407 #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:1143
enum grid_light_level lighting
Definition: cave.h:135
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:149
struct object ** objects
Definition: cave.h:173
bool square_isdisarmabletrap(struct chunk *c, int y, int x)
True if the square is a known, disarmable player trap.
Definition: cave-square.c:761
void square_excise_pile(struct chunk *c, int y, int x)
Excise an entire floor pile.
Definition: cave-square.c:887
bool square_isobjectholding(struct chunk *c, int y, int x)
True if the square can hold an object.
Definition: cave-square.c:217
char * die_msg
Message on dying to feature.
Definition: cave.h:111
Definition: cave.h:78
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:529
bool square_isdisabledtrap(struct chunk *c, int y, int x)
True if the square is a known, disabled player trap.
Definition: cave-square.c:752
void square_add_ward(struct chunk *c, int y, int x)
Definition: cave-square.c:994
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:1095
Definition: cave.h:120
void square_destroy(struct chunk *c, int y, int x)
Definition: cave-square.c:1063
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:545
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:879
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, now with all legal outputs!
Definition: cave.c:458
struct feature * square_feat(struct chunk *c, int y, int x)
OTHER SQUARE FUNCTIONS.
Definition: cave-square.c:831
char * walk_msg
Message on walking into feature.
Definition: cave.h:108
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:736
int mon_current
Definition: cave.h:179
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:117
Information about object kinds, including player knowledge.
Definition: object.h:157
void cave_update_flow(struct chunk *c)
void square_destroy_wall(struct chunk *c, int y, int x)
Definition: cave-square.c:1058
#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:473
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:1053
s32b created_at
Definition: cave.h:155
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:812
bool square_ismon_restrict(struct chunk *c, int y, int x)
True if cave square has monster restrictions (generation)
Definition: cave-square.c:513
void square_add_door(struct chunk *c, int y, int x, bool closed)
Definition: cave-square.c:1010
struct object * obj
Definition: cave.h:145
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:161
void square_set_feat(struct chunk *c, int y, int x, int feat)
Set the terrain type for a square.
Definition: cave-square.c:958
u16b feeling_squares
Definition: cave.h:166
struct square ** squares
Definition: cave.h:169
int square_shopnum(struct chunk *c, int y, int x)
Definition: cave-square.c:1124
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:1000
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:650
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:720
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:441
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:744
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:138
struct heatmap scent
Definition: cave.h:171
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:793
int * feat_count
Definition: cave.h:167
Definition: cave.h:153
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:840
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:911
bool square_isinvis(struct chunk *c, int y, int x)
True if the square has an unknown trap.
Definition: cave-square.c:481
int resist_flag
Monster resist flag for entering feature.
Definition: cave.h:112
u32b obj_rating
Definition: cave.h:159
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:690
bool square_iswall_outer(struct chunk *c, int y, int x)
True if cave square is an outer wall (generation)
Definition: cave-square.c:497
u16b mon_cnt
Definition: cave.h:178
bool square_in_bounds_fully(struct chunk *c, int y, int x)
Definition: cave-square.c:818
bool square_ismark(struct chunk *c, int y, int x)
SQUARE INFO PREDICATES.
Definition: cave-square.c:407
char * name
Definition: cave.h:154
wchar_t d_char
Default feature character.
Definition: cave.h:106
Object information, for a specific object.
Definition: object.h:393
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:871
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:415
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:701
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:682
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:639
u32b m_idx
Definition: cave.h:127
int FEAT_NONE
Definition: cave.c:38
int square_digging(struct chunk *c, int y, int x)
Definition: cave-square.c:1130
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:449
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:132
void square_add_trap(struct chunk *c, int y, int x)
Definition: cave-square.c:988
bool square_isinteresting(struct chunk *c, int y, int x)
Definition: cave-square.c:711
void square_open_door(struct chunk *c, int y, int x)
Definition: cave-square.c:1014
void square_disable_trap(struct chunk *c, int y, int x)
Definition: cave-square.c:1047
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: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: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:1153
bool square_isprojectable(struct chunk *c, int y, int x)
True if any projectable can pass through the square.
Definition: cave-square.c:629
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:862
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
const char * square_apparent_name(struct chunk *c, struct player *p, int y, int x)
Definition: cave-square.c:1136
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:1036
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:457
u16b obj_max
Definition: cave.h:174
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:610
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:241
bool square_isroom(struct chunk *c, int y, int x)
True if the square is part of a room.
Definition: cave-square.c:433
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:579
struct heatmap noise
Definition: cave.h:170
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:390
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: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:489
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:177
u32b mon_rating
Definition: cave.h:160
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:854
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:136
const s16b ddy_ddd[9]
Definition: cave.c:80
bool is_player
Definition: cave.h:137
byte feeling
Definition: cave.h:158
void square_smash_door(struct chunk *c, int y, int x)
Definition: cave-square.c:1025
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:521
void square_upgrade_mineral(struct chunk *c, int y, int x)
Add visible treasure to a mineral square.
Definition: cave-square.c:1106
Information about terrain features.
Definition: cave.h:90
bool square_iswarded(struct chunk *c, int y, int x)
Definition: cave-square.c:695
void square_unlock_door(struct chunk *c, int y, int x)
Definition: cave-square.c:1031
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:598
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:425
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:728
bool square_isbright(struct chunk *c, int y, int x)
True if the cave square is internally lit.
Definition: cave-square.c:658
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:587
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:1148
bool square_isvault(struct chunk *c, int y, int x)
True if the square is part of a vault.
Definition: cave-square.c:425
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:1119
void square_earthquake(struct chunk *c, int y, int x)
Definition: cave-square.c:1077
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:1042
Definition: cave.h:123
Definition: cave.h:119
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:664
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
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:674
int width
Definition: cave.h:164
byte d_attr
Default feature attribute.
Definition: cave.h:105
Most of the "player" information goes here.
Definition: player.h:450
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:537
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:1020
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:465
int depth
Definition: cave.h:156
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:770
int FEAT_RUBBLE
Definition: cave.c:46
void square_unmark(struct chunk *c, int y, int x)
Definition: cave-square.c:1157
bool square_seemslikewall(struct chunk *c, int y, int x)
Definition: cave-square.c:706
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:553
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:896
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:259
int height
Definition: cave.h:163
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:409
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:176
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:666
bool square_ispassable(struct chunk *c, int y, int x)
True if the square is passable by the player.
Definition: cave-square.c:619
bool square_iswall_solid(struct chunk *c, int y, int x)
True if cave square is a solid wall (generation)
Definition: cave-square.c:505
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: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 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:1114
bool square_isopen(struct chunk *c, int y, int x)
SQUARE BEHAVIOR PREDICATES.
Definition: cave-square.c:572
byte dig
How hard is it to dig through?
Definition: cave.h:101