OSDN Git Service

[Refactor] #37353 ソースファイル改名。
[hengband/hengband.git] / src / spells3.c
index 8dc74a2..586a853 100644 (file)
@@ -16,9 +16,6 @@
 /*! テレポート先探索の試行数 / Maximum number of tries for teleporting */
 #define MAX_TRIES 100
 
-/*! 能力値現象の基本確率(1 / HURT_CHANCE) / 1/x chance of reducing stats (for elemental attacks) */
-#define HURT_CHANCE 16
-
 /*!
  * @brief 指定されたマスがモンスターのテレポート可能先かどうかを判定する。
  * @param m_idx モンスターID
@@ -27,7 +24,7 @@
  * @param mode オプション
  * @return テレポート先として妥当ならばtrue
  */
-static bool cave_monster_teleportable_bold(int m_idx, int y, int x, u32b mode)
+static bool cave_monster_teleportable_bold(MONSTER_IDX m_idx, int y, int x, BIT_FLAGS mode)
 {
        monster_type *m_ptr = &m_list[m_idx];
        cave_type    *c_ptr = &cave[y][x];
@@ -63,11 +60,11 @@ static bool cave_monster_teleportable_bold(int m_idx, int y, int x, u32b mode)
  * Attempt to move the monster at least "dis/2" grids away.
  * But allow variation to prevent infinite loops.
  */
-bool teleport_away(idx m_idx, int dis, u32b mode)
+bool teleport_away(MONSTER_IDX m_idx, int dis, BIT_FLAGS mode)
 {
        int oy, ox, d, i, min;
        int tries = 0;
-       position ny = 0, nx = 0;
+       POSITION ny = 0, nx = 0;
 
        bool look = TRUE;
 
@@ -178,7 +175,7 @@ bool teleport_away(idx m_idx, int dis, u32b mode)
  * @param mode オプション
  * @return なし
  */
-void teleport_monster_to(int m_idx, int ty, int tx, int power, u32b mode)
+void teleport_monster_to(MONSTER_IDX m_idx, POSITION ty, POSITION tx, int power, BIT_FLAGS mode)
 {
        int ny, nx, oy, ox, d, i, min;
        int attempts = 500;
@@ -278,7 +275,7 @@ void teleport_monster_to(int m_idx, int ty, int tx, int power, u32b mode)
  * @param mode オプション
  * @return テレポート先として妥当ならばtrue
  */
-bool cave_player_teleportable_bold(int y, int x, u32b mode)
+bool cave_player_teleportable_bold(int y, int x, BIT_FLAGS mode)
 {
        cave_type    *c_ptr = &cave[y][x];
        feature_type *f_ptr = &f_info[c_ptr->feat];
@@ -318,9 +315,6 @@ bool cave_player_teleportable_bold(int y, int x, u32b mode)
 }
 
 
-/*! テレポート最大距離 */
-#define MAX_TELEPORT_DISTANCE 200
-
 /*!
  * @brief プレイヤーのテレポート先選定と移動処理 /
  * Teleport the player to a location up to "dis" grids away.
@@ -344,11 +338,11 @@ bool cave_player_teleportable_bold(int y, int x, u32b mode)
  * </pre>
  */
 
-bool teleport_player_aux(int dis, u32b mode)
+bool teleport_player_aux(int dis, BIT_FLAGS mode)
 {
        int candidates_at[MAX_TELEPORT_DISTANCE + 1];
        int total_candidates, cur_candidates;
-       position y = 0, x = 0;
+       POSITION y = 0, x = 0;
        int min, pick, i;
 
        int left = MAX(1, p_ptr->x - dis);
@@ -461,7 +455,7 @@ bool teleport_player_aux(int dis, u32b mode)
  * @param mode オプション
  * @return なし
  */
-void teleport_player(int dis, u32b mode)
+void teleport_player(int dis, BIT_FLAGS mode)
 {
        int yy, xx;
 
@@ -476,7 +470,7 @@ void teleport_player(int dis, u32b mode)
        {
                for (yy = -1; yy < 2; yy++)
                {
-                       int tmp_m_idx = cave[oy+yy][ox+xx].m_idx;
+                       MONSTER_IDX tmp_m_idx = cave[oy+yy][ox+xx].m_idx;
 
                        /* A monster except your mount may follow */
                        if (tmp_m_idx && (p_ptr->riding != tmp_m_idx))
@@ -505,7 +499,7 @@ void teleport_player(int dis, u32b mode)
  * @param dis テレポート距離
  * @return なし
  */
-void teleport_player_away(int m_idx, int dis)
+void teleport_player_away(MONSTER_IDX m_idx, int dis)
 {
        int yy, xx;
 
@@ -520,7 +514,7 @@ void teleport_player_away(int m_idx, int dis)
        {
                for (yy = -1; yy < 2; yy++)
                {
-                       int tmp_m_idx = cave[oy+yy][ox+xx].m_idx;
+                       IDX tmp_m_idx = cave[oy+yy][ox+xx].m_idx;
 
                        /* A monster except your mount or caster may follow */
                        if (tmp_m_idx && (p_ptr->riding != tmp_m_idx) && (m_idx != tmp_m_idx))
@@ -556,9 +550,9 @@ void teleport_player_away(int m_idx, int dis)
  * This function allows teleporting into vaults (!)
  * </pre>
  */
-void teleport_player_to(position ny, position nx, u32b mode)
+void teleport_player_to(POSITION ny, POSITION nx, BIT_FLAGS mode)
 {
-       position y, x;
+       POSITION y, x;
        int dis = 0, ctr = 0;
 
        if (p_ptr->anti_tele && !(mode & TELEPORT_NONMAGICAL))
@@ -573,8 +567,8 @@ void teleport_player_to(position ny, position nx, u32b mode)
                /* Pick a nearby legal location */
                while (1)
                {
-                       y = (position)rand_spread(ny, dis);
-                       x = (position)rand_spread(nx, dis);
+                       y = (POSITION)rand_spread(ny, dis);
+                       x = (POSITION)rand_spread(nx, dis);
                        if (in_bounds(y, x)) break;
                }
 
@@ -600,7 +594,7 @@ void teleport_player_to(position ny, position nx, u32b mode)
 }
 
 
-void teleport_away_followable(int m_idx)
+void teleport_away_followable(MONSTER_IDX m_idx)
 {
        monster_type *m_ptr = &m_list[m_idx];
        int          oldfy = m_ptr->fy;
@@ -659,7 +653,7 @@ void teleport_away_followable(int m_idx)
  * @param m_idx テレポートの対象となるモンスターID(0ならばプレイヤー) / If m_idx <= 0, target is player.
  * @return なし
  */
-void teleport_level(int m_idx)
+void teleport_level(MONSTER_IDX m_idx)
 {
        bool         go_up;
        char         m_name[160];
@@ -833,17 +827,18 @@ void teleport_level(int m_idx)
 
 
 /*!
- * @brief ã\81\93ã\82\8cã\81¾ã\81§ã\81«å\85¥ã\81£ã\81\9fã\83\80ã\83³ã\82¸ã\83§ã\83³ã\81®ä¸\80覧ã\82\92表示ã\81\99ã\82\8b
+ * @brief ã\81\93ã\82\8cã\81¾ã\81§ã\81«å\85¥ã\81£ã\81\9fã\83\80ã\83³ã\82¸ã\83§ã\83³ã\81®ä¸\80覧ã\82\92表示ã\81\97ã\80\81é\81¸æ\8a\9eã\81\95ã\81\9bã\82\8bã\80\82
  * @param note ダンジョンに施す処理記述
  * @param y コンソールY座標
  * @param x コンソールX座標
- * @return なし
+ * @return 選択されたダンジョンID
  */
-int choose_dungeon(cptr note, int y, int x)
+DUNGEON_IDX choose_dungeon(cptr note, POSITION y, POSITION x)
 {
-       int select_dungeon;
-       int i, num = 0;
-       s16b *dun;
+       DUNGEON_IDX select_dungeon;
+       DUNGEON_IDX i;
+       int num = 0;
+       DUNGEON_IDX *dun;
 
        /* Hack -- No need to choose dungeon in some case */
        if (lite_town || vanilla_town || ironman_downward)
@@ -875,7 +870,7 @@ int choose_dungeon(cptr note, int y, int x)
                else if (max_dlv[i] == d_info[i].maxdepth) seiha = TRUE;
 
                sprintf(buf,_("      %c) %c%-12s : 最大 %d 階", "      %c) %c%-16s : Max level %d"), 
-                                       'a'+num, seiha ? '!' : ' ', d_name + d_info[i].name, max_dlv[i]);
+                                       'a'+num, seiha ? '!' : ' ', d_name + d_info[i].name, (int)max_dlv[i]);
                prt(buf, y + num, x);
                dun[num++] = i;
        }
@@ -919,7 +914,7 @@ int choose_dungeon(cptr note, int y, int x)
  * @param turns 発動までのターン数
  * @return 常にTRUEを返す
  */
-bool recall_player(int turns)
+bool recall_player(TIME_EFFECT turns)
 {
        /*
         * TODO: Recall the player to the last
@@ -947,7 +942,7 @@ bool recall_player(int turns)
        {
                if (!dun_level)
                {
-                       int select_dungeon;
+                       DUNGEON_IDX select_dungeon;
                        select_dungeon = choose_dungeon(_("に帰還", "recall"), 2, 14);
                        if (!select_dungeon) return FALSE;
                        p_ptr->recall_dungeon = select_dungeon;
@@ -995,10 +990,11 @@ bool reset_recall(void)
 
        if (!select_dungeon) return FALSE;
        /* Prompt */
-       sprintf(ppp, _("何階にセットしますか (%d-%d):", "Reset to which level (%d-%d): "), d_info[select_dungeon].mindepth, max_dlv[select_dungeon]);
+       sprintf(ppp, _("何階にセットしますか (%d-%d):", "Reset to which level (%d-%d): "),
+               (int)d_info[select_dungeon].mindepth, (int)max_dlv[select_dungeon]);
 
        /* Default */
-       sprintf(tmp_val, "%d", MAX(dun_level, 1));
+       sprintf(tmp_val, "%d", (int)MAX(dun_level, 1));
 
        /* Ask for a level */
        if (get_string(ppp, tmp_val, 10))
@@ -1040,7 +1036,7 @@ msg_format("%sの帰還レベルを %d 階にセット。", d_name+d_info[select
  * @return 劣化処理に関するメッセージが発せられた場合はTRUEを返す /
  * Return "TRUE" if the player notices anything
  */
-bool apply_disenchant(int mode)
+bool apply_disenchant(BIT_FLAGS mode)
 {
        int             t = 0;
        object_type     *o_ptr;
@@ -1157,7 +1153,7 @@ msg_format("%s(%c)は劣化を跳ね返した!",o_name, index_to_label(t) );
  */
 void mutate_player(void)
 {
-       base_status max1, cur1, max2, cur2;
+       BASE_STATUS max1, cur1, max2, cur2;
        int ii, jj, i;
 
        /* Pick a pair of stats */
@@ -1241,7 +1237,7 @@ void apply_nexus(monster_type *m_ptr)
  */
 void phlogiston(void)
 {
-       int max_flog = 0;
+       GAME_TURN max_flog = 0;
        object_type * o_ptr = &inventory[INVEN_LITE];
 
        /* It's a lamp */
@@ -1270,7 +1266,7 @@ void phlogiston(void)
        }
 
        /* Refuel */
-       o_ptr->xtra4 += (max_flog / 2);
+       o_ptr->xtra4 += (XTRA16)(max_flog / 2);
 
        /* Message */
        msg_print(_("照明用アイテムに燃素を補充した。", "You add phlogiston to your light item."));
@@ -1278,7 +1274,7 @@ void phlogiston(void)
        /* Comment */
        if (o_ptr->xtra4 >= max_flog)
        {
-               o_ptr->xtra4 = max_flog;
+               o_ptr->xtra4 = (XTRA16)max_flog;
                msg_print(_("照明用アイテムは満タンになった。", "Your light item is full."));
        }
 
@@ -1295,7 +1291,7 @@ void phlogiston(void)
  */
 void brand_weapon(int brand_type)
 {
-       int         item;
+       OBJECT_IDX item;
        object_type *o_ptr;
        cptr        q, s;
 
@@ -1346,7 +1342,7 @@ void brand_weapon(int brand_type)
                                act = _("は鋭さを増した!", "becomes very sharp!");
 
                                o_ptr->name2 = EGO_SHARPNESS;
-                               o_ptr->pval = m_bonus(5, dun_level) + 1;
+                               o_ptr->pval = (PARAMETER_VALUE)m_bonus(5, dun_level) + 1;
 
                                if ((o_ptr->sval == SV_HAYABUSA) && (o_ptr->pval > 2))
                                        o_ptr->pval = 2;
@@ -1355,7 +1351,7 @@ void brand_weapon(int brand_type)
                        {
                                act = _("は破壊力を増した!", "seems very powerful.");
                                o_ptr->name2 = EGO_EARTHQUAKES;
-                               o_ptr->pval = m_bonus(3, dun_level);
+                               o_ptr->pval = (PARAMETER_VALUE)m_bonus(3, dun_level);
                        }
                        break;
                case 16:
@@ -1675,12 +1671,13 @@ void call_the_(void)
  * @param require_los 射線の通りを要求するならばTRUE
  * @return なし
  */
-void fetch(int dir, int wgt, bool require_los)
+void fetch(DIRECTION dir, WEIGHT wgt, bool require_los)
 {
-       int             ty, tx, i;
-       cave_type       *c_ptr;
-       object_type     *o_ptr;
-       char            o_name[MAX_NLEN];
+       POSITION ty, tx;
+       OBJECT_IDX i;
+       cave_type *c_ptr;
+       object_type *o_ptr;
+       char o_name[MAX_NLEN];
 
        /* Check to see if an object is already there */
        if (cave[p_ptr->y][p_ptr->x].o_idx)
@@ -1762,6 +1759,7 @@ void fetch(int dir, int wgt, bool require_los)
        i = c_ptr->o_idx;
        c_ptr->o_idx = o_ptr->next_o_idx;
        cave[p_ptr->y][p_ptr->x].o_idx = i; /* 'move' it */
+
        o_ptr->next_o_idx = 0;
        o_ptr->iy = (byte)p_ptr->y;
        o_ptr->ix = (byte)p_ptr->x;
@@ -1788,7 +1786,7 @@ void alter_reality(void)
 
        if (!p_ptr->alter_reality)
        {
-               int turns = randint0(21) + 15;
+               TIME_EFFECT turns = randint0(21) + 15;
 
                p_ptr->alter_reality = turns;
                msg_print(_("回りの景色が変わり始めた...", "The view around you begins to change..."));
@@ -2027,9 +2025,10 @@ int remove_all_curse(void)
  */
 bool alchemy(void)
 {
-       int item, amt = 1;
-       item_number old_number;
-       long price;
+       OBJECT_IDX item;
+       int amt = 1;
+       ITEM_NUMBER old_number;
+       PRICE price;
        bool force = FALSE;
        object_type *o_ptr;
        char o_name[MAX_NLEN];
@@ -2294,9 +2293,9 @@ bool enchant(object_type *o_ptr, int n, int eflag)
  * Note that "num_ac" requires armour, else weapon
  * Returns TRUE if attempted, FALSE if cancelled
  */
-bool enchant_spell(int num_hit, int num_dam, int num_ac)
+bool enchant_spell(HIT_PROB num_hit, HIT_POINT num_dam, ARMOUR_CLASS num_ac)
 {
-       int         item;
+       OBJECT_IDX item;
        bool        okay = FALSE;
        object_type *o_ptr;
        char        o_name[MAX_NLEN];
@@ -2393,7 +2392,7 @@ static bool item_tester_hook_nameless_weapon_armour(object_type *o_ptr)
  */
 bool artifact_scroll(void)
 {
-       int             item;
+       OBJECT_IDX item;
        bool            okay = FALSE;
        object_type     *o_ptr;
        char            o_name[MAX_NLEN];
@@ -2612,7 +2611,7 @@ static bool item_tester_hook_identify_weapon_armour(object_type *o_ptr)
  */
 bool ident_spell(bool only_equip)
 {
-       int             item;
+       OBJECT_IDX item;
        object_type     *o_ptr;
        char            o_name[MAX_NLEN];
        cptr            q, s;
@@ -2698,7 +2697,7 @@ bool ident_spell(bool only_equip)
  */
 bool mundane_spell(bool only_equip)
 {
-       int             item;
+       OBJECT_IDX item;
        object_type     *o_ptr;
        cptr            q, s;
 
@@ -2726,8 +2725,8 @@ bool mundane_spell(bool only_equip)
        /* Oops */
        msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
        {
-               byte iy = o_ptr->iy;                 /* Y-position on map, or zero */
-               byte ix = o_ptr->ix;                 /* X-position on map, or zero */
+               POSITION iy = o_ptr->iy;                 /* Y-position on map, or zero */
+               POSITION ix = o_ptr->ix;                 /* X-position on map, or zero */
                s16b next_o_idx = o_ptr->next_o_idx; /* Next object in stack (if any) */
                byte marked = o_ptr->marked;         /* Object is marked */
                s16b weight = o_ptr->number * o_ptr->weight;
@@ -2782,7 +2781,7 @@ static bool item_tester_hook_identify_fully_weapon_armour(object_type *o_ptr)
  */
 bool identify_fully(bool only_equip)
 {
-       int             item;
+       OBJECT_IDX item;
        object_type     *o_ptr;
        char            o_name[MAX_NLEN];
        cptr            q, s;
@@ -2906,8 +2905,10 @@ bool item_tester_hook_recharge(object_type *o_ptr)
  */
 bool recharge(int power)
 {
-       int item, lev;
-       int recharge_strength, recharge_amount;
+       OBJECT_IDX item;
+       int lev;
+       int recharge_strength;
+       TIME_EFFECT recharge_amount;
 
        object_type *o_ptr;
        object_kind *k_ptr;
@@ -3019,7 +3020,7 @@ bool recharge(int power)
                         */
                        if ((o_ptr->tval == TV_STAFF) && (o_ptr->number > 1))
                        {
-                               recharge_amount /= o_ptr->number;
+                               recharge_amount /= (TIME_EFFECT)o_ptr->number;
                                if (recharge_amount < 1) recharge_amount = 1;
                        }
 
@@ -3199,9 +3200,9 @@ bool recharge(int power)
  */
 bool bless_weapon(void)
 {
-       int             item;
+       OBJECT_IDX item;
        object_type     *o_ptr;
-       u32b flgs[TR_FLAG_SIZE];
+       BIT_FLAGS flgs[TR_FLAG_SIZE];
        char            o_name[MAX_NLEN];
        cptr            q, s;
 
@@ -3383,7 +3384,7 @@ msg_format("%s は劣化した!",
  */
 bool pulish_shield(void)
 {
-       int             item;
+       OBJECT_IDX item;
        object_type     *o_ptr;
        u32b flgs[TR_FLAG_SIZE];
        char            o_name[MAX_NLEN];
@@ -3477,7 +3478,7 @@ msg_format("%sは輝いた!", o_name);
  *    o_ptr --- pointer to the potion object.
  * </pre>
  */
-bool potion_smash_effect(int who, int y, int x, int k_idx)
+bool potion_smash_effect(MONSTER_IDX who, POSITION y, POSITION x, KIND_OBJECT_IDX k_idx)
 {
        int     radius = 2;
        int     dt = 0;
@@ -3903,7 +3904,7 @@ int mod_need_mana(int need_mana, int spell, int realm)
  * @return 失敗率(%)
  * @todo 統合を検討
  */
-int mod_spell_chance_1(int chance)
+PERCENTAGE mod_spell_chance_1(PERCENTAGE chance)
 {
        chance += p_ptr->to_m_chance;
 
@@ -3928,7 +3929,7 @@ int mod_spell_chance_1(int chance)
  * Note: variable "chance" cannot be negative.
  * @todo 統合を検討
  */
-int mod_spell_chance_2(int chance)
+PERCENTAGE mod_spell_chance_2(PERCENTAGE chance)
 {
        if (p_ptr->dec_mana) chance--;
 
@@ -3945,12 +3946,12 @@ int mod_spell_chance_2(int chance)
  * @param use_realm 魔法領域ID
  * @return 失敗率(%)
  */
-s16b spell_chance(int spell, int use_realm)
+PERCENTAGE spell_chance(SPELL_IDX spell, REALM_IDX use_realm)
 {
-       int             chance, minfail;
+       PERCENTAGE chance, minfail;
        const magic_type *s_ptr;
-       int             need_mana;
-       int penalty = (mp_ptr->spell_stat == A_WIS) ? 10 : 4;
+       MANA_POINT need_mana;
+       PERCENTAGE penalty = (mp_ptr->spell_stat == A_WIS) ? 10 : 4;
 
 
        /* Paranoia -- must be literate */
@@ -4104,15 +4105,15 @@ bool spell_okay(int spell, bool learned, bool study_pray, int use_realm)
 /*!
  * @brief 呪文情報の表示処理 /
  * Print a list of spells (for browsing or casting or viewing)
- * @param target_spell 呪文ID
- * @param spells アクセス開始するスペルの参照ポイント
- * @param num 表示する
+ * @param target_spell 呪文ID                    
+ * @param spells 表示するスペルID配列の参照ポインタ
+ * @param num 表示するスペルの数(spellsの要素数)
  * @param y 表示メッセージ左上Y座標
  * @param x 表示メッセージ左上X座標
  * @param use_realm 魔法領域ID
  * @return なし
  */
-void print_spells(int target_spell, byte *spells, int num, int y, int x, int use_realm)
+void print_spells(SPELL_IDX target_spell, SPELL_IDX *spells, int num, TERM_POSITION y, TERM_POSITION x, REALM_IDX use_realm)
 {
        int             i, spell, exp_level, increment = 64;
        const magic_type *s_ptr;
@@ -4680,7 +4681,7 @@ static int minus_ac(void)
  * @param aura オーラよるダメージが原因ならばTRUE
  * @return 修正HPダメージ量
  */
-int acid_dam(int dam, cptr kb_str, int monspell, bool aura)
+int acid_dam(HIT_POINT dam, cptr kb_str, int monspell, bool aura)
 {
        int get_damage;  
        int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3;
@@ -4730,7 +4731,7 @@ int acid_dam(int dam, cptr kb_str, int monspell, bool aura)
  * @param aura オーラよるダメージが原因ならばTRUE
  * @return 修正HPダメージ量
  */
-int elec_dam(int dam, cptr kb_str, int monspell, bool aura)
+int elec_dam(HIT_POINT dam, cptr kb_str, int monspell, bool aura)
 {
        int get_damage;  
        int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3;
@@ -4779,7 +4780,7 @@ int elec_dam(int dam, cptr kb_str, int monspell, bool aura)
  * @param aura オーラよるダメージが原因ならばTRUE
  * @return 修正HPダメージ量
  */
-int fire_dam(int dam, cptr kb_str, int monspell, bool aura)
+int fire_dam(HIT_POINT dam, cptr kb_str, int monspell, bool aura)
 {
        int get_damage;  
        int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3;
@@ -4828,7 +4829,7 @@ int fire_dam(int dam, cptr kb_str, int monspell, bool aura)
  * @param aura オーラよるダメージが原因ならばTRUE
  * @return 修正HPダメージ量
  */
-int cold_dam(int dam, cptr kb_str, int monspell, bool aura)
+int cold_dam(HIT_POINT dam, cptr kb_str, int monspell, bool aura)
 {
        int get_damage;  
        int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3;
@@ -4872,7 +4873,7 @@ int cold_dam(int dam, cptr kb_str, int monspell, bool aura)
  */
 bool rustproof(void)
 {
-       int         item;
+       OBJECT_IDX item;
        object_type *o_ptr;
        char        o_name[MAX_NLEN];
        cptr        q, s;
@@ -5153,11 +5154,13 @@ bool brand_bolts(void)
  * @details
  * Note that this function is one of the more "dangerous" ones...
  */
-static s16b poly_r_idx(int r_idx)
+static IDX poly_r_idx(MONRACE_IDX r_idx)
 {
        monster_race *r_ptr = &r_info[r_idx];
 
-       int i, r, lev1, lev2;
+       int i;
+       MONRACE_IDX r;
+       DEPTH lev1, lev2;
 
        /* Hack -- Uniques/Questors never polymorph */
        if ((r_ptr->flags1 & RF1_UNIQUE) ||
@@ -5204,13 +5207,13 @@ static s16b poly_r_idx(int r_idx)
  * @param x 指定のX座標
  * @return 実際に変身したらTRUEを返す
  */
-bool polymorph_monster(int y, int x)
+bool polymorph_monster(POSITION y, POSITION x)
 {
        cave_type *c_ptr = &cave[y][x];
        monster_type *m_ptr = &m_list[c_ptr->m_idx];
        bool polymorphed = FALSE;
-       int new_r_idx;
-       int old_r_idx = m_ptr->r_idx;
+       MONRACE_IDX new_r_idx;
+       MONRACE_IDX old_r_idx = m_ptr->r_idx;
        bool targeted = (target_who == c_ptr->m_idx) ? TRUE : FALSE;
        bool health_tracked = (p_ptr->health_who == c_ptr->m_idx) ? TRUE : FALSE;
        monster_type back_m;
@@ -5228,7 +5231,7 @@ bool polymorph_monster(int y, int x)
        /* Handle polymorph */
        if (new_r_idx != old_r_idx)
        {
-               u32b mode = 0L;
+               BIT_FLAGS mode = 0L;
                bool preserve_hold_objects = back_m.hold_o_idx ? TRUE : FALSE;
                s16b this_o_idx, next_o_idx = 0;
 
@@ -5308,9 +5311,9 @@ bool polymorph_monster(int y, int x)
  * @param y テレポート先のY座標
  * @return 目標に指定通りテレポートできたならばTRUEを返す
  */
-static bool dimension_door_aux(int x, int y)
+static bool dimension_door_aux(DEPTH x, DEPTH y)
 {
-       int     plev = p_ptr->lev;
+       PLAYER_LEVEL plev = p_ptr->lev;
 
        p_ptr->energy_need += (s16b)((s32b)(60 - plev) * ENERGY_NEED() / 100L);
 
@@ -5341,7 +5344,7 @@ static bool dimension_door_aux(int x, int y)
  */
 bool dimension_door(void)
 {
-       int x = 0, y = 0;
+       DEPTH x = 0, y = 0;
 
        /* Rerutn FALSE if cancelled */
        if (!tgt_pt(&x, &y)) return FALSE;
@@ -5361,7 +5364,7 @@ bool dimension_door(void)
  */
 bool mirror_tunnel(void)
 {
-       int x = 0, y = 0;
+       POSITION x = 0, y = 0;
 
        /* Rerutn FALSE if cancelled */
        if (!tgt_pt(&x, &y)) return FALSE;
@@ -5382,7 +5385,8 @@ bool eat_magic(int power)
 {
        object_type * o_ptr;
        object_kind *k_ptr;
-       int lev, item;
+       int lev;
+       OBJECT_IDX item;
        int recharge_strength = 0;
 
        bool fail = FALSE;
@@ -5659,7 +5663,7 @@ bool eat_magic(int power)
  * @param mode 召喚オプション
  * @return ターンを消費した場合TRUEを返す
  */
-bool summon_kin_player(int level, int y, int x, u32b mode)
+bool summon_kin_player(int level, int y, int x, BIT_FLAGS mode)
 {
        bool pet = (bool)(mode & PM_FORCE_PET);
        if (!pet) mode |= PM_NO_PET;