build: make release restore reproducible

This commit is contained in:
Erik 2026-08-18 10:29:00 +02:00
parent b459e0cf0c
commit c38f6b8852
129 changed files with 16810 additions and 188 deletions

View file

@ -33,8 +33,8 @@ public class CellArrayTests
{
var a = new CellArray();
a.Add(0xA9B40170u);
Assert.True(a.Contains(0xA9B40170u));
Assert.False(a.Contains(0xA9B40171u));
Assert.Contains(0xA9B40170u, a);
Assert.DoesNotContain(0xA9B40171u, a);
}
[Fact]

View file

@ -26,7 +26,7 @@ public class CellGraphMembershipTests
{
VertexArray = new VertexArray { Vertices = new Dictionary<ushort, SWVertex>() },
Polygons = new Dictionary<ushort, Polygon>(),
PhysicsBSP = null,
PhysicsBSP = null!,
CellBSP = new CellBSPTree
{
Root = new CellBSPNode { Type = DatReaderWriter.Enums.BSPNodeType.Leaf },

View file

@ -388,21 +388,26 @@ public class DoorSetupGfxObjInspectionTests
_out.WriteLine($" CellStruct polygons = {cellStruct.Polygons?.Count ?? 0} (visible)");
_out.WriteLine($" CellStruct physicsPolys = {cellStruct.PhysicsPolygons?.Count ?? 0}");
var physicsPolygons = cellStruct.PhysicsPolygons
?? throw new InvalidDataException("CellStruct has no physics polygons collection.");
var vertices = cellStruct.VertexArray?.Vertices
?? throw new InvalidDataException("CellStruct has no vertex array.");
// Dump ALL physics polygons (collision walls/floor) in world frame
// so we can see what blocks a sphere at world (133.655, 17.59).
_out.WriteLine($" CellStruct PHYSICS polys (world frame):");
var cellOrigin = envCell.Position.Origin;
var cellRot = envCell.Position.Orientation;
for (int pi = 0; pi < cellStruct.PhysicsPolygons.Count; pi++)
for (int pi = 0; pi < physicsPolygons.Count; pi++)
{
var (pid, poly) = (cellStruct.PhysicsPolygons.Keys.ElementAt(pi),
cellStruct.PhysicsPolygons.Values.ElementAt(pi));
var (pid, poly) = (physicsPolygons.Keys.ElementAt(pi),
physicsPolygons.Values.ElementAt(pi));
float wxMin = float.MaxValue, wxMax = float.MinValue;
float wyMin = float.MaxValue, wyMax = float.MinValue;
float wzMin = float.MaxValue, wzMax = float.MinValue;
foreach (var vid in poly.VertexIds)
{
if (!cellStruct.VertexArray.Vertices.TryGetValue((ushort)vid, out var sv)) continue;
if (!vertices.TryGetValue((ushort)vid, out var sv)) continue;
var rotated = System.Numerics.Vector3.Transform(sv.Origin, cellRot);
var world = cellOrigin + rotated;
if (world.X < wxMin) wxMin = world.X; if (world.X > wxMax) wxMax = world.X;
@ -425,7 +430,7 @@ public class DoorSetupGfxObjInspectionTests
continue;
}
// Resolve vertex positions.
var vs = poly.VertexIds.Select(vid => cellStruct.VertexArray.Vertices[(ushort)vid].Origin).ToList();
var vs = poly.VertexIds.Select(vid => vertices[(ushort)vid].Origin).ToList();
string vlist = string.Join(",", vs.Select(v => $"({v.X:F2},{v.Y:F2},{v.Z:F2})"));
// Compute the plane using the first three verts (normal = (v1-v0) x (v2-v0), d = -dot(n, v0)).

View file

@ -143,7 +143,7 @@ public sealed class FlatCollisionInstalledDatTests
FlatCollisionAssetBuilder.FlattenGfxObj(gfxObj);
AssertPhysicsSourceMatches(
source.BSP.Root,
source.BSP?.Root,
source.Resolved,
flat.PhysicsBsp);
AssertNullableSphereBits(source.BoundingSphere, flat.BoundingSphere);

View file

@ -127,8 +127,8 @@ internal sealed class RemoteChaseHarness
public double Now;
// Counters (the live-probe equivalents).
public int BeginTurnBlocked;
public int BeginTurnUnblocked;
public int BeginTurnBlocked = 0;
public int BeginTurnUnblocked = 0;
public int RunInstalls; // substate transitions INTO RunForward/Walk fwd
public int TicksInRun;
public int TicksInWalkFwd;
@ -176,7 +176,7 @@ internal sealed class RemoteChaseHarness
{
var mtm = new MoveToManager(
Interp,
stopCompletely: () => Movement.PerformMovement(
stopCompletely: () => Movement!.PerformMovement(
new MovementStruct { Type = MovementType.StopCompletely }),
getPosition: () => new CorePosition(1u, Body.Position, Body.Orientation),
getHeading: () => MoveToMath.GetHeading(Body.Orientation),
@ -202,8 +202,8 @@ internal sealed class RemoteChaseHarness
curTime: () => Now);
// R5-V3 (#171) sticky seam binds (BeginNextNode arrival
// StickTo @0x00529d3a, PerformMovement-head Unstick).
mtm.StickTo = (tlid, radius, height) => Pm.StickTo(tlid, radius, height);
mtm.Unstick = Pm.UnStick;
mtm.StickTo = (tlid, radius, height) => Pm!.StickTo(tlid, radius, height);
mtm.Unstick = Pm!.UnStick;
return mtm;
},
};

View file

@ -24,7 +24,7 @@ namespace AcDream.Core.Tests.Physics;
/// configurable, matching the ground-lifecycle test file's convention.</summary>
file sealed class FakeWeenie : IWeenieObject
{
public bool IsThePlayerResult;
public bool IsThePlayerResult = false;
public bool IsCreatureResult = true;
public bool CanJumpResult = true;

View file

@ -488,6 +488,9 @@ public sealed class MotionInterpreterTests
// links). Verified against the live retail-observer trace
// (RetailObserverTraceConformanceTests, 183/183 dispatch conformant).
// R3 owns removal of the known redundant row. Keep this one historical
// input unchanged during R2 while ensuring any new duplicate still fails.
#pragma warning disable xUnit1025
[Theory]
[InlineData(MotionCommand.Fallen)]
[InlineData(MotionCommand.Dead)]
@ -505,6 +508,7 @@ public sealed class MotionInterpreterTests
Assert.True(allowed);
}
#pragma warning restore xUnit1025
[Fact]
public void ContactAllowsMove_AirborneCreature_AcceptsFallingAndTurns_BlocksWalk()