diff options
Diffstat (limited to 'src/mame/video/k001604.cpp')
-rw-r--r-- | src/mame/video/k001604.cpp | 70 |
1 files changed, 64 insertions, 6 deletions
diff --git a/src/mame/video/k001604.cpp b/src/mame/video/k001604.cpp index ad3ef87af43..8338828ed67 100644 --- a/src/mame/video/k001604.cpp +++ b/src/mame/video/k001604.cpp @@ -274,14 +274,72 @@ void k001604_device::draw_back_layer( bitmap_rgb32 &bitmap, const rectangle &cli void k001604_device::draw_front_layer( screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect ) { - m_layer_8x8[0]->set_scrollx(-cliprect.min_x); - m_layer_8x8[0]->set_scrolly(-cliprect.min_y); + int32_t x = (int16_t)((m_reg[0x00] >> 16) & 0xffff); + int32_t y = (int16_t)((m_reg[0x00] >> 0) & 0xffff); + int32_t yy = (int16_t)((m_reg[0x01] >> 0) & 0xffff); + int32_t xy = (int16_t)((m_reg[0x01] >> 16) & 0xffff); + int32_t yx = (int16_t)((m_reg[0x02] >> 0) & 0xffff); + int32_t xx = (int16_t)((m_reg[0x02] >> 16) & 0xffff); + + int pivotx = (int16_t)(0xfec0); + int pivoty = (int16_t)(0xff28); + + int startx = ((x - pivotx) * 256) * 32; + int starty = ((y - pivoty) * 256) * 32; + int incxx = (xx) * 32; + int incxy = (-xy) * 32; + int incyx = (-yx) * 32; + int incyy = (yy) * 32; + + bitmap_ind16& pixmap = m_layer_8x8[0]->pixmap(); + + // extract start/end points + int sx = cliprect.min_x; + int sy = cliprect.min_y; + int ex = cliprect.max_x; + int ey = cliprect.max_y; + + const rgb_t *clut = palette().palette()->entry_list_raw(); + + int window_x, window_y, window_xmask, window_ymask; + + window_x = 0; + window_y = 0; + window_xmask = pixmap.width() - 1; + window_ymask = pixmap.height() - 1; - m_layer_8x8[1]->set_scrollx(-cliprect.min_x); - m_layer_8x8[1]->set_scrolly(-cliprect.min_y); - //m_layer_8x8[1]->draw(bitmap, cliprect, 0,0); - m_layer_8x8[0]->draw(screen, bitmap, cliprect, 0,0); + // loop over rows + while (sy <= ey) + { + // initialize X counters + int x = sx; + uint32_t cx = startx; + uint32_t cy = starty; + + uint32_t *dest = &bitmap.pix(sy, sx); + + // loop over columns + while (x <= ex) + { + uint16_t pix = pixmap.pix16(((cy >> 16) & window_ymask) + window_y, ((cx >> 16) & window_xmask) + window_x); + if ((pix & 0xff) != 0) + { + *dest = clut[pix]; + } + + // advance in X + cx += incxx; + cy += incxy; + x++; + dest++; + } + + // advance in Y + startx += incyx; + starty += incyy; + sy++; + } } READ32_MEMBER( k001604_device::tile_r ) |