while (attempts--)
{
- scatter(&y, &x, user_ptr->y, user_ptr->x, 4, 0);
+ scatter(user_ptr->current_floor_ptr, &y, &x, user_ptr->y, user_ptr->x, 4, 0);
if (!cave_have_flag_bold(user_ptr->current_floor_ptr, y, x, FF_PROJECT)) continue;
if (!player_bold(user_ptr, y, x)) break;
}
{
for (j = 1000; j > 0; j--)
{
- scatter(&cy, &cx, master_ptr->y, master_ptr->x, d, 0);
+ scatter(master_ptr->current_floor_ptr, &cy, &cx, master_ptr->y, master_ptr->x, d, 0);
if (monster_can_enter(cy, cx, &r_info[party_mon[i].r_idx], 0)) break;
}
if (j) break;
int d = 1;
/* Pick a nearby location */
- scatter(&y, &x, y1, x1, d, 0);
+ scatter(floor_ptr, &y, &x, y1, x1, d, 0);
/* Require "empty" floor grids */
g_ptr = &floor_ptr->grid_array[y][x];
vault_trap_aux(floor_ptr, y, x, yd, xd);
}
}
+
+
+/*
+ * Standard "find me a location" function
+ *
+ * Obtains a legal location within the given distance of the initial
+ * location, and with "los()" from the source to destination location.
+ *
+ * This function is often called from inside a loop which searches for
+ * locations while increasing the "d" distance.
+ *
+ * Currently the "m" parameter is unused.
+ */
+void scatter(floor_type *floor_ptr, POSITION *yp, POSITION *xp, POSITION y, POSITION x, POSITION d, BIT_FLAGS mode)
+{
+ POSITION nx, ny;
+
+ /* Pick a location */
+ while (TRUE)
+ {
+ /* Pick a new location */
+ ny = rand_spread(y, d);
+ nx = rand_spread(x, d);
+
+ /* Ignore annoying locations */
+ if (!in_bounds(floor_ptr, ny, nx)) continue;
+
+ /* Ignore "excessively distant" locations */
+ if ((d > 1) && (distance(y, x, ny, nx) > d)) continue;
+
+ if (mode & PROJECT_LOS)
+ {
+ if (los(floor_ptr, y, x, ny, nx)) break;
+ }
+ else
+ {
+ if (projectable(floor_ptr, y, x, ny, nx)) break;
+ }
+
+ }
+
+ /* Save the location */
+ (*yp) = ny;
+ (*xp) = nx;
+}
extern void delete_monster(floor_type *floor_ptr, POSITION y, POSITION x);
extern void compact_objects(floor_type *floor_ptr, int size);
extern void vault_traps(floor_type *floor_ptr, POSITION y, POSITION x, POSITION yd, POSITION xd, int num);
+extern void scatter(floor_type *floor_ptr, POSITION *yp, POSITION *xp, POSITION y, POSITION x, POSITION d, BIT_FLAGS mode);
}
-/*
- * Standard "find me a location" function
- *
- * Obtains a legal location within the given distance of the initial
- * location, and with "los()" from the source to destination location.
- *
- * This function is often called from inside a loop which searches for
- * locations while increasing the "d" distance.
- *
- * Currently the "m" parameter is unused.
- */
-void scatter(POSITION *yp, POSITION *xp, POSITION y, POSITION x, POSITION d, BIT_FLAGS mode)
-{
- POSITION nx, ny;
-
- /* Pick a location */
- while (TRUE)
- {
- /* Pick a new location */
- ny = rand_spread(y, d);
- nx = rand_spread(x, d);
-
- /* Ignore annoying locations */
- if (!in_bounds(p_ptr->current_floor_ptr, ny, nx)) continue;
-
- /* Ignore "excessively distant" locations */
- if ((d > 1) && (distance(y, x, ny, nx) > d)) continue;
-
- if (mode & PROJECT_LOS)
- {
- if (los(p_ptr->current_floor_ptr, y, x, ny, nx)) break;
- }
- else
- {
- if (projectable(p_ptr->current_floor_ptr, y, x, ny, nx)) break;
- }
-
- }
-
- /* Save the location */
- (*yp) = ny;
- (*xp) = nx;
-}
-
/*!
* @brief 指定された座標をプレイヤーが視覚に収められるかを返す。 / Can the player "see" the given grid in detail?
extern POSITION distance(POSITION y1, POSITION x1, POSITION y2, POSITION x2);
-extern void scatter(POSITION *yp, POSITION *xp, POSITION y, POSITION x, POSITION d, BIT_FLAGS mode);
extern void mmove2(POSITION *y, POSITION *x, POSITION y1, POSITION x1, POSITION y2, POSITION x2);
extern bool player_can_see_bold(player_type *creature_ptr, POSITION y, POSITION x);
while (attempts--)
{
- scatter(&y, &x, caster_ptr->y, caster_ptr->x, 4, 0);
+ scatter(caster_ptr->current_floor_ptr, &y, &x, caster_ptr->y, caster_ptr->x, 4, 0);
if (!player_bold(caster_ptr, y, x)) break;
}
do
{
- scatter(&wy, &wx, y, x, 20, 0);
+ scatter(p_ptr->current_floor_ptr, &wy, &wx, y, x, 20, 0);
} while (!(in_bounds(p_ptr->current_floor_ptr, wy, wx) && cave_empty_bold2(p_ptr->current_floor_ptr, wy, wx)) && --attempts);
if (attempts > 0)
{
POSITION mx, my;
- scatter(&my, &mx, hy, hx, 4, 0);
+ scatter(p_ptr->current_floor_ptr, &my, &mx, hy, hx, 4, 0);
/* Walls and Monsters block flow */
if (!cave_empty_bold2(p_ptr->current_floor_ptr, my, mx)) continue;
for(j = 0; j < n; j++)
{
POSITION nx, ny, d = 7;
- scatter(&ny, &nx, y, x, d, 0);
+ scatter(p_ptr->current_floor_ptr, &ny, &nx, y, x, d, 0);
(void)place_monster_one(place_monster_m_idx, ny, nx, r_ptr->reinforce_id[i], mode);
}
}
MONRACE_IDX z;
/* Pick a location */
- scatter(&ny, &nx, y, x, d, 0);
+ scatter(p_ptr->current_floor_ptr, &ny, &nx, y, x, d, 0);
/* Require empty grids */
if (!cave_empty_bold2(p_ptr->current_floor_ptr, ny, nx)) continue;
for (attempts = randint1(10) + 5; attempts; attempts--)
{
- scatter(&cy, &cx, y, x, 5, 0);
+ scatter(p_ptr->current_floor_ptr, &cy, &cx, y, x, 5, 0);
(void)summon_specific(m_idx, cy, cx, p_ptr->current_floor_ptr->dun_level + 5, SUMMON_KIN, PM_ALLOW_GROUP);
int j;
for (j = 100; j > 0; j--)
{
- scatter(&cy, &cx, y, x, 2, 0);
+ scatter(p_ptr->current_floor_ptr, &cy, &cx, y, x, 2, 0);
if (cave_empty_bold(p_ptr->current_floor_ptr, cy, cx)) break;
}
if (!j) break;
while (to_ruin--)
{
- scatter(&r_y, &r_x, creature_ptr->y, creature_ptr->x, 4, 0);
+ scatter(p_ptr->current_floor_ptr, &r_y, &r_x, creature_ptr->y, creature_ptr->x, 4, 0);
if (pattern_tile(r_y, r_x) &&
(f_info[p_ptr->current_floor_ptr->grid_array[r_y][r_x].feat].subtype != PATTERN_TILE_WRECKED))
while (cave_perma_bold(p_ptr->current_floor_ptr, y, x) || p_ptr->current_floor_ptr->grid_array[y][x].o_idx || (p_ptr->current_floor_ptr->grid_array[y][x].info & CAVE_OBJECT))
{
/* Pick a location */
- scatter(&ny, &nx, y, x, 1, 0);
+ scatter(p_ptr->current_floor_ptr, &ny, &nx, y, x, 1, 0);
/* Stagger */
y = ny; x = nx;
while (attempt--)
{
- scatter(&my, &mx, caster_ptr->y, caster_ptr->x, 4, 0);
+ scatter(caster_ptr->current_floor_ptr, &my, &mx, caster_ptr->y, caster_ptr->x, 4, 0);
/* Require empty grids */
if (cave_empty_bold2(caster_ptr->current_floor_ptr, my, mx)) break;
while (attempts--)
{
- scatter(&y, &x, caster_ptr->y, caster_ptr->x, 4, PROJECT_LOS);
+ scatter(caster_ptr->current_floor_ptr, &y, &x, caster_ptr->y, caster_ptr->x, 4, PROJECT_LOS);
if (!cave_have_flag_bold(caster_ptr->current_floor_ptr, y, x, FF_PROJECT)) continue;
if (!player_bold(caster_ptr, y, x)) break;
}
{
while (attempts--)
{
- scatter(&y, &x, caster_ptr->y, caster_ptr->x, 4, 0);
+ scatter(caster_ptr->current_floor_ptr, &y, &x, caster_ptr->y, caster_ptr->x, 4, 0);
if (!cave_have_flag_bold(caster_ptr->current_floor_ptr, y, x, FF_PROJECT)) continue;
{
while (TRUE)
{
- scatter(&y, &x, caster_ptr->y, caster_ptr->x, 10, 0);
+ scatter(caster_ptr->current_floor_ptr, &y, &x, caster_ptr->y, caster_ptr->x, 10, 0);
if (!player_bold(caster_ptr, y, x)) break;
}
while (--attempts)
{
- scatter(&wy, &wx, caster_ptr->y, caster_ptr->x, 3, 0);
+ scatter(caster_ptr->current_floor_ptr, &wy, &wx, caster_ptr->y, caster_ptr->x, 3, 0);
if (cave_empty_bold(caster_ptr->current_floor_ptr, wy, wx)) break;
}