feat(net+app): Phase 6.3 — extract server MotionTableId and use as resolver override
The Foundry's drudge statue Setup (0x020007DD) has DefaultMotionTable=0, so MotionResolver returned null and the renderer fell back to PlacementFrames[Default] — an upright pose, which is wrong. The retail crouched/aggressive pose comes from a per-instance motion table the server attaches via PhysicsDescriptionFlag.MTable (confirmed live as 0x090000DA for the statue). CreateObject.TryParse was already walking the MTable field but discarding the value. Now it captures it as Parsed.MotionTableId and WorldSession.EntitySpawn forwards it. GameWindow passes it as the motionTableIdOverride to MotionResolver.GetIdleFrame, so the cycle lookup uses the server-supplied table when the dat-side default is empty. With this in place the drudge resolves a real cycle and renders in the correct crouched pose. Trimmed the heavy STATUE motion-table dump diagnostics now that the mechanism is verified; left a one-line summary so future regressions remain debuggable. 160 tests green. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
120e801ecf
commit
b96167e066
3 changed files with 18 additions and 7 deletions
|
|
@ -542,6 +542,7 @@ public sealed class GameWindow : IDisposable
|
|||
if (isStatue)
|
||||
{
|
||||
Console.WriteLine($"live: [STATUE] objScale={spawn.ObjScale?.ToString("F3") ?? "null"}");
|
||||
Console.WriteLine($"live: [STATUE] mtable=0x{(spawn.MotionTableId ?? 0):X8} stance=0x{(spawn.MotionState?.Stance ?? 0):X4} cmd=0x{(spawn.MotionState?.ForwardCommand ?? 0):X4}");
|
||||
if (spawn.TextureChanges is { } tcs)
|
||||
{
|
||||
foreach (var tc in tcs)
|
||||
|
|
@ -577,7 +578,6 @@ public sealed class GameWindow : IDisposable
|
|||
int subCount = pgfx?.Surfaces.Count ?? -1;
|
||||
Console.WriteLine($"live: [STATUE] part[{pi}] gfxObj=0x{partGfxId:X8} surfaces={subCount}");
|
||||
}
|
||||
// The placement frame the existing flatten logic uses.
|
||||
Console.WriteLine($"live: [STATUE] placementFrames count={baseSetup.PlacementFrames.Count}");
|
||||
}
|
||||
}
|
||||
|
|
@ -633,8 +633,14 @@ public sealed class GameWindow : IDisposable
|
|||
// resolving the cycle key from those gives the aggressive crouch.
|
||||
ushort? stanceOverride = spawn.MotionState?.Stance;
|
||||
ushort? commandOverride = spawn.MotionState?.ForwardCommand;
|
||||
// Critical for entities like the Foundry's drudge statue: their
|
||||
// base Setup has DefaultMotionTable=0, but the server tells us
|
||||
// which motion table to use via PhysicsDescriptionFlag.MTable.
|
||||
// Without this override the resolver returns null and we fall
|
||||
// back to PlacementFrames[Default] which renders the wrong pose.
|
||||
var idleFrame = AcDream.Core.Meshing.MotionResolver.GetIdleFrame(
|
||||
setup, _dats, motionTableIdOverride: null,
|
||||
setup, _dats,
|
||||
motionTableIdOverride: spawn.MotionTableId,
|
||||
stanceOverride: stanceOverride,
|
||||
commandOverride: commandOverride);
|
||||
var flat = AcDream.Core.Meshing.SetupMesh.Flatten(setup, idleFrame);
|
||||
|
|
|
|||
|
|
@ -91,7 +91,8 @@ public static class CreateObject
|
|||
uint? BasePaletteId,
|
||||
float? ObjScale,
|
||||
string? Name,
|
||||
ServerMotionState? MotionState);
|
||||
ServerMotionState? MotionState,
|
||||
uint? MotionTableId);
|
||||
|
||||
/// <summary>
|
||||
/// The relevant subset of the server-sent <c>MovementData</c> /
|
||||
|
|
@ -156,6 +157,7 @@ public static class CreateObject
|
|||
uint? setupTableId = null;
|
||||
float? objScale = null;
|
||||
ServerMotionState? motionState = null;
|
||||
uint? motionTableId = null;
|
||||
|
||||
try
|
||||
{
|
||||
|
|
@ -274,6 +276,7 @@ public static class CreateObject
|
|||
if ((physicsFlags & PhysicsDescriptionFlag.MTable) != 0)
|
||||
{
|
||||
if (body.Length - pos < 4) return null;
|
||||
motionTableId = BinaryPrimitives.ReadUInt32LittleEndian(body.Slice(pos));
|
||||
pos += 4;
|
||||
}
|
||||
|
||||
|
|
@ -346,13 +349,13 @@ public static class CreateObject
|
|||
}
|
||||
|
||||
return new Parsed(guid, position, setupTableId, animParts,
|
||||
textureChanges, subPalettes, basePaletteId, objScale, name, motionState);
|
||||
textureChanges, subPalettes, basePaletteId, objScale, name, motionState, motionTableId);
|
||||
|
||||
// Local helper: if we ran out of fields past PhysicsData, still
|
||||
// return the useful prefix (guid/position/setup/animParts/textures/palettes/scale/motion).
|
||||
Parsed PartialResult() => new(
|
||||
guid, position, setupTableId, animParts,
|
||||
textureChanges, subPalettes, basePaletteId, objScale, null, motionState);
|
||||
textureChanges, subPalettes, basePaletteId, objScale, null, motionState, motionTableId);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
|
|
|||
|
|
@ -52,7 +52,8 @@ public sealed class WorldSession : IDisposable
|
|||
uint? BasePaletteId,
|
||||
float? ObjScale,
|
||||
string? Name,
|
||||
CreateObject.ServerMotionState? MotionState);
|
||||
CreateObject.ServerMotionState? MotionState,
|
||||
uint? MotionTableId);
|
||||
|
||||
/// <summary>Fires when the session finishes parsing a CreateObject.</summary>
|
||||
public event Action<EntitySpawn>? EntitySpawned;
|
||||
|
|
@ -238,7 +239,8 @@ public sealed class WorldSession : IDisposable
|
|||
parsed.Value.BasePaletteId,
|
||||
parsed.Value.ObjScale,
|
||||
parsed.Value.Name,
|
||||
parsed.Value.MotionState));
|
||||
parsed.Value.MotionState,
|
||||
parsed.Value.MotionTableId));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue