Add new characteristics for super-size boost
This commit is contained in:
parent
b48f31d4a0
commit
d3c4dd0b7c
@ -243,6 +243,16 @@
|
||||
<zipper duration="3.5" force="250.0" speed-gain="4.5" max-speed-increase="15"
|
||||
fade-out-time="1.0" />
|
||||
|
||||
<!-- Super
|
||||
duration: Time super-size is active.
|
||||
force: Additional engine force.
|
||||
max-speed-increase: Additional speed allowed on top of the
|
||||
kart-specific maximum kart speed.
|
||||
fade-out-time: determines how long it takes for super-size's speed boost
|
||||
to fade out (after 'time'). -->
|
||||
<super duration="12" force="800.0" max-speed-increase="3"
|
||||
fade-out-time="0.5" />
|
||||
|
||||
<!-- Swatter
|
||||
duration: How long can the swatter be active.
|
||||
distance: How close a kart or an item must be before it can be hit.
|
||||
|
@ -161,6 +161,14 @@ AbstractCharacteristic::ValueType AbstractCharacteristic::getType(
|
||||
return TYPE_FLOAT;
|
||||
case ZIPPER_FADE_OUT_TIME:
|
||||
return TYPE_FLOAT;
|
||||
case SUPER_DURATION:
|
||||
return TYPE_FLOAT;
|
||||
case SUPER_FORCE:
|
||||
return TYPE_FLOAT;
|
||||
case SUPER_MAX_SPEED_INCREASE:
|
||||
return TYPE_FLOAT;
|
||||
case SUPER_FADE_OUT_TIME:
|
||||
return TYPE_FLOAT;
|
||||
case SWATTER_DURATION:
|
||||
return TYPE_FLOAT;
|
||||
case SWATTER_DISTANCE:
|
||||
@ -397,6 +405,14 @@ std::string AbstractCharacteristic::getName(CharacteristicType type)
|
||||
return "ZIPPER_MAX_SPEED_INCREASE";
|
||||
case ZIPPER_FADE_OUT_TIME:
|
||||
return "ZIPPER_FADE_OUT_TIME";
|
||||
case SUPER_DURATION:
|
||||
return "SUPER_DURATION";
|
||||
case SUPER_FORCE:
|
||||
return "SUPER_FORCE";
|
||||
case SUPER_MAX_SPEED_INCREASE:
|
||||
return "SUPER_MAX_SPEED_INCREASE";
|
||||
case SUPER_FADE_OUT_TIME:
|
||||
return "SUPER_FADE_OUT_TIME";
|
||||
case SWATTER_DURATION:
|
||||
return "SWATTER_DURATION";
|
||||
case SWATTER_DISTANCE:
|
||||
@ -1155,6 +1171,54 @@ float AbstractCharacteristic::getZipperFadeOutTime() const
|
||||
return result;
|
||||
} // getZipperFadeOutTime
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
float AbstractCharacteristic::getSuperDuration() const
|
||||
{
|
||||
float result;
|
||||
bool is_set = false;
|
||||
process(SUPER_DURATION, &result, &is_set);
|
||||
if (!is_set)
|
||||
Log::fatal("AbstractCharacteristic", "Can't get characteristic %s",
|
||||
getName(SUPER_DURATION).c_str());
|
||||
return result;
|
||||
} // getSuperDuration
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
float AbstractCharacteristic::getSuperForce() const
|
||||
{
|
||||
float result;
|
||||
bool is_set = false;
|
||||
process(SUPER_FORCE, &result, &is_set);
|
||||
if (!is_set)
|
||||
Log::fatal("AbstractCharacteristic", "Can't get characteristic %s",
|
||||
getName(SUPER_FORCE).c_str());
|
||||
return result;
|
||||
} // getSuperForce
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
float AbstractCharacteristic::getSuperMaxSpeedIncrease() const
|
||||
{
|
||||
float result;
|
||||
bool is_set = false;
|
||||
process(SUPER_MAX_SPEED_INCREASE, &result, &is_set);
|
||||
if (!is_set)
|
||||
Log::fatal("AbstractCharacteristic", "Can't get characteristic %s",
|
||||
getName(SUPER_MAX_SPEED_INCREASE).c_str());
|
||||
return result;
|
||||
} // getSuperMaxSpeedIncrease
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
float AbstractCharacteristic::getSuperFadeOutTime() const
|
||||
{
|
||||
float result;
|
||||
bool is_set = false;
|
||||
process(SUPER_FADE_OUT_TIME, &result, &is_set);
|
||||
if (!is_set)
|
||||
Log::fatal("AbstractCharacteristic", "Can't get characteristic %s",
|
||||
getName(SUPER_FADE_OUT_TIME).c_str());
|
||||
return result;
|
||||
} // getSuperFadeOutTime
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
float AbstractCharacteristic::getSwatterDuration() const
|
||||
{
|
||||
|
@ -154,6 +154,12 @@ public:
|
||||
ZIPPER_MAX_SPEED_INCREASE,
|
||||
ZIPPER_FADE_OUT_TIME,
|
||||
|
||||
// Super size
|
||||
SUPER_DURATION,
|
||||
SUPER_FORCE,
|
||||
SUPER_MAX_SPEED_INCREASE,
|
||||
SUPER_FADE_OUT_TIME,
|
||||
|
||||
// Swatter
|
||||
SWATTER_DURATION,
|
||||
SWATTER_DISTANCE,
|
||||
@ -329,6 +335,11 @@ public:
|
||||
float getZipperMaxSpeedIncrease() const;
|
||||
float getZipperFadeOutTime() const;
|
||||
|
||||
float getSuperDuration() const;
|
||||
float getSuperForce() const;
|
||||
float getSuperMaxSpeedIncrease() const;
|
||||
float getSuperFadeOutTime() const;
|
||||
|
||||
float getSwatterDuration() const;
|
||||
float getSwatterDistance() const;
|
||||
float getSwatterSquashDuration() const;
|
||||
|
@ -278,10 +278,8 @@ public:
|
||||
virtual void unsetSquash() = 0;
|
||||
// ------------------------------------------------------------------------
|
||||
/** This activates super mode for kart ; upscaling it and giving it
|
||||
* other perks.
|
||||
* \param time How long the kart will be in super mode. A value of 0 will reset
|
||||
* the kart to be normal. */
|
||||
virtual void setSuper(float time) = 0;
|
||||
* other perks. */
|
||||
virtual void setSuper() = 0;
|
||||
// ------------------------------------------------------------------------
|
||||
/** This disables super mode
|
||||
* \param instant Is this a normal end or a reset */
|
||||
|
@ -1853,23 +1853,24 @@ void Kart::unsetSquash()
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** This activates super mode for kart ; upscaling it and giving it
|
||||
* other perks.
|
||||
* \param time How long the kart will be in super mode. A value of 0 will reset
|
||||
* the kart to be normal.
|
||||
*/
|
||||
void Kart::setSuper(float time)
|
||||
* other perks. */
|
||||
void Kart::setSuper()
|
||||
{
|
||||
if (time <= 0) unsetSuper(false /*instant*/);
|
||||
|
||||
unsetSquash();
|
||||
|
||||
//TODO : set max speed and engine bonus
|
||||
float max_speed_increase = m_kart_properties->getSuperMaxSpeedIncrease();
|
||||
float duration = m_kart_properties->getSuperDuration();
|
||||
float fade_out_time = m_kart_properties->getSuperFadeOutTime();
|
||||
float engine_force = m_kart_properties->getSuperForce();
|
||||
|
||||
if (m_super_time == std::numeric_limits<float>::max())
|
||||
{
|
||||
m_scale_change_ticks = 40;
|
||||
m_super_time = time;
|
||||
}
|
||||
m_max_speed->increaseMaxSpeed(MaxSpeed::MS_INCREASE_SUPER,
|
||||
max_speed_increase,
|
||||
engine_force,
|
||||
stk_config->time2Ticks(duration),
|
||||
stk_config->time2Ticks(fade_out_time));
|
||||
|
||||
m_scale_change_ticks = 40;
|
||||
m_super_time = duration;
|
||||
} // setSuper
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -1906,12 +1907,16 @@ void Kart::unsetSuper(bool instant)
|
||||
{
|
||||
m_node->setScale(core::vector3df(1.0f,1.0f,1.0f));
|
||||
m_scale_change_ticks = 0;
|
||||
// This resets the speed boost
|
||||
m_max_speed->increaseMaxSpeed(MaxSpeed::MS_INCREASE_SUPER,
|
||||
0, 0, 0, 0);
|
||||
//TODO : force end the max speed bonus
|
||||
}
|
||||
else
|
||||
{
|
||||
//Will scale back to normal over time
|
||||
// Will scale back to normal over time
|
||||
m_scale_change_ticks = -40;
|
||||
// The speed boost will end by itself
|
||||
}
|
||||
} // unsetSuper
|
||||
|
||||
|
@ -320,7 +320,7 @@ public:
|
||||
virtual void setSquash (float time, float slowdown) OVERRIDE;
|
||||
virtual void unsetSquash () OVERRIDE;
|
||||
|
||||
virtual void setSuper (float time) OVERRIDE;
|
||||
virtual void setSuper () OVERRIDE;
|
||||
virtual void unsetSuper (bool instant) OVERRIDE;
|
||||
virtual void updateScale () OVERRIDE;
|
||||
|
||||
|
@ -901,6 +901,30 @@ float KartProperties::getZipperFadeOutTime() const
|
||||
return m_cached_characteristic->getZipperFadeOutTime();
|
||||
} // getZipperFadeOutTime
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
float KartProperties::getSuperDuration() const
|
||||
{
|
||||
return m_cached_characteristic->getSuperDuration();
|
||||
} // getSuperDuration
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
float KartProperties::getSuperForce() const
|
||||
{
|
||||
return m_cached_characteristic->getSuperForce();
|
||||
} // getSuperForce
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
float KartProperties::getSuperMaxSpeedIncrease() const
|
||||
{
|
||||
return m_cached_characteristic->getSuperMaxSpeedIncrease();
|
||||
} // getSuperMaxSpeedIncrease
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
float KartProperties::getSuperFadeOutTime() const
|
||||
{
|
||||
return m_cached_characteristic->getSuperFadeOutTime();
|
||||
} // getSuperFadeOutTime
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
float KartProperties::getSwatterDuration() const
|
||||
{
|
||||
|
@ -444,6 +444,11 @@ public:
|
||||
float getZipperMaxSpeedIncrease() const;
|
||||
float getZipperFadeOutTime() const;
|
||||
|
||||
float getSuperDuration() const;
|
||||
float getSuperForce() const;
|
||||
float getSuperMaxSpeedIncrease() const;
|
||||
float getSuperFadeOutTime() const;
|
||||
|
||||
float getSwatterDuration() const;
|
||||
float getSwatterDistance() const;
|
||||
float getSwatterSquashDuration() const;
|
||||
|
@ -30,7 +30,7 @@ friend class KartRewinder;
|
||||
public:
|
||||
/** The categories to use for increasing the speed of a kart:
|
||||
* Increase due to zipper, slipstream, nitro, rubber band,
|
||||
* skidding usage. */
|
||||
* skidding usage, or super bonus (big kart). */
|
||||
enum {MS_INCREASE_MIN,
|
||||
MS_INCREASE_ZIPPER = MS_INCREASE_MIN,
|
||||
MS_INCREASE_SLIPSTREAM,
|
||||
@ -38,6 +38,7 @@ public:
|
||||
MS_INCREASE_RUBBER,
|
||||
MS_INCREASE_SKIDDING,
|
||||
MS_INCREASE_RED_SKIDDING,
|
||||
MS_INCREASE_SUPER,
|
||||
MS_INCREASE_MAX};
|
||||
|
||||
/** The categories to use for decreasing the speed of a kart:
|
||||
|
@ -483,6 +483,18 @@ void XmlCharacteristic::load(const XMLNode *node)
|
||||
&m_values[ZIPPER_FADE_OUT_TIME]);
|
||||
}
|
||||
|
||||
if (const XMLNode *sub_node = node->getNode("super"))
|
||||
{
|
||||
sub_node->get("duration",
|
||||
&m_values[SUPER_DURATION]);
|
||||
sub_node->get("force",
|
||||
&m_values[SUPER_FORCE]);
|
||||
sub_node->get("max-speed-increase",
|
||||
&m_values[SUPER_MAX_SPEED_INCREASE]);
|
||||
sub_node->get("fade-out-time",
|
||||
&m_values[SUPER_FADE_OUT_TIME]);
|
||||
}
|
||||
|
||||
if (const XMLNode *sub_node = node->getNode("swatter"))
|
||||
{
|
||||
sub_node->get("duration",
|
||||
|
Loading…
Reference in New Issue
Block a user