Debian Codegraph @

code/q3_ui/ui_sppostgame.c

raw
1 /*
2 ===========================================================================
3 Copyright (C) 1999-2005 Id Software, Inc.
4
5 This file is part of Quake III Arena source code.
6
7 Quake III Arena source code is free software; you can redistribute it
8 and/or modify it under the terms of the GNU General Public License as
9 published by the Free Software Foundation; either version 2 of the License,
10 or (at your option) any later version.
11
12 Quake III Arena source code is distributed in the hope that it will be
13 useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with Quake III Arena source code; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 ===========================================================================
21 */
22 //
23 /*
24 =============================================================================
25
26 SINGLE PLAYER POSTGAME MENU
27
28 =============================================================================
29 */
30
31 #include "ui_local.h"
32
33 #define MAX_SCOREBOARD_CLIENTS 8
34
35 #define AWARD_PRESENTATION_TIME 2000
36
37 #define ART_MENU0 "menu/art_blueish/menu_0"
38 #define ART_MENU1 "menu/art_blueish/menu_1"
39 #define ART_REPLAY0 "menu/art_blueish/replay_0"
40 #define ART_REPLAY1 "menu/art_blueish/replay_1"
41 #define ART_NEXT0 "menu/art_blueish/next_0"
42 #define ART_NEXT1 "menu/art_blueish/next_1"
43
44 #define ID_AGAIN 10
45 #define ID_NEXT 11
46 #define ID_MENU 12
47
48 typedef struct {
49 menuframework_s menu;
50 menubitmap_s item_again;
51 menubitmap_s item_next;
52 menubitmap_s item_menu;
53
54 int phase;
55 int ignoreKeysTime;
56 int starttime;
57 int scoreboardtime;
58 int serverId;
59
60 int clientNums[MAX_SCOREBOARD_CLIENTS];
61 int ranks[MAX_SCOREBOARD_CLIENTS];
62 int scores[MAX_SCOREBOARD_CLIENTS];
63
64 char placeNames[3][64];
65
66 int level;
67 int numClients;
68 int won;
69 int numAwards;
70 int awardsEarned[6];
71 int awardsLevels[6];
72 qboolean playedSound[6];
73 int lastTier;
74 sfxHandle_t winnerSound;
75 } postgameMenuInfo_t;
76
77 static postgameMenuInfo_t postgameMenuInfo;
78 static char arenainfo[MAX_INFO_VALUE];
79
80 char *ui_medalNames[] = {"Accuracy", "Impressive", "Excellent", "Gauntlet", "Frags", "Perfect"};
81 char *ui_medalPicNames[] = {
82 "menu/medals/medal_accuracy",
83 "menu/medals/medal_impressive",
84 "menu/medals/medal_excellent",
85 "menu/medals/medal_gauntlet",
86 "menu/medals/medal_frags",
87 "menu/medals/medal_victory"
88 };
89 char *ui_medalSounds[] = {
90 "sound/feedback/accuracy.wav",
91 "sound/feedback/impressive_a.wav",
92 "sound/feedback/excellent_a.wav",
93 "sound/feedback/gauntlet.wav",
94 "sound/feedback/frags.wav",
95 "sound/feedback/perfect.wav"
96 };
97
98
99 /*
100 =================
101 UI_SPPostgameMenu_AgainEvent
102 =================
103 */
104 static void UI_SPPostgameMenu_AgainEvent( void* ptr, int event )
105 {
106 if (event != QM_ACTIVATED) {
107 return;
108 }
109 UI_PopMenu();
110 trap_Cmd_ExecuteText( EXEC_APPEND, "map_restart 0\n" );
111 }
112
113
114 /*
115 =================
116 UI_SPPostgameMenu_NextEvent
117 =================
118 */
119 static void UI_SPPostgameMenu_NextEvent( void* ptr, int event ) {
120 int currentSet;
121 int levelSet;
122 int level;
123 int currentLevel;
124 const char *arenaInfo;
125
126 if (event != QM_ACTIVATED) {
127 return;
128 }
129 UI_PopMenu();
130
131 // handle specially if we just won the training map
132 if( postgameMenuInfo.won == 0 ) {
133 level = 0;
134 }
135 else {
136 level = postgameMenuInfo.level + 1;
137 }
138 levelSet = level / ARENAS_PER_TIER;
139
140 currentLevel = UI_GetCurrentGame();
141 if( currentLevel == -1 ) {
142 currentLevel = postgameMenuInfo.level;
143 }
144 currentSet = currentLevel / ARENAS_PER_TIER;
145
146 if( levelSet > currentSet || levelSet == UI_GetNumSPTiers() ) {
147 level = currentLevel;
148 }
149
150 arenaInfo = UI_GetArenaInfoByNumber( level );
151 if ( !arenaInfo ) {
152 return;
153 }
154
155 UI_SPArena_Start( arenaInfo );
156 }
157
158
159 /*
160 =================
161 UI_SPPostgameMenu_MenuEvent
162 =================
163 */
164 static void UI_SPPostgameMenu_MenuEvent( void* ptr, int event )
165 {
166 if (event != QM_ACTIVATED) {
167 return;
168 }
169 UI_PopMenu();
170 trap_Cvar_Set( "nextmap", "" );
171 trap_Cmd_ExecuteText( EXEC_APPEND, "disconnect; levelselect\n" );
172 }
173
174
175 /*
176 =================
177 UI_SPPostgameMenu_MenuKey
178 =================
179 */
180 static sfxHandle_t UI_SPPostgameMenu_MenuKey( int key ) {
181 if ( uis.realtime < postgameMenuInfo.ignoreKeysTime ) {
182 return 0;
183 }
184
185 if( postgameMenuInfo.phase == 1 ) {
186 trap_Cmd_ExecuteText( EXEC_APPEND, "abort_podium\n" );
187 postgameMenuInfo.phase = 2;
188 postgameMenuInfo.starttime = uis.realtime;
189 postgameMenuInfo.ignoreKeysTime = uis.realtime + 250;
190 return 0;
191 }
192
193 if( postgameMenuInfo.phase == 2 ) {
194 postgameMenuInfo.phase = 3;
195 postgameMenuInfo.starttime = uis.realtime;
196 postgameMenuInfo.ignoreKeysTime = uis.realtime + 250;
197 return 0;
198 }
199
200 if( key == K_ESCAPE || key == K_MOUSE2 ) {
201 return 0;
202 }
203
204 return Menu_DefaultKey( &postgameMenuInfo.menu, key );
205 }
206
207
208 static int medalLocations[6] = {144, 448, 88, 504, 32, 560};
209
210 static void UI_SPPostgameMenu_DrawAwardsMedals( int max ) {
211 int n;
212 int medal;
213 int amount;
214 int x, y;
215 char buf[16];
216
217 for( n = 0; n < max; n++ ) {
218 x = medalLocations[n];
219 y = 64;
220 medal = postgameMenuInfo.awardsEarned[n];
221 amount = postgameMenuInfo.awardsLevels[n];
222
223 UI_DrawNamedPic( x, y, 48, 48, ui_medalPicNames[medal] );
224
225 if( medal == AWARD_ACCURACY ) {
226 Com_sprintf( buf, sizeof(buf), "%i%%", amount );
227 }
228 else {
229 if( amount == 1 ) {
230 continue;
231 }
232 Com_sprintf( buf, sizeof(buf), "%i", amount );
233 }
234
235 UI_DrawString( x + 24, y + 52, buf, UI_CENTER, color_yellow );
236 }
237 }
238
239
240 static void UI_SPPostgameMenu_DrawAwardsPresentation( int timer ) {
241 int awardNum;
242 int atimer;
243 vec4_t color;
244
245 awardNum = timer / AWARD_PRESENTATION_TIME;
246 atimer = timer % AWARD_PRESENTATION_TIME;
247
248 color[0] = color[1] = color[2] = 1.0f;
249 color[3] = (float)( AWARD_PRESENTATION_TIME - atimer ) / (float)AWARD_PRESENTATION_TIME;
250 UI_DrawProportionalString( 320, 64, ui_medalNames[postgameMenuInfo.awardsEarned[awardNum]], UI_CENTER, color );
251
252 UI_SPPostgameMenu_DrawAwardsMedals( awardNum + 1 );
253
254 if( !postgameMenuInfo.playedSound[awardNum] ) {
255 postgameMenuInfo.playedSound[awardNum] = qtrue;
256 trap_S_StartLocalSound( trap_S_RegisterSound( ui_medalSounds[postgameMenuInfo.awardsEarned[awardNum]], qfalse ), CHAN_ANNOUNCER );
257 }
258 }
259
260
261 /*
262 =================
263 UI_SPPostgameMenu_MenuDrawScoreLine
264 =================
265 */
266 static void UI_SPPostgameMenu_MenuDrawScoreLine( int n, int y ) {
267 int rank;
268 char name[64];
269 char info[MAX_INFO_STRING];
270
271 if( n > (postgameMenuInfo.numClients + 1) ) {
272 n -= (postgameMenuInfo.numClients + 2);
273 }
274
275 if( n >= postgameMenuInfo.numClients ) {
276 return;
277 }
278
279 rank = postgameMenuInfo.ranks[n];
280 if( rank & RANK_TIED_FLAG ) {
281 UI_DrawString( 640 - 31 * SMALLCHAR_WIDTH, y, "(tie)", UI_LEFT|UI_SMALLFONT, color_white );
282 rank &= ~RANK_TIED_FLAG;
283 }
284 trap_GetConfigString( CS_PLAYERS + postgameMenuInfo.clientNums[n], info, MAX_INFO_STRING );
285 Q_strncpyz( name, Info_ValueForKey( info, "n" ), sizeof(name) );
286 Q_CleanStr( name );
287
288 UI_DrawString( 640 - 25 * SMALLCHAR_WIDTH, y, va( "#%i: %-16s %2i", rank + 1, name, postgameMenuInfo.scores[n] ), UI_LEFT|UI_SMALLFONT, color_white );
289 }
290
291
292 /*
293 =================
294 UI_SPPostgameMenu_MenuDraw
295 =================
296 */
297 static void UI_SPPostgameMenu_MenuDraw( void ) {
298 int timer;
299 int serverId;
300 int n;
301 char info[MAX_INFO_STRING];
302
303 trap_GetConfigString( CS_SYSTEMINFO, info, sizeof(info) );
304 serverId = atoi( Info_ValueForKey( info, "sv_serverid" ) );
305 if( serverId != postgameMenuInfo.serverId ) {
306 UI_PopMenu();
307 return;
308 }
309
310 // phase 1
311 if ( postgameMenuInfo.numClients > 2 ) {
312 UI_DrawProportionalString( 510, 480 - 64 - PROP_HEIGHT, postgameMenuInfo.placeNames[2], UI_CENTER, color_white );
313 }
314 UI_DrawProportionalString( 130, 480 - 64 - PROP_HEIGHT, postgameMenuInfo.placeNames[1], UI_CENTER, color_white );
315 UI_DrawProportionalString( 320, 480 - 64 - 2 * PROP_HEIGHT, postgameMenuInfo.placeNames[0], UI_CENTER, color_white );
316
317 if( postgameMenuInfo.phase == 1 ) {
318 timer = uis.realtime - postgameMenuInfo.starttime;
319
320 if( timer >= 1000 && postgameMenuInfo.winnerSound ) {
321 trap_S_StartLocalSound( postgameMenuInfo.winnerSound, CHAN_ANNOUNCER );
322 postgameMenuInfo.winnerSound = 0;
323 }
324
325 if( timer < 5000 ) {
326 return;
327 }
328 postgameMenuInfo.phase = 2;
329 postgameMenuInfo.starttime = uis.realtime;
330 }
331
332 // phase 2
333 if( postgameMenuInfo.phase == 2 ) {
334 timer = uis.realtime - postgameMenuInfo.starttime;
335 if( timer >= ( postgameMenuInfo.numAwards * AWARD_PRESENTATION_TIME ) ) {
336
337 if( timer < 5000 ) {
338 return;
339 }
340
341 postgameMenuInfo.phase = 3;
342 postgameMenuInfo.starttime = uis.realtime;
343 }
344 else {
345 UI_SPPostgameMenu_DrawAwardsPresentation( timer );
346 }
347 }
348
349 // phase 3
350 if( postgameMenuInfo.phase == 3 ) {
351 if( uis.demoversion ) {
352 if( postgameMenuInfo.won == 1 && UI_ShowTierVideo( 8 )) {
353 trap_Cvar_Set( "nextmap", "" );
354 trap_Cmd_ExecuteText( EXEC_APPEND, "disconnect; cinematic demoEnd.RoQ\n" );
355 return;
356 }
357 }
358 else if( postgameMenuInfo.won > -1 && UI_ShowTierVideo( postgameMenuInfo.won + 1 )) {
359 if( postgameMenuInfo.won == postgameMenuInfo.lastTier ) {
360 trap_Cvar_Set( "nextmap", "" );
361 trap_Cmd_ExecuteText( EXEC_APPEND, "disconnect; cinematic end.RoQ\n" );
362 return;
363 }
364
365 trap_Cvar_SetValue( "ui_spSelection", postgameMenuInfo.won * ARENAS_PER_TIER );
366 trap_Cvar_Set( "nextmap", "levelselect" );
367 trap_Cmd_ExecuteText( EXEC_APPEND, va( "disconnect; cinematic tier%i.RoQ\n", postgameMenuInfo.won + 1 ) );
368 return;
369 }
370
371 postgameMenuInfo.item_again.generic.flags &= ~QMF_INACTIVE;
372 postgameMenuInfo.item_next.generic.flags &= ~QMF_INACTIVE;
373 postgameMenuInfo.item_menu.generic.flags &= ~QMF_INACTIVE;
374
375 UI_SPPostgameMenu_DrawAwardsMedals( postgameMenuInfo.numAwards );
376
377 Menu_Draw( &postgameMenuInfo.menu );
378 }
379
380 // draw the scoreboard
381 if( !trap_Cvar_VariableValue( "ui_spScoreboard" ) ) {
382 return;
383 }
384
385 timer = uis.realtime - postgameMenuInfo.scoreboardtime;
386 if( postgameMenuInfo.numClients <= 3 ) {
387 n = 0;
388 }
389 else {
390 n = timer / 1500 % (postgameMenuInfo.numClients + 2);
391 }
392 UI_SPPostgameMenu_MenuDrawScoreLine( n, 0 );
393 UI_SPPostgameMenu_MenuDrawScoreLine( n + 1, 0 + SMALLCHAR_HEIGHT );
394 UI_SPPostgameMenu_MenuDrawScoreLine( n + 2, 0 + 2 * SMALLCHAR_HEIGHT );
395 }
396
397
398 /*
399 =================
400 UI_SPPostgameMenu_Cache
401 =================
402 */
403 void UI_SPPostgameMenu_Cache( void ) {
404 int n;
405 qboolean buildscript;
406
407 buildscript = trap_Cvar_VariableValue("com_buildscript");
408
409 trap_R_RegisterShaderNoMip( ART_MENU0 );
410 trap_R_RegisterShaderNoMip( ART_MENU1 );
411 trap_R_RegisterShaderNoMip( ART_REPLAY0 );
412 trap_R_RegisterShaderNoMip( ART_REPLAY1 );
413 trap_R_RegisterShaderNoMip( ART_NEXT0 );
414 trap_R_RegisterShaderNoMip( ART_NEXT1 );
415 for( n = 0; n < 6; n++ ) {
416 trap_R_RegisterShaderNoMip( ui_medalPicNames[n] );
417 trap_S_RegisterSound( ui_medalSounds[n], qfalse );
418 }
419
420 if( buildscript ) {
421 trap_S_RegisterSound( "music/loss.wav", qfalse );
422 trap_S_RegisterSound( "music/win.wav", qfalse );
423 trap_S_RegisterSound( "sound/player/announce/youwin.wav", qfalse );
424 }
425 }
426
427
428 /*
429 =================
430 UI_SPPostgameMenu_Init
431 =================
432 */
433 static void UI_SPPostgameMenu_Init( void ) {
434 postgameMenuInfo.menu.wrapAround = qtrue;
435 postgameMenuInfo.menu.key = UI_SPPostgameMenu_MenuKey;
436 postgameMenuInfo.menu.draw = UI_SPPostgameMenu_MenuDraw;
437 postgameMenuInfo.ignoreKeysTime = uis.realtime + 1500;
438
439 UI_SPPostgameMenu_Cache();
440
441 postgameMenuInfo.item_menu.generic.type = MTYPE_BITMAP;
442 postgameMenuInfo.item_menu.generic.name = ART_MENU0;
443 postgameMenuInfo.item_menu.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS|QMF_INACTIVE;
444 postgameMenuInfo.item_menu.generic.x = 0;
445 postgameMenuInfo.item_menu.generic.y = 480-64;
446 postgameMenuInfo.item_menu.generic.callback = UI_SPPostgameMenu_MenuEvent;
447 postgameMenuInfo.item_menu.generic.id = ID_MENU;
448 postgameMenuInfo.item_menu.width = 128;
449 postgameMenuInfo.item_menu.height = 64;
450 postgameMenuInfo.item_menu.focuspic = ART_MENU1;
451
452 postgameMenuInfo.item_again.generic.type = MTYPE_BITMAP;
453 postgameMenuInfo.item_again.generic.name = ART_REPLAY0;
454 postgameMenuInfo.item_again.generic.flags = QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS|QMF_INACTIVE;
455 postgameMenuInfo.item_again.generic.x = 320;
456 postgameMenuInfo.item_again.generic.y = 480-64;
457 postgameMenuInfo.item_again.generic.callback = UI_SPPostgameMenu_AgainEvent;
458 postgameMenuInfo.item_again.generic.id = ID_AGAIN;
459 postgameMenuInfo.item_again.width = 128;
460 postgameMenuInfo.item_again.height = 64;
461 postgameMenuInfo.item_again.focuspic = ART_REPLAY1;
462
463 postgameMenuInfo.item_next.generic.type = MTYPE_BITMAP;
464 postgameMenuInfo.item_next.generic.name = ART_NEXT0;
465 postgameMenuInfo.item_next.generic.flags = QMF_RIGHT_JUSTIFY|QMF_PULSEIFFOCUS|QMF_INACTIVE;
466 postgameMenuInfo.item_next.generic.x = 640;
467 postgameMenuInfo.item_next.generic.y = 480-64;
468 postgameMenuInfo.item_next.generic.callback = UI_SPPostgameMenu_NextEvent;
469 postgameMenuInfo.item_next.generic.id = ID_NEXT;
470 postgameMenuInfo.item_next.width = 128;
471 postgameMenuInfo.item_next.height = 64;
472 postgameMenuInfo.item_next.focuspic = ART_NEXT1;
473
474 Menu_AddItem( &postgameMenuInfo.menu, ( void * )&postgameMenuInfo.item_menu );
475 Menu_AddItem( &postgameMenuInfo.menu, ( void * )&postgameMenuInfo.item_again );
476 Menu_AddItem( &postgameMenuInfo.menu, ( void * )&postgameMenuInfo.item_next );
477 }
478
479
480 static void Prepname( int index ) {
481 int len;
482 char name[64];
483 char info[MAX_INFO_STRING];
484
485 trap_GetConfigString( CS_PLAYERS + postgameMenuInfo.clientNums[index], info, MAX_INFO_STRING );
486 Q_strncpyz( name, Info_ValueForKey( info, "n" ), sizeof(name) );
487 Q_CleanStr( name );
488 len = strlen( name );
489
490 while( len && UI_ProportionalStringWidth( name ) > 256 ) {
491 len--;
492 name[len] = 0;
493 }
494
495 Q_strncpyz( postgameMenuInfo.placeNames[index], name, sizeof(postgameMenuInfo.placeNames[index]) );
496 }
497
498
499 /*
500 =================
501 UI_SPPostgameMenu_f
502 =================
503 */
504 void UI_SPPostgameMenu_f( void ) {
505 int playerGameRank;
506 int playerClientNum;
507 int n;
508 int oldFrags, newFrags;
509 const char *arena;
510 int awardValues[6];
511 char map[MAX_QPATH];
512 char info[MAX_INFO_STRING];
513
514 memset( &postgameMenuInfo, 0, sizeof(postgameMenuInfo) );
515
516 trap_GetConfigString( CS_SYSTEMINFO, info, sizeof(info) );
517 postgameMenuInfo.serverId = atoi( Info_ValueForKey( info, "sv_serverid" ) );
518
519 trap_GetConfigString( CS_SERVERINFO, info, sizeof(info) );
520 Q_strncpyz( map, Info_ValueForKey( info, "mapname" ), sizeof(map) );
521 arena = UI_GetArenaInfoByMap( map );
522 if ( !arena ) {
523 return;
524 }
525 Q_strncpyz( arenainfo, arena, sizeof(arenainfo) );
526
527 postgameMenuInfo.level = atoi( Info_ValueForKey( arenainfo, "num" ) );
528
529 postgameMenuInfo.numClients = atoi( UI_Argv( 1 ) );
530 playerClientNum = atoi( UI_Argv( 2 ) );
531 playerGameRank = 8; // in case they ended game as a spectator
532
533 if( postgameMenuInfo.numClients > MAX_SCOREBOARD_CLIENTS ) {
534 postgameMenuInfo.numClients = MAX_SCOREBOARD_CLIENTS;
535 }
536
537 for( n = 0; n < postgameMenuInfo.numClients; n++ ) {
538 postgameMenuInfo.clientNums[n] = atoi( UI_Argv( 8 + n * 3 + 1 ) );
539 postgameMenuInfo.ranks[n] = atoi( UI_Argv( 8 + n * 3 + 2 ) );
540 postgameMenuInfo.scores[n] = atoi( UI_Argv( 8 + n * 3 + 3 ) );
541
542 if( postgameMenuInfo.clientNums[n] == playerClientNum ) {
543 playerGameRank = (postgameMenuInfo.ranks[n] & ~RANK_TIED_FLAG) + 1;
544 }
545 }
546
547 UI_SetBestScore( postgameMenuInfo.level, playerGameRank );
548
549 // process award stats and prepare presentation data
550 awardValues[AWARD_ACCURACY] = atoi( UI_Argv( 3 ) );
551 awardValues[AWARD_IMPRESSIVE] = atoi( UI_Argv( 4 ) );
552 awardValues[AWARD_EXCELLENT] = atoi( UI_Argv( 5 ) );
553 awardValues[AWARD_GAUNTLET] = atoi( UI_Argv( 6 ) );
554 awardValues[AWARD_FRAGS] = atoi( UI_Argv( 7 ) );
555 awardValues[AWARD_PERFECT] = atoi( UI_Argv( 8 ) );
556
557 postgameMenuInfo.numAwards = 0;
558
559 if( awardValues[AWARD_ACCURACY] >= 50 ) {
560 UI_LogAwardData( AWARD_ACCURACY, 1 );
561 postgameMenuInfo.awardsEarned[postgameMenuInfo.numAwards] = AWARD_ACCURACY;
562 postgameMenuInfo.awardsLevels[postgameMenuInfo.numAwards] = awardValues[AWARD_ACCURACY];
563 postgameMenuInfo.numAwards++;
564 }
565
566 if( awardValues[AWARD_IMPRESSIVE] ) {
567 UI_LogAwardData( AWARD_IMPRESSIVE, awardValues[AWARD_IMPRESSIVE] );
568 postgameMenuInfo.awardsEarned[postgameMenuInfo.numAwards] = AWARD_IMPRESSIVE;
569 postgameMenuInfo.awardsLevels[postgameMenuInfo.numAwards] = awardValues[AWARD_IMPRESSIVE];
570 postgameMenuInfo.numAwards++;
571 }
572
573 if( awardValues[AWARD_EXCELLENT] ) {
574 UI_LogAwardData( AWARD_EXCELLENT, awardValues[AWARD_EXCELLENT] );
575 postgameMenuInfo.awardsEarned[postgameMenuInfo.numAwards] = AWARD_EXCELLENT;
576 postgameMenuInfo.awardsLevels[postgameMenuInfo.numAwards] = awardValues[AWARD_EXCELLENT];
577 postgameMenuInfo.numAwards++;
578 }
579
580 if( awardValues[AWARD_GAUNTLET] ) {
581 UI_LogAwardData( AWARD_GAUNTLET, awardValues[AWARD_GAUNTLET] );
582 postgameMenuInfo.awardsEarned[postgameMenuInfo.numAwards] = AWARD_GAUNTLET;
583 postgameMenuInfo.awardsLevels[postgameMenuInfo.numAwards] = awardValues[AWARD_GAUNTLET];
584 postgameMenuInfo.numAwards++;
585 }
586
587 oldFrags = UI_GetAwardLevel( AWARD_FRAGS ) / 100;
588 UI_LogAwardData( AWARD_FRAGS, awardValues[AWARD_FRAGS] );
589 newFrags = UI_GetAwardLevel( AWARD_FRAGS ) / 100;
590 if( newFrags > oldFrags ) {
591 postgameMenuInfo.awardsEarned[postgameMenuInfo.numAwards] = AWARD_FRAGS;
592 postgameMenuInfo.awardsLevels[postgameMenuInfo.numAwards] = newFrags * 100;
593 postgameMenuInfo.numAwards++;
594 }
595
596 if( awardValues[AWARD_PERFECT] ) {
597 UI_LogAwardData( AWARD_PERFECT, 1 );
598 postgameMenuInfo.awardsEarned[postgameMenuInfo.numAwards] = AWARD_PERFECT;
599 postgameMenuInfo.awardsLevels[postgameMenuInfo.numAwards] = 1;
600 postgameMenuInfo.numAwards++;
601 }
602
603 if ( playerGameRank == 1 ) {
604 postgameMenuInfo.won = UI_TierCompleted( postgameMenuInfo.level );
605 }
606 else {
607 postgameMenuInfo.won = -1;
608 }
609
610 postgameMenuInfo.starttime = uis.realtime;
611 postgameMenuInfo.scoreboardtime = uis.realtime;
612
613 trap_Key_SetCatcher( KEYCATCH_UI );
614 uis.menusp = 0;
615
616 UI_SPPostgameMenu_Init();
617 UI_PushMenu( &postgameMenuInfo.menu );
618
619 if ( playerGameRank == 1 ) {
620 Menu_SetCursorToItem( &postgameMenuInfo.menu, &postgameMenuInfo.item_next );
621 }
622 else {
623 Menu_SetCursorToItem( &postgameMenuInfo.menu, &postgameMenuInfo.item_again );
624 }
625
626 Prepname( 0 );
627 Prepname( 1 );
628 Prepname( 2 );
629
630 if ( playerGameRank != 1 ) {
631 postgameMenuInfo.winnerSound = trap_S_RegisterSound( va( "sound/player/announce/%s_wins.wav", postgameMenuInfo.placeNames[0] ), qfalse );
632 trap_Cmd_ExecuteText( EXEC_APPEND, "music music/loss\n" );
633 }
634 else {
635 postgameMenuInfo.winnerSound = trap_S_RegisterSound( "sound/player/announce/youwin.wav", qfalse );
636 trap_Cmd_ExecuteText( EXEC_APPEND, "music music/win\n" );
637 }
638
639 postgameMenuInfo.phase = 1;
640
641 postgameMenuInfo.lastTier = UI_GetNumSPTiers();
642 if ( UI_GetSpecialArenaInfo( "final" ) ) {
643 postgameMenuInfo.lastTier++;
644 }
645 }