OSDN Git Service

[Refactor] #40414 Unified spells-mirror.c/h into racial-mirror-master.c/h
authorHourier <hourier@users.sourceforge.jp>
Thu, 4 Jun 2020 10:06:11 +0000 (19:06 +0900)
committerHourier <hourier@users.sourceforge.jp>
Thu, 4 Jun 2020 10:06:11 +0000 (19:06 +0900)
Hengband/Hengband/Hengband.vcxproj
Hengband/Hengband/Hengband.vcxproj.filters
src/Makefile.am
src/mind/mind.c
src/mind/racial-mirror-master.c
src/mind/racial-mirror-master.h
src/spell/spells-mirror.c [deleted file]
src/spell/spells-mirror.h [deleted file]

index f528fe6..c0c1955 100644 (file)
     <ClCompile Include="..\..\src\spell\spells-describer.c" />\r
     <ClCompile Include="..\..\src\spell\spells-detection.c" />\r
     <ClCompile Include="..\..\src\spell\spells-hex.c" />\r
-    <ClCompile Include="..\..\src\spell\spells-mirror.c" />\r
     <ClCompile Include="..\..\src\system\system-variables.c" />\r
     <ClCompile Include="..\..\src\core\show-file.c" />\r
     <ClCompile Include="..\..\src\monster\creature.c" />\r
     <ClInclude Include="..\..\src\realm\realm-song-numbers.h" />\r
     <ClInclude Include="..\..\src\spell\spells-describer.h" />\r
     <ClInclude Include="..\..\src\spell\spells-hex.h" />\r
-    <ClInclude Include="..\..\src\spell\spells-mirror.h" />\r
     <ClInclude Include="..\..\src\sv-definition\sv-amulet-types.h" />\r
     <ClInclude Include="..\..\src\sv-definition\sv-armor-types.h" />\r
     <ClInclude Include="..\..\src\sv-definition\sv-bow-types.h" />\r
index d1456c7..4c230d6 100644 (file)
     <ClCompile Include="..\..\src\object\object-stack.c">
       <Filter>object</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\src\spell\spells-mirror.c">
-      <Filter>spell</Filter>
-    </ClCompile>
     <ClCompile Include="..\..\src\spell\spells-describer.c">
       <Filter>spell</Filter>
     </ClCompile>
     <ClInclude Include="..\..\src\object\object-stack.h">
       <Filter>object</Filter>
     </ClInclude>
-    <ClInclude Include="..\..\src\spell\spells-mirror.h">
-      <Filter>spell</Filter>
-    </ClInclude>
     <ClInclude Include="..\..\src\spell\spells-describer.h">
       <Filter>spell</Filter>
     </ClInclude>
index a8a2780..1ea35f3 100644 (file)
@@ -394,7 +394,6 @@ hengband_SOURCES = \
        spell/spells-diceroll.c spell/spells-diceroll.h \
        spell/spells-floor.c spell/spells-floor.h \
        spell/spells-hex.c spell/spells-hex.h \
-       spell/spells-mirror.c spell/spells-mirror.h \
        spell/spells-object.c spell/spells-object.h \
        spell/spells-status.c spell/spells-status.h \
        spell/spells-summon.c spell/spells-summon.h \
index 60cd794..08f6f69 100644 (file)
@@ -27,6 +27,7 @@
 #include "main/sound-definitions-table.h"
 #include "mind/racial-force-trainer.h"
 #include "mind/racial-ninja.h"
+#include "mind/racial-mirror-master.h"
 #include "monster/monster-status.h"
 #include "player/avatar.h"
 #include "player/player-class.h"
@@ -38,7 +39,6 @@
 #include "spell/process-effect.h"
 #include "spell/spells-detection.h"
 #include "spell/spells-floor.h"
-#include "spell/spells-mirror.h"
 #include "spell/spells-status.h"
 #include "spell/spells-summon.h"
 #include "spell/spells-type.h"
index d9293b7..0a13ecb 100644 (file)
@@ -1,18 +1,20 @@
-#include "system/angband.h"
+#include "mind/racial-mirror-master.h"
 #include "cmd-action/cmd-pet.h"
 #include "effect/effect-characteristics.h"
-#include "mind/racial-mirror-master.h"
+#include "effect/effect-feature.h"
+#include "effect/effect-item.h"
+#include "effect/effect-monster.h"
+#include "effect/spells-effect-util.h"
 #include "spell/process-effect.h"
 #include "spell/spells-type.h"
+#include "term/gameterm.h"
+#include "view/display-main-window.h"
 #include "world/world.h"
 
 /*
  * @brief Multishadow effects is determined by turn
  */
-bool check_multishadow(player_type *creature_ptr)
-{
-    return (creature_ptr->multishadow != 0) && ((current_world_ptr->game_turn & 1) != 0);
-}
+bool check_multishadow(player_type *creature_ptr) { return (creature_ptr->multishadow != 0) && ((current_world_ptr->game_turn & 1) != 0); }
 
 /*!
  * 静水
@@ -65,3 +67,150 @@ void remove_all_mirrors(player_type *caster_ptr, bool explode)
         }
     }
 }
+
+/*!
+ * @brief 鏡魔法「封魔結界」の効果処理
+ * @param dam ダメージ量
+ * @return 効果があったらTRUEを返す
+ */
+bool binding_field(player_type *caster_ptr, HIT_POINT dam)
+{
+    POSITION mirror_x[10], mirror_y[10]; /* 鏡はもっと少ない */
+    int mirror_num = 0; /* 鏡の数 */
+    int msec = delay_factor * delay_factor * delay_factor;
+
+    /* 三角形の頂点 */
+    POSITION point_x[3];
+    POSITION point_y[3];
+
+    /* Default target of monsterspell is player */
+    monster_target_y = caster_ptr->y;
+    monster_target_x = caster_ptr->x;
+
+    for (POSITION x = 0; x < caster_ptr->current_floor_ptr->width; x++) {
+        for (POSITION y = 0; y < caster_ptr->current_floor_ptr->height; y++) {
+            if (is_mirror_grid(&caster_ptr->current_floor_ptr->grid_array[y][x]) && distance(caster_ptr->y, caster_ptr->x, y, x) <= MAX_RANGE
+                && distance(caster_ptr->y, caster_ptr->x, y, x) != 0 && player_has_los_bold(caster_ptr, y, x)
+                && projectable(caster_ptr, caster_ptr->y, caster_ptr->x, y, x)) {
+                mirror_y[mirror_num] = y;
+                mirror_x[mirror_num] = x;
+                mirror_num++;
+            }
+        }
+    }
+
+    if (mirror_num < 2)
+        return FALSE;
+
+    point_x[0] = randint0(mirror_num);
+    do {
+        point_x[1] = randint0(mirror_num);
+    } while (point_x[0] == point_x[1]);
+
+    point_y[0] = mirror_y[point_x[0]];
+    point_x[0] = mirror_x[point_x[0]];
+    point_y[1] = mirror_y[point_x[1]];
+    point_x[1] = mirror_x[point_x[1]];
+    point_y[2] = caster_ptr->y;
+    point_x[2] = caster_ptr->x;
+
+    POSITION x = point_x[0] + point_x[1] + point_x[2];
+    POSITION y = point_y[0] + point_y[1] + point_y[2];
+
+    POSITION centersign = (point_x[0] * 3 - x) * (point_y[1] * 3 - y) - (point_y[0] * 3 - y) * (point_x[1] * 3 - x);
+    if (centersign == 0)
+        return FALSE;
+
+    POSITION x1 = point_x[0] < point_x[1] ? point_x[0] : point_x[1];
+    x1 = x1 < point_x[2] ? x1 : point_x[2];
+    POSITION y1 = point_y[0] < point_y[1] ? point_y[0] : point_y[1];
+    y1 = y1 < point_y[2] ? y1 : point_y[2];
+
+    POSITION x2 = point_x[0] > point_x[1] ? point_x[0] : point_x[1];
+    x2 = x2 > point_x[2] ? x2 : point_x[2];
+    POSITION y2 = point_y[0] > point_y[1] ? point_y[0] : point_y[1];
+    y2 = y2 > point_y[2] ? y2 : point_y[2];
+
+    for (y = y1; y <= y2; y++) {
+        for (x = x1; x <= x2; x++) {
+            if (centersign * ((point_x[0] - x) * (point_y[1] - y) - (point_y[0] - y) * (point_x[1] - x)) >= 0
+                && centersign * ((point_x[1] - x) * (point_y[2] - y) - (point_y[1] - y) * (point_x[2] - x)) >= 0
+                && centersign * ((point_x[2] - x) * (point_y[0] - y) - (point_y[2] - y) * (point_x[0] - x)) >= 0) {
+                if (player_has_los_bold(caster_ptr, y, x) && projectable(caster_ptr, caster_ptr->y, caster_ptr->x, y, x)) {
+                    if (!(caster_ptr->blind) && panel_contains(y, x)) {
+                        u16b p = bolt_pict(y, x, y, x, GF_MANA);
+                        print_rel(caster_ptr, PICT_C(p), PICT_A(p), y, x);
+                        move_cursor_relative(y, x);
+                        Term_fresh();
+                        Term_xtra(TERM_XTRA_DELAY, msec);
+                    }
+                }
+            }
+        }
+    }
+
+    for (y = y1; y <= y2; y++) {
+        for (x = x1; x <= x2; x++) {
+            if (centersign * ((point_x[0] - x) * (point_y[1] - y) - (point_y[0] - y) * (point_x[1] - x)) >= 0
+                && centersign * ((point_x[1] - x) * (point_y[2] - y) - (point_y[1] - y) * (point_x[2] - x)) >= 0
+                && centersign * ((point_x[2] - x) * (point_y[0] - y) - (point_y[2] - y) * (point_x[0] - x)) >= 0) {
+                if (player_has_los_bold(caster_ptr, y, x) && projectable(caster_ptr, caster_ptr->y, caster_ptr->x, y, x)) {
+                    (void)affect_feature(caster_ptr, 0, 0, y, x, dam, GF_MANA);
+                }
+            }
+        }
+    }
+
+    for (y = y1; y <= y2; y++) {
+        for (x = x1; x <= x2; x++) {
+            if (centersign * ((point_x[0] - x) * (point_y[1] - y) - (point_y[0] - y) * (point_x[1] - x)) >= 0
+                && centersign * ((point_x[1] - x) * (point_y[2] - y) - (point_y[1] - y) * (point_x[2] - x)) >= 0
+                && centersign * ((point_x[2] - x) * (point_y[0] - y) - (point_y[2] - y) * (point_x[0] - x)) >= 0) {
+                if (player_has_los_bold(caster_ptr, y, x) && projectable(caster_ptr, caster_ptr->y, caster_ptr->x, y, x)) {
+                    (void)affect_item(caster_ptr, 0, 0, y, x, dam, GF_MANA);
+                }
+            }
+        }
+    }
+
+    for (y = y1; y <= y2; y++) {
+        for (x = x1; x <= x2; x++) {
+            if (centersign * ((point_x[0] - x) * (point_y[1] - y) - (point_y[0] - y) * (point_x[1] - x)) >= 0
+                && centersign * ((point_x[1] - x) * (point_y[2] - y) - (point_y[1] - y) * (point_x[2] - x)) >= 0
+                && centersign * ((point_x[2] - x) * (point_y[0] - y) - (point_y[2] - y) * (point_x[0] - x)) >= 0) {
+                if (player_has_los_bold(caster_ptr, y, x) && projectable(caster_ptr, caster_ptr->y, caster_ptr->x, y, x)) {
+                    (void)affect_monster(caster_ptr, 0, 0, y, x, dam, GF_MANA, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE);
+                }
+            }
+        }
+    }
+
+    if (one_in_(7)) {
+        msg_print(_("鏡が結界に耐えきれず、壊れてしまった。", "The field broke a mirror"));
+        remove_mirror(caster_ptr, point_y[0], point_x[0]);
+    }
+
+    return TRUE;
+}
+
+/*!
+ * @brief 鏡魔法「鏡の封印」の効果処理
+ * @param dam ダメージ量
+ * @return 効果があったらTRUEを返す
+ */
+void seal_of_mirror(player_type *caster_ptr, HIT_POINT dam)
+{
+    for (POSITION x = 0; x < caster_ptr->current_floor_ptr->width; x++) {
+        for (POSITION y = 0; y < caster_ptr->current_floor_ptr->height; y++) {
+            if (!is_mirror_grid(&caster_ptr->current_floor_ptr->grid_array[y][x]))
+                continue;
+
+            if (!affect_monster(caster_ptr, 0, 0, y, x, dam, GF_GENOCIDE, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE))
+                continue;
+
+            if (!caster_ptr->current_floor_ptr->grid_array[y][x].m_idx) {
+                remove_mirror(caster_ptr, y, x);
+            }
+        }
+    }
+}
index 057b309..28f559a 100644 (file)
@@ -1,5 +1,9 @@
 #pragma once
 
+#include "system/angband.h"
+
 bool check_multishadow(player_type *creature_ptr);
 bool mirror_concentration(player_type *creature_ptr);
 void remove_all_mirrors(player_type *caster_ptr, bool explode);
+bool binding_field(player_type *caster_ptr, HIT_POINT dam);
+void seal_of_mirror(player_type *caster_ptr, HIT_POINT dam);
diff --git a/src/spell/spells-mirror.c b/src/spell/spells-mirror.c
deleted file mode 100644 (file)
index 743dc3c..0000000
+++ /dev/null
@@ -1,158 +0,0 @@
-#include "spell/spells-mirror.h"
-#include "effect/effect-feature.h"
-#include "effect/effect-item.h"
-#include "effect/effect-monster.h"
-#include "effect/effect-characteristics.h"
-#include "effect/spells-effect-util.h"
-#include "effect/effect-monster.h"
-#include "floor/floor.h"
-#include "spell/spells-type.h"
-#include "term/gameterm.h"
-#include "view/display-main-window.h"
-
-/*!
- * @brief 鏡魔法「封魔結界」の効果処理
- * @param dam ダメージ量
- * @return 効果があったらTRUEを返す
- */
-bool binding_field(player_type *caster_ptr, HIT_POINT dam)
-{
-    POSITION mirror_x[10], mirror_y[10]; /* 鏡はもっと少ない */
-    int mirror_num = 0; /* 鏡の数 */
-    int msec = delay_factor * delay_factor * delay_factor;
-
-    /* 三角形の頂点 */
-    POSITION point_x[3];
-    POSITION point_y[3];
-
-    /* Default target of monsterspell is player */
-    monster_target_y = caster_ptr->y;
-    monster_target_x = caster_ptr->x;
-
-    for (POSITION x = 0; x < caster_ptr->current_floor_ptr->width; x++) {
-        for (POSITION y = 0; y < caster_ptr->current_floor_ptr->height; y++) {
-            if (is_mirror_grid(&caster_ptr->current_floor_ptr->grid_array[y][x]) && distance(caster_ptr->y, caster_ptr->x, y, x) <= MAX_RANGE
-                && distance(caster_ptr->y, caster_ptr->x, y, x) != 0 && player_has_los_bold(caster_ptr, y, x)
-                && projectable(caster_ptr, caster_ptr->y, caster_ptr->x, y, x)) {
-                mirror_y[mirror_num] = y;
-                mirror_x[mirror_num] = x;
-                mirror_num++;
-            }
-        }
-    }
-
-    if (mirror_num < 2)
-        return FALSE;
-
-    point_x[0] = randint0(mirror_num);
-    do {
-        point_x[1] = randint0(mirror_num);
-    } while (point_x[0] == point_x[1]);
-
-    point_y[0] = mirror_y[point_x[0]];
-    point_x[0] = mirror_x[point_x[0]];
-    point_y[1] = mirror_y[point_x[1]];
-    point_x[1] = mirror_x[point_x[1]];
-    point_y[2] = caster_ptr->y;
-    point_x[2] = caster_ptr->x;
-
-    POSITION x = point_x[0] + point_x[1] + point_x[2];
-    POSITION y = point_y[0] + point_y[1] + point_y[2];
-
-    POSITION centersign = (point_x[0] * 3 - x) * (point_y[1] * 3 - y) - (point_y[0] * 3 - y) * (point_x[1] * 3 - x);
-    if (centersign == 0)
-        return FALSE;
-
-    POSITION x1 = point_x[0] < point_x[1] ? point_x[0] : point_x[1];
-    x1 = x1 < point_x[2] ? x1 : point_x[2];
-    POSITION y1 = point_y[0] < point_y[1] ? point_y[0] : point_y[1];
-    y1 = y1 < point_y[2] ? y1 : point_y[2];
-
-    POSITION x2 = point_x[0] > point_x[1] ? point_x[0] : point_x[1];
-    x2 = x2 > point_x[2] ? x2 : point_x[2];
-    POSITION y2 = point_y[0] > point_y[1] ? point_y[0] : point_y[1];
-    y2 = y2 > point_y[2] ? y2 : point_y[2];
-
-    for (y = y1; y <= y2; y++) {
-        for (x = x1; x <= x2; x++) {
-            if (centersign * ((point_x[0] - x) * (point_y[1] - y) - (point_y[0] - y) * (point_x[1] - x)) >= 0
-                && centersign * ((point_x[1] - x) * (point_y[2] - y) - (point_y[1] - y) * (point_x[2] - x)) >= 0
-                && centersign * ((point_x[2] - x) * (point_y[0] - y) - (point_y[2] - y) * (point_x[0] - x)) >= 0) {
-                if (player_has_los_bold(caster_ptr, y, x) && projectable(caster_ptr, caster_ptr->y, caster_ptr->x, y, x)) {
-                    if (!(caster_ptr->blind) && panel_contains(y, x)) {
-                        u16b p = bolt_pict(y, x, y, x, GF_MANA);
-                        print_rel(caster_ptr, PICT_C(p), PICT_A(p), y, x);
-                        move_cursor_relative(y, x);
-                        Term_fresh();
-                        Term_xtra(TERM_XTRA_DELAY, msec);
-                    }
-                }
-            }
-        }
-    }
-
-    for (y = y1; y <= y2; y++) {
-        for (x = x1; x <= x2; x++) {
-            if (centersign * ((point_x[0] - x) * (point_y[1] - y) - (point_y[0] - y) * (point_x[1] - x)) >= 0
-                && centersign * ((point_x[1] - x) * (point_y[2] - y) - (point_y[1] - y) * (point_x[2] - x)) >= 0
-                && centersign * ((point_x[2] - x) * (point_y[0] - y) - (point_y[2] - y) * (point_x[0] - x)) >= 0) {
-                if (player_has_los_bold(caster_ptr, y, x) && projectable(caster_ptr, caster_ptr->y, caster_ptr->x, y, x)) {
-                    (void)affect_feature(caster_ptr, 0, 0, y, x, dam, GF_MANA);
-                }
-            }
-        }
-    }
-
-    for (y = y1; y <= y2; y++) {
-        for (x = x1; x <= x2; x++) {
-            if (centersign * ((point_x[0] - x) * (point_y[1] - y) - (point_y[0] - y) * (point_x[1] - x)) >= 0
-                && centersign * ((point_x[1] - x) * (point_y[2] - y) - (point_y[1] - y) * (point_x[2] - x)) >= 0
-                && centersign * ((point_x[2] - x) * (point_y[0] - y) - (point_y[2] - y) * (point_x[0] - x)) >= 0) {
-                if (player_has_los_bold(caster_ptr, y, x) && projectable(caster_ptr, caster_ptr->y, caster_ptr->x, y, x)) {
-                    (void)affect_item(caster_ptr, 0, 0, y, x, dam, GF_MANA);
-                }
-            }
-        }
-    }
-
-    for (y = y1; y <= y2; y++) {
-        for (x = x1; x <= x2; x++) {
-            if (centersign * ((point_x[0] - x) * (point_y[1] - y) - (point_y[0] - y) * (point_x[1] - x)) >= 0
-                && centersign * ((point_x[1] - x) * (point_y[2] - y) - (point_y[1] - y) * (point_x[2] - x)) >= 0
-                && centersign * ((point_x[2] - x) * (point_y[0] - y) - (point_y[2] - y) * (point_x[0] - x)) >= 0) {
-                if (player_has_los_bold(caster_ptr, y, x) && projectable(caster_ptr, caster_ptr->y, caster_ptr->x, y, x)) {
-                    (void)affect_monster(caster_ptr, 0, 0, y, x, dam, GF_MANA, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE);
-                }
-            }
-        }
-    }
-
-    if (one_in_(7)) {
-        msg_print(_("鏡が結界に耐えきれず、壊れてしまった。", "The field broke a mirror"));
-        remove_mirror(caster_ptr, point_y[0], point_x[0]);
-    }
-
-    return TRUE;
-}
-
-/*!
- * @brief 鏡魔法「鏡の封印」の効果処理
- * @param dam ダメージ量
- * @return 効果があったらTRUEを返す
- */
-void seal_of_mirror(player_type *caster_ptr, HIT_POINT dam)
-{
-    for (POSITION x = 0; x < caster_ptr->current_floor_ptr->width; x++) {
-        for (POSITION y = 0; y < caster_ptr->current_floor_ptr->height; y++) {
-            if (!is_mirror_grid(&caster_ptr->current_floor_ptr->grid_array[y][x]))
-                continue;
-
-            if (!affect_monster(caster_ptr, 0, 0, y, x, dam, GF_GENOCIDE, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE))
-                continue;
-
-            if (!caster_ptr->current_floor_ptr->grid_array[y][x].m_idx) {
-                remove_mirror(caster_ptr, y, x);
-            }
-        }
-    }
-}
diff --git a/src/spell/spells-mirror.h b/src/spell/spells-mirror.h
deleted file mode 100644 (file)
index 0c00cae..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#pragma once
-
-#include "system/angband.h"
-
-bool binding_field(player_type *caster_ptr, HIT_POINT dam);
-void seal_of_mirror(player_type *caster_ptr, HIT_POINT dam);