Made 'min_speed' available for zipper only, re-exported spaceship track.
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@14716 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
c10ed78570
commit
55cd9dd09a
@ -137,7 +137,6 @@ Material::Material(const XMLNode *node, int index, bool deprecated)
|
||||
|
||||
node->get("additive", &m_add );
|
||||
node->get("max-speed", &m_max_speed_fraction);
|
||||
node->get("min-speed", &m_min_speed );
|
||||
node->get("slowdown-time", &m_slowdown_time );
|
||||
node->get("backface-culling", &m_backface_culling );
|
||||
node->get("disable-z-write", &m_disable_z_write );
|
||||
@ -325,11 +324,13 @@ Material::Material(const XMLNode *node, int index, bool deprecated)
|
||||
m_zipper_fade_out_time = 3.0f;
|
||||
m_zipper_speed_gain = 4.5f;
|
||||
m_zipper_engine_force = 250;
|
||||
m_zipper_min_speed = -1.0f;
|
||||
child_node->get("duration", &m_zipper_duration );
|
||||
child_node->get("fade-out-time", &m_zipper_fade_out_time );
|
||||
child_node->get("max-speed-increase",&m_zipper_max_speed_increase);
|
||||
child_node->get("speed-gain", &m_zipper_speed_gain );
|
||||
child_node->get("sengine-force", &m_zipper_engine_force );
|
||||
child_node->get("min-speed", &m_zipper_min_speed );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -387,7 +388,6 @@ void Material::init(unsigned int index)
|
||||
m_water_shader_speed_2 = 4.0f;
|
||||
m_fog = true;
|
||||
m_max_speed_fraction = 1.0f;
|
||||
m_min_speed = -1.0f;
|
||||
m_slowdown_time = 1.0f;
|
||||
m_sfx_name = "";
|
||||
m_sfx_min_speed = 0.0f;
|
||||
@ -401,6 +401,7 @@ void Material::init(unsigned int index)
|
||||
m_zipper_max_speed_increase = -1.0f;
|
||||
m_zipper_speed_gain = -1.0f;
|
||||
m_zipper_engine_force = -1.0f;
|
||||
m_zipper_min_speed = -1.0f;
|
||||
m_parallax_map = false;
|
||||
m_is_heightmap = false;
|
||||
m_water_splash = false;
|
||||
|
@ -176,7 +176,7 @@ private:
|
||||
/** Minimum speed on this terrain. This is used for zippers on a ramp to
|
||||
* guarantee the right jump distance. A negative value indicates no
|
||||
* minimum speed. */
|
||||
float m_min_speed;
|
||||
float m_zipper_min_speed;
|
||||
/** The minimum speed at which a special sfx is started to be played. */
|
||||
float m_sfx_min_speed;
|
||||
/** The speed at which the maximum pitch is used. */
|
||||
@ -270,11 +270,6 @@ public:
|
||||
/** Returns the fraction of maximum speed on this material. */
|
||||
float getMaxSpeedFraction() const { return m_max_speed_fraction; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the minimum speed of a kart on this material. This is used
|
||||
* for zippers on a ramp to guarantee the right jump distance even
|
||||
* on lower speeds. A negative value indicates no minimum speed. */
|
||||
float getMinSpeed() const { return m_min_speed; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns how long it will take for a slowdown to take effect.
|
||||
* It is the time it takes till the full slowdown applies to
|
||||
* karts. So a short time will slowdown a kart much faster. */
|
||||
@ -329,7 +324,12 @@ public:
|
||||
*zipper_fade_out_time = m_zipper_fade_out_time;
|
||||
*zipper_engine_force = m_zipper_engine_force;
|
||||
} // getZipperParameter
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the minimum speed of a kart on this material. This is used
|
||||
* for zippers on a ramp to guarantee the right jump distance even
|
||||
* on lower speeds. A negative value indicates no minimum speed. */
|
||||
float getZipperMinSpeed() const { return m_zipper_min_speed; }
|
||||
// ------------------------------------------------------------------------
|
||||
bool isNormalMap() const { return m_graphical_effect == GE_NORMAL_MAP; }
|
||||
|
||||
void onMadeVisible(scene::IMeshBuffer* who);
|
||||
|
@ -2002,8 +2002,10 @@ void Kart::updatePhysics(float dt)
|
||||
m_speed *= -1.f;
|
||||
|
||||
// Cap speed if necessary
|
||||
m_max_speed->setMinSpeed(getMaterial() ? getMaterial()->getMinSpeed()
|
||||
: -1.0f );
|
||||
const Material *m = getMaterial();
|
||||
|
||||
float min_speed = m && m->isZipper() ? m->getZipperMinSpeed() : -1.0f;
|
||||
m_max_speed->setMinSpeed(min_speed);
|
||||
m_max_speed->update(dt);
|
||||
|
||||
// To avoid tunneling (which can happen on long falls), clamp the
|
||||
|
Loading…
x
Reference in New Issue
Block a user