mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-29 17:06:43 +00:00
Store the position and rotation in MWMechanics::Movement
This commit is contained in:
parent
af65ecd841
commit
0ce188b7cc
4 changed files with 14 additions and 16 deletions
|
@ -368,7 +368,7 @@ namespace MWClass
|
||||||
moveSpeed = runSpeed;
|
moveSpeed = runSpeed;
|
||||||
else
|
else
|
||||||
moveSpeed = walkSpeed;
|
moveSpeed = walkSpeed;
|
||||||
if(getMovementSettings(ptr).mLeftRight != 0 && getMovementSettings(ptr).mForwardBackward == 0)
|
if(getMovementSettings(ptr).mPosition[0] != 0 && getMovementSettings(ptr).mPosition[1] == 0)
|
||||||
moveSpeed *= 0.75f;
|
moveSpeed *= 0.75f;
|
||||||
|
|
||||||
return moveSpeed;
|
return moveSpeed;
|
||||||
|
@ -414,12 +414,7 @@ namespace MWClass
|
||||||
|
|
||||||
Ogre::Vector3 Npc::getMovementVector (const MWWorld::Ptr& ptr) const
|
Ogre::Vector3 Npc::getMovementVector (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
Ogre::Vector3 vector;
|
return Ogre::Vector3(getMovementSettings(ptr).mPosition);
|
||||||
vector.x = getMovementSettings(ptr).mLeftRight;
|
|
||||||
vector.y = getMovementSettings(ptr).mForwardBackward;
|
|
||||||
vector.z = getMovementSettings(ptr).mUpDown;
|
|
||||||
|
|
||||||
return vector;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Npc::isEssential (const MWWorld::Ptr& ptr) const
|
bool Npc::isEssential (const MWWorld::Ptr& ptr) const
|
||||||
|
|
|
@ -175,12 +175,12 @@ void CharacterController::update(float duration, Ogre::Vector3 &movement)
|
||||||
{
|
{
|
||||||
const MWBase::World *world = MWBase::Environment::get().getWorld();
|
const MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||||
const MWWorld::Class &cls = MWWorld::Class::get(mPtr);
|
const MWWorld::Class &cls = MWWorld::Class::get(mPtr);
|
||||||
const Ogre::Vector3 &vec = cls.getMovementVector(mPtr);
|
|
||||||
|
|
||||||
bool onground = world->isOnGround(mPtr);
|
bool onground = world->isOnGround(mPtr);
|
||||||
bool inwater = world->isSwimming(mPtr);
|
bool inwater = world->isSwimming(mPtr);
|
||||||
bool isrunning = cls.getStance(mPtr, MWWorld::Class::Run);
|
bool isrunning = cls.getStance(mPtr, MWWorld::Class::Run);
|
||||||
bool sneak = cls.getStance(mPtr, MWWorld::Class::Sneak);
|
bool sneak = cls.getStance(mPtr, MWWorld::Class::Sneak);
|
||||||
|
const Ogre::Vector3 &vec = cls.getMovementVector(mPtr);
|
||||||
speed = cls.getSpeed(mPtr);
|
speed = cls.getSpeed(mPtr);
|
||||||
|
|
||||||
/* FIXME: The state should be set to Jump, and X/Y movement should be disallowed except
|
/* FIXME: The state should be set to Jump, and X/Y movement should be disallowed except
|
||||||
|
|
|
@ -6,11 +6,14 @@ namespace MWMechanics
|
||||||
/// Desired movement for an actor
|
/// Desired movement for an actor
|
||||||
struct Movement
|
struct Movement
|
||||||
{
|
{
|
||||||
signed char mLeftRight; // 1: wants to move left, -1: wants to move right
|
float mPosition[3];
|
||||||
signed char mForwardBackward; // 1:wants to move forward, -1: wants to move backward
|
float mRotation[3];
|
||||||
signed char mUpDown;
|
|
||||||
|
|
||||||
Movement() : mLeftRight (0), mForwardBackward (0), mUpDown(0) {}
|
Movement()
|
||||||
|
{
|
||||||
|
mPosition[0] = mPosition[1] = mPosition[2] = 0.0f;
|
||||||
|
mRotation[0] = mRotation[1] = mRotation[2] = 0.0f;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,14 +42,14 @@ namespace MWWorld
|
||||||
if (mAutoMove)
|
if (mAutoMove)
|
||||||
value = 1;
|
value = 1;
|
||||||
|
|
||||||
MWWorld::Class::get (ptr).getMovementSettings (ptr).mForwardBackward = value;
|
MWWorld::Class::get (ptr).getMovementSettings (ptr).mPosition[1] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::setLeftRight (int value)
|
void Player::setLeftRight (int value)
|
||||||
{
|
{
|
||||||
MWWorld::Ptr ptr = getPlayer();
|
MWWorld::Ptr ptr = getPlayer();
|
||||||
|
|
||||||
MWWorld::Class::get (ptr).getMovementSettings (ptr).mLeftRight = value;
|
MWWorld::Class::get (ptr).getMovementSettings (ptr).mPosition[0] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::setForwardBackward (int value)
|
void Player::setForwardBackward (int value)
|
||||||
|
@ -61,14 +61,14 @@ namespace MWWorld
|
||||||
if (mAutoMove)
|
if (mAutoMove)
|
||||||
value = 1;
|
value = 1;
|
||||||
|
|
||||||
MWWorld::Class::get (ptr).getMovementSettings (ptr).mForwardBackward = value;
|
MWWorld::Class::get (ptr).getMovementSettings (ptr).mPosition[1] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::setUpDown(int value)
|
void Player::setUpDown(int value)
|
||||||
{
|
{
|
||||||
MWWorld::Ptr ptr = getPlayer();
|
MWWorld::Ptr ptr = getPlayer();
|
||||||
|
|
||||||
MWWorld::Class::get (ptr).getMovementSettings (ptr).mUpDown = value;
|
MWWorld::Class::get (ptr).getMovementSettings (ptr).mPosition[2] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::setRunState(bool run)
|
void Player::setRunState(bool run)
|
||||||
|
|
Loading…
Reference in a new issue