#include "ui_local.h"
Include dependency graph for ui_sppostgame.c:

Go to the source code of this file.
Data Structures | |
| struct | postgameMenuInfo_t |
Defines | |
| #define | ART_MENU0 "menu/art/menu_0" |
| #define | ART_MENU1 "menu/art/menu_1" |
| #define | ART_NEXT0 "menu/art/next_0" |
| #define | ART_NEXT1 "menu/art/next_1" |
| #define | ART_REPLAY0 "menu/art/replay_0" |
| #define | ART_REPLAY1 "menu/art/replay_1" |
| #define | AWARD_PRESENTATION_TIME 2000 |
| #define | ID_AGAIN 10 |
| #define | ID_MENU 12 |
| #define | ID_NEXT 11 |
| #define | MAX_SCOREBOARD_CLIENTS 8 |
Functions | |
| void | Prepname (int index) |
| void | UI_SPPostgameMenu_AgainEvent (void *ptr, int event) |
| void | UI_SPPostgameMenu_Cache (void) |
| void | UI_SPPostgameMenu_DrawAwardsMedals (int max) |
| void | UI_SPPostgameMenu_DrawAwardsPresentation (int timer) |
| void | UI_SPPostgameMenu_f (void) |
| void | UI_SPPostgameMenu_Init (void) |
| void | UI_SPPostgameMenu_MenuDraw (void) |
| void | UI_SPPostgameMenu_MenuDrawScoreLine (int n, int y) |
| void | UI_SPPostgameMenu_MenuEvent (void *ptr, int event) |
| sfxHandle_t | UI_SPPostgameMenu_MenuKey (int key) |
| void | UI_SPPostgameMenu_NextEvent (void *ptr, int event) |
Variables | |
| char | arenainfo [MAX_INFO_VALUE] |
| int | medalLocations [6] = {144, 448, 88, 504, 32, 560} |
| postgameMenuInfo_t | postgameMenuInfo |
| char * | ui_medalNames [] = {"Accuracy", "Impressive", "Excellent", "Gauntlet", "Frags", "Perfect"} |
| char * | ui_medalPicNames [] |
| char * | ui_medalSounds [] |
|
|
Definition at line 37 of file ui_sppostgame.c. Referenced by UI_SPPostgameMenu_Cache(). |
|
|
Definition at line 38 of file ui_sppostgame.c. Referenced by UI_SPPostgameMenu_Cache(). |
|
|
Definition at line 41 of file ui_sppostgame.c. Referenced by UI_SPPostgameMenu_Cache(). |
|
|
Definition at line 42 of file ui_sppostgame.c. Referenced by UI_SPPostgameMenu_Cache(). |
|
|
Definition at line 39 of file ui_sppostgame.c. Referenced by UI_SPPostgameMenu_Cache(). |
|
|
Definition at line 40 of file ui_sppostgame.c. Referenced by UI_SPPostgameMenu_Cache(). |
|
|
Definition at line 35 of file ui_sppostgame.c. Referenced by UI_SPPostgameMenu_DrawAwardsPresentation(). |
|
|
Definition at line 44 of file ui_sppostgame.c. |
|
|
Definition at line 46 of file ui_sppostgame.c. |
|
|
Definition at line 45 of file ui_sppostgame.c. |
|
|
Definition at line 33 of file ui_sppostgame.c. |
|
|
Definition at line 479 of file ui_sppostgame.c. References postgameMenuInfo_t::clientNums, CS_PLAYERS, Info_ValueForKey(), MAX_INFO_STRING, name, postgameMenuInfo_t::placeNames, postgameMenuInfo, Q_CleanStr(), Q_strncpyz(), strlen(), trap_GetConfigString(), and UI_ProportionalStringWidth(). Referenced by UI_SPPostgameMenu_f(). 00479 {
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 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 104 of file ui_sppostgame.c. References EXEC_APPEND, trap_Cmd_ExecuteText(), and UI_PopMenu(). 00105 {
00106 if (event != QM_ACTIVATED) {
00107 return;
00108 }
00109 UI_PopMenu();
00110 trap_Cmd_ExecuteText( EXEC_APPEND, "map_restart 0\n" );
00111 }
|
Here is the call graph for this function:

|
|
Definition at line 402 of file ui_sppostgame.c. References ART_MENU0, ART_MENU1, ART_NEXT0, ART_NEXT1, ART_REPLAY0, ART_REPLAY1, n, qboolean, qfalse, trap_Cvar_VariableValue(), trap_R_RegisterShaderNoMip(), trap_S_RegisterSound(), ui_medalPicNames, and ui_medalSounds. 00402 {
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 }
|
Here is the call graph for this function:

|
|
Definition at line 209 of file ui_sppostgame.c. References postgameMenuInfo_t::awardsEarned, postgameMenuInfo_t::awardsLevels, color_yellow, Com_sprintf(), medalLocations, n, postgameMenuInfo, UI_CENTER, UI_DrawNamedPic(), UI_DrawString(), ui_medalPicNames, x, and y. Referenced by UI_SPPostgameMenu_DrawAwardsPresentation(), and UI_SPPostgameMenu_MenuDraw(). 00209 {
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 }
|
Here is the call graph for this function:

|
|
Definition at line 239 of file ui_sppostgame.c. References AWARD_PRESENTATION_TIME, postgameMenuInfo_t::awardsEarned, CHAN_ANNOUNCER, postgameMenuInfo_t::playedSound, postgameMenuInfo, qfalse, trap_S_RegisterSound(), trap_S_StartLocalSound(), UI_CENTER, UI_DrawProportionalString(), ui_medalNames, ui_medalSounds, and UI_SPPostgameMenu_DrawAwardsMedals(). Referenced by UI_SPPostgameMenu_MenuDraw(). 00239 {
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 }
|
Here is the call graph for this function:

|
|
Definition at line 503 of file ui_sppostgame.c. References arenainfo, atoi, AWARD_ACCURACY, AWARD_EXCELLENT, AWARD_FRAGS, AWARD_GAUNTLET, AWARD_IMPRESSIVE, AWARD_PERFECT, postgameMenuInfo_t::awardsEarned, postgameMenuInfo_t::awardsLevels, postgameMenuInfo_t::clientNums, CS_SERVERINFO, CS_SYSTEMINFO, EXEC_APPEND, Info_ValueForKey(), postgameMenuInfo_t::item_again, postgameMenuInfo_t::item_next, KEYCATCH_UI, postgameMenuInfo_t::lastTier, postgameMenuInfo_t::level, memset(), postgameMenuInfo_t::menu, Menu_SetCursorToItem(), uiStatic_t::menusp, n, postgameMenuInfo_t::numAwards, postgameMenuInfo_t::numClients, postgameMenuInfo_t::phase, postgameMenuInfo_t::placeNames, postgameMenuInfo, Prepname(), Q_strncpyz(), qfalse, postgameMenuInfo_t::ranks, uiStatic_t::realtime, postgameMenuInfo_t::scoreboardtime, postgameMenuInfo_t::scores, postgameMenuInfo_t::serverId, postgameMenuInfo_t::starttime, trap_Cmd_ExecuteText(), trap_GetConfigString(), trap_Key_SetCatcher(), trap_S_RegisterSound(), UI_Argv(), UI_GetArenaInfoByMap(), UI_GetAwardLevel(), UI_GetNumSPTiers(), UI_GetSpecialArenaInfo(), UI_LogAwardData(), UI_PushMenu(), UI_SetBestScore(), UI_SPPostgameMenu_Init(), UI_TierCompleted(), uis, va(), postgameMenuInfo_t::winnerSound, and postgameMenuInfo_t::won. 00503 {
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 }
|
Here is the call graph for this function:

|
Here is the call graph for this function:

|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 265 of file ui_sppostgame.c. References postgameMenuInfo_t::clientNums, color_white, CS_PLAYERS, Info_ValueForKey(), MAX_INFO_STRING, n, name, postgameMenuInfo_t::numClients, postgameMenuInfo, Q_CleanStr(), Q_strncpyz(), postgameMenuInfo_t::ranks, postgameMenuInfo_t::scores, SMALLCHAR_WIDTH, trap_GetConfigString(), UI_DrawString(), UI_LEFT, UI_SMALLFONT, va(), and y. Referenced by UI_SPPostgameMenu_MenuDraw(). 00265 {
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 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 164 of file ui_sppostgame.c. References EXEC_APPEND, trap_Cmd_ExecuteText(), and UI_PopMenu(). 00165 {
00166 if (event != QM_ACTIVATED) {
00167 return;
00168 }
00169 UI_PopMenu();
00170 trap_Cmd_ExecuteText( EXEC_APPEND, "disconnect; levelselect\n" );
00171 }
|
Here is the call graph for this function:

|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 119 of file ui_sppostgame.c. References postgameMenuInfo_t::level, level, postgameMenuInfo, UI_GetArenaInfoByNumber(), UI_GetCurrentGame(), UI_GetNumSPTiers(), UI_PopMenu(), UI_SPArena_Start(), and postgameMenuInfo_t::won. 00119 {
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 }
|
Here is the call graph for this function:
