From a90a67d6b5687dd57e9ce5c66c21b05639a4bb32 Mon Sep 17 00:00:00 2001 From: Starkku Date: Sun, 25 Aug 2024 22:28:22 +0300 Subject: [PATCH] Revert the subterranean harvester fixes, at least for now --- Phobos.vcxproj | 1 - docs/Fixed-or-Improved-Logics.md | 1 - docs/Whats-New.md | 3 +- src/Ext/Unit/Hooks.SubterraneanHarvester.cpp | 100 ------------------- 4 files changed, 1 insertion(+), 104 deletions(-) delete mode 100644 src/Ext/Unit/Hooks.SubterraneanHarvester.cpp diff --git a/Phobos.vcxproj b/Phobos.vcxproj index 17883b4837..da0fa52603 100644 --- a/Phobos.vcxproj +++ b/Phobos.vcxproj @@ -19,7 +19,6 @@ - diff --git a/docs/Fixed-or-Improved-Logics.md b/docs/Fixed-or-Improved-Logics.md index 2f6f87d0c6..c4a6ca02cc 100644 --- a/docs/Fixed-or-Improved-Logics.md +++ b/docs/Fixed-or-Improved-Logics.md @@ -163,7 +163,6 @@ This page describes all ingame logics that are fixed or improved in Phobos witho - Setting `[AudioVisual]` -> `ColorAddUse8BitRGB` to true makes game treat values from `[ColorAdd]` as 8-bit RGB (0-255) instead of RGB565 (0-31 for red & blue, 0-63 for green). This works for `LaserTargetColor`, `IronCurtainColor`, `BerserkColor` and `ForceShieldColor`. - Weapons with `AA=true` Projectile can now correctly fire at air units when both firer and target are over a bridge. - Fixed disguised units not using the correct palette if target has custom palette. -- Fixed `MovementZone=Subterannean` harvesters being unable to find docks if in area enclosed by water, cliffs etc. ## Fixes / interactions with other extensions diff --git a/docs/Whats-New.md b/docs/Whats-New.md index 49e9405157..489bfdd2cb 100644 --- a/docs/Whats-New.md +++ b/docs/Whats-New.md @@ -509,6 +509,7 @@ Vanilla fixes: - Units with `Sensors=true` will no longer reveal ally buildings (by Starkku) - Air units are now reliably included by target scan with large range and Warhead detonation by large `CellSpread` (by Starkku) - Weapons with `AA=true` Projectile can now correctly fire at air units when both firer and target are over a bridge (by Starkku) +- Fixed disguised units not using the correct palette if target has custom palette (by NetsuNegi) Phobos fixes: - Fixed a few errors of calling for superweapon launch by `LaunchSW` or building infiltration (by Trsdy) @@ -726,8 +727,6 @@ Vanilla fixes: - Fixed railgun particles being drawn to wrong coordinate against buildings with non-default `TargetCoordOffset` or when force-firing on bridges (by Starkku) - Fixed building `TargetCoordOffset` not being taken into accord for several things like fire angle calculations and target lines (by Starkku) - Allowed observers to see a selected building's radial indicator (by Trsdy) -- Fixed disguised units not using the correct palette if target has custom palette (by NetsuNegi) -- Fixed `MovementZone=Subterannean` harvesters being unable to find docks if in area enclosed by water, cliffs etc. (by Starkku) Phobos fixes: - Fixed shields being able to take damage when the parent TechnoType was under effects of a `Temporal` Warhead (by Starkku) diff --git a/src/Ext/Unit/Hooks.SubterraneanHarvester.cpp b/src/Ext/Unit/Hooks.SubterraneanHarvester.cpp deleted file mode 100644 index 25b713d99f..0000000000 --- a/src/Ext/Unit/Hooks.SubterraneanHarvester.cpp +++ /dev/null @@ -1,100 +0,0 @@ -#include - -// Hooks that allow harvesters / weeders to work correctly with MovementZone=Subterannean (sic). - -// Allow scanning for docks in all map zones. -DEFINE_HOOK(0x4DEFC6, FootClass_FindDock_SubterraneanHarvester, 0x5) -{ - GET(TechnoTypeClass*, pTechnoType, EAX); - - if (auto const pUnitType = abstract_cast(pTechnoType)) - { - if ((pUnitType->Harvester || pUnitType->Weeder) && pUnitType->MovementZone == MovementZone::Subterrannean) - R->ECX(MovementZone::Fly); - } - - return 0; -} - -// Allow scanning for ore in all map zones. -DEFINE_HOOK(0x4DCF86, FootClass_FindTiberium_SubterraneanHarvester, 0x5) -{ - enum { SkipGameCode = 0x4DCF9B }; - - GET(MovementZone, mZone, ECX); - - if (mZone == MovementZone::Subterrannean) - R->ECX(MovementZone::Fly); - - return 0; -} - -// Allow scanning for weeds in all map zones. -DEFINE_HOOK(0x4DDB23, FootClass_FindWeeds_SubterraneanHarvester, 0x5) -{ - enum { SkipGameCode = 0x4DCF9B }; - - GET(MovementZone, mZone, EAX); - - if (mZone == MovementZone::Subterrannean) - R->EAX(MovementZone::Fly); - - return 0; -} - -// Force harvest mission and clear all destination info etc. upon reaching the rally point. -DEFINE_HOOK(0x738A3E, UnitClass_EnterIdleMode_SubterraneanHarvester, 0x5) -{ - enum { ReturnFromFunction = 0x738D21 }; - - GET(UnitClass*, pThis, ESI); - - auto const pType = pThis->Type; - - if ((pType->Harvester || pType->Weeder) && pType->MovementZone == MovementZone::Subterrannean) - { - auto const pExt = TechnoExt::ExtMap.Find(pThis); - - if (pExt->SubterraneanHarvRallyPoint && pThis->GetMapCoords() == pExt->SubterraneanHarvRallyPoint->MapCoords) - { - pExt->SubterraneanHarvRallyPoint = nullptr; - pThis->SetDestination(nullptr, false); - pThis->ClearNavQueue(); - pThis->SetFocus(nullptr); - pThis->ForceMission(Mission::Harvest); - return ReturnFromFunction; - } - } - - return 0; -} - -// Set rally point. -DEFINE_HOOK(0x44459A, BuildingClass_ExitObject_SubterraneanHarvester, 0x5) -{ - GET(TechnoClass*, pThis, EDI); - - if (auto const pUnit = abstract_cast(pThis)) - { - auto const pType = pUnit->Type; - - if ((pType->Harvester || pType->Weeder) && pType->MovementZone == MovementZone::Subterrannean) - { - auto const pCell = abstract_cast(pThis->Focus); - TechnoExt::ExtMap.Find(pThis)->SubterraneanHarvRallyPoint = pCell; - } - } - - return 0; -} - -// Reset the rally point when it is not needed anymore. -DEFINE_HOOK(0x73EDA1, UnitClass_Mission_Harvest_SubterraneanHarvester, 0x6) -{ - GET(UnitClass*, pThis, EBP); - - if (pThis->Type->MovementZone == MovementZone::Subterrannean) - TechnoExt::ExtMap.Find(pThis)->SubterraneanHarvRallyPoint = nullptr; - - return 0; -}