mirror of
https://github.com/OpenMW/openmw.git
synced 2025-10-22 09:26:36 +00:00
Avoid redundant animation resets in updateIdleStormState
This commit is contained in:
parent
d9f8757f33
commit
79bda2e694
1 changed files with 9 additions and 4 deletions
|
@ -1166,9 +1166,14 @@ namespace MWMechanics
|
||||||
|
|
||||||
void CharacterController::updateIdleStormState(bool inwater) const
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1181,7 +1186,7 @@ namespace MWMechanics
|
||||||
characterDirection.normalize();
|
characterDirection.normalize();
|
||||||
if (stormDirection * characterDirection < -0.5f)
|
if (stormDirection * characterDirection < -0.5f)
|
||||||
{
|
{
|
||||||
if (!mAnimation->isPlaying("idlestorm"))
|
if (!animPlaying)
|
||||||
{
|
{
|
||||||
int mask = MWRender::Animation::BlendMask_Torso | MWRender::Animation::BlendMask_RightArm;
|
int mask = MWRender::Animation::BlendMask_Torso | MWRender::Animation::BlendMask_RightArm;
|
||||||
mAnimation->play("idlestorm", Priority_Storm, mask, true, 1.0f, "start", "stop", 0.0f, ~0ul);
|
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);
|
mAnimation->setLoopingEnabled("idlestorm", false);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue