예제 #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);
            }
예제 #2
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));
            }
예제 #3
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));
        }
예제 #4
0
            public void WriteData(RAMBuffer buffer)
            {
                buffer.WriteByte(Enabled);
                buffer.WriteByte(Random);

                buffer.WriteString(Name, 13);
                buffer.WriteString(Name2, 13);

                buffer.WriteInteger(SLP);
                buffer.WriteInteger(ShapePtr);
                buffer.WriteInteger(SoundID);

                buffer.WriteInteger(BlendPriority);
                buffer.WriteInteger(BlendType);

                AssertListLength(Colors, 3);
                Colors.ForEach(col => buffer.WriteByte(col));

                buffer.WriteByte(CliffColors.Item1);
                buffer.WriteByte(CliffColors.Item2);

                buffer.WriteByte(PassableTerrain);
                buffer.WriteByte(ImpassableTerrain);

                buffer.WriteByte(IsAnimated);
                buffer.WriteShort(AnimationFrames);
                buffer.WriteShort(PauseFames);
                buffer.WriteFloat(Interval);
                buffer.WriteFloat(PauseBetweenLoops);
                buffer.WriteShort(Frame);
                buffer.WriteShort(DrawFrame);
                buffer.WriteFloat(AnimateLast);
                buffer.WriteByte(FrameChanged);
                buffer.WriteByte(Drawn);

                AssertListLength(ElevationGraphics, 19);
                ElevationGraphics.ForEach(eg => eg.WriteData(buffer));

                buffer.WriteShort(TerrainToDraw);
                buffer.WriteShort(TerrainDimensions.Item1);
                buffer.WriteShort(TerrainDimensions.Item2);

                Borders.ForEach(b => buffer.WriteShort(b));

                AssertListLength(TerrainUnitID, 30);
                TerrainUnitID.ForEach(tu => buffer.WriteShort(tu));

                AssertListLength(TerrainUnitDensity, 30);
                TerrainUnitDensity.ForEach(tu => buffer.WriteShort(tu));

                AssertListLength(TerrainUnitCentering, 30);
                TerrainUnitCentering.ForEach(tu => buffer.WriteByte(tu));

                buffer.WriteShort(NumberOfTerrainUnitsUsed);

                buffer.WriteShort(Phantom);
            }
예제 #5
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);
 }
예제 #6
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);
 }
예제 #7
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));
        }
예제 #8
0
 public void WriteData(RAMBuffer buffer)
 {
     buffer.WriteByte(Type);
     buffer.WriteShort(A);
     buffer.WriteShort(B);
     buffer.WriteShort(C);
     buffer.WriteFloat(D);
 }
        public void WriteData(RAMBuffer buffer)
        {
            AssertListLength(TerrainAccessibleFlags, TerrainCount);
            TerrainAccessibleFlags.ForEach(e => buffer.WriteFloat(e));

            AssertListLength(TerrainPassGraphics, TerrainCount);
            TerrainPassGraphics.ForEach(e => e.WriteData(buffer));
        }
예제 #10
0
 public void WriteData(RAMBuffer buffer)
 {
     buffer.WriteByte(StretchMode);
     buffer.WriteByte(CompensationMode);
     buffer.WriteByte(DropAnimationMode);
     buffer.WriteByte(PenetrationMode);
     buffer.WriteByte(Unknown24);
     buffer.WriteFloat(ProjectileArc);
 }
예제 #11
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);
        }
예제 #12
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);
        }
예제 #13
0
            public void WriteData(RAMBuffer buffer)
            {
                buffer.WriteByte(Enabled);
                buffer.WriteByte(Random);

                buffer.WriteString(Name, 13);
                buffer.WriteString(Name2, 13);

                buffer.WriteInteger(SLP);
                buffer.WriteInteger(ShapePtr);
                buffer.WriteInteger(SoundID);

                AssertListLength(Colors, 3);
                Colors.ForEach(col => buffer.WriteByte(col));

                buffer.WriteByte(IsAnimated);
                buffer.WriteShort(AnimationFrames);
                buffer.WriteShort(PauseFames);
                buffer.WriteFloat(Interval);
                buffer.WriteFloat(PauseBetweenLoops);
                buffer.WriteShort(Frame);
                buffer.WriteShort(DrawFrame);
                buffer.WriteFloat(AnimateLast);
                buffer.WriteByte(FrameChanged);
                buffer.WriteByte(Drawn);

                AssertListLength(Borders, 19);
                Borders.ForEach(b =>
                {
                    AssertListLength(b, 12);
                    b.ForEach(fd => fd.WriteData(buffer));
                });

                buffer.WriteShort(DrawTerrain);
                buffer.WriteShort(UnderlayTerrain);
                buffer.WriteShort(BorderStyle);
            }
예제 #14
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));
            }
        }
예제 #15
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(Gold);
     buffer.WriteFloat(Wood);
     buffer.WriteFloat(Food);
     buffer.WriteFloat(Stone);
     buffer.WriteFloat(Ore);
     buffer.WriteUInteger(Padding);
     buffer.WriteFloat(PopulationLimit);
 }
예제 #16
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));
        }
예제 #17
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);
            }
        }
예제 #18
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);
        }
예제 #19
0
 public void WriteData(RAMBuffer buffer)
 {
     buffer.WriteShort(UnitID);
     buffer.WriteFloat(MisplacementX);
     buffer.WriteFloat(MisplacementY);
 }
예제 #20
0
            public void WriteData(RAMBuffer buffer)
            {
                buffer.WriteByte((byte)Type);
                buffer.WriteUShort((ushort)Name1.Length);
                buffer.WriteShort(ID1);
                buffer.WriteUShort(LanguageDLLName);
                buffer.WriteUShort(LanguageDLLCreation);
                buffer.WriteShort(Class);
                buffer.WriteShort(StandingGraphic1);
                buffer.WriteShort(StandingGraphic2);
                buffer.WriteShort(DyingGraphic1);
                buffer.WriteShort(DyingGraphic2);
                buffer.WriteByte(DeathMode);
                buffer.WriteShort(HitPoints);
                buffer.WriteFloat(LineOfSight);
                buffer.WriteByte(GarrisonCapacity);
                buffer.WriteFloat(SizeRadius1);
                buffer.WriteFloat(SizeRadius2);
                buffer.WriteFloat(HPBarHeight1);
                buffer.WriteShort(TrainSound1);
                buffer.WriteShort(TrainSound2);
                buffer.WriteShort(DeadUnitID);
                buffer.WriteByte(PlacementMode);
                buffer.WriteByte(AirMode);
                buffer.WriteShort(IconID);
                buffer.WriteByte(HideInEditor);
                buffer.WriteShort(Unknown1);
                buffer.WriteByte(Enabled);
                buffer.WriteByte(Disabled);
                buffer.WriteShort(PlacementBypassTerrain1);
                buffer.WriteShort(PlacementBypassTerrain2);
                buffer.WriteShort(PlacementTerrain1);
                buffer.WriteShort(PlacementTerrain2);
                buffer.WriteFloat(EditorRadius1);
                buffer.WriteFloat(EditorRadius2);
                buffer.WriteByte(HillMode);
                buffer.WriteByte(VisibleInFog);
                buffer.WriteShort(TerrainRestriction);
                buffer.WriteByte(FlyMode);
                buffer.WriteShort(ResourceCapacity);
                buffer.WriteFloat(ResourceDecay);
                buffer.WriteByte(BlastType);
                buffer.WriteByte(Unknown2);
                buffer.WriteByte(InteractionMode);
                buffer.WriteByte(MinimapMode);
                buffer.WriteByte(CommandAttribute);
                buffer.WriteFloat(Unknown3A);
                buffer.WriteByte(MinimapColor);
                buffer.WriteInteger(LanguageDLLHelp);
                buffer.WriteInteger(LanguageDLLHotKeyText);
                buffer.WriteInteger(HotKey);
                buffer.WriteByte(Unselectable);
                buffer.WriteByte(Unknown6);
                buffer.WriteByte(UnknownSelectionMode);
                buffer.WriteByte(Unknown8);
                buffer.WriteByte(SelectionMask);
                buffer.WriteByte(SelectionShapeType);
                buffer.WriteByte(SelectionShape);
                buffer.WriteByte(Attribute);
                buffer.WriteByte(Civilization);
                buffer.WriteShort(Nothing);
                buffer.WriteByte(SelectionEffect);
                buffer.WriteByte(EditorSelectionColor);
                buffer.WriteFloat(SelectionRadius1);
                buffer.WriteFloat(SelectionRadius2);
                buffer.WriteFloat(HPBarHeight2);

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

                buffer.WriteByte((byte)DamageGraphics.Count);
                DamageGraphics.ForEach(e => e.WriteData(buffer));

                buffer.WriteShort(SelectionSound);
                buffer.WriteShort(DyingSound);
                buffer.WriteByte(AttackMode);
                buffer.WriteByte(EdibleMeat);
                buffer.WriteString(Name1);
                buffer.WriteShort(ID2);
                buffer.WriteShort(ID3);

                if (Type >= UnitType.Flag)
                {
                    buffer.WriteFloat(Speed);
                }
                if (Type >= UnitType.DeadFish)
                {
                    DeadFish.WriteData(buffer);
                }
                if (Type >= UnitType.Bird)
                {
                    Bird.WriteData(buffer);
                }
                if (Type >= UnitType.Type50)
                {
                    Type50.WriteData(buffer);
                }
                if (Type == UnitType.Projectile)
                {
                    Projectile.WriteData(buffer);
                }
                if (Type >= UnitType.Creatable)
                {
                    Creatable.WriteData(buffer);
                }
                if (Type == UnitType.Building)
                {
                    Building.WriteData(buffer);
                }
            }