Move nitro min consumption to kart properties
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@13278 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
7afaad013a
commit
ec4c55de73
@ -81,8 +81,6 @@
|
||||
# include <math.h>
|
||||
#endif
|
||||
|
||||
const float MIN_NITRO_TIME_THRESHOLD = 1.3f;
|
||||
|
||||
/** The kart constructor.
|
||||
* \param ident The identifier for the kart model to use.
|
||||
* \param position The position (or rank) for this kart (between 1 and
|
||||
@ -1538,7 +1536,7 @@ void Kart::updateNitro(float dt)
|
||||
{
|
||||
if (m_controls.m_nitro && m_min_nitro_time <= 0.0f)
|
||||
{
|
||||
m_min_nitro_time = MIN_NITRO_TIME_THRESHOLD;
|
||||
m_min_nitro_time = m_kart_properties->getNitroMinConsumptionTime();
|
||||
}
|
||||
if (m_min_nitro_time > 0.0f)
|
||||
{
|
||||
|
@ -108,6 +108,7 @@ KartProperties::KartProperties(const std::string &filename)
|
||||
m_engine_sfx_type = "engine_small";
|
||||
m_kart_model = NULL;
|
||||
m_has_rand_wheels = false;
|
||||
m_nitro_min_consumption = 1.0f;
|
||||
// The default constructor for stk_config uses filename=""
|
||||
if (filename != "")
|
||||
{
|
||||
@ -313,6 +314,7 @@ void KartProperties::getAllData(const XMLNode * root)
|
||||
nitro_node->get("duration", &m_nitro_duration );
|
||||
nitro_node->get("fade-out-time", &m_nitro_fade_out_time );
|
||||
nitro_node->get("max", &m_nitro_max );
|
||||
nitro_node->get("min-consumption-time", &m_nitro_min_consumption );
|
||||
}
|
||||
|
||||
if(const XMLNode *bubble_node = root->getNode("bubblegum"))
|
||||
|
@ -176,6 +176,11 @@ private:
|
||||
/** Vertical offset after rescue. */
|
||||
float m_rescue_vert_offset;
|
||||
|
||||
/** Minimum time during which nitro is consumed when pressing
|
||||
* the nitro key (to prevent using in very small bursts)
|
||||
*/
|
||||
float m_nitro_min_consumption;
|
||||
|
||||
/** Filename of the wheel models. */
|
||||
std::string m_wheel_filename[4];
|
||||
/** Radius of the graphical wheels. */
|
||||
@ -853,7 +858,11 @@ public:
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns true if wheels should have random rotation at start. */
|
||||
bool hasRandomWheels() const { return m_has_rand_wheels; }
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns minimum time during which nitro is consumed when pressing nitro
|
||||
* key, to prevent using nitro in very short bursts
|
||||
*/
|
||||
float getNitroMinConsumptionTime() const { return m_nitro_min_consumption; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the bevel factor (!=0 indicates to use a bevelled box). */
|
||||
const Vec3 &getBevelFactor() const { return m_bevel_factor; }
|
||||
|
Loading…
Reference in New Issue
Block a user