mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 19:19:56 +00:00
Fix swish sound ID and play swish sound effects for all creatures (Fixes #3653)
This commit is contained in:
parent
7e797eeda0
commit
76ee5845ac
2 changed files with 19 additions and 7 deletions
|
@ -1049,6 +1049,9 @@ bool CharacterController::updateCreatureState()
|
|||
mUpperBodyState = UpperCharState_StartToMinAttack;
|
||||
|
||||
mAttackStrength = std::min(1.f, 0.1f + Misc::Rng::rollClosedProbability());
|
||||
|
||||
if (weapType == WeapType_HandToHand)
|
||||
playSwishSound(0.0f);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1370,13 +1373,7 @@ bool CharacterController::updateWeaponState()
|
|||
}
|
||||
else
|
||||
{
|
||||
std::string sound = "SwishM";
|
||||
if(attackStrength < 0.5f)
|
||||
sndMgr->playSound3D(mPtr, sound, 1.0f, 0.8f); //Weak attack
|
||||
else if(attackStrength < 1.0f)
|
||||
sndMgr->playSound3D(mPtr, sound, 1.0f, 1.0f); //Medium attack
|
||||
else
|
||||
sndMgr->playSound3D(mPtr, sound, 1.0f, 1.2f); //Strong attack
|
||||
playSwishSound(attackStrength);
|
||||
}
|
||||
}
|
||||
mAttackStrength = attackStrength;
|
||||
|
@ -2271,6 +2268,19 @@ void CharacterController::setHeadTrackTarget(const MWWorld::ConstPtr &target)
|
|||
mHeadTrackTarget = target;
|
||||
}
|
||||
|
||||
void CharacterController::playSwishSound(float attackStrength)
|
||||
{
|
||||
MWBase::SoundManager *sndMgr = MWBase::Environment::get().getSoundManager();
|
||||
|
||||
std::string sound = "Weapon Swish";
|
||||
if(attackStrength < 0.5f)
|
||||
sndMgr->playSound3D(mPtr, sound, 1.0f, 0.8f); //Weak attack
|
||||
else if(attackStrength < 1.0f)
|
||||
sndMgr->playSound3D(mPtr, sound, 1.0f, 1.0f); //Medium attack
|
||||
else
|
||||
sndMgr->playSound3D(mPtr, sound, 1.0f, 1.2f); //Strong attack
|
||||
}
|
||||
|
||||
void CharacterController::updateHeadTracking(float duration)
|
||||
{
|
||||
const osg::Node* head = mAnimation->getNode("Bip01 Head");
|
||||
|
|
|
@ -281,6 +281,8 @@ public:
|
|||
|
||||
/// Make this character turn its head towards \a target. To turn off head tracking, pass an empty Ptr.
|
||||
void setHeadTrackTarget(const MWWorld::ConstPtr& target);
|
||||
|
||||
void playSwishSound(float attackStrength);
|
||||
};
|
||||
|
||||
MWWorld::ContainerStoreIterator getActiveWeapon(CreatureStats &stats, MWWorld::InventoryStore &inv, WeaponType *weaptype);
|
||||
|
|
Loading…
Reference in a new issue