Reset attached arrow in the beginning of unequipping animation

pull/593/head
Andrei Kortunov 4 years ago
parent 7ee5526dbf
commit 297898182b

@ -1306,6 +1306,8 @@ bool CharacterController::updateWeaponState(CharacterState& idle)
1.0f, "unequip start", "unequip stop", 0.0f, 0);
mUpperBodyState = UpperCharState_UnEquipingWeap;
mAnimation->detachArrow();
// If we do not have the "unequip detach" key, hide weapon manually.
if (mAnimation->getTextKeyTime(weapgroup+": unequip detach") < 0)
mAnimation->showWeapons(false);

@ -474,6 +474,7 @@ public:
void setAlpha(float alpha);
virtual void setPitchFactor(float factor) {}
virtual void attachArrow() {}
virtual void detachArrow() {}
virtual void releaseArrow(float attackStrength) {}
virtual void enableHeadAnimation(bool enable) {}
// TODO: move outside of this class

@ -208,6 +208,12 @@ bool CreatureWeaponAnimation::isArrowAttached() const
return mAmmunition != nullptr;
}
void CreatureWeaponAnimation::detachArrow()
{
WeaponAnimation::detachArrow(mPtr);
updateQuiver();
}
void CreatureWeaponAnimation::attachArrow()
{
WeaponAnimation::attachArrow(mPtr);

@ -40,6 +40,7 @@ namespace MWRender
void updatePart(PartHolderPtr& scene, int slot);
virtual void attachArrow();
virtual void detachArrow();
virtual void releaseArrow(float attackStrength);
// WeaponAnimation
virtual osg::Group* getArrowBone();

@ -1051,6 +1051,12 @@ void NpcAnimation::attachArrow()
updateQuiver();
}
void NpcAnimation::detachArrow()
{
WeaponAnimation::detachArrow(mPtr);
updateQuiver();
}
void NpcAnimation::releaseArrow(float attackStrength)
{
WeaponAnimation::releaseArrow(mPtr, attackStrength);

@ -142,6 +142,7 @@ public:
virtual void showCarriedLeft(bool show);
virtual void attachArrow();
virtual void detachArrow();
virtual void releaseArrow(float attackStrength);
virtual osg::Group* getArrowBone();

@ -98,6 +98,11 @@ void WeaponAnimation::attachArrow(MWWorld::Ptr actor)
}
}
void WeaponAnimation::detachArrow(MWWorld::Ptr actor)
{
mAmmunition.reset();
}
void WeaponAnimation::releaseArrow(MWWorld::Ptr actor, float attackStrength)
{
MWWorld::InventoryStore& inv = actor.getClass().getInventoryStore(actor);

@ -36,6 +36,8 @@ namespace MWRender
/// @note If no weapon (or an invalid weapon) is equipped, this function is a no-op.
void attachArrow(MWWorld::Ptr actor);
void detachArrow(MWWorld::Ptr actor);
/// @note If no weapon (or an invalid weapon) is equipped, this function is a no-op.
void releaseArrow(MWWorld::Ptr actor, float attackStrength);

Loading…
Cancel
Save