3 #include "system/angband.h"
5 typedef struct floor_type floor_type;
6 extern floor_type floor_info;
9 * Determines if a map location is fully inside the outer walls
11 #define in_bounds(F,Y,X) \
12 (((Y) > 0) && ((X) > 0) && ((Y) < (F)->height-1) && ((X) < (F)->width-1))
15 * Determines if a map location is on or inside the outer walls
17 #define in_bounds2(F,Y,X) \
18 (((Y) >= 0) && ((X) >= 0) && ((Y) < (F)->height) && ((X) < (F)->width))
21 * Determines if a map location is on or inside the outer walls
24 #define in_bounds2u(F,Y,X) \
25 (((Y) < (F)->height) && ((X) < (F)->width))
29 * Determine if player is on this grid
31 #define player_bold(C,Y,X) \
32 (((Y) == (C)->y) && ((X) == (C)->x))
35 * Grid based version of "creature_bold()"
37 #define player_grid(C, G) \
38 ((G) == &(C)->current_floor_ptr->grid_array[(C)->y][(C)->x])
41 #define cave_have_flag_grid(C,INDEX) \
42 (have_flag(f_info[(C)->feat].flags, (INDEX)))
46 * Determine if a "feature" supports "los"
48 #define feat_supports_los(F) \
49 (have_flag(f_info[(F)].flags, FF_LOS))
52 #define cave_los_grid(C) \
53 (feat_supports_los((C)->feat))
57 * Determine if a "legal" grid is a "clean" floor grid
58 * Determine if terrain-change spells are allowed in a grid.
60 * Line 1 -- forbid non-floors
61 * Line 2 -- forbid object terrains
62 * Line 3 -- forbid normal objects
64 #define cave_clean_bold(F,Y,X) \
65 (cave_have_flag_bold((F), (Y), (X), FF_FLOOR) && \
66 !((F)->grid_array[Y][X].info & CAVE_OBJECT) && \
67 ((F)->grid_array[Y][X].o_idx == 0))
71 * Determine if an object can be dropped on a "legal" grid
73 * Line 1 -- forbid non-drops
74 * Line 2 -- forbid object terrains
76 #define cave_drop_bold(F,Y,X) \
77 (cave_have_flag_bold((F), (Y), (X), FF_DROP) && \
78 !((F)->grid_array[Y][X].info & CAVE_OBJECT))
82 * Determine if a "legal" grid is an "naked" floor grid
84 * Line 1 -- forbid non-clean gird
85 * Line 2 -- forbid monsters
86 * Line 3 -- forbid the player
88 #define cave_naked_bold(C,F,Y,X) \
89 (cave_clean_bold(F,Y,X) && \
90 !((F)->grid_array[Y][X].m_idx) && \
95 * Determine if a "legal" grid is "permanent"
97 * Line 1 -- permanent flag
99 #define cave_perma_bold(F,Y,X) \
100 (cave_have_flag_bold((F), (Y), (X), FF_PERMANENT))
104 * Grid based version of "cave_perma_bold()"
106 #define cave_perma_grid(C) \
107 (cave_have_flag_grid((C), FF_PERMANENT))
111 * Does the grid stop disintegration?
113 #define cave_stop_disintegration(F,Y,X) \
114 (!cave_have_flag_bold((F), (Y), (X), FF_PROJECT) && \
115 (!cave_have_flag_bold((F), (Y), (X), FF_HURT_DISI) || \
116 cave_have_flag_bold((F), (Y), (X), FF_PERMANENT)))
120 * Determine if a "legal" grid is within "los" of the player
122 * Note the use of comparison to zero to force a "boolean" result
124 #define player_has_los_grid(C) \
125 (((C)->info & (CAVE_VIEW)) != 0)
128 * Determine if a "legal" grid is within "los" of the player
130 * Note the use of comparison to zero to force a "boolean" result
132 #define player_has_los_bold(C,Y,X) \
133 ((((C)->current_floor_ptr->grid_array[Y][X].info & (CAVE_VIEW)) != 0) || (C)->phase_out)
137 * Determine if a "feature" is "permanent wall"
139 #define permanent_wall(F) \
140 (have_flag((F)->flags, FF_WALL) && \
141 have_flag((F)->flags, FF_PERMANENT))
144 * Convert a "location" (Y,X) into a "grid" (G)
150 * Convert a "grid" (G) into a "location" (Y)
156 * Convert a "grid" (G) into a "location" (X)
161 bool pattern_tile(floor_type *floor_ptr, POSITION y, POSITION x);
162 bool is_cave_empty_bold(player_type *player_ptr, POSITION x, POSITION y);
163 bool is_cave_empty_bold2(player_type *player_ptr, POSITION x, POSITION y);
164 void update_smell(floor_type *floor_ptr, player_type *subject_ptr);
165 void add_door(player_type *player_ptr, POSITION x, POSITION y);
166 void place_secret_door(player_type *player_ptr, POSITION y, POSITION x, int type);
167 void place_locked_door(player_type *player_ptr, POSITION y, POSITION x);
168 void forget_flow(floor_type *floor_ptr);
169 void place_random_stairs(player_type *player_ptr, POSITION y, POSITION x);
170 bool los(player_type *player_ptr, POSITION y1, POSITION x1, POSITION y2, POSITION x2);
171 bool projectable(player_type *player_ptr, POSITION y1, POSITION x1, POSITION y2, POSITION x2);
172 void vault_monsters(player_type *player_ptr, POSITION y1, POSITION x1, int num);
173 bool cave_valid_bold(floor_type *floor_ptr, POSITION y, POSITION x);
174 void cave_set_feat(player_type *player_ptr, POSITION y, POSITION x, FEAT_IDX feat);
175 void place_random_door(player_type *player_ptr, POSITION y, POSITION x, bool room);
176 void place_closed_door(player_type *player_ptr, POSITION y, POSITION x, int type);
177 void wipe_o_list(floor_type *floor_ptr);
178 void vault_trap_aux(player_type *player_ptr, POSITION y, POSITION x, POSITION yd, POSITION xd);
179 bool get_is_floor(floor_type *floor_ptr, POSITION x, POSITION y);
180 void try_door(player_type *player_ptr, POSITION y, POSITION x);
181 FEAT_IDX conv_dungeon_feat(floor_type *floor_ptr, FEAT_IDX newfeat);
182 void vault_objects(player_type *player_ptr, POSITION y, POSITION x, int num);
183 int project_path(player_type *player_ptr, u16b *gp, POSITION range, POSITION y1, POSITION x1, POSITION y2, POSITION x2, BIT_FLAGS flg);
184 void set_floor(player_type *player_ptr, POSITION x, POSITION y);
185 void place_object(player_type *owner_ptr, POSITION y, POSITION x, BIT_FLAGS mode);
186 void place_gold(player_type *player_ptr, POSITION y, POSITION x);
187 void delete_monster(player_type *player_ptr, POSITION y, POSITION x);
188 void compact_objects(player_type *owner_ptr, int size);
189 void vault_traps(player_type *player_ptr, POSITION y, POSITION x, POSITION yd, POSITION xd, int num);
190 void scatter(player_type *player_ptr, POSITION *yp, POSITION *xp, POSITION y, POSITION x, POSITION d, BIT_FLAGS mode);
191 bool cave_los_bold(floor_type *floor_ptr, POSITION y, POSITION x);
193 typedef enum feature_flag_type feature_flag_type;
194 bool cave_have_flag_bold(floor_type *floor_ptr, POSITION y, POSITION x, feature_flag_type f_idx);