Merge remote-tracking branch 'refs/remotes/origin/Curving'
This commit is contained in:
commit
8dcfe96fff
|
@ -1,15 +1,18 @@
|
|||
package awlex.ospu.polymover;
|
||||
|
||||
import Jama.Matrix;
|
||||
import itdelatrisu.opsu.objects.Circle;
|
||||
import itdelatrisu.opsu.objects.GameObject;
|
||||
import itdelatrisu.opsu.objects.Slider;
|
||||
|
||||
import static java.lang.Math.*;
|
||||
|
||||
/**
|
||||
* 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 double xm, ym, r, alpha, beta, gamma;
|
||||
|
||||
|
@ -20,21 +23,13 @@ public class ArcMover extends PolyMover {
|
|||
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() {
|
||||
Matrix m = prepareMatrix(p1, middle, p2);
|
||||
xm = m.get(1, 0) * 0.5;
|
||||
ym = m.get(2, 0) * 0.5;
|
||||
r = sqrt(pow(xm, 2) + pow(ym, 2) - m.get(0, 0));
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -42,10 +37,11 @@ public class ArcMover extends PolyMover {
|
|||
public double[] getPointAt(int time) {
|
||||
double angle;
|
||||
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 {
|
||||
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[]{
|
||||
xm + r * cos(angle),
|
||||
|
@ -61,19 +57,36 @@ public class ArcMover extends PolyMover {
|
|||
p2
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
private static Matrix prepareMatrix(GameObject p1, GameObject middle, GameObject p2) {
|
||||
Matrix a = new Matrix(new double[][]{
|
||||
{1, -p1.end.x, -p1.end.y},
|
||||
{1, -middle.end.x, -middle.end.y},
|
||||
{1, -p2.start.x, -p2.start.y}
|
||||
});
|
||||
Matrix b = new Matrix(new double[][]{
|
||||
{-(pow(p1.end.x, 2) + pow(p1.end.y, 2))},
|
||||
{-(pow(middle.end.x, 2) + pow(middle.end.y, 2))},
|
||||
{-(pow(p2.start.x, 2) + pow(p2.start.y, 2))},
|
||||
});
|
||||
|
||||
Matrix a, b;
|
||||
|
||||
//if (!p2.isSlider()) {
|
||||
a = new Matrix(new double[][]{
|
||||
{1, -p1.end.x, -p1.end.y},
|
||||
{1, -middle.start.x, -middle.start.y},
|
||||
{1, -p2.start.x, -p2.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(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);
|
||||
}
|
||||
|
||||
|
@ -85,4 +98,9 @@ public class ArcMover extends PolyMover {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GameObject getLastItem() {
|
||||
return p2;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,31 +2,54 @@ package awlex.ospu.polymover;
|
|||
|
||||
import itdelatrisu.opsu.objects.DummyObject;
|
||||
import itdelatrisu.opsu.objects.GameObject;
|
||||
import itdelatrisu.opsu.states.Game;
|
||||
import yugecin.opsudance.movers.LinearMover;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* Created by Awlex on 19.11.2016.
|
||||
*/
|
||||
public class LineMover extends PolyMover {
|
||||
|
||||
GameObject[] objects;
|
||||
public class LineMover implements PolyMover {
|
||||
|
||||
public static final int ITEMS_NEEDED = 2;
|
||||
|
||||
private GameObject[] objects;
|
||||
private LinearMover m;
|
||||
private int currentIndex;
|
||||
|
||||
|
||||
public LineMover(GameObject[] objects, int startIndex, int count) {
|
||||
this.objects = new GameObject[count];
|
||||
System.arraycopy(objects, startIndex, this.objects, 0, count);
|
||||
this.objects = objects;
|
||||
m = new LinearMover(objects[startIndex], objects[startIndex + 1], 1);
|
||||
currentIndex = startIndex + 1;
|
||||
}
|
||||
|
||||
|
||||
public LineMover(GameObject[] objects, int count) {
|
||||
this(objects, 0, count);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double[] getPointAt(int time) {
|
||||
int i = 0;
|
||||
while (time > objects[i].getTime() && i < objects.length - 1)
|
||||
i++;
|
||||
|
||||
return new LinearMover(i == 0 ? new DummyObject() : objects[i - 1], objects[i], 1).getPointAt(time);
|
||||
if (objects[currentIndex].getEndTime() < time)
|
||||
m = new LinearMover(objects[currentIndex], objects[currentIndex + 1], 1);
|
||||
return m.getPointAt(time);
|
||||
}
|
||||
|
||||
@Override
|
||||
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];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,8 +5,11 @@ import itdelatrisu.opsu.objects.GameObject;
|
|||
/**
|
||||
* Created by Awlex on 18.11.2016.
|
||||
*/
|
||||
public abstract class PolyMover {
|
||||
public abstract double[] getPointAt(int time);
|
||||
|
||||
public abstract GameObject[] getItems();
|
||||
public interface PolyMover {
|
||||
|
||||
double[] getPointAt(int time);
|
||||
|
||||
GameObject[] getItems();
|
||||
|
||||
GameObject getLastItem();
|
||||
}
|
|
@ -3,75 +3,38 @@ package awlex.ospu.polymover.factory;
|
|||
import awlex.ospu.polymover.ArcMover;
|
||||
import awlex.ospu.polymover.LineMover;
|
||||
import awlex.ospu.polymover.PolyMover;
|
||||
import itdelatrisu.opsu.objects.DummyObject;
|
||||
import itdelatrisu.opsu.objects.GameObject;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 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 PolyMover current, previous;
|
||||
private int lastIndex;
|
||||
|
||||
public double[] getPointAt(int time) {
|
||||
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);
|
||||
|
||||
public void init(GameObject[] objects, int count) {
|
||||
if (count < 3 || (!ArcMover.canCricleExistBetweenItems(objects[0], objects[1], objects[2])))
|
||||
addMover(new LineMover(objects, 3));
|
||||
else
|
||||
current = new ArcMover(objects[startIndex], middle, objects[startIndex + 2]);
|
||||
lastIndex = startIndex + 2;
|
||||
previous = null;
|
||||
addMover(new ArcMover(objects[0], objects[1], objects[2]));
|
||||
}
|
||||
|
||||
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
|
||||
public int getPrefferedBufferSize() {
|
||||
return PREFFERED_BUFFER_SIZE;
|
||||
public int getMaxBufferSize() {
|
||||
return ArcMover.ITEMS_NEEDED;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getMinBufferSize() {
|
||||
return LineMover.ITEMS_NEEDED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Arcs";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInitialized() {
|
||||
return current != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLatestIndex() {
|
||||
return lastIndex;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
38
src/awlex/ospu/polymover/factory/LinearFactory.java
Normal file
38
src/awlex/ospu/polymover/factory/LinearFactory.java
Normal 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";
|
||||
}
|
||||
}
|
|
@ -1,30 +1,122 @@
|
|||
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 yugecin.opsudance.Dancer;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 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
|
||||
* @return [x, y]
|
||||
*/
|
||||
double[] getPointAt(int time);
|
||||
|
||||
void init(GameObject[] objects, int startIndex);
|
||||
|
||||
void update(GameObject g);
|
||||
|
||||
public double[] getPointAt(int time) {
|
||||
double[] ret = new double[2];
|
||||
int i = 0;
|
||||
while (i < movers.size()) {
|
||||
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
|
||||
*/
|
||||
int getPrefferedBufferSize();
|
||||
|
||||
boolean isInitialized();
|
||||
|
||||
int getLatestIndex();
|
||||
public abstract int getMaxBufferSize();
|
||||
|
||||
/**
|
||||
* How many items the Factory would like to look in the future at least
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
@ -617,7 +617,7 @@ public class Options {
|
|||
@Override
|
||||
public void clickListItem(int index) {
|
||||
if (Dancer.multipoint)
|
||||
Dancer.instance.setMoverFactoryIndex(index);
|
||||
Dancer.instance.setPolyMoverFactoryIndex(index);
|
||||
else
|
||||
Dancer.instance.setMoverFactoryIndex(index);
|
||||
}
|
||||
|
|
|
@ -421,7 +421,7 @@ public class Game extends BasicGameState {
|
|||
autoMousePressed = false;
|
||||
if (GameMod.AUTO.isActive() || GameMod.AUTOPILOT.isActive()) {
|
||||
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;
|
||||
if (Dancer.multipoint) {
|
||||
d.update(trackPosition, gameObjects, objectIndex);
|
||||
|
|
|
@ -19,8 +19,8 @@ package yugecin.opsudance;
|
|||
|
||||
import awlex.ospu.movers.factories.CenterSpiralMoverFactory;
|
||||
import awlex.ospu.movers.factories.SpiralMoverFactory;
|
||||
import awlex.ospu.polymover.PolyMover;
|
||||
import awlex.ospu.polymover.factory.ArcFactory;
|
||||
import awlex.ospu.polymover.factory.LinearFactory;
|
||||
import awlex.ospu.polymover.factory.PolyMoverFactory;
|
||||
import awlex.ospu.spinners.SpiralSpinner;
|
||||
import itdelatrisu.opsu.Options;
|
||||
|
@ -39,7 +39,7 @@ import yugecin.opsudance.movers.slidermovers.SliderMoverController;
|
|||
import yugecin.opsudance.spinners.*;
|
||||
|
||||
public class Dancer {
|
||||
|
||||
|
||||
public static MoverFactory[] moverFactories = new MoverFactory[]{
|
||||
new AutoMoverFactory(),
|
||||
new AutoEllipseMoverFactory(),
|
||||
|
@ -53,7 +53,7 @@ public class Dancer {
|
|||
new SpiralMoverFactory(),
|
||||
new CenterSpiralMoverFactory(),
|
||||
};
|
||||
|
||||
|
||||
public static Spinner[] spinners = new Spinner[]{
|
||||
new RektSpinner(),
|
||||
new BeamSpinner(),
|
||||
|
@ -67,18 +67,19 @@ public class Dancer {
|
|||
new ApproachCircleSpinner(),
|
||||
new SpiralSpinner(),
|
||||
};
|
||||
|
||||
|
||||
public static SliderMoverController[] sliderMovers = new SliderMoverController[]{
|
||||
new DefaultSliderMoverController(),
|
||||
new InheritedSliderMoverController(),
|
||||
};
|
||||
|
||||
|
||||
public static PolyMoverFactory[] polyMoverFactories = new PolyMoverFactory[]{
|
||||
new LinearFactory(),
|
||||
new ArcFactory()
|
||||
};
|
||||
|
||||
|
||||
public static Dancer instance = new Dancer();
|
||||
|
||||
|
||||
public static boolean multipoint = false;
|
||||
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...
|
||||
|
@ -95,34 +96,34 @@ public class Dancer {
|
|||
public static int cursortraillength = 20;
|
||||
public static boolean hidewatermark = false;
|
||||
public static boolean onlycolortrail = false;
|
||||
|
||||
|
||||
private int dir;
|
||||
public static final GameObject d = new DummyObject();
|
||||
private GameObject p;
|
||||
|
||||
|
||||
private MoverFactory moverFactory;
|
||||
private PolyMoverFactory polyMoverFactory;
|
||||
private Mover mover;
|
||||
private Spinner spinner;
|
||||
public static SliderMoverController sliderMoverController;
|
||||
|
||||
|
||||
private int moverFactoryIndex;
|
||||
private int polyMoverFactoryIndex;
|
||||
private int spinnerIndex;
|
||||
|
||||
|
||||
public float x;
|
||||
public float y;
|
||||
|
||||
|
||||
private boolean isCurrentLazySlider;
|
||||
|
||||
|
||||
public static boolean LAZY_SLIDERS;
|
||||
|
||||
|
||||
public Dancer() {
|
||||
moverFactory = moverFactories[0];
|
||||
spinner = spinners[0];
|
||||
sliderMoverController = sliderMovers[0];
|
||||
}
|
||||
|
||||
|
||||
public void reset() {
|
||||
isCurrentLazySlider = false;
|
||||
p = null;
|
||||
|
@ -131,11 +132,11 @@ public class Dancer {
|
|||
s.init();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int getSpinnerIndex() {
|
||||
return spinnerIndex;
|
||||
}
|
||||
|
||||
|
||||
public void setSpinnerIndex(int spinnerIndex) {
|
||||
if (spinnerIndex < 0 || spinnerIndex >= spinners.length) {
|
||||
spinnerIndex = 0;
|
||||
|
@ -143,11 +144,11 @@ public class Dancer {
|
|||
this.spinnerIndex = spinnerIndex;
|
||||
spinner = spinners[spinnerIndex];
|
||||
}
|
||||
|
||||
|
||||
public int getMoverFactoryIndex() {
|
||||
return moverFactoryIndex;
|
||||
}
|
||||
|
||||
|
||||
public void setMoverFactoryIndex(int moverFactoryIndex) {
|
||||
if (moverFactoryIndex < 0 || moverFactoryIndex >= moverFactories.length) {
|
||||
moverFactoryIndex = 0;
|
||||
|
@ -155,11 +156,11 @@ public class Dancer {
|
|||
this.moverFactoryIndex = moverFactoryIndex;
|
||||
moverFactory = moverFactories[moverFactoryIndex];
|
||||
}
|
||||
|
||||
|
||||
public int getPolyMoverFactoryIndex() {
|
||||
return polyMoverFactoryIndex;
|
||||
}
|
||||
|
||||
|
||||
public void setPolyMoverFactoryIndex(int polyMoverFactoryIndex) {
|
||||
if (polyMoverFactoryIndex < 0 || polyMoverFactoryIndex >= polyMoverFactories.length) {
|
||||
polyMoverFactoryIndex = 0;
|
||||
|
@ -167,7 +168,7 @@ public class Dancer {
|
|||
this.polyMoverFactoryIndex = polyMoverFactoryIndex;
|
||||
polyMoverFactory = polyMoverFactories[polyMoverFactoryIndex];
|
||||
}
|
||||
|
||||
|
||||
public void update(int time, GameObject p, GameObject c) {
|
||||
GameObject[] e = sliderMoverController.process(p, c, time);
|
||||
p = e[0];
|
||||
|
@ -205,7 +206,7 @@ public class Dancer {
|
|||
mover = moverFactory.create(p, c, dir);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (time < c.getTime()) {
|
||||
if (!p.isSpinner() || !c.isSpinner()) {
|
||||
double[] point = mover.getPointAt(time);
|
||||
|
@ -234,7 +235,7 @@ public class Dancer {
|
|||
x = Utils.clamp(x, 10, Options.width - 10);
|
||||
y = Utils.clamp(y, 10, Options.height - 10);
|
||||
}
|
||||
|
||||
|
||||
public void update(int time, GameObject[] gameObjects, int objectIndex) {
|
||||
GameObject p, c;
|
||||
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]);
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
|
@ -266,16 +268,16 @@ 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[polyMoverFactory.getPrefferedBufferSize() - 1]);
|
||||
} else {
|
||||
polyMoverFactory.init(gameObjects, objectIndex);
|
||||
|
||||
if (polyMoverFactory.isInitialized() && polyMoverFactory.getLatestIndex() < objectIndex + polyMoverFactory.getLatestIndex() - 1) {
|
||||
polyMoverFactory.update(gameObjects[objectIndex + polyMoverFactory.getMaxBufferSize() - 1]);
|
||||
}
|
||||
else {
|
||||
polyMoverFactory.create(gameObjects, objectIndex - 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (time < c.getTime()) {
|
||||
if (!p.isSpinner() || !c.isSpinner()) {
|
||||
if (!(p.isSpinner() || c.isSpinner())) {
|
||||
double[] point = polyMoverFactory.getPointAt(time);
|
||||
x = (float) point[0];
|
||||
y = (float) point[1];
|
||||
|
|
Loading…
Reference in New Issue
Block a user