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) {
|
if (checkpointLoaded) {
|
||||||
int checkpoint = Options.getCheckpoint();
|
int checkpoint = Options.getCheckpoint();
|
||||||
String checkpointText = String.format(
|
String checkpointText = String.format(
|
||||||
"~ Playing from checkpoint at %02d:%02d. ~",
|
"Playing from checkpoint at %02d:%02d.",
|
||||||
TimeUnit.MILLISECONDS.toMinutes(checkpoint),
|
TimeUnit.MILLISECONDS.toMinutes(checkpoint),
|
||||||
TimeUnit.MILLISECONDS.toSeconds(checkpoint) -
|
TimeUnit.MILLISECONDS.toSeconds(checkpoint) -
|
||||||
TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(checkpoint))
|
TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(checkpoint))
|
||||||
|
|
|
@ -322,10 +322,13 @@ public class MainMenu extends BasicGameState {
|
||||||
boolean isTheme = MusicController.isThemePlaying();
|
boolean isTheme = MusicController.isThemePlaying();
|
||||||
SongMenu menu = (SongMenu) game.getState(Opsu.STATE_SONGMENU);
|
SongMenu menu = (SongMenu) game.getState(Opsu.STATE_SONGMENU);
|
||||||
OsuGroupNode node = menu.setFocus(Opsu.groups.getRandomNode(), -1, true);
|
OsuGroupNode node = menu.setFocus(Opsu.groups.getRandomNode(), -1, true);
|
||||||
if (node != null && !isTheme)
|
boolean sameAudio = false;
|
||||||
previous.add(node.index);
|
if (node != null) {
|
||||||
if (Options.isDynamicBackgroundEnabled() &&
|
sameAudio = MusicController.getOsuFile().audioFilename.equals(node.osuFiles.get(0).audioFilename);
|
||||||
MusicController.getOsuFile() != null && !MusicController.isThemePlaying())
|
if (!isTheme && !sameAudio)
|
||||||
|
previous.add(node.index);
|
||||||
|
}
|
||||||
|
if (Options.isDynamicBackgroundEnabled() && !sameAudio && !MusicController.isThemePlaying())
|
||||||
bgAlpha = 0f;
|
bgAlpha = 0f;
|
||||||
} else if (musicPrevious.contains(x, y)) {
|
} else if (musicPrevious.contains(x, y)) {
|
||||||
if (!previous.isEmpty()) {
|
if (!previous.isEmpty()) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user