Skip to content

Commit

Permalink
fixed: Resource IDs for sounds must be unique.
Browse files Browse the repository at this point in the history
If an ID gets used it must be taken off any other sound that has it.
  • Loading branch information
coelckers committed Dec 6, 2023
1 parent 60d3a5e commit 8d4631e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion source/core/music/s_advsound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -461,9 +461,16 @@ static void S_AddSNDINFO (int lump)
// Assigns a resource ID to the given sound.
sc.MustGetString();
FSoundID sfx = soundEngine->FindSoundTentative(sc.String, DEFAULT_LIMIT);
auto sfxp = soundEngine->GetWritableSfx(sfx);

sc.MustGetNumber();
// remove resource ID from any previously defined sound.
for (unsigned i = 0; i < soundEngine->GetNumSounds(); i++)
{
auto sfxp = soundEngine->GetWritableSfx(FSoundID::fromInt(i));
if (sfxp->ResourceId == sc.Number) sfxp->ResourceId = -1;

}
auto sfxp = soundEngine->GetWritableSfx(sfx);
sfxp->ResourceId = sc.Number;
break;
}
Expand Down

0 comments on commit 8d4631e

Please sign in to comment.