refactor(physics #145): Slice 1 — rename Frame->CellFrame to avoid DatReaderWriter.Types.Frame collision

The new value type collided with DatReaderWriter.Types.Frame (used in
physics-adjacent code like ShadowShapeBuilder), which the structural fix
(per-file using-aliases across 6 files) would have re-incurred in every
later physics slice. Renamed the TYPE to CellFrame; the Position.Frame
MEMBER keeps retail's name. Restored the 5 alias-only files to their
pre-Slice-1 state; synced spec + plan. Core 1522 passed / 0 failed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Erik 2026-06-21 10:34:36 +02:00
parent 438bb681a5
commit c980763322
8 changed files with 51 additions and 47 deletions

View file

@ -3,21 +3,25 @@ using System.Numerics;
namespace AcDream.Core.Physics;
/// <summary>
/// Retail <c>Frame</c> (acclient.h:30647). <see cref="Origin"/> is LOCAL to the
/// owning cell: outdoor → X/Y ∈ [0,192) within the landblock, Z = height;
/// indoor → the EnvCell-relative placement. <see cref="Orientation"/> replaces
/// retail's <c>m_fl2gv</c> 3×3 local→global matrix (equivalent rotation).
/// Retail <c>Frame</c> (acclient.h:30647) — named <c>CellFrame</c> here to avoid
/// colliding with <c>DatReaderWriter.Types.Frame</c> (the dat placement/animation
/// frame, used in physics-adjacent code such as <c>ShadowShapeBuilder</c>).
/// <see cref="Origin"/> is LOCAL to the owning cell: outdoor → X/Y ∈ [0,192) within
/// the landblock, Z = height; indoor → the EnvCell-relative placement.
/// <see cref="Orientation"/> replaces retail's <c>m_fl2gv</c> 3×3 local→global
/// matrix (equivalent rotation).
/// </summary>
public readonly record struct Frame(Vector3 Origin, Quaternion Orientation);
public readonly record struct CellFrame(Vector3 Origin, Quaternion Orientation);
/// <summary>
/// Retail <c>Position</c> (acclient.h:30658): the (which-cell, where-inside) pair.
/// One type for indoor and outdoor. The full 32-bit cell id (high 16 = landblock
/// prefix, low 16 = cell index) plus the cell-local <see cref="Frame"/>. Neither
/// half is ever reconstructed from a streaming center — see #145 design spec.
/// prefix, low 16 = cell index) plus the cell-local <see cref="CellFrame"/>. Neither
/// half is ever reconstructed from a streaming center — see #145 design spec. The
/// <c>Frame</c> member keeps retail's name.
/// </summary>
public readonly record struct Position(uint ObjCellId, Frame Frame)
public readonly record struct Position(uint ObjCellId, CellFrame Frame)
{
public Position(uint objCellId, Vector3 origin, Quaternion orientation)
: this(objCellId, new Frame(origin, orientation)) { }
: this(objCellId, new CellFrame(origin, orientation)) { }
}

View file

@ -4,7 +4,6 @@ using System.Numerics;
using DatReaderWriter.DBObjs;
using DatReaderWriter.Enums;
using DatReaderWriter.Types;
using DatFrame = DatReaderWriter.Types.Frame;
namespace AcDream.Core.Physics;
@ -89,9 +88,9 @@ public static class ShadowShapeBuilder
uint gfxId = (uint)setup.Parts[i];
if (!hasPhysicsBsp(gfxId)) continue;
DatFrame partFrame = placementFrame is not null && i < placementFrame.Frames.Count
Frame partFrame = placementFrame is not null && i < placementFrame.Frames.Count
? placementFrame.Frames[i]
: new DatFrame { Origin = Vector3.Zero, Orientation = Quaternion.Identity };
: new Frame { Origin = Vector3.Zero, Orientation = Quaternion.Identity };
// BSP radius default; caller substitutes the real BoundingSphere.Radius
// at registration time when available. Loose-but-safe broadphase value.