1 #using scripts\codescripts\struct;
3 #using scripts\shared\callbacks_shared;
4 #using scripts\shared\hud_message_shared;
5 #using scripts\shared\hud_util_shared;
6 #using scripts\shared\system_shared;
7 #using scripts\shared\util_shared;
9 #insert scripts\shared\shared.gsh;
11 #using scripts\zm\gametypes\_globallogic_audio;
13 #using scripts\zm\_util;
15 #precache( "string", "MENU_POINTS" );
16 #precache( "string", "MP_FIRSTPLACE_NAME" );
17 #precache( "string", "MP_SECONDPLACE_NAME" );
18 #precache( "string", "MP_THIRDPLACE_NAME" );
19 #precache( "string", "MP_WAGER_PLACE_NAME" );
20 #precache( "string", "MP_MATCH_BONUS_IS" );
21 #precache( "string", "MP_WAGER_IN_THE_MONEY" );
22 #precache( "string", "MP_DRAW_CAPS" );
23 #precache( "string", "MP_ROUND_DRAW_CAPS" );
24 #precache( "string", "MP_ROUND_WIN_CAPS" );
25 #precache( "string", "MP_ROUND_LOSS_CAPS" );
26 #precache( "string", "MP_VICTORY_CAPS" );
27 #precache( "string", "MP_DEFEAT_CAPS" );
28 #precache( "string", "MP_GAME_OVER_CAPS" );
29 #precache( "string", "MP_HALFTIME_CAPS" );
30 #precache( "string", "MP_OVERTIME_CAPS" );
31 #precache( "string", "MP_ROUNDEND_CAPS" );
32 #precache( "string", "MP_INTERMISSION_CAPS" );
33 #precache( "string", "MP_SWITCHING_SIDES_CAPS" );
34 #precache( "string", "MP_MATCH_BONUS_IS" );
35 #precache( "eventstring", "faction_popup" );
37 #namespace hud_message;
41 game[
"strings"][
"draw"] = &
"MP_DRAW_CAPS";
42 game[
"strings"][
"round_draw"] = &
"MP_ROUND_DRAW_CAPS";
43 game[
"strings"][
"round_win"] = &
"MP_ROUND_WIN_CAPS";
44 game[
"strings"][
"round_loss"] = &
"MP_ROUND_LOSS_CAPS";
45 game[
"strings"][
"victory"] = &
"MP_VICTORY_CAPS";
46 game[
"strings"][
"defeat"] = &
"MP_DEFEAT_CAPS";
47 game[
"strings"][
"game_over"] = &
"MP_GAME_OVER_CAPS";
48 game[
"strings"][
"halftime"] = &
"MP_HALFTIME_CAPS";
49 game[
"strings"][
"overtime"] = &
"MP_OVERTIME_CAPS";
50 game[
"strings"][
"roundend"] = &
"MP_ROUNDEND_CAPS";
51 game[
"strings"][
"intermission"] = &
"MP_INTERMISSION_CAPS";
52 game[
"strings"][
"side_switch"] = &
"MP_SWITCHING_SIDES_CAPS";
53 game[
"strings"][
"match_bonus"] = &
"MP_MATCH_BONUS_IS";
58 self endon (
"disconnect" );
59 self notify (
"reset_outcome" );
61 team =
self.pers[
"team"];
62 if ( isdefined( team ) && team ==
"spectator" )
64 for ( i = 0; i < level.players.size; i++ )
66 if (
self.currentspectatingclient == level.players[i].clientId )
68 team = level.players[i].pers[
"team"];
74 if ( !isdefined( team ) || !isdefined( level.teams[team] ) )
78 while (
self.doingNotify )
81 self endon (
"reset_outcome" );
83 headerFont =
"extrabig";
85 if (
self IsSplitscreen() )
104 outcomeTitle.glowAlpha = 1;
105 outcomeTitle.hideWhenInMenu =
false;
106 outcomeTitle.archived =
false;
111 outcomeText.glowAlpha = 1;
112 outcomeText.hideWhenInMenu =
false;
113 outcomeText.archived =
false;
115 if ( winner ==
"halftime" )
118 outcomeTitle setText( game[
"strings"][
"halftime"] );
119 outcomeTitle.color = (1, 1, 1);
123 else if ( winner ==
"intermission" )
126 outcomeTitle setText( game[
"strings"][
"intermission"] );
127 outcomeTitle.color = (1, 1, 1);
131 else if ( winner ==
"roundend" )
134 outcomeTitle setText( game[
"strings"][
"roundend"] );
135 outcomeTitle.color = (1, 1, 1);
139 else if ( winner ==
"overtime" )
142 outcomeTitle setText( game[
"strings"][
"overtime"] );
143 outcomeTitle.color = (1, 1, 1);
147 else if ( winner ==
"tie" )
151 outcomeTitle setText( game[
"strings"][
"round_draw"] );
153 outcomeTitle setText( game[
"strings"][
"draw"] );
154 outcomeTitle.color = (0.29, 0.61, 0.7);
158 else if ( isdefined(
self.pers[
"team"] ) && winner == team )
162 outcomeTitle setText( game[
"strings"][
"round_win"] );
164 outcomeTitle setText( game[
"strings"][
"victory"] );
165 outcomeTitle.color = (0.42, 0.68, 0.46);
171 outcomeTitle setText( game[
"strings"][
"round_loss"] );
173 outcomeTitle setText( game[
"strings"][
"defeat"] );
174 outcomeTitle.color = (0.73, 0.29, 0.19);
183 outcomeText setText( endReasonText );
185 outcomeTitle setCOD7DecodeFX( 200, duration, 600 );
186 outcomeText setPulseFX( 100, duration, 1000 );
189 currentX = -(level.teamCount-1) * iconSpacing / 2;
191 teamIcons[team] =
hud::createIcon( game[
"icons"][team], iconSize, iconSize );
193 teamIcons[team]
hud::setPoint(
"TOP",
"BOTTOM", currentX, spacing );
194 teamIcons[team].hideWhenInMenu =
false;
195 teamIcons[team].archived =
false;
196 teamIcons[team].alpha = 0;
197 teamIcons[team] fadeOverTime( 0.5 );
198 teamIcons[team].alpha = 1;
199 currentX += iconSpacing;
201 foreach( enemyTeam
in level.teams )
203 if ( team == enemyTeam )
206 teamIcons[enemyTeam] =
hud::createIcon( game[
"icons"][enemyTeam], iconSize, iconSize );
208 teamIcons[enemyTeam]
hud::setPoint(
"TOP",
"BOTTOM", currentX, spacing );
209 teamIcons[enemyTeam].hideWhenInMenu =
false;
210 teamIcons[enemyTeam].archived =
false;
211 teamIcons[enemyTeam].alpha = 0;
212 teamIcons[enemyTeam] fadeOverTime( 0.5 );
213 teamIcons[enemyTeam].alpha = 1;
214 currentX += iconSpacing;
222 teamScores[team].glowAlpha = 1;
225 teamScores[team] setValue( getTeamScore( team ) );
229 teamScores[team] [[level.setMatchScoreHUDElemForTeam]]( team );
231 teamScores[team].hideWhenInMenu =
false;
232 teamScores[team].archived =
false;
233 teamScores[team] setPulseFX( 100, duration, 1000 );
235 foreach( enemyTeam
in level.teams )
237 if ( team == enemyTeam )
242 teamScores[enemyTeam]
hud::setPoint(
"TOP",
"BOTTOM", 0, spacing );
244 teamScores[enemyTeam].glowAlpha = 1;
247 teamScores[enemyTeam] setValue( getTeamScore( enemyTeam ) );
251 teamScores[enemyTeam] [[level.setMatchScoreHUDElemForTeam]]( enemyTeam );
253 teamScores[enemyTeam].hideWhenInMenu =
false;
254 teamScores[enemyTeam].archived =
false;
255 teamScores[enemyTeam] setPulseFX( 100, duration, 1000 );
259 matchBonus = undefined;
260 if ( isdefined(
self.matchBonus ) )
264 matchBonus
hud::setPoint(
"TOP",
"BOTTOM", 0, iconSize + (spacing * 3) + teamScores[team].height );
265 matchBonus.glowAlpha = 1;
266 matchBonus.hideWhenInMenu =
false;
267 matchBonus.archived =
false;
268 matchBonus.label = game[
"strings"][
"match_bonus"];
269 matchBonus setValue(
self.matchBonus );
289 self endon (
"disconnect" );
290 self notify (
"reset_outcome" );
292 team =
self.pers[
"team"];
293 if ( isdefined( team ) && team ==
"spectator" )
295 for ( i = 0; i < level.players.size; i++ )
297 if (
self.currentspectatingclient == level.players[i].clientId )
299 team = level.players[i].pers[
"team"];
305 if ( !isdefined( team ) || !isdefined( level.teams[team] ) )
309 while (
self.doingNotify )
312 self endon (
"reset_outcome" );
315 if (
self IsSplitscreen() )
328 const duration = 60000;
332 outcomeTitle.glowAlpha = 1;
333 outcomeTitle.hideWhenInMenu =
false;
334 outcomeTitle.archived =
false;
336 outcomeTitle setText( endReasonText );
337 outcomeTitle setPulseFX( 100, duration, 1000 );
344 self endon (
"disconnect" );
345 self notify (
"reset_outcome" );
348 while (
self.doingNotify )
351 self endon (
"reset_outcome" );
353 headerFont =
"extrabig";
355 if (
self IsSplitscreen() )
374 players = level.placement[
"all"];
380 outcomeTitle setText( game[
"strings"][
"game_over"] );
382 else if ( isdefined( players[1] ) && players[0].score == players[1].score && players[0].deaths == players[1].deaths && (
self == players[0] ||
self == players[1]) )
384 outcomeTitle setText( game[
"strings"][
"tie"] );
387 else if ( isdefined( players[2] ) && players[0].score == players[2].score && players[0].deaths == players[2].deaths &&
self == players[2] )
389 outcomeTitle setText( game[
"strings"][
"tie"] );
392 else if ( isdefined( players[0] ) &&
self == players[0] )
394 outcomeTitle setText( game[
"strings"][
"victory"] );
395 outcomeTitle.color = (0.42, 0.68, 0.46);
400 outcomeTitle setText( game[
"strings"][
"defeat"] );
401 outcomeTitle.color = (0.73, 0.29, 0.19);
404 outcomeTitle.glowAlpha = 1;
405 outcomeTitle.hideWhenInMenu =
false;
406 outcomeTitle.archived =
false;
407 outcomeTitle setCOD7DecodeFX( 200, duration, 600 );
412 outcomeText.glowAlpha = 1;
413 outcomeText.hideWhenInMenu =
false;
414 outcomeText.archived =
false;
416 outcomeText setText( endReasonText );
422 firstTitle.glowAlpha = 1;
423 firstTitle.hideWhenInMenu =
false;
424 firstTitle.archived =
false;
425 if ( isdefined( players[0] ) )
427 firstTitle.label = &
"MP_FIRSTPLACE_NAME";
428 firstTitle setPlayerNameString( players[0] );
429 firstTitle setCOD7DecodeFX( 175, duration, 600 );
436 secondTitle.glowAlpha = 1;
437 secondTitle.hideWhenInMenu =
false;
438 secondTitle.archived =
false;
439 if ( isdefined( players[1] ) )
441 secondTitle.label = &
"MP_SECONDPLACE_NAME";
442 secondTitle setPlayerNameString( players[1] );
443 secondTitle setCOD7DecodeFX( 175, duration, 600 );
451 thirdTitle.glowAlpha = 1;
452 thirdTitle.hideWhenInMenu =
false;
453 thirdTitle.archived =
false;
454 if ( isdefined( players[2] ) )
456 thirdTitle.label = &
"MP_THIRDPLACE_NAME";
457 thirdTitle setPlayerNameString( players[2] );
458 thirdTitle setCOD7DecodeFX( 175, duration, 600 );
464 matchBonus.glowAlpha = 1;
465 matchBonus.hideWhenInMenu =
false;
466 matchBonus.archived =
false;
467 if ( isdefined(
self.matchBonus ) )
469 matchBonus.label = game[
"strings"][
"match_bonus"];
470 matchBonus setValue(
self.matchBonus );
473 self thread
updateOutcome( firstTitle, secondTitle, thirdTitle );
474 self thread
resetOutcomeNotify( undefined, undefined, outcomeTitle, outcomeText, firstTitle, secondTitle, thirdTitle, matchBonus );
479 self endon (
"disconnect" );
480 self notify (
"reset_outcome" );
483 while (
self.doingNotify )
488 self endon (
"reset_outcome" );
490 headerFont =
"extrabig";
492 if (
self IsSplitscreen() )
510 if ( isdefined( level.sidebet ) && level.sidebet )
515 players = level.placement[
"all"];
521 outcomeTitle setText( game[
"strings"][
"intermission"] );
522 outcomeTitle.color = (1.0, 1.0, 0.0);
523 outcomeTitle.glowColor = (1.0, 0.0, 0.0);
525 else if( isdefined(level.dontCalcWagerWinnings) && level.dontCalcWagerWinnings == true )
527 outcomeTitle setText( game[
"strings"][
"wager_topwinners"] );
528 outcomeTitle.color = (0.42, 0.68, 0.46);
532 if ( isdefined(
self.wagerWinnings ) && (
self.wagerWinnings > 0 ) )
534 outcomeTitle setText( game[
"strings"][
"wager_inthemoney"] );
535 outcomeTitle.color = (0.42, 0.68, 0.46);
539 outcomeTitle setText( game[
"strings"][
"wager_loss"] );
540 outcomeTitle.color = (0.73, 0.29, 0.19);
543 outcomeTitle.glowAlpha = 1;
544 outcomeTitle.hideWhenInMenu =
false;
545 outcomeTitle.archived =
false;
546 outcomeTitle setCOD7DecodeFX( 200, duration, 600 );
551 outcomeText.glowAlpha = 1;
552 outcomeText.hideWhenInMenu =
false;
553 outcomeText.archived =
false;
555 outcomeText setText( endReasonText );
557 playerNameHudElems = [];
558 playerCPHudElems = [];
559 numPlayers = players.size;
560 for ( i = 0 ; i < numPlayers ; i++ )
562 if ( !halftime && isdefined( players[i] ) )
565 if ( playerNameHudElems.size == 0 )
568 secondTitle
hud::setPoint(
"TOP_LEFT",
"BOTTOM", -175, spacing*3 );
572 secondTitle
hud::setParent( playerNameHudElems[playerNameHudElems.size-1] );
573 secondTitle
hud::setPoint(
"TOP_LEFT",
"BOTTOM_LEFT", 0, spacing );
576 secondTitle.glowAlpha = 1;
577 secondTitle.hideWhenInMenu =
false;
578 secondTitle.archived =
false;
579 secondTitle.label = &
"MP_WAGER_PLACE_NAME";
580 secondTitle.playerNum = i;
581 secondTitle setPlayerNameString( players[i] );
582 playerNameHudElems[playerNameHudElems.size] = secondTitle;
587 secondCP.glowAlpha = 1;
588 secondCP.hideWhenInMenu =
false;
589 secondCP.archived =
false;
590 secondCP.label = &
"MENU_POINTS";
591 secondCP.currentValue = 0;
592 if ( isdefined( players[i].wagerWinnings ) )
593 secondCP.targetValue = players[i].wagerWinnings;
595 secondCP.targetValue = 0;
596 if ( secondCP.targetValue > 0 )
597 secondCP.color = (0.42, 0.68, 0.46);
598 secondCP setValue( 0 );
599 playerCPHudElems[playerCPHudElems.size] = secondCP;
632 stillUpdating =
true;
635 if ( isdefined( playerCPHudElems[0] ) )
637 CPIncrement = int( playerCPHudElems[0].targetValue / ( countUpDuration / 0.05 ) );
638 if ( CPIncrement < 1 )
641 while( stillUpdating )
643 stillUpdating =
false;
644 for ( i = 0 ; i < playerCPHudElems.size ; i++ )
646 if ( isdefined( playerCPHudElems[i] ) && ( playerCPHudElems[i].currentValue < playerCPHudElems[i].targetValue ) )
648 playerCPHudElems[i].currentValue += CPIncrement;
649 if ( playerCPHudElems[i].currentValue > playerCPHudElems[i].targetValue )
650 playerCPHudElems[i].currentValue = playerCPHudElems[i].targetValue;
651 playerCPHudElems[i] SetValue( playerCPHudElems[i].currentValue );
652 stillUpdating =
true;
661 self endon (
"disconnect" );
662 self notify (
"reset_outcome" );
664 team =
self.pers[
"team"];
665 if ( !isdefined( team ) || (!isdefined( level.teams[team] ) ) )
671 while (
self.doingNotify )
674 self endon (
"reset_outcome" );
676 headerFont =
"extrabig";
678 if (
self IsSplitscreen() )
694 if ( isdefined( level.sidebet ) && level.sidebet )
701 outcomeTitle.glowAlpha = 1;
702 outcomeTitle.hideWhenInMenu =
false;
703 outcomeTitle.archived =
false;
708 outcomeText.glowAlpha = 1;
709 outcomeText.hideWhenInMenu =
false;
710 outcomeText.archived =
false;
712 if ( winner ==
"tie" )
716 outcomeTitle setText( game[
"strings"][
"round_draw"] );
718 outcomeTitle setText( game[
"strings"][
"draw"] );
719 outcomeTitle.color = (1, 1, 1);
723 else if ( winner ==
"overtime" )
725 outcomeTitle setText( game[
"strings"][
"overtime"] );
726 outcomeTitle.color = (1, 1, 1);
729 else if ( isdefined(
self.pers[
"team"] ) && winner == team )
733 outcomeTitle setText( game[
"strings"][
"round_win"] );
735 outcomeTitle setText( game[
"strings"][
"victory"] );
736 outcomeTitle.color = (0.42, 0.68, 0.46);
742 outcomeTitle setText( game[
"strings"][
"round_loss"] );
744 outcomeTitle setText( game[
"strings"][
"defeat"] );
745 outcomeTitle.color = (0.73, 0.29, 0.19);
747 if( !isdefined( level.dontShowEndReason ) || !level.dontShowEndReason )
749 outcomeText setText( endReasonText );
752 outcomeTitle setPulseFX( 100, duration, 1000 );
753 outcomeText setPulseFX( 100, duration, 1000 );
756 teamIcons[team] =
hud::createIcon( game[
"icons"][team], iconSize, iconSize );
759 teamIcons[team].hideWhenInMenu =
false;
760 teamIcons[team].archived =
false;
761 teamIcons[team].alpha = 0;
762 teamIcons[team] fadeOverTime( 0.5 );
763 teamIcons[team].alpha = 1;
765 foreach( enemyTeam
in level.teams )
767 if ( team == enemyTeam )
770 teamIcons[enemyTeam] =
hud::createIcon( game[
"icons"][enemyTeam], iconSize, iconSize );
772 teamIcons[enemyTeam]
hud::setPoint(
"TOP",
"BOTTOM", 60, spacing );
773 teamIcons[enemyTeam].hideWhenInMenu =
false;
774 teamIcons[enemyTeam].archived =
false;
775 teamIcons[enemyTeam].alpha = 0;
776 teamIcons[enemyTeam] fadeOverTime( 0.5 );
777 teamIcons[enemyTeam].alpha = 1;
785 teamScores[team].glowAlpha = 1;
786 teamScores[team] setValue( getTeamScore( team ) );
787 teamScores[team].hideWhenInMenu =
false;
788 teamScores[team].archived =
false;
789 teamScores[team] setPulseFX( 100, duration, 1000 );
791 foreach( enemyTeam
in level.teams )
793 if ( team == enemyTeam )
798 teamScores[enemyTeam]
hud::setPoint(
"TOP",
"BOTTOM", 0, spacing );
800 teamScores[enemyTeam].glowAlpha = 1;
801 teamScores[enemyTeam] setValue( getTeamScore( enemyTeam ) );
802 teamScores[enemyTeam].hideWhenInMenu =
false;
803 teamScores[enemyTeam].archived =
false;
804 teamScores[enemyTeam] setPulseFX( 100, duration, 1000 );
807 matchBonus = undefined;
808 sidebetWinnings = undefined;
809 if ( !isRoundEnd && !halftime && isdefined(
self.wagerWinnings ) )
813 matchBonus
hud::setPoint(
"TOP",
"BOTTOM", 0, iconSize + (spacing * 3) + teamScores[team].height );
814 matchBonus.glowAlpha = 1;
815 matchBonus.hideWhenInMenu =
false;
816 matchBonus.archived =
false;
817 matchBonus.label = game[
"strings"][
"wager_winnings"];
818 matchBonus setValue(
self.wagerWinnings );
820 if ( isdefined( game[
"side_bets"] ) && game[
"side_bets"] )
825 sidebetWinnings.glowAlpha = 1;
826 sidebetWinnings.hideWhenInMenu =
false;
827 sidebetWinnings.archived =
false;
828 sidebetWinnings.label = game[
"strings"][
"wager_sidebet_winnings"];
829 sidebetWinnings setValue(
self.pers[
"wager_sideBetWinnings"] );
832 self thread
resetOutcomeNotify( teamIcons, teamScores, outcomeTitle, outcomeText, matchBonus, sidebetWinnings );
835 function resetOutcomeNotify( hudElemList1, hudElemList2, hudElem3, hudElem4, hudElem5, hudElem6, hudElem7, hudElem8, hudElem9, hudElem10 )
837 self endon (
"disconnect" );
838 self waittill (
"reset_outcome" );
849 if ( isdefined( hudElemList1 ) )
851 foreach( elem
in hudElemList1 )
857 if ( isdefined( hudElemList2 ) )
859 foreach( elem
in hudElemList2 )
868 self endon(
"disconnect" );
869 self waittill(
"reset_outcome" );
871 for ( i = playerNameHudElems.size - 1 ; i >= 0 ; i-- )
873 if ( isdefined( playerNameHudElems[i] ) )
877 for ( i = playerCPHudElems.size - 1 ; i >= 0 ; i-- )
879 if ( isdefined( playerCPHudElems[i] ) )
883 if ( isdefined( outcomeText ) )
886 if ( isdefined( outcomeTitle ) )
892 self endon(
"disconnect" );
893 self endon(
"reset_outcome" );
897 self waittill(
"update_outcome" );
899 players = level.placement[
"all"];
901 if ( isdefined( firstTitle ) && isdefined( players[0] ) )
902 firstTitle setPlayerNameString( players[0] );
903 else if ( isdefined( firstTitle ) )
904 firstTitle.alpha = 0;
906 if ( isdefined( secondTitle ) && isdefined( players[1] ) )
907 secondTitle setPlayerNameString( players[1] );
908 else if ( isdefined( secondTitle ) )
909 secondTitle.alpha = 0;
911 if ( isdefined( thirdTitle ) && isdefined( players[2] ) )
912 thirdTitle setPlayerNameString( players[2] );
913 else if ( isdefined( thirdTitle ) )
914 thirdTitle.alpha = 0;
920 self endon(
"disconnect" );
921 self endon(
"reset_outcome" );
925 self waittill(
"update_outcome" );
927 players = level.placement[
"all"];
929 for ( i = 0 ; i < playerNameHudElems.size ; i++ )
931 if ( isdefined( playerNameHudElems[i] ) && isdefined( players[playerNameHudElems[i].playerNum] ) )
932 playerNameHudElems[i] SetPlayerNameString( players[playerNameHudElems[i].playerNum] );
935 if ( isdefined( playerNameHudElems[i] ) )
936 playerNameHudElems[i].alpha = 0;
937 if ( isdefined( playerCPHudElems[i] ) )
938 playerCPHudElems[i].alpha = 0;