| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
#include "ui_local.h" |
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
#ifdef Q3_VM |
| 28 |
#error "Do not use in VM build" |
| 29 |
#endif |
| 30 |
|
| 31 |
static intptr_t (QDECL *syscall)( intptr_t arg, ... ) = (intptr_t (QDECL *)( intptr_t, ...))-1; |
| 32 |
|
| 33 |
Q_EXPORT void dllEntry( intptr_t (QDECL *syscallptr)( intptr_t arg,... ) ) { |
| 34 |
syscall = syscallptr; |
| 35 |
} |
| 36 |
|
| 37 |
int PASSFLOAT( float x ) { |
| 38 |
floatint_t fi; |
| 39 |
fi.f = x; |
| 40 |
return fi.i; |
| 41 |
} |
| 42 |
|
| 43 |
void trap_Print( const char *string ) { |
| 44 |
syscall( UI_PRINT, string ); |
| 45 |
} |
| 46 |
|
| 47 |
void trap_Error(const char *string) |
| 48 |
{ |
| 49 |
syscall(UI_ERROR, string); |
| 50 |
|
| 51 |
exit(1); |
| 52 |
} |
| 53 |
|
| 54 |
int trap_Milliseconds( void ) { |
| 55 |
return syscall( UI_MILLISECONDS ); |
| 56 |
} |
| 57 |
|
| 58 |
void trap_Cvar_Register( vmCvar_t *cvar, const char *var_name, const char *value, int flags ) { |
| 59 |
syscall( UI_CVAR_REGISTER, cvar, var_name, value, flags ); |
| 60 |
} |
| 61 |
|
| 62 |
void trap_Cvar_Update( vmCvar_t *cvar ) { |
| 63 |
syscall( UI_CVAR_UPDATE, cvar ); |
| 64 |
} |
| 65 |
|
| 66 |
void trap_Cvar_Set( const char *var_name, const char *value ) { |
| 67 |
syscall( UI_CVAR_SET, var_name, value ); |
| 68 |
} |
| 69 |
|
| 70 |
float trap_Cvar_VariableValue( const char *var_name ) { |
| 71 |
floatint_t fi; |
| 72 |
fi.i = syscall( UI_CVAR_VARIABLEVALUE, var_name ); |
| 73 |
return fi.f; |
| 74 |
} |
| 75 |
|
| 76 |
void trap_Cvar_VariableStringBuffer( const char *var_name, char *buffer, int bufsize ) { |
| 77 |
syscall( UI_CVAR_VARIABLESTRINGBUFFER, var_name, buffer, bufsize ); |
| 78 |
} |
| 79 |
|
| 80 |
void trap_Cvar_SetValue( const char *var_name, float value ) { |
| 81 |
syscall( UI_CVAR_SETVALUE, var_name, PASSFLOAT( value ) ); |
| 82 |
} |
| 83 |
|
| 84 |
void trap_Cvar_Reset( const char *name ) { |
| 85 |
syscall( UI_CVAR_RESET, name ); |
| 86 |
} |
| 87 |
|
| 88 |
void trap_Cvar_Create( const char *var_name, const char *var_value, int flags ) { |
| 89 |
syscall( UI_CVAR_CREATE, var_name, var_value, flags ); |
| 90 |
} |
| 91 |
|
| 92 |
void trap_Cvar_InfoStringBuffer( int bit, char *buffer, int bufsize ) { |
| 93 |
syscall( UI_CVAR_INFOSTRINGBUFFER, bit, buffer, bufsize ); |
| 94 |
} |
| 95 |
|
| 96 |
int trap_Argc( void ) { |
| 97 |
return syscall( UI_ARGC ); |
| 98 |
} |
| 99 |
|
| 100 |
void trap_Argv( int n, char *buffer, int bufferLength ) { |
| 101 |
syscall( UI_ARGV, n, buffer, bufferLength ); |
| 102 |
} |
| 103 |
|
| 104 |
void trap_Cmd_ExecuteText( int exec_when, const char *text ) { |
| 105 |
syscall( UI_CMD_EXECUTETEXT, exec_when, text ); |
| 106 |
} |
| 107 |
|
| 108 |
int trap_FS_FOpenFile( const char *qpath, fileHandle_t *f, fsMode_t mode ) { |
| 109 |
return syscall( UI_FS_FOPENFILE, qpath, f, mode ); |
| 110 |
} |
| 111 |
|
| 112 |
void trap_FS_Read( void *buffer, int len, fileHandle_t f ) { |
| 113 |
syscall( UI_FS_READ, buffer, len, f ); |
| 114 |
} |
| 115 |
|
| 116 |
void trap_FS_Write( const void *buffer, int len, fileHandle_t f ) { |
| 117 |
syscall( UI_FS_WRITE, buffer, len, f ); |
| 118 |
} |
| 119 |
|
| 120 |
void trap_FS_FCloseFile( fileHandle_t f ) { |
| 121 |
syscall( UI_FS_FCLOSEFILE, f ); |
| 122 |
} |
| 123 |
|
| 124 |
int trap_FS_GetFileList( const char *path, const char *extension, char *listbuf, int bufsize ) { |
| 125 |
return syscall( UI_FS_GETFILELIST, path, extension, listbuf, bufsize ); |
| 126 |
} |
| 127 |
|
| 128 |
int trap_FS_Seek( fileHandle_t f, long offset, int origin ) { |
| 129 |
return syscall( UI_FS_SEEK, f, offset, origin ); |
| 130 |
} |
| 131 |
|
| 132 |
qhandle_t trap_R_RegisterModel( const char *name ) { |
| 133 |
return syscall( UI_R_REGISTERMODEL, name ); |
| 134 |
} |
| 135 |
|
| 136 |
qhandle_t trap_R_RegisterSkin( const char *name ) { |
| 137 |
return syscall( UI_R_REGISTERSKIN, name ); |
| 138 |
} |
| 139 |
|
| 140 |
void trap_R_RegisterFont(const char *fontName, int pointSize, fontInfo_t *font) { |
| 141 |
syscall( UI_R_REGISTERFONT, fontName, pointSize, font ); |
| 142 |
} |
| 143 |
|
| 144 |
qhandle_t trap_R_RegisterShaderNoMip( const char *name ) { |
| 145 |
return syscall( UI_R_REGISTERSHADERNOMIP, name ); |
| 146 |
} |
| 147 |
|
| 148 |
void trap_R_ClearScene( void ) { |
| 149 |
syscall( UI_R_CLEARSCENE ); |
| 150 |
} |
| 151 |
|
| 152 |
void trap_R_AddRefEntityToScene( const refEntity_t *re ) { |
| 153 |
syscall( UI_R_ADDREFENTITYTOSCENE, re ); |
| 154 |
} |
| 155 |
|
| 156 |
void trap_R_AddPolyToScene( qhandle_t hShader , int numVerts, const polyVert_t *verts ) { |
| 157 |
syscall( UI_R_ADDPOLYTOSCENE, hShader, numVerts, verts ); |
| 158 |
} |
| 159 |
|
| 160 |
void trap_R_AddLightToScene( const vec3_t org, float intensity, float r, float g, float b ) { |
| 161 |
syscall( UI_R_ADDLIGHTTOSCENE, org, PASSFLOAT(intensity), PASSFLOAT(r), PASSFLOAT(g), PASSFLOAT(b) ); |
| 162 |
} |
| 163 |
|
| 164 |
void trap_R_RenderScene( const refdef_t *fd ) { |
| 165 |
syscall( UI_R_RENDERSCENE, fd ); |
| 166 |
} |
| 167 |
|
| 168 |
void trap_R_SetColor( const float *rgba ) { |
| 169 |
syscall( UI_R_SETCOLOR, rgba ); |
| 170 |
} |
| 171 |
|
| 172 |
void trap_R_DrawStretchPic( float x, float y, float w, float h, float s1, float t1, float s2, float t2, qhandle_t hShader ) { |
| 173 |
syscall( UI_R_DRAWSTRETCHPIC, PASSFLOAT(x), PASSFLOAT(y), PASSFLOAT(w), PASSFLOAT(h), PASSFLOAT(s1), PASSFLOAT(t1), PASSFLOAT(s2), PASSFLOAT(t2), hShader ); |
| 174 |
} |
| 175 |
|
| 176 |
void trap_R_ModelBounds( clipHandle_t model, vec3_t mins, vec3_t maxs ) { |
| 177 |
syscall( UI_R_MODELBOUNDS, model, mins, maxs ); |
| 178 |
} |
| 179 |
|
| 180 |
void trap_UpdateScreen( void ) { |
| 181 |
syscall( UI_UPDATESCREEN ); |
| 182 |
} |
| 183 |
|
| 184 |
int trap_CM_LerpTag( orientation_t *tag, clipHandle_t mod, int startFrame, int endFrame, float frac, const char *tagName ) { |
| 185 |
return syscall( UI_CM_LERPTAG, tag, mod, startFrame, endFrame, PASSFLOAT(frac), tagName ); |
| 186 |
} |
| 187 |
|
| 188 |
void trap_S_StartLocalSound( sfxHandle_t sfx, int channelNum ) { |
| 189 |
syscall( UI_S_STARTLOCALSOUND, sfx, channelNum ); |
| 190 |
} |
| 191 |
|
| 192 |
sfxHandle_t trap_S_RegisterSound( const char *sample, qboolean compressed ) { |
| 193 |
return syscall( UI_S_REGISTERSOUND, sample, compressed ); |
| 194 |
} |
| 195 |
|
| 196 |
void trap_Key_KeynumToStringBuf( int keynum, char *buf, int buflen ) { |
| 197 |
syscall( UI_KEY_KEYNUMTOSTRINGBUF, keynum, buf, buflen ); |
| 198 |
} |
| 199 |
|
| 200 |
void trap_Key_GetBindingBuf( int keynum, char *buf, int buflen ) { |
| 201 |
syscall( UI_KEY_GETBINDINGBUF, keynum, buf, buflen ); |
| 202 |
} |
| 203 |
|
| 204 |
void trap_Key_SetBinding( int keynum, const char *binding ) { |
| 205 |
syscall( UI_KEY_SETBINDING, keynum, binding ); |
| 206 |
} |
| 207 |
|
| 208 |
qboolean trap_Key_IsDown( int keynum ) { |
| 209 |
return syscall( UI_KEY_ISDOWN, keynum ); |
| 210 |
} |
| 211 |
|
| 212 |
qboolean trap_Key_GetOverstrikeMode( void ) { |
| 213 |
return syscall( UI_KEY_GETOVERSTRIKEMODE ); |
| 214 |
} |
| 215 |
|
| 216 |
void trap_Key_SetOverstrikeMode( qboolean state ) { |
| 217 |
syscall( UI_KEY_SETOVERSTRIKEMODE, state ); |
| 218 |
} |
| 219 |
|
| 220 |
void trap_Key_ClearStates( void ) { |
| 221 |
syscall( UI_KEY_CLEARSTATES ); |
| 222 |
} |
| 223 |
|
| 224 |
int trap_Key_GetCatcher( void ) { |
| 225 |
return syscall( UI_KEY_GETCATCHER ); |
| 226 |
} |
| 227 |
|
| 228 |
void trap_Key_SetCatcher( int catcher ) { |
| 229 |
syscall( UI_KEY_SETCATCHER, catcher ); |
| 230 |
} |
| 231 |
|
| 232 |
void trap_GetClipboardData( char *buf, int bufsize ) { |
| 233 |
syscall( UI_GETCLIPBOARDDATA, buf, bufsize ); |
| 234 |
} |
| 235 |
|
| 236 |
void trap_GetClientState( uiClientState_t *state ) { |
| 237 |
syscall( UI_GETCLIENTSTATE, state ); |
| 238 |
} |
| 239 |
|
| 240 |
void trap_GetGlconfig( glconfig_t *glconfig ) { |
| 241 |
syscall( UI_GETGLCONFIG, glconfig ); |
| 242 |
} |
| 243 |
|
| 244 |
int trap_GetConfigString( int index, char* buff, int buffsize ) { |
| 245 |
return syscall( UI_GETCONFIGSTRING, index, buff, buffsize ); |
| 246 |
} |
| 247 |
|
| 248 |
int trap_LAN_GetServerCount( int source ) { |
| 249 |
return syscall( UI_LAN_GETSERVERCOUNT, source ); |
| 250 |
} |
| 251 |
|
| 252 |
void trap_LAN_GetServerAddressString( int source, int n, char *buf, int buflen ) { |
| 253 |
syscall( UI_LAN_GETSERVERADDRESSSTRING, source, n, buf, buflen ); |
| 254 |
} |
| 255 |
|
| 256 |
void trap_LAN_GetServerInfo( int source, int n, char *buf, int buflen ) { |
| 257 |
syscall( UI_LAN_GETSERVERINFO, source, n, buf, buflen ); |
| 258 |
} |
| 259 |
|
| 260 |
int trap_LAN_GetServerPing( int source, int n ) { |
| 261 |
return syscall( UI_LAN_GETSERVERPING, source, n ); |
| 262 |
} |
| 263 |
|
| 264 |
int trap_LAN_GetPingQueueCount( void ) { |
| 265 |
return syscall( UI_LAN_GETPINGQUEUECOUNT ); |
| 266 |
} |
| 267 |
|
| 268 |
int trap_LAN_ServerStatus( const char *serverAddress, char *serverStatus, int maxLen ) { |
| 269 |
return syscall( UI_LAN_SERVERSTATUS, serverAddress, serverStatus, maxLen ); |
| 270 |
} |
| 271 |
|
| 272 |
void trap_LAN_SaveCachedServers( void ) { |
| 273 |
syscall( UI_LAN_SAVECACHEDSERVERS ); |
| 274 |
} |
| 275 |
|
| 276 |
void trap_LAN_LoadCachedServers( void ) { |
| 277 |
syscall( UI_LAN_LOADCACHEDSERVERS ); |
| 278 |
} |
| 279 |
|
| 280 |
void trap_LAN_ResetPings(int n) { |
| 281 |
syscall( UI_LAN_RESETPINGS, n ); |
| 282 |
} |
| 283 |
|
| 284 |
void trap_LAN_ClearPing( int n ) { |
| 285 |
syscall( UI_LAN_CLEARPING, n ); |
| 286 |
} |
| 287 |
|
| 288 |
void trap_LAN_GetPing( int n, char *buf, int buflen, int *pingtime ) { |
| 289 |
syscall( UI_LAN_GETPING, n, buf, buflen, pingtime ); |
| 290 |
} |
| 291 |
|
| 292 |
void trap_LAN_GetPingInfo( int n, char *buf, int buflen ) { |
| 293 |
syscall( UI_LAN_GETPINGINFO, n, buf, buflen ); |
| 294 |
} |
| 295 |
|
| 296 |
void trap_LAN_MarkServerVisible( int source, int n, qboolean visible ) { |
| 297 |
syscall( UI_LAN_MARKSERVERVISIBLE, source, n, visible ); |
| 298 |
} |
| 299 |
|
| 300 |
int trap_LAN_ServerIsVisible( int source, int n) { |
| 301 |
return syscall( UI_LAN_SERVERISVISIBLE, source, n ); |
| 302 |
} |
| 303 |
|
| 304 |
qboolean trap_LAN_UpdateVisiblePings( int source ) { |
| 305 |
return syscall( UI_LAN_UPDATEVISIBLEPINGS, source ); |
| 306 |
} |
| 307 |
|
| 308 |
int trap_LAN_AddServer(int source, const char *name, const char *addr) { |
| 309 |
return syscall( UI_LAN_ADDSERVER, source, name, addr ); |
| 310 |
} |
| 311 |
|
| 312 |
void trap_LAN_RemoveServer(int source, const char *addr) { |
| 313 |
syscall( UI_LAN_REMOVESERVER, source, addr ); |
| 314 |
} |
| 315 |
|
| 316 |
int trap_LAN_CompareServers( int source, int sortKey, int sortDir, int s1, int s2 ) { |
| 317 |
return syscall( UI_LAN_COMPARESERVERS, source, sortKey, sortDir, s1, s2 ); |
| 318 |
} |
| 319 |
|
| 320 |
int trap_MemoryRemaining( void ) { |
| 321 |
return syscall( UI_MEMORY_REMAINING ); |
| 322 |
} |
| 323 |
|
| 324 |
void trap_GetCDKey( char *buf, int buflen ) { |
| 325 |
syscall( UI_GET_CDKEY, buf, buflen ); |
| 326 |
} |
| 327 |
|
| 328 |
void trap_SetCDKey( char *buf ) { |
| 329 |
syscall( UI_SET_CDKEY, buf ); |
| 330 |
} |
| 331 |
|
| 332 |
int trap_PC_AddGlobalDefine( char *define ) { |
| 333 |
return syscall( UI_PC_ADD_GLOBAL_DEFINE, define ); |
| 334 |
} |
| 335 |
|
| 336 |
int trap_PC_LoadSource( const char *filename ) { |
| 337 |
return syscall( UI_PC_LOAD_SOURCE, filename ); |
| 338 |
} |
| 339 |
|
| 340 |
int trap_PC_FreeSource( int handle ) { |
| 341 |
return syscall( UI_PC_FREE_SOURCE, handle ); |
| 342 |
} |
| 343 |
|
| 344 |
int trap_PC_ReadToken( int handle, pc_token_t *pc_token ) { |
| 345 |
return syscall( UI_PC_READ_TOKEN, handle, pc_token ); |
| 346 |
} |
| 347 |
|
| 348 |
int trap_PC_SourceFileAndLine( int handle, char *filename, int *line ) { |
| 349 |
return syscall( UI_PC_SOURCE_FILE_AND_LINE, handle, filename, line ); |
| 350 |
} |
| 351 |
|
| 352 |
void trap_S_StopBackgroundTrack( void ) { |
| 353 |
syscall( UI_S_STOPBACKGROUNDTRACK ); |
| 354 |
} |
| 355 |
|
| 356 |
void trap_S_StartBackgroundTrack( const char *intro, const char *loop) { |
| 357 |
syscall( UI_S_STARTBACKGROUNDTRACK, intro, loop ); |
| 358 |
} |
| 359 |
|
| 360 |
int trap_RealTime(qtime_t *qtime) { |
| 361 |
return syscall( UI_REAL_TIME, qtime ); |
| 362 |
} |
| 363 |
|
| 364 |
|
| 365 |
int trap_CIN_PlayCinematic( const char *arg0, int xpos, int ypos, int width, int height, int bits) { |
| 366 |
return syscall(UI_CIN_PLAYCINEMATIC, arg0, xpos, ypos, width, height, bits); |
| 367 |
} |
| 368 |
|
| 369 |
|
| 370 |
|
| 371 |
e_status trap_CIN_StopCinematic(int handle) { |
| 372 |
return syscall(UI_CIN_STOPCINEMATIC, handle); |
| 373 |
} |
| 374 |
|
| 375 |
|
| 376 |
|
| 377 |
e_status trap_CIN_RunCinematic (int handle) { |
| 378 |
return syscall(UI_CIN_RUNCINEMATIC, handle); |
| 379 |
} |
| 380 |
|
| 381 |
|
| 382 |
|
| 383 |
void trap_CIN_DrawCinematic (int handle) { |
| 384 |
syscall(UI_CIN_DRAWCINEMATIC, handle); |
| 385 |
} |
| 386 |
|
| 387 |
|
| 388 |
|
| 389 |
void trap_CIN_SetExtents (int handle, int x, int y, int w, int h) { |
| 390 |
syscall(UI_CIN_SETEXTENTS, handle, x, y, w, h); |
| 391 |
} |
| 392 |
|
| 393 |
|
| 394 |
void trap_R_RemapShader( const char *oldShader, const char *newShader, const char *timeOffset ) { |
| 395 |
syscall( UI_R_REMAP_SHADER, oldShader, newShader, timeOffset ); |
| 396 |
} |
| 397 |
|
| 398 |
qboolean trap_VerifyCDKey( const char *key, const char *chksum) { |
| 399 |
return syscall( UI_VERIFY_CDKEY, key, chksum); |
| 400 |
} |
| 401 |
|
| 402 |
void trap_SetPbClStatus( int status ) { |
| 403 |
syscall( UI_SET_PBCLSTATUS, status ); |
| 404 |
} |