Add inline commentary about workarounds in beatmap conversion test

This commit is contained in:
Bartłomiej Dach 2023-10-16 13:40:45 +02:00
parent 937694cd14
commit b3d60c6d4f
No known key found for this signature in database
1 changed files with 12 additions and 0 deletions

View File

@ -39,6 +39,14 @@ protected override IEnumerable<ConvertValue> CreateConvertValue(HitObject hitObj
foreach (var nested in slider.NestedHitObjects)
objects.Add(createConvertValue((OsuHitObject)nested, slider));
// stable does slider tail leniency by offsetting the last tick 36ms back.
// based on player feedback, we're doing this a little different in lazer,
// and the lazer method does not require offsetting the last tick
// (see `DrawableSliderTail.CheckForResult()`).
// however, in conversion tests, just so the output matches, we're bringing
// the 36ms offset back locally.
// in particular, on some sliders, this may rearrange nested objects,
// so we sort them again by start time to prevent test failures.
foreach (var obj in objects.OrderBy(cv => cv.StartTime))
yield return obj;
@ -55,6 +63,10 @@ static ConvertValue createConvertValue(OsuHitObject obj, OsuHitObject? parent =
double startTime = obj.StartTime;
double endTime = obj.GetEndTime();
// as stated in the inline comment above, this is locally bringing back
// the stable treatment of the "legacy last tick" just to make sure
// that the conversion output matches.
// compare: `SliderEventGenerator.Generate()`, and the calculation of `legacyLastTickTime`.
if (obj is SliderTailCircle && parent is Slider slider)
{
startTime = Math.Max(startTime + SliderEventGenerator.TAIL_LENIENCY, slider.StartTime + slider.Duration / 2);