From 2084c5353831af850d70742322cceca7aa5ec58e Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 9 Apr 2021 21:21:53 +0200 Subject: [PATCH] - fixed extended music lookup again. --- source/core/parsefuncs.h | 1 + source/core/raze_music.cpp | 25 ++++++++++++++----------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/source/core/parsefuncs.h b/source/core/parsefuncs.h index 61459d10a..5f2d18026 100644 --- a/source/core/parsefuncs.h +++ b/source/core/parsefuncs.h @@ -243,3 +243,4 @@ void parseDefineTint(FScanner& sc, FScriptPosition& pos) if (!sc.GetNumber(f)) return; lookups.setPaletteTint(pal, r, g, b, 0, 0, 0, f); } + \ No newline at end of file diff --git a/source/core/raze_music.cpp b/source/core/raze_music.cpp index b2c3f0aed..c23f0b0ff 100644 --- a/source/core/raze_music.cpp +++ b/source/core/raze_music.cpp @@ -133,21 +133,24 @@ FileReader OpenMusic(const char* musicname) if (!reader.isOpen()) { int lumpnum = LookupMusic(musicname); - if (mus_extendedlookup && lumpnum >= 0) - { - // EDuke also looks in a subfolder named after the main game resource. Do this as well if extended lookup is active. - auto rfn = fileSystem.GetResourceFileName(fileSystem.GetFileContainer(lumpnum)); - auto rfbase = ExtractFileBase(rfn); - FStringf aliasMusicname("music/%s/%s", rfbase.GetChars(), musicname); - int newlumpnum = LookupMusic(aliasMusicname); - if (newlumpnum >= 0) lumpnum = newlumpnum; - } - if (lumpnum == -1) + if (mus_extendedlookup || lumpnum < 0) { + if (lumpnum >= 0) + { + // EDuke also looks in a subfolder named after the main game resource. Do this as well if extended lookup is active. + auto rfn = fileSystem.GetResourceFileName(fileSystem.GetFileContainer(lumpnum)); + auto rfbase = ExtractFileBase(rfn); + FStringf aliasMusicname("music/%s/%s", rfbase.GetChars(), musicname); + int newlumpnum = LookupMusic(aliasMusicname); + if (newlumpnum >= 0) lumpnum = newlumpnum; + } + // Always look in the 'music' subfolder as well. This gets used by multiple setups to store ripped CD tracks. FStringf aliasMusicname("music/%s", musicname); - lumpnum = LookupMusic(aliasMusicname); + int newlumpnum = LookupMusic(aliasMusicname, lumpnum >= 0); + if (newlumpnum >= 0) lumpnum = newlumpnum; } + if (lumpnum == -1 && (g_gameType & GAMEFLAG_SW)) { // Some Shadow Warrior distributions have the music in a subfolder named 'classic'. Check that, too.