コード例 #1
0
        internal override void Load(SaveFileReader reader)
        {
            reader.ReadVersion(2);

            base.Load(reader);

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

            _stateMachine.Load(reader);
        }
コード例 #2
0
ファイル: TerrainVisual.cs プロジェクト: DarkAtra/OpenSAGE
        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();
        }
コード例 #3
0
        internal void Load(SaveFileReader reader)
        {
            State      = reader.ReadEnum <SkirmishSlotState>();
            PlayerName = reader.ReadUnicodeString();

            var unknown1 = reader.ReadUInt16();

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

            ColorIndex    = (sbyte)reader.ReadInt32();
            StartPosition = (byte)reader.ReadInt32();

            // Bit ugly... this is really an index into player templates,
            // but FactionIndex only counts playable sides... and also is 1-based.
            FactionIndex = (byte)(reader.ReadInt32() - 1);

            Team = (sbyte)reader.ReadInt32();

            var colorChosen               = reader.ReadInt32();
            var startPositionChosen       = reader.ReadInt32();
            var playerTemplateIndexChosen = reader.ReadInt32();
        }
コード例 #4
0
ファイル: AIStateMachine.cs プロジェクト: wrightjjw/OpenSAGE
        internal override void Load(SaveFileReader reader)
        {
            reader.ReadVersion(1);

            base.Load(reader);

            var unknownInt1  = reader.ReadInt32();
            var unknownBool1 = reader.ReadBoolean();
            var unknownBool2 = reader.ReadBoolean();
        }
コード例 #5
0
ファイル: TerrainLogic.cs プロジェクト: wrightjjw/OpenSAGE
        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();
            }
        }
コード例 #6
0
        public void Load(SaveFileReader reader)
        {
            reader.ReadVersion(1);

            Unknown1 = reader.ReadUInt32();

            TeamID            = reader.ReadUInt32();
            ScriptName        = reader.ReadAsciiString();
            ScriptActionIndex = reader.ReadUInt32();
            LoopsRemaining    = reader.ReadUInt32();

            Unknown2 = reader.ReadInt32();
            if (Unknown2 != -1)
            {
                throw new InvalidDataException();
            }

            Unknown3 = reader.ReadByte();
            if (Unknown3 != 0)
            {
                throw new InvalidDataException();
            }
        }
コード例 #7
0
ファイル: TeamTemplate.cs プロジェクト: DarkAtra/OpenSAGE
        internal void Load(SaveFileReader reader)
        {
            reader.ReadVersion(1);

            ProductionPriority = reader.ReadInt32();
        }
コード例 #8
0
ファイル: ScriptingSystem.cs プロジェクト: wrightjjw/OpenSAGE
        internal void Load(SaveFileReader reader)
        {
            reader.ReadVersion(5);

            var numSequentialScripts = reader.ReadUInt16();

            for (var i = 0; i < numSequentialScripts; i++)
            {
                var sequentialScript = new SequentialScript();
                sequentialScript.Load(reader);
            }

            var numTimersAndCounters = reader.ReadUInt32();

            var unknown2 = reader.ReadUInt32();

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

            for (var i = 1; i < numTimersAndCounters; i++)
            {
                var value  = reader.ReadInt32();
                var name   = reader.ReadAsciiString();
                var active = reader.ReadBoolean();
            }

            var numTimersAndCounters2 = reader.ReadUInt32();

            if (numTimersAndCounters2 != numTimersAndCounters)
            {
                throw new InvalidDataException();
            }

            var numFlags = reader.ReadUInt32();

            for (var i = 1; i < numFlags; i++)
            {
                var value = reader.ReadBoolean();
                var name  = reader.ReadAsciiString();
            }

            var numFlags2 = reader.ReadUInt32();

            if (numFlags2 != numFlags)
            {
                throw new InvalidDataException();
            }

            var numAttackPrioritySets = reader.ReadUInt16();

            reader.__Skip(8); // TODO

            for (var i = 1; i < numAttackPrioritySets; i++)
            {
                var attackPriority = new AttackPriority();
                attackPriority.Load(reader);
            }

            var numAttackPrioritySets2 = reader.ReadUInt32();

            if (numAttackPrioritySets2 != numAttackPrioritySets)
            {
                throw new InvalidDataException();
            }

            var unknown7 = reader.ReadInt32();

            if (unknown7 != -1)
            {
                throw new InvalidDataException();
            }

            var unknown8 = reader.ReadInt32();

            if (unknown8 != -1)
            {
                throw new InvalidDataException();
            }

            var unknownCount = reader.ReadUInt16();

            for (var i = 0; i < unknownCount; i++)
            {
                var objectName = reader.ReadAsciiString();
                var someId     = reader.ReadUInt32();
            }

            var unknown9 = reader.ReadByte();

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

            CameraFadeOverlay.Load(reader);

            reader.__Skip(12);

            var numSpecialPowerSets = reader.ReadUInt16(); // Maybe not sides, maybe player count?

            for (var i = 0; i < numSpecialPowerSets; i++)
            {
                var version = reader.ReadByte();

                var numSpecialPowers = reader.ReadUInt16();
                for (var j = 0; j < numSpecialPowers; j++)
                {
                    var name      = reader.ReadAsciiString();
                    var timestamp = reader.ReadUInt32();
                }
            }

            var numUnknown1Sets = reader.ReadUInt16();

            for (var i = 0; i < numUnknown1Sets; i++)
            {
                var version = reader.ReadByte();

                var count = reader.ReadUInt16();
                if (count != 0)
                {
                    throw new InvalidDataException();
                }
            }

            var numUnknown2Sets = reader.ReadUInt16();

            for (var i = 0; i < numUnknown2Sets; i++)
            {
                var version = reader.ReadByte();

                var count = reader.ReadUInt16();
                if (count != 0)
                {
                    throw new InvalidDataException();
                }
            }

            var numUpgradeSets = reader.ReadUInt16();

            for (var i = 0; i < numUpgradeSets; i++)
            {
                var version = reader.ReadByte();

                var numUpgrades = reader.ReadUInt16();
                for (var j = 0; j < numUpgrades; j++)
                {
                    var name      = reader.ReadAsciiString();
                    var timestamp = reader.ReadUInt32();
                }
            }

            var numScienceSets = reader.ReadUInt16();

            for (var i = 0; i < numScienceSets; i++)
            {
                var version = reader.ReadByte();

                var numSciences = reader.ReadUInt16();
                for (var j = 0; j < numSciences; j++)
                {
                    var name = reader.ReadAsciiString();
                }
            }

            var unknown14_1 = reader.ReadByte();

            if (unknown14_1 != 1)
            {
                throw new InvalidDataException();
            }

            var unknown14_2 = reader.ReadUInt16();

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

            for (var i = 0; i < 6; i++)
            {
                var unknown15 = reader.ReadSingle();
            }

            var unknown16 = reader.ReadUInt32();

            if (unknown16 != 150)
            {
                throw new InvalidDataException();
            }

            var unknown17 = reader.ReadUInt32();

            if (unknown17 != 0 && unknown17 != 1 && unknown17 != 2)
            {
                throw new InvalidDataException();
            }

            var unknown18 = reader.ReadByte();

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

            var numMapReveals = reader.ReadUInt16();

            for (var i = 0; i < numMapReveals; i++)
            {
                var revealName = reader.ReadAsciiString();
                var waypoint   = reader.ReadAsciiString();
                var radius     = reader.ReadSingle();
                var player     = reader.ReadAsciiString();
            }

            var numObjectTypeLists = reader.ReadUInt16();

            for (var i = 0; i < numObjectTypeLists; i++)
            {
                var objectTypeList = new ObjectTypeList();
                objectTypeList.Load(reader);
            }

            var unknown20 = reader.ReadByte();

            if (unknown20 != 1)
            {
                throw new InvalidDataException();
            }

            var musicTrack = reader.ReadAsciiString();

            var unknown21 = reader.ReadByte();

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