diff --git a/src/itdelatrisu/opsu/beatmap/Beatmap.java b/src/itdelatrisu/opsu/beatmap/Beatmap.java index c4e95d7f..14847b23 100644 --- a/src/itdelatrisu/opsu/beatmap/Beatmap.java +++ b/src/itdelatrisu/opsu/beatmap/Beatmap.java @@ -179,12 +179,9 @@ public class Beatmap implements Comparable { * [Colours] */ - /** Combo colors (max 8). */ + /** Combo colors (max 8). If null, the skin value is used. */ public Color[] combo; - /** Whether the combo is the default skin combo (true) or a beatmap combo (false). */ - public boolean isDefaultCombo = true; - /** Slider border color. If null, the skin value is used. */ public Color sliderBorder; @@ -260,6 +257,15 @@ public class Beatmap implements Comparable { return (Options.useUnicodeMetadata() && !artistUnicode.isEmpty()) ? artistUnicode : artist; } + /** + * Returns the list of combo colors (max 8). + * If the beatmap does not provide colors, the skin colors will be returned instead. + * @return the combo colors + */ + public Color[] getComboColors() { + return (combo != null) ? combo : Options.getSkin().getComboColors(); + } + /** * Returns the slider border color. * If the beatmap does not provide a color, the skin color will be returned instead. @@ -414,7 +420,7 @@ public class Beatmap implements Comparable { * or null if the field is null or the default combo. */ public String comboToString() { - if (combo == null || isDefaultCombo) + if (combo == null) return null; StringBuilder sb = new StringBuilder(); @@ -437,8 +443,6 @@ public class Beatmap implements Comparable { * @param s the string */ public void comboFromString(String s) { - this.combo = Options.getSkin().getComboColors(); - this.isDefaultCombo = true; if (s == null) return; @@ -448,10 +452,8 @@ public class Beatmap implements Comparable { String[] rgb = tokens[i].split(","); colors.add(new Color(Integer.parseInt(rgb[0]), Integer.parseInt(rgb[1]), Integer.parseInt(rgb[2]))); } - if (!colors.isEmpty()) { + if (!colors.isEmpty()) this.combo = colors.toArray(new Color[colors.size()]); - this.isDefaultCombo = false; - } } /** diff --git a/src/itdelatrisu/opsu/beatmap/BeatmapParser.java b/src/itdelatrisu/opsu/beatmap/BeatmapParser.java index a211e588..58a2100b 100644 --- a/src/itdelatrisu/opsu/beatmap/BeatmapParser.java +++ b/src/itdelatrisu/opsu/beatmap/BeatmapParser.java @@ -19,7 +19,6 @@ package itdelatrisu.opsu.beatmap; import itdelatrisu.opsu.ErrorHandler; -import itdelatrisu.opsu.Options; import itdelatrisu.opsu.Utils; import itdelatrisu.opsu.db.BeatmapDB; @@ -532,10 +531,8 @@ public class BeatmapParser { line, file.getAbsolutePath()), e); } } - if (!colors.isEmpty()) { + if (!colors.isEmpty()) beatmap.combo = colors.toArray(new Color[colors.size()]); - beatmap.isDefaultCombo = false; - } break; case "[HitObjects]": int type = 0; @@ -589,12 +586,6 @@ public class BeatmapParser { if (beatmap.audioFilename == null) return null; - // if no custom colors, use the default color scheme - if (beatmap.combo == null) { - beatmap.combo = Options.getSkin().getComboColors(); - beatmap.isDefaultCombo = true; - } - // parse hit objects now? if (parseObjects) parseHitObjects(beatmap); @@ -627,6 +618,7 @@ public class BeatmapParser { } // combo info + Color[] combo = beatmap.getComboColors(); int comboIndex = 0; // color index int comboNumber = 1; // combo number @@ -654,7 +646,7 @@ public class BeatmapParser { if (hitObject.isNewCombo() || first) { int skip = (hitObject.isSpinner() ? 0 : 1) + hitObject.getComboSkip(); for (int i = 0; i < skip; i++) { - comboIndex = (comboIndex + 1) % beatmap.combo.length; + comboIndex = (comboIndex + 1) % combo.length; comboNumber = 1; } first = false; diff --git a/src/itdelatrisu/opsu/states/Game.java b/src/itdelatrisu/opsu/states/Game.java index eea43540..5fa7ef8c 100644 --- a/src/itdelatrisu/opsu/states/Game.java +++ b/src/itdelatrisu/opsu/states/Game.java @@ -1057,6 +1057,7 @@ public class Game extends BasicGameState { } // initialize object maps + Color[] combo = beatmap.getComboColors(); for (int i = 0; i < beatmap.objects.length; i++) { HitObject hitObject = beatmap.objects[i]; @@ -1065,7 +1066,7 @@ public class Game extends BasicGameState { if (i + 1 < beatmap.objects.length && beatmap.objects[i + 1].isNewCombo()) comboEnd = true; - Color color = beatmap.combo[hitObject.getComboIndex()]; + Color color = combo[hitObject.getComboIndex()]; // pass beatLength to hit objects int hitObjectTime = hitObject.getTime(); @@ -1267,7 +1268,7 @@ public class Game extends BasicGameState { public void loadBeatmap(Beatmap beatmap) { this.beatmap = beatmap; Display.setTitle(String.format("%s - %s", game.getTitle(), beatmap.toString())); - if (beatmap.timingPoints == null || beatmap.combo == null) + if (beatmap.timingPoints == null) BeatmapDB.load(beatmap, BeatmapDB.LOAD_ARRAY); BeatmapParser.parseHitObjects(beatmap); HitSound.setDefaultSampleSet(beatmap.sampleSet);