totalSteps & totalBeats synced with bpm changes

This commit is contained in:
MtH 2021-02-12 01:58:11 +01:00
parent 674a08b381
commit f3462c2c99
3 changed files with 13 additions and 34 deletions

View file

@ -36,10 +36,14 @@ class MusicBeatState extends FlxUIState
override function update(elapsed:Float) override function update(elapsed:Float)
{ {
everyStep(); //everyStep();
var oldStep:Int = curStep;
updateCurStep(); updateCurStep();
// Needs to be FLOOR idk why it was rounded but that dont make sense
if (oldStep != curStep && curStep > 0)
stepHit();
updateBeat(); updateBeat();
super.update(elapsed); super.update(elapsed);
@ -50,21 +54,6 @@ class MusicBeatState extends FlxUIState
curBeat = Math.floor(curStep / 4); 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 private function updateCurStep():Void
{ {
var lastChange:BPMChangeEvent = { var lastChange:BPMChangeEvent = {

View file

@ -35,29 +35,19 @@ class MusicBeatSubstate extends FlxSubState
override function update(elapsed:Float) override function update(elapsed:Float)
{ {
everyStep(); //everyStep();
var oldStep:Int = curStep;
updateCurStep(); updateCurStep();
if (oldStep != curStep && curStep > 0)
stepHit();
curBeat = Math.floor(curStep / 4); curBeat = Math.floor(curStep / 4);
super.update(elapsed); 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 private function updateCurStep():Void
{ {
var lastChange:BPMChangeEvent = { var lastChange:BPMChangeEvent = {

View file

@ -2261,7 +2261,6 @@ class PlayState extends MusicBeatState
override function beatHit() override function beatHit()
{ {
wiggleShit.update(Conductor.crochet);
super.beatHit(); super.beatHit();
if (generatedMusic) if (generatedMusic)
@ -2284,6 +2283,7 @@ class PlayState extends MusicBeatState
dad.dance(); dad.dance();
} }
// FlxG.log.add('change bpm' + SONG.notes[Std.int(curStep / 16)].changeBPM); // FlxG.log.add('change bpm' + SONG.notes[Std.int(curStep / 16)].changeBPM);
wiggleShit.update(Conductor.crochet);
// HARDCODING FOR MILF ZOOMS! // HARDCODING FOR MILF ZOOMS!
if (curSong.toLowerCase() == 'milf' && curBeat >= 168 && curBeat < 200 && camZooming && FlxG.camera.zoom < 1.35) if (curSong.toLowerCase() == 'milf' && curBeat >= 168 && curBeat < 200 && camZooming && FlxG.camera.zoom < 1.35)