Ejemplo n.º 1
0
        public void Deserialize(BinaryReader reader)
        {
            Width           = reader.ReadInt32();
            Height          = reader.ReadInt32();
            Stories         = reader.ReadInt32();
            Terrain         = new VMArchitectureTerrain(Width, Height);
            Terrain.Version = Version;
            if (Version > 6)
            {
                Terrain.Deserialize(reader);
            }

            var size = Width * Height;

            Walls = new WallTile[Stories][];
            for (int l = 0; l < Stories; l++)
            {
                Walls[l] = new WallTile[size];
                for (int i = 0; i < size; i++)
                {
                    Walls[l][i] = WallTileSerializer.Deserialize(reader);
                }
            }

            Floors = new FloorTile[Stories][];
            for (int l = 0; l < Stories; l++)
            {
                Floors[l] = new FloorTile[size];
                for (int i = 0; i < size; i++)
                {
                    Floors[l][i] = new FloorTile {
                        Pattern = reader.ReadUInt16()
                    }
                }
                ;
            }

            WallsDirty  = reader.ReadBoolean();
            FloorsDirty = reader.ReadBoolean();

            if (Version > 13)
            {
                RoofStyle = reader.ReadUInt32();
                RoofPitch = reader.ReadSingle();
            }
        }
Ejemplo n.º 2
0
        public void Deserialize(BinaryReader reader)
        {
            Width           = reader.ReadInt32();
            Height          = reader.ReadInt32();
            Stories         = reader.ReadInt32();
            Terrain         = new VMArchitectureTerrain(Width, Height);
            Terrain.Version = Version;
            if (Version > 6)
            {
                Terrain.Deserialize(reader);
            }

            var size = Width * Height;

            Walls = new WallTile[Stories][];
            for (int l = 0; l < Stories; l++)
            {
                Walls[l] = new WallTile[size];
                for (int i = 0; i < size; i++)
                {
                    Walls[l][i] = WallTileSerializer.Deserialize(reader);
                }
            }

            Floors = new FloorTile[Stories][];
            for (int l = 0; l < Stories; l++)
            {
                Floors[l] = new FloorTile[size];
                for (int i = 0; i < size; i++)
                {
                    Floors[l][i] = new FloorTile {
                        Pattern = reader.ReadUInt16()
                    }
                }
                ;
            }

            WallsDirty  = reader.ReadBoolean();
            FloorsDirty = reader.ReadBoolean();

            if (Version > 13)
            {
                RoofStyle = reader.ReadUInt32();
                RoofPitch = reader.ReadSingle();
            }

            if (Version > 21)
            {
                var hasIDMap = reader.ReadBoolean();
                if (hasIDMap)
                {
                    IDMap = new VMResourceIDMarshal();
                    IDMap.Deserialize(reader);
                }
            }

            if (Version > 22)
            {
                var hasFineBuild = reader.ReadBoolean();
                if (hasFineBuild)
                {
                    FineBuildableArea = reader.ReadBytes(size).Select(x => x > 0).ToArray();
                }
            }
            if (Version > 25)
            {
                BuildBuyEnabled = reader.ReadBoolean();
            }
        }