mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-30 03:32:36 +00:00
Merge pull request #1154 from MiroslavR/swish
Fix swish sound ID and play swish sound effects for all creatures
This commit is contained in:
commit
88e07640d5
@ -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…
x
Reference in New Issue
Block a user