Skip to content

Commit

Permalink
Update test
Browse files Browse the repository at this point in the history
  • Loading branch information
UnrealKaraulov committed Feb 19, 2024
1 parent e2d40f2 commit 1b9b1a2
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 78 deletions.
2 changes: 1 addition & 1 deletion CheatDemos/SearchCheats.bat
Original file line number Diff line number Diff line change
@@ -1 +1 @@
for /r %%v in (*.dem) do START ..\SourceCode\bin\Release\UnrealDemoScanner2.exe -alive "%%v"
for /r %%v in (*.dem) do START ..\Release\UnrealDemoScanner2.exe -alive "%%v"
2 changes: 1 addition & 1 deletion CheatDemos2/SearchCheats.bat
Original file line number Diff line number Diff line change
@@ -1 +1 @@
for /r %%v in (*.dem) do START ..\SourceCode\bin\Release\UnrealDemoScanner2.exe -alive "%%v"
for /r %%v in (*.dem) do START ..\Release\UnrealDemoScanner2.exe -alive "%%v"
14 changes: 7 additions & 7 deletions SourceCode/Parser/Demo stuff/GoldSource/GoldSourceParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ public override bool Equals(object obj)
EqualityComparer<Point3D>.Default.Equals(Forward, @params.Forward) &&
Hardware == @params.Hardware &&
Health == @params.Health &&
Idealpitch == @params.Idealpitch &&
Math.Abs(Idealpitch - @params.Idealpitch) < 0.00001f &&
Intermission == @params.Intermission &&
Maxclients == @params.Maxclients &&
MaxEntities == @params.MaxEntities &&
Expand All @@ -492,14 +492,14 @@ public override bool Equals(object obj)
EqualityComparer<Point3D>.Default.Equals(Simvel, @params.Simvel) &&
Smoothing == @params.Smoothing &&
Spectator == @params.Spectator &&
Time == @params.Time &&
Math.Abs(Time - @params.Time) < 0.00001f &&
EqualityComparer<Point3D>.Default.Equals(Up, @params.Up) &&
EqualityComparer<FPoint3D>.Default.Equals(Viewangles, @params.Viewangles) &&
Viewentity == @params.Viewentity &&
EqualityComparer<Point3D>.Default.Equals(Viewheight, @params.Viewheight) &&
EqualityComparer<Point3D>.Default.Equals(Vieworg, @params.Vieworg) &&
EqualityComparer<Point4D>.Default.Equals(Viewport, @params.Viewport) &&
Viewsize == @params.Viewsize &&
Math.Abs(Viewsize - @params.Viewsize) < 0.00001f &&
Waterlevel == @params.Waterlevel;
}

Expand Down Expand Up @@ -571,15 +571,15 @@ public override bool Equals(object obj)
Align3 == cmd.Align3 &&
Align4 == cmd.Align4 &&
Buttons == cmd.Buttons &&
Forwardmove == cmd.Forwardmove &&
Math.Abs(Forwardmove - cmd.Forwardmove) < 0.00001f &&
ImpactIndex == cmd.ImpactIndex &&
EqualityComparer<Point3D>.Default.Equals(ImpactPosition, cmd.ImpactPosition) &&
Impulse == cmd.Impulse &&
LerpMsec == cmd.LerpMsec &&
Lightlevel == cmd.Lightlevel &&
Msec == cmd.Msec &&
Sidemove == cmd.Sidemove &&
Upmove == cmd.Upmove &&
Math.Abs(Sidemove - cmd.Sidemove) < 0.00001f &&
Math.Abs(Upmove - cmd.Upmove) < 0.00001f &&
EqualityComparer<FPoint3D>.Default.Equals(Viewangles, cmd.Viewangles) &&
Weaponselect == cmd.Weaponselect;
}
Expand Down Expand Up @@ -965,7 +965,7 @@ public static GoldSourceDemoInfoHlsooe ParseDemoHlsooe(string s)
Frame = i + 1
};

if (float.IsNaN(currentDemoFrame.Time) || currentDemoFrame.Time == 0.0f)
if (float.IsNaN(currentDemoFrame.Time) || Math.Abs(currentDemoFrame.Time - 0.0f) < 0.00001f)
{
br.BaseStream.Seek(entry.Offset, SeekOrigin.Begin);
hlsooeDemo.ParsingErrors.Add(
Expand Down
20 changes: 11 additions & 9 deletions SourceCode/Parser/Demo stuff/Point3D.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace DemoScanner
using System;

namespace DemoScanner
{
public struct Point3D
{
Expand All @@ -16,9 +18,9 @@ public Point3D(float x, float y, float z)
public override bool Equals(object obj)
{
return obj is Point3D d &&
X == d.X &&
Y == d.Y &&
Z == d.Z;
Math.Abs(X - d.X) < 0.00001f &&
Math.Abs(Y - d.Y) < 0.00001f &&
Math.Abs(Z - d.Z) < 0.00001f;
}

public override int GetHashCode()
Expand All @@ -37,7 +39,7 @@ public override int GetHashCode()

public static bool operator !=(Point3D per1, Point3D per2)
{
return per1.X != per2.X || per1.Y != per2.Y || per1.Z != per2.Z;
return Math.Abs(per1.X - per2.X) > 0.00001f || Math.Abs(per1.Y - per2.Y) > 0.00001f || Math.Abs(per1.Z - per2.Z) > 0.00001f;
}
}

Expand All @@ -57,9 +59,9 @@ public FPoint3D(float x, float y, float z)
public override bool Equals(object obj)
{
return obj is FPoint3D d &&
X == d.X &&
Y == d.Y &&
Z == d.Z;
Math.Abs(X - d.X) < 0.00001f &&
Math.Abs(Y - d.Y) < 0.00001f &&
Math.Abs(Z - d.Z) < 0.00001f;
}

public override int GetHashCode()
Expand All @@ -78,7 +80,7 @@ public override int GetHashCode()

public static bool operator !=(FPoint3D per1, FPoint3D per2)
{
return per1.X != per2.X || per1.Y != per2.Y || per1.Z != per2.Z;
return Math.Abs(per1.X - per2.X) > 0.00001f || Math.Abs(per1.Y - per2.Y) > 0.00001f || Math.Abs(per1.Z - per2.Z) > 0.00001f;
}
}
}
Loading

0 comments on commit 1b9b1a2

Please sign in to comment.