-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfoolsgoldsource.h
More file actions
285 lines (219 loc) · 7.93 KB
/
foolsgoldsource.h
File metadata and controls
285 lines (219 loc) · 7.93 KB
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
274
275
276
277
278
279
280
281
282
283
284
285
//========= Copyright © 2008-2023, Team Sandpit, All rights reserved. ============
//
// Purpose: Fake GoldSource engine definitions
//
// $NoKeywords: $
//================================================================================
#ifndef _FOOLSGOLDSOURCE_H_
#define _FOOLSGOLDSOURCE_H_
#include <cstring>
#include <cctype>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#ifdef CLIENT_DLL
#define VECTOR_H // cl_dll/util_vector.h and dlls/vector.h define fairly similar classes - define the dlls/vector.h header guard to stop redefinition errors
#include "hud.h"
#include "r_studioint.h"
#include "triangleapi.h"
#include "VGUI_App.h"
#include "VGUI_Panel.h"
#include "VGUI_Scheme.h"
#endif // CLIENT_DLL
#include "extdll.h"
#include "enginecallback.h"
using std::cout;
using std::endl;
using std::shared_ptr;
using std::string;
using std::vector;
const int RENDERER_SOFTWARE = 0;
const int RENDERER_OPENGL = 1;
namespace foolsgoldsource
{
typedef void (*commandFunction)(void);
struct event_t
{
unsigned short iIndex;
string strEventFileName;
int iType;
};
struct clientCommand_t
{
unsigned int iIndex;
string strCommandName;
commandFunction pfnFunction;
};
struct userMessage_t
{
unsigned int iIndex;
string strMessageName;
#ifdef CLIENT_DLL
pfnUserMsgHook pfnFunction;
#endif // CLIENT_DLL
};
enum class EngineType
{
ENGINE_SDKv10,
ENGINE_SDKv20,
ENGINE_SDKv21,
ENGINE_SDKv22,
ENGINE_SDKv23,
ENGINE_STEAM,
ENGINE_CRYOFFEAR,
ENGINE_CROSSPLATFORM,
ENGINE_SVENGINE,
ENGINE_25ANNIVERSARY
};
class Engine
{
public:
Engine();
~Engine() noexcept;
void Initialise();
const enginefuncs_t GetServerEngineFunctions() const;
const globalvars_t GetServerGlobalVariables() const;
const DLL_FUNCTIONS *GetDLLFunctions() const;
const NEW_DLL_FUNCTIONS GetNewDLLFunctions() const;
#ifdef CLIENT_DLL
const cl_enginefunc_t GetClientEngineFunctions() const;
#endif // CLIENT_DLL
const string GetGameDirectory() const;
void SetGameDirectory( const string& strGameDir );
bool GetIsDedicatedServer() const;
void SetIsDedicatedServer( const bool bIsDedicatedServer );
bool GetIsCareerMatch() const;
void SetIsCareerMatch( const bool bIsCareerMatch );
void SetMaxClients( const unsigned int iMaxClients );
#ifdef CLIENT_DLL
TRICULLSTYLE GetTriCullStyle() const;
void SetTriCullStyle( const TRICULLSTYLE triCullStyle );
#endif // CLIENT_DLL
bool GetIsFogOn() const;
void SetIsFogOn( const bool bIsFogOn );
int GetRenderer() const;
void SetRenderer( const int iRenderer );
const char* GetString( string_t offset );
// below shouldn't be public because the game doesn't have access to them
// TODO: below be in some server struct?
vector<shared_ptr<edict_t>> edicts;
vector<string> models;
vector<string> sounds;
vector<event_t> events;
int iMaxEdicts;
vector<string> executedClientCommands;
vector<string> executedServerCommands;
vector<shared_ptr<cvar_t>> clientCvars;
vector<clientCommand_t> clientCommands;
vector<userMessage_t> userMessages;
// TODO: should probably be private
unsigned int iCallsToClientCommand;
// TODO: how does the engine track this?
unsigned int iStringTableOffset;
const static unsigned int iStringTableSize = 2048;
private:
enginefuncs_t engineFunctions;
globalvars_t globalVariables;
DLL_FUNCTIONS dllFunctions;
NEW_DLL_FUNCTIONS newDllFunctions;
#ifdef CLIENT_DLL
triangleapi_t triangleApi;
cl_enginefunc_t clientEngineFunctions;
engine_studio_api_t engineStudioFunctions;
#endif // CLIENT_DLL
EngineType engineType;
string strGameDir;
bool bIsDedicatedServer;
bool bIsCareerMatch;
#ifdef CLIENT_DLL
TRICULLSTYLE triCullStyle;
#endif // CLIENT_DLL
bool bIsFogOn;
int iRenderer;
};
class Util
{
public:
static string tolowercase( const string& str );
};
extern Engine gEngine;
// enginefuncs_t
int pfnPrecacheModel( char* s );
int pfnPrecacheSound( char* s );
void pfnSetModel( edict_t* e, const char* m );
int pfnModelIndex( const char* m );
int pfnModelFrames( int modelIndex );
void pfnSetSize( edict_t* e, const float* rgflMin, const float* rgflMax );
void pfnChangeLevel( char* s1, char* s2 );
void pfnGetSpawnParms( edict_t* ent );
void pfnSaveSpawnParms( edict_t* ent );
float pfnVecToYaw( const float* rgflVector );
void pfnVecToAngles( const float* rgflVectorIn, float* rgflVectorOut );
void pfnMoveToOrigin( edict_t* ent, const float* pflGoal, float dist, int iMoveType );
void pfnChangeYaw( edict_t* ent );
void pfnChangePitch( edict_t* ent );
edict_t* pfnFindEntityByString( edict_t* pEdictStartSearchAfter, const char* pszField, const char* pszValue );
int pfnGetEntityIllum( edict_t* pEnt );
edict_t* pfnFindEntityInSphere( edict_t* pEdictStartSearchAfter, const float* org, float rad );
edict_t* pfnFindClientInPVS( edict_t* pEdict );
edict_t* pfnEntitiesInPVS( edict_t* pplayer );
edict_t* pfnCreateEntity( void );
void pfnSetOrigin( edict_t* e, const float* rgflOrigin );
void pfnEmitSound( edict_t* entity, int channel, const char* sample, float volume, float attenuation, int fFlags, int pitch );
void pfnEmitAmbientSound( edict_t* entity, float* pos, const char* samp, float vol, float attenuation, int fFlags, int pitch );
void pfnTraceSphere( const float* v1, const float* v2, int fNoMonsters, float radius, edict_t* pentToSkip, TraceResult* ptr );
void pfnServerCommand( char* str );
void pfnServerExecute( void );
void pfnClientCommand( edict_t* pEdict, char* szFmt, ... );
void pfnParticleEffect( const float* org, const float* dir, float color, float count );
void pfnLightStyle( int style, char* val );
int32 pfnRandomLong( int32 lLow, int32 lHigh );
void pfnAlertMessage( ALERT_TYPE atype, char *szFmt, ... );
void* pfnPvAllocEntPrivateData( edict_t* pEdict, int32 cb );
int pfnAllocString( const char* szValue );
edict_t* pfnPEntityOfEntOffset( int iEntOffset );
int pfnEntOffsetOfPEntity( const edict_t* pEdict );
edict_t* pfnPEntityOfEntIndex( int iEntIndex );
edict_t* pfnFindEntityByVars( struct entvars_s* pvars );
void* pfnGetModelPtr( edict_t* pEdict );
const char* pfnNameForFunction( uint32 function );
void pfnServerPrint( const char* szMsg );
void pfnGetGameDir( char *szGetGameDir );
int pfnIsDedicatedServer( void );
unsigned short pfnPrecacheEvent( int type, const char* psz );
void pfnPlaybackEvent( int flags, const edict_t* pInvoker, unsigned short eventindex, float delay, float* origin, float* angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 );
int pfnIsCareerMatch( void );
void pfnQueryClientCvarValue( const edict_t* player, const char* cvarName );
void pfnQueryClientCvarValue2( const edict_t* player, const char* cvarName, int requestID );
int pfnCheckParm( const char* pchCmdLineToken, char** ppnext );
edict_t* pfnPEntityOfEntIndexAllEntities( int iEntIndex );
// DLL_FUNCTIONS
void ClientCommand( edict_t* pEntity );
void ServerActivate( edict_t* pEdictList, int edictCount, int clientMax );
// cl_enginefunc_t
struct cvar_s* pfnRegisterVariable( char* szName, char* szValue, int flags );
int pfnAddCommand( char* cmd_name, void (*pfnEngSrc_function)(void) );
#ifdef CLIENT_DLL
int pfnHookUserMsg( char* szMsgName, pfnUserMsgHook pfn );
#endif // CLIENT_DLL
void Con_DPrintf(char* fmt, ...);
const char* pfnGetGameDirectory( void );
struct cvar_s* pfnGetCvarPointer( const char* szName );
const char* pfnGetLevelName( void );
#ifdef CLIENT_DLL
void* VGui_GetPanel();
void CullFace( TRICULLSTYLE style );
#endif // CLIENT_DLL
void Fog( float flFogColor[3], float flStart, float flEnd, int bOn );
void FogParams( float flDensity, int iFogSkybox );
// engine_studio_api_t
struct model_s* GetChromeSprite( void );
void GetModelCounters( int** s, int** a );
float**** StudioGetBoneTransform( void );
float**** StudioGetLightTransform( void );
float*** StudioGetAliasTransform( void );
float*** StudioGetRotationMatrix( void );
int IsHardware( void );
}
#endif // _FOOLSGOLDSOURCE_H_