From: Holger Schemel Date: Tue, 14 Jan 2025 22:36:17 +0000 (+0100) Subject: fixed stopping sounds while (un)covering screen when using BD engine X-Git-Tag: 4.4.0.1~12 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=92fcb4f53808ecce8aaeedbc84cb5442b6b985b8;p=rocksndiamonds.git fixed stopping sounds while (un)covering screen when using BD engine When using the BD engine, this change prevents stopping (fading) sounds after covering the screen if immediately followed by uncovering the screen again when either restarting a game or starting a new game directly after finishing the previous game. --- diff --git a/src/game.c b/src/game.c index 03b555bf..2f31bc7f 100644 --- a/src/game.c +++ b/src/game.c @@ -1126,6 +1126,7 @@ static void PlayLevelSoundElementActionIfLoop(int, int, int, int); static void PlayLevelSoundActionIfLoop(int, int, int); static void StopLevelSoundActionIfLoop(int, int, int); static void PlayLevelMusic(void); +static void FadeLevelMusic(void); static void FadeLevelSoundsAndMusic(void); static void HandleGameButtons(struct GadgetInfo *); @@ -3717,6 +3718,16 @@ static void DebugPrintPlayerStatus(char *message) } #endif +static boolean checkKeepPlayingSoundsWhenRestarting(boolean restarting) +{ + // keep playing continuous loop sound during covering and uncovering screen for BD engine + if (level.game_engine_type == GAME_ENGINE_TYPE_BD && + restarting && game.keep_panel_open_when_restarting) + return TRUE; + + return FALSE; +} + static boolean checkCloseGamePanelDoor(boolean restarting) { // do not close game panel door if game restart was triggered by CE action @@ -3820,7 +3831,10 @@ void InitGame(void) // cover BD screen before closing game panel door CoverScreen(); - FadeLevelSoundsAndMusic(); + if (checkKeepPlayingSoundsWhenRestarting(restarting)) + FadeLevelMusic(); + else + FadeLevelSoundsAndMusic(); if (checkCloseGamePanelDoor(restarting)) CloseDoor(DOOR_CLOSE_1);