rougien: First implementation of the split-bg effect

This commit is contained in:
Olivier Galibert 2021-06-07 20:15:58 +02:00
parent 4de1318f1c
commit 6cfd257765
3 changed files with 27 additions and 4 deletions

View File

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

View File

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

View File

@ -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++)
{