codemp/ui/ui_local.h

Go to the documentation of this file.
00001 // Copyright (C) 1999-2000 Id Software, Inc.
00002 //
00003 #ifndef __UI_LOCAL_H__
00004 #define __UI_LOCAL_H__
00005 
00006 #include "../game/q_shared.h"
00007 #include "../cgame/tr_types.h"
00008 #include "ui_public.h"
00009 #include "keycodes.h"
00010 #include "../game/bg_public.h"
00011 #include "ui_shared.h"
00012 
00013 // global display context
00014 
00015 extern vmCvar_t ui_ffa_fraglimit;
00016 extern vmCvar_t ui_ffa_timelimit;
00017 
00018 extern vmCvar_t ui_selectedModelIndex;
00019 
00020 extern vmCvar_t ui_team_fraglimit;
00021 extern vmCvar_t ui_team_timelimit;
00022 extern vmCvar_t ui_team_friendly;
00023 
00024 extern vmCvar_t ui_ctf_capturelimit;
00025 extern vmCvar_t ui_ctf_timelimit;
00026 extern vmCvar_t ui_ctf_friendly;
00027 
00028 extern vmCvar_t ui_arenasFile;
00029 extern vmCvar_t ui_botsFile;
00030 
00031 extern vmCvar_t ui_browserMaster;
00032 extern vmCvar_t ui_browserGameType;
00033 extern vmCvar_t ui_browserSortKey;
00034 extern vmCvar_t ui_browserShowFull;
00035 extern vmCvar_t ui_browserShowEmpty;
00036 
00037 extern vmCvar_t ui_drawCrosshair;
00038 extern vmCvar_t ui_drawCrosshairNames;
00039 extern vmCvar_t ui_marks;
00040 
00041 extern vmCvar_t ui_captureLimit;
00042 extern vmCvar_t ui_fragLimit;
00043 extern vmCvar_t ui_gameType;
00044 extern vmCvar_t ui_netGameType;
00045 extern vmCvar_t ui_actualNetGameType;
00046 extern vmCvar_t ui_joinGameType;
00047 #ifdef _XBOX
00048 extern vmCvar_t ui_optiGameType;
00049 extern vmCvar_t ui_optiCurrentMap;
00050 extern vmCvar_t ui_optiMinPlayers;
00051 extern vmCvar_t ui_optiMaxPlayers;
00052 extern vmCvar_t ui_optiFriendlyFire;
00053 extern vmCvar_t ui_optiJediMastery;
00054 extern vmCvar_t ui_optiSaberOnly;
00055 #endif
00056 extern vmCvar_t ui_netSource;
00057 extern vmCvar_t ui_serverFilterType;
00058 extern vmCvar_t ui_dedicated;
00059 extern vmCvar_t ui_opponentName;
00060 extern vmCvar_t ui_menuFiles;
00061 extern vmCvar_t ui_currentMap;
00062 extern vmCvar_t ui_currentNetMap;
00063 extern vmCvar_t ui_mapIndex;
00064 extern vmCvar_t ui_currentOpponent;
00065 extern vmCvar_t ui_selectedPlayer;
00066 extern vmCvar_t ui_selectedPlayerName;
00067 extern vmCvar_t ui_lastServerRefresh_0;
00068 extern vmCvar_t ui_lastServerRefresh_1;
00069 extern vmCvar_t ui_lastServerRefresh_2;
00070 extern vmCvar_t ui_lastServerRefresh_3;
00071 extern vmCvar_t ui_singlePlayerActive;
00072 extern vmCvar_t ui_scoreAccuracy;
00073 extern vmCvar_t ui_scoreImpressives;
00074 extern vmCvar_t ui_scoreExcellents;
00075 extern vmCvar_t ui_scoreDefends;
00076 extern vmCvar_t ui_scoreAssists;
00077 extern vmCvar_t ui_scoreGauntlets;
00078 extern vmCvar_t ui_scoreScore;
00079 extern vmCvar_t ui_scorePerfect;
00080 extern vmCvar_t ui_scoreTeam;
00081 extern vmCvar_t ui_scoreBase;
00082 extern vmCvar_t ui_scoreTimeBonus;
00083 extern vmCvar_t ui_scoreSkillBonus;
00084 extern vmCvar_t ui_scoreShutoutBonus;
00085 extern vmCvar_t ui_scoreTime;
00086 extern vmCvar_t ui_serverStatusTimeOut;
00087 
00088 extern vmCvar_t ui_bypassMainMenuLoad;
00089 
00090 //
00091 // ui_qmenu.c
00092 //
00093 
00094 #define RCOLUMN_OFFSET                  ( BIGCHAR_WIDTH )
00095 #define LCOLUMN_OFFSET                  (-BIGCHAR_WIDTH )
00096 
00097 #define SLIDER_RANGE                    10
00098 #define MAX_EDIT_LINE                   256
00099 
00100 #define MAX_MENUDEPTH                   8
00101 #define MAX_MENUITEMS                   256
00102 
00103 #define MAX_FORCE_CONFIGS               128
00104 
00105 #define MTYPE_NULL                              0
00106 #define MTYPE_SLIDER                    1       
00107 #define MTYPE_ACTION                    2
00108 #define MTYPE_SPINCONTROL               3
00109 #define MTYPE_FIELD                             4
00110 #define MTYPE_RADIOBUTTON               5
00111 #define MTYPE_BITMAP                    6       
00112 #define MTYPE_TEXT                              7
00113 #define MTYPE_SCROLLLIST                8
00114 #define MTYPE_PTEXT                             9
00115 #define MTYPE_BTEXT                             10
00116 
00117 #define QMF_BLINK                               0x00000001
00118 #define QMF_SMALLFONT                   0x00000002
00119 #define QMF_LEFT_JUSTIFY                0x00000004
00120 #define QMF_CENTER_JUSTIFY              0x00000008
00121 #define QMF_RIGHT_JUSTIFY               0x00000010
00122 #define QMF_NUMBERSONLY                 0x00000020      // edit field is only numbers
00123 #define QMF_HIGHLIGHT                   0x00000040
00124 #define QMF_HIGHLIGHT_IF_FOCUS  0x00000080      // steady focus
00125 #define QMF_PULSEIFFOCUS                0x00000100      // pulse if focus
00126 #define QMF_HASMOUSEFOCUS               0x00000200
00127 #define QMF_NOONOFFTEXT                 0x00000400
00128 #define QMF_MOUSEONLY                   0x00000800      // only mouse input allowed
00129 #define QMF_HIDDEN                              0x00001000      // skips drawing
00130 #define QMF_GRAYED                              0x00002000      // grays and disables
00131 #define QMF_INACTIVE                    0x00004000      // disables any input
00132 #define QMF_NODEFAULTINIT               0x00008000      // skip default initialization
00133 #define QMF_OWNERDRAW                   0x00010000
00134 #define QMF_PULSE                               0x00020000
00135 #define QMF_LOWERCASE                   0x00040000      // edit field is all lower case
00136 #define QMF_UPPERCASE                   0x00080000      // edit field is all upper case
00137 #define QMF_SILENT                              0x00100000
00138 
00139 // callback notifications
00140 #define QM_GOTFOCUS                             1
00141 #define QM_LOSTFOCUS                    2
00142 #define QM_ACTIVATED                    3
00143 
00144 typedef struct _tag_menuframework
00145 {
00146         int     cursor;
00147         int cursor_prev;
00148 
00149         int     nitems;
00150         void *items[MAX_MENUITEMS];
00151 
00152         void (*draw) (void);
00153         sfxHandle_t (*key) (int key);
00154 
00155         qboolean        wrapAround;
00156         qboolean        fullscreen;
00157         qboolean        showlogo;
00158 } menuframework_s;
00159 
00160 typedef struct
00161 {
00162         int type;
00163         const char *name;
00164         int     id;
00165         int x, y;
00166         int left;
00167         int     top;
00168         int     right;
00169         int     bottom;
00170         menuframework_s *parent;
00171         int menuPosition;
00172         unsigned flags;
00173 
00174         void (*callback)( void *self, int event );
00175         void (*statusbar)( void *self );
00176         void (*ownerdraw)( void *self );
00177 } menucommon_s;
00178 
00179 typedef struct {
00180         int             cursor;
00181         int             scroll;
00182         int             widthInChars;
00183         char    buffer[MAX_EDIT_LINE];
00184         int             maxchars;
00185 } mfield_t;
00186 
00187 typedef struct
00188 {
00189         menucommon_s    generic;
00190         mfield_t                field;
00191 } menufield_s;
00192 
00193 typedef struct 
00194 {
00195         menucommon_s generic;
00196 
00197         float minvalue;
00198         float maxvalue;
00199         float curvalue;
00200 
00201         float range;
00202 } menuslider_s;
00203 
00204 typedef struct
00205 {
00206         menucommon_s generic;
00207 
00208         int     oldvalue;
00209         int curvalue;
00210         int     numitems;
00211         int     top;
00212                 
00213         const char **itemnames;
00214 
00215         int width;
00216         int height;
00217         int     columns;
00218         int     seperation;
00219 } menulist_s;
00220 
00221 typedef struct
00222 {
00223         menucommon_s generic;
00224 } menuaction_s;
00225 
00226 typedef struct
00227 {
00228         menucommon_s generic;
00229         int curvalue;
00230 } menuradiobutton_s;
00231 
00232 typedef struct
00233 {
00234         menucommon_s    generic;
00235         char*                   focuspic;       
00236         char*                   errorpic;
00237         qhandle_t               shader;
00238         qhandle_t               focusshader;
00239         int                             width;
00240         int                             height;
00241         float*                  focuscolor;
00242 } menubitmap_s;
00243 
00244 typedef struct
00245 {
00246         menucommon_s    generic;
00247         char*                   string;
00248         int                             style;
00249         float*                  color;
00250 } menutext_s;
00251 
00252 extern void                     Menu_Cache( void );
00253 extern void                     Menu_Focus( menucommon_s *m );
00254 extern void                     Menu_AddItem( menuframework_s *menu, void *item );
00255 extern void                     Menu_AdjustCursor( menuframework_s *menu, int dir );
00256 extern void                     Menu_Draw( menuframework_s *menu );
00257 extern void                     *Menu_ItemAtCursor( menuframework_s *m );
00258 extern sfxHandle_t      Menu_ActivateItem( menuframework_s *s, menucommon_s* item );
00259 extern void                     Menu_SetCursor( menuframework_s *s, int cursor );
00260 extern void                     Menu_SetCursorToItem( menuframework_s *m, void* ptr );
00261 extern sfxHandle_t      Menu_DefaultKey( menuframework_s *s, int key );
00262 extern void                     Bitmap_Init( menubitmap_s *b );
00263 extern void                     Bitmap_Draw( menubitmap_s *b );
00264 extern void                     ScrollList_Draw( menulist_s *l );
00265 extern sfxHandle_t      ScrollList_Key( menulist_s *l, int key );
00266 extern sfxHandle_t      menu_in_sound;
00267 extern sfxHandle_t      menu_move_sound;
00268 extern sfxHandle_t      menu_out_sound;
00269 extern sfxHandle_t      menu_buzz_sound;
00270 extern sfxHandle_t      menu_null_sound;
00271 extern sfxHandle_t      weaponChangeSound;
00272 extern vec4_t           menu_text_color;
00273 extern vec4_t           menu_grayed_color;
00274 extern vec4_t           menu_dark_color;
00275 extern vec4_t           menu_highlight_color;
00276 extern vec4_t           menu_red_color;
00277 extern vec4_t           menu_black_color;
00278 extern vec4_t           menu_dim_color;
00279 extern vec4_t           color_black;
00280 extern vec4_t           color_white;
00281 extern vec4_t           color_yellow;
00282 extern vec4_t           color_blue;
00283 extern vec4_t           color_orange;
00284 extern vec4_t           color_red;
00285 extern vec4_t           color_dim;
00286 extern vec4_t           name_color;
00287 extern vec4_t           list_color;
00288 extern vec4_t           listbar_color;
00289 extern vec4_t           text_color_disabled; 
00290 extern vec4_t           text_color_normal;
00291 extern vec4_t           text_color_highlight;
00292 
00293 extern char     *ui_medalNames[];
00294 extern char     *ui_medalPicNames[];
00295 extern char     *ui_medalSounds[];
00296 
00297 //
00298 // ui_mfield.c
00299 //
00300 extern void                     MField_Clear( mfield_t *edit );
00301 extern void                     MField_KeyDownEvent( mfield_t *edit, int key );
00302 extern void                     MField_CharEvent( mfield_t *edit, int ch );
00303 extern void                     MField_Draw( mfield_t *edit, int x, int y, int style, vec4_t color );
00304 extern void                     MenuField_Init( menufield_s* m );
00305 extern void                     MenuField_Draw( menufield_s *f );
00306 extern sfxHandle_t      MenuField_Key( menufield_s* m, int* key );
00307 
00308 //
00309 // ui_main.c
00310 //
00311 qboolean UI_FeederSelection( float feederID, int index, itemDef_t *item );
00312 void UI_Report();
00313 void UI_Load();
00314 void UI_LoadMenus(const char *menuFile, qboolean reset);
00315 void _UI_SetActiveMenu( uiMenuCommand_t menu );
00316 int UI_AdjustTimeByGame(int time);
00317 void UI_ShowPostGame(qboolean newHigh);
00318 void UI_ClearScores();
00319 void UI_LoadArenas(void);
00320 void UI_LoadForceConfig_List( void );
00321 
00322 //
00323 // ui_menu.c
00324 //
00325 extern void MainMenu_Cache( void );
00326 extern void UI_MainMenu(void);
00327 extern void UI_RegisterCvars( void );
00328 extern void UI_UpdateCvars( void );
00329 
00330 //
00331 // ui_credits.c
00332 //
00333 extern void UI_CreditMenu( void );
00334 
00335 //
00336 // ui_ingame.c
00337 //
00338 extern void InGame_Cache( void );
00339 extern void UI_InGameMenu(void);
00340 
00341 //
00342 // ui_confirm.c
00343 //
00344 extern void ConfirmMenu_Cache( void );
00345 extern void UI_ConfirmMenu( const char *question, void (*draw)( void ), void (*action)( qboolean result ) );
00346 
00347 //
00348 // ui_setup.c
00349 //
00350 extern void UI_SetupMenu_Cache( void );
00351 extern void UI_SetupMenu(void);
00352 
00353 //
00354 // ui_team.c
00355 //
00356 extern void UI_TeamMainMenu( void );
00357 extern void TeamMain_Cache( void );
00358 
00359 //
00360 // ui_connect.c
00361 //
00362 extern void UI_DrawConnectScreen( qboolean overlay );
00363 
00364 //
00365 // ui_controls2.c
00366 //
00367 extern void UI_ControlsMenu( void );
00368 extern void Controls_Cache( void );
00369 
00370 //
00371 // ui_demo2.c
00372 //
00373 extern void UI_DemosMenu( void );
00374 extern void Demos_Cache( void );
00375 
00376 //
00377 // ui_cinematics.c
00378 //
00379 extern void UI_CinematicsMenu( void );
00380 extern void UI_CinematicsMenu_f( void );
00381 extern void UI_CinematicsMenu_Cache( void );
00382 
00383 //
00384 // ui_mods.c
00385 //
00386 extern void UI_ModsMenu( void );
00387 extern void UI_ModsMenu_Cache( void );
00388 
00389 //
00390 // ui_cdkey.c
00391 //
00392 extern void UI_CDKeyMenu( void );
00393 extern void UI_CDKeyMenu_Cache( void );
00394 extern void UI_CDKeyMenu_f( void );
00395 
00396 //
00397 // ui_playermodel.c
00398 //
00399 extern void UI_PlayerModelMenu( void );
00400 extern void PlayerModel_Cache( void );
00401 
00402 //
00403 // ui_playersettings.c
00404 //
00405 extern void UI_PlayerSettingsMenu( void );
00406 extern void PlayerSettings_Cache( void );
00407 
00408 //
00409 // ui_preferences.c
00410 //
00411 extern void UI_PreferencesMenu( void );
00412 extern void Preferences_Cache( void );
00413 
00414 //
00415 // ui_specifyleague.c
00416 //
00417 extern void UI_SpecifyLeagueMenu( void );
00418 extern void SpecifyLeague_Cache( void );
00419 
00420 //
00421 // ui_specifyserver.c
00422 //
00423 extern void UI_SpecifyServerMenu( void );
00424 extern void SpecifyServer_Cache( void );
00425 
00426 //
00427 // ui_servers2.c
00428 //
00429 #define MAX_FAVORITESERVERS 16
00430 
00431 extern void UI_ArenaServersMenu( void );
00432 extern void ArenaServers_Cache( void );
00433 
00434 //
00435 // ui_startserver.c
00436 //
00437 extern void UI_StartServerMenu( qboolean multiplayer );
00438 extern void StartServer_Cache( void );
00439 extern void ServerOptions_Cache( void );
00440 extern void UI_BotSelectMenu( char *bot );
00441 extern void UI_BotSelectMenu_Cache( void );
00442 
00443 //
00444 // ui_serverinfo.c
00445 //
00446 extern void UI_ServerInfoMenu( void );
00447 extern void ServerInfo_Cache( void );
00448 
00449 //
00450 // ui_video.c
00451 //
00452 extern void UI_GraphicsOptionsMenu( void );
00453 extern void GraphicsOptions_Cache( void );
00454 extern void DriverInfo_Cache( void );
00455 
00456 //
00457 // ui_players.c
00458 //
00459 
00460 //FIXME ripped from cg_local.h
00461 typedef struct {
00462         int                     oldFrame;
00463         int                     oldFrameTime;           // time when ->oldFrame was exactly on
00464 
00465         int                     frame;
00466         int                     frameTime;                      // time when ->frame will be exactly on
00467 
00468         float           backlerp;
00469 
00470         float           yawAngle;
00471         qboolean        yawing;
00472         float           pitchAngle;
00473         qboolean        pitching;
00474 
00475         int                     animationNumber;
00476         animation_t     *animation;
00477         int                     animationTime;          // time when the first frame of the animation will be exact
00478 } lerpFrame_t;
00479 
00480 typedef struct {
00481         // model info
00482         qhandle_t               legsModel;
00483         qhandle_t               legsSkin;
00484         lerpFrame_t             legs;
00485 
00486         qhandle_t               torsoModel;
00487         qhandle_t               torsoSkin;
00488         lerpFrame_t             torso;
00489 
00490 //      qhandle_t               headModel;
00491 //      qhandle_t               headSkin;
00492 
00493         animation_t             animations[MAX_TOTALANIMATIONS];
00494 
00495         qhandle_t               weaponModel;
00496         qhandle_t               barrelModel;
00497         qhandle_t               flashModel;
00498         vec3_t                  flashDlightColor;
00499         int                             muzzleFlashTime;
00500 
00501         // currently in use drawing parms
00502         vec3_t                  viewAngles;
00503         vec3_t                  moveAngles;
00504         weapon_t                currentWeapon;
00505         int                             legsAnim;
00506         int                             torsoAnim;
00507 
00508         // animation vars
00509         weapon_t                weapon;
00510         weapon_t                lastWeapon;
00511         weapon_t                pendingWeapon;
00512         int                             weaponTimer;
00513         int                             pendingLegsAnim;
00514         int                             torsoAnimationTimer;
00515 
00516         int                             pendingTorsoAnim;
00517         int                             legsAnimationTimer;
00518 
00519         qboolean                chat;
00520         qboolean                newModel;
00521 
00522         qboolean                barrelSpinning;
00523         float                   barrelAngle;
00524         int                             barrelTime;
00525 
00526         int                             realWeapon;
00527 } playerInfo_t;
00528 
00529 //void UI_DrawPlayer( float x, float y, float w, float h, playerInfo_t *pi, int time );
00530 //void UI_PlayerInfo_SetModel( playerInfo_t *pi, const char *model, const char *headmodel, char *teamName );
00531 //void UI_PlayerInfo_SetInfo( playerInfo_t *pi, int legsAnim, int torsoAnim, vec3_t viewAngles, vec3_t moveAngles, weapon_t weaponNum, qboolean chat );
00532 //qboolean UI_RegisterClientModelname( playerInfo_t *pi, const char *modelSkinName , const char *headName, const char *teamName);
00533 
00534 //
00535 // ui_atoms.c
00536 //
00537 // this is only used in the old ui, the new ui has it's own version
00538 typedef struct {
00539         int                                     frametime;
00540         int                                     realtime;
00541         int                                     cursorx;
00542         int                                     cursory;
00543         glconfig_t      glconfig;
00544         qboolean                debug;
00545         qhandle_t               whiteShader;
00546         qhandle_t               menuBackShader;
00547         qhandle_t               menuBackShader2;
00548         qhandle_t               menuBackNoLogoShader;
00549         qhandle_t               charset;
00550         qhandle_t               cursor;
00551         qhandle_t               rb_on;
00552         qhandle_t               rb_off;
00553         float                           scale;
00554         float                           bias;
00555         qboolean                demoversion;
00556         qboolean                firstdraw;
00557 } uiStatic_t;
00558 
00559 
00560 // new ui stuff
00561 #define UI_NUMFX 7
00562 #define MAX_HEADS 64
00563 #define MAX_ALIASES 64
00564 #define MAX_HEADNAME  32
00565 #define MAX_TEAMS 64
00566 #define MAX_GAMETYPES 16
00567 #define MAX_MAPS 128
00568 #define MAX_SPMAPS 16
00569 #define PLAYERS_PER_TEAM 8//5
00570 #define MAX_PINGREQUESTS                32
00571 #define MAX_ADDRESSLENGTH               64
00572 #define MAX_HOSTNAMELENGTH              22
00573 #define MAX_MAPNAMELENGTH               16
00574 #define MAX_STATUSLENGTH                64
00575 #define MAX_LISTBOXWIDTH                59
00576 #define UI_FONT_THRESHOLD               0.1
00577 #define MAX_DISPLAY_SERVERS             2048
00578 #define MAX_SERVERSTATUS_LINES  128
00579 #define MAX_SERVERSTATUS_TEXT   1024
00580 #define MAX_FOUNDPLAYER_SERVERS 16
00581 #define TEAM_MEMBERS 8//5
00582 #define GAMES_ALL                       0
00583 #define GAMES_FFA                       1
00584 #define GAMES_HOLOCRON          2
00585 #define GAMES_TEAMPLAY          3
00586 #define GAMES_TOURNEY           4
00587 #define GAMES_CTF                       5
00588 #define MAPS_PER_TIER 3
00589 #define MAX_TIERS 16
00590 #define MAX_MODS 64
00591 #define MAX_DEMOS 256
00592 #define MAX_MOVIES 256
00593 #define MAX_Q3PLAYERMODELS 256
00594 #define MAX_PLAYERMODELS 32
00595 
00596 #define MAX_SCROLLTEXT_SIZE             4096
00597 #define MAX_SCROLLTEXT_LINES            64
00598 
00599 typedef struct {
00600   const char *name;
00601         const char *imageName;
00602   qhandle_t headImage;
00603         const char *base;
00604         qboolean active;
00605         int reference;
00606 } characterInfo;
00607 
00608 typedef struct {
00609         const char *name;
00610         const char *ai;
00611         const char *action;
00612 } aliasInfo;
00613 
00614 typedef struct {
00615   const char *teamName;
00616         const char *imageName;
00617         const char *teamMembers[TEAM_MEMBERS];
00618   qhandle_t teamIcon;
00619   qhandle_t teamIcon_Metal;
00620   qhandle_t teamIcon_Name;
00621         int cinematic;
00622 } teamInfo;
00623 
00624 typedef struct {
00625   const char *gameType;
00626   int gtEnum;
00627 } gameTypeInfo;
00628 
00629 typedef struct {
00630   const char *mapName;
00631   const char *mapLoadName;
00632         const char *imageName;
00633         const char *opponentName;
00634         int teamMembers;
00635   int typeBits;
00636         int cinematic;
00637         int timeToBeat[MAX_GAMETYPES];
00638         qhandle_t levelShot;
00639         qboolean active;
00640 } mapInfo;
00641 
00642 typedef struct {
00643         const char *tierName;
00644         const char *maps[MAPS_PER_TIER];
00645         int gameTypes[MAPS_PER_TIER];
00646         qhandle_t mapHandles[MAPS_PER_TIER];
00647 } tierInfo;
00648 
00649 typedef struct serverFilter_s {
00650         const char *description;
00651         const char *basedir;
00652 } serverFilter_t;
00653 
00654 typedef struct {
00655         char    adrstr[MAX_ADDRESSLENGTH];
00656         int             start;
00657 } pinglist_t;
00658 
00659 
00660 typedef struct serverStatus_s {
00661         pinglist_t pingList[MAX_PINGREQUESTS];
00662         int             numqueriedservers;
00663         int             currentping;
00664         int             nextpingtime;
00665         int             maxservers;
00666         int             refreshtime;
00667         int             numServers;
00668         int             sortKey;
00669         int             sortDir;
00670         int             lastCount;
00671         qboolean refreshActive;
00672         int             currentServer;
00673         int             displayServers[MAX_DISPLAY_SERVERS];
00674         int             numDisplayServers;
00675         int             numPlayersOnServers;
00676         int             nextDisplayRefresh;
00677         int             nextSortTime;
00678         qhandle_t currentServerPreview;
00679         int             currentServerCinematic;
00680         int             motdLen;
00681         int             motdWidth;
00682         int             motdPaintX;
00683         int             motdPaintX2;
00684         int             motdOffset;
00685         int             motdTime;
00686         char    motd[MAX_STRING_CHARS];
00687 } serverStatus_t;
00688 
00689 
00690 typedef struct {
00691         char            adrstr[MAX_ADDRESSLENGTH];
00692         char            name[MAX_ADDRESSLENGTH];
00693         int                     startTime;
00694         int                     serverNum;
00695         qboolean        valid;
00696 } pendingServer_t;
00697 
00698 typedef struct {
00699         int num;
00700         pendingServer_t server[MAX_SERVERSTATUSREQUESTS];
00701 } pendingServerStatus_t;
00702 
00703 typedef struct {
00704         char address[MAX_ADDRESSLENGTH];
00705         char *lines[MAX_SERVERSTATUS_LINES][4];
00706         char text[MAX_SERVERSTATUS_TEXT];
00707         char pings[MAX_CLIENTS * 3];
00708         int numLines;
00709 } serverStatusInfo_t;
00710 
00711 typedef struct {
00712         const char *modName;
00713         const char *modDescr;
00714 } modInfo_t;
00715 
00716 typedef struct {
00717         char            Name[64];
00718         int                     SkinHeadCount;
00719         char            SkinHeadNames[MAX_PLAYERMODELS][16];
00720         int                     SkinTorsoCount;
00721         char            SkinTorsoNames[MAX_PLAYERMODELS][16];
00722         int                     SkinLegCount;
00723         char            SkinLegNames[MAX_PLAYERMODELS][16];
00724         char            ColorShader[MAX_PLAYERMODELS][64];
00725         int                     ColorCount;
00726         char            ColorActionText[MAX_PLAYERMODELS][128];
00727 } playerSpeciesInfo_t;
00728 
00729 typedef struct {
00730         displayContextDef_t uiDC;
00731         int newHighScoreTime;
00732         int newBestTime;
00733         int showPostGameTime;
00734         qboolean newHighScore;
00735         qboolean demoAvailable;
00736         qboolean soundHighScore;
00737         
00738         int characterCount;
00739         int botIndex;
00740 //      characterInfo characterList[MAX_HEADS];
00741 
00742         int aliasCount;
00743         aliasInfo aliasList[MAX_ALIASES];
00744 
00745         int teamCount;
00746         teamInfo teamList[MAX_TEAMS];
00747 
00748         int numGameTypes;
00749         gameTypeInfo gameTypes[MAX_GAMETYPES];
00750 
00751         int numJoinGameTypes;
00752         gameTypeInfo joinGameTypes[MAX_GAMETYPES];
00753 
00754         int redBlue;
00755         int playerCount;
00756         int myTeamCount;
00757         int teamIndex;
00758         int playerRefresh;
00759         int playerIndex;
00760         int playerNumber; 
00761         qboolean teamLeader;
00762         char playerNames[MAX_CLIENTS][MAX_NAME_LENGTH];
00763         char teamNames[MAX_CLIENTS][MAX_NAME_LENGTH];
00764         int teamClientNums[MAX_CLIENTS];
00765 
00766         int playerIndexes[MAX_CLIENTS]; //so we can vote-kick by index
00767 
00768         int mapCount;
00769         mapInfo mapList[MAX_MAPS];
00770 
00771 
00772         int tierCount;
00773         tierInfo tierList[MAX_TIERS];
00774 
00775         int skillIndex;
00776 
00777         modInfo_t modList[MAX_MODS];
00778         int modCount;
00779         int modIndex;
00780 
00781         const char *demoList[MAX_DEMOS];
00782         int demoCount;
00783         int demoIndex;
00784 
00785         const char *movieList[MAX_MOVIES];
00786         int movieCount;
00787         int movieIndex;
00788         int previewMovie;
00789 
00790         char scrolltext[MAX_SCROLLTEXT_SIZE];
00791         const char *scrolltextLine[MAX_SCROLLTEXT_LINES];
00792         int scrolltextLineCount;
00793 
00794         serverStatus_t serverStatus;
00795 
00796         // for the showing the status of a server
00797         char serverStatusAddress[MAX_ADDRESSLENGTH];
00798         serverStatusInfo_t serverStatusInfo;
00799         int nextServerStatusRefresh;
00800 
00801         // to retrieve the status of server to find a player
00802         pendingServerStatus_t pendingServerStatus;
00803         char findPlayerName[MAX_STRING_CHARS];
00804         char foundPlayerServerAddresses[MAX_FOUNDPLAYER_SERVERS][MAX_ADDRESSLENGTH];
00805         char foundPlayerServerNames[MAX_FOUNDPLAYER_SERVERS][MAX_ADDRESSLENGTH];
00806         int currentFoundPlayerServer;
00807         int numFoundPlayerServers;
00808         int nextFindPlayerRefresh;
00809 
00810         int currentCrosshair;
00811         int startPostGameTime;
00812         sfxHandle_t newHighScoreSound;
00813 
00814         int                             q3HeadCount;
00815         char                    q3HeadNames[MAX_Q3PLAYERMODELS][64];
00816         qhandle_t               q3HeadIcons[MAX_Q3PLAYERMODELS];
00817         int                             q3SelectedHead;
00818 
00819         int                             forceConfigCount;
00820         int                             forceConfigSelected;
00821         char                    forceConfigNames[MAX_FORCE_CONFIGS][128];
00822         qboolean                forceConfigSide[MAX_FORCE_CONFIGS]; //true if it's a light side config, false if dark side
00823         int                             forceConfigDarkIndexBegin; //mark the index number dark configs start at
00824         int                             forceConfigLightIndexBegin; //mark the index number light configs start at
00825 
00826         int effectsColor;
00827 
00828         qboolean inGameLoad;
00829 
00830         int                                     playerSpeciesCount;
00831         playerSpeciesInfo_t     playerSpecies[MAX_PLAYERMODELS];
00832         int                                     playerSpeciesIndex;
00833 
00834         short           movesTitleIndex;
00835         char            *movesBaseAnim;
00836         int                     moveAnimTime;
00837 
00838         int                     languageCount;
00839         int                     languageCountIndex;
00840 
00841 }       uiInfo_t;
00842 
00843 extern uiInfo_t uiInfo;
00844 
00845 
00846 extern void                     UI_Init( void );
00847 extern void                     UI_Shutdown( void );
00848 extern void                     UI_KeyEvent( int key );
00849 extern void                     UI_MouseEvent( int dx, int dy );
00850 extern void                     UI_Refresh( int realtime );
00851 extern qboolean         UI_ConsoleCommand( int realTime );
00852 extern float            UI_ClampCvar( float min, float max, float value );
00853 extern void                     UI_DrawNamedPic( float x, float y, float width, float height, const char *picname );
00854 extern void                     UI_DrawHandlePic( float x, float y, float w, float h, qhandle_t hShader ); 
00855 extern void                     UI_FillRect( float x, float y, float width, float height, const float *color );
00856 extern void                     UI_DrawRect( float x, float y, float width, float height, const float *color );
00857 extern void     UI_DrawTopBottom(float x, float y, float w, float h);
00858 extern void     UI_DrawSides(float x, float y, float w, float h);
00859 extern void                     UI_UpdateScreen( void );
00860 extern void                     UI_SetColor( const float *rgba );
00861 extern void                     UI_LerpColor(vec4_t a, vec4_t b, vec4_t c, float t);
00862 extern void                     UI_DrawBannerString( int x, int y, const char* str, int style, vec4_t color );
00863 extern float            UI_ProportionalSizeScale( int style );
00864 extern void                     UI_DrawProportionalString( int x, int y, const char* str, int style, vec4_t color );
00865 extern int                      UI_ProportionalStringWidth( const char* str );
00866 extern void                     UI_DrawString( int x, int y, const char* str, int style, vec4_t color );
00867 extern void                     UI_DrawChar( int x, int y, int ch, int style, vec4_t color );
00868 extern qboolean         UI_CursorInRect (int x, int y, int width, int height);
00869 extern void                     UI_DrawTextBox (int x, int y, int width, int lines);
00870 extern qboolean         UI_IsFullscreen( void );
00871 extern void                     UI_SetActiveMenu( uiMenuCommand_t menu );
00872 extern void                     UI_PushMenu ( menuframework_s *menu );
00873 extern void                     UI_PopMenu (void);
00874 extern void                     UI_ForceMenuOff (void);
00875 extern char                     *UI_Argv( int arg );
00876 extern char                     *UI_Cvar_VariableString( const char *var_name );
00877 extern void                     UI_Refresh( int time );
00878 extern void                     UI_KeyEvent( int key );
00879 extern void                     UI_StartDemoLoop( void );
00880 extern qboolean         m_entersound;
00881 void UI_LoadBestScores(const char *map, int game);
00882 extern uiStatic_t       uis;
00883 
00884 //
00885 // ui_spLevel.c
00886 //
00887 void UI_SPLevelMenu_Cache( void );
00888 void UI_SPLevelMenu( void );
00889 void UI_SPLevelMenu_f( void );
00890 void UI_SPLevelMenu_ReInit( void );
00891 
00892 //
00893 // ui_spArena.c
00894 //
00895 void UI_SPArena_Start( const char *arenaInfo );
00896 
00897 //
00898 // ui_spPostgame.c
00899 //
00900 void UI_SPPostgameMenu_Cache( void );
00901 void UI_SPPostgameMenu_f( void );
00902 
00903 //
00904 // ui_spSkill.c
00905 //
00906 void UI_SPSkillMenu( const char *arenaInfo );
00907 void UI_SPSkillMenu_Cache( void );
00908 
00909 //
00910 // ui_syscalls.c
00911 //
00912 
00913 #include "../namespace_begin.h"
00914 
00915 void                    trap_Print( const char *string );
00916 void                    trap_Error( const char *string );
00917 int                             trap_Milliseconds( void );
00918 void                    trap_Cvar_Register( vmCvar_t *vmCvar, const char *varName, const char *defaultValue, int flags );
00919 void                    trap_Cvar_Update( vmCvar_t *vmCvar );
00920 void                    trap_Cvar_Set( const char *var_name, const char *value );
00921 float                   trap_Cvar_VariableValue( const char *var_name );
00922 void                    trap_Cvar_VariableStringBuffer( const char *var_name, char *buffer, int bufsize );
00923 void                    trap_Cvar_SetValue( const char *var_name, float value );
00924 void                    trap_Cvar_Reset( const char *name );
00925 void                    trap_Cvar_Create( const char *var_name, const char *var_value, int flags );
00926 void                    trap_Cvar_InfoStringBuffer( int bit, char *buffer, int bufsize );
00927 int                             trap_Argc( void );
00928 void                    trap_Argv( int n, char *buffer, int bufferLength );
00929 void                    trap_Cmd_ExecuteText( int exec_when, const char *text );        // don't use EXEC_NOW!
00930 int                             trap_FS_FOpenFile( const char *qpath, fileHandle_t *f, fsMode_t mode );
00931 void                    trap_FS_Read( void *buffer, int len, fileHandle_t f );
00932 void                    trap_FS_Write( const void *buffer, int len, fileHandle_t f );
00933 void                    trap_FS_FCloseFile( fileHandle_t f );
00934 int                             trap_FS_GetFileList(  const char *path, const char *extension, char *listbuf, int bufsize );
00935 qhandle_t               trap_R_RegisterModel( const char *name );
00936 qhandle_t               trap_R_RegisterSkin( const char *name );
00937 qhandle_t               trap_R_RegisterShaderNoMip( const char *name );
00938 void                    trap_R_ShaderNameFromIndex(char *name, int index);
00939 void                    trap_R_ClearScene( void );
00940 void                    trap_R_AddRefEntityToScene( const refEntity_t *re );
00941 void                    trap_R_AddPolyToScene( qhandle_t hShader , int numVerts, const polyVert_t *verts );
00942 void                    trap_R_AddLightToScene( const vec3_t org, float intensity, float r, float g, float b );
00943 void                    trap_R_RenderScene( const refdef_t *fd );
00944 void                    trap_R_SetColor( const float *rgba );
00945 void                    trap_R_DrawStretchPic( float x, float y, float w, float h, float s1, float t1, float s2, float t2, qhandle_t hShader );
00946 void                    trap_R_ModelBounds( clipHandle_t model, vec3_t mins, vec3_t maxs );
00947 void                    trap_UpdateScreen( void );
00948 int                             trap_CM_LerpTag( orientation_t *tag, clipHandle_t mod, int startFrame, int endFrame, float frac, const char *tagName );
00949 void                    trap_S_StartLocalSound( sfxHandle_t sfx, int channelNum );
00950 sfxHandle_t             trap_S_RegisterSound( const char *sample );
00951 void                    trap_Key_KeynumToStringBuf( int keynum, char *buf, int buflen );
00952 void                    trap_Key_GetBindingBuf( int keynum, char *buf, int buflen );
00953 void                    trap_Key_SetBinding( int keynum, const char *binding );
00954 qboolean                trap_Key_IsDown( int keynum );
00955 qboolean                trap_Key_GetOverstrikeMode( void );
00956 void                    trap_Key_SetOverstrikeMode( qboolean state );
00957 void                    trap_Key_ClearStates( void );
00958 int                             trap_Key_GetCatcher( void );
00959 void                    trap_Key_SetCatcher( int catcher );
00960 void                    trap_GetClipboardData( char *buf, int bufsize );
00961 void                    trap_GetClientState( uiClientState_t *state );
00962 void                    trap_GetGlconfig( glconfig_t *glconfig );
00963 int                             trap_GetConfigString( int index, char* buff, int buffsize );
00964 int                             trap_LAN_GetServerCount( int source );
00965 void                    trap_LAN_GetServerAddressString( int source, int n, char *buf, int buflen );
00966 void                    trap_LAN_GetServerInfo( int source, int n, char *buf, int buflen );
00967 int                             trap_LAN_GetServerPing( int source, int n );
00968 int                             trap_LAN_GetPingQueueCount( void );
00969 void                    trap_LAN_ClearPing( int n );
00970 void                    trap_LAN_GetPing( int n, char *buf, int buflen, int *pingtime );
00971 void                    trap_LAN_GetPingInfo( int n, char *buf, int buflen );
00972 void                    trap_LAN_LoadCachedServers();
00973 void                    trap_LAN_SaveCachedServers();
00974 void                    trap_LAN_MarkServerVisible(int source, int n, qboolean visible);
00975 int                             trap_LAN_ServerIsVisible( int source, int n);
00976 qboolean                trap_LAN_UpdateVisiblePings( int source );
00977 int                             trap_LAN_AddServer(int source, const char *name, const char *addr);
00978 void                    trap_LAN_RemoveServer(int source, const char *addr);
00979 void                    trap_LAN_ResetPings(int n);
00980 int                             trap_LAN_ServerStatus( const char *serverAddress, char *serverStatus, int maxLen );
00981 int                             trap_LAN_CompareServers( int source, int sortKey, int sortDir, int s1, int s2 );
00982 int                             trap_MemoryRemaining( void );
00983 
00984 #ifdef USE_CD_KEY
00985 
00986 void                    trap_GetCDKey( char *buf, int buflen );
00987 void                    trap_SetCDKey( char *buf );
00988 qboolean                trap_VerifyCDKey( const char *key, const char *chksum);
00989 
00990 #endif // USE_CD_KEY
00991 
00992 qhandle_t               trap_R_RegisterFont( const char *name );
00993 int                             trap_R_Font_StrLenPixels(const char *text, const int iFontIndex, const float scale);
00994 int                             trap_R_Font_StrLenChars(const char *text);
00995 int                             trap_R_Font_HeightPixels(const int iFontIndex, const float scale);
00996 void                    trap_R_Font_DrawString(int ox, int oy, const char *text, const float *rgba, const int setIndex, int iCharLimit, const float scale);
00997 qboolean                trap_Language_IsAsian(void);
00998 qboolean                trap_Language_UsesSpaces(void);
00999 unsigned                trap_AnyLanguage_ReadCharFromString( const char *psText, int *piAdvanceCount, qboolean *pbIsTrailingPunctuation/* = NULL*/ );
01000 void                    trap_S_StopBackgroundTrack( void );
01001 void                    trap_S_StartBackgroundTrack( const char *intro, const char *loop, qboolean bReturnWithoutStarting);
01002 int                             trap_CIN_PlayCinematic( const char *arg0, int xpos, int ypos, int width, int height, int bits);
01003 e_status                trap_CIN_StopCinematic(int handle);
01004 e_status                trap_CIN_RunCinematic (int handle);
01005 void                    trap_CIN_DrawCinematic (int handle);
01006 void                    trap_CIN_SetExtents (int handle, int x, int y, int w, int h);
01007 int                             trap_RealTime(qtime_t *qtime);
01008 void                    trap_R_RemapShader( const char *oldShader, const char *newShader, const char *timeOffset );
01009 
01010 #include "../namespace_end.h"
01011 
01012 //
01013 // ui_addbots.c
01014 //
01015 void UI_AddBots_Cache( void );
01016 void UI_AddBotsMenu( void );
01017 
01018 //
01019 // ui_removebots.c
01020 //
01021 void UI_RemoveBots_Cache( void );
01022 void UI_RemoveBotsMenu( void );
01023 
01024 //
01025 // ui_teamorders.c
01026 //
01027 extern void UI_TeamOrdersMenu( void );
01028 extern void UI_TeamOrdersMenu_f( void );
01029 extern void UI_TeamOrdersMenu_Cache( void );
01030 
01031 //
01032 // ui_loadconfig.c
01033 //
01034 void UI_LoadConfig_Cache( void );
01035 void UI_LoadConfigMenu( void );
01036 
01037 //
01038 // ui_saveconfig.c
01039 //
01040 void UI_SaveConfigMenu_Cache( void );
01041 void UI_SaveConfigMenu( void );
01042 
01043 //
01044 // ui_display.c
01045 //
01046 void UI_DisplayOptionsMenu_Cache( void );
01047 void UI_DisplayOptionsMenu( void );
01048 
01049 //
01050 // ui_sound.c
01051 //
01052 void UI_SoundOptionsMenu_Cache( void );
01053 void UI_SoundOptionsMenu( void );
01054 
01055 //
01056 // ui_network.c
01057 //
01058 void UI_NetworkOptionsMenu_Cache( void );
01059 void UI_NetworkOptionsMenu( void );
01060 
01061 //
01062 // ui_gameinfo.c
01063 //
01064 typedef enum {
01065         AWARD_ACCURACY,
01066         AWARD_IMPRESSIVE,
01067         AWARD_EXCELLENT,
01068         AWARD_GAUNTLET,
01069         AWARD_FRAGS,
01070         AWARD_PERFECT
01071 } awardType_t;
01072 
01073 const char *UI_GetArenaInfoByNumber( int num );
01074 const char *UI_GetArenaInfoByMap( const char *map );
01075 const char *UI_GetSpecialArenaInfo( const char *tag );
01076 int UI_GetNumArenas( void );
01077 int UI_GetNumSPArenas( void );
01078 int UI_GetNumSPTiers( void );
01079 
01080 char *UI_GetBotInfoByNumber( int num );
01081 char *UI_GetBotInfoByName( const char *name );
01082 int UI_GetNumBots( void );
01083 void UI_LoadBots( void );
01084 char *UI_GetBotNameByNumber( int num );
01085 
01086 void UI_GetBestScore( int level, int *score, int *skill );
01087 void UI_SetBestScore( int level, int score );
01088 int UI_TierCompleted( int levelWon );
01089 qboolean UI_ShowTierVideo( int tier );
01090 qboolean UI_CanShowTierVideo( int tier );
01091 int  UI_GetCurrentGame( void );
01092 void UI_NewGame( void );
01093 void UI_LogAwardData( int award, int data );
01094 int UI_GetAwardLevel( int award );
01095 
01096 void UI_SPUnlock_f( void );
01097 void UI_SPUnlockMedals_f( void );
01098 
01099 void UI_InitGameinfo( void );
01100 
01101 //
01102 // ui_login.c
01103 //
01104 void Login_Cache( void );
01105 void UI_LoginMenu( void );
01106 
01107 //
01108 // ui_signup.c
01109 //
01110 void Signup_Cache( void );
01111 void UI_SignupMenu( void );
01112 
01113 //
01114 // ui_rankstatus.c
01115 //
01116 void RankStatus_Cache( void );
01117 void UI_RankStatusMenu( void );
01118 
01119 
01120 // new ui 
01121 
01122 #define ASSET_BACKGROUND "uiBackground"
01123 
01124 // for tracking sp game info in Team Arena
01125 typedef struct postGameInfo_s {
01126         int score;
01127         int redScore;
01128         int blueScore;
01129         int perfects;
01130         int accuracy;
01131         int impressives;
01132         int excellents;
01133         int defends;
01134         int assists;
01135         int gauntlets;
01136         int     captures;
01137         int time;
01138         int timeBonus;
01139         int shutoutBonus;
01140         int skillBonus;
01141         int baseScore;
01142 } postGameInfo_t;
01143 
01144 
01145 
01146 #endif