From fab4d1d7884c41f38a08f38944eeab8b296d00d8 Mon Sep 17 00:00:00 2001
From: Chronic x3 <126361810+chronicsilly@users.noreply.github.com>
Date: Fri, 25 Jul 2025 17:38:20 +0100
Subject: [PATCH 1/3] Seperate pretty print options for the Chart, Character,
and Stage editors.
The editors that save as xmls have pretty print enabled by default btw
---
assets/languages/en/Options.xml | 10 ++++++++--
assets/languages/pl/Options.xml | 3 ---
source/funkin/editors/DebugOptions.hx | 14 +++++++++++---
.../funkin/editors/character/CharacterEditor.hx | 3 ++-
source/funkin/editors/charter/Charter.hx | 16 ++++++++--------
source/funkin/editors/stage/StageEditor.hx | 4 ++--
source/funkin/game/Character.hx | 13 +++++++------
source/funkin/options/Options.hx | 6 +++++-
8 files changed, 43 insertions(+), 26 deletions(-)
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/DebugOptions.hx b/source/funkin/editors/DebugOptions.hx
index 93d85992..25375a3b 100644
--- a/source/funkin/editors/DebugOptions.hx
+++ b/source/funkin/editors/DebugOptions.hx
@@ -49,9 +49,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"),
diff --git a/source/funkin/editors/character/CharacterEditor.hx b/source/funkin/editors/character/CharacterEditor.hx
index 5885db7f..9fb0f469 100644
--- a/source/funkin/editors/character/CharacterEditor.hx
+++ b/source/funkin/editors/character/CharacterEditor.hx
@@ -484,7 +484,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 0865f0a9..c7e20fc5 100644
--- a/source/funkin/editors/charter/Charter.hx
+++ b/source/funkin/editors/charter/Charter.hx
@@ -788,9 +788,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;
@@ -1480,7 +1480,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();
@@ -1492,7 +1492,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);
@@ -1503,7 +1503,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);
}
@@ -1527,13 +1527,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);
}
@@ -1551,7 +1551,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 c865b8d7..0ed80aee 100644
--- a/source/funkin/editors/stage/StageEditor.hx
+++ b/source/funkin/editors/stage/StageEditor.hx
@@ -724,8 +724,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;
From 16e5c323901c7f36f41b25ec1e9aa912ae02fb59 Mon Sep 17 00:00:00 2001
From: Chronic x3 <126361810+chronicsilly@users.noreply.github.com>
Date: Fri, 25 Jul 2025 17:49:52 +0100
Subject: [PATCH 2/3] EditorPicker if it didn't mess muscle memory up
---
source/funkin/editors/EditorPicker.hx | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/source/funkin/editors/EditorPicker.hx b/source/funkin/editors/EditorPicker.hx
index ff349203..7ddd06f8 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",
From 077bf8e116d54fa44906420f5d4829fb78c57b14 Mon Sep 17 00:00:00 2001
From: Chronic x3 <126361810+chronicsilly@users.noreply.github.com>
Date: Fri, 25 Jul 2025 20:46:55 +0100
Subject: [PATCH 3/3] Debug options are now in the options menu
Also disappear/reappear depending on the devMode bool's state
---
source/funkin/editors/EditorPicker.hx | 5 ---
source/funkin/options/OptionsMenu.hx | 28 +++++++++++++++
source/funkin/options/OptionsScreen.hx | 4 +++
.../categories}/DebugOptions.hx | 36 +++----------------
4 files changed, 37 insertions(+), 36 deletions(-)
rename source/funkin/{editors => options/categories}/DebugOptions.hx (65%)
diff --git a/source/funkin/editors/EditorPicker.hx b/source/funkin/editors/EditorPicker.hx
index 7ddd06f8..ea751908 100644
--- a/source/funkin/editors/EditorPicker.hx
+++ b/source/funkin/editors/EditorPicker.hx
@@ -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/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 65%
rename from source/funkin/editors/DebugOptions.hx
rename to source/funkin/options/categories/DebugOptions.hx
index 25375a3b..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"),