OSDN Git Service

モンスターの光源の更新に関する変更と修正.
authornothere <nothere@0568b783-4c39-0410-ac80-bf13821ea2a2>
Mon, 15 Sep 2003 12:03:37 +0000 (12:03 +0000)
committernothere <nothere@0568b783-4c39-0410-ac80-bf13821ea2a2>
Mon, 15 Sep 2003 12:03:37 +0000 (12:03 +0000)
* モンスターをテレポートさせる, あるいはモンスターがテレポートすると
  モンスター光源が残るバグを修正.
* モンスターの座標が変わった際にモンスター光源アップデートが必要な部
  分の追加.
* モンスター単体が座標移動する, 起きる, あるいは消去される場合に, 光
  源持ちでない場合にもモンスター光源のアップデートが行われていた部分
  があったので, そういった場合には行わないようにした.
* 光源持ちでないモンスターが光源持ちモンスターを押しのけた場合にモン
  スター光源のアップデートが行われなかったバグを修正.
* 乗馬のIDからm_list[], r_info[]を引いていた部分の一部のポインタ化.

src/cmd1.c
src/dungeon.c
src/hissatsu.c
src/melee2.c
src/mind.c
src/monster2.c
src/mspells1.c
src/mspells2.c
src/spells1.c
src/spells3.c

index 441cc40..92747c6 100644 (file)
@@ -2085,8 +2085,7 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int
 
        /* Disturb the monster */
        m_ptr->csleep = 0;
-       if (r_ptr->flags7 & RF7_HAS_LD_MASK)
-               p_ptr->update |= (PU_MON_LITE);
+       if (r_ptr->flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
 
        /* Extract monster name (or "it") */
        monster_desc(m_name, m_ptr, 0);
@@ -3130,6 +3129,7 @@ bool py_attack(int y, int x, int mode)
 
        cave_type       *c_ptr = &cave[y][x];
        monster_type    *m_ptr = &m_list[c_ptr->m_idx];
+       monster_race    *r_ptr = &r_info[m_ptr->r_idx];
        char            m_name[80];
 
        /* Disturb the player */
@@ -3139,8 +3139,8 @@ bool py_attack(int y, int x, int mode)
 
        if (m_ptr->csleep) /* It is not honorable etc to attack helpless victims */
        {
-               if (!(r_info[m_ptr->r_idx].flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
-               if (!(r_info[m_ptr->r_idx].flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
+               if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
+               if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
        }
 
        /* Extract monster name (or "it") */
@@ -3152,7 +3152,7 @@ bool py_attack(int y, int x, int mode)
        /* Track a new monster */
        if (m_ptr->ml) health_track(c_ptr->m_idx);
 
-       if ((r_info[m_ptr->r_idx].flags1 & RF1_FEMALE) &&
+       if ((r_ptr->flags1 & RF1_FEMALE) &&
            !(p_ptr->stun || p_ptr->confused || p_ptr->image || !m_ptr->ml))
        {
                if ((inventory[INVEN_RARM].name1 == ART_ZANTETSU) || (inventory[INVEN_LARM].name1 == ART_ZANTETSU))
@@ -3215,7 +3215,7 @@ bool py_attack(int y, int x, int mode)
 #else
                                msg_format("You stop to avoid hitting %s.", m_name);
 #endif
-                       return FALSE;
+                               return FALSE;
                        }
                }
        }
@@ -3241,7 +3241,7 @@ bool py_attack(int y, int x, int mode)
 
                /* Disturb the monster */
                m_ptr->csleep = 0;
-               p_ptr->update |= (PU_MON_LITE);
+               if (r_ptr->flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
 
                /* Done */
                return FALSE;
@@ -3249,7 +3249,7 @@ bool py_attack(int y, int x, int mode)
 
        if (p_ptr->migite && p_ptr->hidarite)
        {
-               if ((p_ptr->skill_exp[GINOU_NITOURYU] < s_info[p_ptr->pclass].s_max[GINOU_NITOURYU]) && ((p_ptr->skill_exp[GINOU_NITOURYU] - 1000) / 200 < r_info[m_ptr->r_idx].level))
+               if ((p_ptr->skill_exp[GINOU_NITOURYU] < s_info[p_ptr->pclass].s_max[GINOU_NITOURYU]) && ((p_ptr->skill_exp[GINOU_NITOURYU] - 1000) / 200 < r_ptr->level))
                {
                        if (p_ptr->skill_exp[GINOU_NITOURYU] < WEAPON_EXP_BEGINNER)
                                p_ptr->skill_exp[GINOU_NITOURYU] += 80;
@@ -3272,7 +3272,7 @@ bool py_attack(int y, int x, int mode)
                if (cur < max)
                {
                        int ridinglevel = r_info[m_list[p_ptr->riding].r_idx].level;
-                       int targetlevel = r_info[m_ptr->r_idx].level;
+                       int targetlevel = r_ptr->level;
                        int inc = 0;
 
                        if ((cur / 200 - 5) < targetlevel)
@@ -3563,6 +3563,9 @@ void move_player(int dir, int do_pickup, bool break_trap)
        cave_type *c_ptr;
        monster_type *m_ptr;
 
+       monster_type *riding_m_ptr = &m_list[p_ptr->riding];
+       monster_race *riding_r_ptr = &r_info[p_ptr->riding ? riding_m_ptr->r_idx : 0]; /* Paranoia */
+
        char m_name[80];
 
        bool p_can_pass_walls = FALSE;
@@ -3692,6 +3695,7 @@ void move_player(int dir, int do_pickup, bool break_trap)
        /* Hack -- attack monsters */
        if (c_ptr->m_idx && (m_ptr->ml || cave_floor_bold(y, x) || p_can_pass_walls))
        {
+               monster_race *r_ptr = &r_info[m_ptr->r_idx];
 
                /* Attack -- only if we can see it OR it is not in a wall */
                if (!is_hostile(m_ptr) &&
@@ -3701,7 +3705,7 @@ void move_player(int dir, int do_pickup, bool break_trap)
                    ((cave_floor_bold(y, x)) || (c_ptr->feat == FEAT_TREES) || (p_can_pass_walls)))
                {
                        m_ptr->csleep = 0;
-                       p_ptr->update |= (PU_MON_LITE);
+                       if (r_ptr->flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
 
                        /* Extract monster name (or "it") */
                        monster_desc(m_name, m_ptr, 0);
@@ -3718,9 +3722,9 @@ void move_player(int dir, int do_pickup, bool break_trap)
                                py_attack(y, x, 0);
                                oktomove = FALSE;
                        }
-                       else if (monster_can_cross_terrain(cave[py][px].feat, &r_info[m_ptr->r_idx]) &&
+                       else if (monster_can_cross_terrain(cave[py][px].feat, r_ptr) &&
                                 (cave_floor_bold(py, px) || cave[py][px].feat == FEAT_TREES ||
-                                 (r_info[m_ptr->r_idx].flags2 & RF2_PASS_WALL)))
+                                 (r_ptr->flags2 & RF2_PASS_WALL)))
                        {
                                do_past = TRUE;
                        }
@@ -3839,7 +3843,7 @@ void move_player(int dir, int do_pickup, bool break_trap)
        }
 
 #endif /* ALLOW_EASY_DISARM -- TNB */
-       else if (p_ptr->riding && (r_info[m_list[p_ptr->riding].r_idx].flags1 & RF1_NEVER_MOVE))
+       else if (p_ptr->riding && (riding_r_ptr->flags1 & RF1_NEVER_MOVE))
        {
 #ifdef JP
                msg_print("Æ°¤±¤Ê¤¤¡ª");
@@ -3851,16 +3855,16 @@ void move_player(int dir, int do_pickup, bool break_trap)
                disturb(0, 0);
        }
 
-       else if (p_ptr->riding && m_list[p_ptr->riding].monfear)
+       else if (p_ptr->riding && riding_m_ptr->monfear)
        {
                char m_name[80];
 
                /* Acquire the monster name */
-               monster_desc(m_name, &m_list[p_ptr->riding], 0);
+               monster_desc(m_name, riding_m_ptr, 0);
 
                /* Dump a message */
 #ifdef JP
-msg_format("%s¤¬¶²Éݤ·¤Æ¤¤¤ÆÀ©¸æ¤Ç¤­¤Ê¤¤¡£", m_name);
+               msg_format("%s¤¬¶²Éݤ·¤Æ¤¤¤ÆÀ©¸æ¤Ç¤­¤Ê¤¤¡£", m_name);
 #else
                msg_format("%^s is too scared to control.", m_name);
 #endif
@@ -3874,7 +3878,7 @@ msg_format("%s
                disturb(0, 0);
        }
 
-       else if ((p_ptr->riding && (r_info[m_list[p_ptr->riding].r_idx].flags7 & RF7_AQUATIC)) && (c_ptr->feat != FEAT_SHAL_WATER) && (c_ptr->feat != FEAT_DEEP_WATER))
+       else if ((p_ptr->riding && (riding_r_ptr->flags7 & RF7_AQUATIC)) && (c_ptr->feat != FEAT_SHAL_WATER) && (c_ptr->feat != FEAT_DEEP_WATER))
        {
 #ifdef JP
                msg_print("Φ¾å¤Ë¾å¤¬¤ì¤Ê¤¤¡£");
@@ -3886,7 +3890,7 @@ msg_format("%s
                disturb(0, 0);
        }
 
-       else if ((p_ptr->riding && !(r_info[m_list[p_ptr->riding].r_idx].flags7 & (RF7_AQUATIC | RF7_CAN_SWIM | RF7_CAN_FLY))) && (c_ptr->feat == FEAT_DEEP_WATER))
+       else if ((p_ptr->riding && !(riding_r_ptr->flags7 & (RF7_AQUATIC | RF7_CAN_SWIM | RF7_CAN_FLY))) && (c_ptr->feat == FEAT_DEEP_WATER))
        {
 #ifdef JP
                msg_print("¿å¾å¤Ë¹Ô¤±¤Ê¤¤¡£");
@@ -3898,7 +3902,7 @@ msg_format("%s
                disturb(0, 0);
        }
 
-       else if ((p_ptr->riding && (r_info[m_list[p_ptr->riding].r_idx].flags2 & (RF2_AURA_FIRE)) && !(r_info[m_list[p_ptr->riding].r_idx].flags7 & (RF7_CAN_FLY))) && (c_ptr->feat == FEAT_SHAL_WATER))
+       else if ((p_ptr->riding && (riding_r_ptr->flags2 & RF2_AURA_FIRE) && !(riding_r_ptr->flags7 & RF7_CAN_FLY)) && (c_ptr->feat == FEAT_SHAL_WATER))
        {
 #ifdef JP
                msg_print("¿å¾å¤Ë¹Ô¤±¤Ê¤¤¡£");
@@ -3910,7 +3914,7 @@ msg_format("%s
                disturb(0, 0);
        }
 
-       else if ((p_ptr->riding && !(r_info[m_list[p_ptr->riding].r_idx].flags7 & (RF7_CAN_FLY)) && !(r_info[m_list[p_ptr->riding].r_idx].flagsr & RFR_EFF_IM_FIRE_MASK)) && ((c_ptr->feat == FEAT_SHAL_LAVA) || (c_ptr->feat == FEAT_DEEP_LAVA)))
+       else if ((p_ptr->riding && !(riding_r_ptr->flags7 & RF7_CAN_FLY) && !(riding_r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK)) && ((c_ptr->feat == FEAT_SHAL_LAVA) || (c_ptr->feat == FEAT_DEEP_LAVA)))
        {
 #ifdef JP
                msg_print("ÍÏ´ä¤Î¾å¤Ë¹Ô¤±¤Ê¤¤¡£");
@@ -3922,10 +3926,10 @@ msg_format("%s
                disturb(0, 0);
        }
 
-       else if (p_ptr->riding && m_list[p_ptr->riding].stunned && one_in_(2))
+       else if (p_ptr->riding && riding_m_ptr->stunned && one_in_(2))
        {
                char m_name[80];
-               monster_desc(m_name, &m_list[p_ptr->riding], 0);
+               monster_desc(m_name, riding_m_ptr, 0);
 #ifdef JP
                msg_format("%s¤¬Û¯Û°¤È¤·¤Æ¤¤¤Æ¤¦¤Þ¤¯Æ°¤±¤Ê¤¤¡ª",m_name);
 #else
@@ -4136,7 +4140,7 @@ msg_format("%s
                py = y;
                px = x;
 
-               if (p_ptr->riding && (r_info[m_list[p_ptr->riding].r_idx].flags2 & RF2_KILL_WALL))
+               if (p_ptr->riding && (riding_r_ptr->flags2 & RF2_KILL_WALL))
                {
                        if (cave[py][px].feat >= FEAT_RUBBLE && cave[py][px].feat < FEAT_PERM_SOLID)
                        {
@@ -4165,7 +4169,8 @@ msg_format("%s
                                else
                                        cave_set_feat(py, px, floor_type[randint0(100)]);
                        }
-                               /* Update some things -- similar to GF_KILL_WALL */
+
+                       /* Update some things -- similar to GF_KILL_WALL */
                        p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MONSTERS | PU_MON_LITE);
                }
 
@@ -4346,7 +4351,7 @@ msg_format("%s
                                        msg_print("*Leaving trap detect region!*");
 #endif
                                }
-                               
+
                                if (disturb_trap_detect)
                                {
                                        disturb(0, 0);
@@ -4357,11 +4362,12 @@ msg_format("%s
 
        if (p_ptr->riding)
        {
-               m_list[p_ptr->riding].fy = py;
-               m_list[p_ptr->riding].fx = px;
+               riding_m_ptr->fy = py;
+               riding_m_ptr->fx = px;
                cave[py][px].m_idx = p_ptr->riding;
                update_mon(cave[py][px].m_idx, TRUE);
-               p_ptr->update |= (PU_MON_LITE);
+               if (riding_r_ptr->flags7 & (RF7_LITE_MASK | RF7_DARK_MASK))
+                       p_ptr->update |= (PU_MON_LITE);
        }
 }
 
index abd9d2e..23db6b0 100644 (file)
@@ -5623,6 +5623,7 @@ msg_print("
        if (p_ptr->riding && !p_ptr->confused && !p_ptr->blind)
        {
                monster_type *m_ptr = &m_list[p_ptr->riding];
+               monster_race *r_ptr = &r_info[m_ptr->r_idx];
 
                if (m_ptr->csleep)
                {
@@ -5631,7 +5632,7 @@ msg_print("
                        /* Recover fully */
                        m_ptr->csleep = 0;
 
-                       if (r_info[m_ptr->r_idx].flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
+                       if (r_ptr->flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
 
                        /* Acquire the monster name */
                        monster_desc(m_name, m_ptr, 0);
@@ -5649,7 +5650,7 @@ msg_format("%^s
                        int d = 1;
 
                        /* Make a "saving throw" against stun */
-                       if (randint0(r_info[m_ptr->r_idx].level) < p_ptr->skill_exp[GINOU_RIDING])
+                       if (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING])
                        {
                                /* Recover fully */
                                d = m_ptr->stunned;
@@ -5689,7 +5690,7 @@ msg_format("%^s
                        int d = 1;
 
                        /* Make a "saving throw" against stun */
-                       if (randint0(r_info[m_ptr->r_idx].level) < p_ptr->skill_exp[GINOU_RIDING])
+                       if (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING])
                        {
                                /* Recover fully */
                                d = m_ptr->confused;
@@ -5729,7 +5730,7 @@ msg_format("%^s
                        int d = 1;
 
                        /* Make a "saving throw" against stun */
-                       if (randint0(r_info[m_ptr->r_idx].level) < p_ptr->skill_exp[GINOU_RIDING])
+                       if (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING])
                        {
                                /* Recover fully */
                                d = m_ptr->monfear;
index 70010c8..2c9c324 100644 (file)
@@ -634,6 +634,9 @@ static bool cast_hissatsu_spell(int spell)
                                update_mon(m_idx, TRUE);
                                lite_spot(oy, ox);
                                lite_spot(ty, tx);
+
+                               if (r_info[m_ptr->r_idx].flags7 & (RF7_LITE_MASK | RF7_DARK_MASK))
+                                       p_ptr->update |= (PU_MON_LITE);
                        }
                }
                break;
index feb3930..c56fd9e 100644 (file)
@@ -3333,7 +3333,8 @@ msg_print("
                                /* Wake up the moved monster */
                                y_ptr->csleep = 0;
 
-                               if (r_info[y_ptr->r_idx].flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
+                               if (r_info[y_ptr->r_idx].flags7 & (RF7_LITE_MASK | RF7_DARK_MASK))
+                                       p_ptr->update |= (PU_MON_LITE);
                        }
 
                        /* Hack -- Update the new location */
index ff5fc96..c7438ed 100644 (file)
@@ -1111,11 +1111,12 @@ static bool cast_force_spell(int spell)
                        int oy = y, ox = x;
                        int m_idx = cave[y][x].m_idx;
                        monster_type *m_ptr = &m_list[m_idx];
+                       monster_race *r_ptr = &r_info[m_ptr->r_idx];
                        char m_name[80];
 
                        monster_desc(m_name, m_ptr, 0);
 
-                       if (randint1(r_info[m_ptr->r_idx].level * 3 / 2) > randint0(dam / 2) + dam/2)
+                       if (randint1(r_ptr->level * 3 / 2) > randint0(dam / 2) + dam/2)
                        {
 #ifdef JP
                                msg_format("%s¤ÏÈô¤Ð¤µ¤ì¤Ê¤«¤Ã¤¿¡£", m_name);
@@ -1151,6 +1152,9 @@ static bool cast_force_spell(int spell)
                                        update_mon(m_idx, TRUE);
                                        lite_spot(oy, ox);
                                        lite_spot(ty, tx);
+
+                                       if (r_ptr->flags7 & (RF7_LITE_MASK | RF7_DARK_MASK))
+                                               p_ptr->update |= (PU_MON_LITE);
                                }
                        }
                }
@@ -1776,7 +1780,8 @@ msg_print("
                /* Redraw the new grid */
                lite_spot(ty, tx);
 
-               p_ptr->update |= (PU_MON_LITE);
+               if (r_info[m_ptr->r_idx].flags7 & (RF7_LITE_MASK | RF7_DARK_MASK))
+                       p_ptr->update |= (PU_MON_LITE);
 
                break;
        }
index 897f788..a613556 100644 (file)
@@ -263,7 +263,8 @@ void delete_monster_idx(int i)
        lite_spot(y, x);
 
        /* Update some things */
-       p_ptr->update |= (PU_MON_LITE);
+       if (r_ptr->flags7 & (RF7_LITE_MASK | RF7_DARK_MASK))
+               p_ptr->update |= (PU_MON_LITE);
 }
 
 
index 2231c5b..2887188 100644 (file)
@@ -3369,7 +3369,7 @@ msg_format("%^s
 #endif
 
                        teleport_away(m_idx, 10, FALSE);
-                       p_ptr->update |= (PU_MONSTERS | PU_MON_LITE);
+                       p_ptr->update |= (PU_MONSTERS);
                        break;
                }
 
@@ -3550,7 +3550,7 @@ msg_format("%^s
                                                msg_format("%^s suddenly go out of your sight!", m_name);
 #endif
                                                teleport_away(m_idx, 10, FALSE);
-                                               p_ptr->update |= (PU_MONSTERS | PU_MON_LITE);
+                                               p_ptr->update |= (PU_MONSTERS);
                                        }
                                        else
                                        {
index e640ce4..38977ff 100644 (file)
@@ -3095,7 +3095,7 @@ bool monst_spell_monst(int m_idx)
 #endif
                                        }
                                        teleport_away(m_idx, 10, FALSE);
-                                       p_ptr->update |= (PU_MONSTERS | PU_MON_LITE);
+                                       p_ptr->update |= (PU_MONSTERS);
                                }
                                else
                                {
index df03b04..2ca71e2 100644 (file)
@@ -813,14 +813,14 @@ msg_print("
 #endif
 
                                        obvious = TRUE;
+                               }
 
-                                       /* Visibility change */
-                                       if ((c_ptr->feat >= FEAT_DOOR_HEAD) &&
-                                                (c_ptr->feat <= FEAT_DOOR_TAIL))
-                                       {
-                                               /* Update some things */
-                                               p_ptr->update |= (PU_VIEW | PU_LITE | PU_MONSTERS | PU_MON_LITE);
-                                       }
+                               /* Visibility change */
+                               if ((c_ptr->feat >= FEAT_DOOR_HEAD) &&
+                                        (c_ptr->feat <= FEAT_DOOR_TAIL))
+                               {
+                                       /* Update some things */
+                                       p_ptr->update |= (PU_VIEW | PU_LITE | PU_MONSTERS | PU_MON_LITE);
                                }
 
                                /* Forget the door */
index b54f24a..444ceef 100644 (file)
@@ -134,6 +134,9 @@ bool teleport_away(int m_idx, int dis, bool dec_valour)
        /* Redraw the new grid */
        lite_spot(ny, nx);
 
+       if (r_info[m_ptr->r_idx].flags7 & (RF7_LITE_MASK | RF7_DARK_MASK))
+               p_ptr->update |= (PU_MON_LITE);
+
        return (TRUE);
 }
 
@@ -245,7 +248,8 @@ void teleport_monster_to(int m_idx, int ty, int tx, int power)
        /* Redraw the new grid */
        lite_spot(ny, nx);
 
-       p_ptr->update |= (PU_MON_LITE);
+       if (r_info[m_ptr->r_idx].flags7 & (RF7_LITE_MASK | RF7_DARK_MASK))
+               p_ptr->update |= (PU_MON_LITE);
 }