Five reviewer-flagged items addressed:
- Fix#1: GameWindow building-loop now reuses TerrainSurface.ComputeOutdoorCellId
instead of re-deriving the row-major cell-index formula. DRY win; no risk
of the two formulas drifting.
- Fix#2: BuildingPhysics.ExactMatch decoder now references
DatReaderWriter.Enums.PortalFlags.ExactMatch instead of magic 0x0001.
- Fix#3: ExactMatch XML doc clarified as "reserved per retail's
CBldPortal::exact_match; not currently consumed by CheckBuildingTransit".
- Fix#4: CheckBuildingTransit docstring now explicitly documents the
retail divergence — retail's sphere_intersects_cell (radius-aware) vs.
our PointInsideCellBsp (radius-less). The sphereRadius parameter is
reserved for the future sphere_intersects_cell port. Practical effect
noted: entry fires ~sphereRadius (~0.48m) deeper than retail.
- Fix#5: Test method `SphereInsideBuildingPortalDestination_AddsInteriorCell`
renamed to `BuildingPortalWithUnloadedCellBSP_NoCandidateAdded` — the
test asserts Empty(candidates), not that the cell is added. Comment
updated.
Spec: docs/superpowers/specs/2026-05-19-indoor-portal-cell-tracking-design.md
Plan: docs/superpowers/plans/2026-05-19-indoor-portal-cell-tracking.md
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Closes the outdoor→indoor entry path. New BuildingPhysics type holds
the per-SortCell BldPortal list + building world transform; PhysicsDataCache
caches it (CacheBuilding + GetBuilding); CellTransit.CheckBuildingTransit
tests each portal's destination cell via PointInsideCellBsp.
PhysicsEngine.ResolveCellId's outdoor branch now hooks CheckBuildingTransit
after the terrain-grid lookup: if the matched landcell has a cached
building stab, check whether the sphere has crossed into one of its
interior EnvCells before returning.
GameWindow at landblock-load time iterates LandBlockInfo.Buildings and
caches each via PhysicsDataCache.CacheBuilding. The landcell-id derivation
uses retail's row-major cell-index formula (gridX * 8 + gridY + 1).
Polish items from Subagent B/C reviews folded in:
- visited HashSet in FindCellList's BFS (avoids O(N^2) re-enqueue)
- ResolveCellId_NoDataCache_ReturnsFallback test (closes coverage gap)
- DataCache-asymmetry comment in PhysicsEngine.ResolveCellId
- Replaced misleading FindCellList outdoor-branch TODO with explicit
note that ResolveCellId bypasses this branch — wired in ResolveCellId
directly.
- Removed unused 'using DatReaderWriter.Types;' from CellTransit.cs
- 2 new CellTransitFindCellListTests integration tests
- 1 new CellTransitCheckBuildingTransitTests test (null-CellBSP guard
case; happy path deferred to visual verification).
Spec: docs/superpowers/specs/2026-05-19-indoor-portal-cell-tracking-design.md
Plan: docs/superpowers/plans/2026-05-19-indoor-portal-cell-tracking.md
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>