SuperTuxKart
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. More...
 
 ~SlipStream ()
 Removes the node from the scene graph.
 
void reset ()
 Called at re-start of a race. More...
 
void update (int ticks)
 Update, called once per timestep. More...
 
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. More...
 
const AbstractKartgetSlipstreamTarget () const
 Returns the kart from which slipstream is 'collected'. More...
 
bool inUse () const
 Returns if slipstream is being used. More...
 

Private Types

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

Private Member Functions

SP::SPMeshcreateMesh (Material *material, bool bonus_mesh)
 Creates the mesh for the slipstream effect. More...
 
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). More...
 
void updateQuad ()
 UpdateQuad.
 
void updateSlipstreamingTextures (float f, const AbstractKart *kart)
 
void updateBonusTexture ()
 

Private Attributes

AbstractKartm_kart
 The kart to which this smoke belongs. More...
 
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. More...
 
scene::ISceneNode * m_node_fast
 The fast scene node. More...
 
scene::ISceneNode * m_bonus_node
 The node used when the bonus is active. More...
 
std::shared_ptr< SP::SPDynamicDrawCallm_debug_dc
 For debugging: a simple quad to display where slipstream works. More...
 
std::shared_ptr< SP::SPDynamicDrawCallm_debug_dc2
 For debugging: a simple quad to display where inner slipstream works. More...
 
float m_length
 The length of the slipstream cylinder. More...
 
float m_slipstream_time
 The time a kart was in slipstream. More...
 
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'. More...
 
Quadm_slipstream_quad
 This is slipstream area if the kart is at 0,0,0 without rotation. More...
 
Quadm_slipstream_inner_quad
 This is the inner slipstream area if the kart is at 0,0,0 without rotation. More...
 
Quadm_slipstream_outer_quad
 This is the outer slipstream area if the kart is at 0,0,0 without rotation. More...
 
AbstractKartm_target_kart
 The kart from which this kart gets slipstream. More...
 

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()

SP::SPMesh * SlipStream::createMesh ( Material material,
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
materialThe material to use.

◆ getSlipstreamQuad()

const Quad& SlipStream::getSlipstreamQuad ( ) const
inline

Returns the quad in which slipstreaming is effective for this kart.

◆ getSlipstreamTarget()

const AbstractKart* SlipStream::getSlipstreamTarget ( ) const
inline

Returns the kart from which slipstream is 'collected'.

◆ inUse()

bool SlipStream::inUse ( ) const
inline

Returns if slipstream is being used.

◆ reset()

void SlipStream::reset ( )

Called at re-start of a race.

◆ 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_bonus_node

scene::ISceneNode* SlipStream::m_bonus_node
private

The node used when the bonus is active.

◆ m_debug_dc

std::shared_ptr<SP::SPDynamicDrawCall> SlipStream::m_debug_dc
private

For debugging: a simple quad to display where slipstream works.

◆ m_debug_dc2

std::shared_ptr<SP::SPDynamicDrawCall> SlipStream::m_debug_dc2
private

For debugging: a simple quad to display where inner slipstream works.

◆ m_kart

AbstractKart* SlipStream::m_kart
private

The kart to which this smoke belongs.

◆ 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

◆ m_node

scene::ISceneNode* SlipStream::m_node
private

The scene node.

◆ m_node_fast

scene::ISceneNode* SlipStream::m_node_fast
private

The fast scene node.

◆ m_slipstream_inner_quad

Quad* SlipStream::m_slipstream_inner_quad
private

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

◆ m_slipstream_mode

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_slipstream_quad

Quad* SlipStream::m_slipstream_quad
private

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

◆ m_slipstream_time

float SlipStream::m_slipstream_time
private

The time a kart was in slipstream.

◆ 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: