Merge branch 'dancestuff' into dancesettings
This commit is contained in:
commit
1fb75c8ea2
|
@ -51,20 +51,8 @@ public class Container extends AppGameContainer {
|
|||
public Container(Game game) throws SlickException {
|
||||
super(game);
|
||||
instance = this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new container wrapping a game
|
||||
*
|
||||
* @param game The game to be wrapped
|
||||
* @param width The width of the display required
|
||||
* @param height The height of the display required
|
||||
* @param fullscreen True if we want fullscreen mode
|
||||
* @throws SlickException Indicates a failure to initialise the display
|
||||
*/
|
||||
public Container(Game game, int width, int height, boolean fullscreen) throws SlickException {
|
||||
super(game, width, height, fullscreen);
|
||||
instance = this;
|
||||
width = this.getWidth();
|
||||
height = this.getHeight();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -55,13 +55,13 @@ public class ErrorHandler {
|
|||
optionsLogReport = {"Send Report", "View Error Log", "Close"};
|
||||
|
||||
/** Text area for Exception. */
|
||||
private static final JTextArea textArea = new JTextArea(7, 30);
|
||||
private static final JTextArea textArea = new JTextArea(15, 100);
|
||||
static {
|
||||
textArea.setEditable(false);
|
||||
textArea.setBackground(UIManager.getColor("Panel.background"));
|
||||
textArea.setCursor(Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR));
|
||||
textArea.setTabSize(2);
|
||||
textArea.setLineWrap(true);
|
||||
textArea.setLineWrap(false);
|
||||
textArea.setWrapStyleWord(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -801,6 +801,9 @@ public class Options {
|
|||
/** Current screen resolution. */
|
||||
private static Resolution resolution = Resolution.RES_1024_768;
|
||||
|
||||
public static int width;
|
||||
public static int height;
|
||||
|
||||
/** The available skin directories. */
|
||||
private static String[] skinDirs;
|
||||
|
||||
|
@ -919,6 +922,9 @@ public class Options {
|
|||
ErrorHandler.error("Failed to set display mode.", e, true);
|
||||
}
|
||||
|
||||
width = resolution.width;
|
||||
height = resolution.height;
|
||||
|
||||
// set borderless window if dimensions match screen size
|
||||
boolean borderless = (screenWidth == resolution.getWidth() && screenHeight == resolution.getHeight());
|
||||
System.setProperty("org.lwjgl.opengl.Window.undecorated", Boolean.toString(borderless));
|
||||
|
|
|
@ -193,9 +193,15 @@ public class Utils {
|
|||
* @return the Euclidean distance between points (x1,y1) and (x2,y2)
|
||||
*/
|
||||
public static float distance(float x1, float y1, float x2, float y2) {
|
||||
float v1 = Math.abs(x1 - x2);
|
||||
float v2 = Math.abs(y1 - y2);
|
||||
return (float) Math.sqrt((v1 * v1) + (v2 * v2));
|
||||
float v1 = x1 - x2;
|
||||
float v2 = y1 - y2;
|
||||
return (float) Math.sqrt(v1 * v1 + v2 * v2);
|
||||
}
|
||||
|
||||
public static double distance(double x1, double y1, double x2, double y2) {
|
||||
double dx = x1 - x2;
|
||||
double dy = y1 - y2;
|
||||
return Math.sqrt(dx * dx + dy * dy);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -561,4 +567,12 @@ public class Utils {
|
|||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static int getQuadrant(double x, double y) {
|
||||
if (x < Options.width / 2d) {
|
||||
return y < Options.height / 2d ? 2 : 3;
|
||||
}
|
||||
return y < Options.height / 2d ? 1 : 4;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -36,9 +36,9 @@ import org.newdawn.slick.Graphics;
|
|||
/**
|
||||
* Data type representing a circle object.
|
||||
*/
|
||||
public class Circle implements GameObject {
|
||||
public class Circle extends GameObject {
|
||||
/** The diameter of hit circles. */
|
||||
private static float diameter;
|
||||
public static float diameter;
|
||||
|
||||
/** The associated HitObject. */
|
||||
private HitObject hitObject;
|
||||
|
@ -208,4 +208,20 @@ public class Circle implements GameObject {
|
|||
|
||||
@Override
|
||||
public void reset() {}
|
||||
|
||||
@Override
|
||||
public boolean isCircle() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSlider() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSpinner() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.newdawn.slick.Graphics;
|
|||
/**
|
||||
* Dummy hit object, used when another GameObject class cannot be created.
|
||||
*/
|
||||
public class DummyObject implements GameObject {
|
||||
public class DummyObject extends GameObject {
|
||||
/** The associated HitObject. */
|
||||
private HitObject hitObject;
|
||||
|
||||
|
@ -67,4 +67,20 @@ public class DummyObject implements GameObject {
|
|||
|
||||
@Override
|
||||
public void reset() {}
|
||||
|
||||
@Override
|
||||
public boolean isCircle() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSlider() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSpinner() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -25,13 +25,25 @@ import org.newdawn.slick.Graphics;
|
|||
/**
|
||||
* Interface for hit object types used during gameplay.
|
||||
*/
|
||||
public interface GameObject {
|
||||
public abstract class GameObject {
|
||||
|
||||
public Vec2f start;
|
||||
public Vec2f end;
|
||||
|
||||
private int time;
|
||||
|
||||
public void updateStartEndPositions(int startTime) {
|
||||
time = startTime;
|
||||
start = getPointAt(startTime);
|
||||
end = getPointAt(getEndTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws the hit object to the graphics context.
|
||||
* @param g the graphics context
|
||||
* @param trackPosition the current track position
|
||||
*/
|
||||
public void draw(Graphics g, int trackPosition);
|
||||
public abstract void draw(Graphics g, int trackPosition);
|
||||
|
||||
/**
|
||||
* Updates the hit object.
|
||||
|
@ -43,7 +55,7 @@ public interface GameObject {
|
|||
* @param trackPosition the track position
|
||||
* @return true if object ended
|
||||
*/
|
||||
public boolean update(boolean overlap, int delta, int mouseX, int mouseY, boolean keyPressed, int trackPosition);
|
||||
public abstract boolean update(boolean overlap, int delta, int mouseX, int mouseY, boolean keyPressed, int trackPosition);
|
||||
|
||||
/**
|
||||
* Processes a mouse click.
|
||||
|
@ -52,28 +64,37 @@ public interface GameObject {
|
|||
* @param trackPosition the track position
|
||||
* @return true if a hit result was processed
|
||||
*/
|
||||
public boolean mousePressed(int x, int y, int trackPosition);
|
||||
public abstract boolean mousePressed(int x, int y, int trackPosition);
|
||||
|
||||
/**
|
||||
* Returns the coordinates of the hit object at a given track position.
|
||||
* @param trackPosition the track position
|
||||
* @return the position vector
|
||||
*/
|
||||
public Vec2f getPointAt(int trackPosition);
|
||||
public abstract Vec2f getPointAt(int trackPosition);
|
||||
|
||||
public int getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the end time of the hit object.
|
||||
* @return the end time, in milliseconds
|
||||
*/
|
||||
public int getEndTime();
|
||||
public abstract int getEndTime();
|
||||
|
||||
/**
|
||||
* Updates the position of the hit object.
|
||||
*/
|
||||
public void updatePosition();
|
||||
public abstract void updatePosition();
|
||||
|
||||
/**
|
||||
* Resets all internal state so that the hit object can be reused.
|
||||
*/
|
||||
public void reset();
|
||||
public abstract void reset();
|
||||
|
||||
public abstract boolean isCircle();
|
||||
public abstract boolean isSlider();
|
||||
public abstract boolean isSpinner();
|
||||
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ import org.newdawn.slick.Image;
|
|||
/**
|
||||
* Data type representing a slider object.
|
||||
*/
|
||||
public class Slider implements GameObject {
|
||||
public class Slider extends GameObject {
|
||||
/** Slider ball frames. */
|
||||
private static Image[] sliderBallImages;
|
||||
|
||||
|
@ -582,4 +582,20 @@ public class Slider implements GameObject {
|
|||
ticksHit = 0;
|
||||
tickIntervals = 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCircle() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSlider() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSpinner() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ import org.newdawn.slick.Image;
|
|||
/**
|
||||
* Data type representing a spinner object.
|
||||
*/
|
||||
public class Spinner implements GameObject {
|
||||
public class Spinner extends GameObject {
|
||||
/** Container dimensions. */
|
||||
private static int width, height;
|
||||
|
||||
|
@ -409,4 +409,20 @@ public class Spinner implements GameObject {
|
|||
deltaOverflow = 0;
|
||||
isSpinning = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCircle() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSlider() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSpinner() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -73,6 +73,7 @@ import org.newdawn.slick.state.transition.DelayedFadeOutTransition;
|
|||
import org.newdawn.slick.state.transition.EasedFadeOutTransition;
|
||||
import org.newdawn.slick.state.transition.EmptyTransition;
|
||||
import org.newdawn.slick.state.transition.FadeInTransition;
|
||||
import yugecin.opsudance.Dancer;
|
||||
|
||||
/**
|
||||
* "Game" state.
|
||||
|
@ -341,19 +342,17 @@ public class Game extends BasicGameState {
|
|||
autoMousePosition.set(width / 2, height / 2);
|
||||
autoMousePressed = false;
|
||||
if (GameMod.AUTO.isActive() || GameMod.AUTOPILOT.isActive()) {
|
||||
Vec2f autoPoint = null;
|
||||
if (isLeadIn()) {
|
||||
// lead-in
|
||||
float progress = Math.max((float) (leadInTime - beatmap.audioLeadIn) / approachTime, 0f);
|
||||
autoMousePosition.y = height / (2f - progress);
|
||||
} else if (objectIndex == 0 && trackPosition < firstObjectTime) {
|
||||
// before first object
|
||||
timeDiff = firstObjectTime - trackPosition;
|
||||
if (timeDiff < approachTime) {
|
||||
Vec2f point = gameObjects[0].getPointAt(trackPosition);
|
||||
autoPoint = getPointAt(autoMousePosition.x, autoMousePosition.y, point.x, point.y, 1f - ((float) timeDiff / approachTime));
|
||||
Vec2f autoPoint;
|
||||
if (objectIndex == 0) {
|
||||
autoPoint = gameObjects[0].getPointAt(trackPosition);
|
||||
} else if (objectIndex < beatmap.objects.length - 1) {
|
||||
Dancer d = Dancer.instance;
|
||||
d.update(trackPosition, gameObjects[objectIndex - 1], gameObjects[objectIndex]);
|
||||
autoPoint = new Vec2f(d.x, d.y);
|
||||
if (trackPosition < gameObjects[objectIndex].getTime()) {
|
||||
autoMousePressed = true;
|
||||
}
|
||||
} else if (objectIndex < beatmap.objects.length) {
|
||||
/*
|
||||
// normal object
|
||||
int objectTime = beatmap.objects[objectIndex].getTime();
|
||||
if (trackPosition < objectTime) {
|
||||
|
@ -386,14 +385,14 @@ public class Game extends BasicGameState {
|
|||
autoPoint = gameObjects[objectIndex].getPointAt(trackPosition);
|
||||
autoMousePressed = true;
|
||||
}
|
||||
*/
|
||||
} else {
|
||||
// last object
|
||||
autoPoint = gameObjects[objectIndex - 1].getPointAt(trackPosition);
|
||||
}
|
||||
|
||||
// set mouse coordinates
|
||||
if (autoPoint != null)
|
||||
autoMousePosition.set(autoPoint.x, autoPoint.y);
|
||||
autoMousePosition.set(autoPoint.x, autoPoint.y);
|
||||
}
|
||||
|
||||
// "flashlight" mod: restricted view of hit objects around cursor
|
||||
|
@ -1139,6 +1138,8 @@ public class Game extends BasicGameState {
|
|||
if (beatmap == null || beatmap.objects == null)
|
||||
throw new RuntimeException("Running game with no beatmap loaded.");
|
||||
|
||||
Dancer.instance.init(beatmap.getTitle());
|
||||
|
||||
// free all previously cached hitobject to framebuffer mappings if some still exist
|
||||
FrameBufferCache.getInstance().freeMap();
|
||||
|
||||
|
@ -1216,7 +1217,6 @@ public class Game extends BasicGameState {
|
|||
ErrorHandler.error(String.format("Failed to create %s at index %d:\n%s",
|
||||
hitObject.getTypeName(), i, hitObject.toString()), e, true);
|
||||
gameObjects[i] = new DummyObject(hitObject);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1267,6 +1267,10 @@ public class Game extends BasicGameState {
|
|||
replayFrames.add(new ReplayFrame(0, 0, input.getMouseX(), input.getMouseY(), 0));
|
||||
}
|
||||
|
||||
for (int i = 0; i < gameObjects.length; i++) {
|
||||
gameObjects[i].updateStartEndPositions(beatmap.objects[i].getTime());
|
||||
}
|
||||
|
||||
leadInTime = beatmap.audioLeadIn + approachTime;
|
||||
restart = Restart.FALSE;
|
||||
|
||||
|
@ -1756,22 +1760,6 @@ public class Game extends BasicGameState {
|
|||
return frame;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the point at the t value between a start and end point.
|
||||
* @param startX the starting x coordinate
|
||||
* @param startY the starting y coordinate
|
||||
* @param endX the ending x coordinate
|
||||
* @param endY the ending y coordinate
|
||||
* @param t the t value [0, 1]
|
||||
* @return the position vector
|
||||
*/
|
||||
private Vec2f getPointAt(float startX, float startY, float endX, float endY, float t) {
|
||||
// "autopilot" mod: move quicker between objects
|
||||
if (GameMod.AUTOPILOT.isActive())
|
||||
t = Utils.clamp(t * 2f, 0f, 1f);
|
||||
return new Vec2f(startX + (endX - startX) * t, startY + (endY - startY) * t);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the current visible area radius (if the "flashlight" mod is enabled).
|
||||
* @param delta the delta interval
|
||||
|
|
111
src/yugecin/opsudance/Dancer.java
Normal file
111
src/yugecin/opsudance/Dancer.java
Normal file
|
@ -0,0 +1,111 @@
|
|||
/*
|
||||
* opsu!dance - fork of opsu! with cursordance auto
|
||||
* Copyright (C) 2016 yugecin
|
||||
*
|
||||
* opsu!dance is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* opsu! is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with opsu!dance. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package yugecin.opsudance;
|
||||
|
||||
import itdelatrisu.opsu.Options;
|
||||
import itdelatrisu.opsu.Utils;
|
||||
import itdelatrisu.opsu.objects.GameObject;
|
||||
import itdelatrisu.opsu.objects.curves.Vec2f;
|
||||
import yugecin.opsudance.movers.Mover;
|
||||
import yugecin.opsudance.movers.factories.*;
|
||||
import yugecin.opsudance.spinners.RektSpinner;
|
||||
import yugecin.opsudance.spinners.Spinner;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class Dancer {
|
||||
|
||||
public static MoverFactory[] moverFactories = new MoverFactory[] {
|
||||
new AutoMoverFactory(),
|
||||
new AutoEllipseMoverFactory(),
|
||||
new CircleMoverFactory(),
|
||||
new HalfCircleMoverFactory(),
|
||||
new HalfEllipseMoverFactory(),
|
||||
new HalfLowEllipseMoverFactory(),
|
||||
new JumpMoverFactory(),
|
||||
new LinearMoverFactory(),
|
||||
new QuartCircleMoverFactory()
|
||||
};
|
||||
|
||||
public static Spinner[] spinners = new Spinner[] {
|
||||
new RektSpinner()
|
||||
};
|
||||
|
||||
public static Dancer instance = new Dancer();
|
||||
|
||||
private int dir;
|
||||
private GameObject p;
|
||||
private Random rand;
|
||||
|
||||
private MoverFactory moverFactory;
|
||||
private Mover mover;
|
||||
private Spinner spinner;
|
||||
|
||||
public float x;
|
||||
public float y;
|
||||
|
||||
public Dancer() {
|
||||
moverFactory = moverFactories[0];
|
||||
spinner = spinners[0];
|
||||
}
|
||||
|
||||
public void init(String mapname) {
|
||||
p = null;
|
||||
rand = new Random(mapname.hashCode());
|
||||
dir = 1;
|
||||
for (Spinner s : spinners) {
|
||||
s.init();
|
||||
}
|
||||
}
|
||||
|
||||
public void update(int time, GameObject p, GameObject c) {
|
||||
if (this.p != p) {
|
||||
this.p = p;
|
||||
if (rand.nextInt(2) == 1) {
|
||||
dir *= -1;
|
||||
}
|
||||
if (c.isSpinner()) {
|
||||
double[] spinnerStartPoint = spinner.getPoint();
|
||||
c.start = new Vec2f((float) spinnerStartPoint[0], (float) spinnerStartPoint[1]);
|
||||
}
|
||||
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];
|
||||
}
|
||||
x = Utils.clamp(x, 10, Options.width - 10);
|
||||
y = Utils.clamp(y, 10, Options.height - 10);
|
||||
} else {
|
||||
if (c.isSpinner()) {
|
||||
double[] point = spinner.getPoint();
|
||||
x = (float) point[0];
|
||||
y = (float) point[1];
|
||||
c.end = new Vec2f(x, y);
|
||||
} else {
|
||||
Vec2f point = c.getPointAt(time);
|
||||
x = point.x;
|
||||
y = point.y;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
93
src/yugecin/opsudance/movers/CircleMover.java
Normal file
93
src/yugecin/opsudance/movers/CircleMover.java
Normal file
|
@ -0,0 +1,93 @@
|
|||
/*
|
||||
* opsu!dance - fork of opsu! with cursordance auto
|
||||
* Copyright (C) 2016 yugecin
|
||||
*
|
||||
* opsu!dance is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* opsu! is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with opsu!dance. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package yugecin.opsudance.movers;
|
||||
|
||||
import itdelatrisu.opsu.Options;
|
||||
import itdelatrisu.opsu.Utils;
|
||||
import itdelatrisu.opsu.objects.GameObject;
|
||||
|
||||
public class CircleMover extends Mover {
|
||||
|
||||
private double radius;
|
||||
private double SOME_CONSTANT;
|
||||
private double middlexoffset;
|
||||
private double middleyoffset;
|
||||
private double ang;
|
||||
|
||||
public CircleMover(GameObject start, GameObject end, int dir) {
|
||||
super(start, end, dir);
|
||||
if (startX - endX == 0 && startY - endY == 0) {
|
||||
int quadr = Utils.getQuadrant(startX, startY);
|
||||
switch (quadr) {
|
||||
case 1: ang = 135d / 180d * Math.PI; break;
|
||||
case 2: ang = 45d / 180d * Math.PI; break;
|
||||
case 3: ang = -45d / 180d * Math.PI; break;
|
||||
case 4: ang = -135d / 180d * Math.PI; break;
|
||||
}
|
||||
} else {
|
||||
ang = Math.atan2(startY - endY, startX - endX);
|
||||
}
|
||||
SOME_CONSTANT = dir * 2d * Math.PI;
|
||||
// TODO: circle into slider?
|
||||
radius = end.getTime() - start.getEndTime();
|
||||
if (start.isSpinner() || end.isSpinner()) {
|
||||
middlexoffset = -Math.cos(ang) * radius;
|
||||
middleyoffset = -Math.sin(ang) * radius;
|
||||
} else {
|
||||
calcMaxRadius();
|
||||
}
|
||||
}
|
||||
|
||||
private void calcMaxRadius() {
|
||||
double[] pos = new double[2];
|
||||
for (int tries = 0; tries < 7; tries++) {
|
||||
middlexoffset = -Math.cos(ang) * radius;
|
||||
middleyoffset = -Math.sin(ang) * radius;
|
||||
boolean pass = true;
|
||||
for (double t = 0d; t < 1d; t += 0.1d) {
|
||||
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]) {
|
||||
pass = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (pass) {
|
||||
return;
|
||||
}
|
||||
radius *= 0.8d;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double[] getPointAt(int time) {
|
||||
double t = getT(time);
|
||||
double ang = this.ang + SOME_CONSTANT * t;
|
||||
return new double[] {
|
||||
(startX + (endX - startX) * t) - middlexoffset - Math.cos(ang) * radius,
|
||||
(startY + (endY - startY) * t) - middleyoffset - Math.sin(ang) * radius
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Circle";
|
||||
}
|
||||
|
||||
}
|
52
src/yugecin/opsudance/movers/HalfCircleMover.java
Normal file
52
src/yugecin/opsudance/movers/HalfCircleMover.java
Normal file
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* opsu!dance - fork of opsu! with cursordance auto
|
||||
* Copyright (C) 2016 yugecin
|
||||
*
|
||||
* opsu!dance is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* opsu! is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with opsu!dance. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package yugecin.opsudance.movers;
|
||||
|
||||
import itdelatrisu.opsu.Utils;
|
||||
import itdelatrisu.opsu.objects.GameObject;
|
||||
|
||||
public class HalfCircleMover extends Mover {
|
||||
|
||||
private double middlex;
|
||||
private double middley;
|
||||
private double radius;
|
||||
private double ang;
|
||||
|
||||
public HalfCircleMover(GameObject start, GameObject end, int dir) {
|
||||
super(start, end, dir);
|
||||
middlex = (startX + endX) / 2d;
|
||||
middley = (startY + endY) / 2d;
|
||||
radius = Utils.distance(middlex, middley, startX, startY);
|
||||
ang = Math.atan2(startY - middley, startX - middlex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double[] getPointAt(int time) {
|
||||
double ang = this.ang + Math.PI * getT(time) * dir;
|
||||
return new double[] {
|
||||
middlex + Math.cos(ang) * radius,
|
||||
middley + Math.sin(ang) * radius
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Half circle";
|
||||
}
|
||||
|
||||
}
|
67
src/yugecin/opsudance/movers/HalfEllipseMover.java
Normal file
67
src/yugecin/opsudance/movers/HalfEllipseMover.java
Normal file
|
@ -0,0 +1,67 @@
|
|||
/*
|
||||
* opsu!dance - fork of opsu! with cursordance auto
|
||||
* Copyright (C) 2016 yugecin
|
||||
*
|
||||
* opsu!dance is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* opsu! is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with opsu!dance. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package yugecin.opsudance.movers;
|
||||
|
||||
import itdelatrisu.opsu.Utils;
|
||||
import itdelatrisu.opsu.objects.GameObject;
|
||||
|
||||
public class HalfEllipseMover extends Mover {
|
||||
|
||||
private double middlex;
|
||||
private double middley;
|
||||
private double radius;
|
||||
private double ang;
|
||||
private double mod;
|
||||
|
||||
public HalfEllipseMover(GameObject start, GameObject end, int dir) {
|
||||
super(start, end, dir);
|
||||
middlex = (startX - endX) / 2d;
|
||||
middley = (startY - endY) / 2d;
|
||||
radius = Utils.distance(middlex, middley, startX, startY);
|
||||
ang = Math.atan2(startY - middley, startX - middlex);
|
||||
mod = 2d;
|
||||
}
|
||||
|
||||
public void setMod(double mod) {
|
||||
this.mod = mod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double[] getPointAt(int time) {
|
||||
double Tangle = Math.PI * getT(time) * dir;
|
||||
double x = middlex + Math.cos(Tangle) * radius;
|
||||
double y = middley + Math.sin(Tangle) * radius;
|
||||
double dx = middlex - x;
|
||||
double dy = middley - y;
|
||||
|
||||
double d = Math.sqrt(dx * dx + dy * dy);
|
||||
double a = Math.atan2(dy, dx);
|
||||
double my = a - ang;
|
||||
|
||||
return new double[] {
|
||||
middlex - Math.cos(my) * d,
|
||||
middley - Math.sin(my) * d
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Half ellipse " + mod;
|
||||
}
|
||||
|
||||
}
|
44
src/yugecin/opsudance/movers/JumpMover.java
Normal file
44
src/yugecin/opsudance/movers/JumpMover.java
Normal file
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* opsu!dance - fork of opsu! with cursordance auto
|
||||
* Copyright (C) 2016 yugecin
|
||||
*
|
||||
* opsu!dance is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* opsu! is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with opsu!dance. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package yugecin.opsudance.movers;
|
||||
|
||||
import itdelatrisu.opsu.objects.GameObject;
|
||||
|
||||
public class JumpMover extends Mover {
|
||||
|
||||
private double[] pos;
|
||||
|
||||
public JumpMover(GameObject start, GameObject end, int dir) {
|
||||
super(start, end, dir);
|
||||
this.pos = new double[] {
|
||||
end.start.x,
|
||||
end.start.y
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public double[] getPointAt(int time) {
|
||||
return pos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Jump";
|
||||
}
|
||||
|
||||
}
|
42
src/yugecin/opsudance/movers/LinearMover.java
Normal file
42
src/yugecin/opsudance/movers/LinearMover.java
Normal file
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* opsu!dance - fork of opsu! with cursordance auto
|
||||
* Copyright (C) 2016 yugecin
|
||||
*
|
||||
* opsu!dance is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* opsu! is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with opsu!dance. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package yugecin.opsudance.movers;
|
||||
|
||||
import itdelatrisu.opsu.objects.GameObject;
|
||||
|
||||
public class LinearMover extends Mover {
|
||||
|
||||
public LinearMover(GameObject start, GameObject end, int dir) {
|
||||
super(start, end, dir);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double[] getPointAt(int time) {
|
||||
double t = getT(time);
|
||||
return new double[] {
|
||||
startX + (endX - startX) * t,
|
||||
startY + (endY - startY) * t
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Linear";
|
||||
}
|
||||
|
||||
}
|
52
src/yugecin/opsudance/movers/Mover.java
Normal file
52
src/yugecin/opsudance/movers/Mover.java
Normal file
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* opsu!dance - fork of opsu! with cursordance auto
|
||||
* Copyright (C) 2016 yugecin
|
||||
*
|
||||
* opsu!dance is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* opsu! is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with opsu!dance. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package yugecin.opsudance.movers;
|
||||
|
||||
import itdelatrisu.opsu.objects.GameObject;
|
||||
|
||||
public abstract class Mover {
|
||||
|
||||
protected int dir;
|
||||
|
||||
private int startT;
|
||||
private int totalT;
|
||||
|
||||
protected double startX;
|
||||
protected double startY;
|
||||
|
||||
protected double endX;
|
||||
protected double endY;
|
||||
|
||||
public Mover(GameObject start, GameObject end, int dir) {
|
||||
this.dir = dir;
|
||||
this.startX = start.end.x;
|
||||
this.startY = start.end.y;
|
||||
this.endX = end.start.x;
|
||||
this.endY = end.start.y;
|
||||
this.startT = start.getEndTime();
|
||||
this.totalT = end.getTime() - startT;
|
||||
}
|
||||
|
||||
protected final double getT(int time) {
|
||||
return ((double) time - startT) / totalT;
|
||||
}
|
||||
|
||||
public abstract double[] getPointAt(int time);
|
||||
public abstract String getName();
|
||||
|
||||
}
|
57
src/yugecin/opsudance/movers/QuartCircleMover.java
Normal file
57
src/yugecin/opsudance/movers/QuartCircleMover.java
Normal file
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
* opsu!dance - fork of opsu! with cursordance auto
|
||||
* Copyright (C) 2016 yugecin
|
||||
*
|
||||
* opsu!dance is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* opsu! is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with opsu!dance. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package yugecin.opsudance.movers;
|
||||
|
||||
import itdelatrisu.opsu.Utils;
|
||||
import itdelatrisu.opsu.objects.GameObject;
|
||||
|
||||
public class QuartCircleMover extends Mover {
|
||||
|
||||
private double middlex;
|
||||
private double middley;
|
||||
private double radius;
|
||||
private double ang;
|
||||
|
||||
public QuartCircleMover(GameObject start, GameObject end, int dir) {
|
||||
super(start, end, dir);
|
||||
middlex = (startX - endX) / 2d;
|
||||
middley = (startY - endY) / 2d;
|
||||
radius = Utils.distance(middlex, middley, startX, startY);
|
||||
ang = Math.atan2(startY - middley, startX - middlex) + Math.PI / 2d * dir;
|
||||
middlex = middlex + Math.cos(ang) * radius;
|
||||
middley = middley + Math.sin(ang) * radius;
|
||||
radius = Utils.distance(middlex, middley, startX, startY);
|
||||
ang = Math.atan2(startY - middley, startX - middlex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double[] getPointAt(int time) {
|
||||
double ang = this.ang - Math.PI / 2d * getT(time) * dir;
|
||||
|
||||
return new double[] {
|
||||
middlex + Math.cos(ang) * radius,
|
||||
middlex + Math.sin(ang) * radius
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "1/4th circle";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* opsu!dance - fork of opsu! with cursordance auto
|
||||
* Copyright (C) 2016 yugecin
|
||||
*
|
||||
* opsu!dance is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* opsu! is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with opsu!dance. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package yugecin.opsudance.movers.factories;
|
||||
|
||||
import itdelatrisu.opsu.objects.GameObject;
|
||||
import yugecin.opsudance.movers.HalfEllipseMover;
|
||||
import yugecin.opsudance.movers.Mover;
|
||||
|
||||
public class AutoEllipseMoverFactory extends AutoMoverFactory {
|
||||
|
||||
@Override
|
||||
protected Mover donext(GameObject start, GameObject end, int dir, int dt, double velocity) {
|
||||
float mod = (float)dt / /*110f*/ 90f;
|
||||
HalfEllipseMover m1 = new HalfEllipseMover(start, end, dir);
|
||||
HalfEllipseMover m2 = new HalfEllipseMover(start, end, -dir);
|
||||
for( ; ; )
|
||||
{
|
||||
m1.setMod( mod );
|
||||
m2.setMod( mod );
|
||||
if( inbounds( m1 ) )
|
||||
{
|
||||
super.m = m1;
|
||||
break;
|
||||
}
|
||||
if( inbounds( m2 ) )
|
||||
{
|
||||
super.m = m2;
|
||||
break;
|
||||
}
|
||||
mod *= .8d;
|
||||
}
|
||||
return super.m;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Auto ellipse";
|
||||
}
|
||||
|
||||
}
|
113
src/yugecin/opsudance/movers/factories/AutoMoverFactory.java
Normal file
113
src/yugecin/opsudance/movers/factories/AutoMoverFactory.java
Normal file
|
@ -0,0 +1,113 @@
|
|||
/*
|
||||
* opsu!dance - fork of opsu! with cursordance auto
|
||||
* Copyright (C) 2016 yugecin
|
||||
*
|
||||
* opsu!dance is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* opsu! is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with opsu!dance. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package yugecin.opsudance.movers.factories;
|
||||
|
||||
import itdelatrisu.opsu.Options;
|
||||
import itdelatrisu.opsu.Utils;
|
||||
import itdelatrisu.opsu.beatmap.HitObject;
|
||||
import itdelatrisu.opsu.objects.Circle;
|
||||
import itdelatrisu.opsu.objects.GameObject;
|
||||
import yugecin.opsudance.movers.*;
|
||||
|
||||
public class AutoMoverFactory implements MoverFactory {
|
||||
|
||||
public static boolean ONLY_CIRCLE_STACKS = false;
|
||||
public static int CIRCLE_STREAM = 58;
|
||||
private int endtime;
|
||||
protected Mover m;
|
||||
|
||||
@Override
|
||||
public Mover create(GameObject start, GameObject end, int dir) {
|
||||
int dt = end.getTime() - start.getEndTime();
|
||||
double distance = Utils.distance(start.end.x, start.end.y, end.start.x, end.start.y);
|
||||
|
||||
// linear if very fast
|
||||
if (dt < 40) {
|
||||
return new LinearMover(start, end, dir);
|
||||
}
|
||||
|
||||
// stacked: circles if not too quick
|
||||
if (distance < Circle.diameter && ((dt > CIRCLE_STREAM && !ONLY_CIRCLE_STACKS) || distance < HitObject.getStackOffset() * 1.1f)) {
|
||||
return new CircleMover(start, end, dir);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
// TODO streams: linear if pippi+preventwobblystreams
|
||||
if (distance < Circle.diameter * 1.7f && pippi && pippipreventwobblystreams) {
|
||||
return new LinearMover(start, end, dir);
|
||||
}
|
||||
*/
|
||||
|
||||
endtime = end.getTime();
|
||||
|
||||
double velocity = distance / dt;
|
||||
return donext(start, end, dir, dt, velocity);
|
||||
}
|
||||
|
||||
protected Mover donext(GameObject start, GameObject end, int dir, int dt, double velocity) {
|
||||
if( velocity < 4d )
|
||||
{
|
||||
// ellips, if in bounds
|
||||
if( inbounds( new HalfEllipseMover( start, end, dir ) ) ) return m;
|
||||
if( inbounds( new HalfEllipseMover( start, end, -dir ) ) ) return m;
|
||||
}
|
||||
|
||||
if( velocity < 5.5d )
|
||||
{
|
||||
// halfcircle, if in bounds
|
||||
if( inbounds( new HalfCircleMover( start, end, dir ) ) ) return m;
|
||||
if( inbounds( new HalfCircleMover( start, end, -dir ) ) ) return m;
|
||||
}
|
||||
|
||||
if( velocity < 7d )
|
||||
{
|
||||
// halfellips with 0.5 modifier
|
||||
HalfEllipseMover m;
|
||||
m = new HalfEllipseMover(start, end, dir);
|
||||
m.setMod(0.5d);
|
||||
if( inbounds(m) ) return m;
|
||||
m = new HalfEllipseMover(start, end, -dir);
|
||||
m.setMod(0.5d);
|
||||
if( inbounds(m) ) return m;
|
||||
}
|
||||
|
||||
// quart circle
|
||||
Mover last = new QuartCircleMover( start, end, dir );
|
||||
if( inbounds( last ) ) return m;
|
||||
if( inbounds( new QuartCircleMover( start, end, -dir ) ) ) return m;
|
||||
return last;
|
||||
}
|
||||
|
||||
protected boolean inbounds( Mover m )
|
||||
{
|
||||
this.m = m;
|
||||
return checkBounds(m.getPointAt(endtime));
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Auto";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* opsu!dance - fork of opsu! with cursordance auto
|
||||
* Copyright (C) 2016 yugecin
|
||||
*
|
||||
* opsu!dance is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* opsu! is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with opsu!dance. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package yugecin.opsudance.movers.factories;
|
||||
|
||||
import itdelatrisu.opsu.objects.GameObject;
|
||||
import yugecin.opsudance.movers.CircleMover;
|
||||
import yugecin.opsudance.movers.Mover;
|
||||
|
||||
public class CircleMoverFactory implements MoverFactory {
|
||||
|
||||
@Override
|
||||
public Mover create(GameObject start, GameObject end, int dir) {
|
||||
return new CircleMover(start, end, dir);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Circle";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* opsu!dance - fork of opsu! with cursordance auto
|
||||
* Copyright (C) 2016 yugecin
|
||||
*
|
||||
* opsu!dance is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* opsu! is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with opsu!dance. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package yugecin.opsudance.movers.factories;
|
||||
|
||||
import itdelatrisu.opsu.objects.GameObject;
|
||||
import yugecin.opsudance.movers.HalfCircleMover;
|
||||
import yugecin.opsudance.movers.Mover;
|
||||
|
||||
public class HalfCircleMoverFactory implements MoverFactory {
|
||||
|
||||
@Override
|
||||
public Mover create(GameObject start, GameObject end, int dir) {
|
||||
return new HalfCircleMover(start, end, dir);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Half circle";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* opsu!dance - fork of opsu! with cursordance auto
|
||||
* Copyright (C) 2016 yugecin
|
||||
*
|
||||
* opsu!dance is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* opsu! is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with opsu!dance. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package yugecin.opsudance.movers.factories;
|
||||
|
||||
import itdelatrisu.opsu.objects.GameObject;
|
||||
import yugecin.opsudance.movers.HalfEllipseMover;
|
||||
import yugecin.opsudance.movers.Mover;
|
||||
|
||||
public class HalfEllipseMoverFactory implements MoverFactory {
|
||||
|
||||
@Override
|
||||
public Mover create(GameObject start, GameObject end, int dir) {
|
||||
return new HalfEllipseMover(start, end, dir);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Half ellipse";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* opsu!dance - fork of opsu! with cursordance auto
|
||||
* Copyright (C) 2016 yugecin
|
||||
*
|
||||
* opsu!dance is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* opsu! is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with opsu!dance. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package yugecin.opsudance.movers.factories;
|
||||
|
||||
import itdelatrisu.opsu.objects.GameObject;
|
||||
import yugecin.opsudance.movers.HalfEllipseMover;
|
||||
import yugecin.opsudance.movers.Mover;
|
||||
|
||||
public class HalfLowEllipseMoverFactory implements MoverFactory {
|
||||
|
||||
@Override
|
||||
public Mover create(GameObject start, GameObject end, int dir) {
|
||||
HalfEllipseMover m = new HalfEllipseMover(start, end, dir);
|
||||
m.setMod(0.5d);
|
||||
return m;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Half low ellipse";
|
||||
}
|
||||
|
||||
}
|
36
src/yugecin/opsudance/movers/factories/JumpMoverFactory.java
Normal file
36
src/yugecin/opsudance/movers/factories/JumpMoverFactory.java
Normal file
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* opsu!dance - fork of opsu! with cursordance auto
|
||||
* Copyright (C) 2016 yugecin
|
||||
*
|
||||
* opsu!dance is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* opsu! is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with opsu!dance. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package yugecin.opsudance.movers.factories;
|
||||
|
||||
import itdelatrisu.opsu.objects.GameObject;
|
||||
import yugecin.opsudance.movers.JumpMover;
|
||||
import yugecin.opsudance.movers.Mover;
|
||||
|
||||
public class JumpMoverFactory implements MoverFactory {
|
||||
|
||||
@Override
|
||||
public Mover create(GameObject start, GameObject end, int dir) {
|
||||
return new JumpMover(start, end, dir);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Jump";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* opsu!dance - fork of opsu! with cursordance auto
|
||||
* Copyright (C) 2016 yugecin
|
||||
*
|
||||
* opsu!dance is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* opsu! is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with opsu!dance. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package yugecin.opsudance.movers.factories;
|
||||
|
||||
import itdelatrisu.opsu.objects.GameObject;
|
||||
import yugecin.opsudance.movers.LinearMover;
|
||||
import yugecin.opsudance.movers.Mover;
|
||||
|
||||
public class LinearMoverFactory implements MoverFactory {
|
||||
|
||||
@Override
|
||||
public Mover create(GameObject start, GameObject end, int dir) {
|
||||
return new LinearMover(start, end, dir);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Linear";
|
||||
}
|
||||
|
||||
}
|
27
src/yugecin/opsudance/movers/factories/MoverFactory.java
Normal file
27
src/yugecin/opsudance/movers/factories/MoverFactory.java
Normal file
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* opsu!dance - fork of opsu! with cursordance auto
|
||||
* Copyright (C) 2016 yugecin
|
||||
*
|
||||
* opsu!dance is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* opsu! is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with opsu!dance. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package yugecin.opsudance.movers.factories;
|
||||
|
||||
import itdelatrisu.opsu.objects.GameObject;
|
||||
import yugecin.opsudance.movers.Mover;
|
||||
|
||||
public interface MoverFactory {
|
||||
|
||||
Mover create(GameObject start, GameObject end, int dir);
|
||||
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* opsu!dance - fork of opsu! with cursordance auto
|
||||
* Copyright (C) 2016 yugecin
|
||||
*
|
||||
* opsu!dance is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* opsu! is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with opsu!dance. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package yugecin.opsudance.movers.factories;
|
||||
|
||||
import itdelatrisu.opsu.objects.GameObject;
|
||||
import yugecin.opsudance.movers.Mover;
|
||||
import yugecin.opsudance.movers.QuartCircleMover;
|
||||
|
||||
public class QuartCircleMoverFactory implements MoverFactory {
|
||||
|
||||
@Override
|
||||
public Mover create(GameObject start, GameObject end, int dir) {
|
||||
return new QuartCircleMover(start, end, dir);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "1/4th circle";
|
||||
}
|
||||
|
||||
}
|
36
src/yugecin/opsudance/spinners/RektSpinner.java
Normal file
36
src/yugecin/opsudance/spinners/RektSpinner.java
Normal file
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* opsu!dance - fork of opsu! with cursordance auto
|
||||
* Copyright (C) 2016 yugecin
|
||||
*
|
||||
* opsu!dance is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* opsu! is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with opsu!dance. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package yugecin.opsudance.spinners;
|
||||
|
||||
import itdelatrisu.opsu.Options;
|
||||
|
||||
public class RektSpinner extends Spinner {
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
init(new double[][] {
|
||||
{ 10, 10 },
|
||||
{ Options.width / 2d, 10 },
|
||||
{ Options.width - 10, 10 },
|
||||
{ Options.width - 10, Options.height - 10 },
|
||||
{ Options.width / 2d, Options.height - 10 },
|
||||
{ 10, Options.height - 10 }
|
||||
});
|
||||
}
|
||||
|
||||
}
|
43
src/yugecin/opsudance/spinners/Spinner.java
Normal file
43
src/yugecin/opsudance/spinners/Spinner.java
Normal file
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* opsu!dance - fork of opsu! with cursordance auto
|
||||
* Copyright (C) 2016 yugecin
|
||||
*
|
||||
* opsu!dance is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* opsu! is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with opsu!dance. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package yugecin.opsudance.spinners;
|
||||
|
||||
public abstract class Spinner {
|
||||
|
||||
private double[][] points;
|
||||
private int length;
|
||||
private int index;
|
||||
private int delay;
|
||||
public static int DELAY = 3;
|
||||
|
||||
public abstract void init();
|
||||
|
||||
protected final void init(double[][] points) {
|
||||
this.points = points;
|
||||
this.length = points.length;
|
||||
}
|
||||
|
||||
public double[] getPoint() {
|
||||
if (++delay > DELAY) {
|
||||
delay = 0;
|
||||
index = ++index % length;
|
||||
}
|
||||
return points[index];
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user