+2006-02-15
+ * fixed bug with adding score when playing tape with EMC game engine
+ * added steel wall border for levels using EMC engine without border
+ * finally fixed delayed scrolling in EMC engine also for small levels
+
2006-02-12
* fixed potential crash bug in WarnBuggyBase() (missing boundary check)
-#define COMPILE_DATE_STRING "[2006-02-12 13:35]"
+#define COMPILE_DATE_STRING "[2006-02-15 23:26]"
#define CONF_CONTENTS_ELEMENT(b,c,x,y) ((b[CONF_CONTENT_BYTE_POS(c,x,y)]<< 8)|\
(b[CONF_CONTENT_BYTE_POS(c,x,y) + 1]))
+#if 0
+static void LoadLevel_InitPlayfield(struct LevelInfo *, char *);
+#endif
+
static struct LevelInfo li;
static struct
for (x = 0; x < EM_MAX_CAVE_WIDTH; x++)
level_em->cave[x][y] = ZBORDER;
+#if 1
+
+#if 0
+#if 1
+ LoadLevel_InitPlayfield();
+#else
+ lev_fieldx = lev->width; /* !!! also in LoadLevel_InitPlayfield() !!! */
+ lev_fieldy = lev->height; /* !!! also in LoadLevel_InitPlayfield() !!! */
+ SetBorderElement(); /* !!! also in LoadLevel_InitPlayfield() !!! */
+#endif
+#endif
+
+#if 0
+ printf("::: BorderElement == %d\n", BorderElement);
+#endif
+
+ if (BorderElement == EL_STEELWALL)
+ {
+ for (y = 0; y < lev->height + 2; y++)
+ for (x = 0; x < lev->width + 2; x++)
+ level_em->cave[x + 1][y + 1] = map_element_RND_to_EM(EL_STEELWALL);
+ }
+
+ /* then copy the real level contents from level file into the playfield */
+ for (y = 0; y < lev->height; y++) for (x = 0; x < lev->width; x++)
+ {
+ int new_element = map_element_RND_to_EM(level->field[x][y]);
+ int offset = (BorderElement == EL_STEELWALL ? 1 : 0);
+ int xx = x + 1 + offset;
+ int yy = y + 1 + offset;
+
+ if (level->field[x][y] == EL_AMOEBA_DEAD)
+ new_element = map_element_RND_to_EM(EL_AMOEBA_WET);
+
+ level_em->cave[xx][yy] = new_element;
+ }
+
+#else
+
/* then copy the real level contents from level file into the playfield */
for (y = 0; y < lev->height; y++) for (x = 0; x < lev->width; x++)
{
level_em->cave[x + 1][y + 1] = new_element;
}
+#endif
+
#if 1
for (i = 0; i < MAX_PLAYERS; i++)
{
#if 1
-
if (ELEM_IS_PLAYER(level->field[x][y]))
{
int player_nr = GET_PLAYER_NR(level->field[x][y]);
+ int offset = (BorderElement == EL_STEELWALL ? 1 : 0);
+ int xx = x + 1 + offset;
+ int yy = y + 1 + offset;
- ply[player_nr]->x_initial = x + 1;
- ply[player_nr]->y_initial = y + 1;
+ ply[player_nr]->x_initial = xx;
+ ply[player_nr]->y_initial = yy;
- level_em->cave[x + 1][y + 1] = map_element_RND_to_EM(EL_EMPTY);
+ level_em->cave[xx][yy] = map_element_RND_to_EM(EL_EMPTY);
}
#else
#endif
}
+
+ if (BorderElement == EL_STEELWALL)
+ {
+#if 1
+ lev->width += 2;
+ lev->height += 2;
+#endif
+ }
}
void CopyNativeLevel_EM_to_RND(struct LevelInfo *level)
if (level->game_engine_type == GAME_ENGINE_TYPE_UNKNOWN)
level->game_engine_type = GAME_ENGINE_TYPE_RND;
+#if 1
+ if (level_file_info->type != LEVEL_FILE_TYPE_RND)
+ CopyNativeLevel_Native_to_RND(level);
+#else
if (level_file_info->type == LEVEL_FILE_TYPE_RND)
CopyNativeLevel_RND_to_Native(level);
else
CopyNativeLevel_Native_to_RND(level);
+#endif
}
void LoadLevelFromFilename(struct LevelInfo *level, char *filename)
SetBorderElement();
}
+static void LoadLevel_InitNativeEngines(struct LevelInfo *level,char *filename)
+{
+ struct LevelFileInfo *level_file_info = &level->file_info;
+
+#if 1
+ if (level_file_info->type == LEVEL_FILE_TYPE_RND)
+ CopyNativeLevel_RND_to_Native(level);
+#else
+ if (level_file_info->type == LEVEL_FILE_TYPE_RND)
+ CopyNativeLevel_RND_to_Native(level);
+ else
+ CopyNativeLevel_Native_to_RND(level);
+#endif
+}
+
void LoadLevelTemplate(int nr)
{
char *filename;
LoadLevel_InitVersion(&level, filename);
LoadLevel_InitElements(&level, filename);
LoadLevel_InitPlayfield(&level, filename);
+
+ LoadLevel_InitNativeEngines(&level, filename);
}
static void SaveLevel_VERS(FILE *file, struct LevelInfo *level)
BackToFront();
+#if 0
+ if (tape.playing)
+ printf("::: TAPE PLAYING -> DO NOT SAVE SCORE\n");
+ else
+ printf("::: NO TAPE PLAYING -> SAVING SCORE\n");
+#endif
+
if (tape.playing)
return;
{
0x800, 0x809, 0x812, 0x81B, 0x840, 0x849, 0x852, 0x85B
};
- unsigned int i, x, y, temp;
+ int i, x, y, temp;
#if 1
lev.time_seconds = src[0x83E] << 8 | src[0x83F];
void prepare_em_level(void)
{
- unsigned int i, x, y;
+ int i, x, y;
int players_left;
/* reset all runtime variables to their initial values */
extern char *progname;
extern char *arg_basedir;
-extern unsigned int frame;
+extern int frame;
extern short ulaw_to_linear[256];
extern unsigned char linear_to_ulaw[65536];
#include "display.h"
#include "level.h"
+#define MIN_SCREEN_XPOS 1
+#define MIN_SCREEN_YPOS 1
+#define MAX_SCREEN_XPOS MAX(1, lev.width - (SCR_FIELDX - 1))
+#define MAX_SCREEN_YPOS MAX(1, lev.height - (SCR_FIELDY - 1))
-#define MIN_SCREEN_X (TILEX)
-#define MIN_SCREEN_Y (TILEY)
-#define MAX_SCREEN_X ((lev.width - (SCR_FIELDX - 1)) * TILEX)
-#define MAX_SCREEN_Y ((lev.height - (SCR_FIELDY - 1)) * TILEY)
+#define MIN_SCREEN_X (MIN_SCREEN_XPOS * TILEX)
+#define MIN_SCREEN_Y (MIN_SCREEN_YPOS * TILEY)
+#define MAX_SCREEN_X (MAX_SCREEN_XPOS * TILEX)
+#define MAX_SCREEN_Y (MAX_SCREEN_YPOS * TILEY)
#define VALID_SCREEN_X(x) ((x) < MIN_SCREEN_X ? MIN_SCREEN_X : \
(x) > MAX_SCREEN_X ? MAX_SCREEN_X : (x))
- ((SCR_FIELDY - 1) * TILEY) / 2)
-unsigned int frame; /* current screen frame */
+int frame; /* current screen frame */
#if 0
-unsigned int screen_x; /* current scroll position */
-unsigned int screen_y;
+int screen_x; /* current scroll position */
+int screen_y;
#else
int screen_x; /* current scroll position */
int screen_y;
#endif
/* tiles currently on screen */
-static unsigned int screentiles[MAX_BUF_YSIZE][MAX_BUF_XSIZE];
-static unsigned int crumbled_state[MAX_BUF_YSIZE][MAX_BUF_XSIZE];
+static int screentiles[MAX_BUF_YSIZE][MAX_BUF_XSIZE];
+static int crumbled_state[MAX_BUF_YSIZE][MAX_BUF_XSIZE];
static boolean redraw[MAX_BUF_XSIZE][MAX_BUF_YSIZE];
void BlitScreenToBitmap_EM(Bitmap *target_bitmap)
{
- unsigned int x = screen_x % (MAX_BUF_XSIZE * TILEX);
- unsigned int y = screen_y % (MAX_BUF_YSIZE * TILEY);
+ int x = screen_x % (MAX_BUF_XSIZE * TILEX);
+ int y = screen_y % (MAX_BUF_YSIZE * TILEY);
if (x < 2 * TILEX && y < 2 * TILEY)
{
#if 1
static boolean scrolling_last = FALSE;
- unsigned int left = screen_x / TILEX;
- unsigned int top = screen_y / TILEY;
+ int left = screen_x / TILEX;
+ int top = screen_y / TILEY;
boolean scrolling = (screen_x % TILEX != 0 || screen_y % TILEY != 0);
int x, y;
{
int tile = Draw[y][x];
struct GraphicInfo_EM *g = &graphic_info_em_object[tile][frame];
- unsigned int i;
+ int i;
if (crm == 0) /* no crumbled edges for this tile */
return;
static void animscreen(void)
{
- unsigned int x, y, i;
- unsigned int left = screen_x / TILEX;
- unsigned int top = screen_y / TILEY;
+ int x, y, i;
+ int left = screen_x / TILEX;
+ int top = screen_y / TILEY;
static int xy[4][2] =
{
{ 0, -1 },
int sy = y % MAX_BUF_YSIZE;
int tile = Draw[y][x];
struct GraphicInfo_EM *g = &graphic_info_em_object[tile][frame];
- unsigned int obj = g->unique_identifier;
- unsigned int crm = 0;
+ int obj = g->unique_identifier;
+ int crm = 0;
/* re-calculate crumbled state of this tile */
if (g->has_crumbled_graphics)
static void blitplayer(struct PLAYER *ply)
{
- unsigned int x1, y1, x2, y2;
+ int x1, y1, x2, y2;
if (!ply->alive)
return;
x2 = x1 + TILEX - 1;
y2 = y1 + TILEY - 1;
- if ((unsigned int)(x2 - screen_x) < ((MAX_BUF_XSIZE - 1) * TILEX - 1) &&
- (unsigned int)(y2 - screen_y) < ((MAX_BUF_YSIZE - 1) * TILEY - 1))
+ if ((int)(x2 - screen_x) < ((MAX_BUF_XSIZE - 1) * TILEX - 1) &&
+ (int)(y2 - screen_y) < ((MAX_BUF_YSIZE - 1) * TILEY - 1))
{
/* some casts to "int" are needed because of negative calculation values */
int dx = (int)ply->x - (int)ply->oldx;
void game_initscreen(void)
{
- unsigned int x,y;
+ int x,y;
int dynamite_state = ply[0].dynamite; /* !!! ONLY PLAYER 1 !!! */
int all_keys_state = ply[0].keys | ply[1].keys | ply[2].keys | ply[3].keys;
int player_nr = 0; /* !!! FIX THIS (CENTERED TO PLAYER 1) !!! */
int offset = (setup.scroll_delay ? 3 : 0) * TILEX;
/* calculate new screen scrolling position, with regard to scroll delay */
- screen_x = VALID_SCREEN_X(sx < screen_x - offset ? sx + offset :
- sx > screen_x + offset ? sx - offset : screen_x);
- screen_y = VALID_SCREEN_Y(sy < screen_y - offset ? sy + offset :
- sy > screen_y + offset ? sy - offset : screen_y);
+ screen_x = VALID_SCREEN_X(sx + offset < screen_x ? sx + offset :
+ sx - offset > screen_x ? sx - offset : screen_x);
+ screen_y = VALID_SCREEN_Y(sy + offset < screen_y ? sy + offset :
+ sy - offset > screen_y ? sy - offset : screen_y);
#else
/* ---------------------------------------------------------------------- */
-extern unsigned int screen_x;
-extern unsigned int screen_y;
+extern int screen_x;
+extern int screen_y;
void play_element_sound(int x, int y, int sample, int element)
{
#if 0
- unsigned int left = screen_x / TILEX;
- unsigned int top = screen_y / TILEY;
+ int left = screen_x / TILEX;
+ int top = screen_y / TILEY;
if ((x == -1 && y == -1) || /* play sound in the middle of the screen */
- ((unsigned int)(y - top) <= SCR_FIELDY &&
- (unsigned int)(x - left) <= SCR_FIELDX))
+ ((int)(y - top) <= SCR_FIELDY &&
+ (int)(x - left) <= SCR_FIELDX))
#endif
{
#if 1
struct LEVEL lev;
struct PLAYER ply[MAX_PLAYERS];
-unsigned short **Boom;
-unsigned short **Cave;
-unsigned short **Next;
-unsigned short **Draw;
+short **Boom;
+short **Cave;
+short **Next;
+short **Draw;
-static unsigned short *Index[4][HEIGHT];
-static unsigned short Array[4][HEIGHT][WIDTH];
+static short *Index[4][HEIGHT];
+static short Array[4][HEIGHT][WIDTH];
-extern unsigned int screen_x;
-extern unsigned int screen_y;
+extern int screen_x;
+extern int screen_y;
void game_init_vars(void)
{
void readjoy(byte action, struct PLAYER *ply)
{
- unsigned int north = 0, east = 0, south = 0, west = 0;
- unsigned int snap = 0, drop = 0;
+ int north = 0, east = 0, south = 0, west = 0;
+ int snap = 0, drop = 0;
if (action & JOY_LEFT)
west = 1;
void readjoy(byte action)
{
- unsigned int north = 0, east = 0, south = 0, west = 0;
- unsigned int snap = 0, drop = 0;
+ int north = 0, east = 0, south = 0, west = 0;
+ int snap = 0, drop = 0;
if (action & JOY_LEFT)
west = 1;
extern struct GraphicInfo_EM graphic_info_em_object[TILE_MAX][8];
extern struct GraphicInfo_EM graphic_info_em_player[MAX_PLAYERS][SPR_MAX][8];
-extern unsigned short **Boom;
-extern unsigned short **Cave;
-extern unsigned short **Next;
-extern unsigned short **Draw;
+extern short **Boom;
+extern short **Cave;
+extern short **Next;
+extern short **Draw;
#endif
/* 2000-07-30T11:06:03Z ---------------------------------------------------- */
+#if 1
+/* 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)
+#else
#define EM_MAX_CAVE_WIDTH 102
#define EM_MAX_CAVE_HEIGHT 102
+#endif
/* define these for backwards compatibility */
#define EM_ENGINE_BAD_ROLL
-----------------------------------------------------------------------------
definition of elements used in the Emerald Mine Club engine;
the element names have the following properties:
- - elements that start with an 'X' can be stored in a level file;
- - elements that start with an 'Y' indicate moving elements;
- - elements that end with a 'B' are the "backside" of a moving element.
+ - elements that start with 'X' can be stored in a level file
+ - elements that start with 'Y' indicate moving elements
+ - elements that end with 'B' are the "backside" of moving elements
-----------------------------------------------------------------------------
*/
struct LEVEL
{
- unsigned int home_initial; /* number of players (initial) */
- unsigned int home; /* number of players not yet at home */
- /* 0 == all players at home */
+ int home_initial; /* number of players (initial) */
+ int home; /* number of players not yet at home */
+ /* 0 == all players at home */
- unsigned int width; /* playfield width */
- unsigned int height; /* playfield height */
+ int width; /* playfield width */
+ int height; /* playfield height */
- unsigned int time_seconds; /* available time (seconds) */
- unsigned int time_initial; /* available time (initial) */
- unsigned int time; /* time remaining (runtime) */
+ int time_seconds; /* available time (seconds) */
+ int time_initial; /* available time (initial) */
+ int time; /* time remaining (runtime) */
- boolean killed_out_of_time; /* kill player due to time out */
+ boolean killed_out_of_time; /* kill player due to time out */
- unsigned int required_initial; /* emeralds needed (initial) */
- unsigned int required; /* emeralds needed (runtime) */
+ int required_initial; /* emeralds needed (initial) */
+ int required; /* emeralds needed (runtime) */
- unsigned int score; /* score */
+ int score; /* score */
/* all below entries must be filled every time a level is read */
- unsigned int alien_score; /* score for killing alien */
- unsigned int amoeba_time; /* amoeba speed */
- unsigned int android_move_cnt_initial;/* android move counter (initial) */
- unsigned int android_move_cnt; /* android move counter */
- unsigned int android_move_time; /* android move reset time */
- unsigned int android_clone_cnt_initial;/* android clone counter (initial) */
- unsigned int android_clone_cnt; /* android clone counter */
- unsigned int android_clone_time; /* android clone reset time */
- unsigned int ball_cnt; /* ball counter */
- unsigned int ball_pos; /* ball array pos counter */
- unsigned int ball_random; /* ball is random flag */
- unsigned int ball_state_initial; /* ball active flag (initial) */
- unsigned int ball_state; /* ball active flag */
- unsigned int ball_time; /* ball reset time */
- unsigned int bug_score; /* score for killing bug */
- unsigned int diamond_score; /* score for collecting diamond */
- unsigned int dynamite_score; /* score for collecting dynamite */
- unsigned int eater_pos; /* eater array pos */
- unsigned int eater_score; /* score for killing eater */
- unsigned int emerald_score; /* score for collecting emerald */
- unsigned int exit_score; /* score for entering exit */
- unsigned int key_score; /* score for colleting key */
- unsigned int lenses_cnt_initial; /* lenses counter (initial) */
- unsigned int lenses_cnt; /* lenses counter */
- unsigned int lenses_score; /* score for collecting lenses */
- unsigned int lenses_time; /* lenses reset time */
- unsigned int magnify_cnt_initial; /* magnify counter (initial) */
- unsigned int magnify_cnt; /* magnify counter */
- unsigned int magnify_score; /* score for collecting magnifier */
- unsigned int magnify_time; /* magnify reset time */
- unsigned int nut_score; /* score for cracking nut */
- unsigned int shine_cnt; /* shine counter for emerald/diamond */
- unsigned int slurp_score; /* score for slurping alien */
- unsigned int tank_score; /* score for killing tank */
- unsigned int wheel_cnt_initial; /* wheel counter (initial) */
- unsigned int wheel_cnt; /* wheel counter */
- unsigned int wheel_x_initial; /* wheel x pos (initial) */
- unsigned int wheel_x; /* wheel x pos */
- unsigned int wheel_y_initial; /* wheel y pos (initial) */
- unsigned int wheel_y; /* wheel y pos */
- unsigned int wheel_time; /* wheel reset time */
- unsigned int wind_cnt_initial; /* wind counter (initial) */
- unsigned int wind_cnt; /* wind time counter */
- unsigned int wind_direction_initial; /* wind direction (initial) */
- unsigned int wind_direction; /* wind direction */
- unsigned int wind_time; /* wind reset time */
- unsigned int wonderwall_state_initial;/* wonderwall active flag (initial) */
- unsigned int wonderwall_state; /* wonderwall active flag */
- unsigned int wonderwall_time_initial; /* wonderwall time (initial) */
- unsigned int wonderwall_time; /* wonderwall time */
- unsigned short eater_array[8][9]; /* eater data */
- unsigned short ball_array[8][8]; /* ball data */
- unsigned short android_array[TILE_MAX];/* android clone table */
- unsigned int num_ball_arrays; /* number of ball data arrays used */
+ int alien_score; /* score for killing alien */
+ int amoeba_time; /* amoeba speed */
+ int android_move_cnt_initial; /* android move counter (initial) */
+ int android_move_cnt; /* android move counter */
+ int android_move_time; /* android move reset time */
+ int android_clone_cnt_initial;/* android clone counter (initial) */
+ int android_clone_cnt; /* android clone counter */
+ int android_clone_time; /* android clone reset time */
+ int ball_cnt; /* ball counter */
+ int ball_pos; /* ball array pos counter */
+ int ball_random; /* ball is random flag */
+ int ball_state_initial; /* ball active flag (initial) */
+ int ball_state; /* ball active flag */
+ int ball_time; /* ball reset time */
+ int bug_score; /* score for killing bug */
+ int diamond_score; /* score for collecting diamond */
+ int dynamite_score; /* score for collecting dynamite */
+ int eater_pos; /* eater array pos */
+ int eater_score; /* score for killing eater */
+ int emerald_score; /* score for collecting emerald */
+ int exit_score; /* score for entering exit */
+ int key_score; /* score for colleting key */
+ int lenses_cnt_initial; /* lenses counter (initial) */
+ int lenses_cnt; /* lenses counter */
+ int lenses_score; /* score for collecting lenses */
+ int lenses_time; /* lenses reset time */
+ int magnify_cnt_initial; /* magnify counter (initial) */
+ int magnify_cnt; /* magnify counter */
+ int magnify_score; /* score for collecting magnifier */
+ int magnify_time; /* magnify reset time */
+ int nut_score; /* score for cracking nut */
+ int shine_cnt; /* shine counter for emerald/diamond */
+ int slurp_score; /* score for slurping alien */
+ int tank_score; /* score for killing tank */
+ int wheel_cnt_initial; /* wheel counter (initial) */
+ int wheel_cnt; /* wheel counter */
+ int wheel_x_initial; /* wheel x pos (initial) */
+ int wheel_x; /* wheel x pos */
+ int wheel_y_initial; /* wheel y pos (initial) */
+ int wheel_y; /* wheel y pos */
+ int wheel_time; /* wheel reset time */
+ int wind_cnt_initial; /* wind counter (initial) */
+ int wind_cnt; /* wind time counter */
+ int wind_direction_initial; /* wind direction (initial) */
+ int wind_direction; /* wind direction */
+ int wind_time; /* wind reset time */
+ int wonderwall_state_initial; /* wonderwall active flag (initial) */
+ int wonderwall_state; /* wonderwall active flag */
+ int wonderwall_time_initial; /* wonderwall time (initial) */
+ int wonderwall_time; /* wonderwall time */
+ short eater_array[8][9]; /* eater data */
+ short ball_array[8][8]; /* ball data */
+ short android_array[TILE_MAX];/* android clone table */
+ int num_ball_arrays; /* number of ball data arrays used */
};
struct PLAYER
{
- unsigned int num;
- unsigned int exists;
- unsigned int alive_initial;
- unsigned int alive;
-
- unsigned int dynamite;
- unsigned int dynamite_cnt;
- unsigned int keys;
- unsigned int anim;
-
- unsigned int x_initial;
- unsigned int y_initial;
- unsigned int x;
- unsigned int y;
- unsigned int oldx;
- unsigned int oldy;
-
- unsigned int last_move_dir;
-
- unsigned joy_n:1;
- unsigned joy_e:1;
- unsigned joy_s:1;
- unsigned joy_w:1;
- unsigned joy_snap:1;
- unsigned joy_drop:1;
- unsigned joy_stick:1;
- unsigned joy_spin:1;
+ int num;
+ int exists;
+ int alive_initial;
+ int alive;
+
+ int dynamite;
+ int dynamite_cnt;
+ int keys;
+ int anim;
+
+ int x_initial;
+ int y_initial;
+ int x;
+ int y;
+ int oldx;
+ int oldy;
+
+ int last_move_dir;
+
+ int joy_n:1;
+ int joy_e:1;
+ int joy_s:1;
+ int joy_w:1;
+ int joy_snap:1;
+ int joy_drop:1;
+ int joy_stick:1;
+ int joy_spin:1;
};
{
int file_version;
- unsigned short cave[EM_MAX_CAVE_WIDTH][EM_MAX_CAVE_HEIGHT];
+ short cave[EM_MAX_CAVE_WIDTH][EM_MAX_CAVE_HEIGHT];
struct LEVEL *lev;
struct PLAYER *ply[MAX_PLAYERS];
static boolean player_killed(struct PLAYER *ply)
{
- register unsigned int x = ply->x;
- register unsigned int y = ply->y;
+ int x = ply->x;
+ int y = ply->y;
#if 0
printf("::: %d: %d, %d\n", ply->num, x, y);
static void kill_player(struct PLAYER *ply)
{
- register unsigned int x = ply->x;
- register unsigned int y = ply->y;
+ int x = ply->x;
+ int y = ply->y;
ply->alive = 0;
static void check_player(struct PLAYER *ply)
{
- unsigned int oldx = ply->x;
- unsigned int oldy = ply->y;
- register unsigned int x = oldx;
- register unsigned int y = oldy;
- unsigned int anim = 0;
+ int oldx = ply->x;
+ int oldy = ply->y;
+ int x = oldx;
+ int y = oldy;
+ int anim = 0;
int dx = 0, dy = 0;
#if 0
static boolean player_digfield(struct PLAYER *ply, int dx, int dy)
{
int anim = (dx < 0 ? 3 : dx > 0 ? 1 : dy < 0 ? 0 : dy > 0 ? 2 : 2);
- unsigned int oldx = ply->x;
- unsigned int oldy = ply->y;
- register unsigned int x = oldx + dx;
- register unsigned int y = oldy + dy;
+ int oldx = ply->x;
+ int oldy = ply->y;
+ int x = oldx + dx;
+ int y = oldy + dy;
boolean result = TRUE;
if (!dx && !dy) /* no direction specified */
void synchro_2(void)
{
- register unsigned int x = 0;
- register unsigned int y = 1;
- register unsigned long random = RandomEM;
- register unsigned short *cave_cache = Cave[y]; /* might be a win */
- unsigned long score = 0;
-
- unsigned int temp = 0; /* initialized to make compilers happy */
- unsigned int dx; /* only needed to find closest player */
- unsigned int dy;
+ int x = 0;
+ int y = 1;
+ unsigned long random = RandomEM;
+ short *cave_cache = Cave[y]; /* might be a win */
+ int score = 0;
+
+ int temp = 0; /* initialized to make compilers happy */
+ int dx; /* only needed to find closest player */
+ int dy;
int element;
loop:
void synchro_3(void)
{
- register unsigned int x;
- register unsigned int y;
- register unsigned int count;
- register unsigned long random;
+ int x;
+ int y;
+ int count;
+ unsigned long random;
/* update variables */
#define CURSOR_PLAYFIELD 1
+/* maximum playfield size supported by libgame functions */
+#define MAX_PLAYFIELD_WIDTH 128
+#define MAX_PLAYFIELD_HEIGHT 128
+
/* maximum number of parallel players supported by libgame functions */
#define MAX_PLAYERS 4
#define MIN_LEV_FIELDY 3
#define STD_LEV_FIELDX 64
#define STD_LEV_FIELDY 32
-#define MAX_LEV_FIELDX 128
-#define MAX_LEV_FIELDY 128
+#define MAX_LEV_FIELDX MAX_PLAYFIELD_WIDTH
+#define MAX_LEV_FIELDY MAX_PLAYFIELD_HEIGHT
#define SCREENX(a) ((a) - scroll_x)
#define SCREENY(a) ((a) - scroll_y)
byte tape_action[MAX_PLAYERS];
int i;
+#if 1
if (level.native_em_level->lev->home == 0) /* all players at home */
{
+ local_player->LevelSolved = TRUE;
+ AllPlayersGone = TRUE;
+
+ level.native_em_level->lev->home = -1;
+ }
+
+ if (local_player->LevelSolved)
GameWon();
- if (!TAPE_IS_STOPPED(tape))
+ if (AllPlayersGone && !TAPE_IS_STOPPED(tape))
+ TapeStop();
+
+ if (game_status != GAME_MODE_PLAYING)
+ return;
+#else
+ if (level.native_em_level->lev->home == 0) /* all players at home */
+ {
+ if (local_player->LevelSolved)
+ GameWon();
+
+ if (AllPlayersGone && !TAPE_IS_STOPPED(tape))
TapeStop();
if (game_status != GAME_MODE_PLAYING)
return;
}
+#endif
if (level.native_em_level->ply[0]->alive == 0 &&
level.native_em_level->ply[1]->alive == 0 &&