Merge branch 'main' into options-rewrite
This commit is contained in:
@@ -24,6 +24,9 @@
|
||||
<str id="optionsTree.miscellaneous-name">Miscellaneous</str>
|
||||
<str id="optionsTree.miscellaneous-desc">Use this menu to reset save data or engine settings.</str>
|
||||
|
||||
<str id="optionsTree.debug-name">Debug Options</str>
|
||||
<str id="optionsTree.debug-desc">Debug Options for Developer Mode.</str>
|
||||
|
||||
<!-- cant have debug here -->
|
||||
</group>
|
||||
|
||||
@@ -169,8 +172,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>
|
||||
|
||||
@@ -159,9 +159,6 @@
|
||||
<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>
|
||||
|
||||
|
||||
@@ -881,7 +881,7 @@ class FlxSound extends FlxBasic {
|
||||
cleanup(false, true);
|
||||
startSound(time);
|
||||
}
|
||||
else if (playing) {
|
||||
else {
|
||||
_source.offset = 0;
|
||||
_source.currentTime = time + _offset;
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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(_) {
|
||||
|
||||
@@ -29,9 +29,9 @@ class UIAudioPlayer extends UIButton {
|
||||
public function new(x:Float, y:Float, bytes:Bytes) {
|
||||
sound = FlxG.sound.load(Sound.fromAudioBuffer(AudioBuffer.fromBytes(bytes)));
|
||||
|
||||
super(x, y, null, function () {
|
||||
super(x, y, null, () -> {
|
||||
if (sound.playing) sound.pause();
|
||||
else sound.play(false, sound.time);
|
||||
else sound.play();
|
||||
}, 58 - 16, 58 - 16);
|
||||
|
||||
playingSprite = new FlxSprite(x + ((58 - 16)/2) - 8, y + ((58 - 16)/2) - 8).loadGraphic(Paths.image('editors/ui/audio-buttons'), true, 16, 16);
|
||||
@@ -107,20 +107,17 @@ class UIAudioPlayer extends UIButton {
|
||||
|
||||
var spritePos:FlxPoint = sprite.getScreenPosition(FlxPoint.get(), __lastDrawCameras[0]);
|
||||
|
||||
if (((mousePos.x > (spritePos.x)) && (mousePos.x < (spritePos.x) + timeBar.barWidth))
|
||||
&& ((mousePos.y > (spritePos.y)) && (mousePos.y < (spritePos.y) + timeBar.barHeight))) {
|
||||
if (FlxG.mouse.justPressed) {
|
||||
draggingObj = sprite;
|
||||
wasPlaying = draggingObj == timeBar ? sound.playing : false;
|
||||
}
|
||||
if (((mousePos.x > spritePos.x) && (mousePos.x < spritePos.x + sprite.barWidth))
|
||||
&& ((mousePos.y > spritePos.y) && (mousePos.y < spritePos.y + sprite.barHeight))) {
|
||||
|
||||
if (FlxG.mouse.justPressed) {
|
||||
if ((draggingObj = sprite) == timeBar && (wasPlaying = sound.playing)) sound.pause();
|
||||
}
|
||||
if (FlxG.mouse.pressed) {
|
||||
if (draggingObj == timeBar) {
|
||||
if (sound.playing) sound.pause();
|
||||
if (draggingObj == timeBar)
|
||||
sound.time = FlxMath.remapToRange(mousePos.x - spritePos.x, 0, timeBar.barWidth, 0, sound.length);
|
||||
} else if (draggingObj == volumeBar) {
|
||||
else if (draggingObj == volumeBar)
|
||||
sound.volume = FlxMath.remapToRange(mousePos.x - spritePos.x, 0, volumeBar.barWidth, 0, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
spritePos.put();
|
||||
@@ -128,8 +125,10 @@ class UIAudioPlayer extends UIButton {
|
||||
mousePos.put();
|
||||
|
||||
if (FlxG.mouse.released) {
|
||||
if (draggingObj == timeBar && wasPlaying)
|
||||
sound.play(wasPlaying = false, sound.time);
|
||||
if (draggingObj == timeBar && wasPlaying) {
|
||||
sound.play();
|
||||
wasPlaying = false;
|
||||
}
|
||||
draggingObj = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,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;
|
||||
|
||||
@@ -47,6 +47,7 @@ class OptionsMenu extends TreeMenu {
|
||||
];
|
||||
|
||||
var bg:FlxSprite;
|
||||
var debugOption:TextOption;
|
||||
|
||||
override function create() {
|
||||
super.create();
|
||||
@@ -87,6 +88,9 @@ class OptionsMenu extends TreeMenu {
|
||||
}
|
||||
})]));
|
||||
|
||||
tree.first().add(debugOption = new TextOption('optionsTree.debug-name', 'optionsTree.debug-desc', ' >', () -> addMenu(new DebugOptions())));
|
||||
debugOption.locked = !Options.devMode;
|
||||
|
||||
for (i in funkin.backend.assets.ModsFolder.getLoadedMods()) {
|
||||
var xmlPath = Paths.xml('config/options/LIB_$i');
|
||||
|
||||
@@ -113,6 +117,11 @@ class OptionsMenu extends TreeMenu {
|
||||
updateBG();
|
||||
}
|
||||
|
||||
override function menuChanged() {
|
||||
super.menuChanged();
|
||||
debugOption.locked = !Options.devMode;
|
||||
}
|
||||
|
||||
override function exit() {
|
||||
Options.save();
|
||||
Options.applySettings();
|
||||
|
||||
+6
-40
@@ -1,52 +1,18 @@
|
||||
package funkin.editors;
|
||||
package funkin.options.categories;
|
||||
|
||||
import funkin.backend.utils.NativeAPI;
|
||||
import funkin.options.TreeMenu;
|
||||
import funkin.options.TreeMenuScreen;
|
||||
import funkin.options.type.*;
|
||||
|
||||
class DebugOptions extends TreeMenu {
|
||||
var bg:FlxSprite;
|
||||
|
||||
override function create() {
|
||||
super.create();
|
||||
|
||||
add(bg = new FlxSprite().loadAnimatedGraphic(Paths.image('menus/menuBGBlue')));
|
||||
bg.antialiasing = true;
|
||||
bg.scrollFactor.set();
|
||||
|
||||
addMenu(new DebugOptionsScreen());
|
||||
|
||||
FlxG.camera.fade(0xFF000000, 0.5, true);
|
||||
UIState.setResolutionAware();
|
||||
}
|
||||
|
||||
public function updateBG() {
|
||||
var scaleX:Float = FlxG.width / bg.width;
|
||||
var scaleY:Float = FlxG.height / bg.height;
|
||||
bg.scale.x = bg.scale.y = Math.max(scaleX, scaleY) * 1.15;
|
||||
bg.screenCenter();
|
||||
}
|
||||
|
||||
override function onResize(width:Int, height:Int) {
|
||||
super.onResize(width, height);
|
||||
if (!UIState.resolutionAware) return;
|
||||
|
||||
updateBG();
|
||||
}
|
||||
}
|
||||
|
||||
class DebugOptionsScreen extends TreeMenuScreen {
|
||||
class DebugOptions extends TreeMenuScreen {
|
||||
public function new() {
|
||||
super('DebugOptions.title', 'DebugOptions.desc', 'DebugOptions.');
|
||||
|
||||
#if windows
|
||||
add(new TextOption(getNameID("showConsole"), getDescID("showConsole"), () -> NativeAPI.allocConsole()));
|
||||
add(new TextOption(getNameID("showConsole"), getDescID("showConsole"), () -> funkin.backend.utils.NativeAPI.allocConsole()));
|
||||
#end
|
||||
add(new Checkbox(getNameID("editorsResizable"), getDescID("editorsResizable"), "editorsResizable"));
|
||||
add(new Checkbox(getNameID("bypassEditorsResize"), getDescID("bypassEditorsResize"), "bypassEditorsResize"));
|
||||
add(new Checkbox(getNameID("editorSFX"), getDescID("editorSFX"), "editorSFX"));
|
||||
add(new Checkbox(getNameID("editorPrettyPrint"), getDescID("editorPrettyPrint"), "editorPrettyPrint"));
|
||||
add(new Checkbox(getNameID("editorCharterPrettyPrint"), getDescID("editorCharterPrettyPrint"), "editorCharterPrettyPrint"));
|
||||
add(new Checkbox(getNameID("editorCharacterPrettyPrint"), getDescID("editorCharacterPrettyPrint"), "editorCharacterPrettyPrint"));
|
||||
add(new Checkbox(getNameID("editorStagePrettyPrint"), getDescID("editorStagePrettyPrint"), "editorStagePrettyPrint"));
|
||||
add(new Checkbox(getNameID("intensiveBlur"), getDescID("intensiveBlur"), "intensiveBlur"));
|
||||
add(new Checkbox(getNameID("charterAutoSaves"), getDescID("charterAutoSaves"), "charterAutoSaves"));
|
||||
add(new NumOption(getNameID("charterAutoSaveTime"), getDescID("charterAutoSaveTime"), 60, 60*10, 1, "charterAutoSaveTime"));
|
||||
@@ -394,6 +394,7 @@ class NativeAudioSource {
|
||||
AL.sourcePlay(handle);
|
||||
}
|
||||
}
|
||||
else completed = value + 1 < getLength();
|
||||
|
||||
if (!playing && streamed) bufferTimes[STREAM_MAX_BUFFERS - (requestBuffers = queuedBuffers = 1)] = value / 1000;
|
||||
|
||||
|
||||
@@ -178,6 +178,12 @@ class AudioBuffer
|
||||
|
||||
return audioBuffer;
|
||||
#elseif (lime_cffi && !macro)
|
||||
#if lime_vorbis // CNE
|
||||
if (funkin.options.Options.streamedMusic) {
|
||||
var vorbisFile = VorbisFile.fromBytes(bytes);
|
||||
if (vorbisFile != null) return fromVorbisFile(vorbisFile);
|
||||
}
|
||||
#end
|
||||
#if !cs
|
||||
var audioBuffer = new AudioBuffer();
|
||||
audioBuffer.data = new UInt8Array(Bytes.alloc(0));
|
||||
|
||||
Reference in New Issue
Block a user