ui_local.h 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137
  1. /*
  2. ===========================================================================
  3. Copyright (C) 1999-2005 Id Software, Inc.
  4. This file is part of Quake III Arena source code.
  5. Quake III Arena source code is free software; you can redistribute it
  6. and/or modify it under the terms of the GNU General Public License as
  7. published by the Free Software Foundation; either version 2 of the License,
  8. or (at your option) any later version.
  9. Quake III Arena source code is distributed in the hope that it will be
  10. useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with Foobar; if not, write to the Free Software
  15. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  16. ===========================================================================
  17. */
  18. //
  19. #ifndef __UI_LOCAL_H__
  20. #define __UI_LOCAL_H__
  21. #include "../game/q_shared.h"
  22. #include "../cgame/tr_types.h"
  23. #include "ui_public.h"
  24. #include "keycodes.h"
  25. #include "../game/bg_public.h"
  26. #include "ui_shared.h"
  27. // global display context
  28. extern vmCvar_t ui_ffa_fraglimit;
  29. extern vmCvar_t ui_ffa_timelimit;
  30. extern vmCvar_t ui_tourney_fraglimit;
  31. extern vmCvar_t ui_tourney_timelimit;
  32. extern vmCvar_t ui_team_fraglimit;
  33. extern vmCvar_t ui_team_timelimit;
  34. extern vmCvar_t ui_team_friendly;
  35. extern vmCvar_t ui_ctf_capturelimit;
  36. extern vmCvar_t ui_ctf_timelimit;
  37. extern vmCvar_t ui_ctf_friendly;
  38. extern vmCvar_t ui_arenasFile;
  39. extern vmCvar_t ui_botsFile;
  40. extern vmCvar_t ui_spScores1;
  41. extern vmCvar_t ui_spScores2;
  42. extern vmCvar_t ui_spScores3;
  43. extern vmCvar_t ui_spScores4;
  44. extern vmCvar_t ui_spScores5;
  45. extern vmCvar_t ui_spAwards;
  46. extern vmCvar_t ui_spVideos;
  47. extern vmCvar_t ui_spSkill;
  48. extern vmCvar_t ui_spSelection;
  49. extern vmCvar_t ui_browserMaster;
  50. extern vmCvar_t ui_browserGameType;
  51. extern vmCvar_t ui_browserSortKey;
  52. extern vmCvar_t ui_browserShowFull;
  53. extern vmCvar_t ui_browserShowEmpty;
  54. extern vmCvar_t ui_brassTime;
  55. extern vmCvar_t ui_drawCrosshair;
  56. extern vmCvar_t ui_drawCrosshairNames;
  57. extern vmCvar_t ui_marks;
  58. extern vmCvar_t ui_server1;
  59. extern vmCvar_t ui_server2;
  60. extern vmCvar_t ui_server3;
  61. extern vmCvar_t ui_server4;
  62. extern vmCvar_t ui_server5;
  63. extern vmCvar_t ui_server6;
  64. extern vmCvar_t ui_server7;
  65. extern vmCvar_t ui_server8;
  66. extern vmCvar_t ui_server9;
  67. extern vmCvar_t ui_server10;
  68. extern vmCvar_t ui_server11;
  69. extern vmCvar_t ui_server12;
  70. extern vmCvar_t ui_server13;
  71. extern vmCvar_t ui_server14;
  72. extern vmCvar_t ui_server15;
  73. extern vmCvar_t ui_server16;
  74. extern vmCvar_t ui_cdkey;
  75. extern vmCvar_t ui_cdkeychecked;
  76. extern vmCvar_t ui_captureLimit;
  77. extern vmCvar_t ui_fragLimit;
  78. extern vmCvar_t ui_gameType;
  79. extern vmCvar_t ui_netGameType;
  80. extern vmCvar_t ui_actualNetGameType;
  81. extern vmCvar_t ui_joinGameType;
  82. extern vmCvar_t ui_netSource;
  83. extern vmCvar_t ui_serverFilterType;
  84. extern vmCvar_t ui_dedicated;
  85. extern vmCvar_t ui_opponentName;
  86. extern vmCvar_t ui_menuFiles;
  87. extern vmCvar_t ui_currentTier;
  88. extern vmCvar_t ui_currentMap;
  89. extern vmCvar_t ui_currentNetMap;
  90. extern vmCvar_t ui_mapIndex;
  91. extern vmCvar_t ui_currentOpponent;
  92. extern vmCvar_t ui_selectedPlayer;
  93. extern vmCvar_t ui_selectedPlayerName;
  94. extern vmCvar_t ui_lastServerRefresh_0;
  95. extern vmCvar_t ui_lastServerRefresh_1;
  96. extern vmCvar_t ui_lastServerRefresh_2;
  97. extern vmCvar_t ui_lastServerRefresh_3;
  98. extern vmCvar_t ui_singlePlayerActive;
  99. extern vmCvar_t ui_scoreAccuracy;
  100. extern vmCvar_t ui_scoreImpressives;
  101. extern vmCvar_t ui_scoreExcellents;
  102. extern vmCvar_t ui_scoreDefends;
  103. extern vmCvar_t ui_scoreAssists;
  104. extern vmCvar_t ui_scoreGauntlets;
  105. extern vmCvar_t ui_scoreScore;
  106. extern vmCvar_t ui_scorePerfect;
  107. extern vmCvar_t ui_scoreTeam;
  108. extern vmCvar_t ui_scoreBase;
  109. extern vmCvar_t ui_scoreTimeBonus;
  110. extern vmCvar_t ui_scoreSkillBonus;
  111. extern vmCvar_t ui_scoreShutoutBonus;
  112. extern vmCvar_t ui_scoreTime;
  113. extern vmCvar_t ui_smallFont;
  114. extern vmCvar_t ui_bigFont;
  115. extern vmCvar_t ui_serverStatusTimeOut;
  116. //
  117. // ui_qmenu.c
  118. //
  119. #define RCOLUMN_OFFSET ( BIGCHAR_WIDTH )
  120. #define LCOLUMN_OFFSET (-BIGCHAR_WIDTH )
  121. #define SLIDER_RANGE 10
  122. #define MAX_EDIT_LINE 256
  123. #define MAX_MENUDEPTH 8
  124. #define MAX_MENUITEMS 96
  125. #define MTYPE_NULL 0
  126. #define MTYPE_SLIDER 1
  127. #define MTYPE_ACTION 2
  128. #define MTYPE_SPINCONTROL 3
  129. #define MTYPE_FIELD 4
  130. #define MTYPE_RADIOBUTTON 5
  131. #define MTYPE_BITMAP 6
  132. #define MTYPE_TEXT 7
  133. #define MTYPE_SCROLLLIST 8
  134. #define MTYPE_PTEXT 9
  135. #define MTYPE_BTEXT 10
  136. #define QMF_BLINK 0x00000001
  137. #define QMF_SMALLFONT 0x00000002
  138. #define QMF_LEFT_JUSTIFY 0x00000004
  139. #define QMF_CENTER_JUSTIFY 0x00000008
  140. #define QMF_RIGHT_JUSTIFY 0x00000010
  141. #define QMF_NUMBERSONLY 0x00000020 // edit field is only numbers
  142. #define QMF_HIGHLIGHT 0x00000040
  143. #define QMF_HIGHLIGHT_IF_FOCUS 0x00000080 // steady focus
  144. #define QMF_PULSEIFFOCUS 0x00000100 // pulse if focus
  145. #define QMF_HASMOUSEFOCUS 0x00000200
  146. #define QMF_NOONOFFTEXT 0x00000400
  147. #define QMF_MOUSEONLY 0x00000800 // only mouse input allowed
  148. #define QMF_HIDDEN 0x00001000 // skips drawing
  149. #define QMF_GRAYED 0x00002000 // grays and disables
  150. #define QMF_INACTIVE 0x00004000 // disables any input
  151. #define QMF_NODEFAULTINIT 0x00008000 // skip default initialization
  152. #define QMF_OWNERDRAW 0x00010000
  153. #define QMF_PULSE 0x00020000
  154. #define QMF_LOWERCASE 0x00040000 // edit field is all lower case
  155. #define QMF_UPPERCASE 0x00080000 // edit field is all upper case
  156. #define QMF_SILENT 0x00100000
  157. // callback notifications
  158. #define QM_GOTFOCUS 1
  159. #define QM_LOSTFOCUS 2
  160. #define QM_ACTIVATED 3
  161. typedef struct _tag_menuframework
  162. {
  163. int cursor;
  164. int cursor_prev;
  165. int nitems;
  166. void *items[MAX_MENUITEMS];
  167. void (*draw) (void);
  168. sfxHandle_t (*key) (int key);
  169. qboolean wrapAround;
  170. qboolean fullscreen;
  171. qboolean showlogo;
  172. } menuframework_s;
  173. typedef struct
  174. {
  175. int type;
  176. const char *name;
  177. int id;
  178. int x, y;
  179. int left;
  180. int top;
  181. int right;
  182. int bottom;
  183. menuframework_s *parent;
  184. int menuPosition;
  185. unsigned flags;
  186. void (*callback)( void *self, int event );
  187. void (*statusbar)( void *self );
  188. void (*ownerdraw)( void *self );
  189. } menucommon_s;
  190. typedef struct {
  191. int cursor;
  192. int scroll;
  193. int widthInChars;
  194. char buffer[MAX_EDIT_LINE];
  195. int maxchars;
  196. } mfield_t;
  197. typedef struct
  198. {
  199. menucommon_s generic;
  200. mfield_t field;
  201. } menufield_s;
  202. typedef struct
  203. {
  204. menucommon_s generic;
  205. float minvalue;
  206. float maxvalue;
  207. float curvalue;
  208. float range;
  209. } menuslider_s;
  210. typedef struct
  211. {
  212. menucommon_s generic;
  213. int oldvalue;
  214. int curvalue;
  215. int numitems;
  216. int top;
  217. const char **itemnames;
  218. int width;
  219. int height;
  220. int columns;
  221. int seperation;
  222. } menulist_s;
  223. typedef struct
  224. {
  225. menucommon_s generic;
  226. } menuaction_s;
  227. typedef struct
  228. {
  229. menucommon_s generic;
  230. int curvalue;
  231. } menuradiobutton_s;
  232. typedef struct
  233. {
  234. menucommon_s generic;
  235. char* focuspic;
  236. char* errorpic;
  237. qhandle_t shader;
  238. qhandle_t focusshader;
  239. int width;
  240. int height;
  241. float* focuscolor;
  242. } menubitmap_s;
  243. typedef struct
  244. {
  245. menucommon_s generic;
  246. char* string;
  247. int style;
  248. float* color;
  249. } menutext_s;
  250. extern void Menu_Cache( void );
  251. extern void Menu_Focus( menucommon_s *m );
  252. extern void Menu_AddItem( menuframework_s *menu, void *item );
  253. extern void Menu_AdjustCursor( menuframework_s *menu, int dir );
  254. extern void Menu_Draw( menuframework_s *menu );
  255. extern void *Menu_ItemAtCursor( menuframework_s *m );
  256. extern sfxHandle_t Menu_ActivateItem( menuframework_s *s, menucommon_s* item );
  257. extern void Menu_SetCursor( menuframework_s *s, int cursor );
  258. extern void Menu_SetCursorToItem( menuframework_s *m, void* ptr );
  259. extern sfxHandle_t Menu_DefaultKey( menuframework_s *s, int key );
  260. extern void Bitmap_Init( menubitmap_s *b );
  261. extern void Bitmap_Draw( menubitmap_s *b );
  262. extern void ScrollList_Draw( menulist_s *l );
  263. extern sfxHandle_t ScrollList_Key( menulist_s *l, int key );
  264. extern sfxHandle_t menu_in_sound;
  265. extern sfxHandle_t menu_move_sound;
  266. extern sfxHandle_t menu_out_sound;
  267. extern sfxHandle_t menu_buzz_sound;
  268. extern sfxHandle_t menu_null_sound;
  269. extern sfxHandle_t weaponChangeSound;
  270. extern vec4_t menu_text_color;
  271. extern vec4_t menu_grayed_color;
  272. extern vec4_t menu_dark_color;
  273. extern vec4_t menu_highlight_color;
  274. extern vec4_t menu_red_color;
  275. extern vec4_t menu_black_color;
  276. extern vec4_t menu_dim_color;
  277. extern vec4_t color_black;
  278. extern vec4_t color_white;
  279. extern vec4_t color_yellow;
  280. extern vec4_t color_blue;
  281. extern vec4_t color_orange;
  282. extern vec4_t color_red;
  283. extern vec4_t color_dim;
  284. extern vec4_t name_color;
  285. extern vec4_t list_color;
  286. extern vec4_t listbar_color;
  287. extern vec4_t text_color_disabled;
  288. extern vec4_t text_color_normal;
  289. extern vec4_t text_color_highlight;
  290. extern char *ui_medalNames[];
  291. extern char *ui_medalPicNames[];
  292. extern char *ui_medalSounds[];
  293. //
  294. // ui_mfield.c
  295. //
  296. extern void MField_Clear( mfield_t *edit );
  297. extern void MField_KeyDownEvent( mfield_t *edit, int key );
  298. extern void MField_CharEvent( mfield_t *edit, int ch );
  299. extern void MField_Draw( mfield_t *edit, int x, int y, int style, vec4_t color );
  300. extern void MenuField_Init( menufield_s* m );
  301. extern void MenuField_Draw( menufield_s *f );
  302. extern sfxHandle_t MenuField_Key( menufield_s* m, int* key );
  303. //
  304. // ui_main.c
  305. //
  306. void UI_Report();
  307. void UI_Load();
  308. void UI_LoadMenus(const char *menuFile, qboolean reset);
  309. void _UI_SetActiveMenu( uiMenuCommand_t menu );
  310. int UI_AdjustTimeByGame(int time);
  311. void UI_ShowPostGame(qboolean newHigh);
  312. void UI_ClearScores();
  313. void UI_LoadArenas(void);
  314. //
  315. // ui_menu.c
  316. //
  317. extern void MainMenu_Cache( void );
  318. extern void UI_MainMenu(void);
  319. extern void UI_RegisterCvars( void );
  320. extern void UI_UpdateCvars( void );
  321. //
  322. // ui_credits.c
  323. //
  324. extern void UI_CreditMenu( void );
  325. //
  326. // ui_ingame.c
  327. //
  328. extern void InGame_Cache( void );
  329. extern void UI_InGameMenu(void);
  330. //
  331. // ui_confirm.c
  332. //
  333. extern void ConfirmMenu_Cache( void );
  334. extern void UI_ConfirmMenu( const char *question, void (*draw)( void ), void (*action)( qboolean result ) );
  335. //
  336. // ui_setup.c
  337. //
  338. extern void UI_SetupMenu_Cache( void );
  339. extern void UI_SetupMenu(void);
  340. //
  341. // ui_team.c
  342. //
  343. extern void UI_TeamMainMenu( void );
  344. extern void TeamMain_Cache( void );
  345. //
  346. // ui_connect.c
  347. //
  348. extern void UI_DrawConnectScreen( qboolean overlay );
  349. //
  350. // ui_controls2.c
  351. //
  352. extern void UI_ControlsMenu( void );
  353. extern void Controls_Cache( void );
  354. //
  355. // ui_demo2.c
  356. //
  357. extern void UI_DemosMenu( void );
  358. extern void Demos_Cache( void );
  359. //
  360. // ui_cinematics.c
  361. //
  362. extern void UI_CinematicsMenu( void );
  363. extern void UI_CinematicsMenu_f( void );
  364. extern void UI_CinematicsMenu_Cache( void );
  365. //
  366. // ui_mods.c
  367. //
  368. extern void UI_ModsMenu( void );
  369. extern void UI_ModsMenu_Cache( void );
  370. //
  371. // ui_cdkey.c
  372. //
  373. extern void UI_CDKeyMenu( void );
  374. extern void UI_CDKeyMenu_Cache( void );
  375. extern void UI_CDKeyMenu_f( void );
  376. //
  377. // ui_playermodel.c
  378. //
  379. extern void UI_PlayerModelMenu( void );
  380. extern void PlayerModel_Cache( void );
  381. //
  382. // ui_playersettings.c
  383. //
  384. extern void UI_PlayerSettingsMenu( void );
  385. extern void PlayerSettings_Cache( void );
  386. //
  387. // ui_preferences.c
  388. //
  389. extern void UI_PreferencesMenu( void );
  390. extern void Preferences_Cache( void );
  391. //
  392. // ui_specifyleague.c
  393. //
  394. extern void UI_SpecifyLeagueMenu( void );
  395. extern void SpecifyLeague_Cache( void );
  396. //
  397. // ui_specifyserver.c
  398. //
  399. extern void UI_SpecifyServerMenu( void );
  400. extern void SpecifyServer_Cache( void );
  401. //
  402. // ui_servers2.c
  403. //
  404. #define MAX_FAVORITESERVERS 16
  405. extern void UI_ArenaServersMenu( void );
  406. extern void ArenaServers_Cache( void );
  407. //
  408. // ui_startserver.c
  409. //
  410. extern void UI_StartServerMenu( qboolean multiplayer );
  411. extern void StartServer_Cache( void );
  412. extern void ServerOptions_Cache( void );
  413. extern void UI_BotSelectMenu( char *bot );
  414. extern void UI_BotSelectMenu_Cache( void );
  415. //
  416. // ui_serverinfo.c
  417. //
  418. extern void UI_ServerInfoMenu( void );
  419. extern void ServerInfo_Cache( void );
  420. //
  421. // ui_video.c
  422. //
  423. extern void UI_GraphicsOptionsMenu( void );
  424. extern void GraphicsOptions_Cache( void );
  425. extern void DriverInfo_Cache( void );
  426. //
  427. // ui_players.c
  428. //
  429. //FIXME ripped from cg_local.h
  430. typedef struct {
  431. int oldFrame;
  432. int oldFrameTime; // time when ->oldFrame was exactly on
  433. int frame;
  434. int frameTime; // time when ->frame will be exactly on
  435. float backlerp;
  436. float yawAngle;
  437. qboolean yawing;
  438. float pitchAngle;
  439. qboolean pitching;
  440. int animationNumber; // may include ANIM_TOGGLEBIT
  441. animation_t *animation;
  442. int animationTime; // time when the first frame of the animation will be exact
  443. } lerpFrame_t;
  444. typedef struct {
  445. // model info
  446. qhandle_t legsModel;
  447. qhandle_t legsSkin;
  448. lerpFrame_t legs;
  449. qhandle_t torsoModel;
  450. qhandle_t torsoSkin;
  451. lerpFrame_t torso;
  452. qhandle_t headModel;
  453. qhandle_t headSkin;
  454. animation_t animations[MAX_TOTALANIMATIONS];
  455. qhandle_t weaponModel;
  456. qhandle_t barrelModel;
  457. qhandle_t flashModel;
  458. vec3_t flashDlightColor;
  459. int muzzleFlashTime;
  460. // currently in use drawing parms
  461. vec3_t viewAngles;
  462. vec3_t moveAngles;
  463. weapon_t currentWeapon;
  464. int legsAnim;
  465. int torsoAnim;
  466. // animation vars
  467. weapon_t weapon;
  468. weapon_t lastWeapon;
  469. weapon_t pendingWeapon;
  470. int weaponTimer;
  471. int pendingLegsAnim;
  472. int torsoAnimationTimer;
  473. int pendingTorsoAnim;
  474. int legsAnimationTimer;
  475. qboolean chat;
  476. qboolean newModel;
  477. qboolean barrelSpinning;
  478. float barrelAngle;
  479. int barrelTime;
  480. int realWeapon;
  481. } playerInfo_t;
  482. void UI_DrawPlayer( float x, float y, float w, float h, playerInfo_t *pi, int time );
  483. void UI_PlayerInfo_SetModel( playerInfo_t *pi, const char *model, const char *headmodel, char *teamName );
  484. void UI_PlayerInfo_SetInfo( playerInfo_t *pi, int legsAnim, int torsoAnim, vec3_t viewAngles, vec3_t moveAngles, weapon_t weaponNum, qboolean chat );
  485. qboolean UI_RegisterClientModelname( playerInfo_t *pi, const char *modelSkinName , const char *headName, const char *teamName);
  486. //
  487. // ui_atoms.c
  488. //
  489. // this is only used in the old ui, the new ui has it's own version
  490. typedef struct {
  491. int frametime;
  492. int realtime;
  493. int cursorx;
  494. int cursory;
  495. glconfig_t glconfig;
  496. qboolean debug;
  497. qhandle_t whiteShader;
  498. qhandle_t menuBackShader;
  499. qhandle_t menuBackShader2;
  500. qhandle_t menuBackNoLogoShader;
  501. qhandle_t charset;
  502. qhandle_t charsetProp;
  503. qhandle_t charsetPropGlow;
  504. qhandle_t charsetPropB;
  505. qhandle_t cursor;
  506. qhandle_t rb_on;
  507. qhandle_t rb_off;
  508. float scale;
  509. float bias;
  510. qboolean demoversion;
  511. qboolean firstdraw;
  512. } uiStatic_t;
  513. // new ui stuff
  514. #define UI_NUMFX 7
  515. #define MAX_HEADS 64
  516. #define MAX_ALIASES 64
  517. #define MAX_HEADNAME 32
  518. #define MAX_TEAMS 64
  519. #define MAX_GAMETYPES 16
  520. #define MAX_MAPS 128
  521. #define MAX_SPMAPS 16
  522. #define PLAYERS_PER_TEAM 5
  523. #define MAX_PINGREQUESTS 32
  524. #define MAX_ADDRESSLENGTH 64
  525. #define MAX_HOSTNAMELENGTH 22
  526. #define MAX_MAPNAMELENGTH 16
  527. #define MAX_STATUSLENGTH 64
  528. #define MAX_LISTBOXWIDTH 59
  529. #define UI_FONT_THRESHOLD 0.1
  530. #define MAX_DISPLAY_SERVERS 2048
  531. #define MAX_SERVERSTATUS_LINES 128
  532. #define MAX_SERVERSTATUS_TEXT 1024
  533. #define MAX_FOUNDPLAYER_SERVERS 16
  534. #define TEAM_MEMBERS 5
  535. #define GAMES_ALL 0
  536. #define GAMES_FFA 1
  537. #define GAMES_TEAMPLAY 2
  538. #define GAMES_TOURNEY 3
  539. #define GAMES_CTF 4
  540. #define MAPS_PER_TIER 3
  541. #define MAX_TIERS 16
  542. #define MAX_MODS 64
  543. #define MAX_DEMOS 256
  544. #define MAX_MOVIES 256
  545. #define MAX_PLAYERMODELS 256
  546. typedef struct {
  547. const char *name;
  548. const char *imageName;
  549. qhandle_t headImage;
  550. const char *base;
  551. qboolean active;
  552. int reference;
  553. } characterInfo;
  554. typedef struct {
  555. const char *name;
  556. const char *ai;
  557. const char *action;
  558. } aliasInfo;
  559. typedef struct {
  560. const char *teamName;
  561. const char *imageName;
  562. const char *teamMembers[TEAM_MEMBERS];
  563. qhandle_t teamIcon;
  564. qhandle_t teamIcon_Metal;
  565. qhandle_t teamIcon_Name;
  566. int cinematic;
  567. } teamInfo;
  568. typedef struct {
  569. const char *gameType;
  570. int gtEnum;
  571. } gameTypeInfo;
  572. typedef struct {
  573. const char *mapName;
  574. const char *mapLoadName;
  575. const char *imageName;
  576. const char *opponentName;
  577. int teamMembers;
  578. int typeBits;
  579. int cinematic;
  580. int timeToBeat[MAX_GAMETYPES];
  581. qhandle_t levelShot;
  582. qboolean active;
  583. } mapInfo;
  584. typedef struct {
  585. const char *tierName;
  586. const char *maps[MAPS_PER_TIER];
  587. int gameTypes[MAPS_PER_TIER];
  588. qhandle_t mapHandles[MAPS_PER_TIER];
  589. } tierInfo;
  590. typedef struct serverFilter_s {
  591. const char *description;
  592. const char *basedir;
  593. } serverFilter_t;
  594. typedef struct {
  595. char adrstr[MAX_ADDRESSLENGTH];
  596. int start;
  597. } pinglist_t;
  598. typedef struct serverStatus_s {
  599. pinglist_t pingList[MAX_PINGREQUESTS];
  600. int numqueriedservers;
  601. int currentping;
  602. int nextpingtime;
  603. int maxservers;
  604. int refreshtime;
  605. int numServers;
  606. int sortKey;
  607. int sortDir;
  608. int lastCount;
  609. qboolean refreshActive;
  610. int currentServer;
  611. int displayServers[MAX_DISPLAY_SERVERS];
  612. int numDisplayServers;
  613. int numPlayersOnServers;
  614. int nextDisplayRefresh;
  615. int nextSortTime;
  616. qhandle_t currentServerPreview;
  617. int currentServerCinematic;
  618. int motdLen;
  619. int motdWidth;
  620. int motdPaintX;
  621. int motdPaintX2;
  622. int motdOffset;
  623. int motdTime;
  624. char motd[MAX_STRING_CHARS];
  625. } serverStatus_t;
  626. typedef struct {
  627. char adrstr[MAX_ADDRESSLENGTH];
  628. char name[MAX_ADDRESSLENGTH];
  629. int startTime;
  630. int serverNum;
  631. qboolean valid;
  632. } pendingServer_t;
  633. typedef struct {
  634. int num;
  635. pendingServer_t server[MAX_SERVERSTATUSREQUESTS];
  636. } pendingServerStatus_t;
  637. typedef struct {
  638. char address[MAX_ADDRESSLENGTH];
  639. char *lines[MAX_SERVERSTATUS_LINES][4];
  640. char text[MAX_SERVERSTATUS_TEXT];
  641. char pings[MAX_CLIENTS * 3];
  642. int numLines;
  643. } serverStatusInfo_t;
  644. typedef struct {
  645. const char *modName;
  646. const char *modDescr;
  647. } modInfo_t;
  648. typedef struct {
  649. displayContextDef_t uiDC;
  650. int newHighScoreTime;
  651. int newBestTime;
  652. int showPostGameTime;
  653. qboolean newHighScore;
  654. qboolean demoAvailable;
  655. qboolean soundHighScore;
  656. int characterCount;
  657. int botIndex;
  658. characterInfo characterList[MAX_HEADS];
  659. int aliasCount;
  660. aliasInfo aliasList[MAX_ALIASES];
  661. int teamCount;
  662. teamInfo teamList[MAX_TEAMS];
  663. int numGameTypes;
  664. gameTypeInfo gameTypes[MAX_GAMETYPES];
  665. int numJoinGameTypes;
  666. gameTypeInfo joinGameTypes[MAX_GAMETYPES];
  667. int redBlue;
  668. int playerCount;
  669. int myTeamCount;
  670. int teamIndex;
  671. int playerRefresh;
  672. int playerIndex;
  673. int playerNumber;
  674. qboolean teamLeader;
  675. char playerNames[MAX_CLIENTS][MAX_NAME_LENGTH];
  676. char teamNames[MAX_CLIENTS][MAX_NAME_LENGTH];
  677. int teamClientNums[MAX_CLIENTS];
  678. int mapCount;
  679. mapInfo mapList[MAX_MAPS];
  680. int tierCount;
  681. tierInfo tierList[MAX_TIERS];
  682. int skillIndex;
  683. modInfo_t modList[MAX_MODS];
  684. int modCount;
  685. int modIndex;
  686. const char *demoList[MAX_DEMOS];
  687. int demoCount;
  688. int demoIndex;
  689. const char *movieList[MAX_MOVIES];
  690. int movieCount;
  691. int movieIndex;
  692. int previewMovie;
  693. serverStatus_t serverStatus;
  694. // for the showing the status of a server
  695. char serverStatusAddress[MAX_ADDRESSLENGTH];
  696. serverStatusInfo_t serverStatusInfo;
  697. int nextServerStatusRefresh;
  698. // to retrieve the status of server to find a player
  699. pendingServerStatus_t pendingServerStatus;
  700. char findPlayerName[MAX_STRING_CHARS];
  701. char foundPlayerServerAddresses[MAX_FOUNDPLAYER_SERVERS][MAX_ADDRESSLENGTH];
  702. char foundPlayerServerNames[MAX_FOUNDPLAYER_SERVERS][MAX_ADDRESSLENGTH];
  703. int currentFoundPlayerServer;
  704. int numFoundPlayerServers;
  705. int nextFindPlayerRefresh;
  706. int currentCrosshair;
  707. int startPostGameTime;
  708. sfxHandle_t newHighScoreSound;
  709. int q3HeadCount;
  710. char q3HeadNames[MAX_PLAYERMODELS][64];
  711. qhandle_t q3HeadIcons[MAX_PLAYERMODELS];
  712. int q3SelectedHead;
  713. int effectsColor;
  714. qboolean inGameLoad;
  715. } uiInfo_t;
  716. extern uiInfo_t uiInfo;
  717. extern void UI_Init( void );
  718. extern void UI_Shutdown( void );
  719. extern void UI_KeyEvent( int key );
  720. extern void UI_MouseEvent( int dx, int dy );
  721. extern void UI_Refresh( int realtime );
  722. extern qboolean UI_ConsoleCommand( int realTime );
  723. extern float UI_ClampCvar( float min, float max, float value );
  724. extern void UI_DrawNamedPic( float x, float y, float width, float height, const char *picname );
  725. extern void UI_DrawHandlePic( float x, float y, float w, float h, qhandle_t hShader );
  726. extern void UI_FillRect( float x, float y, float width, float height, const float *color );
  727. extern void UI_DrawRect( float x, float y, float width, float height, const float *color );
  728. extern void UI_DrawTopBottom(float x, float y, float w, float h);
  729. extern void UI_DrawSides(float x, float y, float w, float h);
  730. extern void UI_UpdateScreen( void );
  731. extern void UI_SetColor( const float *rgba );
  732. extern void UI_LerpColor(vec4_t a, vec4_t b, vec4_t c, float t);
  733. extern void UI_DrawBannerString( int x, int y, const char* str, int style, vec4_t color );
  734. extern float UI_ProportionalSizeScale( int style );
  735. extern void UI_DrawProportionalString( int x, int y, const char* str, int style, vec4_t color );
  736. extern int UI_ProportionalStringWidth( const char* str );
  737. extern void UI_DrawString( int x, int y, const char* str, int style, vec4_t color );
  738. extern void UI_DrawChar( int x, int y, int ch, int style, vec4_t color );
  739. extern qboolean UI_CursorInRect (int x, int y, int width, int height);
  740. extern void UI_AdjustFrom640( float *x, float *y, float *w, float *h );
  741. extern void UI_DrawTextBox (int x, int y, int width, int lines);
  742. extern qboolean UI_IsFullscreen( void );
  743. extern void UI_SetActiveMenu( uiMenuCommand_t menu );
  744. extern void UI_PushMenu ( menuframework_s *menu );
  745. extern void UI_PopMenu (void);
  746. extern void UI_ForceMenuOff (void);
  747. extern char *UI_Argv( int arg );
  748. extern char *UI_Cvar_VariableString( const char *var_name );
  749. extern void UI_Refresh( int time );
  750. extern void UI_KeyEvent( int key );
  751. extern void UI_StartDemoLoop( void );
  752. extern qboolean m_entersound;
  753. void UI_LoadBestScores(const char *map, int game);
  754. extern uiStatic_t uis;
  755. //
  756. // ui_spLevel.c
  757. //
  758. void UI_SPLevelMenu_Cache( void );
  759. void UI_SPLevelMenu( void );
  760. void UI_SPLevelMenu_f( void );
  761. void UI_SPLevelMenu_ReInit( void );
  762. //
  763. // ui_spArena.c
  764. //
  765. void UI_SPArena_Start( const char *arenaInfo );
  766. //
  767. // ui_spPostgame.c
  768. //
  769. void UI_SPPostgameMenu_Cache( void );
  770. void UI_SPPostgameMenu_f( void );
  771. //
  772. // ui_spSkill.c
  773. //
  774. void UI_SPSkillMenu( const char *arenaInfo );
  775. void UI_SPSkillMenu_Cache( void );
  776. //
  777. // ui_syscalls.c
  778. //
  779. void trap_Print( const char *string );
  780. void trap_Error( const char *string );
  781. int trap_Milliseconds( void );
  782. void trap_Cvar_Register( vmCvar_t *vmCvar, const char *varName, const char *defaultValue, int flags );
  783. void trap_Cvar_Update( vmCvar_t *vmCvar );
  784. void trap_Cvar_Set( const char *var_name, const char *value );
  785. float trap_Cvar_VariableValue( const char *var_name );
  786. void trap_Cvar_VariableStringBuffer( const char *var_name, char *buffer, int bufsize );
  787. void trap_Cvar_SetValue( const char *var_name, float value );
  788. void trap_Cvar_Reset( const char *name );
  789. void trap_Cvar_Create( const char *var_name, const char *var_value, int flags );
  790. void trap_Cvar_InfoStringBuffer( int bit, char *buffer, int bufsize );
  791. int trap_Argc( void );
  792. void trap_Argv( int n, char *buffer, int bufferLength );
  793. void trap_Cmd_ExecuteText( int exec_when, const char *text ); // don't use EXEC_NOW!
  794. int trap_FS_FOpenFile( const char *qpath, fileHandle_t *f, fsMode_t mode );
  795. void trap_FS_Read( void *buffer, int len, fileHandle_t f );
  796. void trap_FS_Write( const void *buffer, int len, fileHandle_t f );
  797. void trap_FS_FCloseFile( fileHandle_t f );
  798. int trap_FS_GetFileList( const char *path, const char *extension, char *listbuf, int bufsize );
  799. int trap_FS_Seek( fileHandle_t f, long offset, int origin ); // fsOrigin_t
  800. qhandle_t trap_R_RegisterModel( const char *name );
  801. qhandle_t trap_R_RegisterSkin( const char *name );
  802. qhandle_t trap_R_RegisterShaderNoMip( const char *name );
  803. void trap_R_ClearScene( void );
  804. void trap_R_AddRefEntityToScene( const refEntity_t *re );
  805. void trap_R_AddPolyToScene( qhandle_t hShader , int numVerts, const polyVert_t *verts );
  806. void trap_R_AddLightToScene( const vec3_t org, float intensity, float r, float g, float b );
  807. void trap_R_RenderScene( const refdef_t *fd );
  808. void trap_R_SetColor( const float *rgba );
  809. void trap_R_DrawStretchPic( float x, float y, float w, float h, float s1, float t1, float s2, float t2, qhandle_t hShader );
  810. void trap_R_ModelBounds( clipHandle_t model, vec3_t mins, vec3_t maxs );
  811. void trap_UpdateScreen( void );
  812. int trap_CM_LerpTag( orientation_t *tag, clipHandle_t mod, int startFrame, int endFrame, float frac, const char *tagName );
  813. void trap_S_StartLocalSound( sfxHandle_t sfx, int channelNum );
  814. sfxHandle_t trap_S_RegisterSound( const char *sample, qboolean compressed );
  815. void trap_Key_KeynumToStringBuf( int keynum, char *buf, int buflen );
  816. void trap_Key_GetBindingBuf( int keynum, char *buf, int buflen );
  817. void trap_Key_SetBinding( int keynum, const char *binding );
  818. qboolean trap_Key_IsDown( int keynum );
  819. qboolean trap_Key_GetOverstrikeMode( void );
  820. void trap_Key_SetOverstrikeMode( qboolean state );
  821. void trap_Key_ClearStates( void );
  822. int trap_Key_GetCatcher( void );
  823. void trap_Key_SetCatcher( int catcher );
  824. void trap_GetClipboardData( char *buf, int bufsize );
  825. void trap_GetClientState( uiClientState_t *state );
  826. void trap_GetGlconfig( glconfig_t *glconfig );
  827. int trap_GetConfigString( int index, char* buff, int buffsize );
  828. int trap_LAN_GetServerCount( int source );
  829. void trap_LAN_GetServerAddressString( int source, int n, char *buf, int buflen );
  830. void trap_LAN_GetServerInfo( int source, int n, char *buf, int buflen );
  831. int trap_LAN_GetServerPing( int source, int n );
  832. int trap_LAN_GetPingQueueCount( void );
  833. void trap_LAN_ClearPing( int n );
  834. void trap_LAN_GetPing( int n, char *buf, int buflen, int *pingtime );
  835. void trap_LAN_GetPingInfo( int n, char *buf, int buflen );
  836. void trap_LAN_LoadCachedServers();
  837. void trap_LAN_SaveCachedServers();
  838. void trap_LAN_MarkServerVisible(int source, int n, qboolean visible);
  839. int trap_LAN_ServerIsVisible( int source, int n);
  840. qboolean trap_LAN_UpdateVisiblePings( int source );
  841. int trap_LAN_AddServer(int source, const char *name, const char *addr);
  842. void trap_LAN_RemoveServer(int source, const char *addr);
  843. void trap_LAN_ResetPings(int n);
  844. int trap_LAN_ServerStatus( const char *serverAddress, char *serverStatus, int maxLen );
  845. int trap_LAN_CompareServers( int source, int sortKey, int sortDir, int s1, int s2 );
  846. int trap_MemoryRemaining( void );
  847. void trap_GetCDKey( char *buf, int buflen );
  848. void trap_SetCDKey( char *buf );
  849. void trap_R_RegisterFont(const char *pFontname, int pointSize, fontInfo_t *font);
  850. void trap_S_StopBackgroundTrack( void );
  851. void trap_S_StartBackgroundTrack( const char *intro, const char *loop);
  852. int trap_CIN_PlayCinematic( const char *arg0, int xpos, int ypos, int width, int height, int bits);
  853. e_status trap_CIN_StopCinematic(int handle);
  854. e_status trap_CIN_RunCinematic (int handle);
  855. void trap_CIN_DrawCinematic (int handle);
  856. void trap_CIN_SetExtents (int handle, int x, int y, int w, int h);
  857. int trap_RealTime(qtime_t *qtime);
  858. void trap_R_RemapShader( const char *oldShader, const char *newShader, const char *timeOffset );
  859. qboolean trap_VerifyCDKey( const char *key, const char *chksum);
  860. void trap_SetPbClStatus( int status );
  861. //
  862. // ui_addbots.c
  863. //
  864. void UI_AddBots_Cache( void );
  865. void UI_AddBotsMenu( void );
  866. //
  867. // ui_removebots.c
  868. //
  869. void UI_RemoveBots_Cache( void );
  870. void UI_RemoveBotsMenu( void );
  871. //
  872. // ui_teamorders.c
  873. //
  874. extern void UI_TeamOrdersMenu( void );
  875. extern void UI_TeamOrdersMenu_f( void );
  876. extern void UI_TeamOrdersMenu_Cache( void );
  877. //
  878. // ui_loadconfig.c
  879. //
  880. void UI_LoadConfig_Cache( void );
  881. void UI_LoadConfigMenu( void );
  882. //
  883. // ui_saveconfig.c
  884. //
  885. void UI_SaveConfigMenu_Cache( void );
  886. void UI_SaveConfigMenu( void );
  887. //
  888. // ui_display.c
  889. //
  890. void UI_DisplayOptionsMenu_Cache( void );
  891. void UI_DisplayOptionsMenu( void );
  892. //
  893. // ui_sound.c
  894. //
  895. void UI_SoundOptionsMenu_Cache( void );
  896. void UI_SoundOptionsMenu( void );
  897. //
  898. // ui_network.c
  899. //
  900. void UI_NetworkOptionsMenu_Cache( void );
  901. void UI_NetworkOptionsMenu( void );
  902. //
  903. // ui_gameinfo.c
  904. //
  905. typedef enum {
  906. AWARD_ACCURACY,
  907. AWARD_IMPRESSIVE,
  908. AWARD_EXCELLENT,
  909. AWARD_GAUNTLET,
  910. AWARD_FRAGS,
  911. AWARD_PERFECT
  912. } awardType_t;
  913. const char *UI_GetArenaInfoByNumber( int num );
  914. const char *UI_GetArenaInfoByMap( const char *map );
  915. const char *UI_GetSpecialArenaInfo( const char *tag );
  916. int UI_GetNumArenas( void );
  917. int UI_GetNumSPArenas( void );
  918. int UI_GetNumSPTiers( void );
  919. char *UI_GetBotInfoByNumber( int num );
  920. char *UI_GetBotInfoByName( const char *name );
  921. int UI_GetNumBots( void );
  922. void UI_LoadBots( void );
  923. char *UI_GetBotNameByNumber( int num );
  924. void UI_GetBestScore( int level, int *score, int *skill );
  925. void UI_SetBestScore( int level, int score );
  926. int UI_TierCompleted( int levelWon );
  927. qboolean UI_ShowTierVideo( int tier );
  928. qboolean UI_CanShowTierVideo( int tier );
  929. int UI_GetCurrentGame( void );
  930. void UI_NewGame( void );
  931. void UI_LogAwardData( int award, int data );
  932. int UI_GetAwardLevel( int award );
  933. void UI_SPUnlock_f( void );
  934. void UI_SPUnlockMedals_f( void );
  935. void UI_InitGameinfo( void );
  936. //
  937. // ui_login.c
  938. //
  939. void Login_Cache( void );
  940. void UI_LoginMenu( void );
  941. //
  942. // ui_signup.c
  943. //
  944. void Signup_Cache( void );
  945. void UI_SignupMenu( void );
  946. //
  947. // ui_rankstatus.c
  948. //
  949. void RankStatus_Cache( void );
  950. void UI_RankStatusMenu( void );
  951. // new ui
  952. #define ASSET_BACKGROUND "uiBackground"
  953. // for tracking sp game info in Team Arena
  954. typedef struct postGameInfo_s {
  955. int score;
  956. int redScore;
  957. int blueScore;
  958. int perfects;
  959. int accuracy;
  960. int impressives;
  961. int excellents;
  962. int defends;
  963. int assists;
  964. int gauntlets;
  965. int captures;
  966. int time;
  967. int timeBonus;
  968. int shutoutBonus;
  969. int skillBonus;
  970. int baseScore;
  971. } postGameInfo_t;
  972. #endif