Draw cursor location in "auto" mod.
Moves the cursor between hit objects and along hit object paths (slider curves, spinner circles).
- Added 'getPointAt(trackPosition)' and 'getEndTime()' methods to HitObject interface.
- Unhide default cursor for "auto" plays.
Other changes:
- Don't save replays for unranked plays ("auto", "relax", "autopilot" mods).
- For "auto" replays, don't parse replay frames: use default "auto" behavior instead.
- Fixed cursor location data not being reset upon entering states.
Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
@@ -180,4 +180,10 @@ public class Circle implements HitObject {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float[] getPointAt(int trackPosition) { return new float[] { x, y }; }
|
||||
|
||||
@Override
|
||||
public int getEndTime() { return hitObject.getTime(); }
|
||||
}
|
||||
@@ -49,4 +49,17 @@ public interface HitObject {
|
||||
* @return true if a hit result was processed
|
||||
*/
|
||||
public boolean mousePressed(int x, int y);
|
||||
|
||||
/**
|
||||
* Returns the coordinates of the hit object at a given track position.
|
||||
* @param trackPosition the track position
|
||||
* @return the [x,y] coordinates
|
||||
*/
|
||||
public float[] getPointAt(int trackPosition);
|
||||
|
||||
/**
|
||||
* Returns the end time of the hit object.
|
||||
* @return the end time, in milliseconds
|
||||
*/
|
||||
public int getEndTime();
|
||||
}
|
||||
|
||||
@@ -458,6 +458,24 @@ public class Slider implements HitObject {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float[] getPointAt(int trackPosition) {
|
||||
if (trackPosition <= hitObject.getTime())
|
||||
return new float[] { x, y };
|
||||
else if (trackPosition >= hitObject.getTime() + sliderTimeTotal) {
|
||||
if (hitObject.getRepeatCount() % 2 == 0)
|
||||
return new float[] { x, y };
|
||||
else {
|
||||
int lastIndex = hitObject.getSliderX().length;
|
||||
return new float[] { curve.getX(lastIndex), curve.getY(lastIndex) };
|
||||
}
|
||||
} else
|
||||
return curve.pointAt(getT(trackPosition, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEndTime() { return hitObject.getTime() + (int) sliderTimeTotal; }
|
||||
|
||||
/**
|
||||
* Returns the t value based on the given track position.
|
||||
* @param trackPosition the current track position
|
||||
|
||||
@@ -51,7 +51,9 @@ public class Spinner implements HitObject {
|
||||
private static final int FADE_IN_TIME = 500;
|
||||
|
||||
/** PI constants. */
|
||||
private static final float TWO_PI = (float) (Math.PI * 2);
|
||||
private static final float
|
||||
TWO_PI = (float) (Math.PI * 2),
|
||||
HALF_PI = (float) (Math.PI / 2);
|
||||
|
||||
/** The associated OsuHitObject. */
|
||||
private OsuHitObject hitObject;
|
||||
@@ -261,6 +263,30 @@ public class Spinner implements HitObject {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float[] getPointAt(int trackPosition) {
|
||||
// get spinner time
|
||||
int timeDiff;
|
||||
float x = hitObject.getScaledX(), y = hitObject.getScaledY();
|
||||
if (trackPosition <= hitObject.getTime())
|
||||
timeDiff = 0;
|
||||
else if (trackPosition >= hitObject.getEndTime())
|
||||
timeDiff = hitObject.getEndTime() - hitObject.getTime();
|
||||
else
|
||||
timeDiff = trackPosition - hitObject.getTime();
|
||||
|
||||
// calculate point
|
||||
float angle = timeDiff / 20f - HALF_PI;
|
||||
final float r = height / 10f;
|
||||
return new float[] {
|
||||
(float) (x + r * Math.cos(angle)),
|
||||
(float) (y + r * Math.sin(angle))
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEndTime() { return hitObject.getEndTime(); }
|
||||
|
||||
/**
|
||||
* Rotates the spinner by an angle.
|
||||
* @param angle the angle to rotate (in radians)
|
||||
|
||||
Reference in New Issue
Block a user