codemp/cgame/cg_syscalls.c

Go to the documentation of this file.
00001 // Copyright (C) 1999-2000 Id Software, Inc.
00002 //
00003 // cg_syscalls.c -- this file is only included when building a dll
00004 // cg_syscalls.asm is included instead when building a qvm
00005 #include "cg_local.h"
00006 
00007 static int (QDECL *syscall)( int arg, ... ) = (int (QDECL *)( int, ...))-1;
00008 
00009 #include "../namespace_begin.h"
00010 void dllEntry( int (QDECL  *syscallptr)( int arg,... ) ) {
00011         syscall = syscallptr;
00012 }
00013 
00014 
00015 int PASSFLOAT( float x ) {
00016         float   floatTemp;
00017         floatTemp = x;
00018         return *(int *)&floatTemp;
00019 }
00020 
00021 void    trap_Print( const char *fmt ) {
00022         syscall( CG_PRINT, fmt );
00023 }
00024 
00025 void    trap_Error( const char *fmt ) {
00026         syscall( CG_ERROR, fmt );
00027 }
00028 
00029 int             trap_Milliseconds( void ) {
00030         return syscall( CG_MILLISECONDS ); 
00031 }
00032 
00033 //rww - precision timer funcs... -ALWAYS- call end after start with supplied ptr, or you'll get a nasty memory leak.
00034 //not that you should be using these outside of debug anyway.. because you shouldn't be. So don't.
00035 
00036 //Start should be suppled with a pointer to an empty pointer (e.g. void *blah; trap_PrecisionTimer_Start(&blah);),
00037 //the empty pointer will be filled with an exe address to our timer (this address means nothing in vm land however).
00038 //You must pass this pointer back unmodified to the timer end func.
00039 void trap_PrecisionTimer_Start(void **theNewTimer)
00040 {
00041         syscall(CG_PRECISIONTIMER_START, theNewTimer);
00042 }
00043 
00044 //If you're using the above example, the appropriate call for this is int result = trap_PrecisionTimer_End(blah);
00045 int trap_PrecisionTimer_End(void *theTimer)
00046 {
00047         return syscall(CG_PRECISIONTIMER_END, theTimer);
00048 }
00049 
00050 void    trap_Cvar_Register( vmCvar_t *vmCvar, const char *varName, const char *defaultValue, int flags ) {
00051         syscall( CG_CVAR_REGISTER, vmCvar, varName, defaultValue, flags );
00052 }
00053 
00054 void    trap_Cvar_Update( vmCvar_t *vmCvar ) {
00055         syscall( CG_CVAR_UPDATE, vmCvar );
00056 }
00057 
00058 void    trap_Cvar_Set( const char *var_name, const char *value ) {
00059         syscall( CG_CVAR_SET, var_name, value );
00060 }
00061 
00062 void trap_Cvar_VariableStringBuffer( const char *var_name, char *buffer, int bufsize ) {
00063         syscall( CG_CVAR_VARIABLESTRINGBUFFER, var_name, buffer, bufsize );
00064 }
00065 
00066 int trap_Cvar_GetHiddenVarValue(const char *name)
00067 {
00068         return syscall(CG_CVAR_GETHIDDENVALUE, name);
00069 }
00070 
00071 int             trap_Argc( void ) {
00072         return syscall( CG_ARGC );
00073 }
00074 
00075 void    trap_Argv( int n, char *buffer, int bufferLength ) {
00076         syscall( CG_ARGV, n, buffer, bufferLength );
00077 }
00078 
00079 void    trap_Args( char *buffer, int bufferLength ) {
00080         syscall( CG_ARGS, buffer, bufferLength );
00081 }
00082 
00083 int             trap_FS_FOpenFile( const char *qpath, fileHandle_t *f, fsMode_t mode ) {
00084         return syscall( CG_FS_FOPENFILE, qpath, f, mode );
00085 }
00086 
00087 void    trap_FS_Read( void *buffer, int len, fileHandle_t f ) {
00088         syscall( CG_FS_READ, buffer, len, f );
00089 }
00090 
00091 void    trap_FS_Write( const void *buffer, int len, fileHandle_t f ) {
00092         syscall( CG_FS_WRITE, buffer, len, f );
00093 }
00094 
00095 void    trap_FS_FCloseFile( fileHandle_t f ) {
00096         syscall( CG_FS_FCLOSEFILE, f );
00097 }
00098 
00099 int trap_FS_GetFileList(  const char *path, const char *extension, char *listbuf, int bufsize ) {
00100         return syscall( CG_FS_GETFILELIST, path, extension, listbuf, bufsize );
00101 }
00102 
00103 void    trap_SendConsoleCommand( const char *text ) {
00104         syscall( CG_SENDCONSOLECOMMAND, text );
00105 }
00106 
00107 void    trap_AddCommand( const char *cmdName ) {
00108         syscall( CG_ADDCOMMAND, cmdName );
00109 }
00110 
00111 void    trap_RemoveCommand( const char *cmdName ) {
00112         syscall( CG_REMOVECOMMAND, cmdName );
00113 }
00114 
00115 void    trap_SendClientCommand( const char *s ) {
00116         syscall( CG_SENDCLIENTCOMMAND, s );
00117 }
00118 
00119 void    trap_UpdateScreen( void ) {
00120         syscall( CG_UPDATESCREEN );
00121 }
00122 
00123 void    trap_CM_LoadMap( const char *mapname, qboolean SubBSP ) {
00124         syscall( CG_CM_LOADMAP, mapname, SubBSP );
00125 }
00126 
00127 int             trap_CM_NumInlineModels( void ) {
00128         return syscall( CG_CM_NUMINLINEMODELS );
00129 }
00130 
00131 clipHandle_t trap_CM_InlineModel( int index ) {
00132         return syscall( CG_CM_INLINEMODEL, index );
00133 }
00134 
00135 clipHandle_t trap_CM_TempBoxModel( const vec3_t mins, const vec3_t maxs ) {
00136         return syscall( CG_CM_TEMPBOXMODEL, mins, maxs );
00137 }
00138 
00139 clipHandle_t trap_CM_TempCapsuleModel( const vec3_t mins, const vec3_t maxs ) {
00140         return syscall( CG_CM_TEMPCAPSULEMODEL, mins, maxs );
00141 }
00142 
00143 int             trap_CM_PointContents( const vec3_t p, clipHandle_t model ) {
00144         return syscall( CG_CM_POINTCONTENTS, p, model );
00145 }
00146 
00147 int             trap_CM_TransformedPointContents( const vec3_t p, clipHandle_t model, const vec3_t origin, const vec3_t angles ) {
00148         return syscall( CG_CM_TRANSFORMEDPOINTCONTENTS, p, model, origin, angles );
00149 }
00150 
00151 void    trap_CM_BoxTrace( trace_t *results, const vec3_t start, const vec3_t end,
00152                                                   const vec3_t mins, const vec3_t maxs,
00153                                                   clipHandle_t model, int brushmask ) {
00154         syscall( CG_CM_BOXTRACE, results, start, end, mins, maxs, model, brushmask );
00155 }
00156 
00157 void    trap_CM_CapsuleTrace( trace_t *results, const vec3_t start, const vec3_t end,
00158                                                   const vec3_t mins, const vec3_t maxs,
00159                                                   clipHandle_t model, int brushmask ) {
00160         syscall( CG_CM_CAPSULETRACE, results, start, end, mins, maxs, model, brushmask );
00161 }
00162 
00163 void    trap_CM_TransformedBoxTrace( trace_t *results, const vec3_t start, const vec3_t end,
00164                                                   const vec3_t mins, const vec3_t maxs,
00165                                                   clipHandle_t model, int brushmask,
00166                                                   const vec3_t origin, const vec3_t angles ) {
00167         syscall( CG_CM_TRANSFORMEDBOXTRACE, results, start, end, mins, maxs, model, brushmask, origin, angles );
00168 }
00169 
00170 void    trap_CM_TransformedCapsuleTrace( trace_t *results, const vec3_t start, const vec3_t end,
00171                                                   const vec3_t mins, const vec3_t maxs,
00172                                                   clipHandle_t model, int brushmask,
00173                                                   const vec3_t origin, const vec3_t angles ) {
00174         syscall( CG_CM_TRANSFORMEDCAPSULETRACE, results, start, end, mins, maxs, model, brushmask, origin, angles );
00175 }
00176 
00177 int             trap_CM_MarkFragments( int numPoints, const vec3_t *points, 
00178                                 const vec3_t projection,
00179                                 int maxPoints, vec3_t pointBuffer,
00180                                 int maxFragments, markFragment_t *fragmentBuffer ) {
00181         return syscall( CG_CM_MARKFRAGMENTS, numPoints, points, projection, maxPoints, pointBuffer, maxFragments, fragmentBuffer );
00182 }
00183 
00184 int trap_S_GetVoiceVolume( int entityNum ) {
00185         return syscall( CG_S_GETVOICEVOLUME, entityNum );
00186 }
00187 
00188 void    trap_S_MuteSound( int entityNum, int entchannel ) {
00189         syscall( CG_S_MUTESOUND, entityNum, entchannel );
00190 }
00191 
00192 void    trap_S_StartSound( vec3_t origin, int entityNum, int entchannel, sfxHandle_t sfx ) {
00193         syscall( CG_S_STARTSOUND, origin, entityNum, entchannel, sfx );
00194 }
00195 
00196 void    trap_S_StartLocalSound( sfxHandle_t sfx, int channelNum ) {
00197         syscall( CG_S_STARTLOCALSOUND, sfx, channelNum );
00198 }
00199 
00200 void    trap_S_ClearLoopingSounds(void) {
00201         syscall( CG_S_CLEARLOOPINGSOUNDS );
00202 }
00203 
00204 void    trap_S_AddLoopingSound( int entityNum, const vec3_t origin, const vec3_t velocity, sfxHandle_t sfx ) {
00205         syscall( CG_S_ADDLOOPINGSOUND, entityNum, origin, velocity, sfx );
00206 }
00207 
00208 void    trap_S_UpdateEntityPosition( int entityNum, const vec3_t origin ) {
00209         syscall( CG_S_UPDATEENTITYPOSITION, entityNum, origin );
00210 }
00211 
00212 void    trap_S_AddRealLoopingSound( int entityNum, const vec3_t origin, const vec3_t velocity, sfxHandle_t sfx ) {
00213         syscall( CG_S_ADDREALLOOPINGSOUND, entityNum, origin, velocity, sfx );
00214 }
00215 
00216 void    trap_S_StopLoopingSound( int entityNum ) {
00217         syscall( CG_S_STOPLOOPINGSOUND, entityNum );
00218 }
00219 
00220 void    trap_S_Respatialize( int entityNum, const vec3_t origin, vec3_t axis[3], int inwater ) {
00221         syscall( CG_S_RESPATIALIZE, entityNum, origin, axis, inwater );
00222 }
00223 
00224 void trap_S_ShutUp(qboolean shutUpFactor)
00225 {
00226         syscall(CG_S_SHUTUP, shutUpFactor);
00227 }
00228 
00229 sfxHandle_t     trap_S_RegisterSound( const char *sample ) {
00230         return syscall( CG_S_REGISTERSOUND, sample );
00231 }
00232 
00233 void    trap_S_StartBackgroundTrack( const char *intro, const char *loop, qboolean bReturnWithoutStarting  ) {
00234         syscall( CG_S_STARTBACKGROUNDTRACK, intro, loop, bReturnWithoutStarting  );
00235 }
00236 
00237 void trap_S_UpdateAmbientSet( const char *name, vec3_t origin )
00238 {
00239         syscall(CG_S_UPDATEAMBIENTSET, name, origin);
00240 }
00241 
00242 void trap_AS_ParseSets( void )
00243 {
00244         syscall(CG_AS_PARSESETS);
00245 }
00246 
00247 void trap_AS_AddPrecacheEntry( const char *name )
00248 {
00249         syscall(CG_AS_ADDPRECACHEENTRY, name);
00250 }
00251 
00252 int trap_S_AddLocalSet( const char *name, vec3_t listener_origin, vec3_t origin, int entID, int time )
00253 {
00254         return syscall(CG_S_ADDLOCALSET, name, listener_origin, origin, entID, time);
00255 }
00256 
00257 sfxHandle_t trap_AS_GetBModelSound( const char *name, int stage )
00258 {
00259         return syscall(CG_AS_GETBMODELSOUND, name, stage);
00260 }
00261 
00262 void    trap_R_LoadWorldMap( const char *mapname ) {
00263         syscall( CG_R_LOADWORLDMAP, mapname );
00264 }
00265 
00266 qhandle_t trap_R_RegisterModel( const char *name ) {
00267         return syscall( CG_R_REGISTERMODEL, name );
00268 }
00269 
00270 qhandle_t trap_R_RegisterSkin( const char *name ) {
00271         return syscall( CG_R_REGISTERSKIN, name );
00272 }
00273 
00274 qhandle_t trap_R_RegisterShader( const char *name ) {
00275         return syscall( CG_R_REGISTERSHADER, name );
00276 }
00277 
00278 qhandle_t trap_R_RegisterShaderNoMip( const char *name ) {
00279         return syscall( CG_R_REGISTERSHADERNOMIP, name );
00280 }
00281 
00282 qhandle_t trap_R_RegisterFont( const char *fontName )
00283 {
00284         return syscall( CG_R_REGISTERFONT, fontName);
00285 }
00286 
00287 int     trap_R_Font_StrLenPixels(const char *text, const int iFontIndex, const float scale)
00288 {
00289         return syscall( CG_R_FONT_STRLENPIXELS, text, iFontIndex, PASSFLOAT(scale));
00290 }
00291 
00292 int trap_R_Font_StrLenChars(const char *text)
00293 {
00294         return syscall( CG_R_FONT_STRLENCHARS, text);
00295 }
00296 
00297 int trap_R_Font_HeightPixels(const int iFontIndex, const float scale)
00298 {
00299         return syscall( CG_R_FONT_STRHEIGHTPIXELS, iFontIndex, PASSFLOAT(scale));
00300 }
00301 
00302 void trap_R_Font_DrawString(int ox, int oy, const char *text, const float *rgba, const int setIndex, int iCharLimit, const float scale)
00303 {
00304         syscall( CG_R_FONT_DRAWSTRING, ox, oy, text, rgba, setIndex, iCharLimit, PASSFLOAT(scale));
00305 }
00306 
00307 qboolean trap_Language_IsAsian(void)
00308 {
00309         return syscall( CG_LANGUAGE_ISASIAN );
00310 }
00311 
00312 qboolean trap_Language_UsesSpaces(void)
00313 {
00314         return syscall( CG_LANGUAGE_USESSPACES );
00315 }
00316 
00317 unsigned int trap_AnyLanguage_ReadCharFromString( const char *psText, int *piAdvanceCount, qboolean *pbIsTrailingPunctuation/* = NULL*/ )
00318 {
00319         return syscall( CG_ANYLANGUAGE_READCHARFROMSTRING, psText, piAdvanceCount, pbIsTrailingPunctuation);
00320 }
00321 
00322 void    trap_R_ClearScene( void ) {
00323         syscall( CG_R_CLEARSCENE );
00324 }
00325 
00326 void trap_R_ClearDecals ( void )
00327 {
00328         syscall ( CG_R_CLEARDECALS );
00329 }
00330 
00331 void    trap_R_AddRefEntityToScene( const refEntity_t *re ) {
00332         syscall( CG_R_ADDREFENTITYTOSCENE, re );
00333 }
00334 
00335 void    trap_R_AddPolyToScene( qhandle_t hShader , int numVerts, const polyVert_t *verts ) {
00336         syscall( CG_R_ADDPOLYTOSCENE, hShader, numVerts, verts );
00337 }
00338 
00339 void    trap_R_AddPolysToScene( qhandle_t hShader , int numVerts, const polyVert_t *verts, int num ) {
00340         syscall( CG_R_ADDPOLYSTOSCENE, hShader, numVerts, verts, num );
00341 }
00342 
00343 void trap_R_AddDecalToScene ( qhandle_t shader, const vec3_t origin, const vec3_t dir, float orientation, float r, float g, float b, float a, qboolean alphaFade, float radius, qboolean temporary )
00344 {
00345         syscall( CG_R_ADDDECALTOSCENE, shader, origin, dir, PASSFLOAT(orientation), PASSFLOAT(r), PASSFLOAT(g), PASSFLOAT(b), PASSFLOAT(a), alphaFade, PASSFLOAT(radius), temporary );
00346 }
00347 
00348 int             trap_R_LightForPoint( vec3_t point, vec3_t ambientLight, vec3_t directedLight, vec3_t lightDir ) {
00349         return syscall( CG_R_LIGHTFORPOINT, point, ambientLight, directedLight, lightDir );
00350 }
00351 
00352 void    trap_R_AddLightToScene( const vec3_t org, float intensity, float r, float g, float b ) {
00353         syscall( CG_R_ADDLIGHTTOSCENE, org, PASSFLOAT(intensity), PASSFLOAT(r), PASSFLOAT(g), PASSFLOAT(b) );
00354 }
00355 
00356 void    trap_R_AddAdditiveLightToScene( const vec3_t org, float intensity, float r, float g, float b ) {
00357         syscall( CG_R_ADDADDITIVELIGHTTOSCENE, org, PASSFLOAT(intensity), PASSFLOAT(r), PASSFLOAT(g), PASSFLOAT(b) );
00358 }
00359 
00360 void    trap_R_RenderScene( const refdef_t *fd ) {
00361         syscall( CG_R_RENDERSCENE, fd );
00362 }
00363 
00364 void    trap_R_SetColor( const float *rgba ) {
00365         syscall( CG_R_SETCOLOR, rgba );
00366 }
00367 
00368 void    trap_R_DrawStretchPic( float x, float y, float w, float h, 
00369                                                            float s1, float t1, float s2, float t2, qhandle_t hShader ) {
00370         syscall( CG_R_DRAWSTRETCHPIC, PASSFLOAT(x), PASSFLOAT(y), PASSFLOAT(w), PASSFLOAT(h), PASSFLOAT(s1), PASSFLOAT(t1), PASSFLOAT(s2), PASSFLOAT(t2), hShader );
00371 }
00372 
00373 void    trap_R_ModelBounds( clipHandle_t model, vec3_t mins, vec3_t maxs ) {
00374         syscall( CG_R_MODELBOUNDS, model, mins, maxs );
00375 }
00376 
00377 int             trap_R_LerpTag( orientation_t *tag, clipHandle_t mod, int startFrame, int endFrame, 
00378                                            float frac, const char *tagName ) {
00379         return syscall( CG_R_LERPTAG, tag, mod, startFrame, endFrame, PASSFLOAT(frac), tagName );
00380 }
00381 
00382 void    trap_R_DrawRotatePic( float x, float y, float w, float h, 
00383                                    float s1, float t1, float s2, float t2,float a, qhandle_t hShader ) 
00384 {
00385         syscall( CG_R_DRAWROTATEPIC, PASSFLOAT(x), PASSFLOAT(y), PASSFLOAT(w), PASSFLOAT(h), PASSFLOAT(s1), PASSFLOAT(t1), PASSFLOAT(s2), PASSFLOAT(t2), PASSFLOAT(a), hShader );
00386 }
00387 
00388 void    trap_R_DrawRotatePic2( float x, float y, float w, float h, 
00389                                    float s1, float t1, float s2, float t2,float a, qhandle_t hShader ) 
00390 {
00391         syscall( CG_R_DRAWROTATEPIC2, PASSFLOAT(x), PASSFLOAT(y), PASSFLOAT(w), PASSFLOAT(h), PASSFLOAT(s1), PASSFLOAT(t1), PASSFLOAT(s2), PASSFLOAT(t2), PASSFLOAT(a), hShader );
00392 }
00393 
00394 //linear fogging, with settable range -rww
00395 void trap_R_SetRangeFog(float range)
00396 {
00397         syscall(CG_R_SETRANGEFOG, PASSFLOAT(range));
00398 }
00399 
00400 //set some properties for the draw layer for my refractive effect (here primarily for mod authors) -rww
00401 void trap_R_SetRefractProp(float alpha, float stretch, qboolean prepost, qboolean negate)
00402 {
00403         syscall(CG_R_SETREFRACTIONPROP, PASSFLOAT(alpha), PASSFLOAT(stretch), prepost, negate);
00404 }
00405 
00406 void    trap_R_RemapShader( const char *oldShader, const char *newShader, const char *timeOffset ) 
00407 {
00408         syscall( CG_R_REMAP_SHADER, oldShader, newShader, timeOffset );
00409 }
00410 
00411 void    trap_R_GetLightStyle(int style, color4ub_t color)
00412 {
00413         syscall( CG_R_GET_LIGHT_STYLE, style, color );
00414 }
00415 
00416 void    trap_R_SetLightStyle(int style, int color)
00417 {
00418         syscall( CG_R_SET_LIGHT_STYLE, style, color );
00419 }
00420 
00421 void    trap_R_GetBModelVerts(int bmodelIndex, vec3_t *verts, vec3_t normal )
00422 {
00423         syscall( CG_R_GET_BMODEL_VERTS, bmodelIndex, verts, normal );
00424 }
00425 
00426 void trap_R_GetDistanceCull(float *f)
00427 {
00428         syscall(CG_R_GETDISTANCECULL, f);
00429 }
00430 
00431 //get screen resolution -rww
00432 void trap_R_GetRealRes(int *w, int *h)
00433 {
00434         syscall( CG_R_GETREALRES, w, h );
00435 }
00436 
00437 
00438 //automap elevation setting -rww
00439 void trap_R_AutomapElevAdj(float newHeight)
00440 {
00441         syscall( CG_R_AUTOMAPELEVADJ, PASSFLOAT(newHeight) );
00442 }
00443 
00444 //initialize automap -rww
00445 qboolean trap_R_InitWireframeAutomap(void)
00446 {
00447         return syscall( CG_R_INITWIREFRAMEAUTO );
00448 }
00449 
00450 void    trap_FX_AddLine( const vec3_t start, const vec3_t end, float size1, float size2, float sizeParm,
00451                                                                         float alpha1, float alpha2, float alphaParm,
00452                                                                         const vec3_t sRGB, const vec3_t eRGB, float rgbParm,
00453                                                                         int killTime, qhandle_t shader, int flags)
00454 {
00455         syscall( CG_FX_ADDLINE, start, end, PASSFLOAT(size1), PASSFLOAT(size2), PASSFLOAT(sizeParm),
00456                                                                         PASSFLOAT(alpha1), PASSFLOAT(alpha2), PASSFLOAT(alphaParm),
00457                                                                         sRGB, eRGB, PASSFLOAT(rgbParm),
00458                                                                         killTime, shader, flags);
00459 }
00460 
00461 void            trap_GetGlconfig( glconfig_t *glconfig ) {
00462         syscall( CG_GETGLCONFIG, glconfig );
00463 }
00464 
00465 void            trap_GetGameState( gameState_t *gamestate ) {
00466         syscall( CG_GETGAMESTATE, gamestate );
00467 }
00468 
00469 void            trap_GetCurrentSnapshotNumber( int *snapshotNumber, int *serverTime ) {
00470         syscall( CG_GETCURRENTSNAPSHOTNUMBER, snapshotNumber, serverTime );
00471 }
00472 
00473 qboolean        trap_GetSnapshot( int snapshotNumber, snapshot_t *snapshot ) {
00474         return syscall( CG_GETSNAPSHOT, snapshotNumber, snapshot );
00475 }
00476 
00477 qboolean        trap_GetDefaultState(int entityIndex, entityState_t *state )
00478 { //rwwRMG - added [NEWTRAP]
00479         return syscall( CG_GETDEFAULTSTATE, entityIndex, state );
00480 }
00481 
00482 qboolean        trap_GetServerCommand( int serverCommandNumber ) {
00483         return syscall( CG_GETSERVERCOMMAND, serverCommandNumber );
00484 }
00485 
00486 int                     trap_GetCurrentCmdNumber( void ) {
00487         return syscall( CG_GETCURRENTCMDNUMBER );
00488 }
00489 
00490 qboolean        trap_GetUserCmd( int cmdNumber, usercmd_t *ucmd ) {
00491         return syscall( CG_GETUSERCMD, cmdNumber, ucmd );
00492 }
00493 
00494 void            trap_SetUserCmdValue( int stateValue, float sensitivityScale, float mPitchOverride, float mYawOverride, float mSensitivityOverride, int fpSel, int invenSel, qboolean fighterControls ) {
00495         syscall( CG_SETUSERCMDVALUE, stateValue, PASSFLOAT(sensitivityScale), PASSFLOAT(mPitchOverride), PASSFLOAT(mYawOverride), PASSFLOAT(mSensitivityOverride), fpSel, invenSel, fighterControls );
00496 }
00497 
00498 void trap_SetClientForceAngle(int time, vec3_t angle)
00499 {
00500         syscall( CG_SETCLIENTFORCEANGLE, time, angle );
00501 }
00502 
00503 void trap_SetClientTurnExtent(float turnAdd, float turnSub, int turnTime)
00504 {
00505         syscall( CG_SETCLIENTTURNEXTENT, PASSFLOAT(turnAdd), PASSFLOAT(turnSub), turnTime );
00506 }
00507 
00508 void trap_OpenUIMenu(int menuID)
00509 {
00510         syscall( CG_OPENUIMENU, menuID );
00511 }
00512 
00513 void            testPrintInt( char *string, int i ) {
00514         syscall( CG_TESTPRINTINT, string, i );
00515 }
00516 
00517 void            testPrintFloat( char *string, float f ) {
00518         syscall( CG_TESTPRINTFLOAT, string, PASSFLOAT(f) );
00519 }
00520 
00521 int trap_MemoryRemaining( void ) {
00522         return syscall( CG_MEMORY_REMAINING );
00523 }
00524 
00525 qboolean trap_Key_IsDown( int keynum ) {
00526         return syscall( CG_KEY_ISDOWN, keynum );
00527 }
00528 
00529 int trap_Key_GetCatcher( void ) {
00530         return syscall( CG_KEY_GETCATCHER );
00531 }
00532 
00533 void trap_Key_SetCatcher( int catcher ) {
00534         syscall( CG_KEY_SETCATCHER, catcher );
00535 }
00536 
00537 int trap_Key_GetKey( const char *binding ) {
00538         return syscall( CG_KEY_GETKEY, binding );
00539 }
00540 
00541 int trap_PC_AddGlobalDefine( char *define ) {
00542         return syscall( CG_PC_ADD_GLOBAL_DEFINE, define );
00543 }
00544 
00545 int trap_PC_LoadSource( const char *filename ) {
00546         return syscall( CG_PC_LOAD_SOURCE, filename );
00547 }
00548 
00549 int trap_PC_FreeSource( int handle ) {
00550         return syscall( CG_PC_FREE_SOURCE, handle );
00551 }
00552 
00553 int trap_PC_ReadToken( int handle, pc_token_t *pc_token ) {
00554         return syscall( CG_PC_READ_TOKEN, handle, pc_token );
00555 }
00556 
00557 int trap_PC_SourceFileAndLine( int handle, char *filename, int *line ) {
00558         return syscall( CG_PC_SOURCE_FILE_AND_LINE, handle, filename, line );
00559 }
00560 
00561 int trap_PC_LoadGlobalDefines ( const char* filename )
00562 {
00563         return syscall ( CG_PC_LOAD_GLOBAL_DEFINES, filename );
00564 }
00565 
00566 void trap_PC_RemoveAllGlobalDefines ( void )
00567 {
00568         syscall ( CG_PC_REMOVE_ALL_GLOBAL_DEFINES );
00569 }
00570 
00571 void    trap_S_StopBackgroundTrack( void ) {
00572         syscall( CG_S_STOPBACKGROUNDTRACK );
00573 }
00574 
00575 int trap_RealTime(qtime_t *qtime) {
00576         return syscall( CG_REAL_TIME, qtime );
00577 }
00578 
00579 void trap_SnapVector( float *v ) {
00580         syscall( CG_SNAPVECTOR, v );
00581 }
00582 
00583 // this returns a handle.  arg0 is the name in the format "idlogo.roq", set arg1 to NULL, alteredstates to qfalse (do not alter gamestate)
00584 int trap_CIN_PlayCinematic( const char *arg0, int xpos, int ypos, int width, int height, int bits) {
00585   return syscall(CG_CIN_PLAYCINEMATIC, arg0, xpos, ypos, width, height, bits);
00586 }
00587  
00588 // stops playing the cinematic and ends it.  should always return FMV_EOF
00589 // cinematics must be stopped in reverse order of when they are started
00590 e_status trap_CIN_StopCinematic(int handle) {
00591   return syscall(CG_CIN_STOPCINEMATIC, handle);
00592 }
00593 
00594 
00595 // 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.
00596 e_status trap_CIN_RunCinematic (int handle) {
00597   return syscall(CG_CIN_RUNCINEMATIC, handle);
00598 }
00599  
00600 
00601 // draws the current frame
00602 void trap_CIN_DrawCinematic (int handle) {
00603   syscall(CG_CIN_DRAWCINEMATIC, handle);
00604 }
00605  
00606 
00607 // allows you to resize the animation dynamically
00608 void trap_CIN_SetExtents (int handle, int x, int y, int w, int h) {
00609   syscall(CG_CIN_SETEXTENTS, handle, x, y, w, h);
00610 }
00611 
00612 qboolean trap_GetEntityToken( char *buffer, int bufferSize ) {
00613         return syscall( CG_GET_ENTITY_TOKEN, buffer, bufferSize );
00614 }
00615 
00616 qboolean trap_R_inPVS( const vec3_t p1, const vec3_t p2, byte *mask ) {
00617         return syscall( CG_R_INPVS, p1, p2, mask );
00618 }
00619 
00620 
00621 int     trap_FX_RegisterEffect(const char *file)
00622 {
00623         return syscall( CG_FX_REGISTER_EFFECT, file);
00624 }
00625 
00626 void trap_FX_PlayEffect( const char *file, vec3_t org, vec3_t fwd, int vol, int rad )
00627 {
00628         syscall( CG_FX_PLAY_EFFECT, file, org, fwd, vol, rad);
00629 }
00630 
00631 void trap_FX_PlayEntityEffect( const char *file, vec3_t org, 
00632                                                 vec3_t axis[3], const int boltInfo, const int entNum, int vol, int rad )
00633 {
00634         syscall( CG_FX_PLAY_ENTITY_EFFECT, file, org, axis, boltInfo, entNum, vol, rad );
00635 }
00636 
00637 void trap_FX_PlayEffectID( int id, vec3_t org, vec3_t fwd, int vol, int rad )
00638 {
00639         syscall( CG_FX_PLAY_EFFECT_ID, id, org, fwd, vol, rad );
00640 }
00641 
00642 void trap_FX_PlayPortalEffectID( int id, vec3_t org, vec3_t fwd, int vol, int rad )
00643 {
00644         syscall( CG_FX_PLAY_PORTAL_EFFECT_ID, id, org, fwd);
00645 }
00646 
00647 void trap_FX_PlayEntityEffectID( int id, vec3_t org, 
00648                                                 vec3_t axis[3], const int boltInfo, const int entNum, int vol, int rad )
00649 {
00650         syscall( CG_FX_PLAY_ENTITY_EFFECT_ID, id, org, axis, boltInfo, entNum, vol, rad );
00651 }
00652 
00653 void trap_FX_PlayBoltedEffectID( int id, vec3_t org, 
00654                                                 void *ghoul2, const int boltNum, const int entNum, const int modelNum, int iLooptime, qboolean isRelative )
00655 {
00656         syscall( CG_FX_PLAY_BOLTED_EFFECT_ID, id, org, ghoul2, boltNum, entNum, modelNum, iLooptime, isRelative );
00657 }
00658 
00659 void trap_FX_AddScheduledEffects( qboolean skyPortal )
00660 {
00661         syscall( CG_FX_ADD_SCHEDULED_EFFECTS, skyPortal );
00662 }
00663 
00664 void trap_FX_Draw2DEffects ( float screenXScale, float screenYScale )
00665 {
00666         syscall( CG_FX_DRAW_2D_EFFECTS, PASSFLOAT(screenXScale), PASSFLOAT(screenYScale) );
00667 }       
00668 
00669 int     trap_FX_InitSystem( refdef_t* refdef )
00670 {
00671         return syscall( CG_FX_INIT_SYSTEM, refdef );
00672 }
00673 
00674 void trap_FX_SetRefDef( refdef_t* refdef )
00675 {
00676         syscall( CG_FX_SET_REFDEF, refdef );
00677 }
00678 
00679 qboolean trap_FX_FreeSystem( void )
00680 {
00681         return syscall( CG_FX_FREE_SYSTEM );
00682 }
00683 
00684 void trap_FX_Reset ( void )
00685 {
00686         syscall ( CG_FX_RESET );
00687 }
00688 
00689 void trap_FX_AdjustTime( int time )
00690 {
00691         syscall( CG_FX_ADJUST_TIME, time );
00692 }
00693 
00694 
00695 void trap_FX_AddPoly( addpolyArgStruct_t *p )
00696 {
00697         syscall( CG_FX_ADDPOLY, p );
00698 }
00699 
00700 void trap_FX_AddBezier( addbezierArgStruct_t *p )
00701 {
00702         syscall( CG_FX_ADDBEZIER, p );
00703 }
00704 
00705 void trap_FX_AddPrimitive( effectTrailArgStruct_t *p )
00706 {
00707         syscall( CG_FX_ADDPRIMITIVE, p );
00708 }
00709 
00710 void trap_FX_AddSprite( addspriteArgStruct_t *p )
00711 {
00712         syscall( CG_FX_ADDSPRITE, p );
00713 }
00714 
00715 void trap_FX_AddElectricity( addElectricityArgStruct_t *p )
00716 {
00717         syscall( CG_FX_ADDELECTRICITY, p );
00718 }
00719 
00720 //void trap_SP_Print(const unsigned ID, byte *Data)
00721 //{
00722 //      syscall( CG_SP_PRINT, ID, Data);
00723 //}
00724 
00725 int trap_SP_GetStringTextString(const char *text, char *buffer, int bufferLength)
00726 {
00727         return syscall( CG_SP_GETSTRINGTEXTSTRING, text, buffer, bufferLength );
00728 }
00729 
00730 qboolean trap_ROFF_Clean( void ) 
00731 {
00732         return syscall( CG_ROFF_CLEAN );
00733 }
00734 
00735 void trap_ROFF_UpdateEntities( void ) 
00736 {
00737         syscall( CG_ROFF_UPDATE_ENTITIES );
00738 }
00739 
00740 int trap_ROFF_Cache( char *file ) 
00741 {
00742         return syscall( CG_ROFF_CACHE, file );
00743 }
00744 
00745 qboolean trap_ROFF_Play( int entID, int roffID, qboolean doTranslation ) 
00746 {
00747         return syscall( CG_ROFF_PLAY, entID, roffID, doTranslation );
00748 }
00749 
00750 qboolean trap_ROFF_Purge_Ent( int entID ) 
00751 {
00752         return syscall( CG_ROFF_PURGE_ENT, entID );
00753 }
00754 
00755 
00756 //rww - dynamic vm memory allocation!
00757 void trap_TrueMalloc(void **ptr, int size)
00758 {
00759         syscall(CG_TRUEMALLOC, ptr, size);
00760 }
00761 
00762 void trap_TrueFree(void **ptr)
00763 {
00764         syscall(CG_TRUEFREE, ptr);
00765 }
00766 
00767 /*
00768 Ghoul2 Insert Start
00769 */
00770 // CG Specific API calls
00771 void trap_G2_ListModelSurfaces(void *ghlInfo)
00772 {
00773         syscall( CG_G2_LISTSURFACES, ghlInfo);
00774 }
00775 
00776 void trap_G2_ListModelBones(void *ghlInfo, int frame)
00777 {
00778         syscall( CG_G2_LISTBONES, ghlInfo, frame);
00779 }
00780 
00781 void trap_G2_SetGhoul2ModelIndexes(void *ghoul2, qhandle_t *modelList, qhandle_t *skinList)
00782 {
00783         syscall( CG_G2_SETMODELS, ghoul2, modelList, skinList);
00784 }
00785 
00786 qboolean trap_G2_HaveWeGhoul2Models(void *ghoul2)
00787 {
00788         return (qboolean)(syscall(CG_G2_HAVEWEGHOULMODELS, ghoul2));
00789 }
00790 
00791 qboolean trap_G2API_GetBoltMatrix(void *ghoul2, const int modelIndex, const int boltIndex, mdxaBone_t *matrix,
00792                                                                 const vec3_t angles, const vec3_t position, const int frameNum, qhandle_t *modelList, vec3_t scale)
00793 {
00794         return (qboolean)(syscall(CG_G2_GETBOLT, ghoul2, modelIndex, boltIndex, matrix, angles, position, frameNum, modelList, scale));
00795 }
00796 
00797 qboolean trap_G2API_GetBoltMatrix_NoReconstruct(void *ghoul2, const int modelIndex, const int boltIndex, mdxaBone_t *matrix,
00798                                                                 const vec3_t angles, const vec3_t position, const int frameNum, qhandle_t *modelList, vec3_t scale)
00799 { //Same as above but force it to not reconstruct the skeleton before getting the bolt position
00800         return (qboolean)(syscall(CG_G2_GETBOLT_NOREC, ghoul2, modelIndex, boltIndex, matrix, angles, position, frameNum, modelList, scale));
00801 }
00802 
00803 qboolean trap_G2API_GetBoltMatrix_NoRecNoRot(void *ghoul2, const int modelIndex, const int boltIndex, mdxaBone_t *matrix,
00804                                                                 const vec3_t angles, const vec3_t position, const int frameNum, qhandle_t *modelList, vec3_t scale)
00805 { //Same as above but force it to not reconstruct the skeleton before getting the bolt position
00806         return (qboolean)(syscall(CG_G2_GETBOLT_NOREC_NOROT, ghoul2, modelIndex, boltIndex, matrix, angles, position, frameNum, modelList, scale));
00807 }
00808 
00809 int trap_G2API_InitGhoul2Model(void **ghoul2Ptr, const char *fileName, int modelIndex, qhandle_t customSkin,
00810                                                   qhandle_t customShader, int modelFlags, int lodBias)
00811 {
00812         return syscall(CG_G2_INITGHOUL2MODEL, ghoul2Ptr, fileName, modelIndex, customSkin, customShader, modelFlags, lodBias);
00813 }
00814 
00815 qboolean trap_G2API_SetSkin(void *ghoul2, int modelIndex, qhandle_t customSkin, qhandle_t renderSkin)
00816 {
00817         return syscall(CG_G2_SETSKIN, ghoul2, modelIndex, customSkin, renderSkin);
00818 }
00819 
00820 void trap_G2API_CollisionDetect ( 
00821         CollisionRecord_t *collRecMap, 
00822         void* ghoul2, 
00823         const vec3_t angles, 
00824         const vec3_t position,
00825         int frameNumber, 
00826         int entNum, 
00827         const vec3_t rayStart, 
00828         const vec3_t rayEnd, 
00829         const vec3_t scale, 
00830         int traceFlags, 
00831         int useLod,
00832         float fRadius
00833         )
00834 {
00835         syscall ( CG_G2_COLLISIONDETECT, collRecMap, ghoul2, angles, position, frameNumber, entNum, rayStart, rayEnd, scale, traceFlags, useLod, PASSFLOAT(fRadius) );
00836 }
00837 
00838 void trap_G2API_CollisionDetectCache ( 
00839         CollisionRecord_t *collRecMap, 
00840         void* ghoul2, 
00841         const vec3_t angles, 
00842         const vec3_t position,
00843         int frameNumber, 
00844         int entNum, 
00845         const vec3_t rayStart, 
00846         const vec3_t rayEnd, 
00847         const vec3_t scale, 
00848         int traceFlags, 
00849         int useLod,
00850         float fRadius
00851         )
00852 {
00853         syscall ( CG_G2_COLLISIONDETECTCACHE, collRecMap, ghoul2, angles, position, frameNumber, entNum, rayStart, rayEnd, scale, traceFlags, useLod, PASSFLOAT(fRadius) );
00854 }
00855 
00856 void trap_G2API_CleanGhoul2Models(void **ghoul2Ptr)
00857 {
00858         syscall(CG_G2_CLEANMODELS, ghoul2Ptr);
00859 }
00860 
00861 qboolean trap_G2API_SetBoneAngles(void *ghoul2, int modelIndex, const char *boneName, const vec3_t angles, const int flags,
00862                                                                 const int up, const int right, const int forward, qhandle_t *modelList,
00863                                                                 int blendTime , int currentTime )
00864 {
00865         return (syscall(CG_G2_ANGLEOVERRIDE, ghoul2, modelIndex, boneName, angles, flags, up, right, forward, modelList, blendTime, currentTime));
00866 }
00867 
00868 qboolean trap_G2API_SetBoneAnim(void *ghoul2, const int modelIndex, const char *boneName, const int startFrame, const int endFrame,
00869                                                           const int flags, const float animSpeed, const int currentTime, const float setFrame , const int blendTime )
00870 {
00871         return syscall(CG_G2_PLAYANIM, ghoul2, modelIndex, boneName, startFrame, endFrame, flags, PASSFLOAT(animSpeed), currentTime, PASSFLOAT(setFrame), blendTime);
00872 }
00873 
00874 qboolean trap_G2API_GetBoneAnim(void *ghoul2, const char *boneName, const int currentTime, float *currentFrame,
00875                                                    int *startFrame, int *endFrame, int *flags, float *animSpeed, int *modelList, const int modelIndex)
00876 {
00877         return syscall(CG_G2_GETBONEANIM, ghoul2, boneName, currentTime, currentFrame, startFrame, endFrame, flags, animSpeed, modelList, modelIndex);
00878 }
00879 
00880 qboolean trap_G2API_GetBoneFrame(void *ghoul2, const char *boneName, const int currentTime, float *currentFrame, int *modelList, const int modelIndex)
00881 {
00882         return syscall(CG_G2_GETBONEFRAME, ghoul2, boneName, currentTime, currentFrame, modelList, modelIndex);
00883 }
00884 
00885 void trap_G2API_GetGLAName(void *ghoul2, int modelIndex, char *fillBuf)
00886 {
00887         syscall(CG_G2_GETGLANAME, ghoul2, modelIndex, fillBuf);
00888 }
00889 
00890 int trap_G2API_CopyGhoul2Instance(void *g2From, void *g2To, int modelIndex)
00891 {
00892         return syscall(CG_G2_COPYGHOUL2INSTANCE, g2From, g2To, modelIndex);
00893 }
00894 
00895 void trap_G2API_CopySpecificGhoul2Model(void *g2From, int modelFrom, void *g2To, int modelTo)
00896 {
00897         syscall(CG_G2_COPYSPECIFICGHOUL2MODEL, g2From, modelFrom, g2To, modelTo);
00898 }
00899 
00900 void trap_G2API_DuplicateGhoul2Instance(void *g2From, void **g2To)
00901 {
00902         syscall(CG_G2_DUPLICATEGHOUL2INSTANCE, g2From, g2To);
00903 }
00904 
00905 qboolean trap_G2API_HasGhoul2ModelOnIndex(void *ghlInfo, int modelIndex)
00906 {
00907         return syscall(CG_G2_HASGHOUL2MODELONINDEX, ghlInfo, modelIndex);
00908 }
00909 
00910 qboolean trap_G2API_RemoveGhoul2Model(void *ghlInfo, int modelIndex)
00911 {
00912         return syscall(CG_G2_REMOVEGHOUL2MODEL, ghlInfo, modelIndex);
00913 }
00914 
00915 qboolean trap_G2API_SkinlessModel(void *ghlInfo, int modelIndex)
00916 {
00917         return syscall(CG_G2_SKINLESSMODEL, ghlInfo, modelIndex);
00918 }
00919 
00920 int trap_G2API_GetNumGoreMarks(void *ghlInfo, int modelIndex)
00921 {
00922         return syscall(CG_G2_GETNUMGOREMARKS, ghlInfo, modelIndex);
00923 }
00924 
00925 void trap_G2API_AddSkinGore(void *ghlInfo,SSkinGoreData *gore)
00926 {
00927         syscall(CG_G2_ADDSKINGORE, ghlInfo, gore);
00928 }
00929 
00930 void trap_G2API_ClearSkinGore ( void* ghlInfo )
00931 {
00932         syscall(CG_G2_CLEARSKINGORE, ghlInfo );
00933 }
00934 
00935 int trap_G2API_Ghoul2Size ( void* ghlInfo )
00936 {
00937         return syscall(CG_G2_SIZE, ghlInfo );
00938 }
00939 
00940 int     trap_G2API_AddBolt(void *ghoul2, int modelIndex, const char *boneName)
00941 {
00942         return syscall(CG_G2_ADDBOLT, ghoul2, modelIndex, boneName);
00943 }
00944 
00945 qboolean trap_G2API_AttachEnt(int *boltInfo, void *ghlInfoTo, int toBoltIndex, int entNum, int toModelNum)
00946 {
00947         return syscall(CG_G2_ATTACHENT, boltInfo, ghlInfoTo, toBoltIndex, entNum, toModelNum);
00948 }
00949 
00950 void trap_G2API_SetBoltInfo(void *ghoul2, int modelIndex, int boltInfo)
00951 {
00952         syscall(CG_G2_SETBOLTON, ghoul2, modelIndex, boltInfo);
00953 }
00954 
00955 qboolean trap_G2API_SetRootSurface(void *ghoul2, const int modelIndex, const char *surfaceName)
00956 {
00957         return syscall(CG_G2_SETROOTSURFACE, ghoul2, modelIndex, surfaceName);
00958 }
00959 
00960 qboolean trap_G2API_SetSurfaceOnOff(void *ghoul2, const char *surfaceName, const int flags)
00961 {
00962         return syscall(CG_G2_SETSURFACEONOFF, ghoul2, surfaceName, flags);
00963 }
00964 
00965 qboolean trap_G2API_SetNewOrigin(void *ghoul2, const int boltIndex)
00966 {
00967         return syscall(CG_G2_SETNEWORIGIN, ghoul2, boltIndex);
00968 }
00969 
00970 //check if a bone exists on skeleton without actually adding to the bone list -rww
00971 qboolean trap_G2API_DoesBoneExist(void *ghoul2, int modelIndex, const char *boneName)
00972 {
00973         return syscall(CG_G2_DOESBONEEXIST, ghoul2, modelIndex, boneName);
00974 }
00975 
00976 int trap_G2API_GetSurfaceRenderStatus(void *ghoul2, const int modelIndex, const char *surfaceName)
00977 {
00978         return syscall(CG_G2_GETSURFACERENDERSTATUS, ghoul2, modelIndex, surfaceName);
00979 }
00980 
00981 int trap_G2API_GetTime(void)
00982 {
00983         return syscall(CG_G2_GETTIME);
00984 }
00985 
00986 void trap_G2API_SetTime(int time, int clock)
00987 {
00988         syscall(CG_G2_SETTIME, time, clock);
00989 }
00990 
00991 //hack for smoothing during ugly situations. forgive me.
00992 void trap_G2API_AbsurdSmoothing(void *ghoul2, qboolean status)
00993 {
00994         syscall(CG_G2_ABSURDSMOOTHING, ghoul2, status);
00995 }
00996 
00997 //rww - RAGDOLL_BEGIN
00998 void trap_G2API_SetRagDoll(void *ghoul2, sharedRagDollParams_t *params)
00999 {
01000         syscall(CG_G2_SETRAGDOLL, ghoul2, params);
01001 }
01002 
01003 void trap_G2API_AnimateG2Models(void *ghoul2, int time, sharedRagDollUpdateParams_t *params)
01004 {
01005         syscall(CG_G2_ANIMATEG2MODELS, ghoul2, time, params);
01006 }
01007 //rww - RAGDOLL_END
01008 
01009 //additional ragdoll options -rww
01010 qboolean trap_G2API_RagPCJConstraint(void *ghoul2, const char *boneName, vec3_t min, vec3_t max) //override default pcj bonee constraints
01011 {
01012         return syscall(CG_G2_RAGPCJCONSTRAINT, ghoul2, boneName, min, max);
01013 }
01014 
01015 qboolean trap_G2API_RagPCJGradientSpeed(void *ghoul2, const char *boneName, const float speed) //override the default gradient movespeed for a pcj bone
01016 {
01017         return syscall(CG_G2_RAGPCJGRADIENTSPEED, ghoul2, boneName, PASSFLOAT(speed));
01018 }
01019 
01020 qboolean trap_G2API_RagEffectorGoal(void *ghoul2, const char *boneName, vec3_t pos) //override an effector bone's goal position (world coordinates)
01021 {
01022         return syscall(CG_G2_RAGEFFECTORGOAL, ghoul2, boneName, pos);
01023 }
01024 
01025 qboolean trap_G2API_GetRagBonePos(void *ghoul2, const char *boneName, vec3_t pos, vec3_t entAngles, vec3_t entPos, vec3_t entScale) //current position of said bone is put into pos (world coordinates)
01026 {
01027         return syscall(CG_G2_GETRAGBONEPOS, ghoul2, boneName, pos, entAngles, entPos, entScale);
01028 }
01029 
01030 qboolean trap_G2API_RagEffectorKick(void *ghoul2, const char *boneName, vec3_t velocity) //add velocity to a rag bone
01031 {
01032         return syscall(CG_G2_RAGEFFECTORKICK, ghoul2, boneName, velocity);
01033 }
01034 
01035 qboolean trap_G2API_RagForceSolve(void *ghoul2, qboolean force) //make sure we are actively performing solve/settle routines, if desired
01036 {
01037         return syscall(CG_G2_RAGFORCESOLVE, ghoul2, force);
01038 }
01039 
01040 qboolean trap_G2API_SetBoneIKState(void *ghoul2, int time, const char *boneName, int ikState, sharedSetBoneIKStateParams_t *params)
01041 {
01042         return syscall(CG_G2_SETBONEIKSTATE, ghoul2, time, boneName, ikState, params);
01043 }
01044 
01045 qboolean trap_G2API_IKMove(void *ghoul2, int time, sharedIKMoveParams_t *params)
01046 {
01047         return syscall(CG_G2_IKMOVE, ghoul2, time, params);
01048 }
01049 
01050 qboolean trap_G2API_RemoveBone(void *ghoul2, const char *boneName, int modelIndex)
01051 {
01052         return syscall(CG_G2_REMOVEBONE, ghoul2, boneName, modelIndex);
01053 }
01054 
01055 //rww - Stuff to allow association of ghoul2 instances to entity numbers.
01056 //This way, on listen servers when both the client and server are doing
01057 //ghoul2 operations, we can copy relevant data off the client instance
01058 //directly onto the server instance and slash the transforms and whatnot
01059 //right in half.
01060 void trap_G2API_AttachInstanceToEntNum(void *ghoul2, int entityNum, qboolean server)
01061 {
01062         syscall(CG_G2_ATTACHINSTANCETOENTNUM, ghoul2, entityNum, server);
01063 }
01064 
01065 void trap_G2API_ClearAttachedInstance(int entityNum)
01066 {
01067         syscall(CG_G2_CLEARATTACHEDINSTANCE, entityNum);
01068 }
01069 
01070 void trap_G2API_CleanEntAttachments(void)
01071 {
01072         syscall(CG_G2_CLEANENTATTACHMENTS);
01073 }
01074 
01075 qboolean trap_G2API_OverrideServer(void *serverInstance)
01076 {
01077         return syscall(CG_G2_OVERRIDESERVER, serverInstance);
01078 }
01079 
01080 void trap_G2API_GetSurfaceName(void *ghoul2, int surfNumber, int modelIndex, char *fillBuf)
01081 {
01082         syscall(CG_G2_GETSURFACENAME, ghoul2, surfNumber, modelIndex, fillBuf);
01083 }
01084 
01085 void trap_CG_RegisterSharedMemory(char *memory)
01086 {
01087         syscall(CG_SET_SHARED_BUFFER, memory);
01088 }
01089 
01090 int     trap_CM_RegisterTerrain(const char *config)
01091 { //rwwRMG - added [NEWTRAP]
01092         return syscall(CG_CM_REGISTER_TERRAIN, config);
01093 }
01094 
01095 void trap_RMG_Init(int terrainID, const char *terrainInfo)
01096 { //rwwRMG - added [NEWTRAP]
01097         syscall(CG_RMG_INIT, terrainID, terrainInfo);
01098 }
01099 
01100 void trap_RE_InitRendererTerrain( const char *info )
01101 { //rwwRMG - added [NEWTRAP]
01102         syscall(CG_RE_INIT_RENDERER_TERRAIN, info);
01103 }
01104 
01105 void trap_R_WeatherContentsOverride( int contents )
01106 { //rwwRMG - added [NEWTRAP]
01107         syscall(CG_R_WEATHER_CONTENTS_OVERRIDE, contents);
01108 }
01109 
01110 void trap_R_WorldEffectCommand(const char *cmd)
01111 {
01112         syscall(CG_R_WORLDEFFECTCOMMAND, cmd);
01113 }
01114 
01115 void trap_WE_AddWeatherZone( const vec3_t mins, const vec3_t maxs )
01116 {
01117         syscall( CG_WE_ADDWEATHERZONE, mins, maxs );
01118 }
01119 
01120 /*
01121 Ghoul2 Insert End
01122 */
01123 
01124 #include "../namespace_end.h"