mirror of
https://github.com/ppy/osu.git
synced 2025-03-25 03:07:34 +08:00
Fix slider event generator incorrectly not generating repeats when tick distance is zero
RFC. This closes https://github.com/ppy/osu/issues/31186. To explain why: The issue occurs on https://osu.ppy.sh/beatmapsets/594828#osu/1258033, specifically on the slider at time 128604. The failure site isfa0d2f4af2/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderCircleOverlay.cs (L65-L66)
wherein `LastRepeat` is `null`, even though the slider's `RepeatCount` is 1 and thus `SpanCount` is 2. In this case, `SliderEventGenerator` is given a non-zero `tickDistance` but a zero `length`. The former is clamped to the latter:fa0d2f4af2/osu.Game/Rulesets/Objects/SliderEventGenerator.cs (L34)
Because of this, a whole block of code pertaining to tick generation gets turned off, because of zero tick spacing - however, that block also includes within it *repeat* generation, for seemingly very little reason whatsoever:fa0d2f4af2/osu.Game/Rulesets/Objects/SliderEventGenerator.cs (L47-L77)
While a zero tick distance would indeed cause `generateTicks()` to loop forever, it should have absolutely no effect on repeats. While this *is* ultimately an aspire-tier bug caused by people pushing things to limits, I do believe that in this case a fix is warranted because of how hard the current behaviour violates invariants. I do not like the possibility of having a slider with multiple spans and no repeats.
This commit is contained in:
parent
ecf64dfc57
commit
e7225399a2
@ -44,13 +44,13 @@ namespace osu.Game.Rulesets.Objects
|
||||
PathProgress = 0,
|
||||
};
|
||||
|
||||
if (tickDistance != 0)
|
||||
for (int span = 0; span < spanCount; span++)
|
||||
{
|
||||
for (int span = 0; span < spanCount; span++)
|
||||
{
|
||||
double spanStartTime = startTime + span * spanDuration;
|
||||
bool reversed = span % 2 == 1;
|
||||
double spanStartTime = startTime + span * spanDuration;
|
||||
bool reversed = span % 2 == 1;
|
||||
|
||||
if (tickDistance != 0)
|
||||
{
|
||||
var ticks = generateTicks(span, spanStartTime, spanDuration, reversed, length, tickDistance, minDistanceFromEnd, cancellationToken);
|
||||
|
||||
if (reversed)
|
||||
@ -61,18 +61,18 @@ namespace osu.Game.Rulesets.Objects
|
||||
|
||||
foreach (var e in ticks)
|
||||
yield return e;
|
||||
}
|
||||
|
||||
if (span < spanCount - 1)
|
||||
if (span < spanCount - 1)
|
||||
{
|
||||
yield return new SliderEventDescriptor
|
||||
{
|
||||
yield return new SliderEventDescriptor
|
||||
{
|
||||
Type = SliderEventType.Repeat,
|
||||
SpanIndex = span,
|
||||
SpanStartTime = startTime + span * spanDuration,
|
||||
Time = spanStartTime + spanDuration,
|
||||
PathProgress = (span + 1) % 2,
|
||||
};
|
||||
}
|
||||
Type = SliderEventType.Repeat,
|
||||
SpanIndex = span,
|
||||
SpanStartTime = startTime + span * spanDuration,
|
||||
Time = spanStartTime + spanDuration,
|
||||
PathProgress = (span + 1) % 2,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user