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 @@ -494,6 +494,7 @@ This page lists all the individual contributions to the project by their author.
- Damaged unit image changes
- `VoiceDeploy` through hot-key/command bar fix
- Damaged aircraft image changes
- Delayed fire additional initial animations count
- **ZivDero**:
- Re-enable the Veinhole Monster and Weeds from TS
- Recreate the weed-charging of SWs like the TS Chemical Missile
Expand Down
32 changes: 17 additions & 15 deletions docs/New-or-Enhanced-Logics.md
Original file line number Diff line number Diff line change
Expand Up @@ -2669,21 +2669,23 @@ Burst.NoDelay=false ; boolean
- If `DelayedFire.CenterAnimOnFirer` is set the animation is created at the firer's center rather than at the firing coordinates.
- If the weapon was fired by InfantryType and `DelayedFire.PauseFiringSequence` is set to true, the infantry's firing sequence animation is paused when it hits the firing frame defined by `FireUp/Prone` or `SecondaryFire/Prone` in its `artmd.ini` entry until the delay timer has expired.
- If the weapon has `Burst` > 1 and `DelayedFire.OnlyOnInitialBurst` set to true, the delay occurs only before the initial burst shot. Note that if using Ares, `Burst` index does not reset if firing is interrupted or the firer loses target, meaning it will be able to resume firing without waiting for the delay.

In `rulesmd.ini`:
```ini
[SOMEWEAPON] ; WeaponType
DelayedFire.Duration= ; integer - single or comma-sep. range (game frames)
DelayedFire.SkipInTransport=false ; boolean
DelayedFire.Animation= ; Animation
DelayedFire.OpenToppedAnimation= ; Animation
DelayedFire.AnimIsAttached=true ; boolean
DelayedFire.AnimOffset= ; integer - Forward,Lateral,Height
DelayedFire.AnimOnTurret=true ; boolean
DelayedFire.CenterAnimOnFirer=false ; boolean
DelayedFire.RemoveAnimOnNoDelay=false ; boolean
DelayedFire.PauseFiringSequence=false ; boolean
DelayedFire.OnlyOnInitialBurst=false ; boolean
- If the weapon has `DelayedFire.OnlyOnInitialBurst` set to true and `DelayedFire.InitialBurstAnimCount` set higher than 1, then there will be created additional `DelayedFire.Animation`-s at the same time as the first one.

In `rulesmd.ini`:
```ini
[SOMEWEAPON] ; WeaponType
DelayedFire.Duration= ; integer - single or comma-sep. range (game frames)
DelayedFire.SkipInTransport=false ; boolean
DelayedFire.Animation= ; Animation
DelayedFire.OpenToppedAnimation= ; Animation
DelayedFire.AnimIsAttached=true ; boolean
DelayedFire.AnimOffset= ; integer - Forward,Lateral,Height
DelayedFire.AnimOnTurret=true ; boolean
DelayedFire.CenterAnimOnFirer=false ; boolean
DelayedFire.RemoveAnimOnNoDelay=false ; boolean
DelayedFire.PauseFiringSequence=false ; boolean
DelayedFire.OnlyOnInitialBurst=false ; boolean
DelayedFire.InitialBurstAnimCount=1 ; integer
```

```{note}
Expand Down
1 change: 1 addition & 0 deletions docs/Whats-New.md
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,7 @@ New:
- [Customize if cloning need power](Fixed-or-Improved-Logics.md#customize-if-cloning-need-power) (by NetsuNegi)
- [Added Target Filtering Options to AttachEffect System](New-or-Enhanced-Logics.md#attached-effects) (by Flactine)
- [Customize type selection for IFV](Fixed-or-Improved-Logics.md#customize-type-selection-for-ifv) (by NetsuNegi)
- Delayed fire additional initial animations count

Vanilla fixes:
- Fixed sidebar not updating queued unit numbers when adding or removing units when the production is on hold (by CrimRecya)
Expand Down
19 changes: 19 additions & 0 deletions src/Ext/Techno/Body.Internal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,25 @@ CoordStruct TechnoExt::GetSimpleFLH(InfantryClass* pThis, int weaponIndex, bool&
return FLH;
}

CoordStruct TechnoExt::GetCompleteFLH(TechnoClass* pThis, int weaponIndex)
{
bool found = false;
auto FLH = TechnoExt::GetBurstFLH(pThis, weaponIndex, found);

if (!found)
{
if (auto const pInf = abstract_cast<InfantryClass*>(pThis))
FLH = TechnoExt::GetSimpleFLH(pInf, weaponIndex, found);

if (!found)
FLH = pThis->GetWeapon(weaponIndex)->FLH;

if (pThis->CurrentBurstIndex % 2 != 0)
FLH.Y = -FLH.Y;
}
return FLH;
}

void TechnoExt::ExtData::InitializeDisplayInfo()
{
const auto pThis = this->OwnerObject();
Expand Down
15 changes: 15 additions & 0 deletions src/Ext/Techno/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,21 @@ bool TechnoExt::HandleDelayedFireWithPauseSequence(TechnoClass* pThis, WeaponTyp

if (pWeaponExt->DelayedFire_AnimOffset.isset())
firingCoords = pWeaponExt->DelayedFire_AnimOffset;
else
firingCoords = TechnoExt::GetCompleteFLH(pThis, weaponIndex);

if(pWeaponExt->DelayedFire_InitialBurstAnimCount > 1 && pThis->CurrentBurstIndex == 0)
{
for (int i = 1; i < pWeaponExt->DelayedFire_InitialBurstAnimCount; i++)
{
TechnoExt::CreateDelayedFireAnim(pThis, pAnimType, weaponIndex, pWeaponExt->DelayedFire_AnimIsAttached, pWeaponExt->DelayedFire_CenterAnimOnFirer,
pWeaponExt->DelayedFire_RemoveAnimOnNoDelay, pWeaponExt->DelayedFire_AnimOnTurret, firingCoords);
pThis->CurrentBurstIndex = i;
firingCoords = TechnoExt::GetCompleteFLH(pThis, weaponIndex);
}

pThis->CurrentBurstIndex = 0;
}

TechnoExt::CreateDelayedFireAnim(pThis, pAnimType, weaponIndex, pWeaponExt->DelayedFire_AnimIsAttached, pWeaponExt->DelayedFire_CenterAnimOnFirer,
pWeaponExt->DelayedFire_RemoveAnimOnNoDelay, pWeaponExt->DelayedFire_AnimOnTurret, firingCoords);
Expand Down
1 change: 1 addition & 0 deletions src/Ext/Techno/Body.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ class TechnoExt

static CoordStruct GetBurstFLH(TechnoClass* pThis, int weaponIndex, bool& FLHFound);
static CoordStruct GetSimpleFLH(InfantryClass* pThis, int weaponIndex, bool& FLHFound);
static CoordStruct GetCompleteFLH(TechnoClass* pThis, int weaponIndex);

static void ChangeOwnerMissionFix(FootClass* pThis);
static void KillSelf(TechnoClass* pThis, AutoDeathBehavior deathOption, const std::vector<AnimTypeClass*>& pVanishAnimation, bool isInLimbo = false);
Expand Down
32 changes: 16 additions & 16 deletions src/Ext/Techno/Hooks.Firing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -572,18 +572,31 @@ DEFINE_HOOK(0x6FDDC0, TechnoClass_FireAt_BeforeTruelyFire, 0x6)
pExt->DelayedFireWeaponIndex = weaponIndex;
timer.Start(Math::max(GeneralUtils::GetRangedRandomOrSingleValue(pWeaponExt->DelayedFire_Duration), 0));
auto pAnimType = pWeaponExt->DelayedFire_Animation;

if (pThis->Transporter && pWeaponExt->DelayedFire_OpenToppedAnimation.isset())
pAnimType = pWeaponExt->DelayedFire_OpenToppedAnimation;

auto firingCoords = pThis->GetWeapon(weaponIndex)->FLH;

if (pWeaponExt->DelayedFire_AnimOffset.isset())
firingCoords = pWeaponExt->DelayedFire_AnimOffset;
else
firingCoords = TechnoExt::GetCompleteFLH(pThis, weaponIndex);

if(pWeaponExt->DelayedFire_InitialBurstAnimCount > 1 && pThis->CurrentBurstIndex == 0)
{
for (int i = 1; i < pWeaponExt->DelayedFire_InitialBurstAnimCount; i++)
{
TechnoExt::CreateDelayedFireAnim(pThis, pAnimType, weaponIndex, pWeaponExt->DelayedFire_AnimIsAttached, pWeaponExt->DelayedFire_CenterAnimOnFirer,
pWeaponExt->DelayedFire_RemoveAnimOnNoDelay, pWeaponExt->DelayedFire_AnimOnTurret, firingCoords);
pThis->CurrentBurstIndex = i;
firingCoords = TechnoExt::GetCompleteFLH(pThis, weaponIndex);
}

pThis->CurrentBurstIndex = 0;
}

TechnoExt::CreateDelayedFireAnim(pThis, pAnimType, weaponIndex, pWeaponExt->DelayedFire_AnimIsAttached, pWeaponExt->DelayedFire_CenterAnimOnFirer,
pWeaponExt->DelayedFire_RemoveAnimOnNoDelay, pWeaponExt->DelayedFire_AnimOnTurret, firingCoords);

return SkipFiring;
}
else
Expand Down Expand Up @@ -915,20 +928,7 @@ DEFINE_HOOK(0x6F3AEB, TechnoClass_GetFLH, 0x6)

if (weaponIndex >= 0)
{
bool found = false;
flh = TechnoExt::GetBurstFLH(pThis, weaponIndex, found);

if (!found)
{
if (auto const pInf = abstract_cast<InfantryClass*>(pThis))
flh = TechnoExt::GetSimpleFLH(pInf, weaponIndex, found);

if (!found)
flh = pThis->GetWeapon(weaponIndex)->FLH;

if (pThis->CurrentBurstIndex % 2 != 0)
flh.Y = -flh.Y;
}
flh = TechnoExt::GetCompleteFLH(pThis, weaponIndex);
}
else
{
Expand Down
2 changes: 2 additions & 0 deletions src/Ext/WeaponType/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ void WeaponTypeExt::ExtData::LoadFromINIFile(CCINIClass* const pINI)
this->DelayedFire_RemoveAnimOnNoDelay.Read(exINI, pSection, "DelayedFire.RemoveAnimOnNoDelay");
this->DelayedFire_PauseFiringSequence.Read(exINI, pSection, "DelayedFire.PauseFiringSequence");
this->DelayedFire_OnlyOnInitialBurst.Read(exINI, pSection, "DelayedFire.OnlyOnInitialBurst");
this->DelayedFire_InitialBurstAnimCount.Read(exINI, pSection, "DelayedFire.InitialBurstAnimCount");
this->DelayedFire_AnimOffset.Read(exINI, pSection, "DelayedFire.AnimOffset");
this->DelayedFire_AnimOnTurret.Read(exINI, pSection, "DelayedFire.AnimOnTurret");

Expand Down Expand Up @@ -235,6 +236,7 @@ void WeaponTypeExt::ExtData::Serialize(T& Stm)
.Process(this->DelayedFire_RemoveAnimOnNoDelay)
.Process(this->DelayedFire_PauseFiringSequence)
.Process(this->DelayedFire_OnlyOnInitialBurst)
.Process(this->DelayedFire_InitialBurstAnimCount)
.Process(this->DelayedFire_AnimOffset)
.Process(this->DelayedFire_AnimOnTurret)
;
Expand Down
2 changes: 2 additions & 0 deletions src/Ext/WeaponType/Body.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ class WeaponTypeExt
Valueable<bool> DelayedFire_RemoveAnimOnNoDelay;
Valueable<bool> DelayedFire_PauseFiringSequence;
Valueable<bool> DelayedFire_OnlyOnInitialBurst;
Valueable<int> DelayedFire_InitialBurstAnimCount;
Nullable<CoordStruct> DelayedFire_AnimOffset;
Valueable<bool> DelayedFire_AnimOnTurret;

Expand Down Expand Up @@ -162,6 +163,7 @@ class WeaponTypeExt
, DelayedFire_RemoveAnimOnNoDelay { false }
, DelayedFire_PauseFiringSequence { false }
, DelayedFire_OnlyOnInitialBurst { false }
, DelayedFire_InitialBurstAnimCount { 1 }
, DelayedFire_AnimOffset {}
, DelayedFire_AnimOnTurret { true }
{ }
Expand Down