mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-21 22:39:39 +00:00
Don't try to play animations we know are bad
Prevents log spam
This commit is contained in:
parent
5ea596f38d
commit
61c3835637
2 changed files with 23 additions and 15 deletions
|
@ -58,7 +58,6 @@ namespace MWMechanics
|
||||||
bool mTurnActorGivingGreetingToFacePlayer;
|
bool mTurnActorGivingGreetingToFacePlayer;
|
||||||
float mReaction; // update some actions infrequently
|
float mReaction; // update some actions infrequently
|
||||||
|
|
||||||
|
|
||||||
AiWander::GreetingState mSaidGreeting;
|
AiWander::GreetingState mSaidGreeting;
|
||||||
int mGreetingTimer;
|
int mGreetingTimer;
|
||||||
|
|
||||||
|
@ -68,6 +67,7 @@ namespace MWMechanics
|
||||||
AiWander::WanderState mState;
|
AiWander::WanderState mState;
|
||||||
|
|
||||||
unsigned short mIdleAnimation;
|
unsigned short mIdleAnimation;
|
||||||
|
std::vector<unsigned short> mBadIdles; //Idle animations that when called cause errors
|
||||||
|
|
||||||
PathFinder mPathFinder;
|
PathFinder mPathFinder;
|
||||||
|
|
||||||
|
@ -79,7 +79,8 @@ namespace MWMechanics
|
||||||
mGreetingTimer(0),
|
mGreetingTimer(0),
|
||||||
mCell(NULL),
|
mCell(NULL),
|
||||||
mState(AiWander::Wander_ChooseAction),
|
mState(AiWander::Wander_ChooseAction),
|
||||||
mIdleAnimation(0)
|
mIdleAnimation(0),
|
||||||
|
mBadIdles()
|
||||||
{};
|
{};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -392,24 +393,31 @@ namespace MWMechanics
|
||||||
short unsigned& idleAnimation = storage.mIdleAnimation;
|
short unsigned& idleAnimation = storage.mIdleAnimation;
|
||||||
idleAnimation = getRandomIdle();
|
idleAnimation = getRandomIdle();
|
||||||
|
|
||||||
//If we should be moving
|
// If we should be moving
|
||||||
if (!idleAnimation && mDistance)
|
if (!idleAnimation && mDistance)
|
||||||
{
|
{
|
||||||
storage.mState = Wander_MoveNow;
|
storage.mState = Wander_MoveNow;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else
|
// If we aren't going to just stand
|
||||||
{
|
|
||||||
//Recreate vanilla (broken?) behavior of resetting start time of AIWander:
|
|
||||||
MWWorld::TimeStamp currentTime = MWBase::Environment::get().getWorld()->getTimeStamp();
|
|
||||||
mStartTime = currentTime;
|
|
||||||
storage.mState = Wander_IdleNow;
|
|
||||||
}
|
|
||||||
|
|
||||||
//If we aren't going to just stand
|
|
||||||
if(idleAnimation)
|
if(idleAnimation)
|
||||||
{
|
{
|
||||||
playIdle(actor, idleAnimation);
|
// If the idle animation actually exists
|
||||||
|
if(std::find(storage.mBadIdles.begin(), storage.mBadIdles.end(), idleAnimation)==storage.mBadIdles.end())
|
||||||
|
{
|
||||||
|
if(!playIdle(actor, idleAnimation))
|
||||||
|
{
|
||||||
|
std::cerr<< "Unable to play idle animation "<<idleAnimation<<" for " << actor.getCellRef().getRefId() << std::endl;
|
||||||
|
storage.mBadIdles.push_back(idleAnimation);
|
||||||
|
storage.mState = Wander_ChooseAction;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
// Recreate vanilla (broken?) behavior of resetting start time of AIWander:
|
||||||
|
mStartTime = MWBase::Environment::get().getWorld()->getTimeStamp();
|
||||||
|
storage.mState = Wander_IdleNow;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AiWander::evadeObstacles(const MWWorld::Ptr& actor, AiWanderStorage& storage, float duration)
|
void AiWander::evadeObstacles(const MWWorld::Ptr& actor, AiWanderStorage& storage, float duration)
|
||||||
|
|
|
@ -76,8 +76,8 @@ namespace MWMechanics
|
||||||
|
|
||||||
void stopWalking(const MWWorld::Ptr& actor, AiWanderStorage& storage);
|
void stopWalking(const MWWorld::Ptr& actor, AiWanderStorage& storage);
|
||||||
|
|
||||||
///Have the given actor play an idle animation
|
/// Have the given actor play an idle animation
|
||||||
///@return Success or error
|
/// @return Success or error
|
||||||
bool playIdle(const MWWorld::Ptr& actor, unsigned short idleSelect);
|
bool playIdle(const MWWorld::Ptr& actor, unsigned short idleSelect);
|
||||||
bool checkIdle(const MWWorld::Ptr& actor, unsigned short idleSelect);
|
bool checkIdle(const MWWorld::Ptr& actor, unsigned short idleSelect);
|
||||||
short unsigned getRandomIdle();
|
short unsigned getRandomIdle();
|
||||||
|
|
Loading…
Reference in a new issue