1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-03-31 14:36:39 +00:00

Don't allow non-bipedal actors to play hand-to-hand animations

This commit is contained in:
Evil Eye 2022-02-05 22:50:04 +01:00
parent 5ebcd37da1
commit 020e0b2ea5

View file

@ -435,6 +435,8 @@ std::string CharacterController::getWeaponAnimation(int weaponType) const
else if (isRealWeapon) else if (isRealWeapon)
weaponGroup = oneHandFallback; weaponGroup = oneHandFallback;
} }
else if (weaponType == ESM::Weapon::HandToHand && !mPtr.getClass().isBipedal(mPtr))
return "attack1";
return weaponGroup; return weaponGroup;
} }
@ -1293,7 +1295,7 @@ bool CharacterController::updateState(CharacterState& idle)
} }
mWeaponType = weaptype; mWeaponType = weaptype;
mCurrentWeapon = getWeaponAnimation(mWeaponType); mCurrentWeapon = weapgroup;
if(!upSoundId.empty() && !isStillWeapon) if(!upSoundId.empty() && !isStillWeapon)
{ {
@ -1376,11 +1378,7 @@ bool CharacterController::updateState(CharacterState& idle)
{ {
mCurrentWeapon = chooseRandomAttackAnimation(); mCurrentWeapon = chooseRandomAttackAnimation();
if (!mPtr.getClass().hasInventoryStore(mPtr)) if (!mPtr.getClass().hasInventoryStore(mPtr))
{
mAttackStrength = std::min(1.f, 0.1f + Misc::Rng::rollClosedProbability()); mAttackStrength = std::min(1.f, 0.1f + Misc::Rng::rollClosedProbability());
if (mWeaponType == ESM::Weapon::HandToHand)
playSwishSound(0.0f);
}
} }
if(mWeaponType == ESM::Weapon::Spell) if(mWeaponType == ESM::Weapon::Spell)
@ -1561,7 +1559,11 @@ bool CharacterController::updateState(CharacterState& idle)
weapSpeed, startKey, stopKey, weapSpeed, startKey, stopKey,
0.0f, 0); 0.0f, 0);
if(mAnimation->getCurrentTime(mCurrentWeapon) != -1.f) if(mAnimation->getCurrentTime(mCurrentWeapon) != -1.f)
{
mUpperBodyState = UpperCharState_StartToMinAttack; mUpperBodyState = UpperCharState_StartToMinAttack;
if (mWeaponType == ESM::Weapon::HandToHand && !mPtr.getClass().isBipedal(mPtr))
playSwishSound(0.0f);
}
} }
} }