From 213ea7c969e2eff74263cd66d64b5642d8c3fe9d Mon Sep 17 00:00:00 2001 From: kunikuni <42865216+kunikunijp@users.noreply.github.com> Date: Fri, 14 Sep 2018 20:57:35 +0900 Subject: pacland.cpp: Changed to approach real hardware behavior (#3998) * Update pacland.h * Update pacland.cpp --- src/mame/includes/pacland.h | 3 +-- src/mame/video/pacland.cpp | 41 +++++++++++++++++++---------------------- 2 files changed, 20 insertions(+), 24 deletions(-) diff --git a/src/mame/includes/pacland.h b/src/mame/includes/pacland.h index 7101f503801..c2ab5c5a49b 100644 --- a/src/mame/includes/pacland.h +++ b/src/mame/includes/pacland.h @@ -40,8 +40,7 @@ public: tilemap_t *m_bg_tilemap; tilemap_t *m_fg_tilemap; bitmap_ind16 m_fg_bitmap; - bitmap_ind16 m_sprite1_bitmap; - bitmap_ind16 m_sprite2_bitmap; + bitmap_ind16 m_sprite_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 fd15ffb737a..47100e83e06 100644 --- a/src/mame/video/pacland.cpp +++ b/src/mame/video/pacland.cpp @@ -122,7 +122,7 @@ PALETTE_INIT_MEMBER(pacland_state, pacland) int palentry; /* start with no transparency */ - m_transmask[0][i] = m_transmask[1][i] = m_transmask[2][i] = 0; + m_transmask[0][i] = m_transmask[1][i] = m_transmask[2][i] = 0; /* iterate over all palette entries except the last one */ for (palentry = 0; palentry < 0x100; palentry++) @@ -189,8 +189,7 @@ TILE_GET_INFO_MEMBER(pacland_state::get_fg_tile_info) void pacland_state::video_start() { - m_screen->register_screen_bitmap(m_sprite1_bitmap); - m_screen->register_screen_bitmap(m_sprite2_bitmap); + m_screen->register_screen_bitmap(m_sprite_bitmap); m_screen->register_screen_bitmap(m_fg_bitmap); m_fg_bitmap.fill(0xffff); @@ -380,32 +379,30 @@ uint32_t pacland_state::screen_update(screen_device &screen, bitmap_ind16 &bitma draw_fg(screen, bitmap, cliprect, 0); /* draw sprites with regular transparency */ - 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_sprites(screen, bitmap, cliprect, flip, 1); - /* 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_sprite2_bitmap.fill(0, cliprect); - draw_sprites(screen, m_sprite2_bitmap, cliprect, flip, 2); + /* draw sprite pixels in a temporary bitmap with colortable values >= 0xf0 */ + m_sprite_bitmap.fill(0, cliprect); + draw_sprites(screen, m_sprite_bitmap, cliprect, flip, 2); for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t *src1 = &m_sprite1_bitmap.pix16(y); - uint16_t *src2 = &m_sprite2_bitmap.pix16(y); - uint16_t *dst = &bitmap.pix16(y); - + uint16_t *spr = &m_sprite_bitmap.pix16(y); + uint16_t *bmp = &bitmap.pix16(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { - /* 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; + /* clear to 0 if "m_sprite_bitmap" and "bitmap" are different, + because not redraw pixels that are not visible in "bitmap" + in this way, keep sprite-sprite priorities intact */ + if (spr[x] != 0 && spr[x] != bmp[x]) + spr[x] = 0; } } + /* draw high priority fg tiles */ + draw_fg(screen, bitmap, cliprect, 1); + + /* draw sprite pixels with colortable values >= 0xf0, which have priority over everything */ + copybitmap_trans(bitmap, m_sprite_bitmap, 0, 0, 0, 0, cliprect, 0); + return 0; } -- cgit v1.2.3