diff --git a/docs/Fixed-or-Improved-Logics.md b/docs/Fixed-or-Improved-Logics.md index 26b15aed17..ca3aee3bb6 100644 --- a/docs/Fixed-or-Improved-Logics.md +++ b/docs/Fixed-or-Improved-Logics.md @@ -296,6 +296,7 @@ This page describes all ingame logics that are fixed or improved in Phobos witho - Fixed an issue that jumpjet infantries' shadow is always drawn even if they are cloaked. - Fixed an issue that technos head to building's dock even they are not going to dock. - Fixed an issue that the jumpjet vehicles cannot stop correctly after going berserk. +- Fixed the issue where Ares' `Flash.Duration` cannot override the weapon's repair flash effect. ```{note} The described behavior is a replica of and is compliant with XNA CnCNet Client's multiplayer save game support. diff --git a/src/Ext/TechnoType/Hooks.cpp b/src/Ext/TechnoType/Hooks.cpp index b20dbd625e..fb1ed48d1b 100644 --- a/src/Ext/TechnoType/Hooks.cpp +++ b/src/Ext/TechnoType/Hooks.cpp @@ -1,6 +1,7 @@ #include "Body.h" #include #include +#include DEFINE_HOOK(0x73D223, UnitClass_DrawIt_OreGath, 0x6) { @@ -127,3 +128,30 @@ DEFINE_HOOK(0x71464A, TechnoTypeClass_ReadINI_Speed, 0x7) return SkipGameCode; } + +DEFINE_HOOK(0x5F547E, ObjectClass_ReceiveDamage_FlashDuration, 0x6) +{ + GET(ObjectClass*, pThis, ESI); + GET(int, nNewHealth, EDX); + LEA_STACK(args_ReceiveDamage*, pArgs, STACK_OFFSET(0x24, 0x4)); + enum { SkipGameCode = 0x5F545C }; + + if (pThis->Health == nNewHealth) + return SkipGameCode; + + int nFlashDuration = 7; + if (auto pWH = pArgs->WH) + { + if (auto pWHEXT = WarheadTypeExt::ExtMap.Find(pWH)) + { + nFlashDuration = pWHEXT->Flash_Duration.Get(nFlashDuration); + } + } + + if (nFlashDuration > 0) + { + pThis->Flash(nFlashDuration); + } + + return SkipGameCode; +} diff --git a/src/Ext/WarheadType/Body.cpp b/src/Ext/WarheadType/Body.cpp index f32b351178..fb9b3761d7 100644 --- a/src/Ext/WarheadType/Body.cpp +++ b/src/Ext/WarheadType/Body.cpp @@ -119,6 +119,7 @@ void WarheadTypeExt::ExtData::LoadFromINIFile(CCINIClass* const pINI) INI_EX exINI(pINI); // Miscs + this->Flash_Duration.Read(exINI, pSection, "Flash.Duration"); this->Reveal.Read(exINI, pSection, "Reveal"); this->CreateGap.Read(exINI, pSection, "CreateGap"); this->TransactMoney.Read(exINI, pSection, "TransactMoney"); @@ -402,6 +403,7 @@ template void WarheadTypeExt::ExtData::Serialize(T& Stm) { Stm + .Process(this->Flash_Duration) .Process(this->Reveal) .Process(this->CreateGap) .Process(this->TransactMoney) diff --git a/src/Ext/WarheadType/Body.h b/src/Ext/WarheadType/Body.h index 271d1d36f5..6f24549461 100644 --- a/src/Ext/WarheadType/Body.h +++ b/src/Ext/WarheadType/Body.h @@ -21,6 +21,7 @@ class WarheadTypeExt { public: + Nullable Flash_Duration; Valueable Reveal; Valueable CreateGap; Valueable TransactMoney; @@ -229,6 +230,7 @@ class WarheadTypeExt public: ExtData(WarheadTypeClass* OwnerObject) : Extension(OwnerObject) + , Flash_Duration { 0 } , Reveal { 0 } , CreateGap { 0 } , TransactMoney { 0 }