mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 08:27:49 +08:00
Fix barlines being misaligned if generation start time is clamped
This commit is contained in:
parent
e69ed67335
commit
f9d952220f
@ -47,13 +47,28 @@ namespace osu.Game.Rulesets.Objects
|
|||||||
// Don't generate barlines before the hit object or t=0 (whichever is earliest). Some beatmaps use very unrealistic values here (although none are ranked).
|
// Don't generate barlines before the hit object or t=0 (whichever is earliest). Some beatmaps use very unrealistic values here (although none are ranked).
|
||||||
// I'm not sure we ever want barlines to appear before the first hitobject, but let's keep some degree of compatibility for now.
|
// I'm not sure we ever want barlines to appear before the first hitobject, but let's keep some degree of compatibility for now.
|
||||||
// Of note, this will still differ from stable if the first timing control point is t<0 and is not near the first hitobject.
|
// Of note, this will still differ from stable if the first timing control point is t<0 and is not near the first hitobject.
|
||||||
double startTime = Math.Max(Math.Min(0, firstHitTime), currentTimingPoint.Time);
|
double generationStartTime = Math.Min(0, firstHitTime);
|
||||||
|
|
||||||
// Stop on the next timing point, or if there is no next timing point stop slightly past the last object
|
// Stop on the next timing point, or if there is no next timing point stop slightly past the last object
|
||||||
double endTime = i < timingPoints.Count - 1 ? timingPoints[i + 1].Time : lastHitTime + currentTimingPoint.BeatLength * currentTimingPoint.TimeSignature.Numerator;
|
double endTime = i < timingPoints.Count - 1 ? timingPoints[i + 1].Time : lastHitTime + currentTimingPoint.BeatLength * currentTimingPoint.TimeSignature.Numerator;
|
||||||
|
|
||||||
double barLength = currentTimingPoint.BeatLength * currentTimingPoint.TimeSignature.Numerator;
|
double barLength = currentTimingPoint.BeatLength * currentTimingPoint.TimeSignature.Numerator;
|
||||||
|
|
||||||
|
double startTime;
|
||||||
|
|
||||||
|
if (currentTimingPoint.Time > generationStartTime)
|
||||||
|
{
|
||||||
|
startTime = currentTimingPoint.Time;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// If the timing point starts before the minimum allowable time for bar lines,
|
||||||
|
// we still need to compute a start time for generation that is actually properly aligned with the timing point.
|
||||||
|
int barCount = (int)Math.Ceiling((generationStartTime - currentTimingPoint.Time) / barLength);
|
||||||
|
|
||||||
|
startTime = currentTimingPoint.Time + barCount * barLength;
|
||||||
|
}
|
||||||
|
|
||||||
if (currentEffectPoint.OmitFirstBarLine)
|
if (currentEffectPoint.OmitFirstBarLine)
|
||||||
{
|
{
|
||||||
startTime += barLength;
|
startTime += barLength;
|
||||||
|
Loading…
Reference in New Issue
Block a user