From 83466c9ef56c4840a0c23120356361301d31f302 Mon Sep 17 00:00:00 2001 From: yugecin Date: Mon, 12 Dec 2016 01:05:32 +0100 Subject: [PATCH 1/3] fade out reversearrows after ball passed them --- src/itdelatrisu/opsu/GameData.java | 40 +++++++++++++++++------- src/itdelatrisu/opsu/objects/Slider.java | 17 ++++++++++ 2 files changed, 46 insertions(+), 11 deletions(-) diff --git a/src/itdelatrisu/opsu/GameData.java b/src/itdelatrisu/opsu/GameData.java index baa77e8e..1dace8b6 100644 --- a/src/itdelatrisu/opsu/GameData.java +++ b/src/itdelatrisu/opsu/GameData.java @@ -141,16 +141,17 @@ public class GameData { /** Hit result types. */ public static final int - HIT_MISS = 0, - HIT_50 = 1, - HIT_100 = 2, - HIT_300 = 3, - HIT_100K = 4, // 100-Katu - HIT_300K = 5, // 300-Katu - HIT_300G = 6, // Geki - HIT_SLIDER10 = 7, - HIT_SLIDER30 = 8, - HIT_MAX = 9; // not a hit result + HIT_MISS = 0, + HIT_50 = 1, + HIT_100 = 2, + HIT_300 = 3, + HIT_100K = 4, // 100-Katu + HIT_300K = 5, // 300-Katu + HIT_300G = 6, // Geki + HIT_SLIDER10 = 7, + HIT_SLIDER30 = 8, + HIT_MAX = 9, // not a hit result + HIT_SLIDER_REPEAT = 10; // not a hit result /** Hit result-related images (indexed by HIT_* constants). */ private Image[] hitResults; @@ -901,8 +902,21 @@ public class GameData { float scale = (!hitResult.expand) ? 1f : 1f + (HITCIRCLE_ANIM_SCALE - 1f) * progress; float alpha = 1f - progress; + if (hitResult.result == HIT_SLIDER_REPEAT) { + // repeats + Image scaledRepeat = GameImage.REVERSEARROW.getImage().getScaledCopy(scale); + scaledRepeat.setAlpha(alpha); + float ang; + if (hitResult.hitResultType == HitObjectType.SLIDER_FIRST) { + ang = hitResult.curve.getStartAngle(); + } else { + ang = hitResult.curve.getEndAngle(); + } + scaledRepeat.rotate(ang); + scaledRepeat.drawCentered(hitResult.x, hitResult.y, hitResult.color); + } // "hidden" mod: circle and slider animations not drawn - if (!GameMod.HIDDEN.isActive()) { + else if (!GameMod.HIDDEN.isActive()) { // slider curve if (hitResult.curve != null) { float oldWhiteAlpha = Colors.WHITE_FADE.a; @@ -1177,6 +1191,10 @@ public class GameData { health = 0f; } + public void sendRepeatSliderResult(int time, float x, float y, Color color, Curve curve, HitObjectType type) { + hitResultList.add(new HitObjectResult(time, HIT_SLIDER_REPEAT, x, y, color, type, curve, true, true)); + } + /** * Handles a slider tick result. * @param time the tick start time diff --git a/src/itdelatrisu/opsu/objects/Slider.java b/src/itdelatrisu/opsu/objects/Slider.java index 94e68363..a4b153bd 100644 --- a/src/itdelatrisu/opsu/objects/Slider.java +++ b/src/itdelatrisu/opsu/objects/Slider.java @@ -538,6 +538,23 @@ public class Slider implements GameObject { tickIndex = 0; isNewRepeat = true; tickExpandTime = TICK_EXPAND_TIME; + + // send hit result, to fade out reversearrow + HitObjectType type; + float posX, posY; + if (currentRepeats % 2 == 1) { + type = HitObjectType.SLIDER_LAST; + Vec2f endPos = curve.pointAt(1); + posX = endPos.x; + posY = endPos.y; + } else { + type = HitObjectType.SLIDER_FIRST; + posX = this.x; + posY = this.y; + } + float colorLuminance = 0.299f*color.r + 0.587f*color.g + 0.114f*color.b; + Color arrowColor = colorLuminance < 0.8f ? Color.white : Color.black; + data.sendRepeatSliderResult(trackPosition, posX, posY, arrowColor, curve, type); } } From a3813075d713cd60d07f448d232ca141c2677d68 Mon Sep 17 00:00:00 2001 From: yugecin Date: Mon, 12 Dec 2016 01:21:05 +0100 Subject: [PATCH 2/3] fade in sliderticks after repeat --- src/itdelatrisu/opsu/objects/Slider.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/itdelatrisu/opsu/objects/Slider.java b/src/itdelatrisu/opsu/objects/Slider.java index a4b153bd..ac494708 100644 --- a/src/itdelatrisu/opsu/objects/Slider.java +++ b/src/itdelatrisu/opsu/objects/Slider.java @@ -344,10 +344,22 @@ public class Slider implements GameObject { min = 0; } + // calculate the tick alpha level + float sliderTickAlpha; + if (currentRepeats == 0) { + sliderTickAlpha = decorationsAlpha; + } else { + float t = getT(trackPosition, false); + if (currentRepeats % 2 == 1) { + t = 1f - t; + } + sliderTickAlpha = Utils.clamp(t * ticksT.length * 2, 0f, 1f); + } + // draw ticks + Colors.WHITE_FADE.a = Math.min(curveAlpha, sliderTickAlpha); for (int i = min; i < max; i++) { Vec2f c = curve.pointAt(ticksT[i]); - Colors.WHITE_FADE.a = Math.min(curveAlpha, decorationsAlpha); tick.drawCentered(c.x, c.y, Colors.WHITE_FADE); } } From 50912cf72e97f3bafc3ed882ab4d38599d2ce0d9 Mon Sep 17 00:00:00 2001 From: yugecin Date: Mon, 12 Dec 2016 01:21:37 +0100 Subject: [PATCH 3/3] remove an unused variable --- src/itdelatrisu/opsu/objects/Slider.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/itdelatrisu/opsu/objects/Slider.java b/src/itdelatrisu/opsu/objects/Slider.java index ac494708..3830726f 100644 --- a/src/itdelatrisu/opsu/objects/Slider.java +++ b/src/itdelatrisu/opsu/objects/Slider.java @@ -219,7 +219,7 @@ public class Slider implements GameObject { // ticks if (ticksT != null) { - drawSliderTicks(g, trackPosition, sliderAlpha, decorationsAlpha); + drawSliderTicks(trackPosition, sliderAlpha, decorationsAlpha); Colors.WHITE_FADE.a = oldWhiteFadeAlpha; } @@ -319,12 +319,11 @@ public class Slider implements GameObject { /** * Draws slider ticks. - * @param g the graphics context * @param trackPosition the track position * @param curveAlpha the curve alpha level * @param decorationsAlpha the decorations alpha level */ - private void drawSliderTicks(Graphics g, int trackPosition, float curveAlpha, float decorationsAlpha) { + private void drawSliderTicks(int trackPosition, float curveAlpha, float decorationsAlpha) { float tickScale = 0.5f + 0.5f * AnimationEquation.OUT_BACK.calc(decorationsAlpha); Image tick = GameImage.SLIDER_TICK.getImage().getScaledCopy(tickScale);