static void ReadMLIQ(BinaryReader file, WMOGroup group)
{
group.LiquidInfo = new LiquidInfo
{
XVertexCount = file.ReadInt32(),
YVertexCount = file.ReadInt32(),
XTileCount = file.ReadInt32(),
YTileCount = file.ReadInt32(),
BaseCoordinates = file.ReadVector3(),
MaterialId = file.ReadUInt16()
};
// The following is untested, but is what the client appears to be doing
// These are probably similar to the 2 floats in the old adt water chunk
group.LiquidInfo.HeightMapMax = new float[group.LiquidInfo.XVertexCount, group.LiquidInfo.YVertexCount];
group.LiquidInfo.HeightMapMin = new float[group.LiquidInfo.XVertexCount, group.LiquidInfo.YVertexCount];
// This is different from the other ADT files, these are stored as [row, col] instead of [col, row]
for (var y = 0; y < group.LiquidInfo.YVertexCount; y++)
{
for (var x = 0; x < group.LiquidInfo.XVertexCount; x++)
{
// The first value is never used ...
group.LiquidInfo.HeightMapMin[x, y] = file.ReadSingle();
group.LiquidInfo.HeightMapMax[x, y] = file.ReadSingle();
}
}
group.LiquidInfo.LiquidTileFlags = new byte[group.LiquidInfo.XTileCount, group.LiquidInfo.YTileCount];
for (var y = 0; y < group.LiquidInfo.YTileCount; y++)
{
for (var x = 0; x < group.LiquidInfo.XTileCount; x++)
{
group.LiquidInfo.LiquidTileFlags[x, y] = file.ReadByte();
}
}
}