-
Notifications
You must be signed in to change notification settings - Fork 1
/
engine.h
339 lines (332 loc) · 18.4 KB
/
engine.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
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
///////////////////////////////////////////////////////////////////////////////////////////////
//
// This file contains both GNU as VALVE licenced material.
//
// This source file contains VALVE LCC licence material.
// Read and Agree to the above stated header
// before distibuting or editing this source code.
//
// Please read and agree to the mb_gnu_license.txt file
// (the file is located in the marine_bot source folder)
// before editing or distributing this source code.
// This source code is free for use under the rules of the GNU General Public License.
// For more information goto:: http://www.gnu.org/licenses/
//
// credits to - valve, botman.
//
// Marine Bot - code by Frank McNeil, Kota@, Mav, Shrike.
//
// (http://marinebot.xf.cz)
//
//
// engine.h
//
////////////////////////////////////////////////////////////////////////////////////////////////
#ifndef ENGINE_H
#define ENGINE_H
#include "defines.h"
#ifndef NEWSDKAM
// engine prototypes (from engine\eiface.h)...
// in HL SDK v2.3
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 );
void pfnMakeVectors( const float *rgflVector );
void pfnAngleVectors( const float *rgflVector, float *forward, float *right, float *up );
edict_t* pfnCreateEntity();
void pfnRemoveEntity( edict_t* e );
edict_t* pfnCreateNamedEntity( int className );
void pfnMakeStatic( edict_t *ent );
int pfnEntIsOnFloor( edict_t *e );
int pfnDropToFloor( edict_t* e );
int pfnWalkMove( edict_t *ent, float yaw, float dist, int iMode );
void pfnSetOrigin( edict_t *e, const float *rgflOrigin );
void pfnEmitSound( edict_t *entity, int channel, const char *sample, /*int*/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 pfnTraceLine( const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr );
void pfnTraceToss( edict_t* pent, edict_t* pentToIgnore, TraceResult *ptr );
int pfnTraceMonsterHull( edict_t *pEdict, const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr );
void pfnTraceHull( const float *v1, const float *v2, int fNoMonsters, int hullNumber, edict_t *pentToSkip, TraceResult *ptr );
void pfnTraceModel( const float *v1, const float *v2, int hullNumber, edict_t *pent, TraceResult *ptr );
const char *pfnTraceTexture( edict_t *pTextureEntity, const float *v1, const float *v2 );
void pfnTraceSphere( const float *v1, const float *v2, int fNoMonsters, float radius, edict_t *pentToSkip, TraceResult *ptr );
void pfnGetAimVector( edict_t* ent, float speed, float *rgflReturn );
void pfnServerCommand( char* str );
void pfnServerExecute();
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 );
int pfnDecalIndex( const char *name );
int pfnPointContents( const float *rgflVector );
void pfnMessageBegin( int msg_dest, int msg_type, const float *pOrigin, edict_t *ed );
void pfnMessageEnd();
void pfnWriteByte( int iValue );
void pfnWriteChar( int iValue );
void pfnWriteShort( int iValue );
void pfnWriteLong( int iValue );
void pfnWriteAngle( float flValue );
void pfnWriteCoord( float flValue );
void pfnWriteString( const char *sz );
void pfnWriteEntity( int iValue );
void pfnCVarRegister( cvar_t *pCvar );
float pfnCVarGetFloat( const char *szVarName );
const char* pfnCVarGetString( const char *szVarName );
void pfnCVarSetFloat( const char *szVarName, float flValue );
void pfnCVarSetString( const char *szVarName, const char *szValue );
void pfnAlertMessage( ALERT_TYPE atype, char *szFmt, ... );
void pfnEngineFprintf( FILE *pfile, char *szFmt, ... );
#if !defined ( __linux__ ) && !defined ( NEWSDKVALVE ) && !defined ( NEWSDKMM )
void* pfnPvAllocEntPrivateData( edict_t *pEdict, long cb );
#else
void* pfnPvAllocEntPrivateData( edict_t *pEdict, int32 cb );
#endif
void* pfnPvEntPrivateData( edict_t *pEdict );
void pfnFreeEntPrivateData( edict_t *pEdict );
const char* pfnSzFromIndex( int iString );
int pfnAllocString( const char *szValue );
struct entvars_s* pfnGetVarsOfEnt( edict_t *pEdict );
edict_t* pfnPEntityOfEntOffset( int iEntOffset );
int pfnEntOffsetOfPEntity( const edict_t *pEdict );
int pfnIndexOfEdict( const edict_t *pEdict );
edict_t* pfnPEntityOfEntIndex( int iEntIndex );
edict_t* pfnFindEntityByVars( struct entvars_s* pvars );
void* pfnGetModelPtr( edict_t* pEdict );
int pfnRegUserMsg( const char *pszName, int iSize );
void pfnAnimationAutomove( const edict_t* pEdict, float flTime );
void pfnGetBonePosition( const edict_t* pEdict, int iBone, float *rgflOrigin, float *rgflAngles );
#if !defined ( __linux__ ) && !defined ( NEWSDKVALVE ) && !defined ( NEWSDKMM )
unsigned long pfnFunctionFromName( const char *pName );
const char *pfnNameForFunction( unsigned long function );
#else
uint32 pfnFunctionFromName( const char *pName );
const char *pfnNameForFunction( uint32 function );
#endif
void pfnClientPrintf( edict_t* pEdict, PRINT_TYPE ptype, const char *szMsg );
void pfnServerPrint( const char *szMsg );
const char *pfnCmd_Args();
const char *pfnCmd_Argv( int argc );
int pfnCmd_Argc();
void pfnGetAttachment( const edict_t *pEdict, int iAttachment, float *rgflOrigin, float *rgflAngles );
void pfnCRC32_Init( CRC32_t *pulCRC );
void pfnCRC32_ProcessBuffer( CRC32_t *pulCRC, void *p, int len );
void pfnCRC32_ProcessByte( CRC32_t *pulCRC, unsigned char ch );
CRC32_t pfnCRC32_Final( CRC32_t pulCRC );
#if !defined ( __linux__ ) && !defined ( NEWSDKVALVE ) && !defined ( NEWSDKMM )
long pfnRandomLong( long lLow, long lHigh );
#else
int32 pfnRandomLong( int32 lLow, int32 lHigh );
#endif
float pfnRandomFloat( float flLow, float flHigh );
void pfnSetView( const edict_t *pClient, const edict_t *pViewent );
float pfnTime();
void pfnCrosshairAngle( const edict_t *pClient, float pitch, float yaw );
byte * pfnLoadFileForMe( char *filename, int *pLength );
void pfnFreeFile( void *buffer );
void pfnEndSection( const char *pszSectionName );
int pfnCompareFileTime( char *filename1, char *filename2, int *iCompare );
void pfnGetGameDir( char *szGetGameDir );
void pfnCvar_RegisterVariable( cvar_t *variable );
void pfnFadeClientVolume( const edict_t *pEdict, int fadePercent, int fadeOutSeconds, int holdTime, int fadeInSeconds );
void pfnSetClientMaxspeed( const edict_t *pEdict, float fNewMaxspeed );
edict_t * pfnCreateFakeClient( const char *netname );
void pfnRunPlayerMove( edict_t *fakeclient, const float *viewangles, float forwardmove, float sidemove, float upmove, unsigned short buttons, byte impulse, byte msec );
int pfnNumberOfEntities();
char* pfnGetInfoKeyBuffer( edict_t *e );
char* pfnInfoKeyValue( char *infobuffer, char *key );
void pfnSetKeyValue( char *infobuffer, char *key, char *value );
void pfnSetClientKeyValue( int clientIndex, char *infobuffer, char *key, char *value );
int pfnIsMapValid( char *filename );
void pfnStaticDecal( const float *origin, int decalIndex, int entityIndex, int modelIndex );
int pfnPrecacheGeneric( char* s );
int pfnGetPlayerUserId( edict_t *e );
const char *pfnGetPlayerAuthId( edict_t *e );
void pfnBuildSoundMsg( edict_t *entity, int channel, const char *sample, /*int*/float volume, float attenuation, int fFlags, int pitch, int msg_dest, int msg_type, const float *pOrigin, edict_t *ed );
int pfnIsDedicatedServer();
cvar_t *pfnCVarGetPointer( const char *szVarName );
unsigned int pfnGetPlayerWONId( edict_t *e );
void pfnInfo_RemoveKey( char *s, const char *key );
const char *pfnGetPhysicsKeyValue( const edict_t *pClient, const char *key );
void pfnSetPhysicsKeyValue( const edict_t *pClient, const char *key, const char *value );
const char *pfnGetPhysicsInfoString( const edict_t *pClient );
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 );
unsigned char *pfnSetFatPVS( float *org );
unsigned char *pfnSetFatPAS( float *org );
int pfnCheckVisibility ( const edict_t *entity, unsigned char *pset );
void pfnDeltaSetField( struct delta_s *pFields, const char *fieldname );
void pfnDeltaUnsetField( struct delta_s *pFields, const char *fieldname );
void pfnDeltaAddEncoder( char *name, void (*conditionalencode)( struct delta_s *pFields, const unsigned char *from, const unsigned char *to ) );
int pfnGetCurrentPlayer();
int pfnCanSkipPlayer( const edict_t *player );
int pfnDeltaFindField( struct delta_s *pFields, const char *fieldname );
void pfnDeltaSetFieldByIndex( struct delta_s *pFields, int fieldNumber );
void pfnDeltaUnsetFieldByIndex( struct delta_s *pFields, int fieldNumber );
void pfnSetGroupMask( int mask, int op );
int pfnCreateInstancedBaseline( int classname, struct entity_state_s *baseline );
void pfnCvar_DirectSet( struct cvar_s *var, char *value );
void pfnForceUnmodified( FORCE_TYPE type, float *mins, float *maxs, const char *filename );
void pfnGetPlayerStats( const edict_t *pClient, int *ping, int *packet_loss );
void pfnAddServerCommand( char *cmd_name, void (*function) () );
#else
// engine prototypes (from engine\eiface.h)...
// in new HL SDK by Allied Modders
int pfnPrecacheModel(const char* s);
int pfnPrecacheSound(const 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(const char* s1, const 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);
void pfnMakeVectors(const float* rgflVector);
void pfnAngleVectors(const float* rgflVector, float* forward, float* right, float* up);
edict_t* pfnCreateEntity(void);
void pfnRemoveEntity(edict_t* e);
edict_t* pfnCreateNamedEntity(int className);
void pfnMakeStatic(edict_t* ent);
int pfnEntIsOnFloor(edict_t* e);
int pfnDropToFloor(edict_t* e);
int pfnWalkMove(edict_t* ent, float yaw, float dist, int iMode);
void pfnSetOrigin(edict_t* e, const float* rgflOrigin);
void pfnEmitSound(edict_t* entity, int channel, const char* sample, /*int*/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 pfnTraceLine(const float* v1, const float* v2, int fNoMonsters, edict_t* pentToSkip, TraceResult* ptr);
void pfnTraceToss(edict_t* pent, edict_t* pentToIgnore, TraceResult* ptr);
int pfnTraceMonsterHull(edict_t* pEdict, const float* v1, const float* v2, int fNoMonsters, edict_t* pentToSkip, TraceResult* ptr);
void pfnTraceHull(const float* v1, const float* v2, int fNoMonsters, int hullNumber, edict_t* pentToSkip, TraceResult* ptr);
void pfnTraceModel(const float* v1, const float* v2, int hullNumber, edict_t* pent, TraceResult* ptr);
const char* pfnTraceTexture(edict_t* pTextureEntity, const float* v1, const float* v2);
void pfnTraceSphere(const float* v1, const float* v2, int fNoMonsters, float radius, edict_t* pentToSkip, TraceResult* ptr);
void pfnGetAimVector(edict_t* ent, float speed, float* rgflReturn);
void pfnServerCommand(const char* str);
void pfnServerExecute(void);
void pfnClientCommand(edict_t* pEdict, const char* szFmt, ...);
void pfnParticleEffect(const float* org, const float* dir, float color, float count);
void pfnLightStyle(int style, const char* val);
int pfnDecalIndex(const char* name);
int pfnPointContents(const float* rgflVector);
void pfnMessageBegin(int msg_dest, int msg_type, const float* pOrigin, edict_t* ed);
void pfnMessageEnd(void);
void pfnWriteByte(int iValue);
void pfnWriteChar(int iValue);
void pfnWriteShort(int iValue);
void pfnWriteLong(int iValue);
void pfnWriteAngle(float flValue);
void pfnWriteCoord(float flValue);
void pfnWriteString(const char* sz);
void pfnWriteEntity(int iValue);
void pfnCVarRegister(cvar_t* pCvar);
float pfnCVarGetFloat(const char* szVarName);
const char* pfnCVarGetString(const char* szVarName);
void pfnCVarSetFloat(const char* szVarName, float flValue);
void pfnCVarSetString(const char* szVarName, const char* szValue);
void pfnAlertMessage(ALERT_TYPE atype, const char* szFmt, ...);
void pfnEngineFprintf(FILE* pfile, const char* szFmt, ...);
void* pfnPvAllocEntPrivateData(edict_t* pEdict, int32 cb);
void* pfnPvEntPrivateData(edict_t* pEdict);
void pfnFreeEntPrivateData(edict_t* pEdict);
const char* pfnSzFromIndex(int iString);
int pfnAllocString(const char* szValue);
struct entvars_s* pfnGetVarsOfEnt(edict_t* pEdict);
edict_t* pfnPEntityOfEntOffset(int iEntOffset);
int pfnEntOffsetOfPEntity(const edict_t* pEdict);
int pfnIndexOfEdict(const edict_t* pEdict);
edict_t* pfnPEntityOfEntIndex(int iEntIndex);
edict_t* pfnFindEntityByVars(struct entvars_s* pvars);
void* pfnGetModelPtr(edict_t* pEdict);
int pfnRegUserMsg(const char* pszName, int iSize);
void pfnAnimationAutomove(const edict_t* pEdict, float flTime);
void pfnGetBonePosition(const edict_t* pEdict, int iBone, float* rgflOrigin, float* rgflAngles);
uint32 pfnFunctionFromName(const char* pName);
const char* pfnNameForFunction(uint32 function);
void pfnClientPrintf(edict_t* pEdict, PRINT_TYPE ptype, const char* szMsg);
void pfnServerPrint(const char* szMsg);
const char* pfnCmd_Args(void);
const char* pfnCmd_Argv(int argc);
int pfnCmd_Argc(void);
void pfnGetAttachment(const edict_t* pEdict, int iAttachment, float* rgflOrigin, float* rgflAngles);
void pfnCRC32_Init(CRC32_t* pulCRC);
void pfnCRC32_ProcessBuffer(CRC32_t* pulCRC, void* p, int len);
void pfnCRC32_ProcessByte(CRC32_t* pulCRC, unsigned char ch);
CRC32_t pfnCRC32_Final(CRC32_t pulCRC);
int32 pfnRandomLong(int32 lLow, int32 lHigh);
float pfnRandomFloat(float flLow, float flHigh);
void pfnSetView(const edict_t* pClient, const edict_t* pViewent);
float pfnTime(void);
void pfnCrosshairAngle(const edict_t* pClient, float pitch, float yaw);
byte* pfnLoadFileForMe(const char* filename, int* pLength);
void pfnFreeFile(void* buffer);
void pfnEndSection(const char* pszSectionName);
int pfnCompareFileTime(char* filename1, char* filename2, int* iCompare);
void pfnGetGameDir(char* szGetGameDir);
void pfnCvar_RegisterVariable(cvar_t* variable);
void pfnFadeClientVolume(const edict_t* pEdict, int fadePercent, int fadeOutSeconds, int holdTime, int fadeInSeconds);
void pfnSetClientMaxspeed(const edict_t* pEdict, float fNewMaxspeed);
edict_t* pfnCreateFakeClient(const char* netname);
void pfnRunPlayerMove(edict_t* fakeclient, const float* viewangles, float forwardmove, float sidemove, float upmove, unsigned short buttons, byte impulse, byte msec);
int pfnNumberOfEntities(void);
char* pfnGetInfoKeyBuffer(edict_t* e);
char* pfnInfoKeyValue(char* infobuffer, const char* key);
void pfnSetKeyValue(char* infobuffer, const char* key, const char* value);
void pfnSetClientKeyValue(int clientIndex, char* infobuffer, const char* key, const char* value);
int pfnIsMapValid(const char* filename);
void pfnStaticDecal(const float* origin, int decalIndex, int entityIndex, int modelIndex);
int pfnPrecacheGeneric(const char* s);
int pfnGetPlayerUserId(edict_t* e);
const char* pfnGetPlayerAuthId(edict_t* e);
void pfnBuildSoundMsg(edict_t* entity, int channel, const char* sample, /*int*/float volume, float attenuation, int fFlags, int pitch, int msg_dest, int msg_type, const float* pOrigin, edict_t* ed);
int pfnIsDedicatedServer(void);
cvar_t* pfnCVarGetPointer(const char* szVarName);
unsigned int pfnGetPlayerWONId(edict_t* e);
void pfnInfo_RemoveKey(char* s, const char* key);
const char* pfnGetPhysicsKeyValue(const edict_t* pClient, const char* key);
void pfnSetPhysicsKeyValue(const edict_t* pClient, const char* key, const char* value);
const char* pfnGetPhysicsInfoString(const edict_t* pClient);
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);
unsigned char* pfnSetFatPVS(float* org);
unsigned char* pfnSetFatPAS(float* org);
int pfnCheckVisibility(const edict_t* entity, unsigned char* pset);
void pfnDeltaSetField(struct delta_s* pFields, const char* fieldname);
void pfnDeltaUnsetField(struct delta_s* pFields, const char* fieldname);
void pfnDeltaAddEncoder(const char* name, void (*conditionalencode)(struct delta_s* pFields, const unsigned char* from, const unsigned char* to));
int pfnGetCurrentPlayer(void);
int pfnCanSkipPlayer(const edict_t* player);
int pfnDeltaFindField(struct delta_s* pFields, const char* fieldname);
void pfnDeltaSetFieldByIndex(struct delta_s* pFields, int fieldNumber);
void pfnDeltaUnsetFieldByIndex(struct delta_s* pFields, int fieldNumber);
void pfnSetGroupMask(int mask, int op);
int pfnCreateInstancedBaseline(int classname, struct entity_state_s* baseline);
void pfnCvar_DirectSet(struct cvar_s* var, const char* value);
void pfnForceUnmodified(FORCE_TYPE type, float* mins, float* maxs, const char* filename);
void pfnGetPlayerStats(const edict_t* pClient, int* ping, int* packet_loss);
void pfnAddServerCommand(const char* cmd_name, void (*function) (void));
#endif
#endif // ENGINE_H