acdream/src/AcDream.Core/Physics/Position.cs
Erik c980763322 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>
2026-06-21 10:34:36 +02:00

27 lines
1.3 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System.Numerics;
namespace AcDream.Core.Physics;
/// <summary>
/// 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 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="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, CellFrame Frame)
{
public Position(uint objCellId, Vector3 origin, Quaternion orientation)
: this(objCellId, new CellFrame(origin, orientation)) { }
}