1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-17 17:17:19 +08:00

Document remaining pieces of LastTick and add back legacy prefix for generation flow

This commit is contained in:
Dean Herbert 2023-09-29 16:44:04 +09:00
parent dd6d09189e
commit 62bcb62842
2 changed files with 12 additions and 7 deletions

View File

@ -87,8 +87,8 @@ namespace osu.Game.Tests.Beatmaps
{
var events = SliderEventGenerator.Generate(start_time, span_duration, 1, span_duration / 2, span_duration, 1).ToArray();
Assert.That(events[2].Type, Is.EqualTo(SliderEventType.LastTick));
Assert.That(events[2].Time, Is.EqualTo(span_duration + SliderEventGenerator.LAST_TICK_OFFSET));
Assert.That(events[2].Type, Is.EqualTo(SliderEventType.LegacyLastTick));
Assert.That(events[2].Time, Is.EqualTo(span_duration + SliderEventGenerator.TAIL_LENIENCY));
}
[Test]

View File

@ -16,8 +16,12 @@ namespace osu.Game.Rulesets.Objects
/// until the true end of the slider. This very small amount of leniency makes it easier to jump away from fast sliders to the next hit object.
///
/// After discussion on how this should be handled going forward, players have unanimously stated that this lenience should remain in some way.
/// These days, this is implemented in the drawable implementation of Slider in the osu! ruleset.
///
/// We need to keep the <see cref="SliderEventType.LegacyLastTick"/> *only* for osu!catch conversion, which relies on it to generate tiny ticks
/// correctly.
/// </summary>
public const double LAST_TICK_OFFSET = -36;
public const double TAIL_LENIENCY = -36;
public static IEnumerable<SliderEventDescriptor> Generate(double startTime, double spanDuration, double velocity, double tickDistance, double totalDistance, int spanCount,
CancellationToken cancellationToken = default)
@ -84,14 +88,14 @@ namespace osu.Game.Rulesets.Objects
int finalSpanIndex = spanCount - 1;
double finalSpanStartTime = startTime + finalSpanIndex * spanDuration;
double finalSpanEndTime = Math.Max(startTime + totalDuration / 2, (finalSpanStartTime + spanDuration) + LAST_TICK_OFFSET);
double finalSpanEndTime = Math.Max(startTime + totalDuration / 2, (finalSpanStartTime + spanDuration) + TAIL_LENIENCY);
double finalProgress = (finalSpanEndTime - finalSpanStartTime) / spanDuration;
if (spanCount % 2 == 0) finalProgress = 1 - finalProgress;
yield return new SliderEventDescriptor
{
Type = SliderEventType.LastTick,
Type = SliderEventType.LegacyLastTick,
SpanIndex = finalSpanIndex,
SpanStartTime = finalSpanStartTime,
Time = finalSpanEndTime,
@ -183,9 +187,10 @@ namespace osu.Game.Rulesets.Objects
Tick,
/// <summary>
/// Occurs just before the tail. See <see cref="SliderEventGenerator.LAST_TICK_OFFSET"/>.
/// Occurs just before the tail. See <see cref="SliderEventGenerator.TAIL_LENIENCY"/>.
/// Should generally be ignored.
/// </summary>
LastTick,
LegacyLastTick,
Head,
Tail,
Repeat