Example #1
0
            /// <summary>
            /// Writes the data element into the given buffer (at its current position).
            /// </summary>
            /// <param name="buffer">The buffer where the data element should be deserialized into.</param>
            public void WriteData(RAMBuffer buffer)
            {
                buffer.WriteUShort((ushort)PlayerName.Length);
                buffer.WriteString(PlayerName);
                buffer.WriteFloat(InitialCameraX);
                buffer.WriteFloat(InitialCameraY);
                buffer.WriteShort(UnknownX);
                buffer.WriteShort(UnknownY);
                buffer.WriteByte(AlliedVictory);

                ScenarioDataElementTools.AssertTrue(Diplomacy1.Count == Diplomacy2.Count);
                buffer.WriteUShort((ushort)Diplomacy1.Count);
                Diplomacy1.ForEach(d => buffer.WriteByte((byte)d));
                Diplomacy2.ForEach(d => buffer.WriteUInteger((uint)d));

                buffer.WriteUInteger(Color);
                buffer.WriteFloat(Unknown1);
                buffer.WriteUShort(Unknown3Count);

                if (Unknown1 == 2)
                {
                    ScenarioDataElementTools.AssertListLength(Unknown2, 8);
                    Unknown2.ForEach(b => buffer.WriteByte(b));
                }

                ScenarioDataElementTools.AssertListLength(Unknown3, Unknown3Count * 44);
                Unknown3.ForEach(b => buffer.WriteByte(b));

                ScenarioDataElementTools.AssertListLength(Unknown4, 7);
                Unknown4.ForEach(b => buffer.WriteByte(b));

                buffer.WriteInteger(Unknown5);
            }
Example #2
0
            /// <summary>
            /// Writes the data element into the given buffer (at its current position).
            /// </summary>
            /// <param name="buffer">The buffer where the data element should be deserialized into.</param>
            public void WriteData(RAMBuffer buffer)
            {
                buffer.WriteUInteger(Enabled);
                buffer.WriteUInteger(Looping);

                buffer.WriteByte(State);
                buffer.WriteByte(ShowAsObjective);
                buffer.WriteInteger(ObjectiveDescriptionIndex);
                buffer.WriteUInteger(Unknown);

                if (Description.Length == 0 || Description.Last() != '\0')
                {
                    Description += '\0';
                }
                buffer.WriteInteger(Description.Length);
                buffer.WriteString(Description);

                if (Name.Length == 0 || Name.Last() != '\0')
                {
                    Name += '\0';
                }
                buffer.WriteInteger(Name.Length);
                buffer.WriteString(Name);

                ScenarioDataElementTools.AssertTrue(Effects.Count == EffectDisplayIndices.Count);
                buffer.WriteInteger(Effects.Count);
                Effects.ForEach(t => t.WriteData(buffer));
                EffectDisplayIndices.ForEach(t => buffer.WriteInteger(t));

                ScenarioDataElementTools.AssertTrue(Conditions.Count == ConditionDisplayIndices.Count);
                buffer.WriteInteger(Conditions.Count);
                Conditions.ForEach(t => t.WriteData(buffer));
                ConditionDisplayIndices.ForEach(t => buffer.WriteInteger(t));
            }
Example #3
0
        public void WriteData(RAMBuffer buffer)
        {
            AssertListLength(ResourceCosts, 3);
            ResourceCosts.ForEach(e =>
            {
                buffer.WriteShort(e.Type);
                buffer.WriteShort(e.Amount);
                buffer.WriteShort(e.Mode);
            });

            buffer.WriteShort(TrainTime);
            buffer.WriteShort(TrainLocationID);
            buffer.WriteByte(ButtonID);
            buffer.WriteFloat(Unknown26);
            buffer.WriteFloat(Unknown27);
            buffer.WriteByte(Unknown28);
            buffer.WriteByte(HeroMode);
            buffer.WriteInteger(GarrisonGraphic);
            buffer.WriteFloat(ProjectileCount);
            buffer.WriteByte(ProjectileCountOnFullGarrison);
            buffer.WriteFloat(ProjectileSpawningAreaWidth);
            buffer.WriteFloat(ProjectileSpawningAreaHeight);
            buffer.WriteFloat(ProjectileSpawningAreaRandomness);
            buffer.WriteInteger(AlternativeProjectileUnit);
            buffer.WriteInteger(ChargingGraphic);
            buffer.WriteByte(ChargingMode);
            buffer.WriteShort(DisplayedPierceArmor);
        }
Example #4
0
        public void WriteData(RAMBuffer buffer)
        {
            AssertListLength(RequiredTechs, 6);
            RequiredTechs.ForEach(e => buffer.WriteShort(e));

            AssertListLength(ResourceCosts, 3);
            ResourceCosts.ForEach(e =>
            {
                buffer.WriteShort(e.Type);
                buffer.WriteShort(e.Amount);
                buffer.WriteByte(e.Mode);
            });

            buffer.WriteShort(RequiredTechCount);
            buffer.WriteShort(Civ);
            buffer.WriteShort(FullTechMode);
            buffer.WriteShort(ResearchLocation);
            buffer.WriteUShort(LanguageDLLName1);
            buffer.WriteUShort(LanguageDLLDescription);
            buffer.WriteShort(ResearchTime);
            buffer.WriteShort(TechageID);
            buffer.WriteShort(Type);
            buffer.WriteShort(IconID);
            buffer.WriteByte(ButtonID);
            buffer.WriteInteger(LanguageDLLHelp);
            buffer.WriteInteger(LanguageDLLName2);
            buffer.WriteInteger(Unknown1);

            buffer.WriteUShort((ushort)Name.Length);
            buffer.WriteString(Name);
        }
Example #5
0
 public void WriteData(RAMBuffer buffer)
 {
     buffer.WriteShort(GraphicID);
     buffer.WriteByte(DamagePercent);
     buffer.WriteByte(ApplyMode);
     buffer.WriteByte(Unknown2);
 }
Example #6
0
        public void WriteData(RAMBuffer buffer)
        {
            buffer.WriteShort(ConstructionGraphicID);
            buffer.WriteShort(SnowGraphicID);
            buffer.WriteByte(AdjacentMode);
            buffer.WriteShort(GraphicsAngle);
            buffer.WriteByte(DisappearsWhenBuilt);
            buffer.WriteShort(StackUnitID);
            buffer.WriteShort(FoundationTerrainID);
            buffer.WriteShort(OldTerrainLikeID);
            buffer.WriteShort(ResearchID);
            buffer.WriteByte(Unknown33);

            AssertListLength(Annexes, 4);
            Annexes.ForEach(e => e.WriteData(buffer));

            buffer.WriteShort(HeadUnit);
            buffer.WriteShort(TransformUnit);
            buffer.WriteShort(UnknownSound);
            buffer.WriteShort(ConstructionSound);
            buffer.WriteByte(GarrisonType);
            buffer.WriteFloat(GarrisonHealRateFactor);
            buffer.WriteFloat(Unknown35);
            buffer.WriteShort(PileUnit);

            AssertListLength(LootingTable, 6);
            LootingTable.ForEach(e => buffer.WriteByte(e));
        }
Example #7
0
 public void WriteData(RAMBuffer buffer)
 {
     buffer.WriteByte(StretchMode);
     buffer.WriteByte(CompensationMode);
     buffer.WriteByte(DropAnimationMode);
     buffer.WriteByte(PenetrationMode);
     buffer.WriteByte(Unknown24);
     buffer.WriteFloat(ProjectileArc);
 }
Example #8
0
        public void WriteData(RAMBuffer buffer)
        {
            buffer.WriteInteger(VirtualFunctionPtr);
            buffer.WriteInteger(MapPointer);
            buffer.WriteInteger(MapWidth);
            buffer.WriteInteger(MapHeight);
            buffer.WriteInteger(WorldWidth);
            buffer.WriteInteger(WorldHeight);

            AssertListLength(TileSizes, 19);
            TileSizes.ForEach(ts => ts.WriteData(buffer));

            buffer.WriteShort(PaddingTS);

            Terrains.ForEach(t => t.WriteData(buffer));

            AssertListLength(TerrainBorders, 16);
            TerrainBorders.ForEach(tb => tb.WriteData(buffer));

            buffer.WriteInteger(MapRowOffset);
            buffer.WriteFloat(MapMinX);
            buffer.WriteFloat(MapMinY);
            buffer.WriteFloat(MapMaxX);
            buffer.WriteFloat(MapMaxY);
            buffer.WriteFloat(MapMaxXplus1);
            buffer.WriteFloat(MapMaxYplus1);

            buffer.WriteUShort(TerrainsUsed2);
            buffer.WriteUShort(BordersUsed);
            buffer.WriteShort(MaxTerrain);
            buffer.WriteShort(TileWidth);
            buffer.WriteShort(TileHeight);
            buffer.WriteShort(TileHalfHeight);
            buffer.WriteShort(TileHalfWidth);
            buffer.WriteShort(ElevHeight);
            buffer.WriteShort(CurRow);
            buffer.WriteShort(CurCol);
            buffer.WriteShort(BlockBegRow);
            buffer.WriteShort(BlockEndRow);
            buffer.WriteShort(BlockBegCol);
            buffer.WriteShort(BlockEndCol);

            buffer.WriteInteger(SearchMapPtr);
            buffer.WriteInteger(SearchMapRowsPtr);
            buffer.WriteByte(AnyFrameChange);

            buffer.WriteByte(MapVisibleFlag);
            buffer.WriteByte(FogFlag);

            AssertListLength(SomeBytes, 21);
            SomeBytes.ForEach(b => buffer.WriteByte(b));

            AssertListLength(SomeInt32, 157);
            SomeInt32.ForEach(i => buffer.WriteInteger(i));
        }
Example #9
0
 public void WriteData(RAMBuffer buffer)
 {
     buffer.WriteShort(SheepConversion);
     buffer.WriteFloat(SearchRadius);
     buffer.WriteFloat(WorkRate);
     buffer.WriteShort(DropSite1);
     buffer.WriteShort(DropSite2);
     buffer.WriteByte(VillagerMode);
     buffer.WriteShort(AttackSound);
     buffer.WriteShort(MoveSound);
     buffer.WriteByte(AnimalMode);
 }
Example #10
0
        public void WriteData(RAMBuffer buffer)
        {
            buffer.WriteByte((byte)TechTreeAges.Count);
            buffer.WriteByte((byte)BuildingConnections.Count);
            buffer.WriteByte((byte)UnitConnections.Count);
            buffer.WriteByte((byte)ResearchConnections.Count);
            buffer.WriteInteger(Unknown2);

            TechTreeAges.ForEach(e => e.WriteData(buffer));
            BuildingConnections.ForEach(e => e.WriteData(buffer));
            UnitConnections.ForEach(e => e.WriteData(buffer));
            ResearchConnections.ForEach(e => e.WriteData(buffer));
        }
Example #11
0
            public void WriteData(RAMBuffer buffer)
            {
                buffer.WriteInteger(ID);
                buffer.WriteByte(Unknown2);

                buffer.WriteByte((byte)Buildings.Count);
                Buildings.ForEach(e => buffer.WriteInteger(e));

                buffer.WriteByte((byte)Units.Count);
                Units.ForEach(e => buffer.WriteInteger(e));

                buffer.WriteByte((byte)Researches.Count);
                Researches.ForEach(e => buffer.WriteInteger(e));

                Common.WriteData(buffer);
                buffer.WriteByte(SlotsUsed);

                AssertListLength(Unknown4, 10);
                Unknown4.ForEach(e => buffer.WriteByte(e));

                AssertListLength(Unknown5, 10);
                Unknown5.ForEach(e => buffer.WriteByte(e));

                buffer.WriteByte(Unknown6);
                buffer.WriteInteger(LineMode);
            }
Example #12
0
        public void WriteData(RAMBuffer buffer)
        {
            buffer.WriteShort(WalkingGraphic1);
            buffer.WriteShort(WalkingGraphic2);
            buffer.WriteFloat(RotationSpeed);
            buffer.WriteByte(Unknown11);
            buffer.WriteShort(TrackingUnit);
            buffer.WriteByte(TrackingUnitUsed);
            buffer.WriteFloat(TrackingUnitDensity);
            buffer.WriteByte(Unknown16);

            AssertListLength(Unknown16B, 5);
            Unknown16B.ForEach(e => buffer.WriteInteger(e));
        }
Example #13
0
        /// <summary>
        /// Schreibt die Daten in den gegebenen Puffer.
        /// </summary>
        /// <param name="buffer">Der Puffer, in den die Daten geschrieben werden sollen.</param>
        public void WriteData(RAMBuffer buffer)
        {
            // Benutzung schreiben
            buffer.WriteByte(Used ? (byte)1 : (byte)0);

            // Durch SLPs iterieren und schreiben
            buffer.WriteByte((byte)SailSlps.Count);
            foreach (var currSlp in SailSlps)
            {
                // Schreiben
                buffer.WriteByte((byte)currSlp.Key);
                currSlp.Value.writeData();
                buffer.Write((RAMBuffer)currSlp.Value.DataBuffer);
            }
        }
Example #14
0
 public void WriteData(RAMBuffer buffer)
 {
     buffer.WriteInteger(Unit);
     buffer.WriteInteger(HostTerrain);
     buffer.WriteByte(GroupPlacing);
     buffer.WriteByte(ScaleFlag);
     buffer.WriteShort(Padding1);
     buffer.WriteInteger(ObjectsPerGroup);
     buffer.WriteInteger(Fluctuation);
     buffer.WriteInteger(GroupsPerPlayer);
     buffer.WriteInteger(GroupArea);
     buffer.WriteInteger(PlayerID);
     buffer.WriteInteger(SetPlaceForAllPlayers);
     buffer.WriteInteger(MinDistanceToPlayers);
     buffer.WriteInteger(MaxDistanceToPlayers);
 }
Example #15
0
 public void WriteData(RAMBuffer buffer)
 {
     buffer.WriteByte(Type);
     buffer.WriteShort(A);
     buffer.WriteShort(B);
     buffer.WriteShort(C);
     buffer.WriteFloat(D);
 }
Example #16
0
            public void WriteData(RAMBuffer buffer)
            {
                buffer.WriteInteger(ID);
                buffer.WriteByte(Unknown1);

                buffer.WriteByte((byte)Buildings.Count);
                Buildings.ForEach(e => buffer.WriteInteger(e));

                buffer.WriteByte((byte)Units.Count);
                Units.ForEach(e => buffer.WriteInteger(e));

                buffer.WriteByte((byte)Researches.Count);
                Researches.ForEach(e => buffer.WriteInteger(e));

                Common.WriteData(buffer);
                buffer.WriteByte(LocationInAge);

                AssertListLength(UnitsTechsTotal, 5);
                UnitsTechsTotal.ForEach(e => buffer.WriteByte(e));

                AssertListLength(UnitsTechsFirst, 5);
                UnitsTechsFirst.ForEach(e => buffer.WriteByte(e));

                buffer.WriteInteger(LineMode);
                buffer.WriteInteger(EnablingResearch);
            }
Example #17
0
            public void WriteData(RAMBuffer buffer)
            {
                buffer.WriteShort(One);
                buffer.WriteShort(ID);
                buffer.WriteByte(Unknown1);
                buffer.WriteShort(Type);
                buffer.WriteShort(ClassID);
                buffer.WriteShort(UnitID);
                buffer.WriteShort(TerrainID);
                buffer.WriteShort(ResourceIn);
                buffer.WriteShort(ResourceProductivityMultiplier);
                buffer.WriteShort(ResourceOut);
                buffer.WriteShort(Resource);
                buffer.WriteFloat(WorkRateMultiplier);
                buffer.WriteFloat(ExecutionRadius);
                buffer.WriteFloat(ExtraRange);
                buffer.WriteByte(Unknown4);
                buffer.WriteFloat(Unknown5);
                buffer.WriteByte(SelectionEnabler);
                buffer.WriteByte(Unknown7);
                buffer.WriteShort(PlunderSource);
                buffer.WriteShort(Unknown9);
                buffer.WriteByte(SelectionMode);
                buffer.WriteByte(RightClickMode);
                buffer.WriteByte(Unknown12);

                AssertListLength(Graphics, 6);
                Graphics.ForEach(e => buffer.WriteShort(e));
            }
Example #18
0
        /// <summary>
        /// Writes the data element into the given buffer (at its current position).
        /// </summary>
        /// <param name="buffer">The buffer where the data element should be deserialized into.</param>
        public void WriteData(RAMBuffer buffer)
        {
            buffer.WriteByte(Unknown);

            ScenarioDataElementTools.AssertTrue(TriggerData.Count == TriggerDisplayIndices.Count);
            buffer.WriteInteger(TriggerData.Count);
            TriggerData.ForEach(t => t.WriteData(buffer));
            TriggerDisplayIndices.ForEach(t => buffer.WriteInteger(t));
        }
Example #19
0
            public void WriteData(RAMBuffer buffer)
            {
                buffer.WriteInteger(ID);
                buffer.WriteByte(Unknown1);
                buffer.WriteInteger(UpperBuilding);

                Common.WriteData(buffer);

                buffer.WriteInteger(VerticalLine);

                buffer.WriteByte((byte)Units.Count);
                Units.ForEach(e => buffer.WriteInteger(e));

                buffer.WriteInteger(LocationInAge);
                buffer.WriteInteger(RequiredResearch);
                buffer.WriteInteger(LineMode);
                buffer.WriteInteger(EnablingResearch);
            }
Example #20
0
 public void WriteData(RAMBuffer buffer)
 {
     buffer.WriteInteger(LandID);
     buffer.WriteInteger(Terrain);
     buffer.WriteInteger(LandSpacing);
     buffer.WriteInteger(BaseSize);
     buffer.WriteByte(Zone);
     buffer.WriteByte(PlacementType);
     buffer.WriteShort(Padding1);
     buffer.WriteInteger(BaseX);
     buffer.WriteInteger(BaseY);
     buffer.WriteByte(LandProportion);
     buffer.WriteByte(ByPlayerFlag);
     buffer.WriteShort(Padding2);
     buffer.WriteInteger(StartAreaRadius);
     buffer.WriteInteger(TerrainEdgeFade);
     buffer.WriteInteger(Clumpiness);
 }
Example #21
0
        /*void func(Sail.SailType type, Civ civ, byte[] data)
         * {
         *      SLPFile s = new SLPFile(new RAMBuffer(data));
         *      for(int f = 0; f < 90; ++f)
         *      {
         *              s._frameInformationHeaders[f].AnchorX = Sails[type].SailSlps[civ]._frameInformationHeaders[10 * ((f / 10) / 2) + (f % 10)].AnchorX;
         *              s._frameInformationHeaders[f].AnchorY = Sails[type].SailSlps[civ]._frameInformationHeaders[10 * ((f / 10) / 2) + (f % 10)].AnchorY;
         *      }
         *      Sails[type].SailSlps[civ] = s;
         * }*/

        /// <summary>
        /// Speichert die Schiffsdaten in der angegebenen Datei.
        /// </summary>
        /// <param name="filename">Die Zieldatei.</param>
        public void Save(string filename)
        {
            // Puffer erstellen
            RAMBuffer buffer = new RAMBuffer();

            // Name schreiben
            buffer.WriteInteger(Name.Length);
            buffer.WriteString(Name);

            // Rumpf-SLP schreiben
            if (BaseSlp != null)
            {
                // SLP schreiben
                buffer.WriteByte(1);
                BaseSlp.writeData();
                buffer.Write((RAMBuffer)BaseSlp.DataBuffer);
            }
            else
            {
                buffer.WriteByte(0);
            }

            // Schatten-SLP schreiben
            if (ShadowSlp != null)
            {
                // SLP schreiben
                buffer.WriteByte(1);
                ShadowSlp.writeData();
                buffer.Write((RAMBuffer)ShadowSlp.DataBuffer);
            }
            else
            {
                buffer.WriteByte(0);
            }

            // Segel schreiben
            buffer.WriteByte((byte)Sails.Count);
            foreach (var currSail in Sails)
            {
                // Schreiben
                buffer.WriteByte((byte)currSail.Key);
                currSail.Value.WriteData(buffer);
            }

            // Invertierte Segel schreiben
            buffer.WriteByte((byte)InvertedSails.Count);
            foreach (var invSail in InvertedSails)
            {
                buffer.WriteByte((byte)invSail);
            }

            // Speichern
            buffer.Save(filename);
        }
Example #22
0
        public void WriteData(RAMBuffer buffer)
        {
            buffer.WriteByte(Exists);

            if (Exists != 0)
            {
                buffer.WriteUShort((ushort)Commands.Count);
                Commands.ForEach(e => e.WriteData(buffer));
            }
        }
Example #23
0
        public void WriteData(RAMBuffer buffer)
        {
            buffer.WriteByte(One);
            buffer.WriteString(Name, 20);
            buffer.WriteUShort((ushort)Resources.Count);
            buffer.WriteShort(TechTreeID);
            buffer.WriteShort(TeamBonusID);
            Resources.ForEach(e => buffer.WriteFloat(e));
            buffer.WriteByte(IconSet);
            buffer.WriteUShort((ushort)UnitPointers.Count);
            UnitPointers.ForEach(e => buffer.WriteInteger(e));

            // Sicherstellen, dass genau jede definierte Einheit einen entsprechenden Pointer hat; hier nur über die Listenlänge, sollte aber die meisten auftretenden Fehler abdecken
            AssertListLength(Units, UnitPointers.Count(p => p != 0));
            foreach (var u in Units)
            {
                u.Value.WriteData(buffer);
            }
        }
Example #24
0
 /// <summary>
 /// Writes the data element into the given buffer (at its current position).
 /// </summary>
 /// <param name="buffer">The buffer where the data element should be deserialized into.</param>
 public void WriteData(RAMBuffer buffer)
 {
     buffer.WriteFloat(PositionX);
     buffer.WriteFloat(PositionY);
     buffer.WriteFloat(PositionZ);
     buffer.WriteUInteger(Id);
     buffer.WriteUShort(UnitId);
     buffer.WriteByte(State);
     buffer.WriteFloat(Rotation);
     buffer.WriteUShort(Frame);
     buffer.WriteInteger(GarrisonId);
 }
Example #25
0
        public void WriteData(RAMBuffer buffer)
        {
            buffer.WriteShort(DefaultArmor);

            buffer.WriteUShort((ushort)Attacks.Count);
            foreach (KeyValuePair <ushort, ushort> currA in Attacks)
            {
                buffer.WriteUShort(currA.Key);
                buffer.WriteUShort(currA.Value);
            }

            buffer.WriteUShort((ushort)Armors.Count);
            foreach (KeyValuePair <ushort, ushort> currA in Armors)
            {
                buffer.WriteUShort(currA.Key);
                buffer.WriteUShort(currA.Value);
            }

            buffer.WriteShort(TerrainRestrictionForDamageMultiplying);
            buffer.WriteFloat(MaxRange);
            buffer.WriteFloat(BlastRadius);
            buffer.WriteFloat(ReloadTime);
            buffer.WriteShort(ProjectileUnitID);
            buffer.WriteShort(ProjectileAccuracyPercent);
            buffer.WriteByte(TowerMode);
            buffer.WriteShort(ProjectileFrameDelay);

            AssertListLength(ProjectileGraphicDisplacement, 3);
            ProjectileGraphicDisplacement.ForEach(e => buffer.WriteFloat(e));

            buffer.WriteByte(BlastLevel);
            buffer.WriteFloat(MinRange);
            buffer.WriteFloat(ProjectileDispersion);
            buffer.WriteShort(AttackGraphic);
            buffer.WriteShort(DisplayedMeleeArmor);
            buffer.WriteShort(DisplayedAttack);
            buffer.WriteFloat(DisplayedRange);
            buffer.WriteFloat(DisplayedReloadTime);
        }
Example #26
0
        /// <summary>
        /// Schreibt die TechTree-Daten.
        /// </summary>
        /// <param name="buffer">Der Datenpuffer.</param>
        /// <param name="writeTreeOnly">Gibt an, ob nur die Baumdaten (und nicht auch das Design) geschrieben werden sollen.</param>
        public void WriteData(RAMBuffer buffer, bool writeTreeOnly)
        {
            // Version schreiben
            buffer.WriteByte(NEW_TECH_TREE_VERSION);

            // Stammelemente schreiben
            buffer.WriteShort((short)ParentElements.Count);
            ParentElements.ForEach(p => p.WriteData(buffer));

            // Designdaten schreiben
            if (!writeTreeOnly)
            {
                DesignData.WriteData(buffer);
            }
        }
Example #27
0
        public void WriteData(RAMBuffer buffer)
        {
            buffer.WriteString(Name1, 21);
            buffer.WriteString(Name2, 13);

            buffer.WriteInteger(SLP);
            buffer.WriteByte(Unknown1);
            buffer.WriteByte(Unknown2);
            buffer.WriteByte(Layer);
            buffer.WriteByte(PlayerColor);
            buffer.WriteByte(Rainbow);
            buffer.WriteByte(Replay);

            AssertListLength(Coordinates, 4);
            Coordinates.ForEach(e => buffer.WriteShort(e));

            buffer.WriteUShort((ushort)Deltas.Count);
            buffer.WriteShort(SoundID);
            buffer.WriteByte(AttackSoundUsed);
            buffer.WriteUShort(FrameCount);
            buffer.WriteUShort(AngleCount);
            buffer.WriteFloat(NewSpeed);
            buffer.WriteFloat(FrameRate);
            buffer.WriteFloat(ReplayDelay);
            buffer.WriteByte(SequenceType);
            buffer.WriteShort(ID);
            buffer.WriteByte(MirroringMode);
            buffer.WriteByte(Unknown3);

            Deltas.ForEach(e => e.WriteData(buffer));
            if (AttackSoundUsed != 0)
            {
                AssertListLength(AttackSounds, AngleCount);
                AttackSounds.ForEach(e => e.WriteData(buffer));
            }
        }
Example #28
0
        /// <summary>
        /// Writes the data element into the given buffer (at its current position).
        /// </summary>
        /// <param name="buffer">The buffer where the data element should be deserialized into.</param>
        public void WriteData(RAMBuffer buffer)
        {
            buffer.WriteInteger(Files.Count > 0 ? 1 : 0);

            buffer.WriteUInteger(EsOnlyDataIncluded);
            if (EsOnlyDataIncluded > 0)
            {
                ScenarioDataElementTools.AssertListLength(EsOnlyData, 396);
                EsOnlyData.ForEach(b => buffer.WriteByte(b));
            }

            if (Files.Count > 0)
            {
                buffer.WriteInteger(Files.Count);
                Files.ForEach(f => f.WriteData(buffer));
            }
        }
Example #29
0
        /// <summary>
        /// Writes the data element into the given buffer (at its current position).
        /// </summary>
        /// <param name="buffer">The buffer where the data element should be deserialized into.</param>
        public void WriteData(RAMBuffer buffer)
        {
            ScenarioDataElementTools.AssertListLength(UnknownStrings, 32);
            UnknownStrings.ForEach(s => { buffer.WriteShort((short)s.Length); buffer.WriteString(s); });

            ScenarioDataElementTools.AssertListLength(AiNames, 16);
            AiNames.ForEach(s => { buffer.WriteShort((short)s.Length); buffer.WriteString(s); });

            ScenarioDataElementTools.AssertListLength(AiFiles, 16);
            AiFiles.ForEach(f => f.WriteData(buffer));

            ScenarioDataElementTools.AssertListLength(AiTypes, 16);
            AiTypes.ForEach(t => buffer.WriteByte(t));

            buffer.WriteUInteger(0xFFFFFF9D);

            ScenarioDataElementTools.AssertListLength(ResourceEntries, 16);
            ResourceEntries.ForEach(e => e.WriteData(buffer));
        }
Example #30
0
        /// <summary>
        /// Writes the data element into the given buffer (at its current position).
        /// </summary>
        /// <param name="buffer">The buffer where the data element should be deserialized into.</param>
        public void WriteData(RAMBuffer buffer)
        {
            buffer.WriteUInteger(NextUnitIdToPlace);

            buffer.WriteFloat(1.22f);

            ScenarioDataElementTools.AssertListLength(PlayerNames, 16);
            PlayerNames.ForEach(p => buffer.WriteString(p, 256));

            ScenarioDataElementTools.AssertListLength(PlayerNameDllIds, 16);
            PlayerNameDllIds.ForEach(p => buffer.WriteUInteger(p));

            ScenarioDataElementTools.AssertListLength(PlayerData, 16);
            PlayerData.ForEach(p => p.WriteData(buffer));

            buffer.WriteUInteger(Unknown1);
            buffer.WriteByte(0);
            buffer.WriteFloat(Unknown2);

            buffer.WriteShort((short)OriginalFileName.Length);
            buffer.WriteString(OriginalFileName);
        }