Advertisement
Guest User

Untitled

a guest
Jul 16th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.35 KB | None | 0 0
  1. // Trace hit for hovering over a mover
  2. function TimerProcessTraceHit(Actor Other, Vector HitLocation, Vector HitNormal, Vector X, Vector Y, Vector Z)
  3. {
  4. if ((Other != none) && (Other.IsA('Mover')) && VSize(Other.Location-Owner.Location) < 2000)
  5. {
  6. Spawn(class'MoverWallHitEffect',,, HitLocation+HitNormal*9, Rotator(HitNormal));
  7. Owner.PlaySound(SuccessSound, SLOT_None, Pawn(Owner).SoundDampening*3.0);
  8. }
  9. }
  10.  
  11. // Creates the overlay in the HUD that shows movers
  12. // Needs improvement, some movers don't render properly
  13. simulated function PostRender(canvas Canvas)
  14. {
  15. local Mover thisMover;
  16. local vector X, Y, Z, CamLoc, TargetDir, Dir, XY;
  17. local rotator CamRot;
  18. local Actor Camera;
  19. local float BaseBeaconScale, BeaconScale, Dist, DistScale;
  20. local float TanFOVx, TanFOVy;
  21. local float dx, dy, FontY;
  22. local string BeaconText;
  23.  
  24. Canvas.Style = ERenderStyle.STY_Masked;
  25.  
  26. if (Canvas.ClipX > 1024)
  27. Canvas.Font = Font'BeaconNameFontLarge';
  28. else if (Canvas.ClipX > 640)
  29. Canvas.Font = Font'BeaconNameFontMedium';
  30. else
  31. Canvas.Font = Font'BeaconNameFontSmall';
  32. Canvas.TextSize("X", dx, FontY);
  33. Canvas.SetPos(0,0.5 * Canvas.ClipY);
  34. Canvas.DrawText(" SCANNER INFORMATION", False);
  35. Canvas.SetPos(0,0.5 * Canvas.ClipY + 16);
  36. Canvas.DrawText(" Monsters Left: "$ Charge, False);
  37. Canvas.SetPos(0, 0);
  38. BaseBeaconScale = 1.5 * FontY / Texture'TeamBeacon2'.VSize;
  39.  
  40. Canvas.ViewPort.Actor.PlayerCalcView(Camera, CamLoc, CamRot);
  41.  
  42. TanFOVx = Tan(Canvas.ViewPort.Actor.FOVAngle / 114.591559);
  43. TanFOVy = (Canvas.ClipY / Canvas.ClipX) * TanFOVx;
  44. GetAxes(CamRot, X, Y, Z);
  45.  
  46. Canvas.bNoSmooth = False;
  47. Canvas.Style = ERenderStyle.STY_Masked;
  48.  
  49. //foreach RadiusActors(class 'Mover', thisMover, 7000)
  50. foreach Owner.RadiusActors(class 'Mover', thisMover, 7000,CamLoc)
  51. {
  52. if (thisMover != none && thisMover != Camera)
  53. {
  54. TargetDir = thisMover.Location - CamLoc;
  55. Dist = VSize(TargetDir) * FMin(TanFOVx, 1.0);
  56. TargetDir = Normal(TargetDir + vect(0,0,1)); // * thisMover.CollisionHeight);
  57. DistScale = FMin(100.0 * thisMover.CollisionRadius / Dist, 1.0);
  58. d = Dist;
  59.  
  60. if ((DistScale > 0.0 && TargetDir dot X > 0) && (FastTrace(thisMover.Location, CamLoc)
  61. || FastTrace(thisMover.Location + vect(0,0,0.8) * thisMover.CollisionHeight, CamLoc)))
  62. {
  63. BeaconScale = BaseBeaconScale * DistScale;
  64. Dir = X * (X dot TargetDir);
  65. XY = TargetDir - Dir;
  66.  
  67. dx = Canvas.ClipX * 0.5 * (1.0 + (XY dot Y) / (VSize(Dir) * TanFOVx));
  68. dy = Canvas.ClipY * 0.5 * (1.0 - (XY dot Z) / (VSize(Dir) * TanFOVy));
  69.  
  70. //Canvas.SetPos(dx - 0.5 * BeaconScale * TeamBeaconIcon.USize, dy - 2 * FontY * DistScale);
  71. Canvas.SetPos(dx - 0.5 * BeaconScale, dy - 2 * FontY * DistScale);
  72.  
  73. if (DistScale <= 1.0)
  74. {
  75. if (Canvas.ClipX > 600)
  76. BeaconText = "Mover: " $ d $ "";
  77. Canvas.DrawIcon(texture'CrossHair6', 1.0);
  78. Canvas.SetPos(dx + 0.6 * BeaconScale * TeamBeaconIcon.USize + 1, dy - 1.75 * FontY + 1);
  79. Canvas.DrawTextClipped(BeaconText, False);
  80. }
  81. }
  82. }
  83. }
  84. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement