Esempio n. 1
0
            public FrameData ReadData(RAMBuffer buffer)
            {
                FrameCount = buffer.ReadShort();
                AngleCount = buffer.ReadShort();
                ShapeID    = buffer.ReadShort();

                return(this);
            }
Esempio n. 2
0
            public TileSize ReadData(RAMBuffer buffer)
            {
                Width  = buffer.ReadShort();
                Height = buffer.ReadShort();
                DeltaY = buffer.ReadShort();

                return(this);
            }
Esempio n. 3
0
            public TechageEffect ReadData(RAMBuffer buffer)
            {
                Type = buffer.ReadByte();
                A    = buffer.ReadShort();
                B    = buffer.ReadShort();
                C    = buffer.ReadShort();
                D    = buffer.ReadFloat();

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

                return(this);
            }
Esempio n. 5
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);
            }
Esempio n. 6
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);
        }
Esempio n. 7
0
        public Bird ReadData(RAMBuffer buffer)
        {
            SheepConversion = buffer.ReadShort();
            SearchRadius    = buffer.ReadFloat();
            WorkRate        = buffer.ReadFloat();
            DropSite1       = buffer.ReadShort();
            DropSite2       = buffer.ReadShort();
            VillagerMode    = buffer.ReadByte();
            AttackSound     = buffer.ReadShort();
            MoveSound       = buffer.ReadShort();
            AnimalMode      = buffer.ReadByte();

            return(this);
        }
Esempio n. 8
0
        /// <summary>
        /// Lädt die TechTree-Daten.
        /// </summary>
        /// <param name="buffer">Der Datenpuffer.</param>
        /// <param name="readTreeOnly">Gibt an, ob nur die Baumdaten (und nicht auch das Design) geladen werden sollen.</param>
        public TechTreeNew ReadData(RAMBuffer buffer, bool readTreeOnly)
        {
            // Versionsbyte lesen
            byte version = buffer.ReadByte();

            if (version > NEW_TECH_TREE_VERSION)
            {
                throw new Exception("This file was created with a newer version of this program. Please consider updating.");
            }

            // Stammelemente lesen
            short parentCount = buffer.ReadShort();

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

            // Design lesen
            if (!readTreeOnly)
            {
                DesignData = new TechTreeDesign().ReadData(buffer);
            }

            return(this);
        }
Esempio n. 9
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);
        }
Esempio n. 10
0
            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);
            }
Esempio n. 11
0
            public BuildingAnnex ReadData(RAMBuffer buffer)
            {
                UnitID        = buffer.ReadShort();
                MisplacementX = buffer.ReadFloat();
                MisplacementY = buffer.ReadFloat();

                return(this);
            }
Esempio n. 12
0
                public DamageGraphic ReadData(RAMBuffer buffer)
                {
                    GraphicID     = buffer.ReadShort();
                    DamagePercent = buffer.ReadByte();
                    ApplyMode     = buffer.ReadByte();
                    Unknown2      = buffer.ReadByte();

                    return(this);
                }
Esempio n. 13
0
        public DeadFish ReadData(RAMBuffer buffer)
        {
            WalkingGraphic1     = buffer.ReadShort();
            WalkingGraphic2     = buffer.ReadShort();
            RotationSpeed       = buffer.ReadFloat();
            Unknown11           = buffer.ReadByte();
            TrackingUnit        = buffer.ReadShort();
            TrackingUnitUsed    = buffer.ReadByte();
            TrackingUnitDensity = buffer.ReadFloat();
            Unknown16           = buffer.ReadByte();

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

            return(this);
        }
Esempio n. 14
0
            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);
            }
Esempio n. 15
0
            public GraphicDelta ReadData(RAMBuffer buffer)
            {
                GraphicID  = buffer.ReadShort();
                Unknown1   = buffer.ReadShort();
                Unknown2   = buffer.ReadShort();
                Unknown3   = buffer.ReadShort();
                DirectionX = buffer.ReadShort();
                DirectionY = buffer.ReadShort();
                Unknown4   = buffer.ReadShort();
                Unknown5   = buffer.ReadShort();

                return(this);
            }
Esempio n. 16
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);
        }
Esempio n. 17
0
        // Resources

        #endregion

        #region Functions

        /// <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 PlayerAiResources ReadData(RAMBuffer buffer)
        {
            UnknownStrings = new List <string>(32);
            for (int i = 0; i < 32; ++i)
            {
                UnknownStrings.Add(buffer.ReadString(buffer.ReadShort()));
            }

            AiNames = new List <string>(16);
            for (int i = 0; i < 16; ++i)
            {
                AiNames.Add(buffer.ReadString(buffer.ReadShort()));
            }

            AiFiles = new List <AiFile>(16);
            for (int i = 0; i < 16; ++i)
            {
                AiFiles.Add(new AiFile().ReadData(buffer));
            }

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

            // Separator
            ScenarioDataElementTools.AssertTrue(buffer.ReadUInteger() == 0xFFFFFF9D);

            ResourceEntries = new List <ResourceEntry>(16);
            for (int i = 0; i < 16; ++i)
            {
                ResourceEntries.Add(new ResourceEntry().ReadData(buffer));
            }

            return(this);
        }
Esempio n. 18
0
        public Civ ReadData(RAMBuffer buffer)
        {
            One  = buffer.ReadByte();
            Name = buffer.ReadString(20);
            int resourceCount = buffer.ReadUShort();

            TechTreeID  = buffer.ReadShort();
            TeamBonusID = buffer.ReadShort();

            Resources = new List <float>(resourceCount);
            for (int i = 0; i < resourceCount; ++i)
            {
                Resources.Add(buffer.ReadFloat());
            }

            IconSet = buffer.ReadByte();

            int unitCount = buffer.ReadUShort();

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

            Units = new SortedList <int, Unit>(unitCount);
            for (int p = 0; p < UnitPointers.Count; ++p)
            {
                if (UnitPointers[p] != 0)
                {
                    Units.Add(p, new Unit().ReadData(buffer));
                }
            }

            return(this);
        }
Esempio n. 19
0
        public Type50 ReadData(RAMBuffer buffer)
        {
            DefaultArmor = buffer.ReadShort();

            ushort attackCount = buffer.ReadUShort();

            Attacks = new Dictionary <ushort, ushort>(attackCount);
            for (int i = 0; i < attackCount; ++i)
            {
                Attacks[buffer.ReadUShort()] = buffer.ReadUShort();
            }

            ushort armourCount = buffer.ReadUShort();

            Armors = new Dictionary <ushort, ushort>(armourCount);
            for (int i = 0; i < armourCount; ++i)
            {
                Armors[buffer.ReadUShort()] = buffer.ReadUShort();
            }

            TerrainRestrictionForDamageMultiplying = buffer.ReadShort();
            MaxRange                  = buffer.ReadFloat();
            BlastRadius               = buffer.ReadFloat();
            ReloadTime                = buffer.ReadFloat();
            ProjectileUnitID          = buffer.ReadShort();
            ProjectileAccuracyPercent = buffer.ReadShort();
            TowerMode                 = buffer.ReadByte();
            ProjectileFrameDelay      = buffer.ReadShort();

            ProjectileGraphicDisplacement = new List <float>(3);
            for (int i = 0; i < 3; ++i)
            {
                ProjectileGraphicDisplacement.Add(buffer.ReadFloat());
            }

            BlastLevel           = buffer.ReadByte();
            MinRange             = buffer.ReadFloat();
            ProjectileDispersion = buffer.ReadFloat();
            AttackGraphic        = buffer.ReadShort();
            DisplayedMeleeArmor  = buffer.ReadShort();
            DisplayedAttack      = buffer.ReadShort();
            DisplayedRange       = buffer.ReadFloat();
            DisplayedReloadTime  = buffer.ReadFloat();

            return(this);
        }
Esempio n. 20
0
            public GraphicAttackSound ReadData(RAMBuffer buffer)
            {
                SoundDelay1 = buffer.ReadShort();
                SoundID1    = buffer.ReadShort();
                SoundDelay2 = buffer.ReadShort();
                SoundID2    = buffer.ReadShort();
                SoundDelay3 = buffer.ReadShort();
                SoundID3    = buffer.ReadShort();

                return(this);
            }
Esempio n. 21
0
            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);
            }
Esempio n. 22
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);
            }
Esempio n. 23
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 Header ReadData(RAMBuffer buffer)
        {
            NextUnitIdToPlace = buffer.ReadUInteger();

            float version = buffer.ReadFloat();

            if (version != 1.22f)
            {
                throw new InvalidDataException($"Invalid secondary file version: '{version}'");
            }

            PlayerNames = new List <string>(16);
            for (int i = 0; i < 16; ++i)
            {
                PlayerNames.Add(buffer.ReadString(256));
            }

            PlayerNameDllIds = new List <uint>(16);
            for (int i = 0; i < 16; ++i)
            {
                PlayerNameDllIds.Add(buffer.ReadUInteger());
            }

            PlayerData = new List <PlayerDataHeader>(16);
            for (int i = 0; i < 16; ++i)
            {
                PlayerData.Add(new PlayerDataHeader().ReadData(buffer));
            }

            Unknown1 = buffer.ReadUInteger();
            byte unknown = buffer.ReadByte();             // = 0

            Unknown2 = buffer.ReadFloat();

            short length = buffer.ReadShort();

            OriginalFileName = buffer.ReadString(length);

            return(this);
        }
Esempio n. 24
0
        public Building ReadData(RAMBuffer buffer)
        {
            ConstructionGraphicID = buffer.ReadShort();
            SnowGraphicID         = buffer.ReadShort();
            AdjacentMode          = buffer.ReadByte();
            GraphicsAngle         = buffer.ReadShort();
            DisappearsWhenBuilt   = buffer.ReadByte();
            StackUnitID           = buffer.ReadShort();
            FoundationTerrainID   = buffer.ReadShort();
            OldTerrainLikeID      = buffer.ReadShort();
            ResearchID            = buffer.ReadShort();
            Unknown33             = buffer.ReadByte();

            Annexes = new List <BuildingAnnex>(4);
            for (int i = 0; i < 4; ++i)
            {
                Annexes.Add(new BuildingAnnex().ReadData(buffer));
            }

            HeadUnit               = buffer.ReadShort();
            TransformUnit          = buffer.ReadShort();
            UnknownSound           = buffer.ReadShort();
            ConstructionSound      = buffer.ReadShort();
            GarrisonType           = buffer.ReadByte();
            GarrisonHealRateFactor = buffer.ReadFloat();
            Unknown35              = buffer.ReadFloat();
            PileUnit               = buffer.ReadShort();

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

            return(this);
        }
        private void _loadSimulationButton_Click(object sender, RoutedEventArgs e)
        {
            // Show dialog
            OpenFileDialog dialog = new OpenFileDialog
            {
                Filter = "Simulation files (*.balancingsim)|*.balancingsim",
                Title  = "Load simulation..."
            };

            if (!(dialog.ShowDialog() ?? false))
            {
                return;
            }

            // Catch errors occuring while reading
            try
            {
                // Load file into buffer
                RAMBuffer buffer = new RAMBuffer(dialog.FileName);

                // Check version
                int version = buffer.ReadInteger();
                if (version > Version)
                {
                    throw new ArgumentException("The given file was created with a newer version of this program, please consider updating.");
                }

                // Read civs
                _civ1ComboBox.SelectedValue = buffer.ReadShort();
                _civ2ComboBox.SelectedValue = buffer.ReadShort();

                // Merge tech lists
                int             count1 = buffer.ReadInteger();
                HashSet <short> res1   = new HashSet <short>();
                for (int i = 0; i < count1; i++)
                {
                    res1.Add(buffer.ReadShort());
                }
                foreach (var res in Researches1)
                {
                    res.Checked = res1.Contains(res.Id);
                }
                int             count2 = buffer.ReadInteger();
                HashSet <short> res2   = new HashSet <short>();
                for (int i = 0; i < count2; i++)
                {
                    res2.Add(buffer.ReadShort());
                }
                foreach (var res in Researches2)
                {
                    res.Checked = res2.Contains(res.Id);
                }

                // Read duels
                int count = buffer.ReadInteger();
                Duels.Clear();
                for (int i = 0; i < count; i++)
                {
                    short id1 = buffer.ReadShort();
                    short id2 = buffer.ReadShort();
                    if (!Units.ContainsKey(id1) || !Units.ContainsKey(id2))
                    {
                        continue;
                    }
                    Duels.Add(new Duel(id1, Units[id1], id2, Units[id2]));
                }
            }
            catch (Exception ex)
            {
                // Error
                MessageBox.Show($"Unable to load given file: {ex.Message}");
            }
        }
Esempio n. 26
0
            public Terrain 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();

                BlendPriority = buffer.ReadInteger();
                BlendType     = buffer.ReadInteger();

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

                CliffColors       = new Tuple <byte, byte>(buffer.ReadByte(), buffer.ReadByte());
                PassableTerrain   = buffer.ReadByte();
                ImpassableTerrain = 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();

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

                TerrainToDraw     = buffer.ReadShort();
                TerrainDimensions = new Tuple <short, short>(buffer.ReadShort(), buffer.ReadShort());

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

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

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

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

                NumberOfTerrainUnitsUsed = buffer.ReadShort();

                Phantom = buffer.ReadShort();

                return(this);
            }
Esempio n. 27
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);
        }
Esempio n. 28
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);
        }
Esempio n. 29
0
            public UnitCommand ReadData(RAMBuffer buffer)
            {
                One        = buffer.ReadShort();
                ID         = buffer.ReadShort();
                Unknown1   = buffer.ReadByte();
                Type       = buffer.ReadShort();
                ClassID    = buffer.ReadShort();
                UnitID     = buffer.ReadShort();
                TerrainID  = buffer.ReadShort();
                ResourceIn = buffer.ReadShort();
                ResourceProductivityMultiplier = buffer.ReadShort();
                ResourceOut        = buffer.ReadShort();
                Resource           = buffer.ReadShort();
                WorkRateMultiplier = buffer.ReadFloat();
                ExecutionRadius    = buffer.ReadFloat();
                ExtraRange         = buffer.ReadFloat();
                Unknown4           = buffer.ReadByte();
                Unknown5           = buffer.ReadFloat();
                SelectionEnabler   = buffer.ReadByte();
                Unknown7           = buffer.ReadByte();
                PlunderSource      = buffer.ReadShort();
                Unknown9           = buffer.ReadShort();
                SelectionMode      = buffer.ReadByte();
                RightClickMode     = buffer.ReadByte();
                Unknown12          = buffer.ReadByte();

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

                return(this);
            }
Esempio n. 30
0
        public TerrainBlock ReadData(RAMBuffer buffer)
        {
            VirtualFunctionPtr = buffer.ReadInteger();
            MapPointer         = buffer.ReadInteger();
            MapWidth           = buffer.ReadInteger();
            MapHeight          = buffer.ReadInteger();
            WorldWidth         = buffer.ReadInteger();
            WorldHeight        = buffer.ReadInteger();

            TileSizes = new List <TileSize>(19);
            for (int i = 0; i < 19; ++i)
            {
                TileSizes.Add(new TileSize().ReadData(buffer));
            }

            PaddingTS = buffer.ReadShort();

            Terrains = new List <Terrain>(TERRAIN_COUNT);
            for (int i = 0; i < TERRAIN_COUNT; ++i)
            {
                Terrains.Add(new Terrain().ReadData(buffer));
            }

            TerrainBorders = new List <TerrainBorder>(16);
            for (int i = 0; i < 16; ++i)
            {
                TerrainBorders.Add(new TerrainBorder().ReadData(buffer));
            }

            MapRowOffset = buffer.ReadInteger();
            MapMinX      = buffer.ReadFloat();
            MapMinY      = buffer.ReadFloat();
            MapMaxX      = buffer.ReadFloat();
            MapMaxY      = buffer.ReadFloat();
            MapMaxXplus1 = buffer.ReadFloat();
            MapMaxYplus1 = buffer.ReadFloat();

            TerrainsUsed2  = buffer.ReadUShort();
            BordersUsed    = buffer.ReadUShort();
            MaxTerrain     = buffer.ReadShort();
            TileWidth      = buffer.ReadShort();
            TileHeight     = buffer.ReadShort();
            TileHalfHeight = buffer.ReadShort();
            TileHalfWidth  = buffer.ReadShort();
            ElevHeight     = buffer.ReadShort();
            CurRow         = buffer.ReadShort();
            CurCol         = buffer.ReadShort();
            BlockBegRow    = buffer.ReadShort();
            BlockEndRow    = buffer.ReadShort();
            BlockBegCol    = buffer.ReadShort();
            BlockEndCol    = buffer.ReadShort();

            SearchMapPtr     = buffer.ReadInteger();
            SearchMapRowsPtr = buffer.ReadInteger();
            AnyFrameChange   = buffer.ReadByte();

            MapVisibleFlag = buffer.ReadByte();
            FogFlag        = buffer.ReadByte();

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

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

            return(this);
        }