Ignore text keys for zero-length animations (Fixes #1876)

This fixes an issue where the Riekling's attack animation would trigger *two* hits on each swing. It has the "min hit" and "hit" keys at the same time, so the MinHitToHit segment a zero-length animation. This caused problems as the "hit" text key will be encountered twice; once when playing the "max attack to min hit" segment and once when playing the "min hit to hit" segment.
This commit is contained in:
scrawl 2014-09-07 04:29:39 +02:00
parent 07d827c907
commit 8b0cb239a9

View file

@ -873,10 +873,13 @@ void Animation::play(const std::string &groupname, int priority, int groups, boo
mStates[groupname] = state;
NifOgre::TextKeyMap::const_iterator textkey(textkeys.lower_bound(state.mTime));
while(textkey != textkeys.end() && textkey->first <= state.mTime)
if (state.mPlaying)
{
handleTextKey(state, groupname, textkey, textkeys);
++textkey;
while(textkey != textkeys.end() && textkey->first <= state.mTime)
{
handleTextKey(state, groupname, textkey, textkeys);
++textkey;
}
}
if(state.mTime >= state.mLoopStopTime && state.mLoopCount > 0)
@ -887,7 +890,7 @@ void Animation::play(const std::string &groupname, int priority, int groups, boo
if(state.mTime >= state.mLoopStopTime)
break;
textkey = textkeys.lower_bound(state.mTime);
NifOgre::TextKeyMap::const_iterator textkey(textkeys.lower_bound(state.mTime));
while(textkey != textkeys.end() && textkey->first <= state.mTime)
{
handleTextKey(state, groupname, textkey, textkeys);