uid issue
This commit is contained in:
59
public/toolframework/iclientenginetools.h
Normal file
59
public/toolframework/iclientenginetools.h
Normal file
@ -0,0 +1,59 @@
|
||||
//====== Copyright <20> 1996-2005, 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
|
246
public/toolframework/ienginetool.h
Normal file
246
public/toolframework/ienginetool.h
Normal file
@ -0,0 +1,246 @@
|
||||
//====== Copyright <20> 1996-2005, Valve Corporation, All rights reserved. =======
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
#ifndef IENGINETOOL_H
|
||||
#define IENGINETOOL_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "interface.h"
|
||||
#include "soundflags.h"
|
||||
#include "avi/iavi.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;
|
||||
|
||||
// If module not already loaded, loads it and optionally switches to first tool in module. Returns false if load failed or tool already loaded
|
||||
virtual bool LoadToolModule( char const *pToolModule, bool bSwitchToFirst ) = 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;
|
||||
|
||||
virtual void SetVolumeByGuid( int guid, float flVolume ) = 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, 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, 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 AVIHandle_t GetRecordingAVIHandle() = 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;
|
||||
virtual void OnModeChanged( bool bGameMode ) = 0;
|
||||
// Get the engine's window.
|
||||
virtual void* GetEngineHwnd() = 0;
|
||||
|
||||
// Returns the actual elapsed time of the samples
|
||||
virtual float GetSoundElapsedTime( int guid ) = 0;
|
||||
virtual void ValidateSoundCache( char const *pchSoundName ) = 0;
|
||||
virtual void PrefetchSound( char const *pchSoundName ) = 0;
|
||||
};
|
||||
|
||||
#define VENGINETOOL_INTERFACE_VERSION "VENGINETOOL003"
|
||||
|
||||
#endif // IENGINETOOL_H
|
56
public/toolframework/iserverenginetools.h
Normal file
56
public/toolframework/iserverenginetools.h
Normal file
@ -0,0 +1,56 @@
|
||||
//====== Copyright <20> 1996-2005, Valve Corporation, All rights reserved. =======
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
#ifndef ISERVERENGINETOOLS_H
|
||||
#define ISERVERENGINETOOLS_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "interface.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Forward declarations
|
||||
//-----------------------------------------------------------------------------
|
||||
class CServerDemo;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// 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* QueryInterface( const char *pInterfaceName ) = 0;
|
||||
|
||||
virtual void PreSetupVisibilityAllTools() = 0;
|
||||
|
||||
virtual bool InToolMode() = 0;
|
||||
};
|
||||
|
||||
#define VSERVERENGINETOOLS_INTERFACE_VERSION "VSERVERENGINETOOLS001"
|
||||
|
||||
#endif // ISERVERENGINETOOLS_H
|
39
public/toolframework/itooldictionary.h
Normal file
39
public/toolframework/itooldictionary.h
Normal file
@ -0,0 +1,39 @@
|
||||
//====== Copyright <20> 1996-2005, 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 "VTOOLDICTIONARY003"
|
||||
|
||||
#endif // ITOOLDICTIONARY_H
|
236
public/toolframework/itoolentity.h
Normal file
236
public/toolframework/itoolentity.h
Normal file
@ -0,0 +1,236 @@
|
||||
//====== Copyright <20> 1996-2005, 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"
|
||||
#include "engine/ivmodelinfo.h"
|
||||
#include "engine/IClientLeafSystem.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Forward declarations
|
||||
//-----------------------------------------------------------------------------
|
||||
class IServerEntity;
|
||||
class IClientEntity;
|
||||
class IToolSystem;
|
||||
class IClientRenderable;
|
||||
class Vector;
|
||||
class QAngle;
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// 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),
|
||||
SHADOW_FLAGS_CUSTOM_DRAW = (SHADOW_FLAGS_LAST_FLAG<<4),
|
||||
// Update this if you add flags
|
||||
CLIENT_SHADOW_FLAGS_LAST_FLAG = SHADOW_FLAGS_CUSTOM_DRAW
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// 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;
|
||||
typedef void *ParticleSystemSearchResult;
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// 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;
|
||||
|
||||
virtual EntitySearchResult GetEntity( HTOOLHANDLE handle ) = 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, bool bDrawWithViewModels, RenderableTranslucencyType_t nType, RenderableModelType_t nModelType = RENDERABLE_MODEL_UNKNOWN_TYPE ) = 0;
|
||||
virtual void RemoveClientRenderable( IClientRenderable *pRenderable ) = 0;
|
||||
virtual void SetTranslucencyType( IClientRenderable *pRenderable, RenderableTranslucencyType_t nType ) = 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 void DrawSprite( const Vector &vecOrigin, float flWidth, float flHeight, color32 color ) = 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 IsCombatCharacter ( EntitySearchResult currentEnt ) = 0;
|
||||
virtual bool IsNPC ( EntitySearchResult currentEnt ) = 0;
|
||||
virtual bool IsRagdoll ( EntitySearchResult currentEnt ) = 0;
|
||||
virtual bool IsViewModel ( EntitySearchResult currentEnt ) = 0;
|
||||
virtual bool IsViewModelOrAttachment( EntitySearchResult currentEnt ) = 0;
|
||||
virtual bool IsWeapon ( EntitySearchResult currentEnt ) = 0;
|
||||
virtual bool IsSprite ( EntitySearchResult currentEnt ) = 0;
|
||||
virtual bool IsProp ( EntitySearchResult currentEnt ) = 0;
|
||||
virtual bool IsBrush ( 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;
|
||||
|
||||
// ParticleSystem iteration, query, modification
|
||||
virtual ParticleSystemSearchResult FirstParticleSystem() { return NextParticleSystem( NULL ); }
|
||||
virtual ParticleSystemSearchResult NextParticleSystem( ParticleSystemSearchResult sr ) = 0;
|
||||
virtual void SetRecording( ParticleSystemSearchResult sr, bool bRecord ) = 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"
|
||||
|
||||
|
||||
class CEntityRespawnInfo
|
||||
{
|
||||
public:
|
||||
int m_nHammerID;
|
||||
const char *m_pEntText;
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// 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 void *FirstEntity( void ) = 0;
|
||||
virtual void *NextEntity( void *pEntity ) = 0;
|
||||
virtual void *FindEntityByHammerID( int iHammerID ) = 0;
|
||||
|
||||
// entity query
|
||||
virtual bool GetKeyValue( void *pEntity, const char *szField, char *szValue, int iMaxLen ) = 0;
|
||||
virtual bool SetKeyValue( void *pEntity, const char *szField, const char *szValue ) = 0;
|
||||
virtual bool SetKeyValue( void *pEntity, const char *szField, float flValue ) = 0;
|
||||
virtual bool SetKeyValue( void *pEntity, const char *szField, const Vector &vecValue ) = 0;
|
||||
|
||||
// entity spawning
|
||||
virtual void *CreateEntityByName( const char *szClassName ) = 0;
|
||||
virtual void DispatchSpawn( void *pEntity ) = 0;
|
||||
virtual bool DestroyEntityByHammerId( int iHammerID ) = 0;
|
||||
|
||||
// This function respawns the entity into the same entindex slot AND tricks the EHANDLE system into thinking it's the same
|
||||
// entity version so anyone holding an EHANDLE to the entity points at the newly-respawned entity.
|
||||
virtual bool RespawnEntitiesWithEdits( CEntityRespawnInfo *pInfos, int nInfos ) = 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;
|
||||
|
||||
// Call UTIL_Remove on the entity.
|
||||
virtual void RemoveEntity( int nHammerID ) = 0;
|
||||
};
|
||||
|
||||
#define VSERVERTOOLS_INTERFACE_VERSION "VSERVERTOOLS001"
|
||||
|
||||
#endif // ITOOLENTITY_H
|
325
public/toolframework/itoolframework.h
Normal file
325
public/toolframework/itoolframework.h
Normal file
@ -0,0 +1,325 @@
|
||||
//====== Copyright <20> 1996-2005, 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"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Forward declarations
|
||||
//-----------------------------------------------------------------------------
|
||||
class IToolSystem;
|
||||
struct SpatializationInfo_t;
|
||||
class KeyValues;
|
||||
class CBoneList;
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Standard messages
|
||||
//-----------------------------------------------------------------------------
|
||||
struct EffectRecordingState_t
|
||||
{
|
||||
bool m_bVisible : 1;
|
||||
bool m_bThirdPerson : 1;
|
||||
Color m_Color;
|
||||
float m_Scale;
|
||||
const char *m_pMaterialName;
|
||||
int m_nAttachment;
|
||||
Vector m_vecAttachment; // only used if m_nAttachment is -1
|
||||
};
|
||||
|
||||
struct BaseEntityRecordingState_t
|
||||
{
|
||||
BaseEntityRecordingState_t() :
|
||||
m_flTime( 0.0f ),
|
||||
m_pModelName( 0 ),
|
||||
m_nOwner( -1 ),
|
||||
m_fEffects( 0 ),
|
||||
m_bVisible( false ),
|
||||
m_bRecordFinalVisibleSample( false ),
|
||||
m_numEffects( 0 ),
|
||||
m_pEffects( NULL ),
|
||||
m_nFollowEntity( -1 )
|
||||
{
|
||||
m_vecRenderOrigin.Init();
|
||||
m_vecRenderAngles.Init();
|
||||
}
|
||||
|
||||
float m_flTime;
|
||||
const char *m_pModelName;
|
||||
int m_nOwner;
|
||||
int m_fEffects;
|
||||
bool m_bVisible : 1;
|
||||
bool m_bRecordFinalVisibleSample : 1;
|
||||
Vector m_vecRenderOrigin;
|
||||
QAngle m_vecRenderAngles;
|
||||
int m_nFollowEntity;
|
||||
|
||||
int m_numEffects;
|
||||
EffectRecordingState_t *m_pEffects;
|
||||
};
|
||||
|
||||
struct SpriteRecordingState_t
|
||||
{
|
||||
float m_flRenderScale;
|
||||
float m_flFrame;
|
||||
int m_nRenderMode;
|
||||
bool m_nRenderFX;
|
||||
Color m_Color;
|
||||
float m_flProxyRadius;
|
||||
};
|
||||
|
||||
struct BaseAnimatingHighLevelRecordingState_t
|
||||
{
|
||||
BaseAnimatingHighLevelRecordingState_t()
|
||||
: m_bClearIkTargets( false ),
|
||||
m_bIsRagdoll( false ),
|
||||
m_bShouldCreateIkContext( false ),
|
||||
m_nNumPoseParams( 0 ),
|
||||
m_flCycle( 0.0f ),
|
||||
m_flPlaybackRate( 1.0f ),
|
||||
m_flCycleRate( 0.0f ),
|
||||
m_nFrameCount( 0 ),
|
||||
m_bInterpEffectActive( false )
|
||||
{
|
||||
}
|
||||
|
||||
bool m_bClearIkTargets;
|
||||
bool m_bIsRagdoll;
|
||||
bool m_bShouldCreateIkContext;
|
||||
int m_nNumPoseParams;
|
||||
|
||||
float m_flCycle;
|
||||
float m_flPlaybackRate;
|
||||
float m_flCycleRate;
|
||||
int m_nFrameCount;
|
||||
|
||||
float m_flPoseParameter[MAXSTUDIOPOSEPARAM];
|
||||
|
||||
bool m_bInterpEffectActive;
|
||||
};
|
||||
|
||||
struct BaseAnimatingRecordingState_t
|
||||
{
|
||||
BaseAnimatingHighLevelRecordingState_t m_highLevelState;
|
||||
|
||||
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;
|
||||
bool m_bPlayerEyeIsPortalled; //for portal. Need to reverse some portal recursion draw logic when the player eye and body straddle a portal
|
||||
};
|
||||
|
||||
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;
|
||||
float m_fHalfWidth;
|
||||
float m_fHalfHeight;
|
||||
const char * m_portalType;
|
||||
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;
|
||||
|
||||
// Should sounds from the game be played?
|
||||
virtual bool ShouldGamePlaySounds() = 0;
|
||||
|
||||
virtual IMaterialProxy *LookupProxy( const char *proxyName ) = 0;
|
||||
|
||||
public: // general framework hooks
|
||||
virtual bool LoadFilmmaker() = 0;
|
||||
virtual void UnloadFilmmaker() = 0;
|
||||
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;
|
||||
// If module not already loaded, loads it and optionally switches to first tool in module. Returns false if load failed or tool already loaded
|
||||
virtual bool LoadToolModule( char const *pToolModule, bool bSwitchToFirst ) = 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
|
159
public/toolframework/itoolsystem.h
Normal file
159
public/toolframework/itoolsystem.h
Normal file
@ -0,0 +1,159 @@
|
||||
//====== Copyright <20> 1996-2005, 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;
|
||||
|
||||
namespace vgui
|
||||
{
|
||||
typedef uintp VPANEL;
|
||||
}
|
||||
|
||||
class CServerDemo;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// 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( const char *pExitMsg ) = 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 PostToolMessage( 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;
|
||||
virtual void* QueryInterface( const char *pInterfaceName ) = 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;
|
||||
|
||||
// Should sounds from the game be played?
|
||||
virtual bool ShouldGamePlaySounds() = 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;
|
||||
|
||||
virtual vgui::VPANEL GetClientWorkspaceArea() = 0;
|
||||
};
|
||||
|
||||
// Pointer to a member method of IGameSystem
|
||||
typedef void (IToolSystem::*ToolSystemFunc_t)();
|
||||
typedef void (IToolSystem::*ToolSystemFunc_Int_t)( int arg );
|
||||
|
||||
#endif // ITOOLSYSTEM_H
|
40
public/toolframework/toolframework.cpp
Normal file
40
public/toolframework/toolframework.cpp
Normal file
@ -0,0 +1,40 @@
|
||||
#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 );
|
||||
}
|
||||
|
Reference in New Issue
Block a user