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.

104 lines
5.6 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. //=======================================================================================//
  4. #ifndef ICLIENTREPLAYHISTORYMANAGER_H
  5. #define ICLIENTREPLAYHISTORYMANAGER_H
  6. #ifdef _WIN32
  7. #pragma once
  8. #endif
  9. //----------------------------------------------------------------------------------------
  10. #include "replay/replayhandle.h"
  11. #include "replay/screenshot.h"
  12. #include "interface.h"
  13. #include "qlimits.h"
  14. #include "convar.h"
  15. #include "engine/http.h"
  16. #include "tier1/utllinkedlist.h"
  17. #include "tier1/checksum_crc.h"
  18. #include <time.h>
  19. //----------------------------------------------------------------------------------------
  20. class IReplayDownloadGroup;
  21. class IReplayDownloadGroupHelper;
  22. class CDmxElement;
  23. class KeyValues;
  24. struct CaptureScreenshotParams_t;
  25. struct RenderMovieParams_t;
  26. class CBaseReplay;
  27. class CReplay;
  28. class IReplayMovieRenderer;
  29. class IReplayMovieManager;
  30. class IReplayMovie;
  31. class IReplayPerformanceManager;
  32. class IGameEvent;
  33. //----------------------------------------------------------------------------------------
  34. class IClientReplayHistoryManager : public IBaseInterface
  35. {
  36. public:
  37. virtual bool Init( CreateInterfaceFn fnCreateFactory ) = 0;
  38. virtual void Shutdown() = 0;
  39. virtual void Think() = 0;
  40. virtual bool IsInitialized() const = 0;
  41. virtual bool Commit( CBaseReplay *pNewReplay ) = 0;
  42. virtual void Save() = 0; // Write the entire index and any replays/groups/movies that are marked as dirty
  43. virtual void FlagReplayForFlush( CBaseReplay *pReplay, bool bForceImmediateWrite ) = 0; // Mark the given replay as dirty - flush to disk at the next opportunity (see CBaseReplayHistoryManager::FlushThink())
  44. virtual void Nuke() = 0;
  45. virtual void DeleteReplay( ReplayHandle_t hReplay, bool bNotifyUI ) = 0;
  46. virtual CBaseReplay *GetReplay( ReplayHandle_t hReplay ) = 0;
  47. virtual const char *GetBaseDirectory() = 0; // Returns full directory to wherever replays.dmx lives, e.g. c:\program files (x86)\steam\steamapps\someuser\team fortress 2\game\tf\replays\client\ (or server\) - NOTE: includes trailing slash
  48. virtual const char *GetReplaysSubDir() = 0; // Returns "client" or "server"
  49. // For loop through all replays - indices should not be cached
  50. virtual int GetReplayCount() const = 0;
  51. // virtual CBaseReplay *GetReplayAtIndex( int nIndex ) = 0;
  52. virtual const char *GetFullReplayPath() = 0; // Get c:\...\game\tf\replays\<client or server>\
  53. // Client-specific
  54. virtual int GetAdjustedDeathTick( CReplay *pReplay ) = 0;
  55. virtual void FlagDownloadGroupForFlush( IReplayDownloadGroup *pGroup, bool bForceImmediate ) = 0;
  56. virtual void FlagMovieForFlush( IReplayMovie *pMovie, bool bForceImmediate ) = 0; // Flag the movie for flush - if pMovie is NULL, mark the index for flush
  57. virtual void SetMovieRenderer( IReplayMovieRenderer *pRenderer ) = 0; // Set to be the panel that renders replay movies, or NULL when nothing is rendering
  58. virtual bool ShouldGameRenderView() = 0; // Called from V_RenderView() to determine whether the game should render - used during movie rendering
  59. virtual int GetUnrenderedReplayCount() = 0; // Get the number of unrendered replays
  60. virtual void UpdateCurrentReplayDataFromServer() = 0; // Updates start tick, current file url, demo filename
  61. virtual void LinkReplayToDownloadGroup() = 0;
  62. virtual void CaptureScreenshot( CaptureScreenshotParams_t &params ) = 0; // Schedules a screenshot capture at flDelay seconds in the future
  63. virtual void DoCaptureScreenshot() = 0; // Takes the screenshot right now
  64. virtual bool ShouldCaptureScreenshot() = 0; // Is screenshot scheduled to be taken right now?
  65. virtual void GetUnpaddedScreenshotSize( int &nWidth, int &nHeight ) = 0; // Get the dimensions for a screenshot if we take one right now, based on replay_screenshotresolution and the current aspect ratio
  66. virtual void DeleteScreenshotsForReplay( CReplay *pReplay ) = 0; // Deletes all screenshots associated with the given replay
  67. virtual void PlayReplay( ReplayHandle_t hReplay ) = 0; // Play the given replay, from spawn tick to death tick
  68. virtual void RenderMovie( RenderMovieParams_t const& params ) = 0; // Renders the given replay - or if params.hReplay is -1, render all unrendered replays
  69. virtual void CompleteRender( bool bSuccess ) = 0;
  70. virtual void OnClientSideDisconnect() = 0; // Called when client disconnects
  71. virtual void OnSignonStateFull() = 0;
  72. virtual void OnPlayerSpawn() = 0; // Called on the client when player is spawned
  73. virtual void OnPlayerClassChanged() = 0; // Called when the player's class changes - we use this instead of an event for immediacy
  74. virtual void OnReplayRecordingCvarChanged() = 0; // Called (on client only) when replay_recording is set to 1
  75. virtual void OnGroupDeleted() = 0;
  76. virtual CReplay *GetPlayingReplay() = 0; // Get the currently playing replay, otherwise NULL if one isn't playing
  77. virtual CReplay *GetReplayForCurrentLife() = 0; // Gets the current replay (constant from local player spawn until next spawn/disconnect/exit)
  78. virtual bool IsRendering() = 0; // Are we currently rendering a movie?
  79. virtual void CancelRender() = 0; // If we're currently rendering, cancel
  80. virtual IReplayMovieManager *GetMovieManager() = 0;
  81. virtual IReplayMovieRenderer *GetMovieRenderer() = 0;
  82. virtual const RenderMovieParams_t *GetRenderSettings() = 0;
  83. virtual IReplayDownloadGroupHelper *GetDownloadGroupHelper() = 0;
  84. virtual IReplayPerformanceManager *GetPerformanceManager() = 0;
  85. };
  86. //----------------------------------------------------------------------------------------
  87. #endif // ICLIENTREPLAYHISTORYMANAGER_H