Skip to content

Commit

Permalink
Merge branch 'attackanimationsareforfalsegods' into 'master'
Browse files Browse the repository at this point in the history
Improve vanilla consistency of weapon animations for non-bipeds (#8223, #8237)

Closes #8237 and #8223

See merge request OpenMW/openmw!4462
  • Loading branch information
psi29a committed Nov 23, 2024
2 parents cb8e280 + b57f488 commit 97522c2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,9 @@
Bug #8206: Moving away from storm wind origin should make you faster
Bug #8207: Using hand-to-hand while sneaking plays the critical hit sound when the target is not getting hurt
Bug #8208: The launcher's view distance option's minimum value isn't capped to Vanilla's minimum
Bug #8223: Ghosts don't move while spellcasting
Bug #8231: AGOP doesn't like NiCollisionSwitch
Bug #8237: Non-bipedal creatures should *not* use spellcast equip/unequip animations
Feature #1415: Infinite fall failsafe
Feature #2566: Handle NAM9 records for manual cell references
Feature #3501: OpenMW-CS: Instance Editing - Shortcuts for axial locking
Expand Down
23 changes: 13 additions & 10 deletions apps/openmw/mwmechanics/character.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1341,10 +1341,14 @@ namespace MWMechanics
}
}

// For biped actors, blend weapon animations with lower body animations with higher priority
MWRender::Animation::AnimPriority priorityWeapon(Priority_Weapon);
MWRender::Animation::AnimPriority priorityWeapon(Priority_Default);
if (cls.isBipedal(mPtr))
{
// For bipeds, blend weapon animations with lower body animations with higher priority
// For non-bipeds, movement takes priority
priorityWeapon = Priority_Weapon;
priorityWeapon[MWRender::BoneGroup_LowerBody] = Priority_WeaponLowerBody;
}

bool forcestateupdate = false;

Expand All @@ -1366,7 +1370,7 @@ namespace MWMechanics
if (!isKnockedOut() && !isKnockedDown() && !isRecovery())
{
std::string weapgroup;
if ((!isWerewolf || mWeaponType != ESM::Weapon::Spell) && weaptype != mWeaponType
if (((!isWerewolf && cls.isBipedal(mPtr)) || mWeaponType != ESM::Weapon::Spell) && weaptype != mWeaponType
&& mUpperBodyState <= UpperBodyState::AttackWindUp && mUpperBodyState != UpperBodyState::Unequipping
&& !isStillWeapon)
{
Expand Down Expand Up @@ -1442,8 +1446,11 @@ namespace MWMechanics
"equip start", "equip stop", 0.0f, 0);
}

playBlendedAnimation(
weapgroup, priorityWeapon, equipMask, true, 1.0f, "equip start", "equip stop", 0.0f, 0);
if (weaptype != ESM::Weapon::Spell || cls.isBipedal(mPtr))
{
playBlendedAnimation(weapgroup, priorityWeapon, equipMask, true, 1.0f, "equip start",
"equip stop", 0.0f, 0);
}
mUpperBodyState = UpperBodyState::Equipping;

// If we do not have the "equip attach" key, show weapon manually.
Expand Down Expand Up @@ -1798,11 +1805,7 @@ namespace MWMechanics

if (animPlaying)
mAnimation->disable(mCurrentWeapon);
MWRender::Animation::AnimPriority priorityFollow(priorityWeapon);
// Follow animations have lower priority than movement for non-biped creatures, logic be damned
if (!cls.isBipedal(mPtr))
priorityFollow = Priority_Default;
playBlendedAnimation(mCurrentWeapon, priorityFollow, MWRender::BlendMask_All, false, weapSpeed,
playBlendedAnimation(mCurrentWeapon, priorityWeapon, MWRender::BlendMask_All, false, weapSpeed,
mAttackType + ' ' + start, mAttackType + ' ' + stop, 0.0f, 0);
mUpperBodyState = UpperBodyState::AttackEnd;

Expand Down

0 comments on commit 97522c2

Please sign in to comment.