Merge pull request #4674 from peppy/fix-lead-in-issues

Fix lead-in time being too short
This commit is contained in:
Dean Herbert 2019-04-27 21:14:32 +09:00 committed by GitHub
commit 1e192d08c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 5 deletions

View File

@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Input;
@ -61,7 +62,7 @@ namespace osu.Game.Rulesets.Osu.UI
get
{
var first = (OsuHitObject)Objects.First();
return first.StartTime - first.TimePreempt;
return first.StartTime - Math.Max(2000, first.TimePreempt);
}
}
}

View File

@ -95,8 +95,7 @@ namespace osu.Game.Screens.Play
UserPlaybackRate.ValueChanged += _ => updateRate();
Seek(Math.Min(0, gameplayStartTime - beatmap.BeatmapInfo.AudioLeadIn));
adjustableClock.ProcessFrame();
Seek(Math.Min(-beatmap.BeatmapInfo.AudioLeadIn, gameplayStartTime));
}
public void Restart()
@ -137,6 +136,9 @@ namespace osu.Game.Screens.Play
// remove the offset component here because most of the time we want the seek to be aligned to gameplay, not the audio track.
// we may want to consider reversing the application of offsets in the future as it may feel more correct.
adjustableClock.Seek(time - totalOffset);
// manually process frame to ensure GameplayClock is correctly updated after a seek.
userOffsetClock.ProcessFrame();
}
public void Stop()

View File

@ -7,6 +7,7 @@ using osu.Framework.Graphics.Textures;
using osu.Framework.Timing;
using osu.Game.Beatmaps;
using osu.Game.Rulesets;
using osuTK;
namespace osu.Game.Tests.Beatmaps
{
@ -67,9 +68,10 @@ namespace osu.Game.Tests.Beatmaps
public override bool Seek(double seek)
{
offset = Math.Min(seek, Length);
offset = MathHelper.Clamp(seek, 0, Length);
lastReferenceTime = null;
return true;
return offset == seek;
}
public override void Start()