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.

72 lines
1.9 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $Revision: $
  6. // $NoKeywords: $
  7. //=============================================================================//
  8. #ifndef TF_DEMO_SUPPORT_H
  9. #define TF_DEMO_SUPPORT_H
  10. #define EVENTS_FILENAME "_events.txt"
  11. enum EDemoEventType
  12. {
  13. eDemoEvent_Bookmark,
  14. eDemoEvent_Killstreak,
  15. // also need to update g_aDemoEventNames
  16. eDemoEvent_Last,
  17. };
  18. struct DemoEvent_t
  19. {
  20. EDemoEventType type;
  21. int value;
  22. int tick;
  23. };
  24. //-----------------------------------------------------------------------------
  25. // Purpose:
  26. //-----------------------------------------------------------------------------
  27. class CTFDemoSupport : public CAutoGameSystemPerFrame, public CGameEventListener
  28. {
  29. public:
  30. CTFDemoSupport();
  31. virtual bool Init() OVERRIDE;
  32. virtual void Update( float frametime ) OVERRIDE;
  33. virtual char const *Name() OVERRIDE { return "CTFDemoSupport"; }
  34. virtual void FireGameEvent( IGameEvent *event ) OVERRIDE;
  35. virtual void LevelInitPostEntity() OVERRIDE;
  36. virtual void LevelShutdownPostEntity() OVERRIDE;
  37. bool StartRecording( void );
  38. void StopRecording( bool bFromEngine = false );
  39. bool IsRecording( void ){ return m_bRecording; }
  40. void BookMarkCurrentTick( const char *pszValue = NULL );
  41. void Status( void );
  42. private:
  43. bool IsValidPath( const char *pszFolder );
  44. void LogEvent( EDemoEventType eType, int nValue = 0, const char *pszValue = NULL );
  45. void Notify( char *pszMessage );
  46. bool m_bRecording;
  47. char m_szFolder[24];
  48. char m_szFilename[MAX_PATH];
  49. char m_szFolderAndFilename[MAX_PATH];
  50. int m_nKillCount;
  51. float m_flLastKill;
  52. float m_flScreenshotTime;
  53. FileHandle_t m_hGlobalEventList;
  54. GCSDK::CWebAPIResponse m_DemoSpecificEventList;
  55. GCSDK::CWebAPIValues *m_pRoot;
  56. GCSDK::CWebAPIValues *m_pChildArray;
  57. bool m_bAlreadyAutoRecordedOnce;
  58. float m_flNextRecordStartCheckTime;
  59. bool m_bFirstEvent;
  60. int m_nStartingTickCount;
  61. bool m_bHasAtLeastOneEvent;
  62. };
  63. #endif // TF_DEMO_SUPPORT_H