Misc. bug fixes and improvements.

- Fixed Game not loading OsuFile for maps in a song group. (blame: 5612336)
- Implemented rotations for reverse arrows, and added a new one by Alic1a.
- "Auto" mod: pausing no longer requires click to unpause, and mod images are permanently drawn.
- Program now loads from Main Menu instead of Options (unnecessary complications for the sake of a transition).

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
Jeffrey Han
2014-07-02 23:38:30 -04:00
parent 2c2f28b441
commit 03be29307f
8 changed files with 75 additions and 50 deletions

View File

@@ -322,23 +322,22 @@ public class Game extends BasicGameState {
// game elements
score.drawGameElements(g, mapLength, false, objectIndex == 0);
// first object...
if (objectIndex == 0) {
// skip beginning
if (osu.objects[objectIndex].time - skipOffsetTime > 5000 &&
trackPosition < osu.objects[objectIndex].time - skipOffsetTime)
skipButton.draw();
// mod icons
if (trackPosition < osu.objects[objectIndex].time) {
for (int i = Options.MOD_MAX - 1; i >= 0; i--) {
if (Options.isModActive(i)) {
Image modImage = Options.getModImage(i);
modImage.draw(
(width * 0.85f) + ((i - (Options.MOD_MAX / 2)) * modImage.getWidth() / 3f),
height / 10f
);
}
// skip beginning
if (objectIndex == 0 &&
osu.objects[0].time - skipOffsetTime > 5000 &&
trackPosition < osu.objects[0].time - skipOffsetTime)
skipButton.draw();
// mod icons
if ((objectIndex == 0 && trackPosition < osu.objects[0].time) ||
Options.isModActive(Options.MOD_AUTO)) {
for (int i = Options.MOD_MAX - 1; i >= 0; i--) {
if (Options.isModActive(i)) {
Image modImage = Options.getModImage(i);
modImage.draw(
(width * 0.85f) + ((i - (Options.MOD_MAX / 2)) * modImage.getWidth() / 3f),
height / 10f
);
}
}
}
@@ -570,7 +569,9 @@ public class Game extends BasicGameState {
case Input.KEY_ESCAPE:
// pause game
int trackPosition = MusicController.getPosition();
if (pauseTime < 0 && breakTime <= 0 && trackPosition >= osu.objects[0].time) {
if (pauseTime < 0 && breakTime <= 0 &&
trackPosition >= osu.objects[0].time &&
!Options.isModActive(Options.MOD_AUTO)) {
pausedMouseX = input.getMouseX();
pausedMouseY = input.getMouseY();
pausePulse = 0f;

View File

@@ -111,6 +111,8 @@ public class MainMenu extends BasicGameState {
@Override
public void init(GameContainer container, StateBasedGame game)
throws SlickException {
Utils.init(container, game);
this.game = game;
osuStartTime = System.currentTimeMillis();

View File

@@ -315,7 +315,6 @@ public class Options extends BasicGameState {
private Input input;
private Graphics g;
private int state;
private boolean init = false;
public Options(int state) {
this.state = state;
@@ -329,8 +328,6 @@ public class Options extends BasicGameState {
this.input = container.getInput();
this.g = container.getGraphics();
Utils.init(container, game);
int width = container.getWidth();
int height = container.getHeight();
@@ -376,16 +373,11 @@ public class Options extends BasicGameState {
);
for (int i = 0; i < modButtons.length; i++)
modButtons[i].getImage().setAlpha(0.5f);
game.enterState(Opsu.STATE_MAINMENU, new EmptyTransition(), new FadeInTransition(Color.black));
}
@Override
public void render(GameContainer container, StateBasedGame game, Graphics g)
throws SlickException {
if (!init)
return;
g.setBackground(Utils.COLOR_BLACK_ALPHA);
g.setColor(Color.white);
@@ -449,7 +441,7 @@ public class Options extends BasicGameState {
@Override
public void update(GameContainer container, StateBasedGame game, int delta)
throws SlickException {
init = true;
// empty
}
@Override

View File

@@ -363,6 +363,7 @@ public class SongMenu extends BasicGameState {
if (sortTabs[i].contains(x, y)) {
if (i != currentSort) {
currentSort = i;
SoundController.playSound(SoundController.SOUND_MENUCLICK);
OsuGroupNode oldFocusBase = Opsu.groups.getBaseNode(focusNode.index);
int oldFocusFileIndex = focusNode.osuFileIndex;
focusNode = null;
@@ -395,7 +396,7 @@ public class SongMenu extends BasicGameState {
} else if (node.osuFileIndex == focusNode.osuFileIndex) {
// if already focused, load the beatmap
startGame(focusNode.osuFiles.get(focusNode.osuFileIndex));
startGame();
} else {
// focus the node
@@ -443,7 +444,7 @@ public class SongMenu extends BasicGameState {
break;
case Input.KEY_ENTER:
if (focusNode != null)
startGame(focusNode.osuFiles.get(focusNode.osuFileIndex));
startGame();
break;
case Input.KEY_DOWN:
changeIndex(1);
@@ -595,11 +596,12 @@ public class SongMenu extends BasicGameState {
* Starts the game.
* @param osu the OsuFile to send to the game
*/
private void startGame(OsuFile osu) {
private void startGame() {
if (MusicController.isConverting())
return;
SoundController.playSound(SoundController.SOUND_MENUHIT);
OsuFile osu = MusicController.getOsuFile();
Display.setTitle(String.format("%s - %s", game.getTitle(), osu.toString()));
OsuParser.parseHitObjects(osu);
SoundController.setSampleSet(osu.sampleSet);