First try integrating a Arc. Status: Still alot to do
This commit is contained in:
@@ -19,6 +19,9 @@ 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.PolyMoverFactory;
|
||||
import awlex.ospu.spinners.SpiralSpinner;
|
||||
import itdelatrisu.opsu.Options;
|
||||
import itdelatrisu.opsu.Utils;
|
||||
@@ -36,8 +39,8 @@ import yugecin.opsudance.movers.slidermovers.SliderMoverController;
|
||||
import yugecin.opsudance.spinners.*;
|
||||
|
||||
public class Dancer {
|
||||
|
||||
public static MoverFactory[] moverFactories = new MoverFactory[] {
|
||||
|
||||
public static MoverFactory[] moverFactories = new MoverFactory[]{
|
||||
new AutoMoverFactory(),
|
||||
new AutoEllipseMoverFactory(),
|
||||
new CircleMoverFactory(),
|
||||
@@ -50,8 +53,8 @@ public class Dancer {
|
||||
new SpiralMoverFactory(),
|
||||
new CenterSpiralMoverFactory(),
|
||||
};
|
||||
|
||||
public static Spinner[] spinners = new Spinner[] {
|
||||
|
||||
public static Spinner[] spinners = new Spinner[]{
|
||||
new RektSpinner(),
|
||||
new BeamSpinner(),
|
||||
new CircleSpinner(),
|
||||
@@ -64,14 +67,19 @@ public class Dancer {
|
||||
new ApproachCircleSpinner(),
|
||||
new SpiralSpinner(),
|
||||
};
|
||||
|
||||
public static SliderMoverController[] sliderMovers = new SliderMoverController[] {
|
||||
|
||||
public static SliderMoverController[] sliderMovers = new SliderMoverController[]{
|
||||
new DefaultSliderMoverController(),
|
||||
new InheritedSliderMoverController(),
|
||||
};
|
||||
|
||||
|
||||
public static PolyMoverFactory[] polyMoverFactories = new PolyMoverFactory[]{
|
||||
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...
|
||||
public static boolean removebg = true; // this should really get its own place somewhere...
|
||||
@@ -87,32 +95,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;
|
||||
@@ -121,11 +131,11 @@ public class Dancer {
|
||||
s.init();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int getSpinnerIndex() {
|
||||
return spinnerIndex;
|
||||
}
|
||||
|
||||
|
||||
public void setSpinnerIndex(int spinnerIndex) {
|
||||
if (spinnerIndex < 0 || spinnerIndex >= spinners.length) {
|
||||
spinnerIndex = 0;
|
||||
@@ -133,11 +143,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;
|
||||
@@ -145,7 +155,19 @@ 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;
|
||||
}
|
||||
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];
|
||||
@@ -175,27 +197,100 @@ public class Dancer {
|
||||
double[] spinnerStartPoint = spinner.getPoint();
|
||||
c.start = new Vec2f((float) spinnerStartPoint[0], (float) spinnerStartPoint[1]);
|
||||
}
|
||||
if (p == d) {
|
||||
mover = new LinearMover(p, c, dir);
|
||||
} else {
|
||||
mover = moverFactory.create(p, c, dir);
|
||||
}
|
||||
if (mover == null || mover.getEnd() != c)
|
||||
if (p == d) {
|
||||
mover = new LinearMover(p, c, dir);
|
||||
}
|
||||
else {
|
||||
mover = moverFactory.create(p, c, dir);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (time < c.getTime()) {
|
||||
if (!p.isSpinner() || !c.isSpinner()) {
|
||||
double[] point = mover.getPointAt(time);
|
||||
x = (float) point[0];
|
||||
y = (float) point[1];
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
if (c.isSpinner()) {
|
||||
Spinner.PROGRESS = (double) (time - c.getTime()) / (double) (c.getEndTime() - c.getTime());
|
||||
double[] point = spinner.getPoint();
|
||||
x = (float) point[0];
|
||||
y = (float) point[1];
|
||||
c.end = new Vec2f(x, y);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
Vec2f point = c.getPointAt(time);
|
||||
if (isCurrentLazySlider) {
|
||||
point = c.start;
|
||||
}
|
||||
x = point.x;
|
||||
y = point.y;
|
||||
}
|
||||
}
|
||||
Pippi.dance(time, c, isCurrentLazySlider);
|
||||
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)
|
||||
: sliderMoverController.process(d, gameObjects[objectIndex], time);
|
||||
p = e[0];
|
||||
c = e[1];
|
||||
if (this.p != p) {
|
||||
this.p = p;
|
||||
if (this.p == d) {
|
||||
if (c.isSpinner()) {
|
||||
double[] spinnerStartPoint = spinner.getPoint();
|
||||
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) {
|
||||
Slider s = (Slider) c;
|
||||
Vec2f mid = s.getCurve().pointAt(1f);
|
||||
if (s.getRepeats() == 1 || Utils.distance(c.start.x, c.start.y, mid.x, mid.y) <= Circle.diameter * 0.8f) {
|
||||
mid = s.getCurve().pointAt(0.5f);
|
||||
if (Utils.distance(c.start.x, c.start.y, mid.x, mid.y) <= Circle.diameter * 0.8f) {
|
||||
isCurrentLazySlider = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
dir = moverDirection.getDirection(dir);
|
||||
if (c.isSpinner()) {
|
||||
double[] spinnerStartPoint = spinner.getPoint();
|
||||
c.start = new Vec2f((float) spinnerStartPoint[0], (float) spinnerStartPoint[1]);
|
||||
}
|
||||
GameObject g = gameObjects[objectIndex + 2];
|
||||
if (!g.isSpinner() && !g.isSlider())
|
||||
if (polyMoverFactory.isInitialized()) {
|
||||
polyMoverFactory.update(g);
|
||||
} else {
|
||||
polyMoverFactory.init(gameObjects, objectIndex);
|
||||
}
|
||||
}
|
||||
|
||||
if (time < c.getTime()) {
|
||||
if (!p.isSpinner() || !c.isSpinner()) {
|
||||
double[] point = polyMoverFactory.getPointAt(time);
|
||||
x = (float) point[0];
|
||||
y = (float) point[1];
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (c.isSpinner()) {
|
||||
Spinner.PROGRESS = (double) (time - c.getTime()) / (double) (c.getEndTime() - c.getTime());
|
||||
double[] point = spinner.getPoint();
|
||||
x = (float) point[0];
|
||||
y = (float) point[1];
|
||||
c.end = new Vec2f(x, y);
|
||||
}
|
||||
else {
|
||||
Vec2f point = c.getPointAt(time);
|
||||
if (isCurrentLazySlider) {
|
||||
point = c.start;
|
||||
@@ -208,5 +303,4 @@ public class Dancer {
|
||||
x = Utils.clamp(x, 10, Options.width - 10);
|
||||
y = Utils.clamp(y, 10, Options.height - 10);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -31,6 +31,8 @@ public abstract class Mover {
|
||||
|
||||
protected double endX;
|
||||
protected double endY;
|
||||
|
||||
private GameObject end;
|
||||
|
||||
public Mover(GameObject start, GameObject end, int dir) {
|
||||
this.dir = dir;
|
||||
@@ -40,6 +42,7 @@ public abstract class Mover {
|
||||
this.endY = end.start.y;
|
||||
this.startT = start.getEndTime();
|
||||
this.totalT = end.getTime() - startT;
|
||||
this.end = end;
|
||||
}
|
||||
|
||||
protected final double getT(int time) {
|
||||
@@ -48,5 +51,8 @@ public abstract class Mover {
|
||||
|
||||
public abstract double[] getPointAt(int time);
|
||||
public abstract String getName();
|
||||
|
||||
|
||||
public GameObject getEnd() {
|
||||
return end;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user