Example #1
0
        byte animationState = 0;                                     //cycle from 0 to 2

        public TilesViewer(Rom rom)
        {
            InitializeComponent();
            this.rom = rom;
            TilesLoader.LoadTile16(rom);
            TilesLoader.LoadTile32(rom);
        }
Example #2
0
        private void TilesViewer_Load(object sender, EventArgs e)
        {
            Tile16[] tiles16 = TilesLoader.LoadTile16(rom);

            //Need to load map data
            map = new OverworldMap(rom, 0);
            //allgfx16Ptr
            unsafe
            {
                byte *newPdata = (byte *)ZGraphics.allgfx16Ptr.ToPointer();

                BitmapData bdata    = b.LockBits(new Rectangle(0, 0, 128, 256), ImageLockMode.ReadWrite, PixelFormat.Format4bppIndexed);
                byte *     pdata    = (byte *)bdata.Scan0;
                int        sheetPos = 0;
                for (int i = 0; i < 8; i++)
                {
                    int d = 0;
                    while (d < 2048)
                    {
                        byte mapByte = newPdata[d + (map.blocksets[i] * 2048)];
                        switch (i)
                        {
                        case 0:
                        case 3:
                        case 4:
                        case 5:
                            mapByte += 0x88;
                            break;
                        }

                        pdata[d + (sheetPos * 2048)] = mapByte;
                        d++;
                    }
                    sheetPos++;
                }
                b.UnlockBits(bdata);
                ColorPalette cp = b.Palette;
                for (int i = 0; i < 16; i++)
                {
                    cp.Entries[i] = map.palettes[i + 32];
                }
                b.Palette = cp;
            }


            mainTilesDisplay.Image = b;
            //mainTilesDisplay.Refresh();
            //Need to load Palette Map Data

            //Need to load Blockset Map Data

            //-> will be able to draw a tile at this point
        }