From b9fbd4b1884e40ae7f8e0bb155f951adcf999df6 Mon Sep 17 00:00:00 2001 From: qndel Date: Thu, 21 Oct 2021 21:24:02 +0200 Subject: [PATCH] prevent cutting off button sound --- Source/menu.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Source/menu.cpp b/Source/menu.cpp index e88085eab..a9b527b69 100644 --- a/Source/menu.cpp +++ b/Source/menu.cpp @@ -131,6 +131,13 @@ bool mainmenu_select_hero_dialog(GameData *gameData) return true; } +void mainmenu_wait_for_button_sound() +{ + SDL_FillRect(DiabloUiSurface(), nullptr, 0x000000); + UiPollAndRender(); + SDL_Delay(350); // delay to let button pressed sound finish playing +} + void mainmenu_loop() { bool done; @@ -170,8 +177,10 @@ void mainmenu_loop() case MAINMENU_REPLAY_INTRO: if (gbIsSpawn && diabdat_mpq == nullptr) { UiSelOkDialog(nullptr, _(/* TRANSLATORS: Error Message when a Shareware User clicks on "Replay Intro" in the Main Menu */ "The Diablo introduction cinematic is only available in the full retail version of Diablo. Visit https://www.gog.com/game/diablo to purchase."), true); - } else if (gbActive) + } else if (gbActive) { + mainmenu_wait_for_button_sound(); PlayIntro(); + } menu = MAINMENU_EXTRAS; break; case MAINMENU_SHOW_CREDITS: @@ -183,6 +192,7 @@ void mainmenu_loop() menu = MAINMENU_EXTRAS; break; case MAINMENU_EXIT_DIABLO: + mainmenu_wait_for_button_sound(); done = true; break; case MAINMENU_EXTRAS: