SuperTuxKart
Loading...
Searching...
No Matches
cannon_animation.hpp
1//
2// SuperTuxKart - a fun racing game with go-kart
3// Copyright (C) 2012-2015 Joerg Henrichs
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 3
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19#ifndef HEADER_CANNON_ANIMATION_HPP
20#define HEADER_CANNON_ANIMATION_HPP
21
22#include "karts/abstract_kart_animation.hpp"
23#include "utils/vec3.hpp"
24
25#include "LinearMath/btQuaternion.h"
26
27class AbstractKart;
28class AnimationBase;
29class CheckCannon;
30class Flyable;
31class Ipo;
32
39{
40protected:
41friend class KartRewinder;
42friend class Flyable;
43 // ------------------------------------------------------------------------
45 // ------------------------------------------------------------------------
46 CannonAnimation(Flyable* flyable, BareNetworkString* buffer);
47 // ------------------------------------------------------------------------
48 void init(Ipo *ipo, const Vec3 &start_left, const Vec3 &start_right,
49 const Vec3 &end_left, const Vec3 &end_right, float skid_rot);
50 // ------------------------------------------------------------------------
51 void initDeltaHeading(float skidding_rotation);
52 // ------------------------------------------------------------------------
53 void restoreData(BareNetworkString* buffer);
54
55private:
58
59 /* Skidding rotation by the time the kart enter this cannon,
60 * will be restored during rewind, */
61 float m_skid_rot;
62
68
71
75
79
83
87
90 btQuaternion m_delta_heading;
91
95
96public:
98 float skid_rot);
99 CannonAnimation(Flyable *flyable, CheckCannon* cc);
100 virtual ~CannonAnimation();
101 virtual void update(int ticks);
102 // ------------------------------------------------------------------------
103 virtual KartAnimationType getAnimationType() const { return KAT_CANNON; }
104 // ------------------------------------------------------------------------
105 virtual void saveState(BareNetworkString* buffer);
106 // ------------------------------------------------------------------------
107 virtual void restoreState(BareNetworkString* buffer);
108}; // CannonAnimation
109#endif
The base class for all kart animation, like rescue, explosion, or cannon.
Definition: abstract_kart_animation.hpp:60
An abstract interface for the actual karts.
Definition: abstract_kart.hpp:62
A base class for all animations.
Definition: animation_base.hpp:41
Describes a chain of 8-bit unsigned integers.
Definition: network_string.hpp:53
This animation shoots the kart to a specified point on the track.
Definition: cannon_animation.hpp:39
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.
Definition: cannon_animation.cpp:114
Flyable * m_flyable
If this animation is used for a flyable (e.g.
Definition: cannon_animation.hpp:74
btQuaternion m_delta_heading
The initial heading of the kart when crossing the line.
Definition: cannon_animation.hpp:90
float m_end_line_length
Length of the (adjusted, i.e.
Definition: cannon_animation.hpp:82
float m_start_line_length
Length of the (adjusted, i.e.
Definition: cannon_animation.hpp:78
Vec3 m_delta
This is the difference between the position of the kart when the cannon line is crossed and the curve...
Definition: cannon_animation.hpp:67
uint32_t m_current_rotation
Current rotation of the object, saved for rewinding usage if needed, it will be compressed by MiniGLM...
Definition: cannon_animation.hpp:94
virtual void update(int ticks)
Updates the kart animation.
Definition: cannon_animation.cpp:259
AnimationBase * m_curve
Stores the curve interpolation for the cannon.
Definition: cannon_animation.hpp:70
CheckCannon * m_check_cannon
The CheckCannon which created this animation.
Definition: cannon_animation.hpp:57
float m_fraction_of_line
Stores the position of the kart relative to the line width at the current location.
Definition: cannon_animation.hpp:86
Implements a simple checkline that will cause a kart or flyable to be shot to a specified point.
Definition: check_cannon.hpp:46
Definition: flyable.hpp:50
A class to manage a single blender IPO curve.
Definition: ipo.hpp:38
Definition: kart_rewinder.hpp:30
A wrapper around bullets btVector3 to include conventient conversion functions (e....
Definition: vec3.hpp:35