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:
parent
438bb681a5
commit
c980763322
8 changed files with 51 additions and 47 deletions
|
|
@ -30,7 +30,7 @@ dotnet test tests/AcDream.Core.Net.Tests/AcDream.Core.Net.Tests.csproj
|
|||
|
||||
| File | Responsibility | Slices |
|
||||
|---|---|---|
|
||||
| `src/AcDream.Core/Physics/Position.cs` (create) | `Frame` + `Position` value types | 1 |
|
||||
| `src/AcDream.Core/Physics/Position.cs` (create) | `CellFrame` + `Position` value types (`CellFrame` = retail `Frame`, renamed to dodge `DatReaderWriter.Types.Frame`) | 1 |
|
||||
| `src/AcDream.Core/Physics/LandDefs.cs` (modify) | add `GetBlockOffset` | 1 |
|
||||
| `src/AcDream.Core/Physics/PhysicsBody.cs` (modify) | carry `Position`; computed `WorldPosition`; `AdjustToOutside` on placement; integrate-then-rewrap | 2,4 |
|
||||
| `src/AcDream.Core/Physics/ResolveResult.cs` (modify) | carry the canonicalized `Position` | 2,3 |
|
||||
|
|
@ -57,30 +57,32 @@ dotnet test tests/AcDream.Core.Net.Tests/AcDream.Core.Net.Tests.csproj
|
|||
|
||||
- [ ] **Step 1: Create the value types**
|
||||
|
||||
`src/AcDream.Core/Physics/Position.cs`:
|
||||
`src/AcDream.Core/Physics/Position.cs` (the value type is named `CellFrame`, NOT `Frame` — `Frame`
|
||||
collides with `DatReaderWriter.Types.Frame` used in physics-adjacent code; the `Position.Frame` *member*
|
||||
keeps retail's name):
|
||||
```csharp
|
||||
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>. <see cref="Origin"/> is LOCAL
|
||||
/// to the owning cell: outdoor → X/Y ∈ [0,192), Z = height; indoor → EnvCell-relative.
|
||||
/// <see cref="Orientation"/> replaces retail's <c>m_fl2gv</c> 3×3 matrix.
|
||||
/// </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.
|
||||
/// Full 32-bit cell id + the cell-local <see cref="CellFrame"/>. Never 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)) { }
|
||||
}
|
||||
```
|
||||
|
||||
|
|
|
|||
|
|
@ -59,16 +59,19 @@ boundary crossing.
|
|||
### 3.1 New value types (`AcDream.Core.Physics`)
|
||||
|
||||
```csharp
|
||||
public readonly record struct Frame(Vector3 Origin, Quaternion Orientation);
|
||||
// Type named CellFrame (retail "Frame") to avoid colliding with
|
||||
// DatReaderWriter.Types.Frame, which is used in physics-adjacent code.
|
||||
public readonly record struct CellFrame(Vector3 Origin, Quaternion Orientation);
|
||||
// Origin is LOCAL to ObjCellId's cell:
|
||||
// outdoor → Origin.X/Y ∈ [0,192) within the landblock; Origin.Z = height.
|
||||
// indoor → Origin is the EnvCell-relative placement the BSP path already uses.
|
||||
|
||||
public readonly record struct Position(uint ObjCellId, Frame Frame);
|
||||
public readonly record struct Position(uint ObjCellId, CellFrame Frame); // member keeps retail's name
|
||||
```
|
||||
|
||||
One `Position` type covers indoor and outdoor (retail uniformity). `PhysicsBody.Position` becomes a
|
||||
`Position` and is **the source of truth.**
|
||||
`Position` and is **the source of truth.** (The value type is `CellFrame`; the `Position.Frame` member
|
||||
keeps retail's name. `Frame` collided with `DatReaderWriter.Types.Frame` — renamed during Slice 1.)
|
||||
|
||||
### 3.2 The seam: `_liveCenter` is render-only
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue