From f7132b81a5b7559991e1048ab8680c65cc4b98c2 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sat, 11 May 2024 13:24:18 +0200 Subject: [PATCH] fixed score time for BD engine --- src/game.c | 6 +++++- src/game_bd/export_bd.h | 4 ++++ src/game_bd/main_bd.c | 8 ++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/game.c b/src/game.c index 1966bb3c..d835b19f 100644 --- a/src/game.c +++ b/src/game.c @@ -4864,7 +4864,8 @@ static void LevelSolved_SetFinalGameValues(void) { game.time_final = (level.game_engine_type == GAME_ENGINE_TYPE_BD ? game_bd.time_left : game.no_level_time_limit ? TimePlayed : TimeLeft); - game.score_time_final = (level.use_step_counter ? TimePlayed : + game.score_time_final = (level.game_engine_type == GAME_ENGINE_TYPE_BD ? game_bd.frames_played : + level.use_step_counter ? TimePlayed : TimePlayed * FRAMES_PER_SECOND + TimeFrames); game.score_final = (level.game_engine_type == GAME_ENGINE_TYPE_BD ? game_bd.score : @@ -11835,6 +11836,9 @@ static void CheckLevelTime(void) // if last second running, wait for native engine time to exactly reach zero if (getTimeLeft_BD() == 1 && TimeLeft == 1) TimeFrames = frames_per_second - 1; + + // needed to store final time after solving game (before counting down remaining time) + SetTimeFrames_BD(TimePlayed * FRAMES_PER_SECOND + TimeFrames); } if (TimeFrames >= frames_per_second) diff --git a/src/game_bd/export_bd.h b/src/game_bd/export_bd.h index f11a4aad..2344d2d0 100644 --- a/src/game_bd/export_bd.h +++ b/src/game_bd/export_bd.h @@ -47,6 +47,9 @@ struct GameInfo_BD int time_left; int gems_still_needed; int score; + + // needed for saving score time + int frames_played; }; struct LevelInfo_BD @@ -96,6 +99,7 @@ boolean checkGamePlaying_BD(void); boolean checkBonusTime_BD(void); int getFramesPerSecond_BD(void); int getTimeLeft_BD(void); +void SetTimeFrames_BD(int); void InitGfxBuffers_BD(void); diff --git a/src/game_bd/main_bd.c b/src/game_bd/main_bd.c index 32305736..e6def9ed 100644 --- a/src/game_bd/main_bd.c +++ b/src/game_bd/main_bd.c @@ -255,6 +255,14 @@ int getTimeLeft_BD(void) return 0; } +void SetTimeFrames_BD(int frames_played) +{ + // needed to store final time after solving game (before counting down remaining time) + if (game_bd.game->state_counter == GAME_INT_CAVE_RUNNING) + game_bd.frames_played = frames_played; + +} + static void UpdateGameDoorValues_BD(void) { GdCave *cave = game_bd.game->cave; -- 2.34.1