Skip to content

Commit

Permalink
Add the option to enable UV Animations.
Browse files Browse the repository at this point in the history
  • Loading branch information
TopazTK committed Sep 11, 2023
1 parent 8c7aa6f commit 1aa109d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions OpenKh.Kh2/Sequence.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using OpenKh.Common;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -165,6 +168,7 @@ public class AnimationGroup
}

public int Unknown04 { get; set; }
public bool UVEnableFlag { get; set; }
public List<Sprite> Sprites { get; set; }
public List<List<SpritePart>> SpriteGroups { get; set; }
public List<AnimationGroup> AnimationGroups { get; set; }
Expand All @@ -186,6 +190,7 @@ private Sequence(Stream inputStream)
throw new InvalidDataException("Invalid header");

Unknown04 = header.Unknown04;
UVEnableFlag = Convert.ToBoolean(header.UVEnableFlag);
Sprites = stream.ReadList<RawSprite>(header.SpriteDesc.Offset, header.SpriteDesc.Count)
.Select(x => new Sprite
{
Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions OpenKh.Tools.LayoutEditor/AppSequenceEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
}

Expand Down

0 comments on commit 1aa109d

Please sign in to comment.