Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

ui_sppostgame.c

Go to the documentation of this file.
00001 /*
00002 ===========================================================================
00003 Copyright (C) 1999-2005 Id Software, Inc.
00004 
00005 This file is part of Quake III Arena source code.
00006 
00007 Quake III Arena source code is free software; you can redistribute it
00008 and/or modify it under the terms of the GNU General Public License as
00009 published by the Free Software Foundation; either version 2 of the License,
00010 or (at your option) any later version.
00011 
00012 Quake III Arena source code is distributed in the hope that it will be
00013 useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 GNU General Public License for more details.
00016 
00017 You should have received a copy of the GNU General Public License
00018 along with Foobar; if not, write to the Free Software
00019 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00020 ===========================================================================
00021 */
00022 //
00023 /*
00024 =============================================================================
00025 
00026 SINGLE PLAYER POSTGAME MENU
00027 
00028 =============================================================================
00029 */
00030 
00031 #include "ui_local.h"
00032 
00033 #define MAX_SCOREBOARD_CLIENTS      8
00034 
00035 #define AWARD_PRESENTATION_TIME     2000
00036 
00037 #define ART_MENU0       "menu/art/menu_0"
00038 #define ART_MENU1       "menu/art/menu_1"
00039 #define ART_REPLAY0     "menu/art/replay_0"
00040 #define ART_REPLAY1     "menu/art/replay_1"
00041 #define ART_NEXT0       "menu/art/next_0"
00042 #define ART_NEXT1       "menu/art/next_1"
00043 
00044 #define ID_AGAIN        10
00045 #define ID_NEXT         11
00046 #define ID_MENU         12
00047 
00048 typedef struct {
00049     menuframework_s menu;
00050     menubitmap_s    item_again;
00051     menubitmap_s    item_next;
00052     menubitmap_s    item_menu;
00053 
00054     int             phase;
00055     int             ignoreKeysTime;
00056     int             starttime;
00057     int             scoreboardtime;
00058     int             serverId;
00059 
00060     int             clientNums[MAX_SCOREBOARD_CLIENTS];
00061     int             ranks[MAX_SCOREBOARD_CLIENTS];
00062     int             scores[MAX_SCOREBOARD_CLIENTS];
00063 
00064     char            placeNames[3][64];
00065 
00066     int             level;
00067     int             numClients;
00068     int             won;
00069     int             numAwards;
00070     int             awardsEarned[6];
00071     int             awardsLevels[6];
00072     qboolean        playedSound[6];
00073     int             lastTier;
00074     sfxHandle_t     winnerSound;
00075 } postgameMenuInfo_t;
00076 
00077 static postgameMenuInfo_t   postgameMenuInfo;
00078 static char                 arenainfo[MAX_INFO_VALUE];
00079 
00080 char    *ui_medalNames[] = {"Accuracy", "Impressive", "Excellent", "Gauntlet", "Frags", "Perfect"};
00081 char    *ui_medalPicNames[] = {
00082     "menu/medals/medal_accuracy",
00083     "menu/medals/medal_impressive",
00084     "menu/medals/medal_excellent",
00085     "menu/medals/medal_gauntlet",
00086     "menu/medals/medal_frags",
00087     "menu/medals/medal_victory"
00088 };
00089 char    *ui_medalSounds[] = {
00090     "sound/feedback/accuracy.wav",
00091     "sound/feedback/impressive_a.wav",
00092     "sound/feedback/excellent_a.wav",
00093     "sound/feedback/gauntlet.wav",
00094     "sound/feedback/frags.wav",
00095     "sound/feedback/perfect.wav"
00096 };
00097 
00098 
00099 /*
00100 =================
00101 UI_SPPostgameMenu_AgainEvent
00102 =================
00103 */
00104 static void UI_SPPostgameMenu_AgainEvent( void* ptr, int event )
00105 {
00106     if (event != QM_ACTIVATED) {
00107         return;
00108     }
00109     UI_PopMenu();
00110     trap_Cmd_ExecuteText( EXEC_APPEND, "map_restart 0\n" );
00111 }
00112 
00113 
00114 /*
00115 =================
00116 UI_SPPostgameMenu_NextEvent
00117 =================
00118 */
00119 static void UI_SPPostgameMenu_NextEvent( void* ptr, int event ) {
00120     int         currentSet;
00121     int         levelSet;
00122     int         level;
00123     int         currentLevel;
00124     const char  *arenaInfo;
00125 
00126     if (event != QM_ACTIVATED) {
00127         return;
00128     }
00129     UI_PopMenu();
00130 
00131     // handle specially if we just won the training map
00132     if( postgameMenuInfo.won == 0 ) {
00133         level = 0;
00134     }
00135     else {
00136         level = postgameMenuInfo.level + 1;
00137     }
00138     levelSet = level / ARENAS_PER_TIER;
00139 
00140     currentLevel = UI_GetCurrentGame();
00141     if( currentLevel == -1 ) {
00142         currentLevel = postgameMenuInfo.level;
00143     }
00144     currentSet = currentLevel / ARENAS_PER_TIER;
00145 
00146     if( levelSet > currentSet || levelSet == UI_GetNumSPTiers() ) {
00147         level = currentLevel;
00148     }
00149 
00150     arenaInfo = UI_GetArenaInfoByNumber( level );
00151     if ( !arenaInfo ) {
00152         return;
00153     }
00154 
00155     UI_SPArena_Start( arenaInfo );
00156 }
00157 
00158 
00159 /*
00160 =================
00161 UI_SPPostgameMenu_MenuEvent
00162 =================
00163 */
00164 static void UI_SPPostgameMenu_MenuEvent( void* ptr, int event )
00165 {
00166     if (event != QM_ACTIVATED) {
00167         return;
00168     }
00169     UI_PopMenu();
00170     trap_Cmd_ExecuteText( EXEC_APPEND, "disconnect; levelselect\n" );
00171 }
00172 
00173 
00174 /*
00175 =================
00176 UI_SPPostgameMenu_MenuKey
00177 =================
00178 */
00179 static sfxHandle_t UI_SPPostgameMenu_MenuKey( int key ) {
00180     if ( uis.realtime < postgameMenuInfo.ignoreKeysTime ) {
00181         return 0;
00182     }
00183 
00184     if( postgameMenuInfo.phase == 1 ) {
00185         trap_Cmd_ExecuteText( EXEC_APPEND, "abort_podium\n" );
00186         postgameMenuInfo.phase = 2;
00187         postgameMenuInfo.starttime = uis.realtime;
00188         postgameMenuInfo.ignoreKeysTime = uis.realtime + 250;
00189         return 0;
00190     }
00191 
00192     if( postgameMenuInfo.phase == 2 ) {
00193         postgameMenuInfo.phase = 3;
00194         postgameMenuInfo.starttime = uis.realtime;
00195         postgameMenuInfo.ignoreKeysTime = uis.realtime + 250;
00196         return 0;
00197     }
00198 
00199     if( key == K_ESCAPE || key == K_MOUSE2 ) {
00200         return 0;
00201     }
00202 
00203     return Menu_DefaultKey( &postgameMenuInfo.menu, key );
00204 }
00205 
00206 
00207 static int medalLocations[6] = {144, 448, 88, 504, 32, 560};
00208 
00209 static void UI_SPPostgameMenu_DrawAwardsMedals( int max ) {
00210     int     n;
00211     int     medal;
00212     int     amount;
00213     int     x, y;
00214     char    buf[16];
00215 
00216     for( n = 0; n < max; n++ ) {
00217         x = medalLocations[n];
00218         y = 64;
00219         medal = postgameMenuInfo.awardsEarned[n];
00220         amount = postgameMenuInfo.awardsLevels[n];
00221 
00222         UI_DrawNamedPic( x, y, 48, 48, ui_medalPicNames[medal] );
00223 
00224         if( medal == AWARD_ACCURACY ) {
00225             Com_sprintf( buf, sizeof(buf), "%i%%", amount );
00226         }
00227         else {
00228             if( amount == 1 ) {
00229                 continue;
00230             }
00231             Com_sprintf( buf, sizeof(buf), "%i", amount );
00232         }
00233 
00234         UI_DrawString( x + 24, y + 52, buf, UI_CENTER, color_yellow );
00235     }
00236 }
00237 
00238 
00239 static void UI_SPPostgameMenu_DrawAwardsPresentation( int timer ) {
00240     int     awardNum;
00241     int     atimer;
00242     vec4_t  color;
00243 
00244     awardNum = timer / AWARD_PRESENTATION_TIME;
00245     atimer = timer % AWARD_PRESENTATION_TIME;
00246 
00247     color[0] = color[1] = color[2] = 1.0f;
00248     color[3] = (float)( AWARD_PRESENTATION_TIME - atimer ) / (float)AWARD_PRESENTATION_TIME;
00249     UI_DrawProportionalString( 320, 64, ui_medalNames[postgameMenuInfo.awardsEarned[awardNum]], UI_CENTER, color );
00250 
00251     UI_SPPostgameMenu_DrawAwardsMedals( awardNum + 1 );
00252 
00253     if( !postgameMenuInfo.playedSound[awardNum] ) {
00254         postgameMenuInfo.playedSound[awardNum] = qtrue;
00255         trap_S_StartLocalSound( trap_S_RegisterSound( ui_medalSounds[postgameMenuInfo.awardsEarned[awardNum]], qfalse ), CHAN_ANNOUNCER );
00256     }
00257 }
00258 
00259 
00260 /*
00261 =================
00262 UI_SPPostgameMenu_MenuDrawScoreLine
00263 =================
00264 */
00265 static void UI_SPPostgameMenu_MenuDrawScoreLine( int n, int y ) {
00266     int     rank;
00267     char    name[64];
00268     char    info[MAX_INFO_STRING];
00269 
00270     if( n > (postgameMenuInfo.numClients + 1) ) {
00271         n -= (postgameMenuInfo.numClients + 2);
00272     }
00273 
00274     if( n >= postgameMenuInfo.numClients ) {
00275         return;
00276     }
00277 
00278     rank = postgameMenuInfo.ranks[n];
00279     if( rank & RANK_TIED_FLAG ) {
00280         UI_DrawString( 640 - 31 * SMALLCHAR_WIDTH, y, "(tie)", UI_LEFT|UI_SMALLFONT, color_white );
00281         rank &= ~RANK_TIED_FLAG;
00282     }
00283     trap_GetConfigString( CS_PLAYERS + postgameMenuInfo.clientNums[n], info, MAX_INFO_STRING );
00284     Q_strncpyz( name, Info_ValueForKey( info, "n" ), sizeof(name) );
00285     Q_CleanStr( name );
00286 
00287     UI_DrawString( 640 - 25 * SMALLCHAR_WIDTH, y, va( "#%i: %-16s %2i", rank + 1, name, postgameMenuInfo.scores[n] ), UI_LEFT|UI_SMALLFONT, color_white );
00288 }
00289 
00290 
00291 /*
00292 =================
00293 UI_SPPostgameMenu_MenuDraw
00294 =================
00295 */
00296 static void UI_SPPostgameMenu_MenuDraw( void ) {
00297     int     timer;
00298     int     serverId;
00299     int     n;
00300     char    info[MAX_INFO_STRING];
00301 
00302     trap_GetConfigString( CS_SYSTEMINFO, info, sizeof(info) );
00303     serverId = atoi( Info_ValueForKey( info, "sv_serverid" ) );
00304     if( serverId != postgameMenuInfo.serverId ) {
00305         UI_PopMenu();
00306         return;
00307     }
00308 
00309     // phase 1
00310     if ( postgameMenuInfo.numClients > 2 ) {
00311         UI_DrawProportionalString( 510, 480 - 64 - PROP_HEIGHT, postgameMenuInfo.placeNames[2], UI_CENTER, color_white );
00312     }
00313     UI_DrawProportionalString( 130, 480 - 64 - PROP_HEIGHT, postgameMenuInfo.placeNames[1], UI_CENTER, color_white );
00314     UI_DrawProportionalString( 320, 480 - 64 - 2 * PROP_HEIGHT, postgameMenuInfo.placeNames[0], UI_CENTER, color_white );
00315 
00316     if( postgameMenuInfo.phase == 1 ) {
00317         timer = uis.realtime - postgameMenuInfo.starttime;
00318 
00319         if( timer >= 1000 && postgameMenuInfo.winnerSound ) {
00320             trap_S_StartLocalSound( postgameMenuInfo.winnerSound, CHAN_ANNOUNCER );
00321             postgameMenuInfo.winnerSound = 0;
00322         }
00323 
00324         if( timer < 5000 ) {
00325             return;
00326         }
00327         postgameMenuInfo.phase = 2;
00328         postgameMenuInfo.starttime = uis.realtime;
00329     }
00330 
00331     // phase 2
00332     if( postgameMenuInfo.phase == 2 ) {
00333         timer = uis.realtime - postgameMenuInfo.starttime;
00334         if( timer >= ( postgameMenuInfo.numAwards * AWARD_PRESENTATION_TIME ) ) {
00335 
00336             if( timer < 5000 ) {
00337                 return;
00338             }
00339 
00340             postgameMenuInfo.phase = 3;
00341             postgameMenuInfo.starttime = uis.realtime;
00342         }
00343         else {
00344             UI_SPPostgameMenu_DrawAwardsPresentation( timer );
00345         }
00346     }
00347 
00348     // phase 3
00349     if( postgameMenuInfo.phase == 3 ) {
00350         if( uis.demoversion ) {
00351             if( postgameMenuInfo.won == 1 && UI_ShowTierVideo( 8 )) {
00352                 trap_Cvar_Set( "nextmap", "" );
00353                 trap_Cmd_ExecuteText( EXEC_APPEND, "disconnect; cinematic demoEnd.RoQ\n" );
00354                 return;
00355             }
00356         }
00357         else if( postgameMenuInfo.won > -1 && UI_ShowTierVideo( postgameMenuInfo.won + 1 )) {
00358             if( postgameMenuInfo.won == postgameMenuInfo.lastTier ) {
00359                 trap_Cvar_Set( "nextmap", "" );
00360                 trap_Cmd_ExecuteText( EXEC_APPEND, "disconnect; cinematic end.RoQ\n" );
00361                 return;
00362             }
00363 
00364             trap_Cvar_SetValue( "ui_spSelection", postgameMenuInfo.won * ARENAS_PER_TIER );
00365             trap_Cvar_Set( "nextmap", "levelselect" );
00366             trap_Cmd_ExecuteText( EXEC_APPEND, va( "disconnect; cinematic tier%i.RoQ\n", postgameMenuInfo.won + 1 ) );
00367             return;
00368         }
00369 
00370         postgameMenuInfo.item_again.generic.flags &= ~QMF_INACTIVE;
00371         postgameMenuInfo.item_next.generic.flags &= ~QMF_INACTIVE;
00372         postgameMenuInfo.item_menu.generic.flags &= ~QMF_INACTIVE;
00373 
00374         UI_SPPostgameMenu_DrawAwardsMedals( postgameMenuInfo.numAwards );
00375 
00376         Menu_Draw( &postgameMenuInfo.menu );
00377     }
00378 
00379     // draw the scoreboard
00380     if( !trap_Cvar_VariableValue( "ui_spScoreboard" ) ) {
00381         return;
00382     }
00383 
00384     timer = uis.realtime - postgameMenuInfo.scoreboardtime;
00385     if( postgameMenuInfo.numClients <= 3 ) {
00386         n = 0;
00387     }
00388     else {
00389         n = timer / 1500 % (postgameMenuInfo.numClients + 2);
00390     }
00391     UI_SPPostgameMenu_MenuDrawScoreLine( n, 0 );
00392     UI_SPPostgameMenu_MenuDrawScoreLine( n + 1, 0 + SMALLCHAR_HEIGHT );
00393     UI_SPPostgameMenu_MenuDrawScoreLine( n + 2, 0 + 2 * SMALLCHAR_HEIGHT );
00394 }
00395 
00396 
00397 /*
00398 =================
00399 UI_SPPostgameMenu_Cache
00400 =================
00401 */
00402 void UI_SPPostgameMenu_Cache( void ) {
00403     int         n;
00404     qboolean    buildscript;
00405 
00406     buildscript = trap_Cvar_VariableValue("com_buildscript");
00407 
00408     trap_R_RegisterShaderNoMip( ART_MENU0 );
00409     trap_R_RegisterShaderNoMip( ART_MENU1 );
00410     trap_R_RegisterShaderNoMip( ART_REPLAY0 );
00411     trap_R_RegisterShaderNoMip( ART_REPLAY1 );
00412     trap_R_RegisterShaderNoMip( ART_NEXT0 );
00413     trap_R_RegisterShaderNoMip( ART_NEXT1 );
00414     for( n = 0; n < 6; n++ ) {
00415         trap_R_RegisterShaderNoMip( ui_medalPicNames[n] );
00416         trap_S_RegisterSound( ui_medalSounds[n], qfalse );
00417     }
00418 
00419     if( buildscript ) {
00420         trap_S_RegisterSound( "music/loss.wav", qfalse );
00421         trap_S_RegisterSound( "music/win.wav", qfalse );
00422         trap_S_RegisterSound( "sound/player/announce/youwin.wav", qfalse );
00423     }
00424 }
00425 
00426 
00427 /*
00428 =================
00429 UI_SPPostgameMenu_Init
00430 =================
00431 */
00432 static void UI_SPPostgameMenu_Init( void ) {
00433     postgameMenuInfo.menu.wrapAround    = qtrue;
00434     postgameMenuInfo.menu.key           = UI_SPPostgameMenu_MenuKey;
00435     postgameMenuInfo.menu.draw          = UI_SPPostgameMenu_MenuDraw;
00436     postgameMenuInfo.ignoreKeysTime     = uis.realtime + 1500;
00437 
00438     UI_SPPostgameMenu_Cache();
00439 
00440     postgameMenuInfo.item_menu.generic.type         = MTYPE_BITMAP;
00441     postgameMenuInfo.item_menu.generic.name         = ART_MENU0;
00442     postgameMenuInfo.item_menu.generic.flags        = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS|QMF_INACTIVE;
00443     postgameMenuInfo.item_menu.generic.x            = 0;
00444     postgameMenuInfo.item_menu.generic.y            = 480-64;
00445     postgameMenuInfo.item_menu.generic.callback     = UI_SPPostgameMenu_MenuEvent;
00446     postgameMenuInfo.item_menu.generic.id           = ID_MENU;
00447     postgameMenuInfo.item_menu.width                = 128;
00448     postgameMenuInfo.item_menu.height               = 64;
00449     postgameMenuInfo.item_menu.focuspic             = ART_MENU1;
00450 
00451     postgameMenuInfo.item_again.generic.type        = MTYPE_BITMAP;
00452     postgameMenuInfo.item_again.generic.name        = ART_REPLAY0;
00453     postgameMenuInfo.item_again.generic.flags       = QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS|QMF_INACTIVE;
00454     postgameMenuInfo.item_again.generic.x           = 320;
00455     postgameMenuInfo.item_again.generic.y           = 480-64;
00456     postgameMenuInfo.item_again.generic.callback    = UI_SPPostgameMenu_AgainEvent;
00457     postgameMenuInfo.item_again.generic.id          = ID_AGAIN;
00458     postgameMenuInfo.item_again.width               = 128;
00459     postgameMenuInfo.item_again.height              = 64;
00460     postgameMenuInfo.item_again.focuspic            = ART_REPLAY1;
00461 
00462     postgameMenuInfo.item_next.generic.type         = MTYPE_BITMAP;
00463     postgameMenuInfo.item_next.generic.name         = ART_NEXT0;
00464     postgameMenuInfo.item_next.generic.flags        = QMF_RIGHT_JUSTIFY|QMF_PULSEIFFOCUS|QMF_INACTIVE;
00465     postgameMenuInfo.item_next.generic.x            = 640;
00466     postgameMenuInfo.item_next.generic.y            = 480-64;
00467     postgameMenuInfo.item_next.generic.callback     = UI_SPPostgameMenu_NextEvent;
00468     postgameMenuInfo.item_next.generic.id           = ID_NEXT;
00469     postgameMenuInfo.item_next.width                = 128;
00470     postgameMenuInfo.item_next.height               = 64;
00471     postgameMenuInfo.item_next.focuspic             = ART_NEXT1;
00472 
00473     Menu_AddItem( &postgameMenuInfo.menu, ( void * )&postgameMenuInfo.item_menu );
00474     Menu_AddItem( &postgameMenuInfo.menu, ( void * )&postgameMenuInfo.item_again );
00475     Menu_AddItem( &postgameMenuInfo.menu, ( void * )&postgameMenuInfo.item_next );
00476 }
00477 
00478 
00479 static void Prepname( int index ) {
00480     int     len;
00481     char    name[64];
00482     char    info[MAX_INFO_STRING];
00483 
00484     trap_GetConfigString( CS_PLAYERS + postgameMenuInfo.clientNums[index], info, MAX_INFO_STRING );
00485     Q_strncpyz( name, Info_ValueForKey( info, "n" ), sizeof(name) );
00486     Q_CleanStr( name );
00487     len = strlen( name );
00488 
00489     while( len && UI_ProportionalStringWidth( name ) > 256 ) {
00490         len--;
00491         name[len] = 0;
00492     }
00493 
00494     Q_strncpyz( postgameMenuInfo.placeNames[index], name, sizeof(postgameMenuInfo.placeNames[index]) );
00495 }
00496 
00497 
00498 /*
00499 =================
00500 UI_SPPostgameMenu_f
00501 =================
00502 */
00503 void UI_SPPostgameMenu_f( void ) {
00504     int         playerGameRank;
00505     int         playerClientNum;
00506     int         n;
00507     int         oldFrags, newFrags;
00508     const char  *arena;
00509     int         awardValues[6];
00510     char        map[MAX_QPATH];
00511     char        info[MAX_INFO_STRING];
00512 
00513     memset( &postgameMenuInfo, 0, sizeof(postgameMenuInfo) );
00514 
00515     trap_GetConfigString( CS_SYSTEMINFO, info, sizeof(info) );
00516     postgameMenuInfo.serverId = atoi( Info_ValueForKey( info, "sv_serverid" ) );
00517 
00518     trap_GetConfigString( CS_SERVERINFO, info, sizeof(info) );
00519     Q_strncpyz( map, Info_ValueForKey( info, "mapname" ), sizeof(map) );
00520     arena = UI_GetArenaInfoByMap( map );
00521     if ( !arena ) {
00522         return;
00523     }
00524     Q_strncpyz( arenainfo, arena, sizeof(arenainfo) );
00525 
00526     postgameMenuInfo.level = atoi( Info_ValueForKey( arenainfo, "num" ) );
00527 
00528     postgameMenuInfo.numClients = atoi( UI_Argv( 1 ) );
00529     playerClientNum = atoi( UI_Argv( 2 ) );
00530     playerGameRank = 8;     // in case they ended game as a spectator
00531 
00532     if( postgameMenuInfo.numClients > MAX_SCOREBOARD_CLIENTS ) {
00533         postgameMenuInfo.numClients = MAX_SCOREBOARD_CLIENTS;
00534     }
00535 
00536     for( n = 0; n < postgameMenuInfo.numClients; n++ ) {
00537         postgameMenuInfo.clientNums[n] = atoi( UI_Argv( 8 + n * 3 + 1 ) );
00538         postgameMenuInfo.ranks[n] = atoi( UI_Argv( 8 + n * 3 + 2 ) );
00539         postgameMenuInfo.scores[n] = atoi( UI_Argv( 8 + n * 3 + 3 ) );
00540 
00541         if( postgameMenuInfo.clientNums[n] == playerClientNum ) {
00542             playerGameRank = (postgameMenuInfo.ranks[n] & ~RANK_TIED_FLAG) + 1;
00543         }
00544     }
00545 
00546     UI_SetBestScore( postgameMenuInfo.level, playerGameRank );
00547 
00548     // process award stats and prepare presentation data
00549     awardValues[AWARD_ACCURACY] = atoi( UI_Argv( 3 ) );
00550     awardValues[AWARD_IMPRESSIVE] = atoi( UI_Argv( 4 ) );
00551     awardValues[AWARD_EXCELLENT] = atoi( UI_Argv( 5 ) );
00552     awardValues[AWARD_GAUNTLET] = atoi( UI_Argv( 6 ) );
00553     awardValues[AWARD_FRAGS] = atoi( UI_Argv( 7 ) );
00554     awardValues[AWARD_PERFECT] = atoi( UI_Argv( 8 ) );
00555 
00556     postgameMenuInfo.numAwards = 0;
00557 
00558     if( awardValues[AWARD_ACCURACY] >= 50 ) {
00559         UI_LogAwardData( AWARD_ACCURACY, 1 );
00560         postgameMenuInfo.awardsEarned[postgameMenuInfo.numAwards] = AWARD_ACCURACY;
00561         postgameMenuInfo.awardsLevels[postgameMenuInfo.numAwards] = awardValues[AWARD_ACCURACY];
00562         postgameMenuInfo.numAwards++;
00563     }
00564 
00565     if( awardValues[AWARD_IMPRESSIVE] ) {
00566         UI_LogAwardData( AWARD_IMPRESSIVE, awardValues[AWARD_IMPRESSIVE] );
00567         postgameMenuInfo.awardsEarned[postgameMenuInfo.numAwards] = AWARD_IMPRESSIVE;
00568         postgameMenuInfo.awardsLevels[postgameMenuInfo.numAwards] = awardValues[AWARD_IMPRESSIVE];
00569         postgameMenuInfo.numAwards++;
00570     }
00571 
00572     if( awardValues[AWARD_EXCELLENT] ) {
00573         UI_LogAwardData( AWARD_EXCELLENT, awardValues[AWARD_EXCELLENT] );
00574         postgameMenuInfo.awardsEarned[postgameMenuInfo.numAwards] = AWARD_EXCELLENT;
00575         postgameMenuInfo.awardsLevels[postgameMenuInfo.numAwards] = awardValues[AWARD_EXCELLENT];
00576         postgameMenuInfo.numAwards++;
00577     }
00578 
00579     if( awardValues[AWARD_GAUNTLET] ) {
00580         UI_LogAwardData( AWARD_GAUNTLET, awardValues[AWARD_GAUNTLET] );
00581         postgameMenuInfo.awardsEarned[postgameMenuInfo.numAwards] = AWARD_GAUNTLET;
00582         postgameMenuInfo.awardsLevels[postgameMenuInfo.numAwards] = awardValues[AWARD_GAUNTLET];
00583         postgameMenuInfo.numAwards++;
00584     }
00585 
00586     oldFrags = UI_GetAwardLevel( AWARD_FRAGS ) / 100;
00587     UI_LogAwardData( AWARD_FRAGS, awardValues[AWARD_FRAGS] );
00588     newFrags = UI_GetAwardLevel( AWARD_FRAGS ) / 100;
00589     if( newFrags > oldFrags ) {
00590         postgameMenuInfo.awardsEarned[postgameMenuInfo.numAwards] = AWARD_FRAGS;
00591         postgameMenuInfo.awardsLevels[postgameMenuInfo.numAwards] = newFrags * 100;
00592         postgameMenuInfo.numAwards++;
00593     }
00594 
00595     if( awardValues[AWARD_PERFECT] ) {
00596         UI_LogAwardData( AWARD_PERFECT, 1 );
00597         postgameMenuInfo.awardsEarned[postgameMenuInfo.numAwards] = AWARD_PERFECT;
00598         postgameMenuInfo.awardsLevels[postgameMenuInfo.numAwards] = 1;
00599         postgameMenuInfo.numAwards++;
00600     }
00601 
00602     if ( playerGameRank == 1 ) {
00603         postgameMenuInfo.won = UI_TierCompleted( postgameMenuInfo.level );
00604     }
00605     else {
00606         postgameMenuInfo.won = -1;
00607     }
00608 
00609     postgameMenuInfo.starttime = uis.realtime;
00610     postgameMenuInfo.scoreboardtime = uis.realtime;
00611 
00612     trap_Key_SetCatcher( KEYCATCH_UI );
00613     uis.menusp = 0;
00614 
00615     UI_SPPostgameMenu_Init();
00616     UI_PushMenu( &postgameMenuInfo.menu );
00617 
00618     if ( playerGameRank == 1 ) {
00619         Menu_SetCursorToItem( &postgameMenuInfo.menu, &postgameMenuInfo.item_next );
00620     }
00621     else {
00622         Menu_SetCursorToItem( &postgameMenuInfo.menu, &postgameMenuInfo.item_again );
00623     }
00624 
00625     Prepname( 0 );
00626     Prepname( 1 );
00627     Prepname( 2 );
00628 
00629     if ( playerGameRank != 1 ) {
00630         postgameMenuInfo.winnerSound = trap_S_RegisterSound( va( "sound/player/announce/%s_wins.wav", postgameMenuInfo.placeNames[0] ), qfalse );
00631         trap_Cmd_ExecuteText( EXEC_APPEND, "music music/loss\n" );
00632     }
00633     else {
00634         postgameMenuInfo.winnerSound = trap_S_RegisterSound( "sound/player/announce/youwin.wav", qfalse );
00635         trap_Cmd_ExecuteText( EXEC_APPEND, "music music/win\n" );
00636     }
00637 
00638     postgameMenuInfo.phase = 1;
00639 
00640     postgameMenuInfo.lastTier = UI_GetNumSPTiers();
00641     if ( UI_GetSpecialArenaInfo( "final" ) ) {
00642         postgameMenuInfo.lastTier++;
00643     }
00644 }

Generated on Thu Aug 25 12:37:44 2005 for Quake III Arena by  doxygen 1.3.9.1