something
This commit is contained in:
parent
3bd16a8593
commit
a671f9dba2
|
@ -70,8 +70,6 @@ public class ArcMover extends PolyMover {
|
||||||
percent = ((double) time - middle.getTime()) / (p2.getTime() - middle.getTime());
|
percent = ((double) time - middle.getTime()) / (p2.getTime() - middle.getTime());
|
||||||
angle = beta + (gamma - beta) * percent;
|
angle = beta + (gamma - beta) * percent;
|
||||||
}
|
}
|
||||||
if (angle > PI)
|
|
||||||
angle -= PI;
|
|
||||||
return new double[]{
|
return new double[]{
|
||||||
xm + r * cos(angle),
|
xm + r * cos(angle),
|
||||||
ym + r * sin(angle)
|
ym + r * sin(angle)
|
||||||
|
|
|
@ -10,28 +10,29 @@ import itdelatrisu.opsu.objects.GameObject;
|
||||||
* Created by Awlex on 18.11.2016.
|
* Created by Awlex on 18.11.2016.
|
||||||
*/
|
*/
|
||||||
public class ArcFactory implements PolyMoverFactory {
|
public class ArcFactory implements PolyMoverFactory {
|
||||||
|
|
||||||
private static final int PREFFERED_BUFFER_SIZE = 3;
|
private static final int PREFFERED_BUFFER_SIZE = 3;
|
||||||
private PolyMover current, previous;
|
private PolyMover current, previous;
|
||||||
private int lastIndex;
|
private int lastIndex;
|
||||||
|
|
||||||
public double[] getPointAt(int time) {
|
public double[] getPointAt(int time) {
|
||||||
if (previous == null) {
|
if (previous == null) {
|
||||||
return current.getPointAt(time);
|
return current.getPointAt(time);
|
||||||
} else if (current == null) {
|
}
|
||||||
|
if (current == null) {
|
||||||
return previous.getPointAt(time);
|
return previous.getPointAt(time);
|
||||||
}
|
}
|
||||||
|
|
||||||
double[] point1 = current.getPointAt(time);
|
double[] point1 = current.getPointAt(time);
|
||||||
double[] point2 = previous.getPointAt(time);
|
double[] point2 = previous.getPointAt(time);
|
||||||
|
|
||||||
return new double[]{
|
return new double[]{
|
||||||
(point1[0] + point2[0]) * 0.5,
|
(point1[0] + point2[0]) * 0.5,
|
||||||
(point1[1] + point2[1]) * 0.5
|
(point1[1] + point2[1]) * 0.5
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void init(GameObject[] objects, int startIndex) {
|
public void init(GameObject[] objects, int startIndex) {
|
||||||
if (objects == null)
|
if (objects == null)
|
||||||
throw new NullPointerException("Objects musn't be null");
|
throw new NullPointerException("Objects musn't be null");
|
||||||
|
@ -45,7 +46,9 @@ public class ArcFactory implements PolyMoverFactory {
|
||||||
startIndex++;
|
startIndex++;
|
||||||
}
|
}
|
||||||
GameObject middle = objects[startIndex + 1];
|
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);
|
current = new LineMover(objects, startIndex, 3);
|
||||||
else
|
else
|
||||||
current = new ArcMover(objects[startIndex], middle, objects[startIndex + 2]);
|
current = new ArcMover(objects[startIndex], middle, objects[startIndex + 2]);
|
||||||
|
@ -54,10 +57,9 @@ public class ArcFactory implements PolyMoverFactory {
|
||||||
lastIndex--;
|
lastIndex--;
|
||||||
previous = null;
|
previous = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void update(GameObject p) {
|
public void update(GameObject p) {
|
||||||
GameObject[] items = current.getItems();
|
GameObject[] items = current.getItems();
|
||||||
System.out.println(items.length);
|
|
||||||
GameObject last = items[items.length - 1];
|
GameObject last = items[items.length - 1];
|
||||||
if (last != p) {
|
if (last != p) {
|
||||||
previous = current;
|
previous = current;
|
||||||
|
@ -74,25 +76,25 @@ public class ArcFactory implements PolyMoverFactory {
|
||||||
}
|
}
|
||||||
lastIndex++;
|
lastIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getPrefferedBufferSize() {
|
public int getPrefferedBufferSize() {
|
||||||
return PREFFERED_BUFFER_SIZE;
|
return PREFFERED_BUFFER_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Arcs";
|
return "Arcs";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isInitialized() {
|
public boolean isInitialized() {
|
||||||
return current != null;
|
return current != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLatestIndex() {
|
public int getLatestIndex() {
|
||||||
return lastIndex;
|
return lastIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -266,16 +266,17 @@ 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) {
|
|
||||||
polyMoverFactory.update(gameObjects[ objectIndex + polyMoverFactory.getPrefferedBufferSize() - 1]);
|
if (polyMoverFactory.isInitialized() && polyMoverFactory.getLatestIndex() < objectIndex + polyMoverFactory.getPrefferedBufferSize()) {
|
||||||
|
polyMoverFactory.update(gameObjects[polyMoverFactory.getLatestIndex()]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
polyMoverFactory.init(gameObjects, objectIndex);
|
polyMoverFactory.init(gameObjects, objectIndex - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (time < c.getTime()) {
|
if (time < c.getTime()) {
|
||||||
if (!p.isSpinner() || !c.isSpinner()) {
|
if (!p.isSpinner() || !c.isSpinner() && polyMoverFactory.isInitialized()) {
|
||||||
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];
|
||||||
|
|
Loading…
Reference in New Issue
Block a user