From fc0a08ed531d0422076a14f110a0ea4a47ad3245 Mon Sep 17 00:00:00 2001 From: Kade M Date: Mon, 2 Aug 2021 17:03:00 -0700 Subject: [PATCH] Fix Steps --- source/MusicBeatState.hx | 51 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 48 insertions(+), 3 deletions(-) diff --git a/source/MusicBeatState.hx b/source/MusicBeatState.hx index 7a3bde8..dec5264 100644 --- a/source/MusicBeatState.hx +++ b/source/MusicBeatState.hx @@ -49,7 +49,7 @@ class MusicBeatState extends FlxUIState override function update(elapsed:Float) { //everyStep(); - var nextStep:Int = updateCurStep(); + /*var nextStep:Int = updateCurStep(); if (nextStep >= 0) { @@ -69,7 +69,7 @@ class MusicBeatState extends FlxUIState updateBeat(); stepHit(); } - } + }*/ if (Conductor.songPosition < 0) curDecimalBeat = 0; @@ -83,17 +83,62 @@ class MusicBeatState extends FlxUIState Conductor.crochet = ((60 / data.bpm) * 1000); - var percent = (Conductor.songPosition - (data.startTime * 1000)) / (data.length * 1000); + var step = ((60 / data.bpm) * 1000) / 4; + var startInMS = (data.startTime * 1000); + + + var percent = (Conductor.songPosition - startInMS) / (data.length * 1000); curDecimalBeat = data.startBeat + (((Conductor.songPosition/1000) - data.startTime) * (data.bpm / 60)); + var ste:Int = Math.floor(data.startStep + ((Conductor.songPosition - startInMS) / step)); + if (ste >= 0) + { + if (ste > curStep) + { + for (i in curStep...ste) + { + curStep++; + updateBeat(); + stepHit(); + } + } + else if (ste < curStep) + { + //Song reset? + curStep = ste; + updateBeat(); + stepHit(); + } + } } else { curDecimalBeat = (Conductor.songPosition / 1000) * (Conductor.bpm/60); + var nextStep:Int = Math.floor(Conductor.songPosition / Conductor.stepCrochet); + if (nextStep >= 0) + { + if (nextStep > curStep) + { + for (i in curStep...nextStep) + { + curStep++; + updateBeat(); + stepHit(); + } + } + else if (nextStep < curStep) + { + //Song reset? + curStep = nextStep; + updateBeat(); + stepHit(); + } + } Conductor.crochet = ((60 / Conductor.bpm) * 1000); } } + if (FlxG.save.data.fpsRain && skippedFrames >= 6) { if (currentColor >= array.length)