Exemple #1
0
        internal void Load(SaveFileReader reader, Game game)
        {
            reader.ReadVersion(2);
            reader.ReadVersion(1);

            var unknownBool1 = reader.ReadBoolean();

            if (unknownBool1)
            {
                throw new InvalidDataException();
            }

            var area = reader.ReadUInt32();

            if (area != game.Scene3D.MapFile.HeightMapData.Area)
            {
                throw new InvalidDataException();
            }

            var width      = game.Scene3D.MapFile.HeightMapData.Width;
            var height     = game.Scene3D.MapFile.HeightMapData.Height;
            var elevations = game.Scene3D.MapFile.HeightMapData.Elevations;

            for (var y = 0; y < height; y++)
            {
                for (var x = 0; x < width; x++)
                {
                    elevations[x, y] = reader.ReadByte();
                }
            }

            // TODO: Not great to create the initial patches,
            // then recreate them here.
            game.Scene3D.Terrain.OnHeightMapChanged();
        }
Exemple #2
0
        internal void Load(SaveFileReader reader, Game game)
        {
            reader.ReadVersion(2);
            reader.ReadVersion(1);

            var unknownBool1 = reader.ReadBoolean();

            if (unknownBool1)
            {
                reader.ReadVersion(1);

                // Matches VertexWaterXGridCellsN and VertexWaterYGridCellsN in GameData.ini
                var gridCellsX = reader.ReadInt32();
                var gridCellsY = reader.ReadInt32();

                // Don't know why, but this gives the correct length for this array.
                var dataCount = (gridCellsX + 3) * (gridCellsY + 3) * 10;
                for (var i = 0; i < dataCount; i++)
                {
                    var unknown3 = reader.ReadByte();
                    if (unknown3 != 0)
                    {
                        throw new InvalidDataException();
                    }
                }
            }

            var area = reader.ReadUInt32();

            if (area != game.Scene3D.MapFile.HeightMapData.Area)
            {
                throw new InvalidDataException();
            }

            var width      = game.Scene3D.MapFile.HeightMapData.Width;
            var height     = game.Scene3D.MapFile.HeightMapData.Height;
            var elevations = game.Scene3D.MapFile.HeightMapData.Elevations;

            for (var y = 0; y < height; y++)
            {
                for (var x = 0; x < width; x++)
                {
                    elevations[x, y] = reader.ReadByte();
                }
            }

            // TODO: Not great to create the initial patches,
            // then recreate them here.
            game.Scene3D.Terrain.OnHeightMapChanged();
        }
Exemple #3
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();
            }
        }
        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();
        }
Exemple #5
0
        internal void Load(SaveFileReader reader)
        {
            reader.ReadVersion(1);

            var numScripts = reader.ReadUInt16();

            if (numScripts != Scripts.Length)
            {
                throw new InvalidDataException();
            }

            for (var i = 0; i < numScripts; i++)
            {
                Scripts[i].Load(reader);
            }

            var numScriptGroups = reader.ReadUInt16();

            if (numScriptGroups != ScriptGroups.Length)
            {
                throw new InvalidDataException();
            }

            for (var i = 0; i < numScriptGroups; i++)
            {
                ScriptGroups[i].Load(reader);
            }
        }
Exemple #6
0
        internal virtual void Load(SaveFileReader reader)
        {
            reader.ReadVersion(1);

            var frameSomething2 = reader.ReadUInt32();
            var unknownInt4     = reader.ReadUInt32();

            var currentStateID = reader.ReadUInt32();

            _currentState = GetState(currentStateID);

            var unknownBool1 = reader.ReadBoolean();

            if (unknownBool1)
            {
                throw new InvalidDataException();
            }

            _currentState.Load(reader);

            var unknownInt9        = reader.ReadUInt32();
            var positionSomething3 = reader.ReadVector3();
            var unknownBool4       = reader.ReadBoolean();
            var unknownBool5       = reader.ReadBoolean();
        }
Exemple #7
0
        internal void Load(SaveFileReader reader)
        {
            reader.ReadVersion(2);

            var playerId = reader.ReadUInt32();

            if (playerId != Owner.Id)
            {
                throw new InvalidDataException();
            }

            _attackPriorityName = reader.ReadAsciiString();

            var unknown2 = reader.ReadBoolean();

            _templateData.Load(reader);

            var teamCount = reader.ReadUInt16();

            for (var i = 0; i < teamCount; i++)
            {
                var id = reader.ReadUInt32();

                var team = FindTeamById(id);
                if (team == null)
                {
                    team    = TeamFactory.AddTeam(this);
                    team.Id = id;
                }

                team.Load(reader);
            }
        }
Exemple #8
0
        internal override void Load(SaveFileReader reader)
        {
            reader.ReadVersion(1);

            var unknownShort1 = reader.ReadUInt16();
            var unknownShort2 = reader.ReadUInt16();
        }
Exemple #9
0
        internal void Load(SaveFileReader reader, PlayerManager players)
        {
            reader.ReadVersion(2);

            // This will be the same as the existing Owner, unless control of this team has been transferred.
            var ownerPlayerId = reader.ReadUInt32();

            Owner = players.GetPlayerByIndex(ownerPlayerId);

            _attackPriorityName = reader.ReadAsciiString();

            var unknown2 = reader.ReadBoolean();

            _templateData.Load(reader);

            var teamCount = reader.ReadUInt16();

            for (var i = 0; i < teamCount; i++)
            {
                var id = reader.ReadUInt32();

                var team = FindTeamById(id);
                if (team == null)
                {
                    team    = TeamFactory.AddTeam(this);
                    team.Id = id;
                }

                team.Load(reader);
            }
        }
Exemple #10
0
            internal override void Load(SaveFileReader reader)
            {
                reader.ReadVersion(1);

                var unknownBool1 = reader.ReadBoolean();
                var unknownBool2 = reader.ReadBoolean();
            }
Exemple #11
0
        internal void Load(SaveFileReader reader)
        {
            reader.ReadVersion(2);

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

            // TODO: Superweapon something...
            var something = reader.ReadUInt32();

            while (something != uint.MaxValue) // A way to store things the engine doesn't know the length of?
            {
                var someString1 = reader.ReadAsciiString();
                var someString2 = reader.ReadAsciiString();
                var unknown1    = reader.ReadUInt32();
                var unknown2    = reader.ReadUInt32(); // 0xFFFFFFFF
                reader.ReadBoolean();
                reader.ReadBoolean();
                reader.ReadBoolean();

                something = reader.ReadUInt32();
            }
        }
Exemple #12
0
        internal override void Load(SaveFileReader reader)
        {
            reader.ReadVersion(1);

            base.Load(reader);

            var unknownInt1 = reader.ReadUInt32();
        }
Exemple #13
0
        internal override void Load(SaveFileReader reader)
        {
            reader.ReadVersion(1);

            base.Load(reader);

            _stateMachine.Load(reader);
        }
Exemple #14
0
        internal override void Load(SaveFileReader reader)
        {
            reader.ReadVersion(1);

            base.Load(reader);

            var containerObjectId = reader.ReadObjectID();
        }
Exemple #15
0
        internal override void Load(SaveFileReader reader)
        {
            reader.ReadVersion(1);

            var unknownBool1 = reader.ReadBoolean();

            _stateMachine.Load(reader);
        }
        internal override void Load(SaveFileReader reader)
        {
            reader.ReadVersion(1);

            base.Load(reader);

            var waypointId = reader.ReadUInt32();
        }
Exemple #17
0
        internal override void Load(SaveFileReader reader)
        {
            reader.ReadVersion(1);

            var unknownBool2      = reader.ReadBoolean();
            var positionSomething = reader.ReadVector3();

            _stateMachine.Load(reader);
        }
Exemple #18
0
        internal void Load(SaveFileReader reader, GameLogic gameLogic, Game game)
        {
            reader.ReadVersion(1);
            reader.ReadVersion(1);

            var unknown1 = reader.ReadUInt32();

            var ghostObjectCount = reader.ReadUInt16();

            for (var i = 0; i < ghostObjectCount; i++)
            {
                var objectId   = reader.ReadObjectID();
                var gameObject = gameLogic.GetObjectById(objectId);

                var ghostObject = new GhostObject(); // TODO
                ghostObject.Load(reader, gameLogic, game);
            }
        }
Exemple #19
0
        internal override void Load(SaveFileReader reader)
        {
            reader.ReadVersion(2);

            base.Load(reader);

            var guardObjectId = reader.ReadObjectID();

            var guardPosition = reader.ReadVector3();
        }
Exemple #20
0
 public void Load(SaveFileReader reader)
 {
     reader.ReadVersion(1);
     Type        = reader.ReadEnum <ObjectGeometry>();
     IsSmall     = reader.ReadBoolean();
     Height      = reader.ReadSingle();
     MajorRadius = reader.ReadSingle();
     MinorRadius = reader.ReadSingle();
     var unknown1 = reader.ReadSingle();
     var unknown2 = reader.ReadSingle();
 }
Exemple #21
0
        internal void Load(SaveFileReader reader)
        {
            reader.ReadVersion(2);

            BuildingName = reader.ReadAsciiString();
            Name         = reader.ReadAsciiString();
            Position     = reader.ReadVector3();

            var unknown1 = reader.ReadUInt32();

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

            var unknown2 = reader.ReadUInt32();

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

            Angle = reader.ReadSingle();

            var unknown3 = reader.ReadBoolean();

            Rebuilds = reader.ReadByte();

            var unknown5 = reader.ReadUInt32();

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

            StartingHealth = reader.ReadUInt32();

            var unknown6  = reader.ReadBoolean();
            var unknown7  = reader.ReadBoolean();
            var unknown8  = reader.ReadBoolean();
            var unknown9  = reader.ReadBoolean();
            var unknown10 = reader.ReadUInt32();
            var unknown11 = reader.ReadUInt32();
            var unknown12 = reader.ReadBoolean();

            for (var i = 0; i < 50; i++)
            {
                var unknown13 = reader.ReadByte();
                if (unknown13 != 0)
                {
                    //throw new InvalidDataException();
                }
            }
        }
Exemple #22
0
        internal override void Load(SaveFileReader reader)
        {
            reader.ReadVersion(1);

            var unknownBool = reader.ReadBoolean();

            if (!unknownBool)
            {
                throw new InvalidDataException();
            }
        }
Exemple #23
0
        internal override void Load(SaveFileReader reader)
        {
            reader.ReadVersion(2);

            base.Load(reader);

            var unknownInt1 = reader.ReadInt32();
            var unknownInt2 = reader.ReadInt32();

            _stateMachine.Load(reader);
        }
Exemple #24
0
        internal void Load(SaveFileReader reader)
        {
            reader.ReadVersion(1);

            reader.ReadVersion(2);

            var unknown = reader.ReadInt32();

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

            var unknown2 = reader.ReadInt32();

            if (unknown2 != 0)
            {
                throw new InvalidDataException();
            }
        }
Exemple #25
0
        internal override void Load(SaveFileReader reader)
        {
            reader.ReadVersion(1);

            var positionSomething  = reader.ReadVector3();
            var unknownInt1        = reader.ReadUInt32();
            var unknownBool1       = reader.ReadBoolean();
            var positionSomething2 = reader.ReadVector3();
            var unknownInt2        = reader.ReadUInt32();
            var unknownInt3        = reader.ReadUInt32();
            var unknownBool2       = reader.ReadBoolean();
        }
        // TODO: Actual implementation

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

            _increasingColorDelta = reader.ReadVector3();
            _decreasingColorDelta = reader.ReadVector3();
            _targetColor          = reader.ReadVector3();
            _currentColor         = reader.ReadVector3();
            _holdFrames           = reader.ReadUInt32();
            _isActive             = reader.ReadBoolean();
            _state = reader.ReadEnumByte <ColorFlashState>();
        }
Exemple #27
0
        internal override void Load(SaveFileReader reader)
        {
            reader.ReadVersion(1);

            var unknownBool1 = reader.ReadBoolean();

            if (!unknownBool1)
            {
                throw new InvalidDataException();
            }

            _stateMachine.Load(reader);
        }
Exemple #28
0
        internal void Load(SaveFileReader reader)
        {
            reader.ReadVersion(1);

            Name = reader.ReadAsciiString();

            var numObjects = reader.ReadUInt16();

            for (var j = 0; j < numObjects; j++)
            {
                _objectTypes.Add(reader.ReadAsciiString());
            }
        }
Exemple #29
0
        internal override void Load(SaveFileReader reader)
        {
            reader.ReadVersion(1);

            base.Load(reader);

            var numPositionsSomething = reader.ReadUInt32();

            for (var i = 0; i < numPositionsSomething; i++)
            {
                var positionSomething = reader.ReadVector3();
            }
        }
Exemple #30
0
        internal override void Load(SaveFileReader reader)
        {
            reader.ReadVersion(1);

            base.Load(reader);

            var unknownInt0      = reader.ReadUInt32();
            var unknownInt1      = reader.ReadUInt32();
            var unknownInt2      = reader.ReadUInt32();
            var unknownInt3      = reader.ReadUInt32();
            var waypointIdMaybe  = reader.ReadUInt32();
            var waypointId2Maybe = reader.ReadUInt32();
            var unknownBool1     = reader.ReadBoolean();
        }