From: Holger Schemel Date: Tue, 1 Sep 2020 18:18:53 +0000 (+0200) Subject: changed constant number of eater arrays to variable for EM game engine X-Git-Tag: 4.2.0.2~20 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=a8c9aaa1bffd5378dbadd747866a10bd7e2faa4d;p=rocksndiamonds.git changed constant number of eater arrays to variable for EM game engine This makes it possible to create and play levels with a number of eater arrays other than eight (which was a contant value before) when using the EM game engine. --- diff --git a/src/files.c b/src/files.c index 3162e629..7b64735f 100644 --- a/src/files.c +++ b/src/files.c @@ -3541,6 +3541,8 @@ static void CopyNativeLevel_RND_to_EM(struct LevelInfo *level) cav->key_score = level->score[SC_KEY]; cav->exit_score = level->score[SC_TIME_BONUS]; + cav->num_eater_arrays = level->num_yamyam_contents; + for (i = 0; i < MAX_ELEMENT_CONTENTS; i++) for (y = 0; y < 3; y++) for (x = 0; x < 3; x++) @@ -3649,9 +3651,9 @@ static void CopyNativeLevel_EM_to_RND(struct LevelInfo *level) level->score[SC_KEY] = cav->key_score; level->score[SC_TIME_BONUS] = cav->exit_score; - level->num_yamyam_contents = MAX_ELEMENT_CONTENTS; + level->num_yamyam_contents = cav->num_eater_arrays; - for (i = 0; i < level->num_yamyam_contents; i++) + for (i = 0; i < MAX_ELEMENT_CONTENTS; i++) for (y = 0; y < 3; y++) for (x = 0; x < 3; x++) level->yamyam_content[i].e[x][y] = diff --git a/src/game_em/cave.c b/src/game_em/cave.c index e501a891..c620133c 100644 --- a/src/game_em/cave.c +++ b/src/game_em/cave.c @@ -58,6 +58,7 @@ void setLevelInfoToDefaults_EM(void) cav.wind_time = 0; cav.wind_direction = 0; + cav.num_eater_arrays = 8; cav.num_ball_arrays = 8; cav.testmode = FALSE; diff --git a/src/game_em/cave.h b/src/game_em/cave.h index d1a9090b..2b6ccef8 100644 --- a/src/game_em/cave.h +++ b/src/game_em/cave.h @@ -252,6 +252,7 @@ struct CAVE int wind_time; /* reset time for wind activity */ int wind_direction; /* wind direction */ + int num_eater_arrays; /* number of eater data arrays used */ int num_ball_arrays; /* number of ball data arrays used */ boolean testmode; /* flag for test mode */ diff --git a/src/game_em/convert.c b/src/game_em/convert.c index 9b8f0a8e..99381064 100644 --- a/src/game_em/convert.c +++ b/src/game_em/convert.c @@ -365,7 +365,8 @@ void prepare_em_level(void) lev.killed_out_of_time = FALSE; - lev.num_ball_arrays = cav.num_ball_arrays; + lev.num_eater_arrays = cav.num_eater_arrays; + lev.num_ball_arrays = cav.num_ball_arrays; for (i = 0; i < 8; i++) for (j = 0; j < 9; j++) diff --git a/src/game_em/emerald.h b/src/game_em/emerald.h index 63009f63..629d66e3 100644 --- a/src/game_em/emerald.h +++ b/src/game_em/emerald.h @@ -702,6 +702,7 @@ struct LOGIC int eater_pos; /* counter for eater array position */ int shine_cnt; /* counter for emerald/diamond shining */ + int num_eater_arrays; /* number of eater data arrays used */ int num_ball_arrays; /* number of ball data arrays used */ int home_initial; /* number of players (initial) */ diff --git a/src/game_em/logic.c b/src/game_em/logic.c index ba9c05e5..68a977aa 100644 --- a/src/game_em/logic.c +++ b/src/game_em/logic.c @@ -165,7 +165,7 @@ static void Lboom_eater(int x, int y) boom[x][y+1] = lev.eater_array[lev.eater_pos][7]; boom[x+1][y+1] = lev.eater_array[lev.eater_pos][8]; - lev.eater_pos = (lev.eater_pos + 1) % 8; + lev.eater_pos = (lev.eater_pos + 1) % lev.num_eater_arrays; #if PLAY_ELEMENT_SOUND play_element_sound(x, y, SOUND_boom, Xeater_n);