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

Play pick/probe animation in attack start animation logic

This commit is contained in:
Alexei Kotov 2022-08-08 20:41:25 +03:00
parent a4b5bfc051
commit 8f280c521c

View file

@ -1501,8 +1501,17 @@ bool CharacterController::updateWeaponState()
resetIdle = false; resetIdle = false;
} }
} }
else if(mWeaponType == ESM::Weapon::PickProbe) else
{ {
std::string startKey = "start";
std::string stopKey = "stop";
bool autodisable = false;
if (mWeaponType == ESM::Weapon::PickProbe)
{
autodisable = true;
mUpperBodyState = UpperBodyState::AttackEnd;
world->breakInvisibility(mPtr); world->breakInvisibility(mPtr);
// TODO: this will only work for the player, and needs to be fixed if NPCs should ever use lockpicks/probes. // TODO: this will only work for the player, and needs to be fixed if NPCs should ever use lockpicks/probes.
MWWorld::Ptr target = world->getFacedObject(); MWWorld::Ptr target = world->getFacedObject();
@ -1515,35 +1524,17 @@ bool CharacterController::updateWeaponState()
else if (mWeapon.getType() == ESM::Probe::sRecordId) else if (mWeapon.getType() == ESM::Probe::sRecordId)
Security(mPtr).probeTrap(target, mWeapon, resultMessage, resultSound); Security(mPtr).probeTrap(target, mWeapon, resultMessage, resultSound);
} }
mAnimation->play(mCurrentWeapon, priorityWeapon,
MWRender::Animation::BlendMask_All, true,
1.0f, "start", "stop", 0.0, 0);
mUpperBodyState = UpperBodyState::AttackEnd;
if(!resultMessage.empty()) if (!resultMessage.empty())
MWBase::Environment::get().getWindowManager()->messageBox(resultMessage); MWBase::Environment::get().getWindowManager()->messageBox(resultMessage);
if(!resultSound.empty()) if (!resultSound.empty())
sndMgr->playSound3D(target, resultSound, 1.0f, 1.0f); sndMgr->playSound3D(target, resultSound, 1.0f, 1.0f);
} }
else else if (!isRandomAttackAnimation(mCurrentWeapon))
{
std::string startKey;
std::string stopKey;
if(weapclass == ESM::WeaponType::Ranged || weapclass == ESM::WeaponType::Thrown)
{ {
if (weapclass == ESM::WeaponType::Ranged || weapclass == ESM::WeaponType::Thrown)
mAttackType = "shoot"; mAttackType = "shoot";
startKey = mAttackType+" start"; else if (mPtr == getPlayer())
stopKey = mAttackType+" min attack";
}
else if (isRandomAttackAnimation(mCurrentWeapon))
{
startKey = "start";
stopKey = "stop";
}
else
{
if(mPtr == getPlayer())
{ {
if (Settings::Manager::getBool("best attack", "Game")) if (Settings::Manager::getBool("best attack", "Game"))
{ {
@ -1568,10 +1559,10 @@ bool CharacterController::updateWeaponState()
} }
mAnimation->play(mCurrentWeapon, priorityWeapon, mAnimation->play(mCurrentWeapon, priorityWeapon,
MWRender::Animation::BlendMask_All, false, MWRender::Animation::BlendMask_All, autodisable,
weapSpeed, startKey, stopKey, weapSpeed, startKey, stopKey,
0.0f, 0); 0.0f, 0);
if(mAnimation->getCurrentTime(mCurrentWeapon) != -1.f) if (mWeaponType != ESM::Weapon::PickProbe && mAnimation->getCurrentTime(mCurrentWeapon) != -1.f)
{ {
mUpperBodyState = UpperBodyState::AttackPreWindUp; mUpperBodyState = UpperBodyState::AttackPreWindUp;
if (isRandomAttackAnimation(mCurrentWeapon)) if (isRandomAttackAnimation(mCurrentWeapon))