From c008108f68bee71215589577982c0ef4d46a1296 Mon Sep 17 00:00:00 2001 From: auria Date: Fri, 26 Dec 2008 21:23:27 +0000 Subject: [PATCH] moved harcoded constant to config file git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@2791 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- data/plunger.projectile | 4 ++-- src/items/plunger.cpp | 9 ++------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/data/plunger.projectile b/data/plunger.projectile index 8da2ba4d8..9f260db86 100644 --- a/data/plunger.projectile +++ b/data/plunger.projectile @@ -5,9 +5,9 @@ (model "plunger.ac") (icon "plunger-icon.rgb") (speed 35.0) - (min-height 0.2) ; height above terrain below which a spark is + (min-height 0.2) ; height above terrain below which a plunger is ; started to be pulled up - (max-height 1.0) ; height above terrain at which a spark is + (max-height 1.0) ; height above terrain at which a plunger is ; started to be pulled back to ground (force-updown 1.0) ; force pushing the spark down ; when it's too high above ground diff --git a/src/items/plunger.cpp b/src/items/plunger.cpp index 76ef61c98..fdd2a7f5b 100644 --- a/src/items/plunger.cpp +++ b/src/items/plunger.cpp @@ -127,19 +127,14 @@ void Plunger::update(float dt) Flyable::update(dt); if(!m_reverse_mode) m_rubber_band->update(dt); - // FIXME - don't hardcode, put in config file - const float max_height = 1.0; - const float min_height = 0.2; - const float average_height = (m_max_height + m_min_height)/2; - if(getHoT()==Track::NOHIT) return; float hat = getTrans().getOrigin().getZ()-getHoT(); // Use the Height Above Terrain to set the Z velocity. // HAT is clamped by min/max height. This might be somewhat // unphysical, but feels right in the game. - hat = std::max(std::min(hat, max_height) , min_height); - float delta = average_height - hat; + hat = std::max(std::min(hat, m_max_height) , m_min_height); + float delta = m_average_height - hat; btVector3 v=getVelocity(); v.setZ( /* up-down force */ 10*delta); // FIXME - don't hardcode, move to config file setVelocity(v);