first attempt at merging sliders
This commit is contained in:
parent
fd39b69cbf
commit
89245d9976
|
@ -220,7 +220,7 @@ public class Slider extends GameObject {
|
||||||
curveColor.a = curveAlpha;
|
curveColor.a = curveAlpha;
|
||||||
|
|
||||||
float curveInterval = Options.isSliderSnaking() ? alpha : 1f;
|
float curveInterval = Options.isSliderSnaking() ? alpha : 1f;
|
||||||
curve.draw(curveColor, curveInterval);
|
//curve.draw(curveColor, curveInterval);
|
||||||
color.a = alpha;
|
color.a = alpha;
|
||||||
|
|
||||||
g.pushTransform();
|
g.pushTransform();
|
||||||
|
|
|
@ -62,6 +62,10 @@ public abstract class Curve {
|
||||||
/** Points along the curve (set by inherited classes). */
|
/** Points along the curve (set by inherited classes). */
|
||||||
protected Vec2f[] curve;
|
protected Vec2f[] curve;
|
||||||
|
|
||||||
|
public Vec2f[] getCurvePoints() {
|
||||||
|
return curve;
|
||||||
|
}
|
||||||
|
|
||||||
private Color fallbackSliderColor = new Color(20, 20, 20);
|
private Color fallbackSliderColor = new Color(20, 20, 20);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -44,7 +44,9 @@ import itdelatrisu.opsu.objects.Slider;
|
||||||
import itdelatrisu.opsu.objects.Spinner;
|
import itdelatrisu.opsu.objects.Spinner;
|
||||||
import itdelatrisu.opsu.objects.curves.Curve;
|
import itdelatrisu.opsu.objects.curves.Curve;
|
||||||
import itdelatrisu.opsu.objects.curves.Vec2f;
|
import itdelatrisu.opsu.objects.curves.Vec2f;
|
||||||
|
import itdelatrisu.opsu.render.CurveRenderState;
|
||||||
import itdelatrisu.opsu.render.FrameBufferCache;
|
import itdelatrisu.opsu.render.FrameBufferCache;
|
||||||
|
import itdelatrisu.opsu.render.KnorkeCurveRenderStuff;
|
||||||
import itdelatrisu.opsu.replay.PlaybackSpeed;
|
import itdelatrisu.opsu.replay.PlaybackSpeed;
|
||||||
import itdelatrisu.opsu.replay.Replay;
|
import itdelatrisu.opsu.replay.Replay;
|
||||||
import itdelatrisu.opsu.replay.ReplayFrame;
|
import itdelatrisu.opsu.replay.ReplayFrame;
|
||||||
|
@ -52,9 +54,7 @@ import itdelatrisu.opsu.ui.*;
|
||||||
import itdelatrisu.opsu.ui.animations.AnimationEquation;
|
import itdelatrisu.opsu.ui.animations.AnimationEquation;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.IdentityHashMap;
|
import java.util.*;
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.Stack;
|
|
||||||
|
|
||||||
import org.lwjgl.input.Keyboard;
|
import org.lwjgl.input.Keyboard;
|
||||||
import org.lwjgl.opengl.Display;
|
import org.lwjgl.opengl.Display;
|
||||||
|
@ -72,6 +72,7 @@ import org.newdawn.slick.state.transition.EasedFadeOutTransition;
|
||||||
import org.newdawn.slick.state.transition.EmptyTransition;
|
import org.newdawn.slick.state.transition.EmptyTransition;
|
||||||
import org.newdawn.slick.state.transition.FadeInTransition;
|
import org.newdawn.slick.state.transition.FadeInTransition;
|
||||||
import yugecin.opsudance.*;
|
import yugecin.opsudance.*;
|
||||||
|
import yugecin.opsudance.objects.curves.FakeCombinedCurve;
|
||||||
import yugecin.opsudance.ui.SBOverlay;
|
import yugecin.opsudance.ui.SBOverlay;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -281,6 +282,8 @@ public class Game extends BasicGameState {
|
||||||
private final Cursor mirrorCursor;
|
private final Cursor mirrorCursor;
|
||||||
private final SBOverlay sbOverlay;
|
private final SBOverlay sbOverlay;
|
||||||
|
|
||||||
|
private FakeCombinedCurve knorkesliders;
|
||||||
|
|
||||||
public Game(int state) {
|
public Game(int state) {
|
||||||
this.state = state;
|
this.state = state;
|
||||||
mirrorCursor = new Cursor(true);
|
mirrorCursor = new Cursor(true);
|
||||||
|
@ -1453,6 +1456,15 @@ public class Game extends BasicGameState {
|
||||||
}
|
}
|
||||||
this.leadInTime += epiImgTime;
|
this.leadInTime += epiImgTime;
|
||||||
SoundController.mute(false);
|
SoundController.mute(false);
|
||||||
|
|
||||||
|
// let's create knorkesliders
|
||||||
|
List<Vec2f> curvepoints = new ArrayList<>();
|
||||||
|
for (GameObject gameObject : gameObjects) {
|
||||||
|
if (gameObject.isSlider()) {
|
||||||
|
curvepoints.addAll(Arrays.asList(((Slider) gameObject).getCurve().getCurvePoints()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
knorkesliders = new FakeCombinedCurve(curvepoints.toArray(new Vec2f[curvepoints.size()]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1495,12 +1507,26 @@ public class Game extends BasicGameState {
|
||||||
GameMod.loadModState(previousMods);
|
GameMod.loadModState(previousMods);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private float slidercurveFrom;
|
||||||
|
private float slidercurveTo;
|
||||||
|
|
||||||
|
public void setSlidercurveFrom(int slidercurveFrom) {
|
||||||
|
float pos = slidercurveFrom / knorkesliders.getCurvePoints().length;
|
||||||
|
this.slidercurveFrom = Math.min(pos, this.slidercurveFrom);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSlidercurveTo(int slidercurveTo) {
|
||||||
|
float pos = slidercurveTo / knorkesliders.getCurvePoints().length;
|
||||||
|
this.slidercurveTo = Math.max(pos, this.slidercurveTo);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Draws hit objects, hit results, and follow points.
|
* Draws hit objects, hit results, and follow points.
|
||||||
* @param g the graphics context
|
* @param g the graphics context
|
||||||
* @param trackPosition the track position
|
* @param trackPosition the track position
|
||||||
*/
|
*/
|
||||||
private void drawHitObjects(Graphics g, int trackPosition) {
|
private void drawHitObjects(Graphics g, int trackPosition) {
|
||||||
|
knorkesliders.draw(Color.white, this.slidercurveFrom, this.slidercurveTo);
|
||||||
// include previous object in follow points
|
// include previous object in follow points
|
||||||
int lastObjectIndex = -1;
|
int lastObjectIndex = -1;
|
||||||
if (objectIndex > 0 && objectIndex < beatmap.objects.length &&
|
if (objectIndex > 0 && objectIndex < beatmap.objects.length &&
|
||||||
|
|
46
src/yugecin/opsudance/objects/curves/FakeCombinedCurve.java
Normal file
46
src/yugecin/opsudance/objects/curves/FakeCombinedCurve.java
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
/*
|
||||||
|
* 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.objects.curves;
|
||||||
|
|
||||||
|
import itdelatrisu.opsu.beatmap.HitObject;
|
||||||
|
import itdelatrisu.opsu.objects.curves.Curve;
|
||||||
|
import itdelatrisu.opsu.objects.curves.Vec2f;
|
||||||
|
|
||||||
|
public class FakeCombinedCurve extends Curve {
|
||||||
|
|
||||||
|
public FakeCombinedCurve(Vec2f[] points) {
|
||||||
|
super(new HitObject(0, 0, 0), false);
|
||||||
|
this.curve = points;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Vec2f pointAt(float t) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getEndAngle() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getStartAngle() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user