diff --git a/osu.Game/Graphics/Containers/BeatSyncedContainer.cs b/osu.Game/Graphics/Containers/BeatSyncedContainer.cs index f261589955..123ef0662d 100644 --- a/osu.Game/Graphics/Containers/BeatSyncedContainer.cs +++ b/osu.Game/Graphics/Containers/BeatSyncedContainer.cs @@ -35,7 +35,7 @@ namespace osu.Game.Graphics.Containers protected override void Update() { - var track = Beatmap.Value?.Track; + var track = Beatmap.Value.Track; if (track == null) return; diff --git a/osu.Game/Screens/Menu/LogoVisualisation.cs b/osu.Game/Screens/Menu/LogoVisualisation.cs index 7fa1eda880..778d304f68 100644 --- a/osu.Game/Screens/Menu/LogoVisualisation.cs +++ b/osu.Game/Screens/Menu/LogoVisualisation.cs @@ -86,13 +86,15 @@ namespace osu.Game.Screens.Menu private void updateAmplitudes() { - float[] temporalAmplitudes = beatmap.Value?.Track?.CurrentAmplitudes.FrequencyAmplitudes ?? new float[256]; + var track = beatmap.Value.Track; - var effect = beatmap.Value?.Beatmap.ControlPointInfo.EffectPointAt(beatmap.Value.Track?.CurrentTime ?? Time.Current); + float[] temporalAmplitudes = track?.CurrentAmplitudes.FrequencyAmplitudes ?? new float[256]; + + var effect = beatmap.Value.Beatmap.ControlPointInfo.EffectPointAt(track?.CurrentTime ?? Time.Current); for (int i = 0; i < bars_per_visualiser; i++) { - if (beatmap?.Value?.Track?.IsRunning ?? false) + if (track?.IsRunning ?? false) { float targetAmplitude = temporalAmplitudes[(i + indexOffset) % bars_per_visualiser] * (effect?.KiaiMode == true ? 1 : 0.5f); if (targetAmplitude > frequencyAmplitudes[i]) diff --git a/osu.Game/Screens/Menu/OsuLogo.cs b/osu.Game/Screens/Menu/OsuLogo.cs index efbd106cb5..ecfd98688e 100644 --- a/osu.Game/Screens/Menu/OsuLogo.cs +++ b/osu.Game/Screens/Menu/OsuLogo.cs @@ -275,7 +275,7 @@ namespace osu.Game.Screens.Menu const float scale_adjust_cutoff = 0.4f; const float velocity_adjust_cutoff = 0.98f; - var maxAmplitude = lastBeatIndex >= 0 ? Beatmap.Value?.Track?.CurrentAmplitudes.Maximum ?? 0 : 0; + var maxAmplitude = lastBeatIndex >= 0 ? Beatmap.Value.Track?.CurrentAmplitudes.Maximum ?? 0 : 0; logoAmplitudeContainer.ScaleTo(1 - Math.Max(0, maxAmplitude - scale_adjust_cutoff) * 0.04f, 75, EasingTypes.OutQuint); if (maxAmplitude > velocity_adjust_cutoff) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 03d02f4deb..82ef85d463 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -81,10 +81,11 @@ namespace osu.Game.Screens.Play try { - if (Beatmap.Value == null) + if (!Beatmap.Value.WithStoryboard) + // we need to ensure the storyboard is loaded. Beatmap.Value = beatmaps.GetWorkingBeatmap(BeatmapInfo, withStoryboard: true); - if (Beatmap.Value?.Beatmap == null) + if (Beatmap.Value.Beatmap == null) throw new InvalidOperationException("Beatmap was not loaded"); ruleset = osu?.Ruleset.Value ?? Beatmap.Value.BeatmapInfo.Ruleset; diff --git a/osu.Game/Screens/Ranking/Results.cs b/osu.Game/Screens/Ranking/Results.cs index a15f6461dc..93f6fec862 100644 --- a/osu.Game/Screens/Ranking/Results.cs +++ b/osu.Game/Screens/Ranking/Results.cs @@ -165,7 +165,7 @@ namespace osu.Game.Screens.Ranking { RelativeSizeAxes = Axes.Both, Alpha = 0.2f, - Texture = Beatmap.Value?.Background, + Texture = Beatmap.Value.Background, Anchor = Anchor.Centre, Origin = Anchor.Centre, FillMode = FillMode.Fill diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index 4301d80076..f564c39e10 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -59,14 +59,14 @@ namespace osu.Game.Screens.Select { if (!IsCurrentScreen) return; - beatmap?.Mods.BindTo(modSelect.SelectedMods); + beatmap.Mods.BindTo(modSelect.SelectedMods); - if (Beatmap.Value?.Track != null) + if (Beatmap.Value.Track != null) Beatmap.Value.Track.Looping = false; beatmapDetails.Beatmap = beatmap; - if (beatmap?.Track != null) + if (beatmap.Track != null) beatmap.Track.Looping = true; } @@ -97,7 +97,7 @@ namespace osu.Game.Screens.Select if (base.OnExiting(next)) return true; - if (Beatmap.Value?.Track != null) + if (Beatmap.Value.Track != null) Beatmap.Value.Track.Looping = false; return false; diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index c5b5366c34..ff11a34461 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -224,7 +224,7 @@ namespace osu.Game.Screens.Select if (beatmap.Equals(beatmapNoDebounce)) return; - bool preview = beatmap.BeatmapSetInfoID != Beatmap.Value?.BeatmapInfo.BeatmapSetInfoID; + bool preview = beatmap.BeatmapSetInfoID != Beatmap.Value.BeatmapInfo.BeatmapSetInfoID; if (beatmap.BeatmapSetInfoID == beatmapNoDebounce?.BeatmapSetInfoID) sampleChangeDifficulty.Play(); @@ -347,15 +347,12 @@ namespace osu.Game.Screens.Select private void ensurePlayingSelected(bool preview = false) { - Track track = Beatmap.Value?.Track; + Track track = Beatmap.Value.Track; trackManager.SetExclusive(track); - if (track != null) - { - if (preview) track.Seek(Beatmap.Value.Metadata.PreviewTime); - track.Start(); - } + if (preview) track.Seek(Beatmap.Value.Metadata.PreviewTime); + track.Start(); } private void removeBeatmapSet(BeatmapSetInfo beatmapSet)