From e7a09fcee27dbd884445ef2e053ac079f2005db1 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Tue, 30 Apr 2024 13:58:39 -0400 Subject: [PATCH] Fix an issue where returning to Freeplay from gameplay would let you interact with the menu underneath --- source/funkin/ui/freeplay/FreeplayState.hx | 8 ++++---- source/funkin/ui/mainmenu/MainMenuState.hx | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/source/funkin/ui/freeplay/FreeplayState.hx b/source/funkin/ui/freeplay/FreeplayState.hx index 860b8f235..e5f89ed0d 100644 --- a/source/funkin/ui/freeplay/FreeplayState.hx +++ b/source/funkin/ui/freeplay/FreeplayState.hx @@ -946,16 +946,16 @@ class FreeplayState extends MusicBeatSubState caps.doJumpOut = true; } - if (Type.getClass(FlxG.state) == MainMenuState) + if (Type.getClass(_parentState) == MainMenuState) { - FlxG.state.persistentUpdate = false; - FlxG.state.persistentDraw = true; + _parentState.persistentUpdate = false; + _parentState.persistentDraw = true; } new FlxTimer().start(longestTimer, (_) -> { FlxTransitionableState.skipNextTransIn = true; FlxTransitionableState.skipNextTransOut = true; - if (Type.getClass(FlxG.state) == MainMenuState) + if (Type.getClass(_parentState) == MainMenuState) { FunkinSound.playMusic('freakyMenu', { diff --git a/source/funkin/ui/mainmenu/MainMenuState.hx b/source/funkin/ui/mainmenu/MainMenuState.hx index 27082c94d..27170fd49 100644 --- a/source/funkin/ui/mainmenu/MainMenuState.hx +++ b/source/funkin/ui/mainmenu/MainMenuState.hx @@ -54,8 +54,9 @@ class MainMenuState extends MusicBeatState playMenuMusic(); - persistentUpdate = true; - persistentDraw = true; + // If something else overrides these, we should keep those values. + // persistentUpdate = true; + // persistentDraw = true; var bg:FlxSprite = new FlxSprite(Paths.image('menuBG')); bg.scrollFactor.x = 0;