From 49ce8a440a65c30a71bb69ba7566562b552b1aa8 Mon Sep 17 00:00:00 2001 From: Ensiform Date: Wed, 4 Sep 2024 10:05:01 -0500 Subject: [PATCH] Fix syscall argument expansion on 64-bit Every argument needs to be cast to intptr_t to ensure the memory is correctly aligned for va_arg as it reads everything as intptr_t to support both x86 and x64 correctly. Merge from ETe https://github.com/etfdevs/ETe/commit/191fd557608ff14518e52ee5d81f3c7d3cbfed95 --- code/api/et/cg_public.h | 36 +- code/api/et/cg_syscalls.c | 344 ++++++------ code/api/et/g_public.h | 24 +- code/api/et/g_syscalls.c | 758 +++------------------------ code/api/et/q_shared.h | 37 ++ code/api/et/ui_public.h | 10 +- code/api/et/ui_syscalls.c | 237 +++++---- code/api/shared/cg_shared_syscalls.c | 28 +- code/api/shared/g_shared_syscalls.c | 4 +- code/api/shared/ui_shared_syscalls.c | 12 +- code/game/g_local.h | 182 ------- 11 files changed, 501 insertions(+), 1171 deletions(-) diff --git a/code/api/et/cg_public.h b/code/api/et/cg_public.h index 764c544..a4bd296 100644 --- a/code/api/et/cg_public.h +++ b/code/api/et/cg_public.h @@ -97,7 +97,7 @@ functions imported from the main executable #define CGAME_IMPORT_API_VERSION 3 typedef enum { - CG_PRINT, + CG_PRINT = 0, CG_ERROR, CG_MILLISECONDS, CG_CVAR_REGISTER, @@ -230,7 +230,7 @@ typedef enum { CG_STOPCAMERA, CG_GETCAMERAINFO, - CG_MEMSET = 150, + /*CG_MEMSET = 150, CG_MEMCPY, CG_STRNCPY, CG_SIN, @@ -242,9 +242,9 @@ typedef enum { CG_TESTPRINTINT, CG_TESTPRINTFLOAT, - CG_ACOS, + CG_ACOS,*/ - CG_INGAME_POPUP, //----(SA) added + CG_INGAME_POPUP = 162, //----(SA) added // NERVE - SMF CG_INGAME_CLOSEPOPUP, @@ -264,6 +264,25 @@ typedef enum { CG_GETHUNKDATA, CG_PUMPEVENTLOOP, + + // zinx + CG_SENDMESSAGE, + CG_MESSAGESTATUS, + // -zinx + + // bani + CG_R_LOADDYNAMICSHADER, + // -bani + + // fretn + CG_R_RENDERTOTEXTURE, + // -fretn + // bani + CG_R_GETTEXTUREID, + // -bani + // bani + CG_R_FINISH, + // -bani } cgameImport_t; @@ -276,7 +295,7 @@ functions exported to the main executable */ typedef enum { - CG_INIT, + CG_INIT = 0, // void CG_Init( int serverMessageNum, int serverCommandSequence ) // called when the level loads or when the renderer is restarted // all media should be registered at this time @@ -322,6 +341,13 @@ typedef enum { CG_WANTSBINDKEYS, + // zinx + CG_MESSAGERECEIVED, +// void (*CG_MessageReceived)( const char *buf, int buflen, int serverTime ); + // -zinx + + CG_EXPORT_LAST, + } cgameExport_t; //---------------------------------------------- diff --git a/code/api/et/cg_syscalls.c b/code/api/et/cg_syscalls.c index 354e830..7683734 100644 --- a/code/api/et/cg_syscalls.c +++ b/code/api/et/cg_syscalls.c @@ -34,13 +34,13 @@ If you have questions concerning this license or the applicable additional terms #include "../../cgame/cg_local.h" -static intptr_t (QDECL *Q_syscall)( intptr_t arg, ... ) = (intptr_t (QDECL *)( intptr_t, ...))-1; +static dllSyscall_t syscall = (dllSyscall_t)-1; -Q_EXPORT void dllEntry( intptr_t (QDECL *syscallptr)( intptr_t arg,... ) ) { - Q_syscall = syscallptr; +Q_EXPORT void dllEntry( dllSyscall_t syscallptr ) { + syscall = syscallptr; } -int PASSFLOAT( float x ) { +static int PASSFLOAT( float x ) { byteAlias_t fi; fi.f = x; return fi.i; @@ -52,170 +52,170 @@ void trap_PumpEventLoop( void ) { if( !cgs.initing ) { return; } - Q_syscall( CG_PUMPEVENTLOOP ); + SystemCall( CG_PUMPEVENTLOOP ); } void trap_Print( const char *fmt ) { - Q_syscall( CG_PRINT, fmt ); + SystemCall( CG_PRINT, fmt ); } void NORETURN trap_Error( const char *fmt ) { - Q_syscall( CG_ERROR, fmt ); + SystemCall( CG_ERROR, fmt ); exit( 1 ); } int trap_Milliseconds( void ) { - return Q_syscall( CG_MILLISECONDS ); + return SystemCall( CG_MILLISECONDS ); } void trap_Cvar_Register( vmCvar_t *vmCvar, const char *varName, const char *defaultValue, int flags ) { - Q_syscall( CG_CVAR_REGISTER, vmCvar, varName, defaultValue, flags ); + SystemCall( CG_CVAR_REGISTER, vmCvar, varName, defaultValue, flags ); } void trap_Cvar_Update( vmCvar_t *vmCvar ) { - Q_syscall( CG_CVAR_UPDATE, vmCvar ); + SystemCall( CG_CVAR_UPDATE, vmCvar ); } void trap_Cvar_Set( const char *var_name, const char *value ) { - Q_syscall( CG_CVAR_SET, var_name, value ); + SystemCall( CG_CVAR_SET, var_name, value ); } void trap_Cvar_VariableStringBuffer( const char *var_name, char *buffer, int bufsize ) { - Q_syscall( CG_CVAR_VARIABLESTRINGBUFFER, var_name, buffer, bufsize ); + SystemCall( CG_CVAR_VARIABLESTRINGBUFFER, var_name, buffer, bufsize ); } void trap_Cvar_LatchedVariableStringBuffer( const char *var_name, char *buffer, int bufsize ) { - Q_syscall( CG_CVAR_LATCHEDVARIABLESTRINGBUFFER, var_name, buffer, bufsize ); + SystemCall( CG_CVAR_LATCHEDVARIABLESTRINGBUFFER, var_name, buffer, bufsize ); } int trap_Argc( void ) { - return Q_syscall( CG_ARGC ); + return SystemCall( CG_ARGC ); } void trap_Argv( int n, char *buffer, int bufferLength ) { - Q_syscall( CG_ARGV, n, buffer, bufferLength ); + SystemCall( CG_ARGV, n, buffer, bufferLength ); } void trap_Args( char *buffer, int bufferLength ) { - Q_syscall( CG_ARGS, buffer, bufferLength ); + SystemCall( CG_ARGS, buffer, bufferLength ); } int trap_FS_FOpenFile( const char *qpath, fileHandle_t *f, fsMode_t mode ) { - return Q_syscall( CG_FS_FOPENFILE, qpath, f, mode ); + return SystemCall( CG_FS_FOPENFILE, qpath, f, mode ); } void trap_FS_Read( void *buffer, int len, fileHandle_t f ) { - Q_syscall( CG_FS_READ, buffer, len, f ); + SystemCall( CG_FS_READ, buffer, len, f ); } void trap_FS_Write( const void *buffer, int len, fileHandle_t f ) { - Q_syscall( CG_FS_WRITE, buffer, len, f ); + SystemCall( CG_FS_WRITE, buffer, len, f ); } void trap_FS_FCloseFile( fileHandle_t f ) { - Q_syscall( CG_FS_FCLOSEFILE, f ); + SystemCall( CG_FS_FCLOSEFILE, f ); } int trap_FS_GetFileList( const char *path, const char *extension, char *listbuf, int bufsize ) { - return Q_syscall( CG_FS_GETFILELIST, path, extension, listbuf, bufsize ); + return SystemCall( CG_FS_GETFILELIST, path, extension, listbuf, bufsize ); } int trap_FS_Delete( const char *filename ) { - return Q_syscall( CG_FS_DELETEFILE, filename); + return SystemCall( CG_FS_DELETEFILE, filename); } void trap_SendConsoleCommand( const char *text ) { - Q_syscall( CG_SENDCONSOLECOMMAND, text ); + SystemCall( CG_SENDCONSOLECOMMAND, text ); } void trap_AddCommand( const char *cmdName ) { - Q_syscall( CG_ADDCOMMAND, cmdName ); + SystemCall( CG_ADDCOMMAND, cmdName ); } void trap_RemoveCommand( const char *cmdName ) { - Q_syscall( CG_REMOVECOMMAND, cmdName ); + SystemCall( CG_REMOVECOMMAND, cmdName ); } void trap_SendClientCommand( const char *s ) { - Q_syscall( CG_SENDCLIENTCOMMAND, s ); + SystemCall( CG_SENDCLIENTCOMMAND, s ); } void trap_UpdateScreen( void ) { - Q_syscall( CG_UPDATESCREEN ); + SystemCall( CG_UPDATESCREEN ); } /*void trap_CM_LoadMap( const char *mapname ) { CG_DrawInformation(); - Q_syscall( CG_CM_LOADMAP, mapname ); + SystemCall( CG_CM_LOADMAP, mapname ); }*/ int trap_CM_NumInlineModels( void ) { - return Q_syscall( CG_CM_NUMINLINEMODELS ); + return SystemCall( CG_CM_NUMINLINEMODELS ); } clipHandle_t trap_CM_InlineModel( int index ) { - return Q_syscall( CG_CM_INLINEMODEL, index ); + return SystemCall( CG_CM_INLINEMODEL, index ); } clipHandle_t trap_CM_TempBoxModel( const vec3_t mins, const vec3_t maxs ) { - return Q_syscall( CG_CM_TEMPBOXMODEL, mins, maxs ); + return SystemCall( CG_CM_TEMPBOXMODEL, mins, maxs ); } clipHandle_t trap_CM_TempCapsuleModel( const vec3_t mins, const vec3_t maxs ) { - return Q_syscall( CG_CM_TEMPCAPSULEMODEL, mins, maxs ); + return SystemCall( CG_CM_TEMPCAPSULEMODEL, mins, maxs ); } int trap_CM_PointContents( const vec3_t p, clipHandle_t model ) { - return Q_syscall( CG_CM_POINTCONTENTS, p, model ); + return SystemCall( CG_CM_POINTCONTENTS, p, model ); } int trap_CM_TransformedPointContents( const vec3_t p, clipHandle_t model, const vec3_t origin, const vec3_t angles ) { - return Q_syscall( CG_CM_TRANSFORMEDPOINTCONTENTS, p, model, origin, angles ); + return SystemCall( CG_CM_TRANSFORMEDPOINTCONTENTS, p, model, origin, angles ); } void trap_CM_BoxTrace( trace_t *results, const vec3_t start, const vec3_t end, const vec3_t mins, const vec3_t maxs, clipHandle_t model, int brushmask ) { - Q_syscall( CG_CM_BOXTRACE, results, start, end, mins, maxs, model, brushmask ); + SystemCall( CG_CM_BOXTRACE, results, start, end, mins, maxs, model, brushmask ); } void trap_CM_TransformedBoxTrace( trace_t *results, const vec3_t start, const vec3_t end, const vec3_t mins, const vec3_t maxs, clipHandle_t model, int brushmask, const vec3_t origin, const vec3_t angles ) { - Q_syscall( CG_CM_TRANSFORMEDBOXTRACE, results, start, end, mins, maxs, model, brushmask, origin, angles ); + SystemCall( CG_CM_TRANSFORMEDBOXTRACE, results, start, end, mins, maxs, model, brushmask, origin, angles ); } void trap_CM_CapsuleTrace( trace_t *results, const vec3_t start, const vec3_t end, const vec3_t mins, const vec3_t maxs, clipHandle_t model, int brushmask ) { - Q_syscall( CG_CM_CAPSULETRACE, results, start, end, mins, maxs, model, brushmask ); + SystemCall( CG_CM_CAPSULETRACE, results, start, end, mins, maxs, model, brushmask ); } void trap_CM_TransformedCapsuleTrace( trace_t *results, const vec3_t start, const vec3_t end, const vec3_t mins, const vec3_t maxs, clipHandle_t model, int brushmask, const vec3_t origin, const vec3_t angles ) { - Q_syscall( CG_CM_TRANSFORMEDCAPSULETRACE, results, start, end, mins, maxs, model, brushmask, origin, angles ); + SystemCall( CG_CM_TRANSFORMEDCAPSULETRACE, results, start, end, mins, maxs, model, brushmask, origin, angles ); } int trap_CM_MarkFragments( int numPoints, const vec3_t *points, const vec3_t projection, int maxPoints, vec3_t pointBuffer, int maxFragments, markFragment_t *fragmentBuffer ) { - return Q_syscall( CG_CM_MARKFRAGMENTS, numPoints, points, projection, maxPoints, pointBuffer, maxFragments, fragmentBuffer ); + return SystemCall( CG_CM_MARKFRAGMENTS, numPoints, points, projection, maxPoints, pointBuffer, maxFragments, fragmentBuffer ); } // ydnar void trap_R_ProjectDecal( qhandle_t hShader, int numPoints, vec3_t *points, vec4_t projection, vec4_t color, int lifeTime, int fadeTime ) { - Q_syscall( CG_R_PROJECTDECAL, hShader, numPoints, points, projection, color, lifeTime, fadeTime ); + SystemCall( CG_R_PROJECTDECAL, hShader, numPoints, points, projection, color, lifeTime, fadeTime ); } void trap_R_ClearDecals( void ) { - Q_syscall( CG_R_CLEARDECALS ); + SystemCall( CG_R_CLEARDECALS ); } @@ -226,21 +226,21 @@ void trap_S_RealStartSound( const vec3_t origin, int entityNum, int entchannel, if(sfx < 0 || sfx >= 4096) { Com_Printf("^1Warning: trap_S_StartSound out of range handle %i\nFile: '%s' Line: %i", sfx, file, line); } - Q_syscall( CG_S_STARTSOUND, origin, entityNum, entchannel, sfx, 127 /* Gordon: default volume always for the moment*/ ); + SystemCall( CG_S_STARTSOUND, origin, entityNum, entchannel, sfx, 127 /* Gordon: default volume always for the moment*/ ); } void trap_S_StartSoundVControl( const vec3_t origin, int entityNum, int entchannel, sfxHandle_t sfx, int volume ) { - Q_syscall( CG_S_STARTSOUND, origin, entityNum, entchannel, sfx, volume ); + SystemCall( CG_S_STARTSOUND, origin, entityNum, entchannel, sfx, volume ); } //----(SA) added void trap_S_StartSoundEx( const vec3_t origin, int entityNum, int entchannel, sfxHandle_t sfx, int flags ) { - Q_syscall( CG_S_STARTSOUNDEX, origin, entityNum, entchannel, sfx, flags, 127 /* Gordon: default volume always for the moment*/ ); + SystemCall( CG_S_STARTSOUNDEX, origin, entityNum, entchannel, sfx, flags, 127 /* Gordon: default volume always for the moment*/ ); } //----(SA) end void trap_S_StartSoundExVControl( const vec3_t origin, int entityNum, int entchannel, sfxHandle_t sfx, int flags, int volume ) { - Q_syscall( CG_S_STARTSOUNDEX, origin, entityNum, entchannel, sfx, flags, volume ); + SystemCall( CG_S_STARTSOUNDEX, origin, entityNum, entchannel, sfx, flags, volume ); } void trap_S_RealStartLocalSound( sfxHandle_t sfx, int channelNum, const char* file, int line ) { @@ -250,377 +250,377 @@ void trap_S_RealStartLocalSound( sfxHandle_t sfx, int channelNum, const char* fi if(sfx < 0 || sfx >= 4096) { Com_Printf("^1Warning: trap_S_StartSound out of range handle %i\nFile: '%s' Line: %i", sfx, file, line); } - Q_syscall( CG_S_STARTLOCALSOUND, sfx, channelNum, 127 /* Gordon: default volume always for the moment*/ ); + SystemCall( CG_S_STARTLOCALSOUND, sfx, channelNum, 127 /* Gordon: default volume always for the moment*/ ); } /*void trap_S_ClearLoopingSounds( void ) { - Q_syscall( CG_S_CLEARLOOPINGSOUNDS ); + SystemCall( CG_S_CLEARLOOPINGSOUNDS ); }*/ void trap_S_ClearSounds( qboolean killmusic ) { - Q_syscall( CG_S_CLEARSOUNDS, killmusic ); + SystemCall( CG_S_CLEARSOUNDS, killmusic ); } /*void trap_S_AddLoopingSound( const vec3_t origin, const vec3_t velocity, sfxHandle_t sfx, int volume, int soundTime ) { - Q_syscall( CG_S_ADDLOOPINGSOUND, origin, velocity, 1250, sfx, volume, soundTime ); // volume was previously removed from CG_S_ADDLOOPINGSOUND. I added 'range' + SystemCall( CG_S_ADDLOOPINGSOUND, origin, velocity, 1250, sfx, volume, soundTime ); // volume was previously removed from CG_S_ADDLOOPINGSOUND. I added 'range' }*/ /*void trap_S_AddRealLoopingSound( const vec3_t origin, const vec3_t velocity, sfxHandle_t sfx, int range, int volume, int soundTime ) { - Q_syscall( CG_S_ADDREALLOOPINGSOUND, origin, velocity, range, sfx, volume, soundTime ); + SystemCall( CG_S_ADDREALLOOPINGSOUND, origin, velocity, range, sfx, volume, soundTime ); }*/ void trap_S_StopStreamingSound(int entityNum) { - Q_syscall( CG_S_STOPSTREAMINGSOUND, entityNum ); + SystemCall( CG_S_STOPSTREAMINGSOUND, entityNum ); } void trap_S_UpdateEntityPosition( int entityNum, const vec3_t origin ) { - Q_syscall( CG_S_UPDATEENTITYPOSITION, entityNum, origin ); + SystemCall( CG_S_UPDATEENTITYPOSITION, entityNum, origin ); } // Ridah, talking animations int trap_S_GetVoiceAmplitude( int entityNum ) { - return Q_syscall( CG_S_GETVOICEAMPLITUDE, entityNum ); + return SystemCall( CG_S_GETVOICEAMPLITUDE, entityNum ); } // done. void trap_S_Respatialize( int entityNum, const vec3_t origin, vec3_t axis[3], int inwater ) { - Q_syscall( CG_S_RESPATIALIZE, entityNum, origin, axis, inwater ); + SystemCall( CG_S_RESPATIALIZE, entityNum, origin, axis, inwater ); } /*sfxHandle_t trap_S_RegisterSound( const char *sample, qboolean compressed ) { CG_DrawInformation(); - return Q_syscall( CG_S_REGISTERSOUND, sample, compressed ); + return SystemCall( CG_S_REGISTERSOUND, sample, compressed ); }*/ int trap_S_GetSoundLength(sfxHandle_t sfx) { - return Q_syscall( CG_S_GETSOUNDLENGTH, sfx ); + return SystemCall( CG_S_GETSOUNDLENGTH, sfx ); } // ydnar: for timing looped sounds int trap_S_GetCurrentSoundTime( void ) { - return Q_syscall( CG_S_GETCURRENTSOUNDTIME ); + return SystemCall( CG_S_GETCURRENTSOUNDTIME ); } /*void trap_S_StartBackgroundTrack( const char *intro, const char *loop, int fadeupTime ) { - Q_syscall( CG_S_STARTBACKGROUNDTRACK, intro, loop, fadeupTime ); + SystemCall( CG_S_STARTBACKGROUNDTRACK, intro, loop, fadeupTime ); }*/ void trap_S_FadeBackgroundTrack( float targetvol, int time, int num){ // yes, i know. fadebackground coming in, fadestreaming going out. will have to see where functionality leads... - Q_syscall( CG_S_FADESTREAMINGSOUND, PASSFLOAT(targetvol), time, num); // 'num' is '0' if it's music, '1' if it's "all streaming sounds" + SystemCall( CG_S_FADESTREAMINGSOUND, PASSFLOAT(targetvol), time, num); // 'num' is '0' if it's music, '1' if it's "all streaming sounds" } void trap_S_FadeAllSound( float targetvol, int time, qboolean stopsounds) { - Q_syscall( CG_S_FADEALLSOUNDS, PASSFLOAT(targetvol), time, stopsounds); + SystemCall( CG_S_FADEALLSOUNDS, PASSFLOAT(targetvol), time, stopsounds); } int trap_S_StartStreamingSound( const char *intro, const char *loop, int entnum, int channel, int attenuation ) { - return Q_syscall( CG_S_STARTSTREAMINGSOUND, intro, loop, entnum, channel, attenuation ); + return SystemCall( CG_S_STARTSTREAMINGSOUND, intro, loop, entnum, channel, attenuation ); } /*void trap_R_LoadWorldMap( const char *mapname ) { CG_DrawInformation(); - Q_syscall( CG_R_LOADWORLDMAP, mapname ); + SystemCall( CG_R_LOADWORLDMAP, mapname ); } qhandle_t trap_R_RegisterModel( const char *name ) { CG_DrawInformation(); - return Q_syscall( CG_R_REGISTERMODEL, name ); + return SystemCall( CG_R_REGISTERMODEL, name ); }*/ //----(SA) added qboolean trap_R_GetSkinModel( qhandle_t skinid, const char *type, char *name ) { - return Q_syscall( CG_R_GETSKINMODEL, skinid, type, name); + return SystemCall( CG_R_GETSKINMODEL, skinid, type, name); } qhandle_t trap_R_GetShaderFromModel( qhandle_t modelid, int surfnum, int withlightmap) { - return Q_syscall( CG_R_GETMODELSHADER, modelid, surfnum, withlightmap); + return SystemCall( CG_R_GETMODELSHADER, modelid, surfnum, withlightmap); } //----(SA) end /*qhandle_t trap_R_RegisterSkin( const char *name ) { CG_DrawInformation(); - return Q_syscall( CG_R_REGISTERSKIN, name ); + return SystemCall( CG_R_REGISTERSKIN, name ); } qhandle_t trap_R_RegisterShader( const char *name ) { CG_DrawInformation(); - return Q_syscall( CG_R_REGISTERSHADER, name ); + return SystemCall( CG_R_REGISTERSHADER, name ); } qhandle_t trap_R_RegisterShaderNoMip( const char *name ) { CG_DrawInformation(); - return Q_syscall( CG_R_REGISTERSHADERNOMIP, name ); + return SystemCall( CG_R_REGISTERSHADERNOMIP, name ); } void trap_R_RegisterFont(const char *fontName, int pointSize, fontInfo_t *font) { - Q_syscall(CG_R_REGISTERFONT, fontName, pointSize, font ); + SystemCall(CG_R_REGISTERFONT, fontName, pointSize, font ); }*/ void trap_R_ClearScene( void ) { - Q_syscall( CG_R_CLEARSCENE ); + SystemCall( CG_R_CLEARSCENE ); } void trap_R_RealAddRefEntityToScene( const refEntity_t *re ) { - Q_syscall( CG_R_ADDREFENTITYTOSCENE, re ); + SystemCall( CG_R_ADDREFENTITYTOSCENE, re ); } void trap_R_RealAddPolyToScene( qhandle_t hShader , int numVerts, const polyVert_t *verts ) { - Q_syscall( CG_R_ADDPOLYTOSCENE, hShader, numVerts, verts ); + SystemCall( CG_R_ADDPOLYTOSCENE, hShader, numVerts, verts ); } void trap_R_RealAddPolyBufferToScene( polyBuffer_t* pPolyBuffer ) { - Q_syscall( CG_R_ADDPOLYBUFFERTOSCENE, pPolyBuffer ); + SystemCall( CG_R_ADDPOLYBUFFERTOSCENE, pPolyBuffer ); } // Ridah void trap_R_RealAddPolysToScene( qhandle_t hShader , int numVerts, const polyVert_t *verts, int numPolys ) { - Q_syscall( CG_R_ADDPOLYSTOSCENE, hShader, numVerts, verts, numPolys ); + SystemCall( CG_R_ADDPOLYSTOSCENE, hShader, numVerts, verts, numPolys ); } // done. // ydnar: new dlight system //% void trap_R_AddLightToScene( const vec3_t org, float intensity, float r, float g, float b, int overdraw ) { -//% Q_syscall( CG_R_ADDLIGHTTOSCENE, org, PASSFLOAT(intensity), PASSFLOAT(r), PASSFLOAT(g), PASSFLOAT(b), overdraw ); +//% SystemCall( CG_R_ADDLIGHTTOSCENE, org, PASSFLOAT(intensity), PASSFLOAT(r), PASSFLOAT(g), PASSFLOAT(b), overdraw ); //% } /*void trap_R_RealAddLightToScene( const vec3_t org, float radius, float intensity, float r, float g, float b, qhandle_t hShader, int flags ) { - Q_syscall( CG_R_ADDLIGHTTOSCENE, org, PASSFLOAT( radius ), PASSFLOAT( intensity ), + SystemCall( CG_R_ADDLIGHTTOSCENE, org, PASSFLOAT( radius ), PASSFLOAT( intensity ), PASSFLOAT( r ), PASSFLOAT( g ), PASSFLOAT( b ), hShader, flags ); }*/ //----(SA) void trap_R_AddCoronaToScene( const vec3_t org, float r, float g, float b, float scale, int id, qboolean visible) { - Q_syscall( CG_R_ADDCORONATOSCENE, org, PASSFLOAT(r), PASSFLOAT(g), PASSFLOAT(b), PASSFLOAT(scale), id, visible); + SystemCall( CG_R_ADDCORONATOSCENE, org, PASSFLOAT(r), PASSFLOAT(g), PASSFLOAT(b), PASSFLOAT(scale), id, visible); } //----(SA) //----(SA) void trap_R_SetFog( int fogvar, int var1, int var2, float r, float g, float b, float density ) { - Q_syscall( CG_R_SETFOG, fogvar, var1, var2, PASSFLOAT(r), PASSFLOAT(g), PASSFLOAT(b), PASSFLOAT(density) ); + SystemCall( CG_R_SETFOG, fogvar, var1, var2, PASSFLOAT(r), PASSFLOAT(g), PASSFLOAT(b), PASSFLOAT(density) ); } //----(SA) void trap_R_SetGlobalFog( qboolean restore, int duration, float r, float g, float b, float depthForOpaque ) { - Q_syscall( CG_R_SETGLOBALFOG, restore, duration, PASSFLOAT(r), PASSFLOAT(g), PASSFLOAT(b), PASSFLOAT(depthForOpaque) ); + SystemCall( CG_R_SETGLOBALFOG, restore, duration, PASSFLOAT(r), PASSFLOAT(g), PASSFLOAT(b), PASSFLOAT(depthForOpaque) ); } void trap_R_RenderScene( const refdef_t *fd ) { - Q_syscall( CG_R_RENDERSCENE, fd ); + SystemCall( CG_R_RENDERSCENE, fd ); } // Mad Doctor I, 11/4/2002. void trap_R_SaveViewParms( ) { - Q_syscall( CG_R_SAVEVIEWPARMS ); + SystemCall( CG_R_SAVEVIEWPARMS ); } // Mad Doctor I, 11/4/2002. void trap_R_RestoreViewParms( ) { - Q_syscall( CG_R_RESTOREVIEWPARMS ); + SystemCall( CG_R_RESTOREVIEWPARMS ); } void trap_R_SetColor( const float *rgba ) { - Q_syscall( CG_R_SETCOLOR, rgba ); + SystemCall( CG_R_SETCOLOR, rgba ); } void trap_R_DrawStretchPic( float x, float y, float w, float h, float s1, float t1, float s2, float t2, qhandle_t hShader ) { - Q_syscall( CG_R_DRAWSTRETCHPIC, PASSFLOAT(x), PASSFLOAT(y), PASSFLOAT(w), PASSFLOAT(h), PASSFLOAT(s1), PASSFLOAT(t1), PASSFLOAT(s2), PASSFLOAT(t2), hShader ); + SystemCall( CG_R_DRAWSTRETCHPIC, PASSFLOAT(x), PASSFLOAT(y), PASSFLOAT(w), PASSFLOAT(h), PASSFLOAT(s1), PASSFLOAT(t1), PASSFLOAT(s2), PASSFLOAT(t2), hShader ); } void trap_R_DrawRotatedPic( float x, float y, float w, float h, float s1, float t1, float s2, float t2, qhandle_t hShader, float angle ) { - Q_syscall( CG_R_DRAWROTATEDPIC, PASSFLOAT(x), PASSFLOAT(y), PASSFLOAT(w), PASSFLOAT(h), PASSFLOAT(s1), PASSFLOAT(t1), PASSFLOAT(s2), PASSFLOAT(t2), hShader, PASSFLOAT(angle) ); + SystemCall( CG_R_DRAWROTATEDPIC, PASSFLOAT(x), PASSFLOAT(y), PASSFLOAT(w), PASSFLOAT(h), PASSFLOAT(s1), PASSFLOAT(t1), PASSFLOAT(s2), PASSFLOAT(t2), hShader, PASSFLOAT(angle) ); } void trap_R_DrawStretchPicGradient( float x, float y, float w, float h, float s1, float t1, float s2, float t2, qhandle_t hShader, const float *gradientColor, int gradientType ) { - Q_syscall( CG_R_DRAWSTRETCHPIC_GRADIENT, PASSFLOAT(x), PASSFLOAT(y), PASSFLOAT(w), PASSFLOAT(h), PASSFLOAT(s1), PASSFLOAT(t1), PASSFLOAT(s2), PASSFLOAT(t2), hShader, gradientColor, gradientType ); + SystemCall( CG_R_DRAWSTRETCHPIC_GRADIENT, PASSFLOAT(x), PASSFLOAT(y), PASSFLOAT(w), PASSFLOAT(h), PASSFLOAT(s1), PASSFLOAT(t1), PASSFLOAT(s2), PASSFLOAT(t2), hShader, gradientColor, gradientType ); } void trap_R_Add2dPolys( polyVert_t* verts, int numverts, qhandle_t hShader ) { - Q_syscall( CG_R_DRAW2DPOLYS, verts, numverts, hShader ); + SystemCall( CG_R_DRAW2DPOLYS, verts, numverts, hShader ); } void trap_R_ModelBounds( clipHandle_t model, vec3_t mins, vec3_t maxs ) { - Q_syscall( CG_R_MODELBOUNDS, model, mins, maxs ); + SystemCall( CG_R_MODELBOUNDS, model, mins, maxs ); } /*int trap_R_LerpTag( orientation_t *tag, const refEntity_t *refent, const char *tagName, int startIndex ) { - return Q_syscall( CG_R_LERPTAG, tag, refent, tagName, startIndex ); + return SystemCall( CG_R_LERPTAG, tag, refent, tagName, startIndex ); }*/ void trap_R_RemapShader( const char *oldShader, const char *newShader, const char *timeOffset ) { - Q_syscall( CG_R_REMAP_SHADER, oldShader, newShader, timeOffset ); + SystemCall( CG_R_REMAP_SHADER, oldShader, newShader, timeOffset ); } void trap_GetGlconfig( glconfig_t *glconfig ) { - Q_syscall( CG_GETGLCONFIG, glconfig ); + SystemCall( CG_GETGLCONFIG, glconfig ); } void trap_GetGameState( gameState_t *gamestate ) { - Q_syscall( CG_GETGAMESTATE, gamestate ); + SystemCall( CG_GETGAMESTATE, gamestate ); } void trap_GetCurrentSnapshotNumber( int *snapshotNumber, int *serverTime ) { - Q_syscall( CG_GETCURRENTSNAPSHOTNUMBER, snapshotNumber, serverTime ); + SystemCall( CG_GETCURRENTSNAPSHOTNUMBER, snapshotNumber, serverTime ); } qboolean trap_GetSnapshot( int snapshotNumber, snapshot_t *snapshot ) { - return Q_syscall( CG_GETSNAPSHOT, snapshotNumber, snapshot ); + return SystemCall( CG_GETSNAPSHOT, snapshotNumber, snapshot ); } qboolean trap_GetServerCommand( int serverCommandNumber ) { - return Q_syscall( CG_GETSERVERCOMMAND, serverCommandNumber ); + return SystemCall( CG_GETSERVERCOMMAND, serverCommandNumber ); } int trap_GetCurrentCmdNumber( void ) { - return Q_syscall( CG_GETCURRENTCMDNUMBER ); + return SystemCall( CG_GETCURRENTCMDNUMBER ); } qboolean trap_GetUserCmd( int cmdNumber, usercmd_t *ucmd ) { - return Q_syscall( CG_GETUSERCMD, cmdNumber, ucmd ); + return SystemCall( CG_GETUSERCMD, cmdNumber, ucmd ); } /*void trap_SetUserCmdValue( int stateValue, int flags, float sensitivityScale, int mpIdentClient ) { - Q_syscall( CG_SETUSERCMDVALUE, stateValue, flags, PASSFLOAT(sensitivityScale), mpIdentClient ); + SystemCall( CG_SETUSERCMDVALUE, stateValue, flags, PASSFLOAT(sensitivityScale), mpIdentClient ); }*/ void trap_SetClientLerpOrigin( float x, float y, float z ) { - Q_syscall( CG_SETCLIENTLERPORIGIN, PASSFLOAT(x), PASSFLOAT(y), PASSFLOAT(z) ); + SystemCall( CG_SETCLIENTLERPORIGIN, PASSFLOAT(x), PASSFLOAT(y), PASSFLOAT(z) ); } void testPrintInt( char *string, int i ) { - Q_syscall( CG_TESTPRINTINT, string, i ); + SystemCall( CG_TESTPRINTINT, string, i ); } void testPrintFloat( char *string, float f ) { - Q_syscall( CG_TESTPRINTFLOAT, string, PASSFLOAT(f) ); + SystemCall( CG_TESTPRINTFLOAT, string, PASSFLOAT(f) ); } int trap_MemoryRemaining( void ) { - return Q_syscall( CG_MEMORY_REMAINING ); + return SystemCall( CG_MEMORY_REMAINING ); } qboolean trap_loadCamera( int camNum, const char *name ) { - return Q_syscall( CG_LOADCAMERA, camNum, name ); + return SystemCall( CG_LOADCAMERA, camNum, name ); } void trap_startCamera(int camNum, int time) { - Q_syscall(CG_STARTCAMERA, camNum, time); + SystemCall(CG_STARTCAMERA, camNum, time); } void trap_stopCamera(int camNum) { - Q_syscall(CG_STOPCAMERA, camNum); + SystemCall(CG_STOPCAMERA, camNum); } qboolean trap_getCameraInfo( int camNum, int time, vec3_t *origin, vec3_t *angles, float *fov) { - return Q_syscall( CG_GETCAMERAINFO, camNum, time, origin, angles, fov ); + return SystemCall( CG_GETCAMERAINFO, camNum, time, origin, angles, fov ); } qboolean trap_Key_IsDown( int keynum ) { - return Q_syscall( CG_KEY_ISDOWN, keynum ); + return SystemCall( CG_KEY_ISDOWN, keynum ); } int trap_Key_GetCatcher( void ) { - return Q_syscall( CG_KEY_GETCATCHER ); + return SystemCall( CG_KEY_GETCATCHER ); } qboolean trap_Key_GetOverstrikeMode( void ) { - return Q_syscall( CG_KEY_GETOVERSTRIKEMODE ); + return SystemCall( CG_KEY_GETOVERSTRIKEMODE ); } void trap_Key_SetOverstrikeMode( qboolean state ) { - Q_syscall( CG_KEY_SETOVERSTRIKEMODE, state ); + SystemCall( CG_KEY_SETOVERSTRIKEMODE, state ); } // binding MUST be lower case void trap_Key_KeysForBinding( const char* binding, int* key1, int* key2 ) { - Q_syscall( CG_KEY_BINDINGTOKEYS, binding, key1, key2 ); + SystemCall( CG_KEY_BINDINGTOKEYS, binding, key1, key2 ); } void trap_Key_SetCatcher( int catcher ) { - Q_syscall( CG_KEY_SETCATCHER, catcher ); + SystemCall( CG_KEY_SETCATCHER, catcher ); } int trap_Key_GetKey( const char *binding ) { - return Q_syscall( CG_KEY_GETKEY, binding ); + return SystemCall( CG_KEY_GETKEY, binding ); } int trap_PC_AddGlobalDefine( const char *define ) { - return Q_syscall( CG_PC_ADD_GLOBAL_DEFINE, define ); + return SystemCall( CG_PC_ADD_GLOBAL_DEFINE, define ); } int trap_PC_LoadSource( const char *filename ) { - return Q_syscall( CG_PC_LOAD_SOURCE, filename ); + return SystemCall( CG_PC_LOAD_SOURCE, filename ); } int trap_PC_FreeSource( int handle ) { - return Q_syscall( CG_PC_FREE_SOURCE, handle ); + return SystemCall( CG_PC_FREE_SOURCE, handle ); } int trap_PC_ReadToken( int handle, pc_token_t *pc_token ) { - return Q_syscall( CG_PC_READ_TOKEN, handle, pc_token ); + return SystemCall( CG_PC_READ_TOKEN, handle, pc_token ); } int trap_PC_SourceFileAndLine( int handle, char *filename, int *line ) { - return Q_syscall( CG_PC_SOURCE_FILE_AND_LINE, handle, filename, line ); + return SystemCall( CG_PC_SOURCE_FILE_AND_LINE, handle, filename, line ); } int trap_PC_UnReadToken( int handle ) { - return Q_syscall( CG_PC_UNREAD_TOKEN, handle ); + return SystemCall( CG_PC_UNREAD_TOKEN, handle ); } void trap_S_StopBackgroundTrack( void ) { - Q_syscall( CG_S_STOPBACKGROUNDTRACK ); + SystemCall( CG_S_STOPBACKGROUNDTRACK ); } int trap_RealTime(qtime_t *qtime) { - return Q_syscall( CG_REAL_TIME, qtime ); + return SystemCall( CG_REAL_TIME, qtime ); } void trap_SnapVector( float *v ) { - Q_syscall( CG_SNAPVECTOR, v ); + SystemCall( CG_SNAPVECTOR, v ); } // this returns a handle. arg0 is the name in the format "idlogo.roq", set arg1 to NULL, alteredstates to qfalse (do not alter gamestate) int trap_CIN_PlayCinematic( const char *arg0, int xpos, int ypos, int width, int height, int bits) { - return Q_syscall(CG_CIN_PLAYCINEMATIC, arg0, xpos, ypos, width, height, bits); + return SystemCall(CG_CIN_PLAYCINEMATIC, arg0, xpos, ypos, width, height, bits); } // stops playing the cinematic and ends it. should always return FMV_EOF // cinematics must be stopped in reverse order of when they are started e_status trap_CIN_StopCinematic(int handle) { - return Q_syscall(CG_CIN_STOPCINEMATIC, handle); + return SystemCall(CG_CIN_STOPCINEMATIC, handle); } // will run a frame of the cinematic but will not draw it. Will return FMV_EOF if the end of the cinematic has been reached. e_status trap_CIN_RunCinematic (int handle) { - return Q_syscall(CG_CIN_RUNCINEMATIC, handle); + return SystemCall(CG_CIN_RUNCINEMATIC, handle); } // draws the current frame void trap_CIN_DrawCinematic (int handle) { - Q_syscall(CG_CIN_DRAWCINEMATIC, handle); + SystemCall(CG_CIN_DRAWCINEMATIC, handle); } // allows you to resize the animation dynamically void trap_CIN_SetExtents (int handle, int x, int y, int w, int h) { - Q_syscall(CG_CIN_SETEXTENTS, handle, x, y, w, h); + SystemCall(CG_CIN_SETEXTENTS, handle, x, y, w, h); } qboolean trap_GetEntityToken( char *buffer, int bufferSize ) { - return Q_syscall( CG_GET_ENTITY_TOKEN, buffer, bufferSize ); + return SystemCall( CG_GET_ENTITY_TOKEN, buffer, bufferSize ); } //----(SA) added @@ -629,23 +629,23 @@ extern void Menus_OpenByName(const char *p); //void trap_UI_Popup( const char *arg0) { void trap_UI_Popup( int arg0 ) { - Q_syscall(CG_INGAME_POPUP, arg0); + SystemCall(CG_INGAME_POPUP, arg0); } void trap_UI_ClosePopup( const char *arg0) { - Q_syscall(CG_INGAME_CLOSEPOPUP, arg0); + SystemCall(CG_INGAME_CLOSEPOPUP, arg0); } void trap_Key_GetBindingBuf( int keynum, char *buf, int buflen ) { - Q_syscall( CG_KEY_GETBINDINGBUF, keynum, buf, buflen ); + SystemCall( CG_KEY_GETBINDINGBUF, keynum, buf, buflen ); } void trap_Key_SetBinding( int keynum, const char *binding ) { - Q_syscall( CG_KEY_SETBINDING, keynum, binding ); + SystemCall( CG_KEY_SETBINDING, keynum, binding ); } void trap_Key_KeynumToStringBuf( int keynum, char *buf, int buflen ) { - Q_syscall( CG_KEY_KEYNUMTOSTRINGBUF, keynum, buf, buflen ); + SystemCall( CG_KEY_KEYNUMTOSTRINGBUF, keynum, buf, buflen ); } #define MAX_VA_STRING 32000 @@ -657,7 +657,7 @@ char* trap_TranslateString( const char *string ) { buf = staticbuf[bufcount++ % 2]; - Q_syscall( CG_TRANSLATE_STRING, string, buf ); + SystemCall( CG_TRANSLATE_STRING, string, buf ); return buf; } @@ -671,7 +671,7 @@ sfxHandle_t trap_S_RealRegisterSound( const char *sample, qboolean compressed ) sfxHandle_t snd; DEBUG_REGISTERPROFILE_INIT // CG_DrawInformation( qtrue ); - snd = Q_syscall( CG_S_REGISTERSOUND, sample, qfalse /* compressed */ ); + snd = SystemCall( CG_S_REGISTERSOUND, sample, qfalse /* compressed */ ); if(!*sample) { Com_Printf("^1Warning: Null Sample filename\n"); } @@ -693,7 +693,7 @@ qhandle_t trap_R_RealRegisterModel( const char *name ) { qhandle_t handle; DEBUG_REGISTERPROFILE_INIT // CG_DrawInformation( qtrue ); - handle = Q_syscall( CG_R_REGISTERMODEL, name ); + handle = SystemCall( CG_R_REGISTERMODEL, name ); DEBUG_REGISTERPROFILE_EXEC("trap_R_RealRegisterModel",name) // trap_PumpEventLoop(); return handle; @@ -703,7 +703,7 @@ qhandle_t trap_R_RegisterSkin( const char *name ) { qhandle_t handle; DEBUG_REGISTERPROFILE_INIT // CG_DrawInformation( qtrue ); - handle = Q_syscall( CG_R_REGISTERSKIN, name ); + handle = SystemCall( CG_R_REGISTERSKIN, name ); DEBUG_REGISTERPROFILE_EXEC("trap_R_RegisterSkin",name) // trap_PumpEventLoop(); return handle; @@ -713,7 +713,7 @@ qhandle_t trap_R_RegisterShader( const char *name ) { qhandle_t handle; DEBUG_REGISTERPROFILE_INIT // CG_DrawInformation( qtrue ); - handle = Q_syscall( CG_R_REGISTERSHADER, name ); + handle = SystemCall( CG_R_REGISTERSHADER, name ); DEBUG_REGISTERPROFILE_EXEC("trap_R_RegisterShader",name) // trap_PumpEventLoop(); return handle; @@ -723,7 +723,7 @@ qhandle_t trap_R_RegisterShaderNoMip( const char *name ) { qhandle_t handle; DEBUG_REGISTERPROFILE_INIT // CG_DrawInformation( qtrue ); - handle = Q_syscall( CG_R_REGISTERSHADERNOMIP, name ); + handle = SystemCall( CG_R_REGISTERSHADERNOMIP, name ); // trap_PumpEventLoop(); return handle; } @@ -731,7 +731,7 @@ qhandle_t trap_R_RegisterShaderNoMip( const char *name ) { void trap_R_RegisterFont(const char *fontName, int pointSize, fontInfo_t *font) { DEBUG_REGISTERPROFILE_INIT // CG_DrawInformation( qtrue ); - Q_syscall(CG_R_REGISTERFONT, fontName, pointSize, font ); + SystemCall(CG_R_REGISTERFONT, fontName, pointSize, font ); DEBUG_REGISTERPROFILE_EXEC("trap_R_RegisterFont",fontName) // trap_PumpEventLoop(); } @@ -739,7 +739,7 @@ void trap_R_RegisterFont(const char *fontName, int pointSize, fontInfo_t *font) void trap_CM_LoadMap( const char *mapname ) { DEBUG_REGISTERPROFILE_INIT // CG_DrawInformation( qtrue ); - Q_syscall( CG_CM_LOADMAP, mapname ); + SystemCall( CG_CM_LOADMAP, mapname ); DEBUG_REGISTERPROFILE_EXEC("trap_CM_LoadMap",mapname) // trap_PumpEventLoop(); } @@ -747,7 +747,7 @@ void trap_CM_LoadMap( const char *mapname ) { void trap_R_LoadWorldMap( const char *mapname ) { DEBUG_REGISTERPROFILE_INIT // CG_DrawInformation( qtrue ); - Q_syscall( CG_R_LOADWORLDMAP, mapname ); + SystemCall( CG_R_LOADWORLDMAP, mapname ); DEBUG_REGISTERPROFILE_EXEC("trap_R_LoadWorldMap",mapname) // trap_PumpEventLoop(); } @@ -755,71 +755,105 @@ void trap_R_LoadWorldMap( const char *mapname ) { sfxHandle_t trap_S_RealRegisterSound( const char *sample, qboolean compressed ) { // CG_DrawInformation( qtrue ); // trap_PumpEventLoop(); - return Q_syscall( CG_S_REGISTERSOUND, sample, qfalse /* compressed */ ); + return SystemCall( CG_S_REGISTERSOUND, sample, qfalse /* compressed */ ); } qhandle_t trap_R_RealRegisterModel( const char *name ) { // CG_DrawInformation( qtrue ); // trap_PumpEventLoop(); - return Q_syscall( CG_R_REGISTERMODEL, name ); + return SystemCall( CG_R_REGISTERMODEL, name ); } qhandle_t trap_R_RegisterSkin( const char *name ) { // CG_DrawInformation( qtrue ); // trap_PumpEventLoop(); - return Q_syscall( CG_R_REGISTERSKIN, name ); + return SystemCall( CG_R_REGISTERSKIN, name ); } qhandle_t trap_R_RegisterShader( const char *name ) { // CG_DrawInformation( qtrue ); // trap_PumpEventLoop(); - return Q_syscall( CG_R_REGISTERSHADER, name ); + return SystemCall( CG_R_REGISTERSHADER, name ); } qhandle_t trap_R_RegisterShaderNoMip( const char *name ) { // CG_DrawInformation( qtrue ); // trap_PumpEventLoop(); - return Q_syscall( CG_R_REGISTERSHADERNOMIP, name ); + return SystemCall( CG_R_REGISTERSHADERNOMIP, name ); } void trap_R_RegisterFont(const char *fontName, int pointSize, fontInfo_t *font) { // CG_DrawInformation( qtrue ); // trap_PumpEventLoop(); - Q_syscall(CG_R_REGISTERFONT, fontName, pointSize, font ); + SystemCall(CG_R_REGISTERFONT, fontName, pointSize, font ); } void trap_CM_LoadMap( const char *mapname ) { // CG_DrawInformation( qtrue ); // trap_PumpEventLoop(); - Q_syscall( CG_CM_LOADMAP, mapname ); + SystemCall( CG_CM_LOADMAP, mapname ); } void trap_R_LoadWorldMap( const char *mapname ) { // CG_DrawInformation( qtrue ); // trap_PumpEventLoop(); - Q_syscall( CG_R_LOADWORLDMAP, mapname ); + SystemCall( CG_R_LOADWORLDMAP, mapname ); } #endif // _DEBUG qboolean trap_R_inPVS( const vec3_t p1, const vec3_t p2 ) { - return Q_syscall( CG_R_INPVS, p1, p2 ); + return SystemCall( CG_R_INPVS, p1, p2 ); } void trap_GetHunkData( int* hunkused, int* hunkexpected ) { - Q_syscall( CG_GETHUNKDATA, hunkused, hunkexpected ); + SystemCall( CG_GETHUNKDATA, hunkused, hunkexpected ); +} + +//zinx - binary message channel +void trap_SendMessage( char *buf, int buflen ) { + syscall( CG_SENDMESSAGE, buf, buflen ); + SystemCall( CG_SENDMESSAGE, buf, buflen ); +} + +messageStatus_t trap_MessageStatus( void ) { + return syscall( CG_MESSAGESTATUS ); + return SystemCall( CG_MESSAGESTATUS ); +} + +//bani - dynamic shaders +qboolean trap_R_LoadDynamicShader( const char *shadername, const char *shadertext ) { + return syscall( CG_R_LOADDYNAMICSHADER, shadername, shadertext ); + return SystemCall( CG_R_LOADDYNAMICSHADER, shadername, shadertext ); +} + +// fretn - render to texture +void trap_R_RenderToTexture( int textureid, int x, int y, int w, int h ) { + syscall( CG_R_RENDERTOTEXTURE, textureid, x, y, w, h ); + SystemCall( CG_R_RENDERTOTEXTURE, textureid, x, y, w, h ); +} + +int trap_R_GetTextureId( const char *name ) { + return syscall( CG_R_GETTEXTUREID, name ); + return SystemCall( CG_R_GETTEXTUREID, name ); +} + +// bani - sync rendering +void trap_R_Finish( void ) { + syscall( CG_R_FINISH ); + SystemCall( CG_R_FINISH ); } // extension interface qboolean trap_GetValue( char *value, int valueSize, const char *key ) { - return Q_syscall( dll_com_trapGetValue, value, valueSize, key ); + return SystemCall( dll_com_trapGetValue, value, valueSize, key ); } void trap_R_AddRefEntityToScene2( const refEntity_t *re ) { - Q_syscall( dll_trap_R_AddRefEntityToScene2, re ); + SystemCall( dll_trap_R_AddRefEntityToScene2, re ); } void trap_R_AddLinearLightToScene( const vec3_t start, const vec3_t end, float intensity, float r, float g, float b ) { - Q_syscall( dll_trap_R_AddLinearLightToScene, start, end, intensity, r, g, b ); + SystemCall( dll_trap_R_AddLinearLightToScene, start, end, intensity, r, g, b ); } diff --git a/code/api/et/g_public.h b/code/api/et/g_public.h index 6140ff5..82b1726 100644 --- a/code/api/et/g_public.h +++ b/code/api/et/g_public.h @@ -68,7 +68,7 @@ If you have questions concerning this license or the applicable additional terms //=============================================================== -typedef qboolean (*addToSnapshotCallback)( int entityNum, int clientNum ); +//typedef qboolean (*addToSnapshotCallback)( int entityNum, int clientNum ); typedef struct { // entityState_t s; // communicated by server to clients @@ -125,7 +125,7 @@ typedef struct { typedef enum { //============== general Quake services ================== - G_PRINT, // ( const char *string ); + G_PRINT = 0, // ( const char *string ); // print message on the local console G_ERROR, // ( const char *string ); @@ -452,7 +452,12 @@ typedef enum { BOTLIB_PC_SOURCE_FILE_AND_LINE, BOTLIB_PC_UNREAD_TOKEN, - PB_STAT_REPORT + PB_STAT_REPORT, + + // zinx + G_SENDMESSAGE, + G_MESSAGESTATUS, + // -zinx } gameImport_t; @@ -492,11 +497,18 @@ typedef enum { GAME_SNAPSHOT_CALLBACK, // ( int entityNum, int clientNum ); // return qfalse if you don't want it to be added - BOTAI_START_FRAME // ( int time ); + BOTAI_START_FRAME, // ( int time ); // Ridah, Cast AI - ,BOT_VISIBLEFROMPOS - ,BOT_CHECKATTACKATPOS + BOT_VISIBLEFROMPOS, + BOT_CHECKATTACKATPOS, // done. + + // zinx + GAME_MESSAGERECEIVED, // ( int cno, const char *buf, int buflen, int commandTime ); + // -zinx + + GAME_EXPORT_LAST + } gameExport_t; diff --git a/code/api/et/g_syscalls.c b/code/api/et/g_syscalls.c index aef8a96..e828b5b 100644 --- a/code/api/et/g_syscalls.c +++ b/code/api/et/g_syscalls.c @@ -32,103 +32,103 @@ If you have questions concerning this license or the applicable additional terms #include "../../game/g_local.h" -static intptr_t (QDECL *Q_syscall)( intptr_t arg, ... ) = (intptr_t (QDECL *)( intptr_t, ...))-1; +static dllSyscall_t syscall = (dllSyscall_t)-1; -Q_EXPORT void dllEntry( intptr_t (QDECL *syscallptr)( intptr_t arg,... ) ) { - Q_syscall = syscallptr; +Q_EXPORT void dllEntry( dllSyscall_t syscallptr ) { + syscall = syscallptr; } uintptr_t G_GetSyscall(void) { - return (uintptr_t)Q_syscall; + return (uintptr_t)syscall; } -int PASSFLOAT( float x ) { +/*static int PASSFLOAT( float x ) { byteAlias_t fi; fi.f = x; return fi.i; -} +}*/ #include "../shared/g_shared_syscalls.c" void trap_Print( const char *str ) { - Q_syscall( G_PRINT, str ); + SystemCall( G_PRINT, str ); } void NORETURN trap_Error( const char *str ) { - Q_syscall( G_ERROR, str ); + SystemCall( G_ERROR, str ); exit( 1 ); } int trap_Milliseconds( void ) { - return Q_syscall( G_MILLISECONDS ); + return SystemCall( G_MILLISECONDS ); } int trap_Argc( void ) { - return Q_syscall( G_ARGC ); + return SystemCall( G_ARGC ); } void trap_Argv( int n, char *buffer, int bufferLength ) { - Q_syscall( G_ARGV, n, buffer, bufferLength ); + SystemCall( G_ARGV, n, buffer, bufferLength ); } int trap_FS_FOpenFile( const char *qpath, fileHandle_t *f, fsMode_t mode ) { - return Q_syscall( G_FS_FOPEN_FILE, qpath, f, mode ); + return SystemCall( G_FS_FOPEN_FILE, qpath, f, mode ); } void trap_FS_Read( void *buffer, int len, fileHandle_t f ) { - Q_syscall( G_FS_READ, buffer, len, f ); + SystemCall( G_FS_READ, buffer, len, f ); } int trap_FS_Write( const void *buffer, int len, fileHandle_t f ) { - return Q_syscall( G_FS_WRITE, buffer, len, f ); + return SystemCall( G_FS_WRITE, buffer, len, f ); } int trap_FS_Rename( const char *from, const char *to ) { - return Q_syscall( G_FS_RENAME, from, to ); + return SystemCall( G_FS_RENAME, from, to ); } void trap_FS_FCloseFile( fileHandle_t f ) { - Q_syscall( G_FS_FCLOSE_FILE, f ); + SystemCall( G_FS_FCLOSE_FILE, f ); } int trap_FS_GetFileList( const char *path, const char *extension, char *listbuf, int bufsize ) { - return Q_syscall( G_FS_GETFILELIST, path, extension, listbuf, bufsize ); + return SystemCall( G_FS_GETFILELIST, path, extension, listbuf, bufsize ); } void trap_SendConsoleCommand( int exec_when, const char *text ) { - Q_syscall( G_SEND_CONSOLE_COMMAND, exec_when, text ); + SystemCall( G_SEND_CONSOLE_COMMAND, exec_when, text ); } void trap_Cvar_Register( vmCvar_t *cvar, const char *var_name, const char *value, int flags ) { - Q_syscall( G_CVAR_REGISTER, cvar, var_name, value, flags ); + SystemCall( G_CVAR_REGISTER, cvar, var_name, value, flags ); } void trap_Cvar_Update( vmCvar_t *cvar ) { - Q_syscall( G_CVAR_UPDATE, cvar ); + SystemCall( G_CVAR_UPDATE, cvar ); } void trap_Cvar_Set( const char *var_name, const char *value ) { - Q_syscall( G_CVAR_SET, var_name, value ); + SystemCall( G_CVAR_SET, var_name, value ); } int trap_Cvar_VariableIntegerValue( const char *var_name ) { - return Q_syscall( G_CVAR_VARIABLE_INTEGER_VALUE, var_name ); + return SystemCall( G_CVAR_VARIABLE_INTEGER_VALUE, var_name ); } void trap_Cvar_VariableStringBuffer( const char *var_name, char *buffer, int bufsize ) { - Q_syscall( G_CVAR_VARIABLE_STRING_BUFFER, var_name, buffer, bufsize ); + SystemCall( G_CVAR_VARIABLE_STRING_BUFFER, var_name, buffer, bufsize ); } void trap_Cvar_LatchedVariableStringBuffer( const char *var_name, char *buffer, int bufsize ) { - Q_syscall( G_CVAR_LATCHEDVARIABLESTRINGBUFFER, var_name, buffer, bufsize ); + SystemCall( G_CVAR_LATCHEDVARIABLESTRINGBUFFER, var_name, buffer, bufsize ); } void trap_LocateGameData( gentity_t *gEnts, int numGEntities, int sizeofGEntity_t, playerState_t *clients, int sizeofGClient ) { - Q_syscall( G_LOCATE_GAME_DATA, gEnts, numGEntities, sizeofGEntity_t, clients, sizeofGClient ); + SystemCall( G_LOCATE_GAME_DATA, gEnts, numGEntities, sizeofGEntity_t, clients, sizeofGClient ); } /*void trap_DropClient( int clientNum, const char *reason, int length ) { - Q_syscall( G_DROP_CLIENT, clientNum, reason, length ); + SystemCall( G_DROP_CLIENT, clientNum, reason, length ); }*/ void trap_SendServerCommand( int clientNum, const char *text ) { @@ -140,798 +140,200 @@ void trap_SendServerCommand( int clientNum, const char *text ) { G_LogPrintf( "text [%.950s]... truncated\n", text ); return; } - Q_syscall( G_SEND_SERVER_COMMAND, clientNum, text ); + SystemCall( G_SEND_SERVER_COMMAND, clientNum, text ); } void trap_SetConfigstring( int num, const char *string ) { - Q_syscall( G_SET_CONFIGSTRING, num, string ); + SystemCall( G_SET_CONFIGSTRING, num, string ); } void trap_GetConfigstring( int num, char *buffer, int bufferSize ) { - Q_syscall( G_GET_CONFIGSTRING, num, buffer, bufferSize ); + SystemCall( G_GET_CONFIGSTRING, num, buffer, bufferSize ); } void trap_GetUserinfo( int num, char *buffer, int bufferSize ) { - Q_syscall( G_GET_USERINFO, num, buffer, bufferSize ); + SystemCall( G_GET_USERINFO, num, buffer, bufferSize ); } void trap_SetUserinfo( int num, const char *buffer ) { - Q_syscall( G_SET_USERINFO, num, buffer ); + SystemCall( G_SET_USERINFO, num, buffer ); } void trap_GetServerinfo( char *buffer, int bufferSize ) { - Q_syscall( G_GET_SERVERINFO, buffer, bufferSize ); + SystemCall( G_GET_SERVERINFO, buffer, bufferSize ); } void trap_SetBrushModel( gentity_t *ent, const char *name ) { - Q_syscall( G_SET_BRUSH_MODEL, ent, name ); + SystemCall( G_SET_BRUSH_MODEL, ent, name ); } void trap_Trace( trace_t *results, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int passEntityNum, int contentmask ) { - Q_syscall( G_TRACE, results, start, mins, maxs, end, passEntityNum, contentmask ); + SystemCall( G_TRACE, results, start, mins, maxs, end, passEntityNum, contentmask ); } void trap_TraceNoEnts( trace_t *results, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int passEntityNum, int contentmask ) { - Q_syscall( G_TRACE, results, start, mins, maxs, end, -2, contentmask ); + SystemCall( G_TRACE, results, start, mins, maxs, end, -2, contentmask ); } void trap_TraceCapsule( trace_t *results, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int passEntityNum, int contentmask ) { - Q_syscall( G_TRACECAPSULE, results, start, mins, maxs, end, passEntityNum, contentmask ); + SystemCall( G_TRACECAPSULE, results, start, mins, maxs, end, passEntityNum, contentmask ); } void trap_TraceCapsuleNoEnts( trace_t *results, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int passEntityNum, int contentmask ) { - Q_syscall( G_TRACECAPSULE, results, start, mins, maxs, end, -2, contentmask ); + SystemCall( G_TRACECAPSULE, results, start, mins, maxs, end, -2, contentmask ); } int trap_PointContents( const vec3_t point, int passEntityNum ) { - return Q_syscall( G_POINT_CONTENTS, point, passEntityNum ); + return SystemCall( G_POINT_CONTENTS, point, passEntityNum ); } qboolean trap_InPVS( const vec3_t p1, const vec3_t p2 ) { - return Q_syscall( G_IN_PVS, p1, p2 ); + return SystemCall( G_IN_PVS, p1, p2 ); } qboolean trap_InPVSIgnorePortals( const vec3_t p1, const vec3_t p2 ) { - return Q_syscall( G_IN_PVS_IGNORE_PORTALS, p1, p2 ); + return SystemCall( G_IN_PVS_IGNORE_PORTALS, p1, p2 ); } void trap_AdjustAreaPortalState( gentity_t *ent, qboolean open ) { - Q_syscall( G_ADJUST_AREA_PORTAL_STATE, ent, open ); + SystemCall( G_ADJUST_AREA_PORTAL_STATE, ent, open ); } qboolean trap_AreasConnected( int area1, int area2 ) { - return Q_syscall( G_AREAS_CONNECTED, area1, area2 ); + return SystemCall( G_AREAS_CONNECTED, area1, area2 ); } -void trap_LinkEntity( gentity_t *ent ) { - if(trap_Cvar_VariableIntegerValue("developer") && ent /*&& ent->inuse */&& !ent->r.bmodel && VectorCompare(ent->r.currentOrigin, vec3_origin)) +void trap_LinkEntityExt( gentity_t *ent, const char *file, int line ) { + if(trap_Cvar_VariableIntegerValue("developer") && ent /*&& ent->inuse */&& !ent->r.bmodel && VectorCompare(ent->r.currentOrigin, vec3_origin)) { G_Printf("WARNING: BBOX entity {%s} is being linked at world origin, this is probably a bug\n", ent->classname); + G_Printf("File: %s, Line: %i\n", file, line ); + } - Q_syscall( G_LINKENTITY, ent ); + SystemCall( G_LINKENTITY, ent ); } void trap_UnlinkEntity( gentity_t *ent ) { - Q_syscall( G_UNLINKENTITY, ent ); + SystemCall( G_UNLINKENTITY, ent ); } int trap_EntitiesInBox( const vec3_t mins, const vec3_t maxs, int *list, int maxcount ) { - return Q_syscall( G_ENTITIES_IN_BOX, mins, maxs, list, maxcount ); + return SystemCall( G_ENTITIES_IN_BOX, mins, maxs, list, maxcount ); } qboolean trap_EntityContact( const vec3_t mins, const vec3_t maxs, const gentity_t *ent ) { - return Q_syscall( G_ENTITY_CONTACT, mins, maxs, ent ); + return SystemCall( G_ENTITY_CONTACT, mins, maxs, ent ); } qboolean trap_EntityContactCapsule( const vec3_t mins, const vec3_t maxs, const gentity_t *ent ) { - return Q_syscall( G_ENTITY_CONTACTCAPSULE, mins, maxs, ent ); + return SystemCall( G_ENTITY_CONTACTCAPSULE, mins, maxs, ent ); } int trap_BotAllocateClient( int clientNum ) { - return Q_syscall( G_BOT_ALLOCATE_CLIENT, clientNum ); + return SystemCall( G_BOT_ALLOCATE_CLIENT, clientNum ); } void trap_BotFreeClient( int clientNum ) { - Q_syscall( G_BOT_FREE_CLIENT, clientNum ); + SystemCall( G_BOT_FREE_CLIENT, clientNum ); } int trap_GetSoundLength(sfxHandle_t sfxHandle) { - return Q_syscall( G_GET_SOUND_LENGTH, sfxHandle ); + return SystemCall( G_GET_SOUND_LENGTH, sfxHandle ); } sfxHandle_t trap_RegisterSound( const char *sample, qboolean compressed ) { - return Q_syscall( G_REGISTERSOUND, sample, compressed ); + return SystemCall( G_REGISTERSOUND, sample, compressed ); } void trap_GetUsercmd( int clientNum, usercmd_t *cmd ) { - Q_syscall( G_GET_USERCMD, clientNum, cmd ); + SystemCall( G_GET_USERCMD, clientNum, cmd ); } qboolean trap_GetEntityToken( char *buffer, int bufferSize ) { - return Q_syscall( G_GET_ENTITY_TOKEN, buffer, bufferSize ); + return SystemCall( G_GET_ENTITY_TOKEN, buffer, bufferSize ); } int trap_DebugPolygonCreate(int color, int numPoints, vec3_t *points) { - return Q_syscall( G_DEBUG_POLYGON_CREATE, color, numPoints, points ); + return SystemCall( G_DEBUG_POLYGON_CREATE, color, numPoints, points ); } void trap_DebugPolygonDelete(int id) { - Q_syscall( G_DEBUG_POLYGON_DELETE, id ); + SystemCall( G_DEBUG_POLYGON_DELETE, id ); } int trap_RealTime( qtime_t *qtime ) { - return Q_syscall( G_REAL_TIME, qtime ); + return SystemCall( G_REAL_TIME, qtime ); } void trap_SnapVector( float *v ) { - Q_syscall( G_SNAPVECTOR, v ); + SystemCall( G_SNAPVECTOR, v ); return; } qboolean trap_GetTag( int clientNum, int tagFileNumber, char *tagName, orientation_t *or ) { - return Q_syscall( G_GETTAG, clientNum, tagFileNumber, tagName, or ); + return SystemCall( G_GETTAG, clientNum, tagFileNumber, tagName, or ); } qboolean trap_LoadTag( const char* filename ) { - return Q_syscall( G_REGISTERTAG, filename ); + return SystemCall( G_REGISTERTAG, filename ); } // BotLib traps start here -int trap_BotLibSetup( void ) { - return Q_syscall( BOTLIB_SETUP ); -} - -int trap_BotLibShutdown( void ) { - return Q_syscall( BOTLIB_SHUTDOWN ); -} - -int trap_BotLibVarSet(char *var_name, char *value) { - return Q_syscall( BOTLIB_LIBVAR_SET, var_name, value ); -} - -int trap_BotLibVarGet(char *var_name, char *value, int size) { - return Q_syscall( BOTLIB_LIBVAR_GET, var_name, value, size ); -} - -int trap_BotLibDefine(char *string) { - return Q_syscall( BOTLIB_PC_ADD_GLOBAL_DEFINE, string ); -} - int trap_PC_AddGlobalDefine( const char *define ) { - return Q_syscall( BOTLIB_PC_ADD_GLOBAL_DEFINE, define ); + return SystemCall( BOTLIB_PC_ADD_GLOBAL_DEFINE, define ); } int trap_PC_LoadSource( const char *filename ) { - return Q_syscall( BOTLIB_PC_LOAD_SOURCE, filename ); + return SystemCall( BOTLIB_PC_LOAD_SOURCE, filename ); } int trap_PC_FreeSource( int handle ) { - return Q_syscall( BOTLIB_PC_FREE_SOURCE, handle ); + return SystemCall( BOTLIB_PC_FREE_SOURCE, handle ); } int trap_PC_ReadToken( int handle, pc_token_t *pc_token ) { - return Q_syscall( BOTLIB_PC_READ_TOKEN, handle, pc_token ); + return SystemCall( BOTLIB_PC_READ_TOKEN, handle, pc_token ); } int trap_PC_SourceFileAndLine( int handle, char *filename, int *line ) { - return Q_syscall( BOTLIB_PC_SOURCE_FILE_AND_LINE, handle, filename, line ); + return SystemCall( BOTLIB_PC_SOURCE_FILE_AND_LINE, handle, filename, line ); } int trap_PC_UnReadToken( int handle ) { - return Q_syscall( BOTLIB_PC_UNREAD_TOKEN, handle ); -} - -int trap_BotLibStartFrame(float time) { - return Q_syscall( BOTLIB_START_FRAME, PASSFLOAT( time ) ); -} - -int trap_BotLibLoadMap(const char *mapname) { - return Q_syscall( BOTLIB_LOAD_MAP, mapname ); -} - -int trap_BotLibUpdateEntity(int ent, void /* struct bot_updateentity_s */ *bue) { - return Q_syscall( BOTLIB_UPDATENTITY, ent, bue ); -} - -int trap_BotLibTest(int parm0, char *parm1, vec3_t parm2, vec3_t parm3) { - return Q_syscall( BOTLIB_TEST, parm0, parm1, parm2, parm3 ); + return SystemCall( BOTLIB_PC_UNREAD_TOKEN, handle ); } int trap_BotGetSnapshotEntity( int clientNum, int sequence ) { - return Q_syscall( BOTLIB_GET_SNAPSHOT_ENTITY, clientNum, sequence ); + return SystemCall( BOTLIB_GET_SNAPSHOT_ENTITY, clientNum, sequence ); } int trap_BotGetServerCommand(int clientNum, char *message, int size) { - return Q_syscall( BOTLIB_GET_CONSOLE_MESSAGE, clientNum, message, size ); + return SystemCall( BOTLIB_GET_CONSOLE_MESSAGE, clientNum, message, size ); } void trap_BotUserCommand(int clientNum, usercmd_t *ucmd) { - Q_syscall( BOTLIB_USER_COMMAND, clientNum, ucmd ); -} - -void trap_AAS_EntityInfo(int entnum, void /* struct aas_entityinfo_s */ *info) { - Q_syscall( BOTLIB_AAS_ENTITY_INFO, entnum, info ); -} - -int trap_AAS_Initialized(void) { - return Q_syscall( BOTLIB_AAS_INITIALIZED ); -} - -void trap_AAS_PresenceTypeBoundingBox(int presencetype, vec3_t mins, vec3_t maxs) { - Q_syscall( BOTLIB_AAS_PRESENCE_TYPE_BOUNDING_BOX, presencetype, mins, maxs ); -} - -float trap_AAS_Time(void) { - byteAlias_t fi; - fi.i = Q_syscall( BOTLIB_AAS_TIME ); - return fi.f; -} - -// Ridah, multiple AAS files -void trap_AAS_SetCurrentWorld(int index) { - // Gordon: stubbed out: we only use one aas -// Q_syscall( BOTLIB_AAS_SETCURRENTWORLD, index ); -} -// done. - -int trap_AAS_PointAreaNum(vec3_t point) { - return Q_syscall( BOTLIB_AAS_POINT_AREA_NUM, point ); -} - -int trap_AAS_TraceAreas(vec3_t start, vec3_t end, int *areas, vec3_t *points, int maxareas) { - return Q_syscall( BOTLIB_AAS_TRACE_AREAS, start, end, areas, points, maxareas ); -} - -int trap_AAS_BBoxAreas(vec3_t absmins, vec3_t absmaxs, int *areas, int maxareas) { - return Q_syscall( BOTLIB_AAS_BBOX_AREAS, absmins, absmaxs, areas, maxareas); -} - -void trap_AAS_AreaCenter(int areanum, vec3_t center) { - Q_syscall( BOTLIB_AAS_AREA_CENTER, areanum, center); -} - -qboolean trap_AAS_AreaWaypoint(int areanum, vec3_t center) { - return Q_syscall( BOTLIB_AAS_AREA_WAYPOINT, areanum, center); -} - -int trap_AAS_PointContents(vec3_t point) { - return Q_syscall( BOTLIB_AAS_POINT_CONTENTS, point ); -} - -int trap_AAS_NextBSPEntity(int ent) { - return Q_syscall( BOTLIB_AAS_NEXT_BSP_ENTITY, ent ); -} - -int trap_AAS_ValueForBSPEpairKey(int ent, char *key, char *value, int size) { - return Q_syscall( BOTLIB_AAS_VALUE_FOR_BSP_EPAIR_KEY, ent, key, value, size ); -} - -int trap_AAS_VectorForBSPEpairKey(int ent, char *key, vec3_t v) { - return Q_syscall( BOTLIB_AAS_VECTOR_FOR_BSP_EPAIR_KEY, ent, key, v ); -} - -int trap_AAS_FloatForBSPEpairKey(int ent, char *key, float *value) { - return Q_syscall( BOTLIB_AAS_FLOAT_FOR_BSP_EPAIR_KEY, ent, key, value ); -} - -int trap_AAS_IntForBSPEpairKey(int ent, char *key, int *value) { - return Q_syscall( BOTLIB_AAS_INT_FOR_BSP_EPAIR_KEY, ent, key, value ); -} - -int trap_AAS_AreaReachability(int areanum) { - return Q_syscall( BOTLIB_AAS_AREA_REACHABILITY, areanum ); -} - -int trap_AAS_AreaLadder(int areanum) { - return Q_syscall( BOTLIB_AAS_AREA_LADDER, areanum ); -} - -int trap_AAS_AreaTravelTimeToGoalArea(int areanum, vec3_t origin, int goalareanum, int travelflags) { - return Q_syscall( BOTLIB_AAS_AREA_TRAVEL_TIME_TO_GOAL_AREA, areanum, origin, goalareanum, travelflags ); -} - -int trap_AAS_Swimming(vec3_t origin) { - return Q_syscall( BOTLIB_AAS_SWIMMING, origin ); -} - -int trap_AAS_PredictClientMovement(void /* struct aas_clientmove_s */ *move, int entnum, vec3_t origin, int presencetype, int onground, vec3_t velocity, vec3_t cmdmove, int cmdframes, int maxframes, float frametime, int stopevent, int stopareanum, int visualize) { - return Q_syscall( BOTLIB_AAS_PREDICT_CLIENT_MOVEMENT, move, entnum, origin, presencetype, onground, velocity, cmdmove, cmdframes, maxframes, PASSFLOAT(frametime), stopevent, stopareanum, visualize ); -} - -// Ridah, route-tables -void trap_AAS_RT_ShowRoute( vec3_t srcpos, int srcnum, int destnum ) { - Q_syscall( BOTLIB_AAS_RT_SHOWROUTE, srcpos, srcnum, destnum ); -} - -//qboolean trap_AAS_RT_GetHidePos( vec3_t srcpos, int srcnum, int srcarea, vec3_t destpos, int destnum, int destarea, vec3_t returnPos ) { -// return Q_syscall( BOTLIB_AAS_RT_GETHIDEPOS, srcpos, srcnum, srcarea, destpos, destnum, destarea, returnPos ); -//} - -//int trap_AAS_FindAttackSpotWithinRange(int srcnum, int rangenum, int enemynum, float rangedist, int travelflags, float *outpos) { -// return Q_syscall( BOTLIB_AAS_FINDATTACKSPOTWITHINRANGE, srcnum, rangenum, enemynum, PASSFLOAT(rangedist), travelflags, outpos ); -//} - -int trap_AAS_NearestHideArea(int srcnum, vec3_t origin, int areanum, int enemynum, vec3_t enemyorigin, int enemyareanum, int travelflags, float maxdist, vec3_t distpos) -{ - return Q_syscall( BOTLIB_AAS_NEARESTHIDEAREA, srcnum, origin, areanum, enemynum, enemyorigin, enemyareanum, travelflags, PASSFLOAT(maxdist), distpos ); -} - -int trap_AAS_ListAreasInRange(vec3_t srcpos, int srcarea, float range, int travelflags, float **outareas, int maxareas) { - return Q_syscall( BOTLIB_AAS_LISTAREASINRANGE, srcpos, srcarea, PASSFLOAT(range), travelflags, outareas, maxareas ); -} - -int trap_AAS_AvoidDangerArea(vec3_t srcpos, int srcarea, vec3_t dangerpos, int dangerarea, float range, int travelflags) { - return Q_syscall( BOTLIB_AAS_AVOIDDANGERAREA, srcpos, srcarea, dangerpos, dangerarea, PASSFLOAT(range), travelflags ); -} - -int trap_AAS_Retreat -( - // Locations of the danger spots (AAS area numbers) - int *dangerSpots, - // The number of danger spots - int dangerSpotCount, - vec3_t srcpos, - int srcarea, - vec3_t dangerpos, - int dangerarea, - // Min range from startpos - float range, - // Min range from danger - float dangerRange, - int travelflags -) -{ - return Q_syscall( BOTLIB_AAS_RETREAT, dangerSpots, dangerSpotCount, srcpos, srcarea, dangerpos, dangerarea, PASSFLOAT(range), PASSFLOAT(dangerRange),travelflags ); -} - -int trap_AAS_AlternativeRouteGoals(vec3_t start, vec3_t goal, int travelflags, - void *altroutegoals, int maxaltroutegoals, - int color) { - return Q_syscall( BOTLIB_AAS_ALTROUTEGOALS, start, goal, travelflags, altroutegoals, maxaltroutegoals, color ); -} - -void trap_AAS_SetAASBlockingEntity( vec3_t absmin, vec3_t absmax, int blocking ) { - Q_syscall( BOTLIB_AAS_SETAASBLOCKINGENTITY, absmin, absmax, blocking ); -} - -void trap_AAS_RecordTeamDeathArea( vec3_t srcpos, int srcarea, int team, int teamCount, int travelflags ) { - Q_syscall( BOTLIB_AAS_RECORDTEAMDEATHAREA, srcpos, srcarea, team, teamCount, travelflags ); -} -// done. - -void trap_EA_Say(int client, char *str) { - Q_syscall( BOTLIB_EA_SAY, client, str ); -} - -void trap_EA_SayTeam(int client, char *str) { - Q_syscall( BOTLIB_EA_SAY_TEAM, client, str ); -} - -void trap_EA_UseItem(int client, char *it) { - Q_syscall( BOTLIB_EA_USE_ITEM, client, it ); -} - -void trap_EA_DropItem(int client, char *it) { - Q_syscall( BOTLIB_EA_DROP_ITEM, client, it ); -} - -void trap_EA_UseInv(int client, char *inv) { - Q_syscall( BOTLIB_EA_USE_INV, client, inv ); -} - -void trap_EA_DropInv(int client, char *inv) { - Q_syscall( BOTLIB_EA_DROP_INV, client, inv ); -} - -void trap_EA_Gesture(int client) { - Q_syscall( BOTLIB_EA_GESTURE, client ); + SystemCall( BOTLIB_USER_COMMAND, clientNum, ucmd ); } void trap_EA_Command(int client, const char *command) { - Q_syscall( BOTLIB_EA_COMMAND, client, command ); -} - -void trap_EA_SelectWeapon(int client, int weapon) { - Q_syscall( BOTLIB_EA_SELECT_WEAPON, client, weapon ); -} - -void trap_EA_Talk(int client) { - Q_syscall( BOTLIB_EA_TALK, client ); -} - -void trap_EA_Attack(int client) { - Q_syscall( BOTLIB_EA_ATTACK, client ); -} - -void trap_EA_Reload(int client) { - Q_syscall( BOTLIB_EA_RELOAD, client ); -} - -void trap_EA_Activate(int client) { - Q_syscall( BOTLIB_EA_USE, client ); -} - -void trap_EA_Respawn(int client) { - Q_syscall( BOTLIB_EA_RESPAWN, client ); -} - -void trap_EA_Jump(int client) { - Q_syscall( BOTLIB_EA_JUMP, client ); -} - -void trap_EA_DelayedJump(int client) { - Q_syscall( BOTLIB_EA_DELAYED_JUMP, client ); -} - -void trap_EA_Crouch(int client) { - Q_syscall( BOTLIB_EA_CROUCH, client ); -} - -void trap_EA_Walk(int client) { - Q_syscall( BOTLIB_EA_WALK, client ); -} - -void trap_EA_MoveUp(int client) { - Q_syscall( BOTLIB_EA_MOVE_UP, client ); -} - -void trap_EA_MoveDown(int client) { - Q_syscall( BOTLIB_EA_MOVE_DOWN, client ); -} - -void trap_EA_MoveForward(int client) { - Q_syscall( BOTLIB_EA_MOVE_FORWARD, client ); -} - -void trap_EA_MoveBack(int client) { - Q_syscall( BOTLIB_EA_MOVE_BACK, client ); -} - -void trap_EA_MoveLeft(int client) { - Q_syscall( BOTLIB_EA_MOVE_LEFT, client ); -} - -void trap_EA_MoveRight(int client) { - Q_syscall( BOTLIB_EA_MOVE_RIGHT, client ); -} - -void trap_EA_Move(int client, vec3_t dir, float speed) { - Q_syscall( BOTLIB_EA_MOVE, client, dir, PASSFLOAT(speed) ); -} - -void trap_EA_View(int client, vec3_t viewangles) { - Q_syscall( BOTLIB_EA_VIEW, client, viewangles ); -} - -void trap_EA_EndRegular(int client, float thinktime) { - Q_syscall( BOTLIB_EA_END_REGULAR, client, PASSFLOAT(thinktime) ); -} - -void trap_EA_GetInput(int client, float thinktime, void /* struct bot_input_s */ *input) { - Q_syscall( BOTLIB_EA_GET_INPUT, client, PASSFLOAT(thinktime), input ); -} - -void trap_EA_ResetInput(int client, void *init) { - Q_syscall( BOTLIB_EA_RESET_INPUT, client, init ); -} - -void trap_EA_Prone(int client) { - Q_syscall( BOTLIB_EA_PRONE, client ); -} - -int trap_BotLoadCharacter(char *charfile, int skill) { - return Q_syscall( BOTLIB_AI_LOAD_CHARACTER, charfile, skill); -} - -void trap_BotFreeCharacter(int character) { - Q_syscall( BOTLIB_AI_FREE_CHARACTER, character ); -} - -float trap_Characteristic_Float(int character, int index) { - byteAlias_t fi; - fi.i = Q_syscall( BOTLIB_AI_CHARACTERISTIC_FLOAT, character, index ); - return fi.f; -} - -float trap_Characteristic_BFloat(int character, int index, float min, float max) { - byteAlias_t fi; - fi.i = Q_syscall( BOTLIB_AI_CHARACTERISTIC_BFLOAT, character, index, PASSFLOAT(min), PASSFLOAT(max) ); - return fi.f; -} - -int trap_Characteristic_Integer(int character, int index) { - return Q_syscall( BOTLIB_AI_CHARACTERISTIC_INTEGER, character, index ); -} - -int trap_Characteristic_BInteger(int character, int index, int min, int max) { - return Q_syscall( BOTLIB_AI_CHARACTERISTIC_BINTEGER, character, index, min, max ); -} - -void trap_Characteristic_String(int character, int index, char *buf, int size) { - Q_syscall( BOTLIB_AI_CHARACTERISTIC_STRING, character, index, buf, size ); -} - -int trap_BotAllocChatState(void) { - return Q_syscall( BOTLIB_AI_ALLOC_CHAT_STATE ); -} - -void trap_BotFreeChatState(int handle) { - Q_syscall( BOTLIB_AI_FREE_CHAT_STATE, handle ); -} - -void trap_BotQueueConsoleMessage(int chatstate, int type, char *message) { - Q_syscall( BOTLIB_AI_QUEUE_CONSOLE_MESSAGE, chatstate, type, message ); -} - -void trap_BotRemoveConsoleMessage(int chatstate, int handle) { - Q_syscall( BOTLIB_AI_REMOVE_CONSOLE_MESSAGE, chatstate, handle ); + SystemCall( BOTLIB_EA_COMMAND, client, command ); } -int trap_BotNextConsoleMessage(int chatstate, void /* struct bot_consolemessage_s */ *cm) { - return Q_syscall( BOTLIB_AI_NEXT_CONSOLE_MESSAGE, chatstate, cm ); -} - -int trap_BotNumConsoleMessages(int chatstate) { - return Q_syscall( BOTLIB_AI_NUM_CONSOLE_MESSAGE, chatstate ); -} - -void trap_BotInitialChat(int chatstate, char *type, int mcontext, char *var0, char *var1, char *var2, char *var3, char *var4, char *var5, char *var6, char *var7 ) { - Q_syscall( BOTLIB_AI_INITIAL_CHAT, chatstate, type, mcontext, var0, var1, var2, var3, var4, var5, var6, var7 ); -} - -int trap_BotNumInitialChats(int chatstate, char *type) { - return Q_syscall( BOTLIB_AI_NUM_INITIAL_CHATS, chatstate, type ); -} - -int trap_BotReplyChat(int chatstate, char *message, int mcontext, int vcontext, char *var0, char *var1, char *var2, char *var3, char *var4, char *var5, char *var6, char *var7 ) { - return Q_syscall( BOTLIB_AI_REPLY_CHAT, chatstate, message, mcontext, vcontext, var0, var1, var2, var3, var4, var5, var6, var7 ); -} - -int trap_BotChatLength(int chatstate) { - return Q_syscall( BOTLIB_AI_CHAT_LENGTH, chatstate ); -} - -void trap_BotEnterChat(int chatstate, int client, int sendto) { - // RF, disabled - return; - Q_syscall( BOTLIB_AI_ENTER_CHAT, chatstate, client, sendto ); -} - -void trap_BotGetChatMessage(int chatstate, char *buf, int size) { - Q_syscall( BOTLIB_AI_GET_CHAT_MESSAGE, chatstate, buf, size); -} - -int trap_StringContains(char *str1, char *str2, int casesensitive) { - return Q_syscall( BOTLIB_AI_STRING_CONTAINS, str1, str2, casesensitive ); -} - -int trap_BotFindMatch(char *str, void /* struct bot_match_s */ *match, unsigned long int context) { - return Q_syscall( BOTLIB_AI_FIND_MATCH, str, match, context ); -} - -void trap_BotMatchVariable(void /* struct bot_match_s */ *match, int variable, char *buf, int size) { - Q_syscall( BOTLIB_AI_MATCH_VARIABLE, match, variable, buf, size ); -} - -void trap_UnifyWhiteSpaces(char *string) { - Q_syscall( BOTLIB_AI_UNIFY_WHITE_SPACES, string ); -} - -void trap_BotReplaceSynonyms(char *string, unsigned long int context) { - Q_syscall( BOTLIB_AI_REPLACE_SYNONYMS, string, context ); -} - -int trap_BotLoadChatFile(int chatstate, char *chatfile, char *chatname) { - return Q_syscall( BOTLIB_AI_LOAD_CHAT_FILE, chatstate, chatfile, chatname ); -} - -void trap_BotSetChatGender(int chatstate, int gender) { - Q_syscall( BOTLIB_AI_SET_CHAT_GENDER, chatstate, gender ); -} - -void trap_BotSetChatName(int chatstate, char *name) { - Q_syscall( BOTLIB_AI_SET_CHAT_NAME, chatstate, name ); -} - -void trap_BotResetGoalState(int goalstate) { - Q_syscall( BOTLIB_AI_RESET_GOAL_STATE, goalstate ); -} - -void trap_BotResetAvoidGoals(int goalstate) { - Q_syscall( BOTLIB_AI_RESET_AVOID_GOALS, goalstate ); -} - -void trap_BotRemoveFromAvoidGoals(int goalstate, int number) { - Q_syscall( BOTLIB_AI_REMOVE_FROM_AVOID_GOALS, goalstate, number); -} - -void trap_BotPushGoal(int goalstate, void /* struct bot_goal_s */ *goal) { - Q_syscall( BOTLIB_AI_PUSH_GOAL, goalstate, goal ); -} - -void trap_BotPopGoal(int goalstate) { - Q_syscall( BOTLIB_AI_POP_GOAL, goalstate ); -} - -void trap_BotEmptyGoalStack(int goalstate) { - Q_syscall( BOTLIB_AI_EMPTY_GOAL_STACK, goalstate ); -} - -void trap_BotDumpAvoidGoals(int goalstate) { - Q_syscall( BOTLIB_AI_DUMP_AVOID_GOALS, goalstate ); -} - -void trap_BotDumpGoalStack(int goalstate) { - Q_syscall( BOTLIB_AI_DUMP_GOAL_STACK, goalstate ); -} - -void trap_BotGoalName(int number, char *name, int size) { - Q_syscall( BOTLIB_AI_GOAL_NAME, number, name, size ); -} - -int trap_BotGetTopGoal(int goalstate, void /* struct bot_goal_s */ *goal) { - return Q_syscall( BOTLIB_AI_GET_TOP_GOAL, goalstate, goal ); -} - -int trap_BotGetSecondGoal(int goalstate, void /* struct bot_goal_s */ *goal) { - return Q_syscall( BOTLIB_AI_GET_SECOND_GOAL, goalstate, goal ); -} - -int trap_BotChooseLTGItem(int goalstate, vec3_t origin, int *inventory, int travelflags) { - return Q_syscall( BOTLIB_AI_CHOOSE_LTG_ITEM, goalstate, origin, inventory, travelflags ); -} - -int trap_BotChooseNBGItem(int goalstate, vec3_t origin, int *inventory, int travelflags, void /* struct bot_goal_s */ *ltg, float maxtime) { - return Q_syscall( BOTLIB_AI_CHOOSE_NBG_ITEM, goalstate, origin, inventory, travelflags, ltg, PASSFLOAT(maxtime) ); -} - -int trap_BotTouchingGoal(vec3_t origin, void /* struct bot_goal_s */ *goal) { - return Q_syscall( BOTLIB_AI_TOUCHING_GOAL, origin, goal ); -} - -int trap_BotItemGoalInVisButNotVisible(int viewer, vec3_t eye, vec3_t viewangles, void /* struct bot_goal_s */ *goal) { - return Q_syscall( BOTLIB_AI_ITEM_GOAL_IN_VIS_BUT_NOT_VISIBLE, viewer, eye, viewangles, goal ); -} - -int trap_BotGetLevelItemGoal(int index, char *classname, void /* struct bot_goal_s */ *goal) { - return Q_syscall( BOTLIB_AI_GET_LEVEL_ITEM_GOAL, index, classname, goal ); -} - -int trap_BotGetNextCampSpotGoal(int num, void /* struct bot_goal_s */ *goal) { - return Q_syscall( BOTLIB_AI_GET_NEXT_CAMP_SPOT_GOAL, num, goal ); -} - -int trap_BotGetMapLocationGoal(char *name, void /* struct bot_goal_s */ *goal) { - return Q_syscall( BOTLIB_AI_GET_MAP_LOCATION_GOAL, name, goal ); -} - -float trap_BotAvoidGoalTime(int goalstate, int number) { - byteAlias_t fi; - fi.i = Q_syscall( BOTLIB_AI_AVOID_GOAL_TIME, goalstate, number ); - return fi.f; -} - -void trap_BotInitLevelItems(void) { - Q_syscall( BOTLIB_AI_INIT_LEVEL_ITEMS ); -} - -void trap_BotUpdateEntityItems(void) { - Q_syscall( BOTLIB_AI_UPDATE_ENTITY_ITEMS ); -} - -int trap_BotLoadItemWeights(int goalstate, char *filename) { - return Q_syscall( BOTLIB_AI_LOAD_ITEM_WEIGHTS, goalstate, filename ); -} - -void trap_BotFreeItemWeights(int goalstate) { - Q_syscall( BOTLIB_AI_FREE_ITEM_WEIGHTS, goalstate ); -} - -void trap_BotInterbreedGoalFuzzyLogic(int parent1, int parent2, int child) { - Q_syscall( BOTLIB_AI_INTERBREED_GOAL_FUZZY_LOGIC, parent1, parent2, child ); -} - -void trap_BotSaveGoalFuzzyLogic(int goalstate, char *filename) { - Q_syscall( BOTLIB_AI_SAVE_GOAL_FUZZY_LOGIC, goalstate, filename ); -} - -void trap_BotMutateGoalFuzzyLogic(int goalstate, float range) { - Q_syscall( BOTLIB_AI_MUTATE_GOAL_FUZZY_LOGIC, goalstate, PASSFLOAT(range) ); -} - -int trap_BotAllocGoalState(int state) { - return Q_syscall( BOTLIB_AI_ALLOC_GOAL_STATE, state ); -} - -void trap_BotFreeGoalState(int handle) { - Q_syscall( BOTLIB_AI_FREE_GOAL_STATE, handle ); -} - -void trap_BotResetMoveState(int movestate) { - Q_syscall( BOTLIB_AI_RESET_MOVE_STATE, movestate ); -} - -void trap_BotMoveToGoal(void /* struct bot_moveresult_s */ *result, int movestate, void /* struct bot_goal_s */ *goal, int travelflags) { - Q_syscall( BOTLIB_AI_MOVE_TO_GOAL, result, movestate, goal, travelflags ); -} - -int trap_BotMoveInDirection(int movestate, vec3_t dir, float speed, int type) { - return Q_syscall( BOTLIB_AI_MOVE_IN_DIRECTION, movestate, dir, PASSFLOAT(speed), type ); -} - -void trap_BotResetAvoidReach(int movestate) { - Q_syscall( BOTLIB_AI_RESET_AVOID_REACH, movestate ); -} - -void trap_BotResetLastAvoidReach(int movestate) { - Q_syscall( BOTLIB_AI_RESET_LAST_AVOID_REACH,movestate ); -} - -int trap_BotReachabilityArea(vec3_t origin, int testground) { - return Q_syscall( BOTLIB_AI_REACHABILITY_AREA, origin, testground ); -} - -int trap_BotMovementViewTarget(int movestate, void /* struct bot_goal_s */ *goal, int travelflags, float lookahead, vec3_t target) { - return Q_syscall( BOTLIB_AI_MOVEMENT_VIEW_TARGET, movestate, goal, travelflags, PASSFLOAT(lookahead), target ); -} - -int trap_BotPredictVisiblePosition(vec3_t origin, int areanum, void /* struct bot_goal_s */ *goal, int travelflags, vec3_t target) { - return Q_syscall( BOTLIB_AI_PREDICT_VISIBLE_POSITION, origin, areanum, goal, travelflags, target ); -} - -int trap_BotAllocMoveState(void) { - return Q_syscall( BOTLIB_AI_ALLOC_MOVE_STATE ); -} - -void trap_BotFreeMoveState(int handle) { - Q_syscall( BOTLIB_AI_FREE_MOVE_STATE, handle ); -} - -void trap_BotInitMoveState(int handle, void /* struct bot_initmove_s */ *initmove) { - Q_syscall( BOTLIB_AI_INIT_MOVE_STATE, handle, initmove ); -} - -// Ridah -void trap_BotInitAvoidReach(int handle) { - Q_syscall( BOTLIB_AI_INIT_AVOID_REACH, handle ); -} -// Done. - -int trap_BotChooseBestFightWeapon(int weaponstate, int *inventory) { - return Q_syscall( BOTLIB_AI_CHOOSE_BEST_FIGHT_WEAPON, weaponstate, inventory ); -} - -void trap_BotGetWeaponInfo(int weaponstate, int weapon, void /* struct weaponinfo_s */ *weaponinfo) { - Q_syscall( BOTLIB_AI_GET_WEAPON_INFO, weaponstate, weapon, weaponinfo ); -} - -int trap_BotLoadWeaponWeights(int weaponstate, char *filename) { - return Q_syscall( BOTLIB_AI_LOAD_WEAPON_WEIGHTS, weaponstate, filename ); -} - -int trap_BotAllocWeaponState(void) { - return Q_syscall( BOTLIB_AI_ALLOC_WEAPON_STATE ); -} - -void trap_BotFreeWeaponState(int weaponstate) { - Q_syscall( BOTLIB_AI_FREE_WEAPON_STATE, weaponstate ); -} - -void trap_BotResetWeaponState(int weaponstate) { - Q_syscall( BOTLIB_AI_RESET_WEAPON_STATE, weaponstate ); +void trap_PbStat ( int clientNum , char *category , char *values ) { + SystemCall( PB_STAT_REPORT , clientNum , category , values ) ; } -int trap_GeneticParentsAndChildSelection(int numranks, float *ranks, int *parent1, int *parent2, int *child) { - return Q_syscall( BOTLIB_AI_GENETIC_PARENTS_AND_CHILD_SELECTION, numranks, ranks, parent1, parent2, child ); +void trap_SendMessage( int clientNum, char *buf, int buflen ) { + SystemCall( G_SENDMESSAGE, clientNum, buf, buflen ); } -void trap_PbStat ( int clientNum , char *category , char *values ) { - Q_syscall( PB_STAT_REPORT , clientNum , category , values ) ; +messageStatus_t trap_MessageStatus( int clientNum ) { + return SystemCall( G_MESSAGESTATUS, clientNum ); } // extension interface qboolean trap_GetValue( char *value, int valueSize, const char *key ) { - return Q_syscall( dll_com_trapGetValue, value, valueSize, key ); + return SystemCall( dll_com_trapGetValue, value, valueSize, key ); } diff --git a/code/api/et/q_shared.h b/code/api/et/q_shared.h index 4bc8ea9..f561136 100644 --- a/code/api/et/q_shared.h +++ b/code/api/et/q_shared.h @@ -222,6 +222,31 @@ typedef int32_t qhandle_t, thandle_t, fxHandle_t, sfxHandle_t, fileHandle_t, cli #define ARRAY_LEN(x) (sizeof(x) / sizeof(*(x))) #define STRARRAY_LEN(x) (ARRAY_LEN(x) - 1) +// We need to use EXPAND because the Microsoft MSVC preprocessor does not expand the va_args the same way as other preprocessors +// http://stackoverflow.com/questions/5134523/msvc-doesnt-expand-va-args-correctly +#define EXPAND(x) x + +#define VM_CALL_END (intptr_t)(-1337) +#define GET_SYSCALL_MACRO(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, NAME, ...) NAME + +#define SystemCall_0(arg) syscall(arg, VM_CALL_END) +#define SystemCall_1(arg, a1) syscall(arg, (intptr_t)(a1), VM_CALL_END) +#define SystemCall_2(arg, a1, a2) syscall(arg, (intptr_t)(a1), (intptr_t)(a2), VM_CALL_END) +#define SystemCall_3(arg, a1, a2, a3) syscall(arg, (intptr_t)(a1), (intptr_t)(a2), (intptr_t)(a3), VM_CALL_END) +#define SystemCall_4(arg, a1, a2, a3, a4) syscall(arg, (intptr_t)(a1), (intptr_t)(a2), (intptr_t)(a3), (intptr_t)(a4), VM_CALL_END) +#define SystemCall_5(arg, a1, a2, a3, a4, a5) syscall(arg, (intptr_t)(a1), (intptr_t)(a2), (intptr_t)(a3), (intptr_t)(a4), (intptr_t)(a5), VM_CALL_END) +#define SystemCall_6(arg, a1, a2, a3, a4, a5, a6) syscall(arg, (intptr_t)(a1), (intptr_t)(a2), (intptr_t)(a3), (intptr_t)(a4), (intptr_t)(a5), (intptr_t)(a6), VM_CALL_END) +#define SystemCall_7(arg, a1, a2, a3, a4, a5, a6, a7) syscall(arg, (intptr_t)(a1), (intptr_t)(a2), (intptr_t)(a3), (intptr_t)(a4), (intptr_t)(a5), (intptr_t)(a6), (intptr_t)(a7), VM_CALL_END) +#define SystemCall_8(arg, a1, a2, a3, a4, a5, a6, a7, a8) syscall(arg, (intptr_t)(a1), (intptr_t)(a2), (intptr_t)(a3), (intptr_t)(a4), (intptr_t)(a5), (intptr_t)(a6), (intptr_t)(a7), (intptr_t)(a8), VM_CALL_END) +#define SystemCall_9(arg, a1, a2, a3, a4, a5, a6, a7, a8, a9) syscall(arg, (intptr_t)(a1), (intptr_t)(a2), (intptr_t)(a3), (intptr_t)(a4), (intptr_t)(a5), (intptr_t)(a6), (intptr_t)(a7), (intptr_t)(a8), (intptr_t)(a9), VM_CALL_END) +#define SystemCall_10(arg, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) syscall(arg, (intptr_t)(a1), (intptr_t)(a2), (intptr_t)(a3), (intptr_t)(a4), (intptr_t)(a5), (intptr_t)(a6), (intptr_t)(a7), (intptr_t)(a8), (intptr_t)(a9), (intptr_t)(a10), VM_CALL_END) +#define SystemCall_11(arg, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) syscall(arg, (intptr_t)(a1), (intptr_t)(a2), (intptr_t)(a3), (intptr_t)(a4), (intptr_t)(a5), (intptr_t)(a6), (intptr_t)(a7), (intptr_t)(a8), (intptr_t)(a9), (intptr_t)(a10), (intptr_t)(a11), VM_CALL_END) +#define SystemCall_12(arg, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) syscall(arg, (intptr_t)(a1), (intptr_t)(a2), (intptr_t)(a3), (intptr_t)(a4), (intptr_t)(a5), (intptr_t)(a6), (intptr_t)(a7), (intptr_t)(a8), (intptr_t)(a9), (intptr_t)(a10), (intptr_t)(a11), (intptr_t)(a12), VM_CALL_END) +#define SystemCall_13(arg, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) syscall(arg, (intptr_t)(a1), (intptr_t)(a2), (intptr_t)(a3), (intptr_t)(a4), (intptr_t)(a5), (intptr_t)(a6), (intptr_t)(a7), (intptr_t)(a8), (intptr_t)(a9), (intptr_t)(a10), (intptr_t)(a11), (intptr_t)(a12), (intptr_t)(a13), VM_CALL_END) +#define SystemCall_14(arg, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) syscall(arg, (intptr_t)(a1), (intptr_t)(a2), (intptr_t)(a3), (intptr_t)(a4), (intptr_t)(a5), (intptr_t)(a6), (intptr_t)(a7), (intptr_t)(a8), (intptr_t)(a9), (intptr_t)(a10), (intptr_t)(a11), (intptr_t)(a12), (intptr_t)(a13), (intptr_t)(a14), VM_CALL_END) + +#define SystemCall(...) EXPAND(GET_SYSCALL_MACRO(__VA_ARGS__, SystemCall_14, SystemCall_13, SystemCall_12, SystemCall_11, SystemCall_10, SystemCall_9, SystemCall_8, SystemCall_7, SystemCall_6, SystemCall_5, SystemCall_4, SystemCall_3, SystemCall_2, SystemCall_1, SystemCall_0)(__VA_ARGS__)) + // angle indexes #define PITCH 0 // up / down #define YAW 1 // left / right @@ -253,6 +278,14 @@ typedef int32_t qhandle_t, thandle_t, fxHandle_t, sfxHandle_t, fileHandle_t, cli #define MAX_SAY_TEXT 150 +#define MAX_BINARY_MESSAGE 32768 // max length of binary message + +typedef enum { + MESSAGE_EMPTY = 0, + MESSAGE_WAITING, // rate/packet limited + MESSAGE_WAITING_OVERFLOW, // packet too large with message +} messageStatus_t; + #define MAX_OBITS 4 #define SHOW_OBIT 5000 // 5 seconds @@ -449,6 +482,10 @@ const char *QDECL va( const char *format, ... ) FORMAT_PRINTF(1, 2); //============================================= +typedef intptr_t (QDECL *dllSyscall_t)( intptr_t callNum, ... ); + + + // // key / value info strings // diff --git a/code/api/et/ui_public.h b/code/api/et/ui_public.h index e656ac1..b3f67ab 100644 --- a/code/api/et/ui_public.h +++ b/code/api/et/ui_public.h @@ -45,7 +45,7 @@ typedef struct { } uiClientState_t; typedef enum { - UI_ERROR, + UI_ERROR = 0, UI_PRINT, UI_MILLISECONDS, UI_CVAR_SET, @@ -162,7 +162,7 @@ typedef enum { UI_OPENURL, UI_SET_PBSVSTATUS, // TTimo - UI_MEMSET = 200, + /*UI_MEMSET = 200, UI_MEMCPY, UI_STRNCPY, UI_SIN, @@ -170,8 +170,8 @@ typedef enum { UI_ATAN2, UI_SQRT, UI_FLOOR, - UI_CEIL, - UI_GETHUNKDATA + UI_CEIL,*/ + UI_GETHUNKDATA = 209 } uiImport_t; @@ -254,6 +254,8 @@ typedef enum { UI_WANTSBINDKEYS, + UI_EXPORT_LAST, + } uiExport_t; #endif diff --git a/code/api/et/ui_syscalls.c b/code/api/et/ui_syscalls.c index 070427c..bb8fbf1 100644 --- a/code/api/et/ui_syscalls.c +++ b/code/api/et/ui_syscalls.c @@ -32,14 +32,13 @@ If you have questions concerning this license or the applicable additional terms #include "../../ui_new/ui_local.h" -static intptr_t (QDECL *Q_syscall)( intptr_t arg, ... ) = (intptr_t (QDECL *)( intptr_t, ...))-1; +static dllSyscall_t syscall = (dllSyscall_t)-1; -Q_EXPORT void dllEntry( intptr_t (QDECL *syscallptr)( intptr_t arg,... ) ) { - Q_syscall = syscallptr; +Q_EXPORT void dllEntry( dllSyscall_t syscallptr ) { + syscall = syscallptr; } - -int PASSFLOAT( float x ) { +static int PASSFLOAT( float x ) { byteAlias_t fi; fi.f = x; return fi.i; @@ -48,183 +47,183 @@ int PASSFLOAT( float x ) { #include "../shared/ui_shared_syscalls.c" void trap_Print( const char *string ) { - Q_syscall( UI_PRINT, string ); + SystemCall( UI_PRINT, string ); } void NORETURN trap_Error( const char *string ) { - Q_syscall( UI_ERROR, string ); + SystemCall( UI_ERROR, string ); exit( 1 ); } int trap_Milliseconds( void ) { - return Q_syscall( UI_MILLISECONDS ); + return SystemCall( UI_MILLISECONDS ); } void trap_Cvar_Register( vmCvar_t *cvar, const char *var_name, const char *value, int flags ) { - Q_syscall( UI_CVAR_REGISTER, cvar, var_name, value, flags ); + SystemCall( UI_CVAR_REGISTER, cvar, var_name, value, flags ); } void trap_Cvar_Update( vmCvar_t *cvar ) { - Q_syscall( UI_CVAR_UPDATE, cvar ); + SystemCall( UI_CVAR_UPDATE, cvar ); } void trap_Cvar_Set( const char *var_name, const char *value ) { - Q_syscall( UI_CVAR_SET, var_name, value ); + SystemCall( UI_CVAR_SET, var_name, value ); } float trap_Cvar_VariableValue( const char *var_name ) { byteAlias_t fi; - fi.i = Q_syscall( UI_CVAR_VARIABLEVALUE, var_name ); + fi.i = SystemCall( UI_CVAR_VARIABLEVALUE, var_name ); return fi.f; } void trap_Cvar_VariableStringBuffer( const char *var_name, char *buffer, int bufsize ) { - Q_syscall( UI_CVAR_VARIABLESTRINGBUFFER, var_name, buffer, bufsize ); + SystemCall( UI_CVAR_VARIABLESTRINGBUFFER, var_name, buffer, bufsize ); } void trap_Cvar_LatchedVariableStringBuffer( const char *var_name, char *buffer, int bufsize ) { - Q_syscall( UI_CVAR_LATCHEDVARIABLESTRINGBUFFER, var_name, buffer, bufsize ); + SystemCall( UI_CVAR_LATCHEDVARIABLESTRINGBUFFER, var_name, buffer, bufsize ); } void trap_Cvar_SetValue( const char *var_name, float value ) { - Q_syscall( UI_CVAR_SETVALUE, var_name, PASSFLOAT( value ) ); + SystemCall( UI_CVAR_SETVALUE, var_name, PASSFLOAT( value ) ); } void trap_Cvar_Reset( const char *name ) { - Q_syscall( UI_CVAR_RESET, name ); + SystemCall( UI_CVAR_RESET, name ); } void trap_Cvar_Create( const char *var_name, const char *var_value, int flags ) { - Q_syscall( UI_CVAR_CREATE, var_name, var_value, flags ); + SystemCall( UI_CVAR_CREATE, var_name, var_value, flags ); } void trap_Cvar_InfoStringBuffer( int bit, char *buffer, int bufsize ) { - Q_syscall( UI_CVAR_INFOSTRINGBUFFER, bit, buffer, bufsize ); + SystemCall( UI_CVAR_INFOSTRINGBUFFER, bit, buffer, bufsize ); } int trap_Argc( void ) { - return Q_syscall( UI_ARGC ); + return SystemCall( UI_ARGC ); } void trap_Argv( int n, char *buffer, int bufferLength ) { - Q_syscall( UI_ARGV, n, buffer, bufferLength ); + SystemCall( UI_ARGV, n, buffer, bufferLength ); } void trap_Cmd_ExecuteText( int exec_when, const char *text ) { - Q_syscall( UI_CMD_EXECUTETEXT, exec_when, text ); + SystemCall( UI_CMD_EXECUTETEXT, exec_when, text ); } void trap_AddCommand( const char *cmdName ) { - Q_syscall( UI_ADDCOMMAND, cmdName ); + SystemCall( UI_ADDCOMMAND, cmdName ); } int trap_FS_FOpenFile( const char *qpath, fileHandle_t *f, fsMode_t mode ) { - return Q_syscall( UI_FS_FOPENFILE, qpath, f, mode ); + return SystemCall( UI_FS_FOPENFILE, qpath, f, mode ); } void trap_FS_Read( void *buffer, int len, fileHandle_t f ) { - Q_syscall( UI_FS_READ, buffer, len, f ); + SystemCall( UI_FS_READ, buffer, len, f ); } void trap_FS_Write( const void *buffer, int len, fileHandle_t f ) { - Q_syscall( UI_FS_WRITE, buffer, len, f ); + SystemCall( UI_FS_WRITE, buffer, len, f ); } void trap_FS_FCloseFile( fileHandle_t f ) { - Q_syscall( UI_FS_FCLOSEFILE, f ); + SystemCall( UI_FS_FCLOSEFILE, f ); } int trap_FS_GetFileList( const char *path, const char *extension, char *listbuf, int bufsize ) { - return Q_syscall( UI_FS_GETFILELIST, path, extension, listbuf, bufsize ); + return SystemCall( UI_FS_GETFILELIST, path, extension, listbuf, bufsize ); } int trap_FS_Delete(const char *filename) { - return Q_syscall( UI_FS_DELETEFILE, filename); + return SystemCall( UI_FS_DELETEFILE, filename); } qhandle_t trap_R_RealRegisterModel( const char *name ) { - return Q_syscall( UI_R_REGISTERMODEL, name ); + return SystemCall( UI_R_REGISTERMODEL, name ); } qhandle_t trap_R_RegisterSkin( const char *name ) { - return Q_syscall( UI_R_REGISTERSKIN, name ); + return SystemCall( UI_R_REGISTERSKIN, name ); } void trap_R_RegisterFont(const char *fontName, int pointSize, fontInfo_t *font) { - Q_syscall( UI_R_REGISTERFONT, fontName, pointSize, font ); + SystemCall( UI_R_REGISTERFONT, fontName, pointSize, font ); } qhandle_t trap_R_RegisterShaderNoMip( const char *name ) { - return Q_syscall( UI_R_REGISTERSHADERNOMIP, name ); + return SystemCall( UI_R_REGISTERSHADERNOMIP, name ); } void trap_R_ClearScene( void ) { - Q_syscall( UI_R_CLEARSCENE ); + SystemCall( UI_R_CLEARSCENE ); } void trap_R_AddRefEntityToScene( const refEntity_t *re ) { // Arnout: Q3F PORT : ET HACK DUE TO BUG IN tr_light.cpp, R_SetupEntityLighting ((refEntity_t *)re)->renderfx |= RF_THIRD_PERSON; - Q_syscall( UI_R_ADDREFENTITYTOSCENE, re ); + SystemCall( UI_R_ADDREFENTITYTOSCENE, re ); } void trap_R_AddPolyToScene( qhandle_t hShader , int numVerts, const polyVert_t *verts ) { - Q_syscall( UI_R_ADDPOLYTOSCENE, hShader, numVerts, verts ); + SystemCall( UI_R_ADDPOLYTOSCENE, hShader, numVerts, verts ); } // ydnar: new dlight system //% void trap_R_AddLightToScene( const vec3_t org, float intensity, float r, float g, float b, int overdraw ) { -//% Q_syscall( UI_R_ADDLIGHTTOSCENE, org, PASSFLOAT(intensity), PASSFLOAT(r), PASSFLOAT(g), PASSFLOAT(b), overdraw ); +//% SystemCall( UI_R_ADDLIGHTTOSCENE, org, PASSFLOAT(intensity), PASSFLOAT(r), PASSFLOAT(g), PASSFLOAT(b), overdraw ); //% } /*void trap_R_AddLightToScene( const vec3_t org, float radius, float intensity, float r, float g, float b, qhandle_t hShader, int flags ) { - Q_syscall( UI_R_ADDLIGHTTOSCENE, org, PASSFLOAT( radius ), PASSFLOAT( intensity ), + SystemCall( UI_R_ADDLIGHTTOSCENE, org, PASSFLOAT( radius ), PASSFLOAT( intensity ), PASSFLOAT( r ), PASSFLOAT( g ), PASSFLOAT( b ), hShader, flags ); }*/ void trap_R_AddCoronaToScene( const vec3_t org, float r, float g, float b, float scale, int id, qboolean visible ) { - Q_syscall( UI_R_ADDCORONATOSCENE, org, PASSFLOAT(r), PASSFLOAT(g), PASSFLOAT(b), PASSFLOAT(scale), id, visible ); + SystemCall( UI_R_ADDCORONATOSCENE, org, PASSFLOAT(r), PASSFLOAT(g), PASSFLOAT(b), PASSFLOAT(scale), id, visible ); } void trap_R_RenderScene( const refdef_t *fd ) { - Q_syscall( UI_R_RENDERSCENE, fd ); + SystemCall( UI_R_RENDERSCENE, fd ); } void trap_R_SetColor( const float *rgba ) { - Q_syscall( UI_R_SETCOLOR, rgba ); + SystemCall( UI_R_SETCOLOR, rgba ); } void trap_R_Add2dPolys( polyVert_t* verts, int numverts, qhandle_t hShader ) { - Q_syscall( UI_R_DRAW2DPOLYS, verts, numverts, hShader ); + SystemCall( UI_R_DRAW2DPOLYS, verts, numverts, hShader ); } void trap_R_DrawStretchPic( float x, float y, float w, float h, float s1, float t1, float s2, float t2, qhandle_t hShader ) { - Q_syscall( UI_R_DRAWSTRETCHPIC, PASSFLOAT(x), PASSFLOAT(y), PASSFLOAT(w), PASSFLOAT(h), PASSFLOAT(s1), PASSFLOAT(t1), PASSFLOAT(s2), PASSFLOAT(t2), hShader ); + SystemCall( UI_R_DRAWSTRETCHPIC, PASSFLOAT(x), PASSFLOAT(y), PASSFLOAT(w), PASSFLOAT(h), PASSFLOAT(s1), PASSFLOAT(t1), PASSFLOAT(s2), PASSFLOAT(t2), hShader ); } void trap_R_DrawRotatedPic( float x, float y, float w, float h, float s1, float t1, float s2, float t2, qhandle_t hShader, float angle ) { - Q_syscall( UI_R_DRAWROTATEDPIC, PASSFLOAT(x), PASSFLOAT(y), PASSFLOAT(w), PASSFLOAT(h), PASSFLOAT(s1), PASSFLOAT(t1), PASSFLOAT(s2), PASSFLOAT(t2), hShader, PASSFLOAT(angle) ); + SystemCall( UI_R_DRAWROTATEDPIC, PASSFLOAT(x), PASSFLOAT(y), PASSFLOAT(w), PASSFLOAT(h), PASSFLOAT(s1), PASSFLOAT(t1), PASSFLOAT(s2), PASSFLOAT(t2), hShader, PASSFLOAT(angle) ); } void trap_R_ModelBounds( clipHandle_t model, vec3_t mins, vec3_t maxs ) { - Q_syscall( UI_R_MODELBOUNDS, model, mins, maxs ); + SystemCall( UI_R_MODELBOUNDS, model, mins, maxs ); } void trap_UpdateScreen( void ) { - Q_syscall( UI_UPDATESCREEN ); + SystemCall( UI_UPDATESCREEN ); } /*int trap_CM_LerpTag( orientation_t *tag, const refEntity_t *refent, const char *tagName, int startIndex ) { - return Q_syscall( UI_CM_LERPTAG, tag, refent, tagName, 0 ); // NEFVE - SMF - fixed + return SystemCall( UI_CM_LERPTAG, tag, refent, tagName, 0 ); // NEFVE - SMF - fixed }*/ void trap_S_StartLocalSound( sfxHandle_t sfx, int channelNum ) { - Q_syscall( UI_S_STARTLOCALSOUND, sfx, channelNum, 127 /* Gordon: default volume always for the moment*/ ); + SystemCall( UI_S_STARTLOCALSOUND, sfx, channelNum, 127 /* Gordon: default volume always for the moment*/ ); } sfxHandle_t trap_S_RegisterSound( const char *sample, qboolean compressed ) { - int i = Q_syscall( UI_S_REGISTERSOUND, sample, qfalse /* compressed */ ); + int i = SystemCall( UI_S_REGISTERSOUND, sample, qfalse /* compressed */ ); #ifdef _DEBUG if(i == 0) { Com_Printf("^1Warning: Failed to load sound: %s\n", sample); @@ -234,268 +233,268 @@ sfxHandle_t trap_S_RegisterSound( const char *sample, qboolean compressed ) { } void trap_S_FadeBackgroundTrack( float targetvol, int time, int num){ // yes, i know. fadebackground coming in, fadestreaming going out. will have to see where functionality leads... - Q_syscall( UI_S_FADESTREAMINGSOUND, PASSFLOAT(targetvol), time, num); // 'num' is '0' if it's music, '1' if it's "all streaming sounds" + SystemCall( UI_S_FADESTREAMINGSOUND, PASSFLOAT(targetvol), time, num); // 'num' is '0' if it's music, '1' if it's "all streaming sounds" } void trap_S_FadeAllSound( float targetvol, int time, qboolean stopsound ) { - Q_syscall( UI_S_FADEALLSOUNDS, PASSFLOAT(targetvol), time, stopsound); + SystemCall( UI_S_FADEALLSOUNDS, PASSFLOAT(targetvol), time, stopsound); } void trap_Key_KeynumToStringBuf( int keynum, char *buf, int buflen ) { - Q_syscall( UI_KEY_KEYNUMTOSTRINGBUF, keynum, buf, buflen ); + SystemCall( UI_KEY_KEYNUMTOSTRINGBUF, keynum, buf, buflen ); } void trap_Key_GetBindingBuf( int keynum, char *buf, int buflen ) { - Q_syscall( UI_KEY_GETBINDINGBUF, keynum, buf, buflen ); + SystemCall( UI_KEY_GETBINDINGBUF, keynum, buf, buflen ); } // binding MUST be lower case void trap_Key_KeysForBinding( const char* binding, int* key1, int* key2 ) { - Q_syscall( UI_KEY_BINDINGTOKEYS, binding, key1, key2 ); + SystemCall( UI_KEY_BINDINGTOKEYS, binding, key1, key2 ); } void trap_Key_SetBinding( int keynum, const char *binding ) { - Q_syscall( UI_KEY_SETBINDING, keynum, binding ); + SystemCall( UI_KEY_SETBINDING, keynum, binding ); } qboolean trap_Key_IsDown( int keynum ) { - return Q_syscall( UI_KEY_ISDOWN, keynum ); + return SystemCall( UI_KEY_ISDOWN, keynum ); } qboolean trap_Key_GetOverstrikeMode( void ) { - return Q_syscall( UI_KEY_GETOVERSTRIKEMODE ); + return SystemCall( UI_KEY_GETOVERSTRIKEMODE ); } void trap_Key_SetOverstrikeMode( qboolean state ) { - Q_syscall( UI_KEY_SETOVERSTRIKEMODE, state ); + SystemCall( UI_KEY_SETOVERSTRIKEMODE, state ); } void trap_Key_ClearStates( void ) { - Q_syscall( UI_KEY_CLEARSTATES ); + SystemCall( UI_KEY_CLEARSTATES ); } int trap_Key_GetCatcher( void ) { - return Q_syscall( UI_KEY_GETCATCHER ); + return SystemCall( UI_KEY_GETCATCHER ); } void trap_Key_SetCatcher( int catcher ) { - Q_syscall( UI_KEY_SETCATCHER, catcher ); + SystemCall( UI_KEY_SETCATCHER, catcher ); } void trap_GetClipboardData( char *buf, int bufsize ) { - Q_syscall( UI_GETCLIPBOARDDATA, buf, bufsize ); + SystemCall( UI_GETCLIPBOARDDATA, buf, bufsize ); } void trap_GetClientState( uiClientState_t *state ) { - Q_syscall( UI_GETCLIENTSTATE, state ); + SystemCall( UI_GETCLIENTSTATE, state ); } void trap_GetGlconfig( glconfig_t *glconfig ) { - Q_syscall( UI_GETGLCONFIG, glconfig ); + SystemCall( UI_GETGLCONFIG, glconfig ); } int trap_GetConfigString( int index, char* buff, int buffsize ) { - return Q_syscall( UI_GETCONFIGSTRING, index, buff, buffsize ); + return SystemCall( UI_GETCONFIGSTRING, index, buff, buffsize ); } int trap_LAN_GetLocalServerCount( void ) { - return Q_syscall( UI_LAN_GETLOCALSERVERCOUNT ); + return SystemCall( UI_LAN_GETLOCALSERVERCOUNT ); } void trap_LAN_GetLocalServerAddressString( int n, char *buf, int buflen ) { - Q_syscall( UI_LAN_GETLOCALSERVERADDRESSSTRING, n, buf, buflen ); + SystemCall( UI_LAN_GETLOCALSERVERADDRESSSTRING, n, buf, buflen ); } int trap_LAN_GetGlobalServerCount( void ) { - return Q_syscall( UI_LAN_GETGLOBALSERVERCOUNT ); + return SystemCall( UI_LAN_GETGLOBALSERVERCOUNT ); } void trap_LAN_GetGlobalServerAddressString( int n, char *buf, int buflen ) { - Q_syscall( UI_LAN_GETGLOBALSERVERADDRESSSTRING, n, buf, buflen ); + SystemCall( UI_LAN_GETGLOBALSERVERADDRESSSTRING, n, buf, buflen ); } int trap_LAN_GetPingQueueCount( void ) { - return Q_syscall( UI_LAN_GETPINGQUEUECOUNT ); + return SystemCall( UI_LAN_GETPINGQUEUECOUNT ); } void trap_LAN_ClearPing( int n ) { - Q_syscall( UI_LAN_CLEARPING, n ); + SystemCall( UI_LAN_CLEARPING, n ); } void trap_LAN_GetPing( int n, char *buf, int buflen, int *pingtime ) { - Q_syscall( UI_LAN_GETPING, n, buf, buflen, pingtime ); + SystemCall( UI_LAN_GETPING, n, buf, buflen, pingtime ); } void trap_LAN_GetPingInfo( int n, char *buf, int buflen ) { - Q_syscall( UI_LAN_GETPINGINFO, n, buf, buflen ); + SystemCall( UI_LAN_GETPINGINFO, n, buf, buflen ); } // NERVE - SMF qboolean trap_LAN_UpdateVisiblePings( int source ) { - return Q_syscall( UI_LAN_UPDATEVISIBLEPINGS, source ); + return SystemCall( UI_LAN_UPDATEVISIBLEPINGS, source ); } int trap_LAN_GetServerCount( int source ) { - return Q_syscall( UI_LAN_GETSERVERCOUNT, source ); + return SystemCall( UI_LAN_GETSERVERCOUNT, source ); } int trap_LAN_CompareServers( int source, int sortKey, int sortDir, int s1, int s2 ) { - return Q_syscall( UI_LAN_COMPARESERVERS, source, sortKey, sortDir, s1, s2 ); + return SystemCall( UI_LAN_COMPARESERVERS, source, sortKey, sortDir, s1, s2 ); } void trap_LAN_GetServerAddressString( int source, int n, char *buf, int buflen ) { - Q_syscall( UI_LAN_GETSERVERADDRESSSTRING, source, n, buf, buflen ); + SystemCall( UI_LAN_GETSERVERADDRESSSTRING, source, n, buf, buflen ); } void trap_LAN_GetServerInfo( int source, int n, char *buf, int buflen ) { - Q_syscall( UI_LAN_GETSERVERINFO, source, n, buf, buflen ); + SystemCall( UI_LAN_GETSERVERINFO, source, n, buf, buflen ); } int trap_LAN_AddServer(int source, const char *name, const char *addr) { - return Q_syscall( UI_LAN_ADDSERVER, source, name, addr ); + return SystemCall( UI_LAN_ADDSERVER, source, name, addr ); } void trap_LAN_RemoveServer(int source, const char *addr) { - Q_syscall( UI_LAN_REMOVESERVER, source, addr ); + SystemCall( UI_LAN_REMOVESERVER, source, addr ); } int trap_LAN_GetServerPing( int source, int n ) { - return Q_syscall( UI_LAN_GETSERVERPING, source, n ); + return SystemCall( UI_LAN_GETSERVERPING, source, n ); } int trap_LAN_ServerIsVisible( int source, int n) { - return Q_syscall( UI_LAN_SERVERISVISIBLE, source, n ); + return SystemCall( UI_LAN_SERVERISVISIBLE, source, n ); } int trap_LAN_ServerStatus( const char *serverAddress, char *serverStatus, int maxLen ) { - return Q_syscall( UI_LAN_SERVERSTATUS, serverAddress, serverStatus, maxLen ); + return SystemCall( UI_LAN_SERVERSTATUS, serverAddress, serverStatus, maxLen ); } qboolean trap_LAN_ServerIsInFavoriteList( int source, int n ) { - return Q_syscall( UI_LAN_SERVERISINFAVORITELIST, source, n ); + return SystemCall( UI_LAN_SERVERISINFAVORITELIST, source, n ); } void trap_LAN_SaveCachedServers( void ) { - Q_syscall( UI_LAN_SAVECACHEDSERVERS ); + SystemCall( UI_LAN_SAVECACHEDSERVERS ); } void trap_LAN_LoadCachedServers( void ) { - Q_syscall( UI_LAN_LOADCACHEDSERVERS ); + SystemCall( UI_LAN_LOADCACHEDSERVERS ); } void trap_LAN_MarkServerVisible( int source, int n, qboolean visible ) { - Q_syscall( UI_LAN_MARKSERVERVISIBLE, source, n, visible ); + SystemCall( UI_LAN_MARKSERVERVISIBLE, source, n, visible ); } // DHM - Nerve :: PunkBuster void trap_SetPbClStatus( int status ) { - Q_syscall( UI_SET_PBCLSTATUS, status ); + SystemCall( UI_SET_PBCLSTATUS, status ); } // DHM - Nerve // TTimo: also for Sv void trap_SetPbSvStatus( int status ) { - Q_syscall( UI_SET_PBSVSTATUS, status ); + SystemCall( UI_SET_PBSVSTATUS, status ); } void trap_LAN_ResetPings(int n) { - Q_syscall( UI_LAN_RESETPINGS, n ); + SystemCall( UI_LAN_RESETPINGS, n ); } // -NERVE - SMF int trap_MemoryRemaining( void ) { - return Q_syscall( UI_MEMORY_REMAINING ); + return SystemCall( UI_MEMORY_REMAINING ); } void trap_GetCDKey( char *buf, int buflen ) { - Q_syscall( UI_GET_CDKEY, buf, buflen ); + SystemCall( UI_GET_CDKEY, buf, buflen ); } void trap_SetCDKey( char *buf ) { - Q_syscall( UI_SET_CDKEY, buf ); + SystemCall( UI_SET_CDKEY, buf ); } int trap_PC_AddGlobalDefine( const char *define ) { - return Q_syscall( UI_PC_ADD_GLOBAL_DEFINE, define ); + return SystemCall( UI_PC_ADD_GLOBAL_DEFINE, define ); } int trap_PC_RemoveAllGlobalDefines( void ) { - return Q_syscall( UI_PC_REMOVE_ALL_GLOBAL_DEFINES ); + return SystemCall( UI_PC_REMOVE_ALL_GLOBAL_DEFINES ); } int trap_PC_LoadSource( const char *filename ) { - return Q_syscall( UI_PC_LOAD_SOURCE, filename ); + return SystemCall( UI_PC_LOAD_SOURCE, filename ); } int trap_PC_FreeSource( int handle ) { - return Q_syscall( UI_PC_FREE_SOURCE, handle ); + return SystemCall( UI_PC_FREE_SOURCE, handle ); } int trap_PC_ReadToken( int handle, pc_token_t *pc_token ) { - return Q_syscall( UI_PC_READ_TOKEN, handle, pc_token ); + return SystemCall( UI_PC_READ_TOKEN, handle, pc_token ); } int trap_PC_SourceFileAndLine( int handle, char *filename, int *line ) { - return Q_syscall( UI_PC_SOURCE_FILE_AND_LINE, handle, filename, line ); + return SystemCall( UI_PC_SOURCE_FILE_AND_LINE, handle, filename, line ); } int trap_PC_UnReadToken( int handle ) { - return Q_syscall( UI_PC_UNREAD_TOKEN, handle ); + return SystemCall( UI_PC_UNREAD_TOKEN, handle ); } void trap_S_StopBackgroundTrack( void ) { - Q_syscall( UI_S_STOPBACKGROUNDTRACK ); + SystemCall( UI_S_STOPBACKGROUNDTRACK ); } /*void trap_S_StartBackgroundTrack( const char *intro, const char *loop, int fadeupTime) { - Q_syscall( UI_S_STARTBACKGROUNDTRACK, intro, loop, fadeupTime ); + SystemCall( UI_S_STARTBACKGROUNDTRACK, intro, loop, fadeupTime ); }*/ int trap_RealTime(qtime_t *qtime) { - return Q_syscall( UI_REAL_TIME, qtime ); + return SystemCall( UI_REAL_TIME, qtime ); } // this returns a handle. arg0 is the name in the format "idlogo.roq", set arg1 to NULL, alteredstates to qfalse (do not alter gamestate) int trap_CIN_PlayCinematic( const char *arg0, int xpos, int ypos, int width, int height, int bits) { - return Q_syscall(UI_CIN_PLAYCINEMATIC, arg0, xpos, ypos, width, height, bits); + return SystemCall(UI_CIN_PLAYCINEMATIC, arg0, xpos, ypos, width, height, bits); } // stops playing the cinematic and ends it. should always return FMV_EOF // cinematics must be stopped in reverse order of when they are started e_status trap_CIN_StopCinematic(int handle) { - return Q_syscall(UI_CIN_STOPCINEMATIC, handle); + return SystemCall(UI_CIN_STOPCINEMATIC, handle); } // will run a frame of the cinematic but will not draw it. Will return FMV_EOF if the end of the cinematic has been reached. e_status trap_CIN_RunCinematic (int handle) { - return Q_syscall(UI_CIN_RUNCINEMATIC, handle); + return SystemCall(UI_CIN_RUNCINEMATIC, handle); } // draws the current frame void trap_CIN_DrawCinematic (int handle) { - Q_syscall(UI_CIN_DRAWCINEMATIC, handle); + SystemCall(UI_CIN_DRAWCINEMATIC, handle); } // allows you to resize the animation dynamically void trap_CIN_SetExtents (int handle, int x, int y, int w, int h) { - Q_syscall(UI_CIN_SETEXTENTS, handle, x, y, w, h); + SystemCall(UI_CIN_SETEXTENTS, handle, x, y, w, h); } void trap_R_RemapShader( const char *oldShader, const char *newShader, const char *timeOffset ) { - Q_syscall( UI_R_REMAP_SHADER, oldShader, newShader, timeOffset ); + SystemCall( UI_R_REMAP_SHADER, oldShader, newShader, timeOffset ); } qboolean trap_VerifyCDKey( const char *key, const char *chksum) { - return Q_syscall( UI_VERIFY_CDKEY, key, chksum); + return SystemCall( UI_VERIFY_CDKEY, key, chksum); } // NERVE - SMF qboolean trap_GetLimboString( int index, char *buf ) { - return Q_syscall( UI_CL_GETLIMBOSTRING, index, buf ); + return SystemCall( UI_CL_GETLIMBOSTRING, index, buf ); } #define MAX_VA_STRING 32000 @@ -508,7 +507,7 @@ char* trap_TranslateString( const char *string ) { buf = staticbuf[bufcount++ % 2]; #ifdef LOCALIZATION_SUPPORT - Q_syscall( UI_CL_TRANSLATE_STRING, string, buf ); + SystemCall( UI_CL_TRANSLATE_STRING, string, buf ); #else Q_strncpyz( buf, string, MAX_VA_STRING ); #endif // LOCALIZATION_SUPPORT @@ -518,36 +517,36 @@ char* trap_TranslateString( const char *string ) { // DHM - Nerve void trap_CheckAutoUpdate( void ) { - Q_syscall( UI_CHECKAUTOUPDATE ); + SystemCall( UI_CHECKAUTOUPDATE ); } void trap_GetAutoUpdate( void ) { - Q_syscall( UI_GET_AUTOUPDATE ); + SystemCall( UI_GET_AUTOUPDATE ); } // DHM - Nerve void trap_openURL( const char *s ) { - Q_syscall( UI_OPENURL, s ); + SystemCall( UI_OPENURL, s ); } void trap_GetHunkData( int* hunkused, int* hunkexpected ) { - Q_syscall( UI_GETHUNKDATA, hunkused, hunkexpected ); + SystemCall( UI_GETHUNKDATA, hunkused, hunkexpected ); } // extension interface qboolean trap_GetValue( char *value, int valueSize, const char *key ) { - return Q_syscall( dll_com_trapGetValue, value, valueSize, key ); + return SystemCall( dll_com_trapGetValue, value, valueSize, key ); } void trap_R_AddRefEntityToScene2( const refEntity_t *re ) { - Q_syscall( dll_trap_R_AddRefEntityToScene2, re ); + SystemCall( dll_trap_R_AddRefEntityToScene2, re ); } void trap_R_AddLinearLightToScene( const vec3_t start, const vec3_t end, float intensity, float r, float g, float b ) { - Q_syscall( dll_trap_R_AddLinearLightToScene, start, end, intensity, r, g, b ); + SystemCall( dll_trap_R_AddLinearLightToScene, start, end, intensity, r, g, b ); } void trap_RemoveCommand( const char *cmdName ) { - Q_syscall( dll_trap_RemoveCommand, cmdName ); + SystemCall( dll_trap_RemoveCommand, cmdName ); } diff --git a/code/api/shared/cg_shared_syscalls.c b/code/api/shared/cg_shared_syscalls.c index 5387b07..fcd71d3 100644 --- a/code/api/shared/cg_shared_syscalls.c +++ b/code/api/shared/cg_shared_syscalls.c @@ -32,10 +32,10 @@ If you have questions concerning this license or the applicable additional terms void trap_R_RealAddLightToScene( const vec3_t org, float radius, float intensity, float r, float g, float b, qhandle_t hShader, int flags ) { #ifdef API_Q3 - Q_syscall( CG_R_ADDLIGHTTOSCENE, org, PASSFLOAT(radius), PASSFLOAT(r), PASSFLOAT(g), PASSFLOAT(b) ); + SystemCall( CG_R_ADDLIGHTTOSCENE, org, PASSFLOAT(radius), PASSFLOAT(r), PASSFLOAT(g), PASSFLOAT(b) ); #endif #ifdef API_ET - Q_syscall( CG_R_ADDLIGHTTOSCENE, org, PASSFLOAT( radius ), PASSFLOAT( intensity ), + SystemCall( CG_R_ADDLIGHTTOSCENE, org, PASSFLOAT( radius ), PASSFLOAT( intensity ), PASSFLOAT( r ), PASSFLOAT( g ), PASSFLOAT( b ), hShader, flags ); #endif } @@ -43,19 +43,19 @@ void trap_R_RealAddLightToScene( const vec3_t org, float radius, float intensity int trap_R_LerpTag( orientation_t *tag, const refEntity_t *refent, const char *tagName, int startIndex ) { #ifdef API_Q3 float backLerp = 1.f - refent->backlerp; - return Q_syscall( CG_R_LERPTAG, tag, refent->hModel, refent->oldframe, refent->frame, PASSFLOAT(backLerp), tagName ); + return SystemCall( CG_R_LERPTAG, tag, refent->hModel, refent->oldframe, refent->frame, PASSFLOAT(backLerp), tagName ); #endif #ifdef API_ET - return Q_syscall( CG_R_LERPTAG, tag, refent, tagName, startIndex ); + return SystemCall( CG_R_LERPTAG, tag, refent, tagName, startIndex ); #endif } void trap_S_ClearLoopingSounds( qboolean killall ) { #ifdef API_Q3 - Q_syscall( CG_S_CLEARLOOPINGSOUNDS, killall ); + SystemCall( CG_S_CLEARLOOPINGSOUNDS, killall ); #endif #ifdef API_ET - Q_syscall( CG_S_CLEARLOOPINGSOUNDS ); + SystemCall( CG_S_CLEARLOOPINGSOUNDS ); #endif } @@ -64,10 +64,10 @@ void trap_S_AddLoopingSound( int entityNum, const vec3_t origin, const vec3_t ve #ifdef DEBUGREG cgs.registeredSoundCounts[(int) sfx]++; #endif - Q_syscall( CG_S_ADDLOOPINGSOUND, entityNum, origin, velocity, sfx ); + SystemCall( CG_S_ADDLOOPINGSOUND, entityNum, origin, velocity, sfx ); #endif #ifdef API_ET - Q_syscall( CG_S_ADDLOOPINGSOUND, origin, velocity, 1250, sfx, volume, soundTime ); // volume was previously removed from CG_S_ADDLOOPINGSOUND. I added 'range' + SystemCall( CG_S_ADDLOOPINGSOUND, origin, velocity, 1250, sfx, volume, soundTime ); // volume was previously removed from CG_S_ADDLOOPINGSOUND. I added 'range' #endif } @@ -76,27 +76,27 @@ void trap_S_AddRealLoopingSound( int entityNum, const vec3_t origin, const vec3_ #ifdef DEBUGREG cgs.registeredSoundCounts[(int) sfx]++; #endif - Q_syscall( CG_S_ADDREALLOOPINGSOUND, entityNum, origin, velocity, sfx ); + SystemCall( CG_S_ADDREALLOOPINGSOUND, entityNum, origin, velocity, sfx ); #endif #ifdef API_ET - Q_syscall( CG_S_ADDREALLOOPINGSOUND, origin, velocity, range, sfx, volume, soundTime ); + SystemCall( CG_S_ADDREALLOOPINGSOUND, origin, velocity, range, sfx, volume, soundTime ); #endif } void trap_S_StartBackgroundTrack( const char *intro, const char *loop, int fadeupTime ) { #ifdef API_Q3 - Q_syscall( CG_S_STARTBACKGROUNDTRACK, intro, loop ); + SystemCall( CG_S_STARTBACKGROUNDTRACK, intro, loop ); #endif #ifdef API_ET - Q_syscall( CG_S_STARTBACKGROUNDTRACK, intro, loop, fadeupTime ); + SystemCall( CG_S_STARTBACKGROUNDTRACK, intro, loop, fadeupTime ); #endif } void trap_SetUserCmdValue( int stateValue, int flags, float sensitivityScale, int mpIdentClient ) { #ifdef API_Q3 - Q_syscall( CG_SETUSERCMDVALUE, stateValue, PASSFLOAT(sensitivityScale) ); + SystemCall( CG_SETUSERCMDVALUE, stateValue, PASSFLOAT(sensitivityScale) ); #endif #ifdef API_ET - Q_syscall( CG_SETUSERCMDVALUE, stateValue, flags, PASSFLOAT(sensitivityScale), mpIdentClient ); + SystemCall( CG_SETUSERCMDVALUE, stateValue, flags, PASSFLOAT(sensitivityScale), mpIdentClient ); #endif } diff --git a/code/api/shared/g_shared_syscalls.c b/code/api/shared/g_shared_syscalls.c index 64cdd4e..e1b5710 100644 --- a/code/api/shared/g_shared_syscalls.c +++ b/code/api/shared/g_shared_syscalls.c @@ -32,9 +32,9 @@ If you have questions concerning this license or the applicable additional terms void trap_DropClient( int clientNum, const char *reason, int length ) { #ifdef API_Q3 - Q_syscall( G_DROP_CLIENT, clientNum, reason ); + SystemCall( G_DROP_CLIENT, clientNum, reason ); #endif #ifdef API_ET - Q_syscall( G_DROP_CLIENT, clientNum, reason, length ); + SystemCall( G_DROP_CLIENT, clientNum, reason, length ); #endif } \ No newline at end of file diff --git a/code/api/shared/ui_shared_syscalls.c b/code/api/shared/ui_shared_syscalls.c index 5cb44a3..748bb87 100644 --- a/code/api/shared/ui_shared_syscalls.c +++ b/code/api/shared/ui_shared_syscalls.c @@ -32,28 +32,28 @@ If you have questions concerning this license or the applicable additional terms void trap_R_AddLightToScene( const vec3_t org, float radius, float intensity, float r, float g, float b, qhandle_t hShader, int flags ) { #ifdef API_Q3 - Q_syscall( UI_R_ADDLIGHTTOSCENE, org, PASSFLOAT(radius), PASSFLOAT(r), PASSFLOAT(g), PASSFLOAT(b) ); + SystemCall( UI_R_ADDLIGHTTOSCENE, org, PASSFLOAT(radius), PASSFLOAT(r), PASSFLOAT(g), PASSFLOAT(b) ); #endif #ifdef API_ET - Q_syscall( UI_R_ADDLIGHTTOSCENE, org, PASSFLOAT( radius ), PASSFLOAT( intensity ), + SystemCall( UI_R_ADDLIGHTTOSCENE, org, PASSFLOAT( radius ), PASSFLOAT( intensity ), PASSFLOAT( r ), PASSFLOAT( g ), PASSFLOAT( b ), hShader, flags ); #endif } int trap_CM_LerpTag( orientation_t *tag, const refEntity_t *refent, const char *tagName, int startIndex ) { #ifdef API_Q3 - return Q_syscall( UI_CM_LERPTAG, tag, refent->hModel, refent->oldframe, refent->frame, PASSFLOAT(1.0 - refent->backlerp), tagName ); + return SystemCall( UI_CM_LERPTAG, tag, refent->hModel, refent->oldframe, refent->frame, PASSFLOAT(1.0 - refent->backlerp), tagName ); #endif #ifdef API_ET - return Q_syscall( UI_CM_LERPTAG, tag, refent, tagName, 0 ); // NEFVE - SMF - fixed + return SystemCall( UI_CM_LERPTAG, tag, refent, tagName, 0 ); // NEFVE - SMF - fixed #endif } void trap_S_StartBackgroundTrack( const char *intro, const char *loop, int fadeupTime ) { #ifdef API_Q3 - Q_syscall( UI_S_STARTBACKGROUNDTRACK, intro, loop ); + SystemCall( UI_S_STARTBACKGROUNDTRACK, intro, loop ); #endif #ifdef API_ET - Q_syscall( UI_S_STARTBACKGROUNDTRACK, intro, loop, fadeupTime ); + SystemCall( UI_S_STARTBACKGROUNDTRACK, intro, loop, fadeupTime ); #endif } diff --git a/code/game/g_local.h b/code/game/g_local.h index 106570c..c363ed4 100644 --- a/code/game/g_local.h +++ b/code/game/g_local.h @@ -1401,195 +1401,13 @@ int trap_RealTime( qtime_t *qtime ); int trap_DebugPolygonCreate(int color, int numPoints, vec3_t *points); void trap_DebugPolygonDelete(int id); -int trap_BotLibSetup( void ); -int trap_BotLibShutdown( void ); -int trap_BotLibVarSet(char *var_name, char *value); -int trap_BotLibVarGet(char *var_name, char *value, int size); -int trap_BotLibDefine(char *string); -int trap_BotLibStartFrame(float time); -int trap_BotLibLoadMap(const char *mapname); -int trap_BotLibUpdateEntity(int ent, void /* struct bot_updateentity_s */ *bue); -int trap_BotLibTest(int parm0, char *parm1, vec3_t parm2, vec3_t parm3); - int trap_BotGetSnapshotEntity( int clientNum, int sequence ); int trap_BotGetServerCommand(int clientNum, char *message, int size); //int trap_BotGetConsoleMessage(int clientNum, char *message, int size); void trap_BotUserCommand(int client, usercmd_t *ucmd); -void trap_AAS_EntityInfo(int entnum, void /* struct aas_entityinfo_s */ *info); - -int trap_AAS_Initialized(void); -void trap_AAS_PresenceTypeBoundingBox(int presencetype, vec3_t mins, vec3_t maxs); -float trap_AAS_Time(void); - -// Ridah -void trap_AAS_SetCurrentWorld(int index); -// done. - -int trap_AAS_PointAreaNum(vec3_t point); -int trap_AAS_TraceAreas(vec3_t start, vec3_t end, int *areas, vec3_t *points, int maxareas); -int trap_AAS_BBoxAreas(vec3_t absmins, vec3_t absmaxs, int *areas, int maxareas); -void trap_AAS_AreaCenter(int areanum, vec3_t center); -qboolean trap_AAS_AreaWaypoint(int areanum, vec3_t center); - -int trap_AAS_PointContents(vec3_t point); -int trap_AAS_NextBSPEntity(int ent); -int trap_AAS_ValueForBSPEpairKey(int ent, char *key, char *value, int size); -int trap_AAS_VectorForBSPEpairKey(int ent, char *key, vec3_t v); -int trap_AAS_FloatForBSPEpairKey(int ent, char *key, float *value); -int trap_AAS_IntForBSPEpairKey(int ent, char *key, int *value); - -int trap_AAS_AreaReachability(int areanum); -int trap_AAS_AreaLadder(int areanum); - -int trap_AAS_AreaTravelTimeToGoalArea(int areanum, vec3_t origin, int goalareanum, int travelflags); - -int trap_AAS_Swimming(vec3_t origin); -int trap_AAS_PredictClientMovement(void /* aas_clientmove_s */ *move, int entnum, vec3_t origin, int presencetype, int onground, vec3_t velocity, vec3_t cmdmove, int cmdframes, int maxframes, float frametime, int stopevent, int stopareanum, int visualize); - -// Ridah, route-tables -void trap_AAS_RT_ShowRoute( vec3_t srcpos, int srcnum, int destnum ); -int trap_AAS_NearestHideArea(int srcnum, vec3_t origin, int areanum, int enemynum, vec3_t enemyorigin, int enemyareanum, int travelflags, float maxdist, vec3_t distpos); -int trap_AAS_ListAreasInRange(vec3_t srcpos, int srcarea, float range, int travelflags, float **outareas, int maxareas); -int trap_AAS_AvoidDangerArea(vec3_t srcpos, int srcarea, vec3_t dangerpos, int dangerarea, float range, int travelflags); -int trap_AAS_Retreat -( - // Locations of the danger spots (AAS area numbers) - int *dangerSpots, - // The number of danger spots - int dangerSpotCount, - vec3_t srcpos, - int srcarea, - vec3_t dangerpos, - int dangerarea, - // Min range from startpos - float range, - // Min range from danger - float dangerRange, - int travelflags -); -int trap_AAS_AlternativeRouteGoals(vec3_t start, vec3_t goal, int travelflags, - void *altroutegoals, int maxaltroutegoals, - int color); -void trap_AAS_SetAASBlockingEntity( vec3_t absmin, vec3_t absmax, int blocking ); -void trap_AAS_RecordTeamDeathArea( vec3_t srcpos, int srcarea, int team, int teamCount, int travelflags ); -// done. - -void trap_EA_Say(int client, char *str); -void trap_EA_SayTeam(int client, char *str); -void trap_EA_UseItem(int client, char *it); -void trap_EA_DropItem(int client, char *it); -void trap_EA_UseInv(int client, char *inv); -void trap_EA_DropInv(int client, char *inv); -void trap_EA_Gesture(int client); void trap_EA_Command(int client, const char *command); -void trap_EA_SelectWeapon(int client, int weapon); -void trap_EA_Talk(int client); -void trap_EA_Attack(int client); -void trap_EA_Reload(int client); -void trap_EA_Activate(int client); -void trap_EA_Respawn(int client); -void trap_EA_Jump(int client); -void trap_EA_DelayedJump(int client); -void trap_EA_Crouch(int client); -void trap_EA_Walk(int client); -void trap_EA_MoveUp(int client); -void trap_EA_MoveDown(int client); -void trap_EA_MoveForward(int client); -void trap_EA_MoveBack(int client); -void trap_EA_MoveLeft(int client); -void trap_EA_MoveRight(int client); -void trap_EA_Move(int client, vec3_t dir, float speed); -void trap_EA_View(int client, vec3_t viewangles); -void trap_EA_Prone(int client); - -void trap_EA_EndRegular(int client, float thinktime); -void trap_EA_GetInput(int client, float thinktime, void /* struct bot_input_s */ *input); -void trap_EA_ResetInput(int client, void *init); - - -int trap_BotLoadCharacter(char *charfile, int skill); -void trap_BotFreeCharacter(int character); -float trap_Characteristic_Float(int character, int index); -float trap_Characteristic_BFloat(int character, int index, float min, float max); -int trap_Characteristic_Integer(int character, int index); -int trap_Characteristic_BInteger(int character, int index, int min, int max); -void trap_Characteristic_String(int character, int index, char *buf, int size); - -int trap_BotAllocChatState(void); -void trap_BotFreeChatState(int handle); -void trap_BotQueueConsoleMessage(int chatstate, int type, char *message); -void trap_BotRemoveConsoleMessage(int chatstate, int handle); -int trap_BotNextConsoleMessage(int chatstate, void /* struct bot_consolemessage_s */ *cm); -int trap_BotNumConsoleMessages(int chatstate); -void trap_BotInitialChat(int chatstate, char *type, int mcontext, char *var0, char *var1, char *var2, char *var3, char *var4, char *var5, char *var6, char *var7 ); -int trap_BotNumInitialChats(int chatstate, char *type); -int trap_BotReplyChat(int chatstate, char *message, int mcontext, int vcontext, char *var0, char *var1, char *var2, char *var3, char *var4, char *var5, char *var6, char *var7 ); -int trap_BotChatLength(int chatstate); -void trap_BotEnterChat(int chatstate, int client, int sendto); -void trap_BotGetChatMessage(int chatstate, char *buf, int size); -int trap_StringContains(char *str1, char *str2, int casesensitive); -int trap_BotFindMatch(char *str, void /* struct bot_match_s */ *match, unsigned long int context); -void trap_BotMatchVariable(void /* struct bot_match_s */ *match, int variable, char *buf, int size); -void trap_UnifyWhiteSpaces(char *string); -void trap_BotReplaceSynonyms(char *string, unsigned long int context); -int trap_BotLoadChatFile(int chatstate, char *chatfile, char *chatname); -void trap_BotSetChatGender(int chatstate, int gender); -void trap_BotSetChatName(int chatstate, char *name); -void trap_BotResetGoalState(int goalstate); -void trap_BotRemoveFromAvoidGoals(int goalstate, int number); -void trap_BotResetAvoidGoals(int goalstate); -void trap_BotPushGoal(int goalstate, void /* struct bot_goal_s */ *goal); -void trap_BotPopGoal(int goalstate); -void trap_BotEmptyGoalStack(int goalstate); -void trap_BotDumpAvoidGoals(int goalstate); -void trap_BotDumpGoalStack(int goalstate); -void trap_BotGoalName(int number, char *name, int size); -int trap_BotGetTopGoal(int goalstate, void /* struct bot_goal_s */ *goal); -int trap_BotGetSecondGoal(int goalstate, void /* struct bot_goal_s */ *goal); -int trap_BotChooseLTGItem(int goalstate, vec3_t origin, int *inventory, int travelflags); -int trap_BotChooseNBGItem(int goalstate, vec3_t origin, int *inventory, int travelflags, void /* struct bot_goal_s */ *ltg, float maxtime); -int trap_BotTouchingGoal(vec3_t origin, void /* struct bot_goal_s */ *goal); -int trap_BotItemGoalInVisButNotVisible(int viewer, vec3_t eye, vec3_t viewangles, void /* struct bot_goal_s */ *goal); -int trap_BotGetNextCampSpotGoal(int num, void /* struct bot_goal_s */ *goal); -int trap_BotGetMapLocationGoal(char *name, void /* struct bot_goal_s */ *goal); -int trap_BotGetLevelItemGoal(int index, char *classname, void /* struct bot_goal_s */ *goal); -float trap_BotAvoidGoalTime(int goalstate, int number); -void trap_BotInitLevelItems(void); -void trap_BotUpdateEntityItems(void); -int trap_BotLoadItemWeights(int goalstate, char *filename); -void trap_BotFreeItemWeights(int goalstate); -void trap_BotInterbreedGoalFuzzyLogic(int parent1, int parent2, int child); -void trap_BotSaveGoalFuzzyLogic(int goalstate, char *filename); -void trap_BotMutateGoalFuzzyLogic(int goalstate, float range); -int trap_BotAllocGoalState(int state); -void trap_BotFreeGoalState(int handle); - -void trap_BotResetMoveState(int movestate); -void trap_BotMoveToGoal(void /* struct bot_moveresult_s */ *result, int movestate, void /* struct bot_goal_s */ *goal, int travelflags); -int trap_BotMoveInDirection(int movestate, vec3_t dir, float speed, int type); -void trap_BotResetAvoidReach(int movestate); -void trap_BotResetLastAvoidReach(int movestate); -int trap_BotReachabilityArea(vec3_t origin, int testground); -int trap_BotMovementViewTarget(int movestate, void /* struct bot_goal_s */ *goal, int travelflags, float lookahead, vec3_t target); -int trap_BotPredictVisiblePosition(vec3_t origin, int areanum, void /* struct bot_goal_s */ *goal, int travelflags, vec3_t target); -int trap_BotAllocMoveState(void); -void trap_BotFreeMoveState(int handle); -void trap_BotInitMoveState(int handle, void /* struct bot_initmove_s */ *initmove); -// Ridah -void trap_BotInitAvoidReach(int handle); -// done. - -int trap_BotChooseBestFightWeapon(int weaponstate, int *inventory); -void trap_BotGetWeaponInfo(int weaponstate, int weapon, void /* struct weaponinfo_s */ *weaponinfo); -int trap_BotLoadWeaponWeights(int weaponstate, char *filename); -int trap_BotAllocWeaponState(void); -void trap_BotFreeWeaponState(int weaponstate); -void trap_BotResetWeaponState(int weaponstate); - -int trap_GeneticParentsAndChildSelection(int numranks, float *ranks, int *parent1, int *parent2, int *child); - void trap_SnapVector( float *v ); void trap_PbStat ( int clientNum , char *category , char *values ) ;