blob: 4fa6129b88907c7a82e7a625babaf05f908010b1 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//=======================================================================================//
#if defined( REPLAY_ENABLED )
#ifndef REPLAYDEMOPLAYER_H
#define REPLAYDEMOPLAYER_H
#ifdef _WIN32
#pragma once
#endif
//----------------------------------------------------------------------------------------
#include "replay/ireplaydemoplayer.h"
#include "replay/ireplaymovie.h"
#include "cl_demo.h"
#include "utlstring.h"
//----------------------------------------------------------------------------------------
class CReplay;
//----------------------------------------------------------------------------------------
class CReplayDemoPlayer : public CDemoPlayer,
public IReplayDemoPlayer
{
public:
typedef CDemoPlayer BaseClass;
CReplayDemoPlayer();
virtual bool StartPlayback( const char *pFilename, bool bAsTimeDemo );
virtual void StopPlayback();
virtual void OnLastDemoInLoopPlayed();
virtual bool ShouldLoopDemos();
//
// IReplayDemoPlayer
//
virtual void PlayReplay( ReplayHandle_t hReplay, int iPerformance );
virtual void PlayNextReplay();
virtual void ClearReplayList();
virtual void AddReplayToList( ReplayHandle_t hReplay, int iPerformance );
virtual CReplay *GetCurrentReplay();
virtual CReplayPerformance *GetCurrentPerformance();
virtual void PauseReplay();
virtual bool IsReplayPaused();
virtual void ResumeReplay();
virtual void OnSignonStateFull();
//
// CDemoPlayer
//
virtual void OnStopCommand();
virtual netpacket_t *ReadPacket();
virtual float GetPlaybackTimeScale();
private:
void DisplayFailedToPlayMsg( int iPerformance );
float CalcMovieLength() const;
class CInStartPlaybackGuard
{
public:
CInStartPlaybackGuard( bool &bState ) : m_bState( bState ) { m_bState = true; }
~CInStartPlaybackGuard() { m_bState = false; }
bool &m_bState;
};
struct PlaybackInfo_t
{
PlaybackInfo_t() : m_hReplay( REPLAY_HANDLE_INVALID ), m_iPerformance( -1 ),
m_nStartTick( -1 ), m_nEndTick( -1 ) {}
ReplayHandle_t m_hReplay;
int m_iPerformance;
int m_nStartTick;
int m_nEndTick;
};
PlaybackInfo_t *GetCurrentPlaybackInfo();
const PlaybackInfo_t *GetCurrentPlaybackInfo() const;
const CReplay *GetCurrentReplay() const;
CUtlVector< PlaybackInfo_t * > m_vecReplaysToPlay;
IReplayMovie *m_pMovie;
int m_nCurReplayIndex;
bool m_bInStartPlayback;
bool m_bStopCommandEncountered; // We only want to handle OnStopCommand() once per playback
float m_flStartRenderTime;
bool m_bFullSignonStateReached;
};
//----------------------------------------------------------------------------------------
extern IDemoPlayer *g_pReplayDemoPlayer;
//----------------------------------------------------------------------------------------
#endif // REPLAYDEMOPLAYER_H
#endif // #if defined( REPLAY_ENABLED )
|