diff --git a/assets/languages/en/Options.xml b/assets/languages/en/Options.xml index f0ec9ea7..2b5a6c00 100644 --- a/assets/languages/en/Options.xml +++ b/assets/languages/en/Options.xml @@ -157,8 +157,14 @@ Editor SFXs If checked, will play sound effects when working on editors (ex: will play sfxs when checking checkboxes...) - Pretty Print - If checked, the saved files from the editor will be formatted to be easily viewable (does not apply to xmls...) + Chart Pretty Print + If checked, the saved files from the chart editor will be formatted to be easily viewable + + Character Pretty Print + If checked, the saved files from the character editor will be formatted to be easily viewable + + Stage Pretty Print + If checked, the saved files from the stage editor will be formatted to be easily viewable Intensive Blur If checked, will use more intensive blur that may be laggier but look better. diff --git a/assets/languages/pl/Options.xml b/assets/languages/pl/Options.xml index 0549951f..0415b455 100644 --- a/assets/languages/pl/Options.xml +++ b/assets/languages/pl/Options.xml @@ -157,9 +157,6 @@ If checked, only musics will have streamed audio, ALSO freeing a LOT of memory w Dźwięki Edytorów Jeśli włączone, niektóre elementy edytorów będą grać dźwięki. (Na przykład: dźwięki pól wyboru...) - Ładny Druk - Jeśli włączone, zapisane pliki z edytorów będą używać formatowania łatwiejszego do odczytania. (opcja nie dotyczy plików xml, tylko po angielsku...) - Mocniejszy Rozmaz Jeśli włączone, gra użyje mocniejszego rozmazu, który kosztuje wydajność, ale wygląda lepiej. diff --git a/source/funkin/editors/EditorPicker.hx b/source/funkin/editors/EditorPicker.hx index ff349203..ea751908 100644 --- a/source/funkin/editors/EditorPicker.hx +++ b/source/funkin/editors/EditorPicker.hx @@ -8,11 +8,6 @@ class EditorPicker extends MusicBeatSubstate { // Name is for backwards compatibility, don't use it, use id instead public var options:Array = [ - { - name: "Alphabet Editor", - id: "alphabet", - state: funkin.editors.alphabet.AlphabetSelection - }, { name: "Chart Editor", id: "chart", @@ -28,6 +23,11 @@ class EditorPicker extends MusicBeatSubstate { id: "stage", state: funkin.editors.stage.StageSelection }, + { + name: "Alphabet Editor", + id: "alphabet", + state: funkin.editors.alphabet.AlphabetSelection + }, #if (debug || debug_ui) { name: "UI Debug State", @@ -42,11 +42,6 @@ class EditorPicker extends MusicBeatSubstate { onClick: function() { CoolUtil.openURL(Flags.URL_WIKI); } - }, - { - name: "Debug Options", - id: "debugOptions", - state: DebugOptions } ]; diff --git a/source/funkin/editors/character/CharacterEditor.hx b/source/funkin/editors/character/CharacterEditor.hx index 264f7039..68f167fd 100644 --- a/source/funkin/editors/character/CharacterEditor.hx +++ b/source/funkin/editors/character/CharacterEditor.hx @@ -486,7 +486,8 @@ class CharacterEditor extends UIState { button.anim ]); - return "\n" + Printer.print(charXML, true); + var xmlThingYea:String = "\n" + Printer.print(charXML, Options.editorCharacterPrettyPrint); + return Options.editorCharacterPrettyPrint ? xmlThingYea : xmlThingYea.replace("\n", ""); } var clipboard:FlxPoint = FlxPoint.get(); diff --git a/source/funkin/editors/charter/Charter.hx b/source/funkin/editors/charter/Charter.hx index 84d1dd57..f1e2a3ce 100644 --- a/source/funkin/editors/charter/Charter.hx +++ b/source/funkin/editors/charter/Charter.hx @@ -789,9 +789,9 @@ class Charter extends UIState { var songPath:String = '${Paths.getAssetsRoot()}/songs/${__song.toLowerCase()}'; if (Options.charterAutoSavesSeparateFolder) - Chart.save(songPath, PlayState.SONG, __autoSaveLocation, {saveMetaInChart: true, saveLocalEvents: true, saveGlobalEvents: true, folder: "autosaves", prettyPrint: Options.editorPrettyPrint}); + Chart.save(songPath, PlayState.SONG, __autoSaveLocation, {saveMetaInChart: true, saveLocalEvents: true, saveGlobalEvents: true, folder: "autosaves", prettyPrint: Options.editorCharterPrettyPrint}); else // These two chart saves are particular, to avoid any kind of loss, stuff like meta, global and local events will be save all together - Nex - Chart.save(songPath, PlayState.SONG, __diff.toLowerCase(), {saveMetaInChart: true, saveLocalEvents: true, saveGlobalEvents: true, prettyPrint: Options.editorPrettyPrint}); + Chart.save(songPath, PlayState.SONG, __diff.toLowerCase(), {saveMetaInChart: true, saveLocalEvents: true, saveGlobalEvents: true, prettyPrint: Options.editorCharterPrettyPrint}); undos.save(); } autoSaveNotif.cancelled = false; @@ -1483,7 +1483,7 @@ class Charter extends UIState { } public static function saveChartAs(shouldBuild:Bool = true, withEvents:Bool = true) { - saveAs(Chart.filterChartForSaving(PlayState.SONG, false, withEvents, false), null, Options.editorPrettyPrint ? Flags.JSON_PRETTY_PRINT : null, { + saveAs(Chart.filterChartForSaving(PlayState.SONG, false, withEvents, false), null, Options.editorCharterPrettyPrint ? Flags.JSON_PRETTY_PRINT : null, { defaultSaveFile: '${__diff.toLowerCase()}.json' }, null, shouldBuild); if (undos != null) undos.save(); @@ -1496,7 +1496,7 @@ class Charter extends UIState { var data = {events: Chart.filterChartForSaving(PlayState.SONG, false, false, true).events}; var path = '${Paths.getAssetsRoot()}/songs/${__song.toLowerCase()}/events.json'; - if (data.events != null && data.events.length > 0) CoolUtil.safeSaveFile(path, Json.stringify(data, null, Options.editorPrettyPrint ? Flags.JSON_PRETTY_PRINT : null)); + if (data.events != null && data.events.length > 0) CoolUtil.safeSaveFile(path, Json.stringify(data, null, Options.editorCharterPrettyPrint ? Flags.JSON_PRETTY_PRINT : null)); else if (FileSystem.exists(path)) FileSystem.deleteFile(path); // Instead of replacing with a useless empty file, deletes the file directly - Nex #else saveEventsAs(shouldBuild); @@ -1507,7 +1507,7 @@ class Charter extends UIState { if (shouldBuild && instance != null) instance.buildChart(); var data = {events: Chart.filterChartForSaving(PlayState.SONG, false, false, true).events}; - saveAs(data, null, Options.editorPrettyPrint ? Flags.JSON_PRETTY_PRINT : null, { + saveAs(data, null, Options.editorCharterPrettyPrint ? Flags.JSON_PRETTY_PRINT : null, { defaultSaveFile: 'events.json' }, null, false); } @@ -1532,13 +1532,13 @@ class Charter extends UIState { } public static function saveLegacyChartAs(shouldBuild:Bool = true) { - saveAs(FNFLegacyParser.encode(PlayState.SONG), null, Options.editorPrettyPrint ? Flags.JSON_PRETTY_PRINT : null, { + saveAs(FNFLegacyParser.encode(PlayState.SONG), null, Options.editorCharterPrettyPrint ? Flags.JSON_PRETTY_PRINT : null, { defaultSaveFile: '${__song.toLowerCase().replace(" ", "-")}${__diff.toLowerCase() == Flags.DEFAULT_DIFFICULTY ? "" : '-${__diff.toLowerCase()}'}.json', }, null, shouldBuild); } public static function savePsychChartAs(shouldBuild:Bool = true) { - saveAs(PsychParser.encode(PlayState.SONG), null, Options.editorPrettyPrint ? Flags.JSON_PRETTY_PRINT : null, { + saveAs(PsychParser.encode(PlayState.SONG), null, Options.editorCharterPrettyPrint ? Flags.JSON_PRETTY_PRINT : null, { defaultSaveFile: '${__song.toLowerCase().replace(" ", "-")}${__diff.toLowerCase() == Flags.DEFAULT_DIFFICULTY ? "" : '-${__diff.toLowerCase()}'}.json', }, null, shouldBuild); } @@ -1556,7 +1556,7 @@ class Charter extends UIState { #if sys public static function saveTo(path:String, separateEvents:Bool = false, shouldBuild:Bool = true) { if (shouldBuild && instance != null) instance.buildChart(); - Chart.save(path, PlayState.SONG, __diff.toLowerCase(), {saveMetaInChart: false, saveLocalEvents: !separateEvents, prettyPrint: Options.editorPrettyPrint}); + Chart.save(path, PlayState.SONG, __diff.toLowerCase(), {saveMetaInChart: false, saveLocalEvents: !separateEvents, prettyPrint: Options.editorCharterPrettyPrint}); } #end #end diff --git a/source/funkin/editors/stage/StageEditor.hx b/source/funkin/editors/stage/StageEditor.hx index d02cc997..8900c24f 100644 --- a/source/funkin/editors/stage/StageEditor.hx +++ b/source/funkin/editors/stage/StageEditor.hx @@ -726,8 +726,8 @@ class StageEditor extends UIState { } } - var xmlThingYea:String = "\n" + Printer.print(xml, Options.editorPrettyPrint); - return Options.editorPrettyPrint ? xmlThingYea : xmlThingYea.replace("\n", ""); + var xmlThingYea:String = "\n" + Printer.print(xml, Options.editorStagePrettyPrint); + return Options.editorStagePrettyPrint ? xmlThingYea : xmlThingYea.replace("\n", ""); } function _edit_undo(_) { diff --git a/source/funkin/game/Character.hx b/source/funkin/game/Character.hx index 15a9729f..32008f18 100644 --- a/source/funkin/game/Character.hx +++ b/source/funkin/game/Character.hx @@ -429,12 +429,12 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset var realFlipped:Bool = isPlayer ? !__baseFlipped : __baseFlipped; if (realFlipped) xml.set("flipX", "true"); - xml.set("icon", getIcon()); + if (icon != curCharacter) xml.set("icon", getIcon()); if (gameOverCharacter != Character.FALLBACK_DEAD_CHARACTER) xml.set("gameOverChar", gameOverCharacter); if (iconColor != null) xml.set("color", iconColor.toWebString()); - xml.set("sprite", sprite); + if (sprite != curCharacter) xml.set("sprite", sprite); if (scale.x != 1) xml.set("scale", Std.string(FlxMath.roundDecimal(scale.x, 4))); if (!antialiasing) xml.set("antialiasing", antialiasing == true ? "true" : "false"); @@ -453,12 +453,12 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset animXml.set("name", anim.name); animXml.set("anim", anim.anim); - animXml.set("loop", Std.string(anim.loop)); - animXml.set("fps", Std.string(FlxMath.roundDecimal(anim.fps, 2))); + if (anim.loop) animXml.set("loop", Std.string(anim.loop)); + if (FlxMath.roundDecimal(anim.fps, 2) != 24) animXml.set("fps", Std.string(FlxMath.roundDecimal(anim.fps, 2))); var offset:FlxPoint = getAnimOffset(anim.name); - animXml.set("x", Std.string(FlxMath.roundDecimal(offset.x, 2))); - animXml.set("y", Std.string(FlxMath.roundDecimal(offset.y, 2))); + if (FlxMath.roundDecimal(offset.x, 2) != 0) animXml.set("x", Std.string(FlxMath.roundDecimal(offset.x, 2))); + if (FlxMath.roundDecimal(offset.y, 2) != 0) animXml.set("y", Std.string(FlxMath.roundDecimal(offset.y, 2))); offset.putWeak(); if (anim.indices.length > 0) @@ -474,6 +474,7 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset } this.xml = new Access(xml); + return xml; } diff --git a/source/funkin/options/Options.hx b/source/funkin/options/Options.hx index a60d519d..0e31a51a 100644 --- a/source/funkin/options/Options.hx +++ b/source/funkin/options/Options.hx @@ -55,7 +55,11 @@ class Options */ public static var intensiveBlur:Bool = true; public static var editorSFX:Bool = true; - public static var editorPrettyPrint:Bool = false; + + public static var editorCharterPrettyPrint:Bool = false; + public static var editorCharacterPrettyPrint:Bool = true; + public static var editorStagePrettyPrint:Bool = true; + public static var editorsResizable:Bool = true; public static var bypassEditorsResize:Bool = false; public static var maxUndos:Int = 120; diff --git a/source/funkin/options/OptionsMenu.hx b/source/funkin/options/OptionsMenu.hx index ace34aad..cba1c9af 100644 --- a/source/funkin/options/OptionsMenu.hx +++ b/source/funkin/options/OptionsMenu.hx @@ -42,11 +42,21 @@ class OptionsMenu extends TreeMenu { desc: 'optionsTree.miscellaneous-desc', suffix: " >", state: MiscOptions + }, + { + name: "Debug Options", + desc: "debugOptions", + suffix: " >", + state: DebugOptions } ]; var bg:FlxSprite; + var addedDebugOptions:Bool = !Options.devMode; + var debugModeButton:OptionType; + var debugModeIndex:Int = mainOptions.length - 1; + public override function create() { super.create(); @@ -99,6 +109,12 @@ class OptionsMenu extends TreeMenu { if (access != null) for (o in parseOptionsFromXML(access)) main.add(o); } } + + doDebugOptionThing(); + } + + public override function onMenuClose(m:OptionsScreen) { + doDebugOptionThing(); } public function reloadStrings() { @@ -115,6 +131,18 @@ class OptionsMenu extends TreeMenu { super.exit(); } + function doDebugOptionThing() { + if ((Options.devMode && !addedDebugOptions) || (!Options.devMode && addedDebugOptions)) { + trace((addedDebugOptions ? "remove" : "add") + " option"); + addedDebugOptions = !addedDebugOptions; + if (debugModeButton == null) debugModeButton = main.members[debugModeIndex]; + if (addedDebugOptions) + main.add(debugModeButton); + else + main.remove(debugModeButton); + } + } + /** * XML STUFF */ diff --git a/source/funkin/options/OptionsScreen.hx b/source/funkin/options/OptionsScreen.hx index 53dd5b06..bb71aec9 100644 --- a/source/funkin/options/OptionsScreen.hx +++ b/source/funkin/options/OptionsScreen.hx @@ -113,6 +113,10 @@ class OptionsScreen extends FlxTypedSpriteGroup { CoolUtil.playMenuSFX(SCROLL); curSelected = FlxMath.wrap(curSelected + sel, 0, members.length-1); + if (members[curSelected] == null) { + changeSelection(sel, true); + return; + } members[curSelected].selected = true; updateMenuDesc(); } diff --git a/source/funkin/editors/DebugOptions.hx b/source/funkin/options/categories/DebugOptions.hx similarity index 55% rename from source/funkin/editors/DebugOptions.hx rename to source/funkin/options/categories/DebugOptions.hx index 93d85992..16676890 100644 --- a/source/funkin/editors/DebugOptions.hx +++ b/source/funkin/options/categories/DebugOptions.hx @@ -1,41 +1,15 @@ -package funkin.editors; +package funkin.options.categories; import funkin.backend.utils.NativeAPI; -import funkin.options.OptionsScreen; -import funkin.options.TreeMenu; -import funkin.options.type.*; -class DebugOptions extends TreeMenu { - public override function create() { - super.create(); +class DebugOptions extends OptionsScreen { + public override function new(title:String, desc:String) { + super(title, desc, "DebugOptions."); - FlxG.camera.fade(0xFF000000, 0.5, true); - - var bg:FlxSprite = new FlxSprite(-80).loadAnimatedGraphic(Paths.image('menus/menuBGBlue')); - // bg.scrollFactor.set(); - bg.scale.set(1.15, 1.15); - bg.updateHitbox(); - bg.screenCenter(); - bg.scrollFactor.set(); - bg.antialiasing = true; - add(bg); - - main = new DebugOptionsScreen(); - } -} - -class DebugOptionsScreen extends OptionsScreen { - public override function new() { - prefix = "DebugOptions."; - super(translate("title"), translate("desc"), prefix); - #if windows add(new TextOption( getName("showConsole"), getDesc("showConsole"), - function() { - NativeAPI.allocConsole(); - })); - #end + function() NativeAPI.allocConsole())); add(new Checkbox( getName("editorsResizable"), getDesc("editorsResizable"), @@ -49,9 +23,17 @@ class DebugOptionsScreen extends OptionsScreen { getDesc("editorSFX"), "editorSFX")); add(new Checkbox( - getName("editorPrettyPrint"), - getDesc("editorPrettyPrint"), - "editorPrettyPrint")); + getName("editorCharterPrettyPrint"), + getDesc("editorCharterPrettyPrint"), + "editorCharterPrettyPrint")); + add(new Checkbox( + getName("editorCharacterPrettyPrint"), + getDesc("editorCharacterPrettyPrint"), + "editorCharacterPrettyPrint")); + add(new Checkbox( + getName("editorStagePrettyPrint"), + getDesc("editorStagePrettyPrint"), + "editorStagePrettyPrint")); add(new Checkbox( getName("intensiveBlur"), getDesc("intensiveBlur"),