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
1 change: 1 addition & 0 deletions CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@ This page lists all the individual contributions to the project by their author.
- Fix an issue where `OmniFire` was ineffective on buildings with `Turret=yes`
- Fix an issue where setting a production building as `Primary` could cause it to enter an unload state
- SkipMapSelect Enhancement
- Ares' `KeepAlive` adds global tags
- **NetsuNegi**:
- Forbidding parallel AI queues by type
- Jumpjet crash speed fix when crashing onto building
Expand Down
7 changes: 6 additions & 1 deletion docs/Fixed-or-Improved-Logics.md
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ This page describes all ingame logics that are fixed or improved in Phobos witho
- `ProjectileRange` now has weapon range modifiers applied to it if greater than 0 and unless `ProjectileRange.ApplyModifiers` is set to false on the WeaponType.
- Allowed customizing the default value of `[Warhead] -> PreventScatter` via `[CombatDamage] -> Warhead.PreventScatter`.
- Allowed `SW.ShowCameo` and `SW.ManualFire` to work independently of `SW.AutoFire`.
- Ares' `KeepAlive` adds global tags.

## Newly added global settings

Expand Down Expand Up @@ -540,7 +541,11 @@ Unless otherwise specified, after removing the last dot and everything before it
In `rulesmd.ini`:
```ini
[General]
DefaultToGuardArea=false ; boolean
DefaultToGuardArea=false ; boolean
KeepAlive.SupportInfantrys=false ; boolean
KeepAlive.SupportVehicles=false ; boolean
KeepAlive.SupportAircrafts=false ; boolean
KeepAlive.SupportBuildings=true ; boolean

[CombatDamage]
Warhead.PreventScatter=false ; boolean
Expand Down
1 change: 1 addition & 0 deletions docs/Whats-New.md
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@ HideShakeEffects=false ; boolean

#### Fixes / interactions with other extensions:
- Allowed `SW.ShowCameo` and `SW.ManualFire` to work independently of `SW.AutoFire` (by Noble_Fish)
- Ares' `KeepAlive` adds global tags (by FlyStar)

```

Expand Down
9 changes: 9 additions & 0 deletions src/Ext/Rules/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,11 @@ void RulesExt::ExtData::LoadBeforeTypeData(RulesClass* pThis, CCINIClass* pINI)
this->ReadyToNextMission_MovingCheck.Read(exINI, GameStrings::General, "ReadyToNextMission.MovingCheck");

this->Warhead_PreventScatter.Read(exINI, GameStrings::CombatDamage, "Warhead.PreventScatter");

this->KeepAlive_SupportInfantrys.Read(exINI, GameStrings::General, "KeepAlive.SupportInfantrys");
this->KeepAlive_SupportVehicles.Read(exINI, GameStrings::General, "KeepAlive.SupportVehicles");
this->KeepAlive_SupportAircrafts.Read(exINI, GameStrings::General, "KeepAlive.SupportAircrafts");
this->KeepAlive_SupportBuildings.Read(exINI, GameStrings::General, "KeepAlive.SupportBuildings");

this->ProjectileRange_ApplyModifiers.Read(exINI, GameStrings::CombatDamage, "ProjectileRange.ApplyModifiers");

Expand Down Expand Up @@ -1090,6 +1095,10 @@ void RulesExt::ExtData::Serialize(T& Stm)
.Process(this->ReadyToNextMission_MovingCheck)
.Process(this->Warhead_PreventScatter)
.Process(this->ProjectileRange_ApplyModifiers)
.Process(this->KeepAlive_SupportInfantrys)
.Process(this->KeepAlive_SupportVehicles)
.Process(this->KeepAlive_SupportAircrafts)
.Process(this->KeepAlive_SupportBuildings)
;
}

Expand Down
10 changes: 10 additions & 0 deletions src/Ext/Rules/Body.h
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,11 @@ class RulesExt
Valueable<bool> NoAlphaImageOnBuildup;

Valueable<bool> Warhead_PreventScatter;

Valueable<bool> KeepAlive_SupportInfantrys;
Valueable<bool> KeepAlive_SupportVehicles;
Valueable<bool> KeepAlive_SupportAircrafts;
Valueable<bool> KeepAlive_SupportBuildings;

Valueable<bool> ProjectileRange_ApplyModifiers;

Expand Down Expand Up @@ -1009,6 +1014,11 @@ class RulesExt
, Warhead_PreventScatter { false }

, ProjectileRange_ApplyModifiers { true }

, KeepAlive_SupportInfantrys { false }
, KeepAlive_SupportVehicles { false }
, KeepAlive_SupportAircrafts { false }
, KeepAlive_SupportBuildings { true }
{ }

virtual ~ExtData() = default;
Expand Down
2 changes: 2 additions & 0 deletions src/Ext/TechnoType/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1206,6 +1206,7 @@ void TechnoTypeExt::LoadFromINIFile(CCINIClass* const pINI)

// Ares 3.0
this->Unsellable.Read(exINI, pSection, "Unsellable");
this->KeepAlive.Read(exINI, pSection, "KeepAlive");

if (pThis->Gunner)
{
Expand Down Expand Up @@ -1804,6 +1805,7 @@ void TechnoTypeExt::Serialize(T& Stm)
.Process(this->JumpjetClimbIgnoreBuilding)

.Process(this->Unsellable)
.Process(this->KeepAlive)

.Process(this->ExtraThreat_Enabled)
.Process(this->ExtraThreat_IsThreat)
Expand Down
4 changes: 3 additions & 1 deletion src/Ext/TechnoType/Body.h
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,8 @@ class TechnoTypeExt : public ObjectTypeExt
Valueable<double> Convert_Health_BelowPercent;
Nullable<TechnoTypeClass*> Convert_Health;

Nullable<bool> Unsellable; // Ares 3.0
Nullable<bool> Unsellable; // Ares 3.0
Nullable<bool> KeepAlive; // Ares 3.0

TechnoTypeExt(TechnoTypeClass* OwnerObject) : ObjectTypeExt(OwnerObject)
, HealthBar_Hide { false }
Expand Down Expand Up @@ -814,6 +815,7 @@ class TechnoTypeExt : public ObjectTypeExt
, JumpjetClimbIgnoreBuilding {}

, Unsellable {}
, KeepAlive {}

, ExtraThreat_Enabled { false }
, ExtraThreat_IsThreat {}
Expand Down
60 changes: 60 additions & 0 deletions src/Misc/Hooks.Ares.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,60 @@ static bool __fastcall ParadropPlaneUnlimbo(AircraftClass* pThis, void* _, const

#pragma endregion

#pragma region AresKeepAlive

struct AresHouseExt
{
char _[0x18];
int KeepAliveTechnos;
int KeepAliveBuildings;
};

static bool __fastcall AresHouseExt_UpdateKeepAlive(AresHouseExt* pExt_Ares, void*, TechnoClass* const pTechno, const AbstractType rtti, const bool add)
{
bool keepAlive = false;
bool result = false;
auto const pType = pTechno->GetTechnoType();

if (!pType->Insignificant && !pType->DontScore)
{
switch (rtti)
{
case AbstractType::Infantry:
keepAlive = RulesExt::Global()->KeepAlive_SupportInfantrys;
break;
case AbstractType::Unit:
keepAlive = RulesExt::Global()->KeepAlive_SupportVehicles;
break;
case AbstractType::Aircraft:
keepAlive = RulesExt::Global()->KeepAlive_SupportAircrafts;
break;
case AbstractType::Building:
keepAlive = RulesExt::Global()->KeepAlive_SupportBuildings;
break;
default:
break;
}

result = true;
}

auto const pTypeExt = TechnoTypeExt::Fetch(pType);

if (pTypeExt->KeepAlive.Get(keepAlive))
{
const int number = add ? 1 : -1;
pExt_Ares->KeepAliveTechnos += number;

if (rtti == AbstractType::Building)
pExt_Ares->KeepAliveBuildings += number;
}

return result;
}

#pragma endregion

DEFINE_HOOK(0x440580, BuildingClass_Unlimbo_UnitDeliveryFix, 0x5)
{
if (UnitDeliveryTemp::Placing)
Expand Down Expand Up @@ -312,6 +366,9 @@ void Apply_Ares3_0_Patches()
Patch::Apply_LJMP(AresHelper::AresBaseAddress + 0x39635, AresHelper::AresBaseAddress + 0x39664);
// Decouple SW.ManualFire from SW.AutoFire - Ares' SidebarClass_ProcessCameoClick_SuperWeapons
Patch::Apply_LJMP(AresHelper::AresBaseAddress + 0x34DD0, AresHelper::AresBaseAddress + 0x34DD9);

// Ares' `KeepAlive` adds global tags.
Patch::Apply_LJMP(AresHelper::AresBaseAddress + 0x21F70, GET_OFFSET(AresHouseExt_UpdateKeepAlive));
}

void Apply_Ares3_0p1_Patches()
Expand Down Expand Up @@ -430,4 +487,7 @@ void Apply_Ares3_0p1_Patches()
Patch::Apply_LJMP(AresHelper::AresBaseAddress + 0x3A0B5, AresHelper::AresBaseAddress + 0x3A0E4);
// Decouple SW.ManualFire from SW.AutoFire - Ares' SidebarClass_ProcessCameoClick_SuperWeapons
Patch::Apply_LJMP(AresHelper::AresBaseAddress + 0x35810, AresHelper::AresBaseAddress + 0x35819);

// Ares' `KeepAlive` adds global tags.
Patch::Apply_LJMP(AresHelper::AresBaseAddress + 0x229F0, GET_OFFSET(AresHouseExt_UpdateKeepAlive));
}
Loading