Zed fixes #16

Merged
dkanus merged 24 commits from :fpfix into master 2022-03-03 15:43:35 +03:00
2 changed files with 74 additions and 61 deletions
Showing only changes of commit 0ca633cad4 - Show all commits

View File

@ -63,14 +63,14 @@ function PostRender(Canvas C)
local NicePlayerController nicePlayer; local NicePlayerController nicePlayer;
local ScrnHUD scrnHUDInstance; local ScrnHUD scrnHUDInstance;
// TODO maybe use scrnhud? // TODO maybe use scrnhud?
local HUDKillingFloor kfHud; // local HUDKillingFloor kfHud;
local Texture barTexture; local Texture barTexture;
local int x, y, center, barWidth, offset; local int x, y, center, barWidth, offset;
local int missesWidth, missesHeight, missesSpace; local int missesWidth, missesHeight, missesSpace;
local int missesX, missesY; local int missesX, missesY;
local Vector CamPos, ViewDir; // local Vector CamPos, ViewDir;
local Rotator CamRot; // local Rotator CamRot;
local float OffsetX, BarLength, BarHeight, XL, YL, posY; // local float OffsetX, BarLength, BarHeight, XL, YL, posY;
if(C == none) return; if(C == none) return;
if(C.ViewPort == none) return; if(C.ViewPort == none) return;

View File

@ -450,70 +450,83 @@ function PlayFiring(){
if(!currentContext.bIsBursting) if(!currentContext.bIsBursting)
FireCount ++; 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; NewRecoilRotation.Yaw *= -1;
if(RecoilVelocityScale > 0){ if (RecoilVelocityScale > 0)
if(Weapon.Owner != none && Weapon.Owner.Physics == PHYS_Falling && {
Weapon.Owner.PhysicsVolume.Gravity.Z > class'PhysicsVolume'.default.Gravity.Z){ if (Weapon.Owner != none && Weapon.Owner.Physics == PHYS_Falling &&
AdjustedVelocity = Weapon.Owner.Velocity; Weapon.Owner.PhysicsVolume.Gravity.Z > class'PhysicsVolume'.default.Gravity.Z)
// Ignore Z velocity in low grav so we don't get massive recoil {
AdjustedVelocity.Z = 0; AdjustedVelocity = Weapon.Owner.Velocity;
AdjustedSpeed = VSize(AdjustedVelocity); // 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 // Reduce the falling recoil in low grav
NewRecoilRotation.Pitch += (AdjustedSpeed * RecoilVelocityScale * 0.5); NewRecoilRotation.Pitch += (AdjustedSpeed * RecoilVelocityScale * 0.5);
NewRecoilRotation.Yaw += (AdjustedSpeed * RecoilVelocityScale * 0.5); NewRecoilRotation.Yaw += (AdjustedSpeed * RecoilVelocityScale * 0.5);
} }
else{ else
NewRecoilRotation.Pitch += (VSize(Weapon.Owner.Velocity) * RecoilVelocityScale); {
NewRecoilRotation.Yaw += (VSize(Weapon.Owner.Velocity) * RecoilVelocityScale); NewRecoilRotation.Pitch += (VSize(Weapon.Owner.Velocity) * RecoilVelocityScale);
} NewRecoilRotation.Yaw += (VSize(Weapon.Owner.Velocity) * RecoilVelocityScale);
} }
}
NewRecoilRotation.Pitch += (Instigator.HealthMax / Instigator.Health * 5); NewRecoilRotation.Pitch += (Instigator.HealthMax / Instigator.Health * 5);
NewRecoilRotation.Yaw += (Instigator.HealthMax / Instigator.Health * 5); NewRecoilRotation.Yaw += (Instigator.HealthMax / Instigator.Health * 5);
NewRecoilRotation *= Rec; NewRecoilRotation *= Rec;
if(default.FireRate <= 0) if (default.FireRate <= 0)
nicePlayer.SetRecoil(NewRecoilRotation, RecoilRate); nicePlayer.SetRecoil(NewRecoilRotation, RecoilRate);
else else
nicePlayer.SetRecoil(NewRecoilRotation, RecoilRate * (FireRate / default.FireRate)); nicePlayer.SetRecoil(NewRecoilRotation, RecoilRate * (FireRate / default.FireRate));
} }
} }
} }
function DoFireEffect(){ function DoFireEffect(){
local bool bIsShotgunBullet, bForceComplexTraj; local bool bIsShotgunBullet, bForceComplexTraj;
local bool bPinpoint; local bool bPinpoint;