Пример #1
0
        internal void Load(SaveFileReader reader)
        {
            reader.ReadVersion(3);

            _currentFrame = reader.ReadUInt32();

            _objectDefinitionLookupTable.Load(reader);

            var drawablesCount = reader.ReadUInt16();

            for (var i = 0; i < drawablesCount; i++)
            {
                var objectDefinitionId = reader.ReadUInt16();
                var objectDefinition   = _objectDefinitionLookupTable.GetById(objectDefinitionId);

                reader.BeginSegment();

                var objectID   = reader.ReadUInt32();
                var gameObject = _gameLogic.GetObjectById(objectID);

                gameObject.Drawable.Load(reader);

                reader.EndSegment();
            }

            reader.ReadUInt32();
        }
Пример #2
0
        public void Load(SaveFileReader reader)
        {
            reader.ReadVersion(9);

            _currentFrame = reader.ReadUInt32();

            _objectDefinitionLookupTable.Load(reader);

            var gameObjectsCount = reader.ReadUInt32();

            _objects.Clear();
            _objects.Capacity = (int)gameObjectsCount;

            for (var i = 0; i < gameObjectsCount; i++)
            {
                var objectDefinitionId = reader.ReadUInt16();
                var objectDefinition   = _objectDefinitionLookupTable.GetById(objectDefinitionId);

                var gameObject = _scene3D.GameObjects.Add(objectDefinition, _scene3D.LocalPlayer);

                reader.BeginSegment();

                gameObject.Load(reader);

                while (_objects.Count <= gameObject.ID)
                {
                    _objects.Add(null);
                }
                _objects[(int)gameObject.ID] = gameObject;

                reader.EndSegment();
            }

            reader.ReadByte(); // 3

            var sideName    = reader.ReadAsciiString();
            var missionName = reader.ReadAsciiString();

            reader.__Skip(12);

            var numPolygonTriggers = reader.ReadUInt32();

            if (numPolygonTriggers != _scene3D.MapFile.PolygonTriggers.Triggers.Length)
            {
                throw new InvalidDataException();
            }
            for (var i = 0; i < numPolygonTriggers; i++)
            {
                var id             = reader.ReadUInt32();
                var polygonTrigger = _scene3D.MapFile.PolygonTriggers.GetPolygonTriggerById(id);
                polygonTrigger.Load(reader);
            }

            _rankLevelLimit = reader.ReadUInt32();

            var unknown2 = reader.ReadUInt32();

            if (unknown2 != 0)
            {
                throw new InvalidDataException();
            }

            while (true)
            {
                var objectDefinitionName = reader.ReadAsciiString();
                if (objectDefinitionName == "")
                {
                    break;
                }

                var buildableStatus = reader.ReadEnum <ObjectBuildableType>();

                _techTreeOverrides.Add(
                    objectDefinitionName,
                    buildableStatus);
            }

            if (!reader.ReadBoolean())
            {
                throw new InvalidDataException();
            }

            if (!reader.ReadBoolean())
            {
                throw new InvalidDataException();
            }

            if (!reader.ReadBoolean())
            {
                throw new InvalidDataException();
            }

            var unknown3 = reader.ReadUInt32();

            if (unknown3 != uint.MaxValue)
            {
                throw new InvalidDataException();
            }

            // Command button overrides
            while (true)
            {
                var commandSetNamePrefixedWithCommandButtonIndex = reader.ReadAsciiString();
                if (commandSetNamePrefixedWithCommandButtonIndex == "")
                {
                    break;
                }

                var unknownBool1 = reader.ReadBoolean();
                if (unknownBool1)
                {
                    throw new InvalidDataException();
                }
            }

            var unknown4 = reader.ReadUInt32();

            if (unknown4 != 0)
            {
                throw new InvalidDataException();
            }
        }
Пример #3
0
        public void Load(SaveFileReader reader)
        {
            reader.ReadVersion(9);

            _currentFrame = reader.ReadUInt32();

            _objectDefinitionLookupTable.Load(reader);

            var gameObjectsCount = reader.ReadUInt32();

            _objects.Clear();
            _objects.Capacity = (int)gameObjectsCount;

            for (var i = 0; i < gameObjectsCount; i++)
            {
                var objectDefinitionId = reader.ReadUInt16();
                var objectDefinition   = _objectDefinitionLookupTable.GetById(objectDefinitionId);

                var gameObject = _scene3D.GameObjects.Add(objectDefinition, _scene3D.LocalPlayer);

                reader.BeginSegment();

                gameObject.Load(reader);

                while (_objects.Count <= gameObject.ID)
                {
                    _objects.Add(null);
                }
                _objects[(int)gameObject.ID] = gameObject;

                reader.EndSegment();
            }

            reader.ReadByte(); // 3

            var sideName    = reader.ReadAsciiString();
            var missionName = reader.ReadAsciiString();

            reader.__Skip(12);

            var someCount4 = reader.ReadUInt32();

            for (var i = 0; i < someCount4; i++)
            {
                var maybeIndex = reader.ReadUInt32();
                reader.ReadBoolean(); // 1
                var someCount5 = reader.ReadUInt32();
                for (var j = 0; j < someCount5; j++)
                {
                    reader.ReadUInt32();
                    reader.ReadUInt32();
                    reader.ReadUInt32();
                }
                reader.ReadUInt32();
                reader.ReadUInt32();
                reader.ReadUInt32();
                reader.ReadUInt32();
                reader.ReadSingle();
                reader.ReadBoolean();
            }

            reader.ReadUInt32();  // 1000
            reader.ReadUInt32();  // 0
            reader.ReadBoolean(); // 0
            reader.ReadBoolean(); // 1
            reader.ReadBoolean(); // 1
            reader.ReadBoolean(); // 1
            reader.ReadUInt32();  // 0xFFFFFFFF



            reader.ReadUInt32();  // 0
            reader.ReadBoolean(); // 0
        }