From 244ca93cf7c224cc855501893701ed556b7425e5 Mon Sep 17 00:00:00 2001 From: MrSimbax Date: Wed, 12 Mar 2014 19:43:20 +0100 Subject: Fixed bug with fall damage If you change the height after overheat, you get damage like you didn't change it at all. For example: overheat when you are 10 meters above the ground, and you fall to place 20 meters deeper, but you get the damage like you fell from 10 meters instead of 30. This commit fix this. --- src/physics/physics.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/physics/physics.cpp b/src/physics/physics.cpp index 0d1c6fe..ad59ec0 100644 --- a/src/physics/physics.cpp +++ b/src/physics/physics.cpp @@ -1613,7 +1613,7 @@ bool CPhysics::EventFrame(const Event &event) if ( m_bLand && m_fallingHeight != 0.0f ) // if fell { - float force = m_fallingHeight * m_fallDamageFraction; + float force = (m_fallingHeight - m_object->GetPosition(0).y) * m_fallDamageFraction; m_object->ExploObject(EXPLO_BOUM, force); m_fallingHeight = 0.0f; } @@ -3901,7 +3901,7 @@ Error CPhysics::GetError() void CPhysics::SetFalling() { if (m_fallingHeight == 0.0f && m_floorHeight >= m_minFallingHeight) - m_fallingHeight = m_floorHeight; + m_fallingHeight = m_object->GetPosition(0).y; } float CPhysics::GetFallingHeight() -- cgit v1.2.3-1-g7c22