Implemented saving/loading from checkpoints.

- A checkpoint (track position) can be set in the options screen, and also while playing by pressing "CTRL+S".
- A checkpoint can be loaded by pressing "CTRL+L" while playing.  This will reset all game data and begin from the checkpoint time; the ranking screen will be skipped upon song completion.

Other changes:
- Don't draw grade if no objects have been processed (previously defaulted to GRADE_D).
- Calculate slider start/end angles based on a step difference (previously an arbitrary 0.01 difference).
- Always end a slider curve base on the last control point.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
Jeffrey Han
2014-07-08 22:17:48 -04:00
parent 2ed8e66bbf
commit 50fb71e353
5 changed files with 129 additions and 20 deletions

View File

@@ -160,22 +160,24 @@ public class Slider {
// calculate curve points for drawing
int N = (int) (1 / step);
this.curveX = new float[N];
this.curveY = new float[N];
this.curveX = new float[N + 1];
this.curveY = new float[N + 1];
float t = 0f;
for (int i = 0; i < N; i++, t += step) {
float[] c = pointAt(t);
curveX[i] = c[0];
curveY[i] = c[1];
}
curveX[N] = getX(order - 1);
curveY[N] = getY(order - 1);
// calculate angles (if needed)
if (hitObject.repeat > 1) {
float[] c1 = pointAt(0f);
float[] c2 = pointAt(0.01f);
float[] c2 = pointAt(step);
startAngle = (float) (Math.atan2(c2[1] - c1[1], c2[0] - c1[0]) * 180 / Math.PI);
c1 = pointAt(1f);
c2 = pointAt(0.99f);
c2 = pointAt(1f - step);
endAngle = (float) (Math.atan2(c2[1] - c1[1], c2[0] - c1[0]) * 180 / Math.PI);
}
}