SuperTuxKart
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
ReplayRecorder Class Reference
Inheritance diagram for ReplayRecorder:
Inheritance graph
[legend]

Public Member Functions

void init ()
 Initialise the replay recorder.
 
void reset ()
 Reset the replay recorder.
 
void save ()
 Saves the replay data stored in the internal data structures.
 
void update (int ticks)
 Saves the current replay data.
 
const uint64_t getLastUID ()
 
virtual const std::string & getReplayFilename (int replay_file_number=1) const
 Returns the filename that was opened.
 

Static Public Member Functions

static int enumToCode (Attachment::AttachmentType type)
 Functions to encode and decode attahcments and item types, so that the stored value is independent from internal representation and resilient to such changes.
 
static int enumToCode (PowerupManager::PowerupType type)
 
static Attachment::AttachmentType codeToEnumAttach (int code)
 
static PowerupManager::PowerupType codeToEnumItem (int code)
 
static void create ()
 Creates a new instance of the replay object.
 
static ReplayRecorderget ()
 Returns the instance of the replay object.
 
static void destroy ()
 Delete the instance of the replay object.
 

Private Member Functions

uint64_t computeUID (float min_time)
 Compute the replay's UID ; partly based on race data ; partly randomly.
 
 ReplayRecorder ()
 Initialises the Replay engine.
 
 ~ReplayRecorder ()
 Frees all stored data.
 

Private Attributes

std::string m_filename
 
std::vector< std::vector< TransformEvent > > m_transform_events
 A separate vector of Replay Events for all transforms.
 
std::vector< std::vector< PhysicInfo > > m_physic_info
 A separate vector of Replay Events for all physic info.
 
std::vector< std::vector< BonusInfo > > m_bonus_info
 A separate vector of Replay Events for all item/nitro info.
 
std::vector< std::vector< KartReplayEvent > > m_kart_replay_event
 A separate vector of Replay Events for all other events.
 
std::vector< float > m_last_saved_time
 Time at which a transform was saved for the last time.
 
std::vector< unsigned int > m_count_transforms
 Counts the number of transform events for each kart.
 
bool m_complete_replay
 
bool m_incorrect_replay
 
unsigned int m_max_frames
 
float m_previous_steer = 0.0f
 
const float DISTANCE_FAST_UPDATES = 10.0f
 
const float DISTANCE_MAX_UPDATES = 1.0f
 
uint64_t m_last_uid
 

Static Private Attributes

static ReplayRecorderm_replay_recorder = NULL
 Static pointer to the one instance of the replay object.
 

Additional Inherited Members

- Protected Member Functions inherited from ReplayBase
FILE * openReplayFile (bool writeable, bool full_path=false, int replay_file_number=1)
 Opens a replay file which is determined by sub classes.
 
virtual const std::string & getReplayFilename (int replay_file_number=1) const =0
 Returns the filename that was opened.
 
unsigned int getCurrentReplayVersion () const
 Returns the version number of the replay file recorderd by this executable.
 
unsigned int getMinSupportedReplayVersion () const
 This is used to check that a loaded replay file can still be understood by this executable.
 

Member Function Documentation

◆ get()

static ReplayRecorder * ReplayRecorder::get ( )
inlinestatic

Returns the instance of the replay object.

Returns NULL if no recorder is available, i.e. recording can be disabled.

◆ getReplayFilename()

virtual const std::string & ReplayRecorder::getReplayFilename ( int  replay_file_number = 1) const
inlinevirtual

Returns the filename that was opened.

Implements ReplayBase.

◆ init()

void ReplayRecorder::init ( )

Initialise the replay recorder.

It especially allocates memory to store the replay data.

◆ update()

void ReplayRecorder::update ( int  ticks)

Saves the current replay data.

Parameters
ticksNumber of physics time steps - should be 1.

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