diff --git a/src/itdelatrisu/opsu/Options.java b/src/itdelatrisu/opsu/Options.java index 47b8a150..eefa7ada 100644 --- a/src/itdelatrisu/opsu/Options.java +++ b/src/itdelatrisu/opsu/Options.java @@ -1189,6 +1189,8 @@ public class Options { /** The boolean value for the option (if applicable). */ protected boolean bool; + private int defaultVal = 0; + /** The integer value for the option (if applicable). */ protected int val; @@ -1244,6 +1246,7 @@ public class Options { GameOption(String name, String displayName, String description, int value, int min, int max) { this(name, displayName, description); this.val = value; + this.defaultVal = value; this.min = min; this.max = max; this.type = OptionType.NUMERIC; @@ -1389,6 +1392,10 @@ public class Options { return max; } + public int getDefaultVal() { + return defaultVal; + } + } /** Map of option display names to GameOptions. */ diff --git a/src/itdelatrisu/opsu/states/OptionsMenu.java b/src/itdelatrisu/opsu/states/OptionsMenu.java index cb79755e..847c129b 100644 --- a/src/itdelatrisu/opsu/states/OptionsMenu.java +++ b/src/itdelatrisu/opsu/states/OptionsMenu.java @@ -422,6 +422,13 @@ public class OptionsMenu extends BasicGameState { keyEntryLeft = false; keyEntryRight = true; } + + // ctrl+click to reset slider options + if (selectedOption != null && selectedOption.isDragOption() && (input.isKeyDown(Input.KEY_LCONTROL) || input.isKeyDown(Input.KEY_RCONTROL))) { + selectedOption.setValue(selectedOption.getDefaultVal() - 1); + // trigger update + selectedOption.drag(container, 1); + } } @Override @@ -438,6 +445,18 @@ public class OptionsMenu extends BasicGameState { if (keyEntryLeft || keyEntryRight) return; + if (selectedOption == null || !selectedOption.isDragOption()) { + return; + } + + // check control keys (reset to default value on ctrl+click) + if (input.isKeyDown(Input.KEY_LCONTROL) || input.isKeyDown(Input.KEY_RCONTROL)) { + selectedOption.setValue(selectedOption.getDefaultVal() - 1); + // trigger update + selectedOption.drag(container, 1); + return; + } + // check mouse button (right click scrolls faster) int multiplier; if (input.isMouseButtonDown(Input.MOUSE_RIGHT_BUTTON)) @@ -454,9 +473,7 @@ public class OptionsMenu extends BasicGameState { diff = ((diff > 0) ? 1 : -1) * multiplier; // options (drag only) - if (selectedOption != null) { - selectedOption.drag(container, diff); - } + selectedOption.drag(container, diff); } @Override