ui_public.h 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. #ifndef __UI_PUBLIC_H__
  2. #define __UI_PUBLIC_H__
  3. #include "../client/keycodes.h"
  4. #define UI_API_VERSION 3
  5. typedef struct {
  6. //============== general Quake services ==================
  7. // print message on the local console
  8. void (*Printf)( const char *fmt, ... );
  9. // abort the game
  10. void (*Error)( int level, const char *fmt, ... );
  11. // console variable interaction
  12. void (*Cvar_Set)( const char *name, const char *value );
  13. float (*Cvar_VariableValue)( const char *var_name );
  14. void (*Cvar_VariableStringBuffer)( const char *var_name, char *buffer, int bufsize );
  15. void (*Cvar_SetValue)( const char *var_name, float value );
  16. void (*Cvar_Reset)( const char *name );
  17. void (*Cvar_Create)( const char *var_name, const char *var_value, int flags );
  18. void (*Cvar_InfoStringBuffer)( int bit, char *buffer, int bufsize );
  19. // console command interaction
  20. int (*Argc)( void );
  21. void (*Argv)( int n, char *buffer, int bufferLength );
  22. void (*Cmd_ExecuteText)( int exec_when, const char *text );
  23. void (*Cmd_TokenizeString)( const char *text );
  24. // filesystem access
  25. int (*FS_FOpenFile)( const char *qpath, fileHandle_t *file, fsMode_t mode );
  26. int (*FS_Read)( void *buffer, int len, fileHandle_t f );
  27. int (*FS_Write)( const void *buffer, int len, fileHandle_t f );
  28. void (*FS_FCloseFile)( fileHandle_t f );
  29. int (*FS_GetFileList)( const char *path, const char *extension, char *listbuf, int bufsize );
  30. int (*FS_ReadFile)( const char *name, void **buf );
  31. void (*FS_FreeFile)( void *buf );
  32. // =========== renderer function calls ================
  33. qhandle_t (*R_RegisterModel)( const char *name ); // returns rgb axis if not found
  34. qhandle_t (*R_RegisterSkin)( const char *name ); // returns all white if not found
  35. qhandle_t (*R_RegisterShader)( const char *name ); // returns white if not found
  36. qhandle_t (*R_RegisterShaderNoMip)( const char *name ); // returns white if not found
  37. qhandle_t (*R_RegisterFont)( const char *name ); // returns 0 for bad font
  38. #ifdef _XBOX // No default arguments on function pointers
  39. int R_Font_StrLenPixels(const char *text, const int setIndex, const float scale = 1.0f)
  40. {
  41. return RE_Font_StrLenPixels(text, setIndex, scale);
  42. }
  43. int R_Font_HeightPixels(const int setIndex, const float scale = 1.0f)
  44. {
  45. return RE_Font_HeightPixels(setIndex, scale);
  46. }
  47. void R_Font_DrawString(int ox, int oy, const char *text, const float *rgba, const int setIndex, int iMaxPixelWidth, const float scale = 1.0f)
  48. {
  49. RE_Font_DrawString(ox, oy, text, rgba, setIndex, iMaxPixelWidth, scale);
  50. }
  51. #else
  52. int (*R_Font_StrLenPixels)(const char *text, const int setIndex, const float scale = 1.0f);
  53. int (*R_Font_HeightPixels)(const int setIndex, const float scale = 1.0f);
  54. void (*R_Font_DrawString)(int ox, int oy, const char *text, const float *rgba, const int setIndex, int iMaxPixelWidth, const float scale = 1.0f);
  55. #endif
  56. int (*R_Font_StrLenChars)(const char *text);
  57. qboolean (*Language_IsAsian) (void);
  58. qboolean (*Language_UsesSpaces) (void);
  59. unsigned int (*AnyLanguage_ReadCharFromString)( const char *psText, int *piAdvanceCount, qboolean *pbIsTrailingPunctuation /* = NULL */);
  60. // a scene is built up by calls to R_ClearScene and the various R_Add functions.
  61. // Nothing is drawn until R_RenderScene is called.
  62. void (*R_ClearScene)( void );
  63. void (*R_AddRefEntityToScene)( const refEntity_t *re );
  64. void (*R_AddPolyToScene)( qhandle_t hShader , int numVerts, const polyVert_t *verts );
  65. void (*R_AddLightToScene)( const vec3_t org, float intensity, float r, float g, float b );
  66. void (*R_RenderScene)( const refdef_t *fd );
  67. void (*R_ModelBounds)( qhandle_t handle, vec3_t mins, vec3_t maxs );
  68. void (*R_SetColor)( const float *rgba ); // NULL = 1,1,1,1
  69. void (*R_DrawStretchPic) ( float x, float y, float w, float h, float s1, float t1, float s2, float t2, qhandle_t hShader ); // 0 = white
  70. void (*R_ScissorPic) ( float x, float y, float w, float h, float s1, float t1, float s2, float t2, qhandle_t hShader ); // 0 = white
  71. // force a screen update, only used during gamestate load
  72. void (*UpdateScreen)( void );
  73. // stuff for savegame screenshots...
  74. #ifdef _XBOX
  75. void (*PrecacheScreenshot)( void );
  76. #endif
  77. //========= model collision ===============
  78. // R_LerpTag is only valid for md3 models
  79. void (*R_LerpTag)( orientation_t *tag, clipHandle_t mod, int startFrame, int endFrame,
  80. float frac, const char *tagName );
  81. // =========== sound function calls ===============
  82. void (*S_StartLocalSound)( sfxHandle_t sfxHandle, int channelNum );
  83. sfxHandle_t (*S_RegisterSound)( const char* name);
  84. void (*S_StartLocalLoopingSound)( sfxHandle_t sfxHandle);
  85. void (*S_StopSounds)( void );
  86. // =========== getting save game picture ===============
  87. void (*DrawStretchRaw) (int x, int y, int w, int h, int cols, int rows, const byte *data, int client, qboolean dirty);
  88. //qboolean(*SG_GetSaveImage)( const char *psPathlessBaseName, void *pvAddress );
  89. int (*SG_GetSaveGameComment)(const char *psPathlessBaseName, char *sComment, char *sMapName);
  90. qboolean (*SG_GameAllowedToSaveHere)(qboolean inCamera);
  91. void (*SG_StoreSaveGameComment)(const char *sComment);
  92. //byte *(*SCR_GetScreenshot)(qboolean *);
  93. // =========== data shared with the client system =============
  94. // keyboard and key binding interaction
  95. void (*Key_KeynumToStringBuf)( int keynum, char *buf, int buflen );
  96. void (*Key_GetBindingBuf)( int keynum, char *buf, int buflen );
  97. void (*Key_SetBinding)( int keynum, const char *binding );
  98. qboolean (*Key_IsDown)( int keynum );
  99. qboolean (*Key_GetOverstrikeMode)( void );
  100. void (*Key_SetOverstrikeMode)( qboolean state );
  101. void (*Key_ClearStates)( void );
  102. int (*Key_GetCatcher)( void );
  103. void (*Key_SetCatcher)( int catcher );
  104. void (*GetClipboardData)( char *buf, int bufsize );
  105. void (*GetGlconfig)( glconfig_t *config );
  106. connstate_t (*GetClientState)( void );
  107. void (*GetConfigString)( int index, char* buff, int buffsize );
  108. int (*Milliseconds)( void );
  109. void (*Draw_DataPad)(int HUDType);
  110. } uiimport_t;
  111. typedef enum {
  112. DP_HUD=0,
  113. DP_OBJECTIVES,
  114. DP_WEAPONS,
  115. DP_INVENTORY,
  116. DP_FORCEPOWERS
  117. }dpTypes_t;
  118. typedef enum {
  119. UI_ERROR,
  120. UI_PRINT,
  121. UI_MILLISECONDS,
  122. UI_CVAR_SET,
  123. UI_CVAR_VARIABLEVALUE,
  124. UI_CVAR_VARIABLESTRINGBUFFER,
  125. UI_CVAR_SETVALUE,
  126. UI_CVAR_RESET,
  127. UI_CVAR_CREATE,
  128. UI_CVAR_INFOSTRINGBUFFER,
  129. UI_ARGC, // 10
  130. UI_ARGV,
  131. UI_CMD_EXECUTETEXT,
  132. UI_FS_FOPENFILE,
  133. UI_FS_READ,
  134. UI_FS_WRITE,
  135. UI_FS_FCLOSEFILE,
  136. UI_FS_GETFILELIST,
  137. UI_R_REGISTERMODEL,
  138. UI_R_REGISTERSKIN,
  139. UI_R_REGISTERSHADERNOMIP, // 20
  140. UI_R_CLEARSCENE,
  141. UI_R_ADDREFENTITYTOSCENE,
  142. UI_R_ADDPOLYTOSCENE,
  143. UI_R_ADDLIGHTTOSCENE,
  144. UI_R_RENDERSCENE,
  145. UI_R_SETCOLOR,
  146. UI_R_DRAWSTRETCHPIC,
  147. UI_UPDATESCREEN,
  148. UI_CM_LERPTAG,
  149. UI_CM_LOADMODEL, // 30
  150. UI_S_REGISTERSOUND,
  151. UI_S_STARTLOCALSOUND,
  152. UI_KEY_KEYNUMTOSTRINGBUF,
  153. UI_KEY_GETBINDINGBUF,
  154. UI_KEY_SETBINDING,
  155. UI_KEY_ISDOWN,
  156. UI_KEY_GETOVERSTRIKEMODE,
  157. UI_KEY_SETOVERSTRIKEMODE,
  158. UI_KEY_CLEARSTATES,
  159. UI_KEY_GETCATCHER, // 40
  160. UI_KEY_SETCATCHER,
  161. UI_GETCLIPBOARDDATA,
  162. UI_GETGLCONFIG,
  163. UI_GETCLIENTSTATE,
  164. UI_GETCONFIGSTRING,
  165. UI_LAN_GETPINGQUEUECOUNT,
  166. UI_LAN_CLEARPING,
  167. UI_LAN_GETPING,
  168. UI_LAN_GETPINGINFO,
  169. UI_CVAR_REGISTER, // 50
  170. UI_CVAR_UPDATE,
  171. UI_MEMORY_REMAINING,
  172. UI_GET_CDKEY,
  173. UI_SET_CDKEY,
  174. UI_R_REGISTERFONT,
  175. UI_R_MODELBOUNDS,
  176. UI_PC_ADD_GLOBAL_DEFINE,
  177. UI_PC_LOAD_SOURCE,
  178. UI_PC_FREE_SOURCE,
  179. UI_PC_READ_TOKEN, // 60
  180. UI_PC_SOURCE_FILE_AND_LINE,
  181. UI_S_STOPBACKGROUNDTRACK,
  182. UI_S_STARTBACKGROUNDTRACK,
  183. UI_REAL_TIME,
  184. UI_LAN_GETSERVERCOUNT,
  185. UI_LAN_GETSERVERADDRESSSTRING,
  186. UI_LAN_GETSERVERINFO,
  187. UI_LAN_MARKSERVERVISIBLE,
  188. UI_LAN_UPDATEVISIBLEPINGS,
  189. UI_LAN_RESETPINGS, // 70
  190. UI_LAN_LOADCACHEDSERVERS,
  191. UI_LAN_SAVECACHEDSERVERS,
  192. UI_LAN_ADDSERVER,
  193. UI_LAN_REMOVESERVER,
  194. UI_CIN_PLAYCINEMATIC,
  195. UI_CIN_STOPCINEMATIC,
  196. UI_CIN_RUNCINEMATIC,
  197. UI_CIN_DRAWCINEMATIC,
  198. UI_CIN_SETEXTENTS,
  199. UI_R_REMAP_SHADER, // 80
  200. UI_VERIFY_CDKEY,
  201. UI_LAN_SERVERSTATUS,
  202. UI_LAN_GETSERVERPING,
  203. UI_LAN_SERVERISVISIBLE,
  204. UI_LAN_COMPARESERVERS,
  205. UI_MEMSET = 100,
  206. UI_MEMCPY,
  207. UI_STRNCPY,
  208. UI_SIN,
  209. UI_COS,
  210. UI_ATAN2,
  211. UI_SQRT,
  212. UI_FLOOR,
  213. UI_CEIL
  214. } uiImport_t;
  215. #endif