1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 10:42:54 +08:00

Limit how far before the first hitobject that barlines can be generated

This commit is contained in:
Dean Herbert 2022-11-21 14:34:35 +09:00
parent 4a79141824
commit 40f2da364c

View File

@ -27,7 +27,10 @@ namespace osu.Game.Rulesets.Objects
if (beatmap.HitObjects.Count == 0)
return;
HitObject firstObject = beatmap.HitObjects.First();
HitObject lastObject = beatmap.HitObjects.Last();
double firstHitTime = firstObject.StartTime;
double lastHitTime = 1 + lastObject.GetEndTime();
var timingPoints = beatmap.ControlPointInfo.TimingPoints;
@ -41,10 +44,14 @@ namespace osu.Game.Rulesets.Objects
EffectControlPoint currentEffectPoint = beatmap.ControlPointInfo.EffectPointAt(currentTimingPoint.Time);
int currentBeat = 0;
// 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.
// 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);
// 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 startTime = currentTimingPoint.Time;
double barLength = currentTimingPoint.BeatLength * currentTimingPoint.TimeSignature.Numerator;
if (currentEffectPoint.OmitFirstBarLine)