Skip to content

Commit 3781e02

Browse files
Belonitchaserli
andcommitted
Allow cloaked units under player control to have SELECT cursor on it when about to select
Co-Authored-By: Trsdy <9932846+chaserli@users.noreply.github.com>
1 parent 1019211 commit 3781e02

File tree

2 files changed

+23
-17
lines changed

2 files changed

+23
-17
lines changed

src/CnCNetYR/Ra2Mode.cpp

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

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

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->IsMutualAlly(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)