From: Holger Schemel Date: Sun, 1 Dec 2024 15:35:18 +0000 (+0100) Subject: added setting increased BD cave time also in main game engine X-Git-Tag: 4.4.0.0-test-4^0 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=9eb7bd6f7b3b3cba5cf8156606ec7cdb113d36e5;p=rocksndiamonds.git added setting increased BD cave time also in main game engine This change is required if the BD cave time was increased by collecting clocks; else the game is running out of time too early in the main game engine, which still uses the previous level time, even though the BD cave time is displayed correctly in the game panel. However, a decreased BD cave time (for example, if a voodoo doll was destroyed) may not be set in the main engine, as it may result in an immediate "out of time" event, which is handled separately in the main game engine. --- diff --git a/src/game.c b/src/game.c index 00a1012b..5a58b1c2 100644 --- a/src/game.c +++ b/src/game.c @@ -15968,6 +15968,11 @@ boolean isSoundPlaying_BD(int element_bd, int sample) return FALSE; } +void SetTimeLeft(int time_left) +{ + TimeLeft = time_left; +} + void PlayLevelSound_EM(int xx, int yy, int element_em, int sample) { int element = (element_em > -1 ? map_element_EM_to_RND_game(element_em) : 0); diff --git a/src/game_bd/bd_caveengine.c b/src/game_bd/bd_caveengine.c index 29f100e8..a18d3b85 100644 --- a/src/game_bd/bd_caveengine.c +++ b/src/game_bd/bd_caveengine.c @@ -1162,6 +1162,7 @@ static GdElement player_eat_element(GdCave *cave, const GdElement element, int x cave->time += cave->time_bonus * cave->timing_factor; if (cave->time > cave->max_time * cave->timing_factor) cave->time -= cave->max_time * cave->timing_factor; + setTimeLeft_BD(); // no space, rather a dirt remains there... return O_DIRT; diff --git a/src/game_bd/export_bd.h b/src/game_bd/export_bd.h index e79e9789..f3b81d5b 100644 --- a/src/game_bd/export_bd.h +++ b/src/game_bd/export_bd.h @@ -121,6 +121,7 @@ boolean checkBonusTime_BD(void); int getNonScannedElement_BD(int); int getFramesPerSecond_BD(void); int getTimeLeft_BD(void); +void setTimeLeft_BD(void); void SetTimeFrames_BD(int); void InitGfxBuffers_BD(void); diff --git a/src/game_bd/import_bd.h b/src/game_bd/import_bd.h index 08e434c3..c594a9b1 100644 --- a/src/game_bd/import_bd.h +++ b/src/game_bd/import_bd.h @@ -33,6 +33,7 @@ void PlayLevelSound_BD(int, int, int, int); void StopSound_BD(int, int); boolean isSoundPlaying_BD(int, int); +void SetTimeLeft(int); void BackToFront(void); byte *TapePlayAction_BD(void); diff --git a/src/game_bd/main_bd.c b/src/game_bd/main_bd.c index 1bcd740b..febe4341 100644 --- a/src/game_bd/main_bd.c +++ b/src/game_bd/main_bd.c @@ -262,6 +262,11 @@ int getTimeLeft_BD(void) return 0; } +void setTimeLeft_BD(void) +{ + SetTimeLeft(getTimeLeft_BD()); +} + void SetTimeFrames_BD(int frames_played) { // needed to store final time after solving game (before counting down remaining time)