|
|
@ -1212,8 +1212,10 @@ bool CharacterController::updateWeaponState()
|
|
|
|
mWeapon = weapon != inv.end() ? *weapon : MWWorld::Ptr();
|
|
|
|
mWeapon = weapon != inv.end() ? *weapon : MWWorld::Ptr();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Apply 1st-person weapon animations only for upper body
|
|
|
|
MWRender::Animation::AnimPriority priorityWeapon(Priority_Weapon);
|
|
|
|
MWRender::Animation::AnimPriority priorityWeapon(Priority_Weapon);
|
|
|
|
priorityWeapon[MWRender::Animation::BoneGroup_LowerBody] = Priority_WeaponLowerBody;
|
|
|
|
if (mPtr != MWMechanics::getPlayer() || !MWBase::Environment::get().getWorld()->isFirstPerson())
|
|
|
|
|
|
|
|
priorityWeapon[MWRender::Animation::BoneGroup_LowerBody] = Priority_WeaponLowerBody;
|
|
|
|
|
|
|
|
|
|
|
|
bool forcestateupdate = false;
|
|
|
|
bool forcestateupdate = false;
|
|
|
|
|
|
|
|
|
|
|
@ -1358,14 +1360,7 @@ bool CharacterController::updateWeaponState()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
MWWorld::Ptr player = getPlayer();
|
|
|
|
MWWorld::Ptr player = getPlayer();
|
|
|
|
|
|
|
|
|
|
|
|
// We should reset player's idle animation in the first-person mode.
|
|
|
|
bool resetIdle = ammunition;
|
|
|
|
if (mPtr == player && MWBase::Environment::get().getWorld()->isFirstPerson())
|
|
|
|
|
|
|
|
mIdleState = CharState_None;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// In other cases we should not break swim and sneak animations
|
|
|
|
|
|
|
|
if (mIdleState != CharState_IdleSneak && mIdleState != CharState_IdleSwim)
|
|
|
|
|
|
|
|
mIdleState = CharState_None;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(mUpperBodyState == UpperCharState_WeapEquiped && (mHitState == CharState_None || mHitState == CharState_Block))
|
|
|
|
if(mUpperBodyState == UpperCharState_WeapEquiped && (mHitState == CharState_None || mHitState == CharState_Block))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
MWBase::Environment::get().getWorld()->breakInvisibility(mPtr);
|
|
|
|
MWBase::Environment::get().getWorld()->breakInvisibility(mPtr);
|
|
|
@ -1430,6 +1425,11 @@ bool CharacterController::updateWeaponState()
|
|
|
|
0.0f, 0);
|
|
|
|
0.0f, 0);
|
|
|
|
mUpperBodyState = UpperCharState_CastingSpell;
|
|
|
|
mUpperBodyState = UpperCharState_CastingSpell;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
resetIdle = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (mPtr.getClass().hasInventoryStore(mPtr))
|
|
|
|
if (mPtr.getClass().hasInventoryStore(mPtr))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
MWWorld::InventoryStore& inv = mPtr.getClass().getInventoryStore(mPtr);
|
|
|
|
MWWorld::InventoryStore& inv = mPtr.getClass().getInventoryStore(mPtr);
|
|
|
@ -1500,6 +1500,14 @@ bool CharacterController::updateWeaponState()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// We should reset player's idle animation in the first-person mode.
|
|
|
|
|
|
|
|
if (resetIdle && mPtr == player && MWBase::Environment::get().getWorld()->isFirstPerson())
|
|
|
|
|
|
|
|
mIdleState = CharState_None;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// In other cases we should not break swim and sneak animations
|
|
|
|
|
|
|
|
if (resetIdle && mIdleState != CharState_IdleSneak && mIdleState != CharState_IdleSwim)
|
|
|
|
|
|
|
|
mIdleState = CharState_None;
|
|
|
|
|
|
|
|
|
|
|
|
animPlaying = mAnimation->getInfo(mCurrentWeapon, &complete);
|
|
|
|
animPlaying = mAnimation->getInfo(mCurrentWeapon, &complete);
|
|
|
|
if(mUpperBodyState == UpperCharState_MinAttackToMaxAttack && !isKnockedDown())
|
|
|
|
if(mUpperBodyState == UpperCharState_MinAttackToMaxAttack && !isKnockedDown())
|
|
|
|
mAttackStrength = complete;
|
|
|
|
mAttackStrength = complete;
|
|
|
@ -1663,18 +1671,22 @@ bool CharacterController::updateWeaponState()
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Note: apply reload animations only for upper body since blending with movement animations can give weird result.
|
|
|
|
// Note: apply crossbow reload animation only for upper body
|
|
|
|
// Especially noticable with crossbow reload animation.
|
|
|
|
// since blending with movement animations can give weird result.
|
|
|
|
if(!start.empty())
|
|
|
|
if(!start.empty())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
int mask = MWRender::Animation::BlendMask_All;
|
|
|
|
|
|
|
|
if (mWeaponType == WeapType_Crossbow)
|
|
|
|
|
|
|
|
mask = MWRender::Animation::BlendMask_UpperBody;
|
|
|
|
|
|
|
|
|
|
|
|
mAnimation->disable(mCurrentWeapon);
|
|
|
|
mAnimation->disable(mCurrentWeapon);
|
|
|
|
if (mUpperBodyState == UpperCharState_FollowStartToFollowStop)
|
|
|
|
if (mUpperBodyState == UpperCharState_FollowStartToFollowStop)
|
|
|
|
mAnimation->play(mCurrentWeapon, priorityWeapon,
|
|
|
|
mAnimation->play(mCurrentWeapon, priorityWeapon,
|
|
|
|
MWRender::Animation::BlendMask_UpperBody, true,
|
|
|
|
mask, true,
|
|
|
|
weapSpeed, start, stop, 0.0f, 0);
|
|
|
|
weapSpeed, start, stop, 0.0f, 0);
|
|
|
|
else
|
|
|
|
else
|
|
|
|
mAnimation->play(mCurrentWeapon, priorityWeapon,
|
|
|
|
mAnimation->play(mCurrentWeapon, priorityWeapon,
|
|
|
|
MWRender::Animation::BlendMask_UpperBody, false,
|
|
|
|
mask, false,
|
|
|
|
weapSpeed, start, stop, 0.0f, 0);
|
|
|
|
weapSpeed, start, stop, 0.0f, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|