Skip to content

Instantly share code, notes, and snippets.

@LordNed
Created July 17, 2015 04:18
Show Gist options
  • Save LordNed/465df6d85d7fed767a45 to your computer and use it in GitHub Desktop.
Save LordNed/465df6d85d7fed767a45 to your computer and use it in GitHub Desktop.
using GameFormatReader.Common;
using System.Diagnostics;
namespace WEditor.WindWaker.Loaders
{
public partial class J3DLoader
{
private DrawInfo LoadDRW1FromStream(EndianBinaryReader reader, long chunkStart)
{
DrawInfo drawInfo = new DrawInfo();
ushort sectionCount = reader.ReadUInt16();
Debug.Assert(reader.ReadUInt16() == 0xFFFF); // Padding
uint isWeightedOffset = reader.ReadUInt32();
uint indexOffset = reader.ReadUInt32();
reader.BaseStream.Position = chunkStart + isWeightedOffset;
for (int k = 0; k < sectionCount; k++)
drawInfo.IsWeighted.Add(reader.ReadBoolean());
reader.BaseStream.Position = chunkStart + indexOffset;
for (int k = 0; k < sectionCount; k++)
drawInfo.Indexes.Add(reader.ReadUInt16());
return drawInfo;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment