Fix catch slider conversion for last droplets

This commit is contained in:
ekrctb 2019-01-21 17:53:00 +09:00
parent 161d0f0564
commit 67ea3beeb4

View File

@ -62,15 +62,22 @@ namespace osu.Game.Rulesets.Catch.Objects
X = X X = X
}); });
double lastDropletTime = StartTime; double lastTickTime = StartTime;
for (int span = 0; span < this.SpanCount(); span++) for (int span = 0; span < this.SpanCount(); span++)
{ {
var spanStartTime = StartTime + span * spanDuration; var spanStartTime = StartTime + span * spanDuration;
var reversed = span % 2 == 1; var reversed = span % 2 == 1;
for (double d = 0; d <= length; d += tickDistance) for (double d = tickDistance;; d += tickDistance)
{ {
bool isLastTick = false;
if (d + minDistanceFromEnd >= length)
{
d = length;
isLastTick = true;
}
var timeProgress = d / length; var timeProgress = d / length;
var distanceProgress = reversed ? 1 - timeProgress : timeProgress; var distanceProgress = reversed ? 1 - timeProgress : timeProgress;
@ -79,15 +86,15 @@ namespace osu.Game.Rulesets.Catch.Objects
if (LegacyLastTickOffset != null) if (LegacyLastTickOffset != null)
{ {
// If we're the last tick, apply the legacy offset // If we're the last tick, apply the legacy offset
if (span == this.SpanCount() - 1 && d + tickDistance > length) if (span == this.SpanCount() - 1 && isLastTick)
time = Math.Max(StartTime + Duration / 2, time - LegacyLastTickOffset.Value); time = Math.Max(StartTime + Duration / 2, time - LegacyLastTickOffset.Value);
} }
double tinyTickInterval = time - lastDropletTime; double tinyTickInterval = time - lastTickTime;
while (tinyTickInterval > 100) while (tinyTickInterval > 100)
tinyTickInterval /= 2; tinyTickInterval /= 2;
for (double t = lastDropletTime + tinyTickInterval; t < time; t += tinyTickInterval) for (double t = lastTickTime + tinyTickInterval; t < time; t += tinyTickInterval)
{ {
double progress = reversed ? 1 - (t - spanStartTime) / spanDuration : (t - spanStartTime) / spanDuration; double progress = reversed ? 1 - (t - spanStartTime) / spanDuration : (t - spanStartTime) / spanDuration;
@ -104,8 +111,11 @@ namespace osu.Game.Rulesets.Catch.Objects
}); });
} }
if (d > minDistanceFromEnd && Math.Abs(d - length) > minDistanceFromEnd) lastTickTime = time;
{
if (isLastTick)
break;
AddNested(new Droplet AddNested(new Droplet
{ {
StartTime = time, StartTime = time,
@ -119,9 +129,6 @@ namespace osu.Game.Rulesets.Catch.Objects
}); });
} }
lastDropletTime = time;
}
AddNested(new Fruit AddNested(new Fruit
{ {
Samples = Samples, Samples = Samples,