fix(core): Phase B.2 — mask cellId to low 16 bits in PhysicsEngine.Resolve
ROOT CAUSE of the fall-through-ground bug. The currentlyIndoor check compared the FULL 32-bit cell ID (0xA9B40001, includes landblock prefix) against 0x0100. Every outdoor cell ID with a landblock prefix is >= 0x0100, so the engine ALWAYS took the "stay indoors" path, snapping the player to the nearest EnvCell floor at Z=66 instead of the outdoor terrain at Z=94. ACE confirmed the bug: "AddWorldObjectInternal: couldn't spawn +Acdream at 0xA9B40121 [84.2 37.7 66.0]" — we were sending the server an indoor cell ID with a below-terrain Z position. Fix: mask cellId with 0xFFFF before the indoor check (outdoor cells are 0x0001–0x0040; indoor are 0x0100+; the high 16 bits are the landblock prefix and must be stripped). Also mask the returned targetCellId from CellSurface (which carries the full EnvCell dat id) to just the cell index. 265 tests still green. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
97c17c5bc3
commit
05d835ff33
1 changed files with 10 additions and 3 deletions
|
|
@ -107,13 +107,20 @@ public sealed class PhysicsEngine
|
|||
float targetZ;
|
||||
uint targetCellId;
|
||||
|
||||
bool currentlyIndoor = cellId >= 0x0100;
|
||||
// Only the low 16 bits of cellId carry the cell index. Outdoor
|
||||
// cells are 0x0001–0x0040; indoor (EnvCell) cells are 0x0100+.
|
||||
// The full 32-bit cellId includes the landblock prefix in the
|
||||
// high 16 bits (e.g., 0xA9B40001), so we MUST mask before
|
||||
// comparing. Without the mask, every cell looks "indoor" because
|
||||
// 0xA9B40001 >= 0x0100 → the engine always takes the "stay
|
||||
// indoors" path and snaps Z to an EnvCell floor 28m below.
|
||||
bool currentlyIndoor = (cellId & 0xFFFFu) >= 0x0100;
|
||||
|
||||
if (currentlyIndoor && bestCellZ is not null)
|
||||
{
|
||||
// Stay indoors on the best cell's floor.
|
||||
targetZ = bestCellZ.Value;
|
||||
targetCellId = bestCell!.CellId;
|
||||
targetCellId = bestCell!.CellId & 0xFFFFu;
|
||||
}
|
||||
else if (currentlyIndoor && bestCellZ is null)
|
||||
{
|
||||
|
|
@ -126,7 +133,7 @@ public sealed class PhysicsEngine
|
|||
{
|
||||
// Walked into an indoor cell from outdoor — transition to indoor.
|
||||
targetZ = bestCellZ.Value;
|
||||
targetCellId = bestCell!.CellId;
|
||||
targetCellId = bestCell!.CellId & 0xFFFFu;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue