OSDN Git Service

[Refactor] #38997 compact_objects() に floor_type * 引数を追加. / Add floor_type * argument...
[hengband/hengband.git] / src / core.c
index df21821..0fa4333 100644 (file)
@@ -220,8 +220,6 @@ static void sense_inventory_aux(INVENTORY_IDX slot, bool heavy)
 #endif
 
        }
-
-       /* Message (p_ptr->inventory_list) */
        else
        {
 #ifdef JP
@@ -254,7 +252,7 @@ static void sense_inventory_aux(INVENTORY_IDX slot, bool heavy)
  * @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
@@ -731,14 +729,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;
        }
@@ -1322,7 +1320,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 +1344,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 +1398,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)
                        {
@@ -1427,11 +1425,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;
 
@@ -1470,7 +1468,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;
 
@@ -1508,7 +1506,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;
 
@@ -1546,7 +1544,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;
 
@@ -1584,7 +1582,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;
 
@@ -1675,7 +1673,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;
@@ -3375,7 +3373,7 @@ static void process_world(player_type *player_ptr)
 static bool enter_wizard_mode(void)
 {
        /* Ask first time */
-       if (!p_ptr->noscore)
+       if (!current_world_ptr->noscore)
        {
                /* Wizard mode is not permitted */
                if (!allow_debug_opts || arg_wizard)
@@ -3397,7 +3395,7 @@ static bool enter_wizard_mode(void)
 
                exe_write_diary(p_ptr, NIKKI_BUNSHOU, 0, _("ウィザードモードに突入してスコアを残せなくなった。", "give up recording score to enter wizard mode."));
                /* Mark savefile */
-               p_ptr->noscore |= 0x0002;
+               current_world_ptr->noscore |= 0x0002;
        }
 
        /* Success */
@@ -3415,7 +3413,7 @@ static bool enter_wizard_mode(void)
 static bool enter_debug_mode(void)
 {
        /* Ask first time */
-       if (!p_ptr->noscore)
+       if (!current_world_ptr->noscore)
        {
                /* Debug mode is not permitted */
                if (!allow_debug_opts)
@@ -3438,7 +3436,7 @@ static bool enter_debug_mode(void)
 
                exe_write_diary(p_ptr, NIKKI_BUNSHOU, 0, _("デバッグモードに突入してスコアを残せなくなった。", "give up sending score to use debug commands."));
                /* Mark savefile */
-               p_ptr->noscore |= 0x0008;
+               current_world_ptr->noscore |= 0x0008;
        }
 
        /* Success */
@@ -3463,7 +3461,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."));
@@ -3479,7 +3477,7 @@ static bool enter_borg_mode(void)
 
                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 */
@@ -3893,7 +3891,7 @@ static void process_command(player_type *creature_ptr)
                                            (creature_ptr->pclass == CLASS_NINJA) ||
                                            (creature_ptr->pclass == CLASS_MIRROR_MASTER)
                                            )
-                                               do_cmd_mind();
+                                               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)
@@ -4233,7 +4231,7 @@ static void process_command(player_type *creature_ptr)
                /* Check artifacts, uniques, objects */
                case '~':
                {
-                       do_cmd_knowledge();
+                       do_cmd_knowledge(creature_ptr);
                        break;
                }
 
@@ -4261,7 +4259,7 @@ static void process_command(player_type *creature_ptr)
                /* Make random artifact list */
                case KTRL('V'):
                {
-                       spoil_random_artifact("randifact.txt");
+                       spoil_random_artifact(creature_ptr, "randifact.txt");
                        break;
                }
 
@@ -4338,28 +4336,28 @@ static void pack_overflow(player_type *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;
+       if (creature_ptr->enchant_energy_need > 0) return;
        
-       while (p_ptr->enchant_energy_need <= 0)
+       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();
        }
 }
 
@@ -4689,7 +4687,7 @@ static void process_player(player_type *creature_ptr)
                else if (travel.run)
                {
                        /* Take a step */
-                       travel_step();
+                       travel_step(creature_ptr);
                }
 #endif
 
@@ -5064,14 +5062,14 @@ static void dungeon(player_type *player_ptr, bool load_game)
 
 
                /* Hack -- Compact the object list occasionally */
-               if (player_ptr->current_floor_ptr->o_cnt + 32 > current_world_ptr->max_o_idx) compact_objects(64);
+               if (player_ptr->current_floor_ptr->o_cnt + 32 > current_world_ptr->max_o_idx) compact_objects(player_ptr->current_floor_ptr, 64);
 
                /* Hack -- Compress the object list occasionally */
-               if (player_ptr->current_floor_ptr->o_cnt + 32 < player_ptr->current_floor_ptr->o_max) compact_objects(0);
+               if (player_ptr->current_floor_ptr->o_cnt + 32 < player_ptr->current_floor_ptr->o_max) compact_objects(player_ptr->current_floor_ptr, 0);
 
                /* Process the player */
                process_player(player_ptr);
-               process_upkeep_with_speed();
+               process_upkeep_with_speed(player_ptr);
 
                handle_stuff();
 
@@ -5226,7 +5224,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;
@@ -5253,7 +5251,7 @@ void play_game(bool new_game)
                return;
        }
 
-       p_ptr->hack_mutation = FALSE;
+       player_ptr->hack_mutation = FALSE;
 
        /* Hack -- Character is "icky" */
        current_world_ptr->character_icky = TRUE;
@@ -5288,7 +5286,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;
@@ -5296,10 +5294,10 @@ 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);
 
@@ -5326,8 +5324,8 @@ void play_game(bool new_game)
                }
                else
                {
-                       p_ptr->wait_report_score = FALSE;
-                       top_twenty(p_ptr);
+                       player_ptr->wait_report_score = FALSE;
+                       top_twenty(player_ptr);
                        if (!save_player()) msg_print(_("セーブ失敗!", "death save failed!"));
                }
                /* Shut the high score file */
@@ -5387,10 +5385,10 @@ void play_game(bool new_game)
                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;
+               player_ptr->current_floor_ptr->dun_level = 0;
+               player_ptr->current_floor_ptr->inside_quest = 0;
+               player_ptr->current_floor_ptr->inside_arena = FALSE;
+               player_ptr->phase_out = FALSE;
 
                write_level = TRUE;
 
@@ -5401,10 +5399,10 @@ 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;
+               player_ptr->count = 0;
 
                load = FALSE;
 
@@ -5412,28 +5410,28 @@ void play_game(bool new_game)
                determine_today_mon(FALSE);
 
                /* Initialize object array */
-               wipe_o_list(p_ptr->current_floor_ptr);
+               wipe_o_list(player_ptr->current_floor_ptr);
        }
        else
        {
                write_level = FALSE;
 
-               exe_write_diary(p_ptr, NIKKI_GAMESTART, 1, 
+               exe_write_diary(player_ptr, NIKKI_GAMESTART, 1, 
                                          _("                            ----ゲーム再開----",
                                                "                            ---- Restart Game ----"));
 
 /*
- * 1.0.9 以前はセーブ前に p_ptr->riding = -1 としていたので、再設定が必要だった。
+ * 1.0.9 以前はセーブ前に player_ptr->riding = -1 としていたので、再設定が必要だった。
  * もう不要だが、以前のセーブファイルとの互換のために残しておく。
  */
-               if (p_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 = player_ptr->current_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, player_ptr->current_floor_ptr->m_list[i].fy, player_ptr->current_floor_ptr->m_list[i].fx))
                                {
-                                       p_ptr->riding = i;
+                                       player_ptr->riding = i;
                                        break;
                                }
                        }
@@ -5442,24 +5440,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 = player_ptr->current_floor_ptr->height;
+       panel_col_min = player_ptr->current_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,55 +5476,55 @@ void play_game(bool new_game)
                {
                        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);
 
                                /* Avoid crash */
-                               p_ptr->current_floor_ptr->inside_quest = 0;
+                               player_ptr->current_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 (!player_ptr->current_floor_ptr->dun_level && !player_ptr->current_floor_ptr->inside_quest)
        {
                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(p_ptr);
+               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;
                }
        }
 
@@ -5542,12 +5540,12 @@ void play_game(bool 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);
+               exe_write_diary(player_ptr, NIKKI_BUNSHOU, 0, buf);
        }
 
 
        /* Start game */
-       p_ptr->playing = TRUE;
+       player_ptr->playing = TRUE;
 
        /* Reset the visual mappings */
        reset_visuals();
@@ -5558,14 +5556,14 @@ void play_game(bool new_game)
        /* 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);
+       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();
 
        /* Set or clear "rogue_like_commands" if requested */
@@ -5573,18 +5571,18 @@ void play_game(bool new_game)
        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,
+               place_monster_aux(0, player_ptr->y, player_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];
+               m_ptr = &player_ptr->current_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->max_maxhp = m_ptr->maxhp;
@@ -5596,13 +5594,13 @@ 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(p_ptr, load_game);
+               dungeon(player_ptr, load_game);
 
                /* Hack -- prevent "icky" message */
                current_world_ptr->character_xtra = TRUE;
@@ -5617,16 +5615,15 @@ void play_game(bool new_game)
                /* Cancel the health bar */
                health_track(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(player_ptr->current_floor_ptr);
+               forget_view(player_ptr->current_floor_ptr);
+               clear_mon_lite(player_ptr->current_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(player_ptr->current_floor_ptr);
+               if (!player_ptr->is_dead) wipe_m_list();
 
 
                msg_print(NULL);
@@ -5634,42 +5631,42 @@ 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 (player_ptr->current_floor_ptr->inside_arena)
                        {
-                               p_ptr->current_floor_ptr->inside_arena = FALSE;
-                               if (p_ptr->arena_number > MAX_ARENA_MONS)
-                                       p_ptr->arena_number++;
+                               player_ptr->current_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 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 */
@@ -5790,7 +5787,7 @@ void close_game(void)
        if (p_ptr->is_dead)
        {
                /* Handle retirement */
-               if (p_ptr->total_winner) kingly(p_ptr);
+               if (current_world_ptr->total_winner) kingly(p_ptr);
 
                /* Save memories */
                if (!cheat_save || get_check(_("死んだデータをセーブしますか? ", "Save death? ")))
@@ -5870,13 +5867,13 @@ void close_game(void)
 void handle_stuff(void)
 {
        if (p_ptr->update) update_creature(p_ptr);
-       if (p_ptr->redraw) redraw_stuff();
+       if (p_ptr->redraw) redraw_stuff(p_ptr);
        if (p_ptr->window) window_stuff();
 }
 
 void update_output(void)
 {
-       if (p_ptr->redraw) redraw_stuff();
+       if (p_ptr->redraw) redraw_stuff(p_ptr);
        if (p_ptr->window) window_stuff();
 }