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