From 3de652c73e7007dd5f99bf075e97eadb68ee14ae Mon Sep 17 00:00:00 2001 From: Ralty <78720179+Raltyro@users.noreply.github.com> Date: Sat, 9 Aug 2025 14:31:18 +0700 Subject: [PATCH] Merge Options XML crash fix PR --- source/funkin/options/OptionsMenu.hx | 12 ++++++------ source/funkin/options/type/Separator.hx | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/source/funkin/options/OptionsMenu.hx b/source/funkin/options/OptionsMenu.hx index 0cc170e6..04b1972c 100644 --- a/source/funkin/options/OptionsMenu.hx +++ b/source/funkin/options/OptionsMenu.hx @@ -151,6 +151,11 @@ class OptionsMenu extends TreeMenu { var options:Array = []; for(node in xml.elements) { + switch(node.name) { + case "separator": + options.push(new Separator(node.has.height ? Std.parseFloat(node.att.height) : null)); + } + if (!node.has.name) { Logs.warn("An option node requires a name attribute."); continue; @@ -165,7 +170,6 @@ class OptionsMenu extends TreeMenu { continue; } options.push(new Checkbox(name, desc, node.att.id, null, FlxG.save.data)); - case "number": if (!node.has.id) { Logs.warn("A number option requires an \"id\" for option saving."); @@ -195,7 +199,7 @@ class OptionsMenu extends TreeMenu { continue; } var v:Dynamic = Std.parseFloat(node.att.value); - options.push(new RadioButton(screen, name, desc, node.att.id, v != null ? v : node.att.value, null, FlxG.save.data, node.att.forId)); + options.push(new RadioButton(screen, name, desc, node.att.id, v != null ? v : node.att.value, null, FlxG.save.data, node.has.forId ? node.att.forId : null)); case 'slider': if (!node.has.id) { Logs.warn("A slider option requires an \"id\" for option saving."); @@ -204,10 +208,6 @@ class OptionsMenu extends TreeMenu { var step = node.has.change ? Std.parseFloat(node.att.change) : (node.has.step ? Std.parseFloat(node.att.step) : null); var segments = node.has.segments ? Std.parseInt(node.att.segments) : 5; options.push(new SliderOption(name, desc, Std.parseFloat(node.att.min), Std.parseFloat(node.att.max), step, segments, node.att.id, Std.parseInt(node.att.barWidth), null, FlxG.save.data)); - - case 'separator': - options.push(new Separator(Std.parseInt(node.att.height))); - case "menu": options.push(new TextOption(name, desc, ' >', () -> { var screen = new TreeMenuScreen(name, desc); diff --git a/source/funkin/options/type/Separator.hx b/source/funkin/options/type/Separator.hx index 716c3576..6d0b020d 100644 --- a/source/funkin/options/type/Separator.hx +++ b/source/funkin/options/type/Separator.hx @@ -6,7 +6,7 @@ import flixel.FlxBasic; class Separator extends FlxSprite { var separatorHeight:Float; - public function new(height = 67) { + public function new(height = 67.0) { super(); separatorHeight = height; }