attemt to fix shrinking sliders with odd amount of repeats with merged slider rendering
This commit is contained in:
parent
50f475e0f7
commit
a3af1c71b8
|
@ -383,9 +383,7 @@ public class Slider extends GameObject {
|
||||||
if (repeats % 2 == 0 && curveIntervalTo == 1 && !reversed) {
|
if (repeats % 2 == 0 && curveIntervalTo == 1 && !reversed) {
|
||||||
// fix shrinking sliders for odd repeating sliders
|
// fix shrinking sliders for odd repeating sliders
|
||||||
reversed = true;
|
reversed = true;
|
||||||
if (Options.isMergingSliders()) {
|
if (!Options.isMergingSliders()) {
|
||||||
|
|
||||||
} else {
|
|
||||||
curve.reverse();
|
curve.reverse();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -396,7 +394,12 @@ public class Slider extends GameObject {
|
||||||
}
|
}
|
||||||
if (Options.isMergingSliders()) {
|
if (Options.isMergingSliders()) {
|
||||||
if (Options.isShrinkingSliders() && curveIntervalFrom > 0) {
|
if (Options.isShrinkingSliders() && curveIntervalFrom > 0) {
|
||||||
game.setSlidercurveFrom(baseSliderFrom + (int) (curveIntervalFrom * curve.getCurvePoints().length));
|
int curvelen = curve.getCurvePoints().length;
|
||||||
|
if (repeats % 2 == 0) {
|
||||||
|
game.spliceSliderCurve(baseSliderFrom + (int) ((1f - curveIntervalFrom) * curvelen), baseSliderFrom + curvelen);
|
||||||
|
} else {
|
||||||
|
game.setSlidercurveFrom(baseSliderFrom + (int) (curveIntervalFrom * curvelen));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
game.setSlidercurveTo(baseSliderFrom + (int) (curveIntervalTo * curve.getCurvePoints().length));
|
game.setSlidercurveTo(baseSliderFrom + (int) (curveIntervalTo * curve.getCurvePoints().length));
|
||||||
} else {
|
} else {
|
||||||
|
@ -587,7 +590,7 @@ public class Slider extends GameObject {
|
||||||
// calculate and send slider result
|
// calculate and send slider result
|
||||||
hitResult();
|
hitResult();
|
||||||
if (Options.isMergingSliders()) {
|
if (Options.isMergingSliders()) {
|
||||||
game.setSlidercurveFrom(baseSliderFrom + curve.getCurvePoints().length);
|
game.setSlidercurveFrom(baseSliderFrom + curve.getCurvePoints().length + 1);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -160,11 +160,13 @@ public abstract class Curve {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reverse() {
|
public void reverse() {
|
||||||
if (renderState == null)
|
|
||||||
renderState = new CurveRenderState(hitObject, curve);
|
|
||||||
renderState.reverse();
|
renderState.reverse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void splice(int from, int to) {
|
||||||
|
renderState.splice(from, to);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the angle of the first control point.
|
* Returns the angle of the first control point.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -68,6 +68,9 @@ public class CurveRenderState {
|
||||||
|
|
||||||
private boolean reversed;
|
private boolean reversed;
|
||||||
|
|
||||||
|
private int spliceFrom;
|
||||||
|
private int spliceTo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the width and height of the container that Curves get drawn into.
|
* Set the width and height of the container that Curves get drawn into.
|
||||||
* Should be called before any curves are drawn.
|
* Should be called before any curves are drawn.
|
||||||
|
@ -113,12 +116,20 @@ public class CurveRenderState {
|
||||||
//write impossible value to make sure the fbo is cleared
|
//write impossible value to make sure the fbo is cleared
|
||||||
lastPointDrawn = -1;
|
lastPointDrawn = -1;
|
||||||
reversed = false;
|
reversed = false;
|
||||||
|
spliceFrom = spliceTo = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reverse() {
|
public void reverse() {
|
||||||
reversed = !reversed;
|
reversed = !reversed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void splice(int from, int to) {
|
||||||
|
spliceFrom = from * 2;
|
||||||
|
spliceTo = to * 2;
|
||||||
|
firstPointDrawn = -1; // force redraw
|
||||||
|
lastPointDrawn = -1; // force redraw
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
||||||
|
@ -336,8 +347,12 @@ public class CurveRenderState {
|
||||||
from = curve.length * 2 - 1 - to;
|
from = curve.length * 2 - 1 - to;
|
||||||
to = curve.length * 2 - 1 - a;
|
to = curve.length * 2 - 1 - a;
|
||||||
}
|
}
|
||||||
for (int i = from; i < to; ++i)
|
for (int i = from; i < to; ++i) {
|
||||||
|
if (spliceFrom <= i && i <= spliceTo) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
GL11.glDrawArrays(GL11.GL_TRIANGLE_FAN, i * (NewCurveStyleState.DIVIDES + 2), NewCurveStyleState.DIVIDES + 2);
|
GL11.glDrawArrays(GL11.GL_TRIANGLE_FAN, i * (NewCurveStyleState.DIVIDES + 2), NewCurveStyleState.DIVIDES + 2);
|
||||||
|
}
|
||||||
GL11.glFlush();
|
GL11.glFlush();
|
||||||
GL20.glDisableVertexAttribArray(staticState.texCoordLoc);
|
GL20.glDisableVertexAttribArray(staticState.texCoordLoc);
|
||||||
GL20.glDisableVertexAttribArray(staticState.attribLoc);
|
GL20.glDisableVertexAttribArray(staticState.attribLoc);
|
||||||
|
|
|
@ -1523,6 +1523,10 @@ public class Game extends BasicGameState {
|
||||||
this.slidercurveTo = Math.max(pos, this.slidercurveTo);
|
this.slidercurveTo = Math.max(pos, this.slidercurveTo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void spliceSliderCurve(int from, int to) {
|
||||||
|
this.knorkesliders.splice(from, to);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user