Follow-up to #71.
- Fixed a major bug where two hit result calculations were being performed for each slider. - Fixed a bug where hit circles/sliders were being drawn for a miss. - Sliders now only expand when held to the end (as in osu!). - Use the track position as the hit result start time for circles (instead of the object time). - Added a 'color' parameter to Curve.draw(), rather than keeping an extra reference to the slider Color object. - Renamed HitResultType enum to HitObjectType, and moved it into GameData. - Removed some overloaded methods (not really necessary...). - Other style changes. Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
package itdelatrisu.opsu.objects;
|
||||
|
||||
import itdelatrisu.opsu.GameData;
|
||||
import itdelatrisu.opsu.GameData.HitObjectType;
|
||||
import itdelatrisu.opsu.GameImage;
|
||||
import itdelatrisu.opsu.GameMod;
|
||||
import itdelatrisu.opsu.OsuHitObject;
|
||||
@@ -138,7 +139,7 @@ public class Circle implements HitObject {
|
||||
|
||||
if (result > -1) {
|
||||
data.addHitError(hitObject.getTime(), x, y, timeDiff);
|
||||
data.hitResult(hitObject.getTime(), result, this.x, this.y, color, comboEnd, hitObject, 0, HitResultType.CIRCLE);
|
||||
data.hitResult(trackPosition, result, this.x, this.y, color, comboEnd, hitObject, 0, HitObjectType.CIRCLE, null, true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -154,17 +155,17 @@ public class Circle implements HitObject {
|
||||
|
||||
if (overlap || trackPosition > time + hitResultOffset[GameData.HIT_50]) {
|
||||
if (isAutoMod) // "auto" mod: catch any missed notes due to lag
|
||||
data.hitResult(time, GameData.HIT_300, x, y, color, comboEnd, hitObject, 0, HitResultType.CIRCLE);
|
||||
data.hitResult(time, GameData.HIT_300, x, y, color, comboEnd, hitObject, 0, HitObjectType.CIRCLE, null, true);
|
||||
|
||||
else // no more points can be scored, so send a miss
|
||||
data.hitResult(time, GameData.HIT_MISS, x, y, null, comboEnd, hitObject, 0, HitResultType.CIRCLE);
|
||||
data.hitResult(trackPosition, GameData.HIT_MISS, x, y, null, comboEnd, hitObject, 0, HitObjectType.CIRCLE, null, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
// "auto" mod: send a perfect hit result
|
||||
else if (isAutoMod) {
|
||||
if (Math.abs(trackPosition - time) < hitResultOffset[GameData.HIT_300]) {
|
||||
data.hitResult(time, GameData.HIT_300, x, y, color, comboEnd, hitObject, 0, HitResultType.CIRCLE);
|
||||
data.hitResult(time, GameData.HIT_300, x, y, color, comboEnd, hitObject, 0, HitObjectType.CIRCLE, null, true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
package itdelatrisu.opsu.objects;
|
||||
|
||||
public enum HitResultType {
|
||||
CIRCLE,
|
||||
//SLIDERSTART,
|
||||
SLIDERTICK,
|
||||
SLIDEREND,
|
||||
SLIDEREND_FIRSTOBJECT,
|
||||
SPINNER
|
||||
}
|
||||
@@ -19,6 +19,7 @@
|
||||
package itdelatrisu.opsu.objects;
|
||||
|
||||
import itdelatrisu.opsu.GameData;
|
||||
import itdelatrisu.opsu.GameData.HitObjectType;
|
||||
import itdelatrisu.opsu.GameImage;
|
||||
import itdelatrisu.opsu.GameMod;
|
||||
import itdelatrisu.opsu.OsuFile;
|
||||
@@ -172,7 +173,7 @@ public class Slider implements HitObject {
|
||||
Utils.COLOR_WHITE_FADE.a = color.a = alpha;
|
||||
|
||||
// curve
|
||||
curve.draw();
|
||||
curve.draw(color);
|
||||
|
||||
// ticks
|
||||
if (ticksT != null) {
|
||||
@@ -278,13 +279,20 @@ public class Slider implements HitObject {
|
||||
else
|
||||
result = GameData.HIT_MISS;
|
||||
|
||||
float[] lastPos = curve.pointAt(1);
|
||||
float cx, cy;
|
||||
HitObjectType type;
|
||||
if (currentRepeats % 2 == 0) { // last circle
|
||||
float[] lastPos = curve.pointAt(1);
|
||||
cx = lastPos[0];
|
||||
cy = lastPos[1];
|
||||
type = HitObjectType.SLIDER_LAST;
|
||||
} else { // first circle
|
||||
cx = x;
|
||||
cy = y;
|
||||
type = HitObjectType.SLIDER_FIRST;
|
||||
}
|
||||
data.hitResult(hitObject.getTime() + (int) sliderTimeTotal, result,
|
||||
x, y, color, comboEnd, hitObject, currentRepeats + 1,
|
||||
currentRepeats % 2 == 0 ? HitResultType.SLIDEREND_FIRSTOBJECT : HitResultType.SLIDEREND, curve);
|
||||
data.hitResult(hitObject.getTime() + (int) sliderTimeTotal, result,
|
||||
lastPos[0], lastPos[1], color, comboEnd, hitObject, currentRepeats + 1,
|
||||
currentRepeats % 2 == 0 ? HitResultType.SLIDEREND : HitResultType.SLIDEREND_FIRSTOBJECT);
|
||||
cx, cy, color, comboEnd, hitObject, currentRepeats + 1, type, curve, sliderClickedFinal);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
package itdelatrisu.opsu.objects;
|
||||
|
||||
import itdelatrisu.opsu.GameData;
|
||||
import itdelatrisu.opsu.GameData.HitObjectType;
|
||||
import itdelatrisu.opsu.GameImage;
|
||||
import itdelatrisu.opsu.GameMod;
|
||||
import itdelatrisu.opsu.OsuHitObject;
|
||||
@@ -191,7 +192,7 @@ public class Spinner implements HitObject {
|
||||
result = GameData.HIT_MISS;
|
||||
|
||||
data.hitResult(hitObject.getEndTime(), result, width / 2, height / 2,
|
||||
Color.transparent, true, hitObject, 0, HitResultType.SPINNER);
|
||||
Color.transparent, true, hitObject, 0, HitObjectType.SPINNER, null, true);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -179,7 +179,7 @@ public class CircumscribedCircle extends Curve {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw() {
|
||||
public void draw(Color color) {
|
||||
Image hitCircle = GameImage.HITCIRCLE.getImage();
|
||||
Image hitCircleOverlay = GameImage.HITCIRCLE_OVERLAY.getImage();
|
||||
for (int i = 0; i < step; i++)
|
||||
|
||||
@@ -28,9 +28,6 @@ import org.newdawn.slick.Color;
|
||||
* @author fluddokt (https://github.com/fluddokt)
|
||||
*/
|
||||
public abstract class Curve {
|
||||
/** The color of this curve. */
|
||||
public Color color;
|
||||
|
||||
/** The associated OsuHitObject. */
|
||||
protected OsuHitObject hitObject;
|
||||
|
||||
@@ -51,7 +48,6 @@ public abstract class Curve {
|
||||
this.y = hitObject.getScaledY();
|
||||
this.sliderX = hitObject.getScaledSliderX();
|
||||
this.sliderY = hitObject.getScaledSliderY();
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -63,8 +59,9 @@ public abstract class Curve {
|
||||
|
||||
/**
|
||||
* Draws the full curve to the graphics context.
|
||||
* @param color the color filter
|
||||
*/
|
||||
public abstract void draw();
|
||||
public abstract void draw(Color color);
|
||||
|
||||
/**
|
||||
* Returns the angle of the first control point.
|
||||
|
||||
@@ -164,7 +164,7 @@ public class LinearBezier extends Curve {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw() {
|
||||
public void draw(Color color) {
|
||||
Image hitCircle = GameImage.HITCIRCLE.getImage();
|
||||
Image hitCircleOverlay = GameImage.HITCIRCLE_OVERLAY.getImage();
|
||||
for (int i = curve.length - 2; i >= 0; i--)
|
||||
|
||||
Reference in New Issue
Block a user