refactor options
This commit is contained in:
@@ -17,9 +17,9 @@
|
||||
*/
|
||||
package yugecin.opsudance.movers;
|
||||
|
||||
import itdelatrisu.opsu.Options;
|
||||
import itdelatrisu.opsu.Utils;
|
||||
import itdelatrisu.opsu.objects.GameObject;
|
||||
import yugecin.opsudance.options.Options;
|
||||
|
||||
public class CircleMover extends Mover {
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
*/
|
||||
package yugecin.opsudance.movers;
|
||||
|
||||
import itdelatrisu.opsu.Options;
|
||||
import itdelatrisu.opsu.Utils;
|
||||
import itdelatrisu.opsu.objects.GameObject;
|
||||
import itdelatrisu.opsu.objects.Slider;
|
||||
@@ -25,6 +24,8 @@ import itdelatrisu.opsu.objects.curves.Vec2f;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
import static yugecin.opsudance.options.Options.*;
|
||||
|
||||
public class CubicBezierMover extends Mover {
|
||||
|
||||
private static Point p2 = new Point(0, 0);
|
||||
@@ -41,7 +42,7 @@ public class CubicBezierMover extends Mover {
|
||||
double ang = s.getCurve().getStartAngle() * Math.PI / 180d + Math.PI;
|
||||
Vec2f nextpos = s.getPointAt(s.getTime() + 10);
|
||||
double dist = Utils.distance(end.start.x, end.start.y, nextpos.x, nextpos.y);
|
||||
double speed = dist * Options.getQuadBezAggressiveness() * Options.getQuadBezSliderEntryAggressiveness() / 10;
|
||||
double speed = dist * OPTION_DANCE_QUAD_BEZ_AGGRESSIVENESS.val * OPTION_DANCE_QUAD_BEZ_CUBIC_AGGRESSIVENESS_FACTOR.val / 10;
|
||||
p2.x = (int) (end.start.x + Math.cos(ang) * speed);
|
||||
p2.y = (int) (end.start.y + Math.sin(ang) * speed);
|
||||
}
|
||||
|
||||
@@ -17,11 +17,13 @@
|
||||
*/
|
||||
package yugecin.opsudance.movers;
|
||||
|
||||
import itdelatrisu.opsu.Options;
|
||||
import itdelatrisu.opsu.objects.GameObject;
|
||||
import yugecin.opsudance.options.Options;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import static yugecin.opsudance.options.Options.*;
|
||||
|
||||
public class ExgonMover extends Mover {
|
||||
|
||||
private double[] pos;
|
||||
@@ -30,15 +32,15 @@ public class ExgonMover extends Mover {
|
||||
|
||||
public ExgonMover(GameObject start, GameObject end, int dir) {
|
||||
super(start, end, dir);
|
||||
nextTime = start.getEndTime() + Options.getExgonDelay();
|
||||
nextTime = start.getEndTime() + OPTION_DANCE_EXGON_DELAY.val;
|
||||
pos = new double[] { start.end.x, start.end.y };
|
||||
}
|
||||
|
||||
@Override
|
||||
public double[] getPointAt(int time) {
|
||||
if (time > nextTime) {
|
||||
nextTime = time + Options.getExgonDelay();
|
||||
if (time > getEnd().getEndTime() - Options.getExgonDelay()) {
|
||||
nextTime = time + OPTION_DANCE_EXGON_DELAY.val;
|
||||
if (time > getEnd().getEndTime() - OPTION_DANCE_EXGON_DELAY.val) {
|
||||
pos[0] = endX;
|
||||
pos[1] = endY;
|
||||
} else {
|
||||
|
||||
@@ -17,12 +17,13 @@
|
||||
*/
|
||||
package yugecin.opsudance.movers;
|
||||
|
||||
import itdelatrisu.opsu.Options;
|
||||
import itdelatrisu.opsu.Utils;
|
||||
import itdelatrisu.opsu.objects.GameObject;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
import static yugecin.opsudance.options.Options.*;
|
||||
|
||||
public class QuadraticBezierMover extends Mover {
|
||||
|
||||
public static Point p;
|
||||
@@ -34,7 +35,7 @@ public class QuadraticBezierMover extends Mover {
|
||||
}
|
||||
|
||||
public static void setPrevspeed(double distance, int timedelta) {
|
||||
prevspeed = distance * Options.getQuadBezAggressiveness() * Options.getQuadBezSliderAggressiveness() / timedelta;
|
||||
prevspeed = distance * OPTION_DANCE_QUAD_BEZ_AGGRESSIVENESS.val * OPTION_DANCE_QUAD_BEZ_SLIDER_AGGRESSIVENESS_FACTOR.val / timedelta;
|
||||
}
|
||||
|
||||
public static double getPrevspeed() {
|
||||
@@ -53,7 +54,7 @@ public class QuadraticBezierMover extends Mover {
|
||||
double dist = Utils.distance(startX, startY, endX, endY);
|
||||
p.x = (int) (startX + Math.cos(startAngle) * prevspeed);
|
||||
p.y = (int) (startY + Math.sin(startAngle) * prevspeed);
|
||||
prevspeed = (dist / totalTime) * Options.getQuadBezAggressiveness();
|
||||
prevspeed = (dist / totalTime) * OPTION_DANCE_QUAD_BEZ_AGGRESSIVENESS.val;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -17,14 +17,16 @@
|
||||
*/
|
||||
package yugecin.opsudance.movers.factories;
|
||||
|
||||
import itdelatrisu.opsu.Options;
|
||||
import itdelatrisu.opsu.Utils;
|
||||
import itdelatrisu.opsu.beatmap.HitObject;
|
||||
import itdelatrisu.opsu.objects.GameObject;
|
||||
import yugecin.opsudance.Pippi;
|
||||
import yugecin.opsudance.movers.*;
|
||||
import yugecin.opsudance.options.Options;
|
||||
import yugecin.opsudance.render.GameObjectRenderer;
|
||||
|
||||
import static yugecin.opsudance.options.Options.*;
|
||||
|
||||
public class AutoMoverFactory implements MoverFactory {
|
||||
|
||||
private int starttime;
|
||||
@@ -42,8 +44,8 @@ public class AutoMoverFactory implements MoverFactory {
|
||||
}
|
||||
|
||||
// stacked: circles if not too quick
|
||||
int circle_stream = Options.isCircleStreams() ? 58: 85;
|
||||
if (distance < GameObjectRenderer.instance.getCircleDiameter() && ((dt > circle_stream && !Options.isOnlyCircleStacks()) || distance < HitObject.getStackOffset() * 5.2f)) { // TODO get the correct multiplier for stackoffsets
|
||||
int circle_stream = OPTION_DANCE_CIRCLE_STREAMS.state ? 58: 85;
|
||||
if (distance < GameObjectRenderer.instance.getCircleDiameter() && ((dt > circle_stream && !OPTION_DANCE_ONLY_CIRCLE_STACKS.state) || distance < HitObject.getStackOffset() * 5.2f)) { // TODO get the correct multiplier for stackoffsets
|
||||
return new CircleMover(start, end, dir);
|
||||
}
|
||||
|
||||
@@ -93,16 +95,14 @@ public class AutoMoverFactory implements MoverFactory {
|
||||
}
|
||||
|
||||
@SuppressWarnings("SimplifiableIfStatement")
|
||||
protected boolean inbounds(Mover m )
|
||||
{
|
||||
protected boolean inbounds(Mover m ) {
|
||||
this.m = m;
|
||||
if (!checkBounds(m.getPointAt((int) (starttime + (endtime - starttime) * 0.3)))) return false;
|
||||
if (!checkBounds(m.getPointAt((int) (starttime + (endtime - starttime) * 0.7)))) return false;
|
||||
return checkBounds(m.getPointAt((int) (starttime + (endtime - starttime) * 0.5)));
|
||||
}
|
||||
|
||||
private boolean checkBounds( double[] pos )
|
||||
{
|
||||
private boolean checkBounds( double[] pos ) {
|
||||
return 0 < pos[0] && pos[0] < Options.width - Options.width / 8 && 0 < pos[1] && pos[1] < Options.height - Options.height / 8;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,17 +17,18 @@
|
||||
*/
|
||||
package yugecin.opsudance.movers.factories;
|
||||
|
||||
import itdelatrisu.opsu.Options;
|
||||
import itdelatrisu.opsu.objects.GameObject;
|
||||
import yugecin.opsudance.movers.CubicBezierMover;
|
||||
import yugecin.opsudance.movers.Mover;
|
||||
import yugecin.opsudance.movers.QuadraticBezierMover;
|
||||
|
||||
import static yugecin.opsudance.options.Options.*;
|
||||
|
||||
public class QuadraticBezierMoverFactory implements MoverFactory {
|
||||
|
||||
@Override
|
||||
public Mover create(GameObject start, GameObject end, int dir) {
|
||||
if (Options.isQuadBezCubicEnabled() && end.isSlider()) {
|
||||
if (OPTION_DANCE_QUAD_BEZ_USE_CUBIC_ON_SLIDERS.state && end.isSlider()) {
|
||||
return new CubicBezierMover(start, end, dir);
|
||||
}
|
||||
return new QuadraticBezierMover(start, end, dir);
|
||||
|
||||
Reference in New Issue
Block a user