Advertisement
Guest User

Untitled

a guest
Jun 24th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.00 KB | None | 0 0
  1. function Update(float Scale)
  2. {
  3. local Pawn P;
  4. local ASDisplayInfo d;
  5. local array<Actor> MyTeam;
  6. local array<Actor> Enemy;
  7. local ProjectBSPawn BSP;
  8. local float f;
  9. local vector V;
  10. local matrix M;
  11. local float MapScale;
  12.  
  13. local bool bIsRedIconType;
  14. local vector MapOffset;
  15. local PlayerController PC;
  16.  
  17. PC = GetPC();
  18.  
  19. Scale = 1.0/Scale;
  20.  
  21. if (PC.Pawn == None)
  22. {
  23. return;
  24. }
  25.  
  26. if (bNeedsUpdateData)
  27. UpdateData();
  28.  
  29. //player
  30. d.hasRotation = true;
  31. if (ProjectBSPlayerController(PC).bRotateMinimap)
  32. {
  33. d.Rotation = 0;
  34. PlayerIcon.SetDisplayInfo(d);
  35. d.Rotation = ((PC.Rotation.Yaw) & 65535) * (-360.0/65536.0);
  36. CompassIcon.SetDisplayInfo(d);
  37.  
  38. f = -((PC.Rotation.Yaw + 16384) & 65535) * (Pi/32768.0);
  39. IconMatrix.XPlane.X = cos(f) * Scale;
  40. IconMatrix.XPlane.Y = sin(f) * Scale;
  41. IconMatrix.YPlane.X = -sin(f) * Scale;
  42. IconMatrix.YPlane.Y = cos(f) * Scale;
  43. IconMatrix.WPlane.X = 0;
  44. IconMatrix.WPlane.Y = 0;
  45. IconMatrix.WPlane.Z = 0;
  46. IconMatrix.WPlane.W = 1;
  47. IconMatrix.WPlane = TransformVector(IconMatrix, -PC.Pawn.Location);
  48. }
  49. else
  50. {
  51. d.Rotation = 0;
  52. CompassIcon.SetDisplayInfo(d);
  53. d.Rotation = ((PC.Rotation.Yaw) & 65535) * (360.0/65536.0);
  54. PlayerIcon.SetDisplayInfo(d);
  55.  
  56. f = -Pi*0.5;
  57. IconMatrix.XPlane.X = 0;
  58. IconMatrix.XPlane.Y = -Scale;
  59. IconMatrix.YPlane.X = Scale;
  60. IconMatrix.YPlane.Y = 0;
  61. IconMatrix.WPlane.X = 0;
  62. IconMatrix.WPlane.Y = 0;
  63. IconMatrix.WPlane.Z = 0;
  64. IconMatrix.WPlane.W = 1;
  65. IconMatrix.WPlane = TransformVector(IconMatrix, -PC.Pawn.Location);
  66. }
  67. d.hasRotation = false;
  68.  
  69. // terrain
  70. if (MapInfo != none && MapInfo.MapTexture != none)
  71. {
  72. f -= Pi*0.5;
  73. MapScale = Hud.NormalZoomf/(2.0 * Hud.CurZoomf);
  74. M.XPlane.X = -cos(f) * MapScale;
  75. M.XPlane.Y = -sin(f) * MapScale;
  76. M.YPlane.X = sin(f) * MapScale;
  77. M.YPlane.Y = -cos(f) * MapScale;
  78. MapOffset.X = -MapTexSize*0.5f;
  79. MapOffset.Y = -MapTexSize*0.5f;
  80. M.WPlane.X = 0;
  81. M.WPlane.Y = 0;
  82. M.WPlane.Z = 0;
  83. M.WPlane.W = 1;
  84. M.WPlane = TransformVector(M, MapOffset);
  85. f = Pi*1.5-f;
  86. V = (MapInfo.MapCenter - PC.Pawn.Location) * MapTexSize/MapInfo.MapExtent;
  87. MapScale = (Hud.NormalZoomf/(2.0 * Hud.CurZoomf));
  88. M.WPlane.X += (V.X * cos(f) + V.Y * sin(f)) * MapScale;
  89. M.WPlane.Y += (V.Y * cos(f) - V.X * sin(f)) * MapScale;
  90. MapMC.SetDisplayMatrix(M);
  91. }
  92.  
  93. // other players
  94. foreach ThisWorld.AllPawns(class'Pawn', P)
  95. {
  96. if ( P.bHidden || (P.Health <=0) || P.IsInvisible() || (P.PlayerReplicationInfo == None) || (P == PC.Pawn))
  97. continue;
  98. BSP = ProjectBSPawn(P);
  99. if (BSP == None)
  100. continue;
  101. if (ThisWorld.GRI.OnSameTeam(PC, P))
  102. MyTeam.AddItem(P);
  103. else
  104. Enemy.AddItem(P);
  105. }
  106.  
  107. bIsRedIconType = (PC.PlayerReplicationInfo.Team == None) || (PC.PlayerReplicationInfo.Team.TeamIndex == 0);
  108.  
  109. UpdateIcons(Enemy, EnemyIcons, !bIsRedIconType);
  110. UpdateIcons(MyTeam, MyTeamIcons, bIsRedIconType);
  111.  
  112. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement