Don't try to set a new state when dead

This commit is contained in:
Chris Robinson 2013-02-18 06:29:16 -08:00
parent f2948ced23
commit 627b866744

View file

@ -174,13 +174,16 @@ Ogre::Vector3 CharacterController::update(float duration)
{ {
Ogre::Vector3 movement(0.0f); Ogre::Vector3 movement(0.0f);
float speed = 0.0f;
if(!(getState() >= CharState_Death1))
{
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); const Ogre::Vector3 &vec = cls.getMovementVector(mPtr);
const float speed = cls.getSpeed(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);
speed = cls.getSpeed(mPtr);
if(std::abs(vec.x/2.0f) > std::abs(vec.y)) if(std::abs(vec.x/2.0f) > std::abs(vec.y))
{ {
@ -209,8 +212,6 @@ Ogre::Vector3 CharacterController::update(float duration)
movement.x += vec.x * (speed*duration); movement.x += vec.x * (speed*duration);
} }
else else
{
if(!(getState() >= CharState_Death1))
setState((inwater ? CharState_IdleSwim : CharState_Idle), true); setState((inwater ? CharState_IdleSwim : CharState_Idle), true);
} }