OSDN Git Service

ダンジョン生成中の*破壊*コードと一般の*破壊*コードを統合. 変愚蛮怒で
authornothere <nothere@0568b783-4c39-0410-ac80-bf13821ea2a2>
Sat, 7 Jun 2003 22:24:04 +0000 (22:24 +0000)
committernothere <nothere@0568b783-4c39-0410-ac80-bf13821ea2a2>
Sat, 7 Jun 2003 22:24:04 +0000 (22:24 +0000)
の*破壊*仕様に合わせたため, 以下の変更を含む.
* 生成中の*破壊*でもアーティファクトは*破壊*される. ただしまだ出現し
  ていないので, 生成中の*破壊*では固定アーティファクトは永久には失わ
  れない.
* cheat_peek時にはアーティファクトが生成中に*破壊*された旨を表示する.

src/cmd5.c
src/cmd6.c
src/externs.h
src/spells2.c
src/spells3.c
src/streams.c
src/xtra2.c

index 639f31b..4e1615f 100644 (file)
@@ -1680,7 +1680,7 @@ msg_print("
                        }
                        else if (die < 106)
                        {
-                               destroy_area(py, px, 13+randint0(5));
+                               (void)destroy_area(py, px, 13 + randint0(5), FALSE);
                        }
                        else if (die < 108)
                        {
@@ -1728,7 +1728,7 @@ msg_print("
                (void)fire_beam(GF_AWAY_ALL, dir, plev);
                break;
        case 14: /* Word of Destruction */
-               destroy_area(py, px, 13+randint0(5));
+               (void)destroy_area(py, px, 13 + randint0(5), FALSE);
                break;
        case 15: /* Invoke Logrus */
                if (!get_aim_dir(&dir)) return FALSE;
@@ -2140,7 +2140,7 @@ msg_print("
                        }
                        else if (die < 106)
                        {
-                               destroy_area(py, px, 13+randint0(5));
+                               (void)destroy_area(py, px, 13 + randint0(5), FALSE);
                        }
                        else if (die < 108)
                        {
@@ -4073,7 +4073,7 @@ msg_print("
                }
                break;
        case 27: /* Word of Destruction */
-               destroy_area(py, px, 13+randint0(5));
+               (void)destroy_area(py, px, 13 + randint0(5), FALSE);
                break;
        case 28: /* Eye for an Eye */
                set_tim_eyeeye(randint1(10)+10, FALSE);
index b9b88e0..b74cfab 100644 (file)
@@ -1945,7 +1945,7 @@ static void do_cmd_read_scroll_aux(int item, bool known)
 
                case SV_SCROLL_STAR_DESTRUCTION:
                {
-                       if (destroy_area(py, px, 13+randint0(5)))
+                       if (destroy_area(py, px, 13 + randint0(5), FALSE))
                                ident = TRUE;
                        else
 #ifdef JP
@@ -2618,7 +2618,7 @@ msg_print("
 
                case SV_STAFF_DESTRUCTION:
                {
-                       if (destroy_area(py, px, 13+randint0(5)))
+                       if (destroy_area(py, px, 13 + randint0(5), FALSE))
                                ident = TRUE;
 
                        break;
index a4ef7e2..d17f03d 100644 (file)
@@ -1006,7 +1006,7 @@ extern bool dispel_living(int dam);
 extern bool dispel_demons(int dam);
 extern bool crusade(void);
 extern bool turn_undead(void);
-extern bool destroy_area(int y1, int x1, int r);
+extern bool destroy_area(int y1, int x1, int r, bool in_generate);
 extern bool earthquake(int cy, int cx, int r);
 extern void lite_room(int y1, int x1);
 extern void unlite_room(int y1, int x1);
index a25cc52..6521222 100644 (file)
@@ -11,6 +11,7 @@
 /* Purpose: Spell code (part 2) */
 
 #include "angband.h"
+#include "grid.h"
 
 
 /*
@@ -5323,13 +5324,12 @@ msg_print("
  * Later we may use one function for both "destruction" and
  * "earthquake" by using the "full" to select "destruction".
  */
-bool destroy_area(int y1, int x1, int r)
+bool destroy_area(int y1, int x1, int r, bool in_generate)
 {
        int       y, x, k, t;
        cave_type *c_ptr;
        bool      flag = FALSE;
 
-
        /* Prevent destruction of quest levels and town */
        if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !dun_level)
        {
@@ -5341,9 +5341,6 @@ bool destroy_area(int y1, int x1, int r)
        {
                for (x = (x1 - r); x <= (x1 + r); x++)
                {
-                       monster_type *m_ptr;
-                       monster_race *r_ptr;
-
                        /* Skip illegal grids */
                        if (!in_bounds(y, x)) continue;
 
@@ -5355,53 +5352,67 @@ bool destroy_area(int y1, int x1, int r)
 
                        /* Access the grid */
                        c_ptr = &cave[y][x];
-                       m_ptr = &m_list[c_ptr->m_idx];
-                       r_ptr = &r_info[m_ptr->r_idx];
 
                        /* Lose room and vault */
-                       c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY | CAVE_UNSAFE | CAVE_OBJECT);
+                       c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
 
                        /* Lose light and knowledge */
                        c_ptr->info &= ~(CAVE_MARK | CAVE_GLOW);
 
-                       /* Hack -- Notice player affect */
-                       if ((x == px) && (y == py))
+                       if (!in_generate) /* Normal */
                        {
-                               /* Hurt the player later */
-                               flag = TRUE;
+                               /* Lose unsafety and runes/mirrors */
+                               c_ptr->info &= ~(CAVE_UNSAFE | CAVE_OBJECT);
+
+                               /* Hack -- Notice player affect */
+                               if ((x == px) && (y == py))
+                               {
+                                       /* Hurt the player later */
+                                       flag = TRUE;
 
-                               /* Do not hurt this grid */
-                               continue;
+                                       /* Do not hurt this grid */
+                                       continue;
+                               }
                        }
 
                        /* Hack -- Skip the epicenter */
                        if ((y == y1) && (x == x1)) continue;
 
-                       if ((r_ptr->flags1 & RF1_QUESTOR))
+                       if (c_ptr->m_idx)
                        {
-                               /* Heal the monster */
-                               m_list[c_ptr->m_idx].hp = m_list[c_ptr->m_idx].maxhp;
+                               monster_type *m_ptr = &m_list[c_ptr->m_idx];
+                               monster_race *r_ptr = &r_info[m_ptr->r_idx];
 
-                               /* Try to teleport away quest monsters */
-                               if (!teleport_away(c_ptr->m_idx, (r * 2) + 1, TRUE)) continue;
-                       }
-                       else
-                       {
-                               if (c_ptr->m_idx)
+                               if (in_generate) /* In generation */
+                               {
+                                       /* Delete the monster (if any) */
+                                       delete_monster(y, x);
+                               }
+                               else if (r_ptr->flags1 & RF1_QUESTOR)
+                               {
+                                       /* Heal the monster */
+                                       m_ptr->hp = m_ptr->maxhp;
+
+                                       /* Try to teleport away quest monsters */
+                                       if (!teleport_away(c_ptr->m_idx, (r * 2) + 1, TRUE)) continue;
+                               }
+                               else
                                {
-                                       if (record_named_pet && is_pet(&m_list[c_ptr->m_idx]) && m_list[c_ptr->m_idx].nickname)
+                                       if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
                                        {
                                                char m_name[80];
 
-                                               monster_desc(m_name, &m_list[c_ptr->m_idx], 0x08);
+                                               monster_desc(m_name, m_ptr, 0x08);
                                                do_cmd_write_nikki(NIKKI_NAMED_PET, 6, m_name);
                                        }
+
+                                       /* Delete the monster (if any) */
+                                       delete_monster(y, x);
                                }
-                               /* Delete the monster (if any) */
-                               delete_monster(y, x);
                        }
 
-                       if (preserve_mode)
+                       /* During generation, destroyed artifacts are "preserved" */
+                       if (preserve_mode || in_generate)
                        {
                                s16b this_o_idx, next_o_idx = 0;
 
@@ -5417,88 +5428,133 @@ bool destroy_area(int y1, int x1, int r)
                                        next_o_idx = o_ptr->next_o_idx;
 
                                        /* Hack -- Preserve unknown artifacts */
-                                       if (artifact_p(o_ptr) && !object_known_p(o_ptr))
+                                       if (artifact_p(o_ptr) && (!object_known_p(o_ptr) || in_generate))
                                        {
                                                /* Mega-Hack -- Preserve the artifact */
                                                a_info[o_ptr->name1].cur_num = 0;
+
+                                               if (in_generate && cheat_peek)
+                                               {
+                                                       char o_name[MAX_NLEN];
+                                                       object_desc_store(o_name, o_ptr, FALSE, 0);
+#ifdef JP
+                                                       msg_format("ÅÁÀâ¤Î¥¢¥¤¥Æ¥à (%s) ¤ÏÀ¸À®Ãæ¤Ë*Ç˲õ*¤µ¤ì¤¿¡£", o_name);
+#else
+                                                       msg_format("Artifact (%s) was *destroyed* during generation.", o_name);
+#endif
+                                               }
+                                       }
+                                       else if (in_generate && cheat_peek && o_ptr->art_name)
+                                       {
+#ifdef JP
+                                               msg_print("¥é¥ó¥À¥à¡¦¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È¤Î1¤Ä¤ÏÀ¸À®Ãæ¤Ë*Ç˲õ*¤µ¤ì¤¿¡£");
+#else
+                                               msg_print("One of the random artifacts was *destroyed* during generation.");
+#endif
                                        }
                                }
                        }
+
+                       /* Delete objects */
                        delete_object(y, x);
 
-                       /* Destroy "valid" grids */
+                       /* Destroy "non-permanent" grids */
                        if (!cave_perma_bold(y, x))
                        {
                                /* Wall (or floor) type */
                                t = randint0(200);
 
-                               /* Granite */
-                               if (t < 20)
-                               {
-                                       /* Create granite wall */
-                                       cave_set_feat(y, x, FEAT_WALL_EXTRA);
-                               }
-
-                               /* Quartz */
-                               else if (t < 70)
+                               if (!in_generate) /* Normal */
                                {
-                                       /* Create quartz vein */
-                                       cave_set_feat(y, x, FEAT_QUARTZ);
+                                       if (t < 20)
+                                       {
+                                               /* Create granite wall */
+                                               cave_set_feat(y, x, FEAT_WALL_EXTRA);
+                                       }
+                                       else if (t < 70)
+                                       {
+                                               /* Create quartz vein */
+                                               cave_set_feat(y, x, FEAT_QUARTZ);
+                                       }
+                                       else if (t < 100)
+                                       {
+                                               /* Create magma vein */
+                                               cave_set_feat(y, x, FEAT_MAGMA);
+                                       }
+                                       else
+                                       {
+                                               /* Create floor */
+                                               cave_set_feat(y, x, floor_type[randint0(100)]);
+                                       }
                                }
-
-                               /* Magma */
-                               else if (t < 100)
+                               else /* In generation */
                                {
-                                       /* Create magma vein */
-                                       cave_set_feat(y, x, FEAT_MAGMA);
-                               }
+                                       if (t < 20)
+                                       {
+                                               /* Create granite wall */
+                                               place_extra_grid(c_ptr);
+                                       }
+                                       else if (t < 70)
+                                       {
+                                               /* Create quartz vein */
+                                               c_ptr->feat = FEAT_QUARTZ;
+                                       }
+                                       else if (t < 100)
+                                       {
+                                               /* Create magma vein */
+                                               c_ptr->feat = FEAT_MAGMA;
+                                       }
+                                       else
+                                       {
+                                               /* Create floor */
+                                               place_floor_grid(c_ptr);
+                                       }
 
-                               /* Floor */
-                               else
-                               {
-                                       /* Create floor */
-                                       cave_set_feat(y, x, floor_type[randint0(100)]);
+                                       /* Clear garbage of hidden trap or door */
+                                       c_ptr->mimic = 0;
                                }
                        }
                }
        }
 
 
-       /* Hack -- Affect player */
-       if (flag)
+       if (!in_generate)
        {
-               /* Message */
+               /* Hack -- Affect player */
+               if (flag)
+               {
+                       /* Message */
 #ifdef JP
-msg_print("dz¤¨¤ë¤è¤¦¤ÊÁ®¸÷¤¬È¯À¸¤·¤¿¡ª");
+                       msg_print("dz¤¨¤ë¤è¤¦¤ÊÁ®¸÷¤¬È¯À¸¤·¤¿¡ª");
 #else
-               msg_print("There is a searing blast of light!");
+                       msg_print("There is a searing blast of light!");
 #endif
 
-
-               /* Blind the player */
-               if (!p_ptr->resist_blind && !p_ptr->resist_lite)
-               {
-                       /* Become blind */
-                       (void)set_blind(p_ptr->blind + 10 + randint1(10));
+                       /* Blind the player */
+                       if (!p_ptr->resist_blind && !p_ptr->resist_lite)
+                       {
+                               /* Become blind */
+                               (void)set_blind(p_ptr->blind + 10 + randint1(10));
+                       }
                }
-       }
 
-       forget_flow();
+               forget_flow();
 
-       /* Mega-Hack -- Forget the view and lite */
-       p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
+               /* Mega-Hack -- Forget the view and lite */
+               p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
 
-       /* Update stuff */
-       p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE);
+               /* Update stuff */
+               p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE);
 
-       /* Update the monsters */
-       p_ptr->update |= (PU_MONSTERS);
+               /* Update the monsters */
+               p_ptr->update |= (PU_MONSTERS);
 
-       /* Redraw map */
-       p_ptr->redraw |= (PR_MAP);
+               /* Redraw map */
+               p_ptr->redraw |= (PR_MAP);
 
-       /* Window stuff */
-       p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
+               /* Window stuff */
+               p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
+       }
 
        /* Success */
        return (TRUE);
index ed3cf5c..c2adf3f 100644 (file)
@@ -1479,7 +1479,7 @@ void call_the_(void)
 #endif
 
 
-               if (destroy_area(py, px, 15 + p_ptr->lev + randint0(11)))
+               if (destroy_area(py, px, 15 + p_ptr->lev + randint0(11), FALSE))
 #ifdef JP
                        msg_print("¥À¥ó¥¸¥ç¥ó¤¬Êø²õ¤·¤¿...");
 #else
index 1a36f67..f00ab01 100644 (file)
@@ -358,18 +358,15 @@ void place_trees(int x, int y)
  */
 void destroy_level(void)
 {
-       int y1, x1, y, x, k, t, n;
-
-       cave_type *c_ptr;
+       int y1, x1, n;
 
        /* Note destroyed levels */
 #ifdef JP
-if (cheat_room) msg_print("Ç˲õ¤µ¤ì¤¿³¬");
+       if (cheat_room) msg_print("Ç˲õ¤µ¤ì¤¿³¬");
 #else
        if (cheat_room) msg_print("Destroyed Level");
 #endif
 
-
        /* Drop a few epi-centers (usually about two) */
        for (n = 0; n < randint1(5); n++)
        {
@@ -377,73 +374,6 @@ if (cheat_room) msg_print("
                x1 = rand_range(5, cur_wid - 1 - 5);
                y1 = rand_range(5, cur_hgt - 1 - 5);
 
-               /* Big area of affect */
-               for (y = (y1 - 15); y <= (y1 + 15); y++)
-               {
-                       for (x = (x1 - 15); x <= (x1 + 15); x++)
-                       {
-                               /* Skip illegal grids */
-                               if (!in_bounds(y, x)) continue;
-
-                               /* Extract the distance */
-                               k = distance(y1, x1, y, x);
-
-                               /* Stay in the circle of death */
-                               if (k >= 16) continue;
-
-                               /* Delete the monster (if any) */
-                               delete_monster(y, x);
-
-                               /* Access the grid */
-                               c_ptr = &cave[y][x];
-
-                               /* Destroy valid grids */
-                               if (cave_valid_grid(c_ptr))
-                               {
-                                       /* Delete objects */
-                                       delete_object(y, x);
-
-                                       /* Wall (or floor) type */
-                                       t = randint0(200);
-
-                                       /* Granite */
-                                       if (t < 20)
-                                       {
-                                               /* Create granite wall */
-                                               place_extra_grid(c_ptr);
-                                       }
-
-                                       /* Quartz */
-                                       else if (t < 70)
-                                       {
-                                               /* Create quartz vein */
-                                               c_ptr->feat = FEAT_QUARTZ;
-                                       }
-
-                                       /* Magma */
-                                       else if (t < 100)
-                                       {
-                                               /* Create magma vein */
-                                               c_ptr->feat = FEAT_MAGMA;
-                                       }
-
-                                       /* Floor */
-                                       else
-                                       {
-                                               /* Create floor */
-                                               place_floor_grid(c_ptr);
-                                       }
-
-                                       /* Clear garbage of hidden trap or door */
-                                       c_ptr->mimic = 0;
-
-                                       /* No longer part of a room or vault */
-                                       c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
-
-                                       /* No longer illuminated or known */
-                                       c_ptr->info &= ~(CAVE_MARK | CAVE_GLOW);
-                               }
-                       }
-               }
+               (void)destroy_area(y1, x1, 15, TRUE);
        }
 }
index ca28848..3d61649 100644 (file)
@@ -5372,7 +5372,7 @@ msg_print("
                        msg_print("'Death and destruction! This pleaseth me!'");
 #endif
 
-                       destroy_area(py, px, 25);
+                       (void)destroy_area(py, px, 25, FALSE);
 #ifdef JP
                        reward = "¥À¥ó¥¸¥ç¥ó¤¬*Ç˲õ*¤µ¤ì¤¿¡£";
 #else