From 56c14b6b51b899cc1a2e3caa335df01f378650c7 Mon Sep 17 00:00:00 2001 From: Yoshman29 <81191621+YoshiCrafter29@users.noreply.github.com> Date: Wed, 2 Nov 2022 03:30:38 +0100 Subject: [PATCH] more conductor stuff + settings now works --- buildnumber.txt | 2 +- source/funkin/game/PlayState.hx | 5 +---- source/funkin/menus/MainMenuState.hx | 5 +++-- source/funkin/options/OptionsMenu.hx | 2 +- source/funkin/options/keybinds/KeybindsOptions.hx | 2 +- source/funkin/system/Conductor.hx | 9 ++++++++- 6 files changed, 15 insertions(+), 10 deletions(-) diff --git a/buildnumber.txt b/buildnumber.txt index 8f32b0ba..7ada46f0 100644 --- a/buildnumber.txt +++ b/buildnumber.txt @@ -1 +1 @@ -969 \ No newline at end of file +970 \ No newline at end of file diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index d907abfa..4f8cb66a 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -1357,12 +1357,9 @@ class PlayState extends MusicBeatState { super.beatHit(curBeat); scripts.call("beatHit", [curBeat]); - - if (SONG.notes[Math.floor(curStep / 16)] != null && SONG.notes[Math.floor(curStep / 16)].changeBPM) - Conductor.changeBPM(SONG.notes[Math.floor(curStep / 16)].bpm); if (camZoomingInterval < 1) camZoomingInterval = 1; - if (camZooming && FlxG.camera.zoom < 1.35 && curBeat % camZoomingInterval == 0) + if (Options.camZoomOnBeat && camZooming && FlxG.camera.zoom < 1.35 && curBeat % camZoomingInterval == 0) { FlxG.camera.zoom += 0.015; camHUD.zoom += 0.03; diff --git a/source/funkin/menus/MainMenuState.hx b/source/funkin/menus/MainMenuState.hx index 6c572880..b4826796 100644 --- a/source/funkin/menus/MainMenuState.hx +++ b/source/funkin/menus/MainMenuState.hx @@ -1,5 +1,6 @@ package funkin.menus; +import funkin.options.Options; #if desktop import funkin.system.Discord.DiscordClient; #end @@ -155,12 +156,12 @@ class MainMenuState extends MusicBeatState selectedSomethin = true; CoolUtil.playMenuSFX(1); - FlxFlicker.flicker(magenta, 1.1, 0.15, false); + if (Options.flashingMenu) FlxFlicker.flicker(magenta, 1.1, 0.15, false); menuItems.forEach(function(spr:FlxSprite) { if (spr.ID != curSelected) return; - FlxFlicker.flicker(spr, 1, 0.06, false, false, function(flick:FlxFlicker) + FlxFlicker.flicker(spr, 1, Options.flashingMenu ? 0.06 : 0.15, false, false, function(flick:FlxFlicker) { var daChoice:String = optionShit[curSelected]; diff --git a/source/funkin/options/OptionsMenu.hx b/source/funkin/options/OptionsMenu.hx index 77ca5b75..507ebdb0 100644 --- a/source/funkin/options/OptionsMenu.hx +++ b/source/funkin/options/OptionsMenu.hx @@ -77,7 +77,7 @@ class OptionsMenu extends MusicBeatState { if (controls.ACCEPT && alphabets.members[curSelected] != null) { CoolUtil.playMenuSFX(1); canSelect = false; - FlxFlicker.flicker(alphabets.members[curSelected], 1, 0.06, false, false, function(flick:FlxFlicker) + FlxFlicker.flicker(alphabets.members[curSelected], 1, Options.flashingMenu ? 0.06 : 0.15, false, false, function(flick:FlxFlicker) { FlxTransitionableState.skipNextTransOut = true; FlxG.switchState(Type.createInstance(options[curSelected].state, [])); diff --git a/source/funkin/options/keybinds/KeybindsOptions.hx b/source/funkin/options/keybinds/KeybindsOptions.hx index b7c8c751..0af91a14 100644 --- a/source/funkin/options/keybinds/KeybindsOptions.hx +++ b/source/funkin/options/keybinds/KeybindsOptions.hx @@ -217,7 +217,7 @@ class KeybindsOptions extends MusicBeatSubstate { if (alphabets.members[curSelected] != null) { canSelect = false; CoolUtil.playMenuSFX(1); - FlxFlicker.flicker(alphabets.members[curSelected], 0.4, 0.1, true, false, function(t) { + FlxFlicker.flicker(alphabets.members[curSelected], 0.4, Options.flashingMenu ? 0.06 : 0.15, true, false, function(t) { alphabets.members[curSelected].changeKeybind(function() { canSelect = true; }, function() { diff --git a/source/funkin/system/Conductor.hx b/source/funkin/system/Conductor.hx index 83e1def1..09bcf3fa 100644 --- a/source/funkin/system/Conductor.hx +++ b/source/funkin/system/Conductor.hx @@ -1,5 +1,6 @@ package funkin.system; +import flixel.FlxState; import funkin.interfaces.IBeatReceiver; import flixel.FlxG; import funkin.system.Song.SwagSong; @@ -107,14 +108,18 @@ class Conductor totalSteps += deltaSteps; totalPos += ((60 / curBPM) * 1000 / 4) * deltaSteps; } - trace("new BPM map BUDDY " + bpmChangeMap); } public static function init() { FlxG.signals.preUpdate.add(update); + FlxG.signals.preStateCreate.add(onStateSwitch); reset(); } + private static function onStateSwitch(newState:FlxState) { + if (FlxG.sound.music == null) + reset(); + } private static function update() { var elapsed = FlxG.elapsed; @@ -140,6 +145,8 @@ class Conductor lastChange = change; } + if (lastChange.bpm > 0 && bpm != lastChange.bpm) changeBPM(lastChange.bpm); + curStepFloat = lastChange.stepTime + ((Conductor.songPosition - lastChange.songTime) / Conductor.stepCrochet); curBeatFloat = curStepFloat / 4;