1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-06-20 11:41:33 +00:00

Further updateWeaponState cleanup

This commit is contained in:
Alexei Kotov 2022-08-09 14:10:46 +03:00
parent ea78e904a9
commit 2e112847be

View file

@ -1323,7 +1323,6 @@ bool CharacterController::updateWeaponState()
mWeaponType = weaptype; mWeaponType = weaptype;
mCurrentWeapon = weapgroup; mCurrentWeapon = weapgroup;
} }
// Make sure that we disabled unequipping animation // Make sure that we disabled unequipping animation
@ -1393,9 +1392,7 @@ bool CharacterController::updateWeaponState()
spellCastResult = world->startSpellCast(mPtr); spellCastResult = world->startSpellCast(mPtr);
mCanCast = spellCastResult == MWWorld::SpellCastState::Success; mCanCast = spellCastResult == MWWorld::SpellCastState::Success;
if (spellid.empty()) if (spellid.empty() && cls.hasInventoryStore(mPtr))
{
if (cls.hasInventoryStore(mPtr))
{ {
MWWorld::InventoryStore& inv = cls.getInventoryStore(mPtr); MWWorld::InventoryStore& inv = cls.getInventoryStore(mPtr);
if (inv.getSelectedEnchantItem() != inv.end()) if (inv.getSelectedEnchantItem() != inv.end())
@ -1405,7 +1402,6 @@ bool CharacterController::updateWeaponState()
isMagicItem = true; isMagicItem = true;
} }
} }
}
static const bool useCastingAnimations = Settings::Manager::getBool("use magic item animations", "Game"); static const bool useCastingAnimations = Settings::Manager::getBool("use magic item animations", "Game");
if (isMagicItem && !useCastingAnimations) if (isMagicItem && !useCastingAnimations)
@ -1550,7 +1546,7 @@ bool CharacterController::updateWeaponState()
} }
} }
// else if (mPtr != getPlayer()) use mAttackType set by AiCombat // else if (mPtr != getPlayer()) use mAttackType set by AiCombat
startKey = mAttackType+" start"; startKey = mAttackType + ' ' + startKey;
stopKey = mAttackType + " min attack"; stopKey = mAttackType + " min attack";
} }
@ -1580,18 +1576,6 @@ bool CharacterController::updateWeaponState()
if (!animPlaying) if (!animPlaying)
animPlaying = mAnimation->getInfo(mCurrentWeapon, &complete); animPlaying = mAnimation->getInfo(mCurrentWeapon, &complete);
if (isKnockedDown())
{
if (mUpperBodyState > UpperBodyState::WeaponEquipped)
{
mUpperBodyState = UpperBodyState::WeaponEquipped;
if (mWeaponType > ESM::Weapon::None)
mAnimation->showWeapons(true);
}
if (!mCurrentWeapon.empty())
mAnimation->disable(mCurrentWeapon);
}
if (mUpperBodyState == UpperBodyState::AttackWindUp) if (mUpperBodyState == UpperBodyState::AttackWindUp)
{ {
mAttackStrength = complete; mAttackStrength = complete;