Skip to content

Commit c528a1a

Browse files
NetsuNegiCoronia
andauthored
[Vanilla Enhancement] Customize squid grapple animation (#1791)
- Squid grapple anim is hardcoded to use `SQDG` in vanilla, Now you can choose it. In `rulesmd.ini`: ```ini [AudioVisual] Parasite.GrappleAnim= ; animation [SOMEWARHEAD] ; WarheadType Parasite.GrappleAnim= ; animation ``` --------- Co-authored-by: Coronia <[email protected]>
1 parent d9c3726 commit c528a1a

File tree

8 files changed

+30
-1
lines changed

8 files changed

+30
-1
lines changed

CREDITS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,7 @@ This page lists all the individual contributions to the project by their author.
436436
- Fix the bug that `IsLocomotor=yes` warhead rendering hover units unselectable and undamageable on elevated bridge
437437
- Fix the bug that Locomotor warhead won't stop working when firer (except for vehicle) stop firing
438438
- Fix the bug that hover vehicle will sink if destroyed on bridge
439+
- Customize squid grapple animation
439440
- **Apollo** - Translucent SHP drawing patches
440441
- **ststl**:
441442
- Customizable `ShowTimer` priority of superweapons

docs/Fixed-or-Improved-Logics.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2024,14 +2024,19 @@ In `rulesmd.ini`:
20242024
DecloakDamagedTargets=true ; boolean
20252025
```
20262026

2027-
### Customizing parasite culling targets
2027+
### Customizing parasite
20282028

20292029
- Now you can specify which targets the parasite will culling them.
2030+
- Squid grapple anim is hardcoded to use `SQDG` in vanilla, Now you can choose it.
20302031

20312032
In `rulesmd.ini`:
20322033
```ini
2034+
[AudioVisual]
2035+
Parasite.GrappleAnim= ; animation
2036+
20332037
[SOMEWARHEAD] ; WarheadType
20342038
Parasite.CullingTarget=infantry ; List of Affected Target Enumeration (none|aircraft|infantry|units|all)
2039+
Parasite.GrappleAnim= ; animation
20352040
```
20362041

20372042
### Delay automatic attack on the controlled unit

docs/Whats-New.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,7 @@ New:
426426
- [Additional attached animation position customizations](Fixed-or-Improved-Logics.md#attached-animation-position-customization) (by Starkku)
427427
- Use `SkipCrushSlowdown=true` to avoid the bug related to `Accelerates=true` and `MovementZone=CrushAll` (by TaranDahl)
428428
- Units can customize the attack voice that plays when using more weapons (by FlyStar)
429+
- Customize squid grapple animation (by NetsuNegi)
429430
430431
Vanilla fixes:
431432
- Fixed sidebar not updating queued unit numbers when adding or removing units when the production is on hold (by CrimRecya)

src/Ext/Rules/Body.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,8 @@ void RulesExt::ExtData::LoadBeforeTypeData(RulesClass* pThis, CCINIClass* pINI)
288288
this->AttackMove_IgnoreWeaponCheck.Read(exINI, GameStrings::General, "AttackMove.IgnoreWeaponCheck");
289289
this->AttackMove_StopWhenTargetAcquired.Read(exINI, GameStrings::General, "AttackMove.StopWhenTargetAcquired");
290290

291+
this->Parasite_GrappleAnim.Read(exINI, GameStrings::AudioVisual, "Parasite.GrappleAnim");
292+
291293
this->AINormalTargetingDelay.Read(exINI, GameStrings::General, "AINormalTargetingDelay");
292294
this->PlayerNormalTargetingDelay.Read(exINI, GameStrings::General, "PlayerNormalTargetingDelay");
293295
this->AIGuardAreaTargetingDelay.Read(exINI, GameStrings::General, "AIGuardAreaTargetingDelay");
@@ -548,6 +550,7 @@ void RulesExt::ExtData::Serialize(T& Stm)
548550
.Process(this->TintColorBerserk)
549551
.Process(this->AttackMove_IgnoreWeaponCheck)
550552
.Process(this->AttackMove_StopWhenTargetAcquired)
553+
.Process(this->Parasite_GrappleAnim)
551554
;
552555
}
553556

src/Ext/Rules/Body.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,8 @@ class RulesExt
245245
Valueable<bool> AttackMove_IgnoreWeaponCheck;
246246
Nullable<bool> AttackMove_StopWhenTargetAcquired;
247247

248+
NullableIdx<AnimTypeClass> Parasite_GrappleAnim;
249+
248250
// cache tint color
249251
int TintColorIronCurtain;
250252
int TintColorForceShield;
@@ -443,6 +445,8 @@ class RulesExt
443445

444446
, AttackMove_IgnoreWeaponCheck { false }
445447
, AttackMove_StopWhenTargetAcquired { }
448+
449+
, Parasite_GrappleAnim {}
446450
{ }
447451

448452
virtual ~ExtData() = default;

src/Ext/Techno/Hooks.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -822,6 +822,17 @@ DEFINE_HOOK(0x62A0AA, ParasiteClass_AI_CullingTarget, 0x5)
822822
return EnumFunctions::IsTechnoEligible(pThis->Victim, pWHExt->Parasite_CullingTarget) ? ExecuteCulling : CannotCulling;
823823
}
824824

825+
DEFINE_HOOK(0x6298CC, ParasiteClass_AI_GrippleAnim, 0x5)
826+
{
827+
enum { SkipGameCode = 0x6298D6 };
828+
829+
GET_STACK(WarheadTypeClass*, pWarhead, STACK_OFFSET(0x68, -0x4C));
830+
const auto pWHExt = WarheadTypeExt::ExtMap.Find(pWarhead);
831+
832+
R->EAX(pWHExt->Parasite_GrappleAnim.Get(RulesExt::Global()->Parasite_GrappleAnim.Get(AnimTypeClass::FindIndex("SQDG"))));
833+
return SkipGameCode;
834+
}
835+
825836
#pragma region RadarDrawing
826837

827838
DEFINE_HOOK(0x655DDD, RadarClass_ProcessPoint_RadarInvisible, 0x6)

src/Ext/WarheadType/Body.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ void WarheadTypeExt::ExtData::LoadFromINIFile(CCINIClass* const pINI)
252252
this->DetonateOnAllMapObjects_IgnoreTypes.Read(exINI, pSection, "DetonateOnAllMapObjects.IgnoreTypes");
253253

254254
this->Parasite_CullingTarget.Read(exINI, pSection, "Parasite.CullingTarget");
255+
this->Parasite_GrappleAnim.Read(exINI, pSection, "Parasite.GrappleAnim");
255256

256257
this->Nonprovocative.Read(exINI, pSection, "Nonprovocative");
257258

@@ -537,6 +538,7 @@ void WarheadTypeExt::ExtData::Serialize(T& Stm)
537538
.Process(this->DamageTargetHealthMultiplier)
538539

539540
.Process(this->Parasite_CullingTarget)
541+
.Process(this->Parasite_GrappleAnim)
540542

541543
.Process(this->Nonprovocative)
542544

src/Ext/WarheadType/Body.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ class WarheadTypeExt
144144
Valueable<bool> RemoveInflictedLocomotor;
145145

146146
Valueable<AffectedTarget> Parasite_CullingTarget;
147+
NullableIdx<AnimTypeClass> Parasite_GrappleAnim;
147148

148149
Valueable<bool> Nonprovocative;
149150

@@ -336,6 +337,7 @@ class WarheadTypeExt
336337
, RemoveInflictedLocomotor { false }
337338

338339
, Parasite_CullingTarget { AffectedTarget::Infantry }
340+
, Parasite_GrappleAnim {}
339341

340342
, Nonprovocative { false }
341343

0 commit comments

Comments
 (0)