Advertisement
Guest User

Untitled

a guest
Jul 10th, 2012
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.88 KB | None | 0 0
  1. //=============================================================================
  2. // DynaMag.
  3. //=============================================================================
  4. class DynaMag expands AutoMag;
  5.  
  6. var rotator SlowRotation;
  7. var() float SlowFactor;
  8.  
  9. simulated event PreRender(Canvas C)
  10. {
  11. local int PlayerPitch, NewPitch;
  12.  
  13. SlowRotation.Yaw += (Pawn(Owner).ViewRotation-SlowRotation).Yaw*SlowFactor;
  14. SlowRotation.Yaw = FClamp(SlowRotation.Yaw, Pawn(Owner).ViewRotation.Yaw-4096, Pawn(Owner).ViewRotation.Yaw+4096);
  15.  
  16. PlayerPitch = Pawn(Owner).ViewRotation.Pitch;
  17. if(PlayerPitch > 18000)
  18. PlayerPitch = -(65536-PlayerPitch);
  19. NewPitch = SlowRotation.Pitch;
  20. NewPitch += (PlayerPitch - NewPitch)*SlowFactor;
  21. SlowRotation.Pitch = NewPitch;
  22. }
  23.  
  24. simulated event RenderOverlays(Canvas C)
  25. {
  26. local bool bPlayerOwner;
  27. local int Hand;
  28. local rotator NewRot;
  29.  
  30. if(bHideWeapon || (Owner == None))
  31. return;
  32.  
  33. if(PlayerPawn(Owner) != None) {
  34. bPlayerOwner = true;
  35. Hand = PlayerPawn(Owner).Handedness; }
  36. if((Level.NetMode == NM_Client) && bPlayerOwner && (Hand == 2))
  37. { bHideWeapon = true; return; }
  38. if ( !bPlayerOwner || (PlayerPawn(Owner).Player == None) )
  39. PlayerPawn(Owner).WalkBob = vect(0,0,0);
  40.  
  41. newRot = SlowRotation;
  42. SetLocation(Owner.Location + CalcWeaponOffset());
  43. if ( Hand == 0 ) newRot.Roll = -2 * Default.Rotation.Roll;
  44. else newRot.Roll = Default.Rotation.Roll * Hand;
  45. setRotation(newRot);
  46. C.DrawActor(self, false);
  47. }
  48.  
  49. simulated final function vector CalcWeaponOffset()
  50. {
  51. local vector DrawOffset, WeaponBob;
  52. local Pawn PawnOwner;
  53.  
  54. PawnOwner = Pawn(Owner);
  55. DrawOffset = ((0.01 * PlayerViewOffset) >> SlowRotation);
  56.  
  57. if ( (Level.NetMode == NM_DedicatedServer)
  58. || ((Level.NetMode == NM_ListenServer) && (Owner.RemoteRole == ROLE_AutonomousProxy)) )
  59. DrawOffset += (PawnOwner.BaseEyeHeight * vect(0,0,1));
  60. else
  61. {
  62. DrawOffset += (PawnOwner.EyeHeight * vect(0,0,1));
  63. WeaponBob = BobDamping * PawnOwner.WalkBob;
  64. WeaponBob.Z = (0.45 + 0.55 * BobDamping) * PawnOwner.WalkBob.Z;
  65. DrawOffset += WeaponBob;
  66. }
  67. return DrawOffset;
  68. }
  69.  
  70. function TraceFire( float Accuracy )
  71. {
  72. local vector HitLocation, HitNormal, StartTrace, EndTrace, X,Y,Z;
  73. local actor Other;
  74. local Pawn PawnOwner;
  75.  
  76. PawnOwner = Pawn(Owner);
  77.  
  78. Owner.MakeNoise(PawnOwner.SoundDampening);
  79. GetAxes(SlowRotation,X,Y,Z);
  80. StartTrace = Owner.Location + CalcWeaponOffset() + FireOffset.X * X + FireOffset.Y * Y + FireOffset.Z * Z;
  81. AdjustedAim = PawnOwner.AdjustAim(1000000, StartTrace, 2.75*AimError, False, False);
  82. EndTrace = StartTrace + Accuracy * (FRand() - 0.5 )* Y * 1000
  83. + Accuracy * (FRand() - 0.5 ) * Z * 1000;
  84. X = vector(AdjustedAim);
  85. EndTrace += (10000 * X);
  86. Other = PawnOwner.TraceShot(HitLocation,HitNormal,EndTrace,StartTrace);
  87. ProcessTraceHit(Other, HitLocation, HitNormal, X,Y,Z);
  88. }
  89.  
  90. defaultproperties
  91. {
  92. SlowFactor=0.300000
  93. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement