Merge branch 'pippi'

This commit is contained in:
yugecin 2016-09-30 22:58:05 +02:00
commit 722180d9ff
5 changed files with 174 additions and 24 deletions

View File

@ -57,6 +57,7 @@ import com.sun.jna.platform.win32.WinReg;
import yugecin.opsudance.Dancer;
import yugecin.opsudance.MoverDirection;
import yugecin.opsudance.ObjectColorOverrides;
import yugecin.opsudance.Pippi;
import yugecin.opsudance.movers.factories.AutoMoverFactory;
/**
@ -797,8 +798,18 @@ public class Options {
}
},
DANCE_CIRLCE_IN_SLOW_SLIDERS ("Do circles in slow sliders", "CircleInSlider", "Circle around sliderball in lazy & slow sliders", false) {
// TODO
DANCE_CIRLCE_IN_SLOW_SLIDERS ("Do circles in slow sliders", "CircleInSlider", "Circle around sliderball in lazy & slow sliders", Pippi.circleSlowSliders) {
@Override
public void click(GameContainer container) {
bool = !bool;
Pippi.circleSlowSliders = bool;
}
@Override
public void read(String s) {
super.read(s);
Pippi.circleSlowSliders = bool;
}
},
DANCE_HIDE_UI ("Hide all UI", "HideUI", ".", Dancer.hideui) {
@ -815,34 +826,84 @@ public class Options {
}
},
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
PIPPI_ENABLE ("Pippi", "Pippi", "Move in circles like dancing pippi (osu! april fools joke 2016)", Pippi.enabled) {
@Override
public void click(GameContainer container) {
bool = !bool;
Pippi.enabled = bool;
}
@Override
public String getValueString() {
return "x" + val;
public void read(String s) {
super.read(s);
Pippi.enabled = bool;
}
},
PIPPI_ANGLE_INC_MUL_SLIDER ("Pippi angle increment multiplier slider", "PippiAngIncMulSlider", "Same as above, but in sliders", 5, -20, 20) {
// TODO
PIPPI_ANGLE_INC_MUL("Pippi angle increment multiplier", "PippiAngIncMul", "How fast pippi's angle increments", Pippi.angleInc, -200, 200) {
@Override
public String getValueString() {
return "x" + val;
return String.format("x%.1f", val / 10f);
}
@Override
public void drag(GameContainer container, int d) {
super.drag(container, d);
Pippi.angleInc = val;
}
@Override
public void read(String s) {
super.read(s);
Pippi.angleInc = val;
}
},
PIPPI_SLIDER_FOLLOW_EXPAND ("Followcircle expand", "PippiFollowExpand", "Increase radius in followcircles", true) {
// TODO
PIPPI_ANGLE_INC_MUL_SLIDER ("Pippi angle increment multiplier slider", "PippiAngIncMulSlider", "Same as above, but in sliders", Pippi.angleSliderInc, -200, 200) {
@Override
public String getValueString() {
return String.format("x%.1f", val / 10f);
}
@Override
public void drag(GameContainer container, int d) {
super.drag(container, d);
Pippi.angleSliderInc = val;
}
@Override
public void read(String s) {
super.read(s);
Pippi.angleSliderInc = val;
}
},
PIPPI_PREVENT_WOBBLY_STREAMS ("Prevent wobbly streams", "PippiPreventWobblyStreams", "Force linear mover while doing streams to prevent wobbly pippi", true) {
// TODO
PIPPI_SLIDER_FOLLOW_EXPAND ("Followcircle expand", "PippiFollowExpand", "Increase radius in followcircles", Pippi.followcircleExpand) {
@Override
public void click(GameContainer container) {
bool = !bool;
Pippi.followcircleExpand = bool;
}
@Override
public void read(String s) {
super.read(s);
Pippi.followcircleExpand = bool;
}
},
PIPPI_PREVENT_WOBBLY_STREAMS ("Prevent wobbly streams", "PippiPreventWobblyStreams", "Force linear mover while doing streams to prevent wobbly pippi", Pippi.preventWobblyStreams) {
@Override
public void click(GameContainer container) {
bool = !bool;
Pippi.preventWobblyStreams = bool;
}
@Override
public void read(String s) {
super.read(s);
Pippi.preventWobblyStreams = bool;
}
};

View File

@ -73,6 +73,7 @@ import org.newdawn.slick.state.transition.FadeInTransition;
import yugecin.opsudance.Dancer;
import yugecin.opsudance.MoverDirection;
import yugecin.opsudance.ObjectColorOverrides;
import yugecin.opsudance.Pippi;
/**
* "Game" state.
@ -631,6 +632,7 @@ public class Game extends BasicGameState {
public void update(GameContainer container, StateBasedGame game, int delta)
throws SlickException {
UI.update(delta);
Pippi.update(delta);
int mouseX = input.getMouseX(), mouseY = input.getMouseY();
skipButton.hoverUpdate(delta, mouseX, mouseY);
if (isReplay || GameMod.AUTO.isActive())
@ -1165,6 +1167,7 @@ public class Game extends BasicGameState {
throw new RuntimeException("Running game with no beatmap loaded.");
Dancer.instance.reset();
Pippi.reset();
MoverDirection.reset(beatmap.getTitle());
// free all previously cached hitobject to framebuffer mappings if some still exist

View File

@ -142,8 +142,6 @@ public class Dancer {
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();
@ -159,6 +157,9 @@ public class Dancer {
y = point.y;
}
}
Pippi.dance(time, c, isCurrentLazySlider);
x = Utils.clamp(x, 10, Options.width - 10);
y = Utils.clamp(y, 10, Options.height - 10);
}
}

View File

@ -0,0 +1,87 @@
/*
* 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 <http://www.gnu.org/licenses/>.
*/
package yugecin.opsudance;
import itdelatrisu.opsu.objects.Circle;
import itdelatrisu.opsu.objects.GameObject;
public class Pippi {
private static double angle = 0;
private static int currentdelta;
private static final int targetdelta = 4;
public static boolean enabled;
public static int angleInc = 10;
public static int angleSliderInc = 50;
public static boolean preventWobblyStreams = true;
public static boolean followcircleExpand = true;
public static boolean circleSlowSliders = true;
private static double pippirad;
private static double pippiminrad;
private static double pippimaxrad;
private static GameObject previous;
public static void reset() {
angle = 0;
currentdelta = 0;
pippiminrad = pippirad = Circle.diameter / 2d - 10d;
pippimaxrad = Circle.diameter - 10d;
}
public static void dance(int time, GameObject c, boolean isCurrentLazySlider) {
if (!enabled || c.isSpinner()) {
return;
}
if (currentdelta >= targetdelta && c != previous) {
currentdelta = 0;
if (c.isSlider() && c.getTime() < time) {
angle += angleSliderInc / 1800d * Math.PI;
if (followcircleExpand && !isCurrentLazySlider) {
if (c.getEndTime() - time < 40 && pippirad > pippimaxrad) {
pippirad -= 5d;
} else if (time - c.getTime() > 10 && c.getEndTime() - c.getTime() > 600 && pippirad < pippimaxrad){
pippirad += 3d;
}
}
} else if (!c.isSpinner()) {
if (followcircleExpand && pippirad != pippiminrad) {
pippirad = pippiminrad;
}
angle += angleInc / 1800d * Math.PI;
}
// don't inc on long movements
if (c.getTime() - time > 400) {
previous = c;
return;
}
}
Dancer.instance.x += pippirad * Math.cos(angle);
Dancer.instance.y += pippirad * Math.sin(angle);
}
public static void update(int delta) {
currentdelta += delta;
}
public static boolean shouldPreventWobblyStream(double distance) {
return enabled && distance < Circle.diameter * 1.7f && preventWobblyStreams;
}
}

View File

@ -22,6 +22,7 @@ import itdelatrisu.opsu.Utils;
import itdelatrisu.opsu.beatmap.HitObject;
import itdelatrisu.opsu.objects.Circle;
import itdelatrisu.opsu.objects.GameObject;
import yugecin.opsudance.Pippi;
import yugecin.opsudance.movers.*;
public class AutoMoverFactory implements MoverFactory {
@ -47,12 +48,9 @@ public class AutoMoverFactory implements MoverFactory {
}
/*
// TODO streams: linear if pippi+preventwobblystreams
if (distance < Circle.diameter * 1.7f && pippi && pippipreventwobblystreams) {
if (Pippi.shouldPreventWobblyStream(distance)) {
return new LinearMover(start, end, dir);
}
*/
endtime = end.getTime();