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
This commit is contained in:
kunikuni 2018-09-02 03:07:25 +09:00 committed by hap
parent 1473e0d256
commit 7d78631873
2 changed files with 19 additions and 11 deletions

View File

@ -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<uint32_t[]> m_transmask[3];
uint16_t m_scroll0;
uint16_t m_scroll1;

View File

@ -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;
}
}