From 223b6fb7741172582ff1bfb180ff31b2120b0ee6 Mon Sep 17 00:00:00 2001 From: ansel <79257300125@ya.ru> Date: Sun, 14 May 2023 18:56:50 +0300 Subject: [PATCH 1/6] Add raster judgments support --- src/nmania/skin/RasterSkin.java | 15 +++++++++++++++ src/nmania/ui/ng/RasterSkinSettings.java | 12 +++++++++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/nmania/skin/RasterSkin.java b/src/nmania/skin/RasterSkin.java index 3d01ec8..0450286 100644 --- a/src/nmania/skin/RasterSkin.java +++ b/src/nmania/skin/RasterSkin.java @@ -22,6 +22,7 @@ public RasterSkin() { public Image[] holds; public int[] holdBodies = new int[3]; public Image[] hud; + public Image[] judgs; public int GetLeftOffset() { return leftOffset; @@ -89,6 +90,8 @@ public Object GetNumericHUD() { } public Image[] GetJudgments() { + if (VerifyJudgs() == null) + return judgs; return null; } @@ -104,6 +107,7 @@ public Skin Read(JSONObject j) { notes = new Image[3]; holds = new Image[3]; hud = new Image[12]; + judgs = new Image[6]; // files try { for (int i = 0; i < 3; i++) { @@ -118,6 +122,9 @@ public Skin Read(JSONObject j) { } hud[10] = BeatmapManager.getImgFromFS(base + "hud," + png); hud[10] = BeatmapManager.getImgFromFS(base + "hud%" + png); + for (int i = 0; i < 6; i++) { + judgs[i] = BeatmapManager.getImgFromFS(base + "judg" + i + png); + } } catch (Exception e) { } if (j == null) { @@ -232,4 +239,12 @@ public String VerifyHud() { return null; } + public String VerifyJudgs() { + for (int i = 0; i < 6; i++) { + if (judgs[i] == null) + return "File \"judg" + i + ".png\" is missing"; + } + return null; + } + } diff --git a/src/nmania/ui/ng/RasterSkinSettings.java b/src/nmania/ui/ng/RasterSkinSettings.java index b9b99a7..5c3a625 100644 --- a/src/nmania/ui/ng/RasterSkinSettings.java +++ b/src/nmania/ui/ng/RasterSkinSettings.java @@ -30,7 +30,8 @@ public RasterSkinSettings() { new CheckItem(4, "Keyboard sprites", this, skin.VerifyKb() == null), new CheckItem(5, "Note sprites", this, skin.VerifyNotes() == null), new CheckItem(6, "HUD sprites", this, skin.VerifyHud() == null), - new CheckItem(7, "Sizes consistency", this, skin.VerifyWidth() == null), }); + new CheckItem(7, "Sizes consistency", this, skin.VerifyWidth() == null), + new CheckItem(8, "Judgment sprites", this, skin.VerifyJudgs() == null), }); } public void OnSelect(ListItem item, ListScreen screen, IDisplay display) { @@ -41,8 +42,9 @@ public void OnSelect(ListItem item, ListScreen screen, IDisplay display) { + "Create \"_skin\" folder in your folder with songs (\"file:///" + Settings.workingFolder + "_skin/\") and place your images there. " + "Create 3 images (\"1\", \"2\", \"3\" for non-odd, odd and center columns) " - + "for keyboard (\"kbX.png\" and \"kbhX.png\" where X is number) and notes (\"noteX.png\" and \"holdX.png\") " - + "and 12 images for numbers (\"hudX.png\" where X is 0-9, \",\" and \"%\"). " + + "for keyboard (\"kbX.png\" and \"kbhX.png\" where X is number) and notes (\"noteX.png\" and \"holdX.png\"), " + + "12 images for numbers (\"hudX.png\" where X is 0-9, \",\" and \"%\") and 6 images for judgments " + + "(\"judgX.png\" where X is 0-5 for miss, meh, ok, good, great, perfect). " + "All images in one category must have equal sizes. Notes and keyboard must have equal width. " + "Refer to checks below to learn what to fix.")); break; @@ -71,6 +73,10 @@ public void OnSelect(ListItem item, ListScreen screen, IDisplay display) { check = skin.VerifyWidth(); display.Push(new Alert(item.text, check == null ? "Sprite sizes are okay!" : check)); break; + case 8: + check = skin.VerifyJudgs(); + display.Push(new Alert(item.text, check == null ? "Judgs sprites are okay!" : check)); + break; } } From 97e43605d6b8fbc639b038426039f6eb2b45b85b Mon Sep 17 00:00:00 2001 From: ansel <79257300125@ya.ru> Date: Sun, 14 May 2023 19:18:15 +0300 Subject: [PATCH 2/6] Add support for border coloring --- src/nmania/Player.java | 7 ++++++- src/nmania/skin/RasterSkin.java | 8 ++++++++ src/nmania/skin/Skin.java | 2 ++ src/nmania/skin/VectorSkin.java | 7 +++++++ 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/nmania/Player.java b/src/nmania/Player.java index 116b61e..07b54ed 100644 --- a/src/nmania/Player.java +++ b/src/nmania/Player.java @@ -314,6 +314,10 @@ public Player(Beatmap map, PlayerBootstrapData opts, Skin s, ILogger log, Displa { columnsBg = s.GetColumnsBackground(columnsCount); } + // border + { + bordersColor = s.GetBordersColor(); + } } if (bg == null) { Image tmp = Image.createImage(fillScoreW, fillCountersH); @@ -397,6 +401,7 @@ private final void UpdateHealthX() { private final int[] holdsBodyColors; private final Image[] keysSprites, holdKeysSprites; private final int[][] keysColors, holdKeysColors; + private final int bordersColor; private final char[] accText; private static final char[] hudCache = new char[16]; private final int kbH, kbY, colW, colWp1; @@ -1446,7 +1451,7 @@ private final void FillBg() { * Draws borders around columns. */ private final void DrawBorders() { - g.setColor(-1); + g.setColor(bordersColor); int x = leftOffset; for (int i = 0; i <= columnsCount; i++) { g.drawLine(x, 0, x, scrH); diff --git a/src/nmania/skin/RasterSkin.java b/src/nmania/skin/RasterSkin.java index 0450286..5e8fae1 100644 --- a/src/nmania/skin/RasterSkin.java +++ b/src/nmania/skin/RasterSkin.java @@ -23,6 +23,7 @@ public RasterSkin() { public int[] holdBodies = new int[3]; public Image[] hud; public Image[] judgs; + public int bordersColor; public int GetLeftOffset() { return leftOffset; @@ -99,6 +100,10 @@ public int[] GetColumnsBackground(int columns) { return Pack(background, columns); } + public int GetBordersColor() { + return bordersColor; + } + public Skin Read(JSONObject j) { final String base = "file:///" + Settings.workingFolder + "_skin/"; final String png = ".png"; @@ -132,11 +137,13 @@ public Skin Read(JSONObject j) { holdWidth = 20; background = new int[] { 0x002200, 0x220000, 0x000022 }; holdBodies = new int[] { 0x007700, 0x770000, 0x000077 }; + bordersColor = -1; return this; } // json leftOffset = j.optInt("left_offset", 30); holdWidth = j.optInt("hold_width", 20); + bordersColor = j.optInt("borders_color", -1); background = SNUtils.json2intArray(j.optJSONArray("background")); if (background == null || background.length < 3) @@ -156,6 +163,7 @@ public JSONObject Write() { j.put("hold_width", holdWidth); j.put("background", ToVector(background)); j.put("hold_bodies", ToVector(holdBodies)); + j.put("borders_color", bordersColor); return j; } diff --git a/src/nmania/skin/Skin.java b/src/nmania/skin/Skin.java index 9db8e70..fdd4d72 100644 --- a/src/nmania/skin/Skin.java +++ b/src/nmania/skin/Skin.java @@ -118,6 +118,8 @@ public abstract class Skin { */ public abstract int[] GetColumnsBackground(int columns); + public abstract int GetBordersColor(); + public abstract Skin Read(JSONObject j); public abstract JSONObject Write(); diff --git a/src/nmania/skin/VectorSkin.java b/src/nmania/skin/VectorSkin.java index ed0f54e..b920439 100644 --- a/src/nmania/skin/VectorSkin.java +++ b/src/nmania/skin/VectorSkin.java @@ -45,6 +45,7 @@ public int GetKeyboardHeight() { public int[] holds = new int[6]; public int[] holdBodies = new int[3]; public int hudColor; + public int bordersColor; public Object GetKeyboardLook(int columns) { return Pack(keyboard, columns, GetKeyboardHeight()); @@ -78,6 +79,10 @@ public int[] GetColumnsBackground(int columns) { return Pack(background, columns); } + public int GetBordersColor() { + return bordersColor; + } + public Skin Read(JSONObject j) { if (j == null) j = new JSONObject(); @@ -88,6 +93,7 @@ public Skin Read(JSONObject j) { holdWidth = j.optInt("hold_width", 20); keyboardHeight = j.optInt("keyboard_height", keyboardHeight); hudColor = j.optInt("hud_color", -1); + bordersColor = j.optInt("borders_color", -1); // palletes background = SNUtils.json2intArray(j.optJSONArray("background")); @@ -129,6 +135,7 @@ public JSONObject Write() { j.put("hold_width", holdWidth); j.put("keyboard_height", keyboardHeight); j.put("hud_color", hudColor); + j.put("borders_color", bordersColor); // palletes j.put("background", ToVector(background)); From 284310a35deaa30f3a576e4eef240d7af8000251 Mon Sep 17 00:00:00 2001 From: ansel <79257300125@ya.ru> Date: Sun, 14 May 2023 19:20:13 +0300 Subject: [PATCH 3/6] Add border editor for vector --- src/nmania/ui/ng/VectorSkinSettings.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/nmania/ui/ng/VectorSkinSettings.java b/src/nmania/ui/ng/VectorSkinSettings.java index 91f3f9a..b2fb3b2 100644 --- a/src/nmania/ui/ng/VectorSkinSettings.java +++ b/src/nmania/ui/ng/VectorSkinSettings.java @@ -8,7 +8,7 @@ public class VectorSkinSettings extends SkinSettings implements IListSelectHandl private final VectorSkin skin; private final DataItem left, colW, noteH, holdW, kbH; - private final ListItem hudC, bgC, kbC, kbHC, noteC, holdC, holdBC; + private final ListItem hudC, bgC, kbC, kbHC, noteC, holdC, holdBC, bordC; private final String[] pal3 = new String[] { "Non-odd column", "Odd column", "Center column" }; private final String[] pal6 = new String[] { "Non-odd column (top)", "Non-odd column (bottom)", "Odd column (top)", @@ -33,8 +33,9 @@ public VectorSkinSettings() { noteC = new ListItem(10, "Notes color", this); holdC = new ListItem(11, "Hold heads color", this); holdBC = new ListItem(12, "Hold bodies color", this); + bordC = new ListItem(13, "Column borders color", this); - SetItems(new ListItem[] { left, colW, noteH, holdW, kbH, hudC, bgC, kbC, kbHC, noteC, holdC, holdBC }); + SetItems(new ListItem[] { left, colW, noteH, holdW, kbH, hudC, bgC, kbC, kbHC, noteC, holdC, holdBC, bordC }); } public void OnSelect(ListItem item, ListScreen screen, IDisplay display) { @@ -75,6 +76,9 @@ public void OnSelect(ListItem item, ListScreen screen, IDisplay display) { case 12: display.Push(new PalleteBox(item.text, skin.holdBodies, pal3)); break; + case 13: + display.Push(new ColorBox(item.text, 13, this, skin.bordersColor)); + break; } } @@ -118,6 +122,9 @@ public void OnNumberEntered(int UUID, int newNumber, IDisplay d) { case 6: skin.hudColor = newNumber; break; + case 13: + skin.bordersColor = newNumber; + break; } d.Back(); From cb77c226a8199ac7dc812e7d3b73aa8b542c2959 Mon Sep 17 00:00:00 2001 From: ansel <79257300125@ya.ru> Date: Sun, 14 May 2023 19:24:34 +0300 Subject: [PATCH 4/6] Add border editor for raster --- src/nmania/ui/ng/RasterSkinSettings.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/nmania/ui/ng/RasterSkinSettings.java b/src/nmania/ui/ng/RasterSkinSettings.java index 5c3a625..5f273c7 100644 --- a/src/nmania/ui/ng/RasterSkinSettings.java +++ b/src/nmania/ui/ng/RasterSkinSettings.java @@ -26,7 +26,7 @@ public RasterSkinSettings() { left = new DataItem(1, "Offset from left", this, skin.leftOffset + "px"); holdW = new DataItem(2, "Holds width", this, skin.holdWidth + "px"); SetItems(new ListItem[] { new ListItem(0, "General info", this), left, holdW, - new ListItem(3, "Hold bodies color", this), + new ListItem(3, "Hold bodies color", this), new ListItem(9, "Column borders color", this), new CheckItem(4, "Keyboard sprites", this, skin.VerifyKb() == null), new CheckItem(5, "Note sprites", this, skin.VerifyNotes() == null), new CheckItem(6, "HUD sprites", this, skin.VerifyHud() == null), @@ -77,6 +77,9 @@ public void OnSelect(ListItem item, ListScreen screen, IDisplay display) { check = skin.VerifyJudgs(); display.Push(new Alert(item.text, check == null ? "Judgs sprites are okay!" : check)); break; + case 9: + display.Push(new ColorBox(item.text, 13, this, skin.bordersColor)); + break; } } @@ -99,6 +102,9 @@ public void OnNumberEntered(int UUID, int newNumber, IDisplay d) { skin.holdWidth = newNumber; holdW.data = String.valueOf(newNumber) + "px"; break; + case 13: + skin.bordersColor = newNumber; + break; } d.Back(); From 07bc40de0cf3a6337d58118b1f2f752c8b970b51 Mon Sep 17 00:00:00 2001 From: ansel <79257300125@ya.ru> Date: Sun, 14 May 2023 19:24:40 +0300 Subject: [PATCH 5/6] Add bg editor for raster --- src/nmania/ui/ng/RasterSkinSettings.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/nmania/ui/ng/RasterSkinSettings.java b/src/nmania/ui/ng/RasterSkinSettings.java index 5f273c7..17fd40d 100644 --- a/src/nmania/ui/ng/RasterSkinSettings.java +++ b/src/nmania/ui/ng/RasterSkinSettings.java @@ -27,6 +27,7 @@ public RasterSkinSettings() { holdW = new DataItem(2, "Holds width", this, skin.holdWidth + "px"); SetItems(new ListItem[] { new ListItem(0, "General info", this), left, holdW, new ListItem(3, "Hold bodies color", this), new ListItem(9, "Column borders color", this), + new ListItem(10, "Columns fill color", this), new CheckItem(4, "Keyboard sprites", this, skin.VerifyKb() == null), new CheckItem(5, "Note sprites", this, skin.VerifyNotes() == null), new CheckItem(6, "HUD sprites", this, skin.VerifyHud() == null), @@ -80,6 +81,9 @@ public void OnSelect(ListItem item, ListScreen screen, IDisplay display) { case 9: display.Push(new ColorBox(item.text, 13, this, skin.bordersColor)); break; + case 10: + display.Push(new PalleteBox(item.text, skin.background, pal3)); + break; } } From 2a1ec1966c6768e7d7aa1ff83740fd5cafdde417 Mon Sep 17 00:00:00 2001 From: ansel <79257300125@ya.ru> Date: Sun, 14 May 2023 19:29:21 +0300 Subject: [PATCH 6/6] Add ability to draw borders every frame --- src/nmania/Player.java | 2 ++ src/nmania/Settings.java | 4 ++++ src/nmania/ui/ng/SystemSettings.java | 5 +++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/nmania/Player.java b/src/nmania/Player.java index 07b54ed..a0d0db0 100644 --- a/src/nmania/Player.java +++ b/src/nmania/Player.java @@ -1219,6 +1219,8 @@ private final void Redraw(boolean flushAll) { g.setClip(0, 0, scrW, kbY); RedrawNotes(); g.setClip(0, 0, scrW, scrH); + if (Settings.redrawBorders) + DrawBorders(); RedrawAllHUD(); if (Settings.fullScreenFlush || flushAll) { diff --git a/src/nmania/Settings.java b/src/nmania/Settings.java index 62da7fa..050941f 100644 --- a/src/nmania/Settings.java +++ b/src/nmania/Settings.java @@ -111,6 +111,8 @@ else if (dir.charAt(dir.length() - 1) != '/') public static boolean rasterSkin; + public static boolean redrawBorders; + public static String GetLastDir() { int i = workingFolder.lastIndexOf('/', workingFolder.length() - 2); if (i == -1) @@ -162,6 +164,7 @@ public static final String Serialize() { j.accumulate("mods", new Integer(defaultMods)); j.accumulate("osr", new Boolean(encodeOsr)); j.accumulate("raster", new Boolean(rasterSkin)); + j.put("borders", redrawBorders); return j.toString(); } @@ -229,6 +232,7 @@ public static final void Load() { defaultMods = j.optInt("mods"); encodeOsr = j.optBoolean("osr", false); rasterSkin = j.optBoolean("raster", false); + redrawBorders = j.optBoolean("borders"); } catch (Exception e) { e.printStackTrace(); } diff --git a/src/nmania/ui/ng/SystemSettings.java b/src/nmania/ui/ng/SystemSettings.java index 8fac35a..3dddfce 100644 --- a/src/nmania/ui/ng/SystemSettings.java +++ b/src/nmania/ui/ng/SystemSettings.java @@ -13,7 +13,7 @@ public SystemSettings() { new SwitchItem(6, "High priority", this, Settings.maxPriority), new SwitchItem(7, "Switch threads", this, Settings.forceThreadSwitch), new SwitchItem(8, "Analyze beatmaps", this, Settings.analyzeMaps), // ?full - }); + new SwitchItem(9, "Redraw column borders", this, Settings.redrawBorders), }); } public String GetTitle() { @@ -54,7 +54,8 @@ public void OnSelect(ListItem item, ListScreen screen, IDisplay display) { case 8: Settings.analyzeMaps = !Settings.analyzeMaps; break; - default: + case 9: + Settings.redrawBorders = !Settings.redrawBorders; break; }