ui_syscalls.cpp 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. // Copyright (C) 1999-2000 Id Software, Inc.
  2. //
  3. // leave this at the top of all UI_xxxx files for PCH reasons...
  4. //
  5. #include "../server/exe_headers.h"
  6. #include "ui_local.h"
  7. #ifdef _IMMERSION
  8. #include "../ff/ff.h"
  9. #endif // _IMMERSION
  10. // this file is only included when building a dll
  11. // syscalls.asm is included instead when building a qvm
  12. static int (*syscall)( int arg, ... ) = (int (*)( int, ...))-1;
  13. void dllEntry( int (*syscallptr)( int arg,... ) ) {
  14. syscall = syscallptr;
  15. // CG_PreInit();
  16. }
  17. inline int PASSFLOAT( float x )
  18. {
  19. float floatTemp;
  20. floatTemp = x;
  21. return *(int *)&floatTemp;
  22. }
  23. int CL_UISystemCalls( int *args );
  24. int FloatAsInt( float f );
  25. float trap_Cvar_VariableValue( const char *var_name )
  26. {
  27. int temp;
  28. // temp = syscall( UI_CVAR_VARIABLEVALUE, var_name );
  29. temp = FloatAsInt( Cvar_VariableValue(var_name) );
  30. return (*(float*)&temp);
  31. }
  32. void trap_R_ClearScene( void )
  33. {
  34. ui.R_ClearScene();
  35. }
  36. void trap_R_AddRefEntityToScene( const refEntity_t *re )
  37. {
  38. ui.R_AddRefEntityToScene(re);
  39. }
  40. void trap_R_RenderScene( const refdef_t *fd )
  41. {
  42. // syscall( UI_R_RENDERSCENE, fd );
  43. ui.R_RenderScene(fd);
  44. }
  45. void trap_R_SetColor( const float *rgba )
  46. {
  47. // syscall( UI_R_SETCOLOR, rgba );
  48. // re.SetColor( rgba );
  49. ui.R_SetColor(rgba);
  50. }
  51. void trap_R_DrawStretchPic( float x, float y, float w, float h, float s1, float t1, float s2, float t2, qhandle_t hShader )
  52. {
  53. // syscall( UI_R_DRAWSTRETCHPIC, PASSFLOAT(x), PASSFLOAT(y), PASSFLOAT(w), PASSFLOAT(h), PASSFLOAT(s1), PASSFLOAT(t1), PASSFLOAT(s2), PASSFLOAT(t2), hShader );
  54. // re.DrawStretchPic( x, y, w, h, s1, t1, s2, t2, hShader );
  55. ui.R_DrawStretchPic( x, y, w, h, s1, t1, s2, t2, hShader );
  56. }
  57. void trap_R_ModelBounds( clipHandle_t model, vec3_t mins, vec3_t maxs )
  58. {
  59. // syscall( UI_R_MODELBOUNDS, model, mins, maxs );
  60. ui.R_ModelBounds(model, mins, maxs);
  61. }
  62. void trap_S_StartLocalSound( sfxHandle_t sfx, int channelNum )
  63. {
  64. // syscall( UI_S_STARTLOCALSOUND, sfx, channelNum );
  65. S_StartLocalSound( sfx, channelNum );
  66. }
  67. void trap_S_StopSounds( void )
  68. {
  69. S_StopSounds( );
  70. }
  71. sfxHandle_t trap_S_RegisterSound( const char *sample, qboolean compressed )
  72. {
  73. return S_RegisterSound(sample);
  74. }
  75. #ifdef _IMMERSION
  76. void trap_FF_Start( ffHandle_t ff )
  77. {
  78. FF_AddForce( ff );
  79. }
  80. ffHandle_t trap_FF_Register( const char *name, int channel )
  81. {
  82. return FF_Register( name, channel, qtrue );
  83. }
  84. #endif // _IMMERSION
  85. void trap_Key_SetBinding( int keynum, const char *binding )
  86. {
  87. Key_SetBinding( keynum, binding);
  88. }
  89. qboolean trap_Key_GetOverstrikeMode( void )
  90. {
  91. return Key_GetOverstrikeMode();
  92. }
  93. void trap_Key_SetOverstrikeMode( qboolean state )
  94. {
  95. Key_SetOverstrikeMode( state );
  96. }
  97. void trap_Key_ClearStates( void )
  98. {
  99. Key_ClearStates();
  100. }
  101. int Key_GetCatcher( void );
  102. int trap_Key_GetCatcher( void )
  103. {
  104. return Key_GetCatcher();
  105. }
  106. void Key_SetCatcher( int catcher );
  107. void trap_Key_SetCatcher( int catcher )
  108. {
  109. Key_SetCatcher( catcher );
  110. }
  111. /*
  112. void trap_GetClipboardData( char *buf, int bufsize ) {
  113. syscall( UI_GETCLIPBOARDDATA, buf, bufsize );
  114. }
  115. void trap_GetClientState( uiClientState_t *state ) {
  116. syscall( UI_GETCLIENTSTATE, state );
  117. }
  118. */
  119. void CL_GetGlconfig( glconfig_t *glconfig );
  120. void trap_GetGlconfig( glconfig_t *glconfig )
  121. {
  122. // syscall( UI_GETGLCONFIG, glconfig );
  123. CL_GetGlconfig( glconfig );
  124. }
  125. #ifndef _XBOX
  126. // this returns a handle. arg0 is the name in the format "idlogo.roq", set arg1 to NULL, alteredstates to qfalse (do not alter gamestate)
  127. int trap_CIN_PlayCinematic( const char *arg0, int xpos, int ypos, int width, int height, int bits, const char *psAudioFile) {
  128. return syscall(UI_CIN_PLAYCINEMATIC, arg0, xpos, ypos, width, height, bits, psAudioFile);
  129. }
  130. #endif
  131. // stops playing the cinematic and ends it. should always return FMV_EOF
  132. // cinematics must be stopped in reverse order of when they are started
  133. int trap_CIN_StopCinematic(int handle)
  134. {
  135. return syscall(UI_CIN_STOPCINEMATIC, handle);
  136. }