Debian Codegraph @

code/ui/ui_local.h

raw symbols SCIP
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 "../renderercommon/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 separation;
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 void UI_LoadArenasIntoMapList(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 qboolean fixedlegs; // true if legs yaw is always the same as torso yaw
538 qboolean fixedtorso; // true if torso never changes yaw
539
540 qhandle_t weaponModel;
541 qhandle_t barrelModel;
542 qhandle_t flashModel;
543 vec3_t flashDlightColor;
544 int muzzleFlashTime;
545
546 // currently in use drawing parms
547 vec3_t viewAngles;
548 vec3_t moveAngles;
549 weapon_t currentWeapon;
550 int legsAnim;
551 int torsoAnim;
552
553 // animation vars
554 weapon_t weapon;
555 weapon_t lastWeapon;
556 weapon_t pendingWeapon;
557 int weaponTimer;
558 int pendingLegsAnim;
559 int torsoAnimationTimer;
560
561 int pendingTorsoAnim;
562 int legsAnimationTimer;
563
564 qboolean chat;
565 qboolean newModel;
566
567 qboolean barrelSpinning;
568 float barrelAngle;
569 int barrelTime;
570
571 int realWeapon;
572 } playerInfo_t;
573
574 void UI_DrawPlayer( 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 its 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 menuBackNoLogoShader;
593 qhandle_t charset;
594 qhandle_t charsetProp;
595 qhandle_t charsetPropGlow;
596 qhandle_t charsetPropB;
597 qhandle_t cursor;
598 qhandle_t rb_on;
599 qhandle_t rb_off;
600 float scale;
601 float bias;
602 qboolean demoversion;
603 qboolean firstdraw;
604 } uiStatic_t;
605
606
607 // new ui stuff
608 #define UI_NUMFX 7
609 #define MAX_HEADS 64
610 #define MAX_ALIASES 64
611 #define MAX_HEADNAME 32
612 #define MAX_TEAMS 64
613 #define MAX_GAMETYPES 16
614 #define MAX_MAPS MAX_ARENAS
615 #define MAX_SPMAPS 16
616 #define PLAYERS_PER_TEAM 5
617 #define MAX_PINGREQUESTS 32
618 #define MAX_ADDRESSLENGTH 64
619 #define MAX_HOSTNAMELENGTH 22
620 #define MAX_MAPNAMELENGTH 16
621 #define MAX_STATUSLENGTH 64
622 #define MAX_LISTBOXWIDTH 59
623 #define UI_FONT_THRESHOLD 0.1
624 #define MAX_DISPLAY_SERVERS 2048
625 #define MAX_SERVERSTATUS_LINES 128
626 #define MAX_SERVERSTATUS_TEXT 1024
627 #define MAX_FOUNDPLAYER_SERVERS 16
628 #define TEAM_MEMBERS 5
629 #define GAMES_ALL 0
630 #define GAMES_FFA 1
631 #define GAMES_TEAMPLAY 2
632 #define GAMES_TOURNEY 3
633 #define GAMES_CTF 4
634 #define MAPS_PER_TIER 3
635 #define MAX_TIERS 16
636 #define MAX_MODS 64
637 #define MAX_DEMOS 512
638 #define MAX_MOVIES 256
639 #define MAX_PLAYERMODELS 256
640
641
642 typedef struct {
643 const char *name;
644 const char *imageName;
645 qhandle_t headImage;
646 const char *base;
647 qboolean active;
648 int reference;
649 } characterInfo;
650
651 typedef struct {
652 const char *name;
653 const char *ai;
654 const char *action;
655 } aliasInfo;
656
657 typedef struct {
658 const char *teamName;
659 const char *imageName;
660 const char *teamMembers[TEAM_MEMBERS];
661 qhandle_t teamIcon;
662 qhandle_t teamIcon_Metal;
663 qhandle_t teamIcon_Name;
664 int cinematic;
665 } teamInfo;
666
667 typedef struct {
668 const char *gameType;
669 int gtEnum;
670 } gameTypeInfo;
671
672 typedef struct {
673 const char *mapName;
674 const char *mapLoadName;
675 const char *imageName;
676 const char *opponentName;
677 int teamMembers;
678 int typeBits;
679 int cinematic;
680 int timeToBeat[MAX_GAMETYPES];
681 qhandle_t levelShot;
682 qboolean active;
683 } mapInfo;
684
685 typedef struct {
686 const char *tierName;
687 const char *maps[MAPS_PER_TIER];
688 int gameTypes[MAPS_PER_TIER];
689 qhandle_t mapHandles[MAPS_PER_TIER];
690 } tierInfo;
691
692 typedef struct serverFilter_s {
693 const char *description;
694 const char *basedir;
695 } serverFilter_t;
696
697 typedef struct {
698 char adrstr[MAX_ADDRESSLENGTH];
699 int start;
700 } pinglist_t;
701
702
703 typedef struct serverStatus_s {
704 pinglist_t pingList[MAX_PINGREQUESTS];
705 int numqueriedservers;
706 int currentping;
707 int nextpingtime;
708 int maxservers;
709 int refreshtime;
710 int numServers;
711 int sortKey;
712 int sortDir;
713 int lastCount;
714 qboolean refreshActive;
715 int currentServer;
716 int displayServers[MAX_DISPLAY_SERVERS];
717 int numDisplayServers;
718 int numPlayersOnServers;
719 int nextDisplayRefresh;
720 int nextSortTime;
721 qhandle_t currentServerPreview;
722 int currentServerCinematic;
723 int motdLen;
724 int motdWidth;
725 int motdPaintX;
726 int motdPaintX2;
727 int motdOffset;
728 int motdTime;
729 char motd[MAX_STRING_CHARS];
730 } serverStatus_t;
731
732
733 typedef struct {
734 char adrstr[MAX_ADDRESSLENGTH];
735 char name[MAX_ADDRESSLENGTH];
736 int startTime;
737 int serverNum;
738 qboolean valid;
739 } pendingServer_t;
740
741 typedef struct {
742 int num;
743 pendingServer_t server[MAX_SERVERSTATUSREQUESTS];
744 } pendingServerStatus_t;
745
746 typedef struct {
747 char address[MAX_ADDRESSLENGTH];
748 char *lines[MAX_SERVERSTATUS_LINES][4];
749 char text[MAX_SERVERSTATUS_TEXT];
750 char pings[MAX_CLIENTS * 3];
751 int numLines;
752 } serverStatusInfo_t;
753
754 typedef struct {
755 const char *modName;
756 const char *modDescr;
757 } modInfo_t;
758
759
760 typedef struct {
761 displayContextDef_t uiDC;
762 int newHighScoreTime;
763 int newBestTime;
764 int showPostGameTime;
765 qboolean newHighScore;
766 qboolean demoAvailable;
767 qboolean soundHighScore;
768
769 int characterCount;
770 int botIndex;
771 characterInfo characterList[MAX_HEADS];
772
773 int aliasCount;
774 aliasInfo aliasList[MAX_ALIASES];
775
776 int teamCount;
777 teamInfo teamList[MAX_TEAMS];
778
779 int numGameTypes;
780 gameTypeInfo gameTypes[MAX_GAMETYPES];
781
782 int numJoinGameTypes;
783 gameTypeInfo joinGameTypes[MAX_GAMETYPES];
784
785 int redBlue;
786 int playerCount;
787 int myTeamCount;
788 int teamIndex;
789 int playerRefresh;
790 int playerIndex;
791 int playerNumber;
792 qboolean teamLeader;
793 char playerNames[MAX_CLIENTS][MAX_NAME_LENGTH];
794 char teamNames[MAX_CLIENTS][MAX_NAME_LENGTH];
795 int teamClientNums[MAX_CLIENTS];
796
797 int mapCount;
798 mapInfo mapList[MAX_MAPS];
799
800
801 int tierCount;
802 tierInfo tierList[MAX_TIERS];
803
804 int skillIndex;
805
806 modInfo_t modList[MAX_MODS];
807 int modCount;
808 int modIndex;
809
810 const char *demoList[MAX_DEMOS];
811 int demoCount;
812 int demoIndex;
813
814 const char *movieList[MAX_MOVIES];
815 int movieCount;
816 int movieIndex;
817 int previewMovie;
818
819 serverStatus_t serverStatus;
820
821 // for the showing the status of a server
822 char serverStatusAddress[MAX_ADDRESSLENGTH];
823 serverStatusInfo_t serverStatusInfo;
824 int nextServerStatusRefresh;
825
826 // to retrieve the status of server to find a player
827 pendingServerStatus_t pendingServerStatus;
828 char findPlayerName[MAX_STRING_CHARS];
829 char foundPlayerServerAddresses[MAX_FOUNDPLAYER_SERVERS][MAX_ADDRESSLENGTH];
830 char foundPlayerServerNames[MAX_FOUNDPLAYER_SERVERS][MAX_ADDRESSLENGTH];
831 int currentFoundPlayerServer;
832 int numFoundPlayerServers;
833 int nextFindPlayerRefresh;
834
835 int currentCrosshair;
836 int startPostGameTime;
837 sfxHandle_t newHighScoreSound;
838
839 int q3HeadCount;
840 char q3HeadNames[MAX_PLAYERMODELS][64];
841 qhandle_t q3HeadIcons[MAX_PLAYERMODELS];
842 int q3SelectedHead;
843
844 int effectsColor;
845
846 qboolean inGameLoad;
847
848 } uiInfo_t;
849
850 extern uiInfo_t uiInfo;
851
852
853 extern void UI_Init( void );
854 extern void UI_Shutdown( void );
855 extern void UI_KeyEvent( int key );
856 extern void UI_MouseEvent( int dx, int dy );
857 extern void UI_Refresh( int realtime );
858 extern qboolean UI_ConsoleCommand( int realTime );
859 extern float UI_ClampCvar( float min, float max, float value );
860 extern void UI_DrawNamedPic( float x, float y, float width, float height, const char *picname );
861 extern void UI_DrawHandlePic( float x, float y, float w, float h, qhandle_t hShader );
862 extern void UI_FillRect( float x, float y, float width, float height, const float *color );
863 extern void UI_DrawRect( float x, float y, float width, float height, const float *color );
864 extern void UI_DrawTopBottom(float x, float y, float w, float h);
865 extern void UI_DrawSides(float x, float y, float w, float h);
866 extern void UI_UpdateScreen( void );
867 extern void UI_SetColor( const float *rgba );
868 extern void UI_LerpColor(vec4_t a, vec4_t b, vec4_t c, float t);
869 extern void UI_DrawBannerString( int x, int y, const char* str, int style, vec4_t color );
870 extern float UI_ProportionalSizeScale( int style );
871 extern void UI_DrawProportionalString( int x, int y, const char* str, int style, vec4_t color );
872 extern int UI_ProportionalStringWidth( const char* str );
873 extern void UI_DrawString( int x, int y, const char* str, int style, vec4_t color );
874 extern void UI_DrawChar( int x, int y, int ch, int style, vec4_t color );
875 extern qboolean UI_CursorInRect (int x, int y, int width, int height);
876 extern void UI_AdjustFrom640( float *x, float *y, float *w, float *h );
877 extern void UI_DrawTextBox (int x, int y, int width, int lines);
878 extern qboolean UI_IsFullscreen( void );
879 extern void UI_SetActiveMenu( uiMenuCommand_t menu );
880 extern void UI_PushMenu ( menuframework_s *menu );
881 extern void UI_PopMenu (void);
882 extern void UI_ForceMenuOff (void);
883 extern char *UI_Argv( int arg );
884 extern char *UI_Cvar_VariableString( const char *var_name );
885 extern void UI_Refresh( int time );
886 extern void UI_KeyEvent( int key );
887 extern void UI_StartDemoLoop( void );
888 extern qboolean m_entersound;
889 void UI_LoadBestScores(const char *map, int game);
890 extern uiStatic_t uis;
891
892 //
893 // ui_spLevel.c
894 //
895 void UI_SPLevelMenu_Cache( void );
896 void UI_SPLevelMenu( void );
897 void UI_SPLevelMenu_f( void );
898 void UI_SPLevelMenu_ReInit( void );
899
900 //
901 // ui_spArena.c
902 //
903 void UI_SPArena_Start( const char *arenaInfo );
904
905 //
906 // ui_spPostgame.c
907 //
908 void UI_SPPostgameMenu_Cache( void );
909 void UI_SPPostgameMenu_f( void );
910
911 //
912 // ui_spSkill.c
913 //
914 void UI_SPSkillMenu( const char *arenaInfo );
915 void UI_SPSkillMenu_Cache( void );
916
917 //
918 // ui_syscalls.c
919 //
920 void trap_Print( const char *string );
921 void trap_Error(const char *string) Q_NO_RETURN;
922 int trap_Milliseconds( void );
923 void trap_Cvar_Register( vmCvar_t *vmCvar, const char *varName, const char *defaultValue, int flags );
924 void trap_Cvar_Update( vmCvar_t *vmCvar );
925 void trap_Cvar_Set( const char *var_name, const char *value );
926 float trap_Cvar_VariableValue( const char *var_name );
927 void trap_Cvar_VariableStringBuffer( const char *var_name, char *buffer, int bufsize );
928 void trap_Cvar_SetValue( const char *var_name, float value );
929 void trap_Cvar_Reset( const char *name );
930 void trap_Cvar_Create( const char *var_name, const char *var_value, int flags );
931 void trap_Cvar_InfoStringBuffer( int bit, char *buffer, int bufsize );
932 int trap_Argc( void );
933 void trap_Argv( int n, char *buffer, int bufferLength );
934 void trap_Cmd_ExecuteText( int exec_when, const char *text ); // don't use EXEC_NOW!
935 int trap_FS_FOpenFile( const char *qpath, fileHandle_t *f, fsMode_t mode );
936 void trap_FS_Read( void *buffer, int len, fileHandle_t f );
937 void trap_FS_Write( const void *buffer, int len, fileHandle_t f );
938 void trap_FS_FCloseFile( fileHandle_t f );
939 int trap_FS_GetFileList( const char *path, const char *extension, char *listbuf, int bufsize );
940 int trap_FS_Seek( fileHandle_t f, long offset, int origin ); // fsOrigin_t
941 qhandle_t trap_R_RegisterModel( const char *name );
942 qhandle_t trap_R_RegisterSkin( const char *name );
943 qhandle_t trap_R_RegisterShaderNoMip( const char *name );
944 void trap_R_ClearScene( void );
945 void trap_R_AddRefEntityToScene( const refEntity_t *re );
946 void trap_R_AddPolyToScene( qhandle_t hShader , int numVerts, const polyVert_t *verts );
947 void trap_R_AddLightToScene( const vec3_t org, float intensity, float r, float g, float b );
948 void trap_R_RenderScene( const refdef_t *fd );
949 void trap_R_SetColor( const float *rgba );
950 void trap_R_DrawStretchPic( float x, float y, float w, float h, float s1, float t1, float s2, float t2, qhandle_t hShader );
951 void trap_R_ModelBounds( clipHandle_t model, vec3_t mins, vec3_t maxs );
952 void trap_UpdateScreen( void );
953 int trap_CM_LerpTag( orientation_t *tag, clipHandle_t mod, int startFrame, int endFrame, float frac, const char *tagName );
954 void trap_S_StartLocalSound( sfxHandle_t sfx, int channelNum );
955 sfxHandle_t trap_S_RegisterSound( const char *sample, qboolean compressed );
956 void trap_Key_KeynumToStringBuf( int keynum, char *buf, int buflen );
957 void trap_Key_GetBindingBuf( int keynum, char *buf, int buflen );
958 void trap_Key_SetBinding( int keynum, const char *binding );
959 qboolean trap_Key_IsDown( int keynum );
960 qboolean trap_Key_GetOverstrikeMode( void );
961 void trap_Key_SetOverstrikeMode( qboolean state );
962 void trap_Key_ClearStates( void );
963 int trap_Key_GetCatcher( void );
964 void trap_Key_SetCatcher( int catcher );
965 void trap_GetClipboardData( char *buf, int bufsize );
966 void trap_GetClientState( uiClientState_t *state );
967 void trap_GetGlconfig( glconfig_t *glconfig );
968 int trap_GetConfigString( int index, char* buff, int buffsize );
969 int trap_LAN_GetServerCount( int source );
970 void trap_LAN_GetServerAddressString( int source, int n, char *buf, int buflen );
971 void trap_LAN_GetServerInfo( int source, int n, char *buf, int buflen );
972 int trap_LAN_GetServerPing( int source, int n );
973 int trap_LAN_GetPingQueueCount( void );
974 void trap_LAN_ClearPing( int n );
975 void trap_LAN_GetPing( int n, char *buf, int buflen, int *pingtime );
976 void trap_LAN_GetPingInfo( int n, char *buf, int buflen );
977 void trap_LAN_LoadCachedServers( void );
978 void trap_LAN_SaveCachedServers( void );
979 void trap_LAN_MarkServerVisible(int source, int n, qboolean visible);
980 int trap_LAN_ServerIsVisible( int source, int n);
981 qboolean trap_LAN_UpdateVisiblePings( int source );
982 int trap_LAN_AddServer(int source, const char *name, const char *addr);
983 void trap_LAN_RemoveServer(int source, const char *addr);
984 void trap_LAN_ResetPings(int n);
985 int trap_LAN_ServerStatus( const char *serverAddress, char *serverStatus, int maxLen );
986 int trap_LAN_CompareServers( int source, int sortKey, int sortDir, int s1, int s2 );
987 int trap_MemoryRemaining( void );
988 void trap_GetCDKey( char *buf, int buflen );
989 void trap_SetCDKey( char *buf );
990 void trap_R_RegisterFont(const char *pFontname, int pointSize, fontInfo_t *font);
991 void trap_S_StopBackgroundTrack( void );
992 void trap_S_StartBackgroundTrack( const char *intro, const char *loop);
993 int trap_CIN_PlayCinematic( const char *arg0, int xpos, int ypos, int width, int height, int bits);
994 e_status trap_CIN_StopCinematic(int handle);
995 e_status trap_CIN_RunCinematic (int handle);
996 void trap_CIN_DrawCinematic (int handle);
997 void trap_CIN_SetExtents (int handle, int x, int y, int w, int h);
998 int trap_RealTime(qtime_t *qtime);
999 void trap_R_RemapShader( const char *oldShader, const char *newShader, const char *timeOffset );
1000 qboolean trap_VerifyCDKey( const char *key, const char *chksum);
1001
1002 void trap_SetPbClStatus( int status );
1003
1004 //
1005 // ui_addbots.c
1006 //
1007 void UI_AddBots_Cache( void );
1008 void UI_AddBotsMenu( void );
1009
1010 //
1011 // ui_removebots.c
1012 //
1013 void UI_RemoveBots_Cache( void );
1014 void UI_RemoveBotsMenu( void );
1015
1016 //
1017 // ui_teamorders.c
1018 //
1019 extern void UI_TeamOrdersMenu( void );
1020 extern void UI_TeamOrdersMenu_f( void );
1021 extern void UI_TeamOrdersMenu_Cache( void );
1022
1023 //
1024 // ui_loadconfig.c
1025 //
1026 void UI_LoadConfig_Cache( void );
1027 void UI_LoadConfigMenu( void );
1028
1029 //
1030 // ui_saveconfig.c
1031 //
1032 void UI_SaveConfigMenu_Cache( void );
1033 void UI_SaveConfigMenu( void );
1034
1035 //
1036 // ui_display.c
1037 //
1038 void UI_DisplayOptionsMenu_Cache( void );
1039 void UI_DisplayOptionsMenu( void );
1040
1041 //
1042 // ui_sound.c
1043 //
1044 void UI_SoundOptionsMenu_Cache( void );
1045 void UI_SoundOptionsMenu( void );
1046
1047 //
1048 // ui_network.c
1049 //
1050 void UI_NetworkOptionsMenu_Cache( void );
1051 void UI_NetworkOptionsMenu( void );
1052
1053 //
1054 // ui_gameinfo.c
1055 //
1056 typedef enum {
1057 AWARD_ACCURACY,
1058 AWARD_IMPRESSIVE,
1059 AWARD_EXCELLENT,
1060 AWARD_GAUNTLET,
1061 AWARD_FRAGS,
1062 AWARD_PERFECT
1063 } awardType_t;
1064
1065 const char *UI_GetArenaInfoByNumber( int num );
1066 const char *UI_GetArenaInfoByMap( const char *map );
1067 const char *UI_GetSpecialArenaInfo( const char *tag );
1068 int UI_GetNumArenas( void );
1069 int UI_GetNumSPArenas( void );
1070 int UI_GetNumSPTiers( void );
1071
1072 char *UI_GetBotInfoByNumber( int num );
1073 char *UI_GetBotInfoByName( const char *name );
1074 int UI_GetNumBots( void );
1075 void UI_LoadBots( void );
1076 char *UI_GetBotNameByNumber( int num );
1077
1078 void UI_GetBestScore( int level, int *score, int *skill );
1079 void UI_SetBestScore( int level, int score );
1080 int UI_TierCompleted( int levelWon );
1081 qboolean UI_ShowTierVideo( int tier );
1082 qboolean UI_CanShowTierVideo( int tier );
1083 int UI_GetCurrentGame( void );
1084 void UI_NewGame( void );
1085 void UI_LogAwardData( int award, int data );
1086 int UI_GetAwardLevel( int award );
1087
1088 void UI_SPUnlock_f( void );
1089 void UI_SPUnlockMedals_f( void );
1090
1091 void UI_InitGameinfo( void );
1092
1093 //
1094 // ui_login.c
1095 //
1096 void Login_Cache( void );
1097 void UI_LoginMenu( void );
1098
1099 //
1100 // ui_signup.c
1101 //
1102 void Signup_Cache( void );
1103 void UI_SignupMenu( void );
1104
1105 //
1106 // ui_rankstatus.c
1107 //
1108 void RankStatus_Cache( void );
1109 void UI_RankStatusMenu( void );
1110
1111
1112 // new ui
1113
1114 #define ASSET_BACKGROUND "uiBackground"
1115
1116 // for tracking sp game info in Team Arena
1117 typedef struct postGameInfo_s {
1118 int score;
1119 int redScore;
1120 int blueScore;
1121 int perfects;
1122 int accuracy;
1123 int impressives;
1124 int excellents;
1125 int defends;
1126 int assists;
1127 int gauntlets;
1128 int captures;
1129 int time;
1130 int timeBonus;
1131 int shutoutBonus;
1132 int skillBonus;
1133 int baseScore;
1134 } postGameInfo_t;
1135
1136
1137
1138 #endif