9 * @brief ダンジョンの最深層 / Maximum dungeon level.
11 * The player can never reach this level
12 * in the dungeon, and this value is used for various calculations
13 * involving object and monster creation. It must be at least 100.
14 * Setting it below 128 may prevent the creation of some objects.
19 * @brief generate.cで用いられる基本的なブロック数単位(垂直方向)
20 * Number of grids in each block (vertically) Probably hard-coded to 11, see "generate.c"
25 * @brief generate.cで用いられる基本的なブロック数単位(水平方向)
26 * Number of grids in each block (horizontally) Probably hard-coded to 11, see "generate.c"
31 * @brief 表示上の基本的なブロック単位(垂直方向、PANEL_HGTの倍数で設定すること)
32 * Number of grids used to display the dungeon (vertically). Must be a multiple of 11, probably hard-coded to 22.
37 * @brief 表示上の基本的なブロック単位(水平方向、PANEL_WIDの倍数で設定すること)
38 * Number of grids used to display the dungeon (horizontally). Must be a multiple of 33, probably hard-coded to 66.
43 * @brief 表示上のダンジョンの最大垂直サイズ(SCREEN_HGTの3倍が望ましい)
44 * Maximum dungeon height in grids, must be a multiple of SCREEN_HGT, probably hard-coded to SCREEN_HGT * 3.
49 * @brief 表示上のダンジョンの最大水平サイズ(SCREEN_WIDの3倍が望ましい)
50 * Maximum dungeon width in grids, must be a multiple of SCREEN_WID, probably hard-coded to SCREEN_WID * 3.
55 * @brief プレイヤー用光源処理配列サイズ / Maximum size of the "lite" array (see "grid.c")
56 * @details Note that the "lite radius" will NEVER exceed 14, and we would
57 * never require more than 581 entries in the array for circular "lite".
62 * @brief モンスター用光源処理配列サイズ / Maximum size of the "mon_lite" array (see ">grid.c")
63 * @details Note that the "view radius" will NEVER exceed 20, monster illumination
64 * flags are dependent on CAVE_VIEW, and even if the "view" was octagonal,
65 * we would never require more than 1520 entries in the array.
67 #define MON_LITE_MAX 1536
70 * @brief 視界処理配列サイズ / Maximum size of the "view" array (see "p_ptr->current_floor_ptr->grid_array.c")
71 * @details Note that the "view radius" will NEVER exceed 20, and even if the "view"
72 * was octagonal, we would never require more than 1520 entries in the array.
77 * @brief 再描画処理用配列サイズ / Maximum size of the "redraw" array (see "p_ptr->current_floor_ptr->grid_array.c")
78 * @details We must be large for proper functioning of delayed redrawing.
79 * We must also be as large as two times of the largest view area.
80 * Note that maximum view grids are 1149 entries.
82 #define REDRAW_MAX 2298
86 DUNGEON_IDX dungeon_idx;
87 grid_type *grid_array[MAX_HGT];
88 DEPTH dun_level; /*!< 現在の実ダンジョン階層base_levelの参照元となる / Current dungeon level */
89 DEPTH base_level; /*!< 基本生成レベル、後述のobject_level, monster_levelの参照元となる / Base dungeon level */
90 DEPTH object_level; /*!< アイテムの生成レベル、p_ptr->current_floor_ptr->base_levelを起点に一時変更する時に参照 / Current object creation level */
91 DEPTH monster_level; /*!< モンスターの生成レベル、p_ptr->current_floor_ptr->base_levelを起点に一時変更する時に参照 / Current monster creation level */
92 POSITION width; /* Current dungeon width */
93 POSITION height; /* Current dungeon height */
94 MONSTER_NUMBER num_repro; /*!< Current reproducer count */
96 GAME_TURN generated_turn; /* Turn when level began */
98 object_type *o_list; /*!< The array of dungeon items [current_world_ptr->max_o_idx] */
99 OBJECT_IDX o_max; /* Number of allocated objects */
100 OBJECT_IDX o_cnt; /* Number of live objects */
102 monster_type *m_list; /*!< The array of dungeon monsters [current_world_ptr->max_m_idx] */
103 MONSTER_IDX m_max; /* Number of allocated monsters */
104 MONSTER_IDX m_cnt; /* Number of live monsters */
106 s16b *mproc_list[MAX_MTIMED]; /*!< The array to process dungeon monsters[max_m_idx] */
107 s16b mproc_max[MAX_MTIMED]; /*!< Number of monsters to be processed */
109 POSITION_IDX lite_n; //!< Array of grids lit by player lite (see "p_ptr->current_floor_ptr->grid_array.c")
110 POSITION lite_y[LITE_MAX];
111 POSITION lite_x[LITE_MAX];
113 POSITION_IDX mon_lite_n; //!< Array of grids lit by player lite (see "p_ptr->current_floor_ptr->grid_array.c")
114 POSITION mon_lite_y[MON_LITE_MAX];
115 POSITION mon_lite_x[MON_LITE_MAX];
117 POSITION_IDX view_n; //!< Array of grids viewable to the player (see "grid_array")
118 POSITION view_y[VIEW_MAX];
119 POSITION view_x[VIEW_MAX];
121 POSITION_IDX redraw_n; //!< Array of grids for delayed visual updating (see "p_ptr->current_floor_ptr->grid_array.c")
122 POSITION redraw_y[REDRAW_MAX];
123 POSITION redraw_x[REDRAW_MAX];
129 extern floor_type floor_info;
131 #define DUNGEON_MODE_NONE 0
132 #define DUNGEON_MODE_AND 1
133 #define DUNGEON_MODE_NAND 2
134 #define DUNGEON_MODE_OR 3
135 #define DUNGEON_MODE_NOR 4
137 /*** Dungeon type flags -- DG ***/
138 #define DF1_WINNER 0x00000001L
139 #define DF1_MAZE 0x00000002L
140 #define DF1_SMALLEST 0x00000004L
141 #define DF1_BEGINNER 0x00000008L
142 #define DF1_BIG 0x00000010L
143 #define DF1_NO_DOORS 0x00000020L
144 #define DF1_WATER_RIVER 0x00000040L
145 #define DF1_LAVA_RIVER 0x00000080L
146 #define DF1_CURTAIN 0x00000100L
147 #define DF1_GLASS_DOOR 0x00000200L
148 #define DF1_CAVE 0x00000400L
149 #define DF1_CAVERN 0x00000800L
150 #define DF1_ARCADE 0x00001000L
151 #define DF1_LAKE_ACID 0x00002000L
152 #define DF1_LAKE_POISONOUS 0x00004000L
153 #define DF1_XXX15 0x00008000L
154 #define DF1_FORGET 0x00010000L
155 #define DF1_LAKE_WATER 0x00020000L
156 #define DF1_LAKE_LAVA 0x00040000L
157 #define DF1_LAKE_RUBBLE 0x00080000L
158 #define DF1_LAKE_TREE 0x00100000L
159 #define DF1_NO_VAULT 0x00200000L
160 #define DF1_ARENA 0x00400000L
161 #define DF1_DESTROY 0x00800000L
162 #define DF1_GLASS_ROOM 0x01000000L
163 #define DF1_NO_CAVE 0x02000000L
164 #define DF1_NO_MAGIC 0x04000000L
165 #define DF1_NO_MELEE 0x08000000L
166 #define DF1_CHAMELEON 0x10000000L
167 #define DF1_DARKNESS 0x20000000L
168 #define DF1_ACID_RIVER 0x40000000L
169 #define DF1_POISONOUS_RIVER 0x80000000L
171 #define DF1_LAKE_MASK (DF1_LAKE_WATER | DF1_LAKE_LAVA | DF1_LAKE_RUBBLE | DF1_LAKE_TREE | DF1_LAKE_POISONOUS | DF1_LAKE_ACID)
174 * Determines if a map location is fully inside the outer walls
176 #define in_bounds(F,Y,X) \
177 (((Y) > 0) && ((X) > 0) && ((Y) < (F)->height-1) && ((X) < (F)->width-1))
180 * Determines if a map location is on or inside the outer walls
182 #define in_bounds2(F,Y,X) \
183 (((Y) >= 0) && ((X) >= 0) && ((Y) < (F)->height) && ((X) < (F)->width))
186 * Determines if a map location is on or inside the outer walls
189 #define in_bounds2u(F,Y,X) \
190 (((Y) < (F)->height) && ((X) < (F)->width))
194 * Determine if player is on this grid
196 #define player_bold(Y,X) \
197 (((Y) == p_ptr->y) && ((X) == p_ptr->x))
200 * Grid based version of "creature_bold()"
202 #define player_grid(C, G) \
203 ((G) == &(C)->current_floor_ptr->grid_array[p_ptr->y][p_ptr->x])
206 #define cave_have_flag_bold(Y,X,INDEX) \
207 (have_flag(f_info[p_ptr->current_floor_ptr->grid_array[(Y)][(X)].feat].flags, (INDEX)))
210 #define cave_have_flag_grid(C,INDEX) \
211 (have_flag(f_info[(C)->feat].flags, (INDEX)))
215 * Determine if a "feature" supports "los"
217 #define feat_supports_los(F) \
218 (have_flag(f_info[(F)].flags, FF_LOS))
222 * Determine if a "legal" grid supports "los"
224 #define cave_los_bold(Y,X) \
225 (feat_supports_los(p_ptr->current_floor_ptr->grid_array[(Y)][(X)].feat))
227 #define cave_los_grid(C) \
228 (feat_supports_los((C)->feat))
232 * Determine if a "legal" grid is a "clean" floor grid
233 * Determine if terrain-change spells are allowed in a grid.
235 * Line 1 -- forbid non-floors
236 * Line 2 -- forbid object terrains
237 * Line 3 -- forbid normal objects
239 #define cave_clean_bold(Y,X) \
240 (cave_have_flag_bold((Y), (X), FF_FLOOR) && \
241 !(p_ptr->current_floor_ptr->grid_array[Y][X].info & CAVE_OBJECT) && \
242 (p_ptr->current_floor_ptr->grid_array[Y][X].o_idx == 0))
246 * Determine if an object can be dropped on a "legal" grid
248 * Line 1 -- forbid non-drops
249 * Line 2 -- forbid object terrains
251 #define cave_drop_bold(Y,X) \
252 (cave_have_flag_bold((Y), (X), FF_DROP) && \
253 !(p_ptr->current_floor_ptr->grid_array[Y][X].info & CAVE_OBJECT))
257 * Determine if a "legal" grid is an "empty" floor grid
258 * Determine if monsters are allowed to move into a grid
260 * Line 1 -- forbid non-placement grids
261 * Line 2 -- forbid normal monsters
262 * Line 3 -- forbid the player
264 #define cave_empty_bold(Y,X) \
265 (cave_have_flag_bold((Y), (X), FF_PLACE) && \
266 !(p_ptr->current_floor_ptr->grid_array[Y][X].m_idx) && \
271 * Determine if a "legal" grid is an "empty" floor grid
272 * Determine if monster generation is allowed in a grid
274 * Line 1 -- forbid non-empty grids
275 * Line 2 -- forbid trees while dungeon generation
277 #define cave_empty_bold2(Y,X) \
278 (cave_empty_bold(Y,X) && \
279 (current_world_ptr->character_dungeon || !cave_have_flag_bold((Y), (X), FF_TREE)))
283 * Determine if a "legal" grid is an "naked" floor grid
285 * Line 1 -- forbid non-clean gird
286 * Line 2 -- forbid monsters
287 * Line 3 -- forbid the player
289 #define cave_naked_bold(Y,X) \
290 (cave_clean_bold(Y,X) && \
291 !(p_ptr->current_floor_ptr->grid_array[Y][X].m_idx) && \
296 * Determine if a "legal" grid is "permanent"
298 * Line 1 -- permanent flag
300 #define cave_perma_bold(Y,X) \
301 (cave_have_flag_bold((Y), (X), FF_PERMANENT))
305 * Grid based version of "cave_empty_bold()"
307 #define cave_empty_grid(C) \
308 (cave_have_flag_grid((C), FF_PLACE) && \
309 !((C)->m_idx) && !player_grid(p_ptr, C))
313 * Grid based version of "cave_perma_bold()"
315 #define cave_perma_grid(C) \
316 (cave_have_flag_grid((C), FF_PERMANENT))
319 #define pattern_tile(Y,X) \
320 (cave_have_flag_bold((Y), (X), FF_PATTERN))
323 * Does the grid stop disintegration?
325 #define cave_stop_disintegration(Y,X) \
326 (!cave_have_flag_bold((Y), (X), FF_PROJECT) && \
327 (!cave_have_flag_bold((Y), (X), FF_HURT_DISI) || \
328 cave_have_flag_bold((Y), (X), FF_PERMANENT)))
332 * Determine if a "legal" grid is within "los" of the player
334 * Note the use of comparison to zero to force a "boolean" result
336 #define player_has_los_grid(C) \
337 (((C)->info & (CAVE_VIEW)) != 0)
340 * Determine if a "legal" grid is within "los" of the player
342 * Note the use of comparison to zero to force a "boolean" result
344 #define player_has_los_bold(Y,X) \
345 (((p_ptr->current_floor_ptr->grid_array[Y][X].info & (CAVE_VIEW)) != 0) || p_ptr->phase_out)
349 * Determine if a "feature" is "permanent wall"
351 #define permanent_wall(F) \
352 (have_flag((F)->flags, FF_WALL) && \
353 have_flag((F)->flags, FF_PERMANENT))
355 extern saved_floor_type saved_floors[MAX_SAVED_FLOORS];
358 * Convert a "location" (Y,X) into a "grid" (G)
364 * Convert a "grid" (G) into a "location" (Y)
370 * Convert a "grid" (G) into a "location" (X)
375 extern void place_secret_door(floor_type *floor_ptr, POSITION y, POSITION x, int type);
376 extern void place_locked_door(floor_type *floor_ptr, POSITION y, POSITION x);