Debian Codegraph @

code/ui/ui_local.h

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