From de61f6d7463a91bd94c33835f8641f4de40c3a7d Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 24 Nov 2021 23:11:31 +0100 Subject: [PATCH] - fixed two bugs that revealed themselves after fully migrating to the actor system. --- source/games/whaven/src/input.cpp | 3 ++- source/games/whaven/src/sound.cpp | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/source/games/whaven/src/input.cpp b/source/games/whaven/src/input.cpp index 1816b29e4..d6ece0fb8 100644 --- a/source/games/whaven/src/input.cpp +++ b/source/games/whaven/src/input.cpp @@ -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) diff --git a/source/games/whaven/src/sound.cpp b/source/games/whaven/src/sound.cpp index 53343a819..26fc34ac2 100644 --- a/source/games/whaven/src/sound.cpp +++ b/source/games/whaven/src/sound.cpp @@ -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()); }