mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
Make snapped time always positive
This commit is contained in:
@ -183,9 +183,15 @@ namespace osu.Game.Beatmaps.ControlPoints
|
|||||||
private static double getClosestSnappedTime(TimingControlPoint timingPoint, double time, int beatDivisor)
|
private static double getClosestSnappedTime(TimingControlPoint timingPoint, double time, int beatDivisor)
|
||||||
{
|
{
|
||||||
double beatLength = timingPoint.BeatLength / beatDivisor;
|
double beatLength = timingPoint.BeatLength / beatDivisor;
|
||||||
int beatLengths = (int)Math.Round((time - timingPoint.Time) / beatLength, MidpointRounding.AwayFromZero);
|
double beats = (Math.Max(time, 0) - timingPoint.Time) / beatLength;
|
||||||
|
|
||||||
return timingPoint.Time + beatLengths * beatLength;
|
int roundedBeats = (int)Math.Round(beats, MidpointRounding.AwayFromZero);
|
||||||
|
double snappedTime = timingPoint.Time + roundedBeats * beatLength;
|
||||||
|
|
||||||
|
if (snappedTime >= 0)
|
||||||
|
return snappedTime;
|
||||||
|
|
||||||
|
return snappedTime + beatLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Reference in New Issue
Block a user