mirror of
https://github.com/OpenMW/openmw.git
synced 2025-11-30 16:04:38 +00:00
Merge branch 'handtwohand' into 'master'
Use Hand To Hand Hit 2 sound (#8731) Closes #8731 See merge request OpenMW/openmw!4978
This commit is contained in:
commit
8b6a552f5a
1 changed files with 8 additions and 2 deletions
|
|
@ -1,6 +1,8 @@
|
||||||
|
|
||||||
#include "combat.hpp"
|
#include "combat.hpp"
|
||||||
|
|
||||||
|
#include <array>
|
||||||
|
|
||||||
#include <components/misc/rng.hpp>
|
#include <components/misc/rng.hpp>
|
||||||
#include <components/settings/values.hpp>
|
#include <components/settings/values.hpp>
|
||||||
|
|
||||||
|
|
@ -504,15 +506,19 @@ namespace MWMechanics
|
||||||
}
|
}
|
||||||
|
|
||||||
MWBase::SoundManager* sndMgr = MWBase::Environment::get().getSoundManager();
|
MWBase::SoundManager* sndMgr = MWBase::Environment::get().getSoundManager();
|
||||||
|
auto& prng = MWBase::Environment::get().getWorld()->getPrng();
|
||||||
if (isWerewolf)
|
if (isWerewolf)
|
||||||
{
|
{
|
||||||
auto& prng = MWBase::Environment::get().getWorld()->getPrng();
|
|
||||||
const ESM::Sound* sound = store.get<ESM::Sound>().searchRandom("WolfHit", prng);
|
const ESM::Sound* sound = store.get<ESM::Sound>().searchRandom("WolfHit", prng);
|
||||||
if (sound)
|
if (sound)
|
||||||
sndMgr->playSound3D(victim, sound->mId, 1.0f, 1.0f);
|
sndMgr->playSound3D(victim, sound->mId, 1.0f, 1.0f);
|
||||||
}
|
}
|
||||||
else if (!healthdmg)
|
else if (!healthdmg)
|
||||||
sndMgr->playSound3D(victim, ESM::RefId::stringRefId("Hand To Hand Hit"), 1.0f, 1.0f);
|
{
|
||||||
|
static const std::array<ESM::RefId, 2> sounds
|
||||||
|
= { ESM::RefId::stringRefId("Hand To Hand Hit"), ESM::RefId::stringRefId("Hand To Hand Hit 2") };
|
||||||
|
sndMgr->playSound3D(victim, sounds[Misc::Rng::rollDice(sounds.size(), prng)], 1.0f, 1.0f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void applyFatigueLoss(const MWWorld::Ptr& attacker, const MWWorld::Ptr& weapon, float attackStrength)
|
void applyFatigueLoss(const MWWorld::Ptr& attacker, const MWWorld::Ptr& weapon, float attackStrength)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue