From 85f104fefe0f4bf4a29bca465ae05621f3531e6a Mon Sep 17 00:00:00 2001 From: Mads Buvik Sandvei Date: Sun, 29 Oct 2023 15:33:07 +0100 Subject: [PATCH] Comments from Capo --- apps/openmw/mwmechanics/character.cpp | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/apps/openmw/mwmechanics/character.cpp b/apps/openmw/mwmechanics/character.cpp index aa045edff6..a21e5fbf36 100644 --- a/apps/openmw/mwmechanics/character.cpp +++ b/apps/openmw/mwmechanics/character.cpp @@ -1857,30 +1857,22 @@ namespace MWMechanics if (!mAnimation->isPlaying(mAnimQueue.front().mGroup)) { - if (mAnimQueue.size() > 1) + // Remove the finished animation, unless it's a scripted animation that was interrupted by e.g. a rebuild of + // the animation object. + if (mAnimQueue.size() > 1 || !mAnimQueue.front().mScripted || mAnimQueue.front().mLoopCount == 0) { - // Curren animation finished, move to the next in queue mAnimation->disable(mAnimQueue.front().mGroup); mAnimQueue.pop_front(); + } - bool loopfallback = mAnimQueue.front().mGroup.starts_with("idle"); - mAnimation->play(mAnimQueue.front().mGroup, Priority_Default, MWRender::Animation::BlendMask_All, false, - 1.0f, "start", "stop", 0.0f, mAnimQueue.front().mLoopCount, loopfallback); - } - else if (mAnimQueue.front().mLoopCount > 0 && mAnimQueue.front().mScripted) + if (!mAnimQueue.empty()) { - // A scripted animation stopped playing before time. - // This happens when the animation object is rebuilt, so we should restart the animation here. + // Move on to the remaining items of the queue bool loopfallback = mAnimQueue.front().mGroup.starts_with("idle"); - mAnimation->play(mAnimQueue.front().mGroup, Priority_Scripted, MWRender::Animation::BlendMask_All, + mAnimation->play(mAnimQueue.front().mGroup, mAnimQueue.front().mScripted ? Priority_Scripted : Priority_Default, + MWRender::Animation::BlendMask_All, false, 1.0f, "start", "stop", 0.0f, mAnimQueue.front().mLoopCount, loopfallback); } - else - { - // Animation is done, remove it from the queue. - mAnimation->disable(mAnimQueue.front().mGroup); - mAnimQueue.pop_front(); - } } else {