From 0ca633cad4c1317ac7a3aa66d90287749a6092c3 Mon Sep 17 00:00:00 2001 From: Shtoyan Date: Wed, 23 Feb 2022 22:06:29 +0400 Subject: [PATCH] compiler warning fixes --- sources/GUI/NiceInteraction.uc | 8 +-- sources/Weapons/NiceFire.uc | 127 ++++++++++++++++++--------------- 2 files changed, 74 insertions(+), 61 deletions(-) diff --git a/sources/GUI/NiceInteraction.uc b/sources/GUI/NiceInteraction.uc index 276a099..fc309bd 100644 --- a/sources/GUI/NiceInteraction.uc +++ b/sources/GUI/NiceInteraction.uc @@ -63,14 +63,14 @@ function PostRender(Canvas C) local NicePlayerController nicePlayer; local ScrnHUD scrnHUDInstance; // TODO maybe use scrnhud? - local HUDKillingFloor kfHud; + // local HUDKillingFloor kfHud; local Texture barTexture; local int x, y, center, barWidth, offset; local int missesWidth, missesHeight, missesSpace; local int missesX, missesY; - local Vector CamPos, ViewDir; - local Rotator CamRot; - local float OffsetX, BarLength, BarHeight, XL, YL, posY; + // local Vector CamPos, ViewDir; + // local Rotator CamRot; + // local float OffsetX, BarLength, BarHeight, XL, YL, posY; if(C == none) return; if(C.ViewPort == none) return; diff --git a/sources/Weapons/NiceFire.uc b/sources/Weapons/NiceFire.uc index b8fbbe8..19d96ae 100644 --- a/sources/Weapons/NiceFire.uc +++ b/sources/Weapons/NiceFire.uc @@ -450,70 +450,83 @@ function PlayFiring(){ if(!currentContext.bIsBursting) FireCount ++; } -// Handle setting new recoil -simulated function HandleRecoil(float Rec){ - local int stationarySeconds; - local rotator NewRecoilRotation; - local NicePlayerController nicePlayer; - local NiceHumanPawn nicePawn; - local vector AdjustedVelocity; - local float AdjustedSpeed; - local KFWeapon kfWeap; - if(Instigator != none){ - nicePlayer = NicePlayerController(Instigator.Controller); - nicePawn = NiceHumanPawn(Instigator); - } - if(nicePlayer == none || nicePawn == none) - return; - if(bResetRecoil || nicePlayer.IsZedTimeActive() && class'NiceVeterancyTypes'.static.hasSkill(nicePlayer, class'NiceSkillEnforcerZEDBarrage')){ - Rec = 0.0; - bResetRecoil = false; - } - kfWeap= KFWeapon(Weapon); - if (kfWeap.bAimingRifle) { - Rec *= 0.5; - } - if(nicePawn.stationaryTime > 0.0 && class'NiceVeterancyTypes'.static.hasSkill(nicePlayer, class'NiceSkillHeavyStablePosition')){ - stationarySeconds = Ceil(2 * nicePawn.stationaryTime) - 1; - Rec *= FMax(0.0, 1.0 - (stationarySeconds * class'NiceSkillHeavyStablePosition'.default.recoilDampeningBonus)); - } - if(!nicePlayer.bFreeCamera){ - if(Weapon.GetFireMode(ThisModeNum).bIsFiring || currentContext.bIsBursting){ - NewRecoilRotation.Pitch = RandRange(maxVerticalRecoilAngle * 0.5, maxVerticalRecoilAngle); - NewRecoilRotation.Yaw = RandRange(maxHorizontalRecoilAngle * 0.5, maxHorizontalRecoilAngle); - if(!bRecoilRightOnly && Rand(2) == 1) +// Handle setting new recoil +simulated function HandleRecoil(float Rec) +{ + local int stationarySeconds; + local rotator NewRecoilRotation; + local NicePlayerController nicePlayer; + local NiceHumanPawn nicePawn; + local vector AdjustedVelocity; + local float AdjustedSpeed; + local KFWeapon KFW; + + if(Instigator != none) + { + nicePlayer = NicePlayerController(Instigator.Controller); + nicePawn = NiceHumanPawn(Instigator); + } + if(nicePlayer == none || nicePawn == none) + return; + if(bResetRecoil || nicePlayer.IsZedTimeActive() && class'NiceVeterancyTypes'.static.hasSkill(nicePlayer, class'NiceSkillEnforcerZEDBarrage')) + { + Rec = 0.0; + bResetRecoil = false; + } + KFW= KFWeapon(Weapon); + if (KFW.bAimingRifle) + { + Rec *= 0.5; + } + if (nicePawn.stationaryTime > 0.0 && class'NiceVeterancyTypes'.static.hasSkill(nicePlayer, class'NiceSkillHeavyStablePosition')) + { + stationarySeconds = Ceil(2 * nicePawn.stationaryTime) - 1; + Rec *= FMax(0.0, 1.0 - (stationarySeconds * class'NiceSkillHeavyStablePosition'.default.recoilDampeningBonus)); + } + if (!nicePlayer.bFreeCamera) + { + if (Weapon.GetFireMode(ThisModeNum).bIsFiring || currentContext.bIsBursting) + { + NewRecoilRotation.Pitch = RandRange(maxVerticalRecoilAngle * 0.5, maxVerticalRecoilAngle); + NewRecoilRotation.Yaw = RandRange(maxHorizontalRecoilAngle * 0.5, maxHorizontalRecoilAngle); + + if (!bRecoilRightOnly && Rand(2) == 1) NewRecoilRotation.Yaw *= -1; - if(RecoilVelocityScale > 0){ - if(Weapon.Owner != none && Weapon.Owner.Physics == PHYS_Falling && - Weapon.Owner.PhysicsVolume.Gravity.Z > class'PhysicsVolume'.default.Gravity.Z){ - AdjustedVelocity = Weapon.Owner.Velocity; - // Ignore Z velocity in low grav so we don't get massive recoil - AdjustedVelocity.Z = 0; - AdjustedSpeed = VSize(AdjustedVelocity); + if (RecoilVelocityScale > 0) + { + if (Weapon.Owner != none && Weapon.Owner.Physics == PHYS_Falling && + Weapon.Owner.PhysicsVolume.Gravity.Z > class'PhysicsVolume'.default.Gravity.Z) + { + AdjustedVelocity = Weapon.Owner.Velocity; + // Ignore Z velocity in low grav so we don't get massive recoil + AdjustedVelocity.Z = 0; + AdjustedSpeed = VSize(AdjustedVelocity); - // Reduce the falling recoil in low grav - NewRecoilRotation.Pitch += (AdjustedSpeed * RecoilVelocityScale * 0.5); - NewRecoilRotation.Yaw += (AdjustedSpeed * RecoilVelocityScale * 0.5); - } - else{ - NewRecoilRotation.Pitch += (VSize(Weapon.Owner.Velocity) * RecoilVelocityScale); - NewRecoilRotation.Yaw += (VSize(Weapon.Owner.Velocity) * RecoilVelocityScale); - } - } + // Reduce the falling recoil in low grav + NewRecoilRotation.Pitch += (AdjustedSpeed * RecoilVelocityScale * 0.5); + NewRecoilRotation.Yaw += (AdjustedSpeed * RecoilVelocityScale * 0.5); + } + else + { + NewRecoilRotation.Pitch += (VSize(Weapon.Owner.Velocity) * RecoilVelocityScale); + NewRecoilRotation.Yaw += (VSize(Weapon.Owner.Velocity) * RecoilVelocityScale); + } + } - NewRecoilRotation.Pitch += (Instigator.HealthMax / Instigator.Health * 5); - NewRecoilRotation.Yaw += (Instigator.HealthMax / Instigator.Health * 5); - NewRecoilRotation *= Rec; + NewRecoilRotation.Pitch += (Instigator.HealthMax / Instigator.Health * 5); + NewRecoilRotation.Yaw += (Instigator.HealthMax / Instigator.Health * 5); + NewRecoilRotation *= Rec; - if(default.FireRate <= 0) - nicePlayer.SetRecoil(NewRecoilRotation, RecoilRate); - else - nicePlayer.SetRecoil(NewRecoilRotation, RecoilRate * (FireRate / default.FireRate)); - } - } + if (default.FireRate <= 0) + nicePlayer.SetRecoil(NewRecoilRotation, RecoilRate); + else + nicePlayer.SetRecoil(NewRecoilRotation, RecoilRate * (FireRate / default.FireRate)); + } + } } + function DoFireEffect(){ local bool bIsShotgunBullet, bForceComplexTraj; local bool bPinpoint;