OSDN Git Service

[Refactor] #37353 店処理のヘッダを externs.h から store.h へ分離。
[hengband/hengband.git] / src / monster-process.c
index 4d15c89..4d04039 100644 (file)
@@ -212,10 +212,9 @@ void mon_take_hit_mon(MONSTER_IDX m_idx, HIT_POINT dam, bool *fear, cptr note, I
                if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
        }
 
-       /* Wake it up */
        (void)set_monster_csleep(m_idx, 0);
 
-       if (p_ptr->riding && (m_idx == p_ptr->riding)) disturb(1, 1);
+       if (p_ptr->riding && (m_idx == p_ptr->riding)) disturb(TRUE, TRUE);
 
        if (MON_INVULNER(m_ptr) && randint0(PENETRATE_INVULNERABILITY))
        {
@@ -298,7 +297,7 @@ void mon_take_hit_mon(MONSTER_IDX m_idx, HIT_POINT dam, bool *fear, cptr note, I
                        /* Generate treasure */
                        monster_death(m_idx, FALSE);
 
-                       /* Delete the monster */
+
                        delete_monster_idx(m_idx);
 
                        /* Not afraid */
@@ -338,7 +337,7 @@ void mon_take_hit_mon(MONSTER_IDX m_idx, HIT_POINT dam, bool *fear, cptr note, I
                        /* Hack -- note fear */
                        (*fear) = TRUE;
 
-                       /* XXX XXX XXX Hack -- Add some timed fear */
+                       /* Hack -- Add some timed fear */
                        (void)set_monster_monfear(m_idx, (randint1(10) +
                                (((dam >= m_ptr->hp) && (percentage > 7)) ?
                                20 : ((11 - percentage) * 5))));
@@ -764,53 +763,30 @@ static bool get_fear_moves_aux(MONSTER_IDX m_idx, POSITION *yp, POSITION *xp)
  * It is probably better to replace these arrays with code to compute
  * the relevant arrays, even if the storage is pre-allocated in hard
  * coded sizes.  At the very least, code should be included which is
- * able to generate and dump these arrays (ala "los()").  XXX XXX XXX
+ * able to generate and dump these arrays (ala "los()").  
  *
- * Also, the storage needs could be halved by using bytes.  XXX XXX XXX
+ * Also, the storage needs could be halved by using bytes.  
  *
  * These arrays could be combined into two big arrays, using sub-arrays
  * to hold the offsets and lengths of each portion of the sub-arrays, and
- * this could perhaps also be used somehow in the "look" code.  XXX XXX XXX
+ * this could perhaps also be used somehow in the "look" code.  
  */
 
 
-static sint d_off_y_0[] =
-{ 0 };
-
-static sint 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 sint d_off_y_2[] =
-{ -1, -1, -2, -2, -2, 0, 0, 1, 1, 2, 2, 2, 0 };
+static sint d_off_y_0[] = { 0 };
+static sint d_off_x_0[] = { 0 };
 
-static sint d_off_x_2[] =
-{ -2, 2, -1, 0, 1, -2, 2, -2, 2, -1, 0, 1, 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 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 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_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 sint 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 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 sint d_off_y_5[] =
@@ -1181,7 +1157,6 @@ static bool get_moves(MONSTER_IDX m_idx, int *mm)
                        y = m_ptr->fy - y2;
                        x = m_ptr->fx - x2;
 
-                       /* Done */
                        done = TRUE;
                }
        }
@@ -1497,7 +1472,7 @@ static bool monst_attack_monst(MONSTER_IDX m_idx, MONSTER_IDX t_idx)
                mon_fight = TRUE;
        }
 
-       if (p_ptr->riding && (m_idx == p_ptr->riding)) disturb(1, 1);
+       if (p_ptr->riding && (m_idx == p_ptr->riding)) disturb(TRUE, TRUE);
 
        /* Scan through all four blows */
        for (ap_cnt = 0; ap_cnt < 4; ap_cnt++)
@@ -1532,7 +1507,6 @@ static bool monst_attack_monst(MONSTER_IDX m_idx, MONSTER_IDX t_idx)
                /* Monster hits */
                if (!effect || check_hit2(power, rlev, ac, MON_STUNNED(m_ptr)))
                {
-                       /* Wake it up */
                        (void)set_monster_csleep(t_idx, 0);
 
                        if (t_ptr->ml)
@@ -1651,7 +1625,7 @@ static bool monst_attack_monst(MONSTER_IDX m_idx, MONSTER_IDX t_idx)
 
                        case RBM_EXPLODE:
                                {
-                                       if (see_either) disturb(1, 1);
+                                       if (see_either) disturb(TRUE, TRUE);
                                        act = _("爆発した。", "explodes.");
                                        explode = TRUE;
                                        touched = FALSE;
@@ -1986,14 +1960,13 @@ static bool monst_attack_monst(MONSTER_IDX m_idx, MONSTER_IDX t_idx)
                        case RBM_ENGULF:
                        case RBM_CHARGE:
                                {
-                                       /* Wake it up */
                                        (void)set_monster_csleep(t_idx, 0);
 
                                        /* Visible monsters */
                                        if (see_m)
                                        {
 #ifdef JP
-                                               msg_format("%sは%^sの攻撃をかわした。", t_name,m_name);
+                                               msg_format("%sは%^sの攻撃をかわした。", t_name, m_name);
 #else
                                                msg_format("%^s misses %s.", m_name, t_name);
 #endif
@@ -2092,7 +2065,7 @@ static bool check_hp_for_feat_destruction(feature_type *f_ptr, monster_type *m_p
  * fixate on opening a door even if they cannot open it.  Actually,\n
  * the same thing happens to normal monsters when they hit a door\n
  *\n
- * XXX XXX XXX In addition, monsters which *cannot* open or bash\n
+ * In addition, monsters which *cannot* open or bash\n
  * down a door will still stand there trying to open it...\n
  *\n
  * XXX Technically, need to check for monster in the way\n
@@ -2191,7 +2164,7 @@ void process_monster(MONSTER_IDX m_idx)
                        do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_LOSE_PARENT, m_name);
                }
 
-               /* Delete the monster */
+
                delete_monster_idx(m_idx);
 
                return;
@@ -2218,14 +2191,13 @@ void process_monster(MONSTER_IDX m_idx)
                                /* Acquire the monster name */
                                monster_desc(m_name, m_ptr, 0);
 
-                               /* Oops */
                                msg_format(_("%sは消え去った!", "%^s disappears!"), m_name);
                        }
 
                        /* Generate treasure, etc */
                        monster_death(m_idx, FALSE);
 
-                       /* Delete the monster */
+
                        delete_monster_idx(m_idx);
 
                        if (sad)
@@ -2256,7 +2228,7 @@ void process_monster(MONSTER_IDX m_idx)
                                msg_format(_("%sは傷の痛さの余りあなたの束縛から逃れようとしている。",
                                                         "%^s seems to be in so much pain, and trying to escape from your restriction."), m_name);
                                riding_pinch++;
-                               disturb(1, 1);
+                               disturb(TRUE, TRUE);
                        }
                        else
                        {
@@ -2746,7 +2718,7 @@ void process_monster(MONSTER_IDX m_idx)
                                /* Locked doors (not jammed) */
                                else
                                {
-                                       /* Try to unlock it XXX XXX XXX */
+                                       /* Try to unlock it */
                                        if (randint0(m_ptr->hp / 10) > f_ptr->power)
                                        {
                                                /* Unlock the door */
@@ -2764,7 +2736,7 @@ void process_monster(MONSTER_IDX m_idx)
                        if (may_bash && (r_ptr->flags2 & RF2_BASH_DOOR) && have_flag(f_ptr->flags, FF_BASH) &&
                                (!is_pet(m_ptr) || (p_ptr->pet_extra_flags & PF_OPEN_DOORS)))
                        {
-                               /* Attempt to Bash XXX XXX XXX */
+                               /* Attempt to Bash */
                                if (check_hp_for_feat_destruction(f_ptr, m_ptr) && (randint0(m_ptr->hp / 10) > f_ptr->power))
                                {
                                        if (have_flag(f_ptr->flags, FF_GLASS))
@@ -2773,7 +2745,7 @@ void process_monster(MONSTER_IDX m_idx)
                                                msg_print(_("ドアを叩き開ける音がした!", "You hear a door burst open!"));
 
                                        /* Disturb (sometimes) */
-                                       if (disturb_minor) disturb(0, 0);
+                                       if (disturb_minor) disturb(FALSE, FALSE);
 
                                        /* The door was bashed open */
                                        did_bash_door = TRUE;
@@ -2843,7 +2815,6 @@ void process_monster(MONSTER_IDX m_idx)
                                /* Allow movement */
                                do_move = TRUE;
 
-                               /* Notice */
                                note_spot(ny, nx);
                        }
                }
@@ -2985,7 +2956,7 @@ void process_monster(MONSTER_IDX m_idx)
                                /* Wake up the moved monster */
                                (void)set_monster_csleep(c_ptr->m_idx, 0);
 
-                               /* XXX XXX XXX Message */
+                               /* Message */
                        }
                }
 
@@ -3081,7 +3052,7 @@ void process_monster(MONSTER_IDX m_idx)
                                        y_ptr->fx = ox;
 
                                        /* Update the old monster */
-                                       update_mon(c_ptr->m_idx, TRUE);
+                                       update_monster(c_ptr->m_idx, TRUE);
                                }
 
                                /* Hack -- Update the new location */
@@ -3090,9 +3061,7 @@ void process_monster(MONSTER_IDX m_idx)
                                /* Move the monster */
                                m_ptr->fy = ny;
                                m_ptr->fx = nx;
-
-                               /* Update the monster */
-                               update_mon(m_idx, TRUE);
+                               update_monster(m_idx, TRUE);
 
                                /* Redraw the old grid */
                                lite_spot(oy, ox);
@@ -3114,9 +3083,8 @@ void process_monster(MONSTER_IDX m_idx)
                             (disturb_near && (m_ptr->mflag & MFLAG_VIEW) && projectable(p_ptr->y, p_ptr->x, m_ptr->fy, m_ptr->fx)) ||
                             (disturb_high && ap_r_ptr->r_tkills && ap_r_ptr->level >= p_ptr->lev)))
                        {
-                               /* Disturb */
                                if (is_hostile(m_ptr))
-                                       disturb(0, 1);
+                                       disturb(FALSE, TRUE);
                        }
 
                        /* Take or Kill objects on the floor */
@@ -3131,8 +3099,6 @@ void process_monster(MONSTER_IDX m_idx)
                                {
                                        BIT_FLAGS flgs[TR_FLAG_SIZE], flg2 = 0L, flg3 = 0L, flgr = 0L;
                                        char m_name[80], o_name[MAX_NLEN];
-
-                                       /* Acquire object */
                                        object_type *o_ptr = &o_list[this_o_idx];
 
                                        /* Acquire next object */
@@ -3250,7 +3216,6 @@ void process_monster(MONSTER_IDX m_idx)
                                                        msg_format(_("%^sが%sを破壊した。", "%^s destroys %s."), m_name, o_name);
                                                }
 
-                                               /* Delete the object */
                                                delete_object_idx(this_o_idx);
                                        }
                                }
@@ -3285,7 +3250,6 @@ void process_monster(MONSTER_IDX m_idx)
                /* Update some things */
                p_ptr->update |= (PU_FLOW);
 
-               /* Window stuff */
                p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
        }
 
@@ -3343,7 +3307,7 @@ void process_monster(MONSTER_IDX m_idx)
 
                if (m_ptr->ml) chg_virtue(V_COMPASSION, -1);
 
-               /* XXX XXX XXX Actually do something now (?) */
+               /* Actually do something now (?) */
        }
 }
 
@@ -3391,24 +3355,24 @@ void process_monsters(void)
        monster_type    *m_ptr;
        monster_race    *r_ptr;
 
-       int             old_monster_race_idx;
+       MONRACE_IDX old_monster_race_idx;
 
-       u32b    old_r_flags1 = 0L;
-       u32b    old_r_flags2 = 0L;
-       u32b    old_r_flags3 = 0L;
-       u32b    old_r_flags4 = 0L;
-       u32b    old_r_flags5 = 0L;
-       u32b    old_r_flags6 = 0L;
-       u32b    old_r_flagsr = 0L;
+       BIT_FLAGS old_r_flags1 = 0L;
+       BIT_FLAGS old_r_flags2 = 0L;
+       BIT_FLAGS old_r_flags3 = 0L;
+       BIT_FLAGS old_r_flags4 = 0L;
+       BIT_FLAGS old_r_flags5 = 0L;
+       BIT_FLAGS old_r_flags6 = 0L;
+       BIT_FLAGS old_r_flagsr = 0L;
 
-       byte    old_r_blows0 = 0;
-       byte    old_r_blows1 = 0;
-       byte    old_r_blows2 = 0;
-       byte    old_r_blows3 = 0;
+       byte old_r_blows0 = 0;
+       byte old_r_blows1 = 0;
+       byte old_r_blows2 = 0;
+       byte old_r_blows3 = 0;
 
-       byte    old_r_cast_spell = 0;
+       byte old_r_cast_spell = 0;
 
-       int speed;
+       SPEED speed;
 
        /* Clear monster fighting indicator */
        mon_fight = FALSE;
@@ -3585,7 +3549,6 @@ void process_monsters(void)
                        (old_r_blows3 != r_ptr->r_blows[3]) ||
                        (old_r_cast_spell != r_ptr->r_cast_spell))
                {
-                       /* Window stuff */
                        p_ptr->window |= (PW_MONSTER);
                }
        }