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:
parent
a7390f7c1d
commit
356772b6b6
|
@ -47,7 +47,7 @@ public class GameData {
|
||||||
/** Time, in milliseconds, for a hit result to fade. */
|
/** Time, in milliseconds, for a hit result to fade. */
|
||||||
public static final int HITRESULT_FADE_TIME = 500;
|
public static final int HITRESULT_FADE_TIME = 500;
|
||||||
|
|
||||||
/** Time, in milliseconds, that a combo pops on the screen. */
|
/** Duration, in milliseconds, of a combo pop effect. */
|
||||||
private static final int COMBO_POP_TIME = 250;
|
private static final int COMBO_POP_TIME = 250;
|
||||||
|
|
||||||
/** Time, in milliseconds, for a hit error tick to fade. */
|
/** Time, in milliseconds, for a hit error tick to fade. */
|
||||||
|
@ -671,6 +671,8 @@ public class GameData {
|
||||||
ki = GameImage.SCOREBAR_KI_DANGER.getImage();
|
ki = GameImage.SCOREBAR_KI_DANGER.getImage();
|
||||||
else
|
else
|
||||||
ki = GameImage.SCOREBAR_KI_DANGER2.getImage();
|
ki = GameImage.SCOREBAR_KI_DANGER2.getImage();
|
||||||
|
if (comboPopTime < COMBO_POP_TIME)
|
||||||
|
ki = ki.getScaledCopy(1f + (0.45f * (1f - (float) comboPopTime / COMBO_POP_TIME)));
|
||||||
ki.drawCentered(colourX + colourCropped.getWidth(), colourY);
|
ki.drawCentered(colourX + colourCropped.getWidth(), colourY);
|
||||||
|
|
||||||
// combo burst
|
// combo burst
|
||||||
|
@ -1265,6 +1267,11 @@ public class GameData {
|
||||||
return replay;
|
return replay;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the replay object.
|
||||||
|
*/
|
||||||
|
public void setReplay(Replay replay) { this.replay = replay; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether or not this object is used for gameplay.
|
* Returns whether or not this object is used for gameplay.
|
||||||
* @return true if gameplay, false if score viewing
|
* @return true if gameplay, false if score viewing
|
||||||
|
|
|
@ -489,7 +489,9 @@ public class Game extends BasicGameState {
|
||||||
// go to ranking screen
|
// go to ranking screen
|
||||||
else {
|
else {
|
||||||
((GameRanking) game.getState(Opsu.STATE_GAMERANKING)).setGameData(data);
|
((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
|
// finalize replay frames with start/skip frames
|
||||||
if (!replayFrames.isEmpty())
|
if (!replayFrames.isEmpty())
|
||||||
replayFrames.getFirst().setTimeDiff(replaySkipTime * -1);
|
replayFrames.getFirst().setTimeDiff(replaySkipTime * -1);
|
||||||
|
@ -945,7 +947,11 @@ public class Game extends BasicGameState {
|
||||||
|
|
||||||
// sleep execution
|
// sleep execution
|
||||||
try {
|
try {
|
||||||
|
int diff = replay.frames[replayIndex].getTime() - trackPosition - 1;
|
||||||
|
if (diff < 1)
|
||||||
Thread.sleep(0, 256000);
|
Thread.sleep(0, 256000);
|
||||||
|
else
|
||||||
|
Thread.sleep(diff);
|
||||||
} catch (InterruptedException e) {}
|
} catch (InterruptedException e) {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1036,10 +1042,13 @@ public class Game extends BasicGameState {
|
||||||
leadInTime = 0;
|
leadInTime = 0;
|
||||||
MusicController.resume();
|
MusicController.resume();
|
||||||
}
|
}
|
||||||
replaySkipTime = (isReplay) ? -1 : trackPosition;
|
|
||||||
if (replayThread != null && replayThread.isAlive())
|
|
||||||
replayThread.interrupt();
|
|
||||||
MusicController.setPosition(firstObjectTime - SKIP_OFFSET);
|
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);
|
SoundController.playSound(SoundEffect.MENUHIT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user