diff --git a/source/funkin/ui/MenuList.hx b/source/funkin/ui/MenuList.hx index ff2e3acf4..993d068e4 100644 --- a/source/funkin/ui/MenuList.hx +++ b/source/funkin/ui/MenuList.hx @@ -36,7 +36,7 @@ class MenuTypedList extends FlxTypedGroup var byName = new Map(); /** Set to true, internally to disable controls, without affecting vars like `enabled` */ - public var busy(default, null):Bool = false; + public var busy:Bool = false; // bit awkward because BACK is also a menu control and this doesn't affect that // #if mobile diff --git a/source/funkin/ui/mainmenu/MainMenuState.hx b/source/funkin/ui/mainmenu/MainMenuState.hx index 6c88b5d54..ef78cb1ca 100644 --- a/source/funkin/ui/mainmenu/MainMenuState.hx +++ b/source/funkin/ui/mainmenu/MainMenuState.hx @@ -52,6 +52,8 @@ class MainMenuState extends MusicBeatState #end var overrideMusic:Bool = false; + var goingToOptions:Bool = false; + var goingBack:Bool = false; static var rememberedSelectedIndex:Int = 0; @@ -257,9 +259,20 @@ class MainMenuState extends MusicBeatState camFollow.y = bg.getGraphicMidpoint().y; addBackButton(FlxG.width - 230, FlxG.height - 200, FlxColor.WHITE, goBack, 1.0); + addOptionsButton(35, FlxG.height - 210, function() { startExitState(() -> new funkin.ui.options.OptionsState()); }); + + backButton.onConfirmStart.add(function():Void { + backButton.active = true; + goingBack = true; + }); + optionsButton.onConfirmStart.add(function():Void { + optionsButton.active = true; + goingToOptions = true; + menuItems.busy = true; + }); #end super.create(); @@ -325,6 +338,7 @@ class MainMenuState extends MusicBeatState backButton.animation.play('idle'); optionsButton.animation.play('idle'); backButton.resetCallbacks(); + optionsButton.resetCallbacks(); #end super.closeSubState(); } @@ -528,10 +542,9 @@ class MainMenuState extends MusicBeatState if (_exiting) menuItems.enabled = false; #if FEATURE_TOUCH_CONTROLS - backButton.active = menuItems.enabled && !menuItems.busy; - optionsButton.active = menuItems.enabled && !menuItems.busy; + backButton.active = (goingBack || (menuItems.enabled && !menuItems.busy && !goingToOptions)); + optionsButton.active = (goingToOptions || (menuItems.enabled && !menuItems.busy && !goingBack)); #end - if (controls.BACK) { goBack(); @@ -542,6 +555,7 @@ class MainMenuState extends MusicBeatState { if (menuItems.enabled && !menuItems.busy) { + menuItems.busy = true; rememberedSelectedIndex = menuItems.selectedIndex; FlxG.switchState(() -> new TitleState()); FunkinSound.playOnce(Paths.sound('cancelMenu'));