Esempio n. 1
0
        internal void Load(SaveFileReader reader)
        {
            reader.ReadVersion(1);

            var numLocomotorTemplates = reader.ReadUInt16();

            for (var i = 0; i < numLocomotorTemplates; i++)
            {
                var locomotorTemplateName = reader.ReadAsciiString();

                var locomotorTemplate = _gameObject.GameContext.AssetLoadContext.AssetStore.LocomotorTemplates.GetByName(locomotorTemplateName);

                var locomotor = new Locomotor(_gameObject, locomotorTemplate, 100);

                locomotor.Load(reader);

                _locomotors.Add(locomotor);
            }

            _surfaces = reader.ReadEnumFlags <Surfaces>();

            var unknownBool1 = reader.ReadBoolean();

            if (unknownBool1 != false)
            {
                throw new InvalidDataException();
            }
        }
Esempio n. 2
0
        internal void Load(SaveFileReader reader)
        {
            reader.ReadVersion(1);

            // This is the object definition which defined the WeaponSet
            // (either a normal object or DefaultThingTemplate)
            var objectDefinitionName = reader.ReadAsciiString();

            var conditions = reader.ReadBitArray <WeaponSetConditions>();

            _currentWeaponTemplateSet = _gameObject.Definition.WeaponSets[conditions];

            // In Generals there are 3 possible weapons.
            // Later games have up to 5.
            for (var i = 0; i < 3; i++)
            {
                var slotFilled = reader.ReadBoolean();
                if (slotFilled)
                {
                    _weapons[i] = new Weapon(_gameObject, _currentWeaponTemplateSet.Slots[i].Weapon.Value, (WeaponSlot)i, _gameObject.GameContext);
                    _weapons[i].Load(reader);
                }
                else
                {
                    _weapons[i] = null;
                }
            }

            _currentWeaponSlot = reader.ReadEnum <WeaponSlot>();

            var unknown2 = reader.ReadUInt32();

            _filledWeaponSlots = reader.ReadUInt32();
            _combinedAntiMask  = reader.ReadEnumFlags <WeaponAntiFlags>();

            var unknown5 = reader.ReadUInt32();

            var unknownBool1 = reader.ReadBoolean();
            var unknownBool2 = reader.ReadBoolean();
        }