From a8f277856320ccdbbf318b90b965a2a4d0a24e04 Mon Sep 17 00:00:00 2001 From: angelosa Date: Mon, 7 May 2018 23:54:26 +0200 Subject: [PATCH] deadang.cpp: popnrun sketchy sprites (nw) --- src/mame/drivers/deadang.cpp | 27 +++++++++++++++--- src/mame/includes/deadang.h | 1 + src/mame/video/deadang.cpp | 53 +++++++++++++++++++++++++++++++++++- 3 files changed, 76 insertions(+), 5 deletions(-) diff --git a/src/mame/drivers/deadang.cpp b/src/mame/drivers/deadang.cpp index dc0b567d9a4..dd8162ac39d 100644 --- a/src/mame/drivers/deadang.cpp +++ b/src/mame/drivers/deadang.cpp @@ -89,6 +89,9 @@ void deadang_state::main_map(address_map &map) void popnrun_state::popnrun_main_map(address_map &map) { main_map(map); + map(0x00000, 0x03bff).ram(); + map(0x03c00, 0x03dff).ram().share("spriteram"); + map(0x03e00, 0x03fff).ram(); map(0x08000, 0x08fff).ram().w(this, FUNC(popnrun_state::popnrun_text_w)).share("videoram"); map(0x0e000, 0x0e0ff).ram().share("scroll_ram"); } @@ -281,6 +284,18 @@ static const gfx_layout popnrun_charlayout = 128 }; +// TODO: this is wrong +static const gfx_layout popnrun_spritelayout = +{ + 16,16, /* 16*16 tiles */ + RGN_FRAC(1,1), + 2, /* 4 bits per pixel */ + { 0,4 }, + { STEP4(0,1), STEP4(16,1), STEP4(512,1), STEP4(512+16,1) }, + { STEP16(0,32) }, + 1024 +}; + /* Graphics Decode Information */ static GFXDECODE_START( deadang ) @@ -294,7 +309,7 @@ GFXDECODE_END static GFXDECODE_START( popnrun ) GFXDECODE_ENTRY( "gfx1", 0x000000, popnrun_charlayout, 0x20, 4 ) // TODO: probably runs on ROM based palette or just uses the first three entries? - GFXDECODE_ENTRY( "gfx2", 0x000000, spritelayout, 768, 16 ) + GFXDECODE_ENTRY( "gfx2", 0x000000, spritelayout, 0, 8 ) GFXDECODE_ENTRY( "gfx3", 0x000000, spritelayout, 1024, 16 ) GFXDECODE_ENTRY( "gfx4", 0x000000, spritelayout, 256, 16 ) GFXDECODE_ENTRY( "gfx5", 0x000000, spritelayout, 0, 16 ) @@ -437,9 +452,11 @@ ROM_START( popnrun ) ROM_REGION( 0x2000, "gfx1", ROMREGION_ERASE00 ) ROM_LOAD( "popnrun-2764-7-1a.bin", 0x000000, 0x002000, CRC(5e508b8e) SHA1(3e49e8d25a3db83178965382295e7c437441b5fe) ) - ROM_REGION( 0x80000, "gfx2", ROMREGION_ERASE00 ) /* Sprites */ + ROM_REGION( 0x80000, "gfx2", ROMREGION_ERASEFF ) /* Sprites */ ROM_LOAD( "gfx2.bin", 0x0000, 0x80000, NO_DUMP ) - + // debugging fill, remove me + ROM_FILL( 0x0000, 0x80000, 0x33 ) + ROM_REGION( 0x100000, "gfx3", ROMREGION_ERASE00 ) /* pf1 layer */ ROM_LOAD( "gfx3.bin", 0x0000, 0x100000, NO_DUMP ) @@ -479,8 +496,10 @@ ROM_START( popnruna ) ROM_REGION( 0x2000, "gfx1", ROMREGION_ERASE00 ) ROM_LOAD( "popnrun-2764-7-1a.bin", 0x000000, 0x002000, CRC(5e508b8e) SHA1(3e49e8d25a3db83178965382295e7c437441b5fe) ) - ROM_REGION( 0x80000, "gfx2", ROMREGION_ERASE00 ) /* Sprites */ + ROM_REGION( 0x80000, "gfx2", ROMREGION_ERASEFF ) /* Sprites */ ROM_LOAD( "gfx2.bin", 0x0000, 0x80000, NO_DUMP ) + // debugging fill, remove me + ROM_FILL( 0x0000, 0x80000, 0x33 ) ROM_REGION( 0x100000, "gfx3", ROMREGION_ERASE00 ) /* pf1 layer */ ROM_LOAD( "gfx3.bin", 0x0000, 0x100000, NO_DUMP ) diff --git a/src/mame/includes/deadang.h b/src/mame/includes/deadang.h index 597cd24c538..2513b09b410 100644 --- a/src/mame/includes/deadang.h +++ b/src/mame/includes/deadang.h @@ -87,6 +87,7 @@ public: void popnrun(machine_config &config); uint32_t popnrun_screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void popnrun_draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); protected: virtual void video_start() override; diff --git a/src/mame/video/deadang.cpp b/src/mame/video/deadang.cpp index 9aece8e4424..49eeab6ef8d 100644 --- a/src/mame/video/deadang.cpp +++ b/src/mame/video/deadang.cpp @@ -198,9 +198,59 @@ uint32_t deadang_state::screen_update(screen_device &screen, bitmap_ind16 &bitma return 0; } +void popnrun_state::popnrun_draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int offs,fx,fy,x,y,color,sprite,pri; + + // TODO: might have more bits in either 0x3800-0x3bff or 0x3e00-0x3fff + for (offs = 0; offs<0x200/2; offs+=2) + { + /* Don't draw empty sprite table entries */ + //if ((m_spriteram[offs+3] & 0xff00)!=0xf00) continue; + + pri = 0; + #ifdef UNUSED_FUNCTION + switch (m_spriteram[offs+2]&0xc000) { + default: + case 0xc000: pri=0; break; /* Unknown */ + case 0x8000: pri=0; break; /* Over all playfields */ + case 0x4000: pri=0xf0; break; /* Under top playfield */ + case 0x0000: pri=0xf0|0xcc; break; /* Under middle playfield */ + } + #endif + + fx = m_spriteram[offs+0]&0x4000; + fy = m_spriteram[offs+0]&0x8000; + y = m_spriteram[offs+1] & 0xff; + x = (m_spriteram[offs+1] >> 8) & 0xff; + #ifdef UNUSED_FUNCTION + if (fy) fy=0; else fy=1; + if (m_spriteram[offs+2]&0x100) x=0-(0xff-x); + #endif + + color = (m_spriteram[offs+0]>>12)&0x7; + sprite = m_spriteram[offs+0]&0xfff; + + #ifdef UNUSED_FUNCTION + if (flip_screen()) { + x=240-x; + y=240-y; + if (fx) fx=0; else fx=1; + if (fy) fy=0; else fy=1; + } + #endif + + m_gfxdecode->gfx(1)->prio_transpen(bitmap,cliprect, + sprite, + color,fx,fy,x,y, + screen.priority(),pri,0); + } +} + uint32_t popnrun_state::popnrun_screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { // TODO: different scroll RAM hookup + // 0x18 seems to enable the various layers /* Setup the tilemaps */ m_pf3_layer->set_scrolly(0, ((m_scroll_ram[0x01]&0xf0)<<4)+((m_scroll_ram[0x02]&0x7f)<<1)+((m_scroll_ram[0x02]&0x80)>>7) ); m_pf3_layer->set_scrollx(0, ((m_scroll_ram[0x09]&0xf0)<<4)+((m_scroll_ram[0x0a]&0x7f)<<1)+((m_scroll_ram[0x0a]&0x80)>>7) ); @@ -219,7 +269,8 @@ uint32_t popnrun_state::popnrun_screen_update(screen_device &screen, bitmap_ind1 //m_pf3_layer->draw(screen, bitmap, cliprect, 0,1); //m_pf1_layer->draw(screen, bitmap, cliprect, 0,2); //m_pf2_layer->draw(screen, bitmap, cliprect, 0,4); - if (!(m_scroll_ram[0x34]&0x10)) draw_sprites(screen, bitmap,cliprect); + if (m_scroll_ram[0x18/2]&0x1) + popnrun_draw_sprites(screen, bitmap,cliprect); m_text_layer->draw(screen, bitmap, cliprect, 0,0); return 0; }