tatsumi.cpp: added background bitmap layers to Round Up 5 [Angelo Salese]

This commit is contained in:
angelosa 2018-05-28 15:39:52 +02:00
parent 93a797cb34
commit 8f64107824
3 changed files with 51 additions and 30 deletions

View File

@ -282,9 +282,9 @@ void roundup5_state::roundup5_v30_map(address_map &map)
map(0x08000, 0x0bfff).ram().w(this, FUNC(roundup5_state::text_w)).share("videoram");
map(0x0c000, 0x0c003).w(this, FUNC(tatsumi_state::hd6445_crt_w)).umask16(0x00ff);
map(0x0d000, 0x0d001).portr("DSW");
map(0x0d400, 0x0d40f).writeonly().share("ru5_unknown0");
map(0x0d800, 0x0d801).writeonly().share("ru5_unknown1"); // VRAM2 X scroll (todo)
map(0x0dc00, 0x0dc01).writeonly().share("ru5_unknown2"); // VRAM2 Y scroll (todo)
map(0x0d400, 0x0d40f).ram().share("ru5_unknown0");
map(0x0d800, 0x0d801).writeonly().share("bg_scrollx"); // VRAM2 X scroll (todo)
map(0x0dc00, 0x0dc01).writeonly().share("bg_scrolly"); // VRAM2 Y scroll (todo)
map(0x0e000, 0x0e001).w(this, FUNC(roundup5_state::roundup5_control_w));
map(0x0f000, 0x0ffff).rw(m_palette, FUNC(palette_device::read8), FUNC(palette_device::write8)).umask16(0x00ff).share("palette");
map(0x10000, 0x1ffff).rw(this, FUNC(roundup5_state::roundup_v30_z80_r), FUNC(roundup5_state::roundup_v30_z80_w));
@ -850,19 +850,6 @@ static const gfx_layout roundup5_vramlayout =
8*8
};
// TODO: wrong, just for debugging
// color data is likely to be at 0x100 - 0x11f (same color as background during VRAM uploads)
static const gfx_layout roundup5_bglayout =
{
8,8,
4096*4,
1,
{ 0 },
{ STEP8(0,1) },
{ STEP8(0,8) },
8*8
};
static GFXDECODE_START( gfx_apache3 )
GFXDECODE_ENTRY( "sprites", 0, spritelayout, 1024, 256)
GFXDECODE_ENTRY( "text", 0, gfx_8x8x3_planar, 768, 16)
@ -871,7 +858,6 @@ GFXDECODE_END
static GFXDECODE_START( gfx_roundup5 )
GFXDECODE_ENTRY( "sprites", 0, spritelayout, 1024, 256)
GFXDECODE_ENTRY( nullptr, 0, roundup5_vramlayout, 0, 16)
GFXDECODE_ENTRY( nullptr, 0, roundup5_bglayout, 512, 1)
GFXDECODE_END
static GFXDECODE_START( gfx_cyclwarr )

View File

@ -135,8 +135,8 @@ public:
, m_roundup5_d0000_ram(*this, "ru5_d0000_ram")
, m_roundup5_e0000_ram(*this, "ru5_e0000_ram")
, m_roundup5_unknown0(*this, "ru5_unknown0")
, m_roundup5_unknown1(*this, "ru5_unknown1")
, m_roundup5_unknown2(*this, "ru5_unknown2")
, m_bg_scrollx(*this, "bg_scrollx")
, m_bg_scrolly(*this, "bg_scrolly")
, m_roundup_r_ram(*this, "roundup_r_ram")
, m_roundup_p_ram(*this, "roundup_p_ram")
, m_roundup_l_ram(*this, "roundup_l_ram")
@ -162,12 +162,13 @@ public:
private:
void draw_road(bitmap_rgb32 &bitmap, const rectangle &cliprect, bitmap_ind8 &shadow_bitmap);
void draw_landscape(bitmap_rgb32 &bitmap, const rectangle &cliprect, uint8_t type);
required_shared_ptr<uint16_t> m_roundup5_d0000_ram;
required_shared_ptr<uint16_t> m_roundup5_e0000_ram;
required_shared_ptr<uint16_t> m_roundup5_unknown0;
required_shared_ptr<uint16_t> m_roundup5_unknown1;
required_shared_ptr<uint16_t> m_roundup5_unknown2;
required_shared_ptr<uint16_t> m_bg_scrollx;
required_shared_ptr<uint16_t> m_bg_scrolly;
required_shared_ptr<uint16_t> m_roundup_r_ram;
required_shared_ptr<uint16_t> m_roundup_p_ram;
required_shared_ptr<uint16_t> m_roundup_l_ram;

View File

@ -51,11 +51,7 @@ WRITE8_MEMBER(roundup5_state::gfxdata_w)
{
if((m_control_word & 0x200) == 0x200)
{
offset += (m_control_word & 0x6000) << 2;
//m_gfxdecode->gfx(2)->mark_dirty(offset/8);
// TODO: temp, until we get the actual decoding
m_gfxdecode->gfx(2)->mark_all_dirty();
offset += (m_control_word & 0x6000) << 2;
m_bg_gfxram[offset] = data;
return;
}
@ -204,7 +200,6 @@ VIDEO_START_MEMBER(roundup5_state,roundup5)
m_tx_layer->set_transparent_pen(0);
m_gfxdecode->gfx(1)->set_source(m_tx_gfxram.get());
m_gfxdecode->gfx(2)->set_source(m_bg_gfxram.get());
save_pointer(NAME(m_tx_gfxram.get()),0x20000);
save_pointer(NAME(m_bg_gfxram.get()),0x20000);
@ -1047,6 +1042,45 @@ if (0) {
}
}
// background layer landscape for Round Up 5
// two bitmap layers, back layer is 512 x 128, the other one is 512 x 64
// it's safe to assume that three monitor version will have a different arrangement here ...
void roundup5_state::draw_landscape(bitmap_rgb32 &bitmap, const rectangle &cliprect, uint8_t type)
{
// 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];
uint16_t y_base = m_bg_scrolly[0] & 0x1ff;
uint16_t y_scroll = 0x180 - y_base;
uint32_t base_offset;
uint16_t color_base = type ? 0x100 : 0x110;
int ysize = type ? 64 : 128;
base_offset = 0x10000 + type * 0x8000;
if(type)
y_scroll += 64;
//popmessage("%04x %04x %04x",m_roundup5_unknown0[8/2],m_roundup5_unknown0[0xc/2],m_bg_scrollx[0]);
for(int y = 0; y < ysize; y++)
{
for(int x = 0; x < 512; x++)
{
int res_x = (x_base + x) & 0x1ff;
uint32_t color = m_bg_gfxram[(res_x >> 1)+y*256+base_offset];
if(res_x & 1)
color >>= 4;
color &= 0xf;
if(cliprect.contains(x, y+y_scroll) && color)
bitmap.pix32(y+y_scroll, x) = m_palette->pen(color+color_base);
}
}
}
/**********************************************************************/
uint32_t apache3_state::screen_update_apache3(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
@ -1065,8 +1099,6 @@ uint32_t apache3_state::screen_update_apache3(screen_device &screen, bitmap_rgb3
uint32_t roundup5_state::screen_update_roundup5(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
// uint16_t bg_x_scroll=m_roundup5_unknown1[0];
// uint16_t bg_y_scroll=m_roundup5_unknown2[0];
int tx_start_addr;
tx_start_addr = (m_hd6445_reg[0xc] << 8) | (m_hd6445_reg[0xd]);
@ -1081,6 +1113,8 @@ uint32_t roundup5_state::screen_update_roundup5(screen_device &screen, bitmap_rg
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);
draw_road(bitmap,cliprect,screen.priority());
if(m_control_word & 0x80) // enabled on map screen after a play
{