forked from sears2424/Source-PlusPlus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathitoolentity.h
273 lines (218 loc) · 13.5 KB
/
itoolentity.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
//========= 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;
class CBaseTempEntity;
class CGlobalEntityList;
class IEntityFindFilter;
//-----------------------------------------------------------------------------
// 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;
virtual CBaseTempEntity *GetTempEntList( void ) = 0;
virtual CGlobalEntityList *GetEntityList( void ) = 0;
virtual bool IsEntityPtr( void *pTest ) = 0;
virtual CBaseEntity *FindEntityByClassname( CBaseEntity *pStartEntity, const char *szName ) = 0;
virtual CBaseEntity *FindEntityByName( CBaseEntity *pStartEntity, const char *szName, CBaseEntity *pSearchingEntity = NULL, CBaseEntity *pActivator = NULL, CBaseEntity *pCaller = NULL, IEntityFindFilter *pFilter = NULL ) = 0;
virtual CBaseEntity *FindEntityInSphere( CBaseEntity *pStartEntity, const Vector &vecCenter, float flRadius ) = 0;
virtual CBaseEntity *FindEntityByTarget( CBaseEntity *pStartEntity, const char *szName ) = 0;
virtual CBaseEntity *FindEntityByModel( CBaseEntity *pStartEntity, const char *szModelName ) = 0;
virtual CBaseEntity *FindEntityByNameNearest( const char *szName, const Vector &vecSrc, float flRadius, CBaseEntity *pSearchingEntity = NULL, CBaseEntity *pActivator = NULL, CBaseEntity *pCaller = NULL ) = 0;
virtual CBaseEntity *FindEntityByNameWithin( CBaseEntity *pStartEntity, const char *szName, const Vector &vecSrc, float flRadius, CBaseEntity *pSearchingEntity = NULL, CBaseEntity *pActivator = NULL, CBaseEntity *pCaller = NULL ) = 0;
virtual CBaseEntity *FindEntityByClassnameNearest( const char *szName, const Vector &vecSrc, float flRadius ) = 0;
virtual CBaseEntity *FindEntityByClassnameWithin( CBaseEntity *pStartEntity, const char *szName, const Vector &vecSrc, float flRadius ) = 0;
virtual CBaseEntity *FindEntityByClassnameWithin( CBaseEntity *pStartEntity, const char *szName, const Vector &vecMins, const Vector &vecMaxs ) = 0;
virtual CBaseEntity *FindEntityGeneric( CBaseEntity *pStartEntity, const char *szName, CBaseEntity *pSearchingEntity = NULL, CBaseEntity *pActivator = NULL, CBaseEntity *pCaller = NULL ) = 0;
virtual CBaseEntity *FindEntityGenericWithin( CBaseEntity *pStartEntity, const char *szName, const Vector &vecSrc, float flRadius, CBaseEntity *pSearchingEntity = NULL, CBaseEntity *pActivator = NULL, CBaseEntity *pCaller = NULL ) = 0;
virtual CBaseEntity *FindEntityGenericNearest( const char *szName, const Vector &vecSrc, float flRadius, CBaseEntity *pSearchingEntity = NULL, CBaseEntity *pActivator = NULL, CBaseEntity *pCaller = NULL ) = 0;
virtual CBaseEntity *FindEntityNearestFacing( const Vector &origin, const Vector &facing, float threshold ) = 0;
virtual CBaseEntity *FindEntityClassNearestFacing( const Vector &origin, const Vector &facing, float threshold, char *classname ) = 0;
virtual CBaseEntity *FindEntityProcedural( const char *szName, CBaseEntity *pSearchingEntity = NULL, CBaseEntity *pActivator = NULL, CBaseEntity *pCaller = NULL ) = 0;
};
typedef IServerTools IServerTools001;
typedef IServerTools IServerTools002;
#define VSERVERTOOLS_INTERFACE_VERSION_1 "VSERVERTOOLS001"
#define VSERVERTOOLS_INTERFACE_VERSION_2 "VSERVERTOOLS002"
#define VSERVERTOOLS_INTERFACE_VERSION "VSERVERTOOLS003"
#define VSERVERTOOLS_INTERFACE_VERSION_INT 3
//-----------------------------------------------------------------------------
// 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