Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 4 additions & 1 deletion CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -749,4 +749,7 @@ This page lists all the individual contributions to the project by their author.
- **Dmitry Volkov** - extensive and thorough testing
- **Rise of the East community** - extensive playtesting of in-dev features
- **11EJDE11** - Prevent mpdebug number from being drawn when visibility toggled off
- **CnCRazer** - Wall overlay unit sell exploit fix
- **RAZER**:
- Wall overlay unit sell exploit fix
- Revert Ares patch to allow OpenTopped transport customization.

1 change: 1 addition & 0 deletions docs/Fixed-or-Improved-Logics.md
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ This page describes all ingame logics that are fixed or improved in Phobos witho
- Fixed the bug that vehicle survivor can spawn on wrong position when transport has been destroyed.
- Fixed the bug that building with `Explodes=yes` use Ares's rubble logic will cause it's owner cannot defeat normally.
- Fixed an issue that retaliation will make the unit keep switching among multiple targets with the same amount of threat.
- Fixed ares hook which stopped OpenTopped transports from firing if cloaked. This can now be customized.

## Newly added global settings

Expand Down
5 changes: 5 additions & 0 deletions docs/New-or-Enhanced-Logics.md
Original file line number Diff line number Diff line change
Expand Up @@ -1556,15 +1556,20 @@ DrainMoneyDisplay.OnTarget.UseDisplayIncome= ; boolean
- `OpenTopped.AllowFiringIfDeactivated` can be used to customize whether or not passengers can fire out when the transport is deactivated (EMP, powered unit etc).
- `OpenTopped.ShareTransportTarget` controls whether or not the current target of the transport itself is passed to the passengers as well.
- You can also customize range bonus and damage multiplier for passenger inside the transport with `OpenTransport.RangeBonus/DamageMultiplier`, which works independently from transport's `OpenTopped.RangeBonus/DamageMultiplier`.
- `OpenTopped.DecloakToFire` can customize if a transport has to uncloak to have passengers fireout if transport is also OpenTopped.

```ini
[General]
OpenTopped.DecloakToFire=true ; boolean

[SOMETECHNO] ; TechnoType, transport with OpenTopped=yes
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.ShareTransportTarget=true ; boolean
OpenTopped.DecloakToFire= ; boolean, defaults to [General] -> OpenTopped.DecloakToFire

[SOMETECHNO] ; TechnoType, passenger
OpenTransport.RangeBonus=0 ; integer
Expand Down
2 changes: 2 additions & 0 deletions docs/Whats-New.md
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,8 @@ Fixes / interactions with other extensions:
- Fixed the issue that technos cannot spawn survivors due to non-probabilistic reasons when the tech type was destroyed (by NetsuNegi)
- Fixed the bug that vehicle survivor can spawn on wrong position when transport has been destroyed (by NetsuNegi)
- Fixed the bug that building with `Explodes=yes` use Ares's rubble logic will cause it's owner cannot defeat normally (by NetsuNegi)
- Fixed ares hook which stopped OpenTopped transports from firing if cloaked. This can now be customized (by RAZER)
```

### 0.4.0.3
Expand Down
2 changes: 2 additions & 0 deletions src/Ext/Rules/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ 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->SortCameoByName.Read(exINI, GameStrings::General, "SortCameoByName");

Expand Down Expand Up @@ -656,6 +657,7 @@ void RulesExt::ExtData::Serialize(T& Stm)
.Process(this->IvanBombAttachToCenter)
.Process(this->FallingDownTargetingFix)
.Process(this->AIAirTargetingFix)
.Process(this->OpenTopped_DecloakToFire)
.Process(this->SortCameoByName)
.Process(this->MergeBuildingDamage)
.Process(this->BuildingRadioLink_SyncOwner)
Expand Down
2 changes: 2 additions & 0 deletions src/Ext/Rules/Body.h
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ class RulesExt

Valueable<bool> FallingDownTargetingFix;
Valueable<bool> AIAirTargetingFix;
Valueable<bool> OpenTopped_DecloakToFire;

Valueable<bool> SortCameoByName;

Expand Down Expand Up @@ -555,6 +556,7 @@ class RulesExt

, FallingDownTargetingFix { false }
, AIAirTargetingFix { false }
, OpenTopped_DecloakToFire { false }

, SortCameoByName { false }

Expand Down
39 changes: 39 additions & 0 deletions src/Ext/Techno/Hooks.Cloak.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "Body.h"
#include <Ext/Rules/Body.h>

namespace CloakTemp
{
Expand Down Expand Up @@ -174,3 +175,41 @@ DEFINE_HOOK(0x4579A5, BuildingClass_ShouldNotCloak_Sensors, 0x6)

return Continue;
}

// NOTE: Overrides incorrect Ares hook at the same address.
DEFINE_HOOK(0x6FCA26, TechnoClass_CanFire_RevertAresOpenTopCloakFix, 0x6)
{
enum { Skip = 0x6FCA4F, Continue = 0x6FCA36, NotApplicable = 0x6FCA5E };

GET(WeaponTypeClass*, pWeapon, EBX);

if (!pWeapon->DecloakToFire)
return NotApplicable;

GET(TechnoClass*, pThis, ESI);

if (pThis->InOpenToppedTransport && pThis->Transporter)
{
auto const pTransporterTypeExt = TechnoTypeExt::ExtMap.Find(pThis->Transporter->GetTechnoType());
if (pTransporterTypeExt->OpenTopped_DecloakToFire.Get(RulesExt::Global()->OpenTopped_DecloakToFire))
return NotApplicable;
}

R->EAX(pThis->CloakState);
return Continue;
}

DEFINE_HOOK(0x6FCD1D, TechnoClass_CanFire_OpenTopCloakFix, 0x5)
{
GET(TechnoClass*, pThis, ESI);
GET_STACK(bool, checkIfTargetInRange, STACK_OFFSET(0x20, 0xC));

if (checkIfTargetInRange && pThis->InOpenToppedTransport && pThis->Transporter)
{
auto const pTransporterTypeExt = TechnoTypeExt::ExtMap.Find(pThis->Transporter->GetTechnoType());
if (pTransporterTypeExt->OpenTopped_DecloakToFire.Get(RulesExt::Global()->OpenTopped_DecloakToFire))
pThis->Transporter->Uncloak(true);
}

return 0;
}
2 changes: 2 additions & 0 deletions src/Ext/TechnoType/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -858,6 +858,7 @@ void TechnoTypeExt::ExtData::LoadFromINIFile(CCINIClass* const pINI)
this->OpenTopped_ShareTransportTarget.Read(exINI, pSection, "OpenTopped.ShareTransportTarget");
this->OpenTopped_UseTransportRangeModifiers.Read(exINI, pSection, "OpenTopped.UseTransportRangeModifiers");
this->OpenTopped_CheckTransportDisableWeapons.Read(exINI, pSection, "OpenTopped.CheckTransportDisableWeapons");
this->OpenTopped_DecloakToFire.Read(exINI, pSection, "OpenTopped.DecloakToFire");
this->OpenTransport_RangeBonus.Read(exINI, pSection, "OpenTransport.RangeBonus");
this->OpenTransport_DamageMultiplier.Read(exINI, pSection, "OpenTransport.DamageMultiplier");

Expand Down Expand Up @@ -1564,6 +1565,7 @@ void TechnoTypeExt::ExtData::Serialize(T& Stm)
.Process(this->OpenTopped_ShareTransportTarget)
.Process(this->OpenTopped_UseTransportRangeModifiers)
.Process(this->OpenTopped_CheckTransportDisableWeapons)
.Process(this->OpenTopped_DecloakToFire)
.Process(this->OpenTransport_RangeBonus)
.Process(this->OpenTransport_DamageMultiplier)

Expand Down
2 changes: 2 additions & 0 deletions src/Ext/TechnoType/Body.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ class TechnoTypeExt
Valueable<bool> OpenTopped_ShareTransportTarget;
Valueable<bool> OpenTopped_UseTransportRangeModifiers;
Valueable<bool> OpenTopped_CheckTransportDisableWeapons;
Nullable<bool> OpenTopped_DecloakToFire;
Valueable<int> OpenTransport_RangeBonus;
Valueable<float> OpenTransport_DamageMultiplier;

Expand Down Expand Up @@ -580,6 +581,7 @@ class TechnoTypeExt
, OpenTopped_ShareTransportTarget { true }
, OpenTopped_UseTransportRangeModifiers { false }
, OpenTopped_CheckTransportDisableWeapons { false }
, OpenTopped_DecloakToFire {}
, OpenTransport_RangeBonus { 0 }
, OpenTransport_DamageMultiplier { 1.0 }

Expand Down