Advertisement
Guest User

_hud_message - Notesblok

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