From 3b497925543223ac9ba2675dbde0f764d9f07b9e Mon Sep 17 00:00:00 2001 From: yugecin Date: Sun, 1 Jan 2017 23:47:11 +0100 Subject: [PATCH] ExGon mover --- src/itdelatrisu/opsu/Options.java | 14 +++++ src/itdelatrisu/opsu/states/OptionsMenu.java | 1 + src/yugecin/opsudance/Dancer.java | 1 + src/yugecin/opsudance/movers/ExgonMover.java | 57 +++++++++++++++++++ .../movers/factories/ExgonMoverFactory.java | 36 ++++++++++++ src/yugecin/opsudance/ui/SBOverlay.java | 1 + 6 files changed, 110 insertions(+) create mode 100644 src/yugecin/opsudance/movers/ExgonMover.java create mode 100644 src/yugecin/opsudance/movers/factories/ExgonMoverFactory.java diff --git a/src/itdelatrisu/opsu/Options.java b/src/itdelatrisu/opsu/Options.java index 9c028342..19db44b0 100644 --- a/src/itdelatrisu/opsu/Options.java +++ b/src/itdelatrisu/opsu/Options.java @@ -59,6 +59,7 @@ import com.sun.jna.platform.win32.Advapi32Util; import com.sun.jna.platform.win32.Win32Exception; import com.sun.jna.platform.win32.WinReg; import yugecin.opsudance.*; +import yugecin.opsudance.movers.factories.ExgonMoverFactory; import yugecin.opsudance.movers.factories.QuadraticBezierMoverFactory; import yugecin.opsudance.movers.slidermovers.DefaultSliderMoverController; @@ -682,6 +683,16 @@ public class Options { Dancer.instance.setMoverFactoryIndex(i); } }, + DANCE_EXGON_DELAY ("ExGon delay", "ExGonDelay", "Delay between moves for the ExGon mover", 25, 2, 750) { + @Override + public String getValueString() { + return String.valueOf(val); + } + @Override + public boolean showCondition() { + return Dancer.moverFactories[Dancer.instance.getMoverFactoryIndex()] instanceof ExgonMoverFactory; + } + }, DANCE_QUAD_BEZ_AGGRESSIVENESS ("Quadratic Bezier aggressiveness", "QuadBezAgr", "AKA initial D factor", 50, 0, 200) { @Override public String getValueString() { @@ -1371,6 +1382,9 @@ public class Options { } } + public static int getExgonDelay() { + return GameOption.DANCE_EXGON_DELAY.getIntegerValue(); + } public static int getQuadBezAggressiveness() { return GameOption.DANCE_QUAD_BEZ_AGGRESSIVENESS.getIntegerValue(); } diff --git a/src/itdelatrisu/opsu/states/OptionsMenu.java b/src/itdelatrisu/opsu/states/OptionsMenu.java index 5b8c48a7..39ffa7ca 100644 --- a/src/itdelatrisu/opsu/states/OptionsMenu.java +++ b/src/itdelatrisu/opsu/states/OptionsMenu.java @@ -112,6 +112,7 @@ public class OptionsMenu extends BasicGameState implements OptionsOverlay.Parent }), new OptionTab("Dance", new GameOption[] { GameOption.DANCE_MOVER, + GameOption.DANCE_EXGON_DELAY, GameOption.DANCE_QUAD_BEZ_AGGRESSIVENESS, GameOption.DANCE_QUAD_BEZ_SLIDER_AGGRESSIVENESS_FACTOR, GameOption.DANCE_QUAD_BEZ_USE_CUBIC_ON_SLIDERS, diff --git a/src/yugecin/opsudance/Dancer.java b/src/yugecin/opsudance/Dancer.java index cbe900e9..3dbc25f2 100644 --- a/src/yugecin/opsudance/Dancer.java +++ b/src/yugecin/opsudance/Dancer.java @@ -58,6 +58,7 @@ public class Dancer { //new LinearFactory(), new ArcFactory(), new QuadraticBezierMoverFactory(), + new ExgonMoverFactory(), }; public static Spinner[] spinners = new Spinner[] { diff --git a/src/yugecin/opsudance/movers/ExgonMover.java b/src/yugecin/opsudance/movers/ExgonMover.java new file mode 100644 index 00000000..bb56ffa5 --- /dev/null +++ b/src/yugecin/opsudance/movers/ExgonMover.java @@ -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!dance 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 . + */ +package yugecin.opsudance.movers; + +import itdelatrisu.opsu.Options; +import itdelatrisu.opsu.objects.GameObject; + +import java.util.Random; + +public class ExgonMover extends Mover { + + private double[] pos; + private int nextTime; + private static final Random randgen = new Random(); + + public ExgonMover(GameObject start, GameObject end, int dir) { + super(start, end, dir); + nextTime = start.getEndTime() + Options.getExgonDelay(); + 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()) { + pos[0] = endX; + pos[1] = endY; + } else { + pos[0] = randgen.nextInt(Options.width); + pos[1] = randgen.nextInt(Options.height); + } + } + return pos; + } + + @Override + public String getName() { + return "ExGon"; + } + +} diff --git a/src/yugecin/opsudance/movers/factories/ExgonMoverFactory.java b/src/yugecin/opsudance/movers/factories/ExgonMoverFactory.java new file mode 100644 index 00000000..6157bd6d --- /dev/null +++ b/src/yugecin/opsudance/movers/factories/ExgonMoverFactory.java @@ -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!dance 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 . + */ +package yugecin.opsudance.movers.factories; + +import itdelatrisu.opsu.objects.GameObject; +import yugecin.opsudance.movers.ExgonMover; +import yugecin.opsudance.movers.Mover; + +public class ExgonMoverFactory extends AutoMoverFactory { + + @Override + protected Mover donext(GameObject start, GameObject end, int dir, int dt, double velocity) { + return new ExgonMover(start, end, dir); + } + + @Override + public String toString() { + return "ExGon"; + } + +} diff --git a/src/yugecin/opsudance/ui/SBOverlay.java b/src/yugecin/opsudance/ui/SBOverlay.java index c3c4a9db..bd03da4d 100644 --- a/src/yugecin/opsudance/ui/SBOverlay.java +++ b/src/yugecin/opsudance/ui/SBOverlay.java @@ -55,6 +55,7 @@ public class SBOverlay implements OptionsOverlay.Parent { }), new OptionTab("Dance", new GameOption[] { GameOption.DANCE_MOVER, + GameOption.DANCE_EXGON_DELAY, GameOption.DANCE_QUAD_BEZ_AGGRESSIVENESS, GameOption.DANCE_QUAD_BEZ_SLIDER_AGGRESSIVENESS_FACTOR, GameOption.DANCE_QUAD_BEZ_USE_CUBIC_ON_SLIDERS,