From 111fd44e266a6d1894c33f7ce341dbd45caa1db4 Mon Sep 17 00:00:00 2001 From: FS-21 Date: Sat, 29 Jan 2022 13:35:41 +0100 Subject: [PATCH 1/2] Fix Convert.Deploy and Laser Trail combination Convert.Deploy is an Ares tag and need an extra check for loading the right Laser Trails when the unit is transformed. --- src/Ext/Techno/Hooks.cpp | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/src/Ext/Techno/Hooks.cpp b/src/Ext/Techno/Hooks.cpp index 2998b8d942..9208d290f9 100644 --- a/src/Ext/Techno/Hooks.cpp +++ b/src/Ext/Techno/Hooks.cpp @@ -318,4 +318,29 @@ DEFINE_HOOK(0x702819, TechnoClass_ReceiveDamage_Decloak, 0xA) } return 0x702823; -} \ No newline at end of file +} + +DEFINE_HOOK(0x73DE90, UnitClass_Mi_Unload_SimpleDeployer_Phobos, 0x6) +{ + GET(UnitClass*, pUnit, ESI); + + auto pTechnoExt = TechnoExt::ExtMap.Find(pUnit); + auto pTechnoTypeExt = TechnoTypeExt::ExtMap.Find(pUnit->GetTechnoType()); + + if (pTechnoExt && pTechnoTypeExt) + { + if (pTechnoExt->LaserTrails.size()) + pTechnoExt->LaserTrails.clear(); + + for (auto const& entry : pTechnoTypeExt->LaserTrailData) + { + if (auto const pLaserType = LaserTrailTypeClass::Array[entry.idxType].get()) + { + pTechnoExt->LaserTrails.push_back(std::make_unique( + pLaserType, pUnit->Owner, entry.FLH, entry.IsOnTurret)); + } + } + } + + return 0; +} From 4536163553a5e8c9a7ce77ac09e9ea69d55fd3d5 Mon Sep 17 00:00:00 2001 From: FS-21 Date: Sat, 29 Jan 2022 13:47:54 +0100 Subject: [PATCH 2/2] Change the Hook name Due to Phobos code style. --- src/Ext/Techno/Hooks.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Ext/Techno/Hooks.cpp b/src/Ext/Techno/Hooks.cpp index 9208d290f9..5879d32e7b 100644 --- a/src/Ext/Techno/Hooks.cpp +++ b/src/Ext/Techno/Hooks.cpp @@ -320,7 +320,7 @@ DEFINE_HOOK(0x702819, TechnoClass_ReceiveDamage_Decloak, 0xA) return 0x702823; } -DEFINE_HOOK(0x73DE90, UnitClass_Mi_Unload_SimpleDeployer_Phobos, 0x6) +DEFINE_HOOK(0x73DE90, UnitClass_SimpleDeployer_TransferLaserTrails, 0x6) { GET(UnitClass*, pUnit, ESI);