1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-04-14 19:36:45 +00:00

Move weapon equip sound logic to weapon equip animation logic

This commit is contained in:
Alexei Kotov 2022-08-09 15:46:24 +03:00
parent 9f39f6d48e
commit c4881c8613

View file

@ -1129,7 +1129,6 @@ bool CharacterController::updateWeaponState()
const bool isWerewolf = cls.isNpc() && cls.getNpcStats(mPtr).isWerewolf(); const bool isWerewolf = cls.isNpc() && cls.getNpcStats(mPtr).isWerewolf();
std::string upSoundId;
std::string downSoundId; std::string downSoundId;
bool weaponChanged = false; bool weaponChanged = false;
bool ammunition = true; bool ammunition = true;
@ -1145,8 +1144,6 @@ bool CharacterController::updateWeaponState()
if (weapon != inv.end()) if (weapon != inv.end())
{ {
newWeapon = *weapon; newWeapon = *weapon;
if (mWeaponType != ESM::Weapon::HandToHand && isRealWeapon(weaptype))
upSoundId = newWeapon.getClass().getUpSoundId(newWeapon);
if (isRealWeapon(mWeaponType)) if (isRealWeapon(mWeaponType))
downSoundId = newWeapon.getClass().getDownSoundId(newWeapon); downSoundId = newWeapon.getClass().getDownSoundId(newWeapon);
} }
@ -1304,10 +1301,13 @@ bool CharacterController::updateWeaponState()
{ {
mAnimation->showWeapons(true); mAnimation->showWeapons(true);
} }
}
if (!upSoundId.empty()) if (!mWeapon.isEmpty() && mWeaponType != ESM::Weapon::HandToHand && isRealWeapon(weaptype))
{ {
sndMgr->playSound3D(mPtr, upSoundId, 1.0f, 1.0f); std::string upSoundId = mWeapon.getClass().getUpSoundId(mWeapon);
if (!upSoundId.empty())
sndMgr->playSound3D(mPtr, upSoundId, 1.0f, 1.0f);
}
} }
} }