Merge branch 'dancesettings'
This commit is contained in:
commit
6e67bf8ca4
|
@ -54,6 +54,8 @@ import org.newdawn.slick.util.ResourceLoader;
|
|||
import com.sun.jna.platform.win32.Advapi32Util;
|
||||
import com.sun.jna.platform.win32.Win32Exception;
|
||||
import com.sun.jna.platform.win32.WinReg;
|
||||
import yugecin.opsudance.Dancer;
|
||||
import yugecin.opsudance.movers.factories.AutoMoverFactory;
|
||||
|
||||
/**
|
||||
* Handles all user options.
|
||||
|
@ -535,7 +537,134 @@ public class Options {
|
|||
ENABLE_THEME_SONG ("Enable Theme Song", "MenuMusic", "Whether to play the theme song upon starting opsu!", true),
|
||||
REPLAY_SEEKING ("Replay Seeking", "ReplaySeeking", "Enable a seeking bar on the left side of the screen during replays.", 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 ("Mover algorithm", "Mover", "Algorithm that decides how to move from note to note" ) {
|
||||
@Override
|
||||
public Object[] getListItems() {
|
||||
return Dancer.moverFactories;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clickListItem(int index) {
|
||||
Dancer.instance.setMoverFactoryIndex(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValueString() {
|
||||
return Dancer.moverFactories[Dancer.instance.getMoverFactoryIndex()].toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String write() {
|
||||
return Dancer.instance.getMoverFactoryIndex() + "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(String s) {
|
||||
Dancer.instance.setMoverFactoryIndex(Integer.parseInt(s));
|
||||
}
|
||||
},
|
||||
|
||||
DANCE_SPINNER ("Spinner", "Spinner", "Spinner style") {
|
||||
@Override
|
||||
public Object[] getListItems() {
|
||||
return Dancer.spinners;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clickListItem(int index) {
|
||||
Dancer.instance.setSpinnerIndex(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValueString() {
|
||||
return Dancer.spinners[Dancer.instance.getSpinnerIndex()].toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String write() {
|
||||
return Dancer.instance.getSpinnerIndex() + "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(String s) {
|
||||
Dancer.instance.setSpinnerIndex(Integer.parseInt(s));
|
||||
}
|
||||
},
|
||||
|
||||
DANCE_LAZY_SLIDERS ("Lazy sliders", "LazySliders", "Don't do short sliders", true) {
|
||||
@Override
|
||||
public void click(GameContainer container) {
|
||||
bool = !bool;
|
||||
Dancer.LAZY_SLIDERS = bool;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(String s) {
|
||||
super.read(s);
|
||||
Dancer.LAZY_SLIDERS = bool;
|
||||
}
|
||||
},
|
||||
|
||||
DANCE_ONLY_CIRCLE_STACKS ("Only circle stacks", "CircleStacks", "Only do circle movement on stacks", true) {
|
||||
@Override
|
||||
public void click(GameContainer container) {
|
||||
bool = !bool;
|
||||
AutoMoverFactory.ONLY_CIRCLE_STACKS = bool;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(String s) {
|
||||
super.read(s);
|
||||
AutoMoverFactory.ONLY_CIRCLE_STACKS = bool;
|
||||
}
|
||||
},
|
||||
|
||||
DANCE_CIRCLE_STREAMS ("Circle streams", "CircleStreams", "Make circles while streaming", false) {
|
||||
@Override
|
||||
public void click(GameContainer container) {
|
||||
bool = !bool;
|
||||
AutoMoverFactory.CIRCLE_STREAM = bool ? 58 : 85;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(String s) {
|
||||
super.read(s);
|
||||
AutoMoverFactory.CIRCLE_STREAM = bool ? 58 : 85;
|
||||
}
|
||||
},
|
||||
|
||||
PIPPI_ENABLE ("Pippi", "Pippi", "Move in circles like dancing pippi (osu! april fools joke 2016)", false) {
|
||||
// TODO
|
||||
},
|
||||
|
||||
PIPPI_ANGLE_INC_MUL("Pippi angle increment multiplier", "PippiAngIncMul", "How fast pippi's angle increments", 1, -20, 20) {
|
||||
// TODO
|
||||
|
||||
@Override
|
||||
public String getValueString() {
|
||||
return "x" + val;
|
||||
}
|
||||
},
|
||||
|
||||
PIPPI_ANGLE_INC_MUL_SLIDER ("Pippi angle increment multiplier slider", "PippiAngIncMulSlider", "Same as above, but in sliders", 5, -20, 20) {
|
||||
// TODO
|
||||
|
||||
@Override
|
||||
public String getValueString() {
|
||||
return "x" + val;
|
||||
}
|
||||
},
|
||||
|
||||
PIPPI_SLIDER_FOLLOW_EXPAND ("Followcircle expand", "PippiFollowExpand", "Increase radius in followcircles", true) {
|
||||
// TODO
|
||||
},
|
||||
|
||||
PIPPI_PREVENT_WOBBLY_STREAMS ("Prevent wobbly streams", "PippiPreventWobblyStreams", "Force linear mover while doing streams to prevent wobbly pippi", true) {
|
||||
// TODO
|
||||
};
|
||||
|
||||
|
||||
/** Option name. */
|
||||
private final String name;
|
||||
|
@ -686,7 +815,7 @@ public class Options {
|
|||
* Fired when an item in the value list has been clicked
|
||||
* @param index the itemindex which has been clicked
|
||||
*/
|
||||
public void clickListItem(int index) { };
|
||||
public void clickListItem(int index) { }
|
||||
|
||||
/**
|
||||
* Processes a mouse drag action (via override).
|
||||
|
|
|
@ -107,6 +107,8 @@ public class Slider extends GameObject {
|
|||
/** Container dimensions. */
|
||||
private static int containerWidth, containerHeight;
|
||||
|
||||
private int repeats;
|
||||
|
||||
/**
|
||||
* Initializes the Slider data type with images and dimensions.
|
||||
* @param container the game container
|
||||
|
@ -169,6 +171,8 @@ public class Slider extends GameObject {
|
|||
for (int i = 0; i < tickCount; i++, t += tickTOffset)
|
||||
ticksT[i] = t;
|
||||
}
|
||||
|
||||
repeats = hitObject.getRepeatCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -583,6 +587,14 @@ public class Slider extends GameObject {
|
|||
tickIntervals = 1;
|
||||
}
|
||||
|
||||
public Curve getCurve() {
|
||||
return curve;
|
||||
}
|
||||
|
||||
public int getRepeats() {
|
||||
return repeats;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCircle() {
|
||||
return false;
|
||||
|
|
|
@ -103,6 +103,20 @@ public class OptionsMenu extends BasicGameState {
|
|||
GameOption.REPLAY_SEEKING,
|
||||
GameOption.DISABLE_UPDATER,
|
||||
GameOption.ENABLE_WATCH_SERVICE
|
||||
}),
|
||||
DANCE ("Dance", new GameOption[] {
|
||||
GameOption.DANCE_MOVER,
|
||||
GameOption.DANCE_SPINNER,
|
||||
GameOption.DANCE_LAZY_SLIDERS,
|
||||
GameOption.DANCE_CIRCLE_STREAMS,
|
||||
GameOption.DANCE_ONLY_CIRCLE_STACKS,
|
||||
}),
|
||||
PIPPI ("Pippi", new GameOption[] {
|
||||
GameOption.PIPPI_ENABLE,
|
||||
GameOption.PIPPI_ANGLE_INC_MUL,
|
||||
GameOption.PIPPI_ANGLE_INC_MUL_SLIDER,
|
||||
GameOption.PIPPI_SLIDER_FOLLOW_EXPAND,
|
||||
GameOption.PIPPI_PREVENT_WOBBLY_STREAMS,
|
||||
});
|
||||
|
||||
/** Total number of tabs. */
|
||||
|
|
|
@ -19,7 +19,9 @@ package yugecin.opsudance;
|
|||
|
||||
import itdelatrisu.opsu.Options;
|
||||
import itdelatrisu.opsu.Utils;
|
||||
import itdelatrisu.opsu.objects.Circle;
|
||||
import itdelatrisu.opsu.objects.GameObject;
|
||||
import itdelatrisu.opsu.objects.Slider;
|
||||
import itdelatrisu.opsu.objects.curves.Vec2f;
|
||||
import yugecin.opsudance.movers.Mover;
|
||||
import yugecin.opsudance.movers.factories.*;
|
||||
|
@ -56,15 +58,23 @@ public class Dancer {
|
|||
private Mover mover;
|
||||
private Spinner spinner;
|
||||
|
||||
private int moverFactoryIndex;
|
||||
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];
|
||||
}
|
||||
|
||||
public void init(String mapname) {
|
||||
isCurrentLazySlider = false;
|
||||
p = null;
|
||||
rand = new Random(mapname.hashCode());
|
||||
dir = 1;
|
||||
|
@ -73,9 +83,45 @@ public class Dancer {
|
|||
}
|
||||
}
|
||||
|
||||
public int getSpinnerIndex() {
|
||||
return spinnerIndex;
|
||||
}
|
||||
|
||||
public void setSpinnerIndex(int spinnerIndex) {
|
||||
if (spinnerIndex < 0 || spinnerIndex >= spinners.length) {
|
||||
spinnerIndex = 0;
|
||||
}
|
||||
this.spinnerIndex = spinnerIndex;
|
||||
spinner = spinners[spinnerIndex];
|
||||
}
|
||||
|
||||
public int getMoverFactoryIndex() {
|
||||
return moverFactoryIndex;
|
||||
}
|
||||
|
||||
public void setMoverFactoryIndex(int moverFactoryIndex) {
|
||||
if (moverFactoryIndex < 0 || moverFactoryIndex >= moverFactories.length) {
|
||||
moverFactoryIndex = 0;
|
||||
}
|
||||
this.moverFactoryIndex = moverFactoryIndex;
|
||||
moverFactory = moverFactories[moverFactoryIndex];
|
||||
}
|
||||
|
||||
public void update(int time, GameObject p, GameObject c) {
|
||||
if (this.p != p) {
|
||||
this.p = p;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (rand.nextInt(2) == 1) {
|
||||
dir *= -1;
|
||||
}
|
||||
|
@ -102,6 +148,9 @@ public class Dancer {
|
|||
c.end = new Vec2f(x, y);
|
||||
} else {
|
||||
Vec2f point = c.getPointAt(time);
|
||||
if (isCurrentLazySlider) {
|
||||
point = c.start;
|
||||
}
|
||||
x = point.x;
|
||||
y = point.y;
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ public class AutoEllipseMoverFactory extends AutoMoverFactory {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Auto ellipse";
|
||||
return "Auto ellipse size";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ public class AutoMoverFactory implements MoverFactory {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Auto";
|
||||
return "Auto decide";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -33,4 +33,9 @@ public class RektSpinner extends Spinner {
|
|||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Rekt";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user