Guest User

Untitled

a guest
Jul 30th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class LTTGMouseInput extends PlayerInput;
  2.  
  3. var int DesiredZoom;
  4. var PrivateWrite IntPoint MousePosition; // Stored mouse position. Set to private write as we don't want other classes to modify it, but still allow other classes to access it.
  5.  
  6.  
  7. event PlayerInput(float DeltaTime)
  8. {
  9.          // Add the aMouseX & aMouseY to the mouse position and clamp it within the viewport width/height
  10.          MousePosition.X = Clamp(MousePosition.X + aMouseX, 0, myHUD.SizeX);
  11.          MousePosition.Y = Clamp(MousePosition.Y - aMouseY, 0, myHUD.SizeY);
  12.  
  13.          CamScroll();
  14.          SmoothZoom(DeltaTime);
  15.          super.PlayerInput(DeltaTime);
  16. }
  17.  
  18. /**********************************************************************
  19. **              Horizontal/Vertical Scroll Cam System                **
  20. **********************************************************************/
  21. function CamScroll()
  22. {
  23.     // SlowLimit/FastLimit = Scroll Activation from Margin Distance for Fast/Slow speed
  24.     // SlowScrollSpeed = Scroll Speed at SlowLimit  / FastScrollSpeed = Scroll Speed at FastLimit
  25.     local int SlowLimit, FastLimit, FastScrollSpeed, SlowScrollSpeed, ScrollLimitX, ScrollLimitY;
  26.     SlowLimit = 25;
  27.     FastLimit = 3;
  28.     SlowScrollSpeed = 20;
  29.     FastScrollSpeed = 50;
  30.     ScrollLimitX = 3000;
  31.     ScrollLimitY = 300;
  32.  
  33.     if ( (MousePosition.X < SlowLimit) && (MousePosition.X > FastLimit) && (LTTGCamera(PlayerCamera).CamY > -ScrollLimitY) )
  34.         LTTGCamera(PlayerCamera).CamY -= SlowScrollSpeed;
  35.     if ( (MousePosition.X <= FastLimit) && (LTTGCamera(PlayerCamera).CamY > -ScrollLimitY) )
  36.         LTTGCamera(PlayerCamera).CamY -= FastScrollSpeed;
  37.  
  38.     if ( (MousePosition.X > (myHUD.SizeX - SlowLimit)) &&  (MousePosition.X < (myHUD.SizeX - FastLimit) ) && (LTTGCamera(PlayerCamera).CamY < ScrollLimitY))
  39.         LTTGCamera(PlayerCamera).CamY += SlowScrollSpeed;
  40.     if ( (MousePosition.X >= (myHUD.SizeX - FastLimit)) && (LTTGCamera(PlayerCamera).CamY < ScrollLimitY) )
  41.         LTTGCamera(PlayerCamera).CamY += FastScrollSpeed;
  42.  
  43.     if ( (MousePosition.Y < SlowLimit) && (MousePosition.Y > FastLimit) && (LTTGCamera(PlayerCamera).CamX < ScrollLimitX) )
  44.         LTTGCamera(PlayerCamera).CamX += SlowScrollSpeed;
  45.     if ( (MousePosition.Y <= FastLimit) && (LTTGCamera(PlayerCamera).CamX < ScrollLimitX) )
  46.         LTTGCamera(PlayerCamera).CamX += FastScrollSpeed;
  47.  
  48.     if ( (MousePosition.Y > (myHUD.SizeY - SlowLimit)) &&  (MousePosition.Y < (myHUD.SizeX - FastLimit) ) && (LTTGCamera(PlayerCamera).CamX > -ScrollLimitX) )
  49.         LTTGCamera(PlayerCamera).CamX -= SlowScrollSpeed;
  50.     if ( MousePosition.Y >= (myHUD.SizeY - FastLimit) && (LTTGCamera(PlayerCamera).CamX > -ScrollLimitX) )
  51.         LTTGCamera(PlayerCamera).CamX -= FastScrollSpeed;
  52. }
  53.  
  54. /**********************************************************************
  55. **                Zoom in/out Camera System                          **
  56. **********************************************************************/
  57.  
  58.  
  59.  
  60. exec function IncreaseCamZ()
  61. {
  62.     if (DesiredZoom < 3000)
  63.         DesiredZoom += DesiredZoom * 1 / 10;
  64. }
  65.  
  66.  
  67. exec function DecreaseCamZ()
  68. {
  69.     if (DesiredZoom > 1000)
  70.         DesiredZoom -= DesiredZoom * 1 / 10;
  71. }
  72.  
  73.  
  74. function SmoothZoom(float DeltaTime)
  75. {
  76.     LTTGCamera(PlayerCamera).CamZ += (DesiredZoom - LTTGCamera(PlayerCamera).CamZ) * DeltaTime *2;
  77. }
  78.  
  79.  
  80.  
  81.  
  82. /***********************************************************
  83. ** default Properties                                     **
  84. ***********************************************************/
  85.  
  86. defaultproperties
  87. {
  88.     DesiredZoom = 1500;
  89. }
Add Comment
Please, Sign In to add comment