From 2f5f2a610d3b59a005b2545d8b05d85b50cd30ca Mon Sep 17 00:00:00 2001 From: yugecin Date: Fri, 30 Sep 2016 21:32:24 +0200 Subject: [PATCH] add opposite combo color as override option --- src/itdelatrisu/opsu/objects/Circle.java | 8 ++++---- src/itdelatrisu/opsu/objects/Slider.java | 7 ++++--- src/itdelatrisu/opsu/states/Game.java | 6 ++---- .../opsudance/ObjectColorOverrides.java | 20 ++++++++++++------- 4 files changed, 23 insertions(+), 18 deletions(-) diff --git a/src/itdelatrisu/opsu/objects/Circle.java b/src/itdelatrisu/opsu/objects/Circle.java index 816b205d..228347dd 100644 --- a/src/itdelatrisu/opsu/objects/Circle.java +++ b/src/itdelatrisu/opsu/objects/Circle.java @@ -78,17 +78,17 @@ public class Circle extends GameObject { * @param hitObject the associated HitObject * @param game the associated Game object * @param data the associated GameData object - * @param color the color of this circle + * @param comboColorIndex index of the combo color of this circle * @param comboEnd true if this is the last hit object in the combo */ - public Circle(HitObject hitObject, Game game, GameData data, Color color, boolean comboEnd) { + public Circle(HitObject hitObject, Game game, GameData data, int comboColorIndex, boolean comboEnd) { this.hitObject = hitObject; this.game = game; this.data = data; this.comboEnd = comboEnd; updatePosition(); - this.color = Dancer.colorOverride.getColor(color); - this.mirrorColor = Dancer.colorMirrorOverride.getColor(color); + color = Dancer.colorOverride.getColor(comboColorIndex); + mirrorColor = Dancer.colorMirrorOverride.getColor(comboColorIndex); } @Override diff --git a/src/itdelatrisu/opsu/objects/Slider.java b/src/itdelatrisu/opsu/objects/Slider.java index 4df9a60d..559c52a5 100644 --- a/src/itdelatrisu/opsu/objects/Slider.java +++ b/src/itdelatrisu/opsu/objects/Slider.java @@ -151,15 +151,16 @@ public class Slider extends GameObject { * @param hitObject the associated HitObject * @param game the associated Game object * @param data the associated GameData object + * @param comboColorIndex index of the combo color of this slider * @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, int comboColorIndex, boolean comboEnd) { this.hitObject = hitObject; this.game = game; this.data = data; this.comboEnd = comboEnd; - this.color = Dancer.colorOverride.getColor(color); - this.mirrorColor = Dancer.colorMirrorOverride.getColor(color); + color = Dancer.colorOverride.getColor(comboColorIndex); + mirrorColor = Dancer.colorMirrorOverride.getColor(comboColorIndex); updatePosition(); // slider time calculations diff --git a/src/itdelatrisu/opsu/states/Game.java b/src/itdelatrisu/opsu/states/Game.java index 98f0bd83..df94e338 100644 --- a/src/itdelatrisu/opsu/states/Game.java +++ b/src/itdelatrisu/opsu/states/Game.java @@ -1219,8 +1219,6 @@ public class Game extends BasicGameState { if (i + 1 >= beatmap.objects.length || beatmap.objects[i + 1].isNewCombo()) comboEnd = true; - Color color = ObjectColorOverrides.comboColors[hitObject.getComboIndex()]; - // pass beatLength to hit objects int hitObjectTime = hitObject.getTime(); while (timingPointIndex < beatmap.timingPoints.size()) { @@ -1233,9 +1231,9 @@ public class Game extends BasicGameState { try { if (hitObject.isCircle()) - gameObjects[i] = new Circle(hitObject, this, data, color, comboEnd); + gameObjects[i] = new Circle(hitObject, this, data, hitObject.getComboIndex(), comboEnd); else if (hitObject.isSlider()) - gameObjects[i] = new Slider(hitObject, this, data, color, comboEnd); + gameObjects[i] = new Slider(hitObject, this, data, hitObject.getComboIndex(), comboEnd); else if (hitObject.isSpinner()) gameObjects[i] = new Spinner(hitObject, this, data); } catch (Exception e) { diff --git a/src/yugecin/opsudance/ObjectColorOverrides.java b/src/yugecin/opsudance/ObjectColorOverrides.java index 7f7df47f..1946551b 100644 --- a/src/yugecin/opsudance/ObjectColorOverrides.java +++ b/src/yugecin/opsudance/ObjectColorOverrides.java @@ -23,8 +23,8 @@ public enum ObjectColorOverrides { NONE ("None", 0) { @Override - public Color getColor(Color color) { - return color; + public Color getColor(int comboColorIndex) { + return comboColors[comboColorIndex]; } }, COMBO1 ("Combo1", 1), @@ -35,15 +35,21 @@ public enum ObjectColorOverrides { COMBO6 ("Combo6", 6), COMBO7 ("Combo7", 7), COMBO8 ("Combo8", 8), - RAINBOW ("Rainbow", 9) { + OPPOSITECOMBOCOLOR ("Opposite combo color", 9) { @Override - public Color getColor(Color color) { + public Color getColor(int comboColorIndex) { + return comboColors[(comboColorIndex + comboColors.length / 2) % comboColors.length]; + } + }, + RAINBOW ("Rainbow", 10) { + @Override + public Color getColor(int comboColorIndex) { return nextRainbowColor(); } }, - RAINBOWSHIFT ("Rainbow + 180° hue shift", 10) { + RAINBOWSHIFT ("Rainbow + 180° hue shift", 11) { @Override - public Color getColor(Color color) { + public Color getColor(int comboColorIndex) { return nextMirrorRainbowColor(); } }; @@ -65,7 +71,7 @@ public enum ObjectColorOverrides { return displayText; } - public Color getColor(Color color) { + public Color getColor(int comboColorIndex) { return comboColors[nr % comboColors.length]; }