From 2a070d2f87495323da7a6219740b401147af68d0 Mon Sep 17 00:00:00 2001 From: Asgard Date: Wed, 20 Nov 2024 14:55:01 -0700 Subject: [PATCH] Fix timelines --- Brio/Resources/Sheets/BrioActionTimeline.cs | 38 +++++++++---------- .../Selectors/ActionTimelineSelector.cs | 28 +++++++------- 2 files changed, 32 insertions(+), 34 deletions(-) diff --git a/Brio/Resources/Sheets/BrioActionTimeline.cs b/Brio/Resources/Sheets/BrioActionTimeline.cs index 3318376b..6f37a4b7 100644 --- a/Brio/Resources/Sheets/BrioActionTimeline.cs +++ b/Brio/Resources/Sheets/BrioActionTimeline.cs @@ -11,25 +11,25 @@ readonly public struct BrioActionTimeline(ExcelPage page, uint offset, uint row) public readonly ReadOnlySeString Key => page.ReadString(offset, offset); public readonly RowRef WeaponTimeline => new(page.Module, (uint)page.ReadUInt16(offset + 4), page.Language); - public readonly byte Unknown_70 => page.ReadUInt8(offset + 6); - public readonly byte Type => page.ReadUInt8(offset + 7); - public readonly byte Priority => page.ReadUInt8(offset + 8); - public readonly byte Stance => page.ReadUInt8(offset + 9); - public readonly byte Slot => page.ReadUInt8(offset + 10); - public readonly byte LookAtMode => page.ReadUInt8(offset + 11); - public readonly byte ActionTimelineIDMode => page.ReadUInt8(offset + 12); - public readonly byte LoadType => page.ReadUInt8(offset + 13); - public readonly byte StartAttach => page.ReadUInt8(offset + 14); - public readonly byte ResidentPap => page.ReadUInt8(offset + 15); - public readonly byte Unknown6 => page.ReadUInt8(offset + 16); - public readonly byte Unknown1 => page.ReadUInt8(offset + 17); - public readonly bool Pause => page.ReadPackedBool(offset + 18, 0); - public readonly bool Resident => page.ReadPackedBool(offset + 18, 1); - public readonly bool IsMotionCanceledByMoving => page.ReadPackedBool(offset + 18, 2); - public readonly bool Unknown2 => page.ReadPackedBool(offset + 18, 3); - public readonly bool Unknown3 => page.ReadPackedBool(offset + 18, 4); - public readonly bool IsLoop => page.ReadPackedBool(offset + 18, 5); - public readonly bool Unknown4 => page.ReadPackedBool(offset + 18, 6); + public readonly ushort Unknown => page.ReadUInt16(offset + 6); + public readonly byte Type => page.ReadUInt8(offset + 8); + public readonly byte Priority => page.ReadUInt8(offset + 9); + public readonly byte Stance => page.ReadUInt8(offset + 10); + public readonly byte Slot => page.ReadUInt8(offset + 11); + public readonly byte LookAtMode => page.ReadUInt8(offset + 12); + public readonly byte ActionTimelineIDMode => page.ReadUInt8(offset + 13); + public readonly byte LoadType => page.ReadUInt8(offset + 14); + public readonly byte StartAttach => page.ReadUInt8(offset + 15); + public readonly byte ResidentPap => page.ReadUInt8(offset + 16); + public readonly byte Unknown6 => page.ReadUInt8(offset + 17); + public readonly byte Unknown1 => page.ReadUInt8(offset + 18); + public readonly bool Pause => page.ReadPackedBool(offset + 19, 0); + public readonly bool Resident => page.ReadPackedBool(offset + 19, 1); + public readonly bool IsMotionCanceledByMoving => page.ReadPackedBool(offset + 19, 2); + public readonly bool Unknown2 => page.ReadPackedBool(offset + 19, 3); + public readonly bool Unknown3 => page.ReadPackedBool(offset + 19, 4); + public readonly bool IsLoop => page.ReadPackedBool(offset + 19, 5); + public readonly bool Unknown4 => page.ReadPackedBool(offset + 19, 6); static BrioActionTimeline IExcelRow.Create(ExcelPage page, uint offset, uint row) => new(page, offset, row); diff --git a/Brio/UI/Controls/Selectors/ActionTimelineSelector.cs b/Brio/UI/Controls/Selectors/ActionTimelineSelector.cs index 8fa84021..ab3d64dd 100644 --- a/Brio/UI/Controls/Selectors/ActionTimelineSelector.cs +++ b/Brio/UI/Controls/Selectors/ActionTimelineSelector.cs @@ -1,4 +1,5 @@ using Brio.Resources; +using Brio.Resources.Sheets; using Brio.UI.Controls.Stateless; using ImGuiNET; using System; @@ -43,38 +44,35 @@ protected override void PopulateList() foreach(var emote in GameDataProvider.Instance.Emotes.Values) { // Loop - var timeline = emote.ActionTimeline[0]; - if(timeline.ValueNullable != null && timeline.RowId != 0) + BrioActionTimeline timeline; + + if(emote.ActionTimeline[0].RowId != 0 && GameDataProvider.Instance.ActionTimelines.TryGetValue(emote.ActionTimeline[0].RowId, out timeline)) { - AddItem(new ActionTimelineSelectorEntry(emote.Name.ToString(), (ushort)timeline.RowId, emote.RowId, timeline.Value.Key.ToString(), ActionTimelineSelectorEntry.OriginalType.Emote, ActionTimelineSelectorEntry.AnimationPurpose.Standard, (ActionTimelineSlots)timeline.Value.Slot, emote.Icon)); + AddItem(new ActionTimelineSelectorEntry(emote.Name.ToString(), (ushort)timeline.RowId, emote.RowId, timeline.Key.ToString(), ActionTimelineSelectorEntry.OriginalType.Emote, ActionTimelineSelectorEntry.AnimationPurpose.Standard, (ActionTimelineSlots)timeline.Slot, emote.Icon)); } // Intro - timeline = emote.ActionTimeline[1]; - if(timeline.ValueNullable != null && timeline.RowId != 0) + if(emote.ActionTimeline[1].RowId != 0 && GameDataProvider.Instance.ActionTimelines.TryGetValue(emote.ActionTimeline[1].RowId, out timeline)) { - AddItem(new ActionTimelineSelectorEntry(emote.Name.ToString(), (ushort)timeline.RowId, emote.RowId, timeline.Value.Key.ToString(), ActionTimelineSelectorEntry.OriginalType.Emote, ActionTimelineSelectorEntry.AnimationPurpose.Intro, (ActionTimelineSlots)timeline.Value.Slot, emote.Icon)); + AddItem(new ActionTimelineSelectorEntry(emote.Name.ToString(), (ushort)timeline.RowId, emote.RowId, timeline.Key.ToString(), ActionTimelineSelectorEntry.OriginalType.Emote, ActionTimelineSelectorEntry.AnimationPurpose.Intro, (ActionTimelineSlots)timeline.Slot, emote.Icon)); } // Ground - timeline = emote.ActionTimeline[2]; - if(timeline.ValueNullable != null && timeline.RowId != 0) + if(emote.ActionTimeline[2].RowId != 0 && GameDataProvider.Instance.ActionTimelines.TryGetValue(emote.ActionTimeline[2].RowId, out timeline)) { - AddItem(new ActionTimelineSelectorEntry(emote.Name.ToString(), (ushort)timeline.RowId, emote.RowId, timeline.Value.Key.ToString(), ActionTimelineSelectorEntry.OriginalType.Emote, ActionTimelineSelectorEntry.AnimationPurpose.Ground, (ActionTimelineSlots)timeline.Value.Slot, emote.Icon)); + AddItem(new ActionTimelineSelectorEntry(emote.Name.ToString(), (ushort)timeline.RowId, emote.RowId, timeline.Key.ToString(), ActionTimelineSelectorEntry.OriginalType.Emote, ActionTimelineSelectorEntry.AnimationPurpose.Ground, (ActionTimelineSlots)timeline.Slot, emote.Icon)); } // Chair - timeline = emote.ActionTimeline[3]; - if(timeline.ValueNullable != null && timeline.RowId != 0) + if(emote.ActionTimeline[3].RowId != 0 && GameDataProvider.Instance.ActionTimelines.TryGetValue(emote.ActionTimeline[3].RowId, out timeline)) { - AddItem(new ActionTimelineSelectorEntry(emote.Name.ToString(), (ushort)timeline.RowId, emote.RowId, timeline.Value.Key.ToString(), ActionTimelineSelectorEntry.OriginalType.Emote, ActionTimelineSelectorEntry.AnimationPurpose.Chair, (ActionTimelineSlots)timeline.Value.Slot, emote.Icon)); + AddItem(new ActionTimelineSelectorEntry(emote.Name.ToString(), (ushort)timeline.RowId, emote.RowId, timeline.Key.ToString(), ActionTimelineSelectorEntry.OriginalType.Emote, ActionTimelineSelectorEntry.AnimationPurpose.Chair, (ActionTimelineSlots)timeline.Slot, emote.Icon)); } // Upper Body - timeline = emote.ActionTimeline[4]; - if(timeline.ValueNullable != null && timeline.RowId != 0) + if(emote.ActionTimeline[4].RowId != 0 && GameDataProvider.Instance.ActionTimelines.TryGetValue(emote.ActionTimeline[4].RowId, out timeline)) { - AddItem(new ActionTimelineSelectorEntry(emote.Name.ToString(), (ushort)timeline.RowId, emote.RowId, timeline.Value.Key.ToString(), ActionTimelineSelectorEntry.OriginalType.Emote, ActionTimelineSelectorEntry.AnimationPurpose.Blend, (ActionTimelineSlots)timeline.Value.Slot, emote.Icon)); + AddItem(new ActionTimelineSelectorEntry(emote.Name.ToString(), (ushort)timeline.RowId, emote.RowId, timeline.Key.ToString(), ActionTimelineSelectorEntry.OriginalType.Emote, ActionTimelineSelectorEntry.AnimationPurpose.Blend, (ActionTimelineSlots)timeline.Slot, emote.Icon)); } }