‪Black Ops 3 Source Code Explorer  0.1
‪An script explorer for Black Ops 3 by ZeRoY
_hud_message.gsc
Go to the documentation of this file.
1 #using scripts\codescripts\struct;
2 
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;
8 
9 #insert scripts\shared\shared.gsh;
10 
11 #using scripts\zm\gametypes\_globallogic_audio;
12 
13 #using scripts\zm\_util;
14 
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" );
36 
37 #namespace hud_message;
38 
39 function ‪init()
40 {
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";
54 }
55 
56 function ‪teamOutcomeNotify( winner, isRound, endReasonText )
57 {
58  self endon ( "disconnect" );
59  self notify ( "reset_outcome" );
60 
61  team = self.pers["team"];
62  if ( isdefined( team ) && team == "spectator" )
63  {
64  for ( i = 0; i < level.players.size; i++ )
65  {
66  if ( self.currentspectatingclient == level.players[i].clientId )
67  {
68  team = level.players[i].pers["team"];
69  break;
70  }
71  }
72  }
73 
74  if ( !isdefined( team ) || !isdefined( level.teams[team] ) )
75  team = "allies";
76 
77  // wait for notifies to finish
78  while ( self.doingNotify )
80 
81  self endon ( "reset_outcome" );
82 
83  headerFont = "extrabig";
84  font = "default";
85  if ( self IsSplitscreen() )
86  {
87  titleSize = 2.0;
88  textSize = 1.5;
89  iconSize = 30;
90  spacing = 10;
91  }
92  else
93  {
94  titleSize = 3.0;
95  textSize = 2.0;
96  iconSize = 70;
97  spacing = 25;
98  }
99 
100  duration = 60000;
101 
102  outcomeTitle = ‪hud::createFontString( headerFont, titleSize );
103  outcomeTitle ‪hud::setPoint( "TOP", undefined, 0, 30 );
104  outcomeTitle.glowAlpha = 1;
105  outcomeTitle.hideWhenInMenu = false;
106  outcomeTitle.archived = false;
107 
108  outcomeText = ‪hud::createFontString( font, 2.0 );
109  outcomeText ‪hud::setParent( outcomeTitle );
110  outcomeText ‪hud::setPoint( "TOP", "BOTTOM", 0, 0 );
111  outcomeText.glowAlpha = 1;
112  outcomeText.hideWhenInMenu = false;
113  outcomeText.archived = false;
114 
115  if ( winner == "halftime" )
116  {
117  //outcomeTitle.glowColor = (0.2, 0.3, 0.7);
118  outcomeTitle setText( game["strings"]["halftime"] );
119  outcomeTitle.color = (1, 1, 1);
120 
121  winner = "allies";
122  }
123  else if ( winner == "intermission" )
124  {
125  //outcomeTitle.glowColor = (0.2, 0.3, 0.7);
126  outcomeTitle setText( game["strings"]["intermission"] );
127  outcomeTitle.color = (1, 1, 1);
128 
129  winner = "allies";
130  }
131  else if ( winner == "roundend" )
132  {
133  //outcomeTitle.glowColor = (0.2, 0.3, 0.7);
134  outcomeTitle setText( game["strings"]["roundend"] );
135  outcomeTitle.color = (1, 1, 1);
136 
137  winner = "allies";
138  }
139  else if ( winner == "overtime" )
140  {
141  //outcomeTitle.glowColor = (0.2, 0.3, 0.7);
142  outcomeTitle setText( game["strings"]["overtime"] );
143  outcomeTitle.color = (1, 1, 1);
144 
145  winner = "allies";
146  }
147  else if ( winner == "tie" )
148  {
149  //outcomeTitle.glowColor = (0.2, 0.3, 0.7);
150  if ( isRound )
151  outcomeTitle setText( game["strings"]["round_draw"] );
152  else
153  outcomeTitle setText( game["strings"]["draw"] );
154  outcomeTitle.color = (0.29, 0.61, 0.7);
155 
156  winner = "allies";
157  }
158  else if ( isdefined( self.pers["team"] ) && winner == team )
159  {
160  //outcomeTitle.glowColor = (0, 0, 0);
161  if ( isRound )
162  outcomeTitle setText( game["strings"]["round_win"] );
163  else
164  outcomeTitle setText( game["strings"]["victory"] );
165  outcomeTitle.color = (0.42, 0.68, 0.46);
166  }
167  else
168  {
169  //outcomeTitle.glowColor = (0, 0, 0);
170  if ( isRound )
171  outcomeTitle setText( game["strings"]["round_loss"] );
172  else
173  outcomeTitle setText( game["strings"]["defeat"] );
174  outcomeTitle.color = (0.73, 0.29, 0.19);
175  }
176 
177  //outcomeText.glowColor = (0.2, 0.3, 0.7);
178  //if( winner == "axis" )
179  // outcomeText setText( endReasonText, GetDvarString( "g_TeamName_Axis" ) );
180  //else
181  // outcomeText setText( endReasonText, GetDvarString( "g_TeamName_Allies" ) );
182 
183  outcomeText setText( endReasonText );
184 
185  outcomeTitle setCOD7DecodeFX( 200, duration, 600 );
186  outcomeText setPulseFX( 100, duration, 1000 );
187 
188  iconSpacing = 100;
189  currentX = -(level.teamCount-1) * iconSpacing / 2;
190  teamIcons = [];
191  teamIcons[team] = ‪hud::createIcon( game["icons"][team], iconSize, iconSize );
192  teamIcons[team] ‪hud::setParent( outcomeText );
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;
200 
201  foreach( enemyTeam in level.teams )
202  {
203  if ( team == enemyTeam )
204  continue;
205 
206  teamIcons[enemyTeam] = ‪hud::createIcon( game["icons"][enemyTeam], iconSize, iconSize );
207  teamIcons[enemyTeam] ‪hud::setParent( outcomeText );
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;
215  }
216 
217  teamScores = [];
218  teamScores[team] = ‪hud::createFontString( font, titleSize );
219  teamScores[team] ‪hud::setParent( teamIcons[team] );
220  teamScores[team] ‪hud::setPoint( "TOP", "BOTTOM", 0, spacing );
221  //teamScores[team].glowColor = game["colors"][team];
222  teamScores[team].glowAlpha = 1;
223  if ( isRound )
224  {
225  teamScores[team] setValue( getTeamScore( team ) );
226  }
227  else
228  {
229  teamScores[team] [[level.setMatchScoreHUDElemForTeam]]( team );
230  }
231  teamScores[team].hideWhenInMenu = false;
232  teamScores[team].archived = false;
233  teamScores[team] setPulseFX( 100, duration, 1000 );
234 
235  foreach( enemyTeam in level.teams )
236  {
237  if ( team == enemyTeam )
238  continue;
239 
240  teamScores[enemyTeam] = ‪hud::createFontString( headerFont, titleSize );
241  teamScores[enemyTeam] ‪hud::setParent( teamIcons[enemyTeam] );
242  teamScores[enemyTeam] ‪hud::setPoint( "TOP", "BOTTOM", 0, spacing );
243  //teamScores[enemyTeam].glowColor = game["colors"][enemyTeam];
244  teamScores[enemyTeam].glowAlpha = 1;
245  if ( isRound )
246  {
247  teamScores[enemyTeam] setValue( getTeamScore( enemyTeam ) );
248  }
249  else
250  {
251  teamScores[enemyTeam] [[level.setMatchScoreHUDElemForTeam]]( enemyTeam );
252  }
253  teamScores[enemyTeam].hideWhenInMenu = false;
254  teamScores[enemyTeam].archived = false;
255  teamScores[enemyTeam] setPulseFX( 100, duration, 1000 );
256  }
257 
258  font = "objective";
259  matchBonus = undefined;
260  if ( isdefined( self.matchBonus ) )
261  {
262  matchBonus = ‪hud::createFontString( font, 2.0 );
263  matchBonus ‪hud::setParent( outcomeText );
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 );
270  /*if ( isdefined( level.codPointsMatchScale ) && level.codPointsMatchScale )
271  {
272  codPointsMatchBonus = undefined;
273  codPointsMatchBonus = hud::createFontString( font, 2.0 );
274  codPointsMatchBonus hud::setParent( outcomeText );
275  codPointsMatchBonus hud::setPoint( "TOP", "BOTTOM", 0, iconSize + (spacing * 4) + leftScore.height );
276  codPointsMatchBonus.glowAlpha = 1;
277  codPointsMatchBonus.hideWhenInMenu = false;
278  codPointsMatchBonus.archived = false;
279  codPointsMatchBonus.label = game["strings"]["codpoints_match_bonus"];
280  codPointsMatchBonus setValue( round_up( self.matchBonus * level.codPointsMatchScale ) );
281  }*/
282  }
283 
284  self thread ‪resetOutcomeNotify( teamIcons, teamScores, outcomeTitle, outcomeText );
285 }
286 
287 function ‪teamOutcomeNotifyZombie( winner, isRound, endReasonText )
288 {
289  self endon ( "disconnect" );
290  self notify ( "reset_outcome" );
291 
292  team = self.pers["team"];
293  if ( isdefined( team ) && team == "spectator" )
294  {
295  for ( i = 0; i < level.players.size; i++ )
296  {
297  if ( self.currentspectatingclient == level.players[i].clientId )
298  {
299  team = level.players[i].pers["team"];
300  break;
301  }
302  }
303  }
304 
305  if ( !isdefined( team ) || !isdefined( level.teams[team] ) )
306  team = "allies";
307 
308  // wait for notifies to finish
309  while ( self.doingNotify )
311 
312  self endon ( "reset_outcome" );
313 
314 
315  if ( self IsSplitscreen() )
316  {
317  titleSize = 2.0;
318  spacing = 10;
319  font = "default";
320  }
321  else
322  {
323  titleSize = 3.0;
324  spacing = 50;
325  font = "objective";
326  }
327 
328  const duration = 60000;
329 
330  outcomeTitle = ‪hud::createFontString( font, titleSize );
331  outcomeTitle ‪hud::setPoint( "TOP", undefined, 0, spacing );
332  outcomeTitle.glowAlpha = 1;
333  outcomeTitle.hideWhenInMenu = false;
334  outcomeTitle.archived = false;
335 
336  outcomeTitle setText( endReasonText );
337  outcomeTitle setPulseFX( 100, duration, 1000 );
338 
339  self thread ‪resetOutcomeNotify( undefined, undefined, outcomeTitle );
340 }
341 
342 function ‪outcomeNotify( winner, isRoundEnd, endReasonText )
343 {
344  self endon ( "disconnect" );
345  self notify ( "reset_outcome" );
346 
347  // wait for notifies to finish
348  while ( self.doingNotify )
350 
351  self endon ( "reset_outcome" );
352 
353  headerFont = "extrabig";
354  font = "default";
355  if ( self IsSplitscreen() )
356  {
357  titleSize = 2.0;
358  winnerSize = 1.5;
359  otherSize = 1.5;
360  iconSize = 30;
361  spacing = 10;
362  }
363  else
364  {
365  titleSize = 3.0;
366  winnerSize = 2.0;
367  otherSize = 1.5;
368  iconSize = 30;
369  spacing = 20;
370  }
371 
372  duration = 60000;
373 
374  players = level.placement["all"];
375 
376  outcomeTitle = ‪hud::createFontString( headerFont, titleSize );
377  outcomeTitle ‪hud::setPoint( "TOP", undefined, 0, spacing );
378  if ( !‪util::isOneRound() && !isRoundEnd )
379  {
380  outcomeTitle setText( game["strings"]["game_over"] );
381  }
382  else if ( isdefined( players[1] ) && players[0].score == players[1].score && players[0].deaths == players[1].deaths && (self == players[0] || self == players[1]) )
383  {
384  outcomeTitle setText( game["strings"]["tie"] );
386  }
387  else if ( isdefined( players[2] ) && players[0].score == players[2].score && players[0].deaths == players[2].deaths && self == players[2] )
388  {
389  outcomeTitle setText( game["strings"]["tie"] );
390  //outcomeTitle.glowColor = (0.2, 0.3, 0.7);
391  }
392  else if ( isdefined( players[0] ) && self == players[0] )
393  {
394  outcomeTitle setText( game["strings"]["victory"] );
395  outcomeTitle.color = (0.42, 0.68, 0.46);
396  //outcomeTitle.glowColor = (0.2, 0.3, 0.7);
397  }
398  else
399  {
400  outcomeTitle setText( game["strings"]["defeat"] );
401  outcomeTitle.color = (0.73, 0.29, 0.19);
402  //outcomeTitle.glowColor = (0.7, 0.3, 0.2);
403  }
404  outcomeTitle.glowAlpha = 1;
405  outcomeTitle.hideWhenInMenu = false;
406  outcomeTitle.archived = false;
407  outcomeTitle setCOD7DecodeFX( 200, duration, 600 );
408 
409  outcomeText = ‪hud::createFontString( font, 2.0 );
410  outcomeText ‪hud::setParent( outcomeTitle );
411  outcomeText ‪hud::setPoint( "TOP", "BOTTOM", 0, 0 );
412  outcomeText.glowAlpha = 1;
413  outcomeText.hideWhenInMenu = false;
414  outcomeText.archived = false;
415  //outcomeText.glowColor = (0.2, 0.3, 0.7);
416  outcomeText setText( endReasonText );
417 
418  firstTitle = ‪hud::createFontString( font, winnerSize );
419  firstTitle ‪hud::setParent( outcomeText );
420  firstTitle ‪hud::setPoint( "TOP", "BOTTOM", 0, spacing );
421  //firstTitle.glowColor = (0.3, 0.7, 0.2);
422  firstTitle.glowAlpha = 1;
423  firstTitle.hideWhenInMenu = false;
424  firstTitle.archived = false;
425  if ( isdefined( players[0] ) )
426  {
427  firstTitle.label = &"MP_FIRSTPLACE_NAME";
428  firstTitle setPlayerNameString( players[0] );
429  firstTitle setCOD7DecodeFX( 175, duration, 600 );
430  }
431 
432  secondTitle = ‪hud::createFontString( font, otherSize );
433  secondTitle ‪hud::setParent( firstTitle );
434  secondTitle ‪hud::setPoint( "TOP", "BOTTOM", 0, spacing );
435  //secondTitle.glowColor = (0.2, 0.3, 0.7);
436  secondTitle.glowAlpha = 1;
437  secondTitle.hideWhenInMenu = false;
438  secondTitle.archived = false;
439  if ( isdefined( players[1] ) )
440  {
441  secondTitle.label = &"MP_SECONDPLACE_NAME";
442  secondTitle setPlayerNameString( players[1] );
443  secondTitle setCOD7DecodeFX( 175, duration, 600 );
444  }
445 
446  thirdTitle = ‪hud::createFontString( font, otherSize );
447  thirdTitle ‪hud::setParent( secondTitle );
448  thirdTitle ‪hud::setPoint( "TOP", "BOTTOM", 0, spacing );
449  thirdTitle ‪hud::setParent( secondTitle );
450  //thirdTitle.glowColor = (0.2, 0.3, 0.7);
451  thirdTitle.glowAlpha = 1;
452  thirdTitle.hideWhenInMenu = false;
453  thirdTitle.archived = false;
454  if ( isdefined( players[2] ) )
455  {
456  thirdTitle.label = &"MP_THIRDPLACE_NAME";
457  thirdTitle setPlayerNameString( players[2] );
458  thirdTitle setCOD7DecodeFX( 175, duration, 600 );
459  }
460 
461  matchBonus = ‪hud::createFontString( font, 2.0 );
462  matchBonus ‪hud::setParent( thirdTitle );
463  matchBonus ‪hud::setPoint( "TOP", "BOTTOM", 0, spacing );
464  matchBonus.glowAlpha = 1;
465  matchBonus.hideWhenInMenu = false;
466  matchBonus.archived = false;
467  if ( isdefined( self.matchBonus ) )
468  {
469  matchBonus.label = game["strings"]["match_bonus"];
470  matchBonus setValue( self.matchBonus );
471  }
472 
473  self thread ‪updateOutcome( firstTitle, secondTitle, thirdTitle );
474  self thread ‪resetOutcomeNotify( undefined, undefined, outcomeTitle, outcomeText, firstTitle, secondTitle, thirdTitle, matchBonus );
475 }
476 
477 function ‪wagerOutcomeNotify( winner, endReasonText )
478 {
479  self endon ( "disconnect" );
480  self notify ( "reset_outcome" );
481 
482  // wait for notifies to finish
483  while ( self.doingNotify )
485 
486  //setMatchFlag( "enable_popups", 0 );
487 
488  self endon ( "reset_outcome" );
489 
490  headerFont = "extrabig";
491  font = "objective";
492  if ( self IsSplitscreen() )
493  {
494  titleSize = 2.0;
495  winnerSize = 1.5;
496  otherSize = 1.5;
497  iconSize = 30;
498  spacing = 2;
499  }
500  else
501  {
502  titleSize = 3.0;
503  winnerSize = 2.0;
504  otherSize = 1.5;
505  iconSize = 30;
506  spacing = 20;
507  }
508 
509  halftime = false;
510  if ( isdefined( level.sidebet ) && level.sidebet )
511  halftime = true;
512 
513  duration = 60000;
514 
515  players = level.placement["all"];
516 
517  outcomeTitle = ‪hud::createFontString( headerFont, titleSize );
518  outcomeTitle ‪hud::setPoint( "TOP", undefined, 0, spacing );
519  if( halftime )
520  {
521  outcomeTitle setText( game["strings"]["intermission"] );
522  outcomeTitle.color = (1.0, 1.0, 0.0);
523  outcomeTitle.glowColor = (1.0, 0.0, 0.0);
524  }
525  else if( isdefined(level.dontCalcWagerWinnings) && level.dontCalcWagerWinnings == true )
526  {
527  outcomeTitle setText( game["strings"]["wager_topwinners"] );
528  outcomeTitle.color = (0.42, 0.68, 0.46);
529  }
530  else
531  {
532  if ( isdefined( self.wagerWinnings ) && ( self.wagerWinnings > 0 ) )
533  {
534  outcomeTitle setText( game["strings"]["wager_inthemoney"] );
535  outcomeTitle.color = (0.42, 0.68, 0.46);
536  }
537  else
538  {
539  outcomeTitle setText( game["strings"]["wager_loss"] );
540  outcomeTitle.color = (0.73, 0.29, 0.19);
541  }
542  }
543  outcomeTitle.glowAlpha = 1;
544  outcomeTitle.hideWhenInMenu = false;
545  outcomeTitle.archived = false;
546  outcomeTitle setCOD7DecodeFX( 200, duration, 600 );
547 
548  outcomeText = ‪hud::createFontString( font, 2.0 );
549  outcomeText ‪hud::setParent( outcomeTitle );
550  outcomeText ‪hud::setPoint( "TOP", "BOTTOM", 0, 0 );
551  outcomeText.glowAlpha = 1;
552  outcomeText.hideWhenInMenu = false;
553  outcomeText.archived = false;
554  //outcomeText.glowColor = (0.2, 0.3, 0.7);
555  outcomeText setText( endReasonText );
556 
557  playerNameHudElems = [];
558  playerCPHudElems = [];
559  numPlayers = players.size;
560  for ( i = 0 ; i < numPlayers ; i++ )
561  {
562  if ( !halftime && isdefined( players[i] ) )
563  {
564  secondTitle = ‪hud::createFontString( font, otherSize );
565  if ( playerNameHudElems.size == 0 )
566  {
567  secondTitle ‪hud::setParent( outcomeText );
568  secondTitle ‪hud::setPoint( "TOP_LEFT", "BOTTOM", -175, spacing*3 );
569  }
570  else
571  {
572  secondTitle ‪hud::setParent( playerNameHudElems[playerNameHudElems.size-1] );
573  secondTitle ‪hud::setPoint( "TOP_LEFT", "BOTTOM_LEFT", 0, spacing );
574  }
575  //secondTitle.glowColor = (0.2, 0.3, 0.7);
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;
583 
584  secondCP = ‪hud::createFontString( font, otherSize );
585  secondCP ‪hud::setParent( secondTitle );
586  secondCP ‪hud::setPoint( "TOP_RIGHT", "TOP_LEFT", 350, 0 );
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;
594  else
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;
600  }
601  }
602 
603  /*matchBonus = hud::createFontString( font, 2.0 );
604  matchBonus hud::setParent( thirdTitle );
605  matchBonus hud::setPoint( "TOP", "BOTTOM_LEFT", 0, spacing );
606  matchBonus.glowAlpha = 1;
607  matchBonus.hideWhenInMenu = false;
608  matchBonus.archived = false;
609 
610  sidebetWinnings = undefined;
611  if ( !halftime && isdefined( self.wagerWinnings ) )
612  {
613  if ( isdefined( game["side_bets"] ) && game["side_bets"] )
614  {
615  sidebetWinnings = hud::createFontString( font, 2.0 );
616  sidebetWinnings hud::setParent( matchBonus );
617  sidebetWinnings hud::setPoint( "TOP", "BOTTOM", 0, spacing );
618  sidebetWinnings.glowAlpha = 1;
619  sidebetWinnings.hideWhenInMenu = false;
620  sidebetWinnings.archived = false;
621  sidebetWinnings.label = game["strings"]["wager_sidebet_winnings"];
622  sidebetWinnings setValue( self.pers["wager_sideBetWinnings"] );
623  }
624  }*/
625 
626  self thread ‪updateWagerOutcome( playerNameHudElems, playerCPHudElems );
627  self thread ‪resetWagerOutcomeNotify( playerNameHudElems, playerCPHudElems, outcomeTitle, outcomeText );
628 
629  if ( halftime )
630  return;
631 
632  stillUpdating = true;
633  countUpDuration = 2;
634  CPIncrement = 9999;
635  if ( isdefined( playerCPHudElems[0] ) )
636  {
637  CPIncrement = int( playerCPHudElems[0].targetValue / ( countUpDuration / 0.05 ) );
638  if ( CPIncrement < 1 )
639  CPIncrement = 1;
640  }
641  while( stillUpdating )
642  {
643  stillUpdating = false;
644  for ( i = 0 ; i < playerCPHudElems.size ; i++ )
645  {
646  if ( isdefined( playerCPHudElems[i] ) && ( playerCPHudElems[i].currentValue < playerCPHudElems[i].targetValue ) )
647  {
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;
653  }
654  }
656  }
657 }
658 
659 function ‪teamWagerOutcomeNotify( winner, isRoundEnd, endReasonText )
660 {
661  self endon ( "disconnect" );
662  self notify ( "reset_outcome" );
663 
664  team = self.pers["team"];
665  if ( !isdefined( team ) || (!isdefined( level.teams[team] ) ) )
666  team = "allies";
667 
669 
670  // wait for notifies to finish
671  while ( self.doingNotify )
673 
674  self endon ( "reset_outcome" );
675 
676  headerFont = "extrabig";
677  font = "objective";
678  if ( self IsSplitscreen() )
679  {
680  titleSize = 2.0;
681  textSize = 1.5;
682  iconSize = 30;
683  spacing = 10;
684  }
685  else
686  {
687  titleSize = 3.0;
688  textSize = 2.0;
689  iconSize = 70;
690  spacing = 15;
691  }
692 
693  halftime = false;
694  if ( isdefined( level.sidebet ) && level.sidebet )
695  halftime = true;
696 
697  duration = 60000;
698 
699  outcomeTitle = ‪hud::createFontString( headerFont, titleSize );
700  outcomeTitle ‪hud::setPoint( "TOP", undefined, 0, spacing );
701  outcomeTitle.glowAlpha = 1;
702  outcomeTitle.hideWhenInMenu = false;
703  outcomeTitle.archived = false;
704 
705  outcomeText = ‪hud::createFontString( font, 2.0 );
706  outcomeText ‪hud::setParent( outcomeTitle );
707  outcomeText ‪hud::setPoint( "TOP", "BOTTOM", 0, 0 );
708  outcomeText.glowAlpha = 1;
709  outcomeText.hideWhenInMenu = false;
710  outcomeText.archived = false;
711 
712  if ( winner == "tie" )
713  {
714  //outcomeTitle.glowColor = (0.2, 0.3, 0.7);
715  if ( isRoundEnd )
716  outcomeTitle setText( game["strings"]["round_draw"] );
717  else
718  outcomeTitle setText( game["strings"]["draw"] );
719  outcomeTitle.color = (1, 1, 1);
720 
721  winner = "allies";
722  }
723  else if ( winner == "overtime" )
724  {
725  outcomeTitle setText( game["strings"]["overtime"] );
726  outcomeTitle.color = (1, 1, 1);
727 
728  }
729  else if ( isdefined( self.pers["team"] ) && winner == team )
730  {
731  //outcomeTitle.glowColor = (0, 0, 0);
732  if ( isRoundEnd )
733  outcomeTitle setText( game["strings"]["round_win"] );
734  else
735  outcomeTitle setText( game["strings"]["victory"] );
736  outcomeTitle.color = (0.42, 0.68, 0.46);
737  }
738  else
739  {
740  //outcomeTitle.glowColor = (0, 0, 0);
741  if ( isRoundEnd )
742  outcomeTitle setText( game["strings"]["round_loss"] );
743  else
744  outcomeTitle setText( game["strings"]["defeat"] );
745  outcomeTitle.color = (0.73, 0.29, 0.19);
746  }
747  if( !isdefined( level.dontShowEndReason ) || !level.dontShowEndReason )
748  {
749  outcomeText setText( endReasonText );
750  }
751 
752  outcomeTitle setPulseFX( 100, duration, 1000 );
753  outcomeText setPulseFX( 100, duration, 1000 );
754 
755  teamIcons = [];
756  teamIcons[team] = ‪hud::createIcon( game["icons"][team], iconSize, iconSize );
757  teamIcons[team] ‪hud::setParent( outcomeText );
758  teamIcons[team] ‪hud::setPoint( "TOP", "BOTTOM", -60, spacing );
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;
764 
765  foreach( enemyTeam in level.teams )
766  {
767  if ( team == enemyTeam )
768  continue;
769 
770  teamIcons[enemyTeam] = ‪hud::createIcon( game["icons"][enemyTeam], iconSize, iconSize );
771  teamIcons[enemyTeam] ‪hud::setParent( outcomeText );
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;
778  }
779 
780  teamScores = [];
781  teamScores[team] = ‪hud::createFontString( font, titleSize );
782  teamScores[team] ‪hud::setParent( teamIcons[team] );
783  teamScores[team] ‪hud::setPoint( "TOP", "BOTTOM", 0, spacing );
784  //teamScores[team].glowColor = game["colors"][team];
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 );
790 
791  foreach( enemyTeam in level.teams )
792  {
793  if ( team == enemyTeam )
794  continue;
795 
796  teamScores[enemyTeam] = ‪hud::createFontString( font, titleSize );
797  teamScores[enemyTeam] ‪hud::setParent( teamIcons[enemyTeam] );
798  teamScores[enemyTeam] ‪hud::setPoint( "TOP", "BOTTOM", 0, spacing );
799  //teamScores[enemyTeam].glowColor = game["colors"][enemyTeam];
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 );
805  }
806 
807  matchBonus = undefined;
808  sidebetWinnings = undefined;
809  if ( !isRoundEnd && !halftime && isdefined( self.wagerWinnings ) )
810  {
811  matchBonus = ‪hud::createFontString( font, 2.0 );
812  matchBonus ‪hud::setParent( outcomeText );
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 );
819 
820  if ( isdefined( game["side_bets"] ) && game["side_bets"] )
821  {
822  sidebetWinnings = ‪hud::createFontString( font, 2.0 );
823  sidebetWinnings ‪hud::setParent( matchBonus );
824  sidebetWinnings ‪hud::setPoint( "TOP", "BOTTOM", 0, spacing );
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"] );
830  }
831  }
832  self thread ‪resetOutcomeNotify( teamIcons, teamScores, outcomeTitle, outcomeText, matchBonus, sidebetWinnings );
833 }
834 
835 function ‪resetOutcomeNotify( hudElemList1, hudElemList2, hudElem3, hudElem4, hudElem5, hudElem6, hudElem7, hudElem8, hudElem9, hudElem10 )
836 {
837  self endon ( "disconnect" );
838  self waittill ( "reset_outcome" );
839 
840  ‪destroyHudElem( hudElem3 );
841  ‪destroyHudElem( hudElem4 );
842  ‪destroyHudElem( hudElem5 );
843  ‪destroyHudElem( hudElem6 );
844  ‪destroyHudElem( hudElem7 );
845  ‪destroyHudElem( hudElem8 );
846  ‪destroyHudElem( hudElem9 );
847  ‪destroyHudElem( hudElem10 );
848 
849  if ( isdefined( hudElemList1 ) )
850  {
851  foreach( elem in hudElemList1 )
852  {
853  ‪destroyHudElem( elem );
854  }
855  }
856 
857  if ( isdefined( hudElemList2 ) )
858  {
859  foreach( elem in hudElemList2 )
860  {
861  ‪destroyHudElem( elem );
862  }
863  }
864 }
865 
866 function ‪resetWagerOutcomeNotify( playerNameHudElems, playerCPHudElems, outcomeTitle, outcomeText )
867 {
868  self endon( "disconnect" );
869  self waittill( "reset_outcome" );
870 
871  for ( i = playerNameHudElems.size - 1 ; i >= 0 ; i-- )
872  {
873  if ( isdefined( playerNameHudElems[i] ) )
874  playerNameHudElems[i] ‪destroy();
875  }
876 
877  for ( i = playerCPHudElems.size - 1 ; i >= 0 ; i-- )
878  {
879  if ( isdefined( playerCPHudElems[i] ) )
880  playerCPHudElems[i] ‪destroy();
881  }
882 
883  if ( isdefined( outcomeText ) )
884  outcomeText ‪destroy();
885 
886  if ( isdefined( outcomeTitle ) )
887  outcomeTitle ‪destroy();
888 }
889 
890 function ‪updateOutcome( firstTitle, secondTitle, thirdTitle )
891 {
892  self endon( "disconnect" );
893  self endon( "reset_outcome" );
894 
895  while( true )
896  {
897  self waittill( "update_outcome" );
898 
899  players = level.placement["all"];
900 
901  if ( isdefined( firstTitle ) && isdefined( players[0] ) )
902  firstTitle setPlayerNameString( players[0] );
903  else if ( isdefined( firstTitle ) )
904  firstTitle.alpha = 0;
905 
906  if ( isdefined( secondTitle ) && isdefined( players[1] ) )
907  secondTitle setPlayerNameString( players[1] );
908  else if ( isdefined( secondTitle ) )
909  secondTitle.alpha = 0;
910 
911  if ( isdefined( thirdTitle ) && isdefined( players[2] ) )
912  thirdTitle setPlayerNameString( players[2] );
913  else if ( isdefined( thirdTitle ) )
914  thirdTitle.alpha = 0;
915  }
916 }
917 
918 function ‪updateWagerOutcome( playerNameHudElems, playerCPHudElems )
919 {
920  self endon( "disconnect" );
921  self endon( "reset_outcome" );
922 
923  while ( true )
924  {
925  self waittill( "update_outcome" );
926 
927  players = level.placement["all"];
928 
929  for ( i = 0 ; i < playerNameHudElems.size ; i++ )
930  {
931  if ( isdefined( playerNameHudElems[i] ) && isdefined( players[playerNameHudElems[i].playerNum] ) )
932  playerNameHudElems[i] SetPlayerNameString( players[playerNameHudElems[i].playerNum] );
933  else
934  {
935  if ( isdefined( playerNameHudElems[i] ) )
936  playerNameHudElems[i].alpha = 0;
937  if ( isdefined( playerCPHudElems[i] ) )
938  playerCPHudElems[i].alpha = 0;
939  }
940  }
941  }
942 }
‪destroyHudElem
‪function destroyHudElem(hudElem)
Definition: hud_message_shared.gsc:511
‪isOneRound
‪function isOneRound()
Definition: util_shared.gsc:3497
‪teamWagerOutcomeNotify
‪function teamWagerOutcomeNotify(winner, isRoundEnd, endReasonText)
Definition: _hud_message.gsc:612
‪resetWagerOutcomeNotify
‪function resetWagerOutcomeNotify(playerNameHudElems, playerCPHudElems, outcomeTitle, outcomeText)
Definition: _hud_message.gsc:830
‪init
‪function init()
Definition: _hud_message.gsc:53
‪setPoint
‪function setPoint(point, relativePoint, xOffset, yOffset, moveTime)
Definition: hud_util_shared.gsc:53
‪teamOutcomeNotify
‪function teamOutcomeNotify(winner, endType, endReasonText)
Definition: _hud_message.gsc:80
‪wagerOutcomeNotify
‪function wagerOutcomeNotify(winner, endReasonText)
Definition: _hud_message.gsc:448
‪setParent
‪function setParent(element)
Definition: hud_util_shared.gsc:10
‪createFontString
‪function createFontString(font, fontScale)
Definition: hud_util_shared.gsc:334
‪updateOutcome
‪function updateOutcome(firstTitle, secondTitle, thirdTitle)
Definition: _hud_message.gsc:854
‪outcomeNotify
‪function outcomeNotify(winner, isRoundEnd, endReasonText)
Definition: _hud_message.gsc:386
‪resetOutcomeNotify
‪function resetOutcomeNotify(hudElemList1, hudElemList2, hudElem3, hudElem4, hudElem5, hudElem6, hudElem7, hudElem8, hudElem9, hudElem10)
Definition: _hud_message.gsc:799
‪updateWagerOutcome
‪function updateWagerOutcome(playerNameHudElems, playerCPHudElems)
Definition: _hud_message.gsc:882
‪destroy
‪function destroy(watcher, owner)
Definition: _decoy.gsc:108
‪createIcon
‪function createIcon(shader, width, height)
Definition: hud_util_shared.gsc:417
‪teamOutcomeNotifyZombie
‪function teamOutcomeNotifyZombie(winner, isRound, endReasonText)
Definition: _hud_message.gsc:329
‪WAIT_SERVER_FRAME
‪#define WAIT_SERVER_FRAME
Definition: shared.gsh:265