19#ifndef HEADER_SKIDDING_HPP
20#define HEADER_SKIDDING_HPP
22#include "karts/controller/kart_control.hpp"
23#include "utils/leak_check.hpp"
24#include "utils/no_copy.hpp"
70 float m_graphical_remaining_jump_time;
72 float m_prev_visual_rotation;
74 float m_smoothing_time;
78 int m_skid_bonus_end_ticks;
89 enum SkidState { SKID_NONE, SKID_ACCUMULATE_LEFT, SKID_ACCUMULATE_RIGHT,
90 SKID_SHOW_GFX_LEFT, SKID_SHOW_GFX_RIGHT, SKID_BREAK} ;
104 unsigned int getSkidBonus(
float *bonus_time,
float *bonus_speed,
105 float *bonus_force)
const;
112 void update(
int dt,
bool is_on_ground,
float steer,
122 if (m_smoothing_dt >= 0.0f)
125 (1.0f - m_smoothing_dt) * m_prev_visual_rotation;
150 bool isJumping()
const {
return m_graphical_remaining_jump_time > 0; }
152 void prepareSmoothing();
154 void checkSmoothing();
Describes a chain of 8-bit unsigned integers.
Definition: network_string.hpp:53
SkidControl
The skidding control state: SC_NONE: not pressed; SC_NO_DIRECTION: pressed, but no steering; SC_LEFT/...
Definition: kart_control.hpp:35
Definition: kart_rewinder.hpp:30
The main kart class.
Definition: kart.hpp:69
This class is used for debugging.
Definition: show_curve.hpp:46
Definition: skidding.hpp:40
bool getSkidBonusReady() const
Returns if the kart has skidded long enough to get a skid bonus if it stopped skidding now.
Definition: skidding.hpp:148
SkidState getSkidState() const
Returns the skidding state.
Definition: skidding.hpp:141
float m_visual_rotation
An additional rotation (heading) of the kart while skidding.
Definition: skidding.hpp:54
bool m_skid_bonus_ready
True if the kart has skidded long enough to get a skid bonus if it stopped skidding now.
Definition: skidding.hpp:65
float getVisualSkidRotation() const
Determines how much the graphics model of the kart should be rotated additionally (for skidding),...
Definition: skidding.hpp:120
float m_skid_factor
Accumulated skidding factor.
Definition: skidding.hpp:57
void update(int dt, bool is_on_ground, float steer, KartControl::SkidControl skidding)
Updates skidding status.
Definition: skidding.cpp:346
float updateGraphics(float dt)
Called once per rendered frame to potentially update the graphical jump height.
Definition: skidding.cpp:257
float m_skid_reduce_turn_delta
This is m_skid_reduce_turn_max - m_skid_reduce_turn_min.
Definition: skidding.hpp:46
float m_real_steering
This is the actual steering (in fraction of max-steering-angle) to be used by this kart.
Definition: skidding.hpp:50
void rewindTo(BareNetworkString *buffer)
Restores the skidding state of a kart.
Definition: skidding.cpp:114
float getSkidFactor() const
Returns the current skid factor in [1, skid_max_for_this_kart].
Definition: skidding.hpp:131
SkidState m_skid_state
The current skidding state.
Definition: skidding.hpp:94
float updateSteering(float steer, int ticks)
Computes the actual steering fraction to be used in the physics, and stores it in m_real_skidding.
Definition: skidding.cpp:148
uint16_t m_skid_time
Keeps track on how long a kart has been skidding, in order to trigger the skidding bonus.
Definition: skidding.hpp:61
float m_remaining_jump_time
Set to >0 when a graphical jump is to be done.
Definition: skidding.hpp:68
float getSteeringWhenSkidding(float steering) const
Returns the steering value necessary to set in KartControls.m_steer in order to actually to steer the...
Definition: skidding.cpp:226
bool isSkidding() const
Returns true if the kart is skidding.
Definition: skidding.hpp:134
void reset()
Resets all skidding related values.
Definition: skidding.cpp:68
SkidState
SKID_NONE: Kart is currently not skidding.
Definition: skidding.hpp:89
float getSteeringFraction()
Returns the steering fraction to be used by the physics.
Definition: skidding.hpp:138
unsigned int getSkidBonus(float *bonus_time, float *bonus_speed, float *bonus_force) const
Determines the bonus time and speed given the currently accumulated m_skid_time.
Definition: skidding.cpp:598
void saveState(BareNetworkString *buffer)
Save the skidding state of a kart.
Definition: skidding.cpp:102
Kart * m_kart
A read-only pointer to the kart's properties.
Definition: skidding.hpp:97
Declares the general types that are used by the network.