diff --git a/source/funkin/audio/FunkinSound.hx b/source/funkin/audio/FunkinSound.hx index 100cee262..8c1bf3b41 100644 --- a/source/funkin/audio/FunkinSound.hx +++ b/source/funkin/audio/FunkinSound.hx @@ -321,6 +321,13 @@ class FunkinSound extends FlxSound implements ICloneable } } + if (FlxG.sound.music != null) + { + FlxG.sound.music.fadeTween?.cancel(); + FlxG.sound.music.stop(); + FlxG.sound.music.kill(); + } + if (params?.mapTimeChanges ?? true) { var songMusicData:Null = SongRegistry.instance.parseMusicData(key); @@ -335,19 +342,6 @@ class FunkinSound extends FlxSound implements ICloneable } } - if (FlxG.sound.music != null) - { - FlxG.sound.music.fadeTween?.cancel(); - FlxG.sound.music.stop(); - FlxG.sound.music.kill(); - } - - // Apparently HaxeFlixel isn't null safe. - @:nullSafety(Off) - { - FlxG.sound.music = FunkinSound.load(Paths.music('$key/$key'), params?.startingVolume ?? 1.0, true, false, true); - } - var music = FunkinSound.load(Paths.music('$key/$key'), params?.startingVolume ?? 1.0, params.loop ?? true, false, true); if (music != null) { diff --git a/source/funkin/ui/freeplay/FreeplayState.hx b/source/funkin/ui/freeplay/FreeplayState.hx index 531167a95..455805479 100644 --- a/source/funkin/ui/freeplay/FreeplayState.hx +++ b/source/funkin/ui/freeplay/FreeplayState.hx @@ -134,7 +134,7 @@ class FreeplayState extends MusicBeatSubState var stickerSubState:StickerSubState; public static var rememberedDifficulty:Null = Constants.DEFAULT_DIFFICULTY; - public static var rememberedSongId:Null = null; + public static var rememberedSongId:Null = 'tutorial'; public function new(?params:FreeplayStateParams, ?stickers:StickerSubState) { @@ -596,7 +596,7 @@ class FreeplayState extends MusicBeatSubState // Only now do we know that the filter is actually changing. - rememberedSongId = grpCapsules.members[curSelected]?.songData?.songId; + rememberedSongId = grpCapsules.members[curSelected]?.songData?.songId ?? rememberedSongId; for (cap in grpCapsules.members) { @@ -939,6 +939,11 @@ class FreeplayState extends MusicBeatSubState FlxTransitionableState.skipNextTransOut = true; if (Type.getClass(FlxG.state) == MainMenuState) { + FunkinSound.playMusic('freakyMenu', + { + overrideExisting: true, + restartTrack: false + }); close(); } else