From 1aa109df680cedccb8e11e6ab95bed74cfd28080 Mon Sep 17 00:00:00 2001 From: Topaz Whitelock Date: Mon, 11 Sep 2023 05:51:11 +0300 Subject: [PATCH] Add the option to enable UV Animations. --- OpenKh.Kh2/Sequence.cs | 6 ++++++ OpenKh.Tools.LayoutEditor/AppSequenceEditor.cs | 1 + 2 files changed, 7 insertions(+) diff --git a/OpenKh.Kh2/Sequence.cs b/OpenKh.Kh2/Sequence.cs index ab8508f9b..286530b69 100644 --- a/OpenKh.Kh2/Sequence.cs +++ b/OpenKh.Kh2/Sequence.cs @@ -1,4 +1,5 @@ using OpenKh.Common; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -48,6 +49,8 @@ private class Header [Data] public Section SpriteGroupDesc { get; set; } [Data] public Section AnimationDesc { get; set; } [Data] public Section AnimationGroupDesc { get; set; } + + [Data] public int UVEnableFlag { get; set; } } public class RawSprite @@ -165,6 +168,7 @@ public class AnimationGroup } public int Unknown04 { get; set; } + public bool UVEnableFlag { get; set; } public List Sprites { get; set; } public List> SpriteGroups { get; set; } public List AnimationGroups { get; set; } @@ -186,6 +190,7 @@ private Sequence(Stream inputStream) throw new InvalidDataException("Invalid header"); Unknown04 = header.Unknown04; + UVEnableFlag = Convert.ToBoolean(header.UVEnableFlag); Sprites = stream.ReadList(header.SpriteDesc.Offset, header.SpriteDesc.Count) .Select(x => new Sprite { @@ -235,6 +240,7 @@ public void Write(Stream stream) SpriteGroupDesc = new Section() { Count = SpriteGroups.Count }, AnimationDesc = new Section() { Count = AnimationGroups.Sum(x => x.Animations.Count) }, AnimationGroupDesc = new Section() { Count = AnimationGroups.Count }, + UVEnableFlag = Convert.ToInt32(UVEnableFlag) }; var index = 0; diff --git a/OpenKh.Tools.LayoutEditor/AppSequenceEditor.cs b/OpenKh.Tools.LayoutEditor/AppSequenceEditor.cs index 0baac8873..d818cbf5d 100644 --- a/OpenKh.Tools.LayoutEditor/AppSequenceEditor.cs +++ b/OpenKh.Tools.LayoutEditor/AppSequenceEditor.cs @@ -130,6 +130,7 @@ public void Menu() { ForMenuItem("Sprite groups...", () => _isSpriteGroupEditDialogOpen = true); ForMenuItem("Sprites...", () => _isSpriteEditDialogOpen = true); + ForMenuCheck("Enable UV Animations", () => _sequence.UVEnableFlag, x => _sequence.UVEnableFlag = x); }); }