OSDN Git Service

[Refactor] #37353 ダンジョンに関するマクロ定義を floor.h に移動。
[hengband/hengband.git] / src / floor.h
1 
2 #define DUNGEON_MODE_NONE       0
3 #define DUNGEON_MODE_AND        1
4 #define DUNGEON_MODE_NAND       2
5 #define DUNGEON_MODE_OR         3
6 #define DUNGEON_MODE_NOR        4
7
8 /*** Dungeon type flags -- DG ***/
9 #define DF1_WINNER              0x00000001L
10 #define DF1_MAZE                0x00000002L
11 #define DF1_SMALLEST            0x00000004L
12 #define DF1_BEGINNER            0x00000008L
13 #define DF1_BIG                 0x00000010L
14 #define DF1_NO_DOORS            0x00000020L
15 #define DF1_WATER_RIVER         0x00000040L
16 #define DF1_LAVA_RIVER          0x00000080L
17 #define DF1_CURTAIN             0x00000100L
18 #define DF1_GLASS_DOOR          0x00000200L
19 #define DF1_CAVE                0x00000400L
20 #define DF1_CAVERN              0x00000800L
21 #define DF1_ARCADE              0x00001000L
22 #define DF1_LAKE_ACID           0x00002000L
23 #define DF1_LAKE_POISONOUS      0x00004000L
24 #define DF1_XXX15               0x00008000L
25 #define DF1_FORGET              0x00010000L
26 #define DF1_LAKE_WATER          0x00020000L
27 #define DF1_LAKE_LAVA           0x00040000L
28 #define DF1_LAKE_RUBBLE         0x00080000L
29 #define DF1_LAKE_TREE           0x00100000L
30 #define DF1_NO_VAULT            0x00200000L
31 #define DF1_ARENA               0x00400000L
32 #define DF1_DESTROY             0x00800000L
33 #define DF1_GLASS_ROOM          0x01000000L
34 #define DF1_NO_CAVE             0x02000000L
35 #define DF1_NO_MAGIC            0x04000000L
36 #define DF1_NO_MELEE            0x08000000L
37 #define DF1_CHAMELEON           0x10000000L
38 #define DF1_DARKNESS            0x20000000L
39 #define DF1_ACID_RIVER          0x40000000L
40 #define DF1_POISONOUS_RIVER     0x80000000L
41
42 #define DF1_LAKE_MASK (DF1_LAKE_WATER | DF1_LAKE_LAVA | DF1_LAKE_RUBBLE | DF1_LAKE_TREE | DF1_LAKE_POISONOUS | DF1_LAKE_ACID)
43
44 #define DUNGEON_ANGBAND  1
45 #define DUNGEON_GALGALS  2
46 #define DUNGEON_ORC      3
47 #define DUNGEON_MAZE     4
48 #define DUNGEON_DRAGON   5
49 #define DUNGEON_GRAVE    6
50 #define DUNGEON_WOOD     7
51 #define DUNGEON_VOLCANO  8
52 #define DUNGEON_HELL     9
53 #define DUNGEON_HEAVEN   10
54 #define DUNGEON_OCEAN    11
55 #define DUNGEON_CASTLE   12
56 #define DUNGEON_CTH      13
57 #define DUNGEON_MOUNTAIN 14
58 #define DUNGEON_GOLD     15
59 #define DUNGEON_NO_MAGIC 16
60 #define DUNGEON_NO_MELEE 17
61 #define DUNGEON_CHAMELEON 18
62 #define DUNGEON_DARKNESS 19
63
64 /*
65  * Flags for change floor mode
66  */
67 #define CFM_UP           0x0001  /* Move up */
68 #define CFM_DOWN         0x0002  /* Move down */
69 #define CFM_LONG_STAIRS  0x0004  /* Randomly occurred long stairs/shaft */
70 #define CFM_XXX          0x0008  /* XXX */
71 #define CFM_SHAFT        0x0010  /* Shaft */
72 #define CFM_RAND_PLACE   0x0020  /* Arrive at random grid */
73 #define CFM_RAND_CONNECT 0x0040  /* Connect with random stairs */
74 #define CFM_SAVE_FLOORS  0x0080  /* Save floors */
75 #define CFM_NO_RETURN    0x0100  /* Flee from random quest etc... */
76 #define CFM_FIRST_FLOOR  0x0200  /* Create exit from the dungeon */
77
78 /*
79  * Determines if a map location is fully inside the outer walls
80  */
81 #define in_bounds(Y,X) \
82    (((Y) > 0) && ((X) > 0) && ((Y) < current_floor_ptr->height-1) && ((X) < current_floor_ptr->width-1))
83
84 /*
85  * Determines if a map location is on or inside the outer walls
86  */
87 #define in_bounds2(Y,X) \
88    (((Y) >= 0) && ((X) >= 0) && ((Y) < current_floor_ptr->height) && ((X) < current_floor_ptr->width))
89
90 /*
91  * Determines if a map location is on or inside the outer walls
92  * (unsigned version)
93  */
94 #define in_bounds2u(Y,X) \
95    (((Y) < current_floor_ptr->height) && ((X) < current_floor_ptr->width))
96
97
98 /*
99  * Determine if player is on this grid
100  */
101 #define player_bold(Y,X) \
102         (((Y) == p_ptr->y) && ((X) == p_ptr->x))
103
104 /*
105  * Grid based version of "player_bold()"
106  */
107 #define player_grid(C) \
108         ((C) == &current_floor_ptr->grid_array[p_ptr->y][p_ptr->x])
109
110
111 #define cave_have_flag_bold(Y,X,INDEX) \
112         (have_flag(f_info[current_floor_ptr->grid_array[(Y)][(X)].feat].flags, (INDEX)))
113
114
115 #define cave_have_flag_grid(C,INDEX) \
116         (have_flag(f_info[(C)->feat].flags, (INDEX)))
117
118
119 /*
120  * Determine if a "feature" supports "los"
121  */
122 #define feat_supports_los(F) \
123         (have_flag(f_info[(F)].flags, FF_LOS))
124
125
126 /*
127  * Determine if a "legal" grid supports "los"
128  */
129 #define cave_los_bold(Y,X) \
130         (feat_supports_los(current_floor_ptr->grid_array[(Y)][(X)].feat))
131
132 #define cave_los_grid(C) \
133         (feat_supports_los((C)->feat))
134
135
136 /*
137  * Determine if a "legal" grid is a "clean" floor grid
138  * Determine if terrain-change spells are allowed in a grid.
139  *
140  * Line 1 -- forbid non-floors
141  * Line 2 -- forbid object terrains
142  * Line 3 -- forbid normal objects
143  */
144 #define cave_clean_bold(Y,X) \
145         (cave_have_flag_bold((Y), (X), FF_FLOOR) && \
146          !(current_floor_ptr->grid_array[Y][X].info & CAVE_OBJECT) && \
147           (current_floor_ptr->grid_array[Y][X].o_idx == 0))
148
149
150 /*
151  * Determine if an object can be dropped on a "legal" grid
152  *
153  * Line 1 -- forbid non-drops
154  * Line 2 -- forbid object terrains
155  */
156 #define cave_drop_bold(Y,X) \
157         (cave_have_flag_bold((Y), (X), FF_DROP) && \
158          !(current_floor_ptr->grid_array[Y][X].info & CAVE_OBJECT))
159
160
161 /*
162  * Determine if a "legal" grid is an "empty" floor grid
163  * Determine if monsters are allowed to move into a grid
164  *
165  * Line 1 -- forbid non-placement grids
166  * Line 2 -- forbid normal monsters
167  * Line 3 -- forbid the player
168  */
169 #define cave_empty_bold(Y,X) \
170         (cave_have_flag_bold((Y), (X), FF_PLACE) && \
171          !(current_floor_ptr->grid_array[Y][X].m_idx) && \
172          !player_bold(Y,X))
173
174
175 /*
176  * Determine if a "legal" grid is an "empty" floor grid
177  * Determine if monster generation is allowed in a grid
178  *
179  * Line 1 -- forbid non-empty grids
180  * Line 2 -- forbid trees while dungeon generation
181  */
182 #define cave_empty_bold2(Y,X) \
183         (cave_empty_bold(Y,X) && \
184          (character_dungeon || !cave_have_flag_bold((Y), (X), FF_TREE)))
185
186
187 /*
188  * Determine if a "legal" grid is an "naked" floor grid
189  *
190  * Line 1 -- forbid non-clean gird
191  * Line 2 -- forbid monsters
192  * Line 3 -- forbid the player
193  */
194 #define cave_naked_bold(Y,X) \
195         (cave_clean_bold(Y,X) && \
196          !(current_floor_ptr->grid_array[Y][X].m_idx) && \
197          !player_bold(Y,X))
198
199
200 /*
201  * Determine if a "legal" grid is "permanent"
202  *
203  * Line 1 -- permanent flag
204  */
205 #define cave_perma_bold(Y,X) \
206         (cave_have_flag_bold((Y), (X), FF_PERMANENT))
207
208
209 /*
210  * Grid based version of "cave_empty_bold()"
211  */
212 #define cave_empty_grid(C) \
213         (cave_have_flag_grid((C), FF_PLACE) && \
214          !((C)->m_idx) && \
215          !player_grid(C))
216
217
218 /*
219  * Grid based version of "cave_perma_bold()"
220  */
221 #define cave_perma_grid(C) \
222         (cave_have_flag_grid((C), FF_PERMANENT))
223
224
225 #define pattern_tile(Y,X) \
226         (cave_have_flag_bold((Y), (X), FF_PATTERN))
227
228 /*
229  * Does the grid stop disintegration?
230  */
231 #define cave_stop_disintegration(Y,X) \
232         (!cave_have_flag_bold((Y), (X), FF_PROJECT) && \
233          (!cave_have_flag_bold((Y), (X), FF_HURT_DISI) || \
234           cave_have_flag_bold((Y), (X), FF_PERMANENT)))
235
236
237 /*
238  * Determine if a "legal" grid is within "los" of the player
239  *
240  * Note the use of comparison to zero to force a "boolean" result
241  */
242 #define player_has_los_grid(C) \
243     (((C)->info & (CAVE_VIEW)) != 0)
244
245 /*
246  * Determine if a "legal" grid is within "los" of the player
247  *
248  * Note the use of comparison to zero to force a "boolean" result
249  */
250 #define player_has_los_bold(Y,X) \
251     (((current_floor_ptr->grid_array[Y][X].info & (CAVE_VIEW)) != 0) || p_ptr->inside_battle)
252
253
254 /*
255  * Determine if a "feature" is "permanent wall"
256  */
257 #define permanent_wall(F) \
258         (have_flag((F)->flags, FF_WALL) && \
259          have_flag((F)->flags, FF_PERMANENT))
260
261 /*
262  * Get feature mimic from f_info[] (applying "mimic" field)
263  */
264 #define get_feat_mimic(C) \
265         (f_info[(C)->mimic ? (C)->mimic : (C)->feat].mimic)