don't recreate knorkesliders when loading checkpoint (part of #104)

This commit is contained in:
yugecin 2016-12-25 18:29:57 +01:00
parent bcb805a23a
commit 3b91247d12

View File

@ -1606,16 +1606,26 @@ public class Game extends BasicGameState {
SoundController.mute(false); SoundController.mute(false);
if (Options.isMergingSliders()) { if (Options.isMergingSliders()) {
// let's create knorkesliders if (knorkesliders == null) {
List<Vec2f> curvepoints = new ArrayList<>(); // let's create knorkesliders
for (GameObject gameObject : gameObjects) { List<Vec2f> curvepoints = new ArrayList<>();
if (gameObject.isSlider()) { for (GameObject gameObject : gameObjects) {
((Slider) gameObject).baseSliderFrom = curvepoints.size(); if (gameObject.isSlider()) {
curvepoints.addAll(Arrays.asList(((Slider) gameObject).getCurve().getCurvePoints())); ((Slider) gameObject).baseSliderFrom = curvepoints.size();
curvepoints.addAll(Arrays.asList(((Slider) gameObject).getCurve().getCurvePoints()));
}
}
if (curvepoints.size() > 0) {
knorkesliders = new FakeCombinedCurve(curvepoints.toArray(new Vec2f[curvepoints.size()]));
}
} else {
int base = 0;
for (GameObject gameObject : gameObjects) {
if (gameObject.isSlider()) {
((Slider) gameObject).baseSliderFrom = base;
base += ((Slider) gameObject).getCurve().getCurvePoints().length;
}
} }
}
if (curvepoints.size() > 0) {
knorkesliders = new FakeCombinedCurve(curvepoints.toArray(new Vec2f[curvepoints.size()]));
} }
} }
} }
@ -1647,6 +1657,8 @@ public class Game extends BasicGameState {
// container.setMouseGrabbed(false); // container.setMouseGrabbed(false);
skippedToCheckpoint = false; skippedToCheckpoint = false;
knorkesliders = null;
sbOverlay.leave(); sbOverlay.leave();
Dancer.instance.setGameObjects(null); Dancer.instance.setGameObjects(null);