From 7b187d0295dfec6e3f7b1b72f597fad84485cc1a Mon Sep 17 00:00:00 2001 From: David Cernat Date: Tue, 23 Aug 2016 22:27:12 +0300 Subject: [PATCH] Fix visual glitch when jumping without adjusting camera afterwards --- apps/openmw/mwmp/LocalPlayer.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/apps/openmw/mwmp/LocalPlayer.cpp b/apps/openmw/mwmp/LocalPlayer.cpp index 14db9b527..776ce93ff 100644 --- a/apps/openmw/mwmp/LocalPlayer.cpp +++ b/apps/openmw/mwmp/LocalPlayer.cpp @@ -133,6 +133,9 @@ void LocalPlayer::updatePosition(bool forceUpdate) static bool posChanged = false; + static bool isJumping = false; + static bool sentJumpEnd = true; + ESM::Position _pos = player.getRefData().getPosition(); const bool isChangedPos = (move.mPosition[0] != 0 || move.mPosition[1] != 0 || move.mPosition[2] != 0 @@ -142,6 +145,9 @@ void LocalPlayer::updatePosition(bool forceUpdate) { posChanged = isChangedPos; + if (!isJumping && !world->isOnGround(player) && !world->isFlying(player)) { + isJumping = true; + } (*Position()) = _pos; @@ -151,6 +157,18 @@ void LocalPlayer::updatePosition(bool forceUpdate) GetNetworking()->GetPacket(ID_GAME_UPDATE_POS)->Send(this); } + else if (isJumping && world->isOnGround(player)) { + + isJumping = false; + sentJumpEnd = false; + } + // Packet with jump end position has to be sent one tick after above check + else if (!sentJumpEnd) { + + sentJumpEnd = true; + (*Position()) = _pos; + GetNetworking()->GetPacket(ID_GAME_UPDATE_POS)->Send(this); + } }