forked from mirror/openmw-tes3mp
[Client] Get rid direction.rot
This commit is contained in:
parent
8c785fb22c
commit
5f30dfd5db
4 changed files with 5 additions and 18 deletions
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
#include <components/openmw-mp/Log.hpp>
|
||||
#include "../mwmp/Main.hpp"
|
||||
#include "../mwmp/Networking.hpp"
|
||||
#include "../mwmp/LocalPlayer.hpp"
|
||||
#include "../mwmp/PlayerList.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
|
||||
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];
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
Loading…
Reference in a new issue