From 6eba7dc4101b7aabf7224d0d404fc4567564748f Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 18 Aug 2020 20:26:16 +0200 Subject: [PATCH] - play music on the summary screen and check for advancing every frame. Fixes #203 --- source/sw/src/2d.cpp | 22 +++++++++++++++------- source/sw/src/d_menu.cpp | 1 + 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/source/sw/src/2d.cpp b/source/sw/src/2d.cpp index b71c7f15a..f1e8afd72 100644 --- a/source/sw/src/2d.cpp +++ b/source/sw/src/2d.cpp @@ -383,17 +383,25 @@ private: twod->ClearScreen(); int totalclock = int(clock * 120 / 1'000'000'000); - while (totalclock > nextclock) + if (clock == 0) { - nextclock += synctics; + PlaySong(nullptr, ThemeSongs[1], ThemeTrack[1]); + } - if (skiprequest && State >= s_BonusRest && State < &s_BonusRest[countof(s_BonusRest)]) + if (skiprequest && State >= s_BonusRest && State < &s_BonusRest[countof(s_BonusRest)]) + { + State = s_BonusAnim[STD_RANDOM_RANGE(countof(s_BonusAnim))]; + Tics = 0; + skiprequest = false; + nextclock = totalclock; + } + else + { + while (totalclock > nextclock) { - State = s_BonusAnim[STD_RANDOM_RANGE(countof(s_BonusAnim))]; - Tics = 0; - skiprequest = false; + nextclock += synctics; + gStateControl(&State, &Tics); } - gStateControl(&State, &Tics); } twod->ClearScreen(); DrawTexture(twod, tileGetTexture(BONUS_SCREEN_PIC, true), 0, 0, DTA_FullscreenEx, FSMode_ScaleToFit43, DTA_LegacyRenderStyle, STYLE_Normal, TAG_DONE); diff --git a/source/sw/src/d_menu.cpp b/source/sw/src/d_menu.cpp index cf7174fd1..64b2a8bba 100644 --- a/source/sw/src/d_menu.cpp +++ b/source/sw/src/d_menu.cpp @@ -47,6 +47,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "raze_sound.h" #include "sounds.h" #include "gamestate.h" +#include "raze_music.h" #include "../../glbackend/glbackend.h"