diff options
| author | Narendra Umate <[email protected]> | 2013-12-02 23:36:05 -0800 |
|---|---|---|
| committer | Narendra Umate <[email protected]> | 2013-12-02 23:36:05 -0800 |
| commit | 8737f191f3b59f001a77bf6c08091109211c1c9f (patch) | |
| tree | dbbf05c004d9b026f2c1f23f06600fe0add82c36 /mp/src/public/toolframework | |
| parent | Update .gitignore. (diff) | |
| parent | Make .xcconfigs text files too. (diff) | |
| download | source-sdk-2013-8737f191f3b59f001a77bf6c08091109211c1c9f.tar.xz source-sdk-2013-8737f191f3b59f001a77bf6c08091109211c1c9f.zip | |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'mp/src/public/toolframework')
| -rw-r--r-- | mp/src/public/toolframework/iclientenginetools.h | 118 | ||||
| -rw-r--r-- | mp/src/public/toolframework/ienginetool.h | 466 | ||||
| -rw-r--r-- | mp/src/public/toolframework/iserverenginetools.h | 100 | ||||
| -rw-r--r-- | mp/src/public/toolframework/itooldictionary.h | 78 | ||||
| -rw-r--r-- | mp/src/public/toolframework/itoolentity.h | 496 | ||||
| -rw-r--r-- | mp/src/public/toolframework/itoolframework.h | 530 | ||||
| -rw-r--r-- | mp/src/public/toolframework/itoolsystem.h | 292 | ||||
| -rw-r--r-- | mp/src/public/toolframework/toolframework.cpp | 82 |
8 files changed, 1081 insertions, 1081 deletions
diff --git a/mp/src/public/toolframework/iclientenginetools.h b/mp/src/public/toolframework/iclientenginetools.h index 13e2edb3..32c460a5 100644 --- a/mp/src/public/toolframework/iclientenginetools.h +++ b/mp/src/public/toolframework/iclientenginetools.h @@ -1,59 +1,59 @@ -//========= Copyright Valve Corporation, All rights reserved. ============//
-//
-// Purpose:
-//
-//=============================================================================
-
-#ifndef ICLIENTENGINETOOLS_H
-#define ICLIENTENGINETOOLS_H
-#ifdef _WIN32
-#pragma once
-#endif
-
-#include "interface.h"
-#include "toolframework/itoolentity.h" // HTOOLHANDLE
-
-//-----------------------------------------------------------------------------
-// Forward declarations
-//-----------------------------------------------------------------------------
-class KeyValues;
-struct AudioState_t;
-
-
-//-----------------------------------------------------------------------------
-// Purpose: Exported from engine to client .dll to marshall tool framework calls
-// into IToolSystems
-//-----------------------------------------------------------------------------
-class IClientEngineTools : public IBaseInterface
-{
-public:
- // Level init, shutdown
- virtual void LevelInitPreEntityAllTools() = 0;
- // entities are created / spawned / precached here
- virtual void LevelInitPostEntityAllTools() = 0;
-
- virtual void LevelShutdownPreEntityAllTools() = 0;
- // Entities are deleted / released here...
- virtual void LevelShutdownPostEntityAllTools() = 0;
-
- virtual void PreRenderAllTools() = 0;
- virtual void PostRenderAllTools() = 0;
-
- virtual void PostToolMessage( HTOOLHANDLE hEntity, KeyValues *msg ) = 0;
-
- virtual void AdjustEngineViewport( int& x, int& y, int& width, int& height ) = 0;
- virtual bool SetupEngineView( Vector &origin, QAngle &angles, float &fov ) = 0;
- virtual bool SetupAudioState( AudioState_t &audioState ) = 0;
-
- // Paintmode is an enum declared in ienginevgui.h
- virtual void VGui_PreRenderAllTools( int paintMode ) = 0;
- virtual void VGui_PostRenderAllTools( int paintMode ) = 0;
-
- virtual bool IsThirdPersonCamera( ) = 0;
-
- virtual bool InToolMode() = 0;
-};
-
-#define VCLIENTENGINETOOLS_INTERFACE_VERSION "VCLIENTENGINETOOLS001"
-
-#endif // ICLIENTENGINETOOLS_H
+//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +//============================================================================= + +#ifndef ICLIENTENGINETOOLS_H +#define ICLIENTENGINETOOLS_H +#ifdef _WIN32 +#pragma once +#endif + +#include "interface.h" +#include "toolframework/itoolentity.h" // HTOOLHANDLE + +//----------------------------------------------------------------------------- +// Forward declarations +//----------------------------------------------------------------------------- +class KeyValues; +struct AudioState_t; + + +//----------------------------------------------------------------------------- +// Purpose: Exported from engine to client .dll to marshall tool framework calls +// into IToolSystems +//----------------------------------------------------------------------------- +class IClientEngineTools : public IBaseInterface +{ +public: + // Level init, shutdown + virtual void LevelInitPreEntityAllTools() = 0; + // entities are created / spawned / precached here + virtual void LevelInitPostEntityAllTools() = 0; + + virtual void LevelShutdownPreEntityAllTools() = 0; + // Entities are deleted / released here... + virtual void LevelShutdownPostEntityAllTools() = 0; + + virtual void PreRenderAllTools() = 0; + virtual void PostRenderAllTools() = 0; + + virtual void PostToolMessage( HTOOLHANDLE hEntity, KeyValues *msg ) = 0; + + virtual void AdjustEngineViewport( int& x, int& y, int& width, int& height ) = 0; + virtual bool SetupEngineView( Vector &origin, QAngle &angles, float &fov ) = 0; + virtual bool SetupAudioState( AudioState_t &audioState ) = 0; + + // Paintmode is an enum declared in ienginevgui.h + virtual void VGui_PreRenderAllTools( int paintMode ) = 0; + virtual void VGui_PostRenderAllTools( int paintMode ) = 0; + + virtual bool IsThirdPersonCamera( ) = 0; + + virtual bool InToolMode() = 0; +}; + +#define VCLIENTENGINETOOLS_INTERFACE_VERSION "VCLIENTENGINETOOLS001" + +#endif // ICLIENTENGINETOOLS_H diff --git a/mp/src/public/toolframework/ienginetool.h b/mp/src/public/toolframework/ienginetool.h index c68ca4e4..cf4bf89f 100644 --- a/mp/src/public/toolframework/ienginetool.h +++ b/mp/src/public/toolframework/ienginetool.h @@ -1,233 +1,233 @@ -//========= Copyright Valve Corporation, All rights reserved. ============//
-//
-// Purpose:
-//
-//=============================================================================
-
-#ifndef IENGINETOOL_H
-#define IENGINETOOL_H
-#ifdef _WIN32
-#pragma once
-#endif
-
-#include "interface.h"
-#include "soundflags.h"
-#include "video/ivideoservices.h"
-#include "ispatialpartition.h"
-
-class CViewSetup;
-class IToolSystem;
-class KeyValues;
-class ITraceFilter;
-class CBaseTrace;
-struct dlight_t;
-struct Ray_t;
-struct AudioState_t;
-
-
-typedef bool (*FnQuitHandler)( void *pvUserData );
-
-#ifndef MAX_DLIGHTS
-#define MAX_DLIGHTS 32
-#endif
-
-// Exposed from engine to all tools, simplest interface
-class IEngineToolFramework : public IBaseInterface
-{
-public:
- // Input system overrides TBD
- // Something like this
- //virtual void AddMessageHandler( int wm_message, bool (*pfnCallback)( int wm_message, int wParam, int lParam ) ) = 0;
- //virtual void RemoveMessageHanlder( int wm_message, bool (*pfnCallbackToRemove)( int wm_message, int wParam, int lParam ) ) = 0;
-
- // Helpers for implementing a tool switching UI
- virtual int GetToolCount() const = 0;
- virtual char const *GetToolName( int index ) const = 0;
- virtual void SwitchToTool( int index ) = 0;
-
- virtual bool IsTopmostTool( const IToolSystem *sys ) const = 0;
-
- virtual const IToolSystem *GetToolSystem( int index ) const = 0;
- virtual IToolSystem *GetTopmostTool() = 0;
-
- // Take over input
- virtual void ShowCursor( bool show ) = 0;
- virtual bool IsCursorVisible() const = 0;
-};
-
-#define VENGINETOOLFRAMEWORK_INTERFACE_VERSION "VENGINETOOLFRAMEWORK003"
-
-struct model_t;
-struct studiohdr_t;
-
-#include "toolframework/itoolentity.h"
-
-// Exposed from engine to tools via, more involved version of above
-class IEngineTool : public IEngineToolFramework
-{
-public:
- virtual void GetServerFactory( CreateInterfaceFn& factory ) = 0;
- virtual void GetClientFactory( CreateInterfaceFn& factory ) = 0;
-
- virtual float GetSoundDuration( const char *pszName ) = 0;
- virtual bool IsSoundStillPlaying( int guid ) = 0;
- // Returns the guid of the sound
- virtual int StartSound(
- int iUserData,
- bool staticsound,
- int iEntIndex,
- int iChannel,
- const char *pSample,
- float flVolume,
- soundlevel_t iSoundlevel,
- const Vector& origin,
- const Vector& direction,
- int iFlags = 0,
- int iPitch = PITCH_NORM,
- bool bUpdatePositions = true,
- float delay = 0.0f,
- int speakerentity = -1 ) = 0;
-
- virtual void StopSoundByGuid( int guid ) = 0;
-
- // Returns how long the sound is
- virtual float GetSoundDuration( int guid ) = 0;
-
- // Returns if the sound is looping
- virtual bool IsLoopingSound( int guid ) = 0;
- virtual void ReloadSound( const char *pSample ) = 0;
- virtual void StopAllSounds( ) = 0;
- virtual float GetMono16Samples( const char *pszName, CUtlVector< short >& sampleList ) = 0;
- virtual void SetAudioState( const AudioState_t &audioState ) = 0;
-
- // Issue a console command
- virtual void Command( char const *cmd ) = 0;
- // Flush console command buffer right away
- virtual void Execute() = 0;
-
- virtual char const *GetCurrentMap() = 0;
- virtual void ChangeToMap( char const *mapname ) = 0;
- virtual bool IsMapValid( char const *mapname ) = 0;
-
- // Method for causing engine to call client to render scene with no view model or overlays
- // See cdll_int.h for enum RenderViewInfo_t for specifying whatToRender
- virtual void RenderView( CViewSetup &view, int nFlags, int whatToRender ) = 0;
-
- // Returns true if the player is fully connected and active in game (i.e, not still loading)
- virtual bool IsInGame() = 0;
- // Returns true if the player is connected, but not necessarily active in game (could still be loading)
- virtual bool IsConnected() = 0;
-
- virtual int GetMaxClients() = 0; // Tools might want to ensure single player, e.g.
-
- virtual bool IsGamePaused() = 0;
- virtual void SetGamePaused( bool paused ) = 0;
-
- virtual float GetTimescale() = 0; // Could do this via ConVar system, too
- virtual void SetTimescale( float scale ) = 0;
-
- // Real time is unscaled, but is updated once per frame
- virtual float GetRealTime() = 0;
- virtual float GetRealFrameTime() = 0; // unscaled
-
- // Get high precision timer (for profiling?)
- virtual float Time() = 0;
-
- // Host time is scaled
- virtual float HostFrameTime() = 0; // host_frametime
- virtual float HostTime() = 0; // host_time
- virtual int HostTick() = 0; // host_tickcount
- virtual int HostFrameCount() = 0; // total famecount
-
- virtual float ServerTime() = 0; // gpGlobals->curtime on server
- virtual float ServerFrameTime() = 0; // gpGlobals->frametime on server
- virtual int ServerTick() = 0; // gpGlobals->tickcount on server
- virtual float ServerTickInterval() = 0; // tick interval on server
-
- virtual float ClientTime() = 0; // gpGlobals->curtime on client
- virtual float ClientFrameTime() = 0; // gpGlobals->frametime on client
- virtual int ClientTick() = 0; // gpGlobals->tickcount on client
-
- virtual void SetClientFrameTime( float frametime ) = 0; // gpGlobals->frametime on client
-
- // 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
- // a network update to get that state over to the client
- virtual void ForceUpdateDuringPause() = 0;
-
- // Maybe through modelcache???
- virtual model_t *GetModel( HTOOLHANDLE hEntity ) = 0;
- // Get the .mdl file used by entity (if it's a cbaseanimating)
- virtual studiohdr_t *GetStudioModel( HTOOLHANDLE hEntity ) = 0;
-
- // SINGLE PLAYER/LISTEN SERVER ONLY (just matching the client .dll api for this)
- // Prints the formatted string to the notification area of the screen ( down the right hand edge
- // numbered lines starting at position 0
- virtual void Con_NPrintf( int pos, PRINTF_FORMAT_STRING const char *fmt, ... ) = 0;
- // SINGLE PLAYER/LISTEN SERVER ONLY(just matching the client .dll api for this)
- // Similar to Con_NPrintf, but allows specifying custom text color and duration information
- virtual void Con_NXPrintf( const struct con_nprint_s *info, PRINTF_FORMAT_STRING const char *fmt, ... ) = 0;
-
- // Get the current game directory (hl2, tf2, hl1, cstrike, etc.)
- virtual void GetGameDir( char *szGetGameDir, int maxlength ) = 0;
-
-// Do we need separate rects for the 3d "viewport" vs. the tools surface??? and can we control viewports from
- virtual void GetScreenSize( int& width, int &height ) = 0;
-
- // GetRootPanel(VPANEL)
-
- // Sets the location of the main view
- virtual void SetMainView( const Vector &vecOrigin, const QAngle &angles ) = 0;
-
- // Gets the player view
- virtual bool GetPlayerView( CViewSetup &playerView, int x, int y, int w, int h ) = 0;
-
- // From a location on the screen, figure out the vector into the world
- virtual void CreatePickingRay( const CViewSetup &viewSetup, int x, int y, Vector& org, Vector& forward ) = 0;
-
- // precache methods
- virtual bool PrecacheSound( const char *pName, bool bPreload = false ) = 0;
- virtual bool PrecacheModel( const char *pName, bool bPreload = false ) = 0;
-
- virtual void InstallQuitHandler( void *pvUserData, FnQuitHandler func ) = 0;
- virtual void TakeTGAScreenShot( char const *filename, int width, int height ) = 0;
- // Even if game is paused, force networking to update to get new server state down to client
- virtual void ForceSend() = 0;
-
- virtual bool IsRecordingMovie() = 0;
-
- // NOTE: Params can contain file name, frame rate, output avi, output raw, and duration
- virtual void StartMovieRecording( KeyValues *pMovieParams ) = 0;
- virtual void EndMovieRecording() = 0;
- virtual void CancelMovieRecording() = 0;
- virtual IVideoRecorder *GetActiveVideoRecorder() = 0;
-
- virtual void StartRecordingVoiceToFile( char const *filename, char const *pPathID = 0 ) = 0;
- virtual void StopRecordingVoiceToFile() = 0;
- virtual bool IsVoiceRecording() = 0;
-
- // A version that simply accepts a ray (can work as a traceline or tracehull)
- virtual void TraceRay( const Ray_t &ray, unsigned int fMask, ITraceFilter *pTraceFilter, CBaseTrace *pTrace ) = 0; // client version
- virtual void TraceRayServer( const Ray_t &ray, unsigned int fMask, ITraceFilter *pTraceFilter, CBaseTrace *pTrace ) = 0;
-
- virtual bool IsConsoleVisible() = 0;
-
- virtual int GetPointContents( const Vector &vecPosition ) = 0;
-
- virtual int GetActiveDLights( dlight_t *pList[MAX_DLIGHTS] ) = 0;
- virtual int GetLightingConditions( const Vector &vecPosition, Vector *pColors, int nMaxLocalLights, LightDesc_t *pLocalLights ) = 0;
-
- virtual void GetWorldToScreenMatrixForView( const CViewSetup &view, VMatrix *pVMatrix ) = 0;
-
- // Collision support
- virtual SpatialPartitionHandle_t CreatePartitionHandle( IHandleEntity *pEntity,
- SpatialPartitionListMask_t listMask, const Vector& mins, const Vector& maxs ) = 0;
- virtual void DestroyPartitionHandle( SpatialPartitionHandle_t hPartition ) = 0;
- virtual void InstallPartitionQueryCallback( IPartitionQueryCallback *pQuery ) = 0;
- virtual void RemovePartitionQueryCallback( IPartitionQueryCallback *pQuery ) = 0;
- virtual void ElementMoved( SpatialPartitionHandle_t handle,
- const Vector& mins, const Vector& maxs ) = 0;
-};
-
-#define VENGINETOOL_INTERFACE_VERSION "VENGINETOOL003"
-
-#endif // IENGINETOOL_H
+//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +//============================================================================= + +#ifndef IENGINETOOL_H +#define IENGINETOOL_H +#ifdef _WIN32 +#pragma once +#endif + +#include "interface.h" +#include "soundflags.h" +#include "video/ivideoservices.h" +#include "ispatialpartition.h" + +class CViewSetup; +class IToolSystem; +class KeyValues; +class ITraceFilter; +class CBaseTrace; +struct dlight_t; +struct Ray_t; +struct AudioState_t; + + +typedef bool (*FnQuitHandler)( void *pvUserData ); + +#ifndef MAX_DLIGHTS +#define MAX_DLIGHTS 32 +#endif + +// Exposed from engine to all tools, simplest interface +class IEngineToolFramework : public IBaseInterface +{ +public: + // Input system overrides TBD + // Something like this + //virtual void AddMessageHandler( int wm_message, bool (*pfnCallback)( int wm_message, int wParam, int lParam ) ) = 0; + //virtual void RemoveMessageHanlder( int wm_message, bool (*pfnCallbackToRemove)( int wm_message, int wParam, int lParam ) ) = 0; + + // Helpers for implementing a tool switching UI + virtual int GetToolCount() const = 0; + virtual char const *GetToolName( int index ) const = 0; + virtual void SwitchToTool( int index ) = 0; + + virtual bool IsTopmostTool( const IToolSystem *sys ) const = 0; + + virtual const IToolSystem *GetToolSystem( int index ) const = 0; + virtual IToolSystem *GetTopmostTool() = 0; + + // Take over input + virtual void ShowCursor( bool show ) = 0; + virtual bool IsCursorVisible() const = 0; +}; + +#define VENGINETOOLFRAMEWORK_INTERFACE_VERSION "VENGINETOOLFRAMEWORK003" + +struct model_t; +struct studiohdr_t; + +#include "toolframework/itoolentity.h" + +// Exposed from engine to tools via, more involved version of above +class IEngineTool : public IEngineToolFramework +{ +public: + virtual void GetServerFactory( CreateInterfaceFn& factory ) = 0; + virtual void GetClientFactory( CreateInterfaceFn& factory ) = 0; + + virtual float GetSoundDuration( const char *pszName ) = 0; + virtual bool IsSoundStillPlaying( int guid ) = 0; + // Returns the guid of the sound + virtual int StartSound( + int iUserData, + bool staticsound, + int iEntIndex, + int iChannel, + const char *pSample, + float flVolume, + soundlevel_t iSoundlevel, + const Vector& origin, + const Vector& direction, + int iFlags = 0, + int iPitch = PITCH_NORM, + bool bUpdatePositions = true, + float delay = 0.0f, + int speakerentity = -1 ) = 0; + + virtual void StopSoundByGuid( int guid ) = 0; + + // Returns how long the sound is + virtual float GetSoundDuration( int guid ) = 0; + + // Returns if the sound is looping + virtual bool IsLoopingSound( int guid ) = 0; + virtual void ReloadSound( const char *pSample ) = 0; + virtual void StopAllSounds( ) = 0; + virtual float GetMono16Samples( const char *pszName, CUtlVector< short >& sampleList ) = 0; + virtual void SetAudioState( const AudioState_t &audioState ) = 0; + + // Issue a console command + virtual void Command( char const *cmd ) = 0; + // Flush console command buffer right away + virtual void Execute() = 0; + + virtual char const *GetCurrentMap() = 0; + virtual void ChangeToMap( char const *mapname ) = 0; + virtual bool IsMapValid( char const *mapname ) = 0; + + // Method for causing engine to call client to render scene with no view model or overlays + // See cdll_int.h for enum RenderViewInfo_t for specifying whatToRender + virtual void RenderView( CViewSetup &view, int nFlags, int whatToRender ) = 0; + + // Returns true if the player is fully connected and active in game (i.e, not still loading) + virtual bool IsInGame() = 0; + // Returns true if the player is connected, but not necessarily active in game (could still be loading) + virtual bool IsConnected() = 0; + + virtual int GetMaxClients() = 0; // Tools might want to ensure single player, e.g. + + virtual bool IsGamePaused() = 0; + virtual void SetGamePaused( bool paused ) = 0; + + virtual float GetTimescale() = 0; // Could do this via ConVar system, too + virtual void SetTimescale( float scale ) = 0; + + // Real time is unscaled, but is updated once per frame + virtual float GetRealTime() = 0; + virtual float GetRealFrameTime() = 0; // unscaled + + // Get high precision timer (for profiling?) + virtual float Time() = 0; + + // Host time is scaled + virtual float HostFrameTime() = 0; // host_frametime + virtual float HostTime() = 0; // host_time + virtual int HostTick() = 0; // host_tickcount + virtual int HostFrameCount() = 0; // total famecount + + virtual float ServerTime() = 0; // gpGlobals->curtime on server + virtual float ServerFrameTime() = 0; // gpGlobals->frametime on server + virtual int ServerTick() = 0; // gpGlobals->tickcount on server + virtual float ServerTickInterval() = 0; // tick interval on server + + virtual float ClientTime() = 0; // gpGlobals->curtime on client + virtual float ClientFrameTime() = 0; // gpGlobals->frametime on client + virtual int ClientTick() = 0; // gpGlobals->tickcount on client + + virtual void SetClientFrameTime( float frametime ) = 0; // gpGlobals->frametime on client + + // 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 + // a network update to get that state over to the client + virtual void ForceUpdateDuringPause() = 0; + + // Maybe through modelcache??? + virtual model_t *GetModel( HTOOLHANDLE hEntity ) = 0; + // Get the .mdl file used by entity (if it's a cbaseanimating) + virtual studiohdr_t *GetStudioModel( HTOOLHANDLE hEntity ) = 0; + + // SINGLE PLAYER/LISTEN SERVER ONLY (just matching the client .dll api for this) + // Prints the formatted string to the notification area of the screen ( down the right hand edge + // numbered lines starting at position 0 + virtual void Con_NPrintf( int pos, PRINTF_FORMAT_STRING const char *fmt, ... ) = 0; + // SINGLE PLAYER/LISTEN SERVER ONLY(just matching the client .dll api for this) + // Similar to Con_NPrintf, but allows specifying custom text color and duration information + virtual void Con_NXPrintf( const struct con_nprint_s *info, PRINTF_FORMAT_STRING const char *fmt, ... ) = 0; + + // Get the current game directory (hl2, tf2, hl1, cstrike, etc.) + virtual void GetGameDir( char *szGetGameDir, int maxlength ) = 0; + +// Do we need separate rects for the 3d "viewport" vs. the tools surface??? and can we control viewports from + virtual void GetScreenSize( int& width, int &height ) = 0; + + // GetRootPanel(VPANEL) + + // Sets the location of the main view + virtual void SetMainView( const Vector &vecOrigin, const QAngle &angles ) = 0; + + // Gets the player view + virtual bool GetPlayerView( CViewSetup &playerView, int x, int y, int w, int h ) = 0; + + // From a location on the screen, figure out the vector into the world + virtual void CreatePickingRay( const CViewSetup &viewSetup, int x, int y, Vector& org, Vector& forward ) = 0; + + // precache methods + virtual bool PrecacheSound( const char *pName, bool bPreload = false ) = 0; + virtual bool PrecacheModel( const char *pName, bool bPreload = false ) = 0; + + virtual void InstallQuitHandler( void *pvUserData, FnQuitHandler func ) = 0; + virtual void TakeTGAScreenShot( char const *filename, int width, int height ) = 0; + // Even if game is paused, force networking to update to get new server state down to client + virtual void ForceSend() = 0; + + virtual bool IsRecordingMovie() = 0; + + // NOTE: Params can contain file name, frame rate, output avi, output raw, and duration + virtual void StartMovieRecording( KeyValues *pMovieParams ) = 0; + virtual void EndMovieRecording() = 0; + virtual void CancelMovieRecording() = 0; + virtual IVideoRecorder *GetActiveVideoRecorder() = 0; + + virtual void StartRecordingVoiceToFile( char const *filename, char const *pPathID = 0 ) = 0; + virtual void StopRecordingVoiceToFile() = 0; + virtual bool IsVoiceRecording() = 0; + + // A version that simply accepts a ray (can work as a traceline or tracehull) + virtual void TraceRay( const Ray_t &ray, unsigned int fMask, ITraceFilter *pTraceFilter, CBaseTrace *pTrace ) = 0; // client version + virtual void TraceRayServer( const Ray_t &ray, unsigned int fMask, ITraceFilter *pTraceFilter, CBaseTrace *pTrace ) = 0; + + virtual bool IsConsoleVisible() = 0; + + virtual int GetPointContents( const Vector &vecPosition ) = 0; + + virtual int GetActiveDLights( dlight_t *pList[MAX_DLIGHTS] ) = 0; + virtual int GetLightingConditions( const Vector &vecPosition, Vector *pColors, int nMaxLocalLights, LightDesc_t *pLocalLights ) = 0; + + virtual void GetWorldToScreenMatrixForView( const CViewSetup &view, VMatrix *pVMatrix ) = 0; + + // Collision support + virtual SpatialPartitionHandle_t CreatePartitionHandle( IHandleEntity *pEntity, + SpatialPartitionListMask_t listMask, const Vector& mins, const Vector& maxs ) = 0; + virtual void DestroyPartitionHandle( SpatialPartitionHandle_t hPartition ) = 0; + virtual void InstallPartitionQueryCallback( IPartitionQueryCallback *pQuery ) = 0; + virtual void RemovePartitionQueryCallback( IPartitionQueryCallback *pQuery ) = 0; + virtual void ElementMoved( SpatialPartitionHandle_t handle, + const Vector& mins, const Vector& maxs ) = 0; +}; + +#define VENGINETOOL_INTERFACE_VERSION "VENGINETOOL003" + +#endif // IENGINETOOL_H diff --git a/mp/src/public/toolframework/iserverenginetools.h b/mp/src/public/toolframework/iserverenginetools.h index 170c6edc..437a97da 100644 --- a/mp/src/public/toolframework/iserverenginetools.h +++ b/mp/src/public/toolframework/iserverenginetools.h @@ -1,50 +1,50 @@ -//========= Copyright Valve Corporation, All rights reserved. ============//
-//
-// Purpose:
-//
-//=============================================================================
-
-#ifndef ISERVERENGINETOOLS_H
-#define ISERVERENGINETOOLS_H
-#ifdef _WIN32
-#pragma once
-#endif
-
-#include "interface.h"
-
-//-----------------------------------------------------------------------------
-// Purpose: exposed from engine to game .dll
-//-----------------------------------------------------------------------------
-class IServerEngineTools : public IBaseInterface
-{
-public:
- // Level init, shutdown
- virtual void LevelInitPreEntityAllTools() = 0;
- // entities are created / spawned / precached here
- virtual void LevelInitPostEntityAllTools() = 0;
-
- virtual void LevelShutdownPreEntityAllTools() = 0;
- // Entities are deleted / released here...
- virtual void LevelShutdownPostEntityAllTools() = 0;
- // end of level shutdown
-
- // Called each frame before entities think
- virtual void FrameUpdatePreEntityThinkAllTools() = 0;
- // called after entities think
- virtual void FrameUpdatePostEntityThinkAllTools() = 0;
-
- virtual void PreClientUpdateAllTools() = 0;
- // FIXME: PostClientUpdateAllTools()???
-
- // The server uses this to call into the tools to get the actual
- // entities to spawn on startup
- virtual const char* GetEntityData( const char *pActualEntityData ) = 0;
-
- virtual void PreSetupVisibilityAllTools() = 0;
-
- virtual bool InToolMode() = 0;
-};
-
-#define VSERVERENGINETOOLS_INTERFACE_VERSION "VSERVERENGINETOOLS001"
-
-#endif // ISERVERENGINETOOLS_H
+//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +//============================================================================= + +#ifndef ISERVERENGINETOOLS_H +#define ISERVERENGINETOOLS_H +#ifdef _WIN32 +#pragma once +#endif + +#include "interface.h" + +//----------------------------------------------------------------------------- +// Purpose: exposed from engine to game .dll +//----------------------------------------------------------------------------- +class IServerEngineTools : public IBaseInterface +{ +public: + // Level init, shutdown + virtual void LevelInitPreEntityAllTools() = 0; + // entities are created / spawned / precached here + virtual void LevelInitPostEntityAllTools() = 0; + + virtual void LevelShutdownPreEntityAllTools() = 0; + // Entities are deleted / released here... + virtual void LevelShutdownPostEntityAllTools() = 0; + // end of level shutdown + + // Called each frame before entities think + virtual void FrameUpdatePreEntityThinkAllTools() = 0; + // called after entities think + virtual void FrameUpdatePostEntityThinkAllTools() = 0; + + virtual void PreClientUpdateAllTools() = 0; + // FIXME: PostClientUpdateAllTools()??? + + // The server uses this to call into the tools to get the actual + // entities to spawn on startup + virtual const char* GetEntityData( const char *pActualEntityData ) = 0; + + virtual void PreSetupVisibilityAllTools() = 0; + + virtual bool InToolMode() = 0; +}; + +#define VSERVERENGINETOOLS_INTERFACE_VERSION "VSERVERENGINETOOLS001" + +#endif // ISERVERENGINETOOLS_H diff --git a/mp/src/public/toolframework/itooldictionary.h b/mp/src/public/toolframework/itooldictionary.h index e29af3ea..96465f16 100644 --- a/mp/src/public/toolframework/itooldictionary.h +++ b/mp/src/public/toolframework/itooldictionary.h @@ -1,39 +1,39 @@ -//========= Copyright Valve Corporation, All rights reserved. ============//
-//
-// Purpose:
-//
-//=============================================================================
-
-#ifndef ITOOLDICTIONARY_H
-#define ITOOLDICTIONARY_H
-
-#ifdef _WIN32
-#pragma once
-#endif
-
-#include "appframework/IAppSystem.h"
-
-//-----------------------------------------------------------------------------
-// Forward declaration
-//-----------------------------------------------------------------------------
-class IToolSystem;
-
-
-//-----------------------------------------------------------------------------
-// Purpose: Every tool dll sitting in bin\tools must expose this interface
-// The engine will load the .dll, get this interface, and then ask for all
-// tools in the .dll
-// The engine will call CreateTools just before querying for the tools, so you
-// can instance any dynamically instanced tools during that call
-//-----------------------------------------------------------------------------
-class IToolDictionary : public IAppSystem
-{
-public:
- virtual void CreateTools() = 0;
- virtual int GetToolCount() const = 0;
- virtual IToolSystem *GetTool( int index ) = 0;
-};
-
-#define VTOOLDICTIONARY_INTERFACE_VERSION "VTOOLDICTIONARY002"
-
-#endif // ITOOLDICTIONARY_H
+//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +//============================================================================= + +#ifndef ITOOLDICTIONARY_H +#define ITOOLDICTIONARY_H + +#ifdef _WIN32 +#pragma once +#endif + +#include "appframework/IAppSystem.h" + +//----------------------------------------------------------------------------- +// Forward declaration +//----------------------------------------------------------------------------- +class IToolSystem; + + +//----------------------------------------------------------------------------- +// Purpose: Every tool dll sitting in bin\tools must expose this interface +// The engine will load the .dll, get this interface, and then ask for all +// tools in the .dll +// The engine will call CreateTools just before querying for the tools, so you +// can instance any dynamically instanced tools during that call +//----------------------------------------------------------------------------- +class IToolDictionary : public IAppSystem +{ +public: + virtual void CreateTools() = 0; + virtual int GetToolCount() const = 0; + virtual IToolSystem *GetTool( int index ) = 0; +}; + +#define VTOOLDICTIONARY_INTERFACE_VERSION "VTOOLDICTIONARY002" + +#endif // ITOOLDICTIONARY_H diff --git a/mp/src/public/toolframework/itoolentity.h b/mp/src/public/toolframework/itoolentity.h index 7e1199db..7433c14a 100644 --- a/mp/src/public/toolframework/itoolentity.h +++ b/mp/src/public/toolframework/itoolentity.h @@ -1,248 +1,248 @@ -//========= Copyright Valve Corporation, All rights reserved. ============//
-//
-// Purpose:
-//
-//=============================================================================
-
-#ifndef ITOOLENTITY_H
-#define ITOOLENTITY_H
-#ifdef _WIN32
-#pragma once
-#endif
-
-#include "tier1/interface.h"
-#include "tier1/utlvector.h"
-#include "Color.h"
-#include "basehandle.h"
-#include "iclientrenderable.h"
-#include "engine/ishadowmgr.h"
-
-
-//-----------------------------------------------------------------------------
-// Forward declarations
-//-----------------------------------------------------------------------------
-class IServerEntity;
-class IClientEntity;
-class IToolSystem;
-class IClientRenderable;
-class Vector;
-class QAngle;
-class CBaseEntity;
-class CBaseAnimating;
-class CTakeDamageInfo;
-class ITempEntsSystem;
-class IEntityFactoryDictionary;
-
-
-//-----------------------------------------------------------------------------
-// Safe accessor to an entity
-//-----------------------------------------------------------------------------
-typedef unsigned int HTOOLHANDLE;
-enum
-{
- HTOOLHANDLE_INVALID = 0
-};
-
-
-//-----------------------------------------------------------------------------
-// If you change this, change the flags in IClientShadowMgr.h also
-//-----------------------------------------------------------------------------
-enum ClientShadowFlags_t
-{
- SHADOW_FLAGS_USE_RENDER_TO_TEXTURE = (SHADOW_FLAGS_LAST_FLAG<<1),
- SHADOW_FLAGS_ANIMATING_SOURCE = (SHADOW_FLAGS_LAST_FLAG<<2),
- SHADOW_FLAGS_USE_DEPTH_TEXTURE = (SHADOW_FLAGS_LAST_FLAG<<3),
- // Update this if you add flags
- CLIENT_SHADOW_FLAGS_LAST_FLAG = SHADOW_FLAGS_USE_DEPTH_TEXTURE
-};
-
-
-//-----------------------------------------------------------------------------
-// Opaque pointer returned from Find* methods, don't store this, you need to
-// Attach it to a tool entity or discard after searching
-//-----------------------------------------------------------------------------
-typedef void *EntitySearchResult;
-
-
-//-----------------------------------------------------------------------------
-// Purpose: Client side tool interace (right now just handles IClientRenderables).
-// In theory could support hooking into client side entities directly
-//-----------------------------------------------------------------------------
-class IClientTools : public IBaseInterface
-{
-public:
- // Allocates or returns the handle to an entity previously found using the Find* APIs below
- virtual HTOOLHANDLE AttachToEntity( EntitySearchResult entityToAttach ) = 0;
- virtual void DetachFromEntity( EntitySearchResult entityToDetach ) = 0;
-
- // Checks whether a handle is still valid.
- virtual bool IsValidHandle( HTOOLHANDLE handle ) = 0;
-
- // Iterates the list of entities which have been associated with tools
- virtual int GetNumRecordables() = 0;
- virtual HTOOLHANDLE GetRecordable( int index ) = 0;
-
- // Iterates through ALL entities (separate list for client vs. server)
- virtual EntitySearchResult NextEntity( EntitySearchResult currentEnt ) = 0;
- EntitySearchResult FirstEntity() { return NextEntity( NULL ); }
-
- // Use this to turn on/off the presence of an underlying game entity
- virtual void SetEnabled( HTOOLHANDLE handle, bool enabled ) = 0;
- // Use this to tell an entity to post "state" to all listening tools
- virtual void SetRecording( HTOOLHANDLE handle, bool recording ) = 0;
- // Some entities are marked with ShouldRecordInTools false, such as ui entities, etc.
- virtual bool ShouldRecord( HTOOLHANDLE handle ) = 0;
-
- virtual HTOOLHANDLE GetToolHandleForEntityByIndex( int entindex ) = 0;
-
- virtual int GetModelIndex( HTOOLHANDLE handle ) = 0;
- virtual const char* GetModelName ( HTOOLHANDLE handle ) = 0;
- virtual const char* GetClassname ( HTOOLHANDLE handle ) = 0;
-
- virtual void AddClientRenderable( IClientRenderable *pRenderable, int renderGroup ) = 0;
- virtual void RemoveClientRenderable( IClientRenderable *pRenderable ) = 0;
- virtual void SetRenderGroup( IClientRenderable *pRenderable, int renderGroup ) = 0;
- virtual void MarkClientRenderableDirty( IClientRenderable *pRenderable ) = 0;
- virtual void UpdateProjectedTexture( ClientShadowHandle_t h, bool bForce ) = 0;
-
- virtual bool DrawSprite( IClientRenderable *pRenderable, float scale, float frame, int rendermode, int renderfx, const Color &color, float flProxyRadius, int *pVisHandle ) = 0;
-
- virtual EntitySearchResult GetLocalPlayer() = 0;
- virtual bool GetLocalPlayerEyePosition( Vector& org, QAngle& ang, float &fov ) = 0;
-
- // See ClientShadowFlags_t above
- virtual ClientShadowHandle_t CreateShadow( CBaseHandle handle, int nFlags ) = 0;
- virtual void DestroyShadow( ClientShadowHandle_t h ) = 0;
-
- virtual ClientShadowHandle_t CreateFlashlight( const FlashlightState_t &lightState ) = 0;
- virtual void DestroyFlashlight( ClientShadowHandle_t h ) = 0;
- virtual void UpdateFlashlightState( ClientShadowHandle_t h, const FlashlightState_t &lightState ) = 0;
-
- virtual void AddToDirtyShadowList( ClientShadowHandle_t h, bool force = false ) = 0;
- virtual void MarkRenderToTextureShadowDirty( ClientShadowHandle_t h ) = 0;
-
- // Global toggle for recording
- virtual void EnableRecordingMode( bool bEnable ) = 0;
- virtual bool IsInRecordingMode() const = 0;
-
- // Trigger a temp entity
- virtual void TriggerTempEntity( KeyValues *pKeyValues ) = 0;
-
- // get owning weapon (for viewmodels)
- virtual int GetOwningWeaponEntIndex( int entindex ) = 0;
- virtual int GetEntIndex( EntitySearchResult entityToAttach ) = 0;
-
- virtual int FindGlobalFlexcontroller( char const *name ) = 0;
- virtual char const *GetGlobalFlexControllerName( int idx ) = 0;
-
- // helper for traversing ownership hierarchy
- virtual EntitySearchResult GetOwnerEntity( EntitySearchResult currentEnt ) = 0;
-
- // common and useful types to query for hierarchically
- virtual bool IsPlayer ( EntitySearchResult currentEnt ) = 0;
- virtual bool IsBaseCombatCharacter( EntitySearchResult currentEnt ) = 0;
- virtual bool IsNPC ( EntitySearchResult currentEnt ) = 0;
-
- virtual Vector GetAbsOrigin( HTOOLHANDLE handle ) = 0;
- virtual QAngle GetAbsAngles( HTOOLHANDLE handle ) = 0;
-
- // This reloads a portion or all of a particle definition file.
- // It's up to the client to decide if it cares about this file
- // Use a UtlBuffer to crack the data
- virtual void ReloadParticleDefintions( const char *pFileName, const void *pBufData, int nLen ) = 0;
-
- // Sends a mesage from the tool to the client
- virtual void PostToolMessage( KeyValues *pKeyValues ) = 0;
-
- // Indicates whether the client should render particle systems
- virtual void EnableParticleSystems( bool bEnable ) = 0;
-
- // Is the game rendering in 3rd person mode?
- virtual bool IsRenderingThirdPerson() const = 0;
-};
-
-#define VCLIENTTOOLS_INTERFACE_VERSION "VCLIENTTOOLS001"
-
-
-//-----------------------------------------------------------------------------
-// Purpose: Interface from engine to tools for manipulating entities
-//-----------------------------------------------------------------------------
-class IServerTools : public IBaseInterface
-{
-public:
- virtual IServerEntity *GetIServerEntity( IClientEntity *pClientEntity ) = 0;
- virtual bool SnapPlayerToPosition( const Vector &org, const QAngle &ang, IClientEntity *pClientPlayer = NULL ) = 0;
- virtual bool GetPlayerPosition( Vector &org, QAngle &ang, IClientEntity *pClientPlayer = NULL ) = 0;
- virtual bool SetPlayerFOV( int fov, IClientEntity *pClientPlayer = NULL ) = 0;
- virtual int GetPlayerFOV( IClientEntity *pClientPlayer = NULL ) = 0;
- virtual bool IsInNoClipMode( IClientEntity *pClientPlayer = NULL ) = 0;
-
- // entity searching
- virtual CBaseEntity *FirstEntity( void ) = 0;
- virtual CBaseEntity *NextEntity( CBaseEntity *pEntity ) = 0;
- virtual CBaseEntity *FindEntityByHammerID( int iHammerID ) = 0;
-
- // entity query
- virtual bool GetKeyValue( CBaseEntity *pEntity, const char *szField, char *szValue, int iMaxLen ) = 0;
- virtual bool SetKeyValue( CBaseEntity *pEntity, const char *szField, const char *szValue ) = 0;
- virtual bool SetKeyValue( CBaseEntity *pEntity, const char *szField, float flValue ) = 0;
- virtual bool SetKeyValue( CBaseEntity *pEntity, const char *szField, const Vector &vecValue ) = 0;
-
- // entity spawning
- virtual CBaseEntity *CreateEntityByName( const char *szClassName ) = 0;
- virtual void DispatchSpawn( CBaseEntity *pEntity ) = 0;
-
- // This reloads a portion or all of a particle definition file.
- // It's up to the server to decide if it cares about this file
- // Use a UtlBuffer to crack the data
- virtual void ReloadParticleDefintions( const char *pFileName, const void *pBufData, int nLen ) = 0;
-
- virtual void AddOriginToPVS( const Vector &org ) = 0;
- virtual void MoveEngineViewTo( const Vector &vPos, const QAngle &vAngles ) = 0;
-
- virtual bool DestroyEntityByHammerId( int iHammerID ) = 0;
- virtual CBaseEntity *GetBaseEntityByEntIndex( int iEntIndex ) = 0;
- virtual void RemoveEntity( CBaseEntity *pEntity ) = 0;
- virtual void RemoveEntityImmediate( CBaseEntity *pEntity ) = 0;
- virtual IEntityFactoryDictionary *GetEntityFactoryDictionary( void ) = 0;
-
- virtual void SetMoveType( CBaseEntity *pEntity, int val ) = 0;
- virtual void SetMoveType( CBaseEntity *pEntity, int val, int moveCollide ) = 0;
- virtual void ResetSequence( CBaseAnimating *pEntity, int nSequence ) = 0;
- virtual void ResetSequenceInfo( CBaseAnimating *pEntity ) = 0;
-
- virtual void ClearMultiDamage( void ) = 0;
- virtual void ApplyMultiDamage( void ) = 0;
- virtual void AddMultiDamage( const CTakeDamageInfo &pTakeDamageInfo, CBaseEntity *pEntity ) = 0;
- virtual void RadiusDamage( const CTakeDamageInfo &info, const Vector &vecSrc, float flRadius, int iClassIgnore, CBaseEntity *pEntityIgnore ) = 0;
-
- virtual ITempEntsSystem *GetTempEntsSystem( void ) = 0;
-};
-
-typedef IServerTools IServerTools001;
-
-#define VSERVERTOOLS_INTERFACE_VERSION_1 "VSERVERTOOLS001"
-#define VSERVERTOOLS_INTERFACE_VERSION "VSERVERTOOLS002"
-#define VSERVERTOOLS_INTERFACE_VERSION_INT 2
-
-//-----------------------------------------------------------------------------
-// Purpose: Client side tool interace (right now just handles IClientRenderables).
-// In theory could support hooking into client side entities directly
-//-----------------------------------------------------------------------------
-class IServerChoreoTools : public IBaseInterface
-{
-public:
-
- // Iterates through ALL entities (separate list for client vs. server)
- virtual EntitySearchResult NextChoreoEntity( EntitySearchResult currentEnt ) = 0;
- EntitySearchResult FirstChoreoEntity() { return NextChoreoEntity( NULL ); }
- virtual const char *GetSceneFile( EntitySearchResult sr ) = 0;
-
- // For interactive editing
- virtual int GetEntIndex( EntitySearchResult sr ) = 0;
- virtual void ReloadSceneFromDisk( int entindex ) = 0;
-};
-
-#define VSERVERCHOREOTOOLS_INTERFACE_VERSION "VSERVERCHOREOTOOLS001"
-
-#endif // ITOOLENTITY_H
+//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +//============================================================================= + +#ifndef ITOOLENTITY_H +#define ITOOLENTITY_H +#ifdef _WIN32 +#pragma once +#endif + +#include "tier1/interface.h" +#include "tier1/utlvector.h" +#include "Color.h" +#include "basehandle.h" +#include "iclientrenderable.h" +#include "engine/ishadowmgr.h" + + +//----------------------------------------------------------------------------- +// Forward declarations +//----------------------------------------------------------------------------- +class IServerEntity; +class IClientEntity; +class IToolSystem; +class IClientRenderable; +class Vector; +class QAngle; +class CBaseEntity; +class CBaseAnimating; +class CTakeDamageInfo; +class ITempEntsSystem; +class IEntityFactoryDictionary; + + +//----------------------------------------------------------------------------- +// Safe accessor to an entity +//----------------------------------------------------------------------------- +typedef unsigned int HTOOLHANDLE; +enum +{ + HTOOLHANDLE_INVALID = 0 +}; + + +//----------------------------------------------------------------------------- +// If you change this, change the flags in IClientShadowMgr.h also +//----------------------------------------------------------------------------- +enum ClientShadowFlags_t +{ + SHADOW_FLAGS_USE_RENDER_TO_TEXTURE = (SHADOW_FLAGS_LAST_FLAG<<1), + SHADOW_FLAGS_ANIMATING_SOURCE = (SHADOW_FLAGS_LAST_FLAG<<2), + SHADOW_FLAGS_USE_DEPTH_TEXTURE = (SHADOW_FLAGS_LAST_FLAG<<3), + // Update this if you add flags + CLIENT_SHADOW_FLAGS_LAST_FLAG = SHADOW_FLAGS_USE_DEPTH_TEXTURE +}; + + +//----------------------------------------------------------------------------- +// Opaque pointer returned from Find* methods, don't store this, you need to +// Attach it to a tool entity or discard after searching +//----------------------------------------------------------------------------- +typedef void *EntitySearchResult; + + +//----------------------------------------------------------------------------- +// Purpose: Client side tool interace (right now just handles IClientRenderables). +// In theory could support hooking into client side entities directly +//----------------------------------------------------------------------------- +class IClientTools : public IBaseInterface +{ +public: + // Allocates or returns the handle to an entity previously found using the Find* APIs below + virtual HTOOLHANDLE AttachToEntity( EntitySearchResult entityToAttach ) = 0; + virtual void DetachFromEntity( EntitySearchResult entityToDetach ) = 0; + + // Checks whether a handle is still valid. + virtual bool IsValidHandle( HTOOLHANDLE handle ) = 0; + + // Iterates the list of entities which have been associated with tools + virtual int GetNumRecordables() = 0; + virtual HTOOLHANDLE GetRecordable( int index ) = 0; + + // Iterates through ALL entities (separate list for client vs. server) + virtual EntitySearchResult NextEntity( EntitySearchResult currentEnt ) = 0; + EntitySearchResult FirstEntity() { return NextEntity( NULL ); } + + // Use this to turn on/off the presence of an underlying game entity + virtual void SetEnabled( HTOOLHANDLE handle, bool enabled ) = 0; + // Use this to tell an entity to post "state" to all listening tools + virtual void SetRecording( HTOOLHANDLE handle, bool recording ) = 0; + // Some entities are marked with ShouldRecordInTools false, such as ui entities, etc. + virtual bool ShouldRecord( HTOOLHANDLE handle ) = 0; + + virtual HTOOLHANDLE GetToolHandleForEntityByIndex( int entindex ) = 0; + + virtual int GetModelIndex( HTOOLHANDLE handle ) = 0; + virtual const char* GetModelName ( HTOOLHANDLE handle ) = 0; + virtual const char* GetClassname ( HTOOLHANDLE handle ) = 0; + + virtual void AddClientRenderable( IClientRenderable *pRenderable, int renderGroup ) = 0; + virtual void RemoveClientRenderable( IClientRenderable *pRenderable ) = 0; + virtual void SetRenderGroup( IClientRenderable *pRenderable, int renderGroup ) = 0; + virtual void MarkClientRenderableDirty( IClientRenderable *pRenderable ) = 0; + virtual void UpdateProjectedTexture( ClientShadowHandle_t h, bool bForce ) = 0; + + virtual bool DrawSprite( IClientRenderable *pRenderable, float scale, float frame, int rendermode, int renderfx, const Color &color, float flProxyRadius, int *pVisHandle ) = 0; + + virtual EntitySearchResult GetLocalPlayer() = 0; + virtual bool GetLocalPlayerEyePosition( Vector& org, QAngle& ang, float &fov ) = 0; + + // See ClientShadowFlags_t above + virtual ClientShadowHandle_t CreateShadow( CBaseHandle handle, int nFlags ) = 0; + virtual void DestroyShadow( ClientShadowHandle_t h ) = 0; + + virtual ClientShadowHandle_t CreateFlashlight( const FlashlightState_t &lightState ) = 0; + virtual void DestroyFlashlight( ClientShadowHandle_t h ) = 0; + virtual void UpdateFlashlightState( ClientShadowHandle_t h, const FlashlightState_t &lightState ) = 0; + + virtual void AddToDirtyShadowList( ClientShadowHandle_t h, bool force = false ) = 0; + virtual void MarkRenderToTextureShadowDirty( ClientShadowHandle_t h ) = 0; + + // Global toggle for recording + virtual void EnableRecordingMode( bool bEnable ) = 0; + virtual bool IsInRecordingMode() const = 0; + + // Trigger a temp entity + virtual void TriggerTempEntity( KeyValues *pKeyValues ) = 0; + + // get owning weapon (for viewmodels) + virtual int GetOwningWeaponEntIndex( int entindex ) = 0; + virtual int GetEntIndex( EntitySearchResult entityToAttach ) = 0; + + virtual int FindGlobalFlexcontroller( char const *name ) = 0; + virtual char const *GetGlobalFlexControllerName( int idx ) = 0; + + // helper for traversing ownership hierarchy + virtual EntitySearchResult GetOwnerEntity( EntitySearchResult currentEnt ) = 0; + + // common and useful types to query for hierarchically + virtual bool IsPlayer ( EntitySearchResult currentEnt ) = 0; + virtual bool IsBaseCombatCharacter( EntitySearchResult currentEnt ) = 0; + virtual bool IsNPC ( EntitySearchResult currentEnt ) = 0; + + virtual Vector GetAbsOrigin( HTOOLHANDLE handle ) = 0; + virtual QAngle GetAbsAngles( HTOOLHANDLE handle ) = 0; + + // This reloads a portion or all of a particle definition file. + // It's up to the client to decide if it cares about this file + // Use a UtlBuffer to crack the data + virtual void ReloadParticleDefintions( const char *pFileName, const void *pBufData, int nLen ) = 0; + + // Sends a mesage from the tool to the client + virtual void PostToolMessage( KeyValues *pKeyValues ) = 0; + + // Indicates whether the client should render particle systems + virtual void EnableParticleSystems( bool bEnable ) = 0; + + // Is the game rendering in 3rd person mode? + virtual bool IsRenderingThirdPerson() const = 0; +}; + +#define VCLIENTTOOLS_INTERFACE_VERSION "VCLIENTTOOLS001" + + +//----------------------------------------------------------------------------- +// Purpose: Interface from engine to tools for manipulating entities +//----------------------------------------------------------------------------- +class IServerTools : public IBaseInterface +{ +public: + virtual IServerEntity *GetIServerEntity( IClientEntity *pClientEntity ) = 0; + virtual bool SnapPlayerToPosition( const Vector &org, const QAngle &ang, IClientEntity *pClientPlayer = NULL ) = 0; + virtual bool GetPlayerPosition( Vector &org, QAngle &ang, IClientEntity *pClientPlayer = NULL ) = 0; + virtual bool SetPlayerFOV( int fov, IClientEntity *pClientPlayer = NULL ) = 0; + virtual int GetPlayerFOV( IClientEntity *pClientPlayer = NULL ) = 0; + virtual bool IsInNoClipMode( IClientEntity *pClientPlayer = NULL ) = 0; + + // entity searching + virtual CBaseEntity *FirstEntity( void ) = 0; + virtual CBaseEntity *NextEntity( CBaseEntity *pEntity ) = 0; + virtual CBaseEntity *FindEntityByHammerID( int iHammerID ) = 0; + + // entity query + virtual bool GetKeyValue( CBaseEntity *pEntity, const char *szField, char *szValue, int iMaxLen ) = 0; + virtual bool SetKeyValue( CBaseEntity *pEntity, const char *szField, const char *szValue ) = 0; + virtual bool SetKeyValue( CBaseEntity *pEntity, const char *szField, float flValue ) = 0; + virtual bool SetKeyValue( CBaseEntity *pEntity, const char *szField, const Vector &vecValue ) = 0; + + // entity spawning + virtual CBaseEntity *CreateEntityByName( const char *szClassName ) = 0; + virtual void DispatchSpawn( CBaseEntity *pEntity ) = 0; + + // This reloads a portion or all of a particle definition file. + // It's up to the server to decide if it cares about this file + // Use a UtlBuffer to crack the data + virtual void ReloadParticleDefintions( const char *pFileName, const void *pBufData, int nLen ) = 0; + + virtual void AddOriginToPVS( const Vector &org ) = 0; + virtual void MoveEngineViewTo( const Vector &vPos, const QAngle &vAngles ) = 0; + + virtual bool DestroyEntityByHammerId( int iHammerID ) = 0; + virtual CBaseEntity *GetBaseEntityByEntIndex( int iEntIndex ) = 0; + virtual void RemoveEntity( CBaseEntity *pEntity ) = 0; + virtual void RemoveEntityImmediate( CBaseEntity *pEntity ) = 0; + virtual IEntityFactoryDictionary *GetEntityFactoryDictionary( void ) = 0; + + virtual void SetMoveType( CBaseEntity *pEntity, int val ) = 0; + virtual void SetMoveType( CBaseEntity *pEntity, int val, int moveCollide ) = 0; + virtual void ResetSequence( CBaseAnimating *pEntity, int nSequence ) = 0; + virtual void ResetSequenceInfo( CBaseAnimating *pEntity ) = 0; + + virtual void ClearMultiDamage( void ) = 0; + virtual void ApplyMultiDamage( void ) = 0; + virtual void AddMultiDamage( const CTakeDamageInfo &pTakeDamageInfo, CBaseEntity *pEntity ) = 0; + virtual void RadiusDamage( const CTakeDamageInfo &info, const Vector &vecSrc, float flRadius, int iClassIgnore, CBaseEntity *pEntityIgnore ) = 0; + + virtual ITempEntsSystem *GetTempEntsSystem( void ) = 0; +}; + +typedef IServerTools IServerTools001; + +#define VSERVERTOOLS_INTERFACE_VERSION_1 "VSERVERTOOLS001" +#define VSERVERTOOLS_INTERFACE_VERSION "VSERVERTOOLS002" +#define VSERVERTOOLS_INTERFACE_VERSION_INT 2 + +//----------------------------------------------------------------------------- +// Purpose: Client side tool interace (right now just handles IClientRenderables). +// In theory could support hooking into client side entities directly +//----------------------------------------------------------------------------- +class IServerChoreoTools : public IBaseInterface +{ +public: + + // Iterates through ALL entities (separate list for client vs. server) + virtual EntitySearchResult NextChoreoEntity( EntitySearchResult currentEnt ) = 0; + EntitySearchResult FirstChoreoEntity() { return NextChoreoEntity( NULL ); } + virtual const char *GetSceneFile( EntitySearchResult sr ) = 0; + + // For interactive editing + virtual int GetEntIndex( EntitySearchResult sr ) = 0; + virtual void ReloadSceneFromDisk( int entindex ) = 0; +}; + +#define VSERVERCHOREOTOOLS_INTERFACE_VERSION "VSERVERCHOREOTOOLS001" + +#endif // ITOOLENTITY_H diff --git a/mp/src/public/toolframework/itoolframework.h b/mp/src/public/toolframework/itoolframework.h index c757623c..5be2190e 100644 --- a/mp/src/public/toolframework/itoolframework.h +++ b/mp/src/public/toolframework/itoolframework.h @@ -1,265 +1,265 @@ -//========= Copyright Valve Corporation, All rights reserved. ============//
-//
-// Purpose:
-//
-//=============================================================================
-
-#ifndef ITOOLFRAMEWORK_H
-#define ITOOLFRAMEWORK_H
-#ifdef _WIN32
-#pragma once
-#endif
-
-#include "appframework/IAppSystem.h"
-#include "materialsystem/imaterialproxy.h"
-#include "toolframework/itoolentity.h"
-#include "mathlib/vector.h"
-#include "Color.h"
-#include "toolframework/itoolentity.h" // HTOOLHANDLE defn
-
-//-----------------------------------------------------------------------------
-// Forward declarations
-//-----------------------------------------------------------------------------
-class IToolSystem;
-struct SpatializationInfo_t;
-class KeyValues;
-class CBoneList;
-
-
-//-----------------------------------------------------------------------------
-// Standard messages
-//-----------------------------------------------------------------------------
-struct BaseEntityRecordingState_t
-{
- BaseEntityRecordingState_t() :
- m_flTime( 0.0f ),
- m_pModelName( 0 ),
- m_nOwner( -1 ),
- m_nEffects( 0 ),
- m_bVisible( false ),
- m_bRecordFinalVisibleSample( false )
- {
- m_vecRenderOrigin.Init();
- m_vecRenderAngles.Init();
- }
-
- float m_flTime;
- const char *m_pModelName;
- int m_nOwner;
- int m_nEffects;
- bool m_bVisible : 1;
- bool m_bRecordFinalVisibleSample : 1;
- Vector m_vecRenderOrigin;
- QAngle m_vecRenderAngles;
-};
-
-struct SpriteRecordingState_t
-{
- float m_flRenderScale;
- float m_flFrame;
- int m_nRenderMode;
- bool m_nRenderFX;
- Color m_Color;
- float m_flProxyRadius;
-};
-
-struct BaseAnimatingRecordingState_t
-{
- int m_nSkin;
- int m_nBody;
- int m_nSequence;
- CBoneList *m_pBoneList;
-};
-
-struct BaseFlexRecordingState_t
-{
- int m_nFlexCount;
- float *m_pDestWeight;
- Vector m_vecViewTarget;
-};
-
-struct CameraRecordingState_t
-{
- bool m_bThirdPerson;
- float m_flFOV;
- Vector m_vecEyePosition;
- QAngle m_vecEyeAngles;
-};
-
-struct MonitorRecordingState_t
-{
- bool m_bActive;
- float m_flFOV;
- bool m_bFogEnabled;
- float m_flFogStart;
- float m_flFogEnd;
- Color m_FogColor;
-};
-
-struct EntityTeleportedRecordingState_t
-{
- Vector m_vecTo;
- QAngle m_qaTo;
- bool m_bTeleported;
- bool m_bViewOverride;
- matrix3x4_t m_teleportMatrix;
-};
-
-struct PortalRecordingState_t
-{
- int m_nPortalId;
- int m_nLinkedPortalId;
- float m_fStaticAmount;
- float m_fSecondaryStaticAmount;
- float m_fOpenAmount;
- bool m_bIsPortal2; //for any set of portals, one must be portal 1, and the other portal 2. Uses different render targets
-};
-
-struct ParticleSystemCreatedState_t
-{
- int m_nParticleSystemId;
- const char * m_pName;
- float m_flTime;
- int m_nOwner;
-};
-
-struct ParticleSystemDestroyedState_t
-{
- int m_nParticleSystemId;
- float m_flTime;
-};
-
-struct ParticleSystemStopEmissionState_t
-{
- int m_nParticleSystemId;
- float m_flTime;
- bool m_bInfiniteOnly;
-};
-
-struct ParticleSystemSetControlPointObjectState_t
-{
- int m_nParticleSystemId;
- float m_flTime;
- int m_nControlPoint;
- int m_nObject;
-};
-
-struct ParticleSystemSetControlPointPositionState_t
-{
- int m_nParticleSystemId;
- float m_flTime;
- int m_nControlPoint;
- Vector m_vecPosition;
-};
-
-struct ParticleSystemSetControlPointOrientationState_t
-{
- int m_nParticleSystemId;
- float m_flTime;
- int m_nControlPoint;
- Quaternion m_qOrientation;
-};
-
-
-//-----------------------------------------------------------------------------
-// Purpose: This interface lives in the engine and handles loading up/unloading all
-// available tools
-//-----------------------------------------------------------------------------
-class IToolFrameworkInternal : public IAppSystem
-{
-public: // Client Hooks
- virtual bool ClientInit( CreateInterfaceFn clientFactory ) = 0;
- virtual void ClientShutdown() = 0;
-
- // Level init, shutdown
- virtual void ClientLevelInitPreEntityAllTools() = 0;
- // entities are created / spawned / precached here
- virtual void ClientLevelInitPostEntityAllTools() = 0;
-
- virtual void ClientLevelShutdownPreEntityAllTools() = 0;
- // Entities are deleted / released here...
- virtual void ClientLevelShutdownPostEntityAllTools() = 0;
-
- virtual void ClientPreRenderAllTools() = 0;
- virtual void ClientPostRenderAllTools() = 0;
-
- // Should we render with a thirdperson camera?
- virtual bool IsThirdPersonCamera() = 0;
-
- // is the current tool recording?
- virtual bool IsToolRecording() = 0;
-
-public: // Server Hooks
- // Level init, shutdown
- virtual bool ServerInit( CreateInterfaceFn serverFactory ) = 0;
- virtual void ServerShutdown() = 0;
-
- virtual void ServerLevelInitPreEntityAllTools() = 0;
- // entities are created / spawned / precached here
- virtual void ServerLevelInitPostEntityAllTools() = 0;
-
- virtual void ServerLevelShutdownPreEntityAllTools() = 0;
- // Entities are deleted / released here...
- virtual void ServerLevelShutdownPostEntityAllTools() = 0;
- // end of level shutdown
-
- // Called each frame before entities think
- virtual void ServerFrameUpdatePreEntityThinkAllTools() = 0;
- // called after entities think
- virtual void ServerFrameUpdatePostEntityThinkAllTools() = 0;
- virtual void ServerPreClientUpdateAllTools() = 0;
-
- virtual void ServerPreSetupVisibilityAllTools() = 0;
-
-public: // Other Hooks
- // If any tool returns false, the engine will not actually quit
- // FIXME: Not implemented yet
- virtual bool CanQuit() = 0;
-
- // Called at end of Host_Init
- virtual bool PostInit() = 0;
-
- virtual void Think( bool finalTick ) = 0;
-
- virtual void PostMessage( KeyValues *msg ) = 0;
-
- virtual bool GetSoundSpatialization( int iUserData, int guid, SpatializationInfo_t& info ) = 0;
-
- virtual void HostRunFrameBegin() = 0;
- virtual void HostRunFrameEnd() = 0;
-
- virtual void RenderFrameBegin() = 0;
- virtual void RenderFrameEnd() = 0;
-
- // Paintmode is an enum declared in enginevgui.h
- virtual void VGui_PreRenderAllTools( int paintMode ) = 0;
- virtual void VGui_PostRenderAllTools( int paintMode ) = 0;
-
- virtual void VGui_PreSimulateAllTools() = 0;
- virtual void VGui_PostSimulateAllTools() = 0;
-
- // Are we using tools?
- virtual bool InToolMode() = 0;
-
- // Should the game be allowed to render the world?
- virtual bool ShouldGameRenderView() = 0;
-
- virtual IMaterialProxy *LookupProxy( const char *proxyName ) = 0;
-
-public: // general framework hooks
- virtual int GetToolCount() = 0;
- virtual char const *GetToolName( int index ) = 0;
- virtual void SwitchToTool( int index ) = 0;
- virtual IToolSystem *SwitchToTool( const char *pToolName ) = 0;
- virtual bool IsTopmostTool( const IToolSystem *sys ) = 0;
- virtual const IToolSystem *GetToolSystem( int index ) const = 0;
- virtual IToolSystem *GetTopmostTool() = 0;
-};
-
-// Expose to rest of engine as a singleton
-extern IToolFrameworkInternal *toolframework;
-
-// Exposed to launcher to automatically add AppSystemGroup hooks
-#define VTOOLFRAMEWORK_INTERFACE_VERSION "VTOOLFRAMEWORKVERSION002"
-
-#endif // ITOOLFRAMEWORK_H
+//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +//============================================================================= + +#ifndef ITOOLFRAMEWORK_H +#define ITOOLFRAMEWORK_H +#ifdef _WIN32 +#pragma once +#endif + +#include "appframework/IAppSystem.h" +#include "materialsystem/imaterialproxy.h" +#include "toolframework/itoolentity.h" +#include "mathlib/vector.h" +#include "Color.h" +#include "toolframework/itoolentity.h" // HTOOLHANDLE defn + +//----------------------------------------------------------------------------- +// Forward declarations +//----------------------------------------------------------------------------- +class IToolSystem; +struct SpatializationInfo_t; +class KeyValues; +class CBoneList; + + +//----------------------------------------------------------------------------- +// Standard messages +//----------------------------------------------------------------------------- +struct BaseEntityRecordingState_t +{ + BaseEntityRecordingState_t() : + m_flTime( 0.0f ), + m_pModelName( 0 ), + m_nOwner( -1 ), + m_nEffects( 0 ), + m_bVisible( false ), + m_bRecordFinalVisibleSample( false ) + { + m_vecRenderOrigin.Init(); + m_vecRenderAngles.Init(); + } + + float m_flTime; + const char *m_pModelName; + int m_nOwner; + int m_nEffects; + bool m_bVisible : 1; + bool m_bRecordFinalVisibleSample : 1; + Vector m_vecRenderOrigin; + QAngle m_vecRenderAngles; +}; + +struct SpriteRecordingState_t +{ + float m_flRenderScale; + float m_flFrame; + int m_nRenderMode; + bool m_nRenderFX; + Color m_Color; + float m_flProxyRadius; +}; + +struct BaseAnimatingRecordingState_t +{ + int m_nSkin; + int m_nBody; + int m_nSequence; + CBoneList *m_pBoneList; +}; + +struct BaseFlexRecordingState_t +{ + int m_nFlexCount; + float *m_pDestWeight; + Vector m_vecViewTarget; +}; + +struct CameraRecordingState_t +{ + bool m_bThirdPerson; + float m_flFOV; + Vector m_vecEyePosition; + QAngle m_vecEyeAngles; +}; + +struct MonitorRecordingState_t +{ + bool m_bActive; + float m_flFOV; + bool m_bFogEnabled; + float m_flFogStart; + float m_flFogEnd; + Color m_FogColor; +}; + +struct EntityTeleportedRecordingState_t +{ + Vector m_vecTo; + QAngle m_qaTo; + bool m_bTeleported; + bool m_bViewOverride; + matrix3x4_t m_teleportMatrix; +}; + +struct PortalRecordingState_t +{ + int m_nPortalId; + int m_nLinkedPortalId; + float m_fStaticAmount; + float m_fSecondaryStaticAmount; + float m_fOpenAmount; + bool m_bIsPortal2; //for any set of portals, one must be portal 1, and the other portal 2. Uses different render targets +}; + +struct ParticleSystemCreatedState_t +{ + int m_nParticleSystemId; + const char * m_pName; + float m_flTime; + int m_nOwner; +}; + +struct ParticleSystemDestroyedState_t +{ + int m_nParticleSystemId; + float m_flTime; +}; + +struct ParticleSystemStopEmissionState_t +{ + int m_nParticleSystemId; + float m_flTime; + bool m_bInfiniteOnly; +}; + +struct ParticleSystemSetControlPointObjectState_t +{ + int m_nParticleSystemId; + float m_flTime; + int m_nControlPoint; + int m_nObject; +}; + +struct ParticleSystemSetControlPointPositionState_t +{ + int m_nParticleSystemId; + float m_flTime; + int m_nControlPoint; + Vector m_vecPosition; +}; + +struct ParticleSystemSetControlPointOrientationState_t +{ + int m_nParticleSystemId; + float m_flTime; + int m_nControlPoint; + Quaternion m_qOrientation; +}; + + +//----------------------------------------------------------------------------- +// Purpose: This interface lives in the engine and handles loading up/unloading all +// available tools +//----------------------------------------------------------------------------- +class IToolFrameworkInternal : public IAppSystem +{ +public: // Client Hooks + virtual bool ClientInit( CreateInterfaceFn clientFactory ) = 0; + virtual void ClientShutdown() = 0; + + // Level init, shutdown + virtual void ClientLevelInitPreEntityAllTools() = 0; + // entities are created / spawned / precached here + virtual void ClientLevelInitPostEntityAllTools() = 0; + + virtual void ClientLevelShutdownPreEntityAllTools() = 0; + // Entities are deleted / released here... + virtual void ClientLevelShutdownPostEntityAllTools() = 0; + + virtual void ClientPreRenderAllTools() = 0; + virtual void ClientPostRenderAllTools() = 0; + + // Should we render with a thirdperson camera? + virtual bool IsThirdPersonCamera() = 0; + + // is the current tool recording? + virtual bool IsToolRecording() = 0; + +public: // Server Hooks + // Level init, shutdown + virtual bool ServerInit( CreateInterfaceFn serverFactory ) = 0; + virtual void ServerShutdown() = 0; + + virtual void ServerLevelInitPreEntityAllTools() = 0; + // entities are created / spawned / precached here + virtual void ServerLevelInitPostEntityAllTools() = 0; + + virtual void ServerLevelShutdownPreEntityAllTools() = 0; + // Entities are deleted / released here... + virtual void ServerLevelShutdownPostEntityAllTools() = 0; + // end of level shutdown + + // Called each frame before entities think + virtual void ServerFrameUpdatePreEntityThinkAllTools() = 0; + // called after entities think + virtual void ServerFrameUpdatePostEntityThinkAllTools() = 0; + virtual void ServerPreClientUpdateAllTools() = 0; + + virtual void ServerPreSetupVisibilityAllTools() = 0; + +public: // Other Hooks + // If any tool returns false, the engine will not actually quit + // FIXME: Not implemented yet + virtual bool CanQuit() = 0; + + // Called at end of Host_Init + virtual bool PostInit() = 0; + + virtual void Think( bool finalTick ) = 0; + + virtual void PostMessage( KeyValues *msg ) = 0; + + virtual bool GetSoundSpatialization( int iUserData, int guid, SpatializationInfo_t& info ) = 0; + + virtual void HostRunFrameBegin() = 0; + virtual void HostRunFrameEnd() = 0; + + virtual void RenderFrameBegin() = 0; + virtual void RenderFrameEnd() = 0; + + // Paintmode is an enum declared in enginevgui.h + virtual void VGui_PreRenderAllTools( int paintMode ) = 0; + virtual void VGui_PostRenderAllTools( int paintMode ) = 0; + + virtual void VGui_PreSimulateAllTools() = 0; + virtual void VGui_PostSimulateAllTools() = 0; + + // Are we using tools? + virtual bool InToolMode() = 0; + + // Should the game be allowed to render the world? + virtual bool ShouldGameRenderView() = 0; + + virtual IMaterialProxy *LookupProxy( const char *proxyName ) = 0; + +public: // general framework hooks + virtual int GetToolCount() = 0; + virtual char const *GetToolName( int index ) = 0; + virtual void SwitchToTool( int index ) = 0; + virtual IToolSystem *SwitchToTool( const char *pToolName ) = 0; + virtual bool IsTopmostTool( const IToolSystem *sys ) = 0; + virtual const IToolSystem *GetToolSystem( int index ) const = 0; + virtual IToolSystem *GetTopmostTool() = 0; +}; + +// Expose to rest of engine as a singleton +extern IToolFrameworkInternal *toolframework; + +// Exposed to launcher to automatically add AppSystemGroup hooks +#define VTOOLFRAMEWORK_INTERFACE_VERSION "VTOOLFRAMEWORKVERSION002" + +#endif // ITOOLFRAMEWORK_H diff --git a/mp/src/public/toolframework/itoolsystem.h b/mp/src/public/toolframework/itoolsystem.h index 8fd28ca4..84c91db7 100644 --- a/mp/src/public/toolframework/itoolsystem.h +++ b/mp/src/public/toolframework/itoolsystem.h @@ -1,146 +1,146 @@ -//========= Copyright Valve Corporation, All rights reserved. ============//
-//
-// Purpose:
-//
-//=============================================================================
-
-#ifndef ITOOLSYSTEM_H
-#define ITOOLSYSTEM_H
-#ifdef _WIN32
-#pragma once
-#endif
-
-#include "itoolentity.h"
-#include "interface.h"
-#include "materialsystem/imaterialproxy.h"
-#include "inputsystem/iinputsystem.h"
-
-class KeyValues;
-struct SpatializationInfo_t;
-struct AudioState_t;
-
-//-----------------------------------------------------------------------------
-// Purpose: All tools expose this interface, which includes both client and server
-// related hooks
-//-----------------------------------------------------------------------------
-class IToolSystem
-{
-public:
- // Name describing the tool
- virtual char const *GetToolName() = 0;
-
- // Called at the end of engine startup (after client .dll and server .dll have been loaded)
- virtual bool Init() = 0;
-
- // Called during RemoveTool or when engine is shutting down
- virtual void Shutdown() = 0;
-
- // Called after server.dll is loaded
- virtual bool ServerInit( CreateInterfaceFn serverFactory ) = 0;
- // Called after client.dll is loaded
- virtual bool ClientInit( CreateInterfaceFn clientFactory ) = 0;
-
- virtual void ServerShutdown() = 0;
- virtual void ClientShutdown() = 0;
-
- // Allow tool to override quitting, called before Shutdown(), return no to abort quitting
- virtual bool CanQuit() = 0;
-
- // Called when another system wiches to post a message to the tool and/or a specific entity
- // FIXME: Are KeyValues too inefficient here?
- virtual void PostMessage( HTOOLHANDLE hEntity, KeyValues *message ) = 0;
-
- // Called oncer per frame even when no level is loaded... (call ProcessMessages())
- virtual void Think( bool finalTick ) = 0;
-
-// Server calls:
-
- // Level init, shutdown
- virtual void ServerLevelInitPreEntity() = 0;
- // entities are created / spawned / precached here
- virtual void ServerLevelInitPostEntity() = 0;
-
- virtual void ServerLevelShutdownPreEntity() = 0;
- // Entities are deleted / released here...
- virtual void ServerLevelShutdownPostEntity() = 0;
- // end of level shutdown
-
- // Called each frame before entities think
- virtual void ServerFrameUpdatePreEntityThink() = 0;
- // called after entities think
- virtual void ServerFrameUpdatePostEntityThink() = 0;
- virtual void ServerPreClientUpdate() = 0;
- virtual void ServerPreSetupVisibility() = 0;
-
- // Used to allow the tool to spawn different entities when it's active
- virtual const char* GetEntityData( const char *pActualEntityData ) = 0;
-
-// Client calls:
- // Level init, shutdown
- virtual void ClientLevelInitPreEntity() = 0;
- // entities are created / spawned / precached here
- virtual void ClientLevelInitPostEntity() = 0;
-
- virtual void ClientLevelShutdownPreEntity() = 0;
- // Entities are deleted / released here...
- virtual void ClientLevelShutdownPostEntity() = 0;
- // end of level shutdown
- // Called before rendering
- virtual void ClientPreRender() = 0;
- virtual void ClientPostRender() = 0;
-
- // Let tool override viewport for engine
- virtual void AdjustEngineViewport( int& x, int& y, int& width, int& height ) = 0;
-
- // let tool override view/camera
- virtual bool SetupEngineView( Vector &origin, QAngle &angles, float &fov ) = 0;
-
- // let tool override microphone
- virtual bool SetupAudioState( AudioState_t &audioState ) = 0;
-
- // Should the client be allowed to render the view normally?
- virtual bool ShouldGameRenderView() = 0;
- virtual bool IsThirdPersonCamera() = 0;
-
- // is the current tool recording?
- virtual bool IsToolRecording() = 0;
-
- virtual IMaterialProxy *LookupProxy( const char *proxyName ) = 0;
-
- // Possible hooks for rendering
- // virtual void Think( float curtime, float frametime ) = 0;
- // virtual void Prerender() = 0;
- // virtual void Render3D() = 0;
- // virtual void Render2D() = 0;
-// Tool activation/deactivation
-
- // This tool is being activated
- virtual void OnToolActivate() = 0;
- // Another tool is being activated
- virtual void OnToolDeactivate() = 0;
-
- virtual bool TrapKey( ButtonCode_t key, bool down ) = 0;
-
- virtual bool GetSoundSpatialization( int iUserData, int guid, SpatializationInfo_t& info ) = 0;
-
- // Unlike the client .dll pre/post render stuff, these get called no matter whether a map is loaded and they only get called once per frame!!!
- virtual void RenderFrameBegin() = 0;
- virtual void RenderFrameEnd() = 0;
-
- // wraps the entire frame - surrounding all other begin/end and pre/post calls
- virtual void HostRunFrameBegin() = 0;
- virtual void HostRunFrameEnd() = 0;
-
- // See enginevgui.h for paintmode_t enum definitions
- virtual void VGui_PreRender( int paintMode ) = 0;
- virtual void VGui_PostRender( int paintMode ) = 0;
-
- virtual void VGui_PreSimulate() = 0;
- virtual void VGui_PostSimulate() = 0;
-};
-
-// Pointer to a member method of IGameSystem
-typedef void (IToolSystem::*ToolSystemFunc_t)();
-typedef void (IToolSystem::*ToolSystemFunc_Int_t)( int arg );
-
-#endif // ITOOLSYSTEM_H
+//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +//============================================================================= + +#ifndef ITOOLSYSTEM_H +#define ITOOLSYSTEM_H +#ifdef _WIN32 +#pragma once +#endif + +#include "itoolentity.h" +#include "interface.h" +#include "materialsystem/imaterialproxy.h" +#include "inputsystem/iinputsystem.h" + +class KeyValues; +struct SpatializationInfo_t; +struct AudioState_t; + +//----------------------------------------------------------------------------- +// Purpose: All tools expose this interface, which includes both client and server +// related hooks +//----------------------------------------------------------------------------- +class IToolSystem +{ +public: + // Name describing the tool + virtual char const *GetToolName() = 0; + + // Called at the end of engine startup (after client .dll and server .dll have been loaded) + virtual bool Init() = 0; + + // Called during RemoveTool or when engine is shutting down + virtual void Shutdown() = 0; + + // Called after server.dll is loaded + virtual bool ServerInit( CreateInterfaceFn serverFactory ) = 0; + // Called after client.dll is loaded + virtual bool ClientInit( CreateInterfaceFn clientFactory ) = 0; + + virtual void ServerShutdown() = 0; + virtual void ClientShutdown() = 0; + + // Allow tool to override quitting, called before Shutdown(), return no to abort quitting + virtual bool CanQuit() = 0; + + // Called when another system wiches to post a message to the tool and/or a specific entity + // FIXME: Are KeyValues too inefficient here? + virtual void PostMessage( HTOOLHANDLE hEntity, KeyValues *message ) = 0; + + // Called oncer per frame even when no level is loaded... (call ProcessMessages()) + virtual void Think( bool finalTick ) = 0; + +// Server calls: + + // Level init, shutdown + virtual void ServerLevelInitPreEntity() = 0; + // entities are created / spawned / precached here + virtual void ServerLevelInitPostEntity() = 0; + + virtual void ServerLevelShutdownPreEntity() = 0; + // Entities are deleted / released here... + virtual void ServerLevelShutdownPostEntity() = 0; + // end of level shutdown + + // Called each frame before entities think + virtual void ServerFrameUpdatePreEntityThink() = 0; + // called after entities think + virtual void ServerFrameUpdatePostEntityThink() = 0; + virtual void ServerPreClientUpdate() = 0; + virtual void ServerPreSetupVisibility() = 0; + + // Used to allow the tool to spawn different entities when it's active + virtual const char* GetEntityData( const char *pActualEntityData ) = 0; + +// Client calls: + // Level init, shutdown + virtual void ClientLevelInitPreEntity() = 0; + // entities are created / spawned / precached here + virtual void ClientLevelInitPostEntity() = 0; + + virtual void ClientLevelShutdownPreEntity() = 0; + // Entities are deleted / released here... + virtual void ClientLevelShutdownPostEntity() = 0; + // end of level shutdown + // Called before rendering + virtual void ClientPreRender() = 0; + virtual void ClientPostRender() = 0; + + // Let tool override viewport for engine + virtual void AdjustEngineViewport( int& x, int& y, int& width, int& height ) = 0; + + // let tool override view/camera + virtual bool SetupEngineView( Vector &origin, QAngle &angles, float &fov ) = 0; + + // let tool override microphone + virtual bool SetupAudioState( AudioState_t &audioState ) = 0; + + // Should the client be allowed to render the view normally? + virtual bool ShouldGameRenderView() = 0; + virtual bool IsThirdPersonCamera() = 0; + + // is the current tool recording? + virtual bool IsToolRecording() = 0; + + virtual IMaterialProxy *LookupProxy( const char *proxyName ) = 0; + + // Possible hooks for rendering + // virtual void Think( float curtime, float frametime ) = 0; + // virtual void Prerender() = 0; + // virtual void Render3D() = 0; + // virtual void Render2D() = 0; +// Tool activation/deactivation + + // This tool is being activated + virtual void OnToolActivate() = 0; + // Another tool is being activated + virtual void OnToolDeactivate() = 0; + + virtual bool TrapKey( ButtonCode_t key, bool down ) = 0; + + virtual bool GetSoundSpatialization( int iUserData, int guid, SpatializationInfo_t& info ) = 0; + + // Unlike the client .dll pre/post render stuff, these get called no matter whether a map is loaded and they only get called once per frame!!! + virtual void RenderFrameBegin() = 0; + virtual void RenderFrameEnd() = 0; + + // wraps the entire frame - surrounding all other begin/end and pre/post calls + virtual void HostRunFrameBegin() = 0; + virtual void HostRunFrameEnd() = 0; + + // See enginevgui.h for paintmode_t enum definitions + virtual void VGui_PreRender( int paintMode ) = 0; + virtual void VGui_PostRender( int paintMode ) = 0; + + virtual void VGui_PreSimulate() = 0; + virtual void VGui_PostSimulate() = 0; +}; + +// Pointer to a member method of IGameSystem +typedef void (IToolSystem::*ToolSystemFunc_t)(); +typedef void (IToolSystem::*ToolSystemFunc_Int_t)( int arg ); + +#endif // ITOOLSYSTEM_H diff --git a/mp/src/public/toolframework/toolframework.cpp b/mp/src/public/toolframework/toolframework.cpp index 1348035e..8d0db6e9 100644 --- a/mp/src/public/toolframework/toolframework.cpp +++ b/mp/src/public/toolframework/toolframework.cpp @@ -1,41 +1,41 @@ -//========= Copyright Valve Corporation, All rights reserved. ============//
-#include "toolframework/itooldictionary.h"
-#include "utlvector.h"
-
-class CToolDictionary : public IToolDictionary
-{
-public:
- virtual int GetToolCount() const
- {
- return m_Tools.Count();
- }
-
- virtual IToolSystem *GetTool( int index )
- {
- if ( index < 0 || index >= m_Tools.Count() )
- {
- return NULL;
- }
- return m_Tools[ index ];
- }
-
-public:
-
- void RegisterTool( IToolSystem *tool )
- {
- m_Tools.AddToTail( tool );
- }
-private:
-
- CUtlVector< IToolSystem * > m_Tools;
-};
-
-static CToolDictionary g_ToolDictionary;
-
-EXPOSE_SINGLE_INTERFACE_GLOBALVAR( IToolDictionary, CToolDictionary, VTOOLDICTIONARY_INTERFACE_VERSION, g_ToolDictionary );
-
-void RegisterTool( IToolSystem *tool )
-{
- g_ToolDictionary.RegisterTool( tool );
-}
-
+//========= Copyright Valve Corporation, All rights reserved. ============// +#include "toolframework/itooldictionary.h" +#include "utlvector.h" + +class CToolDictionary : public IToolDictionary +{ +public: + virtual int GetToolCount() const + { + return m_Tools.Count(); + } + + virtual IToolSystem *GetTool( int index ) + { + if ( index < 0 || index >= m_Tools.Count() ) + { + return NULL; + } + return m_Tools[ index ]; + } + +public: + + void RegisterTool( IToolSystem *tool ) + { + m_Tools.AddToTail( tool ); + } +private: + + CUtlVector< IToolSystem * > m_Tools; +}; + +static CToolDictionary g_ToolDictionary; + +EXPOSE_SINGLE_INTERFACE_GLOBALVAR( IToolDictionary, CToolDictionary, VTOOLDICTIONARY_INTERFACE_VERSION, g_ToolDictionary ); + +void RegisterTool( IToolSystem *tool ) +{ + g_ToolDictionary.RegisterTool( tool ); +} + |