diff --git a/src/mame/drivers/mermaid.cpp b/src/mame/drivers/mermaid.cpp index 1dbd771fe4c..c792a4fea14 100644 --- a/src/mame/drivers/mermaid.cpp +++ b/src/mame/drivers/mermaid.cpp @@ -471,6 +471,7 @@ void mermaid_state::mermaid(machine_config &config) void mermaid_state::rougien(machine_config &config) { mermaid(config); + m_bg_split = 1; m_latch[0]->q_out_cb<2>().set(FUNC(mermaid_state::rougien_sample_playback_w)); diff --git a/src/mame/includes/mermaid.h b/src/mame/includes/mermaid.h index 02bf1bdc055..228f34f52fb 100644 --- a/src/mame/includes/mermaid.h +++ b/src/mame/includes/mermaid.h @@ -38,6 +38,7 @@ public: m_palette(*this, "palette"), m_latch(*this, "latch%u", 1U) { + m_bg_split = 0; } void rougien(machine_config &config); @@ -63,6 +64,7 @@ private: int m_coll_bit2; int m_coll_bit3; int m_coll_bit6; + int m_bg_split; int m_bg_mask; int m_bg_bank; int m_rougien_gfxbank1; diff --git a/src/mame/video/mermaid.cpp b/src/mame/video/mermaid.cpp index 0e54bda0c89..18522971479 100644 --- a/src/mame/video/mermaid.cpp +++ b/src/mame/video/mermaid.cpp @@ -97,11 +97,14 @@ void mermaid_state::mermaid_fg_scroll_w(offs_t offset, uint8_t data) WRITE_LINE_MEMBER(mermaid_state::bg_mask_w) { m_bg_mask = state; + logerror("mask %d\n", state); } WRITE_LINE_MEMBER(mermaid_state::bg_bank_w) { m_bg_bank = state ? 0x100 : 0; + m_bg_tilemap->mark_all_dirty(); + logerror("bank %d\n", state); } WRITE_LINE_MEMBER(mermaid_state::rougien_gfxbankswitch1_w) @@ -224,11 +227,28 @@ void mermaid_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprec uint32_t mermaid_state::screen_update_mermaid(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - if (m_bg_mask) + if (m_bg_split) + { + constexpr int split_y = 64; + constexpr rectangle rr(0, 32*8-1, 0, 32*8-1); + m_bg_tilemap->draw(screen, m_helper_mask, rr, 0, 0); + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) + { + int sy = y >= split_y ? 32*8 - 2 - (y - split_y) : 32*8 - split_y + y; + const u16 *s = &m_helper_mask.pix(sy, cliprect.min_x); + u16 *p = &bitmap.pix(y, cliprect.min_x); + memcpy(p, s, 2*(cliprect.max_x - cliprect.min_x + 1)); + } + + + m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0); + draw_sprites(bitmap, cliprect); + } + else if (m_bg_mask) { for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - u16 *p = &bitmap.pix(y); + u16 *p = &bitmap.pix(y, cliprect.min_x); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) *p++ = x < 26*8 ? 0x42 : 0x40; } @@ -238,8 +258,8 @@ uint32_t mermaid_state::screen_update_mermaid(screen_device &screen, bitmap_ind1 m_bg_tilemap->draw(screen, m_helper_mask, cliprect, 0, 0); for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - const u16 *s = &m_helper_mask.pix(y); - u16 *p = &bitmap.pix(y); + const u16 *s = &m_helper_mask.pix(y, cliprect.min_x); + u16 *p = &bitmap.pix(y, cliprect.min_x); bool on = false; for (int x = cliprect.min_x; x <= cliprect.max_x; x++) {