something

This commit is contained in:
Awlex 2016-11-19 22:47:27 +01:00
parent 3bd16a8593
commit a671f9dba2
4 changed files with 23 additions and 22 deletions

View File

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

View File

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

View File

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

View File

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