예제 #1
0
        public void getMapArea(int index, int group, int season, Program.GameTypes game)
        {
            //CC2D - map group
            //CC30 - map index
            //CD24 - map area
            //FF8D - area | 0x80, and later that & 0x7f - compression type?
            //FF8B - area

            int indexBase = 0x10000 + (game == Program.GameTypes.Ages ? 0x0F9C : 0x0C84);

            //4:6d7a - start of procedure
            gb.BufferLocation = 0x10000 + (game == Program.GameTypes.Ages ? 0x12D4 : 0x133C) + (group * 2);
            //6da1
            gb.BufferLocation = 0x10000 + gb.ReadByte() + ((gb.ReadByte() - 0x40) * 0x100) + index;
            byte a    = gb.ReadByte();
            byte area = (byte)(a & 0x7F);

            gb.BufferLocation = indexBase + area * 8;
            if (game == Program.GameTypes.Seasons)
            {
                if (gb.ReadByte() == 0xFF)
                {
                    gb.BufferLocation  = 0x10000 + gb.ReadByte() + ((gb.ReadByte() - 0x40) * 0x100);
                    gb.BufferLocation += season * 8;
                }
                else
                {
                    gb.BufferLocation--;
                }
            }
            AreaLoader.Area ar = new AreaLoader.Area();
            ar        = areaLoader.loadArea(gb.BufferLocation, area, game);
            room.area = ar;
        }
예제 #2
0
        private void LoadTilesetData()
        {
            int indexBase = 0x10000 + (form.game == Program.GameTypes.Ages ? 0x0F9C : 0x0C84);

            AreaLoader.Area a = form.mapLoader.areaLoader.loadArea(indexBase + (int)nTileset.Value * 8, (int)nTileset.Value, form.game);
            isPastTileset     = (a.tileset > 0xFF);
            gb.BufferLocation = gb.ReadByte(0x200000 + (a.tileset & 0x7F) * 3) * 0x4000 + gb.ReadByte() + ((gb.ReadByte() - 0x40) * 0x100);
            formation         = gb.ReadBytes(0x800);
            originalFormation = new byte[0x800];
            Array.Copy(formation, originalFormation, 0x800);
            if (a.tileset > 0xFF)
            {
                for (int i = 64; i < 128; i++)
                {
                    for (int y = 0; y < 2; y++)
                    {
                        for (int x = 0; x < 2; x++)
                        {
                            byte b = formation[i * 8 + 4 + x + (y * 2)];
                            if ((b & 7) == 6)
                            {
                                formation[i * 8 + 4 + x + (y * 2)] = (byte)((b & 0x78));
                            }
                        }
                    }
                }
            }
        }
예제 #3
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            gb.BufferLocation = 0x181000 + (int)nTileset.Value * 0x1000;
            for (int i = 0; i < 256; i++)
            {
                for (int y = 0; y < 8; y++)
                {
                    byte b = (byte)(tiles[i, 7, y] & 1);
                    b |= (byte)((tiles[i, 6, y] & 1) << 1);
                    b |= (byte)((tiles[i, 5, y] & 1) << 2);
                    b |= (byte)((tiles[i, 4, y] & 1) << 3);
                    b |= (byte)((tiles[i, 3, y] & 1) << 4);
                    b |= (byte)((tiles[i, 2, y] & 1) << 5);
                    b |= (byte)((tiles[i, 1, y] & 1) << 6);
                    b |= (byte)((tiles[i, 0, y] & 1) << 7);
                    gb.WriteByte(b);
                    b  = (byte)((tiles[i, 7, y] & 2) >> 1);
                    b |= (byte)((tiles[i, 6, y] & 2));
                    b |= (byte)((tiles[i, 5, y] & 2) << 1);
                    b |= (byte)((tiles[i, 4, y] & 2) << 2);
                    b |= (byte)((tiles[i, 3, y] & 2) << 3);
                    b |= (byte)((tiles[i, 2, y] & 2) << 4);
                    b |= (byte)((tiles[i, 1, y] & 2) << 5);
                    b |= (byte)((tiles[i, 0, y] & 2) << 6);
                    gb.WriteByte(b);
                }
            }
            int indexBase = 0x10000 + (form.game == Program.GameTypes.Ages ? 0x0F9C : 0x0C84);

            AreaLoader.Area a = form.mapLoader.areaLoader.loadArea(indexBase + (int)nTileset.Value * 8, (int)nTileset.Value, form.game);
            gb.BufferLocation = gb.ReadByte(0x200000 + (a.tileset & 0x7F) * 3) * 0x4000 + gb.ReadByte() + ((gb.ReadByte() - 0x40) * 0x100);
            gb.WriteBytes(formation);
            form.gb = gb;
        }
예제 #4
0
        public frmDecompressTileset(Form1 f, int area)
        {
            InitializeComponent();
            form1 = f;

            int indexBase = 0x10000 + 0x0F9C;

            AreaLoader.Area a = f.mapLoader.areaLoader.loadArea(indexBase + area * 8, area, Program.GameTypes.Ages);
            lockAreaUpdates  = true;
            nVRAM.Value      = a.vram;
            nUnique.Value    = a.unique;
            nTileset.Value   = a.tileset;
            nAnimation.Value = a.animation;
            nPalette.Value   = a.palette;
            lockAreaUpdates  = false;
            nVRAM_ValueChanged(null, null);
        }
예제 #5
0
        private void DrawPalette()
        {
            int indexBase = 0x10000 + (form.game == Program.GameTypes.Ages ? 0x0F9C : 0x0C84);

            AreaLoader.Area a = form.mapLoader.areaLoader.loadArea(indexBase + (int)nTileset.Value * 8, (int)nTileset.Value, form.game);
            palette = form.paletteLoader.LoadPalette(a.palette, form.game);
            Bitmap   pal = new Bitmap(256, 32);
            Graphics g   = Graphics.FromImage(pal);

            for (int i = 0; i < 8; i++)
            {
                for (int k = 0; k < 4; k++)
                {
                    g.FillRectangle(new SolidBrush(palette[i, k]), i * 32, k * 8, 32, 8);
                }
            }
            pPalette.Image = pal;
        }
예제 #6
0
        private void nArea_ValueChanged(object sender, EventArgs e)
        {
            int indexBase = 0x10000 + (game == Program.GameTypes.Ages ? 0x0F9C : 0x0C84);

            if (gb.ReadByte(indexBase) == 0xFF)
            {
                indexBase = 0x10000 + gb.ReadByte() + ((gb.ReadByte() - 0x40) * 0x100);
            }
            AreaLoader.Area a = areaLoader.loadArea(indexBase + (int)nArea.Value * 8, (int)nArea.Value, game);
            nDungeon.Value = (byte)(a.flags1 & 0xF);
            int flag = a.flags2;

            checkBox1.Checked = (flag & 1) != 0;
            checkBox2.Checked = (flag & 2) != 0;
            checkBox3.Checked = (flag & 4) != 0;
            checkBox4.Checked = (flag & 8) != 0;
            checkBox5.Checked = (flag & 16) != 0;
            checkBox7.Checked = (flag & 32) != 0;
            checkBox8.Checked = (flag & 64) != 0;
            checkBox9.Checked = (flag & 128) != 0;
        }