[Client] Get rid direction.rot

pull/249/merge
Koncord 8 years ago
parent 8c785fb22c
commit 5f30dfd5db

@ -18,6 +18,7 @@
*/ */
#include <components/openmw-mp/Log.hpp> #include <components/openmw-mp/Log.hpp>
#include "../mwmp/Main.hpp" #include "../mwmp/Main.hpp"
#include "../mwmp/Networking.hpp"
#include "../mwmp/LocalPlayer.hpp" #include "../mwmp/LocalPlayer.hpp"
#include "../mwmp/PlayerList.hpp" #include "../mwmp/PlayerList.hpp"
#include "../mwmp/CellController.hpp" #include "../mwmp/CellController.hpp"

@ -1687,22 +1687,18 @@ void CharacterController::update(float duration)
Character movement setting rotations get reset here, so we have to assign movement Character movement setting rotations get reset here, so we have to assign movement
settings to the LocalPlayer or a LocalActor now 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(); 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[0] = movementSettings.mPosition[0];
localPlayer->direction.pos[1] = movementSettings.mPosition[1]; localPlayer->direction.pos[1] = movementSettings.mPosition[1];
localPlayer->direction.pos[2] = movementSettings.mPosition[2]; 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)) else if (mwmp::Main::get().getCellController()->isLocalActor(mPtr))
{ {
mwmp::LocalActor *localActor = mwmp::Main::get().getCellController()->getLocalActor(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[0] = movementSettings.mPosition[0];
localActor->direction.pos[1] = movementSettings.mPosition[1]; localActor->direction.pos[1] = movementSettings.mPosition[1];
localActor->direction.pos[2] = movementSettings.mPosition[2]; localActor->direction.pos[2] = movementSettings.mPosition[2];

@ -123,14 +123,6 @@ void DedicatedPlayer::move(float dt)
move->mPosition[0] = direction.pos[0]; move->mPosition[0] = direction.pos[0];
move->mPosition[1] = direction.pos[1]; move->mPosition[1] = direction.pos[1];
move->mPosition[2] = direction.pos[2]; 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() void DedicatedPlayer::setAnimFlags()

@ -323,16 +323,14 @@ void LocalPlayer::updatePosition(bool forceUpdate)
static bool sentJumpEnd = true; static bool sentJumpEnd = true;
bool posIsChanging = (direction.pos[0] != 0 || direction.pos[1] != 0 || direction.pos[2] != 0 || 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) if (forceUpdate || posIsChanging || posWasChanged)
{ {
posWasChanged = posIsChanging; posWasChanged = posIsChanging;
if (!isJumping && !world->isOnGround(player) && !world->isFlying(player)) if (!isJumping && !world->isOnGround(player) && !world->isFlying(player))
{
isJumping = true; isJumping = true;
}
position = player.getRefData().getPosition(); position = player.getRefData().getPosition();

Loading…
Cancel
Save