diff --git a/docs/Fixed-or-Improved-Logics.md b/docs/Fixed-or-Improved-Logics.md index d39932ba2b..1706d9687e 100644 --- a/docs/Fixed-or-Improved-Logics.md +++ b/docs/Fixed-or-Improved-Logics.md @@ -127,7 +127,7 @@ This page describes all ingame logics that are fixed or improved in Phobos witho - Fixed `DeployToFire` not recalculating firer's position on land if it cannot currently deploy. - `Arcing=true` projectile elevation inaccuracy can now be fixed by setting `Arcing.AllowElevationInaccuracy=false`. - Wall overlays are now drawn with the custom palette defined in `Palette` in `artmd.ini` if possible. -- `Secondary` will now be used against walls if `Primary` weapon Warhead has `Wall=false`, `Secondary` has `Wall=true` and the firer does not have `NoSecondaryWeaponFallback` set to true. +- If `[CombatDamage]`->`AllowWeaponSelectAgainstWalls` is set to true, `Secondary` will now be used against walls if `Primary` weapon Warhead has `Wall=false`, `Secondary` has `Wall=true` and the firer does not have `NoSecondaryWeaponFallback` set to true. - Setting `ReloadInTransport` to true on units with `Ammo` will allow the ammo to be reloaded according to `Reload` or `EmptyReload` timers even while the unit is inside a transport. - It is now possible to enable `Verses` and `PercentAtMax` to be applied on negative damage by setting `ApplyModifiersOnNegativeDamage` to true on the Warhead. - Attached animations on flying units now have their layer updated immediately after the parent unit, if on same layer they always draw above the parent. diff --git a/docs/Whats-New.md b/docs/Whats-New.md index e3190ef291..7209db1065 100644 --- a/docs/Whats-New.md +++ b/docs/Whats-New.md @@ -21,6 +21,7 @@ You can use the migration utility (can be found on [Phobos supplementaries repo] #### From post-0.3 devbuilds +- Selecting weapons other than primary against walls based on `Wall=true` on Warhead etc. now requires `[CombatDamage]`->`AllowWeaponSelectAgainstWalls` to be set to true first. - Lunar theater tileset parsing unhardcoding is now only applied if `lunarmd.ini` has `[General]` -> `ApplyLunarFixes` set to true. - `Units.DisableRepairCost` was changed to `Units.UseRepairCost` (note inverted expected value) as it no longer has discrete default value and affects `Hospital=true` buildings, infantry do not have repair cost by default. - Critical hit animations created by `Crit.AnimOnAffectedTargets=true` Warheads no longer default to `AnimList.PickRandom` if `Crit.AnimList.PickRandom` is not set. diff --git a/src/Ext/Rules/Body.cpp b/src/Ext/Rules/Body.cpp index 3e8a538406..fccb225b16 100644 --- a/src/Ext/Rules/Body.cpp +++ b/src/Ext/Rules/Body.cpp @@ -156,6 +156,7 @@ void RulesExt::ExtData::LoadBeforeTypeData(RulesClass* pThis, CCINIClass* pINI) this->ForceShield_KeptOnDeploy.Read(exINI, GameStrings::CombatDamage, "ForceShield.KeptOnDeploy"); this->ForceShield_EffectOnOrganics.Read(exINI, GameStrings::CombatDamage, "ForceShield.EffectOnOrganics"); this->ForceShield_KillOrganicsWarhead.Read(exINI, GameStrings::CombatDamage, "ForceShield.KillOrganicsWarhead"); + this->AllowWeaponSelectAgainstWalls.Read(exINI, GameStrings::CombatDamage, "AllowWeaponSelectAgainstWalls"); this->IronCurtain_ExtraTintIntensity.Read(exINI, GameStrings::AudioVisual, "IronCurtain.ExtraTintIntensity"); this->ForceShield_ExtraTintIntensity.Read(exINI, GameStrings::AudioVisual, "ForceShield.ExtraTintIntensity"); @@ -351,6 +352,7 @@ void RulesExt::ExtData::Serialize(T& Stm) .Process(this->ForceShield_KillOrganicsWarhead) .Process(this->IronCurtain_ExtraTintIntensity) .Process(this->ForceShield_ExtraTintIntensity) + .Process(this->AllowWeaponSelectAgainstWalls) .Process(this->ColorAddUse8BitRGB) .Process(this->ROF_RandomDelay) .Process(this->ToolTip_Background_Color) diff --git a/src/Ext/Rules/Body.h b/src/Ext/Rules/Body.h index 54eb558bbb..a84fdd31a0 100644 --- a/src/Ext/Rules/Body.h +++ b/src/Ext/Rules/Body.h @@ -117,6 +117,8 @@ class RulesExt Valueable ForceShield_EffectOnOrganics; Nullable ForceShield_KillOrganicsWarhead; + Valueable AllowWeaponSelectAgainstWalls; + Valueable IronCurtain_ExtraTintIntensity; Valueable ForceShield_ExtraTintIntensity; Valueable ColorAddUse8BitRGB; @@ -248,6 +250,7 @@ class RulesExt , ForceShield_KillOrganicsWarhead { } , IronCurtain_ExtraTintIntensity { 0.0 } , ForceShield_ExtraTintIntensity { 0.0 } + , AllowWeaponSelectAgainstWalls { false } , ColorAddUse8BitRGB { false } , ROF_RandomDelay { { 0 ,2 } } , ToolTip_Background_Color { { 0, 0, 0 } } diff --git a/src/Ext/Techno/Hooks.Firing.cpp b/src/Ext/Techno/Hooks.Firing.cpp index b8db5f36cd..1bc6f719a5 100644 --- a/src/Ext/Techno/Hooks.Firing.cpp +++ b/src/Ext/Techno/Hooks.Firing.cpp @@ -60,12 +60,8 @@ DEFINE_HOOK(0x6F33CD, TechnoClass_WhatWeaponShouldIUse_ForceFire, 0x6) if (pOverlayType->Wall && pCell->OverlayData >> 4 != pOverlayType->DamageLevels) { - const auto pTypeExt = TechnoTypeExt::ExtMap.Find(pThis->GetTechnoType()); - if (!pTypeExt->NoSecondaryWeaponFallback) - { - R->EAX(TechnoExt::GetWeaponIndexAgainstWall(pThis, pOverlayType)); - return ReturnWeaponIndex; - } + R->EAX(TechnoExt::GetWeaponIndexAgainstWall(pThis, pOverlayType)); + return ReturnWeaponIndex; } } } diff --git a/src/Ext/Techno/WeaponHelpers.cpp b/src/Ext/Techno/WeaponHelpers.cpp index 5310fdf18c..9c02e9b9a9 100644 --- a/src/Ext/Techno/WeaponHelpers.cpp +++ b/src/Ext/Techno/WeaponHelpers.cpp @@ -172,7 +172,7 @@ int TechnoExt::GetWeaponIndexAgainstWall(TechnoClass* pThis, OverlayTypeClass* p int weaponIndex = -1; auto pWeapon = TechnoExt::GetCurrentWeapon(pThis, weaponIndex); - if ((pTechnoType->TurretCount > 0 && !pTechnoType->IsGattling) || !pWallOverlayType || !pWallOverlayType->Wall) + if ((pTechnoType->TurretCount > 0 && !pTechnoType->IsGattling) || !pWallOverlayType || !pWallOverlayType->Wall || !RulesExt::Global()->AllowWeaponSelectAgainstWalls) return weaponIndex; else if (weaponIndex == -1) return 0; @@ -187,8 +187,8 @@ int TechnoExt::GetWeaponIndexAgainstWall(TechnoClass* pThis, OverlayTypeClass* p pWeaponExt = WeaponTypeExt::ExtMap.Find(pWeapon); bool aeForbidsSecondary = pWeaponExt && pWeaponExt->AttachEffect_CheckOnFirer && !pWeaponExt->HasRequiredAttachedEffects(pThis, pThis); - if (pWeapon && (pWeapon->Warhead->Wall || (pWeapon->Warhead->Wood && pWallOverlayType->Armor == Armor::Wood) - && (!TechnoTypeExt::ExtMap.Find(pTechnoType)->NoSecondaryWeaponFallback || aeForbidsPrimary)) && !aeForbidsSecondary) + if (pWeapon && (pWeapon->Warhead->Wall || (pWeapon->Warhead->Wood && pWallOverlayType->Armor == Armor::Wood)) + && (!TechnoTypeExt::ExtMap.Find(pTechnoType)->NoSecondaryWeaponFallback || aeForbidsPrimary) && !aeForbidsSecondary) { return weaponIndexSec; }