Skip to content

Commit

Permalink
Fix storyboard outro time potentially running too long
Browse files Browse the repository at this point in the history
  • Loading branch information
peppy committed Feb 6, 2023
1 parent 9bcc6bf commit 679ec98
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,9 @@ public void TestDecodeLoopCount()
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));
}
}
}
Expand Down
7 changes: 6 additions & 1 deletion osu.Game/Storyboards/CommandLoop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ public class CommandLoop : CommandTimelineGroup
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.
Expand Down

0 comments on commit 679ec98

Please sign in to comment.