Exemplo n.º 1
0
        private void picturePalette_MouseDown(object sender, MouseEventArgs e)
        {
            int px = (e.X * 4) / picturePalette.Width;
            int py = (e.Y * 2) / picturePalette.Height;
            int p  = (py * 4) + px;
            int c  = ((e.X * 16) / picturePalette.Width) % 4;
            int a  = no + 0x400 + ((p * 4) + c);

            if (px < 0 || px >= 4 || py < 0 || py >= 2)
            {
                return;
            }

            if (e.Button == MouseButtons.Right)
            {
                byte        old = mp.rom[a];
                PalettePick pp  = new PalettePick(old & 63);
                pp.StartPosition = FormStartPosition.CenterParent;
                if (pp.ShowDialog() == DialogResult.OK)
                {
                    byte np = (byte)pp.picked;
                    if (mp.rom_modify(a, np))
                    {
                        cache();
                        redraw();
                    }
                }
            }
            else
            {
                picturePalette_MouseMove(sender, e);
            }
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
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);
            }
        }
Exemplo n.º 4
0
        protected override void OnMouseDown(MouseEventArgs e)
        {
            int i = e.X / zoom;

            if (i < 0 || i >= 4)
            {
                return;
            }
            int         s   = (8 * (3 - i));
            uint        old = (result >> s) & 0xFF;
            PalettePick p   = new PalettePick((int)(old & 63));

            p.StartPosition = FormStartPosition.CenterParent;
            if (p.ShowDialog() == DialogResult.OK)
            {
                result &= ~(uint)(0x000000FF << s);
                result |= (uint)p.picked << s;
                Refresh();
            }
        }