using System;
using System.IO;
using System.Runtime.InteropServices;

namespace MindPowerSdk
{
    [StructLayout(LayoutKind.Sequential, Pack = 1)]
    public unsafe struct SNewFileTile
    {
        //      DWORD	dwTileInfo;	// 保存3个layer的tex no和alpha no
        //      BYTE	btTileInfo; // 最下层的tex no
        //      short	sColor;		// 32bit的颜色保存为565
        //      char	cHeight;	// 每10cm为一级来保存高度
        //      short	sRegion;	
        //      BYTE	btIsland;
        //      BYTE	btBlock[4];

        public uint dwTileInfo;
        public byte btTileInfo;
        public short Color;
        public sbyte Height;
        public short Region;
        public byte IsLand;
        public fixed byte Block[4];

        public static SNewFileTile Load(BinaryReader reader)
        {
            SNewFileTile s = new SNewFileTile();
            Span<byte> bytes = new Span<byte>(&s, sizeof(SNewFileTile));
            reader.Read(bytes);
            return s;
        }
    }
}