Merge branch 'hitresults'
This commit is contained in:
commit
fcd9efc7f7
|
@ -43,6 +43,7 @@ import org.newdawn.slick.Animation;
|
|||
import org.newdawn.slick.Color;
|
||||
import org.newdawn.slick.Graphics;
|
||||
import org.newdawn.slick.Image;
|
||||
import yugecin.opsudance.Dancer;
|
||||
|
||||
/**
|
||||
* Holds game data and renders all related elements.
|
||||
|
@ -150,7 +151,8 @@ public class GameData {
|
|||
HIT_300G = 6, // Geki
|
||||
HIT_SLIDER10 = 7,
|
||||
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). */
|
||||
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
|
||||
if (!hitResult.hideResult && (
|
||||
hitResult.hitResultType == HitObjectType.CIRCLE ||
|
||||
|
@ -1181,6 +1196,15 @@ public class GameData {
|
|||
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;
|
||||
}
|
||||
float[] m = Utils.mirrorPoint(x, y);
|
||||
hitResultList.add(new HitObjectResult(time, HIT_SLIDER_INITIAL, m[0], m[1], mirrorcolor, null, null, true, false));
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles a slider tick result.
|
||||
* @param time the tick start time
|
||||
|
@ -1383,6 +1407,7 @@ public class GameData {
|
|||
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));
|
||||
|
||||
/*
|
||||
// sliders: add the other curve endpoint for the hit animation
|
||||
if (curve != null) {
|
||||
boolean isFirst = (hitResultType == HitObjectType.SLIDER_FIRST);
|
||||
|
@ -1390,6 +1415,7 @@ public class GameData {
|
|||
HitObjectType type = (isFirst) ? HitObjectType.SLIDER_LAST : HitObjectType.SLIDER_FIRST;
|
||||
hitResultList.add(new HitObjectResult(time, hitResult, p.x, p.y, color, type, null, expand, hideResult));
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -590,4 +590,15 @@ public class Utils {
|
|||
}
|
||||
*/
|
||||
|
||||
public static float[] mirrorPoint(float x, float y) {
|
||||
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);
|
||||
return new float[]{
|
||||
(float) (Options.width / 2d + Math.cos(ang) * d),
|
||||
(float) (Options.height / 2d + Math.sin(ang) * d)
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -187,8 +187,13 @@ public class Circle extends GameObject {
|
|||
boolean isAutoMod = GameMod.AUTO.isActive();
|
||||
|
||||
if (trackPosition > time + hitResultOffset[GameData.HIT_50]) {
|
||||
if (isAutoMod) // "auto" mod: catch any missed notes due to lag
|
||||
if (isAutoMod) {// "auto" mod: catch any missed notes due to lag
|
||||
data.hitResult(time, GameData.HIT_300, x, y, color, comboEnd, hitObject, HitObjectType.CIRCLE, true, 0, null, false);
|
||||
if (Dancer.mirror) {
|
||||
float[] m = Utils.mirrorPoint(x, y);
|
||||
data.hitResult(time, GameData.HIT_300, m[0], m[1], mirrorColor, comboEnd, hitObject, HitObjectType.CIRCLE, true, 0, null, false);
|
||||
}
|
||||
}
|
||||
|
||||
else // no more points can be scored, so send a miss
|
||||
data.hitResult(trackPosition, GameData.HIT_MISS, x, y, null, comboEnd, hitObject, HitObjectType.CIRCLE, true, 0, null, false);
|
||||
|
@ -199,6 +204,10 @@ public class Circle extends GameObject {
|
|||
else if (isAutoMod) {
|
||||
if (Math.abs(trackPosition - time) < hitResultOffset[GameData.HIT_300]) {
|
||||
data.hitResult(time, GameData.HIT_300, x, y, color, comboEnd, hitObject, HitObjectType.CIRCLE, true, 0, null, false);
|
||||
if (Dancer.mirror) {
|
||||
float[] m = Utils.mirrorPoint(x, y);
|
||||
data.hitResult(time, GameData.HIT_300, m[0], m[1], mirrorColor, comboEnd, hitObject, HitObjectType.CIRCLE, true, 0, null, false);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -219,10 +219,12 @@ public class Slider extends GameObject {
|
|||
hitCircleOverlay.drawCentered(endCircPos.x, endCircPos.y, Colors.WHITE_FADE);
|
||||
*/
|
||||
|
||||
// start circle
|
||||
hitCircle.drawCentered(x, y, color);
|
||||
if (!overlayAboveNumber)
|
||||
hitCircleOverlay.drawCentered(x, y, Colors.WHITE_FADE);
|
||||
// start circle, don't draw if already clicked
|
||||
if (!sliderClickedInitial) {
|
||||
hitCircle.drawCentered(x, y, color);
|
||||
if (!overlayAboveNumber)
|
||||
hitCircleOverlay.drawCentered(x, y, Colors.WHITE_FADE);
|
||||
}
|
||||
|
||||
g.popTransform();
|
||||
|
||||
|
@ -256,13 +258,13 @@ public class Slider extends GameObject {
|
|||
alpha = Math.min(alpha, hiddenAlpha);
|
||||
}
|
||||
}
|
||||
if (sliderClickedInitial)
|
||||
; // don't draw current combo number if already clicked
|
||||
else
|
||||
|
||||
if (!sliderClickedInitial) {
|
||||
data.drawSymbolNumber(hitObject.getComboNumber(), x, y,
|
||||
hitCircle.getWidth() * 0.40f / data.getDefaultSymbolImage(0).getHeight(), alpha);
|
||||
if (overlayAboveNumber)
|
||||
hitCircleOverlay.drawCentered(x, y, Colors.WHITE_FADE);
|
||||
hitCircle.getWidth() * 0.40f / data.getDefaultSymbolImage(0).getHeight(), alpha);
|
||||
if (overlayAboveNumber)
|
||||
hitCircleOverlay.drawCentered(x, y, Colors.WHITE_FADE);
|
||||
}
|
||||
|
||||
g.popTransform();
|
||||
|
||||
|
@ -427,6 +429,12 @@ public class Slider extends GameObject {
|
|||
data.hitResult(hitObject.getTime() + (int) sliderTimeTotal, result,
|
||||
cx, cy, color, comboEnd, hitObject, type, sliderHeldToEnd,
|
||||
currentRepeats + 1, curve, sliderHeldToEnd);
|
||||
if (Dancer.mirror) {
|
||||
float[] m = Utils.mirrorPoint(cx, cy);
|
||||
data.hitResult(hitObject.getTime() + (int) sliderTimeTotal, result,
|
||||
m[0], m[1], mirrorColor, comboEnd, hitObject, type, sliderHeldToEnd,
|
||||
currentRepeats + 1, curve, sliderHeldToEnd);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -484,6 +492,7 @@ public class Slider extends GameObject {
|
|||
ticksHit++;
|
||||
sliderClickedInitial = true;
|
||||
data.sliderTickResult(time, GameData.HIT_SLIDER30, x, y, hitObject, currentRepeats);
|
||||
data.sendInitialSliderResult(time, x, y, color, mirrorColor);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user