OSDN Git Service

[Refactor] #37353 型の置換(C_MAKE)。 / Type replacement(C_MAKE).
[hengband/hengband.git] / src / cmd1.c
index 0d8bf9c..6fe3d66 100644 (file)
  * </pre>
  */
 
-
 #include "angband.h"
+#include "melee.h"
 #include "trap.h"
 
 
-/*!
- * @brief プレイヤーからモンスターへの射撃命中判定 /
- * Determine if the player "hits" a monster (normal combat).
- * @param chance 基本命中値
- * @param m_ptr モンスターの構造体参照ポインタ
- * @param vis 目標を視界に捕らえているならばTRUEを指定
- * @param o_name メッセージ表示時のモンスター名
- * @return 命中と判定された場合TRUEを返す
- * @note Always miss 5%, always hit 5%, otherwise random.
- */
-bool test_hit_fire(int chance, monster_type *m_ptr, int vis, char* o_name)
-{
-       int k, ac;
-       monster_race *r_ptr = &r_info[m_ptr->r_idx];
-
-       /* Percentile dice */
-       k = randint1(100);
-       
-       /* Snipers with high-concentration reduce instant miss percentage.*/
-       k += p_ptr->concent;
-       
-       /* Hack -- Instant miss or hit */
-       if (k <= 5) return (FALSE);
-       if (k > 95) return (TRUE);
-
-       if (p_ptr->pseikaku == SEIKAKU_NAMAKE)
-               if (one_in_(20)) return (FALSE);
-
-       /* Never hit */
-       if (chance <= 0) return (FALSE);
-
-       ac = r_ptr->ac;
-       if (p_ptr->concent)
-       {
-               ac *= (8 - p_ptr->concent);
-               ac /= 8;
-       }
-
-       if(m_ptr->r_idx == MON_GOEMON && !MON_CSLEEP(m_ptr)) ac *= 3;
-
-       /* Invisible monsters are harder to hit */
-       if (!vis) chance = (chance + 1) / 2;
-
-       /* Power competes against armor */
-       if (randint0(chance) < (ac * 3 / 4))
-       {
-               if(m_ptr->r_idx == MON_GOEMON && !MON_CSLEEP(m_ptr))
-               {
-                       char m_name[80];
-                       
-                       /* Extract monster name */
-                       monster_desc(m_name, m_ptr, 0);
-                       msg_format(_("%sは%sを斬り捨てた!", "%s cuts down %s!"), m_name, o_name);
-               }
-               return (FALSE);
-       }
-
-       /* Assume hit */
-       return (TRUE);
-}
-
-
-
-
-/*!
- * @brief プレイヤーからモンスターへの射撃クリティカル判定 /
- * Critical hits (from objects thrown by player) Factor in item weight, total plusses, and player level.
- * @param weight 矢弾の重量
- * @param plus_ammo 矢弾の命中修正
- * @param plus_bow 弓の命中修正
- * @param dam 現在算出中のダメージ値
- * @return クリティカル修正が入ったダメージ値
- */
-HIT_POINT critical_shot(int weight, int plus_ammo, int plus_bow, HIT_POINT dam)
-{
-       int i, k;
-       object_type *j_ptr =  &inventory[INVEN_BOW];
-       
-       /* Extract "shot" power */
-       i = p_ptr->to_h_b + plus_ammo;
-       
-       if (p_ptr->tval_ammo == TV_BOLT)
-               i = (p_ptr->skill_thb + (p_ptr->weapon_exp[0][j_ptr->sval] / 400 + i) * BTH_PLUS_ADJ);
-       else
-               i = (p_ptr->skill_thb + ((p_ptr->weapon_exp[0][j_ptr->sval] - (WEAPON_EXP_MASTER / 2)) / 200 + i) * BTH_PLUS_ADJ);
-
-       
-       /* Snipers can shot more critically with crossbows */
-       if (p_ptr->concent) i += ((i * p_ptr->concent) / 5);
-       if ((p_ptr->pclass == CLASS_SNIPER) && (p_ptr->tval_ammo == TV_BOLT)) i *= 2;
-       
-       /* Good bow makes more critical */
-       i += plus_bow * 8 * (p_ptr->concent ? p_ptr->concent + 5 : 5);
-       
-       /* Critical hit */
-       if (randint1(10000) <= i)
-       {
-               k = weight * randint1(500);
-
-               if (k < 900)
-               {
-                       msg_print(_("手ごたえがあった!", "It was a good hit!"));
-                       dam += (dam / 2);
-               }
-               else if (k < 1350)
-               {
-                       msg_print(_("かなりの手ごたえがあった!", "It was a great hit!"));
-                       dam *= 2;
-               }
-               else
-               {
-                       msg_print(_("会心の一撃だ!", "It was a superb hit!"));
-                       dam *= 3;
-               }
-       }
-
-       return (dam);
-}
-
-
-
-
 
 /*!
  * @brief プレイヤー攻撃の種族スレイング倍率計算
@@ -402,13 +280,11 @@ static MULTIPLY mult_brand(MULTIPLY mult, const BIT_FLAGS* flgs, const monster_t
  * Note that most brands and slays are x3, except Slay Animal (x2),\n
  * Slay Evil (x2), and Kill dragon (x5).\n
  */
-s16b tot_dam_aux(object_type *o_ptr, int tdam, monster_type *m_ptr, BIT_FLAGS mode, bool thrown)
+HIT_POINT tot_dam_aux(object_type *o_ptr, HIT_POINT tdam, monster_type *m_ptr, BIT_FLAGS mode, bool thrown)
 {
        MULTIPLY mult = 10;
 
        BIT_FLAGS flgs[TR_FLAG_SIZE];
-
-       /* Extract the flags */
        object_flags(o_ptr, flgs);
        torch_flags(o_ptr, flgs); /* torches has secret flags */
 
@@ -481,8 +357,6 @@ static void discover_hidden_things(POSITION y, POSITION x)
 {
        OBJECT_IDX this_o_idx, next_o_idx = 0;
        cave_type *c_ptr;
-
-       /* Access the grid */
        c_ptr = &cave[y][x];
 
        /* Invisible trap */
@@ -491,32 +365,26 @@ static void discover_hidden_things(POSITION y, POSITION x)
                /* Pick a trap */
                disclose_grid(y, x);
 
-               /* Message */
                msg_print(_("トラップを発見した。", "You have found a trap."));
 
-               /* Disturb */
-               disturb(0, 1);
+               disturb(FALSE, TRUE);
        }
 
        /* Secret door */
        if (is_hidden_door(c_ptr))
        {
-               /* Message */
                msg_print(_("隠しドアを発見した。", "You have found a secret door."));
 
                /* Disclose */
                disclose_grid(y, x);
 
-               /* Disturb */
-               disturb(0, 0);
+               disturb(FALSE, FALSE);
        }
 
        /* Scan all objects in the grid */
        for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
        {
                object_type *o_ptr;
-
-               /* Acquire object */
                o_ptr = &o_list[this_o_idx];
 
                /* Acquire next object */
@@ -531,14 +399,13 @@ static void discover_hidden_things(POSITION y, POSITION x)
                /* Identify once */
                if (!object_is_known(o_ptr))
                {
-                       /* Message */
                        msg_print(_("箱に仕掛けられたトラップを発見した!", "You have discovered a trap on the chest!"));
 
                        /* Know the trap */
                        object_known(o_ptr);
 
                        /* Notice it */
-                       disturb(0, 0);
+                       disturb(FALSE, FALSE);
                }
        }
 }
@@ -585,17 +452,17 @@ void search(void)
  * Add the given dungeon object to the character's inventory.\n
  * Delete the object afterwards.\n
  */
-void py_pickup_aux(int o_idx)
+void py_pickup_aux(OBJECT_IDX o_idx)
 {
-       int slot;
+       INVENTORY_IDX slot;
 
 #ifdef JP
-       char o_name[MAX_NLEN];
-       char old_name[MAX_NLEN];
+       GAME_TEXT o_name[MAX_NLEN];
+       GAME_TEXT old_name[MAX_NLEN];
        char kazu_str[80];
        int hirottakazu;
 #else
-       char o_name[MAX_NLEN];
+       GAME_TEXT o_name[MAX_NLEN];
 #endif
 
        object_type *o_ptr;
@@ -603,7 +470,6 @@ void py_pickup_aux(int o_idx)
        o_ptr = &o_list[o_idx];
 
 #ifdef JP
-       /* Describe the object */
        object_desc(old_name, o_ptr, OD_NAME_ONLY);
        object_desc_kosuu(kazu_str, o_ptr);
        hirottakazu = o_ptr->number;
@@ -614,7 +480,6 @@ void py_pickup_aux(int o_idx)
        /* Get the object again */
        o_ptr = &inventory[slot];
 
-       /* Delete the object */
        delete_object_idx(o_idx);
 
        if (p_ptr->pseikaku == SEIKAKU_MUNCHKIN)
@@ -628,10 +493,8 @@ void py_pickup_aux(int o_idx)
                if (o_ptr->marked & OM_AUTODESTROY) return;
        }
 
-       /* Describe the object */
        object_desc(o_name, o_ptr, 0);
 
-       /* Message */
 #ifdef JP
        if ((o_ptr->name1 == ART_CRIMSON) && (p_ptr->pseikaku == SEIKAKU_COMBAT))
        {
@@ -680,45 +543,33 @@ void carry(bool pickup)
 {
        cave_type *c_ptr = &cave[p_ptr->y][p_ptr->x];
 
-       s16b this_o_idx, next_o_idx = 0;
+       OBJECT_IDX this_o_idx, next_o_idx = 0;
 
-       char    o_name[MAX_NLEN];
+       GAME_TEXT o_name[MAX_NLEN];
 
        /* Recenter the map around the player */
        verify_panel();
 
-       /* Update stuff */
        p_ptr->update |= (PU_MONSTERS);
 
-       /* Redraw map */
        p_ptr->redraw |= (PR_MAP);
 
-       /* Window stuff */
        p_ptr->window |= (PW_OVERHEAD);
-
-       /* Handle stuff */
        handle_stuff();
 
        /* Automatically pickup/destroy/inscribe items */
        autopick_pickup_items(c_ptr);
 
-
-#ifdef ALLOW_EASY_FLOOR
-
        if (easy_floor)
        {
                py_pickup_floor(pickup);
                return;
        }
 
-#endif /* ALLOW_EASY_FLOOR */
-
        /* Scan the pile of objects */
        for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
        {
                object_type *o_ptr;
-
-               /* Acquire object */
                o_ptr = &o_list[this_o_idx];
 
 #ifdef ALLOW_EASY_SENSE /* TNB */
@@ -732,14 +583,13 @@ void carry(bool pickup)
 
 #endif /* ALLOW_EASY_SENSE -- TNB */
 
-               /* Describe the object */
                object_desc(o_name, o_ptr, 0);
 
                /* Acquire next object */
                next_o_idx = o_ptr->next_o_idx;
 
                /* Hack -- disturb */
-               disturb(0, 0);
+               disturb(FALSE, FALSE);
 
                /* Pick up gold */
                if (o_ptr->tval == TV_GOLD)
@@ -749,7 +599,6 @@ void carry(bool pickup)
                        /* Delete the gold */
                        delete_object_idx(this_o_idx);
 
-                       /* Message */
                        msg_format(_(" $%ld の価値がある%sを見つけた。", "You collect %ld gold pieces worth of %s."),
                           (long)value, o_name);
 
@@ -761,7 +610,6 @@ void carry(bool pickup)
                        /* Redraw gold */
                        p_ptr->redraw |= (PR_GOLD);
 
-                       /* Window stuff */
                        p_ptr->window |= (PW_PLAYER);
                }
 
@@ -774,7 +622,6 @@ void carry(bool pickup)
                                /* Clear the flag. */
                                o_ptr->marked &= ~OM_NOMSG;
                        }
-                       /* Describe the object */
                        else if (!pickup)
                        {
                                msg_format(_("%sがある。", "You see %s."), o_name);
@@ -819,7 +666,7 @@ void carry(bool pickup)
  * @param n_x プレイヤーの移動先X座標
  * @return 移動処理が可能である場合(可能な場合に選択した場合)TRUEを返す。
  */
-bool pattern_seq(int c_y, int c_x, int n_y, int n_x)
+bool pattern_seq(POSITION c_y, POSITION c_x, POSITION n_y, POSITION n_x)
 {
        feature_type *cur_f_ptr = &f_info[cave[c_y][c_x].feat];
        feature_type *new_f_ptr = &f_info[cave[n_y][n_x].feat];
@@ -946,19 +793,17 @@ bool pattern_seq(int c_y, int c_x, int n_y, int n_x)
  * @param mode 移動に関するオプションフラグ
  * @return 移動可能ならばTRUEを返す
  */
-bool player_can_enter(s16b feature, u16b mode)
+bool player_can_enter(FEAT_IDX feature, BIT_FLAGS16 mode)
 {
        feature_type *f_ptr = &f_info[feature];
 
        if (p_ptr->riding) return monster_can_cross_terrain(feature, &r_info[m_list[p_ptr->riding].r_idx], mode | CEM_RIDING);
 
-       /* Pattern */
        if (have_flag(f_ptr->flags, FF_PATTERN))
        {
                if (!(mode & CEM_P_CAN_ENTER_PATTERN)) return FALSE;
        }
 
-       /* "CAN" flags */
        if (have_flag(f_ptr->flags, FF_CAN_FLY) && p_ptr->levitation) return TRUE;
        if (have_flag(f_ptr->flags, FF_CAN_SWIM) && p_ptr->can_swim) return TRUE;
        if (have_flag(f_ptr->flags, FF_CAN_PASS) && p_ptr->pass_wall) return TRUE;
@@ -976,7 +821,7 @@ bool player_can_enter(s16b feature, u16b mode)
  * @param mpe_mode 移動オプションフラグ
  * @return プレイヤーが死亡やフロア離脱を行わず、実際に移動が可能ならばTRUEを返す。
  */
-bool move_player_effect(POSITION ny, POSITION nx, u32b mpe_mode)
+bool move_player_effect(POSITION ny, POSITION nx, BIT_FLAGS mpe_mode)
 {
        cave_type *c_ptr = &cave[ny][nx];
        feature_type *f_ptr = &f_info[c_ptr->feat];
@@ -986,8 +831,8 @@ bool move_player_effect(POSITION ny, POSITION nx, u32b mpe_mode)
                POSITION oy = p_ptr->y;
                POSITION ox = p_ptr->x;
                cave_type *oc_ptr = &cave[oy][ox];
-               IDX om_idx = oc_ptr->m_idx;
-               IDX nm_idx = c_ptr->m_idx;
+               MONSTER_IDX om_idx = oc_ptr->m_idx;
+               MONSTER_IDX nm_idx = c_ptr->m_idx;
 
                /* Move the player */
                p_ptr->y = ny;
@@ -1005,7 +850,7 @@ bool move_player_effect(POSITION ny, POSITION nx, u32b mpe_mode)
                                monster_type *om_ptr = &m_list[om_idx];
                                om_ptr->fy = ny;
                                om_ptr->fx = nx;
-                               update_mon(om_idx, TRUE);
+                               update_monster(om_idx, TRUE);
                        }
 
                        if (nm_idx > 0) /* Monster on new spot */
@@ -1013,14 +858,11 @@ bool move_player_effect(POSITION ny, POSITION nx, u32b mpe_mode)
                                monster_type *nm_ptr = &m_list[nm_idx];
                                nm_ptr->fy = oy;
                                nm_ptr->fx = ox;
-                               update_mon(nm_idx, TRUE);
+                               update_monster(nm_idx, TRUE);
                        }
                }
 
-               /* Redraw old spot */
                lite_spot(oy, ox);
-
-               /* Redraw new spot */
                lite_spot(ny, nx);
 
                /* Check for new panel (redraw map) */
@@ -1030,17 +872,11 @@ bool move_player_effect(POSITION ny, POSITION nx, u32b mpe_mode)
                {
                        forget_flow();
 
-                       /* Mega-Hack -- Forget the view */
                        p_ptr->update |= (PU_UN_VIEW);
-
-                       /* Redraw map */
                        p_ptr->redraw |= (PR_MAP);
                }
 
-               /* Update stuff */
                p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_DISTANCE);
-
-               /* Window stuff */
                p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
 
                /* Remove "unsafe" flag */
@@ -1048,8 +884,6 @@ bool move_player_effect(POSITION ny, POSITION nx, u32b mpe_mode)
 
                /* For get everything when requested hehe I'm *NASTY* */
                if (dun_level && (d_info[dungeon_type].flags1 & DF1_FORGET)) wiz_dark();
-
-               /* Handle stuff */
                if (mpe_mode & MPE_HANDLE_STUFF) handle_stuff();
 
                if (p_ptr->pclass == CLASS_NINJA)
@@ -1099,8 +933,7 @@ bool move_player_effect(POSITION ny, POSITION nx, u32b mpe_mode)
        /* Handle "store doors" */
        if (have_flag(f_ptr->flags, FF_STORE))
        {
-               /* Disturb */
-               disturb(0, 1);
+               disturb(FALSE, TRUE);
 
                p_ptr->energy_use = 0;
                /* Hack -- Enter store */
@@ -1110,8 +943,7 @@ bool move_player_effect(POSITION ny, POSITION nx, u32b mpe_mode)
        /* Handle "building doors" -KMW- */
        else if (have_flag(f_ptr->flags, FF_BLDG))
        {
-               /* Disturb */
-               disturb(0, 1);
+               disturb(FALSE, TRUE);
 
                p_ptr->energy_use = 0;
                /* Hack -- Enter building */
@@ -1121,8 +953,7 @@ bool move_player_effect(POSITION ny, POSITION nx, u32b mpe_mode)
        /* Handle quest areas -KMW- */
        else if (have_flag(f_ptr->flags, FF_QUEST_ENTER))
        {
-               /* Disturb */
-               disturb(0, 1);
+               disturb(FALSE, TRUE);
 
                p_ptr->energy_use = 0;
                /* Hack -- Enter quest level */
@@ -1149,13 +980,11 @@ bool move_player_effect(POSITION ny, POSITION nx, u32b mpe_mode)
        /* Set off a trap */
        else if (have_flag(f_ptr->flags, FF_HIT_TRAP) && !(mpe_mode & MPE_STAYING))
        {
-               /* Disturb */
-               disturb(0, 1);
+               disturb(FALSE, TRUE);
 
                /* Hidden trap */
                if (c_ptr->mimic || have_flag(f_ptr->flags, FF_SECRET))
                {
-                       /* Message */
                        msg_print(_("トラップだ!", "You found a trap!"));
 
                        /* Pick a trap */
@@ -1183,7 +1012,7 @@ bool move_player_effect(POSITION ny, POSITION nx, u32b mpe_mode)
                                msg_print(_("* 注意:この先はトラップの感知範囲外です! *", "*Leaving trap detect region!*"));
                        }
 
-                       if (disturb_trap_detect) disturb(0, 1);
+                       if (disturb_trap_detect) disturb(FALSE, TRUE);
                }
        }
 
@@ -1195,7 +1024,7 @@ bool move_player_effect(POSITION ny, POSITION nx, u32b mpe_mode)
  * @param feat 地形ID
  * @return トラップが自動的に無効ならばTRUEを返す
  */
-bool trap_can_be_ignored(int feat)
+bool trap_can_be_ignored(FEAT_IDX feat)
 {
        feature_type *f_ptr = &f_info[feat];
 
@@ -1276,7 +1105,7 @@ void move_player(DIRECTION dir, bool do_pickup, bool break_trap)
        monster_type *riding_m_ptr = &m_list[p_ptr->riding];
        monster_race *riding_r_ptr = &r_info[p_ptr->riding ? riding_m_ptr->r_idx : 0]; /* Paranoia */
 
-       char m_name[80];
+       GAME_TEXT m_name[MAX_NLEN];
 
        bool p_can_enter = player_can_enter(c_ptr->feat, CEM_P_CAN_ENTER_PATTERN);
        bool p_can_kill_walls = FALSE;
@@ -1445,24 +1274,20 @@ void move_player(DIRECTION dir, bool do_pickup, bool break_trap)
                        msg_print(_("動けない!", "Can't move!"));
                        p_ptr->energy_use = 0;
                        oktomove = FALSE;
-                       disturb(0, 1);
+                       disturb(FALSE, TRUE);
                }
                else if (MON_MONFEAR(riding_m_ptr))
                {
-                       char steed_name[80];
-
-                       /* Acquire the monster name */
+                       GAME_TEXT steed_name[MAX_NLEN];
                        monster_desc(steed_name, riding_m_ptr, 0);
-
-                       /* Dump a message */
                        msg_format(_("%sが恐怖していて制御できない。", "%^s is too scared to control."), steed_name);
                        oktomove = FALSE;
-                       disturb(0, 1);
+                       disturb(FALSE, TRUE);
                }
                else if (p_ptr->riding_ryoute)
                {
                        oktomove = FALSE;
-                       disturb(0, 1);
+                       disturb(FALSE, TRUE);
                }
                else if (have_flag(f_ptr->flags, FF_CAN_FLY) && (riding_r_ptr->flags7 & RF7_CAN_FLY))
                {
@@ -1479,30 +1304,30 @@ void move_player(DIRECTION dir, bool do_pickup, bool break_trap)
                        msg_format(_("%sの上に行けない。", "Can't swim."), f_name + f_info[get_feat_mimic(c_ptr)].name);
                        p_ptr->energy_use = 0;
                        oktomove = FALSE;
-                       disturb(0, 1);
+                       disturb(FALSE, TRUE);
                }
                else if (!have_flag(f_ptr->flags, FF_WATER) && (riding_r_ptr->flags7 & RF7_AQUATIC))
                {
                        msg_format(_("%sから上がれない。", "Can't land."), f_name + f_info[get_feat_mimic(&cave[p_ptr->y][p_ptr->x])].name);
                        p_ptr->energy_use = 0;
                        oktomove = FALSE;
-                       disturb(0, 1);
+                       disturb(FALSE, TRUE);
                }
                else if (have_flag(f_ptr->flags, FF_LAVA) && !(riding_r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK))
                {
                        msg_format(_("%sの上に行けない。", "Too hot to go through."), f_name + f_info[get_feat_mimic(c_ptr)].name);
                        p_ptr->energy_use = 0;
                        oktomove = FALSE;
-                       disturb(0, 1);
+                       disturb(FALSE, TRUE);
                }
 
                if (oktomove && MON_STUNNED(riding_m_ptr) && one_in_(2))
                {
-                       char steed_name[80];
+                       GAME_TEXT steed_name[MAX_NLEN];
                        monster_desc(steed_name, riding_m_ptr, 0);
                        msg_format(_("%sが朦朧としていてうまく動けない!", "You cannot control stunned %s!"), steed_name);
                        oktomove = FALSE;
-                       disturb(0, 1);
+                       disturb(FALSE, TRUE);
                }
        }
 
@@ -1528,7 +1353,6 @@ void move_player(DIRECTION dir, bool do_pickup, bool break_trap)
                if ((p_ptr->pclass != CLASS_RANGER) && !p_ptr->levitation && (!p_ptr->riding || !(riding_r_ptr->flags8 & RF8_WILD_WOOD))) p_ptr->energy_use *= 2;
        }
 
-#ifdef ALLOW_EASY_DISARM /* TNB */
 
        /* Disarm a visible trap */
        else if ((do_pickup != easy_disarm) && have_flag(f_ptr->flags, FF_DISARM) && !c_ptr->mimic)
@@ -1540,15 +1364,14 @@ void move_player(DIRECTION dir, bool do_pickup, bool break_trap)
                }
        }
 
-#endif /* ALLOW_EASY_DISARM -- TNB */
 
        /* Player can not walk through "walls" unless in wraith form...*/
        else if (!p_can_enter && !p_can_kill_walls)
        {
                /* Feature code (applying "mimic" field) */
-               s16b feat = get_feat_mimic(c_ptr);
+               FEAT_IDX feat = get_feat_mimic(c_ptr);
                feature_type *mimic_f_ptr = &f_info[feat];
-               cptr name = f_name + mimic_f_ptr->name;
+               concptr name = f_name + mimic_f_ptr->name;
 
                oktomove = FALSE;
 
@@ -1590,10 +1413,8 @@ void move_player(DIRECTION dir, bool do_pickup, bool break_trap)
                        /* Wall (or secret door) */
                        else
                        {
-#ifdef ALLOW_EASY_OPEN
                                /* Closed doors */
                                if (easy_open && is_closed_door(feat) && easy_open_door(y, x)) return;
-#endif /* ALLOW_EASY_OPEN */
 
 #ifdef JP
                                msg_format("%sが行く手をはばんでいる。", name);
@@ -1612,10 +1433,8 @@ void move_player(DIRECTION dir, bool do_pickup, bool break_trap)
                        }
                }
 
-               /* Disturb the player */
-               disturb(0, 1);
+               disturb(FALSE, TRUE);
 
-               /* Sound */
                if (!boundary_floor(c_ptr, f_ptr, mimic_f_ptr)) sound(SOUND_HITWALL);
        }
 
@@ -1628,7 +1447,7 @@ void move_player(DIRECTION dir, bool do_pickup, bool break_trap)
                }
 
                /* To avoid a loop with running */
-               disturb(0, 1);
+               disturb(FALSE, TRUE);
 
                oktomove = FALSE;
        }
@@ -1671,19 +1490,9 @@ void move_player(DIRECTION dir, bool do_pickup, bool break_trap)
                        p_ptr->update |= (PU_FLOW);
                }
 
-               /* Sound */
                /* sound(SOUND_WALK); */
 
-#ifdef ALLOW_EASY_DISARM /* TNB */
-
                if (do_pickup != always_pickup) mpe_mode |= MPE_DO_PICKUP;
-
-#else /* ALLOW_EASY_DISARM -- TNB */
-
-               if (do_pickup) mpe_mode |= MPE_DO_PICKUP;
-
-#endif /* ALLOW_EASY_DISARM -- TNB */
-
                if (break_trap) mpe_mode |= MPE_BREAK_TRAP;
 
                /* Move the player */
@@ -1702,9 +1511,9 @@ static bool ignore_avoid_run;
  * @param x 移動元のX座標
  * @return 移動先が既知の壁ならばTRUE
  */
-static int see_wall(int dir, int y, int x)
+static bool see_wall(DIRECTION dir, POSITION y, POSITION x)
 {
-       cave_type   *c_ptr;
+       cave_type *c_ptr;
 
        /* Get the new location */
        y += ddy[dir];
@@ -1747,7 +1556,7 @@ static int see_wall(int dir, int y, int x)
  * @param x 移動元のX座標
  * @return 移動先が未知の地形ならばTRUE
  */
-static int see_nothing(int dir, int y, int x)
+static bool see_nothing(DIRECTION dir, POSITION y, POSITION x)
 {
        /* Get the new location */
        y += ddy[dir];
@@ -1767,21 +1576,15 @@ static int see_nothing(int dir, int y, int x)
 }
 
 
-
-
-
-
 /*
  * Hack -- allow quick "cycling" through the legal directions
  */
-static byte cycle[] =
-{ 1, 2, 3, 6, 9, 8, 7, 4, 1, 2, 3, 6, 9, 8, 7, 4, 1 };
+static byte cycle[] = { 1, 2, 3, 6, 9, 8, 7, 4, 1, 2, 3, 6, 9, 8, 7, 4, 1 };
 
 /*
  * Hack -- map each direction into the "middle" of the "cycle[]" array
  */
-static byte chome[] =
-{ 0, 8, 9, 10, 7, 0, 11, 6, 5, 4 };
+static byte chome[] = { 0, 8, 9, 10, 7, 0, 11, 6, 5, 4 };
 
 /*
  * The direction we are running
@@ -1804,8 +1607,6 @@ static bool find_openarea;
 static bool find_breakright;
 static bool find_breakleft;
 
-
-
 /*!
  * @brief ダッシュ処理の導入 /
  * Initialize the running algorithm for a new direction.
@@ -1822,11 +1623,10 @@ static bool find_breakleft;
  *       \#x\#                  \@x\#\n
  *       \@\@p.                  p\n
  */
-static void run_init(int dir)
+static void run_init(DIRECTION dir)
 {
-       int             row, col, deepleft, deepright;
-       int             i, shortleft, shortright;
-
+       int row, col, deepleft, deepright;
+       int i, shortleft, shortright;
 
        /* Save the direction */
        find_current = dir;
@@ -1924,12 +1724,12 @@ static void run_init(int dir)
  */
 static bool run_test(void)
 {
-       int         prev_dir, new_dir, check_dir = 0;
-       int         row, col;
-       int         i, max, inv;
-       int         option = 0, option2 = 0;
-       cave_type   *c_ptr;
-       s16b        feat;
+       DIRECTION prev_dir, new_dir, check_dir = 0;
+       int row, col;
+       int i, max, inv;
+       int option = 0, option2 = 0;
+       cave_type *c_ptr;
+       FEAT_IDX feat;
        feature_type *f_ptr;
 
        /* Where we came from */
@@ -1965,7 +1765,7 @@ static bool run_test(void)
        /* Look at every newly adjacent square. */
        for (i = -max; i <= max; i++)
        {
-               s16b this_o_idx, next_o_idx = 0;
+               OBJECT_IDX this_o_idx, next_o_idx = 0;
 
                /* New direction */
                new_dir = cycle[chome[prev_dir] + i];
@@ -1994,8 +1794,6 @@ static bool run_test(void)
                for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
                {
                        object_type *o_ptr;
-
-                       /* Acquire object */
                        o_ptr = &o_list[this_o_idx];
 
                        /* Acquire next object */
@@ -2259,7 +2057,7 @@ static bool run_test(void)
  * @param dir 移動を試みる方向ID
  * @return なし
  */
-void run_step(int dir)
+void run_step(DIRECTION dir)
 {
        /* Start running */
        if (dir)
@@ -2272,17 +2070,13 @@ void run_step(int dir)
                {
                        sound(SOUND_HITWALL);
 
-                       /* Message */
                        msg_print(_("その方向には走れません。", "You cannot run in that direction."));
 
-                       /* Disturb */
-                       disturb(0, 0);
+                       disturb(FALSE, FALSE);
 
-                       /* Done */
                        return;
                }
 
-               /* Initialize */
                run_init(dir);
        }
 
@@ -2292,10 +2086,8 @@ void run_step(int dir)
                /* Update run */
                if (run_test())
                {
-                       /* Disturb */
-                       disturb(0, 0);
+                       disturb(FALSE, FALSE);
 
-                       /* Done */
                        return;
                }
        }
@@ -2307,21 +2099,13 @@ void run_step(int dir)
        p_ptr->energy_use = 100;
 
        /* Move the player, using the "pickup" flag */
-#ifdef ALLOW_EASY_DISARM /* TNB */
-
        move_player(find_current, FALSE, FALSE);
 
-#else /* ALLOW_EASY_DISARM -- TNB */
-
-       move_player(find_current, always_pickup, FALSE);
-
-#endif /* ALLOW_EASY_DISARM -- TNB */
-
        if (player_bold(p_ptr->run_py, p_ptr->run_px))
        {
                p_ptr->run_py = 0;
                p_ptr->run_px = 0;
-               disturb(0, 0);
+               disturb(FALSE, FALSE);
        }
 }
 
@@ -2332,11 +2116,11 @@ void run_step(int dir)
  * @brief トラベル機能の判定処理 /
  * Test for traveling
  * @param prev_dir 前回移動を行った元の方角ID
- * @return なし
+ * @return 次の方向
  */
-static int travel_test(int prev_dir)
+static DIRECTION travel_test(DIRECTION prev_dir)
 {
-       int new_dir = 0;
+       DIRECTION new_dir = 0;
        int i, max;
        const cave_type *c_ptr;
        int cost;
@@ -2378,11 +2162,11 @@ static int travel_test(int prev_dir)
        for (i = -max; i <= max; i++)
        {
                /* New direction */
-               int dir = cycle[chome[prev_dir] + i];
+               DIRECTION dir = cycle[chome[prev_dir] + i];
 
                /* New location */
-               int row = p_ptr->y + ddy[dir];
-               int col = p_ptr->x + ddx[dir];
+               POSITION row = p_ptr->y + ddy[dir];
+               POSITION col = p_ptr->x + ddx[dir];
 
                /* Access grid */
                c_ptr = &cave[row][col];
@@ -2438,7 +2222,6 @@ void travel_step(void)
        /* Get travel direction */
        travel.dir = travel_test(travel.dir);
 
-       /* disturb */
        if (!travel.dir)
        {
                if (travel.run == 255)
@@ -2446,7 +2229,7 @@ void travel_step(void)
                        msg_print(_("道筋が見つかりません!", "No route is found!"));
                        travel.y = travel.x = 0;
                }
-               disturb(0, 1);
+               disturb(FALSE, TRUE);
                return;
        }