From 072b66fb9fecc14e4772098993a3fd7d41aa3d50 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 12 Aug 2013 21:11:53 +0200 Subject: [PATCH] - fixed: The music that's defined in the Gameinfo section of MAPINFO could not set the order for multitrack music lumps. --- src/d_main.cpp | 2 +- src/gi.cpp | 20 +++++++++++++++++--- src/gi.h | 3 +++ src/intermission/intermission.cpp | 2 +- src/wi_stuff.cpp | 2 +- 5 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/d_main.cpp b/src/d_main.cpp index 6c92babe4..ae1c5144d 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -1300,7 +1300,7 @@ void D_DoAdvanceDemo (void) gamestate = GS_DEMOSCREEN; pagename = gameinfo.titlePage; pagetic = (int)(gameinfo.titleTime * TICRATE); - S_StartMusic (gameinfo.titleMusic); + S_ChangeMusic (gameinfo.titleMusic, gameinfo.titleOrder, false); demosequence = 3; pagecount = 0; C_HideConsole (); diff --git a/src/gi.cpp b/src/gi.cpp index 75476c800..d9d58dc9e 100644 --- a/src/gi.cpp +++ b/src/gi.cpp @@ -184,6 +184,20 @@ const char* GameInfoBorders[] = gameinfo.key.color = NAME_Null; \ } +#define GAMEINFOKEY_MUSIC(key, order, variable) \ + else if(nextKey.CompareNoCase(variable) == 0) \ + { \ + sc.MustGetToken(TK_StringConst); \ + gameinfo.order = 0; \ + char *colon = strchr (sc.String, ':'); \ + if (colon) \ + { \ + gameinfo.order = atoi(colon+1); \ + *colon = 0; \ + } \ + gameinfo.key = sc.String; \ + } + void FMapInfoParser::ParseGameInfo() { @@ -286,12 +300,12 @@ void FMapInfoParser::ParseGameInfo() GAMEINFOKEY_STRINGARRAY(creditPages, "CreditPage", 8, true) GAMEINFOKEY_STRINGARRAY(PlayerClasses, "addplayerclasses", 0, false) GAMEINFOKEY_STRINGARRAY(PlayerClasses, "playerclasses", 0, true) - GAMEINFOKEY_STRING(titleMusic, "titleMusic") + GAMEINFOKEY_MUSIC(titleMusic, titleOrder, "titleMusic") GAMEINFOKEY_FLOAT(titleTime, "titleTime") GAMEINFOKEY_FLOAT(advisoryTime, "advisoryTime") GAMEINFOKEY_FLOAT(pageTime, "pageTime") GAMEINFOKEY_STRING(chatSound, "chatSound") - GAMEINFOKEY_STRING(finaleMusic, "finaleMusic") + GAMEINFOKEY_MUSIC(finaleMusic, finaleOrder, "finaleMusic") GAMEINFOKEY_CSTRING(finaleFlat, "finaleFlat", 8) GAMEINFOKEY_STRINGARRAY(finalePages, "finalePage", 8, true) GAMEINFOKEY_STRINGARRAY(infoPages, "addinfoPage", 8, false) @@ -309,7 +323,7 @@ void FMapInfoParser::ParseGameInfo() GAMEINFOKEY_COLOR(defaultbloodparticlecolor, "defaultbloodparticlecolor") GAMEINFOKEY_STRING(backpacktype, "backpacktype") GAMEINFOKEY_STRING(statusbar, "statusbar") - GAMEINFOKEY_STRING(intermissionMusic, "intermissionMusic") + GAMEINFOKEY_MUSIC(intermissionMusic, intermissionOrder, "intermissionMusic") GAMEINFOKEY_STRING(CursorPic, "CursorPic") GAMEINFOKEY_BOOL(noloopfinalemusic, "noloopfinalemusic") GAMEINFOKEY_BOOL(drawreadthis, "drawreadthis") diff --git a/src/gi.h b/src/gi.h index ff678df07..6b887e1dd 100644 --- a/src/gi.h +++ b/src/gi.h @@ -91,11 +91,13 @@ struct gameinfo_t TArray PlayerClasses; FString titleMusic; + int titleOrder; float titleTime; float advisoryTime; float pageTime; FString chatSound; FString finaleMusic; + int finaleOrder; char finaleFlat[9]; char borderFlat[9]; char SkyFlatName[9]; @@ -114,6 +116,7 @@ struct gameinfo_t FString backpacktype; FString statusbar; FString intermissionMusic; + int intermissionOrder; FString CursorPic; DWORD dimcolor; float dimamount; diff --git a/src/intermission/intermission.cpp b/src/intermission/intermission.cpp index 6ee67006e..91090e432 100644 --- a/src/intermission/intermission.cpp +++ b/src/intermission/intermission.cpp @@ -80,7 +80,7 @@ void DIntermissionScreen::Init(FIntermissionAction *desc, bool first) if (desc->mMusic.IsEmpty()) { // only start the default music if this is the first action in an intermission - if (first) S_ChangeMusic (gameinfo.finaleMusic, 0, desc->mMusicLooping); + if (first) S_ChangeMusic (gameinfo.finaleMusic, gameinfo.finaleOrder, desc->mMusicLooping); } else { diff --git a/src/wi_stuff.cpp b/src/wi_stuff.cpp index 37b418ce9..6ae9148af 100644 --- a/src/wi_stuff.cpp +++ b/src/wi_stuff.cpp @@ -1947,7 +1947,7 @@ void WI_Ticker(void) if (level.info->InterMusic.IsNotEmpty()) S_ChangeMusic(level.info->InterMusic, level.info->intermusicorder); else - S_ChangeMusic (gameinfo.intermissionMusic.GetChars()); + S_ChangeMusic (gameinfo.intermissionMusic.GetChars(), gameinfo.intermissionOrder); }