2010-11-20 10:37:14 +00:00
|
|
|
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
|
|
|
|
/* If you are missing that file, acquire a complete release at teeworlds.com. */
|
2010-05-29 07:25:38 +00:00
|
|
|
#ifndef ENGINE_DEMO_H
|
|
|
|
#define ENGINE_DEMO_H
|
|
|
|
|
|
|
|
#include "kernel.h"
|
|
|
|
|
2012-01-10 22:13:19 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
MAX_TIMELINE_MARKERS=64
|
|
|
|
};
|
|
|
|
|
2016-11-07 09:19:32 +00:00
|
|
|
const double g_aSpeeds[] = {0.1, 0.25, 0.5, 0.75, 1.0, 1.5, 2.0, 4.0, 8.0};
|
2016-10-28 07:31:22 +00:00
|
|
|
|
2017-02-28 09:08:14 +00:00
|
|
|
typedef bool (*DEMOFUNC_FILTER)(const void *pData, int DataSize, void *pUser);
|
|
|
|
|
2011-03-13 09:41:10 +00:00
|
|
|
struct CDemoHeader
|
|
|
|
{
|
|
|
|
unsigned char m_aMarker[7];
|
|
|
|
unsigned char m_Version;
|
|
|
|
char m_aNetversion[64];
|
|
|
|
char m_aMapName[64];
|
2011-04-02 09:55:37 +00:00
|
|
|
unsigned char m_aMapSize[4];
|
2011-03-13 09:41:10 +00:00
|
|
|
unsigned char m_aMapCrc[4];
|
|
|
|
char m_aType[8];
|
|
|
|
char m_aLength[4];
|
|
|
|
char m_aTimestamp[20];
|
2013-02-25 23:00:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct CTimelineMarkers
|
|
|
|
{
|
2012-01-10 22:13:19 +00:00
|
|
|
char m_aNumTimelineMarkers[4];
|
|
|
|
char m_aTimelineMarkers[MAX_TIMELINE_MARKERS][4];
|
2011-03-13 09:41:10 +00:00
|
|
|
};
|
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
class IDemoPlayer : public IInterface
|
|
|
|
{
|
|
|
|
MACRO_INTERFACE("demoplayer", 0)
|
|
|
|
public:
|
|
|
|
class CInfo
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
bool m_Paused;
|
|
|
|
float m_Speed;
|
|
|
|
|
|
|
|
int m_FirstTick;
|
|
|
|
int m_CurrentTick;
|
|
|
|
int m_LastTick;
|
2012-01-10 22:13:19 +00:00
|
|
|
|
|
|
|
int m_NumTimelineMarkers;
|
|
|
|
int m_aTimelineMarkers[MAX_TIMELINE_MARKERS];
|
2010-05-29 07:25:38 +00:00
|
|
|
};
|
|
|
|
|
2011-03-12 17:07:57 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
DEMOTYPE_INVALID=0,
|
|
|
|
DEMOTYPE_CLIENT,
|
|
|
|
DEMOTYPE_SERVER,
|
|
|
|
};
|
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
~IDemoPlayer() {}
|
|
|
|
virtual void SetSpeed(float Speed) = 0;
|
2016-10-28 07:31:22 +00:00
|
|
|
virtual void SetSpeedIndex(int Offset) = 0;
|
2012-01-10 22:13:19 +00:00
|
|
|
virtual int SetPos(float Percent) = 0;
|
2010-05-29 07:25:38 +00:00
|
|
|
virtual void Pause() = 0;
|
|
|
|
virtual void Unpause() = 0;
|
2014-04-26 19:00:14 +00:00
|
|
|
virtual bool IsPlaying() const = 0;
|
2010-05-29 07:25:38 +00:00
|
|
|
virtual const CInfo *BaseInfo() const = 0;
|
2011-06-09 20:44:22 +00:00
|
|
|
virtual void GetDemoName(char *pBuffer, int BufferSize) const = 0;
|
2011-03-13 09:41:10 +00:00
|
|
|
virtual bool GetDemoInfo(class IStorage *pStorage, const char *pFilename, int StorageType, CDemoHeader *pDemoHeader) const = 0;
|
2011-03-12 17:07:57 +00:00
|
|
|
virtual int GetDemoType() const = 0;
|
2010-05-29 07:25:38 +00:00
|
|
|
};
|
|
|
|
|
2010-08-09 12:14:15 +00:00
|
|
|
class IDemoRecorder : public IInterface
|
|
|
|
{
|
|
|
|
MACRO_INTERFACE("demorecorder", 0)
|
|
|
|
public:
|
|
|
|
~IDemoRecorder() {}
|
|
|
|
virtual bool IsRecording() const = 0;
|
2017-07-08 11:38:27 +00:00
|
|
|
virtual int Stop() = 0;
|
2011-03-12 17:34:16 +00:00
|
|
|
virtual int Length() const = 0;
|
2010-08-09 12:14:15 +00:00
|
|
|
};
|
|
|
|
|
2014-08-12 14:21:06 +00:00
|
|
|
class IDemoEditor : public IInterface
|
|
|
|
{
|
|
|
|
MACRO_INTERFACE("demoeditor", 0)
|
|
|
|
public:
|
|
|
|
|
2017-02-28 09:08:14 +00:00
|
|
|
virtual void Slice(const char *pDemo, const char *pDst, int StartTick, int EndTick, DEMOFUNC_FILTER pfnFilter, void *pUser) = 0;
|
2014-08-12 14:21:06 +00:00
|
|
|
};
|
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
#endif
|