OSDN Git Service

[Refactor] #38844 current_floor_ptr を player_type 構造体に加え, max_o_idx, max_m_idx を...
[hengband/hengband.git] / src / player-move.c
index 7622dba..097197f 100644 (file)
  */
 
 #include "angband.h"
+#include "core.h"
+#include "util.h"
+
+#include "realm-song.h"
+#include "autopick.h"
+#include "dungeon.h"
+#include "floor.h"
 #include "melee.h"
 #include "grid.h"
 #include "trap.h"
-#include "projection.h"
 #include "quest.h"
 #include "artifact.h"
 #include "player-move.h"
 #include "player-status.h"
+#include "player-effects.h"
+#include "player-class.h"
+#include "player-personality.h"
 #include "spells-floor.h"
 #include "feature.h"
 #include "warning.h"
+#include "monster.h"
+#include "monster-spell.h"
+#include "monster-status.h"
+#include "object-hook.h"
+#include "object-flavor.h"
+#include "spells.h"
+#include "cmd-basic.h"
+#include "view-mainwindow.h"
+#include "world.h"
+#include "objectkind.h"
+#include "autopick.h"
+#include "targeting.h"
 
 
+#ifdef TRAVEL
+ /* for travel */
+travel_type travel;
+#endif
 
 /*!
- * @brief 地形やその上のアイテムの隠された要素を明かす /
+ * @brief 地形やその上のアイテムの隠された要素を全て明かす /
  * Search for hidden things
  * @param y 対象となるマスのY座標
  * @param x 対象となるマスのX座標
@@ -165,53 +190,37 @@ static void discover_hidden_things(POSITION y, POSITION x)
 {
        OBJECT_IDX this_o_idx, next_o_idx = 0;
        grid_type *g_ptr;
-       g_ptr = &current_floor_ptr->grid_array[y][x];
+       g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x];
 
        /* Invisible trap */
        if (g_ptr->mimic && is_trap(g_ptr->feat))
        {
-               /* Pick a trap */
                disclose_grid(y, x);
-
                msg_print(_("トラップを発見した。", "You have found a trap."));
-
-               disturb(FALSE, TRUE);
+               disturb(p_ptr, FALSE, TRUE);
        }
 
        /* Secret door */
        if (is_hidden_door(g_ptr))
        {
                msg_print(_("隠しドアを発見した。", "You have found a secret door."));
-
-               /* Disclose */
                disclose_grid(y, x);
-
-               disturb(FALSE, FALSE);
+               disturb(p_ptr, FALSE, FALSE);
        }
 
        /* Scan all objects in the grid */
        for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
        {
                object_type *o_ptr;
-               o_ptr = &current_floor_ptr->o_list[this_o_idx];
+               o_ptr = &p_ptr->current_floor_ptr->o_list[this_o_idx];
                next_o_idx = o_ptr->next_o_idx;
-
-               /* Skip non-chests */
                if (o_ptr->tval != TV_CHEST) continue;
-
-               /* Skip non-trapped chests */
                if (!chest_traps[o_ptr->pval]) continue;
-
-               /* Identify once */
                if (!object_is_known(o_ptr))
                {
                        msg_print(_("箱に仕掛けられたトラップを発見した!", "You have discovered a trap on the chest!"));
-
-                       /* Know the trap */
                        object_known(o_ptr);
-
-                       /* Notice it */
-                       disturb(FALSE, FALSE);
+                       disturb(p_ptr, FALSE, FALSE);
                }
        }
 }
@@ -220,17 +229,17 @@ static void discover_hidden_things(POSITION y, POSITION x)
  * @brief プレイヤーの探索処理判定
  * @return なし
  */
-void search(void)
+void search(player_type *creature_ptr)
 {
        DIRECTION i;
        PERCENTAGE chance;
 
        /* Start with base search ability */
-       chance = p_ptr->skill_srh;
+       chance = creature_ptr->skill_srh;
 
        /* Penalize various conditions */
-       if (p_ptr->blind || no_lite()) chance = chance / 10;
-       if (p_ptr->confused || p_ptr->image) chance = chance / 10;
+       if (creature_ptr->blind || no_lite()) chance = chance / 10;
+       if (creature_ptr->confused || creature_ptr->image) chance = chance / 10;
 
        /* Search the nearby grids, which are always in bounds */
        for (i = 0; i < 9; ++ i)
@@ -238,7 +247,7 @@ void search(void)
                /* Sometimes, notice things */
                if (randint0(100) < chance)
                {
-                       discover_hidden_things(p_ptr->y + ddy_ddd[i], p_ptr->x + ddx_ddd[i]);
+                       discover_hidden_things(creature_ptr->y + ddy_ddd[i], creature_ptr->x + ddx_ddd[i]);
                }
        }
 }
@@ -255,7 +264,7 @@ void search(void)
  * だが、違和感が\n
  * あるという指摘をうけたので、「~を拾った、~を持っている」という表示\n
  * にかえてある。そのための配列。\n
- * Add the given dungeon object to the character's inventory.\n
+ * Add the given dungeon object to the character's p_ptr->inventory_list.\n
  * Delete the object afterwards.\n
  */
 void py_pickup_aux(OBJECT_IDX o_idx)
@@ -273,7 +282,7 @@ void py_pickup_aux(OBJECT_IDX o_idx)
 
        object_type *o_ptr;
 
-       o_ptr = &current_floor_ptr->o_list[o_idx];
+       o_ptr = &p_ptr->current_floor_ptr->o_list[o_idx];
 
 #ifdef JP
        object_desc(old_name, o_ptr, OD_NAME_ONLY);
@@ -284,7 +293,7 @@ void py_pickup_aux(OBJECT_IDX o_idx)
        slot = inven_carry(o_ptr);
 
        /* Get the object again */
-       o_ptr = &inventory[slot];
+       o_ptr = &p_ptr->inventory_list[slot];
 
        delete_object_idx(o_idx);
 
@@ -343,11 +352,11 @@ void py_pickup_aux(OBJECT_IDX o_idx)
  * @details
  * Player "wants" to pick up an object or gold.
  * Note that we ONLY handle things that can be picked up.
- * See "move_player()" for handling of other things.
+ * See "move_player(p_ptr, )" for handling of other things.
  */
 void carry(bool pickup)
 {
-       grid_type *g_ptr = &current_floor_ptr->grid_array[p_ptr->y][p_ptr->x];
+       grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[p_ptr->y][p_ptr->x];
 
        OBJECT_IDX this_o_idx, next_o_idx = 0;
 
@@ -374,7 +383,7 @@ void carry(bool pickup)
        for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
        {
                object_type *o_ptr;
-               o_ptr = &current_floor_ptr->o_list[this_o_idx];
+               o_ptr = &p_ptr->current_floor_ptr->o_list[this_o_idx];
 
 #ifdef ALLOW_EASY_SENSE /* TNB */
 
@@ -390,7 +399,7 @@ void carry(bool pickup)
                object_desc(o_name, o_ptr, 0);
                next_o_idx = o_ptr->next_o_idx;
 
-               disturb(FALSE, FALSE);
+               disturb(p_ptr, FALSE, FALSE);
 
                /* Pick up gold */
                if (o_ptr->tval == TV_GOLD)
@@ -466,10 +475,10 @@ void carry(bool pickup)
  * @param n_x プレイヤーの移動先X座標
  * @return 移動処理が可能である場合(可能な場合に選択した場合)TRUEを返す。
  */
-bool pattern_seq(POSITION c_y, POSITION c_x, POSITION n_y, POSITION n_x)
+bool pattern_seq(player_type *creature_ptr, POSITION c_y, POSITION c_x, POSITION n_y, POSITION n_x)
 {
-       feature_type *cur_f_ptr = &f_info[current_floor_ptr->grid_array[c_y][c_x].feat];
-       feature_type *new_f_ptr = &f_info[current_floor_ptr->grid_array[n_y][n_x].feat];
+       feature_type *cur_f_ptr = &f_info[p_ptr->current_floor_ptr->grid_array[c_y][c_x].feat];
+       feature_type *new_f_ptr = &f_info[p_ptr->current_floor_ptr->grid_array[n_y][n_x].feat];
        bool is_pattern_tile_cur = have_flag(cur_f_ptr->flags, FF_PATTERN);
        bool is_pattern_tile_new = have_flag(new_f_ptr->flags, FF_PATTERN);
        int pattern_type_cur, pattern_type_new;
@@ -481,7 +490,7 @@ bool pattern_seq(POSITION c_y, POSITION c_x, POSITION n_y, POSITION n_x)
 
        if (pattern_type_new == PATTERN_TILE_START)
        {
-               if (!is_pattern_tile_cur && !p_ptr->confused && !p_ptr->stun && !p_ptr->image)
+               if (!is_pattern_tile_cur && !creature_ptr->confused && !creature_ptr->stun && !creature_ptr->image)
                {
                        if (get_check(_("パターンの上を歩き始めると、全てを歩かなければなりません。いいですか?", 
                                                        "If you start walking the Pattern, you must walk the whole way. Ok? ")))
@@ -564,7 +573,7 @@ bool pattern_seq(POSITION c_y, POSITION c_x, POSITION n_y, POSITION n_x)
                                        ok_move = PATTERN_TILE_1;
                                        break;
                                default:
-                                       if (p_ptr->wizard)
+                                       if (current_world_ptr->wizard)
                                                msg_format(_("おかしなパターン歩行、%d。", "Funny Pattern walking, %d."), pattern_type_cur);
 
                                        return TRUE; /* Goof-up */
@@ -585,34 +594,6 @@ bool pattern_seq(POSITION c_y, POSITION c_x, POSITION n_y, POSITION n_x)
        }
 }
 
-
-/*!
- * @brief プレイヤーが地形踏破可能かを返す
- * @param feature 判定したい地形ID
- * @param mode 移動に関するオプションフラグ
- * @return 移動可能ならばTRUEを返す
- */
-bool player_can_enter(FEAT_IDX feature, BIT_FLAGS16 mode)
-{
-       feature_type *f_ptr = &f_info[feature];
-
-       if (p_ptr->riding) return monster_can_cross_terrain(feature, &r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx], mode | CEM_RIDING);
-
-       if (have_flag(f_ptr->flags, FF_PATTERN))
-       {
-               if (!(mode & CEM_P_CAN_ENTER_PATTERN)) return FALSE;
-       }
-
-       if (have_flag(f_ptr->flags, FF_CAN_FLY) && p_ptr->levitation) return TRUE;
-       if (have_flag(f_ptr->flags, FF_CAN_SWIM) && p_ptr->can_swim) return TRUE;
-       if (have_flag(f_ptr->flags, FF_CAN_PASS) && p_ptr->pass_wall) return TRUE;
-
-       if (!have_flag(f_ptr->flags, FF_MOVE)) return FALSE;
-
-       return TRUE;
-}
-
-
 /*!
  * @brief 移動に伴うプレイヤーのステータス変化処理
  * @param ny 移動先Y座標
@@ -620,12 +601,12 @@ bool player_can_enter(FEAT_IDX feature, BIT_FLAGS16 mode)
  * @param mpe_mode 移動オプションフラグ
  * @return プレイヤーが死亡やフロア離脱を行わず、実際に移動が可能ならばTRUEを返す。
  */
-bool move_player_effect(POSITION ny, POSITION nx, BIT_FLAGS mpe_mode)
+bool move_player_effect(player_type *creature_ptr, POSITION ny, POSITION nx, BIT_FLAGS mpe_mode)
 {
-       POSITION oy = p_ptr->y;
-       POSITION ox = p_ptr->x;
-       grid_type *g_ptr = &current_floor_ptr->grid_array[ny][nx];
-       grid_type *oc_ptr = &current_floor_ptr->grid_array[oy][ox];
+       POSITION oy = creature_ptr->y;
+       POSITION ox = creature_ptr->x;
+       grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[ny][nx];
+       grid_type *oc_ptr = &p_ptr->current_floor_ptr->grid_array[oy][ox];
        feature_type *f_ptr = &f_info[g_ptr->feat];
        feature_type *of_ptr = &f_info[oc_ptr->feat];
 
@@ -634,8 +615,8 @@ bool move_player_effect(POSITION ny, POSITION nx, BIT_FLAGS mpe_mode)
                MONSTER_IDX om_idx = oc_ptr->m_idx;
                MONSTER_IDX nm_idx = g_ptr->m_idx;
 
-               p_ptr->y = ny;
-               p_ptr->x = nx;
+               creature_ptr->y = ny;
+               creature_ptr->x = nx;
 
                /* Hack -- For moving monster or riding player's moving */
                if (!(mpe_mode & MPE_DONT_SWAP_MON))
@@ -644,9 +625,9 @@ bool move_player_effect(POSITION ny, POSITION nx, BIT_FLAGS mpe_mode)
                        g_ptr->m_idx = om_idx;
                        oc_ptr->m_idx = nm_idx;
 
-                       if (om_idx > 0) /* Monster on old spot (or p_ptr->riding) */
+                       if (om_idx > 0) /* Monster on old spot (or creature_ptr->riding) */
                        {
-                               monster_type *om_ptr = &current_floor_ptr->m_list[om_idx];
+                               monster_type *om_ptr = &p_ptr->current_floor_ptr->m_list[om_idx];
                                om_ptr->fy = ny;
                                om_ptr->fx = nx;
                                update_monster(om_idx, TRUE);
@@ -654,7 +635,7 @@ bool move_player_effect(POSITION ny, POSITION nx, BIT_FLAGS mpe_mode)
 
                        if (nm_idx > 0) /* Monster on new spot */
                        {
-                               monster_type *nm_ptr = &current_floor_ptr->m_list[nm_idx];
+                               monster_type *nm_ptr = &p_ptr->current_floor_ptr->m_list[nm_idx];
                                nm_ptr->fy = oy;
                                nm_ptr->fx = ox;
                                update_monster(nm_idx, TRUE);
@@ -671,63 +652,63 @@ bool move_player_effect(POSITION ny, POSITION nx, BIT_FLAGS mpe_mode)
                {
                        forget_flow();
 
-                       p_ptr->update |= (PU_UN_VIEW);
-                       p_ptr->redraw |= (PR_MAP);
+                       creature_ptr->update |= (PU_UN_VIEW);
+                       creature_ptr->redraw |= (PR_MAP);
                }
 
-               p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_DISTANCE);
-               p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
+               creature_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_DISTANCE);
+               creature_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
 
                /* Remove "unsafe" flag */
-               if ((!p_ptr->blind && !no_lite()) || !is_trap(g_ptr->feat)) g_ptr->info &= ~(CAVE_UNSAFE);
+               if ((!creature_ptr->blind && !no_lite()) || !is_trap(g_ptr->feat)) g_ptr->info &= ~(CAVE_UNSAFE);
 
                /* For get everything when requested hehe I'm *NASTY* */
-               if (current_floor_ptr->dun_level && (d_info[p_ptr->dungeon_idx].flags1 & DF1_FORGET)) wiz_dark();
+               if (p_ptr->current_floor_ptr->dun_level && (d_info[creature_ptr->dungeon_idx].flags1 & DF1_FORGET)) wiz_dark();
                if (mpe_mode & MPE_HANDLE_STUFF) handle_stuff();
 
-               if (p_ptr->pclass == CLASS_NINJA)
+               if (creature_ptr->pclass == CLASS_NINJA)
                {
-                       if (g_ptr->info & (CAVE_GLOW)) set_superstealth(FALSE);
-                       else if (p_ptr->cur_lite <= 0) set_superstealth(TRUE);
+                       if (g_ptr->info & (CAVE_GLOW)) set_superstealth(creature_ptr, FALSE);
+                       else if (creature_ptr->cur_lite <= 0) set_superstealth(creature_ptr, TRUE);
                }
 
-               if ((p_ptr->action == ACTION_HAYAGAKE) &&
+               if ((creature_ptr->action == ACTION_HAYAGAKE) &&
                    (!have_flag(f_ptr->flags, FF_PROJECT) ||
-                    (!p_ptr->levitation && have_flag(f_ptr->flags, FF_DEEP))))
+                    (!creature_ptr->levitation && have_flag(f_ptr->flags, FF_DEEP))))
                {
                        msg_print(_("ここでは素早く動けない。", "You cannot run in here."));
-                       set_action(ACTION_NONE);
+                       set_action(creature_ptr, ACTION_NONE);
                }
-               if (p_ptr->prace == RACE_MERFOLK)
+               if (creature_ptr->prace == RACE_MERFOLK)
                {
                        if(have_flag(f_ptr->flags, FF_WATER) ^ have_flag(of_ptr->flags, FF_WATER))
                        {
-                               p_ptr->update |= PU_BONUS;
-                               update_creature(p_ptr);
+                               creature_ptr->update |= PU_BONUS;
+                               update_creature(creature_ptr);
                        }
                }
        }
 
        if (mpe_mode & MPE_ENERGY_USE)
        {
-               if (music_singing(MUSIC_WALL))
+               if (music_singing(creature_ptr, MUSIC_WALL))
                {
-                       (void)project(0, 0, p_ptr->y, p_ptr->x, (60 + p_ptr->lev), GF_DISINTEGRATE,
+                       (void)project(0, 0, creature_ptr->y, creature_ptr->x, (60 + creature_ptr->lev), GF_DISINTEGRATE,
                                PROJECT_KILL | PROJECT_ITEM, -1);
 
-                       if (!player_bold(ny, nx) || p_ptr->is_dead || p_ptr->leaving) return FALSE;
+                       if (!player_bold(ny, nx) || creature_ptr->is_dead || creature_ptr->leaving) return FALSE;
                }
 
                /* Spontaneous Searching */
-               if ((p_ptr->skill_fos >= 50) || (0 == randint0(50 - p_ptr->skill_fos)))
+               if ((creature_ptr->skill_fos >= 50) || (0 == randint0(50 - creature_ptr->skill_fos)))
                {
-                       search();
+                       search(creature_ptr);
                }
 
                /* Continuous Searching */
-               if (p_ptr->action == ACTION_SEARCH)
+               if (creature_ptr->action == ACTION_SEARCH)
                {
-                       search();
+                       search(creature_ptr);
                }
        }
 
@@ -740,9 +721,9 @@ bool move_player_effect(POSITION ny, POSITION nx, BIT_FLAGS mpe_mode)
        /* Handle "store doors" */
        if (have_flag(f_ptr->flags, FF_STORE))
        {
-               disturb(FALSE, TRUE);
+               disturb(p_ptr, FALSE, TRUE);
 
-               free_turn(p_ptr);
+               free_turn(creature_ptr);
                /* Hack -- Enter store */
                command_new = SPECIAL_KEY_STORE;
        }
@@ -750,9 +731,9 @@ bool move_player_effect(POSITION ny, POSITION nx, BIT_FLAGS mpe_mode)
        /* Handle "building doors" -KMW- */
        else if (have_flag(f_ptr->flags, FF_BLDG))
        {
-               disturb(FALSE, TRUE);
+               disturb(p_ptr, FALSE, TRUE);
 
-               free_turn(p_ptr);
+               free_turn(creature_ptr);
                /* Hack -- Enter building */
                command_new = SPECIAL_KEY_BUILDING;
        }
@@ -760,34 +741,34 @@ bool move_player_effect(POSITION ny, POSITION nx, BIT_FLAGS mpe_mode)
        /* Handle quest areas -KMW- */
        else if (have_flag(f_ptr->flags, FF_QUEST_ENTER))
        {
-               disturb(FALSE, TRUE);
+               disturb(p_ptr, FALSE, TRUE);
 
-               free_turn(p_ptr);
+               free_turn(creature_ptr);
                /* Hack -- Enter quest level */
                command_new = SPECIAL_KEY_QUEST;
        }
 
        else if (have_flag(f_ptr->flags, FF_QUEST_EXIT))
        {
-               if (quest[p_ptr->inside_quest].type == QUEST_TYPE_FIND_EXIT)
+               if (quest[creature_ptr->inside_quest].type == QUEST_TYPE_FIND_EXIT)
                {
-                       complete_quest(p_ptr->inside_quest);
+                       complete_quest(creature_ptr->inside_quest);
                }
 
                leave_quest_check();
 
-               p_ptr->inside_quest = g_ptr->special;
-               current_floor_ptr->dun_level = 0;
-               p_ptr->oldpx = 0;
-               p_ptr->oldpy = 0;
+               creature_ptr->inside_quest = g_ptr->special;
+               p_ptr->current_floor_ptr->dun_level = 0;
+               creature_ptr->oldpx = 0;
+               creature_ptr->oldpy = 0;
 
-               p_ptr->leaving = TRUE;
+               creature_ptr->leaving = TRUE;
        }
 
        /* Set off a trap */
        else if (have_flag(f_ptr->flags, FF_HIT_TRAP) && !(mpe_mode & MPE_STAYING))
        {
-               disturb(FALSE, TRUE);
+               disturb(p_ptr, FALSE, TRUE);
 
                /* Hidden trap */
                if (g_ptr->mimic || have_flag(f_ptr->flags, FF_SECRET))
@@ -795,21 +776,21 @@ bool move_player_effect(POSITION ny, POSITION nx, BIT_FLAGS mpe_mode)
                        msg_print(_("トラップだ!", "You found a trap!"));
 
                        /* Pick a trap */
-                       disclose_grid(p_ptr->y, p_ptr->x);
+                       disclose_grid(creature_ptr->y, creature_ptr->x);
                }
 
                /* Hit the trap */
-               hit_trap((mpe_mode & MPE_BREAK_TRAP) ? TRUE : FALSE);
+               hit_trap(creature_ptr, (mpe_mode & MPE_BREAK_TRAP) ? TRUE : FALSE);
 
-               if (!player_bold(ny, nx) || p_ptr->is_dead || p_ptr->leaving) return FALSE;
+               if (!player_bold(ny, nx) || creature_ptr->is_dead || creature_ptr->leaving) return FALSE;
        }
 
        /* Warn when leaving trap detected region */
        if (!(mpe_mode & MPE_STAYING) && (disturb_trap_detect || alert_trap_detect)
-           && p_ptr->dtrap && !(g_ptr->info & CAVE_IN_DETECT))
+           && creature_ptr->dtrap && !(g_ptr->info & CAVE_IN_DETECT))
        {
                /* No duplicate warning */
-               p_ptr->dtrap = FALSE;
+               creature_ptr->dtrap = FALSE;
 
                /* You are just on the edge */
                if (!(g_ptr->info & CAVE_UNSAFE))
@@ -819,11 +800,11 @@ bool move_player_effect(POSITION ny, POSITION nx, BIT_FLAGS mpe_mode)
                                msg_print(_("* 注意:この先はトラップの感知範囲外です! *", "*Leaving trap detect region!*"));
                        }
 
-                       if (disturb_trap_detect) disturb(FALSE, TRUE);
+                       if (disturb_trap_detect) disturb(p_ptr, FALSE, TRUE);
                }
        }
 
-       return player_bold(ny, nx) && !p_ptr->is_dead && !p_ptr->leaving;
+       return player_bold(ny, nx) && !creature_ptr->is_dead && !creature_ptr->leaving;
 }
 
 /*!
@@ -831,7 +812,7 @@ bool move_player_effect(POSITION ny, POSITION nx, BIT_FLAGS mpe_mode)
  * @param feat 地形ID
  * @return トラップが自動的に無効ならばTRUEを返す
  */
-bool trap_can_be_ignored(FEAT_IDX feat)
+bool trap_can_be_ignored(player_type *creature_ptr, FEAT_IDX feat)
 {
        feature_type *f_ptr = &f_info[feat];
 
@@ -843,28 +824,28 @@ bool trap_can_be_ignored(FEAT_IDX feat)
        case TRAP_PIT:
        case TRAP_SPIKED_PIT:
        case TRAP_POISON_PIT:
-               if (p_ptr->levitation) return TRUE;
+               if (creature_ptr->levitation) return TRUE;
                break;
        case TRAP_TELEPORT:
-               if (p_ptr->anti_tele) return TRUE;
+               if (creature_ptr->anti_tele) return TRUE;
                break;
        case TRAP_FIRE:
-               if (p_ptr->immune_fire) return TRUE;
+               if (creature_ptr->immune_fire) return TRUE;
                break;
        case TRAP_ACID:
-               if (p_ptr->immune_acid) return TRUE;
+               if (creature_ptr->immune_acid) return TRUE;
                break;
        case TRAP_BLIND:
-               if (p_ptr->resist_blind) return TRUE;
+               if (creature_ptr->resist_blind) return TRUE;
                break;
        case TRAP_CONFUSE:
-               if (p_ptr->resist_conf) return TRUE;
+               if (creature_ptr->resist_conf) return TRUE;
                break;
        case TRAP_POISON:
-               if (p_ptr->resist_pois) return TRUE;
+               if (creature_ptr->resist_pois) return TRUE;
                break;
        case TRAP_SLEEP:
-               if (p_ptr->free_act) return TRUE;
+               if (creature_ptr->free_act) return TRUE;
                break;
        }
 
@@ -896,21 +877,21 @@ bool trap_can_be_ignored(FEAT_IDX feat)
  * any monster which might be in the destination grid.  Previously,\n
  * moving into walls was "free" and did NOT hit invisible monsters.\n
  */
-void move_player(DIRECTION dir, bool do_pickup, bool break_trap)
+void move_player(player_type *creature_ptr, DIRECTION dir, bool do_pickup, bool break_trap)
 {
        /* Find the result of moving */
-       POSITION y = p_ptr->y + ddy[dir];
-       POSITION x = p_ptr->x + ddx[dir];
+       POSITION y = creature_ptr->y + ddy[dir];
+       POSITION x = creature_ptr->x + ddx[dir];
 
        /* Examine the destination */
-       grid_type *g_ptr = &current_floor_ptr->grid_array[y][x];
+       grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x];
 
        feature_type *f_ptr = &f_info[g_ptr->feat];
 
        monster_type *m_ptr;
 
-       monster_type *riding_m_ptr = &current_floor_ptr->m_list[p_ptr->riding];
-       monster_race *riding_r_ptr = &r_info[p_ptr->riding ? riding_m_ptr->r_idx : 0]; /* Paranoia */
+       monster_type *riding_m_ptr = &p_ptr->current_floor_ptr->m_list[creature_ptr->riding];
+       monster_race *riding_r_ptr = &r_info[creature_ptr->riding ? riding_m_ptr->r_idx : 0];
 
        GAME_TEXT m_name[MAX_NLEN];
 
@@ -922,7 +903,7 @@ void move_player(DIRECTION dir, bool do_pickup, bool break_trap)
        bool do_past = FALSE;
 
        /* Exit the area */
-       if (!current_floor_ptr->dun_level && !p_ptr->wild_mode &&
+       if (!p_ptr->current_floor_ptr->dun_level && !creature_ptr->wild_mode &&
                ((x == 0) || (x == MAX_WID - 1) ||
                 (y == 0) || (y == MAX_HGT - 1)))
        {
@@ -932,74 +913,74 @@ void move_player(DIRECTION dir, bool do_pickup, bool break_trap)
                        /* Hack: move to new area */
                        if ((y == 0) && (x == 0))
                        {
-                               p_ptr->wilderness_y--;
-                               p_ptr->wilderness_x--;
-                               p_ptr->oldpy = current_floor_ptr->height - 2;
-                               p_ptr->oldpx = current_floor_ptr->width - 2;
-                               p_ptr->ambush_flag = FALSE;
+                               creature_ptr->wilderness_y--;
+                               creature_ptr->wilderness_x--;
+                               creature_ptr->oldpy = p_ptr->current_floor_ptr->height - 2;
+                               creature_ptr->oldpx = p_ptr->current_floor_ptr->width - 2;
+                               creature_ptr->ambush_flag = FALSE;
                        }
 
                        else if ((y == 0) && (x == MAX_WID - 1))
                        {
-                               p_ptr->wilderness_y--;
-                               p_ptr->wilderness_x++;
-                               p_ptr->oldpy = current_floor_ptr->height - 2;
-                               p_ptr->oldpx = 1;
-                               p_ptr->ambush_flag = FALSE;
+                               creature_ptr->wilderness_y--;
+                               creature_ptr->wilderness_x++;
+                               creature_ptr->oldpy = p_ptr->current_floor_ptr->height - 2;
+                               creature_ptr->oldpx = 1;
+                               creature_ptr->ambush_flag = FALSE;
                        }
 
                        else if ((y == MAX_HGT - 1) && (x == 0))
                        {
-                               p_ptr->wilderness_y++;
-                               p_ptr->wilderness_x--;
-                               p_ptr->oldpy = 1;
-                               p_ptr->oldpx = current_floor_ptr->width - 2;
-                               p_ptr->ambush_flag = FALSE;
+                               creature_ptr->wilderness_y++;
+                               creature_ptr->wilderness_x--;
+                               creature_ptr->oldpy = 1;
+                               creature_ptr->oldpx = p_ptr->current_floor_ptr->width - 2;
+                               creature_ptr->ambush_flag = FALSE;
                        }
 
                        else if ((y == MAX_HGT - 1) && (x == MAX_WID - 1))
                        {
-                               p_ptr->wilderness_y++;
-                               p_ptr->wilderness_x++;
-                               p_ptr->oldpy = 1;
-                               p_ptr->oldpx = 1;
-                               p_ptr->ambush_flag = FALSE;
+                               creature_ptr->wilderness_y++;
+                               creature_ptr->wilderness_x++;
+                               creature_ptr->oldpy = 1;
+                               creature_ptr->oldpx = 1;
+                               creature_ptr->ambush_flag = FALSE;
                        }
 
                        else if (y == 0)
                        {
-                               p_ptr->wilderness_y--;
-                               p_ptr->oldpy = current_floor_ptr->height - 2;
-                               p_ptr->oldpx = x;
-                               p_ptr->ambush_flag = FALSE;
+                               creature_ptr->wilderness_y--;
+                               creature_ptr->oldpy = p_ptr->current_floor_ptr->height - 2;
+                               creature_ptr->oldpx = x;
+                               creature_ptr->ambush_flag = FALSE;
                        }
 
                        else if (y == MAX_HGT - 1)
                        {
-                               p_ptr->wilderness_y++;
-                               p_ptr->oldpy = 1;
-                               p_ptr->oldpx = x;
-                               p_ptr->ambush_flag = FALSE;
+                               creature_ptr->wilderness_y++;
+                               creature_ptr->oldpy = 1;
+                               creature_ptr->oldpx = x;
+                               creature_ptr->ambush_flag = FALSE;
                        }
 
                        else if (x == 0)
                        {
-                               p_ptr->wilderness_x--;
-                               p_ptr->oldpx = current_floor_ptr->width - 2;
-                               p_ptr->oldpy = y;
-                               p_ptr->ambush_flag = FALSE;
+                               creature_ptr->wilderness_x--;
+                               creature_ptr->oldpx = p_ptr->current_floor_ptr->width - 2;
+                               creature_ptr->oldpy = y;
+                               creature_ptr->ambush_flag = FALSE;
                        }
 
                        else if (x == MAX_WID - 1)
                        {
-                               p_ptr->wilderness_x++;
-                               p_ptr->oldpx = 1;
-                               p_ptr->oldpy = y;
-                               p_ptr->ambush_flag = FALSE;
+                               creature_ptr->wilderness_x++;
+                               creature_ptr->oldpx = 1;
+                               creature_ptr->oldpy = y;
+                               creature_ptr->ambush_flag = FALSE;
                        }
 
-                       p_ptr->leaving = TRUE;
-                       take_turn(p_ptr, 100);
+                       creature_ptr->leaving = TRUE;
+                       take_turn(creature_ptr, 100);
 
                        return;
                }
@@ -1009,14 +990,14 @@ void move_player(DIRECTION dir, bool do_pickup, bool break_trap)
                p_can_enter = FALSE;
        }
 
-       m_ptr = &current_floor_ptr->m_list[g_ptr->m_idx];
+       m_ptr = &p_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
 
-       if (inventory[INVEN_RARM].name1 == ART_STORMBRINGER) stormbringer = TRUE;
-       if (inventory[INVEN_LARM].name1 == ART_STORMBRINGER) stormbringer = TRUE;
+       if (creature_ptr->inventory_list[INVEN_RARM].name1 == ART_STORMBRINGER) stormbringer = TRUE;
+       if (creature_ptr->inventory_list[INVEN_LARM].name1 == ART_STORMBRINGER) stormbringer = TRUE;
 
        /* Player can not walk through "walls"... */
        /* unless in Shadow Form */
-       p_can_kill_walls = p_ptr->kill_wall && have_flag(f_ptr->flags, FF_HURT_DISI) &&
+       p_can_kill_walls = creature_ptr->kill_wall && have_flag(f_ptr->flags, FF_HURT_DISI) &&
                (!p_can_enter || !have_flag(f_ptr->flags, FF_LOS)) &&
                !have_flag(f_ptr->flags, FF_PERMANENT);
 
@@ -1027,39 +1008,36 @@ void move_player(DIRECTION dir, bool do_pickup, bool break_trap)
 
                /* Attack -- only if we can see it OR it is not in a wall */
                if (!is_hostile(m_ptr) &&
-                   !(p_ptr->confused || p_ptr->image || !m_ptr->ml || p_ptr->stun ||
-                   ((p_ptr->muta2 & MUT2_BERS_RAGE) && p_ptr->shero)) &&
-                   pattern_seq(p_ptr->y, p_ptr->x, y, x) && (p_can_enter || p_can_kill_walls))
+                   !(creature_ptr->confused || creature_ptr->image || !m_ptr->ml || creature_ptr->stun ||
+                   ((creature_ptr->muta2 & MUT2_BERS_RAGE) && creature_ptr->shero)) &&
+                   pattern_seq(p_ptr, creature_ptr->y, creature_ptr->x, y, x) && (p_can_enter || p_can_kill_walls))
                {
                        /* Disturb the monster */
                        (void)set_monster_csleep(g_ptr->m_idx, 0);
 
-                       /* Extract monster name (or "it") */
                        monster_desc(m_name, m_ptr, 0);
 
                        if (m_ptr->ml)
                        {
                                /* Auto-Recall if possible and visible */
-                               if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
-
-                               /* Track a new monster */
+                               if (!creature_ptr->image) monster_race_track(m_ptr->ap_r_idx);
                                health_track(g_ptr->m_idx);
                        }
 
                        /* displace? */
-                       if ((stormbringer && (randint1(1000) > 666)) || (p_ptr->pclass == CLASS_BERSERKER))
+                       if ((stormbringer && (randint1(1000) > 666)) || (creature_ptr->pclass == CLASS_BERSERKER))
                        {
-                               py_attack(y, x, 0);
+                               py_attack(p_ptr, y, x, 0);
                                oktomove = FALSE;
                        }
-                       else if (monster_can_cross_terrain(current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].feat, r_ptr, 0))
+                       else if (monster_can_cross_terrain(p_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat, r_ptr, 0))
                        {
                                do_past = TRUE;
                        }
                        else
                        {
                                msg_format(_("%^sが邪魔だ!", "%^s is in your way!"), m_name);
-                               free_turn(p_ptr);
+                               free_turn(creature_ptr);
                                oktomove = FALSE;
                        }
 
@@ -1067,19 +1045,19 @@ void move_player(DIRECTION dir, bool do_pickup, bool break_trap)
                }
                else
                {
-                       py_attack(y, x, 0);
+                       py_attack(p_ptr, y, x, 0);
                        oktomove = FALSE;
                }
        }
 
-       if (oktomove && p_ptr->riding)
+       if (oktomove && creature_ptr->riding)
        {
                if (riding_r_ptr->flags1 & RF1_NEVER_MOVE)
                {
                        msg_print(_("動けない!", "Can't move!"));
-                       free_turn(p_ptr);
+                       free_turn(creature_ptr);
                        oktomove = FALSE;
-                       disturb(FALSE, TRUE);
+                       disturb(p_ptr, FALSE, TRUE);
                }
                else if (MON_MONFEAR(riding_m_ptr))
                {
@@ -1087,12 +1065,12 @@ void move_player(DIRECTION dir, bool do_pickup, bool break_trap)
                        monster_desc(steed_name, riding_m_ptr, 0);
                        msg_format(_("%sが恐怖していて制御できない。", "%^s is too scared to control."), steed_name);
                        oktomove = FALSE;
-                       disturb(FALSE, TRUE);
+                       disturb(p_ptr, FALSE, TRUE);
                }
-               else if (p_ptr->riding_ryoute)
+               else if (creature_ptr->riding_ryoute)
                {
                        oktomove = FALSE;
-                       disturb(FALSE, TRUE);
+                       disturb(p_ptr, FALSE, TRUE);
                }
                else if (have_flag(f_ptr->flags, FF_CAN_FLY) && (riding_r_ptr->flags7 & RF7_CAN_FLY))
                {
@@ -1107,23 +1085,23 @@ void move_player(DIRECTION dir, bool do_pickup, bool break_trap)
                        (have_flag(f_ptr->flags, FF_DEEP) || (riding_r_ptr->flags2 & RF2_AURA_FIRE)))
                {
                        msg_format(_("%sの上に行けない。", "Can't swim."), f_name + f_info[get_feat_mimic(g_ptr)].name);
-                       free_turn(p_ptr);
+                       free_turn(creature_ptr);
                        oktomove = FALSE;
-                       disturb(FALSE, TRUE);
+                       disturb(p_ptr, FALSE, TRUE);
                }
                else if (!have_flag(f_ptr->flags, FF_WATER) && (riding_r_ptr->flags7 & RF7_AQUATIC))
                {
-                       msg_format(_("%sから上がれない。", "Can't land."), f_name + f_info[get_feat_mimic(&current_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name);
-                       free_turn(p_ptr);
+                       msg_format(_("%sから上がれない。", "Can't land."), f_name + f_info[get_feat_mimic(&p_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x])].name);
+                       free_turn(creature_ptr);
                        oktomove = FALSE;
-                       disturb(FALSE, TRUE);
+                       disturb(p_ptr, FALSE, TRUE);
                }
                else if (have_flag(f_ptr->flags, FF_LAVA) && !(riding_r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK))
                {
                        msg_format(_("%sの上に行けない。", "Too hot to go through."), f_name + f_info[get_feat_mimic(g_ptr)].name);
-                       free_turn(p_ptr);
+                       free_turn(creature_ptr);
                        oktomove = FALSE;
-                       disturb(FALSE, TRUE);
+                       disturb(p_ptr, FALSE, TRUE);
                }
 
                if (oktomove && MON_STUNNED(riding_m_ptr) && one_in_(2))
@@ -1132,7 +1110,7 @@ void move_player(DIRECTION dir, bool do_pickup, bool break_trap)
                        monster_desc(steed_name, riding_m_ptr, 0);
                        msg_format(_("%sが朦朧としていてうまく動けない!", "You cannot control stunned %s!"), steed_name);
                        oktomove = FALSE;
-                       disturb(FALSE, TRUE);
+                       disturb(p_ptr, FALSE, TRUE);
                }
        }
 
@@ -1140,11 +1118,11 @@ void move_player(DIRECTION dir, bool do_pickup, bool break_trap)
        {
        }
 
-       else if (!have_flag(f_ptr->flags, FF_MOVE) && have_flag(f_ptr->flags, FF_CAN_FLY) && !p_ptr->levitation)
+       else if (!have_flag(f_ptr->flags, FF_MOVE) && have_flag(f_ptr->flags, FF_CAN_FLY) && !creature_ptr->levitation)
        {
                msg_format(_("空を飛ばないと%sの上には行けない。", "You need to fly to go through the %s."), f_name + f_info[get_feat_mimic(g_ptr)].name);
-               free_turn(p_ptr);
-               running = 0;
+               free_turn(creature_ptr);
+               creature_ptr->running = 0;
                oktomove = FALSE;
        }
 
@@ -1155,16 +1133,16 @@ void move_player(DIRECTION dir, bool do_pickup, bool break_trap)
         */
        else if (have_flag(f_ptr->flags, FF_TREE) && !p_can_kill_walls)
        {
-               if ((p_ptr->pclass != CLASS_RANGER) && !p_ptr->levitation && (!p_ptr->riding || !(riding_r_ptr->flags8 & RF8_WILD_WOOD))) p_ptr->energy_use *= 2;
+               if ((creature_ptr->pclass != CLASS_RANGER) && !creature_ptr->levitation && (!creature_ptr->riding || !(riding_r_ptr->flags8 & RF8_WILD_WOOD))) creature_ptr->energy_use *= 2;
        }
 
 
        /* Disarm a visible trap */
        else if ((do_pickup != easy_disarm) && have_flag(f_ptr->flags, FF_DISARM) && !g_ptr->mimic)
        {
-               if (!trap_can_be_ignored(g_ptr->feat))
+               if (!trap_can_be_ignored(p_ptr, g_ptr->feat))
                {
-                       (void)do_cmd_disarm_aux(y, x, dir);
+                       (void)exe_disarm(creature_ptr, y, x, dir);
                        return;
                }
        }
@@ -1211,15 +1189,15 @@ void move_player(DIRECTION dir, bool do_pickup, bool break_trap)
                        if (boundary_floor(g_ptr, f_ptr, mimic_f_ptr))
                        {
                                msg_print(_("それ以上先には進めない。", "You cannot go any more."));
-                               if (!(p_ptr->confused || p_ptr->stun || p_ptr->image))
-                                       free_turn(p_ptr);
+                               if (!(creature_ptr->confused || creature_ptr->stun || creature_ptr->image))
+                                       free_turn(creature_ptr);
                        }
 
                        /* Wall (or secret door) */
                        else
                        {
                                /* Closed doors */
-                               if (easy_open && is_closed_door(feat) && easy_open_door(y, x)) return;
+                               if (easy_open && is_closed_door(feat) && easy_open_door(creature_ptr, y, x)) return;
 
 #ifdef JP
                                msg_format("%sが行く手をはばんでいる。", name);
@@ -1233,26 +1211,26 @@ void move_player(DIRECTION dir, bool do_pickup, bool break_trap)
                                 * a wall _if_ you are confused, stunned or blind; but
                                 * typing mistakes should not cost you a current_world_ptr->game_turn...
                                 */
-                               if (!(p_ptr->confused || p_ptr->stun || p_ptr->image))
-                                       free_turn(p_ptr);
+                               if (!(creature_ptr->confused || creature_ptr->stun || creature_ptr->image))
+                                       free_turn(creature_ptr);
                        }
                }
 
-               disturb(FALSE, TRUE);
+               disturb(p_ptr, FALSE, TRUE);
 
                if (!boundary_floor(g_ptr, f_ptr, mimic_f_ptr)) sound(SOUND_HITWALL);
        }
 
        /* Normal movement */
-       if (oktomove && !pattern_seq(p_ptr->y, p_ptr->x, y, x))
+       if (oktomove && !pattern_seq(p_ptr, creature_ptr->y, creature_ptr->x, y, x))
        {
-               if (!(p_ptr->confused || p_ptr->stun || p_ptr->image))
+               if (!(creature_ptr->confused || creature_ptr->stun || creature_ptr->image))
                {
-                       free_turn(p_ptr);
+                       free_turn(creature_ptr);
                }
 
                /* To avoid a loop with running */
-               disturb(FALSE, TRUE);
+               disturb(p_ptr, FALSE, TRUE);
 
                oktomove = FALSE;
        }
@@ -1262,11 +1240,11 @@ void move_player(DIRECTION dir, bool do_pickup, bool break_trap)
        {
                u32b mpe_mode = MPE_ENERGY_USE;
 
-               if (p_ptr->warning)
+               if (creature_ptr->warning)
                {
                        if (!process_warning(x, y))
                        {
-                               p_ptr->energy_use = 25;
+                               creature_ptr->energy_use = 25;
                                return;
                        }
                }
@@ -1277,14 +1255,14 @@ void move_player(DIRECTION dir, bool do_pickup, bool break_trap)
                }
 
                /* Change oldpx and oldpy to place the player well when going back to big mode */
-               if (p_ptr->wild_mode)
+               if (creature_ptr->wild_mode)
                {
-                       if (ddy[dir] > 0)  p_ptr->oldpy = 1;
-                       if (ddy[dir] < 0)  p_ptr->oldpy = MAX_HGT - 2;
-                       if (ddy[dir] == 0) p_ptr->oldpy = MAX_HGT / 2;
-                       if (ddx[dir] > 0)  p_ptr->oldpx = 1;
-                       if (ddx[dir] < 0)  p_ptr->oldpx = MAX_WID - 2;
-                       if (ddx[dir] == 0) p_ptr->oldpx = MAX_WID / 2;
+                       if (ddy[dir] > 0)  creature_ptr->oldpy = 1;
+                       if (ddy[dir] < 0)  creature_ptr->oldpy = MAX_HGT - 2;
+                       if (ddy[dir] == 0) creature_ptr->oldpy = MAX_HGT / 2;
+                       if (ddx[dir] > 0)  creature_ptr->oldpx = 1;
+                       if (ddx[dir] < 0)  creature_ptr->oldpx = MAX_WID - 2;
+                       if (ddx[dir] == 0) creature_ptr->oldpx = MAX_WID / 2;
                }
 
                if (p_can_kill_walls)
@@ -1292,7 +1270,7 @@ void move_player(DIRECTION dir, bool do_pickup, bool break_trap)
                        cave_alter_feat(y, x, FF_HURT_DISI);
 
                        /* Update some things -- similar to GF_KILL_WALL */
-                       p_ptr->update |= (PU_FLOW);
+                       creature_ptr->update |= (PU_FLOW);
                }
 
                /* sound(SOUND_WALK); */
@@ -1300,7 +1278,7 @@ void move_player(DIRECTION dir, bool do_pickup, bool break_trap)
                if (do_pickup != always_pickup) mpe_mode |= MPE_DO_PICKUP;
                if (break_trap) mpe_mode |= MPE_BREAK_TRAP;
 
-               (void)move_player_effect(y, x, mpe_mode);
+               (void)move_player_effect(p_ptr, y, x, mpe_mode);
        }
 }
 
@@ -1327,7 +1305,7 @@ static bool see_wall(DIRECTION dir, POSITION y, POSITION x)
        if (!in_bounds2(y, x)) return (FALSE);
 
        /* Access grid */
-       g_ptr = &current_floor_ptr->grid_array[y][x];
+       g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x];
 
        /* Must be known to the player */
        if (g_ptr->info & (CAVE_MARK))
@@ -1370,7 +1348,7 @@ static bool see_nothing(DIRECTION dir, POSITION y, POSITION x)
        if (!in_bounds2(y, x)) return (TRUE);
 
        /* Memorized grids are always known */
-       if (current_floor_ptr->grid_array[y][x].info & (CAVE_MARK)) return (FALSE);
+       if (p_ptr->current_floor_ptr->grid_array[y][x].info & (CAVE_MARK)) return (FALSE);
 
        /* Viewable door/wall grids are known */
        if (player_can_see_bold(y, x)) return (FALSE);
@@ -1545,13 +1523,13 @@ static bool run_test(void)
 
        /* break run when leaving trap detected region */
        if ((disturb_trap_detect || alert_trap_detect)
-           && p_ptr->dtrap && !(current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_IN_DETECT))
+           && p_ptr->dtrap && !(p_ptr->current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_IN_DETECT))
        {
                /* No duplicate warning */
                p_ptr->dtrap = FALSE;
 
                /* You are just on the edge */
-               if (!(current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_UNSAFE))
+               if (!(p_ptr->current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_UNSAFE))
                {
                        if (alert_trap_detect)
                        {
@@ -1579,7 +1557,7 @@ static bool run_test(void)
                col = p_ptr->x + ddx[new_dir];
 
                /* Access grid */
-               g_ptr = &current_floor_ptr->grid_array[row][col];
+               g_ptr = &p_ptr->current_floor_ptr->grid_array[row][col];
 
                /* Feature code (applying "mimic" field) */
                feat = get_feat_mimic(g_ptr);
@@ -1588,7 +1566,7 @@ static bool run_test(void)
                /* Visible monsters abort running */
                if (g_ptr->m_idx)
                {
-                       monster_type *m_ptr = &current_floor_ptr->m_list[g_ptr->m_idx];
+                       monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
 
                        /* Visible monster */
                        if (m_ptr->ml) return (TRUE);
@@ -1598,7 +1576,7 @@ static bool run_test(void)
                for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
                {
                        object_type *o_ptr;
-                       o_ptr = &current_floor_ptr->o_list[this_o_idx];
+                       o_ptr = &p_ptr->current_floor_ptr->o_list[this_o_idx];
                        next_o_idx = o_ptr->next_o_idx;
 
                        /* Visible object */
@@ -1638,7 +1616,7 @@ static bool run_test(void)
 
                                /* Deep water */
                                else if (have_flag(f_ptr->flags, FF_WATER) && have_flag(f_ptr->flags, FF_DEEP) &&
-                                        (p_ptr->levitation || p_ptr->can_swim || (p_ptr->total_weight <= weight_limit())))
+                                        (p_ptr->levitation || p_ptr->can_swim || (p_ptr->total_weight <= weight_limit(p_ptr))))
                                {
                                        /* Ignore */
                                        notice = FALSE;
@@ -1874,7 +1852,7 @@ void run_step(DIRECTION dir)
 
                        msg_print(_("その方向には走れません。", "You cannot run in that direction."));
 
-                       disturb(FALSE, FALSE);
+                       disturb(p_ptr, FALSE, FALSE);
 
                        return;
                }
@@ -1888,26 +1866,26 @@ void run_step(DIRECTION dir)
                /* Update run */
                if (run_test())
                {
-                       disturb(FALSE, FALSE);
+                       disturb(p_ptr, FALSE, FALSE);
 
                        return;
                }
        }
 
        /* Decrease the run counter */
-       if (--running <= 0) return;
+       if (--p_ptr->running <= 0) return;
 
        /* Take time */
        take_turn(p_ptr, 100);
 
        /* Move the player, using the "pickup" flag */
-       move_player(find_current, FALSE, FALSE);
+       move_player(p_ptr, find_current, FALSE, FALSE);
 
        if (player_bold(p_ptr->run_py, p_ptr->run_px))
        {
                p_ptr->run_py = 0;
                p_ptr->run_px = 0;
-               disturb(FALSE, FALSE);
+               disturb(p_ptr, FALSE, FALSE);
        }
 }
 
@@ -1936,13 +1914,13 @@ static DIRECTION travel_test(DIRECTION prev_dir)
 
        /* break run when leaving trap detected region */
        if ((disturb_trap_detect || alert_trap_detect)
-           && p_ptr->dtrap && !(current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_IN_DETECT))
+           && p_ptr->dtrap && !(p_ptr->current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_IN_DETECT))
        {
                /* No duplicate warning */
                p_ptr->dtrap = FALSE;
 
                /* You are just on the edge */
-               if (!(current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_UNSAFE))
+               if (!(p_ptr->current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_UNSAFE))
                {
                        if (alert_trap_detect)
                        {
@@ -1971,12 +1949,12 @@ static DIRECTION travel_test(DIRECTION prev_dir)
                POSITION col = p_ptr->x + ddx[dir];
 
                /* Access grid */
-               g_ptr = &current_floor_ptr->grid_array[row][col];
+               g_ptr = &p_ptr->current_floor_ptr->grid_array[row][col];
 
                /* Visible monsters abort running */
                if (g_ptr->m_idx)
                {
-                       monster_type *m_ptr = &current_floor_ptr->m_list[g_ptr->m_idx];
+                       monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
 
                        /* Visible monster */
                        if (m_ptr->ml) return (0);
@@ -2001,13 +1979,13 @@ static DIRECTION travel_test(DIRECTION prev_dir)
        if (!new_dir) return (0);
 
        /* Access newly move grid */
-       g_ptr = &current_floor_ptr->grid_array[p_ptr->y+ddy[new_dir]][p_ptr->x+ddx[new_dir]];
+       g_ptr = &p_ptr->current_floor_ptr->grid_array[p_ptr->y+ddy[new_dir]][p_ptr->x+ddx[new_dir]];
 
        /* Close door abort traveling */
        if (!easy_open && is_closed_door(g_ptr->feat)) return (0);
 
        /* Visible and unignorable trap abort tarveling */
-       if (!g_ptr->mimic && !trap_can_be_ignored(g_ptr->feat)) return (0);
+       if (!g_ptr->mimic && !trap_can_be_ignored(p_ptr, g_ptr->feat)) return (0);
 
        /* Move new grid */
        return (new_dir);
@@ -2031,13 +2009,13 @@ void travel_step(void)
                        msg_print(_("道筋が見つかりません!", "No route is found!"));
                        travel.y = travel.x = 0;
                }
-               disturb(FALSE, TRUE);
+               disturb(p_ptr, FALSE, TRUE);
                return;
        }
 
        take_turn(p_ptr, 100);
 
-       move_player(travel.dir, always_pickup, FALSE);
+       move_player(p_ptr, travel.dir, always_pickup, FALSE);
 
        if ((p_ptr->y == travel.y) && (p_ptr->x == travel.x))
        {
@@ -2072,9 +2050,9 @@ void forget_travel_flow(void)
 {
        POSITION x, y;
        /* Check the entire dungeon / Forget the old data */
-       for (y = 0; y < current_floor_ptr->height; y++)
+       for (y = 0; y < p_ptr->current_floor_ptr->height; y++)
        {
-               for (x = 0; x < current_floor_ptr->width; x++)
+               for (x = 0; x < p_ptr->current_floor_ptr->width; x++)
                {
 
                        travel.cost[y][x] = MAX_SHORT;
@@ -2091,7 +2069,7 @@ void forget_travel_flow(void)
  */
 static int travel_flow_cost(POSITION y, POSITION x)
 {
-       feature_type *f_ptr = &f_info[current_floor_ptr->grid_array[y][x].feat];
+       feature_type *f_ptr = &f_info[p_ptr->current_floor_ptr->grid_array[y][x].feat];
        int cost = 1;
 
        /* Avoid obstacles (ex. trees) */
@@ -2115,7 +2093,7 @@ static int travel_flow_cost(POSITION y, POSITION x)
        }
 
        /* Detected traps and doors */
-       if (current_floor_ptr->grid_array[y][x].info & (CAVE_MARK))
+       if (p_ptr->current_floor_ptr->grid_array[y][x].info & (CAVE_MARK))
        {
                if (have_flag(f_ptr->flags, FF_DOOR)) cost += 1;
                if (have_flag(f_ptr->flags, FF_TRAP)) cost += 10;
@@ -2134,7 +2112,7 @@ static int travel_flow_cost(POSITION y, POSITION x)
  */
 static void travel_flow_aux(POSITION y, POSITION x, int n, bool wall)
 {
-       grid_type *g_ptr = &current_floor_ptr->grid_array[y][x];
+       grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x];
        feature_type *f_ptr = &f_info[g_ptr->feat];
        int old_head = flow_head;
        int add_cost = 1;
@@ -2143,15 +2121,15 @@ static void travel_flow_aux(POSITION y, POSITION x, int n, bool wall)
        int cost;
 
        /* Ignore out of bounds */
-       if (!in_bounds(y, x)) return;
+       if (!in_bounds(p_ptr->current_floor_ptr, y, x)) return;
 
        /* Ignore unknown grid except in wilderness */
-       if (current_floor_ptr->dun_level > 0 && !(g_ptr->info & CAVE_KNOWN)) return;
+       if (p_ptr->current_floor_ptr->dun_level > 0 && !(g_ptr->info & CAVE_KNOWN)) return;
 
        /* Ignore "walls" and "rubble" (include "secret doors") */
        if (have_flag(f_ptr->flags, FF_WALL) ||
                have_flag(f_ptr->flags, FF_CAN_DIG) ||
-               (have_flag(f_ptr->flags, FF_DOOR) && current_floor_ptr->grid_array[y][x].mimic) ||
+               (have_flag(f_ptr->flags, FF_DOOR) && p_ptr->current_floor_ptr->grid_array[y][x].mimic) ||
                (!have_flag(f_ptr->flags, FF_MOVE) && have_flag(f_ptr->flags, FF_CAN_FLY) && !p_ptr->levitation))
        {
                if (!wall || !from_wall) return;
@@ -2194,7 +2172,7 @@ static void travel_flow(POSITION ty, POSITION tx)
        POSITION x, y;
        DIRECTION d;
        bool wall = FALSE;
-       feature_type *f_ptr = &f_info[current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].feat];
+       feature_type *f_ptr = &f_info[p_ptr->current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].feat];
 
        /* Reset the "queue" */
        flow_head = flow_tail = 0;
@@ -2234,7 +2212,7 @@ static void travel_flow(POSITION ty, POSITION tx)
  * @brief トラベル処理のメインルーチン
  * @return なし
  */
-void do_cmd_travel(void)
+void do_cmd_travel(player_type *creature_ptr)
 {
        POSITION x, y;
        int i;
@@ -2249,18 +2227,18 @@ void do_cmd_travel(void)
        }
        else if (!tgt_pt(&x, &y)) return;
 
-       if ((x == p_ptr->x) && (y == p_ptr->y))
+       if ((x == creature_ptr->x) && (y == creature_ptr->y))
        {
                msg_print(_("すでにそこにいます!", "You are already there!!"));
                return;
        }
 
-       f_ptr = &f_info[current_floor_ptr->grid_array[y][x].feat];
+       f_ptr = &f_info[p_ptr->current_floor_ptr->grid_array[y][x].feat];
 
-       if ((current_floor_ptr->grid_array[y][x].info & CAVE_MARK) &&
+       if ((p_ptr->current_floor_ptr->grid_array[y][x].info & CAVE_MARK) &&
                (have_flag(f_ptr->flags, FF_WALL) ||
                        have_flag(f_ptr->flags, FF_CAN_DIG) ||
-                       (have_flag(f_ptr->flags, FF_DOOR) && current_floor_ptr->grid_array[y][x].mimic)))
+                       (have_flag(f_ptr->flags, FF_DOOR) && p_ptr->current_floor_ptr->grid_array[y][x].mimic)))
        {
                msg_print(_("そこには行くことができません!", "You cannot travel there!"));
                return;
@@ -2274,15 +2252,13 @@ void do_cmd_travel(void)
 
        /* Travel till 255 steps */
        travel.run = 255;
-
-       /* Paranoia */
        travel.dir = 0;
 
        /* Decides first direction */
-       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);
+       dx = abs(creature_ptr->x - x);
+       dy = abs(creature_ptr->y - y);
+       sx = ((x == creature_ptr->x) || (dx < dy)) ? 0 : ((x > creature_ptr->x) ? 1 : -1);
+       sy = ((y == creature_ptr->y) || (dy < dx)) ? 0 : ((y > creature_ptr->y) ? 1 : -1);
 
        for (i = 1; i <= 9; i++)
        {
@@ -2297,7 +2273,7 @@ void do_cmd_travel(void)
  * The second arg is currently unused, but could induce output flush.
  * All disturbance cancels repeated commands, resting, and running.
  */
-void disturb(bool stop_search, bool stop_travel)
+void disturb(player_type *creature_ptr, bool stop_search, bool stop_travel)
 {
 #ifndef TRAVEL
        /* Unused */
@@ -2314,30 +2290,30 @@ void disturb(bool stop_search, bool stop_travel)
                command_rep = 0;
 
                /* Redraw the state (later) */
-               p_ptr->redraw |= (PR_STATE);
+               creature_ptr->redraw |= (PR_STATE);
        }
 
        /* Cancel Resting */
-       if ((p_ptr->action == ACTION_REST) || (p_ptr->action == ACTION_FISH) || (stop_search && (p_ptr->action == ACTION_SEARCH)))
+       if ((creature_ptr->action == ACTION_REST) || (creature_ptr->action == ACTION_FISH) || (stop_search && (creature_ptr->action == ACTION_SEARCH)))
        {
                /* Cancel */
-               set_action(ACTION_NONE);
+               set_action(creature_ptr, ACTION_NONE);
        }
 
        /* Cancel running */
-       if (running)
+       if (creature_ptr->running)
        {
                /* Cancel */
-               running = 0;
+               creature_ptr->running = 0;
 
                /* Check for new panel if appropriate */
                if (center_player && !center_running) verify_panel();
 
                /* Calculate torch radius */
-               p_ptr->update |= (PU_TORCH);
+               creature_ptr->update |= (PU_TORCH);
 
                /* Update monster flow */
-               p_ptr->update |= (PU_FLOW);
+               creature_ptr->update |= (PU_FLOW);
        }
 
 #ifdef TRAVEL
@@ -2350,7 +2326,7 @@ void disturb(bool stop_search, bool stop_travel)
                if (center_player && !center_running) verify_panel();
 
                /* Calculate torch radius */
-               p_ptr->update |= (PU_TORCH);
+               creature_ptr->update |= (PU_TORCH);
        }
 #endif