diff --git a/src/karts/abstract_kart.hpp b/src/karts/abstract_kart.hpp index c54585904..a702481cf 100644 --- a/src/karts/abstract_kart.hpp +++ b/src/karts/abstract_kart.hpp @@ -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, diff --git a/src/karts/kart.cpp b/src/karts/kart.cpp index effee2645..870efc0c6 100644 --- a/src/karts/kart.cpp +++ b/src/karts/kart.cpp @@ -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::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) { diff --git a/src/karts/kart.hpp b/src/karts/kart.hpp index 8bf40b8a7..97cd2d40e 100644 --- a/src/karts/kart.hpp +++ b/src/karts/kart.hpp @@ -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;