2008-12-25 22:00:00 +01:00
|
|
|
|
//=======================================================================
|
|
|
|
|
// Copyright XashXT Group 2008 <20>
|
2010-08-20 22:00:00 +02:00
|
|
|
|
// cdll_int.h - client dll interface declarations
|
2008-12-25 22:00:00 +01:00
|
|
|
|
//=======================================================================
|
2010-08-20 22:00:00 +02:00
|
|
|
|
#ifndef CDLL_INT_H
|
|
|
|
|
#define CDLL_INT_H
|
2008-12-25 22:00:00 +01:00
|
|
|
|
|
2010-08-20 22:00:00 +02:00
|
|
|
|
typedef int HSPRITE; // handle to a graphic
|
|
|
|
|
typedef int (*pfnUserMsgHook)( const char *pszName, int iSize, void *pbuf );
|
2008-12-25 22:00:00 +01:00
|
|
|
|
|
2010-07-20 22:00:00 +02:00
|
|
|
|
#include "wrect.h"
|
2010-10-22 22:00:00 +02:00
|
|
|
|
#include "cvardef.h"
|
2010-07-20 22:00:00 +02:00
|
|
|
|
|
2010-08-20 22:00:00 +02:00
|
|
|
|
#define SCRINFO_SCREENFLASH 1
|
|
|
|
|
#define SCRINFO_STRETCHED 2
|
2010-07-20 22:00:00 +02:00
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
2010-08-20 22:00:00 +02:00
|
|
|
|
int iSize;
|
2010-07-20 22:00:00 +02:00
|
|
|
|
int iWidth;
|
|
|
|
|
int iHeight;
|
2010-08-20 22:00:00 +02:00
|
|
|
|
int iFlags;
|
2010-07-20 22:00:00 +02:00
|
|
|
|
int iCharHeight;
|
|
|
|
|
byte charWidths[256];
|
|
|
|
|
} SCREENINFO;
|
2009-11-02 22:00:00 +01:00
|
|
|
|
|
2010-08-07 22:00:00 +02:00
|
|
|
|
typedef struct client_data_s
|
|
|
|
|
{
|
|
|
|
|
// fields that cannot be modified (ie. have no effect if changed)
|
|
|
|
|
vec3_t origin;
|
|
|
|
|
|
|
|
|
|
// fields that can be changed by the cldll
|
|
|
|
|
vec3_t viewangles;
|
|
|
|
|
int iWeaponBits;
|
|
|
|
|
float fov; // field of view
|
|
|
|
|
} client_data_t;
|
|
|
|
|
|
2009-11-02 22:00:00 +01:00
|
|
|
|
typedef struct client_sprite_s
|
|
|
|
|
{
|
|
|
|
|
char szName[64];
|
|
|
|
|
char szSprite[64];
|
|
|
|
|
HSPRITE hSprite;
|
|
|
|
|
int iRes;
|
|
|
|
|
wrect_t rc;
|
|
|
|
|
} client_sprite_t;
|
|
|
|
|
|
2010-08-20 22:00:00 +02:00
|
|
|
|
typedef struct client_textmessage_s
|
|
|
|
|
{
|
|
|
|
|
int effect;
|
|
|
|
|
byte r1, g1, b1, a1; // 2 colors for effects
|
|
|
|
|
byte r2, g2, b2, a2;
|
|
|
|
|
float x;
|
|
|
|
|
float y;
|
|
|
|
|
float fadein;
|
|
|
|
|
float fadeout;
|
|
|
|
|
float holdtime;
|
|
|
|
|
float fxtime;
|
|
|
|
|
const char *pName;
|
|
|
|
|
const char *pMessage;
|
|
|
|
|
} client_textmessage_t;
|
2009-09-28 22:00:00 +02:00
|
|
|
|
|
2010-08-20 22:00:00 +02:00
|
|
|
|
// hud_player_info_t formed from player_info_t
|
|
|
|
|
typedef struct hud_player_info_s
|
|
|
|
|
{
|
|
|
|
|
char *name;
|
|
|
|
|
short ping;
|
|
|
|
|
byte thisplayer; // TRUE if this is the calling player
|
2010-03-07 22:00:00 +01:00
|
|
|
|
|
2010-08-20 22:00:00 +02:00
|
|
|
|
byte spectator;
|
|
|
|
|
byte packetloss;
|
|
|
|
|
const char *model;
|
|
|
|
|
short topcolor;
|
|
|
|
|
short bottomcolor;
|
|
|
|
|
} hud_player_info_t;
|
2009-09-28 22:00:00 +02:00
|
|
|
|
|
2008-12-25 22:00:00 +01:00
|
|
|
|
typedef struct cl_enginefuncs_s
|
|
|
|
|
{
|
2009-12-03 22:00:00 +01:00
|
|
|
|
// sprite handlers
|
|
|
|
|
HSPRITE (*pfnSPR_Load)( const char *szPicName );
|
|
|
|
|
int (*pfnSPR_Frames)( HSPRITE hPic );
|
|
|
|
|
int (*pfnSPR_Height)( HSPRITE hPic, int frame );
|
|
|
|
|
int (*pfnSPR_Width)( HSPRITE hPic, int frame );
|
2010-08-20 22:00:00 +02:00
|
|
|
|
void (*pfnSPR_Set)( HSPRITE hPic, int r, int g, int b );
|
|
|
|
|
void (*pfnSPR_Draw)( int frame, int x, int y, const wrect_t *prc );
|
|
|
|
|
void (*pfnSPR_DrawHoles)( int frame, int x, int y, const wrect_t *prc );
|
|
|
|
|
void (*pfnSPR_DrawAdditive)( int frame, int x, int y, const wrect_t *prc );
|
2009-12-03 22:00:00 +01:00
|
|
|
|
void (*pfnSPR_EnableScissor)( int x, int y, int width, int height );
|
|
|
|
|
void (*pfnSPR_DisableScissor)( void );
|
|
|
|
|
client_sprite_t *(*pfnSPR_GetList)( char *psz, int *piCount );
|
|
|
|
|
|
|
|
|
|
// screen handlers
|
|
|
|
|
void (*pfnFillRGBA)( int x, int y, int width, int height, int r, int g, int b, int a );
|
|
|
|
|
int (*pfnGetScreenInfo)( SCREENINFO *pscrinfo );
|
|
|
|
|
void (*pfnSetCrosshair)( HSPRITE hspr, wrect_t rc, int r, int g, int b );
|
|
|
|
|
|
2008-12-25 22:00:00 +01:00
|
|
|
|
// cvar handlers
|
2010-10-22 22:00:00 +02:00
|
|
|
|
cvar_t* (*pfnRegisterVariable)( const char *szName, const char *szValue, int flags );
|
2008-12-25 22:00:00 +01:00
|
|
|
|
float (*pfnGetCvarFloat)( const char *szName );
|
|
|
|
|
char* (*pfnGetCvarString)( const char *szName );
|
|
|
|
|
|
|
|
|
|
// command handlers
|
2010-10-22 22:00:00 +02:00
|
|
|
|
void (*pfnAddCommand)( const char *cmd_name, void (*function)(void) );
|
2008-12-26 22:00:00 +01:00
|
|
|
|
void (*pfnHookUserMsg)( const char *szMsgName, pfnUserMsgHook pfn );
|
2008-12-25 22:00:00 +01:00
|
|
|
|
void (*pfnServerCmd)( const char *szCmdString );
|
|
|
|
|
void (*pfnClientCmd)( const char *szCmdString );
|
2009-01-09 22:00:00 +01:00
|
|
|
|
|
2008-12-25 22:00:00 +01:00
|
|
|
|
void (*pfnGetPlayerInfo)( int player_num, hud_player_info_t *pinfo );
|
|
|
|
|
|
2010-08-20 22:00:00 +02:00
|
|
|
|
// sound handlers
|
|
|
|
|
void (*pfnPlaySoundByName)( const char *szSound, float volume );
|
|
|
|
|
void (*pfnPlaySoundByIndex)( int iSound, float volume );
|
2008-12-25 22:00:00 +01:00
|
|
|
|
|
|
|
|
|
// vector helpers
|
|
|
|
|
void (*pfnAngleVectors)( const float *rgflVector, float *forward, float *right, float *up );
|
|
|
|
|
|
2009-12-04 22:00:00 +01:00
|
|
|
|
// 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 );
|
|
|
|
|
void (*pfnDrawSetTextColor)( float r, float g, float b );
|
|
|
|
|
void (*pfnDrawConsoleStringLen)( const char *string, int *length, int *height );
|
|
|
|
|
|
|
|
|
|
void (*pfnConsolePrint)( const char *string );
|
|
|
|
|
void (*pfnCenterPrint)( const char *string );
|
|
|
|
|
|
2009-12-05 22:00:00 +01:00
|
|
|
|
// added for user input processing
|
2010-08-20 22:00:00 +02:00
|
|
|
|
int (*GetWindowCenterX)( void );
|
|
|
|
|
int (*GetWindowCenterY)( void );
|
2009-12-05 22:00:00 +01:00
|
|
|
|
void (*pfnGetViewAngles)( float *rgflAngles );
|
|
|
|
|
void (*pfnSetViewAngles)( float *rgflAngles );
|
2010-08-20 22:00:00 +02:00
|
|
|
|
int (*GetMaxClients)( void );
|
2009-12-04 22:00:00 +01:00
|
|
|
|
void (*pfnCvarSetValue)( const char *szName, float flValue );
|
|
|
|
|
|
|
|
|
|
int (*pfnCmdArgc)( void );
|
2009-12-05 22:00:00 +01:00
|
|
|
|
const char* (*pfnCmdArgv)( int argc );
|
2010-08-20 22:00:00 +02:00
|
|
|
|
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, ... );
|
2009-12-05 22:00:00 +01:00
|
|
|
|
|
|
|
|
|
const char* (*pfnPhysInfo_ValueForKey)( const char *key );
|
|
|
|
|
const char* (*pfnServerInfo_ValueForKey)( const char *key );
|
|
|
|
|
float (*pfnGetClientMaxspeed)( void );
|
2010-08-20 22:00:00 +02:00
|
|
|
|
int (*CheckParm)( char *parm, char **ppnext );
|
|
|
|
|
|
|
|
|
|
void (*Key_Event)( int key, int down );
|
|
|
|
|
void (*GetMousePosition)( int *mx, int *my );
|
|
|
|
|
int (*IsNoClipping)( void );
|
2009-12-05 22:00:00 +01:00
|
|
|
|
|
2010-08-07 22:00:00 +02:00
|
|
|
|
// entity handlers
|
|
|
|
|
struct cl_entity_s *(*pfnGetLocalPlayer)( void );
|
|
|
|
|
struct cl_entity_s *(*pfnGetViewModel)( void );
|
|
|
|
|
struct cl_entity_s *(*pfnGetEntityByIndex)( int idx ); // matched with entity serialnumber
|
2008-12-25 22:00:00 +01:00
|
|
|
|
|
2010-08-20 22:00:00 +02:00
|
|
|
|
float (*pfnGetClientTime)( void );
|
2010-06-28 22:00:00 +02:00
|
|
|
|
void (*pfnFadeClientVolume)( float fadePercent, float fadeOutSeconds, float holdTime, float fadeInSeconds ); // was V_CalcShake
|
2010-08-20 22:00:00 +02:00
|
|
|
|
struct model_s* (*pfnGetModelPtr)( int modelIndex ); // was V_ApplyShake
|
2009-10-15 22:00:00 +02:00
|
|
|
|
|
2010-08-19 22:00:00 +02:00
|
|
|
|
int (*PM_PointContents)( const float *rgflPos, int *truecontents );
|
2010-08-07 22:00:00 +02:00
|
|
|
|
struct cl_entity_s *(*pfnWaterEntity)( const float *rgflPos );
|
2010-08-19 22:00:00 +02:00
|
|
|
|
struct pmtrace_s *(*PM_TraceLine)( float *start, float *end, int flags, int usehull, int ignore_pe );
|
2009-12-05 22:00:00 +01:00
|
|
|
|
|
2010-08-20 22:00:00 +02:00
|
|
|
|
struct model_s *(*CL_LoadModel)( const char *modelname, int *index );
|
|
|
|
|
int (*CL_CreateVisibleEntity)( int type, struct cl_entity_s *ent, HSPRITE customShader );
|
|
|
|
|
|
|
|
|
|
void (*pfnHostError)( const char *szFmt, ... ); // was GetSpritePointer
|
|
|
|
|
void (*pfnPlaySoundByNameAtLocation)( char *szSound, float volume, float *origin );
|
2010-08-12 22:00:00 +02:00
|
|
|
|
|
2010-06-23 22:00:00 +02:00
|
|
|
|
word (*pfnPrecacheEvent)( int type, const char* psz );
|
2010-08-07 22:00:00 +02:00
|
|
|
|
void (*pfnPlaybackEvent)( int flags, const struct cl_entity_s *pInvoker, word eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 );
|
2010-08-12 22:00:00 +02:00
|
|
|
|
void (*pfnWeaponAnim)( int iAnim, int body );
|
2010-06-23 22:00:00 +02:00
|
|
|
|
float (*pfnRandomFloat)( float flLow, float flHigh );
|
|
|
|
|
long (*pfnRandomLong)( long lLow, long lHigh );
|
|
|
|
|
void (*pfnHookEvent)( const char *name, void ( *pfnEvent )( struct event_args_s *args ));
|
|
|
|
|
int (*Con_IsVisible)( void );
|
2010-08-20 22:00:00 +02:00
|
|
|
|
const char *(*pfnGetGameDirectory)( void );
|
|
|
|
|
struct cvar_s *(*pfnGetCvarPointer)( const char *szName );
|
|
|
|
|
const char *(*Key_LookupBinding)( const char *pBinding );
|
|
|
|
|
const char *(*pfnGetLevelName)( void );
|
|
|
|
|
struct movevars_s *(*pfnGetMovementVariables)( void ); // was pfnGetScreenFade
|
|
|
|
|
void (*MakeEnvShot)( const float *vieworg, const char *name, int skyshot ); // was pfnSetScreenFade
|
2009-12-05 22:00:00 +01:00
|
|
|
|
|
|
|
|
|
// vgui handlers
|
|
|
|
|
void* (*VGui_GetPanel)( void ); // UNDONE: wait for version 0.75
|
|
|
|
|
void (*VGui_ViewportPaintBackground)( int extents[4] );
|
|
|
|
|
|
|
|
|
|
// parse txt files
|
2010-08-20 22:00:00 +02:00
|
|
|
|
byte* (*COM_LoadFile)( const char *filename, int *pLength );
|
|
|
|
|
char* (*COM_ParseFile)( char *data, char *token );
|
|
|
|
|
void (*COM_FreeFile)( void *buffer );
|
2009-12-05 22:00:00 +01:00
|
|
|
|
|
|
|
|
|
struct triapi_s *pTriAPI;
|
|
|
|
|
struct efxapi_s *pEfxAPI;
|
|
|
|
|
struct event_api_s *pEventAPI;
|
2008-12-25 22:00:00 +01:00
|
|
|
|
|
2010-06-28 22:00:00 +02:00
|
|
|
|
int (*pfnIsSpectateOnly)( void );
|
2010-08-20 22:00:00 +02:00
|
|
|
|
int (*pfnIsInGame)( void ); // return false for menu, console, etc // was LoadMapSprite
|
2008-12-25 22:00:00 +01:00
|
|
|
|
} cl_enginefuncs_t;
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
int (*pfnVidInit)( void );
|
|
|
|
|
void (*pfnInit)( void );
|
2008-12-26 22:00:00 +01:00
|
|
|
|
int (*pfnRedraw)( float flTime, int state );
|
2010-08-07 22:00:00 +02:00
|
|
|
|
int (*pfnUpdateClientData)( struct client_data_s *pcldata, float flTime );
|
2010-08-12 22:00:00 +02:00
|
|
|
|
int (*pfnGetHullBounds)( int hullnumber, float *mins, float *maxs );
|
2010-08-07 22:00:00 +02:00
|
|
|
|
void (*pfnTxferLocalOverrides)( struct entity_state_s *state, const struct clientdata_s *client );
|
2010-08-12 22:00:00 +02:00
|
|
|
|
void (*pfnProcessPlayerState)( struct entity_state_s *dst, const struct entity_state_s *src );
|
2010-08-07 22:00:00 +02:00
|
|
|
|
void (*pfnUpdateOnRemove)( struct cl_entity_s *pEdict );
|
2008-12-25 22:00:00 +01:00
|
|
|
|
void (*pfnReset)( void );
|
2010-03-09 22:00:00 +01:00
|
|
|
|
void (*pfnStartFrame)( void );
|
2008-12-25 22:00:00 +01:00
|
|
|
|
void (*pfnFrame)( double time );
|
|
|
|
|
void (*pfnShutdown)( void );
|
2009-12-05 22:00:00 +01:00
|
|
|
|
void (*pfnDrawTriangles)( int fTrans );
|
2008-12-25 22:00:00 +01:00
|
|
|
|
void (*pfnCreateEntities)( void );
|
2010-08-15 22:00:00 +02:00
|
|
|
|
int (*pfnAddVisibleEntity)( struct cl_entity_s *pEnt, int entityType );
|
2010-08-20 22:00:00 +02:00
|
|
|
|
void (*pfnStudioEvent)( const struct mstudioevent_s *event, struct cl_entity_s *entity );
|
2010-08-07 22:00:00 +02:00
|
|
|
|
void (*pfnStudioFxTransform)( struct cl_entity_s *pEdict, float transform[4][4] );
|
2010-08-20 22:00:00 +02:00
|
|
|
|
void (*pfnCalcRefdef)( struct ref_params_s *parms );
|
2010-08-12 22:00:00 +02:00
|
|
|
|
void (*pfnPM_Move)( struct playermove_s *ppmove, int server );
|
|
|
|
|
void (*pfnPM_Init)( struct playermove_s *ppmove );
|
2010-08-15 22:00:00 +02:00
|
|
|
|
char (*pfnPM_FindTextureType)( char *name );
|
2010-08-07 22:00:00 +02:00
|
|
|
|
void (*pfnCmdStart)( const struct cl_entity_s *player, int runfuncs );
|
2010-08-20 22:00:00 +02:00
|
|
|
|
void (*pfnCmdEnd)( const struct cl_entity_s *player, const struct usercmd_s *cmd, unsigned int random_seed );
|
2010-10-09 22:00:00 +02:00
|
|
|
|
void (*pfnCreateMove)( struct usercmd_s *cmd, float frametime, int active );
|
2009-12-05 22:00:00 +01:00
|
|
|
|
void (*pfnMouseEvent)( int mx, int my );
|
|
|
|
|
int (*pfnKeyEvent)( int down, int keynum, const char *pszBind );
|
|
|
|
|
void (*VGui_ConsolePrint)( const char *text );
|
2010-07-13 22:00:00 +02:00
|
|
|
|
void (*pfnParticleEffect)( const float *org, const float *dir, int color, int count ); // SV_ParticleEffect
|
2010-08-16 22:00:00 +02:00
|
|
|
|
void (*pfnTempEntityMessage)( int iSize, void *pbuf );
|
|
|
|
|
void (*pfnDirectorMessage)( int iSize, void *pbuf );
|
2008-12-25 22:00:00 +01:00
|
|
|
|
} HUD_FUNCTIONS;
|
|
|
|
|
|
2010-08-20 22:00:00 +02:00
|
|
|
|
typedef int (*CLIENTAPI)( HUD_FUNCTIONS *pFunctionTable, cl_enginefuncs_t* engfuncs );
|
2008-12-25 22:00:00 +01:00
|
|
|
|
|
2010-08-20 22:00:00 +02:00
|
|
|
|
#endif//CDLL_INT_H
|