Merge remote-tracking branch 'care/main'

This commit is contained in:
Ralty
2025-07-27 19:32:34 +07:00
11 changed files with 85 additions and 67 deletions
+8 -2
View File
@@ -157,8 +157,14 @@
<str id="editorSFX-name">Editor SFXs</str>
<str id="editorSFX-desc">If checked, will play sound effects when working on editors (ex: will play sfxs when checking checkboxes...)</str>
<str id="editorPrettyPrint-name">Pretty Print</str>
<str id="editorPrettyPrint-desc">If checked, the saved files from the editor will be formatted to be easily viewable (does not apply to xmls...)</str>
<str id="editorCharterPrettyPrint-name">Chart Pretty Print</str>
<str id="editorCharterPrettyPrint-desc">If checked, the saved files from the chart editor will be formatted to be easily viewable</str>
<str id="editorCharacterPrettyPrint-name">Character Pretty Print</str>
<str id="editorCharacterPrettyPrint-desc">If checked, the saved files from the character editor will be formatted to be easily viewable</str>
<str id="editorStagePrettyPrint-name">Stage Pretty Print</str>
<str id="editorStagePrettyPrint-desc">If checked, the saved files from the stage editor will be formatted to be easily viewable</str>
<str id="intensiveBlur-name">Intensive Blur</str>
<str id="intensiveBlur-desc">If checked, will use more intensive blur that may be laggier but look better.</str>
-3
View File
@@ -157,9 +157,6 @@ If checked, only musics will have streamed audio, ALSO freeing a LOT of memory w
<str id="editorSFX-name">Dźwięki Edytorów</str>
<str id="editorSFX-desc">Jeśli włączone, niektóre elementy edytorów będą grać dźwięki. (Na przykład: dźwięki pól wyboru...)</str>
<str id="editorPrettyPrint-name">Ładny Druk</str>
<str id="editorPrettyPrint-desc">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...)</str>
<str id="intensiveBlur-name">Mocniejszy Rozmaz</str>
<str id="intensiveBlur-desc">Jeśli włączone, gra użyje mocniejszego rozmazu, który kosztuje wydajność, ale wygląda lepiej.</str>
+5 -10
View File
@@ -8,11 +8,6 @@ class EditorPicker extends MusicBeatSubstate {
// Name is for backwards compatibility, don't use it, use id instead
public var options:Array<Editor> = [
{
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
}
];
@@ -486,7 +486,8 @@ class CharacterEditor extends UIState {
button.anim
]);
return "<!DOCTYPE codename-engine-character>\n" + Printer.print(charXML, true);
var xmlThingYea:String = "<!DOCTYPE codename-engine-character>\n" + Printer.print(charXML, Options.editorCharacterPrettyPrint);
return Options.editorCharacterPrettyPrint ? xmlThingYea : xmlThingYea.replace("\n", "");
}
var clipboard:FlxPoint = FlxPoint.get();
+8 -8
View File
@@ -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
+2 -2
View File
@@ -726,8 +726,8 @@ class StageEditor extends UIState {
}
}
var xmlThingYea:String = "<!DOCTYPE codename-engine-stage>\n" + Printer.print(xml, Options.editorPrettyPrint);
return Options.editorPrettyPrint ? xmlThingYea : xmlThingYea.replace("\n", "");
var xmlThingYea:String = "<!DOCTYPE codename-engine-stage>\n" + Printer.print(xml, Options.editorStagePrettyPrint);
return Options.editorStagePrettyPrint ? xmlThingYea : xmlThingYea.replace("\n", "");
}
function _edit_undo(_) {
+7 -6
View File
@@ -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;
}
+5 -1
View File
@@ -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;
+28
View File
@@ -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
*/
+4
View File
@@ -113,6 +113,10 @@ class OptionsScreen extends FlxTypedSpriteGroup<OptionType> {
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();
}
@@ -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"),