}
/* Get projection path length */
- tdis = project_path(path_g, project_length, shooter_ptr->y, shooter_ptr->x, ty, tx, PROJECT_PATH | PROJECT_THRU) - 1;
+ tdis = project_path(shooter_ptr->current_floor_ptr, path_g, project_length, shooter_ptr->y, shooter_ptr->x, ty, tx, PROJECT_PATH | PROJECT_THRU) - 1;
project_length = 0; /* reset to default */
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);
+ grid_n = project_path(floor_ptr, grid_g, (project_length ? project_length : MAX_RANGE), y1, x1, y2, x2, 0);
/* Identical grid */
if (!grid_n) return TRUE;
}
}
+/*!
+ * @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(floor_type *floor_ptr, 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(floor_ptr, y, x)) break;
+ }
+ else if (!(flg & (PROJECT_PATH)))
+ {
+ /* Always stop at non-initial wall grids */
+ if ((n > 0) && !cave_have_flag_bold(floor_ptr, y, x, FF_PROJECT)) break;
+ }
+
+ /* Sometimes stop at non-initial monsters/players */
+ if (flg & (PROJECT_STOP))
+ {
+ if ((n > 0) &&
+ (player_bold(p_ptr, y, x) || floor_ptr->grid_array[y][x].m_idx != 0))
+ break;
+ }
+
+ if (!in_bounds(floor_ptr, 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(floor_ptr, y, x)) break;
+ }
+ else if (!(flg & (PROJECT_PATH)))
+ {
+ /* Always stop at non-initial wall grids */
+ if ((n > 0) && !cave_have_flag_bold(floor_ptr, y, x, FF_PROJECT)) break;
+ }
+
+ /* Sometimes stop at non-initial monsters/players */
+ if (flg & (PROJECT_STOP))
+ {
+ if ((n > 0) &&
+ (player_bold(p_ptr, y, x) || floor_ptr->grid_array[y][x].m_idx != 0))
+ break;
+ }
+
+ if (!in_bounds(floor_ptr, 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(floor_ptr, y, x)) break;
+ }
+ else if (!(flg & (PROJECT_PATH)))
+ {
+ /* Always stop at non-initial wall grids */
+ if ((n > 0) && !cave_have_flag_bold(floor_ptr, y, x, FF_PROJECT)) break;
+ }
+
+ /* Sometimes stop at non-initial monsters/players */
+ if (flg & (PROJECT_STOP))
+ {
+ if ((n > 0) &&
+ (player_bold(p_ptr, y, x) || floor_ptr->grid_array[y][x].m_idx != 0))
+ break;
+ }
+
+ if (!in_bounds(floor_ptr, y, x)) break;
+
+ /* Advance (Y) */
+ y += sy;
+
+ /* Advance (X) */
+ x += sx;
+ }
+ }
+
+ /* Length */
+ return (n);
+}
extern FEAT_IDX conv_dungeon_feat(floor_type *floor_ptr, FEAT_IDX newfeat);
extern void vault_objects(floor_type *floor_ptr, POSITION y, POSITION x, int num);
+/*
+ * 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(floor_type *floor_ptr, u16b *gp, POSITION range, POSITION y1, POSITION x1, POSITION y2, POSITION x2, BIT_FLAGS flg);
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(p_ptr->current_floor_ptr, y, x)) break;
- }
- else if (!(flg & (PROJECT_PATH)))
- {
- /* Always stop at non-initial wall grids */
- if ((n > 0) && !cave_have_flag_bold(p_ptr->current_floor_ptr, y, x, FF_PROJECT)) break;
- }
-
- /* Sometimes stop at non-initial monsters/players */
- if (flg & (PROJECT_STOP))
- {
- if ((n > 0) &&
- (player_bold(p_ptr, y, x) || p_ptr->current_floor_ptr->grid_array[y][x].m_idx != 0))
- break;
- }
-
- if (!in_bounds(p_ptr->current_floor_ptr, 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(p_ptr->current_floor_ptr, y, x)) break;
- }
- else if (!(flg & (PROJECT_PATH)))
- {
- /* Always stop at non-initial wall grids */
- if ((n > 0) && !cave_have_flag_bold(p_ptr->current_floor_ptr, y, x, FF_PROJECT)) break;
- }
-
- /* Sometimes stop at non-initial monsters/players */
- if (flg & (PROJECT_STOP))
- {
- if ((n > 0) &&
- (player_bold(p_ptr, y, x) || p_ptr->current_floor_ptr->grid_array[y][x].m_idx != 0))
- break;
- }
-
- if (!in_bounds(p_ptr->current_floor_ptr, 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(p_ptr->current_floor_ptr, y, x)) break;
- }
- else if (!(flg & (PROJECT_PATH)))
- {
- /* Always stop at non-initial wall grids */
- if ((n > 0) && !cave_have_flag_bold(p_ptr->current_floor_ptr, y, x, FF_PROJECT)) break;
- }
-
- /* Sometimes stop at non-initial monsters/players */
- if (flg & (PROJECT_STOP))
- {
- if ((n > 0) &&
- (player_bold(p_ptr, y, x) || p_ptr->current_floor_ptr->grid_array[y][x].m_idx != 0))
- break;
- }
-
- if (!in_bounds(p_ptr->current_floor_ptr, y, x)) break;
-
- /* Advance (Y) */
- y += sy;
-
- /* Advance (X) */
- x += sx;
- }
- }
-
- /* Length */
- return (n);
-}
-
/*
* Standard "find me a location" function
extern DIRECTION coords_to_dir(player_type *creature_ptr, 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 POSITION distance(POSITION y1, POSITION x1, POSITION y2, POSITION x2);
extern void scatter(POSITION *yp, POSITION *xp, POSITION y, POSITION x, POSITION d, BIT_FLAGS mode);
m_ptr = &caster_ptr->current_floor_ptr->m_list[m_idx];
monster_desc(m_name, m_ptr, 0);
msg_format(_("%sを引き戻した。", "You pull back %s."), m_name);
- path_n = project_path(path_g, MAX_RANGE, target_row, target_col, caster_ptr->y, caster_ptr->x, 0);
+ path_n = project_path(caster_ptr->current_floor_ptr, path_g, MAX_RANGE, target_row, target_col, caster_ptr->y, caster_ptr->x, 0);
ty = target_row, tx = target_col;
for (i = 1; i < path_n; i++)
{
u16b grid_g[512];
/* Check the projection path */
- grid_n = project_path(grid_g, MAX_RANGE, y1, x1, y2, x2, 0);
+ grid_n = project_path(p_ptr->current_floor_ptr, grid_g, MAX_RANGE, y1, x1, y2, x2, 0);
/* No grid is ever projectable from itself */
if (!grid_n) return (FALSE);
bool is_friend = is_pet(m_ptr);
/* Check the projection path */
- grid_n = project_path(grid_g, MAX_RANGE, y1, x1, y2, x2, PROJECT_THRU);
+ grid_n = project_path(p_ptr->current_floor_ptr, grid_g, MAX_RANGE, y1, x1, y2, x2, PROJECT_THRU);
/* No grid is ever projectable from itself */
if (!grid_n) return (FALSE);
}
/* Check the projection path */
- grid_n = project_path(grid_g, MAX_RANGE, y1, x1, y2, x2, flg);
+ grid_n = project_path(p_ptr->current_floor_ptr, grid_g, MAX_RANGE, y1, x1, y2, x2, flg);
/* Project along the path */
for (i = 0; i < grid_n; ++i)
u16b path_g[128];
int path_n, i;
- path_n = project_path(path_g, MAX_RANGE, sy, sx, *ty, *tx, flg);
+ path_n = project_path(p_ptr->current_floor_ptr, path_g, MAX_RANGE, sy, sx, *ty, *tx, flg);
*ty = sy;
*tx = sx;
/* Calculate the projection path */
- path_n = project_path(path_g, (project_length ? project_length : MAX_RANGE), y1, x1, y2, x2, flg);
+ path_n = project_path(caster_ptr->current_floor_ptr, path_g, (project_length ? project_length : MAX_RANGE), y1, x1, y2, x2, flg);
handle_stuff();
/* Giga-Hack SEEKER & SUPER_RAY */
remove_mirror(y, x);
next_mirror(caster_ptr, &oy, &ox, y, x);
- path_n = i + project_path(&(path_g[i + 1]), (project_length ? project_length : MAX_RANGE), y, x, oy, ox, flg);
+ path_n = i + project_path(caster_ptr->current_floor_ptr, &(path_g[i + 1]), (project_length ? project_length : MAX_RANGE), y, x, oy, ox, flg);
for (j = last_i; j <= i; j++)
{
y = GRID_Y(path_g[j]);
}
path_n = i;
second_step = i + 1;
- path_n += project_path(&(path_g[path_n + 1]), (project_length ? project_length : MAX_RANGE), y, x, y - 1, x - 1, flg);
- path_n += project_path(&(path_g[path_n + 1]), (project_length ? project_length : MAX_RANGE), y, x, y - 1, x, flg);
- path_n += project_path(&(path_g[path_n + 1]), (project_length ? project_length : MAX_RANGE), y, x, y - 1, x + 1, flg);
- path_n += project_path(&(path_g[path_n + 1]), (project_length ? project_length : MAX_RANGE), y, x, y, x - 1, flg);
- path_n += project_path(&(path_g[path_n + 1]), (project_length ? project_length : MAX_RANGE), y, x, y, x + 1, flg);
- path_n += project_path(&(path_g[path_n + 1]), (project_length ? project_length : MAX_RANGE), y, x, y + 1, x - 1, flg);
- path_n += project_path(&(path_g[path_n + 1]), (project_length ? project_length : MAX_RANGE), y, x, y + 1, x, flg);
- path_n += project_path(&(path_g[path_n + 1]), (project_length ? project_length : MAX_RANGE), y, x, y + 1, x + 1, flg);
+ path_n += project_path(caster_ptr->current_floor_ptr, &(path_g[path_n + 1]), (project_length ? project_length : MAX_RANGE), y, x, y - 1, x - 1, flg);
+ path_n += project_path(caster_ptr->current_floor_ptr, &(path_g[path_n + 1]), (project_length ? project_length : MAX_RANGE), y, x, y - 1, x, flg);
+ path_n += project_path(caster_ptr->current_floor_ptr, &(path_g[path_n + 1]), (project_length ? project_length : MAX_RANGE), y, x, y - 1, x + 1, flg);
+ path_n += project_path(caster_ptr->current_floor_ptr, &(path_g[path_n + 1]), (project_length ? project_length : MAX_RANGE), y, x, y, x - 1, flg);
+ path_n += project_path(caster_ptr->current_floor_ptr, &(path_g[path_n + 1]), (project_length ? project_length : MAX_RANGE), y, x, y, x + 1, flg);
+ path_n += project_path(caster_ptr->current_floor_ptr, &(path_g[path_n + 1]), (project_length ? project_length : MAX_RANGE), y, x, y + 1, x - 1, flg);
+ path_n += project_path(caster_ptr->current_floor_ptr, &(path_g[path_n + 1]), (project_length ? project_length : MAX_RANGE), y, x, y + 1, x, flg);
+ path_n += project_path(caster_ptr->current_floor_ptr, &(path_g[path_n + 1]), (project_length ? project_length : MAX_RANGE), y, x, y + 1, x + 1, flg);
}
}
for (i = 0; i < path_n; i++)
if (in_bounds(attacker_ptr->current_floor_ptr, ty, tx)) tm_idx = attacker_ptr->current_floor_ptr->grid_array[ty][tx].m_idx;
- path_n = project_path(path_g, project_length, attacker_ptr->y, attacker_ptr->x, ty, tx, PROJECT_STOP | PROJECT_KILL);
+ path_n = project_path(attacker_ptr->current_floor_ptr, path_g, project_length, attacker_ptr->y, attacker_ptr->x, ty, tx, PROJECT_STOP | PROJECT_KILL);
project_length = 0;
/* No need to move */
return;
/* Get projection path */
- path_n = project_path(path_g, (project_length ? project_length : MAX_RANGE), p_ptr->y, p_ptr->x, y, x, PROJECT_PATH | PROJECT_THRU);
+ path_n = project_path(p_ptr->current_floor_ptr, path_g, (project_length ? project_length : MAX_RANGE), p_ptr->y, p_ptr->x, y, x, PROJECT_PATH | PROJECT_THRU);
p_ptr->redraw |= (PR_MAP);
handle_stuff();