cleanup repo

This commit is contained in:
2026-04-16 11:39:41 +02:00
parent 5f11dfcdc5
commit c79d5c8f0a
11 changed files with 122 additions and 24669 deletions

View File

@@ -57,7 +57,7 @@ Add regression tests for every gameplay bug fix when practical. If scene-level a
- Before beginning with the edit phase, always present a plan first. Only begin editing after the user approves the plan. - Before beginning with the edit phase, always present a plan first. Only begin editing after the user approves the plan.
- Don't make assumptions in the plan. If necessary, ask all clarifying questions before presenting the final plan. - Don't make assumptions in the plan. If necessary, ask all clarifying questions before presenting the final plan.
- After every iteration, evaluate if the test coverage would fall below 100%, and write tests if necessary. - After every iteration, evaluate if the test coverage would fall below 100%, and write tests if necessary.
- After every iteration, run `jb cleanupcode --build=False $file1;$file2;...` for every file you touched. - After every iteration, before committing, run `jb cleanupcode --build=False $file1;$file2;...` for every file you touched.
- After every iteration, if there's a relevant documentation for the current task, update it according to the change. - After every iteration, if there's a relevant documentation for the current task, update it according to the change.
- Update the wording of touched concerns instead of introducing incremental change reports - Update the wording of touched concerns instead of introducing incremental change reports
- The documentation should always represent the current state in its entirety and not derail into a historical development log. - The documentation should always represent the current state in its entirety and not derail into a historical development log.

View File

File diff suppressed because one or more lines are too long

View File

@@ -40,7 +40,7 @@ public static class FixPointUtil
if (FixPoint16Long.Abs(det) < s_IntersectionEpsilon) if (FixPoint16Long.Abs(det) < s_IntersectionEpsilon)
return false; return false;
var t = ((FixPoint16Long)s2.m_X * (line1Start.m_Y - line2Start.m_Y) - (FixPoint16Long)s2.m_Y * (line1Start .m_X - line2Start.m_X)) / det; var t = ((FixPoint16Long)s2.m_X * (line1Start.m_Y - line2Start.m_Y) - (FixPoint16Long)s2.m_Y * (line1Start.m_X - line2Start.m_X)) / det;
var px = line1Start.m_X + (t * s1.m_X); var px = line1Start.m_X + (t * s1.m_X);
var py = line1Start.m_Y + (t * s1.m_Y); var py = line1Start.m_Y + (t * s1.m_Y);
@@ -66,4 +66,4 @@ public static class FixPointUtil
private static readonly FixPoint16 s_IntersectionEpsilon = FixPoint16.Epsilon * 30; private static readonly FixPoint16 s_IntersectionEpsilon = FixPoint16.Epsilon * 30;
private static readonly long s_LineIntersectionMax = FixPoint16.c_LongMax / 4; private static readonly long s_LineIntersectionMax = FixPoint16.c_LongMax / 4;
private static readonly long s_LineIntersectionMin = FixPoint16.c_LongMin / 4; private static readonly long s_LineIntersectionMin = FixPoint16.c_LongMin / 4;
} }

View File

@@ -38,7 +38,7 @@ public static class FixPointVectorExt
count++; count++;
} }
return new(new FixPoint16 {m_Value = (int)(sumX / count)}, new() {m_Value = (int)(sumY / count)}); return new(new FixPoint16 { m_Value = (int)(sumX / count) }, new() { m_Value = (int)(sumY / count) });
} }
} }
@@ -159,9 +159,9 @@ public struct FixPointVector2 : IEquatable<FixPointVector2>
return m_X.GetHashCode() + m_Y.GetHashCode(); return m_X.GetHashCode() + m_Y.GetHashCode();
} }
#endregion #endregion
#region -- static properties ------------------------------------------ #region -- static properties ------------------------------------------
public static readonly FixPointVector2 s_Zero = new(0, 0); public static readonly FixPointVector2 s_Zero = new(0, 0);
public static readonly FixPointVector2 s_One = new(1, 1); public static readonly FixPointVector2 s_One = new(1, 1);
@@ -170,9 +170,9 @@ public struct FixPointVector2 : IEquatable<FixPointVector2>
public static readonly FixPointVector2 s_MaxValue = new(FixPoint16.MaxValue, FixPoint16.MaxValue); public static readonly FixPointVector2 s_MaxValue = new(FixPoint16.MaxValue, FixPoint16.MaxValue);
public static readonly FixPointVector2 s_MinValue = new(FixPoint16.MinValue, FixPoint16.MinValue); public static readonly FixPointVector2 s_MinValue = new(FixPoint16.MinValue, FixPoint16.MinValue);
#endregion #endregion
#region -- public properties ----------------------------------------- #region -- public properties -----------------------------------------
public FixPoint16 this[int i] public FixPoint16 this[int i]
{ {
@@ -182,9 +182,12 @@ public struct FixPointVector2 : IEquatable<FixPointVector2>
{ {
switch (i) switch (i)
{ {
case 0: return m_X; case 0:
case 1: return m_Y; return m_X;
default: throw new ArgumentOutOfRangeException(nameof(i)); case 1:
return m_Y;
default:
throw new ArgumentOutOfRangeException(nameof(i));
} }
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -198,7 +201,8 @@ public struct FixPointVector2 : IEquatable<FixPointVector2>
case 1: case 1:
m_Y = value; m_Y = value;
break; break;
default: throw new ArgumentOutOfRangeException(nameof(i)); default:
throw new ArgumentOutOfRangeException(nameof(i));
} }
} }
} }
@@ -238,9 +242,9 @@ public struct FixPointVector2 : IEquatable<FixPointVector2>
get => new(m_X.Doubled, m_Y.Doubled); get => new(m_X.Doubled, m_Y.Doubled);
} }
#endregion #endregion
#region -- public methods --------------------------------------------- #region -- public methods ---------------------------------------------
/// <summary> /// <summary>
/// Calculates the length of the current vector. /// Calculates the length of the current vector.
@@ -279,8 +283,7 @@ public struct FixPointVector2 : IEquatable<FixPointVector2>
{ {
unchecked unchecked
{ {
return ((m_X.m_Value * (long)m_X.m_Value) + (m_Y.m_Value * (long)m_Y.m_Value)).CompareTo( return ((m_X.m_Value * (long)m_X.m_Value) + (m_Y.m_Value * (long)m_Y.m_Value)).CompareTo((other.m_X.m_Value * (long)other.m_X.m_Value) + (other.m_Y.m_Value * (long)other.m_Y.m_Value));
(other.m_X.m_Value * (long)other.m_X.m_Value) + (other.m_Y.m_Value * (long)other.m_Y.m_Value));
} }
} }
@@ -489,6 +492,7 @@ public struct FixPointVector2 : IEquatable<FixPointVector2>
xStart = i; xStart = i;
state = EParseState.ParseX; state = EParseState.ParseX;
} }
break; break;
} }
case EParseState.ParseX: case EParseState.ParseX:
@@ -533,6 +537,7 @@ public struct FixPointVector2 : IEquatable<FixPointVector2>
{ {
throw new FormatException($"Unexpected character '{character}' after the vector."); throw new FormatException($"Unexpected character '{character}' after the vector.");
} }
break; break;
} }
} }
@@ -570,8 +575,7 @@ public struct FixPointVector2 : IEquatable<FixPointVector2>
{ {
unchecked unchecked
{ {
return ((value1.m_X.m_Value * (long)value1.m_X.m_Value) + (value1.m_Y.m_Value * (long)value1.m_Y.m_Value)).CompareTo( return ((value1.m_X.m_Value * (long)value1.m_X.m_Value) + (value1.m_Y.m_Value * (long)value1.m_Y.m_Value)).CompareTo((value2.m_X.m_Value * (long)value2.m_X.m_Value) + (value2.m_Y.m_Value * (long)value2.m_Y.m_Value));
(value2.m_X.m_Value * (long)value2.m_X.m_Value) + (value2.m_Y.m_Value * (long)value2.m_Y.m_Value));
} }
} }
@@ -1119,9 +1123,9 @@ public struct FixPointVector2 : IEquatable<FixPointVector2>
return new(value.m_X * orientationDirection.m_X + value.m_Y * orientationDirection.m_Y, value.m_Y * orientationDirection.m_X - value.m_X * orientationDirection.m_Y); return new(value.m_X * orientationDirection.m_X + value.m_Y * orientationDirection.m_Y, value.m_Y * orientationDirection.m_X - value.m_X * orientationDirection.m_Y);
} }
#endregion #endregion
#region -- operators -------------------------------------------------- #region -- operators --------------------------------------------------
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator ==(FixPointVector2 left, FixPointVector2 right) public static bool operator ==(FixPointVector2 left, FixPointVector2 right)
@@ -1198,7 +1202,8 @@ public struct FixPointVector2 : IEquatable<FixPointVector2>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static FixPointVector2 operator *(FixPointVector2 left, FixPoint16 right) public static FixPointVector2 operator *(FixPointVector2 left, FixPoint16 right)
{ {
return new() { return new()
{
m_X = left.m_X * right, m_X = left.m_X * right,
m_Y = left.m_Y * right m_Y = left.m_Y * right
}; };
@@ -1219,7 +1224,8 @@ public struct FixPointVector2 : IEquatable<FixPointVector2>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static FixPointVector2 operator /(FixPointVector2 left, FixPoint16 right) public static FixPointVector2 operator /(FixPointVector2 left, FixPoint16 right)
{ {
return new() { return new()
{
m_X = left.m_X / right, m_X = left.m_X / right,
m_Y = left.m_Y / right m_Y = left.m_Y / right
}; };
@@ -1231,7 +1237,7 @@ public struct FixPointVector2 : IEquatable<FixPointVector2>
return Divide(left, right); return Divide(left, right);
} }
#endregion #endregion
/// <summary> /// <summary>
/// The x-component of the vector. /// The x-component of the vector.
@@ -1242,4 +1248,4 @@ public struct FixPointVector2 : IEquatable<FixPointVector2>
/// The y-component of the vector. /// The y-component of the vector.
/// </summary> /// </summary>
public FixPoint16 m_Y; public FixPoint16 m_Y;
} }

View File

@@ -71,7 +71,7 @@ public struct SFixPointVector3 : IEquatable<SFixPointVector3>
return new(m_X.ToFloat(), m_Y.ToFloat(), m_Z.ToFloat()); return new(m_X.ToFloat(), m_Y.ToFloat(), m_Z.ToFloat());
} }
#region -- base overrides --------------------------------------------- #region -- base overrides ---------------------------------------------
[Pure] [Pure]
public override string ToString() public override string ToString()
@@ -103,9 +103,9 @@ public struct SFixPointVector3 : IEquatable<SFixPointVector3>
return m_X.GetHashCode() + m_Y.GetHashCode() + m_Z.GetHashCode(); return m_X.GetHashCode() + m_Y.GetHashCode() + m_Z.GetHashCode();
} }
#endregion #endregion
#region -- static properties ------------------------------------------ #region -- static properties ------------------------------------------
public static readonly SFixPointVector3 s_Zero = new(0, 0, 0); public static readonly SFixPointVector3 s_Zero = new(0, 0, 0);
public static readonly SFixPointVector3 s_One = new(1, 1, 1); public static readonly SFixPointVector3 s_One = new(1, 1, 1);
@@ -115,9 +115,9 @@ public struct SFixPointVector3 : IEquatable<SFixPointVector3>
public static readonly SFixPointVector3 s_MaxValue = new(FixPoint16.MaxValue, FixPoint16.MaxValue, FixPoint16.MaxValue); public static readonly SFixPointVector3 s_MaxValue = new(FixPoint16.MaxValue, FixPoint16.MaxValue, FixPoint16.MaxValue);
public static readonly SFixPointVector3 s_MinValue = new(FixPoint16.MinValue, FixPoint16.MinValue, FixPoint16.MinValue); public static readonly SFixPointVector3 s_MinValue = new(FixPoint16.MinValue, FixPoint16.MinValue, FixPoint16.MinValue);
#endregion #endregion
#region -- public properties ----------------------------------------- #region -- public properties -----------------------------------------
public FixPoint16 this[int i] public FixPoint16 this[int i]
{ {
@@ -127,10 +127,14 @@ public struct SFixPointVector3 : IEquatable<SFixPointVector3>
{ {
switch (i) switch (i)
{ {
case 0: return m_X; case 0:
case 1: return m_Y; return m_X;
case 2: return m_Z; case 1:
default: throw new ArgumentOutOfRangeException(nameof(i)); return m_Y;
case 2:
return m_Z;
default:
throw new ArgumentOutOfRangeException(nameof(i));
} }
} }
set set
@@ -146,7 +150,8 @@ public struct SFixPointVector3 : IEquatable<SFixPointVector3>
case 2: case 2:
m_Z = value; m_Z = value;
break; break;
default: throw new ArgumentOutOfRangeException(nameof(i)); default:
throw new ArgumentOutOfRangeException(nameof(i));
} }
} }
} }
@@ -186,7 +191,7 @@ public struct SFixPointVector3 : IEquatable<SFixPointVector3>
get => new(m_X, m_Z); get => new(m_X, m_Z);
} }
#endregion #endregion
#region -- public methods --------------------------------------------- #region -- public methods ---------------------------------------------
@@ -227,8 +232,7 @@ public struct SFixPointVector3 : IEquatable<SFixPointVector3>
{ {
unchecked unchecked
{ {
return ((m_X.m_Value * (long)m_X.m_Value) + (m_Y.m_Value * (long)m_Y.m_Value) + (m_Z.m_Value * (long)m_Z.m_Value)).CompareTo( return ((m_X.m_Value * (long)m_X.m_Value) + (m_Y.m_Value * (long)m_Y.m_Value) + (m_Z.m_Value * (long)m_Z.m_Value)).CompareTo((other.m_X.m_Value * (long)other.m_X.m_Value) + (other.m_Y.m_Value * (long)other.m_Y.m_Value) + (other.m_Z.m_Value * (long)other.m_Z.m_Value));
(other.m_X.m_Value * (long)other.m_X.m_Value) + (other.m_Y.m_Value * (long)other.m_Y.m_Value) + (other.m_Z.m_Value * (long)other.m_Z.m_Value));
} }
} }
@@ -430,8 +434,7 @@ public struct SFixPointVector3 : IEquatable<SFixPointVector3>
var yz2 = rotation.m_Y * z2; var yz2 = rotation.m_Y * z2;
var zz2 = rotation.m_Z * z2; var zz2 = rotation.m_Z * z2;
return new((value.m_X * (1 - yy2 - zz2)) + (value.m_Y * (xy2 - wz2)) + (value.m_Z * (xz2 + wy2)), (value.m_X * (xy2 + wz2)) + (value.m_Y * (1 - xx2 - zz2)) + (value.m_Z * (yz2 - wx2)), return new((value.m_X * (1 - yy2 - zz2)) + (value.m_Y * (xy2 - wz2)) + (value.m_Z * (xz2 + wy2)), (value.m_X * (xy2 + wz2)) + (value.m_Y * (1 - xx2 - zz2)) + (value.m_Z * (yz2 - wx2)), (value.m_X * (xz2 - wy2)) + (value.m_Y * (yz2 + wx2)) + (value.m_Z * (1 - xx2 - yy2)));
(value.m_X * (xz2 - wy2)) + (value.m_Y * (yz2 + wx2)) + (value.m_Z * (1 - xx2 - yy2)));
} }
#endregion #endregion
@@ -453,8 +456,7 @@ public struct SFixPointVector3 : IEquatable<SFixPointVector3>
{ {
unchecked unchecked
{ {
return ((value.m_X.m_Value * (long)value.m_X.m_Value) + (value.m_Y.m_Value * (long)value.m_Y.m_Value) + (value.m_Z.m_Value * (long)value.m_Z.m_Value)).CompareTo( return ((value.m_X.m_Value * (long)value.m_X.m_Value) + (value.m_Y.m_Value * (long)value.m_Y.m_Value) + (value.m_Z.m_Value * (long)value.m_Z.m_Value)).CompareTo(fLength.m_Value * (long)fLength.m_Value);
fLength.m_Value * (long)fLength.m_Value);
} }
} }
@@ -463,8 +465,7 @@ public struct SFixPointVector3 : IEquatable<SFixPointVector3>
{ {
unchecked unchecked
{ {
return ((value1.m_X.m_Value * (long)value1.m_X.m_Value) + (value1.m_Y.m_Value * (long)value1.m_Y.m_Value) + (value1.m_Z.m_Value * (long)value1.m_Z.m_Value)).CompareTo( return ((value1.m_X.m_Value * (long)value1.m_X.m_Value) + (value1.m_Y.m_Value * (long)value1.m_Y.m_Value) + (value1.m_Z.m_Value * (long)value1.m_Z.m_Value)).CompareTo((value2.m_X.m_Value * (long)value2.m_X.m_Value) + (value2.m_Y.m_Value * (long)value2.m_Y.m_Value) + (value2.m_Z.m_Value * (long)value2.m_Z.m_Value));
(value2.m_X.m_Value * (long)value2.m_X.m_Value) + (value2.m_Y.m_Value * (long)value2.m_Y.m_Value) + (value2.m_Z.m_Value * (long)value2.m_Z.m_Value));
} }
} }
@@ -477,8 +478,7 @@ public struct SFixPointVector3 : IEquatable<SFixPointVector3>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static SFixPointVector3 Cross(SFixPointVector3 vector1, SFixPointVector3 vector2) public static SFixPointVector3 Cross(SFixPointVector3 vector1, SFixPointVector3 vector2)
{ {
return new((vector1.m_Y * vector2.m_Z) - (vector1.m_Z * vector2.m_Y), (vector1.m_Z * vector2.m_X) - (vector1.m_X * vector2.m_Z), return new((vector1.m_Y * vector2.m_Z) - (vector1.m_Z * vector2.m_Y), (vector1.m_Z * vector2.m_X) - (vector1.m_X * vector2.m_Z), (vector1.m_X * vector2.m_Y) - (vector1.m_Y * vector2.m_X));
(vector1.m_X * vector2.m_Y) - (vector1.m_Y * vector2.m_X));
} }
/// <summary> /// <summary>
@@ -870,9 +870,9 @@ public struct SFixPointVector3 : IEquatable<SFixPointVector3>
return new(FixPoint16.Fract(p.m_X), FixPoint16.Fract(p.m_Y), FixPoint16.Fract(p.m_Z)); return new(FixPoint16.Fract(p.m_X), FixPoint16.Fract(p.m_Y), FixPoint16.Fract(p.m_Z));
} }
#endregion #endregion
#region -- operators -------------------------------------------------- #region -- operators --------------------------------------------------
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator ==(SFixPointVector3 left, SFixPointVector3 right) public static bool operator ==(SFixPointVector3 left, SFixPointVector3 right)
@@ -939,7 +939,8 @@ public struct SFixPointVector3 : IEquatable<SFixPointVector3>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static SFixPointVector3 operator *(SFixPointVector3 left, FixPoint16 right) public static SFixPointVector3 operator *(SFixPointVector3 left, FixPoint16 right)
{ {
return new() { return new()
{
m_X = left.m_X * right, m_X = left.m_X * right,
m_Y = left.m_Y * right, m_Y = left.m_Y * right,
m_Z = left.m_Z * right m_Z = left.m_Z * right
@@ -961,7 +962,8 @@ public struct SFixPointVector3 : IEquatable<SFixPointVector3>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static SFixPointVector3 operator /(SFixPointVector3 left, FixPoint16 right) public static SFixPointVector3 operator /(SFixPointVector3 left, FixPoint16 right)
{ {
return new() { return new()
{
m_X = left.m_X / right, m_X = left.m_X / right,
m_Y = left.m_Y / right, m_Y = left.m_Y / right,
m_Z = left.m_Z / right m_Z = left.m_Z / right
@@ -974,7 +976,7 @@ public struct SFixPointVector3 : IEquatable<SFixPointVector3>
return Divide(left, right); return Divide(left, right);
} }
#endregion #endregion
/// <summary> /// <summary>
/// The x-component of the vector. /// The x-component of the vector.
@@ -990,4 +992,4 @@ public struct SFixPointVector3 : IEquatable<SFixPointVector3>
/// The z-component of the vector. /// The z-component of the vector.
/// </summary> /// </summary>
public FixPoint16 m_Z; public FixPoint16 m_Z;
} }

View File

@@ -31,4 +31,4 @@ internal static class IntMath
{ {
return (long)System.Math.Sqrt(value); return (long)System.Math.Sqrt(value);
} }
} }

View File

@@ -116,4 +116,4 @@ public struct SIntRandom
public readonly ulong Seed => m_Seed; public readonly ulong Seed => m_Seed;
private ulong m_Seed; private ulong m_Seed;
} }

View File

@@ -1,9 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

View File

@@ -1,29 +1,29 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<Exclude>[SideScrollerGame.Sim]SideScrollerGame.Sim.Math.*,[SideScrollerGame.Sim]SideScrollerGame.Sim.SimulationDefaults</Exclude> <Exclude>[SideScrollerGame.Sim]SideScrollerGame.Sim.Math.*,[SideScrollerGame.Sim]SideScrollerGame.Sim.SimulationDefaults</Exclude>
<IsPackable>false</IsPackable> <IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject> <IsTestProject>true</IsTestProject>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.0" /> <PackageReference Include="coverlet.collector" Version="6.0.0" />
<PackageReference Include="coverlet.msbuild" Version="6.0.0" /> <PackageReference Include="coverlet.msbuild" Version="6.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="xunit" Version="2.5.3" /> <PackageReference Include="xunit" Version="2.5.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3" /> <PackageReference Include="xunit.runner.visualstudio" Version="2.5.3" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Using Include="Xunit" /> <Using Include="Xunit" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\src\SideScrollerGame.Sim\SideScrollerGame.Sim.csproj" /> <ProjectReference Include="..\..\src\SideScrollerGame.Sim\SideScrollerGame.Sim.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>