From: Holger Schemel Date: Fri, 17 Sep 2004 18:23:56 +0000 (+0200) Subject: rnd-20040917-1-src X-Git-Tag: 3.1.1^2~65 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=da8f8eaa9d466f33d94ff884230a613b3f239700;p=rocksndiamonds.git rnd-20040917-1-src --- diff --git a/src/conftime.h b/src/conftime.h index 284c7e8a..1b27e57d 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2004-09-16 00:59]" +#define COMPILE_DATE_STRING "[2004-09-17 20:19]" diff --git a/src/files.c b/src/files.c index 8d684ff0..c684ab84 100644 --- a/src/files.c +++ b/src/files.c @@ -1343,6 +1343,8 @@ static void LoadLevelFromFileInfo_RND(struct LevelInfo *level, /* functions for loading EM level */ /* ------------------------------------------------------------------------- */ +#if 0 + static int map_em_element_yam(int element) { switch (element) @@ -1655,16 +1657,13 @@ static int map_em_element_field(int element) #define EM_LEVEL_XSIZE 64 #define EM_LEVEL_YSIZE 32 -static void LoadLevelFromFileInfo_EM(struct LevelInfo *level, - struct LevelFileInfo *level_file_info) +static void OLD_LoadLevelFromFileInfo_EM(struct LevelInfo *level, + struct LevelFileInfo *level_file_info) { char *filename = level_file_info->filename; FILE *file; unsigned char leveldata[EM_LEVEL_SIZE]; unsigned char *header = &leveldata[EM_LEVEL_XSIZE * EM_LEVEL_YSIZE]; - unsigned char code0 = 0x65; - unsigned char code1 = 0x11; - boolean level_is_crypted = FALSE; int nr = level_file_info->nr; int i, x, y; @@ -1677,7 +1676,7 @@ static void LoadLevelFromFileInfo_EM(struct LevelInfo *level, return; } - for(i = 0; i < EM_LEVEL_SIZE; i++) + for (i = 0; i < EM_LEVEL_SIZE; i++) leveldata[i] = fgetc(file); fclose(file); @@ -1688,20 +1687,20 @@ static void LoadLevelFromFileInfo_EM(struct LevelInfo *level, if ((leveldata[0] == 0xf1 || leveldata[0] == 0xf5) && leveldata[2] == 0xe7 && leveldata[3] == 0xee) { - level_is_crypted = TRUE; + unsigned char code0 = 0x65; + unsigned char code1 = 0x11; if (leveldata[0] == 0xf5) /* error in crypted Emerald Mine 2 levels */ leveldata[0] = 0xf1; - } - if (level_is_crypted) /* decode crypted level data */ - { - for(i = 0; i < EM_LEVEL_SIZE; i++) + /* decode crypted level data */ + + for (i = 0; i < EM_LEVEL_SIZE; i++) { leveldata[i] ^= code0; leveldata[i] -= code1; - code0 = (code0 + 7) & 0xff; + code0 = (code0 + 7) & 0xff; } } @@ -1734,9 +1733,9 @@ static void LoadLevelFromFileInfo_EM(struct LevelInfo *level, level->num_yamyam_contents = 4; - for(i = 0; i < level->num_yamyam_contents; i++) - for(y = 0; y < 3; y++) - for(x = 0; x < 3; x++) + for (i = 0; i < level->num_yamyam_contents; i++) + for (y = 0; y < 3; y++) + for (x = 0; x < 3; x++) level->yamyam_content[i][x][y] = map_em_element_yam(header[i * 9 + y * 3 + x]); @@ -1764,6 +1763,18 @@ static void LoadLevelFromFileInfo_EM(struct LevelInfo *level, level->field[x][y] = EL_PLAYER_2; } +#else + +static void LoadLevelFromFileInfo_EM(struct LevelInfo *level, + struct LevelFileInfo *level_file_info) +{ + if (!LoadNativeLevel_EM(level_file_info->filename)) + level->no_valid_file = TRUE; +} + +#endif + + /* ------------------------------------------------------------------------- */ /* functions for loading SP level */ /* ------------------------------------------------------------------------- */ @@ -1915,13 +1926,13 @@ static void LoadLevelFromFileStream_SP(FILE *file, struct LevelInfo *level, level->time_wheel = 0; level->amoeba_content = EL_EMPTY; - for(i = 0; i < LEVEL_SCORE_ELEMENTS; i++) + for (i = 0; i < LEVEL_SCORE_ELEMENTS; i++) level->score[i] = 0; /* !!! CORRECT THIS !!! */ /* there are no yamyams in supaplex levels */ - for(i = 0; i < level->num_yamyam_contents; i++) - for(y = 0; y < 3; y++) - for(x = 0; x < 3; x++) + for (i = 0; i < level->num_yamyam_contents; i++) + for (y = 0; y < 3; y++) + for (x = 0; x < 3; x++) level->yamyam_content[i][x][y] = EL_EMPTY; } diff --git a/src/game_em/cave.c b/src/game_em/cave.c index ad5f4b41..0e7caea5 100644 --- a/src/game_em/cave.c +++ b/src/game_em/cave.c @@ -20,21 +20,33 @@ struct cave_node *cave_list; -static void clear(void); +static void setLevelInfoToDefaults_EM(void) +{ + lev.width = 64; + lev.height = 32; + + ply1.x_initial = 0; + ply1.y_initial = 0; + + ply2.x_initial = 0; + ply2.y_initial = 0; +} + /* attempt load a cave * * completely initializes the level structure, ready for a game */ -int cave_convert(char *filename) +int OLD_cave_convert(char *filename) { int result; FILE *file; int actual; - unsigned long length; + int length; unsigned char buffer[16384]; - clear(); + /* always start with reliable default values */ + setLevelInfoToDefaults_EM(); file = fopen(filename, "rb"); if (file == 0) @@ -58,7 +70,7 @@ int cave_convert(char *filename) fclose(file); file = 0; - if (clean_emerald(buffer, &length)) + if (!cleanup_em_level(buffer, &length)) { fprintf(stderr, "%s: \"%s\": %s\n", progname, filename, "unrecognized format"); @@ -66,7 +78,8 @@ int cave_convert(char *filename) goto fail; } - convert_emerald(buffer); + convert_em_level(buffer); + prepare_em_level(); result = 0; @@ -78,35 +91,46 @@ int cave_convert(char *filename) return(result); } -static void clear(void) +#define MAX_EM_LEVEL_SIZE 16384 + +boolean LoadNativeLevel_EM(char *filename) { - lev.home = 1; /* number of players */ - lev.width = 0; - lev.height = 0; - lev.time = 0; - lev.required = 0; - lev.score = 0; - - ply1.num = 0; - ply1.alive = (lev.home >= 1); - ply1.dynamite = 0; - ply1.dynamite_cnt = 0; - ply1.keys = 0; - ply1.anim = 0; - ply1.oldx = ply1.x = 0; - ply1.oldy = ply1.y = 0; - ply1.joy_n = ply1.joy_e = ply1.joy_s = ply1.joy_w = ply1.joy_fire = 0; - ply1.joy_stick = ply1.joy_spin = 0; - ply2.num = 1; - ply2.alive = (lev.home >= 2); - ply2.dynamite = 0; - ply2.dynamite_cnt = 0; - ply2.keys = 0; - ply2.anim = 0; - ply2.oldx = ply2.x = 0; - ply2.oldy = ply2.y = 0; - ply2.joy_n = ply2.joy_e = ply2.joy_s = ply2.joy_w = ply2.joy_fire = 0; - ply2.joy_stick = ply2.joy_spin = 0; + unsigned char raw_leveldata[MAX_EM_LEVEL_SIZE]; + int raw_leveldata_length; + FILE *file; + + /* always start with reliable default values */ + setLevelInfoToDefaults_EM(); + + if (!(file = fopen(filename, MODE_READ))) + { + Error(ERR_WARN, "cannot open level '%s' -- using empty level", filename); + + return FALSE; + } + + raw_leveldata_length = fread(raw_leveldata, 1, MAX_EM_LEVEL_SIZE, file); + + fclose(file); + + if (raw_leveldata_length <= 0) + { + Error(ERR_WARN, "cannot read level '%s' -- using empty level", filename); + + return FALSE; + } + + if (!cleanup_em_level(raw_leveldata, &raw_leveldata_length)) + { + Error(ERR_WARN, "unknown EM level '%s' -- using empty level", filename); + + return FALSE; + } + + convert_em_level(raw_leveldata); + prepare_em_level(); + + return TRUE; } void read_cave_list(void) diff --git a/src/game_em/convert.c b/src/game_em/convert.c index 8fd194a9..aa6df647 100644 --- a/src/game_em/convert.c +++ b/src/game_em/convert.c @@ -8,6 +8,7 @@ * inconsequential, but no doubt it will break some caves. */ +#include "global.h" #include "tile.h" #include "level.h" @@ -89,7 +90,7 @@ static unsigned char remap_v4eater[28] = 146,147,175,65,66,64,2,18 }; -int clean_emerald(unsigned char *src, unsigned long *length) +boolean cleanup_em_level(unsigned char *src, int *length) { unsigned int i; @@ -156,7 +157,7 @@ int clean_emerald(unsigned char *src, unsigned long *length) goto v3; } - return 1; /* unrecognized cave */ + return FALSE; /* unrecognized cave */ v3: v4: @@ -185,7 +186,6 @@ int clean_emerald(unsigned char *src, unsigned long *length) for (i = 0; i < 2048; i++) if (src[i] == 40) break; - for (i++; i < 2048; i++) if (src[i] == 40) src[i] = 147; @@ -323,7 +323,7 @@ int clean_emerald(unsigned char *src, unsigned long *length) /* size of v6 cave */ *length = 2172; - return 0; + return TRUE; } /* 2000-07-30T00:26:00Z @@ -423,69 +423,70 @@ static unsigned short remap_emerald[256] = Xblank, Xblank, Xblank, Xblank, Xblank, Xblank, Xblank, Xblank, }; -void convert_emerald(unsigned char *src) +void convert_em_level(unsigned char *src) { unsigned int x, y, temp; - lev.width = 64; - lev.height = 32; - temp = ((src[0x83E] << 8 | src[0x83F]) * 25 + 3) / 4; if (temp == 0 || temp > 9999) temp = 9999; - lev.time = temp; - lev.required = src[0x82F]; + lev.time_initial = temp; + lev.required_initial = src[0x82F]; temp = src[0x830] << 8 | src[0x831]; - ply1.oldx = ply1.x = (temp & 63) + 1; - ply1.oldy = ply1.y = (temp >> 6 & 31) + 1; + ply1.x_initial = (temp & 63) + 1; + ply1.y_initial = (temp >> 6 & 31) + 1; temp = src[0x832] << 8 | src[0x833]; - ply2.oldx = ply2.x = (temp & 63) + 1; - ply2.oldy = ply2.y = (temp >> 6 & 31) + 1; - - lev.alien_score = src[0x826]; + ply2.x_initial = (temp & 63) + 1; + ply2.y_initial = (temp >> 6 & 31) + 1; temp = (src[0x834] << 8 | src[0x835]) * 28; if (temp > 9999) temp = 9999; lev.ameuba_time = temp; - lev.android_move_cnt = lev.android_move_time = src[0x874] << 8 | src[0x875]; - lev.android_clone_cnt= lev.android_clone_time = src[0x876] << 8 | src[0x877]; - lev.ball_pos = 0; + + lev.android_move_time = src[0x874] << 8 | src[0x875]; + lev.android_clone_time = src[0x876] << 8 | src[0x877]; + lev.ball_random = src[0x872] & 1 ? 1 : 0; - lev.ball_state = src[0x872] & 128 ? 1 : 0; - lev.ball_cnt = lev.ball_time = src[0x870] << 8 | src[0x871]; - lev.bug_score = src[0x828]; + lev.ball_state_initial = src[0x872] & 128 ? 1 : 0; + lev.ball_time = src[0x870] << 8 | src[0x871]; + + lev.emerald_score = src[0x824]; lev.diamond_score = src[0x825]; - lev.dynamite_score = src[0x82B]; - lev.eater_pos = 0; + lev.alien_score = src[0x826]; + lev.tank_score = src[0x827]; + lev.bug_score = src[0x828]; lev.eater_score = src[0x829]; - lev.emerald_score = src[0x824]; - lev.exit_score = src[0x82D] * 8 / 5; + lev.nut_score = src[0x82A]; + lev.dynamite_score = src[0x82B]; lev.key_score = src[0x82C]; - lev.lenses_cnt = 0; + lev.exit_score = src[0x82D] * 8 / 5; lev.lenses_score = src[0x867]; - lev.lenses_time = src[0x86A] << 8 | src[0x86B]; - lev.magnify_cnt = 0; lev.magnify_score = src[0x868]; - lev.magnify_time = src[0x86C] << 8 | src[0x86D]; - lev.nut_score = src[0x82A]; - lev.shine_cnt = 0; lev.slurp_score = src[0x869]; - lev.tank_score = src[0x827]; - lev.wheel_cnt = 0; - lev.wheel_x = 1; - lev.wheel_y = 1; + + lev.lenses_time = src[0x86A] << 8 | src[0x86B]; + lev.lenses_cnt_initial = 0; + + lev.magnify_time = src[0x86C] << 8 | src[0x86D]; + lev.magnify_cnt_initial = 0; + lev.wheel_time = src[0x838] << 8 | src[0x839]; - lev.wind_cnt = src[0x865] & 15 ? 9999 : 0; - temp = src[0x865]; - lev.wind_direction = (temp & 8 ? 0 : - temp & 1 ? 1 : - temp & 2 ? 2 : - temp & 4 ? 3 : 0); + lev.wheel_cnt_initial = 0; + lev.wheel_x_initial = 1; + lev.wheel_y_initial = 1; + lev.wind_time = 9999; - lev.wonderwall_state = 0; - lev.wonderwall_time = src[0x836] << 8 | src[0x837]; + lev.wind_cnt_initial = src[0x865] & 15 ? lev.wind_time : 0; + temp = src[0x865]; + lev.wind_direction_initial = (temp & 8 ? 0 : + temp & 1 ? 1 : + temp & 2 ? 2 : + temp & 4 ? 3 : 0); + + lev.wonderwall_state_initial = 0; + lev.wonderwall_time_initial = src[0x836] << 8 | src[0x837]; for (x = 0; x < 9; x++) lev.eater_array[0][x] = remap_emerald[src[0x800 + x]]; @@ -696,14 +697,14 @@ void convert_emerald(unsigned char *src) switch (src[temp]) { case 0x24: /* wonderwall */ - lev.wonderwall_state = 1; - lev.wonderwall_time = 9999; + lev.wonderwall_state_initial = 1; + lev.wonderwall_time_initial = 9999; break; case 0x28: /* wheel */ - lev.wheel_x = temp & 63; - lev.wheel_y = temp >> 6; - lev.wheel_cnt = lev.wheel_time; + lev.wheel_x_initial = temp & 63; + lev.wheel_y_initial = temp >> 6; + lev.wheel_cnt_initial = lev.wheel_time; break; #ifndef BAD_ROLL @@ -749,28 +750,47 @@ void convert_emerald(unsigned char *src) #endif case 0xA3: /* fake blank */ - lev.lenses_cnt = 9999; + lev.lenses_cnt_initial = 9999; break; case 0xA4: /* fake grass */ - lev.magnify_cnt = 9999; + lev.magnify_cnt_initial = 9999; break; } } + lev.home_initial = 1; /* initial number of players in this level */ + + ply1.alive_initial = (lev.home_initial >= 1); + ply2.alive_initial = (lev.home_initial >= 2); + + /* first fill the complete playfield with the default border element */ for (y = 0; y < HEIGHT; y++) for (x = 0; x < WIDTH; x++) - Cave[y][x] = ZBORDER; + native_em_level.cave[x][y] = ZBORDER; + /* then copy the real level contents from level file into the playfield */ temp = 0; for (y = 0; y < lev.height; y++) for (x = 0; x < lev.width; x++) - Cave[y+1][x+1] = remap_emerald[src[temp++]]; + native_em_level.cave[x + 1][y + 1] = remap_emerald[src[temp++]]; - if (ply1.alive) - Cave[ply1.y][ply1.x] = Zplayer; - if (ply2.alive) - Cave[ply2.y][ply2.x] = Zplayer; + /* at last, set the two players at their positions in the playfield */ + if (ply1.alive_initial) + native_em_level.cave[ply1.x_initial][ply1.y_initial] = Zplayer; + if (ply2.alive_initial) + native_em_level.cave[ply2.x_initial][ply2.y_initial] = Zplayer; +} + +void prepare_em_level(void) +{ + unsigned int x, y; + + /* reset all runtime variables to their initial values */ + + for (y = 0; y < HEIGHT; y++) + for (x = 0; x < WIDTH; x++) + Cave[y][x] = native_em_level.cave[x][y]; for (y = 0; y < HEIGHT; y++) for (x = 0; x < WIDTH; x++) @@ -779,6 +799,57 @@ void convert_emerald(unsigned char *src) for (y = 0; y < HEIGHT; y++) for (x = 0; x < WIDTH; x++) Draw[y][x] = Cave[y][x]; + + lev.time = lev.time_initial; + lev.required = lev.required_initial; + lev.score = 0; + + lev.android_move_cnt = lev.android_move_time; + lev.android_clone_cnt = lev.android_clone_time; + + lev.ball_pos = 0; + lev.ball_state = lev.ball_state_initial; + lev.ball_cnt = lev.ball_time; + + lev.eater_pos = 0; + lev.shine_cnt = 0; + + lev.lenses_cnt = lev.lenses_cnt_initial; + lev.magnify_cnt = lev.magnify_cnt_initial; + + lev.wheel_cnt = lev.wheel_cnt_initial; + lev.wheel_x = lev.wheel_x_initial; + lev.wheel_y = lev.wheel_y_initial; + + lev.wind_cnt = lev.wind_cnt_initial; + lev.wind_direction = lev.wind_direction_initial; + + lev.wonderwall_state = lev.wonderwall_state_initial; + lev.wonderwall_time = lev.wonderwall_time_initial; + + lev.home = lev.home_initial; + + ply1.num = 0; + ply1.alive = ply1.alive_initial; + ply1.dynamite = 0; + ply1.dynamite_cnt = 0; + ply1.keys = 0; + ply1.anim = 0; + ply1.oldx = ply1.x = ply1.x_initial; + ply1.oldy = ply1.y = ply1.y_initial; + ply1.joy_n = ply1.joy_e = ply1.joy_s = ply1.joy_w = ply1.joy_fire = 0; + ply1.joy_stick = ply1.joy_spin = 0; + + ply2.num = 1; + ply2.alive = ply2.alive_initial; + ply2.dynamite = 0; + ply2.dynamite_cnt = 0; + ply2.keys = 0; + ply2.anim = 0; + ply2.oldx = ply2.x = ply2.x_initial; + ply2.oldy = ply2.y = ply2.y_initial; + ply2.joy_n = ply2.joy_e = ply2.joy_s = ply2.joy_w = ply2.joy_fire = 0; + ply2.joy_stick = ply2.joy_spin = 0; } #endif diff --git a/src/game_em/game_em.h b/src/game_em/game_em.h index 540b38ee..9dcb6871 100644 --- a/src/game_em/game_em.h +++ b/src/game_em/game_em.h @@ -18,7 +18,7 @@ /* ========================================================================= */ -/* functions exported from main program to game_em */ +/* functions and definitions imported from main program to game_em */ /* ========================================================================= */ #include "../libgame/libgame.h" @@ -28,14 +28,18 @@ extern void DrawGameDoorValues_EM(int, int, int, int); /* ========================================================================= */ -/* functions exported from game_em to main program */ +/* functions and definitions exported from game_em to main program */ /* ========================================================================= */ +#include "main_em.h" + extern void em_open_all(); extern void em_close_all(); extern int em_main_init_game(int, char *); extern int em_main_handle_game(byte); +boolean LoadNativeLevel_EM(char *); + -#endif /* GAME_EM_H */ +#endif /* GAME_EM_H */ diff --git a/src/game_em/global.h b/src/game_em/global.h index 0e3bd093..51d54184 100644 --- a/src/game_em/global.h +++ b/src/game_em/global.h @@ -51,7 +51,8 @@ void title_string(unsigned int y, unsigned int left, unsigned int right, void sound_play(void); -int cave_convert(char *filename); +int cave_convert(char *); +boolean LoadNativeLevel_EM(char *); void game_init_vars(void); int game_play_init(int, char *); @@ -61,8 +62,9 @@ void synchro_1(void); void synchro_2(void); void synchro_3(void); -int clean_emerald(unsigned char *src, unsigned long *length); -void convert_emerald(unsigned char *src); +boolean cleanup_em_level(unsigned char *src, int *length); +void convert_em_level(unsigned char *src); +void prepare_em_level(void); int sound_thread(void); int read_sample(char *name, short **data, long *length); diff --git a/src/game_em/init.c b/src/game_em/init.c index f5c59b14..972e262d 100644 --- a/src/game_em/init.c +++ b/src/game_em/init.c @@ -187,6 +187,11 @@ int open_all(void) #if defined(PLATFORM_LINUX) || defined(PLATFORM_BSD) +#if 1 + /* disable sound */ + arg_silence = 1; +#endif + if (arg_silence == 0) { for (i = 0; i < SAMPLE_MAX; i++) diff --git a/src/game_em/input.c b/src/game_em/input.c index ad5ee68f..f550494c 100644 --- a/src/game_em/input.c +++ b/src/game_em/input.c @@ -28,6 +28,8 @@ struct PLAYER ply1; struct PLAYER ply2; struct LEVEL lev; +struct LevelInfo_EM native_em_level; + unsigned short **Boom; unsigned short **Cave; unsigned short **Next; @@ -150,12 +152,21 @@ void game_init_vars(void) int game_play_init(int level_nr, char *filename) { +#if 0 if (filename != NULL) { +#endif + player_level = level_nr; - if (cave_convert(filename) != 0) +#if 1 + prepare_em_level(); +#else + if (!LoadNativeLevel_EM(filename)) return 1; +#endif + +#if 0 } else /* !!! SOON OBSOLETE !!! */ { @@ -170,6 +181,7 @@ int game_play_init(int level_nr, char *filename) if (cave_convert(name) != 0) return 1; } +#endif game_initscreen(); game_blitscore(); diff --git a/src/game_em/level.h b/src/game_em/level.h index 82cd93bf..b2e4b3c1 100644 --- a/src/game_em/level.h +++ b/src/game_em/level.h @@ -1,10 +1,13 @@ #ifndef LEVEL_H #define LEVEL_H +#include "main_em.h" #include "tile.h" -#define WIDTH 102 -#define HEIGHT 102 +#define WIDTH EM_MAX_CAVE_WIDTH +#define HEIGHT EM_MAX_CAVE_HEIGHT + +#if 0 struct LEVEL { @@ -82,12 +85,16 @@ struct PLAYER unsigned joy_spin:1; }; +#endif + extern unsigned long Random; extern struct PLAYER ply1; extern struct PLAYER ply2; extern struct LEVEL lev; +extern struct LevelInfo_EM native_em_level; + extern unsigned short **Boom; extern unsigned short **Cave; extern unsigned short **Next; diff --git a/src/game_em/main.c b/src/game_em/main.c index 39975801..252e45f2 100644 --- a/src/game_em/main.c +++ b/src/game_em/main.c @@ -54,17 +54,23 @@ void em_close_all() int em_main_init_game(int level_nr, char *filename) { +#if 0 if (skip_menu) { +#endif + em_game_status = EM_GAME_STATUS_PLAY; if (game_play_init(level_nr, filename) != 0) return 1; + +#if 0 } else { em_game_status = EM_GAME_STATUS_MENU; game_menu_init(); } +#endif return 0; } diff --git a/src/game_em/main_em.h b/src/game_em/main_em.h new file mode 100644 index 00000000..5a0d0436 --- /dev/null +++ b/src/game_em/main_em.h @@ -0,0 +1,538 @@ +#ifndef MAIN_EM_H +#define MAIN_EM_H + +/* 2000-07-30T11:06:03Z ---------------------------------------------------- */ + +#define EM_MAX_CAVE_WIDTH 102 +#define EM_MAX_CAVE_HEIGHT 102 + +/* define these for backwards compatibility */ +#define BAD_ROLL +#define BAD_SPRING + +enum +{ + Xblank = 0, /* still */ + Yacid_splash_eB, /* hmm */ + Yacid_splash_wB, /* hmm */ + +#ifdef BAD_ROLL + Xstone_force_e, /* only use these in eater */ + Xstone_force_w, + Xnut_force_e, + Xnut_force_w, + Xspring_force_e, + Xspring_force_w, + Xemerald_force_e, + Xemerald_force_w, + Xdiamond_force_e, + Xdiamond_force_w, + Xbomb_force_e, + Xbomb_force_w, +#endif + + Xstone, + Xstone_pause, + Xstone_fall, + Ystone_s, + Ystone_sB, + Ystone_e, + Ystone_eB, + Ystone_w, + Ystone_wB, + Xnut, + Xnut_pause, + Xnut_fall, + Ynut_s, + Ynut_sB, + Ynut_e, + Ynut_eB, + Ynut_w, + Ynut_wB, + Xbug_n, + Xbug_e, + Xbug_s, + Xbug_w, + Xbug_gon, + Xbug_goe, + Xbug_gos, + Xbug_gow, + Ybug_n, + Ybug_nB, + Ybug_e, + Ybug_eB, + Ybug_s, + Ybug_sB, + Ybug_w, + Ybug_wB, + Ybug_w_n, + Ybug_n_e, + Ybug_e_s, + Ybug_s_w, + Ybug_e_n, + Ybug_s_e, + Ybug_w_s, + Ybug_n_w, + Ybug_stone, + Ybug_spring, + Xtank_n, + Xtank_e, + Xtank_s, + Xtank_w, + Xtank_gon, + Xtank_goe, + Xtank_gos, + Xtank_gow, + Ytank_n, + Ytank_nB, + Ytank_e, + Ytank_eB, + Ytank_s, + Ytank_sB, + Ytank_w, + Ytank_wB, + Ytank_w_n, + Ytank_n_e, + Ytank_e_s, + Ytank_s_w, + Ytank_e_n, + Ytank_s_e, + Ytank_w_s, + Ytank_n_w, + Ytank_stone, + Ytank_spring, + Xandroid, + Xandroid_1_n, + Xandroid_2_n, + Xandroid_1_e, + Xandroid_2_e, + Xandroid_1_w, + Xandroid_2_w, + Xandroid_1_s, + Xandroid_2_s, + Yandroid_n, + Yandroid_nB, + Yandroid_ne, + Yandroid_neB, + Yandroid_e, + Yandroid_eB, + Yandroid_se, + Yandroid_seB, + Yandroid_s, + Yandroid_sB, + Yandroid_sw, + Yandroid_swB, + Yandroid_w, + Yandroid_wB, + Yandroid_nw, + Yandroid_nwB, + Xspring, + Xspring_pause, + Xspring_e, + Xspring_w, + Xspring_fall, + Yspring_s, + Yspring_sB, + Yspring_e, + Yspring_eB, + Yspring_w, + Yspring_wB, + Yspring_kill_e, + Yspring_kill_eB, + Yspring_kill_w, + Yspring_kill_wB, + Xeater_n, + Xeater_e, + Xeater_w, + Xeater_s, + Yeater_n, + Yeater_nB, + Yeater_e, + Yeater_eB, + Yeater_s, + Yeater_sB, + Yeater_w, + Yeater_wB, + Yeater_stone, + Yeater_spring, + Xalien, + Xalien_pause, + Yalien_n, + Yalien_nB, + Yalien_e, + Yalien_eB, + Yalien_s, + Yalien_sB, + Yalien_w, + Yalien_wB, + Yalien_stone, + Yalien_spring, + Xemerald, + Xemerald_pause, + Xemerald_fall, + Xemerald_shine, + Yemerald_s, + Yemerald_sB, + Yemerald_e, + Yemerald_eB, + Yemerald_w, + Yemerald_wB, + Yemerald_eat, + Yemerald_stone, + Xdiamond, + Xdiamond_pause, + Xdiamond_fall, + Xdiamond_shine, + Ydiamond_s, + Ydiamond_sB, + Ydiamond_e, + Ydiamond_eB, + Ydiamond_w, + Ydiamond_wB, + Ydiamond_eat, + Ydiamond_stone, + Xdrip_fall, + Xdrip_stretch, + Xdrip_stretchB, + Xdrip_eat, + Ydrip_s1, + Ydrip_s1B, + Ydrip_s2, + Ydrip_s2B, + Xbomb, + Xbomb_pause, + Xbomb_fall, + Ybomb_s, + Ybomb_sB, + Ybomb_e, + Ybomb_eB, + Ybomb_w, + Ybomb_wB, + Ybomb_eat, + Xballoon, + Yballoon_n, + Yballoon_nB, + Yballoon_e, + Yballoon_eB, + Yballoon_s, + Yballoon_sB, + Yballoon_w, + Yballoon_wB, + Xgrass, + Ygrass_nB, + Ygrass_eB, + Ygrass_sB, + Ygrass_wB, + Xdirt, + Ydirt_nB, + Ydirt_eB, + Ydirt_sB, + Ydirt_wB, + Xacid_ne, + Xacid_se, + Xacid_s, + Xacid_sw, + Xacid_nw, + Xacid_1, + Xacid_2, + Xacid_3, + Xacid_4, + Xacid_5, + Xacid_6, + Xacid_7, + Xacid_8, + Xball_1, + Xball_1B, + Xball_2, + Xball_2B, + Yball_eat, + Xgrow_ns, + Ygrow_ns_eat, + Xgrow_ew, + Ygrow_ew_eat, + Xwonderwall, + XwonderwallB, + Xameuba_1, + Xameuba_2, + Xameuba_3, + Xameuba_4, + Xameuba_5, + Xameuba_6, + Xameuba_7, + Xameuba_8, + Xdoor_1, + Xdoor_2, + Xdoor_3, + Xdoor_4, + Xdoor_5, + Xdoor_6, + Xdoor_7, + Xdoor_8, + Xkey_1, + Xkey_2, + Xkey_3, + Xkey_4, + Xkey_5, + Xkey_6, + Xkey_7, + Xkey_8, + Xwind_n, + Xwind_e, + Xwind_s, + Xwind_w, + Xwind_nesw, + Xwind_stop, + Xexit, + Xexit_1, + Xexit_2, + Xexit_3, + Xdynamite, + Ydynamite_eat, + Xdynamite_1, + Xdynamite_2, + Xdynamite_3, + Xdynamite_4, + Xbumper, + XbumperB, + Xwheel, + XwheelB, + Xswitch, + XswitchB, + Xsand, + Xsand_stone, + Xsand_stonein_1, + Xsand_stonein_2, + Xsand_stonein_3, + Xsand_stonein_4, + Xsand_stonesand_1, + Xsand_stonesand_2, + Xsand_stonesand_3, + Xsand_stonesand_4, + Xsand_stoneout_1, + Xsand_stoneout_2, + Xsand_sandstone_1, + Xsand_sandstone_2, + Xsand_sandstone_3, + Xsand_sandstone_4, + Xplant, + Yplant, + Xlenses, + Xmagnify, + Xdripper, + XdripperB, + Xfake_blank, + Xfake_blankB, + Xfake_grass, + Xfake_grassB, + Xfake_door_1, + Xfake_door_2, + Xfake_door_3, + Xfake_door_4, + Xfake_door_5, + Xfake_door_6, + Xfake_door_7, + Xfake_door_8, + Xsteel_1, + Xsteel_2, + Xsteel_3, + Xsteel_4, + Xwall_1, + Xwall_2, + Xwall_3, + Xwall_4, + Xround_wall_1, + Xround_wall_2, + Xround_wall_3, + Xround_wall_4, + Xdecor_1, + Xdecor_2, + Xdecor_3, + Xdecor_4, + Xdecor_5, + Xdecor_6, + Xdecor_7, + Xdecor_8, + Xdecor_9, + Xdecor_10, + Xdecor_11, + Xdecor_12, + Xalpha_0, + Xalpha_1, + Xalpha_2, + Xalpha_3, + Xalpha_4, + Xalpha_5, + Xalpha_6, + Xalpha_7, + Xalpha_8, + Xalpha_9, + Xalpha_excla, + Xalpha_quote, + Xalpha_comma, + Xalpha_minus, + Xalpha_perio, + Xalpha_colon, + Xalpha_quest, + Xalpha_a, + Xalpha_b, + Xalpha_c, + Xalpha_d, + Xalpha_e, + Xalpha_f, + Xalpha_g, + Xalpha_h, + Xalpha_i, + Xalpha_j, + Xalpha_k, + Xalpha_l, + Xalpha_m, + Xalpha_n, + Xalpha_o, + Xalpha_p, + Xalpha_q, + Xalpha_r, + Xalpha_s, + Xalpha_t, + Xalpha_u, + Xalpha_v, + Xalpha_w, + Xalpha_x, + Xalpha_y, + Xalpha_z, + Xalpha_arrow_e, + Xalpha_arrow_w, + Xalpha_copyr, + + Xboom_bug, /* passed from explode to synchro (linked explosion); + transition to explode_normal */ + Xboom_bomb, /* passed from explode to synchro (linked explosion); + transition to explode_normal */ + Xboom_android, /* passed from explode to synchro; + transition to boom_2 */ + Xboom_1, /* passed from explode to synchro; + transition to boom_2 */ + Xboom_2, /* transition to boom[] */ + + Znormal, /* passed from synchro to explode, only in next[]; + no picture */ + Zdynamite, /* passed from synchro to explode, only in next[]; + no picture */ + Zplayer, /* special code to indicate player; + no picture */ + ZBORDER, /* special code to indicate border; + no picture */ + + TILE_MAX +}; + +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 */ + + unsigned int width; /* playfield width */ + unsigned int height; /* playfield height */ + unsigned int time_initial; /* time remaining (initial) */ + unsigned int time; /* time remaining (runtime) */ + unsigned int required_initial; /* emeralds needed (initial) */ + unsigned int required; /* emeralds needed (runtime) */ + unsigned int score; /* score */ + + /* fill in all below /every/ time you read a level */ + unsigned int alien_score; /* alien popped by stone/spring score */ + unsigned int ameuba_time; /* ameuba speed */ + unsigned int android_move_cnt_initial; /* android move time counter (initial) */ + unsigned int android_move_cnt; /* android move time counter */ + unsigned int android_move_time; /* android move reset time */ + unsigned int android_clone_cnt_initial; /* android clone time counter (initial) */ + unsigned int android_clone_cnt; /* android clone time counter */ + unsigned int android_clone_time; /* android clone reset time */ + unsigned int ball_cnt; /* ball time counter */ + unsigned int ball_pos; /* ball array pos counter */ + unsigned int ball_random; /* ball is random flag */ + unsigned int ball_state_initial; /* ball currently on flag (initial) */ + unsigned int ball_state; /* ball currently on flag */ + unsigned int ball_time; /* ball reset time */ + unsigned int bug_score; /* bug popped by stone/spring score */ + unsigned int diamond_score; /* diamond collect score */ + unsigned int dynamite_score; /* dynamite collect scoer*/ + unsigned int eater_pos; /* eater array pos */ + unsigned int eater_score; /* eater popped by stone/spring score */ + unsigned int emerald_score; /* emerald collect score */ + unsigned int exit_score; /* exit score */ + unsigned int key_score; /* key collect score */ + unsigned int lenses_cnt_initial; /* lenses time counter (initial) */ + unsigned int lenses_cnt; /* lenses time counter */ + unsigned int lenses_score; /* lenses collect score */ + unsigned int lenses_time; /* lenses reset time */ + unsigned int magnify_cnt_initial; /* magnify time counter (initial) */ + unsigned int magnify_cnt; /* magnify time counter */ + unsigned int magnify_score; /* magnify collect score */ + unsigned int magnify_time; /* magnify reset time */ + unsigned int nut_score; /* nut crack score */ + unsigned int shine_cnt; /* shine counter for emerald/diamond */ + unsigned int slurp_score; /* slurp alien score */ + unsigned int tank_score; /* tank popped by stone/spring */ + unsigned int wheel_cnt_initial; /* wheel time counter (initial) */ + unsigned int wheel_cnt; /* wheel time 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 time 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 currently on flag (initial) */ + unsigned int wonderwall_state; /* wonderwall currently on 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 */ +}; + +struct PLAYER +{ + unsigned int num; + 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 joy_n:1; + unsigned joy_e:1; + unsigned joy_s:1; + unsigned joy_w:1; + unsigned joy_fire:1; + unsigned joy_stick:1; + unsigned joy_spin:1; +}; + +struct LevelInfo_EM +{ + struct LEVEL lev; + struct PLAYER ply1, ply2; + + unsigned short cave[EM_MAX_CAVE_WIDTH][EM_MAX_CAVE_HEIGHT]; + + unsigned short **Boom; + unsigned short **Cave; + unsigned short **Next; + unsigned short **Draw; +}; + +#endif /* MAIN_EM_H */ diff --git a/src/game_em/tile.h b/src/game_em/tile.h index 0af10d72..5d6654de 100644 --- a/src/game_em/tile.h +++ b/src/game_em/tile.h @@ -1,6 +1,10 @@ #ifndef TILE_H #define TILE_H +#include "main_em.h" + +#if 0 + /* 2000-07-30T11:06:03Z */ @@ -415,6 +419,8 @@ enum TILE_MAX }; +#endif + enum { SPR_still = 0, diff --git a/src/main.h b/src/main.h index 739e75f1..3e25cd2f 100644 --- a/src/main.h +++ b/src/main.h @@ -1478,6 +1478,9 @@ struct LevelInfo { struct LevelFileInfo file_info; + /* level stored in native format for the native game engines */ + struct LevelInfo_EM native_em_level; + int game_engine_type; int file_version; /* file format version the level is stored with */