Exemple #1
0
            /// <summary>
            /// Reads the data element from the given buffer.
            /// </summary>
            /// <param name="buffer">The buffer where the data element should be deserialized from.</param>
            public IncludedFile ReadData(RAMBuffer buffer)
            {
                Title   = buffer.ReadString(buffer.ReadInteger());
                Content = buffer.ReadString(buffer.ReadInteger());

                return(this);
            }
Exemple #2
0
        /// <summary>
        /// Reads the data element from the given buffer.
        /// </summary>
        /// <param name="buffer">The buffer where the data element should be deserialized from.</param>
        public IncludedFiles ReadData(RAMBuffer buffer)
        {
            int filesIncluded = buffer.ReadInteger();

            EsOnlyDataIncluded = buffer.ReadUInteger();
            if (EsOnlyDataIncluded > 0)
            {
                EsOnlyData = new List <byte>(396);
                for (int i = 0; i < 396; ++i)
                {
                    EsOnlyData.Add(buffer.ReadByte());
                }
            }

            if (filesIncluded > 0)
            {
                int fileCount = buffer.ReadInteger();
                Files = new List <IncludedFile>(fileCount);
                for (int i = 0; i < fileCount; i++)
                {
                    Files.Add(new IncludedFile().ReadData(buffer));
                }
            }

            return(this);
        }
Exemple #3
0
        public Creatable ReadData(RAMBuffer buffer)
        {
            ResourceCosts = new List <ResourceTuple <short, short, short> >(3);
            for (int i = 0; i < 3; ++i)
            {
                ResourceCosts.Add(new ResourceTuple <short, short, short>()
                {
                    Type = buffer.ReadShort(), Amount = buffer.ReadShort(), Mode = buffer.ReadShort()
                });
            }

            TrainTime       = buffer.ReadShort();
            TrainLocationID = buffer.ReadShort();
            ButtonID        = buffer.ReadByte();
            Unknown26       = buffer.ReadFloat();
            Unknown27       = buffer.ReadFloat();
            Unknown28       = buffer.ReadByte();
            HeroMode        = buffer.ReadByte();
            GarrisonGraphic = buffer.ReadInteger();
            ProjectileCount = buffer.ReadFloat();
            ProjectileCountOnFullGarrison    = buffer.ReadByte();
            ProjectileSpawningAreaWidth      = buffer.ReadFloat();
            ProjectileSpawningAreaHeight     = buffer.ReadFloat();
            ProjectileSpawningAreaRandomness = buffer.ReadFloat();
            AlternativeProjectileUnit        = buffer.ReadInteger();
            ChargingGraphic      = buffer.ReadInteger();
            ChargingMode         = buffer.ReadByte();
            DisplayedPierceArmor = buffer.ReadShort();

            return(this);
        }
Exemple #4
0
        /// <summary>
        /// Reads the data element from the given buffer.
        /// </summary>
        /// <param name="buffer">The buffer where the data element should be deserialized from.</param>
        public MessagesCinematics ReadData(RAMBuffer buffer)
        {
            InstructionsStringDllId = buffer.ReadUInteger();
            HintsStringDllId        = buffer.ReadUInteger();
            VictoryStringDllId      = buffer.ReadUInteger();
            LossStringDllId         = buffer.ReadUInteger();
            HistoryStringDllId      = buffer.ReadUInteger();
            ScoutsStringDllId       = buffer.ReadUInteger();
            InstructionsString      = buffer.ReadString(buffer.ReadShort());
            HintsString             = buffer.ReadString(buffer.ReadShort());
            VictoryString           = buffer.ReadString(buffer.ReadShort());
            LossString               = buffer.ReadString(buffer.ReadShort());
            HistoryString            = buffer.ReadString(buffer.ReadShort());
            ScoutsString             = buffer.ReadString(buffer.ReadShort());
            PregameCinematicFileName = buffer.ReadString(buffer.ReadShort());
            VictoryCinematicFileName = buffer.ReadString(buffer.ReadShort());
            LossCinematicFileName    = buffer.ReadString(buffer.ReadShort());
            BackgroundFileName       = buffer.ReadString(buffer.ReadShort());

            BitmapIncluded = buffer.ReadUInteger();
            buffer.ReadInteger();           // Width
            buffer.ReadInteger();           // Height
            buffer.ReadShort();             // Unknown, -1 for Bitmaps, 1 for no bitmaps
            Bitmap = BitmapIncluded != 0 ? new BitmapLibrary.BitmapLoader(buffer, readFileHeader: false) : null;

            return(this);
        }
            public TerrainPassGraphic ReadData(RAMBuffer buffer)
            {
                Buildable         = buffer.ReadInteger();
                GraphicID1        = buffer.ReadInteger();
                GraphicID2        = buffer.ReadInteger();
                ReplicationAmount = buffer.ReadInteger();

                return(this);
            }
        /// <summary>
        /// Deserializes the data elements from the internal buffer.
        /// </summary>
        /// <remarks></remarks>
        private void ReadData()
        {
            // Read version
            string version = _buffer.ReadString(4);

            if (version != "1.21")
            {
                throw new InvalidDataException($"Invalid primary file version: '{version}'");
            }

            // Read remaining file header
            _buffer.ReadUInteger();            // Header length
            _buffer.ReadInteger();             // Unknown constant = 2
            LastSaveTimestamp = _buffer.ReadUInteger();
            int instructionsLength = _buffer.ReadInteger();

            ScenarioInstructions = _buffer.ReadString(instructionsLength);
            _buffer.ReadUInteger();             // Unknown constant = 0
            PlayerCount = _buffer.ReadUInteger();

            // Create memory stream for decompression
            using (MemoryStream output = new MemoryStream())
                using (MemoryStream input = _buffer.ToMemoryStream())
                {
                    // Go to begin of uncompressed data
                    input.Seek(_buffer.Position, SeekOrigin.Begin);

                    // Create decompressor stream
                    using (DeflateStream decompressor = new DeflateStream(input, CompressionMode.Decompress))
                    {
                        // Decompress
                        decompressor.CopyTo(output);
                        decompressor.Close();
                    }

                    // Save decompressed data into buffer
                    _buffer = new RAMBuffer(output.ToArray());
                }

            // Read parts
            Header             = new DataElements.Header().ReadData(_buffer);
            MessagesCinematics = new DataElements.MessagesCinematics().ReadData(_buffer);
            PlayerAiResources  = new DataElements.PlayerAiResources().ReadData(_buffer);
            GlobalVictory      = new DataElements.GlobalVictory().ReadData(_buffer);
            Diplomacy          = new DataElements.Diplomacy().ReadData(_buffer);
            Disables           = new DataElements.Disables().ReadData(_buffer);
            Map   = new DataElements.Map().ReadData(_buffer);
            Units = new DataElements.Units().ReadData(_buffer);
            PlayerDiplomacyVarious = new DataElements.PlayerDiplomacyVarious().ReadData(_buffer);
            Triggers      = new DataElements.Triggers().ReadData(_buffer);
            IncludedFiles = new DataElements.IncludedFiles().ReadData(_buffer);

            // Clear buffer to save memory
            _buffer.Clear();
        }
                public NodeType ReadData(RAMBuffer buffer, byte version)
                {
                    Name       = buffer.ReadString(buffer.ReadInteger());
                    FrameIndex = buffer.ReadInteger();

                    if (version >= 1)
                    {
                        LegendLabelDllId = buffer.ReadInteger();
                    }

                    return(this);
                }
            public UnitConnection ReadData(RAMBuffer buffer)
            {
                ID            = buffer.ReadInteger();
                Unknown1      = buffer.ReadByte();
                UpperBuilding = buffer.ReadInteger();

                Common = new Common().ReadData(buffer);

                VerticalLine = buffer.ReadInteger();

                byte unitCount = buffer.ReadByte();

                Units = new List <int>(unitCount);
                for (int i = 0; i < unitCount; ++i)
                {
                    Units.Add(buffer.ReadInteger());
                }

                LocationInAge    = buffer.ReadInteger();
                RequiredResearch = buffer.ReadInteger();
                LineMode         = buffer.ReadInteger();
                EnablingResearch = buffer.ReadInteger();

                return(this);
            }
            public TechTreeAge ReadData(RAMBuffer buffer)
            {
                ID       = buffer.ReadInteger();
                Unknown2 = buffer.ReadByte();

                byte buildingCount = buffer.ReadByte();

                Buildings = new List <int>(buildingCount);
                for (int i = 0; i < buildingCount; ++i)
                {
                    Buildings.Add(buffer.ReadInteger());
                }

                byte unitCount = buffer.ReadByte();

                Units = new List <int>(unitCount);
                for (int i = 0; i < unitCount; ++i)
                {
                    Units.Add(buffer.ReadInteger());
                }

                byte researchCount = buffer.ReadByte();

                Researches = new List <int>(researchCount);
                for (int i = 0; i < researchCount; ++i)
                {
                    Researches.Add(buffer.ReadInteger());
                }

                Common    = new Common().ReadData(buffer);
                SlotsUsed = buffer.ReadByte();

                Unknown4 = new List <byte>(10);
                for (int i = 0; i < 10; ++i)
                {
                    Unknown4.Add(buffer.ReadByte());
                }

                Unknown5 = new List <byte>(10);
                for (int i = 0; i < 10; ++i)
                {
                    Unknown5.Add(buffer.ReadByte());
                }

                Unknown6 = buffer.ReadByte();
                LineMode = buffer.ReadInteger();

                return(this);
            }
        public TechTree ReadData(RAMBuffer buffer)
        {
            byte ageCount      = buffer.ReadByte();
            byte buildingCount = buffer.ReadByte();
            byte unitCount     = buffer.ReadByte();
            byte researchCount = buffer.ReadByte();

            Unknown2 = buffer.ReadInteger();

            TechTreeAges = new List <TechTreeAge>(ageCount);
            for (int i = 0; i < ageCount; ++i)
            {
                TechTreeAges.Add(new TechTreeAge().ReadData(buffer));
            }

            BuildingConnections = new List <BuildingConnection>(buildingCount);
            for (int i = 0; i < buildingCount; ++i)
            {
                BuildingConnections.Add(new BuildingConnection().ReadData(buffer));
            }

            UnitConnections = new List <UnitConnection>(unitCount);
            for (int i = 0; i < unitCount; ++i)
            {
                UnitConnections.Add(new UnitConnection().ReadData(buffer));
            }

            ResearchConnections = new List <ResearchConnection>(researchCount);
            for (int i = 0; i < researchCount; ++i)
            {
                ResearchConnections.Add(new ResearchConnection().ReadData(buffer));
            }

            return(this);
        }
Exemple #11
0
            /// <summary>
            /// Reads the data element from the given buffer.
            /// </summary>
            /// <param name="buffer">The buffer where the data element should be deserialized from.</param>
            public AiFile ReadData(RAMBuffer buffer)
            {
                Unknown1         = buffer.ReadUInteger();
                Unknown2         = buffer.ReadUInteger();
                AiPerFileContent = buffer.ReadString(buffer.ReadInteger());

                return(this);
            }
Exemple #12
0
            public TerrainBorder ReadData(RAMBuffer buffer)
            {
                Enabled = buffer.ReadByte();
                Random  = buffer.ReadByte();

                Name  = buffer.ReadString(13);
                Name2 = buffer.ReadString(13);

                SLP      = buffer.ReadInteger();
                ShapePtr = buffer.ReadInteger();
                SoundID  = buffer.ReadInteger();

                Colors = new List <byte>(3);
                for (int i = 0; i < 3; ++i)
                {
                    Colors.Add(buffer.ReadByte());
                }

                IsAnimated        = buffer.ReadByte();
                AnimationFrames   = buffer.ReadShort();
                PauseFames        = buffer.ReadShort();
                Interval          = buffer.ReadFloat();
                PauseBetweenLoops = buffer.ReadFloat();
                Frame             = buffer.ReadShort();
                DrawFrame         = buffer.ReadShort();
                AnimateLast       = buffer.ReadFloat();
                FrameChanged      = buffer.ReadByte();
                Drawn             = buffer.ReadByte();

                Borders = new List <List <FrameData> >(19);
                for (int i = 0; i < 19; ++i)
                {
                    List <FrameData> frameData = new List <FrameData>(12);
                    for (int j = 0; j < 12; ++j)
                    {
                        frameData.Add(new FrameData().ReadData(buffer));
                    }
                    Borders.Add(frameData);
                }

                DrawTerrain     = buffer.ReadShort();
                UnderlayTerrain = buffer.ReadShort();
                BorderStyle     = buffer.ReadShort();

                return(this);
            }
Exemple #13
0
        public PlayerColor ReadData(RAMBuffer buffer)
        {
            ID             = buffer.ReadInteger();
            Palette        = buffer.ReadInteger();
            Color          = buffer.ReadInteger();
            Unknown1       = buffer.ReadInteger();
            Unknown2       = buffer.ReadInteger();
            MinimapColor   = buffer.ReadInteger();
            Unknown3       = buffer.ReadInteger();
            Unknown4       = buffer.ReadInteger();
            StatisticsText = buffer.ReadInteger();

            return(this);
        }
            public Common ReadData(RAMBuffer buffer)
            {
                SlotsUsed = buffer.ReadInteger();

                UnitResearch = new List <int>(10);
                for (int i = 0; i < 10; ++i)
                {
                    UnitResearch.Add(buffer.ReadInteger());
                }

                Mode = new List <int>(10);
                for (int i = 0; i < 10; ++i)
                {
                    Mode.Add(buffer.ReadInteger());
                }

                return(this);
            }
            public MapUnit ReadData(RAMBuffer buffer)
            {
                Unit                  = buffer.ReadInteger();
                HostTerrain           = buffer.ReadInteger();
                GroupPlacing          = buffer.ReadByte();
                ScaleFlag             = buffer.ReadByte();
                Padding1              = buffer.ReadShort();
                ObjectsPerGroup       = buffer.ReadInteger();
                Fluctuation           = buffer.ReadInteger();
                GroupsPerPlayer       = buffer.ReadInteger();
                GroupArea             = buffer.ReadInteger();
                PlayerID              = buffer.ReadInteger();
                SetPlaceForAllPlayers = buffer.ReadInteger();
                MinDistanceToPlayers  = buffer.ReadInteger();
                MaxDistanceToPlayers  = buffer.ReadInteger();

                return(this);
            }
        public RandomMaps ReadData(RAMBuffer buffer)
        {
            int mapCount = buffer.ReadInteger();

            RandomMapsPtr = buffer.ReadInteger();

            Maps1 = new List <MapInfo1>(mapCount);
            for (int i = 0; i < mapCount; ++i)
            {
                Maps1.Add(new MapInfo1().ReadData(buffer));
            }
            Maps2 = new List <MapInfo2>(mapCount);
            for (int i = 0; i < mapCount; ++i)
            {
                Maps2.Add(new MapInfo2().ReadData(buffer));
            }

            return(this);
        }
Exemple #17
0
            public SoundItem ReadData(RAMBuffer buffer)
            {
                FileName    = buffer.ReadString(13);
                ResourceID  = buffer.ReadInteger();
                Probability = buffer.ReadShort();
                Civ         = buffer.ReadShort();
                Unknown1    = buffer.ReadShort();

                return(this);
            }
Exemple #18
0
        /// <summary>
        /// Reads the data element from the given buffer.
        /// </summary>
        /// <param name="buffer">The buffer where the data element should be deserialized from.</param>
        public Triggers ReadData(RAMBuffer buffer)
        {
            Unknown = buffer.ReadByte();

            int triggerCount = buffer.ReadInteger();

            TriggerData = new List <Trigger>(triggerCount);
            for (int i = 0; i < triggerCount; i++)
            {
                TriggerData.Add(new Trigger().ReadData(buffer));
            }
            TriggerDisplayIndices = new List <int>(triggerCount);
            for (int i = 0; i < triggerCount; i++)
            {
                TriggerDisplayIndices.Add(buffer.ReadInteger());
            }

            return(this);
        }
Exemple #19
0
        /// <summary>
        /// Konstruktor. Lädt die angegebene Datei.
        /// </summary>
        /// <param name="filename">Die zu ladende Datei.</param>
        public ShipFile(string filename)
            : this()
        {
            // Datei laden
            RAMBuffer buffer = new RAMBuffer(filename);

            // Namen lesen
            Name = buffer.ReadString(buffer.ReadInteger());

            // Rumpf-SLP lesen
            if (buffer.ReadByte() == 1)
            {
                BaseSlp = new SLPFile(buffer);
            }

            // Schatten-SLP lesen
            if (buffer.ReadByte() == 1)
            {
                ShadowSlp = new SLPFile(buffer);
            }

            // Segel lesen
            int sailCount = buffer.ReadByte();

            for (int i = 0; i < sailCount; ++i)
            {
                // Lesen
                Sail.SailType currType = (Sail.SailType)buffer.ReadByte();
                Sail          currSail = new Sail(buffer);
                Sails.Add(currType, currSail);
            }

            // Invertierte Segeltypen lesen
            int invSailCount = buffer.ReadByte();

            for (int i = 0; i < invSailCount; ++i)
            {
                InvertedSails.Add((Sail.SailType)buffer.ReadByte());
            }

            // 0 -> 0, 10 -> 0, 20 -> 10, 30 -> 10, 40 -> 20, 50 -> 20, 60 -> 30, 70 -> 30, 80 -> 40

            /*func(Sail.SailType.MainGo, Civ.AS, Properties.Resources.MainGo_AS);
             * func(Sail.SailType.MainGo, Civ.IN, Properties.Resources.MainGo_IN);
             * func(Sail.SailType.MainGo, Civ.ME, Properties.Resources.MainGo_ME);
             * func(Sail.SailType.MainGo, Civ.OR, Properties.Resources.MainGo_OR);
             * func(Sail.SailType.MainGo, Civ.WE, Properties.Resources.MainGo_WE);
             * func(Sail.SailType.MainStop, Civ.AS, Properties.Resources.MainStop_AS);
             * func(Sail.SailType.MainStop, Civ.IN, Properties.Resources.MainStop_IN);
             * func(Sail.SailType.MainStop, Civ.ME, Properties.Resources.MainStop_ME);
             * func(Sail.SailType.MainStop, Civ.OR, Properties.Resources.MainStop_OR);
             * func(Sail.SailType.MainStop, Civ.WE, Properties.Resources.MainStop_WE);
             *
             * Save(Path.Combine(Path.GetDirectoryName(filename), Path.GetFileNameWithoutExtension(filename) + "_converted.ship"));*/
        }
Exemple #20
0
            /// <summary>
            /// Reads the data element from the given buffer.
            /// </summary>
            /// <param name="buffer">The buffer where the data element should be deserialized from.</param>
            public PlayerUnitsEntry ReadData(RAMBuffer buffer)
            {
                int unitCount = buffer.ReadInteger();

                Units = new List <UnitEntry>(unitCount);
                for (int i = 0; i < unitCount; ++i)
                {
                    Units.Add(new UnitEntry().ReadData(buffer));
                }

                return(this);
            }
Exemple #21
0
        /// <summary>
        /// Reads the data element from the given buffer.
        /// </summary>
        /// <param name="buffer">The buffer where the data element should be deserialized from.</param>
        public Map ReadData(RAMBuffer buffer)
        {
            // Separator
            ScenarioDataElementTools.AssertTrue(buffer.ReadUInteger() == 0xFFFFFF9D);

            Player1CameraY = buffer.ReadInteger();
            Player1CameraX = buffer.ReadInteger();
            AiMapCode      = buffer.ReadInteger();
            MapWidth       = buffer.ReadUInteger();
            MapHeight      = buffer.ReadUInteger();

            Tiles = new List <List <MapTileTerrainData> >((int)MapWidth);
            for (int i = 0; i < MapWidth; ++i)
            {
                Tiles.Add(new List <MapTileTerrainData>((int)MapHeight));
                for (int j = 0; j < MapHeight; ++j)
                {
                    Tiles[i].Add(new MapTileTerrainData().ReadData(buffer));
                }
            }
            return(this);
        }
Exemple #22
0
            /// <summary>
            /// Reads the data element from the given buffer.
            /// </summary>
            /// <param name="buffer">The buffer where the data element should be deserialized from.</param>
            public PlayerDiplomacyVariousEntry ReadData(RAMBuffer buffer)
            {
                PlayerName     = buffer.ReadString(buffer.ReadUShort());
                InitialCameraX = buffer.ReadFloat();
                InitialCameraY = buffer.ReadFloat();
                UnknownX       = buffer.ReadShort();
                UnknownY       = buffer.ReadShort();
                AlliedVictory  = buffer.ReadByte();

                ushort playerDiplomacyCount = buffer.ReadUShort();

                Diplomacy1 = new List <DiplomacyTypes1>(playerDiplomacyCount);
                for (int i = 0; i < playerDiplomacyCount; i++)
                {
                    Diplomacy1.Add((DiplomacyTypes1)buffer.ReadByte());
                }
                Diplomacy2 = new List <DiplomacyTypes2>(playerDiplomacyCount);
                for (int i = 0; i < playerDiplomacyCount; i++)
                {
                    Diplomacy2.Add((DiplomacyTypes2)buffer.ReadUInteger());
                }

                Color         = buffer.ReadUInteger();
                Unknown1      = buffer.ReadFloat();
                Unknown3Count = buffer.ReadUShort();

                if (Unknown1 == 2)
                {
                    Unknown2 = new List <byte>(8);
                    for (int i = 0; i < 8; i++)
                    {
                        Unknown2.Add(buffer.ReadByte());
                    }
                }

                Unknown3 = new List <byte>(Unknown3Count * 44);
                for (int i = 0; i < Unknown3Count * 44; i++)
                {
                    Unknown3.Add(buffer.ReadByte());
                }

                Unknown4 = new List <byte>(7);
                for (int i = 0; i < 7; i++)
                {
                    Unknown4.Add(buffer.ReadByte());
                }

                Unknown5 = buffer.ReadInteger();

                return(this);
            }
Exemple #23
0
        public Research ReadData(RAMBuffer buffer)
        {
            RequiredTechs = new List <short>(6);
            for (int i = 0; i < 6; ++i)
            {
                RequiredTechs.Add(buffer.ReadShort());
            }

            ResourceCosts = new List <ResourceTuple <short, short, byte> >(3);
            for (int i = 0; i < 3; ++i)
            {
                ResourceCosts.Add(new ResourceTuple <short, short, byte>()
                {
                    Type = buffer.ReadShort(), Amount = buffer.ReadShort(), Mode = buffer.ReadByte()
                });
            }

            RequiredTechCount = buffer.ReadShort();
            Civ                    = buffer.ReadShort();
            FullTechMode           = buffer.ReadShort();
            ResearchLocation       = buffer.ReadShort();
            LanguageDLLName1       = buffer.ReadUShort();
            LanguageDLLDescription = buffer.ReadUShort();
            ResearchTime           = buffer.ReadShort();
            TechageID              = buffer.ReadShort();
            Type                   = buffer.ReadShort();
            IconID                 = buffer.ReadShort();
            ButtonID               = buffer.ReadByte();
            LanguageDLLHelp        = buffer.ReadInteger();
            LanguageDLLName2       = buffer.ReadInteger();
            Unknown1               = buffer.ReadInteger();

            int nameLength = buffer.ReadUShort();

            Name = buffer.ReadString(nameLength);

            return(this);
        }
Exemple #24
0
        public Graphic ReadData(RAMBuffer buffer)
        {
            Name1 = buffer.ReadString(21);
            Name2 = buffer.ReadString(13);

            SLP         = buffer.ReadInteger();
            Unknown1    = buffer.ReadByte();
            Unknown2    = buffer.ReadByte();
            Layer       = buffer.ReadByte();
            PlayerColor = buffer.ReadByte();
            Rainbow     = buffer.ReadByte();
            Replay      = buffer.ReadByte();

            Coordinates = new List <short>(4);
            for (int i = 0; i < 4; ++i)
            {
                Coordinates.Add(buffer.ReadShort());
            }

            int deltaCount = buffer.ReadUShort();

            SoundID         = buffer.ReadShort();
            AttackSoundUsed = buffer.ReadByte();
            FrameCount      = buffer.ReadUShort();
            AngleCount      = buffer.ReadUShort();
            NewSpeed        = buffer.ReadFloat();
            FrameRate       = buffer.ReadFloat();
            ReplayDelay     = buffer.ReadFloat();
            SequenceType    = buffer.ReadByte();
            ID            = buffer.ReadShort();
            MirroringMode = buffer.ReadByte();
            Unknown3      = buffer.ReadByte();

            Deltas = new List <GraphicDelta>(deltaCount);
            for (int i = 0; i < deltaCount; ++i)
            {
                Deltas.Add(new GraphicDelta().ReadData(buffer));
            }

            if (AttackSoundUsed != 0)
            {
                AttackSounds = new List <GraphicAttackSound>(AngleCount);
                for (int i = 0; i < AngleCount; ++i)
                {
                    AttackSounds.Add(new GraphicAttackSound().ReadData(buffer));
                }
            }

            return(this);
        }
Exemple #25
0
            /// <summary>
            /// Reads the data element from the given buffer.
            /// </summary>
            /// <param name="buffer">The buffer where the data element should be deserialized from.</param>
            public UnitEntry ReadData(RAMBuffer buffer)
            {
                PositionX  = buffer.ReadFloat();
                PositionY  = buffer.ReadFloat();
                PositionZ  = buffer.ReadFloat();
                Id         = buffer.ReadUInteger();
                UnitId     = buffer.ReadUShort();
                State      = buffer.ReadByte();
                Rotation   = buffer.ReadFloat();
                Frame      = buffer.ReadUShort();
                GarrisonId = buffer.ReadInteger();

                return(this);
            }
            public MapLand ReadData(RAMBuffer buffer)
            {
                LandID          = buffer.ReadInteger();
                Terrain         = buffer.ReadInteger();
                LandSpacing     = buffer.ReadInteger();
                BaseSize        = buffer.ReadInteger();
                Zone            = buffer.ReadByte();
                PlacementType   = buffer.ReadByte();
                Padding1        = buffer.ReadShort();
                BaseX           = buffer.ReadInteger();
                BaseY           = buffer.ReadInteger();
                LandProportion  = buffer.ReadByte();
                ByPlayerFlag    = buffer.ReadByte();
                Padding2        = buffer.ReadShort();
                StartAreaRadius = buffer.ReadInteger();
                TerrainEdgeFade = buffer.ReadInteger();
                Clumpiness      = buffer.ReadInteger();

                return(this);
            }
Exemple #27
0
        public Sound ReadData(RAMBuffer buffer)
        {
            ID       = buffer.ReadShort();
            Unknown1 = buffer.ReadShort();
            short count = buffer.ReadShort();

            Unknown2 = buffer.ReadInteger();

            Items = new List <SoundItem>(count);
            for (int i = 0; i < count; ++i)
            {
                Items.Add(new SoundItem().ReadData(buffer));
            }

            return(this);
        }
            public TechTreeElement ReadData(RAMBuffer buffer, byte version = NEW_TECH_TREE_VERSION)
            {
                // Eigenschaften lesen
                ElementType     = (ItemType)buffer.ReadByte();
                ElementObjectID = buffer.ReadShort();
                Age             = buffer.ReadByte();
                RenderMode      = (ItemRenderMode)buffer.ReadByte();

                // Deaktivierende Kulturen lesen
                byte disableCivCount = buffer.ReadByte();

                DisableCivs = new List <byte>();
                for (int i = 0; i < disableCivCount; ++i)
                {
                    DisableCivs.Add(buffer.ReadByte());
                }

                // Kindelemente lesen
                short childrenCount = buffer.ReadShort();

                Children = new List <TechTreeElement>();
                for (int i = 0; i < childrenCount; ++i)
                {
                    Children.Add(new TechTreeElement().ReadData(buffer, version));
                }

                // Benötigte Elemente lesen
                short requireCount = buffer.ReadShort();

                RequiredElements = new List <Tuple <ItemType, short> >();
                for (int i = 0; i < requireCount; ++i)
                {
                    RequiredElements.Add(new Tuple <ItemType, short>((ItemType)buffer.ReadByte(), buffer.ReadShort()));
                }

                // Node-Hintergrund lesen
                if (version >= 1)
                {
                    NodeTypeIndex = buffer.ReadInteger();
                }
                else
                {
                    NodeTypeIndex = (int)ElementType;
                }

                return(this);
            }
            public MapElevation ReadData(RAMBuffer buffer)
            {
                Proportion    = buffer.ReadInteger();
                Terrain       = buffer.ReadInteger();
                ClumpCount    = buffer.ReadInteger();
                BaseTerrain   = buffer.ReadInteger();
                BaseElevation = buffer.ReadInteger();
                TileSpacing   = buffer.ReadInteger();

                return(this);
            }
            public MapTerrain ReadData(RAMBuffer buffer)
            {
                Proportion       = buffer.ReadInteger();
                Terrain          = buffer.ReadInteger();
                ClumpCount       = buffer.ReadInteger();
                EdgeSpacing      = buffer.ReadInteger();
                PlacementTerrain = buffer.ReadInteger();
                Clumpiness       = buffer.ReadInteger();

                return(this);
            }