- added missing range checks to PlaySpriteSound.

This can be called with attr_none!
This commit is contained in:
Christoph Oelckers 2023-06-29 18:28:16 +02:00
parent 428425b6dc
commit 1e2b5c2747
2 changed files with 3 additions and 2 deletions

View file

@ -62,7 +62,8 @@ enum ActorStates { SLOW_SPEED, NORM_SPEED, MID_SPEED, FAST_SPEED, MAX_SPEED};
enum ATTRIB_SNDS
{
attr_ambient = 1, attr_alert, attr_attack, attr_pain, attr_die,
attr_none = 0,
attr_ambient, attr_alert, attr_attack, attr_pain, attr_die,
attr_extra1, attr_extra2, attr_extra3,attr_extra4,attr_extra5,
attr_extra6, MAXATTRIBSNDS
};

View file

@ -718,7 +718,7 @@ void Terminate3DSounds(void)
void PlaySpriteSound(DSWActor* actor, int attrib_ndx, int flags)
{
if (actor->hasU())
if (actor->hasU() && attrib_ndx > attr_none && attrib_ndx < MAXATTRIBSNDS)
PlaySound(actor->user.__legacyState.Attrib->Sounds[attrib_ndx - 1], actor, flags);
}