Compare commits

...

12 Commits

Author SHA1 Message Date
Alayan
abbee26708 Don't do the upscaling animation if already upscaled 2018-09-22 23:13:54 +02:00
Alayan
9c6352c867 Add SuperSize in the artist debug mode menu 2018-09-22 22:44:34 +02:00
Alayan
ae1181540d Reduce duration 2018-09-22 01:14:43 +02:00
Alayan
df25f9b1fb Reduce duration, increase item probability 2018-09-22 01:13:15 +02:00
Alayan
639a173339 Add bowling ball immunity for super-sized karts 2018-09-22 00:57:15 +02:00
Alayan
862113d2a9 Add probabilities to get the new super-size item 2018-09-21 18:33:40 +02:00
Alayan
1285f8c58c Add invulnerability stars 2018-09-21 06:47:13 +02:00
Alayan
a9b49305db Add minimal supersize AI ; special effect when swattered 2018-09-21 06:25:02 +02:00
Alayan
d9581d9f70 Make the visual kart scale 2018-09-21 05:56:38 +02:00
Alayan
6a9a1a0e7a Add a new super-size powerup 2018-09-21 05:43:48 +02:00
Alayan
d3c4dd0b7c Add new characteristics for super-size boost 2018-09-21 05:14:44 +02:00
Alayan
b48f31d4a0 add basic functions to manage super status 2018-09-21 04:36:23 +02:00
17 changed files with 369 additions and 77 deletions

View File

@ -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="10" 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.

View File

@ -1,6 +1,7 @@
<?xml version="1.0"?>
<powerup>
<item name="zipper" icon="zipper_collect.png" />
<item name="super" icon="super_size.png" />
<item name="bowling" icon="bowling-icon.png"
model="bowling.spm" speed="4.0"
min-height="0.2" max-height="1.0"
@ -131,112 +132,112 @@
<!-- The entry for '1' kart lists more than a single weight
because the others are used for interpolation when
there are two karts or more. -->
<!-- bubble cake bowl zipper plunger switch swattr rubber para anvil -->
<weight single ="140 0 300 100 225 75 160 0 0 0"
multi =" 0 0 0 0 0 0 0 0 0 0" />
<weight single ="150 0 295 130 200 70 135 0 0 0"
multi =" 0 0 20 0 0 0 0 0 0 0" />
<weight single ="150 0 310 135 180 65 135 0 0 0"
multi =" 0 0 25 0 0 0 0 0 0 0" />
<weight single ="155 0 280 180 170 60 125 0 0 0"
multi =" 0 0 30 0 0 0 0 0 0 0" />
<weight single ="170 0 180 275 150 50 85 0 0 0"
multi =" 0 0 90 0 0 0 0 0 0 0" />
<!-- bubble cake bowl zipper plunger switch swattr rubber super para anvil -->
<weight single ="140 0 300 100 225 75 160 0 0 0 0"
multi =" 0 0 0 0 0 0 0 0 0 0 0" />
<weight single ="150 0 295 130 200 70 135 0 0 0 0"
multi =" 0 0 20 0 0 0 0 0 0 0 0" />
<weight single ="150 0 310 135 180 65 135 0 0 0 0"
multi =" 0 0 25 0 0 0 0 0 0 0 0" />
<weight single ="155 0 280 180 170 60 125 0 0 0 0"
multi =" 0 0 30 0 0 0 0 0 0 0 0" />
<weight single ="170 0 180 275 150 50 85 0 0 0 0"
multi =" 0 0 90 0 0 0 0 0 0 0 0" />
</weights>
<weights num-karts="5">
<!-- bubble cake bowl zipper plunger switch swattr rubber para anvil -->
<weight single ="130 80 260 75 230 60 165 0 0 0"
multi =" 0 0 0 0 0 0 0 0 0 0" />
<weight single ="150 135 240 125 140 50 135 0 0 0"
multi =" 0 0 25 0 0 0 0 0 0 0" />
<weight single ="150 135 225 135 135 45 135 15 0 0"
multi =" 0 0 25 0 0 0 0 0 0 0" />
<weight single ="160 120 140 190 110 35 100 80 30 0"
multi =" 0 0 35 0 0 0 0 0 0 0" />
<weight single ="140 105 45 225 0 30 0 50 90 0"
multi =" 40 0 80 175 20 0 0 0 0 0" />
<!-- bubble cake bowl zipper plunger switch swattr rubber super para anvil -->
<weight single ="130 80 260 75 230 60 165 0 0 0 0"
multi =" 0 0 0 0 0 0 0 0 0 0 0" />
<weight single ="150 135 240 125 140 50 135 0 0 0 0"
multi =" 0 0 25 0 0 0 0 0 0 0 0" />
<weight single ="150 135 225 135 135 45 135 15 0 0 0"
multi =" 0 0 25 0 0 0 0 0 0 0 0" />
<weight single ="160 120 140 190 110 35 100 80 0 30 0"
multi =" 0 0 35 0 0 0 0 0 0 0 0" />
<weight single ="110 100 45 205 0 30 0 50 120 90 0"
multi =" 40 0 80 110 20 0 0 0 0 0 0" />
</weights>
<weights num-karts="9">
<!-- bubble cake bowl zipper plunger switch swattr rubber para anvil -->
<weight single ="120 60 290 50 270 40 170 0 0 0"
multi =" 0 0 0 0 0 0 0 0 0 0" />
<weight single ="145 150 225 120 160 35 135 0 0 0"
multi =" 0 0 30 0 0 0 0 0 0 0" />
<weight single ="150 130 205 140 130 30 130 50 0 0"
multi =" 0 0 35 0 0 0 0 0 0 0" />
<weight single ="165 115 130 225 70 25 80 60 40 0"
multi =" 0 0 60 0 30 0 0 0 0 0" />
<weight single ="100 80 35 185 0 15 0 20 75 0"
multi =" 90 0 90 290 20 0 0 0 0 0" />
<!-- bubble cake bowl zipper plunger switch swattr rubber super para anvil -->
<weight single ="120 60 290 50 270 40 170 0 0 0 0"
multi =" 0 0 0 0 0 0 0 0 0 0 0" />
<weight single ="145 150 225 120 160 35 135 0 0 0 0"
multi =" 0 0 30 0 0 0 0 0 0 0 0" />
<weight single ="150 130 205 140 130 30 130 50 0 0 0"
multi =" 0 0 35 0 0 0 0 0 0 0 0" />
<weight single ="165 115 130 225 70 25 80 60 0 40 0"
multi =" 0 0 60 0 30 0 0 0 0 0 0" />
<weight single =" 85 75 30 195 0 15 0 20 170 75 0"
multi =" 75 0 75 165 20 0 0 0 0 0 0" />
</weights>
<weights num-karts="14">
<!-- bubble cake bowl zipper plunger switch swattr rubber para anvil -->
<weight single ="110 40 320 25 300 30 175 0 0 0"
multi =" 0 0 0 0 0 0 0 0 0 0" />
<weight single ="140 155 240 110 170 20 135 0 0 0"
multi =" 0 0 30 0 0 0 0 0 0 0" />
<weight single ="150 125 210 145 145 15 120 50 0 0"
multi =" 0 0 40 0 0 0 0 0 0 0" />
<weight single ="135 105 115 220 60 15 70 40 30 0"
multi =" 40 0 80 40 50 0 0 0 0 0" />
<weight single =" 90 70 15 175 0 0 0 0 50 0"
multi ="120 0 125 325 30 0 0 0 0 0" />
<!-- bubble cake bowl zipper plunger switch swattr rubber super para anvil -->
<weight single ="110 40 320 25 300 30 175 0 0 0 0"
multi =" 0 0 0 0 0 0 0 0 0 0 0" />
<weight single ="140 155 240 110 170 20 135 0 0 0 0"
multi =" 0 0 30 0 0 0 0 0 0 0 0" />
<weight single ="150 125 210 145 145 15 120 50 0 0 0"
multi =" 0 0 40 0 0 0 0 0 0 0 0" />
<weight single ="135 105 115 220 60 15 70 40 0 30 0"
multi =" 40 0 80 40 50 0 0 0 0 0 0" />
<weight single =" 65 60 10 160 0 0 0 0 230 50 0"
multi ="110 0 80 215 20 0 0 0 0 0 0" />
</weights>
<weights num-karts="20">
<!-- bubble cake bowl zipper plunger switch swattr rubber para anvil -->
<weight single ="100 0 370 0 330 20 180 0 0 0"
multi =" 0 0 0 0 0 0 0 0 0 0" />
<weight single ="135 160 240 100 185 15 135 0 0 0"
multi =" 0 0 30 0 0 0 0 0 0 0" />
<weight single ="150 120 200 150 140 10 105 50 0 0"
multi =" 0 0 50 0 25 0 0 0 0 0" />
<weight single ="125 90 100 250 50 10 50 30 15 0"
multi =" 50 0 100 50 80 0 0 0 0 0" />
<weight single =" 75 60 0 125 0 0 0 0 35 0"
multi ="150 0 155 400 0 0 0 0 0 0" />
<!-- bubble cake bowl zipper plunger switch swattr rubber super para anvil -->
<weight single ="100 0 370 0 330 20 180 0 0 0 0"
multi =" 0 0 0 0 0 0 0 0 0 0 0" />
<weight single ="135 160 240 100 185 15 135 0 0 0 0"
multi =" 0 0 30 0 0 0 0 0 0 0 0" />
<weight single ="150 120 200 150 140 10 105 50 0 0 0"
multi =" 0 0 50 0 25 0 0 0 0 0 0" />
<weight single ="125 90 100 250 50 10 50 30 0 15 0"
multi =" 50 0 100 50 80 0 0 0 0 0 0" />
<weight single =" 40 45 0 110 0 0 0 0 300 35 0"
multi ="140 0 80 250 0 0 0 0 0 0 0" />
</weights>
</race-weight-list>
<ftl-weight-list>
<weights num-karts="1">
<!-- bubble cake bowl zipper plunger switch swattr rubber para anvil -->
<!-- bubble cake bowl zipper plunger switch swattr rubber super para anvil -->
<!-- This is the entry for the leader: -->
<weight single ="35 0 25 35 25 15 25 0 0 0"
multi ="20 0 0 20 0 0 0 0 0 0" />
<weight single ="35 0 25 35 25 15 25 0 0 0 0"
multi ="20 0 0 20 0 0 0 0 0 0 0" />
<!-- This is the entry for the first non-leader karts: -->
<weight single ="25 0 60 25 58 2 30 0 0 0"
multi =" 0 0 0 0 0 0 0 0 0 0" />
<weight single ="35 0 55 35 25 3 25 0 0 0"
multi =" 0 0 10 0 12 0 0 0 0 0" />
<weight single ="25 0 40 45 15 5 15 10 5 0"
multi ="10 0 15 15 0 0 0 0 0 0" />
<weight single ="25 0 60 25 58 2 30 0 0 0 0"
multi =" 0 0 0 0 0 0 0 0 0 0 0" />
<weight single ="35 0 55 35 25 3 25 0 0 0 0"
multi =" 0 0 10 0 12 0 0 0 0 0 0" />
<weight single ="25 0 40 45 15 5 15 10 0 5 0"
multi ="10 0 15 15 0 0 0 0 0 0 0" />
<!-- This is the entry for the last kart: -->
<weight single ="20 0 15 25 0 0 0 0 15 0"
multi ="20 0 25 80 0 0 0 0 0 0" />
<weight single ="20 0 15 25 0 0 0 0 0 15 0"
multi ="20 0 25 80 0 0 0 0 0 0 0" />
</weights>
</ftl-weight-list>
<battle-weight-list>
<weights num-karts="1">
<!-- bubble cake bowl zipper plunger switch swattr rubber para anvil -->
<weight single ="10 30 60 0 0 10 30 0 0 0"
multi =" 0 0 5 0 0 0 0 0 0 0" />
<!-- bubble cake bowl zipper plunger switch swattr rubber super para anvil -->
<weight single ="10 30 60 0 0 10 30 0 0 0 0"
multi =" 0 0 5 0 0 0 0 0 0 0 0" />
</weights>
</battle-weight-list>
<soccer-weight-list>
<weights num-karts="1">
<!-- bubble cake bowl zipper plunger switch swattr rubber para anvil -->
<weight single =" 0 30 60 0 0 10 30 0 0 0"
multi =" 0 0 5 0 0 0 0 0 0 0" />
<!-- bubble cake bowl zipper plunger switch swattr rubber super para anvil -->
<weight single =" 0 30 60 0 0 10 30 0 0 0 0"
multi =" 0 0 5 0 0 0 0 0 0 0 0" />
</weights>
</soccer-weight-list>
<tutorial-weight-list>
<weights num-karts="1">
<!-- bubble cake bowl zipper plunger switch swattr rubber para anvil -->
<weight single =" 0 0 0 0 0 0 0 0 0 0"
multi =" 0 0 100 0 0 0 0 0 0 0" />
<!-- bubble cake bowl zipper plunger switch swattr rubber super para anvil -->
<weight single =" 0 0 0 0 0 0 0 0 0 0 0"
multi =" 0 0 100 0 0 0 0 0 0 0 0" />
</weights>
</tutorial-weight-list>

View File

@ -198,6 +198,12 @@ bool Bowling::hit(AbstractKart* kart, PhysicalObject* obj)
kart->decreaseShieldTime();
return true;
}
// Super-Sized karts are immune to bowling balls
// (But if they have a gum shield, they lose it)
else if (kart && kart->isSuperSized())
{
return false;
}
else
{
m_has_hit_kart = kart != NULL;

View File

@ -170,6 +170,9 @@ void Powerup::set(PowerupManager::PowerupType type, int n)
case PowerupManager::POWERUP_ZIPPER:
break ;
case PowerupManager::POWERUP_SUPER_SIZE:
break ;
case PowerupManager::POWERUP_BOWLING:
m_sound_use = SFXManager::get()->createSoundSource("bowling_shoot");
break ;
@ -276,6 +279,9 @@ void Powerup::use()
case PowerupManager::POWERUP_ZIPPER:
m_kart->handleZipper(NULL, true);
break ;
case PowerupManager::POWERUP_SUPER_SIZE:
m_kart->setSuper();
break ;
case PowerupManager::POWERUP_SWITCH:
{
ItemManager::get()->switchItems();

View File

@ -105,7 +105,7 @@ PowerupManager::PowerupType
static std::string powerup_names[] = {
"", /* Nothing */
"bubblegum", "cake", "bowling", "zipper", "plunger", "switch",
"swatter", "rubber-ball", "parachute", "anchor"
"swatter", "rubber-ball", "super", "parachute", "anchor"
};
for(unsigned int i=POWERUP_FIRST; i<=POWERUP_LAST; i++)

View File

@ -132,6 +132,7 @@ public:
POWERUP_CAKE,
POWERUP_BOWLING, POWERUP_ZIPPER, POWERUP_PLUNGER,
POWERUP_SWITCH, POWERUP_SWATTER, POWERUP_RUBBERBALL,
POWERUP_SUPER_SIZE,
POWERUP_PARACHUTE,
POWERUP_ANVIL, //powerup.cpp assumes these two come last
POWERUP_LAST=POWERUP_ANVIL,

View File

@ -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
{

View File

@ -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;

View File

@ -268,6 +268,9 @@ public:
/** Returns if the kart is currently being squashed. */
virtual bool isSquashed() const = 0;
// ------------------------------------------------------------------------
/** Returns if the kart is currently being super-sized. */
virtual bool isSuperSized() const = 0;
// ------------------------------------------------------------------------
/** Squashes this kart: it will scale the kart in up direction, and causes
* a slowdown while this kart is squashed.
* \param time How long the kart will be squashed.
@ -277,6 +280,17 @@ public:
/** Makes the kart unsquashed again. */
virtual void unsetSquash() = 0;
// ------------------------------------------------------------------------
/** This activates super mode for kart ; upscaling it and giving it
* other perks. */
virtual void setSuper() = 0;
// ------------------------------------------------------------------------
/** This disables super mode
* \param instant Is this a normal end or a reset */
virtual void unsetSuper(bool instant) = 0;
// ------------------------------------------------------------------------
/** Updates the kart's current scaling */
virtual void updateScale(int ticks) = 0;
// ------------------------------------------------------------------------
/** Returns the speed of the kart in meters/second. This is not declared
* pure abstract, since this function is not needed for certain classes,
* like Ghost. */

View File

@ -1241,6 +1241,12 @@ void SkiddingAI::handleItems(const float dt, const Vec3 *aim_point, int last_nod
m_controls->setFire(true);
break; // POWERUP_PARACHUTE
case PowerupManager::POWERUP_SUPER_SIZE:
// FIXME : this is a temporary AI to avoid crashes
if(m_time_since_last_shot > 1.0f)
m_controls->setFire(true);
break; // POWERUP_SUPER_SIZE
case PowerupManager::POWERUP_SWATTER:
{
// if the kart has a shield, do not break it by using a swatter.

View File

@ -348,6 +348,7 @@ void Kart::reset()
m_collision_particles->setCreationRateAbsolute(0.0f);
#endif
unsetSuper(true /*instant*/);
unsetSquash();
m_last_used_powerup = PowerupManager::POWERUP_NOTHING;
@ -360,7 +361,9 @@ void Kart::reset()
m_invulnerable_ticks = 0;
m_min_nitro_ticks = 0;
m_energy_to_min_ratio = 0;
m_scale_change_ticks = 0;
m_squash_time = std::numeric_limits<float>::max();
m_super_time = std::numeric_limits<float>::max();
m_collected_energy = 0;
m_bounce_back_ticks = 0;
m_brake_ticks = 0;
@ -1792,6 +1795,14 @@ void Kart::setSquash(float time, float slowdown)
return;
}
if(isSuperSized())
{
unsetSuper(true /*instant*/);
setInvulnerableTicks(stk_config->time2Ticks(2.5f));
showStarEffect(2.5f);
return;
}
m_max_speed->setSlowdown(MaxSpeed::MS_DECREASE_SQUASH, slowdown,
stk_config->time2Ticks(0.1f),
stk_config->time2Ticks(time));
@ -1846,6 +1857,86 @@ void Kart::unsetSquash()
#endif
}
//-----------------------------------------------------------------------------
/** This activates super mode for kart ; upscaling it and giving it
* other perks. */
void Kart::setSuper()
{
if (isSquashed())
unsetSquash();
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();
m_max_speed->increaseMaxSpeed(MaxSpeed::MS_INCREASE_SUPER,
max_speed_increase,
engine_force,
stk_config->time2Ticks(duration),
stk_config->time2Ticks(fade_out_time));
// Kart small or downscaling and not currently upscaling
if (m_scale_change_ticks <= 0 && m_super_time == std::numeric_limits<float>::max())
m_scale_change_ticks = stk_config->time2Ticks(SUPER_TRANSITION_TIME) +
m_scale_change_ticks;
m_super_time = duration;
} // setSuper
//-----------------------------------------------------------------------------
/** Update the scale according to m_scale_change_ticks
*/
void Kart::updateScale(int ticks)
{
//TODO update physics model too
if (m_scale_change_ticks == 0) return;
float scale_by_tick = 0.5/(float)stk_config->time2Ticks(SUPER_TRANSITION_TIME);
float scale_factor;
if (m_scale_change_ticks > 0)
{
m_scale_change_ticks -= ticks;
if (m_scale_change_ticks < 0) m_scale_change_ticks = 0;
scale_factor = 1.5 - (m_scale_change_ticks*scale_by_tick);
}
else
{
m_scale_change_ticks += ticks;
if (m_scale_change_ticks > 0) m_scale_change_ticks = 0;
scale_factor = 1.0 - (m_scale_change_ticks*scale_by_tick);
}
#ifndef SERVER_ONLY
m_node->setScale(core::vector3df(scale_factor,scale_factor,scale_factor));
#endif
} // setSuper
//-----------------------------------------------------------------------------
/** This disables super mode
* \param instant Is this a normal end or a reset */
void Kart::unsetSuper(bool instant)
{
//TODO update physics model too
m_super_time = std::numeric_limits<float>::max();
if (instant)
{
#ifndef SERVER_ONLY
m_node->setScale(core::vector3df(1.0f,1.0f,1.0f));
#endif
m_scale_change_ticks = 0;
// This resets the speed boost
m_max_speed->increaseMaxSpeed(MaxSpeed::MS_INCREASE_SUPER,
0, 0, 0, 0);
}
else
{
// Will scale back to normal over time
m_scale_change_ticks = -40;
// The speed boost will end by itself
}
} // unsetSuper
//-----------------------------------------------------------------------------
/** Returns if the kart is currently being squashed
*/
@ -1855,6 +1946,16 @@ bool Kart::isSquashed() const
m_max_speed->isSpeedDecreaseActive(MaxSpeed::MS_DECREASE_SQUASH) == 1;
} // setSquash
//-----------------------------------------------------------------------------
/** Returns if the kart is currently super-sized
*/
bool Kart::isSuperSized() const
{
return
m_max_speed->getSpeedIncreaseTicksLeft(MaxSpeed::MS_INCREASE_SUPER) > 0;
} // setSquash
//-----------------------------------------------------------------------------
/** Plays any terrain specific sound effect.
*/
@ -2506,6 +2607,18 @@ bool Kart::playCustomSFX(unsigned int type)
*/
void Kart::updatePhysics(int ticks)
{
if (m_super_time != std::numeric_limits<float>::max())
{
m_super_time -= stk_config->ticks2Time(ticks);
// If super time ends, reset the model
if (m_super_time <= 0.0f)
{
unsetSuper(false /*instant*/);
}
} // if super
updateScale(ticks);
if (m_controls.getAccel() > 0.0f &&
World::getWorld()->getTicksSinceStart() == 1)
{

View File

@ -253,6 +253,12 @@ protected:
int m_ticks_last_crash;
RaceManager::KartType m_type;
// Used to know where we are when upscaling/downscaling the kart
// Set to positive to upscale, to negative to downscale
int8_t m_scale_change_ticks;
float m_super_time;
const float SUPER_TRANSITION_TIME = 0.5;//TODO : move to config
/** To prevent using nitro in too short bursts */
int8_t m_min_nitro_ticks;
@ -315,6 +321,10 @@ public:
virtual void setSquash (float time, float slowdown) OVERRIDE;
virtual void unsetSquash () OVERRIDE;
virtual void setSuper () OVERRIDE;
virtual void unsetSuper (bool instant) OVERRIDE;
virtual void updateScale (int ticks) OVERRIDE;
virtual void crashed (AbstractKart *k, bool update_attachments) OVERRIDE;
virtual void crashed (const Material *m, const Vec3 &normal) OVERRIDE;
virtual float getHoT () const OVERRIDE;
@ -508,6 +518,9 @@ public:
/** Returns if the kart is currently being squashed. */
virtual bool isSquashed() const OVERRIDE;
// ------------------------------------------------------------------------
/** Returns if the kart is currently super sized. */
virtual bool isSuperSized() const OVERRIDE;
// ------------------------------------------------------------------------
/** Shows the star effect for a certain time. */
virtual void showStarEffect(float t) OVERRIDE;
// ------------------------------------------------------------------------

View File

@ -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
{

View File

@ -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;

View File

@ -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:

View File

@ -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",

View File

@ -104,6 +104,7 @@ enum DebugMenuCommand
DEBUG_POWERUP_PARACHUTE,
DEBUG_POWERUP_PLUNGER,
DEBUG_POWERUP_RUBBERBALL,
DEBUG_POWERUP_SUPER,
DEBUG_POWERUP_SWATTER,
DEBUG_POWERUP_SWITCH,
DEBUG_POWERUP_ZIPPER,
@ -501,6 +502,9 @@ bool handleContextMenuAction(s32 cmd_id)
case DEBUG_POWERUP_RUBBERBALL:
addPowerup(PowerupManager::POWERUP_RUBBERBALL);
break;
case DEBUG_POWERUP_SUPER:
addPowerup(PowerupManager::POWERUP_SUPER_SIZE);
break;
case DEBUG_POWERUP_SWATTER:
addPowerup(PowerupManager::POWERUP_SWATTER);
break;
@ -904,6 +908,7 @@ bool onEvent(const SEvent &event)
sub->addItem(L"Cake", DEBUG_POWERUP_CAKE );
sub->addItem(L"Parachute", DEBUG_POWERUP_PARACHUTE );
sub->addItem(L"Plunger", DEBUG_POWERUP_PLUNGER );
sub->addItem(L"SuperSize", DEBUG_POWERUP_SUPER );
sub->addItem(L"Swatter", DEBUG_POWERUP_SWATTER );
sub->addItem(L"Switch", DEBUG_POWERUP_SWITCH );
sub->addItem(L"Zipper", DEBUG_POWERUP_ZIPPER );