diff --git a/CREDITS.md b/CREDITS.md index 6098478f2c..063458b44e 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -519,6 +519,7 @@ This page lists all the individual contributions to the project by their author. - Fix an issue where a unit might cause the target to fall from above its own head when using a locomotor warhead with `Locomotor=Jumpjet` to pull a target with `BalloonHover=yes` - Fix the EIP#007120F7 caused when the `Strength` value is lower than `RepairStep` - Allow the use of more precise calculation of repair costs + - Fix the initial direction of building placed by Ares's UnitDelivery superweapon - **Apollo** - Translucent SHP drawing patches - **ststl**: - Customizable `ShowTimer` priority of superweapons diff --git a/docs/Fixed-or-Improved-Logics.md b/docs/Fixed-or-Improved-Logics.md index b4c2ca429d..0b5a6f3ace 100644 --- a/docs/Fixed-or-Improved-Logics.md +++ b/docs/Fixed-or-Improved-Logics.md @@ -358,6 +358,7 @@ This page describes all ingame logics that are fixed or improved in Phobos witho - Fixed the bug that building with `Explodes=yes` use Ares's rubble logic will cause it's owner cannot defeat normally. - Modified the ares hook that stopped OpenTopped transports from firing if cloaked. - Fixed an Ares bug that led to erroneous interactions where the parasite would frequently reset to the victim's position under specific circumstances and that was highly prone to crashes. +- Fixed the initial direction of building placed by Ares's UnitDelivery superweapon. ## Newly added global settings diff --git a/docs/Whats-New.md b/docs/Whats-New.md index 70a236f4fd..bc68c51964 100644 --- a/docs/Whats-New.md +++ b/docs/Whats-New.md @@ -679,6 +679,7 @@ Fixes / interactions with other extensions: - Fixed the bug that building with `Explodes=yes` use Ares's rubble logic will cause it's owner cannot defeat normally (by NetsuNegi) - Modified the ares hook that stopped OpenTopped transports from firing if cloaked (by RAZER & Morton) - Fixed an Ares bug that led to erroneous interactions where the parasite would frequently reset to the victim's position under specific circumstances and that was highly prone to crashes (by NetsuNegi) +- Fixed the initial direction of building placed by Ares's UnitDelivery superweapon (by NetsuNegi) ``` diff --git a/docs/locale/zh_CN/LC_MESSAGES/CREDITS.po b/docs/locale/zh_CN/LC_MESSAGES/CREDITS.po index 21a31f888f..375725e28d 100644 --- a/docs/locale/zh_CN/LC_MESSAGES/CREDITS.po +++ b/docs/locale/zh_CN/LC_MESSAGES/CREDITS.po @@ -1700,6 +1700,11 @@ msgstr "修复了由于 `Strength` 值低于 `RepairStep` 时引发的 EIP#00712 msgid "Allow the use of more precise calculation of repair costs" msgstr "允许使用更精确的维修费用计算" +msgid "" +"Fix the initial direction of building placed by Ares's UnitDelivery superweapon" +msgstr "" +"修复了 Ares 的单位投放超级武器投放的建筑物的初始朝向" + msgid "**Apollo** - Translucent SHP drawing patches" msgstr "**Apollo** - 半透明 SHP 绘制补丁" diff --git a/docs/locale/zh_CN/LC_MESSAGES/Fixed-or-Improved-Logics.po b/docs/locale/zh_CN/LC_MESSAGES/Fixed-or-Improved-Logics.po index 8ae91f241a..65f4e83eb3 100644 --- a/docs/locale/zh_CN/LC_MESSAGES/Fixed-or-Improved-Logics.po +++ b/docs/locale/zh_CN/LC_MESSAGES/Fixed-or-Improved-Logics.po @@ -1803,6 +1803,10 @@ msgid "" "circumstances and that was highly prone to crashes." msgstr "修复了一个极易崩溃且导致寄生者特定条件下会被高频重设至受害者位置这一错误交互的 Ares Bug。" +msgid "" +"Fixed the initial direction of building placed by Ares's UnitDelivery superweapon." +msgstr "修复了 Ares 的单位投放超级武器投放的建筑物的初始朝向。" + msgid "Newly added global settings" msgstr "新增的全局设定" diff --git a/docs/locale/zh_CN/LC_MESSAGES/Whats-New.po b/docs/locale/zh_CN/LC_MESSAGES/Whats-New.po index 43d835faf9..72303f68b7 100644 --- a/docs/locale/zh_CN/LC_MESSAGES/Whats-New.po +++ b/docs/locale/zh_CN/LC_MESSAGES/Whats-New.po @@ -2389,6 +2389,10 @@ msgid "" "circumstances and that was highly prone to crashes (by NetsuNegi)" msgstr "修复了一个极易崩溃且导致寄生者特定条件下会被高频重设至受害者位置这一错误交互的 Ares Bug(by NetsuNegi)" +msgid "" +"Fixed the initial direction of building placed by Ares's UnitDelivery superweapon (by NetsuNegi)" +msgstr "修复了 Ares 的单位投放超级武器投放的建筑物的初始朝向(by NetsuNegi)" + msgid "0.4.0.3" msgstr "0.4.0.3" diff --git a/src/Misc/Hooks.AlphaImage.cpp b/src/Misc/Hooks.AlphaImage.cpp index 309772cf96..03088fcdc7 100644 --- a/src/Misc/Hooks.AlphaImage.cpp +++ b/src/Misc/Hooks.AlphaImage.cpp @@ -72,13 +72,8 @@ static void __fastcall UpdateAlphaShape(ObjectClass* pSource) const auto pBuilding = abstract_cast(pSource); - if (pBuilding) - { - const auto currMission = pBuilding->GetCurrentMission(); - - if (currMission != Mission::Construction && currMission != Mission::Selling) - inactive |= !pBuilding->IsPowerOnline() || BuildingExt::ExtMap.Find(pBuilding)->LimboID != -1; - } + if (pBuilding && !inactive && pBuilding->GetCurrentMission() != Mission::Construction) + inactive |= !pBuilding->IsPowerOnline() || BuildingExt::ExtMap.Find(pBuilding)->LimboID != -1; auto& alphaExt = *AresFunctions::AlphaExtMap; diff --git a/src/Misc/Hooks.Ares.cpp b/src/Misc/Hooks.Ares.cpp index d96fdeb303..a9a20d9410 100644 --- a/src/Misc/Hooks.Ares.cpp +++ b/src/Misc/Hooks.Ares.cpp @@ -1,4 +1,5 @@ #include +#include #include #include @@ -86,6 +87,26 @@ static bool __fastcall PermaMC_SetOwningHouse_Select(TechnoClass* pTechno, void* return result; } +namespace UnitDeliveryTemp +{ + bool Placing = false; +} + +static void __fastcall UnitDeliveryStateMachine_Update_Wrapper(void* pThis) +{ + UnitDeliveryTemp::Placing = true; + AresFunctions::UnitDeliveryStateMachine_Update(pThis); + UnitDeliveryTemp::Placing = false; +} + +DEFINE_HOOK(0x440580, BuildingClass_Unlimbo_UnitDeliveryFix, 0x5) +{ + if (UnitDeliveryTemp::Placing) + R->Stack(0x8, DirType::North); + + return 0; +} + _GET_FUNCTION_ADDRESS(RadarJammerClass::Update, AresRadarJammerClass_Update_GetAddr) void Apply_Ares3_0_Patches() @@ -159,6 +180,9 @@ void Apply_Ares3_0_Patches() // Handle select of MindControl.Permanent Patch::Apply_CALL(AresHelper::AresBaseAddress + 0x45EAF, &PermaMC_FreeUnit_SetContext); Patch::Apply_CALL6(AresHelper::AresBaseAddress + 0x45EBE, &PermaMC_SetOwningHouse_Select); + + // Fix building direction of Ares's UnitDelivery + Patch::Apply_VTABLE(AresHelper::AresBaseAddress + 0xA8D94, &UnitDeliveryStateMachine_Update_Wrapper); } void Apply_Ares3_0p1_Patches() @@ -234,4 +258,7 @@ void Apply_Ares3_0p1_Patches() // Handle select of MindControl.Permanent Patch::Apply_CALL(AresHelper::AresBaseAddress + 0x46A1F, &PermaMC_FreeUnit_SetContext); Patch::Apply_CALL6(AresHelper::AresBaseAddress + 0x46A2E, &PermaMC_SetOwningHouse_Select); + + // Fix building direction of Ares's UnitDelivery + Patch::Apply_VTABLE(AresHelper::AresBaseAddress + 0xA9F28, &UnitDeliveryStateMachine_Update_Wrapper); } diff --git a/src/Utilities/AresAddressInit.cpp b/src/Utilities/AresAddressInit.cpp index cac83b6e2a..4506a35d50 100644 --- a/src/Utilities/AresAddressInit.cpp +++ b/src/Utilities/AresAddressInit.cpp @@ -9,6 +9,7 @@ decltype(AresFunctions::CreateAresEBolt) AresFunctions::CreateAresEBolt = nullpt decltype(AresFunctions::SpawnSurvivors) AresFunctions::SpawnSurvivors = nullptr; decltype(AresFunctions::ReverseEngineer) AresFunctions::ReverseEngineer = nullptr; decltype(AresFunctions::IsTargetConstraintsEligible) AresFunctions::IsTargetConstraintsEligible = nullptr; +decltype(AresFunctions::UnitDeliveryStateMachine_Update) AresFunctions::UnitDeliveryStateMachine_Update = nullptr; std::function AresFunctions::SWTypeExtMap_Find; PhobosMap* AresFunctions::AlphaExtMap = nullptr; @@ -42,6 +43,8 @@ void AresFunctions::InitAres3_0() NOTE_ARES_FUN(IsTargetConstraintsEligible, 0x032110); + NOTE_ARES_FUN(UnitDeliveryStateMachine_Update, 0x075DE0); + NOTE_ARES_FUN(_SWTypeExtMapFind, 0x57C70); NOTE_ARES_FUN(_SWTypeExtMap, 0xC1C54); SWTypeExtMap_Find = [](SuperWeaponTypeClass* swt) { return _SWTypeExtMapFind(_SWTypeExtMap, swt); }; @@ -78,6 +81,8 @@ void AresFunctions::InitAres3_0p1() NOTE_ARES_FUN(IsTargetConstraintsEligible, 0x032AF0); + NOTE_ARES_FUN(UnitDeliveryStateMachine_Update, 0x076E90); + NOTE_ARES_FUN(_SWTypeExtMapFind, 0x58900); NOTE_ARES_FUN(_SWTypeExtMap, 0xC2C50); SWTypeExtMap_Find = [](SuperWeaponTypeClass* swt) { return _SWTypeExtMapFind(_SWTypeExtMap, swt); }; diff --git a/src/Utilities/AresFunctions.h b/src/Utilities/AresFunctions.h index 0d57755ac8..beb8f4948a 100644 --- a/src/Utilities/AresFunctions.h +++ b/src/Utilities/AresFunctions.h @@ -37,6 +37,8 @@ class AresFunctions static bool(__thiscall* IsTargetConstraintsEligible)(void*, HouseClass*, bool); + static void(__thiscall* UnitDeliveryStateMachine_Update)(void*); + static std::function SWTypeExtMap_Find; static PhobosMap* AlphaExtMap;