From a31f49b0d06d4874e266c62383a225d61bb1ae5d Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Thu, 20 Feb 2020 15:44:56 +0100 Subject: [PATCH] added flags for test mode, teamwork mode and infinite levels to EM engine --- src/game_em/cave.c | 4 ++++ src/game_em/cave.h | 4 ++++ src/game_em/convert.c | 33 ++++++++++++++++++++++----------- src/game_em/emerald.h | 1 + src/game_em/reademc.c | 4 ++++ 5 files changed, 35 insertions(+), 11 deletions(-) diff --git a/src/game_em/cave.c b/src/game_em/cave.c index fc872e9c..3519723d 100644 --- a/src/game_em/cave.c +++ b/src/game_em/cave.c @@ -68,6 +68,10 @@ void setLevelInfoToDefaults_EM(void) cav.num_ball_arrays = 8; + cav.testmode = FALSE; + cav.teamwork = FALSE; + cav.infinite = FALSE; + for (i = 0; i < 8; i++) for (j = 0; j < 9; j++) cav.eater_array[i][j] = Cblank; diff --git a/src/game_em/cave.h b/src/game_em/cave.h index 0e3704d9..5dd05255 100644 --- a/src/game_em/cave.h +++ b/src/game_em/cave.h @@ -260,6 +260,10 @@ struct CAVE int num_ball_arrays; /* number of ball data arrays used */ + boolean testmode; /* test mode */ + boolean teamwork; /* two player mode */ + boolean infinite; /* cave is infinitely wide */ + short eater_array[8][9]; /* eater data */ short ball_array[8][8]; /* ball data */ short android_array[GAME_TILE_MAX]; /* android clone data */ diff --git a/src/game_em/convert.c b/src/game_em/convert.c index 4a4b9cf4..e5bc5c68 100644 --- a/src/game_em/convert.c +++ b/src/game_em/convert.c @@ -275,18 +275,21 @@ void prepare_em_level(void) lev.right = lev.left + lev.width; lev.bottom = lev.top + lev.height; - /* add linked cave buffer columns for wrap-around movement */ - for (x = 0; x < lev.left; x++) + if (cav.infinite) { - lev.cavecol[x] = lev.cavecol[lev.width + x]; - lev.nextcol[x] = lev.nextcol[lev.width + x]; - lev.drawcol[x] = lev.drawcol[lev.width + x]; - lev.boomcol[x] = lev.boomcol[lev.width + x]; - - lev.cavecol[lev.right + x] = lev.cavecol[lev.left + x]; - lev.nextcol[lev.right + x] = lev.nextcol[lev.left + x]; - lev.drawcol[lev.right + x] = lev.drawcol[lev.left + x]; - lev.boomcol[lev.right + x] = lev.boomcol[lev.left + x]; + /* add linked cave buffer columns for wrap-around movement */ + for (x = 0; x < lev.left; x++) + { + lev.cavecol[x] = lev.cavecol[lev.width + x]; + lev.nextcol[x] = lev.nextcol[lev.width + x]; + lev.drawcol[x] = lev.drawcol[lev.width + x]; + lev.boomcol[x] = lev.boomcol[lev.width + x]; + + lev.cavecol[lev.right + x] = lev.cavecol[lev.left + x]; + lev.nextcol[lev.right + x] = lev.nextcol[lev.left + x]; + lev.drawcol[lev.right + x] = lev.drawcol[lev.left + x]; + lev.boomcol[lev.right + x] = lev.boomcol[lev.left + x]; + } } for (x = 0; x < lev.width; x++) @@ -301,6 +304,14 @@ void prepare_em_level(void) lev.gems_needed = cav.gems_needed; lev.score = 0; + lev.testmode = cav.testmode; + + if (lev.testmode) + { + lev.time = 0; + lev.gems_needed = 0; + } + lev.eater_score = cav.eater_score; lev.alien_score = cav.alien_score; lev.bug_score = cav.bug_score; diff --git a/src/game_em/emerald.h b/src/game_em/emerald.h index 0bb0993b..bceb8473 100644 --- a/src/game_em/emerald.h +++ b/src/game_em/emerald.h @@ -678,6 +678,7 @@ struct LOGIC int home; /* number of players not yet at home */ /* 0 == all players at home */ + boolean testmode; /* test mode */ boolean killed_out_of_time; /* kill player due to time out */ int exit_x, exit_y; /* kludge for playing player exit sound */ diff --git a/src/game_em/reademc.c b/src/game_em/reademc.c index 05fa190f..b4ddbc24 100644 --- a/src/game_em/reademc.c +++ b/src/game_em/reademc.c @@ -273,6 +273,10 @@ void convert_em_level(unsigned char *src, int file_version) cav.time_seconds = MIN(GET_BE16(src[2110]), 9999); cav.gems_needed = src[2095]; + cav.infinite = TRUE; + cav.testmode = FALSE; + cav.teamwork = (src[2150] & 128) ? TRUE : FALSE; + /* scores */ cav.emerald_score = src[2084]; -- 2.34.1