Applied Lilian Gimenez's patch which allows the nitro consumption to

vary from kart to kart. While this is atm not used, it will be useful
once we have different physics parameters for karts. Thanks for the
patch!


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@5497 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk
2010-06-11 01:19:15 +00:00
parent 154a733725
commit 3c335d4d0a
4 changed files with 16 additions and 4 deletions

View File

@@ -108,8 +108,10 @@
necessary. -->
<rescue vert-offset="0.0" time="2" height="2"/>
<!-- Nitro: power-boost is the increase in engine power, i.e. 1=plus 100% -->
<nitro power-boost="3"/>
<!-- Nitro: power-boost: increase in engine power, i.e. 1=plus 100%
consumption: nitro consumption - heavier characters can be set
to need more nitro than lighter character. -->
<nitro power-boost="3" consumption="1"/>
<!-- Skidding: increase: multiplicative increase of skidding factor in each frame.
decrease: multiplicative decrease of skidding factor in each frame.

View File

@@ -818,7 +818,7 @@ void Kart::handleZipper()
float Kart::handleNitro(float dt)
{
if(!m_controls.m_nitro) return 0.0;
m_collected_energy -= dt;
m_collected_energy -= dt * m_kart_properties->getNitroConsumption();
if(m_collected_energy<0)
{
m_collected_energy = 0;

View File

@@ -59,7 +59,8 @@ KartProperties::KartProperties(const std::string &filename)
m_max_speed_turn = m_angle_at_max = m_brake_factor =
m_engine_power[0] = m_engine_power[1] = m_engine_power[2] =
m_max_speed[0] = m_max_speed[1] = m_max_speed[2] =
m_time_full_steer = m_time_full_steer_ai = m_nitro_power_boost =
m_time_full_steer = m_time_full_steer_ai =
m_nitro_power_boost = m_nitro_consumption =
m_suspension_stiffness = m_wheel_damping_relaxation = m_wheel_base =
m_wheel_damping_compression = m_friction_slip = m_roll_influence =
m_wheel_radius = m_chassis_linear_damping =
@@ -217,7 +218,10 @@ void KartProperties::getAllData(const XMLNode * root)
dimensions_node->get("gravity-shift", &m_gravity_center_shift);
if(const XMLNode *nitro_node = root->getNode("nitro"))
{
nitro_node->get("power-boost", &m_nitro_power_boost);
nitro_node->get("consumption", &m_nitro_consumption);
}
if(const XMLNode *rescue_node = root->getNode("rescue"))
{
@@ -484,6 +488,8 @@ void KartProperties::checkAllSet(const std::string &filename)
CHECK_NEG(m_slipstream_add_power, "slipstream add-power" );
CHECK_NEG(m_slipstream_min_speed, "slipstream min-speed" );
CHECK_NEG(m_camera_distance, "camera distance" );
CHECK_NEG(m_nitro_power_boost, "nitro power-boost" );
CHECK_NEG(m_nitro_consumption, "nitro consumption" );
CHECK_NEG(m_rescue_height, "rescue height" );
CHECK_NEG(m_rescue_time, "rescue time" );
CHECK_NEG(m_rescue_vert_offset, "rescue vert-offset" );

View File

@@ -140,6 +140,7 @@ private:
float m_rubber_band_duration;/**< Duration a rubber band works. */
float m_wheel_base; /**< Wheel base of the kart. */
float m_nitro_power_boost; /**< Nitro power boost. */
float m_nitro_consumption; /**< Nitro consumption. */
std::string m_engine_sfx_type; /**< Engine sound effect. */
// bullet physics data
@@ -306,6 +307,9 @@ public:
/** Returns the nitro power boost. */
float getNitroPowerBoost () const {return m_nitro_power_boost; }
/** Returns the nitro consumption. */
float getNitroConsumption () const {return m_nitro_consumption; }
/** Returns a shift of the center of mass (lowering the center of mass
* makes the karts more stable. */
const Vec3&getGravityCenterShift() const {return m_gravity_center_shift; }