1 /*
2 ===========================================================================
3
4 Return to Castle Wolfenstein single player GPL Source Code
5 Copyright (C) 1999-2010 id Software LLC, a ZeniMax Media company.
6
7 This file is part of the Return to Castle Wolfenstein single player GPL Source Code (RTCW SP Source Code).
8
9 RTCW SP Source Code is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13
14 RTCW SP Source Code is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with RTCW SP Source Code. If not, see <http://www.gnu.org/licenses/>.
21
22 In addition, the RTCW SP Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the RTCW SP Source Code. If not, please request a copy in writing from id Software at the address below.
23
24 If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
25
26 ===========================================================================
27 */
28
29 // cg_syscalls.c -- this file is only included when building a dll
30 // cg_syscalls.asm is included instead when building a qvm
31 #ifdef Q3_VM
32 #error "Do not use in VM build"
33 #endif
34
35 #include "cg_local.h"
36
37 static intptr_t (QDECL *syscall)( intptr_t arg, ... ) = (intptr_t (QDECL *)( intptr_t, ...))-1;
38
dllEntry(intptr_t (QDECL * syscallptr)(intptr_t arg,...))39 Q_EXPORT void dllEntry( intptr_t (QDECL *syscallptr)( intptr_t arg,... ) ) {
40 syscall = syscallptr;
41 }
42
PASSFLOAT(float x)43 int PASSFLOAT( float x ) {
44 floatint_t fi;
45 fi.f = x;
46 return fi.i;
47 }
48
trap_Print(const char * fmt)49 void trap_Print( const char *fmt ) {
50 syscall( CG_PRINT, fmt );
51 }
52
trap_Error(const char * fmt)53 void trap_Error(const char *fmt)
54 {
55 syscall(CG_ERROR, fmt);
56 // shut up GCC warning about returning functions, because we know better
57 exit(1);
58 }
59
trap_Milliseconds(void)60 int trap_Milliseconds( void ) {
61 return syscall( CG_MILLISECONDS );
62 }
63
trap_Cvar_Register(vmCvar_t * vmCvar,const char * varName,const char * defaultValue,int flags)64 void trap_Cvar_Register( vmCvar_t *vmCvar, const char *varName, const char *defaultValue, int flags ) {
65 syscall( CG_CVAR_REGISTER, vmCvar, varName, defaultValue, flags );
66 }
67
trap_Cvar_Update(vmCvar_t * vmCvar)68 void trap_Cvar_Update( vmCvar_t *vmCvar ) {
69 syscall( CG_CVAR_UPDATE, vmCvar );
70 }
71
trap_Cvar_Set(const char * var_name,const char * value)72 void trap_Cvar_Set( const char *var_name, const char *value ) {
73 syscall( CG_CVAR_SET, var_name, value );
74 }
75
trap_Cvar_VariableStringBuffer(const char * var_name,char * buffer,int bufsize)76 void trap_Cvar_VariableStringBuffer( const char *var_name, char *buffer, int bufsize ) {
77 syscall( CG_CVAR_VARIABLESTRINGBUFFER, var_name, buffer, bufsize );
78 }
79
trap_Argc(void)80 int trap_Argc( void ) {
81 return syscall( CG_ARGC );
82 }
83
trap_Argv(int n,char * buffer,int bufferLength)84 void trap_Argv( int n, char *buffer, int bufferLength ) {
85 syscall( CG_ARGV, n, buffer, bufferLength );
86 }
87
trap_Args(char * buffer,int bufferLength)88 void trap_Args( char *buffer, int bufferLength ) {
89 syscall( CG_ARGS, buffer, bufferLength );
90 }
91
trap_FS_FOpenFile(const char * qpath,fileHandle_t * f,fsMode_t mode)92 int trap_FS_FOpenFile( const char *qpath, fileHandle_t *f, fsMode_t mode ) {
93 return syscall( CG_FS_FOPENFILE, qpath, f, mode );
94 }
95
trap_FS_Read(void * buffer,int len,fileHandle_t f)96 void trap_FS_Read( void *buffer, int len, fileHandle_t f ) {
97 syscall( CG_FS_READ, buffer, len, f );
98 }
99
trap_FS_Write(const void * buffer,int len,fileHandle_t f)100 void trap_FS_Write( const void *buffer, int len, fileHandle_t f ) {
101 syscall( CG_FS_WRITE, buffer, len, f );
102 }
103
trap_FS_FCloseFile(fileHandle_t f)104 void trap_FS_FCloseFile( fileHandle_t f ) {
105 syscall( CG_FS_FCLOSEFILE, f );
106 }
107
trap_SendConsoleCommand(const char * text)108 void trap_SendConsoleCommand( const char *text ) {
109 syscall( CG_SENDCONSOLECOMMAND, text );
110 }
111
trap_AddCommand(const char * cmdName)112 void trap_AddCommand( const char *cmdName ) {
113 syscall( CG_ADDCOMMAND, cmdName );
114 }
115
trap_SendClientCommand(const char * s)116 void trap_SendClientCommand( const char *s ) {
117 syscall( CG_SENDCLIENTCOMMAND, s );
118 }
119
trap_UpdateScreen(void)120 void trap_UpdateScreen( void ) {
121 syscall( CG_UPDATESCREEN );
122 }
123
trap_CM_LoadMap(const char * mapname)124 void trap_CM_LoadMap( const char *mapname ) {
125 syscall( CG_CM_LOADMAP, mapname );
126 }
127
trap_CM_NumInlineModels(void)128 int trap_CM_NumInlineModels( void ) {
129 return syscall( CG_CM_NUMINLINEMODELS );
130 }
131
trap_CM_InlineModel(int index)132 clipHandle_t trap_CM_InlineModel( int index ) {
133 return syscall( CG_CM_INLINEMODEL, index );
134 }
135
trap_CM_TempBoxModel(const vec3_t mins,const vec3_t maxs)136 clipHandle_t trap_CM_TempBoxModel( const vec3_t mins, const vec3_t maxs ) {
137 return syscall( CG_CM_TEMPBOXMODEL, mins, maxs );
138 }
139
trap_CM_TempCapsuleModel(const vec3_t mins,const vec3_t maxs)140 clipHandle_t trap_CM_TempCapsuleModel( const vec3_t mins, const vec3_t maxs ) {
141 return syscall( CG_CM_TEMPCAPSULEMODEL, mins, maxs );
142 }
143
trap_CM_PointContents(const vec3_t p,clipHandle_t model)144 int trap_CM_PointContents( const vec3_t p, clipHandle_t model ) {
145 return syscall( CG_CM_POINTCONTENTS, p, model );
146 }
147
trap_CM_TransformedPointContents(const vec3_t p,clipHandle_t model,const vec3_t origin,const vec3_t angles)148 int trap_CM_TransformedPointContents( const vec3_t p, clipHandle_t model, const vec3_t origin, const vec3_t angles ) {
149 return syscall( CG_CM_TRANSFORMEDPOINTCONTENTS, p, model, origin, angles );
150 }
151
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)152 void trap_CM_BoxTrace( trace_t *results, const vec3_t start, const vec3_t end,
153 const vec3_t mins, const vec3_t maxs,
154 clipHandle_t model, int brushmask ) {
155 syscall( CG_CM_BOXTRACE, results, start, end, mins, maxs, model, brushmask );
156 }
157
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)158 void trap_CM_TransformedBoxTrace( trace_t *results, const vec3_t start, const vec3_t end,
159 const vec3_t mins, const vec3_t maxs,
160 clipHandle_t model, int brushmask,
161 const vec3_t origin, const vec3_t angles ) {
162 syscall( CG_CM_TRANSFORMEDBOXTRACE, results, start, end, mins, maxs, model, brushmask, origin, angles );
163 }
164
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)165 void trap_CM_CapsuleTrace( trace_t *results, const vec3_t start, const vec3_t end,
166 const vec3_t mins, const vec3_t maxs,
167 clipHandle_t model, int brushmask ) {
168 syscall( CG_CM_CAPSULETRACE, results, start, end, mins, maxs, model, brushmask );
169 }
170
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)171 void trap_CM_TransformedCapsuleTrace( trace_t *results, const vec3_t start, const vec3_t end,
172 const vec3_t mins, const vec3_t maxs,
173 clipHandle_t model, int brushmask,
174 const vec3_t origin, const vec3_t angles ) {
175 syscall( CG_CM_TRANSFORMEDCAPSULETRACE, results, start, end, mins, maxs, model, brushmask, origin, angles );
176 }
177
trap_CM_MarkFragments(int numPoints,const vec3_t * points,const vec3_t projection,int maxPoints,vec3_t pointBuffer,int maxFragments,markFragment_t * fragmentBuffer)178 int trap_CM_MarkFragments( int numPoints, const vec3_t *points,
179 const vec3_t projection,
180 int maxPoints, vec3_t pointBuffer,
181 int maxFragments, markFragment_t *fragmentBuffer ) {
182 return syscall( CG_CM_MARKFRAGMENTS, numPoints, points, projection, maxPoints, pointBuffer, maxFragments, fragmentBuffer );
183 }
184
trap_S_StartSound(vec3_t origin,int entityNum,int entchannel,sfxHandle_t sfx)185 void trap_S_StartSound( vec3_t origin, int entityNum, int entchannel, sfxHandle_t sfx ) {
186 syscall( CG_S_STARTSOUND, origin, entityNum, entchannel, sfx );
187 }
188
189 //----(SA) added
trap_S_StartSoundEx(vec3_t origin,int entityNum,int entchannel,sfxHandle_t sfx,int flags)190 void trap_S_StartSoundEx( vec3_t origin, int entityNum, int entchannel, sfxHandle_t sfx, int flags ) {
191 syscall( CG_S_STARTSOUNDEX, origin, entityNum, entchannel, sfx, flags );
192 }
193 //----(SA) end
194
trap_S_StartLocalSound(sfxHandle_t sfx,int channelNum)195 void trap_S_StartLocalSound( sfxHandle_t sfx, int channelNum ) {
196 syscall( CG_S_STARTLOCALSOUND, sfx, channelNum );
197 }
198
trap_S_ClearLoopingSounds(qboolean killall)199 void trap_S_ClearLoopingSounds( qboolean killall ) {
200 syscall( CG_S_CLEARLOOPINGSOUNDS, killall );
201 }
202
trap_S_AddLoopingSound(int entityNum,const vec3_t origin,const vec3_t velocity,int range,sfxHandle_t sfx,int volume)203 void trap_S_AddLoopingSound( int entityNum, const vec3_t origin, const vec3_t velocity, int range, sfxHandle_t sfx, int volume ) {
204 syscall( CG_S_ADDLOOPINGSOUND, entityNum, origin, velocity, range, sfx, volume ); // volume was previously removed from CG_S_ADDLOOPINGSOUND. I added 'range'
205 }
206
207 // not in use
208 //void trap_S_AddRealLoopingSound( int entityNum, const vec3_t origin, const vec3_t velocity, int range, sfxHandle_t sfx, int volume ) {
209 // syscall( CG_S_ADDREALLOOPINGSOUND, entityNum, origin, velocity, range, sfx, volume ); //----(SA) modified
210 //}
211
trap_S_StopLoopingSound(int entityNum)212 void trap_S_StopLoopingSound( int entityNum ) {
213 syscall( CG_S_STOPLOOPINGSOUND, entityNum );
214 }
215
216 //----(SA) added
trap_S_StopStreamingSound(int entityNum)217 void trap_S_StopStreamingSound( int entityNum ) {
218 syscall( CG_S_STOPSTREAMINGSOUND, entityNum );
219 }
220 //----(SA) end
221
trap_S_UpdateEntityPosition(int entityNum,const vec3_t origin)222 void trap_S_UpdateEntityPosition( int entityNum, const vec3_t origin ) {
223 syscall( CG_S_UPDATEENTITYPOSITION, entityNum, origin );
224 }
225
226 // Ridah, talking animations
trap_S_GetVoiceAmplitude(int entityNum)227 int trap_S_GetVoiceAmplitude( int entityNum ) {
228 return syscall( CG_S_GETVOICEAMPLITUDE, entityNum );
229 }
230 // done.
231
trap_S_Respatialize(int entityNum,const vec3_t origin,vec3_t axis[3],int inwater)232 void trap_S_Respatialize( int entityNum, const vec3_t origin, vec3_t axis[3], int inwater ) {
233 syscall( CG_S_RESPATIALIZE, entityNum, origin, axis, inwater );
234 }
235
trap_S_RegisterSound(const char * sample)236 sfxHandle_t trap_S_RegisterSound( const char *sample ) {
237 CG_DrawInformation();
238 return syscall( CG_S_REGISTERSOUND, sample );
239 }
240
trap_S_StartBackgroundTrack(const char * intro,const char * loop,int fadeupTime)241 void trap_S_StartBackgroundTrack( const char *intro, const char *loop, int fadeupTime ) {
242 syscall( CG_S_STARTBACKGROUNDTRACK, intro, loop, fadeupTime );
243 }
244
245 //----(SA) added
trap_S_FadeBackgroundTrack(float targetvol,int time,int num)246 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...
247 syscall( CG_S_FADESTREAMINGSOUND, PASSFLOAT( targetvol ), time, num ); // 'num' is '0' if it's music, '1' if it's "all streaming sounds"
248 }
249
trap_S_FadeAllSound(float targetvol,int time)250 void trap_S_FadeAllSound( float targetvol, int time ) {
251 syscall( CG_S_FADEALLSOUNDS, PASSFLOAT( targetvol ), time );
252 }
253 //----(SA) end
254
trap_S_StartStreamingSound(const char * intro,const char * loop,int entnum,int channel,int attenuation)255 void trap_S_StartStreamingSound( const char *intro, const char *loop, int entnum, int channel, int attenuation ) {
256 syscall( CG_S_STARTSTREAMINGSOUND, intro, loop, entnum, channel, attenuation );
257 }
258
trap_R_LoadWorldMap(const char * mapname)259 void trap_R_LoadWorldMap( const char *mapname ) {
260 syscall( CG_R_LOADWORLDMAP, mapname );
261 }
262
trap_R_RegisterModel(const char * name)263 qhandle_t trap_R_RegisterModel( const char *name ) {
264 CG_DrawInformation();
265 return syscall( CG_R_REGISTERMODEL, name );
266 }
267
268 //----(SA) added
trap_R_GetSkinModel(qhandle_t skinid,const char * type,char * name)269 qboolean trap_R_GetSkinModel( qhandle_t skinid, const char *type, char *name ) {
270 return syscall( CG_R_GETSKINMODEL, skinid, type, name );
271 }
272
trap_R_GetShaderFromModel(qhandle_t modelid,int surfnum,int withlightmap)273 qhandle_t trap_R_GetShaderFromModel( qhandle_t modelid, int surfnum, int withlightmap ) {
274 return syscall( CG_R_GETMODELSHADER, modelid, surfnum, withlightmap );
275 }
276 //----(SA) end
277
trap_R_RegisterSkin(const char * name)278 qhandle_t trap_R_RegisterSkin( const char *name ) {
279 CG_DrawInformation();
280 return syscall( CG_R_REGISTERSKIN, name );
281 }
282
trap_R_RegisterShader(const char * name)283 qhandle_t trap_R_RegisterShader( const char *name ) {
284 CG_DrawInformation();
285 return syscall( CG_R_REGISTERSHADER, name );
286 }
287
trap_R_RegisterShaderNoMip(const char * name)288 qhandle_t trap_R_RegisterShaderNoMip( const char *name ) {
289 CG_DrawInformation();
290 return syscall( CG_R_REGISTERSHADERNOMIP, name );
291 }
292
trap_R_RegisterFont(const char * fontName,int pointSize,fontInfo_t * font)293 void trap_R_RegisterFont( const char *fontName, int pointSize, fontInfo_t *font ) {
294 syscall( CG_R_REGISTERFONT, fontName, pointSize, font );
295 }
296
trap_R_ClearScene(void)297 void trap_R_ClearScene( void ) {
298 syscall( CG_R_CLEARSCENE );
299 }
300
trap_R_AddRefEntityToScene(const refEntity_t * re)301 void trap_R_AddRefEntityToScene( const refEntity_t *re ) {
302 syscall( CG_R_ADDREFENTITYTOSCENE, re );
303 }
304
trap_R_AddPolyToScene(qhandle_t hShader,int numVerts,const polyVert_t * verts)305 void trap_R_AddPolyToScene( qhandle_t hShader, int numVerts, const polyVert_t *verts ) {
306 syscall( CG_R_ADDPOLYTOSCENE, hShader, numVerts, verts );
307 }
308
309 // Ridah
trap_R_AddPolysToScene(qhandle_t hShader,int numVerts,const polyVert_t * verts,int numPolys)310 void trap_R_AddPolysToScene( qhandle_t hShader, int numVerts, const polyVert_t *verts, int numPolys ) {
311 syscall( CG_R_ADDPOLYSTOSCENE, hShader, numVerts, verts, numPolys );
312 }
313
trap_RB_ZombieFXAddNewHit(int entityNum,const vec3_t hitPos,const vec3_t hitDir)314 void trap_RB_ZombieFXAddNewHit( int entityNum, const vec3_t hitPos, const vec3_t hitDir ) {
315 syscall( CG_RB_ZOMBIEFXADDNEWHIT, entityNum, hitPos, hitDir );
316 }
317 // done.
318
trap_R_AddLightToScene(const vec3_t org,float intensity,float r,float g,float b,int overdraw)319 void trap_R_AddLightToScene( const vec3_t org, float intensity, float r, float g, float b, int overdraw ) {
320 syscall( CG_R_ADDLIGHTTOSCENE, org, PASSFLOAT( intensity ), PASSFLOAT( r ), PASSFLOAT( g ), PASSFLOAT( b ), overdraw );
321 }
322
323 //----(SA)
trap_R_AddCoronaToScene(const vec3_t org,float r,float g,float b,float scale,int id,int flags)324 void trap_R_AddCoronaToScene( const vec3_t org, float r, float g, float b, float scale, int id, int flags ) {
325 syscall( CG_R_ADDCORONATOSCENE, org, PASSFLOAT( r ), PASSFLOAT( g ), PASSFLOAT( b ), PASSFLOAT( scale ), id, flags );
326 }
327 //----(SA)
328
329 //----(SA)
trap_R_SetFog(int fogvar,int var1,int var2,float r,float g,float b,float density)330 void trap_R_SetFog( int fogvar, int var1, int var2, float r, float g, float b, float density ) {
331 syscall( CG_R_SETFOG, fogvar, var1, var2, PASSFLOAT( r ), PASSFLOAT( g ), PASSFLOAT( b ), PASSFLOAT( density ) );
332 }
333 //----(SA)
trap_R_RenderScene(const refdef_t * fd)334 void trap_R_RenderScene( const refdef_t *fd ) {
335 syscall( CG_R_RENDERSCENE, fd );
336 }
337
trap_R_SetColor(const float * rgba)338 void trap_R_SetColor( const float *rgba ) {
339 syscall( CG_R_SETCOLOR, rgba );
340 }
341
trap_R_DrawStretchPic(float x,float y,float w,float h,float s1,float t1,float s2,float t2,qhandle_t hShader)342 void trap_R_DrawStretchPic( float x, float y, float w, float h,
343 float s1, float t1, float s2, float t2, qhandle_t hShader ) {
344 syscall( CG_R_DRAWSTRETCHPIC, PASSFLOAT( x ), PASSFLOAT( y ), PASSFLOAT( w ), PASSFLOAT( h ), PASSFLOAT( s1 ), PASSFLOAT( t1 ), PASSFLOAT( s2 ), PASSFLOAT( t2 ), hShader );
345 }
346
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)347 void trap_R_DrawStretchPicGradient( float x, float y, float w, float h,
348 float s1, float t1, float s2, float t2, qhandle_t hShader,
349 const float *gradientColor, int gradientType ) {
350 syscall( CG_R_DRAWSTRETCHPIC_GRADIENT, PASSFLOAT( x ), PASSFLOAT( y ), PASSFLOAT( w ), PASSFLOAT( h ), PASSFLOAT( s1 ), PASSFLOAT( t1 ), PASSFLOAT( s2 ), PASSFLOAT( t2 ), hShader, gradientColor, gradientType );
351 }
352
trap_R_ModelBounds(clipHandle_t model,vec3_t mins,vec3_t maxs)353 void trap_R_ModelBounds( clipHandle_t model, vec3_t mins, vec3_t maxs ) {
354 syscall( CG_R_MODELBOUNDS, model, mins, maxs );
355 }
356
trap_R_LerpTag(orientation_t * tag,const refEntity_t * refent,const char * tagName,int startIndex)357 int trap_R_LerpTag( orientation_t *tag, const refEntity_t *refent, const char *tagName, int startIndex ) {
358 return syscall( CG_R_LERPTAG, tag, refent, tagName, startIndex );
359 }
360
trap_R_RemapShader(const char * oldShader,const char * newShader,const char * timeOffset)361 void trap_R_RemapShader( const char *oldShader, const char *newShader, const char *timeOffset ) {
362 syscall( CG_R_REMAP_SHADER, oldShader, newShader, timeOffset );
363 }
364
trap_GetGlconfig(glconfig_t * glconfig)365 void trap_GetGlconfig( glconfig_t *glconfig ) {
366 syscall( CG_GETGLCONFIG, glconfig );
367 }
368
trap_GetGameState(gameState_t * gamestate)369 void trap_GetGameState( gameState_t *gamestate ) {
370 syscall( CG_GETGAMESTATE, gamestate );
371 }
372
trap_GetCurrentSnapshotNumber(int * snapshotNumber,int * serverTime)373 void trap_GetCurrentSnapshotNumber( int *snapshotNumber, int *serverTime ) {
374 syscall( CG_GETCURRENTSNAPSHOTNUMBER, snapshotNumber, serverTime );
375 }
376
trap_GetSnapshot(int snapshotNumber,snapshot_t * snapshot)377 qboolean trap_GetSnapshot( int snapshotNumber, snapshot_t *snapshot ) {
378 return syscall( CG_GETSNAPSHOT, snapshotNumber, snapshot );
379 }
380
trap_GetServerCommand(int serverCommandNumber)381 qboolean trap_GetServerCommand( int serverCommandNumber ) {
382 return syscall( CG_GETSERVERCOMMAND, serverCommandNumber );
383 }
384
trap_GetCurrentCmdNumber(void)385 int trap_GetCurrentCmdNumber( void ) {
386 return syscall( CG_GETCURRENTCMDNUMBER );
387 }
388
trap_GetUserCmd(int cmdNumber,usercmd_t * ucmd)389 qboolean trap_GetUserCmd( int cmdNumber, usercmd_t *ucmd ) {
390 return syscall( CG_GETUSERCMD, cmdNumber, ucmd );
391 }
392
trap_SetUserCmdValue(int stateValue,int holdableValue,float sensitivityScale,int cld)393 void trap_SetUserCmdValue( int stateValue, int holdableValue, float sensitivityScale, int cld ) { //----(SA) // NERVE - SMF - added cld
394 syscall( CG_SETUSERCMDVALUE, stateValue, holdableValue, PASSFLOAT( sensitivityScale ), cld );
395 }
396
testPrintInt(char * string,int i)397 void testPrintInt( char *string, int i ) {
398 syscall( CG_TESTPRINTINT, string, i );
399 }
400
testPrintFloat(char * string,float f)401 void testPrintFloat( char *string, float f ) {
402 syscall( CG_TESTPRINTFLOAT, string, PASSFLOAT( f ) );
403 }
404
trap_MemoryRemaining(void)405 int trap_MemoryRemaining( void ) {
406 return syscall( CG_MEMORY_REMAINING );
407 }
408
trap_loadCamera(int camNum,const char * name)409 qboolean trap_loadCamera( int camNum, const char *name ) {
410 return syscall( CG_LOADCAMERA, camNum, name );
411 }
412
trap_startCamera(int camNum,int time)413 void trap_startCamera( int camNum, int time ) {
414 syscall( CG_STARTCAMERA, camNum, time );
415 }
416
417 //----(SA) added
trap_stopCamera(int camNum)418 void trap_stopCamera( int camNum ) {
419 syscall( CG_STOPCAMERA, camNum );
420 }
421 //----(SA) end
422
trap_getCameraInfo(int camNum,int time,vec3_t * origin,vec3_t * angles,float * fov)423 qboolean trap_getCameraInfo( int camNum, int time, vec3_t *origin, vec3_t *angles, float *fov ) {
424 return syscall( CG_GETCAMERAINFO, camNum, time, origin, angles, fov );
425 }
426
427
trap_Key_IsDown(int keynum)428 qboolean trap_Key_IsDown( int keynum ) {
429 return syscall( CG_KEY_ISDOWN, keynum );
430 }
431
trap_Key_GetCatcher(void)432 int trap_Key_GetCatcher( void ) {
433 return syscall( CG_KEY_GETCATCHER );
434 }
435
trap_Key_SetCatcher(int catcher)436 void trap_Key_SetCatcher( int catcher ) {
437 syscall( CG_KEY_SETCATCHER, catcher );
438 }
439
trap_Key_GetKey(const char * binding)440 int trap_Key_GetKey( const char *binding ) {
441 return syscall( CG_KEY_GETKEY, binding );
442 }
443
444
trap_PC_AddGlobalDefine(char * define)445 int trap_PC_AddGlobalDefine( char *define ) {
446 return syscall( CG_PC_ADD_GLOBAL_DEFINE, define );
447 }
448
trap_PC_LoadSource(const char * filename)449 int trap_PC_LoadSource( const char *filename ) {
450 return syscall( CG_PC_LOAD_SOURCE, filename );
451 }
452
trap_PC_FreeSource(int handle)453 int trap_PC_FreeSource( int handle ) {
454 return syscall( CG_PC_FREE_SOURCE, handle );
455 }
456
trap_PC_ReadToken(int handle,pc_token_t * pc_token)457 int trap_PC_ReadToken( int handle, pc_token_t *pc_token ) {
458 return syscall( CG_PC_READ_TOKEN, handle, pc_token );
459 }
460
461
trap_PC_SourceFileAndLine(int handle,char * filename,int * line)462 int trap_PC_SourceFileAndLine( int handle, char *filename, int *line ) {
463 return syscall( CG_PC_SOURCE_FILE_AND_LINE, handle, filename, line );
464 }
465
trap_S_StopBackgroundTrack(void)466 void trap_S_StopBackgroundTrack( void ) {
467 syscall( CG_S_STOPBACKGROUNDTRACK );
468 }
469
trap_RealTime(qtime_t * qtime)470 int trap_RealTime( qtime_t *qtime ) {
471 return syscall( CG_REAL_TIME, qtime );
472 }
473
trap_SnapVector(float * v)474 void trap_SnapVector( float *v ) {
475 syscall( CG_SNAPVECTOR, v );
476 }
477
trap_SendMoveSpeedsToGame(int entnum,char * movespeeds)478 void trap_SendMoveSpeedsToGame( int entnum, char *movespeeds ) {
479 syscall( CG_SENDMOVESPEEDSTOGAME, entnum, movespeeds );
480 }
481
482 // this returns a handle. arg0 is the name in the format "idlogo.roq", set arg1 to NULL, alteredstates to qfalse (do not alter gamestate)
trap_CIN_PlayCinematic(const char * arg0,int xpos,int ypos,int width,int height,int bits)483 int trap_CIN_PlayCinematic( const char *arg0, int xpos, int ypos, int width, int height, int bits ) {
484 return syscall( CG_CIN_PLAYCINEMATIC, arg0, xpos, ypos, width, height, bits );
485 }
486
487 // stops playing the cinematic and ends it. should always return FMV_EOF
488 // cinematics must be stopped in reverse order of when they are started
trap_CIN_StopCinematic(int handle)489 e_status trap_CIN_StopCinematic( int handle ) {
490 return syscall( CG_CIN_STOPCINEMATIC, handle );
491 }
492
493
494 // 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.
trap_CIN_RunCinematic(int handle)495 e_status trap_CIN_RunCinematic( int handle ) {
496 return syscall( CG_CIN_RUNCINEMATIC, handle );
497 }
498
499
500 // draws the current frame
trap_CIN_DrawCinematic(int handle)501 void trap_CIN_DrawCinematic( int handle ) {
502 syscall( CG_CIN_DRAWCINEMATIC, handle );
503 }
504
505
506 // allows you to resize the animation dynamically
trap_CIN_SetExtents(int handle,int x,int y,int w,int h)507 void trap_CIN_SetExtents( int handle, int x, int y, int w, int h ) {
508 syscall( CG_CIN_SETEXTENTS, handle, x, y, w, h );
509 }
510
trap_GetEntityToken(char * buffer,int bufferSize)511 qboolean trap_GetEntityToken( char *buffer, int bufferSize ) {
512 return syscall( CG_GET_ENTITY_TOKEN, buffer, bufferSize );
513 }
514
515 //----(SA) added
516 // bring up a popup menu
517 //extern void Menus_OpenByName( const char *p );
518
trap_UI_Popup(const char * arg0)519 void trap_UI_Popup( const char *arg0 ) {
520 syscall( CG_INGAME_POPUP, arg0 );
521 }
522
523 // NERVE - SMF
trap_UI_LimboChat(const char * arg0)524 void trap_UI_LimboChat( const char *arg0 ) {
525 syscall( CG_LIMBOCHAT, arg0 );
526 }
527
trap_UI_ClosePopup(const char * arg0)528 void trap_UI_ClosePopup( const char *arg0 ) {
529 syscall( CG_INGAME_CLOSEPOPUP, arg0 );
530 }
531 // -NERVE - SMF
532
trap_GetModelInfo(int clientNum,char * modelName,animModelInfo_t ** modelInfo)533 qboolean trap_GetModelInfo( int clientNum, char *modelName, animModelInfo_t **modelInfo ) {
534 return syscall( CG_GETMODELINFO, clientNum, modelName, modelInfo );
535 }
536
537 // New in IORTCW
trap_Alloc(int size)538 void *trap_Alloc( int size ) {
539 return (void*)syscall( CG_ALLOC, size );
540 }
541