diff --git a/source/funkin/menus/credits/CreditsMain.hx b/source/funkin/menus/credits/CreditsMain.hx index 6da46187..1676da3a 100644 --- a/source/funkin/menus/credits/CreditsMain.hx +++ b/source/funkin/menus/credits/CreditsMain.hx @@ -1,10 +1,11 @@ package funkin.menus.credits; -import funkin.options.OptionsScreen; -import funkin.options.type.*; -import funkin.options.TreeMenu; -import haxe.xml.Access; import flixel.util.FlxColor; +import funkin.backend.assets.AssetsLibraryList.AssetSource; +import funkin.options.OptionsScreen; +import funkin.options.TreeMenu; +import funkin.options.type.*; +import haxe.xml.Access; class CreditsMain extends TreeMenu { var bg:FlxSprite; @@ -20,21 +21,17 @@ class CreditsMain extends TreeMenu { bg.antialiasing = true; add(bg); - var xmlPath = Paths.xml('config/credits'); - for(source in [funkin.backend.assets.AssetsLibraryList.AssetSource.SOURCE, funkin.backend.assets.AssetsLibraryList.AssetSource.MODS]) { - if (Paths.assetsTree.existsSpecific(xmlPath, "TEXT", source)) { - var access:Access = null; - try { - access = new Access(Xml.parse(Paths.assetsTree.getSpecificAsset(xmlPath, "TEXT", source))); - } catch(e) { - Logs.trace('Error while parsing credits.xml: ${Std.string(e)}', ERROR); - } + for (i in funkin.backend.assets.ModsFolder.getLoadedMods()) { + var xmlPath = Paths.xml('config/credits/LIB_$i'); - if (access != null) - for(c in parseCreditsFromXML(access, source)) - items.push(c); + if (Paths.assetsTree.existsSpecific(xmlPath, "TEXT")) { + var access:Access = null; + try access = new Access(Xml.parse(Paths.assetsTree.getSpecificAsset(xmlPath, "TEXT"))) + catch(e) Logs.trace('Error while parsing credits.xml: ${Std.string(e)}', ERROR); + if (access != null) for (c in parseCreditsFromXML(access)) items.push(c); } } + items.push(new TextOption("Codename Engine >", "Select this to see all the contributors of the engine!", function() { optionsTree.add(Type.createInstance(CreditsCodename, [])); })); @@ -51,7 +48,7 @@ class CreditsMain extends TreeMenu { /** * XML STUFF */ - public function parseCreditsFromXML(xml:Access, source:Bool):Array { + public function parseCreditsFromXML(xml:Access, source:AssetSource = BOTH):Array { var credsMenus:Array = []; for(node in xml.elements) { diff --git a/source/funkin/options/OptionsMenu.hx b/source/funkin/options/OptionsMenu.hx index 30662136..fd06705c 100644 --- a/source/funkin/options/OptionsMenu.hx +++ b/source/funkin/options/OptionsMenu.hx @@ -53,36 +53,24 @@ class OptionsMenu extends TreeMenu { if (o.substate != null) { persistentUpdate = false; persistentDraw = true; - if (o.substate is MusicBeatSubstate) { - openSubState(o.substate); - } else { - openSubState(Type.createInstance(o.substate, [])); - } + if (o.substate is MusicBeatSubstate) openSubState(o.substate); + else openSubState(Type.createInstance(o.substate, [])); } else { - if (o.state is OptionsScreen) { - optionsTree.add(o.state); - } else { - optionsTree.add(Type.createInstance(o.state, [])); - } + if (o.state is OptionsScreen) optionsTree.add(o.state); + else optionsTree.add(Type.createInstance(o.state, [])); } })]); - var xmlPath = Paths.xml("config/options"); - for(source in [funkin.backend.assets.AssetsLibraryList.AssetSource.SOURCE, funkin.backend.assets.AssetsLibraryList.AssetSource.MODS]) { - if (Paths.assetsTree.existsSpecific(xmlPath, "TEXT", source)) { - var access:Access = null; - try { - access = new Access(Xml.parse(Paths.assetsTree.getSpecificAsset(xmlPath, "TEXT", source))); - } catch(e) { - Logs.trace('Error while parsing options.xml: ${Std.string(e)}', ERROR); - } + for (i in funkin.backend.assets.ModsFolder.getLoadedMods()) { + var xmlPath = Paths.xml('config/options/LIB_$i'); - if (access != null) - for(o in parseOptionsFromXML(access)) - main.add(o); + if (Paths.assetsTree.existsSpecific(xmlPath, "TEXT")) { + var access:Access = null; + try access = new Access(Xml.parse(Paths.assetsTree.getSpecificAsset(xmlPath, "TEXT"))) + catch(e) Logs.trace('Error while parsing options.xml: ${Std.string(e)}', ERROR); + if (access != null) for (o in parseOptionsFromXML(access)) main.add(o); } } - } public override function exit() { diff --git a/source/funkin/options/keybinds/KeybindsOptions.hx b/source/funkin/options/keybinds/KeybindsOptions.hx index 621143d4..efafbf1b 100644 --- a/source/funkin/options/keybinds/KeybindsOptions.hx +++ b/source/funkin/options/keybinds/KeybindsOptions.hx @@ -205,10 +205,8 @@ class KeybindsOptions extends MusicBeatSubstate { public override function update(elapsed:Float) { super.update(elapsed); - - if (isSubState) { - bg.alpha = lerp(bg.alpha, 0.1, 0.125); - } else { + if (isSubState) bg.alpha = lerp(bg.alpha, 0.1, 0.125); + else { if (curSelected < 4) { if (coloredBG.alpha == 0) coloredBG.color = noteColors[curSelected]; @@ -224,11 +222,11 @@ class KeybindsOptions extends MusicBeatSubstate { changeSelection((controls.UP_P ? -1 : 0) + (controls.DOWN_P ? 1 : 0)); if (controls.BACK) { - MusicBeatState.skipTransIn = true; - if (isSubState) - close(); - else + if (isSubState) close(); + else { + MusicBeatState.skipTransIn = true; FlxG.switchState(new OptionsMenu()); + } Options.applyKeybinds(); Options.save(); return;