1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-11-29 19:04:31 +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:
Alexei Kotov 2025-11-10 06:30:18 +03:00
commit 8b6a552f5a

View file

@ -1,6 +1,8 @@
#include "combat.hpp"
#include <array>
#include <components/misc/rng.hpp>
#include <components/settings/values.hpp>
@ -504,15 +506,19 @@ namespace MWMechanics
}
MWBase::SoundManager* sndMgr = MWBase::Environment::get().getSoundManager();
auto& prng = MWBase::Environment::get().getWorld()->getPrng();
if (isWerewolf)
{
auto& prng = MWBase::Environment::get().getWorld()->getPrng();
const ESM::Sound* sound = store.get<ESM::Sound>().searchRandom("WolfHit", prng);
if (sound)
sndMgr->playSound3D(victim, sound->mId, 1.0f, 1.0f);
}
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)