public override void Unserialize(GMDataReader reader)
        {
            base.Unserialize(reader);

            List = new GMUniquePointerList <GMObject>();
            List.Unserialize(reader);
        }
Beispiel #2
0
        public override void Unserialize(GMDataReader reader)
        {
            base.Unserialize(reader);

            List = new GMUniquePointerList <GMAudioGroup>();
            List.Unserialize(reader);

            // Now load the audio groups if possible
            string dir = reader.Data.Directory;

            if (dir != null)
            {
                AudioData = new Dictionary <int, GMData>();
                for (int i = 1; i < List.Count; i++)
                {
                    string fname = $"audiogroup{i}.dat";
                    string path  = Path.Combine(dir, fname);
                    if (File.Exists(path))
                    {
                        reader.Data.Logger?.Invoke($"Reading audio group \"{fname}\"...");
                        using (FileStream fs = new FileStream(path, FileMode.Open))
                        {
                            GMDataReader groupReader = new GMDataReader(fs, fs.Name);
                            AudioData[i] = groupReader.Data;
                            foreach (GMWarning w in groupReader.Warnings)
                            {
                                w.File = fname;
                                reader.Warnings.Add(w);
                            }
                        }
                    }
                }
            }
        }
Beispiel #3
0
 public void Unserialize(GMDataReader reader)
 {
     Name        = reader.ReadStringPointerObject();
     DisplayName = reader.ReadStringPointerObject();
     Size        = reader.ReadInt32();
     if (Size < 0)
     {
         reader.Offset -= 4;
         SizeFloat      = -reader.ReadSingle();
     }
     Bold        = reader.ReadWideBoolean();
     Italic      = reader.ReadWideBoolean();
     RangeStart  = reader.ReadUInt16();
     Charset     = reader.ReadByte();
     AntiAlias   = reader.ReadByte();
     RangeEnd    = reader.ReadInt32();
     TextureItem = reader.ReadPointer <GMTextureItem>();
     ScaleX      = reader.ReadSingle();
     ScaleY      = reader.ReadSingle();
     if (reader.VersionInfo.FormatID >= 17)
     {
         AscenderOffset = reader.ReadInt32();
     }
     Glyphs = new GMUniquePointerList <GMGlyph>();
     Glyphs.Unserialize(reader);
 }
Beispiel #4
0
        public void Unserialize(GMDataReader reader)
        {
            Name                  = reader.ReadStringPointerObject();
            SpriteID              = reader.ReadInt32();
            Visible               = reader.ReadWideBoolean();
            Solid                 = reader.ReadWideBoolean();
            Depth                 = reader.ReadInt32();
            Persistent            = reader.ReadWideBoolean();
            ParentObjectID        = reader.ReadInt32();
            MaskSpriteID          = reader.ReadInt32();
            Physics               = reader.ReadWideBoolean();
            PhysicsSensor         = reader.ReadWideBoolean();
            PhysicsShape          = (CollisionShape)reader.ReadInt32();
            PhysicsDensity        = reader.ReadSingle();
            PhysicsRestitution    = reader.ReadSingle();
            PhysicsGroup          = reader.ReadInt32();
            PhysicsLinearDamping  = reader.ReadSingle();
            PhysicsAngularDamping = reader.ReadSingle();
            int vertexCount = reader.ReadInt32();

            PhysicsFriction  = reader.ReadSingle();
            PhysicsAwake     = reader.ReadWideBoolean();
            PhysicsKinematic = reader.ReadWideBoolean();
            PhysicsVertices  = new List <PhysicsVertex>(vertexCount);
            for (int i = vertexCount; i > 0; i--)
            {
                PhysicsVertex v = new PhysicsVertex();
                v.Unserialize(reader);
                PhysicsVertices.Add(v);
            }
            Events = new GMUniquePointerList <GMUniquePointerList <Event> >();
            Events.Unserialize(reader);
        }
        public override void Unserialize(GMDataReader reader)
        {
            base.Unserialize(reader);

            List = new GMUniquePointerList <GMFont>();
            List.Unserialize(reader);

            Padding = reader.ReadBytes(512);
        }
        public override void Unserialize(GMDataReader reader)
        {
            base.Unserialize(reader);

            if (Length == 0)
            {
                return; // In YYC, before bytecode 17, CODE is empty
            }
            List = new GMUniquePointerList <GMCode>();
            List.Unserialize(reader);
        }
Beispiel #7
0
        public override void Unserialize(GMDataReader reader)
        {
            base.Unserialize(reader);

            int chunkVersion = reader.ReadInt32();

            if (chunkVersion != 1)
            {
                reader.Warnings.Add(new GMWarning($"ACRV version is {chunkVersion}, expected 1"));
            }

            List = new GMUniquePointerList <GMAnimCurve>();
            List.Unserialize(reader);
        }
        public override void Unserialize(GMDataReader reader)
        {
            base.Unserialize(reader);

            reader.Pad(4);

            int chunkVersion = reader.ReadInt32();

            if (chunkVersion != 1)
            {
                reader.Warnings.Add(new GMWarning($"FEDS version is {chunkVersion}, expected 1"));
            }

            List = new GMUniquePointerList <GMFilterEffect>();
            List.Unserialize(reader);
        }
        public override void Unserialize(GMDataReader reader)
        {
            base.Unserialize(reader);

            List = new GMUniquePointerList <GMExtension>();
            List.Unserialize(reader);

            // Product ID information for each extension
            if (reader.VersionInfo.IsNumberAtLeast(1, 0, 0, 9999))
            {
                for (int i = 0; i < List.Count; i++)
                {
                    List[i].ProductID = new Guid(reader.ReadBytes(16).Memory.ToArray());
                }
            }
        }
Beispiel #10
0
        public override void Unserialize(GMDataReader reader)
        {
            base.Unserialize(reader);

            List = new GMUniquePointerList <GMBackground>();
            reader.VersionInfo.AlignBackgroundsTo8 = reader.VersionInfo.IsNumberAtLeast(2, 3); // only occurs on newer 2.3.1 versions
            List.Unserialize(reader, null, null, (GMDataReader reader, bool notLast) =>
            {
                int ptr = reader.ReadInt32();

                // Check if backgrounds are aligned to 8 byte offsets
                reader.VersionInfo.AlignBackgroundsTo8 &= (ptr % 8 == 0);

                return(reader.ReadPointerObject <GMBackground>(ptr, notLast));
            });
        }
        public override void Unserialize(GMDataReader reader)
        {
            base.Unserialize(reader);

            // This chunk can just be empty sometimes
            if (Length == 0)
            {
                return;
            }

            int chunkVersion = reader.ReadInt32();

            if (chunkVersion != 1)
            {
                reader.Warnings.Add(new GMWarning($"SEQN version is {chunkVersion}, expected 1"));
            }

            List = new GMUniquePointerList <GMSequence>();
            List.Unserialize(reader);
        }
        public override void Unserialize(GMDataReader reader)
        {
            base.Unserialize(reader);

            reader.Pad(4);

            int chunkVersion = reader.ReadInt32();

            if (chunkVersion != 1)
            {
                reader.Warnings.Add(new GMWarning($"TAGS version is {chunkVersion}, expected 1"));
            }

            int count = reader.ReadInt32();

            AllTags = new List <GMString>(count);
            for (int i = count; i > 0; i--)
            {
                AllTags.Add(reader.ReadStringPointerObject());
            }

            AssetTagsList = new GMUniquePointerList <AssetTags>();
            AssetTagsList.Unserialize(reader);
        }
Beispiel #13
0
        public void Unserialize(GMDataReader reader)
        {
            Name                = reader.ReadStringPointerObject();
            Caption             = reader.ReadStringPointerObject();
            Width               = reader.ReadInt32(); Height = reader.ReadInt32();
            Speed               = reader.ReadInt32();
            Persistent          = reader.ReadWideBoolean();
            BackgroundColor     = reader.ReadInt32();
            DrawBackgroundColor = reader.ReadWideBoolean();
            CreationCodeID      = reader.ReadInt32();
            int flags = reader.ReadInt32();

            if (reader.VersionInfo.IsNumberAtLeast(2, 3))
            {
                flags &= ~0x30000;
            }
            else if (reader.VersionInfo.IsNumberAtLeast(2))
            {
                flags &= ~0x20000;
            }
            Flags       = (RoomFlags)flags;
            Backgrounds = reader.ReadPointerObjectUnique <GMUniquePointerList <Background> >();
            Views       = reader.ReadPointerObjectUnique <GMUniquePointerList <View> >();
            int gameObjectListPtr = reader.ReadInt32(); // read this later
            int tilePtr           = reader.ReadInt32();

            Tiles          = reader.ReadPointerObjectUnique <GMUniquePointerList <Tile> >(tilePtr);
            Physics        = reader.ReadWideBoolean();
            Top            = reader.ReadInt32(); Left = reader.ReadInt32();
            Right          = reader.ReadInt32(); Bottom = reader.ReadInt32();
            GravityX       = reader.ReadSingle(); GravityY = reader.ReadSingle();
            PixelsToMeters = reader.ReadSingle();
            if (reader.VersionInfo.IsNumberAtLeast(2))
            {
                Layers = reader.ReadPointerObjectUnique <GMUniquePointerList <Layer> >();
                if (reader.VersionInfo.IsNumberAtLeast(2, 3))
                {
                    // Read sequence ID list
                    reader.Offset = reader.ReadInt32();
                    int seqIdCount = reader.ReadInt32();
                    SequenceIDs = new List <int>(seqIdCount);
                    for (int i = seqIdCount; i > 0; i--)
                    {
                        SequenceIDs.Add(reader.ReadInt32());
                    }
                }
            }

            // Handle reading game objects, which change lengths in 2.2.2.302 roughly, so calculate the size of them
            reader.Offset = gameObjectListPtr;
            int count = reader.ReadInt32();
            int eachSize;

            if (count > 1)
            {
                int first = reader.ReadInt32();
                eachSize = reader.ReadInt32() - first;
            }
            else
            {
                eachSize = tilePtr - (reader.Offset + 4);
            }
            if (eachSize >= 40)
            {
                reader.VersionInfo.RoomObjectPreCreate = true;
                if (eachSize == 48)
                {
                    reader.VersionInfo.SetNumber(2, 2, 2, 302);
                }
            }
            reader.Offset = gameObjectListPtr;
            GameObjects   = new GMUniquePointerList <GameObject>();
            GameObjects.Unserialize(reader);
        }
Beispiel #14
0
 public void Unserialize(GMDataReader reader)
 {
     Subtype = reader.ReadInt32();
     Actions = new GMUniquePointerList <Action>();
     Actions.Unserialize(reader);
 }