8 * @brief ダンジョンの最深層 / Maximum dungeon level.
10 * The player can never reach this level
11 * in the dungeon, and this value is used for various calculations
12 * involving object and monster creation. It must be at least 100.
13 * Setting it below 128 may prevent the creation of some objects.
18 * @brief generate.cで用いられる基本的なブロック数単位(垂直方向)
19 * Number of grids in each block (vertically) Probably hard-coded to 11, see "generate.c"
24 * @brief generate.cで用いられる基本的なブロック数単位(水平方向)
25 * Number of grids in each block (horizontally) Probably hard-coded to 11, see "generate.c"
30 * @brief 表示上の基本的なブロック単位(垂直方向、PANEL_HGTの倍数で設定すること)
31 * Number of grids used to display the dungeon (vertically). Must be a multiple of 11, probably hard-coded to 22.
36 * @brief 表示上の基本的なブロック単位(水平方向、PANEL_WIDの倍数で設定すること)
37 * Number of grids used to display the dungeon (horizontally). Must be a multiple of 33, probably hard-coded to 66.
42 * @brief 表示上のダンジョンの最大垂直サイズ(SCREEN_HGTの3倍が望ましい)
43 * Maximum dungeon height in grids, must be a multiple of SCREEN_HGT, probably hard-coded to SCREEN_HGT * 3.
48 * @brief 表示上のダンジョンの最大水平サイズ(SCREEN_WIDの3倍が望ましい)
49 * Maximum dungeon width in grids, must be a multiple of SCREEN_WID, probably hard-coded to SCREEN_WID * 3.
54 * @brief プレイヤー用光源処理配列サイズ / Maximum size of the "lite" array (see "grid.c")
55 * @details Note that the "lite radius" will NEVER exceed 14, and we would
56 * never require more than 581 entries in the array for circular "lite".
61 * @brief モンスター用光源処理配列サイズ / Maximum size of the "mon_lite" array (see ">grid.c")
62 * @details Note that the "view radius" will NEVER exceed 20, monster illumination
63 * flags are dependent on CAVE_VIEW, and even if the "view" was octagonal,
64 * we would never require more than 1520 entries in the array.
66 #define MON_LITE_MAX 1536
69 * @brief 視界処理配列サイズ / Maximum size of the "view" array
70 * @details Note that the "view radius" will NEVER exceed 20, and even if the "view"
71 * was octagonal, we would never require more than 1520 entries in the array.
76 * @brief 再描画処理用配列サイズ / Maximum size of the "redraw" array
77 * @details We must be large for proper functioning of delayed redrawing.
78 * We must also be as large as two times of the largest view area.
79 * Note that maximum view grids are 1149 entries.
81 #define REDRAW_MAX 2298
85 DUNGEON_IDX dungeon_idx;
86 grid_type *grid_array[MAX_HGT];
87 DEPTH dun_level; /*!< 現在の実ダンジョン階層 base_level の参照元となる / Current dungeon level */
88 DEPTH base_level; /*!< 基本生成レベル、後述のobject_level, monster_levelの参照元となる / Base dungeon level */
89 DEPTH object_level; /*!< アイテムの生成レベル、 base_level を起点に一時変更する時に参照 / Current object creation level */
90 DEPTH monster_level; /*!< モンスターの生成レベル、 base_level を起点に一時変更する時に参照 / Current monster creation level */
91 POSITION width; /*!< Current dungeon width */
92 POSITION height; /*!< Current dungeon height */
93 MONSTER_NUMBER num_repro; /*!< Current reproducer count */
95 GAME_TURN generated_turn; /* Turn when level began */
97 object_type *o_list; /*!< The array of dungeon items [max_o_idx] */
98 OBJECT_IDX o_max; /* Number of allocated objects */
99 OBJECT_IDX o_cnt; /* Number of live objects */
101 monster_type *m_list; /*!< The array of dungeon monsters [max_m_idx] */
102 MONSTER_IDX m_max; /* Number of allocated monsters */
103 MONSTER_IDX m_cnt; /* Number of live monsters */
105 s16b *mproc_list[MAX_MTIMED]; /*!< The array to process dungeon monsters[max_m_idx] */
106 s16b mproc_max[MAX_MTIMED]; /*!< Number of monsters to be processed */
108 POSITION_IDX lite_n; //!< Array of grids lit by player lite
109 POSITION lite_y[LITE_MAX];
110 POSITION lite_x[LITE_MAX];
112 POSITION_IDX mon_lite_n; //!< Array of grids lit by player lite
113 POSITION mon_lite_y[MON_LITE_MAX];
114 POSITION mon_lite_x[MON_LITE_MAX];
116 POSITION_IDX view_n; //!< Array of grids viewable to the player
117 POSITION view_y[VIEW_MAX];
118 POSITION view_x[VIEW_MAX];
120 POSITION_IDX redraw_n; //!< Array of grids for delayed visual updating
121 POSITION redraw_y[REDRAW_MAX];
122 POSITION redraw_x[REDRAW_MAX];
125 QUEST_IDX inside_quest; /* Inside quest level */
126 bool inside_arena; /* Is character inside arena? */
130 extern floor_type floor_info;
132 #define DUNGEON_MODE_NONE 0
133 #define DUNGEON_MODE_AND 1
134 #define DUNGEON_MODE_NAND 2
135 #define DUNGEON_MODE_OR 3
136 #define DUNGEON_MODE_NOR 4
138 /*** Dungeon type flags -- DG ***/
139 #define DF1_WINNER 0x00000001L
140 #define DF1_MAZE 0x00000002L
141 #define DF1_SMALLEST 0x00000004L
142 #define DF1_BEGINNER 0x00000008L
143 #define DF1_BIG 0x00000010L
144 #define DF1_NO_DOORS 0x00000020L
145 #define DF1_WATER_RIVER 0x00000040L
146 #define DF1_LAVA_RIVER 0x00000080L
147 #define DF1_CURTAIN 0x00000100L
148 #define DF1_GLASS_DOOR 0x00000200L
149 #define DF1_CAVE 0x00000400L
150 #define DF1_CAVERN 0x00000800L
151 #define DF1_ARCADE 0x00001000L
152 #define DF1_LAKE_ACID 0x00002000L
153 #define DF1_LAKE_POISONOUS 0x00004000L
154 #define DF1_XXX15 0x00008000L
155 #define DF1_FORGET 0x00010000L
156 #define DF1_LAKE_WATER 0x00020000L
157 #define DF1_LAKE_LAVA 0x00040000L
158 #define DF1_LAKE_RUBBLE 0x00080000L
159 #define DF1_LAKE_TREE 0x00100000L
160 #define DF1_NO_VAULT 0x00200000L
161 #define DF1_ARENA 0x00400000L
162 #define DF1_DESTROY 0x00800000L
163 #define DF1_GLASS_ROOM 0x01000000L
164 #define DF1_NO_CAVE 0x02000000L
165 #define DF1_NO_MAGIC 0x04000000L
166 #define DF1_NO_MELEE 0x08000000L
167 #define DF1_CHAMELEON 0x10000000L
168 #define DF1_DARKNESS 0x20000000L
169 #define DF1_ACID_RIVER 0x40000000L
170 #define DF1_POISONOUS_RIVER 0x80000000L
172 #define DF1_LAKE_MASK (DF1_LAKE_WATER | DF1_LAKE_LAVA | DF1_LAKE_RUBBLE | DF1_LAKE_TREE | DF1_LAKE_POISONOUS | DF1_LAKE_ACID)
175 * Determines if a map location is fully inside the outer walls
177 #define in_bounds(F,Y,X) \
178 (((Y) > 0) && ((X) > 0) && ((Y) < (F)->height-1) && ((X) < (F)->width-1))
181 * Determines if a map location is on or inside the outer walls
183 #define in_bounds2(F,Y,X) \
184 (((Y) >= 0) && ((X) >= 0) && ((Y) < (F)->height) && ((X) < (F)->width))
187 * Determines if a map location is on or inside the outer walls
190 #define in_bounds2u(F,Y,X) \
191 (((Y) < (F)->height) && ((X) < (F)->width))
195 * Determine if player is on this grid
197 #define player_bold(C,Y,X) \
198 (((Y) == (C)->y) && ((X) == (C)->x))
201 * Grid based version of "creature_bold()"
203 #define player_grid(C, G) \
204 ((G) == &(C)->current_floor_ptr->grid_array[(C)->y][(C)->x])
207 #define cave_have_flag_bold(F,Y,X,INDEX) \
208 (have_flag(f_info[(F)->grid_array[(Y)][(X)].feat].flags, (INDEX)))
211 #define cave_have_flag_grid(C,INDEX) \
212 (have_flag(f_info[(C)->feat].flags, (INDEX)))
216 * Determine if a "feature" supports "los"
218 #define feat_supports_los(F) \
219 (have_flag(f_info[(F)].flags, FF_LOS))
223 * Determine if a "legal" grid supports "los"
225 #define cave_los_bold(F,Y,X) \
226 (feat_supports_los((F)->grid_array[(Y)][(X)].feat))
228 #define cave_los_grid(C) \
229 (feat_supports_los((C)->feat))
233 * Determine if a "legal" grid is a "clean" floor grid
234 * Determine if terrain-change spells are allowed in a grid.
236 * Line 1 -- forbid non-floors
237 * Line 2 -- forbid object terrains
238 * Line 3 -- forbid normal objects
240 #define cave_clean_bold(F,Y,X) \
241 (cave_have_flag_bold((F), (Y), (X), FF_FLOOR) && \
242 !((F)->grid_array[Y][X].info & CAVE_OBJECT) && \
243 ((F)->grid_array[Y][X].o_idx == 0))
247 * Determine if an object can be dropped on a "legal" grid
249 * Line 1 -- forbid non-drops
250 * Line 2 -- forbid object terrains
252 #define cave_drop_bold(F,Y,X) \
253 (cave_have_flag_bold((F), (Y), (X), FF_DROP) && \
254 !((F)->grid_array[Y][X].info & CAVE_OBJECT))
258 * Determine if a "legal" grid is an "empty" floor grid
259 * Determine if monsters are allowed to move into a grid
261 * Line 1 -- forbid non-placement grids
262 * Line 2 -- forbid normal monsters
263 * Line 3 -- forbid the player
265 #define cave_empty_bold(F,Y,X) \
266 (cave_have_flag_bold((F), (Y), (X), FF_PLACE) && \
267 !((F)->grid_array[Y][X].m_idx) && \
268 !player_bold(p_ptr, Y,X))
272 * Determine if a "legal" grid is an "empty" floor grid
273 * Determine if monster generation is allowed in a grid
275 * Line 1 -- forbid non-empty grids
276 * Line 2 -- forbid trees while dungeon generation
278 #define cave_empty_bold2(F,Y,X) \
279 (cave_empty_bold(F,Y,X) && \
280 (current_world_ptr->character_dungeon || !cave_have_flag_bold((F), (Y), (X), FF_TREE)))
284 * Determine if a "legal" grid is an "naked" floor grid
286 * Line 1 -- forbid non-clean gird
287 * Line 2 -- forbid monsters
288 * Line 3 -- forbid the player
290 #define cave_naked_bold(C,F,Y,X) \
291 (cave_clean_bold(F,Y,X) && \
292 !((F)->grid_array[Y][X].m_idx) && \
297 * Determine if a "legal" grid is "permanent"
299 * Line 1 -- permanent flag
301 #define cave_perma_bold(F,Y,X) \
302 (cave_have_flag_bold((F), (Y), (X), FF_PERMANENT))
306 * Grid based version of "cave_empty_bold()"
308 #define cave_empty_grid(C) \
309 (cave_have_flag_grid((C), FF_PLACE) && \
310 !((C)->m_idx) && !player_grid(p_ptr, C))
314 * Grid based version of "cave_perma_bold()"
316 #define cave_perma_grid(C) \
317 (cave_have_flag_grid((C), FF_PERMANENT))
320 #define pattern_tile(Y,X) \
321 (cave_have_flag_bold(p_ptr->current_floor_ptr, (Y), (X), FF_PATTERN))
324 * Does the grid stop disintegration?
326 #define cave_stop_disintegration(F,Y,X) \
327 (!cave_have_flag_bold((F), (Y), (X), FF_PROJECT) && \
328 (!cave_have_flag_bold((F), (Y), (X), FF_HURT_DISI) || \
329 cave_have_flag_bold((F), (Y), (X), FF_PERMANENT)))
333 * Determine if a "legal" grid is within "los" of the player
335 * Note the use of comparison to zero to force a "boolean" result
337 #define player_has_los_grid(C) \
338 (((C)->info & (CAVE_VIEW)) != 0)
341 * Determine if a "legal" grid is within "los" of the player
343 * Note the use of comparison to zero to force a "boolean" result
345 #define player_has_los_bold(C,Y,X) \
346 ((((C)->current_floor_ptr->grid_array[Y][X].info & (CAVE_VIEW)) != 0) || (C)->phase_out)
350 * Determine if a "feature" is "permanent wall"
352 #define permanent_wall(F) \
353 (have_flag((F)->flags, FF_WALL) && \
354 have_flag((F)->flags, FF_PERMANENT))
356 extern saved_floor_type saved_floors[MAX_SAVED_FLOORS];
359 * Convert a "location" (Y,X) into a "grid" (G)
365 * Convert a "grid" (G) into a "location" (Y)
371 * Convert a "grid" (G) into a "location" (X)
376 extern void update_smell(floor_type *floor_ptr, player_type *subject_ptr);
378 extern void add_door(floor_type *floor_ptr, POSITION x, POSITION y);
379 extern void place_secret_door(floor_type *floor_ptr, POSITION y, POSITION x, int type);
380 extern void place_locked_door(floor_type *floor_ptr, POSITION y, POSITION x);
381 extern void forget_flow(floor_type *floor_ptr);
382 extern void place_random_stairs(player_type *player_ptr, POSITION y, POSITION x);
384 extern bool los(floor_type* floor_ptr, POSITION y1, POSITION x1, POSITION y2, POSITION x2);
385 extern bool projectable(floor_type *floor_ptr, POSITION y1, POSITION x1, POSITION y2, POSITION x2);
386 extern int project_length;
388 extern void vault_monsters(floor_type *floor_ptr, POSITION y1, POSITION x1, int num);
389 extern bool cave_valid_bold(floor_type *floor_ptr, POSITION y, POSITION x);
390 extern void cave_set_feat(floor_type *floor_ptr, POSITION y, POSITION x, FEAT_IDX feat);
391 extern void place_random_door(floor_type *floor_ptr, POSITION y, POSITION x, bool room);
392 extern void place_closed_door(floor_type *floor_ptr, POSITION y, POSITION x, int type);
394 extern void wipe_o_list(floor_type *floor_ptr);
395 extern void vault_trap_aux(player_type *player_ptr, POSITION y, POSITION x, POSITION yd, POSITION xd);
397 extern bool get_is_floor(floor_type *floor_ptr, POSITION x, POSITION y);
398 extern void try_door(floor_type *floor_ptr, POSITION y, POSITION x);
400 extern FEAT_IDX conv_dungeon_feat(floor_type *floor_ptr, FEAT_IDX newfeat);
401 extern void vault_objects(player_type *player_ptr, POSITION y, POSITION x, int num);
404 * project()関数に用いられる、遠隔攻撃特性ビットフラグ / Bit flags for the "project()" function
406 #define PROJECT_JUMP 0x0001 /*!< 遠隔攻撃特性: 発動者からの軌跡を持たず、指定地点に直接発生する(予め置いたトラップ、上空からの発生などのイメージ) / Jump directly to the target location (this is a hack) */
407 #define PROJECT_BEAM 0x0002 /*!< 遠隔攻撃特性: ビーム範囲を持つ。 / Work as a beam weapon (affect every grid passed through) */
408 #define PROJECT_THRU 0x0004 /*!< 遠隔攻撃特性: 目標地点に到達しても射程と遮蔽の限り引き延ばす。 / Continue "through" the target (used for "bolts"/"beams") */
409 #define PROJECT_STOP 0x0008 /*!< 遠隔攻撃特性: 道中にプレイヤーかモンスターがいた時点で到達地点を更新して停止する(壁や森はPROJECT_DISIがない限り最初から貫通しない) */
410 #define PROJECT_GRID 0x0010 /*!< 遠隔攻撃特性: 射程内の地形に影響を及ぼす / Affect each grid in the "blast area" in some way */
411 #define PROJECT_ITEM 0x0020 /*!< 遠隔攻撃特性: 射程内のアイテムに影響を及ぼす / Affect each object in the "blast area" in some way */
412 #define PROJECT_KILL 0x0040 /*!< 遠隔攻撃特性: 射程内のモンスターに影響を及ぼす / Affect each monster in the "blast area" in some way */
413 #define PROJECT_HIDE 0x0080 /*!< 遠隔攻撃特性: / Hack -- disable "visual" feedback from projection */
414 #define PROJECT_DISI 0x0100 /*!< 遠隔攻撃特性: / Disintegrate non-permanent features */
415 #define PROJECT_PLAYER 0x0200 /*!< 遠隔攻撃特性: / Main target is player (used for riding player) */
416 #define PROJECT_AIMED 0x0400 /*!< 遠隔攻撃特性: / Target is only player or monster, so don't affect another. Depend on PROJECT_PLAYER. (used for minimum (rad == 0) balls on riding player) */
417 #define PROJECT_REFLECTABLE 0x0800 /*!< 遠隔攻撃特性: 反射可能(ボルト系魔法に利用) / Refrectable spell attacks (used for "bolts") */
418 #define PROJECT_NO_HANGEKI 0x1000 /*!< 遠隔攻撃特性: / Avoid counter attacks of monsters */
419 #define PROJECT_PATH 0x2000 /*!< 遠隔攻撃特性: / Only used for printing project path */
420 #define PROJECT_FAST 0x4000 /*!< 遠隔攻撃特性: / Hide "visual" of flying bolts until blast */
421 #define PROJECT_LOS 0x8000 /*!< 遠隔攻撃特性: / */
422 extern sint project_path(floor_type *floor_ptr, u16b *gp, POSITION range, POSITION y1, POSITION x1, POSITION y2, POSITION x2, BIT_FLAGS flg);
424 extern void set_floor(floor_type *floor_ptr, POSITION x, POSITION y);
425 extern void place_object(player_type *owner_ptr, POSITION y, POSITION x, BIT_FLAGS mode);
426 extern void place_gold(floor_type *floor_ptr, POSITION y, POSITION x);
427 extern void delete_monster(floor_type *floor_ptr, POSITION y, POSITION x);
428 extern void compact_objects(floor_type *floor_ptr, int size);
429 extern void vault_traps(player_type *player_ptr, POSITION y, POSITION x, POSITION yd, POSITION xd, int num);
430 extern void scatter(floor_type *floor_ptr, POSITION *yp, POSITION *xp, POSITION y, POSITION x, POSITION d, BIT_FLAGS mode);