OSDN Git Service

[Refactor] #38997 los(), projectable() に player_type * 引数を追加. / Add player_type ...
authordeskull <deskull@users.sourceforge.jp>
Tue, 3 Dec 2019 15:15:09 +0000 (00:15 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Wed, 4 Dec 2019 23:51:02 +0000 (08:51 +0900)
25 files changed:
src/cmd/cmd-mane.c
src/floor-events.c
src/floor-save.c
src/floor.c
src/floor.h
src/geometry.c
src/geometry.h
src/grid.h
src/mind.c
src/monster-process.c
src/monster-status.c
src/monster2.c
src/mspells1.c
src/mspells2.c
src/mspells3.c
src/object2.c
src/realm-hissatsu.c
src/spells-summon.c
src/spells.h
src/spells1.c
src/spells2.c
src/spells3.c
src/targeting.c
src/trap.c
src/warning.c

index 2bba794..54c471f 100644 (file)
@@ -294,7 +294,7 @@ static bool use_mane(player_type *caster_ptr, int spell)
                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;
        }
@@ -682,7 +682,7 @@ static bool use_mane(player_type *caster_ptr, int spell)
                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);
index 1a2d279..dd37dbd 100644 (file)
@@ -768,7 +768,7 @@ static bool update_view_aux(POSITION y, POSITION x, POSITION y1, POSITION x1, PO
 
 
        /* 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);
 
index b6b3760..b84d705 100644 (file)
@@ -451,8 +451,8 @@ static void preserve_pet(void)
                                 * 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;
                                }
index 17c5571..b504bb6 100644 (file)
@@ -274,3 +274,299 @@ void place_random_stairs(floor_type *floor_ptr, POSITION y, POSITION x)
        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);
+}
+
index 75e9ff1..2809bba 100644 (file)
@@ -380,4 +380,6 @@ extern void place_locked_door(floor_type *floor_ptr, POSITION y, POSITION x);
 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;
index 515b6f1..053fb83 100644 (file)
@@ -454,302 +454,6 @@ sint project_path(u16b *gp, POSITION range, POSITION y1, POSITION x1, POSITION y
        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
@@ -781,11 +485,11 @@ void scatter(POSITION *yp, POSITION *xp, POSITION y, POSITION x, POSITION d, BIT
 
                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;
                }
 
        }
index 03d5e3e..2a594d0 100644 (file)
@@ -35,9 +35,7 @@ extern DIRECTION coords_to_dir(player_type *creature_ptr, POSITION y, POSITION x
 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);
 
@@ -86,5 +84,5 @@ struct coord
  */
 #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)))))
 
index 46a3e0f..2877ae6 100644 (file)
@@ -401,7 +401,6 @@ extern bool player_can_enter(FEAT_IDX feature, BIT_FLAGS16 mode);
 
 /* 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);
index e1584ea..f14b155 100644 (file)
@@ -1246,7 +1246,7 @@ static bool cast_force_spell(player_type *caster_ptr, int spell)
                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;
        }
@@ -1647,7 +1647,7 @@ static bool cast_ninja_spell(player_type *caster_ptr, int spell)
                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);
index 8d7002b..5ccc996 100644 (file)
@@ -125,7 +125,7 @@ static bool get_enemy_dir(MONSTER_IDX m_idx, int *mm)
                        }
                        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 */
@@ -310,7 +310,7 @@ static bool get_moves_aux2(MONSTER_IDX m_idx, POSITION *yp, POSITION *xp)
        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;
@@ -352,7 +352,7 @@ static bool get_moves_aux2(MONSTER_IDX m_idx, POSITION *yp, POSITION *xp)
 
                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;
@@ -430,7 +430,7 @@ static bool get_moves_aux(MONSTER_IDX m_idx, POSITION *yp, POSITION *xp, bool no
        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];
@@ -757,7 +757,7 @@ static bool find_safety(MONSTER_IDX m_idx, POSITION *yp, POSITION *xp)
                        }
 
                        /* 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);
@@ -837,7 +837,7 @@ static bool find_hiding(MONSTER_IDX m_idx, POSITION *yp, POSITION *xp)
                        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);
@@ -898,8 +898,8 @@ static bool get_moves(MONSTER_IDX m_idx, DIRECTION *mm)
                /* 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;
@@ -910,7 +910,7 @@ static bool get_moves(MONSTER_IDX m_idx, DIRECTION *mm)
 
        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)))
        {
        /*
@@ -1400,7 +1400,7 @@ void process_monster(MONSTER_IDX m_idx)
                                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);
                                        }
@@ -1568,7 +1568,7 @@ void process_monster(MONSTER_IDX m_idx)
                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];
@@ -1610,7 +1610,7 @@ void process_monster(MONSTER_IDX m_idx)
 
                        /* 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;
                        }
@@ -2209,7 +2209,7 @@ void process_monster(MONSTER_IDX m_idx)
                        /* 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))
index 9c6af39..7e3e43f 100644 (file)
@@ -839,7 +839,7 @@ bool set_monster_timewalk(int num, MONSTER_IDX who, bool vs_player)
        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);
index 15fc329..aac4613 100644 (file)
@@ -2133,7 +2133,7 @@ void update_monster(MONSTER_IDX m_idx, bool full)
                        }
 
                        /* 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);
@@ -2913,7 +2913,7 @@ static bool mon_scatter(MONRACE_IDX r_idx, POSITION *yp, POSITION *xp, POSITION
                        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)
                        {
index 59df968..3dc2b9e 100644 (file)
@@ -398,7 +398,7 @@ bool summon_possible(POSITION y1, POSITION x1)
                        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);
                }
        }
 
@@ -425,8 +425,8 @@ bool raise_possible(monster_type *m_ptr)
                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 */
@@ -1246,7 +1246,7 @@ bool spell_is_inate(SPELL_IDX spell)
  * @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;
@@ -1276,7 +1276,7 @@ static bool adjacent_grid_check(monster_type *m_ptr, POSITION *yp, POSITION *xp,
                /* 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;
@@ -1423,7 +1423,7 @@ bool make_attack_spell(MONSTER_IDX m_idx)
                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];
 
@@ -1445,7 +1445,7 @@ bool make_attack_spell(MONSTER_IDX m_idx)
        }
 
        /* 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];
 
@@ -1466,13 +1466,13 @@ bool make_attack_spell(MONSTER_IDX m_idx)
 
                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;
@@ -1481,7 +1481,7 @@ bool make_attack_spell(MONSTER_IDX m_idx)
                {
                        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;
index 5a5a021..112ab93 100644 (file)
@@ -168,13 +168,13 @@ static bool breath_direct(POSITION y1, POSITION x1, POSITION y2, POSITION x2, PO
                }
                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
@@ -317,7 +317,7 @@ bool monst_spell_monst(MONSTER_IDX m_idx)
                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;
                }
@@ -340,7 +340,7 @@ bool monst_spell_monst(MONSTER_IDX m_idx)
                        }
 
                        /* 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);
@@ -376,7 +376,7 @@ bool monst_spell_monst(MONSTER_IDX m_idx)
                        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;
@@ -400,7 +400,7 @@ bool monst_spell_monst(MONSTER_IDX m_idx)
 
        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);
        }
 
@@ -491,7 +491,7 @@ bool monst_spell_monst(MONSTER_IDX m_idx)
 
                                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);
 
@@ -510,7 +510,7 @@ bool monst_spell_monst(MONSTER_IDX m_idx)
                                }
                                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);
                                }
                        }
@@ -521,7 +521,7 @@ bool monst_spell_monst(MONSTER_IDX m_idx)
                                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);
                        }
 
index 803ddbe..024ae10 100644 (file)
@@ -864,7 +864,7 @@ static bool cast_learned_spell(int spell, bool success)
                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;
        }
@@ -1305,7 +1305,7 @@ static bool cast_learned_spell(int spell, bool success)
                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);
index 798b0fd..c45b737 100644 (file)
@@ -4642,7 +4642,7 @@ OBJECT_IDX drop_near(object_type *j_ptr, PERCENTAGE chance, POSITION y, POSITION
                        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];
index 388a085..cb17949 100644 (file)
@@ -800,7 +800,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo
 
                        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;
index 7f6d307..fe10506 100644 (file)
@@ -315,8 +315,8 @@ void mitokohmon(player_type *kohmon_ptr)
                        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;
                }
index 4d9a4fd..5f220ad 100644 (file)
@@ -327,6 +327,7 @@ extern bool detonation(player_type *creature_ptr);
 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) \
@@ -334,3 +335,4 @@ extern bool tele_town(void);
         (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))
+
index e057bfd..52d1f13 100644 (file)
@@ -1694,7 +1694,7 @@ static bool project_m(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_P
                                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);
@@ -4053,7 +4053,7 @@ static bool project_p(MONSTER_IDX who, player_type *target_ptr, concptr who_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)
                        {
@@ -5373,7 +5373,7 @@ void breath_shape(u16b *path_g, int dist, int *pgrids, POSITION *gx, POSITION *g
                                        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 */
@@ -5381,7 +5381,7 @@ void breath_shape(u16b *path_g, int dist, int *pgrids, POSITION *gx, POSITION *g
                                                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;
                                        }
 
@@ -6136,7 +6136,7 @@ bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT da
                                                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 */
@@ -6144,7 +6144,7 @@ bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT da
                                                        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;
                                                }
 
@@ -6241,7 +6241,7 @@ bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT da
        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)));
        }
 
 
@@ -6355,7 +6355,7 @@ bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT da
                                                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)
                                        {
@@ -6628,7 +6628,7 @@ bool binding_field(player_type *caster_ptr, HIT_POINT dam)
                                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;
@@ -6677,7 +6677,7 @@ bool binding_field(player_type *caster_ptr, HIT_POINT dam)
                                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)) {
@@ -6700,7 +6700,7 @@ bool binding_field(player_type *caster_ptr, HIT_POINT dam)
                                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);
                                }
                        }
@@ -6715,7 +6715,7 @@ bool binding_field(player_type *caster_ptr, HIT_POINT dam)
                                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);
                                }
                        }
@@ -6730,7 +6730,7 @@ bool binding_field(player_type *caster_ptr, HIT_POINT dam)
                                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);
                                }
index 1ac603b..011ae07 100644 (file)
@@ -796,7 +796,7 @@ bool project_all_los(EFFECT_ID typ, HIT_POINT dam)
                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);
@@ -3322,7 +3322,7 @@ void cast_meteor(HIT_POINT dam, POSITION rad)
 
                        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 */
index 64149b0..6db77d0 100644 (file)
@@ -542,7 +542,7 @@ void teleport_away_followable(MONSTER_IDX m_idx)
 
        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;
 
@@ -596,7 +596,7 @@ bool teleport_level_other(player_type *creature_ptr)
        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);
@@ -1292,7 +1292,7 @@ void fetch(player_type *caster_ptr, DIRECTION dir, WEIGHT wgt, bool require_los)
                                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;
index 1e9303b..75f9651 100644 (file)
@@ -224,7 +224,7 @@ bool target_able(MONSTER_IDX m_idx)
        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); */
@@ -1117,7 +1117,7 @@ bool target_set(BIT_FLAGS mode)
                        {
                                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);
                        }
                        
@@ -1345,8 +1345,8 @@ bool target_set(BIT_FLAGS mode)
                        {
                                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);
                        }
 
index 6af902a..dba71f1 100644 (file)
@@ -623,7 +623,7 @@ void hit_trap(player_type *trapped_ptr, bool break_trap)
                                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;
index 3d9eca7..65cf3f4 100644 (file)
@@ -429,7 +429,7 @@ bool process_warning(POSITION xx, POSITION yy)
                        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;