- Duke: Fixed WT fallback for classic sounds in cases the user data does not exist.

currently that's only the case for CRANEGRAB which is aliased because of differences between Duke and RR.
This commit is contained in:
Christoph Oelckers 2023-09-23 14:29:41 +02:00
parent 0480a5e992
commit 4bb66fb44e

View file

@ -132,6 +132,15 @@ static FSoundID GetReplacementSound(FSoundID soundNum)
if (wt_forcevoc && isWorldTour() && soundEngine->isValidSoundId(soundNum))
{
auto const* snd = soundEngine->GetUserData(soundNum);
if (snd == nullptr)
{
auto S_sfx = soundEngine->GetSfx(soundNum);
if (!S_sfx->bRandomHeader && S_sfx->link != sfxinfo_t::NO_LINK)
{
snd = soundEngine->GetUserData(S_sfx->link);
if (snd == nullptr) return soundNum;
}
}
int sndx = snd[kWorldTourMapping];
if (sndx > 0) soundNum = FSoundID::fromInt(sndx);
}