SuperTuxKart
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Private Attributes | Friends | List of all members
CannonAnimation Class Reference

This animation shoots the kart to a specified point on the track. More...

#include <cannon_animation.hpp>

Inheritance diagram for CannonAnimation:
Inheritance graph
[legend]

Public Member Functions

 CannonAnimation (AbstractKart *kart, CheckCannon *cc, float skid_rot)
 The constructor for the cannon animation.
 
 CannonAnimation (Flyable *flyable, CheckCannon *cc)
 Constructor for a flyable.
 
virtual void update (int ticks)
 Updates the kart animation.
 
virtual KartAnimationType getAnimationType () const
 
virtual void saveState (BareNetworkString *buffer)
 
virtual void restoreState (BareNetworkString *buffer)
 
- Public Member Functions inherited from AbstractKartAnimation
 AbstractKartAnimation (AbstractKart *kart, const std::string &name)
 Constructor.
 
virtual void update (int ticks)
 Updates the timer, and if it expires, the kart animation will be removed from the kart and this object will be deleted.
 
virtual void updateGraphics (float dt)
 
virtual float getAnimationTimer () const
 Returns the current animation timer.
 
virtual const std::string & getName () const
 To easily allow printing the name of the animation being used atm.
 
virtual KartAnimationType getAnimationType () const =0
 
void handleResetRace ()
 
virtual void saveState (BareNetworkString *buffer)
 
virtual void restoreState (BareNetworkString *buffer)
 

Protected Member Functions

 CannonAnimation (AbstractKart *kart, BareNetworkString *buffer)
 The constructor for the cannon animation for kart during rewind.
 
 CannonAnimation (Flyable *flyable, BareNetworkString *buffer)
 The constructor for the cannon animation for flyable during rewind.
 
void init (Ipo *ipo, const Vec3 &start_left, const Vec3 &start_right, const Vec3 &end_left, const Vec3 &end_right, float skid_rot)
 Common initialisation for kart-based and flyable-based animations.
 
void initDeltaHeading (float skidding_rotation)
 
void restoreData (BareNetworkString *buffer)
 
- Protected Member Functions inherited from AbstractKartAnimation
void resetPowerUp ()
 In CTF mode call this to reset kart powerup when get hit.
 
void restoreBasicState (BareNetworkString *buffer)
 Used in constructor of sub-class as no virtual function can be used there.
 
float getMaximumHeight (const Vec3 &up_vector, float height_remove)
 Determine maximum rescue height with up-raycast.
 

Private Attributes

CheckCannonm_check_cannon
 The CheckCannon which created this animation.
 
float m_skid_rot
 
Vec3 m_delta
 This is the difference between the position of the kart when the cannon line is crossed and the curve interpolation at t=0.
 
AnimationBasem_curve
 Stores the curve interpolation for the cannon.
 
Flyablem_flyable
 If this animation is used for a flyable (e.g.
 
float m_start_line_length
 Length of the (adjusted, i.e.
 
float m_end_line_length
 Length of the (adjusted, i.e.
 
float m_fraction_of_line
 Stores the position of the kart relative to the line width at the current location.
 
btQuaternion m_delta_heading
 The initial heading of the kart when crossing the line.
 
uint32_t m_current_rotation
 Current rotation of the object, saved for rewinding usage if needed, it will be compressed by MiniGLM.
 

Friends

class KartRewinder
 
class Flyable
 

Additional Inherited Members

- Protected Attributes inherited from AbstractKartAnimation
AbstractKartm_kart
 A pointer to the kart which is animated by this class.
 
int m_end_ticks
 Time in ticks for the animation which ends in world count up ticks.
 
int m_created_ticks
 Time in ticks for the animation creation.
 
btTransform m_created_transform
 Transformation by the time the animation was created, used for rewind to recreate the animation with the same one.
 
int m_created_transform_compressed [4]
 

Detailed Description

This animation shoots the kart to a specified point on the track.

Constructor & Destructor Documentation

◆ CannonAnimation() [1/2]

CannonAnimation::CannonAnimation ( AbstractKart kart,
CheckCannon cc,
float  skid_rot 
)

The constructor for the cannon animation.

Parameters
kartThe kart to be animated. Can also be NULL if a basket ball etc is animated (e.g. cannon animation).
ccThe CheckCannon which created this animation.
end_left,end_rightLeft and right end points of the line at which the kart finishes.
skid_rotVisual rotation of the kart due to skidding (while this value can be queried, the AbstractkartAnimation constructor resets the value to 0, so it needs to be passed in.

◆ CannonAnimation() [2/2]

CannonAnimation::CannonAnimation ( Flyable flyable,
CheckCannon cc 
)

Constructor for a flyable.

It sets the kart data to NULL.

Member Function Documentation

◆ getAnimationType()

virtual KartAnimationType CannonAnimation::getAnimationType ( ) const
inlinevirtual

Implements AbstractKartAnimation.

◆ init()

void CannonAnimation::init ( Ipo ipo,
const Vec3 start_left,
const Vec3 start_right,
const Vec3 end_left,
const Vec3 end_right,
float  skid_rot 
)
protected

Common initialisation for kart-based and flyable-based animations.

Parameters
ipoThe IPO (blender interpolation curve) which the kart should follow.
start_left,start_rightLeft and right end points of the line that the kart just crossed.
end_left,end_rightLeft and right end points of the line at which the kart finishes.
skid_rotVisual rotation of the kart due to skidding (while this value can be queried, the AbstractkartAnimation constructor resets the value to 0, so it needs to be passed in.

◆ restoreState()

void CannonAnimation::restoreState ( BareNetworkString buffer)
virtual

Reimplemented from AbstractKartAnimation.

◆ saveState()

void CannonAnimation::saveState ( BareNetworkString buffer)
virtual

Reimplemented from AbstractKartAnimation.

◆ update()

void CannonAnimation::update ( int  ticks)
virtual

Updates the kart animation.

Parameters
ticksNumber of time steps - should be 1.

Reimplemented from AbstractKartAnimation.

Member Data Documentation

◆ m_delta

Vec3 CannonAnimation::m_delta
private

This is the difference between the position of the kart when the cannon line is crossed and the curve interpolation at t=0.

This is added to each interpolated curve value to give the final kart position (so the kart moves relative to the curve).

◆ m_delta_heading

btQuaternion CannonAnimation::m_delta_heading
private

The initial heading of the kart when crossing the line.

This is used to smoothly orient the kart towards the normal of the curve.

◆ m_end_line_length

float CannonAnimation::m_end_line_length
private

Length of the (adjusted, i.e.

taking kart width into account) end line.

◆ m_flyable

Flyable* CannonAnimation::m_flyable
private

If this animation is used for a flyable (e.g.

basket ball) instead of a kart, m_flyable is defined and m_kart is NULL.

◆ m_start_line_length

float CannonAnimation::m_start_line_length
private

Length of the (adjusted, i.e.

taking kart width into account) start line.


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