From 16e373f30efa91da3bcc120614fa9f82d4383b33 Mon Sep 17 00:00:00 2001 From: Alexei Kotov Date: Thu, 28 Jul 2022 19:03:17 +0300 Subject: [PATCH] Make enchanted item casting use accurate aiming for 1 frame (bug #6909) --- CHANGELOG.md | 1 + apps/openmw/mwmechanics/character.cpp | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2276c75146..860477345f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -135,6 +135,7 @@ Bug #6895: Removing a negative number of items from a script, makes the script terminate with an error Bug #6898: Accessing the Quick Inventory menu does not work while in menu mode Bug #6901: Morrowind.exe soul gem usage discrepancy + Bug #6909: Using enchanted items has no animation Feature #890: OpenMW-CS: Column filtering Feature #1465: "Reset" argument for AI functions Feature #2491: Ability to make OpenMW "portable" diff --git a/apps/openmw/mwmechanics/character.cpp b/apps/openmw/mwmechanics/character.cpp index b86f63da82..a6d6d346d3 100644 --- a/apps/openmw/mwmechanics/character.cpp +++ b/apps/openmw/mwmechanics/character.cpp @@ -1400,6 +1400,7 @@ bool CharacterController::updateState(CharacterState idle) // Enchanted items by default do not use casting animations world->castSpell(mPtr); resetIdle = false; + mUpperBodyState = UpperCharState_CastingSpell; } else if(!spellid.empty() && canCast) { @@ -1565,7 +1566,8 @@ bool CharacterController::updateState(CharacterState idle) resetCurrentIdleState(); } - animPlaying = mAnimation->getInfo(mCurrentWeapon, &complete); + // Spellcasting animation needs to "play" for at least one frame to reset the aiming factor + animPlaying = mAnimation->getInfo(mCurrentWeapon, &complete) || mUpperBodyState == UpperCharState_CastingSpell; if(mUpperBodyState == UpperCharState_MinAttackToMaxAttack && !isKnockedDown()) mAttackStrength = complete; }