1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 18:07:23 +08:00

Exclude video events from being accounted for when calculating storyboard time bounds

Closes https://github.com/ppy/osu/issues/25263.

In some circumstances, stable allows skipping twice if a particularly
long storyboarded intro is being displayed:

    https://github.com/peppy/osu-stable-reference/blob/master/osu!/GameModes/Play/Player.cs#L1728-L1736

`AllowDoubleSkip` is calculated thus:

    3ea48705eb/osu!/GameModes/Play/Player.cs#L1761-L1770

and `leadInTime` is calculated thus:

    3ea48705eb/osu!/GameModes/Play/Player.cs#L1342-L1351

The key to watch out for here is `{first,last}EventTime`. `EventManager`
will calculate it on-the-fly as it adds storyboard elements:

    3ea48705eb/osu!/GameplayElements/Events/EventManager.cs#L253-L256

However, this pathway is only used for sprite, animation, sample,
and break events. Video and background events use the following pathway:

    https://github.com/peppy/osu-stable-reference/blob/master/osu!/GameplayElements/Events/EventManager.cs#L368

Note that this particular overload does not mutate either bound.
Which means that for the purposes of determining where a storyboard
starts and ends temporally, a video event's start time is essentially
ignored.

To reflect that, add a clause that excludes video events from
calculations of `{Earliest,Latest}EventTime`.
This commit is contained in:
Bartłomiej Dach 2023-10-27 22:10:03 +02:00
parent 2f9b50172e
commit 9ce2c1f49c
No known key found for this signature in database

View File

@ -30,8 +30,11 @@ namespace osu.Game.Storyboards
/// </summary>
/// <remarks>
/// This iterates all elements and as such should be used sparingly or stored locally.
/// Video and background events are not included to match stable.
/// </remarks>
public double? EarliestEventTime => Layers.SelectMany(l => l.Elements).MinBy(e => e.StartTime)?.StartTime;
public double? EarliestEventTime => Layers.SelectMany(l => l.Elements)
.Where(e => e is not StoryboardVideo)
.MinBy(e => e.StartTime)?.StartTime;
/// <summary>
/// Across all layers, find the latest point in time that a storyboard element ends at.
@ -39,9 +42,12 @@ namespace osu.Game.Storyboards
/// </summary>
/// <remarks>
/// This iterates all elements and as such should be used sparingly or stored locally.
/// Videos and samples return StartTime as their EndTIme.
/// Samples return StartTime as their EndTIme.
/// Video and background events are not included to match stable.
/// </remarks>
public double? LatestEventTime => Layers.SelectMany(l => l.Elements).MaxBy(e => e.GetEndTime())?.GetEndTime();
public double? LatestEventTime => Layers.SelectMany(l => l.Elements)
.Where(e => e is not StoryboardVideo)
.MaxBy(e => e.GetEndTime())?.GetEndTime();
/// <summary>
/// Depth of the currently front-most storyboard layer, excluding the overlay layer.