OSDN Git Service

モンスターの死亡メッセージのコードの一部を関数にまとめた.
authornothere <nothere@0568b783-4c39-0410-ac80-bf13821ea2a2>
Fri, 4 Jul 2003 19:15:31 +0000 (19:15 +0000)
committernothere <nothere@0568b783-4c39-0410-ac80-bf13821ea2a2>
Fri, 4 Jul 2003 19:15:31 +0000 (19:15 +0000)
src/cmd2.c
src/externs.h
src/mspells1.c
src/mspells2.c
src/spells1.c
src/xtra2.c

index 5df67ac..570a2f2 100644 (file)
@@ -3851,40 +3851,6 @@ void do_cmd_fire_aux(int item, object_type *j_ptr)
                        {
                                bool fear = FALSE;
 
-                               /* Assume a default death */
-#ifdef JP
-                               cptr note_dies = "¤Ï»à¤ó¤À¡£";
-#else
-                               cptr note_dies = " dies.";
-#endif
-
-                               /* Some monsters get "destroyed" */
-                               if (!monster_living(r_ptr))
-                               {
-                                       int i;
-                                       bool explode = FALSE;
-
-                                       for (i = 0; i < 4; i++)
-                                       {
-                                               if (r_ptr->blow[i].method == RBM_EXPLODE) explode = TRUE;
-                                       }
-
-                                       /* Special note at death */
-                                       if (explode)
-#ifdef JP
-note_dies = "¤ÏÇúȯ¤·¤ÆÊ´¡¹¤Ë¤Ê¤Ã¤¿¡£";
-#else
-                                               note_dies = " explodes into tiny shreds.";
-#endif
-                                       else
-#ifdef JP
-                                               note_dies = "¤òÅݤ·¤¿¡£";
-#else
-                                               note_dies = " is destroyed.";
-#endif
-
-                               }
-
                                /* Handle unseen monster */
                                if (!visible)
                                {
@@ -3944,7 +3910,7 @@ note_dies = "
                                }
 
                                /* Hit the monster, check for death */
-                               if (mon_take_hit(c_ptr->m_idx, tdam, &fear, note_dies))
+                               if (mon_take_hit(c_ptr->m_idx, tdam, &fear, extract_note_dies(real_r_ptr(m_ptr))))
                                {
                                        /* Dead monster */
                                }
@@ -4429,42 +4395,6 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken)
                        {
                                bool fear = FALSE;
 
-                               /* Assume a default death */
-#ifdef JP
-                               cptr note_dies = "¤Ï»à¤ó¤À¡£";
-#else
-                               cptr note_dies = " dies.";
-#endif
-
-
-                               /* Some monsters get "destroyed" */
-                               if (!monster_living(r_ptr))
-                               {
-                                       int i;
-                                       bool explode = FALSE;
-
-                                       for (i = 0; i < 4; i++)
-                                       {
-                                               if (r_ptr->blow[i].method == RBM_EXPLODE) explode = TRUE;
-                                       }
-
-                                       /* Special note at death */
-                                       if (explode)
-#ifdef JP
-note_dies = "¤ÏÇúȯ¤·¤ÆÊ´¡¹¤Ë¤Ê¤Ã¤¿¡£";
-#else
-                                               note_dies = " explodes into tiny shreds.";
-#endif
-                                       else
-#ifdef JP
-                                               note_dies = "¤òÅݤ·¤¿¡£";
-#else
-                                               note_dies = " is destroyed.";
-#endif
-
-                               }
-
-
                                /* Handle unseen monster */
                                if (!visible)
                                {
@@ -4549,7 +4479,7 @@ note_dies = "
                                }
 
                                /* Hit the monster, check for death */
-                               if (mon_take_hit(c_ptr->m_idx, tdam, &fear, note_dies))
+                               if (mon_take_hit(c_ptr->m_idx, tdam, &fear, extract_note_dies(real_r_ptr(m_ptr))))
                                {
                                        /* Dead monster */
                                }
index c78b031..80e4b4d 100644 (file)
@@ -1332,6 +1332,7 @@ extern bool set_superstealth(bool set);
 /* xtra2.c */
 extern void check_experience(void);
 extern void check_quest_completion(monster_type *m_ptr);
+extern cptr extract_note_dies(monster_race *r_ptr);
 extern void monster_death(int m_idx, bool drop_item);
 extern bool mon_take_hit(int m_idx, int dam, bool *fear, cptr note);
 extern void get_screen_size(int *wid_p, int *hgt_p);
index 7fe195c..3c18aa6 100644 (file)
@@ -3618,7 +3618,7 @@ msg_format("%^s
                                                        set_tim_eyeeye(p_ptr->tim_eyeeye-5, TRUE);
                                                }
 
-                                               if (p_ptr->riding) mon_take_hit_mon(p_ptr->riding, dam, &fear, NULL, m_idx);
+                                               if (p_ptr->riding) mon_take_hit_mon(p_ptr->riding, dam, &fear, extract_note_dies(real_r_ptr(&m_list[p_ptr->riding])), m_idx);
                                        }
                                        break;
                                }
index 512984d..09686f9 100644 (file)
@@ -3333,7 +3333,7 @@ bool monst_spell_monst(int m_idx)
                                                }
                                        }
 
-                                       mon_take_hit_mon(t_idx, dam, &fear, NULL, m_idx);
+                                       mon_take_hit_mon(t_idx, dam, &fear, extract_note_dies(real_r_ptr(t_ptr)), m_idx);
                                }
                                break;
                        }
index 236ffac..3e444e9 100644 (file)
@@ -1791,11 +1791,7 @@ static bool project_m(int who, int r, int y, int x, int dam, int typ , int flg)
        cptr note = NULL;
 
        /* Assume a default death */
-#ifdef JP
-       cptr note_dies = "¤Ï»à¤ó¤À¡£";
-#else
-       cptr note_dies = " dies.";
-#endif
+       cptr note_dies = extract_note_dies(real_r_ptr(m_ptr));
 
        int ty = m_ptr->fy;
        int tx = m_ptr->fx;
@@ -1827,32 +1823,6 @@ static bool project_m(int who, int r, int y, int x, int dam, int typ , int flg)
 #endif
 
 
-       /* Some monsters get "destroyed" */
-       if (!monster_living(r_ptr))
-       {
-               int i;
-               bool explode = FALSE;
-
-               for (i = 0; i < 4; i++)
-               {
-                       if (r_ptr->blow[i].method == RBM_EXPLODE) explode = TRUE;
-               }
-
-               /* Special note at death */
-               if (explode)
-#ifdef JP
-note_dies = "¤ÏÇúȯ¤·¤ÆÊ´¡¹¤Ë¤Ê¤Ã¤¿¡£";
-#else
-                       note_dies = " explodes into tiny shreds.";
-#endif
-               else
-#ifdef JP
-note_dies = "¤òÅݤ·¤¿¡£";
-#else
-                       note_dies = " is destroyed.";
-#endif
-       }
-
        if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) disturb(1, 0);
 
        /* Analyze the damage type */
index 550bfc2..7e3c72e 100644 (file)
@@ -614,6 +614,45 @@ msg_print("
        }
 }
 
+
+/*
+ * Return monster death string
+ */
+cptr extract_note_dies(monster_race *r_ptr)
+{
+       /* Some monsters get "destroyed" */
+       if (!monster_living(r_ptr))
+       {
+               int i;
+
+               for (i = 0; i < 4; i++)
+               {
+                       if (r_ptr->blow[i].method == RBM_EXPLODE)
+                       {
+#ifdef JP
+                               return "¤ÏÇúȯ¤·¤ÆÊ´¡¹¤Ë¤Ê¤Ã¤¿¡£";
+#else
+                               return " explodes into tiny shreds.";
+#endif
+                       }
+               }
+
+#ifdef JP
+               return "¤òÅݤ·¤¿¡£";
+#else
+               return " is destroyed.";
+#endif
+       }
+
+       /* Assume a default death */
+#ifdef JP
+       return "¤Ï»à¤ó¤À¡£";
+#else
+       return " dies.";
+#endif
+}
+
+
 /*
  * Handle the "death" of a monster.
  *