SuperTuxKart
rescue_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_RESCUE_ANIMATION_HPP
20 #define HEADER_RESCUE_ANIMATION_HPP
21 
22 #include "karts/abstract_kart_animation.hpp"
23 #include "utils/vec3.hpp"
24 
25 class AbstractKart;
26 class Referee;
27 
32 {
33 protected:
34 friend class KartRewinder;
36  float m_velocity;
37 
41 
44 
45  /* Final transformation to place kart. */
46  btTransform m_rescue_transform;
47 
48  /* Compressed values for server to send to avoid compressing everytime. */
49  int m_rescue_transform_compressed[4];
50 
51  // ------------------------------------------------------------------------
53  // ------------------------------------------------------------------------
54  RescueAnimation(AbstractKart* kart, bool is_auto_rescue);
55  // ------------------------------------------------------------------------
56  void restoreData(BareNetworkString* b);
57  // ------------------------------------------------------------------------
58  void init(const btTransform& rescue_transform, float velocity);
59 public:
60  // ------------------------------------------------------------------------
61  static RescueAnimation* create(AbstractKart* kart,
62  bool is_auto_rescue = false);
63  // ------------------------------------------------------------------------
64  virtual ~RescueAnimation();
65  // ------------------------------------------------------------------------
66  virtual void update(int ticks);
67  // ------------------------------------------------------------------------
68  virtual void updateGraphics(float dt);
69  // ------------------------------------------------------------------------
70  virtual KartAnimationType getAnimationType() const { return KAT_RESCUE; }
71  // ------------------------------------------------------------------------
72  virtual void saveState(BareNetworkString* buffer);
73  // ------------------------------------------------------------------------
74  virtual void restoreState(BareNetworkString* buffer);
75 }; // RescueAnimation
76 #endif
virtual void restoreState(BareNetworkString *p, int count) OVERRIDE
Actually rewind to the specified state.
Definition: kart_rewinder.cpp:275
virtual void updateGraphics(float dt) OVERRIDE
Updates the graphics model.
Definition: kart_rewinder.hpp:60
virtual void init(RaceManager::KartType type) OVERRIDE
This is a second initialisation phase, necessary since in the constructor virtual functions are not c...
Definition: kart.cpp:194
virtual ~RescueAnimation()
This object is automatically destroyed when the timer expires.
Definition: rescue_animation.cpp:147
Referee * m_referee
The referee during a rescue operation.
Definition: rescue_animation.hpp:43
This implements the referee, a character that is displayed at the start of the race holding a 'ready-...
Definition: referee.hpp:44
virtual void update(int ticks)
Updates the kart animation.
Definition: rescue_animation.cpp:162
This triggers a rescue of the specified kart.
Definition: rescue_animation.hpp:31
Definition: kart_rewinder.hpp:29
Describes a chain of 8-bit unsigned integers.
Definition: network_string.hpp:52
int m_rescue_moment
When world ticks > this, it will move the kart above the m_rescue_transform.
Definition: rescue_animation.hpp:40
virtual BareNetworkString * saveState(std::vector< std::string > *ru) OVERRIDE
Saves all state information for a kart in a memory buffer.
Definition: kart_rewinder.cpp:165
The base class for all kart animation, like rescue, explosion, or cannon.
Definition: abstract_kart_animation.hpp:59
An abstract interface for the actual karts.
Definition: abstract_kart.hpp:61
float m_velocity
The velocity with which the kart is moved.
Definition: rescue_animation.hpp:36