ace/Source/ACE.DatLoader/Entity/SubPalette.cs
Mag-nus 33985196fb
Make Dat SubPalette and TextureMapChanges properties public (#2094)
This allows other tools to instantiate these objects and set new values.

This is used by OptimShis Palette decoder and my retail character importer.

I was always on the fence about these dat properties being public. The risk is that a developer could modify a property in ACE. That property would then persist to the cached at object, and would be re-used until ACE was restarted.

This happens because dat objects are cached, and that same instance is returned on subsequent requests.

However, if we are ever to have 3rd party Dat editor tools, these properties will need to be public anyway.
2019-07-11 09:15:44 -05:00

24 lines
629 B
C#

using System.IO;
namespace ACE.DatLoader.Entity
{
// TODO: refactor to use existing PaletteOverride object
public class SubPalette : IUnpackable
{
public uint SubID { get; set; }
public uint Offset { get; set; }
public uint NumColors { get; set; }
public void Unpack(BinaryReader reader)
{
SubID = reader.ReadAsDataIDOfKnownType(0x04000000);
Offset = (uint)(reader.ReadByte() * 8);
NumColors = reader.ReadByte();
if (NumColors == 0)
NumColors = 256;
NumColors *= 8;
}
}
}