diag(phys): A6.P3 slice 4 — add [poly-dump] probe for #98 investigation

Adds a polygon-geometry dump probe that fires alongside [push-back]
whenever AdjustSphereToPlane lands a push-back. Gated by
ACDREAM_PROBE_POLY_DUMP=1.

Output format:
  [poly-dump] cell=0xA9B40147 polyId=0x0042 numPts=4 sides=Single
              n=(0.000,-0.719,0.695) d=-0.1007
              verts=[(x1,y1,z1),(x2,y2,z2),(x3,y3,z3),(x4,y4,z4)]

Purpose: investigate #98 (cellar-up stuck at top step). The push-back
trace shows the player hitting a sloped surface n=(0,-0.719,0.695) at
the cellar stair top. Two possibilities:
  1. The polygon really IS sloped 44° in the dat (genuine geometry).
  2. Our dat-read produces wrong vertices → wrong normal → wrong plane.

The dump lets us:
- Identify which dat polygon was hit (cell + poly ID)
- Compare our extracted vertices against WorldBuilder's straight-from-
  dat read for the same poly
- Or spawn the cell in ACViewer to visually verify the geometry

Changes:
- Added `ushort Id` property to ResolvedPolygon (defaults to 0 for test
  fixtures that don't care; production code in PhysicsDataCache.cs +
  BSPQuery.cs sets it from the dictionary key).
- Added ProbePolyDumpEnabled + LogPolyDump in PhysicsDiagnostics.
- Wired the dump into AdjustSphereToPlane's apply-branch (after the
  existing push-back log; same gating pattern).

Test suite: 1148 pass + 8 pre-existing fail (baseline maintained).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Erik 2026-05-22 12:17:47 +02:00
parent ceeb06be7d
commit 0b449968a7
3 changed files with 64 additions and 0 deletions

View file

@ -394,6 +394,14 @@ public static class BSPQuery
applied: true);
}
if (PhysicsDiagnostics.ProbePolyDumpEnabled)
{
// A6.P3 slice 4 (2026-05-22): dump the polygon geometry to
// cross-reference against WorldBuilder's straight-from-dat
// read. CellId taken from path.CheckCellId.
PhysicsDiagnostics.LogPolyDump(path.CheckCellId, poly);
}
return true;
}
@ -2212,6 +2220,7 @@ public static class BSPQuery
Plane = new Plane(normal, planeD),
NumPoints = n,
SidesType = poly.SidesType,
Id = id,
};
}
return resolved;