1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-12 23:12:59 +08:00

Tidy up WorkingBeatmap passing in ctor

This commit is contained in:
Dean Herbert 2025-02-03 19:26:14 +09:00
parent a23de0b188
commit 99192404f1
No known key found for this signature in database

View File

@ -12,6 +12,7 @@ using osu.Framework.Timing;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints; using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Overlays; using osu.Game.Overlays;
using osu.Game.Storyboards;
namespace osu.Game.Screens.Play namespace osu.Game.Screens.Play
{ {
@ -72,10 +73,10 @@ namespace osu.Game.Screens.Play
track = working.Track; track = working.Track;
GameplayStartTime = gameplayStartTime; GameplayStartTime = gameplayStartTime;
StartTime = findEarliestStartTime(gameplayStartTime, working); StartTime = findEarliestStartTime(gameplayStartTime, beatmap, working.Storyboard);
} }
private static double findEarliestStartTime(double gameplayStartTime, WorkingBeatmap working) private static double findEarliestStartTime(double gameplayStartTime, IBeatmap beatmap, Storyboard storyboard)
{ {
// here we are trying to find the time to start playback from the "zero" point. // here we are trying to find the time to start playback from the "zero" point.
// generally this is either zero, or some point earlier than zero in the case of storyboards, lead-ins etc. // generally this is either zero, or some point earlier than zero in the case of storyboards, lead-ins etc.
@ -85,15 +86,15 @@ namespace osu.Game.Screens.Play
// if a storyboard is present, it may dictate the appropriate start time by having events in negative time space. // if a storyboard is present, it may dictate the appropriate start time by having events in negative time space.
// this is commonly used to display an intro before the audio track start. // this is commonly used to display an intro before the audio track start.
double? firstStoryboardEvent = working.Storyboard.EarliestEventTime; double? firstStoryboardEvent = storyboard.EarliestEventTime;
if (firstStoryboardEvent != null) if (firstStoryboardEvent != null)
time = Math.Min(time, firstStoryboardEvent.Value); time = Math.Min(time, firstStoryboardEvent.Value);
// some beatmaps specify a current lead-in time which should be used instead of the ruleset-provided value when available. // some beatmaps specify a current lead-in time which should be used instead of the ruleset-provided value when available.
// this is not available as an option in the live editor but can still be applied via .osu editing. // this is not available as an option in the live editor but can still be applied via .osu editing.
double firstHitObjectTime = working.Beatmap.HitObjects.First().StartTime; double firstHitObjectTime = beatmap.HitObjects.First().StartTime;
if (working.Beatmap.AudioLeadIn > 0) if (beatmap.AudioLeadIn > 0)
time = Math.Min(time, firstHitObjectTime - working.Beatmap.AudioLeadIn); time = Math.Min(time, firstHitObjectTime - beatmap.AudioLeadIn);
return time; return time;
} }