diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModAlternate.cs b/osu.Game.Rulesets.Osu/Mods/OsuModAlternate.cs index b9f25bd1cf..46b97dd23b 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModAlternate.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModAlternate.cs @@ -16,7 +16,7 @@ using osu.Game.Screens.Play; namespace osu.Game.Rulesets.Osu.Mods { - public class OsuModAlternate : Mod, IApplicableToDrawableRuleset, IApplicableToPlayer, IUpdatableByPlayfield + public class OsuModAlternate : Mod, IApplicableToDrawableRuleset, IApplicableToPlayer { public override string Name => @"Alternate"; public override string Acronym => @"AL"; @@ -26,20 +26,23 @@ namespace osu.Game.Rulesets.Osu.Mods public override ModType Type => ModType.Conversion; public override IconUsage? Icon => FontAwesome.Solid.Keyboard; - private bool introEnded; - private double earliestStartTime; + private double firstObjectValidJudgementTime; private IBindable isBreakTime; private const double flash_duration = 1000; private OsuAction? lastActionPressed; private DrawableRuleset ruleset; + private IFrameStableClock gameplayClock; + public void ApplyToDrawableRuleset(DrawableRuleset drawableRuleset) { ruleset = drawableRuleset; drawableRuleset.KeyBindingInputManager.Add(new InputInterceptor(this)); var firstHitObject = ruleset.Objects.FirstOrDefault(); - earliestStartTime = (firstHitObject?.StartTime ?? 0) - (firstHitObject?.HitWindows.WindowFor(HitResult.Meh) ?? 0); + firstObjectValidJudgementTime = (firstHitObject?.StartTime ?? 0) - (firstHitObject?.HitWindows.WindowFor(HitResult.Meh) ?? 0); + + gameplayClock = drawableRuleset.FrameStableClock; } public void ApplyToPlayer(Player player) @@ -57,7 +60,7 @@ namespace osu.Game.Rulesets.Osu.Mods if (isBreakTime.Value) return true; - if (!introEnded) + if (gameplayClock.CurrentTime < firstObjectValidJudgementTime) return true; switch (action) @@ -82,12 +85,6 @@ namespace osu.Game.Rulesets.Osu.Mods return false; } - public void Update(Playfield playfield) - { - if (!introEnded) - introEnded = playfield.Clock.CurrentTime > earliestStartTime; - } - private class InputInterceptor : Component, IKeyBindingHandler { private readonly OsuModAlternate mod;