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 @@ -452,6 +452,7 @@ This page lists all the individual contributions to the project by their author.
- Fix the bug that armor multiplier of new attacheffect will have extra take effect once if restricted warheads
- Fix the bug that techno unit will draw with ironcurtain and airstrike color and intensity who disguised as terrain or overlay
- Iron Curtain/Custom Tint Support for SHP Turreted Vehicles
- Allow setting whether AlternateFLH applies to vehicle passengers in the transport unit
- **Apollo** - Translucent SHP drawing patches
- **ststl**:
- Customizable `ShowTimer` priority of superweapons
Expand Down
8 changes: 5 additions & 3 deletions docs/Fixed-or-Improved-Logics.md
Original file line number Diff line number Diff line change
Expand Up @@ -961,12 +961,14 @@ AirstrikeTargets=buildings ; List of Affected Target Enumeration (none|infantry

### Alternate FLH customizations

- `AlternateFLH.OnTurret` can be used to customize whether or not `AlternateFLHN` used for `OpenTopped` transport firing coordinates, multiple mind control link offsets etc. is calculated relative to the unit's turret if available or body.
- `AlternateFLH.OnTurret` can be used to customize whether or not `AlternateFLH` used for `OpenTopped` transport firing coordinates, multiple mind control link offsets etc. is calculated relative to the unit's turret if available or body.
- `AlternateFLH.ApplyVehicle` can be used to customize whether or not a transport applies its `AlternateFLH` to passengers of the VehicleType, who by default use their own FLH, as opposed to passengers of the InfantryType who adhere to `AlternateFLH`.

In `artmd.ini`:
```ini
[SOMETECHNO] ; TechnoType
AlternateFLH.OnTurret=true ; boolean
[SOMETECHNO] ; TechnoType
AlternateFLH.OnTurret=true ; boolean
AlternateFLH.ApplyVehicle=false ; boolean
```

### Building-provided self-healing customization
Expand Down
3 changes: 2 additions & 1 deletion docs/Whats-New.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ You can use the migration utility (can be found on [Phobos supplementaries repo]

#### From post-0.3 devbuilds

- `AlternateFLH` no longer affects vehicle passengers by default. To re-enable it, set `AlternateFLH.ApplyVehicle=true` on the transport unit.
- `UseCenterCoordsWhenAttached` has been replaced by enumeration key `AttachedAnimPosition`. Set `AttachedAnimPosition=center` to replicate effects of `UseCenterCoordsWhenAttached=true`.
- Parsing priority of `ShowBriefing` and `BriefingTheme` between map file and `missionmd.ini` has been switched (from latter taking priority over former to vice-versa) due to technical limitations and compatibility issues with spawner DLL.
- Game will now produce fatal error with an error message if any of the files listed in `[$Include]` in any INI file do not exist.
Expand Down Expand Up @@ -687,7 +688,7 @@ New:

Vanilla fixes:
- Allow AI to repair structures built from base nodes/trigger action 125/SW delivery in single player missions (by Trsdy)
- Allow usage of `AlternateFLH%d` of vehicles in `OpenTopped` transport. (by Trsdy)
- Allow setting whether `AlternateFLH` applies to vehicle passengers in the transport unit (by Trsdy & NetsuNegi)
- Improved the statistic distribution of the spawned crates over the visible area of the map. (by Trsdy, based on TwinkleStar's work)
- Teams spawned by trigger action 7,80,107 can use IFV and `OpenTopped` logic normally (by Trsdy)
- Prevented units from retaining previous order after ownership change (by Trsdy)
Expand Down
39 changes: 34 additions & 5 deletions src/Ext/Techno/Hooks.Firing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -824,11 +824,40 @@ DEFINE_HOOK(0x6FF29E, TechnoClass_FireAt_ChargeTurret2, 0x6)
#pragma endregion

#pragma region TechnoClass_GetFLH
// Feature: Allow Units using AlternateFLHs - by Trsdy
// I don't want to rewrite something new, so I use the Infantry one directly
// afaik it has no check for infantry-specific stuff here so far
// and neither Ares nor Phobos has touched it, even that crawling flh one was in TechnoClass
DEFINE_JUMP(VTABLE, 0x7F5D20, 0x523250);// Redirect UnitClass::GetFLH to InfantryClass::GetFLH (used to be TechnoClass::GetFLH)

namespace GetFLHTemp
{
class UnitClassFake final : public UnitClass
{
CoordStruct* _GetFLH(CoordStruct* outBuffer, int weaponIdx, CoordStruct offset);
};
}

CoordStruct* GetFLHTemp::UnitClassFake::_GetFLH(CoordStruct* outBuffer, int weaponIdx, CoordStruct offset)
{
const auto pThis = static_cast<UnitClass*>(this);

do
{
const auto pTransporter = pThis->Transporter;

if (pThis->InOpenToppedTransport && pTransporter && TechnoTypeExt::ExtMap.Find(pTransporter->GetTechnoType())->AlternateFLH_ApplyVehicle)
{
if (const int idx = pTransporter->Passengers.IndexOf(pThis))
{
*outBuffer = pTransporter->GetFLH(-idx, CoordStruct::Empty);
break;
}
}

auto TechnoClass_GetFLH = reinterpret_cast<CoordStruct*(__thiscall*)(TechnoClass*, CoordStruct*, int, CoordStruct)>(0x6F3AD0);
TechnoClass_GetFLH(pThis, outBuffer, weaponIdx, CoordStruct::Empty);
}
while (false);

return outBuffer;
}
DEFINE_FUNCTION_JUMP(VTABLE, 0x7F5D20, GetFLHTemp::UnitClassFake::_GetFLH)

// Apr 4, 2025 - Starkku: Consolidated all the FLH hooks into single one & using TechnoExt::GetFLHAbsoluteCoord() to get the actual coordinate.
DEFINE_HOOK(0x6F3AEB, TechnoClass_GetFLH, 0x6)
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 @@ -1165,6 +1165,7 @@ void TechnoTypeExt::ExtData::LoadFromINIFile(CCINIClass* const pINI)
this->DeployedPrimaryFireFLH.Read(exArtINI, pArtSection, "DeployedPrimaryFireFLH");
this->DeployedSecondaryFireFLH.Read(exArtINI, pArtSection, "DeployedSecondaryFireFLH");
this->AlternateFLH_OnTurret.Read(exArtINI, pArtSection, "AlternateFLH.OnTurret");
this->AlternateFLH_ApplyVehicle.Read(exArtINI, pArtSection, "AlternateFLH.ApplyVehicle");

for (size_t i = 0; ; i++)
{
Expand Down Expand Up @@ -1384,6 +1385,7 @@ void TechnoTypeExt::ExtData::Serialize(T& Stm)
.Process(this->EliteWeaponBurstFLHs)
.Process(this->AlternateFLHs)
.Process(this->AlternateFLH_OnTurret)
.Process(this->AlternateFLH_ApplyVehicle)

.Process(this->OpenTopped_RangeBonus)
.Process(this->OpenTopped_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 @@ -140,6 +140,7 @@ class TechnoTypeExt
std::vector<std::vector<CoordStruct>> EliteWeaponBurstFLHs;
std::vector<CoordStruct> AlternateFLHs;
Valueable<bool> AlternateFLH_OnTurret;
Valueable<bool> AlternateFLH_ApplyVehicle;

Valueable<bool> DestroyAnim_Random;
Valueable<bool> NotHuman_RandomDeathSequence;
Expand Down Expand Up @@ -501,6 +502,7 @@ class TechnoTypeExt
, OreGathering_FramesPerDir {}
, LaserTrailData {}
, AlternateFLH_OnTurret { true }
, AlternateFLH_ApplyVehicle { false }
, DestroyAnim_Random { true }
, NotHuman_RandomDeathSequence { false }

Expand Down