From 25bf0854cf6709e3594e08da643fde8efdd8ee3e Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 12 Mar 2021 23:15:34 +0100 Subject: [PATCH] - allow game specific music names for all games supporting an Ogg-format CD audio soundtrack. New names are: REDNECKxx.ogg for Redneck Rampage REDNECKRIDESxx.ogg for RR Rides Again. SHADOWxx.ogg for Shadow Warrior. The motivation here is to allow copying all this music to a single folder or .zip file and reference it from all games. --- source/games/duke/src/sounds.cpp | 5 ++++- source/games/sw/src/sounds.cpp | 16 ++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/source/games/duke/src/sounds.cpp b/source/games/duke/src/sounds.cpp index a21b1ad40..b4066e57d 100644 --- a/source/games/duke/src/sounds.cpp +++ b/source/games/duke/src/sounds.cpp @@ -744,7 +744,10 @@ void S_PlayRRMusic(int newTrack) if (newTrack != 10 && (g_cdTrack > 9 || g_cdTrack < 2)) g_cdTrack = 2; - FStringf filename("track%02d.ogg", g_cdTrack); + FStringf filename("redneck%s%02d.ogg", isRRRA()? "rides" : "", g_cdTrack); + if (Mus_Play(nullptr, filename, false)) return; + + filename.Format("track%02d.ogg", g_cdTrack); if (Mus_Play(nullptr, filename, false)) return; } // If none of the tracks managed to start, disable the CD music for this session so that regular music can play if defined. diff --git a/source/games/sw/src/sounds.cpp b/source/games/sw/src/sounds.cpp index e0343fcd1..bb645b2bd 100644 --- a/source/games/sw/src/sounds.cpp +++ b/source/games/sw/src/sounds.cpp @@ -948,10 +948,14 @@ bool PlaySong(const char* mapname, const char* song_file_name, int cdaudio_track // Play CD audio if enabled. if (cdaudio_track >= 0 && (mus_redbook || !song_file_name || *song_file_name == 0)) { - FStringf trackname("track%02d.ogg", cdaudio_track); + FStringf trackname("shadow%02d.ogg", cdaudio_track); if (!Mus_Play(mapname, trackname, true)) { - Printf("Can't find CD track %i!\n", cdaudio_track); + trackname.Format("track%02d.ogg", cdaudio_track); + if (!Mus_Play(mapname, trackname, true)) + { + Printf("Can't find CD track %i!\n", cdaudio_track); + } } else return true; } @@ -962,8 +966,12 @@ bool PlaySong(const char* mapname, const char* song_file_name, int cdaudio_track if (!Mus_Play(mapname, song_file_name, true)) { // try the CD track anyway if no MIDI could be found (the original game doesn't have any MIDI, it was CD Audio only, this avoids no music playing if mus_redbook is off.) - FStringf trackname("track%02d.ogg", cdaudio_track); - if (!Mus_Play(nullptr, trackname, true)) return false; + FStringf trackname("shadow%02d.ogg", cdaudio_track); + if (!Mus_Play(mapname, trackname, true)) + { + trackname.Format("track%02d.ogg", cdaudio_track); + if (!Mus_Play(nullptr, trackname, true)) return false; + } } return true; }