Add a method to clear the animation queue

pull/16/head
Chris Robinson 12 years ago
parent 6c6200efef
commit 6201cb0093

@ -476,9 +476,7 @@ void CharacterController::playGroup(const std::string &groupname, int mode, int
count = std::max(count, 1); count = std::max(count, 1);
if(mode != 0 || mAnimQueue.size() == 0) if(mode != 0 || mAnimQueue.size() == 0)
{ {
if(mAnimQueue.size() > 0) clearAnimQueue();
mAnimation->disable(mAnimQueue.front().first);
mAnimQueue.clear();
mAnimQueue.push_back(std::make_pair(groupname, count-1)); mAnimQueue.push_back(std::make_pair(groupname, count-1));
mCharState = CharState_SpecialIdle; mCharState = CharState_SpecialIdle;
@ -500,6 +498,14 @@ void CharacterController::skipAnim()
} }
void CharacterController::clearAnimQueue()
{
if(mAnimQueue.size() > 0)
mAnimation->disable(mAnimQueue.front().first);
mAnimQueue.clear();
}
void CharacterController::setState(CharacterState state) void CharacterController::setState(CharacterState state)
{ {
if(mCharState == state) if(mCharState == state)
@ -513,9 +519,7 @@ void CharacterController::forceStateUpdate()
{ {
if(!mAnimation) if(!mAnimation)
return; return;
if(mAnimQueue.size() > 0) clearAnimQueue();
mAnimation->disable(mAnimQueue.front().first);
mAnimQueue.clear();
std::string group; std::string group;
Priority prio; Priority prio;

@ -111,6 +111,8 @@ class CharacterController
static void getWeaponGroup(WeaponType weaptype, std::string &group); static void getWeaponGroup(WeaponType weaptype, std::string &group);
void clearAnimQueue();
public: public:
CharacterController(const MWWorld::Ptr &ptr, MWRender::Animation *anim, CharacterState state); CharacterController(const MWWorld::Ptr &ptr, MWRender::Animation *anim, CharacterState state);
virtual ~CharacterController(); virtual ~CharacterController();

Loading…
Cancel
Save