Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

70 lines
2.1 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //=======================================================================================//
  3. #if defined( REPLAY_ENABLED )
  4. #ifndef CS_REPLAY_H
  5. #define CS_REPLAY_H
  6. #ifdef _WIN32
  7. #pragma once
  8. #endif
  9. //----------------------------------------------------------------------------------------
  10. #include "replay/genericclassbased_replay.h"
  11. //----------------------------------------------------------------------------------------
  12. class CCSReplay : public CGenericClassBasedReplay
  13. {
  14. typedef CGenericClassBasedReplay BaseClass;
  15. public:
  16. CCSReplay();
  17. ~CCSReplay();
  18. virtual void OnBeginRecording();
  19. virtual void OnEndRecording();
  20. virtual void OnComplete();
  21. virtual void FireGameEvent( IGameEvent *pEvent );
  22. virtual bool Read( KeyValues *pIn );
  23. virtual void Write( KeyValues *pOut );
  24. virtual void DumpGameSpecificData() const;
  25. virtual const char *GetPlayerClass() const { return GetCSClassInfo( m_nPlayerClass )->m_pClassName; }
  26. virtual const char *GetPlayerTeam() const { return m_nPlayerTeam == TEAM_TERRORIST ? "terrorists" : "counterterrorists"; }
  27. virtual const char *GetMaterialFriendlyPlayerClass() const;
  28. private:
  29. virtual void Update();
  30. float GetSentryKillScreenshotDelay();
  31. virtual bool IsValidClass( int nClass ) const;
  32. virtual bool IsValidTeam( int iTeam ) const;
  33. virtual bool GetCurrentStats( RoundStats_t &out );
  34. virtual const char *GetStatString( int iStat ) const;
  35. virtual const char *GetPlayerClass( int iClass ) const;
  36. };
  37. //----------------------------------------------------------------------------------------
  38. inline CCSReplay *ToCSReplay( CReplay *pClientReplay )
  39. {
  40. return static_cast< CCSReplay * >( pClientReplay );
  41. }
  42. inline const CCSReplay *ToCSReplay( const CReplay *pClientReplay )
  43. {
  44. return static_cast< const CCSReplay * >( pClientReplay );
  45. }
  46. inline CCSReplay *GetCSReplay( ReplayHandle_t hReplay )
  47. {
  48. return ToCSReplay( g_pClientReplayContext->GetReplay( hReplay ) );
  49. }
  50. //----------------------------------------------------------------------------------------
  51. #endif // CS_REPLAY_H
  52. #endif