Advertisement
Guest User

Untitled

a guest
Sep 29th, 2010
529
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 32.61 KB | None | 0 0
  1. #include maps\mp\_utility;
  2. #include maps\mp\gametypes\_hud_util;
  3. #include common_scripts\utility;
  4.  
  5. init()
  6. {
  7. precacheString( &"MP_FIRSTPLACE_NAME" );
  8. precacheString( &"MP_SECONDPLACE_NAME" );
  9. precacheString( &"MP_THIRDPLACE_NAME" );
  10. precacheString( &"MP_MATCH_BONUS_IS" );
  11.  
  12. precacheMenu( "splash" );
  13. precacheMenu( "challenge" );
  14. precacheMenu( "defcon" );
  15. precacheMenu( "killstreak" );
  16. precacheMenu( "perk_display" );
  17. precacheMenu( "perk_hide" );
  18. precacheMenu( "killedby_card_display" );
  19. precacheMenu( "killedby_card_hide" );
  20. precacheMenu( "youkilled_card_display" );
  21.  
  22. game["menu_endgameupdate"] = "endgameupdate";
  23. if ( level.splitscreen )
  24. game["menu_endgameupdate"] += "_splitscreen";
  25. precacheMenu(game["menu_endgameupdate"]);
  26.  
  27. game["strings"]["draw"] = &"MP_DRAW";
  28. game["strings"]["round_draw"] = &"MP_ROUND_DRAW";
  29. game["strings"]["round_win"] = &"MP_ROUND_WIN";
  30. game["strings"]["round_loss"] = &"MP_ROUND_LOSS";
  31. game["strings"]["victory"] = &"MP_VICTORY";
  32. game["strings"]["defeat"] = &"MP_DEFEAT";
  33. game["strings"]["halftime"] = &"MP_HALFTIME";
  34. game["strings"]["overtime"] = &"MP_OVERTIME";
  35. game["strings"]["roundend"] = &"MP_ROUNDEND";
  36. game["strings"]["intermission"] = &"MP_INTERMISSION";
  37. game["strings"]["side_switch"] = &"MP_SWITCHING_SIDES";
  38. game["strings"]["match_bonus"] = &"MP_MATCH_BONUS_IS";
  39.  
  40. level thread onPlayerConnect();
  41. }
  42.  
  43.  
  44. onPlayerConnect()
  45. {
  46. for(;;)
  47. {
  48. level waittill( "connected", player );
  49.  
  50. player thread hintMessageDeathThink();
  51. player thread lowerMessageThink();
  52.  
  53. player thread initNotifyMessage();
  54. }
  55. }
  56.  
  57.  
  58. hintMessage( hintText )
  59. {
  60. notifyData = spawnstruct();
  61.  
  62. notifyData.notifyText = hintText;
  63. notifyData.glowColor = (0.3, 0.6, 0.3);
  64.  
  65. notifyMessage( notifyData );
  66. }
  67.  
  68.  
  69. initNotifyMessage()
  70. {
  71. if ( level.splitscreen )
  72. {
  73. titleSize = 2.0;
  74. textSize = 1.5;
  75. iconSize = 24;
  76. font = "default";
  77. point = "TOP";
  78. relativePoint = "BOTTOM";
  79. yOffset = 30;
  80. xOffset = 0;
  81. }
  82. else
  83. {
  84. titleSize = 2.5;
  85. textSize = 1.75;
  86. iconSize = 30;
  87. font = "objective";
  88. point = "TOP";
  89. relativePoint = "BOTTOM";
  90. yOffset = 50;
  91. xOffset = 0;
  92. }
  93.  
  94. self.notifyTitle = createFontString( font, titleSize );
  95. self.notifyTitle setPoint( point, undefined, xOffset, yOffset );
  96. self.notifyTitle.glowColor = (0.2, 0.3, 0.7);
  97. self.notifyTitle.glowAlpha = 1;
  98. self.notifyTitle.hideWhenInMenu = true;
  99. self.notifyTitle.archived = false;
  100. self.notifyTitle.alpha = 0;
  101.  
  102. self.notifyText = createFontString( font, textSize );
  103. self.notifyText setParent( self.notifyTitle );
  104. self.notifyText setPoint( point, relativePoint, 0, 0 );
  105. self.notifyText.glowColor = (0.2, 0.3, 0.7);
  106. self.notifyText.glowAlpha = 1;
  107. self.notifyText.hideWhenInMenu = true;
  108. self.notifyText.archived = false;
  109. self.notifyText.alpha = 0;
  110.  
  111. self.notifyText2 = createFontString( font, textSize );
  112. self.notifyText2 setParent( self.notifyTitle );
  113. self.notifyText2 setPoint( point, relativePoint, 0, 0 );
  114. self.notifyText2.glowColor = (0.2, 0.3, 0.7);
  115. self.notifyText2.glowAlpha = 1;
  116. self.notifyText2.hideWhenInMenu = true;
  117. self.notifyText2.archived = false;
  118. self.notifyText2.alpha = 0;
  119.  
  120. self.notifyIcon = createIcon( "white", iconSize, iconSize );
  121. self.notifyIcon setParent( self.notifyText2 );
  122. self.notifyIcon setPoint( point, relativePoint, 0, 0 );
  123. self.notifyIcon.hideWhenInMenu = true;
  124. self.notifyIcon.archived = false;
  125. self.notifyIcon.alpha = 0;
  126.  
  127. self.notifyOverlay = createIcon( "white", iconSize, iconSize );
  128. self.notifyOverlay setParent( self.notifyIcon );
  129. self.notifyOverlay setPoint( "CENTER", "CENTER", 0, 0 );
  130. self.notifyOverlay.hideWhenInMenu = true;
  131. self.notifyOverlay.archived = false;
  132. self.notifyOverlay.alpha = 0;
  133.  
  134. self.doingSplash = [];
  135. self.doingSplash[0] = undefined;
  136. self.doingSplash[1] = undefined;
  137. self.doingSplash[2] = undefined;
  138. self.doingSplash[3] = undefined;
  139.  
  140. self.splashQueue = [];
  141. self.splashQueue[0] = [];
  142. self.splashQueue[1] = [];
  143. self.splashQueue[2] = [];
  144. self.splashQueue[3] = [];
  145. }
  146.  
  147.  
  148. oldNotifyMessage( titleText, notifyText, iconName, glowColor, sound, duration )
  149. {
  150. notifyData = spawnstruct();
  151.  
  152. notifyData.titleText = titleText;
  153. notifyData.notifyText = notifyText;
  154. notifyData.iconName = iconName;
  155. notifyData.glowColor = glowColor;
  156. notifyData.sound = sound;
  157. notifyData.duration = duration;
  158.  
  159. notifyMessage( notifyData );
  160. }
  161.  
  162.  
  163. notifyMessage( notifyData )
  164. {
  165. self endon ( "death" );
  166. self endon ( "disconnect" );
  167.  
  168. if ( !isDefined( notifyData.slot ) )
  169. notifyData.slot = 0;
  170.  
  171. slot = notifyData.slot;
  172.  
  173. if ( !isDefined( notifyData.type ) )
  174. notifyData.type = "";
  175.  
  176. if ( !isDefined( self.doingSplash[ slot ] ) )
  177. {
  178. self thread showNotifyMessage( notifyData );
  179. return;
  180. }/*
  181. else if ( notifyData.type == "rank" && self.doingSplash[ slot ].type != "challenge" && self.doingSplash[ slot ].type != "killstreak" )
  182. {
  183. self thread showNotifyMessage( notifyData );
  184. return;
  185. }*/
  186.  
  187. self.splashQueue[ slot ][ self.splashQueue[ slot ].size ] = notifyData;
  188. }
  189.  
  190.  
  191. dispatchNotify( slot )
  192. {
  193. nextNotifyData = self.splashQueue[ slot ][ 0 ];
  194.  
  195. for ( i = 1; i < self.splashQueue[ slot ].size; i++ )
  196. self.splashQueue[ slot ][i-1] = self.splashQueue[ slot ][i];
  197. self.splashQueue[ slot ][i-1] = undefined;
  198.  
  199. if ( isDefined( nextNotifyData.name ) )
  200. actionNotify( nextNotifyData );
  201. else
  202. showNotifyMessage( nextNotifyData );
  203. }
  204.  
  205.  
  206. promotionSplashNotify()
  207. {
  208. self endon ( "disconnect" );
  209.  
  210. actionData = spawnStruct();
  211.  
  212. actionData.name = "promotion";
  213. actionData.type = "rank";
  214. actionData.sound = "mp_level_up";
  215. actionData.slot = 0;
  216.  
  217. self thread actionNotify( actionData );
  218. }
  219.  
  220.  
  221. showNotifyMessage( notifyData )
  222. {
  223. self endon("disconnect");
  224.  
  225. assert( isDefined( notifyData.slot ) );
  226. slot = notifyData.slot;
  227.  
  228. if ( level.gameEnded )
  229. {
  230. if ( isDefined( notifyData.type ) && notifyData.type == "rank" )
  231. {
  232. self setClientDvar( "ui_promotion", 1 );
  233. self.postGamePromotion = true;
  234. }
  235.  
  236. if ( self.splashQueue[ slot ].size )
  237. self thread dispatchNotify( slot );
  238.  
  239. return;
  240. }
  241.  
  242. self.doingSplash[ slot ] = notifyData;
  243.  
  244. waitRequireVisibility( 0 );
  245.  
  246. if ( isDefined( notifyData.duration ) )
  247. duration = notifyData.duration;
  248. else if ( level.gameEnded )
  249. duration = 2.0;
  250. else
  251. duration = 4.0;
  252.  
  253. self thread resetOnCancel();
  254.  
  255. if ( isDefined( notifyData.sound ) )
  256. self playLocalSound( notifyData.sound );
  257.  
  258. if ( isDefined( notifyData.leaderSound ) )
  259. self leaderDialogOnPlayer( notifyData.leaderSound );
  260.  
  261. if ( isDefined( notifyData.glowColor ) )
  262. glowColor = notifyData.glowColor;
  263. else
  264. glowColor = (0.3, 0.6, 0.3);
  265.  
  266. anchorElem = self.notifyTitle;
  267.  
  268. if ( isDefined( notifyData.titleText ) )
  269. {
  270. if ( isDefined( notifyData.titleLabel ) )
  271. self.notifyTitle.label = notifyData.titleLabel;
  272. else
  273. self.notifyTitle.label = &"";
  274.  
  275. if ( isDefined( notifyData.titleLabel ) && !isDefined( notifyData.titleIsString ) )
  276. self.notifyTitle setValue( notifyData.titleText );
  277. else
  278. self.notifyTitle setText( notifyData.titleText );
  279. self.notifyTitle setPulseFX( int(25*duration), int(duration*1000), 1000 );
  280. self.notifyTitle.glowColor = glowColor;
  281. self.notifyTitle.alpha = 1;
  282. }
  283.  
  284. if ( isDefined( notifyData.textGlowColor ) )
  285. glowColor = notifyData.textGlowColor;
  286.  
  287. if ( isDefined( notifyData.notifyText ) )
  288. {
  289. if ( isDefined( notifyData.textLabel ) )
  290. self.notifyText.label = notifyData.textLabel;
  291. else
  292. self.notifyText.label = &"";
  293.  
  294. if ( isDefined( notifyData.textLabel ) && !isDefined( notifyData.textIsString ) )
  295. self.notifyText setValue( notifyData.notifyText );
  296. else
  297. self.notifyText setText( notifyData.notifyText );
  298. self.notifyText setPulseFX( 100, int(duration*1000), 1000 );
  299. self.notifyText.glowColor = glowColor;
  300. self.notifyText.alpha = 1;
  301. anchorElem = self.notifyText;
  302. }
  303.  
  304. if ( isDefined( notifyData.notifyText2 ) )
  305. {
  306. self.notifyText2 setParent( anchorElem );
  307.  
  308. if ( isDefined( notifyData.text2Label ) )
  309. self.notifyText2.label = notifyData.text2Label;
  310. else
  311. self.notifyText2.label = &"";
  312.  
  313. self.notifyText2 setText( notifyData.notifyText2 );
  314. self.notifyText2 setPulseFX( 100, int(duration*1000), 1000 );
  315. self.notifyText2.glowColor = glowColor;
  316. self.notifyText2.alpha = 1;
  317. anchorElem = self.notifyText2;
  318. }
  319.  
  320. if ( isDefined( notifyData.iconName ) )
  321. {
  322. self.notifyIcon setParent( anchorElem );
  323. self.notifyIcon setShader( notifyData.iconName, 60, 60 );
  324. self.notifyIcon.alpha = 0;
  325.  
  326. if ( isDefined( notifyData.iconOverlay ) )
  327. {
  328. self.notifyIcon fadeOverTime( 0.15 );
  329. self.notifyIcon.alpha = 1;
  330.  
  331. //if ( !isDefined( notifyData.overlayOffsetY ) )
  332. notifyData.overlayOffsetY = 0;
  333.  
  334. self.notifyOverlay setParent( self.notifyIcon );
  335. self.notifyOverlay setPoint( "CENTER", "CENTER", 0, notifyData.overlayOffsetY );
  336. self.notifyOverlay setShader( notifyData.iconOverlay, 512, 512 );
  337. self.notifyOverlay.alpha = 0;
  338. self.notifyOverlay.color = (1,0,0);
  339.  
  340. self.notifyOverlay fadeOverTime( 0.4 );
  341. self.notifyOverlay.alpha = 0.85;
  342.  
  343. self.notifyOverlay scaleOverTime( 0.4, 32, 32 );
  344.  
  345. waitRequireVisibility( duration );
  346.  
  347. self.notifyIcon fadeOverTime( 0.75 );
  348. self.notifyIcon.alpha = 0;
  349.  
  350. self.notifyOverlay fadeOverTime( 0.75 );
  351. self.notifyOverlay.alpha = 0;
  352. }
  353. else
  354. {
  355. self.notifyIcon fadeOverTime( 1.0 );
  356. self.notifyIcon.alpha = 1;
  357.  
  358. waitRequireVisibility( duration );
  359.  
  360. self.notifyIcon fadeOverTime( 0.75 );
  361. self.notifyIcon.alpha = 0;
  362. }
  363. }
  364. else
  365. {
  366. waitRequireVisibility( duration );
  367. }
  368.  
  369. self notify ( "notifyMessageDone" );
  370. self.doingSplash[ slot ] = undefined;
  371.  
  372. if ( self.splashQueue[ slot ].size )
  373. self thread dispatchNotify( slot );
  374. }
  375.  
  376.  
  377. killstreakSplashNotify( streakName, streakVal, appendString )
  378. {
  379. self endon ( "disconnect" );
  380. waittillframeend;
  381.  
  382. if ( level.gameEnded )
  383. return;
  384.  
  385. actionData = spawnStruct();
  386.  
  387. if ( isDefined( appendString ) )
  388. actionData.name = streakName + "_" + appendString;
  389. else
  390. actionData.name = streakName;
  391.  
  392. actionData.type = "killstreak";
  393. actionData.optionalNumber = streakVal;
  394. actionData.sound = maps\mp\killstreaks\_killstreaks::getKillstreakSound( streakName );
  395. actionData.leaderSound = streakName;
  396. actionData.leaderSoundGroup = "killstreak_earned";
  397. actionData.slot = 0;
  398.  
  399. self thread actionNotify( actionData );
  400. }
  401.  
  402.  
  403. defconSplashNotify( defconLevel, forceNotify )
  404. {
  405. /*
  406. actionData = spawnStruct();
  407.  
  408. actionData.name = "defcon_" + defconLevel;
  409. actionData.sound = tableLookup( "mp/splashTable.csv", 0, actionData.name, 9 );
  410. actionData.slot = 0;
  411. actionData.forceNotify = forceNotify;
  412.  
  413. self thread actionNotify( actionData );
  414. */
  415. }
  416.  
  417.  
  418. challengeSplashNotify( challengeRef )
  419. {
  420. self endon ( "disconnect" );
  421. waittillframeend;
  422.  
  423. // this is used to ensure the client receives the new challenge state before the splash is shown.
  424. wait ( 0.05 );
  425.  
  426. //subtracting one from state becase state was incremented after completing challenge
  427. challengeState = ( self getPlayerData( "challengeState", challengeRef ) - 1 );
  428. challengeTarget = int( tableLookup( "mp/allChallengesTable.csv", 0, challengeRef, 6 + ((challengeState-1)*2) ) );
  429.  
  430. if( challengeTarget == 0 )
  431. challengeTarget = 1;
  432.  
  433. if( isSubStr( challengeRef, "marathon" ) || isSubStr( challengeRef, "lightweight" ) )
  434. challengeTarget = int( challengeTarget/5280 );
  435.  
  436. actionData = spawnStruct();
  437. actionData.type = "challenge";
  438. actionData.optionalNumber = challengeTarget;
  439. actionData.name = challengeRef;
  440. actionData.sound = tableLookup( "mp/splashTable.csv", 0, actionData.name, 9 );
  441. actionData.slot = 0;
  442.  
  443. self thread actionNotify( actionData );
  444. }
  445.  
  446.  
  447. splashNotify( text, optionalNumber )
  448. {
  449. self endon ( "disconnect" );
  450. // wait until any challenges have been processed
  451. //self waittill( "playerKilledChallengesProcessed" );
  452. wait .05;
  453.  
  454. actionData = spawnStruct();
  455.  
  456. actionData.name = text;
  457. actionData.optionalNumber = optionalNumber;
  458. actionData.sound = tableLookup( "mp/splashTable.csv", 0, actionData.name, 9 );
  459. actionData.slot = 0;
  460.  
  461. self thread actionNotify( actionData );
  462. }
  463.  
  464.  
  465. splashNotifyDelayed( text, optionalNumber )
  466. {
  467. if ( level.hardcoreMode )
  468. return;
  469.  
  470. self endon ( "disconnect" );
  471. waittillframeend;
  472.  
  473. if ( level.gameEnded )
  474. return;
  475.  
  476. actionData = spawnStruct();
  477.  
  478. actionData.name = text;
  479. actionData.optionalNumber = optionalNumber;
  480. actionData.sound = tableLookup( "mp/splashTable.csv", 0, actionData.name, 9 );
  481. actionData.slot = 0;
  482.  
  483. self thread actionNotify( actionData );
  484. }
  485.  
  486.  
  487. playerCardSplashNotify( splashRef, player, optionalNumber )
  488. {
  489. self endon ( "disconnect" );
  490. waittillframeend;
  491.  
  492. if ( level.gameEnded )
  493. return;
  494.  
  495. actionData = spawnStruct();
  496.  
  497. actionData.name = splashRef;
  498. actionData.optionalNumber = optionalNumber;
  499. actionData.sound = tableLookup( "mp/splashTable.csv", 0, actionData.name, 9 );
  500. actionData.playerCardPlayer = player;
  501. actionData.slot = 1;
  502.  
  503. self thread actionNotify( actionData );
  504. }
  505.  
  506.  
  507. actionNotify( actionData )
  508. {
  509. self endon ( "death" );
  510. self endon ( "disconnect" );
  511.  
  512. assert( isDefined( actionData.slot ) );
  513.  
  514. slot = actionData.slot;
  515.  
  516. if ( !isDefined( actionData.type ) )
  517. actionData.type = "";
  518.  
  519. if ( !isDefined( self.doingSplash[ slot ] ) )
  520. {
  521. self thread actionNotifyMessage( actionData );
  522. return;
  523. }
  524. else if ( actionData.type == "killstreak" && self.doingSplash[ slot ].type != "challenge" && self.doingSplash[ slot ].type != "rank" )
  525. {
  526. self.notifyText.alpha = 0;
  527. self.notifyText2.alpha = 0;
  528. self.notifyIcon.alpha = 0;
  529. self thread actionNotifyMessage( actionData );
  530. return;
  531. }
  532. else if ( actionData.type == "challenge" && self.doingSplash[ slot ].type != "killstreak" && self.doingSplash[ slot ].type != "challenge" && self.doingSplash[ slot ].type != "rank" )
  533. {
  534. self.notifyText.alpha = 0;
  535. self.notifyText2.alpha = 0;
  536. self.notifyIcon.alpha = 0;
  537. self thread actionNotifyMessage( actionData );
  538. return;
  539. }
  540.  
  541. // push to front of queue
  542. if ( actionData.type == "challenge" || actionData.type == "killstreak" )
  543. {
  544. if ( actionData.type == "killstreak" )
  545. self removeTypeFromQueue( "killstreak", slot );
  546.  
  547. for ( i = self.splashQueue[ slot ].size; i > 0; i-- )
  548. self.splashQueue[ slot ][ i ] = self.splashQueue[ slot ][ i-1 ];
  549.  
  550. self.splashQueue[ slot ][ 0 ] = actionData;
  551. }
  552. else
  553. {
  554. self.splashQueue[ slot ][ self.splashQueue[ slot ].size ] = actionData;
  555. }
  556. }
  557.  
  558.  
  559. removeTypeFromQueue( actionType, slot )
  560. {
  561. newQueue = [];
  562.  
  563. for ( i = 0; i < self.splashQueue[ slot ].size; i++ )
  564. {
  565. if ( self.splashQueue[ slot ][ i ].type != "killstreak" )
  566. newQueue[ newQueue.size ] = self.splashQueue[ slot ][ i ];
  567. }
  568.  
  569. self.splashQueue[ slot ] = newQueue;
  570. }
  571.  
  572.  
  573. actionNotifyMessage( actionData )
  574. {
  575. self endon ( "disconnect" );
  576.  
  577. assert( isDefined( actionData.slot ) );
  578. slot = actionData.slot;
  579.  
  580. if ( level.gameEnded )
  581. {
  582. // added to prevent potential stack overflow
  583. wait ( 0 );
  584.  
  585. if ( isDefined( actionData.type ) && actionData.type == "rank" )
  586. {
  587. self setClientDvar( "ui_promotion", 1 );
  588. self.postGamePromotion = true;
  589. }
  590. else if ( isDefined( actionData.type ) && actionData.type == "challenge" )
  591. {
  592. self.pers["postGameChallenges"]++;
  593. self setClientDvar( "ui_challenge_"+ self.pers["postGameChallenges"] +"_ref", actionData.name );
  594. }
  595.  
  596. if ( self.splashQueue[ slot ].size )
  597. self thread dispatchNotify( slot );
  598.  
  599. return;
  600. }
  601.  
  602. assertEx( tableLookup( "mp/splashTable.csv", 0, actionData.name, 0 ) != "", "ERROR: unknown splash - " + actionData.name );
  603.  
  604. // defensive ship hack for missing table entries
  605. if ( tableLookup( "mp/splashTable.csv", 0, actionData.name, 0 ) != "" )
  606. {
  607. if ( isDefined( actionData.playerCardPlayer ) )
  608. self SetCardDisplaySlot( actionData.playerCardPlayer, 5 );
  609.  
  610. if ( isDefined( actionData.optionalNumber ) )
  611. self ShowHudSplash( actionData.name, actionData.slot, actionData.optionalNumber );
  612. else
  613. self ShowHudSplash( actionData.name, actionData.slot );
  614.  
  615. self.doingSplash[ slot ] = actionData;
  616.  
  617. duration = stringToFloat( tableLookup( "mp/splashTable.csv", 0, actionData.name, 4 ) );
  618.  
  619. if ( isDefined( actionData.sound ) )
  620. self playLocalSound( actionData.sound );
  621.  
  622. if ( isDefined( actionData.leaderSound ) )
  623. {
  624. if ( isDefined( actionData.leaderSoundGroup ) )
  625. self leaderDialogOnPlayer( actionData.leaderSound, actionData.leaderSoundGroup, true );
  626. else
  627. self leaderDialogOnPlayer( actionData.leaderSound );
  628. }
  629.  
  630. self notify ( "actionNotifyMessage" + slot );
  631. self endon ( "actionNotifyMessage" + slot );
  632.  
  633. wait ( duration - 0.05 );
  634.  
  635. self.doingSplash[ slot ] = undefined;
  636. }
  637.  
  638. if ( self.splashQueue[ slot ].size )
  639. self thread dispatchNotify( slot );
  640. }
  641.  
  642.  
  643. // waits for waitTime, plus any time required to let flashbangs go away.
  644. waitRequireVisibility( waitTime )
  645. {
  646. interval = .05;
  647.  
  648. while ( !self canReadText() )
  649. wait interval;
  650.  
  651. while ( waitTime > 0 )
  652. {
  653. wait interval;
  654. if ( self canReadText() )
  655. waitTime -= interval;
  656. }
  657. }
  658.  
  659.  
  660. canReadText()
  661. {
  662. if ( self maps\mp\_flashgrenades::isFlashbanged() )
  663. return false;
  664.  
  665. return true;
  666. }
  667.  
  668.  
  669. resetOnDeath()
  670. {
  671. self endon ( "notifyMessageDone" );
  672. self endon ( "disconnect" );
  673. level endon ( "game_ended" );
  674. self waittill ( "death" );
  675.  
  676. resetNotify();
  677. }
  678.  
  679.  
  680. resetOnCancel()
  681. {
  682. self notify ( "resetOnCancel" );
  683. self endon ( "resetOnCancel" );
  684. self endon ( "notifyMessageDone" );
  685. self endon ( "disconnect" );
  686.  
  687. level waittill ( "cancel_notify" );
  688.  
  689. resetNotify();
  690. }
  691.  
  692.  
  693. resetNotify()
  694. {
  695. self.notifyTitle.alpha = 0;
  696. self.notifyText.alpha = 0;
  697. self.notifyIcon.alpha = 0;
  698. self.notifyOverlay.alpha = 0;
  699.  
  700. self.doingSplash[0] = undefined;
  701. self.doingSplash[1] = undefined;
  702. self.doingSplash[2] = undefined;
  703. self.doingSplash[3] = undefined;
  704. }
  705.  
  706.  
  707. hintMessageDeathThink()
  708. {
  709. self endon ( "disconnect" );
  710.  
  711. for ( ;; )
  712. {
  713. self waittill ( "death" );
  714.  
  715. if ( isDefined( self.hintMessage ) )
  716. self.hintMessage destroyElem();
  717. }
  718. }
  719.  
  720. lowerMessageThink()
  721. {
  722. self endon ( "disconnect" );
  723.  
  724. self.lowerMessages = [];
  725.  
  726. self.lowerMessage = createFontString( "default", level.lowerTextFontSize );
  727. self.lowerMessage setPoint( "CENTER", level.lowerTextYAlign, 0, level.lowerTextY );
  728. self.lowerMessage setText( "" );
  729. self.lowerMessage.archived = false;
  730. self.lowerMessage.sort = 10;
  731.  
  732. timerFontSize = 0.75;
  733. if ( level.splitscreen )
  734. timerFontSize = 0.5;
  735.  
  736. self.lowerTimer = createFontString( "hudbig", timerFontSize );
  737. self.lowerTimer setParent( self.lowerMessage );
  738. self.lowerTimer setPoint( "TOP", "BOTTOM", 0, 0 );
  739. self.lowerTimer setText( "" );
  740. self.lowerTimer.archived = false;
  741. self.lowerTimer.sort = 10;
  742. }
  743.  
  744.  
  745. outcomeOverlay( winner )
  746. {
  747. if ( level.teamBased )
  748. {
  749. if ( winner == "tie" )
  750. self matchOutcomeNotify( "draw" );
  751. else if ( winner == self.team )
  752. self matchOutcomeNotify( "victory" );
  753. else
  754. self matchOutcomeNotify( "defeat" );
  755. }
  756. else
  757. {
  758. if ( winner == self )
  759. self matchOutcomeNotify( "victory" );
  760. else
  761. self matchOutcomeNotify( "defeat" );
  762. }
  763. }
  764.  
  765.  
  766. matchOutcomeNotify( outcome )
  767. {
  768. team = self.team;
  769.  
  770. outcomeTitle = createFontString( "bigfixed", 1.0 );
  771. outcomeTitle setPoint( "TOP", undefined, 0, 50 );
  772. outcomeTitle.foreground = true;
  773. outcomeTitle.glowAlpha = 1;
  774. outcomeTitle.hideWhenInMenu = false;
  775. outcomeTitle.archived = false;
  776.  
  777. outcomeTitle setText( game["strings"][outcome] );
  778. outcomeTitle.alpha = 0;
  779. outcomeTitle fadeOverTime( 0.5 );
  780. outcomeTitle.alpha = 1;
  781.  
  782. switch( outcome )
  783. {
  784. case "victory":
  785. outcomeTitle.glowColor = (0.6, 0.9, 0.6);
  786. break;
  787. default:
  788. outcomeTitle.glowColor = (0.9, 0.6, 0.6);
  789. break;
  790. }
  791.  
  792. centerIcon = createIcon( game["icons"][team], 64, 64 );
  793. centerIcon setParent( outcomeTitle );
  794. centerIcon setPoint( "TOP", "BOTTOM", 0, 30 );
  795. centerIcon.foreground = true;
  796. centerIcon.hideWhenInMenu = false;
  797. centerIcon.archived = false;
  798. centerIcon.alpha = 0;
  799. centerIcon fadeOverTime( 0.5 );
  800. centerIcon.alpha = 1;
  801.  
  802. wait ( 3.0 );
  803.  
  804. outcomeTitle destroyElem();
  805. centerIcon destroyElem();
  806. }
  807.  
  808.  
  809. isDoingSplash()
  810. {
  811. if ( isDefined( self.doingSplash[0] ) )
  812. return true;
  813.  
  814. if ( isDefined( self.doingSplash[1] ) )
  815. return true;
  816.  
  817. if ( isDefined( self.doingSplash[2] ) )
  818. return true;
  819.  
  820. if ( isDefined( self.doingSplash[3] ) )
  821. return true;
  822.  
  823. return false;
  824. }
  825.  
  826.  
  827. teamOutcomeNotify( winner, isRound, endReasonText )
  828. {
  829. self endon ( "disconnect" );
  830. self notify ( "reset_outcome" );
  831.  
  832. wait ( 0.5 );
  833.  
  834. team = self.pers["team"];
  835. if ( !isDefined( team ) || (team != "allies" && team != "axis") )
  836. team = "allies";
  837.  
  838. // wait for notifies to finish
  839. while ( self isDoingSplash() )
  840. wait 0.05;
  841.  
  842. self endon ( "reset_outcome" );
  843.  
  844. if ( level.splitscreen )
  845. {
  846. // These are mostly fullscreen values divided by 1.5
  847. titleSize = 1;
  848. titleOffset = -76;
  849. textSize = 0.667;
  850. textOffset = 12;
  851. numberSize = 0.833;
  852. iconSize = 46;
  853. iconSpacingH = 40;
  854. iconSpacing = 30;
  855. scoreSpacing = 0;
  856. bonusSpacing = 60;
  857. font = "hudbig";
  858. }
  859. else
  860. {
  861. titleSize = 1.5;
  862. titleOffset = -134;
  863. textSize = 1.0;
  864. textOffset = 18;
  865. numberSize = 1.25;
  866. iconSize = 70;
  867. iconSpacingH = 60;
  868. iconSpacing = 45;
  869. scoreSpacing = 0;
  870. bonusSpacing = 90;
  871. font = "hudbig";
  872. }
  873.  
  874. duration = 60000;
  875.  
  876. outcomeTitle = createFontString( font, titleSize );
  877. outcomeTitle setPoint( "CENTER", undefined, 0, titleOffset );
  878. outcomeTitle.foreground = true;
  879. outcomeTitle.glowAlpha = 1;
  880. outcomeTitle.hideWhenInMenu = false;
  881. outcomeTitle.archived = false;
  882.  
  883. outcomeText = createFontString( font, textSize );
  884. outcomeText setParent( outcomeTitle );
  885. outcomeText.foreground = true;
  886. outcomeText setPoint( "TOP", "BOTTOM", 0, textOffset );
  887. outcomeText.glowAlpha = 1;
  888. outcomeText.hideWhenInMenu = false;
  889. outcomeText.archived = false;
  890.  
  891. if ( winner == "halftime" )
  892. {
  893. outcomeTitle.glowColor = (0.2, 0.3, 0.7);
  894. outcomeTitle setText( game["strings"]["halftime"] );
  895. outcomeTitle.color = (1, 1, 1);
  896.  
  897. winner = "allies";
  898. }
  899. else if ( winner == "intermission" )
  900. {
  901. outcomeTitle.glowColor = (0.2, 0.3, 0.7);
  902. outcomeTitle setText( game["strings"]["intermission"] );
  903. outcomeTitle.color = (1, 1, 1);
  904.  
  905. winner = "allies";
  906. }
  907. else if ( winner == "roundend" )
  908. {
  909. outcomeTitle.glowColor = (0.2, 0.3, 0.7);
  910. outcomeTitle setText( game["strings"]["roundend"] );
  911. outcomeTitle.color = (1, 1, 1);
  912.  
  913. winner = "allies";
  914. }
  915. else if ( winner == "overtime" )
  916. {
  917. outcomeTitle.glowColor = (0.2, 0.3, 0.7);
  918. outcomeTitle setText( game["strings"]["overtime"] );
  919. outcomeTitle.color = (1, 1, 1);
  920.  
  921. winner = "allies";
  922. }
  923. else if ( winner == "tie" )
  924. {
  925. outcomeTitle.glowColor = (0.2, 0.3, 0.7);
  926. if ( isRound )
  927. outcomeTitle setText( game["strings"]["round_draw"] );
  928. else
  929. outcomeTitle setText( game["strings"]["draw"] );
  930. outcomeTitle.color = (1, 1, 1);
  931.  
  932. winner = "allies";
  933. }
  934. else if ( isDefined( self.pers["team"] ) && winner == team )
  935. {
  936. outcomeTitle.glowColor = (0, 0, 0);
  937. if ( isRound )
  938. outcomeTitle setText( game["strings"]["round_win"] );
  939. else
  940. outcomeTitle setText( game["strings"]["victory"] );
  941. outcomeTitle.color = (0.6, 0.9, 0.6);
  942. }
  943. else
  944. {
  945. outcomeTitle.glowColor = (0, 0, 0);
  946. if ( isRound )
  947. outcomeTitle setText( game["strings"]["round_loss"] );
  948. else
  949. outcomeTitle setText( game["strings"]["defeat"] );
  950. outcomeTitle.color = (0.7, 0.3, 0.2);
  951. }
  952.  
  953. outcomeText.glowColor = (0.2, 0.3, 0.7);
  954. outcomeText setText( endReasonText );
  955.  
  956. outcomeTitle setPulseFX( 100, duration, 1000 );
  957. outcomeText setPulseFX( 100, duration, 1000 );
  958.  
  959. if ( getIntProperty( "useRelativeTeamColors", 0 ) )
  960. leftIcon = createIcon( game["icons"][team] + "_blue", iconSize, iconSize );
  961. else
  962. leftIcon = createIcon( game["icons"][team], iconSize, iconSize );
  963. leftIcon setParent( outcomeText );
  964. leftIcon setPoint( "TOP", "BOTTOM", (iconSpacingH*-1), iconSpacing );
  965. leftIcon.foreground = true;
  966. leftIcon.hideWhenInMenu = false;
  967. leftIcon.archived = false;
  968. leftIcon.alpha = 0;
  969. leftIcon fadeOverTime( 0.5 );
  970. leftIcon.alpha = 1;
  971.  
  972. if ( getIntProperty( "useRelativeTeamColors", 0 ) )
  973. rightIcon = createIcon( game["icons"][level.otherTeam[team]] + "_red", iconSize, iconSize );
  974. else
  975. rightIcon = createIcon( game["icons"][level.otherTeam[team]], iconSize, iconSize );
  976. rightIcon setParent( outcomeText );
  977. rightIcon setPoint( "TOP", "BOTTOM", iconSpacingH, iconSpacing );
  978. rightIcon.foreground = true;
  979. rightIcon.hideWhenInMenu = false;
  980. rightIcon.archived = false;
  981. rightIcon.alpha = 0;
  982. rightIcon fadeOverTime( 0.5 );
  983. rightIcon.alpha = 1;
  984.  
  985. leftScore = createFontString( font, numberSize );
  986. leftScore setParent( leftIcon );
  987. leftScore setPoint( "TOP", "BOTTOM", 0, scoreSpacing );
  988. if ( getIntProperty( "useRelativeTeamColors", 0 ) )
  989. leftScore.glowColor = game["colors"]["blue"];
  990. else
  991. leftScore.glowColor = game["colors"][team];
  992. leftScore.glowAlpha = 1;
  993. if ( !isRoundBased() || !isObjectiveBased() )
  994. leftScore setValue( maps\mp\gametypes\_gamescore::_getTeamScore( team ) );
  995. else
  996. leftScore setValue( game["roundsWon"][team] );
  997. leftScore.foreground = true;
  998. leftScore.hideWhenInMenu = false;
  999. leftScore.archived = false;
  1000. leftScore setPulseFX( 100, duration, 1000 );
  1001.  
  1002. rightScore = createFontString( font, numberSize );
  1003. rightScore setParent( rightIcon );
  1004. rightScore setPoint( "TOP", "BOTTOM", 0, scoreSpacing );
  1005. if ( getIntProperty( "useRelativeTeamColors", 0 ) )
  1006. rightScore.glowColor = game["colors"]["red"];
  1007. else
  1008. rightScore.glowColor = game["colors"][level.otherTeam[team]];
  1009. rightScore.glowAlpha = 1;
  1010. if ( !isRoundBased() || !isObjectiveBased() )
  1011. rightScore setValue( maps\mp\gametypes\_gamescore::_getTeamScore( level.otherTeam[team] ) );
  1012. else
  1013. rightScore setValue( game["roundsWon"][level.otherTeam[team]] );
  1014. rightScore.foreground = true;
  1015. rightScore.hideWhenInMenu = false;
  1016. rightScore.archived = false;
  1017. rightScore setPulseFX( 100, duration, 1000 );
  1018.  
  1019. matchBonus = undefined;
  1020. if ( isDefined( self.matchBonus ) )
  1021. {
  1022. matchBonus = createFontString( font, textSize );
  1023. matchBonus setParent( outcomeText );
  1024. matchBonus setPoint( "TOP", "BOTTOM", 0, iconSize + bonusSpacing + leftScore.height );
  1025. matchBonus.glowAlpha = 1;
  1026. matchBonus.foreground = true;
  1027. matchBonus.hideWhenInMenu = false;
  1028. matchBonus.color = (1,1,0.5);
  1029. matchBonus.archived = false;
  1030. matchBonus.label = game["strings"]["match_bonus"];
  1031. matchBonus setValue( self.matchBonus );
  1032. }
  1033.  
  1034. self thread resetTeamOutcomeNotify( outcomeTitle, outcomeText, leftIcon, rightIcon, leftScore, rightScore, matchBonus );
  1035. }
  1036.  
  1037.  
  1038. outcomeNotify( winner, endReasonText )
  1039. {
  1040. self endon ( "disconnect" );
  1041. self notify ( "reset_outcome" );
  1042.  
  1043. // wait for notifies to finish
  1044. while ( self isDoingSplash() )
  1045. wait 0.05;
  1046.  
  1047. self endon ( "reset_outcome" );
  1048.  
  1049. if ( level.splitscreen )
  1050. {
  1051. titleSize = 2.0;
  1052. winnerSize = 1.5;
  1053. otherSize = 1.5;
  1054. iconSize = 30;
  1055. spacing = 2;
  1056. font = "default";
  1057. }
  1058. else
  1059. {
  1060. titleSize = 3.0;
  1061. winnerSize = 2.0;
  1062. otherSize = 1.5;
  1063. iconSize = 30;
  1064. spacing = 20;
  1065. font = "objective";
  1066. }
  1067.  
  1068. duration = 60000;
  1069.  
  1070. players = level.placement["all"];
  1071.  
  1072. outcomeTitle = createFontString( font, titleSize );
  1073. outcomeTitle setPoint( "TOP", undefined, 0, spacing );
  1074. if ( isDefined( players[1] ) && players[0].score == players[1].score && players[0].deaths == players[1].deaths && (self == players[0] || self == players[1]) )
  1075. {
  1076. outcomeTitle setText( game["strings"]["tie"] );
  1077. outcomeTitle.glowColor = (0.2, 0.3, 0.7);
  1078. }
  1079. else if ( isDefined( players[2] ) && players[0].score == players[2].score && players[0].deaths == players[2].deaths && self == players[2] )
  1080. {
  1081. outcomeTitle setText( game["strings"]["tie"] );
  1082. outcomeTitle.glowColor = (0.2, 0.3, 0.7);
  1083. }
  1084. else if ( isDefined( players[0] ) && self == players[0] )
  1085. {
  1086. outcomeTitle setText( game["strings"]["victory"] );
  1087. outcomeTitle.glowColor = (0.2, 0.3, 0.7);
  1088. }
  1089. else
  1090. {
  1091. outcomeTitle setText( game["strings"]["defeat"] );
  1092. outcomeTitle.glowColor = (0.7, 0.3, 0.2);
  1093. }
  1094. outcomeTitle.glowAlpha = 1;
  1095. outcomeTitle.foreground = true;
  1096. outcomeTitle.hideWhenInMenu = false;
  1097. outcomeTitle.archived = false;
  1098. outcomeTitle setPulseFX( 100, duration, 1000 );
  1099.  
  1100. outcomeText = createFontString( font, 2.0 );
  1101. outcomeText setParent( outcomeTitle );
  1102. outcomeText setPoint( "TOP", "BOTTOM", 0, 0 );
  1103. outcomeText.glowAlpha = 1;
  1104. outcomeText.foreground = true;
  1105. outcomeText.hideWhenInMenu = false;
  1106. outcomeText.archived = false;
  1107. outcomeText.glowColor = (0.2, 0.3, 0.7);
  1108. outcomeText setText( endReasonText );
  1109.  
  1110. firstTitle = createFontString( font, winnerSize );
  1111. firstTitle setParent( outcomeText );
  1112. firstTitle setPoint( "TOP", "BOTTOM", 0, spacing );
  1113. firstTitle.glowColor = (0.3, 0.7, 0.2);
  1114. firstTitle.glowAlpha = 1;
  1115. firstTitle.foreground = true;
  1116. firstTitle.hideWhenInMenu = false;
  1117. firstTitle.archived = false;
  1118. if ( isDefined( players[0] ) )
  1119. {
  1120. firstTitle.label = &"MP_FIRSTPLACE_NAME";
  1121. firstTitle setPlayerNameString( players[0] );
  1122. firstTitle setPulseFX( 100, duration, 1000 );
  1123. }
  1124.  
  1125. secondTitle = createFontString( font, otherSize );
  1126. secondTitle setParent( firstTitle );
  1127. secondTitle setPoint( "TOP", "BOTTOM", 0, spacing );
  1128. secondTitle.glowColor = (0.2, 0.3, 0.7);
  1129. secondTitle.glowAlpha = 1;
  1130. secondTitle.foreground = true;
  1131. secondTitle.hideWhenInMenu = false;
  1132. secondTitle.archived = false;
  1133. if ( isDefined( players[1] ) )
  1134. {
  1135. secondTitle.label = &"MP_SECONDPLACE_NAME";
  1136. secondTitle setPlayerNameString( players[1] );
  1137. secondTitle setPulseFX( 100, duration, 1000 );
  1138. }
  1139.  
  1140. thirdTitle = createFontString( font, otherSize );
  1141. thirdTitle setParent( secondTitle );
  1142. thirdTitle setPoint( "TOP", "BOTTOM", 0, spacing );
  1143. thirdTitle setParent( secondTitle );
  1144. thirdTitle.glowColor = (0.2, 0.3, 0.7);
  1145. thirdTitle.glowAlpha = 1;
  1146. thirdTitle.foreground = true;
  1147. thirdTitle.hideWhenInMenu = false;
  1148. thirdTitle.archived = false;
  1149. if ( isDefined( players[2] ) )
  1150. {
  1151. thirdTitle.label = &"MP_THIRDPLACE_NAME";
  1152. thirdTitle setPlayerNameString( players[2] );
  1153. thirdTitle setPulseFX( 100, duration, 1000 );
  1154. }
  1155.  
  1156. matchBonus = createFontString( font, 2.0 );
  1157. matchBonus setParent( thirdTitle );
  1158. matchBonus setPoint( "TOP", "BOTTOM", 0, spacing );
  1159. matchBonus.glowAlpha = 1;
  1160. matchBonus.foreground = true;
  1161. matchBonus.hideWhenInMenu = false;
  1162. matchBonus.archived = false;
  1163. if ( isDefined( self.matchBonus ) )
  1164. {
  1165. matchBonus.label = game["strings"]["match_bonus"];
  1166. matchBonus setValue( self.matchBonus );
  1167. }
  1168.  
  1169. self thread updateOutcome( firstTitle, secondTitle, thirdTitle );
  1170. self thread resetOutcomeNotify( outcomeTitle, outcomeText, firstTitle, secondTitle, thirdTitle, matchBonus );
  1171. }
  1172.  
  1173.  
  1174. resetOutcomeNotify( outcomeTitle, outcomeText, firstTitle, secondTitle, thirdTitle, matchBonus )
  1175. {
  1176. self endon ( "disconnect" );
  1177. self waittill ( "reset_outcome" );
  1178.  
  1179. if ( isDefined( outcomeTitle ) )
  1180. outcomeTitle destroyElem();
  1181. if ( isDefined( outcomeText ) )
  1182. outcomeText destroyElem();
  1183. if ( isDefined( firstTitle ) )
  1184. firstTitle destroyElem();
  1185. if ( isDefined( secondTitle ) )
  1186. secondTitle destroyElem();
  1187. if ( isDefined( thirdTitle ) )
  1188. thirdTitle destroyElem();
  1189. if ( isDefined( matchBonus ) )
  1190. matchBonus destroyElem();
  1191. }
  1192.  
  1193. resetTeamOutcomeNotify( outcomeTitle, outcomeText, leftIcon, rightIcon, LeftScore, rightScore, matchBonus )
  1194. {
  1195. self endon ( "disconnect" );
  1196. self waittill ( "reset_outcome" );
  1197.  
  1198. if ( isDefined( outcomeTitle ) )
  1199. outcomeTitle destroyElem();
  1200. if ( isDefined( outcomeText ) )
  1201. outcomeText destroyElem();
  1202. if ( isDefined( leftIcon ) )
  1203. leftIcon destroyElem();
  1204. if ( isDefined( rightIcon ) )
  1205. rightIcon destroyElem();
  1206. if ( isDefined( leftScore ) )
  1207. leftScore destroyElem();
  1208. if ( isDefined( rightScore ) )
  1209. rightScore destroyElem();
  1210. if ( isDefined( matchBonus ) )
  1211. matchBonus destroyElem();
  1212. }
  1213.  
  1214.  
  1215. updateOutcome( firstTitle, secondTitle, thirdTitle )
  1216. {
  1217. self endon( "disconnect" );
  1218. self endon( "reset_outcome" );
  1219.  
  1220. while( true )
  1221. {
  1222. self waittill( "update_outcome" );
  1223.  
  1224. players = level.placement["all"];
  1225.  
  1226. if ( isDefined( firstTitle ) && isDefined( players[0] ) )
  1227. firstTitle setPlayerNameString( players[0] );
  1228. else if ( isDefined( firstTitle ) )
  1229. firstTitle.alpha = 0;
  1230.  
  1231. if ( isDefined( secondTitle ) && isDefined( players[1] ) )
  1232. secondTitle setPlayerNameString( players[1] );
  1233. else if ( isDefined( secondTitle ) )
  1234. secondTitle.alpha = 0;
  1235.  
  1236. if ( isDefined( thirdTitle ) && isDefined( players[2] ) )
  1237. thirdTitle setPlayerNameString( players[2] );
  1238. else if ( isDefined( thirdTitle ) )
  1239. thirdTitle.alpha = 0;
  1240. }
  1241. }
  1242.  
  1243. canShowSplash( type )
  1244. {
  1245.  
  1246. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement