private static Dictionary <int, BuildSector> ReadSectors(MapSet map, BinaryReader reader)
{
int count = reader.ReadInt32();
// Create lookup table
var link = new Dictionary <int, BuildSector>(count);
// Go for all collections
map.SetCapacity(0, 0, 0, map.Sectors.Count + count, 0);
for (int i = 0; i < count; i++)
{
BuildSector bs = new BuildSector();
// Read Build properteis
bs.FirstWallIndex = reader.ReadInt32();
bs.CeilingHeight = reader.ReadInt32();
bs.FloorHeight = reader.ReadInt32();
bs.CeilingTileIndex = reader.ReadInt32();
bs.CeilingSlope = reader.ReadInt32();
bs.CeilingShade = reader.ReadInt32();
bs.CeilingPaletteIndex = reader.ReadInt32();
bs.CeilingOffsetX = reader.ReadInt32();
bs.CeilingOffsetY = reader.ReadInt32();
bs.FloorTileIndex = reader.ReadInt32();
bs.FloorSlope = reader.ReadInt32();
bs.FloorShade = reader.ReadInt32();
bs.FloorPaletteIndex = reader.ReadInt32();
bs.FloorOffsetX = reader.ReadInt32();
bs.FloorOffsetY = reader.ReadInt32();
bs.Visibility = reader.ReadInt32();
bs.HiTag = reader.ReadInt32();
bs.LoTag = reader.ReadInt32();
bs.Extra = reader.ReadInt32();
// Flags
bs.CeilingFlags = ReadFlags(reader, General.Map.Config.SectorFlags.Keys);
bs.FloorFlags = ReadFlags(reader, General.Map.Config.SectorFlags.Keys);
// Create new item
Sector s = map.CreateSector();
if (s != null)
{
// Set properties
s.Update(bs);
bs.Sector = s;
// Add it to the lookup table
link.Add(i, bs);
}
}
// Return lookup table
return(link);
}