SuperTuxKart
Loading...
Searching...
No Matches
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
SlipStream Class Reference

Public Member Functions

 SlipStream (AbstractKart *kart)
 Creates the slip stream object.
 
 ~SlipStream ()
 Removes the node from the scene graph.
 
void reset ()
 Called at re-start of a race.
 
void update (int ticks)
 Update, called once per timestep.
 
bool isSlipstreamReady () const
 Returns true if enough slipstream credits have been accumulated to get a boost when leaving the slipstream area.
 
void updateSpeedIncrease ()
 
const QuadgetSlipstreamQuad () const
 Returns the quad in which slipstreaming is effective for this kart.
 
const AbstractKartgetSlipstreamTarget () const
 Returns the kart from which slipstream is 'collected'.
 
bool inUse () const
 Returns if slipstream is being used.
 

Private Types

enum  { SS_NONE , SS_COLLECT }
 Slipstream mode: either nothing happening, or the kart is collecting 'slipstream credits'. More...
 

Private Member Functions

SP::SPMeshcreateMeshSP (unsigned material_id, bool bonus_mesh)
 Creates the mesh for the slipstream effect.
 
scene::IAnimatedMesh * createMesh (unsigned material_id, bool bonus_mesh)
 Creates the mesh for the slipstream effect.
 
void setDebugColor (const video::SColor &color, bool inner)
 Sets the color of the debug mesh (which shows the area in which slipstream can be accumulated).
 
void updateQuad ()
 UpdateQuad.
 
void updateSlipstreamingTextures (float f, const AbstractKart *kart)
 
void updateBonusTexture ()
 
void hideAllNodes ()
 

Private Attributes

AbstractKartm_kart
 The kart to which this smoke belongs.
 
MovingTexturem_moving
 The moving texture for the normal node.
 
MovingTexturem_moving_fast
 The moving texture for the fast node.
 
MovingTexturem_moving_bonus
 The moving texture for the fast node.
 
scene::ISceneNode * m_node
 The scene node.
 
scene::ISceneNode * m_node_fast
 The fast scene node.
 
scene::ISceneNode * m_bonus_node
 The node used when the bonus is active.
 
std::shared_ptr< SP::SPDynamicDrawCallm_debug_dc
 For debugging: a simple quad to display where slipstream works.
 
std::shared_ptr< SP::SPDynamicDrawCallm_debug_dc2
 For debugging: a simple quad to display where inner slipstream works.
 
float m_length
 The length of the slipstream cylinder.
 
float m_slipstream_time
 The time a kart was in slipstream.
 
float m_bonus_time
 The remaining active time bonus.
 
bool m_bonus_active
 This bool is used to know the first time we're going out of the slipstreaming area.
 
int m_current_target_id
 Used to trigger automatically the slipstreaming bonus.
 
int m_previous_target_id
 
int m_speed_increase_ticks
 
int m_speed_increase_duration
 
enum SlipStream:: { ... }  m_slipstream_mode
 Slipstream mode: either nothing happening, or the kart is collecting 'slipstream credits'.
 
Quadm_slipstream_quad
 This is slipstream area if the kart is at 0,0,0 without rotation.
 
Quadm_slipstream_inner_quad
 This is the inner slipstream area if the kart is at 0,0,0 without rotation.
 
Quadm_slipstream_outer_quad
 This is the outer slipstream area if the kart is at 0,0,0 without rotation.
 
AbstractKartm_target_kart
 The kart from which this kart gets slipstream.
 

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private

Slipstream mode: either nothing happening, or the kart is collecting 'slipstream credits'.

Credits can be accumulated while the bonus is used

Constructor & Destructor Documentation

◆ SlipStream()

SlipStream::SlipStream ( AbstractKart kart)

Creates the slip stream object.

Parameters
kartPointer to the kart to which the slip stream belongs to.

Member Function Documentation

◆ createMesh()

scene::IAnimatedMesh * SlipStream::createMesh ( unsigned  material_id,
bool  bonus_mesh 
)
private

Creates the mesh for the slipstream effect.

This function creates a first a series of circles (with a certain number of vertices each and distance from each other. Then it will create the triangles and add texture coordniates.

Parameters
material_idThe material to use.

◆ createMeshSP()

SP::SPMesh * SlipStream::createMeshSP ( unsigned  material_id,
bool  bonus_mesh 
)
private

Creates the mesh for the slipstream effect.

This function creates a first a series of circles (with a certain number of vertices each and distance from each other. Then it will create the triangles and add texture coordniates.

Parameters
material_idThe material to use.

◆ setDebugColor()

void SlipStream::setDebugColor ( const video::SColor &  color,
bool  inner 
)
private

Sets the color of the debug mesh (which shows the area in which slipstream can be accumulated).

Color codes: black: kart too slow red: not inside of slipstream area green: slipstream is being accumulated.

Parameters
inner: bool to know if we apply the color to the inner quad or to the main one

◆ update()

void SlipStream::update ( int  ticks)

Update, called once per timestep.

Parameters
dtTime step size.

Member Data Documentation

◆ m_length

float SlipStream::m_length
private

The length of the slipstream cylinder.

This is used to scale the actual scene node correctly. Shared between node and node_fast

◆ 

enum { ... } SlipStream::m_slipstream_mode

Slipstream mode: either nothing happening, or the kart is collecting 'slipstream credits'.

Credits can be accumulated while the bonus is used

◆ m_slipstream_outer_quad

Quad* SlipStream::m_slipstream_outer_quad
private

This is the outer slipstream area if the kart is at 0,0,0 without rotation.

No slipstream time is accumulated there, but it's lost slower

◆ m_target_kart

AbstractKart* SlipStream::m_target_kart
private

The kart from which this kart gets slipstream.

Used by the AI to overtake the right kart.


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