From 135d83ea3ecf95a3458ecf87b014073e8587e263 Mon Sep 17 00:00:00 2001 From: hap Date: Sun, 24 Nov 2024 05:05:43 +0100 Subject: k007420: apply same sprite code mask fix as with k007121 --- src/mame/konami/k007342.cpp | 9 +--- src/mame/konami/k007420.cpp | 100 +++++++++++++++++++++++++++----------------- 2 files changed, 63 insertions(+), 46 deletions(-) diff --git a/src/mame/konami/k007342.cpp b/src/mame/konami/k007342.cpp index 460e7e6bca9..d8206f16ed5 100644 --- a/src/mame/konami/k007342.cpp +++ b/src/mame/konami/k007342.cpp @@ -48,9 +48,6 @@ k007342_device::k007342_device(const machine_config &mconfig, const char *tag, d m_tilemap{ nullptr, nullptr }, m_flipscreen(false), m_int_enabled(false), - //m_regs[8], - //m_scrollx[2], - //m_scrolly[2], m_callback(*this) { } @@ -269,11 +266,7 @@ void k007342_device::get_tile_info( tile_data &tileinfo, int tile_index, uint8_t if (!m_callback.isnull()) m_callback(layer, m_regs[1], code, color, flags); - - tileinfo.set(0, - code, - color, - flags); + tileinfo.set(0, code, color, flags); } TILE_GET_INFO_MEMBER(k007342_device::get_tile_info0) diff --git a/src/mame/konami/k007420.cpp b/src/mame/konami/k007420.cpp index c9c65a55ee0..2a15420fecd 100644 --- a/src/mame/konami/k007420.cpp +++ b/src/mame/konami/k007420.cpp @@ -28,7 +28,6 @@ k007420_device::k007420_device(const machine_config &mconfig, const char *tag, d , m_flipscreen(false) , m_banklimit(0) , m_callback(*this) - //, m_regs[8] { } @@ -115,50 +114,71 @@ void k007420_device::sprites_draw(bitmap_ind16 &bitmap, const rectangle &cliprec const uint32_t bank = code & bankmask; code &= codemask; - /* 0x080 = normal scale, 0x040 = double size, 0x100 half size */ + // 0x080 = normal scale, 0x040 = double size, 0x100 half size uint32_t zoom = m_ram[offs + 5] | ((m_ram[offs + 4] & 0x03) << 8); if (!zoom) continue; zoom = 0x10000 * 128 / zoom; - uint8_t w, h; + uint8_t width, height; switch (m_ram[offs + 4] & 0x70) { - case 0x30: w = h = 1; break; - case 0x20: w = 2; h = 1; code &= (~1); break; - case 0x10: w = 1; h = 2; code &= (~2); break; - case 0x00: w = h = 2; code &= (~3); break; - case 0x40: w = h = 4; code &= (~3); break; - default: w = 1; h = 1; -//logerror("Unknown sprite size %02x\n",(m_ram[offs + 4] & 0x70) >> 4); + case 0x30: + width = height = 1; + break; + + case 0x20: + width = 2; height = 1; + code &= ~1; + break; + + case 0x10: + width = 1; height = 2; + code &= ~2; + break; + + case 0x00: + width = height = 2; + code &= ~3; + break; + + case 0x40: + width = height = 4; + code &= ~0xf; + break; + + default: + width = 1; height = 1; + //logerror("Unknown sprite size %02x\n",(m_ram[offs + 4] & 0x70) >> 4); + break; } if (m_flipscreen) { - ox = 256 - ox - ((zoom * w + (1 << 12)) >> 13); - oy = 256 - oy - ((zoom * h + (1 << 12)) >> 13); + ox = 256 - ox - ((zoom * width + (1 << 12)) >> 13); + oy = 256 - oy - ((zoom * height + (1 << 12)) >> 13); flipx = !flipx; flipy = !flipy; } if (zoom == 0x10000) { - for (int y = 0; y < h; y++) + for (int y = 0; y < height; y++) { const int sy = oy + 8 * y; - for (int x = 0; x < w; x++) + for (int x = 0; x < width; x++) { uint32_t c = code; const int sx = ox + 8 * x; if (flipx) - c += xoffset[(w - 1 - x)]; + c += xoffset[(width - 1 - x)]; else c += xoffset[x]; if (flipy) - c += yoffset[(h - 1 - y)]; + c += yoffset[(height - 1 - y)]; else c += yoffset[y]; @@ -168,40 +188,42 @@ void k007420_device::sprites_draw(bitmap_ind16 &bitmap, const rectangle &cliprec c += bank; gfx(0)->transpen(bitmap,cliprect, - c, - color, - flipx,flipy, - sx,sy,0); - - if (m_regs[2] & 0x80) - gfx(0)->transpen(bitmap,cliprect, c, color, flipx,flipy, - sx,sy-256,0); + sx,sy,0); + + if (m_regs[2] & 0x80) + { + gfx(0)->transpen(bitmap,cliprect, + c, + color, + flipx,flipy, + sx,sy-256,0); + } } } } else { - for (int y = 0; y < h; y++) + for (int y = 0; y < height; y++) { const int sy = oy + ((zoom * y + (1 << 12)) >> 13); const int zh = (oy + ((zoom * (y + 1) + (1 << 12)) >> 13)) - sy; - for (int x = 0; x < w; x++) + for (int x = 0; x < width; x++) { uint32_t c = code; - const int sx = ox + ((zoom * x + (1<<12)) >> 13); + const int sx = ox + ((zoom * x + (1 << 12)) >> 13); const int zw = (ox + ((zoom * (x + 1) + (1 << 12)) >> 13)) - sx; if (flipx) - c += xoffset[(w - 1 - x)]; + c += xoffset[(width - 1 - x)]; else c += xoffset[x]; if (flipy) - c += yoffset[(h - 1 - y)]; + c += yoffset[(height - 1 - y)]; else c += yoffset[y]; @@ -211,19 +233,21 @@ void k007420_device::sprites_draw(bitmap_ind16 &bitmap, const rectangle &cliprec c += bank; gfx(0)->zoom_transpen(bitmap,cliprect, - c, - color, - flipx,flipy, - sx,sy, - (zw << 16) / 8,(zh << 16) / 8,0); - - if (m_regs[2] & 0x80) - gfx(0)->zoom_transpen(bitmap,cliprect, c, color, flipx,flipy, - sx,sy-256, + sx,sy, (zw << 16) / 8,(zh << 16) / 8,0); + + if (m_regs[2] & 0x80) + { + gfx(0)->zoom_transpen(bitmap,cliprect, + c, + color, + flipx,flipy, + sx,sy-256, + (zw << 16) / 8,(zh << 16) / 8,0); + } } } } -- cgit v1.2.3