Store the position and rotation in MWMechanics::Movement

actorid
Chris Robinson 12 years ago
parent af65ecd841
commit 0ce188b7cc

@ -368,7 +368,7 @@ namespace MWClass
moveSpeed = runSpeed;
else
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;
return moveSpeed;
@ -414,12 +414,7 @@ namespace MWClass
Ogre::Vector3 Npc::getMovementVector (const MWWorld::Ptr& ptr) const
{
Ogre::Vector3 vector;
vector.x = getMovementSettings(ptr).mLeftRight;
vector.y = getMovementSettings(ptr).mForwardBackward;
vector.z = getMovementSettings(ptr).mUpDown;
return vector;
return Ogre::Vector3(getMovementSettings(ptr).mPosition);
}
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 MWWorld::Class &cls = MWWorld::Class::get(mPtr);
const Ogre::Vector3 &vec = cls.getMovementVector(mPtr);
bool onground = world->isOnGround(mPtr);
bool inwater = world->isSwimming(mPtr);
bool isrunning = cls.getStance(mPtr, MWWorld::Class::Run);
bool sneak = cls.getStance(mPtr, MWWorld::Class::Sneak);
const Ogre::Vector3 &vec = cls.getMovementVector(mPtr);
speed = cls.getSpeed(mPtr);
/* 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
struct Movement
{
signed char mLeftRight; // 1: wants to move left, -1: wants to move right
signed char mForwardBackward; // 1:wants to move forward, -1: wants to move backward
signed char mUpDown;
float mPosition[3];
float mRotation[3];
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)
value = 1;
MWWorld::Class::get (ptr).getMovementSettings (ptr).mForwardBackward = value;
MWWorld::Class::get (ptr).getMovementSettings (ptr).mPosition[1] = value;
}
void Player::setLeftRight (int value)
{
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)
@ -61,14 +61,14 @@ namespace MWWorld
if (mAutoMove)
value = 1;
MWWorld::Class::get (ptr).getMovementSettings (ptr).mForwardBackward = value;
MWWorld::Class::get (ptr).getMovementSettings (ptr).mPosition[1] = value;
}
void Player::setUpDown(int value)
{
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)

Loading…
Cancel
Save