From 0f997386aef703dc440d9afb0e1ee6e0227304ec Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 30 Oct 2020 15:26:21 +0900 Subject: [PATCH] Fix direction and IsRunning not updating on first frame after becoming valid The parent clock will not unpause until WaitingForFrames becomes false, so I've moved the set of that before we start to propagate its values across. Doesn't fix any visible issue but should make propagation one game loop faster. --- osu.Game/Rulesets/UI/FrameStabilityContainer.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Game/Rulesets/UI/FrameStabilityContainer.cs b/osu.Game/Rulesets/UI/FrameStabilityContainer.cs index 1ff8fc9715..8a7f8d2739 100644 --- a/osu.Game/Rulesets/UI/FrameStabilityContainer.cs +++ b/osu.Game/Rulesets/UI/FrameStabilityContainer.cs @@ -144,22 +144,22 @@ namespace osu.Game.Rulesets.UI state = PlaybackState.NotValid; } - if (proposedTime != manualClock.CurrentTime) + if (state == PlaybackState.Valid) direction = proposedTime >= manualClock.CurrentTime ? 1 : -1; + double timeBehind = Math.Abs(proposedTime - parentGameplayClock.CurrentTime); + + frameStableClock.IsCatchingUp.Value = timeBehind > 200; + frameStableClock.WaitingOnFrames.Value = state == PlaybackState.NotValid; + manualClock.CurrentTime = proposedTime; manualClock.Rate = Math.Abs(parentGameplayClock.Rate) * direction; manualClock.IsRunning = parentGameplayClock.IsRunning; - double timeBehind = Math.Abs(manualClock.CurrentTime - parentGameplayClock.CurrentTime); - // determine whether catch-up is required. if (state == PlaybackState.Valid && timeBehind > 0) state = PlaybackState.RequiresCatchUp; - frameStableClock.IsCatchingUp.Value = timeBehind > 200; - frameStableClock.WaitingOnFrames.Value = state == PlaybackState.NotValid; - // The manual clock time has changed in the above code. The framed clock now needs to be updated // to ensure that the its time is valid for our children before input is processed framedClock.ProcessFrame();