got rid of dependency injection, it doesn't add anything at this point and only slows down things and makes a mess. Also some refactoring.

This commit is contained in:
yugecin
2017-05-21 11:12:55 +02:00
parent 1ebf2c2dcb
commit ec53f531c8
72 changed files with 675 additions and 929 deletions

View File

@@ -19,7 +19,8 @@ package yugecin.opsudance.movers;
import itdelatrisu.opsu.Utils;
import itdelatrisu.opsu.objects.GameObject;
import yugecin.opsudance.options.Options;
import static yugecin.opsudance.core.InstanceContainer.*;
public class CircleMover extends Mover {
@@ -63,7 +64,7 @@ public class CircleMover extends Mover {
double a = ang + SOME_CONSTANT * t;
pos[0] = (startX + (endX - startX) * t) - middlexoffset - Math.cos(a) * radius;
pos[1] = (startY + (endY - startY) * t) - middleyoffset - Math.sin(a) * radius;
if (pos[0] < 0 || Options.width < pos[0] || pos[1] < 0 || Options.height < pos[1]) {
if (pos[0] < 0 || displayContainer.width < pos[0] || pos[1] < 0 || displayContainer.height < pos[1]) {
pass = false;
break;
}

View File

@@ -18,11 +18,11 @@
package yugecin.opsudance.movers;
import itdelatrisu.opsu.objects.GameObject;
import yugecin.opsudance.options.Options;
import java.util.Random;
import static yugecin.opsudance.options.Options.*;
import static yugecin.opsudance.core.InstanceContainer.*;
public class ExgonMover extends Mover {
@@ -44,8 +44,8 @@ public class ExgonMover extends Mover {
pos[0] = endX;
pos[1] = endY;
} else {
pos[0] = randgen.nextInt(Options.width);
pos[1] = randgen.nextInt(Options.height);
pos[0] = randgen.nextInt(displayContainer.width);
pos[1] = randgen.nextInt(displayContainer.height);
}
}
return pos;

View File

@@ -22,9 +22,8 @@ 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.core.InstanceContainer.*;
import static yugecin.opsudance.options.Options.*;
public class AutoMoverFactory implements MoverFactory {
@@ -45,7 +44,7 @@ public class AutoMoverFactory implements MoverFactory {
// stacked: circles if not too quick
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
if (distance < gameObjectRenderer.circleDiameter && ((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);
}
@@ -103,7 +102,8 @@ public class AutoMoverFactory implements MoverFactory {
}
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;
return 0 < pos[0] && pos[0] < displayContainer.width - displayContainer.width / 8 &&
0 < pos[1] && pos[1] < displayContainer.height - displayContainer.height / 8;
}
@Override