3 #include "system/angband.h"
5 extern floor_type floor_info;
8 * Determines if a map location is fully inside the outer walls
10 #define in_bounds(F,Y,X) \
11 (((Y) > 0) && ((X) > 0) && ((Y) < (F)->height-1) && ((X) < (F)->width-1))
14 * Determines if a map location is on or inside the outer walls
16 #define in_bounds2(F,Y,X) \
17 (((Y) >= 0) && ((X) >= 0) && ((Y) < (F)->height) && ((X) < (F)->width))
20 * Determines if a map location is on or inside the outer walls
23 #define in_bounds2u(F,Y,X) \
24 (((Y) < (F)->height) && ((X) < (F)->width))
28 * Determine if player is on this grid
30 #define player_bold(C,Y,X) \
31 (((Y) == (C)->y) && ((X) == (C)->x))
34 * Grid based version of "creature_bold()"
36 #define player_grid(C, G) \
37 ((G) == &(C)->current_floor_ptr->grid_array[(C)->y][(C)->x])
40 #define cave_have_flag_grid(C,INDEX) \
41 (have_flag(f_info[(C)->feat].flags, (INDEX)))
45 * Determine if a "feature" supports "los"
47 #define feat_supports_los(F) \
48 (have_flag(f_info[(F)].flags, FF_LOS))
51 #define cave_los_grid(C) \
52 (feat_supports_los((C)->feat))
56 * Determine if a "legal" grid is a "clean" floor grid
57 * Determine if terrain-change spells are allowed in a grid.
59 * Line 1 -- forbid non-floors
60 * Line 2 -- forbid object terrains
61 * Line 3 -- forbid normal objects
63 #define cave_clean_bold(F,Y,X) \
64 (cave_have_flag_bold((F), (Y), (X), FF_FLOOR) && \
65 !((F)->grid_array[Y][X].info & CAVE_OBJECT) && \
66 ((F)->grid_array[Y][X].o_idx == 0))
70 * Determine if an object can be dropped on a "legal" grid
72 * Line 1 -- forbid non-drops
73 * Line 2 -- forbid object terrains
75 #define cave_drop_bold(F,Y,X) \
76 (cave_have_flag_bold((F), (Y), (X), FF_DROP) && \
77 !((F)->grid_array[Y][X].info & CAVE_OBJECT))
81 * Determine if a "legal" grid is an "naked" floor grid
83 * Line 1 -- forbid non-clean gird
84 * Line 2 -- forbid monsters
85 * Line 3 -- forbid the player
87 #define cave_naked_bold(C,F,Y,X) \
88 (cave_clean_bold(F,Y,X) && \
89 !((F)->grid_array[Y][X].m_idx) && \
94 * Determine if a "legal" grid is "permanent"
96 * Line 1 -- permanent flag
98 #define cave_perma_bold(F,Y,X) \
99 (cave_have_flag_bold((F), (Y), (X), FF_PERMANENT))
103 * Grid based version of "cave_perma_bold()"
105 #define cave_perma_grid(C) \
106 (cave_have_flag_grid((C), FF_PERMANENT))
110 * Does the grid stop disintegration?
112 #define cave_stop_disintegration(F,Y,X) \
113 (!cave_have_flag_bold((F), (Y), (X), FF_PROJECT) && \
114 (!cave_have_flag_bold((F), (Y), (X), FF_HURT_DISI) || \
115 cave_have_flag_bold((F), (Y), (X), FF_PERMANENT)))
119 * Determine if a "legal" grid is within "los" of the player
121 * Note the use of comparison to zero to force a "boolean" result
123 #define player_has_los_grid(C) \
124 (((C)->info & (CAVE_VIEW)) != 0)
127 * Determine if a "legal" grid is within "los" of the player
129 * Note the use of comparison to zero to force a "boolean" result
131 #define player_has_los_bold(C,Y,X) \
132 ((((C)->current_floor_ptr->grid_array[Y][X].info & (CAVE_VIEW)) != 0) || (C)->phase_out)
136 * Determine if a "feature" is "permanent wall"
138 #define permanent_wall(F) \
139 (have_flag((F)->flags, FF_WALL) && \
140 have_flag((F)->flags, FF_PERMANENT))
143 * Convert a "location" (Y,X) into a "grid" (G)
149 * Convert a "grid" (G) into a "location" (Y)
155 * Convert a "grid" (G) into a "location" (X)
160 bool pattern_tile(floor_type *floor_ptr, POSITION y, POSITION x);
161 bool is_cave_empty_bold(player_type *player_ptr, POSITION x, POSITION y);
162 bool is_cave_empty_bold2(player_type *player_ptr, POSITION x, POSITION y);
163 void update_smell(floor_type *floor_ptr, player_type *subject_ptr);
164 void add_door(player_type *player_ptr, POSITION x, POSITION y);
165 void place_secret_door(player_type *player_ptr, POSITION y, POSITION x, int type);
166 void place_locked_door(player_type *player_ptr, POSITION y, POSITION x);
167 void forget_flow(floor_type *floor_ptr);
168 void place_random_stairs(player_type *player_ptr, POSITION y, POSITION x);
169 bool los(player_type *player_ptr, POSITION y1, POSITION x1, POSITION y2, POSITION x2);
170 bool projectable(player_type *player_ptr, POSITION y1, POSITION x1, POSITION y2, POSITION x2);
171 void vault_monsters(player_type *player_ptr, POSITION y1, POSITION x1, int num);
172 bool cave_valid_bold(floor_type *floor_ptr, POSITION y, POSITION x);
173 void cave_set_feat(player_type *player_ptr, POSITION y, POSITION x, FEAT_IDX feat);
174 void place_random_door(player_type *player_ptr, POSITION y, POSITION x, bool room);
175 void place_closed_door(player_type *player_ptr, POSITION y, POSITION x, int type);
176 void wipe_o_list(floor_type *floor_ptr);
177 void vault_trap_aux(player_type *player_ptr, POSITION y, POSITION x, POSITION yd, POSITION xd);
178 bool get_is_floor(floor_type *floor_ptr, POSITION x, POSITION y);
179 void try_door(player_type *player_ptr, POSITION y, POSITION x);
180 FEAT_IDX conv_dungeon_feat(floor_type *floor_ptr, FEAT_IDX newfeat);
181 void vault_objects(player_type *player_ptr, POSITION y, POSITION x, int num);
182 int project_path(player_type *player_ptr, u16b *gp, POSITION range, POSITION y1, POSITION x1, POSITION y2, POSITION x2, BIT_FLAGS flg);
183 void set_floor(player_type *player_ptr, POSITION x, POSITION y);
184 void place_object(player_type *owner_ptr, POSITION y, POSITION x, BIT_FLAGS mode);
185 void place_gold(player_type *player_ptr, POSITION y, POSITION x);
186 void delete_monster(player_type *player_ptr, POSITION y, POSITION x);
187 void compact_objects(player_type *owner_ptr, int size);
188 void vault_traps(player_type *player_ptr, POSITION y, POSITION x, POSITION yd, POSITION xd, int num);
189 void scatter(player_type *player_ptr, POSITION *yp, POSITION *xp, POSITION y, POSITION x, POSITION d, BIT_FLAGS mode);
190 bool cave_los_bold(floor_type *floor_ptr, POSITION y, POSITION x);