From 551a3a37e2575583a6c0884a2591580be96ed9c2 Mon Sep 17 00:00:00 2001 From: Angelo Salese Date: Wed, 1 Feb 2012 19:38:44 +0000 Subject: [PATCH] Converted Boogie Wings to generic sprite device plus added manual mixing. Converted various bootleg implementations of the chip to use the common code as well. (tumbleb.c, esd16.c, crospang.c, nmg5.c) [David Haywood] --- src/mame/drivers/crospang.c | 56 ++-- src/mame/drivers/esd16.c | 88 ++++--- src/mame/drivers/nmg5.c | 55 +--- src/mame/drivers/tumbleb.c | 50 +++- src/mame/includes/crospang.h | 2 - src/mame/includes/esd16.h | 2 - src/mame/includes/tumbleb.h | 2 - src/mame/video/boogwing.c | 309 ++++++++++++---------- src/mame/video/crospang.c | 90 +------ src/mame/video/decocomn.c | 95 ------- src/mame/video/decocomn.h | 8 - src/mame/video/decospr.c | 88 ++++--- src/mame/video/decospr.h | 39 ++- src/mame/video/esd16.c | 263 +------------------ src/mame/video/rohga.c | 1 - src/mame/video/tumbleb.c | 486 ++++++----------------------------- 16 files changed, 467 insertions(+), 1167 deletions(-) diff --git a/src/mame/drivers/crospang.c b/src/mame/drivers/crospang.c index 34a34793c21..c0c3917917f 100644 --- a/src/mame/drivers/crospang.c +++ b/src/mame/drivers/crospang.c @@ -22,6 +22,10 @@ Bestri: Bestri includes Heuk San Baek Sa as one of it's three sub games. + Note: + Bestri tile banking / enable wrong (corrupt gfx in some modes?) + - check and merge with other Tumble Pop based implementations? + 2008-08 Added Service dipswitch and dip locations based on Service Mode. */ @@ -32,7 +36,7 @@ #include "sound/okim6295.h" #include "sound/3812intf.h" #include "includes/crospang.h" - +#include "video/decospr.h" static WRITE16_HANDLER ( crospang_soundlatch_w ) { @@ -330,8 +334,7 @@ static MACHINE_START( crospang ) state->m_audiocpu = machine.device("audiocpu"); state->save_item(NAME(state->m_bestri_tilebank)); - state->save_item(NAME(state->m_xsproff)); - state->save_item(NAME(state->m_ysproff)); + } static MACHINE_RESET( crospang ) @@ -339,17 +342,14 @@ static MACHINE_RESET( crospang ) crospang_state *state = machine.driver_data(); state->m_bestri_tilebank = 0; -// state->m_xsproff = 4; -// state->m_ysproff = 7; - state->m_xsproff = 5; - state->m_ysproff = 7; + } static MACHINE_CONFIG_START( crospang, crospang_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M68000, 14318180/2) + MCFG_CPU_ADD("maincpu", M68000, 14318180) MCFG_CPU_PROGRAM_MAP(crospang_map) MCFG_CPU_VBLANK_INT("screen", irq6_line_hold) @@ -373,6 +373,12 @@ static MACHINE_CONFIG_START( crospang, crospang_state ) MCFG_VIDEO_START(crospang) + MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0) + decospr_device::set_gfx_region(*device, 0); + decospr_device::set_is_bootleg(*device, true); + decospr_device::set_offsets(*device, 5,7); + + /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") @@ -384,42 +390,12 @@ static MACHINE_CONFIG_START( crospang, crospang_state ) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) MACHINE_CONFIG_END -static MACHINE_CONFIG_START( bestri, crospang_state ) +static MACHINE_CONFIG_DERIVED( bestri, crospang ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M68000, 14318180/2) + MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(bestri_map) - MCFG_CPU_VBLANK_INT("screen", irq6_line_hold) - MCFG_CPU_ADD("audiocpu", Z80, 14318180/4) - MCFG_CPU_PROGRAM_MAP(crospang_sound_map) - MCFG_CPU_IO_MAP(crospang_sound_io_map) - - MCFG_MACHINE_START(crospang) - MCFG_MACHINE_RESET(crospang) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) - MCFG_SCREEN_SIZE(64*8, 64*8) - MCFG_SCREEN_VISIBLE_AREA(0, 40*8-1, 0, 30*8-1) - MCFG_SCREEN_UPDATE_STATIC(crospang) - - MCFG_PALETTE_LENGTH(0x300) - MCFG_GFXDECODE(crospang) - - MCFG_VIDEO_START(crospang) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - - MCFG_SOUND_ADD("ymsnd", YM3812, 14318180/4) - MCFG_SOUND_CONFIG(ym3812_config) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) - - MCFG_OKIM6295_ADD("oki", 1056000, OKIM6295_PIN7_HIGH) // clock frequency & pin 7 not verified - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) MACHINE_CONFIG_END diff --git a/src/mame/drivers/esd16.c b/src/mame/drivers/esd16.c index 6a07bae5d43..c1da3b07790 100644 --- a/src/mame/drivers/esd16.c +++ b/src/mame/drivers/esd16.c @@ -48,7 +48,7 @@ Head Panic #include "sound/okim6295.h" #include "sound/3812intf.h" #include "includes/esd16.h" - +#include "video/decospr.h" /*************************************************************************** @@ -91,9 +91,10 @@ static ADDRESS_MAP_START( multchmp_map, AS_PROGRAM, 16 ) /**/AM_RANGE(0x420000, 0x423fff) AM_RAM_WRITE(esd16_vram_1_w) AM_BASE_MEMBER(esd16_state, m_vram_1) // /**/AM_RANGE(0x500000, 0x500003) AM_RAM AM_BASE_MEMBER(esd16_state, m_scroll_0) // Scroll /**/AM_RANGE(0x500004, 0x500007) AM_RAM AM_BASE_MEMBER(esd16_state, m_scroll_1) // -/**/AM_RANGE(0x500008, 0x50000b) AM_RAM // -/**/AM_RANGE(0x50000c, 0x50000f) AM_RAM // - AM_RANGE(0x600000, 0x600001) AM_WRITENOP // IRQ Ack + AM_RANGE(0x500008, 0x500009) AM_WRITEONLY AM_BASE_MEMBER(esd16_state, m_headpanic_platform_x) + AM_RANGE(0x50000a, 0x50000b) AM_WRITEONLY AM_BASE_MEMBER(esd16_state, m_headpanic_platform_y) + AM_RANGE(0x50000c, 0x50000d) AM_WRITENOP // ?? + AM_RANGE(0x50000e, 0x50000f) AM_WRITEONLY AM_BASE_MEMBER(esd16_state, m_head_layersize) // ?? AM_RANGE(0x600002, 0x600003) AM_READ_PORT("P1_P2") AM_RANGE(0x600004, 0x600005) AM_READ_PORT("SYSTEM") AM_RANGE(0x600006, 0x600007) AM_READ_PORT("DSW") @@ -434,11 +435,24 @@ static const gfx_layout layout_16x16x5 = RGN_FRAC(1,5), 5, { RGN_FRAC(4,5),RGN_FRAC(3,5),RGN_FRAC(2,5),RGN_FRAC(1,5), RGN_FRAC(0,5) }, - { STEP8(0+7,-1), STEP8(8*16+7,-1) }, + { STEP8(8*16,1), STEP8(0,1) }, { STEP16(0,8) }, 16*16 }; + +static const gfx_layout hedpanic_sprite_16x16x5 = +{ + 16,16, + RGN_FRAC(1,3), + 5, + { RGN_FRAC(2,3), RGN_FRAC(0,3), RGN_FRAC(0,3)+8, RGN_FRAC(1,3),RGN_FRAC(1,3)+8 }, + { 256+0,256+1,256+2,256+3,256+4,256+5,256+6,256+7,0,1,2,3,4,5,6,7 }, + { 0*16,1*16,2*16,3*16,4*16,5*16,6*16,7*16,8*16,9*16,10*16,11*16,12*16,13*16,14*16,15*16 }, + 16*32, +}; + + /* 8x8x8 */ static const gfx_layout layout_8x8x8 = { @@ -452,12 +466,6 @@ static const gfx_layout layout_8x8x8 = 8*8*2, }; -static GFXDECODE_START( esd16 ) - GFXDECODE_ENTRY( "gfx1", 0, layout_16x16x5, 0x200, 8 ) // [0] Sprites - GFXDECODE_ENTRY( "gfx2", 0, layout_8x8x8, 0x000, 2 ) // [1] Layers - GFXDECODE_ENTRY( "gfx1", 0, layout_16x16x5, 0x200, 8 ) // [0] Sprites -GFXDECODE_END - static const gfx_layout hedpanic_layout_8x8x8 = { 8,8, @@ -484,16 +492,12 @@ static const gfx_layout hedpanic_layout_16x16x8 = }; -static const gfx_layout hedpanic_sprite_16x16x5 = -{ - 16,16, - RGN_FRAC(1,3), - 5, - { RGN_FRAC(2,3), RGN_FRAC(0,3), RGN_FRAC(0,3)+8, RGN_FRAC(1,3),RGN_FRAC(1,3)+8 }, - { 7,6,5,4,3,2,1,0, 256+7,256+6,256+5,256+4,256+3,256+2,256+1,256+0 }, - { 0*16,1*16,2*16,3*16,4*16,5*16,6*16,7*16,8*16,9*16,10*16,11*16,12*16,13*16,14*16,15*16 }, - 16*32, -}; + +static GFXDECODE_START( esd16 ) + GFXDECODE_ENTRY( "gfx1", 0, layout_16x16x5, 0x200, 8 ) // [0] Sprites + GFXDECODE_ENTRY( "gfx2", 0, layout_8x8x8, 0x000, 2 ) // [1] Layers + GFXDECODE_ENTRY( "gfx2", 0, hedpanic_layout_16x16x8, 0x000, 2 ) // [1] Layers +GFXDECODE_END static GFXDECODE_START( hedpanic ) @@ -536,7 +540,15 @@ static MACHINE_RESET( esd16 ) state->m_tilemap0_color = 0; } -static MACHINE_CONFIG_START( multchmp, esd16_state ) +static UINT16 hedpanic_pri_callback(UINT16 x) +{ + if (x & 0x8000) + return 0xfffe; // under "tilemap 1" + else + return 0; // above everything +} + +static MACHINE_CONFIG_START( esd16, esd16_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu",M68000, 16000000) @@ -557,8 +569,14 @@ static MACHINE_CONFIG_START( multchmp, esd16_state ) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) MCFG_SCREEN_SIZE(0x140, 0x100) MCFG_SCREEN_VISIBLE_AREA(0, 0x140-1, 0+8, 0x100-8-1) - MCFG_SCREEN_UPDATE_STATIC(esd16) + MCFG_SCREEN_UPDATE_STATIC(hedpanic) + MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0) + decospr_device::set_gfx_region(*device, 0); + decospr_device::set_is_bootleg(*device, true); + decospr_device::set_pri_callback(*device, hedpanic_pri_callback); + decospr_device::set_flipallx(*device, 1); + MCFG_GFXDECODE(esd16) MCFG_PALETTE_LENGTH(768) @@ -574,7 +592,7 @@ static MACHINE_CONFIG_START( multchmp, esd16_state ) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.60) MACHINE_CONFIG_END -static MACHINE_CONFIG_DERIVED( hedpanic, multchmp ) +static MACHINE_CONFIG_DERIVED( hedpanic, esd16 ) /* basic machine hardware */ @@ -582,15 +600,18 @@ static MACHINE_CONFIG_DERIVED( hedpanic, multchmp ) MCFG_CPU_PROGRAM_MAP(hedpanic_map) MCFG_EEPROM_93C46_ADD("eeprom") - + MCFG_PALETTE_LENGTH(0x1000/2) MCFG_GFXDECODE(hedpanic) MCFG_SCREEN_MODIFY("screen") MCFG_SCREEN_UPDATE_STATIC(hedpanic) + MCFG_DEVICE_MODIFY("spritegen") + decospr_device::set_offsets(*device, -0x18,-0x100); MACHINE_CONFIG_END + static MACHINE_CONFIG_DERIVED( mchampdx, hedpanic ) /* basic machine hardware */ @@ -616,11 +637,16 @@ static MACHINE_CONFIG_DERIVED( swatpolc, hedpanic ) MCFG_GFXDECODE(tangtang) MACHINE_CONFIG_END -static MACHINE_CONFIG_DERIVED( hedpanio, hedpanic ) - +static MACHINE_CONFIG_DERIVED( hedpanio, esd16 ) /* basic machine hardware */ - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_UPDATE_STATIC(hedpanio) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(hedpanic_map) + + MCFG_EEPROM_93C46_ADD("eeprom") + + MCFG_PALETTE_LENGTH(0x1000/2) + + MCFG_GFXDECODE(hedpanic) MACHINE_CONFIG_END @@ -1278,8 +1304,8 @@ ROM_END ***************************************************************************/ /* ESD 11-09-98 */ -GAME( 1999, multchmp, 0, multchmp, multchmp, 0, ROT0, "ESD", "Multi Champ (World, ver. 2.5)", GAME_SUPPORTS_SAVE ) -GAME( 1998, multchmpk,multchmp, multchmp, multchmp, 0, ROT0, "ESD", "Multi Champ (Korea)", GAME_SUPPORTS_SAVE ) +GAME( 1999, multchmp, 0, esd16, multchmp, 0, ROT0, "ESD", "Multi Champ (World, ver. 2.5)", GAME_SUPPORTS_SAVE ) +GAME( 1998, multchmpk,multchmp, esd16, multchmp, 0, ROT0, "ESD", "Multi Champ (Korea)", GAME_SUPPORTS_SAVE ) /* ESD 05-28-99 */ GAME( 1999, hedpanico,hedpanic, hedpanio, hedpanic, 0, ROT0, "ESD", "Head Panic (ver. 0615, 15/06/1999)", GAME_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/nmg5.c b/src/mame/drivers/nmg5.c index 6a6d7fbc2e6..3de4a0fc7b4 100644 --- a/src/mame/drivers/nmg5.c +++ b/src/mame/drivers/nmg5.c @@ -224,7 +224,7 @@ Stephh's notes (based on the games M68000 code and some tests) : #include "cpu/m68000/m68000.h" #include "sound/okim6295.h" #include "sound/3812intf.h" - +#include "video/decospr.h" class nmg5_state : public driver_device { @@ -845,41 +845,7 @@ static VIDEO_START( nmg5 ) state->m_fg_tilemap->set_transparent_pen(0); } -static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) -{ - nmg5_state *state = machine.driver_data(); - UINT16 *spriteram = state->m_spriteram; - int offs; - for (offs = 0; offs < state->m_spriteram_size / 2; offs += 4) - { - int sx, sy, code, color, flipx, flipy, height, y; - - sx = spriteram[offs + 2]; - sy = spriteram[offs + 0]; - code = spriteram[offs + 1]; - color = (spriteram[offs + 2] >> 9) & 0xf; - height = 1 << ((spriteram[offs + 0] & 0x0600) >> 9); - flipx = spriteram[offs + 0] & 0x2000; - flipy = spriteram[offs + 0] & 0x4000; - - for (y = 0; y < height; y++) - { - drawgfx_transpen(bitmap,cliprect,machine.gfx[1], - code + (flipy ? height-1 - y : y), - color, - flipx,flipy, - sx & 0x1ff,248 - ((sy + 0x10 * (height - y)) & 0x1ff),0); - - /* wrap around */ - drawgfx_transpen(bitmap,cliprect,machine.gfx[1], - code + (flipy ? height-1 - y : y), - color, - flipx,flipy, - (sx & 0x1ff) - 512,248 - ((sy + 0x10 * (height - y)) & 0x1ff),0); - } - } -} static void draw_bitmap( running_machine &machine, bitmap_ind16 &bitmap ) { @@ -924,33 +890,33 @@ static SCREEN_UPDATE_IND16( nmg5 ) if (state->m_priority_reg == 0) { - draw_sprites(screen.machine(), bitmap, cliprect); + screen.machine().device("spritegen")->draw_sprites(bitmap, cliprect, state->m_spriteram, 0x400); state->m_fg_tilemap->draw(bitmap, cliprect, 0, 0); draw_bitmap(screen.machine(), bitmap); } else if (state->m_priority_reg == 1) { draw_bitmap(screen.machine(), bitmap); - draw_sprites(screen.machine(), bitmap, cliprect); + screen.machine().device("spritegen")->draw_sprites(bitmap, cliprect, state->m_spriteram, 0x400); state->m_fg_tilemap->draw(bitmap, cliprect, 0, 0); } else if (state->m_priority_reg == 2) { - draw_sprites(screen.machine(), bitmap, cliprect); + screen.machine().device("spritegen")->draw_sprites(bitmap, cliprect, state->m_spriteram, 0x400); draw_bitmap(screen.machine(), bitmap); state->m_fg_tilemap->draw(bitmap, cliprect, 0, 0); } else if (state->m_priority_reg == 3) { state->m_fg_tilemap->draw(bitmap, cliprect, 0, 0); - draw_sprites(screen.machine(), bitmap, cliprect); + screen.machine().device("spritegen")->draw_sprites(bitmap, cliprect, state->m_spriteram, 0x400); draw_bitmap(screen.machine(), bitmap); } else if (state->m_priority_reg == 7) { state->m_fg_tilemap->draw(bitmap, cliprect, 0, 0); draw_bitmap(screen.machine(), bitmap); - draw_sprites(screen.machine(), bitmap, cliprect); + screen.machine().device("spritegen")->draw_sprites(bitmap, cliprect, state->m_spriteram, 0x400); } return 0; } @@ -984,7 +950,7 @@ static const gfx_layout layout_16x16x5 = RGN_FRAC(1,5), 5, { RGN_FRAC(2,5),RGN_FRAC(3,5),RGN_FRAC(1,5),RGN_FRAC(4,5),RGN_FRAC(0,5) }, - { 7,6,5,4,3,2,1,0,135,134,133,132,131,130,129,128 }, + { 128,129,130,131,132,133,134,135, 0,1,2,3,4,5,6,7, }, { 0*8,1*8,2*8,3*8,4*8,5*8,6*8,7*8,8*8,9*8,10*8,11*8,12*8,13*8,14*8,15*8 }, 32*8 }; @@ -1061,6 +1027,13 @@ static MACHINE_CONFIG_START( nmg5, nmg5_state ) MCFG_VIDEO_START(nmg5) + MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0) + decospr_device::set_gfx_region(*device, 1); + decospr_device::set_is_bootleg(*device, true); + decospr_device::set_flipallx(*device, 1); + decospr_device::set_offsets(*device, 0,8); + + /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") diff --git a/src/mame/drivers/tumbleb.c b/src/mame/drivers/tumbleb.c index 56f617eae4f..da0e3ad388c 100644 --- a/src/mame/drivers/tumbleb.c +++ b/src/mame/drivers/tumbleb.c @@ -318,6 +318,7 @@ Stephh's notes (based on the games M68000 code and some tests) : #include "sound/3812intf.h" #include "sound/okim6295.h" #include "includes/tumbleb.h" +#include "video/decospr.h" #define TUMBLEP_HACK 0 #define FNCYWLD_HACK 0 @@ -347,15 +348,6 @@ static READ16_HANDLER( tumblepb_prot_r ) return ~0; } -#ifdef UNUSED_FUNCTION -static WRITE16_HANDLER( tumblepb_sound_w ) -{ - tumbleb_state *state = space->machine().driver_data(); - soundlatch_w(space, 0, data & 0xff); - device_set_input_line(state->m_audiocpu, 0, HOLD_LINE); -} -#endif - static WRITE16_HANDLER( jumppop_sound_w ) { tumbleb_state *state = space->machine().driver_data(); @@ -2091,6 +2083,10 @@ static MACHINE_CONFIG_START( tumblepb, tumbleb_state ) MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 1*8, 31*8-1) MCFG_SCREEN_UPDATE_STATIC(tumblepb) + MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0) + decospr_device::set_gfx_region(*device, 3); + decospr_device::set_is_bootleg(*device, true); + MCFG_GFXDECODE(tumbleb) MCFG_PALETTE_LENGTH(1024) @@ -2122,6 +2118,10 @@ static MACHINE_CONFIG_START( tumbleb2, tumbleb_state ) MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 1*8, 31*8-1) MCFG_SCREEN_UPDATE_STATIC(tumblepb) + MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0) + decospr_device::set_gfx_region(*device, 3); + decospr_device::set_is_bootleg(*device, true); + MCFG_GFXDECODE(tumbleb) MCFG_PALETTE_LENGTH(1024) @@ -2156,6 +2156,10 @@ static MACHINE_CONFIG_START( jumpkids, tumbleb_state ) MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 1*8, 31*8-1) MCFG_SCREEN_UPDATE_STATIC(jumpkids) + MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0) + decospr_device::set_gfx_region(*device, 3); + decospr_device::set_is_bootleg(*device, true); + MCFG_GFXDECODE(tumbleb) MCFG_PALETTE_LENGTH(1024) @@ -2186,6 +2190,11 @@ static MACHINE_CONFIG_START( fncywld, tumbleb_state ) MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 1*8, 31*8-1) MCFG_SCREEN_UPDATE_STATIC(fncywld) + MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0) + decospr_device::set_gfx_region(*device, 3); + decospr_device::set_is_bootleg(*device, true); + decospr_device::set_transpen(*device, 15); + MCFG_GFXDECODE(fncywld) MCFG_PALETTE_LENGTH(0x800) @@ -2252,6 +2261,10 @@ static MACHINE_CONFIG_START( htchctch, tumbleb_state ) MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 1*8, 31*8-1) MCFG_SCREEN_UPDATE_STATIC(semicom) + MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0) + decospr_device::set_gfx_region(*device, 3); + decospr_device::set_is_bootleg(*device, true); + MCFG_GFXDECODE(tumbleb) MCFG_PALETTE_LENGTH(1024) @@ -2340,6 +2353,10 @@ static MACHINE_CONFIG_START( jumppop, tumbleb_state ) MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 1*8, 31*8-1) MCFG_SCREEN_UPDATE_STATIC(jumppop) + MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0) + decospr_device::set_gfx_region(*device, 3); + decospr_device::set_is_bootleg(*device, true); + MCFG_GFXDECODE(jumppop) MCFG_PALETTE_LENGTH(1024) @@ -2377,6 +2394,10 @@ static MACHINE_CONFIG_START( suprtrio, tumbleb_state ) MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 1*8-1, 31*8-2) MCFG_SCREEN_UPDATE_STATIC(suprtrio) + MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0) + decospr_device::set_gfx_region(*device, 3); + decospr_device::set_is_bootleg(*device, true); + MCFG_GFXDECODE(suprtrio) MCFG_PALETTE_LENGTH(1024) @@ -2408,6 +2429,10 @@ static MACHINE_CONFIG_START( pangpang, tumbleb_state ) MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 1*8, 31*8-1) MCFG_SCREEN_UPDATE_STATIC(pangpang) + MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0) + decospr_device::set_gfx_region(*device, 3); + decospr_device::set_is_bootleg(*device, true); + MCFG_GFXDECODE(tumbleb) MCFG_PALETTE_LENGTH(1024) @@ -3770,16 +3795,17 @@ GAME( 1993, jumpkids, 0, jumpkids, tumblepb, jumpkids, ROT0, "Comad", GAME( 1994, metlsavr, 0, metlsavr, metlsavr, chokchok, ROT0, "First Amusement", "Metal Saver", GAME_SUPPORTS_SAVE ) GAME( 1994, pangpang, 0, pangpang, tumblepb, tumbleb2, ROT0, "Dong Gue La Mi Ltd.", "Pang Pang", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) // PIC is protected, sound simulation not 100% GAME( 1994, suprtrio, 0, suprtrio, suprtrio, suprtrio, ROT0, "Gameace", "Super Trio", GAME_SUPPORTS_SAVE ) +GAME( 1996, fncywld, 0, fncywld, fncywld, fncywld, ROT0, "Unico", "Fancy World - Earth of Crisis" , GAME_SUPPORTS_SAVE ) // game says 1996, testmode 1995? +GAME( 2001, jumppop, 0, jumppop, jumppop, 0, ORIENTATION_FLIP_X, "ESD", "Jumping Pop", GAME_SUPPORTS_SAVE ) + // Should also be 'Magicball Fighting' (c)1994 +GAME( 1995, wlstar, 0, cookbib_mcu, wlstar, wlstar, ROT0, "Mijin", "Wonder League Star - Sok-Magicball Fighting (Korea)", GAME_SUPPORTS_SAVE ) // translates to 'Wonder League Star - Return of Magicball Fighting' GAME( 1995, htchctch, 0, htchctch, htchctch, htchctch, ROT0, "SemiCom", "Hatch Catch" , GAME_SUPPORTS_SAVE ) // not 100% sure about gfx offsets GAME( 1995, cookbib, 0, cookbib, cookbib, htchctch, ROT0, "SemiCom", "Cookie & Bibi" , GAME_SUPPORTS_SAVE ) // not 100% sure about gfx offsets GAME( 1995, chokchok, 0, cookbib, chokchok, chokchok, ROT0, "SemiCom", "Choky! Choky!", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) // corruption during attract mode (tmap disable?) -GAME( 1995, wlstar, 0, cookbib_mcu, wlstar, wlstar, ROT0, "Mijin", "Wonder League Star - Sok-Magicball Fighting (Korea)", GAME_SUPPORTS_SAVE ) // translates to 'Wonder League Star - Return of Magicball Fighting' GAME( 1996, wondl96, 0, cookbib_mcu, wondl96, wondl96, ROT0, "SemiCom", "Wonder League '96 (Korea)", GAME_SUPPORTS_SAVE ) -GAME( 1996, fncywld, 0, fncywld, fncywld, fncywld, ROT0, "Unico", "Fancy World - Earth of Crisis" , GAME_SUPPORTS_SAVE ) // game says 1996, testmode 1995? GAME( 1996, sdfight, 0, sdfight, sdfight, bcstory, ROT0, "SemiCom", "SD Fighters (Korea)", GAME_SUPPORTS_SAVE ) GAME( 1997, bcstry, 0, bcstory, bcstory, bcstory, ROT0, "SemiCom", "B.C. Story (set 1)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) // gfx offsets? GAME( 1997, bcstrya, bcstry, bcstory, bcstory, bcstory, ROT0, "SemiCom", "B.C. Story (set 2)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) // gfx offsets? GAME( 1997, semibase, 0, semibase, semibase, bcstory, ROT0, "SemiCom", "MuHanSeungBu (SemiCom Baseball) (Korea)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )// sprite offsets.. GAME( 1998, dquizgo, 0, cookbib, dquizgo, dquizgo, ROT0, "SemiCom", "Date Quiz Go Go (Korea)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) // check layer offsets -GAME( 2001, jumppop, 0, jumppop, jumppop, 0, ORIENTATION_FLIP_X, "ESD", "Jumping Pop", GAME_SUPPORTS_SAVE ) diff --git a/src/mame/includes/crospang.h b/src/mame/includes/crospang.h index 98b728503a2..487237af513 100644 --- a/src/mame/includes/crospang.h +++ b/src/mame/includes/crospang.h @@ -20,8 +20,6 @@ public: /* video-related */ tilemap_t *m_bg_layer; tilemap_t *m_fg_layer; - int m_xsproff; - int m_ysproff; int m_bestri_tilebank; /* devices */ diff --git a/src/mame/includes/esd16.h b/src/mame/includes/esd16.h index c62ba9c962f..31469ca33c3 100644 --- a/src/mame/includes/esd16.h +++ b/src/mame/includes/esd16.h @@ -44,6 +44,4 @@ WRITE16_HANDLER( esd16_vram_1_w ); WRITE16_HANDLER( esd16_tilemap0_color_w ); VIDEO_START( esd16 ); -SCREEN_UPDATE_IND16( esd16 ); SCREEN_UPDATE_IND16( hedpanic ); -SCREEN_UPDATE_IND16( hedpanio ); diff --git a/src/mame/includes/tumbleb.h b/src/mame/includes/tumbleb.h index 2eb103941cd..d945b5f4df9 100644 --- a/src/mame/includes/tumbleb.h +++ b/src/mame/includes/tumbleb.h @@ -27,8 +27,6 @@ public: UINT16 m_control_0[8]; int m_flipscreen; UINT16 m_tilebank; - int m_sprite_xoffset; - int m_sprite_yoffset; /* devices */ device_t *m_maincpu; diff --git a/src/mame/video/boogwing.c b/src/mame/video/boogwing.c index 9aca459d17e..9e18f1180ed 100644 --- a/src/mame/video/boogwing.c +++ b/src/mame/video/boogwing.c @@ -4,153 +4,186 @@ #include "video/decocomn.h" #include "video/decospr.h" -static void draw_sprites( running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT16* spriteram_base, int gfx_region ) -{ - boogwing_state *state = machine.driver_data(); - int offs; - int flipscreen = !flip_screen_get(machine); - UINT16 priority = decocomn_priority_r(state->m_decocomn, 0, 0xffff); - - for (offs = 0x400 - 4; offs >= 0; offs -= 4) - { - int x, y, sprite, colour, multi, fx, fy, inc, flash, mult, pri = 0, spri = 0; - int alpha = 0xff; - - sprite = spriteram_base[offs + 1]; - if (!sprite) - continue; - - y = spriteram_base[offs]; - flash = y & 0x1000; - if (flash && (machine.primary_screen->frame_number() & 1)) - continue; - - x = spriteram_base[offs + 2]; - colour = (x >> 9) & 0x1f; - - fx = y & 0x2000; - fy = y & 0x4000; - multi = (1 << ((y & 0x0600) >> 9)) - 1; /* 1x, 2x, 4x, 8x height */ - - // Todo: This should be verified from the prom - if (gfx_region == 4) - { - // Sprite 2 priority vs sprite 1 - if ((spriteram_base[offs + 2] & 0xc000) == 0xc000) - spri = 4; - else if ((spriteram_base[offs + 2] & 0xc000)) - spri = 16; - else - spri = 64; - - // Transparency - if (spriteram_base[offs + 2] & 0x2000) - alpha = 0x80; - - if (priority == 0x2) - { - // Additional sprite alpha in this mode - if (spriteram_base[offs + 2] & 0x8000) - alpha = 0x80; - - // Sprite vs playfield - if ((spriteram_base[offs + 2] & 0xc000) == 0xc000) - pri = 4; - else if ((spriteram_base[offs + 2] & 0xc000) == 0x8000) - pri = 16; - else - pri = 64; - } - else - { - if ((spriteram_base[offs + 2] & 0x8000) == 0x8000) - pri = 16; - else - pri = 64; - } - } - else - { - // Sprite 1 priority vs sprite 2 - if (spriteram_base[offs + 2] & 0x8000) // todo - check only in pri mode 2?? - spri = 8; - else - spri = 32; - - // Sprite vs playfield - if (priority == 0x1) - { - if ((spriteram_base[offs + 2] & 0xc000)) - pri = 16; - else - pri = 64; - } - else - { - if ((spriteram_base[offs + 2] & 0xc000) == 0xc000) - pri = 4; - else if ((spriteram_base[offs + 2] & 0xc000) == 0x8000) - pri = 16; - else - pri = 64; - } - } - - x = x & 0x01ff; - y = y & 0x01ff; - if (x >= 320) x -= 512; - if (y >= 256) y -= 512; - y = 240 - y; - x = 304 - x; - - sprite &= ~multi; - if (fy) - inc = -1; - else - { - sprite += multi; - inc = 1; - } - - if (flipscreen) - { - y = 240 - y; - x = 304 - x; - if (fx) fx = 0; else fx = 1; - if (fy) fy = 0; else fy = 1; - mult = 16; - } - else - mult = -16; - - while (multi >= 0) - { - decocomn_pdrawgfx( - state->m_decocomn, - bitmap, cliprect, machine.gfx[gfx_region], - sprite - multi * inc, - colour, - fx,fy, - x,y + mult * multi, - 0, pri, spri, 0, alpha); - - multi--; - } - } -} - VIDEO_START( boogwing ) { machine.device("spritegen1")->alloc_sprite_bitmap(); machine.device("spritegen2")->alloc_sprite_bitmap(); } + +/* Mix the 2 sprite planes with the already rendered tilemaps.. + note, if we implement tilemap blending etc. too we'll probably have to mix those in here as well.. + + this is just a reimplementation of the old priority system used before conversion but to work with + the bitmaps. It could probably be simplified / improved greatly, along with the long-standing bugs + fixed, with manual mixing you have full control. + + apparently priority is based on a PROM, that should be used if possible. +*/ +static void mix_boogwing(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + boogwing_state *state = machine.driver_data(); + int y, x; + const pen_t *paldata = machine.pens; + bitmap_ind16 *sprite_bitmap1, *sprite_bitmap2; + bitmap_ind8* priority_bitmap; + + UINT16 priority = decocomn_priority_r(state->m_decocomn, 0, 0xffff); + + sprite_bitmap1 = &machine.device("spritegen1")->get_sprite_temp_bitmap(); + sprite_bitmap2 = &machine.device("spritegen2")->get_sprite_temp_bitmap(); + priority_bitmap = &machine.priority_bitmap; + + UINT32* dstline; + UINT16 *srcline1, *srcline2; + UINT8 *srcpriline; + + for (y=cliprect.min_y;y<=cliprect.max_y;y++) + { + srcline1=&sprite_bitmap1->pix16(y,0); + srcline2=&sprite_bitmap2->pix16(y,0); + srcpriline=&priority_bitmap->pix8(y,0); + + dstline=&bitmap.pix32(y,0); + + for (x=cliprect.min_x;x<=cliprect.max_x;x++) + { + UINT16 pix1 = srcline1[x]; + UINT16 pix2 = srcline2[x]; + + /* Here we have + pix1 - raw pixel / colour / priority data from first 1sdt chip + pix2 - raw pixel / colour / priority data from first 2nd chip + */ + + int pri1, pri2; + int spri1, spri2, alpha2; + alpha2 = 0xff; + + // pix1 sprite vs pix2 sprite + if (pix1 & 0x400) // todo - check only in pri mode 2?? + spri1 = 8; + else + spri1 = 32; + + // pix1 sprite vs playfield + switch (priority) + { + case 0x01: + { + if ((pix1 & 0x600)) + pri1 = 16; + else + pri1 = 64; + } + break; + + default: + { + if ((pix1 & 0x600) == 0x600) + pri1 = 4; + else if ((pix1 & 0x600) == 0x400) + pri1 = 16; + else + pri1 = 64; + } + break; + } + + // pix2 sprite vs pix1 sprite + if ((pix2 & 0x600) == 0x600) + spri2 = 4; + else if ((pix2 & 0x600)) + spri2 = 16; + else + spri2 = 64; + + // Transparency + if (pix2 & 0x100) + alpha2 = 0x80; + + // pix2 sprite vs playfield + switch (priority) + { + case 0x02: + { + // Additional sprite alpha in this mode + if (pix2 & 0x400) + alpha2 = 0x80; + + // Sprite vs playfield + if ((pix2 & 0x600) == 0x600) + pri2 = 4; + else if ((pix2 & 0x600) == 0x400) + pri2 = 16; + else + pri2 = 64; + } + break; + + default: + { + if ((pix2 & 0x400) == 0x400) + pri2 = 16; + else + pri2 = 64; + } + break; + } + + UINT8 bgpri = srcpriline[x]; + /* once we get here we have + + pri1 - 4/16/64 (sprite chip 1 pixel priority relative to bg) + pri2 - 4/16/64 (sprite chip 2 pixel priority relative to bg) + spri1 - 8/32 (priority of sprite chip 1 relative to other sprite chip) + spri2 - 4/16/64 (priority of sprite chip 2 relative to other sprite chip) + alpha2 - 0x80/0xff alpha level of sprite chip 2 pixels (0x80 if enabled, 0xff if not) + + bgpri - 0 / 8 / 32 (from drawing tilemaps earlier, to compare above pri1/pri2 priorities against) + pix1 - same as before (ready to extract just colour data from) + pix2 - same as before ^^ + */ + + int drawnpixe1 = 0; + if (pix1 & 0xf) + { + if (pri1 > bgpri) + { + dstline[x] = paldata[(pix1&0x1ff)+0x500]; + drawnpixe1 = 1; + } + } + + if (pix2 & 0xf) + { + if (pri2 > bgpri) + { + if ((!drawnpixe1) || (spri2 > spri1)) + { + if (alpha2==0xff) + { + dstline[x] = paldata[(pix2&0xff)+0x700]; + } + else + { + UINT32 base = dstline[x]; + dstline[x] = alpha_blend_r32(base, paldata[(pix2&0xff)+0x700], alpha2); + } + } + } + } + } + } +} + SCREEN_UPDATE_RGB32( boogwing ) { boogwing_state *state = screen.machine().driver_data(); UINT16 flip = deco16ic_pf_control_r(state->m_deco_tilegen1, 0, 0xffff); UINT16 priority = decocomn_priority_r(state->m_decocomn, 0, 0xffff); + /* Draw sprite planes to bitmaps for later mixing */ screen.machine().device("spritegen2")->draw_sprites(bitmap, cliprect, screen.machine().generic.buffered_spriteram2.u16, 0x400, true); screen.machine().device("spritegen1")->draw_sprites(bitmap, cliprect, screen.machine().generic.buffered_spriteram.u16, 0x400, true); @@ -159,7 +192,6 @@ SCREEN_UPDATE_RGB32( boogwing ) deco16ic_pf_update(state->m_deco_tilegen2, state->m_pf3_rowscroll, state->m_pf4_rowscroll); /* Draw playfields */ - decocomn_clear_sprite_priority_bitmap(state->m_decocomn); bitmap.fill(screen.machine().pens[0x400], cliprect); /* pen not confirmed */ screen.machine().priority_bitmap.fill(0); @@ -192,10 +224,7 @@ SCREEN_UPDATE_RGB32( boogwing ) deco16ic_tilemap_2_draw(state->m_deco_tilegen1, bitmap, cliprect, 0, 32); } - draw_sprites(screen.machine(), bitmap, cliprect, screen.machine().generic.buffered_spriteram.u16, 3); - draw_sprites(screen.machine(), bitmap, cliprect, screen.machine().generic.buffered_spriteram2.u16, 4); -// screen.machine().device("spritegen1")->inefficient_copy_sprite_bitmap(bitmap, cliprect, 0x0000, 0x0000, 0x500, 0x1ff); -// screen.machine().device("spritegen2")->inefficient_copy_sprite_bitmap(bitmap, cliprect, 0x0000, 0x0000, 0x700, 0xff); + mix_boogwing(screen.machine(), bitmap,cliprect); deco16ic_tilemap_1_draw(state->m_deco_tilegen1, bitmap, cliprect, 0, 0); return 0; diff --git a/src/mame/video/crospang.c b/src/mame/video/crospang.c index 54604311766..dd788e122f8 100644 --- a/src/mame/video/crospang.c +++ b/src/mame/video/crospang.c @@ -11,6 +11,7 @@ #include "emu.h" #include "includes/crospang.h" +#include "video/decospr.h" WRITE16_HANDLER( bestri_tilebank_w) { @@ -118,93 +119,6 @@ static TILE_GET_INFO( get_fg_tile_info ) SET_TILE_INFO(1, tile + state->m_bestri_tilebank * 0x1000, color + 0x10, 0); } -/* - - offset - - 0 -------yyyyyyyyy y offset - -----hh--------- sprite height - ---a------------ alpha blending enable - f--------------- flip x - -??-?----------- unused - - 1 --ssssssssssssss sprite code - ??-------------- unused - - 2 -------xxxxxxxxx x offset - ---cccc--------- colors - ???------------- unused - - 3 ---------------- unused - -*/ - -/* jumpkids / tumbleb.c! */ -static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) -{ - crospang_state *state = machine.driver_data(); - int offs; - int flipscreen = 0; - - for (offs = 0; offs < state->m_spriteram_size / 2; offs += 4) - { - int x, y, sprite, colour, multi, fx, fy, inc, flash, mult; - - sprite = state->m_spriteram[offs + 1] & 0x7fff; - if (!sprite) - continue; - - y = state->m_spriteram[offs]; - flash = y & 0x1000; - if (flash && (machine.primary_screen->frame_number() & 1)) - continue; - - x = state->m_spriteram[offs + 2]; - colour = (x >>9) & 0xf; - - fx = y & 0x2000; - fy = y & 0x4000; - multi = (1 << ((y & 0x0600) >> 9)) - 1; /* 1x, 2x, 4x, 8x height */ - - x = x & 0x01ff; - y = y & 0x01ff; - if (x >= 320) x -= 512; - if (y >= 256) y -= 512; - y = 240 - y; - x = 304 - x; - - // sprite &= ~multi; /* Todo: I bet TumblePop bootleg doesn't do this either */ - if (fy) - inc = -1; - else - { - sprite += multi; - inc = 1; - } - - if (flipscreen) - { - y = 240 - y; - x = 304 - x; - if (fx) fx = 0; else fx = 1; - if (fy) fy = 0; else fy = 1; - mult = 16; - } - else - mult = -16; - - while (multi >= 0) - { - drawgfx_transpen(bitmap,cliprect,machine.gfx[0], - sprite - multi * inc, - colour, - fx, fy, - x - state->m_xsproff, y - state->m_ysproff + mult * multi,0); - - multi--; - } - } -} VIDEO_START( crospang ) { @@ -220,6 +134,6 @@ SCREEN_UPDATE_IND16( crospang ) crospang_state *state = screen.machine().driver_data(); state->m_bg_layer->draw(bitmap, cliprect, 0, 0); state->m_fg_layer->draw(bitmap, cliprect, 0, 0); - draw_sprites(screen.machine(), bitmap, cliprect); + screen.machine().device("spritegen")->draw_sprites(bitmap, cliprect, state->m_spriteram, 0x400); return 0; } diff --git a/src/mame/video/decocomn.c b/src/mame/video/decocomn.c index 702e1e72d73..2807226b8d4 100644 --- a/src/mame/video/decocomn.c +++ b/src/mame/video/decocomn.c @@ -13,11 +13,8 @@ typedef struct _decocomn_state decocomn_state; struct _decocomn_state { screen_device *screen; - UINT16 *raster_display_list; UINT8 *dirty_palette; - bitmap_ind8 *sprite_priority_bitmap; UINT16 priority; - int raster_display_position; }; /***************************************************************************** @@ -113,88 +110,6 @@ READ16_DEVICE_HANDLER( decocomn_priority_r ) /******************************************************************************/ -/*****************************************************************************************/ - -void decocomn_clear_sprite_priority_bitmap( device_t *device ) -{ - decocomn_state *decocomn = get_safe_token(device); - - if (decocomn->sprite_priority_bitmap) - decocomn->sprite_priority_bitmap->fill(0); -} - -/* A special pdrawgfx z-buffered sprite renderer that is needed to properly draw multiple sprite sources with alpha */ -void decocomn_pdrawgfx( - device_t *device, - bitmap_rgb32 &dest, const rectangle &clip, const gfx_element *gfx, - UINT32 code, UINT32 color, int flipx, int flipy, int sx, int sy, - int transparent_color, UINT32 pri_mask, UINT32 sprite_mask, UINT8 write_pri, UINT8 alpha) -{ - decocomn_state *decocomn = get_safe_token(device); - int ox, oy, cx, cy; - int x_index, y_index, x, y; - bitmap_ind8 &priority_bitmap = gfx->machine().priority_bitmap; - const pen_t *pal = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; - const UINT8 *code_base = gfx_element_get_data(gfx, code % gfx->total_elements); - - /* check bounds */ - ox = sx; - oy = sy; - - if (sx > 319 || sy > 247 || sx < -15 || sy < -7) - return; - - if (sy < 0) sy = 0; - if (sx < 0) sx = 0; - - if (sx > 319) cx = 319; - else cx = ox + 16; - - cy = (sy - oy); - - if (flipy) y_index = 15 - cy; else y_index = cy; - - for (y = 0; y < 16 - cy; y++) - { - const UINT8 *source = code_base + (y_index * gfx->line_modulo); - UINT32 *destb = &dest.pix32(sy); - UINT8 *pri = &priority_bitmap.pix8(sy); - UINT8 *spri = &decocomn->sprite_priority_bitmap->pix8(sy); - - if (sy >= 0 && sy < 248) - { - if (flipx) { source += 15 - (sx - ox); x_index = -1; } - else { source += (sx - ox); x_index = 1; } - - for (x = sx; x < cx; x++) - { - int c = *source; - if (c != transparent_color && x >= 0 && x < 320) - { - if (pri_mask>pri[x] && sprite_mask>spri[x]) - { - if (alpha != 0xff) - destb[x] = alpha_blend_r32(destb[x], pal[c], alpha); - else - destb[x] = pal[c]; - if (write_pri) - pri[x] |= pri_mask; - } - spri[x] |= sprite_mask; - } - source += x_index; - } - } - - sy++; - if (sy > 247) - return; - if (flipy) y_index--; else y_index++; - } -} - -/*****************************************************************************************/ - /***************************************************************************** DEVICE INTERFACE *****************************************************************************/ @@ -209,25 +124,15 @@ static DEVICE_START( decocomn ) width = decocomn->screen->width(); height = decocomn->screen->height(); - decocomn->sprite_priority_bitmap = auto_bitmap_ind8_alloc(device->machine(), width, height); - decocomn->dirty_palette = auto_alloc_array_clear(device->machine(), UINT8, 4096); - decocomn->raster_display_list = auto_alloc_array_clear(device->machine(), UINT16, 20 * 256 / 2); - - device->save_item(NAME(decocomn->priority)); - device->save_item(NAME(decocomn->raster_display_position)); device->save_pointer(NAME(decocomn->dirty_palette), 4096); - device->save_pointer(NAME(decocomn->raster_display_list), 20 * 256 / 2); } static DEVICE_RESET( decocomn ) { decocomn_state *decocomn = get_safe_token(device); - - decocomn->raster_display_position = 0; - decocomn->priority = 0; } diff --git a/src/mame/video/decocomn.h b/src/mame/video/decocomn.h index 5cb824c233b..75734d404a5 100644 --- a/src/mame/video/decocomn.h +++ b/src/mame/video/decocomn.h @@ -46,12 +46,4 @@ READ16_DEVICE_HANDLER( decocomn_priority_r ); READ16_DEVICE_HANDLER( decocomn_71_r ); -/* used by boogwing, dassault, nitrobal */ -void decocomn_clear_sprite_priority_bitmap(device_t *device); -void decocomn_pdrawgfx( - device_t *device, - bitmap_rgb32 &dest,const rectangle &clip,const gfx_element *gfx, - UINT32 code,UINT32 color,int flipx,int flipy,int sx,int sy, - int transparent_color,UINT32 pri_mask,UINT32 sprite_mask,UINT8 write_pri,UINT8 alpha); - #endif diff --git a/src/mame/video/decospr.c b/src/mame/video/decospr.c index e5b06599483..2f7e9a81bf0 100644 --- a/src/mame/video/decospr.c +++ b/src/mame/video/decospr.c @@ -12,6 +12,8 @@ There is also a very simply 'drawgfx' path for games where the sprites are only of one priority level. + Several features are included to support the various clone / bootleg chips derived from this device, it appears + to have been a popular base for Korean developers (much as the Tumble Pop code was) used by: @@ -32,10 +34,16 @@ deco32.c rohga.c dassault.c + boogwing.c + + (bootleg) esd16.c + (bootleg) nmg5.c + (bootleg) tumbleb.c + (bootleg) crospang.c to convert: - boogwing.c - complex video mixing + (any other bootleg / clone chips?) notes: does the chip natively support 5bpp (tattass / nslasher) in hw, or is it done with doubled up chips? @@ -105,7 +113,7 @@ offs +2 ssssSSSS pppccccc s = size (height) -S = size (width) (double wings) +S = size (width) offs +3 -------- -------- @@ -116,8 +124,6 @@ t = sprite tile todo: the priotity callback for using pdrawgfx should really pack those 8 bits, and pass them instead of currently just passing offs+2 which lacks the extra priority bit -todo: basic blend mixing - */ #include "emu.h" @@ -148,19 +154,24 @@ void decospr_device::set_col_callback(device_t &device, decospr_colour_callback_ } + const device_type DECO_SPRITE = &device_creator; decospr_device::decospr_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : device_t(mconfig, DECO_SPRITE, "decospr_device", tag, owner, clock), m_gfxregion(0), m_pricallback(NULL), - m_colcallback(decospr_default_colour_callback) + m_colcallback(decospr_default_colour_callback), + m_is_bootleg(false), + m_x_offset(0), + m_y_offset(0), + m_flipallx(0), + m_transpen(0) { } void decospr_device::device_start() { -// sprite_kludge_x = sprite_kludge_y = 0; // printf("decospr_device::device_start()\n"); m_alt_format = 0; m_pixmask = 0xf; @@ -172,14 +183,6 @@ void decospr_device::device_reset() //printf("decospr_device::device_reset()\n"); } -/* -void decospr_device::decospr_sprite_kludge(int x, int y) -{ - sprite_kludge_x = x; - sprite_kludge_y = y; -} -*/ - void decospr_device::alloc_sprite_bitmap() { machine().primary_screen->register_screen_bitmap(m_sprite_bitmap); @@ -267,6 +270,12 @@ void decospr_device::draw_sprites_common(_BitmapClass &bitmap, const rectangle & fy = y & 0x4000; multi = (1 << ((y & 0x0600) >> 9)) - 1; /* 1x, 2x, 4x, 8x height */ + /* bootleg support (esd16.c) */ + if (flipscreen) x = ((x&0x1ff) - m_x_offset)&0x1ff; + else x = ((x&0x1ff) + m_x_offset)&0x1ff; + y = ((y&0x1ff) + m_y_offset)&0x1ff; + + if (cliprect.max_x>256) { x = x & 0x01ff; @@ -287,10 +296,12 @@ void decospr_device::draw_sprites_common(_BitmapClass &bitmap, const rectangle & x = 240 - x; } + //if (x <= 320) { - - sprite &= ~multi; + if (!m_is_bootleg) // several of the clone / bootleg chips don't do this, see jumpkids + sprite &= ~multi; + if (fy) inc = -1; else @@ -302,19 +313,24 @@ void decospr_device::draw_sprites_common(_BitmapClass &bitmap, const rectangle & if (flipscreen) { y = 240 - y; - - if (cliprect.max_x>256) - x = 304 - x; - else - x = 240 - x; - - if (fx) fx = 0; else fx = 1; if (fy) fy = 0; else fy = 1; mult = 16; } else mult = -16; + if (flipscreen || m_flipallx) + { + if (cliprect.max_x>256) + x = 304 - x; + else + x = 240 - x; + + if (fx) fx = 0; else fx = 1; + } + + + mult2 = multi + 1; while (multi >= 0) @@ -333,14 +349,14 @@ void decospr_device::draw_sprites_common(_BitmapClass &bitmap, const rectangle & colour, fx,fy, x,ypos, - machine().priority_bitmap,pri,0); + machine().priority_bitmap,pri,m_transpen); else drawgfx_transpen(bitmap,cliprect,machine().gfx[m_gfxregion], sprite - multi * inc, colour, fx,fy, x,ypos, - 0); + m_transpen); } // double wing uses this flag @@ -352,14 +368,14 @@ void decospr_device::draw_sprites_common(_BitmapClass &bitmap, const rectangle & colour, fx,fy, x-16,ypos, - machine().priority_bitmap,pri,0); + machine().priority_bitmap,pri,m_transpen); else drawgfx_transpen(bitmap,cliprect,machine().gfx[m_gfxregion], (sprite - multi * inc)-mult2, colour, fx,fy, x-16,ypos, - 0); + m_transpen); } } else @@ -370,7 +386,7 @@ void decospr_device::draw_sprites_common(_BitmapClass &bitmap, const rectangle & colour<(device); + dev.m_is_bootleg = is_bootleg; + } + + static void set_offsets(device_t &device, int x_offset, int y_offset) + { + decospr_device &dev = downcast(device); + dev.m_x_offset = x_offset; + dev.m_y_offset = y_offset; + } + + static void set_flipallx(device_t &device, int flipallx) + { + decospr_device &dev = downcast(device); + dev.m_flipallx = flipallx; + } + + static void set_transpen(device_t &device, int transpen) + { + decospr_device &dev = downcast(device); + dev.m_transpen = transpen; + } + + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, UINT16* spriteram, int sizewords, bool invert_flip = false ); void draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT16* spriteram, int sizewords, bool invert_flip = false ); void set_pri_callback(decospr_priority_callback_func callback); @@ -18,6 +44,11 @@ public: void set_alt_format(bool alt) { m_alt_format = alt; }; void set_pix_mix_mask(UINT16 mask) { m_pixmask = mask; }; void set_pix_raw_shift(UINT16 shift) { m_raw_shift = shift; }; + void set_is_bootleg(bool is_bootleg) { m_is_bootleg = is_bootleg; }; + void set_offsets(int x_offset, int y_offset) { m_x_offset = x_offset; m_y_offset = y_offset; }; + void set_flipallx(int flipallx) { m_flipallx = flipallx; }; + void set_transpen(int transpen) { m_transpen = transpen; }; + void alloc_sprite_bitmap(); void inefficient_copy_sprite_bitmap(bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT16 pri, UINT16 priority_mask, UINT16 colbase, UINT16 palmask, UINT8 alpha = 0xff); bitmap_ind16& get_sprite_temp_bitmap() { assert(m_sprite_bitmap.valid()); return m_sprite_bitmap; }; @@ -33,6 +64,12 @@ protected: UINT16 m_pixmask; UINT16 m_raw_shift; + // used by various bootleg / clone chips. + bool m_is_bootleg; // used by various bootlegs (disables masking of sprite tile number when multi-sprite is used) + int m_x_offset, m_y_offset; // used by various bootlegs + int m_flipallx; // used by esd16.c - hedpanio, multchmp , and nmg5.c + int m_transpen; // used by fncywld (tumbleb.c) + private: template void draw_sprites_common(_BitmapClass &bitmap, const rectangle &cliprect, UINT16* spriteram, int sizewords, bool invert_flip); diff --git a/src/mame/video/esd16.c b/src/mame/video/esd16.c index 8baca75d23b..b2ab059a94e 100644 --- a/src/mame/video/esd16.c +++ b/src/mame/video/esd16.c @@ -35,7 +35,7 @@ Note: if MAME_DEBUG is defined, pressing Z with: #include "emu.h" #include "includes/esd16.h" - +#include "video/decospr.h" /*************************************************************************** @@ -153,168 +153,6 @@ VIDEO_START( esd16 ) } - - -/*************************************************************************** - - Sprites Drawing - - Offset: Bits: Value: - - 0.w fedc b--- ---- ---- - ---- -a9- ---- ---- Y Size: (1 << N) Tiles - ---- ---8 7654 3210 Y (Signed, Bottom-Up) - - 2.w Code - - 4.w f--- ---- ---- ---- Sprite priority - -ed- ---- ---- ---- - ---c ---- ---- ---- Color? - ---- ba9- ---- ---- Color - ---- ---8 7654 3210 X (Signed) - - 6.w fedc ba9- ---- ---- - ---- ---8 ---- ---- ? 1 (Display Sprite?) - ---- ---- 7654 3210 - -- To Do: Flip X&Y ? They seem unused. - - these are clearly the same as the tumble pop (bootleg?) sprites - -***************************************************************************/ - -static void esd16_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) -{ - esd16_state *state = machine.driver_data(); - int offs; - - int max_x = machine.primary_screen->width(); - int max_y = machine.primary_screen->height(); - - for (offs = state->m_spriteram_size / 2 - 8 / 2; offs >= 0 ; offs -= 8 / 2) - { - int y, starty, endy, incy; - - int sy = state->m_spriteram[offs + 0]; - int code = state->m_spriteram[offs + 1]; - int sx = state->m_spriteram[offs + 2]; - int attr = state->m_spriteram[offs + 3]; - - int dimy = 1 << ((sy >> 9) & 3); - - int flipx = sy & 0x2000; - int flipy = attr & 0x0000; - int flash = sy & 0x1000; - - int color = (sx >> 9) & 0xf; - - int pri_mask; - - if (flash && (machine.primary_screen->frame_number() & 1)) - continue; - - if (sx & 0x8000) - pri_mask = 0xfffe; // under "tilemap 1" - else - pri_mask = 0; // above everything - - sx = sx & 0x1ff; - if (sx >= 0x180) - sx -= 0x200; - - sy = 0x100 - ((sy & 0xff) - (sy & 0x100)); - sy -= dimy * 16; - - if (flip_screen_get(machine)) - { - flipx = !flipx; sx = max_x - sx - 1 * 16 + 2; // small offset - flipy = !flipy; sy = max_y - sy - dimy * 16; - } - - if (flipy) { starty = sy + (dimy - 1) * 16; endy = sy-16; incy = -16; } - else { starty = sy; endy = sy + dimy * 16; incy = +16; } - - for (y = starty ; y != endy ; y += incy) - { - pdrawgfx_transpen(bitmap, cliprect, machine.gfx[0], - code++, - color, - flipx, flipy, - sx, y, - machine.priority_bitmap, pri_mask, 0); - } - } -} - -/* note, check if i can re-merge this with the other or if its really different */ -static void hedpanic_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) -{ - esd16_state *state = machine.driver_data(); - int offs; - - int max_x = machine.primary_screen->width(); - int max_y = machine.primary_screen->height(); - - for (offs = state->m_spriteram_size / 2 - 8 / 2; offs >= 0 ; offs -= 8 / 2) - { - int y, starty, endy, incy; - - int sy = state->m_spriteram[offs + 0]; - int code = state->m_spriteram[offs + 1]; - int sx = state->m_spriteram[offs + 2]; -// int attr = state->m_spriteram[offs + 3]; - - int dimy = 1 << ((sy >> 9) & 3); - - int flipx = sy & 0x2000; - int flipy = sy & 0x0000; - int flash = sy & 0x1000; - - int color = (sx >> 9) & 0xf; - - int pri_mask; - - if (flash && (machine.primary_screen->frame_number() & 1)) - continue; - - if (sx & 0x8000) - pri_mask = 0xfffe; // under "tilemap 1" - else - pri_mask = 0; // above everything - - sx = sx & 0x1ff; - if (sx >= 0x180) - sx -= 0x200; - - sy &= 0x1ff; - - sx -= 24; - - sy = 0x1ff - sy; - - if (flip_screen_get(machine)) - { - flipx = !flipx; sx = max_x - sx - 1 * 16 + 2; // small offset - flipy = !flipy; sy = max_y - sy - dimy * 16; - } - - if (flipy) { starty = sy + (dimy - 1) * 16; endy = sy - 16; incy = -16; } - else { starty = sy - dimy * 16; endy = sy; incy = +16; } - - for (y = starty ; y != endy ; y += incy) - { - pdrawgfx_transpen(bitmap, cliprect, machine.gfx[0], - code++, - color, - flipx, flipy, - sx, y, - machine.priority_bitmap, pri_mask, 0); - } - } -} - - - /*************************************************************************** @@ -323,40 +161,6 @@ static void hedpanic_draw_sprites( running_machine &machine, bitmap_ind16 &bitma ***************************************************************************/ -SCREEN_UPDATE_IND16( esd16 ) -{ - esd16_state *state = screen.machine().driver_data(); - int layers_ctrl = -1; - - screen.machine().priority_bitmap.fill(0, cliprect); - - state->m_tilemap_0->set_scrollx(0, state->m_scroll_0[0]); - state->m_tilemap_0->set_scrolly(0, state->m_scroll_0[1]); - - state->m_tilemap_1->set_scrollx(0, state->m_scroll_1[0]); - state->m_tilemap_1->set_scrolly(0, state->m_scroll_1[1]); - -#ifdef MAME_DEBUG -if (screen.machine().input().code_pressed(KEYCODE_Z)) -{ - int msk = 0; - if (screen.machine().input().code_pressed(KEYCODE_Q)) msk |= 1; - if (screen.machine().input().code_pressed(KEYCODE_W)) msk |= 2; - if (screen.machine().input().code_pressed(KEYCODE_A)) msk |= 4; - if (msk != 0) layers_ctrl &= msk; -} -#endif - - if (layers_ctrl & 1) state->m_tilemap_0->draw(bitmap, cliprect, 0, 0); - else bitmap.fill(0, cliprect); - - if (layers_ctrl & 2) state->m_tilemap_1->draw(bitmap, cliprect, 0, 1); - - if (layers_ctrl & 4) esd16_draw_sprites(screen.machine(), bitmap, cliprect); - return 0; -} - - SCREEN_UPDATE_IND16( hedpanic ) { esd16_state *state = screen.machine().driver_data(); @@ -413,70 +217,7 @@ if (screen.machine().input().code_pressed(KEYCODE_Z)) } - if (layers_ctrl & 4) hedpanic_draw_sprites(screen.machine(),bitmap,cliprect); - -// popmessage("%04x %04x %04x %04x %04x",head_unknown1[0],head_layersize[0],head_unknown3[0],head_unknown4[0],head_unknown5[0]); - return 0; -} - -// uses older style sprites -SCREEN_UPDATE_IND16( hedpanio ) -{ - esd16_state *state = screen.machine().driver_data(); - int layers_ctrl = -1; - - screen.machine().priority_bitmap.fill(0, cliprect); - -#ifdef MAME_DEBUG -if ( screen.machine().input().code_pressed(KEYCODE_Z) ) -{ - int msk = 0; - if (screen.machine().input().code_pressed(KEYCODE_Q)) msk |= 1; - if (screen.machine().input().code_pressed(KEYCODE_W)) msk |= 2; - if (screen.machine().input().code_pressed(KEYCODE_A)) msk |= 4; - if (msk != 0) layers_ctrl &= msk; -} -#endif - - if (layers_ctrl & 1) - { - if (state->m_head_layersize[0] & 0x0001) - { - state->m_tilemap_0_16x16->set_scrollx(0, state->m_scroll_0[0]); - state->m_tilemap_0_16x16->set_scrolly(0, state->m_scroll_0[1]); - state->m_tilemap_0_16x16->draw(bitmap, cliprect, 0, 0); - } - else - { - state->m_tilemap_0->set_scrollx(0, state->m_scroll_0[0]); - state->m_tilemap_0->set_scrolly(0, state->m_scroll_0[1]); - state->m_tilemap_0->draw(bitmap, cliprect, 0, 0); - } - } - else - { - bitmap.fill(0, cliprect); - } - - - if (layers_ctrl & 2) - { - if (state->m_head_layersize[0] & 0x0002) - { - state->m_tilemap_1_16x16->set_scrollx(0, state->m_scroll_1[0]); - state->m_tilemap_1_16x16->set_scrolly(0, state->m_scroll_1[1]); - state->m_tilemap_1_16x16->draw(bitmap, cliprect, 0, 1); - } - else - { - state->m_tilemap_1->set_scrollx(0, state->m_scroll_1[0]); - state->m_tilemap_1->set_scrolly(0, state->m_scroll_1[1]); - state->m_tilemap_1->draw(bitmap, cliprect, 0, 1); - } - - } - - if (layers_ctrl & 4) esd16_draw_sprites(screen.machine(),bitmap,cliprect); + if (layers_ctrl & 4) screen.machine().device("spritegen")->draw_sprites(bitmap, cliprect, state->m_spriteram, 0x400); // popmessage("%04x %04x %04x %04x %04x",head_unknown1[0],head_layersize[0],head_unknown3[0],head_unknown4[0],head_unknown5[0]); return 0; diff --git a/src/mame/video/rohga.c b/src/mame/video/rohga.c index b6a637f9a45..6d0f537b908 100644 --- a/src/mame/video/rohga.c +++ b/src/mame/video/rohga.c @@ -224,7 +224,6 @@ SCREEN_UPDATE_RGB32( nitrobal ) /* Draw playfields - Palette of 2nd playfield chip visible if playfields turned off */ bitmap.fill(screen.machine().pens[512], cliprect); screen.machine().priority_bitmap.fill(0); - decocomn_clear_sprite_priority_bitmap(state->m_decocomn); /* pf3 and pf4 are combined into a single 8bpp bitmap */ deco16ic_tilemap_12_combine_draw(state->m_deco_tilegen2, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0); diff --git a/src/mame/video/tumbleb.c b/src/mame/video/tumbleb.c index b0bec5e62a5..ac4e56a00d8 100644 --- a/src/mame/video/tumbleb.c +++ b/src/mame/video/tumbleb.c @@ -16,206 +16,10 @@ to switch between 8*8 tiles and 16*16 tiles. #include "emu.h" #include "includes/tumbleb.h" +#include "video/decospr.h" /******************************************************************************/ -static void tumblepb_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) -{ - tumbleb_state *state = machine.driver_data(); - UINT16 *spriteram = state->m_spriteram; - int offs; - - for (offs = 0; offs < 0x400; offs += 4) - { - int x, y, sprite, colour, multi, fx, fy, inc, flash, mult; - - sprite = spriteram[offs + 1] & 0x3fff; - if (!sprite) - continue; - - y = spriteram[offs]; - flash = y & 0x1000; - if (flash && (machine.primary_screen->frame_number() & 1)) - continue; - - x = spriteram[offs + 2]; - colour = (x >> 9) & 0xf; - - fx = y & 0x2000; - fy = y & 0x4000; - multi = (1 << ((y & 0x0600) >> 9)) - 1; /* 1x, 2x, 4x, 8x height */ - - x = x & 0x01ff; - y = y & 0x01ff; - if (x >= 320) x -= 512; - if (y >= 256) y -= 512; - y = 240 - y; - x = 304 - x; - - sprite &= ~multi; - if (fy) - inc = -1; - else - { - sprite += multi; - inc = 1; - } - - if (state->m_flipscreen) - { - y = 240 - y; - x = 304 - x; - if (fx) fx = 0; else fx = 1; - if (fy) fy = 0; else fy = 1; - mult = 16; - } - else - mult = -16; - - while (multi >= 0) - { - drawgfx_transpen(bitmap,cliprect,machine.gfx[3], - sprite - multi * inc, - colour, - fx,fy, - state->m_sprite_xoffset + x, state->m_sprite_yoffset + y + mult * multi, 0); - - multi--; - } - } -} - -static void jumpkids_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) -{ - tumbleb_state *state = machine.driver_data(); - UINT16 *spriteram = state->m_spriteram; - int offs; - - for (offs = 0; offs < state->m_spriteram_size / 2; offs += 4) - { - int x, y, sprite, colour, multi, fx, fy, inc, flash, mult; - - sprite = spriteram[offs + 1] & 0x7fff; - if (!sprite) - continue; - - y = spriteram[offs]; - flash = y & 0x1000; - if (flash && (machine.primary_screen->frame_number() & 1)) - continue; - - x = spriteram[offs+2]; - colour = (x >> 9) & 0xf; - - fx = y & 0x2000; - fy = y & 0x4000; - multi = (1 << ((y & 0x0600) >> 9)) - 1; /* 1x, 2x, 4x, 8x height */ - - x = x & 0x01ff; - y = y & 0x01ff; - if (x >= 320) x -= 512; - if (y >= 256) y -= 512; - y = 240 - y; - x = 304 - x; - - // sprite &= ~multi; /* Todo: I bet TumblePop bootleg doesn't do this either */ - if (fy) - inc = -1; - else - { - sprite += multi; - inc = 1; - } - - if (state->m_flipscreen) - { - y = 240 - y; - x = 304 - x; - if (fx) fx = 0; else fx = 1; - if (fy) fy = 0; else fy = 1; - mult = 16; - } - else - mult = -16; - - while (multi >= 0) - { - drawgfx_transpen(bitmap,// x-1 for bcstory .. realign other layers? - cliprect,machine.gfx[3], - sprite - multi * inc, - colour, - fx,fy, - state->m_sprite_xoffset + x, state->m_sprite_yoffset + y + mult * multi, 0); - - multi--; - } - } -} - -static void fncywld_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) -{ - tumbleb_state *state = machine.driver_data(); - UINT16 *spriteram = state->m_spriteram; - int offs; - - for (offs = 0; offs < 0x400; offs += 4) - { - int x, y, sprite, colour, multi, fx, fy, inc, flash, mult; - - sprite = spriteram[offs + 1] & 0x3fff; - if (!sprite) - continue; - - y = spriteram[offs]; - flash = y & 0x1000; - if (flash && (machine.primary_screen->frame_number() & 1)) - continue; - - x = spriteram[offs + 2]; - colour = (x >> 9) & 0x3f; - - fx = y & 0x2000; - fy = y & 0x4000; - multi = (1 << ((y & 0x0600) >> 9)) - 1; /* 1x, 2x, 4x, 8x height */ - - x = x & 0x01ff; - y = y & 0x01ff; - if (x >= 320) x -= 512; - if (y >= 256) y -= 512; - y = 240 - y; - x = 304 - x; - - // sprite &= ~multi; /* Todo: I bet TumblePop bootleg doesn't do this either */ - if (fy) - inc = -1; - else - { - sprite += multi; - inc = 1; - } - - if (state->m_flipscreen) - { - y = 240 - y; - x = 304 - x; - if (fx) fx = 0; else fx = 1; - if (fy) fy = 0; else fy = 1; - mult = 16; - } - else mult = -16; - - while (multi >= 0) - { - drawgfx_transpen(bitmap,cliprect,machine.gfx[3], - sprite - multi * inc, - colour, - fx,fy, - state->m_sprite_xoffset + x, state->m_sprite_yoffset + y + mult * multi, 15); - - multi--; - } - } -} /******************************************************************************/ @@ -504,9 +308,6 @@ VIDEO_START( pangpang ) state->m_pf1_tilemap->set_transparent_pen(0); state->m_pf1_alt_tilemap->set_transparent_pen(0); - state->m_sprite_xoffset = -1; - state->m_sprite_yoffset = 0; - machine.save().register_postload(save_prepost_delegate(FUNC(tumbleb_tilemap_redraw), &machine)); } @@ -522,9 +323,6 @@ VIDEO_START( tumblepb ) state->m_pf1_tilemap->set_transparent_pen(0); state->m_pf1_alt_tilemap->set_transparent_pen(0); - state->m_sprite_xoffset = -1; - state->m_sprite_yoffset = 0; - machine.save().register_postload(save_prepost_delegate(FUNC(tumbleb_tilemap_redraw), &machine)); } @@ -539,10 +337,6 @@ VIDEO_START( sdfight ) state->m_pf1_tilemap->set_transparent_pen(0); state->m_pf1_alt_tilemap->set_transparent_pen(0); - /* aligned to monitor test */ - state->m_sprite_xoffset = 0; - state->m_sprite_yoffset = 1; - machine.save().register_postload(save_prepost_delegate(FUNC(tumbleb_tilemap_redraw), &machine)); } @@ -557,9 +351,6 @@ VIDEO_START( fncywld ) state->m_pf1_tilemap->set_transparent_pen(15); state->m_pf1_alt_tilemap->set_transparent_pen(15); - state->m_sprite_xoffset = -1; - state->m_sprite_yoffset = 0; - machine.save().register_postload(save_prepost_delegate(FUNC(tumbleb_tilemap_redraw), &machine)); } @@ -580,9 +371,6 @@ VIDEO_START( jumppop ) state->m_pf2_tilemap->set_flip(TILEMAP_FLIPX); state->m_pf2_alt_tilemap->set_flip(TILEMAP_FLIPX); - state->m_sprite_xoffset = -1; - state->m_sprite_yoffset = 0; - machine.save().register_postload(save_prepost_delegate(FUNC(tumbleb_tilemap_redraw), &machine)); } @@ -602,6 +390,26 @@ VIDEO_START( suprtrio ) /******************************************************************************/ +void tumbleb_draw_common(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int pf1x_offs, int pf1y_offs, int pf2x_offs, int pf2y_offs) +{ + tumbleb_state *state = machine.driver_data(); + + state->m_pf1_tilemap->set_scrollx(0, state->m_control_0[1] + pf1x_offs); + state->m_pf1_tilemap->set_scrolly(0, state->m_control_0[2] + pf1y_offs); + state->m_pf1_alt_tilemap->set_scrollx(0, state->m_control_0[1] + pf1x_offs); + state->m_pf1_alt_tilemap->set_scrolly(0, state->m_control_0[2] + pf1y_offs); + state->m_pf2_tilemap->set_scrollx(0, state->m_control_0[3] + pf2x_offs); + state->m_pf2_tilemap->set_scrolly(0, state->m_control_0[4] + pf2y_offs); + + state->m_pf2_tilemap->draw(bitmap, cliprect, 0, 0); + + if (state->m_control_0[6] & 0x80) + state->m_pf1_tilemap->draw(bitmap, cliprect, 0, 0); + else + state->m_pf1_alt_tilemap->draw(bitmap, cliprect, 0, 0); + + machine.device("spritegen")->draw_sprites(bitmap, cliprect, state->m_spriteram, state->m_spriteram_size/2); +} SCREEN_UPDATE_IND16( tumblepb ) { @@ -621,21 +429,8 @@ SCREEN_UPDATE_IND16( tumblepb ) else offs2 = -5; - state->m_pf1_tilemap->set_scrollx(0, state->m_control_0[1] + offs2); - state->m_pf1_tilemap->set_scrolly(0, state->m_control_0[2]); - state->m_pf1_alt_tilemap->set_scrollx(0, state->m_control_0[1] + offs2); - state->m_pf1_alt_tilemap->set_scrolly(0, state->m_control_0[2]); - state->m_pf2_tilemap->set_scrollx(0, state->m_control_0[3] + offs); - state->m_pf2_tilemap->set_scrolly(0, state->m_control_0[4]); + tumbleb_draw_common(screen.machine(),bitmap,cliprect, offs2, 0, offs, 0); - state->m_pf2_tilemap->draw(bitmap, cliprect, 0, 0); - - if (state->m_control_0[6] & 0x80) - state->m_pf1_tilemap->draw(bitmap, cliprect, 0, 0); - else - state->m_pf1_alt_tilemap->draw(bitmap, cliprect, 0, 0); - - tumblepb_draw_sprites(screen.machine(), bitmap, cliprect); return 0; } @@ -657,21 +452,7 @@ SCREEN_UPDATE_IND16( jumpkids ) else offs2 = -5; - state->m_pf1_tilemap->set_scrollx(0, state->m_control_0[1] + offs2); - state->m_pf1_tilemap->set_scrolly(0, state->m_control_0[2]); - state->m_pf1_alt_tilemap->set_scrollx(0, state->m_control_0[1] + offs2); - state->m_pf1_alt_tilemap->set_scrolly(0, state->m_control_0[2]); - state->m_pf2_tilemap->set_scrollx(0, state->m_control_0[3] + offs); - state->m_pf2_tilemap->set_scrolly(0, state->m_control_0[4]); - - state->m_pf2_tilemap->draw(bitmap, cliprect, 0, 0); - - if (state->m_control_0[6] & 0x80) - state->m_pf1_tilemap->draw(bitmap, cliprect, 0, 0); - else - state->m_pf1_alt_tilemap->draw(bitmap, cliprect, 0, 0); - - jumpkids_draw_sprites(screen.machine(), bitmap, cliprect); + tumbleb_draw_common(screen.machine(),bitmap,cliprect, offs2, 0, offs, 0); return 0; } @@ -693,21 +474,7 @@ SCREEN_UPDATE_IND16( semicom ) else offs2 = -5; - state->m_pf1_tilemap->set_scrollx(0, state->m_control_0[1] + offs2); - state->m_pf1_tilemap->set_scrolly(0, state->m_control_0[2]); - state->m_pf1_alt_tilemap->set_scrollx(0, state->m_control_0[1] + offs2); - state->m_pf1_alt_tilemap->set_scrolly(0, state->m_control_0[2]); - state->m_pf2_tilemap->set_scrollx(0, state->m_control_0[3] + offs); - state->m_pf2_tilemap->set_scrolly(0, state->m_control_0[4]); - - state->m_pf2_tilemap->draw(bitmap, cliprect, 0, 0); - - if (state->m_control_0[6] & 0x80) - state->m_pf1_tilemap->draw(bitmap, cliprect, 0, 0); - else - state->m_pf1_alt_tilemap->draw(bitmap, cliprect, 0, 0); - - jumpkids_draw_sprites(screen.machine(), bitmap, cliprect); + tumbleb_draw_common(screen.machine(),bitmap,cliprect, offs2, 0, offs, 0); return 0; } @@ -722,21 +489,8 @@ SCREEN_UPDATE_IND16( semicom_altoffsets ) offsy = 2; offsx2 = -5; - state->m_pf1_tilemap->set_scrollx(0, state->m_control_0[1] + offsx2); - state->m_pf1_tilemap->set_scrolly(0, state->m_control_0[2]); - state->m_pf1_alt_tilemap->set_scrollx(0, state->m_control_0[1] + offsx2); - state->m_pf1_alt_tilemap->set_scrolly(0, state->m_control_0[2]); - state->m_pf2_tilemap->set_scrollx(0, state->m_control_0[3] + offsx); - state->m_pf2_tilemap->set_scrolly(0, state->m_control_0[4] + offsy); + tumbleb_draw_common(screen.machine(),bitmap,cliprect, offsx2, 0, offsx, offsy); - state->m_pf2_tilemap->draw(bitmap, cliprect, 0, 0); - - if (state->m_control_0[6] & 0x80) - state->m_pf1_tilemap->draw(bitmap, cliprect, 0, 0); - else - state->m_pf1_alt_tilemap->draw(bitmap, cliprect, 0, 0); - - jumpkids_draw_sprites(screen.machine(), bitmap, cliprect); return 0; } @@ -760,21 +514,7 @@ SCREEN_UPDATE_IND16( bcstory ) else offs2 = 8; - state->m_pf1_tilemap->set_scrollx(0, state->m_control_0[1] + offs2); - state->m_pf1_tilemap->set_scrolly(0, state->m_control_0[2]); - state->m_pf1_alt_tilemap->set_scrollx(0, state->m_control_0[1] + offs2); - state->m_pf1_alt_tilemap->set_scrolly(0, state->m_control_0[2]); - state->m_pf2_tilemap->set_scrollx(0, state->m_control_0[3] + offs); - state->m_pf2_tilemap->set_scrolly(0, state->m_control_0[4]); - - state->m_pf2_tilemap->draw(bitmap, cliprect, 0, 0); - - if (state->m_control_0[6] & 0x80) - state->m_pf1_tilemap->draw(bitmap, cliprect, 0, 0); - else - state->m_pf1_alt_tilemap->draw(bitmap, cliprect, 0, 0); - - jumpkids_draw_sprites(screen.machine(), bitmap, cliprect); + tumbleb_draw_common(screen.machine(),bitmap,cliprect, offs2, 0, offs, 0); return 0; } @@ -788,22 +528,8 @@ SCREEN_UPDATE_IND16( semibase ) offs = -1; offs2 = -2; - /* sprites need an offset too */ - state->m_pf1_tilemap->set_scrollx(0, state->m_control_0[1] + offs2); - state->m_pf1_tilemap->set_scrolly(0, state->m_control_0[2]); - state->m_pf1_alt_tilemap->set_scrollx(0, state->m_control_0[1] + offs2); - state->m_pf1_alt_tilemap->set_scrolly(0, state->m_control_0[2]); - state->m_pf2_tilemap->set_scrollx(0, state->m_control_0[3] + offs); - state->m_pf2_tilemap->set_scrolly(0, state->m_control_0[4]); + tumbleb_draw_common(screen.machine(),bitmap,cliprect, offs2, 0, offs, 0); - state->m_pf2_tilemap->draw(bitmap, cliprect, 0, 0); - - if (state->m_control_0[6] & 0x80) - state->m_pf1_tilemap->draw(bitmap, cliprect, 0, 0); - else - state->m_pf1_alt_tilemap->draw(bitmap, cliprect, 0, 0); - - jumpkids_draw_sprites(screen.machine(), bitmap, cliprect); return 0; } @@ -817,26 +543,12 @@ SCREEN_UPDATE_IND16( sdfight ) offs = -1; offs2 = -5; // foreground scroll.. - /* sprites need an offset too */ - state->m_pf1_tilemap->set_scrollx(0, state->m_control_0[1] + offs2); - state->m_pf1_tilemap->set_scrolly(0, state->m_control_0[2] - 16); // needed for the ground ... - state->m_pf1_alt_tilemap->set_scrollx(0, state->m_control_0[1] + offs2); - state->m_pf1_alt_tilemap->set_scrolly(0, state->m_control_0[2] - 16); - state->m_pf2_tilemap->set_scrollx(0, state->m_control_0[3] + offs); - state->m_pf2_tilemap->set_scrolly(0, state->m_control_0[4]); + tumbleb_draw_common(screen.machine(),bitmap,cliprect, offs2, -16, offs, 0); - state->m_pf2_tilemap->draw(bitmap, cliprect, 0, 0); - if (state->m_control_0[6] & 0x80) - state->m_pf1_tilemap->draw(bitmap, cliprect, 0, 0); - else - state->m_pf1_alt_tilemap->draw(bitmap, cliprect, 0, 0); - - jumpkids_draw_sprites(screen.machine(), bitmap, cliprect); + screen.machine().device("spritegen")->draw_sprites(bitmap, cliprect, state->m_spriteram, state->m_spriteram_size/2); return 0; } - - SCREEN_UPDATE_IND16( fncywld ) { tumbleb_state *state = screen.machine().driver_data(); @@ -855,81 +567,7 @@ SCREEN_UPDATE_IND16( fncywld ) else offs2 = -5; - state->m_pf1_tilemap->set_scrollx(0, state->m_control_0[1] + offs2); - state->m_pf1_tilemap->set_scrolly(0, state->m_control_0[2]); - state->m_pf1_alt_tilemap->set_scrollx(0, state->m_control_0[1] + offs2); - state->m_pf1_alt_tilemap->set_scrolly(0, state->m_control_0[2]); - state->m_pf2_tilemap->set_scrollx(0, state->m_control_0[3] + offs); - state->m_pf2_tilemap->set_scrolly(0, state->m_control_0[4]); - - state->m_pf2_tilemap->draw(bitmap, cliprect, 0, 0); - - if (state->m_control_0[6] & 0x80) - state->m_pf1_tilemap->draw(bitmap, cliprect, 0, 0); - else - state->m_pf1_alt_tilemap->draw(bitmap, cliprect, 0, 0); - - fncywld_draw_sprites(screen.machine(), bitmap, cliprect); - return 0; -} - - -SCREEN_UPDATE_IND16( jumppop ) -{ - tumbleb_state *state = screen.machine().driver_data(); - - // bitmap.fill(get_black_pen(screen.machine()), cliprect); - - state->m_pf1_tilemap->set_scrollx(0, state->m_control[2] - 0x3a0); - state->m_pf1_tilemap->set_scrolly(0, state->m_control[3]); - state->m_pf1_alt_tilemap->set_scrollx(0, state->m_control[2] - 0x3a0); - state->m_pf1_alt_tilemap->set_scrolly(0, state->m_control[3]); - state->m_pf2_tilemap->set_scrollx(0, state->m_control[0] - 0x3a2); - state->m_pf2_tilemap->set_scrolly(0, state->m_control[1]); - state->m_pf2_alt_tilemap->set_scrollx(0, state->m_control[0] - 0x3a2); - state->m_pf2_alt_tilemap->set_scrolly(0, state->m_control[1]); - - if (state->m_control[7] & 1) - state->m_pf2_tilemap->draw(bitmap, cliprect, 0, 0); - else - state->m_pf2_alt_tilemap->draw(bitmap, cliprect, 0, 0); - - if (state->m_control[7] & 2) - state->m_pf1_alt_tilemap->draw(bitmap, cliprect, 0, 0); - else - state->m_pf1_tilemap->draw(bitmap, cliprect, 0, 0); - -//popmessage("%04x %04x %04x %04x %04x %04x %04x %04x", state->m_control[0],state->m_control[1],state->m_control[2],state->m_control[3],state->m_control[4],state->m_control[5],state->m_control[6],state->m_control[7]); - - jumpkids_draw_sprites(screen.machine(), bitmap, cliprect); - return 0; -} - - -SCREEN_UPDATE_IND16( suprtrio ) -{ - tumbleb_state *state = screen.machine().driver_data(); - - state->m_pf1_alt_tilemap->set_scrollx(0, -state->m_control[1] - 6); - state->m_pf1_alt_tilemap->set_scrolly(0, -state->m_control[2]); - state->m_pf2_tilemap->set_scrollx(0, -state->m_control[3] - 2); - state->m_pf2_tilemap->set_scrolly(0, -state->m_control[4]); - - state->m_pf2_tilemap->draw(bitmap, cliprect, 0, 0); - state->m_pf1_alt_tilemap->draw(bitmap, cliprect, 0, 0); - - jumpkids_draw_sprites(screen.machine(), bitmap, cliprect); -#if 0 -popmessage("%04x %04x %04x %04x %04x %04x %04x %04x", - state->m_control[0], - state->m_control[1], - state->m_control[2], - state->m_control[3], - state->m_control[4], - state->m_control[5], - state->m_control[6], - state->m_control[7]); -#endif + tumbleb_draw_common(screen.machine(),bitmap,cliprect, offs2, -16, offs, 0); return 0; } @@ -952,20 +590,54 @@ SCREEN_UPDATE_IND16( pangpang ) else offs2 = -5; - state->m_pf1_tilemap->set_scrollx(0, state->m_control_0[1] + offs2); - state->m_pf1_tilemap->set_scrolly(0, state->m_control_0[2]); - state->m_pf1_alt_tilemap->set_scrollx(0, state->m_control_0[1] + offs2); - state->m_pf1_alt_tilemap->set_scrolly(0, state->m_control_0[2]); - state->m_pf2_tilemap->set_scrollx(0, state->m_control_0[3] + offs); - state->m_pf2_tilemap->set_scrolly(0, state->m_control_0[4]); - - state->m_pf2_tilemap->draw(bitmap, cliprect, 0, 0); - - if (state->m_control_0[6] & 0x80) - state->m_pf1_tilemap->draw(bitmap, cliprect, 0, 0); - else - state->m_pf1_alt_tilemap->draw(bitmap, cliprect, 0, 0); - - jumpkids_draw_sprites(screen.machine(), bitmap, cliprect); + tumbleb_draw_common(screen.machine(),bitmap,cliprect, offs2, -16, offs, 0); return 0; } + + + +SCREEN_UPDATE_IND16( jumppop ) +{ + tumbleb_state *state = screen.machine().driver_data(); + + state->m_pf1_tilemap->set_scrollx(0, state->m_control[2] - 0x3a0); + state->m_pf1_tilemap->set_scrolly(0, state->m_control[3]); + state->m_pf1_alt_tilemap->set_scrollx(0, state->m_control[2] - 0x3a0); + state->m_pf1_alt_tilemap->set_scrolly(0, state->m_control[3]); + state->m_pf2_tilemap->set_scrollx(0, state->m_control[0] - 0x3a2); + state->m_pf2_tilemap->set_scrolly(0, state->m_control[1]); + state->m_pf2_alt_tilemap->set_scrollx(0, state->m_control[0] - 0x3a2); + state->m_pf2_alt_tilemap->set_scrolly(0, state->m_control[1]); + + if (state->m_control[7] & 1) + state->m_pf2_tilemap->draw(bitmap, cliprect, 0, 0); + else + state->m_pf2_alt_tilemap->draw(bitmap, cliprect, 0, 0); + + if (state->m_control[7] & 2) + state->m_pf1_alt_tilemap->draw(bitmap, cliprect, 0, 0); + else + state->m_pf1_tilemap->draw(bitmap, cliprect, 0, 0); + + screen.machine().device("spritegen")->draw_sprites(bitmap, cliprect, state->m_spriteram, state->m_spriteram_size/2); + + return 0; +} + + +SCREEN_UPDATE_IND16( suprtrio ) +{ + tumbleb_state *state = screen.machine().driver_data(); + + state->m_pf1_alt_tilemap->set_scrollx(0, -state->m_control[1] - 6); + state->m_pf1_alt_tilemap->set_scrolly(0, -state->m_control[2]); + state->m_pf2_tilemap->set_scrollx(0, -state->m_control[3] - 2); + state->m_pf2_tilemap->set_scrolly(0, -state->m_control[4]); + + state->m_pf2_tilemap->draw(bitmap, cliprect, 0, 0); + state->m_pf1_alt_tilemap->draw(bitmap, cliprect, 0, 0); + + screen.machine().device("spritegen")->draw_sprites(bitmap, cliprect, state->m_spriteram, state->m_spriteram_size/2); + return 0; +} +