예제 #1
0
 private static void WriteHelp(GMHelp _data, Stream _s, IFF _iff)
 {
     _s.WriteInteger(_data.BackgroundColour);
     _s.WriteBoolean(_data.Mimic);
     _iff.AddString(_s, _data.Caption);
     _s.WriteInteger(_data.Left);
     _s.WriteInteger(_data.Top);
     _s.WriteInteger(_data.Width);
     _s.WriteInteger(_data.Height);
     _s.WriteBoolean(_data.Border);
     _s.WriteBoolean(_data.Sizable);
     _s.WriteBoolean(_data.OnTop);
     _s.WriteBoolean(_data.Modal);
     _iff.AddString(_s, _data.Text);
 }
예제 #2
0
        internal GMAssets(Stream _s)
        {
            Magic   = _s.ReadInteger();
            Version = _s.ReadInteger();
            if (Version == 810)
            {
                _s.ReadInteger();
            }
            Debug = _s.ReadBoolean();
            if (Version == 810)
            {
                _s.ReadInteger();
            }
            Options = new GMOptions(this, _s);
            Name    = _s.ReadString();
            _s.ReadCompressedStream();
            Stream stream = null;

            byte[] array = null;
            if (Version != 800 && Version != 810)
            {
                array  = _s.ReadCompressedStream();
                stream = new MemoryStream(array);
            }
            else
            {
                stream = _s;
            }
            if (Version == 800 || Version == 810)
            {
                stream = stream.ReadStreamE();
                int num = stream.ReadInteger();
                for (int i = 1; i <= num; i++)
                {
                    stream.ReadInteger();
                }
                stream.ReadBoolean();
            }
            else
            {
                int num2 = stream.ReadInteger();
                int num3 = stream.ReadInteger();
                for (int j = 0; j <= num2 - 1; j++)
                {
                    stream.ReadInteger();
                }
                int key = stream.ReadInteger();
                for (int k = 0; k <= num3 - 1; k++)
                {
                    stream.ReadInteger();
                }
                long position = stream.Position;
                Decrypt2(key, array, position + 1);
                stream.ReadInteger();
            }
            GameID      = stream.ReadInteger();
            GameGUID    = stream.ReadGuid();
            Extensions  = new List <GMExtension>();
            Triggers    = new List <GMTrigger>();
            Sounds      = new List <KeyValuePair <string, GMSound> >();
            Sprites     = new List <KeyValuePair <string, GMSprite> >();
            Backgrounds = new List <KeyValuePair <string, GMBackground> >();
            Paths       = new List <KeyValuePair <string, GMPath> >();
            Scripts     = new List <KeyValuePair <string, GMScript> >();
            Fonts       = new List <KeyValuePair <string, GMFont> >();
            TimeLines   = new List <KeyValuePair <string, GMTimeLine> >();
            Objects     = new List <KeyValuePair <string, GMObject> >();
            Rooms       = new List <KeyValuePair <string, GMRoom> >();
            DataFiles   = new List <KeyValuePair <string, GMDataFile> >();
            Libraries   = new List <string>();
            RoomOrder   = new List <int>();
            Extensions_Load(stream);
            if (Version == 800 || Version == 810)
            {
                Trigger_Load(stream);
                Constant_Load(stream);
            }
            Sound_Load(stream);
            Sprite_Load(stream);
            Background_Load(stream);
            Path_Load(stream);
            Script_Load(stream);
            Font_Load(stream);
            TimeLine_Load(stream);
            Object_Load(stream);
            Room_Load(stream);
            DataFile_Load(stream);
            Help = new GMHelp(this, stream);
            Library_Load(stream);
            Room_LoadOrder(stream);
        }
예제 #3
0
        internal GMAssets(Stream _s, bool _gmk)
        {
            Magic   = _s.ReadInteger();
            Version = _s.ReadInteger();
            Stream stream = _s;

            byte[] array = null;
            if (Version >= 701)
            {
                int num  = stream.ReadInteger();
                int num2 = stream.ReadInteger();
                for (int i = 0; i <= num - 1; i++)
                {
                    stream.ReadInteger();
                }
                int key = stream.ReadInteger();
                for (int j = 0; j <= num2 - 1; j++)
                {
                    stream.ReadInteger();
                }
                long position = stream.Position;
                array           = new byte[stream.Length];
                stream.Position = 0L;
                stream.Read(array, 0, (int)stream.Length);
                Decrypt2(key, array, position + 1);
                MemoryStream memoryStream = new MemoryStream(array, false);
                stream          = memoryStream;
                stream.Position = position;
            }
            if (Version < 600)
            {
                stream.ReadInteger();
            }
            GameID      = stream.ReadInteger();
            GameGUID    = stream.ReadGuid();
            Extensions  = new List <GMExtension>();
            Triggers    = new List <GMTrigger>();
            Sounds      = new List <KeyValuePair <string, GMSound> >();
            Sprites     = new List <KeyValuePair <string, GMSprite> >();
            Backgrounds = new List <KeyValuePair <string, GMBackground> >();
            Paths       = new List <KeyValuePair <string, GMPath> >();
            Scripts     = new List <KeyValuePair <string, GMScript> >();
            Fonts       = new List <KeyValuePair <string, GMFont> >();
            TimeLines   = new List <KeyValuePair <string, GMTimeLine> >();
            Objects     = new List <KeyValuePair <string, GMObject> >();
            Rooms       = new List <KeyValuePair <string, GMRoom> >();
            DataFiles   = new List <KeyValuePair <string, GMDataFile> >();
            Libraries   = new List <string>();
            RoomOrder   = new List <int>();
            Options     = new GMOptions(this, stream, true);
            LoadGMK(Sounds, stream, (GMAssets _t, Stream _st) => new GMSound(_t, _st));
            LoadGMK(Sprites, stream, (GMAssets _t, Stream _st) => new GMSprite(_t, _st));
            LoadGMK(Backgrounds, stream, (GMAssets _t, Stream _st) => new GMBackground(_t, _st));
            LoadGMK(Paths, stream, (GMAssets _t, Stream _st) => new GMPath(_t, _st));
            LoadGMK(Scripts, stream, (GMAssets _t, Stream _st) => new GMScript(_t, _st));
            LoadGMK(Fonts, stream, (GMAssets _t, Stream _st) => new GMFont(_t, _st));
            LoadGMK(TimeLines, stream, (GMAssets _t, Stream _st) => new GMTimeLine(_t, _st));
            LoadGMK(Objects, stream, (GMAssets _t, Stream _st) => new GMObject(_t, _st));
            LoadGMK(Rooms, stream, (GMAssets _t, Stream _st) => new GMRoom(_t, _st, true));
            RoomMaxId     = stream.ReadInteger();
            RoomMaxTileId = stream.ReadInteger();
            LoadGMK_GMDataFile(DataFiles, stream);
            LoadGMK_GMExtension(Extensions, stream);
            Help = new GMHelp(this, stream);
            Library_Load(stream);
        }