1 /*
2 ===========================================================================
3 
4 Return to Castle Wolfenstein multiplayer 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 multiplayer GPL Source Code (“RTCW MP Source Code”).
8 
9 RTCW MP 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 MP 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 MP Source Code.  If not, see <http://www.gnu.org/licenses/>.
21 
22 In addition, the RTCW MP 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 MP 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 
trap_S_AddRealLoopingSound(int entityNum,const vec3_t origin,const vec3_t velocity,int range,sfxHandle_t sfx,int volume)207 void    trap_S_AddRealLoopingSound( int entityNum, const vec3_t origin, const vec3_t velocity, int range, sfxHandle_t sfx, int volume ) {
208 	syscall( CG_S_ADDREALLOOPINGSOUND, entityNum, origin, velocity, range, sfx, volume );
209 }
210 
trap_S_StopLoopingSound(int entityNum)211 void    trap_S_StopLoopingSound( int entityNum ) {
212 	syscall( CG_S_STOPLOOPINGSOUND, entityNum );
213 }
214 
trap_S_UpdateEntityPosition(int entityNum,const vec3_t origin)215 void    trap_S_UpdateEntityPosition( int entityNum, const vec3_t origin ) {
216 	syscall( CG_S_UPDATEENTITYPOSITION, entityNum, origin );
217 }
218 
219 // Ridah, talking animations
trap_S_GetVoiceAmplitude(int entityNum)220 int     trap_S_GetVoiceAmplitude( int entityNum ) {
221 	return syscall( CG_S_GETVOICEAMPLITUDE, entityNum );
222 }
223 // done.
224 
trap_S_Respatialize(int entityNum,const vec3_t origin,vec3_t axis[3],int inwater)225 void    trap_S_Respatialize( int entityNum, const vec3_t origin, vec3_t axis[3], int inwater ) {
226 	syscall( CG_S_RESPATIALIZE, entityNum, origin, axis, inwater );
227 }
228 
trap_S_RegisterSound(const char * sample)229 sfxHandle_t trap_S_RegisterSound( const char *sample ) {
230 	CG_DrawInformation();
231 	return syscall( CG_S_REGISTERSOUND, sample );
232 }
233 
trap_S_StartBackgroundTrack(const char * intro,const char * loop)234 void    trap_S_StartBackgroundTrack( const char *intro, const char *loop ) {
235 	syscall( CG_S_STARTBACKGROUNDTRACK, intro, loop );
236 }
237 
trap_S_StartStreamingSound(const char * intro,const char * loop,int entnum,int channel,int attenuation)238 void    trap_S_StartStreamingSound( const char *intro, const char *loop, int entnum, int channel, int attenuation ) {
239 	syscall( CG_S_STARTSTREAMINGSOUND, intro, loop, entnum, channel, attenuation );
240 }
241 
trap_R_LoadWorldMap(const char * mapname)242 void    trap_R_LoadWorldMap( const char *mapname ) {
243 	syscall( CG_R_LOADWORLDMAP, mapname );
244 }
245 
trap_R_RegisterModel(const char * name)246 qhandle_t trap_R_RegisterModel( const char *name ) {
247 	CG_DrawInformation();
248 	return syscall( CG_R_REGISTERMODEL, name );
249 }
250 
251 //----(SA)	added
trap_R_GetSkinModel(qhandle_t skinid,const char * type,char * name)252 qboolean trap_R_GetSkinModel( qhandle_t skinid, const char *type, char *name ) {
253 	return syscall( CG_R_GETSKINMODEL, skinid, type, name );
254 }
255 
trap_R_GetShaderFromModel(qhandle_t modelid,int surfnum,int withlightmap)256 qhandle_t trap_R_GetShaderFromModel( qhandle_t modelid, int surfnum, int withlightmap ) {
257 	return syscall( CG_R_GETMODELSHADER, modelid, surfnum, withlightmap );
258 }
259 //----(SA)	end
260 
trap_R_RegisterSkin(const char * name)261 qhandle_t trap_R_RegisterSkin( const char *name ) {
262 	CG_DrawInformation();
263 	return syscall( CG_R_REGISTERSKIN, name );
264 }
265 
trap_R_RegisterShader(const char * name)266 qhandle_t trap_R_RegisterShader( const char *name ) {
267 	CG_DrawInformation();
268 	return syscall( CG_R_REGISTERSHADER, name );
269 }
270 
trap_R_RegisterShaderNoMip(const char * name)271 qhandle_t trap_R_RegisterShaderNoMip( const char *name ) {
272 	CG_DrawInformation();
273 	return syscall( CG_R_REGISTERSHADERNOMIP, name );
274 }
275 
trap_R_RegisterFont(const char * fontName,int pointSize,fontInfo_t * font)276 void trap_R_RegisterFont( const char *fontName, int pointSize, fontInfo_t *font ) {
277 	syscall( CG_R_REGISTERFONT, fontName, pointSize, font );
278 }
279 
trap_R_ClearScene(void)280 void    trap_R_ClearScene( void ) {
281 	syscall( CG_R_CLEARSCENE );
282 }
283 
trap_R_AddRefEntityToScene(const refEntity_t * re)284 void    trap_R_AddRefEntityToScene( const refEntity_t *re ) {
285 	syscall( CG_R_ADDREFENTITYTOSCENE, re );
286 }
287 
trap_R_AddPolyToScene(qhandle_t hShader,int numVerts,const polyVert_t * verts)288 void    trap_R_AddPolyToScene( qhandle_t hShader, int numVerts, const polyVert_t *verts ) {
289 	syscall( CG_R_ADDPOLYTOSCENE, hShader, numVerts, verts );
290 }
291 
292 // Ridah
trap_R_AddPolysToScene(qhandle_t hShader,int numVerts,const polyVert_t * verts,int numPolys)293 void    trap_R_AddPolysToScene( qhandle_t hShader, int numVerts, const polyVert_t *verts, int numPolys ) {
294 	syscall( CG_R_ADDPOLYSTOSCENE, hShader, numVerts, verts, numPolys );
295 }
296 // done.
297 
trap_R_AddLightToScene(const vec3_t org,float intensity,float r,float g,float b,int overdraw)298 void    trap_R_AddLightToScene( const vec3_t org, float intensity, float r, float g, float b, int overdraw ) {
299 	syscall( CG_R_ADDLIGHTTOSCENE, org, PASSFLOAT( intensity ), PASSFLOAT( r ), PASSFLOAT( g ), PASSFLOAT( b ), overdraw );
300 }
301 
302 //----(SA)
trap_R_AddCoronaToScene(const vec3_t org,float r,float g,float b,float scale,int id,qboolean visible)303 void    trap_R_AddCoronaToScene( const vec3_t org, float r, float g, float b, float scale, int id, qboolean visible ) {
304 	syscall( CG_R_ADDCORONATOSCENE, org, PASSFLOAT( r ), PASSFLOAT( g ), PASSFLOAT( b ), PASSFLOAT( scale ), id, visible );
305 }
306 //----(SA)
307 
308 //----(SA)
trap_R_SetFog(int fogvar,int var1,int var2,float r,float g,float b,float density)309 void    trap_R_SetFog( int fogvar, int var1, int var2, float r, float g, float b, float density ) {
310 	syscall( CG_R_SETFOG, fogvar, var1, var2, PASSFLOAT( r ), PASSFLOAT( g ), PASSFLOAT( b ), PASSFLOAT( density ) );
311 }
312 //----(SA)
trap_R_RenderScene(const refdef_t * fd)313 void    trap_R_RenderScene( const refdef_t *fd ) {
314 	syscall( CG_R_RENDERSCENE, fd );
315 }
316 
trap_R_SetColor(const float * rgba)317 void    trap_R_SetColor( const float *rgba ) {
318 	syscall( CG_R_SETCOLOR, rgba );
319 }
320 
trap_R_DrawStretchPic(float x,float y,float w,float h,float s1,float t1,float s2,float t2,qhandle_t hShader)321 void    trap_R_DrawStretchPic( float x, float y, float w, float h,
322 							   float s1, float t1, float s2, float t2, qhandle_t hShader ) {
323 	syscall( CG_R_DRAWSTRETCHPIC, PASSFLOAT( x ), PASSFLOAT( y ), PASSFLOAT( w ), PASSFLOAT( h ), PASSFLOAT( s1 ), PASSFLOAT( t1 ), PASSFLOAT( s2 ), PASSFLOAT( t2 ), hShader );
324 }
325 
trap_R_DrawRotatedPic(float x,float y,float w,float h,float s1,float t1,float s2,float t2,qhandle_t hShader,float angle)326 void    trap_R_DrawRotatedPic( float x, float y, float w, float h,
327 							   float s1, float t1, float s2, float t2, qhandle_t hShader, float angle ) {
328 	syscall( CG_R_DRAWROTATEDPIC, PASSFLOAT( x ), PASSFLOAT( y ), PASSFLOAT( w ), PASSFLOAT( h ), PASSFLOAT( s1 ), PASSFLOAT( t1 ), PASSFLOAT( s2 ), PASSFLOAT( t2 ), hShader, PASSFLOAT( angle ) );
329 }
330 
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)331 void    trap_R_DrawStretchPicGradient(  float x, float y, float w, float h,
332 										float s1, float t1, float s2, float t2, qhandle_t hShader,
333 										const float *gradientColor, int gradientType ) {
334 	syscall( CG_R_DRAWSTRETCHPIC_GRADIENT, PASSFLOAT( x ), PASSFLOAT( y ), PASSFLOAT( w ), PASSFLOAT( h ), PASSFLOAT( s1 ), PASSFLOAT( t1 ), PASSFLOAT( s2 ), PASSFLOAT( t2 ), hShader, gradientColor, gradientType  );
335 }
336 
trap_R_ModelBounds(clipHandle_t model,vec3_t mins,vec3_t maxs)337 void    trap_R_ModelBounds( clipHandle_t model, vec3_t mins, vec3_t maxs ) {
338 	syscall( CG_R_MODELBOUNDS, model, mins, maxs );
339 }
340 
trap_R_LerpTag(orientation_t * tag,const refEntity_t * refent,const char * tagName,int startIndex)341 int     trap_R_LerpTag( orientation_t *tag, const refEntity_t *refent, const char *tagName, int startIndex ) {
342 	return syscall( CG_R_LERPTAG, tag, refent, tagName, startIndex );
343 }
344 
trap_R_RemapShader(const char * oldShader,const char * newShader,const char * timeOffset)345 void    trap_R_RemapShader( const char *oldShader, const char *newShader, const char *timeOffset ) {
346 	syscall( CG_R_REMAP_SHADER, oldShader, newShader, timeOffset );
347 }
348 
trap_GetGlconfig(glconfig_t * glconfig)349 void        trap_GetGlconfig( glconfig_t *glconfig ) {
350 	syscall( CG_GETGLCONFIG, glconfig );
351 }
352 
trap_GetGameState(gameState_t * gamestate)353 void        trap_GetGameState( gameState_t *gamestate ) {
354 	syscall( CG_GETGAMESTATE, gamestate );
355 }
356 
trap_GetCurrentSnapshotNumber(int * snapshotNumber,int * serverTime)357 void        trap_GetCurrentSnapshotNumber( int *snapshotNumber, int *serverTime ) {
358 	syscall( CG_GETCURRENTSNAPSHOTNUMBER, snapshotNumber, serverTime );
359 }
360 
trap_GetSnapshot(int snapshotNumber,snapshot_t * snapshot)361 qboolean    trap_GetSnapshot( int snapshotNumber, snapshot_t *snapshot ) {
362 	return syscall( CG_GETSNAPSHOT, snapshotNumber, snapshot );
363 }
364 
trap_GetServerCommand(int serverCommandNumber)365 qboolean    trap_GetServerCommand( int serverCommandNumber ) {
366 	return syscall( CG_GETSERVERCOMMAND, serverCommandNumber );
367 }
368 
trap_GetCurrentCmdNumber(void)369 int         trap_GetCurrentCmdNumber( void ) {
370 	return syscall( CG_GETCURRENTCMDNUMBER );
371 }
372 
trap_GetUserCmd(int cmdNumber,usercmd_t * ucmd)373 qboolean    trap_GetUserCmd( int cmdNumber, usercmd_t *ucmd ) {
374 	return syscall( CG_GETUSERCMD, cmdNumber, ucmd );
375 }
376 
trap_SetUserCmdValue(int stateValue,int holdableValue,float sensitivityScale,int mpSetup,int mpIdentClient)377 void        trap_SetUserCmdValue( int stateValue, int holdableValue, float sensitivityScale, int mpSetup, int mpIdentClient ) {
378 	syscall( CG_SETUSERCMDVALUE, stateValue, holdableValue, PASSFLOAT( sensitivityScale ), mpSetup, mpIdentClient );
379 }
380 
trap_SetClientLerpOrigin(float x,float y,float z)381 void        trap_SetClientLerpOrigin( float x, float y, float z ) {
382 	syscall( CG_SETCLIENTLERPORIGIN, PASSFLOAT( x ), PASSFLOAT( y ), PASSFLOAT( z ) );
383 }
384 
testPrintInt(char * string,int i)385 void        testPrintInt( char *string, int i ) {
386 	syscall( CG_TESTPRINTINT, string, i );
387 }
388 
testPrintFloat(char * string,float f)389 void        testPrintFloat( char *string, float f ) {
390 	syscall( CG_TESTPRINTFLOAT, string, PASSFLOAT( f ) );
391 }
392 
trap_MemoryRemaining(void)393 int trap_MemoryRemaining( void ) {
394 	return syscall( CG_MEMORY_REMAINING );
395 }
396 
trap_loadCamera(int camNum,const char * name)397 qboolean trap_loadCamera( int camNum, const char *name ) {
398 	return syscall( CG_LOADCAMERA, camNum, name );
399 }
400 
trap_startCamera(int camNum,int time)401 void trap_startCamera( int camNum, int time ) {
402 	syscall( CG_STARTCAMERA, camNum, time );
403 }
404 
trap_getCameraInfo(int camNum,int time,vec3_t * origin,vec3_t * angles,float * fov)405 qboolean trap_getCameraInfo( int camNum, int time, vec3_t *origin, vec3_t *angles, float *fov ) {
406 	return syscall( CG_GETCAMERAINFO, camNum, time, origin, angles, fov );
407 }
408 
409 
trap_Key_IsDown(int keynum)410 qboolean trap_Key_IsDown( int keynum ) {
411 	return syscall( CG_KEY_ISDOWN, keynum );
412 }
413 
trap_Key_GetCatcher(void)414 int trap_Key_GetCatcher( void ) {
415 	return syscall( CG_KEY_GETCATCHER );
416 }
417 
trap_Key_SetCatcher(int catcher)418 void trap_Key_SetCatcher( int catcher ) {
419 	syscall( CG_KEY_SETCATCHER, catcher );
420 }
421 
trap_Key_GetKey(const char * binding)422 int trap_Key_GetKey( const char *binding ) {
423 	return syscall( CG_KEY_GETKEY, binding );
424 }
425 
426 
trap_PC_AddGlobalDefine(char * define)427 int trap_PC_AddGlobalDefine( char *define ) {
428 	return syscall( CG_PC_ADD_GLOBAL_DEFINE, define );
429 }
430 
trap_PC_LoadSource(const char * filename)431 int trap_PC_LoadSource( const char *filename ) {
432 	return syscall( CG_PC_LOAD_SOURCE, filename );
433 }
434 
trap_PC_FreeSource(int handle)435 int trap_PC_FreeSource( int handle ) {
436 	return syscall( CG_PC_FREE_SOURCE, handle );
437 }
438 
trap_PC_ReadToken(int handle,pc_token_t * pc_token)439 int trap_PC_ReadToken( int handle, pc_token_t *pc_token ) {
440 	return syscall( CG_PC_READ_TOKEN, handle, pc_token );
441 }
442 
443 
trap_PC_SourceFileAndLine(int handle,char * filename,int * line)444 int trap_PC_SourceFileAndLine( int handle, char *filename, int *line ) {
445 	return syscall( CG_PC_SOURCE_FILE_AND_LINE, handle, filename, line );
446 }
447 
trap_S_StopBackgroundTrack(void)448 void    trap_S_StopBackgroundTrack( void ) {
449 	syscall( CG_S_STOPBACKGROUNDTRACK );
450 }
451 
trap_RealTime(qtime_t * qtime)452 int trap_RealTime( qtime_t *qtime ) {
453 	return syscall( CG_REAL_TIME, qtime );
454 }
455 
trap_SnapVector(float * v)456 void trap_SnapVector( float *v ) {
457 	syscall( CG_SNAPVECTOR, v );
458 }
459 
trap_SendMoveSpeedsToGame(int entnum,char * movespeeds)460 void trap_SendMoveSpeedsToGame( int entnum, char *movespeeds ) {
461 	syscall( CG_SENDMOVESPEEDSTOGAME, entnum, movespeeds );
462 }
463 
464 // 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)465 int trap_CIN_PlayCinematic( const char *arg0, int xpos, int ypos, int width, int height, int bits ) {
466 	return syscall( CG_CIN_PLAYCINEMATIC, arg0, xpos, ypos, width, height, bits );
467 }
468 
469 // stops playing the cinematic and ends it.  should always return FMV_EOF
470 // cinematics must be stopped in reverse order of when they are started
trap_CIN_StopCinematic(int handle)471 e_status trap_CIN_StopCinematic( int handle ) {
472 	return syscall( CG_CIN_STOPCINEMATIC, handle );
473 }
474 
475 
476 // 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)477 e_status trap_CIN_RunCinematic( int handle ) {
478 	return syscall( CG_CIN_RUNCINEMATIC, handle );
479 }
480 
481 
482 // draws the current frame
trap_CIN_DrawCinematic(int handle)483 void trap_CIN_DrawCinematic( int handle ) {
484 	syscall( CG_CIN_DRAWCINEMATIC, handle );
485 }
486 
487 
488 // allows you to resize the animation dynamically
trap_CIN_SetExtents(int handle,int x,int y,int w,int h)489 void trap_CIN_SetExtents( int handle, int x, int y, int w, int h ) {
490 	syscall( CG_CIN_SETEXTENTS, handle, x, y, w, h );
491 }
492 
trap_GetEntityToken(char * buffer,int bufferSize)493 qboolean trap_GetEntityToken( char *buffer, int bufferSize ) {
494 	return syscall( CG_GET_ENTITY_TOKEN, buffer, bufferSize );
495 }
496 
497 //----(SA)	added
498 // bring up a popup menu
499 //extern void Menus_OpenByName( const char *p );
500 
trap_UI_Popup(const char * arg0)501 void trap_UI_Popup( const char *arg0 ) {
502 	syscall( CG_INGAME_POPUP, arg0 );
503 }
504 
505 // NERVE - SMF
trap_UI_LimboChat(const char * arg0)506 void trap_UI_LimboChat( const char *arg0 ) {
507 	syscall( CG_LIMBOCHAT, arg0 );
508 }
509 
trap_UI_ClosePopup(const char * arg0)510 void trap_UI_ClosePopup( const char *arg0 ) {
511 	syscall( CG_INGAME_CLOSEPOPUP, arg0 );
512 }
513 // -NERVE - SMF
514 
trap_Key_GetBindingBuf(int keynum,char * buf,int buflen)515 void trap_Key_GetBindingBuf( int keynum, char *buf, int buflen ) {
516 	syscall( CG_KEY_GETBINDINGBUF, keynum, buf, buflen );
517 }
518 
trap_Key_SetBinding(int keynum,const char * binding)519 void trap_Key_SetBinding( int keynum, const char *binding ) {
520 	syscall( CG_KEY_SETBINDING, keynum, binding );
521 }
522 
trap_Key_KeynumToStringBuf(int keynum,char * buf,int buflen)523 void trap_Key_KeynumToStringBuf( int keynum, char *buf, int buflen ) {
524 	syscall( CG_KEY_KEYNUMTOSTRINGBUF, keynum, buf, buflen );
525 }
526 
trap_TranslateString(const char * string,char * buf)527 void trap_TranslateString( const char *string, char *buf ) {
528 	syscall( CG_TRANSLATE_STRING, string, buf );
529 }
530 // -NERVE - SMF
531