Skip to content

Commit 2fa74f6

Browse files
committed
support individually extracting Heroic highlight intros
1 parent e562907 commit 2fa74f6

2 files changed

Lines changed: 47 additions & 1 deletion

File tree

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
using DataTool.Flag;
2+
using DataTool.Helper;
3+
using TankLib.Helpers;
4+
using TankLib.STU.Types;
5+
using TankLib.STU.Types.Enums;
6+
7+
namespace DataTool.SaveLogic.Unlock {
8+
public static class HighlightIntro {
9+
public static void Save(ICLIFlags flags, string directory, DataModels.Unlock unlock, STUHero hero) {
10+
if (unlock.GetSTU() is STUUnlock_POTGAnimation { m_type: POTGType.Default }) {
11+
SaveHeroicIntro(flags, directory, hero);
12+
return;
13+
}
14+
15+
AnimationItem.Save(flags, directory, unlock);
16+
}
17+
18+
private static void SaveHeroicIntro(ICLIFlags flags, string directory, STUHero hero) {
19+
if (hero == null) {
20+
// sanity
21+
Logger.Error(nameof(HighlightIntro), "No hero associated to highlight intro");
22+
return;
23+
}
24+
25+
// heroic highlight intros do not use the animation field
26+
// instead it uses the hero select entity which has a blend tree
27+
28+
var heroSelectEntity = STUHelper.GetInstance<STUModelComponent>(hero.m_322C521A);
29+
if (heroSelectEntity == null) {
30+
Logger.Error(nameof(HighlightIntro), "Unable to load heroic animation entity");
31+
return;
32+
}
33+
34+
// we don't really want to extract the whole hero
35+
// so select only the blend tree
36+
var comboInfo = new FindLogic.Combo.ComboInfo();
37+
FindLogic.Combo.Find(comboInfo, heroSelectEntity.m_animBlendTreeSet);
38+
39+
var saveContext = new Combo.SaveContext(comboInfo) {
40+
m_saveAnimationEffects = false // not supported in loose mode
41+
};
42+
Combo.Save(flags, directory, saveContext);
43+
Combo.SaveAllAnimations(flags, directory, saveContext);
44+
}
45+
}
46+
}

DataTool/ToolLogic/Extract/ExtractHeroUnlocks.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ public static void SaveUnlock(
293293

294294
if (ShouldDo(unlock, config, tags, UnlockType.HighlightIntro)) {
295295
Log($"\tExtracting highlight intro {unlock.Name}");
296-
AnimationItem.Save(flags, thisPath, unlock);
296+
HighlightIntro.Save(flags, thisPath, unlock, hero);
297297
}
298298

299299
if (ShouldDo(unlock, config, tags, UnlockType.Emote)) {

0 commit comments

Comments
 (0)