m_idx = caster_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx;
if (!m_idx) break;
if (!player_has_los_bold(p_ptr, target_row, target_col)) break;
- if (!projectable(caster_ptr->y, caster_ptr->x, target_row, target_col)) break;
+ if (!projectable(caster_ptr->current_floor_ptr, caster_ptr->y, caster_ptr->x, target_row, target_col)) break;
dispel_monster_status(m_idx);
break;
}
if (!target_set(TARGET_KILL)) return FALSE;
if (!caster_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx) break;
if (!player_has_los_bold(p_ptr, target_row, target_col)) break;
- if (!projectable(caster_ptr->y, caster_ptr->x, target_row, target_col)) break;
+ if (!projectable(caster_ptr->current_floor_ptr, caster_ptr->y, caster_ptr->x, target_row, target_col)) break;
m_ptr = &caster_ptr->current_floor_ptr->m_list[caster_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx];
r_ptr = &r_info[m_ptr->r_idx];
monster_desc(m_name, m_ptr, 0);
/* Hack -- check line of sight */
- if (los(p_ptr->y, p_ptr->x, y, x))
+ if (los(p_ptr->current_floor_ptr, p_ptr->y, p_ptr->x, y, x))
{
cave_view_hack(g_ptr, y, x);
* when you or the pet can see the other.
*/
if (m_ptr->nickname &&
- ((player_has_los_bold(p_ptr, m_ptr->fy, m_ptr->fx) && projectable(p_ptr->y, p_ptr->x, m_ptr->fy, m_ptr->fx)) ||
- (los(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x) && projectable(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x))))
+ ((player_has_los_bold(p_ptr, m_ptr->fy, m_ptr->fx) && projectable(p_ptr->current_floor_ptr, p_ptr->y, p_ptr->x, m_ptr->fy, m_ptr->fx)) ||
+ (los(p_ptr->current_floor_ptr, m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x) && projectable(p_ptr->current_floor_ptr, m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x))))
{
if (dis > 3) continue;
}
else if (down_stairs) set_cave_feat(floor_ptr, y, x, feat_down_stair);
}
+/*!
+ * @brief LOS(Line Of Sight / 視線が通っているか)の判定を行う。
+ * @param y1 始点のy座標
+ * @param x1 始点のx座標
+ * @param y2 終点のy座標
+ * @param x2 終点のx座標
+ * @return LOSが通っているならTRUEを返す。
+ * @details
+ * A simple, fast, integer-based line-of-sight algorithm. By Joseph Hall,\n
+ * 4116 Brewster Drive, Raleigh NC 27606. Email to jnh@ecemwl.ncsu.edu.\n
+ *\n
+ * Returns TRUE if a line of sight can be traced from (x1,y1) to (x2,y2).\n
+ *\n
+ * The LOS begins at the center of the tile (x1,y1) and ends at the center of\n
+ * the tile (x2,y2). If los() is to return TRUE, all of the tiles this line\n
+ * passes through must be floor tiles, except for (x1,y1) and (x2,y2).\n
+ *\n
+ * We assume that the "mathematical corner" of a non-floor tile does not\n
+ * block line of sight.\n
+ *\n
+ * Because this function uses (short) ints for all calculations, overflow may\n
+ * occur if dx and dy exceed 90.\n
+ *\n
+ * Once all the degenerate cases are eliminated, the values "qx", "qy", and\n
+ * "m" are multiplied by a scale factor "f1 = abs(dx * dy * 2)", so that\n
+ * we can use integer arithmetic.\n
+ *\n
+ * We travel from start to finish along the longer axis, starting at the border\n
+ * between the first and second tiles, where the y offset = .5 * slope, taking\n
+ * into account the scale factor. See below.\n
+ *\n
+ * Also note that this function and the "move towards target" code do NOT\n
+ * share the same properties. Thus, you can see someone, target them, and\n
+ * then fire a bolt at them, but the bolt may hit a wall, not them. However\n,
+ * by clever choice of target locations, you can sometimes throw a "curve".\n
+ *\n
+ * Note that "line of sight" is not "reflexive" in all cases.\n
+ *\n
+ * Use the "projectable()" routine to test "spell/missile line of sight".\n
+ *\n
+ * Use the "update_view()" function to determine player line-of-sight.\n
+ */
+bool los(floor_type *floor_ptr, POSITION y1, POSITION x1, POSITION y2, POSITION x2)
+{
+ /* Delta */
+ POSITION dx, dy;
+
+ /* Absolute */
+ POSITION ax, ay;
+
+ /* Signs */
+ POSITION sx, sy;
+
+ /* Fractions */
+ POSITION qx, qy;
+
+ /* Scanners */
+ POSITION tx, ty;
+
+ /* Scale factors */
+ POSITION f1, f2;
+
+ /* Slope, or 1/Slope, of LOS */
+ POSITION m;
+
+
+ /* Extract the offset */
+ dy = y2 - y1;
+ dx = x2 - x1;
+
+ /* Extract the absolute offset */
+ ay = ABS(dy);
+ ax = ABS(dx);
+
+
+ /* Handle adjacent (or identical) grids */
+ if ((ax < 2) && (ay < 2)) return TRUE;
+
+
+ /* Paranoia -- require "safe" origin */
+ /* if (!in_bounds(floor_ptr, y1, x1)) return FALSE; */
+ /* if (!in_bounds(floor_ptr, y2, x2)) return FALSE; */
+
+
+ /* Directly South/North */
+ if (!dx)
+ {
+ /* South -- check for walls */
+ if (dy > 0)
+ {
+ for (ty = y1 + 1; ty < y2; ty++)
+ {
+ if (!cave_los_bold(floor_ptr, ty, x1)) return FALSE;
+ }
+ }
+
+ /* North -- check for walls */
+ else
+ {
+ for (ty = y1 - 1; ty > y2; ty--)
+ {
+ if (!cave_los_bold(floor_ptr, ty, x1)) return FALSE;
+ }
+ }
+
+ /* Assume los */
+ return TRUE;
+ }
+
+ /* Directly East/West */
+ if (!dy)
+ {
+ /* East -- check for walls */
+ if (dx > 0)
+ {
+ for (tx = x1 + 1; tx < x2; tx++)
+ {
+ if (!cave_los_bold(floor_ptr, y1, tx)) return FALSE;
+ }
+ }
+
+ /* West -- check for walls */
+ else
+ {
+ for (tx = x1 - 1; tx > x2; tx--)
+ {
+ if (!cave_los_bold(floor_ptr, y1, tx)) return FALSE;
+ }
+ }
+
+ /* Assume los */
+ return TRUE;
+ }
+
+
+ /* Extract some signs */
+ sx = (dx < 0) ? -1 : 1;
+ sy = (dy < 0) ? -1 : 1;
+
+
+ /* Vertical "knights" */
+ if (ax == 1)
+ {
+ if (ay == 2)
+ {
+ if (cave_los_bold(floor_ptr, y1 + sy, x1)) return TRUE;
+ }
+ }
+
+ /* Horizontal "knights" */
+ else if (ay == 1)
+ {
+ if (ax == 2)
+ {
+ if (cave_los_bold(floor_ptr, y1, x1 + sx)) return TRUE;
+ }
+ }
+
+
+ /* Calculate scale factor div 2 */
+ f2 = (ax * ay);
+
+ /* Calculate scale factor */
+ f1 = f2 << 1;
+
+
+ /* Travel horizontally */
+ if (ax >= ay)
+ {
+ /* Let m = dy / dx * 2 * (dy * dx) = 2 * dy * dy */
+ qy = ay * ay;
+ m = qy << 1;
+
+ tx = x1 + sx;
+
+ /* Consider the special case where slope == 1. */
+ if (qy == f2)
+ {
+ ty = y1 + sy;
+ qy -= f1;
+ }
+ else
+ {
+ ty = y1;
+ }
+
+ /* Note (below) the case (qy == f2), where */
+ /* the LOS exactly meets the corner of a tile. */
+ while (x2 - tx)
+ {
+ if (!cave_los_bold(floor_ptr, ty, tx)) return FALSE;
+
+ qy += m;
+
+ if (qy < f2)
+ {
+ tx += sx;
+ }
+ else if (qy > f2)
+ {
+ ty += sy;
+ if (!cave_los_bold(floor_ptr, ty, tx)) return FALSE;
+ qy -= f1;
+ tx += sx;
+ }
+ else
+ {
+ ty += sy;
+ qy -= f1;
+ tx += sx;
+ }
+ }
+ }
+
+ /* Travel vertically */
+ else
+ {
+ /* Let m = dx / dy * 2 * (dx * dy) = 2 * dx * dx */
+ qx = ax * ax;
+ m = qx << 1;
+
+ ty = y1 + sy;
+
+ if (qx == f2)
+ {
+ tx = x1 + sx;
+ qx -= f1;
+ }
+ else
+ {
+ tx = x1;
+ }
+
+ /* Note (below) the case (qx == f2), where */
+ /* the LOS exactly meets the corner of a tile. */
+ while (y2 - ty)
+ {
+ if (!cave_los_bold(floor_ptr, ty, tx)) return FALSE;
+
+ qx += m;
+
+ if (qx < f2)
+ {
+ ty += sy;
+ }
+ else if (qx > f2)
+ {
+ tx += sx;
+ if (!cave_los_bold(floor_ptr, ty, tx)) return FALSE;
+ qx -= f1;
+ ty += sy;
+ }
+ else
+ {
+ tx += sx;
+ qx -= f1;
+ ty += sy;
+ }
+ }
+ }
+
+ /* Assume los */
+ return TRUE;
+}
+
+
+/*
+ * 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(floor_type *floor_ptr, 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);
+}
+
extern void forget_flow(floor_type *floor_ptr);
extern void place_random_stairs(floor_type *floor_ptr, POSITION y, POSITION x);
-
+extern bool los(floor_type* floor_ptr, POSITION y1, POSITION x1, POSITION y2, POSITION x2);
+extern bool projectable(floor_type *floor_ptr, POSITION y1, POSITION x1, POSITION y2, POSITION x2);
+extern int project_length;
return (n);
}
-/*!
- * @brief LOS(Line Of Sight / 視線が通っているか)の判定を行う。
- * @param y1 始点のy座標
- * @param x1 始点のx座標
- * @param y2 終点のy座標
- * @param x2 終点のx座標
- * @return LOSが通っているならTRUEを返す。
- * @details
- * A simple, fast, integer-based line-of-sight algorithm. By Joseph Hall,\n
- * 4116 Brewster Drive, Raleigh NC 27606. Email to jnh@ecemwl.ncsu.edu.\n
- *\n
- * Returns TRUE if a line of sight can be traced from (x1,y1) to (x2,y2).\n
- *\n
- * The LOS begins at the center of the tile (x1,y1) and ends at the center of\n
- * the tile (x2,y2). If los() is to return TRUE, all of the tiles this line\n
- * passes through must be floor tiles, except for (x1,y1) and (x2,y2).\n
- *\n
- * We assume that the "mathematical corner" of a non-floor tile does not\n
- * block line of sight.\n
- *\n
- * Because this function uses (short) ints for all calculations, overflow may\n
- * occur if dx and dy exceed 90.\n
- *\n
- * Once all the degenerate cases are eliminated, the values "qx", "qy", and\n
- * "m" are multiplied by a scale factor "f1 = abs(dx * dy * 2)", so that\n
- * we can use integer arithmetic.\n
- *\n
- * We travel from start to finish along the longer axis, starting at the border\n
- * between the first and second tiles, where the y offset = .5 * slope, taking\n
- * into account the scale factor. See below.\n
- *\n
- * Also note that this function and the "move towards target" code do NOT\n
- * share the same properties. Thus, you can see someone, target them, and\n
- * then fire a bolt at them, but the bolt may hit a wall, not them. However\n,
- * by clever choice of target locations, you can sometimes throw a "curve".\n
- *\n
- * Note that "line of sight" is not "reflexive" in all cases.\n
- *\n
- * Use the "projectable()" routine to test "spell/missile line of sight".\n
- *\n
- * Use the "update_view()" function to determine player line-of-sight.\n
- */
-bool los(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
-{
- /* Delta */
- POSITION dx, dy;
-
- /* Absolute */
- POSITION ax, ay;
-
- /* Signs */
- POSITION sx, sy;
-
- /* Fractions */
- POSITION qx, qy;
-
- /* Scanners */
- POSITION tx, ty;
-
- /* Scale factors */
- POSITION f1, f2;
-
- /* Slope, or 1/Slope, of LOS */
- POSITION m;
-
-
- /* Extract the offset */
- dy = y2 - y1;
- dx = x2 - x1;
-
- /* Extract the absolute offset */
- ay = ABS(dy);
- ax = ABS(dx);
-
-
- /* Handle adjacent (or identical) grids */
- if ((ax < 2) && (ay < 2)) return TRUE;
-
-
- /* Paranoia -- require "safe" origin */
- /* if (!in_bounds(p_ptr->current_floor_ptr, y1, x1)) return FALSE; */
- /* if (!in_bounds(p_ptr->current_floor_ptr, y2, x2)) return FALSE; */
-
-
- /* Directly South/North */
- if (!dx)
- {
- /* South -- check for walls */
- if (dy > 0)
- {
- for (ty = y1 + 1; ty < y2; ty++)
- {
- if (!cave_los_bold(p_ptr->current_floor_ptr, ty, x1)) return FALSE;
- }
- }
-
- /* North -- check for walls */
- else
- {
- for (ty = y1 - 1; ty > y2; ty--)
- {
- if (!cave_los_bold(p_ptr->current_floor_ptr, ty, x1)) return FALSE;
- }
- }
-
- /* Assume los */
- return TRUE;
- }
-
- /* Directly East/West */
- if (!dy)
- {
- /* East -- check for walls */
- if (dx > 0)
- {
- for (tx = x1 + 1; tx < x2; tx++)
- {
- if (!cave_los_bold(p_ptr->current_floor_ptr, y1, tx)) return FALSE;
- }
- }
-
- /* West -- check for walls */
- else
- {
- for (tx = x1 - 1; tx > x2; tx--)
- {
- if (!cave_los_bold(p_ptr->current_floor_ptr, y1, tx)) return FALSE;
- }
- }
-
- /* Assume los */
- return TRUE;
- }
-
-
- /* Extract some signs */
- sx = (dx < 0) ? -1 : 1;
- sy = (dy < 0) ? -1 : 1;
-
-
- /* Vertical "knights" */
- if (ax == 1)
- {
- if (ay == 2)
- {
- if (cave_los_bold(p_ptr->current_floor_ptr, y1 + sy, x1)) return TRUE;
- }
- }
-
- /* Horizontal "knights" */
- else if (ay == 1)
- {
- if (ax == 2)
- {
- if (cave_los_bold(p_ptr->current_floor_ptr, y1, x1 + sx)) return TRUE;
- }
- }
-
-
- /* Calculate scale factor div 2 */
- f2 = (ax * ay);
-
- /* Calculate scale factor */
- f1 = f2 << 1;
-
-
- /* Travel horizontally */
- if (ax >= ay)
- {
- /* Let m = dy / dx * 2 * (dy * dx) = 2 * dy * dy */
- qy = ay * ay;
- m = qy << 1;
-
- tx = x1 + sx;
-
- /* Consider the special case where slope == 1. */
- if (qy == f2)
- {
- ty = y1 + sy;
- qy -= f1;
- }
- else
- {
- ty = y1;
- }
-
- /* Note (below) the case (qy == f2), where */
- /* the LOS exactly meets the corner of a tile. */
- while (x2 - tx)
- {
- if (!cave_los_bold(p_ptr->current_floor_ptr, ty, tx)) return FALSE;
-
- qy += m;
-
- if (qy < f2)
- {
- tx += sx;
- }
- else if (qy > f2)
- {
- ty += sy;
- if (!cave_los_bold(p_ptr->current_floor_ptr, ty, tx)) return FALSE;
- qy -= f1;
- tx += sx;
- }
- else
- {
- ty += sy;
- qy -= f1;
- tx += sx;
- }
- }
- }
-
- /* Travel vertically */
- else
- {
- /* Let m = dx / dy * 2 * (dx * dy) = 2 * dx * dx */
- qx = ax * ax;
- m = qx << 1;
-
- ty = y1 + sy;
-
- if (qx == f2)
- {
- tx = x1 + sx;
- qx -= f1;
- }
- else
- {
- tx = x1;
- }
-
- /* Note (below) the case (qx == f2), where */
- /* the LOS exactly meets the corner of a tile. */
- while (y2 - ty)
- {
- if (!cave_los_bold(p_ptr->current_floor_ptr, ty, tx)) return FALSE;
-
- qx += m;
-
- if (qx < f2)
- {
- ty += sy;
- }
- else if (qx > f2)
- {
- tx += sx;
- if (!cave_los_bold(p_ptr->current_floor_ptr, ty, tx)) return FALSE;
- qx -= f1;
- ty += sy;
- }
- else
- {
- tx += sx;
- qx -= f1;
- ty += sy;
- }
- }
- }
-
- /* Assume los */
- return TRUE;
-}
-
-/*
- * 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
if (mode & PROJECT_LOS)
{
- if (los(y, x, ny, nx)) break;
+ if (los(p_ptr->current_floor_ptr, y, x, ny, nx)) break;
}
else
{
- if (projectable(y, x, ny, nx)) break;
+ if (projectable(p_ptr->current_floor_ptr, y, x, ny, nx)) break;
}
}
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 bool los(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 mmove2(POSITION *y, POSITION *x, POSITION y1, POSITION x1, POSITION y2, POSITION x2);
*/
#define is_seen(A) \
((bool)((A)->ml && (!ignore_unview || p_ptr->phase_out || \
- (player_can_see_bold((A)->fy, (A)->fx) && projectable(p_ptr->y, p_ptr->x, (A)->fy, (A)->fx)))))
+ (player_can_see_bold((A)->fy, (A)->fx) && projectable(p_ptr->current_floor_ptr, p_ptr->y, p_ptr->x, (A)->fy, (A)->fx)))))
/* grids.c */
extern POSITION distance(POSITION y1, POSITION x1, POSITION y2, POSITION x2);
-extern bool los(POSITION y1, POSITION x1, POSITION y2, POSITION x2);
extern void update_local_illumination(player_type *creature_ptr, POSITION y, POSITION x);
extern bool player_can_see_bold(POSITION y, POSITION x);
extern bool cave_valid_bold(POSITION y, POSITION x);
m_idx = caster_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx;
if (!m_idx) break;
if (!player_has_los_bold(p_ptr, target_row, target_col)) break;
- if (!projectable(caster_ptr->y, caster_ptr->x, target_row, target_col)) break;
+ if (!projectable(caster_ptr->current_floor_ptr, caster_ptr->y, caster_ptr->x, target_row, target_col)) break;
dispel_monster_status(m_idx);
break;
}
if (!m_idx) break;
if (m_idx == caster_ptr->riding) break;
if (!player_has_los_bold(p_ptr, target_row, target_col)) break;
- if (!projectable(caster_ptr->y, caster_ptr->x, target_row, target_col)) break;
+ if (!projectable(caster_ptr->current_floor_ptr, caster_ptr->y, caster_ptr->x, target_row, target_col)) break;
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);
}
else
{
- if (!projectable(m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx)) continue;
+ if (!projectable(p_ptr->current_floor_ptr, m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx)) continue;
}
/* OK -- we've got a target */
x1 = m_ptr->fx;
/* Monster can already cast spell to player */
- if (projectable(y1, x1, p_ptr->y, p_ptr->x)) return (FALSE);
+ if (projectable(p_ptr->current_floor_ptr, y1, x1, p_ptr->y, p_ptr->x)) return (FALSE);
/* Set current grid cost */
now_cost = p_ptr->current_floor_ptr->grid_array[y1][x1].cost;
if (now_cost < cost) continue;
- if (!projectable(y, x, p_ptr->y, p_ptr->x)) continue;
+ if (!projectable(p_ptr->current_floor_ptr, y, x, p_ptr->y, p_ptr->x)) continue;
/* Accept louder sounds */
if (best < cost) continue;
x1 = m_ptr->fx;
/* Hack -- Player can see us, run towards him */
- if (player_has_los_bold(p_ptr, y1, x1) && projectable(p_ptr->y, p_ptr->x, y1, x1)) return (FALSE);
+ if (player_has_los_bold(p_ptr, y1, x1) && projectable(p_ptr->current_floor_ptr, p_ptr->y, p_ptr->x, y1, x1)) return (FALSE);
/* Monster grid */
g_ptr = &p_ptr->current_floor_ptr->grid_array[y1][x1];
}
/* Check for absence of shot (more or less) */
- if (!projectable(p_ptr->y, p_ptr->x, y, x))
+ if (!projectable(p_ptr->current_floor_ptr, p_ptr->y, p_ptr->x, y, x))
{
/* Calculate distance from player */
dis = distance(y, x, p_ptr->y, p_ptr->x);
if (!monster_can_enter(y, x, r_ptr, 0)) continue;
/* Check for hidden, available grid */
- if (!projectable(p_ptr->y, p_ptr->x, y, x) && clean_shot(fy, fx, y, x, FALSE))
+ if (!projectable(p_ptr->current_floor_ptr, p_ptr->y, p_ptr->x, y, x) && clean_shot(fy, fx, y, x, FALSE))
{
/* Calculate distance from player */
dis = distance(y, x, p_ptr->y, p_ptr->x);
/* The monster must be an enemy, and in LOS */
if (t_m_idx &&
are_enemies(m_ptr, &p_ptr->current_floor_ptr->m_list[t_m_idx]) &&
- los(m_ptr->fy, m_ptr->fx, m_ptr->target_y, m_ptr->target_x) &&
- projectable(m_ptr->fy, m_ptr->fx, m_ptr->target_y, m_ptr->target_x))
+ los(p_ptr->current_floor_ptr, m_ptr->fy, m_ptr->fx, m_ptr->target_y, m_ptr->target_x) &&
+ projectable(p_ptr->current_floor_ptr, m_ptr->fy, m_ptr->fx, m_ptr->target_y, m_ptr->target_x))
{
/* Extract the "pseudo-direction" */
y = m_ptr->fy - m_ptr->target_y;
if (!done && !will_run && is_hostile(m_ptr) &&
(r_ptr->flags1 & RF1_FRIENDS) &&
- ((los(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x) && projectable(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x)) ||
+ ((los(p_ptr->current_floor_ptr, m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x) && projectable(p_ptr->current_floor_ptr, m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x)) ||
(p_ptr->current_floor_ptr->grid_array[m_ptr->fy][m_ptr->fx].dist < MAX_SIGHT / 2)))
{
/*
if (see_m)
{
if ((r_ptr->flags2 & RF2_CAN_SPEAK) && (m_ptr->r_idx != MON_GRIP) && (m_ptr->r_idx != MON_WOLF) && (m_ptr->r_idx != MON_FANG) &&
- player_has_los_bold(p_ptr, m_ptr->fy, m_ptr->fx) && projectable(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x))
+ player_has_los_bold(p_ptr, m_ptr->fy, m_ptr->fx) && projectable(p_ptr->current_floor_ptr, m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x))
{
msg_format(_("%^s「ピンチだ!退却させてもらう!」", "%^s says 'It is the pinch! I will retreat'."), m_name);
}
if ((ap_r_ptr->flags2 & RF2_CAN_SPEAK) && aware &&
one_in_(SPEAK_CHANCE) &&
player_has_los_bold(p_ptr, oy, ox) &&
- projectable(oy, ox, p_ptr->y, p_ptr->x))
+ projectable(p_ptr->current_floor_ptr, oy, ox, p_ptr->y, p_ptr->x))
{
GAME_TEXT m_name[MAX_NLEN];
char monmessage[1024];
/* The monster must be an enemy, and projectable */
if (t_m_idx && are_enemies(m_ptr, &p_ptr->current_floor_ptr->m_list[t_m_idx]) &&
- projectable(m_ptr->fy, m_ptr->fx, m_ptr->target_y, m_ptr->target_x))
+ projectable(p_ptr->current_floor_ptr, m_ptr->fy, m_ptr->fx, m_ptr->target_y, m_ptr->target_x))
{
counterattack = TRUE;
}
/* Possible disturb */
if (m_ptr->ml &&
(disturb_move ||
- (disturb_near && (m_ptr->mflag & MFLAG_VIEW) && projectable(p_ptr->y, p_ptr->x, m_ptr->fy, m_ptr->fx)) ||
+ (disturb_near && (m_ptr->mflag & MFLAG_VIEW) && projectable(p_ptr->current_floor_ptr, p_ptr->y, p_ptr->x, m_ptr->fy, m_ptr->fx)) ||
(disturb_high && ap_r_ptr->r_tkills && ap_r_ptr->level >= p_ptr->lev)))
{
if (is_hostile(m_ptr))
p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
current_world_ptr->timewalk_m_idx = 0;
- if (vs_player || (player_has_los_bold(p_ptr, m_ptr->fy, m_ptr->fx) && projectable(p_ptr->y, p_ptr->x, m_ptr->fy, m_ptr->fx)))
+ if (vs_player || (player_has_los_bold(p_ptr, m_ptr->fy, m_ptr->fx) && projectable(p_ptr->current_floor_ptr, p_ptr->y, p_ptr->x, m_ptr->fy, m_ptr->fx)))
{
msg_print(_("「時は動きだす…」", "You feel time flowing around you once more."));
msg_print(NULL);
}
/* Disturb on appearance */
- if (disturb_near && (projectable(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x) && projectable(p_ptr->y, p_ptr->x, m_ptr->fy, m_ptr->fx)))
+ if (disturb_near && (projectable(p_ptr->current_floor_ptr, m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x) && projectable(p_ptr->current_floor_ptr, p_ptr->y, p_ptr->x, m_ptr->fy, m_ptr->fx)))
{
if (disturb_pets || is_hostile(m_ptr))
disturb(p_ptr, TRUE, TRUE);
if (!in_bounds(p_ptr->current_floor_ptr, ny, nx)) continue;
/* Require "line of projection" */
- if (!projectable(y, x, ny, nx)) continue;
+ if (!projectable(p_ptr->current_floor_ptr, y, x, ny, nx)) continue;
if (r_idx > 0)
{
if (pattern_tile(y, x)) continue;
/* Require empty floor grid in line of projection */
- if (cave_empty_bold(p_ptr->current_floor_ptr, y, x) && projectable(y1, x1, y, x) && projectable(y, x, y1, x1)) return (TRUE);
+ if (cave_empty_bold(p_ptr->current_floor_ptr, y, x) && projectable(p_ptr->current_floor_ptr, y1, x1, y, x) && projectable(p_ptr->current_floor_ptr, y, x, y1, x1)) return (TRUE);
}
}
for (yy = y - 5; yy <= y + 5; yy++)
{
if (distance(y, x, yy, xx) > 5) continue;
- if (!los(y, x, yy, xx)) continue;
- if (!projectable(y, x, yy, xx)) continue;
+ if (!los(p_ptr->current_floor_ptr, y, x, yy, xx)) continue;
+ if (!projectable(p_ptr->current_floor_ptr, y, x, yy, xx)) continue;
g_ptr = &p_ptr->current_floor_ptr->grid_array[yy][xx];
/* Scan the pile of objects */
* @return 有効な座標があった場合TRUEを返す
*/
static bool adjacent_grid_check(monster_type *m_ptr, POSITION *yp, POSITION *xp,
- int f_flag, bool (*path_check)(POSITION, POSITION, POSITION, POSITION))
+ int f_flag, bool (*path_check)(floor_type *, POSITION, POSITION, POSITION, POSITION))
{
int i;
int tonari;
/* Skip this feature */
if (!cave_have_flag_grid(g_ptr, f_flag)) continue;
- if (path_check(m_ptr->fy, m_ptr->fx, next_y, next_x))
+ if (path_check(p_ptr->current_floor_ptr, m_ptr->fy, m_ptr->fx, next_y, next_x))
{
*yp = next_y;
*xp = next_x;
y_br_lite = y;
x_br_lite = x;
- if (los(m_ptr->fy, m_ptr->fx, y_br_lite, x_br_lite))
+ if (los(p_ptr->current_floor_ptr, m_ptr->fy, m_ptr->fx, y_br_lite, x_br_lite))
{
feature_type *f_ptr = &f_info[p_ptr->current_floor_ptr->grid_array[y_br_lite][x_br_lite].feat];
}
/* Check path */
- if (projectable(m_ptr->fy, m_ptr->fx, y, x))
+ if (projectable(p_ptr->current_floor_ptr, m_ptr->fy, m_ptr->fx, y, x))
{
feature_type *f_ptr = &f_info[p_ptr->current_floor_ptr->grid_array[y][x].feat];
if ((f4 & RF4_BR_DISI) && (m_ptr->cdis < MAX_RANGE/2) &&
in_disintegration_range(m_ptr->fy, m_ptr->fx, y, x) &&
- (one_in_(10) || (projectable(y, x, m_ptr->fy, m_ptr->fx) && one_in_(2))))
+ (one_in_(10) || (projectable(p_ptr->current_floor_ptr, y, x, m_ptr->fy, m_ptr->fx) && one_in_(2))))
{
do_spell = DO_SPELL_BR_DISI;
success = TRUE;
}
else if ((f4 & RF4_BR_LITE) && (m_ptr->cdis < MAX_RANGE/2) &&
- los(m_ptr->fy, m_ptr->fx, y, x) && one_in_(5))
+ los(p_ptr->current_floor_ptr, m_ptr->fy, m_ptr->fx, y, x) && one_in_(5))
{
do_spell = DO_SPELL_BR_LITE;
success = TRUE;
{
POSITION by = y, bx = x;
get_project_point(m_ptr->fy, m_ptr->fx, &by, &bx, 0L);
- if ((distance(by, bx, y, x) <= 3) && los(by, bx, y, x) && one_in_(5))
+ if ((distance(by, bx, y, x) <= 3) && los(p_ptr->current_floor_ptr, by, bx, y, x) && one_in_(5))
{
do_spell = DO_SPELL_BA_LITE;
success = TRUE;
}
else if (flg & PROJECT_LOS)
{
- if (los(y1, x1, y2, x2) && (distance(y1, x1, y2, x2) <= rad)) hit2 = TRUE;
- if (los(y1, x1, p_ptr->y, p_ptr->x) && (distance(y1, x1, p_ptr->y, p_ptr->x) <= rad)) hityou = TRUE;
+ if (los(p_ptr->current_floor_ptr, y1, x1, y2, x2) && (distance(y1, x1, y2, x2) <= rad)) hit2 = TRUE;
+ if (los(p_ptr->current_floor_ptr, y1, x1, p_ptr->y, p_ptr->x) && (distance(y1, x1, p_ptr->y, p_ptr->x) <= rad)) hityou = TRUE;
}
else
{
- if (projectable(y1, x1, y2, x2) && (distance(y1, x1, y2, x2) <= rad)) hit2 = TRUE;
- if (projectable(y1, x1, p_ptr->y, p_ptr->x) && (distance(y1, x1, p_ptr->y, p_ptr->x) <= rad)) hityou = TRUE;
+ if (projectable(p_ptr->current_floor_ptr, y1, x1, y2, x2) && (distance(y1, x1, y2, x2) <= rad)) hit2 = TRUE;
+ if (projectable(p_ptr->current_floor_ptr, y1, x1, p_ptr->y, p_ptr->x) && (distance(y1, x1, p_ptr->y, p_ptr->x) <= rad)) hityou = TRUE;
}
}
else
t_ptr = &p_ptr->current_floor_ptr->m_list[target_idx];
/* Cancel if not projectable (for now) */
- if ((m_idx == target_idx) || !projectable(m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx))
+ if ((m_idx == target_idx) || !projectable(p_ptr->current_floor_ptr, m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx))
{
target_idx = 0;
}
}
/* Allow only summoning etc.. if not projectable */
- else if (!projectable(m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx))
+ else if (!projectable(p_ptr->current_floor_ptr, m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx))
{
f4 &= (RF4_INDIRECT_MASK);
f5 &= (RF5_INDIRECT_MASK);
if ((m_idx == target_idx) || !are_enemies(m_ptr, t_ptr)) continue;
/* Monster must be projectable */
- if (!projectable(m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx)) continue;
+ if (!projectable(p_ptr->current_floor_ptr, m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx)) continue;
/* Get it */
success = TRUE;
if (f4 & RF4_BR_LITE)
{
- if (!los(m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx))
+ if (!los(p_ptr->current_floor_ptr, m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx))
f4 &= ~(RF4_BR_LITE);
}
get_project_point(m_ptr->fy, m_ptr->fx, &real_y, &real_x, 0L);
- if (projectable(real_y, real_x, p_ptr->y, p_ptr->x))
+ if (projectable(p_ptr->current_floor_ptr, real_y, real_x, p_ptr->y, p_ptr->x))
{
int dist = distance(real_y, real_x, p_ptr->y, p_ptr->x);
}
else if (f5 & RF5_BA_LITE)
{
- if ((distance(real_y, real_x, p_ptr->y, p_ptr->x) <= 4) && los(real_y, real_x, p_ptr->y, p_ptr->x))
+ if ((distance(real_y, real_x, p_ptr->y, p_ptr->x) <= 4) && los(p_ptr->current_floor_ptr, real_y, real_x, p_ptr->y, p_ptr->x))
f5 &= ~(RF5_BA_LITE);
}
}
POSITION real_x = x;
get_project_point(m_ptr->fy, m_ptr->fx, &real_y, &real_x, PROJECT_STOP);
- if (projectable(real_y, real_x, p_ptr->y, p_ptr->x) && (distance(real_y, real_x, p_ptr->y, p_ptr->x) <= 2))
+ if (projectable(p_ptr->current_floor_ptr, real_y, real_x, p_ptr->y, p_ptr->x) && (distance(real_y, real_x, p_ptr->y, p_ptr->x) <= 2))
f4 &= ~(RF4_ROCKET);
}
m_idx = p_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx;
if (!m_idx) break;
if (!player_has_los_bold(p_ptr, target_row, target_col)) break;
- if (!projectable(p_ptr->y, p_ptr->x, target_row, target_col)) break;
+ if (!projectable(p_ptr->current_floor_ptr, p_ptr->y, p_ptr->x, target_row, target_col)) break;
dispel_monster_status(m_idx);
break;
}
if (!target_set(TARGET_KILL)) return FALSE;
if (!p_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx) break;
if (!player_has_los_bold(p_ptr, target_row, target_col)) break;
- if (!projectable(p_ptr->y, p_ptr->x, target_row, target_col)) break;
+ if (!projectable(p_ptr->current_floor_ptr, p_ptr->y, p_ptr->x, target_row, target_col)) break;
m_ptr = &p_ptr->current_floor_ptr->m_list[p_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx];
r_ptr = &r_info[m_ptr->r_idx];
monster_desc(m_name, m_ptr, 0);
if (!in_bounds(p_ptr->current_floor_ptr, ty, tx)) continue;
/* Require line of projection */
- if (!projectable(y, x, ty, tx)) continue;
+ if (!projectable(p_ptr->current_floor_ptr, y, x, ty, tx)) continue;
/* Obtain grid */
g_ptr = &p_ptr->current_floor_ptr->grid_array[ty][tx];
if (!cave_player_teleportable_bold(y, x, 0L) ||
(distance(y, x, caster_ptr->y, caster_ptr->x) > MAX_SIGHT / 2) ||
- !projectable(caster_ptr->y, caster_ptr->x, y, x))
+ !projectable(caster_ptr->current_floor_ptr, caster_ptr->y, caster_ptr->x, y, x))
{
msg_print(_("失敗!", "You cannot move to that place!"));
break;
m_ptr = &kohmon_ptr->current_floor_ptr->m_list[i];
if (!monster_is_valid(m_ptr)) continue;
if (!((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) continue;
- if (!los(m_ptr->fy, m_ptr->fx, kohmon_ptr->y, kohmon_ptr->x)) continue;
- if (!projectable(m_ptr->fy, m_ptr->fx, kohmon_ptr->y, kohmon_ptr->x)) continue;
+ if (!los(p_ptr->current_floor_ptr, m_ptr->fy, m_ptr->fx, kohmon_ptr->y, kohmon_ptr->x)) continue;
+ if (!projectable(kohmon_ptr->current_floor_ptr, m_ptr->fy, m_ptr->fx, kohmon_ptr->y, kohmon_ptr->x)) continue;
count++;
break;
}
extern void blood_curse_to_enemy(MONSTER_IDX m_idx);
extern bool fire_crimson(player_type *shooter_ptr);
extern bool tele_town(void);
+extern int project_length;
/* Is "teleport level" ineffective to this target? */
#define TELE_LEVEL_IS_INEFF(TARGET) \
(p_ptr->inside_quest && !random_quest_number(p_ptr->current_floor_ptr->dun_level)) || \
(((TARGET) <= 0) && (quest_number(p_ptr->current_floor_ptr->dun_level) || (p_ptr->current_floor_ptr->dun_level >= d_info[p_ptr->dungeon_idx].maxdepth)) && \
(p_ptr->current_floor_ptr->dun_level >= 1) && ironman_downward))
+
if (seen) obvious = TRUE;
/* PSI only works if the monster can see you! -- RG */
- if (!(los(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x)))
+ if (!(los(p_ptr->current_floor_ptr, m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x)))
{
if (seen_msg)
msg_format(_("%sはあなたが見えないので影響されない!", "%^s can't see you, and isn't affected!"), m_name);
t_y = target_ptr->current_floor_ptr->m_list[who].fy - 1 + randint1(3);
t_x = target_ptr->current_floor_ptr->m_list[who].fx - 1 + randint1(3);
max_attempts--;
- } while (max_attempts && in_bounds2u(target_ptr->current_floor_ptr, t_y, t_x) && !projectable(target_ptr->y, target_ptr->x, t_y, t_x));
+ } while (max_attempts && in_bounds2u(target_ptr->current_floor_ptr, t_y, t_x) && !projectable(target_ptr->current_floor_ptr, target_ptr->y, target_ptr->x, t_y, t_x));
if (max_attempts < 1)
{
case GF_LITE:
case GF_LITE_WEAK:
/* Lights are stopped by opaque terrains */
- if (!los(by, bx, y, x)) continue;
+ if (!los(p_ptr->current_floor_ptr, by, bx, y, x)) continue;
break;
case GF_DISINTEGRATE:
/* Disintegration are stopped only by perma-walls */
break;
default:
/* Ball explosions are stopped by walls */
- if (!projectable(by, bx, y, x)) continue;
+ if (!projectable(p_ptr->current_floor_ptr, by, bx, y, x)) continue;
break;
}
case GF_LITE:
case GF_LITE_WEAK:
/* Lights are stopped by opaque terrains */
- if (!los(by, bx, y, x)) continue;
+ if (!los(p_ptr->current_floor_ptr, by, bx, y, x)) continue;
break;
case GF_DISINTEGRATE:
/* Disintegration are stopped only by perma-walls */
break;
default:
/* Ball explosions are stopped by walls */
- if (!projectable(by, bx, y, x)) continue;
+ if (!projectable(p_ptr->current_floor_ptr, by, bx, y, x)) continue;
break;
}
if (flg & PROJECT_KILL)
{
see_s_msg = (who > 0) ? is_seen(&p_ptr->current_floor_ptr->m_list[who]) :
- (!who ? TRUE : (player_can_see_bold(y1, x1) && projectable(p_ptr->y, p_ptr->x, y1, x1)));
+ (!who ? TRUE : (player_can_see_bold(y1, x1) && projectable(p_ptr->current_floor_ptr, p_ptr->y, p_ptr->x, y1, x1)));
}
t_x = x_saver - 1 + randint1(3);
max_attempts--;
}
- while (max_attempts && in_bounds2u(p_ptr->current_floor_ptr, t_y, t_x) && !projectable(y, x, t_y, t_x));
+ while (max_attempts && in_bounds2u(p_ptr->current_floor_ptr, t_y, t_x) && !projectable(p_ptr->current_floor_ptr, y, x, t_y, t_x));
if (max_attempts < 1)
{
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->y, caster_ptr->x, y, x)
+ projectable(caster_ptr->current_floor_ptr, caster_ptr->y, caster_ptr->x, y, x)
) {
mirror_y[mirror_num] = y;
mirror_x[mirror_num] = x;
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->y, caster_ptr->x, y, x)) {
+ if (player_has_los_bold(caster_ptr, y, x) && projectable(caster_ptr->current_floor_ptr, caster_ptr->y, caster_ptr->x, y, x)) {
/* Visual effects */
if (!(caster_ptr->blind)
&& panel_contains(y, x)) {
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->y, caster_ptr->x, y, x)) {
+ if (player_has_los_bold(caster_ptr, y, x) && projectable(caster_ptr->current_floor_ptr, caster_ptr->y, caster_ptr->x, y, x)) {
(void)project_f(caster_ptr->current_floor_ptr, 0, 0, y, x, dam, GF_MANA);
}
}
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->y, caster_ptr->x, y, x)) {
+ if (player_has_los_bold(caster_ptr, y, x) && projectable(caster_ptr->current_floor_ptr, caster_ptr->y, caster_ptr->x, y, x)) {
(void)project_o(0, 0, y, x, dam, GF_MANA);
}
}
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->y, caster_ptr->x, y, x)) {
+ if (player_has_los_bold(caster_ptr, y, x) && projectable(caster_ptr->current_floor_ptr, caster_ptr->y, caster_ptr->x, y, x)) {
(void)project_m(0, 0, y, x, dam, GF_MANA,
(PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE);
}
x = m_ptr->fx;
/* Require line of sight */
- if (!player_has_los_bold(p_ptr, y, x) || !projectable(p_ptr->y, p_ptr->x, y, x)) continue;
+ if (!player_has_los_bold(p_ptr, y, x) || !projectable(p_ptr->current_floor_ptr, p_ptr->y, p_ptr->x, y, x)) continue;
/* Mark the monster */
m_ptr->mflag |= (MFLAG_LOS);
if (d >= 9) continue;
- if (!in_bounds(p_ptr->current_floor_ptr, y, x) || !projectable(p_ptr->y, p_ptr->x, y, x)
+ if (!in_bounds(p_ptr->current_floor_ptr, y, x) || !projectable(p_ptr->current_floor_ptr, p_ptr->y, p_ptr->x, y, x)
|| !cave_have_flag_bold(y, x, FF_PROJECT)) continue;
/* Valid position */
teleport_away(m_idx, MAX_SIGHT * 2 + 5, 0L);
- if (old_ml && (old_cdis <= MAX_SIGHT) && !current_world_ptr->timewalk_m_idx && !p_ptr->phase_out && los(p_ptr->y, p_ptr->x, oldfy, oldfx))
+ if (old_ml && (old_cdis <= MAX_SIGHT) && !current_world_ptr->timewalk_m_idx && !p_ptr->phase_out && los(p_ptr->current_floor_ptr, p_ptr->y, p_ptr->x, oldfy, oldfx))
{
bool follow = FALSE;
target_m_idx = p_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx;
if (!target_m_idx) return TRUE;
if (!player_has_los_bold(p_ptr, target_row, target_col)) return TRUE;
- if (!projectable(creature_ptr->y, creature_ptr->x, target_row, target_col)) return TRUE;
+ if (!projectable(creature_ptr->current_floor_ptr, creature_ptr->y, creature_ptr->x, target_row, target_col)) return TRUE;
m_ptr = &p_ptr->current_floor_ptr->m_list[target_m_idx];
r_ptr = &r_info[m_ptr->r_idx];
monster_desc(m_name, m_ptr, 0);
msg_print(_("そこはあなたの視界に入っていません。", "You have no direct line of sight to that location."));
return;
}
- else if (!projectable(caster_ptr->y, caster_ptr->x, ty, tx))
+ else if (!projectable(caster_ptr->current_floor_ptr, caster_ptr->y, caster_ptr->x, ty, tx))
{
msg_print(_("そこは壁の向こうです。", "You have no direct line of sight to that location."));
return;
if (p_ptr->riding && (p_ptr->riding == m_idx)) return (TRUE);
/* Monster must be projectable */
- if (!projectable(p_ptr->y, p_ptr->x, m_ptr->fy, m_ptr->fx)) return (FALSE);
+ if (!projectable(p_ptr->current_floor_ptr, p_ptr->y, p_ptr->x, m_ptr->fy, m_ptr->fx)) return (FALSE);
/* Hack -- Never target trappers */
/* if (CLEAR_ATTR && (CLEAR_CHAR)) return (FALSE); */
{
char cheatinfo[30];
sprintf(cheatinfo, " LOS:%d, PROJECTABLE:%d",
- los(p_ptr->y, p_ptr->x, y, x), projectable(p_ptr->y, p_ptr->x, y, x));
+ los(p_ptr->current_floor_ptr, p_ptr->y, p_ptr->x, y, x), projectable(p_ptr->current_floor_ptr, p_ptr->y, p_ptr->x, y, x));
strcat(info, cheatinfo);
}
{
char cheatinfo[100];
sprintf(cheatinfo, " LOS:%d, PROJECTABLE:%d, SPECIAL:%d",
- los(p_ptr->y, p_ptr->x, y, x),
- projectable(p_ptr->y, p_ptr->x, y, x), g_ptr->special);
+ los(p_ptr->current_floor_ptr, p_ptr->y, p_ptr->x, y, x),
+ projectable(p_ptr->current_floor_ptr, p_ptr->y, p_ptr->x, y, x), g_ptr->special);
strcat(info, cheatinfo);
}
if (!in_bounds(p_ptr->current_floor_ptr, y1, x1)) continue;
/* Require line of projection */
- if (!projectable(trapped_ptr->y, trapped_ptr->x, y1, x1)) continue;
+ if (!projectable(p_ptr->current_floor_ptr, trapped_ptr->y, trapped_ptr->x, y1, x1)) continue;
if (summon_specific(0, y1, x1, lev, SUMMON_ARMAGE_EVIL, (PM_NO_PET)))
evil_idx = hack_m_idx_ii;
r_ptr = &r_info[m_ptr->r_idx];
/* Monster spells (only powerful ones)*/
- if (projectable(my, mx, yy, xx))
+ if (projectable(p_ptr->current_floor_ptr, my, mx, yy, xx))
{
BIT_FLAGS f4 = r_ptr->flags4;
BIT_FLAGS f5 = r_ptr->a_ability_flags1;