· 8 years ago · Jun 03, 2018, 11:28 PM
1//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======//
2//
3// Purpose: Interfaces between the client.dll and engine
4//
5//===========================================================================//
6
7#ifndef CDLL_INT_H
8#define CDLL_INT_H
9#ifdef _WIN32
10#pragma once
11#endif
12
13#include "basetypes.h"
14#include "interface.h"
15#include "mathlib/mathlib.h"
16#include "const.h"
17#include "checksum_crc.h"
18#include "datamap.h"
19#include "tier1/bitbuf.h"
20#include "inputsystem/ButtonCode.h"
21
22#if !defined( _X360 )
23#include "xbox/xboxstubs.h"
24#endif
25
26//-----------------------------------------------------------------------------
27// forward declarations
28//-----------------------------------------------------------------------------
29class ClientClass;
30struct model_t;
31class CSentence;
32struct vrect_t;
33struct cmodel_t;
34class IMaterial;
35class CAudioSource;
36class CMeasureSection;
37class SurfInfo;
38class ISpatialQuery;
39struct cache_user_t;
40class IMaterialSystem;
41class VMatrix;
42struct ScreenFade_t;
43struct ScreenShake_t;
44class CViewSetup;
45class CEngineSprite;
46class CGlobalVarsBase;
47class CPhysCollide;
48class CSaveRestoreData;
49class INetChannelInfo;
50struct datamap_t;
51struct typedescription_t;
52class CStandardRecvProxies;
53struct client_textmessage_t;
54class IAchievementMgr;
55class CGamestatsData;
56
57//-----------------------------------------------------------------------------
58// Purpose: This data structure is filled in by the engine when the client .dll requests information about
59// other players that the engine knows about
60//-----------------------------------------------------------------------------
61
62// Engine player info, no game related infos here
63// If you change this, change the two byteswap defintions:
64// cdll_client_int.cpp and cdll_engine_int.cpp
65typedef struct player_info_s
66{
67 DECLARE_BYTESWAP_DATADESC();
68 // scoreboard information
69 char name[MAX_PLAYER_NAME_LENGTH];
70 // local server user ID, unique while server is running
71 int userID;
72 // global unique player identifer
73 char guid[SIGNED_GUID_LEN + 1];
74 // friends identification number
75 uint32 friendsID;
76 // friends name
77 char friendsName[MAX_PLAYER_NAME_LENGTH];
78 // true, if player is a bot controlled by game.dll
79 bool fakeplayer;
80 // true if player is the HLTV proxy
81 bool ishltv;
82 // custom files CRC for this player
83 CRC32_t customFiles[MAX_CUSTOM_FILES];
84 // this counter increases each time the server downloaded a new file
85 unsigned char filesDownloaded;
86} player_info_t;
87
88
89//-----------------------------------------------------------------------------
90// Hearing info
91//-----------------------------------------------------------------------------
92struct AudioState_t
93{
94 Vector m_Origin;
95 QAngle m_Angles;
96 bool m_bIsUnderwater;
97};
98
99
100//-----------------------------------------------------------------------------
101// Skybox visibility
102//-----------------------------------------------------------------------------
103enum SkyboxVisibility_t
104{
105 SKYBOX_NOT_VISIBLE = 0,
106 SKYBOX_3DSKYBOX_VISIBLE,
107 SKYBOX_2DSKYBOX_VISIBLE,
108};
109
110
111//-----------------------------------------------------------------------------
112// Purpose: The engine reports to the client DLL what stage it's entering so the DLL can latch events
113// and make sure that certain operations only happen during the right stages.
114// The value for each stage goes up as you move through the frame so you can check ranges of values
115// and if new stages get added in-between, the range is still valid.
116//-----------------------------------------------------------------------------
117enum ClientFrameStage_t
118{
119 FRAME_UNDEFINED=-1, // (haven't run any frames yet)
120 FRAME_START,
121
122 // A network packet is being recieved
123 FRAME_NET_UPDATE_START,
124 // Data has been received and we're going to start calling PostDataUpdate
125 FRAME_NET_UPDATE_POSTDATAUPDATE_START,
126 // Data has been received and we've called PostDataUpdate on all data recipients
127 FRAME_NET_UPDATE_POSTDATAUPDATE_END,
128 // We've received all packets, we can now do interpolation, prediction, etc..
129 FRAME_NET_UPDATE_END,
130
131 // We're about to start rendering the scene
132 FRAME_RENDER_START,
133 // We've finished rendering the scene.
134 FRAME_RENDER_END
135};
136
137// Used by RenderView
138enum RenderViewInfo_t
139{
140 RENDERVIEW_UNSPECIFIED = 0,
141 RENDERVIEW_DRAWVIEWMODEL = (1<<0),
142 RENDERVIEW_DRAWHUD = (1<<1),
143 RENDERVIEW_SUPPRESSMONITORRENDERING = (1<<2),
144};
145
146//-----------------------------------------------------------------------------
147// Lightcache entry handle
148//-----------------------------------------------------------------------------
149DECLARE_POINTER_HANDLE( LightCacheHandle_t );
150
151
152//-----------------------------------------------------------------------------
153// Occlusion parameters
154//-----------------------------------------------------------------------------
155struct OcclusionParams_t
156{
157 float m_flMaxOccludeeArea;
158 float m_flMinOccluderArea;
159};
160
161
162//-----------------------------------------------------------------------------
163// Just an interface version name for the random number interface
164// See vstdlib/random.h for the interface definition
165// NOTE: If you change this, also change VENGINE_SERVER_RANDOM_INTERFACE_VERSION in eiface.h
166//-----------------------------------------------------------------------------
167#define VENGINE_CLIENT_RANDOM_INTERFACE_VERSION "VEngineRandom001"
168
169// change this when the new version is incompatable with the old
170#define VENGINE_CLIENT_INTERFACE_VERSION "VEngineClient013"
171
172//-----------------------------------------------------------------------------
173// Purpose: Interface exposed from the engine to the client .dll
174//-----------------------------------------------------------------------------
175abstract_class IVEngineClient
176{
177public:
178 // Find the model's surfaces that intersect the given sphere.
179 // Returns the number of surfaces filled in.
180 virtual int GetIntersectingSurfaces(
181 const model_t *model,
182 const Vector &vCenter,
183 const float radius,
184 const bool bOnlyVisibleSurfaces, // Only return surfaces visible to vCenter.
185 SurfInfo *pInfos,
186 const int nMaxInfos) = 0;
187
188 // Get the lighting intensivty for a specified point
189 // If bClamp is specified, the resulting Vector is restricted to the 0.0 to 1.0 for each element
190 virtual Vector GetLightForPoint(const Vector &pos, bool bClamp) = 0;
191
192 // Traces the line and reports the material impacted as well as the lighting information for the impact point
193 virtual IMaterial *TraceLineMaterialAndLighting( const Vector &start, const Vector &end,
194 Vector &diffuseLightColor, Vector& baseColor ) = 0;
195
196 // Given an input text buffer data pointer, parses a single token into the variable token and returns the new
197 // reading position
198 virtual const char *ParseFile( const char *data, char *token, int maxlen ) = 0;
199 virtual bool CopyFile( const char *source, const char *destination ) = 0;
200
201 // Gets the dimensions of the game window
202 virtual void GetScreenSize( int& width, int& height ) = 0;
203
204 // Forwards szCmdString to the server, sent reliably if bReliable is set
205 virtual void ServerCmd( const char *szCmdString, bool bReliable = true ) = 0;
206 // Inserts szCmdString into the command buffer as if it was typed by the client to his/her console.
207 // Note: Calls to this are checked against FCVAR_CLIENTCMD_CAN_EXECUTE (if that bit is not set, then this function can't change it).
208 // Call ClientCmd_Unrestricted to have access to FCVAR_CLIENTCMD_CAN_EXECUTE vars.
209 virtual void ClientCmd( const char *szCmdString ) = 0;
210
211 // Fill in the player info structure for the specified player index (name, model, etc.)
212 virtual bool GetPlayerInfo( int ent_num, player_info_t *pinfo ) = 0;
213
214 // Retrieve the player entity number for a specified userID
215 virtual int GetPlayerForUserID( int userID ) = 0;
216
217 // Retrieves text message system information for the specified message by name
218 virtual client_textmessage_t *TextMessageGet( const char *pName ) = 0;
219
220 // Returns true if the console is visible
221 virtual bool Con_IsVisible( void ) = 0;
222
223 // Get the entity index of the local player
224 virtual int GetLocalPlayer( void ) = 0;
225
226 // Client DLL is hooking a model, loads the model into memory and returns pointer to the model_t
227 virtual const model_t *LoadModel( const char *pName, bool bProp = false ) = 0;
228
229 // Get accurate, sub-frame clock ( profiling use )
230 virtual float Time( void ) = 0;
231
232 // Get the exact server timesstamp ( server time ) from the last message received from the server
233 virtual float GetLastTimeStamp( void ) = 0;
234
235 // Given a CAudioSource (opaque pointer), retrieve the underlying CSentence object ( stores the words, phonemes, and close
236 // captioning data )
237 virtual CSentence *GetSentence( CAudioSource *pAudioSource ) = 0;
238 // Given a CAudioSource, determines the length of the underlying audio file (.wav, .mp3, etc.)
239 virtual float GetSentenceLength( CAudioSource *pAudioSource ) = 0;
240 // Returns true if the sound is streaming off of the hard disk (instead of being memory resident)
241 virtual bool IsStreaming( CAudioSource *pAudioSource ) const = 0;
242
243 // Copy current view orientation into va
244 virtual void GetViewAngles( QAngle& va ) = 0;
245 // Set current view orientation from va
246 virtual void SetViewAngles( QAngle& va ) = 0;
247
248 // Retrieve the current game's maxclients setting
249 virtual int GetMaxClients( void ) = 0;
250
251 // Given the string pBinding which may be bound to a key,
252 // returns the string name of the key to which this string is bound. Returns NULL if no such binding exists
253 virtual const char *Key_LookupBinding( const char *pBinding ) = 0;
254
255 // Given the name of the key "mouse1", "e", "tab", etc., return the string it is bound to "+jump", "impulse 50", etc.
256 virtual const char *Key_BindingForKey( ButtonCode_t &code ) = 0;
257
258 // key trapping (for binding keys)
259 virtual void StartKeyTrapMode( void ) = 0;
260 virtual bool CheckDoneKeyTrapping( ButtonCode_t &code ) = 0;
261
262 // Returns true if the player is fully connected and active in game (i.e, not still loading)
263 virtual bool IsInGame( void ) = 0;
264 // Returns true if the player is connected, but not necessarily active in game (could still be loading)
265 virtual bool IsConnected( void ) = 0;
266 // Returns true if the loading plaque should be drawn
267 virtual bool IsDrawingLoadingImage( void ) = 0;
268
269 // Prints the formatted string to the notification area of the screen ( down the right hand edge
270 // numbered lines starting at position 0
271 virtual void Con_NPrintf( int pos, const char *fmt, ... ) = 0;
272 // Similar to Con_NPrintf, but allows specifying custom text color and duration information
273 virtual void Con_NXPrintf( const struct con_nprint_s *info, const char *fmt, ... ) = 0;
274
275 // Is the specified world-space bounding box inside the view frustum?
276 virtual int IsBoxVisible( const Vector& mins, const Vector& maxs ) = 0;
277
278 // Is the specified world-space boudning box in the same PVS cluster as the view origin?
279 virtual int IsBoxInViewCluster( const Vector& mins, const Vector& maxs ) = 0;
280
281 // Returns true if the specified box is outside of the view frustum and should be culled
282 virtual bool CullBox( const Vector& mins, const Vector& maxs ) = 0;
283
284 // Allow the sound system to paint additional data (during lengthy rendering operations) to prevent stuttering sound.
285 virtual void Sound_ExtraUpdate( void ) = 0;
286
287 // Get the current game directory ( e.g., hl2, tf2, cstrike, hl1 )
288 virtual const char *GetGameDirectory( void ) = 0;
289
290 // Get access to the world to screen transformation matrix
291 virtual const VMatrix& WorldToScreenMatrix() = 0;
292
293 // Get the matrix to move a point from world space into view space
294 // (translate and rotate so the camera is at the origin looking down X).
295 virtual const VMatrix& WorldToViewMatrix() = 0;
296
297 // The .bsp file can have mod-specified data lumps. These APIs are for working with such game lumps.
298
299 // Get mod-specified lump version id for the specified game data lump
300 virtual int GameLumpVersion( int lumpId ) const = 0;
301 // Get the raw size of the specified game data lump.
302 virtual int GameLumpSize( int lumpId ) const = 0;
303 // Loads a game lump off disk, writing the data into the buffer pointed to bye pBuffer
304 // Returns false if the data can't be read or the destination buffer is too small
305 virtual bool LoadGameLump( int lumpId, void* pBuffer, int size ) = 0;
306
307 // Returns the number of leaves in the level
308 virtual int LevelLeafCount() const = 0;
309
310 // Gets a way to perform spatial queries on the BSP tree
311 virtual ISpatialQuery* GetBSPTreeQuery() = 0;
312
313 // Convert texlight to gamma...
314 virtual void LinearToGamma( float* linear, float* gamma ) = 0;
315
316 // Get the lightstyle value
317 virtual float LightStyleValue( int style ) = 0;
318
319 // Computes light due to dynamic lighting at a point
320 // If the normal isn't specified, then it'll return the maximum lighting
321 virtual void ComputeDynamicLighting( const Vector& pt, const Vector* pNormal, Vector& color ) = 0;
322
323 // Returns the color of the ambient light
324 virtual void GetAmbientLightColor( Vector& color ) = 0;
325
326 // Returns the dx support level
327 virtual int GetDXSupportLevel() = 0;
328
329 // GR - returns the HDR support status
330 virtual bool SupportsHDR() = 0;
331
332 // Replace the engine's material system pointer.
333 virtual void Mat_Stub( IMaterialSystem *pMatSys ) = 0;
334
335 // Get the name of the current map
336 virtual void GetChapterName( char *pchBuff, int iMaxLength ) = 0;
337 virtual char const *GetLevelName( void ) = 0;
338#if !defined( NO_VOICE )
339 // Obtain access to the voice tweaking API
340 virtual struct IVoiceTweak_s *GetVoiceTweakAPI( void ) = 0;
341#endif
342 // Tell engine stats gathering system that the rendering frame is beginning/ending
343 virtual void EngineStats_BeginFrame( void ) = 0;
344 virtual void EngineStats_EndFrame( void ) = 0;
345
346 // This tells the engine to fire any events (temp entity messages) that it has queued up this frame.
347 // It should only be called once per frame.
348 virtual void FireEvents() = 0;
349
350 // Returns an area index if all the leaves are in the same area. If they span multple areas, then it returns -1.
351 virtual int GetLeavesArea( int *pLeaves, int nLeaves ) = 0;
352
353 // Returns true if the box touches the specified area's frustum.
354 virtual bool DoesBoxTouchAreaFrustum( const Vector &mins, const Vector &maxs, int iArea ) = 0;
355
356 // Sets the hearing origin (i.e., the origin and orientation of the listener so that the sound system can spatialize
357 // sound appropriately ).
358 virtual void SetAudioState( const AudioState_t& state ) = 0;
359
360 // Sentences / sentence groups
361 virtual int SentenceGroupPick( int groupIndex, char *name, int nameBufLen ) = 0;
362 virtual int SentenceGroupPickSequential( int groupIndex, char *name, int nameBufLen, int sentenceIndex, int reset ) = 0;
363 virtual int SentenceIndexFromName( const char *pSentenceName ) = 0;
364 virtual const char *SentenceNameFromIndex( int sentenceIndex ) = 0;
365 virtual int SentenceGroupIndexFromName( const char *pGroupName ) = 0;
366 virtual const char *SentenceGroupNameFromIndex( int groupIndex ) = 0;
367 virtual float SentenceLength( int sentenceIndex ) = 0;
368
369 // Computes light due to dynamic lighting at a point
370 // If the normal isn't specified, then it'll return the maximum lighting
371 // If pBoxColors is specified (it's an array of 6), then it'll copy the light contribution at each box side.
372 virtual void ComputeLighting( const Vector& pt, const Vector* pNormal, bool bClamp, Vector& color, Vector *pBoxColors=NULL ) = 0;
373
374 // Activates/deactivates an occluder...
375 virtual void ActivateOccluder( int nOccluderIndex, bool bActive ) = 0;
376 virtual bool IsOccluded( const Vector &vecAbsMins, const Vector &vecAbsMaxs ) = 0;
377
378 // The save restore system allocates memory from a shared memory pool, use this allocator to allocate/free saverestore
379 // memory.
380 virtual void *SaveAllocMemory( size_t num, size_t size ) = 0;
381 virtual void SaveFreeMemory( void *pSaveMem ) = 0;
382
383 // returns info interface for client netchannel
384 virtual INetChannelInfo *GetNetChannelInfo( void ) = 0;
385
386 // Debugging functionality:
387 // Very slow routine to draw a physics model
388 virtual void DebugDrawPhysCollide( const CPhysCollide *pCollide, IMaterial *pMaterial, matrix3x4_t& transform, const color32 &color ) = 0;
389 // This can be used to notify test scripts that we're at a particular spot in the code.
390 virtual void CheckPoint( const char *pName ) = 0;
391 // Draw portals if r_DrawPortals is set (Debugging only)
392 virtual void DrawPortals() = 0;
393 // Determine whether the client is playing back or recording a demo
394 virtual bool IsPlayingDemo( void ) = 0;
395 virtual bool IsRecordingDemo( void ) = 0;
396 virtual bool IsPlayingTimeDemo( void ) = 0;
397 // Is the game paused?
398 virtual bool IsPaused( void ) = 0;
399 // Is the game currently taking a screenshot?
400 virtual bool IsTakingScreenshot( void ) = 0;
401 // Is this a HLTV broadcast ?
402 virtual bool IsHLTV( void ) = 0;
403 // is this level loaded as just the background to the main menu? (active, but unplayable)
404 virtual bool IsLevelMainMenuBackground( void ) = 0;
405 // returns the name of the background level
406 virtual void GetMainMenuBackgroundName( char *dest, int destlen ) = 0;
407
408 // Occlusion system control
409 virtual void SetOcclusionParameters( const OcclusionParams_t ¶ms ) = 0;
410
411 // What language is the user expecting to hear .wavs in, "english" or another...
412 virtual void GetUILanguage( char *dest, int destlen ) = 0;
413
414 // Can skybox be seen from a particular point?
415 virtual SkyboxVisibility_t IsSkyboxVisibleFromPoint( const Vector &vecPoint ) = 0;
416
417 // Get the pristine map entity lump string. (e.g., used by CS to reload the map entities when restarting a round.)
418 virtual const char* GetMapEntitiesString() = 0;
419
420 // Is the engine in map edit mode ?
421 virtual bool IsInEditMode( void ) = 0;
422
423 // current screen aspect ratio (eg. 4.0f/3.0f, 16.0f/9.0f)
424 virtual float GetScreenAspectRatio() = 0;
425
426 // allow the game UI to login a user
427 virtual bool REMOVED_SteamRefreshLogin( const char *password, bool isSecure ) = 0;
428 virtual bool REMOVED_SteamProcessCall( bool & finished ) = 0;
429
430 // allow other modules to know about engine versioning (one use is a proxy for network compatability)
431 virtual unsigned int GetEngineBuildNumber() = 0; // engines build
432 virtual const char * GetProductVersionString() = 0; // mods version number (steam.inf)
433
434 // Communicates to the color correction editor that it's time to grab the pre-color corrected frame
435 // Passes in the actual size of the viewport
436 virtual void GrabPreColorCorrectedFrame( int x, int y, int width, int height ) = 0;
437
438 virtual bool IsHammerRunning( ) const = 0;
439
440 // Inserts szCmdString into the command buffer as if it was typed by the client to his/her console.
441 // And then executes the command string immediately (vs ClientCmd() which executes in the next frame)
442 //
443 // Note: this is NOT checked against the FCVAR_CLIENTCMD_CAN_EXECUTE vars.
444 virtual void ExecuteClientCmd( const char *szCmdString ) = 0;
445
446 // returns if the loaded map was processed with HDR info. This will be set regardless
447 // of what HDR mode the player is in.
448 virtual bool MapHasHDRLighting(void) = 0;
449
450 virtual int GetAppID() = 0;
451
452 // Just get the leaf ambient light - no caching, no samples
453 virtual Vector GetLightForPointFast(const Vector &pos, bool bClamp) = 0;
454
455 // This version does NOT check against FCVAR_CLIENTCMD_CAN_EXECUTE.
456 virtual void ClientCmd_Unrestricted( const char *szCmdString ) = 0;
457
458 // This used to be accessible through the cl_restrict_server_commands cvar.
459 // By default, Valve games restrict the server to only being able to execute commands marked with FCVAR_SERVER_CAN_EXECUTE.
460 // By default, mods are allowed to execute any server commands, and they can restrict the server's ability to execute client
461 // commands with this function.
462 virtual void SetRestrictServerCommands( bool bRestrict ) = 0;
463
464 // If set to true (defaults to true for Valve games and false for others), then IVEngineClient::ClientCmd
465 // can only execute things marked with FCVAR_CLIENTCMD_CAN_EXECUTE.
466 virtual void SetRestrictClientCommands( bool bRestrict ) = 0;
467
468 // Sets the client renderable for an overlay's material proxy to bind to
469 virtual void SetOverlayBindProxy( int iOverlayID, void *pBindProxy ) = 0;
470
471 virtual bool CopyFrameBufferToMaterial( const char *pMaterialName ) = 0;
472
473 // Matchmaking
474 virtual void ChangeTeam( const char *pTeamName ) = 0;
475
476 // Causes the engine to read in the user's configuration on disk
477 virtual void ReadConfiguration( const bool readDefault = false ) = 0;
478
479 virtual void SetAchievementMgr( IAchievementMgr *pAchievementMgr ) = 0;
480 virtual IAchievementMgr *GetAchievementMgr() = 0;
481
482 virtual bool MapLoadFailed( void ) = 0;
483 virtual void SetMapLoadFailed( bool bState ) = 0;
484
485 virtual bool IsLowViolence() = 0;
486 virtual const char *GetMostRecentSaveGame( void ) = 0;
487 virtual void SetMostRecentSaveGame( const char *lpszFilename ) = 0;
488
489 virtual void StartXboxExitingProcess() = 0;
490 virtual bool IsSaveInProgress() = 0;
491 virtual uint OnStorageDeviceAttached( void ) = 0;
492 virtual void OnStorageDeviceDetached( void ) = 0;
493
494 virtual void ResetDemoInterpolation( void ) = 0;
495
496 // Methods to set/get a gamestats data container so client & server running in same process can send combined data
497 virtual void SetGamestatsData( CGamestatsData *pGamestatsData ) = 0;
498 virtual CGamestatsData *GetGamestatsData() = 0;
499};
500
501
502//-----------------------------------------------------------------------------
503// Purpose: Interface exposed from the client .dll back to the engine
504//-----------------------------------------------------------------------------
505abstract_class IBaseClientDLL
506{
507public:
508 // Called once when the client DLL is loaded
509 virtual int Init( CreateInterfaceFn appSystemFactory,
510 CreateInterfaceFn physicsFactory,
511 CGlobalVarsBase *pGlobals ) = 0;
512
513 virtual void PostInit() = 0;
514
515 // Called once when the client DLL is being unloaded
516 virtual void Shutdown( void ) = 0;
517
518 // Called at the start of each level change
519 virtual void LevelInitPreEntity( char const* pMapName ) = 0;
520 // Called at the start of a new level, after the entities have been received and created
521 virtual void LevelInitPostEntity( ) = 0;
522 // Called at the end of a level
523 virtual void LevelShutdown( void ) = 0;
524
525 // Request a pointer to the list of client datatable classes
526 virtual ClientClass *GetAllClasses( void ) = 0;
527
528 // Called once per level to re-initialize any hud element drawing stuff
529 virtual int HudVidInit( void ) = 0;
530 // Called by the engine when gathering user input
531 virtual void HudProcessInput( bool bActive ) = 0;
532 // Called oncer per frame to allow the hud elements to think
533 virtual void HudUpdate( bool bActive ) = 0;
534 // Reset the hud elements to their initial states
535 virtual void HudReset( void ) = 0;
536 // Display a hud text message
537 virtual void HudText( const char * message ) = 0;
538
539 // Mouse Input Interfaces
540 // Activate the mouse (hides the cursor and locks it to the center of the screen)
541 virtual void IN_ActivateMouse( void ) = 0;
542 // Deactivates the mouse (shows the cursor and unlocks it)
543 virtual void IN_DeactivateMouse( void ) = 0;
544 // This is only called during extra sound updates and just accumulates mouse x, y offets and recenters the mouse.
545 // This call is used to try to prevent the mouse from appearing out of the side of a windowed version of the engine if
546 // rendering or other processing is taking too long
547 virtual void IN_Accumulate (void) = 0;
548 // Reset all key and mouse states to their initial, unpressed state
549 virtual void IN_ClearStates (void) = 0;
550 // If key is found by name, returns whether it's being held down in isdown, otherwise function returns false
551 virtual bool IN_IsKeyDown( const char *name, bool& isdown ) = 0;
552 // Raw keyboard signal, if the client .dll returns 1, the engine processes the key as usual, otherwise,
553 // if the client .dll returns 0, the key is swallowed.
554 virtual int IN_KeyEvent( int eventcode, ButtonCode_t keynum, const char *pszCurrentBinding ) = 0;
555
556 // This function is called once per tick to create the player CUserCmd (used for prediction/physics simulation of the player)
557 // Because the mouse can be sampled at greater than the tick interval, there is a separate input_sample_frametime, which
558 // specifies how much additional mouse / keyboard simulation to perform.
559 virtual void CreateMove (
560 int sequence_number, // sequence_number of this cmd
561 float input_sample_frametime, // Frametime for mouse input sampling
562 bool active ) = 0; // True if the player is active (not paused)
563
564 // If the game is running faster than the tick_interval framerate, then we do extra mouse sampling to avoid jittery input
565 // This code path is much like the normal move creation code, except no move is created
566 virtual void ExtraMouseSample( float frametime, bool active ) = 0;
567
568 // Encode the delta (changes) between the CUserCmd in slot from vs the one in slot to. The game code will have
569 // matching logic to read the delta.
570 virtual bool WriteUsercmdDeltaToBuffer( bf_write *buf, int from, int to, bool isnewcommand ) = 0;
571 // Demos need to be able to encode/decode CUserCmds to memory buffers, so these functions wrap that
572 virtual void EncodeUserCmdToBuffer( bf_write& buf, int slot ) = 0;
573 virtual void DecodeUserCmdFromBuffer( bf_read& buf, int slot ) = 0;
574
575 // Set up and render one or more views (e.g., rear view window, etc.). This called into RenderView below
576 virtual void View_Render( vrect_t *rect ) = 0;
577
578 // Allow engine to expressly render a view (e.g., during timerefresh)
579 // See IVRenderView.h, PushViewFlags_t for nFlags values
580 virtual void RenderView( const CViewSetup &view, int nClearFlags, int whatToDraw ) = 0;
581
582 // Apply screen fade directly from engine
583 virtual void View_Fade( ScreenFade_t *pSF ) = 0;
584
585 // The engine has parsed a crosshair angle message, this function is called to dispatch the new crosshair angle
586 virtual void SetCrosshairAngle( const QAngle& angle ) = 0;
587
588 // Sprite (.spr) model handling code
589 // Load a .spr file by name
590 virtual void InitSprite( CEngineSprite *pSprite, const char *loadname ) = 0;
591 // Shutdown a .spr file
592 virtual void ShutdownSprite( CEngineSprite *pSprite ) = 0;
593 // Returns sizeof( CEngineSprite ) so the engine can allocate appropriate memory
594 virtual int GetSpriteSize( void ) const = 0;
595
596 // Called when a player starts or stops talking.
597 // entindex is -1 to represent the local client talking (before the data comes back from the server).
598 // entindex is -2 to represent the local client's voice being acked by the server.
599 // entindex is GetPlayer() when the server acknowledges that the local client is talking.
600 virtual void VoiceStatus( int entindex, qboolean bTalking ) = 0;
601
602 // Networked string table definitions have arrived, allow client .dll to
603 // hook string changes with a callback function ( see INetworkStringTableClient.h )
604 virtual void InstallStringTableCallback( char const *tableName ) = 0;
605
606 // Notification that we're moving into another stage during the frame.
607 virtual void FrameStageNotify( ClientFrameStage_t curStage ) = 0;
608
609 // The engine has received the specified user message, this code is used to dispatch the message handler
610 virtual bool DispatchUserMessage( int msg_type, bf_read &msg_data ) = 0;
611
612 // Save/restore system hooks
613 virtual CSaveRestoreData *SaveInit( int size ) = 0;
614 virtual void SaveWriteFields( CSaveRestoreData *, const char *, void *, datamap_t *, typedescription_t *, int ) = 0;
615 virtual void SaveReadFields( CSaveRestoreData *, const char *, void *, datamap_t *, typedescription_t *, int ) = 0;
616 virtual void PreSave( CSaveRestoreData * ) = 0;
617 virtual void Save( CSaveRestoreData * ) = 0;
618 virtual void WriteSaveHeaders( CSaveRestoreData * ) = 0;
619 virtual void ReadRestoreHeaders( CSaveRestoreData * ) = 0;
620 virtual void Restore( CSaveRestoreData *, bool ) = 0;
621 virtual void DispatchOnRestore() = 0;
622
623 // Hand over the StandardRecvProxies in the client DLL's module.
624 virtual CStandardRecvProxies* GetStandardRecvProxies() = 0;
625
626 // save game screenshot writing
627 virtual void WriteSaveGameScreenshot( const char *pFilename ) = 0;
628
629 // Given a list of "S(wavname) S(wavname2)" tokens, look up the localized text and emit
630 // the appropriate close caption if running with closecaption = 1
631 virtual void EmitSentenceCloseCaption( char const *tokenstream ) = 0;
632 // Emits a regular close caption by token name
633 virtual void EmitCloseCaption( char const *captionname, float duration ) = 0;
634
635 // Returns true if the client can start recording a demo now. If the client returns false,
636 // an error message of up to length bytes should be returned in errorMsg.
637 virtual bool CanRecordDemo( char *errorMsg, int length ) const = 0;
638
639 // Added interface
640
641 // save game screenshot writing
642 virtual void WriteSaveGameScreenshotOfSize( const char *pFilename, int width, int height ) = 0;
643
644 // Gets the current view
645 virtual bool GetPlayerView( CViewSetup &playerView ) = 0;
646
647 // Matchmaking
648 virtual void SetupGameProperties( CUtlVector< XUSER_CONTEXT > &contexts, CUtlVector< XUSER_PROPERTY > &properties ) = 0;
649 virtual uint GetPresenceID( const char *pIDName ) = 0;
650 virtual const char *GetPropertyIdString( const uint id ) = 0;
651 virtual void GetPropertyDisplayString( uint id, uint value, char *pOutput, int nBytes ) = 0;
652#ifdef _WIN32
653 virtual void StartStatsReporting( HANDLE handle, bool bArbitrated ) = 0;
654#endif
655
656 virtual void InvalidateMdlCache() = 0;
657
658 virtual void IN_SetSampleTime( float frametime ) = 0;
659
660};
661
662#define CLIENT_DLL_INTERFACE_VERSION "VClient016"
663
664//-----------------------------------------------------------------------------
665// Purpose: Interface exposed from the client .dll back to the engine for specifying shared .dll IAppSystems (e.g., ISoundEmitterSystem)
666//-----------------------------------------------------------------------------
667abstract_class IClientDLLSharedAppSystems
668{
669public:
670 virtual int Count() = 0;
671 virtual char const *GetDllName( int idx ) = 0;
672 virtual char const *GetInterfaceName( int idx ) = 0;
673};
674
675#define CLIENT_DLL_SHARED_APPSYSTEMS "VClientDllSharedAppSystems001"
676
677#endif // CDLL_INT_H