OSDN Git Service

[Refactor] #40482 Separated spells-chaos.c/h from spells3.c/h
authorHourier <hourier@users.sourceforge.jp>
Sat, 27 Jun 2020 13:01:51 +0000 (22:01 +0900)
committerHourier <hourier@users.sourceforge.jp>
Sat, 27 Jun 2020 13:01:51 +0000 (22:01 +0900)
Hengband/Hengband/Hengband.vcxproj
Hengband/Hengband/Hengband.vcxproj.filters
src/Makefile.am
src/realm/realm-chaos.c
src/realm/realm-life.c
src/spell-realm/spells-chaos.c [new file with mode: 0644]
src/spell-realm/spells-chaos.h [new file with mode: 0644]
src/spell/spells3.c
src/spell/spells3.h
src/wizard/wizard-spells.c

index b5274e6..b76d3a0 100644 (file)
     <ClCompile Include="..\..\src\mind\stances-table.c" />\r
     <ClCompile Include="..\..\src\player\bad-status-setter.c" />\r
     <ClCompile Include="..\..\src\spell-kind\spells-recall.c" />\r
+    <ClCompile Include="..\..\src\spell-realm\spells-chaos.c" />\r
     <ClCompile Include="..\..\src\view\display-map.c" />\r
     <ClCompile Include="..\..\src\view\display-sub-windows.c" />\r
     <ClCompile Include="..\..\src\view\main-window-left-frame.c" />\r
     <ClInclude Include="..\..\src\player\bad-status-setter.h" />\r
     <ClInclude Include="..\..\src\player\special-defense-types.h" />\r
     <ClInclude Include="..\..\src\spell-kind\spells-recall.h" />\r
+    <ClInclude Include="..\..\src\spell-realm\spells-chaos.h" />\r
     <ClInclude Include="..\..\src\system\alloc-entries.h" />\r
     <ClInclude Include="..\..\src\term\screen-processor.h" />\r
     <ClInclude Include="..\..\src\util\bit-flags-calculator.h" />\r
index dfd6efc..e412664 100644 (file)
     <ClCompile Include="..\..\src\spell-kind\spells-recall.c">
       <Filter>spell-kind</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\src\spell-realm\spells-chaos.c">
+      <Filter>spell-realm</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\src\cmd\cmd-basic.h">
     <ClInclude Include="..\..\src\spell-kind\spells-recall.h">
       <Filter>spell-kind</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\src\spell-realm\spells-chaos.h">
+      <Filter>spell-realm</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <None Include="..\..\src\wall.bmp" />
index 6c35970..ac875b0 100644 (file)
@@ -532,6 +532,7 @@ hengband_SOURCES = \
        spell-kind/spells-specific-bolt.c spell-kind/spells-specific-bolt.h \
        spell-kind/spells-teleport.c spell-kind/spells-teleport.h \
        \
+       spell-realm/spells-chaos.c spell-realm/spells-chaos.h \
        spell-realm/spells-crusade.c spell-realm/spells-crusade.h \
        spell-realm/spells-hex.c spell-realm/spells-hex.h \
        spell-realm/spells-song.c spell-realm/spells-song.h \
index 162c36c..1ab9af6 100644 (file)
@@ -13,6 +13,7 @@
 #include "spell-kind/spells-lite.h"
 #include "spell-kind/spells-neighbor.h"
 #include "spell-kind/spells-teleport.h"
+#include "spell-realm/spells-chaos.h"
 #include "spell/spells-object.h"
 #include "spell/spells-status.h"
 #include "spell/spells-summon.h"
index af73a72..9376f41 100644 (file)
@@ -12,6 +12,7 @@
 #include "spell-kind/spells-lite.h"
 #include "spell-kind/spells-launcher.h"
 #include "spell-kind/spells-neighbor.h"
+#include "spell-kind/spells-recall.h"
 #include "spell-kind/spells-sight.h"
 #include "spell/spells-status.h"
 #include "spell/spell-types.h"
diff --git a/src/spell-realm/spells-chaos.c b/src/spell-realm/spells-chaos.c
new file mode 100644 (file)
index 0000000..2e0ede1
--- /dev/null
@@ -0,0 +1,173 @@
+#include "spell-realm/spells-chaos.h"
+#include "dungeon/quest.h"
+#include "floor/floor.h"
+#include "grid/feature.h"
+#include "grid/grid.h"
+#include "monster/monster-describer.h"
+#include "monster/monster-status.h"
+#include "player/player-damage.h"
+#include "player/player-class.h"
+#include "spell-kind/spells-floor.h"
+#include "spell-kind/spells-launcher.h"
+#include "spell/spell-types.h"
+#include "util/bit-flags-calculator.h"
+#include "view/display-messages.h"
+
+/*!
+ * @brief 虚無招来処理 /
+ * @param caster_ptr プレーヤーへの参照ポインタ
+ * @return なし
+ * @details
+ * Sorry, it becomes not (void)...
+ */
+void call_the_void(player_type *caster_ptr)
+{
+    grid_type *g_ptr;
+    bool do_call = TRUE;
+    for (int i = 0; i < 9; i++) {
+        g_ptr = &caster_ptr->current_floor_ptr->grid_array[caster_ptr->y + ddy_ddd[i]][caster_ptr->x + ddx_ddd[i]];
+
+        if (!cave_have_flag_grid(g_ptr, FF_PROJECT)) {
+            if (!g_ptr->mimic || !have_flag(f_info[g_ptr->mimic].flags, FF_PROJECT) || !permanent_wall(&f_info[g_ptr->feat])) {
+                do_call = FALSE;
+                break;
+            }
+        }
+    }
+
+    if (do_call) {
+        for (int i = 1; i < 10; i++) {
+            if (i - 5)
+                fire_ball(caster_ptr, GF_ROCKET, i, 175, 2);
+        }
+
+        for (int i = 1; i < 10; i++) {
+            if (i - 5)
+                fire_ball(caster_ptr, GF_MANA, i, 175, 3);
+        }
+
+        for (int i = 1; i < 10; i++) {
+            if (i - 5)
+                fire_ball(caster_ptr, GF_NUKE, i, 175, 4);
+        }
+
+        return;
+    }
+
+    bool is_special_fllor = caster_ptr->current_floor_ptr->inside_quest && is_fixed_quest_idx(caster_ptr->current_floor_ptr->inside_quest);
+    is_special_fllor |= !caster_ptr->current_floor_ptr->dun_level;
+    if (is_special_fllor) {
+        msg_print(_("地面が揺れた。", "The ground trembles."));
+        return;
+    }
+
+#ifdef JP
+    msg_format("あなたは%sを壁に近すぎる場所で唱えてしまった!", ((mp_ptr->spell_book == TV_LIFE_BOOK) ? "祈り" : "呪文"));
+#else
+    msg_format("You %s the %s too close to a wall!", ((mp_ptr->spell_book == TV_LIFE_BOOK) ? "recite" : "cast"),
+        ((mp_ptr->spell_book == TV_LIFE_BOOK) ? "prayer" : "spell"));
+#endif
+    msg_print(_("大きな爆発音があった!", "There is a loud explosion!"));
+
+    if (one_in_(666)) {
+        if (!vanish_dungeon(caster_ptr))
+            msg_print(_("ダンジョンは一瞬静まり返った。", "The dungeon becomes quiet for a moment."));
+        take_hit(caster_ptr, DAMAGE_NOESCAPE, 100 + randint1(150), _("自殺的な虚無招来", "a suicidal Call the Void"), -1);
+        return;
+    }
+
+    if (destroy_area(caster_ptr, caster_ptr->y, caster_ptr->x, 15 + caster_ptr->lev + randint0(11), FALSE))
+        msg_print(_("ダンジョンが崩壊した...", "The dungeon collapses..."));
+    else
+        msg_print(_("ダンジョンは大きく揺れた。", "The dungeon trembles."));
+    take_hit(caster_ptr, DAMAGE_NOESCAPE, 100 + randint1(150), _("自殺的な虚無招来", "a suicidal Call the Void"), -1);
+}
+
+/*!
+ * @brief 虚無招来によるフロア中の全壁除去処理 /
+ * Vanish all walls in this floor
+ * @param caster_ptr プレーヤーへの参照ポインタ
+ * @params caster_ptr 術者の参照ポインタ
+ * @return 実際に処理が反映された場合TRUE
+ */
+bool vanish_dungeon(player_type *caster_ptr)
+{
+    bool is_special_floor = caster_ptr->current_floor_ptr->inside_quest && is_fixed_quest_idx(caster_ptr->current_floor_ptr->inside_quest);
+    is_special_floor |= !caster_ptr->current_floor_ptr->dun_level;
+    if (is_special_floor)
+        return FALSE;
+
+    grid_type *g_ptr;
+    feature_type *f_ptr;
+    monster_type *m_ptr;
+    GAME_TEXT m_name[MAX_NLEN];
+    for (POSITION y = 1; y < caster_ptr->current_floor_ptr->height - 1; y++) {
+        for (POSITION x = 1; x < caster_ptr->current_floor_ptr->width - 1; x++) {
+            g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][x];
+
+            f_ptr = &f_info[g_ptr->feat];
+            g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
+            m_ptr = &caster_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
+            if (g_ptr->m_idx && monster_csleep_remaining(m_ptr)) {
+                (void)set_monster_csleep(caster_ptr, g_ptr->m_idx, 0);
+                if (m_ptr->ml) {
+                    monster_desc(caster_ptr, m_name, m_ptr, 0);
+                    msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name);
+                }
+            }
+
+            if (have_flag(f_ptr->flags, FF_HURT_DISI))
+                cave_alter_feat(caster_ptr, y, x, FF_HURT_DISI);
+        }
+    }
+
+    for (POSITION x = 0; x < caster_ptr->current_floor_ptr->width; x++) {
+        g_ptr = &caster_ptr->current_floor_ptr->grid_array[0][x];
+        f_ptr = &f_info[g_ptr->mimic];
+        g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
+
+        if (g_ptr->mimic && have_flag(f_ptr->flags, FF_HURT_DISI)) {
+            g_ptr->mimic = feat_state(caster_ptr, g_ptr->mimic, FF_HURT_DISI);
+            if (!have_flag(f_info[g_ptr->mimic].flags, FF_REMEMBER))
+                g_ptr->info &= ~(CAVE_MARK);
+        }
+
+        g_ptr = &caster_ptr->current_floor_ptr->grid_array[caster_ptr->current_floor_ptr->height - 1][x];
+        f_ptr = &f_info[g_ptr->mimic];
+        g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
+
+        if (g_ptr->mimic && have_flag(f_ptr->flags, FF_HURT_DISI)) {
+            g_ptr->mimic = feat_state(caster_ptr, g_ptr->mimic, FF_HURT_DISI);
+            if (!have_flag(f_info[g_ptr->mimic].flags, FF_REMEMBER))
+                g_ptr->info &= ~(CAVE_MARK);
+        }
+    }
+
+    /* Special boundary walls -- Left and right */
+    for (POSITION y = 1; y < (caster_ptr->current_floor_ptr->height - 1); y++) {
+        g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][0];
+        f_ptr = &f_info[g_ptr->mimic];
+        g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
+
+        if (g_ptr->mimic && have_flag(f_ptr->flags, FF_HURT_DISI)) {
+            g_ptr->mimic = feat_state(caster_ptr, g_ptr->mimic, FF_HURT_DISI);
+            if (!have_flag(f_info[g_ptr->mimic].flags, FF_REMEMBER))
+                g_ptr->info &= ~(CAVE_MARK);
+        }
+
+        g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][caster_ptr->current_floor_ptr->width - 1];
+        f_ptr = &f_info[g_ptr->mimic];
+        g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
+
+        if (g_ptr->mimic && have_flag(f_ptr->flags, FF_HURT_DISI)) {
+            g_ptr->mimic = feat_state(caster_ptr, g_ptr->mimic, FF_HURT_DISI);
+            if (!have_flag(f_info[g_ptr->mimic].flags, FF_REMEMBER))
+                g_ptr->info &= ~(CAVE_MARK);
+        }
+    }
+
+    caster_ptr->update |= (PU_UN_VIEW | PU_UN_LITE | PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS);
+    caster_ptr->redraw |= (PR_MAP);
+    caster_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
+    return TRUE;
+}
diff --git a/src/spell-realm/spells-chaos.h b/src/spell-realm/spells-chaos.h
new file mode 100644 (file)
index 0000000..0837df1
--- /dev/null
@@ -0,0 +1,6 @@
+#pragma once
+
+#include "system/angband.h"
+
+void call_the_void(player_type *caster_ptr);
+bool vanish_dungeon(player_type *caster_ptr);
index 8743fa5..45cc1c8 100644 (file)
@@ -213,165 +213,6 @@ bool apply_disenchant(player_type *target_ptr, BIT_FLAGS mode)
 }
 
 /*!
- * @brief 虚無招来によるフロア中の全壁除去処理 /
- * Vanish all walls in this floor
- * @param caster_ptr プレーヤーへの参照ポインタ
- * @params caster_ptr 術者の参照ポインタ
- * @return 実際に処理が反映された場合TRUE
- */
-bool vanish_dungeon(player_type *caster_ptr)
-{
-    bool is_special_floor = caster_ptr->current_floor_ptr->inside_quest && is_fixed_quest_idx(caster_ptr->current_floor_ptr->inside_quest);
-    is_special_floor |= !caster_ptr->current_floor_ptr->dun_level;
-    if (is_special_floor)
-        return FALSE;
-
-    grid_type *g_ptr;
-    feature_type *f_ptr;
-    monster_type *m_ptr;
-    GAME_TEXT m_name[MAX_NLEN];
-    for (POSITION y = 1; y < caster_ptr->current_floor_ptr->height - 1; y++) {
-        for (POSITION x = 1; x < caster_ptr->current_floor_ptr->width - 1; x++) {
-            g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][x];
-
-            f_ptr = &f_info[g_ptr->feat];
-            g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
-            m_ptr = &caster_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
-            if (g_ptr->m_idx && monster_csleep_remaining(m_ptr)) {
-                (void)set_monster_csleep(caster_ptr, g_ptr->m_idx, 0);
-                if (m_ptr->ml) {
-                    monster_desc(caster_ptr, m_name, m_ptr, 0);
-                    msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name);
-                }
-            }
-
-            if (have_flag(f_ptr->flags, FF_HURT_DISI))
-                cave_alter_feat(caster_ptr, y, x, FF_HURT_DISI);
-        }
-    }
-
-    for (POSITION x = 0; x < caster_ptr->current_floor_ptr->width; x++) {
-        g_ptr = &caster_ptr->current_floor_ptr->grid_array[0][x];
-        f_ptr = &f_info[g_ptr->mimic];
-        g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
-
-        if (g_ptr->mimic && have_flag(f_ptr->flags, FF_HURT_DISI)) {
-            g_ptr->mimic = feat_state(caster_ptr, g_ptr->mimic, FF_HURT_DISI);
-            if (!have_flag(f_info[g_ptr->mimic].flags, FF_REMEMBER))
-                g_ptr->info &= ~(CAVE_MARK);
-        }
-
-        g_ptr = &caster_ptr->current_floor_ptr->grid_array[caster_ptr->current_floor_ptr->height - 1][x];
-        f_ptr = &f_info[g_ptr->mimic];
-        g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
-
-        if (g_ptr->mimic && have_flag(f_ptr->flags, FF_HURT_DISI)) {
-            g_ptr->mimic = feat_state(caster_ptr, g_ptr->mimic, FF_HURT_DISI);
-            if (!have_flag(f_info[g_ptr->mimic].flags, FF_REMEMBER))
-                g_ptr->info &= ~(CAVE_MARK);
-        }
-    }
-
-    /* Special boundary walls -- Left and right */
-    for (POSITION y = 1; y < (caster_ptr->current_floor_ptr->height - 1); y++) {
-        g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][0];
-        f_ptr = &f_info[g_ptr->mimic];
-        g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
-
-        if (g_ptr->mimic && have_flag(f_ptr->flags, FF_HURT_DISI)) {
-            g_ptr->mimic = feat_state(caster_ptr, g_ptr->mimic, FF_HURT_DISI);
-            if (!have_flag(f_info[g_ptr->mimic].flags, FF_REMEMBER))
-                g_ptr->info &= ~(CAVE_MARK);
-        }
-
-        g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][caster_ptr->current_floor_ptr->width - 1];
-        f_ptr = &f_info[g_ptr->mimic];
-        g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
-
-        if (g_ptr->mimic && have_flag(f_ptr->flags, FF_HURT_DISI)) {
-            g_ptr->mimic = feat_state(caster_ptr, g_ptr->mimic, FF_HURT_DISI);
-            if (!have_flag(f_info[g_ptr->mimic].flags, FF_REMEMBER))
-                g_ptr->info &= ~(CAVE_MARK);
-        }
-    }
-
-    caster_ptr->update |= (PU_UN_VIEW | PU_UN_LITE | PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS);
-    caster_ptr->redraw |= (PR_MAP);
-    caster_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
-    return TRUE;
-}
-
-/*!
- * @brief 虚無招来処理 /
- * @param caster_ptr プレーヤーへの参照ポインタ
- * @return なし
- * @details
- * Sorry, it becomes not (void)...
- */
-void call_the_void(player_type *caster_ptr)
-{
-    grid_type *g_ptr;
-    bool do_call = TRUE;
-    for (int i = 0; i < 9; i++) {
-        g_ptr = &caster_ptr->current_floor_ptr->grid_array[caster_ptr->y + ddy_ddd[i]][caster_ptr->x + ddx_ddd[i]];
-
-        if (!cave_have_flag_grid(g_ptr, FF_PROJECT)) {
-            if (!g_ptr->mimic || !have_flag(f_info[g_ptr->mimic].flags, FF_PROJECT) || !permanent_wall(&f_info[g_ptr->feat])) {
-                do_call = FALSE;
-                break;
-            }
-        }
-    }
-
-    if (do_call) {
-        for (int i = 1; i < 10; i++) {
-            if (i - 5)
-                fire_ball(caster_ptr, GF_ROCKET, i, 175, 2);
-        }
-
-        for (int i = 1; i < 10; i++) {
-            if (i - 5)
-                fire_ball(caster_ptr, GF_MANA, i, 175, 3);
-        }
-
-        for (int i = 1; i < 10; i++) {
-            if (i - 5)
-                fire_ball(caster_ptr, GF_NUKE, i, 175, 4);
-        }
-
-        return;
-    }
-
-    bool is_special_fllor = caster_ptr->current_floor_ptr->inside_quest && is_fixed_quest_idx(caster_ptr->current_floor_ptr->inside_quest);
-    is_special_fllor |= !caster_ptr->current_floor_ptr->dun_level;
-    if (is_special_fllor) {
-        msg_print(_("地面が揺れた。", "The ground trembles."));
-        return;
-    }
-
-#ifdef JP
-    msg_format("あなたは%sを壁に近すぎる場所で唱えてしまった!", ((mp_ptr->spell_book == TV_LIFE_BOOK) ? "祈り" : "呪文"));
-#else
-    msg_format("You %s the %s too close to a wall!", ((mp_ptr->spell_book == TV_LIFE_BOOK) ? "recite" : "cast"),
-        ((mp_ptr->spell_book == TV_LIFE_BOOK) ? "prayer" : "spell"));
-#endif
-    msg_print(_("大きな爆発音があった!", "There is a loud explosion!"));
-
-    if (one_in_(666)) {
-        if (!vanish_dungeon(caster_ptr))
-            msg_print(_("ダンジョンは一瞬静まり返った。", "The dungeon becomes quiet for a moment."));
-        take_hit(caster_ptr, DAMAGE_NOESCAPE, 100 + randint1(150), _("自殺的な虚無招来", "a suicidal Call the Void"), -1);
-        return;
-    }
-
-    if (destroy_area(caster_ptr, caster_ptr->y, caster_ptr->x, 15 + caster_ptr->lev + randint0(11), FALSE))
-        msg_print(_("ダンジョンが崩壊した...", "The dungeon collapses..."));
-    else
-        msg_print(_("ダンジョンは大きく揺れた。", "The dungeon trembles."));
-    take_hit(caster_ptr, DAMAGE_NOESCAPE, 100 + randint1(150), _("自殺的な虚無招来", "a suicidal Call the Void"), -1);
-}
-
-/*!
  * @brief アイテム引き寄せ処理 /
  * Fetch an item (teleport it right underneath the caster)
  * @param caster_ptr プレーヤーへの参照ポインタ
index 6f78222..6c7f515 100644 (file)
@@ -7,7 +7,6 @@
 bool eat_magic(player_type *caster_ptr, int power);
 
 bool apply_disenchant(player_type* target_ptr, BIT_FLAGS mode);
-void call_the_void(player_type* caster_ptr);
 void fetch(player_type* caster_ptr, DIRECTION dir, WEIGHT wgt, bool require_los);
 void reserve_alter_reality(player_type* caster_ptr);
 void identify_pack(player_type* target_ptr);
@@ -37,4 +36,3 @@ bool booze(player_type* creature_ptr);
 bool detonation(player_type* creature_ptr);
 void blood_curse_to_enemy(player_type* caster_ptr, MONSTER_IDX m_idx);
 bool fire_crimson(player_type* shooter_ptr);
-bool vanish_dungeon(player_type *caster_ptr);
index 7115d97..77b76c9 100644 (file)
@@ -14,8 +14,8 @@
 #include "mspell/mspells3.h"
 #include "player/player-effects.h"
 #include "spell-kind/spells-teleport.h"
+#include "spell-realm/spells-chaos.h"
 #include "spell/spells-status.h"
-#include "spell/spells3.h"
 #include "view/display-messages.h"
 
 debug_spell_command debug_spell_commands_list[SPELL_MAX] = {