From 319847289edeffc71c249148b8dc3a4a1531872f Mon Sep 17 00:00:00 2001 From: Erik Date: Fri, 22 May 2026 12:31:34 +0200 Subject: [PATCH] =?UTF-8?q?diag(phys):=20A6.P3=20slice=204=20=E2=80=94=20e?= =?UTF-8?q?xtend=20[cell-cache]=20probe=20with=20portalTargets?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Extends the existing [cell-cache] probe (gated by ACDREAM_PROBE_CELL_CACHE=1) to also dump the list of portal targets per cell: which other cells each portal connects to, the portal polygon id, and the flags. Output format (appended to existing [cell-cache] line): portalTargets=[(cell=0xNNNN,poly=0xNNNN,flags=0xNNNN),...] Purpose: investigating issue #98 (cellar-up stuck at top of ramp). We now know the polygon geometry is correct (per slice 4 polydump capture: the cellar is a real 46° ramp). Question is whether the cellar cell has a portal to the cottage main floor cell, and where that portal is. If portalTargets shows no connection to the expected upstairs cell, that's the bug. Test suite: unaffected (probe is gated off by default). Build: green. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/AcDream.Core/Physics/PhysicsDataCache.cs | 23 +++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/AcDream.Core/Physics/PhysicsDataCache.cs b/src/AcDream.Core/Physics/PhysicsDataCache.cs index 9bcda0b..ae40c63 100644 --- a/src/AcDream.Core/Physics/PhysicsDataCache.cs +++ b/src/AcDream.Core/Physics/PhysicsDataCache.cs @@ -215,8 +215,29 @@ public sealed class PhysicsDataCache var worldOrigin = Vector3.Transform(Vector3.Zero, worldTransform); + // A6.P3 slice 4 (2026-05-22): also dump portal targets so we + // can see which cells the player should be able to transition + // to (issue #98 investigation: cellar-up stuck at top of ramp). + string portalTargets; + if (portals.Count == 0) + { + portalTargets = "portalTargets=[]"; + } + else + { + var sb = new System.Text.StringBuilder("portalTargets=["); + for (int i = 0; i < portals.Count; i++) + { + if (i > 0) sb.Append(','); + sb.Append(System.FormattableString.Invariant( + $"(cell=0x{portals[i].OtherCellId:X4},poly=0x{portals[i].PolygonId:X4},flags=0x{portals[i].Flags:X4})")); + } + sb.Append(']'); + portalTargets = sb.ToString(); + } + Console.WriteLine(System.FormattableString.Invariant( - $"[cell-cache] envCellId=0x{envCellId:X8} physicsPolyCount={cellStruct.PhysicsPolygons?.Count ?? 0} resolvedCount={resolved.Count} bspTotalLeafPolys={bspTotalLeafPolys} bspUnmatchedIds={bspUnmatchedIds} {bsStr} portalCount={portals.Count} visibleCells={visibleCellIds.Count} cellBspRoot={(cellStruct.CellBSP?.Root is null ? "null" : "ok")} worldOrigin=({worldOrigin.X:F2},{worldOrigin.Y:F2},{worldOrigin.Z:F2})")); + $"[cell-cache] envCellId=0x{envCellId:X8} physicsPolyCount={cellStruct.PhysicsPolygons?.Count ?? 0} resolvedCount={resolved.Count} bspTotalLeafPolys={bspTotalLeafPolys} bspUnmatchedIds={bspUnmatchedIds} {bsStr} portalCount={portals.Count} visibleCells={visibleCellIds.Count} cellBspRoot={(cellStruct.CellBSP?.Root is null ? "null" : "ok")} worldOrigin=({worldOrigin.X:F2},{worldOrigin.Y:F2},{worldOrigin.Z:F2}) {portalTargets}")); } if (PhysicsDiagnostics.ProbeWalkMissEnabled)