From 229cfaf4ca4d20b0c56ec2e539c18ce55675d4e9 Mon Sep 17 00:00:00 2001 From: kuroppoi <68156848+kuroppoi@users.noreply.github.com> Date: Sat, 15 Jul 2023 21:11:31 +0200 Subject: [PATCH] Fix C-Gear skin preview inaccuracy --- .../java/entralinked/utility/TiledImageUtility.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/entralinked/utility/TiledImageUtility.java b/src/main/java/entralinked/utility/TiledImageUtility.java index 638b404..f540b14 100644 --- a/src/main/java/entralinked/utility/TiledImageUtility.java +++ b/src/main/java/entralinked/utility/TiledImageUtility.java @@ -128,7 +128,16 @@ public class TiledImageUtility { // In cases where background colors are present, pixels that use the *first* foreground color // will be replaced by the background color at that pixel's location. for(int i = 0; i < COLOR_PALETTE_SIZE; i++) { - colorPalette[i] = ColorUtility.convertBGR555ToRGB888(inputStream.readShort()); + int color = inputStream.readShort(); + + // The game seems to always replace the first color of the foreground with the background, + // so let's just set it to black so that C-Gear skin previews are more accurate. + // This won't do anything for Pokédex skins, as they use a special background color palette. + if(i == 0) { + colorPalette[i] = 0; + } else { + colorPalette[i] = ColorUtility.convertBGR555ToRGB888(color); + } } // Read background color data.