From 9de6b62fb136e7b7705858970b3b15c818e353de Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 16 Dec 2019 18:24:29 +0900 Subject: [PATCH] Fix nightcore beat not playing if song doesn't hit beat index 0 --- osu.Game/Rulesets/Mods/ModNightcore.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/osu.Game/Rulesets/Mods/ModNightcore.cs b/osu.Game/Rulesets/Mods/ModNightcore.cs index 1374c385cc..4d11b9de1d 100644 --- a/osu.Game/Rulesets/Mods/ModNightcore.cs +++ b/osu.Game/Rulesets/Mods/ModNightcore.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Track; @@ -55,7 +56,8 @@ namespace osu.Game.Rulesets.Mods private SkinnableSound clapSample; private SkinnableSound kickSample; private SkinnableSound finishSample; - private bool started; + + private int? firstBeat; [BackgroundDependencyLoader] private void load() @@ -73,10 +75,10 @@ namespace osu.Game.Rulesets.Mods { base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes); - if (!started && beatIndex == 0) - started = true; + if (beatIndex < firstBeat || !firstBeat.HasValue) + firstBeat = Math.Max(0, beatIndex / 16 * 16); - if (started && beatIndex > -1) + if (beatIndex > firstBeat) { if (beatIndex % 16 == 0) finishSample?.Play();