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 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;

View File

@ -450,44 +450,55 @@ function PlayFiring(){
if(!currentContext.bIsBursting)
FireCount ++;
}
// Handle setting new recoil
simulated function HandleRecoil(float Rec){
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){
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')){
if(bResetRecoil || nicePlayer.IsZedTimeActive() && class'NiceVeterancyTypes'.static.hasSkill(nicePlayer, class'NiceSkillEnforcerZEDBarrage'))
{
Rec = 0.0;
bResetRecoil = false;
}
kfWeap= KFWeapon(Weapon);
if (kfWeap.bAimingRifle) {
KFW= KFWeapon(Weapon);
if (KFW.bAimingRifle)
{
Rec *= 0.5;
}
if(nicePawn.stationaryTime > 0.0 && class'NiceVeterancyTypes'.static.hasSkill(nicePlayer, class'NiceSkillHeavyStablePosition')){
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){
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)
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){
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;
@ -497,7 +508,8 @@ simulated function HandleRecoil(float Rec){
NewRecoilRotation.Pitch += (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);
}
@ -507,13 +519,14 @@ simulated function HandleRecoil(float Rec){
NewRecoilRotation.Yaw += (Instigator.HealthMax / Instigator.Health * 5);
NewRecoilRotation *= Rec;
if(default.FireRate <= 0)
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;