SuperTuxKart
|
An internal class to store and handle speed increase related data. More...
Public Member Functions | |
SpeedIncrease () | |
The constructor initialised the values with a no-increase entry, i.e. | |
void | reset () |
Resets this increase category to be not active. | |
void | update (int ticks) |
Handles the update of speed increase objects. | |
void | saveState (BareNetworkString *buffer) const |
void | rewindTo (BareNetworkString *buffer, bool is_active) |
float | getSpeedIncrease () const |
Returns the current speedup for this category. | |
int | getTimeLeft () const |
Returns the remaining time till the fade out time starts. | |
float | getEngineForce () const |
Returns the additional engine force for this speed increase. | |
bool | isActive () const |
Returns if this speed increase is active atm. | |
Public Attributes | |
uint16_t | m_max_add_speed |
The maximum additional speed allowed, 3 digits precision. | |
int16_t | m_duration |
How long this speed will apply. | |
int16_t | m_fade_out_time |
The fadeout time. | |
float | m_current_speedup |
The current max speed increase value, updated with duration. | |
uint16_t | m_engine_force |
Additional engine force, 1 digit precision. | |
An internal class to store and handle speed increase related data.
|
inline |
The constructor initialised the values with a no-increase entry, i.e.
an entry that does affect top speed at all.
|
inline |
Returns the remaining time till the fade out time starts.
Note that this function will return a negative value if the fade_out time has started or this speed increase has expired.
void MaxSpeed::SpeedIncrease::update | ( | int | ticks | ) |
Handles the update of speed increase objects.
The m_duration variable contains the remaining time - as long as this variable is positive the maximum speed increase applies, while when it is between -m_fade_out_time and 0, the maximum speed will linearly decrease.
dt | Time step size. |
int16_t MaxSpeed::SpeedIncrease::m_duration |
How long this speed will apply.
This is used as a timer internally, to the duration will be decreased. When the duration is <0, the fade out time starts, and duration will go down to -m_fade_out_time before this speed increase stops.