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:
Jeffrey Han
2015-03-17 14:48:13 -04:00
parent f23159d003
commit e6206e52d4
6 changed files with 170 additions and 11 deletions

View File

@@ -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)