diff --git a/docs/Whats-New.md b/docs/Whats-New.md index 0169f87e34..64c77d037d 100644 --- a/docs/Whats-New.md +++ b/docs/Whats-New.md @@ -654,6 +654,7 @@ Vanilla fixes: - `ElectricAssault` weapons can now auto acquire allies' overpowerable defenses (by Ollerus) - Fixed the issue that the time for units in the area guard mission to reacquire targets after eliminating the target is significantly longer than that in other missions (by TaranDahl) - Purely visual animations and particles excluded from sync checks (by Starkku) +- Fixed the issue where tint color RGB mode conversion was incorrect (by Shatyuka) Phobos fixes: - Fixed the bug that `AllowAirstrike=no` cannot completely prevent air strikes from being launched against it (by NetsuNegi) diff --git a/src/Utilities/GeneralUtils.cpp b/src/Utilities/GeneralUtils.cpp index 01db3dd956..03031edb64 100644 --- a/src/Utilities/GeneralUtils.cpp +++ b/src/Utilities/GeneralUtils.cpp @@ -282,13 +282,18 @@ int GeneralUtils::GetColorFromColorAdd(int colorIndex) const int green = color.G; const int blue = color.B; - if (Drawing::ColorMode == RGBMode::RGB565) + switch (Drawing::ColorMode) + { + case RGBMode::RGB565: colorValue |= blue | (32 * (green | (red << 6))); - - if (Drawing::ColorMode != RGBMode::RGB655) + break; + case RGBMode::RGB556: colorValue |= blue | (((32 * red) | (green >> 1)) << 6); - - colorValue |= blue | (32 * ((32 * red) | (green >> 1))); + break; + default: + colorValue |= blue | (32 * ((32 * red) | (green >> 1))); + break; + } return colorValue; }