Counter Strike : Global Offensive Source Code
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.

1194 lines
51 KiB

  1. //===== Copyright 1996-2005, Valve Corporation, All rights reserved. ======//
  2. //
  3. // Purpose: Interfaces between the client.dll and engine
  4. //
  5. //===========================================================================//
  6. #ifndef CDLL_INT_H
  7. #define CDLL_INT_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "basetypes.h"
  12. #include "interface.h"
  13. #include "mathlib/mathlib.h"
  14. #include "const.h"
  15. #include "checksum_crc.h"
  16. #include "datamap.h"
  17. #include "tier1/bitbuf.h"
  18. #include "inputsystem/ButtonCode.h"
  19. #include "modes.h"
  20. #include "string_t.h"
  21. #include "toolframework/itoolentity.h"
  22. #include "bitvec.h"
  23. #include "steam/isteamremotestorage.h"
  24. #if !defined( _X360 ) && !defined( _PS3 )
  25. #include "xbox/xboxstubs.h"
  26. #endif
  27. //-----------------------------------------------------------------------------
  28. // forward declarations
  29. //-----------------------------------------------------------------------------
  30. FORWARD_DECLARE_HANDLE( InputContextHandle_t );
  31. class CSteamAPIContext;
  32. struct adsp_auto_params_t;
  33. class ClientClass;
  34. struct model_t;
  35. class CSentence;
  36. struct vrect_t;
  37. struct cmodel_t;
  38. class IMaterial;
  39. class CAudioSource;
  40. class CMeasureSection;
  41. class SurfInfo;
  42. class ISpatialQuery;
  43. struct cache_user_t;
  44. class IMaterialSystem;
  45. class VMatrix;
  46. struct ScreenFade_t;
  47. struct ScreenShake_t;
  48. class CViewSetup;
  49. class CEngineSprite;
  50. class CGlobalVarsBase;
  51. class CPhysCollide;
  52. class CSaveRestoreData;
  53. class INetChannelInfo;
  54. struct datamap_t;
  55. struct typedescription_t;
  56. class CStandardRecvProxies;
  57. struct client_textmessage_t;
  58. class IAchievementMgr;
  59. class ISPSharedMemory;
  60. class IDemoRecorder;
  61. struct AudioState_t;
  62. class CGamestatsData;
  63. class KeyValues;
  64. class IFileList;
  65. class IReplayFactory;
  66. struct WriteReplayScreenshotParams_t;
  67. class IMaterialProxy;
  68. struct InputEvent_t;
  69. struct SpatializationInfo_t;
  70. class IScaleformSlotInitController;
  71. class IConVar;
  72. class CJob;
  73. class CSVCMsg_HltvReplay;
  74. class INetMessage;
  75. class CEngineGotvSyncPacket;
  76. struct CDemoPlaybackParameters_t
  77. {
  78. uint64 m_uiCaseID;
  79. uint32 m_uiHeaderPrefixLength;
  80. uint32 m_uiLockFirstPersonAccountID;
  81. bool m_bAnonymousPlayerIdentity;
  82. uint32 m_numRoundSkip;
  83. uint32 m_numRoundStop;
  84. bool m_bSkipWarmup;
  85. bool m_bPlayingLiveRemoteBroadcast;
  86. uint64 m_uiLiveMatchID;
  87. };
  88. struct DemoImportantGameEvent_t
  89. {
  90. int nEventID;
  91. const char *pszEventName;
  92. const char *pszUIName;
  93. float flSeekTimeBefore; // time in seconds before the event to seek to
  94. float flSeekForwardOffset; // when searching forward to find the next instance of this event, first offset forward by this much time
  95. float flSeekBackwardOffset; // when searching backwards to find the previous instance of this event, first offset back by this much time
  96. bool bScanOnly;
  97. };
  98. struct DemoImportantTick_t
  99. {
  100. int nImportanGameEventIndex;
  101. int nTick;
  102. int nPreviousTick;
  103. bool bCanDirectSeek;
  104. KeyValues *pKeys;
  105. };
  106. namespace vgui
  107. {
  108. // handle to an internal vgui panel
  109. // this is the only handle to a panel that is valid across dll boundaries
  110. typedef uintp VPANEL;
  111. }
  112. //-----------------------------------------------------------------------------
  113. // Purpose: This data structure is filled in by the engine when the client .dll requests information about
  114. // other players that the engine knows about
  115. //-----------------------------------------------------------------------------
  116. // Engine player info, no game related infos here
  117. // If you change this, change the two byteswap defintions:
  118. // cdll_client_int.cpp and cdll_engine_int.cpp
  119. typedef struct player_info_s
  120. {
  121. DECLARE_BYTESWAP_DATADESC();
  122. // version for future compatibility
  123. uint64 version;
  124. // network xuid
  125. uint64 xuid;
  126. // scoreboard information
  127. char name[MAX_PLAYER_NAME_LENGTH];
  128. // local server user ID, unique while server is running
  129. int userID;
  130. // global unique player identifer
  131. char guid[SIGNED_GUID_LEN + 1];
  132. // friends identification number
  133. uint32 friendsID;
  134. // friends name
  135. char friendsName[MAX_PLAYER_NAME_LENGTH];
  136. // true, if player is a bot controlled by game.dll
  137. bool fakeplayer;
  138. // true if player is the HLTV proxy
  139. bool ishltv;
  140. #if defined( REPLAY_ENABLED )
  141. // true if player is the Replay proxy
  142. bool isreplay;
  143. #endif
  144. // custom files CRC for this player
  145. CRC32_t customFiles[MAX_CUSTOM_FILES];
  146. // this counter increases each time the server downloaded a new file
  147. unsigned char filesDownloaded;
  148. } player_info_t;
  149. #define CDLL_PLAYER_INFO_S_VERSION_CURRENT 0xFFFFFFFFFFFFF002ull
  150. typedef struct player_info_s_version_1
  151. {
  152. // network xuid
  153. uint64 xuid;
  154. // scoreboard information
  155. char name[32];
  156. // local server user ID, unique while server is running
  157. int userID;
  158. // global unique player identifer
  159. char guid[32 + 1];
  160. // friends identification number
  161. uint32 friendsID;
  162. // friends name
  163. char friendsName[32];
  164. // true, if player is a bot controlled by game.dll
  165. bool fakeplayer;
  166. // true if player is the HLTV proxy
  167. bool ishltv;
  168. // custom files CRC for this player
  169. CRC32_t customFiles[4];
  170. // this counter increases each time the server downloaded a new file
  171. unsigned char filesDownloaded;
  172. } player_info_t_version_1;
  173. //-----------------------------------------------------------------------------
  174. // Skybox visibility
  175. //-----------------------------------------------------------------------------
  176. enum SkyboxVisibility_t
  177. {
  178. SKYBOX_NOT_VISIBLE = 0,
  179. SKYBOX_3DSKYBOX_VISIBLE,
  180. SKYBOX_2DSKYBOX_VISIBLE,
  181. };
  182. enum EngineInputContextId_t
  183. {
  184. ENGINE_INPUT_CONTEXT_GAME = 0,
  185. ENGINE_INPUT_CONTEXT_GAMEUI,
  186. };
  187. enum BindingLookupOption_t
  188. {
  189. BINDINGLOOKUP_ALL = -1,
  190. BINDINGLOOKUP_KEYBOARD_ONLY = 0,
  191. BINDINGLOOKUP_JOYSTICK_ONLY,
  192. BINDINGLOOKUP_STEAMCONTROLLER_ONLY,
  193. };
  194. //-----------------------------------------------------------------------------
  195. // Purpose: The engine reports to the client DLL what stage it's entering so the DLL can latch events
  196. // and make sure that certain operations only happen during the right stages.
  197. // The value for each stage goes up as you move through the frame so you can check ranges of values
  198. // and if new stages get added in-between, the range is still valid.
  199. //-----------------------------------------------------------------------------
  200. enum ClientFrameStage_t
  201. {
  202. FRAME_UNDEFINED=-1, // (haven't run any frames yet)
  203. FRAME_START,
  204. // A network packet is being recieved
  205. FRAME_NET_UPDATE_START,
  206. // Data has been received and we're going to start calling PostDataUpdate
  207. FRAME_NET_UPDATE_POSTDATAUPDATE_START,
  208. // Data has been received and we've called PostDataUpdate on all data recipients
  209. FRAME_NET_UPDATE_POSTDATAUPDATE_END,
  210. // We've received all packets, we can now do interpolation, prediction, etc..
  211. FRAME_NET_UPDATE_END,
  212. // We're about to start rendering the scene
  213. FRAME_RENDER_START,
  214. // We've finished rendering the scene.
  215. FRAME_RENDER_END,
  216. FRAME_NET_FULL_FRAME_UPDATE_ON_REMOVE
  217. };
  218. // Used by RenderView
  219. enum RenderViewInfo_t
  220. {
  221. RENDERVIEW_UNSPECIFIED = 0,
  222. RENDERVIEW_DRAWVIEWMODEL = (1<<0),
  223. RENDERVIEW_DRAWHUD = (1<<1),
  224. RENDERVIEW_SUPPRESSMONITORRENDERING = (1<<2),
  225. };
  226. // Spectator Movement modes (mods define these i
  227. enum ClientDLLObserverMode_t
  228. {
  229. CLIENT_DLL_OBSERVER_NONE = 0, // not in spectator mode
  230. CLIENT_DLL_OBSERVER_DEATHCAM, // special mode for death cam animation
  231. CLIENT_DLL_OBSERVER_FREEZECAM, // zooms to a target, and freeze-frames on them
  232. CLIENT_DLL_OBSERVER_FIXED, // view from a fixed camera position
  233. CLIENT_DLL_OBSERVER_IN_EYE, // follow a player in first person view
  234. CLIENT_DLL_OBSERVER_CHASE, // follow a player in third person view
  235. CLIENT_DLL_OBSERVER_ROAMING, // free roaming
  236. CLIENT_DLL_OBSERVER_OTHER,
  237. };
  238. //-----------------------------------------------------------------------------
  239. // Lightcache entry handle
  240. //-----------------------------------------------------------------------------
  241. DECLARE_POINTER_HANDLE( LightCacheHandle_t );
  242. //-----------------------------------------------------------------------------
  243. // Occlusion parameters
  244. //-----------------------------------------------------------------------------
  245. struct OcclusionParams_t
  246. {
  247. float m_flMaxOccludeeArea;
  248. float m_flMinOccluderArea;
  249. };
  250. //-----------------------------------------------------------------------------
  251. // Demo custom data callback type
  252. //-----------------------------------------------------------------------------
  253. typedef void (*pfnDemoCustomDataCallback)( uint8 *pData, size_t iSize );
  254. //-----------------------------------------------------------------------------
  255. // Just an interface version name for the random number interface
  256. // See vstdlib/random.h for the interface definition
  257. // NOTE: If you change this, also change VENGINE_SERVER_RANDOM_INTERFACE_VERSION in eiface.h
  258. //-----------------------------------------------------------------------------
  259. #define VENGINE_CLIENT_RANDOM_INTERFACE_VERSION "VEngineRandom001"
  260. // change this when the new version is incompatable with the old
  261. #define VENGINE_CLIENT_INTERFACE_VERSION "VEngineClient014"
  262. //-----------------------------------------------------------------------------
  263. // Purpose: Interface exposed from the engine to the client .dll
  264. //-----------------------------------------------------------------------------
  265. abstract_class IVEngineClient
  266. {
  267. public:
  268. // Find the model's surfaces that intersect the given sphere.
  269. // Returns the number of surfaces filled in.
  270. virtual int GetIntersectingSurfaces(
  271. const model_t *model,
  272. const Vector &vCenter,
  273. const float radius,
  274. const bool bOnlyVisibleSurfaces, // Only return surfaces visible to vCenter.
  275. SurfInfo *pInfos,
  276. const int nMaxInfos) = 0;
  277. // Get the lighting intensivty for a specified point
  278. // If bClamp is specified, the resulting Vector is restricted to the 0.0 to 1.0 for each element
  279. virtual Vector GetLightForPoint(const Vector &pos, bool bClamp) = 0;
  280. // Traces the line and reports the material impacted as well as the lighting information for the impact point
  281. virtual IMaterial *TraceLineMaterialAndLighting( const Vector &start, const Vector &end,
  282. Vector &diffuseLightColor, Vector& baseColor ) = 0;
  283. // Given an input text buffer data pointer, parses a single token into the variable token and returns the new
  284. // reading position
  285. virtual const char *ParseFile( const char *data, char *token, int maxlen ) = 0;
  286. virtual bool CopyLocalFile( const char *source, const char *destination ) = 0;
  287. // Gets the dimensions of the game window
  288. virtual void GetScreenSize( int& width, int& height ) = 0;
  289. // Forwards szCmdString to the server, sent reliably if bReliable is set
  290. virtual void ServerCmd( const char *szCmdString, bool bReliable = true ) = 0;
  291. // Inserts szCmdString into the command buffer as if it was typed by the client to his/her console.
  292. // Note: Calls to this are checked against FCVAR_CLIENTCMD_CAN_EXECUTE (if that bit is not set, then this function can't change it).
  293. // Call ClientCmd_Unrestricted to have access to FCVAR_CLIENTCMD_CAN_EXECUTE vars.
  294. virtual void ClientCmd( const char *szCmdString ) = 0;
  295. // Fill in the player info structure for the specified player index (name, model, etc.)
  296. virtual bool GetPlayerInfo( int ent_num, player_info_t *pinfo ) = 0;
  297. // Retrieve the player entity number for a specified userID
  298. virtual int GetPlayerForUserID( int userID ) = 0;
  299. // Retrieves text message system information for the specified message by name
  300. virtual client_textmessage_t *TextMessageGet( const char *pName ) = 0;
  301. // Returns true if the console is visible
  302. virtual bool Con_IsVisible( void ) = 0;
  303. // Get the entity index of the local player
  304. virtual int GetLocalPlayer( void ) = 0;
  305. // Client DLL is hooking a model, loads the model into memory and returns pointer to the model_t
  306. virtual const model_t *LoadModel( const char *pName, bool bProp = false ) = 0;
  307. // Get the exact server timesstamp ( server time ) from the last message received from the server
  308. virtual float GetLastTimeStamp( void ) = 0;
  309. // Given a CAudioSource (opaque pointer), retrieve the underlying CSentence object ( stores the words, phonemes, and close
  310. // captioning data )
  311. virtual CSentence *GetSentence( CAudioSource *pAudioSource ) = 0;
  312. // Given a CAudioSource, determines the length of the underlying audio file (.wav, .mp3, etc.)
  313. virtual float GetSentenceLength( CAudioSource *pAudioSource ) = 0;
  314. // Returns true if the sound is streaming off of the hard disk (instead of being memory resident)
  315. virtual bool IsStreaming( CAudioSource *pAudioSource ) const = 0;
  316. // Copy current view orientation into va
  317. virtual void GetViewAngles( QAngle& va ) = 0;
  318. // Set current view orientation from va
  319. virtual void SetViewAngles( QAngle& va ) = 0;
  320. // Retrieve the current game's maxclients setting
  321. virtual int GetMaxClients( void ) = 0;
  322. // Given the string pBinding which may be bound to a key,
  323. // returns the string name of the key to which this string is bound. Returns NULL if no such binding exists
  324. virtual const char *Key_LookupBinding( const char *pBinding ) = 0;
  325. // Given the name of the key "mouse1", "e", "tab", etc., return the string it is bound to "+jump", "impulse 50", etc.
  326. virtual const char *Key_BindingForKey( ButtonCode_t code ) = 0;
  327. // Bind a key
  328. virtual void Key_SetBinding( ButtonCode_t code, const char *pBinding ) = 0;
  329. // key trapping (for binding keys)
  330. virtual void StartKeyTrapMode( void ) = 0;
  331. virtual bool CheckDoneKeyTrapping( ButtonCode_t &code ) = 0;
  332. // Returns true if the player is fully connected and active in game (i.e, not still loading)
  333. virtual bool IsInGame( void ) = 0;
  334. // Returns true if the player is connected, but not necessarily active in game (could still be loading)
  335. virtual bool IsConnected( void ) = 0;
  336. // Returns true if the loading plaque should be drawn
  337. virtual bool IsDrawingLoadingImage( void ) = 0;
  338. virtual void HideLoadingPlaque( void ) = 0;
  339. // Prints the formatted string to the notification area of the screen ( down the right hand edge
  340. // numbered lines starting at position 0
  341. virtual void Con_NPrintf( int pos, PRINTF_FORMAT_STRING const char *fmt, ... ) = 0;
  342. // Similar to Con_NPrintf, but allows specifying custom text color and duration information
  343. virtual void Con_NXPrintf( const struct con_nprint_s *info, PRINTF_FORMAT_STRING const char *fmt, ... ) = 0;
  344. // Is the specified world-space bounding box inside the view frustum?
  345. virtual int IsBoxVisible( const Vector& mins, const Vector& maxs ) = 0;
  346. // Is the specified world-space boudning box in the same PVS cluster as the view origin?
  347. virtual int IsBoxInViewCluster( const Vector& mins, const Vector& maxs ) = 0;
  348. // Returns true if the specified box is outside of the view frustum and should be culled
  349. virtual bool CullBox( const Vector& mins, const Vector& maxs ) = 0;
  350. // Allow the sound system to paint additional data (during lengthy rendering operations) to prevent stuttering sound.
  351. virtual void Sound_ExtraUpdate( void ) = 0;
  352. #if defined(_PS3)
  353. // Allow sound system updates from engine, ensure only done if sv.IsActive() is true
  354. virtual void Sound_ServerUpdateSoundsPS3( void ) = 0;
  355. #endif
  356. // Get the current game directory ( e.g., hl2, tf2, cstrike, hl1 )
  357. virtual const char *GetGameDirectory( void ) = 0;
  358. // Get access to the world to screen transformation matrix
  359. virtual const VMatrix& WorldToScreenMatrix() = 0;
  360. // Get the matrix to move a point from world space into view space
  361. // (translate and rotate so the camera is at the origin looking down X).
  362. virtual const VMatrix& WorldToViewMatrix() = 0;
  363. // The .bsp file can have mod-specified data lumps. These APIs are for working with such game lumps.
  364. // Get mod-specified lump version id for the specified game data lump
  365. virtual int GameLumpVersion( int lumpId ) const = 0;
  366. // Get the raw size of the specified game data lump.
  367. virtual int GameLumpSize( int lumpId ) const = 0;
  368. // Loads a game lump off disk, writing the data into the buffer pointed to bye pBuffer
  369. // Returns false if the data can't be read or the destination buffer is too small
  370. virtual bool LoadGameLump( int lumpId, void* pBuffer, int size ) = 0;
  371. // Returns the number of leaves in the level
  372. virtual int LevelLeafCount() const = 0;
  373. // Gets a way to perform spatial queries on the BSP tree
  374. virtual ISpatialQuery* GetBSPTreeQuery() = 0;
  375. // Convert texlight to gamma...
  376. virtual void LinearToGamma( float* linear, float* gamma ) = 0;
  377. // Get the lightstyle value
  378. virtual float LightStyleValue( int style ) = 0;
  379. // Computes light due to dynamic lighting at a point
  380. // If the normal isn't specified, then it'll return the maximum lighting
  381. virtual void ComputeDynamicLighting( const Vector& pt, const Vector* pNormal, Vector& color ) = 0;
  382. // Returns the color of the ambient light
  383. virtual void GetAmbientLightColor( Vector& color ) = 0;
  384. // Returns the dx support level
  385. virtual int GetDXSupportLevel() = 0;
  386. // GR - returns the HDR support status
  387. virtual bool SupportsHDR() = 0;
  388. // Replace the engine's material system pointer.
  389. virtual void Mat_Stub( IMaterialSystem *pMatSys ) = 0;
  390. // Get the name of the current map
  391. virtual void GetChapterName( char *pchBuff, int iMaxLength ) = 0;
  392. virtual char const *GetLevelName( void ) = 0;
  393. virtual char const *GetLevelNameShort( void ) = 0;
  394. virtual char const *GetMapGroupName( void ) = 0;
  395. #if !defined( NO_VOICE )
  396. // Obtain access to the voice tweaking API
  397. virtual struct IVoiceTweak_s *GetVoiceTweakAPI( void ) = 0;
  398. virtual void SetVoiceCasterID( uint32 casterID ) = 0;
  399. #endif
  400. // Tell engine stats gathering system that the rendering frame is beginning/ending
  401. virtual void EngineStats_BeginFrame( void ) = 0;
  402. virtual void EngineStats_EndFrame( void ) = 0;
  403. // This tells the engine to fire any events (temp entity messages) that it has queued up this frame.
  404. // It should only be called once per frame.
  405. virtual void FireEvents() = 0;
  406. // Returns an area index if all the leaves are in the same area. If they span multple areas, then it returns -1.
  407. virtual int GetLeavesArea( unsigned short *pLeaves, int nLeaves ) = 0;
  408. // Returns true if the box touches the specified area's frustum.
  409. virtual bool DoesBoxTouchAreaFrustum( const Vector &mins, const Vector &maxs, int iArea ) = 0;
  410. virtual int GetFrustumList( Frustum_t **pList, int listMax ) = 0;
  411. virtual bool ShouldUseAreaFrustum( int area ) = 0;
  412. // Sets the hearing origin (i.e., the origin and orientation of the listener so that the sound system can spatialize
  413. // sound appropriately ).
  414. virtual void SetAudioState( const AudioState_t& state ) = 0;
  415. // Sentences / sentence groups
  416. virtual int SentenceGroupPick( int groupIndex, char *name, int nameBufLen ) = 0;
  417. virtual int SentenceGroupPickSequential( int groupIndex, char *name, int nameBufLen, int sentenceIndex, int reset ) = 0;
  418. virtual int SentenceIndexFromName( const char *pSentenceName ) = 0;
  419. virtual const char *SentenceNameFromIndex( int sentenceIndex ) = 0;
  420. virtual int SentenceGroupIndexFromName( const char *pGroupName ) = 0;
  421. virtual const char *SentenceGroupNameFromIndex( int groupIndex ) = 0;
  422. virtual float SentenceLength( int sentenceIndex ) = 0;
  423. // Computes light due to dynamic lighting at a point
  424. // If the normal isn't specified, then it'll return the maximum lighting
  425. // If pBoxColors is specified (it's an array of 6), then it'll copy the light contribution at each box side.
  426. virtual void ComputeLighting( const Vector& pt, const Vector* pNormal, bool bClamp, Vector& color, Vector *pBoxColors=NULL ) = 0;
  427. // Activates/deactivates an occluder...
  428. virtual void ActivateOccluder( int nOccluderIndex, bool bActive ) = 0;
  429. virtual bool IsOccluded( int occlusionViewId, const Vector &vecAbsMins, const Vector &vecAbsMaxs ) = 0;
  430. virtual int GetOcclusionViewId() const = 0;
  431. // The save restore system allocates memory from a shared memory pool, use this allocator to allocate/free saverestore
  432. // memory.
  433. virtual void *SaveAllocMemory( size_t num, size_t size ) = 0;
  434. virtual void SaveFreeMemory( void *pSaveMem ) = 0;
  435. // returns info interface for client netchannel
  436. virtual INetChannelInfo *GetNetChannelInfo( void ) = 0;
  437. // Debugging functionality:
  438. // Very slow routine to draw a physics model
  439. virtual void DebugDrawPhysCollide( const CPhysCollide *pCollide, IMaterial *pMaterial, const matrix3x4_t& transform, const color32 &color ) = 0;
  440. // This can be used to notify test scripts that we're at a particular spot in the code.
  441. virtual void CheckPoint( const char *pName ) = 0;
  442. // Draw portals if r_DrawPortals is set (Debugging only)
  443. virtual void DrawPortals() = 0;
  444. // Determine whether the client is playing back or recording a demo
  445. virtual bool IsPlayingDemo( void ) = 0;
  446. virtual bool IsRecordingDemo( void ) = 0;
  447. virtual bool IsPlayingTimeDemo( void ) = 0;
  448. virtual int GetDemoRecordingTick( void ) = 0;
  449. virtual int GetDemoPlaybackTick( void ) = 0;
  450. virtual int GetDemoPlaybackStartTick( void ) = 0;
  451. virtual float GetDemoPlaybackTimeScale( void ) = 0;
  452. virtual int GetDemoPlaybackTotalTicks( void ) = 0;
  453. // Is the game paused?
  454. virtual bool IsPaused( void ) = 0;
  455. // What is the game timescale multiplied with the host_timescale?
  456. virtual float GetTimescale( void ) const = 0;
  457. // Is the game currently taking a screenshot?
  458. virtual bool IsTakingScreenshot( void ) = 0;
  459. // Is this a HLTV broadcast ?
  460. virtual bool IsHLTV( void ) = 0;
  461. #if defined( REPLAY_ENABLED )
  462. // Is this a Replay demo?
  463. virtual bool IsReplay( void ) = 0;
  464. // Download a replay from the given URL
  465. virtual void DownloadReplay( int nReplayDownloadGroupId ) = 0;
  466. // Is replay enabled?
  467. virtual bool IsReplayEnabled() = 0;
  468. // Is replay recording?
  469. virtual bool IsReplayRecording() = 0;
  470. // Get the replay recording tick from server
  471. virtual int GetReplayRecordingTick() = 0;
  472. #endif // REPLAY_ENABLED
  473. // is this level loaded as just the background to the main menu? (active, but unplayable)
  474. virtual bool IsLevelMainMenuBackground( void ) = 0;
  475. // returns the name of the background level
  476. virtual void GetMainMenuBackgroundName( char *dest, int destlen ) = 0;
  477. // Occlusion system control
  478. virtual void SetOcclusionParameters( const OcclusionParams_t &params ) = 0;
  479. // What language is the user expecting to hear .wavs in, "english" or another...
  480. virtual void GetUILanguage( char *dest, int destlen ) = 0;
  481. // Can skybox be seen from a particular point?
  482. virtual SkyboxVisibility_t IsSkyboxVisibleFromPoint( const Vector &vecPoint ) = 0;
  483. // Get the pristine map entity lump string. (e.g., used by CS to reload the map entities when restarting a round.)
  484. virtual const char* GetMapEntitiesString() = 0;
  485. // Is the engine in map edit mode ?
  486. virtual bool IsInEditMode( void ) = 0;
  487. // current screen aspect ratio (eg. 4.0f/3.0f, 16.0f/9.0f)
  488. virtual float GetScreenAspectRatio( int viewportWidth, int viewportHeight ) = 0;
  489. // allow the game UI to login a user
  490. virtual bool REMOVED_SteamRefreshLogin( const char *password, bool isSecure ) = 0;
  491. virtual bool REMOVED_SteamProcessCall( bool & finished ) = 0;
  492. // allow other modules to know about engine versioning (one use is a proxy for network compatability)
  493. virtual unsigned int GetEngineBuildNumber() = 0; // engines build
  494. virtual const char * GetProductVersionString() = 0; // mods version number (steam.inf)
  495. // Communicates to the color correction editor that it's time to grab the pre-color corrected frame
  496. // Passes in the actual size of the viewport
  497. virtual void GrabPreColorCorrectedFrame( int x, int y, int width, int height ) = 0;
  498. virtual bool IsHammerRunning( ) const = 0;
  499. // Inserts szCmdString into the command buffer as if it was typed by the client to his/her console.
  500. // And then executes the command string immediately (vs ClientCmd() which executes in the next frame)
  501. //
  502. // Note: this is NOT checked against the FCVAR_CLIENTCMD_CAN_EXECUTE vars.
  503. virtual void ExecuteClientCmd( const char *szCmdString ) = 0;
  504. // returns if the loaded map was processed with HDR info. This will be set regardless
  505. // of what HDR mode the player is in.
  506. virtual bool MapHasHDRLighting(void) = 0;
  507. virtual bool MapHasLightMapAlphaData(void) = 0;
  508. virtual int GetAppID() = 0;
  509. // Just get the leaf ambient light - no caching, no samples
  510. virtual Vector GetLightForPointFast(const Vector &pos, bool bClamp) = 0;
  511. // This version does NOT check against FCVAR_CLIENTCMD_CAN_EXECUTE.
  512. virtual void ClientCmd_Unrestricted( const char *szCmdString , bool fromConsoleOrKeybind = false ) = 0;
  513. // Version that takes userSlot and can ignore checking if the slot validity has been set; required for joystick initialization for splitscreen
  514. virtual void ClientCmd_Unrestricted( const char *szCmdString , bool fromConsoleOrKeybind, int nUserSlot, bool bCheckValidSlot = true ) = 0;
  515. // This used to be accessible through the cl_restrict_server_commands cvar.
  516. // By default, Valve games restrict the server to only being able to execute commands marked with FCVAR_SERVER_CAN_EXECUTE.
  517. // By default, mods are allowed to execute any server commands, and they can restrict the server's ability to execute client
  518. // commands with this function.
  519. virtual void SetRestrictServerCommands( bool bRestrict ) = 0;
  520. // If set to true (defaults to true for Valve games and false for others), then IVEngineClient::ClientCmd
  521. // can only execute things marked with FCVAR_CLIENTCMD_CAN_EXECUTE.
  522. virtual void SetRestrictClientCommands( bool bRestrict ) = 0;
  523. // Sets the client renderable for an overlay's material proxy to bind to
  524. virtual void SetOverlayBindProxy( int iOverlayID, void *pBindProxy ) = 0;
  525. virtual bool CopyFrameBufferToMaterial( const char *pMaterialName ) = 0;
  526. // Causes the engine to read in the user's configuration on disk
  527. virtual void ReadConfiguration( const int iController, const bool readDefault ) = 0;
  528. virtual void SetAchievementMgr( IAchievementMgr *pAchievementMgr ) = 0;
  529. virtual IAchievementMgr *GetAchievementMgr() = 0;
  530. virtual bool MapLoadFailed( void ) = 0;
  531. virtual void SetMapLoadFailed( bool bState ) = 0;
  532. virtual bool IsLowViolence() = 0;
  533. virtual const char *GetMostRecentSaveGame( bool bEnsureExists = false ) = 0;
  534. virtual void SetMostRecentSaveGame( const char *lpszFilename ) = 0;
  535. virtual void StartXboxExitingProcess() = 0;
  536. virtual bool IsSaveInProgress() = 0;
  537. virtual bool IsAutoSaveDangerousInProgress() = 0;
  538. virtual uint OnStorageDeviceAttached( int iController ) = 0;
  539. virtual void OnStorageDeviceDetached( int iController ) = 0;
  540. virtual const char * GetSaveDirName() = 0; // get a pointer to the path where saves should go (with a trailing slash already added)
  541. // generic screenshot writing
  542. virtual void WriteScreenshot( const char *pFilename ) = 0;
  543. virtual void ResetDemoInterpolation( void ) = 0;
  544. // For non-split screen games this will always be zero
  545. virtual int GetActiveSplitScreenPlayerSlot() = 0;
  546. virtual int SetActiveSplitScreenPlayerSlot( int slot ) = 0;
  547. // This is the current # of players on the local host
  548. virtual bool SetLocalPlayerIsResolvable( char const *pchContext, int nLine, bool bResolvable ) = 0;
  549. virtual bool IsLocalPlayerResolvable() = 0;
  550. virtual int GetSplitScreenPlayer( int nSlot ) = 0;
  551. virtual bool IsSplitScreenActive() = 0;
  552. virtual bool IsValidSplitScreenSlot( int nSlot ) = 0;
  553. virtual int FirstValidSplitScreenSlot() = 0; // -1 == invalid
  554. virtual int NextValidSplitScreenSlot( int nPreviousSlot ) = 0; // -1 == invalid
  555. //Finds or Creates a shared memory space, the returned pointer will automatically be AddRef()ed
  556. virtual ISPSharedMemory *GetSinglePlayerSharedMemorySpace( const char *szName, int ent_num = MAX_EDICTS ) = 0;
  557. // Computes an ambient cube that includes ALL dynamic lights
  558. virtual void ComputeLightingCube( const Vector& pt, bool bClamp, Vector *pBoxColors ) = 0;
  559. //All callbacks have to be registered before demo recording begins. TODO: Macro'ize a way to do it at startup
  560. virtual void RegisterDemoCustomDataCallback( string_t szCallbackSaveID, pfnDemoCustomDataCallback pCallback ) = 0;
  561. virtual void RecordDemoCustomData( pfnDemoCustomDataCallback pCallback, const void *pData, size_t iDataLength ) = 0;
  562. // global sound pitch scaling
  563. virtual void SetPitchScale( float flPitchScale ) = 0;
  564. virtual float GetPitchScale( void ) = 0;
  565. // Load/unload the SFM - used by Replay
  566. virtual bool LoadFilmmaker() = 0;
  567. virtual void UnloadFilmmaker() = 0;
  568. // leaf flag management. Allows fast leaf enumeration of leaves that have a flag set
  569. // set a bit in a leaf flag
  570. virtual void SetLeafFlag( int nLeafIndex, int nFlagBits ) = 0;
  571. // you must call this once done modifying flags. Not super fast.
  572. virtual void RecalculateBSPLeafFlags( void ) = 0;
  573. virtual bool DSPGetCurrentDASRoomNew(void) = 0;
  574. virtual bool DSPGetCurrentDASRoomChanged(void) = 0;
  575. virtual bool DSPGetCurrentDASRoomSkyAbove(void) = 0;
  576. virtual float DSPGetCurrentDASRoomSkyPercent(void) = 0;
  577. virtual void SetMixGroupOfCurrentMixer( const char *szgroupname, const char *szparam, float val, int setMixerType) = 0;
  578. virtual int GetMixLayerIndex( const char *szmixlayername ) = 0;
  579. virtual void SetMixLayerLevel(int index, float level ) = 0;
  580. virtual int GetMixGroupIndex( const char *pMixGroupName ) = 0;
  581. virtual void SetMixLayerTriggerFactor( int nMixLayerIndex, int nMixGroupIndex, float flFactor ) = 0;
  582. virtual void SetMixLayerTriggerFactor( const char *pMixLayerIndex, const char *pMixGroupIndex, float flFactor ) = 0;
  583. virtual bool IsCreatingReslist() = 0;
  584. virtual bool IsCreatingXboxReslist() = 0;
  585. virtual void SetTimescale( float flTimescale ) = 0;
  586. // Methods to set/get a gamestats data container so client & server running in same process can send combined data
  587. virtual void SetGamestatsData( CGamestatsData *pGamestatsData ) = 0;
  588. virtual CGamestatsData *GetGamestatsData() = 0;
  589. #if defined( USE_SDL ) || defined( OSX )
  590. // we need to pull delta's from the cocoa mgr, the engine vectors this for us
  591. virtual void GetMouseDelta( int &x, int &y, bool bIgnoreNextMouseDelta = false ) = 0;
  592. #endif
  593. // Given the string pBinding which may be bound to a key,
  594. // returns the string name of the key to which this string is bound. Returns NULL if no such binding exists
  595. // Increment start count to iterate through multiple keys bound to the same binding
  596. // iAllowJoystick defaults to -1 witch returns joystick and non-joystick binds, 0 returns only non-joystick, 1 returns only joystick
  597. virtual const char *Key_LookupBindingEx( const char *pBinding, int iUserId = -1, int iStartCount = 0, BindingLookupOption_t nFlags = BINDINGLOOKUP_ALL ) = 0;
  598. // returns key_code for specified binding
  599. virtual int Key_CodeForBinding( const char *pBinding, int iUserId = -1, int iStartCount = 0, BindingLookupOption_t nFlags = BINDINGLOOKUP_ALL ) = 0;
  600. // Updates dynamic light state. Necessary for light cache to work properly for d- and elights
  601. virtual void UpdateDAndELights( void ) = 0;
  602. // Methods to get bug count for internal dev work stat tracking.
  603. // Will get the bug count and clear it every map transition
  604. virtual int GetBugSubmissionCount() const = 0;
  605. virtual void ClearBugSubmissionCount() = 0;
  606. // Is there water anywhere in the level?
  607. virtual bool DoesLevelContainWater() const = 0;
  608. // How much time was spent in server simulation?
  609. virtual float GetServerSimulationFrameTime() const = 0;
  610. virtual void SolidMoved( class IClientEntity *pSolidEnt, class ICollideable *pSolidCollide, const Vector* pPrevAbsOrigin, bool accurateBboxTriggerChecks ) = 0;
  611. virtual void TriggerMoved( class IClientEntity *pTriggerEnt, bool accurateBboxTriggerChecks ) = 0;
  612. // Using area bits, check whether the area of the specified point flows into the other areas
  613. virtual void ComputeLeavesConnected( const Vector &vecOrigin, int nCount, const int *pLeafIndices, bool *pIsConnected ) = 0;
  614. // Is the engine in Commentary mode?
  615. virtual bool IsInCommentaryMode( void ) = 0;
  616. virtual void SetBlurFade( float amount ) = 0;
  617. virtual bool IsTransitioningToLoad() = 0;
  618. virtual void SearchPathsChangedAfterInstall() = 0;
  619. virtual void ConfigureSystemLevel( int nCPULevel, int nGPULevel ) = 0;
  620. virtual void SetConnectionPassword( char const *pchCurrentPW ) = 0;
  621. virtual CSteamAPIContext* GetSteamAPIContext() = 0;
  622. virtual void SubmitStatRecord( char const *szMapName, uint uiBlobVersion, uint uiBlobSize, const void *pvBlob ) = 0;
  623. // Sends a key values server command, not allowed from scripts execution
  624. // Params:
  625. // pKeyValues - key values to be serialized and sent to server
  626. // the pointer is deleted inside the function: pKeyValues->deleteThis()
  627. virtual void ServerCmdKeyValues( KeyValues *pKeyValues ) = 0;
  628. virtual void SendMessageToServer( INetMessage *pMessage, bool bForceReliable = false, bool bVoice = false ) = 0;
  629. // Tells the engine what and where to paint
  630. virtual bool SpherePaintSurface( const model_t *pModel, const Vector& vPosition, BYTE color, float flSphereRadius, float flPaintCoatPercent ) = 0;
  631. virtual bool HasPaintmap() = 0;
  632. // Enable paint in the engine for project Paint
  633. virtual void EnablePaintmapRender() = 0;
  634. virtual void SphereTracePaintSurface( const model_t *pModel, const Vector& vPosition, const Vector& vContactNormal, float flSphereRadius, CUtlVector<BYTE>& surfColors ) = 0;
  635. virtual void RemoveAllPaint() = 0;
  636. virtual void PaintAllSurfaces( BYTE color ) = 0;
  637. virtual void RemovePaint( const model_t *pModel ) = 0;
  638. virtual bool IsActiveApp() = 0;
  639. // is this client running inside the same process as an active server?
  640. virtual bool IsClientLocalToActiveServer() = 0;
  641. // Callback for LevelInit to tick the progress bar during time consuming operations
  642. virtual void TickProgressBar() = 0;
  643. // Returns the requested input context
  644. virtual InputContextHandle_t GetInputContext( EngineInputContextId_t id ) = 0;
  645. virtual void GetStartupImage( char *pOutBuff, int nOutBuffSize ) = 0;
  646. // For the rare case when the client DLL needs to do something different if network backdoor is on.
  647. virtual bool IsUsingLocalNetworkBackdoor() = 0;
  648. virtual bool SaveGame( const char *pSaveFilename, bool bIsXSave, char *pOutName, int nOutNameSize, char *pOutComment, int nOutCommentSize ) = 0;
  649. // Request 'generic' memory stats (returns a list of N named values; caller should assume this list will change over time)
  650. virtual int GetGenericMemoryStats( GenericMemoryStat_t **ppMemoryStats ) = 0;
  651. // On exit from a map, this becomes true once all map-related assets are flushed from memory:
  652. virtual bool GameHasShutdownAndFlushedMemory() = 0;
  653. //get the command_number from the most recent command the server acknowledged processing
  654. virtual int GetLastAcknowledgedCommand( void ) = 0;
  655. virtual void FinishContainerWrites( int iController ) = 0;
  656. virtual void FinishAsyncSave() = 0;
  657. virtual int GetServerTick( void ) = 0;
  658. // return the final directory in the game dir (i.e "cstrike", "hl2", rather than c:\blah\cstrike )
  659. virtual const char *GetModDirectory( void ) = 0;
  660. virtual void AudioLanguageChanged() = 0;
  661. virtual bool IsAutoSaveInProgress() = 0;
  662. virtual void StartLoadingScreenForCommand( const char* command ) = 0;
  663. virtual void StartLoadingScreenForKeyValues( KeyValues* keyValues ) = 0;
  664. // Sos opvars
  665. virtual bool SOSSetOpvarFloat( const char *pOpVarName, float flValue ) = 0;
  666. virtual bool SOSGetOpvarFloat( const char *pOpVarName, float &flValue ) = 0;
  667. #if defined(_PS3)
  668. virtual void* GetHostStateWorldBrush( void ) = 0;
  669. virtual bool PS3_IsUserRestrictedFromChat( void ) = 0;
  670. virtual bool PS3_IsUserRestrictedFromOnline( void ) = 0;
  671. virtual bool PS3_PendingInvitesFound( void ) = 0;
  672. virtual void PS3_ShowInviteOverlay( void ) = 0;
  673. virtual bool bOverrideCSMConvars( void ) = 0;
  674. virtual bool bDrawWorldIntoCSM( void ) = 0;
  675. virtual bool bDrawStaticPropsIntoCSM( void ) = 0;
  676. virtual float GetCSMMaxDist( void ) = 0;
  677. #endif
  678. virtual bool IsSubscribedMap( const char *pchMapName, bool bOnlyOnDisk ) = 0;
  679. virtual bool IsFeaturedMap( const char *pchMapName, bool bOnlyOnDisk ) = 0;
  680. // Access demo playback parameters
  681. virtual CDemoPlaybackParameters_t const * GetDemoPlaybackParameters() = 0;
  682. // Client version from the steam.inf, this will be compared to the GC version
  683. virtual int GetClientVersion() const = 0; // engines build
  684. virtual bool IsDemoSkipping() = 0;
  685. virtual void SetDemoImportantEventData( const KeyValues *pData ) = 0;
  686. // clear any temp entity events that are stacked up
  687. virtual void ClearEvents() = 0;
  688. virtual float GetSafeZoneXMin( void ) const = 0;
  689. virtual bool IsVoiceRecording() const = 0;
  690. virtual void ForceVoiceRecordOn() const = 0;
  691. virtual int GetConnectionDataProtocol() const = 0;
  692. virtual bool EngineGotvSyncPacket( const CEngineGotvSyncPacket *pPkt ) = 0;
  693. virtual const char* AliasToCommandString( const char* szAliasName ) = 0;
  694. };
  695. //-----------------------------------------------------------------------------
  696. // Purpose: Interface exposed from the client .dll back to the engine
  697. //-----------------------------------------------------------------------------
  698. abstract_class IBaseClientDLL
  699. {
  700. public:
  701. // Connect appsystem components, get global interfaces, don't run any other init code
  702. virtual int Connect( CreateInterfaceFn appSystemFactory, CGlobalVarsBase *pGlobals ) = 0;
  703. virtual void Disconnect() = 0;
  704. // run other init code here
  705. virtual int Init( CreateInterfaceFn appSystemFactory, CGlobalVarsBase *pGlobals ) = 0;
  706. virtual void PostInit() = 0;
  707. // Called once when the client DLL is being unloaded
  708. virtual void Shutdown( void ) = 0;
  709. // Called at the start of each level change
  710. virtual void LevelInitPreEntity( char const* pMapName ) = 0;
  711. // Called at the start of a new level, after the entities have been received and created
  712. virtual void LevelInitPostEntity( ) = 0;
  713. // Called at the end of a level
  714. virtual void LevelShutdown( void ) = 0;
  715. // Request a pointer to the list of client datatable classes
  716. virtual ClientClass *GetAllClasses( void ) = 0;
  717. // Called once per level to re-initialize any hud element drawing stuff
  718. virtual int HudVidInit( void ) = 0;
  719. // Called by the engine when gathering user input
  720. virtual void HudProcessInput( bool bActive ) = 0;
  721. // Called oncer per frame to allow the hud elements to think
  722. virtual void HudUpdate( bool bActive ) = 0;
  723. // Reset the hud elements to their initial states
  724. virtual void HudReset( void ) = 0;
  725. // Display a hud text message
  726. virtual void HudText( const char * message ) = 0;
  727. // Draw the console overlay?
  728. virtual bool ShouldDrawDropdownConsole() = 0;
  729. // Mouse Input Interfaces
  730. // Activate the mouse (hides the cursor and locks it to the center of the screen)
  731. virtual void IN_ActivateMouse( void ) = 0;
  732. // Deactivates the mouse (shows the cursor and unlocks it)
  733. virtual void IN_DeactivateMouse( void ) = 0;
  734. // This is only called during extra sound updates and just accumulates mouse x, y offets and recenters the mouse.
  735. // This call is used to try to prevent the mouse from appearing out of the side of a windowed version of the engine if
  736. // rendering or other processing is taking too long
  737. virtual void IN_Accumulate (void) = 0;
  738. // Reset all key and mouse states to their initial, unpressed state
  739. virtual void IN_ClearStates (void) = 0;
  740. // If key is found by name, returns whether it's being held down in isdown, otherwise function returns false
  741. virtual bool IN_IsKeyDown( const char *name, bool& isdown ) = 0;
  742. // Raw keyboard signal, if the client .dll returns 1, the engine processes the key as usual, otherwise,
  743. // if the client .dll returns 0, the key is swallowed.
  744. virtual int IN_KeyEvent( int eventcode, ButtonCode_t keynum, const char *pszCurrentBinding ) = 0;
  745. // This function is called once per tick to create the player CUserCmd (used for prediction/physics simulation of the player)
  746. // Because the mouse can be sampled at greater than the tick interval, there is a separate input_sample_frametime, which
  747. // specifies how much additional mouse / keyboard simulation to perform.
  748. virtual void CreateMove (
  749. int sequence_number, // sequence_number of this cmd
  750. float input_sample_frametime, // Frametime for mouse input sampling
  751. bool active ) = 0; // True if the player is active (not paused)
  752. // If the game is running faster than the tick_interval framerate, then we do extra mouse sampling to avoid jittery input
  753. // This code path is much like the normal move creation code, except no move is created
  754. virtual void ExtraMouseSample( float frametime, bool active ) = 0;
  755. // Encode the delta (changes) between the CUserCmd in slot from vs the one in slot to. The game code will have
  756. // matching logic to read the delta.
  757. virtual bool WriteUsercmdDeltaToBuffer( int nSlot, bf_write *buf, int from, int to, bool isnewcommand ) = 0;
  758. // Demos need to be able to encode/decode CUserCmds to memory buffers, so these functions wrap that
  759. virtual void EncodeUserCmdToBuffer( int nSlot, bf_write& buf, int slot ) = 0;
  760. virtual void DecodeUserCmdFromBuffer( int nSlot, bf_read& buf, int slot ) = 0;
  761. // Set up and render one or more views (e.g., rear view window, etc.). This called into RenderView below
  762. virtual void View_Render( vrect_t *rect ) = 0;
  763. // Allow engine to expressly render a view (e.g., during timerefresh)
  764. // See IVRenderView.h, PushViewFlags_t for nFlags values
  765. virtual void RenderView( const CViewSetup &view, int nClearFlags, int whatToDraw ) = 0;
  766. // Apply screen fade directly from engine
  767. virtual void View_Fade( ScreenFade_t *pSF ) = 0;
  768. // The engine has parsed a crosshair angle message, this function is called to dispatch the new crosshair angle
  769. virtual void SetCrosshairAngle( const QAngle& angle ) = 0;
  770. // Sprite (.spr) model handling code
  771. // Load a .spr file by name
  772. virtual void InitSprite( CEngineSprite *pSprite, const char *loadname ) = 0;
  773. // Shutdown a .spr file
  774. virtual void ShutdownSprite( CEngineSprite *pSprite ) = 0;
  775. // Returns sizeof( CEngineSprite ) so the engine can allocate appropriate memory
  776. virtual int GetSpriteSize( void ) const = 0;
  777. // Called when a player starts or stops talking.
  778. // entindex is -1 to represent the local client talking (before the data comes back from the server).
  779. // entindex is -2 to represent the local client's voice being acked by the server.
  780. // entindex is GetPlayer() when the server acknowledges that the local client is talking.
  781. virtual void VoiceStatus( int entindex, int iSsSlot, qboolean bTalking ) = 0;
  782. // returns false if the player can't hear the other client due to game rules (eg. the other team)
  783. virtual bool PlayerAudible( int iPlayerIndex ) = 0;
  784. // Networked string table definitions have arrived, allow client .dll to
  785. // hook string changes with a callback function ( see INetworkStringTableClient.h )
  786. virtual void InstallStringTableCallback( char const *tableName ) = 0;
  787. // Notification that we're moving into another stage during the frame.
  788. virtual void FrameStageNotify( ClientFrameStage_t curStage ) = 0;
  789. // The engine has received the specified user message, this code is used to dispatch the message handler
  790. virtual bool DispatchUserMessage( int msg_type, int32 nFlags, int size, const void *msg ) = 0; // New protobuf version
  791. // Save/restore system hooks
  792. virtual CSaveRestoreData *SaveInit( int size ) = 0;
  793. virtual void SaveWriteFields( CSaveRestoreData *, const char *, void *, datamap_t *, typedescription_t *, int ) = 0;
  794. virtual void SaveReadFields( CSaveRestoreData *, const char *, void *, datamap_t *, typedescription_t *, int ) = 0;
  795. virtual void PreSave( CSaveRestoreData * ) = 0;
  796. virtual void Save( CSaveRestoreData * ) = 0;
  797. virtual void WriteSaveHeaders( CSaveRestoreData * ) = 0;
  798. virtual void ReadRestoreHeaders( CSaveRestoreData * ) = 0;
  799. virtual void Restore( CSaveRestoreData *, bool ) = 0;
  800. virtual void DispatchOnRestore() = 0;
  801. // Hand over the StandardRecvProxies in the client DLL's module.
  802. virtual CStandardRecvProxies* GetStandardRecvProxies() = 0;
  803. // save game screenshot writing
  804. virtual void WriteSaveGameScreenshot( const char *pFilename ) = 0;
  805. // Given a list of "S(wavname) S(wavname2)" tokens, look up the localized text and emit
  806. // the appropriate close caption if running with closecaption = 1
  807. virtual void EmitSentenceCloseCaption( char const *tokenstream ) = 0;
  808. // Emits a regular close caption by token name
  809. virtual void EmitCloseCaption( char const *captionname, float duration ) = 0;
  810. // Returns true if the client can start recording a demo now. If the client returns false,
  811. // an error message of up to length bytes should be returned in errorMsg.
  812. virtual bool CanRecordDemo( char *errorMsg, int length ) const = 0;
  813. // Give the Client a chance to do setup/cleanup.
  814. virtual void OnDemoRecordStart( char const* pDemoBaseName ) = 0;
  815. virtual void OnDemoRecordStop() = 0;
  816. virtual void OnDemoPlaybackStart( char const* pDemoBaseName ) = 0;
  817. virtual void OnDemoPlaybackRestart() = 0;
  818. virtual void OnDemoPlaybackStop() = 0;
  819. virtual void SetDemoPlaybackHighlightXuid( uint64 xuid, bool bLowlights ) = 0;
  820. virtual void ShowHighlightSkippingMessage( bool bState, int nCurrentTick = 0, int nTickStart = 0, int nTickStop = 0 ) = 0;
  821. // Demo polish callbacks.
  822. virtual void RecordDemoPolishUserInput( int nCmdIndex ) = 0;
  823. // Cache replay ragdolls
  824. virtual bool CacheReplayRagdolls( const char* pFilename, int nStartTick ) = 0;
  825. // Send a message to the Replay UI
  826. virtual void ReplayUI_SendMessage( KeyValues *pMsg ) = 0;
  827. // Get the client replay factory
  828. virtual IReplayFactory *GetReplayFactory() = 0;
  829. // Clear out the local player's replay pointer so it doesn't get deleted
  830. virtual void ClearLocalPlayerReplayPtr() = 0;
  831. // Get client screen dimensions
  832. virtual int GetScreenWidth() = 0;
  833. virtual int GetScreenHeight() = 0;
  834. // Added interface
  835. // save game screenshot writing
  836. virtual void WriteSaveGameScreenshotOfSize( const char *pFilename, int width, int height, bool bCreatePowerOf2Padded = false, bool bWriteVTF = false ) = 0;
  837. // Write a .VTF screenshot to disk for the replay system
  838. virtual void WriteReplayScreenshot( WriteReplayScreenshotParams_t &params ) = 0;
  839. // Reallocate memory for replay screenshots - called if user changes resolution or if the convar "replay_screenshotresolution" changes
  840. virtual void UpdateReplayScreenshotCache() = 0;
  841. // Gets the current view
  842. virtual bool GetPlayerView( CViewSetup &playerView ) = 0;
  843. virtual bool ShouldHideLoadingPlaque( void ) = 0;
  844. virtual void InvalidateMdlCache() = 0;
  845. virtual void IN_SetSampleTime( float frametime ) = 0;
  846. virtual void OnActiveSplitscreenPlayerChanged( int nNewSlot ) = 0;
  847. // We are entering into/leaving split screen mode (or # of players is changing)
  848. virtual void OnSplitScreenStateChanged() = 0;
  849. virtual int GetSpectatorTarget( ClientDLLObserverMode_t* pObserverMode ) = 0;
  850. virtual void CenterStringOff() = 0;
  851. virtual void OnScreenSizeChanged( int nOldWidth, int nOldHeight ) = 0;
  852. virtual IMaterialProxy *InstantiateMaterialProxy( const char *proxyName ) = 0;
  853. virtual vgui::VPANEL GetFullscreenClientDLLVPanel( void ) = 0;
  854. // The engine wants to mark two entities as touching
  855. virtual void MarkEntitiesAsTouching( IClientEntity *e1, IClientEntity *e2 ) = 0;
  856. virtual void OnKeyBindingChanged( ButtonCode_t buttonCode, char const *pchKeyName, char const *pchNewBinding ) = 0;
  857. virtual void SetBlurFade( float scale ) = 0;
  858. virtual void ResetHudCloseCaption() = 0;
  859. // Called by the engine to allow the new GameUI to handle key events
  860. // Function must return true if the key event was handled
  861. virtual bool HandleGameUIEvent( const InputEvent_t &event ) = 0;
  862. // check if the client needs to alter non-entity associated sound locations (portal2, multiple sources, etc.)
  863. virtual bool GetSoundSpatialization( SpatializationInfo_t& info ) = 0;
  864. // sending a hint to the hud
  865. virtual void Hud_SaveStarted() = 0;
  866. virtual void ShutdownMovies() = 0;
  867. virtual void GetStatus( char *buffer, int bufsize ) = 0;
  868. // find out if the chat display is up
  869. #if defined ( CSTRIKE15 )
  870. virtual bool IsChatRaised( void ) = 0;
  871. virtual bool IsRadioPanelRaised( void ) = 0;
  872. virtual bool IsBindMenuRaised( void ) = 0;
  873. virtual bool IsTeamMenuRaised( void ) = 0;
  874. virtual bool IsLoadingScreenRaised( void ) = 0;
  875. #endif
  876. #if defined(_PS3)
  877. virtual int GetDrawFlags( void ) = 0;
  878. virtual int GetBuildViewID( void ) = 0;
  879. virtual bool IsSPUBuildWRJobsOn( void ) = 0;
  880. virtual void CacheFrustumData( Frustum_t *pFrustum, Frustum_t *pAreaFrustum, void *pRenderAreaBits, int numArea, bool bViewerInSolidSpace ) = 0;
  881. virtual void *GetBuildViewVolumeCuller( void ) = 0;
  882. virtual Frustum_t *GetBuildViewFrustum( void ) = 0;
  883. virtual Frustum_t *GetBuildViewAreaFrustum( void ) = 0;
  884. virtual unsigned char *GetBuildViewRenderAreaBits( void ) = 0;
  885. #else
  886. virtual bool IsBuildWRThreaded( void ) = 0;
  887. virtual void QueueBuildWorldListJob( CJob* pJob ) = 0;
  888. virtual void CacheFrustumData( const Frustum_t& frustum, const CUtlVector< Frustum_t, CUtlMemoryAligned< Frustum_t,16 > >& aeraFrustums ) = 0;
  889. virtual const Frustum_t* GetBuildViewFrustum( void ) const = 0;
  890. virtual const CUtlVector< Frustum_t, CUtlMemoryAligned< Frustum_t,16 > >* GetBuildViewAeraFrustums( void ) const = 0;
  891. #endif
  892. virtual bool IsSubscribedMap( const char *pchMapName, bool bOnlyOnDisk ) = 0;
  893. virtual bool IsFeaturedMap( const char *pchMapName, bool bOnlyOnDisk ) = 0;
  894. // Gets file info for a workshop map, downloads latest version if needed
  895. virtual void DownloadCommunityMapFile( PublishedFileId_t id ) = 0;
  896. // Return download progress from 0.0 - 1.0, or -1.0 on error
  897. virtual float GetUGCFileDownloadProgress( PublishedFileId_t id ) = 0;
  898. virtual void RecordUIEvent( const char* szEvent ) = 0;
  899. // Inventory access
  900. virtual float FindInventoryItemWithMaxAttributeValue( char const *szItemType, char const *szAttrClass ) = 0;
  901. // Inventory access
  902. virtual void DetermineSubscriptionKvToAdvertise( KeyValues *kvLocalPlayer ) = 0;
  903. // Evidence validation
  904. virtual bool ValidateSignedEvidenceHeader( char const *szKey, void const *pvHeader, CDemoPlaybackParameters_t *pPlaybackParameters ) = 0;
  905. virtual void PrepareSignedEvidenceData( void *pvData, int numBytes, CDemoPlaybackParameters_t const *pPlaybackParameters ) = 0;
  906. virtual bool ShouldSkipEvidencePlayback( CDemoPlaybackParameters_t const *pPlaybackParameters ) = 0;
  907. // Scaleform slot controller
  908. virtual IScaleformSlotInitController * GetScaleformSlotInitController() = 0;
  909. virtual bool IsConnectedUserInfoChangeAllowed( IConVar *pCvar ) = 0;
  910. virtual char const * GetRichPresenceStatusString() = 0;
  911. // Returns true if the client can stop recording a demo now. If the client returns false,
  912. // an error message of up to length bytes should be returned in errorMsg.
  913. virtual bool CanStopRecordDemo( char *errorMsg, int length ) const = 0;
  914. virtual void OnHltvReplay( const CSVCMsg_HltvReplay &msg ) = 0;
  915. virtual void OnHltvReplayTick() = 0;
  916. virtual int GetHltvReplayDelay() = 0;
  917. virtual void OnDemoPlaybackTimeJump() = 0;
  918. virtual void OnCommandDuringPlayback( char const *cmd ) = 0;
  919. virtual void RetireAllPlayerDecals( bool bRenderContextValid ) = 0;
  920. virtual void EngineGotvSyncPacket( const CEngineGotvSyncPacket *pPkt ) = 0; // Engine asking GC for a sync packet
  921. virtual int GetInEyeEntity() const = 0;
  922. virtual void OnTickPre( int tickcount ) = 0;
  923. };
  924. #define CLIENT_DLL_INTERFACE_VERSION "VClient018"
  925. //-----------------------------------------------------------------------------
  926. // Purpose: Interface exposed from the client .dll back to the engine for specifying shared .dll IAppSystems (e.g., ISoundEmitterSystem)
  927. //-----------------------------------------------------------------------------
  928. abstract_class IClientDLLSharedAppSystems
  929. {
  930. public:
  931. virtual int Count() = 0;
  932. virtual char const *GetDllName( int idx ) = 0;
  933. virtual char const *GetInterfaceName( int idx ) = 0;
  934. };
  935. #define CLIENT_DLL_SHARED_APPSYSTEMS "VClientDllSharedAppSystems001"
  936. #endif // CDLL_INT_H