From 5f30dfd5db19da0faf12fc09fae34968e61ec4d4 Mon Sep 17 00:00:00 2001 From: Koncord Date: Fri, 2 Jun 2017 15:44:39 +0800 Subject: [PATCH] [Client] Get rid direction.rot --- apps/openmw/mwmechanics/actors.cpp | 1 + apps/openmw/mwmechanics/character.cpp | 10 +++------- apps/openmw/mwmp/DedicatedPlayer.cpp | 8 -------- apps/openmw/mwmp/LocalPlayer.cpp | 4 +--- 4 files changed, 5 insertions(+), 18 deletions(-) diff --git a/apps/openmw/mwmechanics/actors.cpp b/apps/openmw/mwmechanics/actors.cpp index b25305e03..d0656270b 100644 --- a/apps/openmw/mwmechanics/actors.cpp +++ b/apps/openmw/mwmechanics/actors.cpp @@ -18,6 +18,7 @@ */ #include #include "../mwmp/Main.hpp" +#include "../mwmp/Networking.hpp" #include "../mwmp/LocalPlayer.hpp" #include "../mwmp/PlayerList.hpp" #include "../mwmp/CellController.hpp" diff --git a/apps/openmw/mwmechanics/character.cpp b/apps/openmw/mwmechanics/character.cpp index 949eeb3f0..fae6facb2 100644 --- a/apps/openmw/mwmechanics/character.cpp +++ b/apps/openmw/mwmechanics/character.cpp @@ -1687,22 +1687,18 @@ void CharacterController::update(float duration) Character movement setting rotations get reset here, so we have to assign movement settings to the LocalPlayer or a LocalActor now */ - if (MWBase::Environment::get().getWorld()->getPlayerPtr() == mPtr) + if (world->getPlayerPtr() == mPtr) { mwmp::LocalPlayer *localPlayer = mwmp::Main::get().getLocalPlayer(); - MWMechanics::Movement &movementSettings = mPtr.getClass().getMovementSettings(mPtr); + MWMechanics::Movement &movementSettings = cls.getMovementSettings(mPtr); localPlayer->direction.pos[0] = movementSettings.mPosition[0]; localPlayer->direction.pos[1] = movementSettings.mPosition[1]; localPlayer->direction.pos[2] = movementSettings.mPosition[2]; - localPlayer->direction.rot[0] = movementSettings.mRotation[0]; - localPlayer->direction.rot[1] = movementSettings.mRotation[1]; - localPlayer->direction.rot[2] = movementSettings.mRotation[2]; } - else if (mwmp::Main::get().getCellController()->isLocalActor(mPtr)) { mwmp::LocalActor *localActor = mwmp::Main::get().getCellController()->getLocalActor(mPtr); - MWMechanics::Movement &movementSettings = mPtr.getClass().getMovementSettings(mPtr); + MWMechanics::Movement &movementSettings = cls.getMovementSettings(mPtr); localActor->direction.pos[0] = movementSettings.mPosition[0]; localActor->direction.pos[1] = movementSettings.mPosition[1]; localActor->direction.pos[2] = movementSettings.mPosition[2]; diff --git a/apps/openmw/mwmp/DedicatedPlayer.cpp b/apps/openmw/mwmp/DedicatedPlayer.cpp index f9a2738b0..a420b6263 100644 --- a/apps/openmw/mwmp/DedicatedPlayer.cpp +++ b/apps/openmw/mwmp/DedicatedPlayer.cpp @@ -123,14 +123,6 @@ void DedicatedPlayer::move(float dt) move->mPosition[0] = direction.pos[0]; move->mPosition[1] = direction.pos[1]; move->mPosition[2] = direction.pos[2]; - - // Make sure the values are valid, or we'll get an infinite error loop - if (!isnan(direction.rot[0]) && !isnan(direction.rot[1]) && !isnan(direction.rot[2])) - { - move->mRotation[0] = direction.rot[0]; - move->mRotation[1] = direction.rot[1]; - move->mRotation[2] = direction.rot[2]; - } } void DedicatedPlayer::setAnimFlags() diff --git a/apps/openmw/mwmp/LocalPlayer.cpp b/apps/openmw/mwmp/LocalPlayer.cpp index 3878a3f22..c8747797c 100644 --- a/apps/openmw/mwmp/LocalPlayer.cpp +++ b/apps/openmw/mwmp/LocalPlayer.cpp @@ -323,16 +323,14 @@ void LocalPlayer::updatePosition(bool forceUpdate) static bool sentJumpEnd = true; bool posIsChanging = (direction.pos[0] != 0 || direction.pos[1] != 0 || direction.pos[2] != 0 || - direction.rot[0] != 0 || direction.rot[1] != 0 || direction.rot[2] != 0); + position.rot[0] != 0 || position.rot[1] != 0 || position.rot[2] != 0); if (forceUpdate || posIsChanging || posWasChanged) { posWasChanged = posIsChanging; if (!isJumping && !world->isOnGround(player) && !world->isFlying(player)) - { isJumping = true; - } position = player.getRefData().getPosition();