Made the amount of nitro configurable per kart - in case that we

want to change this later when giving each kart different abilities
(now that I think about it: a similar effect can be accomplished 
with the nitro consumption rate).


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@6074 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2010-09-20 01:21:17 +00:00
parent 82fcdef6fb
commit a7672b5720
3 changed files with 21 additions and 5 deletions

View File

@ -531,9 +531,12 @@ void Kart::collectedItem(Item *item, int add_info)
case Item::ITEM_BANANA:
m_attachment->hitBanana(item, add_info);
break;
case Item::ITEM_NITRO_SMALL: m_collected_energy++; break;
case Item::ITEM_NITRO_BIG: m_collected_energy += 3; break;
case Item::ITEM_NITRO_SMALL:
m_collected_energy += m_kart_properties->getNitroSmallContainer();
break;
case Item::ITEM_NITRO_BIG:
m_collected_energy += m_kart_properties->getNitroBigContainer();
break;
case Item::ITEM_BONUS_BOX :
{
// In wheelie style, karts get more items depending on energy,

View File

@ -62,6 +62,7 @@ KartProperties::KartProperties(const std::string &filename)
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_nitro_consumption =
m_nitro_small_container = m_nitro_big_container =
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 =
@ -216,8 +217,10 @@ void KartProperties::getAllData(const XMLNode * root)
if(const XMLNode *nitro_node = root->getNode("nitro"))
{
nitro_node->get("power-boost", &m_nitro_power_boost);
nitro_node->get("consumption", &m_nitro_consumption);
nitro_node->get("power-boost", &m_nitro_power_boost );
nitro_node->get("consumption", &m_nitro_consumption );
nitro_node->get("small-container", &m_nitro_small_container);
nitro_node->get("big-container", &m_nitro_big_container );
}
if(const XMLNode *rescue_node = root->getNode("rescue"))
@ -500,6 +503,8 @@ void KartProperties::checkAllSet(const std::string &filename)
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_nitro_big_container, "nitro big-container" );
CHECK_NEG(m_nitro_small_container, "nitro small-container" );
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

@ -144,6 +144,8 @@ private:
float m_wheel_base; /**< Wheel base of the kart. */
float m_nitro_power_boost; /**< Nitro power boost. */
float m_nitro_consumption; /**< Nitro consumption. */
float m_nitro_small_container; /**< Nitro amount for small bottle. */
float m_nitro_big_container; /**< Nitro amount for big bittle. */
std::string m_engine_sfx_type; /**< Engine sound effect. */
// bullet physics data
@ -325,6 +327,12 @@ public:
/** Returns the nitro consumption. */
float getNitroConsumption () const {return m_nitro_consumption; }
/** Returns the amount of nitro for a small container. */
float getNitroSmallContainer () const {return m_nitro_small_container; }
/** Returns the amount of nitro for a big container. */
float getNitroBigContainer () const {return m_nitro_big_container; }
/** 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; }