SuperTuxKart
|
An internal class to store and handle speed decrease related data. More...
Public Member Functions | |
SpeedDecrease () | |
The constructor initialises the data with data that won't affect top speed at all. | |
void | reset () |
Resets the state to be inactive. | |
void | update (int ticks) |
Handles the speed increase for a certain category. | |
void | saveState (BareNetworkString *buffer) const |
Saves the state of an (active) speed decrease category. | |
void | rewindTo (BareNetworkString *buffer, bool is_active) |
Restores a previously saved state for an active speed decrease category. | |
float | getSlowdownFraction () const |
Returns the current slowdown fracftion, taking a 'fade in' into account. | |
int | getTimeLeft () const |
bool | isActive () const |
Returns if this speed decrease is active atm. | |
Public Attributes | |
uint16_t | m_max_speed_fraction |
The maximum slowdown to apply, 3 digits precision. | |
float | m_current_fraction |
The current slowdown fraction, taking the fade-in time into account. | |
int16_t | m_fade_in_ticks |
How long it should take for the full slowdown to take effect. | |
int16_t | m_duration |
How long the effect should last. | |
An internal class to store and handle speed decrease related data.
|
inline |
Returns if this speed decrease is active atm.
A duration of -1 indicates an ongoing effect.
void MaxSpeed::SpeedDecrease::saveState | ( | BareNetworkString * | buffer | ) | const |
Saves the state of an (active) speed decrease category.
It is not called if the speed decrease is not active.
buffer | Buffer which will store the state information. |
void MaxSpeed::SpeedDecrease::update | ( | int | ticks | ) |
Handles the speed increase for a certain category.
dt | Time step size. |
int16_t MaxSpeed::SpeedDecrease::m_duration |
How long the effect should last.
A -1 as value indicates that this effect stays active till it is changed back.