Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,7 @@ This page lists all the individual contributions to the project by their author.
- Customize which parasite can remove by warhead
- Fix the bug that unit will play crashing voice & sound when dropped by warhead with `IsLocomotor=yes`
- Add toggle of whether shield use ArmorMultiplier or not
- Allow customize jumpjet properties on warhead
- **Apollo** - Translucent SHP drawing patches
- **ststl**:
- Customizable `ShowTimer` priority of superweapons
Expand Down
18 changes: 18 additions & 0 deletions docs/Fixed-or-Improved-Logics.md
Original file line number Diff line number Diff line change
Expand Up @@ -2498,6 +2498,24 @@ Parasite.CullingTarget=infantry ; List of Affected Target Enumeration (n
Parasite.GrappleAnim= ; AnimationType, default to [AudioVisual] -> Parasite.GrappleAnim
```

### Customizing locomotor warhead

- Now you can customize jumpjet properties on warhead.

In `rulesmd.ini`:
```ini
[SOMEWARHEAD] ; WarheadType
JumpjetTurnRate= ; Integer, default to [TechnoType] -> JumpjetTurnRate
JumpjetSpeed= ; Integer, default to [TechnoType] -> JumpjetSpeed
JumpjetClimb= ; floating point value, default to [TechnoType] -> JumpjetClimb
JumpjetCrash= ; floating point value, default to [TechnoType] -> JumpjetCrash
JumpjetHeight= ; Integer, default to [TechnoType] -> JumpjetHeight
JumpjetAccel= ; floating point value, default to [TechnoType] -> JumpjetAccel
JumpjetWobbles= ; floating point value, default to [TechnoType] -> JumpjetWobbles
JumpjetNoWobbles= ; boolean, default to [TechnoType] -> JumpjetNoWobbles
JumpjetDeviation= ; Integer, default to [TechnoType] -> JumpjetDeviation
```

### Dehardcode the `ZAdjust` of warhead anim

- In vanilla, the animations generated by `AnimList` have a hard-coded `ZAdjust=-15`. Now you can customize it in the following ways.
Expand Down
1 change: 1 addition & 0 deletions docs/Whats-New.md
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,7 @@ New:
- [Implement `CurleyShuffle` for AircraftTypes](Fixed-or-Improved-Logics.md#implement-curleyshuffle-for-aircrafttypes) (ported from Vinifera by Noble_Fish)
- Customize which parasite can remove by warhead (by NetsuNegi)
- Add toggle of whether shield use ArmorMultiplier or not (by NetsuNegi)
- Allow customize jumpjet properties on warhead (by NetsuNegi)

Vanilla fixes:
- Fixed sidebar not updating queued unit numbers when adding or removing units when the production is on hold (by CrimRecya)
Expand Down
5 changes: 5 additions & 0 deletions docs/locale/zh_CN/LC_MESSAGES/CREDITS.po
Original file line number Diff line number Diff line change
Expand Up @@ -1671,6 +1671,11 @@ msgid ""
msgstr ""
"添加了护盾是否使用护甲倍率的开关"

msgid ""
"Allow customize jumpjet properties on warhead"
msgstr ""
"允许在弹头上自定义 Jumpjet 属性"

msgid "**Apollo** - Translucent SHP drawing patches"
msgstr "**Apollo** - 半透明 SHP 绘制补丁"

Expand Down
6 changes: 6 additions & 0 deletions docs/locale/zh_CN/LC_MESSAGES/Fixed-or-Improved-Logics.po
Original file line number Diff line number Diff line change
Expand Up @@ -5136,6 +5136,12 @@ msgid ""
"choose it."
msgstr "在原版中乌贼拖拽的动画被硬编码为 `SQDG`,现在选择权归你了。"

msgid "Customizing locomotor warhead"
msgstr "自定义 Locomotor 弹头"

msgid "Now you can customize jumpjet properties on warhead."
msgstr "现在你可以在弹头上指定 Jumpjet 属性了。"

msgid "Dehardcode the `ZAdjust` of warhead anim"
msgstr "弹头动画 `ZAdjust` 去硬编码"

Expand Down
3 changes: 3 additions & 0 deletions docs/locale/zh_CN/LC_MESSAGES/Whats-New.po
Original file line number Diff line number Diff line change
Expand Up @@ -1755,6 +1755,9 @@ msgstr "添加了护盾是否使用护甲倍率的开关(by NetsuNegi)"
msgid "Customize which parasite can remove by warhead (by NetsuNegi)"
msgstr "自定义哪些寄生者可被弹头移除(by NetsuNegi)"

msgid "Allow customize jumpjet properties on warhead (by NetsuNegi)"
msgstr "允许在弹头上自定义 Jumpjet 属性(by NetsuNegi)"

msgid "Vanilla fixes:"
msgstr "原版问题修复:"

Expand Down
39 changes: 39 additions & 0 deletions src/Ext/Unit/Hooks.Jumpjet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <Ext/Techno/Body.h>
#include <Ext/WeaponType/Body.h>
#include <Ext/WarheadType/Body.h>

// Misc jumpjet facing, turning, drawing fix -- Author: Trsdy
// Jumpjets stuck at FireError::FACING because Jumpjet has its own facing just for JumpjetTurnRate
Expand Down Expand Up @@ -454,3 +455,41 @@ DEFINE_HOOK(0x54D859, JumpjetLocomotionClass_GetFloorZ_IgnoreBuilding, 0x9)
}

#pragma endregion

DEFINE_HOOK(0x54AD41, JumpjetLocomotionClass_Link_To_Object_LocomotorWarhead, 0x8)
{
enum { SkipGameCode = 0x54ADF8 };

GET(ILocomotion*, pThis, EBP);
GET(FootClass*, pLinkedTo, EBX);
const auto pLoco = static_cast<JumpjetLocomotionClass*>(pThis);
const auto pType = pLinkedTo->GetTechnoType();

if (const auto pLocomotorWarhead = WarheadTypeExt::LocomotorWarhead)
{
const auto pWHExt = WarheadTypeExt::ExtMap.Find(pLocomotorWarhead);
pLoco->TurnRate = pWHExt->JumpjetTurnRate.Get(pType->JumpjetTurnRate);
pLoco->Speed = pWHExt->JumpjetSpeed.Get(pType->JumpjetSpeed);
pLoco->Climb = pWHExt->JumpjetClimb.Get(pType->JumpjetClimb);
pLoco->Crash = pWHExt->JumpjetCrash.Get(pType->JumpjetCrash);
pLoco->Height = std::max(pWHExt->JumpjetHeight.Get(pType->JumpjetHeight), Unsorted::CellHeight);
pLoco->Accel = pWHExt->JumpjetAccel.Get(pType->JumpjetAccel);
pLoco->Wobbles = pWHExt->JumpjetWobbles.Get(pType->JumpjetWobbles);
pLoco->Deviation = pWHExt->JumpjetDeviation.Get(pType->JumpjetDeviation);
pLoco->NoWobbles = pWHExt->JumpjetNoWobbles.Get(pType->JumpjetNoWobbles);
}
else
{
pLoco->TurnRate = pType->JumpjetTurnRate;
pLoco->Speed = pType->JumpjetSpeed;
pLoco->Climb = pType->JumpjetClimb;
pLoco->Crash = pType->JumpjetCrash;
pLoco->Height = std::max(pType->JumpjetHeight, Unsorted::CellHeight);
pLoco->Accel = pType->JumpjetAccel;
pLoco->Wobbles = pType->JumpjetWobbles;
pLoco->Deviation = pType->JumpjetDeviation;
pLoco->NoWobbles = pType->JumpjetNoWobbles;
}

return SkipGameCode;
}
22 changes: 22 additions & 0 deletions src/Ext/WarheadType/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

WarheadTypeExt::ExtContainer WarheadTypeExt::ExtMap;

WarheadTypeClass* WarheadTypeExt::LocomotorWarhead = nullptr;

bool WarheadTypeExt::ExtData::CanTargetHouse(HouseClass* pHouse, TechnoClass* pTarget) const
{
if (pHouse && pTarget)
Expand Down Expand Up @@ -291,6 +293,16 @@ void WarheadTypeExt::ExtData::LoadFromINIFile(CCINIClass* const pINI)
this->Parasite_CullingTarget.Read(exINI, pSection, "Parasite.CullingTarget");
this->Parasite_GrappleAnim.Read(exINI, pSection, "Parasite.GrappleAnim");

this->JumpjetTurnRate.Read(exINI, pSection, "JumpjetTurnRate");
this->JumpjetSpeed.Read(exINI, pSection, "JumpjetSpeed");
this->JumpjetClimb.Read(exINI, pSection, "JumpjetClimb");
this->JumpjetCrash.Read(exINI, pSection, "JumpjetCrash");
this->JumpjetHeight.Read(exINI, pSection, "JumpjetHeight");
this->JumpjetAccel.Read(exINI, pSection, "JumpjetAccel");
this->JumpjetWobbles.Read(exINI, pSection, "JumpjetWobbles");
this->JumpjetNoWobbles.Read(exINI, pSection, "JumpjetNoWobbles");
this->JumpjetDeviation.Read(exINI, pSection, "JumpjetDeviation");

this->Nonprovocative.Read(exINI, pSection, "Nonprovocative");

this->MergeBuildingDamage.Read(exINI, pSection, "MergeBuildingDamage");
Expand Down Expand Up @@ -666,6 +678,16 @@ void WarheadTypeExt::ExtData::Serialize(T& Stm)
.Process(this->Parasite_DisableParticleSystem)
.Process(this->Parasite_CullingTarget)
.Process(this->Parasite_GrappleAnim)

.Process(this->JumpjetTurnRate)
.Process(this->JumpjetSpeed)
.Process(this->JumpjetClimb)
.Process(this->JumpjetCrash)
.Process(this->JumpjetHeight)
.Process(this->JumpjetAccel)
.Process(this->JumpjetWobbles)
.Process(this->JumpjetNoWobbles)
.Process(this->JumpjetDeviation)

.Process(this->Nonprovocative)

Expand Down
22 changes: 22 additions & 0 deletions src/Ext/WarheadType/Body.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,16 @@ class WarheadTypeExt
Valueable<AffectedTarget> Parasite_CullingTarget;
NullableIdx<AnimTypeClass> Parasite_GrappleAnim;

Nullable<int> JumpjetTurnRate;
Nullable<int> JumpjetSpeed;
Nullable<float> JumpjetClimb;
Nullable<float> JumpjetCrash;
Nullable<int> JumpjetHeight;
Nullable<float> JumpjetAccel;
Nullable<float> JumpjetWobbles;
Nullable<bool> JumpjetNoWobbles;
Nullable<int> JumpjetDeviation;

Valueable<bool> Nonprovocative;

Nullable<bool> MergeBuildingDamage;
Expand Down Expand Up @@ -405,6 +415,16 @@ class WarheadTypeExt
, Parasite_CullingTarget { AffectedTarget::Infantry }
, Parasite_GrappleAnim {}

, JumpjetTurnRate {}
, JumpjetSpeed {}
, JumpjetClimb {}
, JumpjetCrash {}
, JumpjetHeight {}
, JumpjetAccel {}
, JumpjetWobbles {}
, JumpjetNoWobbles {}
, JumpjetDeviation {}

, Nonprovocative { false }

, MergeBuildingDamage {}
Expand Down Expand Up @@ -553,6 +573,8 @@ class WarheadTypeExt
static bool LoadGlobals(PhobosStreamReader& Stm);
static bool SaveGlobals(PhobosStreamWriter& Stm);

static WarheadTypeClass* LocomotorWarhead;

static void DetonateAt(WarheadTypeClass* pThis, AbstractClass* pTarget, TechnoClass* pOwner, int damage, HouseClass* pFiringHouse = nullptr);
static void DetonateAt(WarheadTypeClass* pThis, const CoordStruct& coords, TechnoClass* pOwner, int damage, HouseClass* pFiringHouse = nullptr, AbstractClass* pTarget = nullptr);
};
15 changes: 15 additions & 0 deletions src/Ext/WarheadType/Hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,21 @@ DEFINE_HOOK(0x46920B, BulletClass_Detonate, 0x6)
return 0;
}

// Customize Jumpjet properties on warhead
DEFINE_HOOK(0x4696CE, BulletClass_Detonate_ImbueLocomotor, 0x6)
{
enum { SkipGameCode = 0x469AA4 };

GET(BulletClass* const, pBullet, ESI);
GET(FootClass* const, pTarget, EDI);
const auto pWH = pBullet->WH;

WarheadTypeExt::LocomotorWarhead = pWH;
pBullet->Owner->ImbueLocomotor(pTarget, pWH->Locomotor);
WarheadTypeExt::LocomotorWarhead = nullptr;
return SkipGameCode;
}

DEFINE_HOOK(0x489286, MapClass_DamageArea, 0x6)
{
GET_BASE(const WarheadTypeClass*, pWH, 0xC);
Expand Down
Loading