ace/Source/ACE.DatLoader/Entity/ObjDesc.cs
Mag-nus 6fe177a600
ACE.DatLoader refactoring (#594)
* Change >> 1) & 1 to & 2

Cosmetic change pointed out by Rawaho.

* Better fix of the Portal Flags in the dat code

* ACE.DatLoader refactoring

This new code format uses extention methods to re-use code. It allows decouples object unpacking from DatReader and reduces the dependancy to a simple BinaryReader.

* Forgot to remove the temp StarterAreas code from the transition

* Some files were ignored, not sure why. This should fix
2018-01-23 04:02:39 -06:00

33 lines
1.1 KiB
C#

using System.Collections.Generic;
using System.IO;
namespace ACE.DatLoader.Entity
{
public class ObjDesc : IUnpackable
{
public uint PaletteID { get; private set; }
public List<SubPalette> SubPalettes { get; } = new List<SubPalette>();
public List<TextureMapChange> TextureChanges { get; } = new List<TextureMapChange>();
public List<AnimationPartChange> AnimPartChanges { get; } = new List<AnimationPartChange>();
public void Unpack(BinaryReader reader)
{
reader.AlignBoundary();
reader.ReadByte(); // ObjDesc always starts with 11.
var numPalettes = reader.ReadByte();
var numTextureMapChanges = reader.ReadByte();
var numAnimPartChanges = reader.ReadByte();
if (numPalettes > 0)
PaletteID = reader.ReadAsDataIDOfKnownType(0x04000000);
SubPalettes.Unpack(reader, numPalettes);
TextureChanges.Unpack(reader, numTextureMapChanges);
AnimPartChanges.Unpack(reader, numAnimPartChanges);
reader.AlignBoundary();
}
}
}