Fix incorrect serialization of SendTeleport (#1121)

* Fix incorrect serialization of SendTeleport

- Fixes all incorrect teleports in the game
- remove hacks in mast teleport
- ...
- ......

Update GameMessages.cpp

* Remove stupid argument

there got it all out

* remove extra true
This commit is contained in:
David Markowitz 2023-06-18 00:00:36 -07:00 committed by GitHub
parent f46bc33dd4
commit 2d31b7e4bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 19 deletions

View File

@ -124,8 +124,7 @@ void RacingControlComponent::LoadPlayerVehicle(Entity* player,
// Make sure the player is at the correct position.
GameMessages::SendTeleport(player->GetObjectID(), startPosition,
startRotation, player->GetSystemAddress(), true,
true);
startRotation, player->GetSystemAddress(), true);
// Spawn the vehicle entity.
@ -243,11 +242,9 @@ void RacingControlComponent::LoadPlayerVehicle(Entity* player,
// Make sure everything has the correct position.
GameMessages::SendTeleport(player->GetObjectID(), startPosition,
startRotation, player->GetSystemAddress(), true,
true);
startRotation, player->GetSystemAddress(), true);
GameMessages::SendTeleport(carEntity->GetObjectID(), startPosition,
startRotation, player->GetSystemAddress(), true,
true);
startRotation, player->GetSystemAddress(), true);
}
void RacingControlComponent::OnRacingClientReady(Entity* player) {
@ -634,7 +631,7 @@ void RacingControlComponent::Update(float deltaTime) {
GameMessages::SendTeleport(
player.playerID, player.respawnPosition,
player.respawnRotation,
playerEntity->GetSystemAddress(), true, true);
playerEntity->GetSystemAddress(), true);
vehicle->SetPosition(player.respawnPosition);
vehicle->SetRotation(player.respawnRotation);

View File

@ -120,7 +120,7 @@ void GameMessages::SendFireEventClientSide(const LWOOBJID& objectID, const Syste
SEND_PACKET;
}
void GameMessages::SendTeleport(const LWOOBJID& objectID, const NiPoint3& pos, const NiQuaternion& rot, const SystemAddress& sysAddr, bool bSetRotation, bool noGravTeleport) {
void GameMessages::SendTeleport(const LWOOBJID& objectID, const NiPoint3& pos, const NiQuaternion& rot, const SystemAddress& sysAddr, bool bSetRotation) {
CBITSTREAM;
CMSGHEADER;
bitStream.Write(objectID);
@ -141,7 +141,6 @@ void GameMessages::SendTeleport(const LWOOBJID& objectID, const NiPoint3& pos, c
bitStream.Write(pos.y);
bitStream.Write(pos.z);
bitStream.Write(bUseNavmesh);
bitStream.Write(noGravTeleport);
bitStream.Write(rot.w != 1.0f);
if (rot.w != 1.0f) bitStream.Write(rot.w);

View File

@ -40,7 +40,7 @@ enum class eRebuildState : uint32_t;
namespace GameMessages {
class PropertyDataMessage;
void SendFireEventClientSide(const LWOOBJID& objectID, const SystemAddress& sysAddr, std::u16string args, const LWOOBJID& object, int64_t param1, int param2, const LWOOBJID& sender);
void SendTeleport(const LWOOBJID& objectID, const NiPoint3& pos, const NiQuaternion& rot, const SystemAddress& sysAddr, bool bSetRotation = false, bool noGravTeleport = true);
void SendTeleport(const LWOOBJID& objectID, const NiPoint3& pos, const NiQuaternion& rot, const SystemAddress& sysAddr, bool bSetRotation = false);
void SendPlayAnimation(Entity* entity, const std::u16string& animationName, float fPriority = 0.0f, float fScale = 1.0f);
void SendPlayerReady(Entity* entity, const SystemAddress& sysAddr);
void SendPlayerAllowedRespawn(LWOOBJID entityID, bool doNotPromptRespawn, const SystemAddress& systemAddress);

View File

@ -43,15 +43,7 @@ void MastTeleport::OnTimerDone(Entity* self, std::string timerName) {
GameMessages::SendTeleport(playerId, position, rotation, player->GetSystemAddress(), true);
// Hacky fix for odd rotations
auto mastName = self->GetVar<std::u16string>(u"MastName");
if (mastName == u"Elephant") {
GameMessages::SendOrientToAngle(playerId, true, (M_PI / 180) * 140.0f, player->GetSystemAddress());
} else if (mastName == u"Jail") {
GameMessages::SendOrientToAngle(playerId, true, (M_PI / 180) * 100.0f, player->GetSystemAddress());
} else if (mastName == u""){
GameMessages::SendOrientToAngle(playerId, true, (M_PI / 180) * 203.0f, player->GetSystemAddress());
}
GameMessages::SendTeleport(playerId, position, rotation, player->GetSystemAddress(), true);
const auto cinematic = GeneralUtils::UTF16ToWTF8(self->GetVar<std::u16string>(u"Cinematic"));
const auto leanIn = self->GetVar<float>(u"LeanIn");