mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-01 08:15:54 +00:00
Reset attached arrow in the beginning of unequipping animation
This commit is contained in:
parent
7ee5526dbf
commit
297898182b
8 changed files with 24 additions and 0 deletions
|
@ -1306,6 +1306,8 @@ bool CharacterController::updateWeaponState(CharacterState& idle)
|
||||||
1.0f, "unequip start", "unequip stop", 0.0f, 0);
|
1.0f, "unequip start", "unequip stop", 0.0f, 0);
|
||||||
mUpperBodyState = UpperCharState_UnEquipingWeap;
|
mUpperBodyState = UpperCharState_UnEquipingWeap;
|
||||||
|
|
||||||
|
mAnimation->detachArrow();
|
||||||
|
|
||||||
// If we do not have the "unequip detach" key, hide weapon manually.
|
// If we do not have the "unequip detach" key, hide weapon manually.
|
||||||
if (mAnimation->getTextKeyTime(weapgroup+": unequip detach") < 0)
|
if (mAnimation->getTextKeyTime(weapgroup+": unequip detach") < 0)
|
||||||
mAnimation->showWeapons(false);
|
mAnimation->showWeapons(false);
|
||||||
|
|
|
@ -474,6 +474,7 @@ public:
|
||||||
void setAlpha(float alpha);
|
void setAlpha(float alpha);
|
||||||
virtual void setPitchFactor(float factor) {}
|
virtual void setPitchFactor(float factor) {}
|
||||||
virtual void attachArrow() {}
|
virtual void attachArrow() {}
|
||||||
|
virtual void detachArrow() {}
|
||||||
virtual void releaseArrow(float attackStrength) {}
|
virtual void releaseArrow(float attackStrength) {}
|
||||||
virtual void enableHeadAnimation(bool enable) {}
|
virtual void enableHeadAnimation(bool enable) {}
|
||||||
// TODO: move outside of this class
|
// TODO: move outside of this class
|
||||||
|
|
|
@ -208,6 +208,12 @@ bool CreatureWeaponAnimation::isArrowAttached() const
|
||||||
return mAmmunition != nullptr;
|
return mAmmunition != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CreatureWeaponAnimation::detachArrow()
|
||||||
|
{
|
||||||
|
WeaponAnimation::detachArrow(mPtr);
|
||||||
|
updateQuiver();
|
||||||
|
}
|
||||||
|
|
||||||
void CreatureWeaponAnimation::attachArrow()
|
void CreatureWeaponAnimation::attachArrow()
|
||||||
{
|
{
|
||||||
WeaponAnimation::attachArrow(mPtr);
|
WeaponAnimation::attachArrow(mPtr);
|
||||||
|
|
|
@ -40,6 +40,7 @@ namespace MWRender
|
||||||
void updatePart(PartHolderPtr& scene, int slot);
|
void updatePart(PartHolderPtr& scene, int slot);
|
||||||
|
|
||||||
virtual void attachArrow();
|
virtual void attachArrow();
|
||||||
|
virtual void detachArrow();
|
||||||
virtual void releaseArrow(float attackStrength);
|
virtual void releaseArrow(float attackStrength);
|
||||||
// WeaponAnimation
|
// WeaponAnimation
|
||||||
virtual osg::Group* getArrowBone();
|
virtual osg::Group* getArrowBone();
|
||||||
|
|
|
@ -1051,6 +1051,12 @@ void NpcAnimation::attachArrow()
|
||||||
updateQuiver();
|
updateQuiver();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NpcAnimation::detachArrow()
|
||||||
|
{
|
||||||
|
WeaponAnimation::detachArrow(mPtr);
|
||||||
|
updateQuiver();
|
||||||
|
}
|
||||||
|
|
||||||
void NpcAnimation::releaseArrow(float attackStrength)
|
void NpcAnimation::releaseArrow(float attackStrength)
|
||||||
{
|
{
|
||||||
WeaponAnimation::releaseArrow(mPtr, attackStrength);
|
WeaponAnimation::releaseArrow(mPtr, attackStrength);
|
||||||
|
|
|
@ -142,6 +142,7 @@ public:
|
||||||
virtual void showCarriedLeft(bool show);
|
virtual void showCarriedLeft(bool show);
|
||||||
|
|
||||||
virtual void attachArrow();
|
virtual void attachArrow();
|
||||||
|
virtual void detachArrow();
|
||||||
virtual void releaseArrow(float attackStrength);
|
virtual void releaseArrow(float attackStrength);
|
||||||
|
|
||||||
virtual osg::Group* getArrowBone();
|
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)
|
void WeaponAnimation::releaseArrow(MWWorld::Ptr actor, float attackStrength)
|
||||||
{
|
{
|
||||||
MWWorld::InventoryStore& inv = actor.getClass().getInventoryStore(actor);
|
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.
|
/// @note If no weapon (or an invalid weapon) is equipped, this function is a no-op.
|
||||||
void attachArrow(MWWorld::Ptr actor);
|
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.
|
/// @note If no weapon (or an invalid weapon) is equipped, this function is a no-op.
|
||||||
void releaseArrow(MWWorld::Ptr actor, float attackStrength);
|
void releaseArrow(MWWorld::Ptr actor, float attackStrength);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue