using System.Numerics; using AcDream.Core.Physics; namespace AcDream.App.Physics; /// /// Shared host adapter for retail's moved-object shadow re-registration /// (CPhysicsObj::SetPositionInternal 0x00515330). Both the local body /// and remote dead-reckoning bodies publish their resolved position through /// this one cell-offset calculation. /// internal static class ShadowPositionSynchronizer { public static void Sync( ShadowObjectRegistry registry, uint entityId, Vector3 position, Quaternion orientation, uint cellId, int liveCenterX, int liveCenterY) { if (cellId == 0) return; int landblockX = (int)((cellId >> 24) & 0xFFu); int landblockY = (int)((cellId >> 16) & 0xFFu); float worldOffsetX = (landblockX - liveCenterX) * 192f; float worldOffsetY = (landblockY - liveCenterY) * 192f; registry.UpdatePosition( entityId, position, orientation, worldOffsetX, worldOffsetY, cellId, seedCellId: cellId); } }