Exemple #1
0
        public static void m72_draw_sprites(RECT rect)
        {
            int offs;

            offs = 0;
            while (offs < spriteram_size / 2)
            {
                int code, color, sx, sy, flipx, flipy, w, h, x, y;
                code  = m72_spriteram[offs + 1];
                color = m72_spriteram[offs + 2] & 0x0f;
                sx    = -256 + (m72_spriteram[offs + 3] & 0x3ff);
                sy    = 384 - (m72_spriteram[offs + 0] & 0x1ff);
                flipx = m72_spriteram[offs + 2] & 0x0800;
                flipy = m72_spriteram[offs + 2] & 0x0400;
                w     = 1 << ((m72_spriteram[offs + 2] & 0xc000) >> 14);
                h     = 1 << ((m72_spriteram[offs + 2] & 0x3000) >> 12);
                sy   -= 16 * h;

                /*if (flip_screen_get())
                 * {
                 *  sx = 512 - 16*w - sx;
                 *  sy = 284 - 16*h - sy;
                 *  flipx = !flipx;
                 *  flipy = !flipy;
                 * }*/
                for (x = 0; x < w; x++)
                {
                    for (y = 0; y < h; y++)
                    {
                        int c = code;
                        if (flipx != 0)
                        {
                            c += 8 * (w - 1 - x);
                        }
                        else
                        {
                            c += 8 * x;
                        }
                        if (flipy != 0)
                        {
                            c += h - 1 - y;
                        }
                        else
                        {
                            c += y;
                        }
                        Drawgfx.common_drawgfx_m72(M72.sprites1rom, c, color, flipx, flipy, sx + 16 * x, sy + 16 * y, rect);
                    }
                }
                offs += w * 4;
            }
        }
Exemple #2
0
        public static void draw_sprites(int iBitmap, RECT cliprect)
        {
            //gfx_element* gfx = machine->gfx[1];
            //gfx_element mygfx = *gfx;
            int source_offset;
            int sprite_xoffs = namcos1_spriteram[0x800 + 0x07f5] + ((namcos1_spriteram[0x800 + 0x07f4] & 1) << 8);
            int sprite_yoffs = namcos1_spriteram[0x800 + 0x07f7];

            for (source_offset = 0xfe0; source_offset >= 0x800; source_offset -= 0x10)
            {
                int[] sprite_size = new int[] { 16, 8, 32, 4 };
                int   attr1       = namcos1_spriteram[source_offset + 10];
                int   attr2       = namcos1_spriteram[source_offset + 14];
                int   color       = namcos1_spriteram[source_offset + 12];
                int   flipx       = (attr1 & 0x20) >> 5;
                int   flipy       = (attr2 & 0x01);
                int   sizex       = sprite_size[(attr1 & 0xc0) >> 6];
                int   sizey       = sprite_size[(attr2 & 0x06) >> 1];
                int   tx          = (attr1 & 0x18) & (~(sizex - 1));
                int   ty          = (attr2 & 0x18) & (~(sizey - 1));
                int   sx          = namcos1_spriteram[source_offset + 13] + ((color & 0x01) << 8);
                int   sy          = -namcos1_spriteram[source_offset + 15] - sizey;
                int   sprite      = namcos1_spriteram[source_offset + 11];
                int   sprite_bank = attr1 & 7;
                int   priority    = (namcos1_spriteram[source_offset + 14] & 0xe0) >> 5;
                namcos1_pri = priority;
                sprite     += sprite_bank * 256;
                color       = color >> 1;
                sx         += sprite_xoffs;
                sy         -= sprite_yoffs;
                if (Video.flip_screen_get())
                {
                    sx     = -sx - sizex;
                    sy     = -sy - sizey;
                    flipx ^= 1;
                    flipy ^= 1;
                }
                sy++;
                //mygfx.width = sizex;
                //mygfx.height = sizey;
                //mygfx.gfxdata = gfx->gfxdata + tx + ty * gfx->line_modulo;
                Drawgfx.common_drawgfx_na(sizex, sizey, tx, ty, sprite, color, flipx, flipy, sx & 0x1ff, ((sy + 16) & 0xff) - 16, cliprect);
            }
        }
Exemple #3
0
        public static void draw_sprites(RECT cliprect)
        {
            int offs, k;

            for (k = 0; k < 8; k++)
            {
                for (offs = 0; offs < m92_sprite_list;)
                {
                    int x, y, sprite, colour, fx, fy, x_multi, y_multi, i, j, s_ptr, pri_back, pri_sprite;
                    y = Generic.buffered_spriteram16[offs + 0] & 0x1ff;
                    x = Generic.buffered_spriteram16[offs + 3] & 0x1ff;
                    if ((Generic.buffered_spriteram16[offs + 2] & 0x0080) != 0)
                    {
                        pri_back = 0;
                    }
                    else
                    {
                        pri_back = 2;
                    }
                    sprite     = Generic.buffered_spriteram16[offs + 1];
                    colour     = Generic.buffered_spriteram16[offs + 2] & 0x007f;
                    pri_sprite = (Generic.buffered_spriteram16[offs + 0] & 0xe000) >> 13;
                    fx         = (Generic.buffered_spriteram16[offs + 2] >> 8) & 1;
                    fy         = (Generic.buffered_spriteram16[offs + 2] >> 9) & 1;
                    y_multi    = (Generic.buffered_spriteram16[offs + 0] >> 9) & 3;
                    x_multi    = (Generic.buffered_spriteram16[offs + 0] >> 11) & 3;
                    y_multi    = 1 << y_multi;
                    x_multi    = 1 << x_multi;
                    offs      += 4 * x_multi;
                    if (pri_sprite != k)
                    {
                        continue;
                    }
                    x = x - 16;
                    y = 384 - 16 - y;
                    if (fx != 0)
                    {
                        x += 16 * (x_multi - 1);
                    }
                    for (j = 0; j < x_multi; j++)
                    {
                        s_ptr = 8 * j;
                        if (fy == 0)
                        {
                            s_ptr += y_multi - 1;
                        }
                        x &= 0x1ff;
                        for (i = 0; i < y_multi; i++)
                        {
                            /*if (flip_screen_get()) {
                             *  pdrawgfx(bitmap,machine->gfx[1],
                             *          sprite + s_ptr,
                             *          colour,
                             *          !fx,!fy,
                             *          464-x,240-(y-i*16),
                             *          cliprect,TRANSPARENCY_PEN,0,pri_back);
                             *
                             *  pdrawgfx(bitmap,machine->gfx[1],
                             *          sprite + s_ptr,
                             *          colour,
                             *          !fx,!fy,
                             *          464-x+512,240-(y-i*16),
                             *          cliprect,TRANSPARENCY_PEN,0,pri_back);
                             * }
                             * else
                             * {
                             *  pdrawgfx(bitmap,machine->gfx[1],
                             *          sprite + s_ptr,
                             *          colour,
                             *          fx,fy,
                             *          x,y-i*16,
                             *          cliprect,TRANSPARENCY_PEN,0,pri_back);
                             *
                             *  pdrawgfx(bitmap,machine->gfx[1],
                             *          sprite + s_ptr,
                             *          colour,
                             *          fx,fy,
                             *          x-512,y-i*16,
                             *          cliprect,TRANSPARENCY_PEN,0,pri_back);
                             * }*/
                            Drawgfx.common_drawgfx_m92(gfx21rom, sprite + s_ptr, colour, fx, fy, x, y - i * 16, cliprect, (uint)(pri_back | (1 << 31)));
                            Drawgfx.common_drawgfx_m92(gfx21rom, sprite + s_ptr, colour, fx, fy, x - 512, y - i * 16, cliprect, (uint)(pri_back | (1 << 31)));
                            if (fy != 0)
                            {
                                s_ptr++;
                            }
                            else
                            {
                                s_ptr--;
                            }
                        }
                        if (fx != 0)
                        {
                            x -= 16;
                        }
                        else
                        {
                            x += 16;
                        }
                    }
                }
            }
        }
Exemple #4
0
        private static void cps2_render_sprites()
        {
            int i, x, y, priority, code, colour, col, cps2_last_sprite_offset;
            int xoffs = 64 - cps2_port(0x08);
            int yoffs = 16 - cps2_port(0x0a);

            cps2_last_sprite_offset = 0x3ff;
            for (i = 0; i < 0x400; i++)
            {
                y      = cps2_buffered_obj[i * 4 + 1];
                colour = cps2_buffered_obj[i * 4 + 3];
                if (y >= 0x8000 || colour >= 0xff00)
                {
                    cps2_last_sprite_offset = i - 1;
                    break;
                }
            }
            for (i = cps2_last_sprite_offset; i >= 0; i--)
            {
                x        = cps2_buffered_obj[i * 4];
                y        = cps2_buffered_obj[i * 4 + 1];
                priority = (x >> 13) & 0x07;
                code     = cps2_buffered_obj[i * 4 + 2] + ((y & 0x6000) << 3);
                colour   = cps2_buffered_obj[i * 4 + 3];
                col      = colour & 0x1f;
                if ((colour & 0x80) != 0)
                {
                    x += cps2_port(0x08);  /* fix the offset of some games */
                    y += cps2_port(0x0a);  /* like Marvel vs. Capcom ending credits */
                }
                y += 0x100;
                if ((colour & 0xff00) != 0)
                {
                    /* handle blocked sprites */
                    int nx = (colour & 0x0f00) >> 8;
                    int ny = (colour & 0xf000) >> 12;
                    int nxs, nys, sx, sy;
                    nx++;
                    ny++;
                    if ((colour & 0x40) != 0)
                    {
                        /* Y flip */
                        if ((colour & 0x20) != 0)
                        {
                            for (nys = 0; nys < ny; nys++)
                            {
                                for (nxs = 0; nxs < nx; nxs++)
                                {
                                    sx = (x + nxs * 16 + xoffs) & 0x3ff;
                                    sy = (y + nys * 16 + yoffs) & 0x3ff;
                                    Drawgfx.common_drawgfx_c(code + (nx - 1) - nxs + 0x10 * (ny - 1 - nys), (col & 0x1f), 1, 1, sx, sy, (uint)(primasks[priority] | 0x80000000));
                                }
                            }
                        }
                        else
                        {
                            for (nys = 0; nys < ny; nys++)
                            {
                                for (nxs = 0; nxs < nx; nxs++)
                                {
                                    sx = (x + nxs * 16 + xoffs) & 0x3ff;
                                    sy = (y + nys * 16 + yoffs) & 0x3ff;
                                    Drawgfx.common_drawgfx_c(code + nxs + 0x10 * (ny - 1 - nys), (col & 0x1f), 0, 1, sx, sy, (uint)(primasks[priority] | 0x80000000));
                                }
                            }
                        }
                    }
                    else
                    {
                        if ((colour & 0x20) != 0)
                        {
                            for (nys = 0; nys < ny; nys++)
                            {
                                for (nxs = 0; nxs < nx; nxs++)
                                {
                                    sx = (x + nxs * 16 + xoffs) & 0x3ff;
                                    sy = (y + nys * 16 + yoffs) & 0x3ff;
                                    Drawgfx.common_drawgfx_c(code + (nx - 1) - nxs + 0x10 * nys, (col & 0x1f), 1, 0, sx, sy, (uint)(primasks[priority] | 0x80000000));
                                }
                            }
                        }
                        else
                        {
                            for (nys = 0; nys < ny; nys++)
                            {
                                for (nxs = 0; nxs < nx; nxs++)
                                {
                                    sx = (x + nxs * 16 + xoffs) & 0x3ff;
                                    sy = (y + nys * 16 + yoffs) & 0x3ff;
                                    Drawgfx.common_drawgfx_c((code & ~0xf) + ((code + nxs) & 0xf) + 0x10 * nys, (col & 0x1f), 0, 0, sx, sy, (uint)(primasks[priority] | 0x80000000));
                                }
                            }
                        }
                    }
                }
                else
                {
                    /* Simple case... 1 sprite */
                    Drawgfx.common_drawgfx_c(code, (col & 0x1f), colour & 0x20, colour & 0x40, (x + xoffs) & 0x3ff, (y + yoffs) & 0x3ff, (uint)(primasks[priority] | 0x80000000));
                }
            }
        }
Exemple #5
0
        private static void cps1_render_sprites()
        {
            int i, match;
            int baseoffset, baseadd;

            /* some sf2 hacks draw the sprites in reverse order */
            if ((bootleg_kludge == 1) || (bootleg_kludge == 2) || (bootleg_kludge == 3))
            {
                baseoffset = cps1_last_sprite_offset;
                baseadd    = -4;
            }
            else
            {
                baseoffset = 0;
                baseadd    = 4;
            }
            for (i = 0; i <= cps1_last_sprite_offset; i += 4)
            {
                int x, y, code, colour, col;
                x      = cps1_buffered_obj[baseoffset];
                y      = cps1_buffered_obj[baseoffset + 1];
                code   = cps1_buffered_obj[baseoffset + 2];
                colour = cps1_buffered_obj[baseoffset + 3];
                col    = colour & 0x1f;
                if (x == 0 && y == 0 && code == 0 && colour == 0)
                {
                    baseoffset += baseadd;
                    continue;
                }
                match = 0;
                foreach (gfx_range r in lsRangeS)
                {
                    if (code >= r.start && code <= r.end)
                    {
                        code += r.add;
                        match = 1;
                        break;
                    }
                }
                if (match == 0)
                {
                    baseoffset += baseadd;
                    continue;
                }
                y += 0x100;
                if ((colour & 0xff00) != 0)
                {
                    /* handle blocked sprites */
                    int nx = (colour & 0x0f00) >> 8;
                    int ny = (colour & 0xf000) >> 12;
                    int nxs, nys, sx, sy;
                    nx++;
                    ny++;
                    if ((colour & 0x40) != 0)
                    {
                        /* Y flip */
                        if ((colour & 0x20) != 0)
                        {
                            for (nys = 0; nys < ny; nys++)
                            {
                                for (nxs = 0; nxs < nx; nxs++)
                                {
                                    sx = (x + nxs * 16) & 0x1ff;
                                    sy = (y + nys * 16) & 0x1ff;
                                    Drawgfx.common_drawgfx_c((code & ~0xf) + ((code + (nx - 1) - nxs) & 0xf) + 0x10 * (ny - 1 - nys), col, 1, 1, sx, sy, 0x80000002);
                                }
                            }
                        }
                        else
                        {
                            for (nys = 0; nys < ny; nys++)
                            {
                                for (nxs = 0; nxs < nx; nxs++)
                                {
                                    sx = (x + nxs * 16) & 0x1ff;
                                    sy = (y + nys * 16) & 0x1ff;
                                    Drawgfx.common_drawgfx_c((code & ~0xf) + ((code + nxs) & 0xf) + 0x10 * (ny - 1 - nys), col, 0, 1, sx, sy, 0x80000002);
                                }
                            }
                        }
                    }
                    else
                    {
                        if ((colour & 0x20) != 0)
                        {
                            for (nys = 0; nys < ny; nys++)
                            {
                                for (nxs = 0; nxs < nx; nxs++)
                                {
                                    sx = (x + nxs * 16) & 0x1ff;
                                    sy = (y + nys * 16) & 0x1ff;
                                    Drawgfx.common_drawgfx_c((code & ~0xf) + ((code + (nx - 1) - nxs) & 0xf) + 0x10 * nys, col, 1, 0, sx, sy, 0x80000002);
                                }
                            }
                        }
                        else
                        {
                            for (nys = 0; nys < ny; nys++)
                            {
                                for (nxs = 0; nxs < nx; nxs++)
                                {
                                    sx = (x + nxs * 16) & 0x1ff;
                                    sy = (y + nys * 16) & 0x1ff;
                                    Drawgfx.common_drawgfx_c((code & ~0xf) + ((code + nxs) & 0xf) + 0x10 * nys, col, 0, 0, sx, sy, 0x80000002);
                                }
                            }
                        }
                    }
                }
                else
                {
                    Drawgfx.common_drawgfx_c(code, col, colour & 0x20, colour & 0x40, x & 0x1ff, y & 0x1ff, 0x80000002);
                }
                baseoffset += baseadd;
            }
        }
Exemple #6
0
        private static void cps1_render_sprites()
        {
            int i, match;

            string[] ss1;
            int[]    iiRender;
            int      i9, n1;
            int      baseoffset, baseadd;
            Color    c1 = new Color();
            int      iSprite = 0, nSprite, iOffset, iRatio = 1, iFlip, iXCount, iYCount;
            int      width1 = 512, height1 = 512;

            int[]      iiX = new int[256], iiY = new int[256], iiCode = new int[256], iiColor = new int[256], iiIndex = new int[256];
            List <int> lX = new List <int>(), lY = new List <int>(), lY2 = new List <int>(), lCode = new List <int>(), lColor = new List <int>();
            List <int> lFlip = new List <int>();
            List <int> lIndex = new List <int>(), lXCount = new List <int>(), lYCount = new List <int>();

            /*ss1 = CPS1.c1.FORM.tbInput.Text.Split(sde2, StringSplitOptions.RemoveEmptyEntries);
             * n1 = ss1.Length;
             * iiRender=new int[n1];
             * for (i9 = 0; i9 < n1; i9++)
             * {
             *  iiRender[i9] = int.Parse(ss1[i9]);
             * }*/
            /* some sf2 hacks draw the sprites in reverse order */
            if ((bootleg_kludge == 1) || (bootleg_kludge == 2) || (bootleg_kludge == 3))
            {
                baseoffset = cps1_last_sprite_offset;
                baseadd    = -4;
            }
            else
            {
                baseoffset = 0;
                baseadd    = 4;
            }
            for (i = 0; i <= cps1_last_sprite_offset; i += 4)
            {
                int x, y, code, colour, col;
                x      = cps1_buffered_obj[baseoffset];
                y      = cps1_buffered_obj[baseoffset + 1];
                code   = cps1_buffered_obj[baseoffset + 2];
                colour = cps1_buffered_obj[baseoffset + 3];
                col    = colour & 0x1f;

                /*if ((colour & 0xff00) == 0xff00)
                 * {
                 *  break;
                 * }*/
                iiX[iSprite]     = x;
                iiY[iSprite]     = y;
                iiCode[iSprite]  = code;
                iiColor[iSprite] = colour;

                /*iiIndex[iSprite] = Array.IndexOf(iiRender, iiColor[iSprite] % 32);
                 * if (iiIndex[iSprite] >= 0)
                 * {
                 *  lX.Add(iiX[iSprite]);
                 *  lY.Add(iiY[iSprite]);
                 *  lCode.Add(iiCode[iSprite]);
                 *  lColor.Add(iiColor[iSprite]);
                 *  lIndex.Add(iiIndex[iSprite]);
                 *  iFlip = ((iiColor[iSprite] & 0x60) >> 5) & 3;
                 *  iXCount = iiColor[iSprite] / 256 % 16 + 1;
                 *  iYCount = iiColor[iSprite] / 256 / 16 + 1;
                 *  lXCount.Add(iXCount);
                 *  lYCount.Add(iYCount);
                 *  lY2.Add(iiY[iSprite] + iYCount * 16);
                 *  lFlip.Add(iFlip);
                 *  iSprite++;
                 * }*/
                if (x == 0 && y == 0 && code == 0 && colour == 0)
                {
                    baseoffset += baseadd;
                    continue;
                }
                match = 0;
                foreach (gfx_range r in lsRangeS)
                {
                    if (code >= r.start && code <= r.end)
                    {
                        code += r.add;
                        match = 1;
                        break;
                    }
                }
                if (match == 0)
                {
                    baseoffset += baseadd;
                    continue;
                }
                y += 0x100;
                if ((colour & 0xff00) != 0)
                {
                    /* handle blocked sprites */
                    int nx = (colour & 0x0f00) >> 8;
                    int ny = (colour & 0xf000) >> 12;
                    int nxs, nys, sx, sy;
                    nx++;
                    ny++;
                    if ((colour & 0x40) != 0)
                    {
                        /* Y flip */
                        if ((colour & 0x20) != 0)
                        {
                            for (nys = 0; nys < ny; nys++)
                            {
                                for (nxs = 0; nxs < nx; nxs++)
                                {
                                    sx = (x + nxs * 16) & 0x1ff;
                                    sy = (y + nys * 16) & 0x1ff;
                                    Drawgfx.common_drawgfx_c((code & ~0xf) + ((code + (nx - 1) - nxs) & 0xf) + 0x10 * (ny - 1 - nys), col, 1, 1, sx, sy, 0x80000002);
                                }
                            }
                        }
                        else
                        {
                            for (nys = 0; nys < ny; nys++)
                            {
                                for (nxs = 0; nxs < nx; nxs++)
                                {
                                    sx = (x + nxs * 16) & 0x1ff;
                                    sy = (y + nys * 16) & 0x1ff;
                                    Drawgfx.common_drawgfx_c((code & ~0xf) + ((code + nxs) & 0xf) + 0x10 * (ny - 1 - nys), col, 0, 1, sx, sy, 0x80000002);
                                }
                            }
                        }
                    }
                    else
                    {
                        if ((colour & 0x20) != 0)
                        {
                            for (nys = 0; nys < ny; nys++)
                            {
                                for (nxs = 0; nxs < nx; nxs++)
                                {
                                    sx = (x + nxs * 16) & 0x1ff;
                                    sy = (y + nys * 16) & 0x1ff;
                                    Drawgfx.common_drawgfx_c((code & ~0xf) + ((code + (nx - 1) - nxs) & 0xf) + 0x10 * nys, col, 1, 0, sx, sy, 0x80000002);
                                }
                            }
                        }
                        else
                        {
                            for (nys = 0; nys < ny; nys++)
                            {
                                for (nxs = 0; nxs < nx; nxs++)
                                {
                                    sx = (x + nxs * 16) & 0x1ff;
                                    sy = (y + nys * 16) & 0x1ff;
                                    Drawgfx.common_drawgfx_c((code & ~0xf) + ((code + nxs) & 0xf) + 0x10 * nys, col, 0, 0, sx, sy, 0x80000002);
                                }
                            }
                        }
                    }
                }
                else
                {
                    Drawgfx.common_drawgfx_c(code, col, colour & 0x20, colour & 0x40, x & 0x1ff, y & 0x1ff, 0x80000002);
                }
                baseoffset += baseadd;
            }
            return;

            nSprite = lX.Count;
            if (nSprite == 0)
            {
                return;
            }
            int i1, i2, i3, i4, i5, i6, i7, i8, rows, cols, minX, minY, maxX, maxY, maxY2, nX, nY, maxXCount, maxYCount;

            minX      = lX.Min();
            minY      = lY.Min();
            maxX      = lX.Max();
            maxY      = lY.Max();
            maxY2     = lY2.Max();
            maxXCount = lXCount.Max();
            maxYCount = lYCount.Max();
            string sHash = "";
            Bitmap bm1, bm2;

            nX = (maxX - minX) / 16 + 1;
            nY = (maxY - minY) / 16 + 1;
            if (maxXCount == 1 && maxYCount == 1)
            {
                if (nX % 2 == 1)
                {
                    nX += 1;
                }
                if (nY <= 8)
                {
                    nY = 8;
                }
                else if (nY > 8 && nY % 2 == 1)
                {
                    nY += 1;
                }
            }
            else
            {
                if ((nX + maxXCount - 1) % 2 == 0)
                {
                    nX = nX + maxXCount - 1;
                }
                else if ((nX + maxXCount - 1) % 2 == 1)
                {
                    nX = nX + maxXCount;
                }
                if (nY + maxYCount - 1 <= 8)
                {
                    nY = 8;
                }
                else if (nY + maxYCount - 1 > 8 && (nY + maxYCount - 1) % 2 == 1)
                {
                    nY = nY + maxYCount;
                }
            }
            bm1 = new Bitmap(16 * nX, 16 * nY);
            Graphics g = Graphics.FromImage(bm1);

            g.Clear(Color.Magenta);
            for (iSprite = nSprite - 1; iSprite >= 0; iSprite--)
            {
                bm2  = new Bitmap(16 * lXCount[iSprite], 16 * lYCount[iSprite]);
                cols = lColor[iSprite] / 256 % 16 + 1;
                rows = lColor[iSprite] / 256 / 16 + 1;

                /*for (i5 = 0; i5 < lYCount[iSprite]; i5++)
                 * {
                 *  for (i6 = 0; i6 < lXCount[iSprite]; i6++)
                 *  {
                 *      iOffset = (lCode[iSprite] + i5 * 16 + i6) * 16 * 16 / 2;
                 *      sHash += lCode[iSprite].ToString("X4");// +lbXFlip[iSprite] + lbYFlip[iSprite];
                 *      for (i1 = 0; i1 < 16; i1++)
                 *      {
                 *          for (i2 = 0; i2 < 16; i2++)
                 *          {
                 *              int iByte;
                 *              iByte = CPS1.gfxrom[iOffset + (i1 * 16 + i2) / 2];
                 *              if (i2 % 2 == 0)
                 *              {
                 *                  if (iByte % 16 == 0x0f)
                 *                  {
                 *                      c1 = Color.Magenta;
                 *                  }
                 *                  else
                 *                  {
                 *                      c1 = Color.FromArgb((int)Palette.entry_color[iiRender[lIndex[iSprite]] * 16 + iByte % 16]);
                 *                  }
                 *              }
                 *              else if (i2 % 2 == 1)
                 *              {
                 *                  if (iByte / 16 == 0x0f)
                 *                  {
                 *                      c1 = Color.Magenta;
                 *                  }
                 *                  else
                 *                  {
                 *                      c1 = Color.FromArgb((int)Palette.entry_color[iiRender[lIndex[iSprite]] * 16 + iByte / 16]);
                 *                  }
                 *              }
                 *              for (i7 = 0; i7 < iRatio; i7++)
                 *              {
                 *                  for (i8 = 0; i8 < iRatio; i8++)
                 *                  {
                 *                      bm2.SetPixel((i6 * 16 + i2) * iRatio + i8, (i5 * 16 + i1) * iRatio + i7, c1);
                 *                  }
                 *              }
                 *          }
                 *      }
                 *  }
                 * }*/
                if (lFlip[iSprite] == 0)
                {
                    g.DrawImage(bm2, new Rectangle(lX[iSprite] - minX, 16 * nY - maxY2 + lY[iSprite], 16 * lXCount[iSprite], 16 * lYCount[iSprite]), new Rectangle(0, 0, 16 * lXCount[iSprite], 16 * lYCount[iSprite]), GraphicsUnit.Pixel);
                }
                else if (lFlip[iSprite] == 1)
                {
                    //bm2.RotateFlip(RotateFlipType.RotateNoneFlipX);
                    g.DrawImage(bm2, new Rectangle(maxX - lX[iSprite], 16 * nY - maxY2 - (lYCount[iSprite] - 1) * 16 + lY[iSprite], 16 * lXCount[iSprite], 16 * lYCount[iSprite]), new Rectangle(0, 0, 16 * lXCount[iSprite], 16 * lYCount[iSprite]), GraphicsUnit.Pixel);
                }
                else if (lFlip[iSprite] == 2)
                {
                    bm2.RotateFlip(RotateFlipType.RotateNoneFlipY);
                    g.DrawImage(bm2, new Rectangle(lX[iSprite] - minX, 16 * (nY - 1) - maxY - (lYCount[iSprite] - 1) * 16 + lY[iSprite], 16 * lXCount[iSprite], 16 * lYCount[iSprite]), new Rectangle(0, 0, 16 * lXCount[iSprite], 16 * lYCount[iSprite]), GraphicsUnit.Pixel);
                }
                else if (lFlip[iSprite] == 3)
                {
                    //bm2.RotateFlip(RotateFlipType.RotateNoneFlipXY);
                    g.DrawImage(bm2, new Rectangle(lX[iSprite] - minX, 16 * (nY - 1) - maxY - (lYCount[iSprite] - 1) * 16 + lY[iSprite], 16 * lXCount[iSprite], 16 * lYCount[iSprite]), new Rectangle(0, 0, 16 * lXCount[iSprite], 16 * lYCount[iSprite]), GraphicsUnit.Pixel);
                }
            }
            g.Dispose();
            if (bRecord && lBitmapHash.IndexOf(sHash) < 0)
            {
                lBitmapHash.Add(sHash);
                Machine.FORM.cpsform.tbResult.AppendText(sHash + "\r\n");
                int iYRow = 128;
                if (iXAll + bm1.Width <= width1 && iYAll + bm1.Height <= height1)
                {
                }
                else if (iXAll + bm1.Width > width1 && iYAll + iYRow + bm1.Height <= height1)
                {
                    iXAll = 0;
                    iYAll = iYAll + iYRow;
                }
                else if (iXAll + bm1.Width > width1 && iYAll + iYRow + bm1.Height > height1)
                {
                    bmAll.Save(nBitmap.ToString("00") + ".png", ImageFormat.Png);
                    nBitmap++;
                    bmAll = new Bitmap(512, 512);
                    Graphics g2 = Graphics.FromImage(bmAll);
                    g2.Clear(Color.Magenta);
                    g2.Dispose();
                    iXAll = 0;
                    iYAll = 0;
                }
                Graphics gAll = Graphics.FromImage(bmAll);
                gAll.DrawImage(bm1, new Rectangle(iXAll, iYAll, bm1.Width, bm1.Height), new Rectangle(0, 0, bm1.Width, bm1.Height), GraphicsUnit.Pixel);
                gAll.Dispose();
                iXAll += bm1.Width;
                Machine.FORM.cpsform.pictureBox1.Image = bmAll;
            }
            //CPS1.c1.FORM.cps1form.pictureBox1.Image = bm1;
        }