Skip to content

Commit

Permalink
LCWeapons_0024 initial commit
Browse files Browse the repository at this point in the history
Fixed bug breaking LC sub-engine. (!!!)
Fixed a bug breaking client impact effects/decals on Level and movers.

Rewrote entire position cache system.
- Unified, all actors use the same XC_PosList holder type.
- Positions cached by timers (0.05) instead of ticks.

LC sub-engine:
- bNetTemporary or ROLE_SimulatedProxy projectiles use correct advancer latency.

ZP sub-engine:
- Player ducking validation less likely to give false negatives.
- ffCheckHit validator gives outputs some messages to clients.
  • Loading branch information
CacoFFF committed Dec 12, 2019
1 parent 6488348 commit a7f55ba
Show file tree
Hide file tree
Showing 11 changed files with 385 additions and 690 deletions.
80 changes: 0 additions & 80 deletions classes/LCMarkerTag.uc

This file was deleted.

2 changes: 1 addition & 1 deletion classes/LCMonsterSN.uc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var XC_LagCompensation Mutator;

event Actor SpawnNotification( actor A)
{
Mutator.AddGenericPos( A);
Mutator.SetupPosList( A);
return A;
}

Expand Down
2 changes: 1 addition & 1 deletion classes/LCMutator.uc
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ function bool IsRelevant( Actor Other, out byte bSuperRelevant)

if ( ScriptedPawn(Other) != None )
{
AddGenericPos( Other);
SetupPosList( Other );
return true;
}

Expand Down
10 changes: 8 additions & 2 deletions classes/LCProjSN.uc
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,16 @@ class LCProjSN expands SpawnNotify;

var XC_LagCompensation Mutator;

event Actor SpawnNotification( actor A)
event Actor SpawnNotification( Actor A)
{
local XC_PosList PosList;
if ( !A.bNetTemporary && A.bProjTarget && (A.CollisionHeight > 0) && (A.CollisionRadius > 0) )
Mutator.AddGenericPos( A).bPingHandicap = true;
{
PosList = Mutator.SetupPosList( A);
PosList.bPingHandicap = true;
if ( (Projectile(A).Damage != 0) && (A.bNetTemporary || A.RemoteRole == ROLE_SimulatedProxy) )
PosList.bClientAdvance = true;
}
return A;
}

Expand Down
52 changes: 35 additions & 17 deletions classes/LCStatics.uc
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
class LCStatics expands Object
abstract;

#exec OBJ LOAD FILE="LCPureUtil.u" PACKAGE=LCWeapons_0023
#exec OBJ LOAD FILE="SiegeUtil_A.u" PACKAGE=LCWeapons_0023
#exec OBJ LOAD FILE="TimerUtil.u" PACKAGE=LCWeapons_0023
#exec OBJ LOAD FILE="LCExtraFuncs.u" PACKAGE=LCWeapons_0023
#exec OBJ LOAD FILE="LCPureUtil.u" PACKAGE=LCWeapons_0024
#exec OBJ LOAD FILE="SiegeUtil_A.u" PACKAGE=LCWeapons_0024
#exec OBJ LOAD FILE="TimerUtil.u" PACKAGE=LCWeapons_0024
#exec OBJ LOAD FILE="LCExtraFuncs.u" PACKAGE=LCWeapons_0024

const MULTIPLIER = 0x015a4e35;
const INCREMENT = 1;
Expand Down Expand Up @@ -119,7 +119,7 @@ static final function ClientTraceFire( Weapon Weapon, XC_CompensatorChannel LCCh
static final function Actor ClientTraceShot( out vector HitLocation, out vector AdjustedHitLocation, out vector HitNormal, vector EndTrace, vector StartTrace, Pawn P)
{
local Actor A, HitActor;
local vector TmpHitLocation, TmpHitNormal;
local vector TmpHitLocation, TmpHitNormal, TmpAdjustedHitLocation;
local bool bCorrectHitLocation;

if ( P == None )
Expand All @@ -133,11 +133,12 @@ static final function Actor ClientTraceShot( out vector HitLocation, out vector
{
if ( HitActor == None )
{
TmpAdjustedHitLocation = TmpHitLocation;
if ( TraceStopper( A) )
HitActor = A;
else if ( Pawn(A) != None )
{
if ( (A != P) && AdjustHitLocationMod( Pawn(A), AdjustedHitLocation, EndTrace-StartTrace) )
if ( (A != P) && AdjustHitLocationMod( Pawn(A), TmpAdjustedHitLocation, EndTrace-StartTrace) )
HitActor = A;
}
else if ( A.bProjTarget || (A.bBlockActors && A.bBlockPlayers) )
Expand All @@ -148,14 +149,16 @@ static final function Actor ClientTraceShot( out vector HitLocation, out vector
bCorrectHitLocation = (HitActor != P.Level) && (HitActor.Brush == None) && !HitActor.IsA('StaticMeshActor');
HitLocation = TmpHitLocation;
HitNormal = TmpHitNormal;
AdjustedHitLocation = TmpHitLocation;
AdjustedHitLocation = TmpAdjustedHitLocation;
}
}

//Correct HitLocation by adding the missing 1/1000th part on Cylinder actors
if ( (A == P.Level) && bCorrectHitLocation )

if ( A == P.Level )
{
HitLocation += (TmpHitLocation - StartTrace) * 0.001;
//Correct HitLocation by adding the missing 1/1000th part on Cylinder actors
if ( bCorrectHitLocation )
HitLocation += (TmpHitLocation - StartTrace) * 0.001;
return HitActor;
}
}
Expand Down Expand Up @@ -230,13 +233,8 @@ static final function bool AdjustHitLocationMod( Pawn Other, out vector HitLocat
local bool bHit, bDumbProxy, bSimulatedProxy;

//See if EyeHeight should be modified (if not pre-modified by caller)
if ( (ForceEyeHeight == 0) && (Other.Mesh != None) && Other.HasAnim(Other.AnimSequence) )
{
if ( (Other.GetAnimGroup(Other.AnimSequence) == 'Ducking') && (Other.AnimFrame > -0.03) )
ForceEyeHeight = (Other.default.BaseEyeHeight+1) * 0.1;
else if ( InStr(string(Other.AnimSequence),"Dead") != -1 || InStr(string(Other.AnimSequence),"DeathEnd") != -1 )
ForceEyeHeight = (Other.default.BaseEyeHeight+1) * -0.1;
}
if ( ForceEyeHeight == 0 )
ForceEyeHeight = GetEyeHeight(Other);

//Modify eye height
OldEyeHeight = Other.EyeHeight;
Expand Down Expand Up @@ -268,6 +266,26 @@ static final function bool AdjustHitLocationMod( Pawn Other, out vector HitLocat
return bHit;
}

//***************************************
//Client-predictable eye height
//***************************************
static final function float GetEyeHeight( Pawn Other)
{
local float ForceEyeHeight;

if ( (Other.Mesh != None) && Other.HasAnim(Other.AnimSequence) )
{
if ( (Other.GetAnimGroup(Other.AnimSequence) == 'Ducking') && (Other.AnimFrame > -0.03) )
ForceEyeHeight = (Other.default.BaseEyeHeight+1) * 0.1;
else if ( InStr(string(Other.AnimSequence),"Dead") != -1 || InStr(string(Other.AnimSequence),"DeathEnd") != -1 )
ForceEyeHeight = (Other.default.BaseEyeHeight+1) * -0.1;
}
if ( ForceEyeHeight == 0 )
ForceEyeHeight = Other.default.BaseEyeHeight;

return ForceEyeHeight;
}


//*****************
//Swap two integers
Expand Down
4 changes: 2 additions & 2 deletions classes/XC_CompensatorChannel.uc
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ function ffSendHit

if ( !LCComp.ffClassifyShot(ffTime) ) //Time classification failure
return;

SavedShots[ffISaved].ffOther = ffOther;
SavedShots[ffISaved].Weap = Weap;
SavedShots[ffISaved].ffTime = ffTime;
Expand Down Expand Up @@ -255,7 +255,7 @@ function bool ProcessHit( out ShotData Data)
}

if ( TargetComp != None )
Data.ffOther = LCComp.ffCheckHit( TargetComp, Data.ffHit, Data.ffOff, class'LCStatics'.static.DecompressRotator(Data.CmpRot) );
Data.ffOther = LCComp.ffCheckHit( TargetComp, Data.ffHit, Data.ffOff, class'LCStatics'.static.DecompressRotator(Data.CmpRot), Data.Error );

if ( Data.Imprecise >= 2 )
{
Expand Down
Loading

0 comments on commit a7f55ba

Please sign in to comment.