Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2017
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class SRHUDKillingFloor extends HUD_StoryMode
  2.     dependson(SRPlayerReplicationInfo);
  3.  
  4.  
  5. #exec obj load file="KFMapEndTextures.utx"
  6. #exec obj load file="2K4Menus.utx"
  7.  
  8. #exec TEXTURE IMPORT FILE="Textures\11_FROWN.pcx" NAME="I_Frown" GROUP="Emo" MIPS=0 MASKED=1
  9. #exec TEXTURE IMPORT FILE="Textures\12_INDIFFE.pcx" NAME="I_Indiffe" GROUP="Emo" MIPS=0 MASKED=1
  10. #exec TEXTURE IMPORT FILE="Textures\13_OHWELL.pcx" NAME="I_Ohwell" GROUP="Emo" MIPS=0 MASKED=1
  11. #exec TEXTURE IMPORT FILE="Textures\16_BIGGRIN.pcx" NAME="I_BigGrin" GROUP="Emo" MIPS=0 MASKED=1
  12. #exec TEXTURE IMPORT FILE="Textures\17_TONGUE1.pcx" NAME="I_Tongue" GROUP="Emo" MIPS=0 MASKED=1
  13. #exec TEXTURE IMPORT FILE="Textures\17_TONGUE2.pcx" NAME="I_TongueB" GROUP="Emo" MIPS=0 MASKED=1
  14. #exec TEXTURE IMPORT FILE="Textures\18_REDFACE.pcx" NAME="I_RedFace" GROUP="Emo" MIPS=0 MASKED=1
  15. #exec TEXTURE IMPORT FILE="Textures\19_GREENLI1.pcx" NAME="I_GreenLick" GROUP="Emo" MIPS=0 MASKED=1
  16. #exec TEXTURE IMPORT FILE="Textures\19_GREENLI2.pcx" NAME="I_GreenLickB" GROUP="Emo" MIPS=0 MASKED=1
  17. #exec TEXTURE IMPORT FILE="Textures\Ban.pcx" NAME="I_Ban" GROUP="Emo" MIPS=0 MASKED=1
  18. #exec TEXTURE IMPORT FILE="Textures\COOL.pcx" NAME="I_Cool" GROUP="Emo" MIPS=0 MASKED=1
  19. #exec TEXTURE IMPORT FILE="Textures\HM.pcx" NAME="I_Hmm" GROUP="Emo" MIPS=0 MASKED=1
  20. #exec TEXTURE IMPORT FILE="Textures\MAD.pcx" NAME="I_Mad" GROUP="Emo" MIPS=0 MASKED=1
  21. #exec TEXTURE IMPORT FILE="Textures\SCREAM6.pcx" NAME="I_Scream" GROUP="Emo" MIPS=0 MASKED=1
  22. #exec TEXTURE IMPORT FILE="Textures\SPAM.pcx" NAME="I_Spam" GROUP="Emo" MIPS=0 MASKED=1
  23.  
  24. //NEW
  25. var Texture Noob_Crosshair;
  26.  
  27. struct DamageInfo
  28. {
  29.     var int Damage;
  30.     var float HitTime;
  31.     var Vector HitLocation;
  32.     var byte DamTypeNum;
  33.     var float RandX, RandY;
  34.     var color FontColor;
  35. };
  36.  
  37. const DAMAGEPOPUP_COUNT = 32;
  38. var DamageInfo DamagePopups[32];
  39. var int NextDamagePopupIndex;
  40. var() config byte DamagePopupFont;
  41. var() config float DamagePopupFadeOutTime;
  42.  
  43. struct SmileyMessageType
  44. {
  45.     var string SmileyTag;
  46.     var texture SmileyTex;
  47.     var bool bInCAPS;
  48. };
  49. var array<SmileyMessageType> SmileyMsgs;
  50.  
  51. var ClientPerkRepLink ClientRep;
  52. var transient float OldDilation,CurrentBW,DesiredBW,NextLevelTimer,LevelProgressBar,VisualProgressBar;
  53. var bool bUseBloom,bUseMotionBlur,bDisplayingProgress;
  54. var transient bool bFadeBW;
  55. var() Material CrosshairTexture;
  56.  
  57. simulated function PostBeginPlay()
  58. {
  59.     local Font MyFont;
  60.  
  61.     Super(HudBase).PostBeginPlay();
  62.     SetHUDAlpha();
  63.  
  64.     foreach DynamicActors(class'KFSPLevelInfo', KFLevelRule)
  65.         Break;
  66.  
  67.     Hint_45_Time = 9999999;
  68.  
  69.     MyFont = LoadWaitingFont(0);
  70.     MyFont = LoadWaitingFont(1);
  71.  
  72.     bUseBloom = bool(ConsoleCommand("get ini:Engine.Engine.ViewportManager Bloom"));
  73.     bUseMotionBlur = Class'KFHumanPawn'.Default.bUseBlurEffect;
  74.    
  75.     CacheDialogueActors();
  76.     CacheObjectives();
  77. }
  78.  
  79. simulated function DrawStoryHUDInfo(Canvas C)
  80. {
  81.     if( KF_StoryGRI(Level.GRI)!=None ) // Only do this if objective mode is enabled.
  82.         Super.DrawStoryHUDInfo(C);
  83. }
  84.  
  85. simulated function DrawKFHUDTextElements(Canvas Canvas)
  86. {
  87.     if( KF_StoryGRI(Level.GRI)==None )
  88.     {
  89.         Super(HudKillingFloor).DrawKFHUDTextElements(Canvas);
  90.         //DrawPlayerTime(Canvas);  
  91.     }
  92. }
  93.  
  94. //Player time under the trader arrow, not so good aparently, Toblerone: 04/12/2016
  95. /*
  96. final simulated function DrawPlayerTime(Canvas Canvas)
  97. {
  98.     local int FontSize;
  99.     local float StrWidth, StrHeight;
  100.     local string PlayerTimeText;
  101.  
  102.  
  103.     PlayerTimeText = SRPlayerReplicationInfo(PawnOwner.PlayerReplicationInfo).PlayerLocalTime;
  104.  
  105.  
  106.     if ( Canvas.ClipX <= 640 )
  107.         FontSize = 7;
  108.     else if ( Canvas.ClipX <= 800 )
  109.         FontSize = 6;
  110.     else if ( Canvas.ClipX <= 1024 )
  111.         FontSize = 5;
  112.     else if ( Canvas.ClipX <= 1280 )
  113.         FontSize = 4;
  114.     else
  115.         FontSize = 3;
  116.  
  117.  
  118.     Canvas.Font = LoadFont(FontSize);
  119.     Canvas.SetDrawColor(255, 50, 50, 255);
  120.     Canvas.StrLen(PlayerTimeText, StrWidth, StrHeight);
  121.     Canvas.SetPos((Canvas.SizeX / 14.0) - (StrWidth / 2.0), Canvas.SizeX / 10.0 + StrHeight);
  122.     Canvas.DrawText(PlayerTimeText);
  123. }
  124. */
  125.  
  126. simulated function UpdateHud()
  127. {
  128.     local float MaxGren, CurGren;
  129.     local KFHumanPawn KFHPawn;
  130.     local Syringe S;
  131.  
  132.     if( PawnOwner == none )
  133.     {
  134.         super.UpdateHud();
  135.         return;
  136.     }
  137.  
  138.     KFHPawn = KFHumanPawn(PawnOwner);
  139.  
  140.     CalculateAmmo();
  141.  
  142.     if ( KFHPawn != none )
  143.     {
  144.         FlashlightDigits.Value = 100 * (float(KFHPawn.TorchBatteryLife) / float(KFHPawn.default.TorchBatteryLife));
  145.     }
  146.  
  147.     if ( KFWeapon(PawnOwner.Weapon) != none )
  148.     {
  149.         BulletsInClipDigits.Value = KFWeapon(PawnOwner.Weapon).MagAmmoRemaining;
  150.  
  151.         if ( BulletsInClipDigits.Value < 0 )
  152.         {
  153.             BulletsInClipDigits.Value = 0;
  154.         }
  155.     }
  156.  
  157.     ClipsDigits.Value = CurClipsPrimary;
  158.     SecondaryClipsDigits.Value = CurClipsSecondary;
  159.  
  160.     if ( LAW(PawnOwner.Weapon) != none || Crossbow(PawnOwner.Weapon) != none
  161.         || M79GrenadeLauncher(PawnOwner.Weapon) != none || PipeBombExplosive(PawnOwner.Weapon) != none
  162.         || HuskGun(PawnOwner.Weapon) != none  )
  163.     {
  164.         ClipsDigits.Value += KFWeapon(PawnOwner.Weapon).MagAmmoRemaining;
  165.     }
  166.  
  167.     if ( PlayerGrenade == none )
  168.     {
  169.         FindPlayerGrenade();
  170.     }
  171.  
  172.     if ( PlayerGrenade != none )
  173.     {
  174.         PlayerGrenade.GetAmmoCount(MaxGren, CurGren);
  175.         GrenadeDigits.Value = CurGren;
  176.     }
  177.     else
  178.     {
  179.         GrenadeDigits.Value = 0;
  180.     }
  181.  
  182.     if( Vehicle(PawnOwner)!=None )
  183.     {
  184.         if( Vehicle(PawnOwner).Driver!=None )
  185.             HealthDigits.Value = Vehicle(PawnOwner).Driver.Health;
  186.         ArmorDigits.Value = PawnOwner.Health;
  187.     }
  188.     else
  189.     {
  190.         HealthDigits.Value = PawnOwner.Health;
  191.         if( KFHPawn!=None )
  192.             ArmorDigits.Value = KFHPawn.ShieldStrength;
  193.     }
  194.  
  195.     // "Poison" the health meter
  196.     if ( VomitHudTimer > Level.TimeSeconds )
  197.     {
  198.         HealthDigits.Tints[0].R = 196;
  199.         HealthDigits.Tints[0].G = 206;
  200.         HealthDigits.Tints[0].B = 0;
  201.  
  202.         HealthDigits.Tints[1].R = 196;
  203.         HealthDigits.Tints[1].G = 206;
  204.         HealthDigits.Tints[1].B = 0;
  205.     }
  206.     else if ( PawnOwner.Health < 50 )
  207.     {
  208.         if ( Level.TimeSeconds < SwitchDigitColorTime )
  209.         {
  210.             HealthDigits.Tints[0].R = 255;
  211.             HealthDigits.Tints[0].G = 200;
  212.             HealthDigits.Tints[0].B = 0;
  213.  
  214.             HealthDigits.Tints[1].R = 255;
  215.             HealthDigits.Tints[1].G = 200;
  216.             HealthDigits.Tints[1].B = 0;
  217.         }
  218.         else
  219.         {
  220.             HealthDigits.Tints[0].R = 255;
  221.             HealthDigits.Tints[0].G = 0;
  222.             HealthDigits.Tints[0].B = 0;
  223.  
  224.             HealthDigits.Tints[1].R = 255;
  225.             HealthDigits.Tints[1].G = 0;
  226.             HealthDigits.Tints[1].B = 0;
  227.  
  228.             if ( Level.TimeSeconds > SwitchDigitColorTime + 0.2 )
  229.             {
  230.                 SwitchDigitColorTime = Level.TimeSeconds + 0.2;
  231.             }
  232.         }
  233.     }
  234.     else
  235.     {
  236.         HealthDigits.Tints[0].R = 255;
  237.         HealthDigits.Tints[0].G = 50;
  238.         HealthDigits.Tints[0].B = 50;
  239.  
  240.         HealthDigits.Tints[1].R = 255;
  241.         HealthDigits.Tints[1].G = 50;
  242.         HealthDigits.Tints[1].B = 50;
  243.     }
  244.  
  245.  
  246.  
  247.     CashDigits.Value = PawnOwnerPRI.Score;
  248.  
  249.     WelderDigits.Value = 100 * (CurAmmoPrimary / MaxAmmoPrimary);
  250.     SyringeDigits.Value = WelderDigits.Value;
  251.  
  252.     if ( SyringeDigits.Value < 50 )
  253.     {
  254.         SyringeDigits.Tints[0].R = 128;
  255.         SyringeDigits.Tints[0].G = 128;
  256.         SyringeDigits.Tints[0].B = 128;
  257.  
  258.         SyringeDigits.Tints[1] = SyringeDigits.Tints[0];
  259.     }
  260.     else if ( SyringeDigits.Value < 100 )
  261.     {
  262.         SyringeDigits.Tints[0].R = 192;
  263.         SyringeDigits.Tints[0].G = 96;
  264.         SyringeDigits.Tints[0].B = 96;
  265.  
  266.         SyringeDigits.Tints[1] = SyringeDigits.Tints[0];
  267.     }
  268.     else
  269.     {
  270.         SyringeDigits.Tints[0].R = 255;
  271.         SyringeDigits.Tints[0].G = 64;
  272.         SyringeDigits.Tints[0].B = 64;
  273.  
  274.         SyringeDigits.Tints[1] = SyringeDigits.Tints[0];
  275.     }
  276.  
  277.     if ( bDisplayQuickSyringe  )
  278.     {
  279.         S = Syringe(PawnOwner.FindInventoryType(class'Syringe'));
  280.         if ( S != none )
  281.         {
  282.             QuickSyringeDigits.Value = S.ChargeBar() * 100;
  283.  
  284.             if ( QuickSyringeDigits.Value < 50 )
  285.             {
  286.                 QuickSyringeDigits.Tints[0].R = 128;
  287.                 QuickSyringeDigits.Tints[0].G = 128;
  288.                 QuickSyringeDigits.Tints[0].B = 128;
  289.  
  290.                 QuickSyringeDigits.Tints[1] = QuickSyringeDigits.Tints[0];
  291.             }
  292.             else if ( QuickSyringeDigits.Value < 100 )
  293.             {
  294.                 QuickSyringeDigits.Tints[0].R = 192;
  295.                 QuickSyringeDigits.Tints[0].G = 96;
  296.                 QuickSyringeDigits.Tints[0].B = 96;
  297.  
  298.                 QuickSyringeDigits.Tints[1] = QuickSyringeDigits.Tints[0];
  299.             }
  300.             else
  301.             {
  302.                 QuickSyringeDigits.Tints[0].R = 255;
  303.                 QuickSyringeDigits.Tints[0].G = 64;
  304.                 QuickSyringeDigits.Tints[0].B = 64;
  305.  
  306.                 QuickSyringeDigits.Tints[1] = QuickSyringeDigits.Tints[0];
  307.             }
  308.         }
  309.     }
  310.  
  311.     // Hints
  312.     if ( PawnOwner.Health <= 50 )
  313.     {
  314.         KFPlayerController(PlayerOwner).CheckForHint(51);
  315.     }
  316.  
  317.     Super(HudBase).UpdateHud();
  318. }
  319.  
  320. function DrawCustomBeacon(Canvas C, Pawn P, float ScreenLocX, float ScreenLocY);
  321.  
  322. simulated function DrawSpectatingHud(Canvas C)
  323. {
  324.     local rotator CamRot;
  325.     local vector CamPos, ViewDir, ScreenPos;
  326.     local KFPawn KFBuddy;
  327.  
  328.     DrawModOverlay(C);
  329.  
  330.     if( bHideHud )
  331.         return;
  332.  
  333.     PlayerOwner.PostFX_SetActive(0, false);
  334.  
  335.     // Grab our View Direction
  336.     C.GetCameraLocation(CamPos, CamRot);
  337.     ViewDir = vector(CamRot);
  338.  
  339.     // Draw the Name, Health, Armor, and Veterancy above other players (using this way to fix portal's beacon errors).
  340.     foreach VisibleCollidingActors(Class'KFPawn',KFBuddy,1000.f,CamPos)
  341.     {
  342.         KFBuddy.bNoTeamBeacon = true;
  343.         if ( KFBuddy.PlayerReplicationInfo!=None && KFBuddy.Health>0 && ((KFBuddy.Location - CamPos) Dot ViewDir)>0.8 )
  344.         {
  345.             ScreenPos = C.WorldToScreen(KFBuddy.Location+vect(0,0,1)*KFBuddy.CollisionHeight);
  346.             if( ScreenPos.X>=0 && ScreenPos.Y>=0 && ScreenPos.X<=C.ClipX && ScreenPos.Y<=C.ClipY )
  347.                 DrawPlayerInfo(C, KFBuddy, ScreenPos.X, ScreenPos.Y);
  348.         }
  349.     }
  350.  
  351.     DrawFadeEffect(C);
  352.  
  353.     if ( KFPlayerController(PlayerOwner) != None && KFPlayerController(PlayerOwner).ActiveNote != None )
  354.         KFPlayerController(PlayerOwner).ActiveNote = None;
  355.  
  356.     if( KFGameReplicationInfo(Level.GRI) != none && KFGameReplicationInfo(Level.GRI).EndGameType > 0 )
  357.     {
  358.         if( KFGameReplicationInfo(Level.GRI).EndGameType == 2 )
  359.         {
  360.             DrawEndGameHUD(C, True);
  361.             DrawStoryHUDInfo(C);
  362.             Return;
  363.         }
  364.         else DrawEndGameHUD(C, False);
  365.     }
  366.  
  367.     DrawKFHUDTextElements(C);
  368.     DisplayLocalMessages(C);
  369.  
  370.     if ( bShowScoreBoard && ScoreBoard != None )
  371.         ScoreBoard.DrawScoreboard(C);
  372.  
  373.     // portrait
  374.     if ( bShowPortrait && Portrait != None )
  375.         DrawPortrait(C);
  376.  
  377.     // Draw hints
  378.     if ( bDrawHint )
  379.         DrawHint(C);
  380.     DrawStoryHUDInfo(C);
  381. }
  382.  
  383. simulated function DrawHud(Canvas C)
  384. {
  385.     local KFGameReplicationInfo CurrentGame;
  386.     local rotator CamRot;
  387.     local vector CamPos, ViewDir, ScreenPos;
  388.     local KFPawn KFBuddy;
  389.  
  390.     RenderDelta = Level.TimeSeconds - LastHUDRenderTime;
  391.     LastHUDRenderTime = Level.TimeSeconds;
  392.     CurrentGame = KFGameReplicationInfo(Level.GRI);
  393.  
  394.     if ( FontsPrecached < 2 )
  395.         PrecacheFonts(C);
  396.  
  397.     UpdateHud();
  398.  
  399.     PassStyle = STY_Modulated;
  400.     DrawModOverlay(C);
  401.  
  402.     if ( bUseBloom )
  403.         PlayerOwner.PostFX_SetActive(0, true);
  404.  
  405.     if ( bHideHud )
  406.     {
  407.         // Draw fade effects even if the hud is hidden so poeple can't just turn off thier hud
  408.         C.Style = ERenderStyle.STY_Alpha;
  409.         DrawFadeEffect(C);
  410.         return;
  411.     }
  412.  
  413.     if ( !KFPlayerReplicationInfo(PlayerOwner.PlayerReplicationInfo).bViewingMatineeCinematic )
  414.     {
  415.         if ( bShowTargeting )
  416.             DrawTargeting(C);
  417.  
  418.         // Grab our View Direction
  419.         C.GetCameraLocation(CamPos,CamRot);
  420.         ViewDir = vector(CamRot);
  421.  
  422.         // Draw the Name, Health, Armor, and Veterancy above other players (using this way to fix portal's beacon errors).
  423.         foreach VisibleCollidingActors(Class'KFPawn',KFBuddy,1000.f,CamPos)
  424.         {
  425.             KFBuddy.bNoTeamBeacon = true;
  426.             if ( KFBuddy!=PawnOwner && KFBuddy.PlayerReplicationInfo!=None && KFBuddy.Health>0 && ((KFBuddy.Location - CamPos) Dot ViewDir)>0.8 )
  427.             {
  428.                 ScreenPos = C.WorldToScreen(KFBuddy.Location+vect(0,0,1)*KFBuddy.CollisionHeight);
  429.                 if( ScreenPos.X>=0 && ScreenPos.Y>=0 && ScreenPos.X<=C.ClipX && ScreenPos.Y<=C.ClipY )
  430.                     DrawPlayerInfo(C, KFBuddy, ScreenPos.X, ScreenPos.Y);
  431.             }
  432.         }
  433.  
  434.         PassStyle = STY_Alpha;
  435.         DrawDamageIndicators(C);
  436.         DrawHudPassA(C);
  437.         DrawHudPassC(C);
  438.  
  439.         if ( KFPlayerController(PlayerOwner)!= None && KFPlayerController(PlayerOwner).ActiveNote!=None )
  440.         {
  441.             if( PlayerOwner.Pawn == none )
  442.                 KFPlayerController(PlayerOwner).ActiveNote = None;
  443.             else KFPlayerController(PlayerOwner).ActiveNote.RenderNote(C);
  444.         }
  445.  
  446.         PassStyle = STY_None;
  447.         DisplayLocalMessages(C);
  448.         DrawWeaponName(C);
  449.         DrawVehicleName(C);
  450.  
  451.         PassStyle = STY_Alpha;
  452.  
  453.         if ( CurrentGame!=None && CurrentGame.EndGameType > 0 )
  454.         {
  455.             DrawEndGameHUD(C, (CurrentGame.EndGameType==2));
  456.             return;
  457.         }
  458.  
  459.         RenderFlash(C);
  460.         C.Style = PassStyle;
  461.         DrawKFHUDTextElements(C);
  462.     }
  463.     if ( KFPlayerReplicationInfo(PlayerOwner.PlayerReplicationInfo).bViewingMatineeCinematic )
  464.     {
  465.         PassStyle = STY_Alpha;
  466.         DrawCinematicHUD(C);
  467.     }
  468.     if ( bShowNotification )
  469.         DrawPopupNotification(C);
  470.        
  471.     if(((PlayerOwner != none) && SRPlayerReplicationInfo(PlayerOwner.PlayerReplicationInfo) != none) && SRPlayerReplicationInfo(PlayerOwner.PlayerReplicationInfo).bShowDamage)
  472.     {
  473.         DrawDamage(C);
  474.         Log("Draw Damage C has been called");
  475.     }
  476.    
  477.     if(((PlayerOwner != none) && SRPlayerReplicationInfo(PlayerOwner.PlayerReplicationInfo) != none) && SRPlayerReplicationInfo(PlayerOwner.PlayerReplicationInfo).bUseNoobCross)
  478.     {
  479.         DrawNoobCrosshair(C);
  480.     }  
  481. }
  482.  
  483. simulated function DrawNoobCrosshair(Canvas C)
  484. {
  485.     local float X, Y;
  486.  
  487.     X = (C.ClipX * 0.50) - float(32);
  488.     Y = (C.ClipY * 0.50) - float(29);
  489.     C.SetPos(X, Y);
  490.     C.SetDrawColor(byte(255), byte(255), byte(255), byte(255));
  491.     C.DrawRect(Noob_Crosshair, 64.0, 64.0);
  492. }
  493.  
  494. /*
  495. simulated function DrawDamage(Canvas C)
  496. {
  497.     local int i;
  498.     local float TimeSinceHit;
  499.     local Vector CameraLocation, CamDir;
  500.     local Rotator CameraRotation;
  501.     local Vector HBScreenPos;
  502.     local float TextWidth, TextHeight, X;
  503. Log("AWAWA")
  504.     C.GetCameraLocation(CameraLocation, CameraRotation);
  505.     CamDir = vector(CameraRotation);
  506.     if(C.ClipX <= float(800))
  507.     {
  508.         DamagePopupFont = 7;
  509.         Log("Font 7 ready");
  510.     }
  511.     else
  512.     {
  513.         if(C.ClipX <= float(1024))
  514.         {
  515.             DamagePopupFont = 6;
  516.             Log("Font 6 ready");
  517.         }
  518.         else
  519.         {
  520.             if(C.ClipX < float(1400))
  521.             {
  522.                 DamagePopupFont = 5;
  523.                 Log("Font 5 ready");
  524.             }
  525.             else
  526.             {
  527.                 if(C.ClipX < float(1700))
  528.                 {
  529.                     DamagePopupFont = 4;
  530.                     Log("Font 4 ready");
  531.                 }
  532.                 else
  533.                 {
  534.                     DamagePopupFont = 3;
  535.                 }
  536.             }
  537.         }
  538.     }
  539.     C.Font = LoadFont(DamagePopupFont);
  540.     for( i=0; i < 30 ; i++ ) {
  541.         TimeSinceHit = Level.TimeSeconds - DamagePopups[i].HitTime;
  542.         if( TimeSinceHit > DamagePopupFadeOutTime
  543.                 || ( Normal(DamagePopups[i].HitLocation - CameraLocation) dot Normal(CamDir) < 0.1 ) ) //don't draw if player faced back to the hit location
  544. Log("Draw Damage is running");             
  545.             continue;
  546.            
  547.         HBScreenPos = C.WorldToScreen(DamagePopups[i].HitLocation);    
  548.         C.StrLen(DamagePopups[i].damage, TextWidth, TextHeight);  
  549.         //draw just on the hit location
  550.         HBScreenPos.Y -= TextHeight/2;
  551.         HBScreenPos.X -= TextWidth/2;
  552. Log("Draw Damage is running");
  553.         //let numbers to fly up
  554.         HBScreenPos.Y -= TimeSinceHit * TextHeight * DamagePopups[i].RandY;
  555.         x = Sin(2*Pi * TimeSinceHit/DamagePopupFadeOutTime) * TextWidth * DamagePopups[i].RandX;
  556.         // odd numbers start to flying to the right side, even - left
  557.         // So in situations of decapitaion player could see both damages
  558.         if ( i % 2 == 0)
  559.             x *= -1.0;
  560.         HBScreenPos.X += x;          
  561. Log("Draw Damage is running");
  562.         C.DrawColor = DamagePopups[i].FontColor;
  563.         C.DrawColor.A = 255 * cos(0.5*Pi * TimeSinceHit/DamagePopupFadeOutTime);
  564.  
  565.         C.SetPos( HBScreenPos.X, HBScreenPos.Y);
  566.         C.DrawText(DamagePopups[i].damage);
  567. Log("Draw Damage is running");
  568.     }
  569. }
  570. */
  571.  
  572. simulated function DrawDamage(Canvas C)
  573. {
  574.     local int i;
  575.     local float TimeSinceHit;
  576.     local vector CameraLocation, CamDir;
  577.     local rotator CameraRotation;
  578.     local vector HBScreenPos;
  579.     local float TextWidth, TextHeight, x;
  580.      
  581.     C.GetCameraLocation(CameraLocation, CameraRotation);
  582.     CamDir    = vector(CameraRotation);
  583.  
  584.     if ( C.ClipX <= 800 )
  585.         DamagePopupFont = 7;
  586.     else if ( C.ClipX <= 1024 )
  587.         DamagePopupFont = 6;
  588.     else if ( C.ClipX < 1400 )
  589.         DamagePopupFont = 5;
  590.     else if ( C.ClipX < 1700 )
  591.         DamagePopupFont = 4;
  592.     else
  593.         DamagePopupFont = 3;  
  594.        
  595.     C.Font = LoadFont(DamagePopupFont);
  596.  
  597.     for( i=0; i < DAMAGEPOPUP_COUNT ; i++ ) {
  598.         TimeSinceHit = Level.TimeSeconds - DamagePopups[i].HitTime;
  599.         if( TimeSinceHit > DamagePopupFadeOutTime
  600.                 || ( Normal(DamagePopups[i].HitLocation - CameraLocation) dot Normal(CamDir) < 0.1 ) ) //don't draw if player faced back to the hit location
  601.             continue;
  602.        
  603.         HBScreenPos = C.WorldToScreen(DamagePopups[i].HitLocation);    
  604.         C.StrLen(DamagePopups[i].damage, TextWidth, TextHeight);  
  605.         //draw just on the hit location
  606.         HBScreenPos.Y -= TextHeight/2;
  607.         HBScreenPos.X -= TextWidth/2;
  608.        
  609.         //let numbers to fly up
  610.         HBScreenPos.Y -= TimeSinceHit * TextHeight * DamagePopups[i].RandY;
  611.         x = Sin(2*Pi * TimeSinceHit/DamagePopupFadeOutTime) * TextWidth * DamagePopups[i].RandX;
  612.         // odd numbers start to flying to the right side, even - left
  613.         // So in situations of decapitaion player could see both damages
  614.         if ( i % 2 == 0)
  615.             x *= -1.0;
  616.         HBScreenPos.X += x;          
  617.  
  618.         C.DrawColor = DamagePopups[i].FontColor;
  619.         C.DrawColor.A = 255 * cos(0.5*Pi * TimeSinceHit/DamagePopupFadeOutTime);
  620.  
  621.         C.SetPos( HBScreenPos.X, HBScreenPos.Y);
  622.         C.DrawText(DamagePopups[i].damage);
  623.     }
  624. }
  625.  
  626. simulated function DrawHudPassC(Canvas C)
  627. {
  628.     DrawFadeEffect(C);
  629.  
  630.     if ( bShowScoreBoard && ScoreBoard != None )
  631.         ScoreBoard.DrawScoreboard(C);
  632.  
  633.     // portrait
  634.     if ( bShowPortrait && (Portrait != None) )
  635.         DrawPortraitX(C);
  636. }
  637.  
  638. function DrawPlayerInfo(Canvas C, Pawn P, float ScreenLocX, float ScreenLocY)
  639. {
  640.     local float XL, YL, TempX, TempY, TempSize;
  641.  
  642.     local string PlayerName;
  643.     local float dist, OffsetX;
  644.     local byte BeaconAlpha,Counter;
  645.     local float OldZ;
  646.     local Material TempMaterial, TempStarMaterial;
  647.     local byte TempLevel, HudLVL;
  648.  
  649.     if(((KFPlayerReplicationInfo(P.PlayerReplicationInfo) == none) || KFPRI == none) || KFPRI.bViewingMatineeCinematic)
  650.     {
  651.         return;
  652.     }
  653.     dist = VSize(P.Location - PlayerOwner.CalcViewLocation);
  654.     dist -= HealthBarFullVisDist;
  655.     dist = FClamp(dist, 0.0, HealthBarCutoffDist - HealthBarFullVisDist);
  656.     dist = dist / (HealthBarCutoffDist - HealthBarFullVisDist);
  657.     BeaconAlpha = byte((1.0 - dist) * 255.0);
  658.  
  659.     if(BeaconAlpha == 0)
  660.     {
  661.         return;
  662.     }
  663.     OldZ = C.Z;
  664.     C.Z = 1.0;
  665.     C.Style = ERenderStyle.STY_Alpha;
  666.     C.SetDrawColor(255, 255, 255, BeaconAlpha);
  667.     C.Font = GetConsoleFont(C);
  668.     Class'SRScoreBoard'.Static.TextSizeCountry(C,P.PlayerReplicationInfo,XL,YL);
  669.     Class'SRScoreBoard'.Static.DrawCountryName(C,P.PlayerReplicationInfo,ScreenLocX-(XL * 0.5),ScreenLocY-(YL * 0.75));
  670.  
  671.     OffsetX = (36.f * VeterancyMatScaleFactor * 0.6) - (HealthIconSize + 2.0);
  672.     if((class<SRVeterancyTypes>(KFPlayerReplicationInfo(P.PlayerReplicationInfo).ClientVeteranSkill) != none) && KFPlayerReplicationInfo(P.PlayerReplicationInfo).ClientVeteranSkill.default.OnHUDIcon != none)
  673.     {
  674.         TempLevel = class<SRVeterancyTypes>(KFPlayerReplicationInfo(P.PlayerReplicationInfo).ClientVeteranSkill).static.PreDrawPerk(C, byte(KFPlayerReplicationInfo(P.PlayerReplicationInfo).ClientVeteranSkillLevel), TempMaterial, TempStarMaterial);
  675.         HudLVL = byte(KFPlayerReplicationInfo(P.PlayerReplicationInfo).ClientVeteranSkillLevel);
  676.         TempSize = 36.0 * VeterancyMatScaleFactor;
  677.         TempX = ((ScreenLocX + ((BarLength + HealthIconSize) * 0.50)) - (TempSize * 0.250)) - OffsetX;
  678.         TempY = (ScreenLocY - YL) - (TempSize * 0.750);
  679.         C.SetPos(TempX, TempY);
  680.         C.DrawTile(TempMaterial, TempSize, TempSize, 0.0, 0.0, float(TempMaterial.MaterialUSize()), float(TempMaterial.MaterialVSize()));
  681.         C.SetPos(TempX + (TempSize * 0.90), TempY);
  682.         C.DrawText(string(HudLVL));
  683.     }
  684.     // End:0x438
  685.     if(P.Health > 0)
  686.     {
  687.         DrawKFBar(C, ScreenLocX - OffsetX, (ScreenLocY - YL) - (0.40 * BarHeight), FClamp(float(P.Health) / P.HealthMax, 0.0, 1.0), BeaconAlpha);
  688.     }
  689.     // End:0x4A6
  690.     if(P.ShieldStrength > float(0))
  691.     {
  692.         DrawKFBar(C, ScreenLocX - OffsetX, (ScreenLocY - YL) - (1.50 * BarHeight), FClamp(P.ShieldStrength / 100.0, 0.0, 1.0), BeaconAlpha, true);
  693.     }
  694.     C.Z = OldZ;
  695.     //return;    
  696. }
  697.  
  698. simulated function DrawModOverlay( Canvas C )
  699. {
  700.     local float MaxRBrighten, MaxGBrighten, MaxBBrighten;
  701.  
  702.     // We want the overlay to start black, and fade in, almost like the player opened their eyes
  703.     // BrightFactor = 1.5;   // Not too bright.  Not too dark.  Livens things up just abit
  704.     // Hook for Optional Vision overlay.  - Alex
  705.  
  706.     if( PawnOwner==None )
  707.     {
  708.         if( CurrentZone!=None || CurrentVolume!=None ) // Reset everything.
  709.         {
  710.             LastR = 0;
  711.                 LastG = 0;
  712.                 LastB = 0;
  713.             CurrentZone = None;
  714.             LastZone = None;
  715.             CurrentVolume = None;
  716.             LastVolume = None;
  717.             bZoneChanged = false;
  718.             SetTimer(0.f, false);
  719.         }
  720.         VisionOverlay = default.VisionOverlay;
  721.  
  722.         // Dead Players see Red
  723.         if( !PlayerOwner.IsSpectating() )
  724.         {
  725.             C.SetDrawColor(255, 255, 255, GrainAlpha);
  726.             C.DrawTile(SpectatorOverlay, C.SizeX, C.SizeY, 0, 0, 1024, 1024);
  727.         }
  728.         return;
  729.     }
  730.  
  731.     C.SetPos(0, 0);
  732.  
  733.     // if critical, pulsate.  otherwise, dont.
  734.     if ( (PlayerOwner.Pawn==PawnOwner || !PlayerOwner.bBehindView) && Vehicle(PawnOwner)==None && PawnOwner.Health>0 && PawnOwner.Health<(PawnOwner.HealthMax*0.25) )
  735.         VisionOverlay = NearDeathOverlay;
  736.     else VisionOverlay = default.VisionOverlay;
  737.  
  738.     // Players can choose to turn this feature off completely.
  739.     // conversely, setting bDistanceFog = false in a Zone
  740.     //will cause the code to ignore that zone for a shift in RGB tint
  741.     if ( KFLevelRule != none && !KFLevelRule.bUseVisionOverlay )
  742.         return;
  743.  
  744.     // here we determine the maximum "brighten" amounts for each value.  CANNOT exceed 255
  745.     MaxRBrighten = Round(LastR* (1.0 - (LastR / 255)) - 2) ;
  746.     MaxGBrighten = Round(LastG* (1.0 - (LastG / 255)) - 2) ;
  747.     MaxBBrighten = Round(LastB* (1.0 - (LastB / 255)) - 2) ;
  748.  
  749.     C.SetDrawColor(LastR + MaxRBrighten, LastG + MaxGBrighten, LastB + MaxBBrighten, GrainAlpha);
  750.     C.DrawTileScaled(VisionOverlay, C.SizeX, C.SizeY);  //,0,0,1024,1024);
  751.  
  752.     // Here we change over the Zone.
  753.     // What happens of importance is
  754.     // A.  Set Old Zone to current
  755.     // B.  Set New Zone
  756.     // C.  Set Color info up for use by Tick()
  757.  
  758.     // if we're in a new zone or volume without distance fog...just , dont touch anything.
  759.     // the physicsvolume check is abit screwy because the player is always in a volume called "DefaultPhyicsVolume"
  760.     // so we've gotta make sure that the return checks take this into consideration.
  761.  
  762.     // This block of code here just makes sure that if we've already got a tint, and we step into a zone/volume without
  763.     // bDistanceFog, our current tint is not affected.
  764.     // a.  If I'm in a zone and its not bDistanceFog. AND IM NOT IN A PHYSICSVOLUME. Just a zone.
  765.     // b.  If I'm in a Volume
  766.     if ( !PawnOwner.Region.Zone.bDistanceFog &&
  767.          DefaultPhysicsVolume(PawnOwner.PhysicsVolume)==None && !PawnOwner.PhysicsVolume.bDistanceFog )
  768.         return;
  769.  
  770.     if ( !bZoneChanged )
  771.     {
  772.         // Grab the most recent zone info from our PRI
  773.         // Only update if it's different
  774.         // EDIT:  AND HAS bDISTANCEFOG true
  775.         if ( CurrentZone!=PawnOwner.Region.Zone || (DefaultPhysicsVolume(PawnOwner.PhysicsVolume) == None &&
  776.              CurrentVolume != PawnOwner.PhysicsVolume) )
  777.         {
  778.             if ( CurrentZone != none )
  779.                 LastZone = CurrentZone;
  780.             else if ( CurrentVolume != none )
  781.                 LastVolume = CurrentVolume;
  782.  
  783.             // This is for all occasions where we're either in a Levelinfo handled zone
  784.             // Or a zoneinfo.
  785.             // If we're in a LevelInfo / ZoneInfo  and NOT touching a Volume.  Set current Zone
  786.             if ( PawnOwner.Region.Zone.bDistanceFog && DefaultPhysicsVolume(PawnOwner.PhysicsVolume)!= none && !PawnOwner.Region.Zone.bNoKFColorCorrection )
  787.             {
  788.                 CurrentVolume = none;
  789.                 CurrentZone = PawnOwner.Region.Zone;
  790.             }
  791.             else if ( DefaultPhysicsVolume(PawnOwner.PhysicsVolume) == None && PawnOwner.PhysicsVolume.bDistanceFog && !PawnOwner.PhysicsVolume.bNoKFColorCorrection)
  792.             {
  793.                 CurrentZone = none;
  794.                 CurrentVolume = PawnOwner.PhysicsVolume;
  795.             }
  796.  
  797.             if ( CurrentVolume != none )
  798.                 LastZone = none;
  799.             else if ( CurrentZone != none )
  800.                 LastVolume = none;
  801.  
  802.             if ( LastZone != none )
  803.             {
  804.                 if( LastZone.bNewKFColorCorrection )
  805.                 {
  806.                     LastR = LastZone.KFOverlayColor.R;
  807.                         LastG = LastZone.KFOverlayColor.G;
  808.                         LastB = LastZone.KFOverlayColor.B;
  809.                 }
  810.                 else
  811.                 {
  812.                     LastR = LastZone.DistanceFogColor.R;
  813.                         LastG = LastZone.DistanceFogColor.G;
  814.                         LastB = LastZone.DistanceFogColor.B;
  815.                 }
  816.             }
  817.             else if ( LastVolume != none )
  818.             {
  819.                 if( LastVolume.bNewKFColorCorrection )
  820.                 {
  821.                     LastR = LastVolume.KFOverlayColor.R;
  822.                         LastG = LastVolume.KFOverlayColor.G;
  823.                         LastB = LastVolume.KFOverlayColor.B;
  824.                 }
  825.                 else
  826.                 {
  827.                         LastR = LastVolume.DistanceFogColor.R;
  828.                         LastG = LastVolume.DistanceFogColor.G;
  829.                         LastB = LastVolume.DistanceFogColor.B;
  830.                 }
  831.             }
  832.             else if ( LastZone != none && LastVolume != none )
  833.                 return;
  834.  
  835.             if ( LastZone != CurrentZone || LastVolume != CurrentVolume )
  836.             {
  837.                 bZoneChanged = true;
  838.                 SetTimer(OverlayFadeSpeed, false);
  839.             }
  840.         }
  841.     }
  842.     if ( !bTicksTurn && bZoneChanged )
  843.     {
  844.         // Pass it off to the tick now
  845.         // valueCheckout signifies that none of the three values have been
  846.         // altered by Tick() yet.
  847.  
  848.         // BOUNCE IT BACK! :D
  849.         ValueCheckOut = 0;
  850.         bTicksTurn = true;
  851.         SetTimer(OverlayFadeSpeed, false);
  852.     }
  853. }
  854.  
  855. simulated function DrawEndGameHUD(Canvas C, bool bVictory)
  856. {
  857.     local float Scalar;
  858.     local Shader M;
  859.  
  860.     C.DrawColor.A = 255;
  861.     C.DrawColor.R = 255;
  862.     C.DrawColor.G = 255;
  863.     C.DrawColor.B = 255;
  864.     Scalar = FClamp(C.ClipY, 320, 1024);
  865.     C.CurX = C.ClipX / 2 - Scalar / 2;
  866.     C.CurY = C.ClipY / 2 - Scalar / 2;
  867.     C.Style = ERenderStyle.STY_Alpha;
  868.  
  869.     if ( bVictory )
  870.         M = Shader'KFMapEndTextures.VictoryShader';
  871.     else M = Shader'KFMapEndTextures.DefeatShader';
  872.  
  873.     C.DrawTile(M, Scalar, Scalar, 0, 0, 1024, 1024);
  874.  
  875.     if ( bShowScoreBoard && ScoreBoard != None )
  876.         ScoreBoard.DrawScoreboard(C);
  877. }
  878.  
  879. simulated function DrawHudPassA(Canvas C)
  880. {
  881.     local KFHumanPawn KFHPawn;
  882.     local Material TempMaterial, TempStarMaterial;
  883.     local int TempLevel;
  884.     local float TempX, TempY, TempSize;
  885.     local class<SRVeterancyTypes> SV;
  886.     local byte HudLVL;
  887.  
  888.     KFHPawn = KFHumanPawn(PawnOwner);
  889.     DrawDoorHealthBars(C);
  890.     // End:0x36
  891.     if(!bLightHud)
  892.     {
  893.         DrawSpriteWidget(C, HealthBG);
  894.     }
  895.     DrawSpriteWidget(C, HealthIcon);
  896.     DrawNumericWidget(C, HealthDigits, DigitsSmall);
  897.     // End:0x76
  898.     if(!bLightHud)
  899.     {
  900.         DrawSpriteWidget(C, ArmorBG);
  901.     }
  902.     DrawSpriteWidget(C, ArmorIcon);
  903.     DrawNumericWidget(C, ArmorDigits, DigitsSmall);
  904.     // End:0x2DA
  905.     if(KFHPawn != none)
  906.     {
  907.         C.SetPos(C.ClipX * WeightBG.PosX, C.ClipY * WeightBG.PosY);
  908.         // End:0x1B5
  909.         if(!bLightHud)
  910.         {
  911.             C.DrawTile(WeightBG.WidgetTexture, ((((float(WeightBG.WidgetTexture.MaterialUSize()) * WeightBG.TextureScale) * 1.50) * HudCanvasScale) * ResScaleX) * HudScale, (((float(WeightBG.WidgetTexture.MaterialVSize()) * WeightBG.TextureScale) * HudCanvasScale) * ResScaleY) * HudScale, 0.0, 0.0, float(WeightBG.WidgetTexture.MaterialUSize()), float(WeightBG.WidgetTexture.MaterialVSize()));
  912.         }
  913.         DrawSpriteWidget(C, WeightIcon);
  914.         C.Font = LoadSmallFontStatic(5);
  915.         C.FontScaleX = C.ClipX / 1024.0;
  916.         C.FontScaleY = C.FontScaleX;
  917.         C.SetPos(C.ClipX * WeightDigits.PosX, C.ClipY * WeightDigits.PosY);
  918.         C.DrawColor = WeightDigits.Tints[0];
  919.         C.DrawText((string(int(KFHPawn.CurrentWeight)) $ "/") $ string(int(KFHPawn.MaxCarryWeight)));
  920.         C.FontScaleX = 1.0;
  921.         C.FontScaleY = 1.0;
  922.        
  923.        
  924.         // ????? ???????
  925.         if(SRPlayerReplicationInfo(PawnOwnerPRI) != none)
  926.         {
  927.             if(SRPlayerReplicationInfo(PawnOwnerPRI).ExpMult!=0)
  928.             {
  929.                 C.SetPos(C.ClipX * 0.05, C.ClipY * 0.7);
  930.                 C.DrawText("Exp Bonus x"$string(SRPlayerReplicationInfo(PawnOwnerPRI).ExpMult));
  931.             }
  932.            
  933.             if(SRPlayerReplicationInfo(PawnOwnerPRI).DamMult!=0)
  934.             {
  935.                 C.SetPos(C.ClipX * 0.05, C.ClipY * 0.75);
  936.                 C.DrawText("Damage Bonus x"$string(SRPlayerReplicationInfo(PawnOwnerPRI).DamMult));
  937.             }
  938.         }
  939.     }
  940.     // End:0x2F5
  941.     if(!bLightHud)
  942.     {
  943.         DrawSpriteWidget(C, GrenadeBG);
  944.     }
  945.     DrawSpriteWidget(C, GrenadeIcon);
  946.     DrawNumericWidget(C, GrenadeDigits, DigitsSmall);
  947.     // End:0xCEE
  948.     if((PawnOwner != none) && PawnOwner.Weapon != none)
  949.     {
  950.         // End:0x397
  951.         if(Syringe(PawnOwner.Weapon) != none)
  952.         {
  953.             // End:0x36F
  954.             if(!bLightHud)
  955.             {
  956.                 DrawSpriteWidget(C, SyringeBG);
  957.             }
  958.             DrawSpriteWidget(C, SyringeIcon);
  959.             DrawNumericWidget(C, SyringeDigits, DigitsSmall);
  960.         }
  961.         // End:0xCEE
  962.         else
  963.         {
  964.             // End:0x689
  965.             if(bDisplayQuickSyringe)
  966.             {
  967.                 TempSize = Level.TimeSeconds - QuickSyringeStartTime;
  968.                 // End:0x681
  969.                 if(TempSize < QuickSyringeDisplayTime)
  970.                 {
  971.                     // End:0x4B4
  972.                     if(TempSize < QuickSyringeFadeInTime)
  973.                     {
  974.                         QuickSyringeBG.Tints[0].A = byte(int((TempSize / QuickSyringeFadeInTime) * 255.0));
  975.                         QuickSyringeBG.Tints[1].A = QuickSyringeBG.Tints[0].A;
  976.                         QuickSyringeIcon.Tints[0].A = QuickSyringeBG.Tints[0].A;
  977.                         QuickSyringeIcon.Tints[1].A = QuickSyringeBG.Tints[0].A;
  978.                         QuickSyringeDigits.Tints[0].A = QuickSyringeBG.Tints[0].A;
  979.                         QuickSyringeDigits.Tints[1].A = QuickSyringeBG.Tints[0].A;
  980.                     }
  981.                     // End:0x63E
  982.                     else
  983.                     {
  984.                         // End:0x5BA
  985.                         if(TempSize > (QuickSyringeDisplayTime - QuickSyringeFadeOutTime))
  986.                         {
  987.                             QuickSyringeBG.Tints[0].A = byte(int((1.0 - ((TempSize - (QuickSyringeDisplayTime - QuickSyringeFadeOutTime)) / QuickSyringeFadeOutTime)) * 255.0));
  988.                             QuickSyringeBG.Tints[1].A = QuickSyringeBG.Tints[0].A;
  989.                             QuickSyringeIcon.Tints[0].A = QuickSyringeBG.Tints[0].A;
  990.                             QuickSyringeIcon.Tints[1].A = QuickSyringeBG.Tints[0].A;
  991.                             QuickSyringeDigits.Tints[0].A = QuickSyringeBG.Tints[0].A;
  992.                             QuickSyringeDigits.Tints[1].A = QuickSyringeBG.Tints[0].A;
  993.                         }
  994.                         // End:0x63E
  995.                         else
  996.                         {
  997.                             QuickSyringeBG.Tints[0].A = byte(255);
  998.                             QuickSyringeBG.Tints[1].A = byte(255);
  999.                             QuickSyringeIcon.Tints[0].A = byte(255);
  1000.                             QuickSyringeIcon.Tints[1].A = byte(255);
  1001.                             QuickSyringeDigits.Tints[0].A = byte(255);
  1002.                             QuickSyringeDigits.Tints[1].A = byte(255);
  1003.                         }
  1004.                     }
  1005.                     // End:0x659
  1006.                     if(!bLightHud)
  1007.                     {
  1008.                         DrawSpriteWidget(C, QuickSyringeBG);
  1009.                     }
  1010.                     DrawSpriteWidget(C, QuickSyringeIcon);
  1011.                     DrawNumericWidget(C, QuickSyringeDigits, DigitsSmall);
  1012.                 }
  1013.                 // End:0x689
  1014.                 else
  1015.                 {
  1016.                     bDisplayQuickSyringe = false;
  1017.                 }
  1018.             }
  1019.             // End:0x8A2
  1020.             if((MP7MMedicGun(PawnOwner.Weapon) != none) || MP5MMedicGun(PawnOwner.Weapon) != none)
  1021.             {
  1022.                 // End:0x709
  1023.                 if(MP7MMedicGun(PawnOwner.Weapon) != none)
  1024.                 {
  1025.                     MedicGunDigits.Value = int(MP7MMedicGun(PawnOwner.Weapon).ChargeBar() * float(100));
  1026.                 }
  1027.                 // End:0x739
  1028.                 else
  1029.                 {
  1030.                     MedicGunDigits.Value = int(MP5MMedicGun(PawnOwner.Weapon).ChargeBar() * float(100));
  1031.                 }
  1032.                 // End:0x7A2
  1033.                 if(MedicGunDigits.Value < 50)
  1034.                 {
  1035.                     MedicGunDigits.Tints[0].R = 128;
  1036.                     MedicGunDigits.Tints[0].G = 128;
  1037.                     MedicGunDigits.Tints[0].B = 128;
  1038.                     MedicGunDigits.Tints[1] = SyringeDigits.Tints[0];
  1039.                 }
  1040.                 // End:0x862
  1041.                 else
  1042.                 {
  1043.                     // End:0x80B
  1044.                     if(MedicGunDigits.Value < 100)
  1045.                     {
  1046.                         MedicGunDigits.Tints[0].R = 192;
  1047.                         MedicGunDigits.Tints[0].G = 96;
  1048.                         MedicGunDigits.Tints[0].B = 96;
  1049.                         MedicGunDigits.Tints[1] = SyringeDigits.Tints[0];
  1050.                     }
  1051.                     // End:0x862
  1052.                     else
  1053.                     {
  1054.                         MedicGunDigits.Tints[0].R = byte(255);
  1055.                         MedicGunDigits.Tints[0].G = 64;
  1056.                         MedicGunDigits.Tints[0].B = 64;
  1057.                         MedicGunDigits.Tints[1] = MedicGunDigits.Tints[0];
  1058.                     }
  1059.                 }
  1060.                 // End:0x87D
  1061.                 if(!bLightHud)
  1062.                 {
  1063.                     DrawSpriteWidget(C, MedicGunBG);
  1064.                 }
  1065.                 DrawSpriteWidget(C, MedicGunIcon);
  1066.                 DrawNumericWidget(C, MedicGunDigits, DigitsSmall);
  1067.             }
  1068.             // End:0x8FE
  1069.             if(Welder(PawnOwner.Weapon) != none)
  1070.             {
  1071.                 // End:0x8D6
  1072.                 if(!bLightHud)
  1073.                 {
  1074.                     DrawSpriteWidget(C, WelderBG);
  1075.                 }
  1076.                 DrawSpriteWidget(C, WelderIcon);
  1077.                 DrawNumericWidget(C, WelderDigits, DigitsSmall);
  1078.             }
  1079.             // End:0xC73
  1080.             else
  1081.             {
  1082.                 // End:0xC73
  1083.                 if(PawnOwner.Weapon.GetAmmoClass(0) != none)
  1084.                 {
  1085.                     // End:0x938
  1086.                     if(!bLightHud)
  1087.                     {
  1088.                         DrawSpriteWidget(C, ClipsBG);
  1089.                     }
  1090.                     // End:0x98E
  1091.                     if(Huskgun(PawnOwner.Weapon) != none)
  1092.                     {
  1093.                         ClipsDigits.PosX = 0.8730;
  1094.                         DrawNumericWidget(C, ClipsDigits, DigitsSmall);
  1095.                         ClipsDigits.PosX = default.ClipsDigits.PosX;
  1096.                     }
  1097.                     // End:0x9A3
  1098.                     else
  1099.                     {
  1100.                         DrawNumericWidget(C, ClipsDigits, DigitsSmall);
  1101.                     }
  1102.                     // End:0x9CF
  1103.                     if(LAW(PawnOwner.Weapon) != none)
  1104.                     {
  1105.                         DrawSpriteWidget(C, LawRocketIcon);
  1106.                     }
  1107.                     // End:0xB98
  1108.                     else
  1109.                     {
  1110.                         // End:0x9FB
  1111.                         if(Crossbow(PawnOwner.Weapon) != none)
  1112.                         {
  1113.                             DrawSpriteWidget(C, ArrowheadIcon);
  1114.                         }
  1115.                         // End:0xB98
  1116.                         else
  1117.                         {
  1118.                             // End:0xA27
  1119.                             if(PipeBombExplosive(PawnOwner.Weapon) != none)
  1120.                             {
  1121.                                 DrawSpriteWidget(C, PipeBombIcon);
  1122.                             }
  1123.                             // End:0xB98
  1124.                             else
  1125.                             {
  1126.                                 // End:0xA53
  1127.                                 if(M79GrenadeLauncher(PawnOwner.Weapon) != none)
  1128.                                 {
  1129.                                     DrawSpriteWidget(C, M79Icon);
  1130.                                 }
  1131.                                 // End:0xB98
  1132.                                 else
  1133.                                 {
  1134.                                     // End:0xA7F
  1135.                                     if(Huskgun(PawnOwner.Weapon) != none)
  1136.                                     {
  1137.                                         DrawSpriteWidget(C, HuskAmmoIcon);
  1138.                                     }
  1139.                                     // End:0xB98
  1140.                                     else
  1141.                                     {
  1142.                                         // End:0xA9A
  1143.                                         if(!bLightHud)
  1144.                                         {
  1145.                                             DrawSpriteWidget(C, BulletsInClipBG);
  1146.                                         }
  1147.                                         DrawNumericWidget(C, BulletsInClipDigits, DigitsSmall);
  1148.                                         // End:0xAEB
  1149.                                         if(FlameThrower(PawnOwner.Weapon) != none)
  1150.                                         {
  1151.                                             DrawSpriteWidget(C, FlameIcon);
  1152.                                             DrawSpriteWidget(C, FlameTankIcon);
  1153.                                         }
  1154.                                         // End:0xB98
  1155.                                         else
  1156.                                         {
  1157.                                             // End:0xB78
  1158.                                             if((((Shotgun(PawnOwner.Weapon) != none) || BoomStick(PawnOwner.Weapon) != none) || Winchester(PawnOwner.Weapon) != none) || BenelliShotgun(PawnOwner.Weapon) != none)
  1159.                                             {
  1160.                                                 DrawSpriteWidget(C, SingleBulletIcon);
  1161.                                                 DrawSpriteWidget(C, BulletsInClipIcon);
  1162.                                             }
  1163.                                             // End:0xB98
  1164.                                             else
  1165.                                             {
  1166.                                                 DrawSpriteWidget(C, ClipsIcon);
  1167.                                                 DrawSpriteWidget(C, BulletsInClipIcon);
  1168.                                             }
  1169.                                         }
  1170.                                     }
  1171.                                 }
  1172.                             }
  1173.                         }
  1174.                     }
  1175.                     // End:0xC73
  1176.                     if((KFWeapon(PawnOwner.Weapon) != none) && KFWeapon(PawnOwner.Weapon).bTorchEnabled)
  1177.                     {
  1178.                         // End:0xBEE
  1179.                         if(!bLightHud)
  1180.                         {
  1181.                             DrawSpriteWidget(C, FlashlightBG);
  1182.                         }
  1183.                         DrawNumericWidget(C, FlashlightDigits, DigitsSmall);
  1184.                         // End:0xC63
  1185.                         if((KFWeapon(PawnOwner.Weapon).FlashLight != none) && KFWeapon(PawnOwner.Weapon).FlashLight.bHasLight)
  1186.                         {
  1187.                             DrawSpriteWidget(C, FlashlightIcon);
  1188.                         }
  1189.                         // End:0xC73
  1190.                         else
  1191.                         {
  1192.                             DrawSpriteWidget(C, FlashlightOffIcon);
  1193.                         }
  1194.                     }
  1195.                 }
  1196.             }
  1197.             // End:0xCEE
  1198.             if((KFWeapon(PawnOwner.Weapon) != none) && KFWeapon(PawnOwner.Weapon).bHasSecondaryAmmo)
  1199.             {
  1200.                 // End:0xCC9
  1201.                 if(!bLightHud)
  1202.                 {
  1203.                     DrawSpriteWidget(C, SecondaryClipsBG);
  1204.                 }
  1205.                 DrawNumericWidget(C, SecondaryClipsDigits, DigitsSmall);
  1206.                 DrawSpriteWidget(C, SecondaryClipsIcon);
  1207.             }
  1208.         }
  1209.     }
  1210.     // End:0xD1C
  1211.     if(KFPlayerReplicationInfo(PawnOwnerPRI) != none)
  1212.     {
  1213.         SV = class<SRVeterancyTypes>(KFPlayerReplicationInfo(PawnOwnerPRI).ClientVeteranSkill);
  1214.     }
  1215.     // End:0xD45
  1216.     if(SV != none)
  1217.     {
  1218.         SV.static.SpecialHUDInfo(KFPlayerReplicationInfo(PawnOwnerPRI), C);
  1219.     }
  1220.     // End:0xDA5
  1221.     if((KFSGameReplicationInfo(PlayerOwner.GameReplicationInfo) == none) || KFSGameReplicationInfo(PlayerOwner.GameReplicationInfo).bHUDShowCash)
  1222.     {
  1223.         DrawSpriteWidget(C, CashIcon);
  1224.         DrawNumericWidget(C, CashDigits, DigitsBig);
  1225.     }
  1226.     // End:0x1126
  1227.     if(SV != none)
  1228.     {
  1229.         TempSize = (36.0 * VeterancyMatScaleFactor) * 1.40;
  1230.         TempX = C.ClipX * 0.0070;
  1231.         TempY = (C.ClipY * 0.930) - TempSize;
  1232.         C.DrawColor = WhiteColor;
  1233.         TempLevel = KFPlayerReplicationInfo(PawnOwnerPRI).ClientVeteranSkillLevel;
  1234.         // End:0xFA4
  1235.         if((ClientRep != none) && (TempLevel + 1) < ClientRep.MaximumLevel)
  1236.         {
  1237.             // Draw progress bar.
  1238.             bDisplayingProgress = true;
  1239.             if( NextLevelTimer<Level.TimeSeconds )
  1240.             {
  1241.                 NextLevelTimer = Level.TimeSeconds+3.f;
  1242.                 LevelProgressBar = SV.Static.GetTotalProgress(ClientRep,TempLevel+1);
  1243.             }
  1244.             Class'SRScoreBoard'.Static.DrawProgressBar(C,TempX,TempY-TempSize*0.12f,TempSize*2.f,TempSize*0.1f,VisualProgressBar);
  1245.         }
  1246.         C.DrawColor.A = 192;
  1247.         TempLevel = SV.static.PreDrawPerk(C, byte(TempLevel), TempMaterial, TempStarMaterial);
  1248.         HudLVL = byte(KFPlayerReplicationInfo(PawnOwnerPRI).ClientVeteranSkillLevel);
  1249.         C.SetPos(TempX + (VetStarSize * float(6)), TempY + (3.0 * VetStarSize));
  1250.         C.FontScaleX = 1.50;
  1251.         C.FontScaleY = 1.50;
  1252.         C.DrawText(string(HudLVL));
  1253.         C.FontScaleX = 1.0;
  1254.         C.FontScaleY = 1.0;
  1255.         C.SetPos(TempX, TempY);
  1256.         C.DrawTile(TempMaterial, TempSize, TempSize, 0.0, 0.0, float(TempMaterial.MaterialUSize()), float(TempMaterial.MaterialVSize()));
  1257.         TempX += (TempSize - VetStarSize);
  1258.         TempY += (TempSize - (2.0 * VetStarSize));
  1259.     }
  1260.     // End:0x11BD
  1261.     if((Level.TimeSeconds - LastVoiceGainTime) < 0.3330)
  1262.     {
  1263.         // End:0x11AF
  1264.         if(((!bUsingVOIP && PlayerOwner != none) && PlayerOwner.ActiveRoom != none) && PlayerOwner.ActiveRoom.GetTitle() == "Team")
  1265.         {
  1266.             bUsingVOIP = true;
  1267.             PlayerOwner.NotifySpeakingInTeamChannel();
  1268.         }
  1269.         DisplayVoiceGain(C);
  1270.     }
  1271.     // End:0x11C5
  1272.     else
  1273.     {
  1274.         bUsingVOIP = false;
  1275.     }
  1276.     // End:0x11E4
  1277.     if(bDisplayInventory || bInventoryFadingOut)
  1278.     {
  1279.         DrawInventory(C);
  1280.     }
  1281.  
  1282. /*
  1283.     if(KFPCServ(PlayerOwner).bEnableCrosshair)
  1284.     {
  1285.         C.Style = ERenderStyle.STY_Alpha;
  1286.         C.SetDrawColor(255, 255, 255, 200);
  1287.         C.SetPos(float(int(C.ClipX - float(CrosshairTexture.MaterialUSize())) >> 1), float(int(C.ClipY - float(CrosshairTexture.MaterialVSize())) >> 1));
  1288.         C.DrawTileScaled(CrosshairTexture, 1.0, 1.0);
  1289.     }
  1290. */
  1291. }
  1292.  
  1293. simulated final function RenderFlash( canvas Canvas )
  1294. {
  1295.     if( PlayerOwner==None || PlayerOwner.FlashScale.X==0 || PlayerOwner.FlashFog==vect(0,0,0) )
  1296.         Return;
  1297.     Canvas.DrawColor.R = Min(Abs(PlayerOwner.FlashFog.X*PlayerOwner.FlashScale.X)*255,255);
  1298.     Canvas.DrawColor.G = Min(Abs(PlayerOwner.FlashFog.Y*PlayerOwner.FlashScale.X)*255,255);
  1299.     Canvas.DrawColor.B = Min(Abs(PlayerOwner.FlashFog.Z*PlayerOwner.FlashScale.X)*255,255);
  1300.     Canvas.DrawColor.A = 255;
  1301.     Canvas.Style = ERenderStyle.STY_Translucent;
  1302.     Canvas.SetPos(0,0);
  1303.     Canvas.DrawTile(Texture'engine.WhiteSquareTexture', Canvas.ClipX, Canvas.ClipY, 0, 0, 1, 1);
  1304.     Canvas.DrawColor = Canvas.Default.DrawColor;
  1305. }
  1306.  
  1307. // Draw Health Bars for damage opened doors.
  1308. function DrawDoorHealthBars(Canvas C)
  1309. {
  1310.     local KFDoorMover DamageDoor;
  1311.     local vector CameraLocation, CamDir, TargetLocation, HBScreenPos;
  1312.     local rotator CameraRotation;
  1313.     local name DoorTag;
  1314.     local int i;
  1315.  
  1316.     if( PawnOwner==None )
  1317.         return;
  1318.  
  1319.     if ( (Level.TimeSeconds>LastDoorBarHealthUpdate) || (Welder(PawnOwner.Weapon)!=none && PlayerOwner.bFire==1) )
  1320.     {
  1321.         DoorCache.Length = 0;
  1322.  
  1323.         foreach CollidingActors(class'KFDoorMover', DamageDoor, 300.00, PlayerOwner.CalcViewLocation)
  1324.         {
  1325.             if ( DamageDoor.WeldStrength<=0 )
  1326.                 continue;
  1327.  
  1328.             DoorCache[DoorCache.Length] = DamageDoor;
  1329.  
  1330.             C.GetCameraLocation(CameraLocation, CameraRotation);
  1331.             TargetLocation = DamageDoor.WeldIconLocation /*+ vect(0, 0, 1) * Height*/;
  1332.             TargetLocation.Z = CameraLocation.Z;
  1333.             CamDir  = vector(CameraRotation);
  1334.  
  1335.             if ( Normal(TargetLocation - CameraLocation) dot Normal(CamDir) >= 0.1 && DamageDoor.Tag != DoorTag && FastTrace(DamageDoor.WeldIconLocation - ((DoorCache[i].WeldIconLocation - CameraLocation) * 0.25), CameraLocation) )
  1336.             {
  1337.                 HBScreenPos = C.WorldToScreen(TargetLocation);
  1338.                 DrawDoorBar(C, HBScreenPos.X, HBScreenPos.Y, DamageDoor.WeldStrength / DamageDoor.MaxWeld, 255);
  1339.                 DoorTag = DamageDoor.Tag;
  1340.             }
  1341.         }
  1342.         LastDoorBarHealthUpdate = Level.TimeSeconds+0.2;
  1343.     }
  1344.     else
  1345.     {
  1346.         for ( i = 0; i < DoorCache.Length; i++ )
  1347.         {
  1348.             if ( DoorCache[i].WeldStrength<=0 )
  1349.                 continue;
  1350.             C.GetCameraLocation(CameraLocation, CameraRotation);
  1351.             TargetLocation = DoorCache[i].WeldIconLocation /*+ vect(0, 0, 1) * Height*/;
  1352.             TargetLocation.Z = CameraLocation.Z;
  1353.             CamDir  = vector(CameraRotation);
  1354.  
  1355.             if ( Normal(TargetLocation - CameraLocation) dot Normal(CamDir) >= 0.1 && DoorCache[i].Tag != DoorTag && FastTrace(DoorCache[i].WeldIconLocation - ((DoorCache[i].WeldIconLocation - CameraLocation) * 0.25), CameraLocation) )
  1356.             {
  1357.                 HBScreenPos = C.WorldToScreen(TargetLocation);
  1358.                 DrawDoorBar(C, HBScreenPos.X, HBScreenPos.Y, DoorCache[i].WeldStrength / DoorCache[i].MaxWeld, 255);
  1359.                 DoorTag = DoorCache[i].Tag;
  1360.             }
  1361.         }
  1362.     }
  1363. }
  1364.  
  1365. simulated function Tick( float Delta )
  1366. {
  1367.     if( ClientRep==None )
  1368.     {
  1369.         ClientRep = Class'ClientPerkRepLink'.Static.FindStats(PlayerOwner);
  1370.         if( ClientRep!=None )
  1371.             SmileyMsgs = ClientRep.SmileyTags;
  1372.     }
  1373.     if( ClientRep!=None && ClientRep.bBWZEDTime && OldDilation!=Level.TimeDilation )
  1374.     {
  1375.         OldDilation = Level.TimeDilation;
  1376.         if( OldDilation<0.5f )
  1377.         {
  1378.             DesiredBW = 1.f;
  1379.             bFadeBW = (bUseBloom || bUseMotionBlur);
  1380.         }
  1381.         else
  1382.         {
  1383.             DesiredBW = 0.f;
  1384.             bFadeBW = (bUseBloom || bUseMotionBlur);
  1385.         }
  1386.     }
  1387.     if( bDisplayingProgress )
  1388.     {
  1389.         bDisplayingProgress = false;
  1390.         if( VisualProgressBar<LevelProgressBar )
  1391.             VisualProgressBar = FMin(VisualProgressBar+Delta,LevelProgressBar);
  1392.         else if( VisualProgressBar>LevelProgressBar )
  1393.             VisualProgressBar = FMax(VisualProgressBar-Delta,LevelProgressBar);
  1394.     }
  1395.     if( bFadeBW )
  1396.     {
  1397.         if( CurrentBW>DesiredBW )
  1398.             CurrentBW = FMax(CurrentBW-Delta*2.f,DesiredBW);
  1399.         else if( CurrentBW<DesiredBW )
  1400.             CurrentBW = FMin(CurrentBW+Delta*2.f,DesiredBW);
  1401.  
  1402.         if( CurrentBW>0 )
  1403.         {
  1404.             KFPlayerController(PlayerOwner).postfxon(2);
  1405.             KFPlayerController(PlayerOwner).postfxbw(CurrentBW);
  1406.         }
  1407.         else KFPlayerController(PlayerOwner).postfxoff(2);
  1408.         if( CurrentBW==DesiredBW )
  1409.             bFadeBW = false;
  1410.     }
  1411.     Super.Tick(Delta);
  1412. }
  1413.  
  1414. final function DrawSelectionIcon( Canvas C, bool bSelected, KFWeapon I, float Width, float Height )
  1415. {
  1416.     local float RX,RY;
  1417.     local Material M;
  1418.  
  1419.     if( bSelected )
  1420.         M = I.SelectedHudImage;
  1421.     else M = I.HudImage;
  1422.  
  1423.     if( M!=None )
  1424.     {
  1425.         RX = C.CurX;
  1426.         RY = C.CurY;
  1427.         C.DrawTile(M, Width, Height, 0, 0, 256, 192);
  1428.         if( !bSelected )
  1429.             return;
  1430.         C.CurX = RX;
  1431.         C.CurY = RY;
  1432.     }
  1433.  
  1434.     if( !bSelected )
  1435.     {
  1436.         C.DrawColor.G = 128;
  1437.         C.DrawColor.B = 128;
  1438.     }
  1439.     RX = C.ClipX;
  1440.     RY = C.ClipY;
  1441.     C.OrgX = C.CurX;
  1442.     C.CurX = 0;
  1443.     C.ClipX = Width;
  1444.     C.ClipY = C.CurY+Height;
  1445.     C.DrawText(I.ItemName,false);
  1446.     C.OrgX = 0;
  1447.     C.ClipX = RX;
  1448.     C.ClipY = RY;
  1449.     if( !bSelected )
  1450.     {
  1451.         C.DrawColor.G = 255;
  1452.         C.DrawColor.B = 255;
  1453.     }
  1454. }
  1455. function DrawInventory(Canvas C)
  1456. {
  1457.     local Inventory CurInv;
  1458.     local int i, Categorized[5], Num[5], X, Y, TempX, TempY, TempWidth, TempHeight, TempBorder, StartY;
  1459.  
  1460.     if( PawnOwner == none )
  1461.     {
  1462.         return;
  1463.     }
  1464.  
  1465.     if ( bInventoryFadingIn )
  1466.     {
  1467.         if ( Level.TimeSeconds < InventoryFadeStartTime + InventoryFadeTime )
  1468.         {
  1469.             C.SetDrawColor(255, 255, 255, byte(((Level.TimeSeconds - InventoryFadeStartTime) / InventoryFadeTime) * 255.0));
  1470.         }
  1471.         else
  1472.         {
  1473.             bInventoryFadingIn = false;
  1474.             C.SetDrawColor(255, 255, 255, 255);
  1475.         }
  1476.     }
  1477.     else if ( bInventoryFadingOut )
  1478.     {
  1479.         if ( Level.TimeSeconds < InventoryFadeStartTime + InventoryFadeTime )
  1480.         {
  1481.             C.SetDrawColor(255, 255, 255, byte((1.0 - ((Level.TimeSeconds - InventoryFadeStartTime) / InventoryFadeTime)) * 255.0));
  1482.         }
  1483.         else
  1484.         {
  1485.             bInventoryFadingOut = false;
  1486.             return;
  1487.         }
  1488.     }
  1489.     else
  1490.     {
  1491.         C.SetDrawColor(255, 255, 255, 255);
  1492.     }
  1493.  
  1494.     TempX = InventoryX * C.ClipX;
  1495.     TempY = InventoryY * C.ClipY;
  1496.     TempWidth = InventoryBoxWidth * C.ClipX;
  1497.     TempHeight = InventoryBoxHeight * C.ClipX;
  1498.     TempBorder = BorderSize * C.ClipX;
  1499.     C.Font = GetFontSizeIndex(C, -3);
  1500.     SelectedInventoryCategory = -1;
  1501.  
  1502.     // First count the weapons
  1503.     for ( CurInv = PawnOwner.Inventory; CurInv != none; CurInv = CurInv.Inventory )
  1504.     {
  1505.         // Don't allow non-categorized or Grenades
  1506.         if ( CurInv.InventoryGroup>0 && CurInv.InventoryGroup<=ArrayCount(Categorized) && KFWeapon(CurInv)!=None )
  1507.         {
  1508.             if( CurInv==SelectedInventory ) // Make sure index is in sync (could have desynced)
  1509.             {
  1510.                 SelectedInventoryCategory = CurInv.InventoryGroup-1;
  1511.                 SelectedInventoryIndex = Categorized[SelectedInventoryCategory];
  1512.             }
  1513.             ++Categorized[CurInv.InventoryGroup-1];
  1514.         }
  1515.     }
  1516.    
  1517.     // Check if current selected weapon goes off screen.
  1518.     if( SelectedInventoryCategory!=-1 && (TempY+Categorized[SelectedInventoryCategory]*TempHeight)>=C.ClipY )
  1519.     {
  1520.         // Adjust offset based on current selected weapon.
  1521.         Y = SelectedInventoryIndex*TempHeight;
  1522.         X = (C.ClipY-TempY)/2;
  1523.         if( Y>X )
  1524.             StartY = X-Y;
  1525.     }
  1526.    
  1527.     // Now draw weapons.
  1528.     for ( CurInv = PawnOwner.Inventory; CurInv != none; CurInv = CurInv.Inventory )
  1529.     {
  1530.         // Don't allow non-categorized or Grenades
  1531.         if ( CurInv.InventoryGroup>0 && CurInv.InventoryGroup<=ArrayCount(Categorized) && KFWeapon(CurInv)!=None )
  1532.         {
  1533.             i = CurInv.InventoryGroup - 1;
  1534.             X = TempX+(TempWidth*i);
  1535.             Y = TempY+(Num[i]*TempHeight);
  1536.             if( i==SelectedInventoryCategory )
  1537.                 Y+=StartY;
  1538.  
  1539.             // Draw this item's Background
  1540.             C.SetPos(X, Y);
  1541.             if ( CurInv==SelectedInventory )
  1542.                 C.DrawTileStretched(SelectedInventoryBackgroundTexture, TempWidth, TempHeight);
  1543.             else C.DrawTileStretched(InventoryBackgroundTexture, TempWidth, TempHeight);
  1544.  
  1545.             // Draw the Weapon's Icon over the Background
  1546.             C.SetPos(X + TempBorder, Y + TempBorder);
  1547.             DrawSelectionIcon(C,CurInv==SelectedInventory,KFWeapon(CurInv),TempWidth - (2.0 * TempBorder),TempHeight - (2.0 * TempBorder));
  1548.             ++Num[i];
  1549.         }
  1550.     }
  1551.  
  1552.     // Draw empty categories boxes.
  1553.     for ( i=0; i<ArrayCount(Categorized); i++ )
  1554.     {
  1555.         if ( Categorized[i]==0 )
  1556.         {
  1557.             C.SetPos(TempX+(TempWidth*i), TempY);
  1558.             C.DrawTileStretched(InventoryBackgroundTexture, TempWidth, TempHeight * 0.25);
  1559.         }
  1560.     }
  1561. }
  1562. function PrevWeapon()
  1563. {
  1564.     local Inventory CurInv;
  1565.     local int Categorized[5], Num;
  1566. //  local byte Tries;
  1567.  
  1568.     if ( PawnOwner==none || PawnOwner.Inventory==None || !ShowInventory() )
  1569.         return;
  1570.  
  1571. //  while( ++Tries<3 )
  1572. //  {
  1573.         SelectedInventoryCategory = -1;
  1574.         SelectedInventoryIndex = 0;
  1575.  
  1576.         // First pass, gather weapon counts.
  1577.         for ( CurInv = PawnOwner.Inventory; CurInv != none; CurInv = CurInv.Inventory )
  1578.         {
  1579.             // Don't allow non-categorized or Grenades
  1580.             if ( CurInv.InventoryGroup>0 && CurInv.InventoryGroup<=ArrayCount(Categorized) && KFWeapon(CurInv)!=None )
  1581.             {
  1582.                 if ( CurInv==SelectedInventory )
  1583.                 {
  1584.                     SelectedInventoryCategory = CurInv.InventoryGroup - 1;
  1585.                     SelectedInventoryIndex = Categorized[SelectedInventoryCategory];
  1586.                 }
  1587.                 ++Num;
  1588.                 ++Categorized[CurInv.InventoryGroup - 1];
  1589.             }
  1590.         }
  1591.  
  1592.         if( Num<=1 )
  1593.             return; // Prevent runaway loop.
  1594.  
  1595.         // Now check for suitable prev index.
  1596.         // Find next available category.
  1597.         if( SelectedInventoryIndex==0 )
  1598.         {
  1599.             while( true )
  1600.             {
  1601.                 if( --SelectedInventoryCategory<0 )
  1602.                     SelectedInventoryCategory = ArrayCount(Categorized)-1;
  1603.  
  1604.                 if( Categorized[SelectedInventoryCategory]>0 )
  1605.                     break;
  1606.             }
  1607.             SelectedInventoryIndex = Categorized[SelectedInventoryCategory]-1;
  1608.         }
  1609.         else --SelectedInventoryIndex; // Simply go to previous index.
  1610.  
  1611.         // Second pass, find our desired item.
  1612.         Num = 0;
  1613.         for ( CurInv = PawnOwner.Inventory; CurInv != none; CurInv = CurInv.Inventory )
  1614.         {
  1615.             if ( CurInv.InventoryGroup==(SelectedInventoryCategory+1) && KFWeapon(CurInv)!=None && (Num++)==SelectedInventoryIndex )
  1616.             {
  1617.                 SelectedInventory = CurInv;
  1618.                 break;
  1619.             }
  1620.         }
  1621. //      if( PawnOwner.Weapon!=SelectedInventory ) // Make sure not reselecting current weapon.
  1622. //          break;
  1623. //  }
  1624. }
  1625. function NextWeapon()
  1626. {
  1627.     local Inventory CurInv;
  1628.     local int Categorized[5], Num;
  1629. //  local byte Tries;
  1630.  
  1631.     if ( PawnOwner==none || PawnOwner.Inventory==None || !ShowInventory() )
  1632.         return;
  1633.  
  1634. //  while( ++Tries<3 )
  1635. //  {
  1636.         SelectedInventoryCategory = -1;
  1637.         SelectedInventoryIndex = 0;
  1638.  
  1639.         // First pass, gather weapon counts.
  1640.         for ( CurInv = PawnOwner.Inventory; CurInv != none; CurInv = CurInv.Inventory )
  1641.         {
  1642.             // Don't allow non-categorized or Grenades
  1643.             if ( CurInv.InventoryGroup>0 && CurInv.InventoryGroup<=ArrayCount(Categorized) && KFWeapon(CurInv)!=None )
  1644.             {
  1645.                 if ( CurInv==SelectedInventory )
  1646.                 {
  1647.                     SelectedInventoryCategory = CurInv.InventoryGroup - 1;
  1648.                     SelectedInventoryIndex = Categorized[SelectedInventoryCategory];
  1649.                 }
  1650.                 ++Num;
  1651.                 ++Categorized[CurInv.InventoryGroup - 1];
  1652.             }
  1653.         }
  1654.  
  1655.         if( Num<=1 )
  1656.             return; // Prevent runaway loop.
  1657.  
  1658.         // Now check for suitable next index.
  1659.         // Find next available category.
  1660.         if( SelectedInventoryCategory==-1 || SelectedInventoryIndex==(Categorized[SelectedInventoryCategory]-1) )
  1661.         {
  1662.             while( true )
  1663.             {
  1664.                 if( ++SelectedInventoryCategory>=ArrayCount(Categorized) )
  1665.                     SelectedInventoryCategory = 0;
  1666.  
  1667.                 if( Categorized[SelectedInventoryCategory]>0 )
  1668.                     break;
  1669.             }
  1670.             SelectedInventoryIndex = 0;
  1671.         }
  1672.         else ++SelectedInventoryIndex; // Simply go to next index.
  1673.  
  1674.         // Second pass, find our desired item.
  1675.         Num = 0;
  1676.         for ( CurInv = PawnOwner.Inventory; CurInv != none; CurInv = CurInv.Inventory )
  1677.         {
  1678.             if ( CurInv.InventoryGroup==(SelectedInventoryCategory+1) && KFWeapon(CurInv)!=None && (Num++)==SelectedInventoryIndex )
  1679.             {
  1680.                 SelectedInventory = CurInv;
  1681.                 break;
  1682.             }
  1683.         }
  1684. //      if( PawnOwner.Weapon!=SelectedInventory ) // Make sure not reselecting current weapon.
  1685. //          break;
  1686. //  }
  1687. }
  1688. function HideInventory()
  1689. {
  1690.     if( bDisplayInventory )
  1691.         Super.HideInventory();
  1692. }
  1693.  
  1694. simulated final function DrawPortraitX( Canvas C )
  1695. {
  1696.     local float PortraitWidth, PortraitHeight, XL, YL;
  1697.     local int Abbrev;
  1698.  
  1699.     PortraitWidth = 0.125 * C.ClipY;
  1700.     PortraitHeight = 1.5 * PortraitWidth;
  1701.     C.DrawColor = WhiteColor;
  1702.  
  1703.     C.SetPos(-PortraitWidth * PortraitX + 0.025 * PortraitWidth, 0.5 * (C.ClipY - PortraitHeight) + 0.025 * PortraitHeight);
  1704.     C.DrawTile(Portrait, PortraitWidth, PortraitHeight, 0, 0, Portrait.MaterialUSize(), Portrait.MaterialVSize() * 0.75f);
  1705.  
  1706.     C.SetPos(-PortraitWidth * PortraitX, 0.5 * (C.ClipY - PortraitHeight));
  1707.     C.Font = GetFontSizeIndex(C, -2);
  1708.  
  1709.     C.DrawColor = C.static.MakeColor(160, 160, 160);
  1710.     C.SetPos(-PortraitWidth * PortraitX + 0.025 * PortraitWidth, 0.5 * (C.ClipY - PortraitHeight) + 0.025 * PortraitHeight);
  1711.     C.DrawTile( Material'kf_fx_trip_t.Misc.KFModuNoise', PortraitWidth, PortraitHeight, 0.0, 0.0, 512, 512 );
  1712.  
  1713.     C.DrawColor = WhiteColor;
  1714.     C.SetPos(-PortraitWidth * PortraitX, 0.5 * (C.ClipY - PortraitHeight));
  1715.     C.DrawTileStretched(texture'InterfaceContent.Menu.BorderBoxA1', 1.05 * PortraitWidth, 1.05 * PortraitHeight);
  1716.  
  1717.     if ( PortraitPRI != None )
  1718.     {
  1719.         if ( PortraitPRI.Team != None )
  1720.         {
  1721.             if ( PortraitPRI.Team.TeamIndex == 0 )
  1722.                 C.DrawColor = RedColor;
  1723.             else C.DrawColor = TurqColor;
  1724.         }
  1725.  
  1726.         Class'SRScoreBoard'.Static.TextSizeCountry(C,PortraitPRI,XL,YL);
  1727.         if ( XL > PortraitWidth )
  1728.         {
  1729.             C.Font = GetFontSizeIndex(C, -4);
  1730.             Class'SRScoreBoard'.Static.TextSizeCountry(C,PortraitPRI,XL,YL);
  1731.  
  1732.             if ( XL > PortraitWidth )
  1733.             {
  1734.                 XL = float(Len(PortraitPRI.PlayerName)) * PortraitWidth / XL;
  1735.                 Abbrev = XL;
  1736.                 XL = PortraitWidth;
  1737.             }
  1738.         }
  1739.         Class'SRScoreBoard'.Static.DrawCountryName(C,PortraitPRI,C.ClipY / 256 - PortraitWidth * PortraitX + 0.5 * (PortraitWidth - XL), 0.5 * (C.ClipY + PortraitHeight) + 0.06 * PortraitHeight,Abbrev);
  1740.     }
  1741.     else if ( Portrait == TraderPortrait )
  1742.     {
  1743.         C.DrawColor = RedColor;
  1744.         C.TextSize(TraderString, XL, YL);
  1745.         C.SetPos(C.ClipY / 256 - PortraitWidth * PortraitX + 0.5 * (PortraitWidth - XL), 0.5 * (C.ClipY + PortraitHeight) + 0.06 * PortraitHeight);
  1746.         C.DrawTextClipped(TraderString,true);
  1747.     }
  1748. }
  1749.  
  1750. function DisplayMessages(Canvas C)
  1751. {
  1752.     local int i, j, XPos, YPos,MessageCount;
  1753.     local float XL, YL, XXL, YYL;
  1754.  
  1755.     for( i = 0; i < ConsoleMessageCount; i++ )
  1756.     {
  1757.         if ( TextMessages[i].Text == "" )
  1758.             break;
  1759.         else if( TextMessages[i].MessageLife < Level.TimeSeconds )
  1760.         {
  1761.             TextMessages[i].Text = "";
  1762.  
  1763.             if( i < ConsoleMessageCount - 1 )
  1764.             {
  1765.                 for( j=i; j<ConsoleMessageCount-1; j++ )
  1766.                     TextMessages[j] = TextMessages[j+1];
  1767.             }
  1768.             TextMessages[j].Text = "";
  1769.             break;
  1770.         }
  1771.         else
  1772.             MessageCount++;
  1773.     }
  1774.  
  1775.     YPos = (ConsoleMessagePosY * HudCanvasScale * C.SizeY) + (((1.0 - HudCanvasScale) / 2.0) * C.SizeY);
  1776.     if ( PlayerOwner == none || PlayerOwner.PlayerReplicationInfo == none || !PlayerOwner.PlayerReplicationInfo.bWaitingPlayer )
  1777.     {
  1778.         XPos = (ConsoleMessagePosX * HudCanvasScale * C.SizeX) + (((1.0 - HudCanvasScale) / 2.0) * C.SizeX);
  1779.     }
  1780.     else
  1781.     {
  1782.         XPos = (0.005 * HudCanvasScale * C.SizeX) + (((1.0 - HudCanvasScale) / 2.0) * C.SizeX);
  1783.     }
  1784.  
  1785.     C.Font = GetConsoleFont(C);
  1786.     C.DrawColor = LevelActionFontColor;
  1787.  
  1788.     C.TextSize ("A", XL, YL);
  1789.  
  1790.     YPos -= YL * MessageCount+1; // DP_LowerLeft
  1791.     YPos -= YL; // Room for typing prompt
  1792.  
  1793.     for( i=0; i<MessageCount; i++ )
  1794.     {
  1795.         if ( TextMessages[i].Text == "" )
  1796.             break;
  1797.  
  1798.         C.SetPos( XPos, YPos );
  1799.         C.DrawColor = TextMessages[i].TextColor;
  1800.         YYL = 0;
  1801.         XXL = 0;
  1802.         if( TextMessages[i].PRI!=None )
  1803.         {
  1804.             XL = Class'SRScoreBoard'.Static.DrawCountryName(C,TextMessages[i].PRI,XPos,YPos);
  1805.             C.SetPos( XPos+XL, YPos );
  1806.         }
  1807.         if( SmileyMsgs.Length!=0 )
  1808.             DrawSmileyText(TextMessages[i].Text,C,,YYL);
  1809.         else C.DrawText(TextMessages[i].Text,false);
  1810.         YPos += (YL+YYL);
  1811.     }
  1812. }
  1813. function AddTextMessage(string M, class<LocalMessage> MessageClass, PlayerReplicationInfo PRI)
  1814. {
  1815.     local int i;
  1816.  
  1817.     if( bMessageBeep && MessageClass.Default.bBeep )
  1818.         PlayerOwner.PlayBeepSound();
  1819.  
  1820.     for( i=0; i<ConsoleMessageCount; i++ )
  1821.     {
  1822.         if ( TextMessages[i].Text == "" )
  1823.             break;
  1824.     }
  1825.     if( i == ConsoleMessageCount )
  1826.     {
  1827.         for( i=0; i<ConsoleMessageCount-1; i++ )
  1828.             TextMessages[i] = TextMessages[i+1];
  1829.     }
  1830.     TextMessages[i].Text = M;
  1831.     TextMessages[i].MessageLife = Level.TimeSeconds + MessageClass.Default.LifeTime;
  1832.     TextMessages[i].TextColor = MessageClass.static.GetConsoleColor(PRI);
  1833.     if( MessageClass==class'SayMessagePlus' || MessageClass==class'TeamSayMessagePlus' )
  1834.         TextMessages[i].PRI = PRI;
  1835.     else TextMessages[i].PRI = None;
  1836. }
  1837. simulated function Message(PlayerReplicationInfo PRI, coerce string Msg, name MsgType)
  1838. {
  1839.     local Class<LocalMessage> LocalMessage${1}< ${3} >
  1840.  
  1841.     if ( PRI != None && MsgType == 'Say' || MsgType == 'TeamSay' )
  1842.     {
  1843.         DisplayPortrait(PRI);
  1844.     }
  1845.  
  1846.     switch( MsgType )
  1847.     {
  1848.         case 'Trader':
  1849.             Msg = TraderString$":" @ Msg;
  1850.             LocalMessageClass = class'SayMessagePlus';
  1851.             PRI = None;
  1852.             break;
  1853.         case 'Voice':
  1854.         case 'Say':
  1855.             if ( PRI == None )
  1856.                 return;
  1857.             Msg = ": " $ Msg;
  1858.             LocalMessageClass = class'SayMessagePlus';
  1859.             break;
  1860.         case 'TeamSay':
  1861.             if ( PRI == None )
  1862.                 return;
  1863.             Msg = " (" $ PRI.GetLocationName() $ "): " $ Msg;
  1864.             LocalMessageClass = class'TeamSayMessagePlus';
  1865.             break;
  1866.         case 'CriticalEvent':
  1867.             LocalMessageClass = class'KFCriticalEventPlus';
  1868.             LocalizedMessage(LocalMessageClass, 0, None, None, None, Msg);
  1869.             return;
  1870.         case 'DeathMessage':
  1871.             LocalMessageClass = class'xDeathMessage';
  1872.             break;
  1873.         case 'Msg_CashReward':
  1874.             LocalMessageClass = class'Msg_CashReward';
  1875.             break;
  1876.         default:
  1877.             LocalMessageClass = class'StringMessagePlus';
  1878.             break;
  1879.     }
  1880.     AddTextMessage(Msg, LocalMessageClass, PRI);
  1881. }
  1882.  
  1883. simulated final function DrawSmileyText( string S, canvas C, optional out float XXL, optional out float XYL )
  1884. {
  1885.     local int i,n;
  1886.     local float PX,PY,XL,YL,CurX,CurY,SScale,Sca,AdditionalY,NewAY;
  1887.     local string D;
  1888.     local color OrgC;
  1889.  
  1890.     // Initilize
  1891.     C.TextSize("T",XL,YL);
  1892.     SScale = YL;
  1893.     PX = C.CurX;
  1894.     PY = C.CurY;
  1895.     CurX = PX;
  1896.     CurY = PY;
  1897.     OrgC = C.DrawColor;
  1898.  
  1899.     // Search for smiles in text
  1900.     i = FindNextSmile(S,n);
  1901.     While( i!=-1 )
  1902.     {
  1903.         D = Left(S,i);
  1904.         S = Mid(S,i+Len(SmileyMsgs[n].SmileyTag));
  1905.         // Draw text behind
  1906.         C.SetPos(CurX,CurY);
  1907.         C.DrawText(D);
  1908.         // Draw smile
  1909.         C.StrLen(StripColorForTTS(D),XL,YL);
  1910.         CurX+=XL;
  1911.         While( CurX>C.ClipX )
  1912.         {
  1913.             CurY+=(YL+AdditionalY);
  1914.             XYL+=(YL+AdditionalY);
  1915.             AdditionalY = 0;
  1916.             CurX-=C.ClipX;
  1917.         }
  1918.         C.DrawColor = Default.WhiteColor;
  1919.         C.SetPos(CurX,CurY);
  1920.         if( SmileyMsgs[n].SmileyTex.USize==16 )
  1921.             Sca = SScale;
  1922.         else Sca = SmileyMsgs[n].SmileyTex.USize/32*SScale;
  1923.         C.DrawRect(SmileyMsgs[n].SmileyTex,Sca,Sca);
  1924.         if( Sca>SScale )
  1925.         {
  1926.             NewAY = (Sca-SScale);
  1927.             if( NewAY>AdditionalY )
  1928.                 AdditionalY = NewAY;
  1929.             NewAY = 0;
  1930.         }
  1931.         CurX+=Sca;
  1932.         While( CurX>C.ClipX )
  1933.         {
  1934.             CurY+=(YL+AdditionalY);
  1935.             XYL+=(YL+AdditionalY);
  1936.             AdditionalY = 0;
  1937.             CurX-=C.ClipX;
  1938.         }
  1939.         // Then go for next smile
  1940.         C.DrawColor = OrgC;
  1941.         i = FindNextSmile(S,n);
  1942.     }
  1943.     // Then draw rest of text remaining
  1944.     C.SetPos(CurX,CurY);
  1945.     C.StrLen(StripColorForTTS(S),XL,YL);
  1946.     C.DrawText(S);
  1947.     CurX+=XL;
  1948.     While( CurX>C.ClipX )
  1949.     {
  1950.         CurY+=(YL+AdditionalY);
  1951.         XYL+=(YL+AdditionalY);
  1952.         AdditionalY = 0;
  1953.         CurX-=C.ClipX;
  1954.     }
  1955.     XYL+=AdditionalY;
  1956.     AdditionalY = 0;
  1957.     XXL = CurX;
  1958.     C.SetPos(PX,PY);
  1959. }
  1960. simulated final function int FindNextSmile( string S, out int SmileNr )
  1961. {
  1962.     local int i,p,bp;
  1963.     local string CS;
  1964.  
  1965.     CS = Caps(S);
  1966.     bp = -1;
  1967.     for( i=(SmileyMsgs.Length-1); i>=0; --i )
  1968.     {
  1969.         if( SmileyMsgs[i].bInCAPS )
  1970.             p = InStr(CS,SmileyMsgs[i].SmileyTag);
  1971.         else p = InStr(S,SmileyMsgs[i].SmileyTag);
  1972.         if( p!=-1 && (p<bp || bp==-1) )
  1973.         {
  1974.             bp = p;
  1975.             SmileNr = i;
  1976.         }
  1977.     }
  1978.     Return bp;
  1979. }
  1980. static final function string StripColorForTTS(string s) // Strip color codes.
  1981. {
  1982.     local int p;
  1983.  
  1984.     p = InStr(s,chr(27));
  1985.     while ( p>=0 )
  1986.     {
  1987.         s = left(s,p)$mid(S,p+4);
  1988.         p = InStr(s,Chr(27));
  1989.     }
  1990.     return s;
  1991. }
  1992.  
  1993. defaultproperties
  1994. {
  1995.     // CROSSHAIR TEXTURE
  1996.     Noob_Crosshair=Texture'Weps2.Throwing_KnifeV2_T.HL2Crosshair'
  1997.     DamagePopupFadeOutTime=1.50
  1998.     DamagePopupFont=4
  1999. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement