diff --git a/src/awlex/ospu/polymover/ArcMover.java b/src/awlex/ospu/polymover/ArcMover.java index 3f58c743..5ece7b20 100644 --- a/src/awlex/ospu/polymover/ArcMover.java +++ b/src/awlex/ospu/polymover/ArcMover.java @@ -70,8 +70,6 @@ public class ArcMover extends PolyMover { percent = ((double) time - middle.getTime()) / (p2.getTime() - middle.getTime()); angle = beta + (gamma - beta) * percent; } - if (angle > PI) - angle -= PI; return new double[]{ xm + r * cos(angle), ym + r * sin(angle) diff --git a/src/awlex/ospu/polymover/factory/ArcFactory.java b/src/awlex/ospu/polymover/factory/ArcFactory.java index 512cc43a..331dc9e1 100644 --- a/src/awlex/ospu/polymover/factory/ArcFactory.java +++ b/src/awlex/ospu/polymover/factory/ArcFactory.java @@ -10,28 +10,29 @@ import itdelatrisu.opsu.objects.GameObject; * Created by Awlex on 18.11.2016. */ public class ArcFactory implements PolyMoverFactory { - + private static final int PREFFERED_BUFFER_SIZE = 3; private PolyMover current, previous; private int lastIndex; - + public double[] getPointAt(int time) { if (previous == null) { return current.getPointAt(time); - } else if (current == null) { + } + if (current == null) { return previous.getPointAt(time); } - + double[] point1 = current.getPointAt(time); double[] point2 = previous.getPointAt(time); - + return new double[]{ (point1[0] + point2[0]) * 0.5, (point1[1] + point2[1]) * 0.5 }; } - - + + public void init(GameObject[] objects, int startIndex) { if (objects == null) throw new NullPointerException("Objects musn't be null"); @@ -45,7 +46,9 @@ public class ArcFactory implements PolyMoverFactory { startIndex++; } GameObject middle = objects[startIndex + 1]; - if (middle.isSlider() || middle.isSpinner() || !ArcMover.canCricleExistBetweenItems(objects[startIndex], middle, objects[startIndex + 2])) + if (middle.isSlider() || middle.isSpinner()) + return; + if (!ArcMover.canCricleExistBetweenItems(objects[startIndex], middle, objects[startIndex + 2])) current = new LineMover(objects, startIndex, 3); else current = new ArcMover(objects[startIndex], middle, objects[startIndex + 2]); @@ -54,10 +57,9 @@ public class ArcFactory implements PolyMoverFactory { lastIndex--; previous = null; } - + public void update(GameObject p) { GameObject[] items = current.getItems(); - System.out.println(items.length); GameObject last = items[items.length - 1]; if (last != p) { previous = current; @@ -74,25 +76,25 @@ public class ArcFactory implements PolyMoverFactory { } lastIndex++; } - + @Override public int getPrefferedBufferSize() { return PREFFERED_BUFFER_SIZE; } - + @Override public String toString() { return "Arcs"; } - + @Override public boolean isInitialized() { return current != null; } - + @Override public int getLatestIndex() { return lastIndex; } - + } diff --git a/src/itdelatrisu/opsu/Options.java b/src/itdelatrisu/opsu/Options.java index 5e16234e..3cb070c5 100644 --- a/src/itdelatrisu/opsu/Options.java +++ b/src/itdelatrisu/opsu/Options.java @@ -594,7 +594,7 @@ public class Options { DISABLE_UPDATER ("Disable Automatic Updates", "DisableUpdater", "Disable automatic checking for updates upon starting opsu!.", false), ENABLE_WATCH_SERVICE ("Enable Watch Service", "WatchService", "Watch the beatmap directory for changes. Requires a restart.", false), - DANCE_MOVER_TYPE("Mover Type", "Mover type", "More Points", Dancer.multipoint) { + DANCE_MOVER_TYPE("Mover Type", "Mover type", "More than 2 Points", Dancer.multipoint) { @Override public void click(GameContainer container) { bool = !bool; diff --git a/src/yugecin/opsudance/Dancer.java b/src/yugecin/opsudance/Dancer.java index ff457014..eddba1b8 100644 --- a/src/yugecin/opsudance/Dancer.java +++ b/src/yugecin/opsudance/Dancer.java @@ -266,16 +266,17 @@ public class Dancer { double[] spinnerStartPoint = spinner.getPoint(); c.start = new Vec2f((float) spinnerStartPoint[0], (float) spinnerStartPoint[1]); } - if (polyMoverFactory.isInitialized() && polyMoverFactory.getLatestIndex() < objectIndex + polyMoverFactory.getPrefferedBufferSize() - 1) { - polyMoverFactory.update(gameObjects[ objectIndex + polyMoverFactory.getPrefferedBufferSize() - 1]); + + if (polyMoverFactory.isInitialized() && polyMoverFactory.getLatestIndex() < objectIndex + polyMoverFactory.getPrefferedBufferSize()) { + polyMoverFactory.update(gameObjects[polyMoverFactory.getLatestIndex()]); } else { - polyMoverFactory.init(gameObjects, objectIndex); + polyMoverFactory.init(gameObjects, objectIndex - 1); } } if (time < c.getTime()) { - if (!p.isSpinner() || !c.isSpinner()) { + if (!p.isSpinner() || !c.isSpinner() && polyMoverFactory.isInitialized()) { double[] point = polyMoverFactory.getPointAt(time); x = (float) point[0]; y = (float) point[1];