Options to use object color overrides
This commit is contained in:
@@ -55,6 +55,7 @@ import com.sun.jna.platform.win32.Advapi32Util;
|
|||||||
import com.sun.jna.platform.win32.Win32Exception;
|
import com.sun.jna.platform.win32.Win32Exception;
|
||||||
import com.sun.jna.platform.win32.WinReg;
|
import com.sun.jna.platform.win32.WinReg;
|
||||||
import yugecin.opsudance.Dancer;
|
import yugecin.opsudance.Dancer;
|
||||||
|
import yugecin.opsudance.ObjectColorOverrides;
|
||||||
import yugecin.opsudance.movers.factories.AutoMoverFactory;
|
import yugecin.opsudance.movers.factories.AutoMoverFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -666,17 +667,76 @@ public class Options {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
DANCE_RGB_OBJECTS ("Use rgb objects", "RGBObj", "Give each object a new color", false) {
|
DANCE_OBJECT_COLOR_OVERRIDE ("Object color override", "ObjColorOverride", "Override object colors") {
|
||||||
@Override
|
@Override
|
||||||
public void click(GameContainer container) {
|
public String getValueString() {
|
||||||
bool = !bool;
|
return Dancer.colorOverride.toString();
|
||||||
Dancer.rgbobj = bool;
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object[] getListItems() {
|
||||||
|
return ObjectColorOverrides.values();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clickListItem(int index) {
|
||||||
|
Dancer.colorOverride = ObjectColorOverrides.values()[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String write() {
|
||||||
|
return "" + Dancer.colorOverride.nr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void read(String s) {
|
||||||
|
Dancer.colorOverride = ObjectColorOverrides.values()[Integer.parseInt(s)];
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
DANCE_OBJECT_COLOR_OVERRIDE_MIRRORED ("Object color override", "ObjColorOverride", "Override object colors") {
|
||||||
|
@Override
|
||||||
|
public String getValueString() {
|
||||||
|
return Dancer.colorMirrorOverride.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object[] getListItems() {
|
||||||
|
return ObjectColorOverrides.values();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clickListItem(int index) {
|
||||||
|
Dancer.colorMirrorOverride = ObjectColorOverrides.values()[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String write() {
|
||||||
|
return "" + Dancer.colorMirrorOverride.nr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void read(String s) {
|
||||||
|
Dancer.colorMirrorOverride = ObjectColorOverrides.values()[Integer.parseInt(s)];
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
DANCE_RGB_INC ("RGB objects increment", "RGBInc", "Amount of hue to shift, used for rainbow object color override", Dancer.rgbhueinc, -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
|
@Override
|
||||||
public void read(String s) {
|
public void read(String s) {
|
||||||
super.read(s);
|
super.read(s);
|
||||||
Dancer.rgbobj = bool;
|
Dancer.rgbhueinc = val;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -577,6 +577,7 @@ public class Utils {
|
|||||||
return y < Options.height / 2d ? 1 : 4;
|
return y < Options.height / 2d ? 1 : 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
public static Color shiftHue(Color color, double H) {
|
public static Color shiftHue(Color color, double H) {
|
||||||
double U = Math.cos(H * Math.PI / 180d);
|
double U = Math.cos(H * Math.PI / 180d);
|
||||||
double W = Math.sin(H * Math.PI / 180d);
|
double W = Math.sin(H * Math.PI / 180d);
|
||||||
@@ -587,14 +588,6 @@ public class Utils {
|
|||||||
n.b = (float) ((0.299d + 0.300d * U + 1.250d * W) * color.r + (0.587d - 0.585d * U + 1.050d * W) * color.g + (0.114 - 0.886 * U - 0.203 * W) * color.b);
|
n.b = (float) ((0.299d + 0.300d * U + 1.250d * W) * color.r + (0.587d - 0.585d * U + 1.050d * W) * color.g + (0.114 - 0.886 * U - 0.203 * W) * color.b);
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
public static Color nextColor() {
|
|
||||||
Circle.hue += 10;
|
|
||||||
return new Color(java.awt.Color.getHSBColor(Circle.hue / 360f, 1.0f, 1.0f).getRGB());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Color currentShiftColor() {
|
|
||||||
return new Color(java.awt.Color.getHSBColor((Circle.hue + 180f) / 360f, 1.0f, 1.0f).getRGB());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,12 +55,11 @@ public class Circle extends GameObject {
|
|||||||
|
|
||||||
/** The color of this circle. */
|
/** The color of this circle. */
|
||||||
private Color color;
|
private Color color;
|
||||||
|
private Color mirrorColor;
|
||||||
|
|
||||||
/** Whether or not the circle result ends the combo streak. */
|
/** Whether or not the circle result ends the combo streak. */
|
||||||
private boolean comboEnd;
|
private boolean comboEnd;
|
||||||
|
|
||||||
public static int hue;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes the Circle data type with map modifiers, images, and dimensions.
|
* Initializes the Circle data type with map modifiers, images, and dimensions.
|
||||||
* @param container the game container
|
* @param container the game container
|
||||||
@@ -86,20 +85,17 @@ public class Circle extends GameObject {
|
|||||||
this.hitObject = hitObject;
|
this.hitObject = hitObject;
|
||||||
this.game = game;
|
this.game = game;
|
||||||
this.data = data;
|
this.data = data;
|
||||||
this.color = color;
|
|
||||||
this.comboEnd = comboEnd;
|
this.comboEnd = comboEnd;
|
||||||
updatePosition();
|
updatePosition();
|
||||||
if (Dancer.rgbobj) {
|
this.color = Dancer.colorOverride.getColor(color);
|
||||||
this.color = Utils.nextColor();
|
this.mirrorColor = Dancer.colorMirrorOverride.getColor(color);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(Graphics g, int trackPosition, boolean mirror) {
|
public void draw(Graphics g, int trackPosition, boolean mirror) {
|
||||||
Color orig = color;
|
Color orig = color;
|
||||||
if (mirror) {
|
if (mirror) {
|
||||||
//color = Utils.currentShiftColor();
|
color = mirrorColor;
|
||||||
color = Utils.shiftHue(color, 180f);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int timeDiff = hitObject.getTime() - trackPosition;
|
int timeDiff = hitObject.getTime() - trackPosition;
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ public class Slider extends GameObject {
|
|||||||
|
|
||||||
/** The color of this slider. */
|
/** The color of this slider. */
|
||||||
private Color color;
|
private Color color;
|
||||||
|
private Color mirrorColor;
|
||||||
|
|
||||||
/** The underlying Curve. */
|
/** The underlying Curve. */
|
||||||
private Curve curve;
|
private Curve curve;
|
||||||
@@ -150,18 +151,15 @@ public class Slider extends GameObject {
|
|||||||
* @param hitObject the associated HitObject
|
* @param hitObject the associated HitObject
|
||||||
* @param game the associated Game object
|
* @param game the associated Game object
|
||||||
* @param data the associated GameData object
|
* @param data the associated GameData object
|
||||||
* @param color the color of this slider
|
|
||||||
* @param comboEnd true if this is the last hit object in the combo
|
* @param comboEnd true if this is the last hit object in the combo
|
||||||
*/
|
*/
|
||||||
public Slider(HitObject hitObject, Game game, GameData data, Color color, boolean comboEnd) {
|
public Slider(HitObject hitObject, Game game, GameData data, Color color, boolean comboEnd) {
|
||||||
this.hitObject = hitObject;
|
this.hitObject = hitObject;
|
||||||
this.game = game;
|
this.game = game;
|
||||||
this.data = data;
|
this.data = data;
|
||||||
this.color = color;
|
|
||||||
this.comboEnd = comboEnd;
|
this.comboEnd = comboEnd;
|
||||||
if (Dancer.rgbobj) {
|
this.color = Dancer.colorOverride.getColor(color);
|
||||||
this.color = Utils.nextColor();
|
this.mirrorColor = Dancer.colorMirrorOverride.getColor(color);
|
||||||
}
|
|
||||||
updatePosition();
|
updatePosition();
|
||||||
|
|
||||||
// slider time calculations
|
// slider time calculations
|
||||||
@@ -186,8 +184,7 @@ public class Slider extends GameObject {
|
|||||||
public void draw(Graphics g, int trackPosition, boolean mirror) {
|
public void draw(Graphics g, int trackPosition, boolean mirror) {
|
||||||
Color orig = color;
|
Color orig = color;
|
||||||
if (mirror) {
|
if (mirror) {
|
||||||
//color = Utils.currentShiftColor();
|
color = mirrorColor;
|
||||||
color = Utils.shiftHue(color, 180f);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int timeDiff = hitObject.getTime() - trackPosition;
|
int timeDiff = hitObject.getTime() - trackPosition;
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ import org.newdawn.slick.state.transition.EasedFadeOutTransition;
|
|||||||
import org.newdawn.slick.state.transition.EmptyTransition;
|
import org.newdawn.slick.state.transition.EmptyTransition;
|
||||||
import org.newdawn.slick.state.transition.FadeInTransition;
|
import org.newdawn.slick.state.transition.FadeInTransition;
|
||||||
import yugecin.opsudance.Dancer;
|
import yugecin.opsudance.Dancer;
|
||||||
|
import yugecin.opsudance.ObjectColorOverrides;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* "Game" state.
|
* "Game" state.
|
||||||
@@ -1196,7 +1197,8 @@ public class Game extends BasicGameState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// initialize object maps
|
// initialize object maps
|
||||||
Color[] combo = beatmap.getComboColors();
|
ObjectColorOverrides.comboColors = beatmap.getComboColors();
|
||||||
|
ObjectColorOverrides.hue = 0f;
|
||||||
for (int i = 0; i < beatmap.objects.length; i++) {
|
for (int i = 0; i < beatmap.objects.length; i++) {
|
||||||
HitObject hitObject = beatmap.objects[i];
|
HitObject hitObject = beatmap.objects[i];
|
||||||
|
|
||||||
@@ -1205,7 +1207,7 @@ public class Game extends BasicGameState {
|
|||||||
if (i + 1 >= beatmap.objects.length || beatmap.objects[i + 1].isNewCombo())
|
if (i + 1 >= beatmap.objects.length || beatmap.objects[i + 1].isNewCombo())
|
||||||
comboEnd = true;
|
comboEnd = true;
|
||||||
|
|
||||||
Color color = combo[hitObject.getComboIndex()];
|
Color color = ObjectColorOverrides.comboColors[hitObject.getComboIndex()];
|
||||||
|
|
||||||
// pass beatLength to hit objects
|
// pass beatLength to hit objects
|
||||||
int hitObjectTime = hitObject.getTime();
|
int hitObjectTime = hitObject.getTime();
|
||||||
|
|||||||
@@ -112,7 +112,9 @@ public class OptionsMenu extends BasicGameState {
|
|||||||
GameOption.DANCE_ONLY_CIRCLE_STACKS,
|
GameOption.DANCE_ONLY_CIRCLE_STACKS,
|
||||||
GameOption.DANCE_MIRROR,
|
GameOption.DANCE_MIRROR,
|
||||||
GameOption.DANCE_DRAW_APPROACH,
|
GameOption.DANCE_DRAW_APPROACH,
|
||||||
GameOption.DANCE_RGB_OBJECTS,
|
GameOption.DANCE_OBJECT_COLOR_OVERRIDE,
|
||||||
|
GameOption.DANCE_OBJECT_COLOR_OVERRIDE_MIRRORED,
|
||||||
|
GameOption.DANCE_RGB_INC,
|
||||||
GameOption.DANCE_REMOVE_BG,
|
GameOption.DANCE_REMOVE_BG,
|
||||||
GameOption.DANCE_HIDE_UI,
|
GameOption.DANCE_HIDE_UI,
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -52,9 +52,11 @@ public class Dancer {
|
|||||||
|
|
||||||
public static boolean mirror; // this should really get its own place somewhere...
|
public static boolean mirror; // this should really get its own place somewhere...
|
||||||
public static boolean drawApproach; // this should really get its own place somewhere...
|
public static boolean drawApproach; // this should really get its own place somewhere...
|
||||||
public static boolean rgbobj; // this should really get its own place somewhere...
|
|
||||||
public static boolean removebg; // this should really get its own place somewhere...
|
public static boolean removebg; // this should really get its own place somewhere...
|
||||||
public static boolean hideui; // this should really get its own place somewhere...
|
public static boolean hideui; // this should really get its own place somewhere...
|
||||||
|
public static ObjectColorOverrides colorOverride = ObjectColorOverrides.NONE;
|
||||||
|
public static ObjectColorOverrides colorMirrorOverride = ObjectColorOverrides.NONE;
|
||||||
|
public static int rgbhueinc = 70; // this should really get its own place somewhere...
|
||||||
|
|
||||||
private int dir;
|
private int dir;
|
||||||
private GameObject p;
|
private GameObject p;
|
||||||
|
|||||||
83
src/yugecin/opsudance/ObjectColorOverrides.java
Normal file
83
src/yugecin/opsudance/ObjectColorOverrides.java
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
/*
|
||||||
|
* opsu!dance - fork of opsu! with cursordance auto
|
||||||
|
* Copyright (C) 2016 yugecin
|
||||||
|
*
|
||||||
|
* opsu!dance is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* opsu!dance is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with opsu!dance. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package yugecin.opsudance;
|
||||||
|
|
||||||
|
import org.newdawn.slick.Color;
|
||||||
|
|
||||||
|
public enum ObjectColorOverrides {
|
||||||
|
|
||||||
|
NONE ("None", 0) {
|
||||||
|
@Override
|
||||||
|
public Color getColor(Color color) {
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
COMBO1 ("Combo1", 1),
|
||||||
|
COMBO2 ("Combo2", 2),
|
||||||
|
COMBO3 ("Combo3", 3),
|
||||||
|
COMBO4 ("Combo4", 4),
|
||||||
|
COMBO5 ("Combo5", 5),
|
||||||
|
COMBO6 ("Combo6", 6),
|
||||||
|
COMBO7 ("Combo7", 7),
|
||||||
|
COMBO8 ("Combo8", 8),
|
||||||
|
RAINBOW ("Rainbow", 9) {
|
||||||
|
@Override
|
||||||
|
public Color getColor(Color color) {
|
||||||
|
return nextRainbowColor();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
RAINBOWSHIFT ("Rainbow + 180° hue shift", 10) {
|
||||||
|
@Override
|
||||||
|
public Color getColor(Color color) {
|
||||||
|
return nextMirrorRainbowColor();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
public int nr;
|
||||||
|
private String displayText;
|
||||||
|
|
||||||
|
public static Color[] comboColors;
|
||||||
|
|
||||||
|
public static float hue;
|
||||||
|
|
||||||
|
ObjectColorOverrides(String displayText, int nr) {
|
||||||
|
this.displayText = displayText;
|
||||||
|
this.nr = nr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return displayText;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Color getColor(Color color) {
|
||||||
|
return comboColors[nr % comboColors.length];
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Color nextRainbowColor() {
|
||||||
|
hue += Dancer.rgbhueinc / 10f;
|
||||||
|
return new Color(java.awt.Color.getHSBColor(hue / 360f, 1.0f, 1.0f).getRGB());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Color nextMirrorRainbowColor() {
|
||||||
|
return new Color(java.awt.Color.getHSBColor((hue + 180f) / 360f, 1.0f, 1.0f).getRGB());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user