Make the visual kart scale
This commit is contained in:
parent
6a9a1a0e7a
commit
d9581d9f70
@ -286,7 +286,7 @@ public:
|
||||
virtual void unsetSuper(bool instant) = 0;
|
||||
// ------------------------------------------------------------------------
|
||||
/** Updates the kart's current scaling */
|
||||
virtual void updateScale() = 0;
|
||||
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,
|
||||
|
@ -1876,7 +1876,7 @@ void Kart::setSuper()
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Update the scale according to m_scale_change_ticks
|
||||
*/
|
||||
void Kart::updateScale()
|
||||
void Kart::updateScale(int ticks)
|
||||
{
|
||||
//TODO update physics model too
|
||||
if (m_scale_change_ticks == 0) return;
|
||||
@ -1884,12 +1884,14 @@ void Kart::updateScale()
|
||||
float scale_factor;
|
||||
if (m_scale_change_ticks > 0)
|
||||
{
|
||||
m_scale_change_ticks--;
|
||||
m_scale_change_ticks -= ticks;
|
||||
if (m_scale_change_ticks < 0) m_scale_change_ticks = 0;
|
||||
scale_factor = 1.4 - (m_scale_change_ticks*0.01);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_scale_change_ticks++;
|
||||
m_scale_change_ticks += ticks;
|
||||
if (m_scale_change_ticks > 0) m_scale_change_ticks = 0;
|
||||
scale_factor = 1.0 - (m_scale_change_ticks*0.01);
|
||||
}
|
||||
|
||||
@ -1910,7 +1912,6 @@ void Kart::unsetSuper(bool instant)
|
||||
// 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
|
||||
{
|
||||
@ -2583,7 +2584,7 @@ void Kart::updatePhysics(int ticks)
|
||||
{
|
||||
if (m_super_time != std::numeric_limits<float>::max())
|
||||
{
|
||||
m_squash_time -= stk_config->ticks2Time(ticks);
|
||||
m_super_time -= stk_config->ticks2Time(ticks);
|
||||
// If super time ends, reset the model
|
||||
if (m_super_time <= 0.0f)
|
||||
{
|
||||
@ -2591,6 +2592,8 @@ void Kart::updatePhysics(int ticks)
|
||||
}
|
||||
} // if super
|
||||
|
||||
updateScale(ticks);
|
||||
|
||||
if (m_controls.getAccel() > 0.0f &&
|
||||
World::getWorld()->getTicksSinceStart() == 1)
|
||||
{
|
||||
|
@ -322,7 +322,7 @@ public:
|
||||
|
||||
virtual void setSuper () OVERRIDE;
|
||||
virtual void unsetSuper (bool instant) OVERRIDE;
|
||||
virtual void updateScale () 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;
|
||||
|
Loading…
Reference in New Issue
Block a user