diff --git a/src/itdelatrisu/opsu/Options.java b/src/itdelatrisu/opsu/Options.java index 3ac9f067..335a706e 100644 --- a/src/itdelatrisu/opsu/Options.java +++ b/src/itdelatrisu/opsu/Options.java @@ -694,7 +694,7 @@ public class Options { } }, - DANCE_OBJECT_COLOR_OVERRIDE_MIRRORED ("Object color override", "ObjColorOverride", "Override object colors") { + DANCE_OBJECT_COLOR_OVERRIDE_MIRRORED ("Collage object color override", "ObjColorMirroredOverride", "Override collage object colors") { @Override public String getValueString() { return Dancer.colorMirrorOverride.toString(); @@ -740,6 +740,20 @@ 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", false) { + @Override + public void click(GameContainer container) { + bool = !bool; + Dancer.cursoruselastobjectcolor = bool; + } + + @Override + public void read(String s) { + super.read(s); + Dancer.cursoruselastobjectcolor = bool; + } + }, + DANCE_REMOVE_BG ("Never draw background", "RemoveBG", "Hello darkness my old friend", true) { @Override public void click(GameContainer container) { diff --git a/src/itdelatrisu/opsu/objects/Circle.java b/src/itdelatrisu/opsu/objects/Circle.java index efcf7436..816b205d 100644 --- a/src/itdelatrisu/opsu/objects/Circle.java +++ b/src/itdelatrisu/opsu/objects/Circle.java @@ -240,4 +240,14 @@ public class Circle extends GameObject { return false; } + @Override + public Color getColor() { + return color; + } + + @Override + public Color getMirroredColor() { + return mirrorColor; + } + } diff --git a/src/itdelatrisu/opsu/objects/DummyObject.java b/src/itdelatrisu/opsu/objects/DummyObject.java index 7edc6a94..a9c52ba7 100644 --- a/src/itdelatrisu/opsu/objects/DummyObject.java +++ b/src/itdelatrisu/opsu/objects/DummyObject.java @@ -21,6 +21,7 @@ package itdelatrisu.opsu.objects; import itdelatrisu.opsu.beatmap.HitObject; import itdelatrisu.opsu.objects.curves.Vec2f; +import org.newdawn.slick.Color; import org.newdawn.slick.Graphics; /** @@ -83,4 +84,14 @@ public class DummyObject extends GameObject { return false; } + @Override + public Color getColor() { + return null; + } + + @Override + public Color getMirroredColor() { + return null; + } + } diff --git a/src/itdelatrisu/opsu/objects/GameObject.java b/src/itdelatrisu/opsu/objects/GameObject.java index ce5c2d06..1f9f49dd 100644 --- a/src/itdelatrisu/opsu/objects/GameObject.java +++ b/src/itdelatrisu/opsu/objects/GameObject.java @@ -20,6 +20,7 @@ package itdelatrisu.opsu.objects; import itdelatrisu.opsu.objects.curves.Vec2f; +import org.newdawn.slick.Color; import org.newdawn.slick.Graphics; /** @@ -97,4 +98,7 @@ public abstract class GameObject { public abstract boolean isSlider(); public abstract boolean isSpinner(); + public abstract Color getColor(); + public abstract Color getMirroredColor(); + } diff --git a/src/itdelatrisu/opsu/objects/Slider.java b/src/itdelatrisu/opsu/objects/Slider.java index 1b2626fd..d0dea977 100644 --- a/src/itdelatrisu/opsu/objects/Slider.java +++ b/src/itdelatrisu/opsu/objects/Slider.java @@ -650,4 +650,14 @@ public class Slider extends GameObject { return false; } + @Override + public Color getColor() { + return color; + } + + @Override + public Color getMirroredColor() { + return mirrorColor; + } + } diff --git a/src/itdelatrisu/opsu/objects/Spinner.java b/src/itdelatrisu/opsu/objects/Spinner.java index 6b48d7ba..251f4e0d 100644 --- a/src/itdelatrisu/opsu/objects/Spinner.java +++ b/src/itdelatrisu/opsu/objects/Spinner.java @@ -428,4 +428,14 @@ public class Spinner extends GameObject { return true; } + @Override + public Color getColor() { + return null; + } + + @Override + public Color getMirroredColor() { + return null; + } + } diff --git a/src/itdelatrisu/opsu/states/Game.java b/src/itdelatrisu/opsu/states/Game.java index 4ea93683..3bb01759 100644 --- a/src/itdelatrisu/opsu/states/Game.java +++ b/src/itdelatrisu/opsu/states/Game.java @@ -271,7 +271,7 @@ public class Game extends BasicGameState { public Game(int state) { this.state = state; - mirrorCursor = new Cursor(); + mirrorCursor = new Cursor(true); } @Override @@ -876,6 +876,11 @@ public class Game extends BasicGameState { break; } } + GameObject g = gameObjects[objectIndex]; + if (g.isCircle() || g.isSlider() && g.getTime() <= trackPosition) { + Cursor.lastObjColor = g.getColor(); + Cursor.lastMirroredObjColor = g.getMirroredColor(); + } } @Override @@ -1308,6 +1313,9 @@ public class Game extends BasicGameState { throws SlickException { // container.setMouseGrabbed(false); + Cursor.lastObjColor = Color.white; + Cursor.lastMirroredObjColor = Color.white; + // re-hide cursor if (GameMod.AUTO.isActive() || isReplay) UI.getCursor().hide(); diff --git a/src/itdelatrisu/opsu/states/OptionsMenu.java b/src/itdelatrisu/opsu/states/OptionsMenu.java index 0725df6d..8e9818fd 100644 --- a/src/itdelatrisu/opsu/states/OptionsMenu.java +++ b/src/itdelatrisu/opsu/states/OptionsMenu.java @@ -115,6 +115,7 @@ public class OptionsMenu extends BasicGameState { GameOption.DANCE_OBJECT_COLOR_OVERRIDE, GameOption.DANCE_OBJECT_COLOR_OVERRIDE_MIRRORED, GameOption.DANCE_RGB_INC, + GameOption.DANCE_CURSOR_USE_OBJECT_COLOR, GameOption.DANCE_REMOVE_BG, GameOption.DANCE_HIDE_UI, }), diff --git a/src/itdelatrisu/opsu/ui/Cursor.java b/src/itdelatrisu/opsu/ui/Cursor.java index 00b6041e..e9b7562f 100644 --- a/src/itdelatrisu/opsu/ui/Cursor.java +++ b/src/itdelatrisu/opsu/ui/Cursor.java @@ -32,11 +32,9 @@ import java.util.LinkedList; import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLException; -import org.newdawn.slick.GameContainer; -import org.newdawn.slick.Image; -import org.newdawn.slick.Input; -import org.newdawn.slick.SlickException; +import org.newdawn.slick.*; import org.newdawn.slick.state.StateBasedGame; +import yugecin.opsudance.Dancer; /** * Updates and draws the cursor. @@ -49,7 +47,7 @@ public class Cursor { private Point lastPosition; /** Cursor rotation angle. */ - private float cursorAngle = 0f; + private static float cursorAngle = 0f; /** The time in milliseconds when the cursor was last pressed, used for the scaling animation. */ private long lastCursorPressTime = 0L; @@ -71,6 +69,11 @@ public class Cursor { private static StateBasedGame game; private static Input input; + public static Color lastObjColor = Color.white; + public static Color lastMirroredObjColor = Color.white; + + private boolean isMirrored; + /** * Initializes the class. * @param container the game container @@ -95,7 +98,12 @@ public class Cursor { * Constructor. */ public Cursor() { + this(false); + } + + public Cursor(boolean isMirrored) { resetLocations(); + this.isMirrored = isMirrored; } /** @@ -182,6 +190,8 @@ public class Cursor { for (int i = 0; i < removeCount && !trail.isEmpty(); i++) trail.remove(); + Color filter = getColorFilter(); + // draw a fading trail float alpha = 0f; float t = 2f / trail.size(); @@ -190,7 +200,7 @@ public class Cursor { cursorTrail.startUse(); for (Point p : trail) { alpha += t; - cursorTrail.setImageColor(1f, 1f, 1f, alpha); + cursorTrail.setImageColor(filter.r, filter.g, filter.b, alpha); cursorTrail.drawEmbedded( p.x - (cursorTrailWidth / 2f), p.y - (cursorTrailHeight / 2f), cursorTrailWidth, cursorTrailHeight, cursorTrailRotation); @@ -203,9 +213,19 @@ public class Cursor { // draw the other components if (newStyle && skin.isCursorRotated()) cursor.setRotation(cursorAngle); - cursor.drawCentered(mouseX, mouseY); + cursor.drawCentered(mouseX, mouseY, filter); if (hasMiddle) - cursorMiddle.drawCentered(mouseX, mouseY); + cursorMiddle.drawCentered(mouseX, mouseY, filter); + } + + private Color getColorFilter() { + if (!Dancer.cursoruselastobjectcolor) { + return Color.white; + } + if (isMirrored) { + return lastMirroredObjColor; + } + return lastObjColor; } /** diff --git a/src/yugecin/opsudance/Dancer.java b/src/yugecin/opsudance/Dancer.java index 6808a1ac..3afe44dc 100644 --- a/src/yugecin/opsudance/Dancer.java +++ b/src/yugecin/opsudance/Dancer.java @@ -57,6 +57,7 @@ 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; private int dir; private GameObject p;