Skip to content

Don't leave finished, scripted animations in the queue

Evil Eye requested to merge Assumeru/openmw:out_of_breath into master

Fixes #4742 (closed).

So to answer Capo's question on #6730 (closed), not really related, but kinda. They're both issues with the persist parameter.

When LoopGroup is called, a persistent animation is queued in CharacterController::mAnimQueue. The last item in this queue is never removed, which is usually fine. While a persistent/scripted animation is playing, regular animations won't play. However, once it's done, regular animations (including walkforward) start playing again, and they do so without updating mAnimQueue. Which gets us the situation where the scripted walkforward has finished playing, but the queue still contains a struct that says walkforward is persistent, and refreshMovementAnims tells mAnimation to play a second walkforward INT_MAX times, which then means we can't tell that the animation that's playing isn't the scripted animation and we've got an 'infinite' walkforward playing.

...which is actually accurate to vanilla behaviour if we call LoopGroup while an NPC is already naturally playing walkforward.

This MR attempts to fix the issue by clearing the queue of persistent animations that aren't playing. Which works to fix the reported issue, but doesn't reproduce the vanilla behaviour above. So this might break some mod... maybe 🤷

Merge request reports