diff --git a/README.md b/README.md index db4782f118..c88781745e 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,7 @@ Credits - **wiktorderelf** - overhauled Unicode font - **Uranusian (Thrifinesma)** - Mind Control enhancement, custom warhead splash list, harvesters counter, promoted spawns, shields, death after dead fix, customizeable missing cameo, cameo sorting priority, placement mode responding of tab hotkeys fix, producing progress, custom ore gathering anim, NoManualMove, DeathWeapon fix, re-enable obsolete `JumpjetControls`, overhauled Unicode font, docs maintenance, CN docs translation - **secsome (SEC-SOME)** - debug info dump hotkey, refactoring & porting of Ares helper code, introducing more Ares-derived stuff, disguise removal warhead, Mind Control removal warhead, Mind Control enhancement, shields, AnimList.PickRandom, MoveToCell fix, unlimited waypoints, Build At trigger action buildup anim fix, Undeploy building into a unit plays `EVA_NewRallyPointEstablished` fix, custom ore gathering anim, TemporaryClass related crash -- **Otamaa (Fahroni, BoredEXE)** - help with CellSpread, ported and fixed custom RadType code, togglable ElectricBolt bolts, customizable Chrono Locomotor properties per TechnoClass, DebrisMaximums fixes, Anim-to-Unit, NotHuman anim sequences improvements +- **Otamaa (Fahroni, BoredEXE)** - help with CellSpread, ported and fixed custom RadType code, togglable ElectricBolt bolts, customizable Chrono Locomotor properties per TechnoClass, DebrisMaximums fixes, Anim-to-Unit, NotHuman anim sequences improvements, Customizable OpenTopped Properties - **E1 Elite** - TileSet 255 and above bridge repair fix - **FS-21** - Dump Object Info enhancements, Powered.KillSpawns, Spawner.LimitRange, ScriptType Actions 71, 72 & 73, MC deployer fixes, help with docs - **AutoGavy** - interceptor logic, warhead critical damage system diff --git a/docs/New-or-Enhanced-Logics.md b/docs/New-or-Enhanced-Logics.md index efb50b0819..d8ae97b0dc 100644 --- a/docs/New-or-Enhanced-Logics.md +++ b/docs/New-or-Enhanced-Logics.md @@ -223,6 +223,17 @@ NotHuman.RandomDeathSequence=yes ; boolean NoManualMove=no ; boolean ``` +### Customizable OpenTopped Properties + +- You can now override settings of `OpenTopped` transport properties per TechnoType. + +```ini +[SOMETECHNO] ; TechnoType +OpenTopped.RangeBonus=1 ; integer +OpenTopped.DamageMultiplier=1.3 ; float +OpenTopped.WarpDistance=8 ; integer +``` + ## Technos ### Mind Control enhancement diff --git a/docs/Whats-New.md b/docs/Whats-New.md index fdeb4fc771..ef0bbb84e3 100644 --- a/docs/Whats-New.md +++ b/docs/Whats-New.md @@ -48,6 +48,7 @@ New: - Allow `NotHuman=yes` infantry to use random `Death` anim sequence (by Otamaa) - Ability for warheads to trigger specific `NotHuman=yes` infantry `Death` anim sequence (by Otamaa) - XDrawOffset for animations (by Morton) +- Customizable OpenTopped properties (by Otamaa) Vanilla fixes: - Fixed laser drawing code to allow for thicker lasers in house color draw mode (by Kerbiter, ChrisLv_CN) diff --git a/src/Ext/Techno/Hooks.cpp b/src/Ext/Techno/Hooks.cpp index 6a30cd8562..9da0da7b9c 100644 --- a/src/Ext/Techno/Hooks.cpp +++ b/src/Ext/Techno/Hooks.cpp @@ -19,7 +19,7 @@ DEFINE_HOOK(0x6F9E50, TechnoClass_AI, 0x5) // LaserTrails update routine is in TechnoClass::AI hook because TechnoClass::Draw // doesn't run when the object is off-screen which leads to visual bugs - Kerbiter - for (auto const& trail: pExt->LaserTrails) + for (auto const& trail : pExt->LaserTrails) trail->Update(TechnoExt::GetFLHAbsoluteCoords(pThis, trail->FLH, trail->IsOnTurret)); return 0; @@ -126,7 +126,7 @@ DEFINE_HOOK(0x518505, InfantryClass_TakeDamage_NotHuman, 0x4) REF_STACK(args_ReceiveDamage const, receiveDamageArgs, STACK_OFFS(0xD0, -0x4)); // Die1-Die5 sequences are offset by 10 - #define Die(x) x + 10 + constexpr auto Die = [](int x) { return x + 10; }; int resultSequence = Die(1); auto const pTypeExt = TechnoTypeExt::ExtMap.Find(pThis->GetTechnoType()); @@ -144,10 +144,71 @@ DEFINE_HOOK(0x518505, InfantryClass_TakeDamage_NotHuman, 0x4) } } - #undef Die(x) - R->ECX(pThis); pThis->PlayAnim(static_cast(resultSequence), true); return 0x518515; +} + +// Customizable OpenTopped Properties +// Author: Otamaa + +DEFINE_HOOK(0x6F72D2, TechnoClass_IsCloseEnoughToTarget_OpenTopped_RangeBonus, 0xC) +{ + GET(TechnoClass* const, pThis, ESI); + + if (auto pTransport = pThis->Transporter) + { + if (auto pExt = TechnoTypeExt::ExtMap.Find(pTransport->GetTechnoType())) + { + R->EAX(pExt->OpenTopped_RangeBonus.Get(RulesClass::Instance->OpenToppedRangeBonus)); + return 0x6F72DE; + } + } + + return 0; +} + +DEFINE_HOOK(0x6FE43B, TechnoClass_Fire_OpenTopped_DmgMult, 0x8) +{ + enum { ApplyDamageMult = 0x6FE45A, ContinueCheck = 0x6FE460 }; + + GET(TechnoClass* const, pThis, ESI); + + //replacing whole check due to `fild` + if (pThis->InOpenToppedTransport) + { + GET_STACK(int, nDamage, STACK_OFFS(0xB4, -0x2C)); + float nDamageMult = static_cast(RulesClass::Instance->OpenToppedDamageMultiplier); + + if (auto pTransport = pThis->Transporter) + { + if (auto pExt = TechnoTypeExt::ExtMap.Find(pTransport->GetTechnoType())) + { + //it is float isnt it YRPP ? , check tomson26 YR-IDB ! + nDamageMult = pExt->OpenTopped_DamageMultiplier.Get(nDamageMult); + } + } + + R->EAX(Game::F2I(nDamage * nDamageMult)); + return ApplyDamageMult; + } + + return ContinueCheck; +} + +DEFINE_HOOK(0x71A82C, TemporalClass_AI_Opentopped_WarpDistance, 0xC) +{ + GET(TemporalClass* const, pThis, ESI); + + if (auto pTransport = pThis->Owner->Transporter) + { + if (auto pExt = TechnoTypeExt::ExtMap.Find(pTransport->GetTechnoType())) + { + R->EDX(pExt->OpenTopped_WarpDistance.Get(RulesClass::Instance->OpenToppedWarpDistance)); + return 0x71A838; + } + } + + return 0; } \ No newline at end of file diff --git a/src/Ext/TechnoType/Body.cpp b/src/Ext/TechnoType/Body.cpp index e3ae1f6f7f..6893d883fa 100644 --- a/src/Ext/TechnoType/Body.cpp +++ b/src/Ext/TechnoType/Body.cpp @@ -120,6 +120,10 @@ void TechnoTypeExt::ExtData::LoadFromINIFile(CCINIClass* const pINI) // Ares 0.A this->GroupAs.Read(pINI, pSection, "GroupAs"); + this->OpenTopped_RangeBonus.Read(exINI, pSection, "OpenTopped.RangeBonus"); + this->OpenTopped_DamageMultiplier.Read(exINI, pSection, "OpenTopped.DamageMultiplier"); + this->OpenTopped_WarpDistance.Read(exINI, pSection, "OpenTopped.WarpDistance"); + // Art tags INI_EX exArtINI(CCINIClass::INI_Art); auto pArtSection = pThis->ImageFile; @@ -221,6 +225,9 @@ void TechnoTypeExt::ExtData::Serialize(T& Stm) .Process(this->NotHuman_RandomDeathSequence) .Process(this->WeaponBurstFLHs) .Process(this->EliteWeaponBurstFLHs) + .Process(this->OpenTopped_RangeBonus) + .Process(this->OpenTopped_DamageMultiplier) + .Process(this->OpenTopped_WarpDistance) ; } void TechnoTypeExt::ExtData::LoadFromStream(PhobosStreamReader& Stm) diff --git a/src/Ext/TechnoType/Body.h b/src/Ext/TechnoType/Body.h index 0f5b5fc620..ff1eeb07ec 100644 --- a/src/Ext/TechnoType/Body.h +++ b/src/Ext/TechnoType/Body.h @@ -61,6 +61,10 @@ class TechnoTypeExt Valueable DestroyAnim_Random; Valueable NotHuman_RandomDeathSequence; + Nullable OpenTopped_RangeBonus; + Nullable OpenTopped_DamageMultiplier; + Nullable OpenTopped_WarpDistance; + struct LaserTrailDataEntry { ValueableIdx idxType; @@ -113,7 +117,10 @@ class TechnoTypeExt OreGathering_FramesPerDir(), LaserTrailData(), DestroyAnim_Random(true), - NotHuman_RandomDeathSequence(false) + NotHuman_RandomDeathSequence(false), + OpenTopped_RangeBonus(), + OpenTopped_DamageMultiplier(), + OpenTopped_WarpDistance() { } virtual ~ExtData() = default;