}
/* first fill the complete playfield with the default border element */
- for (y = 0; y < HEIGHT; y++)
- for (x = 0; x < WIDTH; x++)
+ for (y = 0; y < CAVE_HEIGHT; y++)
+ for (x = 0; x < CAVE_WIDTH; x++)
native_em_level.cave[x][y] = Zborder;
/* then copy the real level contents from level file into the playfield */
/* reset all runtime variables to their initial values */
- for (y = 0; y < HEIGHT; y++)
- for (x = 0; x < WIDTH; x++)
+ for (y = 0; y < CAVE_HEIGHT; y++)
+ for (x = 0; x < CAVE_WIDTH; x++)
lev.cave[x][y] = native_em_level.cave[x][y];
- for (y = 0; y < HEIGHT; y++)
- for (x = 0; x < WIDTH; x++)
+ for (y = 0; y < CAVE_HEIGHT; y++)
+ for (x = 0; x < CAVE_WIDTH; x++)
lev.next[x][y] = lev.cave[x][y];
- for (y = 0; y < HEIGHT; y++)
- for (x = 0; x < WIDTH; x++)
+ for (y = 0; y < CAVE_HEIGHT; y++)
+ for (x = 0; x < CAVE_WIDTH; x++)
lev.draw[x][y] = lev.cave[x][y];
lev.time_initial = lev.time_seconds;
#define EM_ENGINE_USE_ADDITIONAL_ELEMENTS
/* one border for Zborder elements, one border for steelwall, if needed */
-#define EM_MAX_CAVE_WIDTH (MAX_PLAYFIELD_WIDTH + 2 + 2)
-#define EM_MAX_CAVE_HEIGHT (MAX_PLAYFIELD_HEIGHT + 2 + 2)
+#define CAVE_WIDTH (MAX_PLAYFIELD_WIDTH + 2 + 2)
+#define CAVE_HEIGHT (MAX_PLAYFIELD_HEIGHT + 2 + 2)
/*
-----------------------------------------------------------------------------
int exit_x, exit_y; /* kludge for playing player exit sound */
- short cavebuf[EM_MAX_CAVE_WIDTH][EM_MAX_CAVE_HEIGHT];
- short nextbuf[EM_MAX_CAVE_WIDTH][EM_MAX_CAVE_HEIGHT];
- short drawbuf[EM_MAX_CAVE_WIDTH][EM_MAX_CAVE_HEIGHT];
- short boombuf[EM_MAX_CAVE_WIDTH][EM_MAX_CAVE_HEIGHT];
+ short cavebuf[CAVE_WIDTH][CAVE_HEIGHT];
+ short nextbuf[CAVE_WIDTH][CAVE_HEIGHT];
+ short drawbuf[CAVE_WIDTH][CAVE_HEIGHT];
+ short boombuf[CAVE_WIDTH][CAVE_HEIGHT];
- short *cavecol[EM_MAX_CAVE_WIDTH];
- short *nextcol[EM_MAX_CAVE_WIDTH];
- short *drawcol[EM_MAX_CAVE_WIDTH];
- short *boomcol[EM_MAX_CAVE_WIDTH];
+ short *cavecol[CAVE_WIDTH];
+ short *nextcol[CAVE_WIDTH];
+ short *drawcol[CAVE_WIDTH];
+ short *boomcol[CAVE_WIDTH];
short **cave;
short **next;
#include "emerald.h"
+// ----------------------------------------------------------------------------
+// constant definitions
+// ----------------------------------------------------------------------------
+
+#define EM_MAX_CAVE_WIDTH CAVE_WIDTH
+#define EM_MAX_CAVE_HEIGHT CAVE_HEIGHT
+
+
// ----------------------------------------------------------------------------
// exported structures
// ----------------------------------------------------------------------------
{
int file_version;
- short cave[EM_MAX_CAVE_WIDTH][EM_MAX_CAVE_HEIGHT];
+ short cave[CAVE_WIDTH][CAVE_HEIGHT];
struct LEVEL *lev;
struct PLAYER *ply[MAX_PLAYERS];
};
if (!game.use_native_emc_graphics_engine)
- for (y = 2; y < EM_MAX_CAVE_HEIGHT - 2; y++)
- for (x = 2; x < EM_MAX_CAVE_WIDTH - 2; x++)
+ for (y = 2; y < CAVE_HEIGHT - 2; y++)
+ for (x = 2; x < CAVE_WIDTH - 2; x++)
SetGfxAnimation_EM(&graphic_info_em_object[lev.draw[x][y]][frame],
lev.draw[x][y], 7 - frame, x - 2, y - 2);
int yy = y + xy[i][1];
int tile_next;
- if (xx < 0 || xx >= EM_MAX_CAVE_WIDTH ||
- yy < 0 || yy >= EM_MAX_CAVE_HEIGHT)
+ if (xx < 0 || xx >= CAVE_WIDTH ||
+ yy < 0 || yy >= CAVE_HEIGHT)
continue;
tile_next = lev.draw[xx][yy];
RandomEM = 1684108901;
- for (y = 0; y < HEIGHT; y++)
- for (x = 0; x < WIDTH; x++)
+ for (y = 0; y < CAVE_HEIGHT; y++)
+ for (x = 0; x < CAVE_WIDTH; x++)
lev.cavebuf[x][y] = Zborder;
- for (y = 0; y < HEIGHT; y++)
- for (x = 0; x < WIDTH; x++)
+ for (y = 0; y < CAVE_HEIGHT; y++)
+ for (x = 0; x < CAVE_WIDTH; x++)
lev.nextbuf[x][y] = Zborder;
- for (y = 0; y < HEIGHT; y++)
- for (x = 0; x < WIDTH; x++)
+ for (y = 0; y < CAVE_HEIGHT; y++)
+ for (x = 0; x < CAVE_WIDTH; x++)
lev.drawbuf[x][y] = Zborder;
- for (y = 0; y < HEIGHT; y++)
- for (x = 0; x < WIDTH; x++)
+ for (y = 0; y < CAVE_HEIGHT; y++)
+ for (x = 0; x < CAVE_WIDTH; x++)
lev.boombuf[x][y] = Xblank;
- for (x = 0; x < WIDTH; x++)
+ for (x = 0; x < CAVE_WIDTH; x++)
lev.cavecol[x] = lev.cavebuf[x];
- for (x = 0; x < WIDTH; x++)
+ for (x = 0; x < CAVE_WIDTH; x++)
lev.nextcol[x] = lev.nextbuf[x];
- for (x = 0; x < WIDTH; x++)
+ for (x = 0; x < CAVE_WIDTH; x++)
lev.drawcol[x] = lev.drawbuf[x];
- for (x = 0; x < WIDTH; x++)
+ for (x = 0; x < CAVE_WIDTH; x++)
lev.boomcol[x] = lev.boombuf[x];
lev.cave = lev.cavecol;
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 = 1; y < CAVE_HEIGHT - 1; y++)
+ for (x = 0; x < CAVE_WIDTH; 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 = (random >> 10) % (CAVE_WIDTH - 2);
+ y = (random >> 20) % (CAVE_HEIGHT - 2);
Lamoeba(x, y);
/* handle explosions */
- for (y = 1; y < HEIGHT - 1; y++)
- for (x = 1; x < WIDTH - 1; x++)
+ for (y = 1; y < CAVE_HEIGHT - 1; y++)
+ for (x = 1; x < CAVE_WIDTH - 1; x++)
Lexplode(x, y);
/* triple buffering */
- for (y = 0; y < HEIGHT; y++)
- for (x = 0; x < WIDTH; x++)
+ for (y = 0; y < CAVE_HEIGHT; y++)
+ for (x = 0; x < CAVE_WIDTH; x++)
next[x][y] = cave[x][y];
}
#define FILE_VERSION_EM_ACTUAL FILE_VERSION_EM_V6
-/* level sizes and positions for EM engine */
-
-#define WIDTH EM_MAX_CAVE_WIDTH
-#define HEIGHT EM_MAX_CAVE_HEIGHT
-
/* screen sizes and positions for EM engine */
#define TILESIZE 32