From b804a4d154b4cb6a1269052025631d85950aca82 Mon Sep 17 00:00:00 2001 From: Jeffrey Han Date: Sun, 24 May 2015 22:17:45 -0400 Subject: [PATCH] Skin options: CursorRotate, CursorExpand, SpinnerFadePlayfield, CursorTrailRotate, ComboBurstRandom, Combo[1-8], SongSelect(Active|Inactive)Text. Signed-off-by: Jeffrey Han --- src/itdelatrisu/opsu/Container.java | 3 +++ src/itdelatrisu/opsu/GameData.java | 12 ++++++++---- src/itdelatrisu/opsu/OsuParser.java | 10 +++++++--- src/itdelatrisu/opsu/UI.java | 11 ++++++++--- src/itdelatrisu/opsu/Utils.java | 10 ---------- src/itdelatrisu/opsu/beatmap/Beatmap.java | 13 +++++++++---- .../opsu/beatmap/BeatmapSetNode.java | 4 ++-- src/itdelatrisu/opsu/objects/Spinner.java | 17 ++++++++++------- 8 files changed, 47 insertions(+), 33 deletions(-) diff --git a/src/itdelatrisu/opsu/Container.java b/src/itdelatrisu/opsu/Container.java index 9ce9de9f..e16aae1e 100644 --- a/src/itdelatrisu/opsu/Container.java +++ b/src/itdelatrisu/opsu/Container.java @@ -114,6 +114,9 @@ public class Container extends AppGameContainer { // save user options Options.saveOptions(); + // reset cursor + UI.resetCursor(); + // destroy images InternalTextureLoader.get().clear(); diff --git a/src/itdelatrisu/opsu/GameData.java b/src/itdelatrisu/opsu/GameData.java index dccaa93c..89fb1e9e 100644 --- a/src/itdelatrisu/opsu/GameData.java +++ b/src/itdelatrisu/opsu/GameData.java @@ -1124,10 +1124,14 @@ public class GameData { // combo bursts (at 30, 60, 100+50x) if (Options.isComboBurstEnabled() && (combo == 30 || combo == 60 || (combo >= 100 && combo % 50 == 0))) { - if (combo == 30) - comboBurstIndex = 0; - else - comboBurstIndex = (comboBurstIndex + 1) % comboBurstImages.length; + if (Options.getSkin().isComboBurstRandom()) + comboBurstIndex = (int) (Math.random() * comboBurstImages.length); + else { + if (combo == 30) + comboBurstIndex = 0; + else + comboBurstIndex = (comboBurstIndex + 1) % comboBurstImages.length; + } comboBurstAlpha = 0.8f; if ((comboBurstIndex % 2) == 0) comboBurstX = width; diff --git a/src/itdelatrisu/opsu/OsuParser.java b/src/itdelatrisu/opsu/OsuParser.java index 1a5da34d..30bdf26c 100644 --- a/src/itdelatrisu/opsu/OsuParser.java +++ b/src/itdelatrisu/opsu/OsuParser.java @@ -529,8 +529,10 @@ public class OsuParser { 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; @@ -585,8 +587,10 @@ public class OsuParser { return null; // if no custom colors, use the default color scheme - if (beatmap.combo == null) - beatmap.combo = Utils.DEFAULT_COMBO; + if (beatmap.combo == null) { + beatmap.combo = Options.getSkin().getComboColors(); + beatmap.isDefaultCombo = true; + } // parse hit objects now? if (parseObjects) diff --git a/src/itdelatrisu/opsu/UI.java b/src/itdelatrisu/opsu/UI.java index ed14be98..84b65b6f 100644 --- a/src/itdelatrisu/opsu/UI.java +++ b/src/itdelatrisu/opsu/UI.java @@ -19,6 +19,7 @@ package itdelatrisu.opsu; import itdelatrisu.opsu.audio.SoundController; +import itdelatrisu.opsu.skins.Skin; import java.nio.IntBuffer; import java.util.Iterator; @@ -242,6 +243,7 @@ public class UI { int removeCount = 0; int FPSmod = (Options.getTargetFPS() / 60); + Skin skin = Options.getSkin(); // TODO: use an image buffer if (newStyle) { @@ -275,6 +277,8 @@ public class UI { // draw a fading trail float alpha = 0f; float t = 2f / cursorX.size(); + if (skin.isCursorTrailRotated()) + cursorTrail.setRotation(cursorAngle); Iterator iterX = cursorX.iterator(); Iterator iterY = cursorY.iterator(); while (iterX.hasNext()) { @@ -288,15 +292,15 @@ public class UI { cursorTrail.drawCentered(mouseX, mouseY); // increase the cursor size if pressed - final float scale = 1.25f; - if (mousePressed) { + if (mousePressed && skin.isCursorExpanded()) { + final float scale = 1.25f; cursor = cursor.getScaledCopy(scale); if (newStyle) cursorMiddle = cursorMiddle.getScaledCopy(scale); } // draw the other components - if (newStyle) + if (newStyle && skin.isCursorRotated()) cursor.setRotation(cursorAngle); cursor.drawCentered(mouseX, mouseY); if (newStyle) @@ -373,6 +377,7 @@ public class UI { GameImage.CURSOR_TRAIL.destroySkinImage(); cursorAngle = 0f; GameImage.CURSOR.getImage().setRotation(0f); + GameImage.CURSOR_TRAIL.getImage().setRotation(0f); } /** diff --git a/src/itdelatrisu/opsu/Utils.java b/src/itdelatrisu/opsu/Utils.java index 80ee74b0..c70016d9 100644 --- a/src/itdelatrisu/opsu/Utils.java +++ b/src/itdelatrisu/opsu/Utils.java @@ -84,10 +84,6 @@ public class Utils { COLOR_BLUE_BACKGROUND = new Color(74, 130, 255), COLOR_BLUE_BUTTON = new Color(40, 129, 237), COLOR_ORANGE_BUTTON = new Color(200, 90, 3), - COLOR_GREEN_OBJECT = new Color(26, 207, 26), - COLOR_BLUE_OBJECT = new Color(46, 136, 248), - COLOR_RED_OBJECT = new Color(243, 48, 77), - COLOR_ORANGE_OBJECT = new Color(255, 200, 32), COLOR_YELLOW_ALPHA = new Color(255, 255, 0, 0.4f), COLOR_WHITE_FADE = new Color(255, 255, 255, 1f), COLOR_RED_HOVER = new Color(255, 112, 112), @@ -100,12 +96,6 @@ public class Utils { COLOR_RED_HIGHLIGHT = new Color(246, 154, 161), COLOR_BLUE_HIGHLIGHT = new Color(173, 216, 230); - /** The default map colors, used when a map does not provide custom colors. */ - public static final Color[] DEFAULT_COMBO = { - COLOR_ORANGE_OBJECT, COLOR_GREEN_OBJECT, - COLOR_BLUE_OBJECT, COLOR_RED_OBJECT, - }; - /** Game fonts. */ public static UnicodeFont FONT_DEFAULT, FONT_BOLD, diff --git a/src/itdelatrisu/opsu/beatmap/Beatmap.java b/src/itdelatrisu/opsu/beatmap/Beatmap.java index 4f04d5a7..923305a5 100644 --- a/src/itdelatrisu/opsu/beatmap/Beatmap.java +++ b/src/itdelatrisu/opsu/beatmap/Beatmap.java @@ -19,7 +19,6 @@ package itdelatrisu.opsu.beatmap; import itdelatrisu.opsu.Options; -import itdelatrisu.opsu.Utils; import java.io.File; import java.util.ArrayList; @@ -183,6 +182,9 @@ public class Beatmap implements Comparable { /** Combo colors (max 8). */ public Color[] combo; + /** Whether the combo is the default skin combo (true) or a beatmap combo (false). */ + public boolean isDefaultCombo = true; + /** * [HitObjects] */ @@ -400,7 +402,7 @@ public class Beatmap implements Comparable { * or null if the field is null or the default combo. */ public String comboToString() { - if (combo == null || combo == Utils.DEFAULT_COMBO) + if (combo == null || isDefaultCombo) return null; StringBuilder sb = new StringBuilder(); @@ -423,7 +425,8 @@ public class Beatmap implements Comparable { * @param s the string */ public void comboFromString(String s) { - this.combo = Utils.DEFAULT_COMBO; + this.combo = Options.getSkin().getComboColors(); + this.isDefaultCombo = true; if (s == null) return; @@ -433,7 +436,9 @@ 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; + } } } \ No newline at end of file diff --git a/src/itdelatrisu/opsu/beatmap/BeatmapSetNode.java b/src/itdelatrisu/opsu/beatmap/BeatmapSetNode.java index 1307ee4d..6324d1c4 100644 --- a/src/itdelatrisu/opsu/beatmap/BeatmapSetNode.java +++ b/src/itdelatrisu/opsu/beatmap/BeatmapSetNode.java @@ -69,14 +69,14 @@ public class BeatmapSetNode { Beatmap beatmap; bg.setAlpha(0.9f); Color bgColor; - Color textColor = Color.lightGray; + Color textColor = Options.getSkin().getSongSelectInactiveTextColor(); // get drawing parameters if (expanded) { x -= bg.getWidth() / 10f; if (focus) { bgColor = Color.white; - textColor = Color.white; + textColor = Options.getSkin().getSongSelectActiveTextColor(); } else bgColor = Utils.COLOR_BLUE_BUTTON; beatmap = beatmapSet.get(beatmapIndex); diff --git a/src/itdelatrisu/opsu/objects/Spinner.java b/src/itdelatrisu/opsu/objects/Spinner.java index 4c138a47..64e8e417 100644 --- a/src/itdelatrisu/opsu/objects/Spinner.java +++ b/src/itdelatrisu/opsu/objects/Spinner.java @@ -22,6 +22,7 @@ import itdelatrisu.opsu.GameData; import itdelatrisu.opsu.GameData.HitObjectType; import itdelatrisu.opsu.GameImage; import itdelatrisu.opsu.GameMod; +import itdelatrisu.opsu.Options; import itdelatrisu.opsu.Utils; import itdelatrisu.opsu.audio.SoundController; import itdelatrisu.opsu.audio.SoundEffect; @@ -125,15 +126,17 @@ public class Spinner implements GameObject { return; boolean spinnerComplete = (rotations >= rotationsNeeded); + float alpha = Utils.clamp(1 - (float) timeDiff / FADE_IN_TIME, 0f, 1f); // darken screen - float alpha = Utils.clamp(1 - (float) timeDiff / FADE_IN_TIME, 0f, 1f); - float oldAlpha = Utils.COLOR_BLACK_ALPHA.a; - if (timeDiff > 0) - Utils.COLOR_BLACK_ALPHA.a *= alpha; - g.setColor(Utils.COLOR_BLACK_ALPHA); - g.fillRect(0, 0, width, height); - Utils.COLOR_BLACK_ALPHA.a = oldAlpha; + if (Options.getSkin().isSpinnerFadePlayfield()) { + float oldAlpha = Utils.COLOR_BLACK_ALPHA.a; + if (timeDiff > 0) + Utils.COLOR_BLACK_ALPHA.a *= alpha; + g.setColor(Utils.COLOR_BLACK_ALPHA); + g.fillRect(0, 0, width, height); + Utils.COLOR_BLACK_ALPHA.a = oldAlpha; + } // rpm int rpm = Math.abs(Math.round(sumVelocity / storedVelocities.length * 60));