Skip to content
Merged
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 @@ -739,6 +739,7 @@ This page lists all the individual contributions to the project by their author.
- Remove the restriction that prohibits InfantryTypes from using the InitialPayload logic
- Add `ammo`, `health`, `mission`, `landtype` and `sequence` conditions to `DiscardOn`
- Disable AlphaImage during Buildup
- Allow customizing the default value of `[Warhead] -> PreventScatter` via `[CombatDamage] -> Warhead.PreventScatter`
- **Ollerus**:
- Build limit group enhancement
- Customizable rocker amplitude
Expand Down
16 changes: 10 additions & 6 deletions docs/Fixed-or-Improved-Logics.md
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,7 @@ This page describes all ingame logics that are fixed or improved in Phobos witho
- Fixed the issue of Ares' EMP not suspending the production of AI factories.
- Removed the restriction that prohibits InfantryTypes from using the InitialPayload logic.
- `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`.

## Newly added global settings

Expand Down Expand Up @@ -525,22 +526,25 @@ In `rulesmd.ini`:
AdjacentWallDamage=200 ; integer
```

### Customize the global default values of some vanilla flags
### Customize the global default values of some vanilla/Ares flags

- The following flags supplement definitions for flags that do not have global default values in vanilla.
- The following flags supplement definitions for flags that do not have global default values in vanilla/Ares.

```{hint}
Unless otherwise specified, the definition is the same as the name of the micro-level definition flag.
Unless otherwise specified, after removing the last dot and everything before it, the definition is the same as the name of the micro-level definition flag.
```

In `rulesmd.ini`:
```ini
[General]
DefaultToGuardArea=false ; boolean
DefaultToGuardArea=false ; boolean

[CombatDamage]
Warhead.PreventScatter=false ; boolean

[AudioVisual]
LeptonMindControlOffset=70 ; integer, in leptons
MindControlRingOffset=140 ; integer, in leptons
LeptonMindControlOffset=70 ; integer, in leptons
MindControlRingOffset=140 ; integer, in leptons
```

### Customizing effect of level lighting on air units
Expand Down
1 change: 1 addition & 0 deletions docs/Whats-New.md
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,7 @@ HideShakeEffects=false ; boolean
- [Customize whether warhead can prevent crew escape from techno](New-or-Enhanced-Logics.md#customize-whether-warhead-can-prevent-crew-escape-from-techno) (by NetsuNegi)
- [Disable AlphaImage during Buildup](Fixed-or-Improved-Logics.md#disable-alphaimage-during-buildup) (by Noble_Fish)
- [Reload speed adjustment on promotion](New-or-Enhanced-Logics.md#reload-speed-adjustment-on-promotion) (by Nuke)
- Allowed customizing the default value of `[Warhead] -> PreventScatter` via `[CombatDamage] -> Warhead.PreventScatter` (by Noble_Fish)

#### Vanilla fixes:
- Fixed sidebar not updating queued unit numbers when adding or removing units when the production is on hold (by CrimRecya)
Expand Down
12 changes: 6 additions & 6 deletions docs/locale/zh_CN/LC_MESSAGES/Fixed-or-Improved-Logics.po
Original file line number Diff line number Diff line change
Expand Up @@ -2168,18 +2168,18 @@ msgstr ""
msgid "Now you can customize that damage by using the following flag."
msgstr "现在你可以使用下面的标签自定义这个杀伤值。"

msgid "Customize the global default values of some vanilla flags"
msgstr "自定义部分原版语句的全局默认值"
msgid "Customize the global default values of some vanilla/Ares flags"
msgstr "自定义部分原版/Ares 语句的全局默认值"

msgid ""
"The following flags supplement definitions for flags that do not have "
"global default values in vanilla."
msgstr "以下语句为原版中没有全局默认值的语句补充了默认值定义。"
"global default values in vanilla/Ares."
msgstr "以下语句为原版/Ares 中没有全局默认值的语句补充了默认值定义。"

msgid ""
"Unless otherwise specified, the definition is the same as the name of the"
"Unless otherwise specified, after removing the last dot and everything before it, the definition is the same as the name of the"
" micro-level definition flag."
msgstr "除非特别说明,默认与微观定义语句名称相同。"
msgstr "除非特别说明,去掉最后一个 `.` 及之前的内容后,默认与微观定义语句名称相同。"

msgid "Customizing effect of level lighting on air units"
msgstr "自定义光照等级对空中单位的影响"
Expand Down
3 changes: 3 additions & 0 deletions src/Ext/Rules/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,8 @@ void RulesExt::ExtData::LoadBeforeTypeData(RulesClass* pThis, CCINIClass* pINI)
this->NoAlphaImageOnBuildup.Read(exINI, GameStrings::AudioVisual, "NoAlphaImageOnBuildup");
this->ReadyToNextMission_MovingCheck.Read(exINI, GameStrings::General, "ReadyToNextMission.MovingCheck");

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

// Section AITargetTypes
int itemsCount = pINI->GetKeyCount("AITargetTypes");
for (int i = 0; i < itemsCount; ++i)
Expand Down Expand Up @@ -1084,6 +1086,7 @@ void RulesExt::ExtData::Serialize(T& Stm)
.Process(this->ApproachTarget_StopWhenInRange)
.Process(this->NoAlphaImageOnBuildup)
.Process(this->ReadyToNextMission_MovingCheck)
.Process(this->Warhead_PreventScatter)
;
}

Expand Down
3 changes: 3 additions & 0 deletions src/Ext/Rules/Body.h
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,8 @@ class RulesExt

Valueable<bool> NoAlphaImageOnBuildup;

Valueable<bool> Warhead_PreventScatter;

ExtData(RulesClass* OwnerObject) : Extension<RulesClass>(OwnerObject)
, Storage_TiberiumIndex { -1 }
, HarvesterDumpAmount { 0.0f }
Expand Down Expand Up @@ -1000,6 +1002,7 @@ class RulesExt

, NoAlphaImageOnBuildup { false }
, ReadyToNextMission_MovingCheck { false }
, Warhead_PreventScatter { false }
{ }

virtual ~ExtData() = default;
Expand Down
2 changes: 2 additions & 0 deletions src/Ext/WarheadType/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,7 @@ void WarheadTypeExt::LoadFromINIFile(CCINIClass* const pINI)
this->Malicious.Read(exINI, pSection, "Malicious");
this->Flash_Duration.Read(exINI, pSection, "Flash.Duration");
this->Damage_Deployed.Read(exINI, pSection, "Damage.Deployed");
this->PreventScatter.Read(exINI, pSection, "PreventScatter");

// List all Warheads here that respect CellSpread
// Used in WarheadTypeExt::Detonate
Expand Down Expand Up @@ -808,6 +809,7 @@ void WarheadTypeExt::Serialize(T& Stm)
.Process(this->Malicious)
.Process(this->Flash_Duration)
.Process(this->Damage_Deployed)
.Process(this->PreventScatter)

.Process(this->WasDetonatedOnAllMapObjects)
.Process(this->RemainingAnimCreationInterval)
Expand Down
2 changes: 2 additions & 0 deletions src/Ext/WarheadType/Body.h
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ class WarheadTypeExt final : public AbstractTypeExt
Valueable<bool> Malicious;
Nullable<int> Flash_Duration;
Valueable<double> Damage_Deployed;
Nullable<bool> PreventScatter;

double Crit_RandomBuffer;
double Crit_CurrentChance;
Expand Down Expand Up @@ -514,6 +515,7 @@ class WarheadTypeExt final : public AbstractTypeExt
, Malicious { true }
, Flash_Duration {}
, Damage_Deployed { 1.0 }
, PreventScatter {}

, Crit_RandomBuffer { 0.0 }
, Crit_CurrentChance { 0.0 }
Expand Down
17 changes: 17 additions & 0 deletions src/Misc/Hooks.Ares.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@

#include <Ext/Aircraft/Body.h>
#include <Ext/Building/Body.h>
#include <Ext/WarheadType/Body.h>
#include <Ext/Sidebar/Body.h>
#include <Ext/EBolt/Body.h>
#include <Ext/SWType/Body.h>
#include <Ext/CaptureManager/Body.h>
#include <Ext/Scenario/Body.h>
#include <Ext/Rules/Body.h>

#include <New/Entity/Ares/RadarJammerClass.h>

Expand Down Expand Up @@ -185,6 +187,17 @@ DEFINE_HOOK(0x440580, BuildingClass_Unlimbo_UnitDeliveryFix, 0x5)

_GET_FUNCTION_ADDRESS(RadarJammerClass::Update, AresRadarJammerClass_Update_GetAddr)

static DWORD _cdecl AresPreventScatter_Override(REGISTERS* R)
{
GET(FootClass* const, pThis, ESI);
GET_STACK(WarheadTypeClass*, pWarhead, 0xD0);

if (!WarheadTypeExt::Fetch(pWarhead)->PreventScatter.Get(RulesExt::Global()->Warhead_PreventScatter))
pThis->Scatter(CoordStruct::Empty, true, false);

return 0x702D11;
}

void Apply_Ares3_0_Patches()
{
// Abductor fix:
Expand Down Expand Up @@ -292,6 +305,8 @@ void Apply_Ares3_0_Patches()
Patch::Apply_CALL(AresHelper::AresBaseAddress + 0x13FA7, &BuildingExt::UpdateFactoryQueues);
Patch::Apply_CALL(AresHelper::AresBaseAddress + 0x4CD9E, &BuildingExt::UpdateFactoryQueues);
Patch::Apply_CALL(AresHelper::AresBaseAddress + 0x4CE84, &BuildingExt::UpdateFactoryQueues);

Patch::Apply_LJMP(AresHelper::AresBaseAddress + 0x4ADE0, GET_OFFSET(AresPreventScatter_Override));
}

void Apply_Ares3_0p1_Patches()
Expand Down Expand Up @@ -403,4 +418,6 @@ void Apply_Ares3_0p1_Patches()
Patch::Apply_CALL(AresHelper::AresBaseAddress + 0x14537, &BuildingExt::UpdateFactoryQueues);
Patch::Apply_CALL(AresHelper::AresBaseAddress + 0x4DA0E, &BuildingExt::UpdateFactoryQueues);
Patch::Apply_CALL(AresHelper::AresBaseAddress + 0x4DAF4, &BuildingExt::UpdateFactoryQueues);

Patch::Apply_LJMP(AresHelper::AresBaseAddress + 0x4BA40, GET_OFFSET(AresPreventScatter_Override));
}
Loading