Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow cloaked units under player control to have SELECT cursor on it when about to select #20

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
17 changes: 0 additions & 17 deletions src/HardEndStuff/Ra2Mode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,23 +178,6 @@ bool Ra2Mode::CheckSaveGameID(const char* saveGameName)
return false;
}

// Allow allies to repair on service depot
DEFINE_HOOK(0x700594, TechnoClass_WhatAction__AllowAlliesRepair, 0x5)
{
if (!Ra2Mode::IsEnabled())
return 0;

GET(TechnoClass*, pThis, ESI);
GET(ObjectClass*, pObject, EDI);

auto const pBuilding = abstract_cast<BuildingClass* const>(pObject);
auto const pBuildingOwner = pBuilding ? pBuilding->Owner : nullptr;

return (pBuildingOwner && pBuildingOwner->IsAlliedWith(pThis))
? 0x70059D
: 0x7005E6;
}

// Allow to repair the BlackHawk Transport on service depot
#pragma region AllowRepairFlyMZone

Expand Down
23 changes: 23 additions & 0 deletions src/Misc/Observers.Visibility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,20 @@ DEFINE_HOOK(0x4ABE3C, DisplayClass_MouseLeftRelease_Cloak, 0xA)
return Unselect;
}

DEFINE_HOOK(0x692686, DisplayClass_DecideAction_Cloak, 0x6)
{
GET(TechnoClass*, pTechno, EDI);
enum { ProceedCloakCheck = 0x692690, ShouldNotCheck = 0x6926DB };

if (pTechno->IsOwnedByCurrentPlayer || HouseClass::IsCurrentPlayerObserver())
return ShouldNotCheck;

if (pTechno->Owner->IsMutualAllie(HouseClass::CurrentPlayer))
return ShouldNotCheck;

return ProceedCloakCheck;
}

// Show cloaked Technos on radar for observers and mutual allies
DEFINE_HOOK(0x70D386, TechnoClass_Radar_Cloak, 0xA)
{
Expand Down Expand Up @@ -165,6 +179,15 @@ DEFINE_HOOK(0x4AE62B, DisplayClass_HelpText_Cloak, 0x5)
return CheckSensedByHouses;
}

// Allow showing the select cursor on the object
DEFINE_HOOK(0x700594, TechnoClass_WhatAction__AllowAllies, 0x5)
{
GET(TechnoClass*, pThis, ESI);
GET(ObjectClass*, pObject, EDI);

return pThis->Owner->IsAlliedWith(pObject) ? 0x70059D : 0x7005E6;
}

// Show disguised units (Spy and Mirage) for observer
#pragma region
// Show spy for observer
Expand Down