OSDN Git Service

[Refactor] #38997 set_monster_*() にplayer_type * 引数を追加 / Added player_type * argument...
authorHourier <hourier@users.sourceforge.jp>
Mon, 13 Jan 2020 07:46:54 +0000 (16:46 +0900)
committerHourier <hourier@users.sourceforge.jp>
Mon, 13 Jan 2020 07:46:54 +0000 (16:46 +0900)
20 files changed:
src/cmd/cmd-mane.c
src/cmd/cmd-pet.c
src/combat/melee1.c
src/core.c
src/files.c
src/floor-save.c
src/mind.c
src/monster-process.c
src/monster-process.h
src/monster-status.c
src/monster-status.h
src/monster2.c
src/mspells3.c
src/mspells4.c
src/player-effects.c
src/player-move.c
src/spells-floor.c
src/spells1.c
src/spells2.c
src/spells3.c

index 786de57..e68509c 100644 (file)
@@ -296,7 +296,7 @@ static bool use_mane(player_type *caster_ptr, int spell)
                if (!m_idx) break;
                if (!player_has_los_bold(caster_ptr, target_row, target_col)) break;
                if (!projectable(caster_ptr, caster_ptr->y, caster_ptr->x, target_row, target_col)) break;
-               dispel_monster_status(m_idx);
+               dispel_monster_status(caster_ptr, m_idx);
                break;
        }
 
index 9acb816..f345e30 100644 (file)
@@ -364,7 +364,7 @@ bool do_cmd_riding(player_type *creature_ptr, bool force)
                {
                        GAME_TEXT m_name[MAX_NLEN];
                        monster_desc(m_name, m_ptr, 0);
-                       (void)set_monster_csleep(g_ptr->m_idx, 0);
+                       (void)set_monster_csleep(creature_ptr, g_ptr->m_idx, 0);
                        msg_format(_("%sを起こした。", "You have woken %s up."), m_name);
                }
 
index 7945720..3b71c81 100644 (file)
@@ -1389,7 +1389,7 @@ static void py_attack_aux(player_type *attacker_ptr, POSITION y, POSITION x, boo
        }
 
        /* Disturb the monster */
-       (void)set_monster_csleep(g_ptr->m_idx, 0);
+       (void)set_monster_csleep(attacker_ptr, g_ptr->m_idx, 0);
 
        monster_desc(m_name, m_ptr, 0);
 
@@ -1731,7 +1731,7 @@ static void py_attack_aux(player_type *attacker_ptr, POSITION y, POSITION x, boo
                        {
                                if (attacker_ptr->lev > randint1(r_ptr->level + resist_stun + 10))
                                {
-                                       if (set_monster_stunned(g_ptr->m_idx, stun_effect + MON_STUNNED(m_ptr)))
+                                       if (set_monster_stunned(attacker_ptr, g_ptr->m_idx, stun_effect + MON_STUNNED(m_ptr)))
                                        {
                                                msg_format(_("%^sはフラフラになった。", "%^s is stunned."), m_name);
                                        }
@@ -1877,7 +1877,7 @@ static void py_attack_aux(player_type *attacker_ptr, POSITION y, POSITION x, boo
                                }
 
                                /* Apply stun */
-                               (void)set_monster_stunned(g_ptr->m_idx, MON_STUNNED(m_ptr) + tmp);
+                               (void)set_monster_stunned(attacker_ptr, g_ptr->m_idx, MON_STUNNED(m_ptr) + tmp);
                        }
                        else
                        {
@@ -2059,7 +2059,7 @@ static void py_attack_aux(player_type *attacker_ptr, POSITION y, POSITION x, boo
                        else
                        {
                                msg_format(_("%^sは混乱したようだ。", "%^s appears confused."), m_name);
-                               (void)set_monster_confused(g_ptr->m_idx, MON_CONFUSED(m_ptr) + 10 + randint0(attacker_ptr->lev) / 5);
+                               (void)set_monster_confused(attacker_ptr, g_ptr->m_idx, MON_CONFUSED(m_ptr) + 10 + randint0(attacker_ptr->lev) / 5);
                        }
                }
 
@@ -2257,7 +2257,7 @@ bool py_attack(player_type *attacker_ptr, POSITION y, POSITION x, COMBAT_OPTION_
                        msg_format(_("そっちには何か恐いものがいる!", "There is something scary in your way!"));
 
                /* Disturb the monster */
-               (void)set_monster_csleep(g_ptr->m_idx, 0);
+               (void)set_monster_csleep(attacker_ptr, g_ptr->m_idx, 0);
 
                return FALSE;
        }
@@ -4202,7 +4202,7 @@ bool monst_attack_monst(player_type *subject_ptr, MONSTER_IDX m_idx, MONSTER_IDX
                /* Monster hits */
                if (!effect || check_hit2(power, rlev, ac, MON_STUNNED(m_ptr)))
                {
-                       (void)set_monster_csleep(t_idx, 0);
+                       (void)set_monster_csleep(subject_ptr, t_idx, 0);
 
                        if (t_ptr->ml)
                        {
@@ -4655,7 +4655,7 @@ bool monst_attack_monst(player_type *subject_ptr, MONSTER_IDX m_idx, MONSTER_IDX
                        case RBM_ENGULF:
                        case RBM_CHARGE:
                        {
-                               (void)set_monster_csleep(t_idx, 0);
+                               (void)set_monster_csleep(subject_ptr, t_idx, 0);
 
                                /* Visible monsters */
                                if (see_m)
@@ -4693,7 +4693,7 @@ bool monst_attack_monst(player_type *subject_ptr, MONSTER_IDX m_idx, MONSTER_IDX
                sound(SOUND_EXPLODE);
 
                /* Cancel Invulnerability */
-               (void)set_monster_invulner(m_idx, 0, FALSE);
+               (void)set_monster_invulner(subject_ptr, m_idx, 0, FALSE);
                mon_take_hit_mon(subject_ptr, m_idx, m_ptr->hp + 1, &dead, &fear, _("は爆発して粉々になった。", " explodes into tiny shreds."), m_idx);
                blinked = FALSE;
        }
@@ -4761,7 +4761,7 @@ void mon_take_hit_mon(player_type *player_ptr, MONSTER_IDX m_idx, HIT_POINT dam,
                if (player_ptr->riding == m_idx) player_ptr->redraw |= (PR_UHEALTH);
        }
 
-       (void)set_monster_csleep(m_idx, 0);
+       (void)set_monster_csleep(player_ptr, m_idx, 0);
 
        if (player_ptr->riding && (m_idx == player_ptr->riding)) disturb(player_ptr, TRUE, TRUE);
 
@@ -4862,7 +4862,7 @@ void mon_take_hit_mon(player_type *player_ptr, MONSTER_IDX m_idx, HIT_POINT dam,
        if (MON_MONFEAR(m_ptr) && (dam > 0))
        {
                /* Cure fear */
-               if (set_monster_monfear(m_idx, MON_MONFEAR(m_ptr) - randint1(dam / 4)))
+               if (set_monster_monfear(player_ptr, m_idx, MON_MONFEAR(m_ptr) - randint1(dam / 4)))
                {
                        /* No more fear */
                        (*fear) = FALSE;
@@ -4886,7 +4886,7 @@ void mon_take_hit_mon(player_type *player_ptr, MONSTER_IDX m_idx, HIT_POINT dam,
                        (*fear) = TRUE;
 
                        /* Hack -- Add some timed fear */
-                       (void)set_monster_monfear(m_idx, (randint1(10) +
+                       (void)set_monster_monfear(player_ptr, m_idx, (randint1(10) +
                                (((dam >= m_ptr->hp) && (percentage > 7)) ?
                                        20 : ((11 - percentage) * 5))));
                }
index 85e5156..17e6052 100644 (file)
@@ -3109,12 +3109,13 @@ static void process_world(player_type *player_ptr)
        update_dungeon_feeling(player_ptr);
 
        /* 帰還無しモード時のレベルテレポバグ対策 / Fix for level teleport bugs on ironman_downward.*/
+       floor_type *floor_ptr = player_ptr->current_floor_ptr;
        if (ironman_downward && (player_ptr->dungeon_idx != DUNGEON_ANGBAND && player_ptr->dungeon_idx != 0))
        {
-               player_ptr->current_floor_ptr->dun_level = 0;
+               floor_ptr->dun_level = 0;
                player_ptr->dungeon_idx = 0;
                prepare_change_floor_mode(player_ptr, CFM_FIRST_FLOOR | CFM_RAND_PLACE);
-               player_ptr->current_floor_ptr->inside_arena = FALSE;
+               floor_ptr->inside_arena = FALSE;
                player_ptr->wild_mode = FALSE;
                player_ptr->leaving = TRUE;
        }
@@ -3127,10 +3128,10 @@ static void process_world(player_type *player_ptr)
                int number_mon = 0;
 
                /* Count all hostile monsters */
-               for (i2 = 0; i2 < player_ptr->current_floor_ptr->width; ++i2)
-                       for (j2 = 0; j2 < player_ptr->current_floor_ptr->height; j2++)
+               for (i2 = 0; i2 < floor_ptr->width; ++i2)
+                       for (j2 = 0; j2 < floor_ptr->height; j2++)
                        {
-                               grid_type *g_ptr = &player_ptr->current_floor_ptr->grid_array[j2][i2];
+                               grid_type *g_ptr = &floor_ptr->grid_array[j2][i2];
 
                                if ((g_ptr->m_idx > 0) && (g_ptr->m_idx != player_ptr->riding))
                                {
@@ -3151,7 +3152,7 @@ static void process_world(player_type *player_ptr)
                        GAME_TEXT m_name[MAX_NLEN];
                        monster_type *wm_ptr;
 
-                       wm_ptr = &player_ptr->current_floor_ptr->m_list[win_m_idx];
+                       wm_ptr = &floor_ptr->m_list[win_m_idx];
 
                        monster_desc(m_name, wm_ptr, 0);
                        msg_format(_("%sが勝利した!", "%s is winner!"), m_name);
@@ -3171,7 +3172,7 @@ static void process_world(player_type *player_ptr)
                        player_ptr->energy_need = 0;
                        update_gambling_monsters(player_ptr);
                }
-               else if (current_world_ptr->game_turn - player_ptr->current_floor_ptr->generated_turn == 150 * TURNS_PER_TICK)
+               else if (current_world_ptr->game_turn - floor_ptr->generated_turn == 150 * TURNS_PER_TICK)
                {
                        msg_print(_("申し分けありませんが、この勝負は引き分けとさせていただきます。", "This battle have ended in a draw."));
                        player_ptr->au += kakekin;
@@ -3191,7 +3192,7 @@ static void process_world(player_type *player_ptr)
                        do_cmd_save_game(player_ptr, TRUE);
        }
 
-       if (player_ptr->current_floor_ptr->monster_noise && !ignore_unview)
+       if (floor_ptr->monster_noise && !ignore_unview)
        {
                msg_print(_("何かが聞こえた。", "You hear noise."));
        }
@@ -3199,7 +3200,7 @@ static void process_world(player_type *player_ptr)
        /*** Handle the wilderness/town (sunshine) ***/
 
        /* While in town/wilderness */
-       if (!player_ptr->current_floor_ptr->dun_level && !player_ptr->current_floor_ptr->inside_quest && !player_ptr->phase_out && !player_ptr->current_floor_ptr->inside_arena)
+       if (!floor_ptr->dun_level && !floor_ptr->inside_quest && !player_ptr->phase_out && !floor_ptr->inside_arena)
        {
                /* Hack -- Daybreak/Nighfall in town */
                if (!(current_world_ptr->game_turn % ((TURNS_PER_TICK * TOWN_DAWN) / 2)))
@@ -3216,7 +3217,7 @@ static void process_world(player_type *player_ptr)
        }
 
        /* While in the dungeon (vanilla_town or lite_town mode only) */
-       else if ((vanilla_town || (lite_town && !player_ptr->current_floor_ptr->inside_quest && !player_ptr->phase_out && !player_ptr->current_floor_ptr->inside_arena)) && player_ptr->current_floor_ptr->dun_level)
+       else if ((vanilla_town || (lite_town && !floor_ptr->inside_quest && !player_ptr->phase_out && !floor_ptr->inside_arena)) && floor_ptr->dun_level)
        {
                /*** Shuffle the Storekeepers ***/
 
@@ -3266,7 +3267,7 @@ static void process_world(player_type *player_ptr)
 
        /* Check for creature generation. */
        if (one_in_(d_info[player_ptr->dungeon_idx].max_m_alloc_chance) &&
-           !player_ptr->current_floor_ptr->inside_arena && !player_ptr->current_floor_ptr->inside_quest && !player_ptr->phase_out)
+           !floor_ptr->inside_arena && !floor_ptr->inside_quest && !player_ptr->phase_out)
        {
                /* Make a new monster */
                (void)alloc_monster(MAX_SIGHT + 5, 0);
@@ -3283,7 +3284,7 @@ static void process_world(player_type *player_ptr)
                /* Hack -- Process the counters of monsters if needed */
                for (i = 0; i < MAX_MTIMED; i++)
                {
-                       if (player_ptr->current_floor_ptr->mproc_max[i] > 0) process_monsters_mtimed(i);
+                       if (floor_ptr->mproc_max[i] > 0) process_monsters_mtimed(player_ptr, i);
                }
        }
 
@@ -4514,7 +4515,7 @@ static void process_player(player_type *creature_ptr)
                        GAME_TEXT m_name[MAX_NLEN];
 
                        /* Recover fully */
-                       (void)set_monster_csleep(creature_ptr->riding, 0);
+                       (void)set_monster_csleep(creature_ptr, creature_ptr->riding, 0);
                        monster_desc(m_name, m_ptr, 0);
                        msg_format(_("%^sを起こした。", "You have woken %s up."), m_name);
                }
@@ -4522,7 +4523,7 @@ static void process_player(player_type *creature_ptr)
                if (MON_STUNNED(m_ptr))
                {
                        /* Hack -- Recover from stun */
-                       if (set_monster_stunned(creature_ptr->riding,
+                       if (set_monster_stunned(creature_ptr, creature_ptr->riding,
                                (randint0(r_ptr->level) < creature_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_STUNNED(m_ptr) - 1)))
                        {
                                GAME_TEXT m_name[MAX_NLEN];
@@ -4534,7 +4535,7 @@ static void process_player(player_type *creature_ptr)
                if (MON_CONFUSED(m_ptr))
                {
                        /* Hack -- Recover from confusion */
-                       if (set_monster_confused(creature_ptr->riding,
+                       if (set_monster_confused(creature_ptr, creature_ptr->riding,
                                (randint0(r_ptr->level) < creature_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_CONFUSED(m_ptr) - 1)))
                        {
                                GAME_TEXT m_name[MAX_NLEN];
@@ -4546,7 +4547,7 @@ static void process_player(player_type *creature_ptr)
                if (MON_MONFEAR(m_ptr))
                {
                        /* Hack -- Recover from fear */
-                       if(set_monster_monfear(creature_ptr->riding,
+                       if(set_monster_monfear(creature_ptr, creature_ptr->riding,
                                (randint0(r_ptr->level) < creature_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_MONFEAR(m_ptr) - 1)))
                        {
                                GAME_TEXT m_name[MAX_NLEN];
@@ -4898,7 +4899,8 @@ static void dungeon(player_type *player_ptr, bool load_game)
        int quest_num = 0;
 
        /* Set the base level */
-       player_ptr->current_floor_ptr->base_level = player_ptr->current_floor_ptr->dun_level;
+       floor_type *floor_ptr = player_ptr->current_floor_ptr;
+       floor_ptr->base_level = floor_ptr->dun_level;
 
        /* Reset various flags */
        current_world_ptr->is_loading_now = FALSE;
@@ -4934,7 +4936,7 @@ static void dungeon(player_type *player_ptr, bool load_game)
        disturb(player_ptr, TRUE, TRUE);
 
        /* Get index of current quest (if any) */
-       quest_num = quest_number(player_ptr, player_ptr->current_floor_ptr->dun_level);
+       quest_num = quest_number(player_ptr, floor_ptr->dun_level);
 
        /* Inside a quest? */
        if (quest_num)
@@ -4951,10 +4953,10 @@ static void dungeon(player_type *player_ptr, bool load_game)
 
 
        /* Track maximum dungeon level (if not in quest -KMW-) */
-       if ((max_dlv[player_ptr->dungeon_idx] < player_ptr->current_floor_ptr->dun_level) && !player_ptr->current_floor_ptr->inside_quest)
+       if ((max_dlv[player_ptr->dungeon_idx] < floor_ptr->dun_level) && !floor_ptr->inside_quest)
        {
-               max_dlv[player_ptr->dungeon_idx] = player_ptr->current_floor_ptr->dun_level;
-               if (record_maxdepth) exe_write_diary(player_ptr, NIKKI_MAXDEAPTH, player_ptr->current_floor_ptr->dun_level, NULL);
+               max_dlv[player_ptr->dungeon_idx] = floor_ptr->dun_level;
+               if (record_maxdepth) exe_write_diary(player_ptr, NIKKI_MAXDEAPTH, floor_ptr->dun_level, NULL);
        }
 
        (void)calculate_upkeep(player_ptr);
@@ -5010,12 +5012,12 @@ static void dungeon(player_type *player_ptr, bool load_game)
        if (!player_ptr->playing || player_ptr->is_dead) return;
 
        /* Print quest message if appropriate */
-       if (!player_ptr->current_floor_ptr->inside_quest && (player_ptr->dungeon_idx == DUNGEON_ANGBAND))
+       if (!floor_ptr->inside_quest && (player_ptr->dungeon_idx == DUNGEON_ANGBAND))
        {
-               quest_discovery(random_quest_number(player_ptr, player_ptr->current_floor_ptr->dun_level));
-               player_ptr->current_floor_ptr->inside_quest = random_quest_number(player_ptr, player_ptr->current_floor_ptr->dun_level);
+               quest_discovery(random_quest_number(player_ptr, floor_ptr->dun_level));
+               floor_ptr->inside_quest = random_quest_number(player_ptr, floor_ptr->dun_level);
        }
-       if ((player_ptr->current_floor_ptr->dun_level == d_info[player_ptr->dungeon_idx].maxdepth) && d_info[player_ptr->dungeon_idx].final_guardian)
+       if ((floor_ptr->dun_level == d_info[player_ptr->dungeon_idx].maxdepth) && d_info[player_ptr->dungeon_idx].final_guardian)
        {
                if (r_info[d_info[player_ptr->dungeon_idx].final_guardian].max_num)
 #ifdef JP
@@ -5034,38 +5036,38 @@ static void dungeon(player_type *player_ptr, bool load_game)
        /*** Process this dungeon level ***/
 
        /* Reset the monster generation level */
-       player_ptr->current_floor_ptr->monster_level = player_ptr->current_floor_ptr->base_level;
+       floor_ptr->monster_level = floor_ptr->base_level;
 
        /* Reset the object generation level */
-       player_ptr->current_floor_ptr->object_level = player_ptr->current_floor_ptr->base_level;
+       floor_ptr->object_level = floor_ptr->base_level;
 
        current_world_ptr->is_loading_now = TRUE;
 
        if (player_ptr->energy_need > 0 && !player_ptr->phase_out &&
-           (player_ptr->current_floor_ptr->dun_level || player_ptr->leaving_dungeon || player_ptr->current_floor_ptr->inside_arena))
+           (floor_ptr->dun_level || player_ptr->leaving_dungeon || floor_ptr->inside_arena))
                player_ptr->energy_need = 0;
 
        /* Not leaving dungeon */
        player_ptr->leaving_dungeon = FALSE;
 
        /* Initialize monster process */
-       mproc_init();
+       mproc_init(floor_ptr);
 
        /* Main loop */
        while (TRUE)
        {
                /* Hack -- Compact the monster list occasionally */
-               if ((player_ptr->current_floor_ptr->m_cnt + 32 > current_world_ptr->max_m_idx) && !player_ptr->phase_out) compact_monsters(64);
+               if ((floor_ptr->m_cnt + 32 > current_world_ptr->max_m_idx) && !player_ptr->phase_out) compact_monsters(64);
 
                /* Hack -- Compress the monster list occasionally */
-               if ((player_ptr->current_floor_ptr->m_cnt + 32 < player_ptr->current_floor_ptr->m_max) && !player_ptr->phase_out) compact_monsters(0);
+               if ((floor_ptr->m_cnt + 32 < floor_ptr->m_max) && !player_ptr->phase_out) compact_monsters(0);
 
 
                /* Hack -- Compact the object list occasionally */
-               if (player_ptr->current_floor_ptr->o_cnt + 32 > current_world_ptr->max_o_idx) compact_objects(player_ptr, 64);
+               if (floor_ptr->o_cnt + 32 > current_world_ptr->max_o_idx) compact_objects(player_ptr, 64);
 
                /* Hack -- Compress the object list occasionally */
-               if (player_ptr->current_floor_ptr->o_cnt + 32 < player_ptr->current_floor_ptr->o_max) compact_objects(player_ptr, 0);
+               if (floor_ptr->o_cnt + 32 < floor_ptr->o_max) compact_objects(player_ptr, 0);
 
                /* Process the player */
                process_player(player_ptr);
@@ -5381,15 +5383,16 @@ void play_game(player_type *player_ptr, bool new_game)
        }
 
        /* Roll new character */
+       floor_type *floor_ptr = player_ptr->current_floor_ptr;
        if (new_game)
        {
                /* The dungeon is not ready */
                current_world_ptr->character_dungeon = FALSE;
 
                /* Start in town */
-               player_ptr->current_floor_ptr->dun_level = 0;
-               player_ptr->current_floor_ptr->inside_quest = 0;
-               player_ptr->current_floor_ptr->inside_arena = FALSE;
+               floor_ptr->dun_level = 0;
+               floor_ptr->inside_quest = 0;
+               floor_ptr->inside_arena = FALSE;
                player_ptr->phase_out = FALSE;
 
                write_level = TRUE;
@@ -5412,7 +5415,7 @@ void play_game(player_type *player_ptr, bool new_game)
                determine_daily_bounty(player_ptr, FALSE);
 
                /* Initialize object array */
-               wipe_o_list(player_ptr->current_floor_ptr);
+               wipe_o_list(floor_ptr);
        }
        else
        {
@@ -5429,9 +5432,9 @@ void play_game(player_type *player_ptr, bool new_game)
                if (player_ptr->riding == -1)
                {
                        player_ptr->riding = 0;
-                       for (i = player_ptr->current_floor_ptr->m_max; i > 0; i--)
+                       for (i = floor_ptr->m_max; i > 0; i--)
                        {
-                               if (player_bold(player_ptr, player_ptr->current_floor_ptr->m_list[i].fy, player_ptr->current_floor_ptr->m_list[i].fx))
+                               if (player_bold(player_ptr, floor_ptr->m_list[i].fy, floor_ptr->m_list[i].fx))
                                {
                                        player_ptr->riding = i;
                                        break;
@@ -5451,8 +5454,8 @@ void play_game(player_type *player_ptr, bool new_game)
        record_o_name[0] = '\0';
 
        /* Reset map panel */
-       panel_row_min = player_ptr->current_floor_ptr->height;
-       panel_col_min = player_ptr->current_floor_ptr->width;
+       panel_row_min = floor_ptr->height;
+       panel_col_min = floor_ptr->width;
 
        /* Sexy gal gets bonus to maximum weapon skill of whip */
        if (player_ptr->pseikaku == SEIKAKU_SEXY)
@@ -5484,7 +5487,7 @@ void play_game(player_type *player_ptr, bool new_game)
                                init_saved_floors(player_ptr, TRUE);
 
                                /* Avoid crash */
-                               player_ptr->current_floor_ptr->inside_quest = 0;
+                               floor_ptr->inside_quest = 0;
 
                                /* Avoid crash in update_view() */
                                player_ptr->y = player_ptr->x = 10;
@@ -5497,7 +5500,7 @@ void play_game(player_type *player_ptr, bool new_game)
        }
 
        /* Initialize the town-buildings if necessary */
-       if (!player_ptr->current_floor_ptr->dun_level && !player_ptr->current_floor_ptr->inside_quest)
+       if (!floor_ptr->dun_level && !floor_ptr->inside_quest)
        {
                process_dungeon_file(player_ptr, "w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x);
                init_flags = INIT_ONLY_BUILDINGS;
@@ -5581,7 +5584,7 @@ void play_game(player_type *player_ptr, bool new_game)
                monster_race *r_ptr = &r_info[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 = &player_ptr->current_floor_ptr->m_list[hack_m_idx_ii];
+               m_ptr = &floor_ptr->m_list[hack_m_idx_ii];
                m_ptr->mspeed = r_ptr->speed;
                m_ptr->maxhp = r_ptr->hdice*(r_ptr->hside+1)/2;
                m_ptr->max_maxhp = m_ptr->maxhp;
@@ -5613,14 +5616,14 @@ void play_game(player_type *player_ptr, bool new_game)
 
                health_track(player_ptr, 0);
 
-               forget_lite(player_ptr->current_floor_ptr);
-               forget_view(player_ptr->current_floor_ptr);
-               clear_mon_lite(player_ptr->current_floor_ptr);
+               forget_lite(floor_ptr);
+               forget_view(floor_ptr);
+               clear_mon_lite(floor_ptr);
 
                /* Handle "quit and save" */
                if (!player_ptr->playing && !player_ptr->is_dead) break;
 
-               wipe_o_list(player_ptr->current_floor_ptr);
+               wipe_o_list(floor_ptr);
                if (!player_ptr->is_dead) wipe_m_list();
 
 
@@ -5631,9 +5634,9 @@ void play_game(player_type *player_ptr, bool new_game)
                /* Accidental Death */
                if (player_ptr->playing && player_ptr->is_dead)
                {
-                       if (player_ptr->current_floor_ptr->inside_arena)
+                       if (floor_ptr->inside_arena)
                        {
-                               player_ptr->current_floor_ptr->inside_arena = FALSE;
+                               floor_ptr->inside_arena = FALSE;
                                if (player_ptr->arena_number > MAX_ARENA_MONS)
                                        player_ptr->arena_number++;
                                else
index 947a923..ad6fc96 100644 (file)
@@ -5850,7 +5850,7 @@ void do_cmd_save_game(player_type *creature_ptr, int is_autosave)
        update_creature(creature_ptr);
 
        /* Initialize monster process */
-       mproc_init();
+       mproc_init(creature_ptr->current_floor_ptr);
 
        /* HACK -- reset the hackish flag */
        current_world_ptr->is_loading_now = TRUE;
index b39c4c0..235105f 100644 (file)
@@ -1235,12 +1235,12 @@ void change_floor(player_type *creature_ptr)
                                        m_ptr->hp = m_ptr->maxhp = m_ptr->max_maxhp;
 
                                        /* Remove timed status (except MTIMED_CSLEEP) */
-                                       (void)set_monster_fast(i, 0);
-                                       (void)set_monster_slow(i, 0);
-                                       (void)set_monster_stunned(i, 0);
-                                       (void)set_monster_confused(i, 0);
-                                       (void)set_monster_monfear(i, 0);
-                                       (void)set_monster_invulner(i, 0, FALSE);
+                                       (void)set_monster_fast(creature_ptr, i, 0);
+                                       (void)set_monster_slow(creature_ptr, i, 0);
+                                       (void)set_monster_stunned(creature_ptr, i, 0);
+                                       (void)set_monster_confused(creature_ptr, i, 0);
+                                       (void)set_monster_monfear(creature_ptr, i, 0);
+                                       (void)set_monster_invulner(creature_ptr, i, 0, FALSE);
                                }
 
                                /* Extract real monster race */
index 1a541a7..ad8758f 100644 (file)
@@ -1247,7 +1247,7 @@ static bool cast_force_spell(player_type *caster_ptr, int spell)
                if (!m_idx) break;
                if (!player_has_los_bold(caster_ptr, target_row, target_col)) break;
                if (!projectable(caster_ptr, caster_ptr->y, caster_ptr->x, target_row, target_col)) break;
-               dispel_monster_status(m_idx);
+               dispel_monster_status(caster_ptr, m_idx);
                break;
        }
        case 10:
@@ -1681,7 +1681,7 @@ static bool cast_ninja_spell(player_type *caster_ptr, int spell)
                m_ptr->fx = tx;
 
                /* Wake the monster up */
-               (void)set_monster_csleep(m_idx, 0);
+               (void)set_monster_csleep(caster_ptr, m_idx, 0);
 
                update_monster(caster_ptr, m_idx, TRUE);
                lite_spot(target_row, target_col);
index 432758b..d43d40d 100644 (file)
@@ -1410,7 +1410,7 @@ void process_monster(player_type *target_ptr, MONSTER_IDX m_idx)
                /* Handle non-aggravation - Still sleeping */
                if (!(target_ptr->cursed & TRC_AGGRAVATE)) return;
 
-               (void)set_monster_csleep(m_idx, 0);
+               (void)set_monster_csleep(target_ptr, m_idx, 0);
 
                /* Notice the "waking up" */
                if (m_ptr->ml)
@@ -2069,7 +2069,7 @@ void process_monster(player_type *target_ptr, MONSTER_IDX m_idx)
                                did_move_body = TRUE;
 
                                /* Wake up the moved monster */
-                               (void)set_monster_csleep(g_ptr->m_idx, 0);
+                               (void)set_monster_csleep(target_ptr, g_ptr->m_idx, 0);
 
                                /* Message */
                        }
@@ -2391,7 +2391,7 @@ void process_monster(player_type *target_ptr, MONSTER_IDX m_idx)
        if (!is_battle_determined) return;
 
        /* No longer afraid */
-       (void)set_monster_monfear(m_idx, 0);
+       (void)set_monster_monfear(target_ptr, m_idx, 0);
 
        /* Message if seen */
        if (see_m)
index 2147a5b..89517c1 100644 (file)
@@ -3,6 +3,3 @@
 /* monster-process.c */
 extern void process_monsters(player_type *target_ptr);
 extern void process_monster(player_type *target_ptr, MONSTER_IDX m_idx);
-extern int get_mproc_idx(MONSTER_IDX m_idx, int mproc_type);
-extern void mproc_init(void);
-extern void process_monsters_mtimed(int mtimed_idx);
index 1088e20..0e0cda7 100644 (file)
@@ -183,16 +183,17 @@ static void get_exp_from_mon(player_type *target_ptr, HIT_POINT dam, monster_typ
 
 /*!
 * @brief モンスターの時限ステータスを取得する
+* @param floor_ptr 現在フロアへの参照ポインタ
 * @return m_idx モンスターの参照ID
 * @return mproc_type モンスターの時限ステータスID
 * @return 残りターン値
 */
-int get_mproc_idx(MONSTER_IDX m_idx, int mproc_type)
+int get_mproc_idx(floor_type *floor_ptr, MONSTER_IDX m_idx, int mproc_type)
 {
-       s16b *cur_mproc_list = p_ptr->current_floor_ptr->mproc_list[mproc_type];
+       s16b *cur_mproc_list = floor_ptr->mproc_list[mproc_type];
        int i;
 
-       for (i = p_ptr->current_floor_ptr->mproc_max[mproc_type] - 1; i >= 0; i--)
+       for (i = floor_ptr->mproc_max[mproc_type] - 1; i >= 0; i--)
        {
                if (cur_mproc_list[i] == m_idx) return i;
        }
@@ -202,53 +203,56 @@ int get_mproc_idx(MONSTER_IDX m_idx, int mproc_type)
 
 /*!
 * @brief モンスターの時限ステータスリストを追加する
+* @param floor_ptr 現在フロアへの参照ポインタ
 * @return m_idx モンスターの参照ID
 * @return mproc_type 追加したいモンスターの時限ステータスID
 * @return なし
 */
-static void mproc_add(MONSTER_IDX m_idx, int mproc_type)
+static void mproc_add(floor_type *floor_ptr, MONSTER_IDX m_idx, int mproc_type)
 {
-       if (p_ptr->current_floor_ptr->mproc_max[mproc_type] < current_world_ptr->max_m_idx) p_ptr->current_floor_ptr->mproc_list[mproc_type][p_ptr->current_floor_ptr->mproc_max[mproc_type]++] = (s16b)m_idx;
+       if (floor_ptr->mproc_max[mproc_type] < current_world_ptr->max_m_idx) floor_ptr->mproc_list[mproc_type][floor_ptr->mproc_max[mproc_type]++] = (s16b)m_idx;
 }
 
 
 /*!
 * @brief モンスターの時限ステータスリストを削除
+* @param floor_ptr 現在フロアへの参照ポインタ
 * @return m_idx モンスターの参照ID
 * @return mproc_type 削除したいモンスターの時限ステータスID
 * @return なし
 */
-static void mproc_remove(MONSTER_IDX m_idx, int mproc_type)
+static void mproc_remove(floor_type *floor_ptr, MONSTER_IDX m_idx, int mproc_type)
 {
-       int mproc_idx = get_mproc_idx(m_idx, mproc_type);
-       if (mproc_idx >= 0) p_ptr->current_floor_ptr->mproc_list[mproc_type][mproc_idx] = p_ptr->current_floor_ptr->mproc_list[mproc_type][--p_ptr->current_floor_ptr->mproc_max[mproc_type]];
+       int mproc_idx = get_mproc_idx(floor_ptr, m_idx, mproc_type);
+       if (mproc_idx >= 0) floor_ptr->mproc_list[mproc_type][mproc_idx] = floor_ptr->mproc_list[mproc_type][--floor_ptr->mproc_max[mproc_type]];
 }
 
 
 /*!
 * @brief モンスターの時限ステータスリストを初期化する / Initialize monster process
+* @param floor_ptr 現在フロアへの参照ポインタ
 * @return なし
 */
-void mproc_init(void)
+void mproc_init(floor_type *floor_ptr)
 {
        monster_type *m_ptr;
        MONSTER_IDX i;
        int cmi;
 
        /* Reset "p_ptr->current_floor_ptr->mproc_max[]" */
-       for (cmi = 0; cmi < MAX_MTIMED; cmi++) p_ptr->current_floor_ptr->mproc_max[cmi] = 0;
+       for (cmi = 0; cmi < MAX_MTIMED; cmi++) floor_ptr->mproc_max[cmi] = 0;
 
        /* Process the monsters (backwards) */
-       for (i = p_ptr->current_floor_ptr->m_max - 1; i >= 1; i--)
+       for (i = floor_ptr->m_max - 1; i >= 1; i--)
        {
-               m_ptr = &p_ptr->current_floor_ptr->m_list[i];
+               m_ptr = &floor_ptr->m_list[i];
 
                /* Ignore "dead" monsters */
                if (!monster_is_valid(m_ptr)) continue;
 
                for (cmi = 0; cmi < MAX_MTIMED; cmi++)
                {
-                       if (m_ptr->mtimed[cmi]) mproc_add(i, cmi);
+                       if (m_ptr->mtimed[cmi]) mproc_add(floor_ptr, i, cmi);
                }
        }
 }
@@ -257,13 +261,15 @@ void mproc_init(void)
 /*!
 * @brief モンスターの睡眠状態値をセットする。0で起きる。 /
 * Set "m_ptr->mtimed[MTIMED_CSLEEP]", notice observable changes
+* @param target_ptr プレーヤーへの参照ポインタ
 * @param m_idx モンスター参照ID
 * @param v セットする値
 * @return 別途更新処理が必要な場合TRUEを返す
 */
-bool set_monster_csleep(MONSTER_IDX m_idx, int v)
+bool set_monster_csleep(player_type *target_ptr, MONSTER_IDX m_idx, int v)
 {
-       monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx];
+       floor_type *floor_ptr = target_ptr->current_floor_ptr;
+       monster_type *m_ptr = &floor_ptr->m_list[m_idx];
        bool notice = FALSE;
        v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
 
@@ -271,7 +277,7 @@ bool set_monster_csleep(MONSTER_IDX m_idx, int v)
        {
                if (!MON_CSLEEP(m_ptr))
                {
-                       mproc_add(m_idx, MTIMED_CSLEEP);
+                       mproc_add(floor_ptr, m_idx, MTIMED_CSLEEP);
                        notice = TRUE;
                }
        }
@@ -280,7 +286,7 @@ bool set_monster_csleep(MONSTER_IDX m_idx, int v)
        {
                if (MON_CSLEEP(m_ptr))
                {
-                       mproc_remove(m_idx, MTIMED_CSLEEP);
+                       mproc_remove(floor_ptr, m_idx, MTIMED_CSLEEP);
                        notice = TRUE;
                }
        }
@@ -293,11 +299,11 @@ bool set_monster_csleep(MONSTER_IDX m_idx, int v)
        if (m_ptr->ml)
        {
                /* Update health bar as needed */
-               if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
-               if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
+               if (target_ptr->health_who == m_idx) target_ptr->redraw |= (PR_HEALTH);
+               if (target_ptr->riding == m_idx) target_ptr->redraw |= (PR_UHEALTH);
        }
 
-       if (r_info[m_ptr->r_idx].flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
+       if (r_info[m_ptr->r_idx].flags7 & RF7_HAS_LD_MASK) target_ptr->update |= (PU_MON_LITE);
 
        return TRUE;
 }
@@ -306,13 +312,15 @@ bool set_monster_csleep(MONSTER_IDX m_idx, int v)
 /*!
 * @brief モンスターの加速状態値をセット /
 * Set "m_ptr->mtimed[MTIMED_FAST]", notice observable changes
+* @param target_ptr プレーヤーへの参照ポインタ
 * @param m_idx モンスター参照ID
 * @param v セットする値
 * @return 別途更新処理が必要な場合TRUEを返す
 */
-bool set_monster_fast(MONSTER_IDX m_idx, int v)
+bool set_monster_fast(player_type *target_ptr, MONSTER_IDX m_idx, int v)
 {
-       monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx];
+       floor_type *floor_ptr = target_ptr->current_floor_ptr;
+       monster_type *m_ptr = &floor_ptr->m_list[m_idx];
        bool notice = FALSE;
        v = (v > 200) ? 200 : (v < 0) ? 0 : v;
 
@@ -320,7 +328,7 @@ bool set_monster_fast(MONSTER_IDX m_idx, int v)
        {
                if (!MON_FAST(m_ptr))
                {
-                       mproc_add(m_idx, MTIMED_FAST);
+                       mproc_add(floor_ptr, m_idx, MTIMED_FAST);
                        notice = TRUE;
                }
        }
@@ -329,7 +337,7 @@ bool set_monster_fast(MONSTER_IDX m_idx, int v)
        {
                if (MON_FAST(m_ptr))
                {
-                       mproc_remove(m_idx, MTIMED_FAST);
+                       mproc_remove(floor_ptr, m_idx, MTIMED_FAST);
                        notice = TRUE;
                }
        }
@@ -339,7 +347,7 @@ bool set_monster_fast(MONSTER_IDX m_idx, int v)
 
        if (!notice) return FALSE;
 
-       if ((p_ptr->riding == m_idx) && !p_ptr->leaving) p_ptr->update |= (PU_BONUS);
+       if ((target_ptr->riding == m_idx) && !p_ptr->leaving) target_ptr->update |= (PU_BONUS);
 
        return TRUE;
 }
@@ -348,9 +356,10 @@ bool set_monster_fast(MONSTER_IDX m_idx, int v)
 /*
 * Set "m_ptr->mtimed[MTIMED_SLOW]", notice observable changes
 */
-bool set_monster_slow(MONSTER_IDX m_idx, int v)
+bool set_monster_slow(player_type *target_ptr, MONSTER_IDX m_idx, int v)
 {
-       monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx];
+       floor_type *floor_ptr = target_ptr->current_floor_ptr;
+       monster_type *m_ptr = &floor_ptr->m_list[m_idx];
        bool notice = FALSE;
        v = (v > 200) ? 200 : (v < 0) ? 0 : v;
 
@@ -358,7 +367,7 @@ bool set_monster_slow(MONSTER_IDX m_idx, int v)
        {
                if (!MON_SLOW(m_ptr))
                {
-                       mproc_add(m_idx, MTIMED_SLOW);
+                       mproc_add(floor_ptr, m_idx, MTIMED_SLOW);
                        notice = TRUE;
                }
        }
@@ -367,7 +376,7 @@ bool set_monster_slow(MONSTER_IDX m_idx, int v)
        {
                if (MON_SLOW(m_ptr))
                {
-                       mproc_remove(m_idx, MTIMED_SLOW);
+                       mproc_remove(floor_ptr, m_idx, MTIMED_SLOW);
                        notice = TRUE;
                }
        }
@@ -377,7 +386,7 @@ bool set_monster_slow(MONSTER_IDX m_idx, int v)
 
        if (!notice) return FALSE;
 
-       if ((p_ptr->riding == m_idx) && !p_ptr->leaving) p_ptr->update |= (PU_BONUS);
+       if ((target_ptr->riding == m_idx) && !target_ptr->leaving) target_ptr->update |= (PU_BONUS);
 
        return TRUE;
 }
@@ -386,13 +395,15 @@ bool set_monster_slow(MONSTER_IDX m_idx, int v)
 /*!
 * @brief モンスターの朦朧状態値をセット /
 * Set "m_ptr->mtimed[MTIMED_STUNNED]", notice observable changes
+* @param target_ptr プレーヤーへの参照ポインタ
 * @param m_idx モンスター参照ID
 * @param v セットする値
 * @return 別途更新処理が必要な場合TRUEを返す
 */
-bool set_monster_stunned(MONSTER_IDX m_idx, int v)
+bool set_monster_stunned(player_type *target_ptr, MONSTER_IDX m_idx, int v)
 {
-       monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx];
+       floor_type *floor_ptr = target_ptr->current_floor_ptr;
+       monster_type *m_ptr = &floor_ptr->m_list[m_idx];
        bool notice = FALSE;
        v = (v > 200) ? 200 : (v < 0) ? 0 : v;
 
@@ -400,7 +411,7 @@ bool set_monster_stunned(MONSTER_IDX m_idx, int v)
        {
                if (!MON_STUNNED(m_ptr))
                {
-                       mproc_add(m_idx, MTIMED_STUNNED);
+                       mproc_add(floor_ptr, m_idx, MTIMED_STUNNED);
                        notice = TRUE;
                }
        }
@@ -409,7 +420,7 @@ bool set_monster_stunned(MONSTER_IDX m_idx, int v)
        {
                if (MON_STUNNED(m_ptr))
                {
-                       mproc_remove(m_idx, MTIMED_STUNNED);
+                       mproc_remove(floor_ptr, m_idx, MTIMED_STUNNED);
                        notice = TRUE;
                }
        }
@@ -424,13 +435,15 @@ bool set_monster_stunned(MONSTER_IDX m_idx, int v)
 /*!
 * @brief モンスターの混乱状態値をセット /
 * Set "m_ptr->mtimed[MTIMED_CONFUSED]", notice observable changes
+* @param target_ptr プレーヤーへの参照ポインタ
 * @param m_idx モンスター参照ID
 * @param v セットする値
 * @return 別途更新処理が必要な場合TRUEを返す
 */
-bool set_monster_confused(MONSTER_IDX m_idx, int v)
+bool set_monster_confused(player_type *target_ptr, MONSTER_IDX m_idx, int v)
 {
-       monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx];
+       floor_type *floor_ptr = target_ptr->current_floor_ptr;
+       monster_type *m_ptr = &floor_ptr->m_list[m_idx];
        bool notice = FALSE;
        v = (v > 200) ? 200 : (v < 0) ? 0 : v;
 
@@ -438,7 +451,7 @@ bool set_monster_confused(MONSTER_IDX m_idx, int v)
        {
                if (!MON_CONFUSED(m_ptr))
                {
-                       mproc_add(m_idx, MTIMED_CONFUSED);
+                       mproc_add(floor_ptr, m_idx, MTIMED_CONFUSED);
                        notice = TRUE;
                }
        }
@@ -447,7 +460,7 @@ bool set_monster_confused(MONSTER_IDX m_idx, int v)
        {
                if (MON_CONFUSED(m_ptr))
                {
-                       mproc_remove(m_idx, MTIMED_CONFUSED);
+                       mproc_remove(floor_ptr, m_idx, MTIMED_CONFUSED);
                        notice = TRUE;
                }
        }
@@ -462,13 +475,15 @@ bool set_monster_confused(MONSTER_IDX m_idx, int v)
 /*!
 * @brief モンスターの恐慌状態値をセット /
 * Set "m_ptr->mtimed[MTIMED_MONFEAR]", notice observable changes
+* @param target_ptr プレーヤーへの参照ポインタ
 * @param m_idx モンスター参照ID
 * @param v セットする値
 * @return 別途更新処理が必要な場合TRUEを返す
 */
-bool set_monster_monfear(MONSTER_IDX m_idx, int v)
+bool set_monster_monfear(player_type *target_ptr, MONSTER_IDX m_idx, int v)
 {
-       monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx];
+       floor_type *floor_ptr = target_ptr->current_floor_ptr;
+       monster_type *m_ptr = &floor_ptr->m_list[m_idx];
        bool notice = FALSE;
        v = (v > 200) ? 200 : (v < 0) ? 0 : v;
 
@@ -476,7 +491,7 @@ bool set_monster_monfear(MONSTER_IDX m_idx, int v)
        {
                if (!MON_MONFEAR(m_ptr))
                {
-                       mproc_add(m_idx, MTIMED_MONFEAR);
+                       mproc_add(floor_ptr, m_idx, MTIMED_MONFEAR);
                        notice = TRUE;
                }
        }
@@ -485,7 +500,7 @@ bool set_monster_monfear(MONSTER_IDX m_idx, int v)
        {
                if (MON_MONFEAR(m_ptr))
                {
-                       mproc_remove(m_idx, MTIMED_MONFEAR);
+                       mproc_remove(floor_ptr, m_idx, MTIMED_MONFEAR);
                        notice = TRUE;
                }
        }
@@ -498,8 +513,8 @@ bool set_monster_monfear(MONSTER_IDX m_idx, int v)
        if (m_ptr->ml)
        {
                /* Update health bar as needed */
-               if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
-               if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
+               if (target_ptr->health_who == m_idx) target_ptr->redraw |= (PR_HEALTH);
+               if (target_ptr->riding == m_idx) target_ptr->redraw |= (PR_UHEALTH);
        }
 
        return TRUE;
@@ -509,14 +524,16 @@ bool set_monster_monfear(MONSTER_IDX m_idx, int v)
 /*!
 * @brief モンスターの無敵状態値をセット /
 * Set "m_ptr->mtimed[MTIMED_INVULNER]", notice observable changes
+* @param target_ptr プレーヤーへの参照ポインタ
 * @param m_idx モンスター参照ID
 * @param v セットする値
 * @param energy_need TRUEならば無敵解除時に行動ターン消費を行う
 * @return 別途更新処理が必要な場合TRUEを返す
 */
-bool set_monster_invulner(MONSTER_IDX m_idx, int v, bool energy_need)
+bool set_monster_invulner(player_type *target_ptr, MONSTER_IDX m_idx, int v, bool energy_need)
 {
-       monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx];
+       floor_type *floor_ptr = target_ptr->current_floor_ptr;
+       monster_type *m_ptr = &floor_ptr->m_list[m_idx];
        bool notice = FALSE;
        v = (v > 200) ? 200 : (v < 0) ? 0 : v;
 
@@ -524,7 +541,7 @@ bool set_monster_invulner(MONSTER_IDX m_idx, int v, bool energy_need)
        {
                if (!MON_INVULNER(m_ptr))
                {
-                       mproc_add(m_idx, MTIMED_INVULNER);
+                       mproc_add(floor_ptr, m_idx, MTIMED_INVULNER);
                        notice = TRUE;
                }
        }
@@ -533,8 +550,8 @@ bool set_monster_invulner(MONSTER_IDX m_idx, int v, bool energy_need)
        {
                if (MON_INVULNER(m_ptr))
                {
-                       mproc_remove(m_idx, MTIMED_INVULNER);
-                       if (energy_need && !p_ptr->wild_mode) m_ptr->energy_need += ENERGY_NEED();
+                       mproc_remove(floor_ptr, m_idx, MTIMED_INVULNER);
+                       if (energy_need && !target_ptr->wild_mode) m_ptr->energy_need += ENERGY_NEED();
                        notice = TRUE;
                }
        }
@@ -547,8 +564,8 @@ bool set_monster_invulner(MONSTER_IDX m_idx, int v, bool energy_need)
        if (m_ptr->ml)
        {
                /* Update health bar as needed */
-               if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
-               if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
+               if (target_ptr->health_who == m_idx) target_ptr->redraw |= (PR_HEALTH);
+               if (target_ptr->riding == m_idx) target_ptr->redraw |= (PR_UHEALTH);
        }
 
        return TRUE;
@@ -559,11 +576,12 @@ static u32b csleep_noise;
 
 /*!
 * @brief モンスターの各種状態値を時間経過により更新するサブルーチン
+* @param floor_ptr 現在フロアへの参照ポインタ
 * @param m_idx モンスター参照ID
 * @param mtimed_idx 更新するモンスターの時限ステータスID
 * @return なし
 */
-static void process_monsters_mtimed_aux(MONSTER_IDX m_idx, int mtimed_idx)
+static void process_monsters_mtimed_aux(player_type *target_ptr, MONSTER_IDX m_idx, int mtimed_idx)
 {
        monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx];
 
@@ -615,7 +633,7 @@ static void process_monsters_mtimed_aux(MONSTER_IDX m_idx, int mtimed_idx)
                                /* Monster wakes up "a little bit" */
 
                                /* Still asleep */
-                               if (!set_monster_csleep(m_idx, MON_CSLEEP(m_ptr) - d))
+                               if (!set_monster_csleep(target_ptr, m_idx, MON_CSLEEP(m_ptr) - d))
                                {
                                        /* Notice the "not waking up" */
                                        if (is_original_ap_and_seen(m_ptr))
@@ -649,7 +667,7 @@ static void process_monsters_mtimed_aux(MONSTER_IDX m_idx, int mtimed_idx)
 
        case MTIMED_FAST:
                /* Reduce by one, note if expires */
-               if (set_monster_fast(m_idx, MON_FAST(m_ptr) - 1))
+               if (set_monster_fast(target_ptr, m_idx, MON_FAST(m_ptr) - 1))
                {
                        if (is_seen(m_ptr))
                        {
@@ -662,7 +680,7 @@ static void process_monsters_mtimed_aux(MONSTER_IDX m_idx, int mtimed_idx)
 
        case MTIMED_SLOW:
                /* Reduce by one, note if expires */
-               if (set_monster_slow(m_idx, MON_SLOW(m_ptr) - 1))
+               if (set_monster_slow(target_ptr, m_idx, MON_SLOW(m_ptr) - 1))
                {
                        if (is_seen(m_ptr))
                        {
@@ -678,7 +696,7 @@ static void process_monsters_mtimed_aux(MONSTER_IDX m_idx, int mtimed_idx)
                int rlev = r_info[m_ptr->r_idx].level;
 
                /* Recover from stun */
-               if (set_monster_stunned(m_idx, (randint0(10000) <= rlev * rlev) ? 0 : (MON_STUNNED(m_ptr) - 1)))
+               if (set_monster_stunned(target_ptr, m_idx, (randint0(10000) <= rlev * rlev) ? 0 : (MON_STUNNED(m_ptr) - 1)))
                {
                        /* Message if visible */
                        if (is_seen(m_ptr))
@@ -693,7 +711,7 @@ static void process_monsters_mtimed_aux(MONSTER_IDX m_idx, int mtimed_idx)
 
        case MTIMED_CONFUSED:
                /* Reduce the confusion */
-               if (set_monster_confused(m_idx, MON_CONFUSED(m_ptr) - randint1(r_info[m_ptr->r_idx].level / 20 + 1)))
+               if (set_monster_confused(target_ptr, m_idx, MON_CONFUSED(m_ptr) - randint1(r_info[m_ptr->r_idx].level / 20 + 1)))
                {
                        /* Message if visible */
                        if (is_seen(m_ptr))
@@ -707,7 +725,7 @@ static void process_monsters_mtimed_aux(MONSTER_IDX m_idx, int mtimed_idx)
 
        case MTIMED_MONFEAR:
                /* Reduce the fear */
-               if (set_monster_monfear(m_idx, MON_MONFEAR(m_ptr) - randint1(r_info[m_ptr->r_idx].level / 20 + 1)))
+               if (set_monster_monfear(target_ptr, m_idx, MON_MONFEAR(m_ptr) - randint1(r_info[m_ptr->r_idx].level / 20 + 1)))
                {
                        /* Visual note */
                        if (is_seen(m_ptr))
@@ -731,7 +749,7 @@ static void process_monsters_mtimed_aux(MONSTER_IDX m_idx, int mtimed_idx)
 
        case MTIMED_INVULNER:
                /* Reduce by one, note if expires */
-               if (set_monster_invulner(m_idx, MON_INVULNER(m_ptr) - 1, TRUE))
+               if (set_monster_invulner(target_ptr, m_idx, MON_INVULNER(m_ptr) - 1, TRUE))
                {
                        if (is_seen(m_ptr))
                        {
@@ -748,46 +766,50 @@ static void process_monsters_mtimed_aux(MONSTER_IDX m_idx, int mtimed_idx)
 /*!
 * @brief 全モンスターの各種状態値を時間経過により更新するメインルーチン
 * @param mtimed_idx 更新するモンスターの時限ステータスID
+* @param target_ptr プレーヤーへの参照ポインタ
 * @return なし
 * @details
 * Process the counters of monsters (once per 10 game turns)\n
 * These functions are to process monsters' counters same as player's.
 */
-void process_monsters_mtimed(int mtimed_idx)
+void process_monsters_mtimed(player_type *target_ptr, int mtimed_idx)
 {
        int  i;
-       s16b *cur_mproc_list = p_ptr->current_floor_ptr->mproc_list[mtimed_idx];
+       floor_type *floor_ptr = target_ptr->current_floor_ptr;
+       s16b *cur_mproc_list = floor_ptr->mproc_list[mtimed_idx];
 
        /* Hack -- calculate the "player noise" */
        if (mtimed_idx == MTIMED_CSLEEP) csleep_noise = (1L << (30 - p_ptr->skill_stl));
 
        /* Process the monsters (backwards) */
-       for (i = p_ptr->current_floor_ptr->mproc_max[mtimed_idx] - 1; i >= 0; i--)
+       for (i = floor_ptr->mproc_max[mtimed_idx] - 1; i >= 0; i--)
        {
-               process_monsters_mtimed_aux(cur_mproc_list[i], mtimed_idx);
+               process_monsters_mtimed_aux(target_ptr, cur_mproc_list[i], mtimed_idx);
        }
 }
 
+
 /*!
 * @brief モンスターへの魔力消去処理
+* @param target_ptr プレーヤーへの参照ポインタ
 * @param m_idx 魔力消去を受けるモンスターの参照ID
 * @return なし
 */
-void dispel_monster_status(MONSTER_IDX m_idx)
+void dispel_monster_status(player_type *target_ptr, MONSTER_IDX m_idx)
 {
        monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx];
        GAME_TEXT m_name[MAX_NLEN];
 
        monster_desc(m_name, m_ptr, 0);
-       if (set_monster_invulner(m_idx, 0, TRUE))
+       if (set_monster_invulner(target_ptr, m_idx, 0, TRUE))
        {
                if (m_ptr->ml) msg_format(_("%sはもう無敵ではない。", "%^s is no longer invulnerable."), m_name);
        }
-       if (set_monster_fast(m_idx, 0))
+       if (set_monster_fast(target_ptr, m_idx, 0))
        {
                if (m_ptr->ml) msg_format(_("%sはもう加速されていない。", "%^s is no longer fast."), m_name);
        }
-       if (set_monster_slow(m_idx, 0))
+       if (set_monster_slow(target_ptr, m_idx, 0))
        {
                if (m_ptr->ml) msg_format(_("%sはもう減速されていない。", "%^s is no longer slow."), m_name);
        }
@@ -1020,7 +1042,7 @@ bool mon_take_hit(player_type *target_ptr, MONSTER_IDX m_idx, HIT_POINT dam, boo
        if (target_ptr->health_who == m_idx) target_ptr->redraw |= (PR_HEALTH);
        if (target_ptr->riding == m_idx) target_ptr->redraw |= (PR_UHEALTH);
 
-       (void)set_monster_csleep(m_idx, 0);
+       (void)set_monster_csleep(target_ptr, m_idx, 0);
 
        /* Hack - Cancel any special player stealth magics. -LM- */
        if (target_ptr->special_defense & NINJA_S_STEALTH)
@@ -1370,7 +1392,7 @@ bool mon_take_hit(player_type *target_ptr, MONSTER_IDX m_idx, HIT_POINT dam, boo
        if (MON_MONFEAR(m_ptr) && (dam > 0))
        {
                /* Cure fear */
-               if (set_monster_monfear(m_idx, MON_MONFEAR(m_ptr) - randint1(dam)))
+               if (set_monster_monfear(target_ptr, m_idx, MON_MONFEAR(m_ptr) - randint1(dam)))
                {
                        /* No more fear */
                        (*fear) = FALSE;
@@ -1393,7 +1415,7 @@ bool mon_take_hit(player_type *target_ptr, MONSTER_IDX m_idx, HIT_POINT dam, boo
                        (*fear) = TRUE;
 
                        /* Hack -- Add some timed fear */
-                       (void)set_monster_monfear(m_idx, (randint1(10) +
+                       (void)set_monster_monfear(target_ptr, m_idx, (randint1(10) +
                                (((dam >= m_ptr->hp) && (percentage > 7)) ?
                                        20 : ((11 - percentage) * 5))));
                }
index 5e729be..0813980 100644 (file)
@@ -5,17 +5,21 @@ extern DEPTH monster_level_idx(floor_type *floor_ptr, MONSTER_IDX m_idx);
 
 extern HIT_POINT mon_damage_mod(player_type *target_ptr, monster_type *m_ptr, HIT_POINT dam, bool is_psy_spear);
 extern bool mon_take_hit(player_type *target_ptr, MONSTER_IDX m_idx, HIT_POINT dam, bool *fear, concptr note);
-extern int get_mproc_idx(MONSTER_IDX m_idx, int mproc_type);
+extern int get_mproc_idx(floor_type *floor_ptr, MONSTER_IDX m_idx, int mproc_type);
 extern bool monster_is_valid(monster_type *m_ptr);
 
-extern bool set_monster_csleep(MONSTER_IDX m_idx, int v);
-extern bool set_monster_fast(MONSTER_IDX m_idx, int v);
-extern bool set_monster_slow(MONSTER_IDX m_idx, int v);
-extern bool set_monster_stunned(MONSTER_IDX m_idx, int v);
-extern bool set_monster_confused(MONSTER_IDX m_idx, int v);
-extern bool set_monster_monfear(MONSTER_IDX m_idx, int v);
-extern bool set_monster_invulner(MONSTER_IDX m_idx, int v, bool energy_need);
+extern bool set_monster_csleep(player_type *target_ptr, MONSTER_IDX m_idx, int v);
+extern bool set_monster_fast(player_type *target_ptr, MONSTER_IDX m_idx, int v);
+extern bool set_monster_slow(player_type *target_ptr, MONSTER_IDX m_idx, int v);
+extern bool set_monster_stunned(player_type *target_ptr, MONSTER_IDX m_idx, int v);
+extern bool set_monster_confused(player_type *target_ptr, MONSTER_IDX m_idx, int v);
+extern bool set_monster_monfear(player_type *target_ptr, MONSTER_IDX m_idx, int v);
+extern bool set_monster_invulner(player_type *target_ptr, MONSTER_IDX m_idx, int v, bool energy_need);
 extern bool set_monster_timewalk(player_type *target_ptr, int num, MONSTER_IDX who, bool vs_player);
 
-extern void dispel_monster_status(MONSTER_IDX m_idx);
+extern void dispel_monster_status(player_type *target_ptr, MONSTER_IDX m_idx);
 extern void monster_gain_exp(MONSTER_IDX m_idx, MONRACE_IDX s_idx);
+
+extern int get_mproc_idx(floor_type *floor_ptr, MONSTER_IDX m_idx, int mproc_type);
+extern void mproc_init(floor_type *floor_ptr);
+extern void process_monsters_mtimed(player_type *target_ptr, int mtimed_idx);
index fc7fb90..dcafa42 100644 (file)
@@ -127,13 +127,13 @@ void delete_monster_idx(MONSTER_IDX i)
        /* Hack -- count the number of "reproducers" */
        if (r_ptr->flags2 & (RF2_MULTIPLY)) p_ptr->current_floor_ptr->num_repro--;
 
-       if (MON_CSLEEP(m_ptr)) (void)set_monster_csleep(i, 0);
-       if (MON_FAST(m_ptr)) (void)set_monster_fast(i, 0);
-       if (MON_SLOW(m_ptr)) (void)set_monster_slow(i, 0);
-       if (MON_STUNNED(m_ptr)) (void)set_monster_stunned(i, 0);
-       if (MON_CONFUSED(m_ptr)) (void)set_monster_confused(i, 0);
-       if (MON_MONFEAR(m_ptr)) (void)set_monster_monfear(i, 0);
-       if (MON_INVULNER(m_ptr)) (void)set_monster_invulner(i, 0, FALSE);
+       if (MON_CSLEEP(m_ptr)) (void)set_monster_csleep(p_ptr, i, 0);
+       if (MON_FAST(m_ptr)) (void)set_monster_fast(p_ptr, i, 0);
+       if (MON_SLOW(m_ptr)) (void)set_monster_slow(p_ptr, i, 0);
+       if (MON_STUNNED(m_ptr)) (void)set_monster_stunned(p_ptr, i, 0);
+       if (MON_CONFUSED(m_ptr)) (void)set_monster_confused(p_ptr, i, 0);
+       if (MON_MONFEAR(m_ptr)) (void)set_monster_monfear(p_ptr, i, 0);
+       if (MON_INVULNER(m_ptr)) (void)set_monster_invulner(p_ptr, i, 0, FALSE);
 
        /* Hack -- remove target monster */
        if (i == target_who) target_who = 0;
@@ -193,13 +193,14 @@ static void compact_monsters_aux(MONSTER_IDX i1, MONSTER_IDX i2)
        if (i1 == i2) return;
 
        /* Old monster */
-       m_ptr = &p_ptr->current_floor_ptr->m_list[i1];
+       floor_type *floor_ptr = p_ptr->current_floor_ptr;
+       m_ptr = &floor_ptr->m_list[i1];
 
        y = m_ptr->fy;
        x = m_ptr->fx;
 
        /* Cave grid */
-       g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x];
+       g_ptr = &floor_ptr->grid_array[y][x];
 
        g_ptr->m_idx = i2;
 
@@ -207,7 +208,7 @@ static void compact_monsters_aux(MONSTER_IDX i1, MONSTER_IDX i2)
        for (this_o_idx = m_ptr->hold_o_idx; this_o_idx; this_o_idx = next_o_idx)
        {
                object_type *o_ptr;
-               o_ptr = &p_ptr->current_floor_ptr->o_list[this_o_idx];
+               o_ptr = &floor_ptr->o_list[this_o_idx];
                next_o_idx = o_ptr->next_o_idx;
 
                /* Reset monster pointer */
@@ -230,9 +231,9 @@ static void compact_monsters_aux(MONSTER_IDX i1, MONSTER_IDX i2)
        /* Hack -- Update parent index */
        if (is_pet(m_ptr))
        {
-               for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++)
+               for (i = 1; i < floor_ptr->m_max; i++)
                {
-                       monster_type *m2_ptr = &p_ptr->current_floor_ptr->m_list[i];
+                       monster_type *m2_ptr = &floor_ptr->m_list[i];
 
                        if (m2_ptr->parent_m_idx == i1)
                                m2_ptr->parent_m_idx = i2;
@@ -240,15 +241,15 @@ static void compact_monsters_aux(MONSTER_IDX i1, MONSTER_IDX i2)
        }
 
        /* Structure copy */
-       (void)COPY(&p_ptr->current_floor_ptr->m_list[i2], &p_ptr->current_floor_ptr->m_list[i1], monster_type);
+       (void)COPY(&floor_ptr->m_list[i2], &floor_ptr->m_list[i1], monster_type);
 
        /* Wipe the hole */
-       (void)WIPE(&p_ptr->current_floor_ptr->m_list[i1], monster_type);
+       (void)WIPE(&floor_ptr->m_list[i1], monster_type);
 
        for (i = 0; i < MAX_MTIMED; i++)
        {
-               int mproc_idx = get_mproc_idx(i1, i);
-               if (mproc_idx >= 0) p_ptr->current_floor_ptr->mproc_list[i][mproc_idx] = i2;
+               int mproc_idx = get_mproc_idx(floor_ptr, i1, i);
+               if (mproc_idx >= 0) floor_ptr->mproc_list[i][mproc_idx] = i2;
        }
 }
 
@@ -2701,7 +2702,7 @@ static bool place_monster_one(MONSTER_IDX who, POSITION y, POSITION x, MONRACE_I
        if ((mode & PM_ALLOW_SLEEP) && r_ptr->sleep && !ironman_nightmare)
        {
                int val = r_ptr->sleep;
-               (void)set_monster_csleep(g_ptr->m_idx, (val * 2) + randint1(val * 10));
+               (void)set_monster_csleep(p_ptr, g_ptr->m_idx, (val * 2) + randint1(val * 10));
        }
 
        /* Assign maximal hitpoints */
@@ -2737,8 +2738,8 @@ static bool place_monster_one(MONSTER_IDX who, POSITION y, POSITION x, MONRACE_I
        /* Extract the monster base speed */
        m_ptr->mspeed = get_mspeed(r_ptr);
 
-       if (mode & PM_HASTE) (void)set_monster_fast(g_ptr->m_idx, 100);
-
+       if (mode & PM_HASTE) (void)set_monster_fast(p_ptr, g_ptr->m_idx, 100);
+       
        /* Give a random starting energy */
        if (!ironman_nightmare)
        {
index 842644d..a511925 100644 (file)
@@ -879,7 +879,7 @@ static bool cast_learned_spell(player_type *caster_ptr, int spell, bool success)
                if (!m_idx) break;
                if (!player_has_los_bold(caster_ptr, target_row, target_col)) break;
                if (!projectable(caster_ptr, caster_ptr->y, caster_ptr->x, target_row, target_col)) break;
-               dispel_monster_status(m_idx);
+               dispel_monster_status(caster_ptr, m_idx);
                break;
        }
        case MS_ROCKET:
index 2dd2eb2..62f8692 100644 (file)
@@ -193,7 +193,7 @@ void spell_RF4_SHRIEK(MONSTER_IDX m_idx, player_type *target_ptr, MONSTER_IDX t_
 
        if (TARGET_TYPE == MONSTER_TO_MONSTER)
        {
-               set_monster_csleep(t_idx, 0);
+               set_monster_csleep(target_ptr, t_idx, 0);
        }
 }
 
@@ -220,7 +220,7 @@ void spell_RF4_DISPEL(MONSTER_IDX m_idx, player_type *target_ptr, MONSTER_IDX t_
        if (TARGET_TYPE == MONSTER_TO_PLAYER)
        {
                dispel_player(target_ptr);
-               if (target_ptr->riding) dispel_monster_status(target_ptr->riding);
+               if (target_ptr->riding) dispel_monster_status(target_ptr, target_ptr->riding);
 
                if ((target_ptr->pseikaku == SEIKAKU_COMBAT) || (target_ptr->inventory_list[INVEN_BOW].name1 == ART_CRIMSON))
                        msg_print(_("やりやがったな!", ""));
@@ -237,7 +237,7 @@ void spell_RF4_DISPEL(MONSTER_IDX m_idx, player_type *target_ptr, MONSTER_IDX t_
        if (TARGET_TYPE == MONSTER_TO_MONSTER)
        {
                if (t_idx == target_ptr->riding) dispel_player(target_ptr);
-               dispel_monster_status(t_idx);
+               dispel_monster_status(target_ptr, t_idx);
        }
 }
 
@@ -1537,7 +1537,7 @@ void spell_badstatus_message(player_type *target_ptr, MONSTER_IDX m_idx, MONSTER
                if (see_t) msg_format(msg4, t_name);
        }
 
-       set_monster_csleep(t_idx, 0);
+       set_monster_csleep(target_ptr, t_idx, 0);
 }
 
 
@@ -1590,7 +1590,7 @@ void spell_RF5_SCARE(MONSTER_IDX m_idx, player_type *target_ptr, MONSTER_IDX t_i
 
        if (!resist && !saving_throw)
        {
-               set_monster_monfear(t_idx, MON_MONFEAR(t_ptr) + randint0(4) + 4);
+               set_monster_monfear(target_ptr, t_idx, MON_MONFEAR(t_ptr) + randint0(4) + 4);
        }
 }
 
@@ -1657,7 +1657,7 @@ void spell_RF5_BLIND(MONSTER_IDX m_idx, player_type *target_ptr, MONSTER_IDX t_i
 
        if (!resist && !saving_throw)
        {
-               (void)set_monster_confused(t_idx, MON_CONFUSED(t_ptr) + 12 + randint0(4));
+               (void)set_monster_confused(target_ptr, t_idx, MON_CONFUSED(t_ptr) + 12 + randint0(4));
        }
 }
 
@@ -1711,7 +1711,7 @@ void spell_RF5_CONF(MONSTER_IDX m_idx, player_type *target_ptr, MONSTER_IDX t_id
 
        if (!resist && !saving_throw)
        {
-               (void)set_monster_confused(t_idx, MON_CONFUSED(t_ptr) + 12 + randint0(4));
+               (void)set_monster_confused(target_ptr, t_idx, MON_CONFUSED(t_ptr) + 12 + randint0(4));
        }
 }
 
@@ -1778,7 +1778,7 @@ void spell_RF5_SLOW(MONSTER_IDX m_idx, player_type *target_ptr, MONSTER_IDX t_id
 
        if (!resist && !saving_throw)
        {
-               set_monster_slow(t_idx, MON_SLOW(t_ptr) + 50);
+               set_monster_slow(target_ptr, t_idx, MON_SLOW(t_ptr) + 50);
        }
 }
 
@@ -1832,7 +1832,7 @@ void spell_RF5_HOLD(MONSTER_IDX m_idx, player_type *target_ptr, MONSTER_IDX t_id
 
        if (!resist && !saving_throw)
        {
-               (void)set_monster_stunned(t_idx, MON_STUNNED(t_ptr) + randint1(4) + 4);
+               (void)set_monster_stunned(target_ptr, t_idx, MON_STUNNED(t_ptr) + randint1(4) + 4);
        }
 }
 
@@ -1860,7 +1860,7 @@ void spell_RF6_HASTE(player_type *target_ptr, MONSTER_IDX m_idx, MONSTER_IDX t_i
                target_ptr->blind > 0, TARGET_TYPE);
 
        /* Allow quick speed increases to base+10 */
-       if (set_monster_fast(m_idx, MON_FAST(m_ptr) + 100))
+       if (set_monster_fast(target_ptr, m_idx, MON_FAST(m_ptr) + 100))
        {
                if (TARGET_TYPE == MONSTER_TO_PLAYER ||
                        (TARGET_TYPE == MONSTER_TO_MONSTER && see_m))
@@ -1963,7 +1963,7 @@ void spell_RF6_HEAL(player_type *target_ptr, MONSTER_IDX m_idx, MONSTER_IDX t_id
        if (!MON_MONFEAR(m_ptr)) return;
 
        /* Cancel fear */
-       (void)set_monster_monfear(m_idx, 0);
+       (void)set_monster_monfear(target_ptr, m_idx, 0);
 
        if (see_monster(floor_ptr, m_idx))
                msg_format(_("%^sは勇気を取り戻した。", "%^s recovers %s courage."), m_name);
@@ -1989,7 +1989,7 @@ void spell_RF6_INVULNER(player_type *target_ptr, MONSTER_IDX m_idx, MONSTER_IDX
                _("%sは無傷の球の呪文を唱えた。", "%^s casts a Globe of Invulnerability."),
                !seen, TARGET_TYPE);
 
-       if (!MON_INVULNER(m_ptr)) (void)set_monster_invulner(m_idx, randint1(4) + 4, FALSE);
+       if (!MON_INVULNER(m_ptr)) (void)set_monster_invulner(target_ptr, m_idx, randint1(4) + 4, FALSE);
 }
 
 
@@ -2379,7 +2379,7 @@ void spell_RF6_TELE_TO(player_type *target_ptr, MONSTER_IDX m_idx, MONSTER_IDX t
 
        if (resists_tele)
        {
-               set_monster_csleep(t_idx, 0);
+               set_monster_csleep(target_ptr, t_idx, 0);
                return;
        }
 
@@ -2387,7 +2387,7 @@ void spell_RF6_TELE_TO(player_type *target_ptr, MONSTER_IDX m_idx, MONSTER_IDX t
                teleport_player_to(target_ptr, m_ptr->fy, m_ptr->fx, TELEPORT_PASSIVE);
        else
                teleport_monster_to(target_ptr, t_idx, m_ptr->fy, m_ptr->fx, 100, TELEPORT_PASSIVE);
-       set_monster_csleep(t_idx, 0);
+       set_monster_csleep(target_ptr, t_idx, 0);
 }
 
 
@@ -2455,7 +2455,7 @@ void spell_RF6_TELE_AWAY(player_type *target_ptr, MONSTER_IDX m_idx, MONSTER_IDX
 
        if (resists_tele)
        {
-               set_monster_csleep(t_idx, 0);
+               set_monster_csleep(target_ptr, t_idx, 0);
                return;
        }
 
@@ -2463,7 +2463,7 @@ void spell_RF6_TELE_AWAY(player_type *target_ptr, MONSTER_IDX m_idx, MONSTER_IDX
                teleport_player_away(m_idx, target_ptr, MAX_SIGHT * 2 + 5);
        else
                teleport_away(target_ptr, t_idx, MAX_SIGHT * 2 + 5, TELEPORT_PASSIVE);
-       set_monster_csleep(t_idx, 0);
+       set_monster_csleep(target_ptr, t_idx, 0);
 }
 
 
index 311ff6b..cc939f5 100644 (file)
@@ -272,9 +272,9 @@ void reset_tim_flags(player_type *creature_ptr)
 
        if (creature_ptr->riding)
        {
-               (void)set_monster_fast(creature_ptr->riding, 0);
-               (void)set_monster_slow(creature_ptr->riding, 0);
-               (void)set_monster_invulner(creature_ptr->riding, 0, FALSE);
+               (void)set_monster_fast(creature_ptr, creature_ptr->riding, 0);
+               (void)set_monster_slow(creature_ptr, creature_ptr->riding, 0);
+               (void)set_monster_invulner(creature_ptr, creature_ptr->riding, 0, FALSE);
        }
 
        if (creature_ptr->pclass == CLASS_BARD)
index bf4a311..024c94c 100644 (file)
@@ -992,7 +992,7 @@ void move_player(player_type *creature_ptr, DIRECTION dir, bool do_pickup, bool
                    pattern_seq(creature_ptr, creature_ptr->y, creature_ptr->x, y, x) && (p_can_enter || p_can_kill_walls))
                {
                        /* Disturb the monster */
-                       (void)set_monster_csleep(g_ptr->m_idx, 0);
+                       (void)set_monster_csleep(creature_ptr, g_ptr->m_idx, 0);
 
                        monster_desc(m_name, m_ptr, 0);
 
index 82a4b13..bf9fd9a 100644 (file)
@@ -980,7 +980,7 @@ bool earthquake(player_type *caster_ptr, POSITION cy, POSITION cx, POSITION r, M
                        damage = (sn ? damroll(4, 8) : (m_ptr->hp + 1));
 
                        /* Monster is certainly awake */
-                       (void)set_monster_csleep(g_ptr->m_idx, 0);
+                       (void)set_monster_csleep(caster_ptr, g_ptr->m_idx, 0);
 
                        /* Apply damage directly */
                        m_ptr->hp -= damage;
index cdb6c05..e7d7bfd 100644 (file)
@@ -1584,7 +1584,7 @@ static bool project_m(player_type *caster_ptr, MONSTER_IDX who, POSITION r, POSI
                                /* Normal monsters slow down */
                                else
                                {
-                                       if (set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
+                                       if (set_monster_slow(caster_ptr, g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
                                        {
                                                note = _("の動きが遅くなった。", " starts moving slower.");
                                        }
@@ -1652,7 +1652,7 @@ static bool project_m(player_type *caster_ptr, MONSTER_IDX who, POSITION r, POSI
                                /* Normal monsters slow down */
                                else
                                {
-                                       if (set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
+                                       if (set_monster_slow(caster_ptr, g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
                                        {
                                                note = _("の動きが遅くなった。", " starts moving slower.");
                                        }
@@ -2127,7 +2127,7 @@ static bool project_m(player_type *caster_ptr, MONSTER_IDX who, POSITION r, POSI
                        if (seen) obvious = TRUE;
 
                        /* Wake up */
-                       (void)set_monster_csleep(g_ptr->m_idx, 0);
+                       (void)set_monster_csleep(caster_ptr, g_ptr->m_idx, 0);
 
                        if (m_ptr->maxhp < m_ptr->max_maxhp)
                        {
@@ -2150,21 +2150,21 @@ static bool project_m(player_type *caster_ptr, MONSTER_IDX who, POSITION r, POSI
                        if (seen) obvious = TRUE;
 
                        /* Wake up */
-                       (void)set_monster_csleep(g_ptr->m_idx, 0);
+                       (void)set_monster_csleep(caster_ptr, g_ptr->m_idx, 0);
                        if (MON_STUNNED(m_ptr))
                        {
                                if (seen_msg) msg_format(_("%^sは朦朧状態から立ち直った。", "%^s is no longer stunned."), m_name);
-                               (void)set_monster_stunned(g_ptr->m_idx, 0);
+                               (void)set_monster_stunned(caster_ptr, g_ptr->m_idx, 0);
                        }
                        if (MON_CONFUSED(m_ptr))
                        {
                                if (seen_msg) msg_format(_("%^sは混乱から立ち直った。", "%^s is no longer confused."), m_name);
-                               (void)set_monster_confused(g_ptr->m_idx, 0);
+                               (void)set_monster_confused(caster_ptr, g_ptr->m_idx, 0);
                        }
                        if (MON_MONFEAR(m_ptr))
                        {
                                if (seen_msg) msg_format(_("%^sは勇気を取り戻した。", "%^s recovers %s courage."), m_name);
-                               (void)set_monster_monfear(g_ptr->m_idx, 0);
+                               (void)set_monster_monfear(caster_ptr, g_ptr->m_idx, 0);
                        }
 
                        /* Heal */
@@ -2218,7 +2218,7 @@ static bool project_m(player_type *caster_ptr, MONSTER_IDX who, POSITION r, POSI
                        if (seen) obvious = TRUE;
 
                        /* Speed up */
-                       if (set_monster_fast(g_ptr->m_idx, MON_FAST(m_ptr) + 100))
+                       if (set_monster_fast(caster_ptr, g_ptr->m_idx, MON_FAST(m_ptr) + 100))
                        {
                                note = _("の動きが速くなった。", " starts moving faster.");
                        }
@@ -2253,7 +2253,7 @@ static bool project_m(player_type *caster_ptr, MONSTER_IDX who, POSITION r, POSI
                        /* Normal monsters slow down */
                        else
                        {
-                               if (set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
+                               if (set_monster_slow(caster_ptr, g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
                                {
                                        note = _("の動きが遅くなった。", " starts moving slower.");
                                }
@@ -3229,7 +3229,7 @@ static bool project_m(player_type *caster_ptr, MONSTER_IDX who, POSITION r, POSI
                                        do_conf = randint0(8) + 8;
                                        do_stun = randint0(8) + 8;
                                }
-                               (void)set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 10);
+                               (void)set_monster_slow(caster_ptr, g_ptr->m_idx, MON_SLOW(m_ptr) + 10);
                        }
                        break;
                }
@@ -3419,7 +3419,7 @@ static bool project_m(player_type *caster_ptr, MONSTER_IDX who, POSITION r, POSI
                                /* Normal monsters slow down */
                                else
                                {
-                                       if (set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
+                                       if (set_monster_slow(caster_ptr, g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
                                        {
                                                note = _("の動きが遅くなった。", " starts moving slower.");
                                        }
@@ -3544,7 +3544,7 @@ static bool project_m(player_type *caster_ptr, MONSTER_IDX who, POSITION r, POSI
                                if (is_pet(m_ptr))
                                {
                                        note = _("の動きが速くなった。", " starts moving faster.");
-                                       (void)set_monster_fast(g_ptr->m_idx, MON_FAST(m_ptr) + 100);
+                                       (void)set_monster_fast(caster_ptr, g_ptr->m_idx, MON_FAST(m_ptr) + 100);
                                        success = TRUE;
                                }
 
@@ -3562,7 +3562,7 @@ static bool project_m(player_type *caster_ptr, MONSTER_IDX who, POSITION r, POSI
                                {
                                        note = _("を支配した。", " is tamed!");
                                        set_pet(m_ptr);
-                                       (void)set_monster_fast(g_ptr->m_idx, MON_FAST(m_ptr) + 100);
+                                       (void)set_monster_fast(caster_ptr, g_ptr->m_idx, MON_FAST(m_ptr) + 100);
 
                                        /* Learn about type */
                                        if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
@@ -3666,7 +3666,7 @@ static bool project_m(player_type *caster_ptr, MONSTER_IDX who, POSITION r, POSI
                        }
 
                        /* Apply stun */
-                       (void)set_monster_stunned(g_ptr->m_idx, tmp);
+                       (void)set_monster_stunned(caster_ptr, g_ptr->m_idx, tmp);
 
                        /* Get angry */
                        get_angry = TRUE;
@@ -3694,7 +3694,7 @@ static bool project_m(player_type *caster_ptr, MONSTER_IDX who, POSITION r, POSI
                        }
 
                        /* Apply confusion */
-                       (void)set_monster_confused(g_ptr->m_idx, tmp);
+                       (void)set_monster_confused(caster_ptr, g_ptr->m_idx, tmp);
 
                        /* Get angry */
                        get_angry = TRUE;
@@ -3761,7 +3761,7 @@ static bool project_m(player_type *caster_ptr, MONSTER_IDX who, POSITION r, POSI
                if (do_fear)
                {
                        /* Set fear */
-                       (void)set_monster_monfear(g_ptr->m_idx, MON_MONFEAR(m_ptr) + do_fear);
+                       (void)set_monster_monfear(caster_ptr, g_ptr->m_idx, MON_MONFEAR(m_ptr) + do_fear);
 
                        /* Get angry */
                        get_angry = TRUE;
@@ -3781,7 +3781,7 @@ static bool project_m(player_type *caster_ptr, MONSTER_IDX who, POSITION r, POSI
                if (caster_ptr->riding == g_ptr->m_idx) caster_ptr->redraw |= (PR_UHEALTH);
 
                /* Wake the monster up */
-               (void)set_monster_csleep(g_ptr->m_idx, 0);
+               (void)set_monster_csleep(caster_ptr, g_ptr->m_idx, 0);
 
                /* Hurt the monster */
                m_ptr->hp -= dam;
@@ -3839,7 +3839,7 @@ static bool project_m(player_type *caster_ptr, MONSTER_IDX who, POSITION r, POSI
                        }
 
                        /* Hack -- handle sleep */
-                       if (do_sleep) (void)set_monster_csleep(g_ptr->m_idx, do_sleep);
+                       if (do_sleep) (void)set_monster_csleep(caster_ptr, g_ptr->m_idx, do_sleep);
                }
        }
 
@@ -3896,7 +3896,7 @@ static bool project_m(player_type *caster_ptr, MONSTER_IDX who, POSITION r, POSI
                        }
 
                        /* Hack -- handle sleep */
-                       if (do_sleep) (void)set_monster_csleep(g_ptr->m_idx, do_sleep);
+                       if (do_sleep) (void)set_monster_csleep(caster_ptr, g_ptr->m_idx, do_sleep);
                }
        }
 
index 8586c99..6019e60 100644 (file)
@@ -1029,7 +1029,7 @@ void aggravate_monsters(player_type *caster_ptr, MONSTER_IDX who)
                        /* Wake up */
                        if (MON_CSLEEP(m_ptr))
                        {
-                               (void)set_monster_csleep(i, 0);
+                               (void)set_monster_csleep(caster_ptr, i, 0);
                                sleep = TRUE;
                        }
                        if (!is_pet(m_ptr)) m_ptr->mflag2 |= MFLAG2_NOPET;
@@ -1040,7 +1040,7 @@ void aggravate_monsters(player_type *caster_ptr, MONSTER_IDX who)
                {
                        if (!is_pet(m_ptr))
                        {
-                               (void)set_monster_fast(i, MON_FAST(m_ptr) + 100);
+                               (void)set_monster_fast(caster_ptr, i, MON_FAST(m_ptr) + 100);
                                speed = TRUE;
                        }
                }
@@ -1101,7 +1101,7 @@ bool genocide_aux(player_type *caster_ptr, MONSTER_IDX m_idx, int power, bool pl
 
                if (MON_CSLEEP(m_ptr))
                {
-                       (void)set_monster_csleep(m_idx, 0);
+                       (void)set_monster_csleep(caster_ptr, m_idx, 0);
                        if (m_ptr->ml)
                        {
                                msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name);
@@ -1502,7 +1502,7 @@ static void cave_temp_room_lite(player_type *caster_ptr)
                        if (MON_CSLEEP(m_ptr) && (randint0(100) < chance))
                        {
                                /* Wake up! */
-                               (void)set_monster_csleep(g_ptr->m_idx, 0);
+                               (void)set_monster_csleep(caster_ptr, g_ptr->m_idx, 0);
 
                                /* Notice the "waking up" */
                                if (m_ptr->ml)
@@ -2192,7 +2192,7 @@ bool teleport_swap(player_type *caster_ptr, DIRECTION dir)
        m_ptr = &caster_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
        r_ptr = &r_info[m_ptr->r_idx];
 
-       (void)set_monster_csleep(g_ptr->m_idx, 0);
+       (void)set_monster_csleep(caster_ptr, g_ptr->m_idx, 0);
 
        if (r_ptr->flagsr & RFR_RES_TELE)
        {
index d36370f..2fbf85e 100644 (file)
@@ -1041,7 +1041,7 @@ bool vanish_dungeon(player_type *caster_ptr)
                        /* Awake monster */
                        if (g_ptr->m_idx && MON_CSLEEP(m_ptr))
                        {
-                               (void)set_monster_csleep(g_ptr->m_idx, 0);
+                               (void)set_monster_csleep(caster_ptr, g_ptr->m_idx, 0);
 
                                /* Notice the "waking up" */
                                if (m_ptr->ml)
@@ -2778,7 +2778,7 @@ bool polymorph_monster(player_type *caster_ptr, POSITION y, POSITION x)
                        floor_ptr->m_list[hack_m_idx_ii] = back_m;
 
                        /* Re-initialize monster process */
-                       mproc_init();
+                       mproc_init(floor_ptr);
                }
                else preserve_hold_objects = FALSE;
        }