OSDN Git Service

[Refactor] #37353 コメント整理 / Refactor comments.
[hengband/hengband.git] / src / cmd2.c
index 2831165..bafddf7 100644 (file)
@@ -11,7 +11,8 @@
  */
 
 #include "angband.h"
-
+#include "chest.h"
+#include "object-hook.h"
 
 /*!
  * @brief フロア脱出時に出戻りが不可能だった場合に警告を加える処理
@@ -31,13 +32,8 @@ bool confirm_leave_level(bool down_stair)
                                                ((q_ptr->status != QUEST_STATUS_STAGE_COMPLETED) ||
                                                 (down_stair && (quest[QUEST_TOWER1].status != QUEST_STATUS_COMPLETED))))))
        {
-#ifdef JP
-               msg_print("この階を一度去ると二度と戻って来られません。");
-               if (get_check("本当にこの階を去りますか?")) return TRUE;
-#else
-               msg_print("You can't come back here once you leave this floor.");
-               if (get_check("Really leave this floor? ")) return TRUE;
-#endif
+               msg_print(_("この階を一度去ると二度と戻って来られません。", "You can't come back here once you leave this floor."));
+               if (get_check(_("本当にこの階を去りますか?", "Really leave this floor? "))) return TRUE;
        }
        else
        {
@@ -55,7 +51,7 @@ void do_cmd_go_up(void)
        bool go_up = FALSE;
 
        /* Player grid */
-       cave_type *c_ptr = &cave[py][px];
+       cave_type *c_ptr = &cave[p_ptr->y][p_ptr->x];
        feature_type *f_ptr = &f_info[c_ptr->feat];
 
        int up_num = 0;
@@ -80,14 +76,10 @@ void do_cmd_go_up(void)
        
                
                /* Success */
-#ifdef JP
                if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
-                       msg_print("なんだこの階段は!");
+                       msg_print(_("なんだこの階段は!", "What's this STAIRWAY!"));
                else
-                       msg_print("上の階に登った。");
-#else
-               msg_print("You enter the up staircase.");
-#endif
+                       msg_print(_("上の階に登った。", "You enter the up staircase."));
 
                leave_quest_check();
 
@@ -187,7 +179,7 @@ void do_cmd_go_up(void)
 
        /* Success */
        if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
-               msg_print(_("なんだこの階段は!", ""));
+               msg_print(_("なんだこの階段は!", "What's this STAIRWAY!"));
        else if (up_num == dun_level)
                msg_print(_("地上に戻った。", "You go back to the surface."));
        else
@@ -205,7 +197,7 @@ void do_cmd_go_up(void)
 void do_cmd_go_down(void)
 {
        /* Player grid */
-       cave_type *c_ptr = &cave[py][px];
+       cave_type *c_ptr = &cave[p_ptr->y][p_ptr->x];
        feature_type *f_ptr = &f_info[c_ptr->feat];
 
        bool fall_trap = FALSE;
@@ -237,14 +229,10 @@ void do_cmd_go_down(void)
                /* Confirm Leaving */
                if(!confirm_leave_level(TRUE)) return;
                
-#ifdef JP
                if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
-                       msg_print("なんだこの階段は!");
+                       msg_print(_("なんだこの階段は!", "What's this STAIRWAY!"));
                else
-                       msg_print("下の階に降りた。");
-#else
-                       msg_print("You enter the down staircase.");
-#endif
+                       msg_print(_("下の階に降りた。", "You enter the down staircase."));
 
                leave_quest_check();
                leave_tower_check();
@@ -300,8 +288,8 @@ void do_cmd_go_down(void)
                        }
 
                        /* Save old player position */
-                       p_ptr->oldpx = px;
-                       p_ptr->oldpy = py;
+                       p_ptr->oldpx = p_ptr->x;
+                       p_ptr->oldpy = p_ptr->y;
                        dungeon_type = (byte)target_dungeon;
 
                        /*
@@ -347,7 +335,7 @@ void do_cmd_go_down(void)
                        else
                        {
                                if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
-                                       msg_print(_("なんだこの階段は!", ""));
+                                       msg_print(_("なんだこの階段は!", "What's this STAIRWAY!"));
                                else
                                        msg_print(_("階段を下りて新たなる迷宮へと足を踏み入れた。", "You enter a maze of down staircases."));
                        }
@@ -396,8 +384,6 @@ void do_cmd_search(void)
                /* Cancel the arg */
                command_arg = 0;
        }
-
-       /* Take a turn */
        p_ptr->energy_use = 100;
 
        /* Search */
@@ -412,22 +398,17 @@ void do_cmd_search(void)
  * @param trapped TRUEならばトラップが存在する箱のみ、FALSEならば空でない箱全てを対象にする
  * @return 箱が存在する場合そのオブジェクトID、存在しない場合0を返す。
  */
-static s16b chest_check(int y, int x, bool trapped)
+static OBJECT_IDX chest_check(POSITION y, POSITION x, bool trapped)
 {
        cave_type *c_ptr = &cave[y][x];
-
-       s16b this_o_idx, next_o_idx = 0;
-
+       OBJECT_IDX this_o_idx, next_o_idx = 0;
 
        /* 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 */
                next_o_idx = o_ptr->next_o_idx;
 
                /* Skip unknown chests XXX XXX */
@@ -441,354 +422,9 @@ static s16b chest_check(int y, int x, bool trapped)
                        return (this_o_idx);
                }
        }
-
-       /* No chest */
        return (0);
 }
 
-
-/*!
- * @brief 箱からアイテムを引き出す /
- * Allocates objects upon opening a chest    -BEN-
- * @param scatter TRUEならばトラップによるアイテムの拡散処理
- * @param y 箱の存在するマスのY座標
- * @param x 箱の存在するマスのX座標
- * @param o_idx 箱のオブジェクトID
- * @return なし
- * @details
- * <pre>
- * Disperse treasures from the given chest, centered at (x,y).
- *
- * Small chests often contain "gold", while Large chests always contain
- * items.  Wooden chests contain 2 items, Iron chests contain 4 items,
- * and Steel chests contain 6 items.  The "value" of the items in a
- * chest is based on the "power" of the chest, which is in turn based
- * on the level on which the chest is generated.
- * </pre>
- */
-static void chest_death(bool scatter, int y, int x, s16b o_idx)
-{
-       int number;
-
-       bool small;
-       u32b mode = AM_GOOD;
-
-       object_type forge;
-       object_type *q_ptr;
-
-       object_type *o_ptr = &o_list[o_idx];
-
-
-       /* Small chests often hold "gold" */
-       small = (o_ptr->sval < SV_CHEST_MIN_LARGE);
-
-       /* Determine how much to drop (see above) */
-       number = (o_ptr->sval % SV_CHEST_MIN_LARGE) * 2;
-
-       if (o_ptr->sval == SV_CHEST_KANDUME)
-       {
-               number = 5;
-               small = FALSE;
-               mode |= AM_GREAT;
-               object_level = o_ptr->xtra3;
-       }
-       else
-       {
-               /* Determine the "value" of the items */
-               object_level = ABS(o_ptr->pval) + 10;
-       }
-
-       /* Zero pval means empty chest */
-       if (!o_ptr->pval) number = 0;
-
-       /* Opening a chest */
-       opening_chest = TRUE;
-
-       /* Drop some objects (non-chests) */
-       for (; number > 0; --number)
-       {
-               /* Get local object */
-               q_ptr = &forge;
-
-               /* Wipe the object */
-               object_wipe(q_ptr);
-
-               /* Small chests often drop gold */
-               if (small && (randint0(100) < 25))
-               {
-                       /* Make some gold */
-                       if (!make_gold(q_ptr)) continue;
-               }
-
-               /* Otherwise drop an item */
-               else
-               {
-                       /* Make a good object */
-                       if (!make_object(q_ptr, mode)) continue;
-               }
-
-               /* If chest scatters its contents, pick any floor square. */
-               if (scatter)
-               {
-                       int i;
-                       for (i = 0; i < 200; i++)
-                       {
-                               /* Pick a totally random spot. */
-                               y = randint0(MAX_HGT);
-                               x = randint0(MAX_WID);
-
-                               /* Must be an empty floor. */
-                               if (!cave_empty_bold(y, x)) continue;
-
-                               /* Place the object there. */
-                               drop_near(q_ptr, -1, y, x);
-
-                               /* Done. */
-                               break;
-                       }
-               }
-               /* Normally, drop object near the chest. */
-               else drop_near(q_ptr, -1, y, x);
-       }
-
-       /* Reset the object level */
-       object_level = base_level;
-
-       /* No longer opening a chest */
-       opening_chest = FALSE;
-
-       /* Empty */
-       o_ptr->pval = 0;
-
-       /* Known */
-       object_known(o_ptr);
-}
-
-
-/*!
- * @brief 箱のトラップ処理 /
- * Chests have traps too.
- * @param y 箱の存在するマスのY座標
- * @param x 箱の存在するマスのX座標
- * @param o_idx 箱のオブジェクトID
- * @return なし
- * @details
- * <pre>
- * Exploding chest destroys contents (and traps).
- * Note that the chest itself is never destroyed.
- * </pre>
- */
-static void chest_trap(int y, int x, s16b o_idx)
-{
-       int  i, trap;
-
-       object_type *o_ptr = &o_list[o_idx];
-
-       int mon_level = o_ptr->xtra3;
-
-       /* Ignore disarmed chests */
-       if (o_ptr->pval <= 0) return;
-
-       /* Obtain the traps */
-       trap = chest_traps[o_ptr->pval];
-
-       /* Lose strength */
-       if (trap & (CHEST_LOSE_STR))
-       {
-#ifdef JP
-               msg_print("仕掛けられていた小さな針に刺されてしまった!");
-               take_hit(DAMAGE_NOESCAPE, damroll(1, 4), "毒針", -1);
-#else
-               msg_print("A small needle has pricked you!");
-               take_hit(DAMAGE_NOESCAPE, damroll(1, 4), "a poison needle", -1);
-#endif
-
-               (void)do_dec_stat(A_STR);
-       }
-
-       /* Lose constitution */
-       if (trap & (CHEST_LOSE_CON))
-       {
-#ifdef JP
-               msg_print("仕掛けられていた小さな針に刺されてしまった!");
-               take_hit(DAMAGE_NOESCAPE, damroll(1, 4), "毒針", -1);
-#else
-               msg_print("A small needle has pricked you!");
-               take_hit(DAMAGE_NOESCAPE, damroll(1, 4), "a poison needle", -1);
-#endif
-
-               (void)do_dec_stat(A_CON);
-       }
-
-       /* Poison */
-       if (trap & (CHEST_POISON))
-       {
-               msg_print(_("突如吹き出した緑色のガスに包み込まれた!", "A puff of green gas surrounds you!"));
-               if (!(p_ptr->resist_pois || IS_OPPOSE_POIS()))
-               {
-                       (void)set_poisoned(p_ptr->poisoned + 10 + randint1(20));
-               }
-       }
-
-       /* Paralyze */
-       if (trap & (CHEST_PARALYZE))
-       {
-               msg_print(_("突如吹き出した黄色いガスに包み込まれた!", "A puff of yellow gas surrounds you!"));
-               if (!p_ptr->free_act)
-               {
-                       (void)set_paralyzed(p_ptr->paralyzed + 10 + randint1(20));
-               }
-       }
-
-       /* Summon monsters */
-       if (trap & (CHEST_SUMMON))
-       {
-               int num = 2 + randint1(3);
-               msg_print(_("突如吹き出した煙に包み込まれた!", "You are enveloped in a cloud of smoke!"));
-               for (i = 0; i < num; i++)
-               {
-                       if (randint1(100)<dun_level)
-                               activate_hi_summon(py, px, FALSE);
-                       else
-                               (void)summon_specific(0, y, x, mon_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
-               }
-       }
-
-       /* Elemental summon. */
-       if (trap & (CHEST_E_SUMMON))
-       {
-               msg_print(_("宝を守るためにエレメンタルが現れた!", "Elemental beings appear to protect their treasures!"));
-               for (i = 0; i < randint1(3) + 5; i++)
-               {
-                       (void)summon_specific(0, y, x, mon_level, SUMMON_ELEMENTAL, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
-               }
-       }
-
-       /* Force clouds, then summon birds. */
-       if (trap & (CHEST_BIRD_STORM))
-       {
-               msg_print(_("鳥の群れがあなたを取り巻いた!", "A storm of birds swirls around you!"));
-
-               for (i = 0; i < randint1(3) + 3; i++)
-                       (void)fire_meteor(-1, GF_FORCE, y, x, o_ptr->pval / 5, 7);
-
-               for (i = 0; i < randint1(5) + o_ptr->pval / 5; i++)
-               {
-                       (void)summon_specific(0, y, x, mon_level, SUMMON_BIRD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
-               }
-       }
-
-       /* Various colorful summonings. */
-       if (trap & (CHEST_H_SUMMON))
-       {
-               /* Summon demons. */
-               if (one_in_(4))
-               {
-                       msg_print(_("炎と硫黄の雲の中に悪魔が姿を現した!", "Demons materialize in clouds of fire and brimstone!"));
-                       for (i = 0; i < randint1(3) + 2; i++)
-                       {
-                               (void)fire_meteor(-1, GF_FIRE, y, x, 10, 5);
-                               (void)summon_specific(0, y, x, mon_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
-                       }
-               }
-
-               /* Summon dragons. */
-               else if (one_in_(3))
-               {
-                       msg_print(_("暗闇にドラゴンの影がぼんやりと現れた!", "Draconic forms loom out of the darkness!"));
-                       for (i = 0; i < randint1(3) + 2; i++)
-                       {
-                               (void)summon_specific(0, y, x, mon_level, SUMMON_DRAGON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
-                       }
-               }
-
-               /* Summon hybrids. */
-               else if (one_in_(2))
-               {
-                       msg_print(_("奇妙な姿の怪物が襲って来た!", "Creatures strange and twisted assault you!"));
-                       for (i = 0; i < randint1(5) + 3; i++)
-                       {
-                               (void)summon_specific(0, y, x, mon_level, SUMMON_HYBRID, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
-                       }
-               }
-
-               /* Summon vortices (scattered) */
-               else
-               {
-                       msg_print(_("渦巻が合体し、破裂した!", "Vortices coalesce and wreak destruction!"));
-                       for (i = 0; i < randint1(3) + 2; i++)
-                       {
-                               (void)summon_specific(0, y, x, mon_level, SUMMON_VORTEX, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
-                       }
-               }
-       }
-
-       /* Dispel player. */
-       if ((trap & (CHEST_RUNES_OF_EVIL)) && o_ptr->k_idx)
-       {
-               /* Determine how many nasty tricks can be played. */
-               int nasty_tricks_count = 4 + randint0(3);
-
-               /* Message. */
-               msg_print(_("恐ろしい声が響いた:  「暗闇が汝をつつまん!」", "Hideous voices bid:  'Let the darkness have thee!'"));
-               /* This is gonna hurt... */
-               for (; nasty_tricks_count > 0; nasty_tricks_count--)
-               {
-                       /* ...but a high saving throw does help a little. */
-                       if (randint1(100+o_ptr->pval*2) > p_ptr->skill_sav)
-                       {
-                               if (one_in_(6)) take_hit(DAMAGE_NOESCAPE, damroll(5, 20), _("破滅のトラップの宝箱", "a chest dispel-player trap"), -1);
-                               else if (one_in_(5)) (void)set_cut(p_ptr->cut + 200);
-                               else if (one_in_(4))
-                               {
-                                       if (!p_ptr->free_act) 
-                                               (void)set_paralyzed(p_ptr->paralyzed + 2 + 
-                                               randint0(6));
-                                       else 
-                                               (void)set_stun(p_ptr->stun + 10 + 
-                                               randint0(100));
-                               }
-                               else if (one_in_(3)) apply_disenchant(0);
-                               else if (one_in_(2))
-                               {
-                                       (void)do_dec_stat(A_STR);
-                                       (void)do_dec_stat(A_DEX);
-                                       (void)do_dec_stat(A_CON);
-                                       (void)do_dec_stat(A_INT);
-                                       (void)do_dec_stat(A_WIS);
-                                       (void)do_dec_stat(A_CHR);
-                               }
-                               else (void)fire_meteor(-1, GF_NETHER, y, x, 150, 1);
-                       }
-               }
-       }
-
-       /* Aggravate monsters. */
-       if (trap & (CHEST_ALARM))
-       {
-               msg_print(_("けたたましい音が鳴り響いた!", "An alarm sounds!"));
-               aggravate_monsters(0);
-       }
-
-       /* Explode */
-       if ((trap & (CHEST_EXPLODE)) && o_ptr->k_idx)
-       {
-               msg_print(_("突然、箱が爆発した!", "There is a sudden explosion!"));
-               msg_print(_("箱の中の物はすべて粉々に砕け散った!", "Everything inside the chest is destroyed!"));
-               o_ptr->pval = 0;
-               sound(SOUND_EXPLODE);
-               take_hit(DAMAGE_ATTACK, damroll(5, 8), _("爆発する箱", "an exploding chest"), -1);
-       }
-       /* Scatter contents. */
-       if ((trap & (CHEST_SCATTER)) && o_ptr->k_idx)
-       {
-               msg_print(_("宝箱の中身はダンジョンじゅうに散乱した!", "The contents of the chest scatter all over the dungeon!"));
-               chest_death(TRUE, y, x, o_idx);
-               o_ptr->pval = 0;
-       }
-}
-
-
 /*!
  * @brief 箱を開けるコマンドのメインルーチン /
  * Attempt to open the given chest at the given location
@@ -799,18 +435,13 @@ static void chest_trap(int y, int x, s16b o_idx)
  * @details
  * Assume there is no monster blocking the destination
  */
-static bool do_cmd_open_chest(int y, int x, s16b o_idx)
+static bool do_cmd_open_chest(POSITION y, POSITION x, OBJECT_IDX o_idx)
 {
        int i, j;
-
        bool flag = TRUE;
-
        bool more = FALSE;
-
        object_type *o_ptr = &o_list[o_idx];
 
-
-       /* Take a turn */
        p_ptr->energy_use = 100;
 
        /* Attempt to unlock it */
@@ -860,21 +491,16 @@ static bool do_cmd_open_chest(int y, int x, s16b o_idx)
                /* Let the Chest drop items */
                chest_death(FALSE, y, x, o_idx);
        }
-
-       /* Result */
        return (more);
 }
 
-
-#if defined(ALLOW_EASY_OPEN) || defined(ALLOW_EASY_DISARM) /* TNB */
-
 /*!
  * @brief 地形は開くものであって、かつ開かれているかを返す /
  * Attempt to open the given chest at the given location
  * @param feat 地形ID
  * @return 開いた地形である場合TRUEを返す /  Return TRUE if the given feature is an open door
  */
-static bool is_open(int feat)
+static bool is_open(IDX feat)
 {
        return have_flag(f_info[feat].flags, FF_CLOSE) && (feat != feat_state(feat, FF_CLOSE));
 }
@@ -891,7 +517,7 @@ static bool is_open(int feat)
  * @details Return the number of features around (or under) the character.
  * Usually look for doors and floor traps.
  */
-static int count_dt(int *y, int *x, bool (*test)(int feat), bool under)
+static int count_dt(POSITION *y, POSITION *x, bool (*test)(IDX feat), bool under)
 {
        int d, count, xx, yy;
 
@@ -902,14 +528,14 @@ static int count_dt(int *y, int *x, bool (*test)(int feat), bool under)
        for (d = 0; d < 9; d++)
        {
                cave_type *c_ptr;
-               s16b feat;
+               FEAT_IDX feat;
 
                /* if not searching under player continue */
                if ((d == 8) && !under) continue;
 
                /* Extract adjacent (legal) location */
-               yy = py + ddy_ddd[d];
-               xx = px + ddx_ddd[d];
+               yy = p_ptr->y + ddy_ddd[d];
+               xx = p_ptr->x + ddx_ddd[d];
 
                /* Get the cave */
                c_ptr = &cave[yy][xx];
@@ -946,9 +572,10 @@ static int count_dt(int *y, int *x, bool (*test)(int feat), bool under)
  * @details
  * If requested, count only trapped chests.
  */
-static int count_chests(int *y, int *x, bool trapped)
+static int count_chests(POSITION *y, POSITION *x, bool trapped)
 {
-       int d, count, o_idx;
+       int d, count;
+       OBJECT_IDX o_idx;
 
        object_type *o_ptr;
 
@@ -959,8 +586,8 @@ static int count_chests(int *y, int *x, bool trapped)
        for (d = 0; d < 9; d++)
        {
                /* Extract adjacent (legal) location */
-               int yy = py + ddy_ddd[d];
-               int xx = px + ddx_ddd[d];
+               POSITION yy = p_ptr->y + ddy_ddd[d];
+               POSITION xx = p_ptr->x + ddx_ddd[d];
 
                /* No (visible) chest is there */
                if ((o_idx = chest_check(yy, xx, FALSE)) == 0) continue;
@@ -995,13 +622,13 @@ static int count_chests(int *y, int *x, bool trapped)
  * @param x 方角を確認したX座標
  * @return 方向ID
  */
-static int coords_to_dir(int y, int x)
+static DIRECTION coords_to_dir(POSITION y, POSITION x)
 {
        int d[3][3] = { {7, 4, 1}, {8, 5, 2}, {9, 6, 3} };
        int dy, dx;
 
-       dy = y - py;
-       dx = x - px;
+       dy = y - p_ptr->y;
+       dx = x - p_ptr->x;
 
        /* Paranoia */
        if (ABS(dx) > 1 || ABS(dy) > 1) return (0);
@@ -1009,9 +636,6 @@ static int coords_to_dir(int y, int x)
        return d[dx + 1][dy + 1];
 }
 
-#endif /* defined(ALLOW_EASY_OPEN) || defined(ALLOW_EASY_DISARM) -- TNB */
-
-
 /*!
  * @brief 「開ける」動作コマンドのサブルーチン /
  * Perform the basic "open" command on doors
@@ -1023,19 +647,15 @@ static int coords_to_dir(int y, int x)
  * Assume there is no monster blocking the destination
  * Returns TRUE if repeated commands may continue
  */
-static bool do_cmd_open_aux(int y, int x)
+static bool do_cmd_open_aux(POSITION y, POSITION x)
 {
        int i, j;
 
        /* Get requested grid */
        cave_type *c_ptr = &cave[y][x];
-
        feature_type *f_ptr = &f_info[c_ptr->feat];
-
        bool more = FALSE;
 
-
-       /* Take a turn */
        p_ptr->energy_use = 100;
 
        /* Seeing true feature code (ignore mimic) */
@@ -1060,7 +680,7 @@ static bool do_cmd_open_aux(int y, int x)
                /* Extract the lock power */
                j = f_ptr->power;
 
-               /* Extract the difficulty XXX XXX XXX */
+               /* Extract the difficulty */
                j = i - (j * 4);
 
                /* Always have a small chance of success */
@@ -1069,13 +689,11 @@ static bool do_cmd_open_aux(int y, int x)
                /* Success */
                if (randint0(100) < j)
                {
-                       /* Message */
                        msg_print(_("鍵をはずした。", "You have picked the lock."));
 
                        /* Open the door */
                        cave_alter_feat(y, x, FF_OPEN);
 
-                       /* Sound */
                        sound(SOUND_OPENDOOR);
 
                        /* Experience */
@@ -1088,7 +706,6 @@ static bool do_cmd_open_aux(int y, int x)
                        /* Failure */
                        if (flush_failure) flush();
 
-                       /* Message */
                        msg_print(_("鍵をはずせなかった。", "You failed to pick the lock."));
 
                        /* We may keep trying */
@@ -1102,11 +719,8 @@ static bool do_cmd_open_aux(int y, int x)
                /* Open the door */
                cave_alter_feat(y, x, FF_OPEN);
 
-               /* Sound */
                sound(SOUND_OPENDOOR);
        }
-
-       /* Result */
        return (more);
 }
 
@@ -1119,9 +733,9 @@ static bool do_cmd_open_aux(int y, int x)
  */
 void do_cmd_open(void)
 {
-       int y, x, dir;
-
-       s16b o_idx;
+       POSITION y, x;
+       DIRECTION dir;
+       OBJECT_IDX o_idx;
 
        bool more = FALSE;
 
@@ -1130,8 +744,6 @@ void do_cmd_open(void)
                set_action(ACTION_NONE);
        }
 
-#ifdef ALLOW_EASY_OPEN /* TNB */
-
        /* Option: Pick a direction */
        if (easy_open)
        {
@@ -1152,8 +764,6 @@ void do_cmd_open(void)
                }
        }
 
-#endif /* ALLOW_EASY_OPEN -- TNB */
-
        /* Allow repeated command */
        if (command_arg)
        {
@@ -1170,12 +780,12 @@ void do_cmd_open(void)
        /* Get a "repeated" direction */
        if (get_rep_dir(&dir, TRUE))
        {
-               s16b feat;
+               FEAT_IDX feat;
                cave_type *c_ptr;
 
                /* Get requested location */
-               y = py + ddy[dir];
-               x = px + ddx[dir];
+               y = p_ptr->y + ddy[dir];
+               x = p_ptr->x + ddx[dir];
 
                /* Get requested grid */
                c_ptr = &cave[y][x];
@@ -1189,17 +799,14 @@ void do_cmd_open(void)
                /* Nothing useful */
                if (!have_flag(f_info[feat].flags, FF_OPEN) && !o_idx)
                {
-                       /* Message */
                        msg_print(_("そこには開けるものが見当たらない。", "You see nothing there to open."));
                }
 
                /* Monster in the way */
                else if (c_ptr->m_idx && p_ptr->riding != c_ptr->m_idx)
                {
-                       /* Take a turn */
                        p_ptr->energy_use = 100;
 
-                       /* Message */
                        msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
                        
                        /* Attack */
@@ -1222,7 +829,7 @@ void do_cmd_open(void)
        }
 
        /* Cancel repeat unless we may continue */
-       if (!more) disturb(0, 0);
+       if (!more) disturb(FALSE, FALSE);
 }
 
 
@@ -1238,14 +845,13 @@ void do_cmd_open(void)
  * Assume there is no monster blocking the destination
  * Returns TRUE if repeated commands may continue
  */
-static bool do_cmd_close_aux(int y, int x)
+static bool do_cmd_close_aux(POSITION y, POSITION x)
 {
        /* Get grid and contents */
        cave_type *c_ptr = &cave[y][x];
-       s16b      old_feat = c_ptr->feat;
-       bool      more = FALSE;
+       FEAT_IDX old_feat = c_ptr->feat;
+       bool more = FALSE;
 
-       /* Take a turn */
        p_ptr->energy_use = 100;
 
        /* Seeing true feature code (ignore mimic) */
@@ -1259,7 +865,6 @@ static bool do_cmd_close_aux(int y, int x)
                if ((c_ptr->o_idx || (c_ptr->info & CAVE_OBJECT)) &&
                    (closed_feat != old_feat) && !have_flag(f_info[closed_feat].flags, FF_DROP))
                {
-                       /* Message */
                        msg_print(_("何かがつっかえて閉まらない。", "There seems stuck."));
                }
                else
@@ -1270,18 +875,14 @@ static bool do_cmd_close_aux(int y, int x)
                        /* Broken door */
                        if (old_feat == c_ptr->feat)
                        {
-                               /* Message */
                                msg_print(_("ドアは壊れてしまっている。", "The door appears to be broken."));
                        }
                        else
                        {
-                               /* Sound */
                                sound(SOUND_SHUTDOOR);
                        }
                }
        }
-
-       /* Result */
        return (more);
 }
 
@@ -1295,7 +896,8 @@ static bool do_cmd_close_aux(int y, int x)
  */
 void do_cmd_close(void)
 {
-       int y, x, dir;
+       POSITION y, x;
+       DIRECTION dir;
 
        bool more = FALSE;
 
@@ -1304,8 +906,6 @@ void do_cmd_close(void)
                set_action(ACTION_NONE);
        }
 
-#ifdef ALLOW_EASY_OPEN /* TNB */
-
        /* Option: Pick a direction */
        if (easy_open)
        {
@@ -1316,8 +916,6 @@ void do_cmd_close(void)
                }
        }
 
-#endif /* ALLOW_EASY_OPEN -- TNB */
-
        /* Allow repeated command */
        if (command_arg)
        {
@@ -1332,14 +930,14 @@ void do_cmd_close(void)
        }
 
        /* Get a "repeated" direction */
-       if (get_rep_dir(&dir,FALSE))
+       if (get_rep_dir(&dir, FALSE))
        {
                cave_type *c_ptr;
-               s16b feat;
+               FEAT_IDX feat;
 
                /* Get requested location */
-               y = py + ddy[dir];
-               x = px + ddx[dir];
+               y = p_ptr->y + ddy[dir];
+               x = p_ptr->x + ddx[dir];
 
                /* Get grid and contents */
                c_ptr = &cave[y][x];
@@ -1350,17 +948,14 @@ void do_cmd_close(void)
                /* Require open/broken door */
                if (!have_flag(f_info[feat].flags, FF_CLOSE))
                {
-                       /* Message */
                        msg_print(_("そこには閉じるものが見当たらない。", "You see nothing there to close."));
                }
 
                /* Monster in the way */
                else if (c_ptr->m_idx)
                {
-                       /* Take a turn */
                        p_ptr->energy_use = 100;
 
-                       /* Message */
                        msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
 
                        /* Attack */
@@ -1376,7 +971,7 @@ void do_cmd_close(void)
        }
 
        /* Cancel repeat unless we may continue */
-       if (!more) disturb(0, 0);
+       if (!more) disturb(FALSE, FALSE);
 }
 
 
@@ -1387,31 +982,26 @@ void do_cmd_close(void)
  * @param x 対象を行うマスのX座標
  * @return 
  */
-static bool do_cmd_tunnel_test(int y, int x)
+static bool do_cmd_tunnel_test(POSITION y, POSITION x)
 {
        cave_type *c_ptr = &cave[y][x];
 
        /* Must have knowledge */
        if (!(c_ptr->info & CAVE_MARK))
        {
-               /* Message */
                msg_print(_("そこには何も見当たらない。", "You see nothing there."));
 
-               /* Nope */
                return (FALSE);
        }
 
        /* Must be a wall/door/etc */
        if (!cave_have_flag_grid(c_ptr, FF_TUNNEL))
        {
-               /* Message */
                msg_print(_("そこには掘るものが見当たらない。", "You see nothing there to tunnel."));
 
-               /* Nope */
                return (FALSE);
        }
 
-       /* Okay */
        return (TRUE);
 }
 
@@ -1427,7 +1017,7 @@ static bool do_cmd_tunnel_test(int y, int x)
  * Do not use twall anymore
  * Returns TRUE if repeated commands may continue
  */
-static bool do_cmd_tunnel_aux(int y, int x)
+static bool do_cmd_tunnel_aux(POSITION y, POSITION x)
 {
        cave_type *c_ptr;
        feature_type *f_ptr, *mimic_f_ptr;
@@ -1438,7 +1028,6 @@ static bool do_cmd_tunnel_aux(int y, int x)
        /* Verify legality */
        if (!do_cmd_tunnel_test(y, x)) return (FALSE);
 
-       /* Take a turn */
        p_ptr->energy_use = 100;
 
        /* Get grid */
@@ -1451,7 +1040,6 @@ static bool do_cmd_tunnel_aux(int y, int x)
 
        name = f_name + mimic_f_ptr->name;
 
-       /* Sound */
        sound(SOUND_DIG);
 
        if (have_flag(f_ptr->flags, FF_PERMANENT))
@@ -1475,7 +1063,6 @@ static bool do_cmd_tunnel_aux(int y, int x)
                /* Dig */
                if (p_ptr->skill_dig > randint0(20 * power))
                {
-                       /* Message */
                        msg_format(_("%sをくずした。", "You have removed the %s."), name);
 
                        /* Remove the feature */
@@ -1507,7 +1094,6 @@ static bool do_cmd_tunnel_aux(int y, int x)
                                p_ptr->update |= (PU_FLOW);
                        }
                        
-                       /* Sound */
                        if (have_flag(f_ptr->flags, FF_GLASS)) sound(SOUND_GLASS);
 
                        /* Remove the feature */
@@ -1542,8 +1128,6 @@ static bool do_cmd_tunnel_aux(int y, int x)
                /* Occasional Search XXX XXX */
                if (randint0(100) < 25) search();
        }
-
-       /* Result */
        return more;
 }
 
@@ -1566,7 +1150,7 @@ void do_cmd_tunnel(void)
        int                     y, x, dir;
 
        cave_type       *c_ptr;
-       s16b feat;
+       FEAT_IDX feat;
 
        bool            more = FALSE;
 
@@ -1593,8 +1177,8 @@ void do_cmd_tunnel(void)
        if (get_rep_dir(&dir,FALSE))
        {
                /* Get location */
-               y = py + ddy[dir];
-               x = px + ddx[dir];
+               y = p_ptr->y + ddy[dir];
+               x = p_ptr->x + ddx[dir];
 
                /* Get grid */
                c_ptr = &cave[y][x];
@@ -1605,7 +1189,6 @@ void do_cmd_tunnel(void)
                /* No tunnelling through doors */
                if (have_flag(f_info[feat].flags, FF_DOOR))
                {
-                       /* Message */
                        msg_print(_("ドアは掘れない。", "You cannot tunnel through doors."));
                }
 
@@ -1618,10 +1201,8 @@ void do_cmd_tunnel(void)
                /* A monster is in the way */
                else if (c_ptr->m_idx)
                {
-                       /* Take a turn */
                        p_ptr->energy_use = 100;
 
-                       /* Message */
                        msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
 
                        /* Attack */
@@ -1637,12 +1218,9 @@ void do_cmd_tunnel(void)
        }
 
        /* Cancel repetition unless we can continue */
-       if (!more) disturb(0, 0);
+       if (!more) disturb(FALSE, FALSE);
 }
 
-
-#ifdef ALLOW_EASY_OPEN /* TNB */
-
 /*!
  * @brief 移動処理による簡易な「開く」処理 /
  * easy_open_door --
@@ -1657,7 +1235,7 @@ void do_cmd_tunnel(void)
  *     do_cmd_open_test() and do_cmd_open_aux().
  * </pre>
  */
-bool easy_open_door(int y, int x)
+bool easy_open_door(POSITION y, POSITION x)
 {
        int i, j;
 
@@ -1667,7 +1245,6 @@ bool easy_open_door(int y, int x)
        /* Must be a closed door */
        if (!is_closed_door(c_ptr->feat))
        {
-               /* Nope */
                return (FALSE);
        }
 
@@ -1692,7 +1269,7 @@ bool easy_open_door(int y, int x)
                /* Extract the lock power */
                j = f_ptr->power;
 
-               /* Extract the difficulty XXX XXX XXX */
+               /* Extract the difficulty */
                j = i - (j * 4);
 
                /* Always have a small chance of success */
@@ -1701,13 +1278,11 @@ bool easy_open_door(int y, int x)
                /* Success */
                if (randint0(100) < j)
                {
-                       /* Message */
                        msg_print(_("鍵をはずした。", "You have picked the lock."));
 
                        /* Open the door */
                        cave_alter_feat(y, x, FF_OPEN);
 
-                       /* Sound */
                        sound(SOUND_OPENDOOR);
 
                        /* Experience */
@@ -1720,7 +1295,6 @@ bool easy_open_door(int y, int x)
                        /* Failure */
                        if (flush_failure) flush();
 
-                       /* Message */
                        msg_print(_("鍵をはずせなかった。", "You failed to pick the lock."));
 
                }
@@ -1732,17 +1306,11 @@ bool easy_open_door(int y, int x)
                /* Open the door */
                cave_alter_feat(y, x, FF_OPEN);
 
-               /* Sound */
                sound(SOUND_OPENDOOR);
        }
-
-       /* Result */
        return (TRUE);
 }
 
-#endif /* ALLOW_EASY_OPEN -- TNB */
-
-
 /*!
  * @brief 箱のトラップを解除するコマンドのメインルーチン /
  * Perform the basic "disarm" command
@@ -1757,16 +1325,12 @@ bool easy_open_door(int y, int x)
  * Returns TRUE if repeated commands may continue
  * </pre>
  */
-static bool do_cmd_disarm_chest(int y, int x, s16b o_idx)
+static bool do_cmd_disarm_chest(POSITION y, POSITION x, OBJECT_IDX o_idx)
 {
        int i, j;
-
        bool more = FALSE;
-
        object_type *o_ptr = &o_list[o_idx];
 
-
-       /* Take a turn */
        p_ptr->energy_use = 100;
 
        /* Get the "disarm" factor */
@@ -1825,8 +1389,6 @@ static bool do_cmd_disarm_chest(int y, int x, s16b o_idx)
                sound(SOUND_FAIL);
                chest_trap(y, x, o_idx);
        }
-
-       /* Result */
        return (more);
 }
 
@@ -1845,15 +1407,8 @@ static bool do_cmd_disarm_chest(int y, int x, s16b o_idx)
  * Returns TRUE if repeated commands may continue
  * </pre>
  */
-#ifdef ALLOW_EASY_DISARM /* TNB */
 
-bool do_cmd_disarm_aux(int y, int x, int dir)
-
-#else /* ALLOW_EASY_DISARM -- TNB */
-
-static bool do_cmd_disarm_aux(int y, int x, int dir)
-
-#endif /* ALLOW_EASY_DISARM -- TNB */
+bool do_cmd_disarm_aux(POSITION y, POSITION x, DIRECTION dir)
 {
        /* Get grid and contents */
        cave_type *c_ptr = &cave[y][x];
@@ -1866,15 +1421,12 @@ static bool do_cmd_disarm_aux(int y, int x, int dir)
 
        /* Extract trap "power" */
        int power = f_ptr->power;
-
        bool more = FALSE;
 
        /* Get the "disarm" factor */
        int i = p_ptr->skill_dis;
-
        int j;
 
-       /* Take a turn */
        p_ptr->energy_use = 100;
 
        /* Penalize some conditions */
@@ -1890,7 +1442,6 @@ static bool do_cmd_disarm_aux(int y, int x, int dir)
        /* Success */
        if (randint0(100) < j)
        {
-               /* Message */
                msg_format(_("%sを解除した。", "You have disarmed the %s."), name);
                
                /* Reward */
@@ -1899,17 +1450,8 @@ static bool do_cmd_disarm_aux(int y, int x, int dir)
                /* Remove the trap */
                cave_alter_feat(y, x, FF_DISARM);
 
-#ifdef ALLOW_EASY_DISARM /* TNB */
-
                /* Move the player onto the trap */
                move_player(dir, easy_disarm, FALSE);
-
-#else /* ALLOW_EASY_DISARM -- TNB */
-
-               /* move the player onto the trap grid */
-               move_player(dir, FALSE, FALSE);
-
-#endif /* ALLOW_EASY_DISARM -- TNB */
        }
 
        /* Failure -- Keep trying */
@@ -1918,7 +1460,6 @@ static bool do_cmd_disarm_aux(int y, int x, int dir)
                /* Failure */
                if (flush_failure) flush();
 
-               /* Message */
                msg_format(_("%sの解除に失敗した。", "You failed to disarm the %s."), name);
 
                /* We may keep trying */
@@ -1928,23 +1469,10 @@ static bool do_cmd_disarm_aux(int y, int x, int dir)
        /* Failure -- Set off the trap */
        else
        {
-               /* Message */
                msg_format(_("%sを作動させてしまった!", "You set off the %s!"), name);
-
-#ifdef ALLOW_EASY_DISARM /* TNB */
-
                /* Move the player onto the trap */
                move_player(dir, easy_disarm, FALSE);
-
-#else /* ALLOW_EASY_DISARM -- TNB */
-
-               /* Move the player onto the trap */
-               move_player(dir, FALSE, FALSE);
-
-#endif /* ALLOW_EASY_DISARM -- TNB */
        }
-
-       /* Result */
        return (more);
 }
 
@@ -1956,8 +1484,8 @@ static bool do_cmd_disarm_aux(int y, int x, int dir)
  */
 void do_cmd_disarm(void)
 {
-       int y, x, dir;
-
+       POSITION y, x;
+       DIRECTION dir;
        s16b o_idx;
 
        bool more = FALSE;
@@ -1967,7 +1495,6 @@ void do_cmd_disarm(void)
                set_action(ACTION_NONE);
        }
 
-#ifdef ALLOW_EASY_DISARM /* TNB */
 
        /* Option: Pick a direction */
        if (easy_disarm)
@@ -1983,13 +1510,11 @@ void do_cmd_disarm(void)
                /* See if only one target */
                if (num_traps || num_chests)
                {
-                       bool too_many = (num_traps && num_chests) || (num_traps > 1) ||
-                           (num_chests > 1);
+                       bool too_many = (num_traps && num_chests) || (num_traps > 1) || (num_chests > 1);
                        if (!too_many) command_dir = coords_to_dir(y, x);
                }
        }
 
-#endif /* ALLOW_EASY_DISARM -- TNB */
 
        /* Allow repeated command */
        if (command_arg)
@@ -2008,11 +1533,11 @@ void do_cmd_disarm(void)
        if (get_rep_dir(&dir,TRUE))
        {
                cave_type *c_ptr;
-               s16b feat;
+               FEAT_IDX feat;
 
                /* Get location */
-               y = py + ddy[dir];
-               x = px + ddx[dir];
+               y = p_ptr->y + ddy[dir];
+               x = p_ptr->x + ddx[dir];
 
                /* Get grid and contents */
                c_ptr = &cave[y][x];
@@ -2026,14 +1551,12 @@ void do_cmd_disarm(void)
                /* Disarm a trap */
                if (!is_trap(feat) && !o_idx)
                {
-                       /* Message */
                        msg_print(_("そこには解除するものが見当たらない。", "You see nothing there to disarm."));
                }
 
                /* Monster in the way */
                else if (c_ptr->m_idx && p_ptr->riding != c_ptr->m_idx)
                {
-                       /* Message */
                        msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
 
                        /* Attack */
@@ -2056,7 +1579,7 @@ void do_cmd_disarm(void)
        }
 
        /* Cancel repeat unless told not to */
-       if (!more) disturb(0, 0);
+       if (!more) disturb(FALSE, FALSE);
 }
 
 
@@ -2074,7 +1597,7 @@ void do_cmd_disarm(void)
  * Returns TRUE if repeated commands may continue
  * </pre>
  */
-static bool do_cmd_bash_aux(int y, int x, int dir)
+static bool do_cmd_bash_aux(POSITION y, POSITION x, DIRECTION dir)
 {
        /* Get grid */
        cave_type       *c_ptr = &cave[y][x];
@@ -2093,13 +1616,11 @@ static bool do_cmd_bash_aux(int y, int x, int dir)
 
        cptr name = f_name + f_info[get_feat_mimic(c_ptr)].name;
 
-       /* Take a turn */
        p_ptr->energy_use = 100;
 
-       /* Message */
        msg_format(_("%sに体当たりをした!", "You smash into the %s!"), name);
 
-       /* Compare bash power to door power XXX XXX XXX */
+       /* Compare bash power to door power */
        temp = (bash - (temp * 10));
 
        if (p_ptr->pclass == CLASS_BERSERKER) temp *= 2;
@@ -2110,10 +1631,8 @@ static bool do_cmd_bash_aux(int y, int x, int dir)
        /* Hack -- attempt to bash down the door */
        if (randint0(100) < temp)
        {
-               /* Message */
                msg_format(_("%sを壊した!", "The %s crashes open!"), name);
 
-               /* Sound */
                sound(have_flag(f_ptr->flags, FF_GLASS) ? SOUND_GLASS : SOUND_OPENDOOR);
 
                /* Break down the door */
@@ -2136,7 +1655,6 @@ static bool do_cmd_bash_aux(int y, int x, int dir)
        else if (randint0(100) < adj_dex_safe[p_ptr->stat_ind[A_DEX]] +
                 p_ptr->lev)
        {
-               /* Message */
                msg_format(_("この%sは頑丈だ。", "The %s holds firm."), name);
 
                /* Allow repeated bashing */
@@ -2146,14 +1664,11 @@ static bool do_cmd_bash_aux(int y, int x, int dir)
        /* High dexterity yields coolness */
        else
        {
-               /* Message */
                msg_print(_("体のバランスをくずしてしまった。", "You are off-balance."));
 
                /* Hack -- Lose balance ala paralysis */
                (void)set_paralyzed(p_ptr->paralyzed + 2 + randint0(2));
        }
-
-       /* Result */
        return (more);
 }
 
@@ -2206,11 +1721,11 @@ void do_cmd_bash(void)
        /* Get a "repeated" direction */
        if (get_rep_dir(&dir,FALSE))
        {
-               s16b feat;
+               FEAT_IDX feat;
 
                /* Bash location */
-               y = py + ddy[dir];
-               x = px + ddx[dir];
+               y = p_ptr->y + ddy[dir];
+               x = p_ptr->x + ddx[dir];
 
                /* Get grid */
                c_ptr = &cave[y][x];
@@ -2221,17 +1736,14 @@ void do_cmd_bash(void)
                /* Nothing useful */
                if (!have_flag(f_info[feat].flags, FF_BASH))
                {
-                       /* Message */
                        msg_print(_("そこには体当たりするものが見当たらない。", "You see nothing there to bash."));
                }
 
                /* Monster in the way */
                else if (c_ptr->m_idx)
                {
-                       /* Take a turn */
                        p_ptr->energy_use = 100;
 
-                       /* Message */
                        msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
 
                        /* Attack */
@@ -2247,7 +1759,7 @@ void do_cmd_bash(void)
        }
 
        /* Unless valid action taken, cancel bash */
-       if (!more) disturb(0, 0);
+       if (!more) disturb(FALSE, FALSE);
 }
 
 
@@ -2260,7 +1772,7 @@ void do_cmd_bash(void)
  *
  * Attack monsters, tunnel through walls, disarm traps, open doors.
  *
- * Consider confusion XXX XXX XXX
+ * Consider confusion 
  *
  * This command must always take a turn, to prevent free detection
  * of invisible monsters.
@@ -2296,12 +1808,12 @@ void do_cmd_alter(void)
        /* Get a direction */
        if (get_rep_dir(&dir,TRUE))
        {
-               s16b feat;
+               FEAT_IDX feat;
                feature_type *f_ptr;
 
                /* Get location */
-               y = py + ddy[dir];
-               x = px + ddx[dir];
+               y = p_ptr->y + ddy[dir];
+               x = p_ptr->x + ddx[dir];
 
                /* Get grid */
                c_ptr = &cave[y][x];
@@ -2310,7 +1822,6 @@ void do_cmd_alter(void)
                feat = get_feat_mimic(c_ptr);
                f_ptr = &f_info[feat];
 
-               /* Take a turn */
                p_ptr->energy_use = 100;
 
                /* Attack monsters */
@@ -2350,16 +1861,14 @@ void do_cmd_alter(void)
                        more = do_cmd_disarm_aux(y, x, dir);
                }
 
-               /* Oops */
                else
                {
-                       /* Oops */
                        msg_print(_("何もない空中を攻撃した。", "You attack the empty air."));
                }
        }
 
        /* Cancel repetition unless we can continue */
-       if (!more) disturb(0, 0);
+       if (!more) disturb(FALSE, FALSE);
 }
 
 
@@ -2371,12 +1880,12 @@ void do_cmd_alter(void)
  * @return オブジェクトがある場合TRUEを返す
  * @details
  * <pre>
- * XXX XXX XXX Let user choose a pile of spikes, perhaps?
+ * Let user choose a pile of spikes, perhaps?
  * </pre>
  */
-static bool get_spike(int *ip)
+static bool get_spike(INVENTORY_IDX *ip)
 {
-       int i;
+       INVENTORY_IDX i;
 
        /* Check every item in the pack */
        for (i = 0; i < INVEN_PACK; i++)
@@ -2397,7 +1906,6 @@ static bool get_spike(int *ip)
                }
        }
 
-       /* Oops */
        return (FALSE);
 }
 
@@ -2413,7 +1921,7 @@ static bool get_spike(int *ip)
  */
 void do_cmd_spike(void)
 {
-       int dir;
+       DIRECTION dir;
 
        if (p_ptr->special_defense & KATA_MUSOU)
        {
@@ -2423,13 +1931,14 @@ void do_cmd_spike(void)
        /* Get a "repeated" direction */
        if (get_rep_dir(&dir,FALSE))
        {
-               int y, x, item;
+               POSITION y, x;
+               INVENTORY_IDX item;
                cave_type *c_ptr;
-               s16b feat;
+               FEAT_IDX feat;
 
                /* Get location */
-               y = py + ddy[dir];
-               x = px + ddx[dir];
+               y = p_ptr->y + ddy[dir];
+               x = p_ptr->x + ddx[dir];
 
                /* Get grid and contents */
                c_ptr = &cave[y][x];
@@ -2440,24 +1949,20 @@ void do_cmd_spike(void)
                /* Require closed door */
                if (!have_flag(f_info[feat].flags, FF_SPIKE))
                {
-                       /* Message */
                        msg_print(_("そこにはくさびを打てるものが見当たらない。", "You see nothing there to spike."));
                }
 
                /* Get a spike */
                else if (!get_spike(&item))
                {
-                       /* Message */
                        msg_print(_("くさびを持っていない!", "You have no spikes!"));
                }
 
                /* Is a monster in the way? */
                else if (c_ptr->m_idx)
                {
-                       /* Take a turn */
                        p_ptr->energy_use = 100;
 
-                       /* Message */
                        msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
 
                        /* Attack */
@@ -2467,7 +1972,6 @@ void do_cmd_spike(void)
                /* Go for it */
                else
                {
-                       /* Take a turn */
                        p_ptr->energy_use = 100;
 
                        /* Successful jamming */
@@ -2492,7 +1996,7 @@ void do_cmd_spike(void)
  */
 void do_cmd_walk(bool pickup)
 {
-       int dir;
+       DIRECTION dir;
 
        bool more = FALSE;
 
@@ -2511,9 +2015,8 @@ void do_cmd_walk(bool pickup)
        }
 
        /* Get a "repeated" direction */
-       if (get_rep_dir(&dir,FALSE))
+       if (get_rep_dir(&dir, FALSE))
        {
-               /* Take a turn */
                p_ptr->energy_use = 100;
 
                if ((dir != 5) && (p_ptr->special_defense & KATA_MUSOU))
@@ -2533,12 +2036,12 @@ void do_cmd_walk(bool pickup)
        }
 
        /* Hack again -- Is there a special encounter ??? */
-       if (p_ptr->wild_mode && !cave_have_flag_bold(py, px, FF_TOWN))
+       if (p_ptr->wild_mode && !cave_have_flag_bold(p_ptr->y, p_ptr->x, FF_TOWN))
        {
-               int tmp = 120 + p_ptr->lev*10 - wilderness[py][px].level + 5;
+               int tmp = 120 + p_ptr->lev*10 - wilderness[p_ptr->y][p_ptr->x].level + 5;
                if (tmp < 1) 
                        tmp = 1;
-               if (((wilderness[py][px].level + 5) > (p_ptr->lev / 2)) && randint0(tmp) < (21-p_ptr->skill_stl))
+               if (((wilderness[p_ptr->y][p_ptr->x].level + 5) > (p_ptr->lev / 2)) && randint0(tmp) < (21-p_ptr->skill_stl))
                {
                        /* Inform the player of his horrible fate :=) */
                        msg_print(_("襲撃だ!", "You are ambushed !"));
@@ -2557,7 +2060,7 @@ void do_cmd_walk(bool pickup)
        }
 
        /* Cancel repeat unless we may continue */
-       if (!more) disturb(0, 0);
+       if (!more) disturb(FALSE, FALSE);
 }
 
 
@@ -2568,7 +2071,7 @@ void do_cmd_walk(bool pickup)
  */
 void do_cmd_run(void)
 {
-       int dir;
+       DIRECTION dir;
 
        /* Hack -- no running when confused */
        if (p_ptr->confused)
@@ -2618,11 +2121,10 @@ void do_cmd_stay(bool pickup)
                command_arg = 0;
        }
 
-       /* Take a turn */
        p_ptr->energy_use = 100;
 
        if (pickup) mpe_mode |= MPE_DO_PICKUP;
-       (void)move_player_effect(py, px, mpe_mode);
+       (void)move_player_effect(p_ptr->y, p_ptr->x, mpe_mode);
 }
 
 
@@ -2636,7 +2138,7 @@ void do_cmd_rest(void)
 
        set_action(ACTION_NONE);
 
-       if ((p_ptr->pclass == CLASS_BARD) && (p_ptr->magic_num1[0] || p_ptr->magic_num1[1]))
+       if ((p_ptr->pclass == CLASS_BARD) && (SINGING_SONG_EFFECT(p_ptr) || INTERUPTING_SONG_EFFECT(p_ptr)))
        {
                stop_singing();
        }
@@ -2662,19 +2164,19 @@ void do_cmd_rest(void)
                /* Rest until done */
                if (out_val[0] == '&')
                {
-                       command_arg = (-2);
+                       command_arg = COMMAND_ARG_REST_UNTIL_DONE;
                }
 
                /* Rest a lot */
                else if (out_val[0] == '*')
                {
-                       command_arg = (-1);
+                       command_arg = COMMAND_ARG_REST_FULL_HEALING;
                }
 
                /* Rest some */
                else
                {
-                       command_arg = atoi(out_val);
+                       command_arg = (COMMAND_ARG)atoi(out_val);
                        if (command_arg <= 0) return;
                }
        }
@@ -2685,7 +2187,7 @@ void do_cmd_rest(void)
 
        if (p_ptr->special_defense & NINJA_S_STEALTH) set_superstealth(FALSE);
 
-       /* Take a turn XXX XXX XXX (?) */
+       /* Take a turn (?) */
        p_ptr->energy_use = 100;
 
        /* The sin of sloth */
@@ -2712,8 +2214,6 @@ void do_cmd_rest(void)
 
        /* Redraw the state */
        p_ptr->redraw |= (PR_STATE);
-
-       /* Handle stuff */
        handle_stuff();
 
        /* Refresh */
@@ -2729,9 +2229,9 @@ void do_cmd_rest(void)
  * @details
  * Note that artifacts never break, see the "drop_near()" function.
  */
-static int breakage_chance(object_type *o_ptr)
+static PERCENTAGE breakage_chance(object_type *o_ptr)
 {
-       int archer_bonus = (p_ptr->pclass == CLASS_ARCHER ? (p_ptr->lev-1)/7 + 4: 0);
+       PERCENTAGE archer_bonus = (p_ptr->pclass == CLASS_ARCHER ? (PERCENTAGE)(p_ptr->lev-1)/7 + 4: 0);
 
        /* Examine the snipe type */
        if (snipe_type)
@@ -2793,7 +2293,7 @@ static s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr)
 
        monster_race *r_ptr = &r_info[m_ptr->r_idx];
 
-       u32b flgs[TR_FLAG_SIZE];
+       BIT_FLAGS flgs[TR_FLAG_SIZE];
 
        /* Extract the flags */
        object_flags(o_ptr, flgs);
@@ -3188,13 +2688,15 @@ static s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr)
  * Note that Bows of "Extra Shots" give an extra shot.
  * </pre>
  */
-void do_cmd_fire_aux(int item, object_type *j_ptr)
+void do_cmd_fire_aux(INVENTORY_IDX item, object_type *j_ptr)
 {
-       int dir;
-       int i, j, y, x, ny, nx, ty, tx, prev_y, prev_x;
+       DIRECTION dir;
+       int i;
+       POSITION y, x, ny, nx, ty, tx, prev_y, prev_x;
        int tdam_base, tdis, thits, tmul;
        int bonus, chance;
        int cur_dis, visible;
+       PERCENTAGE j;
 
        object_type forge;
        object_type *q_ptr;
@@ -3225,7 +2727,6 @@ void do_cmd_fire_aux(int item, object_type *j_ptr)
        /* Sniper - Cannot shot a single arrow twice */
        if ((snipe_type == SP_DOUBLE) && (o_ptr->number < 2)) snipe_type = SP_NONE;
 
-       /* Describe the object */
        object_desc(o_name, o_ptr, OD_OMIT_PREFIX);
 
        /* Use the proper number of shots */
@@ -3281,8 +2782,8 @@ void do_cmd_fire_aux(int item, object_type *j_ptr)
        }
 
        /* Predict the "target" location */
-       tx = px + 99 * ddx[dir];
-       ty = py + 99 * ddy[dir];
+       tx = p_ptr->x + 99 * ddx[dir];
+       ty = p_ptr->y + 99 * ddy[dir];
 
        /* Check for "target request" */
        if ((dir == 5) && target_okay())
@@ -3292,12 +2793,12 @@ void do_cmd_fire_aux(int item, object_type *j_ptr)
        }
 
        /* Get projection path length */
-       tdis = project_path(path_g, project_length, py, px, ty, tx, PROJECT_PATH|PROJECT_THRU) - 1;
+       tdis = project_path(path_g, project_length, p_ptr->y, p_ptr->x, ty, tx, PROJECT_PATH|PROJECT_THRU) - 1;
 
        project_length = 0; /* reset to default */
 
        /* Don't shoot at my feet */
-       if (tx == px && ty == py)
+       if (tx == p_ptr->x && ty == p_ptr->y)
        {
                p_ptr->energy_use = 0;
 
@@ -3319,10 +2820,8 @@ void do_cmd_fire_aux(int item, object_type *j_ptr)
        {
 
        /* Start at the player */
-       y = py;
-       x = px;
-
-       /* Get local object */
+       y = p_ptr->y;
+       x = p_ptr->x;
        q_ptr = &forge;
 
        /* Obtain a local object */
@@ -3346,10 +2845,7 @@ void do_cmd_fire_aux(int item, object_type *j_ptr)
                floor_item_optimize(0 - item);
        }
 
-       /* Sound */
        sound(SOUND_SHOOT);
-
-       /* Hack -- Handle stuff */
        handle_stuff();
 
        /* Save the old location */
@@ -3370,7 +2866,7 @@ void do_cmd_fire_aux(int item, object_type *j_ptr)
                /* Calculate the new location (see "project()") */
                ny = y;
                nx = x;
-               mmove2(&ny, &nx, py, px, ty, tx);
+               mmove2(&ny, &nx, p_ptr->y, p_ptr->x, ty, tx);
 
                /* Shatter Arrow */
                if (snipe_type == SP_KILL_WALL)
@@ -3404,10 +2900,8 @@ void do_cmd_fire_aux(int item, object_type *j_ptr)
                {
                        cave[ny][nx].info |= (CAVE_GLOW);
 
-                       /* Notice */
                        note_spot(ny, nx);
 
-                       /* Redraw */
                        lite_spot(ny, nx);
                }
 
@@ -3445,10 +2939,8 @@ void do_cmd_fire_aux(int item, object_type *j_ptr)
                {
                        cave[ny][nx].info &= ~(CAVE_GLOW | CAVE_MARK);
 
-                       /* Notice */
                        note_spot(ny, nx);
 
-                       /* Redraw */
                        lite_spot(ny, nx);
                }
 
@@ -3464,10 +2956,9 @@ void do_cmd_fire_aux(int item, object_type *j_ptr)
                /* Monster here, Try to hit it */
                if (cave[y][x].m_idx)
                {
-                       int armour;
-                       cave_type *c_ptr = &cave[y][x];
+                       cave_type *c_mon_ptr = &cave[y][x];
 
-                       monster_type *m_ptr = &m_list[c_ptr->m_idx];
+                       monster_type *m_ptr = &m_list[c_mon_ptr->m_idx];
                        monster_race *r_ptr = &r_info[m_ptr->r_idx];
 
                        /* Check the visibility */
@@ -3487,7 +2978,7 @@ void do_cmd_fire_aux(int item, object_type *j_ptr)
                                int now_exp = p_ptr->weapon_exp[0][j_ptr->sval];
                                if (now_exp < s_info[p_ptr->pclass].w_max[0][j_ptr->sval])
                                {
-                                       int amount = 0;
+                                       SUB_EXP amount = 0;
                                        if (now_exp < WEAPON_EXP_BEGINNER) amount = 80;
                                        else if (now_exp < WEAPON_EXP_SKILLED) amount = 25;
                                        else if ((now_exp < WEAPON_EXP_EXPERT) && (p_ptr->lev > 19)) amount = 10;
@@ -3508,14 +2999,6 @@ void do_cmd_fire_aux(int item, object_type *j_ptr)
                                }
                        }
 
-                       /* Some shots have hit bonus */
-                       armour = r_ptr->ac;
-                       if (p_ptr->concent)
-                       {
-                               armour *= (8 - p_ptr->concent);
-                               armour /= 8;
-                       }
-
                        /* Did we hit it (penalize range) */
                        if (test_hit_fire(chance - cur_dis, m_ptr, m_ptr->ml, o_name))
                        {
@@ -3540,7 +3023,6 @@ void do_cmd_fire_aux(int item, object_type *j_ptr)
                                        /* Get "the monster" or "it" */
                                        monster_desc(m_name, m_ptr, 0);
 
-                                       /* Message */
                                        msg_format(_("%sが%sに命中した。", "The %s hits %s."), o_name, m_name);
 
                                        if (m_ptr->ml)
@@ -3549,7 +3031,7 @@ void do_cmd_fire_aux(int item, object_type *j_ptr)
                                                if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
 
                                                /* Hack -- Track this monster */
-                                               health_track(c_ptr->m_idx);
+                                               health_track(c_mon_ptr->m_idx);
                                        }
                                }
 
@@ -3570,7 +3052,7 @@ void do_cmd_fire_aux(int item, object_type *j_ptr)
                                }
                                else
                                {
-                                       /* Apply special damage XXX XXX XXX */
+                                       /* Apply special damage */
                                        tdam = tot_dam_aux_shot(q_ptr, tdam, m_ptr);
                                        tdam = critical_shot(q_ptr->weight, q_ptr->to_h, j_ptr->to_h, tdam);
 
@@ -3581,11 +3063,9 @@ void do_cmd_fire_aux(int item, object_type *j_ptr)
                                        tdam = mon_damage_mod(m_ptr, tdam, FALSE);
                                }
 
-                               /* Complex message */
-                               if (p_ptr->wizard || cheat_xtra)
-                               {
-                                       msg_format(_("%d/%d のダメージを与えた。", "You do %d (out of %d) damage."), tdam, m_ptr->hp);
-                               }
+                               msg_format_wizard(CHEAT_MONSTER,
+                                       _("%dのダメージを与えた。(残りHP %d/%d(%d))", "You do %d damage. (left HP %d/%d(%d))"),
+                                       tdam, m_ptr->hp - tdam, m_ptr->maxhp, m_ptr->max_maxhp);
 
                                /* Sniper */
                                if (snipe_type == SP_EXPLODE)
@@ -3602,15 +3082,13 @@ void do_cmd_fire_aux(int item, object_type *j_ptr)
                                {
                                        cave[ny][nx].info |= (CAVE_GLOW);
 
-                                       /* Notice */
                                        note_spot(ny, nx);
 
-                                       /* Redraw */
                                        lite_spot(ny, nx);
                                }
 
                                /* Hit the monster, check for death */
-                               if (mon_take_hit(c_ptr->m_idx, tdam, &fear, extract_note_dies(real_r_ptr(m_ptr))))
+                               if (mon_take_hit(c_mon_ptr->m_idx, tdam, &fear, extract_note_dies(real_r_ptr(m_ptr))))
                                {
                                        /* Dead monster */
                                }
@@ -3630,8 +3108,7 @@ void do_cmd_fire_aux(int item, object_type *j_ptr)
                                                msg_format(_("%sは%sに突き刺さった!", "%^s have stuck into %s!"),o_name, m_name);
                                        }
 
-                                       /* Message */
-                                       message_pain(c_ptr->m_idx, tdam);
+                                       message_pain(c_mon_ptr->m_idx, tdam);
 
                                        /* Anger the monster */
                                        if (tdam > 0) anger_monster(m_ptr);
@@ -3641,33 +3118,31 @@ void do_cmd_fire_aux(int item, object_type *j_ptr)
                                        {
                                                char m_name[80];
 
-                                               /* Sound */
                                                sound(SOUND_FLEE);
 
                                                /* Get the monster name (or "it") */
                                                monster_desc(m_name, m_ptr, 0);
 
-                                               /* Message */
                                                msg_format(_("%^sは恐怖して逃げ出した!", "%^s flees in terror!"), m_name);
                                        }
 
-                                       set_target(m_ptr, py, px);
+                                       set_target(m_ptr, p_ptr->y, p_ptr->x);
 
                                        /* Sniper */
                                        if (snipe_type == SP_RUSH)
                                        {
                                                int n = randint1(5) + 3;
-                                               int m_idx = c_ptr->m_idx;
+                                               MONSTER_IDX m_idx = c_mon_ptr->m_idx;
 
                                                for ( ; cur_dis <= tdis; )
                                                {
-                                                       int ox = nx;
-                                                       int oy = ny;
+                                                       POSITION ox = nx;
+                                                       POSITION oy = ny;
 
                                                        if (!n) break;
 
                                                        /* Calculate the new location (see "project()") */
-                                                       mmove2(&ny, &nx, py, px, ty, tx);
+                                                       mmove2(&ny, &nx, p_ptr->y, p_ptr->x, ty, tx);
 
                                                        /* Stopped by wilderness boundary */
                                                        if (!in_bounds2(ny, nx)) break;
@@ -3685,7 +3160,7 @@ void do_cmd_fire_aux(int item, object_type *j_ptr)
                                                        m_ptr->fy = ny;
 
                                                        /* Update the monster (new location) */
-                                                       update_mon(c_ptr->m_idx, TRUE);
+                                                       update_monster(c_mon_ptr->m_idx, TRUE);
 
                                                        lite_spot(ny, nx);
                                                        lite_spot(oy, ox);
@@ -3720,9 +3195,9 @@ void do_cmd_fire_aux(int item, object_type *j_ptr)
 
        if (stick_to)
        {
-               int m_idx = cave[y][x].m_idx;
+               MONSTER_IDX m_idx = cave[y][x].m_idx;
                monster_type *m_ptr = &m_list[m_idx];
-               int o_idx = o_pop();
+               OBJECT_IDX o_idx = o_pop();
 
                if (!o_idx)
                {
@@ -3776,7 +3251,7 @@ void do_cmd_fire_aux(int item, object_type *j_ptr)
  */
 void do_cmd_fire(void)
 {
-       int item;
+       OBJECT_IDX item;
        object_type *j_ptr;
        cptr q, s;
 
@@ -3800,6 +3275,13 @@ void do_cmd_fire(void)
                return;
        }
 
+       if (j_ptr->sval == SV_HARP)
+       {
+               msg_print(_("この武器で射撃はできない。", "It's not for firing."));
+               flush();
+               return;
+       }
+
 
        if (p_ptr->special_defense & KATA_MUSOU)
        {
@@ -3809,7 +3291,6 @@ void do_cmd_fire(void)
        /* Require proper missile */
        item_tester_tval = p_ptr->tval_ammo;
 
-       /* Get an item */
        q = _("どれを撃ちますか? ", "Fire which item? ");
        s = _("発射されるアイテムがありません。", "You have nothing to fire.");
        if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR)))
@@ -3836,22 +3317,9 @@ void do_cmd_fire(void)
        }
 }
 
-/*!
- * @brief オブジェクトが投射可能な武器かどうかを返す。
- * @param o_ptr 判定するオブジェクトの構造体参照ポインタ
- * @return 投射可能な武器ならばTRUE
- */
-static bool item_tester_hook_boomerang(object_type *o_ptr)
-{
-       if ((o_ptr->tval==TV_DIGGING) || (o_ptr->tval == TV_SWORD) || (o_ptr->tval == TV_POLEARM) || (o_ptr->tval == TV_HAFTED)) return (TRUE);
-
-       /* Assume not */
-       return (FALSE);
-}
-
 
 /*!
- * @brief æ\8a\95å°\84å\87¦ç\90\86ã\81®ã\82µã\83\96ルーチン /
+ * @brief æ\8a\95å°\84å\87¦ç\90\86ã\83¡ã\82¤ã\83³ルーチン /
  * Throw an object from the pack or floor.
  * @param mult 威力の倍率
  * @param boomerang ブーメラン処理ならばTRUE
@@ -3866,14 +3334,17 @@ static bool item_tester_hook_boomerang(object_type *o_ptr)
  * the item to be destroyed?  Should it do any damage at all?
  * </pre>
  */
-bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken)
+bool do_cmd_throw(int mult, bool boomerang, OBJECT_IDX shuriken)
 {
-       int dir, item;
-       int i, j, y, x, ty, tx, prev_y, prev_x;
-       int ny[19], nx[19];
+       DIRECTION dir;
+       OBJECT_IDX item;
+       int i;
+       POSITION y, x, ty, tx, prev_y, prev_x;
+       POSITION ny[19], nx[19];
        int chance, tdam, tdis;
        int mul, div, dd, ds;
        int cur_dis, visible;
+       PERCENTAGE j;
 
        object_type forge;
        object_type *q_ptr;
@@ -3889,7 +3360,7 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken)
 
        int msec = delay_factor * delay_factor * delay_factor;
 
-       u32b flgs[TR_FLAG_SIZE];
+       BIT_FLAGS flgs[TR_FLAG_SIZE];
        cptr q, s;
        bool come_back = FALSE;
        bool do_drop = TRUE;
@@ -3922,7 +3393,6 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken)
        }
        else
        {
-               /* Get an item */
                q = _("どのアイテムを投げますか? ", "Throw which item? ");
                s = _("投げるアイテムがない。", "You have nothing to throw.");
                if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR | USE_EQUIP)))
@@ -3942,14 +3412,11 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken)
                o_ptr = &o_list[0 - item];
        }
 
-
        /* Item is cursed */
        if (object_is_cursed(o_ptr) && (item >= INVEN_RARM))
        {
-               /* Oops */
                msg_print(_("ふーむ、どうやら呪われているようだ。", "Hmmm, it seems to be cursed."));
 
-               /* Nope */
                return FALSE;
        }
 
@@ -3960,12 +3427,10 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken)
                        msg_print(_("アリーナではアイテムを使えない!", "You're in the arena now. This is hand-to-hand!"));
                        msg_print(NULL);
 
-                       /* Nope */
                        return FALSE;
                }
-       }
 
-       /* Get local object */
+       }
        q_ptr = &forge;
 
        /* Obtain a local object */
@@ -4002,8 +3467,8 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken)
 
        if (shuriken >= 0)
        {
-               ty = randint0(101)-50+py;
-               tx = randint0(101)-50+px;
+               ty = randint0(101) - 50 + p_ptr->y;
+               tx = randint0(101) - 50 + p_ptr->x;
        }
        else
        {
@@ -4013,8 +3478,8 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken)
                if (!get_aim_dir(&dir)) return FALSE;
 
                /* Predict the "target" location */
-               tx = px + 99 * ddx[dir];
-               ty = py + 99 * ddy[dir];
+               tx = p_ptr->x + 99 * ddx[dir];
+               ty = p_ptr->y + 99 * ddy[dir];
 
                /* Check for "target request" */
                if ((dir == 5) && target_okay())
@@ -4051,7 +3516,6 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken)
                p_ptr->redraw |= (PR_EQUIPPY);
        }
 
-       /* Take a turn */
        p_ptr->energy_use = 100;
 
        /* Rogue and Ninja gets bonus */
@@ -4059,11 +3523,9 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken)
                p_ptr->energy_use -= p_ptr->lev;
 
        /* Start at the player */
-       y = py;
-       x = px;
-
+       y = p_ptr->y;
+       x = p_ptr->x;
 
-       /* Hack -- Handle stuff */
        handle_stuff();
 
        if ((p_ptr->pclass == CLASS_NINJA) && ((q_ptr->tval == TV_SPIKE) || ((have_flag(flgs, TR_THROW)) && (q_ptr->tval == TV_SWORD)))) shuriken = TRUE;
@@ -4089,7 +3551,7 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken)
                /* Calculate the new location (see "project()") */
                ny[cur_dis] = y;
                nx[cur_dis] = x;
-               mmove2(&ny[cur_dis], &nx[cur_dis], py, px, ty, tx);
+               mmove2(&ny[cur_dis], &nx[cur_dis], p_ptr->y, p_ptr->x, ty, tx);
 
                /* Stopped by walls/doors */
                if (!cave_have_flag_bold(ny[cur_dis], nx[cur_dis], FF_PROJECT))
@@ -4135,7 +3597,6 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken)
                if (cave[y][x].m_idx)
                {
                        cave_type *c_ptr = &cave[y][x];
-
                        monster_type *m_ptr = &m_list[c_ptr->m_idx];
 
                        /* Check the visibility */
@@ -4164,7 +3625,6 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken)
                                        /* Get "the monster" or "it" */
                                        monster_desc(m_name, m_ptr, 0);
 
-                                       /* Message */
                                        msg_format(_("%sが%sに命中した。", "The %s hits %s."), o_name, m_name);
 
                                        if (m_ptr->ml)
@@ -4182,7 +3642,7 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken)
                                ds = q_ptr->ds;
                                torch_dice(q_ptr, &dd, &ds); /* throwing a torch */
                                tdam = damroll(dd, ds);
-                               /* Apply special damage XXX XXX XXX */
+                               /* Apply special damage */
                                tdam = tot_dam_aux(q_ptr, tdam, m_ptr, 0, TRUE);
                                tdam = critical_shot(q_ptr->weight, q_ptr->to_h, 0, tdam);
                                if (q_ptr->to_d > 0)
@@ -4215,11 +3675,8 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken)
                                /* Modify the damage */
                                tdam = mon_damage_mod(m_ptr, tdam, FALSE);
 
-                               /* Complex message */
-                               if (p_ptr->wizard)
-                               {
-                                       msg_format(_("%d/%dのダメージを与えた。", "You do %d (out of %d) damage."), tdam, m_ptr->hp);
-                               }
+                               msg_format_wizard(CHEAT_MONSTER, _("%dのダメージを与えた。(残りHP %d/%d(%d))", "You do %d damage. (left HP %d/%d(%d))"),
+                                       tdam, m_ptr->hp - tdam, m_ptr->maxhp, m_ptr->max_maxhp);
 
                                /* Hit the monster, check for death */
                                if (mon_take_hit(c_ptr->m_idx, tdam, &fear, extract_note_dies(real_r_ptr(m_ptr))))
@@ -4230,7 +3687,6 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken)
                                /* No death */
                                else
                                {
-                                       /* Message */
                                        message_pain(c_ptr->m_idx, tdam);
 
                                        /* Anger the monster */
@@ -4242,13 +3698,11 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken)
                                        {
                                                char m_name[80];
 
-                                               /* Sound */
                                                sound(SOUND_FLEE);
 
                                                /* Get the monster name (or "it") */
                                                monster_desc(m_name, m_ptr, 0);
 
-                                               /* Message */
                                                msg_format(_("%^sは恐怖して逃げ出した!", "%^s flees in terror!"), m_name);
                                        }
                                }
@@ -4284,7 +3738,6 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken)
        {
                if (hit_body || hit_wall || (randint1(100) < j))
                {
-                       /* Message */
                        msg_format(_("%sは砕け散った!", "The %s shatters!"), o_name);
 
                        if (potion_smash_effect(0, y, x, q_ptr->k_idx))
@@ -4359,8 +3812,8 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken)
                                {
                                        msg_format(_("%sが返ってきた。", "%s comes back."), o2_name);
                                }
-                               y = py;
-                               x = px;
+                               y = p_ptr->y;
+                               x = p_ptr->x;
                        }
                }
                else
@@ -4394,7 +3847,6 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken)
                        /* Recalculate mana XXX */
                        p_ptr->update |= (PU_MANA);
 
-                       /* Window stuff */
                        p_ptr->window |= (PW_EQUIP);
                }
                else
@@ -4428,17 +3880,6 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken)
 }
 
 
-/*!
- * @brief 投射処理のメインルーチン /
- * Throw an object from the pack or floor.
- * @return なし
- */
-void do_cmd_throw(void)
-{
-       do_cmd_throw_aux(1, FALSE, -1);
-}
-
-
 #ifdef TRAVEL
 /*
  * Hack: travel command
@@ -4447,8 +3888,8 @@ void do_cmd_throw(void)
 
 static int flow_head = 0;
 static int flow_tail = 0;
-static s16b temp2_x[MAX_SHORT];
-static s16b temp2_y[MAX_SHORT];
+static POSITION temp2_x[MAX_SHORT];
+static POSITION temp2_y[MAX_SHORT];
 
 /*!
  * @brief トラベル処理の記憶配列を初期化する Hack: forget the "flow" information 
@@ -4456,7 +3897,7 @@ static s16b temp2_y[MAX_SHORT];
  */
 void forget_travel_flow(void)
 {
-       int x, y;
+       POSITION x, y;
 
        /* Check the entire dungeon */
        for (y = 0; y < cur_hgt; y++)
@@ -4477,7 +3918,7 @@ void forget_travel_flow(void)
  * @param x 該当地点のX座標
  * @return コスト値
  */
-static int travel_flow_cost(int y, int x)
+static int travel_flow_cost(POSITION y, POSITION x)
 {
        feature_type *f_ptr = &f_info[cave[y][x].feat];
        int cost = 1;
@@ -4520,7 +3961,7 @@ static int travel_flow_cost(int y, int x)
  * @param wall プレイヤーが壁の中にいるならばTRUE
  * @return なし
  */
-static void travel_flow_aux(int y, int x, int n, bool wall)
+static void travel_flow_aux(POSITION y, POSITION x, int n, bool wall)
 {
        cave_type *c_ptr = &cave[y][x];
        feature_type *f_ptr = &f_info[c_ptr->feat];
@@ -4577,11 +4018,11 @@ static void travel_flow_aux(int y, int x, int n, bool wall)
  * @param tx 目標地点のX座標
  * @return なし
  */
-static void travel_flow(int ty, int tx)
+static void travel_flow(POSITION ty, POSITION tx)
 {
-       int x, y, d;
+       POSITION x, y, d;
        bool wall = FALSE;
-       feature_type *f_ptr = &f_info[cave[py][px].feat];
+       feature_type *f_ptr = &f_info[cave[p_ptr->y][p_ptr->x].feat];
 
        /* Reset the "queue" */
        flow_head = flow_tail = 0;
@@ -4623,7 +4064,8 @@ static void travel_flow(int ty, int tx)
  */
 void do_cmd_travel(void)
 {
-       int x, y, i;
+       POSITION x, y;
+       int i;
        int dx, dy, sx, sy;
        feature_type *f_ptr;
 
@@ -4635,7 +4077,7 @@ void do_cmd_travel(void)
        }
        else if (!tgt_pt(&x, &y)) return;
 
-       if ((x == px) && (y == py))
+       if ((x == p_ptr->x) && (y == p_ptr->y))
        {
                msg_print(_("すでにそこにいます!", "You are already there!!"));
                return;
@@ -4665,10 +4107,10 @@ void do_cmd_travel(void)
        travel.dir = 0;
 
        /* Decides first direction */
-       dx = abs(px - x);
-       dy = abs(py - y);
-       sx = ((x == px) || (dx < dy)) ? 0 : ((x > px) ? 1 : -1);
-       sy = ((y == py) || (dy < dx)) ? 0 : ((y > py) ? 1 : -1);
+       dx = abs(p_ptr->x - x);
+       dy = abs(p_ptr->y - y);
+       sx = ((x == p_ptr->x) || (dx < dy)) ? 0 : ((x > p_ptr->x) ? 1 : -1);
+       sy = ((y == p_ptr->y) || (dy < dx)) ? 0 : ((y > p_ptr->y) ? 1 : -1);
 
        for (i = 1; i <= 9; i++)
        {