Merge remote-tracking branch 'remotes/yugefork/slider-improvements'

# Conflicts:
#	src/itdelatrisu/opsu/GameData.java
#	src/itdelatrisu/opsu/objects/Slider.java
This commit is contained in:
yugecin 2016-12-12 01:35:33 +01:00
commit 1bf9186685
2 changed files with 63 additions and 16 deletions

View File

@ -141,17 +141,18 @@ public class GameData {
/** Hit result types. */ /** Hit result types. */
public static final int public static final int
HIT_MISS = 0, HIT_MISS = 0,
HIT_50 = 1, HIT_50 = 1,
HIT_100 = 2, HIT_100 = 2,
HIT_300 = 3, HIT_300 = 3,
HIT_100K = 4, // 100-Katu HIT_100K = 4, // 100-Katu
HIT_300K = 5, // 300-Katu HIT_300K = 5, // 300-Katu
HIT_300G = 6, // Geki HIT_300G = 6, // Geki
HIT_SLIDER10 = 7, HIT_SLIDER10 = 7,
HIT_SLIDER30 = 8, HIT_SLIDER30 = 8,
HIT_MAX = 9, // not a hit result HIT_MAX = 9, // not a hit result
HIT_SLIDER_INITIAL = 10; HIT_SLIDER_INITIAL = 10, // not a hit result
HIT_SLIDER_REPEAT = 11; // not a hit result
/** Hit result-related images (indexed by HIT_* constants). */ /** Hit result-related images (indexed by HIT_* constants). */
private Image[] hitResults; private Image[] hitResults;
@ -908,8 +909,21 @@ public class GameData {
float scale = (!hitResult.expand) ? 1f : 1f + (HITCIRCLE_ANIM_SCALE - 1f) * progress; float scale = (!hitResult.expand) ? 1f : 1f + (HITCIRCLE_ANIM_SCALE - 1f) * progress;
float alpha = 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 // "hidden" mod: circle and slider animations not drawn
if (!GameMod.HIDDEN.isActive()) { else if (!GameMod.HIDDEN.isActive()) {
// slider curve // slider curve
if (hitResult.curve != null) { if (hitResult.curve != null) {
float oldWhiteAlpha = Colors.WHITE_FADE.a; float oldWhiteAlpha = Colors.WHITE_FADE.a;
@ -1197,6 +1211,10 @@ public class GameData {
hitResultList.add(new HitObjectResult(time, HIT_SLIDER_INITIAL, m[0], m[1], mirrorcolor, null, null, true, false)); hitResultList.add(new HitObjectResult(time, HIT_SLIDER_INITIAL, m[0], m[1], mirrorcolor, null, null, true, false));
} }
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. * Handles a slider tick result.
* @param time the tick start time * @param time the tick start time

View File

@ -251,7 +251,7 @@ public class Slider extends GameObject {
// ticks // ticks
if (ticksT != null) { if (ticksT != null) {
drawSliderTicks(g, trackPosition, curveAlpha, decorationsAlpha, mirror); drawSliderTicks(trackPosition, sliderAlpha, decorationsAlpha, mirror);
Colors.WHITE_FADE.a = alpha; Colors.WHITE_FADE.a = alpha;
} }
@ -363,12 +363,12 @@ public class Slider extends GameObject {
/** /**
* Draws slider ticks. * Draws slider ticks.
* @param g the graphics context
* @param trackPosition the track position * @param trackPosition the track position
* @param curveAlpha the curve alpha level * @param curveAlpha the curve alpha level
* @param decorationsAlpha the decorations alpha level * @param decorationsAlpha the decorations alpha level
* @param mirror true to draw mirrored
*/ */
private void drawSliderTicks(Graphics g, int trackPosition, float curveAlpha, float decorationsAlpha, boolean mirror) { private void drawSliderTicks(int trackPosition, float curveAlpha, float decorationsAlpha, boolean mirror) {
float tickScale = 0.5f + 0.5f * AnimationEquation.OUT_BACK.calc(decorationsAlpha); float tickScale = 0.5f + 0.5f * AnimationEquation.OUT_BACK.calc(decorationsAlpha);
Image tick = GameImage.SLIDER_TICK.getImage().getScaledCopy(tickScale); Image tick = GameImage.SLIDER_TICK.getImage().getScaledCopy(tickScale);
@ -388,10 +388,22 @@ public class Slider extends GameObject {
min = 0; 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 // draw ticks
Colors.WHITE_FADE.a = Math.min(curveAlpha, sliderTickAlpha);
for (int i = min; i < max; i++) { for (int i = min; i < max; i++) {
Vec2f c = curve.pointAt(ticksT[i]); Vec2f c = curve.pointAt(ticksT[i]);
Colors.WHITE_FADE.a = Math.min(curveAlpha, decorationsAlpha);
g.pushTransform(); g.pushTransform();
if (mirror) { if (mirror) {
g.rotate(c.x, c.y, -180f); g.rotate(c.x, c.y, -180f);
@ -633,6 +645,23 @@ public class Slider extends GameObject {
tickIndex = 0; tickIndex = 0;
isNewRepeat = true; isNewRepeat = true;
tickExpandTime = TICK_EXPAND_TIME; 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);
} }
} }