Refactor onChooseActionStatePerFrameActions

This prevents playIdle errors from tyring to play idleAnimation 0
This commit is contained in:
Arthur Moore 2015-07-30 08:15:45 -04:00
parent f69de1f263
commit 5ea596f38d

View file

@ -392,18 +392,24 @@ namespace MWMechanics
short unsigned& idleAnimation = storage.mIdleAnimation; short unsigned& idleAnimation = storage.mIdleAnimation;
idleAnimation = getRandomIdle(); idleAnimation = getRandomIdle();
//If we should be moving
if (!idleAnimation && mDistance) if (!idleAnimation && mDistance)
{ {
storage.mState = Wander_MoveNow; storage.mState = Wander_MoveNow;
} }
else else
{ {
// Play idle animation and recreate vanilla (broken?) behavior of resetting start time of AIWander: //Recreate vanilla (broken?) behavior of resetting start time of AIWander:
MWWorld::TimeStamp currentTime = MWBase::Environment::get().getWorld()->getTimeStamp(); MWWorld::TimeStamp currentTime = MWBase::Environment::get().getWorld()->getTimeStamp();
mStartTime = currentTime; mStartTime = currentTime;
playIdle(actor, idleAnimation);
storage.mState = Wander_IdleNow; storage.mState = Wander_IdleNow;
} }
//If we aren't going to just stand
if(idleAnimation)
{
playIdle(actor, idleAnimation);
}
} }
void AiWander::evadeObstacles(const MWWorld::Ptr& actor, AiWanderStorage& storage, float duration) void AiWander::evadeObstacles(const MWWorld::Ptr& actor, AiWanderStorage& storage, float duration)