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
64
src/AcDream.Core.Net/Messages/PhysicsSpawnData.cs
Normal file
64
src/AcDream.Core.Net/Messages/PhysicsSpawnData.cs
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
using System.Numerics;
|
||||
using AcDream.Core.Physics;
|
||||
|
||||
namespace AcDream.Core.Net.Messages;
|
||||
|
||||
/// <summary>
|
||||
/// The nine retail <c>PhysicsTimeStamp</c> channels stored at the tail of a
|
||||
/// <c>PhysicsDesc</c>. Field order is verbatim from <c>acclient.h:6084</c>.
|
||||
/// </summary>
|
||||
public readonly record struct PhysicsTimestamps(
|
||||
ushort Position,
|
||||
ushort Movement,
|
||||
ushort State,
|
||||
ushort Vector,
|
||||
ushort Teleport,
|
||||
ushort ServerControlledMove,
|
||||
ushort ForcePosition,
|
||||
ushort ObjDesc,
|
||||
ushort Instance);
|
||||
|
||||
/// <summary>A parent or child attachment carried by <c>PhysicsDesc</c>.</summary>
|
||||
public readonly record struct PhysicsAttachment(uint Guid, uint LocationId);
|
||||
|
||||
/// <summary>
|
||||
/// A present Movement field. The wrapper is retained even when
|
||||
/// <see cref="RawData"/> is empty so callers can distinguish absent Movement
|
||||
/// from an explicitly present zero-length movement block.
|
||||
/// </summary>
|
||||
public readonly record struct PhysicsMovementData(
|
||||
ReadOnlyMemory<byte> RawData,
|
||||
CreateObject.ServerMotionState? MotionState,
|
||||
bool? IsAutonomous);
|
||||
|
||||
/// <summary>
|
||||
/// Immutable, lossless projection of the retail <c>PhysicsDesc</c> embedded in
|
||||
/// CreateObject (0xF745). Nullable members preserve absent versus present-zero.
|
||||
/// Network acceleration is retained for protocol fidelity; retail recalculates
|
||||
/// normal acceleration after applying the final physics state.
|
||||
/// </summary>
|
||||
public readonly record struct PhysicsSpawnData(
|
||||
uint RawState,
|
||||
CreateObject.ServerPosition? Position,
|
||||
PhysicsMovementData? Movement,
|
||||
uint? AnimationFrame,
|
||||
uint? SetupTableId,
|
||||
uint? MotionTableId,
|
||||
uint? SoundTableId,
|
||||
uint? PhysicsScriptTableId,
|
||||
PhysicsAttachment? Parent,
|
||||
ReadOnlyMemory<PhysicsAttachment>? Children,
|
||||
float? Scale,
|
||||
float? Friction,
|
||||
float? Elasticity,
|
||||
float? Translucency,
|
||||
Vector3? Velocity,
|
||||
Vector3? Acceleration,
|
||||
Vector3? AngularVelocity,
|
||||
uint? DefaultScriptType,
|
||||
float? DefaultScriptIntensity,
|
||||
PhysicsTimestamps Timestamps)
|
||||
{
|
||||
/// <summary>The corrected retail flag view of <see cref="RawState"/>.</summary>
|
||||
public PhysicsStateFlags State => (PhysicsStateFlags)RawState;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue