Fixed music player issues with handling repeat tracks.
When pressing the "next" button, songs will only be pushed when a new track plays. Fixes a potential null pointer crash. Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
parent
33f5df030c
commit
068a844e1f
|
@ -251,7 +251,7 @@ public class Game extends BasicGameState {
|
|||
if (checkpointLoaded) {
|
||||
int checkpoint = Options.getCheckpoint();
|
||||
String checkpointText = String.format(
|
||||
"~ Playing from checkpoint at %02d:%02d. ~",
|
||||
"Playing from checkpoint at %02d:%02d.",
|
||||
TimeUnit.MILLISECONDS.toMinutes(checkpoint),
|
||||
TimeUnit.MILLISECONDS.toSeconds(checkpoint) -
|
||||
TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(checkpoint))
|
||||
|
|
|
@ -322,10 +322,13 @@ public class MainMenu extends BasicGameState {
|
|||
boolean isTheme = MusicController.isThemePlaying();
|
||||
SongMenu menu = (SongMenu) game.getState(Opsu.STATE_SONGMENU);
|
||||
OsuGroupNode node = menu.setFocus(Opsu.groups.getRandomNode(), -1, true);
|
||||
if (node != null && !isTheme)
|
||||
previous.add(node.index);
|
||||
if (Options.isDynamicBackgroundEnabled() &&
|
||||
MusicController.getOsuFile() != null && !MusicController.isThemePlaying())
|
||||
boolean sameAudio = false;
|
||||
if (node != null) {
|
||||
sameAudio = MusicController.getOsuFile().audioFilename.equals(node.osuFiles.get(0).audioFilename);
|
||||
if (!isTheme && !sameAudio)
|
||||
previous.add(node.index);
|
||||
}
|
||||
if (Options.isDynamicBackgroundEnabled() && !sameAudio && !MusicController.isThemePlaying())
|
||||
bgAlpha = 0f;
|
||||
} else if (musicPrevious.contains(x, y)) {
|
||||
if (!previous.isEmpty()) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user