Exemple #1
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();
        }
Exemple #2
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();
        }
Exemple #3
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();
        }
Exemple #4
0
        public void Load(ProjectReader reader, GMProject proj)
        {
            int _x, _y, _w, _h;

            Visible    = reader.ReadBoolean();
            _x         = reader.ReadInt32();
            _y         = reader.ReadInt32();
            _w         = reader.ReadInt32();
            _h         = reader.ReadInt32();
            ViewCoords = new Rectangle(_x, _y, _w, _h);
            _x         = reader.ReadInt32();
            _y         = reader.ReadInt32();
            _w         = reader.ReadInt32();
            _h         = reader.ReadInt32();
            PortCoords = new Rectangle(_x, _y, _w, _h);
            BorderHor  = reader.ReadInt32();
            BorderVert = reader.ReadInt32();
            HSpeed     = reader.ReadInt32();
            VSpeed     = reader.ReadInt32();
            ViewObject = null;
            int _objind = reader.ReadInt32();

            if (_objind > -1)
            {
                ViewObject = proj.Objects[_objind];
            }
        }
        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();
        }
Exemple #6
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();
        }
Exemple #7
0
        public void Load(ProjectReader reader)
        {
            Version = reader.ReadInt32();
            if (Version != 700)
            {
                throw new Exception("Invalid constant version, got " + Version);
            }

            Name   = reader.ReadString();
            Value  = reader.ReadString();
            Hidden = reader.ReadBoolean();
        }
        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();
        }
Exemple #9
0
        public void Load(ProjectReader reader, GMProject proj)
        {
            Visible      = reader.ReadBoolean();
            IsForeground = reader.ReadBoolean();
            Background   = null;
            int bgid, _bgx, _bgy;

            bgid = reader.ReadInt32();
            if (bgid > -1)
            {
                Background = proj.Backgrounds[bgid];
            }
            _bgx            = reader.ReadInt32();
            _bgy            = reader.ReadInt32();
            Position        = new Point(_bgx, _bgy);
            TileHorizontal  = reader.ReadBoolean();
            TileVertical    = reader.ReadBoolean();
            SpeedHorizontal = reader.ReadInt32();
            SpeedVertical   = reader.ReadInt32();
            Stretch         = reader.ReadBoolean();
        }
Exemple #10
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();
        }
Exemple #11
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();
        }
Exemple #12
0
        public void Load(ProjectReader reader)
        {
            Version = reader.ReadInt32();
            if (Version != 700)
            {
                throw new Exception("Invalid GED version, got " + Version);
            }

            Editable = reader.ReadBoolean();

            Name        = reader.ReadString();
            Folder      = reader.ReadString();
            ExtVersion  = reader.ReadString();
            Author      = reader.ReadString();
            Date        = reader.ReadString();
            License     = reader.ReadString();
            Description = reader.ReadString();
            HelpFile    = reader.ReadString();
            Hidden      = reader.ReadBoolean();

            int cnt = reader.ReadInt32();

            Uses = new List <string>(cnt);
            for (int i = 0; i < cnt; i++)
            {
                Uses.Add(reader.ReadString());
            }

            cnt   = reader.ReadInt32();
            Files = new List <GEDFile>(cnt);
            for (int i = 0; i < cnt; i++)
            {
                var ff = new GEDFile();
                ff.Load(reader);
                Files.Add(ff);
            }
        }
Exemple #13
0
        public GMAction(ProjectReader reader)
        {
            Version = reader.ReadInt32(); // what?
            if (Version != 440)
            {
                throw new Exception("Invalid Action version, got " + Version);
            }
            LibID         = reader.ReadInt32();
            ID            = reader.ReadInt32();
            Kind          = (ActionType)reader.ReadInt32();
            UseRelative   = reader.ReadBoolean();
            IsQuestion    = reader.ReadBoolean();
            UseApplyTo    = reader.ReadBoolean();
            ExeType       = (ActionExecuteType)reader.ReadInt32();
            Name          = reader.ReadString();
            Code          = reader.ReadString();
            ArgumentCount = reader.ReadInt32();
            int argc = reader.ReadInt32();

            ArgumentTypes = new List <ActionArgType>(argc);
            for (int i = 0; i < argc; i++)
            {
                ArgumentTypes.Add((ActionArgType)reader.ReadInt32());
            }
            Who      = reader.ReadInt32();
            WhoObj   = null;
            Relative = reader.ReadBoolean();
            int argc2 = reader.ReadInt32();

            Arguments = new List <string>(argc2);
            for (int i = 0; i < argc2; i++)
            {
                Arguments.Add(reader.ReadString());
            }
            IsNot = reader.ReadBoolean();
        }
Exemple #14
0
        public void Load(ProjectReader reader, GMProject proj)
        {
            int _x, _y, _objind;

            _x       = reader.ReadInt32();
            _y       = reader.ReadInt32();
            Position = new Point(_x, _y);
            Object   = null;
            _objind  = reader.ReadInt32();
            if (_objind > -1)
            {
                Object = proj.Objects[_objind];
            }
            ID           = reader.ReadInt32();
            CreationCode = reader.ReadString();
            IsLocked     = reader.ReadBoolean();
        }
Exemple #15
0
        public void Load(ProjectReader reader)
        {
            Version = reader.ReadInt32();
            if (Version != 700)
            {
                throw new Exception("Invalid function version, got " + Version);
            }

            Name         = reader.ReadString();
            ExternalName = reader.ReadString();
            Convention   = (GEDFunctionConv)reader.ReadInt32();
            Help         = reader.ReadString();
            Hidden       = reader.ReadBoolean();
            Argc         = reader.ReadInt32();
            ArgTypes     = new List <GEDFunctionArgType>(17);
            for (int i = 0; i < 17; i++)
            {
                GEDFunctionArgType tt = (GEDFunctionArgType)reader.ReadInt32();
                ArgTypes.Add(tt);
            }
            Return = (GEDFunctionArgType)reader.ReadInt32();
        }
Exemple #16
0
        public void Load(ProjectReader reader, GMProject proj)
        {
            int _x, _y, _w, _h, _bgind;

            _x           = reader.ReadInt32();
            _y           = reader.ReadInt32();
            RoomPosition = new Point(_x, _y);
            Background   = null;
            _bgind       = reader.ReadInt32();
            if (_bgind > -1)
            {
                Background = proj.Backgrounds[_bgind];
            }
            _x       = reader.ReadInt32();
            _y       = reader.ReadInt32();
            _w       = reader.ReadInt32();
            _h       = reader.ReadInt32();
            BGCoords = new Rectangle(_x, _y, _w, _h);
            Depth    = reader.ReadInt32();
            ID       = reader.ReadInt32();
            IsLocked = reader.ReadBoolean();
        }
Exemple #17
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();
        }