Skip to content

Commit 535d40d

Browse files
committed
warp and promotion anim
1 parent e68e636 commit 535d40d

File tree

8 files changed

+48
-43
lines changed

8 files changed

+48
-43
lines changed

docs/Fixed-or-Improved-Logics.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -785,13 +785,14 @@ TargetZoneScanType=same ; target zone scan enumeration (same|any|inrange)
785785

786786
- You can now specify Teleport/Chrono Locomotor settings per TechnoType to override default rules values. Unfilled values default to values in `[General]`.
787787
- Only applicable to Techno that have Teleport/Chrono Locomotor attached.
788+
- If more than one animation is listed in `WarpOut`, `WarpIn` or `WarpAway`, a random one is selected.
788789

789790
In `rulesmd.ini`:
790791
```ini
791792
[SOMETECHNO] ; TechnoType
792-
WarpOut= ; Anim (played when Techno warping out), default to [General] WarpOut
793-
WarpIn= ; Anim (played when Techno warping in), default to [General] WarpIn
794-
WarpAway= ; Anim (played when Techno chronowarped by chronosphere), default to [General] WarpOut
793+
WarpOut= ; list of Animation (played when Techno warping out), default to [General] WarpOut
794+
WarpIn= ; list of Animation (played when Techno warping in), default to [General] WarpIn
795+
WarpAway= ; list of Animation (played when Techno chronowarped by chronosphere), default to [General] WarpOut
795796
ChronoTrigger= ; boolean, if yes then delay varies by distance, if no it is a constant
796797
ChronoDistanceFactor= ; integer, amount to divide the distance to destination by to get the warped out delay
797798
ChronoMinimumDelay= ; integer, the minimum delay for teleporting, no matter how short the distance

docs/New-or-Enhanced-Logics.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1545,15 +1545,15 @@ Promote.IncludeSpawns=false ; boolean
15451545
### Promotion animation
15461546

15471547
- You can now specify an animation on the unit or structure promotion.
1548-
- `Promote.VeteranAnimation` is used when unit or structure is promoted to veteran.
1549-
- `Promote.EliteAnimation` is used when unit or structure is promoted to elite.
1548+
- `Promote.VeteranAnimation` is used when unit or structure is promoted to veteran. If more than one animation is listed, a random one is selected.
1549+
- `Promote.EliteAnimation` is used when unit or structure is promoted to elite. If more than one animation is listed, a random one is selected.
15501550
- If `Promote.EliteAnimation` is not defined, `Promote.VeteranAnimation` will play instead when unit or structure is promoted to elite.
15511551

15521552
In `rulesmd.ini`:
15531553
```ini
15541554
[AudioVisual]
1555-
Promote.VeteranAnimation= ; AnimationType
1556-
Promote.EliteAnimation= ; AnimationType
1555+
Promote.VeteranAnimation= ; list of Animation
1556+
Promote.EliteAnimation= ; list of Animation
15571557
```
15581558

15591559
### Raise alert when technos are taking damage

docs/locale/zh_CN/LC_MESSAGES/Fixed-or-Improved-Logics.po

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3151,11 +3151,11 @@ msgstr "仅对使用超时空运动方式的科技类型有效。"
31513151
#: ../../Fixed-or-Improved-Logics.md:790
31523152
msgid ""
31533153
"[SOMETECHNO] ; TechnoType\n"
3154-
"WarpOut= ; Anim (played when Techno warping out), default "
3154+
"WarpOut= ; list of Animation (played when Techno warping out), default "
31553155
"to [General] WarpOut\n"
3156-
"WarpIn= ; Anim (played when Techno warping in), default "
3156+
"WarpIn= ; list of Animation (played when Techno warping in), default "
31573157
"to [General] WarpIn\n"
3158-
"WarpAway= ; Anim (played when Techno chronowarped by "
3158+
"WarpAway= ; list of Animation (played when Techno chronowarped by "
31593159
"chronosphere), default to [General] WarpOut\n"
31603160
"ChronoTrigger= ; boolean, if yes then delay varies by distance, "
31613161
"if no it is a constant\n"
@@ -3168,11 +3168,11 @@ msgid ""
31683168
"ChronoDelay= ; integer, delay after teleport for chronosphere\n"
31693169
msgstr ""
31703170
"[SOMETECHNO] ; TechnoType\n"
3171-
"WarpOut= ; Anim (played when Techno warping out), default "
3171+
"WarpOut= ; list of Animation (played when Techno warping out), default "
31723172
"to [General] WarpOut\n"
3173-
"WarpIn= ; Anim (played when Techno warping in), default "
3173+
"WarpIn= ; list of Animation (played when Techno warping in), default "
31743174
"to [General] WarpIn\n"
3175-
"WarpAway= ; Anim (played when Techno chronowarped by "
3175+
"WarpAway= ; list of Animation (played when Techno chronowarped by "
31763176
"chronosphere), default to [General] WarpOut\n"
31773177
"ChronoTrigger= ; boolean, if yes then delay varies by distance, "
31783178
"if no it is a constant\n"

docs/locale/zh_CN/LC_MESSAGES/New-or-Enhanced-Logics.po

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5848,14 +5848,14 @@ msgstr "现在你可以在单位或建筑升级时播放指定动画。"
58485848
#: ../../New-or-Enhanced-Logics.md:1548
58495849
msgid ""
58505850
"`Promote.VeteranAnimation` is used when unit or structure is promoted to "
5851-
"veteran."
5852-
msgstr "`Promote.VeteranAnimation` 用于单位或建筑升级为老兵时。"
5851+
"veteran. If more than one animation is listed, a random one is selected."
5852+
msgstr "`Promote.VeteranAnimation` 用于单位或建筑升级为老兵时。如果列出了多个动画,则将随机选择一个。"
58535853

58545854
#: ../../New-or-Enhanced-Logics.md:1549
58555855
msgid ""
58565856
"`Promote.EliteAnimation` is used when unit or structure is promoted to "
5857-
"elite."
5858-
msgstr "`Promote.EliteAnimation` 用于单位或建筑升级为精英时。"
5857+
"elite. If more than one animation is listed, a random one is selected."
5858+
msgstr "`Promote.EliteAnimation` 用于单位或建筑升级为精英时。如果列出了多个动画,则将随机选择一个。"
58595859

58605860
#: ../../New-or-Enhanced-Logics.md:1550
58615861
msgid ""
@@ -5866,12 +5866,12 @@ msgstr "如果未定义 `Promote.EliteAnimation` 则使用 `Promote.VeteranAnima
58665866
#: ../../New-or-Enhanced-Logics.md:1553
58675867
msgid ""
58685868
"[AudioVisual]\n"
5869-
"Promote.VeteranAnimation= ; AnimationType\n"
5870-
"Promote.EliteAnimation= ; AnimationType\n"
5869+
"Promote.VeteranAnimation= ; list of Animation\n"
5870+
"Promote.EliteAnimation= ; list of Animation\n"
58715871
msgstr ""
58725872
"[AudioVisual]\n"
5873-
"Promote.VeteranAnimation= ; AnimationType\n"
5874-
"Promote.EliteAnimation= ; AnimationType\n"
5873+
"Promote.VeteranAnimation= ; list of Animation\n"
5874+
"Promote.EliteAnimation= ; list of Animation\n"
58755875

58765876
#: ../../New-or-Enhanced-Logics.md:1559
58775877
msgid "Raise alert when technos are taking damage"

src/Ext/Rules/Body.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,8 @@ class RulesExt
155155
Valueable<Point2D> DrawInsignia_AdjustPos_Buildings;
156156
Nullable<BuildingSelectBracketPosition> DrawInsignia_AdjustPos_BuildingsAnchor;
157157
Valueable<Point2D> DrawInsignia_AdjustPos_Units;
158-
Valueable<AnimTypeClass*> Promote_VeteranAnimation;
159-
Valueable<AnimTypeClass*> Promote_EliteAnimation;
158+
ValueableVector<AnimTypeClass*> Promote_VeteranAnimation;
159+
ValueableVector<AnimTypeClass*> Promote_EliteAnimation;
160160

161161
Valueable<double> DamageOwnerMultiplier;
162162
Valueable<double> DamageAlliesMultiplier;

src/Ext/Techno/Hooks.cpp

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -111,23 +111,15 @@ DEFINE_HOOK(0x6F9FA9, TechnoClass_AI_PromoteAnim, 0x6)
111111

112112
auto aresProcess = [pThis]() { return (pThis->GetTechnoType()->Turret) ? 0x6F9FB7 : 0x6FA054; };
113113

114-
if (!RulesExt::Global()->Promote_VeteranAnimation && !RulesExt::Global()->Promote_EliteAnimation)
114+
if (!RulesExt::Global()->Promote_VeteranAnimation.size() && !RulesExt::Global()->Promote_EliteAnimation.size())
115115
return aresProcess();
116116

117117
if (pThis->CurrentRanking != pThis->Veterancy.GetRemainingLevel() && pThis->CurrentRanking != Rank::Invalid && (pThis->Veterancy.GetRemainingLevel() != Rank::Rookie))
118118
{
119-
AnimClass* promAnim = nullptr;
120-
if (pThis->Veterancy.GetRemainingLevel() == Rank::Veteran && RulesExt::Global()->Promote_VeteranAnimation)
121-
promAnim = GameCreate<AnimClass>(RulesExt::Global()->Promote_VeteranAnimation, pThis->GetCenterCoords());
122-
else if (RulesExt::Global()->Promote_EliteAnimation)
123-
promAnim = GameCreate<AnimClass>(RulesExt::Global()->Promote_EliteAnimation, pThis->GetCenterCoords());
124-
125-
if (promAnim)
126-
{
127-
promAnim->SetOwnerObject(pThis);
128-
AnimExt::SetAnimOwnerHouseKind(promAnim, pThis->Owner, nullptr, false, true);
129-
AnimExt::ExtMap.Find(promAnim)->SetInvoker(pThis);
130-
}
119+
if (pThis->Veterancy.GetRemainingLevel() == Rank::Veteran && RulesExt::Global()->Promote_VeteranAnimation.size() > 0)
120+
AnimExt::CreateRandomAnim(RulesExt::Global()->Promote_VeteranAnimation, pThis->GetCenterCoords(), pThis, pThis->Owner, true);
121+
else if (RulesExt::Global()->Promote_EliteAnimation.size() > 0)
122+
AnimExt::CreateRandomAnim(RulesExt::Global()->Promote_EliteAnimation, pThis->GetCenterCoords(), pThis, pThis->Owner, true);
131123
}
132124

133125
return aresProcess();
@@ -738,4 +730,4 @@ DEFINE_HOOK(0x4B3DF0, LocomotionClass_Process_DamagedSpeedMultiplier, 0x6)// Dri
738730
__asm fmul multiplier;
739731

740732
return R->Origin() + 0x6;
741-
}
733+
}

src/Ext/TechnoType/Body.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,9 @@ class TechnoTypeExt
9494
NullableIdx<VocClass> VoiceCreated;
9595
NullableIdx<VocClass> VoicePickup; // Used by carryalls instead of VoiceMove if set.
9696

97-
Nullable<AnimTypeClass*> WarpOut;
98-
Nullable<AnimTypeClass*> WarpIn;
99-
Nullable<AnimTypeClass*> WarpAway;
97+
ValueableVector<AnimTypeClass*> WarpOut;
98+
ValueableVector<AnimTypeClass*> WarpIn;
99+
ValueableVector<AnimTypeClass*> WarpAway;
100100
Nullable<bool> ChronoTrigger;
101101
Nullable<int> ChronoDistanceFactor;
102102
Nullable<int> ChronoMinimumDelay;

src/Ext/TechnoType/Hooks.Teleport.cpp

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ DEFINE_HOOK(0x7193F6, TeleportLocomotionClass_ILocomotion_Process_WarpoutAnim, 0
1919
{
2020
GET_LOCO(ESI);
2121

22-
if (auto pWarpOut = pExt->WarpOut.Get(RulesClass::Instance->WarpOut))
22+
if (pExt->WarpOut.size() > 0)
23+
{
24+
AnimExt::CreateRandomAnim(pExt->WarpOut, pLinked->Location, nullptr, pLinked->Owner);
25+
}
26+
else if (auto const pWarpOut = RulesClass::Instance->WarpOut)
2327
{
2428
auto const pAnim = GameCreate<AnimClass>(pWarpOut, pLinked->Location);
2529
AnimExt::SetAnimOwnerHouseKind(pAnim, pLinked->Owner, nullptr, false, true);
@@ -74,7 +78,11 @@ DEFINE_HOOK(0x719742, TeleportLocomotionClass_ILocomotion_Process_WarpInAnim, 0x
7478
{
7579
GET_LOCO(ESI);
7680

77-
if (auto pWarpIn = pExt->WarpIn.Get(RulesClass::Instance->WarpIn))
81+
if (pExt->WarpIn.size() > 0)
82+
{
83+
AnimExt::CreateRandomAnim(pExt->WarpIn, pLinked->Location, nullptr, pLinked->Owner);
84+
}
85+
else if (auto const pWarpIn = RulesClass::Instance->WarpIn)
7886
{
7987
auto const pAnim = GameCreate<AnimClass>(pWarpIn, pLinked->Location);
8088
AnimExt::SetAnimOwnerHouseKind(pAnim, pLinked->Owner, nullptr, false, true);
@@ -96,7 +104,11 @@ DEFINE_HOOK(0x719827, TeleportLocomotionClass_ILocomotion_Process_WarpAway, 0x5)
96104
{
97105
GET_LOCO(ESI);
98106

99-
if (auto pWarpAway = pExt->WarpAway.Get(RulesClass::Instance->WarpOut))
107+
if (pExt->WarpAway.size() > 0)
108+
{
109+
AnimExt::CreateRandomAnim(pExt->WarpAway, pLinked->Location, nullptr, pLinked->Owner);
110+
}
111+
else if (auto const pWarpAway = RulesClass::Instance->WarpOut)
100112
{
101113
auto const pAnim = GameCreate<AnimClass>(pWarpAway, pLinked->Location);
102114
AnimExt::SetAnimOwnerHouseKind(pAnim, pLinked->Owner, nullptr, false, true);

0 commit comments

Comments
 (0)