1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 09:22:54 +08:00

Account for user/system offsets when deciding on an initial seek time

Closes #3043
Remove "AllowLeadIn" flag
This commit is contained in:
Dean Herbert 2019-03-26 16:17:20 +09:00
parent e017350b80
commit 651706b10e

View File

@ -26,6 +26,10 @@ namespace osu.Game.Screens.Play
private readonly WorkingBeatmap beatmap;
private readonly IReadOnlyList<Mod> mods;
private readonly bool allowLeadIn;
private readonly double gameplayStartTime;
/// <summary>
/// The original source (usually a <see cref="WorkingBeatmap"/>'s track).
/// </summary>
@ -60,6 +64,8 @@ namespace osu.Game.Screens.Play
private readonly FramedOffsetClock platformOffsetClock;
private double totalOffset => userOffsetClock.Offset + platformOffsetClock.Offset;
public GameplayClockContainer(WorkingBeatmap beatmap, IReadOnlyList<Mod> mods, double gameplayStartTime)
{
this.beatmap = beatmap;
@ -93,6 +99,9 @@ namespace osu.Game.Screens.Play
userAudioOffset = config.GetBindable<double>(OsuSetting.AudioOffset);
userAudioOffset.BindValueChanged(offset => userOffsetClock.Offset = offset.NewValue, true);
adjustableClock.Seek(Math.Min(0, gameplayStartTime - totalOffset - (allowLeadIn ? beatmap.BeatmapInfo.AudioLeadIn : 0)));
adjustableClock.ProcessFrame();
UserPlaybackRate.ValueChanged += _ => updateRate();
Seek(Math.Min(-beatmap.BeatmapInfo.AudioLeadIn, gameplayStartTime));