예제 #1
0
        public override void Unpack(BinaryReader reader)
        {
            Id = reader.ReadUInt32();

            RegionNumber = reader.ReadUInt32();
            Version      = reader.ReadUInt32();
            RegionName   = reader.ReadPString();    // "Dereth" in newer versions, "Lands of Dereth" in older
            reader.AlignBoundary();

            LandDefs.Unpack(reader);
            GameTime.Unpack(reader);

            PartsMask = reader.ReadUInt32();

            var curOffset = reader.BaseStream.Position;

            try
            {
                if ((PartsMask & 0x10) != 0)
                {
                    SkyInfo.Unpack(reader);
                }
            }
            catch
            {
                // At some point post TOD, the SkyObject had "properties" added to it.
                // Since we don't know when, this tries to catch that and revert to the old reading method before resetting back the status to TOD.
                if (DatManager.DatVersion == DatVersionType.ACTOD)
                {
                    reader.BaseStream.Position = curOffset;
                    DatManager.DatVersion      = DatVersionType.ACDM;
                    if ((PartsMask & 0x10) != 0)
                    {
                        SkyInfo.Unpack(reader);
                    }
                    DatManager.DatVersion = DatVersionType.ACTOD;
                }
            }

            if ((PartsMask & 0x01) != 0)
            {
                SoundInfo.Unpack(reader);
            }

            if ((PartsMask & 0x02) != 0)
            {
                SceneInfo.Unpack(reader);
            }

            TerrainInfo.Unpack(reader);

            if ((PartsMask & 0x0200) != 0)
            {
                RegionMisc.Unpack(reader);
            }
        }
예제 #2
0
        public override void Unpack(BinaryReader reader)
        {
            Id = reader.ReadUInt32();

            RegionNumber = reader.ReadUInt32();
            Version      = reader.ReadUInt32();
            RegionName   = reader.ReadPString();    // "Dereth"
            reader.AlignBoundary();

            LandDefs.Unpack(reader);
            GameTime.Unpack(reader);

            PartsMask = reader.ReadUInt32();

            if ((PartsMask & 0x10) != 0)
            {
                SkyInfo.Unpack(reader);
            }

            if ((PartsMask & 0x01) != 0)
            {
                SoundInfo.Unpack(reader);
            }

            if ((PartsMask & 0x02) != 0)
            {
                SceneInfo.Unpack(reader);
            }

            TerrainInfo.Unpack(reader);

            if ((PartsMask & 0x0200) != 0)
            {
                RegionMisc.Unpack(reader);
            }
        }