Display checkpoint time on game screen after loading.
Also fixed some indentation issues. Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
parent
47cf4f4af3
commit
9d3a12ad9c
|
@ -139,14 +139,14 @@ public class MusicController {
|
|||
* Converts an MP3 file to a temporary WAV file.
|
||||
*/
|
||||
private static File convertMp3(File file) {
|
||||
try {
|
||||
try {
|
||||
wavFile = File.createTempFile(".osu", ".wav", Options.TMP_DIR);
|
||||
wavFile.deleteOnExit();
|
||||
|
||||
Converter converter = new Converter();
|
||||
converter.convert(file.getPath(), wavFile.getPath());
|
||||
return wavFile;
|
||||
} catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
Log.error(String.format("Failed to play file '%s'.", file.getAbsolutePath()), e);
|
||||
}
|
||||
return wavFile;
|
||||
|
|
|
@ -79,12 +79,12 @@ public class OszUnpacker {
|
|||
* @param dest the destination directory
|
||||
*/
|
||||
private static void unzip(File file, File dest) {
|
||||
try {
|
||||
ZipFile zipFile = new ZipFile(file);
|
||||
zipFile.extractAll(dest.getAbsolutePath());
|
||||
} catch (ZipException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
ZipFile zipFile = new ZipFile(file);
|
||||
zipFile.extractAll(dest.getAbsolutePath());
|
||||
} catch (ZipException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -145,10 +145,10 @@ public class Utils {
|
|||
// set the cursor
|
||||
try {
|
||||
// hide the native cursor
|
||||
int min = Cursor.getMinCursorSize();
|
||||
IntBuffer tmp = BufferUtils.createIntBuffer(min * min);
|
||||
Cursor emptyCursor = new Cursor(min, min, min/2, min/2, 1, tmp, null);
|
||||
container.setMouseCursor(emptyCursor, 0, 0);
|
||||
int min = Cursor.getMinCursorSize();
|
||||
IntBuffer tmp = BufferUtils.createIntBuffer(min * min);
|
||||
Cursor emptyCursor = new Cursor(min, min, min/2, min/2, 1, tmp, null);
|
||||
container.setMouseCursor(emptyCursor, 0, 0);
|
||||
} catch (LWJGLException e) {
|
||||
Log.error("Failed to set the cursor.", e);
|
||||
}
|
||||
|
|
|
@ -236,8 +236,8 @@ public class Slider {
|
|||
int n = order - 1;
|
||||
if (n < 4) { // normal curve
|
||||
for (int i = 0; i <= n; i++) {
|
||||
c[0] += getX(i) * bernstein(i, n, t);
|
||||
c[1] += getY(i) * bernstein(i, n, t);
|
||||
c[0] += getX(i) * bernstein(i, n, t);
|
||||
c[1] += getY(i) * bernstein(i, n, t);
|
||||
}
|
||||
} else { // split curve into path
|
||||
// TODO: this is probably wrong...
|
||||
|
@ -247,8 +247,8 @@ public class Slider {
|
|||
int segmentOrder = Math.min(startIndex + 3, n) - startIndex;
|
||||
float segmentT = (t * segmentCount) - segment;
|
||||
for (int i = 0; i <= segmentOrder; i++) {
|
||||
c[0] += getX(i + startIndex) * bernstein(i, segmentOrder, segmentT);
|
||||
c[1] += getY(i + startIndex) * bernstein(i, segmentOrder, segmentT);
|
||||
c[0] += getX(i + startIndex) * bernstein(i, segmentOrder, segmentT);
|
||||
c[1] += getY(i + startIndex) * bernstein(i, segmentOrder, segmentT);
|
||||
}
|
||||
}
|
||||
return c;
|
||||
|
|
|
@ -36,6 +36,7 @@ import itdelatrisu.opsu.objects.Spinner;
|
|||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.Stack;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.newdawn.slick.Color;
|
||||
|
@ -248,7 +249,13 @@ public class Game extends BasicGameState {
|
|||
|
||||
// checkpoint
|
||||
if (checkpointLoaded) {
|
||||
String checkpointText = "~ Playing from checkpoint. ~";
|
||||
int checkpoint = Options.getCheckpoint();
|
||||
String checkpointText = String.format(
|
||||
"~ Playing from checkpoint at %02d:%02d. ~",
|
||||
TimeUnit.MILLISECONDS.toMinutes(checkpoint),
|
||||
TimeUnit.MILLISECONDS.toSeconds(checkpoint) -
|
||||
TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(checkpoint))
|
||||
);
|
||||
Utils.FONT_MEDIUM.drawString(
|
||||
(container.getWidth() - Utils.FONT_MEDIUM.getWidth(checkpointText)) / 2,
|
||||
container.getHeight() - 15 - Utils.FONT_MEDIUM.getLineHeight(),
|
||||
|
|
|
@ -526,7 +526,7 @@ public class SongMenu extends BasicGameState {
|
|||
buttonY = height * 0.18f;
|
||||
shift++;
|
||||
} else if (shift > 0 && startNode.next != null &&
|
||||
Opsu.groups.getNode(startNode, MAX_BUTTONS) != null) {
|
||||
Opsu.groups.getNode(startNode, MAX_BUTTONS) != null) {
|
||||
startNode = startNode.next;
|
||||
buttonY -= buttonOffset / 4;
|
||||
if (buttonY < height * 0.14f)
|
||||
|
|
Loading…
Reference in New Issue
Block a user