Instantly show hitresult on slider initial circle, don't show the other end when finishing. Also show results in mirrored circles

This commit is contained in:
yugecin 2016-09-30 23:48:02 +02:00
parent 5b264a5277
commit b1d69cf9f4
2 changed files with 45 additions and 11 deletions

View File

@ -43,6 +43,7 @@ import org.newdawn.slick.Animation;
import org.newdawn.slick.Color; import org.newdawn.slick.Color;
import org.newdawn.slick.Graphics; import org.newdawn.slick.Graphics;
import org.newdawn.slick.Image; import org.newdawn.slick.Image;
import yugecin.opsudance.Dancer;
/** /**
* Holds game data and renders all related elements. * Holds game data and renders all related elements.
@ -150,7 +151,8 @@ public class GameData {
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 result-related images (indexed by HIT_* constants). */ /** Hit result-related images (indexed by HIT_* constants). */
private Image[] hitResults; private Image[] hitResults;
@ -928,6 +930,19 @@ public class GameData {
} }
} }
if (hitResult.result == HIT_SLIDER_INITIAL) {
float progress = AnimationEquation.OUT_CUBIC.calc(
(float) Utils.clamp(trackPosition - hitResult.time, 0, HITCIRCLE_FADE_TIME) / HITCIRCLE_FADE_TIME);
float scale = (!hitResult.expand) ? 1f : 1f + (HITCIRCLE_ANIM_SCALE - 1f) * progress;
float alpha = 1f - progress;
Image scaledHitCircle = GameImage.HITCIRCLE.getImage().getScaledCopy(scale);
Image scaledHitCircleOverlay = GameImage.HITCIRCLE_OVERLAY.getImage().getScaledCopy(scale);
scaledHitCircle.setAlpha(alpha);
scaledHitCircleOverlay.setAlpha(alpha);
scaledHitCircle.drawCentered(hitResult.x, hitResult.y, hitResult.color);
scaledHitCircleOverlay.drawCentered(hitResult.x, hitResult.y);
}
// hit result // hit result
if (!hitResult.hideResult && ( if (!hitResult.hideResult && (
hitResult.hitResultType == HitObjectType.CIRCLE || hitResult.hitResultType == HitObjectType.CIRCLE ||
@ -1181,6 +1196,20 @@ public class GameData {
health = 0f; health = 0f;
} }
public void sendInitialSliderResult(int time, float x, float y, Color color, Color mirrorcolor) {
hitResultList.add(new HitObjectResult(time, HIT_SLIDER_INITIAL, x, y, color, null, null, true, false));
if (!Dancer.mirror) {
return;
}
double dx = x - Options.width / 2d;
double dy = y - Options.height / 2d;
double ang = Math.atan2(dy, dx);
double d = -Math.sqrt(dx * dx + dy * dy);
x = (float) (Options.width / 2d + Math.cos(ang) * d);
y = (float) (Options.height / 2d + Math.sin(ang) * d);
hitResultList.add(new HitObjectResult(time, HIT_SLIDER_INITIAL, x, y, mirrorcolor, null, null, true, false));
}
/** /**
* Handles a slider tick result. * Handles a slider tick result.
* @param time the tick start time * @param time the tick start time
@ -1383,6 +1412,7 @@ public class GameData {
boolean hideResult = (hitResult == HIT_300 || hitResult == HIT_300G || hitResult == HIT_300K) && !Options.isPerfectHitBurstEnabled(); boolean hideResult = (hitResult == HIT_300 || hitResult == HIT_300G || hitResult == HIT_300K) && !Options.isPerfectHitBurstEnabled();
hitResultList.add(new HitObjectResult(time, hitResult, x, y, color, hitResultType, curve, expand, hideResult)); hitResultList.add(new HitObjectResult(time, hitResult, x, y, color, hitResultType, curve, expand, hideResult));
/*
// sliders: add the other curve endpoint for the hit animation // sliders: add the other curve endpoint for the hit animation
if (curve != null) { if (curve != null) {
boolean isFirst = (hitResultType == HitObjectType.SLIDER_FIRST); boolean isFirst = (hitResultType == HitObjectType.SLIDER_FIRST);
@ -1390,6 +1420,7 @@ public class GameData {
HitObjectType type = (isFirst) ? HitObjectType.SLIDER_LAST : HitObjectType.SLIDER_FIRST; HitObjectType type = (isFirst) ? HitObjectType.SLIDER_LAST : HitObjectType.SLIDER_FIRST;
hitResultList.add(new HitObjectResult(time, hitResult, p.x, p.y, color, type, null, expand, hideResult)); hitResultList.add(new HitObjectResult(time, hitResult, p.x, p.y, color, type, null, expand, hideResult));
} }
*/
} }
/** /**

View File

@ -219,10 +219,12 @@ public class Slider extends GameObject {
hitCircleOverlay.drawCentered(endCircPos.x, endCircPos.y, Colors.WHITE_FADE); hitCircleOverlay.drawCentered(endCircPos.x, endCircPos.y, Colors.WHITE_FADE);
*/ */
// start circle // start circle, don't draw if already clicked
if (!sliderClickedInitial) {
hitCircle.drawCentered(x, y, color); hitCircle.drawCentered(x, y, color);
if (!overlayAboveNumber) if (!overlayAboveNumber)
hitCircleOverlay.drawCentered(x, y, Colors.WHITE_FADE); hitCircleOverlay.drawCentered(x, y, Colors.WHITE_FADE);
}
g.popTransform(); g.popTransform();
@ -256,13 +258,13 @@ public class Slider extends GameObject {
alpha = Math.min(alpha, hiddenAlpha); alpha = Math.min(alpha, hiddenAlpha);
} }
} }
if (sliderClickedInitial)
; // don't draw current combo number if already clicked if (!sliderClickedInitial) {
else
data.drawSymbolNumber(hitObject.getComboNumber(), x, y, data.drawSymbolNumber(hitObject.getComboNumber(), x, y,
hitCircle.getWidth() * 0.40f / data.getDefaultSymbolImage(0).getHeight(), alpha); hitCircle.getWidth() * 0.40f / data.getDefaultSymbolImage(0).getHeight(), alpha);
if (overlayAboveNumber) if (overlayAboveNumber)
hitCircleOverlay.drawCentered(x, y, Colors.WHITE_FADE); hitCircleOverlay.drawCentered(x, y, Colors.WHITE_FADE);
}
g.popTransform(); g.popTransform();
@ -484,6 +486,7 @@ public class Slider extends GameObject {
ticksHit++; ticksHit++;
sliderClickedInitial = true; sliderClickedInitial = true;
data.sliderTickResult(time, GameData.HIT_SLIDER30, x, y, hitObject, currentRepeats); data.sliderTickResult(time, GameData.HIT_SLIDER30, x, y, hitObject, currentRepeats);
data.sendInitialSliderResult(time, x, y, color, mirrorColor);
} }
} }