fixed handling of DSDHacked sound replacement in the index range between the regular sounds and the MBF21 extensions.

This commit is contained in:
Christoph Oelckers 2023-10-28 09:20:56 +02:00
parent 4d88e82e32
commit 478a832515

View file

@ -152,9 +152,12 @@ static PClassActor* FindInfoName(int index, bool mustexist = false)
static FSoundID DehFindSound(int index,bool mustexist = false)
{
if (index < 0) return NO_SOUND;
if (index < (int) SoundMap.Size()) return SoundMap[index];
FStringf name("~dsdhacked/#%d", index);
if (dsdhacked && !mustexist) return soundEngine->FindSoundTentative(name.GetChars());
if (index < (int) SoundMap.Size() && SoundMap[index].isvalid()) return SoundMap[index];
if (dsdhacked && !mustexist)
{
FStringf name("~dsdhacked/#%d", index);
return soundEngine->FindSoundTentative(name.GetChars());
}
return NO_SOUND;
}
@ -1476,7 +1479,7 @@ static int PatchThing (int thingy)
}
else if (stricmp (Line1 + linelen - 6, " sound") == 0)
{
FSoundID snd = DehFindSound(val - 1);
FSoundID snd = DehFindSound(val - 1, false);
if (snd == NO_SOUND) // This won't trigger for dsdhacked patches!
{