OSDN Git Service

[Refactor] #38995 world_type 構造体に starttime を start_time に改名して取り込む。 / Move starttime...
[hengband/hengband.git] / src / types.h
index adeb549..c813f94 100644 (file)
@@ -37,7 +37,7 @@
  *
  * Certain data is saved in multiple places for efficient access, currently,
  * this includes the tval/sval/weight fields in "object_type", various fields
- * in "header_type", and the "m_idx" and "o_idx" fields in "cave_type".  All
+ * in "header_type", and the "m_idx" and "o_idx" fields in "grid_type".  All
  * of these could be removed, but this would, in general, slow down the game
  * and increase the complexity of the code.
  * </pre>
@@ -427,20 +427,20 @@ struct skill_table
 /*
  * A single "grid" in a Cave
  *
- * Note that several aspects of the code restrict the actual cave
+ * Note that several aspects of the code restrict the actual current_floor_ptr->grid_array
  * to a max size of 256 by 256.  In partcular, locations are often
  * saved as bytes, limiting each coordinate to the 0-255 range.
  *
  * The "o_idx" and "m_idx" fields are very interesting.  There are
  * many places in the code where we need quick access to the actual
- * monster or object(s) in a given cave grid.  The easiest way to
+ * monster or object(s) in a given grid.  The easiest way to
  * do this is to simply keep the index of the monster and object
  * (if any) with the grid, but this takes 198*66*4 bytes of memory.
  * Several other methods come to mind, which require only half this
  * amound of memory, but they all seem rather complicated, and would
  * probably add enough code that the savings would be lost.  So for
  * these reasons, we simply store an index into the "o_list" and
- * "m_list" arrays, using "zero" when no monster/object is present.
+ * "current_floor_ptr->m_list" arrays, using "zero" when no monster/object is present.
  *
  * Note that "o_idx" is the index of the top object in a stack of
  * objects, using the "next_o_idx" field of objects (see below) to
@@ -450,17 +450,17 @@ struct skill_table
  * Note the special fields for the "MONSTER_FLOW" code.
  */
 
-typedef struct cave_type cave_type;
+typedef struct grid_type grid_type;
 
-struct cave_type
+struct grid_type
 {
-       BIT_FLAGS info;         /* Hack -- cave flags */
+       BIT_FLAGS info;         /* Hack -- current_floor_ptr->grid_array flags */
 
        FEAT_IDX feat;          /* Hack -- feature type */
        OBJECT_IDX o_idx;               /* Object in this grid */
        MONSTER_IDX m_idx;              /* Monster in this grid */
 
-       /*! 地形の特別な情報を保存する / Special cave info
+       /*! 地形の特別な情報を保存する / Special current_floor_ptr->grid_array info
         * 具体的な使用一覧はクエスト行き階段の移行先クエストID、
         * 各ダンジョン入口の移行先ダンジョンID、
         * 
@@ -503,7 +503,7 @@ struct coord
  * Note that "object flags" must now be derived from the object kind,
  * the artifact and ego-item indexes, and the two "xtra" fields.
  *
- * Each cave grid points to one (or zero) objects via the "o_idx"
+ * Each grid points to one (or zero) objects via the "o_idx"
  * field (above).  Each object then points to one (or zero) objects
  * via the "next_o_idx" field, forming a singly linked list, which
  * in game terms, represents a "stack" of objects in the same grid.
@@ -620,7 +620,40 @@ struct monster_type
 
        EXP exp;
 
-       BIT_FLAGS smart;                        /* Field for "smart_learn" */
+       /* TODO: クローン、ペット、有効化は意義が異なるので別変数に切り離すこと。save/loadのバージョン更新が面倒そうだけど */
+       BIT_FLAGS smart; /*!< Field for "smart_learn" - Some bit-flags for the "smart" field */
+       #define SM_RES_ACID             0x00000001 /*!< モンスターの学習フラグ: プレイヤーに酸耐性あり */
+       #define SM_RES_ELEC             0x00000002 /*!< モンスターの学習フラグ: プレイヤーに電撃耐性あり */
+       #define SM_RES_FIRE             0x00000004 /*!< モンスターの学習フラグ: プレイヤーに火炎耐性あり */
+       #define SM_RES_COLD             0x00000008 /*!< モンスターの学習フラグ: プレイヤーに冷気耐性あり */
+       #define SM_RES_POIS             0x00000010 /*!< モンスターの学習フラグ: プレイヤーに毒耐性あり */
+       #define SM_RES_NETH             0x00000020 /*!< モンスターの学習フラグ: プレイヤーに地獄耐性あり */
+       #define SM_RES_LITE             0x00000040 /*!< モンスターの学習フラグ: プレイヤーに閃光耐性あり */
+       #define SM_RES_DARK             0x00000080 /*!< モンスターの学習フラグ: プレイヤーに暗黒耐性あり */
+       #define SM_RES_FEAR             0x00000100 /*!< モンスターの学習フラグ: プレイヤーに恐怖耐性あり */
+       #define SM_RES_CONF             0x00000200 /*!< モンスターの学習フラグ: プレイヤーに混乱耐性あり */
+       #define SM_RES_CHAOS            0x00000400 /*!< モンスターの学習フラグ: プレイヤーにカオス耐性あり */
+       #define SM_RES_DISEN            0x00000800 /*!< モンスターの学習フラグ: プレイヤーに劣化耐性あり */
+       #define SM_RES_BLIND            0x00001000 /*!< モンスターの学習フラグ: プレイヤーに盲目耐性あり */
+       #define SM_RES_NEXUS            0x00002000 /*!< モンスターの学習フラグ: プレイヤーに因果混乱耐性あり */
+       #define SM_RES_SOUND            0x00004000 /*!< モンスターの学習フラグ: プレイヤーに轟音耐性あり */
+       #define SM_RES_SHARD            0x00008000 /*!< モンスターの学習フラグ: プレイヤーに破片耐性あり */
+       #define SM_OPP_ACID             0x00010000 /*!< モンスターの学習フラグ: プレイヤーに二重酸耐性あり */
+       #define SM_OPP_ELEC             0x00020000 /*!< モンスターの学習フラグ: プレイヤーに二重電撃耐性あり */
+       #define SM_OPP_FIRE             0x00040000 /*!< モンスターの学習フラグ: プレイヤーに二重火炎耐性あり */
+       #define SM_OPP_COLD             0x00080000 /*!< モンスターの学習フラグ: プレイヤーに二重冷気耐性あり */
+       #define SM_OPP_POIS             0x00100000 /*!< モンスターの学習フラグ: プレイヤーに二重毒耐性あり */
+       #define SM_OPP_XXX1             0x00200000 /*!< 未使用 / (unused) */
+       #define SM_CLONED               0x00400000 /*!< クローンである / Cloned */
+       #define SM_PET                  0x00800000 /*!< ペットである / Pet */
+       #define SM_IMM_ACID             0x01000000 /*!< モンスターの学習フラグ: プレイヤーに酸免疫あり */
+       #define SM_IMM_ELEC             0x02000000 /*!< モンスターの学習フラグ: プレイヤーに電撃免疫あり */
+       #define SM_IMM_FIRE             0x04000000 /*!< モンスターの学習フラグ: プレイヤーに火炎免疫あり */
+       #define SM_IMM_COLD             0x08000000 /*!< モンスターの学習フラグ: プレイヤーに冷気免疫あり */
+       #define SM_FRIENDLY             0x10000000 /*!< 友好的である / Friendly */
+       #define SM_IMM_REFLECT          0x20000000 /*!< モンスターの学習フラグ: プレイヤーに反射あり */
+       #define SM_IMM_FREE             0x40000000 /*!< モンスターの学習フラグ: プレイヤーに麻痺耐性あり */
+       #define SM_IMM_MANA             0x80000000 /*!< モンスターの学習フラグ: プレイヤーにMPがない */
 
        MONSTER_IDX parent_m_idx;
 };
@@ -753,9 +786,9 @@ struct store_type
        s16b good_buy;                  /* Number of "good" buys */
        s16b bad_buy;                   /* Number of "bad" buys */
 
-       s32b store_open;                /* Closed until this turn */
+       s32b store_open;                /* Closed until this current_world_ptr->game_turn */
 
-       s32b last_visit;                /* Last visited on this turn */
+       s32b last_visit;                /* Last visited on this current_world_ptr->game_turn */
 
        s16b table_num;                 /* Table -- Number of entries */
        s16b table_size;                /* Table -- Total Size of Array */
@@ -987,12 +1020,13 @@ struct player_type
 
        PLAYER_LEVEL lev;                       /* Level */
 
-       s16b town_num;                  /* Current town number */
+       TOWN_IDX town_num;                      /* Current town number */
        s16b arena_number;              /* monster number in arena -KMW- */
        bool inside_arena;              /* Is character inside arena? */
        QUEST_IDX inside_quest;         /* Inside quest level */
        bool inside_battle;             /* Is character inside tougijou? */
 
+       DUNGEON_IDX dungeon_idx; /* current dungeon index */
        POSITION wilderness_x;  /* Coordinates in the wilderness */
        POSITION wilderness_y;
        bool wild_mode;
@@ -1000,6 +1034,7 @@ struct player_type
        HIT_POINT mhp;                  /* Max hit pts */
        HIT_POINT chp;                  /* Cur hit pts */
        u32b chp_frac;          /* Cur hit frac (times 2^16) */
+       PERCENTAGE mutant_regenerate_mod;
 
        MANA_POINT msp;                 /* Max mana pts */
        MANA_POINT csp;                 /* Cur mana pts */
@@ -1071,6 +1106,9 @@ struct player_type
        TIME_EFFECT multishadow;       /* Timed -- Multi-shadow */
        TIME_EFFECT dustrobe;          /* Timed -- Robe of dust */
 
+       bool timewalk;
+
+
        PATRON_IDX chaos_patron;
 
        BIT_FLAGS muta1; /*!< レイシャル型の変異 / "Activatable" mutations must be in MUT1_* */        
@@ -1224,6 +1262,7 @@ struct player_type
 
        bool wait_report_score;   /* Waiting to report score */
        bool is_dead;             /* Player is dead */
+       bool now_damaged;
 
        bool wizard;              /* Player is in wizard mode */
 
@@ -1247,7 +1286,7 @@ struct player_type
        bool autopick_autoregister; /* auto register is in-use or not */
 
        byte feeling;           /* Most recent dungeon feeling */
-       s32b feeling_turn;      /* The turn of the last dungeon feeling */
+       s32b feeling_turn;      /* The current_world_ptr->game_turn of the last dungeon feeling */
 
 
        /*** Temporary fields ***/
@@ -1465,7 +1504,7 @@ struct player_type
 
        byte pspeed;            /* Current speed */
 
-       ENERGY energy_use;      /* Energy use this turn */
+       ENERGY energy_use;      /* Energy use this current_world_ptr->game_turn */
 
        POSITION y;     /* Player location in dungeon */
        POSITION x;     /* Player location in dungeon */
@@ -1514,31 +1553,31 @@ typedef struct martial_arts martial_arts;
 
 struct martial_arts
 {
-       concptr    desc;       /* A verbose attack description */
-       int     min_level;  /* Minimum level to use */
-       int     chance;     /* Chance of 'success' */
-       int     dd;         /* Damage dice */
-       int     ds;         /* Damage sides */
-       int     effect;     /* Special effects */
+       concptr desc;       /* A verbose attack description */
+       PLAYER_LEVEL min_level;  /* Minimum level to use */
+       int chance;     /* Chance of 'success' */
+       int dd;         /* Damage dice */
+       int ds;         /* Damage sides */
+       int effect;     /* Special effects */
 };
 
 typedef struct kamae kamae;
 
 struct kamae
 {
-       concptr    desc;       /* A verbose kamae description */
-       int     min_level;  /* Minimum level to use */
-       concptr    info;
+       concptr desc;       /* A verbose kamae description */
+       PLAYER_LEVEL min_level;  /* Minimum level to use */
+       concptr info;
 };
 
 /* Mindcrafters */
 typedef struct mind_type mind_type;
 struct mind_type
 {
-       int     min_lev;
-       int     mana_cost;
-       int     fail;
-       concptr    name;
+       PLAYER_LEVEL min_lev;
+       MANA_POINT mana_cost;
+       PERCENTAGE fail;
+       concptr name;
 };
 
 typedef struct mind_power mind_power;
@@ -1572,7 +1611,7 @@ struct building_type
 {
        GAME_TEXT name[20];                  /* proprietor name */
        GAME_TEXT owner_name[20];            /* proprietor name */
-       char owner_race[20];            /* proprietor race */
+       GAME_TEXT owner_race[20];            /* proprietor race */
 
        GAME_TEXT act_names[8][30];          /* action names */
        PRICE member_costs[8];           /* Costs for class members of building */
@@ -1610,7 +1649,7 @@ typedef struct wilderness_type wilderness_type;
 struct wilderness_type
 {
        int terrain;
-       int town;
+       TOWN_IDX town;
        int road;
        u32b seed;
        DEPTH level;
@@ -1631,15 +1670,6 @@ struct town_type
        byte numstores;
 };
 
-/* Dungeons */
-typedef struct dun_type dun_type;
-struct dun_type
-{
-       DEPTH min_level; /* Minimum level in the dungeon */
-       DEPTH max_level; /* Maximum dungeon level allowed */
-       concptr name;      /* The name of the dungeon */
-};
-
 /*
  * Sort-array element
  */
@@ -1705,8 +1735,8 @@ feat_prob;
 
 
 /* A structure for the != dungeon types */
-typedef struct dungeon_info_type dungeon_info_type;
-struct dungeon_info_type {
+typedef struct dungeon_type dungeon_type;
+struct dungeon_type {
 
        STR_OFFSET name; /* Name */
        STR_OFFSET text; /* Description */
@@ -1813,19 +1843,6 @@ typedef struct
 } arena_type;
 
 
-/*
- * A structure type for doors
- */
-typedef struct
-{
-       FEAT_IDX open;
-       FEAT_IDX broken;
-       FEAT_IDX closed;
-       FEAT_IDX locked[MAX_LJ_DOORS];
-       FEAT_IDX num_locked;
-       FEAT_IDX jammed[MAX_LJ_DOORS];
-       FEAT_IDX num_jammed;
-} door_type;
 
 
 #ifdef TRAVEL
@@ -1858,3 +1875,56 @@ typedef struct {
        int type;
        concptr name;
 } dragonbreath_type;
+
+typedef struct {
+       grid_type *grid_array[MAX_HGT];
+       DEPTH dun_level;                /*!< 現在の実ダンジョン階層base_levelの参照元となる / Current dungeon level */
+       DEPTH base_level;               /*!< 基本生成レベル、後述のobject_level, monster_levelの参照元となる / Base dungeon level */
+       DEPTH object_level;             /*!< アイテムの生成レベル、current_floor_ptr->base_levelを起点に一時変更する時に参照 / Current object creation level */
+       DEPTH monster_level;    /*!< モンスターの生成レベル、current_floor_ptr->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_floor_ptr->max_o_idx] */
+       OBJECT_IDX max_o_idx; /*!< Maximum number of objects in the level */
+
+       monster_type *m_list; /*!< The array of dungeon monsters [current_floor_ptr->max_m_idx] */
+       MONSTER_IDX max_m_idx; /*!< Maximum number of monsters in the level */
+
+       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 "current_floor_ptr->grid_array.c")
+       POSITION lite_y[LITE_MAX];
+       POSITION lite_x[LITE_MAX];
+
+       POSITION_IDX mon_lite_n; //!< Array of grids lit by player lite (see "current_floor_ptr->grid_array.c")
+       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 view_y[VIEW_MAX];
+       POSITION view_x[VIEW_MAX];
+
+       POSITION_IDX redraw_n; //!< Array of grids for delayed visual updating (see "current_floor_ptr->grid_array.c")
+       POSITION redraw_y[REDRAW_MAX];
+       POSITION redraw_x[REDRAW_MAX];
+
+} floor_type;
+
+typedef struct {
+       POSITION max_wild_x; /*!< Maximum size of the wilderness */
+       POSITION max_wild_y; /*!< Maximum size of the wilderness */
+       GAME_TURN game_turn;                    /*!< 画面表示上のゲーム時間基準となるターン / Current game turn */
+       GAME_TURN game_turn_limit;              /*!< game_turnの最大値 / Limit of game_turn */
+       GAME_TURN dungeon_turn;                 /*!< NASTY生成の計算に関わる内部ターン値 / Game current_world_ptr->game_turn in dungeon */
+       GAME_TURN dungeon_turn_limit;   /*!< dungeon_turnの最大値 / Limit of game_turn in dungeon */
+       MONSTER_IDX timewalk_m_idx;     /*!< 現在時間停止を行っているモンスターのID */
+
+       MONRACE_IDX bounty_r_idx[MAX_KUBI];
+
+       u32b play_time; /*!< 実プレイ時間 */
+} world_type;