Major track length-related updates.
- Parse and store the end time for every beatmap (i.e. end time of last hit object). - Added a 'length' sorting tab. - Added 'length' search condition. - Removed 'getTrackLength()' and 'getTrackLengthString()' methods, as they are no longer needed. - Added a loader spritesheet animation to render during MP3 conversions (in place of track length rendering upon completion). Other changes: - Added a yellow progress circle during lead-in time. - Fixed sorting tab positioning. - Slightly increased button animation speed in "Main Menu Exit" state. Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
@@ -114,11 +114,6 @@ public class Game extends BasicGameState {
|
||||
*/
|
||||
private int[] hitResultOffset;
|
||||
|
||||
/**
|
||||
* Time, in milliseconds, between the first and last hit object.
|
||||
*/
|
||||
private int mapLength;
|
||||
|
||||
/**
|
||||
* Current break index in breaks ArrayList.
|
||||
*/
|
||||
@@ -274,7 +269,7 @@ public class Game extends BasicGameState {
|
||||
g.fillRect(0, height * 0.875f, width, height * 0.125f);
|
||||
}
|
||||
|
||||
score.drawGameElements(g, mapLength, true, objectIndex == 0);
|
||||
score.drawGameElements(g, true, objectIndex == 0);
|
||||
|
||||
if (breakLength >= 8000 &&
|
||||
trackPosition - breakTime > 2000 &&
|
||||
@@ -317,7 +312,7 @@ public class Game extends BasicGameState {
|
||||
}
|
||||
|
||||
// game elements
|
||||
score.drawGameElements(g, mapLength, false, objectIndex == 0);
|
||||
score.drawGameElements(g, false, objectIndex == 0);
|
||||
|
||||
// skip beginning
|
||||
if (objectIndex == 0 &&
|
||||
@@ -624,7 +619,7 @@ public class Game extends BasicGameState {
|
||||
// load checkpoint
|
||||
if (input.isKeyDown(Input.KEY_RCONTROL) || input.isKeyDown(Input.KEY_LCONTROL)) {
|
||||
int checkpoint = Options.getCheckpoint();
|
||||
if (checkpoint == 0 || checkpoint > MusicController.getTrackLength())
|
||||
if (checkpoint == 0 || checkpoint > osu.endTime)
|
||||
break; // invalid checkpoint
|
||||
try {
|
||||
restart = RESTART_MANUAL;
|
||||
@@ -728,15 +723,6 @@ public class Game extends BasicGameState {
|
||||
if (restart == RESTART_NEW) {
|
||||
loadImages();
|
||||
setMapModifiers();
|
||||
|
||||
// calculate map length (TODO: end on slider?)
|
||||
OsuHitObject lastObject = osu.objects[osu.objects.length - 1];
|
||||
int endTime;
|
||||
if ((lastObject.type & OsuHitObject.TYPE_SPINNER) > 0)
|
||||
endTime = lastObject.endTime;
|
||||
else
|
||||
endTime = lastObject.time;
|
||||
mapLength = endTime - osu.objects[0].time;
|
||||
}
|
||||
|
||||
// initialize object maps
|
||||
|
||||
@@ -190,7 +190,7 @@ public class MainMenu extends BasicGameState {
|
||||
g.setColor(Color.white);
|
||||
if (!MusicController.isTrackLoading())
|
||||
g.fillRoundRect(width - 168, 54,
|
||||
148f * MusicController.getPosition() / MusicController.getTrackLength(), 5, 4);
|
||||
148f * MusicController.getPosition() / osu.endTime, 5, 4);
|
||||
|
||||
// draw text
|
||||
g.setFont(Utils.FONT_MEDIUM);
|
||||
|
||||
@@ -120,9 +120,9 @@ public class MainMenuExit extends BasicGameState {
|
||||
float yesX = yesButton.getX(), noX = noButton.getX();
|
||||
float center = container.getWidth() / 2f;
|
||||
if (yesX < center)
|
||||
yesButton.setX(Math.min(yesX + (delta / 6f), center));
|
||||
yesButton.setX(Math.min(yesX + (delta / 5f), center));
|
||||
if (noX > center)
|
||||
noButton.setX(Math.max(noX - (delta / 6f), center));
|
||||
noButton.setX(Math.max(noX - (delta / 5f), center));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -29,12 +29,14 @@ import itdelatrisu.opsu.SoundController;
|
||||
import itdelatrisu.opsu.Utils;
|
||||
|
||||
import org.lwjgl.opengl.Display;
|
||||
import org.newdawn.slick.Animation;
|
||||
import org.newdawn.slick.Color;
|
||||
import org.newdawn.slick.GameContainer;
|
||||
import org.newdawn.slick.Graphics;
|
||||
import org.newdawn.slick.Image;
|
||||
import org.newdawn.slick.Input;
|
||||
import org.newdawn.slick.SlickException;
|
||||
import org.newdawn.slick.SpriteSheet;
|
||||
import org.newdawn.slick.gui.TextField;
|
||||
import org.newdawn.slick.state.BasicGameState;
|
||||
import org.newdawn.slick.state.StateBasedGame;
|
||||
@@ -128,6 +130,11 @@ public class SongMenu extends BasicGameState {
|
||||
*/
|
||||
private Image musicNote;
|
||||
|
||||
/**
|
||||
* Loader animation.
|
||||
*/
|
||||
private Animation loader;
|
||||
|
||||
// game-related variables
|
||||
private GameContainer container;
|
||||
private StateBasedGame game;
|
||||
@@ -164,7 +171,7 @@ public class SongMenu extends BasicGameState {
|
||||
Image tab = Utils.getTabImage();
|
||||
float tabX = buttonX + (tab.getWidth() / 2f);
|
||||
float tabY = (height * 0.15f) - (tab.getHeight() / 2f) - 2f;
|
||||
float tabOffset = (width - buttonX) / sortTabs.length;
|
||||
float tabOffset = (width - buttonX - tab.getWidth()) / (sortTabs.length - 1);
|
||||
for (int i = 0; i < sortTabs.length; i++)
|
||||
sortTabs[i] = new GUIMenuButton(tab, tabX + (i * tabOffset), tabY);
|
||||
|
||||
@@ -178,7 +185,7 @@ public class SongMenu extends BasicGameState {
|
||||
|
||||
search = new TextField(
|
||||
container, Utils.FONT_DEFAULT,
|
||||
(int) tabX + searchIcon.getWidth(), (int) ((height * 0.15f) - (tab.getHeight() * 5 / 2f)),
|
||||
(int) tabX + searchIcon.getWidth(), (int) ((height * 0.15f) - (tab.getHeight() * 2.5f)),
|
||||
(int) (buttonWidth / 2), Utils.FONT_DEFAULT.getHeight()
|
||||
);
|
||||
search.setBackgroundColor(Color.transparent);
|
||||
@@ -191,8 +198,16 @@ public class SongMenu extends BasicGameState {
|
||||
Image optionsIcon = new Image("options.png").getScaledCopy(iconScale);
|
||||
optionsButton = new GUIMenuButton(optionsIcon, search.getX() - (optionsIcon.getWidth() * 1.5f), search.getY());
|
||||
|
||||
// music note
|
||||
int musicNoteDim = (int) (Utils.FONT_LARGE.getHeight() * 0.75f + Utils.FONT_DEFAULT.getHeight());
|
||||
musicNote = new Image("music-note.png").getScaledCopy(musicNoteDim, musicNoteDim);
|
||||
|
||||
// loader
|
||||
SpriteSheet spr = new SpriteSheet(
|
||||
new Image("loader.png").getScaledCopy(musicNoteDim / 48f),
|
||||
musicNoteDim, musicNoteDim
|
||||
);
|
||||
loader = new Animation(spr, 50);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -218,16 +233,19 @@ public class SongMenu extends BasicGameState {
|
||||
|
||||
// header
|
||||
if (focusNode != null) {
|
||||
musicNote.draw();
|
||||
int musicNoteWidth = musicNote.getWidth();
|
||||
int musicNoteHeight = musicNote.getHeight();
|
||||
if (MusicController.isTrackLoading())
|
||||
loader.draw();
|
||||
else
|
||||
musicNote.draw();
|
||||
int iconWidth = musicNote.getWidth();
|
||||
int iconHeight = musicNote.getHeight();
|
||||
|
||||
String[] info = focusNode.getInfo();
|
||||
g.setColor(Color.white);
|
||||
Utils.FONT_LARGE.drawString(musicNoteWidth + 5, -3, info[0]);
|
||||
Utils.FONT_LARGE.drawString(iconWidth + 5, -3, info[0]);
|
||||
Utils.FONT_DEFAULT.drawString(
|
||||
musicNoteWidth + 5, -3 + Utils.FONT_LARGE.getHeight() * 0.75f, info[1]);
|
||||
int headerY = musicNoteHeight - 3;
|
||||
iconWidth + 5, -3 + Utils.FONT_LARGE.getHeight() * 0.75f, info[1]);
|
||||
int headerY = iconHeight - 3;
|
||||
Utils.FONT_BOLD.drawString(5, headerY, info[2]);
|
||||
headerY += Utils.FONT_BOLD.getLineHeight() - 6;
|
||||
Utils.FONT_DEFAULT.drawString(5, headerY, info[3]);
|
||||
|
||||
Reference in New Issue
Block a user