Minor replay changes, and added pop effect for the scorebar marker.

- When reading replay frames, the thread will now sleep for the time difference minus 1ms if possible (to avoid so much unnecessary looping).
- Fixed a bug where the 'replay' GameData field wasn't being set in some cases.
- Move cursor to skip button location when skipping intro in a replay.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
Jeffrey Han
2015-03-13 18:03:44 -04:00
parent a7390f7c1d
commit 356772b6b6
2 changed files with 22 additions and 6 deletions

View File

@@ -489,7 +489,9 @@ public class Game extends BasicGameState {
// go to ranking screen
else {
((GameRanking) game.getState(Opsu.STATE_GAMERANKING)).setGameData(data);
if (!isReplay && replayFrames != null) {
if (isReplay)
data.setReplay(replay);
else if (replayFrames != null) {
// finalize replay frames with start/skip frames
if (!replayFrames.isEmpty())
replayFrames.getFirst().setTimeDiff(replaySkipTime * -1);
@@ -945,7 +947,11 @@ public class Game extends BasicGameState {
// sleep execution
try {
Thread.sleep(0, 256000);
int diff = replay.frames[replayIndex].getTime() - trackPosition - 1;
if (diff < 1)
Thread.sleep(0, 256000);
else
Thread.sleep(diff);
} catch (InterruptedException e) {}
}
}
@@ -1036,10 +1042,13 @@ public class Game extends BasicGameState {
leadInTime = 0;
MusicController.resume();
}
replaySkipTime = (isReplay) ? -1 : trackPosition;
if (replayThread != null && replayThread.isAlive())
replayThread.interrupt();
MusicController.setPosition(firstObjectTime - SKIP_OFFSET);
replaySkipTime = (isReplay) ? -1 : trackPosition;
if (replayThread != null && replayThread.isAlive()) {
replayX = (int) skipButton.getX();
replayY = (int) skipButton.getY();
replayThread.interrupt();
}
SoundController.playSound(SoundEffect.MENUHIT);
return true;
}