1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-10-15 08:56:35 +00:00

Merge branch 'fix-7611' into 'master'

Refresh mMovementAnimationControlled when refreshing idle animations.

Closes #7611

See merge request OpenMW/openmw!3482
This commit is contained in:
psi29a 2023-10-23 12:37:13 +00:00
commit e1973f342e
3 changed files with 18 additions and 9 deletions

View file

@ -77,6 +77,7 @@
Bug #7603: Scripts menu size is not updated properly Bug #7603: Scripts menu size is not updated properly
Bug #7604: Goblins Grunt becomes idle once injured Bug #7604: Goblins Grunt becomes idle once injured
Bug #7609: ForceGreeting should not open dialogue for werewolves Bug #7609: ForceGreeting should not open dialogue for werewolves
Bug #7611: Beast races' idle animations slide after turning or jumping in place
Bug #7630: Charm can be cast on creatures Bug #7630: Charm can be cast on creatures
Feature #3537: Shader-based water ripples Feature #3537: Shader-based water ripples
Feature #5492: Let rain and snow collide with statics Feature #5492: Let rain and snow collide with statics

View file

@ -353,6 +353,7 @@ namespace MWMechanics
{ {
clearStateAnimation(mCurrentMovement); clearStateAnimation(mCurrentMovement);
mMovementState = CharState_None; mMovementState = CharState_None;
mMovementAnimationHasMovement = false;
} }
void CharacterController::resetCurrentIdleState() void CharacterController::resetCurrentIdleState()
@ -705,7 +706,7 @@ namespace MWMechanics
if (!mCurrentMovement.empty() && movementAnimName == mCurrentMovement) if (!mCurrentMovement.empty() && movementAnimName == mCurrentMovement)
mAnimation->getInfo(mCurrentMovement, &startpoint); mAnimation->getInfo(mCurrentMovement, &startpoint);
mMovementAnimationControlled = true; mMovementAnimationHasMovement = true;
clearStateAnimation(mCurrentMovement); clearStateAnimation(mCurrentMovement);
mCurrentMovement = movementAnimName; mCurrentMovement = movementAnimName;
@ -743,7 +744,7 @@ namespace MWMechanics
bool sneaking = mMovementState == CharState_SneakForward || mMovementState == CharState_SneakBack bool sneaking = mMovementState == CharState_SneakForward || mMovementState == CharState_SneakBack
|| mMovementState == CharState_SneakLeft || mMovementState == CharState_SneakRight; || mMovementState == CharState_SneakLeft || mMovementState == CharState_SneakRight;
mMovementAnimSpeed = (sneaking ? 33.5452f : (isRunning() ? 222.857f : 154.064f)); mMovementAnimSpeed = (sneaking ? 33.5452f : (isRunning() ? 222.857f : 154.064f));
mMovementAnimationControlled = false; mMovementAnimationHasMovement = false;
} }
} }
@ -852,7 +853,6 @@ namespace MWMechanics
resetCurrentHitState(); resetCurrentHitState();
resetCurrentIdleState(); resetCurrentIdleState();
resetCurrentJumpState(); resetCurrentJumpState();
mMovementAnimationControlled = true;
mAnimation->play(mCurrentDeath, Priority_Death, MWRender::Animation::BlendMask_All, false, 1.0f, "start", mAnimation->play(mCurrentDeath, Priority_Death, MWRender::Animation::BlendMask_All, false, 1.0f, "start",
"stop", startpoint, 0); "stop", startpoint, 0);
@ -2309,9 +2309,6 @@ namespace MWMechanics
updateIdleStormState(inwater); updateIdleStormState(inwater);
} }
if (mInJump)
mMovementAnimationControlled = false;
if (isTurning()) if (isTurning())
{ {
// Adjust animation speed from 1.0 to 1.5 multiplier // Adjust animation speed from 1.0 to 1.5 multiplier
@ -2347,7 +2344,7 @@ namespace MWMechanics
} }
} }
if (!mMovementAnimationControlled) if (!isMovementAnimationControlled())
world->queueMovement(mPtr, vec); world->queueMovement(mPtr, vec);
} }
@ -2416,7 +2413,7 @@ namespace MWMechanics
} }
// Update movement // Update movement
if (mMovementAnimationControlled && mPtr.getClass().isActor()) if (isMovementAnimationControlled() && mPtr.getClass().isActor())
world->queueMovement(mPtr, moved); world->queueMovement(mPtr, moved);
mSkipAnim = false; mSkipAnim = false;
@ -2577,6 +2574,16 @@ namespace MWMechanics
return mAnimation->isPlaying(groupName); return mAnimation->isPlaying(groupName);
} }
bool CharacterController::isMovementAnimationControlled() const
{
bool movementAnimationControlled = mIdleState != CharState_None;
if (mMovementState != CharState_None)
movementAnimationControlled = mMovementAnimationHasMovement;
if (mInJump)
movementAnimationControlled = false;
return movementAnimationControlled;
}
void CharacterController::clearAnimQueue(bool clearPersistAnims) void CharacterController::clearAnimQueue(bool clearPersistAnims)
{ {
// Do not interrupt scripted animations, if we want to keep them // Do not interrupt scripted animations, if we want to keep them

View file

@ -147,7 +147,7 @@ namespace MWMechanics
std::string mCurrentMovement; std::string mCurrentMovement;
float mMovementAnimSpeed{ 0.f }; float mMovementAnimSpeed{ 0.f };
bool mAdjustMovementAnimSpeed{ false }; bool mAdjustMovementAnimSpeed{ false };
bool mMovementAnimationControlled{ true }; bool mMovementAnimationHasMovement{ false };
CharacterState mDeathState{ CharState_None }; CharacterState mDeathState{ CharState_None };
std::string mCurrentDeath; std::string mCurrentDeath;
@ -216,6 +216,7 @@ namespace MWMechanics
static bool isRandomAttackAnimation(std::string_view group); static bool isRandomAttackAnimation(std::string_view group);
bool isPersistentAnimPlaying() const; bool isPersistentAnimPlaying() const;
bool isMovementAnimationControlled() const;
void updateAnimQueue(); void updateAnimQueue();