From e47671c865f6b6ebd284e3a6a8d5e0fb068d0599 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 17 May 2021 11:41:43 +0200 Subject: [PATCH] - make the title music only play once, unless a real demo is successfully played. --- src/d_main.cpp | 4 +++- src/g_game.cpp | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/d_main.cpp b/src/d_main.cpp index fe099331c..fa2cc6734 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -315,6 +315,7 @@ FStartupInfo GameStartupInfo; FString lastIWAD; int restart = 0; bool AppActive = true; +bool playedtitlemusic; cycle_t FrameCycles; @@ -1573,7 +1574,8 @@ void D_DoAdvanceDemo (void) gamestate = GS_DEMOSCREEN; pagename = gameinfo.TitlePage; pagetic = (int)(gameinfo.titleTime * TICRATE); - S_ChangeMusic (gameinfo.titleMusic, gameinfo.titleOrder, false); + if (!playedtitlemusic) S_ChangeMusic (gameinfo.titleMusic, gameinfo.titleOrder, false); + playedtitlemusic = true; demosequence = 3; pagecount = 0; C_HideConsole (); diff --git a/src/g_game.cpp b/src/g_game.cpp index 836481e99..bfebb4f6b 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -138,6 +138,7 @@ CUSTOM_CVAR (Int, displaynametags, 0, CVAR_ARCHIVE) CVAR(Int, nametagcolor, CR_GOLD, CVAR_ARCHIVE) +extern bool playedtitlemusic; gameaction_t gameaction; gamestate_t gamestate = GS_STARTUP; @@ -1166,7 +1167,7 @@ void G_Ticker () case ga_loadgameplaydemo: G_DoLoadGame (); // fallthrough - case ga_playdemo: + case ga_playdemo: G_DoPlayDemo (); break; case ga_completed: @@ -2934,6 +2935,7 @@ void G_DoPlayDemo (void) usergame = false; demoplayback = true; + playedtitlemusic = false; } }