Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

ui_syscalls.c

Go to the documentation of this file.
00001 /*
00002 ===========================================================================
00003 Copyright (C) 1999-2005 Id Software, Inc.
00004 
00005 This file is part of Quake III Arena source code.
00006 
00007 Quake III Arena source code is free software; you can redistribute it
00008 and/or modify it under the terms of the GNU General Public License as
00009 published by the Free Software Foundation; either version 2 of the License,
00010 or (at your option) any later version.
00011 
00012 Quake III Arena source code is distributed in the hope that it will be
00013 useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 GNU General Public License for more details.
00016 
00017 You should have received a copy of the GNU General Public License
00018 along with Foobar; if not, write to the Free Software
00019 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00020 ===========================================================================
00021 */
00022 //
00023 #include "ui_local.h"
00024 
00025 // this file is only included when building a dll
00026 // syscalls.asm is included instead when building a qvm
00027 #ifdef Q3_VM
00028 #error "Do not use in VM build"
00029 #endif
00030 
00031 static int (QDECL *syscall)( int arg, ... ) = (int (QDECL *)( int, ...))-1;
00032 
00033 void dllEntry( int (QDECL *syscallptr)( int arg,... ) ) {
00034     syscall = syscallptr;
00035 }
00036 
00037 int PASSFLOAT( float x ) {
00038     float   floatTemp;
00039     floatTemp = x;
00040     return *(int *)&floatTemp;
00041 }
00042 
00043 void trap_Print( const char *string ) {
00044     syscall( UI_PRINT, string );
00045 }
00046 
00047 void trap_Error( const char *string ) {
00048     syscall( UI_ERROR, string );
00049 }
00050 
00051 int trap_Milliseconds( void ) {
00052     return syscall( UI_MILLISECONDS ); 
00053 }
00054 
00055 void trap_Cvar_Register( vmCvar_t *cvar, const char *var_name, const char *value, int flags ) {
00056     syscall( UI_CVAR_REGISTER, cvar, var_name, value, flags );
00057 }
00058 
00059 void trap_Cvar_Update( vmCvar_t *cvar ) {
00060     syscall( UI_CVAR_UPDATE, cvar );
00061 }
00062 
00063 void trap_Cvar_Set( const char *var_name, const char *value ) {
00064     syscall( UI_CVAR_SET, var_name, value );
00065 }
00066 
00067 float trap_Cvar_VariableValue( const char *var_name ) {
00068     int temp;
00069     temp = syscall( UI_CVAR_VARIABLEVALUE, var_name );
00070     return (*(float*)&temp);
00071 }
00072 
00073 void trap_Cvar_VariableStringBuffer( const char *var_name, char *buffer, int bufsize ) {
00074     syscall( UI_CVAR_VARIABLESTRINGBUFFER, var_name, buffer, bufsize );
00075 }
00076 
00077 void trap_Cvar_SetValue( const char *var_name, float value ) {
00078     syscall( UI_CVAR_SETVALUE, var_name, PASSFLOAT( value ) );
00079 }
00080 
00081 void trap_Cvar_Reset( const char *name ) {
00082     syscall( UI_CVAR_RESET, name ); 
00083 }
00084 
00085 void trap_Cvar_Create( const char *var_name, const char *var_value, int flags ) {
00086     syscall( UI_CVAR_CREATE, var_name, var_value, flags );
00087 }
00088 
00089 void trap_Cvar_InfoStringBuffer( int bit, char *buffer, int bufsize ) {
00090     syscall( UI_CVAR_INFOSTRINGBUFFER, bit, buffer, bufsize );
00091 }
00092 
00093 int trap_Argc( void ) {
00094     return syscall( UI_ARGC );
00095 }
00096 
00097 void trap_Argv( int n, char *buffer, int bufferLength ) {
00098     syscall( UI_ARGV, n, buffer, bufferLength );
00099 }
00100 
00101 void trap_Cmd_ExecuteText( int exec_when, const char *text ) {
00102     syscall( UI_CMD_EXECUTETEXT, exec_when, text );
00103 }
00104 
00105 int trap_FS_FOpenFile( const char *qpath, fileHandle_t *f, fsMode_t mode ) {
00106     return syscall( UI_FS_FOPENFILE, qpath, f, mode );
00107 }
00108 
00109 void trap_FS_Read( void *buffer, int len, fileHandle_t f ) {
00110     syscall( UI_FS_READ, buffer, len, f );
00111 }
00112 
00113 void trap_FS_Write( const void *buffer, int len, fileHandle_t f ) {
00114     syscall( UI_FS_WRITE, buffer, len, f );
00115 }
00116 
00117 void trap_FS_FCloseFile( fileHandle_t f ) {
00118     syscall( UI_FS_FCLOSEFILE, f );
00119 }
00120 
00121 int trap_FS_GetFileList(  const char *path, const char *extension, char *listbuf, int bufsize ) {
00122     return syscall( UI_FS_GETFILELIST, path, extension, listbuf, bufsize );
00123 }
00124 
00125 int trap_FS_Seek( fileHandle_t f, long offset, int origin ) {
00126     return syscall( UI_FS_SEEK, f, offset, origin );
00127 }
00128 
00129 qhandle_t trap_R_RegisterModel( const char *name ) {
00130     return syscall( UI_R_REGISTERMODEL, name );
00131 }
00132 
00133 qhandle_t trap_R_RegisterSkin( const char *name ) {
00134     return syscall( UI_R_REGISTERSKIN, name );
00135 }
00136 
00137 void trap_R_RegisterFont(const char *fontName, int pointSize, fontInfo_t *font) {
00138     syscall( UI_R_REGISTERFONT, fontName, pointSize, font );
00139 }
00140 
00141 qhandle_t trap_R_RegisterShaderNoMip( const char *name ) {
00142     return syscall( UI_R_REGISTERSHADERNOMIP, name );
00143 }
00144 
00145 void trap_R_ClearScene( void ) {
00146     syscall( UI_R_CLEARSCENE );
00147 }
00148 
00149 void trap_R_AddRefEntityToScene( const refEntity_t *re ) {
00150     syscall( UI_R_ADDREFENTITYTOSCENE, re );
00151 }
00152 
00153 void trap_R_AddPolyToScene( qhandle_t hShader , int numVerts, const polyVert_t *verts ) {
00154     syscall( UI_R_ADDPOLYTOSCENE, hShader, numVerts, verts );
00155 }
00156 
00157 void trap_R_AddLightToScene( const vec3_t org, float intensity, float r, float g, float b ) {
00158     syscall( UI_R_ADDLIGHTTOSCENE, org, PASSFLOAT(intensity), PASSFLOAT(r), PASSFLOAT(g), PASSFLOAT(b) );
00159 }
00160 
00161 void trap_R_RenderScene( const refdef_t *fd ) {
00162     syscall( UI_R_RENDERSCENE, fd );
00163 }
00164 
00165 void trap_R_SetColor( const float *rgba ) {
00166     syscall( UI_R_SETCOLOR, rgba );
00167 }
00168 
00169 void trap_R_DrawStretchPic( float x, float y, float w, float h, float s1, float t1, float s2, float t2, qhandle_t hShader ) {
00170     syscall( UI_R_DRAWSTRETCHPIC, PASSFLOAT(x), PASSFLOAT(y), PASSFLOAT(w), PASSFLOAT(h), PASSFLOAT(s1), PASSFLOAT(t1), PASSFLOAT(s2), PASSFLOAT(t2), hShader );
00171 }
00172 
00173 void    trap_R_ModelBounds( clipHandle_t model, vec3_t mins, vec3_t maxs ) {
00174     syscall( UI_R_MODELBOUNDS, model, mins, maxs );
00175 }
00176 
00177 void trap_UpdateScreen( void ) {
00178     syscall( UI_UPDATESCREEN );
00179 }
00180 
00181 int trap_CM_LerpTag( orientation_t *tag, clipHandle_t mod, int startFrame, int endFrame, float frac, const char *tagName ) {
00182     return syscall( UI_CM_LERPTAG, tag, mod, startFrame, endFrame, PASSFLOAT(frac), tagName );
00183 }
00184 
00185 void trap_S_StartLocalSound( sfxHandle_t sfx, int channelNum ) {
00186     syscall( UI_S_STARTLOCALSOUND, sfx, channelNum );
00187 }
00188 
00189 sfxHandle_t trap_S_RegisterSound( const char *sample, qboolean compressed ) {
00190     return syscall( UI_S_REGISTERSOUND, sample, compressed );
00191 }
00192 
00193 void trap_Key_KeynumToStringBuf( int keynum, char *buf, int buflen ) {
00194     syscall( UI_KEY_KEYNUMTOSTRINGBUF, keynum, buf, buflen );
00195 }
00196 
00197 void trap_Key_GetBindingBuf( int keynum, char *buf, int buflen ) {
00198     syscall( UI_KEY_GETBINDINGBUF, keynum, buf, buflen );
00199 }
00200 
00201 void trap_Key_SetBinding( int keynum, const char *binding ) {
00202     syscall( UI_KEY_SETBINDING, keynum, binding );
00203 }
00204 
00205 qboolean trap_Key_IsDown( int keynum ) {
00206     return syscall( UI_KEY_ISDOWN, keynum );
00207 }
00208 
00209 qboolean trap_Key_GetOverstrikeMode( void ) {
00210     return syscall( UI_KEY_GETOVERSTRIKEMODE );
00211 }
00212 
00213 void trap_Key_SetOverstrikeMode( qboolean state ) {
00214     syscall( UI_KEY_SETOVERSTRIKEMODE, state );
00215 }
00216 
00217 void trap_Key_ClearStates( void ) {
00218     syscall( UI_KEY_CLEARSTATES );
00219 }
00220 
00221 int trap_Key_GetCatcher( void ) {
00222     return syscall( UI_KEY_GETCATCHER );
00223 }
00224 
00225 void trap_Key_SetCatcher( int catcher ) {
00226     syscall( UI_KEY_SETCATCHER, catcher );
00227 }
00228 
00229 void trap_GetClipboardData( char *buf, int bufsize ) {
00230     syscall( UI_GETCLIPBOARDDATA, buf, bufsize );
00231 }
00232 
00233 void trap_GetClientState( uiClientState_t *state ) {
00234     syscall( UI_GETCLIENTSTATE, state );
00235 }
00236 
00237 void trap_GetGlconfig( glconfig_t *glconfig ) {
00238     syscall( UI_GETGLCONFIG, glconfig );
00239 }
00240 
00241 int trap_GetConfigString( int index, char* buff, int buffsize ) {
00242     return syscall( UI_GETCONFIGSTRING, index, buff, buffsize );
00243 }
00244 
00245 int trap_LAN_GetServerCount( int source ) {
00246     return syscall( UI_LAN_GETSERVERCOUNT, source );
00247 }
00248 
00249 void trap_LAN_GetServerAddressString( int source, int n, char *buf, int buflen ) {
00250     syscall( UI_LAN_GETSERVERADDRESSSTRING, source, n, buf, buflen );
00251 }
00252 
00253 void trap_LAN_GetServerInfo( int source, int n, char *buf, int buflen ) {
00254     syscall( UI_LAN_GETSERVERINFO, source, n, buf, buflen );
00255 }
00256 
00257 int trap_LAN_GetServerPing( int source, int n ) {
00258     return syscall( UI_LAN_GETSERVERPING, source, n );
00259 }
00260 
00261 int trap_LAN_GetPingQueueCount( void ) {
00262     return syscall( UI_LAN_GETPINGQUEUECOUNT );
00263 }
00264 
00265 int trap_LAN_ServerStatus( const char *serverAddress, char *serverStatus, int maxLen ) {
00266     return syscall( UI_LAN_SERVERSTATUS, serverAddress, serverStatus, maxLen );
00267 }
00268 
00269 void trap_LAN_SaveCachedServers() {
00270     syscall( UI_LAN_SAVECACHEDSERVERS );
00271 }
00272 
00273 void trap_LAN_LoadCachedServers() {
00274     syscall( UI_LAN_LOADCACHEDSERVERS );
00275 }
00276 
00277 void trap_LAN_ResetPings(int n) {
00278     syscall( UI_LAN_RESETPINGS, n );
00279 }
00280 
00281 void trap_LAN_ClearPing( int n ) {
00282     syscall( UI_LAN_CLEARPING, n );
00283 }
00284 
00285 void trap_LAN_GetPing( int n, char *buf, int buflen, int *pingtime ) {
00286     syscall( UI_LAN_GETPING, n, buf, buflen, pingtime );
00287 }
00288 
00289 void trap_LAN_GetPingInfo( int n, char *buf, int buflen ) {
00290     syscall( UI_LAN_GETPINGINFO, n, buf, buflen );
00291 }
00292 
00293 void trap_LAN_MarkServerVisible( int source, int n, qboolean visible ) {
00294     syscall( UI_LAN_MARKSERVERVISIBLE, source, n, visible );
00295 }
00296 
00297 int trap_LAN_ServerIsVisible( int source, int n) {
00298     return syscall( UI_LAN_SERVERISVISIBLE, source, n );
00299 }
00300 
00301 qboolean trap_LAN_UpdateVisiblePings( int source ) {
00302     return syscall( UI_LAN_UPDATEVISIBLEPINGS, source );
00303 }
00304 
00305 int trap_LAN_AddServer(int source, const char *name, const char *addr) {
00306     return syscall( UI_LAN_ADDSERVER, source, name, addr );
00307 }
00308 
00309 void trap_LAN_RemoveServer(int source, const char *addr) {
00310     syscall( UI_LAN_REMOVESERVER, source, addr );
00311 }
00312 
00313 int trap_LAN_CompareServers( int source, int sortKey, int sortDir, int s1, int s2 ) {
00314     return syscall( UI_LAN_COMPARESERVERS, source, sortKey, sortDir, s1, s2 );
00315 }
00316 
00317 int trap_MemoryRemaining( void ) {
00318     return syscall( UI_MEMORY_REMAINING );
00319 }
00320 
00321 void trap_GetCDKey( char *buf, int buflen ) {
00322     syscall( UI_GET_CDKEY, buf, buflen );
00323 }
00324 
00325 void trap_SetCDKey( char *buf ) {
00326     syscall( UI_SET_CDKEY, buf );
00327 }
00328 
00329 int trap_PC_AddGlobalDefine( char *define ) {
00330     return syscall( UI_PC_ADD_GLOBAL_DEFINE, define );
00331 }
00332 
00333 int trap_PC_LoadSource( const char *filename ) {
00334     return syscall( UI_PC_LOAD_SOURCE, filename );
00335 }
00336 
00337 int trap_PC_FreeSource( int handle ) {
00338     return syscall( UI_PC_FREE_SOURCE, handle );
00339 }
00340 
00341 int trap_PC_ReadToken( int handle, pc_token_t *pc_token ) {
00342     return syscall( UI_PC_READ_TOKEN, handle, pc_token );
00343 }
00344 
00345 int trap_PC_SourceFileAndLine( int handle, char *filename, int *line ) {
00346     return syscall( UI_PC_SOURCE_FILE_AND_LINE, handle, filename, line );
00347 }
00348 
00349 void trap_S_StopBackgroundTrack( void ) {
00350     syscall( UI_S_STOPBACKGROUNDTRACK );
00351 }
00352 
00353 void trap_S_StartBackgroundTrack( const char *intro, const char *loop) {
00354     syscall( UI_S_STARTBACKGROUNDTRACK, intro, loop );
00355 }
00356 
00357 int trap_RealTime(qtime_t *qtime) {
00358     return syscall( UI_REAL_TIME, qtime );
00359 }
00360 
00361 // this returns a handle.  arg0 is the name in the format "idlogo.roq", set arg1 to NULL, alteredstates to qfalse (do not alter gamestate)
00362 int trap_CIN_PlayCinematic( const char *arg0, int xpos, int ypos, int width, int height, int bits) {
00363   return syscall(UI_CIN_PLAYCINEMATIC, arg0, xpos, ypos, width, height, bits);
00364 }
00365  
00366 // stops playing the cinematic and ends it.  should always return FMV_EOF
00367 // cinematics must be stopped in reverse order of when they are started
00368 e_status trap_CIN_StopCinematic(int handle) {
00369   return syscall(UI_CIN_STOPCINEMATIC, handle);
00370 }
00371 
00372 
00373 // 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.
00374 e_status trap_CIN_RunCinematic (int handle) {
00375   return syscall(UI_CIN_RUNCINEMATIC, handle);
00376 }
00377  
00378 
00379 // draws the current frame
00380 void trap_CIN_DrawCinematic (int handle) {
00381   syscall(UI_CIN_DRAWCINEMATIC, handle);
00382 }
00383  
00384 
00385 // allows you to resize the animation dynamically
00386 void trap_CIN_SetExtents (int handle, int x, int y, int w, int h) {
00387   syscall(UI_CIN_SETEXTENTS, handle, x, y, w, h);
00388 }
00389 
00390 
00391 void    trap_R_RemapShader( const char *oldShader, const char *newShader, const char *timeOffset ) {
00392     syscall( UI_R_REMAP_SHADER, oldShader, newShader, timeOffset );
00393 }
00394 
00395 qboolean trap_VerifyCDKey( const char *key, const char *chksum) {
00396     return syscall( UI_VERIFY_CDKEY, key, chksum);
00397 }
00398 
00399 void trap_SetPbClStatus( int status ) {
00400     syscall( UI_SET_PBCLSTATUS, status );
00401 }

Generated on Thu Aug 25 12:38:02 2005 for Quake III Arena by  doxygen 1.3.9.1