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