OSDN Git Service

[Refactor] #37353 projection.c/h を geometry.c/h に統合。
authordeskull <deskull@users.sourceforge.jp>
Thu, 4 Apr 2019 12:29:03 +0000 (21:29 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Thu, 4 Apr 2019 14:35:13 +0000 (23:35 +0900)
43 files changed:
Hengband_vcs2017/Hengband/Hengband.vcxproj
Hengband_vcs2017/Hengband/Hengband.vcxproj.filters
src/cmd-activate.c
src/cmd-usestaff.c
src/cmd2.c
src/externs.h
src/geometry.c
src/geometry.h
src/grid.c
src/melee1.c
src/mind.c
src/monster-process.c
src/monster1.c
src/monster2.c
src/mspells1.c
src/mspells2.c
src/mspells3.c
src/mspells4.c
src/object-broken.c
src/player-move.c
src/projection.c [deleted file]
src/projection.h [deleted file]
src/realm-arcane.c
src/realm-chaos.c
src/realm-craft.c
src/realm-crusade.c
src/realm-daemon.c
src/realm-death.c
src/realm-hex.c
src/realm-hissatsu.c
src/realm-life.c
src/realm-nature.c
src/realm-song.c
src/realm-sorcery.c
src/realm-trump.c
src/shoot.c
src/spells-diceroll.c
src/spells-status.c
src/spells1.c
src/spells2.c
src/spells3.c
src/trap.c
src/xtra2.c

index 7fd1a1f..79b55ad 100644 (file)
     <ClCompile Include="..\..\src\patron.c" />\r
     <ClCompile Include="..\..\src\player-damage.c" />\r
     <ClCompile Include="..\..\src\player-status.c" />\r
-    <ClCompile Include="..\..\src\projection.c" />\r
     <ClCompile Include="..\..\src\quest.c" />\r
     <ClCompile Include="..\..\src\realm-craft.c" />\r
     <ClCompile Include="..\..\src\realm-crusade.c" />\r
     <ClInclude Include="..\..\src\spells-status.h" />\r
     <ClInclude Include="..\..\src\spells-summon.h" />\r
     <ClInclude Include="..\..\src\floor-streams.h" />\r
-    <ClInclude Include="..\..\src\projection.h" />\r
     <ClInclude Include="..\..\src\spells-world.h" />\r
     <ClInclude Include="..\..\src\spells.h" />\r
     <ClInclude Include="..\..\src\store.h" />\r
index a5949a6..07a27d0 100644 (file)
@@ -5,7 +5,6 @@
     <ClCompile Include="..\..\src\chuukei.c" />
     <ClCompile Include="..\..\src\geometry.c" />
     <ClCompile Include="..\..\src\history.c" />
-    <ClCompile Include="..\..\src\projection.c" />
     <ClCompile Include="..\..\src\quest.c" />
     <ClCompile Include="..\..\src\realm-craft.c" />
     <ClCompile Include="..\..\src\realm-crusade.c" />
     <ClInclude Include="..\..\src\selfinfo.h" />
     <ClInclude Include="..\..\src\shoot.h" />
     <ClInclude Include="..\..\src\sort.h" />
-    <ClInclude Include="..\..\src\projection.h" />
     <ClInclude Include="..\..\src\store.h" />
     <ClInclude Include="..\..\src\term.h" />
     <ClInclude Include="..\..\src\trap.h" />
index 4cdacc7..db4375a 100644 (file)
@@ -11,7 +11,6 @@
 #include "object-hook.h"
 #include "spells-summon.h"
 #include "sort.h"
-#include "projection.h"
 #include "artifact.h"
 #include "avatar.h"
 #include "spells-status.h"
index 4ab7403..77c26df 100644 (file)
@@ -1,5 +1,4 @@
 #include "angband.h"
-#include "projection.h"
 #include "spells-summon.h"
 #include "avatar.h"
 #include "player-status.h"
index 6ff147f..5457e7d 100644 (file)
@@ -16,7 +16,6 @@
 #include "floor.h"
 #include "melee.h"
 #include "object-hook.h"
-#include "projection.h"
 #include "spells-summon.h"
 #include "spells-status.h"
 #include "monster-status.h"
index 7339cc3..05140df 100644 (file)
@@ -453,7 +453,6 @@ extern void cave_alter_feat(POSITION y, POSITION x, int action);
 extern void remove_mirror(POSITION y, POSITION x);
 
 extern void mmove2(POSITION *y, POSITION *x, POSITION y1, POSITION x1, POSITION y2, POSITION x2);
-extern bool projectable(POSITION y1, POSITION x1, POSITION y2, POSITION x2);
 extern void scatter(POSITION *yp, POSITION *xp, POSITION y, POSITION x, POSITION d, BIT_FLAGS mode);
 extern void health_track(MONSTER_IDX m_idx);
 extern void monster_race_track(MONRACE_IDX r_idx);
index 06b2168..58ecc72 100644 (file)
@@ -18,3 +18,376 @@ DIRECTION coords_to_dir(POSITION y, POSITION x)
 
        return d[dx + 1][dy + 1];
 }
+
+/*!
+ * @brief 始点から終点への直線経路を返す /
+ * Determine the path taken by a projection.
+ * @param gp 経路座標リストを返す参照ポインタ
+ * @param range 距離
+ * @param y1 始点Y座標
+ * @param x1 始点X座標
+ * @param y2 終点Y座標
+ * @param x2 終点X座標
+ * @param flg フラグID
+ * @return リストの長さ
+ * @details
+ * <pre>
+ * The projection will always start from the grid (y1,x1), and will travel
+ * towards the grid (y2,x2), touching one grid per unit of distance along
+ * the major axis, and stopping when it enters the destination grid or a
+ * wall grid, or has travelled the maximum legal distance of "range".
+ *
+ * Note that "distance" in this function (as in the "update_view()" code)
+ * is defined as "MAX(dy,dx) + MIN(dy,dx)/2", which means that the player
+ * actually has an "octagon of projection" not a "circle of projection".
+ *
+ * The path grids are saved into the grid array pointed to by "gp", and
+ * there should be room for at least "range" grids in "gp".  Note that
+ * due to the way in which distance is calculated, this function normally
+ * uses fewer than "range" grids for the projection path, so the result
+ * of this function should never be compared directly to "range".  Note
+ * that the initial grid (y1,x1) is never saved into the grid array, not
+ * even if the initial grid is also the final grid.
+ *
+ * The "flg" flags can be used to modify the behavior of this function.
+ *
+ * In particular, the "PROJECT_STOP" and "PROJECT_THRU" flags have the same
+ * semantics as they do for the "project" function, namely, that the path
+ * will stop as soon as it hits a monster, or that the path will continue
+ * through the destination grid, respectively.
+ *
+ * The "PROJECT_JUMP" flag, which for the "project()" function means to
+ * start at a special grid (which makes no sense in this function), means
+ * that the path should be "angled" slightly if needed to avoid any wall
+ * grids, allowing the player to "target" any grid which is in "view".
+ * This flag is non-trivial and has not yet been implemented, but could
+ * perhaps make use of the "vinfo" array (above).
+ *
+ * This function returns the number of grids (if any) in the path.  This
+ * function will return zero if and only if (y1,x1) and (y2,x2) are equal.
+ *
+ * This algorithm is similar to, but slightly different from, the one used
+ * by "update_view_los()", and very different from the one used by "los()".
+ * </pre>
+ */
+sint project_path(u16b *gp, POSITION range, POSITION y1, POSITION x1, POSITION y2, POSITION x2, BIT_FLAGS flg)
+{
+       POSITION y, x;
+
+       int n = 0;
+       int k = 0;
+
+       /* Absolute */
+       POSITION ay, ax;
+
+       /* Offsets */
+       POSITION sy, sx;
+
+       /* Fractions */
+       int frac;
+
+       /* Scale factors */
+       int full, half;
+
+       /* Slope */
+       int m;
+
+       /* No path necessary (or allowed) */
+       if ((x1 == x2) && (y1 == y2)) return (0);
+
+
+       /* Analyze "dy" */
+       if (y2 < y1)
+       {
+               ay = (y1 - y2);
+               sy = -1;
+       }
+       else
+       {
+               ay = (y2 - y1);
+               sy = 1;
+       }
+
+       /* Analyze "dx" */
+       if (x2 < x1)
+       {
+               ax = (x1 - x2);
+               sx = -1;
+       }
+       else
+       {
+               ax = (x2 - x1);
+               sx = 1;
+       }
+
+
+       /* Number of "units" in one "half" grid */
+       half = (ay * ax);
+
+       /* Number of "units" in one "full" grid */
+       full = half << 1;
+
+       /* Vertical */
+       if (ay > ax)
+       {
+               /* Let m = ((dx/dy) * full) = (dx * dx * 2) */
+               m = ax * ax * 2;
+
+               /* Start */
+               y = y1 + sy;
+               x = x1;
+
+               frac = m;
+
+               if (frac > half)
+               {
+                       /* Advance (X) part 2 */
+                       x += sx;
+
+                       /* Advance (X) part 3 */
+                       frac -= full;
+
+                       /* Track distance */
+                       k++;
+               }
+
+               /* Create the projection path */
+               while (1)
+               {
+                       /* Save grid */
+                       gp[n++] = GRID(y, x);
+
+                       /* Hack -- Check maximum range */
+                       if ((n + (k >> 1)) >= range) break;
+
+                       /* Sometimes stop at destination grid */
+                       if (!(flg & (PROJECT_THRU)))
+                       {
+                               if ((x == x2) && (y == y2)) break;
+                       }
+
+                       if (flg & (PROJECT_DISI))
+                       {
+                               if ((n > 0) && cave_stop_disintegration(y, x)) break;
+                       }
+                       else if (flg & (PROJECT_LOS))
+                       {
+                               if ((n > 0) && !cave_los_bold(y, x)) break;
+                       }
+                       else if (!(flg & (PROJECT_PATH)))
+                       {
+                               /* Always stop at non-initial wall grids */
+                               if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
+                       }
+
+                       /* Sometimes stop at non-initial monsters/players */
+                       if (flg & (PROJECT_STOP))
+                       {
+                               if ((n > 0) &&
+                                       (player_bold(y, x) || current_floor_ptr->grid_array[y][x].m_idx != 0))
+                                       break;
+                       }
+
+                       if (!in_bounds(y, x)) break;
+
+                       /* Slant */
+                       if (m)
+                       {
+                               /* Advance (X) part 1 */
+                               frac += m;
+
+                               /* Horizontal change */
+                               if (frac > half)
+                               {
+                                       /* Advance (X) part 2 */
+                                       x += sx;
+
+                                       /* Advance (X) part 3 */
+                                       frac -= full;
+
+                                       /* Track distance */
+                                       k++;
+                               }
+                       }
+
+                       /* Advance (Y) */
+                       y += sy;
+               }
+       }
+
+       /* Horizontal */
+       else if (ax > ay)
+       {
+               /* Let m = ((dy/dx) * full) = (dy * dy * 2) */
+               m = ay * ay * 2;
+
+               /* Start */
+               y = y1;
+               x = x1 + sx;
+
+               frac = m;
+
+               /* Vertical change */
+               if (frac > half)
+               {
+                       /* Advance (Y) part 2 */
+                       y += sy;
+
+                       /* Advance (Y) part 3 */
+                       frac -= full;
+
+                       /* Track distance */
+                       k++;
+               }
+
+               /* Create the projection path */
+               while (1)
+               {
+                       /* Save grid */
+                       gp[n++] = GRID(y, x);
+
+                       /* Hack -- Check maximum range */
+                       if ((n + (k >> 1)) >= range) break;
+
+                       /* Sometimes stop at destination grid */
+                       if (!(flg & (PROJECT_THRU)))
+                       {
+                               if ((x == x2) && (y == y2)) break;
+                       }
+
+                       if (flg & (PROJECT_DISI))
+                       {
+                               if ((n > 0) && cave_stop_disintegration(y, x)) break;
+                       }
+                       else if (flg & (PROJECT_LOS))
+                       {
+                               if ((n > 0) && !cave_los_bold(y, x)) break;
+                       }
+                       else if (!(flg & (PROJECT_PATH)))
+                       {
+                               /* Always stop at non-initial wall grids */
+                               if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
+                       }
+
+                       /* Sometimes stop at non-initial monsters/players */
+                       if (flg & (PROJECT_STOP))
+                       {
+                               if ((n > 0) &&
+                                       (player_bold(y, x) || current_floor_ptr->grid_array[y][x].m_idx != 0))
+                                       break;
+                       }
+
+                       if (!in_bounds(y, x)) break;
+
+                       /* Slant */
+                       if (m)
+                       {
+                               /* Advance (Y) part 1 */
+                               frac += m;
+
+                               /* Vertical change */
+                               if (frac > half)
+                               {
+                                       /* Advance (Y) part 2 */
+                                       y += sy;
+
+                                       /* Advance (Y) part 3 */
+                                       frac -= full;
+
+                                       /* Track distance */
+                                       k++;
+                               }
+                       }
+
+                       /* Advance (X) */
+                       x += sx;
+               }
+       }
+
+       /* Diagonal */
+       else
+       {
+               /* Start */
+               y = y1 + sy;
+               x = x1 + sx;
+
+               /* Create the projection path */
+               while (1)
+               {
+                       /* Save grid */
+                       gp[n++] = GRID(y, x);
+
+                       /* Hack -- Check maximum range */
+                       if ((n + (n >> 1)) >= range) break;
+
+                       /* Sometimes stop at destination grid */
+                       if (!(flg & (PROJECT_THRU)))
+                       {
+                               if ((x == x2) && (y == y2)) break;
+                       }
+
+                       if (flg & (PROJECT_DISI))
+                       {
+                               if ((n > 0) && cave_stop_disintegration(y, x)) break;
+                       }
+                       else if (flg & (PROJECT_LOS))
+                       {
+                               if ((n > 0) && !cave_los_bold(y, x)) break;
+                       }
+                       else if (!(flg & (PROJECT_PATH)))
+                       {
+                               /* Always stop at non-initial wall grids */
+                               if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
+                       }
+
+                       /* Sometimes stop at non-initial monsters/players */
+                       if (flg & (PROJECT_STOP))
+                       {
+                               if ((n > 0) &&
+                                       (player_bold(y, x) || current_floor_ptr->grid_array[y][x].m_idx != 0))
+                                       break;
+                       }
+
+                       if (!in_bounds(y, x)) break;
+
+                       /* Advance (Y) */
+                       y += sy;
+
+                       /* Advance (X) */
+                       x += sx;
+               }
+       }
+
+       /* Length */
+       return (n);
+}
+
+/*
+ * Determine if a bolt spell cast from (y1,x1) to (y2,x2) will arrive
+ * at the final destination, assuming no monster gets in the way.
+ *
+ * This is slightly (but significantly) different from "los(y1,x1,y2,x2)".
+ */
+bool projectable(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
+{
+       POSITION y, x;
+
+       int grid_n = 0;
+       u16b grid_g[512];
+
+       /* Check the projection path */
+       grid_n = project_path(grid_g, (project_length ? project_length : MAX_RANGE), y1, x1, y2, x2, 0);
+
+       /* Identical grid */
+       if (!grid_n) return TRUE;
+
+       /* Final grid */
+       y = GRID_Y(grid_g[grid_n - 1]);
+       x = GRID_X(grid_g[grid_n - 1]);
+
+       /* May not end in an unrequested grid */
+       if ((y != y2) || (x != x2)) return (FALSE);
+
+       /* Assume okay */
+       return (TRUE);
+}
index edae84c..f52b32b 100644 (file)
@@ -1,6 +1,29 @@
 #pragma once
 
-DIRECTION coords_to_dir(POSITION y, POSITION x);
+extern DIRECTION coords_to_dir(POSITION y, POSITION x);
+
+/*
+ * project()関数に用いられる、遠隔攻撃特性ビットフラグ / Bit flags for the "project()" function
+ */
+#define PROJECT_JUMP        0x0001 /*!< 遠隔攻撃特性: 発動者からの軌跡を持たず、指定地点に直接発生する(予め置いたトラップ、上空からの発生などのイメージ) / Jump directly to the target location (this is a hack) */
+#define PROJECT_BEAM        0x0002 /*!< 遠隔攻撃特性: ビーム範囲を持つ。 / Work as a beam weapon (affect every grid passed through) */
+#define PROJECT_THRU        0x0004 /*!< 遠隔攻撃特性: 目標地点に到達しても射程と遮蔽の限り引き延ばす。 / Continue "through" the target (used for "bolts"/"beams") */
+#define PROJECT_STOP        0x0008 /*!< 遠隔攻撃特性: 道中にプレイヤーかモンスターがいた時点で到達地点を更新して停止する(壁や森はPROJECT_DISIがない限り最初から貫通しない) */
+#define PROJECT_GRID        0x0010 /*!< 遠隔攻撃特性: 射程内の地形に影響を及ぼす / Affect each grid in the "blast area" in some way */
+#define PROJECT_ITEM        0x0020 /*!< 遠隔攻撃特性: 射程内のアイテムに影響を及ぼす / Affect each object in the "blast area" in some way */
+#define PROJECT_KILL        0x0040 /*!< 遠隔攻撃特性: 射程内のモンスターに影響を及ぼす / Affect each monster in the "blast area" in some way */
+#define PROJECT_HIDE        0x0080 /*!< 遠隔攻撃特性: / Hack -- disable "visual" feedback from projection */
+#define PROJECT_DISI        0x0100 /*!< 遠隔攻撃特性: / Disintegrate non-permanent features */
+#define PROJECT_PLAYER      0x0200 /*!< 遠隔攻撃特性: / Main target is player (used for riding player) */
+#define PROJECT_AIMED       0x0400 /*!< 遠隔攻撃特性: / Target is only player or monster, so don't affect another. Depend on PROJECT_PLAYER. (used for minimum (rad == 0) balls on riding player) */
+#define PROJECT_REFLECTABLE 0x0800 /*!< 遠隔攻撃特性: 反射可能(ボルト系魔法に利用) / Refrectable spell attacks (used for "bolts") */
+#define PROJECT_NO_HANGEKI  0x1000 /*!< 遠隔攻撃特性: / Avoid counter attacks of monsters */
+#define PROJECT_PATH        0x2000 /*!< 遠隔攻撃特性: / Only used for printing project path */
+#define PROJECT_FAST        0x4000 /*!< 遠隔攻撃特性: / Hide "visual" of flying bolts until blast */
+#define PROJECT_LOS         0x8000 /*!< 遠隔攻撃特性: /  */
+extern sint project_path(u16b *gp, POSITION range, POSITION y1, POSITION x1, POSITION y2, POSITION x2, BIT_FLAGS flg);
+
+extern bool projectable(POSITION y1, POSITION x1, POSITION y2, POSITION x2);
 
 //!< 対象グリッドの一覧をまとめる構造体
 typedef struct
index 8d67b82..0b28e95 100644 (file)
@@ -19,7 +19,6 @@
 
 #include "angband.h"
 #include "world.h"
-#include "projection.h"
 #include "object-hook.h"
 #include "generate.h"
 #include "grid.h"
@@ -5380,37 +5379,6 @@ void mmove2(POSITION *y, POSITION *x, POSITION y1, POSITION x1, POSITION y2, POS
 
 
 /*
- * Determine if a bolt spell cast from (y1,x1) to (y2,x2) will arrive
- * at the final destination, assuming no monster gets in the way.
- *
- * This is slightly (but significantly) different from "los(y1,x1,y2,x2)".
- */
-bool projectable(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
-{
-       POSITION y, x;
-
-       int grid_n = 0;
-       u16b grid_g[512];
-
-       /* Check the projection path */
-       grid_n = project_path(grid_g, (project_length ? project_length : MAX_RANGE), y1, x1, y2, x2, 0);
-
-       /* Identical grid */
-       if (!grid_n) return TRUE;
-
-       /* Final grid */
-       y = GRID_Y(grid_g[grid_n - 1]);
-       x = GRID_X(grid_g[grid_n - 1]);
-
-       /* May not end in an unrequested grid */
-       if ((y != y2) || (x != x2)) return (FALSE);
-
-       /* Assume okay */
-       return (TRUE);
-}
-
-
-/*
  * Standard "find me a location" function
  *
  * Obtains a legal location within the given distance of the initial
index 428927a..32a4147 100644 (file)
@@ -17,7 +17,6 @@
 #include "player-damage.h"
 #include "monsterrace-hook.h"
 #include "melee.h"
-#include "projection.h"
 #include "monster.h"
 #include "monster-status.h"
 #include "monster-spell.h"
index 2b010b2..4447c94 100644 (file)
@@ -16,7 +16,6 @@
 
 #include "angband.h"
 #include "melee.h"
-#include "projection.h"
 #include "spells-summon.h"
 #include "avatar.h"
 #include "player-status.h"
index cb478bf..353a2b5 100644 (file)
@@ -17,7 +17,6 @@
 #include "cmd-pet.h"
 #include "monsterrace-hook.h"
 #include "melee.h"
-#include "projection.h"
 #include "spells-summon.h"
 #include "quest.h"
 #include "avatar.h"
index 582b354..eb4333a 100644 (file)
@@ -14,7 +14,6 @@
 #include "cmd-pet.h"
 #include "monsterrace-hook.h"
 #include "objectkind-hook.h"
-#include "projection.h"
 #include "monster.h"
 #include "monster-spell.h"
 #include "spells-summon.h"
index f5af4ea..37854d3 100644 (file)
@@ -14,7 +14,6 @@
 #include "cmd-pet.h"
 #include "monsterrace-hook.h"
 #include "monster-status.h"
-#include "projection.h"
 #include "monster.h"
 #include "spells-summon.h"
 #include "quest.h"
index 21b52ba..b716b85 100644 (file)
@@ -40,7 +40,6 @@
 
 #include "angband.h"
 #include "object-curse.h"
-#include "projection.h"
 #include "quest.h"
 #include "realm-hex.h"
 #include "player-move.h"
index 7298ad0..0d4fe37 100644 (file)
@@ -12,7 +12,6 @@
  */
 
 #include "angband.h"
-#include "projection.h"
 #include "quest.h"
 #include "realm-hex.h"
 #include "player-move.h"
index 5c178fb..928f502 100644 (file)
@@ -12,7 +12,6 @@
 
 #include "angband.h"
 #include "spells-summon.h"
-#include "projection.h"
 #include "avatar.h"
 #include "spells-status.h"
 #include "cmd-spell.h"
index b23352a..aae08f1 100644 (file)
@@ -7,7 +7,6 @@
 
 
 #include "angband.h"
-#include "projection.h"
 #include "spells-summon.h"
 #include "artifact.h"
 #include "player-status.h"
index 149452b..d883c11 100644 (file)
@@ -1,5 +1,4 @@
 #include "angband.h"
-#include "projection.h"
 
 /*!
  * @brief 薬の破損効果処理 /
index 2ea419e..70ffd8f 100644 (file)
 #include "melee.h"
 #include "grid.h"
 #include "trap.h"
-#include "projection.h"
 #include "quest.h"
 #include "artifact.h"
 #include "player-move.h"
diff --git a/src/projection.c b/src/projection.c
deleted file mode 100644 (file)
index b5049b5..0000000
+++ /dev/null
@@ -1,346 +0,0 @@
-#include "angband.h"
-#include "projection.h"
-
-/*!
- * @brief 始点から終点への経路を返す /
- * Determine the path taken by a projection.
- * @param gp 経路座標リストを返す参照ポインタ
- * @param range 距離
- * @param y1 始点Y座標
- * @param x1 始点X座標
- * @param y2 終点Y座標
- * @param x2 終点X座標
- * @param flg フラグID
- * @return リストの長さ
- * @details
- * <pre>
- * The projection will always start from the grid (y1,x1), and will travel
- * towards the grid (y2,x2), touching one grid per unit of distance along
- * the major axis, and stopping when it enters the destination grid or a
- * wall grid, or has travelled the maximum legal distance of "range".
- *
- * Note that "distance" in this function (as in the "update_view()" code)
- * is defined as "MAX(dy,dx) + MIN(dy,dx)/2", which means that the player
- * actually has an "octagon of projection" not a "circle of projection".
- *
- * The path grids are saved into the grid array pointed to by "gp", and
- * there should be room for at least "range" grids in "gp".  Note that
- * due to the way in which distance is calculated, this function normally
- * uses fewer than "range" grids for the projection path, so the result
- * of this function should never be compared directly to "range".  Note
- * that the initial grid (y1,x1) is never saved into the grid array, not
- * even if the initial grid is also the final grid.  
- *
- * The "flg" flags can be used to modify the behavior of this function.
- *
- * In particular, the "PROJECT_STOP" and "PROJECT_THRU" flags have the same
- * semantics as they do for the "project" function, namely, that the path
- * will stop as soon as it hits a monster, or that the path will continue
- * through the destination grid, respectively.
- *
- * The "PROJECT_JUMP" flag, which for the "project()" function means to
- * start at a special grid (which makes no sense in this function), means
- * that the path should be "angled" slightly if needed to avoid any wall
- * grids, allowing the player to "target" any grid which is in "view".
- * This flag is non-trivial and has not yet been implemented, but could
- * perhaps make use of the "vinfo" array (above).  
- *
- * This function returns the number of grids (if any) in the path.  This
- * function will return zero if and only if (y1,x1) and (y2,x2) are equal.
- *
- * This algorithm is similar to, but slightly different from, the one used
- * by "update_view_los()", and very different from the one used by "los()".
- * </pre>
- */
-sint project_path(u16b *gp, POSITION range, POSITION y1, POSITION x1, POSITION y2, POSITION x2, BIT_FLAGS flg)
-{
-       POSITION y, x;
-
-       int n = 0;
-       int k = 0;
-
-       /* Absolute */
-       POSITION ay, ax;
-
-       /* Offsets */
-       POSITION sy, sx;
-
-       /* Fractions */
-       int frac;
-
-       /* Scale factors */
-       int full, half;
-
-       /* Slope */
-       int m;
-
-       /* No path necessary (or allowed) */
-       if ((x1 == x2) && (y1 == y2)) return (0);
-
-
-       /* Analyze "dy" */
-       if (y2 < y1)
-       {
-               ay = (y1 - y2);
-               sy = -1;
-       }
-       else
-       {
-               ay = (y2 - y1);
-               sy = 1;
-       }
-
-       /* Analyze "dx" */
-       if (x2 < x1)
-       {
-               ax = (x1 - x2);
-               sx = -1;
-       }
-       else
-       {
-               ax = (x2 - x1);
-               sx = 1;
-       }
-
-
-       /* Number of "units" in one "half" grid */
-       half = (ay * ax);
-
-       /* Number of "units" in one "full" grid */
-       full = half << 1;
-
-       /* Vertical */
-       if (ay > ax)
-       {
-               /* Let m = ((dx/dy) * full) = (dx * dx * 2) */
-               m = ax * ax * 2;
-
-               /* Start */
-               y = y1 + sy;
-               x = x1;
-
-               frac = m;
-
-               if (frac > half)
-               {
-                       /* Advance (X) part 2 */
-                       x += sx;
-
-                       /* Advance (X) part 3 */
-                       frac -= full;
-
-                       /* Track distance */
-                       k++;
-               }
-
-               /* Create the projection path */
-               while (1)
-               {
-                       /* Save grid */
-                       gp[n++] = GRID(y, x);
-
-                       /* Hack -- Check maximum range */
-                       if ((n + (k >> 1)) >= range) break;
-
-                       /* Sometimes stop at destination grid */
-                       if (!(flg & (PROJECT_THRU)))
-                       {
-                               if ((x == x2) && (y == y2)) break;
-                       }
-
-                       if (flg & (PROJECT_DISI))
-                       {
-                               if ((n > 0) && cave_stop_disintegration(y, x)) break;
-                       }
-                       else if (flg & (PROJECT_LOS))
-                       {
-                               if ((n > 0) && !cave_los_bold(y, x)) break;
-                       }
-                       else if (!(flg & (PROJECT_PATH)))
-                       {
-                               /* Always stop at non-initial wall grids */
-                               if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
-                       }
-
-                       /* Sometimes stop at non-initial monsters/players */
-                       if (flg & (PROJECT_STOP))
-                       {
-                               if ((n > 0) &&
-                                       (player_bold(y, x) || current_floor_ptr->grid_array[y][x].m_idx != 0))
-                                       break;
-                       }
-
-                       if (!in_bounds(y, x)) break;
-
-                       /* Slant */
-                       if (m)
-                       {
-                               /* Advance (X) part 1 */
-                               frac += m;
-
-                               /* Horizontal change */
-                               if (frac > half)
-                               {
-                                       /* Advance (X) part 2 */
-                                       x += sx;
-
-                                       /* Advance (X) part 3 */
-                                       frac -= full;
-
-                                       /* Track distance */
-                                       k++;
-                               }
-                       }
-
-                       /* Advance (Y) */
-                       y += sy;
-               }
-       }
-
-       /* Horizontal */
-       else if (ax > ay)
-       {
-               /* Let m = ((dy/dx) * full) = (dy * dy * 2) */
-               m = ay * ay * 2;
-
-               /* Start */
-               y = y1;
-               x = x1 + sx;
-
-               frac = m;
-
-               /* Vertical change */
-               if (frac > half)
-               {
-                       /* Advance (Y) part 2 */
-                       y += sy;
-
-                       /* Advance (Y) part 3 */
-                       frac -= full;
-
-                       /* Track distance */
-                       k++;
-               }
-
-               /* Create the projection path */
-               while (1)
-               {
-                       /* Save grid */
-                       gp[n++] = GRID(y, x);
-
-                       /* Hack -- Check maximum range */
-                       if ((n + (k >> 1)) >= range) break;
-
-                       /* Sometimes stop at destination grid */
-                       if (!(flg & (PROJECT_THRU)))
-                       {
-                               if ((x == x2) && (y == y2)) break;
-                       }
-
-                       if (flg & (PROJECT_DISI))
-                       {
-                               if ((n > 0) && cave_stop_disintegration(y, x)) break;
-                       }
-                       else if (flg & (PROJECT_LOS))
-                       {
-                               if ((n > 0) && !cave_los_bold(y, x)) break;
-                       }
-                       else if (!(flg & (PROJECT_PATH)))
-                       {
-                               /* Always stop at non-initial wall grids */
-                               if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
-                       }
-
-                       /* Sometimes stop at non-initial monsters/players */
-                       if (flg & (PROJECT_STOP))
-                       {
-                               if ((n > 0) &&
-                                       (player_bold(y, x) || current_floor_ptr->grid_array[y][x].m_idx != 0))
-                                       break;
-                       }
-
-                       if (!in_bounds(y, x)) break;
-
-                       /* Slant */
-                       if (m)
-                       {
-                               /* Advance (Y) part 1 */
-                               frac += m;
-
-                               /* Vertical change */
-                               if (frac > half)
-                               {
-                                       /* Advance (Y) part 2 */
-                                       y += sy;
-
-                                       /* Advance (Y) part 3 */
-                                       frac -= full;
-
-                                       /* Track distance */
-                                       k++;
-                               }
-                       }
-
-                       /* Advance (X) */
-                       x += sx;
-               }
-       }
-
-       /* Diagonal */
-       else
-       {
-               /* Start */
-               y = y1 + sy;
-               x = x1 + sx;
-
-               /* Create the projection path */
-               while (1)
-               {
-                       /* Save grid */
-                       gp[n++] = GRID(y, x);
-
-                       /* Hack -- Check maximum range */
-                       if ((n + (n >> 1)) >= range) break;
-
-                       /* Sometimes stop at destination grid */
-                       if (!(flg & (PROJECT_THRU)))
-                       {
-                               if ((x == x2) && (y == y2)) break;
-                       }
-
-                       if (flg & (PROJECT_DISI))
-                       {
-                               if ((n > 0) && cave_stop_disintegration(y, x)) break;
-                       }
-                       else if (flg & (PROJECT_LOS))
-                       {
-                               if ((n > 0) && !cave_los_bold(y, x)) break;
-                       }
-                       else if (!(flg & (PROJECT_PATH)))
-                       {
-                               /* Always stop at non-initial wall grids */
-                               if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
-                       }
-
-                       /* Sometimes stop at non-initial monsters/players */
-                       if (flg & (PROJECT_STOP))
-                       {
-                               if ((n > 0) &&
-                                       (player_bold(y, x) || current_floor_ptr->grid_array[y][x].m_idx != 0))
-                                       break;
-                       }
-
-                       if (!in_bounds(y, x)) break;
-
-                       /* Advance (Y) */
-                       y += sy;
-
-                       /* Advance (X) */
-                       x += sx;
-               }
-       }
-
-       /* Length */
-       return (n);
-}
-
diff --git a/src/projection.h b/src/projection.h
deleted file mode 100644 (file)
index 8c5fe72..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * project()関数に用いられる、遠隔攻撃特性ビットフラグ / Bit flags for the "project()" function
- */
-#define PROJECT_JUMP        0x0001 /*!< 遠隔攻撃特性: 発動者からの軌跡を持たず、指定地点に直接発生する(予め置いたトラップ、上空からの発生などのイメージ) / Jump directly to the target location (this is a hack) */
-#define PROJECT_BEAM        0x0002 /*!< 遠隔攻撃特性: ビーム範囲を持つ。 / Work as a beam weapon (affect every grid passed through) */
-#define PROJECT_THRU        0x0004 /*!< 遠隔攻撃特性: 目標地点に到達しても射程と遮蔽の限り引き延ばす。 / Continue "through" the target (used for "bolts"/"beams") */
-#define PROJECT_STOP        0x0008 /*!< 遠隔攻撃特性: 道中にプレイヤーかモンスターがいた時点で到達地点を更新して停止する(壁や森はPROJECT_DISIがない限り最初から貫通しない) */
-#define PROJECT_GRID        0x0010 /*!< 遠隔攻撃特性: 射程内の地形に影響を及ぼす / Affect each grid in the "blast area" in some way */
-#define PROJECT_ITEM        0x0020 /*!< 遠隔攻撃特性: 射程内のアイテムに影響を及ぼす / Affect each object in the "blast area" in some way */
-#define PROJECT_KILL        0x0040 /*!< 遠隔攻撃特性: 射程内のモンスターに影響を及ぼす / Affect each monster in the "blast area" in some way */
-#define PROJECT_HIDE        0x0080 /*!< 遠隔攻撃特性: / Hack -- disable "visual" feedback from projection */
-#define PROJECT_DISI        0x0100 /*!< 遠隔攻撃特性: / Disintegrate non-permanent features */
-#define PROJECT_PLAYER      0x0200 /*!< 遠隔攻撃特性: / Main target is player (used for riding player) */
-#define PROJECT_AIMED       0x0400 /*!< 遠隔攻撃特性: / Target is only player or monster, so don't affect another. Depend on PROJECT_PLAYER. (used for minimum (rad == 0) balls on riding player) */
-#define PROJECT_REFLECTABLE 0x0800 /*!< 遠隔攻撃特性: 反射可能(ボルト系魔法に利用) / Refrectable spell attacks (used for "bolts") */
-#define PROJECT_NO_HANGEKI  0x1000 /*!< 遠隔攻撃特性: / Avoid counter attacks of monsters */
-#define PROJECT_PATH        0x2000 /*!< 遠隔攻撃特性: / Only used for printing project path */
-#define PROJECT_FAST        0x4000 /*!< 遠隔攻撃特性: / Hide "visual" of flying bolts until blast */
-#define PROJECT_LOS         0x8000 /*!< 遠隔攻撃特性: /  */
-
-extern sint project_path(u16b *gp, POSITION range, POSITION y1, POSITION x1, POSITION y2, POSITION x2, BIT_FLAGS flg);
index 92a9868..25e2136 100644 (file)
@@ -1,6 +1,5 @@
 #include "angband.h"
 #include "cmd-spell.h"
-#include "projection.h"
 #include "avatar.h"
 
 #include "spells-floor.h"
index a994114..81f4180 100644 (file)
@@ -2,7 +2,6 @@
 #include "cmd-spell.h"
 #include "spells-summon.h"
 #include "spells-status.h"
-#include "projection.h"
 
 /*!
 * @brief カオス領域魔法の各処理を行う
index 9f11cf9..082f3b7 100644 (file)
@@ -1,7 +1,6 @@
 #include "angband.h"
 #include "cmd-spell.h"
 #include "selfinfo.h"
-#include "projection.h"
 #include "spells-object.h"
 #include "spells-summon.h"
 #include "spells-status.h"
index aadefe5..3113038 100644 (file)
@@ -1,7 +1,6 @@
 #include "angband.h"
 #include "cmd-spell.h"
 #include "spells-summon.h"
-#include "projection.h"
 #include "spells-status.h"
 
 
index 4042dc7..44c1ffe 100644 (file)
@@ -3,7 +3,6 @@
 #include "cmd-spell.h"
 #include "spells-summon.h"
 #include "spells-status.h"
-#include "projection.h"
 
 /*!
 * @brief 悪魔領域魔法の各処理を行う
index 901c92b..9a51348 100644 (file)
@@ -1,6 +1,5 @@
 #include "angband.h"
 #include "cmd-spell.h"
-#include "projection.h"
 #include "spells-summon.h"
 #include "spells-status.h"
 #include "avatar.h"
index cec53ac..f914a6f 100644 (file)
@@ -20,7 +20,6 @@
 #include "cmd-quaff.h"
 #include "object-hook.h"
 #include "object-curse.h"
-#include "projection.h"
 #include "spells-status.h"
 #include "player-status.h"
 
index f0ac70c..91a0010 100644 (file)
@@ -2,7 +2,6 @@
 #include "cmd-spell.h"
 #include "melee.h"
 #include "monsterrace-hook.h"
-#include "projection.h"
 #include "artifact.h"
 #include "monster.h"
 #include "player-status.h"
index 80c0c87..85ef354 100644 (file)
@@ -1,6 +1,5 @@
 #include "angband.h"
 #include "cmd-spell.h"
-#include "projection.h"
 #include "spells-status.h"
 #include "spells-floor.h"
 
index 973e7dc..719af9e 100644 (file)
@@ -1,6 +1,5 @@
 #include "angband.h"
 #include "cmd-spell.h"
-#include "projection.h"
 #include "spells-summon.h"
 #include "spells-status.h"
 #include "spells-object.h"
index 73f7870..da3c54d 100644 (file)
@@ -1,7 +1,6 @@
 #include "angband.h"
 #include "cmd-spell.h"
 #include "spells-status.h"
-#include "projection.h"
 #include "spells-floor.h"
 
 /*!
index da77206..3865c94 100644 (file)
@@ -1,7 +1,6 @@
 #include "angband.h"
 #include "cmd-spell.h"
 #include "selfinfo.h"
-#include "projection.h"
 #include "avatar.h"
 #include "spells-status.h"
 #include "spells-floor.h"
index 8784042..03d2b44 100644 (file)
@@ -1,6 +1,5 @@
 #include "angband.h"
 #include "cmd-spell.h"
-#include "projection.h"
 #include "spells-summon.h"
 #include "mutation.h"
 #include "spells-status.h"
index 2c5d36d..13f7f39 100644 (file)
@@ -1,5 +1,4 @@
 #include "angband.h"
-#include "projection.h"
 #include "monster.h"
 #include "monster-status.h"
 #include "monster-spell.h"
index 5aea49b..8f2c952 100644 (file)
@@ -5,7 +5,6 @@
 #include "monster.h"
 #include "monsterrace-hook.h"
 #include "mutation.h"
-#include "projection.h"
 #include "rooms.h"
 
 
index 07ed81f..a431bfc 100644 (file)
@@ -2,7 +2,6 @@
 #include "avatar.h"
 #include "player-status.h"
 #include "spells-status.h"
-#include "projection.h"
 #include "spells.h"
 #include "monster.h"
 
index 99816f5..8e906c3 100644 (file)
@@ -27,7 +27,6 @@
 
 #include "melee.h"
 #include "world.h"
-#include "projection.h"
 #include "mutation.h"
 #include "rooms.h"
 #include "artifact.h"
index 952dc5a..db281fb 100644 (file)
@@ -18,7 +18,6 @@
 #include "monsterrace-hook.h"
 #include "melee.h"
 #include "world.h"
-#include "projection.h"
 #include "spells-summon.h"
 #include "mutation.h"
 #include "quest.h"
index 2f8d6a2..b68e657 100644 (file)
@@ -17,7 +17,6 @@
 #include "object-hook.h"
 #include "melee.h"
 #include "player-status.h"
-#include "projection.h"
 #include "spells-summon.h"
 #include "quest.h"
 #include "artifact.h"
index 159613d..3f8eae2 100644 (file)
@@ -3,7 +3,6 @@
 #include "trap.h"
 #include "player-damage.h"
 #include "player-move.h"
-#include "projection.h"
 #include "spells-summon.h"
 #include "quest.h"
 #include "artifact.h"
index e09e2f5..4b04366 100644 (file)
@@ -18,7 +18,6 @@
 #include "monsterrace-hook.h"
 #include "objectkind-hook.h"
 #include "sort.h"
-#include "projection.h"
 #include "spells-summon.h"
 #include "floor-events.h"
 #include "player-move.h"