From 711fd0a03ed71079269ca83dbcd09225a5be32a5 Mon Sep 17 00:00:00 2001 From: yugecin Date: Sun, 13 Nov 2016 00:58:50 +0100 Subject: [PATCH] fix object color override for sb --- src/awlex/ospu/FakeGameObject.java | 5 +++++ src/itdelatrisu/opsu/objects/Circle.java | 12 ++++++++++-- src/itdelatrisu/opsu/objects/DummyObject.java | 4 ++++ src/itdelatrisu/opsu/objects/GameObject.java | 2 ++ src/itdelatrisu/opsu/objects/Slider.java | 12 ++++++++++-- src/itdelatrisu/opsu/objects/Spinner.java | 3 +++ src/yugecin/opsudance/ui/SBOverlay.java | 11 +++++++++++ 7 files changed, 45 insertions(+), 4 deletions(-) diff --git a/src/awlex/ospu/FakeGameObject.java b/src/awlex/ospu/FakeGameObject.java index cfb701ee..b746b023 100644 --- a/src/awlex/ospu/FakeGameObject.java +++ b/src/awlex/ospu/FakeGameObject.java @@ -101,4 +101,9 @@ public class FakeGameObject extends GameObject { public void setTime(int time) { this.halfTime = time; } + + @Override + public void updateColor() { + } + } \ No newline at end of file diff --git a/src/itdelatrisu/opsu/objects/Circle.java b/src/itdelatrisu/opsu/objects/Circle.java index 684c644a..44718a38 100644 --- a/src/itdelatrisu/opsu/objects/Circle.java +++ b/src/itdelatrisu/opsu/objects/Circle.java @@ -60,6 +60,8 @@ public class Circle extends GameObject { /** Whether or not the circle result ends the combo streak. */ private boolean comboEnd; + private int comboColorIndex; + /** * Initializes the Circle data type with map modifiers, images, and dimensions. * @param container the game container @@ -86,9 +88,9 @@ public class Circle extends GameObject { this.game = game; this.data = data; this.comboEnd = comboEnd; + this.comboColorIndex = comboColorIndex; + updateColor(); updatePosition(); - color = Dancer.colorOverride.getColor(comboColorIndex); - mirrorColor = Dancer.colorMirrorOverride.getColor(comboColorIndex); } public Circle(float x, float y, int time) { @@ -265,4 +267,10 @@ public class Circle extends GameObject { return mirrorColor; } + @Override + public void updateColor() { + color = Dancer.colorOverride.getColor(comboColorIndex); + mirrorColor = Dancer.colorMirrorOverride.getColor(comboColorIndex); + } + } diff --git a/src/itdelatrisu/opsu/objects/DummyObject.java b/src/itdelatrisu/opsu/objects/DummyObject.java index ce5adebd..f545d501 100644 --- a/src/itdelatrisu/opsu/objects/DummyObject.java +++ b/src/itdelatrisu/opsu/objects/DummyObject.java @@ -100,4 +100,8 @@ public class DummyObject extends GameObject { return null; } + @Override + public void updateColor() { + } + } diff --git a/src/itdelatrisu/opsu/objects/GameObject.java b/src/itdelatrisu/opsu/objects/GameObject.java index 1f9f49dd..b819ac32 100644 --- a/src/itdelatrisu/opsu/objects/GameObject.java +++ b/src/itdelatrisu/opsu/objects/GameObject.java @@ -101,4 +101,6 @@ public abstract class GameObject { public abstract Color getColor(); public abstract Color getMirroredColor(); + public abstract void updateColor(); + } diff --git a/src/itdelatrisu/opsu/objects/Slider.java b/src/itdelatrisu/opsu/objects/Slider.java index 5700713c..b71cb234 100644 --- a/src/itdelatrisu/opsu/objects/Slider.java +++ b/src/itdelatrisu/opsu/objects/Slider.java @@ -117,6 +117,8 @@ public class Slider extends GameObject { public float pixelLength; + private int comboColorIndex; + /** * Initializes the Slider data type with images and dimensions. * @param container the game container @@ -162,8 +164,8 @@ public class Slider extends GameObject { this.game = game; this.data = data; this.comboEnd = comboEnd; - color = Dancer.colorOverride.getColor(comboColorIndex); - mirrorColor = Dancer.colorMirrorOverride.getColor(comboColorIndex); + this.comboColorIndex = comboColorIndex; + updateColor(); updatePosition(); this.pixelLength = hitObject.getPixelLength(); @@ -710,4 +712,10 @@ public class Slider extends GameObject { return ticks; } + @Override + public void updateColor() { + color = Dancer.colorOverride.getColor(comboColorIndex); + mirrorColor = Dancer.colorMirrorOverride.getColor(comboColorIndex); + } + } diff --git a/src/itdelatrisu/opsu/objects/Spinner.java b/src/itdelatrisu/opsu/objects/Spinner.java index 251f4e0d..e507e080 100644 --- a/src/itdelatrisu/opsu/objects/Spinner.java +++ b/src/itdelatrisu/opsu/objects/Spinner.java @@ -438,4 +438,7 @@ public class Spinner extends GameObject { return null; } + @Override + public void updateColor() { + } } diff --git a/src/yugecin/opsudance/ui/SBOverlay.java b/src/yugecin/opsudance/ui/SBOverlay.java index 8fa16e68..16a663a1 100644 --- a/src/yugecin/opsudance/ui/SBOverlay.java +++ b/src/yugecin/opsudance/ui/SBOverlay.java @@ -188,6 +188,7 @@ public class SBOverlay { for (Object o : options.entrySet()) { Map.Entry next = (Map.Entry) o; next.getKey().read(next.getValue()); + readOption(next.getKey()); } } } @@ -212,6 +213,16 @@ public class SBOverlay { for (Options.GameOption o : options.getSavedOptionList()) { if (initialOptions.containsKey(o)) { o.read(initialOptions.get(o)); + readOption(o); + } + } + } + + // needed for object color overrides... + private void readOption(Options.GameOption o) { + if (o == Options.GameOption.DANCE_OBJECT_COLOR_OVERRIDE || o == Options.GameOption.DANCE_OBJECT_COLOR_OVERRIDE_MIRRORED) { + for (int i = index; i < gameObjects.length; i++) { + gameObjects[i].updateColor(); } } }