diff options
author | MrSimbax <simbaxlp@gmail.com> | 2014-03-08 22:36:35 +0100 |
---|---|---|
committer | MrSimbax <simbaxlp@gmail.com> | 2014-03-08 22:36:35 +0100 |
commit | a61da7404bf8430132864d493c7e75a6b4c3d978 (patch) | |
tree | a9e915bbfab52fd67bad3d2d43d48999e816bbb5 /src/physics/physics.cpp | |
parent | fbe2bf8bc7d61a7a13759f56e65181e16e25806b (diff) | |
download | colobot-a61da7404bf8430132864d493c7e75a6b4c3d978.tar.gz colobot-a61da7404bf8430132864d493c7e75a6b4c3d978.tar.bz2 colobot-a61da7404bf8430132864d493c7e75a6b4c3d978.zip |
Added fall damage
+ changed window title
Diffstat (limited to 'src/physics/physics.cpp')
-rw-r--r-- | src/physics/physics.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/physics/physics.cpp b/src/physics/physics.cpp index a7e1e6c..c84040e 100644 --- a/src/physics/physics.cpp +++ b/src/physics/physics.cpp @@ -107,6 +107,9 @@ CPhysics::CPhysics(CObject* object) m_bFreeze = false; m_bForceUpdate = true; m_bLowLevel = false; + m_fallingHeight = 0.0f; + m_fallDamageFraction = 0.0f; + m_minFallingHeight = 0.0f; memset(&m_linMotion, 0, sizeof(Motion)); memset(&m_cirMotion, 0,sizeof(Motion)); @@ -912,9 +915,15 @@ void CPhysics::MotorUpdate(float aTime, float rTime) if ( m_reactorRange < 0.5f ) m_bLowLevel = true; } + m_minFallingHeight = 20.0f; + m_fallDamageFraction = 0.007f; + if ( m_reactorRange == 0.0f ) // reactor tilt? { motorSpeed.y = -1.0f; // grave + + if (m_fallingHeight == 0.0f && m_floorHeight >= m_minFallingHeight) + m_fallingHeight = m_floorHeight; } } @@ -974,6 +983,13 @@ void CPhysics::MotorUpdate(float aTime, float rTime) m_cirMotion.motorSpeed.y = 0.0f; } + if ( m_bLand && m_fallingHeight != 0.0f ) // if fell + { + float force = m_fallingHeight * m_fallDamageFraction; + m_object->ExploObject(EXPLO_BOUM, force); + m_fallingHeight = 0.0f; + } + if ( m_type == TYPE_FLYING && m_bLand ) // flying on the ground? { if ( type == OBJECT_HUMAN || |