#include "feature.h"
#include "grid.h"
#include "object.h"
-#include "monster.h"
/*!
* @brief ダンジョンの最深層 / Maximum dungeon level.
#define MON_LITE_MAX 1536
/*!
- * @brief 視界処理配列サイズ / Maximum size of the "view" array (see "p_ptr->current_floor_ptr->grid_array.c")
+ * @brief 視界処理配列サイズ / Maximum size of the "view" array
* @details Note that the "view radius" will NEVER exceed 20, and even if the "view"
* was octagonal, we would never require more than 1520 entries in the array.
*/
#define VIEW_MAX 1536
/*!
- * @brief 再描画処理用配列サイズ / Maximum size of the "redraw" array (see "p_ptr->current_floor_ptr->grid_array.c")
+ * @brief 再描画処理用配列サイズ / Maximum size of the "redraw" array
* @details We must be large for proper functioning of delayed redrawing.
* We must also be as large as two times of the largest view area.
* Note that maximum view grids are 1149 entries.
#define REDRAW_MAX 2298
-typedef struct {
+typedef struct floor_type {
DUNGEON_IDX dungeon_idx;
grid_type *grid_array[MAX_HGT];
- DEPTH dun_level; /*!< 現在の実ダンジョン階層base_levelの参照元となる / Current dungeon level */
+ DEPTH dun_level; /*!< 現在の実ダンジョン階層 base_level の参照元となる / Current dungeon level */
DEPTH base_level; /*!< 基本生成レベル、後述のobject_level, monster_levelの参照元となる / Base dungeon level */
- DEPTH object_level; /*!< アイテムの生成レベル、p_ptr->current_floor_ptr->base_levelを起点に一時変更する時に参照 / Current object creation level */
- DEPTH monster_level; /*!< モンスターの生成レベル、p_ptr->current_floor_ptr->base_levelを起点に一時変更する時に参照 / Current monster creation level */
- POSITION width; /* Current dungeon width */
- POSITION height; /* Current dungeon height */
+ DEPTH object_level; /*!< アイテムの生成レベル、 base_level を起点に一時変更する時に参照 / Current object creation level */
+ DEPTH monster_level; /*!< モンスターの生成レベル、 base_level を起点に一時変更する時に参照 / Current monster creation level */
+ POSITION width; /*!< Current dungeon width */
+ POSITION height; /*!< Current dungeon height */
MONSTER_NUMBER num_repro; /*!< Current reproducer count */
GAME_TURN generated_turn; /* Turn when level began */
- object_type *o_list; /*!< The array of dungeon items [current_world_ptr->max_o_idx] */
+ object_type *o_list; /*!< The array of dungeon items [max_o_idx] */
OBJECT_IDX o_max; /* Number of allocated objects */
OBJECT_IDX o_cnt; /* Number of live objects */
- monster_type *m_list; /*!< The array of dungeon monsters [current_world_ptr->max_m_idx] */
+ monster_type *m_list; /*!< The array of dungeon monsters [max_m_idx] */
MONSTER_IDX m_max; /* Number of allocated monsters */
MONSTER_IDX m_cnt; /* Number of live monsters */
s16b *mproc_list[MAX_MTIMED]; /*!< The array to process dungeon monsters[max_m_idx] */
s16b mproc_max[MAX_MTIMED]; /*!< Number of monsters to be processed */
- POSITION_IDX lite_n; //!< Array of grids lit by player lite (see "p_ptr->current_floor_ptr->grid_array.c")
+ POSITION_IDX lite_n; //!< Array of grids lit by player lite
POSITION lite_y[LITE_MAX];
POSITION lite_x[LITE_MAX];
- POSITION_IDX mon_lite_n; //!< Array of grids lit by player lite (see "p_ptr->current_floor_ptr->grid_array.c")
+ POSITION_IDX mon_lite_n; //!< Array of grids lit by player lite
POSITION mon_lite_y[MON_LITE_MAX];
POSITION mon_lite_x[MON_LITE_MAX];
- POSITION_IDX view_n; //!< Array of grids viewable to the player (see "grid_array")
+ POSITION_IDX view_n; //!< Array of grids viewable to the player
POSITION view_y[VIEW_MAX];
POSITION view_x[VIEW_MAX];
- POSITION_IDX redraw_n; //!< Array of grids for delayed visual updating (see "p_ptr->current_floor_ptr->grid_array.c")
+ POSITION_IDX redraw_n; //!< Array of grids for delayed visual updating
POSITION redraw_y[REDRAW_MAX];
POSITION redraw_x[REDRAW_MAX];
* Grid based version of "creature_bold()"
*/
#define player_grid(C, G) \
- ((G) == &(C)->current_floor_ptr->grid_array[p_ptr->y][p_ptr->x])
+ ((G) == &(C)->current_floor_ptr->grid_array[(C)->y][(C)->x])
-#define cave_have_flag_bold(Y,X,INDEX) \
- (have_flag(f_info[p_ptr->current_floor_ptr->grid_array[(Y)][(X)].feat].flags, (INDEX)))
+#define cave_have_flag_bold(F,Y,X,INDEX) \
+ (have_flag(f_info[(F)->grid_array[(Y)][(X)].feat].flags, (INDEX)))
#define cave_have_flag_grid(C,INDEX) \
(have_flag(f_info[(F)].flags, FF_LOS))
-/*
- * Determine if a "legal" grid supports "los"
- */
-#define cave_los_bold(F,Y,X) \
- (feat_supports_los((F)->grid_array[(Y)][(X)].feat))
-
#define cave_los_grid(C) \
(feat_supports_los((C)->feat))
* Line 3 -- forbid normal objects
*/
#define cave_clean_bold(F,Y,X) \
- (cave_have_flag_bold((Y), (X), FF_FLOOR) && \
+ (cave_have_flag_bold((F), (Y), (X), FF_FLOOR) && \
!((F)->grid_array[Y][X].info & CAVE_OBJECT) && \
((F)->grid_array[Y][X].o_idx == 0))
* Line 2 -- forbid object terrains
*/
#define cave_drop_bold(F,Y,X) \
- (cave_have_flag_bold((Y), (X), FF_DROP) && \
+ (cave_have_flag_bold((F), (Y), (X), FF_DROP) && \
!((F)->grid_array[Y][X].info & CAVE_OBJECT))
/*
- * Determine if a "legal" grid is an "empty" floor grid
- * Determine if monsters are allowed to move into a grid
- *
- * Line 1 -- forbid non-placement grids
- * Line 2 -- forbid normal monsters
- * Line 3 -- forbid the player
- */
-#define cave_empty_bold(F,Y,X) \
- (cave_have_flag_bold((Y), (X), FF_PLACE) && \
- !((F)->grid_array[Y][X].m_idx) && \
- !player_bold(p_ptr, Y,X))
-
-
-/*
- * Determine if a "legal" grid is an "empty" floor grid
- * Determine if monster generation is allowed in a grid
- *
- * Line 1 -- forbid non-empty grids
- * Line 2 -- forbid trees while dungeon generation
- */
-#define cave_empty_bold2(F,Y,X) \
- (cave_empty_bold(F,Y,X) && \
- (current_world_ptr->character_dungeon || !cave_have_flag_bold((Y), (X), FF_TREE)))
-
-
-/*
* Determine if a "legal" grid is an "naked" floor grid
*
* Line 1 -- forbid non-clean gird
*
* Line 1 -- permanent flag
*/
-#define cave_perma_bold(Y,X) \
- (cave_have_flag_bold((Y), (X), FF_PERMANENT))
-
-
-/*
- * Grid based version of "cave_empty_bold()"
- */
-#define cave_empty_grid(C) \
- (cave_have_flag_grid((C), FF_PLACE) && \
- !((C)->m_idx) && !player_grid(p_ptr, C))
+#define cave_perma_bold(F,Y,X) \
+ (cave_have_flag_bold((F), (Y), (X), FF_PERMANENT))
/*
(cave_have_flag_grid((C), FF_PERMANENT))
-#define pattern_tile(Y,X) \
- (cave_have_flag_bold((Y), (X), FF_PATTERN))
-
/*
* Does the grid stop disintegration?
*/
-#define cave_stop_disintegration(Y,X) \
- (!cave_have_flag_bold((Y), (X), FF_PROJECT) && \
- (!cave_have_flag_bold((Y), (X), FF_HURT_DISI) || \
- cave_have_flag_bold((Y), (X), FF_PERMANENT)))
+#define cave_stop_disintegration(F,Y,X) \
+ (!cave_have_flag_bold((F), (Y), (X), FF_PROJECT) && \
+ (!cave_have_flag_bold((F), (Y), (X), FF_HURT_DISI) || \
+ cave_have_flag_bold((F), (Y), (X), FF_PERMANENT)))
/*
#define GRID_X(G) \
((int)((G) % 256U))
+extern bool pattern_tile(floor_type *floor_ptr, POSITION y, POSITION x);
+extern bool is_cave_empty_bold(player_type *player_ptr, POSITION x, POSITION y);
+extern bool is_cave_empty_bold2(player_type *player_ptr, POSITION x, POSITION y);
extern void update_smell(floor_type *floor_ptr, player_type *subject_ptr);
-extern void add_door(floor_type *floor_ptr, POSITION x, POSITION y);
-extern void place_secret_door(floor_type *floor_ptr, POSITION y, POSITION x, int type);
-extern void place_locked_door(floor_type *floor_ptr, POSITION y, POSITION x);
+extern void add_door(player_type *player_ptr, POSITION x, POSITION y);
+extern void place_secret_door(player_type *player_ptr, POSITION y, POSITION x, int type);
+extern void place_locked_door(player_type *player_ptr, POSITION y, POSITION x);
extern void forget_flow(floor_type *floor_ptr);
-extern void place_random_stairs(floor_type *floor_ptr, POSITION y, POSITION x);
+extern void place_random_stairs(player_type *player_ptr, POSITION y, POSITION x);
-extern bool los(floor_type* floor_ptr, POSITION y1, POSITION x1, POSITION y2, POSITION x2);
-extern bool projectable(floor_type *floor_ptr, POSITION y1, POSITION x1, POSITION y2, POSITION x2);
+extern bool los(player_type *player_ptr, POSITION y1, POSITION x1, POSITION y2, POSITION x2);
+extern bool projectable(player_type *player_ptr, POSITION y1, POSITION x1, POSITION y2, POSITION x2);
extern int project_length;
-extern void vault_monsters(floor_type *floor_ptr, POSITION y1, POSITION x1, int num);
+extern void vault_monsters(player_type *player_ptr, POSITION y1, POSITION x1, int num);
extern bool cave_valid_bold(floor_type *floor_ptr, POSITION y, POSITION x);
-extern void cave_set_feat(floor_type *floor_ptr, POSITION y, POSITION x, FEAT_IDX feat);
-extern void place_random_door(floor_type *floor_ptr, POSITION y, POSITION x, bool room);
+extern void cave_set_feat(player_type *player_ptr, POSITION y, POSITION x, FEAT_IDX feat);
+extern void place_random_door(player_type *player_ptr, POSITION y, POSITION x, bool room);
+extern void place_closed_door(player_type *player_ptr, POSITION y, POSITION x, int type);
+
+extern void wipe_o_list(floor_type *floor_ptr);
+extern void vault_trap_aux(player_type *player_ptr, POSITION y, POSITION x, POSITION yd, POSITION xd);
+
+extern bool get_is_floor(floor_type *floor_ptr, POSITION x, POSITION y);
+extern void try_door(player_type *player_ptr, POSITION y, POSITION x);
+
+extern FEAT_IDX conv_dungeon_feat(floor_type *floor_ptr, FEAT_IDX newfeat);
+extern void vault_objects(player_type *player_ptr, POSITION y, POSITION x, int num);
+
+/*
+ * project()関数に用いられる、遠隔攻撃特性ビットフラグ / Bit flags for the "project()" function
+ */
+#define PROJECT_JUMP 0x0001 /*!< 遠隔攻撃特性: 発動者からの軌跡を持たず、指定地点に直接発生する(予め置いたトラップ、上空からの発生などのイメージ) / Jump directly to the target location (this is a hack) */
+#define PROJECT_BEAM 0x0002 /*!< 遠隔攻撃特性: ビーム範囲を持つ。 / Work as a beam weapon (affect every grid passed through) */
+#define PROJECT_THRU 0x0004 /*!< 遠隔攻撃特性: 目標地点に到達しても射程と遮蔽の限り引き延ばす。 / Continue "through" the target (used for "bolts"/"beams") */
+#define PROJECT_STOP 0x0008 /*!< 遠隔攻撃特性: 道中にプレイヤーかモンスターがいた時点で到達地点を更新して停止する(壁や森はPROJECT_DISIがない限り最初から貫通しない) */
+#define PROJECT_GRID 0x0010 /*!< 遠隔攻撃特性: 射程内の地形に影響を及ぼす / Affect each grid in the "blast area" in some way */
+#define PROJECT_ITEM 0x0020 /*!< 遠隔攻撃特性: 射程内のアイテムに影響を及ぼす / Affect each object in the "blast area" in some way */
+#define PROJECT_KILL 0x0040 /*!< 遠隔攻撃特性: 射程内のモンスターに影響を及ぼす / Affect each monster in the "blast area" in some way */
+#define PROJECT_HIDE 0x0080 /*!< 遠隔攻撃特性: / Hack -- disable "visual" feedback from projection */
+#define PROJECT_DISI 0x0100 /*!< 遠隔攻撃特性: / Disintegrate non-permanent features */
+#define PROJECT_PLAYER 0x0200 /*!< 遠隔攻撃特性: / Main target is player (used for riding player) */
+#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) */
+#define PROJECT_REFLECTABLE 0x0800 /*!< 遠隔攻撃特性: 反射可能(ボルト系魔法に利用) / Refrectable spell attacks (used for "bolts") */
+#define PROJECT_NO_HANGEKI 0x1000 /*!< 遠隔攻撃特性: / Avoid counter attacks of monsters */
+#define PROJECT_PATH 0x2000 /*!< 遠隔攻撃特性: / Only used for printing project path */
+#define PROJECT_FAST 0x4000 /*!< 遠隔攻撃特性: / Hide "visual" of flying bolts until blast */
+#define PROJECT_LOS 0x8000 /*!< 遠隔攻撃特性: / */
+extern sint project_path(player_type *player_ptr, u16b *gp, POSITION range, POSITION y1, POSITION x1, POSITION y2, POSITION x2, BIT_FLAGS flg);
+
+extern void set_floor(player_type *player_ptr, POSITION x, POSITION y);
+extern void place_object(player_type *owner_ptr, POSITION y, POSITION x, BIT_FLAGS mode);
+extern void place_gold(player_type *player_ptr, POSITION y, POSITION x);
+extern void delete_monster(player_type *player_ptr, POSITION y, POSITION x);
+extern void compact_objects(player_type *owner_ptr, int size);
+extern void vault_traps(player_type *player_ptr, POSITION y, POSITION x, POSITION yd, POSITION xd, int num);
+extern void scatter(player_type *player_ptr, POSITION *yp, POSITION *xp, POSITION y, POSITION x, POSITION d, BIT_FLAGS mode);
+
+extern bool cave_los_bold(floor_type *floor_ptr, POSITION y, POSITION x);