Advertisement
Guest User

Engine.PlayerPawn

a guest
Jun 2nd, 2023
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Determines how weapons and their muzzle flash are placed and scaled when drawn in the first person view.
  2. // 0 - the weapon and its muzzle flash are placed and scaled like in UT 436.
  3. // > 0 - muzzle flash is adjusted by the viewport's aspect ratio and FOVAngle.
  4. // 1 - the weapon is placed like in UT 436, taking 4:3 FOV as the FOVAngle.
  5. // 2 - the weapon is placed at its default position or possibly shifted from such a position closer to the viewport
  6. //     depending on viewport's FOVAngle and WeaponFOVScaling.
  7. var globalconfig transient byte WeaponFOVFix;
  8.  
  9. // Determines how much the weapon is moved towards the viewport when using WeaponFOVFix == 2 with a large FOVAngle.
  10. // Min value is 0.0 which corresponds to the Unreal 1 method, max value is 1.0.
  11. var globalconfig transient float WeaponFOVScaling;
  12.  
  13.  
  14. exec function SetNarrowFOV(float FOV)
  15. {
  16.     local string CurrentRes;
  17.     local int i;
  18.     local float ScreenWidth, ScreenHeight;
  19.  
  20.     CurrentRes = ConsoleCommand("GetCurrentRes");
  21.     i = InStr(CurrentRes, "x");
  22.     if (i > 0)
  23.     {
  24.         ScreenWidth = int(Left(CurrentRes, i));
  25.         ScreenHeight = int(Mid(CurrentRes, i + 1));
  26.         if (ScreenWidth > 0 && ScreenHeight > 0)
  27.             SetDesiredFOV(Atan(Tan(FClamp(FOV, 1.0, 179.0) * Pi / 360.0) *
  28.                 FMax(1.0, 0.75 * ScreenWidth / ScreenHeight)) * 360.0 / Pi);
  29.     }
  30. }
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement