engine: import headers from hlsdk-xash3d, fixes missing const modifiers

This commit is contained in:
Alibek Omarov 2020-08-31 20:29:36 +03:00
parent 0a331ca9a4
commit c1948b0f89
3 changed files with 140 additions and 113 deletions

View File

@ -30,7 +30,6 @@ typedef unsigned short word;
typedef int (*pfnUserMsgHook)(const char *pszName, int iSize, void *pbuf); typedef int (*pfnUserMsgHook)(const char *pszName, int iSize, void *pbuf);
#include <vector.h> #include <vector.h>
#define EXPORT _declspec( dllexport )
#include "../engine/cdll_int.h" #include "../engine/cdll_int.h"
#include "cdll_dll.h" #include "cdll_dll.h"
@ -46,4 +45,4 @@ bool GL_Init( void );
void GL_MapChanged( void ); void GL_MapChanged( void );
void GL_Shutdown( void ); void GL_Shutdown( void );
bool GL_Support( int r_ext ); bool GL_Support( int r_ext );
void R_VidInit( void ); void R_VidInit( void );

View File

@ -18,7 +18,7 @@
// 4-23-98 // 4-23-98
// JOHN: client dll interface declarations // JOHN: client dll interface declarations
// //
#pragma once
#ifndef CDLL_INT_H #ifndef CDLL_INT_H
#define CDLL_INT_H #define CDLL_INT_H
@ -89,6 +89,12 @@ typedef struct client_textmessage_s
const char *pMessage; const char *pMessage;
} client_textmessage_t; } client_textmessage_t;
#if _MSC_VER == 1200
#define ulonglong_t __int64
#else
#define ulonglong_t unsigned long long
#endif
typedef struct hud_player_info_s typedef struct hud_player_info_s
{ {
char *name; char *name;
@ -101,6 +107,8 @@ typedef struct hud_player_info_s
char *model; char *model;
short topcolor; short topcolor;
short bottomcolor; short bottomcolor;
ulonglong_t m_nSteamID;
} hud_player_info_t; } hud_player_info_t;
typedef struct cl_enginefuncs_s typedef struct cl_enginefuncs_s
@ -116,7 +124,7 @@ typedef struct cl_enginefuncs_s
void (*pfnSPR_DrawAdditive)( int frame, int x, int y, const wrect_t *prc ); void (*pfnSPR_DrawAdditive)( int frame, int x, int y, const wrect_t *prc );
void (*pfnSPR_EnableScissor)( int x, int y, int width, int height ); void (*pfnSPR_EnableScissor)( int x, int y, int width, int height );
void (*pfnSPR_DisableScissor)( void ); void (*pfnSPR_DisableScissor)( void );
client_sprite_t *(*pfnSPR_GetList)( char *psz, int *piCount ); client_sprite_t *(*pfnSPR_GetList)( const char *psz, int *piCount );
// screen handlers // screen handlers
void (*pfnFillRGBA)( int x, int y, int width, int height, int r, int g, int b, int a ); void (*pfnFillRGBA)( int x, int y, int width, int height, int r, int g, int b, int a );
@ -124,20 +132,20 @@ typedef struct cl_enginefuncs_s
void (*pfnSetCrosshair)( HSPRITE hspr, wrect_t rc, int r, int g, int b ); void (*pfnSetCrosshair)( HSPRITE hspr, wrect_t rc, int r, int g, int b );
// cvar handlers // cvar handlers
struct cvar_s *(*pfnRegisterVariable)( char *szName, char *szValue, int flags ); struct cvar_s *(*pfnRegisterVariable)( const char *szName, const char *szValue, int flags );
float (*pfnGetCvarFloat)( char *szName ); float (*pfnGetCvarFloat)( const char *szName );
char* (*pfnGetCvarString)( char *szName ); char* (*pfnGetCvarString)( const char *szName );
// command handlers // command handlers
int (*pfnAddCommand)( char *cmd_name, void (*function)(void) ); int (*pfnAddCommand)( const char *cmd_name, void (*function)(void) );
int (*pfnHookUserMsg)( char *szMsgName, pfnUserMsgHook pfn ); int (*pfnHookUserMsg)( const char *szMsgName, pfnUserMsgHook pfn );
int (*pfnServerCmd)( char *szCmdString ); int (*pfnServerCmd)( const char *szCmdString );
int (*pfnClientCmd)( char *szCmdString ); int (*pfnClientCmd)( const char *szCmdString );
void (*pfnGetPlayerInfo)( int ent_num, hud_player_info_t *pinfo ); void (*pfnGetPlayerInfo)( int ent_num, hud_player_info_t *pinfo );
// sound handlers // sound handlers
void (*pfnPlaySoundByName)( char *szSound, float volume ); void (*pfnPlaySoundByName)( const char *szSound, float volume );
void (*pfnPlaySoundByIndex)( int iSound, float volume ); void (*pfnPlaySoundByIndex)( int iSound, float volume );
// vector helpers // vector helpers
@ -146,7 +154,7 @@ typedef struct cl_enginefuncs_s
// text message system // text message system
client_textmessage_t *(*pfnTextMessageGet)( const char *pName ); client_textmessage_t *(*pfnTextMessageGet)( const char *pName );
int (*pfnDrawCharacter)( int x, int y, int number, int r, int g, int b ); int (*pfnDrawCharacter)( int x, int y, int number, int r, int g, int b );
int (*pfnDrawConsoleString)( int x, int y, char *string ); int (*pfnDrawConsoleString)( int x, int y, const char *string );
void (*pfnDrawSetTextColor)( float r, float g, float b ); void (*pfnDrawSetTextColor)( float r, float g, float b );
void (*pfnDrawConsoleStringLen)( const char *string, int *length, int *height ); void (*pfnDrawConsoleStringLen)( const char *string, int *length, int *height );
@ -157,21 +165,21 @@ typedef struct cl_enginefuncs_s
int (*GetWindowCenterX)( void ); int (*GetWindowCenterX)( void );
int (*GetWindowCenterY)( void ); int (*GetWindowCenterY)( void );
void (*GetViewAngles)( float * ); void (*GetViewAngles)( float * );
void (*SetViewAngles)( float * ); void (*SetViewAngles)( const float * );
int (*GetMaxClients)( void ); int (*GetMaxClients)( void );
void (*Cvar_SetValue)( char *cvar, float value ); void (*Cvar_SetValue)( const char *cvar, float value );
int (*Cmd_Argc)( void ); int (*Cmd_Argc)( void );
char *(*Cmd_Argv)( int arg ); char *(*Cmd_Argv)( int arg );
void (*Con_Printf)( char *fmt, ... ); void (*Con_Printf)( const char *fmt, ... );
void (*Con_DPrintf)( char *fmt, ... ); void (*Con_DPrintf)( const char *fmt, ... );
void (*Con_NPrintf)( int pos, char *fmt, ... ); void (*Con_NPrintf)( int pos, const char *fmt, ... );
void (*Con_NXPrintf)( struct con_nprint_s *info, char *fmt, ... ); void (*Con_NXPrintf)( struct con_nprint_s *info, const char *fmt, ... );
const char* (*PhysInfo_ValueForKey)( const char *key ); const char* (*PhysInfo_ValueForKey)( const char *key );
const char* (*ServerInfo_ValueForKey)( const char *key ); const char* (*ServerInfo_ValueForKey)( const char *key );
float (*GetClientMaxspeed)( void ); float (*GetClientMaxspeed)( void );
int (*CheckParm)( char *parm, char **ppnext ); int (*CheckParm)( const char *parm, const char **ppnext );
void (*Key_Event)( int key, int down ); void (*Key_Event)( int key, int down );
void (*GetMousePosition)( int *mx, int *my ); void (*GetMousePosition)( int *mx, int *my );
@ -183,24 +191,24 @@ typedef struct cl_enginefuncs_s
float (*GetClientTime)( void ); float (*GetClientTime)( void );
void (*V_CalcShake)( void ); void (*V_CalcShake)( void );
void (*V_ApplyShake)( float *origin, float *angles, float factor ); void (*V_ApplyShake)( const float *origin, const float *angles, float factor );
int (*PM_PointContents)( float *point, int *truecontents ); int (*PM_PointContents)( const float *point, int *truecontents );
int (*PM_WaterEntity)( float *p ); int (*PM_WaterEntity)( const float *p );
struct pmtrace_s *(*PM_TraceLine)( float *start, float *end, int flags, int usehull, int ignore_pe ); struct pmtrace_s *(*PM_TraceLine)( const float *start, const float *end, int flags, int usehull, int ignore_pe );
struct model_s *(*CL_LoadModel)( const char *modelname, int *index ); struct model_s *(*CL_LoadModel)( const char *modelname, int *index );
int (*CL_CreateVisibleEntity)( int type, struct cl_entity_s *ent ); int (*CL_CreateVisibleEntity)( int type, struct cl_entity_s *ent );
const struct model_s* (*GetSpritePointer)( HSPRITE hSprite ); const struct model_s* (*GetSpritePointer)( HSPRITE hSprite );
void (*pfnPlaySoundByNameAtLocation)( char *szSound, float volume, float *origin ); void (*pfnPlaySoundByNameAtLocation)( const char *szSound, float volume, const float *origin );
unsigned short (*pfnPrecacheEvent)( int type, const char* psz ); unsigned short (*pfnPrecacheEvent)( int type, const char* psz );
void (*pfnPlaybackEvent)( int flags, const struct edict_s *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 ); void (*pfnPlaybackEvent)( int flags, const struct edict_s *pInvoker, unsigned short eventindex, float delay, const float *origin, const float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 );
void (*pfnWeaponAnim)( int iAnim, int body ); void (*pfnWeaponAnim)( int iAnim, int body );
float (*pfnRandomFloat)( float flLow, float flHigh ); float (*pfnRandomFloat)( float flLow, float flHigh );
long (*pfnRandomLong)( long lLow, long lHigh ); int (*pfnRandomLong)( int lLow, int lHigh );
void (*pfnHookEvent)( char *name, void ( *pfnEvent )( struct event_args_s *args )); void (*pfnHookEvent)( const char *name, void ( *pfnEvent )( struct event_args_s *args ));
int (*Con_IsVisible) (); int (*Con_IsVisible) ();
const char *(*pfnGetGameDirectory)( void ); const char *(*pfnGetGameDirectory)( void );
struct cvar_s *(*pfnGetCvarPointer)( const char *szName ); struct cvar_s *(*pfnGetCvarPointer)( const char *szName );
@ -211,8 +219,8 @@ typedef struct cl_enginefuncs_s
void* (*VGui_GetPanel)( ); void* (*VGui_GetPanel)( );
void (*VGui_ViewportPaintBackground)( int extents[4] ); void (*VGui_ViewportPaintBackground)( int extents[4] );
byte* (*COM_LoadFile)( char *path, int usehunk, int *pLength ); byte* (*COM_LoadFile)( const char *path, int usehunk, int *pLength );
char* (*COM_ParseFile)( char *data, char *token ); char* (*COM_ParseFile)( const char *data, const char *token );
void (*COM_FreeFile)( void *buffer ); void (*COM_FreeFile)( void *buffer );
struct triangleapi_s *pTriAPI; struct triangleapi_s *pTriAPI;
@ -240,7 +248,7 @@ typedef struct cl_enginefuncs_s
// Gets a unique ID for the specified player. This is the same even if you see the player on a different server. // Gets a unique ID for the specified player. This is the same even if you see the player on a different server.
// iPlayer is an entity index, so client 0 would use iPlayer=1. // iPlayer is an entity index, so client 0 would use iPlayer=1.
// Returns false if there is no player on the server in the specified slot. // Returns false if there is no player on the server in the specified slot.
qboolean (*GetPlayerUniqueID)(int iPlayer, char playerID[16]); qboolean (*GetPlayerUniqueID)(int iPlayer, const char playerID[16]);
// TrackerID access // TrackerID access
int (*GetTrackerIDForPlayer)(int playerSlot); int (*GetTrackerIDForPlayer)(int playerSlot);
@ -248,44 +256,49 @@ typedef struct cl_enginefuncs_s
// Same as pfnServerCmd, but the message goes in the unreliable stream so it can't clog the net stream // Same as pfnServerCmd, but the message goes in the unreliable stream so it can't clog the net stream
// (but it might not get there). // (but it might not get there).
int ( *pfnServerCmdUnreliable )( char *szCmdString ); int ( *pfnServerCmdUnreliable )( const char *szCmdString );
void (*pfnGetMousePos)( struct tagPOINT *ppt ); void (*pfnGetMousePos)( struct tagPOINT *ppt );
void (*pfnSetMousePos)( int x, int y ); void (*pfnSetMousePos)( int x, int y );
void (*pfnSetMouseEnable)( qboolean fEnable ); void (*pfnSetMouseEnable)( qboolean fEnable );
void (*pfnUnused1)( void );
void (*pfnUnused2)( void ); // undocumented interface starts here
void (*pfnUnused3)( void ); struct cvar_s* (*pfnGetFirstCvarPtr)( void );
void (*pfnUnused4)( void ); void* (*pfnGetFirstCmdFunctionHandle)( void );
float (*GetClientOldTime)( void ); void* (*pfnGetNextCmdFunctionHandle)( void *cmdhandle );
float (*pfnGetGravity)( void ); const char* (*pfnGetCmdFunctionName)( void *cmdhandle );
struct model_s*(*pfnGetModelByIndex)( int index ); float (*pfnGetClientOldTime)( void );
void (*pfnUnused5)( void ); float (*pfnGetGravity)( void );
void (*pfnUnused6)( void ); struct model_s* (*pfnGetModelByIndex)( int index );
void (*pfnUnused7)( void ); void (*pfnSetFilterMode)( int mode ); // same as gl_texsort in original Quake
void (*pfnUnused8)( void ); void (*pfnSetFilterColor)( float red, float green, float blue );
void (*pfnUnused9)( void ); void (*pfnSetFilterBrightness)( float brightness );
void (*pfnUnused10)( void ); void *(*pfnSequenceGet)( const char *fileName, const char *entryName );
void (*pfnUnused11)( void ); void (*pfnSPR_DrawGeneric)( int frame, int x, int y, const wrect_t *prc, int blendsrc, int blenddst, int width, int height );
void (*pfnUnused12)( void ); void *(*pfnSequencePickSentence)( const char *groupName, int pickMethod, int *entryPicked );
const char*(*LocalPlayerInfo_ValueForKey)( const char* key ); int (*pfnDrawString)( int x, int y, const char *str, int r, int g, int b );
void (*pfnUnused13)( void ); int (*pfnDrawStringReverse)( int x, int y, const char *str, int r, int g, int b );
void (*pfnUnused14)( void ); const char *(*LocalPlayerInfo_ValueForKey)( const char* key );
void (*pfnUnused15)( void ); int (*pfnVGUI2DrawCharacter)( int x, int y, int ch, unsigned int font );
void (*pfnUnused16)( void ); int (*pfnVGUI2DrawCharacterAdditive)( int x, int y, int ch, int r, int g, int b, unsigned int font );
void (*Cvar_Set)( char *name, char *value ); unsigned int (*pfnGetApproxWavePlayLen)( const char *filename );
void (*pfnUnused17)( void ); void* (*GetCareerGameUI)( void ); // g-cont. !!!! potential crash-point!
void (*pfnUnused18)( void ); void (*Cvar_Set)( const char *name, const char *value );
void (*pfnUnused19)( void ); int (*pfnIsPlayingCareerMatch)( void );
double (*pfnSys_FloatTime)( void ); void (*pfnPlaySoundVoiceByName)( const char *szSound, float volume, int pitch );
void (*pfnUnused20)( void ); void (*pfnPrimeMusicStream)( const char *filename, int looping );
void (*pfnUnused21)( void ); double (*pfnSys_FloatTime)( void );
void (*pfnUnused22)( void );
void (*pfnUnused23)( void ); // decay funcs
void (*pfnFillRGBABlend)( int x, int y, int width, int height, int r, int g, int b, int a ); void (*pfnProcessTutorMessageDecayBuffer)( int *buffer, int buflen );
int (*pfnGetAppID)( void ); void (*pfnConstructTutorMessageDecayBuffer)( int *buffer, int buflen );
void (*pfnUnused24)( void ); void (*pfnResetTutorMessageDecayData)( void );
void (*pfnUnused25)( void );
void (*pfnPlaySoundByNameAtPitch)( const char *szSound, float volume, int pitch );
void (*pfnFillRGBABlend)( int x, int y, int width, int height, int r, int g, int b, int a );
int (*pfnGetAppID)( void );
cmdalias_t *(*pfnGetAliases)( void );
void (*pfnVguiWrap2_GetMouseDelta)( int *x, int *y );
} cl_enginefunc_t; } cl_enginefunc_t;
#define CLDLL_INTERFACE_VERSION 7 #define CLDLL_INTERFACE_VERSION 7
@ -294,4 +307,4 @@ typedef struct cl_enginefuncs_s
} }
#endif #endif
#endif//CDLL_INT_H #endif//CDLL_INT_H

View File

@ -12,7 +12,7 @@
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#pragma once
#ifndef EIFACE_H #ifndef EIFACE_H
#define EIFACE_H #define EIFACE_H
@ -34,22 +34,17 @@
// This is conveniently done for them in extdll.h // This is conveniently done for them in extdll.h
// //
#ifdef _WIN32 #include "exportdef.h"
#define DLLEXPORT __stdcall
#else
#define DLLEXPORT /* */
#endif
#include <alert.h> #include <alert.h>
#define at_debug at_console #define at_debug at_console
// 4-22-98 JOHN: added for use in pfnClientPrintf // 4-22-98 JOHN: added for use in pfnClientPrintf
typedef enum typedef enum
{ {
print_console, print_console,
print_center, print_center,
print_chat, print_chat
} PRINT_TYPE; } PRINT_TYPE;
// For integrity checking of content on clients // For integrity checking of content on clients
@ -58,6 +53,7 @@ typedef enum
force_exactfile, // File on client must exactly match server's file force_exactfile, // File on client must exactly match server's file
force_model_samebounds, // For model files only, the geometry must fit in the same bbox force_model_samebounds, // For model files only, the geometry must fit in the same bbox
force_model_specifybounds, // For model files only, the geometry must fit in the specified bbox force_model_specifybounds, // For model files only, the geometry must fit in the specified bbox
force_model_specifybounds_if_avail // For Steam model files only, the geometry must fit in the specified bbox (if the file is available)
} FORCE_TYPE; } FORCE_TYPE;
// Returned by TraceLine // Returned by TraceLine
@ -72,7 +68,6 @@ typedef struct
float flPlaneDist; float flPlaneDist;
vec3_t vecPlaneNormal; // surface normal at impact vec3_t vecPlaneNormal; // surface normal at impact
edict_t *pHit; // entity the surface is on edict_t *pHit; // entity the surface is on
union union
{ {
int iHitgroup;// 0 == generic, non zero is specific body part int iHitgroup;// 0 == generic, non zero is specific body part
@ -93,18 +88,18 @@ typedef struct
int fPlayTrack; int fPlayTrack;
} CDStatus; } CDStatus;
typedef unsigned long CRC32_t; typedef unsigned int CRC32_t;
// Engine hands this to DLLs for functionality callbacks // Engine hands this to DLLs for functionality callbacks
typedef struct enginefuncs_s typedef struct enginefuncs_s
{ {
int (*pfnPrecacheModel)( const char* s ); int (*pfnPrecacheModel)( const char *s );
int (*pfnPrecacheSound)( const char* s ); int (*pfnPrecacheSound)( const char *s );
void (*pfnSetModel)( edict_t *e, const char *m ); void (*pfnSetModel)( edict_t *e, const char *m );
int (*pfnModelIndex)( const char *m ); int (*pfnModelIndex)( const char *m );
int (*pfnModelFrames)( int modelIndex ); int (*pfnModelFrames)( int modelIndex );
void (*pfnSetSize)( edict_t *e, const float *rgflMin, const float *rgflMax ); void (*pfnSetSize)( edict_t *e, const float *rgflMin, const float *rgflMax );
void (*pfnChangeLevel)( char* s1, char* s2 ); void (*pfnChangeLevel)( const char *s1, const char *s2 );
void (*pfnGetSpawnParms)( edict_t *ent ); void (*pfnGetSpawnParms)( edict_t *ent );
void (*pfnSaveSpawnParms)( edict_t *ent ); void (*pfnSaveSpawnParms)( edict_t *ent );
float (*pfnVecToYaw)( const float *rgflVector ); float (*pfnVecToYaw)( const float *rgflVector );
@ -128,7 +123,7 @@ typedef struct enginefuncs_s
int (*pfnWalkMove)( edict_t *ent, float yaw, float dist, int iMode ); int (*pfnWalkMove)( edict_t *ent, float yaw, float dist, int iMode );
void (*pfnSetOrigin)( edict_t *e, const float *rgflOrigin ); 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 (*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 (*pfnEmitAmbientSound)( edict_t *entity, const 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 (*pfnTraceLine)( const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr );
void (*pfnTraceToss)( edict_t* pent, edict_t* pentToIgnore, 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 ); int (*pfnTraceMonsterHull)( edict_t *pEdict, const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr );
@ -136,12 +131,12 @@ typedef struct enginefuncs_s
void (*pfnTraceModel)( const float *v1, const float *v2, int hullNumber, edict_t *pent, 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 ); 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 (*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 (*pfnGetAimVector)( edict_t *ent, float speed, float *rgflReturn );
void (*pfnServerCommand)( char* str ); void (*pfnServerCommand)( const char *str );
void (*pfnServerExecute)( void ); void (*pfnServerExecute)( void );
void (*pfnClientCommand)( edict_t* pEdict, char* szFmt, ... ); void (*pfnClientCommand)( edict_t* pEdict, const char *szFmt, ... );
void (*pfnParticleEffect)( const float *org, const float *dir, float color, float count ); void (*pfnParticleEffect)( const float *org, const float *dir, float color, float count );
void (*pfnLightStyle)( int style, char* val ); void (*pfnLightStyle)( int style, const char *val );
int (*pfnDecalIndex)( const char *name ); int (*pfnDecalIndex)( const char *name );
int (*pfnPointContents)( const float *rgflVector ); int (*pfnPointContents)( const float *rgflVector );
void (*pfnMessageBegin)( int msg_dest, int msg_type, const float *pOrigin, edict_t *ed ); void (*pfnMessageBegin)( int msg_dest, int msg_type, const float *pOrigin, edict_t *ed );
@ -159,9 +154,9 @@ typedef struct enginefuncs_s
const char* (*pfnCVarGetString)( const char *szVarName ); const char* (*pfnCVarGetString)( const char *szVarName );
void (*pfnCVarSetFloat)( const char *szVarName, float flValue ); void (*pfnCVarSetFloat)( const char *szVarName, float flValue );
void (*pfnCVarSetString)( const char *szVarName, const char *szValue ); void (*pfnCVarSetString)( const char *szVarName, const char *szValue );
void (*pfnAlertMessage)( ALERT_TYPE atype, char *szFmt, ... ); void (*pfnAlertMessage)( ALERT_TYPE atype, const char *szFmt, ... );
void (*pfnEngineFprintf)( FILE *pfile, char *szFmt, ... ); void (*pfnEngineFprintf)( FILE *pfile, const char *szFmt, ... );
void* (*pfnPvAllocEntPrivateData)( edict_t *pEdict, long cb ); void* (*pfnPvAllocEntPrivateData)( edict_t *pEdict, int cb );
void* (*pfnPvEntPrivateData)( edict_t *pEdict ); void* (*pfnPvEntPrivateData)( edict_t *pEdict );
void (*pfnFreeEntPrivateData)( edict_t *pEdict ); void (*pfnFreeEntPrivateData)( edict_t *pEdict );
const char *(*pfnSzFromIndex)( int iString ); const char *(*pfnSzFromIndex)( int iString );
@ -176,8 +171,8 @@ typedef struct enginefuncs_s
int (*pfnRegUserMsg)( const char *pszName, int iSize ); int (*pfnRegUserMsg)( const char *pszName, int iSize );
void (*pfnAnimationAutomove)( const edict_t* pEdict, float flTime ); void (*pfnAnimationAutomove)( const edict_t* pEdict, float flTime );
void (*pfnGetBonePosition)( const edict_t* pEdict, int iBone, float *rgflOrigin, float *rgflAngles ); void (*pfnGetBonePosition)( const edict_t* pEdict, int iBone, float *rgflOrigin, float *rgflAngles );
unsigned long (*pfnFunctionFromName)( const char *pName ); void* (*pfnFunctionFromName)( const char *pName );
const char *(*pfnNameForFunction)( unsigned long function ); const char *(*pfnNameForFunction)( void *function );
void (*pfnClientPrintf)( edict_t* pEdict, PRINT_TYPE ptype, const char *szMsg ); // JOHN: engine callbacks so game DLL can print messages to individual clients void (*pfnClientPrintf)( edict_t* pEdict, PRINT_TYPE ptype, const char *szMsg ); // JOHN: engine callbacks so game DLL can print messages to individual clients
void (*pfnServerPrint)( const char *szMsg ); void (*pfnServerPrint)( const char *szMsg );
const char *(*pfnCmd_Args)( void ); // these 3 added const char *(*pfnCmd_Args)( void ); // these 3 added
@ -188,7 +183,7 @@ typedef struct enginefuncs_s
void (*pfnCRC32_ProcessBuffer)( CRC32_t *pulCRC, void *p, int len ); void (*pfnCRC32_ProcessBuffer)( CRC32_t *pulCRC, void *p, int len );
void (*pfnCRC32_ProcessByte)( CRC32_t *pulCRC, unsigned char ch ); void (*pfnCRC32_ProcessByte)( CRC32_t *pulCRC, unsigned char ch );
CRC32_t (*pfnCRC32_Final)( CRC32_t pulCRC ); CRC32_t (*pfnCRC32_Final)( CRC32_t pulCRC );
long (*pfnRandomLong)( long lLow, long lHigh ); int (*pfnRandomLong)( int lLow, int lHigh );
float (*pfnRandomFloat)( float flLow, float flHigh ); float (*pfnRandomFloat)( float flLow, float flHigh );
void (*pfnSetView)( const edict_t *pClient, const edict_t *pViewent ); void (*pfnSetView)( const edict_t *pClient, const edict_t *pViewent );
float (*pfnTime)( void ); float (*pfnTime)( void );
@ -205,10 +200,10 @@ typedef struct enginefuncs_s
void (*pfnRunPlayerMove)( edict_t *fakeclient, const float *viewangles, float forwardmove, float sidemove, float upmove, unsigned short buttons, byte impulse, byte msec ); void (*pfnRunPlayerMove)( edict_t *fakeclient, const float *viewangles, float forwardmove, float sidemove, float upmove, unsigned short buttons, byte impulse, byte msec );
int (*pfnNumberOfEntities)( void ); int (*pfnNumberOfEntities)( void );
char* (*pfnGetInfoKeyBuffer)( edict_t *e ); // passing in NULL gets the serverinfo char* (*pfnGetInfoKeyBuffer)( edict_t *e ); // passing in NULL gets the serverinfo
char* (*pfnInfoKeyValue)( char *infobuffer, char *key ); char* (*pfnInfoKeyValue)( char *infobuffer, const char *key );
void (*pfnSetKeyValue)( char *infobuffer, char *key, char *value ); void (*pfnSetKeyValue)( char *infobuffer, const char *key, const char *value );
void (*pfnSetClientKeyValue)( int clientIndex, char *infobuffer, char *key, char *value ); void (*pfnSetClientKeyValue)( int clientIndex, char *infobuffer, const char *key, const char *value );
int (*pfnIsMapValid)( char *filename ); int (*pfnIsMapValid)( const char *filename );
void (*pfnStaticDecal)( const float *origin, int decalIndex, int entityIndex, int modelIndex ); void (*pfnStaticDecal)( const float *origin, int decalIndex, int entityIndex, int modelIndex );
int (*pfnPrecacheGeneric)( const char *s ); int (*pfnPrecacheGeneric)( const char *s );
int (*pfnGetPlayerUserId)( edict_t *e ); // returns the server assigned userid for this player. useful for logging frags, etc. returns -1 if the edict couldn't be found in the list of clients int (*pfnGetPlayerUserId)( edict_t *e ); // returns the server assigned userid for this player. useful for logging frags, etc. returns -1 if the edict couldn't be found in the list of clients
@ -223,16 +218,16 @@ typedef struct enginefuncs_s
void (*pfnSetPhysicsKeyValue)( const edict_t *pClient, const char *key, const char *value ); void (*pfnSetPhysicsKeyValue)( const edict_t *pClient, const char *key, const char *value );
const char *(*pfnGetPhysicsInfoString)( const edict_t *pClient ); const char *(*pfnGetPhysicsInfoString)( const edict_t *pClient );
unsigned short (*pfnPrecacheEvent)( int type, const char*psz ); 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 ); void (*pfnPlaybackEvent)( int flags, const edict_t *pInvoker, unsigned short eventindex, float delay, const float *origin, const float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 );
unsigned char *(*pfnSetFatPVS)( float *org ); unsigned char *(*pfnSetFatPVS)( const float *org );
unsigned char *(*pfnSetFatPAS)( float *org ); unsigned char *(*pfnSetFatPAS)( const float *org );
int (*pfnCheckVisibility )( const edict_t *entity, unsigned char *pset ); int (*pfnCheckVisibility )( const edict_t *entity, unsigned char *pset );
void (*pfnDeltaSetField) ( struct delta_s *pFields, const char *fieldname ); void (*pfnDeltaSetField) ( struct delta_s *pFields, const char *fieldname );
void (*pfnDeltaUnsetField)( 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 ) ); void (*pfnDeltaAddEncoder)( const char *name, void (*conditionalencode)( struct delta_s *pFields, const unsigned char *from, const unsigned char *to ) );
int (*pfnGetCurrentPlayer)( void ); int (*pfnGetCurrentPlayer)( void );
int (*pfnCanSkipPlayer)( const edict_t *player ); int (*pfnCanSkipPlayer)( const edict_t *player );
int (*pfnDeltaFindField)( struct delta_s *pFields, const char *fieldname ); int (*pfnDeltaFindField)( struct delta_s *pFields, const char *fieldname );
@ -240,16 +235,16 @@ typedef struct enginefuncs_s
void (*pfnDeltaUnsetFieldByIndex)( struct delta_s *pFields, int fieldNumber ); void (*pfnDeltaUnsetFieldByIndex)( struct delta_s *pFields, int fieldNumber );
void (*pfnSetGroupMask)( int mask, int op ); void (*pfnSetGroupMask)( int mask, int op );
int (*pfnCreateInstancedBaseline)( int classname, struct entity_state_s *baseline ); int (*pfnCreateInstancedBaseline)( int classname, struct entity_state_s *baseline );
void (*pfnCvar_DirectSet)( struct cvar_s *var, char *value ); void (*pfnCvar_DirectSet)( struct cvar_s *var, const char *value );
// Forces the client and server to be running with the same version of the specified file // Forces the client and server to be running with the same version of the specified file
// ( e.g., a player model ). // ( e.g., a player model ).
// Calling this has no effect in single player // Calling this has no effect in single player
void (*pfnForceUnmodified)( FORCE_TYPE type, float *mins, float *maxs, const char *filename ); void (*pfnForceUnmodified)( FORCE_TYPE type, const float *mins, const float *maxs, const char *filename );
void (*pfnGetPlayerStats)( const edict_t *pClient, int *ping, int *packet_loss ); void (*pfnGetPlayerStats)( const edict_t *pClient, int *ping, int *packet_loss );
void (*pfnAddServerCommand)( char *cmd_name, void (*function) (void) ); void (*pfnAddServerCommand)( const char *cmd_name, void (*function) (void) );
// For voice communications, set which clients hear eachother. // For voice communications, set which clients hear eachother.
// NOTE: these functions take player entity indices (starting at 1). // NOTE: these functions take player entity indices (starting at 1).
@ -257,16 +252,31 @@ typedef struct enginefuncs_s
qboolean (*pfnVoice_SetClientListening)(int iReceiver, int iSender, qboolean bListen); qboolean (*pfnVoice_SetClientListening)(int iReceiver, int iSender, qboolean bListen);
const char *(*pfnGetPlayerAuthId) ( edict_t *e ); const char *(*pfnGetPlayerAuthId) ( edict_t *e );
void *(*pfnSequenceGet)( const char *fileName, const char *entryName );
void *(*pfnSequencePickSentence)( const char *groupName, int pickMethod, int *picked );
int (*pfnGetFileSize)( const char *filename );
unsigned int (*pfnGetApproxWavePlayLen)( const char *filepath );
int (*pfnIsCareerMatch)( void );
int (*pfnGetLocalizedStringLength)( const char *label );
void (*pfnRegisterTutorMessageShown)( int mid );
int (*pfnGetTimesTutorMessageShown)( int mid );
void (*pfnProcessTutorMessageDecayBuffer)( int *buffer, int bufferLength );
void (*pfnConstructTutorMessageDecayBuffer)( int *buffer, int bufferLength );
void (*pfnResetTutorMessageDecayData)( void );
void (*pfnQueryClientCvarValue)( const edict_t *player, const char *cvarName );
void (*pfnQueryClientCvarValue2)( const edict_t *player, const char *cvarName, int requestID );
int (*CheckParm)( char *parm, char **ppnext );
} enginefuncs_t; } enginefuncs_t;
// ONLY ADD NEW FUNCTIONS TO THE END OF THIS STRUCT. INTERFACE VERSION IS FROZEN AT 138 // ONLY ADD NEW FUNCTIONS TO THE END OF THIS STRUCT. INTERFACE VERSION IS FROZEN AT 138
// Passed to pfnKeyValue // Passed to pfnKeyValue
typedef struct KeyValueData_s typedef struct KeyValueData_s
{ {
char *szClassName; // in: entity classname const char *szClassName; // in: entity classname
char *szKeyName; // in: name of key const char *szKeyName; // in: name of key
char *szValue; // in: value of key const char *szValue; // in: value of key
long fHandled; // out: DLL sets to true if key-value pair was understood int fHandled; // out: DLL sets to true if key-value pair was understood
} KeyValueData; } KeyValueData;
@ -340,12 +350,11 @@ typedef enum _fieldtypes
FIELD_TIME, // a floating point time (these are fixed up automatically too!) FIELD_TIME, // a floating point time (these are fixed up automatically too!)
FIELD_MODELNAME, // Engine string that is a model name (needs precache) FIELD_MODELNAME, // Engine string that is a model name (needs precache)
FIELD_SOUNDNAME, // Engine string that is a sound name (needs precache) FIELD_SOUNDNAME, // Engine string that is a sound name (needs precache)
FIELD_RANGE, // Min and Max range for generate random value
FIELD_TYPECOUNT, // MUST BE LAST FIELD_TYPECOUNT // MUST BE LAST
} FIELDTYPE; } FIELDTYPE;
#ifndef offsetof #if !defined(offsetof) && !defined(__GNUC__)
#define offsetof(s,m) (size_t)&(((s *)0)->m) #define offsetof(s,m) (size_t)&(((s *)0)->m)
#endif #endif
@ -364,12 +373,16 @@ typedef enum _fieldtypes
typedef struct typedef struct
{ {
FIELDTYPE fieldType; FIELDTYPE fieldType;
char *fieldName; const char *fieldName;
int fieldOffset; int fieldOffset;
short fieldSize; short fieldSize;
short flags; short flags;
} TYPEDESCRIPTION; } TYPEDESCRIPTION;
#ifndef ARRAYSIZE
#define ARRAYSIZE(p) (sizeof(p)/sizeof(p[0]))
#endif
typedef struct typedef struct
{ {
// Initialize/shutdown the game (one-time call after loading of game .dll ) // Initialize/shutdown the game (one-time call after loading of game .dll )
@ -422,7 +435,7 @@ typedef struct
void (*pfnPM_Move)( struct playermove_s *ppmove, qboolean server ); void (*pfnPM_Move)( struct playermove_s *ppmove, qboolean server );
void (*pfnPM_Init)( struct playermove_s *ppmove ); void (*pfnPM_Init)( struct playermove_s *ppmove );
char (*pfnPM_FindTextureType)( char *name ); char (*pfnPM_FindTextureType)( const char *name );
void (*pfnSetupVisibility)( struct edict_s *pViewEntity, struct edict_s *pClient, unsigned char **pvs, unsigned char **pas ); void (*pfnSetupVisibility)( struct edict_s *pViewEntity, struct edict_s *pClient, unsigned char **pvs, unsigned char **pas );
void (*pfnUpdateClientData) ( const struct edict_s *ent, int sendweapons, struct clientdata_s *cd ); void (*pfnUpdateClientData) ( const struct edict_s *ent, int sendweapons, struct clientdata_s *cd );
int (*pfnAddToFullPack)( struct entity_state_s *state, int e, edict_t *ent, edict_t *host, int hostflags, int player, unsigned char *pSet ); int (*pfnAddToFullPack)( struct entity_state_s *state, int e, edict_t *ent, edict_t *host, int hostflags, int player, unsigned char *pSet );
@ -466,6 +479,8 @@ typedef struct
void (*pfnOnFreeEntPrivateData)( edict_t *pEnt ); void (*pfnOnFreeEntPrivateData)( edict_t *pEnt );
void (*pfnGameShutdown)(void); void (*pfnGameShutdown)(void);
int (*pfnShouldCollide)( edict_t *pentTouched, edict_t *pentOther ); int (*pfnShouldCollide)( edict_t *pentTouched, edict_t *pentOther );
void (*pfnCvarValue)( const edict_t *pEnt, const char *value );
void (*pfnCvarValue2)( const edict_t *pEnt, int requestID, const char *cvarName, const char *value );
} NEW_DLL_FUNCTIONS; } NEW_DLL_FUNCTIONS;
typedef int (*NEW_DLL_FUNCTIONS_FN)( NEW_DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion ); typedef int (*NEW_DLL_FUNCTIONS_FN)( NEW_DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion );
@ -475,4 +490,4 @@ extern NEW_DLL_FUNCTIONS gNewDLLFunctions;
typedef int (*APIFUNCTION)( DLL_FUNCTIONS *pFunctionTable, int interfaceVersion ); typedef int (*APIFUNCTION)( DLL_FUNCTIONS *pFunctionTable, int interfaceVersion );
typedef int (*APIFUNCTION2)( DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion ); typedef int (*APIFUNCTION2)( DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion );
#endif//EIFACE_H #endif//EIFACE_H