diff --git a/CREDITS.md b/CREDITS.md index 2d8ff598a9..f12f924c0f 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -608,6 +608,7 @@ This page lists all the individual contributions to the project by their author. - Use `SkipCrushSlowdown=true` to avoid the bug related to `Accelerates=true` and `MovementZone=CrushAll` - Auto deploy for GI-like infantry - Fix an issue that Ares' Type Conversion not resetting barrel's direction by `FireAngle` + - Fix an issue that jumpjets in air can not correctly spawn missiles - **solar-III (凤九歌)** - Target scanning delay customization (documentation) - Skip target scanning function calling for unarmed technos (documentation) diff --git a/docs/Fixed-or-Improved-Logics.md b/docs/Fixed-or-Improved-Logics.md index 54aca7c5c8..02e8f5fcbc 100644 --- a/docs/Fixed-or-Improved-Logics.md +++ b/docs/Fixed-or-Improved-Logics.md @@ -261,7 +261,8 @@ This page describes all ingame logics that are fixed or improved in Phobos witho - `DeployingAnim` now supports both `Normalized=true` and `Reverse=true`. Keep in mind `Reverse` uses `LoopEnd` for frame amount instead of `End` even without `LoopCount` > 1. - `DeployingAnim` using unit drawer now also tint accordingly with the unit. - Fixed the bug that armor multiplier of new attacheffect will have extra take effect once if restricted warheads. -- Fixed an issue that units' `LaserTrails` will always lags behind by one frame +- Fixed an issue that units' `LaserTrails` will always lags behind by one frame. +- Fixed an issue that jumpjets in air can not correctly spawn missiles. ## Fixes / interactions with other extensions diff --git a/docs/Whats-New.md b/docs/Whats-New.md index 7df23554e8..f347f33b3b 100644 --- a/docs/Whats-New.md +++ b/docs/Whats-New.md @@ -462,6 +462,7 @@ Vanilla fixes: - If `DeployingAnim` with `Shadow=true` is played for unit currently in air its shadow will now be drawn on ground (by Starkku) - `DeployingAnim` now supports both `Normalized=true` and `Reverse=true` (by Starkku) - `DeployingAnim` using unit drawer now also tint accordingly with the unit (by Starkku) +- Jumpjets in air now can correctly spawn missiles (by TaranDahl) Phobos fixes: - Fixed the bug that `AllowAirstrike=no` cannot completely prevent air strikes from being launched against it (by NetsuNegi) diff --git a/src/Ext/Techno/Hooks.Misc.cpp b/src/Ext/Techno/Hooks.Misc.cpp index 546243f977..697fa035b1 100644 --- a/src/Ext/Techno/Hooks.Misc.cpp +++ b/src/Ext/Techno/Hooks.Misc.cpp @@ -2,6 +2,7 @@ #include #include +#include #include @@ -79,6 +80,21 @@ DEFINE_HOOK(0x6B7265, SpawnManagerClass_AI_UpdateTimer, 0x6) return 0; } +// Fix Jumpjets can not spawn missiles in air. +DEFINE_HOOK(0x6B72FE, SpawnerManagerClass_AI_MissileCheck, 0x9) +{ + enum { SpawnMissile = 0x6B735C, NoSpawn = 0x6B795A }; + + GET(SpawnManagerClass*, pThis, ESI); + + auto pLoco = ((FootClass*)pThis->Owner)->Locomotor; // Ares has already handled the building case. + auto pLocoInterface = pLoco.GetInterfacePtr(); + + return (pLocoInterface->Is_Moving_Now() + || (!locomotion_cast(pLoco) && pLocoInterface->Is_Moving())) // Jumpjet should only check Is_Moving_Now. + ? NoSpawn : SpawnMissile; +} + DEFINE_HOOK_AGAIN(0x6B73BE, SpawnManagerClass_AI_SpawnTimer, 0x6) DEFINE_HOOK(0x6B73AD, SpawnManagerClass_AI_SpawnTimer, 0x5) {