aboutsummaryrefslogtreecommitdiff
path: root/mp/src/public/toolframework/itoolframework.h
blob: 5be2190e453e373079c01beaa36fe9059ee6ac43 (plain) (blame)
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
//========= 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