From 0d9298d77fd5fc58bb5d3c6b9b92bfd3a1e0e213 Mon Sep 17 00:00:00 2001 From: angelosa Date: Mon, 28 May 2018 18:07:25 +0200 Subject: tatsumi.cpp: improved road clipping for Round Up 5 [Angelo Salese] --- src/mame/drivers/tatsumi.cpp | 4 ++-- src/mame/video/tatsumi.cpp | 48 +++++++++++++++++++++++++++----------------- 2 files changed, 32 insertions(+), 20 deletions(-) diff --git a/src/mame/drivers/tatsumi.cpp b/src/mame/drivers/tatsumi.cpp index dcd6c3b4e63..5a3c866ae9b 100644 --- a/src/mame/drivers/tatsumi.cpp +++ b/src/mame/drivers/tatsumi.cpp @@ -302,8 +302,8 @@ void roundup5_state::roundup5_68000_map(address_map &map) map(0xa0000, 0xa0fff).ram().share("roundup_r_ram"); // Road control data map(0xb0000, 0xb0fff).ram().share("roundup_p_ram"); // Road pixel data map(0xc0000, 0xc0fff).ram().share("roundup_l_ram"); // Road colour data - map(0xd0000, 0xd0003).w(this, FUNC(roundup5_state::roundup5_d0000_w)).share("ru5_d0000_ram"); - map(0xe0000, 0xe0001).w(this, FUNC(roundup5_state::roundup5_e0000_w)).share("ru5_e0000_ram"); + map(0xd0000, 0xd0003).ram().w(this, FUNC(roundup5_state::roundup5_d0000_w)).share("ru5_d0000_ram"); + map(0xe0000, 0xe0001).ram().w(this, FUNC(roundup5_state::roundup5_e0000_w)).share("ru5_e0000_ram"); } void roundup5_state::roundup5_z80_map(address_map &map) diff --git a/src/mame/video/tatsumi.cpp b/src/mame/video/tatsumi.cpp index 2d481cc90c2..09d93d34e9c 100644 --- a/src/mame/video/tatsumi.cpp +++ b/src/mame/video/tatsumi.cpp @@ -761,7 +761,7 @@ pos is 11.5 fixed point int y,x; int visible_line=0; const uint16_t *data = m_roundup_r_ram; - + // Road layer enable (?) if ((m_roundup5_unknown0[0x1]&0x1)==0) return; @@ -769,17 +769,18 @@ pos is 11.5 fixed point // Road data bank select (double buffered) if (m_roundup5_e0000_ram[0]&0x10) data+=0x400; - - // ?? Todo: This is wrong - don't know how to clip the road properly - y=256 - (m_roundup5_unknown0[0xb/2] >> 8); + + // Apply clipping: global screen + local road y offsets + y = 256 - ((m_roundup5_unknown0[0xa/2] >> 8) + m_roundup5_d0000_ram[0]); data+=y*4; visible_line=0; - for (/*y=0*/; y<256; y++) { + for (/*y=0*/; y>8)&0xf; + int pal = 4; //(data[3]>>8)&0xf; int step=((data[1]&0xff)<<8)|((data[1]&0xff00)>>8); int samplePos=0; const uint16_t* linedata=m_roundup_p_ram;// + (0x100 * pal); @@ -811,7 +812,7 @@ offset is from last pixel of first road segment? */ palette_byte=m_roundup_l_ram[visible_line/8]; - pal=4 + ((palette_byte>>(visible_line%8))&1); + pal = 4 + ((palette_byte>>(visible_line%8))&1); visible_line++; @@ -823,7 +824,8 @@ offset is from last pixel of first road segment? startPos=((shift<<8) + 0x80 )/ step; /* Fill in left of road segment */ - for (x=0; x>11)<0x80; x++) { + for (x=startPos; x < (cliprect.max_x + 1) && ((samplePos>>11)<0x80); x++) + { // look up colour int col = linedata[(samplePos>>11)&0x7f]&0xf; uint8_t shadow=shadow_bitmap.pix8(y, x); @@ -873,7 +879,8 @@ offset is from last pixel of first road segment? endPos=startPos+endPos; /* Fill pixels */ - for (x=startPos; x<320 && xpen(256 + pal*16 + col + 32); } - if (endPos<0) { + if (endPos<0) + { samplePos=step*(0-startPos); } - else if (endPos>11)&0x7f) + 0x200]&0xf; uint8_t shadow=shadow_bitmap.pix8(y, x); @@ -1050,6 +1062,7 @@ void roundup5_state::draw_landscape(bitmap_rgb32 &bitmap, const rectangle &clipr // TODO: guess, assume back layer having less scroll increment than front for parallax scrolling. // also notice that unknown0[8/2] >> 8 is identical to [0x0c/2], always? uint16_t x_base = type ? m_bg_scrollx[0] : m_roundup5_unknown0[0xc/2]; + // TODO: maybe [0xa/2] applies here as well? uint16_t y_base = m_bg_scrolly[0] & 0x1ff; uint16_t y_scroll = 0x180 - y_base; uint32_t base_offset; @@ -1110,8 +1123,7 @@ uint32_t roundup5_state::screen_update_roundup5(screen_device &screen, bitmap_rg m_tx_layer->set_scrolly(0,(tx_start_addr >> 4) | m_hd6445_reg[0x1d]); bitmap.fill(m_palette->pen(384), cliprect); // todo - screen.priority().fill(0, cliprect); - + screen.priority().fill(0, cliprect); draw_sprites(screen.priority(),cliprect,1,(m_sprite_control_ram[0xe0]&0x1000) ? 0x1000 : 0); // Alpha pass only draw_landscape(bitmap,cliprect,0); draw_landscape(bitmap,cliprect,1); -- cgit v1.2.3