feat(R2-Q4): adapter cutover — SetCycle/PlayAction rehosted on PerformMovement; Fix B / fast-path / stop-anim fallback / G17 gate DELETED

AnimationSequencer becomes a thin shim over the verbatim R2 stack:
SetCycle dispatches the style change (Branch 1) then the motion (Branch
2/3/4) through MotionTableManager.PerformMovement; PlayAction is the
same dispatch (actions rebuild via Branch 3; modifiers are Branch 4
physics-only combine_motion — the AP-73 turn-blend mechanism now runs
for real). CurrentStyle/CurrentMotion/CurrentSpeedMod are read-only
mirrors of MotionState (post-adjust_motion, signed mod). Lazy
initialize_state on first drive (retail lazy-create analog) keeps
undriven sequencers do-nothing.

DELETED legacy inventions (net -648 lines): the adapter fast-path
(replaced by Branch-2 fast re-speed: change_cycle_speed +
subtract/combine_motion), Fix B + IsLocomotionCycleLowByte (replaced by
remove_redundant_links on the pending queue — the retail mechanism the
2026-05-03 cdb trace pointed at), the stop-anim low-byte fallback
(replaced by get_link's reversed-key double-hop — retail's actual
backward-walk settle plays the windup link REVERSED), GetLink/BuildNode/
EnqueueMotionData + the G17 HasVelocity/HasOmega gate (add_motion sets
unconditionally), MultiplyCyclicFramerate + the G13 composite,
PlayAction's insert-before-tail machinery, SCFAST/SCFULL diagnostics.
KEPT at the adapter (register rows): the boundary adjust_motion remap +
locomotion velocity/omega synthesis (AP-75, retire R3-W6/R6), K-fix18
skip-link as post-dispatch RemoveAllLinkAnimations (AP-74, retire
R3-W4 when LeaveGround fires it).

GameWindow queue-drain wiring (the §4 G6 seam): each drained AnimDone
hook → manager.AnimationDone(true) (retail AnimDoneHook::Execute
0x00526c20 → Hook_AnimDone 0x0050fda0 chain), UseTime once per tick
(0x00517d57/0x00517d67); IMotionDoneSink bound to an
ACDREAM_DUMP_MOTION recorder (AD-36 — R3 rebinds to
MotionInterpreter.MotionDone).

Conformance: the 11-scenario pre-cutover trace suite (a6235a36) replays
green with six EXPECTED-DIFF annotations (double-hop walk-run routing,
reversed settle links, Branch-4 physics-only modifiers, Branch-1
style-change links, post-adjust mirrors) — everything unannotated is
byte-identical. Legacy suites repaired by a dedicated agent (fixtures
gain the retail-mandatory StyleDefaults + class-bit-tagged ids;
reflection state-poking replaced with real dispatch; zero category-D
regressions — the suspected cursor bug was a fixture class-bit gap),
plus two vacuously-passing tests fixed. Register: stale IA-4 deleted
(R1-P1 ported the negative-factor swap).

Full suite green: 3,458 passed (374+425+713+1946).

Closes H6, H7, H8, H9, H10-adapter, H16-wiring (r2-port-plan.md §3 Q4).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Erik 2026-07-02 21:41:27 +02:00
parent cd0289bea2
commit 3b9d9bb6be
6 changed files with 562 additions and 646 deletions

View file

@ -254,8 +254,16 @@ public sealed class AnimationSequencerCutoverTraceTests
seq.SetCycle(NC, Ready);
seq.SetCycle(NC, Walk, 1.0f);
seq.SetCycle(NC, Run, 2.0f);
// EXPECTED-DIFF(Q4): pre-cutover Fix B stripped every link leaving
// "102@60.0*^". The verbatim GetObjectSequence (Branch 2, no direct
// Walk->Run link in this fixture) routes the DOUBLE-HOP: Walk->Ready
// settle (105 at the OLD substate mod) + Ready->Run windup (104 at
// the new speed) + the Run cycle; the old Ready->Walk link (103)
// keeps draining first (pending-queue discipline). Rapid same-motion
// re-issues now collapse via remove_redundant_links (the retail
// Fix B), not an adapter locomotion special case.
Assert.Equal(
"102@60.0*^ | frame=0.0 vel=(0.00,8.00,0.00) om=(0.00,0.00,0.00) style=8000003D motion=44000007 mod=2.00",
"103@30.0^,105@30.0,104@60.0,102@60.0* | frame=0.0 vel=(0.00,8.00,0.00) om=(0.00,0.00,0.00) style=8000003D motion=44000007 mod=2.00",
Describe(seq, loader));
}
@ -267,8 +275,12 @@ public sealed class AnimationSequencerCutoverTraceTests
seq.SetCycle(NC, Walk, 1.0f);
seq.SetCycle(NC, Run, 2.0f);
seq.SetCycle(NC, Run, 2.5f);
// EXPECTED-DIFF(Q4): inherits S3's double-hop list; the re-speed
// itself is the verbatim Branch-2 fast path (change_cycle_speed
// scales ONLY first_cyclic..tail: 102 60->75; links untouched;
// velocity via subtract_motion(2.0)+combine_motion(2.5)).
Assert.Equal(
"102@75.0*^ | frame=0.0 vel=(0.00,10.00,0.00) om=(0.00,0.00,0.00) style=8000003D motion=44000007 mod=2.50",
"103@30.0^,105@30.0,104@60.0,102@75.0* | frame=0.0 vel=(0.00,10.00,0.00) om=(0.00,0.00,0.00) style=8000003D motion=44000007 mod=2.50",
Describe(seq, loader));
}
@ -278,11 +290,18 @@ public sealed class AnimationSequencerCutoverTraceTests
var seq = NewSeq(out var loader);
seq.SetCycle(NC, Ready);
seq.SetCycle(NC, WalkBack, 1.0f);
// Reversed-key GetLink resolves the Walk→Ready link (0x105) played in
// reverse (fr=-19.5 = 30 × -0.65 BackwardsFactor); cursor starts at
// the link's reverse starting frame (HighFrame+1 = 3).
// Node list BYTE-IDENTICAL to pre-cutover: the reversed-key get_link
// resolves the Walk->Ready link (0x105) played in reverse (fr=-19.5 =
// 30 x -0.65 BackwardsFactor); cursor at the reverse starting frame
// (HighFrame+1 = 3).
// EXPECTED-DIFF(Q4), mirrors only: CurrentMotion now reads the
// POST-adjust_motion substate (45000005, was 45000006) and
// CurrentSpeedMod the signed mod (-0.65, was 1.00) - MotionState owns
// the state and retail's interpreted state is post-adjustment. The
// om=(-0.00,...) is IEEE negative zero from add_motion's
// zero-omega x negative-speed multiply (numerically equal to 0).
Assert.Equal(
"105@-19.5^,101@-19.5* | frame=3.0 vel=(0.00,-2.03,0.00) om=(0.00,0.00,0.00) style=8000003D motion=45000006 mod=1.00",
"105@-19.5^,101@-19.5* | frame=3.0 vel=(0.00,-2.03,0.00) om=(-0.00,-0.00,-0.00) style=8000003D motion=45000005 mod=-0.65",
Describe(seq, loader));
}
@ -293,12 +312,14 @@ public sealed class AnimationSequencerCutoverTraceTests
seq.SetCycle(NC, Ready);
seq.SetCycle(NC, WalkBack, 1.0f);
seq.SetCycle(NC, Ready, 1.0f);
// Pre-cutover: the OLD reversed link (0x105@-19.5, mid-drain) stays at
// the head while the settle link (0x105@30, via the stop-anim
// low-byte fallback 0x06→0x05) and the Ready cycle append behind it —
// link-before-link stacking.
// EXPECTED-DIFF(Q4): pre-cutover the stop-anim low-byte fallback
// re-keyed the settle as 105@30 (forward). The verbatim get_link
// (SubstateMod=-0.65 routes the REVERSED-key branch) resolves the
// Ready->Walk windup (103) played in REVERSE (fr=-30) - retail's
// actual backward-walk settle. The old reversed link (105@-19.5,
// mid-drain) still drains first, unchanged from pre-cutover.
Assert.Equal(
"105@-19.5^,105@30.0,100@30.0* | frame=3.0 vel=(0.00,0.00,0.00) om=(0.00,0.00,0.00) style=8000003D motion=41000003 mod=1.00",
"105@-19.5^,103@-30.0,100@30.0* | frame=3.0 vel=(0.00,0.00,0.00) om=(0.00,0.00,0.00) style=8000003D motion=41000003 mod=1.00",
Describe(seq, loader));
}
@ -332,8 +353,13 @@ public sealed class AnimationSequencerCutoverTraceTests
seq.SetCycle(NC, Ready);
seq.SetCycle(NC, Walk, 1.0f);
seq.PlayAction(TurnMod, 1.0f);
// EXPECTED-DIFF(Q4): pre-cutover PlayAction INSERTED the modifier's
// anim (109) before the cyclic tail - an acdream invention. Retail
// Branch 4 is PHYSICS-ONLY combine_motion (the AP-73 mechanism): the
// walk cycle's frames are untouched, the modifier contributes omega
// (0,0,1.5) and is tracked on the MotionState modifier stack.
Assert.Equal(
"103@30.0^,109@30.0,101@30.0* | frame=0.0 vel=(0.00,3.12,0.00) om=(0.00,0.00,1.50) style=8000003D motion=45000005 mod=1.00",
"103@30.0^,101@30.0* | frame=0.0 vel=(0.00,3.12,0.00) om=(0.00,0.00,1.50) style=8000003D motion=45000005 mod=1.00",
Describe(seq, loader));
}
@ -343,8 +369,12 @@ public sealed class AnimationSequencerCutoverTraceTests
var seq = NewSeq(out var loader);
seq.SetCycle(NC, Ready);
seq.SetCycle(Style2, Ready, 1.0f);
// EXPECTED-DIFF(Q4): pre-cutover switched cycles bare ("107@30.0*^").
// GetObjectSequence Branch 1 (style-change) plays the cross-style
// entry link (10A = Ready->Style2) before the target style's default
// cycle - retail's stance-transition animation.
Assert.Equal(
"107@30.0*^ | frame=0.0 vel=(0.00,0.00,0.00) om=(0.00,0.00,0.00) style=8000004C motion=41000003 mod=1.00",
"10A@30.0^,107@30.0* | frame=0.0 vel=(0.00,0.00,0.00) om=(0.00,0.00,0.00) style=8000004C motion=41000003 mod=1.00",
Describe(seq, loader));
}
}