From a80fea00e2194d48dedb519938bc1475daabb8eb Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sat, 27 Jan 2024 21:19:32 +0200 Subject: [PATCH] Rename 2nd original battle music If "Battle B" music file is found, use it instead of tensor B for the second original battle music. Allows us to replace either the enemy present or battle version of the same track instead of always both when "tensor B" is replaced. --- Utils/Music Control.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Utils/Music Control.cpp b/Utils/Music Control.cpp index 0d1361d7..aa86d29d 100644 --- a/Utils/Music Control.cpp +++ b/Utils/Music Control.cpp @@ -69,7 +69,7 @@ CHAR8* szMusicList[NUM_MUSIC] = "MUSIC\\triumph", "MUSIC\\death", "MUSIC\\battle A", - "MUSIC\\tensor B", + "MUSIC\\battle B", "MUSIC\\creepy", "MUSIC\\creature battle", "MUSIC", @@ -96,6 +96,9 @@ static void AddMusicToList(STR fileName, NewMusicList mode) void InitializeMusicLists() { + UINT8 constexpr buf = 64; + CHAR8 fileName[buf]; + // Special casing original music so they can be easily replaced with new files AddMusicToList(szMusicList[MENUMIX_MUSIC], MUSICLIST_MAIN_MENU); AddMusicToList(szMusicList[MARIMBAD2_MUSIC], MUSICLIST_LAPTOP); @@ -110,7 +113,14 @@ void InitializeMusicLists() AddMusicToList(szMusicList[TENSOR_C_MUSIC], MUSICLIST_TACTICAL_ENEMYPRESENT); AddMusicToList(szMusicList[BATTLE_A_MUSIC], MUSICLIST_TACTICAL_BATTLE); - AddMusicToList(szMusicList[BATTLE_B_MUSIC], MUSICLIST_TACTICAL_BATTLE); + if (SoundFileExists(szMusicList[BATTLE_B_MUSIC], fileName)) + { + AddMusicToList(szMusicList[BATTLE_B_MUSIC], MUSICLIST_TACTICAL_BATTLE); + } + else + { + AddMusicToList(szMusicList[TENSOR_B_MUSIC], MUSICLIST_TACTICAL_BATTLE); + } AddMusicToList(szMusicList[TRIUMPH_MUSIC], MUSICLIST_TACTICAL_VICTORY); AddMusicToList(szMusicList[DEATH_MUSIC], MUSICLIST_TACTICAL_DEATH); @@ -118,8 +128,6 @@ void InitializeMusicLists() AddMusicToList(szMusicList[CREATURE_BATTLE_MUSIC], MUSICLIST_TACTICAL_CREEPY_BATTLE); - UINT8 constexpr buf = 64; - CHAR8 fileName[buf]; // Read music files into list for (size_t j = MUSICLIST_MAIN_MENU; j < MAX_MUSIC; j++) {