added CDemoRecorder::TickCount() to get demo length by Batchyx

This commit is contained in:
oy 2010-12-08 00:48:02 +01:00
parent db9dd6b8c9
commit 974a40913d
2 changed files with 6 additions and 0 deletions

View file

@ -105,6 +105,7 @@ int CDemoRecorder::Start(class IStorage *pStorage, class IConsole *pConsole, con
m_LastKeyFrame = -1;
m_LastTickMarker = -1;
m_FirstTick = -1;
char aBuf[256];
str_format(aBuf, sizeof(aBuf), "Recording to '%s'", pFilename);
@ -164,6 +165,8 @@ void CDemoRecorder::WriteTickMarker(int Tick, int Keyframe)
}
m_LastTickMarker = Tick;
if(m_FirstTick < 0)
m_FirstTick = Tick;
}
void CDemoRecorder::Write(int Type, const void *pData, int Size)

View file

@ -22,6 +22,7 @@ class CDemoRecorder : public IDemoRecorder
IOHANDLE m_File;
int m_LastTickMarker;
int m_LastKeyFrame;
int m_FirstTick;
unsigned char m_aLastSnapshotData[CSnapshot::MAX_SIZE];
class CSnapshotDelta *m_pSnapshotDelta;
@ -37,6 +38,8 @@ public:
void RecordMessage(const void *pData, int Size);
bool IsRecording() const { return m_File != 0; }
int TickCount() const { return m_LastTickMarker - m_FirstTick; }
};
class CDemoPlayer : public IDemoPlayer