From f3462c2c99b492f74ec583b317c5ef46f418df3c Mon Sep 17 00:00:00 2001 From: MtH Date: Fri, 12 Feb 2021 01:58:11 +0100 Subject: [PATCH] totalSteps & totalBeats synced with bpm changes --- source/MusicBeatState.hx | 23 ++++++----------------- source/MusicBeatSubstate.hx | 22 ++++++---------------- source/PlayState.hx | 2 +- 3 files changed, 13 insertions(+), 34 deletions(-) diff --git a/source/MusicBeatState.hx b/source/MusicBeatState.hx index 1be91a32f..6e41a028d 100644 --- a/source/MusicBeatState.hx +++ b/source/MusicBeatState.hx @@ -36,10 +36,14 @@ class MusicBeatState extends FlxUIState override function update(elapsed:Float) { - everyStep(); + //everyStep(); + var oldStep:Int = curStep; updateCurStep(); - // Needs to be FLOOR idk why it was rounded but that dont make sense + + if (oldStep != curStep && curStep > 0) + stepHit(); + updateBeat(); super.update(elapsed); @@ -50,21 +54,6 @@ class MusicBeatState extends FlxUIState curBeat = Math.floor(curStep / 4); } - /** - * CHECKS EVERY FRAME - */ - private function everyStep():Void - { - if (Conductor.songPosition > lastStep + Conductor.stepCrochet - Conductor.safeZoneOffset - || Conductor.songPosition < lastStep + Conductor.safeZoneOffset) - { - if (Conductor.songPosition > lastStep + Conductor.stepCrochet) - { - stepHit(); - } - } - } - private function updateCurStep():Void { var lastChange:BPMChangeEvent = { diff --git a/source/MusicBeatSubstate.hx b/source/MusicBeatSubstate.hx index 90c3824e5..84c6a4b23 100644 --- a/source/MusicBeatSubstate.hx +++ b/source/MusicBeatSubstate.hx @@ -35,29 +35,19 @@ class MusicBeatSubstate extends FlxSubState override function update(elapsed:Float) { - everyStep(); + //everyStep(); + var oldStep:Int = curStep; updateCurStep(); + + if (oldStep != curStep && curStep > 0) + stepHit(); + curBeat = Math.floor(curStep / 4); super.update(elapsed); } - /** - * CHECKS EVERY FRAME - */ - private function everyStep():Void - { - if (Conductor.songPosition > lastStep + Conductor.stepCrochet - Conductor.safeZoneOffset - || Conductor.songPosition < lastStep + Conductor.safeZoneOffset) - { - if (Conductor.songPosition > lastStep + Conductor.stepCrochet) - { - stepHit(); - } - } - } - private function updateCurStep():Void { var lastChange:BPMChangeEvent = { diff --git a/source/PlayState.hx b/source/PlayState.hx index 1bdfb7215..094867a95 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -2261,7 +2261,6 @@ class PlayState extends MusicBeatState override function beatHit() { - wiggleShit.update(Conductor.crochet); super.beatHit(); if (generatedMusic) @@ -2284,6 +2283,7 @@ class PlayState extends MusicBeatState dad.dance(); } // FlxG.log.add('change bpm' + SONG.notes[Std.int(curStep / 16)].changeBPM); + wiggleShit.update(Conductor.crochet); // HARDCODING FOR MILF ZOOMS! if (curSong.toLowerCase() == 'milf' && curBeat >= 168 && curBeat < 200 && camZooming && FlxG.camera.zoom < 1.35)