OSDN Git Service

[Refactor] #38997 forget_lite() に floor_type * 引数を追加. / Add floor_type * argument...
[hengband/hengband.git] / src / core.c
index a57cf82..3407328 100644 (file)
@@ -263,10 +263,10 @@ static void sense_inventory_aux(INVENTORY_IDX slot, bool heavy)
  *   Class 4 = Ranger  --> slow but heavy  (changed!)\n
  *   Class 5 = Paladin --> slow but heavy\n
  */
-static void sense_inventory1(void)
+static void sense_inventory1(player_type *creature_ptr)
 {
        INVENTORY_IDX i;
-       PLAYER_LEVEL plev = p_ptr->lev;
+       PLAYER_LEVEL plev = creature_ptr->lev;
        bool heavy = FALSE;
        object_type *o_ptr;
 
@@ -274,10 +274,10 @@ static void sense_inventory1(void)
        /*** Check for "sensing" ***/
 
        /* No sensing when confused */
-       if (p_ptr->confused) return;
+       if (creature_ptr->confused) return;
 
        /* Analyze the class */
-       switch (p_ptr->pclass)
+       switch (creature_ptr->pclass)
        {
                case CLASS_WARRIOR:
                case CLASS_ARCHER:
@@ -426,7 +426,7 @@ static void sense_inventory1(void)
                }
        }
 
-       if (compare_virtue(p_ptr, V_KNOWLEDGE, 100, VIRTUE_LARGE)) heavy = TRUE;
+       if (compare_virtue(creature_ptr, V_KNOWLEDGE, 100, VIRTUE_LARGE)) heavy = TRUE;
 
        /*** Sense everything ***/
 
@@ -435,7 +435,7 @@ static void sense_inventory1(void)
        {
                bool okay = FALSE;
 
-               o_ptr = &p_ptr->inventory_list[i];
+               o_ptr = &creature_ptr->inventory_list[i];
 
                /* Skip empty slots */
                if (!o_ptr->k_idx) continue;
@@ -470,11 +470,11 @@ static void sense_inventory1(void)
                /* Skip non-sense machines */
                if (!okay) continue;
 
-               /* Occasional failure on p_ptr->inventory_list items */
+               /* Occasional failure on creature_ptr->inventory_list items */
                if ((i < INVEN_RARM) && (0 != randint0(5))) continue;
 
                /* Good luck */
-               if ((p_ptr->muta3 & MUT3_GOOD_LUCK) && !randint0(13))
+               if ((creature_ptr->muta3 & MUT3_GOOD_LUCK) && !randint0(13))
                {
                        heavy = TRUE;
                }
@@ -487,20 +487,20 @@ static void sense_inventory1(void)
  * @brief 1プレイヤーターン毎に武器、防具以外の擬似鑑定が行われるかを判定する。
  * @return なし
  */
-static void sense_inventory2(void)
+static void sense_inventory2(player_type *creature_ptr)
 {
        INVENTORY_IDX i;
-       PLAYER_LEVEL plev = p_ptr->lev;
+       PLAYER_LEVEL plev = creature_ptr->lev;
        object_type *o_ptr;
 
 
        /*** Check for "sensing" ***/
 
        /* No sensing when confused */
-       if (p_ptr->confused) return;
+       if (creature_ptr->confused) return;
 
        /* Analyze the class */
-       switch (p_ptr->pclass)
+       switch (creature_ptr->pclass)
        {
                case CLASS_WARRIOR:
                case CLASS_ARCHER:
@@ -577,7 +577,7 @@ static void sense_inventory2(void)
        {
                bool okay = FALSE;
 
-               o_ptr = &p_ptr->inventory_list[i];
+               o_ptr = &creature_ptr->inventory_list[i];
 
                /* Skip empty slots */
                if (!o_ptr->k_idx) continue;
@@ -598,7 +598,7 @@ static void sense_inventory2(void)
                /* Skip non-sense machines */
                if (!okay) continue;
 
-               /* Occasional failure on p_ptr->inventory_list items */
+               /* Occasional failure on creature_ptr->inventory_list items */
                if ((i < INVEN_RARM) && (0 != randint0(5))) continue;
 
                sense_inventory_aux(i, TRUE);
@@ -689,29 +689,29 @@ static void pattern_teleport(void)
  * @brief 各種パターン地形上の特別な処理 / Returns TRUE if we are on the Pattern...
  * @return 実際にパターン地形上にプレイヤーが居た場合はTRUEを返す。
  */
-static bool pattern_effect(void)
+static bool pattern_effect(player_type *creature_ptr)
 {
        int pattern_type;
 
-       if (!pattern_tile(p_ptr->y, p_ptr->x)) return FALSE;
+       if (!pattern_tile(creature_ptr->y, creature_ptr->x)) return FALSE;
 
-       if ((PRACE_IS_(p_ptr, RACE_AMBERITE)) &&
-           (p_ptr->cut > 0) && one_in_(10))
+       if ((PRACE_IS_(creature_ptr, RACE_AMBERITE)) &&
+           (creature_ptr->cut > 0) && one_in_(10))
        {
-               wreck_the_pattern(p_ptr);
+               wreck_the_pattern(creature_ptr);
        }
 
-       pattern_type = f_info[current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].feat].subtype;
+       pattern_type = f_info[current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat].subtype;
 
        switch (pattern_type)
        {
        case PATTERN_TILE_END:
-               (void)set_image(p_ptr, 0);
+               (void)set_image(creature_ptr, 0);
                (void)restore_all_status();
-               (void)restore_level(p_ptr);
-               (void)cure_critical_wounds(1000);
+               (void)restore_level(creature_ptr);
+               (void)cure_critical_wounds(creature_ptr, 1000);
 
-               cave_set_feat(p_ptr->y, p_ptr->x, feat_pattern_old);
+               cave_set_feat(creature_ptr->y, creature_ptr->x, feat_pattern_old);
                msg_print(_("「パターン」のこの部分は他の部分より強力でないようだ。", "This section of the Pattern looks less powerful."));
 
                /*
@@ -732,14 +732,14 @@ static bool pattern_effect(void)
 
        case PATTERN_TILE_WRECKED:
                if (!IS_INVULN())
-                       take_hit(p_ptr, DAMAGE_NOESCAPE, 200, _("壊れた「パターン」を歩いたダメージ", "walking the corrupted Pattern"), -1);
+                       take_hit(creature_ptr, DAMAGE_NOESCAPE, 200, _("壊れた「パターン」を歩いたダメージ", "walking the corrupted Pattern"), -1);
                break;
 
        default:
-               if (PRACE_IS_(p_ptr, RACE_AMBERITE) && !one_in_(2))
+               if (PRACE_IS_(creature_ptr, RACE_AMBERITE) && !one_in_(2))
                        return TRUE;
                else if (!IS_INVULN())
-                       take_hit(p_ptr, DAMAGE_NOESCAPE, damroll(1, 3), _("「パターン」を歩いたダメージ", "walking the Pattern"), -1);
+                       take_hit(creature_ptr, DAMAGE_NOESCAPE, damroll(1, 3), _("「パターン」を歩いたダメージ", "walking the Pattern"), -1);
                break;
        }
 
@@ -802,32 +802,32 @@ static void regenhp(int percent)
  * @param regen_amount 回復量
  * @return なし
  */
-static void regenmana(MANA_POINT upkeep_factor, MANA_POINT regen_amount)
+static void regenmana(player_type *creature_ptr, MANA_POINT upkeep_factor, MANA_POINT regen_amount)
 {
-       MANA_POINT old_csp = p_ptr->csp;
+       MANA_POINT old_csp = creature_ptr->csp;
        s32b regen_rate = regen_amount * 100 - upkeep_factor * PY_REGEN_NORMAL;
 
        /*
         * Excess mana will decay 32 times faster than normal
         * regeneration rate.
         */
-       if (p_ptr->csp > p_ptr->msp)
+       if (creature_ptr->csp > creature_ptr->msp)
        {
                /* PY_REGEN_NORMAL is the Regen factor in unit (1/2^16) */
                s32b decay = 0;
-               u32b decay_frac = (p_ptr->msp * 32 * PY_REGEN_NORMAL + PY_REGEN_MNBASE);
+               u32b decay_frac = (creature_ptr->msp * 32 * PY_REGEN_NORMAL + PY_REGEN_MNBASE);
 
                /* Convert the unit (1/2^16) to (1/2^32) */
                s64b_LSHIFT(decay, decay_frac, 16);
 
                /* Decay */
-               s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), decay, decay_frac);
+               s64b_sub(&(creature_ptr->csp), &(creature_ptr->csp_frac), decay, decay_frac);
 
                /* Stop decaying */
-               if (p_ptr->csp < p_ptr->msp)
+               if (creature_ptr->csp < creature_ptr->msp)
                {
-                       p_ptr->csp = p_ptr->msp;
-                       p_ptr->csp_frac = 0;
+                       creature_ptr->csp = creature_ptr->msp;
+                       creature_ptr->csp_frac = 0;
                }
        }
 
@@ -836,19 +836,19 @@ static void regenmana(MANA_POINT upkeep_factor, MANA_POINT regen_amount)
        {
                /* (percent/100) is the Regen factor in unit (1/2^16) */
                MANA_POINT new_mana = 0;
-               u32b new_mana_frac = (p_ptr->msp * regen_rate / 100 + PY_REGEN_MNBASE);
+               u32b new_mana_frac = (creature_ptr->msp * regen_rate / 100 + PY_REGEN_MNBASE);
 
                /* Convert the unit (1/2^16) to (1/2^32) */
                s64b_LSHIFT(new_mana, new_mana_frac, 16);
 
                /* Regenerate */
-               s64b_add(&(p_ptr->csp), &(p_ptr->csp_frac), new_mana, new_mana_frac);
+               s64b_add(&(creature_ptr->csp), &(creature_ptr->csp_frac), new_mana, new_mana_frac);
 
                /* Must set frac to zero even if equal */
-               if (p_ptr->csp >= p_ptr->msp)
+               if (creature_ptr->csp >= creature_ptr->msp)
                {
-                       p_ptr->csp = p_ptr->msp;
-                       p_ptr->csp_frac = 0;
+                       creature_ptr->csp = creature_ptr->msp;
+                       creature_ptr->csp_frac = 0;
                }
        }
 
@@ -858,27 +858,27 @@ static void regenmana(MANA_POINT upkeep_factor, MANA_POINT regen_amount)
        {
                /* PY_REGEN_NORMAL is the Regen factor in unit (1/2^16) */
                s32b reduce_mana = 0;
-               u32b reduce_mana_frac = (p_ptr->msp * (-1) * regen_rate / 100 + PY_REGEN_MNBASE);
+               u32b reduce_mana_frac = (creature_ptr->msp * (-1) * regen_rate / 100 + PY_REGEN_MNBASE);
 
                /* Convert the unit (1/2^16) to (1/2^32) */
                s64b_LSHIFT(reduce_mana, reduce_mana_frac, 16);
 
                /* Reduce mana */
-               s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), reduce_mana, reduce_mana_frac);
+               s64b_sub(&(creature_ptr->csp), &(creature_ptr->csp_frac), reduce_mana, reduce_mana_frac);
 
                /* Check overflow */
-               if (p_ptr->csp < 0)
+               if (creature_ptr->csp < 0)
                {
-                       p_ptr->csp = 0;
-                       p_ptr->csp_frac = 0;
+                       creature_ptr->csp = 0;
+                       creature_ptr->csp_frac = 0;
                }
        }
 
-       if (old_csp != p_ptr->csp)
+       if (old_csp != creature_ptr->csp)
        {
-               p_ptr->redraw |= (PR_MANA);
-               p_ptr->window |= (PW_PLAYER);
-               p_ptr->window |= (PW_SPELL);
+               creature_ptr->redraw |= (PR_MANA);
+               creature_ptr->window |= (PW_PLAYER);
+               creature_ptr->window |= (PW_SPELL);
                wild_regen = 20;
        }
 }
@@ -888,41 +888,41 @@ static void regenmana(MANA_POINT upkeep_factor, MANA_POINT regen_amount)
  * @param regen_amount 回復量
  * @return なし
  */
-static void regenmagic(int regen_amount)
+static void regenmagic(player_type *creature_ptr, int regen_amount)
 {
        MANA_POINT new_mana;
        int i;
        int dev = 30;
-       int mult = (dev + adj_mag_mana[p_ptr->stat_ind[A_INT]]); /* x1 to x2 speed bonus for recharging */
+       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++)
        {
-               if (!p_ptr->magic_num2[i]) continue;
-               if (p_ptr->magic_num1[i] == ((long)p_ptr->magic_num2[i] << 16)) continue;
+               if (!creature_ptr->magic_num2[i]) continue;
+               if (creature_ptr->magic_num1[i] == ((long)creature_ptr->magic_num2[i] << 16)) continue;
 
                /* Increase remaining charge number like float value */
-               new_mana = (regen_amount * mult * ((long)p_ptr->magic_num2[i] + 13)) / (dev * 8);
-               p_ptr->magic_num1[i] += new_mana;
+               new_mana = (regen_amount * mult * ((long)creature_ptr->magic_num2[i] + 13)) / (dev * 8);
+               creature_ptr->magic_num1[i] += new_mana;
 
                /* Check maximum charge */
-               if (p_ptr->magic_num1[i] > (p_ptr->magic_num2[i] << 16))
+               if (creature_ptr->magic_num1[i] > (creature_ptr->magic_num2[i] << 16))
                {
-                       p_ptr->magic_num1[i] = ((long)p_ptr->magic_num2[i] << 16);
+                       creature_ptr->magic_num1[i] = ((long)creature_ptr->magic_num2[i] << 16);
                }
                wild_regen = 20;
        }
        for (i = EATER_EXT*2; i < EATER_EXT*3; i++)
        {
-               if (!p_ptr->magic_num1[i]) continue;
-               if (!p_ptr->magic_num2[i]) continue;
+               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)p_ptr->magic_num2[i] + 10) * EATER_ROD_CHARGE) 
+               new_mana = (regen_amount * mult * ((long)creature_ptr->magic_num2[i] + 10) * EATER_ROD_CHARGE) 
                                        / (dev * 16 * PY_REGEN_NORMAL); 
-               p_ptr->magic_num1[i] -= new_mana;
+               creature_ptr->magic_num1[i] -= new_mana;
 
                /* Check minimum remaining period for charging */
-               if (p_ptr->magic_num1[i] < 0) p_ptr->magic_num1[i] = 0;
+               if (creature_ptr->magic_num1[i] < 0) creature_ptr->magic_num1[i] = 0;
                wild_regen = 20;
        }
 }
@@ -1032,16 +1032,16 @@ static void regen_captured_monsters(void)
  * @param o_ptr 現在光源として使っているオブジェクトの構造体参照ポインタ
  * @return なし
  */
-static void notice_lite_change(object_type *o_ptr)
+static void notice_lite_change(player_type *creature_ptr, object_type *o_ptr)
 {
        /* Hack -- notice interesting fuel steps */
        if ((o_ptr->xtra4 < 100) || (!(o_ptr->xtra4 % 100)))
        {
-               p_ptr->window |= (PW_EQUIP);
+               creature_ptr->window |= (PW_EQUIP);
        }
 
        /* Hack -- Special treatment when blind */
-       if (p_ptr->blind)
+       if (creature_ptr->blind)
        {
                /* Hack -- save some light for later */
                if (o_ptr->xtra4 == 0) o_ptr->xtra4++;
@@ -1050,14 +1050,14 @@ static void notice_lite_change(object_type *o_ptr)
        /* The light is now out */
        else if (o_ptr->xtra4 == 0)
        {
-               disturb(p_ptr, FALSE, TRUE);
+               disturb(creature_ptr, FALSE, TRUE);
                msg_print(_("明かりが消えてしまった!", "Your light has gone out!"));
 
                /* Recalculate torch radius */
-               p_ptr->update |= (PU_TORCH);
+               creature_ptr->update |= (PU_TORCH);
 
                /* Some ego light lose its effects without fuel */
-               p_ptr->update |= (PU_BONUS);
+               creature_ptr->update |= (PU_BONUS);
        }
 
        /* The light is getting dim */
@@ -1066,7 +1066,7 @@ static void notice_lite_change(object_type *o_ptr)
                if ((o_ptr->xtra4 < 50) && (!(o_ptr->xtra4 % 5))
                    && (current_world_ptr->game_turn % (TURNS_PER_TICK*2)))
                {
-                       if (disturb_minor) disturb(p_ptr, FALSE, TRUE);
+                       if (disturb_minor) disturb(creature_ptr, FALSE, TRUE);
                        msg_print(_("明かりが微かになってきている。", "Your light is growing faint."));
                }
        }
@@ -1074,7 +1074,7 @@ static void notice_lite_change(object_type *o_ptr)
        /* The light is getting dim */
        else if ((o_ptr->xtra4 < 100) && (!(o_ptr->xtra4 % 10)))
        {
-               if (disturb_minor) disturb(p_ptr, FALSE, TRUE);
+               if (disturb_minor) disturb(creature_ptr, FALSE, TRUE);
                        msg_print(_("明かりが微かになってきている。", "Your light is growing faint."));
        }
 }
@@ -1131,7 +1131,7 @@ static void recharged_notice(object_type *o_ptr)
  * @brief プレイヤーの歌に関する継続処理
  * @return なし
  */
-static void check_music(void)
+static void check_music(player_type *creature_ptr)
 {
        const magic_type *s_ptr;
        int spell;
@@ -1139,16 +1139,16 @@ static void check_music(void)
        u32b need_mana_frac;
 
        /* Music singed by player */
-       if (p_ptr->pclass != CLASS_BARD) return;
-       if (!SINGING_SONG_EFFECT(p_ptr) && !INTERUPTING_SONG_EFFECT(p_ptr)) return;
+       if (creature_ptr->pclass != CLASS_BARD) return;
+       if (!SINGING_SONG_EFFECT(creature_ptr) && !INTERUPTING_SONG_EFFECT(creature_ptr)) return;
 
-       if (p_ptr->anti_magic)
+       if (creature_ptr->anti_magic)
        {
-               stop_singing(p_ptr);
+               stop_singing(creature_ptr);
                return;
        }
 
-       spell = SINGING_SONG_ID(p_ptr);
+       spell = SINGING_SONG_ID(creature_ptr);
        s_ptr = &technic_info[REALM_MUSIC - MIN_TECHNIC][spell];
 
        need_mana = mod_need_mana(s_ptr->smana, spell, REALM_MUSIC);
@@ -1157,38 +1157,38 @@ static void check_music(void)
        /* Divide by 2 */
        s64b_RSHIFT(need_mana, need_mana_frac, 1);
 
-       if (s64b_cmp(p_ptr->csp, p_ptr->csp_frac, need_mana, need_mana_frac) < 0)
+       if (s64b_cmp(creature_ptr->csp, creature_ptr->csp_frac, need_mana, need_mana_frac) < 0)
        {
-               stop_singing(p_ptr);
+               stop_singing(creature_ptr);
                return;
        }
        else
        {
-               s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), need_mana, need_mana_frac);
+               s64b_sub(&(creature_ptr->csp), &(creature_ptr->csp_frac), need_mana, need_mana_frac);
 
-               p_ptr->redraw |= PR_MANA;
-               if (INTERUPTING_SONG_EFFECT(p_ptr))
+               creature_ptr->redraw |= PR_MANA;
+               if (INTERUPTING_SONG_EFFECT(creature_ptr))
                {
-                       SINGING_SONG_EFFECT(p_ptr) = INTERUPTING_SONG_EFFECT(p_ptr);
-                       INTERUPTING_SONG_EFFECT(p_ptr) = MUSIC_NONE;
+                       SINGING_SONG_EFFECT(creature_ptr) = INTERUPTING_SONG_EFFECT(creature_ptr);
+                       INTERUPTING_SONG_EFFECT(creature_ptr) = MUSIC_NONE;
                        msg_print(_("歌を再開した。", "You restart singing."));
-                       p_ptr->action = ACTION_SING;
-                       p_ptr->update |= (PU_BONUS | PU_HP | PU_MONSTERS);
-                       p_ptr->redraw |= (PR_MAP | PR_STATUS | PR_STATE);
-                       p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
+                       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);
                }
        }
-       if (p_ptr->spell_exp[spell] < SPELL_EXP_BEGINNER)
-               p_ptr->spell_exp[spell] += 5;
-       else if(p_ptr->spell_exp[spell] < SPELL_EXP_SKILLED)
-       { if (one_in_(2) && (current_floor_ptr->dun_level > 4) && ((current_floor_ptr->dun_level + 10) > p_ptr->lev)) p_ptr->spell_exp[spell] += 1; }
-       else if(p_ptr->spell_exp[spell] < SPELL_EXP_EXPERT)
-       { if (one_in_(5) && ((current_floor_ptr->dun_level + 5) > p_ptr->lev) && ((current_floor_ptr->dun_level + 5) > s_ptr->slevel)) p_ptr->spell_exp[spell] += 1; }
-       else if(p_ptr->spell_exp[spell] < SPELL_EXP_MASTER)
-       { if (one_in_(5) && ((current_floor_ptr->dun_level + 5) > p_ptr->lev) && (current_floor_ptr->dun_level > s_ptr->slevel)) p_ptr->spell_exp[spell] += 1; }
+       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) && (current_floor_ptr->dun_level > 4) && ((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) && ((current_floor_ptr->dun_level + 5) > creature_ptr->lev) && ((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) && ((current_floor_ptr->dun_level + 5) > creature_ptr->lev) && (current_floor_ptr->dun_level > s_ptr->slevel)) creature_ptr->spell_exp[spell] += 1; }
 
        /* Do any effects of continual song */
-       exe_spell(p_ptr, REALM_MUSIC, spell, SPELL_CONT);
+       exe_spell(creature_ptr, REALM_MUSIC, spell, SPELL_CONT);
 }
 
 /*!
@@ -1264,33 +1264,33 @@ static object_type *choose_cursed_obj_name(BIT_FLAGS flag)
        return (&p_ptr->inventory_list[choices[randint0(number)]]);
 }
 
-static void process_world_aux_digestion(void)
+static void process_world_aux_digestion(player_type *creature_ptr)
 {
-       if (!p_ptr->phase_out)
+       if (!creature_ptr->phase_out)
        {
                /* Digest quickly when gorged */
-               if (p_ptr->food >= PY_FOOD_MAX)
+               if (creature_ptr->food >= PY_FOOD_MAX)
                {
                        /* Digest a lot of food */
-                       (void)set_food(p_ptr, p_ptr->food - 100);
+                       (void)set_food(creature_ptr, creature_ptr->food - 100);
                }
 
                /* Digest normally -- Every 50 game turns */
                else if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * 5)))
                {
                        /* Basic digestion rate based on speed */
-                       int digestion = SPEED_TO_ENERGY(p_ptr->pspeed);
+                       int digestion = SPEED_TO_ENERGY(creature_ptr->pspeed);
 
                        /* Regeneration takes more food */
-                       if (p_ptr->regenerate)
+                       if (creature_ptr->regenerate)
                                digestion += 20;
-                       if (p_ptr->special_defense & (KAMAE_MASK | KATA_MASK))
+                       if (creature_ptr->special_defense & (KAMAE_MASK | KATA_MASK))
                                digestion += 20;
-                       if (p_ptr->cursed & TRC_FAST_DIGEST)
+                       if (creature_ptr->cursed & TRC_FAST_DIGEST)
                                digestion += 30;
 
                        /* Slow digestion takes less food */
-                       if (p_ptr->slow_digest)
+                       if (creature_ptr->slow_digest)
                                digestion -= 5;
 
                        /* Minimal digestion */
@@ -1299,30 +1299,30 @@ static void process_world_aux_digestion(void)
                        if (digestion > 100) digestion = 100;
 
                        /* Digest some food */
-                       (void)set_food(p_ptr, p_ptr->food - digestion);
+                       (void)set_food(creature_ptr, creature_ptr->food - digestion);
                }
 
 
                /* Getting Faint */
-               if ((p_ptr->food < PY_FOOD_FAINT))
+               if ((creature_ptr->food < PY_FOOD_FAINT))
                {
                        /* Faint occasionally */
-                       if (!p_ptr->paralyzed && (randint0(100) < 10))
+                       if (!creature_ptr->paralyzed && (randint0(100) < 10))
                        {
                                msg_print(_("あまりにも空腹で気絶してしまった。", "You faint from the lack of food."));
-                               disturb(p_ptr, TRUE, TRUE);
+                               disturb(creature_ptr, TRUE, TRUE);
 
                                /* Hack -- faint (bypass free action) */
-                               (void)set_paralyzed(p_ptr, p_ptr->paralyzed + 1 + randint0(5));
+                               (void)set_paralyzed(creature_ptr, creature_ptr->paralyzed + 1 + randint0(5));
                        }
 
                        /* Starve to death (slowly) */
-                       if (p_ptr->food < PY_FOOD_STARVE)
+                       if (creature_ptr->food < PY_FOOD_STARVE)
                        {
                                /* Calculate damage */
-                               HIT_POINT dam = (PY_FOOD_STARVE - p_ptr->food) / 10;
+                               HIT_POINT dam = (PY_FOOD_STARVE - creature_ptr->food) / 10;
 
-                               if (!IS_INVULN()) take_hit(p_ptr, DAMAGE_LOSELIFE, dam, _("空腹", "starvation"), -1);
+                               if (!IS_INVULN()) take_hit(creature_ptr, DAMAGE_LOSELIFE, dam, _("空腹", "starvation"), -1);
                        }
                }
        }
@@ -1717,7 +1717,7 @@ static void process_world_aux_hp_and_sp(player_type *creature_ptr)
        }
 
        /* Are we walking the pattern? */
-       if (pattern_effect())
+       if (pattern_effect(creature_ptr))
        {
                cave_no_regen = TRUE;
        }
@@ -1756,13 +1756,13 @@ static void process_world_aux_hp_and_sp(player_type *creature_ptr)
        }
 
        /* Regenerate the mana */
-       regenmana(upkeep_factor, regen_amount);
+       regenmana(creature_ptr, upkeep_factor, regen_amount);
 
 
        /* Recharge magic eater's power */
        if (creature_ptr->pclass == CLASS_MAGIC_EATER)
        {
-               regenmagic(regen_amount);
+               regenmagic(creature_ptr, regen_amount);
        }
 
        if ((creature_ptr->csp == 0) && (creature_ptr->csp_frac == 0))
@@ -2133,7 +2133,7 @@ static void process_world_aux_light(player_type *creature_ptr)
                        else o_ptr->xtra4--;
 
                        /* Notice interesting fuel steps */
-                       notice_lite_change(o_ptr);
+                       notice_lite_change(creature_ptr, o_ptr);
                }
        }
 }
@@ -2352,7 +2352,7 @@ static void process_world_aux_mutation(player_type *creature_ptr)
                                msg_print(_("光源からエネルギーを吸収した!", "You absorb energy from your light!"));
 
                                /* Notice interesting fuel steps */
-                               notice_lite_change(o_ptr);
+                               notice_lite_change(creature_ptr, o_ptr);
                        }
                }
 
@@ -2929,64 +2929,64 @@ static void process_world_aux_recharge(player_type *creature_ptr)
  * / Handle involuntary movement once every 10 game turns
  * @return なし
  */
-static void process_world_aux_movement(void)
+static void process_world_aux_movement(player_type *creature_ptr)
 {
        /* Delayed Word-of-Recall */
-       if (p_ptr->word_recall)
+       if (creature_ptr->word_recall)
        {
                /*
                 * HACK: Autosave BEFORE resetting the recall counter (rr9)
                 * The player is yanked up/down as soon as
                 * he loads the autosaved game.
                 */
-               if (autosave_l && (p_ptr->word_recall == 1) && !p_ptr->phase_out)
+               if (autosave_l && (creature_ptr->word_recall == 1) && !creature_ptr->phase_out)
                        do_cmd_save_game(TRUE);
 
                /* Count down towards recall */
-               p_ptr->word_recall--;
+               creature_ptr->word_recall--;
 
-               p_ptr->redraw |= (PR_STATUS);
+               creature_ptr->redraw |= (PR_STATUS);
 
                /* Activate the recall */
-               if (!p_ptr->word_recall)
+               if (!creature_ptr->word_recall)
                {
                        /* Disturbing! */
-                       disturb(p_ptr, FALSE, TRUE);
+                       disturb(creature_ptr, FALSE, TRUE);
 
                        /* Determine the level */
-                       if (current_floor_ptr->dun_level || p_ptr->inside_quest || p_ptr->enter_dungeon)
+                       if (current_floor_ptr->dun_level || creature_ptr->inside_quest || creature_ptr->enter_dungeon)
                        {
                                msg_print(_("上に引っ張りあげられる感じがする!", "You feel yourself yanked upwards!"));
 
-                               if (p_ptr->dungeon_idx) p_ptr->recall_dungeon = p_ptr->dungeon_idx;
+                               if (creature_ptr->dungeon_idx) creature_ptr->recall_dungeon = creature_ptr->dungeon_idx;
                                if (record_stair)
-                                       exe_write_diary(p_ptr, NIKKI_RECALL, current_floor_ptr->dun_level, NULL);
+                                       exe_write_diary(creature_ptr, NIKKI_RECALL, current_floor_ptr->dun_level, NULL);
 
                                current_floor_ptr->dun_level = 0;
-                               p_ptr->dungeon_idx = 0;
+                               creature_ptr->dungeon_idx = 0;
 
                                leave_quest_check();
                                leave_tower_check();
 
-                               p_ptr->inside_quest = 0;
+                               creature_ptr->inside_quest = 0;
 
-                               p_ptr->leaving = TRUE;
+                               creature_ptr->leaving = TRUE;
                        }
                        else
                        {
                                msg_print(_("下に引きずり降ろされる感じがする!", "You feel yourself yanked downwards!"));
 
-                               p_ptr->dungeon_idx = p_ptr->recall_dungeon;
+                               creature_ptr->dungeon_idx = creature_ptr->recall_dungeon;
 
                                if (record_stair)
-                                       exe_write_diary(p_ptr, NIKKI_RECALL, current_floor_ptr->dun_level, NULL);
+                                       exe_write_diary(creature_ptr, NIKKI_RECALL, current_floor_ptr->dun_level, NULL);
 
                                /* New depth */
-                               current_floor_ptr->dun_level = max_dlv[p_ptr->dungeon_idx];
+                               current_floor_ptr->dun_level = max_dlv[creature_ptr->dungeon_idx];
                                if (current_floor_ptr->dun_level < 1) current_floor_ptr->dun_level = 1;
 
                                /* Nightmare mode makes recall more dangerous */
-                               if (ironman_nightmare && !randint0(666) && (p_ptr->dungeon_idx == DUNGEON_ANGBAND))
+                               if (ironman_nightmare && !randint0(666) && (creature_ptr->dungeon_idx == DUNGEON_ANGBAND))
                                {
                                        if (current_floor_ptr->dun_level < 50)
                                        {
@@ -2998,31 +2998,31 @@ static void process_world_aux_movement(void)
                                        }
                                        else if (current_floor_ptr->dun_level > 100)
                                        {
-                                               current_floor_ptr->dun_level = d_info[p_ptr->dungeon_idx].maxdepth - 1;
+                                               current_floor_ptr->dun_level = d_info[creature_ptr->dungeon_idx].maxdepth - 1;
                                        }
                                }
 
-                               if (p_ptr->wild_mode)
+                               if (creature_ptr->wild_mode)
                                {
-                                       p_ptr->wilderness_y = p_ptr->y;
-                                       p_ptr->wilderness_x = p_ptr->x;
+                                       creature_ptr->wilderness_y = creature_ptr->y;
+                                       creature_ptr->wilderness_x = creature_ptr->x;
                                }
                                else
                                {
                                        /* Save player position */
-                                       p_ptr->oldpx = p_ptr->x;
-                                       p_ptr->oldpy = p_ptr->y;
+                                       creature_ptr->oldpx = creature_ptr->x;
+                                       creature_ptr->oldpy = creature_ptr->y;
                                }
-                               p_ptr->wild_mode = FALSE;
+                               creature_ptr->wild_mode = FALSE;
 
                                /*
                                 * Clear all saved floors
                                 * and create a first saved floor
                                 */
                                prepare_change_floor_mode(CFM_FIRST_FLOOR);
-                               p_ptr->leaving = TRUE;
+                               creature_ptr->leaving = TRUE;
 
-                               if (p_ptr->dungeon_idx == DUNGEON_ANGBAND)
+                               if (creature_ptr->dungeon_idx == DUNGEON_ANGBAND)
                                {
                                        int i;
 
@@ -3036,7 +3036,7 @@ static void process_world_aux_movement(void)
                                                    (q_ptr->level < current_floor_ptr->dun_level))
                                                {
                                                        q_ptr->status = QUEST_STATUS_FAILED;
-                                                       q_ptr->complev = (byte)p_ptr->lev;
+                                                       q_ptr->complev = (byte)creature_ptr->lev;
                                                        update_playtime();
                                                        q_ptr->comptime = current_world_ptr->play_time;
                                                        r_info[q_ptr->r_idx].flags1 &= ~(RF1_QUESTOR);
@@ -3051,21 +3051,21 @@ static void process_world_aux_movement(void)
 
 
        /* Delayed Alter reality */
-       if (p_ptr->alter_reality)
+       if (creature_ptr->alter_reality)
        {
-               if (autosave_l && (p_ptr->alter_reality == 1) && !p_ptr->phase_out)
+               if (autosave_l && (creature_ptr->alter_reality == 1) && !creature_ptr->phase_out)
                        do_cmd_save_game(TRUE);
 
                /* Count down towards alter */
-               p_ptr->alter_reality--;
+               creature_ptr->alter_reality--;
 
-               p_ptr->redraw |= (PR_STATUS);
+               creature_ptr->redraw |= (PR_STATUS);
 
                /* Activate the alter reality */
-               if (!p_ptr->alter_reality)
+               if (!creature_ptr->alter_reality)
                {
                        /* Disturbing! */
-                       disturb(p_ptr, FALSE, TRUE);
+                       disturb(creature_ptr, FALSE, TRUE);
 
                        /* Determine the level */
                        if (!quest_number(current_floor_ptr->dun_level) && current_floor_ptr->dun_level)
@@ -3077,7 +3077,7 @@ static void process_world_aux_movement(void)
                                 * and create a first saved floor
                                 */
                                prepare_change_floor_mode(CFM_FIRST_FLOOR);
-                               p_ptr->leaving = TRUE;
+                               creature_ptr->leaving = TRUE;
                        }
                        else
                        {
@@ -3105,7 +3105,7 @@ static void process_world(void)
        extract_day_hour_min(&day, &hour, &min);
 
        /* Update dungeon feeling, and announce it if changed */
-       update_dungeon_feeling(current_floor_ptr);
+       update_dungeon_feeling(p_ptr, current_floor_ptr);
 
        /* 帰還無しモード時のレベルテレポバグ対策 / Fix for level teleport bugs on ironman_downward.*/
        if (ironman_downward && (p_ptr->dungeon_idx != DUNGEON_ANGBAND && p_ptr->dungeon_idx != 0))
@@ -3354,16 +3354,16 @@ static void process_world(void)
                }
        }
 
-       process_world_aux_digestion();
+       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();
-       sense_inventory2();
-       process_world_aux_movement();
+       sense_inventory1(p_ptr);
+       sense_inventory2(p_ptr);
+       process_world_aux_movement(p_ptr);
 }
 
 /*!
@@ -3447,7 +3447,7 @@ static bool enter_debug_mode(void)
 /*
  * Hack -- Declare the Debug Routines
  */
-extern void do_cmd_debug(void);
+extern void do_cmd_debug(player_type *creature_ptr);
 
 #endif /* ALLOW_WIZARD */
 
@@ -3499,7 +3499,7 @@ extern void do_cmd_borg(void);
  * @todo Make some "blocks"
  * @return なし
  */
-static void process_command(void)
+static void process_command(player_type *creature_ptr)
 {
        COMMAND_CODE old_now_message = now_message;
 
@@ -3509,8 +3509,8 @@ static void process_command(void)
        now_message = 0;
 
        /* Sniper */
-       if ((p_ptr->pclass == CLASS_SNIPER) && (p_ptr->concent))
-               p_ptr->reset_concent = TRUE;
+       if ((creature_ptr->pclass == CLASS_SNIPER) && (creature_ptr->concent))
+               creature_ptr->reset_concent = TRUE;
 
        /* Parse the command */
        switch (command_cmd)
@@ -3542,8 +3542,8 @@ static void process_command(void)
                                current_world_ptr->wizard = TRUE;
                                msg_print(_("ウィザードモード突入。", "Wizard mode on."));
                        }
-                       p_ptr->update |= (PU_MONSTERS);
-                       p_ptr->redraw |= (PR_TITLE);
+                       creature_ptr->update |= (PU_MONSTERS);
+                       creature_ptr->redraw |= (PR_TITLE);
 
                        break;
                }
@@ -3556,7 +3556,7 @@ static void process_command(void)
                {
                        if (enter_debug_mode())
                        {
-                               do_cmd_debug();
+                               do_cmd_debug(creature_ptr);
                        }
                        break;
                }
@@ -3571,7 +3571,7 @@ static void process_command(void)
                {
                        if (enter_borg_mode())
                        {
-                               if (!p_ptr->wild_mode) do_cmd_borg();
+                               if (!creature_ptr->wild_mode) do_cmd_borg();
                        }
                        break;
                }
@@ -3585,42 +3585,42 @@ static void process_command(void)
                /* Wear/wield equipment */
                case 'w':
                {
-                       if (!p_ptr->wild_mode) do_cmd_wield(p_ptr);
+                       if (!creature_ptr->wild_mode) do_cmd_wield(creature_ptr);
                        break;
                }
 
                /* Take off equipment */
                case 't':
                {
-                       if (!p_ptr->wild_mode) do_cmd_takeoff(p_ptr);
+                       if (!creature_ptr->wild_mode) do_cmd_takeoff(creature_ptr);
                        break;
                }
 
                /* Drop an item */
                case 'd':
                {
-                       if (!p_ptr->wild_mode) do_cmd_drop(p_ptr);
+                       if (!creature_ptr->wild_mode) do_cmd_drop(creature_ptr);
                        break;
                }
 
                /* Destroy an item */
                case 'k':
                {
-                       do_cmd_destroy(p_ptr);
+                       do_cmd_destroy(creature_ptr);
                        break;
                }
 
                /* Equipment list */
                case 'e':
                {
-                       do_cmd_equip(p_ptr);
+                       do_cmd_equip(creature_ptr);
                        break;
                }
 
                /* Inventory list */
                case 'i':
                {
-                       do_cmd_inven(p_ptr);
+                       do_cmd_inven(creature_ptr);
                        break;
                }
 
@@ -3630,13 +3630,13 @@ static void process_command(void)
                /* Identify an object */
                case 'I':
                {
-                       do_cmd_observe(p_ptr);
+                       do_cmd_observe(creature_ptr);
                        break;
                }
 
                case KTRL('I'):
                {
-                       toggle_inven_equip(p_ptr);
+                       toggle_inven_equip(creature_ptr);
                        break;
                }
 
@@ -3646,28 +3646,28 @@ static void process_command(void)
                /* Alter a grid */
                case '+':
                {
-                       if (!p_ptr->wild_mode) do_cmd_alter(p_ptr);
+                       if (!creature_ptr->wild_mode) do_cmd_alter(creature_ptr);
                        break;
                }
 
                /* Dig a tunnel */
                case 'T':
                {
-                       if (!p_ptr->wild_mode) do_cmd_tunnel(p_ptr);
+                       if (!creature_ptr->wild_mode) do_cmd_tunnel(creature_ptr);
                        break;
                }
 
                /* Move (usually pick up things) */
                case ';':
                {
-                       do_cmd_walk(p_ptr, FALSE);
+                       do_cmd_walk(creature_ptr, FALSE);
                        break;
                }
 
                /* Move (usually do not pick up) */
                case '-':
                {
-                       do_cmd_walk(p_ptr, TRUE);
+                       do_cmd_walk(creature_ptr, TRUE);
                        break;
                }
 
@@ -3677,42 +3677,42 @@ static void process_command(void)
                /* Begin Running -- Arg is Max Distance */
                case '.':
                {
-                       if (!p_ptr->wild_mode) do_cmd_run(p_ptr);
+                       if (!creature_ptr->wild_mode) do_cmd_run(creature_ptr);
                        break;
                }
 
                /* Stay still (usually pick things up) */
                case ',':
                {
-                       do_cmd_stay(p_ptr, always_pickup);
+                       do_cmd_stay(creature_ptr, always_pickup);
                        break;
                }
 
                /* Stay still (usually do not pick up) */
                case 'g':
                {
-                       do_cmd_stay(p_ptr, !always_pickup);
+                       do_cmd_stay(creature_ptr, !always_pickup);
                        break;
                }
 
                /* Rest -- Arg is time */
                case 'R':
                {
-                       do_cmd_rest(p_ptr);
+                       do_cmd_rest(creature_ptr);
                        break;
                }
 
                /* Search for traps/doors */
                case 's':
                {
-                       do_cmd_search(p_ptr);
+                       do_cmd_search(creature_ptr);
                        break;
                }
 
                case 'S':
                {
-                       if (p_ptr->action == ACTION_SEARCH) set_action(p_ptr, ACTION_NONE);
-                       else set_action(p_ptr, ACTION_SEARCH);
+                       if (creature_ptr->action == ACTION_SEARCH) set_action(creature_ptr, ACTION_NONE);
+                       else set_action(creature_ptr, ACTION_SEARCH);
                        break;
                }
 
@@ -3743,17 +3743,17 @@ static void process_command(void)
                /* Go up staircase */
                case '<':
                {
-                       if (!p_ptr->wild_mode && !current_floor_ptr->dun_level && !p_ptr->inside_arena && !p_ptr->inside_quest)
+                       if (!creature_ptr->wild_mode && !current_floor_ptr->dun_level && !creature_ptr->inside_arena && !creature_ptr->inside_quest)
                        {
                                if (vanilla_town) break;
 
-                               if (p_ptr->ambush_flag)
+                               if (creature_ptr->ambush_flag)
                                {
                                        msg_print(_("襲撃から逃げるにはマップの端まで移動しなければならない。", "To flee the ambush you have to reach the edge of the map."));
                                        break;
                                }
 
-                               if (p_ptr->food < PY_FOOD_WEAK)
+                               if (creature_ptr->food < PY_FOOD_WEAK)
                                {
                                        msg_print(_("その前に食事をとらないと。", "You must eat something here."));
                                        break;
@@ -3762,52 +3762,52 @@ static void process_command(void)
                                change_wild_mode(FALSE);
                        }
                        else
-                               do_cmd_go_up(p_ptr);
+                               do_cmd_go_up(creature_ptr);
                        break;
                }
 
                /* Go down staircase */
                case '>':
                {
-                       if (p_ptr->wild_mode)
+                       if (creature_ptr->wild_mode)
                                change_wild_mode(FALSE);
                        else
-                               do_cmd_go_down(p_ptr);
+                               do_cmd_go_down(creature_ptr);
                        break;
                }
 
                /* Open a door or chest */
                case 'o':
                {
-                       do_cmd_open(p_ptr);
+                       do_cmd_open(creature_ptr);
                        break;
                }
 
                /* Close a door */
                case 'c':
                {
-                       do_cmd_close(p_ptr);
+                       do_cmd_close(creature_ptr);
                        break;
                }
 
                /* Jam a door with spikes */
                case 'j':
                {
-                       do_cmd_spike(p_ptr);
+                       do_cmd_spike(creature_ptr);
                        break;
                }
 
                /* Bash a door */
                case 'B':
                {
-                       do_cmd_bash(p_ptr);
+                       do_cmd_bash(creature_ptr);
                        break;
                }
 
                /* Disarm a trap or chest */
                case 'D':
                {
-                       do_cmd_disarm(p_ptr);
+                       do_cmd_disarm(creature_ptr);
                        break;
                }
 
@@ -3817,32 +3817,32 @@ static void process_command(void)
                /* Gain new spells/prayers */
                case 'G':
                {
-                       if ((p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE))
+                       if ((creature_ptr->pclass == CLASS_SORCERER) || (creature_ptr->pclass == CLASS_RED_MAGE))
                                msg_print(_("呪文を学習する必要はない!", "You don't have to learn spells!"));
-                       else if (p_ptr->pclass == CLASS_SAMURAI)
-                               do_cmd_gain_hissatsu(p_ptr);
-                       else if (p_ptr->pclass == CLASS_MAGIC_EATER)
-                               import_magic_device();
+                       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(p_ptr);
+                               do_cmd_study(creature_ptr);
                        break;
                }
 
                /* Browse a book */
                case 'b':
                {
-                       if ( (p_ptr->pclass == CLASS_MINDCRAFTER) ||
-                            (p_ptr->pclass == CLASS_BERSERKER) ||
-                            (p_ptr->pclass == CLASS_NINJA) ||
-                            (p_ptr->pclass == CLASS_MIRROR_MASTER) 
+                       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 (p_ptr->pclass == CLASS_SMITH)
-                               do_cmd_kaji(p_ptr, TRUE);
-                       else if (p_ptr->pclass == CLASS_MAGIC_EATER)
-                               do_cmd_magic_eater(p_ptr, TRUE, FALSE);
-                       else if (p_ptr->pclass == CLASS_SNIPER)
-                               do_cmd_snipe_browse(p_ptr);
-                       else do_cmd_browse(p_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;
                }
 
@@ -3850,63 +3850,63 @@ static void process_command(void)
                case 'm':
                {
                        /* -KMW- */
-                       if (!p_ptr->wild_mode)
+                       if (!creature_ptr->wild_mode)
                        {
-                               if ((p_ptr->pclass == CLASS_WARRIOR) || (p_ptr->pclass == CLASS_ARCHER) || (p_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 (current_floor_ptr->dun_level && (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_MAGIC) && (p_ptr->pclass != CLASS_BERSERKER) && (p_ptr->pclass != CLASS_SMITH))
+                               else if (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 (p_ptr->anti_magic && (p_ptr->pclass != CLASS_BERSERKER) && (p_ptr->pclass != CLASS_SMITH))
+                               else if (creature_ptr->anti_magic && (creature_ptr->pclass != CLASS_BERSERKER) && (creature_ptr->pclass != CLASS_SMITH))
                                {
                                        concptr which_power = _("魔法", "magic");
-                                       if (p_ptr->pclass == CLASS_MINDCRAFTER)
+                                       if (creature_ptr->pclass == CLASS_MINDCRAFTER)
                                                which_power = _("超能力", "psionic powers");
-                                       else if (p_ptr->pclass == CLASS_IMITATOR)
+                                       else if (creature_ptr->pclass == CLASS_IMITATOR)
                                                which_power = _("ものまね", "imitation");
-                                       else if (p_ptr->pclass == CLASS_SAMURAI)
+                                       else if (creature_ptr->pclass == CLASS_SAMURAI)
                                                which_power = _("必殺剣", "hissatsu");
-                                       else if (p_ptr->pclass == CLASS_MIRROR_MASTER)
+                                       else if (creature_ptr->pclass == CLASS_MIRROR_MASTER)
                                                which_power = _("鏡魔法", "mirror magic");
-                                       else if (p_ptr->pclass == CLASS_NINJA)
+                                       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(p_ptr);
+                                       free_turn(creature_ptr);
                                }
-                               else if (p_ptr->shero && (p_ptr->pclass != CLASS_BERSERKER))
+                               else if (creature_ptr->shero && (creature_ptr->pclass != CLASS_BERSERKER))
                                {
                                        msg_format(_("狂戦士化していて頭が回らない!", "You cannot think directly!"));
-                                       free_turn(p_ptr);
+                                       free_turn(creature_ptr);
                                }
                                else
                                {
-                                       if ((p_ptr->pclass == CLASS_MINDCRAFTER) ||
-                                           (p_ptr->pclass == CLASS_BERSERKER) ||
-                                           (p_ptr->pclass == CLASS_NINJA) ||
-                                           (p_ptr->pclass == CLASS_MIRROR_MASTER)
+                                       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 (p_ptr->pclass == CLASS_IMITATOR)
-                                               do_cmd_mane(p_ptr, FALSE);
-                                       else if (p_ptr->pclass == CLASS_MAGIC_EATER)
-                                               do_cmd_magic_eater(p_ptr, FALSE, FALSE);
-                                       else if (p_ptr->pclass == CLASS_SAMURAI)
-                                               do_cmd_hissatsu(p_ptr);
-                                       else if (p_ptr->pclass == CLASS_BLUE_MAGE)
+                                       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 (p_ptr->pclass == CLASS_SMITH)
-                                               do_cmd_kaji(p_ptr, FALSE);
-                                       else if (p_ptr->pclass == CLASS_SNIPER)
-                                               do_cmd_snipe(p_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
-                                               do_cmd_cast(p_ptr);
+                                               do_cmd_cast(creature_ptr);
                                }
                        }
                        break;
@@ -3915,7 +3915,7 @@ static void process_command(void)
                /* Issue a pet command */
                case 'p':
                {
-                       do_cmd_pet(p_ptr);
+                       do_cmd_pet(creature_ptr);
                        break;
                }
 
@@ -3924,56 +3924,56 @@ static void process_command(void)
                /* Inscribe an object */
                case '{':
                {
-                       do_cmd_inscribe(p_ptr);
+                       do_cmd_inscribe(creature_ptr);
                        break;
                }
 
                /* Uninscribe an object */
                case '}':
                {
-                       do_cmd_uninscribe(p_ptr);
+                       do_cmd_uninscribe(creature_ptr);
                        break;
                }
 
                /* Activate an artifact */
                case 'A':
                {
-                       do_cmd_activate(p_ptr);
+                       do_cmd_activate(creature_ptr);
                        break;
                }
 
                /* Eat some food */
                case 'E':
                {
-                       do_cmd_eat_food(p_ptr);
+                       do_cmd_eat_food(creature_ptr);
                        break;
                }
 
                /* Fuel your lantern/torch */
                case 'F':
                {
-                       do_cmd_refill(p_ptr);
+                       do_cmd_refill(creature_ptr);
                        break;
                }
 
                /* Fire an item */
                case 'f':
                {
-                       do_cmd_fire(p_ptr, SP_NONE);
+                       do_cmd_fire(creature_ptr, SP_NONE);
                        break;
                }
 
                /* Throw an item */
                case 'v':
                {
-                       do_cmd_throw(p_ptr, 1, FALSE, -1);
+                       do_cmd_throw(creature_ptr, 1, FALSE, -1);
                        break;
                }
 
                /* Aim a wand */
                case 'a':
                {
-                       do_cmd_aim_wand(p_ptr);
+                       do_cmd_aim_wand(creature_ptr);
                        break;
                }
 
@@ -3982,11 +3982,11 @@ static void process_command(void)
                {
                        if (use_command && rogue_like_commands)
                        {
-                               do_cmd_use(p_ptr);
+                               do_cmd_use(creature_ptr);
                        }
                        else
                        {
-                               do_cmd_zap_rod(p_ptr);
+                               do_cmd_zap_rod(creature_ptr);
                        }
                        break;
                }
@@ -3994,14 +3994,14 @@ static void process_command(void)
                /* Quaff a potion */
                case 'q':
                {
-                       do_cmd_quaff_potion(p_ptr);
+                       do_cmd_quaff_potion(creature_ptr);
                        break;
                }
 
                /* Read a scroll */
                case 'r':
                {
-                       do_cmd_read_scroll(p_ptr);
+                       do_cmd_read_scroll(creature_ptr);
                        break;
                }
 
@@ -4009,16 +4009,16 @@ static void process_command(void)
                case 'u':
                {
                        if (use_command && !rogue_like_commands)
-                               do_cmd_use(p_ptr);
+                               do_cmd_use(creature_ptr);
                        else
-                               do_cmd_use_staff(p_ptr);
+                               do_cmd_use_staff(creature_ptr);
                        break;
                }
 
                /* Use racial power */
                case 'U':
                {
-                       do_cmd_racial_power(p_ptr);
+                       do_cmd_racial_power(creature_ptr);
                        break;
                }
 
@@ -4035,7 +4035,7 @@ static void process_command(void)
                /* Locate player on map */
                case 'L':
                {
-                       do_cmd_locate(p_ptr);
+                       do_cmd_locate(creature_ptr);
                        break;
                }
 
@@ -4074,7 +4074,7 @@ static void process_command(void)
                /* Character description */
                case 'C':
                {
-                       do_cmd_player_status(p_ptr);
+                       do_cmd_player_status(creature_ptr);
                        break;
                }
 
@@ -4110,23 +4110,23 @@ static void process_command(void)
                /* Interact with macros */
                case '@':
                {
-                       do_cmd_macros(p_ptr);
+                       do_cmd_macros(creature_ptr);
                        break;
                }
 
                /* Interact with visuals */
                case '%':
                {
-                       do_cmd_visuals(p_ptr);
-                       do_cmd_redraw(p_ptr);
+                       do_cmd_visuals(creature_ptr);
+                       do_cmd_redraw(creature_ptr);
                        break;
                }
 
                /* Interact with colors */
                case '&':
                {
-                       do_cmd_colors(p_ptr);
-                       do_cmd_redraw(p_ptr);
+                       do_cmd_colors(creature_ptr);
+                       do_cmd_redraw(creature_ptr);
                        break;
                }
 
@@ -4135,7 +4135,7 @@ static void process_command(void)
                {
                        do_cmd_options();
                        (void)combine_and_reorder_home(STORE_HOME);
-                       do_cmd_redraw(p_ptr);
+                       do_cmd_redraw(creature_ptr);
                        break;
                }
 
@@ -4158,7 +4158,7 @@ static void process_command(void)
                /* Repeat level feeling */
                case KTRL('F'):
                {
-                       do_cmd_feeling(p_ptr);
+                       do_cmd_feeling(creature_ptr);
                        break;
                }
 
@@ -4187,7 +4187,7 @@ static void process_command(void)
                case KTRL('R'):
                {
                        now_message = old_now_message;
-                       do_cmd_redraw(p_ptr);
+                       do_cmd_redraw(creature_ptr);
                        break;
                }
 
@@ -4219,7 +4219,7 @@ static void process_command(void)
                /* Quit (commit suicide) */
                case 'Q':
                {
-                       do_cmd_suicide(p_ptr);
+                       do_cmd_suicide(creature_ptr);
                        break;
                }
 
@@ -4267,10 +4267,10 @@ static void process_command(void)
 #ifdef TRAVEL
                case '`':
                {
-                       if (!p_ptr->wild_mode) do_cmd_travel();
-                       if (p_ptr->special_defense & KATA_MUSOU)
+                       if (!creature_ptr->wild_mode) do_cmd_travel(creature_ptr);
+                       if (creature_ptr->special_defense & KATA_MUSOU)
                        {
-                               set_action(p_ptr, ACTION_NONE);
+                               set_action(creature_ptr, ACTION_NONE);
                        }
                        break;
                }
@@ -4295,7 +4295,7 @@ static void process_command(void)
                        break;
                }
        }
-       if (!p_ptr->energy_use && !now_message)
+       if (!creature_ptr->energy_use && !now_message)
                now_message = old_now_message;
 }
 
@@ -4355,7 +4355,7 @@ static void process_upkeep_with_speed(void)
        while (p_ptr->enchant_energy_need <= 0)
        {
                /* Handle the player song */
-               if (!load) check_music();
+               if (!load) check_music(p_ptr);
 
                /* Hex - Handle the hex spells */
                if (!load) check_hex();
@@ -4649,7 +4649,7 @@ static void process_player(void)
                        command_cmd = SPECIAL_KEY_BUILDING;
 
                        /* Process the command */
-                       process_command();
+                       process_command(p_ptr);
                }
 
                /* Paralyzed or Knocked Out */
@@ -4712,7 +4712,7 @@ static void process_player(void)
                        prt("", 0, 0);
 
                        /* Process the command */
-                       process_command();
+                       process_command(p_ptr);
                }
 
                /* Normal command */
@@ -4727,7 +4727,7 @@ static void process_player(void)
                        can_save = FALSE;
 
                        /* Process the command */
-                       process_command();
+                       process_command(p_ptr);
                }
 
                /* Hack -- Pack Overflow */
@@ -5146,7 +5146,7 @@ static void dungeon(bool load_game)
                 * Maintain Unique monsters and artifact, save current
                 * floor, then prepare next floor
                 */
-               leave_floor(p_ptr->change_floor_mode);
+               leave_floor(p_ptr, p_ptr->change_floor_mode);
 
                /* Forget the flag */
                reinit_wilderness = FALSE;
@@ -5505,7 +5505,7 @@ void play_game(bool new_game)
                process_dungeon_file("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();
+               select_floor_music(p_ptr);
        }
 
        /* Generate a dungeon level if needed */
@@ -5599,7 +5599,7 @@ void play_game(bool new_game)
        (void)combine_and_reorder_home(STORE_HOME);
        (void)combine_and_reorder_home(STORE_MUSEUM);
 
-       select_floor_music();
+       select_floor_music(p_ptr);
 
        /* Process */
        while (TRUE)
@@ -5620,7 +5620,7 @@ void play_game(bool new_game)
                /* Cancel the health bar */
                health_track(0);
 
-               forget_lite();
+               forget_lite(current_floor_ptr);
                forget_view();
                clear_mon_lite(current_floor_ptr);
 
@@ -5656,7 +5656,7 @@ void play_game(bool new_game)
                                prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_RAND_CONNECT);
 
                                /* prepare next floor */
-                               leave_floor(p_ptr->change_floor_mode);
+                               leave_floor(p_ptr, p_ptr->change_floor_mode);
                        }
                        else
                        {