mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-24 09:39:51 +00:00
Fix swish sound volume and pitch (bug #5057)
This commit is contained in:
parent
8e7ddc7c0d
commit
6c05192afa
@ -2710,8 +2710,9 @@ void CharacterController::playSwishSound() const
|
||||
if (weapclass == ESM::WeaponType::Ranged || weapclass == ESM::WeaponType::Thrown)
|
||||
return;
|
||||
|
||||
std::string soundId;
|
||||
float pitch = 1.f;
|
||||
std::string soundId = "Weapon Swish";
|
||||
float volume = 0.98f + mAttackStrength * 0.02f;
|
||||
float pitch = 0.75f + mAttackStrength * 0.4f;
|
||||
|
||||
const MWWorld::Class &cls = mPtr.getClass();
|
||||
if (cls.isNpc() && cls.getNpcStats(mPtr).isWerewolf())
|
||||
@ -2722,17 +2723,9 @@ void CharacterController::playSwishSound() const
|
||||
if (sound)
|
||||
soundId = sound->mId;
|
||||
}
|
||||
else
|
||||
{
|
||||
soundId = "Weapon Swish";
|
||||
if (mAttackStrength < 0.5f)
|
||||
pitch = 0.8f; // Weak attack
|
||||
else if (mAttackStrength >= 1.f)
|
||||
pitch = 1.2f; // Strong attack
|
||||
}
|
||||
|
||||
if (!soundId.empty())
|
||||
MWBase::Environment::get().getSoundManager()->playSound3D(mPtr, soundId, 1.0f, pitch);
|
||||
MWBase::Environment::get().getSoundManager()->playSound3D(mPtr, soundId, volume, pitch);
|
||||
}
|
||||
|
||||
void CharacterController::updateHeadTracking(float duration)
|
||||
|
Loading…
x
Reference in New Issue
Block a user