1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 02:32:55 +08:00

Fix storyboard outro time potentially running too long

This commit is contained in:
Dean Herbert 2023-02-06 16:39:44 +09:00
parent 9bcc6bf6da
commit 679ec986d5
2 changed files with 9 additions and 2 deletions

View File

@ -214,7 +214,9 @@ namespace osu.Game.Tests.Beatmaps.Formats
Assert.That(oneTime.EndTime, Is.EqualTo(4000 + loop_duration));
StoryboardSprite manyTimes = background.Elements.OfType<StoryboardSprite>().Single(s => s.Path == "many-times.png");
Assert.That(manyTimes.EndTime, Is.EqualTo(9000 + 40 * loop_duration));
// It is intentional that we don't consider the loop count (40) as part of the end time calculation to match stable's handling.
// If we were to include the loop count, storyboards which loop for stupid long loop counts would continue playing the outro forever.
Assert.That(manyTimes.EndTime, Is.EqualTo(9000 + loop_duration));
}
}
}

View File

@ -18,7 +18,12 @@ namespace osu.Game.Storyboards
public readonly int TotalIterations;
public override double StartTime => LoopStartTime + CommandsStartTime;
public override double EndTime => StartTime + CommandsDuration * TotalIterations;
public override double EndTime =>
// In an ideal world, we would multiply the command duration by TotalIterations here.
// Unfortunately this would clash with how stable handled end times, and results in some storyboards playing outro
// sequences for minutes or hours.
StartTime + CommandsDuration;
/// <summary>
/// Construct a new command loop.