- 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.
This commit is contained in:
Christoph Oelckers 2021-03-12 23:15:34 +01:00
parent d7f720664a
commit 25bf0854cf
2 changed files with 16 additions and 5 deletions

View file

@ -744,7 +744,10 @@ void S_PlayRRMusic(int newTrack)
if (newTrack != 10 && (g_cdTrack > 9 || g_cdTrack < 2)) if (newTrack != 10 && (g_cdTrack > 9 || g_cdTrack < 2))
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 (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. // If none of the tracks managed to start, disable the CD music for this session so that regular music can play if defined.

View file

@ -948,10 +948,14 @@ bool PlaySong(const char* mapname, const char* song_file_name, int cdaudio_track
// Play CD audio if enabled. // Play CD audio if enabled.
if (cdaudio_track >= 0 && (mus_redbook || !song_file_name || *song_file_name == 0)) 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)) 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; 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)) 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.) // 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); FStringf trackname("shadow%02d.ogg", cdaudio_track);
if (!Mus_Play(nullptr, trackname, true)) return false; if (!Mus_Play(mapname, trackname, true))
{
trackname.Format("track%02d.ogg", cdaudio_track);
if (!Mus_Play(nullptr, trackname, true)) return false;
}
} }
return true; return true;
} }