SuperTuxKart
Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
AbstractKart Class Referenceabstract

An abstract interface for the actual karts. More...

#include <abstract_kart.hpp>

Inheritance diagram for AbstractKart:
Inheritance graph
[legend]

Public Member Functions

 AbstractKart (const std::string &ident, int world_kart_id, int position, const btTransform &init_transform, HandicapLevel handicap, std::shared_ptr< RenderInfo > ri)
 Creates a kart. More...
 
const core::stringw & getName () const
 Returns a name to be displayed for this kart. More...
 
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. More...
 
KartControlgetControls ()
 Returns all controls of this kart. More...
 
const KartControlgetControls () const
 Returns all controls of this kart - const version. More...
 
const KartPropertiesgetKartProperties () const
 Returns the kart properties of this kart. More...
 
virtual void changeKart (const std::string &new_ident, HandicapLevel handicap, std::shared_ptr< RenderInfo > ri)
 Change to new kart instancely (used in network live join). More...
 
const HandicapLevel getHandicap () const
 Returns the handicap of this kart. More...
 
void setHandicap (const HandicapLevel h)
 Sets the handicap. More...
 
virtual const std::string & getIdent () const
 Returns a unique identifier for this kart (name of the directory the kart was loaded from). More...
 
virtual float getMaxSteerAngle () const =0
 Returns the maximum steering angle for this kart, which depends on the speed. More...
 
virtual float getSpeedForTurnRadius (float radius) const =0
 Returns the (maximum) speed for a given turn radius. More...
 
virtual float getTimeFullSteer (float steer) const =0
 Returns the time till full steering is reached for this kart. More...
 
const AttachmentgetAttachment () const
 Returns the current attachment. More...
 
AttachmentgetAttachment ()
 Returns the current attachment, non-const version. More...
 
KartModelgetKartModel () const
 Returns this kart's kart model. More...
 
float getKartLength () const
 Returns the length of the kart. More...
 
float getKartHeight () const
 Returns the height of the kart. More...
 
float getKartWidth () const
 Returns the width of the kart. More...
 
float getHighestPoint () const
 Returns the highest point of the kart (coordinate on up axis)
 
virtual void kartIsInRestNow ()
 Called after the kart comes to rest. More...
 
virtual float getTimeForDistance (float distance)
 Returns the time at which the kart was at a given distance. More...
 
bool isWheeless () const
 Returns true if this kart has no wheels. More...
 
virtual const Vec3getFrontXYZ () const =0
 Returns the coordinates of the front of the kart. More...
 
const Vec3getWheelGraphicsPosition (int i) const
 Returns the position of a wheel relative to the kart. More...
 
AbstractKartAnimationgetKartAnimation ()
 Returns a kart animation (if any), or NULL if currently no kart animation is being shown. More...
 
const AbstractKartAnimationgetKartAnimation () const
 
virtual void setKartAnimation (AbstractKartAnimation *ka)
 Sets a new kart animation. More...
 
unsigned int getWorldKartId () const
 Returns the index of this kart in world. More...
 
virtual void setController (Controller *controller)=0
 Saves the old controller in m_saved_controller and stores a new controller. More...
 
virtual ControllergetController ()=0
 Returns the controller of this kart. More...
 
virtual const ControllergetController () const =0
 Returns the controller of this kart (const version). More...
 
virtual const SkiddinggetSkidding () const =0
 Returns the skidding object for this kart (which can be used to query skidding related values). More...
 
virtual RaceManager::KartType getType () const =0
 
virtual SkiddinggetSkidding ()=0
 Returns the skidding object for this kart (which can be used to query skidding related values), non-const. More...
 
virtual bool isEliminated () const =0
 Returns true if the kart is eliminated. More...
 
virtual void eliminate ()=0
 Marks this kart to be eliminated. More...
 
virtual void finishedRace (float time, bool from_server=false)=0
 
virtual float getFinishTime () const =0
 Returns the finished time for a kart. More...
 
virtual int getBlockedByPlungerTicks () const =0
 Returns true if the kart has a plunger attached to its face. More...
 
virtual void blockViewWithPlunger ()=0
 Sets that the view is blocked by a plunger. More...
 
virtual bool isSquashed () const =0
 Returns if the kart is currently being squashed. More...
 
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. More...
 
virtual void unsetSquash ()=0
 Makes the kart unsquashed again. More...
 
virtual float getSpeed () const =0
 Returns the speed of the kart in meters/second. More...
 
virtual float getCurrentMaxSpeed () const =0
 Returns the current maximum speed for this kart, this includes all bonus and maluses that are currently applied. More...
 
virtual int getSpeedIncreaseTicksLeft (unsigned int category) const =0
 Returns how much increased speed time is left over in the given category. More...
 
virtual void setBoostAI (bool boosted)=0
 Sets the kart AI boost state. More...
 
virtual bool getBoostAI () const =0
 Returns the kart AI boost state. More...
 
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. More...
 
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. More...
 
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. More...
 
virtual float getEnergy () const =0
 Returns the remaining collected energy. More...
 
virtual void collectedItem (ItemState *item_state)=0
 Called when an item is collected. More...
 
virtual int getPosition () const =0
 Returns the current position of this kart in the race. More...
 
virtual void setPosition (int p)=0
 Returns the current position of this kart in the race. More...
 
virtual int getInitialPosition () const =0
 Returns the initial position of this kart. More...
 
virtual bool isOnGround () const =0
 True if the wheels are touching the ground. More...
 
virtual const SlipStreamgetSlipstream () const =0
 Returns the slipstream object of this kart. More...
 
virtual SlipStreamgetSlipstream ()=0
 Returns the slipstream object of this kart. More...
 
virtual void setSlipstreamEffect (float f)=0
 Activates a slipstream effect, atm that is display some nitro. More...
 
virtual void beep ()=0
 Plays a beep sfx. More...
 
virtual bool playCustomSFX (unsigned int type)=0
 This function will play a particular character voice for this kart. More...
 
virtual void showZipperFire ()=0
 Show fire to go with a zipper. More...
 
virtual void handleZipper (const Material *m=NULL, bool play_sound=false)=0
 Sets zipper time, and apply one time additional speed boost. More...
 
virtual bool hasFinishedRace () const =0
 Returns true if this kart has finished the race. More...
 
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 MaterialgetMaterial () const =0
 Returns the current material the kart is on. More...
 
virtual const MaterialgetLastMaterial () const =0
 Returns the previous material the kart was one (which might be the same as getMaterial() ). More...
 
virtual const PowerupgetPowerup () const =0
 Returns the current powerup. More...
 
virtual PowerupgetPowerup ()=0
 Returns the current powerup. More...
 
virtual PowerupManager::PowerupType getLastUsedPowerup ()=0
 Returns the last used powerup type. More...
 
virtual int getNumPowerup () const =0
 Returns the number of powerups. More...
 
virtual KartGFXgetKartGFX ()=0
 Returns a points to this kart's graphical effects. More...
 
virtual void setPowerup (PowerupManager::PowerupType t, int n)=0
 
virtual btKartgetVehicle () const =0
 Returns the bullet vehicle which represents this kart. More...
 
virtual btQuaternion getVisualRotation () const =0
 
virtual bool isInRest () const =0
 Returns true if the kart is 'resting', i.e. More...
 
virtual void startEngineSFX ()=0
 Starts the engine sound effect. More...
 
virtual void adjustSpeed (float f)=0
 Multiplies the velocity of the kart by a factor f (both linear and angular). More...
 
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. More...
 
virtual bool isInvulnerable () const =0
 Returns if the kart is invulnerable. More...
 
virtual void setInvulnerableTicks (int ticks)=0
 
virtual bool isShielded () const =0
 Returns if the kart is protected by a shield. More...
 
virtual void setShieldTime (float t)=0
 
virtual float getShieldTime () const =0
 
virtual void decreaseShieldTime ()=0
 Decreases the kart's shield time. More...
 
virtual void showStarEffect (float t)=0
 Shows the star effect for a certain time. More...
 
virtual const TerrainInfogetTerrainInfo () const =0
 Returns the terrain info oject. More...
 
virtual void crashed (AbstractKart *k, bool update_attachments)=0
 Called when the kart crashes against another kart. More...
 
virtual void crashed (const Material *m, const Vec3 &normal)=0
 
virtual const Vec3getNormal () const =0
 Returns the normal of the terrain the kart is over atm. More...
 
virtual const Vec3getPreviousXYZ () const =0
 Returns the position 0.25s before.
 
virtual const Vec3getRecentPreviousXYZ () 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. More...
 
virtual float getTerrainPitch (float heading) const =0
 Returns the pitch of the terrain depending on the heading. More...
 
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. More...
 
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. More...
 
virtual bool isGhostKart () const =0
 Returns whether this kart is a ghost (replay) kart. More...
 
virtual bool isJumping () const =0
 Returns whether this kart is jumping. More...
 
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. More...
 
virtual void setStartupBoost (float val)=0
 
virtual float getStartupBoost () const =0
 
virtual float getStartupBoostFromStartTicks (int ticks) const =0
 
virtual StarsgetStarsEffect () 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. More...
 
- Public Member Functions inherited from Moveable
scene::ISceneNode * getNode () const
 Returns the scene node of this moveable. More...
 
void setNode (scene::ISceneNode *n)
 Sets the mesh for this model. More...
 
virtual const btVector3 & getVelocity () const
 
const btVector3 & getVelocityLC () const
 
virtual void setVelocity (const btVector3 &v)
 
const Vec3getXYZ () const
 
float getHeading () const
 Returns the heading between -pi and pi. More...
 
float getPitch () const
 Returns the pitch of the kart, restricted to between -pi/2 and pi/2. More...
 
float getRoll () const
 Returns the roll of the kart between -pi and pi. More...
 
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. More...
 
void setRotation (const btMatrix3x3 &m)
 Sets the rotation of the physical body this moveable. More...
 
void setRotation (const btQuaternion &q)
 Sets the rotation of the physical body this moveable. More...
 
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. More...
 
btRigidBody * getBody () const
 
void createBody (float mass, btTransform &trans, btCollisionShape *shape, float restitution)
 Creates the bullet rigid body for this moveable. More...
 
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. More...
 
void updatePosition ()
 Updates the current position and rotation. More...
 
virtual void updateGraphics (float dt)=0
 Called once per rendered frame. More...
 
void prepareSmoothing ()
 
void checkSmoothing ()
 
const btTransform & getSmoothedTrans () const
 
const Vec3getSmoothedXYZ () 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 &current_transform, const Vec3 &current_velocity)
 
void checkSmoothing (const btTransform &current_transform, const Vec3 &current_velocity)
 Adds a new error between graphical and physical position/rotation. More...
 
void updateSmoothedGraphics (const btTransform &current_transform, const Vec3 &current_velocity, float dt)
 
void setSmoothedTransform (const btTransform &t)
 
const btTransform & getSmoothedTrans () const
 
const Vec3getSmoothedXYZ () const
 
void setMinAdjustLength (float val)
 
void setMaxAdjustLength (float val)
 
void setMinAdjustSpeed (float val)
 
void setMaxAdjustTime (float val)
 
void setAdjustLengthThreshold (float val)
 

Protected Attributes

btTransform m_starting_transform
 
int m_live_join_util
 
std::unique_ptr< KartPropertiesm_kart_properties
 The kart properties. More...
 
HandicapLevel m_handicap
 The handicap level of this kart. More...
 
std::unique_ptr< KartModelm_kart_model
 This stores a copy of the kart model. More...
 
std::unique_ptr< Attachmentm_attachment
 Handles the attachment the kart might have. More...
 
KartControl m_controls
 The kart controls (e.g. More...
 
AbstractKartAnimationm_kart_animation
 A kart animation object to handle rescue, explosion etc. More...
 
irr::scene::IDummyTransformationSceneNode * m_wheel_box
 Node between wheels and kart. More...
 
- Protected Attributes inherited from Moveable
btTransform m_transform
 The bullet transform of this rigid body. More...
 
UserPointer m_user_pointer
 
scene::ISceneNode * m_node
 
std::unique_ptr< btRigidBody > m_body
 
std::unique_ptr< KartMotionStatem_motion_state
 

Private Member Functions

void loadKartProperties (const std::string &new_ident, HandicapLevel handicap, std::shared_ptr< RenderInfo > ri)
 

Private Attributes

float m_kart_length
 Length of the kart, copy of the data from KartModel. More...
 
float m_kart_width
 Width of the kart, copy of the data from KartModel. More...
 
float m_kart_height
 Height of the kart, copy of the data from KartModel. More...
 
float m_kart_highest_point
 Coordinate on up axis.
 
const Vec3m_wheel_graphics_position
 The position of all four wheels in the 3d model.
 
unsigned int m_world_kart_id
 Index of kart in world. More...
 
core::stringw m_name
 Name of the kart with translation. More...
 

Additional Inherited Members

- 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. More...
 

Detailed Description

An abstract interface for the actual karts.

Some functions are actually implemented here in order to allow inlining.

Constructor & Destructor Documentation

◆ AbstractKart()

AbstractKart::AbstractKart ( const std::string &  ident,
int  world_kart_id,
int  position,
const btTransform &  init_transform,
HandicapLevel  handicap,
std::shared_ptr< RenderInfo ri 
)

Creates a kart.

Parameters
identThe identifier of the kart.
world_kart_idThe world index of this kart.
positionThe start position of the kart (1<=position<=n).
init_transformThe start position of the kart.

Member Function Documentation

◆ adjustSpeed()

virtual void AbstractKart::adjustSpeed ( float  f)
pure virtual

Multiplies the velocity of the kart by a factor f (both linear and angular).

This is used by anvils, which suddenly slow down the kart when they are attached.

Implemented in Kart.

◆ beep()

virtual void AbstractKart::beep ( )
pure virtual

Plays a beep sfx.

Implemented in Kart.

◆ blockViewWithPlunger()

virtual void AbstractKart::blockViewWithPlunger ( )
pure virtual

Sets that the view is blocked by a plunger.

The duration depends on the difficulty, see KartPorperties getPlungerInFaceTime.

Implemented in Kart.

◆ changeKart()

void AbstractKart::changeKart ( const std::string &  new_ident,
HandicapLevel  handicap,
std::shared_ptr< RenderInfo ri 
)
virtual

Change to new kart instancely (used in network live join).

Reimplemented in Kart.

◆ collectedItem()

virtual void AbstractKart::collectedItem ( ItemState item_state)
pure virtual

Called when an item is collected.

It will either adjust the collected energy, or update the attachment or powerup for this kart.

Parameters
itemThe item that was hit.

Implemented in Kart, and KartWithStats.

◆ crashed()

virtual void AbstractKart::crashed ( AbstractKart k,
bool  update_attachments 
)
pure virtual

Called when the kart crashes against another kart.

Parameters
kThe kart that was hit.
update_attachmentsIf true the attachment of this kart and the other kart hit will be updated (e.g. bombs will be moved).

Implemented in Kart.

◆ decreaseShieldTime()

virtual void AbstractKart::decreaseShieldTime ( )
pure virtual

Decreases the kart's shield time.

Implemented in Kart.

◆ eliminate()

virtual void AbstractKart::eliminate ( )
pure virtual

Marks this kart to be eliminated.

Implemented in Kart.

◆ getAlignedTransform()

virtual btTransform AbstractKart::getAlignedTransform ( const float  customPitch = -1)
pure virtual

Returns a bullet transform object located at the kart's position and oriented in the direction the kart is going.

Can be useful e.g. to calculate the starting point and direction of projectiles.

Implemented in Kart.

◆ getAttachment() [1/2]

const Attachment* AbstractKart::getAttachment ( ) const
inline

Returns the current attachment.

◆ getAttachment() [2/2]

Attachment* AbstractKart::getAttachment ( )
inline

Returns the current attachment, non-const version.

◆ getBlockedByPlungerTicks()

virtual int AbstractKart::getBlockedByPlungerTicks ( ) const
pure virtual

Returns true if the kart has a plunger attached to its face.

Implemented in Kart.

◆ getBoostAI()

virtual bool AbstractKart::getBoostAI ( ) const
pure virtual

Returns the kart AI boost state.

Not pure abstract, since there is no need to implement this e.g. in Ghost.

Implemented in Kart.

◆ getController() [1/2]

virtual Controller* AbstractKart::getController ( )
pure virtual

Returns the controller of this kart.

Implemented in Kart.

◆ getController() [2/2]

virtual const Controller* AbstractKart::getController ( ) const
pure virtual

Returns the controller of this kart (const version).

Implemented in Kart.

◆ getControls() [1/2]

KartControl& AbstractKart::getControls ( )
inline

Returns all controls of this kart.

◆ getControls() [2/2]

const KartControl& AbstractKart::getControls ( ) const
inline

Returns all controls of this kart - const version.

◆ getCurrentMaxSpeed()

virtual float AbstractKart::getCurrentMaxSpeed ( ) const
pure virtual

Returns the current maximum speed for this kart, this includes all bonus and maluses that are currently applied.

Implemented in Kart.

◆ getEnergy()

virtual float AbstractKart::getEnergy ( ) const
pure virtual

Returns the remaining collected energy.

Implemented in Kart.

◆ getFinishTime()

virtual float AbstractKart::getFinishTime ( ) const
pure virtual

Returns the finished time for a kart.

Implemented in Kart.

◆ getFrontXYZ()

virtual const Vec3& AbstractKart::getFrontXYZ ( ) const
pure virtual

Returns the coordinates of the front of the kart.

This is used for determining when the lap line is crossed.

Implemented in Kart.

◆ getHandicap()

const HandicapLevel AbstractKart::getHandicap ( ) const
inline

Returns the handicap of this kart.

◆ getHoT()

virtual float AbstractKart::getHoT ( ) const
pure virtual

Returns the height of the terrain.

we're currently above

Implemented in Kart.

◆ getIdent()

const std::string & AbstractKart::getIdent ( ) const
virtual

Returns a unique identifier for this kart (name of the directory the kart was loaded from).

Reimplemented from Moveable.

◆ getInitialPosition()

virtual int AbstractKart::getInitialPosition ( ) const
pure virtual

Returns the initial position of this kart.

Implemented in Kart.

◆ getKartAnimation()

AbstractKartAnimation* AbstractKart::getKartAnimation ( )
inline

Returns a kart animation (if any), or NULL if currently no kart animation is being shown.

◆ getKartGFX()

virtual KartGFX* AbstractKart::getKartGFX ( )
pure virtual

Returns a points to this kart's graphical effects.

Implemented in Kart.

◆ getKartHeight()

float AbstractKart::getKartHeight ( ) const
inline

Returns the height of the kart.

◆ getKartLength()

float AbstractKart::getKartLength ( ) const
inline

Returns the length of the kart.

◆ getKartModel()

KartModel* AbstractKart::getKartModel ( ) const
inline

Returns this kart's kart model.

◆ getKartProperties()

const KartProperties* AbstractKart::getKartProperties ( ) const
inline

Returns the kart properties of this kart.

◆ getKartWidth()

float AbstractKart::getKartWidth ( ) const
inline

Returns the width of the kart.

◆ getLastMaterial()

virtual const Material* AbstractKart::getLastMaterial ( ) const
pure virtual

Returns the previous material the kart was one (which might be the same as getMaterial() ).

Implemented in Kart.

◆ getLastUsedPowerup()

virtual PowerupManager::PowerupType AbstractKart::getLastUsedPowerup ( )
pure virtual

Returns the last used powerup type.

Implemented in Kart.

◆ getMaterial()

virtual const Material* AbstractKart::getMaterial ( ) const
pure virtual

Returns the current material the kart is on.

Implemented in Kart.

◆ getMaxSteerAngle()

virtual float AbstractKart::getMaxSteerAngle ( ) const
pure virtual

Returns the maximum steering angle for this kart, which depends on the speed.

Implemented in Kart.

◆ getName()

const core::stringw& AbstractKart::getName ( ) const
inline

Returns a name to be displayed for this kart.

◆ getNetworkConfirmedFinishTicks()

virtual int AbstractKart::getNetworkConfirmedFinishTicks ( ) const
pure virtual

Return the confirmed finish ticks (sent by the server) indicating that this kart has really finished the race.

Implemented in Kart.

◆ getNormal()

virtual const Vec3& AbstractKart::getNormal ( ) const
pure virtual

Returns the normal of the terrain the kart is over atm.

This is defined even if the kart is flying.

Implemented in Kart.

◆ getNumPowerup()

virtual int AbstractKart::getNumPowerup ( ) const
pure virtual

Returns the number of powerups.

Implemented in Kart.

◆ getPosition()

virtual int AbstractKart::getPosition ( ) const
pure virtual

Returns the current position of this kart in the race.

Implemented in Kart.

◆ getPowerup() [1/2]

virtual const Powerup* AbstractKart::getPowerup ( ) const
pure virtual

Returns the current powerup.

Implemented in Kart.

◆ getPowerup() [2/2]

virtual Powerup* AbstractKart::getPowerup ( )
pure virtual

Returns the current powerup.

Implemented in Kart.

◆ getRaceResult()

virtual bool AbstractKart::getRaceResult ( ) const
pure virtual

Returns whether this kart wins or loses.

Implemented in Kart.

◆ getSkidding() [1/2]

virtual const Skidding* AbstractKart::getSkidding ( ) const
pure virtual

Returns the skidding object for this kart (which can be used to query skidding related values).

Implemented in Kart.

◆ getSkidding() [2/2]

virtual Skidding* AbstractKart::getSkidding ( )
pure virtual

Returns the skidding object for this kart (which can be used to query skidding related values), non-const.

Implemented in Kart.

◆ getSlipstream() [1/2]

virtual const SlipStream* AbstractKart::getSlipstream ( ) const
pure virtual

Returns the slipstream object of this kart.

Implemented in Kart.

◆ getSlipstream() [2/2]

virtual SlipStream* AbstractKart::getSlipstream ( )
pure virtual

Returns the slipstream object of this kart.

Implemented in Kart.

◆ getSpeed()

virtual float AbstractKart::getSpeed ( ) const
pure virtual

Returns the speed of the kart in meters/second.

This is not declared pure abstract, since this function is not needed for certain classes, like Ghost.

Implemented in Kart, and GhostKart.

◆ getSpeedForTurnRadius()

virtual float AbstractKart::getSpeedForTurnRadius ( float  radius) const
pure virtual

Returns the (maximum) speed for a given turn radius.

Parameters
radiusThe radius for which the speed needs to be computed.

Implemented in Kart.

◆ getSpeedIncreaseTicksLeft()

virtual int AbstractKart::getSpeedIncreaseTicksLeft ( unsigned int  category) const
pure virtual

Returns how much increased speed time is left over in the given category.

Parameters
categoryWhich category to report on.

Implemented in Kart.

◆ getSteerPercent()

virtual float AbstractKart::getSteerPercent ( ) const
inlinevirtual

Returns the current steering value for this kart.

Reimplemented in KartRewinder.

◆ getTerrainInfo()

virtual const TerrainInfo* AbstractKart::getTerrainInfo ( ) const
pure virtual

Returns the terrain info oject.

Implemented in Kart.

◆ getTerrainPitch()

virtual float AbstractKart::getTerrainPitch ( float  heading) const
pure virtual

Returns the pitch of the terrain depending on the heading.

Implemented in Kart.

◆ getTimeForDistance()

float AbstractKart::getTimeForDistance ( float  distance)
virtual

Returns the time at which the kart was at a given distance.

Returns -1.0f if none

Reimplemented in GhostKart.

◆ getTimeFullSteer()

virtual float AbstractKart::getTimeFullSteer ( float  steer) const
pure virtual

Returns the time till full steering is reached for this kart.

This can depend on the current steering value, which must be >= 0.

Implemented in Kart.

◆ getVehicle()

virtual btKart* AbstractKart::getVehicle ( ) const
pure virtual

Returns the bullet vehicle which represents this kart.

Implemented in Kart.

◆ getWheelGraphicsPosition()

const Vec3& AbstractKart::getWheelGraphicsPosition ( int  i) const
inline

Returns the position of a wheel relative to the kart.

Parameters
iIndex of the wheel: 0=front right, 1 = front left, 2 = rear right, 3 = rear left.

◆ getWorldKartId()

unsigned int AbstractKart::getWorldKartId ( ) const
inline

Returns the index of this kart in world.

◆ handleZipper()

virtual void AbstractKart::handleZipper ( const Material m = NULL,
bool  play_sound = false 
)
pure virtual

Sets zipper time, and apply one time additional speed boost.

It can be used with a specific material, in which case the zipper parmaters are taken from this material (parameters that are <0 will be using the kart-specific values from kart-properties.

Implemented in Kart.

◆ hasFinishedRace()

virtual bool AbstractKart::hasFinishedRace ( ) const
pure virtual

Returns true if this kart has finished the race.

Implemented in Kart.

◆ increaseMaxSpeed()

virtual void AbstractKart::increaseMaxSpeed ( unsigned int  category,
float  add_speed,
float  engine_force,
int  duration,
int  fade_out_time 
)
pure virtual

Sets an increased maximum speed for a category.

Parameters
categoryThe category for which to set the higher maximum speed.
add_speedHow much speed (in m/s) is added to the maximum speed.
engine_forceAdditional engine force to affect the kart.
durationHow long the speed increase will last.
fade_out_timeHow long the maximum speed will fade out linearly.

Implemented in Kart.

◆ instantSpeedIncrease()

virtual void AbstractKart::instantSpeedIncrease ( unsigned int  category,
float  add_max_speed,
float  speed_boost,
float  engine_force,
int  duration,
int  fade_out_time 
)
pure virtual

This adjusts the top speed using increaseMaxSpeed, but additionally causes an instant speed boost, which can be smaller than add-max-speed.

(e.g. a zipper can give an instant boost of 5 m/s, but over time would allow the speed to go up by 10 m/s).

Parameters
categoryThe category for which the speed is increased.
add_max_speedIncrease of the maximum allowed speed.
speed_boostAn instant speed increase for this kart.
engine_forceAdditional engine force.
durationDuration of the increased speed.
fade_out_timeHow long the maximum speed will fade out linearly.

Implemented in Kart.

◆ isEliminated()

virtual bool AbstractKart::isEliminated ( ) const
pure virtual

Returns true if the kart is eliminated.

Implemented in Kart.

◆ isGhostKart()

virtual bool AbstractKart::isGhostKart ( ) const
pure virtual

Returns whether this kart is a ghost (replay) kart.

Implemented in Kart, and GhostKart.

◆ isInRest()

virtual bool AbstractKart::isInRest ( ) const
pure virtual

Returns true if the kart is 'resting', i.e.

(nearly) not moving.

Implemented in Kart.

◆ isInvulnerable()

virtual bool AbstractKart::isInvulnerable ( ) const
pure virtual

Returns if the kart is invulnerable.

Implemented in Kart, and GhostKart.

◆ isJumping()

virtual bool AbstractKart::isJumping ( ) const
pure virtual

Returns whether this kart is jumping.

Implemented in Kart.

◆ isOnGround()

virtual bool AbstractKart::isOnGround ( ) const
pure virtual

True if the wheels are touching the ground.

Implemented in Kart.

◆ isShielded()

virtual bool AbstractKart::isShielded ( ) const
pure virtual

Returns if the kart is protected by a shield.

Implemented in Kart.

◆ isSquashed()

virtual bool AbstractKart::isSquashed ( ) const
pure virtual

Returns if the kart is currently being squashed.

Implemented in Kart.

◆ isWheeless()

bool AbstractKart::isWheeless ( ) const

Returns true if this kart has no wheels.

◆ kartIsInRestNow()

void AbstractKart::kartIsInRestNow ( )
virtual

Called after the kart comes to rest.

Moves the current physical transform into this kart's position.

It can be used to e.g. compute differences between graphical and physical chassis. Note that overwriting this function is possible, but this implementation must be called.

Reimplemented in Kart, and GhostKart.

◆ makeKartRest()

void AbstractKart::makeKartRest ( )
virtual

Called before go phase to make sure all karts start at the same position in case there is a slope.

Reimplemented in GhostKart.

◆ playCustomSFX()

virtual bool AbstractKart::playCustomSFX ( unsigned int  type)
pure virtual

This function will play a particular character voice for this kart.

It returns whether or not a character voice sample exists for the particular event. If there is no voice sample, a default can be played instead.

Implemented in Kart.

◆ setBoostAI()

virtual void AbstractKart::setBoostAI ( bool  boosted)
pure virtual

Sets the kart AI boost state.

Not pure abstract, since there is no need to implement this e.g. in Ghost.

Parameters
boostedTrue if a boost should be applied.

Implemented in Kart.

◆ setController()

virtual void AbstractKart::setController ( Controller controller)
pure virtual

Saves the old controller in m_saved_controller and stores a new controller.

The save controller is needed in case of a reset.

Parameters
controllerThe new controller to use (atm it's always an end controller).

Implemented in Kart.

◆ setHandicap()

void AbstractKart::setHandicap ( const HandicapLevel  h)
inline

Sets the handicap.

◆ setKartAnimation()

void AbstractKart::setKartAnimation ( AbstractKartAnimation ka)
virtual

Sets a new kart animation.

This function should either be called to remove an existing kart animation (ka=NULL), or to set a new kart animation, in which case the current kart animation must be NULL.

Parameters
kaThe new kart animation, or NULL if the current kart animation is to be stopped.

Reimplemented in KartWithStats.

◆ setPosition()

virtual void AbstractKart::setPosition ( int  p)
pure virtual

Returns the current position of this kart in the race.

Implemented in Kart.

◆ setSlipstreamEffect()

virtual void AbstractKart::setSlipstreamEffect ( float  f)
pure virtual

Activates a slipstream effect, atm that is display some nitro.

Implemented in Kart.

◆ setSlowdown()

virtual void AbstractKart::setSlowdown ( unsigned int  category,
float  max_speed_fraction,
int  fade_in_time 
)
pure virtual

Defines a slowdown, which is in fraction of top speed.

Parameters
categoryThe category for which the speed is increased.
max_speed_fractionFraction of top speed to allow only.
fade_in_timeHow long till maximum speed is capped.

Implemented in Kart.

◆ setSpeed()

virtual void AbstractKart::setSpeed ( float  s)
pure virtual

This is used on the client side only to set the speed of the kart from the server information.

Implemented in Kart.

◆ setSquash()

virtual bool AbstractKart::setSquash ( float  time,
float  slowdown 
)
pure virtual

Squashes this kart: it will scale the kart in up direction, and causes a slowdown while this kart is squashed.

Returns true if the squash is successful, false otherwise.

Parameters
timeHow long the kart will be squashed.
slowdownReduction of max speed.

Implemented in Kart.

◆ showStarEffect()

virtual void AbstractKart::showStarEffect ( float  t)
pure virtual

Shows the star effect for a certain time.

Implemented in Kart.

◆ showZipperFire()

virtual void AbstractKart::showZipperFire ( )
pure virtual

Show fire to go with a zipper.

Implemented in Kart.

◆ startEngineSFX()

virtual void AbstractKart::startEngineSFX ( )
pure virtual

Starts the engine sound effect.

Called once the track intro phase is over.

Implemented in Kart.

◆ unsetSquash()

virtual void AbstractKart::unsetSquash ( )
pure virtual

Makes the kart unsquashed again.

Implemented in Kart.

Member Data Documentation

◆ m_attachment

std::unique_ptr<Attachment> AbstractKart::m_attachment
protected

Handles the attachment the kart might have.

◆ m_controls

KartControl AbstractKart::m_controls
protected

The kart controls (e.g.

steering, fire, ...).

◆ m_handicap

HandicapLevel AbstractKart::m_handicap
protected

The handicap level of this kart.

◆ m_kart_animation

AbstractKartAnimation* AbstractKart::m_kart_animation
protected

A kart animation object to handle rescue, explosion etc.

◆ m_kart_height

float AbstractKart::m_kart_height
private

Height of the kart, copy of the data from KartModel.

◆ m_kart_length

float AbstractKart::m_kart_length
private

Length of the kart, copy of the data from KartModel.

◆ m_kart_model

std::unique_ptr<KartModel> AbstractKart::m_kart_model
protected

This stores a copy of the kart model.

It has to be a copy since otherwise incosistencies can happen if the same kart is used more than once.

◆ m_kart_properties

std::unique_ptr<KartProperties> AbstractKart::m_kart_properties
protected

The kart properties.

◆ m_kart_width

float AbstractKart::m_kart_width
private

Width of the kart, copy of the data from KartModel.

◆ m_name

core::stringw AbstractKart::m_name
private

Name of the kart with translation.

◆ m_wheel_box

irr::scene::IDummyTransformationSceneNode* AbstractKart::m_wheel_box
protected

Node between wheels and kart.

Allows kart to be scaled independent of wheels, when being squashed.

◆ m_world_kart_id

unsigned int AbstractKart::m_world_kart_id
private

Index of kart in world.


The documentation for this class was generated from the following files: