SuperTuxKart
replay_base.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_REPLAY_BASE_HPP
20 #define HEADER_REPLAY_BASE_HPP
21 
22 #include "LinearMath/btTransform.h"
23 #include "utils/no_copy.hpp"
24 
25 #include <stdio.h>
26 #include <string>
27 #include <vector>
28 
32 class ReplayBase : public NoCopy
33 {
34  // Needs access to KartReplayEvent
35  friend class GhostKart;
36 
37 protected:
41  {
43  float m_time;
45  btTransform m_transform;
46  }; // TransformEvent
47 
48  // ------------------------------------------------------------------------
49  struct PhysicInfo
50  {
52  float m_speed;
54  float m_steer;
56  float m_suspension_length[4];
59  }; // PhysicInfo
60 
61  // ------------------------------------------------------------------------
62  struct BonusInfo
63  {
79  }; // StateInfo
80 
81 
82  // ------------------------------------------------------------------------
85  {
87  float m_distance;
97  bool m_jumping;
98  }; // KartReplayEvent
99 
100  // ------------------------------------------------------------------------
101  FILE *openReplayFile(bool writeable, bool full_path = false, int replay_file_number=1);
102  // ------------------------------------------------------------------------
104  virtual const std::string& getReplayFilename(int replay_file_number = 1) const = 0;
105  // ------------------------------------------------------------------------
108  unsigned int getCurrentReplayVersion() const { return 4; }
109 
110  // ------------------------------------------------------------------------
113  unsigned int getMinSupportedReplayVersion() const { return 3; }
114 
115 public:
116  ReplayBase();
117  virtual ~ReplayBase() {};
118 }; // ReplayBase
119 
120 #endif
float m_nitro_amount
The nitro amount at a certain time.
Definition: replay_base.hpp:71
int m_item_amount
The number of items at a certain time.
Definition: replay_base.hpp:73
Definition: replay_base.hpp:62
int m_attachment
The attachment.
Definition: replay_base.hpp:69
int m_special_value
Used to store mode-specific values : eggs in egg-hunt, number of lives in battle-mode.
Definition: replay_base.hpp:78
float m_time
Time at which this event happens.
Definition: replay_base.hpp:43
virtual const std::string & getReplayFilename(int replay_file_number=1) const =0
Returns the filename that was opened.
int m_item_type
The type of item at a certain time.
Definition: replay_base.hpp:75
unsigned int getMinSupportedReplayVersion() const
This is used to check that a loaded replay file can still be understood by this executable.
Definition: replay_base.hpp:113
int m_skidding_effect
Skidding effect for the kart recorded.
Definition: replay_base.hpp:93
bool m_zipper_usage
Zipper usage for the kart recorded.
Definition: replay_base.hpp:91
bool m_red_skidding
Kart skidding showing red flame or not.
Definition: replay_base.hpp:95
btTransform m_transform
The transform at a certain time.
Definition: replay_base.hpp:45
Records all other events.
Definition: replay_base.hpp:84
Stores a transform event, i.e.
Definition: replay_base.hpp:40
Utility class, you can inherit from this class to disallow the assignment operator and copy construct...
Definition: no_copy.hpp:25
bool m_jumping
True if the kart recorded is jumping.
Definition: replay_base.hpp:97
int m_skidding_state
The skidding state.
Definition: replay_base.hpp:58
A ghost kart.
Definition: ghost_kart.hpp:37
Definition: replay_base.hpp:32
Definition: replay_base.hpp:49
float m_distance
distance on track for the kart recorded.
Definition: replay_base.hpp:87
int m_nitro_usage
Nitro usage for the kart recorded.
Definition: replay_base.hpp:89
FILE * openReplayFile(bool writeable, bool full_path=false, int replay_file_number=1)
Opens a replay file which is determined by sub classes.
Definition: replay_base.cpp:33
float m_steer
The steering at a certain time.
Definition: replay_base.hpp:54
float m_speed
The speed at a certain time.
Definition: replay_base.hpp:52
unsigned int getCurrentReplayVersion() const
Returns the version number of the replay file recorderd by this executable.
Definition: replay_base.hpp:108