2008-12-25 22:00:00 +01:00
|
|
|
|
//=======================================================================
|
|
|
|
|
// Copyright XashXT Group 2008 <20>
|
|
|
|
|
// clgame_api.h - entity interface between engine and clgame
|
|
|
|
|
//=======================================================================
|
|
|
|
|
#ifndef CLGAME_API_H
|
|
|
|
|
#define CLGAME_API_H
|
|
|
|
|
|
2009-01-11 22:00:00 +01:00
|
|
|
|
typedef int HSPRITE; // handle to a graphic
|
2009-09-13 22:00:00 +02:00
|
|
|
|
typedef struct usercmd_s usercmd_t;
|
2009-01-15 22:00:00 +01:00
|
|
|
|
typedef struct cparticle_s cparticle_t;
|
2009-01-11 22:00:00 +01:00
|
|
|
|
typedef struct ref_params_s ref_params_t;
|
|
|
|
|
typedef struct dstudioevent_s dstudioevent_t;
|
2008-12-25 22:00:00 +01:00
|
|
|
|
typedef int (*pfnUserMsgHook)( const char *pszName, int iSize, void *pbuf ); // user message handle
|
2009-01-11 22:00:00 +01:00
|
|
|
|
typedef void (*pfnEventHook)( struct event_args_s *args );
|
2008-12-25 22:00:00 +01:00
|
|
|
|
|
2009-01-11 22:00:00 +01:00
|
|
|
|
#include "trace_def.h"
|
|
|
|
|
#include "event_api.h"
|
2008-12-25 22:00:00 +01:00
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
2009-01-11 22:00:00 +01:00
|
|
|
|
char *name;
|
|
|
|
|
short ping;
|
|
|
|
|
byte thisplayer; // TRUE if this is the calling player
|
|
|
|
|
byte packetloss; // TRUE if current packet is loose
|
2008-12-25 22:00:00 +01:00
|
|
|
|
} hud_player_info_t;
|
|
|
|
|
|
|
|
|
|
typedef struct client_textmessage_s
|
|
|
|
|
{
|
2009-01-11 22:00:00 +01:00
|
|
|
|
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;
|
2008-12-25 22:00:00 +01:00
|
|
|
|
} client_textmessage_t;
|
|
|
|
|
|
2009-01-05 22:00:00 +01:00
|
|
|
|
typedef struct client_data_s
|
|
|
|
|
{
|
2009-01-11 22:00:00 +01:00
|
|
|
|
vec3_t origin; // cl.origin
|
|
|
|
|
vec3_t angles; // cl.viewangles
|
|
|
|
|
|
|
|
|
|
int iKeyBits; // Keyboard bits
|
2009-02-01 22:00:00 +01:00
|
|
|
|
int iWeaponBits; // came from pev->weapons
|
2009-01-11 22:00:00 +01:00
|
|
|
|
float v_idlescale; // view shake/rotate
|
|
|
|
|
float mouse_sensitivity; // used for menus
|
|
|
|
|
float fov; // field of view
|
2009-01-05 22:00:00 +01:00
|
|
|
|
} client_data_t;
|
|
|
|
|
|
2008-12-25 22:00:00 +01:00
|
|
|
|
typedef struct cl_enginefuncs_s
|
|
|
|
|
{
|
|
|
|
|
// interface validator
|
|
|
|
|
size_t api_size; // must matched with sizeof(cl_enginefuncs_t)
|
|
|
|
|
|
|
|
|
|
// engine memory manager
|
|
|
|
|
void* (*pfnMemAlloc)( size_t cb, const char *filename, const int fileline );
|
2009-01-11 22:00:00 +01:00
|
|
|
|
void (*pfnMemCopy)( void *dest, const void *src, size_t cb, const char *filename, const int fileline );
|
2008-12-25 22:00:00 +01:00
|
|
|
|
void (*pfnMemFree)( void *mem, const char *filename, const int fileline );
|
|
|
|
|
|
|
|
|
|
// screen handlers
|
2009-01-16 22:00:00 +01:00
|
|
|
|
HSPRITE (*pfnLoadShader)( const char *szShaderName, int fShaderNoMip );
|
2009-09-10 22:00:00 +02:00
|
|
|
|
void (*pfnFillRGBA)( int x, int y, int width, int height, byte r, byte g, byte b, byte alpha );
|
2009-01-06 22:00:00 +01:00
|
|
|
|
void (*pfnDrawImageExt)( HSPRITE shader, float x, float y, float w, float h, float s1, float t1, float s2, float t2 );
|
2009-09-10 22:00:00 +02:00
|
|
|
|
void (*pfnSetColor)( byte r, byte g, byte b, byte a );
|
2008-12-25 22:00:00 +01:00
|
|
|
|
|
|
|
|
|
// cvar handlers
|
2009-01-22 22:00:00 +01:00
|
|
|
|
cvar_t* (*pfnRegisterVariable)( const char *szName, const char *szValue, int flags, const char *szDesc );
|
2009-01-11 22:00:00 +01:00
|
|
|
|
void (*pfnCvarSetString)( const char *szName, const char *szValue );
|
|
|
|
|
void (*pfnCvarSetValue)( const char *szName, float flValue );
|
2008-12-25 22:00:00 +01:00
|
|
|
|
float (*pfnGetCvarFloat)( const char *szName );
|
|
|
|
|
char* (*pfnGetCvarString)( const char *szName );
|
|
|
|
|
|
|
|
|
|
// command handlers
|
|
|
|
|
void (*pfnAddCommand)( const char *cmd_name, void (*function)(void), const char *cmd_desc );
|
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
|
|
|
|
void (*pfnSetKeyDest)( int key_dest );
|
|
|
|
|
|
2008-12-25 22:00:00 +01:00
|
|
|
|
void (*pfnGetPlayerInfo)( int player_num, hud_player_info_t *pinfo );
|
|
|
|
|
client_textmessage_t *(*pfnTextMessageGet)( const char *pName );
|
|
|
|
|
|
|
|
|
|
int (*pfnCmdArgc)( void );
|
2009-01-11 22:00:00 +01:00
|
|
|
|
char* (*pfnCmdArgv)( int argc );
|
2008-12-25 22:00:00 +01:00
|
|
|
|
void (*pfnAlertMessage)( ALERT_TYPE, char *szFmt, ... );
|
|
|
|
|
|
|
|
|
|
// sound handlers (NULL origin == play at current client origin)
|
2009-01-05 22:00:00 +01:00
|
|
|
|
void (*pfnPlaySoundByName)( const char *szSound, float volume, int pitch, const float *org );
|
|
|
|
|
void (*pfnPlaySoundByIndex)( int iSound, float volume, int pitch, const float *org );
|
2008-12-25 22:00:00 +01:00
|
|
|
|
|
|
|
|
|
// vector helpers
|
|
|
|
|
void (*pfnAngleVectors)( const float *rgflVector, float *forward, float *right, float *up );
|
|
|
|
|
|
|
|
|
|
void (*pfnDrawCenterPrint)( void );
|
|
|
|
|
void (*pfnCenterPrint)( const char *text, int y, int charWidth );
|
|
|
|
|
void (*pfnDrawString)( int x, int y, int width, int height, const char *text );
|
2009-01-04 22:00:00 +01:00
|
|
|
|
void (*pfnGetParms)( int *w, int *h, int *frames, int frame, shader_t shader );
|
2008-12-28 22:00:00 +01:00
|
|
|
|
void (*pfnSetParms)( shader_t handle, kRenderMode_t rendermode, int frame );
|
2008-12-25 22:00:00 +01:00
|
|
|
|
|
|
|
|
|
// local client handlers
|
|
|
|
|
void (*pfnGetViewAngles)( float *angles );
|
|
|
|
|
edict_t* (*pfnGetEntityByIndex)( int idx ); // matched with entity serialnumber
|
|
|
|
|
edict_t* (*pfnGetLocalPlayer)( void );
|
|
|
|
|
int (*pfnIsSpectateOnly)( void ); // returns 1 if the client is a spectator only
|
|
|
|
|
float (*pfnGetClientTime)( void );
|
|
|
|
|
int (*pfnGetMaxClients)( void );
|
|
|
|
|
edict_t* (*pfnGetViewModel)( void );
|
2009-01-22 22:00:00 +01:00
|
|
|
|
void* (*pfnGetModelPtr)( edict_t* pEdict );
|
2008-12-26 22:00:00 +01:00
|
|
|
|
void (*pfnMakeLevelShot)( void ); // level shot will be created at next frame
|
2008-12-25 22:00:00 +01:00
|
|
|
|
|
|
|
|
|
int (*pfnPointContents)( const float *rgflVector );
|
|
|
|
|
void (*pfnTraceLine)( const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr );
|
2009-01-11 22:00:00 +01:00
|
|
|
|
void (*pfnTraceToss)( edict_t* pent, edict_t* pentToIgnore, TraceResult *ptr );
|
|
|
|
|
void (*pfnTraceHull)( const float *v1, const float *mins, const float *maxs, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr );
|
|
|
|
|
void (*pfnTraceModel)( const float *v1, const float *v2, edict_t *pent, TraceResult *ptr );
|
|
|
|
|
const char *(*pfnTraceTexture)( edict_t *pTextureEntity, const float *v1, const float *v2 );
|
|
|
|
|
|
|
|
|
|
word (*pfnPrecacheEvent)( int type, const char* psz );
|
|
|
|
|
void (*pfnHookEvent)( const char *name, pfnEventHook pfn );
|
|
|
|
|
void (*pfnPlaybackEvent)( int flags, const edict_t *pInvoker, word eventindex, float delay, event_args_t *args );
|
|
|
|
|
void (*pfnKillEvent)( word eventindex );
|
|
|
|
|
|
|
|
|
|
string_t (*pfnAllocString)( const char *szValue );
|
|
|
|
|
const char *(*pfnGetString)( string_t iString );
|
2008-12-25 22:00:00 +01:00
|
|
|
|
|
|
|
|
|
long (*pfnRandomLong)( long lLow, long lHigh );
|
|
|
|
|
float (*pfnRandomFloat)( float flLow, float flHigh );
|
|
|
|
|
byte* (*pfnLoadFile)( const char *filename, int *pLength );
|
2009-01-01 22:00:00 +01:00
|
|
|
|
int (*pfnFileExists)( const char *filename );
|
2008-12-25 22:00:00 +01:00
|
|
|
|
void (*pfnGetGameDir)( char *szGetGameDir );
|
2009-01-21 22:00:00 +01:00
|
|
|
|
void* (*pfnLoadLibrary)( const char *name );
|
|
|
|
|
void* (*pfnGetProcAddress)( void *hInstance, const char *name );
|
|
|
|
|
void (*pfnFreeLibrary)( void *hInstance );
|
2008-12-25 22:00:00 +01:00
|
|
|
|
void (*pfnHostError)( const char *szFmt, ... ); // invoke host error
|
|
|
|
|
|
2009-01-11 22:00:00 +01:00
|
|
|
|
struct triapi_s *pTriAPI;
|
|
|
|
|
struct efxapi_s *pEfxAPI;
|
2008-12-25 22:00:00 +01:00
|
|
|
|
|
|
|
|
|
} cl_enginefuncs_t;
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
// interface validator
|
|
|
|
|
size_t api_size; // must matched with sizeof(HUD_FUNCTIONS)
|
|
|
|
|
|
|
|
|
|
int (*pfnVidInit)( void );
|
|
|
|
|
void (*pfnInit)( void );
|
2008-12-26 22:00:00 +01:00
|
|
|
|
int (*pfnRedraw)( float flTime, int state );
|
2009-01-05 22:00:00 +01:00
|
|
|
|
int (*pfnUpdateClientData)( client_data_t *cdata, float flTime );
|
2009-08-22 22:00:00 +02:00
|
|
|
|
void (*pfnUpdateEntityVars)( edict_t *out, ref_params_t *view, const struct entity_state_s *in );
|
2008-12-25 22:00:00 +01:00
|
|
|
|
void (*pfnReset)( void );
|
|
|
|
|
void (*pfnFrame)( double time );
|
|
|
|
|
void (*pfnShutdown)( void );
|
|
|
|
|
void (*pfnDrawNormalTriangles)( void );
|
|
|
|
|
void (*pfnDrawTransparentTriangles)( void );
|
|
|
|
|
void (*pfnCreateEntities)( void );
|
|
|
|
|
void (*pfnStudioEvent)( const dstudioevent_t *event, edict_t *entity );
|
2009-09-13 22:00:00 +02:00
|
|
|
|
void (*pfnCalcRefdef)( ref_params_t *parms );
|
|
|
|
|
void (*pfnStartPitchDrift)( void );
|
|
|
|
|
void (*pfnStopPitchDrift)( void );
|
2008-12-25 22:00:00 +01:00
|
|
|
|
} HUD_FUNCTIONS;
|
|
|
|
|
|
2009-01-11 22:00:00 +01:00
|
|
|
|
typedef int (*CLIENTAPI)( HUD_FUNCTIONS *pFunctionTable, cl_enginefuncs_t* pEngfuncsFromEngine );
|
2008-12-25 22:00:00 +01:00
|
|
|
|
|
|
|
|
|
#endif//CLGAME_API_H
|