From c1948b0f89be241524e4df8cc087ea431fe30d01 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Mon, 31 Aug 2020 20:29:36 +0300 Subject: [PATCH] engine: import headers from hlsdk-xash3d, fixes missing const modifiers --- cl_dll/cl_dll.h | 3 +- engine/cdll_int.h | 141 +++++++++++++++++++++++++--------------------- engine/eiface.h | 109 +++++++++++++++++++---------------- 3 files changed, 140 insertions(+), 113 deletions(-) diff --git a/cl_dll/cl_dll.h b/cl_dll/cl_dll.h index 2e35b91..ad7fe18 100644 --- a/cl_dll/cl_dll.h +++ b/cl_dll/cl_dll.h @@ -30,7 +30,6 @@ typedef unsigned short word; typedef int (*pfnUserMsgHook)(const char *pszName, int iSize, void *pbuf); #include -#define EXPORT _declspec( dllexport ) #include "../engine/cdll_int.h" #include "cdll_dll.h" @@ -46,4 +45,4 @@ bool GL_Init( void ); void GL_MapChanged( void ); void GL_Shutdown( void ); bool GL_Support( int r_ext ); -void R_VidInit( void ); \ No newline at end of file +void R_VidInit( void ); diff --git a/engine/cdll_int.h b/engine/cdll_int.h index 749e0c5..ea4803a 100644 --- a/engine/cdll_int.h +++ b/engine/cdll_int.h @@ -18,7 +18,7 @@ // 4-23-98 // JOHN: client dll interface declarations // - +#pragma once #ifndef CDLL_INT_H #define CDLL_INT_H @@ -89,6 +89,12 @@ typedef struct client_textmessage_s const char *pMessage; } 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 { char *name; @@ -101,6 +107,8 @@ typedef struct hud_player_info_s char *model; short topcolor; short bottomcolor; + + ulonglong_t m_nSteamID; } hud_player_info_t; 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_EnableScissor)( int x, int y, int width, int height ); 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 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 ); // cvar handlers - struct cvar_s *(*pfnRegisterVariable)( char *szName, char *szValue, int flags ); - float (*pfnGetCvarFloat)( char *szName ); - char* (*pfnGetCvarString)( char *szName ); + struct cvar_s *(*pfnRegisterVariable)( const char *szName, const char *szValue, int flags ); + float (*pfnGetCvarFloat)( const char *szName ); + char* (*pfnGetCvarString)( const char *szName ); // command handlers - int (*pfnAddCommand)( char *cmd_name, void (*function)(void) ); - int (*pfnHookUserMsg)( char *szMsgName, pfnUserMsgHook pfn ); - int (*pfnServerCmd)( char *szCmdString ); - int (*pfnClientCmd)( char *szCmdString ); + int (*pfnAddCommand)( const char *cmd_name, void (*function)(void) ); + int (*pfnHookUserMsg)( const char *szMsgName, pfnUserMsgHook pfn ); + int (*pfnServerCmd)( const char *szCmdString ); + int (*pfnClientCmd)( const char *szCmdString ); void (*pfnGetPlayerInfo)( int ent_num, hud_player_info_t *pinfo ); // sound handlers - void (*pfnPlaySoundByName)( char *szSound, float volume ); + void (*pfnPlaySoundByName)( const char *szSound, float volume ); void (*pfnPlaySoundByIndex)( int iSound, float volume ); // vector helpers @@ -146,7 +154,7 @@ typedef struct cl_enginefuncs_s // text message system client_textmessage_t *(*pfnTextMessageGet)( const char *pName ); 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 (*pfnDrawConsoleStringLen)( const char *string, int *length, int *height ); @@ -157,21 +165,21 @@ typedef struct cl_enginefuncs_s int (*GetWindowCenterX)( void ); int (*GetWindowCenterY)( void ); void (*GetViewAngles)( float * ); - void (*SetViewAngles)( float * ); + void (*SetViewAngles)( const float * ); int (*GetMaxClients)( void ); - void (*Cvar_SetValue)( char *cvar, float value ); + void (*Cvar_SetValue)( const char *cvar, float value ); int (*Cmd_Argc)( void ); char *(*Cmd_Argv)( int arg ); - void (*Con_Printf)( char *fmt, ... ); - void (*Con_DPrintf)( char *fmt, ... ); - void (*Con_NPrintf)( int pos, char *fmt, ... ); - void (*Con_NXPrintf)( struct con_nprint_s *info, char *fmt, ... ); + void (*Con_Printf)( const char *fmt, ... ); + void (*Con_DPrintf)( const char *fmt, ... ); + void (*Con_NPrintf)( int pos, const char *fmt, ... ); + void (*Con_NXPrintf)( struct con_nprint_s *info, const char *fmt, ... ); const char* (*PhysInfo_ValueForKey)( const char *key ); const char* (*ServerInfo_ValueForKey)( const char *key ); 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 (*GetMousePosition)( int *mx, int *my ); @@ -183,24 +191,24 @@ typedef struct cl_enginefuncs_s float (*GetClientTime)( 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_WaterEntity)( float *p ); - struct pmtrace_s *(*PM_TraceLine)( float *start, float *end, int flags, int usehull, int ignore_pe ); + int (*PM_PointContents)( const float *point, int *truecontents ); + int (*PM_WaterEntity)( const float *p ); + 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 ); int (*CL_CreateVisibleEntity)( int type, struct cl_entity_s *ent ); 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 ); - 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 ); float (*pfnRandomFloat)( float flLow, float flHigh ); - long (*pfnRandomLong)( long lLow, long lHigh ); - void (*pfnHookEvent)( char *name, void ( *pfnEvent )( struct event_args_s *args )); + int (*pfnRandomLong)( int lLow, int lHigh ); + void (*pfnHookEvent)( const char *name, void ( *pfnEvent )( struct event_args_s *args )); int (*Con_IsVisible) (); const char *(*pfnGetGameDirectory)( void ); struct cvar_s *(*pfnGetCvarPointer)( const char *szName ); @@ -211,8 +219,8 @@ typedef struct cl_enginefuncs_s void* (*VGui_GetPanel)( ); void (*VGui_ViewportPaintBackground)( int extents[4] ); - byte* (*COM_LoadFile)( char *path, int usehunk, int *pLength ); - char* (*COM_ParseFile)( char *data, char *token ); + byte* (*COM_LoadFile)( const char *path, int usehunk, int *pLength ); + char* (*COM_ParseFile)( const char *data, const char *token ); void (*COM_FreeFile)( void *buffer ); 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. // 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. - qboolean (*GetPlayerUniqueID)(int iPlayer, char playerID[16]); + qboolean (*GetPlayerUniqueID)(int iPlayer, const char playerID[16]); // TrackerID access 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 // (but it might not get there). - int ( *pfnServerCmdUnreliable )( char *szCmdString ); + int ( *pfnServerCmdUnreliable )( const char *szCmdString ); void (*pfnGetMousePos)( struct tagPOINT *ppt ); void (*pfnSetMousePos)( int x, int y ); void (*pfnSetMouseEnable)( qboolean fEnable ); - void (*pfnUnused1)( void ); - void (*pfnUnused2)( void ); - void (*pfnUnused3)( void ); - void (*pfnUnused4)( void ); - float (*GetClientOldTime)( void ); - float (*pfnGetGravity)( void ); - struct model_s*(*pfnGetModelByIndex)( int index ); - void (*pfnUnused5)( void ); - void (*pfnUnused6)( void ); - void (*pfnUnused7)( void ); - void (*pfnUnused8)( void ); - void (*pfnUnused9)( void ); - void (*pfnUnused10)( void ); - void (*pfnUnused11)( void ); - void (*pfnUnused12)( void ); - const char*(*LocalPlayerInfo_ValueForKey)( const char* key ); - void (*pfnUnused13)( void ); - void (*pfnUnused14)( void ); - void (*pfnUnused15)( void ); - void (*pfnUnused16)( void ); - void (*Cvar_Set)( char *name, char *value ); - void (*pfnUnused17)( void ); - void (*pfnUnused18)( void ); - void (*pfnUnused19)( void ); - double (*pfnSys_FloatTime)( void ); - void (*pfnUnused20)( void ); - void (*pfnUnused21)( void ); - void (*pfnUnused22)( void ); - void (*pfnUnused23)( void ); - void (*pfnFillRGBABlend)( int x, int y, int width, int height, int r, int g, int b, int a ); - int (*pfnGetAppID)( void ); - void (*pfnUnused24)( void ); - void (*pfnUnused25)( void ); + + // undocumented interface starts here + struct cvar_s* (*pfnGetFirstCvarPtr)( void ); + void* (*pfnGetFirstCmdFunctionHandle)( void ); + void* (*pfnGetNextCmdFunctionHandle)( void *cmdhandle ); + const char* (*pfnGetCmdFunctionName)( void *cmdhandle ); + float (*pfnGetClientOldTime)( void ); + float (*pfnGetGravity)( void ); + struct model_s* (*pfnGetModelByIndex)( int index ); + void (*pfnSetFilterMode)( int mode ); // same as gl_texsort in original Quake + void (*pfnSetFilterColor)( float red, float green, float blue ); + void (*pfnSetFilterBrightness)( float brightness ); + void *(*pfnSequenceGet)( const char *fileName, const char *entryName ); + void (*pfnSPR_DrawGeneric)( int frame, int x, int y, const wrect_t *prc, int blendsrc, int blenddst, int width, int height ); + void *(*pfnSequencePickSentence)( const char *groupName, int pickMethod, int *entryPicked ); + int (*pfnDrawString)( int x, int y, const char *str, int r, int g, int b ); + int (*pfnDrawStringReverse)( int x, int y, const char *str, int r, int g, int b ); + const char *(*LocalPlayerInfo_ValueForKey)( const char* key ); + int (*pfnVGUI2DrawCharacter)( int x, int y, int ch, unsigned int font ); + int (*pfnVGUI2DrawCharacterAdditive)( int x, int y, int ch, int r, int g, int b, unsigned int font ); + unsigned int (*pfnGetApproxWavePlayLen)( const char *filename ); + void* (*GetCareerGameUI)( void ); // g-cont. !!!! potential crash-point! + void (*Cvar_Set)( const char *name, const char *value ); + int (*pfnIsPlayingCareerMatch)( void ); + void (*pfnPlaySoundVoiceByName)( const char *szSound, float volume, int pitch ); + void (*pfnPrimeMusicStream)( const char *filename, int looping ); + double (*pfnSys_FloatTime)( void ); + + // decay funcs + void (*pfnProcessTutorMessageDecayBuffer)( int *buffer, int buflen ); + void (*pfnConstructTutorMessageDecayBuffer)( int *buffer, int buflen ); + void (*pfnResetTutorMessageDecayData)( 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; #define CLDLL_INTERFACE_VERSION 7 @@ -294,4 +307,4 @@ typedef struct cl_enginefuncs_s } #endif -#endif//CDLL_INT_H \ No newline at end of file +#endif//CDLL_INT_H diff --git a/engine/eiface.h b/engine/eiface.h index 3ef76de..f2194a8 100644 --- a/engine/eiface.h +++ b/engine/eiface.h @@ -12,7 +12,7 @@ * without written permission from Valve LLC. * ****/ - +#pragma once #ifndef EIFACE_H #define EIFACE_H @@ -34,22 +34,17 @@ // This is conveniently done for them in extdll.h // -#ifdef _WIN32 -#define DLLEXPORT __stdcall -#else -#define DLLEXPORT /* */ -#endif - +#include "exportdef.h" #include -#define at_debug at_console +#define at_debug at_console // 4-22-98 JOHN: added for use in pfnClientPrintf typedef enum { print_console, print_center, - print_chat, + print_chat } PRINT_TYPE; // 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_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_if_avail // For Steam model files only, the geometry must fit in the specified bbox (if the file is available) } FORCE_TYPE; // Returned by TraceLine @@ -72,7 +68,6 @@ typedef struct float flPlaneDist; vec3_t vecPlaneNormal; // surface normal at impact edict_t *pHit; // entity the surface is on - union { int iHitgroup;// 0 == generic, non zero is specific body part @@ -93,18 +88,18 @@ typedef struct int fPlayTrack; } CDStatus; -typedef unsigned long CRC32_t; +typedef unsigned int CRC32_t; // Engine hands this to DLLs for functionality callbacks typedef struct enginefuncs_s { - int (*pfnPrecacheModel)( const char* s ); - int (*pfnPrecacheSound)( const char* s ); + 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)( char* s1, char* s2 ); + void (*pfnChangeLevel)( const char *s1, const char *s2 ); void (*pfnGetSpawnParms)( edict_t *ent ); void (*pfnSaveSpawnParms)( edict_t *ent ); float (*pfnVecToYaw)( const float *rgflVector ); @@ -128,7 +123,7 @@ typedef struct enginefuncs_s 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 (*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 (*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 ); @@ -136,12 +131,12 @@ typedef struct enginefuncs_s 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 (*pfnGetAimVector)( edict_t *ent, float speed, float *rgflReturn ); + void (*pfnServerCommand)( const char *str ); 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 (*pfnLightStyle)( int style, char* val ); + 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 ); @@ -159,9 +154,9 @@ typedef struct enginefuncs_s 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, ... ); - void* (*pfnPvAllocEntPrivateData)( edict_t *pEdict, long cb ); + void (*pfnAlertMessage)( ALERT_TYPE atype, const char *szFmt, ... ); + void (*pfnEngineFprintf)( FILE *pfile, const char *szFmt, ... ); + void* (*pfnPvAllocEntPrivateData)( edict_t *pEdict, int cb ); void* (*pfnPvEntPrivateData)( edict_t *pEdict ); void (*pfnFreeEntPrivateData)( edict_t *pEdict ); const char *(*pfnSzFromIndex)( int iString ); @@ -176,8 +171,8 @@ typedef struct enginefuncs_s 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 ); - unsigned long (*pfnFunctionFromName)( const char *pName ); - const char *(*pfnNameForFunction)( unsigned long function ); + void* (*pfnFunctionFromName)( const char *pName ); + 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 (*pfnServerPrint)( const char *szMsg ); 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_ProcessByte)( CRC32_t *pulCRC, unsigned char ch ); 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 ); void (*pfnSetView)( const edict_t *pClient, const edict_t *pViewent ); 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 ); int (*pfnNumberOfEntities)( void ); char* (*pfnGetInfoKeyBuffer)( edict_t *e ); // passing in NULL gets the serverinfo - 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 ); + 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 ); // 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 ); 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 ); + 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)( const float *org ); + unsigned char *(*pfnSetFatPAS)( const 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 ) ); + 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 ); @@ -240,16 +235,16 @@ typedef struct enginefuncs_s 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 (*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 // ( e.g., a player model ). // 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 (*pfnAddServerCommand)( char *cmd_name, void (*function) (void) ); + void (*pfnAddServerCommand)( const char *cmd_name, void (*function) (void) ); // For voice communications, set which clients hear eachother. // 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); 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; // ONLY ADD NEW FUNCTIONS TO THE END OF THIS STRUCT. INTERFACE VERSION IS FROZEN AT 138 // Passed to pfnKeyValue typedef struct KeyValueData_s { - char *szClassName; // in: entity classname - char *szKeyName; // in: name of key - char *szValue; // in: value of key - long fHandled; // out: DLL sets to true if key-value pair was understood + const char *szClassName; // in: entity classname + const char *szKeyName; // in: name of key + const char *szValue; // in: value of key + int fHandled; // out: DLL sets to true if key-value pair was understood } KeyValueData; @@ -340,12 +350,11 @@ typedef enum _fieldtypes FIELD_TIME, // a floating point time (these are fixed up automatically too!) FIELD_MODELNAME, // Engine string that is a model 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; -#ifndef offsetof +#if !defined(offsetof) && !defined(__GNUC__) #define offsetof(s,m) (size_t)&(((s *)0)->m) #endif @@ -364,12 +373,16 @@ typedef enum _fieldtypes typedef struct { FIELDTYPE fieldType; - char *fieldName; + const char *fieldName; int fieldOffset; short fieldSize; short flags; } TYPEDESCRIPTION; +#ifndef ARRAYSIZE +#define ARRAYSIZE(p) (sizeof(p)/sizeof(p[0])) +#endif + typedef struct { // 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_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 (*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 ); @@ -466,6 +479,8 @@ typedef struct void (*pfnOnFreeEntPrivateData)( edict_t *pEnt ); void (*pfnGameShutdown)(void); 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; 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 (*APIFUNCTION2)( DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion ); -#endif//EIFACE_H \ No newline at end of file +#endif//EIFACE_H