Rename start time calculation method and add more commenting to explain purpose better

This commit is contained in:
Dean Herbert 2022-03-18 01:15:17 +09:00
parent e3ab5de8cd
commit c6be26eb01

View File

@ -100,15 +100,18 @@ namespace osu.Game.Screens.Play
bool isStarted = !IsPaused.Value; bool isStarted = !IsPaused.Value;
// If a custom start time was not specified, calculate the best value to use. // If a custom start time was not specified, calculate the best value to use.
double gameplayStartTime = StartTime ?? findBeatmapStartTime(); double gameplayStartTime = StartTime ?? findEarliestStartTime();
Reset(startClock: isStarted, gameplayStartTime: gameplayStartTime); Reset(startClock: isStarted, gameplayStartTime: gameplayStartTime);
} }
private double findBeatmapStartTime() private double findEarliestStartTime()
{ {
// start with the originally provided latest time as a sane default. // here we are trying to find the time to start playback from the "zero" point.
double time = latestGameplayStartTime; // generally this is either zero, or some point earlier than zero in the case of storyboards, lead-ins etc.
// start with the originally provided latest time (if before zero).
double time = Math.Min(0, latestGameplayStartTime);
// 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.