1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-27 21:35:24 +00:00

Avoid redundant animation resets in updateIdleStormState

This commit is contained in:
Alexei Kotov 2023-10-04 20:46:36 +03:00
parent d9f8757f33
commit 79bda2e694

View File

@ -1166,9 +1166,14 @@ namespace MWMechanics
void CharacterController::updateIdleStormState(bool inwater) const
{
if (!mAnimation->hasAnimation("idlestorm") || mUpperBodyState != UpperBodyState::None || inwater)
if (!mAnimation->hasAnimation("idlestorm"))
return;
bool animPlaying = mAnimation->isPlaying("idlestorm");
if (mUpperBodyState != UpperBodyState::None || inwater)
{
mAnimation->disable("idlestorm");
if (animPlaying)
mAnimation->disable("idlestorm");
return;
}
@ -1181,7 +1186,7 @@ namespace MWMechanics
characterDirection.normalize();
if (stormDirection * characterDirection < -0.5f)
{
if (!mAnimation->isPlaying("idlestorm"))
if (!animPlaying)
{
int mask = MWRender::Animation::BlendMask_Torso | MWRender::Animation::BlendMask_RightArm;
mAnimation->play("idlestorm", Priority_Storm, mask, true, 1.0f, "start", "stop", 0.0f, ~0ul);
@ -1194,7 +1199,7 @@ namespace MWMechanics
}
}
if (mAnimation->isPlaying("idlestorm"))
if (animPlaying)
{
mAnimation->setLoopingEnabled("idlestorm", false);
}