Skip to content

Commit 8c1b515

Browse files
committed
Allow cloaked units under player control to have SELECT cursor on it when about to select
1 parent 2e8eb97 commit 8c1b515

2 files changed

Lines changed: 23 additions & 17 deletions

File tree

src/CnCNetYR/Ra2Mode.cpp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -178,23 +178,6 @@ bool Ra2Mode::CheckSaveGameID(const char* saveGameName)
178178
return false;
179179
}
180180

181-
// Allow allies to repair on service depot
182-
DEFINE_HOOK(0x700594, TechnoClass_WhatAction__AllowAlliesRepair, 0x5)
183-
{
184-
if (!Ra2Mode::IsEnabled())
185-
return 0;
186-
187-
GET(TechnoClass*, pThis, ESI);
188-
GET(ObjectClass*, pObject, EDI);
189-
190-
auto const pBuilding = abstract_cast<BuildingClass* const>(pObject);
191-
auto const pBuildingOwner = pBuilding ? pBuilding->Owner : nullptr;
192-
193-
return (pBuildingOwner && pBuildingOwner->IsAlliedWith(pThis))
194-
? 0x70059D
195-
: 0x7005E6;
196-
}
197-
198181
// Allow to repair the BlackHawk Transport on service depot
199182
#pragma region AllowRepairFlyMZone
200183

src/Misc/Observers.Visibility.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,20 @@ DEFINE_HOOK(0x4ABE3C, DisplayClass_MouseLeftRelease_Cloak, 0xA)
125125
return Unselect;
126126
}
127127

128+
DEFINE_HOOK(0x692686, DisplayClass_DecideAction_Cloak, 0x6)
129+
{
130+
GET(TechnoClass*, pTechno, EDI);
131+
enum { ProceedCloakCheck = 0x692690, ShouldNotCheck = 0x6926DB };
132+
133+
if (pTechno->IsOwnedByCurrentPlayer || HouseClass::IsCurrentPlayerObserver())
134+
return ShouldNotCheck;
135+
136+
if (pTechno->Owner->IsMutualAllie(HouseClass::CurrentPlayer))
137+
return ShouldNotCheck;
138+
139+
return ProceedCloakCheck;
140+
}
141+
128142
// Show cloaked Technos on radar for observers and mutual allies
129143
DEFINE_HOOK(0x70D386, TechnoClass_Radar_Cloak, 0xA)
130144
{
@@ -165,6 +179,15 @@ DEFINE_HOOK(0x4AE62B, DisplayClass_HelpText_Cloak, 0x5)
165179
return CheckSensedByHouses;
166180
}
167181

182+
// Allow showing the select cursor on the object
183+
DEFINE_HOOK(0x700594, TechnoClass_WhatAction__AllowAllies, 0x5)
184+
{
185+
GET(TechnoClass*, pThis, ESI);
186+
GET(ObjectClass*, pObject, EDI);
187+
188+
return pThis->Owner->IsAlliedWith(pObject) ? 0x70059D : 0x7005E6;
189+
}
190+
168191
// Show disguised units (Spy and Mirage) for observer
169192
#pragma region
170193
// Show spy for observer

0 commit comments

Comments
 (0)