Example #1
0
        private void pictureBox_MouseDown(object sender, MouseEventArgs e)
        {
            int p = e.X / 16;

            if (p >= 0 && p < 16)
            {
                int         po  = ro + 0x3F0 + p;
                byte        old = mp.rom[po];
                PalettePick pp  = new PalettePick(old & 63);
                pp.StartPosition = FormStartPosition.CenterParent;
                if (pp.ShowDialog() == DialogResult.OK)
                {
                    byte np = (byte)pp.picked;
                    if (mp.rom_modify(po, np))
                    {
                        mp.refresh_map(me.room);
                        me.cache();
                        me.redraw(); // not covered by refresh_map
                        me.redraw_info();
                        redraw();
                    }
                }
            }
            pictureBox_MouseMove(sender, e);
        }
Example #2
0
        private void paletteBox_MouseDown(object sender, MouseEventArgs e)
        {
            int px = e.X / (8 * zoom);

            if (!modal && e.Button == MouseButtons.Right && px >= 0 && px < 16)
            {
                int         ro  = 16 + (1024 * me.room) + 0x3E0 + px;
                byte        old = mp.rom[ro];
                PalettePick p   = new PalettePick(old & 63);
                p.StartPosition = FormStartPosition.CenterParent;
                if (p.ShowDialog() == DialogResult.OK)
                {
                    byte np = (byte)p.picked;
                    if (mp.rom_modify(ro, np))
                    {
                        mp.refresh_map(me.room);
                        me.cache();
                        me.redraw(); // not covered by refresh_map
                        me.redraw_info();
                        redraw();
                    }
                }
            }
            else
            {
                paletteBox_MouseMove(sender, e);
            }
        }