OSDN Git Service

[Refactor] #38997 gain_random_mutation() を gain_mutation() に改名しつつ引数追加。 / Rename gain_...
[hengband/hengband.git] / src / spells2.c
index 9d63a7a..90eccf0 100644 (file)
@@ -25,7 +25,9 @@
 #include "avatar.h"
 
 #include "spells-status.h"
+#include "spells-floor.h"
 #include "realm-hex.h"
+#include "object-hook.h"
 
 /*!
  * @brief プレイヤー周辺の地形を感知する
@@ -38,18 +40,18 @@ static bool detect_feat_flag(POSITION range, int flag, bool known)
 {
        POSITION x, y;
        bool detect = FALSE;
-       grid_type *c_ptr;
+       grid_type *g_ptr;
 
        if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
 
        /* Scan the current panel */
-       for (y = 1; y < cur_hgt - 1; y++)
+       for (y = 1; y < current_floor_ptr->height - 1; y++)
        {
-               for (x = 1; x <= cur_wid - 1; x++)
+               for (x = 1; x <= current_floor_ptr->width - 1; x++)
                {
                        int dist = distance(p_ptr->y, p_ptr->x, y, x);
                        if (dist > range) continue;
-                       c_ptr = &grid_array[y][x];
+                       g_ptr = &current_floor_ptr->grid_array[y][x];
 
                        /* Hack -- Safe */
                        if (flag == FF_TRAP)
@@ -57,22 +59,22 @@ static bool detect_feat_flag(POSITION range, int flag, bool known)
                                /* Mark as detected */
                                if (dist <= range && known)
                                {
-                                       if (dist <= range - 1) c_ptr->info |= (CAVE_IN_DETECT);
+                                       if (dist <= range - 1) g_ptr->info |= (CAVE_IN_DETECT);
 
-                                       c_ptr->info &= ~(CAVE_UNSAFE);
+                                       g_ptr->info &= ~(CAVE_UNSAFE);
 
                                        lite_spot(y, x);
                                }
                        }
 
                        /* Detect flags */
-                       if (cave_have_flag_grid(c_ptr, flag))
+                       if (cave_have_flag_grid(g_ptr, flag))
                        {
                                /* Detect secrets */
                                disclose_grid(y, x);
 
                                /* Hack -- Memorize */
-                               c_ptr->info |= (CAVE_MARK);
+                               g_ptr->info |= (CAVE_MARK);
 
                                lite_spot(y, x);
 
@@ -177,7 +179,7 @@ bool detect_objects_gold(POSITION range)
        /* Scan objects */
        for (i = 1; i < o_max; i++)
        {
-               object_type *o_ptr = &o_list[i];
+               object_type *o_ptr = &current_floor_ptr->o_list[i];
 
                /* Skip dead objects */
                if (!o_ptr->k_idx) continue;
@@ -232,7 +234,7 @@ bool detect_objects_normal(POSITION range)
        /* Scan objects */
        for (i = 1; i < o_max; i++)
        {
-               object_type *o_ptr = &o_list[i];
+               object_type *o_ptr = &current_floor_ptr->o_list[i];
 
                /* Skip dead objects */
                if (!o_ptr->k_idx) continue;
@@ -295,7 +297,7 @@ bool detect_objects_magic(POSITION range)
        /* Scan all objects */
        for (i = 1; i < o_max; i++)
        {
-               object_type *o_ptr = &o_list[i];
+               object_type *o_ptr = &current_floor_ptr->o_list[i];
 
                /* Skip dead objects */
                if (!o_ptr->k_idx) continue;
@@ -369,7 +371,7 @@ bool detect_monsters_normal(POSITION range)
 
        for (i = 1; i < m_max; i++)
        {
-               monster_type *m_ptr = &m_list[i];
+               monster_type *m_ptr = &current_floor_ptr->m_list[i];
                monster_race *r_ptr = &r_info[m_ptr->r_idx];
 
                /* Skip dead monsters */
@@ -417,7 +419,7 @@ bool detect_monsters_invis(POSITION range)
 
        for (i = 1; i < m_max; i++)
        {
-               monster_type *m_ptr = &m_list[i];
+               monster_type *m_ptr = &current_floor_ptr->m_list[i];
                monster_race *r_ptr = &r_info[m_ptr->r_idx];
 
                /* Skip dead monsters */
@@ -470,7 +472,7 @@ bool detect_monsters_evil(POSITION range)
 
        for (i = 1; i < m_max; i++)
        {
-               monster_type *m_ptr = &m_list[i];
+               monster_type *m_ptr = &current_floor_ptr->m_list[i];
                monster_race *r_ptr = &r_info[m_ptr->r_idx];
 
                /* Skip dead monsters */
@@ -527,7 +529,7 @@ bool detect_monsters_nonliving(POSITION range)
 
        for (i = 1; i < m_max; i++)
        {
-               monster_type *m_ptr = &m_list[i];
+               monster_type *m_ptr = &current_floor_ptr->m_list[i];
 
                /* Skip dead monsters */
                if (!m_ptr->r_idx) continue;
@@ -577,7 +579,7 @@ bool detect_monsters_mind(POSITION range)
 
        for (i = 1; i < m_max; i++)
        {
-               monster_type *m_ptr = &m_list[i];
+               monster_type *m_ptr = &current_floor_ptr->m_list[i];
                monster_race *r_ptr = &r_info[m_ptr->r_idx];
 
                /* Skip dead monsters */
@@ -630,7 +632,7 @@ bool detect_monsters_string(POSITION range, concptr Match)
 
        for (i = 1; i < m_max; i++)
        {
-               monster_type *m_ptr = &m_list[i];
+               monster_type *m_ptr = &current_floor_ptr->m_list[i];
                monster_race *r_ptr = &r_info[m_ptr->r_idx];
 
                /* Skip dead monsters */
@@ -685,7 +687,7 @@ bool detect_monsters_xxx(POSITION range, u32b match_flag)
 
        for (i = 1; i < m_max; i++)
        {
-               monster_type *m_ptr = &m_list[i];
+               monster_type *m_ptr = &current_floor_ptr->m_list[i];
                monster_race *r_ptr = &r_info[m_ptr->r_idx];
 
                /* Skip dead monsters */
@@ -788,7 +790,7 @@ bool project_all_los(EFFECT_ID typ, HIT_POINT dam)
        /* Mark all (nearby) monsters */
        for (i = 1; i < m_max; i++)
        {
-               monster_type *m_ptr = &m_list[i];
+               monster_type *m_ptr = &current_floor_ptr->m_list[i];
 
                /* Paranoia -- Skip dead monsters */
                if (!m_ptr->r_idx) continue;
@@ -806,7 +808,7 @@ bool project_all_los(EFFECT_ID typ, HIT_POINT dam)
        /* Affect all marked monsters */
        for (i = 1; i < m_max; i++)
        {
-               monster_type *m_ptr = &m_list[i];
+               monster_type *m_ptr = &current_floor_ptr->m_list[i];
 
                /* Skip unmarked monsters */
                if (!(m_ptr->mflag & (MFLAG_TEMP))) continue;
@@ -978,7 +980,7 @@ void aggravate_monsters(MONSTER_IDX who)
        /* Aggravate everyone nearby */
        for (i = 1; i < m_max; i++)
        {
-               monster_type *m_ptr = &m_list[i];
+               monster_type *m_ptr = &current_floor_ptr->m_list[i];
 
                /* Paranoia -- Skip dead monsters */
                if (!m_ptr->r_idx) continue;
@@ -1027,7 +1029,7 @@ void aggravate_monsters(MONSTER_IDX who)
 bool genocide_aux(MONSTER_IDX m_idx, int power, bool player_cast, int dam_side, concptr spell_name)
 {
        int          msec = delay_factor * delay_factor * delay_factor;
-       monster_type *m_ptr = &m_list[m_idx];
+       monster_type *m_ptr = &current_floor_ptr->m_list[m_idx];
        monster_race *r_ptr = &r_info[m_ptr->r_idx];
        bool         resist = FALSE;
 
@@ -1037,7 +1039,7 @@ bool genocide_aux(MONSTER_IDX m_idx, int power, bool player_cast, int dam_side,
        if (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) resist = TRUE;
        else if (r_ptr->flags7 & RF7_UNIQUE2) resist = TRUE;
        else if (m_idx == p_ptr->riding) resist = TRUE;
-       else if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle) resist = TRUE;
+       else if ((p_ptr->inside_quest && !random_quest_number(current_floor_ptr->dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle) resist = TRUE;
        else if (player_cast && (r_ptr->level > randint0(power))) resist = TRUE;
        else if (player_cast && (m_ptr->mflag2 & MFLAG2_NOGENO)) resist = TRUE;
 
@@ -1116,7 +1118,7 @@ bool symbol_genocide(int power, bool player_cast)
        bool result = FALSE;
 
        /* Prevent genocide in quest levels */
-       if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
+       if ((p_ptr->inside_quest && !random_quest_number(current_floor_ptr->dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
        {
                msg_print(_("何も起きないようだ……", "It seems nothing happen here..."));
                return (FALSE);
@@ -1128,7 +1130,7 @@ bool symbol_genocide(int power, bool player_cast)
        /* Delete the monsters of that "type" */
        for (i = 1; i < m_max; i++)
        {
-               monster_type *m_ptr = &m_list[i];
+               monster_type *m_ptr = &current_floor_ptr->m_list[i];
                monster_race *r_ptr = &r_info[m_ptr->r_idx];
 
                /* Paranoia -- Skip dead monsters */
@@ -1162,7 +1164,7 @@ bool mass_genocide(int power, bool player_cast)
        bool result = FALSE;
 
        /* Prevent mass genocide in quest levels */
-       if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
+       if ((p_ptr->inside_quest && !random_quest_number(current_floor_ptr->dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
        {
                return (FALSE);
        }
@@ -1170,7 +1172,7 @@ bool mass_genocide(int power, bool player_cast)
        /* Delete the (nearby) monsters */
        for (i = 1; i < m_max; i++)
        {
-               monster_type *m_ptr = &m_list[i];
+               monster_type *m_ptr = &current_floor_ptr->m_list[i];
 
                /* Paranoia -- Skip dead monsters */
                if (!m_ptr->r_idx) continue;
@@ -1204,7 +1206,7 @@ bool mass_genocide_undead(int power, bool player_cast)
        bool result = FALSE;
 
        /* Prevent mass genocide in quest levels */
-       if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
+       if ((p_ptr->inside_quest && !random_quest_number(current_floor_ptr->dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
        {
                return (FALSE);
        }
@@ -1212,7 +1214,7 @@ bool mass_genocide_undead(int power, bool player_cast)
        /* Delete the (nearby) monsters */
        for (i = 1; i < m_max; i++)
        {
-               monster_type *m_ptr = &m_list[i];
+               monster_type *m_ptr = &current_floor_ptr->m_list[i];
                monster_race *r_ptr = &r_info[m_ptr->r_idx];
 
                /* Paranoia -- Skip dead monsters */
@@ -1258,7 +1260,7 @@ bool probing(void)
        /* Probe all (nearby) monsters */
        for (i = 1; i < m_max; i++)
        {
-               monster_type *m_ptr = &m_list[i];
+               monster_type *m_ptr = &current_floor_ptr->m_list[i];
                monster_race *r_ptr = &r_info[m_ptr->r_idx];
 
                /* Paranoia -- Skip dead monsters */
@@ -1394,11 +1396,11 @@ bool destroy_area(POSITION y1, POSITION x1, POSITION r, bool in_generate)
 {
        POSITION y, x;
        int k, t;
-       grid_type *c_ptr;
+       grid_type *g_ptr;
        bool flag = FALSE;
 
        /* Prevent destruction of quest levels and town */
-       if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !dun_level)
+       if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !current_floor_ptr->dun_level)
        {
                return (FALSE);
        }
@@ -1419,18 +1421,18 @@ bool destroy_area(POSITION y1, POSITION x1, POSITION r, bool in_generate)
 
                        /* Stay in the circle of death */
                        if (k > r) continue;
-                       c_ptr = &grid_array[y][x];
+                       g_ptr = &current_floor_ptr->grid_array[y][x];
 
                        /* Lose room and vault */
-                       c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
+                       g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
 
                        /* Lose light and knowledge */
-                       c_ptr->info &= ~(CAVE_MARK | CAVE_GLOW | CAVE_KNOWN);
+                       g_ptr->info &= ~(CAVE_MARK | CAVE_GLOW | CAVE_KNOWN);
 
                        if (!in_generate) /* Normal */
                        {
                                /* Lose unsafety */
-                               c_ptr->info &= ~(CAVE_UNSAFE);
+                               g_ptr->info &= ~(CAVE_UNSAFE);
 
                                /* Hack -- Notice player affect */
                                if (player_bold(y, x))
@@ -1446,9 +1448,9 @@ bool destroy_area(POSITION y1, POSITION x1, POSITION r, bool in_generate)
                        /* Hack -- Skip the epicenter */
                        if ((y == y1) && (x == x1)) continue;
 
-                       if (c_ptr->m_idx)
+                       if (g_ptr->m_idx)
                        {
-                               monster_type *m_ptr = &m_list[c_ptr->m_idx];
+                               monster_type *m_ptr = &current_floor_ptr->m_list[g_ptr->m_idx];
                                monster_race *r_ptr = &r_info[m_ptr->r_idx];
 
                                if (in_generate) /* In generation */
@@ -1462,7 +1464,7 @@ bool destroy_area(POSITION y1, POSITION x1, POSITION r, bool in_generate)
                                        m_ptr->hp = m_ptr->maxhp;
 
                                        /* Try to teleport away quest monsters */
-                                       if (!teleport_away(c_ptr->m_idx, (r * 2) + 1, TELEPORT_DEC_VALOUR)) continue;
+                                       if (!teleport_away(g_ptr->m_idx, (r * 2) + 1, TELEPORT_DEC_VALOUR)) continue;
                                }
                                else
                                {
@@ -1485,10 +1487,10 @@ bool destroy_area(POSITION y1, POSITION x1, POSITION r, bool in_generate)
                                OBJECT_IDX this_o_idx, next_o_idx = 0;
 
                                /* Scan all objects in the grid */
-                               for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
+                               for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
                                {
                                        object_type *o_ptr;
-                                       o_ptr = &o_list[this_o_idx];
+                                       o_ptr = &current_floor_ptr->o_list[this_o_idx];
 
                                        /* Acquire next object */
                                        next_o_idx = o_ptr->next_o_idx;
@@ -1517,7 +1519,7 @@ bool destroy_area(POSITION y1, POSITION x1, POSITION r, bool in_generate)
                        delete_object(y, x);
 
                        /* Destroy "non-permanent" grids */
-                       if (!cave_perma_grid(c_ptr))
+                       if (!cave_perma_grid(g_ptr))
                        {
                                /* Wall (or floor) type */
                                t = randint0(200);
@@ -1550,26 +1552,26 @@ bool destroy_area(POSITION y1, POSITION x1, POSITION r, bool in_generate)
                                        if (t < 20)
                                        {
                                                /* Create granite wall */
-                                               place_extra_grid(c_ptr);
+                                               place_extra_grid(g_ptr);
                                        }
                                        else if (t < 70)
                                        {
                                                /* Create quartz vein */
-                                               c_ptr->feat = feat_quartz_vein;
+                                               g_ptr->feat = feat_quartz_vein;
                                        }
                                        else if (t < 100)
                                        {
                                                /* Create magma vein */
-                                               c_ptr->feat = feat_magma_vein;
+                                               g_ptr->feat = feat_magma_vein;
                                        }
                                        else
                                        {
                                                /* Create floor */
-                                               place_floor_grid(c_ptr);
+                                               place_floor_grid(g_ptr);
                                        }
 
                                        /* Clear garbage of hidden trap or door */
-                                       c_ptr->mimic = 0;
+                                       g_ptr->mimic = 0;
                                }
                        }
                }
@@ -1590,9 +1592,9 @@ bool destroy_area(POSITION y1, POSITION x1, POSITION r, bool in_generate)
 
                                /* Stay in the circle of death */
                                if (k > r) continue;
-                               c_ptr = &grid_array[y][x];
+                               g_ptr = &current_floor_ptr->grid_array[y][x];
 
-                               if (is_mirror_grid(c_ptr)) c_ptr->info |= CAVE_GLOW;
+                               if (is_mirror_grid(g_ptr)) g_ptr->info |= CAVE_GLOW;
                                else if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS))
                                {
                                        DIRECTION i;
@@ -1604,10 +1606,10 @@ bool destroy_area(POSITION y1, POSITION x1, POSITION r, bool in_generate)
                                                yy = y + ddy_ddd[i];
                                                xx = x + ddx_ddd[i];
                                                if (!in_bounds2(yy, xx)) continue;
-                                               cc_ptr = &grid_array[yy][xx];
+                                               cc_ptr = &current_floor_ptr->grid_array[yy][xx];
                                                if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
                                                {
-                                                       c_ptr->info |= CAVE_GLOW;
+                                                       g_ptr->info |= CAVE_GLOW;
                                                        break;
                                                }
                                        }
@@ -1637,7 +1639,7 @@ bool destroy_area(POSITION y1, POSITION x1, POSITION r, bool in_generate)
 
                if (p_ptr->special_defense & NINJA_S_STEALTH)
                {
-                       if (grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
+                       if (current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
                }
        }
 
@@ -1657,7 +1659,7 @@ bool destroy_area(POSITION y1, POSITION x1, POSITION r, bool in_generate)
  * @details
  * <pre>
  *
- * This will turn some walls into floors and some floors into walls.
+ * This will current_world_ptr->game_turn some walls into floors and some floors into walls.
  *
  * The player will take damage and "jump" into a safe grid if possible,
  * otherwise, he will "tunnel" through the rubble instantaneously.
@@ -1669,7 +1671,7 @@ bool destroy_area(POSITION y1, POSITION x1, POSITION r, bool in_generate)
  * Note that thus the player and monsters (except eaters of walls and
  * passers through walls) will never occupy the same grid as a wall.
  * Note that as of now (2.7.8) no monster may occupy a "wall" grid, even
- * for a single turn, unless that monster can pass_walls or kill_walls.
+ * for a single current_world_ptr->game_turn, unless that monster can pass_walls or kill_walls.
  * This has allowed massive simplification of the "monster" code.
  * </pre>
  */
@@ -1682,11 +1684,11 @@ bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx)
        int sn = 0;
        POSITION sy = 0, sx = 0;
        bool hurt = FALSE;
-       grid_type *c_ptr;
+       grid_type *g_ptr;
        bool map[32][32];
 
        /* Prevent destruction of quest levels and town */
-       if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !dun_level)
+       if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !current_floor_ptr->dun_level)
        {
                return (FALSE);
        }
@@ -1717,11 +1719,11 @@ bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx)
 
                        /* Skip distant grids */
                        if (distance(cy, cx, yy, xx) > r) continue;
-                       c_ptr = &grid_array[yy][xx];
+                       g_ptr = &current_floor_ptr->grid_array[yy][xx];
 
                        /* Lose room and vault / Lose light and knowledge */
-                       c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY | CAVE_UNSAFE);
-                       c_ptr->info &= ~(CAVE_GLOW | CAVE_MARK | CAVE_KNOWN);
+                       g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY | CAVE_UNSAFE);
+                       g_ptr->info &= ~(CAVE_GLOW | CAVE_MARK | CAVE_KNOWN);
 
                        /* Skip the epicenter */
                        if (!dx && !dy) continue;
@@ -1753,7 +1755,7 @@ bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx)
                        /* Important -- Skip "quake" grids */
                        if (map[16+y-cy][16+x-cx]) continue;
 
-                       if (grid_array[y][x].m_idx) continue;
+                       if (current_floor_ptr->grid_array[y][x].m_idx) continue;
 
                        /* Count "safe" grids */
                        sn++;
@@ -1770,17 +1772,17 @@ bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx)
                {
                        case 1:
                        {
-                               msg_print(_("ダンジョンの壁が崩れた!", "The grid_array ceiling collapses!"));
+                               msg_print(_("ダンジョンの壁が崩れた!", "The current_floor_ptr->grid_array ceiling collapses!"));
                                break;
                        }
                        case 2:
                        {
-                               msg_print(_("ダンジョンの床が不自然にねじ曲がった!", "The grid_array floor twists in an unnatural way!"));
+                               msg_print(_("ダンジョンの床が不自然にねじ曲がった!", "The current_floor_ptr->grid_array floor twists in an unnatural way!"));
                                break;
                        }
                        default:
                        {
-                               msg_print(_("ダンジョンが揺れた!崩れた岩が頭に降ってきた!", "The grid_array quakes!  You are pummeled with debris!"));
+                               msg_print(_("ダンジョンが揺れた!崩れた岩が頭に降ってきた!", "The current_floor_ptr->grid_array quakes!  You are pummeled with debris!"));
                                break;
                        }
                }
@@ -1835,7 +1837,7 @@ bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx)
                        if (m_idx)
                        {
                                GAME_TEXT m_name[MAX_NLEN];
-                               monster_type *m_ptr = &m_list[m_idx];
+                               monster_type *m_ptr = &current_floor_ptr->m_list[m_idx];
 
                                /* Get the monster's real name */
                                monster_desc(m_name, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
@@ -1862,14 +1864,14 @@ bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx)
 
                        /* Skip unaffected grids */
                        if (!map[16+yy-cy][16+xx-cx]) continue;
-                       c_ptr = &grid_array[yy][xx];
+                       g_ptr = &current_floor_ptr->grid_array[yy][xx];
 
-                       if (c_ptr->m_idx == p_ptr->riding) continue;
+                       if (g_ptr->m_idx == p_ptr->riding) continue;
 
                        /* Process monsters */
-                       if (c_ptr->m_idx)
+                       if (g_ptr->m_idx)
                        {
-                               monster_type *m_ptr = &m_list[c_ptr->m_idx];
+                               monster_type *m_ptr = &current_floor_ptr->m_list[g_ptr->m_idx];
                                monster_race *r_ptr = &r_info[m_ptr->r_idx];
 
                                /* Quest monsters */
@@ -1903,8 +1905,8 @@ bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx)
                                                        if (!cave_empty_bold(y, x)) continue;
 
                                                        /* Hack -- no safety on glyph of warding */
-                                                       if (is_glyph_grid(&grid_array[y][x])) continue;
-                                                       if (is_explosive_rune_grid(&grid_array[y][x])) continue;
+                                                       if (is_glyph_grid(&current_floor_ptr->grid_array[y][x])) continue;
+                                                       if (is_explosive_rune_grid(&current_floor_ptr->grid_array[y][x])) continue;
 
                                                        /* ... nor on the Pattern */
                                                        if (pattern_tile(y, x)) continue;
@@ -1912,7 +1914,7 @@ bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx)
                                                        /* Important -- Skip "quake" grids */
                                                        if (map[16+y-cy][16+x-cx]) continue;
 
-                                                       if (grid_array[y][x].m_idx) continue;
+                                                       if (current_floor_ptr->grid_array[y][x].m_idx) continue;
                                                        if (player_bold(y, x)) continue;
 
                                                        /* Count "safe" grids */
@@ -1935,7 +1937,7 @@ bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx)
                                        damage = (sn ? damroll(4, 8) : (m_ptr->hp + 1));
 
                                        /* Monster is certainly awake */
-                                       (void)set_monster_csleep(c_ptr->m_idx, 0);
+                                       (void)set_monster_csleep(g_ptr->m_idx, 0);
 
                                        /* Apply damage directly */
                                        m_ptr->hp -= damage;
@@ -1946,9 +1948,9 @@ bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx)
                                                if (!ignore_unview || is_seen(m_ptr)) 
                                                        msg_format(_("%^sは岩石に埋もれてしまった!", "%^s is embedded in the rock!"), m_name);
 
-                                               if (c_ptr->m_idx)
+                                               if (g_ptr->m_idx)
                                                {
-                                                       if (record_named_pet && is_pet(&m_list[c_ptr->m_idx]) && m_list[c_ptr->m_idx].nickname)
+                                                       if (record_named_pet && is_pet(&current_floor_ptr->m_list[g_ptr->m_idx]) && current_floor_ptr->m_list[g_ptr->m_idx].nickname)
                                                        {
                                                                char m2_name[MAX_NLEN];
 
@@ -1966,13 +1968,13 @@ bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx)
                                        /* Hack -- Escape from the rock */
                                        if (sn)
                                        {
-                                               IDX m_idx_aux = grid_array[yy][xx].m_idx;
+                                               IDX m_idx_aux = current_floor_ptr->grid_array[yy][xx].m_idx;
 
                                                /* Update the old location */
-                                               grid_array[yy][xx].m_idx = 0;
+                                               current_floor_ptr->grid_array[yy][xx].m_idx = 0;
 
                                                /* Update the new location */
-                                               grid_array[sy][sx].m_idx = m_idx_aux;
+                                               current_floor_ptr->grid_array[sy][sx].m_idx = m_idx_aux;
 
                                                /* Move the monster */
                                                m_ptr->fy = sy;
@@ -2002,7 +2004,7 @@ bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx)
                        /* Skip unaffected grids */
                        if (!map[16+yy-cy][16+xx-cx]) continue;
 
-                       c_ptr = &grid_array[yy][xx];
+                       g_ptr = &current_floor_ptr->grid_array[yy][xx];
 
                        /* Paranoia -- never affect player */
 /*                     if (player_bold(yy, xx)) continue; */
@@ -2060,9 +2062,9 @@ bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx)
 
                        /* Skip distant grids */
                        if (distance(cy, cx, yy, xx) > r) continue;
-                       c_ptr = &grid_array[yy][xx];
+                       g_ptr = &current_floor_ptr->grid_array[yy][xx];
 
-                       if (is_mirror_grid(c_ptr)) c_ptr->info |= CAVE_GLOW;
+                       if (is_mirror_grid(g_ptr)) g_ptr->info |= CAVE_GLOW;
                        else if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS))
                        {
                                DIRECTION ii;
@@ -2074,10 +2076,10 @@ bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx)
                                        yyy = yy + ddy_ddd[ii];
                                        xxx = xx + ddx_ddd[ii];
                                        if (!in_bounds2(yyy, xxx)) continue;
-                                       cc_ptr = &grid_array[yyy][xxx];
+                                       cc_ptr = &current_floor_ptr->grid_array[yyy][xxx];
                                        if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
                                        {
-                                               c_ptr->info |= CAVE_GLOW;
+                                               g_ptr->info |= CAVE_GLOW;
                                                break;
                                        }
                                }
@@ -2092,7 +2094,7 @@ bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx)
 
        if (p_ptr->special_defense & NINJA_S_STEALTH)
        {
-               if (grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
+               if (current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
        }
 
        /* Success */
@@ -2123,7 +2125,7 @@ void discharge_minion(void)
 
        for (i = 1; i < m_max; i++)
        {
-               monster_type *m_ptr = &m_list[i];
+               monster_type *m_ptr = &current_floor_ptr->m_list[i];
                if (!m_ptr->r_idx || !is_pet(m_ptr)) continue;
                if (m_ptr->nickname) okay = FALSE;
        }
@@ -2135,7 +2137,7 @@ void discharge_minion(void)
        for (i = 1; i < m_max; i++)
        {
                HIT_POINT dam;
-               monster_type *m_ptr = &m_list[i];
+               monster_type *m_ptr = &current_floor_ptr->m_list[i];
                monster_race *r_ptr;
 
                if (!m_ptr->r_idx || !is_pet(m_ptr)) continue;
@@ -2196,24 +2198,24 @@ static void cave_temp_room_lite(void)
                POSITION y = temp_y[i];
                POSITION x = temp_x[i];
 
-               grid_type *c_ptr = &grid_array[y][x];
+               grid_type *g_ptr = &current_floor_ptr->grid_array[y][x];
 
                /* No longer in the array */
-               c_ptr->info &= ~(CAVE_TEMP);
+               g_ptr->info &= ~(CAVE_TEMP);
 
                /* Update only non-CAVE_GLOW grids */
-               /* if (c_ptr->info & (CAVE_GLOW)) continue; */
+               /* if (g_ptr->info & (CAVE_GLOW)) continue; */
 
                /* Perma-Lite */
-               c_ptr->info |= (CAVE_GLOW);
+               g_ptr->info |= (CAVE_GLOW);
 
                /* Process affected monsters */
-               if (c_ptr->m_idx)
+               if (g_ptr->m_idx)
                {
                        int chance = 25;
-                       monster_type    *m_ptr = &m_list[c_ptr->m_idx];
+                       monster_type    *m_ptr = &current_floor_ptr->m_list[g_ptr->m_idx];
                        monster_race    *r_ptr = &r_info[m_ptr->r_idx];
-                       update_monster(c_ptr->m_idx, FALSE);
+                       update_monster(g_ptr->m_idx, FALSE);
 
                        /* Stupid monsters rarely wake up */
                        if (r_ptr->flags2 & (RF2_STUPID)) chance = 10;
@@ -2225,7 +2227,7 @@ static void cave_temp_room_lite(void)
                        if (MON_CSLEEP(m_ptr) && (randint0(100) < chance))
                        {
                                /* Wake up! */
-                               (void)set_monster_csleep(c_ptr->m_idx, 0);
+                               (void)set_monster_csleep(g_ptr->m_idx, 0);
 
                                /* Notice the "waking up" */
                                if (m_ptr->ml)
@@ -2271,16 +2273,16 @@ static void cave_temp_room_unlite(void)
                POSITION x = temp_x[i];
                int j;
 
-               grid_type *c_ptr = &grid_array[y][x];
-               bool do_dark = !is_mirror_grid(c_ptr);
+               grid_type *g_ptr = &current_floor_ptr->grid_array[y][x];
+               bool do_dark = !is_mirror_grid(g_ptr);
 
                /* No longer in the array */
-               c_ptr->info &= ~(CAVE_TEMP);
+               g_ptr->info &= ~(CAVE_TEMP);
 
                /* Darken the grid */
                if (do_dark)
                {
-                       if (dun_level || !is_daytime())
+                       if (current_floor_ptr->dun_level || !is_daytime())
                        {
                                for (j = 0; j < 9; j++)
                                {
@@ -2289,7 +2291,7 @@ static void cave_temp_room_unlite(void)
 
                                        if (in_bounds2(by, bx))
                                        {
-                                               grid_type *cc_ptr = &grid_array[by][bx];
+                                               grid_type *cc_ptr = &current_floor_ptr->grid_array[by][bx];
 
                                                if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
                                                {
@@ -2302,20 +2304,20 @@ static void cave_temp_room_unlite(void)
                                if (!do_dark) continue;
                        }
 
-                       c_ptr->info &= ~(CAVE_GLOW);
+                       g_ptr->info &= ~(CAVE_GLOW);
 
                        /* Hack -- Forget "boring" grids */
-                       if (!have_flag(f_info[get_feat_mimic(c_ptr)].flags, FF_REMEMBER))
+                       if (!have_flag(f_info[get_feat_mimic(g_ptr)].flags, FF_REMEMBER))
                        {
                                /* Forget the grid */
-                               if (!view_torch_grids) c_ptr->info &= ~(CAVE_MARK);
+                               if (!view_torch_grids) g_ptr->info &= ~(CAVE_MARK);
                                note_spot(y, x);
                        }
 
                        /* Process affected monsters */
-                       if (c_ptr->m_idx)
+                       if (g_ptr->m_idx)
                        {
-                               update_monster(c_ptr->m_idx, FALSE);
+                               update_monster(g_ptr->m_idx, FALSE);
                        }
 
                        lite_spot(y, x);
@@ -2402,16 +2404,14 @@ static int next_to_walls_adj(POSITION cy, POSITION cx, bool (*pass_bold)(POSITIO
  */
 static void cave_temp_room_aux(POSITION y, POSITION x, bool only_room, bool (*pass_bold)(POSITION, POSITION))
 {
-       grid_type *c_ptr;
-
-       /* Get the grid */
-       c_ptr = &grid_array[y][x];
+       grid_type *g_ptr;
+       g_ptr = &current_floor_ptr->grid_array[y][x];
 
        /* Avoid infinite recursion */
-       if (c_ptr->info & (CAVE_TEMP)) return;
+       if (g_ptr->info & (CAVE_TEMP)) return;
 
        /* Do not "leave" the current room */
-       if (!(c_ptr->info & (CAVE_ROOM)))
+       if (!(g_ptr->info & (CAVE_ROOM)))
        {
                if (only_room) return;
 
@@ -2438,7 +2438,7 @@ static void cave_temp_room_aux(POSITION y, POSITION x, bool only_room, bool (*pa
        if (temp_n == TEMP_MAX) return;
 
        /* Mark the grid as "seen" */
-       c_ptr->info |= (CAVE_TEMP);
+       g_ptr->info |= (CAVE_TEMP);
 
        /* Add it to the "seen" set */
        temp_y[temp_n] = y;
@@ -2532,7 +2532,7 @@ void lite_room(POSITION y1, POSITION x1)
 
        if (p_ptr->special_defense & NINJA_S_STEALTH)
        {
-               if (grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
+               if (current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
        }
 }
 
@@ -2891,7 +2891,7 @@ bool fire_blast(EFFECT_ID typ, DIRECTION dir, DICE_NUMBER dd, DICE_SID ds, int n
 bool teleport_swap(DIRECTION dir)
 {
        POSITION tx, ty;
-       grid_type* c_ptr;
+       grid_type* g_ptr;
        monster_type* m_ptr;
        monster_race* r_ptr;
 
@@ -2905,7 +2905,7 @@ bool teleport_swap(DIRECTION dir)
                tx = p_ptr->x + ddx[dir];
                ty = p_ptr->y + ddy[dir];
        }
-       c_ptr = &grid_array[ty][tx];
+       g_ptr = &current_floor_ptr->grid_array[ty][tx];
 
        if (p_ptr->anti_tele)
        {
@@ -2913,22 +2913,22 @@ bool teleport_swap(DIRECTION dir)
                return FALSE;
        }
 
-       if (!c_ptr->m_idx || (c_ptr->m_idx == p_ptr->riding))
+       if (!g_ptr->m_idx || (g_ptr->m_idx == p_ptr->riding))
        {
                msg_print(_("それとは場所を交換できません。", "You can't trade places with that!"));
                return FALSE;
        }
 
-       if ((c_ptr->info & CAVE_ICKY) || (distance(ty, tx, p_ptr->y, p_ptr->x) > p_ptr->lev * 3 / 2 + 10))
+       if ((g_ptr->info & CAVE_ICKY) || (distance(ty, tx, p_ptr->y, p_ptr->x) > p_ptr->lev * 3 / 2 + 10))
        {
                msg_print(_("失敗した。", "Failed to swap."));
                return FALSE;
        }
 
-       m_ptr = &m_list[c_ptr->m_idx];
+       m_ptr = &current_floor_ptr->m_list[g_ptr->m_idx];
        r_ptr = &r_info[m_ptr->r_idx];
 
-       (void)set_monster_csleep(c_ptr->m_idx, 0);
+       (void)set_monster_csleep(g_ptr->m_idx, 0);
 
        if (r_ptr->flagsr & RFR_RES_TELE)
        {
@@ -3347,7 +3347,7 @@ bool activate_ty_curse(bool stop_ty, int *count)
                        (*count) += activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
                        if (!one_in_(6)) break;
                case 7: case 8: case 9: case 18:
-                       (*count) += summon_specific(0, p_ptr->y, p_ptr->x, dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET), '\0');
+                       (*count) += summon_specific(0, p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET), '\0');
                        if (!one_in_(6)) break;
                case 10: case 11: case 12:
                        msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
@@ -3379,7 +3379,7 @@ bool activate_ty_curse(bool stop_ty, int *count)
                        /*
                         * Only summon Cyberdemons deep in the dungeon.
                         */
-                       if ((dun_level > 65) && !stop_ty)
+                       if ((current_floor_ptr->dun_level > 65) && !stop_ty)
                        {
                                (*count) += summon_cyber(-1, p_ptr->y, p_ptr->x);
                                stop_ty = TRUE;
@@ -3434,11 +3434,11 @@ int activate_hi_summon(POSITION y, POSITION x, bool can_pet)
 
        if (!pet) mode |= PM_NO_PET;
 
-       summon_lev = (pet ? p_ptr->lev * 2 / 3 + randint1(p_ptr->lev / 2) : dun_level);
+       summon_lev = (pet ? p_ptr->lev * 2 / 3 + randint1(p_ptr->lev / 2) : current_floor_ptr->dun_level);
 
-       for (i = 0; i < (randint1(7) + (dun_level / 40)); i++)
+       for (i = 0; i < (randint1(7) + (current_floor_ptr->dun_level / 40)); i++)
        {
-               switch (randint1(25) + (dun_level / 20))
+               switch (randint1(25) + (current_floor_ptr->dun_level / 20))
                {
                        case 1: case 2:
                                count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_ANT, mode, '\0');
@@ -3772,7 +3772,7 @@ bool rush_attack(bool *mdeath)
                ty = target_row;
        }
 
-       if (in_bounds(ty, tx)) tm_idx = grid_array[ty][tx].m_idx;
+       if (in_bounds(ty, tx)) tm_idx = current_floor_ptr->grid_array[ty][tx].m_idx;
 
        path_n = project_path(path_g, project_length, p_ptr->y, p_ptr->x, ty, tx, PROJECT_STOP | PROJECT_KILL);
        project_length = 0;
@@ -3792,7 +3792,7 @@ bool rush_attack(bool *mdeath)
                int ny = GRID_Y(path_g[i]);
                int nx = GRID_X(path_g[i]);
 
-               if (cave_empty_bold(ny, nx) && player_can_enter(grid_array[ny][nx].feat, 0))
+               if (cave_empty_bold(ny, nx) && player_can_enter(current_floor_ptr->grid_array[ny][nx].feat, 0))
                {
                        ty = ny;
                        tx = nx;
@@ -3801,7 +3801,7 @@ bool rush_attack(bool *mdeath)
                        continue;
                }
 
-               if (!grid_array[ny][nx].m_idx)
+               if (!current_floor_ptr->grid_array[ny][nx].m_idx)
                {
                        if (tm_idx)
                        {
@@ -3818,12 +3818,12 @@ bool rush_attack(bool *mdeath)
 
                /* Move player before updating the monster */
                if (!player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
-               update_monster(grid_array[ny][nx].m_idx, TRUE);
+               update_monster(current_floor_ptr->grid_array[ny][nx].m_idx, TRUE);
 
                /* Found a monster */
-               m_ptr = &m_list[grid_array[ny][nx].m_idx];
+               m_ptr = &current_floor_ptr->m_list[current_floor_ptr->grid_array[ny][nx].m_idx];
 
-               if (tm_idx != grid_array[ny][nx].m_idx)
+               if (tm_idx != current_floor_ptr->grid_array[ny][nx].m_idx)
                {
 #ifdef JP
                        msg_format("%s%sが立ちふさがっている!", tm_idx ? "別の" : "", m_ptr->ml ? "モンスター" : "何か");
@@ -3864,11 +3864,11 @@ void remove_all_mirrors(bool explode)
 {
        POSITION x, y;
 
-       for (x = 0; x < cur_wid; x++)
+       for (x = 0; x < current_floor_ptr->width; x++)
        {
-               for (y = 0; y < cur_hgt; y++)
+               for (y = 0; y < current_floor_ptr->height; y++)
                {
-                       if (is_mirror_grid(&grid_array[y][x]))
+                       if (is_mirror_grid(&current_floor_ptr->grid_array[y][x]))
                        {
                                remove_mirror(y, x);
                                if (explode)
@@ -4003,7 +4003,7 @@ void wild_magic(int spell)
                break;
        case 27:
        case 28:
-               (void)gain_random_mutation(0);
+               (void)gain_mutation(p_ptr, 0);
                break;
        case 29:
        case 30:
@@ -4022,7 +4022,7 @@ void wild_magic(int spell)
        case 35:
                while (counter++ < 8)
                {
-                       (void)summon_specific(0, p_ptr->y, p_ptr->x, (dun_level * 3) / 2, type, (PM_ALLOW_GROUP | PM_NO_PET), '\0');
+                       (void)summon_specific(0, p_ptr->y, p_ptr->x, (current_floor_ptr->dun_level * 3) / 2, type, (PM_ALLOW_GROUP | PM_NO_PET), '\0');
                }
                break;
        case 36:
@@ -4135,7 +4135,7 @@ bool cast_wrath_of_the_god(HIT_POINT dam, POSITION rad)
                if (!cave_have_flag_bold(ny, nx, FF_PROJECT)) break;
 
                /* Stopped by monsters */
-               if ((dir != 5) && grid_array[ny][nx].m_idx != 0) break;
+               if ((dir != 5) && current_floor_ptr->grid_array[ny][nx].m_idx != 0) break;
 
                /* Save the new location */
                x = nx;
@@ -4303,7 +4303,7 @@ void cast_invoke_spirits(DIRECTION dir)
                msg_print(_("なんてこった!あなたの周りの地面から朽ちた人影が立ち上がってきた!",
                        "Oh no! Mouldering forms rise from the earth around you!"));
 
-               (void)summon_specific(0, p_ptr->y, p_ptr->x, dun_level, SUMMON_UNDEAD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET), '\0');
+               (void)summon_specific(0, p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_UNDEAD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET), '\0');
                chg_virtue(V_UNLIFE, 1);
        }
        else if (die < 14)
@@ -4463,7 +4463,7 @@ void cast_shuffle(void)
        else if (die < 14)
        {
                msg_print(_("なんてこった!《悪魔》だ!", "Oh no! It's the Devil!"));
-               summon_specific(0, p_ptr->y, p_ptr->x, dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET), '\0');
+               summon_specific(0, p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET), '\0');
        }
        else if (die < 18)
        {
@@ -4485,7 +4485,7 @@ void cast_shuffle(void)
        else if (die < 30)
        {
                msg_print(_("奇妙なモンスターの絵だ。", "It's the picture of a strange monster."));
-               trump_summoning(1, FALSE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), (32 + randint1(6)), PM_ALLOW_GROUP | PM_ALLOW_UNIQUE);
+               trump_summoning(1, FALSE, p_ptr->y, p_ptr->x, (current_floor_ptr->dun_level * 3 / 2), (32 + randint1(6)), PM_ALLOW_GROUP | PM_ALLOW_UNIQUE);
        }
        else if (die < 33)
        {
@@ -4536,22 +4536,22 @@ void cast_shuffle(void)
        else if (die < 82)
        {
                msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
-               trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_MOLD, 0L);
+               trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (current_floor_ptr->dun_level * 3 / 2), SUMMON_MOLD, 0L);
        }
        else if (die < 84)
        {
                msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
-               trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_BAT, 0L);
+               trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (current_floor_ptr->dun_level * 3 / 2), SUMMON_BAT, 0L);
        }
        else if (die < 86)
        {
                msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
-               trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_VORTEX, 0L);
+               trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (current_floor_ptr->dun_level * 3 / 2), SUMMON_VORTEX, 0L);
        }
        else if (die < 88)
        {
                msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
-               trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_COIN_MIMIC, 0L);
+               trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (current_floor_ptr->dun_level * 3 / 2), SUMMON_COIN_MIMIC, 0L);
        }
        else if (die < 96)
        {
@@ -4568,7 +4568,7 @@ void cast_shuffle(void)
        else if (die < 111)
        {
                msg_print(_("《審判》だ。", "It's the Judgement."));
-               roll_hitdice(0L);
+               roll_hitdice(p_ptr, 0L);
                lose_all_mutations();
        }
        else if (die < 120)
@@ -4597,7 +4597,7 @@ void cast_shuffle(void)
  */
 void stop_mouth(void)
 {
-       if (music_singing_any()) stop_singing();
+       if (music_singing_any()) stop_singing(p_ptr);
        if (hex_spelling_any()) stop_hex_spell_all();
 }
 
@@ -4607,7 +4607,7 @@ bool_hack vampirism(void)
        DIRECTION dir;
        POSITION x, y;
        int dummy;
-       grid_type *c_ptr;
+       grid_type *g_ptr;
 
        if (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_MELEE)
        {
@@ -4619,11 +4619,11 @@ bool_hack vampirism(void)
        if (!get_direction(&dir, FALSE, FALSE)) return FALSE;
        y = p_ptr->y + ddy[dir];
        x = p_ptr->x + ddx[dir];
-       c_ptr = &grid_array[y][x];
+       g_ptr = &current_floor_ptr->grid_array[y][x];
 
        stop_mouth();
 
-       if (!(c_ptr->m_idx))
+       if (!(g_ptr->m_idx))
        {
                msg_print(_("何もない場所に噛みついた!", "You bite into thin air!"));
                return FALSE;
@@ -4662,7 +4662,7 @@ bool panic_hit(void)
        if (!get_direction(&dir, FALSE, FALSE)) return FALSE;
        y = p_ptr->y + ddy[dir];
        x = p_ptr->x + ddx[dir];
-       if (grid_array[y][x].m_idx)
+       if (current_floor_ptr->grid_array[y][x].m_idx)
        {
                py_attack(y, x, 0);
                if (randint0(p_ptr->skill_dis) < 7)
@@ -4969,8 +4969,8 @@ void hayagake(player_type *creature_ptr)
        }
        else
        {
-               grid_type *c_ptr = &grid_array[creature_ptr->y][creature_ptr->x];
-               feature_type *f_ptr = &f_info[c_ptr->feat];
+               grid_type *g_ptr = &current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x];
+               feature_type *f_ptr = &f_info[g_ptr->feat];
 
                if (!have_flag(f_ptr->flags, FF_PROJECT) ||
                        (!creature_ptr->levitation && have_flag(f_ptr->flags, FF_DEEP)))
@@ -4993,7 +4993,7 @@ bool double_attack(player_type *creature_ptr)
        if (!get_rep_dir(&dir, FALSE)) return FALSE;
        y = creature_ptr->y + ddy[dir];
        x = creature_ptr->x + ddx[dir];
-       if (grid_array[y][x].m_idx)
+       if (current_floor_ptr->grid_array[y][x].m_idx)
        {
                if (one_in_(3))
                        msg_print(_("あーたたたたたたたたたたたたたたたたたたたたたた!!!",
@@ -5006,7 +5006,7 @@ bool double_attack(player_type *creature_ptr)
                                "Oraoraoraoraoraoraoraoraoraoraoraoraoraoraoraoraora!!!!"));
 
                py_attack(y, x, 0);
-               if (grid_array[y][x].m_idx)
+               if (current_floor_ptr->grid_array[y][x].m_idx)
                {
                        handle_stuff();
                        py_attack(y, x, 0);
@@ -5074,7 +5074,7 @@ bool mirror_concentration(player_type *creature_ptr)
                msg_print(_("今はペットを操ることに集中していないと。", "You need concentration on the pets now."));
                return FALSE;
        }
-       if (is_mirror_grid(&grid_array[creature_ptr->y][creature_ptr->x]))
+       if (is_mirror_grid(&current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x]))
        {
                msg_print(_("少し頭がハッキリした。", "You feel your head clear a little."));
 
@@ -5098,17 +5098,17 @@ bool sword_dancing(player_type *creature_ptr)
        DIRECTION dir;
        POSITION y = 0, x = 0;
        int i;
-       grid_type *c_ptr;
+       grid_type *g_ptr;
 
        for (i = 0; i < 6; i++)
        {
                dir = randint0(8);
                y = creature_ptr->y + ddy_ddd[dir];
                x = creature_ptr->x + ddx_ddd[dir];
-               c_ptr = &grid_array[y][x];
+               g_ptr = &current_floor_ptr->grid_array[y][x];
 
                /* Hack -- attack monsters */
-               if (c_ptr->m_idx)
+               if (g_ptr->m_idx)
                        py_attack(y, x, 0);
                else
                {
@@ -5143,7 +5143,7 @@ bool rodeo(player_type *creature_ptr)
        }
        if (!do_riding(TRUE)) return TRUE;
 
-       m_ptr = &m_list[creature_ptr->riding];
+       m_ptr = &current_floor_ptr->m_list[creature_ptr->riding];
        r_ptr = &r_info[m_ptr->r_idx];
        monster_desc(m_name, m_ptr, 0);
        msg_format(_("%sに乗った。", "You ride on %s."), m_name);