Advertisement
Guest User

Untitled

a guest
May 25th, 2015
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.04 KB | None | 0 0
  1. #define VENGINETOOLFRAMEWORK_INTERFACE_VERSION "VENGINETOOLFRAMEWORK003"
  2.  
  3. struct model_t;
  4. struct studiohdr_t;
  5.  
  6. #include "toolframework/itoolentity.h"
  7.  
  8. // Exposed from engine to tools via, more involved version of above
  9. class IEngineTool : public IEngineToolFramework
  10. {
  11. public:
  12. virtual void GetServerFactory( CreateInterfaceFn& factory ) = 0;
  13. virtual void GetClientFactory( CreateInterfaceFn& factory ) = 0;
  14.  
  15. virtual float GetSoundDuration( const char *pszName ) = 0;
  16. virtual bool IsSoundStillPlaying( int guid ) = 0;
  17. // Returns the guid of the sound
  18. virtual int StartSound(
  19. int iUserData,
  20. bool staticsound,
  21. int iEntIndex,
  22. int iChannel,
  23. const char *pSample,
  24. float flVolume,
  25. soundlevel_t iSoundlevel,
  26. const Vector& origin,
  27. const Vector& direction,
  28. int iFlags = 0,
  29. int iPitch = PITCH_NORM,
  30. bool bUpdatePositions = true,
  31. float delay = 0.0f,
  32. int speakerentity = -1 ) = 0;
  33.  
  34. virtual void StopSoundByGuid( int guid ) = 0;
  35.  
  36. virtual void SetVolumeByGuid( int guid, float flVolume ) = 0;
  37.  
  38. // Returns how long the sound is
  39. virtual float GetSoundDuration( int guid ) = 0;
  40.  
  41. // Returns if the sound is looping
  42. virtual bool IsLoopingSound( int guid ) = 0;
  43. virtual void ReloadSound( const char *pSample ) = 0;
  44. virtual void StopAllSounds( ) = 0;
  45. virtual float GetMono16Samples( const char *pszName, CUtlVector< short >& sampleList ) = 0;
  46. virtual void SetAudioState( const AudioState_t &audioState ) = 0;
  47.  
  48. // Issue a console command
  49. virtual void Command( char const *cmd ) = 0;
  50. // Flush console command buffer right away
  51. virtual void Execute() = 0;
  52.  
  53. virtual char const *GetCurrentMap() = 0;
  54. virtual void ChangeToMap( char const *mapname ) = 0;
  55. virtual bool IsMapValid( char const *mapname ) = 0;
  56.  
  57. // Method for causing engine to call client to render scene with no view model or overlays
  58. // See cdll_int.h for enum RenderViewInfo_t for specifying whatToRender
  59. virtual void RenderView( CViewSetup &view, int nFlags, int whatToRender ) = 0;
  60.  
  61. // Returns true if the player is fully connected and active in game (i.e, not still loading)
  62. virtual bool IsInGame() = 0;
  63. // Returns true if the player is connected, but not necessarily active in game (could still be loading)
  64. virtual bool IsConnected() = 0;
  65.  
  66. virtual int GetMaxClients() = 0; // Tools might want to ensure single player, e.g.
  67.  
  68. virtual bool IsGamePaused() = 0;
  69. virtual void SetGamePaused( bool paused ) = 0;
  70.  
  71. virtual float GetTimescale() = 0; // Could do this via ConVar system, too
  72. virtual void SetTimescale( float scale ) = 0;
  73.  
  74. // Real time is unscaled, but is updated once per frame
  75. virtual float GetRealTime() = 0;
  76. virtual float GetRealFrameTime() = 0; // unscaled
  77.  
  78. // Get high precision timer (for profiling?)
  79. virtual float Time() = 0;
  80.  
  81. // Host time is scaled
  82. virtual float HostFrameTime() = 0; // host_frametime
  83. virtual float HostTime() = 0; // host_time
  84. virtual int HostTick() = 0; // host_tickcount
  85. virtual int HostFrameCount() = 0; // total famecount
  86.  
  87. virtual float ServerTime() = 0; // gpGlobals->curtime on server
  88. virtual float ServerFrameTime() = 0; // gpGlobals->frametime on server
  89. virtual int ServerTick() = 0; // gpGlobals->tickcount on server
  90. virtual float ServerTickInterval() = 0; // tick interval on server
  91.  
  92. virtual float ClientTime() = 0; // gpGlobals->curtime on client
  93. virtual float ClientFrameTime() = 0; // gpGlobals->frametime on client
  94. virtual int ClientTick() = 0; // gpGlobals->tickcount on client
  95.  
  96. virtual void SetClientFrameTime( float frametime ) = 0; // gpGlobals->frametime on client
  97.  
  98. // Currently the engine doesn't like to do networking when it's paused, but if a tool changes entity state, it can be useful to force
  99. // a network update to get that state over to the client
  100. virtual void ForceUpdateDuringPause() = 0;
  101.  
  102. // Maybe through modelcache???
  103. virtual model_t *GetModel( HTOOLHANDLE hEntity ) = 0;
  104. // Get the .mdl file used by entity (if it's a cbaseanimating)
  105. virtual studiohdr_t *GetStudioModel( HTOOLHANDLE hEntity ) = 0;
  106.  
  107. // SINGLE PLAYER/LISTEN SERVER ONLY (just matching the client .dll api for this)
  108. // Prints the formatted string to the notification area of the screen ( down the right hand edge
  109. // numbered lines starting at position 0
  110. virtual void Con_NPrintf( int pos, const char *fmt, ... ) = 0;
  111. // SINGLE PLAYER/LISTEN SERVER ONLY(just matching the client .dll api for this)
  112. // Similar to Con_NPrintf, but allows specifying custom text color and duration information
  113. virtual void Con_NXPrintf( const struct con_nprint_s *info, const char *fmt, ... ) = 0;
  114.  
  115. // Get the current game directory (hl2, tf2, hl1, cstrike, etc.)
  116. virtual void GetGameDir( char *szGetGameDir, int maxlength ) = 0;
  117.  
  118. // Do we need separate rects for the 3d "viewport" vs. the tools surface??? and can we control viewports from
  119. virtual void GetScreenSize( int& width, int &height ) = 0;
  120.  
  121. // GetRootPanel(VPANEL)
  122.  
  123. // Sets the location of the main view
  124. virtual void SetMainView( const Vector &vecOrigin, const QAngle &angles ) = 0;
  125.  
  126. // Gets the player view
  127. virtual bool GetPlayerView( CViewSetup &playerView, int x, int y, int w, int h ) = 0;
  128.  
  129. // From a location on the screen, figure out the vector into the world
  130. virtual void CreatePickingRay( const CViewSetup &viewSetup, int x, int y, Vector& org, Vector& forward ) = 0;
  131.  
  132. // precache methods
  133. virtual bool PrecacheSound( const char *pName, bool bPreload = false ) = 0;
  134. virtual bool PrecacheModel( const char *pName, bool bPreload = false ) = 0;
  135.  
  136. virtual void InstallQuitHandler( void *pvUserData, FnQuitHandler func ) = 0;
  137. virtual void TakeTGAScreenShot( char const *filename, int width, int height ) = 0;
  138. // Even if game is paused, force networking to update to get new server state down to client
  139. virtual void ForceSend() = 0;
  140.  
  141. virtual bool IsRecordingMovie() = 0;
  142.  
  143. // NOTE: Params can contain file name, frame rate, output avi, output raw, and duration
  144. virtual void StartMovieRecording( KeyValues *pMovieParams ) = 0;
  145. virtual void EndMovieRecording() = 0;
  146. virtual void CancelMovieRecording() = 0;
  147. virtual AVIHandle_t GetRecordingAVIHandle() = 0;
  148.  
  149. virtual void StartRecordingVoiceToFile( char const *filename, char const *pPathID = 0 ) = 0;
  150. virtual void StopRecordingVoiceToFile() = 0;
  151. virtual bool IsVoiceRecording() = 0;
  152.  
  153. // A version that simply accepts a ray (can work as a traceline or tracehull)
  154. virtual void TraceRay( const Ray_t &ray, unsigned int fMask, ITraceFilter *pTraceFilter, CBaseTrace *pTrace ) = 0; // client version
  155. virtual void TraceRayServer( const Ray_t &ray, unsigned int fMask, ITraceFilter *pTraceFilter, CBaseTrace *pTrace ) = 0;
  156.  
  157. virtual bool IsConsoleVisible() = 0;
  158.  
  159. virtual int GetPointContents( const Vector &vecPosition ) = 0;
  160.  
  161. virtual int GetActiveDLights( dlight_t *pList[MAX_DLIGHTS] ) = 0;
  162. virtual int GetLightingConditions( const Vector &vecPosition, Vector *pColors, int nMaxLocalLights, LightDesc_t *pLocalLights ) = 0;
  163.  
  164. virtual void GetWorldToScreenMatrixForView( const CViewSetup &view, VMatrix *pVMatrix ) = 0;
  165.  
  166. // Collision support
  167. virtual SpatialPartitionHandle_t CreatePartitionHandle( IHandleEntity *pEntity,
  168. SpatialPartitionListMask_t listMask, const Vector& mins, const Vector& maxs ) = 0;
  169. virtual void DestroyPartitionHandle( SpatialPartitionHandle_t hPartition ) = 0;
  170. virtual void InstallPartitionQueryCallback( IPartitionQueryCallback *pQuery ) = 0;
  171. virtual void RemovePartitionQueryCallback( IPartitionQueryCallback *pQuery ) = 0;
  172. virtual void ElementMoved( SpatialPartitionHandle_t handle,
  173. const Vector& mins, const Vector& maxs ) = 0;
  174. virtual void OnModeChanged( bool bGameMode ) = 0;
  175. // Get the engine's window.
  176. virtual void* GetEngineHwnd() = 0;
  177.  
  178. // Returns the actual elapsed time of the samples
  179. virtual float GetSoundElapsedTime( int guid ) = 0;
  180. virtual void ValidateSoundCache( char const *pchSoundName ) = 0;
  181. virtual void PrefetchSound( char const *pchSoundName ) = 0;
  182. };
  183.  
  184. #define VENGINETOOL_INTERFACE_VERSION "VENGINETOOL003"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement