From dcf6a1fc3c6f986caf6a825912d0d52ce5606a01 Mon Sep 17 00:00:00 2001 From: Mads Buvik Sandvei Date: Sun, 8 Oct 2023 20:10:53 +0200 Subject: [PATCH 1/5] Refresh mMovementAnimationControlled when refreshing idle animations. --- apps/openmw/mwmechanics/character.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apps/openmw/mwmechanics/character.cpp b/apps/openmw/mwmechanics/character.cpp index 92bc2d143e..3e242586a0 100644 --- a/apps/openmw/mwmechanics/character.cpp +++ b/apps/openmw/mwmechanics/character.cpp @@ -821,6 +821,9 @@ namespace MWMechanics mCurrentIdle = idleGroup; mAnimation->play(mCurrentIdle, priority, MWRender::Animation::BlendMask_All, false, 1.0f, "start", "stop", startPoint, numLoops, true); + + // May still be false after recent turn or jump animations + mMovementAnimationControlled = true; } void CharacterController::refreshCurrentAnims( From 7c280662684465fae747a2c74fc6ff19993ed040 Mon Sep 17 00:00:00 2001 From: Mads Buvik Sandvei Date: Sun, 8 Oct 2023 22:45:03 +0200 Subject: [PATCH 2/5] Changelog entry for 7611 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c01901ae1..3033eb83f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -77,6 +77,7 @@ Bug #7603: Scripts menu size is not updated properly Bug #7604: Goblins Grunt becomes idle once injured 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 Feature #3537: Shader-based water ripples Feature #5492: Let rain and snow collide with statics From 45a2b8042df8d3c2d1d269ca6601e00bb86c5409 Mon Sep 17 00:00:00 2001 From: Mads Buvik Sandvei Date: Wed, 11 Oct 2023 11:50:06 +0200 Subject: [PATCH 3/5] Derive the value of MovementAnimationControlled instead of storing it. --- apps/openmw/mwmechanics/character.cpp | 27 ++++++++++++++++----------- apps/openmw/mwmechanics/character.hpp | 3 ++- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/apps/openmw/mwmechanics/character.cpp b/apps/openmw/mwmechanics/character.cpp index 3e242586a0..99c82f2bf7 100644 --- a/apps/openmw/mwmechanics/character.cpp +++ b/apps/openmw/mwmechanics/character.cpp @@ -353,6 +353,7 @@ namespace MWMechanics { clearStateAnimation(mCurrentMovement); mMovementState = CharState_None; + mMovementAnimationHasMovement = false; } void CharacterController::resetCurrentIdleState() @@ -705,7 +706,7 @@ namespace MWMechanics if (!mCurrentMovement.empty() && movementAnimName == mCurrentMovement) mAnimation->getInfo(mCurrentMovement, &startpoint); - mMovementAnimationControlled = true; + mMovementAnimationHasMovement = true; clearStateAnimation(mCurrentMovement); mCurrentMovement = movementAnimName; @@ -743,7 +744,7 @@ namespace MWMechanics bool sneaking = mMovementState == CharState_SneakForward || mMovementState == CharState_SneakBack || mMovementState == CharState_SneakLeft || mMovementState == CharState_SneakRight; mMovementAnimSpeed = (sneaking ? 33.5452f : (isRunning() ? 222.857f : 154.064f)); - mMovementAnimationControlled = false; + mMovementAnimationHasMovement = false; } } @@ -821,9 +822,6 @@ namespace MWMechanics mCurrentIdle = idleGroup; mAnimation->play(mCurrentIdle, priority, MWRender::Animation::BlendMask_All, false, 1.0f, "start", "stop", startPoint, numLoops, true); - - // May still be false after recent turn or jump animations - mMovementAnimationControlled = true; } void CharacterController::refreshCurrentAnims( @@ -855,7 +853,6 @@ namespace MWMechanics resetCurrentHitState(); resetCurrentIdleState(); resetCurrentJumpState(); - mMovementAnimationControlled = true; mAnimation->play(mCurrentDeath, Priority_Death, MWRender::Animation::BlendMask_All, false, 1.0f, "start", "stop", startpoint, 0); @@ -2312,9 +2309,6 @@ namespace MWMechanics updateIdleStormState(inwater); } - if (mInJump) - mMovementAnimationControlled = false; - if (isTurning()) { // Adjust animation speed from 1.0 to 1.5 multiplier @@ -2350,7 +2344,7 @@ namespace MWMechanics } } - if (!mMovementAnimationControlled) + if (!isMovementAnimationControlled()) world->queueMovement(mPtr, vec); } @@ -2419,7 +2413,7 @@ namespace MWMechanics } // Update movement - if (mMovementAnimationControlled && mPtr.getClass().isActor()) + if (isMovementAnimationControlled() && mPtr.getClass().isActor()) world->queueMovement(mPtr, moved); mSkipAnim = false; @@ -2580,6 +2574,17 @@ namespace MWMechanics return mAnimation->isPlaying(groupName); } + bool CharacterController::isMovementAnimationControlled() const + { + bool movementAnimationControlled = true; + movementAnimationControlled = mIdleState != CharState_None; + if (mMovementState != CharState_None) + movementAnimationControlled = mMovementAnimationHasMovement; + if (mInJump) + movementAnimationControlled = false; + return movementAnimationControlled; + } + void CharacterController::clearAnimQueue(bool clearPersistAnims) { // Do not interrupt scripted animations, if we want to keep them diff --git a/apps/openmw/mwmechanics/character.hpp b/apps/openmw/mwmechanics/character.hpp index 5a676e3f6d..e4d2d32fb8 100644 --- a/apps/openmw/mwmechanics/character.hpp +++ b/apps/openmw/mwmechanics/character.hpp @@ -147,7 +147,7 @@ namespace MWMechanics std::string mCurrentMovement; float mMovementAnimSpeed{ 0.f }; bool mAdjustMovementAnimSpeed{ false }; - bool mMovementAnimationControlled{ true }; + bool mMovementAnimationHasMovement{ false }; CharacterState mDeathState{ CharState_None }; std::string mCurrentDeath; @@ -272,6 +272,7 @@ namespace MWMechanics bool playGroup(std::string_view groupname, int mode, int count, bool persist = false); void skipAnim(); bool isAnimPlaying(std::string_view groupName) const; + bool isMovementAnimationControlled() const; enum KillResult { From e893767ed055ced9dc20d5c3c25bdbb5b32b1fed Mon Sep 17 00:00:00 2001 From: Mads Buvik Sandvei Date: Sat, 14 Oct 2023 13:56:44 +0200 Subject: [PATCH 4/5] Redundant line --- apps/openmw/mwmechanics/character.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/apps/openmw/mwmechanics/character.cpp b/apps/openmw/mwmechanics/character.cpp index 99c82f2bf7..48abac8b06 100644 --- a/apps/openmw/mwmechanics/character.cpp +++ b/apps/openmw/mwmechanics/character.cpp @@ -2576,8 +2576,7 @@ namespace MWMechanics bool CharacterController::isMovementAnimationControlled() const { - bool movementAnimationControlled = true; - movementAnimationControlled = mIdleState != CharState_None; + bool movementAnimationControlled = mIdleState != CharState_None; if (mMovementState != CharState_None) movementAnimationControlled = mMovementAnimationHasMovement; if (mInJump) From 354b028072ff817ea1f7083126d8ba6a455c5bc9 Mon Sep 17 00:00:00 2001 From: Mads Buvik Sandvei Date: Sat, 14 Oct 2023 13:57:29 +0200 Subject: [PATCH 5/5] isMovementAnimationControlled should be private. --- apps/openmw/mwmechanics/character.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/openmw/mwmechanics/character.hpp b/apps/openmw/mwmechanics/character.hpp index e4d2d32fb8..316a1cff0e 100644 --- a/apps/openmw/mwmechanics/character.hpp +++ b/apps/openmw/mwmechanics/character.hpp @@ -216,6 +216,7 @@ namespace MWMechanics static bool isRandomAttackAnimation(std::string_view group); bool isPersistentAnimPlaying() const; + bool isMovementAnimationControlled() const; void updateAnimQueue(); @@ -272,7 +273,6 @@ namespace MWMechanics bool playGroup(std::string_view groupname, int mode, int count, bool persist = false); void skipAnim(); bool isAnimPlaying(std::string_view groupName) const; - bool isMovementAnimationControlled() const; enum KillResult {