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.

115 lines
4.1 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. //=======================================================================================//
  4. #ifndef IENGINEREPLAY_H
  5. #define IENGINEREPLAY_H
  6. #ifdef _WIN32
  7. #pragma once
  8. #endif
  9. //----------------------------------------------------------------------------------------
  10. #include "interface.h"
  11. //----------------------------------------------------------------------------------------
  12. #define ENGINE_REPLAY_INTERFACE_VERSION "EngineReplay001"
  13. #if !defined( DEDICATED )
  14. # define ENGINE_REPLAY_CLIENT_INTERFACE_VERSION "EngineClientReplay001"
  15. #endif
  16. //----------------------------------------------------------------------------------------
  17. class IServer;
  18. class INetChannel;
  19. class IReplayServer;
  20. class IClientEntityList;
  21. class IClientReplay;
  22. struct demoheader_t;
  23. class CGlobalVarsBase;
  24. class IDemoBuffer;
  25. class CBaseRecordingSessionBlock;
  26. //----------------------------------------------------------------------------------------
  27. //
  28. // Allows the replay, client & server DLL's to talk to the engine
  29. //
  30. class IEngineReplay : public IBaseInterface
  31. {
  32. public:
  33. virtual bool IsSupportedModAndPlatform() = 0;
  34. virtual float GetHostTime() = 0;
  35. virtual int GetHostTickCount() = 0;
  36. virtual int TimeToTicks( float flTime ) = 0;
  37. virtual float TicksToTime( int nTick ) = 0;
  38. virtual bool ReadDemoHeader( const char *pFilename, demoheader_t &header ) = 0;
  39. virtual const char *GetGameDir() = 0;
  40. virtual void Cbuf_AddText( const char *pCmd ) = 0;
  41. virtual void Cbuf_Execute() = 0;
  42. virtual void Host_Disconnect( bool bShowMainMenu ) = 0;
  43. virtual void HostState_Shutdown() = 0;
  44. virtual const char *GetModDir() = 0;
  45. virtual bool CopyFile( const char *pSource, const char *pDest ) = 0;
  46. virtual bool LZSS_Compress( char *pDest, unsigned int *pDestLen, const char *pSource, unsigned int nSourceLen ) = 0;
  47. virtual bool LZSS_Decompress( char *pDest, unsigned int *pDestLen, const char *pSource, unsigned int nSourceLen ) = 0;
  48. virtual bool MD5_HashBuffer( unsigned char pDigest[16], const unsigned char *pBuffer, int nSize, unsigned int pSeed[4] ) = 0;
  49. // Server-specific
  50. virtual IReplayServer *GetReplayServer() = 0;
  51. virtual IServer *GetReplayServerAsIServer() = 0;
  52. virtual IServer *GetGameServer() = 0;
  53. virtual bool GetSessionRecordBuffer( uint8 **ppSessionBuffer, int *pSize ) = 0;
  54. virtual bool IsDedicated() = 0;
  55. virtual void ResetReplayRecordBuffer() = 0;
  56. virtual demoheader_t *GetReplayDemoHeader() = 0;
  57. virtual void RecalculateTags() = 0;
  58. virtual bool NET_GetHostnameAsIP( const char *pHostname, char *pOut, int nOutSize ) = 0;
  59. };
  60. //
  61. // Allows the replay and client DLL's to talk to the engine
  62. //
  63. #if !defined( DEDICATED )
  64. class IEngineClientReplay : public IBaseInterface
  65. {
  66. public:
  67. virtual INetChannel *GetNetChannel() = 0;
  68. virtual bool IsConnected() = 0;
  69. virtual bool IsListenServer() = 0;
  70. virtual float GetLastServerTickTime() = 0;
  71. virtual const char *GetLevelName() = 0;
  72. virtual const char *GetLevelNameShort() = 0;
  73. virtual int GetPlayerSlot() = 0;
  74. virtual bool IsPlayingReplayDemo() = 0;
  75. virtual IClientEntityList *GetClientEntityList() = 0;
  76. virtual IClientReplay *GetClientReplayInt() = 0;
  77. virtual uint32 GetClientSteamID() = 0;
  78. virtual void Con_NPrintf( int nPos, PRINTF_FORMAT_STRING const char *pFormat, ... ) = 0;
  79. virtual CGlobalVarsBase *GetClientGlobalVars() = 0;
  80. virtual void VGui_PlaySound( const char *pSound ) = 0;
  81. virtual void EngineVGui_ConfirmQuit() = 0;
  82. virtual int GetScreenWidth() = 0;
  83. virtual int GetScreenHeight() = 0;
  84. virtual bool IsDemoPlayingBack() = 0;
  85. virtual bool IsGamePathValidAndSafeForDownload( const char *pGamePath ) = 0;
  86. virtual bool IsInGame() = 0;
  87. virtual void InitSoundRecord() = 0;
  88. virtual void Wave_CreateTmpFile( const char *pFilename ) = 0;
  89. virtual void Wave_AppendTmpFile( const char *pFilename, void *pBuffer, int nNumSamples ) = 0;
  90. virtual void Wave_FixupTmpFile( const char *pFilename ) = 0;
  91. };
  92. #endif // !defined( DEDICATED )
  93. //----------------------------------------------------------------------------------------
  94. #endif // IENGINEREPLAY_H