From 8b0cb239a932de4a8258b624eb1d8873b3505dda Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 7 Sep 2014 04:29:39 +0200 Subject: [PATCH] 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. --- apps/openmw/mwrender/animation.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwrender/animation.cpp b/apps/openmw/mwrender/animation.cpp index a8b453e89..81b92dcbf 100644 --- a/apps/openmw/mwrender/animation.cpp +++ b/apps/openmw/mwrender/animation.cpp @@ -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);