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.

90 lines
2.2 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef REPLAYDEMO_H
  7. #define REPLAYDEMO_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include <filesystem.h>
  12. #include "demo.h"
  13. #include "demofile.h"
  14. #define TMP_REPLAY_FILENAME ".replay.tmp"
  15. class CReplayFrame;
  16. class CReplayServer;
  17. class CRecordingSessionBlock;
  18. class CReplayDemoRecorder : public IDemoRecorder
  19. {
  20. public:
  21. CReplayDemoRecorder( CReplayServer* pServer );
  22. virtual ~CReplayDemoRecorder();
  23. CDemoFile *GetDemoFile();
  24. int GetRecordingTick();
  25. private:
  26. friend class CReplayServer; // Calls to Start/StopRecording() should be funneled through CReplayServer
  27. void StartRecording();
  28. void StopRecording();
  29. const char *GetDemoFilename();
  30. public:
  31. void SetSignonState( int state ) {}
  32. bool IsRecording();
  33. void PauseRecording() {}
  34. void ResumeRecording() {}
  35. void RecordCommand( const char *cmdstring );
  36. void RecordUserInput( int cmdnumber ) {} ; // not need by Replay recorder
  37. void RecordMessages( bf_read &data, int bits );
  38. void RecordPacket();
  39. void RecordServerClasses( ServerClass *pClasses );
  40. void RecordStringTables();
  41. void ResetDemoInterpolation() {}
  42. void WriteFrame( CReplayFrame *pFrame );
  43. void CloseFile();
  44. void WriteServerInfo();
  45. int WriteSignonData(); // write all necessary signon data and returns written bytes
  46. void WriteMessages( unsigned char cmd, bf_write &message );
  47. int GetMaxAckTickCount();
  48. void GetUniqueDemoFilename( char* pOut, int nLength );
  49. const char *GetRecordingFilename();
  50. public:
  51. CDemoFile m_DemoFile;
  52. // TODO: I believe this can be removed
  53. char m_szDumpFilename[MAX_OSPATH]; // The name of the file name to which we are currently (or will eventually)
  54. // write the demo, depending on cvar, "replay_record_directly_to_disk"
  55. bool m_bIsRecording;
  56. bool m_bWrittenFirstFullUpdate;
  57. int m_nFrameCount;
  58. int m_nStartTick;
  59. int m_SequenceInfo;
  60. int m_nDeltaTick;
  61. int m_nSignonTick;
  62. bf_write m_MessageData; // temp buffer for all network messages
  63. CReplayServer *m_pReplayServer;
  64. private:
  65. void StartRecording( const char *pFilename, bool bContinuously );
  66. };
  67. #endif // REPLAYDEMO_H