Ejemplo n.º 1
0
        public GMPath(ProjectReader reader)
        {
            Name            = reader.ReadString();
            LastChanged     = reader.ReadDate();
            Version         = reader.ReadInt32();
            Smooth          = reader.ReadBoolean();
            Closed          = reader.ReadBoolean();
            Precision       = reader.ReadUInt32();
            _BackgroundRoom = reader.ReadInt32();

            int _x = reader.ReadInt32();
            int _y = reader.ReadInt32();

            Snap = new Point(_x, _y);

            int pointcnt = reader.ReadInt32();

            Points = new List <PathPoint>(pointcnt);
            for (int i = 0; i < pointcnt; i++)
            {
                double _px     = reader.ReadDouble();
                double _py     = reader.ReadDouble();
                double _pspeed = reader.ReadDouble();
                Points.Add(new PathPoint(_px, _py, _pspeed));
            }

            reader.Dispose();
        }
Ejemplo n.º 2
0
        public GMBackground(ProjectReader reader)
        {
            Name         = reader.ReadString();
            LastChanged  = reader.ReadDate();
            Version      = reader.ReadInt32(); // version that we don't care about here.
            UseAsTileset = reader.ReadBoolean();
            TileWidth    = reader.ReadInt32();
            TileHeight   = reader.ReadInt32();
            OffsetH      = reader.ReadInt32();
            OffsetV      = reader.ReadInt32();
            SepH         = reader.ReadInt32();
            SepV         = reader.ReadInt32();
            FrameVersion = reader.ReadInt32(); // frame version
            int Width, Height;

            Width      = reader.ReadInt32();
            Height     = reader.ReadInt32();
            Background = null;
            if (Width * Height != 0)
            {
                Background = reader.ReadBGRAImage(Width, Height);
            }

            reader.Dispose();
        }
Ejemplo n.º 3
0
        public GMIncludedFile(ProjectReader reader)
        {
            LastChanged = reader.ReadDate();
            Version     = reader.ReadInt32();
            if (Version != 800)
            {
                throw new InvalidDataException("Wrong Included File version, got " + Version);
            }

            FileName       = reader.ReadString();
            FilePath       = reader.ReadString();
            Original       = reader.ReadBoolean();
            FileSize       = reader.ReadInt32();
            StoreInProject = reader.ReadBoolean();
            Data           = null;
            if (StoreInProject)
            {
                int size = reader.ReadInt32(); // ??? why it's repeated twice?
                Data = reader.ReadBytes(size);
            }
            ExportKind      = (ExportActionKind)reader.ReadInt32();
            ExportFolder    = reader.ReadString();
            Overwrite       = reader.ReadBoolean();
            FreeMemory      = reader.ReadBoolean();
            RemoveAtGameEnd = reader.ReadBoolean();
        }
Ejemplo n.º 4
0
        private void Load_Triggers(ProjectReader reader)
        {
            int Version = reader.ReadInt32();

            if (Version != 800)
            {
                throw new InvalidDataException("This library only supports .gmk GM8.0 files.");
            }

            int Count = reader.ReadInt32();

            Triggers = new List <GMTrigger>(Count);
            for (int i = 0; i < Count; i++)
            {
                var dec_reader = reader.MakeReaderZlib();
                if (dec_reader.ReadBoolean())
                {
                    Triggers.Add(new GMTrigger(dec_reader));
                }
                else
                {
                    Triggers.Add(null);
                }
            }

            TriggersLastChanged = reader.ReadDate();
        }
Ejemplo n.º 5
0
        public GMObject(ProjectReader reader, GMProject proj)
        {
            Name        = reader.ReadString();
            LastChanged = reader.ReadDate();
            Version     = reader.ReadInt32();
            if (Version != 430)
            {
                throw new InvalidDataException("Invalid Object version, got " + Version);
            }
            Sprite = null;
            int spr = reader.ReadInt32();

            if (spr > -1)
            {
                Sprite = proj.Sprites[spr];
            }

            Solid      = reader.ReadBoolean();
            Visible    = reader.ReadBoolean();
            Depth      = reader.ReadInt32();
            Persistent = reader.ReadBoolean();
            Parent     = null;
            _ParentInd = reader.ReadInt32();
            Mask       = null;
            int mask = reader.ReadInt32();

            if (mask > -1)
            {
                Mask = proj.Sprites[mask];
            }

            int ev_count = reader.ReadInt32();

            Events = new List <List <GMEvent> >(ev_count + 1);
            for (int i = 0; i <= ev_count; i++)
            {
                var  l    = new List <GMEvent>();
                bool done = false;
                while (!done)
                {
                    int first = reader.ReadInt32();
                    if (first != -1)
                    {
                        var ev = new GMEvent(reader);
                        ev.Key = first;
                        l.Add(ev);
                    }
                    else
                    {
                        done = true;
                    }
                }
                Events.Add(l);
            }

            reader.Dispose();
        }
Ejemplo n.º 6
0
        public GMScript(ProjectReader reader)
        {
            Name        = reader.ReadString();
            LastChanged = reader.ReadDate();
            Version     = reader.ReadInt32();
            if (Version != 800)
            {
                throw new InvalidDataException("This library only supports .gmk GM8.0 files.");
            }
            Code = reader.ReadString();

            reader.Dispose();
        }
Ejemplo n.º 7
0
        public GMSprite(ProjectReader reader)
        {
            Name        = reader.ReadString();
            LastChanged = reader.ReadDate();
            Version     = reader.ReadInt32();
            if (Version != 800)
            {
                throw new InvalidDataException("This library only supports .gmk GM8.0 files.");
            }

            int _x = reader.ReadInt32();
            int _y = reader.ReadInt32();

            Origin = new Point(_x, _y);

            int framenum = reader.ReadInt32();

            Subimages = new List <Image>(framenum);
            for (int i = 0; i < framenum; i++)
            {
                int framever = reader.ReadInt32();
                if (framever != 800)
                {
                    throw new InvalidDataException("This library only supports .gmk GM8.0 files.");
                }
                Width  = reader.ReadInt32();
                Height = reader.ReadInt32();
                if (Width * Height != 0)
                {
                    Subimages.Add(reader.ReadBGRAImage(Width, Height));
                }
                else
                {
                    Subimages.Add(null);  // ????
                }
            }

            MaskMode       = (SpriteMaskMode)reader.ReadInt32();
            AlphaTolerance = reader.ReadInt32();
            SeparateMasks  = reader.ReadBoolean();
            BBoxMode       = (SpriteBBoxMode)reader.ReadInt32();

            int _l = reader.ReadInt32();
            int _r = reader.ReadInt32();
            int _b = reader.ReadInt32();
            int _t = reader.ReadInt32();

            BBox = new Rectangle(_l, _r, _b, _t);

            reader.Dispose();
        }
Ejemplo n.º 8
0
        public GMTimeline(ProjectReader reader)
        {
            Name        = reader.ReadString();
            LastChanged = reader.ReadDate();
            Version     = reader.ReadInt32();

            int momentcount = reader.ReadInt32();

            Moments = new List <TimelineMoment>(momentcount);
            for (int i = 0; i < momentcount; i++)
            {
                Moments.Add(new TimelineMoment(reader));
            }

            reader.Dispose();
        }
Ejemplo n.º 9
0
        public GMFont(ProjectReader reader)
        {
            Name        = reader.ReadString();
            LastChanged = reader.ReadDate();
            Version     = reader.ReadInt32();
            if (Version != 800)
            {
                throw new InvalidDataException("This library only supports .gmk GM8.0 files.");
            }

            FontName = reader.ReadString();
            Size     = reader.ReadInt32();
            Bold     = reader.ReadBoolean();
            Italic   = reader.ReadBoolean();
            RangeMin = reader.ReadInt32();
            RangeMax = reader.ReadInt32();
        }
Ejemplo n.º 10
0
        private void Load_Constants(ProjectReader reader)
        {
            int Version = reader.ReadInt32();

            if (Version != 800)
            {
                throw new InvalidDataException("This library only supports .gmk GM8.0 files.");
            }

            int Count = reader.ReadInt32();

            Constants = new List <GMConstant>(Count);
            for (int i = 0; i < Count; i++)
            {
                Constants.Add(new GMConstant(reader));
            }

            ConstantsLastChanged = reader.ReadDate();
        }
Ejemplo n.º 11
0
        public GMGameInformation(ProjectReader reader)
        {
            BackgroundColor = reader.ReadColor();
            SeparateWindow  = reader.ReadBoolean();
            Caption         = reader.ReadString();
            int _l, _t, _w, _h;

            _l          = reader.ReadInt32();
            _t          = reader.ReadInt32();
            _w          = reader.ReadInt32();
            _h          = reader.ReadInt32();
            Position    = new Rectangle(_l, _t, _w, _h);
            ShowBorder  = reader.ReadBoolean();
            AllowResize = reader.ReadBoolean();
            AlwaysOnTop = reader.ReadBoolean();
            Freeze      = reader.ReadBoolean();
            LastChanged = reader.ReadDate();
            Text        = reader.ReadString();

            reader.Dispose();
        }
Ejemplo n.º 12
0
        public GMSound(ProjectReader reader)
        {
            Name        = reader.ReadString();
            LastChanged = reader.ReadDate();
            Version     = reader.ReadInt32();
            if (Version != 800)
            {
                throw new InvalidDataException("This library only supports .gmk GM8.0 files.");
            }

            Kind     = (SoundKind)reader.ReadInt32();
            FileType = reader.ReadString();
            FileName = reader.ReadString();
            Data     = null;
            if (reader.ReadBoolean())
            {
                int size = reader.ReadInt32();
                Data = reader.ReadBytes(size);
            }

            int eff    = reader.ReadInt32();
            int efflen = (int)SoundEffects.__LENGTH;

            Effects = new bool[efflen];
            for (int i = 0; i < efflen; i++)
            {
                Effects[i] = (eff & 1) != 0;
                eff      >>= 1;
            }

            // to check for an effect you do:
            // if (Effects[(int)SoundEffects.CHORUS]) { }

            Volume  = reader.ReadDouble();
            Panning = reader.ReadDouble();
            Preload = reader.ReadBoolean();

            reader.Dispose();
        }
Ejemplo n.º 13
0
        public GMRoom(ProjectReader reader, GMProject proj)
        {
            Name        = reader.ReadString();
            LastChanged = reader.ReadDate();
            Version     = reader.ReadInt32();
            Caption     = reader.ReadString();
            Width       = reader.ReadUInt32();
            Height      = reader.ReadUInt32();
            int _snx = reader.ReadInt32();
            int _sny = reader.ReadInt32();

            Snap            = new Point(_snx, _sny);
            Isometric       = reader.ReadBoolean();
            Speed           = reader.ReadUInt32();
            Persistent      = reader.ReadBoolean();
            BackgroundColor = reader.ReadColor();
            int val = reader.ReadInt32();

            DrawBackgroundColor    = (val & 1) != 0;
            ClearBGWithWindowColor = (val & 0b10) == 0;
            CreationCode           = reader.ReadString();

            // Read room backgrounds.
            int bgcount = reader.ReadInt32();

            Backgrounds = new List <RoomBackground>(bgcount);
            for (int i = 0; i < bgcount; i++)
            {
                var bgstruct = new RoomBackground();
                bgstruct.Load(reader, proj);
                Backgrounds.Add(bgstruct);
            }

            // Read views.
            EnableViews = reader.ReadBoolean();
            int viewcount = reader.ReadInt32();

            Views = new List <RoomView>(viewcount);
            for (int i = 0; i < viewcount; i++)
            {
                var viewstruct = new RoomView();
                viewstruct.Load(reader, proj);
                Views.Add(viewstruct);
            }

            // Read room instances.
            int instcount = reader.ReadInt32();

            Instances = new List <RoomInstance>(instcount);
            for (int i = 0; i < instcount; i++)
            {
                var inststruct = new RoomInstance();
                inststruct.Load(reader, proj);
                Instances.Add(inststruct);
            }

            // Read room tiles.
            int tilecount = reader.ReadInt32();

            Tiles = new List <RoomTile>(tilecount);
            for (int i = 0; i < tilecount; i++)
            {
                var tilestruct = new RoomTile();
                tilestruct.Load(reader, proj);
                Tiles.Add(tilestruct);
            }

            // weird editor settings (aren't really important unless you make an IDE)
            REI                 = reader.ReadBoolean();
            EditorWidth         = reader.ReadInt32();
            EditorHeight        = reader.ReadInt32();
            ShowGrid            = reader.ReadBoolean();
            ShowObjects         = reader.ReadBoolean();
            ShowTiles           = reader.ReadBoolean();
            ShowBGs             = reader.ReadBoolean();
            ShowFGs             = reader.ReadBoolean();
            ShowViews           = reader.ReadBoolean();
            DeleteUnderlyingObj = reader.ReadBoolean();
            DeleteUnderlyingTil = reader.ReadBoolean();
            Tab                 = (EditorTab)reader.ReadInt32();
            int _hx = reader.ReadInt32();
            int _hy = reader.ReadInt32();

            Scrollbar = new Point(_hx, _hy);

            reader.Dispose();
        }