Merge branch 'cursorcolors' into master
This commit is contained in:
commit
6fcff4b38f
|
@ -54,10 +54,7 @@ import org.newdawn.slick.util.ResourceLoader;
|
|||
import com.sun.jna.platform.win32.Advapi32Util;
|
||||
import com.sun.jna.platform.win32.Win32Exception;
|
||||
import com.sun.jna.platform.win32.WinReg;
|
||||
import yugecin.opsudance.Dancer;
|
||||
import yugecin.opsudance.MoverDirection;
|
||||
import yugecin.opsudance.ObjectColorOverrides;
|
||||
import yugecin.opsudance.Pippi;
|
||||
import yugecin.opsudance.*;
|
||||
import yugecin.opsudance.movers.factories.AutoMoverFactory;
|
||||
|
||||
/**
|
||||
|
@ -759,7 +756,7 @@ public class Options {
|
|||
}
|
||||
},
|
||||
|
||||
DANCE_RGB_INC ("RGB objects increment", "RGBInc", "Amount of hue to shift, used for rainbow object color override", Dancer.rgbhueinc, -1800, 1800) {
|
||||
DANCE_RGB_OBJECT_INC ("RGB objects increment", "RGBInc", "Amount of hue to shift, used for rainbow object override", Dancer.rgbhueinc, -1800, 1800) {
|
||||
@Override
|
||||
public String getValueString() {
|
||||
return String.format("%.1f°", val / 10f);
|
||||
|
@ -778,17 +775,76 @@ public class Options {
|
|||
}
|
||||
},
|
||||
|
||||
DANCE_CURSOR_USE_OBJECT_COLOR ("Give object color to cursor", "CursorUseObjectColor", "The color of the last object will be used on the cursor", Dancer.cursoruselastobjectcolor) {
|
||||
DANCE_CURSOR_COLOR_OVERRIDE ("Cursor color override", "CursorColorOverride", "Override cursor color") {
|
||||
@Override
|
||||
public void click(GameContainer container) {
|
||||
bool = !bool;
|
||||
Dancer.cursoruselastobjectcolor = bool;
|
||||
public String getValueString() {
|
||||
return Dancer.cursorColorOverride.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] getListItems() {
|
||||
return CursorColorOverrides.values();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clickListItem(int index) {
|
||||
Dancer.cursorColorOverride = CursorColorOverrides.values()[index];
|
||||
}
|
||||
|
||||
@Override
|
||||
public String write() {
|
||||
return "" + Dancer.cursorColorOverride.nr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(String s) {
|
||||
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() {
|
||||
return Dancer.cursorColorMirrorOverride.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] getListItems() {
|
||||
return CursorColorOverrides.values();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clickListItem(int index) {
|
||||
Dancer.cursorColorMirrorOverride = CursorColorOverrides.values()[index];
|
||||
}
|
||||
|
||||
@Override
|
||||
public String write() {
|
||||
return "" + Dancer.cursorColorMirrorOverride.nr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(String s) {
|
||||
Dancer.cursorColorMirrorOverride = CursorColorOverrides.values()[Integer.parseInt(s)];
|
||||
}
|
||||
},
|
||||
|
||||
DANCE_RGB_CURSOR_INC ("RGB cursor increment", "RGBCursorInc", "Amount of hue to shift, used for rainbow cursor override", Dancer.rgbhueinc, -1800, 1800) {
|
||||
@Override
|
||||
public String getValueString() {
|
||||
return String.format("%.1f°", val / 100f);
|
||||
}
|
||||
|
||||
@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.cursoruselastobjectcolor = bool;
|
||||
Dancer.rgbcursorhueinc = val;
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -70,10 +70,7 @@ import org.newdawn.slick.state.transition.DelayedFadeOutTransition;
|
|||
import org.newdawn.slick.state.transition.EasedFadeOutTransition;
|
||||
import org.newdawn.slick.state.transition.EmptyTransition;
|
||||
import org.newdawn.slick.state.transition.FadeInTransition;
|
||||
import yugecin.opsudance.Dancer;
|
||||
import yugecin.opsudance.MoverDirection;
|
||||
import yugecin.opsudance.ObjectColorOverrides;
|
||||
import yugecin.opsudance.Pippi;
|
||||
import yugecin.opsudance.*;
|
||||
|
||||
/**
|
||||
* "Game" state.
|
||||
|
@ -1218,7 +1215,7 @@ public class Game extends BasicGameState {
|
|||
}
|
||||
|
||||
// initialize object maps
|
||||
ObjectColorOverrides.comboColors = beatmap.getComboColors();
|
||||
CursorColorOverrides.comboColors = ObjectColorOverrides.comboColors = beatmap.getComboColors();
|
||||
ObjectColorOverrides.hue = 0f;
|
||||
for (int i = 0; i < beatmap.objects.length; i++) {
|
||||
HitObject hitObject = beatmap.objects[i];
|
||||
|
|
|
@ -118,8 +118,10 @@ public class OptionsMenu extends BasicGameState {
|
|||
GameOption.DANCE_DRAW_APPROACH,
|
||||
GameOption.DANCE_OBJECT_COLOR_OVERRIDE,
|
||||
GameOption.DANCE_OBJECT_COLOR_OVERRIDE_MIRRORED,
|
||||
GameOption.DANCE_RGB_INC,
|
||||
GameOption.DANCE_CURSOR_USE_OBJECT_COLOR,
|
||||
GameOption.DANCE_RGB_OBJECT_INC,
|
||||
GameOption.DANCE_CURSOR_COLOR_OVERRIDE,
|
||||
GameOption.DANCE_CURSOR_MIRROR_COLOR_OVERRIDE,
|
||||
GameOption.DANCE_RGB_CURSOR_INC,
|
||||
GameOption.DANCE_REMOVE_BG,
|
||||
GameOption.DANCE_HIDE_OBJECTS,
|
||||
GameOption.DANCE_HIDE_UI,
|
||||
|
|
|
@ -190,7 +190,12 @@ public class Cursor {
|
|||
for (int i = 0; i < removeCount && !trail.isEmpty(); i++)
|
||||
trail.remove();
|
||||
|
||||
Color filter = getColorFilter();
|
||||
Color filter;
|
||||
if (isMirrored) {
|
||||
filter = Dancer.cursorColorMirrorOverride.getMirrorColor();
|
||||
} else {
|
||||
filter = Dancer.cursorColorOverride.getColor();
|
||||
}
|
||||
|
||||
// draw a fading trail
|
||||
float alpha = 0f;
|
||||
|
@ -218,16 +223,6 @@ public class Cursor {
|
|||
cursorMiddle.drawCentered(mouseX, mouseY, filter);
|
||||
}
|
||||
|
||||
private Color getColorFilter() {
|
||||
if (!Dancer.cursoruselastobjectcolor) {
|
||||
return Color.white;
|
||||
}
|
||||
if (isMirrored) {
|
||||
return lastMirroredObjColor;
|
||||
}
|
||||
return lastObjColor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds all points between (x1, y1) and (x2, y2) to the cursor point lists.
|
||||
* @author http://rosettacode.org/wiki/Bitmap/Bresenham's_line_algorithm#Java
|
||||
|
|
109
src/yugecin/opsudance/CursorColorOverrides.java
Normal file
109
src/yugecin/opsudance/CursorColorOverrides.java
Normal file
|
@ -0,0 +1,109 @@
|
|||
/*
|
||||
* 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 itdelatrisu.opsu.ui.Cursor;
|
||||
import org.newdawn.slick.Color;
|
||||
|
||||
public enum CursorColorOverrides {
|
||||
|
||||
NONE ("None", 0) {
|
||||
@Override
|
||||
public Color getColor(boolean mirrored) {
|
||||
return Color.white;
|
||||
}
|
||||
},
|
||||
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", 10) {
|
||||
@Override
|
||||
public Color getColor(boolean mirrored) {
|
||||
return nextRainbowColor();
|
||||
}
|
||||
},
|
||||
RAINBOWSHIFT ("Rainbow + 180° hue shift", 11) {
|
||||
@Override
|
||||
public Color getColor(boolean mirrored) {
|
||||
return nextMirrorRainbowColor();
|
||||
}
|
||||
},
|
||||
BLACK ("Black", 12) {
|
||||
@Override
|
||||
public Color getColor(boolean mirrored) {
|
||||
return Color.black;
|
||||
}
|
||||
},
|
||||
LASTOBJ ("Use last object's colors", 13) {
|
||||
@Override
|
||||
public Color getColor(boolean mirrored) {
|
||||
if (mirrored) {
|
||||
return Cursor.lastMirroredObjColor;
|
||||
}
|
||||
return Cursor.lastObjColor;
|
||||
}
|
||||
};
|
||||
|
||||
public int nr;
|
||||
private String displayText;
|
||||
|
||||
public static Color[] comboColors;
|
||||
|
||||
public static float hue;
|
||||
|
||||
CursorColorOverrides(String displayText, int nr) {
|
||||
this.displayText = displayText;
|
||||
this.nr = nr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return displayText;
|
||||
}
|
||||
|
||||
public Color getColor(boolean mirrored) {
|
||||
if (comboColors == null || comboColors.length == 0) {
|
||||
return Color.white;
|
||||
}
|
||||
return comboColors[nr % comboColors.length];
|
||||
}
|
||||
|
||||
public Color getColor() {
|
||||
return getColor(false);
|
||||
}
|
||||
|
||||
public Color getMirrorColor() {
|
||||
return getColor(true);
|
||||
}
|
||||
|
||||
private static Color nextRainbowColor() {
|
||||
hue += Dancer.rgbcursorhueinc / 100f;
|
||||
return new Color(java.awt.Color.getHSBColor(hue / 360f, 1.0f, 1.0f).getRGB());
|
||||
}
|
||||
|
||||
private static Color nextMirrorRainbowColor() {
|
||||
hue += Dancer.rgbcursorhueinc / 100f;
|
||||
return new Color(java.awt.Color.getHSBColor((hue + 180f) / 360f, 1.0f, 1.0f).getRGB());
|
||||
}
|
||||
|
||||
}
|
|
@ -63,7 +63,9 @@ public class Dancer {
|
|||
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...
|
||||
public static boolean cursoruselastobjectcolor = false;
|
||||
public static CursorColorOverrides cursorColorOverride = CursorColorOverrides.NONE;
|
||||
public static CursorColorOverrides cursorColorMirrorOverride = CursorColorOverrides.NONE;
|
||||
public static int rgbcursorhueinc = 10; // this should really get its own place somewhere...
|
||||
public static MoverDirection moverDirection = MoverDirection.RANDOM;
|
||||
public static boolean hideobjects = false;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user