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