diff --git a/src/yugecin/opsudance/Dancer.java b/src/yugecin/opsudance/Dancer.java index bdbce492..8f879275 100644 --- a/src/yugecin/opsudance/Dancer.java +++ b/src/yugecin/opsudance/Dancer.java @@ -146,6 +146,9 @@ public class Dancer { } public void update(int time, GameObject p, GameObject c) { + GameObject[] e = sliderMoverController.process(p, c, time); + p = e[0]; + c = e[1]; if (this.p != p) { this.p = p; if (this.p == d) { @@ -154,7 +157,6 @@ public class Dancer { c.start.set((float) spinnerStartPoint[0], (float) spinnerStartPoint[1]); } } - c = sliderMoverController.process(c); isCurrentLazySlider = false; // detect lazy sliders, should work pretty good if (c.isSlider() && LAZY_SLIDERS && Utils.distance(c.start.x, c.start.y, c.end.x, c.end.y) <= Circle.diameter * 0.8f) { @@ -175,12 +177,6 @@ public class Dancer { mover = moverFactory.create(p, c, dir); } - GameObject next = sliderMoverController.processNext(time); - if (next != null) { - update(time, c, next); - return; - } - if (time < c.getTime()) { if (!p.isSpinner() || !c.isSpinner()) { double[] point = mover.getPointAt(time); diff --git a/src/yugecin/opsudance/movers/slidermovers/DefaultSliderMoverController.java b/src/yugecin/opsudance/movers/slidermovers/DefaultSliderMoverController.java index a259ef54..3056bf18 100644 --- a/src/yugecin/opsudance/movers/slidermovers/DefaultSliderMoverController.java +++ b/src/yugecin/opsudance/movers/slidermovers/DefaultSliderMoverController.java @@ -22,17 +22,16 @@ import itdelatrisu.opsu.objects.GameObject; public class DefaultSliderMoverController implements SliderMoverController { @Override - public GameObject process(GameObject obj) { - return obj; - } - - @Override - public GameObject processNext(int time) { - return null; + public GameObject[] process(GameObject p, GameObject c, int time) { + return new GameObject[] { + p, + c + }; } @Override public String toString() { return "Nothing special, just follow it"; } + } diff --git a/src/yugecin/opsudance/movers/slidermovers/InheritedSliderMoverController.java b/src/yugecin/opsudance/movers/slidermovers/InheritedSliderMoverController.java index 1aa63251..29c5d265 100644 --- a/src/yugecin/opsudance/movers/slidermovers/InheritedSliderMoverController.java +++ b/src/yugecin/opsudance/movers/slidermovers/InheritedSliderMoverController.java @@ -17,18 +17,41 @@ */ package yugecin.opsudance.movers.slidermovers; +import itdelatrisu.opsu.objects.Circle; import itdelatrisu.opsu.objects.GameObject; +import itdelatrisu.opsu.objects.Slider; public class InheritedSliderMoverController implements SliderMoverController { - @Override - public GameObject process(GameObject obj) { - return obj; - } + private GameObject currentSlider; + private Circle[] positions; + private int idx; @Override - public GameObject processNext(int time) { - return null; + public GameObject[] process(GameObject p, GameObject c, int time) { + GameObject[] ret = new GameObject[2]; + if (!c.isSlider()) { + ret[0] = p; + ret[1] = c; + return ret; + } + if (currentSlider != c) { + currentSlider = c; + positions = ((Slider) c).getTickPositionCircles(); + idx = 0; + } + for (; idx < positions.length; idx++) { + if (time < positions[idx].getTime() || idx == positions.length - 1) { + ret[1] = positions[idx]; + if (idx == 0) { + ret[0] = p; + } else { + ret[0] = positions[idx - 1]; + } + return ret; + } + } + return null; // make the compiler happy c: } @Override diff --git a/src/yugecin/opsudance/movers/slidermovers/SliderMoverController.java b/src/yugecin/opsudance/movers/slidermovers/SliderMoverController.java index abe96109..494ac960 100644 --- a/src/yugecin/opsudance/movers/slidermovers/SliderMoverController.java +++ b/src/yugecin/opsudance/movers/slidermovers/SliderMoverController.java @@ -21,7 +21,6 @@ import itdelatrisu.opsu.objects.GameObject; public interface SliderMoverController { - GameObject process(GameObject obj); - GameObject processNext(int time); + GameObject[] process(GameObject p, GameObject c, int time); }