checkpoint(render): preserve pre-overhaul investigation state

This commit is contained in:
Erik 2026-09-01 18:04:24 +02:00
parent e880860291
commit b3b7d922f1
45 changed files with 3168 additions and 619 deletions

View file

@ -21,7 +21,9 @@ namespace AcDream.Core.Tests.Physics;
public sealed class CellTransitFindTransitCellsBoxTests
{
private static CellPhysics MakeCellWithPortalAtRightWall(
Matrix4x4 worldTransform, uint otherCellId, ushort flags)
Matrix4x4 worldTransform,
uint otherCellId,
ushort flags)
{
// Portal poly at local x=2.5 (right wall), normal +X. Same shape as
// CellTransitFindTransitCellsSphereTests' fixture, so the sphere-only
@ -142,6 +144,47 @@ public sealed class CellTransitFindTransitCellsBoxTests
Assert.DoesNotContain(0xA9B40101u, endToEnd);
}
[Fact]
public void StaticPartArrayCrossesExteriorPortal_KeepsOutdoorCells()
{
// CPhysicsObj::calc_cross_cells_static sets do_not_load_cells before
// entering find_bbox_cell_list, but retail's bbox worklist returns
// the CELLARRAY directly. The post-pass prune at CObjCell::
// find_cell_list+0x18E belongs only to that separate sphere route.
// This is the cathedral-ramp shape: an indoor static box genuinely
// reaches an exterior portal and must remain registered in outdoor
// shadow cells even when the seed's stab list is empty.
var cache = new PhysicsDataCache();
const uint seedCell = 0xF4180112u;
cache.RegisterCellStructForTest(
seedCell,
MakeCellWithPortalAtRightWall(
Matrix4x4.Identity,
otherCellId: 0xFFFF,
flags: 0));
var partWorldPos = new Vector3(2.0f, 0f, 2.5f);
var sphere = new Sphere { Origin = partWorldPos, Radius = 0.7f };
var box = new[]
{
MakeBox(
new Vector3(-0.7f),
new Vector3(0.7f),
partWorldPos,
Quaternion.Identity),
};
IReadOnlyList<uint> cells = CellTransit.BuildShadowCellSetFromParts(
cache,
seedCell,
box,
new[] { sphere },
isStatic: true);
Assert.Contains(seedCell, cells);
Assert.Contains(cells, id => (id & 0xFFFFu) is >= 1u and <= 64u);
}
// ── D3.2: inverse guard — a box that DOES cross admits, unchanged ──────
/// <summary>