feat(net): port retail physics spawn and event timestamps
Parse the complete PhysicsDesc plus F754/F755 packets, correct every PhysicsState bit, and gate all nine retail update channels with generation-safe immutable snapshots. Preserve ForcePosition, teleport, placement, velocity, parent, pickup, delete, and same-generation CreateObject ordering from the named client. Separate accepted logical lifecycle notifications from retained UI qualities, make GUID replacement and session reset clear every projection exactly once, and add packet, wraparound, malformed-input, parent FIFO, canonical-position, reconnect, and GUID-reuse conformance coverage. Co-Authored-By: Codex <noreply@openai.com>
This commit is contained in:
parent
d53fe30ffe
commit
8a5d77f7f4
50 changed files with 3809 additions and 649 deletions
30
src/AcDream.Core/Physics/PositionFrameValidation.cs
Normal file
30
src/AcDream.Core/Physics/PositionFrameValidation.cs
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
using System.Numerics;
|
||||
|
||||
namespace AcDream.Core.Physics;
|
||||
|
||||
/// <summary>
|
||||
/// Retail <c>Position::IsValid</c> 0x005A9480 composed with
|
||||
/// <c>Frame::IsValid</c> 0x00534ED0. The quaternion test is performed on its
|
||||
/// squared norm with retail's exact <c>0.0002 * 5</c> tolerance.
|
||||
/// </summary>
|
||||
public static class PositionFrameValidation
|
||||
{
|
||||
public static bool IsValid(uint cellId, Vector3 origin, Quaternion rotation)
|
||||
{
|
||||
if (!LandDefs.InboundValidCellId(cellId)
|
||||
|| float.IsNaN(origin.X)
|
||||
|| float.IsNaN(origin.Y)
|
||||
|| float.IsNaN(origin.Z)
|
||||
|| float.IsNaN(rotation.W)
|
||||
|| float.IsNaN(rotation.X)
|
||||
|| float.IsNaN(rotation.Y)
|
||||
|| float.IsNaN(rotation.Z))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
float normSquared = rotation.LengthSquared();
|
||||
return !float.IsNaN(normSquared)
|
||||
&& MathF.Abs(normSquared - 1f) <= 0.001f;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue