Make PlayGroup use an indefinite number of loops (Fixes #2156)

loadfix
scrawl 10 years ago
parent 4fd3a994e9
commit 5f5fcc2fef

@ -1645,6 +1645,8 @@ void CharacterController::playGroup(const std::string &groupname, int mode, int
}
else if(mode == 0)
{
if (!mAnimQueue.empty())
mAnimation->stopLooping(mAnimQueue.front().first);
mAnimQueue.resize(1);
mAnimQueue.push_back(std::make_pair(groupname, count-1));
}

@ -842,6 +842,17 @@ void Animation::changeGroups(const std::string &groupname, int groups)
return;
}
}
void Animation::stopLooping(const std::string& groupname)
{
AnimStateMap::iterator stateiter = mStates.find(groupname);
if(stateiter != mStates.end())
{
stateiter->second.mLoopCount = 0;
return;
}
}
void Animation::play(const std::string &groupname, int priority, int groups, bool autodisable, float speedmult, const std::string &start, const std::string &stop, float startpoint, size_t loops)
{
if(!mSkelBase || mAnimSources.empty())

@ -260,6 +260,10 @@ public:
float speedmult, const std::string &start, const std::string &stop,
float startpoint, size_t loops);
/** If the given animation group is currently playing, set its remaining loop count to '0'.
*/
void stopLooping(const std::string& groupName);
/** Adjust the speed multiplier of an already playing animation.
*/
void adjustSpeedMult (const std::string& groupname, float speedmult);

@ -55,7 +55,7 @@ namespace MWScript
throw std::runtime_error ("animation mode out of range");
}
MWBase::Environment::get().getMechanicsManager()->playAnimationGroup (ptr, group, mode, 1);
MWBase::Environment::get().getMechanicsManager()->playAnimationGroup (ptr, group, mode, std::numeric_limits<int>::max());
}
};

Loading…
Cancel
Save