OSDN Git Service

[Refactor] #38997 place_monster*()、alloc_*()、set_pet()、multiply_monster()、summon_...
[hengband/hengband.git] / src / core.c
index 4dc9e3c..c11df92 100644 (file)
@@ -1,13 +1,13 @@
 /*!
-    @file dungeon.c
-    @brief Angbandゲームエンジン / Angband game engine
-    @date 2013/12/31
-    @author
-    Copyright (c) 1989 James E. Wilson, Robert A. Koeneke\n
-    This software may be copied and distributed for educational, research, and\n
-    not for profit purposes provided that this copyright and statement are\n
-    included in all such copies.\n
-    2013 Deskull rearranged comment for Doxygen.
+       @file dungeon.c
+       @brief Angbandゲームエンジン / Angband game engine
+       @date 2013/12/31
+       @author
+       Copyright (c) 1989 James E. Wilson, Robert A. Koeneke\n
+       This software may be copied and distributed for educational, research, and\n
+       not for profit purposes provided that this copyright and statement are\n
+       included in all such copies.\n
+       2013 Deskull rearranged comment for Doxygen.
  */
 
 #include "angband.h"
@@ -130,13 +130,14 @@ int init_flags;
 /*!
  * @brief 擬似鑑定を実際に行い判定を反映する
  * @param slot 擬似鑑定を行うプレイヤーの所持リストID
+ * @param creature_ptr プレーヤーへの参照ポインタ
  * @param heavy 重度の擬似鑑定を行うならばTRUE
  * @return なし
  */
-static void sense_inventory_aux(INVENTORY_IDX slot, bool heavy)
+static void sense_inventory_aux(player_type *creature_ptr, INVENTORY_IDX slot, bool heavy)
 {
        byte feel;
-       object_type *o_ptr = &p_ptr->inventory_list[slot];
+       object_type *o_ptr = &creature_ptr->inventory_list[slot];
        GAME_TEXT o_name[MAX_NLEN];
 
        /* We know about it already, do not tell us again */
@@ -152,56 +153,56 @@ static void sense_inventory_aux(INVENTORY_IDX slot, bool heavy)
        if (!feel) return;
 
        /* Bad luck */
-       if ((p_ptr->muta3 & MUT3_BAD_LUCK) && !randint0(13))
+       if ((creature_ptr->muta3 & MUT3_BAD_LUCK) && !randint0(13))
        {
                switch (feel)
                {
-                       case FEEL_TERRIBLE:
-                       {
-                               feel = FEEL_SPECIAL;
-                               break;
-                       }
-                       case FEEL_WORTHLESS:
-                       {
-                               feel = FEEL_EXCELLENT;
-                               break;
-                       }
-                       case FEEL_CURSED:
-                       {
-                               if (heavy)
-                                       feel = randint0(3) ? FEEL_GOOD : FEEL_AVERAGE;
-                               else
-                                       feel = FEEL_UNCURSED;
-                               break;
-                       }
-                       case FEEL_AVERAGE:
-                       {
-                               feel = randint0(2) ? FEEL_CURSED : FEEL_GOOD;
-                               break;
-                       }
-                       case FEEL_GOOD:
-                       {
-                               if (heavy)
-                                       feel = randint0(3) ? FEEL_CURSED : FEEL_AVERAGE;
-                               else
-                                       feel = FEEL_CURSED;
-                               break;
-                       }
-                       case FEEL_EXCELLENT:
-                       {
-                               feel = FEEL_WORTHLESS;
-                               break;
-                       }
-                       case FEEL_SPECIAL:
-                       {
-                               feel = FEEL_TERRIBLE;
-                               break;
-                       }
+               case FEEL_TERRIBLE:
+               {
+                       feel = FEEL_SPECIAL;
+                       break;
+               }
+               case FEEL_WORTHLESS:
+               {
+                       feel = FEEL_EXCELLENT;
+                       break;
+               }
+               case FEEL_CURSED:
+               {
+                       if (heavy)
+                               feel = randint0(3) ? FEEL_GOOD : FEEL_AVERAGE;
+                       else
+                               feel = FEEL_UNCURSED;
+                       break;
+               }
+               case FEEL_AVERAGE:
+               {
+                       feel = randint0(2) ? FEEL_CURSED : FEEL_GOOD;
+                       break;
+               }
+               case FEEL_GOOD:
+               {
+                       if (heavy)
+                               feel = randint0(3) ? FEEL_CURSED : FEEL_AVERAGE;
+                       else
+                               feel = FEEL_CURSED;
+                       break;
+               }
+               case FEEL_EXCELLENT:
+               {
+                       feel = FEEL_WORTHLESS;
+                       break;
+               }
+               case FEEL_SPECIAL:
+               {
+                       feel = FEEL_TERRIBLE;
+                       break;
+               }
                }
        }
 
        /* Stop everything */
-       if (disturb_minor) disturb(p_ptr, FALSE, FALSE);
+       if (disturb_minor) disturb(creature_ptr, FALSE, FALSE);
 
        /* Get an object description */
        object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
@@ -211,27 +212,25 @@ static void sense_inventory_aux(INVENTORY_IDX slot, bool heavy)
        {
 #ifdef JP
                msg_format("%s%s(%c)は%sという感じがする...",
-                       describe_use(slot),o_name, index_to_label(slot),game_inscriptions[feel]);
+                       describe_use(creature_ptr, slot), o_name, index_to_label(slot), game_inscriptions[feel]);
 #else
                msg_format("You feel the %s (%c) you are %s %s %s...",
-                          o_name, index_to_label(slot), describe_use(slot),
-                          ((o_ptr->number == 1) ? "is" : "are"),
-                                  game_inscriptions[feel]);
+                       o_name, index_to_label(slot), describe_use(creature_ptr, slot),
+                       ((o_ptr->number == 1) ? "is" : "are"),
+                       game_inscriptions[feel]);
 #endif
 
        }
-
-       /* Message (p_ptr->inventory_list) */
        else
        {
 #ifdef JP
                msg_format("ザックの中の%s(%c)は%sという感じがする...",
-                       o_name, index_to_label(slot),game_inscriptions[feel]);
+                       o_name, index_to_label(slot), game_inscriptions[feel]);
 #else
                msg_format("You feel the %s (%c) in your pack %s %s...",
-                          o_name, index_to_label(slot),
-                          ((o_ptr->number == 1) ? "is" : "are"),
-                                  game_inscriptions[feel]);
+                       o_name, index_to_label(slot),
+                       ((o_ptr->number == 1) ? "is" : "are"),
+                       game_inscriptions[feel]);
 #endif
 
        }
@@ -242,19 +241,17 @@ static void sense_inventory_aux(INVENTORY_IDX slot, bool heavy)
        o_ptr->feeling = feel;
 
        /* Auto-inscription/destroy */
-       autopick_alter_item(slot, destroy_feeling);
-       p_ptr->update |= (PU_COMBINE | PU_REORDER);
-
-       p_ptr->window |= (PW_INVEN | PW_EQUIP);
+       autopick_alter_item(creature_ptr, slot, destroy_feeling);
+       creature_ptr->update |= (PU_COMBINE | PU_REORDER);
+       creature_ptr->window |= (PW_INVEN | PW_EQUIP);
 }
 
 
-
 /*!
  * @brief 1プレイヤーターン毎に武器、防具の擬似鑑定が行われるかを判定する。
  * @return なし
  * @details
- * Sense the p_ptr->inventory_list\n
+ * Sense the inventory\n
  *\n
  *   Class 0 = Warrior --> fast and heavy\n
  *   Class 1 = Mage    --> slow and light\n
@@ -279,151 +276,151 @@ static void sense_inventory1(player_type *creature_ptr)
        /* Analyze the class */
        switch (creature_ptr->pclass)
        {
-               case CLASS_WARRIOR:
-               case CLASS_ARCHER:
-               case CLASS_SAMURAI:
-               case CLASS_CAVALRY:
-               {
-                       /* Good sensing */
-                       if (0 != randint0(9000L / (plev * plev + 40))) return;
+       case CLASS_WARRIOR:
+       case CLASS_ARCHER:
+       case CLASS_SAMURAI:
+       case CLASS_CAVALRY:
+       {
+               /* Good sensing */
+               if (0 != randint0(9000L / (plev * plev + 40))) return;
 
-                       /* Heavy sensing */
-                       heavy = TRUE;
+               /* Heavy sensing */
+               heavy = TRUE;
 
-                       break;
-               }
+               break;
+       }
 
-               case CLASS_SMITH:
-               {
-                       /* Good sensing */
-                       if (0 != randint0(6000L / (plev * plev + 50))) return;
+       case CLASS_SMITH:
+       {
+               /* Good sensing */
+               if (0 != randint0(6000L / (plev * plev + 50))) return;
 
-                       /* Heavy sensing */
-                       heavy = TRUE;
+               /* Heavy sensing */
+               heavy = TRUE;
 
-                       break;
-               }
+               break;
+       }
 
-               case CLASS_MAGE:
-               case CLASS_HIGH_MAGE:
-               case CLASS_SORCERER:
-               case CLASS_MAGIC_EATER:
-               {
-                       /* Very bad (light) sensing */
-                       if (0 != randint0(240000L / (plev + 5))) return;
+       case CLASS_MAGE:
+       case CLASS_HIGH_MAGE:
+       case CLASS_SORCERER:
+       case CLASS_MAGIC_EATER:
+       {
+               /* Very bad (light) sensing */
+               if (0 != randint0(240000L / (plev + 5))) return;
 
-                       break;
-               }
+               break;
+       }
 
-               case CLASS_PRIEST:
-               case CLASS_BARD:
-               {
-                       /* Good (light) sensing */
-                       if (0 != randint0(10000L / (plev * plev + 40))) return;
+       case CLASS_PRIEST:
+       case CLASS_BARD:
+       {
+               /* Good (light) sensing */
+               if (0 != randint0(10000L / (plev * plev + 40))) return;
 
-                       break;
-               }
+               break;
+       }
 
-               case CLASS_ROGUE:
-               case CLASS_NINJA:
-               {
-                       /* Okay sensing */
-                       if (0 != randint0(20000L / (plev * plev + 40))) return;
+       case CLASS_ROGUE:
+       case CLASS_NINJA:
+       {
+               /* Okay sensing */
+               if (0 != randint0(20000L / (plev * plev + 40))) return;
 
-                       /* Heavy sensing */
-                       heavy = TRUE;
+               /* Heavy sensing */
+               heavy = TRUE;
 
-                       break;
-               }
+               break;
+       }
 
-               case CLASS_RANGER:
-               {
-                       /* Bad sensing */
-                       if (0 != randint0(95000L / (plev * plev + 40))) return;
+       case CLASS_RANGER:
+       {
+               /* Bad sensing */
+               if (0 != randint0(95000L / (plev * plev + 40))) return;
 
-                       /* Changed! */
-                       heavy = TRUE;
+               /* Changed! */
+               heavy = TRUE;
 
-                       break;
-               }
+               break;
+       }
 
-               case CLASS_PALADIN:
-               case CLASS_SNIPER:
-               {
-                       /* Bad sensing */
-                       if (0 != randint0(77777L / (plev * plev + 40))) return;
+       case CLASS_PALADIN:
+       case CLASS_SNIPER:
+       {
+               /* Bad sensing */
+               if (0 != randint0(77777L / (plev * plev + 40))) return;
 
-                       /* Heavy sensing */
-                       heavy = TRUE;
+               /* Heavy sensing */
+               heavy = TRUE;
 
-                       break;
-               }
+               break;
+       }
 
-               case CLASS_WARRIOR_MAGE:
-               case CLASS_RED_MAGE:
-               {
-                       /* Bad sensing */
-                       if (0 != randint0(75000L / (plev * plev + 40))) return;
+       case CLASS_WARRIOR_MAGE:
+       case CLASS_RED_MAGE:
+       {
+               /* Bad sensing */
+               if (0 != randint0(75000L / (plev * plev + 40))) return;
 
-                       break;
-               }
+               break;
+       }
 
-               case CLASS_MINDCRAFTER:
-               case CLASS_IMITATOR:
-               case CLASS_BLUE_MAGE:
-               case CLASS_MIRROR_MASTER:
-               {
-                       /* Bad sensing */
-                       if (0 != randint0(55000L / (plev * plev + 40))) return;
+       case CLASS_MINDCRAFTER:
+       case CLASS_IMITATOR:
+       case CLASS_BLUE_MAGE:
+       case CLASS_MIRROR_MASTER:
+       {
+               /* Bad sensing */
+               if (0 != randint0(55000L / (plev * plev + 40))) return;
 
-                       break;
-               }
+               break;
+       }
 
-               case CLASS_CHAOS_WARRIOR:
-               {
-                       /* Bad sensing */
-                       if (0 != randint0(80000L / (plev * plev + 40))) return;
+       case CLASS_CHAOS_WARRIOR:
+       {
+               /* Bad sensing */
+               if (0 != randint0(80000L / (plev * plev + 40))) return;
 
-                       /* Changed! */
-                       heavy = TRUE;
+               /* Changed! */
+               heavy = TRUE;
 
-                       break;
-               }
+               break;
+       }
 
-               case CLASS_MONK:
-               case CLASS_FORCETRAINER:
-               {
-                       /* Okay sensing */
-                       if (0 != randint0(20000L / (plev * plev + 40))) return;
+       case CLASS_MONK:
+       case CLASS_FORCETRAINER:
+       {
+               /* Okay sensing */
+               if (0 != randint0(20000L / (plev * plev + 40))) return;
 
-                       break;
-               }
+               break;
+       }
 
-               case CLASS_TOURIST:
-               {
-                       /* Good sensing */
-                       if (0 != randint0(20000L / ((plev+50)*(plev+50)))) return;
+       case CLASS_TOURIST:
+       {
+               /* Good sensing */
+               if (0 != randint0(20000L / ((plev + 50)*(plev + 50)))) return;
 
-                       /* Heavy sensing */
-                       heavy = TRUE;
+               /* Heavy sensing */
+               heavy = TRUE;
 
-                       break;
-               }
+               break;
+       }
 
-               case CLASS_BEASTMASTER:
-               {
-                       /* Bad sensing */
-                       if (0 != randint0(65000L / (plev * plev + 40))) return;
+       case CLASS_BEASTMASTER:
+       {
+               /* Bad sensing */
+               if (0 != randint0(65000L / (plev * plev + 40))) return;
 
-                       break;
-               }
-               case CLASS_BERSERKER:
-               {
-                       /* Heavy sensing */
-                       heavy = TRUE;
+               break;
+       }
+       case CLASS_BERSERKER:
+       {
+               /* Heavy sensing */
+               heavy = TRUE;
 
-                       break;
-               }
+               break;
+       }
        }
 
        if (compare_virtue(creature_ptr, V_KNOWLEDGE, 100, VIRTUE_LARGE)) heavy = TRUE;
@@ -443,28 +440,28 @@ static void sense_inventory1(player_type *creature_ptr)
                /* Valid "tval" codes */
                switch (o_ptr->tval)
                {
-                       case TV_SHOT:
-                       case TV_ARROW:
-                       case TV_BOLT:
-                       case TV_BOW:
-                       case TV_DIGGING:
-                       case TV_HAFTED:
-                       case TV_POLEARM:
-                       case TV_SWORD:
-                       case TV_BOOTS:
-                       case TV_GLOVES:
-                       case TV_HELM:
-                       case TV_CROWN:
-                       case TV_SHIELD:
-                       case TV_CLOAK:
-                       case TV_SOFT_ARMOR:
-                       case TV_HARD_ARMOR:
-                       case TV_DRAG_ARMOR:
-                       case TV_CARD:
-                       {
-                               okay = TRUE;
-                               break;
-                       }
+               case TV_SHOT:
+               case TV_ARROW:
+               case TV_BOLT:
+               case TV_BOW:
+               case TV_DIGGING:
+               case TV_HAFTED:
+               case TV_POLEARM:
+               case TV_SWORD:
+               case TV_BOOTS:
+               case TV_GLOVES:
+               case TV_HELM:
+               case TV_CROWN:
+               case TV_SHIELD:
+               case TV_CLOAK:
+               case TV_SOFT_ARMOR:
+               case TV_HARD_ARMOR:
+               case TV_DRAG_ARMOR:
+               case TV_CARD:
+               {
+                       okay = TRUE;
+                       break;
+               }
                }
 
                /* Skip non-sense machines */
@@ -479,7 +476,7 @@ static void sense_inventory1(player_type *creature_ptr)
                        heavy = TRUE;
                }
 
-               sense_inventory_aux(i, heavy);
+               sense_inventory_aux(creature_ptr, i, heavy);
        }
 }
 
@@ -502,72 +499,72 @@ static void sense_inventory2(player_type *creature_ptr)
        /* Analyze the class */
        switch (creature_ptr->pclass)
        {
-               case CLASS_WARRIOR:
-               case CLASS_ARCHER:
-               case CLASS_SAMURAI:
-               case CLASS_CAVALRY:
-               case CLASS_BERSERKER:
-               case CLASS_SNIPER:
-               {
-                       return;
-               }
+       case CLASS_WARRIOR:
+       case CLASS_ARCHER:
+       case CLASS_SAMURAI:
+       case CLASS_CAVALRY:
+       case CLASS_BERSERKER:
+       case CLASS_SNIPER:
+       {
+               return;
+       }
 
-               case CLASS_SMITH:
-               case CLASS_PALADIN:
-               case CLASS_CHAOS_WARRIOR:
-               case CLASS_IMITATOR:
-               case CLASS_BEASTMASTER:
-               case CLASS_NINJA:
-               {
-                       /* Very bad (light) sensing */
-                       if (0 != randint0(240000L / (plev + 5))) return;
+       case CLASS_SMITH:
+       case CLASS_PALADIN:
+       case CLASS_CHAOS_WARRIOR:
+       case CLASS_IMITATOR:
+       case CLASS_BEASTMASTER:
+       case CLASS_NINJA:
+       {
+               /* Very bad (light) sensing */
+               if (0 != randint0(240000L / (plev + 5))) return;
 
-                       break;
-               }
+               break;
+       }
 
-               case CLASS_RANGER:
-               case CLASS_WARRIOR_MAGE:
-               case CLASS_RED_MAGE:
-               case CLASS_MONK:
-               {
-                       /* Bad sensing */
-                       if (0 != randint0(95000L / (plev * plev + 40))) return;
+       case CLASS_RANGER:
+       case CLASS_WARRIOR_MAGE:
+       case CLASS_RED_MAGE:
+       case CLASS_MONK:
+       {
+               /* Bad sensing */
+               if (0 != randint0(95000L / (plev * plev + 40))) return;
 
-                       break;
-               }
+               break;
+       }
 
-               case CLASS_PRIEST:
-               case CLASS_BARD:
-               case CLASS_ROGUE:
-               case CLASS_FORCETRAINER:
-               case CLASS_MINDCRAFTER:
-               {
-                       /* Good sensing */
-                       if (0 != randint0(20000L / (plev * plev + 40))) return;
+       case CLASS_PRIEST:
+       case CLASS_BARD:
+       case CLASS_ROGUE:
+       case CLASS_FORCETRAINER:
+       case CLASS_MINDCRAFTER:
+       {
+               /* Good sensing */
+               if (0 != randint0(20000L / (plev * plev + 40))) return;
 
-                       break;
-               }
+               break;
+       }
 
-               case CLASS_MAGE:
-               case CLASS_HIGH_MAGE:
-               case CLASS_SORCERER:
-               case CLASS_MAGIC_EATER:
-               case CLASS_MIRROR_MASTER:
-               case CLASS_BLUE_MAGE:
-               {
-                       /* Good sensing */
-                       if (0 != randint0(9000L / (plev * plev + 40))) return;
+       case CLASS_MAGE:
+       case CLASS_HIGH_MAGE:
+       case CLASS_SORCERER:
+       case CLASS_MAGIC_EATER:
+       case CLASS_MIRROR_MASTER:
+       case CLASS_BLUE_MAGE:
+       {
+               /* Good sensing */
+               if (0 != randint0(9000L / (plev * plev + 40))) return;
 
-                       break;
-               }
+               break;
+       }
 
-               case CLASS_TOURIST:
-               {
-                       /* Good sensing */
-                       if (0 != randint0(20000L / ((plev+50)*(plev+50)))) return;
+       case CLASS_TOURIST:
+       {
+               /* Good sensing */
+               if (0 != randint0(20000L / ((plev + 50)*(plev + 50)))) return;
 
-                       break;
-               }
+               break;
+       }
        }
 
        /*** Sense everything ***/
@@ -585,14 +582,14 @@ static void sense_inventory2(player_type *creature_ptr)
                /* Valid "tval" codes */
                switch (o_ptr->tval)
                {
-                       case TV_RING:
-                       case TV_AMULET:
-                       case TV_LITE:
-                       case TV_FIGURINE:
-                       {
-                               okay = TRUE;
-                               break;
-                       }
+               case TV_RING:
+               case TV_AMULET:
+               case TV_LITE:
+               case TV_FIGURINE:
+               {
+                       okay = TRUE;
+                       break;
+               }
                }
 
                /* Skip non-sense machines */
@@ -601,12 +598,14 @@ static void sense_inventory2(player_type *creature_ptr)
                /* Occasional failure on creature_ptr->inventory_list items */
                if ((i < INVEN_RARM) && (0 != randint0(5))) continue;
 
-               sense_inventory_aux(i, TRUE);
+               sense_inventory_aux(creature_ptr, i, TRUE);
        }
 }
 
+
 /*!
  * @brief パターン終点到達時のテレポート処理を行う
+ * @param creature_ptr プレーヤーへの参照ポインタ
  * @return なし
  */
 static void pattern_teleport(player_type *creature_ptr)
@@ -665,14 +664,14 @@ static void pattern_teleport(player_type *creature_ptr)
        /* Accept request */
        msg_format(_("%d 階にテレポートしました。", "You teleport to dungeon level %d."), command_arg);
 
-       if (autosave_l) do_cmd_save_game(TRUE);
+       if (autosave_l) do_cmd_save_game(creature_ptr, TRUE);
 
        /* Change level */
        creature_ptr->current_floor_ptr->dun_level = command_arg;
 
-       leave_quest_check();
+       leave_quest_check(creature_ptr);
 
-       if (record_stair) exe_write_diary(creature_ptr, NIKKI_PAT_TELE, 0, NULL);
+       if (record_stair) exe_write_diary(creature_ptr, DIARY_PAT_TELE, 0, NULL);
 
        creature_ptr->current_floor_ptr->inside_quest = 0;
        free_turn(creature_ptr);
@@ -681,7 +680,7 @@ static void pattern_teleport(player_type *creature_ptr)
         * Clear all saved floors
         * and create a first saved floor
         */
-       prepare_change_floor_mode(CFM_FIRST_FLOOR);
+       prepare_change_floor_mode(creature_ptr, CFM_FIRST_FLOOR);
        creature_ptr->leaving = TRUE;
 }
 
@@ -696,12 +695,13 @@ static bool pattern_effect(player_type *creature_ptr)
        if (!pattern_tile(creature_ptr->y, creature_ptr->x)) return FALSE;
 
        if ((PRACE_IS_(creature_ptr, RACE_AMBERITE)) &&
-           (creature_ptr->cut > 0) && one_in_(10))
+               (creature_ptr->cut > 0) && one_in_(10))
        {
                wreck_the_pattern(creature_ptr);
        }
 
-       pattern_type = f_info[p_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat].subtype;
+       floor_type *floor_ptr = creature_ptr->current_floor_ptr;
+       pattern_type = f_info[floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat].subtype;
 
        switch (pattern_type)
        {
@@ -711,7 +711,7 @@ static bool pattern_effect(player_type *creature_ptr)
                (void)restore_level(creature_ptr);
                (void)cure_critical_wounds(creature_ptr, 1000);
 
-               cave_set_feat(creature_ptr->current_floor_ptr, creature_ptr->y, creature_ptr->x, feat_pattern_old);
+               cave_set_feat(creature_ptr, creature_ptr->y, creature_ptr->x, feat_pattern_old);
                msg_print(_("「パターン」のこの部分は他の部分より強力でないようだ。", "This section of the Pattern looks less powerful."));
 
                /*
@@ -731,14 +731,14 @@ static bool pattern_effect(player_type *creature_ptr)
                break;
 
        case PATTERN_TILE_WRECKED:
-               if (!IS_INVULN())
+               if (!IS_INVULN(creature_ptr))
                        take_hit(creature_ptr, DAMAGE_NOESCAPE, 200, _("壊れた「パターン」を歩いたダメージ", "walking the corrupted Pattern"), -1);
                break;
 
        default:
                if (PRACE_IS_(creature_ptr, RACE_AMBERITE) && !one_in_(2))
                        return TRUE;
-               else if (!IS_INVULN())
+               else if (!IS_INVULN(creature_ptr))
                        take_hit(creature_ptr, DAMAGE_NOESCAPE, damroll(1, 3), _("「パターン」を歩いたダメージ", "walking the Pattern"), -1);
                break;
        }
@@ -752,17 +752,17 @@ static bool pattern_effect(player_type *creature_ptr)
  * @param percent 回復比率
  * @return なし
  */
-static void regenhp(int percent)
+static void regenhp(player_type *creature_ptr, int percent)
 {
        HIT_POINT new_chp;
        u32b new_chp_frac;
        HIT_POINT old_chp;
 
-       if (p_ptr->special_defense & KATA_KOUKIJIN) return;
-       if (p_ptr->action == ACTION_HAYAGAKE) return;
+       if (creature_ptr->special_defense & KATA_KOUKIJIN) return;
+       if (creature_ptr->action == ACTION_HAYAGAKE) return;
 
        /* Save the old hitpoints */
-       old_chp = p_ptr->chp;
+       old_chp = creature_ptr->chp;
 
        /*
         * Extract the new hitpoints
@@ -770,27 +770,27 @@ static void regenhp(int percent)
         * 'percent' is the Regen factor in unit (1/2^16)
         */
        new_chp = 0;
-       new_chp_frac = (p_ptr->mhp * percent + PY_REGEN_HPBASE);
+       new_chp_frac = (creature_ptr->mhp * percent + PY_REGEN_HPBASE);
 
        /* Convert the unit (1/2^16) to (1/2^32) */
        s64b_LSHIFT(new_chp, new_chp_frac, 16);
 
        /* Regenerating */
-       s64b_add(&(p_ptr->chp), &(p_ptr->chp_frac), new_chp, new_chp_frac);
+       s64b_add(&(creature_ptr->chp), &(creature_ptr->chp_frac), new_chp, new_chp_frac);
 
 
        /* Fully healed */
-       if (0 < s64b_cmp(p_ptr->chp, p_ptr->chp_frac, p_ptr->mhp, 0))
+       if (0 < s64b_cmp(creature_ptr->chp, creature_ptr->chp_frac, creature_ptr->mhp, 0))
        {
-               p_ptr->chp = p_ptr->mhp;
-               p_ptr->chp_frac = 0;
+               creature_ptr->chp = creature_ptr->mhp;
+               creature_ptr->chp_frac = 0;
        }
 
        /* Notice changes */
-       if (old_chp != p_ptr->chp)
+       if (old_chp != creature_ptr->chp)
        {
-               p_ptr->redraw |= (PR_HP);
-               p_ptr->window |= (PW_PLAYER);
+               creature_ptr->redraw |= (PR_HP);
+               creature_ptr->window |= (PW_PLAYER);
                wild_regen = 20;
        }
 }
@@ -895,7 +895,7 @@ static void regenmagic(player_type *creature_ptr, int regen_amount)
        int dev = 30;
        int mult = (dev + adj_mag_mana[creature_ptr->stat_ind[A_INT]]); /* x1 to x2 speed bonus for recharging */
 
-       for (i = 0; i < EATER_EXT*2; i++)
+       for (i = 0; i < EATER_EXT * 2; i++)
        {
                if (!creature_ptr->magic_num2[i]) continue;
                if (creature_ptr->magic_num1[i] == ((long)creature_ptr->magic_num2[i] << 16)) continue;
@@ -911,14 +911,14 @@ static void regenmagic(player_type *creature_ptr, int regen_amount)
                }
                wild_regen = 20;
        }
-       for (i = EATER_EXT*2; i < EATER_EXT*3; i++)
+       for (i = EATER_EXT * 2; i < EATER_EXT * 3; i++)
        {
                if (!creature_ptr->magic_num1[i]) continue;
                if (!creature_ptr->magic_num2[i]) continue;
 
                /* Decrease remaining period for charging */
-               new_mana = (regen_amount * mult * ((long)creature_ptr->magic_num2[i] + 10) * EATER_ROD_CHARGE) 
-                                       / (dev * 16 * PY_REGEN_NORMAL); 
+               new_mana = (regen_amount * mult * ((long)creature_ptr->magic_num2[i] + 10) * EATER_ROD_CHARGE)
+                       / (dev * 16 * PY_REGEN_NORMAL);
                creature_ptr->magic_num1[i] -= new_mana;
 
                /* Check minimum remaining period for charging */
@@ -930,19 +930,16 @@ static void regenmagic(player_type *creature_ptr, int regen_amount)
 
 /*!
  * @brief 100ゲームターン毎のモンスターのHP自然回復処理 / Regenerate the monsters (once per 100 game turns)
+ * @param player_ptr プレーヤーへの参照ポインタ
  * @return なし
  * @note Should probably be done during monster turns.
  */
-static void regen_monsters(void)
+static void regenerate_monsters(player_type *player_ptr)
 {
-       int i, frac;
-
-
-       /* Regenerate everyone */
-       for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++)
+       for (int i = 1; i < player_ptr->current_floor_ptr->m_max; i++)
        {
                /* Check the i'th monster */
-               monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i];
+               monster_type *m_ptr = &player_ptr->current_floor_ptr->m_list[i];
                monster_race *r_ptr = &r_info[m_ptr->r_idx];
 
                if (!monster_is_valid(m_ptr)) continue;
@@ -951,7 +948,7 @@ static void regen_monsters(void)
                if (m_ptr->hp < m_ptr->maxhp)
                {
                        /* Hack -- Base regeneration */
-                       frac = m_ptr->maxhp / 100;
+                       int frac = m_ptr->maxhp / 100;
 
                        /* Hack -- Minimal regeneration rate */
                        if (!frac) if (one_in_(2)) frac = 1;
@@ -966,8 +963,8 @@ static void regen_monsters(void)
                        if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
 
                        /* Redraw (later) if needed */
-                       if (p_ptr->health_who == i) p_ptr->redraw |= (PR_HEALTH);
-                       if (p_ptr->riding == i) p_ptr->redraw |= (PR_UHEALTH);
+                       if (player_ptr->health_who == i) player_ptr->redraw |= (PR_HEALTH);
+                       if (player_ptr->riding == i) player_ptr->redraw |= (PR_UHEALTH);
                }
        }
 }
@@ -975,10 +972,11 @@ static void regen_monsters(void)
 
 /*!
  * @brief 30ゲームターン毎のボール中モンスターのHP自然回復処理 / Regenerate the captured monsters (once per 30 game turns)
+ * @param creature_ptr プレーヤーへの参照ポインタ
  * @return なし
  * @note Should probably be done during monster turns.
  */
-static void regen_captured_monsters(void)
+static void regenerate_captured_monsters(player_type *creature_ptr)
 {
        int i, frac;
        bool heal = FALSE;
@@ -987,7 +985,7 @@ static void regen_captured_monsters(void)
        for (i = 0; i < INVEN_TOTAL; i++)
        {
                monster_race *r_ptr;
-               object_type *o_ptr = &p_ptr->inventory_list[i];
+               object_type *o_ptr = &creature_ptr->inventory_list[i];
 
                if (!o_ptr->k_idx) continue;
                if (o_ptr->tval != TV_CAPTURE) continue;
@@ -1020,15 +1018,16 @@ static void regen_captured_monsters(void)
        if (heal)
        {
                /* Combine pack */
-               p_ptr->update |= (PU_COMBINE);
-               p_ptr->window |= (PW_INVEN);
-               p_ptr->window |= (PW_EQUIP);
+               creature_ptr->update |= (PU_COMBINE);
+               creature_ptr->window |= (PW_INVEN);
+               creature_ptr->window |= (PW_EQUIP);
                wild_regen = 20;
        }
 }
 
 /*!
  * @brief 寿命つき光源の警告メッセージ処理
+ * @param creature_ptr プレーヤーへの参照ポインタ
  * @param o_ptr 現在光源として使っているオブジェクトの構造体参照ポインタ
  * @return なし
  */
@@ -1064,7 +1063,7 @@ static void notice_lite_change(player_type *creature_ptr, object_type *o_ptr)
        else if (o_ptr->name2 == EGO_LITE_LONG)
        {
                if ((o_ptr->xtra4 < 50) && (!(o_ptr->xtra4 % 5))
-                   && (current_world_ptr->game_turn % (TURNS_PER_TICK*2)))
+                       && (current_world_ptr->game_turn % (TURNS_PER_TICK * 2)))
                {
                        if (disturb_minor) disturb(creature_ptr, FALSE, TRUE);
                        msg_print(_("明かりが微かになってきている。", "Your light is growing faint."));
@@ -1075,7 +1074,7 @@ static void notice_lite_change(player_type *creature_ptr, object_type *o_ptr)
        else if ((o_ptr->xtra4 < 100) && (!(o_ptr->xtra4 % 10)))
        {
                if (disturb_minor) disturb(creature_ptr, FALSE, TRUE);
-                       msg_print(_("明かりが微かになってきている。", "Your light is growing faint."));
+               msg_print(_("明かりが微かになってきている。", "Your light is growing faint."));
        }
 }
 
@@ -1085,7 +1084,7 @@ static void notice_lite_change(player_type *creature_ptr, object_type *o_ptr)
  * @param o_ptr 対象オブジェクトの構造体参照ポインタ
  * @return なし
  */
-static void recharged_notice(object_type *o_ptr)
+static void recharged_notice(player_type *owner_ptr, object_type *o_ptr)
 {
        GAME_TEXT o_name[MAX_NLEN];
 
@@ -1116,7 +1115,7 @@ static void recharged_notice(object_type *o_ptr)
                                msg_format("Your %s is recharged.", o_name);
 #endif
 
-                       disturb(p_ptr, FALSE, FALSE);
+                       disturb(owner_ptr, FALSE, FALSE);
 
                        /* Done. */
                        return;
@@ -1131,7 +1130,7 @@ static void recharged_notice(object_type *o_ptr)
  * @brief プレイヤーの歌に関する継続処理
  * @return なし
  */
-static void check_music(player_type *creature_ptr)
+static void check_music(player_type *caster_ptr)
 {
        const magic_type *s_ptr;
        int spell;
@@ -1139,56 +1138,62 @@ static void check_music(player_type *creature_ptr)
        u32b need_mana_frac;
 
        /* Music singed by player */
-       if (creature_ptr->pclass != CLASS_BARD) return;
-       if (!SINGING_SONG_EFFECT(creature_ptr) && !INTERUPTING_SONG_EFFECT(creature_ptr)) return;
+       if (caster_ptr->pclass != CLASS_BARD) return;
+       if (!SINGING_SONG_EFFECT(caster_ptr) && !INTERUPTING_SONG_EFFECT(caster_ptr)) return;
 
-       if (creature_ptr->anti_magic)
+       if (caster_ptr->anti_magic)
        {
-               stop_singing(creature_ptr);
+               stop_singing(caster_ptr);
                return;
        }
 
-       spell = SINGING_SONG_ID(creature_ptr);
+       spell = SINGING_SONG_ID(caster_ptr);
        s_ptr = &technic_info[REALM_MUSIC - MIN_TECHNIC][spell];
 
-       need_mana = mod_need_mana(s_ptr->smana, spell, REALM_MUSIC);
+       need_mana = mod_need_mana(caster_ptr, s_ptr->smana, spell, REALM_MUSIC);
        need_mana_frac = 0;
 
        /* Divide by 2 */
        s64b_RSHIFT(need_mana, need_mana_frac, 1);
 
-       if (s64b_cmp(creature_ptr->csp, creature_ptr->csp_frac, need_mana, need_mana_frac) < 0)
+       if (s64b_cmp(caster_ptr->csp, caster_ptr->csp_frac, need_mana, need_mana_frac) < 0)
        {
-               stop_singing(creature_ptr);
+               stop_singing(caster_ptr);
                return;
        }
        else
        {
-               s64b_sub(&(creature_ptr->csp), &(creature_ptr->csp_frac), need_mana, need_mana_frac);
+               s64b_sub(&(caster_ptr->csp), &(caster_ptr->csp_frac), need_mana, need_mana_frac);
 
-               creature_ptr->redraw |= PR_MANA;
-               if (INTERUPTING_SONG_EFFECT(creature_ptr))
+               caster_ptr->redraw |= PR_MANA;
+               if (INTERUPTING_SONG_EFFECT(caster_ptr))
                {
-                       SINGING_SONG_EFFECT(creature_ptr) = INTERUPTING_SONG_EFFECT(creature_ptr);
-                       INTERUPTING_SONG_EFFECT(creature_ptr) = MUSIC_NONE;
+                       SINGING_SONG_EFFECT(caster_ptr) = INTERUPTING_SONG_EFFECT(caster_ptr);
+                       INTERUPTING_SONG_EFFECT(caster_ptr) = MUSIC_NONE;
                        msg_print(_("歌を再開した。", "You restart singing."));
-                       creature_ptr->action = ACTION_SING;
-                       creature_ptr->update |= (PU_BONUS | PU_HP | PU_MONSTERS);
-                       creature_ptr->redraw |= (PR_MAP | PR_STATUS | PR_STATE);
-                       creature_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
+                       caster_ptr->action = ACTION_SING;
+                       caster_ptr->update |= (PU_BONUS | PU_HP | PU_MONSTERS);
+                       caster_ptr->redraw |= (PR_MAP | PR_STATUS | PR_STATE);
+                       caster_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
                }
        }
-       if (creature_ptr->spell_exp[spell] < SPELL_EXP_BEGINNER)
-               creature_ptr->spell_exp[spell] += 5;
-       else if(creature_ptr->spell_exp[spell] < SPELL_EXP_SKILLED)
-       { if (one_in_(2) && (p_ptr->current_floor_ptr->dun_level > 4) && ((p_ptr->current_floor_ptr->dun_level + 10) > creature_ptr->lev)) creature_ptr->spell_exp[spell] += 1; }
-       else if(creature_ptr->spell_exp[spell] < SPELL_EXP_EXPERT)
-       { if (one_in_(5) && ((p_ptr->current_floor_ptr->dun_level + 5) > creature_ptr->lev) && ((p_ptr->current_floor_ptr->dun_level + 5) > s_ptr->slevel)) creature_ptr->spell_exp[spell] += 1; }
-       else if(creature_ptr->spell_exp[spell] < SPELL_EXP_MASTER)
-       { if (one_in_(5) && ((p_ptr->current_floor_ptr->dun_level + 5) > creature_ptr->lev) && (p_ptr->current_floor_ptr->dun_level > s_ptr->slevel)) creature_ptr->spell_exp[spell] += 1; }
+       if (caster_ptr->spell_exp[spell] < SPELL_EXP_BEGINNER)
+               caster_ptr->spell_exp[spell] += 5;
+       else if (caster_ptr->spell_exp[spell] < SPELL_EXP_SKILLED)
+       {
+               if (one_in_(2) && (caster_ptr->current_floor_ptr->dun_level > 4) && ((caster_ptr->current_floor_ptr->dun_level + 10) > caster_ptr->lev)) caster_ptr->spell_exp[spell] += 1;
+       }
+       else if (caster_ptr->spell_exp[spell] < SPELL_EXP_EXPERT)
+       {
+               if (one_in_(5) && ((caster_ptr->current_floor_ptr->dun_level + 5) > caster_ptr->lev) && ((caster_ptr->current_floor_ptr->dun_level + 5) > s_ptr->slevel)) caster_ptr->spell_exp[spell] += 1;
+       }
+       else if (caster_ptr->spell_exp[spell] < SPELL_EXP_MASTER)
+       {
+               if (one_in_(5) && ((caster_ptr->current_floor_ptr->dun_level + 5) > caster_ptr->lev) && (caster_ptr->current_floor_ptr->dun_level > s_ptr->slevel)) caster_ptr->spell_exp[spell] += 1;
+       }
 
        /* Do any effects of continual song */
-       exe_spell(creature_ptr, REALM_MUSIC, spell, SPELL_CONT);
+       exe_spell(caster_ptr, REALM_MUSIC, spell, SPELL_CONT);
 }
 
 /*!
@@ -1197,60 +1202,60 @@ static void check_music(player_type *creature_ptr)
  * @return 該当の呪いが一つでもあった場合にランダムに選ばれた装備品のオブジェクト構造体参照ポインタを返す。\n
  * 呪いがない場合NULLを返す。
  */
-static object_type *choose_cursed_obj_name(BIT_FLAGS flag)
+static object_type *choose_cursed_obj_name(player_type *player_ptr, BIT_FLAGS flag)
 {
        int i;
-       int choices[INVEN_TOTAL-INVEN_RARM];
+       int choices[INVEN_TOTAL - INVEN_RARM];
        int number = 0;
 
        /* Paranoia -- Player has no warning-item */
-       if (!(p_ptr->cursed & flag)) return NULL;
+       if (!(player_ptr->cursed & flag)) return NULL;
 
        /* Search Inventry */
        for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
        {
-               object_type *o_ptr = &p_ptr->inventory_list[i];
+               object_type *o_ptr = &player_ptr->inventory_list[i];
 
                if (o_ptr->curse_flags & flag)
                {
                        choices[number] = i;
                        number++;
                }
-               else if ((flag == TRC_ADD_L_CURSE) || 
-                                       (flag == TRC_ADD_H_CURSE) || 
-                                       (flag == TRC_DRAIN_HP) || 
-                                       (flag == TRC_DRAIN_MANA) || 
-                                       (flag == TRC_CALL_ANIMAL) || 
-                                       (flag == TRC_CALL_DEMON) || 
-                                       (flag == TRC_CALL_DRAGON) || 
-                                       (flag == TRC_CALL_UNDEAD) || 
-                                       (flag == TRC_COWARDICE) || 
-                                       (flag == TRC_LOW_MELEE) || 
-                                       (flag == TRC_LOW_AC) || 
-                                       (flag == TRC_LOW_MAGIC) || 
-                                       (flag == TRC_FAST_DIGEST) || 
-                                       (flag == TRC_SLOW_REGEN) )
+               else if ((flag == TRC_ADD_L_CURSE) ||
+                       (flag == TRC_ADD_H_CURSE) ||
+                       (flag == TRC_DRAIN_HP) ||
+                       (flag == TRC_DRAIN_MANA) ||
+                       (flag == TRC_CALL_ANIMAL) ||
+                       (flag == TRC_CALL_DEMON) ||
+                       (flag == TRC_CALL_DRAGON) ||
+                       (flag == TRC_CALL_UNDEAD) ||
+                       (flag == TRC_COWARDICE) ||
+                       (flag == TRC_LOW_MELEE) ||
+                       (flag == TRC_LOW_AC) ||
+                       (flag == TRC_LOW_MAGIC) ||
+                       (flag == TRC_FAST_DIGEST) ||
+                       (flag == TRC_SLOW_REGEN))
                {
                        u32b cf = 0L;
                        BIT_FLAGS flgs[TR_FLAG_SIZE];
                        object_flags(o_ptr, flgs);
                        switch (flag)
                        {
-                         case TRC_ADD_L_CURSE  : cf = TR_ADD_L_CURSE; break;
-                         case TRC_ADD_H_CURSE  : cf = TR_ADD_H_CURSE; break;
-                         case TRC_DRAIN_HP             : cf = TR_DRAIN_HP; break;
-                         case TRC_DRAIN_MANA   : cf = TR_DRAIN_MANA; break;
-                         case TRC_CALL_ANIMAL  : cf = TR_CALL_ANIMAL; break;
-                         case TRC_CALL_DEMON   : cf = TR_CALL_DEMON; break;
-                         case TRC_CALL_DRAGON  : cf = TR_CALL_DRAGON; break;
-                         case TRC_CALL_UNDEAD  : cf = TR_CALL_UNDEAD; break;
-                         case TRC_COWARDICE    : cf = TR_COWARDICE; break;
-                         case TRC_LOW_MELEE    : cf = TR_LOW_MELEE; break;
-                         case TRC_LOW_AC               : cf = TR_LOW_AC; break;
-                         case TRC_LOW_MAGIC    : cf = TR_LOW_MAGIC; break;
-                         case TRC_FAST_DIGEST  : cf = TR_FAST_DIGEST; break;
-                         case TRC_SLOW_REGEN   : cf = TR_SLOW_REGEN; break;
-                         default                               : break;
+                       case TRC_ADD_L_CURSE: cf = TR_ADD_L_CURSE; break;
+                       case TRC_ADD_H_CURSE: cf = TR_ADD_H_CURSE; break;
+                       case TRC_DRAIN_HP: cf = TR_DRAIN_HP; break;
+                       case TRC_DRAIN_MANA: cf = TR_DRAIN_MANA; break;
+                       case TRC_CALL_ANIMAL: cf = TR_CALL_ANIMAL; break;
+                       case TRC_CALL_DEMON: cf = TR_CALL_DEMON; break;
+                       case TRC_CALL_DRAGON: cf = TR_CALL_DRAGON; break;
+                       case TRC_CALL_UNDEAD: cf = TR_CALL_UNDEAD; break;
+                       case TRC_COWARDICE: cf = TR_COWARDICE; break;
+                       case TRC_LOW_MELEE: cf = TR_LOW_MELEE; break;
+                       case TRC_LOW_AC: cf = TR_LOW_AC; break;
+                       case TRC_LOW_MAGIC: cf = TR_LOW_MAGIC; break;
+                       case TRC_FAST_DIGEST: cf = TR_FAST_DIGEST; break;
+                       case TRC_SLOW_REGEN: cf = TR_SLOW_REGEN; break;
+                       default: break;
                        }
                        if (have_flag(flgs, cf))
                        {
@@ -1260,10 +1265,10 @@ static object_type *choose_cursed_obj_name(BIT_FLAGS flag)
                }
        }
 
-       /* Choice one of them */
-       return (&p_ptr->inventory_list[choices[randint0(number)]]);
+       return &player_ptr->inventory_list[choices[randint0(number)]];
 }
 
+
 static void process_world_aux_digestion(player_type *creature_ptr)
 {
        if (!creature_ptr->phase_out)
@@ -1322,7 +1327,7 @@ static void process_world_aux_digestion(player_type *creature_ptr)
                                /* Calculate damage */
                                HIT_POINT dam = (PY_FOOD_STARVE - creature_ptr->food) / 10;
 
-                               if (!IS_INVULN()) take_hit(creature_ptr, DAMAGE_LOSELIFE, dam, _("空腹", "starvation"), -1);
+                               if (!IS_INVULN(creature_ptr)) take_hit(creature_ptr, DAMAGE_LOSELIFE, dam, _("空腹", "starvation"), -1);
                        }
                }
        }
@@ -1346,13 +1351,13 @@ static void process_world_aux_hp_and_sp(player_type *creature_ptr)
        /*** Damage over Time ***/
 
        /* Take damage from poison */
-       if (creature_ptr->poisoned && !IS_INVULN())
+       if (creature_ptr->poisoned && !IS_INVULN(creature_ptr))
        {
                take_hit(creature_ptr, DAMAGE_NOESCAPE, 1, _("毒", "poison"), -1);
        }
 
        /* Take damage from cuts */
-       if (creature_ptr->cut && !IS_INVULN())
+       if (creature_ptr->cut && !IS_INVULN(creature_ptr))
        {
                HIT_POINT dam;
 
@@ -1400,7 +1405,7 @@ static void process_world_aux_hp_and_sp(player_type *creature_ptr)
        /* (Vampires) Take damage from sunlight */
        if (PRACE_IS_(creature_ptr, RACE_VAMPIRE) || (creature_ptr->mimic_form == MIMIC_VAMPIRE))
        {
-               if (!creature_ptr->current_floor_ptr->dun_level && !creature_ptr->resist_lite && !IS_INVULN() && is_daytime())
+               if (!creature_ptr->current_floor_ptr->dun_level && !creature_ptr->resist_lite && !IS_INVULN(creature_ptr) && is_daytime())
                {
                        if ((creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW)
                        {
@@ -1411,11 +1416,11 @@ static void process_world_aux_hp_and_sp(player_type *creature_ptr)
                }
 
                if (creature_ptr->inventory_list[INVEN_LITE].tval && (creature_ptr->inventory_list[INVEN_LITE].name2 != EGO_LITE_DARKNESS) &&
-                   !creature_ptr->resist_lite)
+                       !creature_ptr->resist_lite)
                {
-                       object_type * o_ptr = &creature_ptr->inventory_list[INVEN_LITE];
-                       GAME_TEXT o_name [MAX_NLEN];
-                       char ouch [MAX_NLEN+40];
+                       object_type *o_ptr = &creature_ptr->inventory_list[INVEN_LITE];
+                       GAME_TEXT o_name[MAX_NLEN];
+                       char ouch[MAX_NLEN + 40];
 
                        /* Get an object description */
                        object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
@@ -1427,11 +1432,11 @@ static void process_world_aux_hp_and_sp(player_type *creature_ptr)
                        object_desc(o_name, o_ptr, OD_NAME_ONLY);
                        sprintf(ouch, _("%sを装備したダメージ", "wielding %s"), o_name);
 
-                       if (!IS_INVULN()) take_hit(creature_ptr, DAMAGE_NOESCAPE, 1, ouch, -1);
+                       if (!IS_INVULN(creature_ptr)) take_hit(creature_ptr, DAMAGE_NOESCAPE, 1, ouch, -1);
                }
        }
 
-       if (have_flag(f_ptr->flags, FF_LAVA) && !IS_INVULN() && !creature_ptr->immune_fire)
+       if (have_flag(f_ptr->flags, FF_LAVA) && !IS_INVULN(creature_ptr) && !creature_ptr->immune_fire)
        {
                int damage = 0;
 
@@ -1446,18 +1451,18 @@ static void process_world_aux_hp_and_sp(player_type *creature_ptr)
 
                if (damage)
                {
-                       if(PRACE_IS_(creature_ptr, RACE_ENT)) damage += damage / 3;
-                       if(creature_ptr->resist_fire) damage = damage / 3;
-                       if(IS_OPPOSE_FIRE()) damage = damage / 3;
-                       if(creature_ptr->levitation) damage = damage / 5;
+                       if (PRACE_IS_(creature_ptr, RACE_ENT)) damage += damage / 3;
+                       if (creature_ptr->resist_fire) damage = damage / 3;
+                       if (is_oppose_fire(creature_ptr)) damage = damage / 3;
+                       if (creature_ptr->levitation) damage = damage / 5;
 
                        damage = damage / 100 + (randint0(100) < (damage % 100));
 
                        if (creature_ptr->levitation)
                        {
                                msg_print(_("熱で火傷した!", "The heat burns you!"));
-                               take_hit(creature_ptr, DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"), 
-                                                               f_name + f_info[get_feat_mimic(&creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x])].name), -1);
+                               take_hit(creature_ptr, DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
+                                       f_name + f_info[get_feat_mimic(&creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x])].name), -1);
                        }
                        else
                        {
@@ -1470,7 +1475,7 @@ static void process_world_aux_hp_and_sp(player_type *creature_ptr)
                }
        }
 
-       if (have_flag(f_ptr->flags, FF_COLD_PUDDLE) && !IS_INVULN() && !creature_ptr->immune_cold)
+       if (have_flag(f_ptr->flags, FF_COLD_PUDDLE) && !IS_INVULN(creature_ptr) && !creature_ptr->immune_cold)
        {
                int damage = 0;
 
@@ -1486,7 +1491,7 @@ static void process_world_aux_hp_and_sp(player_type *creature_ptr)
                if (damage)
                {
                        if (creature_ptr->resist_cold) damage = damage / 3;
-                       if (IS_OPPOSE_COLD()) damage = damage / 3;
+                       if (is_oppose_cold(creature_ptr)) damage = damage / 3;
                        if (creature_ptr->levitation) damage = damage / 5;
 
                        damage = damage / 100 + (randint0(100) < (damage % 100));
@@ -1508,7 +1513,7 @@ static void process_world_aux_hp_and_sp(player_type *creature_ptr)
                }
        }
 
-       if (have_flag(f_ptr->flags, FF_ELEC_PUDDLE) && !IS_INVULN() && !creature_ptr->immune_elec)
+       if (have_flag(f_ptr->flags, FF_ELEC_PUDDLE) && !IS_INVULN(creature_ptr) && !creature_ptr->immune_elec)
        {
                int damage = 0;
 
@@ -1524,7 +1529,7 @@ static void process_world_aux_hp_and_sp(player_type *creature_ptr)
                if (damage)
                {
                        if (creature_ptr->resist_elec) damage = damage / 3;
-                       if (IS_OPPOSE_ELEC()) damage = damage / 3;
+                       if (is_oppose_elec(creature_ptr)) damage = damage / 3;
                        if (creature_ptr->levitation) damage = damage / 5;
 
                        damage = damage / 100 + (randint0(100) < (damage % 100));
@@ -1546,7 +1551,7 @@ static void process_world_aux_hp_and_sp(player_type *creature_ptr)
                }
        }
 
-       if (have_flag(f_ptr->flags, FF_ACID_PUDDLE) && !IS_INVULN() && !creature_ptr->immune_acid)
+       if (have_flag(f_ptr->flags, FF_ACID_PUDDLE) && !IS_INVULN(creature_ptr) && !creature_ptr->immune_acid)
        {
                int damage = 0;
 
@@ -1562,7 +1567,7 @@ static void process_world_aux_hp_and_sp(player_type *creature_ptr)
                if (damage)
                {
                        if (creature_ptr->resist_acid) damage = damage / 3;
-                       if (IS_OPPOSE_ACID()) damage = damage / 3;
+                       if (is_oppose_acid(creature_ptr)) damage = damage / 3;
                        if (creature_ptr->levitation) damage = damage / 5;
 
                        damage = damage / 100 + (randint0(100) < (damage % 100));
@@ -1584,7 +1589,7 @@ static void process_world_aux_hp_and_sp(player_type *creature_ptr)
                }
        }
 
-       if (have_flag(f_ptr->flags, FF_POISON_PUDDLE) && !IS_INVULN())
+       if (have_flag(f_ptr->flags, FF_POISON_PUDDLE) && !IS_INVULN(creature_ptr))
        {
                int damage = 0;
 
@@ -1600,7 +1605,7 @@ static void process_world_aux_hp_and_sp(player_type *creature_ptr)
                if (damage)
                {
                        if (creature_ptr->resist_pois) damage = damage / 3;
-                       if (IS_OPPOSE_POIS()) damage = damage / 3;
+                       if (is_oppose_pois(creature_ptr)) damage = damage / 3;
                        if (creature_ptr->levitation) damage = damage / 5;
 
                        damage = damage / 100 + (randint0(100) < (damage % 100));
@@ -1625,7 +1630,7 @@ static void process_world_aux_hp_and_sp(player_type *creature_ptr)
        }
 
        if (have_flag(f_ptr->flags, FF_WATER) && have_flag(f_ptr->flags, FF_DEEP) &&
-           !creature_ptr->levitation && !creature_ptr->can_swim && !creature_ptr->resist_water)
+               !creature_ptr->levitation && !creature_ptr->can_swim && !creature_ptr->resist_water)
        {
                if (creature_ptr->total_weight > weight_limit(creature_ptr))
                {
@@ -1643,7 +1648,7 @@ static void process_world_aux_hp_and_sp(player_type *creature_ptr)
                        damage = r_info[creature_ptr->current_floor_ptr->m_list[creature_ptr->riding].r_idx].level / 2;
                        if (PRACE_IS_(creature_ptr, RACE_ENT)) damage += damage / 3;
                        if (creature_ptr->resist_fire) damage = damage / 3;
-                       if (IS_OPPOSE_FIRE()) damage = damage / 3;
+                       if (is_oppose_fire(creature_ptr)) damage = damage / 3;
                        msg_print(_("熱い!", "It's hot!"));
                        take_hit(creature_ptr, DAMAGE_NOESCAPE, damage, _("炎のオーラ", "Fire aura"), -1);
                }
@@ -1652,7 +1657,7 @@ static void process_world_aux_hp_and_sp(player_type *creature_ptr)
                        damage = r_info[creature_ptr->current_floor_ptr->m_list[creature_ptr->riding].r_idx].level / 2;
                        if (PRACE_IS_(creature_ptr, RACE_ANDROID)) damage += damage / 3;
                        if (creature_ptr->resist_elec) damage = damage / 3;
-                       if (IS_OPPOSE_ELEC()) damage = damage / 3;
+                       if (is_oppose_elec(creature_ptr)) damage = damage / 3;
                        msg_print(_("痛い!", "It hurts!"));
                        take_hit(creature_ptr, DAMAGE_NOESCAPE, damage, _("電気のオーラ", "Elec aura"), -1);
                }
@@ -1660,7 +1665,7 @@ static void process_world_aux_hp_and_sp(player_type *creature_ptr)
                {
                        damage = r_info[creature_ptr->current_floor_ptr->m_list[creature_ptr->riding].r_idx].level / 2;
                        if (creature_ptr->resist_cold) damage = damage / 3;
-                       if (IS_OPPOSE_COLD()) damage = damage / 3;
+                       if (is_oppose_cold(creature_ptr)) damage = damage / 3;
                        msg_print(_("冷たい!", "It's cold!"));
                        take_hit(creature_ptr, DAMAGE_NOESCAPE, damage, _("冷気のオーラ", "Cold aura"), -1);
                }
@@ -1675,7 +1680,7 @@ static void process_world_aux_hp_and_sp(player_type *creature_ptr)
         */
        if (!have_flag(f_ptr->flags, FF_MOVE) && !have_flag(f_ptr->flags, FF_CAN_FLY))
        {
-               if (!IS_INVULN() && !creature_ptr->wraith_form && !creature_ptr->kabenuke && ((creature_ptr->chp > (creature_ptr->lev / 5)) || !creature_ptr->pass_wall))
+               if (!IS_INVULN(creature_ptr) && !creature_ptr->wraith_form && !creature_ptr->kabenuke && ((creature_ptr->chp > (creature_ptr->lev / 5)) || !creature_ptr->pass_wall))
                {
                        concptr dam_desc;
                        cave_no_regen = TRUE;
@@ -1749,8 +1754,8 @@ static void process_world_aux_hp_and_sp(player_type *creature_ptr)
 
        /* No regeneration while special action */
        if ((creature_ptr->action == ACTION_LEARN) ||
-           (creature_ptr->action == ACTION_HAYAGAKE) ||
-           (creature_ptr->special_defense & KATA_KOUKIJIN))
+               (creature_ptr->action == ACTION_HAYAGAKE) ||
+               (creature_ptr->special_defense & KATA_KOUKIJIN))
        {
                upkeep_factor += 100;
        }
@@ -1792,7 +1797,7 @@ static void process_world_aux_hp_and_sp(player_type *creature_ptr)
        /* Regenerate Hit Points if needed */
        if ((creature_ptr->chp < creature_ptr->mhp) && !cave_no_regen)
        {
-               regenhp(regen_amount);
+               regenhp(creature_ptr, regen_amount);
        }
 }
 
@@ -2104,7 +2109,7 @@ static void process_world_aux_timeout(player_type *creature_ptr)
                if (creature_ptr->cut > 1000) adjust = 0;
 
                /* Apply some healing */
-               (void)set_cut(creature_ptr,creature_ptr->cut - adjust);
+               (void)set_cut(creature_ptr, creature_ptr->cut - adjust);
        }
 }
 
@@ -2128,7 +2133,7 @@ static void process_world_aux_light(player_type *creature_ptr)
                        /* Decrease life-span */
                        if (o_ptr->name2 == EGO_LITE_LONG)
                        {
-                               if (current_world_ptr->game_turn % (TURNS_PER_TICK*2)) o_ptr->xtra4--;
+                               if (current_world_ptr->game_turn % (TURNS_PER_TICK * 2)) o_ptr->xtra4--;
                        }
                        else o_ptr->xtra4--;
 
@@ -2206,7 +2211,7 @@ static void process_world_aux_mutation(player_type *creature_ptr)
                                msg_print(NULL);
                                if (one_in_(3)) lose_all_info(creature_ptr);
                                else wiz_dark(creature_ptr);
-                               (void)teleport_player_aux(creature_ptr,100, TELEPORT_NONMAGICAL | TELEPORT_PASSIVE);
+                               (void)teleport_player_aux(creature_ptr, 100, TELEPORT_NONMAGICAL | TELEPORT_PASSIVE);
                                wiz_dark(creature_ptr);
                                msg_print(_("あなたは見知らぬ場所で目が醒めた...頭が痛い。", "You wake up somewhere with a sore head..."));
                                msg_print(_("何も覚えていない。どうやってここに来たかも分からない!", "You can't remember a thing, or how you got here!"));
@@ -2241,16 +2246,16 @@ static void process_world_aux_mutation(player_type *creature_ptr)
        }
 
        if ((creature_ptr->muta2 & MUT2_PROD_MANA) &&
-           !creature_ptr->anti_magic && one_in_(9000))
+               !creature_ptr->anti_magic && one_in_(9000))
        {
                int dire = 0;
                disturb(creature_ptr, FALSE, TRUE);
-               msg_print(_("魔法のエネルギーが突然あなたの中に流れ込んできた!エネルギーを解放しなければならない!", 
-                                               "Magical energy flows through you! You must release it!"));
+               msg_print(_("魔法のエネルギーが突然あなたの中に流れ込んできた!エネルギーを解放しなければならない!",
+                       "Magical energy flows through you! You must release it!"));
 
                flush();
                msg_print(NULL);
-               (void)get_hack_dir(&dire);
+               (void)get_hack_dir(creature_ptr, &dire);
                fire_ball(creature_ptr, GF_MANA, dire, creature_ptr->lev * 2, 3);
        }
 
@@ -2262,7 +2267,7 @@ static void process_world_aux_mutation(player_type *creature_ptr)
                if (pet) mode |= PM_FORCE_PET;
                else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
 
-               if (summon_specific((pet ? -1 : 0), creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, SUMMON_DEMON, mode))
+               if (summon_specific(creature_ptr, (pet ? -1 : 0), creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, SUMMON_DEMON, mode))
                {
                        msg_print(_("あなたはデーモンを引き寄せた!", "You have attracted a demon!"));
                        disturb(creature_ptr, FALSE, TRUE);
@@ -2305,7 +2310,7 @@ static void process_world_aux_mutation(player_type *creature_ptr)
                disturb(creature_ptr, FALSE, TRUE);
                msg_print(_("突然ほとんど孤独になった気がする。", "You suddenly feel almost lonely."));
 
-               banish_monsters(100);
+               banish_monsters(creature_ptr, 100);
                if (!creature_ptr->current_floor_ptr->dun_level && creature_ptr->town_num)
                {
                        int n;
@@ -2314,11 +2319,10 @@ static void process_world_aux_mutation(player_type *creature_ptr)
                        do
                        {
                                n = randint0(MAX_STORES);
-                       }
-                       while ((n == STORE_HOME) || (n == STORE_MUSEUM));
+                       } while ((n == STORE_HOME) || (n == STORE_MUSEUM));
 
                        msg_print(_("店の主人が丘に向かって走っている!", "You see one of the shopkeepers running for the hills!"));
-                       store_shuffle(n);
+                       store_shuffle(creature_ptr, n);
                }
                msg_print(NULL);
        }
@@ -2360,7 +2364,7 @@ static void process_world_aux_mutation(player_type *creature_ptr)
                 * Unlite the area (radius 10) around player and
                 * do 50 points damage to every affected monster
                 */
-               unlite_area(50, 10);
+               unlite_area(creature_ptr, 50, 10);
        }
 
        if ((creature_ptr->muta2 & MUT2_ATT_ANIMAL) && !creature_ptr->anti_magic && one_in_(7000))
@@ -2371,7 +2375,7 @@ static void process_world_aux_mutation(player_type *creature_ptr)
                if (pet) mode |= PM_FORCE_PET;
                else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
 
-               if (summon_specific((pet ? -1 : 0), creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, SUMMON_ANIMAL, mode))
+               if (summon_specific(creature_ptr, (pet ? -1 : 0), creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, SUMMON_ANIMAL, mode))
                {
                        msg_print(_("動物を引き寄せた!", "You have attracted an animal!"));
                        disturb(creature_ptr, FALSE, TRUE);
@@ -2449,7 +2453,7 @@ static void process_world_aux_mutation(player_type *creature_ptr)
                if (pet) mode |= PM_FORCE_PET;
                else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
 
-               if (summon_specific((pet ? -1 : 0), creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, SUMMON_DRAGON, mode))
+               if (summon_specific(creature_ptr, (pet ? -1 : 0), creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, SUMMON_DRAGON, mode))
                {
                        msg_print(_("ドラゴンを引き寄せた!", "You have attracted a dragon!"));
                        disturb(creature_ptr, FALSE, TRUE);
@@ -2480,7 +2484,7 @@ static void process_world_aux_mutation(player_type *creature_ptr)
 
        if ((creature_ptr->muta2 & MUT2_WALK_SHAD) && !creature_ptr->anti_magic && one_in_(12000) && !creature_ptr->current_floor_ptr->inside_arena)
        {
-               alter_reality();
+               reserve_alter_reality(creature_ptr);
        }
 
        if ((creature_ptr->muta2 & MUT2_WARNING) && one_in_(1000))
@@ -2581,7 +2585,7 @@ static void process_world_aux_mutation(player_type *creature_ptr)
                if (slot && !object_is_cursed(o_ptr))
                {
                        msg_print(_("武器を落としてしまった!", "You drop your weapon!"));
-                       inven_drop(slot, 1);
+                       drop_from_inventory(creature_ptr, slot, 1);
                }
        }
 
@@ -2636,8 +2640,8 @@ static void process_world_aux_curse(player_type *creature_ptr)
                        }
                        else
                        {
-                               msg_format(_("%sに{.}(ピリオド)と銘を刻むと発動を抑制できます。", 
-                                                        "You can inscribe {.} on your %s to disable random teleportation. "), o_name);
+                               msg_format(_("%sに{.}(ピリオド)と銘を刻むと発動を抑制できます。",
+                                       "You can inscribe {.} on your %s to disable random teleportation. "), o_name);
                                disturb(creature_ptr, TRUE, TRUE);
                        }
                }
@@ -2653,7 +2657,7 @@ static void process_world_aux_curse(player_type *creature_ptr)
                if ((creature_ptr->cursed & TRC_TY_CURSE) && one_in_(TY_CURSE_CHANCE))
                {
                        int count = 0;
-                       (void)activate_ty_curse(FALSE, &count);
+                       (void)activate_ty_curse(creature_ptr, FALSE, &count);
                }
                /* Handle experience draining */
                if (creature_ptr->prace != RACE_ANDROID && ((creature_ptr->cursed & TRC_DRAIN_EXP) && one_in_(4)))
@@ -2670,7 +2674,7 @@ static void process_world_aux_curse(player_type *creature_ptr)
                        BIT_FLAGS new_curse;
                        object_type *o_ptr;
 
-                       o_ptr = choose_cursed_obj_name(TRC_ADD_L_CURSE);
+                       o_ptr = choose_cursed_obj_name(creature_ptr, TRC_ADD_L_CURSE);
 
                        new_curse = get_curse(0, o_ptr);
                        if (!(o_ptr->curse_flags & new_curse))
@@ -2693,7 +2697,7 @@ static void process_world_aux_curse(player_type *creature_ptr)
                        BIT_FLAGS new_curse;
                        object_type *o_ptr;
 
-                       o_ptr = choose_cursed_obj_name(TRC_ADD_H_CURSE);
+                       o_ptr = choose_cursed_obj_name(creature_ptr, TRC_ADD_H_CURSE);
 
                        new_curse = get_curse(1, o_ptr);
                        if (!(o_ptr->curse_flags & new_curse))
@@ -2712,50 +2716,50 @@ static void process_world_aux_curse(player_type *creature_ptr)
                /* Call animal */
                if ((creature_ptr->cursed & TRC_CALL_ANIMAL) && one_in_(2500))
                {
-                       if (summon_specific(0, creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, SUMMON_ANIMAL, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
+                       if (summon_specific(creature_ptr, 0, creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, SUMMON_ANIMAL, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
                        {
                                GAME_TEXT o_name[MAX_NLEN];
 
-                               object_desc(o_name, choose_cursed_obj_name(TRC_CALL_ANIMAL), (OD_OMIT_PREFIX | OD_NAME_ONLY));
-                               msg_format(_("%sが動物を引き寄せた!", "Your %s have attracted an animal!"), o_name);
+                               object_desc(o_name, choose_cursed_obj_name(creature_ptr, TRC_CALL_ANIMAL), (OD_OMIT_PREFIX | OD_NAME_ONLY));
+                               msg_format(_("%sが動物を引き寄せた!", "Your %s has attracted an animal!"), o_name);
                                disturb(creature_ptr, FALSE, TRUE);
                        }
                }
                /* Call demon */
                if ((creature_ptr->cursed & TRC_CALL_DEMON) && one_in_(1111))
                {
-                       if (summon_specific(0, creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
+                       if (summon_specific(creature_ptr, 0, creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
                        {
                                GAME_TEXT o_name[MAX_NLEN];
 
-                               object_desc(o_name, choose_cursed_obj_name(TRC_CALL_DEMON), (OD_OMIT_PREFIX | OD_NAME_ONLY));
-                               msg_format(_("%sが悪魔を引き寄せた!", "Your %s have attracted a demon!"), o_name);
+                               object_desc(o_name, choose_cursed_obj_name(creature_ptr, TRC_CALL_DEMON), (OD_OMIT_PREFIX | OD_NAME_ONLY));
+                               msg_format(_("%sが悪魔を引き寄せた!", "Your %s has attracted a demon!"), o_name);
                                disturb(creature_ptr, FALSE, TRUE);
                        }
                }
                /* Call dragon */
                if ((creature_ptr->cursed & TRC_CALL_DRAGON) && one_in_(800))
                {
-                       if (summon_specific(0, creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, SUMMON_DRAGON,
-                           (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
+                       if (summon_specific(creature_ptr, 0, creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, SUMMON_DRAGON,
+                               (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
                        {
                                GAME_TEXT o_name[MAX_NLEN];
 
-                               object_desc(o_name, choose_cursed_obj_name(TRC_CALL_DRAGON), (OD_OMIT_PREFIX | OD_NAME_ONLY));
-                               msg_format(_("%sがドラゴンを引き寄せた!", "Your %s have attracted an dragon!"), o_name);
+                               object_desc(o_name, choose_cursed_obj_name(creature_ptr, TRC_CALL_DRAGON), (OD_OMIT_PREFIX | OD_NAME_ONLY));
+                               msg_format(_("%sがドラゴンを引き寄せた!", "Your %s has attracted an dragon!"), o_name);
                                disturb(creature_ptr, FALSE, TRUE);
                        }
                }
                /* Call undead */
                if ((creature_ptr->cursed & TRC_CALL_UNDEAD) && one_in_(1111))
                {
-                       if (summon_specific(0, creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, SUMMON_UNDEAD,
-                           (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
+                       if (summon_specific(creature_ptr, 0, creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, SUMMON_UNDEAD,
+                               (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
                        {
                                GAME_TEXT o_name[MAX_NLEN];
 
-                               object_desc(o_name, choose_cursed_obj_name(TRC_CALL_UNDEAD), (OD_OMIT_PREFIX | OD_NAME_ONLY));
-                               msg_format(_("%sが死霊を引き寄せた!", "Your %s have attracted an undead!"), o_name);
+                               object_desc(o_name, choose_cursed_obj_name(creature_ptr, TRC_CALL_UNDEAD), (OD_OMIT_PREFIX | OD_NAME_ONLY));
+                               msg_format(_("%sが死霊を引き寄せた!", "Your %s has attracted an undead!"), o_name);
                                disturb(creature_ptr, FALSE, TRUE);
                        }
                }
@@ -2781,16 +2785,16 @@ static void process_world_aux_curse(player_type *creature_ptr)
                {
                        GAME_TEXT o_name[MAX_NLEN];
 
-                       object_desc(o_name, choose_cursed_obj_name(TRC_DRAIN_HP), (OD_OMIT_PREFIX | OD_NAME_ONLY));
+                       object_desc(o_name, choose_cursed_obj_name(creature_ptr, TRC_DRAIN_HP), (OD_OMIT_PREFIX | OD_NAME_ONLY));
                        msg_format(_("%sはあなたの体力を吸収した!", "Your %s drains HP from you!"), o_name);
-                       take_hit(creature_ptr, DAMAGE_LOSELIFE, MIN(creature_ptr->lev*2, 100), o_name, -1);
+                       take_hit(creature_ptr, DAMAGE_LOSELIFE, MIN(creature_ptr->lev * 2, 100), o_name, -1);
                }
                /* Handle mana draining */
                if ((creature_ptr->cursed & TRC_DRAIN_MANA) && creature_ptr->csp && one_in_(666))
                {
                        GAME_TEXT o_name[MAX_NLEN];
 
-                       object_desc(o_name, choose_cursed_obj_name(TRC_DRAIN_MANA), (OD_OMIT_PREFIX | OD_NAME_ONLY));
+                       object_desc(o_name, choose_cursed_obj_name(creature_ptr, TRC_DRAIN_MANA), (OD_OMIT_PREFIX | OD_NAME_ONLY));
                        msg_format(_("%sはあなたの魔力を吸収した!", "Your %s drains mana from you!"), o_name);
                        creature_ptr->csp -= MIN(creature_ptr->lev, 50);
                        if (creature_ptr->csp < 0)
@@ -2845,7 +2849,7 @@ static void process_world_aux_recharge(player_type *creature_ptr)
                        /* Notice changes */
                        if (!o_ptr->timeout)
                        {
-                               recharged_notice(o_ptr);
+                               recharged_notice(creature_ptr, o_ptr);
                                changed = TRUE;
                        }
                }
@@ -2885,7 +2889,7 @@ static void process_world_aux_recharge(player_type *creature_ptr)
                        /* Notice changes, provide message if object is inscribed. */
                        if (!(o_ptr->timeout))
                        {
-                               recharged_notice(o_ptr);
+                               recharged_notice(creature_ptr, o_ptr);
                                changed = TRUE;
                        }
 
@@ -2905,9 +2909,9 @@ static void process_world_aux_recharge(player_type *creature_ptr)
        }
 
        /* Process objects on floor */
-       for (i = 1; i < p_ptr->current_floor_ptr->o_max; i++)
+       for (i = 1; i < creature_ptr->current_floor_ptr->o_max; i++)
        {
-               object_type *o_ptr = &p_ptr->current_floor_ptr->o_list[i];
+               object_type *o_ptr = &creature_ptr->current_floor_ptr->o_list[i];
 
                if (!OBJECT_IS_VALID(o_ptr)) continue;
 
@@ -2941,7 +2945,7 @@ static void process_world_aux_movement(player_type *creature_ptr)
                 * he loads the autosaved game.
                 */
                if (autosave_l && (creature_ptr->word_recall == 1) && !creature_ptr->phase_out)
-                       do_cmd_save_game(TRUE);
+                       do_cmd_save_game(creature_ptr, TRUE);
 
                /* Count down towards recall */
                creature_ptr->word_recall--;
@@ -2961,13 +2965,13 @@ static void process_world_aux_movement(player_type *creature_ptr)
 
                                if (creature_ptr->dungeon_idx) creature_ptr->recall_dungeon = creature_ptr->dungeon_idx;
                                if (record_stair)
-                                       exe_write_diary(creature_ptr, NIKKI_RECALL, floor_ptr->dun_level, NULL);
+                                       exe_write_diary(creature_ptr, DIARY_RECALL, floor_ptr->dun_level, NULL);
 
                                floor_ptr->dun_level = 0;
                                creature_ptr->dungeon_idx = 0;
 
-                               leave_quest_check();
-                               leave_tower_check();
+                               leave_quest_check(creature_ptr);
+                               leave_tower_check(creature_ptr);
 
                                creature_ptr->current_floor_ptr->inside_quest = 0;
 
@@ -2980,7 +2984,7 @@ static void process_world_aux_movement(player_type *creature_ptr)
                                creature_ptr->dungeon_idx = creature_ptr->recall_dungeon;
 
                                if (record_stair)
-                                       exe_write_diary(creature_ptr, NIKKI_RECALL, floor_ptr->dun_level, NULL);
+                                       exe_write_diary(creature_ptr, DIARY_RECALL, floor_ptr->dun_level, NULL);
 
                                /* New depth */
                                floor_ptr->dun_level = max_dlv[creature_ptr->dungeon_idx];
@@ -3020,7 +3024,7 @@ static void process_world_aux_movement(player_type *creature_ptr)
                                 * Clear all saved floors
                                 * and create a first saved floor
                                 */
-                               prepare_change_floor_mode(CFM_FIRST_FLOOR);
+                               prepare_change_floor_mode(creature_ptr, CFM_FIRST_FLOOR);
                                creature_ptr->leaving = TRUE;
 
                                if (creature_ptr->dungeon_idx == DUNGEON_ANGBAND)
@@ -3031,10 +3035,10 @@ static void process_world_aux_movement(player_type *creature_ptr)
                                        {
                                                quest_type* const q_ptr = &quest[i];
 
-                                               
+
                                                if ((q_ptr->type == QUEST_TYPE_RANDOM) &&
-                                                   (q_ptr->status == QUEST_STATUS_TAKEN) &&
-                                                   (q_ptr->level < floor_ptr->dun_level))
+                                                       (q_ptr->status == QUEST_STATUS_TAKEN) &&
+                                                       (q_ptr->level < floor_ptr->dun_level))
                                                {
                                                        q_ptr->status = QUEST_STATUS_FAILED;
                                                        q_ptr->complev = (byte)creature_ptr->lev;
@@ -3055,7 +3059,7 @@ static void process_world_aux_movement(player_type *creature_ptr)
        if (creature_ptr->alter_reality)
        {
                if (autosave_l && (creature_ptr->alter_reality == 1) && !creature_ptr->phase_out)
-                       do_cmd_save_game(TRUE);
+                       do_cmd_save_game(creature_ptr, TRUE);
 
                /* Count down towards alter */
                creature_ptr->alter_reality--;
@@ -3069,7 +3073,7 @@ static void process_world_aux_movement(player_type *creature_ptr)
                        disturb(creature_ptr, FALSE, TRUE);
 
                        /* Determine the level */
-                       if (!quest_number(floor_ptr->dun_level) && floor_ptr->dun_level)
+                       if (!quest_number(creature_ptr, floor_ptr->dun_level) && floor_ptr->dun_level)
                        {
                                msg_print(_("世界が変わった!", "The world changes!"));
 
@@ -3077,7 +3081,7 @@ static void process_world_aux_movement(player_type *creature_ptr)
                                 * Clear all saved floors
                                 * and create a first saved floor
                                 */
-                               prepare_change_floor_mode(CFM_FIRST_FLOOR);
+                               prepare_change_floor_mode(creature_ptr, CFM_FIRST_FLOOR);
                                creature_ptr->leaving = TRUE;
                        }
                        else
@@ -3095,44 +3099,45 @@ static void process_world_aux_movement(player_type *creature_ptr)
  * / Handle certain things once every 10 game turns
  * @return なし
  */
-static void process_world(void)
+static void process_world(player_type *player_ptr)
 {
        int day, hour, min;
 
        const s32b A_DAY = TURNS_PER_TICK * TOWN_DAWN;
        s32b prev_turn_in_today = ((current_world_ptr->game_turn - TURNS_PER_TICK) % A_DAY + A_DAY / 4) % A_DAY;
        int prev_min = (1440 * prev_turn_in_today / A_DAY) % 60;
-       
-       extract_day_hour_min(&day, &hour, &min);
+
+       extract_day_hour_min(player_ptr, &day, &hour, &min);
 
        /* Update dungeon feeling, and announce it if changed */
-       update_dungeon_feeling(p_ptr, p_ptr->current_floor_ptr);
+       update_dungeon_feeling(player_ptr);
 
        /* 帰還無しモード時のレベルテレポバグ対策 / Fix for level teleport bugs on ironman_downward.*/
-       if (ironman_downward && (p_ptr->dungeon_idx != DUNGEON_ANGBAND && p_ptr->dungeon_idx != 0))
+       floor_type *floor_ptr = player_ptr->current_floor_ptr;
+       if (ironman_downward && (player_ptr->dungeon_idx != DUNGEON_ANGBAND && player_ptr->dungeon_idx != 0))
        {
-               p_ptr->current_floor_ptr->dun_level = 0;
-               p_ptr->dungeon_idx = 0;
-               prepare_change_floor_mode(CFM_FIRST_FLOOR | CFM_RAND_PLACE);
-               p_ptr->current_floor_ptr->inside_arena = FALSE;
-               p_ptr->wild_mode = FALSE;
-               p_ptr->leaving = TRUE;
+               floor_ptr->dun_level = 0;
+               player_ptr->dungeon_idx = 0;
+               prepare_change_floor_mode(player_ptr, CFM_FIRST_FLOOR | CFM_RAND_PLACE);
+               floor_ptr->inside_arena = FALSE;
+               player_ptr->wild_mode = FALSE;
+               player_ptr->leaving = TRUE;
        }
 
        /*** Check monster arena ***/
-       if (p_ptr->phase_out && !p_ptr->leaving)
+       if (player_ptr->phase_out && !player_ptr->leaving)
        {
                int i2, j2;
                int win_m_idx = 0;
                int number_mon = 0;
 
                /* Count all hostile monsters */
-               for (i2 = 0; i2 < p_ptr->current_floor_ptr->width; ++i2)
-                       for (j2 = 0; j2 < p_ptr->current_floor_ptr->height; j2++)
+               for (i2 = 0; i2 < floor_ptr->width; ++i2)
+                       for (j2 = 0; j2 < floor_ptr->height; j2++)
                        {
-                               grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[j2][i2];
+                               grid_type *g_ptr = &floor_ptr->grid_array[j2][i2];
 
-                               if ((g_ptr->m_idx > 0) && (g_ptr->m_idx != p_ptr->riding))
+                               if ((g_ptr->m_idx > 0) && (g_ptr->m_idx != player_ptr->riding))
                                {
                                        number_mon++;
                                        win_m_idx = g_ptr->m_idx;
@@ -3143,41 +3148,41 @@ static void process_world(void)
                {
                        msg_print(_("相打ちに終わりました。", "They have kill each other at the same time."));
                        msg_print(NULL);
-                       p_ptr->energy_need = 0;
-                       update_gambling_monsters();
+                       player_ptr->energy_need = 0;
+                       update_gambling_monsters(player_ptr);
                }
-               else if ((number_mon-1) == 0)
+               else if ((number_mon - 1) == 0)
                {
                        GAME_TEXT m_name[MAX_NLEN];
                        monster_type *wm_ptr;
 
-                       wm_ptr = &p_ptr->current_floor_ptr->m_list[win_m_idx];
+                       wm_ptr = &floor_ptr->m_list[win_m_idx];
 
                        monster_desc(m_name, wm_ptr, 0);
                        msg_format(_("%sが勝利した!", "%s is winner!"), m_name);
                        msg_print(NULL);
 
-                       if (win_m_idx == (sel_monster+1))
+                       if (win_m_idx == (sel_monster + 1))
                        {
                                msg_print(_("おめでとうございます。", "Congratulations."));
                                msg_format(_("%d$を受け取った。", "You received %d gold."), battle_odds);
-                               p_ptr->au += battle_odds;
+                               player_ptr->au += battle_odds;
                        }
                        else
                        {
                                msg_print(_("残念でした。", "You lost gold."));
                        }
                        msg_print(NULL);
-                       p_ptr->energy_need = 0;
-                       update_gambling_monsters();
+                       player_ptr->energy_need = 0;
+                       update_gambling_monsters(player_ptr);
                }
-               else if (current_world_ptr->game_turn - p_ptr->current_floor_ptr->generated_turn == 150 * TURNS_PER_TICK)
+               else if (current_world_ptr->game_turn - floor_ptr->generated_turn == 150 * TURNS_PER_TICK)
                {
                        msg_print(_("申し分けありませんが、この勝負は引き分けとさせていただきます。", "This battle have ended in a draw."));
-                       p_ptr->au += kakekin;
+                       player_ptr->au += kakekin;
                        msg_print(NULL);
-                       p_ptr->energy_need = 0;
-                       update_gambling_monsters();
+                       player_ptr->energy_need = 0;
+                       update_gambling_monsters(player_ptr);
                }
        }
 
@@ -3185,13 +3190,13 @@ static void process_world(void)
        if (current_world_ptr->game_turn % TURNS_PER_TICK) return;
 
        /*** Attempt timed autosave ***/
-       if (autosave_t && autosave_freq && !p_ptr->phase_out)
+       if (autosave_t && autosave_freq && !player_ptr->phase_out)
        {
                if (!(current_world_ptr->game_turn % ((s32b)autosave_freq * TURNS_PER_TICK)))
-                       do_cmd_save_game(TRUE);
+                       do_cmd_save_game(player_ptr, TRUE);
        }
 
-       if (p_ptr->current_floor_ptr->monster_noise && !ignore_unview)
+       if (floor_ptr->monster_noise && !ignore_unview)
        {
                msg_print(_("何かが聞こえた。", "You hear noise."));
        }
@@ -3199,7 +3204,7 @@ static void process_world(void)
        /*** Handle the wilderness/town (sunshine) ***/
 
        /* While in town/wilderness */
-       if (!p_ptr->current_floor_ptr->dun_level && !p_ptr->current_floor_ptr->inside_quest && !p_ptr->phase_out && !p_ptr->current_floor_ptr->inside_arena)
+       if (!floor_ptr->dun_level && !floor_ptr->inside_quest && !player_ptr->phase_out && !floor_ptr->inside_arena)
        {
                /* Hack -- Daybreak/Nighfall in town */
                if (!(current_world_ptr->game_turn % ((TURNS_PER_TICK * TOWN_DAWN) / 2)))
@@ -3209,14 +3214,14 @@ static void process_world(void)
                        /* Check for dawn */
                        dawn = (!(current_world_ptr->game_turn % (TURNS_PER_TICK * TOWN_DAWN)));
 
-                       if (dawn) day_break(p_ptr->current_floor_ptr);
-                       else night_falls(p_ptr->current_floor_ptr);
+                       if (dawn) day_break(player_ptr);
+                       else night_falls(player_ptr);
 
                }
        }
 
        /* While in the dungeon (vanilla_town or lite_town mode only) */
-       else if ((vanilla_town || (lite_town && !p_ptr->current_floor_ptr->inside_quest && !p_ptr->phase_out && !p_ptr->current_floor_ptr->inside_arena)) && p_ptr->current_floor_ptr->dun_level)
+       else if ((vanilla_town || (lite_town && !floor_ptr->inside_quest && !player_ptr->phase_out && !floor_ptr->inside_arena)) && floor_ptr->dun_level)
        {
                /*** Shuffle the Storekeepers ***/
 
@@ -3233,8 +3238,7 @@ static void process_world(void)
                                do
                                {
                                        n = randint0(MAX_STORES);
-                               }
-                               while ((n == STORE_HOME) || (n == STORE_MUSEUM));
+                               } while ((n == STORE_HOME) || (n == STORE_MUSEUM));
 
                                /* Check every feature */
                                for (i = 1; i < max_f_idx; i++)
@@ -3253,7 +3257,7 @@ static void process_world(void)
                                                if (cheat_xtra) msg_format(_("%sの店主をシャッフルします。", "Shuffle a Shopkeeper of %s."), f_name + f_ptr->name);
 
                                                /* Shuffle it */
-                                               store_shuffle(n);
+                                               store_shuffle(player_ptr, n);
 
                                                break;
                                        }
@@ -3262,40 +3266,38 @@ static void process_world(void)
                }
        }
 
-
        /*** Process the monsters ***/
 
        /* Check for creature generation. */
-       if (one_in_(d_info[p_ptr->dungeon_idx].max_m_alloc_chance) &&
-           !p_ptr->current_floor_ptr->inside_arena && !p_ptr->current_floor_ptr->inside_quest && !p_ptr->phase_out)
+       if (one_in_(d_info[player_ptr->dungeon_idx].max_m_alloc_chance) &&
+               !floor_ptr->inside_arena && !floor_ptr->inside_quest && !player_ptr->phase_out)
        {
                /* Make a new monster */
-               (void)alloc_monster(MAX_SIGHT + 5, 0);
+               (void)alloc_monster(player_ptr, MAX_SIGHT + 5, 0);
        }
 
        /* Hack -- Check for creature regeneration */
-       if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * 10)) && !p_ptr->phase_out) regen_monsters();
-       if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * 3))) regen_captured_monsters();
+       if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * 10)) && !player_ptr->phase_out) regenerate_monsters(player_ptr);
+       if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * 3))) regenerate_captured_monsters(player_ptr);
 
-       if (!p_ptr->leaving)
+       if (!player_ptr->leaving)
        {
                int i;
 
                /* Hack -- Process the counters of monsters if needed */
                for (i = 0; i < MAX_MTIMED; i++)
                {
-                       if (p_ptr->current_floor_ptr->mproc_max[i] > 0) process_monsters_mtimed(i);
+                       if (floor_ptr->mproc_max[i] > 0) process_monsters_mtimed(player_ptr, i);
                }
        }
 
-
        /* Date changes */
        if (!hour && !min)
        {
                if (min != prev_min)
                {
-                       exe_write_diary(p_ptr, NIKKI_HIGAWARI, 0, NULL);
-                       determine_today_mon(FALSE);
+                       exe_write_diary(player_ptr, DIARY_DIALY, 0, NULL);
+                       determine_daily_bounty(player_ptr, FALSE);
                }
        }
 
@@ -3310,7 +3312,7 @@ static void process_world(void)
                /* Every 15 minutes after 11:00 pm */
                if ((hour == 23) && !(min % 15))
                {
-                       disturb(p_ptr, FALSE, TRUE);
+                       disturb(player_ptr, FALSE, TRUE);
 
                        switch (min / 15)
                        {
@@ -3336,46 +3338,47 @@ static void process_world(void)
                if (!hour && !min)
                {
 
-                       disturb(p_ptr, TRUE, TRUE);
+                       disturb(player_ptr, TRUE, TRUE);
                        msg_print(_("遠くで鐘が何回も鳴り、死んだような静けさの中へ消えていった。", "A distant bell tolls many times, fading into an deathly silence."));
 
-                       if (p_ptr->wild_mode)
+                       if (player_ptr->wild_mode)
                        {
                                /* Go into large wilderness view */
-                               p_ptr->oldpy = randint1(MAX_HGT - 2);
-                               p_ptr->oldpx = randint1(MAX_WID - 2);
-                               change_wild_mode(p_ptr, TRUE);
+                               player_ptr->oldpy = randint1(MAX_HGT - 2);
+                               player_ptr->oldpx = randint1(MAX_WID - 2);
+                               change_wild_mode(player_ptr, TRUE);
 
                                /* Give first move to monsters */
-                               take_turn(p_ptr, 100);
+                               take_turn(player_ptr, 100);
 
                        }
 
-                       p_ptr->invoking_midnight_curse = TRUE;
+                       player_ptr->invoking_midnight_curse = TRUE;
                }
        }
 
-       process_world_aux_digestion(p_ptr);
-       process_world_aux_hp_and_sp(p_ptr);
-       process_world_aux_timeout(p_ptr);
-       process_world_aux_light(p_ptr);
-       process_world_aux_mutation(p_ptr);
-       process_world_aux_curse(p_ptr);
-       process_world_aux_recharge(p_ptr);
-       sense_inventory1(p_ptr);
-       sense_inventory2(p_ptr);
-       process_world_aux_movement(p_ptr);
+       process_world_aux_digestion(player_ptr);
+       process_world_aux_hp_and_sp(player_ptr);
+       process_world_aux_timeout(player_ptr);
+       process_world_aux_light(player_ptr);
+       process_world_aux_mutation(player_ptr);
+       process_world_aux_curse(player_ptr);
+       process_world_aux_recharge(player_ptr);
+       sense_inventory1(player_ptr);
+       sense_inventory2(player_ptr);
+       process_world_aux_movement(player_ptr);
 }
 
 /*!
  * @brief ウィザードモードへの導入処理
  * / Verify use of "wizard" mode
+ * @param player_ptr プレーヤーへの参照ポインタ
  * @return 実際にウィザードモードへ移行したらTRUEを返す。
  */
-static bool enter_wizard_mode(void)
+static bool enter_wizard_mode(player_type *player_ptr)
 {
        /* Ask first time */
-       if (!p_ptr->noscore)
+       if (!current_world_ptr->noscore)
        {
                /* Wizard mode is not permitted */
                if (!allow_debug_opts || arg_wizard)
@@ -3392,16 +3395,16 @@ static bool enter_wizard_mode(void)
                /* Verify request */
                if (!get_check(_("本当にウィザードモードに入りたいのですか? ", "Are you sure you want to enter wizard mode? ")))
                {
-                       return (FALSE);
+                       return FALSE;
                }
 
-               exe_write_diary(p_ptr, NIKKI_BUNSHOU, 0, _("ウィザードモードに突入してスコアを残せなくなった。", "give up recording score to enter wizard mode."));
+               exe_write_diary(player_ptr, DIARY_DESCRIPTION, 0, _("ウィザードモードに突入してスコアを残せなくなった。", "give up recording score to enter wizard mode."));
                /* Mark savefile */
-               p_ptr->noscore |= 0x0002;
+               current_world_ptr->noscore |= 0x0002;
        }
 
        /* Success */
-       return (TRUE);
+       return TRUE;
 }
 
 
@@ -3410,12 +3413,13 @@ static bool enter_wizard_mode(void)
 /*!
  * @brief デバッグコマンドへの導入処理
  * / Verify use of "debug" commands
+ * @param player_ptr プレーヤーへの参照ポインタ
  * @return 実際にデバッグコマンドへ移行したらTRUEを返す。
  */
-static bool enter_debug_mode(void)
+static bool enter_debug_mode(player_type *player_ptr)
 {
        /* Ask first time */
-       if (!p_ptr->noscore)
+       if (!current_world_ptr->noscore)
        {
                /* Debug mode is not permitted */
                if (!allow_debug_opts)
@@ -3433,16 +3437,16 @@ static bool enter_debug_mode(void)
                /* Verify request */
                if (!get_check(_("本当にデバッグ・コマンドを使いますか? ", "Are you sure you want to use debug commands? ")))
                {
-                       return (FALSE);
+                       return FALSE;
                }
 
-               exe_write_diary(p_ptr, NIKKI_BUNSHOU, 0, _("デバッグモードに突入してスコアを残せなくなった。", "give up sending score to use debug commands."));
+               exe_write_diary(player_ptr, DIARY_DESCRIPTION, 0, _("デバッグモードに突入してスコアを残せなくなった。", "give up sending score to use debug commands."));
                /* Mark savefile */
-               p_ptr->noscore |= 0x0008;
+               current_world_ptr->noscore |= 0x0008;
        }
 
        /* Success */
-       return (TRUE);
+       return TRUE;
 }
 
 /*
@@ -3463,7 +3467,7 @@ extern void do_cmd_debug(player_type *creature_ptr);
 static bool enter_borg_mode(void)
 {
        /* Ask first time */
-       if (!(p_ptr->noscore & 0x0010))
+       if (!(current_world_ptr->noscore & 0x0010))
        {
                /* Mention effects */
                msg_print(_("ボーグ・コマンドはデバッグと実験のためのコマンドです。 ", "The borg commands are for debugging and experimenting."));
@@ -3474,16 +3478,16 @@ static bool enter_borg_mode(void)
                /* Verify request */
                if (!get_check(_("本当にボーグ・コマンドを使いますか? ", "Are you sure you want to use borg commands? ")))
                {
-                       return (FALSE);
+                       return FALSE;
                }
 
                exe_write_diary(p_ptr, NIKKI_BUNSHOU, 0, _("ボーグ・コマンドを使用してスコアを残せなくなった。", "give up recording score to use borg commands."));
                /* Mark savefile */
-               p_ptr->noscore |= 0x0010;
+               current_world_ptr->noscore |= 0x0010;
        }
 
        /* Success */
-       return (TRUE);
+       return TRUE;
 }
 
 /*
@@ -3514,787 +3518,788 @@ static void process_command(player_type *creature_ptr)
                creature_ptr->reset_concent = TRUE;
 
        /* Parse the command */
+       floor_type *floor_ptr = creature_ptr->current_floor_ptr;
        switch (command_cmd)
        {
                /* Ignore */
-               case ESCAPE:
-               case ' ':
-               {
-                       break;
-               }
+       case ESCAPE:
+       case ' ':
+       {
+               break;
+       }
 
-               /* Ignore return */
-               case '\r':
-               case '\n':
+       /* Ignore return */
+       case '\r':
+       case '\n':
+       {
+               break;
+       }
+
+       /*** Wizard Commands ***/
+       case KTRL('W'):
+       {
+               if (current_world_ptr->wizard)
                {
-                       break;
+                       current_world_ptr->wizard = FALSE;
+                       msg_print(_("ウィザードモード解除。", "Wizard mode off."));
                }
-
-               /*** Wizard Commands ***/
-               case KTRL('W'):
+               else if (enter_wizard_mode(creature_ptr))
                {
-                       if (current_world_ptr->wizard)
-                       {
-                               current_world_ptr->wizard = FALSE;
-                               msg_print(_("ウィザードモード解除。", "Wizard mode off."));
-                       }
-                       else if (enter_wizard_mode())
-                       {
-                               current_world_ptr->wizard = TRUE;
-                               msg_print(_("ウィザードモード突入。", "Wizard mode on."));
-                       }
-                       creature_ptr->update |= (PU_MONSTERS);
-                       creature_ptr->redraw |= (PR_TITLE);
-
-                       break;
+                       current_world_ptr->wizard = TRUE;
+                       msg_print(_("ウィザードモード突入。", "Wizard mode on."));
                }
+               creature_ptr->update |= (PU_MONSTERS);
+               creature_ptr->redraw |= (PR_TITLE);
+
+               break;
+       }
 
 
 #ifdef ALLOW_WIZARD
 
-               /* Special "debug" commands */
-               case KTRL('A'):
+       /* Special "debug" commands */
+       case KTRL('A'):
+       {
+               if (enter_debug_mode(creature_ptr))
                {
-                       if (enter_debug_mode())
-                       {
-                               do_cmd_debug(creature_ptr);
-                       }
-                       break;
+                       do_cmd_debug(creature_ptr);
                }
+               break;
+       }
 
 #endif /* ALLOW_WIZARD */
 
 
 #ifdef ALLOW_BORG
 
-               /* Special "borg" commands */
-               case KTRL('Z'):
+       /* Special "borg" commands */
+       case KTRL('Z'):
+       {
+               if (enter_borg_mode())
                {
-                       if (enter_borg_mode())
-                       {
-                               if (!creature_ptr->wild_mode) do_cmd_borg();
-                       }
-                       break;
+                       if (!creature_ptr->wild_mode) do_cmd_borg();
                }
+               break;
+       }
 
 #endif /* ALLOW_BORG */
 
 
 
-               /*** Inventory Commands ***/
+       /*** Inventory Commands ***/
 
-               /* Wear/wield equipment */
-               case 'w':
-               {
-                       if (!creature_ptr->wild_mode) do_cmd_wield(creature_ptr);
-                       break;
-               }
+       /* Wear/wield equipment */
+       case 'w':
+       {
+               if (!creature_ptr->wild_mode) do_cmd_wield(creature_ptr);
+               break;
+       }
 
-               /* Take off equipment */
-               case 't':
-               {
-                       if (!creature_ptr->wild_mode) do_cmd_takeoff(creature_ptr);
-                       break;
-               }
+       /* Take off equipment */
+       case 't':
+       {
+               if (!creature_ptr->wild_mode) do_cmd_takeoff(creature_ptr);
+               break;
+       }
 
-               /* Drop an item */
-               case 'd':
-               {
-                       if (!creature_ptr->wild_mode) do_cmd_drop(creature_ptr);
-                       break;
-               }
+       /* Drop an item */
+       case 'd':
+       {
+               if (!creature_ptr->wild_mode) do_cmd_drop(creature_ptr);
+               break;
+       }
 
-               /* Destroy an item */
-               case 'k':
-               {
-                       do_cmd_destroy(creature_ptr);
-                       break;
-               }
+       /* Destroy an item */
+       case 'k':
+       {
+               do_cmd_destroy(creature_ptr);
+               break;
+       }
 
-               /* Equipment list */
-               case 'e':
-               {
-                       do_cmd_equip(creature_ptr);
-                       break;
-               }
+       /* Equipment list */
+       case 'e':
+       {
+               do_cmd_equip(creature_ptr);
+               break;
+       }
 
-               /* Inventory list */
-               case 'i':
-               {
-                       do_cmd_inven(creature_ptr);
-                       break;
-               }
+       /* Inventory list */
+       case 'i':
+       {
+               do_cmd_inven(creature_ptr);
+               break;
+       }
 
 
-               /*** Various commands ***/
+       /*** Various commands ***/
 
-               /* Identify an object */
-               case 'I':
-               {
-                       do_cmd_observe(creature_ptr);
-                       break;
-               }
+       /* Identify an object */
+       case 'I':
+       {
+               do_cmd_observe(creature_ptr);
+               break;
+       }
 
-               case KTRL('I'):
-               {
-                       toggle_inven_equip(creature_ptr);
-                       break;
-               }
+       case KTRL('I'):
+       {
+               toggle_inventory_equipment(creature_ptr);
+               break;
+       }
 
 
-               /*** Standard "Movement" Commands ***/
+       /*** Standard "Movement" Commands ***/
 
-               /* Alter a grid */
-               case '+':
-               {
-                       if (!creature_ptr->wild_mode) do_cmd_alter(creature_ptr);
-                       break;
-               }
+       /* Alter a grid */
+       case '+':
+       {
+               if (!creature_ptr->wild_mode) do_cmd_alter(creature_ptr);
+               break;
+       }
 
-               /* Dig a tunnel */
-               case 'T':
-               {
-                       if (!creature_ptr->wild_mode) do_cmd_tunnel(creature_ptr);
-                       break;
-               }
+       /* Dig a tunnel */
+       case 'T':
+       {
+               if (!creature_ptr->wild_mode) do_cmd_tunnel(creature_ptr);
+               break;
+       }
 
-               /* Move (usually pick up things) */
-               case ';':
-               {
-                       do_cmd_walk(creature_ptr, FALSE);
-                       break;
-               }
+       /* Move (usually pick up things) */
+       case ';':
+       {
+               do_cmd_walk(creature_ptr, FALSE);
+               break;
+       }
 
-               /* Move (usually do not pick up) */
-               case '-':
-               {
-                       do_cmd_walk(creature_ptr, TRUE);
-                       break;
-               }
+       /* Move (usually do not pick up) */
+       case '-':
+       {
+               do_cmd_walk(creature_ptr, TRUE);
+               break;
+       }
 
 
-               /*** Running, Resting, Searching, Staying */
+       /*** Running, Resting, Searching, Staying */
 
-               /* Begin Running -- Arg is Max Distance */
-               case '.':
-               {
-                       if (!creature_ptr->wild_mode) do_cmd_run(creature_ptr);
-                       break;
-               }
+       /* Begin Running -- Arg is Max Distance */
+       case '.':
+       {
+               if (!creature_ptr->wild_mode) do_cmd_run(creature_ptr);
+               break;
+       }
 
-               /* Stay still (usually pick things up) */
-               case ',':
-               {
-                       do_cmd_stay(creature_ptr, always_pickup);
-                       break;
-               }
+       /* Stay still (usually pick things up) */
+       case ',':
+       {
+               do_cmd_stay(creature_ptr, always_pickup);
+               break;
+       }
 
-               /* Stay still (usually do not pick up) */
-               case 'g':
-               {
-                       do_cmd_stay(creature_ptr, !always_pickup);
-                       break;
-               }
+       /* Stay still (usually do not pick up) */
+       case 'g':
+       {
+               do_cmd_stay(creature_ptr, !always_pickup);
+               break;
+       }
 
-               /* Rest -- Arg is time */
-               case 'R':
-               {
-                       do_cmd_rest(creature_ptr);
-                       break;
-               }
+       /* Rest -- Arg is time */
+       case 'R':
+       {
+               do_cmd_rest(creature_ptr);
+               break;
+       }
 
-               /* Search for traps/doors */
-               case 's':
-               {
-                       do_cmd_search(creature_ptr);
-                       break;
-               }
+       /* Search for traps/doors */
+       case 's':
+       {
+               do_cmd_search(creature_ptr);
+               break;
+       }
 
-               case 'S':
-               {
-                       if (creature_ptr->action == ACTION_SEARCH) set_action(creature_ptr, ACTION_NONE);
-                       else set_action(creature_ptr, ACTION_SEARCH);
-                       break;
-               }
+       case 'S':
+       {
+               if (creature_ptr->action == ACTION_SEARCH) set_action(creature_ptr, ACTION_NONE);
+               else set_action(creature_ptr, ACTION_SEARCH);
+               break;
+       }
 
 
-               /*** Stairs and Doors and Chests and Traps ***/
+       /*** Stairs and Doors and Chests and Traps ***/
 
-               /* Enter store */
-               case SPECIAL_KEY_STORE:
-               {
-                       do_cmd_store();
-                       break;
-               }
+       /* Enter store */
+       case SPECIAL_KEY_STORE:
+       {
+               do_cmd_store(creature_ptr);
+               break;
+       }
 
-               /* Enter building -KMW- */
-               case SPECIAL_KEY_BUILDING:
-               {
-                       do_cmd_bldg();
-                       break;
-               }
+       /* Enter building -KMW- */
+       case SPECIAL_KEY_BUILDING:
+       {
+               do_cmd_bldg(creature_ptr);
+               break;
+       }
 
-               /* Enter quest level -KMW- */
-               case SPECIAL_KEY_QUEST:
-               {
-                       do_cmd_quest();
-                       break;
-               }
+       /* Enter quest level -KMW- */
+       case SPECIAL_KEY_QUEST:
+       {
+               do_cmd_quest(creature_ptr);
+               break;
+       }
 
-               /* Go up staircase */
-               case '<':
+       /* Go up staircase */
+       case '<':
+       {
+               if (!creature_ptr->wild_mode && !floor_ptr->dun_level && !floor_ptr->inside_arena && !floor_ptr->inside_quest)
                {
-                       if (!creature_ptr->wild_mode && !p_ptr->current_floor_ptr->dun_level && !creature_ptr->current_floor_ptr->inside_arena && !creature_ptr->current_floor_ptr->inside_quest)
-                       {
-                               if (vanilla_town) break;
-
-                               if (creature_ptr->ambush_flag)
-                               {
-                                       msg_print(_("襲撃から逃げるにはマップの端まで移動しなければならない。", "To flee the ambush you have to reach the edge of the map."));
-                                       break;
-                               }
+                       if (vanilla_town) break;
 
-                               if (creature_ptr->food < PY_FOOD_WEAK)
-                               {
-                                       msg_print(_("その前に食事をとらないと。", "You must eat something here."));
-                                       break;
-                               }
+                       if (creature_ptr->ambush_flag)
+                       {
+                               msg_print(_("襲撃から逃げるにはマップの端まで移動しなければならない。", "To flee the ambush you have to reach the edge of the map."));
+                               break;
+                       }
 
-                               change_wild_mode(creature_ptr, FALSE);
+                       if (creature_ptr->food < PY_FOOD_WEAK)
+                       {
+                               msg_print(_("その前に食事をとらないと。", "You must eat something here."));
+                               break;
                        }
-                       else
-                               do_cmd_go_up(creature_ptr);
-                       break;
-               }
 
-               /* Go down staircase */
-               case '>':
-               {
-                       if (creature_ptr->wild_mode)
-                               change_wild_mode(creature_ptr, FALSE);
-                       else
-                               do_cmd_go_down(creature_ptr);
-                       break;
+                       change_wild_mode(creature_ptr, FALSE);
                }
+               else
+                       do_cmd_go_up(creature_ptr);
+               break;
+       }
 
-               /* Open a door or chest */
-               case 'o':
-               {
-                       do_cmd_open(creature_ptr);
-                       break;
-               }
+       /* Go down staircase */
+       case '>':
+       {
+               if (creature_ptr->wild_mode)
+                       change_wild_mode(creature_ptr, FALSE);
+               else
+                       do_cmd_go_down(creature_ptr);
+               break;
+       }
 
-               /* Close a door */
-               case 'c':
-               {
-                       do_cmd_close(creature_ptr);
-                       break;
-               }
+       /* Open a door or chest */
+       case 'o':
+       {
+               do_cmd_open(creature_ptr);
+               break;
+       }
 
-               /* Jam a door with spikes */
-               case 'j':
-               {
-                       do_cmd_spike(creature_ptr);
-                       break;
-               }
+       /* Close a door */
+       case 'c':
+       {
+               do_cmd_close(creature_ptr);
+               break;
+       }
 
-               /* Bash a door */
-               case 'B':
-               {
-                       do_cmd_bash(creature_ptr);
-                       break;
-               }
+       /* Jam a door with spikes */
+       case 'j':
+       {
+               do_cmd_spike(creature_ptr);
+               break;
+       }
 
-               /* Disarm a trap or chest */
-               case 'D':
-               {
-                       do_cmd_disarm(creature_ptr);
-                       break;
-               }
+       /* Bash a door */
+       case 'B':
+       {
+               do_cmd_bash(creature_ptr);
+               break;
+       }
 
+       /* Disarm a trap or chest */
+       case 'D':
+       {
+               do_cmd_disarm(creature_ptr);
+               break;
+       }
 
-               /*** Magic and Prayers ***/
 
-               /* Gain new spells/prayers */
-               case 'G':
-               {
-                       if ((creature_ptr->pclass == CLASS_SORCERER) || (creature_ptr->pclass == CLASS_RED_MAGE))
-                               msg_print(_("呪文を学習する必要はない!", "You don't have to learn spells!"));
-                       else if (creature_ptr->pclass == CLASS_SAMURAI)
-                               do_cmd_gain_hissatsu(creature_ptr);
-                       else if (creature_ptr->pclass == CLASS_MAGIC_EATER)
-                               import_magic_device(creature_ptr);
-                       else
-                               do_cmd_study(creature_ptr);
-                       break;
-               }
+       /*** Magic and Prayers ***/
 
-               /* Browse a book */
-               case 'b':
-               {
-                       if ( (creature_ptr->pclass == CLASS_MINDCRAFTER) ||
-                            (creature_ptr->pclass == CLASS_BERSERKER) ||
-                            (creature_ptr->pclass == CLASS_NINJA) ||
-                            (creature_ptr->pclass == CLASS_MIRROR_MASTER) 
-                            ) do_cmd_mind_browse();
-                       else if (creature_ptr->pclass == CLASS_SMITH)
-                               do_cmd_kaji(creature_ptr, TRUE);
-                       else if (creature_ptr->pclass == CLASS_MAGIC_EATER)
-                               do_cmd_magic_eater(creature_ptr, TRUE, FALSE);
-                       else if (creature_ptr->pclass == CLASS_SNIPER)
-                               do_cmd_snipe_browse(creature_ptr);
-                       else do_cmd_browse(creature_ptr);
-                       break;
-               }
+       /* Gain new spells/prayers */
+       case 'G':
+       {
+               if ((creature_ptr->pclass == CLASS_SORCERER) || (creature_ptr->pclass == CLASS_RED_MAGE))
+                       msg_print(_("呪文を学習する必要はない!", "You don't have to learn spells!"));
+               else if (creature_ptr->pclass == CLASS_SAMURAI)
+                       do_cmd_gain_hissatsu(creature_ptr);
+               else if (creature_ptr->pclass == CLASS_MAGIC_EATER)
+                       import_magic_device(creature_ptr);
+               else
+                       do_cmd_study(creature_ptr);
+               break;
+       }
+
+       /* Browse a book */
+       case 'b':
+       {
+               if ((creature_ptr->pclass == CLASS_MINDCRAFTER) ||
+                       (creature_ptr->pclass == CLASS_BERSERKER) ||
+                       (creature_ptr->pclass == CLASS_NINJA) ||
+                       (creature_ptr->pclass == CLASS_MIRROR_MASTER)
+                       ) do_cmd_mind_browse(creature_ptr);
+               else if (creature_ptr->pclass == CLASS_SMITH)
+                       do_cmd_kaji(creature_ptr, TRUE);
+               else if (creature_ptr->pclass == CLASS_MAGIC_EATER)
+                       do_cmd_magic_eater(creature_ptr, TRUE, FALSE);
+               else if (creature_ptr->pclass == CLASS_SNIPER)
+                       do_cmd_snipe_browse(creature_ptr);
+               else do_cmd_browse(creature_ptr);
+               break;
+       }
 
-               /* Cast a spell */
-               case 'm':
+       /* Cast a spell */
+       case 'm':
+       {
+               /* -KMW- */
+               if (!creature_ptr->wild_mode)
                {
-                       /* -KMW- */
-                       if (!creature_ptr->wild_mode)
+                       if ((creature_ptr->pclass == CLASS_WARRIOR) || (creature_ptr->pclass == CLASS_ARCHER) || (creature_ptr->pclass == CLASS_CAVALRY))
                        {
-                               if ((creature_ptr->pclass == CLASS_WARRIOR) || (creature_ptr->pclass == CLASS_ARCHER) || (creature_ptr->pclass == CLASS_CAVALRY))
-                               {
-                                       msg_print(_("呪文を唱えられない!", "You cannot cast spells!"));
-                               }
-                               else if (p_ptr->current_floor_ptr->dun_level && (d_info[creature_ptr->dungeon_idx].flags1 & DF1_NO_MAGIC) && (creature_ptr->pclass != CLASS_BERSERKER) && (creature_ptr->pclass != CLASS_SMITH))
-                               {
-                                       msg_print(_("ダンジョンが魔法を吸収した!", "The dungeon absorbs all attempted magic!"));
-                                       msg_print(NULL);
-                               }
-                               else if (creature_ptr->anti_magic && (creature_ptr->pclass != CLASS_BERSERKER) && (creature_ptr->pclass != CLASS_SMITH))
-                               {
-                                       concptr which_power = _("魔法", "magic");
-                                       if (creature_ptr->pclass == CLASS_MINDCRAFTER)
-                                               which_power = _("超能力", "psionic powers");
-                                       else if (creature_ptr->pclass == CLASS_IMITATOR)
-                                               which_power = _("ものまね", "imitation");
-                                       else if (creature_ptr->pclass == CLASS_SAMURAI)
-                                               which_power = _("必殺剣", "hissatsu");
-                                       else if (creature_ptr->pclass == CLASS_MIRROR_MASTER)
-                                               which_power = _("鏡魔法", "mirror magic");
-                                       else if (creature_ptr->pclass == CLASS_NINJA)
-                                               which_power = _("忍術", "ninjutsu");
-                                       else if (mp_ptr->spell_book == TV_LIFE_BOOK)
-                                               which_power = _("祈り", "prayer");
-
-                                       msg_format(_("反魔法バリアが%sを邪魔した!", "An anti-magic shell disrupts your %s!"), which_power);
-                                       free_turn(creature_ptr);
-                               }
-                               else if (creature_ptr->shero && (creature_ptr->pclass != CLASS_BERSERKER))
-                               {
-                                       msg_format(_("狂戦士化していて頭が回らない!", "You cannot think directly!"));
-                                       free_turn(creature_ptr);
-                               }
+                               msg_print(_("呪文を唱えられない!", "You cannot cast spells!"));
+                       }
+                       else if (floor_ptr->dun_level && (d_info[creature_ptr->dungeon_idx].flags1 & DF1_NO_MAGIC) && (creature_ptr->pclass != CLASS_BERSERKER) && (creature_ptr->pclass != CLASS_SMITH))
+                       {
+                               msg_print(_("ダンジョンが魔法を吸収した!", "The dungeon absorbs all attempted magic!"));
+                               msg_print(NULL);
+                       }
+                       else if (creature_ptr->anti_magic && (creature_ptr->pclass != CLASS_BERSERKER) && (creature_ptr->pclass != CLASS_SMITH))
+                       {
+                               concptr which_power = _("魔法", "magic");
+                               if (creature_ptr->pclass == CLASS_MINDCRAFTER)
+                                       which_power = _("超能力", "psionic powers");
+                               else if (creature_ptr->pclass == CLASS_IMITATOR)
+                                       which_power = _("ものまね", "imitation");
+                               else if (creature_ptr->pclass == CLASS_SAMURAI)
+                                       which_power = _("必殺剣", "hissatsu");
+                               else if (creature_ptr->pclass == CLASS_MIRROR_MASTER)
+                                       which_power = _("鏡魔法", "mirror magic");
+                               else if (creature_ptr->pclass == CLASS_NINJA)
+                                       which_power = _("忍術", "ninjutsu");
+                               else if (mp_ptr->spell_book == TV_LIFE_BOOK)
+                                       which_power = _("祈り", "prayer");
+
+                               msg_format(_("反魔法バリアが%sを邪魔した!", "An anti-magic shell disrupts your %s!"), which_power);
+                               free_turn(creature_ptr);
+                       }
+                       else if (creature_ptr->shero && (creature_ptr->pclass != CLASS_BERSERKER))
+                       {
+                               msg_format(_("狂戦士化していて頭が回らない!", "You cannot think directly!"));
+                               free_turn(creature_ptr);
+                       }
+                       else
+                       {
+                               if ((creature_ptr->pclass == CLASS_MINDCRAFTER) ||
+                                       (creature_ptr->pclass == CLASS_BERSERKER) ||
+                                       (creature_ptr->pclass == CLASS_NINJA) ||
+                                       (creature_ptr->pclass == CLASS_MIRROR_MASTER)
+                                       )
+                                       do_cmd_mind(creature_ptr);
+                               else if (creature_ptr->pclass == CLASS_IMITATOR)
+                                       do_cmd_mane(creature_ptr, FALSE);
+                               else if (creature_ptr->pclass == CLASS_MAGIC_EATER)
+                                       do_cmd_magic_eater(creature_ptr, FALSE, FALSE);
+                               else if (creature_ptr->pclass == CLASS_SAMURAI)
+                                       do_cmd_hissatsu(creature_ptr);
+                               else if (creature_ptr->pclass == CLASS_BLUE_MAGE)
+                                       do_cmd_cast_learned(creature_ptr);
+                               else if (creature_ptr->pclass == CLASS_SMITH)
+                                       do_cmd_kaji(creature_ptr, FALSE);
+                               else if (creature_ptr->pclass == CLASS_SNIPER)
+                                       do_cmd_snipe(creature_ptr);
                                else
-                               {
-                                       if ((creature_ptr->pclass == CLASS_MINDCRAFTER) ||
-                                           (creature_ptr->pclass == CLASS_BERSERKER) ||
-                                           (creature_ptr->pclass == CLASS_NINJA) ||
-                                           (creature_ptr->pclass == CLASS_MIRROR_MASTER)
-                                           )
-                                               do_cmd_mind();
-                                       else if (creature_ptr->pclass == CLASS_IMITATOR)
-                                               do_cmd_mane(creature_ptr, FALSE);
-                                       else if (creature_ptr->pclass == CLASS_MAGIC_EATER)
-                                               do_cmd_magic_eater(creature_ptr, FALSE, FALSE);
-                                       else if (creature_ptr->pclass == CLASS_SAMURAI)
-                                               do_cmd_hissatsu(creature_ptr);
-                                       else if (creature_ptr->pclass == CLASS_BLUE_MAGE)
-                                               do_cmd_cast_learned();
-                                       else if (creature_ptr->pclass == CLASS_SMITH)
-                                               do_cmd_kaji(creature_ptr, FALSE);
-                                       else if (creature_ptr->pclass == CLASS_SNIPER)
-                                               do_cmd_snipe(creature_ptr);
-                                       else
-                                               do_cmd_cast(creature_ptr);
-                               }
+                                       do_cmd_cast(creature_ptr);
                        }
-                       break;
                }
+               break;
+       }
 
-               /* Issue a pet command */
-               case 'p':
-               {
-                       do_cmd_pet(creature_ptr);
-                       break;
-               }
+       /* Issue a pet command */
+       case 'p':
+       {
+               do_cmd_pet(creature_ptr);
+               break;
+       }
 
-               /*** Use various objects ***/
+       /*** Use various objects ***/
 
-               /* Inscribe an object */
-               case '{':
-               {
-                       do_cmd_inscribe(creature_ptr);
-                       break;
-               }
+       /* Inscribe an object */
+       case '{':
+       {
+               do_cmd_inscribe(creature_ptr);
+               break;
+       }
 
-               /* Uninscribe an object */
-               case '}':
-               {
-                       do_cmd_uninscribe(creature_ptr);
-                       break;
-               }
+       /* Uninscribe an object */
+       case '}':
+       {
+               do_cmd_uninscribe(creature_ptr);
+               break;
+       }
 
-               /* Activate an artifact */
-               case 'A':
-               {
-                       do_cmd_activate(creature_ptr);
-                       break;
-               }
+       /* Activate an artifact */
+       case 'A':
+       {
+               do_cmd_activate(creature_ptr);
+               break;
+       }
 
-               /* Eat some food */
-               case 'E':
-               {
-                       do_cmd_eat_food(creature_ptr);
-                       break;
-               }
+       /* Eat some food */
+       case 'E':
+       {
+               do_cmd_eat_food(creature_ptr);
+               break;
+       }
 
-               /* Fuel your lantern/torch */
-               case 'F':
-               {
-                       do_cmd_refill(creature_ptr);
-                       break;
-               }
+       /* Fuel your lantern/torch */
+       case 'F':
+       {
+               do_cmd_refill(creature_ptr);
+               break;
+       }
 
-               /* Fire an item */
-               case 'f':
-               {
-                       do_cmd_fire(creature_ptr, SP_NONE);
-                       break;
-               }
+       /* Fire an item */
+       case 'f':
+       {
+               do_cmd_fire(creature_ptr, SP_NONE);
+               break;
+       }
 
-               /* Throw an item */
-               case 'v':
-               {
-                       do_cmd_throw(creature_ptr, 1, FALSE, -1);
-                       break;
-               }
+       /* Throw an item */
+       case 'v':
+       {
+               do_cmd_throw(creature_ptr, 1, FALSE, -1);
+               break;
+       }
 
-               /* Aim a wand */
-               case 'a':
-               {
-                       do_cmd_aim_wand(creature_ptr);
-                       break;
-               }
+       /* Aim a wand */
+       case 'a':
+       {
+               do_cmd_aim_wand(creature_ptr);
+               break;
+       }
 
-               /* Zap a rod */
-               case 'z':
+       /* Zap a rod */
+       case 'z':
+       {
+               if (use_command && rogue_like_commands)
                {
-                       if (use_command && rogue_like_commands)
-                       {
-                               do_cmd_use(creature_ptr);
-                       }
-                       else
-                       {
-                               do_cmd_zap_rod(creature_ptr);
-                       }
-                       break;
+                       do_cmd_use(creature_ptr);
                }
-
-               /* Quaff a potion */
-               case 'q':
+               else
                {
-                       do_cmd_quaff_potion(creature_ptr);
-                       break;
+                       do_cmd_zap_rod(creature_ptr);
                }
+               break;
+       }
 
-               /* Read a scroll */
-               case 'r':
-               {
-                       do_cmd_read_scroll(creature_ptr);
-                       break;
-               }
+       /* Quaff a potion */
+       case 'q':
+       {
+               do_cmd_quaff_potion(creature_ptr);
+               break;
+       }
 
-               /* Use a staff */
-               case 'u':
-               {
-                       if (use_command && !rogue_like_commands)
-                               do_cmd_use(creature_ptr);
-                       else
-                               do_cmd_use_staff(creature_ptr);
-                       break;
-               }
+       /* Read a scroll */
+       case 'r':
+       {
+               do_cmd_read_scroll(creature_ptr);
+               break;
+       }
 
-               /* Use racial power */
-               case 'U':
-               {
-                       do_cmd_racial_power(creature_ptr);
-                       break;
-               }
+       /* Use a staff */
+       case 'u':
+       {
+               if (use_command && !rogue_like_commands)
+                       do_cmd_use(creature_ptr);
+               else
+                       do_cmd_use_staff(creature_ptr);
+               break;
+       }
 
+       /* Use racial power */
+       case 'U':
+       {
+               do_cmd_racial_power(creature_ptr);
+               break;
+       }
 
-               /*** Looking at Things (nearby or on map) ***/
 
-               /* Full dungeon map */
-               case 'M':
-               {
-                       do_cmd_view_map();
-                       break;
-               }
+       /*** Looking at Things (nearby or on map) ***/
 
-               /* Locate player on map */
-               case 'L':
-               {
-                       do_cmd_locate(creature_ptr);
-                       break;
-               }
+       /* Full dungeon map */
+       case 'M':
+       {
+               do_cmd_view_map(creature_ptr);
+               break;
+       }
 
-               /* Look around */
-               case 'l':
-               {
-                       do_cmd_look();
-                       break;
-               }
+       /* Locate player on map */
+       case 'L':
+       {
+               do_cmd_locate(creature_ptr);
+               break;
+       }
 
-               /* Target monster or location */
-               case '*':
-               {
-                       do_cmd_target();
-                       break;
-               }
+       /* Look around */
+       case 'l':
+       {
+               do_cmd_look(creature_ptr);
+               break;
+       }
 
+       /* Target monster or location */
+       case '*':
+       {
+               do_cmd_target(creature_ptr);
+               break;
+       }
 
 
-               /*** Help and Such ***/
 
-               /* Help */
-               case '?':
-               {
-                       do_cmd_help();
-                       break;
-               }
+       /*** Help and Such ***/
 
-               /* Identify symbol */
-               case '/':
-               {
-                       do_cmd_query_symbol();
-                       break;
-               }
+       /* Help */
+       case '?':
+       {
+               do_cmd_help(creature_ptr);
+               break;
+       }
 
-               /* Character description */
-               case 'C':
-               {
-                       do_cmd_player_status(creature_ptr);
-                       break;
-               }
+       /* Identify symbol */
+       case '/':
+       {
+               do_cmd_query_symbol(creature_ptr);
+               break;
+       }
 
+       /* Character description */
+       case 'C':
+       {
+               do_cmd_player_status(creature_ptr);
+               break;
+       }
 
-               /*** System Commands ***/
 
-               /* Hack -- User interface */
-               case '!':
-               {
-                       (void)Term_user(0);
-                       break;
-               }
+       /*** System Commands ***/
 
-               /* Single line from a pref file */
-               case '"':
-               {
-                       do_cmd_pref();
-                       break;
-               }
+       /* Hack -- User interface */
+       case '!':
+       {
+               (void)Term_user(0);
+               break;
+       }
 
-               case '$':
-               {
-                       do_cmd_reload_autopick();
-                       break;
-               }
+       /* Single line from a pref file */
+       case '"':
+       {
+               do_cmd_pref(creature_ptr);
+               break;
+       }
 
-               case '_':
-               {
-                       do_cmd_edit_autopick();
-                       break;
-               }
+       case '$':
+       {
+               do_cmd_reload_autopick(creature_ptr);
+               break;
+       }
 
-               /* Interact with macros */
-               case '@':
-               {
-                       do_cmd_macros(creature_ptr);
-                       break;
-               }
+       case '_':
+       {
+               do_cmd_edit_autopick(creature_ptr);
+               break;
+       }
 
-               /* Interact with visuals */
-               case '%':
-               {
-                       do_cmd_visuals(creature_ptr);
-                       do_cmd_redraw(creature_ptr);
-                       break;
-               }
+       /* Interact with macros */
+       case '@':
+       {
+               do_cmd_macros(creature_ptr);
+               break;
+       }
 
-               /* Interact with colors */
-               case '&':
-               {
-                       do_cmd_colors(creature_ptr);
-                       do_cmd_redraw(creature_ptr);
-                       break;
-               }
+       /* Interact with visuals */
+       case '%':
+       {
+               do_cmd_visuals(creature_ptr);
+               do_cmd_redraw(creature_ptr);
+               break;
+       }
 
-               /* Interact with options */
-               case '=':
-               {
-                       do_cmd_options();
-                       (void)combine_and_reorder_home(STORE_HOME);
-                       do_cmd_redraw(creature_ptr);
-                       break;
-               }
+       /* Interact with colors */
+       case '&':
+       {
+               do_cmd_colors(creature_ptr);
+               do_cmd_redraw(creature_ptr);
+               break;
+       }
 
-               /*** Misc Commands ***/
+       /* Interact with options */
+       case '=':
+       {
+               do_cmd_options();
+               (void)combine_and_reorder_home(STORE_HOME);
+               do_cmd_redraw(creature_ptr);
+               break;
+       }
 
-               /* Take notes */
-               case ':':
-               {
-                       do_cmd_note();
-                       break;
-               }
+       /*** Misc Commands ***/
 
-               /* Version info */
-               case 'V':
-               {
-                       do_cmd_version();
-                       break;
-               }
+       /* Take notes */
+       case ':':
+       {
+               do_cmd_note();
+               break;
+       }
 
-               /* Repeat level feeling */
-               case KTRL('F'):
-               {
-                       do_cmd_feeling(creature_ptr);
-                       break;
-               }
+       /* Version info */
+       case 'V':
+       {
+               do_cmd_version();
+               break;
+       }
 
-               /* Show previous message */
-               case KTRL('O'):
-               {
-                       do_cmd_message_one();
-                       break;
-               }
+       /* Repeat level feeling */
+       case KTRL('F'):
+       {
+               do_cmd_feeling(creature_ptr);
+               break;
+       }
 
-               /* Show previous messages */
-               case KTRL('P'):
-               {
-                       do_cmd_messages(old_now_message);
-                       break;
-               }
+       /* Show previous message */
+       case KTRL('O'):
+       {
+               do_cmd_message_one();
+               break;
+       }
 
-               /* Show quest status -KMW- */
-               case KTRL('Q'):
-               {
-                       do_cmd_checkquest();
-                       break;
-               }
+       /* Show previous messages */
+       case KTRL('P'):
+       {
+               do_cmd_messages(old_now_message);
+               break;
+       }
 
-               /* Redraw the screen */
-               case KTRL('R'):
-               {
-                       now_message = old_now_message;
-                       do_cmd_redraw(creature_ptr);
-                       break;
-               }
+       /* Show quest status -KMW- */
+       case KTRL('Q'):
+       {
+               do_cmd_checkquest(creature_ptr);
+               break;
+       }
+
+       /* Redraw the screen */
+       case KTRL('R'):
+       {
+               now_message = old_now_message;
+               do_cmd_redraw(creature_ptr);
+               break;
+       }
 
 #ifndef VERIFY_SAVEFILE
 
-               /* Hack -- Save and don't quit */
-               case KTRL('S'):
-               {
-                       do_cmd_save_game(FALSE);
-                       break;
-               }
+       /* Hack -- Save and don't quit */
+       case KTRL('S'):
+       {
+               do_cmd_save_game(creature_ptr, FALSE);
+               break;
+       }
 
 #endif /* VERIFY_SAVEFILE */
 
-               case KTRL('T'):
-               {
-                       do_cmd_time();
-                       break;
-               }
+       case KTRL('T'):
+       {
+               do_cmd_time(creature_ptr);
+               break;
+       }
 
-               /* Save and quit */
-               case KTRL('X'):
-               case SPECIAL_KEY_QUIT:
-               {
-                       do_cmd_save_and_exit();
-                       break;
-               }
+       /* Save and quit */
+       case KTRL('X'):
+       case SPECIAL_KEY_QUIT:
+       {
+               do_cmd_save_and_exit(creature_ptr);
+               break;
+       }
 
-               /* Quit (commit suicide) */
-               case 'Q':
-               {
-                       do_cmd_suicide(creature_ptr);
-                       break;
-               }
+       /* Quit (commit suicide) */
+       case 'Q':
+       {
+               do_cmd_suicide(creature_ptr);
+               break;
+       }
 
-               case '|':
-               {
-                       do_cmd_nikki();
-                       break;
-               }
+       case '|':
+       {
+               do_cmd_diary(creature_ptr);
+               break;
+       }
 
-               /* Check artifacts, uniques, objects */
-               case '~':
-               {
-                       do_cmd_knowledge();
-                       break;
-               }
+       /* Check artifacts, uniques, objects */
+       case '~':
+       {
+               do_cmd_knowledge(creature_ptr);
+               break;
+       }
 
-               /* Load "screen dump" */
-               case '(':
-               {
-                       do_cmd_load_screen();
-                       break;
-               }
+       /* Load "screen dump" */
+       case '(':
+       {
+               do_cmd_load_screen();
+               break;
+       }
 
-               /* Save "screen dump" */
-               case ')':
-               {
-                       do_cmd_save_screen();
-                       break;
-               }
+       /* Save "screen dump" */
+       case ')':
+       {
+               do_cmd_save_screen(creature_ptr);
+               break;
+       }
 
-               /* Record/stop "Movie" */
-               case ']':
-               {
-                       prepare_movie_hooks();
-                       break;
-               }
+       /* Record/stop "Movie" */
+       case ']':
+       {
+               prepare_movie_hooks();
+               break;
+       }
 
-               /* Make random artifact list */
-               case KTRL('V'):
-               {
-                       spoil_random_artifact("randifact.txt");
-                       break;
-               }
+       /* Make random artifact list */
+       case KTRL('V'):
+       {
+               spoil_random_artifact(creature_ptr, "randifact.txt");
+               break;
+       }
 
 #ifdef TRAVEL
-               case '`':
+       case '`':
+       {
+               if (!creature_ptr->wild_mode) do_cmd_travel(creature_ptr);
+               if (creature_ptr->special_defense & KATA_MUSOU)
                {
-                       if (!creature_ptr->wild_mode) do_cmd_travel(creature_ptr);
-                       if (creature_ptr->special_defense & KATA_MUSOU)
-                       {
-                               set_action(creature_ptr, ACTION_NONE);
-                       }
-                       break;
+                       set_action(creature_ptr, ACTION_NONE);
                }
+               break;
+       }
 #endif
 
-               /* Hack -- Unknown command */
-               default:
+       /* Hack -- Unknown command */
+       default:
+       {
+               if (flush_failure) flush();
+               if (one_in_(2))
                {
-                       if (flush_failure) flush();
-                       if (one_in_(2))
-                       {
-                               char error_m[1024];
-                               sound(SOUND_ILLEGAL);
-                               if (!get_rnd_line(_("error_j.txt", "error.txt"), 0, error_m))
-                                       msg_print(error_m);
-                       }
-                       else
-                       {
-                               prt(_(" '?' でヘルプが表示されます。", "Type '?' for help."), 0, 0);
-                       }
-
-                       break;
+                       char error_m[1024];
+                       sound(SOUND_ILLEGAL);
+                       if (!get_rnd_line(_("error_j.txt", "error.txt"), 0, error_m))
+                               msg_print(error_m);
+               }
+               else
+               {
+                       prt(_(" '?' でヘルプが表示されます。", "Type '?' for help."), 0, 0);
                }
+
+               break;
+       }
        }
        if (!creature_ptr->energy_use && !now_message)
                now_message = old_now_message;
@@ -4306,68 +4311,63 @@ static void process_command(player_type *creature_ptr)
  */
 static void pack_overflow(player_type *owner_ptr)
 {
-       if (owner_ptr->inventory_list[INVEN_PACK].k_idx)
-       {
-               GAME_TEXT o_name[MAX_NLEN];
-               object_type *o_ptr;
+       if (owner_ptr->inventory_list[INVEN_PACK].k_idx == 0) return;
 
-               /* Is auto-destroy done? */
-               update_creature(owner_ptr);
-               if (!owner_ptr->inventory_list[INVEN_PACK].k_idx) return;
+       GAME_TEXT o_name[MAX_NLEN];
+       object_type *o_ptr;
 
-               /* Access the slot to be dropped */
-               o_ptr = &owner_ptr->inventory_list[INVEN_PACK];
+       /* Is auto-destroy done? */
+       update_creature(owner_ptr);
+       if (!owner_ptr->inventory_list[INVEN_PACK].k_idx) return;
 
-               disturb(owner_ptr, FALSE, TRUE);
+       /* Access the slot to be dropped */
+       o_ptr = &owner_ptr->inventory_list[INVEN_PACK];
 
-               /* Warning */
-               msg_print(_("ザックからアイテムがあふれた!", "Your pack overflows!"));
-               object_desc(o_name, o_ptr, 0);
+       disturb(owner_ptr, FALSE, TRUE);
 
-               msg_format(_("%s(%c)を落とした。", "You drop %s (%c)."), o_name, index_to_label(INVEN_PACK));
+       /* Warning */
+       msg_print(_("ザックからアイテムがあふれた!", "Your pack overflows!"));
+       object_desc(o_name, o_ptr, 0);
 
-               /* Drop it (carefully) near the player */
-               (void)drop_near(o_ptr, 0, owner_ptr->y, owner_ptr->x);
+       msg_format(_("%s(%c)を落とした。", "You drop %s (%c)."), o_name, index_to_label(INVEN_PACK));
 
-               /* Modify, Describe, Optimize */
-               inven_item_increase(INVEN_PACK, -255);
-               inven_item_describe(INVEN_PACK);
-               inven_item_optimize(INVEN_PACK);
+       /* Drop it (carefully) near the player */
+       (void)drop_near(owner_ptr, o_ptr, 0, owner_ptr->y, owner_ptr->x);
 
-               handle_stuff();
-       }
+       vary_item(owner_ptr, INVEN_PACK, -255);
+       handle_stuff(owner_ptr);
 }
 
 /*!
  * @brief プレイヤーの行動エネルギーが充填される(=プレイヤーのターンが回る)毎に行われる処理  / process the effects per 100 energy at player speed.
  * @return なし
  */
-static void process_upkeep_with_speed(void)
+static void process_upkeep_with_speed(player_type *creature_ptr)
 {
        /* Give the player some energy */
-       if (!load && p_ptr->enchant_energy_need > 0 && !p_ptr->leaving)
+       if (!load && creature_ptr->enchant_energy_need > 0 && !creature_ptr->leaving)
        {
-               p_ptr->enchant_energy_need -= SPEED_TO_ENERGY(p_ptr->pspeed);
+               creature_ptr->enchant_energy_need -= SPEED_TO_ENERGY(creature_ptr->pspeed);
        }
-       
+
        /* No turn yet */
-       if (p_ptr->enchant_energy_need > 0) return;
-       
-       while (p_ptr->enchant_energy_need <= 0)
+       if (creature_ptr->enchant_energy_need > 0) return;
+
+       while (creature_ptr->enchant_energy_need <= 0)
        {
                /* Handle the player song */
-               if (!load) check_music(p_ptr);
+               if (!load) check_music(creature_ptr);
 
                /* Hex - Handle the hex spells */
-               if (!load) check_hex(p_ptr);
-               if (!load) revenge_spell(p_ptr);
-               
+               if (!load) check_hex(creature_ptr);
+               if (!load) revenge_spell(creature_ptr);
+
                /* There is some randomness of needed energy */
-               p_ptr->enchant_energy_need += ENERGY_NEED();
+               creature_ptr->enchant_energy_need += ENERGY_NEED();
        }
 }
 
-static void process_fishing(void)
+static void process_fishing(player_type *creature_ptr)
 {
        Term_xtra(TERM_XTRA_DELAY, 10);
        if (one_in_(1000))
@@ -4375,17 +4375,17 @@ static void process_fishing(void)
                MONRACE_IDX r_idx;
                bool success = FALSE;
                get_mon_num_prep(monster_is_fishing_target, NULL);
-               r_idx = get_mon_num(p_ptr->current_floor_ptr->dun_level ? p_ptr->current_floor_ptr->dun_level : wilderness[p_ptr->wilderness_y][p_ptr->wilderness_x].level);
+               r_idx = get_mon_num(creature_ptr->current_floor_ptr->dun_level ? creature_ptr->current_floor_ptr->dun_level : wilderness[creature_ptr->wilderness_y][creature_ptr->wilderness_x].level);
                msg_print(NULL);
                if (r_idx && one_in_(2))
                {
                        POSITION y, x;
-                       y = p_ptr->y + ddy[p_ptr->fishing_dir];
-                       x = p_ptr->x + ddx[p_ptr->fishing_dir];
-                       if (place_monster_aux(0, y, x, r_idx, PM_NO_KAGE))
+                       y = creature_ptr->y + ddy[creature_ptr->fishing_dir];
+                       x = creature_ptr->x + ddx[creature_ptr->fishing_dir];
+                       if (place_monster_aux(creature_ptr, 0, y, x, r_idx, PM_NO_KAGE))
                        {
                                GAME_TEXT m_name[MAX_NLEN];
-                               monster_desc(m_name, &p_ptr->current_floor_ptr->m_list[p_ptr->current_floor_ptr->grid_array[y][x].m_idx], 0);
+                               monster_desc(m_name, &creature_ptr->current_floor_ptr->m_list[creature_ptr->current_floor_ptr->grid_array[y][x].m_idx], 0);
                                msg_format(_("%sが釣れた!", "You have a good catch!"), m_name);
                                success = TRUE;
                        }
@@ -4394,7 +4394,7 @@ static void process_fishing(void)
                {
                        msg_print(_("餌だけ食われてしまった!くっそ~!", "Damn!  The fish stole your bait!"));
                }
-               disturb(p_ptr, FALSE, TRUE);
+               disturb(creature_ptr, FALSE, TRUE);
        }
 }
 
@@ -4423,13 +4423,13 @@ static void process_player(player_type *creature_ptr)
        if (creature_ptr->invoking_midnight_curse)
        {
                int count = 0;
-               activate_ty_curse(FALSE, &count);
+               activate_ty_curse(creature_ptr, FALSE, &count);
                creature_ptr->invoking_midnight_curse = FALSE;
        }
 
        if (creature_ptr->phase_out)
        {
-               for(m_idx = 1; m_idx < creature_ptr->current_floor_ptr->m_max; m_idx++)
+               for (m_idx = 1; m_idx < creature_ptr->current_floor_ptr->m_max; m_idx++)
                {
                        monster_type *m_ptr = &creature_ptr->current_floor_ptr->m_list[m_idx];
 
@@ -4438,7 +4438,8 @@ static void process_player(player_type *creature_ptr)
                        m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
                        update_monster(creature_ptr, m_idx, FALSE);
                }
-               prt_time();
+
+               print_time(creature_ptr);
        }
 
        /* Give the player some energy */
@@ -4449,7 +4450,7 @@ static void process_player(player_type *creature_ptr)
 
        /* No turn yet */
        if (creature_ptr->energy_need > 0) return;
-       if (!command_rep) prt_time();
+       if (!command_rep) print_time(creature_ptr);
 
        /*** Check for interupts ***/
 
@@ -4461,7 +4462,7 @@ static void process_player(player_type *creature_ptr)
                {
                        /* Stop resting */
                        if ((creature_ptr->chp == creature_ptr->mhp) &&
-                           (creature_ptr->csp >= creature_ptr->msp))
+                               (creature_ptr->csp >= creature_ptr->msp))
                        {
                                set_action(creature_ptr, ACTION_NONE);
                        }
@@ -4472,20 +4473,20 @@ static void process_player(player_type *creature_ptr)
                {
                        /* Stop resting */
                        if ((creature_ptr->chp == creature_ptr->mhp) &&
-                           (creature_ptr->csp >= creature_ptr->msp) &&
-                           !creature_ptr->blind && !creature_ptr->confused &&
-                           !creature_ptr->poisoned && !creature_ptr->afraid &&
-                           !creature_ptr->stun && !creature_ptr->cut &&
-                           !creature_ptr->slow && !creature_ptr->paralyzed &&
-                           !creature_ptr->image && !creature_ptr->word_recall &&
-                           !creature_ptr->alter_reality)
+                               (creature_ptr->csp >= creature_ptr->msp) &&
+                               !creature_ptr->blind && !creature_ptr->confused &&
+                               !creature_ptr->poisoned && !creature_ptr->afraid &&
+                               !creature_ptr->stun && !creature_ptr->cut &&
+                               !creature_ptr->slow && !creature_ptr->paralyzed &&
+                               !creature_ptr->image && !creature_ptr->word_recall &&
+                               !creature_ptr->alter_reality)
                        {
                                set_action(creature_ptr, ACTION_NONE);
                        }
                }
        }
 
-       if (creature_ptr->action == ACTION_FISH) process_fishing();
+       if (creature_ptr->action == ACTION_FISH) process_fishing(creature_ptr);
 
        /* Handle "abort" */
        if (check_abort)
@@ -4519,15 +4520,15 @@ static void process_player(player_type *creature_ptr)
                        GAME_TEXT m_name[MAX_NLEN];
 
                        /* Recover fully */
-                       (void)set_monster_csleep(creature_ptr->riding, 0);
+                       (void)set_monster_csleep(creature_ptr, creature_ptr->riding, 0);
                        monster_desc(m_name, m_ptr, 0);
-                       msg_format(_("%^sを起こした。", "You have waked %s up."), m_name);
+                       msg_format(_("%^sを起こした。", "You have woken %s up."), m_name);
                }
 
                if (MON_STUNNED(m_ptr))
                {
                        /* Hack -- Recover from stun */
-                       if (set_monster_stunned(creature_ptr->riding,
+                       if (set_monster_stunned(creature_ptr, creature_ptr->riding,
                                (randint0(r_ptr->level) < creature_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_STUNNED(m_ptr) - 1)))
                        {
                                GAME_TEXT m_name[MAX_NLEN];
@@ -4539,7 +4540,7 @@ static void process_player(player_type *creature_ptr)
                if (MON_CONFUSED(m_ptr))
                {
                        /* Hack -- Recover from confusion */
-                       if (set_monster_confused(creature_ptr->riding,
+                       if (set_monster_confused(creature_ptr, creature_ptr->riding,
                                (randint0(r_ptr->level) < creature_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_CONFUSED(m_ptr) - 1)))
                        {
                                GAME_TEXT m_name[MAX_NLEN];
@@ -4551,18 +4552,18 @@ static void process_player(player_type *creature_ptr)
                if (MON_MONFEAR(m_ptr))
                {
                        /* Hack -- Recover from fear */
-                       if(set_monster_monfear(creature_ptr->riding,
+                       if (set_monster_monfear(creature_ptr, creature_ptr->riding,
                                (randint0(r_ptr->level) < creature_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_MONFEAR(m_ptr) - 1)))
                        {
                                GAME_TEXT m_name[MAX_NLEN];
                                monster_desc(m_name, m_ptr, 0);
-                               msg_format(_("%^sを恐怖から立ち直らせた。", "%^s is no longer fear."), m_name);
+                               msg_format(_("%^sを恐怖から立ち直らせた。", "%^s is no longer afraid."), m_name);
                        }
                }
 
-               handle_stuff();
+               handle_stuff(creature_ptr);
        }
-       
+
        load = FALSE;
 
        /* Fast */
@@ -4572,7 +4573,7 @@ static void process_player(player_type *creature_ptr)
        }
        if ((creature_ptr->pclass == CLASS_FORCETRAINER) && P_PTR_KI)
        {
-               if(P_PTR_KI < 40) P_PTR_KI = 0;
+               if (P_PTR_KI < 40) P_PTR_KI = 0;
                else P_PTR_KI -= 40;
                creature_ptr->update |= (PU_BONUS);
        }
@@ -4583,7 +4584,7 @@ static void process_player(player_type *creature_ptr)
 
                /* Convert the unit (1/2^16) to (1/2^32) */
                s64b_LSHIFT(cost, cost_frac, 16);
+
                if (s64b_cmp(creature_ptr->csp, creature_ptr->csp_frac, cost, cost_frac) < 0)
                {
                        /* Mana run out */
@@ -4625,7 +4626,7 @@ static void process_player(player_type *creature_ptr)
                creature_ptr->counter = FALSE;
                creature_ptr->now_damaged = FALSE;
 
-               handle_stuff();
+               handle_stuff(creature_ptr);
 
                /* Place the cursor on the player */
                move_cursor_relative(creature_ptr->y, creature_ptr->x);
@@ -4685,7 +4686,7 @@ static void process_player(player_type *creature_ptr)
                else if (creature_ptr->running)
                {
                        /* Take a step */
-                       run_step(0);
+                       run_step(creature_ptr, 0);
                }
 
 #ifdef TRAVEL
@@ -4693,7 +4694,7 @@ static void process_player(player_type *creature_ptr)
                else if (travel.run)
                {
                        /* Take a step */
-                       travel_step();
+                       travel_step(creature_ptr);
                }
 #endif
 
@@ -4704,7 +4705,7 @@ static void process_player(player_type *creature_ptr)
                        command_rep--;
 
                        creature_ptr->redraw |= (PR_STATE);
-                       handle_stuff();
+                       handle_stuff(creature_ptr);
 
                        /* Hack -- Assume messages were seen */
                        msg_flag = FALSE;
@@ -4724,7 +4725,7 @@ static void process_player(player_type *creature_ptr)
 
                        can_save = TRUE;
                        /* Get a command (normal) */
-                       request_command(FALSE);
+                       request_command(creature_ptr, FALSE);
                        can_save = FALSE;
 
                        /* Process the command */
@@ -4851,7 +4852,7 @@ static void process_player(player_type *creature_ptr)
                                creature_ptr->redraw |= (PR_STATE);
                        }
 
-                       if (creature_ptr->timewalk && (creature_ptr->energy_need > - 1000))
+                       if (creature_ptr->timewalk && (creature_ptr->energy_need > -1000))
                        {
 
                                creature_ptr->redraw |= (PR_MAP);
@@ -4863,7 +4864,7 @@ static void process_player(player_type *creature_ptr)
                                creature_ptr->timewalk = FALSE;
                                creature_ptr->energy_need = ENERGY_NEED();
 
-                               handle_stuff();
+                               handle_stuff(creature_ptr);
                        }
                }
 
@@ -4898,49 +4899,43 @@ static void process_player(player_type *creature_ptr)
  * the user dies, or the game is terminated.\n
  * </p>
  */
-static void dungeon(bool load_game)
+static void dungeon(player_type *player_ptr, bool load_game)
 {
        int quest_num = 0;
 
        /* Set the base level */
-       p_ptr->current_floor_ptr->base_level = p_ptr->current_floor_ptr->dun_level;
+       floor_type *floor_ptr = player_ptr->current_floor_ptr;
+       floor_ptr->base_level = floor_ptr->dun_level;
 
        /* Reset various flags */
        current_world_ptr->is_loading_now = FALSE;
 
        /* Not leaving */
-       p_ptr->leaving = FALSE;
+       player_ptr->leaving = FALSE;
 
        /* Reset the "command" vars */
        command_cmd = 0;
-
-#if 0 /* Don't reset here --- It's used for Arena */
-       command_new = 0;
-#endif
-
        command_rep = 0;
        command_arg = 0;
        command_dir = 0;
 
-
        /* Cancel the target */
        target_who = 0;
-       p_ptr->pet_t_m_idx = 0;
-       p_ptr->riding_t_m_idx = 0;
-       p_ptr->ambush_flag = FALSE;
+       player_ptr->pet_t_m_idx = 0;
+       player_ptr->riding_t_m_idx = 0;
+       player_ptr->ambush_flag = FALSE;
 
-       /* Cancel the health bar */
-       health_track(0);
+       health_track(player_ptr, 0);
 
        /* Check visual effects */
        repair_monsters = TRUE;
        repair_objects = TRUE;
 
 
-       disturb(p_ptr, TRUE, TRUE);
+       disturb(player_ptr, TRUE, TRUE);
 
        /* Get index of current quest (if any) */
-       quest_num = quest_number(p_ptr->current_floor_ptr->dun_level);
+       quest_num = quest_number(player_ptr, floor_ptr->dun_level);
 
        /* Inside a quest? */
        if (quest_num)
@@ -4950,26 +4945,26 @@ static void dungeon(bool load_game)
        }
 
        /* Track maximum player level */
-       if (p_ptr->max_plv < p_ptr->lev)
+       if (player_ptr->max_plv < player_ptr->lev)
        {
-               p_ptr->max_plv = p_ptr->lev;
+               player_ptr->max_plv = player_ptr->lev;
        }
 
 
        /* Track maximum dungeon level (if not in quest -KMW-) */
-       if ((max_dlv[p_ptr->dungeon_idx] < p_ptr->current_floor_ptr->dun_level) && !p_ptr->current_floor_ptr->inside_quest)
+       if ((max_dlv[player_ptr->dungeon_idx] < floor_ptr->dun_level) && !floor_ptr->inside_quest)
        {
-               max_dlv[p_ptr->dungeon_idx] = p_ptr->current_floor_ptr->dun_level;
-               if (record_maxdepth) exe_write_diary(p_ptr, NIKKI_MAXDEAPTH, p_ptr->current_floor_ptr->dun_level, NULL);
+               max_dlv[player_ptr->dungeon_idx] = floor_ptr->dun_level;
+               if (record_maxdepth) exe_write_diary(player_ptr, DIARY_MAXDEAPTH, floor_ptr->dun_level, NULL);
        }
 
-       (void)calculate_upkeep(p_ptr);
+       (void)calculate_upkeep(player_ptr);
 
        /* Validate the panel */
        panel_bounds_center();
 
        /* Verify the panel */
-       verify_panel();
+       verify_panel(player_ptr);
 
        msg_erase();
 
@@ -4977,30 +4972,30 @@ static void dungeon(bool load_game)
        /* Enter "xtra" mode */
        current_world_ptr->character_xtra = TRUE;
 
-       p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER | PW_MONSTER | PW_OVERHEAD | PW_DUNGEON);
-       p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_EQUIPPY | PR_MAP);
-       p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS | PU_VIEW | PU_LITE | PU_MON_LITE | PU_TORCH | PU_MONSTERS | PU_DISTANCE | PU_FLOW);
+       player_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER | PW_MONSTER | PW_OVERHEAD | PW_DUNGEON);
+       player_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_EQUIPPY | PR_MAP);
+       player_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS | PU_VIEW | PU_LITE | PU_MON_LITE | PU_TORCH | PU_MONSTERS | PU_DISTANCE | PU_FLOW);
 
-       handle_stuff();
+       handle_stuff(player_ptr);
 
        /* Leave "xtra" mode */
        current_world_ptr->character_xtra = FALSE;
 
-       p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
-       p_ptr->update |= (PU_COMBINE | PU_REORDER);
-       handle_stuff();
+       player_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
+       player_ptr->update |= (PU_COMBINE | PU_REORDER);
+       handle_stuff(player_ptr);
        Term_fresh();
 
        if (quest_num && (is_fixed_quest_idx(quest_num) &&
-           !((quest_num == QUEST_OBERON) || (quest_num == QUEST_SERPENT) ||
-           !(quest[quest_num].flags & QUEST_FLAG_PRESET)))) do_cmd_feeling(p_ptr);
+               !((quest_num == QUEST_OBERON) || (quest_num == QUEST_SERPENT) ||
+                       !(quest[quest_num].flags & QUEST_FLAG_PRESET)))) do_cmd_feeling(player_ptr);
 
-       if (p_ptr->phase_out)
+       if (player_ptr->phase_out)
        {
                if (load_game)
                {
-                       p_ptr->energy_need = 0;
-                       update_gambling_monsters();
+                       player_ptr->energy_need = 0;
+                       update_gambling_monsters(player_ptr);
                }
                else
                {
@@ -5009,126 +5004,126 @@ static void dungeon(bool load_game)
                }
        }
 
-       if ((p_ptr->pclass == CLASS_BARD) && (SINGING_SONG_EFFECT(p_ptr) > MUSIC_DETECT))
-               SINGING_SONG_EFFECT(p_ptr) = MUSIC_DETECT;
+       if ((player_ptr->pclass == CLASS_BARD) && (SINGING_SONG_EFFECT(player_ptr) > MUSIC_DETECT))
+               SINGING_SONG_EFFECT(player_ptr) = MUSIC_DETECT;
 
        /* Hack -- notice death or departure */
-       if (!p_ptr->playing || p_ptr->is_dead) return;
+       if (!player_ptr->playing || player_ptr->is_dead) return;
 
        /* Print quest message if appropriate */
-       if (!p_ptr->current_floor_ptr->inside_quest && (p_ptr->dungeon_idx == DUNGEON_ANGBAND))
+       if (!floor_ptr->inside_quest && (player_ptr->dungeon_idx == DUNGEON_ANGBAND))
        {
-               quest_discovery(random_quest_number(p_ptr->current_floor_ptr->dun_level));
-               p_ptr->current_floor_ptr->inside_quest = random_quest_number(p_ptr->current_floor_ptr->dun_level);
+               quest_discovery(random_quest_number(player_ptr, floor_ptr->dun_level));
+               floor_ptr->inside_quest = random_quest_number(player_ptr, floor_ptr->dun_level);
        }
-       if ((p_ptr->current_floor_ptr->dun_level == d_info[p_ptr->dungeon_idx].maxdepth) && d_info[p_ptr->dungeon_idx].final_guardian)
+       if ((floor_ptr->dun_level == d_info[player_ptr->dungeon_idx].maxdepth) && d_info[player_ptr->dungeon_idx].final_guardian)
        {
-               if (r_info[d_info[p_ptr->dungeon_idx].final_guardian].max_num)
+               if (r_info[d_info[player_ptr->dungeon_idx].final_guardian].max_num)
 #ifdef JP
                        msg_format("この階には%sの主である%sが棲んでいる。",
-                                  d_name+d_info[p_ptr->dungeon_idx].name, 
-                                  r_name+r_info[d_info[p_ptr->dungeon_idx].final_guardian].name);
+                               d_name + d_info[player_ptr->dungeon_idx].name,
+                               r_name + r_info[d_info[player_ptr->dungeon_idx].final_guardian].name);
 #else
                        msg_format("%^s lives in this level as the keeper of %s.",
-                                          r_name+r_info[d_info[p_ptr->dungeon_idx].final_guardian].name, 
-                                          d_name+d_info[p_ptr->dungeon_idx].name);
+                               r_name + r_info[d_info[player_ptr->dungeon_idx].final_guardian].name,
+                               d_name + d_info[player_ptr->dungeon_idx].name);
 #endif
        }
 
-       if (!load_game && (p_ptr->special_defense & NINJA_S_STEALTH)) set_superstealth(p_ptr, FALSE);
+       if (!load_game && (player_ptr->special_defense & NINJA_S_STEALTH)) set_superstealth(player_ptr, FALSE);
 
        /*** Process this dungeon level ***/
 
        /* Reset the monster generation level */
-       p_ptr->current_floor_ptr->monster_level = p_ptr->current_floor_ptr->base_level;
+       floor_ptr->monster_level = floor_ptr->base_level;
 
        /* Reset the object generation level */
-       p_ptr->current_floor_ptr->object_level = p_ptr->current_floor_ptr->base_level;
+       floor_ptr->object_level = floor_ptr->base_level;
 
        current_world_ptr->is_loading_now = TRUE;
 
-       if (p_ptr->energy_need > 0 && !p_ptr->phase_out &&
-           (p_ptr->current_floor_ptr->dun_level || p_ptr->leaving_dungeon || p_ptr->current_floor_ptr->inside_arena))
-               p_ptr->energy_need = 0;
+       if (player_ptr->energy_need > 0 && !player_ptr->phase_out &&
+               (floor_ptr->dun_level || player_ptr->leaving_dungeon || floor_ptr->inside_arena))
+               player_ptr->energy_need = 0;
 
        /* Not leaving dungeon */
-       p_ptr->leaving_dungeon = FALSE;
+       player_ptr->leaving_dungeon = FALSE;
 
        /* Initialize monster process */
-       mproc_init();
+       mproc_init(floor_ptr);
 
        /* Main loop */
        while (TRUE)
        {
                /* Hack -- Compact the monster list occasionally */
-               if ((p_ptr->current_floor_ptr->m_cnt + 32 > current_world_ptr->max_m_idx) && !p_ptr->phase_out) compact_monsters(64);
+               if ((floor_ptr->m_cnt + 32 > current_world_ptr->max_m_idx) && !player_ptr->phase_out) compact_monsters(64);
 
                /* Hack -- Compress the monster list occasionally */
-               if ((p_ptr->current_floor_ptr->m_cnt + 32 < p_ptr->current_floor_ptr->m_max) && !p_ptr->phase_out) compact_monsters(0);
+               if ((floor_ptr->m_cnt + 32 < floor_ptr->m_max) && !player_ptr->phase_out) compact_monsters(0);
 
 
                /* Hack -- Compact the object list occasionally */
-               if (p_ptr->current_floor_ptr->o_cnt + 32 > current_world_ptr->max_o_idx) compact_objects(64);
+               if (floor_ptr->o_cnt + 32 > current_world_ptr->max_o_idx) compact_objects(player_ptr, 64);
 
                /* Hack -- Compress the object list occasionally */
-               if (p_ptr->current_floor_ptr->o_cnt + 32 < p_ptr->current_floor_ptr->o_max) compact_objects(0);
+               if (floor_ptr->o_cnt + 32 < floor_ptr->o_max) compact_objects(player_ptr, 0);
 
                /* Process the player */
-               process_player(p_ptr);
-               process_upkeep_with_speed();
+               process_player(player_ptr);
+               process_upkeep_with_speed(player_ptr);
 
-               handle_stuff();
+               handle_stuff(player_ptr);
 
                /* Hack -- Hilite the player */
-               move_cursor_relative(p_ptr->y, p_ptr->x);
+               move_cursor_relative(player_ptr->y, player_ptr->x);
 
                /* Optional fresh */
                if (fresh_after) Term_fresh();
 
                /* Hack -- Notice death or departure */
-               if (!p_ptr->playing || p_ptr->is_dead) break;
+               if (!player_ptr->playing || player_ptr->is_dead) break;
 
                /* Process all of the monsters */
-               process_monsters();
+               process_monsters(player_ptr);
 
-               handle_stuff();
+               handle_stuff(player_ptr);
 
                /* Hack -- Hilite the player */
-               move_cursor_relative(p_ptr->y, p_ptr->x);
+               move_cursor_relative(player_ptr->y, player_ptr->x);
 
                /* Optional fresh */
                if (fresh_after) Term_fresh();
 
                /* Hack -- Notice death or departure */
-               if (!p_ptr->playing || p_ptr->is_dead) break;
+               if (!player_ptr->playing || player_ptr->is_dead) break;
 
                /* Process the world */
-               process_world();
+               process_world(player_ptr);
 
-               handle_stuff();
+               handle_stuff(player_ptr);
 
                /* Hack -- Hilite the player */
-               move_cursor_relative(p_ptr->y, p_ptr->x);
+               move_cursor_relative(player_ptr->y, player_ptr->x);
 
                /* Optional fresh */
                if (fresh_after) Term_fresh();
 
                /* Hack -- Notice death or departure */
-               if (!p_ptr->playing || p_ptr->is_dead) break;
+               if (!player_ptr->playing || player_ptr->is_dead) break;
 
                /* Count game turns */
                current_world_ptr->game_turn++;
 
                if (current_world_ptr->dungeon_turn < current_world_ptr->dungeon_turn_limit)
                {
-                       if (!p_ptr->wild_mode || wild_regen) current_world_ptr->dungeon_turn++;
-                       else if (p_ptr->wild_mode && !(current_world_ptr->game_turn % ((MAX_HGT + MAX_WID) / 2))) current_world_ptr->dungeon_turn++;
+                       if (!player_ptr->wild_mode || wild_regen) current_world_ptr->dungeon_turn++;
+                       else if (player_ptr->wild_mode && !(current_world_ptr->game_turn % ((MAX_HGT + MAX_WID) / 2))) current_world_ptr->dungeon_turn++;
                }
 
-               prevent_turn_overflow();
+               prevent_turn_overflow(player_ptr);
 
                /* Handle "leaving" */
-               if (p_ptr->leaving) break;
+               if (player_ptr->leaving) break;
 
                if (wild_regen) wild_regen--;
        }
@@ -5141,13 +5136,13 @@ static void dungeon(bool load_game)
        }
 
        /* Not save-and-quit and not dead? */
-       if (p_ptr->playing && !p_ptr->is_dead)
+       if (player_ptr->playing && !player_ptr->is_dead)
        {
                /*
                 * Maintain Unique monsters and artifact, save current
                 * floor, then prepare next floor
                 */
-               leave_floor(p_ptr);
+               leave_floor(player_ptr);
 
                /* Forget the flag */
                reinit_wilderness = FALSE;
@@ -5160,12 +5155,13 @@ static void dungeon(bool load_game)
 
 /*!
  * @brief 全ユーザプロファイルをロードする / Load some "user pref files"
+ * @paaram player_ptr プレーヤーへの参照ポインタ
  * @return なし
  * @note
  * Modified by Arcum Dagsson to support
  * separate macro files for different realms.
  */
-static void load_all_pref_files(void)
+static void load_all_pref_files(player_type *player_ptr)
 {
        char buf[1024];
 
@@ -5173,55 +5169,56 @@ static void load_all_pref_files(void)
        sprintf(buf, "user.prf");
 
        /* Process that file */
-       process_pref_file(buf);
+       process_pref_file(player_ptr, buf);
 
        /* Access the "user" system pref file */
        sprintf(buf, "user-%s.prf", ANGBAND_SYS);
 
        /* Process that file */
-       process_pref_file(buf);
+       process_pref_file(player_ptr, buf);
 
        /* Access the "race" pref file */
        sprintf(buf, "%s.prf", rp_ptr->title);
 
        /* Process that file */
-       process_pref_file(buf);
+       process_pref_file(player_ptr, buf);
 
        /* Access the "class" pref file */
        sprintf(buf, "%s.prf", cp_ptr->title);
 
        /* Process that file */
-       process_pref_file(buf);
+       process_pref_file(player_ptr, buf);
 
        /* Access the "character" pref file */
-       sprintf(buf, "%s.prf", p_ptr->base_name);
+       sprintf(buf, "%s.prf", player_ptr->base_name);
 
        /* Process that file */
-       process_pref_file(buf);
+       process_pref_file(player_ptr, buf);
 
        /* Access the "realm 1" pref file */
-       if (p_ptr->realm1 != REALM_NONE)
+       if (player_ptr->realm1 != REALM_NONE)
        {
-               sprintf(buf, "%s.prf", realm_names[p_ptr->realm1]);
+               sprintf(buf, "%s.prf", realm_names[player_ptr->realm1]);
 
                /* Process that file */
-               process_pref_file(buf);
+               process_pref_file(player_ptr, buf);
        }
 
        /* Access the "realm 2" pref file */
-       if (p_ptr->realm2 != REALM_NONE)
+       if (player_ptr->realm2 != REALM_NONE)
        {
-               sprintf(buf, "%s.prf", realm_names[p_ptr->realm2]);
+               sprintf(buf, "%s.prf", realm_names[player_ptr->realm2]);
 
                /* Process that file */
-               process_pref_file(buf);
+               process_pref_file(player_ptr, buf);
        }
 
 
        /* Load an autopick preference file */
-       autopick_load_pref(FALSE);
+       autopick_load_pref(player_ptr, FALSE);
 }
 
+
 /*!
  * @brief 1ゲームプレイの主要ルーチン / Actually play a game
  * @return なし
@@ -5230,7 +5227,7 @@ static void load_all_pref_files(void)
  * savefile, we will commit suicide, if necessary, to allow the
  * player to start a new game.
  */
-void play_game(bool new_game)
+void play_game(player_type *player_ptr, bool new_game)
 {
        MONSTER_IDX i;
        bool load_game = TRUE;
@@ -5252,12 +5249,12 @@ void play_game(bool new_game)
 
        if (browsing_movie)
        {
-               reset_visuals();
+               reset_visuals(player_ptr);
                browse_movie();
                return;
        }
 
-       p_ptr->hack_mutation = FALSE;
+       player_ptr->hack_mutation = FALSE;
 
        /* Hack -- Character is "icky" */
        current_world_ptr->character_icky = TRUE;
@@ -5283,7 +5280,7 @@ void play_game(bool new_game)
 
 
        /* Attempt to load */
-       if (!load_player())
+       if (!load_player(player_ptr))
        {
                quit(_("セーブファイルが壊れています", "broken savefile"));
        }
@@ -5292,7 +5289,7 @@ void play_game(bool new_game)
        extract_option_vars();
 
        /* Report waited score */
-       if (p_ptr->wait_report_score)
+       if (player_ptr->wait_report_score)
        {
                char buf[1024];
                bool success;
@@ -5300,16 +5297,16 @@ void play_game(bool new_game)
                if (!get_check_strict(_("待機していたスコア登録を今行ないますか?", "Do you register score now? "), CHECK_NO_HISTORY))
                        quit(0);
 
-               p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
-               update_creature(p_ptr);
+               player_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
+               update_creature(player_ptr);
 
-               p_ptr->is_dead = TRUE;
+               player_ptr->is_dead = TRUE;
 
                current_world_ptr->start_time = (u32b)time(NULL);
 
                /* No suspending now */
                signals_ignore_tstp();
-               
+
                /* Hack -- Character is now "icky" */
                current_world_ptr->character_icky = TRUE;
                path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
@@ -5318,10 +5315,10 @@ void play_game(bool new_game)
                highscore_fd = fd_open(buf, O_RDWR);
 
                /* 町名消失バグ対策(#38205)のためここで世界マップ情報を読み出す */
-               process_dungeon_file("w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x);
+               process_dungeon_file(player_ptr, "w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x);
 
                /* Handle score, show Top scores */
-               success = send_world_score(TRUE);
+               success = send_world_score(player_ptr, TRUE);
 
                if (!success && !get_check_strict(_("スコア登録を諦めますか?", "Do you give up score registration? "), CHECK_NO_HISTORY))
                {
@@ -5330,16 +5327,16 @@ void play_game(bool new_game)
                }
                else
                {
-                       p_ptr->wait_report_score = FALSE;
-                       top_twenty(p_ptr);
-                       if (!save_player()) msg_print(_("セーブ失敗!", "death save failed!"));
+                       player_ptr->wait_report_score = FALSE;
+                       top_twenty(player_ptr);
+                       if (!save_player(player_ptr)) msg_print(_("セーブ失敗!", "death save failed!"));
                }
                /* Shut the high score file */
                (void)fd_close(highscore_fd);
 
                /* Forget the high score fd */
                highscore_fd = -1;
-               
+
                /* Allow suspending now */
                signals_handle_tstp();
 
@@ -5361,21 +5358,21 @@ void play_game(bool new_game)
                init_random_seed = TRUE;
 
                /* Initialize the saved floors data */
-               init_saved_floors(FALSE);
+               init_saved_floors(player_ptr, FALSE);
        }
 
        /* Old game is loaded.  But new game is requested. */
        else if (new_game)
        {
                /* Initialize the saved floors data */
-               init_saved_floors(TRUE);
+               init_saved_floors(player_ptr, TRUE);
        }
 
        /* Process old character */
        if (!new_game)
        {
                /* Process the player name */
-               process_player_name(FALSE);
+               process_player_name(player_ptr, FALSE);
        }
 
        /* Init the RNG */
@@ -5385,16 +5382,17 @@ void play_game(bool new_game)
        }
 
        /* Roll new character */
+       floor_type *floor_ptr = player_ptr->current_floor_ptr;
        if (new_game)
        {
                /* The dungeon is not ready */
                current_world_ptr->character_dungeon = FALSE;
 
                /* Start in town */
-               p_ptr->current_floor_ptr->dun_level = 0;
-               p_ptr->current_floor_ptr->inside_quest = 0;
-               p_ptr->current_floor_ptr->inside_arena = FALSE;
-               p_ptr->phase_out = FALSE;
+               floor_ptr->dun_level = 0;
+               floor_ptr->inside_quest = 0;
+               floor_ptr->inside_arena = FALSE;
+               player_ptr->phase_out = FALSE;
 
                write_level = TRUE;
 
@@ -5405,39 +5403,39 @@ void play_game(bool new_game)
                current_world_ptr->seed_town = randint0(0x10000000);
 
                /* Roll up a new character */
-               player_birth(p_ptr);
+               player_birth(player_ptr);
 
-               counts_write(2,0);
-               p_ptr->count = 0;
+               counts_write(player_ptr, 2, 0);
+               player_ptr->count = 0;
 
                load = FALSE;
 
                determine_bounty_uniques();
-               determine_today_mon(FALSE);
+               determine_daily_bounty(player_ptr, FALSE);
 
                /* Initialize object array */
-               wipe_o_list(p_ptr->current_floor_ptr);
+               wipe_o_list(floor_ptr);
        }
        else
        {
                write_level = FALSE;
 
-               exe_write_diary(p_ptr, NIKKI_GAMESTART, 1, 
-                                         _("                            ----ゲーム再開----",
-                                               "                            ---- Restart Game ----"));
+               exe_write_diary(player_ptr, DIARY_GAMESTART, 1,
+                       _("                            ----ゲーム再開----",
+                               "                            ---- Restart Game ----"));
 
-/*
* 1.0.9 以前はセーブ前に p_ptr->riding = -1 としていたので、再設定が必要だった。
- * もう不要だが、以前のセーブファイルとの互換のために残しておく。
- */
-               if (p_ptr->riding == -1)
+               /*
               * 1.0.9 以前はセーブ前に player_ptr->riding = -1 としていたので、再設定が必要だった。
               * もう不要だが、以前のセーブファイルとの互換のために残しておく。
               */
+               if (player_ptr->riding == -1)
                {
-                       p_ptr->riding = 0;
-                       for (i = p_ptr->current_floor_ptr->m_max; i > 0; i--)
+                       player_ptr->riding = 0;
+                       for (i = floor_ptr->m_max; i > 0; i--)
                        {
-                               if (player_bold(p_ptr, p_ptr->current_floor_ptr->m_list[i].fy, p_ptr->current_floor_ptr->m_list[i].fx))
+                               if (player_bold(player_ptr, floor_ptr->m_list[i].fy, floor_ptr->m_list[i].fx))
                                {
-                                       p_ptr->riding = i;
+                                       player_ptr->riding = i;
                                        break;
                                }
                        }
@@ -5446,24 +5444,24 @@ void play_game(bool new_game)
 
        current_world_ptr->creating_savefile = FALSE;
 
-       p_ptr->teleport_town = FALSE;
-       p_ptr->sutemi = FALSE;
+       player_ptr->teleport_town = FALSE;
+       player_ptr->sutemi = FALSE;
        current_world_ptr->timewalk_m_idx = 0;
-       p_ptr->now_damaged = FALSE;
+       player_ptr->now_damaged = FALSE;
        now_message = 0;
        current_world_ptr->start_time = time(NULL) - 1;
        record_o_name[0] = '\0';
 
        /* Reset map panel */
-       panel_row_min = p_ptr->current_floor_ptr->height;
-       panel_col_min = p_ptr->current_floor_ptr->width;
+       panel_row_min = floor_ptr->height;
+       panel_col_min = floor_ptr->width;
 
        /* Sexy gal gets bonus to maximum weapon skill of whip */
-       if (p_ptr->pseikaku == SEIKAKU_SEXY)
-               s_info[p_ptr->pclass].w_max[TV_HAFTED-TV_WEAPON_BEGIN][SV_WHIP] = WEAPON_EXP_MASTER;
+       if (player_ptr->pseikaku == SEIKAKU_SEXY)
+               s_info[player_ptr->pclass].w_max[TV_HAFTED - TV_WEAPON_BEGIN][SV_WHIP] = WEAPON_EXP_MASTER;
 
        /* Fill the arrays of floors and walls in the good proportions */
-       set_floor_and_wall(p_ptr->dungeon_idx);
+       set_floor_and_wall(player_ptr->dungeon_idx);
 
        /* Flavor the objects */
        flavor_init();
@@ -5478,121 +5476,118 @@ void play_game(bool new_game)
        /* Hack -- Enter wizard mode */
        if (arg_wizard)
        {
-               if (enter_wizard_mode())
+               if (enter_wizard_mode(player_ptr))
                {
                        current_world_ptr->wizard = TRUE;
 
-                       if (p_ptr->is_dead || !p_ptr->y || !p_ptr->x)
+                       if (player_ptr->is_dead || !player_ptr->y || !player_ptr->x)
                        {
                                /* Initialize the saved floors data */
-                               init_saved_floors(TRUE);
+                               init_saved_floors(player_ptr, TRUE);
 
                                /* Avoid crash */
-                               p_ptr->current_floor_ptr->inside_quest = 0;
+                               floor_ptr->inside_quest = 0;
 
                                /* Avoid crash in update_view() */
-                               p_ptr->y = p_ptr->x = 10;
+                               player_ptr->y = player_ptr->x = 10;
                        }
                }
-               else if (p_ptr->is_dead)
+               else if (player_ptr->is_dead)
                {
                        quit("Already dead.");
                }
        }
 
        /* Initialize the town-buildings if necessary */
-       if (!p_ptr->current_floor_ptr->dun_level && !p_ptr->current_floor_ptr->inside_quest)
+       if (!floor_ptr->dun_level && !floor_ptr->inside_quest)
        {
-               process_dungeon_file("w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x);
+               process_dungeon_file(player_ptr, "w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x);
                init_flags = INIT_ONLY_BUILDINGS;
-               process_dungeon_file("t_info.txt", 0, 0, MAX_HGT, MAX_WID);
-               select_floor_music(p_ptr);
+               process_dungeon_file(player_ptr, "t_info.txt", 0, 0, MAX_HGT, MAX_WID);
+               select_floor_music(player_ptr);
        }
 
        /* Generate a dungeon level if needed */
        if (!current_world_ptr->character_dungeon)
        {
-               change_floor(p_ptr);
+               change_floor(player_ptr);
        }
        else
        {
                /* HACK -- Restore from panic-save */
-               if (p_ptr->panic_save)
+               if (player_ptr->panic_save)
                {
                        /* No player?  -- Try to regenerate floor */
-                       if (!p_ptr->y || !p_ptr->x)
+                       if (!player_ptr->y || !player_ptr->x)
                        {
                                msg_print(_("プレイヤーの位置がおかしい。フロアを再生成します。", "What a strange player location.  Regenerate the dungeon floor."));
-                               change_floor(p_ptr);
+                               change_floor(player_ptr);
                        }
 
                        /* Still no player?  -- Try to locate random place */
-                       if (!p_ptr->y || !p_ptr->x) p_ptr->y = p_ptr->x = 10;
+                       if (!player_ptr->y || !player_ptr->x) player_ptr->y = player_ptr->x = 10;
 
                        /* No longer in panic */
-                       p_ptr->panic_save = 0;
+                       player_ptr->panic_save = 0;
                }
        }
 
        /* Character is now "complete" */
        current_world_ptr->character_generated = TRUE;
 
-
        /* Hack -- Character is no longer "icky" */
        current_world_ptr->character_icky = FALSE;
 
-
        if (new_game)
        {
                char buf[80];
-               sprintf(buf, _("%sに降り立った。", "You are standing in the %s."), map_name());
-               exe_write_diary(p_ptr, NIKKI_BUNSHOU, 0, buf);
+               sprintf(buf, _("%sに降り立った。", "You are standing in the %s."), map_name(player_ptr));
+               exe_write_diary(player_ptr, DIARY_DESCRIPTION, 0, buf);
        }
 
-
        /* Start game */
-       p_ptr->playing = TRUE;
+       player_ptr->playing = TRUE;
 
        /* Reset the visual mappings */
-       reset_visuals();
+       reset_visuals(player_ptr);
 
        /* Load the "pref" files */
-       load_all_pref_files();
+       load_all_pref_files(player_ptr);
 
        /* Give startup outfit (after loading pref files) */
        if (new_game)
        {
-               player_outfit(p_ptr);
+               player_outfit(player_ptr);
        }
 
        /* React to changes */
        Term_xtra(TERM_XTRA_REACT, 0);
 
-       p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
-       p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
-       handle_stuff();
+       player_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
+       player_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
+       handle_stuff(player_ptr);
 
        /* Set or clear "rogue_like_commands" if requested */
        if (arg_force_original) rogue_like_commands = FALSE;
        if (arg_force_roguelike) rogue_like_commands = TRUE;
 
        /* Hack -- Enforce "delayed death" */
-       if (p_ptr->chp < 0) p_ptr->is_dead = TRUE;
+       if (player_ptr->chp < 0) player_ptr->is_dead = TRUE;
 
-       if (p_ptr->prace == RACE_ANDROID) calc_android_exp(p_ptr);
+       if (player_ptr->prace == RACE_ANDROID) calc_android_exp(player_ptr);
 
-       if (new_game && ((p_ptr->pclass == CLASS_CAVALRY) || (p_ptr->pclass == CLASS_BEASTMASTER)))
+       if (new_game && ((player_ptr->pclass == CLASS_CAVALRY) || (player_ptr->pclass == CLASS_BEASTMASTER)))
        {
                monster_type *m_ptr;
-               MONRACE_IDX pet_r_idx = ((p_ptr->pclass == CLASS_CAVALRY) ? MON_HORSE : MON_YASE_HORSE);
+               MONRACE_IDX pet_r_idx = ((player_ptr->pclass == CLASS_CAVALRY) ? MON_HORSE : MON_YASE_HORSE);
                monster_race *r_ptr = &r_info[pet_r_idx];
-               place_monster_aux(0, p_ptr->y, p_ptr->x - 1, pet_r_idx,
-                                 (PM_FORCE_PET | PM_NO_KAGE));
-               m_ptr = &p_ptr->current_floor_ptr->m_list[hack_m_idx_ii];
+               place_monster_aux(player_ptr, 0, player_ptr->y, player_ptr->x - 1, pet_r_idx,
+                       (PM_FORCE_PET | PM_NO_KAGE));
+               m_ptr = &floor_ptr->m_list[hack_m_idx_ii];
                m_ptr->mspeed = r_ptr->speed;
-               m_ptr->maxhp = r_ptr->hdice*(r_ptr->hside+1)/2;
+               m_ptr->maxhp = r_ptr->hdice*(r_ptr->hside + 1) / 2;
                m_ptr->max_maxhp = m_ptr->maxhp;
-               m_ptr->hp = r_ptr->hdice*(r_ptr->hside+1)/2;
+               m_ptr->hp = r_ptr->hdice*(r_ptr->hside + 1) / 2;
                m_ptr->dealt_damage = 0;
                m_ptr->energy_need = ENERGY_NEED() + ENERGY_NEED();
        }
@@ -5600,37 +5595,35 @@ void play_game(bool new_game)
        (void)combine_and_reorder_home(STORE_HOME);
        (void)combine_and_reorder_home(STORE_MUSEUM);
 
-       select_floor_music(p_ptr);
+       select_floor_music(player_ptr);
 
        /* Process */
        while (TRUE)
        {
                /* Process the level */
-               dungeon(load_game);
+               dungeon(player_ptr, load_game);
 
                /* Hack -- prevent "icky" message */
                current_world_ptr->character_xtra = TRUE;
 
-               handle_stuff();
+               handle_stuff(player_ptr);
 
                current_world_ptr->character_xtra = FALSE;
 
                /* Cancel the target */
                target_who = 0;
 
-               /* Cancel the health bar */
-               health_track(0);
+               health_track(player_ptr, 0);
 
-               forget_lite(p_ptr->current_floor_ptr);
-               forget_view(p_ptr->current_floor_ptr);
-               clear_mon_lite(p_ptr->current_floor_ptr);
+               forget_lite(floor_ptr);
+               forget_view(floor_ptr);
+               clear_mon_lite(floor_ptr);
 
                /* Handle "quit and save" */
-               if (!p_ptr->playing && !p_ptr->is_dead) break;
+               if (!player_ptr->playing && !player_ptr->is_dead) break;
 
-               /* Erase the old p_ptr->current_floor_ptr->grid_array */
-               wipe_o_list(p_ptr->current_floor_ptr);
-               if (!p_ptr->is_dead) wipe_m_list();
+               wipe_o_list(floor_ptr);
+               if (!player_ptr->is_dead) wipe_m_list();
 
 
                msg_print(NULL);
@@ -5638,46 +5631,46 @@ void play_game(bool new_game)
                load_game = FALSE;
 
                /* Accidental Death */
-               if (p_ptr->playing && p_ptr->is_dead)
+               if (player_ptr->playing && player_ptr->is_dead)
                {
-                       if (p_ptr->current_floor_ptr->inside_arena)
+                       if (floor_ptr->inside_arena)
                        {
-                               p_ptr->current_floor_ptr->inside_arena = FALSE;
-                               if (p_ptr->arena_number > MAX_ARENA_MONS)
-                                       p_ptr->arena_number++;
+                               floor_ptr->inside_arena = FALSE;
+                               if (player_ptr->arena_number > MAX_ARENA_MONS)
+                                       player_ptr->arena_number++;
                                else
-                                       p_ptr->arena_number = -1 - p_ptr->arena_number;
-                               p_ptr->is_dead = FALSE;
-                               p_ptr->chp = 0;
-                               p_ptr->chp_frac = 0;
-                               p_ptr->exit_bldg = TRUE;
-                               reset_tim_flags(p_ptr);
+                                       player_ptr->arena_number = -1 - player_ptr->arena_number;
+                               player_ptr->is_dead = FALSE;
+                               player_ptr->chp = 0;
+                               player_ptr->chp_frac = 0;
+                               player_ptr->exit_bldg = TRUE;
+                               reset_tim_flags(player_ptr);
 
                                /* Leave through the exit */
-                               prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_RAND_CONNECT);
+                               prepare_change_floor_mode(player_ptr, CFM_SAVE_FLOORS | CFM_RAND_CONNECT);
 
                                /* prepare next floor */
-                               leave_floor(p_ptr);
+                               leave_floor(player_ptr);
                        }
                        else
                        {
                                /* Mega-Hack -- Allow player to cheat death */
                                if ((current_world_ptr->wizard || cheat_live) && !get_check(_("死にますか? ", "Die? ")))
                                {
-                                       cheat_death(p_ptr);
+                                       cheat_death(player_ptr);
                                }
                        }
                }
 
                /* Handle "death" */
-               if (p_ptr->is_dead) break;
+               if (player_ptr->is_dead) break;
 
                /* Make a new level */
-               change_floor(p_ptr);
+               change_floor(player_ptr);
        }
 
        /* Close stuff */
-       close_game();
+       close_game(player_ptr);
 
        /* Quit */
        quit(NULL);
@@ -5689,9 +5682,9 @@ void play_game(bool new_game)
  * @details アンデッド種族は18:00からゲームを開始するので、この修正を予め行う。
  * @return 修正をかけた後のゲームターン
  */
-s32b turn_real(s32b hoge)
+s32b turn_real(player_type *player_ptr, s32b hoge)
 {
-       switch (p_ptr->start_race)
+       switch (player_ptr->start_race)
        {
        case RACE_VAMPIRE:
        case RACE_SKELETON:
@@ -5703,12 +5696,14 @@ s32b turn_real(s32b hoge)
        }
 }
 
+
 /*!
  * @brief ターンのオーバーフローに対する対処
+ * @param player_ptr プレーヤーへの参照ポインタ
  * @details ターン及びターンを記録する変数をターンの限界の1日前まで巻き戻す.
  * @return 修正をかけた後のゲームターン
  */
-void prevent_turn_overflow(void)
+void prevent_turn_overflow(player_type *player_ptr)
 {
        int rollback_days, i, j;
        s32b rollback_turns;
@@ -5720,12 +5715,13 @@ void prevent_turn_overflow(void)
 
        if (current_world_ptr->game_turn > rollback_turns) current_world_ptr->game_turn -= rollback_turns;
        else current_world_ptr->game_turn = 1;
-       if (p_ptr->current_floor_ptr->generated_turn > rollback_turns) p_ptr->current_floor_ptr->generated_turn -= rollback_turns;
-       else p_ptr->current_floor_ptr->generated_turn = 1;
+       floor_type *floor_ptr = player_ptr->current_floor_ptr;
+       if (floor_ptr->generated_turn > rollback_turns) floor_ptr->generated_turn -= rollback_turns;
+       else floor_ptr->generated_turn = 1;
        if (current_world_ptr->arena_start_turn > rollback_turns) current_world_ptr->arena_start_turn -= rollback_turns;
        else current_world_ptr->arena_start_turn = 1;
-       if (p_ptr->feeling_turn > rollback_turns) p_ptr->feeling_turn -= rollback_turns;
-       else p_ptr->feeling_turn = 1;
+       if (player_ptr->feeling_turn > rollback_turns) player_ptr->feeling_turn -= rollback_turns;
+       else player_ptr->feeling_turn = 1;
 
        for (i = 1; i < max_towns; i++)
        {
@@ -5748,22 +5744,24 @@ void prevent_turn_overflow(void)
        }
 }
 
+
 /*!
  * @brief ゲーム終了処理 /
  * Close up the current game (player may or may not be dead)
+ * @param creature_ptr プレーヤーへの参照ポインタ
  * @return なし
  * @details
  * <pre>
  * This function is called only from "main.c" and "signals.c".
  * </pre>
  */
-void close_game(void)
+void close_game(player_type *player_ptr)
 {
        char buf[1024];
        bool do_send = TRUE;
 
        /*      concptr p = "[i:キャラクタの情報, f:ファイル書き出し, t:スコア, x:*鑑定*, ESC:ゲーム終了]"; */
-       handle_stuff();
+       handle_stuff(player_ptr);
 
        /* Flush the messages */
        msg_print(NULL);
@@ -5791,64 +5789,60 @@ void close_game(void)
        safe_setuid_drop();
 
        /* Handle death */
-       if (p_ptr->is_dead)
+       if (player_ptr->is_dead)
        {
                /* Handle retirement */
-               if (p_ptr->total_winner) kingly(p_ptr);
+               if (current_world_ptr->total_winner) kingly(player_ptr);
 
                /* Save memories */
                if (!cheat_save || get_check(_("死んだデータをセーブしますか? ", "Save death? ")))
                {
-                       if (!save_player()) msg_print(_("セーブ失敗!", "death save failed!"));
+                       if (!save_player(player_ptr)) msg_print(_("セーブ失敗!", "death save failed!"));
                }
                else do_send = FALSE;
 
                /* You are dead */
-               print_tomb();
+               print_tomb(player_ptr);
 
                flush();
 
                /* Show more info */
-               show_info();
+               show_info(player_ptr);
                Term_clear();
 
-               if (check_score())
+               if (check_score(player_ptr))
                {
-                       if ((!send_world_score(do_send)))
+                       if ((!send_world_score(player_ptr, do_send)))
                        {
                                if (get_check_strict(_("後でスコアを登録するために待機しますか?", "Stand by for later score registration? "),
                                        (CHECK_NO_ESCAPE | CHECK_NO_HISTORY)))
                                {
-                                       p_ptr->wait_report_score = TRUE;
-                                       p_ptr->is_dead = FALSE;
-                                       if (!save_player()) msg_print(_("セーブ失敗!", "death save failed!"));
+                                       player_ptr->wait_report_score = TRUE;
+                                       player_ptr->is_dead = FALSE;
+                                       if (!save_player(player_ptr)) msg_print(_("セーブ失敗!", "death save failed!"));
                                }
                        }
-                       if (!p_ptr->wait_report_score)
-                               (void)top_twenty(p_ptr);
+                       if (!player_ptr->wait_report_score)
+                               (void)top_twenty(player_ptr);
                }
                else if (highscore_fd >= 0)
                {
                        display_scores_aux(0, 10, -1, NULL);
                }
-#if 0
-               /* Dump bones file */
-               make_bones();
-#endif
        }
 
        /* Still alive */
        else
        {
                /* Save the game */
-               do_cmd_save_game(FALSE);
+               do_cmd_save_game(player_ptr, FALSE);
 
                /* Prompt for scores */
                prt(_("リターンキーか ESC キーを押して下さい。", "Press Return (or Escape)."), 0, 40);
                play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_EXIT);
 
                /* Predict score (or ESCAPE) */
-               if (inkey() != ESCAPE) predict_score(p_ptr);
+               if (inkey() != ESCAPE) predict_score(player_ptr);
        }
 
 
@@ -5858,8 +5852,8 @@ void close_game(void)
        /* Forget the high score fd */
        highscore_fd = -1;
 
-       /* Kill all temporal files */
-       clear_saved_floor_files();
+       /* Kill all temporary files */
+       clear_saved_floor_files(player_ptr);
 
        /* Allow suspending now */
        signals_handle_tstp();
@@ -5868,19 +5862,19 @@ void close_game(void)
 
 /*!
  * @brief 全更新処理をチェックして処理していく
- * Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window"
+ * Handle "player_ptr->update" and "player_ptr->redraw" and "player_ptr->window"
  * @return なし
  */
-void handle_stuff(void)
+void handle_stuff(player_type *player_ptr)
 {
-       if (p_ptr->update) update_creature(p_ptr);
-       if (p_ptr->redraw) redraw_stuff();
-       if (p_ptr->window) window_stuff();
+       if (player_ptr->update) update_creature(player_ptr);
+       if (player_ptr->redraw) redraw_stuff(player_ptr);
+       if (player_ptr->window) window_stuff(player_ptr);
 }
 
-void update_output(void)
+
+void update_output(player_type *player_ptr)
 {
-       if (p_ptr->redraw) redraw_stuff();
-       if (p_ptr->window) window_stuff();
+       if (player_ptr->redraw) redraw_stuff(player_ptr);
+       if (player_ptr->window) window_stuff(player_ptr);
 }
-