Merge remote-tracking branch 'org/master' into ReplayTest
Conflicts: src/itdelatrisu/opsu/GameData.java src/itdelatrisu/opsu/Options.java src/itdelatrisu/opsu/OsuFile.java src/itdelatrisu/opsu/OsuGroupList.java src/itdelatrisu/opsu/OsuHitObject.java src/itdelatrisu/opsu/OsuParser.java src/itdelatrisu/opsu/UI.java src/itdelatrisu/opsu/db/OsuDB.java src/itdelatrisu/opsu/objects/Circle.java src/itdelatrisu/opsu/objects/HitObject.java src/itdelatrisu/opsu/objects/Slider.java src/itdelatrisu/opsu/objects/Spinner.java src/itdelatrisu/opsu/states/Game.java src/itdelatrisu/opsu/states/Splash.java
This commit is contained in:
@@ -21,14 +21,15 @@ package itdelatrisu.opsu.states;
|
||||
import itdelatrisu.opsu.GameImage;
|
||||
import itdelatrisu.opsu.Opsu;
|
||||
import itdelatrisu.opsu.Options;
|
||||
import itdelatrisu.opsu.OsuGroupList;
|
||||
import itdelatrisu.opsu.OsuParser;
|
||||
import itdelatrisu.opsu.OszUnpacker;
|
||||
import itdelatrisu.opsu.UI;
|
||||
import itdelatrisu.opsu.Utils;
|
||||
import itdelatrisu.opsu.audio.MusicController;
|
||||
import itdelatrisu.opsu.audio.SoundController;
|
||||
import itdelatrisu.opsu.replay.ReplayImporter;
|
||||
//conflict
|
||||
import itdelatrisu.opsu.beatmap.BeatmapSetList;
|
||||
import itdelatrisu.opsu.beatmap.BeatmapParser;
|
||||
import itdelatrisu.opsu.ui.UI;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@@ -56,6 +57,9 @@ public class Splash extends BasicGameState {
|
||||
/** Number of times the 'Esc' key has been pressed. */
|
||||
private int escapeCount = 0;
|
||||
|
||||
/** Whether the skin being loaded is a new skin (for program restarts). */
|
||||
private boolean newSkin = false;
|
||||
|
||||
// game-related variables
|
||||
private int state;
|
||||
private GameContainer container;
|
||||
@@ -70,6 +74,10 @@ public class Splash extends BasicGameState {
|
||||
throws SlickException {
|
||||
this.container = container;
|
||||
|
||||
// check if skin changed
|
||||
if (Options.getSkin() != null)
|
||||
this.newSkin = (Options.getSkin().getDirectory() != Options.getSkinDir());
|
||||
|
||||
// load Utils class first (needed in other 'init' methods)
|
||||
Utils.init(container, game);
|
||||
|
||||
@@ -90,11 +98,27 @@ public class Splash extends BasicGameState {
|
||||
if (!init) {
|
||||
init = true;
|
||||
|
||||
if (OsuGroupList.get() != null) {
|
||||
// resources already loaded (from application restart)
|
||||
finished = true;
|
||||
} else {
|
||||
// load resources in a new thread
|
||||
// resources already loaded (from application restart)
|
||||
if (BeatmapSetList.get() != null) {
|
||||
// reload sounds if skin changed
|
||||
if (newSkin) {
|
||||
thread = new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
// TODO: only reload each sound if actually needed?
|
||||
SoundController.init();
|
||||
|
||||
finished = true;
|
||||
thread = null;
|
||||
}
|
||||
};
|
||||
thread.start();
|
||||
} else // don't reload anything
|
||||
finished = true;
|
||||
}
|
||||
|
||||
// load all resources in a new thread
|
||||
else {
|
||||
thread = new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -104,7 +128,7 @@ public class Splash extends BasicGameState {
|
||||
OszUnpacker.unpackAllFiles(Options.getOSZDir(), beatmapDir);
|
||||
|
||||
// parse song directory
|
||||
OsuParser.parseAllFiles(beatmapDir);
|
||||
BeatmapParser.parseAllFiles(beatmapDir);
|
||||
|
||||
// import replays
|
||||
ReplayImporter.importAllReplaysFromDir(Options.getReplayImportDir());
|
||||
@@ -129,12 +153,12 @@ public class Splash extends BasicGameState {
|
||||
// change states when loading complete
|
||||
if (finished && alpha >= 1f) {
|
||||
// initialize song list
|
||||
if (OsuGroupList.get().size() > 0) {
|
||||
OsuGroupList.get().init();
|
||||
if (BeatmapSetList.get().size() > 0) {
|
||||
BeatmapSetList.get().init();
|
||||
if (Options.isThemeSongEnabled())
|
||||
MusicController.playThemeSong();
|
||||
else
|
||||
((SongMenu) game.getState(Opsu.STATE_SONGMENU)).setFocus(OsuGroupList.get().getRandomNode(), -1, true, true);
|
||||
((SongMenu) game.getState(Opsu.STATE_SONGMENU)).setFocus(BeatmapSetList.get().getRandomNode(), -1, true, true);
|
||||
}
|
||||
|
||||
// play the theme song
|
||||
@@ -155,7 +179,7 @@ public class Splash extends BasicGameState {
|
||||
if (++escapeCount >= 3)
|
||||
container.exit();
|
||||
|
||||
// stop parsing OsuFiles by sending interrupt to OsuParser
|
||||
// stop parsing beatmaps by sending interrupt to BeatmapParser
|
||||
else if (thread != null)
|
||||
thread.interrupt();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user