SuperTuxKart
|
Public Member Functions | |
KartRewinder (const std::string &ident, unsigned int world_kart_id, int position, const btTransform &init_transform, HandicapLevel handicap, std::shared_ptr< GE::GERenderInfo > ri) | |
virtual void | saveTransform () OVERRIDE |
This function is called immediately before a rewind is done and saves the current transform for the kart. | |
virtual void | computeError () OVERRIDE |
Called when a rewind is finished, and is used to compute the error caused by the rewind (which is then visually smoothed over time). | |
virtual BareNetworkString * | saveState (std::vector< std::string > *ru) OVERRIDE |
Saves all state information for a kart in a memory buffer. | |
void | reset () OVERRIDE |
Resets status in case of a resetart. | |
virtual void | restoreState (BareNetworkString *p, int count) OVERRIDE |
Actually rewind to the specified state. | |
virtual void | rewindToEvent (BareNetworkString *p) OVERRIDE |
Called when an event needs to be replayed. | |
virtual void | update (int ticks) OVERRIDE |
Called once a frame. | |
virtual float | getSteerPercent () const OVERRIDE |
Returns the current steering value for this kart. | |
virtual void | updateGraphics (float dt) OVERRIDE |
Updates the graphics model. | |
virtual void | undoState (BareNetworkString *p) OVERRIDE |
Undo the effects of the given state, but do not rewind to that state (which is done by rewindTo). | |
virtual void | undoEvent (BareNetworkString *p) OVERRIDE |
Called when an event needs to be undone. | |
virtual std::function< void()> | getLocalStateRestoreFunction () OVERRIDE |
Public Member Functions inherited from Rewinder | |
Rewinder (const std::string &ui="") | |
virtual void | saveTransform ()=0 |
Called before a rewind. | |
virtual void | computeError ()=0 |
Called when a rewind is finished, and is used to compute the error caused by the rewind (which is then visually smoothed over time). | |
virtual BareNetworkString * | saveState (std::vector< std::string > *ru)=0 |
Provides a copy of the state of the object in one memory buffer. | |
virtual void | undoEvent (BareNetworkString *buffer)=0 |
Called when an event needs to be undone. | |
virtual void | rewindToEvent (BareNetworkString *buffer)=0 |
Called when an event needs to be replayed. | |
virtual void | restoreState (BareNetworkString *buffer, int count)=0 |
Called when a state needs to be replayed. | |
virtual void | undoState (BareNetworkString *buffer)=0 |
Undo the effects of the given state, but do not rewind to that state (which is done by rewindTo). | |
virtual void | reset () |
Nothing to do here. | |
virtual std::function< void()> | getLocalStateRestoreFunction () |
const std::string & | getUniqueIdentity () const |
bool | rewinderAdd () |
Add this object to the list of all rewindable objects in the rewind manager. | |
template<typename T > | |
std::shared_ptr< T > | getShared () |
Public Member Functions inherited from Kart | |
Kart (const std::string &ident, unsigned int world_kart_id, int position, const btTransform &init_transform, HandicapLevel handicap, std::shared_ptr< GE::GERenderInfo > ri) | |
The kart constructor. | |
virtual | ~Kart () |
The destructor frees the memory of this kart, but note that the actual kart model is still stored in the kart_properties (m_kart_model variable), so it is not reloaded). | |
virtual void | init (RaceManager::KartType type) OVERRIDE |
This is a second initialisation phase, necessary since in the constructor virtual functions are not called for any superclasses. | |
virtual void | kartIsInRestNow () OVERRIDE |
Computes the transform of the graphical kart chasses with regards to the physical chassis. | |
virtual void | updateGraphics (float dt) OVERRIDE |
Updates the graphics model. | |
virtual void | createPhysics () |
Creates the physical representation of this kart. | |
virtual bool | isInRest () const OVERRIDE |
Returns true if the kart is 'resting', i.e. | |
virtual void | applyEngineForce (float force) |
Applies engine power to all the wheels that are traction capable, so other parts of code do not have to be adjusted to simulate different kinds of vehicles in the general case, only if they are trying to simulate traction control, diferentials or multiple independent electric engines, they will have to tweak the power in a per wheel basis. | |
virtual void | flyUp () OVERRIDE |
Enter flying mode. | |
virtual void | flyDown () OVERRIDE |
virtual void | startEngineSFX () OVERRIDE |
Starts the engine sound effect. | |
virtual void | collectedItem (ItemState *item) OVERRIDE |
Called when an item is collected. | |
virtual float | getStartupBoostFromStartTicks (int ticks) const OVERRIDE |
Called the first time a kart accelerates after 'ready'. | |
virtual float | getStartupBoost () const OVERRIDE |
virtual void | setStartupBoost (float val) OVERRIDE |
virtual const Material * | getMaterial () const OVERRIDE |
Returns the current material the kart is on. | |
virtual const Material * | getLastMaterial () const OVERRIDE |
Returns the previous material the kart was one (which might be the same as getMaterial() ). | |
virtual float | getTerrainPitch (float heading) const OVERRIDE |
Returns the pitch of the terrain depending on the heading. | |
virtual void | reset () OVERRIDE |
Reset before a new race. | |
virtual void | handleZipper (const Material *m=NULL, bool play_sound=false) OVERRIDE |
Sets zipper time, and apply one time additional speed boost. | |
virtual bool | setSquash (float time, float slowdown) OVERRIDE |
Squashes this kart: it will scale the kart in up direction, and causes a slowdown while this kart is squashed. | |
void | setSquashGraphics () |
virtual void | unsetSquash () OVERRIDE |
Makes the kart unsquashed again. | |
virtual void | crashed (AbstractKart *k, bool update_attachments) OVERRIDE |
Called when the kart crashes against another kart. | |
virtual void | crashed (const Material *m, const Vec3 &normal) OVERRIDE |
Kart hits the track with a given material. | |
virtual float | getHoT () const OVERRIDE |
Returns the height of the terrain. | |
virtual void | update (int ticks) OVERRIDE |
Updates the kart in each time step. | |
virtual void | finishedRace (float time, bool from_server=false) OVERRIDE |
Sets that this kart has finished the race and finishing time. | |
virtual void | setPosition (int p) OVERRIDE |
Sets the position in race this kart has . | |
virtual void | beep () OVERRIDE |
Plays a beep sfx. | |
virtual void | showZipperFire () OVERRIDE |
Show fire to go with a zipper. | |
virtual bool | playCustomSFX (unsigned int type) OVERRIDE |
This function will play a particular character voice for this kart. | |
virtual void | setController (Controller *controller) OVERRIDE |
Saves the old controller in m_saved_controller and stores a new controller. | |
virtual void | setXYZ (const Vec3 &a) OVERRIDE |
Sets the XYZ coordinates of the moveable. | |
virtual void | changeKart (const std::string &new_ident, HandicapLevel handicap, std::shared_ptr< GE::GERenderInfo > ri, const KartData &kart_data=KartData()) OVERRIDE |
Change to new kart instancely (used in network live join). | |
virtual void | adjustSpeed (float f) OVERRIDE |
Multiplies the velocity of the kart by a factor f (both linear and angular). | |
virtual void | increaseMaxSpeed (unsigned int category, float add_speed, float engine_force, int duration, int fade_out_time) OVERRIDE |
Sets an increased maximum speed for a category. | |
virtual void | instantSpeedIncrease (unsigned int category, float add_max_speed, float speed_boost, float engine_force, int duration, int fade_out_time) OVERRIDE |
This adjusts the top speed using increaseMaxSpeed, but additionally causes an instant speed boost, which can be smaller than add-max-speed. | |
virtual void | setSlowdown (unsigned int category, float max_speed_fraction, int fade_in_time) OVERRIDE |
Defines a slowdown, which is in fraction of top speed. | |
virtual int | getSpeedIncreaseTicksLeft (unsigned int category) const OVERRIDE |
Returns how much increased speed time is left over in the given category. | |
virtual float | getSpeed () const OVERRIDE |
Returns the speed of the kart in meters/second. | |
virtual float | getCurrentMaxSpeed () const OVERRIDE |
Returns the current maximum speed for this kart, this includes all bonus and maluses that are currently applied. | |
virtual void | setSpeed (float s) OVERRIDE |
This is used on the client side only to set the speed of the kart from the server information. | |
virtual float | getMaxSteerAngle () const OVERRIDE |
Returns the maximum steering angle for this kart, which depends on the speed. | |
virtual float | getTimeFullSteer (float steer) const OVERRIDE |
Returns the time till full steering is reached for this kart. | |
virtual float | getSpeedForTurnRadius (float radius) const OVERRIDE |
Returns the (maximum) speed for a given turn radius. | |
virtual float | getMaxSteerAngle (float speed) const |
Returns the maximum steering angle (depending on speed). | |
virtual const Skidding * | getSkidding () const OVERRIDE |
Returns the skidding object for this kart (which can be used to query skidding related values). | |
virtual Skidding * | getSkidding () OVERRIDE |
Returns the skidding object for this kart (which can be used to query skidding related values) - non-const. | |
virtual float | getEnergy () const OVERRIDE |
Returns the remaining collected energy. | |
virtual void | setEnergy (float val) OVERRIDE |
Sets the energy the kart has collected. | |
virtual bool | isOnMinNitroTime () const OVERRIDE |
Return whether nitro is being used despite the nitro button not being pressed due to minimal use time requirements. | |
virtual void | setPowerup (PowerupManager::PowerupType t, int n) OVERRIDE |
Sets a new powerup. | |
virtual void | setLastUsedPowerup (PowerupManager::PowerupType t) |
Sets the last used powerup. | |
virtual const Powerup * | getPowerup () const OVERRIDE |
Returns the current powerup. | |
virtual Powerup * | getPowerup () OVERRIDE |
Returns the current powerup. | |
virtual PowerupManager::PowerupType | getLastUsedPowerup () OVERRIDE |
Returns the last used powerup. | |
virtual int | getNumPowerup () const OVERRIDE |
Returns the number of powerups. | |
virtual void | setInvulnerableTicks (int ticks) OVERRIDE |
Makes a kart invulnerable for a certain amount of time. | |
virtual bool | isInvulnerable () const OVERRIDE |
Returns if the kart is invulnerable. | |
virtual int | getBlockedByPlungerTicks () const OVERRIDE |
Returns true if the kart has a plunger attached to its face. | |
virtual void | blockViewWithPlunger () OVERRIDE |
Sets the view to blocked by a plunger. | |
virtual void | setShieldTime (float t) OVERRIDE |
Enables a kart shield protection for a certain amount of time. | |
virtual bool | isShielded () const OVERRIDE |
Returns if the kart is protected by a shield. | |
virtual float | getShieldTime () const OVERRIDE |
Returns the remaining time the kart is protected by a shield. | |
virtual void | decreaseShieldTime () OVERRIDE |
Decreases the kart's shield time. | |
virtual bool | isSquashed () const OVERRIDE |
Returns if the kart is currently being squashed. | |
virtual void | setBoostAI (bool boosted) OVERRIDE |
Sets the kart AI boost state. | |
virtual bool | getBoostAI () const OVERRIDE |
Returns the kart AI boost state. | |
virtual Controller * | getController () OVERRIDE |
Returns the controller of this kart. | |
const Controller * | getController () const OVERRIDE |
Returns the controller of this kart (const version). | |
virtual const Vec3 & | getFrontXYZ () const OVERRIDE |
Returns the coordinates of the front of the kart. | |
virtual btTransform | getAlignedTransform (const float customPitch=-1) OVERRIDE |
Returns a bullet transform object located at the kart's position and oriented in the direction the kart is going. | |
const btTransform & | getResetTransform () const |
Returns the start transform, i.e. | |
virtual bool | isOnGround () const OVERRIDE |
True if the wheels are touching the ground. | |
bool | isNearGround () const |
Returns true if the kart is close to the ground, used to dis/enable the upright constraint to allow for more realistic explosions. | |
virtual const Vec3 & | getNormal () const OVERRIDE |
Returns the normal of the terrain the kart is over atm. | |
virtual const Vec3 & | getPreviousXYZ () const OVERRIDE |
Returns the position 0.25s before. | |
virtual const Vec3 & | getRecentPreviousXYZ () const OVERRIDE |
Returns a more recent different previous position. | |
virtual const float | getRecentPreviousXYZTime () const OVERRIDE |
Returns the time at which the recent previous position occured. | |
bool | isFlying () const |
For debugging only: check if a kart is flying. | |
virtual bool | isJumping () const OVERRIDE |
Returns whether this kart is jumping. | |
virtual const TerrainInfo * | getTerrainInfo () const OVERRIDE |
Returns the terrain info oject. | |
virtual KartGFX * | getKartGFX () OVERRIDE |
Returns a pointer to this kart's graphical effects. | |
virtual int | getPosition () const OVERRIDE |
Returns the current position of this kart in the race. | |
virtual int | getInitialPosition () const OVERRIDE |
Returns the initial position of this kart. | |
virtual float | getFinishTime () const OVERRIDE |
Returns the finished time for a kart. | |
virtual bool | hasFinishedRace () const OVERRIDE |
Returns true if this kart has finished the race. | |
const irr::video::SColor & | getColor () const |
Returns the color used for this kart. | |
virtual RaceManager::KartType | getType () const OVERRIDE |
virtual btKart * | getVehicle () const OVERRIDE |
Returns the bullet vehicle which represents this kart. | |
virtual btQuaternion | getVisualRotation () const OVERRIDE |
virtual const SlipStream * | getSlipstream () const OVERRIDE |
Returns the slipstream object of this kart. | |
virtual SlipStream * | getSlipstream () OVERRIDE |
Returns the slipstream object of this kart. | |
virtual void | setSlipstreamEffect (float f) OVERRIDE |
Activates a slipstream effect, atm that is display some nitro. | |
virtual bool | isEliminated () const OVERRIDE |
Returns true if the kart is eliminated. | |
virtual void | eliminate () OVERRIDE |
Marks this kart to be eliminated. | |
virtual void | setOnScreenText (const core::stringw &text) OVERRIDE |
Sets a text that is being displayed on top of a kart. | |
virtual bool | getRaceResult () const OVERRIDE |
Returns whether this kart wins or loses. | |
void | setRaceResult () |
Set this kart race result. | |
virtual bool | isGhostKart () const OVERRIDE |
Returns whether this kart is a ghost (replay) kart. | |
SFXBase * | getNextEmitter () |
virtual void | playSound (SFXBuffer *buffer) OVERRIDE |
virtual bool | isVisible () const OVERRIDE |
virtual void | showStarEffect (float t) OVERRIDE |
Shows the star effect for a certain time. | |
virtual Stars * | getStarsEffect () const OVERRIDE |
int | getNetworkConfirmedFinishTicks () const OVERRIDE |
Return the confirmed finish ticks (sent by the server) indicating that this kart has really finished the race. | |
Public Member Functions inherited from AbstractKart | |
AbstractKart (const std::string &ident, int world_kart_id, int position, const btTransform &init_transform, HandicapLevel handicap, std::shared_ptr< GE::GERenderInfo > ri) | |
Creates a kart. | |
const core::stringw & | getName () const |
Returns a name to be displayed for this kart. | |
virtual void | reset () |
The reset position must be set before calling reset. | |
virtual void | init (RaceManager::KartType type)=0 |
virtual float | getSteerPercent () const |
Returns the current steering value for this kart. | |
KartControl & | getControls () |
Returns all controls of this kart. | |
const KartControl & | getControls () const |
Returns all controls of this kart - const version. | |
const KartProperties * | getKartProperties () const |
Returns the kart properties of this kart. | |
virtual void | changeKart (const std::string &new_ident, HandicapLevel handicap, std::shared_ptr< GE::GERenderInfo > ri, const KartData &kart_data=KartData()) |
Change to new kart instancely (used in network live join). | |
const HandicapLevel | getHandicap () const |
Returns the handicap of this kart. | |
void | setHandicap (const HandicapLevel h) |
Sets the handicap. | |
virtual const std::string & | getIdent () const |
Returns a unique identifier for this kart (name of the directory the kart was loaded from). | |
virtual float | getMaxSteerAngle () const =0 |
Returns the maximum steering angle for this kart, which depends on the speed. | |
virtual float | getSpeedForTurnRadius (float radius) const =0 |
Returns the (maximum) speed for a given turn radius. | |
virtual float | getTimeFullSteer (float steer) const =0 |
Returns the time till full steering is reached for this kart. | |
const Attachment * | getAttachment () const |
Returns the current attachment. | |
Attachment * | getAttachment () |
Returns the current attachment, non-const version. | |
KartModel * | getKartModel () const |
Returns this kart's kart model. | |
float | getKartLength () const |
Returns the length of the kart. | |
float | getKartHeight () const |
Returns the height of the kart. | |
float | getKartWidth () const |
Returns the width of the kart. | |
float | getHighestPoint () const |
Returns the highest point of the kart (coordinate on up axis) | |
virtual void | kartIsInRestNow () |
Called after the kart comes to rest. | |
virtual float | getTimeForDistance (float distance) |
Returns the time at which the kart was at a given distance. | |
bool | isWheeless () const |
Returns true if this kart has no wheels. | |
virtual const Vec3 & | getFrontXYZ () const =0 |
Returns the coordinates of the front of the kart. | |
const Vec3 & | getWheelGraphicsPosition (int i) const |
Returns the position of a wheel relative to the kart. | |
AbstractKartAnimation * | getKartAnimation () |
Returns a kart animation (if any), or NULL if currently no kart animation is being shown. | |
const AbstractKartAnimation * | getKartAnimation () const |
virtual void | setKartAnimation (AbstractKartAnimation *ka) |
Sets a new kart animation. | |
unsigned int | getWorldKartId () const |
Returns the index of this kart in world. | |
virtual void | setController (Controller *controller)=0 |
Saves the old controller in m_saved_controller and stores a new controller. | |
virtual Controller * | getController ()=0 |
Returns the controller of this kart. | |
virtual const Controller * | getController () const =0 |
Returns the controller of this kart (const version). | |
virtual const Skidding * | getSkidding () const =0 |
Returns the skidding object for this kart (which can be used to query skidding related values). | |
virtual RaceManager::KartType | getType () const =0 |
virtual Skidding * | getSkidding ()=0 |
Returns the skidding object for this kart (which can be used to query skidding related values), non-const. | |
virtual bool | isEliminated () const =0 |
Returns true if the kart is eliminated. | |
virtual void | eliminate ()=0 |
Marks this kart to be eliminated. | |
virtual void | finishedRace (float time, bool from_server=false)=0 |
virtual float | getFinishTime () const =0 |
Returns the finished time for a kart. | |
virtual int | getBlockedByPlungerTicks () const =0 |
Returns true if the kart has a plunger attached to its face. | |
virtual void | blockViewWithPlunger ()=0 |
Sets that the view is blocked by a plunger. | |
virtual bool | isSquashed () const =0 |
Returns if the kart is currently being squashed. | |
virtual bool | setSquash (float time, float slowdown)=0 |
Squashes this kart: it will scale the kart in up direction, and causes a slowdown while this kart is squashed. | |
virtual void | unsetSquash ()=0 |
Makes the kart unsquashed again. | |
virtual float | getSpeed () const =0 |
Returns the speed of the kart in meters/second. | |
virtual float | getCurrentMaxSpeed () const =0 |
Returns the current maximum speed for this kart, this includes all bonus and maluses that are currently applied. | |
virtual int | getSpeedIncreaseTicksLeft (unsigned int category) const =0 |
Returns how much increased speed time is left over in the given category. | |
virtual void | setBoostAI (bool boosted)=0 |
Sets the kart AI boost state. | |
virtual bool | getBoostAI () const =0 |
Returns the kart AI boost state. | |
virtual void | increaseMaxSpeed (unsigned int category, float add_speed, float engine_force, int duration, int fade_out_time)=0 |
Sets an increased maximum speed for a category. | |
virtual void | instantSpeedIncrease (unsigned int category, float add_max_speed, float speed_boost, float engine_force, int duration, int fade_out_time)=0 |
This adjusts the top speed using increaseMaxSpeed, but additionally causes an instant speed boost, which can be smaller than add-max-speed. | |
virtual void | setSlowdown (unsigned int category, float max_speed_fraction, int fade_in_time)=0 |
Defines a slowdown, which is in fraction of top speed. | |
virtual float | getEnergy () const =0 |
Returns the remaining collected energy. | |
virtual void | collectedItem (ItemState *item_state)=0 |
Called when an item is collected. | |
virtual int | getPosition () const =0 |
Returns the current position of this kart in the race. | |
virtual void | setPosition (int p)=0 |
Returns the current position of this kart in the race. | |
virtual int | getInitialPosition () const =0 |
Returns the initial position of this kart. | |
virtual bool | isOnGround () const =0 |
True if the wheels are touching the ground. | |
virtual const SlipStream * | getSlipstream () const =0 |
Returns the slipstream object of this kart. | |
virtual SlipStream * | getSlipstream ()=0 |
Returns the slipstream object of this kart. | |
virtual void | setSlipstreamEffect (float f)=0 |
Activates a slipstream effect, atm that is display some nitro. | |
virtual void | beep ()=0 |
Plays a beep sfx. | |
virtual bool | playCustomSFX (unsigned int type)=0 |
This function will play a particular character voice for this kart. | |
virtual void | showZipperFire ()=0 |
Show fire to go with a zipper. | |
virtual void | handleZipper (const Material *m=NULL, bool play_sound=false)=0 |
Sets zipper time, and apply one time additional speed boost. | |
virtual bool | hasFinishedRace () const =0 |
Returns true if this kart has finished the race. | |
virtual void | setEnergy (float val)=0 |
virtual bool | isOnMinNitroTime () const =0 |
Return whether nitro is being used despite the nitro button not being pressed due to minimal use time requirements. | |
virtual const Material * | getMaterial () const =0 |
Returns the current material the kart is on. | |
virtual const Material * | getLastMaterial () const =0 |
Returns the previous material the kart was one (which might be the same as getMaterial() ). | |
virtual const Powerup * | getPowerup () const =0 |
Returns the current powerup. | |
virtual Powerup * | getPowerup ()=0 |
Returns the current powerup. | |
virtual PowerupManager::PowerupType | getLastUsedPowerup ()=0 |
Returns the last used powerup type. | |
virtual int | getNumPowerup () const =0 |
Returns the number of powerups. | |
virtual KartGFX * | getKartGFX ()=0 |
Returns a points to this kart's graphical effects. | |
virtual void | setPowerup (PowerupManager::PowerupType t, int n)=0 |
virtual btKart * | getVehicle () const =0 |
Returns the bullet vehicle which represents this kart. | |
virtual btQuaternion | getVisualRotation () const =0 |
virtual bool | isInRest () const =0 |
Returns true if the kart is 'resting', i.e. | |
virtual void | startEngineSFX ()=0 |
Starts the engine sound effect. | |
virtual void | adjustSpeed (float f)=0 |
Multiplies the velocity of the kart by a factor f (both linear and angular). | |
virtual void | setSpeed (float s)=0 |
This is used on the client side only to set the speed of the kart from the server information. | |
virtual bool | isInvulnerable () const =0 |
Returns if the kart is invulnerable. | |
virtual void | setInvulnerableTicks (int ticks)=0 |
virtual bool | isShielded () const =0 |
Returns if the kart is protected by a shield. | |
virtual void | setShieldTime (float t)=0 |
virtual float | getShieldTime () const =0 |
virtual void | decreaseShieldTime ()=0 |
Decreases the kart's shield time. | |
virtual void | showStarEffect (float t)=0 |
Shows the star effect for a certain time. | |
virtual const TerrainInfo * | getTerrainInfo () const =0 |
Returns the terrain info oject. | |
virtual void | crashed (AbstractKart *k, bool update_attachments)=0 |
Called when the kart crashes against another kart. | |
virtual void | crashed (const Material *m, const Vec3 &normal)=0 |
virtual const Vec3 & | getNormal () const =0 |
Returns the normal of the terrain the kart is over atm. | |
virtual const Vec3 & | getPreviousXYZ () const =0 |
Returns the position 0.25s before. | |
virtual const Vec3 & | getRecentPreviousXYZ () const =0 |
Returns the most recent different previous position. | |
virtual const float | getRecentPreviousXYZTime () const =0 |
Returns the time at which the recent previous position occured. | |
virtual float | getHoT () const =0 |
Returns the height of the terrain. | |
virtual float | getTerrainPitch (float heading) const =0 |
Returns the pitch of the terrain depending on the heading. | |
virtual btTransform | getAlignedTransform (const float customPitch=-1)=0 |
Returns a bullet transform object located at the kart's position and oriented in the direction the kart is going. | |
virtual void | setOnScreenText (const core::stringw &text)=0 |
Set a text that is displayed on top of a kart. | |
virtual bool | getRaceResult () const =0 |
Returns whether this kart wins or loses. | |
virtual bool | isGhostKart () const =0 |
Returns whether this kart is a ghost (replay) kart. | |
virtual bool | isJumping () const =0 |
Returns whether this kart is jumping. | |
virtual void | playSound (SFXBuffer *buffer)=0 |
virtual bool | isVisible () const =0 |
virtual void | makeKartRest () |
Called before go phase to make sure all karts start at the same position in case there is a slope. | |
virtual void | setStartupBoost (float val)=0 |
virtual float | getStartupBoost () const =0 |
virtual float | getStartupBoostFromStartTicks (int ticks) const =0 |
virtual Stars * | getStarsEffect () const =0 |
int | getLiveJoinUntilTicks () const |
void | setLiveJoinKart (int util_ticks) |
virtual int | getNetworkConfirmedFinishTicks () const =0 |
Return the confirmed finish ticks (sent by the server) indicating that this kart has really finished the race. | |
Public Member Functions inherited from Moveable | |
scene::ISceneNode * | getNode () const |
Returns the scene node of this moveable. | |
void | setNode (scene::ISceneNode *n) |
Sets the mesh for this model. | |
virtual const btVector3 & | getVelocity () const |
const btVector3 & | getVelocityLC () const |
virtual void | setVelocity (const btVector3 &v) |
const Vec3 & | getXYZ () const |
float | getHeading () const |
Returns the heading between -pi and pi. | |
float | getPitch () const |
Returns the pitch of the kart, restricted to between -pi/2 and pi/2. | |
float | getRoll () const |
Returns the roll of the kart between -pi and pi. | |
const btQuaternion | getRotation () const |
virtual void | flyUp () |
Enter flying mode. | |
virtual void | flyDown () |
virtual void | stopFlying () |
virtual void | setXYZ (const Vec3 &a) |
Sets the XYZ coordinates of the moveable. | |
void | setRotation (const btMatrix3x3 &m) |
Sets the rotation of the physical body this moveable. | |
void | setRotation (const btQuaternion &q) |
Sets the rotation of the physical body this moveable. | |
virtual void | reset () |
The reset position must be set before calling reset. | |
virtual void | update (int ticks) |
Updates the current position and rotation from the corresponding physics body, and then calls updateGraphics to position the model correctly. | |
btRigidBody * | getBody () const |
void | createBody (float mass, btTransform &trans, btCollisionShape *shape, float restitution) |
Creates the bullet rigid body for this moveable. | |
const btTransform & | getTrans () const |
void | setTrans (const btTransform &t) |
Places this moveable at a certain location and stores this transform in this Moveable, so that it can be accessed easily. | |
void | updatePosition () |
Updates the current position and rotation. | |
virtual void | updateGraphics (float dt)=0 |
Called once per rendered frame. | |
void | prepareSmoothing () |
void | checkSmoothing () |
const btTransform & | getSmoothedTrans () const |
const Vec3 & | getSmoothedXYZ () const |
virtual const std::string & | getIdent () const |
Public Member Functions inherited from SmoothNetworkBody | |
SmoothNetworkBody (bool enable=false) | |
void | reset () |
void | setEnable (bool val) |
bool | isEnabled () const |
void | setSmoothRotation (bool val) |
void | setAdjustVerticalOffset (bool val) |
void | prepareSmoothing (const btTransform ¤t_transform, const Vec3 ¤t_velocity) |
void | checkSmoothing (const btTransform ¤t_transform, const Vec3 ¤t_velocity) |
Adds a new error between graphical and physical position/rotation. | |
void | updateSmoothedGraphics (const btTransform ¤t_transform, const Vec3 ¤t_velocity, float dt) |
void | setSmoothedTransform (const btTransform &t) |
const btTransform & | getSmoothedTrans () const |
const Vec3 & | getSmoothedXYZ () const |
void | setMinAdjustLength (float val) |
void | setMaxAdjustLength (float val) |
void | setMinAdjustSpeed (float val) |
void | setMaxAdjustTime (float val) |
void | setAdjustLengthThreshold (float val) |
Private Attributes | |
float | m_prev_steering |
float | m_steering_smoothing_dt |
float | m_steering_smoothing_time |
bool | m_has_server_state |
Additional Inherited Members | |
Protected Member Functions inherited from Rewinder | |
void | setUniqueIdentity (const std::string &uid) |
Protected Member Functions inherited from Kart | |
void | updatePhysics (int ticks) |
Updates the physics for this kart: computing the driving force, set steering, handles skidding, terrain impact on kart, ... | |
void | handleMaterialSFX () |
Plays any terrain specific sound effect. | |
void | handleMaterialGFX (float dt) |
Handles material specific GFX, mostly particle effects. | |
void | updateFlying () |
Adjusts kart translation if the kart is flying (in debug mode). | |
void | updateSliding () |
Handles sliding, i.e. | |
void | updateEnginePowerAndBrakes (int ticks) |
Sets the engine power. | |
void | updateEngineSFX (float dt) |
Adjust the engine sound effect depending on the speed of the kart. | |
void | updateSpeed () |
Updates the local speed based on the current physical velocity. | |
void | updateNitro (int ticks) |
Updates the current nitro status. | |
float | applyAirFriction (float engine_power) |
Reduces the engine power according to speed. | |
float | getActualWheelForce () |
Simulates gears by adjusting the force of the engine. | |
void | playCrashSFX (const Material *m, AbstractKart *k) |
Common code used when a kart or a material was hit. | |
void | loadData (RaceManager::KartType type, bool animatedModel) |
Attaches the right model, creates the physics and loads all special effects (particle systems etc.) | |
void | updateWeight () |
This method is to be called every time the mass of the kart is updated, which includes attaching an anvil to the kart (and detaching). | |
void | initSound () |
Protected Member Functions inherited from Moveable | |
void | updateSmoothedGraphics (float dt) |
virtual void | updateGraphics (const Vec3 &off_xyz=Vec3(0.0f, 0.0f, 0.0f), const btQuaternion &off_rotation=btQuaternion(0.0f, 0.0f, 0.0f, 1.0f)) |
Updates the graphics model. | |
Protected Attributes inherited from Kart | |
float | m_graphical_y_offset |
Offset of the graphical kart chassis from the physical chassis. | |
Vec3 | m_xyz_front |
The coordinates of the front of the kart, used to determine when a new lap is triggered. | |
const float | XYZ_HISTORY_TIME = 0.25f |
int | m_xyz_history_size |
std::vector< Vec3 > | m_previous_xyz |
The coordinates of the XYZ_HISTORY_SIZE previous positions. | |
std::vector< float > | m_previous_xyz_times |
The times at which the previous positions occured. | |
float | m_time_previous_counter |
bool | m_is_jumping |
Is time flying activated. | |
bool | m_bubblegum_torque_sign |
The sign of torque to apply after hitting a bubble gum. | |
uint8_t | m_bounce_back_ticks |
A short time after a collision acceleration is disabled to allow the karts to bounce back. | |
MaxSpeed * | m_max_speed |
Handles speed increase and capping due to powerup, terrain, ... | |
TerrainInfo * | m_terrain_info |
Stores information about the terrain the kart is on. | |
Powerup * | m_powerup |
Handles the powerup of a kart. | |
std::unique_ptr< btVehicleRaycaster > | m_vehicle_raycaster |
std::unique_ptr< btKart > | m_vehicle |
std::unique_ptr< Skidding > | m_skidding |
This object handles all skidding. | |
std::unique_ptr< Stars > | m_stars_effect |
For stars rotating around head effect. | |
std::unique_ptr< Shadow > | m_shadow |
The shadow of a kart. | |
std::unique_ptr< SkidMarks > | m_skidmarks |
The skidmarks object for this kart. | |
std::unique_ptr< KartGFX > | m_kart_gfx |
All particle effects. | |
std::unique_ptr< SlipStream > | m_slipstream |
Handles all slipstreaming. | |
std::unique_ptr< btCompoundShape, btCompoundShapeDeleter > | m_kart_chassis |
ParticleEmitter * | m_collision_particles |
For collisions. | |
Controller * | m_controller |
The main controller of this object, used for driving. | |
Controller * | m_saved_controller |
This saves the original controller when the end controller is used. | |
PowerupManager::PowerupType | m_last_used_powerup |
Remember the last used powerup type of a kart for AI purposes. | |
bool | m_flying |
True if kart is flying (for debug purposes only). | |
bool | m_has_caught_nolok_bubblegum |
Set when hitting bubblegum. | |
bool | m_race_result |
True if the kart wins, false otherwise. | |
bool | m_eliminated |
True if the kart is eliminated. | |
int | m_initial_position |
Initial rank of the kart. | |
int | m_race_position |
Current race position (1-num_karts). | |
float | m_max_gear_rpm |
Maximum engine rpm's for the current gear. | |
int | m_brake_ticks |
How long the brake key has been pressed - the longer the harder the kart will brake. | |
int16_t | m_invulnerable_ticks |
Time a kart is invulnerable. | |
int16_t | m_bubblegum_ticks |
If > 0 then bubble gum effect is on. | |
int16_t | m_view_blocked_by_plunger |
When a kart has its view blocked by the plunger, this variable will be
| |
float | m_current_lean |
Current leaning of the kart. | |
int8_t | m_min_nitro_ticks |
To prevent using nitro in too short bursts. | |
bool | m_fire_clicked |
True if fire button was pushed and not released. | |
bool | m_boosted_ai |
True if the kart has been selected to have a boosted ai. | |
bool | m_finished_race |
float | m_finish_time |
float | m_collected_energy |
The amount of energy collected with nitro cans. | |
float | m_consumption_per_tick |
float | m_energy_to_min_ratio |
float | m_startup_boost |
float | m_falling_time |
float | m_weight |
float | m_speed |
The current speed (i.e. | |
float | m_last_factor_engine_sound |
For smoothing engine sound. | |
float | m_default_suspension_force |
For changeKart. | |
btTransform | m_reset_transform |
Reset position. | |
std::vector< SFXBase * > | m_custom_sounds |
int | m_emitter_id = 0 |
SFXBase * | m_emitters [EMITTER_COUNT] |
SFXBase * | m_engine_sound |
SFXBase * | m_terrain_sound |
Sound to be played depending on terrain. | |
const Material * | m_last_sound_material |
The material for which the last sound effect was played. | |
SFXBase * | m_nitro_sound |
SFXBase * | m_previous_terrain_sound |
A pointer to the previous terrain sound needs to be saved so that an 'older' sfx can be finished and an abrupt end of the sfx is avoided. | |
SFXBase * | m_skid_sound |
SFXBuffer * | m_horn_sound |
SFXBuffer * | m_crash_sounds [CRASH_SOUND_COUNT] |
SFXBuffer * | m_goo_sound |
SFXBuffer * | m_boing_sound |
int | m_ticks_last_crash |
int | m_ticks_last_zipper |
RaceManager::KartType | m_type |
Protected Attributes inherited from AbstractKart | |
btTransform | m_starting_transform |
int | m_live_join_util |
std::unique_ptr< KartProperties > | m_kart_properties |
The kart properties. | |
HandicapLevel | m_handicap |
The handicap level of this kart. | |
std::unique_ptr< KartModel > | m_kart_model |
This stores a copy of the kart model. | |
std::unique_ptr< Attachment > | m_attachment |
Handles the attachment the kart might have. | |
KartControl | m_controls |
The kart controls (e.g. | |
AbstractKartAnimation * | m_kart_animation |
A kart animation object to handle rescue, explosion etc. | |
irr::scene::IDummyTransformationSceneNode * | m_wheel_box |
Node between wheels and kart. | |
Protected Attributes inherited from Moveable | |
btTransform | m_transform |
The bullet transform of this rigid body. | |
UserPointer | m_user_pointer |
scene::ISceneNode * | m_node |
std::unique_ptr< btRigidBody > | m_body |
std::unique_ptr< KartMotionState > | m_motion_state |
Static Protected Attributes inherited from Kart | |
static const int | EMITTER_COUNT = 3 |
static const int | CRASH_SOUND_COUNT = 3 |
|
virtual |
Called when a rewind is finished, and is used to compute the error caused by the rewind (which is then visually smoothed over time).
Implements Rewinder.
|
virtual |
Reimplemented from Rewinder.
|
inlinevirtual |
Returns the current steering value for this kart.
Reimplemented from AbstractKart.
|
virtual |
Resets status in case of a resetart.
Reimplemented from Kart.
|
virtual |
Actually rewind to the specified state.
buffer | The buffer with the state info. |
count | Number of bytes that must be used up in this function (not used). |
Implements Rewinder.
|
inlinevirtual |
Called when an event needs to be replayed.
This is called during rewind, i.e. when going forward in time again.
Implements Rewinder.
|
virtual |
Saves all state information for a kart in a memory buffer.
The memory is allocated here and the address returned. It will then be managed by the RewindManager.
[out] | ru | The unique identity of rewinder writing to. |
Implements Rewinder.
|
virtual |
This function is called immediately before a rewind is done and saves the current transform for the kart.
The difference between this saved transform and the new transform after rewind is the error that needs (smoothly) be applied to the graphical position of the kart.
Implements Rewinder.
|
inlinevirtual |
Called when an event needs to be undone.
This is called while going backwards for rewinding - all stored events will get an 'undo' call.
Implements Rewinder.
|
inlinevirtual |
Undo the effects of the given state, but do not rewind to that state (which is done by rewindTo).
This is called while going backwards for rewinding - all stored events will get an 'undo' call.
Implements Rewinder.
|
virtual |
Called once a frame.
It will add a new kart control event to the rewind manager if any control values have changed.
Reimplemented from Kart.
|
inlinevirtual |
Updates the graphics model.
It is responsible for positioning the graphical chasses at an 'appropriate' position: typically, the physical model has much longer suspension, so if the graphical chassis would be at the same location as the physical chassis, the wheels would be too far away. Instead the default suspension length is saved once the kart have been settled at start up (see World::resetAllKarts, which just runs several physics-only simulation steps so that karts come to a rest). Then at race time, only the difference between the current suspension length and this default suspension length is used. The graphical kart chassis will be offset so that when the kart is in rest, i.e. suspension length == default suspension length, the kart will look the way it was modelled in blender. To explain the various offsets used, here a view from the side focusing on the Y axis only (X/Z position of the graphical chassis is identical to the physical chassis):
Y| | visual kart | physical kart
+----------—COG------------— | |
: |
| +------—low---— : | O : +-----------------------------------------------------------------------— X 'O' : visual wheel ':' : raycast from physics 'low' : lowest Y coordinate of COG : Center of gravity (at bottom of model chassis)
The visual kart is stored so that if it is shown at (0,0,0) it would be the same as in blender. This on the other hand means, if the kart is shown at the position of the physical chassis (which is at COG in the picture above), the kart and its wheels would be floating in the air (exactly by as much as the suspension length), and the wheels would be exactly at the bottom of the physical chassis (i.e. just on the plane going through COG and parallel to the ground). If we want to align the visual chassis to be the same as the physical chassis, we would need to subtract 'low' from the physical position. If the kart is then displayed at COG.y-low, the bottom of the kart (which is at 'low' above ground) would be at COG.y-low + low = COG.y --> visual and physical chassis are identical.
Unfortunately, the suspension length used in the physics is much too high, the karts would be way above their wheels, basically disconneccted (typical physical suspension length is around 0.28, while the distance between wheel and chassis in blender is in the order of 0.10 --> so there would be an additional distance of around 0.18 between wheel chassis as designed in blender and in stk - even more if the kart is driving downhill when the suspension extends further to keep contact with the ground). To make the visuals look closer to what they are in blender, an additional offset is added: before the start of a race the physics simulation is run to find a stable position for each kart (see World::resetAllKarts). Once a kart is stable, we save this suspension length in m_graphical_y_offset. This offset is subtracted from the COG of the kart. So if the kart is in rest (i.e. suspenion == default_suspension == m_graphical_y_offset), The kart is showen exactly at the same height above ground as it is in blender. If the suspension is shorter by DY (because the kart is accelerating, the ground goes up, ...), the visual chassis is lowered by DY as well.
While the above algorithm indeed results in the right position of the visual chassis, in reality the visual chassis is too low. For example, nolok's chassis has its lowest point at the rear at around 0.10 above the ground (and the lowest point overall is 0.05, though this is at the front and so not easily visible), so if the suspension is compressed by more than that, the chassiswill appear to be in the ground. Testing on the sand track shows that the suspension is compressed by 0.12 (and up to 0.16 in some extreme points), which means that the chassis will appear to be in the ground quite easily. Therefore the chassis is actually moved up a bit to avoid this problem. Historically (due to never sorting out that formula properly) the chassis was moved twice as high as its lowest point, e.g. nolok's lowest point is at 0.05, so the whole chassis was raised by 0.05 (this was not done by design, but because of a bug ;) ). Since this visual offset has worked well in the past, the visual chassis is moved by the same amount higher.
Of course this means that the Y position of the wheels (relative to the visual kart chassis) needs to be adjusted: if the kart is in rest, the wheels are exactly on the ground. If the suspension is shorter, that wheel would appear to be partly in the ground, and if the suspension is longer, the wheel would not touch the ground.
The wheels must be offset by how much the current suspension length is longer or shorter than the default (i.e. at rest) suspension length. This is done in KartModel (pos is the position of the wheel relative to the visual kart chassis): pos.Y += m_default_physics_suspension[i]
Reimplemented from Kart.