Reset animation state after weapon unequipping

remotes/1728160796594174844/tmp_0.7.0-alpha
Andrei Kortunov 7 years ago
parent 9e6cba09a6
commit c07cc0dc40

@ -1221,11 +1221,11 @@ bool CharacterController::updateWeaponState()
bool isStillWeapon = weaptype > WeapType_HandToHand && weaptype < WeapType_Spell && bool isStillWeapon = weaptype > WeapType_HandToHand && weaptype < WeapType_Spell &&
mWeaponType > WeapType_HandToHand && mWeaponType < WeapType_Spell; mWeaponType > WeapType_HandToHand && mWeaponType < WeapType_Spell;
if(weaptype != mWeaponType && !isKnockedOut() && if(!isKnockedOut() && !isKnockedDown() && !isRecovery())
!isKnockedDown() && !isRecovery())
{ {
std::string weapgroup; std::string weapgroup;
if ((!isWerewolf || mWeaponType != WeapType_Spell) if ((!isWerewolf || mWeaponType != WeapType_Spell)
&& weaptype != mWeaponType
&& mUpperBodyState != UpperCharState_UnEquipingWeap && mUpperBodyState != UpperCharState_UnEquipingWeap
&& !isStillWeapon) && !isStillWeapon)
{ {
@ -1250,7 +1250,12 @@ bool CharacterController::updateWeaponState()
float complete; float complete;
bool animPlaying = mAnimation->getInfo(mCurrentWeapon, &complete); bool animPlaying = mAnimation->getInfo(mCurrentWeapon, &complete);
if (!animPlaying || complete >= 1.0f) if (!animPlaying || complete >= 1.0f)
{
// Weapon is changed, no current animation (e.g. unequipping or attack).
// Start equipping animation now.
if (weaptype != mWeaponType)
{ {
forcestateupdate = true; forcestateupdate = true;
mAnimation->showCarriedLeft(updateCarriedLeftVisible(weaptype)); mAnimation->showCarriedLeft(updateCarriedLeftVisible(weaptype));
@ -1260,12 +1265,8 @@ bool CharacterController::updateWeaponState()
if (!isStillWeapon) if (!isStillWeapon)
{ {
if (weaptype == WeapType_None)
{
// Disable current weapon animation manually
mAnimation->disable(mCurrentWeapon); mAnimation->disable(mCurrentWeapon);
} if (weaptype != WeapType_None)
else
{ {
mAnimation->showWeapons(false); mAnimation->showWeapons(false);
mAnimation->play(weapgroup, priorityWeapon, mAnimation->play(weapgroup, priorityWeapon,
@ -1295,6 +1296,16 @@ bool CharacterController::updateWeaponState()
sndMgr->playSound3D(mPtr, upSoundId, 1.0f, 1.0f); sndMgr->playSound3D(mPtr, upSoundId, 1.0f, 1.0f);
} }
} }
// Make sure that we disabled unequipping animation
if (mUpperBodyState == UpperCharState_UnEquipingWeap)
{
mUpperBodyState = UpperCharState_Nothing;
mAnimation->disable(mCurrentWeapon);
mWeaponType = WeapType_None;
getWeaponGroup(mWeaponType, mCurrentWeapon);
}
}
} }
if(isWerewolf) if(isWerewolf)

Loading…
Cancel
Save