Пример #1
0
        public static void UpdateTreeView(Form1 _MainForm)
        {
            //Header
            _MainForm.treeView1.Nodes[0].Nodes[0].Text += LevelCard.get_eCoin_position(LevelCard.level_header.eCoin);
            _MainForm.treeView1.Nodes[0].Nodes[1].Text += LevelCard.level_header.acecoins.ToString();
            _MainForm.treeView1.Nodes[0].Nodes[2].Text += LevelCard.getLevelSet(LevelCard.level_header.lvl_class);
            _MainForm.treeView1.Nodes[0].Nodes[3].Text += LevelCard.level_header.lvl_num.ToString();
            _MainForm.treeView1.Nodes[0].Nodes[4].Text += LevelCard.getLevelIcon(LevelCard.level_header.lvl_icon);
            _MainForm.treeView1.Nodes[0].Nodes[5].Text += LevelCard.level_header.lvl_name;

            //Objects
        }
Пример #2
0
        public static void LoadLevel(Form1 _MainForm, string filename, Stream file)
        {
            //TODO
            //Load File (*.level)
            InitLevel(_MainForm);
            InitTreeView(_MainForm);
            LevelCard.loaded_file = filename;
            file.Seek(0, SeekOrigin.Begin);
            LevelCard.header header;

            //Load Header
            header.eCoin     = (byte)file.ReadByte();
            header.acecoins  = (byte)file.ReadByte();
            header.lvl_class = (byte)file.ReadByte();
            header.lvl_num   = (byte)file.ReadByte();
            header.lvl_icon  = (byte)file.ReadByte();

            file.Seek(0x40, SeekOrigin.Begin);
            if (header.eCoin != 0)
            {
                //Load eCoin
                LevelCard.eCoin eCoin;
                ushort[]        pal = new ushort[16];
                byte[]          gfx = new byte[0x120];

                for (int i = 0; i < pal.Length; i++)
                {
                    pal[i] = (ushort)(file.ReadByte() | (file.ReadByte() << 8));
                }

                for (int i = 0; i < gfx.Length; i++)
                {
                    gfx[i] = (byte)file.ReadByte();
                }

                eCoin.pal = pal;
                eCoin.gfx = gfx;

                LevelCard.level_eCoin = eCoin;

                file.Seek(0x180, SeekOrigin.Begin);
            }

            //Level Name
            byte[] name = new byte[21];
            for (int i = 0; i < 21; i++)
            {
                name[i] = (byte)file.ReadByte();
                if (name[i] == 0xFF)
                {
                    break;
                }
            }

            header.lvl_name = LevelCard.getLevelName(name);

            LevelCard.level_header = header;

            //Load Objects

            //Update TreeView
            UpdateTreeView(_MainForm);
        }
Пример #3
0
        public static void LoadLevel(Form1 _MainForm, string filename, Stream file)
        {
            //TODO
            //Load File (*.level)
            InitLevel(_MainForm);
            InitTreeView(_MainForm);
            LevelCard.loaded_file = filename;
            file.Seek(0, SeekOrigin.Begin);
            LevelCard.header header = new LevelCard.header();

            //Load Header
            header.eCoin     = (byte)file.ReadByte();
            header.acecoins  = (byte)file.ReadByte();
            header.lvl_class = (byte)file.ReadByte();
            header.lvl_num   = (byte)file.ReadByte();
            header.lvl_icon  = (byte)file.ReadByte();

            for (int numBytes = 0x5; numBytes < 0x40; numBytes++)
            {//0x4-0x40 is where data stops
                header.delicious.Add((byte)file.ReadByte());
            }

            //file.Seek(0x40, SeekOrigin.Begin);
            if (header.eCoin != 0)
            {
                //Load eCoin
                LevelCard.eCoin eCoin;
                ushort[]        pal = new ushort[16];
                byte[]          gfx = new byte[0x120];

                for (int i = 0; i < pal.Length; i++)
                {
                    pal[i] = (ushort)(file.ReadByte() | (file.ReadByte() << 8));
                }

                for (int i = 0; i < gfx.Length; i++)
                {
                    gfx[i] = (byte)file.ReadByte();
                }

                eCoin.pal = pal;
                eCoin.gfx = gfx;

                //file.Seek(0x180, SeekOrigin.Begin);
                LevelCard.level_eCoin = eCoin;
                //for (int numBytes = 0x17F; numBytes < 0x4D4; numBytes++)
                while (file.Position < file.Length)//nothing past 17F in saved level, 4D4 is EoF
                {
                    header.dessert.Add((byte)file.ReadByte());
                }
            }

            //Level Name
            byte[] name = new byte[21];
            for (int i = 0; i < 21; i++)
            {
                name[i] = (byte)file.ReadByte();
                if (name[i] == 0xFF)
                {
                    break;
                }
            }

            header.lvl_name = LevelCard.getLevelName(name);

            LevelCard.level_header = header;

            //Load Objects (Are they actually loaded? Is this the problem?)

            //Update TreeView
            UpdateTreeView(_MainForm);
        }