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.

88 lines
3.2 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef DEMO_H
  8. #define DEMO_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "utlvector.h"
  13. #include "net.h"
  14. #include "demofile/demoformat.h"
  15. class CUtlBuffer;
  16. class CDemoFile;
  17. class ServerClass;
  18. abstract_class IDemoRecorder
  19. {
  20. public:
  21. ~IDemoRecorder() {}
  22. virtual CDemoFile *GetDemoFile() = 0;
  23. virtual int GetRecordingTick( void ) = 0;
  24. virtual void StartRecording( const char *filename, bool bContinuously ) = 0;
  25. virtual void SetSignonState( int state ) = 0;
  26. virtual bool IsRecording( void ) = 0;
  27. virtual void PauseRecording( void ) = 0;
  28. virtual void ResumeRecording( void ) = 0;
  29. virtual void StopRecording( void ) = 0;
  30. virtual void RecordCommand( const char *cmdstring ) = 0; // record a console command
  31. virtual void RecordUserInput( int cmdnumber ) = 0; // record a user input command
  32. virtual void RecordMessages( bf_read &data, int bits ) = 0; // add messages to current packet
  33. virtual void RecordPacket( void ) = 0; // packet finished, write all recorded stuff to file
  34. virtual void RecordServerClasses( ServerClass *pClasses ) = 0; // packet finished, write all recorded stuff to file
  35. virtual void RecordStringTables() = 0;
  36. virtual void ResetDemoInterpolation() = 0;
  37. };
  38. abstract_class IDemoPlayer
  39. {
  40. public:
  41. virtual ~IDemoPlayer() {};
  42. virtual CDemoFile *GetDemoFile() = 0;
  43. virtual int GetPlaybackStartTick( void ) = 0;
  44. virtual int GetPlaybackTick( void ) = 0;
  45. virtual int GetTotalTicks( void ) = 0;
  46. virtual bool StartPlayback( const char *filename, bool bAsTimeDemo ) = 0;
  47. virtual bool IsPlayingBack( void ) = 0; // true if demo loaded and playing back
  48. virtual bool IsPlaybackPaused( void ) = 0; // true if playback paused
  49. virtual bool IsPlayingTimeDemo( void ) = 0; // true if playing back in timedemo mode
  50. virtual bool IsSkipping( void ) = 0; // true, if demo player skiiping trough packets
  51. virtual bool CanSkipBackwards( void ) = 0; // true if demoplayer can skip backwards
  52. virtual void SetPlaybackTimeScale( float timescale ) = 0; // sets playback timescale
  53. virtual float GetPlaybackTimeScale( void ) = 0; // get playback timescale
  54. virtual void PausePlayback( float seconds ) = 0; // pause playback n seconds, -1 = forever
  55. virtual void SkipToTick( int tick, bool bRelative, bool bPause ) = 0; // goto a specific tick, 0 = start, -1 = end
  56. virtual void SetEndTick( int tick ) = 0; // set end tick
  57. virtual void ResumePlayback( void ) = 0; // resume playback
  58. virtual void StopPlayback( void ) = 0; // stop playback, close file
  59. virtual void InterpolateViewpoint() = 0; // override viewpoint
  60. virtual netpacket_t *ReadPacket( void ) = 0; // read packet from demo file
  61. virtual void ResetDemoInterpolation() = 0;
  62. virtual int GetProtocolVersion() = 0;
  63. virtual bool ShouldLoopDemos() = 0; // if we're in "startdemos" - should we loop?
  64. virtual void OnLastDemoInLoopPlayed() = 0; // Last demo of "startdemos" just completed
  65. virtual bool IsLoading( void ) = 0; // true if demo is currently loading
  66. };
  67. extern IDemoPlayer *demoplayer; // reference to current demo player
  68. extern IDemoRecorder *demorecorder; // reference to current demo recorder
  69. #endif // DEMO_H