From 5ae8520f1459f4b1f8af799a5cab4395eaaacbee Mon Sep 17 00:00:00 2001 From: Noble_Fish <1065703286@qq.com> Date: Mon, 6 Apr 2026 23:09:04 +0800 Subject: [PATCH 1/2] initial --- docs/User-Interface.md | 9 +++++---- docs/Whats-New.md | 1 + src/Ext/Side/Body.cpp | 2 ++ src/Ext/Side/Body.h | 2 ++ src/Misc/Hooks.UI.cpp | 2 +- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/docs/User-Interface.md b/docs/User-Interface.md index 86385a49a6..df852b9d49 100644 --- a/docs/User-Interface.md +++ b/docs/User-Interface.md @@ -638,10 +638,10 @@ MissingCameo=XXICON.SHP ; filename - including the .shp/.pcx extension In `uimd.ini`: ```ini [Sidebar] -HarvesterCounter.Show=false ; boolean -HarvesterCounter.Label= ; CSF entry key -HarvesterCounter.ConditionYellow=99% ; floating point value, percents -HarvesterCounter.ConditionRed=50% ; floating point value, percents +HarvesterCounter.Show=false ; boolean +HarvesterCounter.Label= ; CSF entry key +HarvesterCounter.ConditionYellow=99% ; floating point value, percents +HarvesterCounter.ConditionRed=50% ; floating point value, percents ``` In `rulesmd.ini`: @@ -651,6 +651,7 @@ Harvester.Counted= ; boolean [SOMESIDE] ; Side Sidebar.HarvesterCounter.Offset=0,0 ; X,Y, pixels relative to default +Sidebar.HarvesterCounter.ColorGreen= ; integer - Red,Green,Blue, default to [Side] -> ToolTipColor= Sidebar.HarvesterCounter.ColorYellow=255,255,0 ; integer - Red,Green,Blue Sidebar.HarvesterCounter.ColorRed=255,0,0 ; integer - Red,Green,Blue ``` diff --git a/docs/Whats-New.md b/docs/Whats-New.md index ec2d41e947..674d0d4d72 100644 --- a/docs/Whats-New.md +++ b/docs/Whats-New.md @@ -561,6 +561,7 @@ New: - [Customize default mirage disguises per vehicletypes](New-or-Enhanced-Logics.md#default-mirage-disguise-for-individual-vehicletypes) (by NetsuNegi) - [Allow customize jumpjet properties on warhead](Fixed-or-Improved-Logics.md#customizing-locomotor-warhead) (by NetsuNegi) - Customize effects range of power plant enhancer (by NetsuNegi) +- Allow each side to customize the color when the proportion of working miners is higher than `HarvesterCounter.ConditionYellow` (by Noble_Fish) Vanilla fixes: - Fixed sidebar not updating queued unit numbers when adding or removing units when the production is on hold (by CrimRecya) diff --git a/src/Ext/Side/Body.cpp b/src/Ext/Side/Body.cpp index b0eabbd0ff..25677946e4 100644 --- a/src/Ext/Side/Body.cpp +++ b/src/Ext/Side/Body.cpp @@ -31,6 +31,7 @@ void SideExt::ExtData::LoadFromINIFile(CCINIClass* pINI) this->IngameScore_WinTheme = pINI->ReadTheme(pSection, "IngameScore.WinTheme", this->IngameScore_WinTheme); this->IngameScore_LoseTheme = pINI->ReadTheme(pSection, "IngameScore.LoseTheme", this->IngameScore_LoseTheme); this->Sidebar_HarvesterCounter_Offset.Read(exINI, pSection, "Sidebar.HarvesterCounter.Offset"); + this->Sidebar_HarvesterCounter_Green.Read(exINI, pSection, "Sidebar.HarvesterCounter.ColorGreen"); this->Sidebar_HarvesterCounter_Yellow.Read(exINI, pSection, "Sidebar.HarvesterCounter.ColorYellow"); this->Sidebar_HarvesterCounter_Red.Read(exINI, pSection, "Sidebar.HarvesterCounter.ColorRed"); this->Sidebar_WeedsCounter_Offset.Read(exINI, pSection, "Sidebar.WeedsCounter.Offset"); @@ -64,6 +65,7 @@ void SideExt::ExtData::Serialize(T& Stm) .Process(this->ArrayIndex) .Process(this->Sidebar_GDIPositions) .Process(this->Sidebar_HarvesterCounter_Offset) + .Process(this->Sidebar_HarvesterCounter_Green) .Process(this->Sidebar_HarvesterCounter_Yellow) .Process(this->Sidebar_HarvesterCounter_Red) .Process(this->Sidebar_WeedsCounter_Offset) diff --git a/src/Ext/Side/Body.h b/src/Ext/Side/Body.h index 27a868cfa0..c5c56282d4 100644 --- a/src/Ext/Side/Body.h +++ b/src/Ext/Side/Body.h @@ -20,6 +20,7 @@ class SideExt Valueable IngameScore_WinTheme; Valueable IngameScore_LoseTheme; Valueable Sidebar_HarvesterCounter_Offset; + Nullable Sidebar_HarvesterCounter_Green; Valueable Sidebar_HarvesterCounter_Yellow; Valueable Sidebar_HarvesterCounter_Red; Valueable Sidebar_WeedsCounter_Offset; @@ -48,6 +49,7 @@ class SideExt , IngameScore_WinTheme { -2 } , IngameScore_LoseTheme { -2 } , Sidebar_HarvesterCounter_Offset { { 0, 0 } } + , Sidebar_HarvesterCounter_Green { } , Sidebar_HarvesterCounter_Yellow { { 255, 255, 0 } } , Sidebar_HarvesterCounter_Red { { 255, 0, 0 } } , Sidebar_WeedsCounter_Offset { { 0, 0 } } diff --git a/src/Misc/Hooks.UI.cpp b/src/Misc/Hooks.UI.cpp index 709b824882..626600eae1 100644 --- a/src/Misc/Hooks.UI.cpp +++ b/src/Misc/Hooks.UI.cpp @@ -92,7 +92,7 @@ DEFINE_HOOK(0x4A25E0, CreditsClass_GraphicLogic_HarvesterCounter, 0x7) const double nPercentage = nTotal == 0 ? 1.0 : (double)nActive / (double)nTotal; const ColorStruct clrToolTip = nPercentage > Phobos::UI::HarvesterCounter_ConditionYellow - ? Drawing::TooltipColor : nPercentage > Phobos::UI::HarvesterCounter_ConditionRed + ? pSideExt->Sidebar_HarvesterCounter_Green.Get(Drawing::TooltipColor) : nPercentage > Phobos::UI::HarvesterCounter_ConditionRed ? pSideExt->Sidebar_HarvesterCounter_Yellow : pSideExt->Sidebar_HarvesterCounter_Red; swprintf_s(counter, L"%ls%d/%d", Phobos::UI::HarvesterLabel, nActive, nTotal); From eda154bed61915ecfbf6f6f6eb4547f3cae659f9 Mon Sep 17 00:00:00 2001 From: Noble_Fish <1065703286@qq.com> Date: Mon, 6 Apr 2026 23:34:40 +0800 Subject: [PATCH 2/2] =?UTF-8?q?`=5F`=E2=86=92`=5FCo?= =?UTF-8?q?lor`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Ext/Side/Body.cpp | 28 ++++++++++++++-------------- src/Ext/Side/Body.h | 28 ++++++++++++++-------------- src/Misc/Hooks.UI.cpp | 10 +++++----- 3 files changed, 33 insertions(+), 33 deletions(-) diff --git a/src/Ext/Side/Body.cpp b/src/Ext/Side/Body.cpp index 25677946e4..63d197a7c9 100644 --- a/src/Ext/Side/Body.cpp +++ b/src/Ext/Side/Body.cpp @@ -31,17 +31,17 @@ void SideExt::ExtData::LoadFromINIFile(CCINIClass* pINI) this->IngameScore_WinTheme = pINI->ReadTheme(pSection, "IngameScore.WinTheme", this->IngameScore_WinTheme); this->IngameScore_LoseTheme = pINI->ReadTheme(pSection, "IngameScore.LoseTheme", this->IngameScore_LoseTheme); this->Sidebar_HarvesterCounter_Offset.Read(exINI, pSection, "Sidebar.HarvesterCounter.Offset"); - this->Sidebar_HarvesterCounter_Green.Read(exINI, pSection, "Sidebar.HarvesterCounter.ColorGreen"); - this->Sidebar_HarvesterCounter_Yellow.Read(exINI, pSection, "Sidebar.HarvesterCounter.ColorYellow"); - this->Sidebar_HarvesterCounter_Red.Read(exINI, pSection, "Sidebar.HarvesterCounter.ColorRed"); + this->Sidebar_HarvesterCounter_ColorGreen.Read(exINI, pSection, "Sidebar.HarvesterCounter.ColorGreen"); + this->Sidebar_HarvesterCounter_ColorYellow.Read(exINI, pSection, "Sidebar.HarvesterCounter.ColorYellow"); + this->Sidebar_HarvesterCounter_ColorRed.Read(exINI, pSection, "Sidebar.HarvesterCounter.ColorRed"); this->Sidebar_WeedsCounter_Offset.Read(exINI, pSection, "Sidebar.WeedsCounter.Offset"); this->Sidebar_WeedsCounter_Color.Read(exINI, pSection, "Sidebar.WeedsCounter.Color"); this->Sidebar_ProducingProgress_Offset.Read(exINI, pSection, "Sidebar.ProducingProgress.Offset"); this->Sidebar_PowerDelta_Offset.Read(exINI, pSection, "Sidebar.PowerDelta.Offset"); - this->Sidebar_PowerDelta_Green.Read(exINI, pSection, "Sidebar.PowerDelta.ColorGreen"); - this->Sidebar_PowerDelta_Yellow.Read(exINI, pSection, "Sidebar.PowerDelta.ColorYellow"); - this->Sidebar_PowerDelta_Red.Read(exINI, pSection, "Sidebar.PowerDelta.ColorRed"); - this->Sidebar_PowerDelta_Grey.Read(exINI, pSection, "Sidebar.PowerDelta.ColorGrey"); + this->Sidebar_PowerDelta_ColorGreen.Read(exINI, pSection, "Sidebar.PowerDelta.ColorGreen"); + this->Sidebar_PowerDelta_ColorYellow.Read(exINI, pSection, "Sidebar.PowerDelta.ColorYellow"); + this->Sidebar_PowerDelta_ColorRed.Read(exINI, pSection, "Sidebar.PowerDelta.ColorRed"); + this->Sidebar_PowerDelta_ColorGrey.Read(exINI, pSection, "Sidebar.PowerDelta.ColorGrey"); this->Sidebar_PowerDelta_Align.Read(exINI, pSection, "Sidebar.PowerDelta.Align"); this->ToolTip_Background_Color.Read(exINI, pSection, "ToolTip.Background.Color"); this->ToolTip_Background_Opacity.Read(exINI, pSection, "ToolTip.Background.Opacity"); @@ -65,17 +65,17 @@ void SideExt::ExtData::Serialize(T& Stm) .Process(this->ArrayIndex) .Process(this->Sidebar_GDIPositions) .Process(this->Sidebar_HarvesterCounter_Offset) - .Process(this->Sidebar_HarvesterCounter_Green) - .Process(this->Sidebar_HarvesterCounter_Yellow) - .Process(this->Sidebar_HarvesterCounter_Red) + .Process(this->Sidebar_HarvesterCounter_ColorGreen) + .Process(this->Sidebar_HarvesterCounter_ColorYellow) + .Process(this->Sidebar_HarvesterCounter_ColorRed) .Process(this->Sidebar_WeedsCounter_Offset) .Process(this->Sidebar_WeedsCounter_Color) .Process(this->Sidebar_ProducingProgress_Offset) .Process(this->Sidebar_PowerDelta_Offset) - .Process(this->Sidebar_PowerDelta_Green) - .Process(this->Sidebar_PowerDelta_Yellow) - .Process(this->Sidebar_PowerDelta_Red) - .Process(this->Sidebar_PowerDelta_Grey) + .Process(this->Sidebar_PowerDelta_ColorGreen) + .Process(this->Sidebar_PowerDelta_ColorYellow) + .Process(this->Sidebar_PowerDelta_ColorRed) + .Process(this->Sidebar_PowerDelta_ColorGrey) .Process(this->Sidebar_PowerDelta_Align) .Process(this->ToolTip_Background_Color) .Process(this->ToolTip_Background_Opacity) diff --git a/src/Ext/Side/Body.h b/src/Ext/Side/Body.h index c5c56282d4..7605294640 100644 --- a/src/Ext/Side/Body.h +++ b/src/Ext/Side/Body.h @@ -20,17 +20,17 @@ class SideExt Valueable IngameScore_WinTheme; Valueable IngameScore_LoseTheme; Valueable Sidebar_HarvesterCounter_Offset; - Nullable Sidebar_HarvesterCounter_Green; - Valueable Sidebar_HarvesterCounter_Yellow; - Valueable Sidebar_HarvesterCounter_Red; + Nullable Sidebar_HarvesterCounter_ColorGreen; + Valueable Sidebar_HarvesterCounter_ColorYellow; + Valueable Sidebar_HarvesterCounter_ColorRed; Valueable Sidebar_WeedsCounter_Offset; Nullable Sidebar_WeedsCounter_Color; Valueable Sidebar_ProducingProgress_Offset; Valueable Sidebar_PowerDelta_Offset; - Valueable Sidebar_PowerDelta_Green; - Valueable Sidebar_PowerDelta_Yellow; - Valueable Sidebar_PowerDelta_Red; - Valueable Sidebar_PowerDelta_Grey; + Valueable Sidebar_PowerDelta_ColorGreen; + Valueable Sidebar_PowerDelta_ColorYellow; + Valueable Sidebar_PowerDelta_ColorRed; + Valueable Sidebar_PowerDelta_ColorGrey; Valueable Sidebar_PowerDelta_Align; Nullable ToolTip_Background_Color; Nullable ToolTip_Background_Opacity; @@ -49,17 +49,17 @@ class SideExt , IngameScore_WinTheme { -2 } , IngameScore_LoseTheme { -2 } , Sidebar_HarvesterCounter_Offset { { 0, 0 } } - , Sidebar_HarvesterCounter_Green { } - , Sidebar_HarvesterCounter_Yellow { { 255, 255, 0 } } - , Sidebar_HarvesterCounter_Red { { 255, 0, 0 } } + , Sidebar_HarvesterCounter_ColorGreen { } + , Sidebar_HarvesterCounter_ColorYellow { { 255, 255, 0 } } + , Sidebar_HarvesterCounter_ColorRed { { 255, 0, 0 } } , Sidebar_WeedsCounter_Offset { { 0, 0 } } , Sidebar_WeedsCounter_Color {} , Sidebar_ProducingProgress_Offset { { 0, 0 } } , Sidebar_PowerDelta_Offset { { 0, 0 } } - , Sidebar_PowerDelta_Green { { 0, 255, 0 } } - , Sidebar_PowerDelta_Yellow { { 255, 255, 0 } } - , Sidebar_PowerDelta_Red { { 255, 0, 0 } } - , Sidebar_PowerDelta_Grey { { 0x80,0x80,0x80 } } + , Sidebar_PowerDelta_ColorGreen { { 0, 255, 0 } } + , Sidebar_PowerDelta_ColorYellow { { 255, 255, 0 } } + , Sidebar_PowerDelta_ColorRed { { 255, 0, 0 } } + , Sidebar_PowerDelta_ColorGrey { { 0x80,0x80,0x80 } } , Sidebar_PowerDelta_Align { TextAlign::Left } , ToolTip_Background_Color { } , ToolTip_Background_Opacity { } diff --git a/src/Misc/Hooks.UI.cpp b/src/Misc/Hooks.UI.cpp index 626600eae1..f1ae6c21c1 100644 --- a/src/Misc/Hooks.UI.cpp +++ b/src/Misc/Hooks.UI.cpp @@ -92,8 +92,8 @@ DEFINE_HOOK(0x4A25E0, CreditsClass_GraphicLogic_HarvesterCounter, 0x7) const double nPercentage = nTotal == 0 ? 1.0 : (double)nActive / (double)nTotal; const ColorStruct clrToolTip = nPercentage > Phobos::UI::HarvesterCounter_ConditionYellow - ? pSideExt->Sidebar_HarvesterCounter_Green.Get(Drawing::TooltipColor) : nPercentage > Phobos::UI::HarvesterCounter_ConditionRed - ? pSideExt->Sidebar_HarvesterCounter_Yellow : pSideExt->Sidebar_HarvesterCounter_Red; + ? pSideExt->Sidebar_HarvesterCounter_ColorGreen.Get(Drawing::TooltipColor) : nPercentage > Phobos::UI::HarvesterCounter_ConditionRed + ? pSideExt->Sidebar_HarvesterCounter_ColorYellow : pSideExt->Sidebar_HarvesterCounter_ColorRed; swprintf_s(counter, L"%ls%d/%d", Phobos::UI::HarvesterLabel, nActive, nTotal); @@ -115,7 +115,7 @@ DEFINE_HOOK(0x4A25E0, CreditsClass_GraphicLogic_HarvesterCounter, 0x7) if (pPlayer->PowerBlackoutTimer.InProgress()) { - clrToolTip = pSideExt->Sidebar_PowerDelta_Grey; + clrToolTip = pSideExt->Sidebar_PowerDelta_ColorGrey; swprintf_s(counter, L"%ls", Phobos::UI::PowerBlackoutLabel); } else @@ -127,8 +127,8 @@ DEFINE_HOOK(0x4A25E0, CreditsClass_GraphicLogic_HarvesterCounter, 0x7) ? Phobos::UI::PowerDelta_ConditionRed * 2.f : Phobos::UI::PowerDelta_ConditionYellow; clrToolTip = percent < Phobos::UI::PowerDelta_ConditionYellow - ? pSideExt->Sidebar_PowerDelta_Green : LESS_EQUAL(percent, Phobos::UI::PowerDelta_ConditionRed) - ? pSideExt->Sidebar_PowerDelta_Yellow : pSideExt->Sidebar_PowerDelta_Red; + ? pSideExt->Sidebar_PowerDelta_ColorGreen : LESS_EQUAL(percent, Phobos::UI::PowerDelta_ConditionRed) + ? pSideExt->Sidebar_PowerDelta_ColorYellow : pSideExt->Sidebar_PowerDelta_ColorRed; swprintf_s(counter, L"%ls%+d", Phobos::UI::PowerLabel, delta); }