Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 15 additions & 0 deletions docs/New-or-Enhanced-Logics.md
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,21 @@ 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
[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

### Build area customizations
Expand Down
1 change: 1 addition & 0 deletions docs/Whats-New.md
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,7 @@ HideShakeEffects=false ; boolean
- [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)
- [Allowed customize that whether `Temporal=yes` warhead will cause target building animation poweroff](Fixed-or-Improved-Logics.md#allow-customize-that-whether-temporal-yes-warhead-will-cause-target-building-animation-poweroff) (by NetsuNegi)
- 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)
Expand Down
2 changes: 2 additions & 0 deletions src/Ext/HouseType/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ void HouseTypeExt::LoadFromINIFile(CCINIClass* pINI)
INI_EX exINI(pINI);

this->EVATag.Read(pINI, pSection, "EVA.Tag");
this->RevealHouses.Read(exINI, pSection, "RevealHouses");
}

template <typename T>
void HouseTypeExt::Serialize(T& Stm)
{
Stm
.Process(this->EVATag)
.Process(this->RevealHouses)
;
}

Expand Down
2 changes: 2 additions & 0 deletions src/Ext/HouseType/Body.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ class HouseTypeExt final : public AbstractTypeExt
}

EVAType EVATag;
Nullable<AffectedHouse> RevealHouses;

HouseTypeExt(HouseTypeClass* OwnerObject) : AbstractTypeExt(OwnerObject)
, EVATag { -2 }
, RevealHouses {}
{ }

virtual ~HouseTypeExt() = default;
Expand Down
29 changes: 29 additions & 0 deletions src/Ext/HouseType/Hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,32 @@

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<TechnoClass*>() : R->ESI<TechnoClass*>();

auto const pPlayer = HouseClass::CurrentPlayer;
auto const pHouse = pTechno->Owner;
const bool canShow = pPlayer ? EnumFunctions::CanTargetHouse(
HouseTypeExt::ExtMap.Find(pHouse->Type)->RevealHouses.Get(RulesExt::Global()->RevealHouses), pHouse, pPlayer)

Check warning on line 49 in src/Ext/HouseType/Hooks.cpp

View workflow job for this annotation

GitHub Actions / build

'Container<HouseTypeExt>::Find': use the extension class's Fetch instead [D:\a\Phobos\Phobos\Phobos.vcxproj]
: 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;
}
2 changes: 2 additions & 0 deletions src/Ext/Rules/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -1140,6 +1141,7 @@ void RulesExt::ExtData::Serialize(T& Stm)
.Process(this->Cloak_KickOutParasite)
.Process(this->CustomSequenceRates)
.Process(this->CustomSequenceNormalized)
.Process(this->RevealHouses)
;
}

Expand Down
4 changes: 4 additions & 0 deletions src/Ext/Rules/Body.h
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,8 @@ class RulesExt
// Global default per-sequence game-speed normalization flags for infantry
std::vector<int> CustomSequenceNormalized;

Valueable<AffectedHouse> RevealHouses;

ExtData(RulesClass* OwnerObject) : Extension<RulesClass>(OwnerObject)
, Storage_TiberiumIndex { -1 }
, HarvesterDumpAmount { 0.0f }
Expand Down Expand Up @@ -1051,6 +1053,8 @@ class RulesExt

, CustomSequenceRates(42, -1)
, CustomSequenceNormalized(42, -1)

, RevealHouses { AffectedHouse::Team }
{ }

virtual ~ExtData() = default;
Expand Down
Loading