- SW: account for invalid player actors being passed to the sound engine.

This commit is contained in:
Christoph Oelckers 2023-01-08 12:40:32 +01:00
parent 1f489d5dbe
commit 7262184d53

View file

@ -529,7 +529,16 @@ void SWSoundEngine::CalcPosVel(int type, const void* source, const float pt[3],
}
else if (type == SOURCE_Actor || type == SOURCE_Player)
{
vPos = type == SOURCE_Actor ? ((DSWActor*)source)->spr.pos : ((PLAYER*)source)->actor->getPosWithOffsetZ();
if (type == SOURCE_Actor)
{
vPos = ((DSWActor*)source)->spr.pos;
}
else
{
auto act = ((PLAYER*)source)->actor;
if (act) vPos = act->getPosWithOffsetZ();
else vPos = pp->actor->getPosWithOffsetZ();
}
pancheck = true;
FVector3 npos = GetSoundPos(vPos);