OSDN Git Service

[Refactor] #37353 グローバル変数 dungeon_type を他の慣例に従い dungeon_idx に改名。 / Rename dungeon_typ...
[hengband/hengband.git] / src / monster-process.c
index aff5af8..36fbf74 100644 (file)
 #include "angband.h"
 #include "cmd-pet.h"
 #include "monsterrace-hook.h"
+#include "melee.h"
+#include "projection.h"
+#include "spells-summon.h"
+#include "quest.h"
+#include "avatar.h"
+#include "realm-hex.h"
 
 
 /*!
@@ -35,7 +41,6 @@ static bool get_enemy_dir(MONSTER_IDX m_idx, int *mm)
 
        monster_type *m_ptr = &m_list[m_idx];
        monster_race *r_ptr = &r_info[m_ptr->r_idx];
-
        monster_type *t_ptr;
 
        if (riding_t_m_idx && player_bold(m_ptr->fy, m_ptr->fx))
@@ -187,16 +192,17 @@ static bool get_enemy_dir(MONSTER_IDX m_idx, int *mm)
  * Hack, based on mon_take_hit... perhaps all monster attacks on other monsters should use this?
  * @param m_idx 目標となるモンスターの参照ID
  * @param dam ダメージ量
- * @param fear 目標となるモンスターの恐慌状態を返す参照ポインタ
+ * @param dead 目標となったモンスターの死亡状態を返す参照ポインタ
+ * @param fear 目標となったモンスターの恐慌状態を返す参照ポインタ
  * @param note 目標モンスターが死亡した場合の特別メッセージ(NULLならば標準表示を行う)
  * @param who 打撃を行ったモンスターの参照ID
  * @return なし
  */
-void mon_take_hit_mon(MONSTER_IDX m_idx, HIT_POINT dam, bool *fear, cptr note, IDX who)
+void mon_take_hit_mon(MONSTER_IDX m_idx, HIT_POINT dam, bool *dead, bool *fear, concptr note, IDX who)
 {
        monster_type *m_ptr = &m_list[m_idx];
        monster_race *r_ptr = &r_info[m_ptr->r_idx];
-       char m_name[160];
+       GAME_TEXT m_name[160];
        bool seen = is_seen(m_ptr);
 
        /* Can the player be aware of this attack? */
@@ -266,6 +272,8 @@ void mon_take_hit_mon(MONSTER_IDX m_idx, HIT_POINT dam, bool *fear, cptr note, I
                                sound(SOUND_KILL);
                        }
 
+                       *dead = TRUE;
+
                        if (known)
                        {
                                monster_desc(m_name, m_ptr, MD_TRUE_NAME);
@@ -303,6 +311,8 @@ void mon_take_hit_mon(MONSTER_IDX m_idx, HIT_POINT dam, bool *fear, cptr note, I
                }
        }
 
+       *dead = FALSE;
+
 #ifdef ALLOW_FEAR
 
        /* Mega-Hack -- Pain cancels fear */
@@ -766,89 +776,89 @@ static bool get_fear_moves_aux(MONSTER_IDX m_idx, POSITION *yp, POSITION *xp)
  */
 
 
-static sint d_off_y_0[] = { 0 };
-static sint d_off_x_0[] = { 0 };
+static POSITION d_off_y_0[] = { 0 };
+static POSITION d_off_x_0[] = { 0 };
 
-static sint d_off_y_1[] = { -1, -1, -1, 0, 0, 1, 1, 1, 0 };
-static sint d_off_x_1[] = { -1, 0, 1, -1, 1, -1, 0, 1, 0 };
+static POSITION d_off_y_1[] = { -1, -1, -1, 0, 0, 1, 1, 1, 0 };
+static POSITION d_off_x_1[] = { -1, 0, 1, -1, 1, -1, 0, 1, 0 };
 
-static sint d_off_y_2[] = { -1, -1, -2, -2, -2, 0, 0, 1, 1, 2, 2, 2, 0 };
-static sint d_off_x_2[] = { -2, 2, -1, 0, 1, -2, 2, -2, 2, -1, 0, 1, 0 };
+static POSITION d_off_y_2[] = { -1, -1, -2, -2, -2, 0, 0, 1, 1, 2, 2, 2, 0 };
+static POSITION d_off_x_2[] = { -2, 2, -1, 0, 1, -2, 2, -2, 2, -1, 0, 1, 0 };
 
-static sint d_off_y_3[] = { -1, -1, -2, -2, -3, -3, -3, 0, 0, 1, 1, 2, 2, 3, 3, 3, 0 };
-static sint d_off_x_3[] = { -3, 3, -2, 2, -1, 0, 1, -3, 3, -3, 3, -2, 2, -1, 0, 1, 0 };
+static POSITION d_off_y_3[] = { -1, -1, -2, -2, -3, -3, -3, 0, 0, 1, 1, 2, 2, 3, 3, 3, 0 };
+static POSITION d_off_x_3[] = { -3, 3, -2, 2, -1, 0, 1, -3, 3, -3, 3, -2, 2, -1, 0, 1, 0 };
 
-static sint d_off_y_4[] = { -1, -1, -2, -2, -3, -3, -3, -3, -4, -4, -4, 0, 0, 1, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 0 };
-static sint d_off_x_4[] = { -4, 4, -3, 3, -2, -3, 2, 3, -1, 0, 1, -4, 4, -4, 4, -3, 3, -2, -3, 2, 3, -1, 0, 1, 0 };
+static POSITION d_off_y_4[] = { -1, -1, -2, -2, -3, -3, -3, -3, -4, -4, -4, 0, 0, 1, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 0 };
+static POSITION d_off_x_4[] = { -4, 4, -3, 3, -2, -3, 2, 3, -1, 0, 1, -4, 4, -4, 4, -3, 3, -2, -3, 2, 3, -1, 0, 1, 0 };
 
 
-static sint d_off_y_5[] =
+static POSITION d_off_y_5[] =
 { -1, -1, -2, -2, -3, -3, -4, -4, -4, -4, -5, -5,
   -5, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 4, 4, 5, 5,
   5, 0 };
 
-static sint d_off_x_5[] =
+static POSITION d_off_x_5[] =
 { -5, 5, -4, 4, -4, 4, -2, -3, 2, 3, -1, 0, 1,
   -5, 5, -5, 5, -4, 4, -4, 4, -2, -3, 2, 3, -1,
   0, 1, 0 };
 
 
-static sint d_off_y_6[] =
+static POSITION d_off_y_6[] =
 { -1, -1, -2, -2, -3, -3, -4, -4, -5, -5, -5, -5,
   -6, -6, -6, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5,
   5, 5, 6, 6, 6, 0 };
 
-static sint d_off_x_6[] =
+static POSITION d_off_x_6[] =
 { -6, 6, -5, 5, -5, 5, -4, 4, -2, -3, 2, 3, -1,
   0, 1, -6, 6, -6, 6, -5, 5, -5, 5, -4, 4, -2,
   -3, 2, 3, -1, 0, 1, 0 };
 
 
-static sint d_off_y_7[] =
+static POSITION d_off_y_7[] =
 { -1, -1, -2, -2, -3, -3, -4, -4, -5, -5, -5, -5,
   -6, -6, -6, -6, -7, -7, -7, 0, 0, 1, 1, 2, 2, 3,
   3, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 0 };
 
-static sint d_off_x_7[] =
+static POSITION d_off_x_7[] =
 { -7, 7, -6, 6, -6, 6, -5, 5, -4, -5, 4, 5, -2,
   -3, 2, 3, -1, 0, 1, -7, 7, -7, 7, -6, 6, -6,
   6, -5, 5, -4, -5, 4, 5, -2, -3, 2, 3, -1, 0,
   1, 0 };
 
 
-static sint d_off_y_8[] =
+static POSITION d_off_y_8[] =
 { -1, -1, -2, -2, -3, -3, -4, -4, -5, -5, -6, -6,
   -6, -6, -7, -7, -7, -7, -8, -8, -8, 0, 0, 1, 1,
   2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7,
   8, 8, 8, 0 };
 
-static sint d_off_x_8[] =
+static POSITION d_off_x_8[] =
 { -8, 8, -7, 7, -7, 7, -6, 6, -6, 6, -4, -5, 4,
   5, -2, -3, 2, 3, -1, 0, 1, -8, 8, -8, 8, -7,
   7, -7, 7, -6, 6, -6, 6, -4, -5, 4, 5, -2, -3,
   2, 3, -1, 0, 1, 0 };
 
 
-static sint d_off_y_9[] =
+static POSITION d_off_y_9[] =
 { -1, -1, -2, -2, -3, -3, -4, -4, -5, -5, -6, -6,
   -7, -7, -7, -7, -8, -8, -8, -8, -9, -9, -9, 0,
   0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 7,
   7, 8, 8, 8, 8, 9, 9, 9, 0 };
 
-static sint d_off_x_9[] =
+static POSITION d_off_x_9[] =
 { -9, 9, -8, 8, -8, 8, -7, 7, -7, 7, -6, 6, -4,
   -5, 4, 5, -2, -3, 2, 3, -1, 0, 1, -9, 9, -9,
   9, -8, 8, -8, 8, -7, 7, -7, 7, -6, 6, -4, -5,
   4, 5, -2, -3, 2, 3, -1, 0, 1, 0 };
 
 
-static sint *dist_offsets_y[10] =
+static POSITION *dist_offsets_y[10] =
 {
        d_off_y_0, d_off_y_1, d_off_y_2, d_off_y_3, d_off_y_4,
        d_off_y_5, d_off_y_6, d_off_y_7, d_off_y_8, d_off_y_9
 };
 
-static sint *dist_offsets_x[10] =
+static POSITION *dist_offsets_x[10] =
 {
        d_off_x_0, d_off_x_1, d_off_x_2, d_off_x_3, d_off_x_4,
        d_off_x_5, d_off_x_6, d_off_x_7, d_off_x_8, d_off_x_9
@@ -882,8 +892,8 @@ static bool find_safety(MONSTER_IDX m_idx, POSITION *yp, POSITION *xp)
        POSITION y, x, dy, dx, d, dis, i;
        POSITION gy = 0, gx = 0, gdis = 0;
 
-       sint *y_offsets;
-       sint *x_offsets;
+       POSITION *y_offsets;
+       POSITION *x_offsets;
 
        cave_type *c_ptr;
 
@@ -977,7 +987,7 @@ static bool find_hiding(MONSTER_IDX m_idx, POSITION *yp, POSITION *xp)
        POSITION y, x, dy, dx, d, dis, i;
        POSITION gy = 0, gx = 0, gdis = 999;
 
-       sint *y_offsets, *x_offsets;
+       POSITION *y_offsets, *x_offsets;
 
        /* Start with adjacent locations, spread further */
        for (d = 1; d < 10; d++)
@@ -1421,12 +1431,12 @@ static bool monst_attack_monst(MONSTER_IDX m_idx, MONSTER_IDX t_idx)
        ARMOUR_CLASS ac;
        DEPTH rlev;
        int pt;
-       char            m_name[80], t_name[80];
+       GAME_TEXT m_name[MAX_NLEN], t_name[MAX_NLEN];
        char            temp[MAX_NLEN];
        bool            blinked;
-       bool            explode = FALSE, touched = FALSE, fear = FALSE;
-       int             y_saver = t_ptr->fy;
-       int             x_saver = t_ptr->fx;
+       bool            explode = FALSE, touched = FALSE, fear = FALSE, dead = FALSE;
+       POSITION y_saver = t_ptr->fy;
+       POSITION x_saver = t_ptr->fx;
        int             effect_type;
 
        bool see_m = is_seen(m_ptr);
@@ -1443,7 +1453,7 @@ static bool monst_attack_monst(MONSTER_IDX m_idx, MONSTER_IDX t_idx)
        /* Not allowed to attack */
        if (r_ptr->flags1 & RF1_NEVER_BLOW) return FALSE;
 
-       if (d_info[dungeon_type].flags1 & DF1_NO_MELEE) return (FALSE);
+       if (d_info[dungeon_idx].flags1 & DF1_NO_MELEE) return (FALSE);
 
        /* Total armor */
        ac = tr_ptr->ac;
@@ -1451,10 +1461,7 @@ static bool monst_attack_monst(MONSTER_IDX m_idx, MONSTER_IDX t_idx)
        /* Extract the effective monster level */
        rlev = ((r_ptr->level >= 1) ? r_ptr->level : 1);
 
-       /* Get the monster name (or "it") */
        monster_desc(m_name, m_ptr, 0);
-
-       /* Get the monster name (or "it") */
        monster_desc(t_name, t_ptr, 0);
 
        /* Assume no blink */
@@ -1475,7 +1482,7 @@ static bool monst_attack_monst(MONSTER_IDX m_idx, MONSTER_IDX t_idx)
                HIT_POINT power = 0;
                HIT_POINT damage = 0;
 
-               cptr act = NULL;
+               concptr act = NULL;
 
                /* Extract the attack infomation */
                int effect = r_ptr->blow[ap_cnt].effect;
@@ -1992,7 +1999,7 @@ static bool monst_attack_monst(MONSTER_IDX m_idx, MONSTER_IDX t_idx)
 
                /* Cancel Invulnerability */
                (void)set_monster_invulner(m_idx, 0, FALSE);
-               mon_take_hit_mon(m_idx, m_ptr->hp + 1, &fear, _("は爆発して粉々になった。", " explodes into tiny shreds."), m_idx);
+               mon_take_hit_mon(m_idx, m_ptr->hp + 1, &dead, &fear, _("は爆発して粉々になった。", " explodes into tiny shreds."), m_idx);
                blinked = FALSE;
        }
 
@@ -2032,8 +2039,8 @@ static bool monst_attack_monst(MONSTER_IDX m_idx, MONSTER_IDX t_idx)
 static bool check_hp_for_feat_destruction(feature_type *f_ptr, monster_type *m_ptr)
 {
        return !have_flag(f_ptr->flags, FF_GLASS) ||
-              (r_info[m_ptr->r_idx].flags2 & RF2_STUPID) ||
-              (m_ptr->hp >= MAX(m_ptr->maxhp / 3, 200));
+               (r_info[m_ptr->r_idx].flags2 & RF2_STUPID) ||
+               (m_ptr->hp >= MAX(m_ptr->maxhp / 3, 200));
 }
 
 
@@ -2098,11 +2105,9 @@ void process_monster(MONSTER_IDX m_idx)
        bool            can_cross;
        bool            aware = TRUE;
 
-       bool            fear;
-
-       bool            is_riding_mon = (m_idx == p_ptr->riding);
-
-       bool            see_m = is_seen(m_ptr);
+       bool fear, dead;
+       bool is_riding_mon = (m_idx == p_ptr->riding);
+       bool see_m = is_seen(m_ptr);
 
        if (is_riding_mon && !(r_ptr->flags7 & RF7_RIDING))
        {
@@ -2111,7 +2116,7 @@ void process_monster(MONSTER_IDX m_idx)
 #ifdef JP
                        msg_print("地面に落とされた。");
 #else
-                       char m_name[80];
+                       GAME_TEXT m_name[MAX_NLEN];
                        monster_desc(m_name, &m_list[p_ptr->riding], 0);
                        msg_format("You have fallen from %s.", m_name);
 #endif
@@ -2130,7 +2135,7 @@ void process_monster(MONSTER_IDX m_idx)
                int tmp = p_ptr->lev*6+(p_ptr->skill_stl+10)*4;
                if (p_ptr->monlite) tmp /= 3;
                if (p_ptr->cursed & TRC_AGGRAVATE) tmp /= 2;
-               if (r_ptr->level > (p_ptr->lev*p_ptr->lev/20+10)) tmp /= 3;
+               if (r_ptr->level > (p_ptr->lev * p_ptr->lev / 20 + 10)) tmp /= 3;
                /* Low-level monsters will find it difficult to locate the player. */
                if (randint0(tmp) > (r_ptr->level+20)) aware = FALSE;
        }
@@ -2142,20 +2147,18 @@ void process_monster(MONSTER_IDX m_idx)
 
                if (see_m)
                {
-                       char m_name[80];
+                       GAME_TEXT m_name[MAX_NLEN];
                        monster_desc(m_name, m_ptr, 0);
                        msg_format(_("%sは消え去った!", "%^s disappears!"), m_name);
                }
 
                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_LOSE_PARENT, m_name);
                }
 
-
                delete_monster_idx(m_idx);
 
                return;
@@ -2176,7 +2179,7 @@ void process_monster(MONSTER_IDX m_idx)
 
                        if (see_m)
                        {
-                               char m_name[80];
+                               GAME_TEXT m_name[MAX_NLEN];
                                monster_desc(m_name, m_ptr, 0);
 
                                msg_format(_("%sは消え去った!", "%^s disappears!"), m_name);
@@ -2185,7 +2188,6 @@ void process_monster(MONSTER_IDX m_idx)
                        /* Generate treasure, etc */
                        monster_death(m_idx, FALSE);
 
-
                        delete_monster_idx(m_idx);
                        if (sad)
                        {
@@ -2198,7 +2200,8 @@ void process_monster(MONSTER_IDX m_idx)
 
        if (m_ptr->r_idx == MON_SHURYUUDAN)
        {
-               mon_take_hit_mon(m_idx, 1, &fear, _("は爆発して粉々になった。", " explodes into tiny shreds."), m_idx);
+               mon_take_hit_mon(m_idx, 1, &dead, &fear, _("は爆発して粉々になった。", " explodes into tiny shreds."), m_idx);
+               if(dead) return;
        }
 
        if ((is_pet(m_ptr) || is_friendly(m_ptr)) && ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL)) && !p_ptr->inside_battle)
@@ -2207,7 +2210,7 @@ void process_monster(MONSTER_IDX m_idx)
 
                if (m_ptr->hp < m_ptr->maxhp/3)
                {
-                       char m_name[80];
+                       GAME_TEXT m_name[MAX_NLEN];
                        monster_desc(m_name, m_ptr, 0);
 
                        if (is_riding_mon && riding_pinch < 2)
@@ -2265,18 +2268,14 @@ void process_monster(MONSTER_IDX m_idx)
                /* Handle non-aggravation - Still sleeping */
                if (!(p_ptr->cursed & TRC_AGGRAVATE)) return;
 
-               /* Handle aggravation */
-
                /* Reset sleep counter */
                (void)set_monster_csleep(m_idx, 0);
 
                /* Notice the "waking up" */
                if (m_ptr->ml)
                {
-                       char m_name[80];
+                       GAME_TEXT m_name[MAX_NLEN];
                        monster_desc(m_name, m_ptr, 0);
-
-                       /* Dump a message */
                        msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name);
                }
 
@@ -2304,8 +2303,7 @@ void process_monster(MONSTER_IDX m_idx)
                gets_angry = TRUE;
 
        /* Paranoia... no pet uniques outside wizard mode -- TY */
-       if (is_pet(m_ptr) &&
-           ((((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL)) &&
+       if (is_pet(m_ptr) && ((((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL)) &&
              monster_has_hostile_align(NULL, 10, -10, r_ptr))
             || (r_ptr->flagsr & RFR_RES_ALL)))
        {
@@ -2318,7 +2316,7 @@ void process_monster(MONSTER_IDX m_idx)
        {
                if (is_pet(m_ptr) || see_m)
                {
-                       char m_name[80];
+                       GAME_TEXT m_name[MAX_NLEN];
                        monster_desc(m_name, m_ptr, is_pet(m_ptr) ? MD_ASSUME_VISIBLE : 0);
                        msg_format(_("%^sは突然敵にまわった!", "%^s suddenly becomes hostile!"), m_name);
                }
@@ -2330,11 +2328,11 @@ void process_monster(MONSTER_IDX m_idx)
        oy = m_ptr->fy;
        ox = m_ptr->fx;
 
-
        /* Attempt to "multiply" if able and allowed */
        if ((r_ptr->flags2 & RF2_MULTIPLY) && (num_repro < MAX_REPRO))
        {
-               int k, y, x;
+               int k;
+               POSITION y, x;
 
                /* Count the adjacent monsters */
                for (k = 0, y = oy - 1; y <= oy + 1; y++)
@@ -2343,7 +2341,6 @@ void process_monster(MONSTER_IDX m_idx)
                        {
                                /* Ignore locations off of edge */
                                if (!in_bounds2(y, x)) continue;
-
                                if (cave[y][x].m_idx) k++;
                        }
                }
@@ -2369,7 +2366,6 @@ void process_monster(MONSTER_IDX m_idx)
                }
        }
 
-
        if (r_ptr->a_ability_flags2 & RF6_SPECIAL)
        {
                /* Hack -- Ohmu scatters molds! */
@@ -2383,9 +2379,9 @@ void process_monster(MONSTER_IDX m_idx)
                                        DEPTH rlev = ((r_ptr->level >= 1) ? r_ptr->level : 1);
                                        BIT_FLAGS p_mode = is_pet(m_ptr) ? PM_FORCE_PET : 0L;
 
-                                       for (k = 0; k < 6; k++)
+                                       for (k = 0; k < A_MAX; k++)
                                        {
-                                               if (summon_specific(m_idx, m_ptr->fy, m_ptr->fx, rlev, SUMMON_MOLD, (PM_ALLOW_GROUP | p_mode)))
+                                               if (summon_specific(m_idx, m_ptr->fy, m_ptr->fx, rlev, SUMMON_MOLD, (PM_ALLOW_GROUP | p_mode), '\0'))
                                                {
                                                        if (m_list[hack_m_idx_ii].ml) count++;
                                                }
@@ -2397,7 +2393,6 @@ void process_monster(MONSTER_IDX m_idx)
                }
        }
 
-
        if (!p_ptr->inside_battle)
        {
                /* Hack! "Cyber" monster makes noise... */
@@ -2415,9 +2410,9 @@ void process_monster(MONSTER_IDX m_idx)
                    player_has_los_bold(oy, ox) &&
                    projectable(oy, ox, p_ptr->y, p_ptr->x))
                {
-                       char m_name[80];
+                       GAME_TEXT m_name[MAX_NLEN];
                        char monmessage[1024];
-                       cptr filename;
+                       concptr filename;
 
                        /* Acquire the monster name/poss */
                        if (m_ptr->ml)
@@ -2542,8 +2537,7 @@ void process_monster(MONSTER_IDX m_idx)
        else if (is_pet(m_ptr))
        {
                /* Are we trying to avoid the player? */
-               bool avoid = ((p_ptr->pet_follow_distance < 0) &&
-                                                 (m_ptr->cdis <= (0 - p_ptr->pet_follow_distance)));
+               bool avoid = ((p_ptr->pet_follow_distance < 0) && (m_ptr->cdis <= (0 - p_ptr->pet_follow_distance)));
 
                /* Do we want to find the player? */
                bool lonely = (!avoid && (m_ptr->cdis > p_ptr->pet_follow_distance));
@@ -2609,7 +2603,6 @@ void process_monster(MONSTER_IDX m_idx)
        did_pass_wall = FALSE;
        did_kill_wall = FALSE;
 
-
        /* Take a zero-terminated array of "directions" */
        for (i = 0; mm[i]; i++)
        {
@@ -2856,7 +2849,7 @@ void process_monster(MONSTER_IDX m_idx)
                        }
 
                        /* In anti-melee dungeon, stupid or confused monster takes useless turn */
-                       if (do_move && (d_info[dungeon_type].flags1 & DF1_NO_MELEE))
+                       if (do_move && (d_info[dungeon_idx].flags1 & DF1_NO_MELEE))
                        {
                                if (!MON_CONFUSED(m_ptr))
                                {
@@ -2912,7 +2905,7 @@ void process_monster(MONSTER_IDX m_idx)
                                                if (monst_attack_monst(m_idx, c_ptr->m_idx)) return;
 
                                                /* In anti-melee dungeon, stupid or confused monster takes useless turn */
-                                               else if (d_info[dungeon_type].flags1 & DF1_NO_MELEE)
+                                               else if (d_info[dungeon_idx].flags1 & DF1_NO_MELEE)
                                                {
                                                        if (MON_CONFUSED(m_ptr)) return;
                                                        else if (r_ptr->flags2 & RF2_STUPID)
@@ -2975,7 +2968,6 @@ void process_monster(MONSTER_IDX m_idx)
 
                        /* Note changes to viewable region */
                        do_view = TRUE;
-
                        do_turn = TRUE;
                }
 
@@ -3040,24 +3032,19 @@ void process_monster(MONSTER_IDX m_idx)
                                }
 
                                /* Hack -- Update the new location */
-                               c_ptr->m_idx = (s16b)m_idx;
+                               c_ptr->m_idx = m_idx;
 
                                /* Move the monster */
                                m_ptr->fy = ny;
                                m_ptr->fx = nx;
                                update_monster(m_idx, TRUE);
 
-                               /* Redraw the old grid */
                                lite_spot(oy, ox);
-
-                               /* Redraw the new grid */
                                lite_spot(ny, nx);
                        }
                        else
                        {
                                /* sound(SOUND_WALK); */
-
-                               /* Move the player */
                                if (!move_player_effect(ny, nx, MPE_DONT_PICKUP)) break;
                        }
 
@@ -3082,7 +3069,7 @@ void process_monster(MONSTER_IDX m_idx)
                                for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
                                {
                                        BIT_FLAGS flgs[TR_FLAG_SIZE], flg2 = 0L, flg3 = 0L, flgr = 0L;
-                                       char m_name[80], o_name[MAX_NLEN];
+                                       GAME_TEXT m_name[MAX_NLEN], o_name[MAX_NLEN];
                                        object_type *o_ptr = &o_list[this_o_idx];
 
                                        /* Acquire next object */
@@ -3141,13 +3128,11 @@ void process_monster(MONSTER_IDX m_idx)
                                                /* Only give a message for "take_item" */
                                                if (do_take && (r_ptr->flags2 & RF2_STUPID))
                                                {
-                                                       /* Take note */
                                                        did_take_item = TRUE;
 
                                                        /* Describe observable situations */
                                                        if (m_ptr->ml && player_can_see_bold(ny, nx))
                                                        {
-                                                               /* Dump a message */
                                                                msg_format(_("%^sは%sを拾おうとしたが、だめだった。", "%^s tries to pick up %s, but fails."), m_name, o_name);
                                                        }
                                                }
@@ -3156,13 +3141,11 @@ void process_monster(MONSTER_IDX m_idx)
                                        /* Pick up the item */
                                        else if (do_take)
                                        {
-                                               /* Take note */
                                                did_take_item = TRUE;
 
                                                /* Describe observable situations */
                                                if (player_can_see_bold(ny, nx))
                                                {
-                                                       /* Dump a message */
                                                        msg_format(_("%^sが%sを拾った。", "%^s picks up %s."), m_name, o_name);
                                                }
 
@@ -3176,7 +3159,7 @@ void process_monster(MONSTER_IDX m_idx)
                                                o_ptr->iy = o_ptr->ix = 0;
 
                                                /* Memorize monster */
-                                               o_ptr->held_m_idx = (s16b)m_idx;
+                                               o_ptr->held_m_idx = m_idx;
 
                                                /* Build a stack */
                                                o_ptr->next_o_idx = m_ptr->hold_o_idx;
@@ -3188,13 +3171,11 @@ void process_monster(MONSTER_IDX m_idx)
                                        /* Destroy the item if not a pet */
                                        else if (!is_pet(m_ptr))
                                        {
-                                               /* Take note */
                                                did_kill_item = TRUE;
 
                                                /* Describe observable situations */
                                                if (player_has_los_bold(ny, nx))
                                                {
-                                                       /* Dump a message */
                                                        msg_format(_("%^sが%sを破壊した。", "%^s destroys %s."), m_name, o_name);
                                                }
 
@@ -3229,9 +3210,7 @@ void process_monster(MONSTER_IDX m_idx)
        /* Notice changes in view */
        if (do_view)
        {
-               /* Update some things */
                p_ptr->update |= (PU_FLOW);
-
                p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
        }
 
@@ -3278,10 +3257,8 @@ void process_monster(MONSTER_IDX m_idx)
                /* Message if seen */
                if (see_m)
                {
-                       char m_name[80];
+                       GAME_TEXT m_name[MAX_NLEN];
                        monster_desc(m_name, m_ptr, 0);
-
-                       /* Dump a message */
                        msg_format(_("%^sは戦いを決意した!", "%^s turns to fight!"), m_name);
                }