From 3df3552467a0dc1b014e53c5b4f3e07320e9d65d Mon Sep 17 00:00:00 2001 From: jadebenn Date: Sun, 26 Nov 2023 16:30:39 -0600 Subject: [PATCH] fix: respawn rotation (#1323) * fixed respawn rotation * even though the condensed calls work, splitting em --- dGame/dGameMessages/GameMessages.cpp | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/dGame/dGameMessages/GameMessages.cpp b/dGame/dGameMessages/GameMessages.cpp index 34b031d3..b506e3a0 100644 --- a/dGame/dGameMessages/GameMessages.cpp +++ b/dGame/dGameMessages/GameMessages.cpp @@ -944,14 +944,7 @@ void GameMessages::SendResurrect(Entity* entity) { destroyableComponent->SetImagination(imaginationToRestore); } } - }); - - - auto cont = static_cast(entity->GetComponent(eReplicaComponentType::CONTROLLABLE_PHYSICS)); - if (cont && entity->GetLOT() == 1) { - cont->SetPosition(entity->GetRespawnPosition()); - cont->SetRotation(entity->GetRespawnRotation()); - } + }); CBITSTREAM; CMSGHEADER; @@ -1144,18 +1137,16 @@ void GameMessages::SendPlayerReachedRespawnCheckpoint(Entity* entity, const NiPo bitStream.Write(position.y); bitStream.Write(position.z); - auto con = static_cast(entity->GetComponent(eReplicaComponentType::CONTROLLABLE_PHYSICS)); - if (con) { - auto rot = con->GetRotation(); - bitStream.Write(rot.x); - bitStream.Write(rot.y); - bitStream.Write(rot.z); - bitStream.Write(rot.w); + const bool isNotIdentity = rotation != NiQuaternion::IDENTITY; + bitStream.Write(isNotIdentity); + + if (isNotIdentity) { + bitStream.Write(rotation.w); + bitStream.Write(rotation.x); + bitStream.Write(rotation.y); + bitStream.Write(rotation.z); } - //bitStream.Write(position); - //bitStream.Write(rotation); - SystemAddress sysAddr = entity->GetSystemAddress(); SEND_PACKET; }