Example #1
0
 public void Serialize(GMDataWriter writer)
 {
     writer.WritePointerString(EmptyString);
     writer.WritePointerString(Name);
     writer.WritePointerString(ClassName);
     Files.Serialize(writer);
 }
Example #2
0
 public void Serialize(GMDataWriter writer)
 {
     writer.WritePointerString(Filename);
     writer.WritePointerString(FinalFunction);
     writer.WritePointerString(InitFunction);
     writer.Write((uint)Kind);
     Functions.Serialize(writer);
 }
            // values that correspond to EntryIDs/EntryCount in main chunk

            public void Serialize(GMDataWriter writer)
            {
                writer.WritePointerString(Name);
                writer.WritePointerString(Region);
                foreach (GMString s in Entries)
                {
                    writer.WritePointerString(s);
                }
            }
Example #4
0
 public void Serialize(GMDataWriter writer)
 {
     writer.WritePointerString(Name);
     writer.Write((uint)Flags);
     writer.WritePointerString(Type);
     writer.WritePointerString(File);
     writer.Write(Effects);
     writer.Write(Volume);
     writer.Write(Pitch);
     writer.Write(GroupID);
     writer.Write(AudioID);
 }
Example #5
0
            public void Serialize(GMDataWriter writer)
            {
                writer.WritePointerString(Name);
                writer.Write(ID);
                writer.Write(Kind);
                writer.Write((uint)ReturnType);
                writer.WritePointerString(ExternalName);

                writer.Write(ArgumentTypes.Count);
                for (int i = 0; i < ArgumentTypes.Count; i++)
                {
                    writer.Write((uint)ArgumentTypes[i]);
                }
            }
Example #6
0
 public void Serialize(GMDataWriter writer)
 {
     writer.WritePointerString(Name);
     writer.Write(SpriteID);
     writer.WriteWideBoolean(Visible);
     writer.WriteWideBoolean(Solid);
     writer.Write(Depth);
     writer.WriteWideBoolean(Persistent);
     writer.Write(ParentObjectID);
     writer.Write(MaskSpriteID);
     writer.WriteWideBoolean(Physics);
     writer.WriteWideBoolean(PhysicsSensor);
     writer.Write((int)PhysicsShape);
     writer.Write(PhysicsDensity);
     writer.Write(PhysicsRestitution);
     writer.Write(PhysicsGroup);
     writer.Write(PhysicsLinearDamping);
     writer.Write(PhysicsAngularDamping);
     writer.Write(PhysicsVertices.Count);
     writer.Write(PhysicsFriction);
     writer.WriteWideBoolean(PhysicsAwake);
     writer.WriteWideBoolean(PhysicsKinematic);
     foreach (PhysicsVertex v in PhysicsVertices)
     {
         v.Serialize(writer);
     }
     Events.Serialize(writer);
 }
Example #7
0
            public void Serialize(GMDataWriter writer)
            {
                writer.WritePointerString(Name);
                writer.Write(ID);
                writer.Write((int)Kind);
                writer.Write(Depth);
                writer.Write(OffsetX); writer.Write(OffsetY);
                writer.Write(HSpeed); writer.Write(VSpeed);
                writer.WriteWideBoolean(Visible);
                switch (Kind)
                {
                case LayerKind.Background:
                    Background.Serialize(writer);
                    break;

                case LayerKind.Instances:
                    Instances.Serialize(writer);
                    break;

                case LayerKind.Assets:
                    Assets.Serialize(writer);
                    break;

                case LayerKind.Tiles:
                    Tiles.Serialize(writer);
                    break;

                default:
                    writer.Warnings.Add(new GMWarning($"Unknown layer kind {Kind}"));
                    break;
                }
            }
Example #8
0
        public List <List <uint> > Tiles; // Contains entries per tile per frame

        public void Serialize(GMDataWriter writer)
        {
            writer.WritePointerString(Name);
            writer.WriteWideBoolean(Transparent);
            writer.WriteWideBoolean(Smooth);
            writer.WriteWideBoolean(Preload);
            writer.WritePointer(Texture);

            if (writer.VersionInfo.Major >= 2)
            {
                writer.Write(TileUnknown1);
                writer.Write(TileWidth);
                writer.Write(TileHeight);
                writer.Write(TileOutputBorderX);
                writer.Write(TileOutputBorderY);
                writer.Write(TileColumns);
                writer.Write((uint)Tiles[0].Count);
                writer.Write((uint)Tiles.Count);
                writer.Write(TileUnknown2);
                writer.Write(TileFrameLength);

                for (int i = 0; i < Tiles.Count; i++)
                {
                    if (i != 0 && Tiles[i].Count != Tiles[i - 1].Count)
                    {
                        writer.Warnings.Add(new GMWarning("Amount of frames is different across tiles", GMWarning.WarningLevel.Severe));
                    }
                    foreach (uint item in Tiles[i])
                    {
                        writer.Write(item);
                    }
                }
            }
        }
            public void Serialize(GMDataWriter writer)
            {
                writer.WritePointerString(Name);
                writer.Write((uint)FunctionType);
                writer.Write((uint)Iterations);

                Points.Serialize(writer);
            }
Example #10
0
 public void Serialize(GMDataWriter writer)
 {
     writer.WritePointerString(Name);
     writer.WriteWideBoolean(Smooth);
     writer.WriteWideBoolean(Closed);
     writer.Write(Precision);
     Points.Serialize(writer);
 }
Example #11
0
 public void Serialize(GMDataWriter writer)
 {
     writer.Write(InternalCount);
     if (InternalCount > 0)
     {
         writer.WritePointerString(Event);
     }
 }
Example #12
0
 public void Serialize(GMDataWriter writer)
 {
     writer.Write(List.Count);
     foreach (GMString str in List)
     {
         writer.WritePointerString(str);
     }
 }
Example #13
0
 public void Serialize(GMDataWriter writer)
 {
     writer.Write(ID);
     writer.Write(Tags.Count);
     foreach (GMString s in Tags)
     {
         writer.WritePointerString(s);
     }
 }
Example #14
0
 public void Serialize(GMDataWriter writer)
 {
     writer.Write(Entries.Count);
     writer.WritePointerString(Name);
     for (int i = 0; i < Entries.Count; i++)
     {
         Entries[i].Serialize(writer);
     }
 }
        public void Serialize(GMDataWriter writer, bool includeName)
        {
            if (includeName)
            {
                writer.WritePointerString(Name);
            }
            writer.Write((uint)GraphType);

            Channels.Serialize(writer);
        }
Example #16
0
 public void Serialize(GMDataWriter writer)
 {
     writer.WritePointerString(Name);
     writer.Write(AssetID);
     writer.Write(X); writer.Write(Y);
     writer.Write(ScaleX); writer.Write(ScaleY);
     writer.Write(Color);
     writer.Write(AnimationSpeed);
     writer.Write((int)AnimationSpeedType);
     writer.Write(FrameIndex);
     writer.Write(Rotation);
 }
Example #17
0
 public void Serialize(GMDataWriter writer)
 {
     writer.WritePointerString(Name);
     if (Constructor)
     {
         writer.Write((uint)CodeID | 2147483648u);
     }
     else
     {
         writer.Write(CodeID);
     }
 }
        public void Serialize(GMDataWriter writer)
        {
            writer.WritePointerString(Name);
            writer.Write(Occurrences);

            List <int> references;

            if (writer.FunctionReferences.TryGetValue(this, out references))
            {
                Occurrences = references.Count;
            }
            else
            {
                Occurrences = 0;
            }

            if (Occurrences > 0)
            {
                if (writer.VersionInfo.IsNumberAtLeast(2, 3))
                {
                    writer.Write(references[0] + 4);
                }
                else
                {
                    writer.Write(references[0]);
                }

                int returnTo = writer.Offset;
                for (int i = 0; i < references.Count; i++)
                {
                    int curr = references[i];

                    int nextDiff;
                    if (i < references.Count - 1)
                    {
                        nextDiff = references[i + 1] - curr;
                    }
                    else
                    {
                        nextDiff = ((GMChunkSTRG)writer.Data.Chunks["STRG"]).List.IndexOf(Name);
                    }

                    writer.Offset = curr + 4;
                    writer.WriteInt24(nextDiff);
                }
                writer.Offset = returnTo;
            }
            else
            {
                writer.Write((int)-1);
            }
        }
Example #19
0
        public override void Serialize(GMDataWriter writer)
        {
            base.Serialize(writer);

            writer.Pad(4);
            writer.Write(1);

            writer.Write(AllTags.Count);
            foreach (GMString s in AllTags)
            {
                writer.WritePointerString(s);
            }

            AssetTagsList.Serialize(writer);
        }
Example #20
0
 public void Serialize(GMDataWriter writer)
 {
     writer.WritePointerString(Name);
     writer.WritePointerString(DisplayName);
     if (Size < 0)
     {
         Size = BitConverter.ToInt32(BitConverter.GetBytes(-SizeFloat));
     }
     writer.Write(Size);
     writer.WriteWideBoolean(Bold);
     writer.WriteWideBoolean(Italic);
     writer.Write(RangeStart);
     writer.Write(Charset);
     writer.Write(AntiAlias);
     writer.Write(RangeEnd);
     writer.WritePointer(TextureItem);
     writer.Write(ScaleX);
     writer.Write(ScaleY);
     if (writer.VersionInfo.FormatID >= 17)
     {
         writer.Write(AscenderOffset);
     }
     Glyphs.Serialize(writer);
 }
Example #21
0
        public void Serialize(GMDataWriter writer)
        {
            writer.WritePointerString(Name);
            writer.Write((uint)PlaybackType);
            writer.Write(PlaybackSpeed);
            writer.Write((uint)PlaybackSpeedType);
            writer.Write(Length);
            writer.Write(OriginX);
            writer.Write(OriginY);
            writer.Write(Volume);

            BroadcastMessages.Serialize(writer);

            Tracks.Serialize(writer);

            writer.Write(FunctionIDs.Count);
            foreach (KeyValuePair <int, GMString> kvp in FunctionIDs)
            {
                writer.Write(kvp.Key);
                writer.WritePointerString(kvp.Value);
            }

            Moments.Serialize(writer);
        }
Example #22
0
 public void Serialize(GMDataWriter writer)
 {
     writer.Write(LibID);
     writer.Write(ID);
     writer.Write(Kind);
     writer.WriteWideBoolean(UseRelative);
     writer.WriteWideBoolean(IsQuestion);
     writer.WriteWideBoolean(UseApplyTo);
     writer.Write(ExeType);
     writer.WritePointerString(ActionName);
     writer.Write(CodeID);
     writer.Write(ArgumentCount);
     writer.Write(Who);
     writer.WriteWideBoolean(Relative);
     writer.WriteWideBoolean(IsNot);
     writer.Write(0);
 }
Example #23
0
        public void Serialize(GMDataWriter writer)
        {
            writer.WritePointerString(Name);
            writer.Write(Length);

            if (writer.VersionInfo.FormatID <= 14)
            {
                BytecodeEntry.Serialize(writer);
            }
            else
            {
                writer.Write(LocalsCount);
                writer.Write((short)((int)ArgumentsCount | ((int)Flags << 13)));
                writer.Write(writer.PointerOffsets[BytecodeEntry] - writer.Offset);
                writer.Write(BytecodeOffset);
            }
        }
        public override void Serialize(GMDataWriter writer)
        {
            base.Serialize(writer);

            writer.Write(Unknown1);
            LanguageCount = Languages.Count;
            writer.Write(LanguageCount);
            EntryCount = EntryIDs.Count;
            writer.Write(EntryCount);

            foreach (GMString s in EntryIDs)
            {
                writer.WritePointerString(s);
            }

            foreach (Language l in Languages)
            {
                l.Serialize(writer);
            }
        }
Example #25
0
        public void Serialize(GMDataWriter writer)
        {
            writer.WritePointerString(Name);

            writer.WritePointer(TexturePageIDs);
            writer.WritePointer(SpriteIDs);
            writer.WritePointer(SpineSpriteIDs);
            writer.WritePointer(FontIDs);
            writer.WritePointer(TilesetIDs);

            writer.WriteObjectPointer(TexturePageIDs);
            TexturePageIDs.Serialize(writer);
            writer.WriteObjectPointer(SpriteIDs);
            SpriteIDs.Serialize(writer);
            writer.WriteObjectPointer(SpineSpriteIDs);
            SpineSpriteIDs.Serialize(writer);
            writer.WriteObjectPointer(FontIDs);
            FontIDs.Serialize(writer);
            writer.WriteObjectPointer(TilesetIDs);
            TilesetIDs.Serialize(writer);
        }
Example #26
0
 public void Serialize(GMDataWriter writer)
 {
     writer.WritePointerString(Name);
     writer.WritePointer(TextureItem);
 }
Example #27
0
        public GMString Value; // Unsure how this is determined just yet

        public void Serialize(GMDataWriter writer)
        {
            writer.WritePointerString(Name);
            writer.WritePointerString(Value);
        }
        public override void Serialize(GMDataWriter writer)
        {
            base.Serialize(writer);

            writer.Write(DisableDebug);
            writer.Write(FormatID);
            writer.VersionInfo.FormatID = FormatID;
            writer.Write(Unknown);
            writer.WritePointerString(Filename);
            writer.WritePointerString(Config);
            writer.Write(LastObjectID);
            writer.Write(LastTileID);
            writer.Write(GameID);
            writer.Write(LegacyGUID.ToByteArray());
            writer.WritePointerString(GameName);
            writer.Write(Major);
            writer.Write(Minor);
            writer.Write(Release);
            writer.Write(Build);
            writer.VersionInfo.SetNumber(Major, Minor, Release, Build);
            writer.Write(DefaultWindowWidth);
            writer.Write(DefaultWindowHeight);
            writer.Write((uint)Info);
            writer.Write(LicenseCRC32);
            writer.Write(LicenseMD5);
            writer.Write(Timestamp);
            writer.WritePointerString(DisplayName);
            writer.Write(ActiveTargets);
            writer.Write((ulong)FunctionClassifications);
            writer.Write(SteamAppID);
            if (FormatID >= 14)
            {
                writer.Write(DebuggerPort);
            }

            writer.Write(RoomOrder.Count);
            for (int i = 0; i < RoomOrder.Count; i++)
            {
                writer.Write(RoomOrder[i]);
            }

            if (writer.VersionInfo.Major >= 2)
            {
                // Write random UID
                Random random      = new Random((int)(Timestamp & 4294967295L));
                long   firstRandom = (long)random.Next() << 32 | (long)random.Next();
                long   infoNumber  = Timestamp - 1000;
                ulong  temp        = (ulong)infoNumber;
                temp = ((temp << 56 & 18374686479671623680UL) | (temp >> 8 & 71776119061217280UL) |
                        (temp << 32 & 280375465082880UL) | (temp >> 16 & 1095216660480UL) | (temp << 8 & 4278190080UL) |
                        (temp >> 24 & 16711680UL) | (temp >> 16 & 65280UL) | (temp >> 32 & 255UL));
                infoNumber  = (long)temp;
                infoNumber ^= firstRandom;
                infoNumber  = ~infoNumber;
                infoNumber ^= ((long)GameID << 32 | (long)GameID);
                infoNumber ^= ((long)(DefaultWindowWidth + (int)Info) << 48 |
                               (long)(DefaultWindowHeight + (int)Info) << 32 |
                               (long)(DefaultWindowHeight + (int)Info) << 16 |
                               (long)(DefaultWindowWidth + (int)Info));
                infoNumber ^= FormatID;
                int infoLocation = Math.Abs((int)(Timestamp & 65535L) / 7 + (GameID - DefaultWindowWidth) + RoomOrder.Count) % 4;
                GMS2_RandomUID.Clear();
                writer.Write(firstRandom);
                GMS2_RandomUID.Add(firstRandom);
                for (int i = 0; i < 4; i++)
                {
                    if (i == infoLocation)
                    {
                        writer.Write(infoNumber);
                        GMS2_RandomUID.Add(infoNumber);
                    }
                    else
                    {
                        int first  = random.Next();
                        int second = random.Next();
                        writer.Write(first);
                        writer.Write(second);
                        GMS2_RandomUID.Add(((long)first << 32) | (long)second);
                    }
                }

                // Other GMS2-specific data
                writer.Write(GMS2_FPS);
                writer.WriteWideBoolean(GMS2_AllowStatistics);
                writer.Write(GMS2_GameGUID.ToByteArray());
            }
        }
Example #29
0
        public void Serialize(GMDataWriter writer)
        {
            writer.WritePointerString(Name);
            writer.Write(Width);
            writer.Write(Height);
            writer.Write(MarginLeft);
            writer.Write(MarginRight);
            writer.Write(MarginBottom);
            writer.Write(MarginTop);
            writer.WriteWideBoolean(Transparent);
            writer.WriteWideBoolean(Smooth);
            writer.WriteWideBoolean(Preload);
            writer.Write(BBoxMode);
            writer.Write((int)SepMasks);
            writer.Write(OriginX);
            writer.Write(OriginY);

            if (SpecialOrGMS2)
            {
                // Special/GMS2 sprite type
                writer.Write(-1);
                if (writer.VersionInfo.IsNumberAtLeast(2, 3, 2))
                {
                    writer.Write(3);
                }
                else if (writer.VersionInfo.IsNumberAtLeast(2, 3))
                {
                    writer.Write(2);
                }
                else
                {
                    writer.Write(1);
                }
                writer.Write((int)S_SpriteType);
                if (writer.VersionInfo.IsNumberAtLeast(2))
                {
                    writer.Write(GMS2_PlaybackSpeed);
                    writer.Write((int)GMS2_PlaybackSpeedType);
                    if (writer.VersionInfo.IsNumberAtLeast(2, 3))
                    {
                        writer.WritePointer(GMS2_3_Sequence);
                        if (writer.VersionInfo.IsNumberAtLeast(2, 3, 2))
                        {
                            writer.WritePointer(GMS2_3_2_NineSlice);
                        }
                    }
                }

                switch (S_SpriteType)
                {
                case SpriteType.Normal:
                    TextureItems.Serialize(writer);
                    WriteMaskData(writer);
                    break;

                case SpriteType.SWF:
                    writer.Write(8);
                    TextureItems.Serialize(writer);
                    writer.Pad(4);
                    writer.Write(S_Buffer);
                    break;

                case SpriteType.Spine:
                    writer.Pad(4);
                    writer.Write(S_Buffer);
                    break;
                }

                if (GMS2_3_Sequence != null)
                {
                    writer.Pad(4);
                    writer.WriteObjectPointer(GMS2_3_Sequence);
                    GMS2_3_Sequence.Serialize(writer);
                }

                if (GMS2_3_2_NineSlice != null)
                {
                    writer.Pad(4);
                    writer.WriteObjectPointer(GMS2_3_2_NineSlice);
                    GMS2_3_2_NineSlice.Serialize(writer);
                }
            }
            else
            {
                // Normal sprite type
                TextureItems.Serialize(writer);
                WriteMaskData(writer);
            }
        }
Example #30
0
            public void Serialize(GMDataWriter writer)
            {
                writer.WritePointerString(ModelName);
                writer.WritePointerString(Name);
                writer.Write(BuiltinName);
                writer.Write((int)Traits);
                writer.WriteWideBoolean(IsCreationTrack);

                writer.Write(Tags.Count);
                writer.Write(OwnedResources.Count);
                writer.Write(Tracks.Count);

                foreach (int i in Tags)
                {
                    writer.Write(i);
                }

                for (int i = 0; i < OwnedResources.Count; i++)
                {
                    writer.WritePointerString(OwnedResourceTypes[i]);
                    OwnedResources[i].Serialize(writer);
                }

                foreach (Track track in Tracks)
                {
                    track.Serialize(writer);
                }

                switch (ModelName.Content)
                {
                case "GMAudioTrack":
                {
                    Keyframes.Serialize(writer);
                }
                break;

                case "GMInstanceTrack":
                case "GMGraphicTrack":
                case "GMSequenceTrack":
                {
                    Keyframes.Serialize(writer);
                }
                break;

                case "GMSpriteFramesTrack":
                case "GMBoolTrack":
                {
                    Keyframes.Serialize(writer);
                }
                break;

                case "GMStringTrack":
                {
                    Keyframes.Serialize(writer);
                }
                break;

                case "GMColourTrack":
                case "GMRealTrack":
                {
                    Keyframes.Serialize(writer);
                }
                break;

                case "GMGroupTrack":
                    break;

                default:
                    throw new Exception(string.Format("Unknown sequence \"{0}\" model name.", ModelName.Content));
                }
            }