- fixed two bugs that revealed themselves after fully migrating to the actor system.

This commit is contained in:
Christoph Oelckers 2021-11-24 23:11:31 +01:00
parent 46ecd2b652
commit de61f6d746
2 changed files with 6 additions and 4 deletions

View file

@ -114,7 +114,8 @@ void GameInterface::clearlocalinputstate()
static void UpdatePlayerSpriteAngle(PLAYER& plr)
{
plr.actor()->s().ang = plr.angle.ang.asbuild();
if (plr.actor())
plr.actor()->s().ang = plr.angle.ang.asbuild();
}
void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput)

View file

@ -138,6 +138,9 @@ void GameInterface::UpdateSounds()
return false;
});
listener.underwater = false;
listener.Environment = 0;
if (player[pyrn].actor() != nullptr)
{
listener.angle = float(-FixedToFloat(player[pyrn].angle.ang.asq16()) * pi::pi() / 1024); // Build uses a period of 2048.
@ -145,16 +148,14 @@ void GameInterface::UpdateSounds()
vec3_t ppos{ player[pyrn].x, player[pyrn].y, player[pyrn].z };
listener.position = GetSoundPos(&ppos);
listener.valid = true;
listener.ListenerObject = &player[pyrn].actor()->s();
}
else
{
listener.position.Zero();
listener.valid = false;
}
listener.underwater = false;
listener.Environment = 0;
listener.ListenerObject = &player[pyrn].actor()->s();
soundEngine->SetListener(listener);
soundEngine->UpdateSounds(I_GetTime());
}