From e77dc1a0e874169aa94120806bc63d4aed816b7c Mon Sep 17 00:00:00 2001 From: Erik Date: Mon, 13 Apr 2026 00:44:38 +0200 Subject: [PATCH] fix(anim): call Sequencer.SetCycle on motion changes The sequencer was initialized at spawn but never notified when the player started walking/running/turning. UpdatePlayerAnimation and OnLiveMotionUpdated both updated the legacy slerp fields but the sequencer path in TickAnimations reads from Sequencer.Advance(dt), which stayed at the initial idle cycle. Fix: both methods now call ae.Sequencer.SetCycle(style, motion) when the sequencer exists, alongside the legacy field updates (which serve as fallback for entities without a sequencer). Co-Authored-By: Claude Opus 4.6 (1M context) --- src/AcDream.App/Rendering/GameWindow.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/AcDream.App/Rendering/GameWindow.cs b/src/AcDream.App/Rendering/GameWindow.cs index 4c739f1..6186e33 100644 --- a/src/AcDream.App/Rendering/GameWindow.cs +++ b/src/AcDream.App/Rendering/GameWindow.cs @@ -951,6 +951,14 @@ public sealed class GameWindow : IDisposable if (!newCycleIsGood) return; + // If the entity has a sequencer, use SetCycle for transition links. + if (ae.Sequencer is not null) + { + uint fullStyle = stance != 0 ? (0x80000000u | (uint)stance) : ae.Sequencer.CurrentStyle; + uint fullMotion = command is > 0 ? (uint)command.Value : 0x41000003u; + ae.Sequencer.SetCycle(fullStyle, fullMotion); + } + ae.Animation = newCycle!.Animation; ae.LowFrame = Math.Max(0, newCycle.LowFrame); ae.HighFrame = Math.Min(newCycle.HighFrame, newCycle.Animation.PartFrames.Count - 1); @@ -2048,6 +2056,14 @@ public sealed class GameWindow : IDisposable if (cycle is null || cycle.Framerate == 0f || cycle.HighFrame <= cycle.LowFrame) return; + // If the entity has a sequencer, use SetCycle for transition-link-aware + // motion switching. Otherwise update the legacy slerp path fields. + if (ae.Sequencer is not null) + { + uint fullStyle = 0x80000000u | (uint)NonCombatStance; + ae.Sequencer.SetCycle(fullStyle, animCommand); + } + ae.Animation = cycle.Animation; ae.LowFrame = Math.Max(0, cycle.LowFrame); ae.HighFrame = Math.Min(cycle.HighFrame, cycle.Animation.PartFrames.Count - 1);