static void set_nearest_player_xy(int x, int y, int *dx, int *dy)
{
- int distance, distance_shortest = EM_MAX_CAVE_WIDTH + EM_MAX_CAVE_HEIGHT;
+ int distance, distance_shortest = CAVE_WIDTH + CAVE_HEIGHT;
int i;
/* default values if no players are alive anymore */
seed = RandomEM;
score = 0;
- for (y = 1; y < HEIGHT - 1; y++)
- for (x = 0; x < WIDTH; x++)
+ for (y = lev.top; y < lev.bottom; y++)
+ for (x = lev.left; x < lev.right; x++)
handle_tile(x, y);
if (ply[0].alive || ply[1].alive || ply[2].alive || ply[3].alive)
for (count = lev.amoeba_time; count--;)
{
- x = (random >> 10) % (WIDTH - 2);
- y = (random >> 20) % (HEIGHT - 2);
+ x = lev.left - 1 + (random >> 10) % CAVE_WIDTH;
+ y = lev.top - 1 + (random >> 20) % CAVE_HEIGHT;
- Lamoeba(x, y);
+ if (x >= lev.left && x < lev.right &&
+ y >= lev.top && y < lev.bottom)
+ Lamoeba(x, y);
random = random * 129 + 1;
}
/* handle explosions */
- for (y = 1; y < HEIGHT - 1; y++)
- for (x = 1; x < WIDTH - 1; x++)
+ for (y = lev.top; y < lev.bottom; y++)
+ for (x = lev.left; x < lev.right; x++)
Lexplode(x, y);
/* triple buffering */
- for (y = 0; y < HEIGHT; y++)
- for (x = 0; x < WIDTH; x++)
+ for (y = lev.top; y < lev.bottom; y++)
+ for (x = lev.left; x < lev.right; x++)
next[x][y] = cave[x][y];
}