mirror of
https://github.com/UberGames/RPG-X2.git
synced 2024-11-16 01:41:34 +00:00
261 lines
7 KiB
C
261 lines
7 KiB
C
// Copyright (C) 1999-2000 Id Software, Inc.
|
|
//
|
|
#include "ui_local.h"
|
|
|
|
// this file is only included when building a dll
|
|
// syscalls.asm is included instead when building a qvm
|
|
|
|
//TiM | Hack coz VC 6 can't understand Thilo's defnitions :S
|
|
//typedef int intptr_t;
|
|
|
|
static intptr_t (QDECL *syscall)( intptr_t arg, ... ) = (intptr_t (QDECL *)( intptr_t, ...))-1;
|
|
|
|
void dllEntry( intptr_t (QDECL *syscallptr)( intptr_t arg,... ) ) {
|
|
syscall = syscallptr;
|
|
}
|
|
|
|
/*static int (QDECL *syscall)( int arg, ... ) = (int (QDECL *)( int, ...))-1;
|
|
|
|
void dllEntry( int (QDECL *syscallptr)( int arg,... ) ) {
|
|
syscall = syscallptr;
|
|
}*/
|
|
|
|
int PASSFLOAT( float x ) {
|
|
float floatTemp;
|
|
floatTemp = x;
|
|
return *(int *)&floatTemp;
|
|
}
|
|
|
|
void trap_Print( const char *string ) {
|
|
syscall( UI_PRINT, string );
|
|
}
|
|
|
|
void trap_Error( const char *string ) {
|
|
syscall( UI_ERROR, string );
|
|
}
|
|
|
|
int trap_Milliseconds( void ) {
|
|
return syscall( UI_MILLISECONDS );
|
|
}
|
|
|
|
void trap_Cvar_Register( vmCvar_t *cvar, const char *var_name, const char *value, int flags ) {
|
|
syscall( UI_CVAR_REGISTER, cvar, var_name, value, flags );
|
|
}
|
|
|
|
void trap_Cvar_Update( vmCvar_t *cvar ) {
|
|
syscall( UI_CVAR_UPDATE, cvar );
|
|
}
|
|
|
|
void trap_Cvar_Set( const char *var_name, const char *value ) {
|
|
syscall( UI_CVAR_SET, var_name, value );
|
|
}
|
|
|
|
float trap_Cvar_VariableValue( const char *var_name ) {
|
|
int temp;
|
|
temp = syscall( UI_CVAR_VARIABLEVALUE, var_name );
|
|
return (*(float*)&temp);
|
|
}
|
|
|
|
void trap_Cvar_VariableStringBuffer( const char *var_name, char *buffer, int bufsize ) {
|
|
syscall( UI_CVAR_VARIABLESTRINGBUFFER, var_name, buffer, bufsize );
|
|
}
|
|
|
|
void trap_Cvar_SetValue( const char *var_name, float value ) {
|
|
syscall( UI_CVAR_SETVALUE, var_name, PASSFLOAT( value ) );
|
|
}
|
|
|
|
void trap_Cvar_Reset( const char *name ) {
|
|
syscall( UI_CVAR_RESET, name );
|
|
}
|
|
|
|
void trap_Cvar_Create( const char *var_name, const char *var_value, int flags ) {
|
|
syscall( UI_CVAR_CREATE, var_name, var_value, flags );
|
|
}
|
|
|
|
void trap_Cvar_InfoStringBuffer( int bit, char *buffer, int bufsize ) {
|
|
syscall( UI_CVAR_INFOSTRINGBUFFER, bit, buffer, bufsize );
|
|
}
|
|
|
|
int trap_Argc( void ) {
|
|
return syscall( UI_ARGC );
|
|
}
|
|
|
|
void trap_Argv( int n, char *buffer, int bufferLength ) {
|
|
syscall( UI_ARGV, n, buffer, bufferLength );
|
|
}
|
|
|
|
void trap_Cmd_ExecuteText( int exec_when, const char *text ) {
|
|
syscall( UI_CMD_EXECUTETEXT, exec_when, text );
|
|
}
|
|
|
|
int trap_FS_FOpenFile( const char *qpath, fileHandle_t *f, fsMode_t mode ) {
|
|
return syscall( UI_FS_FOPENFILE, qpath, f, mode );
|
|
}
|
|
|
|
void trap_FS_Read( void *buffer, int len, fileHandle_t f ) {
|
|
syscall( UI_FS_READ, buffer, len, f );
|
|
}
|
|
|
|
void trap_FS_Write( const void *buffer, int len, fileHandle_t f ) {
|
|
syscall( UI_FS_WRITE, buffer, len, f );
|
|
}
|
|
|
|
void trap_FS_FCloseFile( fileHandle_t f ) {
|
|
syscall( UI_FS_FCLOSEFILE, f );
|
|
}
|
|
|
|
int trap_FS_GetFileList( const char *path, const char *extension, char *listbuf, int bufsize ) {
|
|
return syscall( UI_FS_GETFILELIST, path, extension, listbuf, bufsize );
|
|
}
|
|
|
|
qhandle_t trap_R_RegisterModel( const char *name ) {
|
|
return syscall( UI_R_REGISTERMODEL, name );
|
|
}
|
|
|
|
qhandle_t trap_R_RegisterSkin( const char *name ) {
|
|
return syscall( UI_R_REGISTERSKIN, name );
|
|
}
|
|
|
|
qhandle_t trap_R_RegisterShaderNoMip( const char *name ) {
|
|
return syscall( UI_R_REGISTERSHADERNOMIP, name );
|
|
}
|
|
|
|
void trap_R_ClearScene( void ) {
|
|
syscall( UI_R_CLEARSCENE );
|
|
}
|
|
|
|
void trap_R_AddRefEntityToScene( const refEntity_t *re ) {
|
|
syscall( UI_R_ADDREFENTITYTOSCENE, re );
|
|
}
|
|
|
|
void trap_R_AddPolyToScene( qhandle_t hShader , int numVerts, const polyVert_t *verts ) {
|
|
syscall( UI_R_ADDPOLYTOSCENE, hShader, numVerts, verts );
|
|
}
|
|
|
|
void trap_R_AddLightToScene( const vec3_t org, float intensity, float r, float g, float b ) {
|
|
syscall( UI_R_ADDLIGHTTOSCENE, org, PASSFLOAT(intensity), PASSFLOAT(r), PASSFLOAT(g), PASSFLOAT(b) );
|
|
}
|
|
|
|
void trap_R_RenderScene( const refdef_t *fd ) {
|
|
syscall( UI_R_RENDERSCENE, fd );
|
|
}
|
|
|
|
void trap_R_SetColor( const float *rgba ) {
|
|
syscall( UI_R_SETCOLOR, rgba );
|
|
}
|
|
|
|
void trap_R_DrawStretchPic( float x, float y, float w, float h, float s1, float t1, float s2, float t2, qhandle_t hShader ) {
|
|
syscall( UI_R_DRAWSTRETCHPIC, PASSFLOAT(x), PASSFLOAT(y), PASSFLOAT(w), PASSFLOAT(h), PASSFLOAT(s1), PASSFLOAT(t1), PASSFLOAT(s2), PASSFLOAT(t2), hShader );
|
|
}
|
|
|
|
void trap_UpdateScreen( void ) {
|
|
syscall( UI_UPDATESCREEN );
|
|
}
|
|
|
|
void trap_CM_LerpTag( orientation_t *tag, clipHandle_t mod, int startFrame, int endFrame, float frac, const char *tagName ) {
|
|
syscall( UI_CM_LERPTAG, tag, mod, startFrame, endFrame, PASSFLOAT(frac), tagName );
|
|
}
|
|
|
|
void trap_S_StartLocalSound( sfxHandle_t sfx, int channelNum ) {
|
|
syscall( UI_S_STARTLOCALSOUND, sfx, channelNum );
|
|
}
|
|
|
|
sfxHandle_t trap_S_RegisterSound( const char *sample ) {
|
|
return syscall( UI_S_REGISTERSOUND, sample );
|
|
}
|
|
|
|
void trap_Key_KeynumToStringBuf( int keynum, char *buf, int buflen ) {
|
|
syscall( UI_KEY_KEYNUMTOSTRINGBUF, keynum, buf, buflen );
|
|
}
|
|
|
|
void trap_Key_GetBindingBuf( int keynum, char *buf, int buflen ) {
|
|
syscall( UI_KEY_GETBINDINGBUF, keynum, buf, buflen );
|
|
}
|
|
|
|
void trap_Key_SetBinding( int keynum, const char *binding ) {
|
|
syscall( UI_KEY_SETBINDING, keynum, binding );
|
|
}
|
|
|
|
qboolean trap_Key_IsDown( int keynum ) {
|
|
return syscall( UI_KEY_ISDOWN, keynum );
|
|
}
|
|
|
|
qboolean trap_Key_GetOverstrikeMode( void ) {
|
|
return syscall( UI_KEY_GETOVERSTRIKEMODE );
|
|
}
|
|
|
|
void trap_Key_SetOverstrikeMode( qboolean state ) {
|
|
syscall( UI_KEY_SETOVERSTRIKEMODE, state );
|
|
}
|
|
|
|
void trap_Key_ClearStates( void ) {
|
|
syscall( UI_KEY_CLEARSTATES );
|
|
}
|
|
|
|
int trap_Key_GetCatcher( void ) {
|
|
return syscall( UI_KEY_GETCATCHER );
|
|
}
|
|
|
|
void trap_Key_SetCatcher( int catcher ) {
|
|
syscall( UI_KEY_SETCATCHER, catcher );
|
|
}
|
|
|
|
void trap_GetClipboardData( char *buf, int bufsize ) {
|
|
syscall( UI_GETCLIPBOARDDATA, buf, bufsize );
|
|
}
|
|
|
|
void trap_GetClientState( uiClientState_t *state ) {
|
|
syscall( UI_GETCLIENTSTATE, state );
|
|
}
|
|
|
|
void trap_GetGlconfig( glconfig_t *glconfig ) {
|
|
syscall( UI_GETGLCONFIG, glconfig );
|
|
}
|
|
|
|
int trap_GetConfigString( int index, char* buff, int buffsize ) {
|
|
return syscall( UI_GETCONFIGSTRING, index, buff, buffsize );
|
|
}
|
|
|
|
int trap_LAN_GetLocalServerCount( void ) {
|
|
return syscall( UI_LAN_GETLOCALSERVERCOUNT );
|
|
}
|
|
|
|
void trap_LAN_GetLocalServerAddressString( int n, char *buf, int buflen ) {
|
|
syscall( UI_LAN_GETLOCALSERVERADDRESSSTRING, n, buf, buflen );
|
|
}
|
|
|
|
int trap_LAN_GetGlobalServerCount( void ) {
|
|
return syscall( UI_LAN_GETGLOBALSERVERCOUNT );
|
|
}
|
|
|
|
void trap_LAN_GetGlobalServerAddressString( int n, char *buf, int buflen ) {
|
|
syscall( UI_LAN_GETGLOBALSERVERADDRESSSTRING, n, buf, buflen );
|
|
}
|
|
|
|
int trap_LAN_GetPingQueueCount( void ) {
|
|
return syscall( UI_LAN_GETPINGQUEUECOUNT );
|
|
}
|
|
|
|
void trap_LAN_ClearPing( int n ) {
|
|
syscall( UI_LAN_CLEARPING, n );
|
|
}
|
|
|
|
void trap_LAN_GetPing( int n, char *buf, int buflen, int *pingtime ) {
|
|
syscall( UI_LAN_GETPING, n, buf, buflen, pingtime );
|
|
}
|
|
|
|
void trap_LAN_GetPingInfo( int n, char *buf, int buflen ) {
|
|
syscall( UI_LAN_GETPINGINFO, n, buf, buflen );
|
|
}
|
|
|
|
int trap_MemoryRemaining( void ) {
|
|
return syscall( UI_MEMORY_REMAINING );
|
|
}
|
|
|
|
qboolean trap_SetCDKey( char *buf ) {
|
|
return syscall( UI_SET_CDKEY, buf );
|
|
}
|
|
|
|
void trap_R_ModelBounds( clipHandle_t model, vec3_t mins, vec3_t maxs ) {
|
|
syscall( UI_R_MODELBOUNDS, model, mins, maxs );
|
|
}
|