Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- simulated final function vector CalcDrawOffset()
- {
- local vector DrawOffset, WeaponBob;
- local Pawn PawnOwner;
- local byte WeaponFOVFix;
- local float WeaponFOVScaling;
- local float FOVAngle, FOVScale;
- local float ScreenWidth, ScreenHeight;
- PawnOwner = Pawn(Owner);
- if (PawnOwner != None)
- {
- if (bCalcDrawOffsetFOV)
- {
- WeaponFOVFix = class'PlayerPawn'.default.WeaponFOVFix;
- WeaponFOVScaling = FClamp(class'PlayerPawn'.default.WeaponFOVScaling, 0.0, 1.0);
- if (WeaponFOVFix == 0) // UT 436 method
- DrawOffset = ((0.9 / PawnOwner.FOVAngle * PlayerViewOffset) >> PawnOwner.ViewRotation);
- else if (WeaponFOVFix == 2 && WeaponFOVScaling == 0.0 || PlayerPawn(Owner) == none || Level.NetMode == NM_DedicatedServer)
- DrawOffset = (0.01 * PlayerViewOffset) >> PawnOwner.ViewRotation;
- else
- {
- // TODO: use a more reliable method to retrieve screen width and height
- ScreenWidth = PlayerPawn(Owner).Player.Console.FrameX;
- ScreenHeight = PlayerPawn(Owner).Player.Console.FrameY;
- if (WeaponFOVFix == 1)
- {
- FOVAngle = FClamp(PawnOwner.FOVAngle, 1.0, 179.0);
- FOVScale = ATan(Tan(FOVAngle / 360.0 * Pi) * ScreenHeight / FMax(ScreenWidth, 1.0) / 0.75) * 360.0 / Pi;
- FOVScale = FMin(FOVAngle, FMax(90.0, FOVScale));
- DrawOffset = ((0.9 / FOVScale * PlayerViewOffset) >> PawnOwner.ViewRotation);
- }
- else // mode 2
- {
- DrawOffset = 0.01 * PlayerViewOffset;
- FOVAngle = FClamp(PawnOwner.FOVAngle, 1.0, 179.0);
- FOVScale = FMin(1.0, 0.75 * ScreenWidth / (FMax(ScreenHeight, 1.0) * Tan(FOVAngle / 360 * Pi)));
- DrawOffset.X *= 1.0 - (1.0 - FOVScale) * WeaponFOVScaling;
- DrawOffset = DrawOffset >> PawnOwner.ViewRotation;
- }
- }
- }
- else
- DrawOffset = (0.01 * PlayerViewOffset) >> PawnOwner.ViewRotation;
- if ( (Level.NetMode == NM_DedicatedServer)
- || ((Level.NetMode == NM_ListenServer) && (Owner.RemoteRole == ROLE_AutonomousProxy)) )
- DrawOffset += (PawnOwner.BaseEyeHeight * vect(0,0,1));
- else
- {
- DrawOffset += (PawnOwner.EyeHeight * vect(0,0,1));
- WeaponBob = BobDamping * PawnOwner.WalkBob;
- WeaponBob.Z = (0.45 + 0.55 * BobDamping) * PawnOwner.WalkBob.Z;
- DrawOffset += WeaponBob;
- }
- }
- return DrawOffset;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement