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 @@ -685,6 +685,7 @@ This page lists all the individual contributions to the project by their author.
- Allow customizing whether the creation of shrapnel weapon is controlled by the new target check on the warhead of the parent weapon
- Customize `Tiled` drawing interval and centering
- Customize whether technos with `Locomotor=Fly` wobble
- Customize the landing animation of technos that have `Locomotor=Fly`
- **Ollerus**:
- Build limit group enhancement
- Customizable rocker amplitude
Expand Down
15 changes: 15 additions & 0 deletions docs/Fixed-or-Improved-Logics.md
Original file line number Diff line number Diff line change
Expand Up @@ -1749,6 +1749,21 @@ FallingDownDamage.Water= ; integer / percentage
FallingDownDamage.AllowEMP=true ; boolean
```

### Customize the landing animation of technos that have `Locomotor=Fly`

- In vanilla, if a techno has `Locomotor=Fly` and `IsDropship=true`, it plays the `[DROPLAND]` animation when landing; if `IsDropship=false` but it is an aircraft with `Carryall=true`, it will play the `[CARYLAND]` animation when landing. Now you can customize this logic.

In `rulesmd.ini`:
```ini
[AudioVisual]
DefaultLandingAnim= ; AnimationType
DefaultLandingAnim.Dropship=DROPLAND ; AnimationType
DefaultLandingAnim.Carryall=CARYLAND ; AnimationType

[SOMETECHNO] ; TechnoType
LandingAnim= ; AnimationType, defaults to the global default (none, DROPLAND, or CARYLAND) based on unit's IsDropship/Carryall flags
```

### Customize whether technos with `Locomotor=Fly` wobble

- In vanilla, if technos use `Locomotor=Fly` and do not have `IsDropship=true`, they will have a hardcoded wobble effect. However, using `IsDropship=true` also introduces a series of hardcoded behaviors associated with it. Now, you can customize whether to disable this behavior, and it can also be used to enable this behavior for technos with `IsDropship=true`.
Expand Down
1 change: 1 addition & 0 deletions docs/Whats-New.md
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,7 @@ HideShakeEffects=false ; boolean
- [Animation transparency customization settings](New-or-Enhanced-Logics.md#customizable-animation-transparency-settings) (by Starkku)
- [Customize `Tiled` drawing interval and centering](Fixed-or-Improved-Logics.md#customize-the-drawing-interval-for-tiled) (by Noble_Fish)
- [Customize whether technos with `Locomotor=Fly` wobble](Fixed-or-Improved-Logics.md#customize-whether-technos-with-locomotor-fly-wobble) (by Noble_Fish)
- [Customize the landing animation of technos that have `Locomotor=Fly`](Fixed-or-Improved-Logics.md#customize-the-landing-animation-of-technos-that-have-locomotor-fly) (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
7 changes: 7 additions & 0 deletions src/Ext/Rules/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,10 @@ void RulesExt::ExtData::LoadBeforeTypeData(RulesClass* pThis, CCINIClass* pINI)

this->FlyNoWobbles.Read(exINI, GameStrings::AudioVisual, "FlyNoWobbles");

this->DefaultLandingAnim.Read(exINI, GameStrings::AudioVisual, "DefaultLandingAnim");
this->DefaultLandingAnim_Dropship.Read(exINI, GameStrings::AudioVisual, "DefaultLandingAnim.Dropship");
this->DefaultLandingAnim_Carryall.Read(exINI, GameStrings::AudioVisual, "DefaultLandingAnim.Carryall");

this->TeamDelays_DynamicType.Read(exINI, GameStrings::General, "TeamDelays.DynamicType");

char tempBuffer[40];
Expand Down Expand Up @@ -775,6 +779,9 @@ void RulesExt::ExtData::Serialize(T& Stm)
.Process(this->RemoveMindControl_Silent)
.Process(this->MindControl_Permanent_ReplaceSilent)
.Process(this->FlyNoWobbles)
.Process(this->DefaultLandingAnim)
.Process(this->DefaultLandingAnim_Dropship)
.Process(this->DefaultLandingAnim_Carryall)
.Process(this->TeamDelays_DynamicType)
.Process(this->TeamDelays_Count)
;
Expand Down
8 changes: 8 additions & 0 deletions src/Ext/Rules/Body.h
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,10 @@ class RulesExt
Valueable<bool> MindControl_Permanent_ReplaceSilent;
Nullable<bool> FlyNoWobbles;

Valueable<AnimTypeClass*> DefaultLandingAnim;
Nullable<AnimTypeClass*> DefaultLandingAnim_Dropship;
Nullable<AnimTypeClass*> DefaultLandingAnim_Carryall;

Valueable<DynamicTeamDelayType> TeamDelays_DynamicType;
Valueable<Vector3D<int>> TeamDelays_Count[8];

Expand Down Expand Up @@ -672,6 +676,10 @@ class RulesExt

, FlyNoWobbles {}

, DefaultLandingAnim { nullptr }
, DefaultLandingAnim_Dropship {}
, DefaultLandingAnim_Carryall {}

, TeamDelays_DynamicType { DynamicTeamDelayType::StartingPoint }
, TeamDelays_Count {}
{ }
Expand Down
52 changes: 52 additions & 0 deletions src/Ext/Techno/Hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2065,6 +2065,58 @@ DEFINE_HOOK(0x70AFEF, TechnoClass_UpdateSight_DynamicSight2, 0x6)

#pragma endregion

static AnimTypeClass* GetLandingAnim(TechnoClass* pTechno)
{
auto const pType = pTechno->GetTechnoType();
auto const pTypeExt = TechnoTypeExt::ExtMap.Find(pType);

if (pTypeExt->LandingAnim.isset())
return pTypeExt->LandingAnim.Get();

if (pType->IsDropship)
{
if (RulesExt::Global()->DefaultLandingAnim_Dropship.isset())
return RulesExt::Global()->DefaultLandingAnim_Dropship.Get();
return AnimTypeClass::Find("DROPLAND");
}

auto const pAircraft = abstract_cast<AircraftClass*, true>(pTechno);
if (pAircraft && pAircraft->Type->Carryall)
{
if (RulesExt::Global()->DefaultLandingAnim_Carryall.isset())
return RulesExt::Global()->DefaultLandingAnim_Carryall.Get();
return AnimTypeClass::Find("CARYLAND");
}

return RulesExt::Global()->DefaultLandingAnim;
}

DEFINE_HOOK(0x4CEB59, FlyLocomotionClass_ProcessLanding_ForceDropship, 0x6)
{
GET(FlyLocomotionClass*, pLoco, ESI);
auto const pType = pLoco->LinkedTo->GetTechnoType();
bool force = TechnoTypeExt::ExtMap.Find(pType)->LandingAnim.isset() || RulesExt::Global()->DefaultLandingAnim != nullptr;

R->CL(force || pType->IsDropship);
return 0x4CEB5F;
}

DEFINE_HOOK(0x4CEB7E, FlyLocomotionClass_ProcessLanding_DropshipAnim, 0x5)
{
GET(FlyLocomotionClass*, pLoco, ESI);
auto const pAnim = GetLandingAnim(pLoco->LinkedTo);
R->EAX(pAnim ? pAnim->ArrayIndex : -1);
return 0x4CEB88;
}

DEFINE_HOOK(0x4CEC31, FlyLocomotionClass_ProcessLanding_CarryallAnim, 0x5)
{
GET(FlyLocomotionClass*, pLoco, ESI);
auto const pAnim = GetLandingAnim(pLoco->LinkedTo);
R->EAX(pAnim ? pAnim->ArrayIndex : -1);
return 0x4CEC3B;
}

DEFINE_HOOK(0x4CF8B1, FlyLocomotionClass_Draw_Point_NoWobbles, 0x6)
{
enum { Continue = 0x4CF8B7 };
Expand Down
4 changes: 4 additions & 0 deletions src/Ext/TechnoType/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1201,6 +1201,8 @@ void TechnoTypeExt::ExtData::LoadFromINIFile(CCINIClass* const pINI)

this->FlyNoWobbles.Read(exINI, pSection, "FlyNoWobbles");

this->LandingAnim.Read(exINI, pSection, "LandingAnim");

// Ares 0.2
this->RadarJamRadius.Read(exINI, pSection, "RadarJamRadius");

Expand Down Expand Up @@ -1945,6 +1947,8 @@ void TechnoTypeExt::ExtData::Serialize(T& Stm)
.Process(this->Parasite_AllowWaterExit)

.Process(this->FlyNoWobbles)

.Process(this->LandingAnim)
;
}
void TechnoTypeExt::ExtData::LoadFromStream(PhobosStreamReader& Stm)
Expand Down
4 changes: 4 additions & 0 deletions src/Ext/TechnoType/Body.h
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,8 @@ class TechnoTypeExt

Nullable<bool> FlyNoWobbles;

Nullable<AnimTypeClass*> LandingAnim;

ExtData(TechnoTypeClass* OwnerObject) : Extension<TechnoTypeClass>(OwnerObject)
, HealthBar_Hide { false }
, HealthBar_HidePips { false }
Expand Down Expand Up @@ -980,6 +982,8 @@ class TechnoTypeExt
, Parasite_AllowWaterExit {}

, FlyNoWobbles {}

, LandingAnim {}
{ }

virtual ~ExtData() = default;
Expand Down
Loading