Merge remote-tracking branch 'refs/remotes/origin/Curving'

This commit is contained in:
Awlex 2016-11-20 13:52:22 +01:00
commit 8dcfe96fff
9 changed files with 285 additions and 146 deletions

View File

@ -1,15 +1,18 @@
package awlex.ospu.polymover; package awlex.ospu.polymover;
import Jama.Matrix; import Jama.Matrix;
import itdelatrisu.opsu.objects.Circle;
import itdelatrisu.opsu.objects.GameObject; import itdelatrisu.opsu.objects.GameObject;
import itdelatrisu.opsu.objects.Slider;
import static java.lang.Math.*; import static java.lang.Math.*;
/** /**
* Created by Awlex on 13.11.2016. * Created by Awlex on 13.11.2016.
*/ */
public class ArcMover extends PolyMover { public class ArcMover implements PolyMover {
public static final int ITEMS_NEEDED = 3;
private GameObject p1, middle, p2; private GameObject p1, middle, p2;
private double xm, ym, r, alpha, beta, gamma; private double xm, ym, r, alpha, beta, gamma;
@ -20,21 +23,13 @@ public class ArcMover extends PolyMover {
init(); init();
} }
public ArcMover(PolyMover mover, GameObject p) {
GameObject[] items = mover.getItems();
p1 = items[items.length - 2];
middle = items[items.length - 1];
p2 = p;
init();
}
private void init() { private void init() {
Matrix m = prepareMatrix(p1, middle, p2); Matrix m = prepareMatrix(p1, middle, p2);
xm = m.get(1, 0) * 0.5; xm = m.get(1, 0) * 0.5;
ym = m.get(2, 0) * 0.5; ym = m.get(2, 0) * 0.5;
r = sqrt(pow(xm, 2) + pow(ym, 2) - m.get(0, 0)); r = sqrt(pow(xm, 2) + pow(ym, 2) - m.get(0, 0));
alpha = atan2(p1.end.y - ym, p1.end.x - xm); alpha = atan2(p1.end.y - ym, p1.end.x - xm);
beta = atan2(middle.end.y - ym, middle.end.x - xm); beta = atan2(middle.start.y - ym, middle.start.x - xm);
gamma = atan2(p2.start.y - ym, p2.start.x - xm); gamma = atan2(p2.start.y - ym, p2.start.x - xm);
} }
@ -42,10 +37,11 @@ public class ArcMover extends PolyMover {
public double[] getPointAt(int time) { public double[] getPointAt(int time) {
double angle; double angle;
if (time < middle.getTime()) { if (time < middle.getTime()) {
angle = alpha + beta * ((double) time - p1.getEndTime()) / ((middle.getTime() - p1.getEndTime())); double percent = ((double) time - p1.getEndTime()) / ((middle.getTime() - p1.getEndTime()));
angle = alpha + (beta - alpha) * percent;
} }
else { else {
angle = beta + gamma * ((double) time - middle.getTime()) / (p2.getTime() - middle.getTime()); angle = beta + (gamma - beta) * ((double) time - middle.getTime()) / (p2.getTime() - middle.getTime());
} }
return new double[]{ return new double[]{
xm + r * cos(angle), xm + r * cos(angle),
@ -61,19 +57,36 @@ public class ArcMover extends PolyMover {
p2 p2
}; };
} }
private static Matrix prepareMatrix(GameObject p1, GameObject middle, GameObject p2) { private static Matrix prepareMatrix(GameObject p1, GameObject middle, GameObject p2) {
Matrix a = new Matrix(new double[][]{ Matrix a, b;
{1, -p1.end.x, -p1.end.y},
{1, -middle.end.x, -middle.end.y}, //if (!p2.isSlider()) {
{1, -p2.start.x, -p2.start.y} a = new Matrix(new double[][]{
}); {1, -p1.end.x, -p1.end.y},
Matrix b = new Matrix(new double[][]{ {1, -middle.start.x, -middle.start.y},
{-(pow(p1.end.x, 2) + pow(p1.end.y, 2))}, {1, -p2.start.x, -p2.start.y}
{-(pow(middle.end.x, 2) + pow(middle.end.y, 2))}, });
{-(pow(p2.start.x, 2) + pow(p2.start.y, 2))}, b = new Matrix(new double[][]{
}); {-(pow(p1.end.x, 2) + pow(p1.end.y, 2))},
{-(pow(middle.start.x, 2) + pow(middle.start.y, 2))},
{-(pow(p2.start.x, 2) + pow(p2.start.y, 2))},
});
/*
} else {
Circle c = ((Slider) p2).getTickPositionCircles()[0];
a = new Matrix(new double[][]{
{1, -p1.end.x, -p1.end.y},
{1, -middle.start.x, -middle.start.y},
{1, -c.start.x, -c.start.y}
});
b = new Matrix(new double[][]{
{-(pow(p1.end.x, 2) + pow(p1.end.y, 2))},
{-(pow(middle.start.x, 2) + pow(middle.start.y, 2))},
{-(pow(c.start.x, 2) + pow(c.start.y, 2))},
});
}
*/
return a.solve(b); return a.solve(b);
} }
@ -85,4 +98,9 @@ public class ArcMover extends PolyMover {
} }
return true; return true;
} }
@Override
public GameObject getLastItem() {
return p2;
}
} }

View File

@ -2,31 +2,54 @@ package awlex.ospu.polymover;
import itdelatrisu.opsu.objects.DummyObject; import itdelatrisu.opsu.objects.DummyObject;
import itdelatrisu.opsu.objects.GameObject; import itdelatrisu.opsu.objects.GameObject;
import itdelatrisu.opsu.states.Game;
import yugecin.opsudance.movers.LinearMover; import yugecin.opsudance.movers.LinearMover;
import java.util.Arrays;
/** /**
* Created by Awlex on 19.11.2016. * Created by Awlex on 19.11.2016.
*/ */
public class LineMover extends PolyMover { public class LineMover implements PolyMover {
GameObject[] objects; public static final int ITEMS_NEEDED = 2;
private GameObject[] objects;
private LinearMover m;
private int currentIndex;
public LineMover(GameObject[] objects, int startIndex, int count) { public LineMover(GameObject[] objects, int startIndex, int count) {
this.objects = new GameObject[count]; this.objects = objects;
System.arraycopy(objects, startIndex, this.objects, 0, count); m = new LinearMover(objects[startIndex], objects[startIndex + 1], 1);
currentIndex = startIndex + 1;
} }
public LineMover(GameObject[] objects, int count) {
this(objects, 0, count);
}
@Override @Override
public double[] getPointAt(int time) { public double[] getPointAt(int time) {
int i = 0; if (objects[currentIndex].getEndTime() < time)
while (time > objects[i].getTime() && i < objects.length - 1) m = new LinearMover(objects[currentIndex], objects[currentIndex + 1], 1);
i++; return m.getPointAt(time);
return new LinearMover(i == 0 ? new DummyObject() : objects[i - 1], objects[i], 1).getPointAt(time);
} }
@Override @Override
public GameObject[] getItems() { public GameObject[] getItems() {
return new GameObject[0]; return objects;
}
@Override
public GameObject getLastItem() {
int i = objects.length - 1;
while (i > 0) {
if (objects[i] != null) {
break;
}
i--;
}
return objects[i];
} }
} }

View File

@ -5,8 +5,11 @@ import itdelatrisu.opsu.objects.GameObject;
/** /**
* Created by Awlex on 18.11.2016. * Created by Awlex on 18.11.2016.
*/ */
public abstract class PolyMover { public interface PolyMover {
public abstract double[] getPointAt(int time);
double[] getPointAt(int time);
public abstract GameObject[] getItems();
GameObject[] getItems();
GameObject getLastItem();
} }

View File

@ -3,75 +3,38 @@ package awlex.ospu.polymover.factory;
import awlex.ospu.polymover.ArcMover; import awlex.ospu.polymover.ArcMover;
import awlex.ospu.polymover.LineMover; import awlex.ospu.polymover.LineMover;
import awlex.ospu.polymover.PolyMover; import awlex.ospu.polymover.PolyMover;
import itdelatrisu.opsu.objects.DummyObject;
import itdelatrisu.opsu.objects.GameObject; import itdelatrisu.opsu.objects.GameObject;
import java.util.Arrays;
/** /**
* Created by Awlex on 18.11.2016. * Created by Awlex on 18.11.2016.
*/ */
public class ArcFactory implements PolyMoverFactory { public class ArcFactory extends PolyMoverFactory {
private static final int PREFFERED_BUFFER_SIZE = 3; private static final int PREFFERED_BUFFER_SIZE = 3;
private PolyMover current, previous;
private int lastIndex; public void init(GameObject[] objects, int count) {
if (count < 3 || (!ArcMover.canCricleExistBetweenItems(objects[0], objects[1], objects[2])))
public double[] getPointAt(int time) { addMover(new LineMover(objects, 3));
if (previous == null) {
return current.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");
GameObject middle = objects[startIndex + 1];
if (middle.isSlider() || middle.isSpinner() || !ArcMover.canCricleExistBetweenItems(objects[startIndex], middle, objects[startIndex + 2]))
current = new LineMover(objects, startIndex, 3);
else else
current = new ArcMover(objects[startIndex], middle, objects[startIndex + 2]); addMover(new ArcMover(objects[0], objects[1], objects[2]));
lastIndex = startIndex + 2;
previous = null;
} }
public void update(GameObject p) {
GameObject[] items = (previous == null ? current : previous).getItems();
GameObject last = items[items.length - 1];
if (last != p) {
if (ArcMover.canCricleExistBetweenItems(items[items.length - 2], items[items.length - 1], p)) {
previous = current;
current = new ArcMover(previous, p);
}
}
lastIndex++;
}
@Override @Override
public int getPrefferedBufferSize() { public int getMaxBufferSize() {
return PREFFERED_BUFFER_SIZE; return ArcMover.ITEMS_NEEDED;
} }
@Override
public int getMinBufferSize() {
return LineMover.ITEMS_NEEDED;
}
@Override @Override
public String toString() { public String toString() {
return "Arcs"; return "Arcs";
} }
@Override
public boolean isInitialized() {
return current != null;
}
@Override
public int getLatestIndex() {
return lastIndex;
}
} }

View File

@ -0,0 +1,38 @@
package awlex.ospu.polymover.factory;
import awlex.ospu.polymover.LineMover;
import itdelatrisu.opsu.objects.GameObject;
/**
* Created by Awlex on 20.11.2016.
*/
public class LinearFactory extends PolyMoverFactory {
public final static int PREFFERED_BUFFER_SIZE = 2;
@Override
public double[] getPointAt(int time) {
return getCurrent().getPointAt(time);
}
@Override
public void init(GameObject[] objects, int count) {
addMover(new LineMover(objects, count));
}
@Override
public int getMaxBufferSize() {
return LineMover.ITEMS_NEEDED;
}
@Override
public int getMinBufferSize() {
return LineMover.ITEMS_NEEDED;
}
@Override
public String toString() {
return "Linear";
}
}

View File

@ -1,30 +1,122 @@
package awlex.ospu.polymover.factory; package awlex.ospu.polymover.factory;
import awlex.ospu.polymover.LineMover;
import awlex.ospu.polymover.PolyMover;
import itdelatrisu.opsu.objects.DummyObject;
import itdelatrisu.opsu.objects.GameObject; import itdelatrisu.opsu.objects.GameObject;
import yugecin.opsudance.Dancer;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
/** /**
* Created by Awlex on 18.11.2016. * Created by Awlex on 18.11.2016.
*/ */
public interface PolyMoverFactory { public abstract class PolyMoverFactory {
private LinkedList<PolyMover> movers;
private int latestIndex;
public PolyMoverFactory() {
movers = new LinkedList<>();
}
/** /**
* @param time point in time whose cursor position has to be calculated * @param time point in time whose cursor position has to be calculated
* @return [x, y] * @return [x, y]
*/ */
double[] getPointAt(int time); public double[] getPointAt(int time) {
double[] ret = new double[2];
void init(GameObject[] objects, int startIndex); int i = 0;
while (i < movers.size()) {
void update(GameObject g); if (movers.get(i).getLastItem().getEndTime() < time)
break;
double[] point = movers.get(i).getPointAt(time);
ret[0] += point[0];
ret[1] += point[1];
i++;
}
ret[0] /= i;
ret[1] /= i;
return ret;
}
public final void create(GameObject[] objects, int startIndex) {
if (latestIndex <= startIndex) {
movers.clear();
}
GameObject[] items = new GameObject[getMaxBufferSize()];
int i = 1;
items[0] = startIndex == -1 ? Dancer.d : objects[startIndex];
while (i < items.length - 1) {
GameObject g = objects[startIndex + i];
if (g.isSlider() || g.isSpinner())
break;
items[i++] = g;
}
items[i] = objects[startIndex + i];
latestIndex = startIndex + getMaxBufferSize() + i - items.length;
if (++i >= getMinBufferSize()) {
init(items, i);
}
else {
addMover(new LineMover(objects, startIndex + 1, i));
}
}
protected abstract void init(GameObject[] objects, int count);
public final void update(GameObject g) {
GameObject[] items = movers.get(movers.size() - 1).getItems();
if (items[items.length - 1] != g) {
System.arraycopy(items, 1, items, 0, items.length - 1);
items[items.length - 1] = g;
create(items, 0);
latestIndex++;
}
}
/** /**
* How many items the Factory would like to look in the future * How many items the Factory would like to look in the future at most
* *
* @return * @return
*/ */
int getPrefferedBufferSize(); public abstract int getMaxBufferSize();
boolean isInitialized(); /**
* How many items the Factory would like to look in the future at least
int getLatestIndex(); *
* @return
*/
public abstract int getMinBufferSize();
public boolean isInitialized() {
return movers.isEmpty();
}
protected PolyMover getCurrent() {
return movers.peekLast();
}
protected List<PolyMover> getMovers() {
return movers;
}
/**
* Adds a Mover to the end of the list. It will also remove the first mover, if the list is bigger than the buffersize.
*
* @param mover the mover to be added
*/
protected void addMover(PolyMover mover) {
movers.add(mover);
if (movers.size() >= getMaxBufferSize())
movers.remove();
}
public int getLatestIndex() {
return latestIndex;
}
} }

View File

@ -594,7 +594,7 @@ public class Options {
DISABLE_UPDATER ("Disable Automatic Updates", "DisableUpdater", "Disable automatic checking for updates upon starting opsu!.", false), 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), 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 @Override
public void click(GameContainer container) { public void click(GameContainer container) {
bool = !bool; bool = !bool;
@ -617,7 +617,7 @@ public class Options {
@Override @Override
public void clickListItem(int index) { public void clickListItem(int index) {
if (Dancer.multipoint) if (Dancer.multipoint)
Dancer.instance.setMoverFactoryIndex(index); Dancer.instance.setPolyMoverFactoryIndex(index);
else else
Dancer.instance.setMoverFactoryIndex(index); Dancer.instance.setMoverFactoryIndex(index);
} }

View File

@ -421,7 +421,7 @@ public class Game extends BasicGameState {
autoMousePressed = false; autoMousePressed = false;
if (GameMod.AUTO.isActive() || GameMod.AUTOPILOT.isActive()) { if (GameMod.AUTO.isActive() || GameMod.AUTOPILOT.isActive()) {
Vec2f autoPoint; Vec2f autoPoint;
if (objectIndex < beatmap.objects.length - (Dancer.multipoint ? Dancer.polyMoverFactories[Dancer.instance.getPolyMoverFactoryIndex()].getPrefferedBufferSize() : 0)) { if (objectIndex < beatmap.objects.length - (Dancer.multipoint ? Dancer.polyMoverFactories[Dancer.instance.getPolyMoverFactoryIndex()].getMinBufferSize() : 0)) {
Dancer d = Dancer.instance; Dancer d = Dancer.instance;
if (Dancer.multipoint) { if (Dancer.multipoint) {
d.update(trackPosition, gameObjects, objectIndex); d.update(trackPosition, gameObjects, objectIndex);

View File

@ -19,8 +19,8 @@ package yugecin.opsudance;
import awlex.ospu.movers.factories.CenterSpiralMoverFactory; import awlex.ospu.movers.factories.CenterSpiralMoverFactory;
import awlex.ospu.movers.factories.SpiralMoverFactory; import awlex.ospu.movers.factories.SpiralMoverFactory;
import awlex.ospu.polymover.PolyMover;
import awlex.ospu.polymover.factory.ArcFactory; import awlex.ospu.polymover.factory.ArcFactory;
import awlex.ospu.polymover.factory.LinearFactory;
import awlex.ospu.polymover.factory.PolyMoverFactory; import awlex.ospu.polymover.factory.PolyMoverFactory;
import awlex.ospu.spinners.SpiralSpinner; import awlex.ospu.spinners.SpiralSpinner;
import itdelatrisu.opsu.Options; import itdelatrisu.opsu.Options;
@ -39,7 +39,7 @@ import yugecin.opsudance.movers.slidermovers.SliderMoverController;
import yugecin.opsudance.spinners.*; import yugecin.opsudance.spinners.*;
public class Dancer { public class Dancer {
public static MoverFactory[] moverFactories = new MoverFactory[]{ public static MoverFactory[] moverFactories = new MoverFactory[]{
new AutoMoverFactory(), new AutoMoverFactory(),
new AutoEllipseMoverFactory(), new AutoEllipseMoverFactory(),
@ -53,7 +53,7 @@ public class Dancer {
new SpiralMoverFactory(), new SpiralMoverFactory(),
new CenterSpiralMoverFactory(), new CenterSpiralMoverFactory(),
}; };
public static Spinner[] spinners = new Spinner[]{ public static Spinner[] spinners = new Spinner[]{
new RektSpinner(), new RektSpinner(),
new BeamSpinner(), new BeamSpinner(),
@ -67,18 +67,19 @@ public class Dancer {
new ApproachCircleSpinner(), new ApproachCircleSpinner(),
new SpiralSpinner(), new SpiralSpinner(),
}; };
public static SliderMoverController[] sliderMovers = new SliderMoverController[]{ public static SliderMoverController[] sliderMovers = new SliderMoverController[]{
new DefaultSliderMoverController(), new DefaultSliderMoverController(),
new InheritedSliderMoverController(), new InheritedSliderMoverController(),
}; };
public static PolyMoverFactory[] polyMoverFactories = new PolyMoverFactory[]{ public static PolyMoverFactory[] polyMoverFactories = new PolyMoverFactory[]{
new LinearFactory(),
new ArcFactory() new ArcFactory()
}; };
public static Dancer instance = new Dancer(); public static Dancer instance = new Dancer();
public static boolean multipoint = false; public static boolean multipoint = false;
public static boolean mirror = false; // this should really get its own place somewhere... public static boolean mirror = false; // this should really get its own place somewhere...
public static boolean drawApproach = true; // this should really get its own place somewhere... public static boolean drawApproach = true; // this should really get its own place somewhere...
@ -95,34 +96,34 @@ public class Dancer {
public static int cursortraillength = 20; public static int cursortraillength = 20;
public static boolean hidewatermark = false; public static boolean hidewatermark = false;
public static boolean onlycolortrail = false; public static boolean onlycolortrail = false;
private int dir; private int dir;
public static final GameObject d = new DummyObject(); public static final GameObject d = new DummyObject();
private GameObject p; private GameObject p;
private MoverFactory moverFactory; private MoverFactory moverFactory;
private PolyMoverFactory polyMoverFactory; private PolyMoverFactory polyMoverFactory;
private Mover mover; private Mover mover;
private Spinner spinner; private Spinner spinner;
public static SliderMoverController sliderMoverController; public static SliderMoverController sliderMoverController;
private int moverFactoryIndex; private int moverFactoryIndex;
private int polyMoverFactoryIndex; private int polyMoverFactoryIndex;
private int spinnerIndex; private int spinnerIndex;
public float x; public float x;
public float y; public float y;
private boolean isCurrentLazySlider; private boolean isCurrentLazySlider;
public static boolean LAZY_SLIDERS; public static boolean LAZY_SLIDERS;
public Dancer() { public Dancer() {
moverFactory = moverFactories[0]; moverFactory = moverFactories[0];
spinner = spinners[0]; spinner = spinners[0];
sliderMoverController = sliderMovers[0]; sliderMoverController = sliderMovers[0];
} }
public void reset() { public void reset() {
isCurrentLazySlider = false; isCurrentLazySlider = false;
p = null; p = null;
@ -131,11 +132,11 @@ public class Dancer {
s.init(); s.init();
} }
} }
public int getSpinnerIndex() { public int getSpinnerIndex() {
return spinnerIndex; return spinnerIndex;
} }
public void setSpinnerIndex(int spinnerIndex) { public void setSpinnerIndex(int spinnerIndex) {
if (spinnerIndex < 0 || spinnerIndex >= spinners.length) { if (spinnerIndex < 0 || spinnerIndex >= spinners.length) {
spinnerIndex = 0; spinnerIndex = 0;
@ -143,11 +144,11 @@ public class Dancer {
this.spinnerIndex = spinnerIndex; this.spinnerIndex = spinnerIndex;
spinner = spinners[spinnerIndex]; spinner = spinners[spinnerIndex];
} }
public int getMoverFactoryIndex() { public int getMoverFactoryIndex() {
return moverFactoryIndex; return moverFactoryIndex;
} }
public void setMoverFactoryIndex(int moverFactoryIndex) { public void setMoverFactoryIndex(int moverFactoryIndex) {
if (moverFactoryIndex < 0 || moverFactoryIndex >= moverFactories.length) { if (moverFactoryIndex < 0 || moverFactoryIndex >= moverFactories.length) {
moverFactoryIndex = 0; moverFactoryIndex = 0;
@ -155,11 +156,11 @@ public class Dancer {
this.moverFactoryIndex = moverFactoryIndex; this.moverFactoryIndex = moverFactoryIndex;
moverFactory = moverFactories[moverFactoryIndex]; moverFactory = moverFactories[moverFactoryIndex];
} }
public int getPolyMoverFactoryIndex() { public int getPolyMoverFactoryIndex() {
return polyMoverFactoryIndex; return polyMoverFactoryIndex;
} }
public void setPolyMoverFactoryIndex(int polyMoverFactoryIndex) { public void setPolyMoverFactoryIndex(int polyMoverFactoryIndex) {
if (polyMoverFactoryIndex < 0 || polyMoverFactoryIndex >= polyMoverFactories.length) { if (polyMoverFactoryIndex < 0 || polyMoverFactoryIndex >= polyMoverFactories.length) {
polyMoverFactoryIndex = 0; polyMoverFactoryIndex = 0;
@ -167,7 +168,7 @@ public class Dancer {
this.polyMoverFactoryIndex = polyMoverFactoryIndex; this.polyMoverFactoryIndex = polyMoverFactoryIndex;
polyMoverFactory = polyMoverFactories[polyMoverFactoryIndex]; polyMoverFactory = polyMoverFactories[polyMoverFactoryIndex];
} }
public void update(int time, GameObject p, GameObject c) { public void update(int time, GameObject p, GameObject c) {
GameObject[] e = sliderMoverController.process(p, c, time); GameObject[] e = sliderMoverController.process(p, c, time);
p = e[0]; p = e[0];
@ -205,7 +206,7 @@ public class Dancer {
mover = moverFactory.create(p, c, dir); mover = moverFactory.create(p, c, dir);
} }
} }
if (time < c.getTime()) { if (time < c.getTime()) {
if (!p.isSpinner() || !c.isSpinner()) { if (!p.isSpinner() || !c.isSpinner()) {
double[] point = mover.getPointAt(time); double[] point = mover.getPointAt(time);
@ -234,7 +235,7 @@ public class Dancer {
x = Utils.clamp(x, 10, Options.width - 10); x = Utils.clamp(x, 10, Options.width - 10);
y = Utils.clamp(y, 10, Options.height - 10); y = Utils.clamp(y, 10, Options.height - 10);
} }
public void update(int time, GameObject[] gameObjects, int objectIndex) { public void update(int time, GameObject[] gameObjects, int objectIndex) {
GameObject p, c; GameObject p, c;
GameObject[] e = objectIndex > 0 ? sliderMoverController.process(gameObjects[objectIndex - 1], gameObjects[objectIndex], time) GameObject[] e = objectIndex > 0 ? sliderMoverController.process(gameObjects[objectIndex - 1], gameObjects[objectIndex], time)
@ -249,6 +250,7 @@ public class Dancer {
c.start.set((float) spinnerStartPoint[0], (float) spinnerStartPoint[1]); c.start.set((float) spinnerStartPoint[0], (float) spinnerStartPoint[1]);
} }
} }
isCurrentLazySlider = false; isCurrentLazySlider = false;
// detect lazy sliders, should work pretty good // 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) { if (c.isSlider() && LAZY_SLIDERS && Utils.distance(c.start.x, c.start.y, c.end.x, c.end.y) <= Circle.diameter * 0.8f) {
@ -266,16 +268,16 @@ public class Dancer {
double[] spinnerStartPoint = spinner.getPoint(); double[] spinnerStartPoint = spinner.getPoint();
c.start = new Vec2f((float) spinnerStartPoint[0], (float) spinnerStartPoint[1]); c.start = new Vec2f((float) spinnerStartPoint[0], (float) spinnerStartPoint[1]);
} }
if (polyMoverFactory.isInitialized() && polyMoverFactory.getLatestIndex() < objectIndex + polyMoverFactory.getPrefferedBufferSize() - 1) { if (polyMoverFactory.isInitialized() && polyMoverFactory.getLatestIndex() < objectIndex + polyMoverFactory.getLatestIndex() - 1) {
polyMoverFactory.update(gameObjects[polyMoverFactory.getPrefferedBufferSize() - 1]); polyMoverFactory.update(gameObjects[objectIndex + polyMoverFactory.getMaxBufferSize() - 1]);
} else { }
polyMoverFactory.init(gameObjects, objectIndex); else {
polyMoverFactory.create(gameObjects, objectIndex - 1);
} }
} }
if (time < c.getTime()) { if (time < c.getTime()) {
if (!p.isSpinner() || !c.isSpinner()) { if (!(p.isSpinner() || c.isSpinner())) {
double[] point = polyMoverFactory.getPointAt(time); double[] point = polyMoverFactory.getPointAt(time);
x = (float) point[0]; x = (float) point[0];
y = (float) point[1]; y = (float) point[1];