Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- simulated event RenderOverlays( canvas Canvas )
- {
- local rotator NewRot;
- local bool bPlayerOwner;
- local int Hand;
- local PlayerPawn PlayerOwner;
- local float FOVScale;
- local float RectWidth, RectHeight;
- if ( bHideWeapon || (Owner == None) )
- return;
- PlayerOwner = PlayerPawn(Owner);
- if ( PlayerOwner != None )
- {
- if ( PlayerOwner.DesiredFOV != PlayerOwner.DefaultFOV )
- return;
- bPlayerOwner = true;
- Hand = PlayerOwner.Handedness;
- if ( (Level.NetMode == NM_Client) && (Hand == 2) )
- {
- bHideWeapon = true;
- return;
- }
- }
- if ( !bPlayerOwner || (PlayerOwner.Player == None) )
- Pawn(Owner).WalkBob = vect(0,0,0);
- if ( (bMuzzleFlash > 0) && bDrawMuzzleFlash && Level.bHighDetailMode && (MFTexture != None) )
- {
- FOVScale = 1.0;
- RectWidth = Canvas.ClipX;
- if (class'PlayerPawn'.default.WeaponFOVFix > 0)
- {
- FOVScale /= Tan(FClamp(Canvas.Viewport.Actor.FOVAngle, 1.0, 179.0) / 360.0 * Pi);
- RectHeight = RectWidth * 0.75; // (RectWidth / RectHeight) must always be 4:3 for correct evaluations below
- }
- else
- RectHeight = Canvas.ClipY; // Using old UT 436 method
- MuzzleScale = Default.MuzzleScale * RectWidth/640.0 * FMin(1.0, FOVScale);
- if ( !bSetFlashTime )
- {
- bSetFlashTime = true;
- FlashTime = Level.TimeSeconds + FlashLength;
- }
- else if ( FlashTime < Level.TimeSeconds )
- bMuzzleFlash = 0;
- if ( bMuzzleFlash > 0 )
- {
- if ( Hand == 0 )
- Canvas.SetPos(
- Canvas.ClipX/2 - 0.5 * MuzzleScale * FlashS + RectWidth * (-0.2 * Default.FireOffset.Y * FlashO) * FOVScale,
- Canvas.ClipY/2 - 0.5 * MuzzleScale * FlashS + RectHeight * (FlashY + FlashC) * FOVScale);
- else
- Canvas.SetPos(
- Canvas.ClipX/2 - 0.5 * MuzzleScale * FlashS + RectWidth * (Hand * Default.FireOffset.Y * FlashO) * FOVScale,
- Canvas.ClipY/2 - 0.5 * MuzzleScale * FlashS + RectHeight * FlashY * FOVScale);
- Canvas.Style = 3;
- Canvas.DrawIcon(MFTexture, MuzzleScale);
- Canvas.Style = 1;
- }
- }
- else
- bSetFlashTime = false;
- SetLocation( Owner.Location + CalcDrawOffset() );
- NewRot = Pawn(Owner).ViewRotation;
- if ( Hand == 0 )
- newRot.Roll = -2 * Default.Rotation.Roll;
- else
- newRot.Roll = Default.Rotation.Roll * Hand;
- SetRotation(newRot);
- Canvas.DrawActor(self, false);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement