OSDN Git Service

[Refactor] monster_name() で一部 cmd2.c の投擲対象処理を整理。
[hengband/hengband.git] / src / monster2.c
index 40a6b2a..33ff4ae 100644 (file)
 
 #include "angband.h"
 #include "cmd-pet.h"
-#include "monster-hook.h"
+#include "monsterrace-hook.h"
 #include "monster-status.h"
+#include "projection.h"
+#include "monster.h"
+#include "spells-summon.h"
+#include "quest.h"
+#include "grid.h"
+#include "player-move.h"
+#include "wild.h"
+#include "warning.h"
+#include "player-status.h"
+#include "monster-spell.h"
 
 #define HORDE_NOGOOD 0x01 /*!< (未実装フラグ)HORDE生成でGOODなモンスターの生成を禁止する? */
 #define HORDE_NOEVIL 0x02 /*!< (未実装フラグ)HORDE生成でEVILなモンスターの生成を禁止する? */
 
 
 /*!
- * @var horror_desc
- * @brief ELDRITCH HORROR効果時のモンスターの形容メッセージ(通常時)
- */
-cptr horror_desc[MAX_SAN_HORROR] =
-{
-#ifdef JP
-       "忌まわしい",
-       "底知れぬ",
-       "ぞっとする",
-       "破滅的な",
-       "冒涜的な",
-
-       "いやな",
-       "恐ろしい",
-       "不潔な",
-       "容赦のない",
-       "おぞましい",
-
-       "地獄の",
-       "身の毛もよだつ",
-       "地獄の",
-       "忌まわしい",
-       "悪夢のような",
-
-       "嫌悪を感じる",
-       "罰当たりな",
-       "恐い",
-       "不浄な",
-       "言うもおぞましい",
-#else
-       "abominable",
-       "abysmal",
-       "appalling",
-       "baleful",
-       "blasphemous",
-
-       "disgusting",
-       "dreadful",
-       "filthy",
-       "grisly",
-       "hideous",
-
-       "hellish",
-       "horrible",
-       "infernal",
-       "loathsome",
-       "nightmarish",
-
-       "repulsive",
-       "sacrilegious",
-       "terrible",
-       "unclean",
-       "unspeakable",
-#endif
-
-};
-
-/*!
- * @var funny_desc
- * @brief ELDRITCH HORROR効果時のモンスターの形容メッセージ(幻覚状態時)
- */
-cptr funny_desc[MAX_SAN_FUNNY] =
-{
-#ifdef JP
-       "間抜けな",
-       "滑稽な",
-       "ばからしい",
-       "無味乾燥な",
-       "馬鹿げた",
-
-       "笑える",
-       "ばかばかしい",
-       "ぶっとんだ",
-       "いかした",
-       "ポストモダンな",
-
-       "ファンタスティックな",
-       "ダダイズム的な",
-       "キュビズム的な",
-       "宇宙的な",
-       "卓越した",
-
-       "理解不能な",
-       "ものすごい",
-       "驚くべき",
-       "信じられない",
-       "カオティックな",
-
-       "野性的な",
-       "非常識な",
-#else
-       "silly",
-       "hilarious",
-       "absurd",
-       "insipid",
-       "ridiculous",
-
-       "laughable",
-       "ludicrous",
-       "far-out",
-       "groovy",
-       "postmodern",
-
-       "fantastic",
-       "dadaistic",
-       "cubistic",
-       "cosmic",
-       "awesome",
-
-       "incomprehensible",
-       "fabulous",
-       "amazing",
-       "incredible",
-       "chaotic",
-
-       "wild",
-       "preposterous",
-#endif
-
-};
-
-/*!
- * @var funny_comments
- * @brief ELDRITCH HORROR効果時の幻覚時間延長を示す錯乱表現
- */
-cptr funny_comments[MAX_SAN_COMMENT] =
-{
-#ifdef JP
-  /* nuke me */
-       "最高だぜ!",
-       "うひょー!",
-       "いかすぜ!",
-       "すんばらしい!",
-       "ぶっとびー!"
-#else
-       "Wow, cosmic, man!",
-       "Rad!",
-       "Groovy!",
-       "Cool!",
-       "Far out!"
-#endif
-
-};
-
-
-/*!
  * @brief モンスターの目標地点をセットする / Set the target of counter attack
  * @param m_ptr モンスターの参照ポインタ
  * @param y 目標y座標
@@ -197,19 +61,24 @@ void reset_target(monster_type *m_ptr)
  */
 monster_race *real_r_ptr(monster_type *m_ptr)
 {
+       return &r_info[real_r_idx(m_ptr)];
+}
+
+MONRACE_IDX real_r_idx(monster_type *m_ptr)
+{
        monster_race *r_ptr = &r_info[m_ptr->r_idx];
 
        /* Extract real race */
        if (m_ptr->mflag2 & MFLAG2_CHAMELEON)
        {
                if (r_ptr->flags1 & RF1_UNIQUE)
-                       return &r_info[MON_CHAMELEON_K];
+                       return MON_CHAMELEON_K;
                else
-                       return &r_info[MON_CHAMELEON];
+                       return MON_CHAMELEON;
        }
        else
        {
-               return r_ptr;
+               return m_ptr->r_idx;
        }
 }
 
@@ -225,11 +94,10 @@ monster_race *real_r_ptr(monster_type *m_ptr)
 void delete_monster_idx(MONSTER_IDX i)
 {
        POSITION x, y;
-       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];
        OBJECT_IDX this_o_idx, next_o_idx = 0;
 
-       /* Get location */
        y = m_ptr->fy;
        x = m_ptr->fx;
 
@@ -237,7 +105,7 @@ void delete_monster_idx(MONSTER_IDX i)
        real_r_ptr(m_ptr)->cur_num--;
 
        /* Hack -- count the number of "reproducers" */
-       if (r_ptr->flags2 & (RF2_MULTIPLY)) num_repro--;
+       if (r_ptr->flags2 & (RF2_MULTIPLY)) 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);
@@ -247,7 +115,6 @@ void delete_monster_idx(MONSTER_IDX i)
        if (MON_MONFEAR(m_ptr)) (void)set_monster_monfear(i, 0);
        if (MON_INVULNER(m_ptr)) (void)set_monster_invulner(i, 0, FALSE);
 
-
        /* Hack -- remove target monster */
        if (i == target_who) target_who = 0;
 
@@ -259,18 +126,12 @@ void delete_monster_idx(MONSTER_IDX i)
        if (p_ptr->riding == i) p_ptr->riding = 0;
 
        /* Monster is gone */
-       cave[y][x].m_idx = 0;
-
+       current_floor_ptr->grid_array[y][x].m_idx = 0;
 
-       /* Delete objects */
        for (this_o_idx = m_ptr->hold_o_idx; this_o_idx; this_o_idx = next_o_idx)
        {
                object_type *o_ptr;
-
-               /* Acquire object */
-               o_ptr = &o_list[this_o_idx];
-
-               /* Acquire next object */
+               o_ptr = &current_floor_ptr->o_list[this_o_idx];
                next_o_idx = o_ptr->next_o_idx;
 
                /*
@@ -278,26 +139,19 @@ void delete_monster_idx(MONSTER_IDX i)
                 * to prevent calling lite_spot()
                 */
 
-               /* Delete the object */
                delete_object_idx(this_o_idx);
        }
 
-
-       if (is_pet(m_ptr)) check_pets_num_and_align(m_ptr, FALSE);
-
-
-       /* Wipe the Monster */
        (void)WIPE(m_ptr, monster_type);
 
        /* Count monsters */
        m_cnt--;
 
-       /* Visual update */
        lite_spot(y, x);
-
-       /* Update some things */
        if (r_ptr->flags7 & (RF7_LITE_MASK | RF7_DARK_MASK))
+       {
                p_ptr->update |= (PU_MON_LITE);
+       }
 }
 
 
@@ -309,16 +163,14 @@ void delete_monster_idx(MONSTER_IDX i)
  */
 void delete_monster(POSITION y, POSITION x)
 {
-       cave_type *c_ptr;
-
-       /* Paranoia */
+       grid_type *g_ptr;
        if (!in_bounds(y, x)) return;
 
        /* Check the grid */
-       c_ptr = &cave[y][x];
+       g_ptr = &current_floor_ptr->grid_array[y][x];
 
        /* Delete the monster (if any) */
-       if (c_ptr->m_idx) delete_monster_idx(c_ptr->m_idx);
+       if (g_ptr->m_idx) delete_monster_idx(g_ptr->m_idx);
 }
 
 
@@ -328,11 +180,11 @@ void delete_monster(POSITION y, POSITION x)
  * @param i2 配列移動先添字
  * @return なし
  */
-static void compact_monsters_aux(IDX i1, IDX i2)
+static void compact_monsters_aux(MONSTER_IDX i1, MONSTER_IDX i2)
 {
        POSITION y, x;
        int i;
-       cave_type *c_ptr;
+       grid_type *g_ptr;
        monster_type *m_ptr;
        OBJECT_IDX this_o_idx, next_o_idx = 0;
 
@@ -340,26 +192,22 @@ static void compact_monsters_aux(IDX i1, IDX i2)
        if (i1 == i2) return;
 
        /* Old monster */
-       m_ptr = &m_list[i1];
+       m_ptr = &current_floor_ptr->m_list[i1];
 
        y = m_ptr->fy;
        x = m_ptr->fx;
 
        /* Cave grid */
-       c_ptr = &cave[y][x];
+       g_ptr = &current_floor_ptr->grid_array[y][x];
 
-       /* Update the cave */
-       c_ptr->m_idx = i2;
+       /* Update the current_floor_ptr->grid_array */
+       g_ptr->m_idx = i2;
 
        /* Repair objects being carried by monster */
        for (this_o_idx = m_ptr->hold_o_idx; this_o_idx; this_o_idx = next_o_idx)
        {
                object_type *o_ptr;
-
-               /* Acquire object */
-               o_ptr = &o_list[this_o_idx];
-
-               /* Acquire next object */
+               o_ptr = &current_floor_ptr->o_list[this_o_idx];
                next_o_idx = o_ptr->next_o_idx;
 
                /* Reset monster pointer */
@@ -384,7 +232,7 @@ static void compact_monsters_aux(IDX i1, IDX i2)
        {
                for (i = 1; i < m_max; i++)
                {
-                       monster_type *m2_ptr = &m_list[i];
+                       monster_type *m2_ptr = &current_floor_ptr->m_list[i];
 
                        if (m2_ptr->parent_m_idx == i1)
                                m2_ptr->parent_m_idx = i2;
@@ -392,15 +240,15 @@ static void compact_monsters_aux(IDX i1, IDX i2)
        }
 
        /* Structure copy */
-       (void)COPY(&m_list[i2], &m_list[i1], monster_type);
+       (void)COPY(&current_floor_ptr->m_list[i2], &current_floor_ptr->m_list[i1], monster_type);
 
        /* Wipe the hole */
-       (void)WIPE(&m_list[i1], monster_type);
+       (void)WIPE(&current_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) mproc_list[i][mproc_idx] = i2;
+               if (mproc_idx >= 0) current_floor_ptr->mproc_list[i][mproc_idx] = i2;
        }
 }
 
@@ -441,12 +289,12 @@ void compact_monsters(int size)
                /* Check all the 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 */
-                       if (!m_ptr->r_idx) continue;
+                       if (!monster_is_valid(m_ptr)) continue;
 
                        /* Hack -- High level monsters start out "immune" */
                        if (r_ptr->level > cur_lev) continue;
@@ -470,13 +318,11 @@ void compact_monsters(int size)
 
                        if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
                        {
-                               char m_name[80];
-
+                               GAME_TEXT m_name[MAX_NLEN];
                                monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
                                do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_COMPACT, m_name);
                        }
 
-                       /* Delete the monster */
                        delete_monster_idx(i);
 
                        /* Count the monster */
@@ -489,7 +335,7 @@ void compact_monsters(int size)
        for (i = m_max - 1; i >= 1; i--)
        {
                /* Get the i'th monster */
-               monster_type *m_ptr = &m_list[i];
+               monster_type *m_ptr = &current_floor_ptr->m_list[i];
 
                /* Skip real monsters */
                if (m_ptr->r_idx) continue;
@@ -536,15 +382,12 @@ void wipe_m_list(void)
        /* Delete all the monsters */
        for (i = m_max - 1; i >= 1; i--)
        {
-               monster_type *m_ptr = &m_list[i];
-
-               /* Skip dead monsters */
-               if (!m_ptr->r_idx) continue;
+               monster_type *m_ptr = &current_floor_ptr->m_list[i];
+               if (!monster_is_valid(m_ptr)) continue;
 
                /* Monster is gone */
-               cave[m_ptr->fy][m_ptr->fx].m_idx = 0;
+               current_floor_ptr->grid_array[m_ptr->fy][m_ptr->fx].m_idx = 0;
 
-               /* Wipe the Monster */
                (void)WIPE(m_ptr, monster_type);
 
        }
@@ -564,11 +407,11 @@ void wipe_m_list(void)
        /* Reset "m_cnt" */
        m_cnt = 0;
 
-       /* Reset "mproc_max[]" */
-       for (i = 0; i < MAX_MTIMED; i++) mproc_max[i] = 0;
+       /* Reset "current_floor_ptr->mproc_max[]" */
+       for (i = 0; i < MAX_MTIMED; i++) current_floor_ptr->mproc_max[i] = 0;
 
        /* Hack -- reset "reproducer" count */
-       num_repro = 0;
+       current_floor_ptr->num_repro = 0;
 
        /* Hack -- no more target */
        target_who = 0;
@@ -590,9 +433,8 @@ MONSTER_IDX m_pop(void)
 {
        MONSTER_IDX i;
 
-
        /* Normal allocation */
-       if (m_max < max_m_idx)
+       if (m_max < current_floor_ptr->max_m_idx)
        {
                /* Access the next hole */
                i = m_max;
@@ -607,14 +449,13 @@ MONSTER_IDX m_pop(void)
                return (i);
        }
 
-
        /* Recycle dead monsters */
        for (i = 1; i < m_max; i++)
        {
                monster_type *m_ptr;
 
                /* Acquire monster */
-               m_ptr = &m_list[i];
+               m_ptr = &current_floor_ptr->m_list[i];
 
                /* Skip live monsters */
                if (m_ptr->r_idx) continue;
@@ -626,7 +467,6 @@ MONSTER_IDX m_pop(void)
                return (i);
        }
 
-
        /* Warn the player (except during dungeon creation) */
        if (character_dungeon) msg_print(_("モンスターが多すぎる!", "Too many monsters!"));
 
@@ -800,7 +640,6 @@ static bool summon_specific_aux(MONRACE_IDX r_idx)
                        break;
                }
 
-
                case SUMMON_KIN:
                {
                        okay = ((r_ptr->d_char == summon_kin_type) && (r_idx != MON_HAGURE));
@@ -834,13 +673,13 @@ static bool summon_specific_aux(MONRACE_IDX r_idx)
 
                case SUMMON_HI_DRAGON_LIVING:
                {
-                       okay = ((r_ptr->d_char == 'D') && monster_living(r_ptr));
+                       okay = ((r_ptr->d_char == 'D') && monster_living(r_idx));
                        break;
                }
 
                case SUMMON_LIVING:
                {
-                       okay = monster_living(r_ptr);
+                       okay = monster_living(r_idx);
                        break;
                }
 
@@ -894,7 +733,7 @@ static bool summon_specific_aux(MONRACE_IDX r_idx)
 
                        for (i = 0; i < 4; i++)
                                if (r_ptr->blow[i].method == RBM_EXPLODE) okay = TRUE;
-                       okay = (okay && monster_living(r_ptr));
+                       okay = (okay && monster_living(r_idx));
                        break;
                }
 
@@ -954,8 +793,6 @@ static bool summon_specific_aux(MONRACE_IDX r_idx)
                        break;
                }
        }
-
-       /* Result */
        /* Since okay is int, "return (okay);" is not correct. */
        return (bool)(okay ? TRUE : FALSE);
 }
@@ -975,7 +812,7 @@ static int chameleon_change_m_idx = 0;
  */
 static bool restrict_monster_to_dungeon(MONRACE_IDX r_idx)
 {
-       dungeon_info_type *d_ptr = &d_info[dungeon_type];
+       dungeon_type *d_ptr = &d_info[p_ptr->dungeon_idx];
        monster_race *r_ptr = &r_info[r_idx];
        byte a;
 
@@ -1002,7 +839,7 @@ static bool restrict_monster_to_dungeon(MONRACE_IDX r_idx)
        }
        if (d_ptr->flags1 & DF1_BEGINNER)
        {
-               if (r_ptr->level > dun_level)
+               if (r_ptr->level > current_floor_ptr->dun_level)
                        return FALSE;
        }
 
@@ -1165,8 +1002,8 @@ static bool restrict_monster_to_dungeon(MONRACE_IDX r_idx)
  * @param monster_hook2 制限関数2
  * @return エラーコード
  */
-errr get_mon_num_prep(monster_hook_type monster_hook,
-                                         monster_hook_type monster_hook2)
+errr get_mon_num_prep(monsterrace_hook_type monster_hook,
+                                         monsterrace_hook_type monster_hook2)
 {
        int i;
 
@@ -1179,7 +1016,7 @@ errr get_mon_num_prep(monster_hook_type monster_hook,
        /* Scan the allocation table */
        for (i = 0; i < alloc_race_size; i++)
        {
-               monster_race    *r_ptr;
+               monster_race *r_ptr;
                
                /* Get the entry */
                alloc_entry *entry = &alloc_race_table[i];
@@ -1204,16 +1041,16 @@ errr get_mon_num_prep(monster_hook_type monster_hook,
 
                        /* Depth Monsters never appear out of depth */
                        if ((r_ptr->flags1 & (RF1_FORCE_DEPTH)) &&
-                           (r_ptr->level > dun_level))
+                           (r_ptr->level > current_floor_ptr->dun_level))
                                continue;
                }
 
                /* Accept this monster */
                entry->prob2 = entry->prob1;
 
-               if (dun_level && (!p_ptr->inside_quest || is_fixed_quest_idx(p_ptr->inside_quest)) && !restrict_monster_to_dungeon(entry->index) && !p_ptr->inside_battle)
+               if (current_floor_ptr->dun_level && (!p_ptr->inside_quest || is_fixed_quest_idx(p_ptr->inside_quest)) && !restrict_monster_to_dungeon(entry->index) && !p_ptr->inside_battle)
                {
-                       int hoge = entry->prob2 * d_info[dungeon_type].special_div;
+                       int hoge = entry->prob2 * d_info[p_ptr->dungeon_idx].special_div;
                        entry->prob2 = hoge / 64;
                        if (randint0(64) < (hoge & 0x3f)) entry->prob2++;
                }
@@ -1223,47 +1060,6 @@ errr get_mon_num_prep(monster_hook_type monster_hook,
        return (0);
 }
 
-/*!
- * @brief 平方根を切り捨て整数で返す
- * @param n 数値
- * @return 平方根
- */
-static int mysqrt(int n)
-{
-       int tmp = n>>1;
-       int tasu = 10;
-       int kaeriti = 1;
-
-       if (!tmp)
-       {
-               if (n) return 1;
-               else return 0;
-       }
-
-       while(tmp)
-       {
-               if ((n/tmp) < tmp)
-               {
-                       tmp >>= 1;
-               }
-               else break;
-       }
-       kaeriti = tmp;
-       while(tasu)
-       {
-               if ((n/tmp) < tmp)
-               {
-                       tasu--;
-                       tmp = kaeriti;
-               }
-               else
-               {
-                       kaeriti = tmp;
-                       tmp += tasu;
-               }
-       }
-       return kaeriti;
-}
 
 /*!
  * @brief 生成モンスター種族を1種生成テーブルから選択する
@@ -1293,21 +1089,19 @@ static int mysqrt(int n)
  */
 MONRACE_IDX get_mon_num(DEPTH level)
 {
-       int                     i, j, p;
-       int                     r_idx;
-       long            value, total;
-       monster_race    *r_ptr;
-       alloc_entry             *table = alloc_race_table;
+       int i, j, p;
+       MONRACE_IDX r_idx;
+       long value, total;
+       monster_race *r_ptr;
+       alloc_entry *table = alloc_race_table;
 
        int pls_kakuritu, pls_level;
        int delay = mysqrt(level * 10000L) + 400L;
 
-       if (level > MAX_DEPTH - 1) level = MAX_DEPTH - 1;
-
-       pls_kakuritu = MAX(NASTY_MON_MAX, NASTY_MON_BASE - ((dungeon_turn / (TURNS_PER_TICK * 5000L) - delay / 10)));
-       pls_level    = MIN(NASTY_MON_PLUS_MAX, 3 + dungeon_turn / (TURNS_PER_TICK * 40000L) - delay / 40 + MIN(5, level / 10)) ;
+       pls_kakuritu = MAX(NASTY_MON_MAX, NASTY_MON_BASE - ((current_world_ptr->dungeon_turn / (TURNS_PER_TICK * 5000L) - delay / 10)));
+       pls_level    = MIN(NASTY_MON_PLUS_MAX, 3 + current_world_ptr->dungeon_turn / (TURNS_PER_TICK * 40000L) - delay / 40 + MIN(5, level / 10)) ;
 
-       if (d_info[dungeon_type].flags1 & DF1_MAZE)
+       if (d_info[p_ptr->dungeon_idx].flags1 & DF1_MAZE)
        {
                pls_kakuritu = MIN(pls_kakuritu / 2, pls_kakuritu - 10);
                if (pls_kakuritu < 2) pls_kakuritu = 2;
@@ -1316,7 +1110,7 @@ MONRACE_IDX get_mon_num(DEPTH level)
        }
 
        /* Boost the level */
-       if (!p_ptr->inside_battle && !(d_info[dungeon_type].flags1 & DF1_BEGINNER))
+       if (!p_ptr->inside_battle && !(d_info[p_ptr->dungeon_idx].flags1 & DF1_BEGINNER))
        {
                /* Nightmare mode allows more out-of depth monsters */
                if (ironman_nightmare && !randint0(pls_kakuritu))
@@ -1335,6 +1129,9 @@ MONRACE_IDX get_mon_num(DEPTH level)
                }
        }
 
+       if (level > MAX_DEPTH - 1) level = MAX_DEPTH - 1;
+       if (level < 0) level = 0;
+
        /* Reset total */
        total = 0L;
 
@@ -1447,8 +1244,6 @@ MONRACE_IDX get_mon_num(DEPTH level)
                /* Keep the "best" one */
                if (table[i].level < table[j].level) i = j;
        }
-
-       /* Result */
        return (table[i].index);
 }
 
@@ -1508,12 +1303,12 @@ MONRACE_IDX get_mon_num(DEPTH level)
  */
 void monster_desc(char *desc, monster_type *m_ptr, BIT_FLAGS mode)
 {
-       cptr            res;
+       concptr            res;
        monster_race    *r_ptr;
 
-       cptr            name;
+       concptr            name;
        char            buf[128];
-       char            silly_name[1024];
+       GAME_TEXT silly_name[1024];
        bool            seen, pron;
        bool            named = FALSE;
 
@@ -1651,15 +1446,9 @@ void monster_desc(char *desc, monster_type *m_ptr, BIT_FLAGS mode)
        else if ((mode & (MD_POSSESSIVE | MD_OBJECTIVE)) == (MD_POSSESSIVE | MD_OBJECTIVE))
        {
                /* The monster is visible, so use its gender */
-#ifdef JP
-               if (r_ptr->flags1 & (RF1_FEMALE)) strcpy(desc, "彼女自身");
-               else if (r_ptr->flags1 & (RF1_MALE)) strcpy(desc, "彼自身");
-               else strcpy(desc, "それ自身");
-#else
-               if (r_ptr->flags1 & RF1_FEMALE) strcpy(desc, "herself");
-               else if (r_ptr->flags1 & RF1_MALE) strcpy(desc, "himself");
-               else strcpy(desc, "itself");
-#endif
+               if (r_ptr->flags1 & (RF1_FEMALE)) strcpy(desc, _("彼女自身", "herself"));
+               else if (r_ptr->flags1 & (RF1_MALE)) strcpy(desc, _("彼自身", "himself"));
+               else strcpy(desc, _("それ自身", "itself"));
        }
 
 
@@ -1712,7 +1501,7 @@ void monster_desc(char *desc, monster_type *m_ptr, BIT_FLAGS mode)
 
                        /* Inside monster arena, and it is not your mount */
                        else if (p_ptr->inside_battle &&
-                                !(p_ptr->riding && (&m_list[p_ptr->riding] == m_ptr)))
+                                !(p_ptr->riding && (&current_floor_ptr->m_list[p_ptr->riding] == m_ptr)))
                        {
                                /* It is a fake unique monster */
                                (void)sprintf(desc, _("%sもどき", "fake %s"), name);
@@ -1757,7 +1546,7 @@ void monster_desc(char *desc, monster_type *m_ptr, BIT_FLAGS mode)
                        strcat(desc,buf);
                }
 
-               if (p_ptr->riding && (&m_list[p_ptr->riding] == m_ptr))
+               if (p_ptr->riding && (&current_floor_ptr->m_list[p_ptr->riding] == m_ptr))
                {
                        strcat(desc,_("(乗馬中)", "(riding)"));
                }
@@ -1790,6 +1579,16 @@ void monster_desc(char *desc, monster_type *m_ptr, BIT_FLAGS mode)
        }
 }
 
+/*!
+* @brief モンスターIDを取り、モンスター名をm_nameに代入する /
+* @param m_idx モンスターID
+* @param m_name モンスター名を入力する配列
+*/
+void monster_name(MONSTER_IDX m_idx, char* m_name)
+{
+       monster_type *m_ptr = &current_floor_ptr->m_list[m_idx];
+       monster_desc(m_name, m_ptr, 0x00);
+}
 
 
 /*!
@@ -1918,7 +1717,7 @@ int lore_do_probe(MONRACE_IDX r_idx)
  */
 void lore_treasure(MONSTER_IDX m_idx, ITEM_NUMBER num_item, ITEM_NUMBER num_gold)
 {
-       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];
 
@@ -1942,294 +1741,6 @@ void lore_treasure(MONSTER_IDX m_idx, ITEM_NUMBER num_item, ITEM_NUMBER num_gold
 
 
 /*!
- * @brief ELDRITCH_HORRORによるプレイヤーの精神破壊処理
- * @param m_ptr ELDRITCH_HORRORを引き起こしたモンスターの参照ポインタ
- * @param necro 暗黒領域魔法の詠唱失敗によるものならばTRUEを返す
- * @return なし
- */
-void sanity_blast(monster_type *m_ptr, bool necro)
-{
-       int power = 100;
-
-       if (p_ptr->inside_battle || !character_dungeon) return;
-
-       if (!necro && m_ptr)
-       {
-               char m_name[80];
-               monster_race *r_ptr = &r_info[m_ptr->ap_r_idx];
-
-               power = r_ptr->level / 2;
-
-               monster_desc(m_name, m_ptr, 0);
-
-               if (!(r_ptr->flags1 & RF1_UNIQUE))
-               {
-                       if (r_ptr->flags1 & RF1_FRIENDS)
-                       power /= 2;
-               }
-               else power *= 2;
-
-               if (!is_loading_now)
-                       return; /* No effect yet, just loaded... */
-
-               if (!m_ptr->ml)
-                       return; /* Cannot see it for some reason */
-
-               if (!(r_ptr->flags2 & RF2_ELDRITCH_HORROR))
-
-               if (is_pet(m_ptr))
-                       return; /* Pet eldritch horrors are safe most of the time */
-
-               if (randint1(100) > power) return;
-
-               if (saving_throw(p_ptr->skill_sav - power))
-               {
-                       return; /* Save, no adverse effects */
-               }
-
-               if (p_ptr->image)
-               {
-                       /* Something silly happens... */
-#ifdef JP
-                       msg_format("%s%sの顔を見てしまった!",
-                               funny_desc[randint0(MAX_SAN_FUNNY)], m_name);
-#else
-                       msg_format("You behold the %s visage of %s!",
-                               funny_desc[randint0(MAX_SAN_FUNNY)], m_name);
-#endif
-
-                       if (one_in_(3))
-                       {
-                               msg_print(funny_comments[randint0(MAX_SAN_COMMENT)]);
-                               p_ptr->image = p_ptr->image + randint1(r_ptr->level);
-                       }
-
-                       return; /* Never mind; we can't see it clearly enough */
-               }
-
-               /* Something frightening happens... */
-#ifdef JP
-               msg_format("%s%sの顔を見てしまった!",
-                       horror_desc[randint0(MAX_SAN_HORROR)], m_name);
-#else
-               msg_format("You behold the %s visage of %s!",
-                       horror_desc[randint0(MAX_SAN_HORROR)], m_name);
-#endif
-
-               r_ptr->r_flags2 |= RF2_ELDRITCH_HORROR;
-
-               /* Demon characters are unaffected */
-               if (prace_is_(RACE_IMP) || prace_is_(RACE_DEMON) || (mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_DEMON)) return;
-               if (p_ptr->wizard) return;
-
-               /* Undead characters are 50% likely to be unaffected */
-               if (prace_is_(RACE_SKELETON) || prace_is_(RACE_ZOMBIE)
-                       || prace_is_(RACE_VAMPIRE) || prace_is_(RACE_SPECTRE) ||
-                   (mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_UNDEAD))
-               {
-                       if (saving_throw(25 + p_ptr->lev)) return;
-               }
-       }
-       else if(!necro)
-       {
-               monster_race *r_ptr;
-               char m_name[80];
-               cptr desc;
-
-               get_mon_num_prep(get_nightmare, NULL);
-
-               r_ptr = &r_info[get_mon_num(MAX_DEPTH)];
-               power = r_ptr->level + 10;
-               desc = r_name + r_ptr->name;
-
-               get_mon_num_prep(NULL, NULL);
-
-               /* Describe it */
-#ifndef JP
-               if (!(r_ptr->flags1 & RF1_UNIQUE))
-                       sprintf(m_name, "%s %s", (is_a_vowel(desc[0]) ? "an" : "a"), desc);
-               else
-#endif
-               sprintf(m_name, "%s", desc);
-
-               if (!(r_ptr->flags1 & RF1_UNIQUE))
-               {
-                       if (r_ptr->flags1 & RF1_FRIENDS) power /= 2;
-               }
-               else power *= 2;
-
-               if (saving_throw(p_ptr->skill_sav * 100 / power))
-               {
-                       msg_format(_("夢の中で%sに追いかけられた。", "%^s chases you through your dreams."), m_name);
-                       /* Safe */
-                       return;
-               }
-
-               if (p_ptr->image)
-               {
-                       /* Something silly happens... */
-                       msg_format(_("%s%sの顔を見てしまった!", "You behold the %s visage of %s!"),
-                                               funny_desc[randint0(MAX_SAN_FUNNY)], m_name);
-
-                       if (one_in_(3))
-                       {
-                               msg_print(funny_comments[randint0(MAX_SAN_COMMENT)]);
-                               p_ptr->image = p_ptr->image + randint1(r_ptr->level);
-                       }
-
-                       /* Never mind; we can't see it clearly enough */
-                       return;
-               }
-
-               /* Something frightening happens... */
-               msg_format(_("%s%sの顔を見てしまった!", "You behold the %s visage of %s!"),
-                                 horror_desc[randint0(MAX_SAN_HORROR)], desc);
-
-               r_ptr->r_flags2 |= RF2_ELDRITCH_HORROR;
-
-               if (!p_ptr->mimic_form)
-               {
-                       switch (p_ptr->prace)
-                       {
-                       /* Demons may make a saving throw */
-                       case RACE_IMP:
-                       case RACE_DEMON:
-                               if (saving_throw(20 + p_ptr->lev)) return;
-                               break;
-                       /* Undead may make a saving throw */
-                       case RACE_SKELETON:
-                       case RACE_ZOMBIE:
-                       case RACE_SPECTRE:
-                       case RACE_VAMPIRE:
-                               if (saving_throw(10 + p_ptr->lev)) return;
-                               break;
-                       }
-               }
-               else
-               {
-                       /* Demons may make a saving throw */
-                       if (mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_DEMON)
-                       {
-                               if (saving_throw(20 + p_ptr->lev)) return;
-                       }
-                       /* Undead may make a saving throw */
-                       else if (mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_UNDEAD)
-                       {
-                               if (saving_throw(10 + p_ptr->lev)) return;
-                       }
-               }
-       }
-       else
-       {
-               msg_print(_("ネクロノミコンを読んで正気を失った!", "Your sanity is shaken by reading the Necronomicon!"));
-       }
-
-       if (saving_throw(p_ptr->skill_sav - power))
-       {
-               return;
-       }
-
-       do {
-               (void)do_dec_stat(A_INT);
-       } while (randint0(100) > p_ptr->skill_sav && one_in_(2));
-
-       do {
-               (void)do_dec_stat(A_WIS);
-       } while (randint0(100) > p_ptr->skill_sav && one_in_(2));
-
-       switch (randint1(21))
-       {
-       case 1:
-               if (!(p_ptr->muta3 & MUT3_MORONIC) && one_in_(5))
-               {
-                       if ((p_ptr->stat_use[A_INT] < 4) && (p_ptr->stat_use[A_WIS] < 4))
-                       {
-                               msg_print(_("あなたは完璧な馬鹿になったような気がした。しかしそれは元々だった。", "You turn into an utter moron!"));
-                       }
-                       else
-                       {
-                               msg_print(_("あなたは完璧な馬鹿になった!", "You turn into an utter moron!"));
-                       }
-
-                       if (p_ptr->muta3 & MUT3_HYPER_INT)
-                       {
-                               msg_print(_("あなたの脳は生体コンピュータではなくなった。", "Your brain is no longer a living computer."));
-                               p_ptr->muta3 &= ~(MUT3_HYPER_INT);
-                       }
-                       p_ptr->muta3 |= MUT3_MORONIC;
-               }
-               break;
-       case 2:
-       case 3:
-       case 4:
-               if (!(p_ptr->muta2 & MUT2_COWARDICE) && !p_ptr->resist_fear)
-               {
-                       msg_print(_("あなたはパラノイアになった!", "You become paranoid!"));
-
-                       /* Duh, the following should never happen, but anyway... */
-                       if (p_ptr->muta3 & MUT3_FEARLESS)
-                       {
-                               msg_print(_("あなたはもう恐れ知らずではなくなった。", "You are no longer fearless."));
-                               p_ptr->muta3 &= ~(MUT3_FEARLESS);
-                       }
-
-                       p_ptr->muta2 |= MUT2_COWARDICE;
-               }
-               break;
-       case 5:
-       case 6:
-       case 7:
-               if (!(p_ptr->muta2 & MUT2_HALLU) && !p_ptr->resist_chaos)
-               {
-                       msg_print(_("幻覚をひき起こす精神錯乱に陥った!", "You are afflicted by a hallucinatory insanity!"));
-                       p_ptr->muta2 |= MUT2_HALLU;
-               }
-               break;
-       case 8:
-       case 9:
-       case 10:
-               if (!(p_ptr->muta2 & MUT2_BERS_RAGE))
-               {
-                       msg_print(_("激烈な感情の発作におそわれるようになった!", "You become subject to fits of berserk rage!"));
-                       p_ptr->muta2 |= MUT2_BERS_RAGE;
-               }
-               break;
-       case 11:
-       case 12:
-       case 13:
-       case 14:
-       case 15:
-       case 16:
-               /* Brain smash */
-               if (!p_ptr->resist_conf)
-               {
-                       (void)set_confused(p_ptr->confused + randint0(4) + 4);
-               }
-               if (!p_ptr->free_act)
-               {
-                       (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
-               }
-               if (!p_ptr->resist_chaos)
-               {
-                       (void)set_image(p_ptr->image + randint0(250) + 150);
-               }
-               break;
-       case 17:
-       case 18:
-       case 19:
-       case 20:
-       case 21:
-               /* Amnesia */
-               if (lose_all_info())
-                       msg_print(_("あまりの恐怖に全てのことを忘れてしまった!", "You forget everything in your utmost terror!"));
-               break;
-       }
-
-       p_ptr->update |= PU_BONUS;
-       handle_stuff();
-}
-
-/*!
  * @brief モンスターの各情報を更新する / This function updates the monster record of the given monster
  * @param m_idx 更新するモンスター情報のID
  * @param full プレイヤーとの距離更新を行うならばtrue
@@ -2291,19 +1802,18 @@ void sanity_blast(monster_type *m_ptr, bool necro)
  * "disturb_near" (monster which is "easily" viewable moves in some
  * way).  Note that "moves" includes "appears" and "disappears".
  */
-void update_mon(MONSTER_IDX m_idx, bool full)
+void update_monster(MONSTER_IDX m_idx, bool full)
 {
-       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 do_disturb = disturb_move;
 
-       int d;
+       POSITION d;
 
        /* Current location */
-       int fy = m_ptr->fy;
-       int fx = m_ptr->fx;
+       POSITION fy = m_ptr->fy;
+       POSITION fx = m_ptr->fx;
 
        /* Seen at all */
        bool flag = FALSE;
@@ -2312,7 +1822,7 @@ void update_mon(MONSTER_IDX m_idx, bool full)
        bool easy = FALSE;
 
        /* Non-Ninja player in the darkness */
-       bool in_darkness = (d_info[dungeon_type].flags1 & DF1_DARKNESS) && !p_ptr->see_nocto;
+       bool in_darkness = (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) && !p_ptr->see_nocto;
 
        /* Do disturb? */
        if (disturb_high)
@@ -2419,77 +1929,66 @@ void update_mon(MONSTER_IDX m_idx, bool full)
                                }
                        }
 
-                       /* Magical sensing */
                        if ((p_ptr->esp_animal) && (r_ptr->flags3 & (RF3_ANIMAL)))
                        {
                                flag = TRUE;
                                if (is_original_ap(m_ptr) && !p_ptr->image) r_ptr->r_flags3 |= (RF3_ANIMAL);
                        }
 
-                       /* Magical sensing */
                        if ((p_ptr->esp_undead) && (r_ptr->flags3 & (RF3_UNDEAD)))
                        {
                                flag = TRUE;
                                if (is_original_ap(m_ptr) && !p_ptr->image) r_ptr->r_flags3 |= (RF3_UNDEAD);
                        }
 
-                       /* Magical sensing */
                        if ((p_ptr->esp_demon) && (r_ptr->flags3 & (RF3_DEMON)))
                        {
                                flag = TRUE;
                                if (is_original_ap(m_ptr) && !p_ptr->image) r_ptr->r_flags3 |= (RF3_DEMON);
                        }
 
-                       /* Magical sensing */
                        if ((p_ptr->esp_orc) && (r_ptr->flags3 & (RF3_ORC)))
                        {
                                flag = TRUE;
                                if (is_original_ap(m_ptr) && !p_ptr->image) r_ptr->r_flags3 |= (RF3_ORC);
                        }
 
-                       /* Magical sensing */
                        if ((p_ptr->esp_troll) && (r_ptr->flags3 & (RF3_TROLL)))
                        {
                                flag = TRUE;
                                if (is_original_ap(m_ptr) && !p_ptr->image) r_ptr->r_flags3 |= (RF3_TROLL);
                        }
 
-                       /* Magical sensing */
                        if ((p_ptr->esp_giant) && (r_ptr->flags3 & (RF3_GIANT)))
                        {
                                flag = TRUE;
                                if (is_original_ap(m_ptr) && !p_ptr->image) r_ptr->r_flags3 |= (RF3_GIANT);
                        }
 
-                       /* Magical sensing */
                        if ((p_ptr->esp_dragon) && (r_ptr->flags3 & (RF3_DRAGON)))
                        {
                                flag = TRUE;
                                if (is_original_ap(m_ptr) && !p_ptr->image) r_ptr->r_flags3 |= (RF3_DRAGON);
                        }
 
-                       /* Magical sensing */
                        if ((p_ptr->esp_human) && (r_ptr->flags2 & (RF2_HUMAN)))
                        {
                                flag = TRUE;
                                if (is_original_ap(m_ptr) && !p_ptr->image) r_ptr->r_flags2 |= (RF2_HUMAN);
                        }
 
-                       /* Magical sensing */
                        if ((p_ptr->esp_evil) && (r_ptr->flags3 & (RF3_EVIL)))
                        {
                                flag = TRUE;
                                if (is_original_ap(m_ptr) && !p_ptr->image) r_ptr->r_flags3 |= (RF3_EVIL);
                        }
 
-                       /* Magical sensing */
                        if ((p_ptr->esp_good) && (r_ptr->flags3 & (RF3_GOOD)))
                        {
                                flag = TRUE;
                                if (is_original_ap(m_ptr) && !p_ptr->image) r_ptr->r_flags3 |= (RF3_GOOD);
                        }
 
-                       /* Magical sensing */
                        if ((p_ptr->esp_nonliving) &&
                            ((r_ptr->flags3 & (RF3_DEMON | RF3_UNDEAD | RF3_NONLIVING)) == RF3_NONLIVING))
                        {
@@ -2497,7 +1996,6 @@ void update_mon(MONSTER_IDX m_idx, bool full)
                                if (is_original_ap(m_ptr) && !p_ptr->image) r_ptr->r_flags3 |= (RF3_NONLIVING);
                        }
 
-                       /* Magical sensing */
                        if ((p_ptr->esp_unique) && (r_ptr->flags1 & (RF1_UNIQUE)))
                        {
                                flag = TRUE;
@@ -2524,7 +2022,6 @@ void update_mon(MONSTER_IDX m_idx, bool full)
                                /* Handle "cold blooded" monsters */
                                if ((r_ptr->flags2 & (RF2_COLD_BLOOD | RF2_AURA_FIRE)) == RF2_COLD_BLOOD)
                                {
-                                       /* Take note */
                                        do_cold_blood = TRUE;
                                }
 
@@ -2542,7 +2039,6 @@ void update_mon(MONSTER_IDX m_idx, bool full)
                                /* Handle "invisible" monsters */
                                if (r_ptr->flags2 & (RF2_INVISIBLE))
                                {
-                                       /* Take note */
                                        do_invisible = TRUE;
 
                                        /* See invisible */
@@ -2610,7 +2106,7 @@ void update_mon(MONSTER_IDX m_idx, bool full)
                        if (disturb_near && (projectable(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x) && projectable(p_ptr->y, p_ptr->x, m_ptr->fy, m_ptr->fx)))
                        {
                                if (disturb_pets || is_hostile(m_ptr))
-                                       disturb(1, 1);
+                                       disturb(TRUE, TRUE);
                        }
                }
        }
@@ -2635,7 +2131,7 @@ void update_mon(MONSTER_IDX m_idx, bool full)
                        if (do_disturb)
                        {
                                if (disturb_pets || is_hostile(m_ptr))
-                                       disturb(1, 1);
+                                       disturb(TRUE, TRUE);
                        }
                }
        }
@@ -2654,7 +2150,7 @@ void update_mon(MONSTER_IDX m_idx, bool full)
                        if (do_disturb)
                        {
                                if (disturb_pets || is_hostile(m_ptr))
-                                       disturb(1, 1);
+                                       disturb(TRUE, TRUE);
                        }
                }
        }
@@ -2672,7 +2168,7 @@ void update_mon(MONSTER_IDX m_idx, bool full)
                        if (do_disturb)
                        {
                                if (disturb_pets || is_hostile(m_ptr))
-                                       disturb(1, 1);
+                                       disturb(TRUE, TRUE);
                        }
                }
        }
@@ -2686,18 +2182,14 @@ void update_mon(MONSTER_IDX m_idx, bool full)
  */
 void update_monsters(bool full)
 {
-       IDX i;
+       MONSTER_IDX i;
 
        /* Update each (live) monster */
        for (i = 1; i < m_max; i++)
        {
-               monster_type *m_ptr = &m_list[i];
-
-               /* Skip dead monsters */
-               if (!m_ptr->r_idx) continue;
-
-               /* Update the monster */
-               update_mon(i, full);
+               monster_type *m_ptr = &current_floor_ptr->m_list[i];
+               if (!monster_is_valid(m_ptr)) continue;
+               update_monster(i, full);
        }
 }
 
@@ -2710,7 +2202,7 @@ void update_monsters(bool full)
 static bool monster_hook_chameleon_lord(MONRACE_IDX r_idx)
 {
        monster_race *r_ptr = &r_info[r_idx];
-       monster_type *m_ptr = &m_list[chameleon_change_m_idx];
+       monster_type *m_ptr = &current_floor_ptr->m_list[chameleon_change_m_idx];
        monster_race *old_r_ptr = &r_info[m_ptr->r_idx];
 
        if (!(r_ptr->flags1 & (RF1_UNIQUE))) return FALSE;
@@ -2721,7 +2213,7 @@ static bool monster_hook_chameleon_lord(MONRACE_IDX r_idx)
        if ((r_ptr->blow[0].method == RBM_EXPLODE) || (r_ptr->blow[1].method == RBM_EXPLODE) || (r_ptr->blow[2].method == RBM_EXPLODE) || (r_ptr->blow[3].method == RBM_EXPLODE))
                return FALSE;
 
-       if (!monster_can_cross_terrain(cave[m_ptr->fy][m_ptr->fx].feat, r_ptr, 0)) return FALSE;
+       if (!monster_can_cross_terrain(current_floor_ptr->grid_array[m_ptr->fy][m_ptr->fx].feat, r_ptr, 0)) return FALSE;
 
        /* Not born */
        if (!(old_r_ptr->flags7 & RF7_CHAMELEON))
@@ -2732,7 +2224,7 @@ static bool monster_hook_chameleon_lord(MONRACE_IDX r_idx)
        /* Born now */
        else if (summon_specific_who > 0)
        {
-               if (monster_has_hostile_align(&m_list[summon_specific_who], 0, 0, r_ptr)) return FALSE;
+               if (monster_has_hostile_align(&current_floor_ptr->m_list[summon_specific_who], 0, 0, r_ptr)) return FALSE;
        }
 
        return TRUE;
@@ -2742,11 +2234,12 @@ static bool monster_hook_chameleon_lord(MONRACE_IDX r_idx)
  * @brief カメレオンの変身対象となるモンスターかどうか判定する / Hack -- the index of the summoning monster
  * @param r_idx モンスター種族ID
  * @return 対象にできるならtrueを返す
+ * @todo グローバル変数対策の上 monster_hook.cへ移す。
  */
 static bool monster_hook_chameleon(MONRACE_IDX r_idx)
 {
        monster_race *r_ptr = &r_info[r_idx];
-       monster_type *m_ptr = &m_list[chameleon_change_m_idx];
+       monster_type *m_ptr = &current_floor_ptr->m_list[chameleon_change_m_idx];
        monster_race *old_r_ptr = &r_info[m_ptr->r_idx];
 
        if (r_ptr->flags1 & (RF1_UNIQUE)) return FALSE;
@@ -2756,7 +2249,7 @@ static bool monster_hook_chameleon(MONRACE_IDX r_idx)
        if ((r_ptr->blow[0].method == RBM_EXPLODE) || (r_ptr->blow[1].method == RBM_EXPLODE) || (r_ptr->blow[2].method == RBM_EXPLODE) || (r_ptr->blow[3].method == RBM_EXPLODE))
                return FALSE;
 
-       if (!monster_can_cross_terrain(cave[m_ptr->fy][m_ptr->fx].feat, r_ptr, 0)) return FALSE;
+       if (!monster_can_cross_terrain(current_floor_ptr->grid_array[m_ptr->fy][m_ptr->fx].feat, r_ptr, 0)) return FALSE;
 
        /* Not born */
        if (!(old_r_ptr->flags7 & RF7_CHAMELEON))
@@ -2769,7 +2262,7 @@ static bool monster_hook_chameleon(MONRACE_IDX r_idx)
        /* Born now */
        else if (summon_specific_who > 0)
        {
-               if (monster_has_hostile_align(&m_list[summon_specific_who], 0, 0, r_ptr)) return FALSE;
+               if (monster_has_hostile_align(&current_floor_ptr->m_list[summon_specific_who], 0, 0, r_ptr)) return FALSE;
        }
 
        return (*(get_monster_hook()))(r_idx);
@@ -2785,9 +2278,9 @@ static bool monster_hook_chameleon(MONRACE_IDX r_idx)
 void choose_new_monster(MONSTER_IDX m_idx, bool born, MONRACE_IDX r_idx)
 {
        int oldmaxhp;
-       monster_type *m_ptr = &m_list[m_idx];
+       monster_type *m_ptr = &current_floor_ptr->m_list[m_idx];
        monster_race *r_ptr;
-       char old_m_name[80];
+       char old_m_name[MAX_NLEN];
        bool old_unique = FALSE;
        int old_r_idx = m_ptr->r_idx;
 
@@ -2810,35 +2303,29 @@ void choose_new_monster(MONSTER_IDX m_idx, bool born, MONRACE_IDX r_idx)
 
                if (old_unique)
                        level = r_info[MON_CHAMELEON_K].level;
-               else if (!dun_level)
+               else if (!current_floor_ptr->dun_level)
                        level = wilderness[p_ptr->wilderness_y][p_ptr->wilderness_x].level;
                else
-                       level = dun_level;
+                       level = current_floor_ptr->dun_level;
 
-               if (d_info[dungeon_type].flags1 & DF1_CHAMELEON) level+= 2+randint1(3);
+               if (d_info[p_ptr->dungeon_idx].flags1 & DF1_CHAMELEON) level+= 2+randint1(3);
 
                r_idx = get_mon_num(level);
                r_ptr = &r_info[r_idx];
 
                chameleon_change_m_idx = 0;
-
-               /* Paranoia */
                if (!r_idx) return;
        }
 
-       if (is_pet(m_ptr)) check_pets_num_and_align(m_ptr, FALSE);
-
        m_ptr->r_idx = r_idx;
        m_ptr->ap_r_idx = r_idx;
-       update_mon(m_idx, FALSE);
+       update_monster(m_idx, FALSE);
        lite_spot(m_ptr->fy, m_ptr->fx);
 
        if ((r_info[old_r_idx].flags7 & (RF7_LITE_MASK | RF7_DARK_MASK)) ||
            (r_ptr->flags7 & (RF7_LITE_MASK | RF7_DARK_MASK)))
                p_ptr->update |= (PU_MON_LITE);
 
-       if (is_pet(m_ptr)) check_pets_num_and_align(m_ptr, TRUE);
-
        if (born)
        {
                /* Sub-alignment of a chameleon */
@@ -2853,7 +2340,7 @@ void choose_new_monster(MONSTER_IDX m_idx, bool born, MONRACE_IDX r_idx)
 
        if (m_idx == p_ptr->riding)
        {
-               char m_name[80];
+               GAME_TEXT m_name[MAX_NLEN];
                monster_desc(m_name, m_ptr, 0);
                msg_format(_("突然%sが変身した。", "Suddenly, %s transforms!"), old_m_name);
                if (!(r_ptr->flags7 & RF7_RIDING))
@@ -2894,6 +2381,7 @@ void choose_new_monster(MONSTER_IDX m_idx, bool born, MONRACE_IDX r_idx)
  * @brief たぬきの変身対象となるモンスターかどうか判定する / Hook for Tanuki
  * @param r_idx モンスター種族ID
  * @return 対象にできるならtrueを返す
+ * @todo グローバル変数対策の上 monster_hook.cへ移す。
  */
 static bool monster_hook_tanuki(MONRACE_IDX r_idx)
 {
@@ -2916,12 +2404,16 @@ static bool monster_hook_tanuki(MONRACE_IDX r_idx)
  * @param r_idx モンスター種族ID
  * @return モンスター種族の表層ID
  */
-static IDX initial_r_appearance(MONRACE_IDX r_idx)
+static MONRACE_IDX initial_r_appearance(MONRACE_IDX r_idx)
 {
        int attempts = 1000;
+       MONRACE_IDX ap_r_idx;
+       DEPTH min = MIN(current_floor_ptr->base_level-5, 50);
 
-       IDX ap_r_idx;
-       DEPTH min = MIN(base_level-5, 50);
+       if (p_ptr->pseikaku == SEIKAKU_CHARGEMAN)
+       {
+               if (current_floor_ptr->base_level == 0 || one_in_(5)) return MON_ALIEN_JURAL;
+       }
 
        if (!(r_info[r_idx].flags7 & RF7_TANUKI))
                return r_idx;
@@ -2930,7 +2422,7 @@ static IDX initial_r_appearance(MONRACE_IDX r_idx)
 
        while (--attempts)
        {
-               ap_r_idx = get_mon_num(base_level + 10);
+               ap_r_idx = get_mon_num(current_floor_ptr->base_level + 10);
                if (r_info[ap_r_idx].level >= min) return ap_r_idx;
        }
 
@@ -2943,10 +2435,10 @@ static IDX initial_r_appearance(MONRACE_IDX r_idx)
  * @param r_ptr モンスター種族の参照ポインタ
  * @return 加速値
  */
-byte get_mspeed(monster_race *r_ptr)
+SPEED get_mspeed(monster_race *r_ptr)
 {
        /* Extract the monster base speed */
-       int mspeed = r_ptr->speed;
+       SPEED mspeed = r_ptr->speed;
 
        /* Hack -- small racial variety */
        if (!(r_ptr->flags1 & RF1_UNIQUE) && !p_ptr->inside_arena)
@@ -2958,7 +2450,7 @@ byte get_mspeed(monster_race *r_ptr)
 
        if (mspeed > 199) mspeed = 199;
 
-       return (byte)mspeed;
+       return mspeed;
 }
 
 
@@ -2978,10 +2470,10 @@ byte get_mspeed(monster_race *r_ptr)
  *
  * This routine refuses to place out-of-depth "FORCE_DEPTH" monsters.
  *
- * XXX XXX XXX Use special "here" and "dead" flags for unique monsters,
+ * Use special "here" and "dead" flags for unique monsters,
  * remove old "cur_num" and "max_num" fields.
  *
- * XXX XXX XXX Actually, do something similar for artifacts, to simplify
+ * Actually, do something similar for artifacts, to simplify
  * the "preserve" mode, and to make the "what artifacts" flag more useful.
  *
  * This is the only function which may place a monster in the dungeon,
@@ -2989,11 +2481,10 @@ byte get_mspeed(monster_race *r_ptr)
  */
 static bool place_monster_one(MONSTER_IDX who, POSITION y, POSITION x, MONRACE_IDX r_idx, BIT_FLAGS mode)
 {
-       /* Access the location */
-       cave_type               *c_ptr = &cave[y][x];
+       grid_type               *g_ptr = &current_floor_ptr->grid_array[y][x];
        monster_type    *m_ptr;
        monster_race    *r_ptr = &r_info[r_idx];
-       cptr            name = (r_name + r_ptr->name);
+       concptr         name = (r_name + r_ptr->name);
 
        int cmi;
 
@@ -3002,11 +2493,7 @@ static bool place_monster_one(MONSTER_IDX who, POSITION y, POSITION x, MONRACE_I
 
        /* Verify location */
        if (!in_bounds(y, x)) return (FALSE);
-
-       /* Paranoia */
        if (!r_idx) return (FALSE);
-
-       /* Paranoia */
        if (!r_ptr->name) return (FALSE);
 
        if (!(mode & PM_IGNORE_TERRAIN))
@@ -3042,7 +2529,7 @@ static bool place_monster_one(MONSTER_IDX who, POSITION y, POSITION x, MONRACE_I
                }
 
                /* Depth monsters may NOT be created out of depth, unless in Nightmare mode */
-               if ((r_ptr->flags1 & (RF1_FORCE_DEPTH)) && (dun_level < r_ptr->level) &&
+               if ((r_ptr->flags1 & (RF1_FORCE_DEPTH)) && (current_floor_ptr->dun_level < r_ptr->level) &&
                    (!ironman_nightmare || (r_ptr->flags1 & (RF1_QUESTOR))))
                {
                        /* Cannot create */
@@ -3050,9 +2537,9 @@ static bool place_monster_one(MONSTER_IDX who, POSITION y, POSITION x, MONRACE_I
                }
        }
 
-       if (quest_number(dun_level))
+       if (quest_number(current_floor_ptr->dun_level))
        {
-               int hoge = quest_number(dun_level);
+               int hoge = quest_number(current_floor_ptr->dun_level);
                if ((quest[hoge].type == QUEST_TYPE_KILL_LEVEL) || (quest[hoge].type == QUEST_TYPE_RANDOM))
                {
                        if(r_idx == quest[hoge].r_idx)
@@ -3061,10 +2548,10 @@ static bool place_monster_one(MONSTER_IDX who, POSITION y, POSITION x, MONRACE_I
                                number_mon = 0;
 
                                /* Count all quest monsters */
-                               for (i2 = 0; i2 < cur_wid; ++i2)
-                                       for (j2 = 0; j2 < cur_hgt; j2++)
-                                               if (cave[j2][i2].m_idx > 0)
-                                                       if (m_list[cave[j2][i2].m_idx].r_idx == quest[hoge].r_idx)
+                               for (i2 = 0; i2 < current_floor_ptr->width; ++i2)
+                                       for (j2 = 0; j2 < current_floor_ptr->height; j2++)
+                                               if (current_floor_ptr->grid_array[j2][i2].m_idx > 0)
+                                                       if (current_floor_ptr->m_list[current_floor_ptr->grid_array[j2][i2].m_idx].r_idx == quest[hoge].r_idx)
                                                                number_mon++;
                                if(number_mon + quest[hoge].cur_num >= quest[hoge].max_num)
                                        return FALSE;
@@ -3072,24 +2559,23 @@ static bool place_monster_one(MONSTER_IDX who, POSITION y, POSITION x, MONRACE_I
                }
        }
 
-       if (is_glyph_grid(c_ptr))
+       if (is_glyph_grid(g_ptr))
        {
                if (randint1(BREAK_GLYPH) < (r_ptr->level+20))
                {
                        /* Describe observable breakage */
-                       if (c_ptr->info & CAVE_MARK)
+                       if (g_ptr->info & CAVE_MARK)
                        {
                                msg_print(_("守りのルーンが壊れた!", "The rune of protection is broken!"));
                        }
 
                        /* Forget the rune */
-                       c_ptr->info &= ~(CAVE_MARK);
+                       g_ptr->info &= ~(CAVE_MARK);
 
                        /* Break the rune */
-                       c_ptr->info &= ~(CAVE_OBJECT);
-                       c_ptr->mimic = 0;
+                       g_ptr->info &= ~(CAVE_OBJECT);
+                       g_ptr->mimic = 0;
 
-                       /* Notice */
                        note_spot(y, x);
                }
                else return FALSE;
@@ -3100,15 +2586,15 @@ static bool place_monster_one(MONSTER_IDX who, POSITION y, POSITION x, MONRACE_I
        if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL) || (r_ptr->level < 10)) mode &= ~PM_KAGE;
 
        /* Make a new monster */
-       c_ptr->m_idx = m_pop();
-       hack_m_idx_ii = c_ptr->m_idx;
+       g_ptr->m_idx = m_pop();
+       hack_m_idx_ii = g_ptr->m_idx;
 
        /* Mega-Hack -- catch "failure" */
-       if (!c_ptr->m_idx) return (FALSE);
+       if (!g_ptr->m_idx) return (FALSE);
 
 
        /* Get a new monster record */
-       m_ptr = &m_list[c_ptr->m_idx];
+       m_ptr = &current_floor_ptr->m_list[g_ptr->m_idx];
 
        /* Save the race */
        m_ptr->r_idx = r_idx;
@@ -3119,17 +2605,17 @@ static bool place_monster_one(MONSTER_IDX who, POSITION y, POSITION x, MONRACE_I
        m_ptr->mflag2 = 0;
 
        /* Hack -- Appearance transfer */
-       if ((mode & PM_MULTIPLY) && (who > 0) && !is_original_ap(&m_list[who]))
+       if ((mode & PM_MULTIPLY) && (who > 0) && !is_original_ap(&current_floor_ptr->m_list[who]))
        {
-               m_ptr->ap_r_idx = m_list[who].ap_r_idx;
+               m_ptr->ap_r_idx = current_floor_ptr->m_list[who].ap_r_idx;
 
                /* Hack -- Shadower spawns Shadower */
-               if (m_list[who].mflag2 & MFLAG2_KAGE) m_ptr->mflag2 |= MFLAG2_KAGE;
+               if (current_floor_ptr->m_list[who].mflag2 & MFLAG2_KAGE) m_ptr->mflag2 |= MFLAG2_KAGE;
        }
 
        /* Sub-alignment of a monster */
        if ((who > 0) && !(r_ptr->flags3 & (RF3_EVIL | RF3_GOOD)))
-               m_ptr->sub_align = m_list[who].sub_align;
+               m_ptr->sub_align = current_floor_ptr->m_list[who].sub_align;
        else
        {
                m_ptr->sub_align = SUB_ALIGN_NEUTRAL;
@@ -3156,7 +2642,7 @@ static bool place_monster_one(MONSTER_IDX who, POSITION y, POSITION x, MONRACE_I
 
 
        /* Your pet summons its pet. */
-       if (who > 0 && is_pet(&m_list[who]))
+       if (who > 0 && is_pet(&current_floor_ptr->m_list[who]))
        {
                mode |= PM_FORCE_PET;
                m_ptr->parent_m_idx = who;
@@ -3168,7 +2654,7 @@ static bool place_monster_one(MONSTER_IDX who, POSITION y, POSITION x, MONRACE_I
 
        if (r_ptr->flags7 & RF7_CHAMELEON)
        {
-               choose_new_monster(c_ptr->m_idx, TRUE, 0);
+               choose_new_monster(g_ptr->m_idx, TRUE, 0);
                r_ptr = &r_info[m_ptr->r_idx];
                m_ptr->mflag2 |= MFLAG2_CHAMELEON;
 
@@ -3206,7 +2692,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(c_ptr->m_idx, (val * 2) + randint1(val * 10));
+               (void)set_monster_csleep(g_ptr->m_idx, (val * 2) + randint1(val * 10));
        }
 
        /* Assign maximal hitpoints */
@@ -3242,7 +2728,7 @@ 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(c_ptr->m_idx, 100);
+       if (mode & PM_HASTE) (void)set_monster_fast(g_ptr->m_idx, 100);
 
        /* Give a random starting energy */
        if (!ironman_nightmare)
@@ -3266,7 +2752,7 @@ static bool place_monster_one(MONSTER_IDX who, POSITION y, POSITION x, MONRACE_I
        }
 
        /* Hack -- see "process_monsters()" */
-       if (c_ptr->m_idx < hack_m_idx)
+       if (g_ptr->m_idx < hack_m_idx)
        {
                /* Monster is still being born */
                m_ptr->mflag |= (MFLAG_BORN);
@@ -3277,9 +2763,7 @@ static bool place_monster_one(MONSTER_IDX who, POSITION y, POSITION x, MONRACE_I
                p_ptr->update |= (PU_MON_LITE);
        else if ((r_ptr->flags7 & RF7_HAS_LD_MASK) && !MON_CSLEEP(m_ptr))
                p_ptr->update |= (PU_MON_LITE);
-
-       /* Update the monster */
-       update_mon(c_ptr->m_idx, TRUE);
+       update_monster(g_ptr->m_idx, TRUE);
 
 
        /* Count the monsters on the level */
@@ -3294,7 +2778,7 @@ static bool place_monster_one(MONSTER_IDX who, POSITION y, POSITION x, MONRACE_I
                real_r_ptr(m_ptr)->floor_id = p_ptr->floor_id;
 
        /* Hack -- Count the number of "reproducers" */
-       if (r_ptr->flags2 & RF2_MULTIPLY) num_repro++;
+       if (r_ptr->flags2 & RF2_MULTIPLY) current_floor_ptr->num_repro++;
 
        /* Hack -- Notice new multi-hued monsters */
        {
@@ -3307,9 +2791,9 @@ static bool place_monster_one(MONSTER_IDX who, POSITION y, POSITION x, MONRACE_I
        {
                if (r_ptr->flags1 & RF1_UNIQUE)
                {
-                       cptr color;
+                       concptr color;
                        object_type *o_ptr;
-                       char o_name[MAX_NLEN];
+                       GAME_TEXT o_name[MAX_NLEN];
 
                        if (r_ptr->level > p_ptr->lev + 30)
                                color = _("黒く", "black");
@@ -3337,13 +2821,13 @@ static bool place_monster_one(MONSTER_IDX who, POSITION y, POSITION x, MONRACE_I
                }
        }
 
-       if (is_explosive_rune_grid(c_ptr))
+       if (is_explosive_rune_grid(g_ptr))
        {
                /* Break the ward */
                if (randint1(BREAK_MINOR_GLYPH) > r_ptr->level)
                {
                        /* Describe observable breakage */
-                       if (c_ptr->info & CAVE_MARK)
+                       if (g_ptr->info & CAVE_MARK)
                        {
                                msg_print(_("ルーンが爆発した!", "The rune explodes!"));
                                project(0, 2, y, x, 2 * (p_ptr->lev + damroll(7, 7)), GF_MANA, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
@@ -3355,11 +2839,11 @@ static bool place_monster_one(MONSTER_IDX who, POSITION y, POSITION x, MONRACE_I
                }
 
                /* Forget the rune */
-               c_ptr->info &= ~(CAVE_MARK);
+               g_ptr->info &= ~(CAVE_MARK);
 
                /* Break the rune */
-               c_ptr->info &= ~(CAVE_OBJECT);
-               c_ptr->mimic = 0;
+               g_ptr->info &= ~(CAVE_OBJECT);
+               g_ptr->mimic = 0;
 
                note_spot(y, x);
                lite_spot(y, x);
@@ -3374,7 +2858,7 @@ static bool place_monster_one(MONSTER_IDX who, POSITION y, POSITION x, MONRACE_I
 #define MON_SCAT_MAXD 10 /*!< mon_scatter()関数によるモンスター配置で許される中心からの最大距離 */
 
 /*!
- * @brief モンスター1体を目標地点に可能なり近い位置に生成する / improved version of scatter() for place monster
+ * @brief モンスター1体を目標地点に可能なり近い位置に生成する / improved version of scatter() for place monster
  * @param r_idx 生成モンスター種族
  * @param yp 結果生成位置y座標
  * @param xp 結果生成位置x座標
@@ -3386,11 +2870,11 @@ static bool place_monster_one(MONSTER_IDX who, POSITION y, POSITION x, MONRACE_I
  */
 static bool mon_scatter(MONRACE_IDX r_idx, POSITION *yp, POSITION *xp, POSITION y, POSITION x, POSITION max_dist)
 {
-       int place_x[MON_SCAT_MAXD];
-       int place_y[MON_SCAT_MAXD];
+       POSITION place_x[MON_SCAT_MAXD];
+       POSITION place_y[MON_SCAT_MAXD];
        int num[MON_SCAT_MAXD];
        int i;
-       int nx, ny;
+       POSITION nx, ny;
 
        if (max_dist >= MON_SCAT_MAXD)
                return FALSE;
@@ -3462,7 +2946,7 @@ static bool mon_scatter(MONRACE_IDX r_idx, POSITION *yp, POSITION *xp, POSITION
  * @param mode 生成オプション
  * @return 成功したらtrue
  */
-static bool place_monster_group(IDX who, POSITION y, POSITION x, MONRACE_IDX r_idx, BIT_FLAGS mode)
+static bool place_monster_group(MONSTER_IDX who, POSITION y, POSITION x, MONRACE_IDX r_idx, BIT_FLAGS mode)
 {
        monster_race *r_ptr = &r_info[r_idx];
 
@@ -3479,16 +2963,16 @@ static bool place_monster_group(IDX who, POSITION y, POSITION x, MONRACE_IDX r_i
        total = randint1(10);
 
        /* Hard monsters, small groups */
-       if (r_ptr->level > dun_level)
+       if (r_ptr->level > current_floor_ptr->dun_level)
        {
-               extra = r_ptr->level - dun_level;
+               extra = r_ptr->level - current_floor_ptr->dun_level;
                extra = 0 - randint1(extra);
        }
 
        /* Easy monsters, large groups */
-       else if (r_ptr->level < dun_level)
+       else if (r_ptr->level < current_floor_ptr->dun_level)
        {
-               extra = dun_level - r_ptr->level;
+               extra = current_floor_ptr->dun_level - r_ptr->level;
                extra = randint1(extra);
        }
 
@@ -3548,14 +3032,14 @@ static bool place_monster_group(IDX who, POSITION y, POSITION x, MONRACE_IDX r_i
  * @brief 護衛対象となるモンスター種族IDを渡すグローバル変数 / Hack -- help pick an escort type
  * @todo 関数ポインタの都合を配慮しながら、グローバル変数place_monster_idxを除去し、関数引数化する
  */
-static IDX place_monster_idx = 0;
+static MONSTER_IDX place_monster_idx = 0;
 
 /*!
  * @var place_monster_m_idx
  * @brief 護衛対象となるモンスターIDを渡すグローバル変数 / Hack -- help pick an escort type
  * @todo 関数ポインタの都合を配慮しながら、グローバル変数place_monster_m_idxを除去し、関数引数化する
  */
-static IDX place_monster_m_idx = 0;
+static MONSTER_IDX place_monster_m_idx = 0;
 
 /*!
  * @brief モンスター種族が召喚主の護衛となれるかどうかをチェックする / Hack -- help pick an escort type
@@ -3565,7 +3049,7 @@ static IDX place_monster_m_idx = 0;
 static bool place_monster_can_escort(MONRACE_IDX r_idx)
 {
        monster_race *r_ptr = &r_info[place_monster_idx];
-       monster_type *m_ptr = &m_list[place_monster_m_idx];
+       monster_type *m_ptr = &current_floor_ptr->m_list[place_monster_m_idx];
 
        monster_race *z_ptr = &r_info[r_idx];
 
@@ -3595,7 +3079,6 @@ static bool place_monster_can_escort(MONRACE_IDX r_idx)
        if ((r_ptr->flags7 & RF7_CHAMELEON) && !(z_ptr->flags7 & RF7_CHAMELEON))
                return FALSE;
 
-       /* Okay */
        return (TRUE);
 }
 
@@ -3677,8 +3160,6 @@ bool place_monster_aux(MONSTER_IDX who, POSITION y, POSITION x, MONRACE_IDX r_id
 
                        /* Require empty grids */
                        if (!cave_empty_bold2(ny, nx)) continue;
-
-                       /* Prepare allocation table */
                        get_mon_num_prep(place_monster_can_escort, get_monster_hook2(ny, nx));
 
                        /* Pick a random race */
@@ -3714,12 +3195,10 @@ bool place_monster_aux(MONSTER_IDX who, POSITION y, POSITION x, MONRACE_IDX r_id
 bool place_monster(POSITION y, POSITION x, BIT_FLAGS mode)
 {
        MONRACE_IDX r_idx;
-
-       /* Prepare allocation table */
        get_mon_num_prep(get_monster_hook(), get_monster_hook2(y, x));
 
        /* Pick a monster */
-       r_idx = get_mon_num(monster_level);
+       r_idx = get_mon_num(current_floor_ptr->monster_level);
 
        /* Handle failure */
        if (!r_idx) return (FALSE);
@@ -3730,9 +3209,6 @@ bool place_monster(POSITION y, POSITION x, BIT_FLAGS mode)
        return (FALSE);
 }
 
-
-#ifdef MONSTER_HORDES
-
 /*!
  * @brief 指定地点に1種類のモンスター種族による群れを生成する
  * @param y 生成地点y座標
@@ -3747,14 +3223,12 @@ bool alloc_horde(POSITION y, POSITION x)
        int attempts = 1000;
        POSITION cy = y;
        POSITION cx = x;
-
-       /* Prepare allocation table */
        get_mon_num_prep(get_monster_hook(), get_monster_hook2(y, x));
 
        while (--attempts)
        {
                /* Pick a monster */
-               r_idx = get_mon_num(monster_level);
+               r_idx = get_mon_num(current_floor_ptr->monster_level);
 
                /* Handle failure */
                if (!r_idx) return (FALSE);
@@ -3778,27 +3252,24 @@ bool alloc_horde(POSITION y, POSITION x)
 
        if (attempts < 1) return FALSE;
 
-       m_idx = cave[y][x].m_idx;
+       m_idx = current_floor_ptr->grid_array[y][x].m_idx;
 
-       if (m_list[m_idx].mflag2 & MFLAG2_CHAMELEON) r_ptr = &r_info[m_list[m_idx].r_idx];
-       summon_kin_type = r_ptr->d_char;
+       if (current_floor_ptr->m_list[m_idx].mflag2 & MFLAG2_CHAMELEON) r_ptr = &r_info[current_floor_ptr->m_list[m_idx].r_idx];
 
        for (attempts = randint1(10) + 5; attempts; attempts--)
        {
                scatter(&cy, &cx, y, x, 5, 0);
 
-               (void)summon_specific(m_idx, cy, cx, dun_level + 5, SUMMON_KIN, PM_ALLOW_GROUP);
+               (void)summon_specific(m_idx, cy, cx, current_floor_ptr->dun_level + 5, SUMMON_KIN, PM_ALLOW_GROUP, r_ptr->d_char);
 
                y = cy;
                x = cx;
        }
 
+       if (cheat_hear) msg_format(_("モンスターの大群(%c)", "Monster horde (%c)."), r_ptr->d_char);
        return TRUE;
 }
 
-#endif /* MONSTER_HORDES */
-
-
 /*!
  * @brief ダンジョンの主生成を試みる / Put the Guardian
  * @param def_val 現在の主の生成状態
@@ -3806,23 +3277,23 @@ bool alloc_horde(POSITION y, POSITION x)
  */
 bool alloc_guardian(bool def_val)
 {
-       MONRACE_IDX guardian = d_info[dungeon_type].final_guardian;
+       MONRACE_IDX guardian = d_info[p_ptr->dungeon_idx].final_guardian;
 
-       if (guardian && (d_info[dungeon_type].maxdepth == dun_level) && (r_info[guardian].cur_num < r_info[guardian].max_num))
+       if (guardian && (d_info[p_ptr->dungeon_idx].maxdepth == current_floor_ptr->dun_level) && (r_info[guardian].cur_num < r_info[guardian].max_num))
        {
-               int oy;
-               int ox;
+               POSITION oy;
+               POSITION ox;
                int try_count = 4000;
 
                /* Find a good position */
                while (try_count)
                {
                        /* Get a random spot */
-                       oy = randint1(cur_hgt - 4) + 2;
-                       ox = randint1(cur_wid - 4) + 2;
+                       oy = randint1(current_floor_ptr->height - 4) + 2;
+                       ox = randint1(current_floor_ptr->width - 4) + 2;
 
                        /* Is it a good spot ? */
-                       if (cave_empty_bold2(oy, ox) && monster_can_cross_terrain(cave[oy][ox].feat, &r_info[guardian], 0))
+                       if (cave_empty_bold2(oy, ox) && monster_can_cross_terrain(current_floor_ptr->grid_array[oy][ox].feat, &r_info[guardian], 0))
                        {
                                /* Place the guardian */
                                if (place_monster_aux(0, oy, ox, guardian, (PM_ALLOW_GROUP | PM_NO_KAGE | PM_NO_PET))) return TRUE;
@@ -3847,11 +3318,11 @@ bool alloc_guardian(bool def_val)
  * @details
  * Place the monster at least "dis" distance from the player.
  * Use "slp" to choose the initial "sleep" status
- * Use "monster_level" for the monster level
+ * Use "current_floor_ptr->monster_level" for the monster level
  */
 bool alloc_monster(POSITION dis, BIT_FLAGS mode)
 {
-       int y = 0, x = 0;
+       POSITION y = 0, x = 0;
        int attempts_left = 10000;
 
        /* Put the Guardian */
@@ -3861,11 +3332,11 @@ bool alloc_monster(POSITION dis, BIT_FLAGS mode)
        while (attempts_left--)
        {
                /* Pick a location */
-               y = randint0(cur_hgt);
-               x = randint0(cur_wid);
+               y = randint0(current_floor_ptr->height);
+               x = randint0(current_floor_ptr->width);
 
                /* Require empty floor grid (was "naked") */
-               if (dun_level)
+               if (current_floor_ptr->dun_level)
                {
                        if (!cave_empty_bold2(y, x)) continue;
                }
@@ -3889,27 +3360,19 @@ bool alloc_monster(POSITION dis, BIT_FLAGS mode)
        }
 
 
-#ifdef MONSTER_HORDES
-       if (randint1(5000) <= dun_level)
+       if (randint1(5000) <= current_floor_ptr->dun_level)
        {
                if (alloc_horde(y, x))
                {
-                       if (cheat_hear) msg_format(_("モンスターの大群(%c)", "Monster horde (%c)."), summon_kin_type);
                        return (TRUE);
                }
        }
        else
        {
-#endif /* MONSTER_HORDES */
-
                /* Attempt to place the monster, allow groups */
                if (place_monster(y, x, (mode | PM_ALLOW_GROUP))) return (TRUE);
-
-#ifdef MONSTER_HORDES
        }
-#endif /* MONSTER_HORDES */
 
-       /* Nope */
        return (FALSE);
 }
 
@@ -3929,7 +3392,7 @@ static bool summon_specific_okay(MONRACE_IDX r_idx)
        /* Hack -- identify the summoning monster */
        if (summon_specific_who > 0)
        {
-               monster_type *m_ptr = &m_list[summon_specific_who];
+               monster_type *m_ptr = &current_floor_ptr->m_list[summon_specific_who];
 
                /* Do not summon enemies */
 
@@ -3956,7 +3419,7 @@ static bool summon_specific_okay(MONRACE_IDX r_idx)
            monster_has_hostile_align(NULL, 10, -10, r_ptr))
                return FALSE;
 
-       if ((r_ptr->flags7 & RF7_CHAMELEON) && (d_info[dungeon_type].flags1 & DF1_CHAMELEON)) return TRUE;
+       if ((r_ptr->flags7 & RF7_CHAMELEON) && (d_info[p_ptr->dungeon_idx].flags1 & DF1_CHAMELEON)) return TRUE;
 
        return (summon_specific_aux(r_idx));
 }
@@ -3993,7 +3456,7 @@ static bool summon_specific_okay(MONRACE_IDX r_idx)
  *
  * Note that this function may not succeed, though this is very rare.
  */
-bool summon_specific(MONSTER_IDX who, POSITION y1, POSITION x1, DEPTH lev, int type, BIT_FLAGS mode)
+bool summon_specific(MONSTER_IDX who, POSITION y1, POSITION x1, DEPTH lev, int type, BIT_FLAGS mode, SYMBOL_CODE symbol)
 {
        POSITION x, y;
        MONRACE_IDX r_idx;
@@ -4008,13 +3471,13 @@ bool summon_specific(MONSTER_IDX who, POSITION y1, POSITION x1, DEPTH lev, int t
        /* Save the "summon" type */
        summon_specific_type = type;
 
-       summon_unique_okay = (mode & PM_ALLOW_UNIQUE) ? TRUE : FALSE;
+       summon_kin_type = symbol;
 
-       /* Prepare allocation table */
+       summon_unique_okay = (mode & PM_ALLOW_UNIQUE) ? TRUE : FALSE;
        get_mon_num_prep(summon_specific_okay, get_monster_hook2(y, x));
 
        /* Pick a monster, using the level calculation */
-       r_idx = get_mon_num((dun_level + lev) / 2 + 5);
+       r_idx = get_mon_num((current_floor_ptr->dun_level + lev) / 2 + 5);
 
        /* Handle failure */
        if (!r_idx)
@@ -4048,11 +3511,9 @@ bool summon_specific(MONSTER_IDX who, POSITION y1, POSITION x1, DEPTH lev, int t
  * @param mode 生成オプション 
  * @return 召喚できたらtrueを返す
  */
-bool summon_named_creature (MONSTER_IDX who, POSITION oy, POSITION ox, MONRACE_IDX r_idx, BIT_FLAGS mode)
+bool summon_named_creature(MONSTER_IDX who, POSITION oy, POSITION ox, MONRACE_IDX r_idx, BIT_FLAGS mode)
 {
        POSITION x, y;
-
-       /* Paranoia */
        /* if (!r_idx) return; */
 
        /* Prevent illegal monsters */
@@ -4078,8 +3539,7 @@ bool summon_named_creature (MONSTER_IDX who, POSITION oy, POSITION ox, MONRACE_I
  */
 bool multiply_monster(MONSTER_IDX m_idx, bool clone, BIT_FLAGS mode)
 {
-       monster_type    *m_ptr = &m_list[m_idx];
-
+       monster_type *m_ptr = &current_floor_ptr->m_list[m_idx];
        POSITION y, x;
 
        if (!mon_scatter(m_ptr->r_idx, &y, &x, m_ptr->fy, m_ptr->fx, 1))
@@ -4094,8 +3554,8 @@ bool multiply_monster(MONSTER_IDX m_idx, bool clone, BIT_FLAGS mode)
        /* Hack -- Transfer "clone" flag */
        if (clone || (m_ptr->smart & SM_CLONED))
        {
-               m_list[hack_m_idx_ii].smart |= SM_CLONED;
-               m_list[hack_m_idx_ii].mflag2 |= MFLAG2_NOPET;
+               current_floor_ptr->m_list[hack_m_idx_ii].smart |= SM_CLONED;
+               current_floor_ptr->m_list[hack_m_idx_ii].mflag2 |= MFLAG2_NOPET;
        }
 
        return TRUE;
@@ -4113,15 +3573,15 @@ bool multiply_monster(MONSTER_IDX m_idx, bool clone, BIT_FLAGS mode)
  */
 void message_pain(MONSTER_IDX m_idx, HIT_POINT dam)
 {
-       long oldhp, newhp, tmp;
-       int percentage;
+       HIT_POINT oldhp, newhp;
+       HIT_POINT tmp;
+       PERCENTAGE percentage;
 
-       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];
 
-       char m_name[80];
+       GAME_TEXT m_name[MAX_NLEN];
 
-       /* Get the monster name */
        monster_desc(m_name, m_ptr, 0);
 
        if(dam == 0) // Notice non-damage
@@ -4131,10 +3591,10 @@ void message_pain(MONSTER_IDX m_idx, HIT_POINT dam)
        }
 
        /* Note -- subtle fix -CFT */
-       newhp = (long)(m_ptr->hp);
-       oldhp = newhp + (long)(dam);
+       newhp = m_ptr->hp;
+       oldhp = newhp + dam;
        tmp = (newhp * 100L) / oldhp;
-       percentage = (int)(tmp);
+       percentage = tmp;
 
        if(my_strchr(",ejmvwQ", r_ptr->d_char)) // Mushrooms, Eyes, Jellies, Molds, Vortices, Worms, Quylthulgs
        {
@@ -4441,11 +3901,9 @@ void message_pain(MONSTER_IDX m_idx, HIT_POINT dam)
  */
 void update_smart_learn(MONSTER_IDX m_idx, int what)
 {
-       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];
 
-
        /* Not allowed to learn */
        if (!smart_learn) return;
 
@@ -4455,8 +3913,6 @@ void update_smart_learn(MONSTER_IDX m_idx, int what)
        /* Not intelligent, only learn sometimes */
        if (!(r_ptr->flags2 & (RF2_SMART)) && (randint0(100) < 50)) return;
 
-
-
        /* Analyze the knowledge */
        switch (what)
        {
@@ -4550,26 +4006,6 @@ void update_smart_learn(MONSTER_IDX m_idx, int what)
 
 
 /*!
- * @brief プレイヤーを指定座標に配置する / Place the player in the dungeon XXX XXX
- * @param x 配置先X座標
- * @param y 配置先Y座標
- * @return 配置に成功したらTRUE
- */
-bool player_place(POSITION y, POSITION x)
-{
-       /* Paranoia XXX XXX */
-       if (cave[y][x].m_idx != 0) return FALSE;
-
-       /* Save player location */
-       p_ptr->y = y;
-       p_ptr->x = x;
-
-       /* Success */
-       return TRUE;
-}
-
-
-/*!
  * @brief モンスターが盗みや拾いで確保していたアイテムを全てドロップさせる / Drop all items carried by a monster
  * @param m_ptr モンスター参照ポインタ
  * @return なし
@@ -4585,13 +4021,8 @@ void monster_drop_carried_objects(monster_type *m_ptr)
        /* Drop objects being carried */
        for (this_o_idx = m_ptr->hold_o_idx; this_o_idx; this_o_idx = next_o_idx)
        {
-               /* Acquire object */
-               o_ptr = &o_list[this_o_idx];
-
-               /* Acquire next object */
+               o_ptr = &current_floor_ptr->o_list[this_o_idx];
                next_o_idx = o_ptr->next_o_idx;
-
-               /* Get local object */
                q_ptr = &forge;
 
                /* Copy the object */
@@ -4600,7 +4031,6 @@ void monster_drop_carried_objects(monster_type *m_ptr)
                /* Forget monster */
                q_ptr->held_m_idx = 0;
 
-               /* Delete the object */
                delete_object_idx(this_o_idx);
 
                /* Drop it */