add options for slider styles and make it all work

This commit is contained in:
yugecin 2016-12-04 17:35:55 +01:00
parent 33f018bf0f
commit 00fcf0ebc1
7 changed files with 62 additions and 22 deletions

View File

@ -913,7 +913,9 @@ public class GameData {
float oldColorAlpha = hitResult.color.a; float oldColorAlpha = hitResult.color.a;
Colors.WHITE_FADE.a = alpha; Colors.WHITE_FADE.a = alpha;
hitResult.color.a = alpha; hitResult.color.a = alpha;
//hitResult.curve.draw(hitResult.color); if (!Options.isShrinkingSliders()) {
hitResult.curve.draw(hitResult.color);
}
Colors.WHITE_FADE.a = oldWhiteAlpha; Colors.WHITE_FADE.a = oldWhiteAlpha;
hitResult.color.a = oldColorAlpha; hitResult.color.a = oldColorAlpha;
} }

View File

@ -502,7 +502,14 @@ public class Options {
FORCE_DEFAULT_PLAYFIELD ("Force Default Playfield", "ForceDefaultPlayfield", "Override the song background with the default playfield background.", false), FORCE_DEFAULT_PLAYFIELD ("Force Default Playfield", "ForceDefaultPlayfield", "Override the song background with the default playfield background.", false),
IGNORE_BEATMAP_SKINS ("Ignore All Beatmap Skins", "IgnoreBeatmapSkins", "Never use skin element overrides provided by beatmaps.", false), IGNORE_BEATMAP_SKINS ("Ignore All Beatmap Skins", "IgnoreBeatmapSkins", "Never use skin element overrides provided by beatmaps.", false),
SNAKING_SLIDERS ("Snaking sliders", "SnakingSliders", "Sliders gradually snake out from their starting point.", true), SNAKING_SLIDERS ("Snaking sliders", "SnakingSliders", "Sliders gradually snake out from their starting point.", true),
SHRINKING_SLIDERS ("Shrinking sliders", "ShrinkingSliders", "Sliders shrinks when sliderball passes - unstable!", false),
FALLBACK_SLIDERS ("Fallback sliders", "FallbackSliders", "Enable this if sliders won't render", false), FALLBACK_SLIDERS ("Fallback sliders", "FallbackSliders", "Enable this if sliders won't render", false),
MERGING_SLIDERS ("Merging sliders", "MergingSliders", "Merge sliders (aka knorkesliders) - unstable!", false) {
@Override
public boolean showCondition() {
return !FALLBACK_SLIDERS.bool;
}
},
SHOW_HIT_LIGHTING ("Show Hit Lighting", "HitLighting", "Adds an effect behind hit explosions.", true), SHOW_HIT_LIGHTING ("Show Hit Lighting", "HitLighting", "Adds an effect behind hit explosions.", true),
SHOW_COMBO_BURSTS ("Show Combo Bursts", "ComboBurst", "A character image is displayed at combo milestones.", true), SHOW_COMBO_BURSTS ("Show Combo Bursts", "ComboBurst", "A character image is displayed at combo milestones.", true),
SHOW_PERFECT_HIT ("Show Perfect Hits", "PerfectHit", "Whether to show perfect hit result bursts (300s, slider ticks).", true), SHOW_PERFECT_HIT ("Show Perfect Hits", "PerfectHit", "Whether to show perfect hit result bursts (300s, slider ticks).", true),
@ -1775,6 +1782,9 @@ public class Options {
public static boolean isFallbackSliders() { return GameOption.FALLBACK_SLIDERS.getBooleanValue(); } public static boolean isFallbackSliders() { return GameOption.FALLBACK_SLIDERS.getBooleanValue(); }
public static boolean isShrinkingSliders() { return GameOption.SHRINKING_SLIDERS.getBooleanValue(); }
public static boolean isMergingSliders() { return !isFallbackSliders() && GameOption.MERGING_SLIDERS.getBooleanValue(); }
/** /**
* Returns the fixed circle size override, if any. * Returns the fixed circle size override, if any.
* @return the CS value (0, 10], 0f if disabled * @return the CS value (0, 10], 0f if disabled

View File

@ -195,6 +195,9 @@ public class Slider extends GameObject {
@Override @Override
public void draw(Graphics g, int trackPosition, boolean mirror) { public void draw(Graphics g, int trackPosition, boolean mirror) {
if (trackPosition > getEndTime()) {
return;
}
Color orig = color; Color orig = color;
if (mirror) { if (mirror) {
color = mirrorColor; color = mirrorColor;
@ -219,15 +222,9 @@ public class Slider extends GameObject {
if (GameMod.HIDDEN.isActive() && trackPosition > getTime()) { if (GameMod.HIDDEN.isActive() && trackPosition > getTime()) {
curveAlpha = Math.max(0f, 1f - ((float) (trackPosition - getTime()) / (getEndTime() - getTime())) * 1.05f); curveAlpha = Math.max(0f, 1f - ((float) (trackPosition - getTime()) / (getEndTime() - getTime())) * 1.05f);
} }
curveColor.a = curveAlpha;
float curveInterval = Options.isSliderSnaking() ? alpha : 1f; curveColor.a = curveAlpha;
//curve.draw(curveColor, curveInterval); boolean isCurveCompletelyDrawn = drawSliderTrack(trackPosition, alpha);
float sliderprogress = (float) (trackPosition - getTime()) / sliderTimeTotal;
if (sliderprogress > 0) {
game.setSlidercurveFrom(baseSliderFrom + (int) (sliderprogress * curve.getCurvePoints().length));
}
game.setSlidercurveTo(baseSliderFrom + (int) (curveInterval * curve.getCurvePoints().length));
color.a = alpha; color.a = alpha;
g.pushTransform(); g.pushTransform();
@ -292,7 +289,7 @@ public class Slider extends GameObject {
g.popTransform(); g.popTransform();
// repeats // repeats
if (curveInterval == 1.0f) { if (isCurveCompletelyDrawn) {
for (int tcurRepeat = currentRepeats; tcurRepeat <= currentRepeats + 1; tcurRepeat++) { for (int tcurRepeat = currentRepeats; tcurRepeat <= currentRepeats + 1; tcurRepeat++) {
if (hitObject.getRepeatCount() - 1 > tcurRepeat) { if (hitObject.getRepeatCount() - 1 > tcurRepeat) {
Image arrow = GameImage.REVERSEARROW.getImage(); Image arrow = GameImage.REVERSEARROW.getImage();
@ -376,6 +373,26 @@ public class Slider extends GameObject {
color = orig; color = orig;
} }
private boolean drawSliderTrack(int trackPosition, float snakingSliderProgress) {
float curveIntervalTo = Options.isSliderSnaking() ? snakingSliderProgress : 1f;
float curveIntervalFrom = 0f;
if (Options.isShrinkingSliders()) {
float sliderprogress = (float) (trackPosition - getTime()) / sliderTimeTotal;
if (sliderprogress > 0) {
curveIntervalFrom = sliderprogress;
}
}
if (Options.isMergingSliders()) {
if (Options.isShrinkingSliders() && curveIntervalFrom > 0) {
game.setSlidercurveFrom(baseSliderFrom + (int) (curveIntervalFrom * curve.getCurvePoints().length));
}
game.setSlidercurveTo(baseSliderFrom + (int) (curveIntervalTo * curve.getCurvePoints().length));
} else {
curve.draw(curveColor, curveIntervalFrom, curveIntervalTo);
}
return curveIntervalTo == 1f;
}
/** /**
* Calculates the slider hit result. * Calculates the slider hit result.
* @return the hit result (GameData.HIT_* constants) * @return the hit result (GameData.HIT_* constants)
@ -557,7 +574,9 @@ public class Slider extends GameObject {
// calculate and send slider result // calculate and send slider result
hitResult(); hitResult();
game.setSlidercurveFrom(baseSliderFrom + curve.getCurvePoints().length); if (Options.isMergingSliders()) {
game.setSlidercurveFrom(baseSliderFrom + curve.getCurvePoints().length);
}
return true; return true;
} }

View File

@ -126,7 +126,8 @@ public abstract class Curve {
/** /**
* Draws the curve in the range [0, t] (where the full range is [0, 1]) to the graphics context. * Draws the curve in the range [0, t] (where the full range is [0, 1]) to the graphics context.
* @param color the color filter * @param color the color filter
* @param t set the curve interval to [0, t] * @param t1 interval to draw from
* @param t2 interval to draw to
*/ */
public void draw(Color color, float t1, float t2) { public void draw(Color color, float t1, float t2) {
if (curve == null) if (curve == null)
@ -145,7 +146,7 @@ public abstract class Curve {
hitCircleOverlay.drawCentered(curve[i].x, curve[i].y, Colors.WHITE_FADE); hitCircleOverlay.drawCentered(curve[i].x, curve[i].y, Colors.WHITE_FADE);
float a = fallbackSliderColor.a; float a = fallbackSliderColor.a;
fallbackSliderColor.a = color.a; fallbackSliderColor.a = color.a;
for (int i = 0; i < drawUpTo; i++) for (int i = drawFrom; i < drawUpTo; i++)
hitCircle.drawCentered(curve[i].x, curve[i].y, fallbackSliderColor); hitCircle.drawCentered(curve[i].x, curve[i].y, fallbackSliderColor);
fallbackSliderColor.a = a; fallbackSliderColor.a = a;
} }
@ -154,7 +155,7 @@ public abstract class Curve {
else { else {
if (renderState == null) if (renderState == null)
renderState = new CurveRenderState(hitObject, curve); renderState = new CurveRenderState(hitObject, curve);
renderState.draw(color, borderColor, t1, t2); renderState.draw(color, borderColor, t1, t2); // TODO
} }
} }

View File

@ -143,6 +143,8 @@ public class CurveRenderState {
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
} }
if (firstPointDrawn != drawFrom) { if (firstPointDrawn != drawFrom) {
GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
firstPointDrawn = drawFrom; firstPointDrawn = drawFrom;
this.renderCurve(color, borderColor, drawFrom, drawUpTo, true); this.renderCurve(color, borderColor, drawFrom, drawUpTo, true);
} else { } else {

View File

@ -1455,15 +1455,17 @@ public class Game extends BasicGameState {
this.leadInTime += epiImgTime; this.leadInTime += epiImgTime;
SoundController.mute(false); SoundController.mute(false);
// let's create knorkesliders if (Options.isMergingSliders()) {
List<Vec2f> curvepoints = new ArrayList<>(); // let's create knorkesliders
for (GameObject gameObject : gameObjects) { List<Vec2f> curvepoints = new ArrayList<>();
if (gameObject.isSlider()) { for (GameObject gameObject : gameObjects) {
((Slider) gameObject).baseSliderFrom = curvepoints.size(); if (gameObject.isSlider()) {
curvepoints.addAll(Arrays.asList(((Slider) gameObject).getCurve().getCurvePoints())); ((Slider) gameObject).baseSliderFrom = curvepoints.size();
curvepoints.addAll(Arrays.asList(((Slider) gameObject).getCurve().getCurvePoints()));
}
} }
knorkesliders = new FakeCombinedCurve(curvepoints.toArray(new Vec2f[curvepoints.size()]));
} }
knorkesliders = new FakeCombinedCurve(curvepoints.toArray(new Vec2f[curvepoints.size()]));
} }
slidercurveFrom = 0; slidercurveFrom = 0;
@ -1527,7 +1529,9 @@ public class Game extends BasicGameState {
* @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); if (Options.isMergingSliders()) {
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 &&

View File

@ -82,7 +82,9 @@ public class OptionsMenu extends BasicGameState {
GameOption.FORCE_DEFAULT_PLAYFIELD, GameOption.FORCE_DEFAULT_PLAYFIELD,
GameOption.IGNORE_BEATMAP_SKINS, GameOption.IGNORE_BEATMAP_SKINS,
GameOption.SNAKING_SLIDERS, GameOption.SNAKING_SLIDERS,
GameOption.SHRINKING_SLIDERS,
GameOption.FALLBACK_SLIDERS, GameOption.FALLBACK_SLIDERS,
GameOption.MERGING_SLIDERS,
GameOption.SHOW_HIT_LIGHTING, GameOption.SHOW_HIT_LIGHTING,
GameOption.SHOW_COMBO_BURSTS, GameOption.SHOW_COMBO_BURSTS,
GameOption.SHOW_PERFECT_HIT, GameOption.SHOW_PERFECT_HIT,