Skip to content

Commit 323c51e

Browse files
committed
Make the Quality Option not confusing
1 parent c13a0a2 commit 323c51e

File tree

4 files changed

+42
-12
lines changed

4 files changed

+42
-12
lines changed

source/funkin/options/Options.hx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,15 @@ class Options
226226

227227
public static function applySettings() {
228228
applyKeybinds();
229+
applyQuality();
229230

231+
FlxG.sound.defaultMusicGroup.volume = volumeMusic;
232+
FlxG.autoPause = autoPause;
233+
if (FlxG.updateFramerate < framerate) FlxG.drawFramerate = FlxG.updateFramerate = framerate;
234+
else FlxG.updateFramerate = FlxG.drawFramerate = framerate;
235+
}
236+
237+
public static function applyQuality() {
230238
switch (quality) {
231239
case 0:
232240
antialiasing = false;
@@ -238,11 +246,7 @@ class Options
238246
gameplayShaders = true;
239247
}
240248

241-
FlxG.sound.defaultMusicGroup.volume = volumeMusic;
242249
FlxG.game.stage.quality = (FlxG.enableAntialiasing = antialiasing) ? BEST : LOW;
243-
FlxG.autoPause = autoPause;
244-
if (FlxG.updateFramerate < framerate) FlxG.drawFramerate = FlxG.updateFramerate = framerate;
245-
else FlxG.updateFramerate = FlxG.drawFramerate = framerate;
246250
}
247251

248252
public static function applyKeybinds() {

source/funkin/options/categories/AppearanceOptions.hx

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,29 @@ class AdvancedAppearanceOptions extends TreeMenuScreen {
4848
}
4949

5050
private function updateQualityOptions() {
51-
for (option in qualityOptions) option.locked = Options.quality != 2;
51+
for (option in qualityOptions) {
52+
option.locked = Options.quality != 2;
53+
if (option is Checkbox) {
54+
final checkbox:Checkbox = cast option;
55+
checkbox.checked = Reflect.field(checkbox.parent, checkbox.optionName);
56+
}
57+
else if (option is SliderOption) {
58+
final slider:SliderOption = cast option;
59+
slider.currentValue = Reflect.field(slider.parent, slider.optionName);
60+
}
61+
else if (option is NumOption) {
62+
final num:NumOption = cast option;
63+
num.currentValue = Reflect.field(num.parent, num.optionName);
64+
}
65+
else if (option is ArrayOption) {
66+
final array:ArrayOption = cast option;
67+
array.currentSelection = Reflect.field(array.parent, array.optionName);
68+
}
69+
}
5270
}
5371

5472
private function __changeQuality(value:Dynamic) {
55-
var antialiasing = value == 0 ? false : (value == 1 ? true : Options.antialiasing);
56-
FlxG.game.stage.quality = (FlxG.enableAntialiasing = antialiasing) ? BEST : LOW;
73+
Options.applyQuality();
5774
updateQualityOptions();
5875
}
5976

source/funkin/options/type/ArrayOption.hx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,19 @@ class ArrayOption extends TextOption {
55

66
public var options:Array<Dynamic>;
77
public var displayOptions:Array<String>;
8-
public var currentSelection:Int;
8+
public var currentSelection(default, set):Int;
99

1010
public var parent:Dynamic;
1111
public var optionName:String;
1212

1313
var __selectionText:Alphabet;
1414

15+
function set_currentSelection(v:Int):Int {
16+
currentSelection = v;
17+
if (__selectionText != null) __selectionText.text = formatTextOption();
18+
return v;
19+
}
20+
1521
override function set_text(v:String) {
1622
super.set_text(v);
1723
__selectionText.x = __text.x + __text.width + 12;
@@ -53,7 +59,6 @@ class ArrayOption extends TextOption {
5359

5460
override function changeSelection(change:Int) {
5561
if (locked || currentSelection == (currentSelection = CoolUtil.boundInt(currentSelection + change, 0, options.length - 1))) return;
56-
__selectionText.text = formatTextOption();
5762
CoolUtil.playMenuSFX(SCROLL);
5863

5964
if (optionName != null) Reflect.setField(parent, optionName, options[currentSelection]);

source/funkin/options/type/NumOption.hx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,19 @@ class NumOption extends TextOption {
1010
public var max:Float;
1111
public var step:Float;
1212

13-
public var currentValue:Float;
13+
public var currentValue(default, set):Float;
1414

1515
public var parent:Dynamic;
1616
public var optionName:String;
1717

1818
var __number:Alphabet;
1919

20-
override function set_text(v:String) {
20+
function set_currentValue(v:Float):Float {
21+
if (__number != null) __number.text = ": $v";
22+
return currentValue = v;
23+
}
24+
25+
override function set_text(v:String):String {
2126
super.set_text(v);
2227
__number.x = __text.x + __text.width + 12;
2328
return v;
@@ -41,7 +46,6 @@ class NumOption extends TextOption {
4146
override function changeSelection(change:Int):Void {
4247
if (locked) return;
4348
if (currentValue == (currentValue = FlxMath.bound(currentValue + change * step, min, max))) return;
44-
__number.text = ': $currentValue';
4549

4650
Reflect.setField(parent, optionName, currentValue);
4751
if (changedCallback != null) changedCallback(currentValue);

0 commit comments

Comments
 (0)