diff --git a/docs/Fixed-or-Improved-Logics.md b/docs/Fixed-or-Improved-Logics.md index ef18b5e8ad..101e349c78 100644 --- a/docs/Fixed-or-Improved-Logics.md +++ b/docs/Fixed-or-Improved-Logics.md @@ -117,9 +117,9 @@ This page describes all ingame logics that are fixed or improved in Phobos witho - They can also have map lighting apply on them if `AltPalette.ApplyLighting` is set to true. - Fixed `DeployToFire` not considering building placement rules for `DeploysInto` buildings and as a result not working properly with `WaterBound` buildings. - 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`. +- `Arcing=true` projectile elevation inaccuracy can now be fixed by setting `Arcing.AllowElevationInaccuracy=false`, default to `[CombatDamage] -> Arcing.AllowElevationInaccuracy`. - Wall overlays are now drawn with the custom palette defined in `Palette` in `artmd.ini` if possible. -- 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. +- 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. Can also be defined at `[General] -> ReloadInTransport` for a global default value. - 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. - Fixed an issue where the powered anims of `Powered` / `PoweredSpecial` buildings cease to update when being captured by enemies. @@ -759,8 +759,11 @@ CurleyShuffle= ; boolean, default to [General] -> CurleyShuffle In `rulesmd.ini`: ```ini -[SOMEAIRCRAFT] ; AircraftType -FiringForceScatter=true ; boolean +[General] +AircraftFiringForceScatter=true ; boolean + +[SOMEAIRCRAFT] ; AircraftType +FiringForceScatter= ; boolean, default to [General] -> AircraftFiringForceScatter ``` ### Extended Aircraft Missions @@ -1382,13 +1385,16 @@ BallisticScatter.Max= ; floating point value, distance in cells In `rulesmd.ini`: ```ini [CombatDamage] -Shrapnel.IgnoreHitBuildings=false ; boolean - -[SOMEPROJECTILE] ; Projectile Shrapnel.AffectsGround=false ; boolean Shrapnel.AffectsBuildings=false ; boolean Shrapnel.UseWeaponTargeting=false ; boolean -Shrapnel.IgnoreHitBuildings= ; boolean +Shrapnel.IgnoreHitBuildings=false ; boolean + +[SOMEPROJECTILE] ; Projectile +Shrapnel.AffectsGround= ; boolean, default to [CombatDamage] -> Shrapnel.AffectsGround +Shrapnel.AffectsBuildings= ; boolean, default to [CombatDamage] -> Shrapnel.AffectsBuildings +Shrapnel.UseWeaponTargeting= ; boolean, default to [CombatDamage] -> Shrapnel.UseWeaponTargeting +Shrapnel.IgnoreHitBuildings= ; boolean, default to [CombatDamage] -> Shrapnel.IgnoreHitBuildings ``` ## Technos @@ -1760,11 +1766,15 @@ DropPod.Weapon.HitLandOnly= ; boolean, default to no In `rulesmd.ini`: ```ini -[SOMETECHNO] ; TechnoType +[General] Explodes.KillPassengers=true ; boolean +Explodes.DuringBuildup=true ; boolean + +[SOMETECHNO] ; TechnoType +Explodes.KillPassengers= ; boolean, default to [General] -> Explodes.KillPassengers [SOMEBUILDING] ; BuildingType -Explodes.DuringBuildup=true ; boolean +Explodes.DuringBuildup= ; boolean, default to [General] -> Explodes.DuringBuildup ``` ### Forbid parallel AI queues @@ -2101,9 +2111,13 @@ MinimapColor= ; integer - Red,Green,Blue In `rulesmd.ini`: ```ini -[SOMETERRAINTYPE] ; TerrainType -IsPassable=false ; boolean -CanBeBuiltOn=false ; boolean +[General] +Terrain.IsPassable=false ; boolean +Terrain.CanBeBuiltOn=false ; boolean + +[SOMETERRAINTYPE] ; TerrainType +IsPassable= ; boolean, default to [General] -> Terrain.IsPassable +CanBeBuiltOn= ; boolean, default to [General] -> Terrain.CanBeBuiltOn ``` ## Tiberiums (ores) @@ -2359,10 +2373,15 @@ KeepTargetOnMove.ExtraDistance=0 ; floating point value, distance in cells In `rulesmd.ini`: ```ini -[SOMEVEHICLE] ; VehicleType +[General] Sinkable= ; boolean SinkSpeed=5 ; integer, leptons per frame Sinkable.SquidGrab=true ; boolean + +[SOMEVEHICLE] ; VehicleType +Sinkable= ; boolean, default to [General] -> Sinkable +SinkSpeed=5 ; integer, leptons per frame, default to [General] -> SinkSpeed +Sinkable.SquidGrab=true ; boolean, default to [General] -> Sinkable.SquidGrab ``` ### Stationary vehicles @@ -2542,6 +2561,10 @@ Rocker.AmplitudeOverride= ; integer In `rulesmd.ini`: ```ini +[General] +CreateAnimsOnZeroDamage=false ; boolean +Conventional.IgnoreUnits=false ; boolean + [SOMEWARHEAD] ; WarheadType AnimList.PickRandom=false ; boolean AnimList.CreateAll=false ; boolean @@ -2554,8 +2577,8 @@ SplashList.CreateAll=false ; boolean SplashList.CreationInterval=0 ; integer SplashList.ScatterMin=0.0 ; floating point value, distance in cells SplashList.ScatterMax=0.0 ; floating point value, distance in cells -CreateAnimsOnZeroDamage=false ; boolean -Conventional.IgnoreUnits=false ; boolean +CreateAnimsOnZeroDamage= ; boolean, default to [General] -> CreateAnimsOnZeroDamage +Conventional.IgnoreUnits=false ; boolean, default to [General] -> Conventional.IgnoreUnits ``` ### Customizable Warhead trigger conditions @@ -2581,8 +2604,11 @@ EffectsRequireVerses=false ; boolean In `rulesmd.ini`: ```ini -[SOMEWARHEAD] ; WarheadType +[General] DecloakDamagedTargets=true ; boolean + +[SOMEWARHEAD] ; WarheadType +DecloakDamagedTargets= ; boolean, default to [General] -> DecloakDamagedTargets ``` ### Customizing locomotor warhead diff --git a/docs/New-or-Enhanced-Logics.md b/docs/New-or-Enhanced-Logics.md index 9487274334..fdd04dca65 100644 --- a/docs/New-or-Enhanced-Logics.md +++ b/docs/New-or-Enhanced-Logics.md @@ -46,7 +46,7 @@ This page describes all the engine features that are either new and introduced b - `ForceDecloak`, if set to true, will uncloak and make the object the effect is attached to unable to cloak itself for duration of the effect. - `WeaponRange.Multiplier` and `WeaponRange.ExtraRange` can be used to multiply the weapon firing range of the object the effect is attached to, or give it an increase / decrease (measured in cells), respectively. `ExtraRange` is cumulatively applied from all attached effects after all `Multiplier` values have been applied. - `WeaponRange.AllowWeapons` can be used to list only weapons that can benefit from this range bonus and `WeaponRange.DisallowWeapons` weapons that are not allowed to, respectively. - - On TechnoTypes with `OpenTopped=true`, `OpenTopped.UseTransportRangeModifiers` can be set to true to make passengers firing out use the transport's active range bonuses instead. + - On TechnoTypes with `OpenTopped=true`, `OpenTopped.UseTransportRangeModifiers` can be set to true to make passengers firing out use the transport's active range bonuses instead. `[General] -> OpenTopped.UseTransportRangeModifiers` defines its global default value. - `Crit.Multiplier` and `Crit.ExtraChance` can be used to multiply the [critical hit](#chance-based-extra-damage-or-warhead-detonation--critical-hits) chance or grant a fixed bonus to it for the object the effect is attached to, respectively. - `Crit.AllowWarheads` can be used to list only Warheads that can benefit from this critical hit chance multiplier and `Crit.DisallowWarheads` weapons that are not allowed to, respectively. - `RevengeWeapon` can be used to temporarily grant the specified weapon as a [revenge weapon](#revenge-weapon) for the attached object. @@ -56,7 +56,7 @@ This page describes all the engine features that are either new and introduced b - Warheads can prevent reflect damage from occuring by setting `SuppressReflectDamage` to true. `SuppressReflectDamage.Types` can control which AttachEffectTypes' reflect damage is suppressed, if none are listed then all of them are suppressed. `SuppressReflectDamage.Groups` does the same thing but for all AttachEffectTypes in the listed groups. - `ReflectDamage.UseInvokerAsOwner` can be used to set the house and TechnoType that created the effect (e.g firer of the weapon that applied it) as the reflected damage's owner & invoker instead of the object the effect is attached to. - `DisableWeapons` can be used to disable ability to fire any and all weapons. - - On TechnoTypes with `OpenTopped=true`, `OpenTopped.CheckTransportDisableWeapons` can be set to true to make passengers not be able to fire out if transport's weapons are disabled by `DisableWeapons`. + - On TechnoTypes with `OpenTopped=true`, `OpenTopped.CheckTransportDisableWeapons` can be set to true to make passengers not be able to fire out if transport's weapons are disabled by `DisableWeapons`. `[General] -> OpenTopped.CheckTransportDisableWeapons` defines its global default value. - `Unkillable` can be used to prevent the techno from being killed by taken damage (minimum health will be 1). - It is possible to set groups for attach effect types by defining strings in `Groups`. - Groups can be used instead of types for removing effects and weapon filters. @@ -152,14 +152,18 @@ Unkillable=false ; boolean LaserTrail.Type= ; LaserTrailType Groups= ; comma-separated list of strings (group IDs) +[General] +OpenTopped.UseTransportRangeModifiers=false ; boolean +OpenTopped.CheckTransportDisableWeapons=false ; boolean + [SOMETECHNO] ; TechnoType AttachEffect.AttachTypes= ; List of AttachEffectTypes AttachEffect.DurationOverrides= ; integer - duration overrides (comma-separated) for AttachTypes in order from first to last. AttachEffect.Delays= ; integer - delays (comma-separated) for AttachTypes in order from first to last. AttachEffect.InitialDelays= ; integer - initial delays (comma-separated) for AttachTypes in order from first to last. AttachEffect.RecreationDelays= ; integer - recreation delays (comma-separated) for AttachTypes in order from first to last. -OpenTopped.UseTransportRangeModifiers=false ; boolean -OpenTopped.CheckTransportDisableWeapons=false ; boolean +OpenTopped.UseTransportRangeModifiers= ; boolean, default to [General] -> OpenTopped.UseTransportRangeModifiers +OpenTopped.CheckTransportDisableWeapons= ; boolean, default to [General] -> OpenTopped.CheckTransportDisableWeapons [SOMEWEAPON] ; WeaponType AttachEffect.RequiredTypes= ; List of AttachEffectTypes @@ -822,6 +826,9 @@ BombParachute= ; AnimationType, default to [General] -> BombParachute In `rulesmd.ini`: ```ini +[General] +Interceptable=false ; boolean + [SOMETECHNO] ; TechnoType Interceptor=false ; boolean Interceptor.Weapon=0 ; integer, weapon slot index (0 or 1) @@ -1474,9 +1481,13 @@ PassengerDeletion.UnderEMP=false ; boolean In `rulesmd.ini`: ```ini -[SOMETECHNO] ; TechnoType +[General] Passengers.SyncOwner=false ; boolean Passengers.SyncOwner.RevertOnExit=true ; boolean + +[SOMETECHNO] ; TechnoType +Passengers.SyncOwner= ; boolean, default to [General] -> Passengers.SyncOwner +Passengers.SyncOwner.RevertOnExit= ; boolean, default to [General] -> Passengers.SyncOwner.RevertOnExit ``` ### Automatically firing weapons @@ -1588,6 +1599,9 @@ DrainMoneyDisplay.OnTarget.UseDisplayIncome= ; boolean In `rulesmd.ini`: ```ini [General] +OpenTopped.IgnoreRangefinding=false ; boolean +OpenTopped.AllowFiringIfDeactivated=true ; boolean +OpenTopped.ShareTransportTarget=true ; boolean OpenTopped.AllowFiringIfAttackedByLocomotor=true ; boolean OpenTopped.DecloakToFire=true ; boolean @@ -1595,15 +1609,19 @@ OpenTopped.DecloakToFire=true ; boolean OpenTopped.RangeBonus= ; integer, default to [CombatDamage] -> OpenToppedRangeBonus OpenTopped.DamageMultiplier= ; floating point value, default to [CombatDamage] -> OpenToppedDamageMultiplier OpenTopped.WarpDistance= ; integer, default to [CombatDamage] -> OpenToppedWarpDistance -OpenTopped.IgnoreRangefinding=false ; boolean -OpenTopped.AllowFiringIfDeactivated=true ; boolean +OpenTopped.IgnoreRangefinding= ; boolean, defaults to [General] -> OpenTopped.IgnoreRangefinding +OpenTopped.AllowFiringIfDeactivated= ; boolean, defaults to [General] -> OpenTopped.AllowFiringIfDeactivated OpenTopped.AllowFiringIfAttackedByLocomotor= ; boolean, defaults to [General] -> OpenTopped.AllowFiringIfAttackedByLocomotor -OpenTopped.ShareTransportTarget=true ; boolean +OpenTopped.ShareTransportTarget= ; boolean, defaults to [General] -> OpenTopped.ShareTransportTarget OpenTopped.DecloakToFire= ; boolean, defaults to [General] -> OpenTopped.DecloakToFire -[SOMETECHNO] ; TechnoType, passenger +[CombatDamage] OpenTransport.RangeBonus=0 ; integer OpenTransport.DamageMultiplier=1.0 ; floating point value + +[SOMETECHNO] ; TechnoType, passenger +OpenTransport.RangeBonus= ; integer, defaults to [CombatDamage] -> OpenTransport.RangeBonus +OpenTransport.DamageMultiplier= ; floating point value, defaults to [CombatDamage] -> OpenTransport.DamageMultiplier ``` ```{note} @@ -2327,8 +2345,11 @@ Ammo.DeployUnlockMaximumAmount=-1 ; integer In `rulesmd.ini`: ```ini -[SOMEVEHICLE] ; VehicleType +[General] HoverDrownable=true ; boolean + +[SOMEVEHICLE] ; VehicleType +HoverDrownable= ; boolean, default to [General] -> HoverDrownable ``` ### Damaged unit image changes diff --git a/src/Ext/Aircraft/Hooks.cpp b/src/Ext/Aircraft/Hooks.cpp index 4c063db1c5..263702fcf2 100644 --- a/src/Ext/Aircraft/Hooks.cpp +++ b/src/Ext/Aircraft/Hooks.cpp @@ -320,7 +320,7 @@ DEFINE_HOOK(0x41879D, AircraftClass_Mission_Attack_StrafeCell, 0x6) AircraftExt::FireWeapon(pThis, pTargetCell); - if (pExt->TypeExtData->FiringForceScatter) + if (pExt->TypeExtData->FiringForceScatter.Get(RulesExt::Global()->AircraftFiringForceScatter)) pTargetCell->ScatterContent(pThis->Location, true, false, false); pThis->SetDestination(pTargetCell, true); @@ -344,13 +344,13 @@ DEFINE_HOOK_AGAIN(0x418B46, AircraftClass_MissionAttack_ScatterCell1, 0x6) DEFINE_HOOK(0x41847E, AircraftClass_MissionAttack_ScatterCell1, 0x6) { GET(AircraftClass*, pThis, ESI); - return TechnoTypeExt::ExtMap.Find(pThis->Type)->FiringForceScatter ? 0 : (R->Origin() + 0x44); + return TechnoTypeExt::ExtMap.Find(pThis->Type)->FiringForceScatter.Get(RulesExt::Global()->AircraftFiringForceScatter) ? 0 : (R->Origin() + 0x44); } DEFINE_HOOK(0x4186DD, AircraftClass_MissionAttack_ScatterCell2, 0x5) { GET(AircraftClass*, pThis, ESI); - return TechnoTypeExt::ExtMap.Find(pThis->Type)->FiringForceScatter ? 0 : (R->Origin() + 0x43); + return TechnoTypeExt::ExtMap.Find(pThis->Type)->FiringForceScatter.Get(RulesExt::Global()->AircraftFiringForceScatter) ? 0 : (R->Origin() + 0x43); } #pragma endregion diff --git a/src/Ext/Bullet/Body.cpp b/src/Ext/Bullet/Body.cpp index 73aa3a2077..37c6a41a8a 100644 --- a/src/Ext/Bullet/Body.cpp +++ b/src/Ext/Bullet/Body.cpp @@ -67,7 +67,7 @@ void BulletExt::ExtData::InterceptBullet(TechnoClass* pSource, BulletClass* pInt this->InitializeLaserTrails(); // Lose target if the current bullet is no longer interceptable. - if (pSource && (!pTypeExt->Interceptable || (pTypeExt->Armor.isset() && GeneralUtils::GetWarheadVersusArmor(pInterceptor->WH, pTypeExt->Armor.Get()) == 0.0))) + if (pSource && (!pTypeExt->Interceptable.Get(RulesExt::Global()->Interceptable) || (pTypeExt->Armor.isset() && GeneralUtils::GetWarheadVersusArmor(pInterceptor->WH, pTypeExt->Armor.Get()) == 0.0))) pSource->SetTarget(nullptr); } } diff --git a/src/Ext/Bullet/Hooks.DetonateLogics.cpp b/src/Ext/Bullet/Hooks.DetonateLogics.cpp index 6e4d6b5c6a..bccf7a50cf 100644 --- a/src/Ext/Bullet/Hooks.DetonateLogics.cpp +++ b/src/Ext/Bullet/Hooks.DetonateLogics.cpp @@ -246,7 +246,7 @@ DEFINE_HOOK(0x469B44, BulletClass_Logics_LandTypeCheck, 0x6) auto const pWHExt = WarheadTypeExt::ExtMap.Find(pThis->WH); - if (pWHExt->Conventional_IgnoreUnits) + if (pWHExt->Conventional_IgnoreUnits.Get(RulesExt::Global()->Conventional_IgnoreUnits)) return SkipChecks; return 0; diff --git a/src/Ext/Bullet/Hooks.cpp b/src/Ext/Bullet/Hooks.cpp index 340f3e2fb7..170ca0c399 100644 --- a/src/Ext/Bullet/Hooks.cpp +++ b/src/Ext/Bullet/Hooks.cpp @@ -247,16 +247,12 @@ DEFINE_HOOK(0x46A3D6, BulletClass_Shrapnel_Forced, 0xA) { return Shrapnel; } - else if (pTypeExt->Shrapnel_AffectsBuildings) + else if (pTypeExt->Shrapnel_AffectsBuildings.Get(RulesExt::Global()->Shrapnel_AffectsBuildings)) { ShrapnelTemp::InitialTargetBuilding = static_cast(pObject); return Shrapnel; } } - else if (pTypeExt->Shrapnel_AffectsGround) - { - return Shrapnel; - } return Skip; } @@ -286,7 +282,7 @@ DEFINE_HOOK(0x46A4FB, BulletClass_Shrapnel_Targeting, 0x6) auto const pOwner = pSource->Owner; - if (pTypeExt->Shrapnel_UseWeaponTargeting) + if (pTypeExt->Shrapnel_UseWeaponTargeting.Get(RulesExt::Global()->Shrapnel_UseWeaponTargeting)) { auto const pWeaponExt = WeaponTypeExt::ExtMap.Find(pShrapnelWeapon); auto const pType = pObject->GetType(); @@ -499,7 +495,7 @@ DEFINE_HOOK(0x6FF008, TechnoClass_Fire_BeforeMoveTo, 0x8) const auto pBulletType = pBullet->Type; - if (pBulletType->Arcing && !BulletTypeExt::ExtMap.Find(pBulletType)->Arcing_AllowElevationInaccuracy) + if (pBulletType->Arcing && !BulletTypeExt::ExtMap.Find(pBulletType)->Arcing_AllowElevationInaccuracy.Get(RulesExt::Global()->Arcing_AllowElevationInaccuracy)) { REF_STACK(BulletVelocity, velocity, STACK_OFFSET(0xB0, -0x60)); REF_STACK(const CoordStruct, crdSrc, STACK_OFFSET(0xB0, -0x6C)); @@ -519,7 +515,7 @@ DEFINE_HOOK(0x44D46E, BuildingClass_Mission_Missile_BeforeMoveTo, 0x8) const auto pBulletType = pBullet->Type; - if (pBulletType->Arcing && !BulletTypeExt::ExtMap.Find(pBulletType)->Arcing_AllowElevationInaccuracy) + if (pBulletType->Arcing && !BulletTypeExt::ExtMap.Find(pBulletType)->Arcing_AllowElevationInaccuracy.Get(RulesExt::Global()->Arcing_AllowElevationInaccuracy)) { REF_STACK(BulletVelocity, velocity, STACK_OFFSET(0xE8, -0xD0)); REF_STACK(const CoordStruct, crdSrc, STACK_OFFSET(0xE8, -0x8C)); diff --git a/src/Ext/BulletType/Body.h b/src/Ext/BulletType/Body.h index 49aaf0def2..913660bb11 100644 --- a/src/Ext/BulletType/Body.h +++ b/src/Ext/BulletType/Body.h @@ -21,7 +21,7 @@ class BulletTypeExt public: // Valueable Strength; //Use OwnerObject()->ObjectTypeClass::Strength Nullable Armor; - Valueable Interceptable; + Nullable Interceptable; Valueable Interceptable_DeleteOnIntercept; Valueable Interceptable_WeaponOverride; ValueableIdxVector LaserTrail_Types; @@ -31,9 +31,9 @@ class BulletTypeExt TrajectoryTypePointer TrajectoryType; - Valueable Shrapnel_AffectsGround; - Valueable Shrapnel_AffectsBuildings; - Valueable Shrapnel_UseWeaponTargeting; + Nullable Shrapnel_AffectsGround; + Nullable Shrapnel_AffectsBuildings; + Nullable Shrapnel_UseWeaponTargeting; Nullable Shrapnel_IgnoreHitBuildings; Nullable SubjectToLand; Valueable SubjectToLand_Detonate; @@ -44,7 +44,7 @@ class BulletTypeExt Valueable ClusterScatter_Max; Valueable AAOnly; - Valueable Arcing_AllowElevationInaccuracy; + Nullable Arcing_AllowElevationInaccuracy; Valueable ReturnWeapon; Valueable ReturnWeapon_ApplyFirepowerMult; @@ -83,7 +83,7 @@ class BulletTypeExt ExtData(BulletTypeClass* OwnerObject) : Extension(OwnerObject) , Armor {} - , Interceptable { false } + , Interceptable {} , Interceptable_DeleteOnIntercept { false } , Interceptable_WeaponOverride {} , LaserTrail_Types {} @@ -91,9 +91,9 @@ class BulletTypeExt , Vertical_AircraftFix { true } , VerticalInitialFacing {} , TrajectoryType { } - , Shrapnel_AffectsGround { false } - , Shrapnel_AffectsBuildings { false } - , Shrapnel_UseWeaponTargeting { false } + , Shrapnel_AffectsGround {} + , Shrapnel_AffectsBuildings {} + , Shrapnel_UseWeaponTargeting {} , Shrapnel_IgnoreHitBuildings {} , ClusterScatter_Min { Leptons(256) } , ClusterScatter_Max { Leptons(512) } @@ -104,7 +104,7 @@ class BulletTypeExt , SubjectToWater {} , SubjectToWater_Detonate { true } , AAOnly { false } - , Arcing_AllowElevationInaccuracy { true } + , Arcing_AllowElevationInaccuracy {} , ReturnWeapon {} , ReturnWeapon_ApplyFirepowerMult { false } , SubjectToGround { false } diff --git a/src/Ext/Rules/Body.cpp b/src/Ext/Rules/Body.cpp index 0fdda59211..84417bde68 100644 --- a/src/Ext/Rules/Body.cpp +++ b/src/Ext/Rules/Body.cpp @@ -359,8 +359,42 @@ void RulesExt::ExtData::LoadBeforeTypeData(RulesClass* pThis, CCINIClass* pINI) this->FallingDownTargetingFix.Read(exINI, GameStrings::General, "FallingDownTargetingFix"); this->AIAirTargetingFix.Read(exINI, GameStrings::General, "AIAirTargetingFix"); - this->OpenTopped_DecloakToFire.Read(exINI, GameStrings::General, "OpenTopped.DecloakToFire"); + + this->ReloadInTransport.Read(exINI, GameStrings::General, "ReloadInTransport"); + this->OpenTopped_IgnoreRangefinding.Read(exINI, GameStrings::General, "OpenTopped.IgnoreRangefinding"); + this->OpenTopped_AllowFiringIfDeactivated.Read(exINI, GameStrings::General, "OpenTopped.AllowFiringIfDeactivated"); this->OpenTopped_AllowFiringIfAttackedByLocomotor.Read(exINI, GameStrings::General, "OpenTopped.AllowFiringIfAttackedByLocomotor"); + this->OpenTopped_ShareTransportTarget.Read(exINI, GameStrings::General, "OpenTopped.ShareTransportTarget"); + this->OpenTopped_UseTransportRangeModifiers.Read(exINI, GameStrings::General, "OpenTopped.UseTransportRangeModifiers"); + this->OpenTopped_CheckTransportDisableWeapons.Read(exINI, GameStrings::General, "OpenTopped.CheckTransportDisableWeapons"); + this->OpenTopped_DecloakToFire.Read(exINI, GameStrings::General, "OpenTopped.DecloakToFire"); + this->OpenTransport_RangeBonus.Read(exINI, GameStrings::CombatDamage, "OpenTransport.RangeBonus"); + this->OpenTransport_DamageMultiplier.Read(exINI, GameStrings::CombatDamage, "OpenTransport.DamageMultiplier"); + + this->Passengers_SyncOwner.Read(exINI, GameStrings::General, "Passengers.SyncOwner"); + this->Passengers_SyncOwner_RevertOnExit.Read(exINI, GameStrings::General, "Passengers.SyncOwner.RevertOnExit"); + + this->Explodes_KillPassengers.Read(exINI, GameStrings::General, "Explodes.KillPassengers"); + this->Explodes_DuringBuildup.Read(exINI, GameStrings::General, "Explodes.DuringBuildup"); + + this->AircraftFiringForceScatter.Read(exINI, GameStrings::General, "AircraftFiringForceScatter"); + + this->HoverDrownable.Read(exINI, GameStrings::General, "HoverDrownable"); + + this->Arcing_AllowElevationInaccuracy.Read(exINI, GameStrings::CombatDamage, "Arcing.AllowElevationInaccuracy"); + + this->Terrain_IsPassable.Read(exINI, GameStrings::General, "Terrain.IsPassable"); + this->Terrain_CanBeBuiltOn.Read(exINI, GameStrings::General, "Terrain.CanBeBuiltOn"); + + this->Sinkable.Read(exINI, GameStrings::General, "Sinkable"); + this->Sinkable_SquidGrab.Read(exINI, GameStrings::General, "Sinkable.SquidGrab"); + this->SinkSpeed.Read(exINI, GameStrings::General, "SinkSpeed"); + + this->CreateAnimsOnZeroDamage.Read(exINI, GameStrings::General, "CreateAnimsOnZeroDamage"); + this->Conventional_IgnoreUnits.Read(exINI, GameStrings::General, "Conventional.IgnoreUnits"); + this->DecloakDamagedTargets.Read(exINI, GameStrings::General, "DecloakDamagedTargets"); + + this->Interceptable.Read(exINI, GameStrings::General, "Interceptable"); this->SortCameoByName.Read(exINI, GameStrings::General, "SortCameoByName"); @@ -407,7 +441,11 @@ void RulesExt::ExtData::LoadBeforeTypeData(RulesClass* pThis, CCINIClass* pINI) this->FiringAnim_Update.Read(exINI, GameStrings::AudioVisual, "FiringAnim.Update"); this->ExtendedPlayerRepair.Read(exINI, GameStrings::General, "ExtendedPlayerRepair"); + this->Shrapnel_AffectsGround.Read(exINI, GameStrings::CombatDamage, "Shrapnel.AffectsGround"); + this->Shrapnel_AffectsBuildings.Read(exINI, GameStrings::CombatDamage, "Shrapnel.AffectsBuildings"); + this->Shrapnel_UseWeaponTargeting.Read(exINI, GameStrings::CombatDamage, "Shrapnel.UseWeaponTargeting"); this->Shrapnel_IgnoreHitBuildings.Read(exINI, GameStrings::CombatDamage, "Shrapnel.IgnoreHitBuildings"); + this->BuildingGuardRetryDelay.Read(exINI, GameStrings::General, "BuildingGuardRetryDelay"); // Section AITargetTypes @@ -704,8 +742,32 @@ void RulesExt::ExtData::Serialize(T& Stm) .Process(this->IvanBombAttachToCenter) .Process(this->FallingDownTargetingFix) .Process(this->AIAirTargetingFix) - .Process(this->OpenTopped_DecloakToFire) + .Process(this->ReloadInTransport) + .Process(this->OpenTopped_IgnoreRangefinding) + .Process(this->OpenTopped_AllowFiringIfDeactivated) .Process(this->OpenTopped_AllowFiringIfAttackedByLocomotor) + .Process(this->OpenTopped_ShareTransportTarget) + .Process(this->OpenTopped_UseTransportRangeModifiers) + .Process(this->OpenTopped_CheckTransportDisableWeapons) + .Process(this->OpenTopped_DecloakToFire) + .Process(this->OpenTransport_RangeBonus) + .Process(this->OpenTransport_DamageMultiplier) + .Process(this->Passengers_SyncOwner) + .Process(this->Passengers_SyncOwner_RevertOnExit) + .Process(this->Explodes_KillPassengers) + .Process(this->Explodes_DuringBuildup) + .Process(this->AircraftFiringForceScatter) + .Process(this->HoverDrownable) + .Process(this->Arcing_AllowElevationInaccuracy) + .Process(this->Terrain_IsPassable) + .Process(this->Terrain_CanBeBuiltOn) + .Process(this->Sinkable) + .Process(this->Sinkable_SquidGrab) + .Process(this->SinkSpeed) + .Process(this->CreateAnimsOnZeroDamage) + .Process(this->Conventional_IgnoreUnits) + .Process(this->DecloakDamagedTargets) + .Process(this->Interceptable) .Process(this->SortCameoByName) .Process(this->MergeBuildingDamage) .Process(this->BuildingRadioLink_SyncOwner) @@ -737,6 +799,9 @@ void RulesExt::ExtData::Serialize(T& Stm) .Process(this->ShipLocomotorMakesWake) .Process(this->FiringAnim_Update) .Process(this->ExtendedPlayerRepair) + .Process(this->Shrapnel_AffectsGround) + .Process(this->Shrapnel_AffectsBuildings) + .Process(this->Shrapnel_UseWeaponTargeting) .Process(this->Shrapnel_IgnoreHitBuildings) .Process(this->BuildingGuardRetryDelay) ; diff --git a/src/Ext/Rules/Body.h b/src/Ext/Rules/Body.h index a5bac34b0b..1bf7a10e87 100644 --- a/src/Ext/Rules/Body.h +++ b/src/Ext/Rules/Body.h @@ -303,8 +303,42 @@ class RulesExt Valueable FallingDownTargetingFix; Valueable AIAirTargetingFix; - Valueable OpenTopped_DecloakToFire; + + Valueable ReloadInTransport; + Valueable OpenTopped_IgnoreRangefinding; + Valueable OpenTopped_AllowFiringIfDeactivated; Valueable OpenTopped_AllowFiringIfAttackedByLocomotor; + Valueable OpenTopped_ShareTransportTarget; + Valueable OpenTopped_UseTransportRangeModifiers; + Valueable OpenTopped_CheckTransportDisableWeapons; + Valueable OpenTopped_DecloakToFire; + Valueable OpenTransport_RangeBonus; + Valueable OpenTransport_DamageMultiplier; + + Valueable Passengers_SyncOwner; + Valueable Passengers_SyncOwner_RevertOnExit; + + Valueable Explodes_KillPassengers; + Valueable Explodes_DuringBuildup; + + Valueable AircraftFiringForceScatter; + + Valueable HoverDrownable; + + Valueable Arcing_AllowElevationInaccuracy; + + Valueable Terrain_IsPassable; + Valueable Terrain_CanBeBuiltOn; + + Nullable Sinkable; + Valueable Sinkable_SquidGrab; + Valueable SinkSpeed; + + Valueable CreateAnimsOnZeroDamage; + Valueable Conventional_IgnoreUnits; + Valueable DecloakDamagedTargets; + + Valueable Interceptable; Valueable SortCameoByName; @@ -350,6 +384,9 @@ class RulesExt Valueable HoverLocomotorMakesWake; Valueable ShipLocomotorMakesWake; + Valueable Shrapnel_AffectsGround; + Valueable Shrapnel_AffectsBuildings; + Valueable Shrapnel_UseWeaponTargeting; Valueable Shrapnel_IgnoreHitBuildings; Nullable> BuildingGuardRetryDelay; @@ -597,8 +634,42 @@ class RulesExt , FallingDownTargetingFix { false } , AIAirTargetingFix { false } - , OpenTopped_DecloakToFire { false } + + , ReloadInTransport { false } + , OpenTopped_IgnoreRangefinding { false } + , OpenTopped_AllowFiringIfDeactivated { true } , OpenTopped_AllowFiringIfAttackedByLocomotor { true } + , OpenTopped_ShareTransportTarget { true } + , OpenTopped_UseTransportRangeModifiers { false } + , OpenTopped_CheckTransportDisableWeapons { false } + , OpenTopped_DecloakToFire { false } + , OpenTransport_RangeBonus { 0 } + , OpenTransport_DamageMultiplier { 1.0f } + + , Passengers_SyncOwner { false } + , Passengers_SyncOwner_RevertOnExit { true } + + , Explodes_KillPassengers { true } + , Explodes_DuringBuildup { true } + + , AircraftFiringForceScatter { true } + + , HoverDrownable { true } + + , Arcing_AllowElevationInaccuracy {} + + , Terrain_IsPassable { false } + , Terrain_CanBeBuiltOn { false } + + , Sinkable {} + , Sinkable_SquidGrab { true } + , SinkSpeed { 5 } + + , CreateAnimsOnZeroDamage { false } + , Conventional_IgnoreUnits { false } + , DecloakDamagedTargets { true } + + , Interceptable { false } , SortCameoByName { false } @@ -644,6 +715,9 @@ class RulesExt , ShipLocomotorMakesWake { true } , FiringAnim_Update { false } , ExtendedPlayerRepair { false } + , Shrapnel_AffectsGround { false } + , Shrapnel_AffectsBuildings { false } + , Shrapnel_UseWeaponTargeting { false } , Shrapnel_IgnoreHitBuildings { false } , BuildingGuardRetryDelay {} { } diff --git a/src/Ext/Techno/Body.Update.cpp b/src/Ext/Techno/Body.Update.cpp index 185b608762..c8bce01bf0 100644 --- a/src/Ext/Techno/Body.Update.cpp +++ b/src/Ext/Techno/Body.Update.cpp @@ -90,7 +90,7 @@ void TechnoExt::ExtData::ApplyInterceptor() const auto pBulletExt = BulletExt::ExtMap.Find(pBullet); const auto pBulletTypeExt = pBulletExt->TypeExtData; - if (!pBulletTypeExt->Interceptable || pBullet->SpawnNextAnim) + if (!pBulletTypeExt->Interceptable.Get(RulesExt::Global()->Interceptable) || pBullet->SpawnNextAnim) continue; const bool isTargetedOrLocked = static_cast(pBulletExt->InterceptedStatus & (InterceptedStatus::Targeted | InterceptedStatus::Locked)); @@ -791,7 +791,8 @@ void TechnoExt::ExtData::UpdateTypeData(TechnoTypeClass* pCurrentType) } // Remove from limbo reloaders if no longer applicable - if (pOldType->Ammo > 0 && pOldTypeExt->ReloadInTransport && !pNewTypeExt->ReloadInTransport) + if (pOldType->Ammo > 0 && pOldTypeExt->ReloadInTransport.Get(RulesExt::Global()->ReloadInTransport) + && !pNewTypeExt->ReloadInTransport.Get(RulesExt::Global()->ReloadInTransport)) { auto& vec = ScenarioExt::Global()->TransportReloaders; vec.erase(std::remove(vec.begin(), vec.end(), this), vec.end()); diff --git a/src/Ext/Techno/Body.cpp b/src/Ext/Techno/Body.cpp index ca1016d5fc..4d6654f6e4 100644 --- a/src/Ext/Techno/Body.cpp +++ b/src/Ext/Techno/Body.cpp @@ -28,7 +28,7 @@ TechnoExt::ExtData::~ExtData() } if (whatAmI != AbstractType::AircraftType && whatAmI != AbstractType::BuildingType - && pType->Ammo > 0 && pTypeExt->ReloadInTransport) + && pType->Ammo > 0 && pTypeExt->ReloadInTransport.Get(RulesExt::Global()->ReloadInTransport)) { auto& vec = ScenarioExt::Global()->TransportReloaders; vec.erase(std::remove(vec.begin(), vec.end(), this), vec.end()); diff --git a/src/Ext/Techno/Hooks.Firing.cpp b/src/Ext/Techno/Hooks.Firing.cpp index 4c7f814564..8f9e7497ee 100644 --- a/src/Ext/Techno/Hooks.Firing.cpp +++ b/src/Ext/Techno/Hooks.Firing.cpp @@ -433,7 +433,7 @@ DEFINE_HOOK(0x6FC5C7, TechnoClass_CanFire_OpenTopped, 0x6) auto const pTypeExt = TechnoExt::ExtMap.Find(pTransport)->TypeExtData; - if (pTransport->Deactivated && !pTypeExt->OpenTopped_AllowFiringIfDeactivated) + if (pTransport->Deactivated && !pTypeExt->OpenTopped_AllowFiringIfDeactivated.Get(RulesExt::Global()->OpenTopped_AllowFiringIfDeactivated)) return Illegal; if (const auto pTransportFoot = abstract_cast(pTransport)) @@ -445,8 +445,11 @@ DEFINE_HOOK(0x6FC5C7, TechnoClass_CanFire_OpenTopped, 0x6) if (pTransport->Transporter) return Illegal; - if (pTypeExt->OpenTopped_CheckTransportDisableWeapons && TechnoExt::HasWeaponsDisabled(pTransport) && pThis->GetWeapon(weaponIndex)->WeaponType) + if (pTypeExt->OpenTopped_CheckTransportDisableWeapons.Get(RulesExt::Global()->OpenTopped_CheckTransportDisableWeapons + && TechnoExt::HasWeaponsDisabled(pTransport) && pThis->GetWeapon(weaponIndex)->WeaponType)) + { return OutOfRange; + } return Continue; } @@ -682,7 +685,7 @@ DEFINE_HOOK(0x6FE43B, TechnoClass_FireAt_OpenToppedDmgMult, 0x8) nDamageMult = pExt->OpenTopped_DamageMultiplier.Get(nDamageMult); } - nDamageMult *= TechnoExt::ExtMap.Find(pThis)->TypeExtData->OpenTransport_DamageMultiplier; + nDamageMult *= TechnoExt::ExtMap.Find(pThis)->TypeExtData->OpenTransport_DamageMultiplier.Get(RulesExt::Global()->OpenTransport_DamageMultiplier); R->EAX(static_cast(nDamage * nDamageMult)); return ApplyDamageMult; diff --git a/src/Ext/Techno/Hooks.ReceiveDamage.cpp b/src/Ext/Techno/Hooks.ReceiveDamage.cpp index 638c72a9a2..fc6c2c65eb 100644 --- a/src/Ext/Techno/Hooks.ReceiveDamage.cpp +++ b/src/Ext/Techno/Hooks.ReceiveDamage.cpp @@ -197,7 +197,7 @@ DEFINE_HOOK(0x702819, TechnoClass_ReceiveDamage_Decloak, 0xA) if (auto const pExt = WarheadTypeExt::ExtMap.TryFind(pWarhead)) { - if (pExt->DecloakDamagedTargets) + if (pExt->DecloakDamagedTargets.Get(RulesExt::Global()->DecloakDamagedTargets)) pThis->Uncloak(false); } @@ -228,11 +228,14 @@ DEFINE_HOOK(0x702603, TechnoClass_ReceiveDamage_Explodes, 0x6) if (pThis->WhatAmI() == AbstractType::Building) { - if (!pTypeExt->Explodes_DuringBuildup && (pThis->CurrentMission == Mission::Construction || pThis->CurrentMission == Mission::Selling)) + if (!pTypeExt->Explodes_DuringBuildup.Get(RulesExt::Global()->Explodes_DuringBuildup) + && (pThis->CurrentMission == Mission::Construction || pThis->CurrentMission == Mission::Selling)) + { return SkipExploding; + } } - if (!pTypeExt->Explodes_KillPassengers) + if (!pTypeExt->Explodes_KillPassengers.Get(RulesExt::Global()->Explodes_KillPassengers)) return SkipKillingPassengers; return 0; diff --git a/src/Ext/Techno/Hooks.Transport.cpp b/src/Ext/Techno/Hooks.Transport.cpp index 8416ebf863..30328f7e69 100644 --- a/src/Ext/Techno/Hooks.Transport.cpp +++ b/src/Ext/Techno/Hooks.Transport.cpp @@ -35,7 +35,7 @@ DEFINE_HOOK(0x6F8FD7, TechnoClass_ThreatEvals_OpenToppedOwner, 0x5) // Tec if (auto const pTransport = pThis->Transporter) { - if (TechnoExt::ExtMap.Find(pTransport)->TypeExtData->Passengers_SyncOwner) + if (TechnoExt::ExtMap.Find(pTransport)->TypeExtData->Passengers_SyncOwner.Get(RulesExt::Global()->Passengers_SyncOwner)) return returnAddress; } @@ -48,7 +48,7 @@ DEFINE_HOOK(0x701881, TechnoClass_ChangeHouse_Passenger_SyncOwner, 0x5) if (auto pPassenger = pThis->Passengers.GetFirstPassenger()) { - if (TechnoExt::ExtMap.Find(pThis)->TypeExtData->Passengers_SyncOwner) + if (TechnoExt::ExtMap.Find(pThis)->TypeExtData->Passengers_SyncOwner.Get(RulesExt::Global()->Passengers_SyncOwner)) { const auto pOwner = pThis->Owner; @@ -76,11 +76,14 @@ DEFINE_HOOK(0x71067B, TechnoClass_EnterTransport, 0x7) auto const whatAmI = pPassenger->WhatAmI(); auto const pTransTypeExt = TechnoExt::ExtMap.Find(pThis)->TypeExtData; - if (pTransTypeExt->Passengers_SyncOwner && pTransTypeExt->Passengers_SyncOwner_RevertOnExit) + if (pTransTypeExt->Passengers_SyncOwner.Get(RulesExt::Global()->Passengers_SyncOwner) + && pTransTypeExt->Passengers_SyncOwner_RevertOnExit.Get(RulesExt::Global()->Passengers_SyncOwner_RevertOnExit)) + { pExt->OriginalPassengerOwner = pPassenger->Owner; + } if (whatAmI != AbstractType::Aircraft && whatAmI != AbstractType::Building - && pType->Ammo > 0 && pExt->TypeExtData->ReloadInTransport) + && pType->Ammo > 0 && pExt->TypeExtData->ReloadInTransport.Get(RulesExt::Global()->ReloadInTransport)) { ScenarioExt::Global()->TransportReloaders.push_back(pExt); } @@ -103,14 +106,14 @@ DEFINE_HOOK(0x4DE722, FootClass_LeaveTransport, 0x6) // Remove from transport reloader list before switching house if (whatAmI != AbstractType::Aircraft && whatAmI != AbstractType::Building - && pType->Ammo > 0 && pExt->TypeExtData->ReloadInTransport) + && pType->Ammo > 0 && pExt->TypeExtData->ReloadInTransport.Get(RulesExt::Global()->ReloadInTransport)) { auto& vec = ScenarioExt::Global()->TransportReloaders; vec.erase(std::remove(vec.begin(), vec.end(), pExt), vec.end()); } - if (pTransTypeExt->Passengers_SyncOwner - && pTransTypeExt->Passengers_SyncOwner_RevertOnExit + if (pTransTypeExt->Passengers_SyncOwner.Get(RulesExt::Global()->Passengers_SyncOwner) + && pTransTypeExt->Passengers_SyncOwner_RevertOnExit.Get(RulesExt::Global()->Passengers_SyncOwner_RevertOnExit) && pExt->OriginalPassengerOwner) { pPassenger->SetOwningHouse(pExt->OriginalPassengerOwner, false); @@ -129,7 +132,8 @@ DEFINE_HOOK(0x737F80, UnitClass_ReceiveDamage_Cargo_SyncOwner, 0x6) { auto const pTypeExt = TechnoTypeExt::ExtMap.Find(pThis->Type); - if (pTypeExt->Passengers_SyncOwner && pTypeExt->Passengers_SyncOwner_RevertOnExit) + if (pTypeExt->Passengers_SyncOwner.Get(RulesExt::Global()->Passengers_SyncOwner) + && pTypeExt->Passengers_SyncOwner_RevertOnExit.Get(RulesExt::Global()->Passengers_SyncOwner_RevertOnExit)) { do { @@ -156,7 +160,7 @@ DEFINE_HOOK(0x51DF82, InfantryClass_FireAt_ReloadInTransport, 0x6) auto const pType = pThis->Type; auto const pTypeExt = TechnoTypeExt::ExtMap.Find(pType); - if (pTypeExt->ReloadInTransport && pType->Ammo > 0 && pThis->Ammo < pType->Ammo) + if (pTypeExt->ReloadInTransport.Get(RulesExt::Global()->ReloadInTransport) && pType->Ammo > 0 && pThis->Ammo < pType->Ammo) pThis->StartReloading(); } @@ -174,7 +178,7 @@ DEFINE_HOOK(0x6F72D2, TechnoClass_IsCloseEnoughToTarget_OpenTopped_RangeBonus, 0 auto const pExt = TechnoExt::ExtMap.Find(pTransport)->TypeExtData; const int rangeBonus = pExt->OpenTopped_RangeBonus.Get(RulesClass::Instance->OpenToppedRangeBonus); - R->EAX(rangeBonus + TechnoExt::ExtMap.Find(pThis)->TypeExtData->OpenTransport_RangeBonus); + R->EAX(rangeBonus + TechnoExt::ExtMap.Find(pThis)->TypeExtData->OpenTransport_RangeBonus.Get(RulesExt::Global()->OpenTransport_RangeBonus)); return 0x6F72DE; } @@ -206,7 +210,7 @@ DEFINE_HOOK(0x710552, TechnoClass_SetOpenTransportCargoTarget_ShareTarget, 0x6) { auto const pTypeExt = TechnoExt::ExtMap.Find(pThis)->TypeExtData; - if (!pTypeExt->OpenTopped_ShareTransportTarget) + if (!pTypeExt->OpenTopped_ShareTransportTarget.Get(RulesExt::Global()->OpenTopped_ShareTransportTarget)) return ReturnFromFunction; } diff --git a/src/Ext/Techno/Hooks.WeaponRange.cpp b/src/Ext/Techno/Hooks.WeaponRange.cpp index c60dea0db5..c65ce6d224 100644 --- a/src/Ext/Techno/Hooks.WeaponRange.cpp +++ b/src/Ext/Techno/Hooks.WeaponRange.cpp @@ -19,7 +19,7 @@ DEFINE_HOOK(0x7012C2, TechnoClass_WeaponRange, 0x8) result = WeaponTypeExt::GetRangeWithModifiers(pWeapon, pThis); auto const pTypeExt = TechnoExt::ExtMap.Find(pThis)->TypeExtData; - if (!pTypeExt->OpenTopped_IgnoreRangefinding && pTypeExt->OwnerObject()->OpenTopped) + if (!pTypeExt->OpenTopped_IgnoreRangefinding.Get(RulesExt::Global()->OpenTopped_IgnoreRangefinding) && pTypeExt->OwnerObject()->OpenTopped) { int smallestRange = INT32_MAX; auto pPassenger = abstract_cast(pThis->Passengers.GetFirstPassenger()); diff --git a/src/Ext/Techno/Hooks.cpp b/src/Ext/Techno/Hooks.cpp index df3499c348..69c23a1471 100644 --- a/src/Ext/Techno/Hooks.cpp +++ b/src/Ext/Techno/Hooks.cpp @@ -897,7 +897,7 @@ DEFINE_HOOK(0x5F4021, ObjectClass_Update_FallingDown_ToDead, 0x6) if (hoverShutdown) { - if (pExt->TypeExtData->HoverDrownable) + if (pExt->TypeExtData->HoverDrownable.Get(RulesExt::Global()->HoverDrownable)) { int damage = pThis->Health; pTechno->ReceiveDamage(&damage, 0, RulesClass::Instance->C4Warhead, nullptr, true, false, nullptr); diff --git a/src/Ext/TechnoType/Body.h b/src/Ext/TechnoType/Body.h index f8cad1c703..57e767318e 100644 --- a/src/Ext/TechnoType/Body.h +++ b/src/Ext/TechnoType/Body.h @@ -69,7 +69,7 @@ class TechnoTypeExt PhobosPCXFile AltCameoPCX; Valueable NoManualMove; Nullable InitialStrength; - Valueable ReloadInTransport; + Nullable ReloadInTransport; Valueable ForbidParallelAIQueues; Valueable IgnoreForBaseCenter; @@ -162,15 +162,15 @@ class TechnoTypeExt Nullable OpenTopped_RangeBonus; Nullable OpenTopped_DamageMultiplier; Nullable OpenTopped_WarpDistance; - Valueable OpenTopped_IgnoreRangefinding; - Valueable OpenTopped_AllowFiringIfDeactivated; + Nullable OpenTopped_IgnoreRangefinding; + Nullable OpenTopped_AllowFiringIfDeactivated; Nullable OpenTopped_AllowFiringIfAttackedByLocomotor; - Valueable OpenTopped_ShareTransportTarget; - Valueable OpenTopped_UseTransportRangeModifiers; - Valueable OpenTopped_CheckTransportDisableWeapons; + Nullable OpenTopped_ShareTransportTarget; + Nullable OpenTopped_UseTransportRangeModifiers; + Nullable OpenTopped_CheckTransportDisableWeapons; Nullable OpenTopped_DecloakToFire; - Valueable OpenTransport_RangeBonus; - Valueable OpenTransport_DamageMultiplier; + Nullable OpenTransport_RangeBonus; + Nullable OpenTransport_DamageMultiplier; Valueable AutoTargetOwnPosition; Valueable AutoTargetOwnPosition_Self; @@ -221,8 +221,8 @@ class TechnoTypeExt Valueable Ammo_Shared_Group; Nullable SelfHealGainType; - Valueable Passengers_SyncOwner; - Valueable Passengers_SyncOwner_RevertOnExit; + Nullable Passengers_SyncOwner; + Nullable Passengers_SyncOwner_RevertOnExit; Nullable IronCurtain_KeptOnDeploy; Nullable IronCurtain_Effect; @@ -230,8 +230,8 @@ class TechnoTypeExt Nullable ForceShield_KeptOnDeploy; Nullable ForceShield_Effect; Nullable ForceShield_KillWarhead; - Valueable Explodes_KillPassengers; - Valueable Explodes_DuringBuildup; + Nullable Explodes_KillPassengers; + Nullable Explodes_DuringBuildup; Valueable DriverKilled_KeptPassengers; Nullable DriverKilled_KillPassengers; Nullable DeployFireWeapon; @@ -374,8 +374,8 @@ class TechnoTypeExt Valueable Spawner_RecycleOnTurret; Nullable Sinkable; - Valueable Sinkable_SquidGrab; - Valueable SinkSpeed; + Nullable Sinkable_SquidGrab; + Nullable SinkSpeed; Nullable ProneSpeed; Nullable DamagedSpeed; @@ -435,7 +435,7 @@ class TechnoTypeExt Valueable Ammo_AutoConvertMaximumAmount; Nullable Ammo_AutoConvertType; - Valueable FiringForceScatter; + Nullable FiringForceScatter; Valueable FireUp; Valueable FireUp_ResetInRetarget; @@ -494,7 +494,7 @@ class TechnoTypeExt Nullable JumpjetClimbIgnoreBuilding; - Valueable HoverDrownable; + Nullable HoverDrownable; bool ExtraThreat_Enabled; Nullable ExtraThreat_IsThreat; Valueable AlwaysConsideredThreat; @@ -554,7 +554,7 @@ class TechnoTypeExt , AltCameoPCX {} , NoManualMove { false } , InitialStrength {} - , ReloadInTransport { false } + , ReloadInTransport {} , ForbidParallelAIQueues { false } , IgnoreForBaseCenter { false } , TintColorAirstrike { 0 } @@ -598,15 +598,15 @@ class TechnoTypeExt , OpenTopped_RangeBonus {} , OpenTopped_DamageMultiplier {} , OpenTopped_WarpDistance {} - , OpenTopped_IgnoreRangefinding { false } + , OpenTopped_IgnoreRangefinding {} + , OpenTopped_AllowFiringIfDeactivated {} , OpenTopped_AllowFiringIfAttackedByLocomotor {} - , OpenTopped_AllowFiringIfDeactivated { true } - , OpenTopped_ShareTransportTarget { true } - , OpenTopped_UseTransportRangeModifiers { false } - , OpenTopped_CheckTransportDisableWeapons { false } + , OpenTopped_ShareTransportTarget {} + , OpenTopped_UseTransportRangeModifiers {} + , OpenTopped_CheckTransportDisableWeapons {} , OpenTopped_DecloakToFire {} - , OpenTransport_RangeBonus { 0 } - , OpenTransport_DamageMultiplier { 1.0f } + , OpenTransport_RangeBonus {} + , OpenTransport_DamageMultiplier {} , AutoTargetOwnPosition { false } , AutoTargetOwnPosition_Self { false } @@ -693,8 +693,8 @@ class TechnoTypeExt , Ammo_Shared_Group { -1 } , SelfHealGainType {} - , Passengers_SyncOwner { false } - , Passengers_SyncOwner_RevertOnExit { true } + , Passengers_SyncOwner {} + , Passengers_SyncOwner_RevertOnExit {} , OnlyUseLandSequences { false } @@ -710,8 +710,8 @@ class TechnoTypeExt , ForceShield_Effect {} , ForceShield_KillWarhead {} - , Explodes_KillPassengers { true } - , Explodes_DuringBuildup { true } + , Explodes_KillPassengers {} + , Explodes_DuringBuildup {} , DriverKilled_KeptPassengers { false } , DriverKilled_KillPassengers {} , DeployFireWeapon {} @@ -858,8 +858,8 @@ class TechnoTypeExt , Spawner_RecycleOnTurret { false } , Sinkable { } - , Sinkable_SquidGrab { true } - , SinkSpeed { 5 } + , Sinkable_SquidGrab { } + , SinkSpeed { } , ProneSpeed { } , DamagedSpeed { } @@ -898,7 +898,7 @@ class TechnoTypeExt , Ammo_AutoConvertMaximumAmount { -1 } , Ammo_AutoConvertType { nullptr } - , FiringForceScatter { true } + , FiringForceScatter {} , FireUp { -1 } , FireUp_ResetInRetarget { true } @@ -957,7 +957,7 @@ class TechnoTypeExt , JumpjetClimbIgnoreBuilding {} - , HoverDrownable { true } + , HoverDrownable {} , Unsellable {} diff --git a/src/Ext/TerrainType/Body.h b/src/Ext/TerrainType/Body.h index c1e5f1f87c..1df87d53e2 100644 --- a/src/Ext/TerrainType/Body.h +++ b/src/Ext/TerrainType/Body.h @@ -23,8 +23,8 @@ class TerrainTypeExt ValueableVector DestroyAnim; ValueableIdx DestroySound; Nullable MinimapColor; - Valueable IsPassable; - Valueable CanBeBuiltOn; + Nullable IsPassable; + Nullable CanBeBuiltOn; Valueable HasDamagedFrames; Valueable HasCrumblingFrames; ValueableIdx CrumblingSound; @@ -42,8 +42,8 @@ class TerrainTypeExt , DestroyAnim {} , DestroySound {} , MinimapColor {} - , IsPassable { false } - , CanBeBuiltOn { false } + , IsPassable {} + , CanBeBuiltOn {} , HasDamagedFrames { false } , HasCrumblingFrames { false } , CrumblingSound {} diff --git a/src/Ext/TerrainType/Hooks.Passable.cpp b/src/Ext/TerrainType/Hooks.Passable.cpp index aae4097b21..18aa355512 100644 --- a/src/Ext/TerrainType/Hooks.Passable.cpp +++ b/src/Ext/TerrainType/Hooks.Passable.cpp @@ -1,5 +1,6 @@ #include "Body.h" +#include // Passable TerrainTypes Hook #1 - Do not set occupy bits. DEFINE_HOOK(0x71C110, TerrainClass_SetOccupyBit_PassableTerrain, 0x6) @@ -10,7 +11,7 @@ DEFINE_HOOK(0x71C110, TerrainClass_SetOccupyBit_PassableTerrain, 0x6) auto const pTypeExt = TerrainTypeExt::ExtMap.Find(pThis->Type); - if (pTypeExt->IsPassable) + if (pTypeExt->IsPassable.Get(RulesExt::Global()->Terrain_IsPassable)) return Skip; return 0; @@ -30,7 +31,7 @@ DEFINE_HOOK(0x7002E9, TechnoClass_WhatAction_PassableTerrain, 0x5) if (const auto pTerrain = abstract_cast(pTarget)) { - if (!isForceFire && TerrainTypeExt::ExtMap.Find(pTerrain->Type)->IsPassable) + if (!isForceFire && TerrainTypeExt::ExtMap.Find(pTerrain->Type)->IsPassable.Get(RulesExt::Global()->Terrain_IsPassable)) { R->EBP(Action::Move); return ReturnAction; @@ -50,7 +51,7 @@ DEFINE_HOOK(0x483DDF, CellClass_CheckPassability_PassableTerrain, 0x6) auto const pTypeExt = TerrainTypeExt::ExtMap.Find(pTerrain->Type); - if (pTypeExt->IsPassable) + if (pTypeExt->IsPassable.Get(RulesExt::Global()->Terrain_IsPassable)) { pThis->Passability = PassabilityType::Passable; return ReturnFromFunction; @@ -70,7 +71,7 @@ DEFINE_HOOK(0x73FB71, UnitClass_CanEnterCell_PassableTerrain, 0x6) { auto const pTypeExt = TerrainTypeExt::ExtMap.Find(pTerrain->Type); - if (pTypeExt->IsPassable) + if (pTypeExt->IsPassable.Get(RulesExt::Global()->Terrain_IsPassable)) return SkipTerrainChecks; } @@ -88,7 +89,7 @@ DEFINE_HOOK(0x6D57C1, TacticalClass_DrawLaserFencePlacement_BuildableTerrain, 0x GET(CellClass*, pCell, ESI); if (auto const pTerrain = pCell->GetTerrain(false)) - return TerrainTypeExt::ExtMap.Find(pTerrain->Type)->CanBeBuiltOn ? ContinueChecks : DontDraw; + return TerrainTypeExt::ExtMap.Find(pTerrain->Type)->CanBeBuiltOn.Get(RulesExt::Global()->Terrain_CanBeBuiltOn) ? ContinueChecks : DontDraw; return ContinueChecks; } @@ -103,7 +104,7 @@ DEFINE_HOOK(0x5684B1, MapClass_PlaceDown_BuildableTerrain, 0x6) { if (auto const pTerrain = pCell->GetTerrain(false)) { - if (TerrainTypeExt::ExtMap.Find(pTerrain->Type)->CanBeBuiltOn) + if (TerrainTypeExt::ExtMap.Find(pTerrain->Type)->CanBeBuiltOn.Get(RulesExt::Global()->Terrain_CanBeBuiltOn)) { pCell->RemoveContent(pTerrain, false); TerrainTypeExt::Remove(pTerrain); @@ -126,7 +127,7 @@ DEFINE_HOOK(0x5FD2B6, OverlayClass_Unlimbo_SkipTerrainCheck, 0x9) if (auto const pTerrain = pCell->GetTerrain(false)) { - if (!TerrainTypeExt::ExtMap.Find(pTerrain->Type)->CanBeBuiltOn) + if (!TerrainTypeExt::ExtMap.Find(pTerrain->Type)->CanBeBuiltOn.Get(RulesExt::Global()->Terrain_CanBeBuiltOn)) return NoUnlimbo; pCell->RemoveContent(pTerrain, false); @@ -145,7 +146,7 @@ DEFINE_HOOK(0x45EF3A, BuildingTypeClass_FlushForPlacement_BuildableTerrain, 0x7) if (auto const pTerrain = abstract_cast(pObject)) { - if (!TerrainTypeExt::ExtMap.Find(pTerrain->Type)->CanBeBuiltOn) + if (!TerrainTypeExt::ExtMap.Find(pTerrain->Type)->CanBeBuiltOn.Get(RulesExt::Global()->Terrain_CanBeBuiltOn)) return Disallow; } diff --git a/src/Ext/Unit/Hooks.DeploysInto.cpp b/src/Ext/Unit/Hooks.DeploysInto.cpp index 98815fdf2f..e2ec452522 100644 --- a/src/Ext/Unit/Hooks.DeploysInto.cpp +++ b/src/Ext/Unit/Hooks.DeploysInto.cpp @@ -178,7 +178,7 @@ DEFINE_HOOK(0x47C640, CellClass_CanThisExistHere_IgnoreSomething, 0x6) } else if (const auto pTerrain = abstract_cast(pObject)) { - if (!TerrainTypeExt::ExtMap.Find(pTerrain->Type)->CanBeBuiltOn) + if (!TerrainTypeExt::ExtMap.Find(pTerrain->Type)->CanBeBuiltOn.Get(RulesExt::Global()->Terrain_CanBeBuiltOn)) return CanNotExistHere; } } @@ -192,7 +192,7 @@ DEFINE_HOOK(0x47C640, CellClass_CanThisExistHere_IgnoreSomething, 0x6) { if (const auto pTerrain = abstract_cast(pObject)) { - if (!TerrainTypeExt::ExtMap.Find(pTerrain->Type)->CanBeBuiltOn) + if (!TerrainTypeExt::ExtMap.Find(pTerrain->Type)->CanBeBuiltOn.Get(RulesExt::Global()->Terrain_CanBeBuiltOn)) return CanNotExistHere; builtOnCanBeBuiltOn = true; @@ -248,7 +248,7 @@ DEFINE_HOOK(0x47C640, CellClass_CanThisExistHere_IgnoreSomething, 0x6) } else if (const auto pTerrain = abstract_cast(pObject)) { - if (!TerrainTypeExt::ExtMap.Find(pTerrain->Type)->CanBeBuiltOn) + if (!TerrainTypeExt::ExtMap.Find(pTerrain->Type)->CanBeBuiltOn.Get(RulesExt::Global()->Terrain_CanBeBuiltOn)) return CanNotExistHere; builtOnCanBeBuiltOn = true; diff --git a/src/Ext/Unit/Hooks.Sinking.cpp b/src/Ext/Unit/Hooks.Sinking.cpp index 023fa66466..e15b3a9a6a 100644 --- a/src/Ext/Unit/Hooks.Sinking.cpp +++ b/src/Ext/Unit/Hooks.Sinking.cpp @@ -6,7 +6,7 @@ DEFINE_HOOK(0x7364DC, UnitClass_Update_SinkSpeed, 0x7) GET(const int, CoordZ, EDX); auto const pTypeExt = TechnoTypeExt::ExtMap.Find(pThis->Type); - R->EDX(CoordZ - (pTypeExt->SinkSpeed - 5)); + R->EDX(CoordZ - (pTypeExt->SinkSpeed.Get(RulesExt::Global()->SinkSpeed) - 5)); return 0; } @@ -19,7 +19,7 @@ DEFINE_HOOK(0x737DE2, UnitClass_ReceiveDamage_Sinkable, 0x6) auto const pTypeExt = TechnoTypeExt::ExtMap.Find(pType); const bool shouldSink = pType->Weight > RulesClass::Instance->ShipSinkingWeight && pType->Naval && !pType->Underwater && !pType->Organic; - return pTypeExt->Sinkable.Get(shouldSink) ? GoOtherChecks : NoSink; + return pTypeExt->Sinkable.Get(shouldSink || RulesExt::Global()->Sinkable) ? GoOtherChecks : NoSink; } DEFINE_HOOK(0x629C67, ParasiteClass_UpdateSquid_SinkableBySquid, 0x9) @@ -32,7 +32,7 @@ DEFINE_HOOK(0x629C67, ParasiteClass_UpdateSquid_SinkableBySquid, 0x9) const auto pVictimTypeExt = TechnoExt::ExtMap.Find(pVictim)->TypeExtData; const auto pOwner = pThis->Owner; - if (pVictimTypeExt->Sinkable_SquidGrab || pVictim->WhatAmI() != AbstractType::Unit) + if (pVictimTypeExt->Sinkable_SquidGrab.Get(RulesExt::Global()->Sinkable_SquidGrab) || pVictim->WhatAmI() != AbstractType::Unit) { pVictim->IsSinking = true; pVictim->Destroyed(pOwner); diff --git a/src/Ext/WarheadType/Body.h b/src/Ext/WarheadType/Body.h index 88be830a6d..a09f25c7b6 100644 --- a/src/Ext/WarheadType/Body.h +++ b/src/Ext/WarheadType/Body.h @@ -36,14 +36,14 @@ class WarheadTypeExt Valueable AnimList_CreationInterval; Valueable AnimList_ScatterMin; Valueable AnimList_ScatterMax; - Valueable CreateAnimsOnZeroDamage; - Valueable Conventional_IgnoreUnits; + Nullable CreateAnimsOnZeroDamage; + Nullable Conventional_IgnoreUnits; Valueable RemoveDisguise; Valueable RemoveMindControl; Nullable RemoveParasite; ValueableVector RemoveParasite_Allow; ValueableVector RemoveParasite_Disallow; - Valueable DecloakDamagedTargets; + Nullable DecloakDamagedTargets; Valueable ShakeIsLocal; Valueable ApplyModifiersOnNegativeDamage; Valueable PenetratesIronCurtain; @@ -293,14 +293,14 @@ class WarheadTypeExt , AnimList_CreationInterval { 0 } , AnimList_ScatterMin { Leptons(-1) } , AnimList_ScatterMax { Leptons(-1) } - , CreateAnimsOnZeroDamage { false } - , Conventional_IgnoreUnits { false } + , CreateAnimsOnZeroDamage {} + , Conventional_IgnoreUnits {} , RemoveDisguise { false } , RemoveMindControl { false } , RemoveParasite {} , RemoveParasite_Allow {} , RemoveParasite_Disallow {} - , DecloakDamagedTargets { true } + , DecloakDamagedTargets {} , ShakeIsLocal { false } , ApplyModifiersOnNegativeDamage { false } , PenetratesIronCurtain { false } diff --git a/src/Ext/WarheadType/Detonate.cpp b/src/Ext/WarheadType/Detonate.cpp index b8fe245d42..06f5956501 100644 --- a/src/Ext/WarheadType/Detonate.cpp +++ b/src/Ext/WarheadType/Detonate.cpp @@ -567,7 +567,7 @@ void WarheadTypeExt::ExtData::InterceptBullets(TechnoClass* pOwner, BulletClass* { const auto pBulletExt = BulletExt::ExtMap.Find(pBullet); - if (!pBulletExt->TypeExtData->Interceptable) + if (!pBulletExt->TypeExtData->Interceptable.Get(RulesExt::Global()->Interceptable)) return; // 1/8th of a cell as a margin of error if not Inviso interceptor. @@ -584,7 +584,7 @@ void WarheadTypeExt::ExtData::InterceptBullets(TechnoClass* pOwner, BulletClass* const auto pBulletExt = BulletExt::ExtMap.Find(pBullet); // Cells don't know about bullets that may or may not be located on them so it has to be this way. - if (!pBulletExt->TypeExtData->Interceptable || pBullet->SpawnNextAnim) + if (!pBulletExt->TypeExtData->Interceptable.Get(RulesExt::Global()->Interceptable) || pBullet->SpawnNextAnim) continue; if (pBullet->Location.DistanceFromSquared(coords) <= cellSpreadSq) diff --git a/src/Ext/WarheadType/Hooks.cpp b/src/Ext/WarheadType/Hooks.cpp index 2b59d709ac..97ddd51b2f 100644 --- a/src/Ext/WarheadType/Hooks.cpp +++ b/src/Ext/WarheadType/Hooks.cpp @@ -305,7 +305,7 @@ DEFINE_HOOK(0x48A4F3, SelectDamageAnimation_NegativeZeroDamage, 0x6) pWHExt->Splashed = false; - if (damage == 0 && !pWHExt->CreateAnimsOnZeroDamage) + if (damage == 0 && !pWHExt->CreateAnimsOnZeroDamage.Get(RulesExt::Global()->CreateAnimsOnZeroDamage)) return NoAnim; else if (damage < 0) damage = -damage; diff --git a/src/Ext/WeaponType/Body.cpp b/src/Ext/WeaponType/Body.cpp index f98678cfdc..316037d22c 100644 --- a/src/Ext/WeaponType/Body.cpp +++ b/src/Ext/WeaponType/Body.cpp @@ -349,7 +349,7 @@ int WeaponTypeExt::GetRangeWithModifiers(WeaponTypeClass* pThis, TechnoClass* pF { auto const pTypeExt = TechnoExt::ExtMap.Find(pTransport)->TypeExtData; - if (pTypeExt->OpenTopped_UseTransportRangeModifiers && pTypeExt->OwnerObject()->OpenTopped) + if (pTypeExt->OpenTopped_UseTransportRangeModifiers.Get(RulesExt::Global()->OpenTopped_UseTransportRangeModifiers) && pTypeExt->OwnerObject()->OpenTopped) pTechno = pTransport; } diff --git a/src/New/Entity/ShieldClass.cpp b/src/New/Entity/ShieldClass.cpp index b71327bdb9..fc9ee2cb21 100644 --- a/src/New/Entity/ShieldClass.cpp +++ b/src/New/Entity/ShieldClass.cpp @@ -262,7 +262,7 @@ int ShieldClass::ReceiveDamage(args_ReceiveDamage* args) if (!pWHExt->Nonprovocative) this->ResponseAttack(); - if (pWHExt->DecloakDamagedTargets) + if (pWHExt->DecloakDamagedTargets.Get(RulesExt::Global()->DecloakDamagedTargets)) pTechno->Uncloak(false); const int residueDamage = shieldDamage - health;