Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Making animation saving comply with AS' limitations.
  • Loading branch information
MainMemory committed Feb 17, 2015
1 parent 61704b7 commit 4755d65
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions SonLVLAPI/DataTypes.cs
Expand Up @@ -4,6 +4,7 @@
using System.Drawing;
using System.IO;
using System.Text;
using System.Linq;

namespace SonicRetro.SonLVL.API
{
Expand Down Expand Up @@ -2042,9 +2043,17 @@ public static void ToASM(string file, string name, List<Animation> anims, bool m
{
if (writtenFrames.Contains(anim.Name)) continue;
writtenFrames.Add(anim.Name);
writer.Write(anim.Name + ":\tdc.b ");
writer.WriteLine(string.Join(", ", Array.ConvertAll(anim.GetBytes(), (a) => a.ToHex68k())));
writer.WriteLine();
writer.Write(anim.Name + ":");
List<byte> bytes = new List<byte>(anim.GetBytes());
while (bytes.Count > 20)
{
writer.Write("\tdc.b ");
writer.WriteLine(string.Join(", ", bytes.Take(20).Select(a => a.ToHex68k()).ToArray()));
bytes.RemoveRange(0, 20);
}
writer.Write("\tdc.b ");
writer.WriteLine(string.Join(", ", bytes.Select(a => a.ToHex68k()).ToArray()));
writer.WriteLine();
}
}
writer.WriteLine("\teven");
Expand Down

0 comments on commit 4755d65

Please sign in to comment.