Merge branch 'options-redesign'

This commit is contained in:
yugecin
2016-12-11 13:34:28 +01:00
25 changed files with 792 additions and 1370 deletions

View File

@@ -1190,7 +1190,7 @@ public class GameData {
public void sendInitialSliderResult(int time, float x, float y, Color color, Color mirrorcolor) {
hitResultList.add(new HitObjectResult(time, HIT_SLIDER_INITIAL, x, y, color, null, null, true, false));
if (!Dancer.mirror || !GameMod.AUTO.isActive()) {
if (!Options.isMirror() || !GameMod.AUTO.isActive()) {
return;
}
float[] m = Utils.mirrorPoint(x, y);

View File

@@ -237,6 +237,9 @@ public enum GameImage {
REPLAY_PLAYBACK_HALF ("playback-half", "png", false, false),
// Non-Game Components
CONTROL_SLIDER_BALL ("control-sliderball", "png", false, false),
CONTROL_CHECK_ON ("control-check-on", "png", false, false),
CONTROL_CHECK_OFF ("control-check-off", "png", false, false),
VOLUME ("volume-bg", "png", false, false) {
@Override
protected Image process_sub(Image img, int w, int h) {

View File

@@ -522,13 +522,13 @@ public class Options {
MAP_START_DELAY ("Map start delay", "StartDelay", "Have a fix amount of time to prepare your play/record", 20, 1, 50) {
@Override
public String getValueString() {
return String.valueOf(val * 100);
return (val * 100) + "ms";
}
},
MAP_END_DELAY ("Map end delay", "EndDelay", "Have a fix amount of time at the and of the map for a smooth finish", 50, 1, 150) {
@Override
public String getValueString() {
return String.valueOf(val * 100);
return (val * 100) + "ms";
}
},
EPILEPSY_WARNING ("Epilepsy warning image", "EpiWarn", "Show a little warning for flashing colours in the beginning", 0, 0, 20) {
@@ -537,7 +537,7 @@ public class Options {
if (val == 0) {
return "Disabled";
}
return String.valueOf(val * 100);
return (val * 100) + "ms";
}
},
LOAD_HD_IMAGES ("Load HD Images", "LoadHDImages", String.format("Loads HD (%s) images when available. Increases memory usage and loading times.", GameImage.HD_SUFFIX), true),
@@ -609,7 +609,6 @@ public class Options {
REPLAY_SEEKING ("Replay Seeking", "ReplaySeeking", "Enable a seeking bar on the left side of the screen during replays.", false),
DISABLE_UPDATER ("Disable Automatic Updates", "DisableUpdater", "Disable automatic checking for updates upon starting opsu!.", false),
ENABLE_WATCH_SERVICE ("Enable Watch Service", "WatchService", "Watch the beatmap directory for changes. Requires a restart.", false),
DANCE_MOVER ("Mover algorithm", "Mover", "Algorithm that decides how to move from note to note" ) {
@Override
public Object[] getListItems() {
@@ -637,41 +636,21 @@ public class Options {
Dancer.instance.setMoverFactoryIndex(i);
}
},
DANCE_QUAD_BEZ_AGGRESSIVENESS ("Quadratic Bezier aggressiveness", "QuadBezAgr", "AKA initial D factor", 50, 0, 200) {
@Override
public String getValueString() {
return val + "";
}
@Override
public void drag(GameContainer container, int d) {
super.drag(container, d);
QuadraticBezierMover.aggressiveness = val;
return String.valueOf(val);
}
@Override
public boolean showCondition() {
return Dancer.moverFactories[Dancer.instance.getMoverFactoryIndex()] instanceof QuadraticBezierMoverFactory;
}
@Override
public void read(String s) {
super.read(s);
QuadraticBezierMover.aggressiveness = val;
}
},
DANCE_QUAD_BEZ_SLIDER_AGGRESSIVENESS_FACTOR ("Slider exit aggressiveness factor", "CubBezSliderExitAgr", "AKA initial D factor for sliderexits", 40, 10, 60) {
DANCE_QUAD_BEZ_SLIDER_AGGRESSIVENESS_FACTOR ("Slider exit aggressiveness factor", "CubBezSliderExitAgr", "AKA initial D factor for sliderexits", 4, 1, 6) {
@Override
public String getValueString() {
return val / 10 + "";
}
@Override
public void drag(GameContainer container, int d) {
super.drag(container, d);
QuadraticBezierMover.sliderExitAggressivenessfactor = val / 10;
return String.valueOf(val);
}
@Override
@@ -679,43 +658,17 @@ public class Options {
return DANCE_QUAD_BEZ_AGGRESSIVENESS.showCondition()
&& Dancer.sliderMoverController instanceof DefaultSliderMoverController;
}
@Override
public void read(String s) {
super.read(s);
QuadraticBezierMover.sliderExitAggressivenessfactor = val / 10;
}
},
DANCE_QUAD_BEZ_USE_CUBIC_ON_SLIDERS ("Use cubic bezier before sliders", "QuadBezCubicSliders", "Slider entry looks better using this", true) {
@Override
public void click(GameContainer container) {
super.click(container);
QuadraticBezierMoverFactory.cubicForSliderEntries = bool;
}
@Override
public boolean showCondition() {
return DANCE_QUAD_BEZ_SLIDER_AGGRESSIVENESS_FACTOR.showCondition();
}
@Override
public void read(String s) {
super.read(s);
QuadraticBezierMoverFactory.cubicForSliderEntries = bool;
}
},
DANCE_QUAD_BEZ_CUBIC_AGGRESSIVENESS_FACTOR ("Slider entry aggressiveness factor", "CubBezSliderEntryAgr", "AKA initial D factor for sliderentries", 40, 10, 60) {
DANCE_QUAD_BEZ_CUBIC_AGGRESSIVENESS_FACTOR ("Slider entry aggressiveness factor", "CubBezSliderEntryAgr", "AKA initial D factor for sliderentries", 4, 1, 6) {
@Override
public String getValueString() {
return val / 10 + "";
}
@Override
public void drag(GameContainer container, int d) {
super.drag(container, d);
CubicBezierMover.aggressivenessfactor = val / 10;
return String.valueOf(val);
}
@Override
@@ -723,14 +676,7 @@ public class Options {
return DANCE_QUAD_BEZ_USE_CUBIC_ON_SLIDERS.showCondition()
&& DANCE_QUAD_BEZ_USE_CUBIC_ON_SLIDERS.getBooleanValue();
}
@Override
public void read(String s) {
super.read(s);
CubicBezierMover.aggressivenessfactor = val / 10;
}
},
DANCE_MOVER_DIRECTION ("Mover direction", "MoverDirection", "The direction the mover goes" ) {
@Override
public String getValueString() {
@@ -757,7 +703,6 @@ public class Options {
Dancer.moverDirection = MoverDirection.values()[Integer.parseInt(s)];
}
},
DANCE_SLIDER_MOVER_TYPE ("Slider mover", "SliderMover", "How to move in sliders") {
@Override
public String getValueString() {
@@ -785,7 +730,6 @@ public class Options {
Dancer.sliderMoverController = Dancer.sliderMovers[val = Integer.parseInt(s)];
}
},
DANCE_SPINNER ("Spinner", "Spinner", "Spinner style") {
@Override
public Object[] getListItems() {
@@ -812,96 +756,17 @@ public class Options {
Dancer.instance.setSpinnerIndex(Integer.parseInt(s));
}
},
DANCE_SPINNER_DELAY ("Spinner delay", "SpinnerDelay", "Fiddle with this if spinner goes too fast.", Spinner.DELAY, 0, 200) {
DANCE_SPINNER_DELAY ("Spinner delay", "SpinnerDelay", "Fiddle with this if spinner goes too fast.", 3, 0, 20) {
@Override
public String getValueString() {
return String.format("%dms", val / 10);
}
@Override
public void drag(GameContainer container, int d) {
super.drag(container, d);
Spinner.DELAY = val / 10;
}
@Override
public void read(String s) {
super.read(s);
Spinner.DELAY = val / 10;
return String.format("%dms", val);
}
},
DANCE_LAZY_SLIDERS ("Lazy sliders", "LazySliders", "Don't do short sliders", Dancer.LAZY_SLIDERS) {
@Override
public void click(GameContainer container) {
bool = !bool;
Dancer.LAZY_SLIDERS = bool;
}
@Override
public void read(String s) {
super.read(s);
Dancer.LAZY_SLIDERS = bool;
}
},
DANCE_ONLY_CIRCLE_STACKS ("Only circle stacks", "CircleStacks", "Only do circle movement on stacks", AutoMoverFactory.ONLY_CIRCLE_STACKS) {
@Override
public void click(GameContainer container) {
bool = !bool;
AutoMoverFactory.ONLY_CIRCLE_STACKS = bool;
}
@Override
public void read(String s) {
super.read(s);
AutoMoverFactory.ONLY_CIRCLE_STACKS = bool;
}
},
DANCE_CIRCLE_STREAMS ("Circle streams", "CircleStreams", "Make circles while streaming", AutoMoverFactory.CIRCLE_STREAM == 58) {
@Override
public void click(GameContainer container) {
bool = !bool;
AutoMoverFactory.CIRCLE_STREAM = bool ? 58 : 85;
}
@Override
public void read(String s) {
super.read(s);
AutoMoverFactory.CIRCLE_STREAM = bool ? 58 : 85;
}
},
DANCE_MIRROR ("Mirror collage", "MirrorCollage", "Hypnotizing stuff. Toggle this ingame by pressing the M key.", Dancer.mirror) {
@Override
public void click(GameContainer container) {
bool = !bool;
Dancer.mirror = bool;
}
@Override
public void read(String s) {
super.read(s);
Dancer.mirror = bool;
}
},
DANCE_DRAW_APPROACH ("Draw approach circles", "DrawApproach", "Can get a bit busy when using mirror collage", Dancer.drawApproach) {
@Override
public void click(GameContainer container) {
bool = !bool;
Dancer.drawApproach = bool;
}
@Override
public void read(String s) {
super.read(s);
Dancer.drawApproach = bool;
}
},
DANCE_LAZY_SLIDERS ("Lazy sliders", "LazySliders", "Don't do short sliders", false),
DANCE_ONLY_CIRCLE_STACKS ("Only circle stacks", "CircleStacks", "Only do circle movement on stacks", false),
DANCE_CIRCLE_STREAMS ("Circle streams", "CircleStreams", "Make circles while streaming", false),
DANCE_MIRROR ("Mirror collage", "MirrorCollage", "Hypnotizing stuff. Toggle this ingame by pressing the M key.", false),
DANCE_DRAW_APPROACH ("Draw approach circles", "DrawApproach", "Can get a bit busy when using mirror collage", true),
DANCE_OBJECT_COLOR_OVERRIDE ("Object color override", "ObjColorOverride", "Override object colors") {
@Override
public String getValueString() {
@@ -928,7 +793,6 @@ public class Options {
Dancer.colorOverride = ObjectColorOverrides.values()[Integer.parseInt(s)];
}
},
DANCE_OBJECT_COLOR_OVERRIDE_MIRRORED ("Collage object color override", "ObjColorMirroredOverride", "Override collage object colors") {
@Override
public String getValueString() {
@@ -955,26 +819,12 @@ public class Options {
Dancer.colorMirrorOverride = ObjectColorOverrides.values()[Integer.parseInt(s)];
}
},
DANCE_RGB_OBJECT_INC ("RGB objects increment", "RGBInc", "Amount of hue to shift, used for rainbow object override", Dancer.rgbhueinc, -1800, 1800) {
DANCE_RGB_OBJECT_INC ("RGB objects increment", "RGBInc", "Amount of hue to shift, used for rainbow object override", 70, -1800, 1800) {
@Override
public String getValueString() {
return String.format("%.1f°", val / 10f);
}
@Override
public void drag(GameContainer container, int d) {
super.drag(container, d);
Dancer.rgbhueinc = val;
}
@Override
public void read(String s) {
super.read(s);
Dancer.rgbhueinc = val;
}
},
DANCE_CURSOR_COLOR_OVERRIDE ("Cursor color override", "CursorColorOverride", "Override cursor color") {
@Override
public String getValueString() {
@@ -1001,7 +851,6 @@ public class Options {
Dancer.cursorColorOverride = CursorColorOverrides.values()[Integer.parseInt(s)];
}
},
DANCE_CURSOR_MIRROR_COLOR_OVERRIDE ("Cursor mirror color override", "CursorMirrorColorOverride", "Override mirror cursor color") {
@Override
public String getValueString() {
@@ -1028,41 +877,14 @@ public class Options {
Dancer.cursorColorMirrorOverride = CursorColorOverrides.values()[Integer.parseInt(s)];
}
},
DANCE_CURSOR_ONLY_COLOR_TRAIL ("Only color cursor trail", "OnlyColorTrail", "Don't color the cursor, only the trail", Dancer.onlycolortrail) {
@Override
public void click(GameContainer container) {
bool = !bool;
Dancer.onlycolortrail = bool;
}
@Override
public void read(String s) {
super.read(s);
Dancer.onlycolortrail = bool;
}
},
DANCE_RGB_CURSOR_INC ("RGB cursor increment", "RGBCursorInc", "Amount of hue to shift, used for rainbow cursor override", Dancer.rgbhueinc, -2000, 2000) {
DANCE_CURSOR_ONLY_COLOR_TRAIL ("Only color cursor trail", "OnlyColorTrail", "Don't color the cursor, only the trail", false),
DANCE_RGB_CURSOR_INC ("RGB cursor increment", "RGBCursorInc", "Amount of hue to shift, used for rainbow cursor override", 100, -2000, 2000) {
@Override
public String getValueString() {
return String.format("%.2f°", val / 1000f);
}
@Override
public void drag(GameContainer container, int d) {
super.drag(container, d);
Dancer.rgbcursorhueinc = val;
}
@Override
public void read(String s) {
super.read(s);
Dancer.rgbcursorhueinc = val;
}
},
DANCE_CURSOR_TRAIL_OVERRIDE ("Cursor trail length override", "CursorTrailOverride", "Override cursor trail length", Dancer.cursortraillength, 20, 400) {
DANCE_CURSOR_TRAIL_OVERRIDE ("Cursor trail length override", "CursorTrailOverride", "Override cursor trail length", 20, 20, 400) {
@Override
public String getValueString() {
if (val == 20) {
@@ -1070,141 +892,20 @@ public class Options {
}
return "" + val;
}
@Override
public void drag(GameContainer container, int d) {
super.drag(container, d);
Dancer.cursortraillength = val;
}
@Override
public void read(String s) {
super.read(s);
Dancer.cursortraillength = val;
}
},
DANCE_HIDE_OBJECTS ("Don't draw objects", "HideObj", "If you only want to see cursors :)", Dancer.hideobjects) {
@Override
public void click(GameContainer container) {
bool = !bool;
Dancer.hideobjects = bool;
}
@Override
public void read(String s) {
super.read(s);
Dancer.hideobjects = bool;
}
},
DANCE_REMOVE_BG ("Use black background instead of image", "RemoveBG", "Hello darkness my old friend", Dancer.removebg) {
@Override
public void click(GameContainer container) {
bool = !bool;
Dancer.removebg = bool;
}
@Override
public void read(String s) {
super.read(s);
Dancer.removebg = bool;
}
},
DANCE_CIRLCE_IN_SLOW_SLIDERS ("Do circles in slow sliders", "CircleInSlider", "Circle around sliderball in lazy & slow sliders", Pippi.circleSlowSliders) {
@Override
public void click(GameContainer container) {
bool = !bool;
Pippi.circleSlowSliders = bool;
}
@Override
public void read(String s) {
super.read(s);
Pippi.circleSlowSliders = bool;
}
},
DANCE_CIRLCE_IN_LAZY_SLIDERS ("Do circles in lazy sliders", "CircleInLazySlider", "Circle in hitcircle in lazy sliders", Pippi.circleLazySliders) {
@Override
public void click(GameContainer container) {
bool = !bool;
Pippi.circleLazySliders = bool;
}
@Override
public void read(String s) {
super.read(s);
Pippi.circleLazySliders = bool;
}
},
DANCE_HIDE_UI ("Hide all UI", "HideUI", ".", Dancer.hideui) {
@Override
public void click(GameContainer container) {
bool = !bool;
Dancer.hideui = bool;
}
@Override
public void read(String s) {
super.read(s);
Dancer.hideui = bool;
}
},
DANCE_ENABLE_SB ("Enable storyboard editor", "EnableStoryBoard", "Dance storyboard", false) {
@Override
public void click(GameContainer container) {
super.click(container);
SBOverlay.isActive = bool;
}
@Override
public void read(String s) {
super.read(s);
SBOverlay.isActive = bool;
}
},
DANCE_HIDE_WATERMARK ("Hide watermark", "HideWaterMark", "Hide the githublink in the top left corner of the playfield", false) {
@Override
public String getValueString() {
return Dancer.hidewatermark ? "Yes" : "No";
}
@Override
public void click(GameContainer container) {
Dancer.hidewatermark = false;
}
@Override
public boolean showRWM() {
return !Dancer.hidewatermark;
}
},
PIPPI_ENABLE ("Pippi", "Pippi", "Move in circles like dancing pippi (osu! april fools joke 2016)", Pippi.enabled) {
@Override
public void click(GameContainer container) {
bool = !bool;
Pippi.enabled = bool;
}
@Override
public void read(String s) {
super.read(s);
Pippi.enabled = bool;
}
},
PIPPI_RADIUS_PERCENT ("Pippi radius", "PippiRad", "Radius of pippi, percentage of circle radius", 200, 0, 200) {
DANCE_HIDE_OBJECTS ("Don't draw objects", "HideObj", "If you only want to see cursors :)", false),
DANCE_REMOVE_BG ("Use black background instead of image", "RemoveBG", "Hello darkness my old friend", true),
DANCE_CIRLCE_IN_SLOW_SLIDERS ("Do circles in slow sliders", "CircleInSlider", "Circle around sliderball in lazy & slow sliders", false),
DANCE_CIRLCE_IN_LAZY_SLIDERS ("Do circles in lazy sliders", "CircleInLazySlider", "Circle in hitcircle in lazy sliders", false),
DANCE_HIDE_UI ("Hide all UI", "HideUI", ".", true),
DANCE_ENABLE_SB ("Enable storyboard editor", "EnableStoryBoard", "Dance storyboard", false),
DANCE_HIDE_WATERMARK ("Hide watermark", "HideWaterMark", "Hide the githublink in the top left corner of the playfield", false),
PIPPI_ENABLE ("Pippi", "Pippi", "Move in circles like dancing pippi (osu! april fools joke 2016)", false),
PIPPI_RADIUS_PERCENT ("Pippi radius", "PippiRad", "Radius of pippi, percentage of circle radius", 100, 0, 100) {
@Override
public String getValueString() {
return (val / 2) + "%";
}
@Override
public void drag(GameContainer container, int d) {
super.drag(container, d);
@@ -1217,72 +918,20 @@ public class Options {
Pippi.setRadiusPercent(val / 2);
}
},
PIPPI_ANGLE_INC_MUL("Pippi angle increment multiplier", "PippiAngIncMul", "How fast pippi's angle increments", Pippi.angleInc, -200, 200) {
PIPPI_ANGLE_INC_MUL("Pippi angle increment multiplier", "PippiAngIncMul", "How fast pippi's angle increments", 10, -200, 200) {
@Override
public String getValueString() {
return String.format("x%.1f", val / 10f);
}
@Override
public void drag(GameContainer container, int d) {
super.drag(container, d);
Pippi.angleInc = val;
}
@Override
public void read(String s) {
super.read(s);
Pippi.angleInc = val;
}
},
PIPPI_ANGLE_INC_MUL_SLIDER ("Pippi angle increment multiplier slider", "PippiAngIncMulSlider", "Same as above, but in sliders", Pippi.angleSliderInc, -200, 200) {
PIPPI_ANGLE_INC_MUL_SLIDER ("Pippi angle increment multiplier slider", "PippiAngIncMulSlider", "Same as above, but in sliders", 50, -200, 200) {
@Override
public String getValueString() {
return String.format("x%.1f", val / 10f);
}
@Override
public void drag(GameContainer container, int d) {
super.drag(container, d);
Pippi.angleSliderInc = val;
}
@Override
public void read(String s) {
super.read(s);
Pippi.angleSliderInc = val;
}
},
PIPPI_SLIDER_FOLLOW_EXPAND ("Followcircle expand", "PippiFollowExpand", "Increase radius in followcircles", Pippi.followcircleExpand) {
@Override
public void click(GameContainer container) {
bool = !bool;
Pippi.followcircleExpand = bool;
}
@Override
public void read(String s) {
super.read(s);
Pippi.followcircleExpand = bool;
}
},
PIPPI_PREVENT_WOBBLY_STREAMS ("Prevent wobbly streams", "PippiPreventWobblyStreams", "Force linear mover while doing streams to prevent wobbly pippi", Pippi.preventWobblyStreams) {
@Override
public void click(GameContainer container) {
bool = !bool;
Pippi.preventWobblyStreams = bool;
}
@Override
public void read(String s) {
super.read(s);
Pippi.preventWobblyStreams = bool;
}
};
PIPPI_SLIDER_FOLLOW_EXPAND ("Followcircle expand", "PippiFollowExpand", "Increase radius in followcircles", false),
PIPPI_PREVENT_WOBBLY_STREAMS ("Prevent wobbly streams", "PippiPreventWobblyStreams", "Force linear mover while doing streams to prevent wobbly pippi", true);
/** Option name. */
@@ -1306,7 +955,7 @@ public class Options {
private int max, min;
/** Option types. */
private enum OptionType { BOOLEAN, NUMERIC, OTHER };
public enum OptionType { BOOLEAN, NUMERIC, OTHER };
/** Whether or not this is a numeric option. */
private OptionType type = OptionType.OTHER;
@@ -1385,8 +1034,6 @@ public class Options {
*/
public String getDescription() { return description; }
public boolean showRWM() { return false; } // this is probably a shitty way to implement this :)
/**
* Returns the boolean value for the option, if applicable.
* @return the boolean value
@@ -1456,7 +1103,7 @@ public class Options {
* @param container the game container
* @param d the dragged distance (modified by multiplier)
*/
public void drag(GameContainer container, int d) {
public void drag(GameContainer container, int d) { // TODO rename this
if (type == OptionType.NUMERIC)
val = Utils.clamp(val + d, min, max);
}
@@ -1495,8 +1142,8 @@ public class Options {
bool = Boolean.parseBoolean(s);
}
public boolean isDragOption() {
return type == OptionType.NUMERIC;
public OptionType getType() {
return type;
}
public int getMinValue() {
@@ -1698,6 +1345,88 @@ public class Options {
}
}
public static int getQuadBezAggressiveness() {
return GameOption.DANCE_QUAD_BEZ_AGGRESSIVENESS.getIntegerValue();
}
public static int getQuadBezSliderAggressiveness() {
return GameOption.DANCE_QUAD_BEZ_SLIDER_AGGRESSIVENESS_FACTOR.getIntegerValue();
}
public static boolean isQuadBezCubicEnabled() {
return GameOption.DANCE_QUAD_BEZ_USE_CUBIC_ON_SLIDERS.getBooleanValue();
}
public static int getQuadBezSliderEntryAggressiveness() {
return GameOption.DANCE_QUAD_BEZ_CUBIC_AGGRESSIVENESS_FACTOR.getIntegerValue();
}
public static int getSpinnerDelay() {
return GameOption.DANCE_SPINNER_DELAY.getIntegerValue();
}
public static boolean isLazySliders() {
return GameOption.DANCE_LAZY_SLIDERS.getBooleanValue();
}
public static boolean isOnlyCircleStacks() {
return GameOption.DANCE_ONLY_CIRCLE_STACKS.getBooleanValue();
}
public static boolean isCircleStreams() {
return GameOption.DANCE_CIRCLE_STREAMS.getBooleanValue();
}
public static boolean isMirror() {
return GameOption.DANCE_MIRROR.getBooleanValue();
}
public static void setMirror(boolean mirror) {
GameOption.DANCE_MIRROR.setValue(mirror);
}
public static boolean isDrawApproach() {
return GameOption.DANCE_DRAW_APPROACH.getBooleanValue();
}
public static int getRGBObjInc() {
return GameOption.DANCE_RGB_OBJECT_INC.getIntegerValue();
}
public static boolean isCursorOnlyColorTrail() {
return GameOption.DANCE_CURSOR_ONLY_COLOR_TRAIL.getBooleanValue();
}
public static int getRGBCursorInc() {
return GameOption.DANCE_RGB_CURSOR_INC.getIntegerValue();
}
public static int getCursorTrailOverride() {
return GameOption.DANCE_CURSOR_TRAIL_OVERRIDE.getIntegerValue();
}
public static boolean isHideObjects() {
return GameOption.DANCE_HIDE_OBJECTS.getBooleanValue();
}
public static boolean isRemoveBG() {
return GameOption.DANCE_REMOVE_BG.getBooleanValue();
}
public static boolean isCircleInSlowSliders() {
return GameOption.DANCE_CIRLCE_IN_SLOW_SLIDERS.getBooleanValue();
}
public static boolean isCircleInLazySliders() {
return GameOption.DANCE_CIRLCE_IN_LAZY_SLIDERS.getBooleanValue();
}
public static boolean isHideUI() {
return GameOption.DANCE_HIDE_UI.getBooleanValue();
}
public static boolean isEnableSB() {
return GameOption.DANCE_ENABLE_SB.getBooleanValue();
}
public static boolean isHideWM() {
return GameOption.DANCE_HIDE_WATERMARK.getBooleanValue();
}
public static boolean isPippiEnabled() {
return GameOption.PIPPI_ENABLE.getBooleanValue();
}
public static int getPippiAngIncMultiplier() {
return GameOption.PIPPI_ANGLE_INC_MUL.getIntegerValue();
}
public static int getPippiAngIncMultiplierSlider() {
return GameOption.PIPPI_ANGLE_INC_MUL_SLIDER.getIntegerValue();
}
public static boolean isPippiFollowcircleExpand() {
return GameOption.PIPPI_SLIDER_FOLLOW_EXPAND.getBooleanValue();
}
public static boolean isPippiPreventWobblyStreams() {
return GameOption.PIPPI_PREVENT_WOBBLY_STREAMS.getBooleanValue();
}
/**
* Returns whether or not fullscreen mode is enabled.
* @return true if enabled

View File

@@ -130,7 +130,7 @@ public class Circle extends GameObject {
float oldAlpha = Colors.WHITE_FADE.a;
Colors.WHITE_FADE.a = color.a = alpha;
if (timeDiff >= 0 && !GameMod.HIDDEN.isActive() && Dancer.drawApproach)
if (timeDiff >= 0 && !GameMod.HIDDEN.isActive() && Options.isDrawApproach())
GameImage.APPROACHCIRCLE.getImage().getScaledCopy(approachScale).drawCentered(x, y, color);
GameImage.HITCIRCLE.getImage().drawCentered(x, y, color);
boolean overlayAboveNumber = Options.getSkin().isHitCircleOverlayAboveNumber();
@@ -196,7 +196,7 @@ public class Circle extends GameObject {
if (trackPosition > time + hitResultOffset[GameData.HIT_50]) {
if (isAutoMod) {// "auto" mod: catch any missed notes due to lag
data.hitResult(time, GameData.HIT_300, x, y, color, comboEnd, hitObject, HitObjectType.CIRCLE, true, 0, null, false);
if (Dancer.mirror && GameMod.AUTO.isActive()) {
if (Options.isMirror() && GameMod.AUTO.isActive()) {
float[] m = Utils.mirrorPoint(x, y);
data.hitResult(time, GameData.HIT_300, m[0], m[1], mirrorColor, comboEnd, hitObject, HitObjectType.CIRCLE, true, 0, null, false, false);
}
@@ -211,7 +211,7 @@ public class Circle extends GameObject {
else if (isAutoMod) {
if (Math.abs(trackPosition - time) < hitResultOffset[GameData.HIT_300]) {
data.hitResult(time, GameData.HIT_300, x, y, color, comboEnd, hitObject, HitObjectType.CIRCLE, true, 0, null, false);
if (Dancer.mirror && GameMod.AUTO.isActive()) {
if (Options.isMirror() && GameMod.AUTO.isActive()) {
float[] m = Utils.mirrorPoint(x, y);
data.hitResult(time, GameData.HIT_300, m[0], m[1], mirrorColor, comboEnd, hitObject, HitObjectType.CIRCLE, true, 0, null, false, false);
}

View File

@@ -311,7 +311,7 @@ public class Slider extends GameObject {
if (mirror) {
g.rotate(x, y, -180f);
}
if (!GameMod.HIDDEN.isActive() && Dancer.drawApproach) {
if (!GameMod.HIDDEN.isActive() && Options.isDrawApproach()) {
GameImage.APPROACHCIRCLE.getImage().getScaledCopy(approachScale).drawCentered(x, y, color);
}
g.popTransform();
@@ -515,7 +515,7 @@ public class Slider extends GameObject {
data.hitResult(hitObject.getTime() + (int) sliderTimeTotal, result,
cx, cy, color, comboEnd, hitObject, type, sliderHeldToEnd,
currentRepeats + 1, curve, sliderHeldToEnd);
if (Dancer.mirror && GameMod.AUTO.isActive()) {
if (Options.isMirror() && GameMod.AUTO.isActive()) {
float[] m = Utils.mirrorPoint(cx, cy);
data.hitResult(hitObject.getTime() + (int) sliderTimeTotal, result,
m[0], m[1], mirrorColor, comboEnd, hitObject, type, sliderHeldToEnd,

View File

@@ -299,14 +299,13 @@ public class Game extends BasicGameState {
private final int state;
private final Cursor mirrorCursor;
private final SBOverlay sbOverlay;
private SBOverlay sbOverlay;
private FakeCombinedCurve knorkesliders;
public Game(int state) {
this.state = state;
mirrorCursor = new Cursor(true);
sbOverlay = new SBOverlay(this);
}
public void loadCheckpoint(int checkpoint) {
@@ -347,6 +346,7 @@ public class Game extends BasicGameState {
@Override
public void init(GameContainer container, StateBasedGame game)
throws SlickException {
this.sbOverlay = new SBOverlay(this, container);
this.container = container;
this.game = game;
input = container.getInput();
@@ -354,8 +354,6 @@ public class Game extends BasicGameState {
int width = container.getWidth();
int height = container.getHeight();
sbOverlay.init(container, input, width, height);
// create offscreen graphics
offscreen = new Image(width, height);
gOffscreen = offscreen.getGraphics();
@@ -396,7 +394,7 @@ public class Game extends BasicGameState {
}
// background
if (!Dancer.removebg && GameMod.AUTO.isActive()) {
if (!Options.isRemoveBG() && GameMod.AUTO.isActive()) {
float dimLevel = Options.getBackgroundDim();
if (trackPosition < firstObjectTime) {
if (timeDiff < approachTime)
@@ -510,7 +508,7 @@ public class Game extends BasicGameState {
Colors.BLACK_ALPHA.a = a;
}
if (!Dancer.hideui || !GameMod.AUTO.isActive()) {
if (!Options.isHideUI() || !GameMod.AUTO.isActive()) {
data.drawGameElements(g, true, objectIndex == 0);
}
@@ -548,7 +546,7 @@ public class Game extends BasicGameState {
// non-break
else {
if (!GameMod.AUTO.isActive() || !Dancer.hideui) {
if (!GameMod.AUTO.isActive() || !Options.isHideUI()) {
// game elements
data.drawGameElements(g, false, objectIndex == 0);
@@ -672,11 +670,11 @@ public class Game extends BasicGameState {
}
}
if (!Dancer.hideui && GameMod.AUTO.isActive())
if (!Options.isHideUI() && GameMod.AUTO.isActive())
GameImage.UNRANKED.getImage().drawCentered(width / 2, height * 0.077f);
// draw replay speed button
if (isReplay || (!Dancer.hideui && GameMod.AUTO.isActive()))
if (isReplay || (!Options.isHideUI()&& GameMod.AUTO.isActive()))
playbackSpeed.getButton().draw();
// draw music position bar (for replay seeking)
@@ -711,7 +709,7 @@ public class Game extends BasicGameState {
UI.draw(g, replayX, replayY, replayKeyPressed);
else if (GameMod.AUTO.isActive()) {
UI.draw(g, (int) autoMousePosition.x, (int) autoMousePosition.y, autoMousePressed);
if (Dancer.mirror && GameMod.AUTO.isActive()) {
if (Options.isMirror() && GameMod.AUTO.isActive()) {
double dx = autoMousePosition.x - Options.width / 2d;
double dy = autoMousePosition.y - Options.height / 2d;
double d = Math.sqrt(dx * dx + dy * dy);
@@ -724,9 +722,9 @@ public class Game extends BasicGameState {
else
UI.draw(g);
sbOverlay.render(container, game, g);
sbOverlay.render(container, g);
if (!Dancer.hidewatermark) {
if (!Options.isHideWM()) {
Fonts.SMALL.drawString(0.3f, 0.3f, "opsu!dance " + Updater.get().getCurrentVersion() + " by robin_be | https://github.com/yugecin/opsu-dance");
}
}
@@ -741,7 +739,7 @@ public class Game extends BasicGameState {
}
yugecin.opsudance.spinners.Spinner.update(delta);
int mouseX = input.getMouseX(), mouseY = input.getMouseY();
sbOverlay.update(mouseX, mouseY);
sbOverlay.update(delta, mouseX, mouseY);
skipButton.hoverUpdate(delta, mouseX, mouseY);
if (isReplay || GameMod.AUTO.isActive())
playbackSpeed.getButton().hoverUpdate(delta, mouseX, mouseY);
@@ -853,7 +851,7 @@ public class Game extends BasicGameState {
}
// update in-game scoreboard
if (!Dancer.hideui && previousScores != null && trackPosition > firstObjectTime) {
if (!Options.isHideUI() && previousScores != null && trackPosition > firstObjectTime) {
// show scoreboard if selected, and always in break
if (scoreboardVisible || breakTime > 0) {
currentScoreboardAlpha += 1f / SCOREBOARD_FADE_IN_TIME * delta;
@@ -1035,7 +1033,7 @@ public class Game extends BasicGameState {
objectIndex++; // done, so increment object index
sbOverlay.updateIndex(objectIndex);
if (objectIndex >= mirrorTo) {
Dancer.mirror = false;
Options.setMirror(false);
}
} else
break;
@@ -1150,30 +1148,30 @@ public class Game extends BasicGameState {
Utils.takeScreenShot();
break;
case Input.KEY_TAB:
if (!Dancer.hideui) {
if (!Options.isHideUI()) {
scoreboardVisible = !scoreboardVisible;
}
break;
case Input.KEY_M:
if (Dancer.mirror) {
if (Options.isMirror()) {
mirrorTo = objectIndex;
Dancer.mirror = false;
Options.setMirror(false);
} else {
mirrorCursor.resetLocations();
mirrorFrom = objectIndex;
mirrorTo = gameObjects.length;
Dancer.mirror = true;
Options.setMirror(true);
}
break;
case Input.KEY_P:
if (Dancer.mirror) {
if (Options.isMirror()) {
mirrorTo = objectIndex;
Dancer.mirror = false;
Options.setMirror(false);
} else {
mirrorCursor.resetLocations();
mirrorFrom = objectIndex;
mirrorTo = mirrorFrom + 1;
Dancer.mirror = true;
Options.setMirror(true);
}
break;
case Input.KEY_MINUS:
@@ -1189,7 +1187,10 @@ public class Game extends BasicGameState {
@Override
public void mouseDragged(int oldx, int oldy, int newx, int newy) {
sbOverlay.mouseDragged(oldx, oldy, newx, newy);
if (sbOverlay.mouseDragged(oldx, oldy, newx, newy)) {
//noinspection UnnecessaryReturnStatement
return;
}
}
@Override
@@ -1622,7 +1623,7 @@ public class Game extends BasicGameState {
stack.add(index);
// draw follow points
if (!Options.isFollowPointEnabled() || loseState)
if (!Options.isFollowPointEnabled() || loseState || !Options.isHideObjects())
continue;
if (beatmap.objects[index].isSpinner()) {
lastObjectIndex = -1;
@@ -1687,9 +1688,9 @@ public class Game extends BasicGameState {
// normal case
if (!loseState) {
if (!Dancer.hideobjects) {
if (!Options.isHideObjects()) {
gameObj.draw(g, trackPosition, false);
if (Dancer.mirror && GameMod.AUTO.isActive() && idx < mirrorTo && idx >= mirrorFrom) {
if (Options.isMirror() && GameMod.AUTO.isActive() && idx < mirrorTo && idx >= mirrorFrom) {
g.pushTransform();
g.rotate(Options.width / 2f, Options.height / 2f, 180f);
gameObj.draw(g, trackPosition, true);
@@ -1729,7 +1730,7 @@ public class Game extends BasicGameState {
}
// draw result objects
if (!Dancer.hideobjects) {
if (!Options.isHideObjects()) {
data.drawHitResults(trackPosition);
}
}

View File

@@ -22,39 +22,32 @@ import itdelatrisu.opsu.GameImage;
import itdelatrisu.opsu.Opsu;
import itdelatrisu.opsu.Options;
import itdelatrisu.opsu.Options.GameOption;
import itdelatrisu.opsu.Utils;
import itdelatrisu.opsu.audio.MusicController;
import itdelatrisu.opsu.audio.SoundController;
import itdelatrisu.opsu.audio.SoundEffect;
import itdelatrisu.opsu.ui.Colors;
import itdelatrisu.opsu.ui.Fonts;
import itdelatrisu.opsu.ui.MenuButton;
import itdelatrisu.opsu.ui.UI;
import java.util.*;
import org.newdawn.slick.Color;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Image;
import org.newdawn.slick.Input;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.state.BasicGameState;
import org.newdawn.slick.state.StateBasedGame;
import org.newdawn.slick.state.transition.FadeInTransition;
import org.newdawn.slick.state.transition.EmptyTransition;
import yugecin.opsudance.ui.ItemList;
import yugecin.opsudance.ui.RWM;
import yugecin.opsudance.ui.OptionsOverlay;
import yugecin.opsudance.ui.OptionsOverlay.OptionTab;
/**
* "Game Options" state.
* <p>
* Players are able to view and change various game settings in this state.
*/
public class OptionsMenu extends BasicGameState {
public class OptionsMenu extends BasicGameState implements OptionsOverlay.Parent {
/** Option tabs. */
private enum OptionTab {
DISPLAY ("Display", new GameOption[] {
private static final OptionTab[] options = new OptionsOverlay.OptionTab[]{
new OptionTab("Display", new GameOption[]{
GameOption.SCREEN_RESOLUTION,
GameOption.FULLSCREEN,
GameOption.ALLOW_LARGER_RESOLUTIONS,
@@ -67,7 +60,7 @@ public class OptionsMenu extends BasicGameState {
GameOption.LOAD_HD_IMAGES,
GameOption.LOAD_VERBOSE
}),
MUSIC ("Music", new GameOption[] {
new OptionTab("Music", new GameOption[] {
GameOption.MASTER_VOLUME,
GameOption.MUSIC_VOLUME,
GameOption.EFFECT_VOLUME,
@@ -77,7 +70,7 @@ public class OptionsMenu extends BasicGameState {
GameOption.DISABLE_SOUNDS,
GameOption.ENABLE_THEME_SONG
}),
GAMEPLAY ("Gameplay", new GameOption[] {
new OptionTab("Gameplay", new GameOption[] {
GameOption.BACKGROUND_DIM,
GameOption.FORCE_DEFAULT_PLAYFIELD,
GameOption.IGNORE_BEATMAP_SKINS,
@@ -95,7 +88,7 @@ public class OptionsMenu extends BasicGameState {
GameOption.MAP_END_DELAY,
GameOption.EPILEPSY_WARNING,
}),
INPUT ("Input", new GameOption[] {
new OptionTab("Input", new GameOption[] {
GameOption.KEY_LEFT,
GameOption.KEY_RIGHT,
GameOption.DISABLE_MOUSE_WHEEL,
@@ -104,7 +97,7 @@ public class OptionsMenu extends BasicGameState {
GameOption.NEW_CURSOR,
GameOption.DISABLE_CURSOR
}),
CUSTOM ("Custom", new GameOption[] {
new OptionTab("Custom", new GameOption[] {
GameOption.FIXED_CS,
GameOption.FIXED_HP,
GameOption.FIXED_AR,
@@ -114,7 +107,7 @@ public class OptionsMenu extends BasicGameState {
GameOption.DISABLE_UPDATER,
GameOption.ENABLE_WATCH_SERVICE
}),
DANCE ("Dance", new GameOption[] {
new OptionTab("Dance", new GameOption[] {
GameOption.DANCE_MOVER,
GameOption.DANCE_QUAD_BEZ_AGGRESSIVENESS,
GameOption.DANCE_QUAD_BEZ_SLIDER_AGGRESSIVENESS_FACTOR,
@@ -131,7 +124,7 @@ public class OptionsMenu extends BasicGameState {
GameOption.DANCE_CIRLCE_IN_LAZY_SLIDERS,
GameOption.DANCE_MIRROR,
}),
DANCEDISP ("Dance display", new GameOption[] {
new OptionTab("Dance display", new GameOption[] {
GameOption.DANCE_DRAW_APPROACH,
GameOption.DANCE_OBJECT_COLOR_OVERRIDE,
GameOption.DANCE_OBJECT_COLOR_OVERRIDE_MIRRORED,
@@ -147,406 +140,80 @@ public class OptionsMenu extends BasicGameState {
GameOption.DANCE_ENABLE_SB,
GameOption.DANCE_HIDE_WATERMARK,
}),
PIPPI ("Pippi", new GameOption[] {
new OptionTab ("Pippi", new GameOption[] {
GameOption.PIPPI_ENABLE,
GameOption.PIPPI_RADIUS_PERCENT,
GameOption.PIPPI_ANGLE_INC_MUL,
GameOption.PIPPI_ANGLE_INC_MUL_SLIDER,
GameOption.PIPPI_SLIDER_FOLLOW_EXPAND,
GameOption.PIPPI_PREVENT_WOBBLY_STREAMS,
});
})
};
/** Total number of tabs. */
public static final int SIZE = values().length;
/** Array of OptionTab objects in reverse order. */
public static final OptionTab[] VALUES_REVERSED;
static {
VALUES_REVERSED = values();
Collections.reverse(Arrays.asList(VALUES_REVERSED));
}
/** Enum values. */
private static OptionTab[] values = values();
/** Tab name. */
private final String name;
/** Options array. */
public final GameOption[] options;
/** Associated tab button. */
public MenuButton button;
/**
* Constructor.
* @param name the tab name
* @param options the options to display under the tab
*/
OptionTab(String name, GameOption[] options) {
this.name = name;
this.options = options;
}
/**
* Returns the tab name.
*/
public String getName() { return name; }
/**
* Returns the next tab.
*/
public OptionTab next() { return values[(this.ordinal() + 1) % values.length]; }
/**
* Returns the previous tab.
*/
public OptionTab prev() { return values[(this.ordinal() + (SIZE - 1)) % values.length]; }
}
/** Current tab. */
private OptionTab currentTab;
/** Key entry states. */
private boolean keyEntryLeft = false, keyEntryRight = false;
/** Game option coordinate modifiers (for drawing). */
private int textY, offsetY;
// game-related variables
private GameContainer container;
private StateBasedGame game;
private Input input;
private Graphics g;
private final int state;
private GameOption selectedOption;
private final ItemList list;
private final RWM rwm;
private OptionsOverlay optionsOverlay;
public OptionsMenu(int state) {
this.state = state;
list = new ItemList();
rwm = new RWM();
}
@Override
public void init(GameContainer container, StateBasedGame game)
throws SlickException {
list.init(container);
rwm.init(container);
this.container = container;
this.game = game;
this.input = container.getInput();
this.g = container.getGraphics();
int width = container.getWidth();
int height = container.getHeight();
// option tabs
Image tabImage = GameImage.MENU_TAB.getImage();
float tabX = width * 0.032f + (tabImage.getWidth() / 3);
float tabY = Fonts.XLARGE.getLineHeight() + Fonts.DEFAULT.getLineHeight() +
height * 0.015f - (tabImage.getHeight() / 2f);
int tabOffset = Math.min(tabImage.getWidth(), width / OptionTab.SIZE);
for (OptionTab tab : OptionTab.values())
tab.button = new MenuButton(tabImage, tabX + (tab.ordinal() * tabOffset), tabY);
// game option coordinate modifiers
textY = (int) (tabY + tabImage.getHeight());
//int backHeight = GameImage.MENU_BACK.getAnimation(1).getHeight();
//offsetY = (height - textY - (backHeight * 4 / 5)) / maxOptionsScreen;
offsetY = (int) ((Fonts.MEDIUM.getLineHeight() + Fonts.SMALL.getLineHeight()) * 1.1f);
optionsOverlay = new OptionsOverlay(this, options, 5, container);
}
@Override
public void render(GameContainer container, StateBasedGame game, Graphics g)
throws SlickException {
int width = container.getWidth();
int height = container.getHeight();
int mouseX = input.getMouseX(), mouseY = input.getMouseY();
public void render(GameContainer container, StateBasedGame game, Graphics g) throws SlickException {
// background
GameImage.OPTIONS_BG.getImage().draw();
// title
float marginX = width * 0.015f, marginY = height * 0.01f;
Fonts.XLARGE.drawString(marginX, marginY, "Options", Color.white);
Fonts.DEFAULT.drawString(marginX + Fonts.XLARGE.getWidth("Options") * 1.2f, marginY + Fonts.XLARGE.getLineHeight() * 0.9f - Fonts.DEFAULT.getLineHeight(),
"Change the way opsu! behaves", Color.white);
// game options
g.setLineWidth(1f);
GameOption hoverOption = (keyEntryLeft) ? GameOption.KEY_LEFT :
(keyEntryRight) ? GameOption.KEY_RIGHT :
getOptionAt(mouseY);
if (selectedOption != null) {
hoverOption = selectedOption;
}
for (int i = 0, j = 0; i < currentTab.options.length; i++) {
GameOption option = currentTab.options[i];
if (!option.showCondition()) {
continue;
}
drawOption(option, j++, hoverOption == option);
}
// option tabs
OptionTab hoverTab = null;
for (OptionTab tab : OptionTab.values()) {
if (tab.button.contains(mouseX, mouseY)) {
hoverTab = tab;
break;
}
}
for (OptionTab tab : OptionTab.VALUES_REVERSED) {
if (tab != currentTab)
UI.drawTab(tab.button.getX(), tab.button.getY(),
tab.getName(), false, tab == hoverTab && !list.isVisible());
}
UI.drawTab(currentTab.button.getX(), currentTab.button.getY(),
currentTab.getName(), true, false);
g.setColor(Color.white);
g.setLineWidth(2f);
float lineY = OptionTab.DISPLAY.button.getY() + (GameImage.MENU_TAB.getImage().getHeight() / 2f);
g.drawLine(0, lineY, width, lineY);
g.resetLineWidth();
if (list.isVisible()) {
list.render(container, game, g);
}
if (rwm.isVisible()) {
rwm.render(container, game, g);
}
UI.getBackButton().draw();
// key entry state
if (keyEntryLeft || keyEntryRight) {
g.setColor(Colors.BLACK_ALPHA);
g.fillRect(0, 0, width, height);
g.setColor(Color.white);
String prompt = (keyEntryLeft) ?
"Please press the new left-click key." :
"Please press the new right-click key.";
Fonts.LARGE.drawString(
(width / 2) - (Fonts.LARGE.getWidth(prompt) / 2),
(height / 2) - Fonts.LARGE.getLineHeight(), prompt
);
}
int mouseX = input.getMouseX(), mouseY = input.getMouseY();
optionsOverlay.render(g, mouseX, mouseY);
UI.draw(g);
}
@Override
public void update(GameContainer container, StateBasedGame game, int delta)
throws SlickException {
rwm.update(delta);
public void update(GameContainer container, StateBasedGame game, int delta) throws SlickException {
UI.update(delta);
MusicController.loopTrackIfEnded(false);
int mouseX = input.getMouseX(), mouseY = input.getMouseY();
UI.getBackButton().hoverUpdate(delta, mouseX, mouseY);
optionsOverlay.update(delta, input.getMouseX(), input.getMouseY());
}
@Override
public int getID() { return state; }
public int getID() {
return state;
}
@Override
public void mouseReleased(int button, int x, int y) {
selectedOption = null;
if (list.isVisible()) {
list.mouseReleased(button, x, y);
}
if (rwm.isVisible()) {
rwm.mouseReleased(button, x, y);
}
optionsOverlay.mouseReleased(button, x, y);
}
@Override
public void mousePressed(int button, int x, int y) {
if (list.isVisible()) {
list.mousePressed(button, x, y);
return;
}
if (rwm.isVisible()) {
return;
}
// key entry state
if (keyEntryLeft || keyEntryRight) {
keyEntryLeft = keyEntryRight = false;
return;
}
// check mouse button
if (button == Input.MOUSE_MIDDLE_BUTTON)
return;
// back
if (UI.getBackButton().contains(x, y)) {
SoundController.playSound(SoundEffect.MENUBACK);
game.enterState(Opsu.STATE_SONGMENU, new EmptyTransition(), new FadeInTransition());
return;
}
// option tabs
for (OptionTab tab : OptionTab.values()) {
if (tab.button.contains(x, y)) {
if (tab != currentTab) {
currentTab = tab;
SoundController.playSound(SoundEffect.MENUCLICK);
}
return;
}
}
// options (click only)
final GameOption option = getOptionAt(y);
if (option != null) {
selectedOption = option;
Object[] listItems = option.getListItems();
if (listItems == null) {
if (option.showRWM()) {
rwm.show();
} else {
option.click(container);
}
} else {
list.setItems(listItems);
list.setClickListener(new Observer() {
@Override
public void update(Observable o, Object arg) {
option.clickListItem((int) arg);
}
});
list.show();
}
}
// special key entry states
if (option == GameOption.KEY_LEFT) {
keyEntryLeft = true;
keyEntryRight = false;
} else if (option == GameOption.KEY_RIGHT) {
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);
}
optionsOverlay.mousePressed(button, x, y);
}
@Override
public void mouseDragged(int oldx, int oldy, int newx, int newy) {
if (list.isVisible()) {
list.mouseDragged(oldx, oldy, newx, newy);
return;
}
if (rwm.isVisible()) {
return;
}
// key entry state
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))
multiplier = 4;
else if (input.isMouseButtonDown(Input.MOUSE_LEFT_BUTTON))
multiplier = 1;
else
return;
// get direction
int diff = newx - oldx;
if (diff == 0)
return;
diff = ((diff > 0) ? 1 : -1) * multiplier;
// options (drag only)
selectedOption.drag(container, diff);
optionsOverlay.mouseDragged(oldx, oldy, newx, newy);
}
@Override
public void mouseWheelMoved(int newValue) {
if (list.isVisible()) {
list.mouseWheelMoved(newValue);
}
if (input.isKeyDown(Input.KEY_LALT) || input.isKeyDown(Input.KEY_RALT))
UI.changeVolume((newValue < 0) ? -1 : 1);
optionsOverlay.mouseWheelMoved(newValue);
}
@Override
public void keyPressed(int key, char c) {
if (list.isVisible()) {
list.keyPressed(key, c);
return;
}
if (rwm.isVisible()) {
rwm.keyPressed(key, c);
return;
}
// key entry state
if (keyEntryLeft || keyEntryRight) {
if (keyEntryLeft)
Options.setGameKeyLeft(key);
else
Options.setGameKeyRight(key);
keyEntryLeft = keyEntryRight = false;
return;
}
switch (key) {
case Input.KEY_ESCAPE:
SoundController.playSound(SoundEffect.MENUBACK);
game.enterState(Opsu.STATE_SONGMENU, new EmptyTransition(), new FadeInTransition());
break;
case Input.KEY_F5:
// restart application
if ((input.isKeyDown(Input.KEY_RCONTROL) || input.isKeyDown(Input.KEY_LCONTROL)) &&
(input.isKeyDown(Input.KEY_RSHIFT) || input.isKeyDown(Input.KEY_LSHIFT))) {
container.setForceExit(false);
container.exit();
}
break;
case Input.KEY_F7:
Options.setNextFPS(container);
break;
case Input.KEY_F10:
Options.toggleMouseDisabled();
break;
case Input.KEY_F12:
Utils.takeScreenShot();
break;
case Input.KEY_TAB:
// change tabs
if (input.isKeyDown(Input.KEY_LSHIFT) || input.isKeyDown(Input.KEY_RSHIFT))
currentTab = currentTab.prev();
else
currentTab = currentTab.next();
SoundController.playSound(SoundEffect.MENUCLICK);
break;
}
optionsOverlay.keyPressed(key, c);
}
/**
@@ -560,7 +227,6 @@ public class OptionsMenu extends BasicGameState {
public void enter(GameContainer container, StateBasedGame game)
throws SlickException {
UI.enter();
currentTab = OptionTab.DANCE;
restartOptions = "" + Options.getResolutionIdx() + Options.isFullscreen() + Options.allowLargeResolutions() + Options.getSkinName();
}
@@ -569,57 +235,19 @@ public class OptionsMenu extends BasicGameState {
if (!("" + Options.getResolutionIdx() + Options.isFullscreen() + Options.allowLargeResolutions() + Options.getSkinName()).equals(restartOptions)) {
container.setForceExit(false);
container.exit();
return;
}
SoundController.playSound(SoundEffect.MENUBACK);
}
/**
* Draws a game option.
* @param option the option
* @param pos the position to draw at
* @param focus whether the option is currently focused
*/
private void drawOption(GameOption option, int pos, boolean focus) {
int width = container.getWidth();
int textHeight = Fonts.MEDIUM.getLineHeight();
float y = textY + (pos * offsetY);
Color color = (focus) ? Color.cyan : Color.white;
Fonts.MEDIUM.drawString(width / 30, y, option.getName(), color);
Fonts.SMALL.drawString(width / 30, y + textHeight, option.getDescription(), color);
Fonts.MEDIUM.drawString(width / 2, y, option.getValueString(), color);
g.setColor(Colors.WHITE_ALPHA);
if (option.isDragOption()) {
float availableWidth = width / 2 - width / 30;
g.fillRect(width / 2, y + textHeight, 20, 10);
g.fillRect(width / 2 + availableWidth - 20, y + textHeight, 20, 10);
availableWidth -= 40 + 100;
float optionPercent = (float) (option.getIntegerValue() - option.getMinValue()) / (option.getMaxValue() - option.getMinValue());
g.fillRect(width / 2 + 20 + optionPercent * availableWidth, y + textHeight, 100, 10);
}
g.drawLine(0, y + textHeight, width, y + textHeight);
@Override
public void onLeave() {
game.enterState(Opsu.STATE_SONGMENU, new EmptyTransition(), new FadeInTransition());
}
/**
* Returns the option at the given y coordinate.
* @param y the y coordinate
* @return the option, or GameOption.NULL if no such option exists
*/
private GameOption getOptionAt(int y) {
if (y < textY)
return null;
@Override
public void onSaveOption(GameOption option) {
int index = (y - textY) / offsetY;
if (index >= currentTab.options.length)
return null;
for (GameOption option : currentTab.options) {
if (option.showCondition()) {
index--;
}
if (index < 0) {
return option;
}
}
return null;
}
}

View File

@@ -26,6 +26,8 @@ import org.newdawn.slick.Color;
public class Colors {
public static final Color
BLACK_ALPHA = new Color(0, 0, 0, 0.5f),
BLACK_ALPHA_75 = new Color(0, 0, 0, 0.75f),
BLACK_ALPHA_85 = new Color(0, 0, 0, 0.85f),
WHITE_ALPHA = new Color(255, 255, 255, 0.5f),
BLUE_DIVIDER = new Color(49, 94, 237),
BLUE_BACKGROUND = new Color(74, 130, 255),

View File

@@ -200,9 +200,9 @@ public class Cursor {
// draw the other components
if (newStyle && skin.isCursorRotated())
cursor.setRotation(cursorAngle);
cursor.drawCentered(mouseX, mouseY, Dancer.onlycolortrail ? Color.white : filter);
cursor.drawCentered(mouseX, mouseY, Options.isCursorOnlyColorTrail() ? Color.white : filter);
if (hasMiddle)
cursorMiddle.drawCentered(mouseX, mouseY, Dancer.onlycolortrail ? Color.white : filter);
cursorMiddle.drawCentered(mouseX, mouseY, Options.isCursorOnlyColorTrail() ? Color.white : filter);
}
/**
@@ -231,8 +231,9 @@ public class Cursor {
removeCount = trail.size() - max;
}
if (Dancer.cursortraillength > 20) {
removeCount = trail.size() - Dancer.cursortraillength;
int cursortraillength = Options.getCursorTrailOverride();
if (cursortraillength > 20) {
removeCount = trail.size() - cursortraillength;
}
// remove points from the lists