summaryrefslogtreecommitdiff
path: root/game/client/tf/tf_replay.h
blob: 238b700f3ec24f26a7d93fa0a172b3ed33f3b5d7 (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
//========= Copyright Valve Corporation, All rights reserved. ============//
//=======================================================================================//

#if defined( REPLAY_ENABLED )

#ifndef TF_REPLAY_H
#define TF_REPLAY_H
#ifdef _WIN32
#pragma once
#endif

//----------------------------------------------------------------------------------------

#include "replay/genericclassbased_replay.h"

//----------------------------------------------------------------------------------------

class CTFReplay : public CGenericClassBasedReplay
{
	typedef CGenericClassBasedReplay BaseClass;
public:
	CTFReplay();
	~CTFReplay();

	virtual void OnBeginRecording();
	virtual void OnEndRecording();
	virtual void OnComplete();
	virtual void FireGameEvent( IGameEvent *pEvent );

	virtual bool Read( KeyValues *pIn );
	virtual void Write( KeyValues *pOut );

	virtual void DumpGameSpecificData() const;

	virtual const char *GetPlayerClass() const { return g_aPlayerClassNames_NonLocalized[ m_nPlayerClass ]; }
	virtual const char *GetPlayerTeam() const { return m_nPlayerTeam == TF_TEAM_RED ? "red" : "blu"; }
	virtual const char *GetMaterialFriendlyPlayerClass() const;

private:
	virtual void Update();
	void MedicUpdate();
	float GetSentryKillScreenshotDelay();

	virtual bool IsValidClass( int nClass ) const;
	virtual bool IsValidTeam( int iTeam ) const;
	virtual bool GetCurrentStats( RoundStats_t &out );
	virtual const char *GetStatString( int iStat ) const;
	virtual const char *GetPlayerClass( int iClass ) const;

	float			m_flNextMedicUpdateTime;
};

//----------------------------------------------------------------------------------------

inline CTFReplay *ToTFReplay( CReplay *pClientReplay )
{
	return static_cast< CTFReplay * >( pClientReplay );
}

inline const CTFReplay *ToTFReplay( const CReplay *pClientReplay )
{
	return static_cast< const CTFReplay * >( pClientReplay );
}

inline CTFReplay *GetTFReplay( ReplayHandle_t hReplay )
{
	return ToTFReplay( g_pClientReplayContext->GetReplay( hReplay ) );
}

//----------------------------------------------------------------------------------------

#endif	// TF_REPLAY_H

#endif