diff --git a/src/engine/shared/demo.cpp b/src/engine/shared/demo.cpp index 91ac4ba3b..0433d6a37 100644 --- a/src/engine/shared/demo.cpp +++ b/src/engine/shared/demo.cpp @@ -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) diff --git a/src/engine/shared/demo.h b/src/engine/shared/demo.h index 79b0021a6..d8ce70b22 100644 --- a/src/engine/shared/demo.h +++ b/src/engine/shared/demo.h @@ -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