make it work

This commit is contained in:
yugecin 2016-11-12 18:25:55 +01:00
parent 3dc0ad8c68
commit fe2169c39c
4 changed files with 39 additions and 22 deletions

View File

@ -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);

View File

@ -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";
}
}

View File

@ -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

View File

@ -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);
}