mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-01 22:45:35 +00:00
Fix applying of falling damage
This commit is contained in:
parent
819101144d
commit
510d1d76d7
1 changed files with 8 additions and 3 deletions
|
@ -1792,6 +1792,7 @@ void CharacterController::updateAnimQueue()
|
||||||
void CharacterController::update(float duration)
|
void CharacterController::update(float duration)
|
||||||
{
|
{
|
||||||
MWBase::World *world = MWBase::Environment::get().getWorld();
|
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||||
|
MWBase::SoundManager *sndMgr = MWBase::Environment::get().getSoundManager();
|
||||||
const MWWorld::Class &cls = mPtr.getClass();
|
const MWWorld::Class &cls = mPtr.getClass();
|
||||||
osg::Vec3f movement(0.f, 0.f, 0.f);
|
osg::Vec3f movement(0.f, 0.f, 0.f);
|
||||||
float speed = 0.f;
|
float speed = 0.f;
|
||||||
|
@ -2063,8 +2064,13 @@ void CharacterController::update(float duration)
|
||||||
// inflict fall damages
|
// inflict fall damages
|
||||||
if (!godmode)
|
if (!godmode)
|
||||||
{
|
{
|
||||||
float realHealthLost = static_cast<float>(healthLost * (1.0f - 0.25f * fatigueTerm));
|
DynamicStat<float> health = cls.getCreatureStats(mPtr).getHealth();
|
||||||
cls.onHit(mPtr, realHealthLost, true, MWWorld::Ptr(), MWWorld::Ptr(), osg::Vec3f(), true);
|
float realHealthLost = healthLost * (1.0f - 0.25f * fatigueTerm);
|
||||||
|
health.setCurrent(health.getCurrent() - realHealthLost);
|
||||||
|
cls.getCreatureStats(mPtr).setHealth(health);
|
||||||
|
sndMgr->playSound3D(mPtr, "Health Damage", 1.0f, 1.0f);
|
||||||
|
if (isPlayer)
|
||||||
|
MWBase::Environment::get().getWindowManager()->activateHitOverlay();
|
||||||
}
|
}
|
||||||
|
|
||||||
const float acrobaticsSkill = cls.getSkill(mPtr, ESM::Skill::Acrobatics);
|
const float acrobaticsSkill = cls.getSkill(mPtr, ESM::Skill::Acrobatics);
|
||||||
|
@ -2136,7 +2142,6 @@ void CharacterController::update(float duration)
|
||||||
|
|
||||||
if (playLandingSound)
|
if (playLandingSound)
|
||||||
{
|
{
|
||||||
MWBase::SoundManager *sndMgr = MWBase::Environment::get().getSoundManager();
|
|
||||||
std::string sound;
|
std::string sound;
|
||||||
osg::Vec3f pos(mPtr.getRefData().getPosition().asVec3());
|
osg::Vec3f pos(mPtr.getRefData().getPosition().asVec3());
|
||||||
if (world->isUnderwater(mPtr.getCell(), pos) || world->isWalkingOnWater(mPtr))
|
if (world->isUnderwater(mPtr.getCell(), pos) || world->isWalkingOnWater(mPtr))
|
||||||
|
|
Loading…
Reference in a new issue