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 void health_track(MONSTER_IDX m_idx);
extern void monster_race_track(MONRACE_IDX r_idx);
extern void object_kind_track(KIND_OBJECT_IDX k_idx);
(*xp) = nx;
}
+/*
+ * Calculate "incremental motion". Used by project() and shoot().
+ * Assumes that (*y,*x) lies on the path from (y1,x1) to (y2,x2).
+ */
+void mmove2(POSITION *y, POSITION *x, POSITION y1, POSITION x1, POSITION y2, POSITION x2)
+{
+ POSITION dy, dx, dist, shift;
+
+ /* Extract the distance travelled */
+ dy = (*y < y1) ? y1 - *y : *y - y1;
+ dx = (*x < x1) ? x1 - *x : *x - x1;
+
+ /* Number of steps */
+ dist = (dy > dx) ? dy : dx;
+
+ /* We are calculating the next location */
+ dist++;
+
+
+ /* Calculate the total distance along each axis */
+ dy = (y2 < y1) ? (y1 - y2) : (y2 - y1);
+ dx = (x2 < x1) ? (x1 - x2) : (x2 - x1);
+
+ /* Paranoia -- Hack -- no motion */
+ if (!dy && !dx) return;
+
+
+ /* Move mostly vertically */
+ if (dy > dx)
+ {
+ /* Extract a shift factor */
+ shift = (dist * dx + (dy - 1) / 2) / dy;
+
+ /* Sometimes move along the minor axis */
+ (*x) = (x2 < x1) ? (x1 - shift) : (x1 + shift);
+
+ /* Always move along major axis */
+ (*y) = (y2 < y1) ? (y1 - dist) : (y1 + dist);
+ }
+
+ /* Move mostly horizontally */
+ else
+ {
+ /* Extract a shift factor */
+ shift = (dist * dy + (dx - 1) / 2) / dx;
+
+ /* Sometimes move along the minor axis */
+ (*y) = (y2 < y1) ? (y1 - shift) : (y1 + shift);
+
+ /* Always move along major axis */
+ (*x) = (x2 < x1) ? (x1 - dist) : (x1 + dist);
+ }
+}
+
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 mmove2(POSITION *y, POSITION *x, POSITION y1, POSITION x1, POSITION y2, POSITION x2);
//!< 対象グリッドの一覧をまとめる構造体
typedef struct
/*
- * Calculate "incremental motion". Used by project() and shoot().
- * Assumes that (*y,*x) lies on the path from (y1,x1) to (y2,x2).
- */
-void mmove2(POSITION *y, POSITION *x, POSITION y1, POSITION x1, POSITION y2, POSITION x2)
-{
- POSITION dy, dx, dist, shift;
-
- /* Extract the distance travelled */
- dy = (*y < y1) ? y1 - *y : *y - y1;
- dx = (*x < x1) ? x1 - *x : *x - x1;
-
- /* Number of steps */
- dist = (dy > dx) ? dy : dx;
-
- /* We are calculating the next location */
- dist++;
-
-
- /* Calculate the total distance along each axis */
- dy = (y2 < y1) ? (y1 - y2) : (y2 - y1);
- dx = (x2 < x1) ? (x1 - x2) : (x2 - x1);
-
- /* Paranoia -- Hack -- no motion */
- if (!dy && !dx) return;
-
-
- /* Move mostly vertically */
- if (dy > dx)
- {
- /* Extract a shift factor */
- shift = (dist * dx + (dy - 1) / 2) / dy;
-
- /* Sometimes move along the minor axis */
- (*x) = (x2 < x1) ? (x1 - shift) : (x1 + shift);
-
- /* Always move along major axis */
- (*y) = (y2 < y1) ? (y1 - dist) : (y1 + dist);
- }
-
- /* Move mostly horizontally */
- else
- {
- /* Extract a shift factor */
- shift = (dist * dy + (dx - 1) / 2) / dx;
-
- /* Sometimes move along the minor axis */
- (*y) = (y2 < y1) ? (y1 - shift) : (y1 + shift);
-
- /* Always move along major axis */
- (*x) = (x2 < x1) ? (x1 - dist) : (x1 + dist);
- }
-}
-
-
-
-
-/*
* Track a new monster
*/
void health_track(MONSTER_IDX m_idx)