OSDN Git Service

#37287 #37353 (2.2.0.89) 型の置換を継続中。 / Ongoing type replacement.
[hengband/hengband.git] / src / cmd2.c
index b0d2e85..bbd673c 100644 (file)
@@ -55,7 +55,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;
@@ -117,7 +117,7 @@ void do_cmd_go_up(void)
                p_ptr->oldpy = 0;
                
                /* Hack -- take a turn */
-               energy_use = 100;
+               p_ptr->energy_use = 100;
 
                /* End the command */
                return;
@@ -136,7 +136,7 @@ void do_cmd_go_up(void)
        if (!go_up) return;
 
        /* Hack -- take a turn */
-       energy_use = 100;
+       p_ptr->energy_use = 100;
 
        if (autosave_l) do_cmd_save_game(TRUE);
 
@@ -205,7 +205,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;
@@ -276,7 +276,7 @@ void do_cmd_go_down(void)
                
                
         /* Hack -- take a turn */
-        energy_use = 100;
+        p_ptr->energy_use = 100;
        }
 
        else
@@ -300,8 +300,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;
 
                        /*
@@ -312,7 +312,7 @@ void do_cmd_go_down(void)
                }
 
                /* Hack -- take a turn */
-               energy_use = 100;
+               p_ptr->energy_use = 100;
 
                if (autosave_l) do_cmd_save_game(TRUE);
 
@@ -398,7 +398,7 @@ void do_cmd_search(void)
        }
 
        /* Take a turn */
-       energy_use = 100;
+       p_ptr->energy_use = 100;
 
        /* Search */
        search();
@@ -648,7 +648,7 @@ static void chest_trap(int y, int x, s16b o_idx)
                for (i = 0; i < num; i++)
                {
                        if (randint1(100)<dun_level)
-                               activate_hi_summon(py, px, FALSE);
+                               activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
                        else
                                (void)summon_specific(0, y, x, mon_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
                }
@@ -811,7 +811,7 @@ static bool do_cmd_open_chest(int y, int x, s16b o_idx)
 
 
        /* Take a turn */
-       energy_use = 100;
+       p_ptr->energy_use = 100;
 
        /* Attempt to unlock it */
        if (o_ptr->pval > 0)
@@ -874,7 +874,7 @@ static bool do_cmd_open_chest(int y, int x, s16b o_idx)
  * @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 +891,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;
 
@@ -908,8 +908,8 @@ static int count_dt(int *y, int *x, bool (*test)(int feat), bool under)
                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 +946,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;
+       IDX o_idx;
 
        object_type *o_ptr;
 
@@ -959,8 +960,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];
+               int yy = p_ptr->y + ddy_ddd[d];
+               int xx = p_ptr->x + ddx_ddd[d];
 
                /* No (visible) chest is there */
                if ((o_idx = chest_check(yy, xx, FALSE)) == 0) continue;
@@ -995,13 +996,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);
@@ -1036,7 +1037,7 @@ static bool do_cmd_open_aux(int y, int x)
 
 
        /* Take a turn */
-       energy_use = 100;
+       p_ptr->energy_use = 100;
 
        /* Seeing true feature code (ignore mimic) */
 
@@ -1119,9 +1120,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;
+       IDX o_idx;
 
        bool more = FALSE;
 
@@ -1174,8 +1175,8 @@ void do_cmd_open(void)
                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];
@@ -1197,7 +1198,7 @@ void do_cmd_open(void)
                else if (c_ptr->m_idx && p_ptr->riding != c_ptr->m_idx)
                {
                        /* Take a turn */
-                       energy_use = 100;
+                       p_ptr->energy_use = 100;
 
                        /* Message */
                        msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
@@ -1246,7 +1247,7 @@ static bool do_cmd_close_aux(int y, int x)
        bool      more = FALSE;
 
        /* Take a turn */
-       energy_use = 100;
+       p_ptr->energy_use = 100;
 
        /* Seeing true feature code (ignore mimic) */
 
@@ -1295,7 +1296,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;
 
@@ -1338,8 +1340,8 @@ void do_cmd_close(void)
                s16b 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];
@@ -1358,7 +1360,7 @@ void do_cmd_close(void)
                else if (c_ptr->m_idx)
                {
                        /* Take a turn */
-                       energy_use = 100;
+                       p_ptr->energy_use = 100;
 
                        /* Message */
                        msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
@@ -1439,7 +1441,7 @@ static bool do_cmd_tunnel_aux(int y, int x)
        if (!do_cmd_tunnel_test(y, x)) return (FALSE);
 
        /* Take a turn */
-       energy_use = 100;
+       p_ptr->energy_use = 100;
 
        /* Get grid */
        c_ptr = &cave[y][x];
@@ -1593,8 +1595,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];
@@ -1619,7 +1621,7 @@ void do_cmd_tunnel(void)
                else if (c_ptr->m_idx)
                {
                        /* Take a turn */
-                       energy_use = 100;
+                       p_ptr->energy_use = 100;
 
                        /* Message */
                        msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
@@ -1767,7 +1769,7 @@ static bool do_cmd_disarm_chest(int y, int x, s16b o_idx)
 
 
        /* Take a turn */
-       energy_use = 100;
+       p_ptr->energy_use = 100;
 
        /* Get the "disarm" factor */
        i = p_ptr->skill_dis;
@@ -1875,7 +1877,7 @@ static bool do_cmd_disarm_aux(int y, int x, int dir)
        int j;
 
        /* Take a turn */
-       energy_use = 100;
+       p_ptr->energy_use = 100;
 
        /* Penalize some conditions */
        if (p_ptr->blind || no_lite()) i = i / 10;
@@ -1956,8 +1958,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;
@@ -1983,8 +1985,7 @@ 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);
                }
        }
@@ -2011,8 +2012,8 @@ void do_cmd_disarm(void)
                s16b 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];
@@ -2094,7 +2095,7 @@ 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 */
-       energy_use = 100;
+       p_ptr->energy_use = 100;
 
        /* Message */
        msg_format(_("%sに体当たりをした!", "You smash into the %s!"), name);
@@ -2209,8 +2210,8 @@ void do_cmd_bash(void)
                s16b 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];
@@ -2229,7 +2230,7 @@ void do_cmd_bash(void)
                else if (c_ptr->m_idx)
                {
                        /* Take a turn */
-                       energy_use = 100;
+                       p_ptr->energy_use = 100;
 
                        /* Message */
                        msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
@@ -2300,8 +2301,8 @@ void do_cmd_alter(void)
                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];
@@ -2311,7 +2312,7 @@ void do_cmd_alter(void)
                f_ptr = &f_info[feat];
 
                /* Take a turn */
-               energy_use = 100;
+               p_ptr->energy_use = 100;
 
                /* Attack monsters */
                if (c_ptr->m_idx)
@@ -2428,8 +2429,8 @@ void do_cmd_spike(void)
                s16b 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];
@@ -2455,7 +2456,7 @@ void do_cmd_spike(void)
                else if (c_ptr->m_idx)
                {
                        /* Take a turn */
-                       energy_use = 100;
+                       p_ptr->energy_use = 100;
 
                        /* Message */
                        msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
@@ -2468,7 +2469,7 @@ void do_cmd_spike(void)
                else
                {
                        /* Take a turn */
-                       energy_use = 100;
+                       p_ptr->energy_use = 100;
 
                        /* Successful jamming */
                        msg_format(_("%sにくさびを打ち込んだ。", "You jam the %s with a spike."), f_name + f_info[feat].name);
@@ -2514,7 +2515,7 @@ void do_cmd_walk(bool pickup)
        if (get_rep_dir(&dir,FALSE))
        {
                /* Take a turn */
-               energy_use = 100;
+               p_ptr->energy_use = 100;
 
                if ((dir != 5) && (p_ptr->special_defense & KATA_MUSOU))
                {
@@ -2522,8 +2523,8 @@ void do_cmd_walk(bool pickup)
                }
 
                /* Hack -- In small scale wilderness it takes MUCH more time to move */
-               if (p_ptr->wild_mode) energy_use *= ((MAX_HGT + MAX_WID) / 2);
-               if (p_ptr->action == ACTION_HAYAGAKE) energy_use = energy_use * (45-(p_ptr->lev/2)) / 100;
+               if (p_ptr->wild_mode) p_ptr->energy_use *= ((MAX_HGT + MAX_WID) / 2);
+               if (p_ptr->action == ACTION_HAYAGAKE) p_ptr->energy_use = p_ptr->energy_use * (45-(p_ptr->lev/2)) / 100;
 
                /* Actually move the character */
                move_player(dir, pickup, FALSE);
@@ -2533,12 +2534,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 !"));
@@ -2549,7 +2550,7 @@ void do_cmd_walk(bool pickup)
                        change_wild_mode();
 
                        /* Give first move to monsters */
-                       energy_use = 100;
+                       p_ptr->energy_use = 100;
 
                        /* HACk -- set the encouter flag for the wilderness generation */
                        generate_encounter = TRUE;
@@ -2619,10 +2620,10 @@ void do_cmd_stay(bool pickup)
        }
 
        /* Take a turn */
-       energy_use = 100;
+       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);
 }
 
 
@@ -2674,7 +2675,7 @@ void do_cmd_rest(void)
                /* Rest some */
                else
                {
-                       command_arg = atoi(out_val);
+                       command_arg = (COMMAND_ARG)atoi(out_val);
                        if (command_arg <= 0) return;
                }
        }
@@ -2686,7 +2687,7 @@ void do_cmd_rest(void)
        if (p_ptr->special_defense & NINJA_S_STEALTH) set_superstealth(FALSE);
 
        /* Take a turn XXX XXX XXX (?) */
-       energy_use = 100;
+       p_ptr->energy_use = 100;
 
        /* The sin of sloth */
        if (command_arg > 100)
@@ -3244,7 +3245,7 @@ void do_cmd_fire_aux(int item, object_type *j_ptr)
        else
                chance = (p_ptr->skill_thb + ((p_ptr->weapon_exp[0][j_ptr->sval] - (WEAPON_EXP_MASTER / 2)) / 200 + bonus) * BTH_PLUS_ADJ);
 
-       energy_use = bow_energy(j_ptr->sval);
+       p_ptr->energy_use = bow_energy(j_ptr->sval);
        tmul = bow_tmul(j_ptr->sval);
 
        /* Get extra "power" from "extra might" */
@@ -3271,7 +3272,7 @@ void do_cmd_fire_aux(int item, object_type *j_ptr)
        /* Get a direction (or cancel) */
        if (!get_aim_dir(&dir))
        {
-               energy_use = 0;
+               p_ptr->energy_use = 0;
 
                if (snipe_type == SP_AWAY) snipe_type = SP_NONE;
 
@@ -3281,8 +3282,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,14 +3293,14 @@ 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)
        {
-               energy_use = 0;
+               p_ptr->energy_use = 0;
 
                /* project_length is already reset to 0 */
 
@@ -3308,7 +3309,7 @@ void do_cmd_fire_aux(int item, object_type *j_ptr)
 
 
        /* Take a (partial) turn */
-       energy_use = (energy_use / thits);
+       p_ptr->energy_use = (p_ptr->energy_use / thits);
        is_fired = TRUE;
 
        /* Sniper - Difficult to shot twice at 1 turn */
@@ -3319,8 +3320,8 @@ void do_cmd_fire_aux(int item, object_type *j_ptr)
        {
 
        /* Start at the player */
-       y = py;
-       x = px;
+       y = p_ptr->y;
+       x = p_ptr->x;
 
        /* Get local object */
        q_ptr = &forge;
@@ -3370,7 +3371,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)
@@ -3464,10 +3465,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 +3487,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 +3508,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))
                        {
@@ -3549,7 +3541,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);
                                        }
                                }
 
@@ -3581,11 +3573,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)
@@ -3610,7 +3600,7 @@ void do_cmd_fire_aux(int item, object_type *j_ptr)
                                }
 
                                /* 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 */
                                }
@@ -3631,7 +3621,7 @@ void do_cmd_fire_aux(int item, object_type *j_ptr)
                                        }
 
                                        /* 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);
@@ -3651,23 +3641,23 @@ void do_cmd_fire_aux(int item, object_type *j_ptr)
                                                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 +3675,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_mon(c_mon_ptr->m_idx, TRUE);
 
                                                        lite_spot(ny, nx);
                                                        lite_spot(oy, ox);
@@ -3720,9 +3710,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();
+               IDX o_idx = o_pop();
 
                if (!o_idx)
                {
@@ -3776,7 +3766,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 +3790,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)
        {
@@ -3866,9 +3863,10 @@ 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_aux(int mult, bool boomerang, OBJECT_IDX shuriken)
 {
-       int dir, item;
+       DIRECTION dir;
+       OBJECT_IDX item;
        int i, j, y, x, ty, tx, prev_y, prev_x;
        int ny[19], nx[19];
        int chance, tdam, tdis;
@@ -4002,8 +4000,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 +4011,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())
@@ -4052,15 +4050,15 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken)
        }
 
        /* Take a turn */
-       energy_use = 100;
+       p_ptr->energy_use = 100;
 
        /* Rogue and Ninja gets bonus */
        if ((p_ptr->pclass == CLASS_ROGUE) || (p_ptr->pclass == CLASS_NINJA))
-               energy_use -= p_ptr->lev;
+               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 */
@@ -4089,7 +4087,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))
@@ -4215,11 +4213,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))))
@@ -4359,8 +4354,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
@@ -4447,8 +4442,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 
@@ -4520,7 +4515,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];
@@ -4581,7 +4576,7 @@ static void travel_flow(int ty, int tx)
 {
        int 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 +4618,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 +4631,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 +4661,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++)
        {