fix sliders disappearing when multiple sliders are active or when later sliders is done earlier (2b maps etc)
This commit is contained in:
parent
d6144187ad
commit
2f1f860ca3
|
@ -661,4 +661,13 @@ public class Utils {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class Pair<F, S> {
|
||||||
|
public F first;
|
||||||
|
public S second;
|
||||||
|
public Pair(F first, S second) {
|
||||||
|
this.first = first;
|
||||||
|
this.second = second;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -466,13 +466,14 @@ public class Slider extends GameObject {
|
||||||
int curvelen = curve.getCurvePoints().length;
|
int curvelen = curve.getCurvePoints().length;
|
||||||
if (Options.isMergingSliders()) {
|
if (Options.isMergingSliders()) {
|
||||||
if (Options.isShrinkingSliders() && curveIntervalFrom > 0) {
|
if (Options.isShrinkingSliders() && curveIntervalFrom > 0) {
|
||||||
if (repeats % 2 == 0) {
|
if (hitObject.getRepeatCount() % 2 == 0) {
|
||||||
game.spliceSliderCurve(baseSliderFrom + (int) ((1d - curveIntervalFrom) * curvelen) - 1, baseSliderFrom + curvelen);
|
game.addMergedSliderPointsToRender(baseSliderFrom, baseSliderFrom + (int) ((1d - curveIntervalFrom) * curvelen));
|
||||||
} else {
|
} else {
|
||||||
game.setSlidercurveFrom(baseSliderFrom + (int) (curveIntervalFrom * curvelen) + 1);
|
game.addMergedSliderPointsToRender(baseSliderFrom + (int) (curveIntervalFrom * curvelen) + 1, baseSliderFrom + (int) (curveIntervalTo * curve.getCurvePoints().length));
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
game.addMergedSliderPointsToRender(baseSliderFrom, baseSliderFrom + (int) (curveIntervalTo * curve.getCurvePoints().length));
|
||||||
}
|
}
|
||||||
game.setSlidercurveTo(baseSliderFrom + (int) (curveIntervalTo * curve.getCurvePoints().length));
|
|
||||||
} else {
|
} else {
|
||||||
if (Options.isShrinkingSliders() && curveIntervalFrom > 0 && repeats % 2 == 0) {
|
if (Options.isShrinkingSliders() && curveIntervalFrom > 0 && repeats % 2 == 0) {
|
||||||
if (Options.isFallbackSliders()) {
|
if (Options.isFallbackSliders()) {
|
||||||
|
@ -687,9 +688,6 @@ public class Slider extends GameObject {
|
||||||
|
|
||||||
// calculate and send slider result
|
// calculate and send slider result
|
||||||
hitResult();
|
hitResult();
|
||||||
if (Options.isMergingSliders()) {
|
|
||||||
game.setSlidercurveFrom(baseSliderFrom + curve.getCurvePoints().length + 1);
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,6 @@ package itdelatrisu.opsu.objects.curves;
|
||||||
|
|
||||||
import itdelatrisu.opsu.GameImage;
|
import itdelatrisu.opsu.GameImage;
|
||||||
import itdelatrisu.opsu.Options;
|
import itdelatrisu.opsu.Options;
|
||||||
import itdelatrisu.opsu.Utils;
|
|
||||||
import itdelatrisu.opsu.beatmap.HitObject;
|
import itdelatrisu.opsu.beatmap.HitObject;
|
||||||
import itdelatrisu.opsu.render.CurveRenderState;
|
import itdelatrisu.opsu.render.CurveRenderState;
|
||||||
import itdelatrisu.opsu.skins.Skin;
|
import itdelatrisu.opsu.skins.Skin;
|
||||||
|
@ -31,7 +30,6 @@ import org.lwjgl.opengl.GLContext;
|
||||||
import org.newdawn.slick.Color;
|
import org.newdawn.slick.Color;
|
||||||
import org.newdawn.slick.Image;
|
import org.newdawn.slick.Image;
|
||||||
import org.newdawn.slick.util.Log;
|
import org.newdawn.slick.util.Log;
|
||||||
import yugecin.opsudance.objects.curves.FakeCombinedCurve;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Representation of a curve.
|
* Representation of a curve.
|
||||||
|
@ -43,7 +41,7 @@ public abstract class Curve {
|
||||||
protected static float CURVE_POINTS_SEPERATION = 2.5f;
|
protected static float CURVE_POINTS_SEPERATION = 2.5f;
|
||||||
|
|
||||||
/** The curve border color. */
|
/** The curve border color. */
|
||||||
private static Color borderColor;
|
protected static Color borderColor;
|
||||||
|
|
||||||
/** Whether mmsliders are supported. */
|
/** Whether mmsliders are supported. */
|
||||||
private static boolean mmsliderSupported = false;
|
private static boolean mmsliderSupported = false;
|
||||||
|
@ -58,7 +56,7 @@ public abstract class Curve {
|
||||||
protected float[] sliderX, sliderY;
|
protected float[] sliderX, sliderY;
|
||||||
|
|
||||||
/** Per-curve render-state used for the new style curve renders. */
|
/** Per-curve render-state used for the new style curve renders. */
|
||||||
private CurveRenderState renderState;
|
protected CurveRenderState renderState;
|
||||||
|
|
||||||
/** Points along the curve (set by inherited classes). */
|
/** Points along the curve (set by inherited classes). */
|
||||||
public Vec2f[] curve;
|
public Vec2f[] curve;
|
||||||
|
@ -150,14 +148,14 @@ public abstract class Curve {
|
||||||
// mmsliders
|
// mmsliders
|
||||||
else {
|
else {
|
||||||
if (renderState == null)
|
if (renderState == null)
|
||||||
renderState = new CurveRenderState(hitObject, curve, this instanceof FakeCombinedCurve);
|
renderState = new CurveRenderState(hitObject, curve, false);
|
||||||
renderState.draw(color, borderColor, from, to);
|
renderState.draw(color, borderColor, from, to);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void splice(int from, int to) {
|
public void splice(int from, int to) {
|
||||||
if (renderState == null)
|
if (renderState == null)
|
||||||
renderState = new CurveRenderState(hitObject, curve, this instanceof FakeCombinedCurve);
|
renderState = new CurveRenderState(hitObject, curve, false);
|
||||||
renderState.splice(from, to);
|
renderState.splice(from, to);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@ import itdelatrisu.opsu.objects.curves.Vec2f;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.nio.FloatBuffer;
|
import java.nio.FloatBuffer;
|
||||||
import java.nio.IntBuffer;
|
import java.nio.IntBuffer;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
|
||||||
import org.lwjgl.BufferUtils;
|
import org.lwjgl.BufferUtils;
|
||||||
import org.lwjgl.opengl.EXTFramebufferObject;
|
import org.lwjgl.opengl.EXTFramebufferObject;
|
||||||
|
@ -69,6 +70,8 @@ public class CurveRenderState {
|
||||||
private int spliceFrom;
|
private int spliceFrom;
|
||||||
private int spliceTo;
|
private int spliceTo;
|
||||||
|
|
||||||
|
protected LinkedList<Utils.Pair<Integer, Integer>> pointsToRender;
|
||||||
|
|
||||||
private final int mirrors;
|
private final int mirrors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -138,6 +141,14 @@ public class CurveRenderState {
|
||||||
lastPointDrawn = -1; // force redraw
|
lastPointDrawn = -1; // force redraw
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void draw(Color color, Color borderColor, LinkedList<Utils.Pair<Integer, Integer>> pointsToRender) {
|
||||||
|
lastPointDrawn = -1;
|
||||||
|
firstPointDrawn = -1;
|
||||||
|
this.pointsToRender = pointsToRender;
|
||||||
|
draw(color, borderColor, 0, curve.length);
|
||||||
|
this.pointsToRender = null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Draw a curve to the screen that's tinted with `color`. The first time
|
* Draw a curve to the screen that's tinted with `color`. The first time
|
||||||
* this is called this caches the image result of the curve and on subsequent
|
* this is called this caches the image result of the curve and on subsequent
|
||||||
|
@ -348,7 +359,11 @@ public class CurveRenderState {
|
||||||
max = 1;
|
max = 1;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < max; i++) {
|
for (int i = 0; i < max; i++) {
|
||||||
renderCurve(from, to, i);
|
if (pointsToRender == null) {
|
||||||
|
renderCurve(from, to, i);
|
||||||
|
} else {
|
||||||
|
renderCurve(i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
GL11.glFlush();
|
GL11.glFlush();
|
||||||
GL20.glDisableVertexAttribArray(staticState.texCoordLoc);
|
GL20.glDisableVertexAttribArray(staticState.texCoordLoc);
|
||||||
|
@ -370,6 +385,15 @@ public class CurveRenderState {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void renderCurve(int mirror) {
|
||||||
|
for (Utils.Pair<Integer, Integer> point : pointsToRender) {
|
||||||
|
for (int i = point.first * 2; i < point.second * 2 - 1; ++i) {
|
||||||
|
final int index = i + curve.length * 2 * mirror;
|
||||||
|
GL11.glDrawArrays(GL11.GL_TRIANGLE_FAN, index * (NewCurveStyleState.DIVIDES + 2), NewCurveStyleState.DIVIDES + 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fill {@code buff} with the texture coordinates and positions for a cone
|
* Fill {@code buff} with the texture coordinates and positions for a cone
|
||||||
* that has its center at the coordinates {@code (x1,y1)}.
|
* that has its center at the coordinates {@code (x1,y1)}.
|
||||||
|
|
|
@ -382,17 +382,6 @@ public class Game extends ComplexOpsuState {
|
||||||
if (objectIndex > 0) {
|
if (objectIndex > 0) {
|
||||||
objectIndex--;
|
objectIndex--;
|
||||||
}
|
}
|
||||||
if (Options.isMergingSliders()) {
|
|
||||||
int obj = objectIndex;
|
|
||||||
while (obj < gameObjects.length) {
|
|
||||||
if (gameObjects[obj] instanceof Slider) {
|
|
||||||
slidercurveFrom = slidercurveTo = ((Slider) gameObjects[obj]).baseSliderFrom;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
obj++;
|
|
||||||
}
|
|
||||||
spliceSliderCurve(-1, -1);
|
|
||||||
}
|
|
||||||
Dancer.instance.setObjectIndex(objectIndex);
|
Dancer.instance.setObjectIndex(objectIndex);
|
||||||
storyboardOverlay.updateIndex(objectIndex);
|
storyboardOverlay.updateIndex(objectIndex);
|
||||||
lastReplayTime = beatmap.objects[objectIndex].getTime();
|
lastReplayTime = beatmap.objects[objectIndex].getTime();
|
||||||
|
@ -1680,9 +1669,6 @@ public class Game extends ComplexOpsuState {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
slidercurveFrom = 0;
|
|
||||||
slidercurveTo = 0;
|
|
||||||
|
|
||||||
Dancer.instance.setGameObjects(gameObjects);
|
Dancer.instance.setGameObjects(gameObjects);
|
||||||
storyboardOverlay.setGameObjects(gameObjects);
|
storyboardOverlay.setGameObjects(gameObjects);
|
||||||
if (!skippedToCheckpoint) {
|
if (!skippedToCheckpoint) {
|
||||||
|
@ -1738,19 +1724,8 @@ public class Game extends ComplexOpsuState {
|
||||||
GameMod.loadModState(previousMods);
|
GameMod.loadModState(previousMods);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int slidercurveFrom;
|
public void addMergedSliderPointsToRender(int from, int to) {
|
||||||
private int slidercurveTo;
|
knorkesliders.addRange(from, to);
|
||||||
|
|
||||||
public void setSlidercurveFrom(int slidercurveFrom) {
|
|
||||||
this.slidercurveFrom = Math.max(slidercurveFrom, this.slidercurveFrom);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSlidercurveTo(int slidercurveTo) {
|
|
||||||
this.slidercurveTo = Math.max(slidercurveTo, this.slidercurveTo);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void spliceSliderCurve(int from, int to) {
|
|
||||||
this.knorkesliders.splice(from, to);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1767,7 +1742,8 @@ public class Game extends ComplexOpsuState {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Options.isMergingSliders() && knorkesliders != null) {
|
if (Options.isMergingSliders() && knorkesliders != null) {
|
||||||
knorkesliders.draw(Color.white, this.slidercurveFrom, this.slidercurveTo);
|
knorkesliders.draw(Color.white);
|
||||||
|
knorkesliders.initForFrame();
|
||||||
/*
|
/*
|
||||||
if (Options.isMirror()) {
|
if (Options.isMirror()) {
|
||||||
g.pushTransform();
|
g.pushTransform();
|
||||||
|
|
|
@ -17,15 +17,38 @@
|
||||||
*/
|
*/
|
||||||
package yugecin.opsudance.objects.curves;
|
package yugecin.opsudance.objects.curves;
|
||||||
|
|
||||||
|
import itdelatrisu.opsu.Utils;
|
||||||
import itdelatrisu.opsu.beatmap.HitObject;
|
import itdelatrisu.opsu.beatmap.HitObject;
|
||||||
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 org.newdawn.slick.Color;
|
||||||
|
|
||||||
|
import java.util.LinkedList;
|
||||||
|
|
||||||
public class FakeCombinedCurve extends Curve {
|
public class FakeCombinedCurve extends Curve {
|
||||||
|
|
||||||
|
private LinkedList<Utils.Pair<Integer, Integer>> pointsToRender;
|
||||||
|
|
||||||
public FakeCombinedCurve(Vec2f[] points) {
|
public FakeCombinedCurve(Vec2f[] points) {
|
||||||
super(new HitObject(0, 0, 0), false);
|
super(new HitObject(0, 0, 0), false);
|
||||||
this.curve = points;
|
this.curve = points;
|
||||||
|
pointsToRender = new LinkedList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void initForFrame() {
|
||||||
|
pointsToRender.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addRange(int from, int to) {
|
||||||
|
pointsToRender.add(new Utils.Pair<>(from, to));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void draw(Color color) {
|
||||||
|
if (renderState == null)
|
||||||
|
renderState = new CurveRenderState(hitObject, curve, true);
|
||||||
|
renderState.draw(color, borderColor, pointsToRender);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue
Block a user