diff --git a/docs/Fixed-or-Improved-Logics.md b/docs/Fixed-or-Improved-Logics.md index 2ee15a0dd5..61379b9738 100644 --- a/docs/Fixed-or-Improved-Logics.md +++ b/docs/Fixed-or-Improved-Logics.md @@ -2446,8 +2446,8 @@ In `rulesmd.ini`: AnimList.PickRandom=false ; boolean AnimList.CreateAll=false ; boolean AnimList.CreationInterval=0 ; integer -AnimList.ScatterMin=0.0 ; floating point value, distance in cells -AnimList.ScatterMax=0.0 ; floating point value, distance in cells +AnimList.ScatterMin=0.0 ; floating point value, distance in cells, default to 0.125 if [Projectile] -> Inviso=true, and 0 if false +AnimList.ScatterMax= ; floating point value, distance in cells, default to 0.125 if [Projectile] -> Inviso=true, and 0 if false SplashList= ; List of AnimationTypes, default to [CombatDamage] -> SplashList SplashList.PickRandom=false ; boolean SplashList.CreateAll=false ; boolean diff --git a/docs/Whats-New.md b/docs/Whats-New.md index 2c722f95b8..88b5518848 100644 --- a/docs/Whats-New.md +++ b/docs/Whats-New.md @@ -662,6 +662,7 @@ Phobos fixes: - Fixed the bug that the upgrade building's power-enhancing effect depends only on its parent building and is not related to the upgrade building itself (by NetsuNegi) - Fixed an issue where hover vehicles could not be destroyed after malfunctioning on water surfaces (by FlyStar) - Fixed an issue where shadow matrix scaling was incorrectly applied to `TurretOffset` causing turret shadow misplacement (by Noble_Fish) +- Fixed an issue that customizable warhead animation scatter cannot override 32 leptons scatter of `Inviso=yes` projectile (by NetsuNegi) Fixes / interactions with other extensions: diff --git a/docs/locale/zh_CN/LC_MESSAGES/Whats-New.po b/docs/locale/zh_CN/LC_MESSAGES/Whats-New.po index 53f5e0f7cb..f512ff8b87 100644 --- a/docs/locale/zh_CN/LC_MESSAGES/Whats-New.po +++ b/docs/locale/zh_CN/LC_MESSAGES/Whats-New.po @@ -2301,6 +2301,11 @@ msgid "" "`TurretOffset` causing turret shadow misplacement (by Noble_Fish)" msgstr "修复了一个影子矩阵缩放错误地应用于 `TurretOffset` 而导致炮塔影子错位的问题(by Noble_Fish)" +msgid "" +"Fixed an issue that customizable warhead animation scatter cannot " +"override 32 leptons scatter of `Inviso=yes` projectile (by NetsuNegi)" +msgstr "修复了自定义弹头动画散布范围不能覆盖 `Inviso=yes` 抛射体自带 32 leptons 散布的问题(by NetsuNegi)" + msgid "Fixes / interactions with other extensions:" msgstr "其他扩展引擎相关的修复/交互:" diff --git a/src/Ext/Bullet/Hooks.DetonateLogics.cpp b/src/Ext/Bullet/Hooks.DetonateLogics.cpp index 56ecc8d8fc..7d44a9459d 100644 --- a/src/Ext/Bullet/Hooks.DetonateLogics.cpp +++ b/src/Ext/Bullet/Hooks.DetonateLogics.cpp @@ -252,6 +252,8 @@ DEFINE_HOOK(0x469B44, BulletClass_Logics_LandTypeCheck, 0x6) return 0; } +DEFINE_JUMP(LJMP, 0x469AC1, 0x469AF0) // Skip random scatter in vanilla code + DEFINE_HOOK(0x469C46, BulletClass_Logics_DamageAnimSelected, 0x8) { enum { SkipGameCode = 0x469C98 }; @@ -280,7 +282,7 @@ DEFINE_HOOK(0x469C46, BulletClass_Logics_DamageAnimSelected, 0x8) int* remainingInterval = &pWHExt->RemainingAnimCreationInterval; const int scatterMin = splashed ? pWHExt->SplashList_ScatterMin.Get() : pWHExt->AnimList_ScatterMin.Get(); const int scatterMax = splashed ? pWHExt->SplashList_ScatterMax.Get() : pWHExt->AnimList_ScatterMax.Get(); - const bool allowScatter = scatterMax != 0 || scatterMin != 0; + const bool allowScatter = scatterMax >= 0 || scatterMin >= 0 || pThis->Type->Inviso; if (creationInterval > 0 && pOwner) remainingInterval = &TechnoExt::ExtMap.Find(pOwner)->WHAnimRemainingCreationInterval; @@ -329,7 +331,11 @@ DEFINE_HOOK(0x469C46, BulletClass_Logics_DamageAnimSelected, 0x8) if (allowScatter) { - const int distance = random.RandomRanged(scatterMin, scatterMax); + int distance = 32; + + if (scatterMax >= 0 || scatterMin >= 0) + distance = random(scatterMin, scatterMax); + animCoords = MapClass::GetRandomCoordsNear(animCoords, distance, false); } diff --git a/src/Ext/WarheadType/Body.h b/src/Ext/WarheadType/Body.h index 1a08e540fc..22715ea821 100644 --- a/src/Ext/WarheadType/Body.h +++ b/src/Ext/WarheadType/Body.h @@ -275,13 +275,13 @@ class WarheadTypeExt , SplashList_PickRandom { false } , SplashList_CreateAll { false } , SplashList_CreationInterval { 0 } - , SplashList_ScatterMin { Leptons(0) } - , SplashList_ScatterMax { Leptons(0) } + , SplashList_ScatterMin { Leptons(-1) } + , SplashList_ScatterMax { Leptons(-1) } , AnimList_PickRandom { false } , AnimList_CreateAll { false } , AnimList_CreationInterval { 0 } - , AnimList_ScatterMin { Leptons(0) } - , AnimList_ScatterMax { Leptons(0) } + , AnimList_ScatterMin { Leptons(-1) } + , AnimList_ScatterMax { Leptons(-1) } , CreateAnimsOnZeroDamage { false } , Conventional_IgnoreUnits { false } , RemoveDisguise { false }