From 03f6344901ef38fffb0dc1fae7e896fcda84bb5b Mon Sep 17 00:00:00 2001 From: Angelo Salese Date: Thu, 16 Dec 2010 16:01:29 +0000 Subject: [PATCH] Ported row select to every other tilemap in Irem M107 and fixed a bug in it, gives correct stretching gfxs at the end of level 1 and at the start of level 8 in Fire Barrel [Angelo Salese] --- src/mame/video/m107.c | 69 +++++++++++++++++++------------------------ 1 file changed, 30 insertions(+), 39 deletions(-) diff --git a/src/mame/video/m107.c b/src/mame/video/m107.c index d1bdd67a193..d700cb51b22 100644 --- a/src/mame/video/m107.c +++ b/src/mame/video/m107.c @@ -295,7 +295,7 @@ static void m107_update_scroll_positions(void) /*****************************************************************************/ -static void m107_screenrefresh(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect) +static void m107_tilemap_draw(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int laynum, int category) { int line; rectangle clip; @@ -305,53 +305,44 @@ static void m107_screenrefresh(running_machine *machine, bitmap_t *bitmap, const clip.min_y = visarea.min_y; clip.max_y = visarea.max_y; + if (m107_control[0x08 + laynum] & 0x02) + { + for (line = cliprect->min_y; line < cliprect->max_y;line++) + { + const UINT16 *scrolldata = m107_vram_data + (0xe800 + 0x200 * laynum) / 2; + clip.min_y = clip.max_y = line; + + //FIXME: right side (bottom of the screen actually) gets corrupted lines? + tilemap_set_scrollx(pf_layer[laynum].tmap,0, m107_control[1 + 2 * laynum]); + tilemap_set_scrolly(pf_layer[laynum].tmap,0, (m107_control[0 + 2 * laynum] + scrolldata[line])); + + tilemap_draw(bitmap, &clip, pf_layer[laynum].tmap, category, 0); + } + } + else + tilemap_draw(bitmap, cliprect, pf_layer[laynum].tmap, category, 0); +} + + +static void m107_screenrefresh(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect) +{ if ((~m107_control[0x0b] >> 7) & 1) { - tilemap_draw(bitmap, cliprect, pf_layer[3].tmap, 0, 0); - tilemap_draw(bitmap, cliprect, pf_layer[3].tmap, 1, 0); + m107_tilemap_draw(machine, bitmap, cliprect, 3, 0); + m107_tilemap_draw(machine, bitmap, cliprect, 3, 1); } else bitmap_fill(bitmap, cliprect, 0); - tilemap_draw(bitmap, cliprect, pf_layer[2].tmap, 0, 0); - tilemap_draw(bitmap, cliprect, pf_layer[2].tmap, 1, 0); + m107_tilemap_draw(machine, bitmap, cliprect, 2, 0); + m107_tilemap_draw(machine, bitmap, cliprect, 2, 1); - tilemap_draw(bitmap, cliprect, pf_layer[1].tmap, 0, 0); - if (m107_control[0x08 + 0] & 0x02) - { - for (line = cliprect->min_y; line < cliprect->max_y;line++) - { - const UINT16 *scrolldata = m107_vram_data + (0xe800 + 0x400 * 0) / 2; - clip.min_y = clip.max_y = line; - - tilemap_set_scrollx(pf_layer[0].tmap,0, m107_control[1 + 2 * 0] + scrolldata[line]); - tilemap_set_scrolly(pf_layer[0].tmap,0, m107_control[0 + 2 * 0] + scrolldata[line]); - - tilemap_draw(bitmap, &clip, pf_layer[0].tmap, 0, 0); - - } - - } - else - tilemap_draw(bitmap, cliprect, pf_layer[0].tmap, 0, 0); + m107_tilemap_draw(machine, bitmap, cliprect, 1, 0); + m107_tilemap_draw(machine, bitmap, cliprect, 0, 0); draw_sprites(machine, bitmap, cliprect, 0); - tilemap_draw(bitmap, cliprect, pf_layer[1].tmap, 1, 0); - if (m107_control[0x08 + 0] & 0x02) - { - for (line = cliprect->min_y; line < cliprect->max_y;line++) - { - const UINT16 *scrolldata = m107_vram_data + (0xe800 + 0x400 * 0) / 2; - clip.min_y = clip.max_y = line; - - tilemap_set_scrollx(pf_layer[0].tmap,0, m107_control[1 + 2 * 0] + scrolldata[line]); - tilemap_set_scrolly(pf_layer[0].tmap,0, m107_control[0 + 2 * 0] + scrolldata[line]); - - tilemap_draw(bitmap, &clip, pf_layer[0].tmap, 1, 0); - } - } - else - tilemap_draw(bitmap, cliprect, pf_layer[0].tmap, 1, 0); + m107_tilemap_draw(machine, bitmap, cliprect, 1, 1); + m107_tilemap_draw(machine, bitmap, cliprect, 0, 1); draw_sprites(machine, bitmap, cliprect, 1);