From 5563422a6cf6ae1dfe383d0b40dd1a2aa1303e80 Mon Sep 17 00:00:00 2001 From: Agiri Date: Sat, 30 Dec 2017 22:31:54 +0900 Subject: [PATCH 1/2] ygv608.cpp: Add mosaic effect for Galaga Arrangement Ending/Staffroll --- src/mame/video/ygv608.cpp | 27 +++++++++++++++++++++++++-- src/mame/video/ygv608.h | 1 + 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/mame/video/ygv608.cpp b/src/mame/video/ygv608.cpp index 6a29eb1aea9..e00fe9b6ba5 100644 --- a/src/mame/video/ygv608.cpp +++ b/src/mame/video/ygv608.cpp @@ -1030,6 +1030,25 @@ inline void ygv608_device::draw_layer_roz(screen_device &screen, bitmap_ind16 &b source_tilemap->draw(screen, bitmap, cliprect, 0, 0 ); } +void ygv608_device::ygv608_draw_mosaic(bitmap_ind16 &bitmap, const rectangle &cliprect, int n) +{ + int x, y, x0, y0; + + if (n <= 0) + { + return; + } + + for (y = cliprect.min_y; y <= cliprect.max_y; y++) + { + for (x = cliprect.min_x; x <= cliprect.max_x; x++) + { + x0 = (x >> n) << n; + y0 = (y >> n) << n; + bitmap.pix16(y, x) = bitmap.pix16(y0, x0); + } + } +} uint32_t ygv608_device::update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { @@ -1175,6 +1194,8 @@ uint32_t ygv608_device::update_screen(screen_device &screen, bitmap_ind16 &bitma else { draw_layer_roz(screen, m_work_bitmap, finalclip, m_tilemap_B); + if(m_mosaic_bplane > 0) + ygv608_draw_mosaic(m_work_bitmap, finalclip, m_mosaic_bplane); if(m_planeB_trans_enable == true) copybitmap_trans( bitmap, m_work_bitmap, 0, 0, 0, 0, finalclip, 0); @@ -1192,6 +1213,8 @@ uint32_t ygv608_device::update_screen(screen_device &screen, bitmap_ind16 &bitma draw_sprites(bitmap, finalclip); draw_layer_roz(screen, m_work_bitmap, finalclip, m_tilemap_A); + if(m_mosaic_aplane > 0) + ygv608_draw_mosaic(m_work_bitmap, finalclip, m_mosaic_aplane); if(m_planeA_trans_enable == true) copybitmap_trans( bitmap, m_work_bitmap, 0, 0, 0, 0, finalclip, 0); @@ -1941,8 +1964,8 @@ WRITE8_MEMBER( ygv608_device::screen_ctrl_10_w ) // check mosaic m_mosaic_bplane = (data & 0xc) >> 2; m_mosaic_aplane = data & 3; - if(m_mosaic_aplane || m_mosaic_bplane) - popmessage("Mosaic effect %02x %02x",m_mosaic_aplane,m_mosaic_bplane); +// if(m_mosaic_aplane || m_mosaic_bplane) +// popmessage("Mosaic effect %02x %02x",m_mosaic_aplane,m_mosaic_bplane); } // R#11R - screen control 11 diff --git a/src/mame/video/ygv608.h b/src/mame/video/ygv608.h index 8a1fee7278c..95519c3a00d 100644 --- a/src/mame/video/ygv608.h +++ b/src/mame/video/ygv608.h @@ -127,6 +127,7 @@ private: void register_state_save(); void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); void draw_layer_roz(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, tilemap_t *source_tilemap); + void ygv608_draw_mosaic(bitmap_ind16 &bitmap, const rectangle &cliprect, int n); uint8_t m_namcond1_gfxbank; From d301a89fb292c3cc96e5bf4c55c723465bcd66fd Mon Sep 17 00:00:00 2001 From: Agiri Date: Sat, 30 Dec 2017 22:39:48 +0900 Subject: [PATCH 2/2] ygv608.cpp: small changes --- src/mame/video/ygv608.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/mame/video/ygv608.cpp b/src/mame/video/ygv608.cpp index e00fe9b6ba5..c6aa50353dc 100644 --- a/src/mame/video/ygv608.cpp +++ b/src/mame/video/ygv608.cpp @@ -1032,20 +1032,21 @@ inline void ygv608_device::draw_layer_roz(screen_device &screen, bitmap_ind16 &b void ygv608_device::ygv608_draw_mosaic(bitmap_ind16 &bitmap, const rectangle &cliprect, int n) { - int x, y, x0, y0; + int x, y, mask; if (n <= 0) { return; } + // mask to drop the lowest n-bits + mask = ~((1 << n) - 1); + for (y = cliprect.min_y; y <= cliprect.max_y; y++) { for (x = cliprect.min_x; x <= cliprect.max_x; x++) { - x0 = (x >> n) << n; - y0 = (y >> n) << n; - bitmap.pix16(y, x) = bitmap.pix16(y0, x0); + bitmap.pix16(y, x) = bitmap.pix16(y & mask, x & mask); } } }