From 7d7863187370b02c24551ab2bf539328ecd5aca8 Mon Sep 17 00:00:00 2001 From: kunikuni <42865216+kunikunijp@users.noreply.github.com> Date: Sun, 2 Sep 2018 03:07:25 +0900 Subject: pacland: sprites bugfix (#3935) * pacland: sprites bugfix Fixed the difference with real hardware: - fixed: incomplete priority of sprites on fg - fixed: sprites could not be displayed at the bottom of the screen * Update pacland.cpp --- src/mame/includes/pacland.h | 3 ++- src/mame/video/pacland.cpp | 27 +++++++++++++++++---------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/src/mame/includes/pacland.h b/src/mame/includes/pacland.h index c2ab5c5a49b..7101f503801 100644 --- a/src/mame/includes/pacland.h +++ b/src/mame/includes/pacland.h @@ -40,7 +40,8 @@ public: tilemap_t *m_bg_tilemap; tilemap_t *m_fg_tilemap; bitmap_ind16 m_fg_bitmap; - bitmap_ind16 m_sprite_bitmap; + bitmap_ind16 m_sprite1_bitmap; + bitmap_ind16 m_sprite2_bitmap; std::unique_ptr m_transmask[3]; uint16_t m_scroll0; uint16_t m_scroll1; diff --git a/src/mame/video/pacland.cpp b/src/mame/video/pacland.cpp index 065bd733cd5..fd15ffb737a 100644 --- a/src/mame/video/pacland.cpp +++ b/src/mame/video/pacland.cpp @@ -189,7 +189,8 @@ TILE_GET_INFO_MEMBER(pacland_state::get_fg_tile_info) void pacland_state::video_start() { - m_screen->register_screen_bitmap(m_sprite_bitmap); + m_screen->register_screen_bitmap(m_sprite1_bitmap); + m_screen->register_screen_bitmap(m_sprite2_bitmap); m_screen->register_screen_bitmap(m_fg_bitmap); m_fg_bitmap.fill(0xffff); @@ -302,8 +303,8 @@ void pacland_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, co flipy ^= 1; } - sy -= 16 * sizey; - sy = (sy & 0xff) - 32; // fix wraparound + sy -= 16 * (sizey + 1); // sprites could not be displayed at the bottom of the screen + sy = (sy & 0xff) - 16; // fix wraparound for (y = 0;y <= sizey;y++) { @@ -379,24 +380,30 @@ uint32_t pacland_state::screen_update(screen_device &screen, bitmap_ind16 &bitma draw_fg(screen, bitmap, cliprect, 0); /* draw sprites with regular transparency */ - draw_sprites(screen, bitmap, cliprect, flip, 1); + m_sprite1_bitmap.fill(0, cliprect); + draw_sprites(screen, m_sprite1_bitmap, cliprect, flip, 1); + copybitmap_trans(bitmap, m_sprite1_bitmap, 0, 0, 0, 0, cliprect, 0); /* draw high priority fg tiles */ draw_fg(screen, bitmap, cliprect, 1); /* draw sprite pixels with colortable values >= 0xf0, which have priority over all fg tiles */ - m_sprite_bitmap.fill(0, cliprect); - draw_sprites(screen, m_sprite_bitmap, cliprect, flip, 2); + m_sprite2_bitmap.fill(0, cliprect); + draw_sprites(screen, m_sprite2_bitmap, cliprect, flip, 2); for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t *src = &m_sprite_bitmap.pix16(y); + uint16_t *src1 = &m_sprite1_bitmap.pix16(y); + uint16_t *src2 = &m_sprite2_bitmap.pix16(y); uint16_t *dst = &bitmap.pix16(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { - uint16_t pix = src[x]; - if (pix != 0 && dst[x] < 0x800) - dst[x] = pix; + /* only copy if "m_sprite1_bitmap" and "m_sprite2_bitmap" are same value, + because not redraw pixels that are not visible in "m_sprite1_bitmap" */ + uint16_t pix1 = src1[x]; + uint16_t pix2 = src2[x]; + if (pix2 != 0 && dst[x] < 0x800 && pix1 == pix2) + dst[x] = pix2; } } -- cgit v1.2.3