From 6bc6b11ae3f5f36dc29e6a233aa87cdbaa1df7fa Mon Sep 17 00:00:00 2001 From: shatyuka Date: Wed, 6 May 2026 01:20:25 +0800 Subject: [PATCH] Fix tint color RGB mode conversion --- docs/Whats-New.md | 1 + src/Utilities/GeneralUtils.cpp | 15 ++++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/docs/Whats-New.md b/docs/Whats-New.md index 15c4fdfcd0..d2a0f9d3c0 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; }