From 8c334a95d1de52bf51b8d88c93c3e9ce4f3708b0 Mon Sep 17 00:00:00 2001 From: Fly-Star <100747645+a851903106@users.noreply.github.com> Date: Sun, 6 Sep 2026 16:48:05 +0800 Subject: [PATCH 1/3] push code --- CREDITS.md | 1 + docs/New-or-Enhanced-Logics.md | 12 ++++++++++++ docs/Whats-New.md | 1 + src/Ext/HouseType/Body.cpp | 2 ++ src/Ext/HouseType/Body.h | 2 ++ src/Ext/HouseType/Hooks.cpp | 27 +++++++++++++++++++++++++++ 6 files changed, 45 insertions(+) diff --git a/CREDITS.md b/CREDITS.md index d0613cb59f..334dd86b3e 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -446,6 +446,7 @@ This page lists all the individual contributions to the project by their author. - SkipMapSelect Enhancement - Add a global default value for `KeepAlive` - Customized transport plane for teams + - Customize the country displayed in `Sight` - **NetsuNegi**: - Forbidding parallel AI queues by type - Jumpjet crash speed fix when crashing onto building diff --git a/docs/New-or-Enhanced-Logics.md b/docs/New-or-Enhanced-Logics.md index bf868e7c50..cb66734f3f 100644 --- a/docs/New-or-Enhanced-Logics.md +++ b/docs/New-or-Enhanced-Logics.md @@ -665,6 +665,18 @@ In `artmd.ini`: DetachedReport= ; Sound entry ``` +## Country + +### Customize the country displayed in `Sight` + +- You can now customize which countries the `Sight` unit for that nation provides map visibility to. + +In `rulesmd.ini`: +```ini +[COUNTRY] ; Country +RevealHouses=team ; Affected House Enumeration (none|owner/self|allies/ally|team|enemies/enemy|neutral|all) +``` + ## Buildings ### Build area customizations diff --git a/docs/Whats-New.md b/docs/Whats-New.md index 27a1a52a68..cab7d82c94 100644 --- a/docs/Whats-New.md +++ b/docs/Whats-New.md @@ -440,6 +440,7 @@ HideShakeEffects=false ; boolean - More veteran and elite abilities (by Ollerus) - [Attached animation draw offset customizations](Fixed-or-Improved-Logics.md#draw-offset-customization) (by Starkku) - [Draw offset rules for AttachEffect animations](New-or-Enhanced-Logics.md#attached-effects) by (Starkku) +- Customize the country displayed in `Sight` (by FlyStar) #### Vanilla fixes: - Fixed the bug where a building with `Factory=BuildingType` owned by the AI did not play `ProductionAnim` when placing a produced building (by Noble_Fish) diff --git a/src/Ext/HouseType/Body.cpp b/src/Ext/HouseType/Body.cpp index 08c0adfd4e..d52d80561f 100644 --- a/src/Ext/HouseType/Body.cpp +++ b/src/Ext/HouseType/Body.cpp @@ -18,6 +18,7 @@ void HouseTypeExt::LoadFromINIFile(CCINIClass* pINI) INI_EX exINI(pINI); this->EVATag.Read(pINI, pSection, "EVA.Tag"); + this->RevealHouses.Read(exINI, pSection, "RevealHouses"); } template @@ -25,6 +26,7 @@ void HouseTypeExt::Serialize(T& Stm) { Stm .Process(this->EVATag) + .Process(this->RevealHouses) ; } diff --git a/src/Ext/HouseType/Body.h b/src/Ext/HouseType/Body.h index c843286266..61b818fbca 100644 --- a/src/Ext/HouseType/Body.h +++ b/src/Ext/HouseType/Body.h @@ -26,9 +26,11 @@ class HouseTypeExt final : public AbstractTypeExt } EVAType EVATag; + Valueable RevealHouses; HouseTypeExt(HouseTypeClass* OwnerObject) : AbstractTypeExt(OwnerObject) , EVATag { -2 } + , RevealHouses { AffectedHouse::Team } { } virtual ~HouseTypeExt() = default; diff --git a/src/Ext/HouseType/Hooks.cpp b/src/Ext/HouseType/Hooks.cpp index 605bf0bbf7..93361cec6a 100644 --- a/src/Ext/HouseType/Hooks.cpp +++ b/src/Ext/HouseType/Hooks.cpp @@ -35,3 +35,30 @@ DEFINE_HOOK(0x68AD0C, ScenarioClass_ReadMap_SetEVAIndex, 0x7) return 0; } + +DEFINE_HOOK_AGAIN(0x70B1F2, TechnoClass_RevealHouses, 0x6) // TechnoClass::vt_entry_48C +DEFINE_HOOK_AGAIN(0x70B15A, TechnoClass_RevealHouses, 0x6) // TechnoClass::UpdateSight +DEFINE_HOOK(0x70AF22, TechnoClass_RevealHouses, 0x6) // TechnoClass::See +{ + const DWORD address = R->Origin(); + auto const pTechno = address == 0x70B1F2 ? R->ECX() : R->ESI(); + + auto const pPlayer = HouseClass::CurrentPlayer; + auto const pHouse = pTechno->Owner; + const bool canShow = pPlayer ? EnumFunctions::CanTargetHouse(HouseTypeExt::ExtMap.Find(pHouse->Type)->RevealHouses, pHouse, pPlayer) : false; + + switch (address) + { + case 0x70B1F2: + R->ESI(canShow ? pPlayer : nullptr); + break; + case 0x70B15A: + R->EDX(canShow ? pPlayer : nullptr); + return 0x70B160; + default: + R->EDX(canShow ? pPlayer : nullptr); + return 0x70AF28; + } + + return 0; +} From 38e5036232ccb8ceb6d5ac4c566496d9bb34ce6b Mon Sep 17 00:00:00 2001 From: Fly-Star <100747645+a851903106@users.noreply.github.com> Date: Sun, 6 Sep 2026 17:29:32 +0800 Subject: [PATCH 2/3] add global tag --- docs/New-or-Enhanced-Logics.md | 7 +++++-- src/Ext/HouseType/Body.h | 4 ++-- src/Ext/HouseType/Hooks.cpp | 4 +++- src/Ext/Rules/Body.cpp | 2 ++ src/Ext/Rules/Body.h | 4 ++++ 5 files changed, 16 insertions(+), 5 deletions(-) diff --git a/docs/New-or-Enhanced-Logics.md b/docs/New-or-Enhanced-Logics.md index cb66734f3f..84174339d4 100644 --- a/docs/New-or-Enhanced-Logics.md +++ b/docs/New-or-Enhanced-Logics.md @@ -673,8 +673,11 @@ DetachedReport= ; Sound entry In `rulesmd.ini`: ```ini -[COUNTRY] ; Country -RevealHouses=team ; Affected House Enumeration (none|owner/self|allies/ally|team|enemies/enemy|neutral|all) +[AudioVisual] +RevealHouses=team ; Affected House Enumeration (none|owner/self|allies/ally|team|enemies/enemy|neutral|all) + +[SOMECOUNTRY] ; Country +RevealHouses= ; Affected House Enumeration (none|owner/self|allies/ally|team|enemies/enemy|neutral|all), defaults to [AudioVisual] -> RevealHouses. ``` ## Buildings diff --git a/src/Ext/HouseType/Body.h b/src/Ext/HouseType/Body.h index 61b818fbca..f6d336c65c 100644 --- a/src/Ext/HouseType/Body.h +++ b/src/Ext/HouseType/Body.h @@ -26,11 +26,11 @@ class HouseTypeExt final : public AbstractTypeExt } EVAType EVATag; - Valueable RevealHouses; + Nullable RevealHouses; HouseTypeExt(HouseTypeClass* OwnerObject) : AbstractTypeExt(OwnerObject) , EVATag { -2 } - , RevealHouses { AffectedHouse::Team } + , RevealHouses {} { } virtual ~HouseTypeExt() = default; diff --git a/src/Ext/HouseType/Hooks.cpp b/src/Ext/HouseType/Hooks.cpp index 93361cec6a..c40abbc10e 100644 --- a/src/Ext/HouseType/Hooks.cpp +++ b/src/Ext/HouseType/Hooks.cpp @@ -45,7 +45,9 @@ DEFINE_HOOK(0x70AF22, TechnoClass_RevealHouses, 0x6) // TechnoClass::See auto const pPlayer = HouseClass::CurrentPlayer; auto const pHouse = pTechno->Owner; - const bool canShow = pPlayer ? EnumFunctions::CanTargetHouse(HouseTypeExt::ExtMap.Find(pHouse->Type)->RevealHouses, pHouse, pPlayer) : false; + const bool canShow = pPlayer ? EnumFunctions::CanTargetHouse( + HouseTypeExt::ExtMap.Find(pHouse->Type)->RevealHouses.Get(RulesExt::Global()->RevealHouses), pHouse, pPlayer) + : false; switch (address) { diff --git a/src/Ext/Rules/Body.cpp b/src/Ext/Rules/Body.cpp index c0319d97ba..afc55bd155 100644 --- a/src/Ext/Rules/Body.cpp +++ b/src/Ext/Rules/Body.cpp @@ -684,6 +684,7 @@ void RulesExt::ExtData::LoadBeforeTypeData(RulesClass* pThis, CCINIClass* pINI) this->CustomSequenceNormalized[i] = normalized ? 1 : 0; } + this->RevealHouses.Read(exINI, GameStrings::AudioVisual, "RevealHouses"); } // this should load everything that TypeData is not dependant on @@ -1140,6 +1141,7 @@ void RulesExt::ExtData::Serialize(T& Stm) .Process(this->Cloak_KickOutParasite) .Process(this->CustomSequenceRates) .Process(this->CustomSequenceNormalized) + .Process(this->RevealHouses) ; } diff --git a/src/Ext/Rules/Body.h b/src/Ext/Rules/Body.h index 9603b2570c..3051ddd23c 100644 --- a/src/Ext/Rules/Body.h +++ b/src/Ext/Rules/Body.h @@ -559,6 +559,8 @@ class RulesExt // Global default per-sequence game-speed normalization flags for infantry std::vector CustomSequenceNormalized; + Valueable RevealHouses; + ExtData(RulesClass* OwnerObject) : Extension(OwnerObject) , Storage_TiberiumIndex { -1 } , HarvesterDumpAmount { 0.0f } @@ -1051,6 +1053,8 @@ class RulesExt , CustomSequenceRates(42, -1) , CustomSequenceNormalized(42, -1) + + , RevealHouses { AffectedHouse::Team } { } virtual ~ExtData() = default; From e7d2223a9cc92aaae32f7cdb243818bd611adc1e Mon Sep 17 00:00:00 2001 From: Fly-Star <100747645+a851903106@users.noreply.github.com> Date: Sun, 6 Sep 2026 17:31:25 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20New-or-Enhanced-Logics?= =?UTF-8?q?.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/New-or-Enhanced-Logics.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/New-or-Enhanced-Logics.md b/docs/New-or-Enhanced-Logics.md index 84174339d4..5c2c195933 100644 --- a/docs/New-or-Enhanced-Logics.md +++ b/docs/New-or-Enhanced-Logics.md @@ -677,7 +677,7 @@ In `rulesmd.ini`: RevealHouses=team ; Affected House Enumeration (none|owner/self|allies/ally|team|enemies/enemy|neutral|all) [SOMECOUNTRY] ; Country -RevealHouses= ; Affected House Enumeration (none|owner/self|allies/ally|team|enemies/enemy|neutral|all), defaults to [AudioVisual] -> RevealHouses. +RevealHouses= ; Affected House Enumeration (none|owner/self|allies/ally|team|enemies/enemy|neutral|all), defaults to [AudioVisual] -> RevealHouses ``` ## Buildings