diff options
Diffstat (limited to 'src')
33 files changed, 225 insertions, 256 deletions
diff --git a/src/mame/drivers/backfire.c b/src/mame/drivers/backfire.c index 1c6c0198af7..9897226a1d9 100644 --- a/src/mame/drivers/backfire.c +++ b/src/mame/drivers/backfire.c @@ -97,7 +97,8 @@ public: INTERRUPT_GEN_MEMBER(deco32_vbl_interrupt); void descramble_sound(); DECO16IC_BANK_CB_MEMBER(bank_callback); - + DECOSPR_PRIORITY_CB_MEMBER(pri_callback); + required_ioport m_io_in0; required_ioport m_io_in1; required_ioport m_io_in2; @@ -456,13 +457,9 @@ DECO16IC_BANK_CB_MEMBER(backfire_state::bank_callback) return bank * 0x1000; } -void backfire_state::machine_start() -{ -} - -UINT16 backfire_pri_callback(UINT16 x) +DECOSPR_PRIORITY_CB_MEMBER(backfire_state::pri_callback) { - switch (x & 0xc000) + switch (pri & 0xc000) { case 0x0000: return 0; // numbers, people, cars when in the air, status display.. case 0x4000: return 0xf0; // cars most of the time @@ -472,6 +469,10 @@ UINT16 backfire_pri_callback(UINT16 x) return 0; } +void backfire_state::machine_start() +{ +} + static MACHINE_CONFIG_START( backfire, backfire_state ) /* basic machine hardware */ @@ -539,15 +540,15 @@ static MACHINE_CONFIG_START( backfire, backfire_state ) MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0) MCFG_VIDEO_SET_SCREEN("lscreen") - decospr_device::set_gfx_region(*device, 4); - decospr_device::set_pri_callback(*device, backfire_pri_callback); + MCFG_DECO_SPRITE_GFX_REGION(4) + MCFG_DECO_SPRITE_PRIORITY_CB(backfire_state, pri_callback) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO_SPRITE_PALETTE("palette") MCFG_DEVICE_ADD("spritegen2", DECO_SPRITE, 0) MCFG_VIDEO_SET_SCREEN("rscreen") - decospr_device::set_gfx_region(*device, 5); - decospr_device::set_pri_callback(*device, backfire_pri_callback); + MCFG_DECO_SPRITE_GFX_REGION(5) + MCFG_DECO_SPRITE_PRIORITY_CB(backfire_state, pri_callback) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO_SPRITE_PALETTE("palette") diff --git a/src/mame/drivers/boogwing.c b/src/mame/drivers/boogwing.c index c000d46d9e0..af86f2b07db 100644 --- a/src/mame/drivers/boogwing.c +++ b/src/mame/drivers/boogwing.c @@ -371,12 +371,12 @@ static MACHINE_CONFIG_START( boogwing, boogwing_state ) MCFG_DECO16IC_PALETTE("palette") MCFG_DEVICE_ADD("spritegen1", DECO_SPRITE, 0) - decospr_device::set_gfx_region(*device, 3); + MCFG_DECO_SPRITE_GFX_REGION(3) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO_SPRITE_PALETTE("palette") MCFG_DEVICE_ADD("spritegen2", DECO_SPRITE, 0) - decospr_device::set_gfx_region(*device, 4); + MCFG_DECO_SPRITE_GFX_REGION(4) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO_SPRITE_PALETTE("palette") diff --git a/src/mame/drivers/cbuster.c b/src/mame/drivers/cbuster.c index 2c3aaa15e64..8b43c4270ff 100644 --- a/src/mame/drivers/cbuster.c +++ b/src/mame/drivers/cbuster.c @@ -330,7 +330,7 @@ static MACHINE_CONFIG_START( twocrude, cbuster_state ) MCFG_DECO16IC_PALETTE("palette") MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0) - decospr_device::set_gfx_region(*device, 3); + MCFG_DECO_SPRITE_GFX_REGION(3) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO_SPRITE_PALETTE("palette") diff --git a/src/mame/drivers/cninja.c b/src/mame/drivers/cninja.c index 00c746a23d1..fd632a7dcda 100644 --- a/src/mame/drivers/cninja.c +++ b/src/mame/drivers/cninja.c @@ -808,34 +808,33 @@ DECO16IC_BANK_CB_MEMBER(cninja_state::mutantf_2_bank_callback) } -void cninja_state::machine_start() -{ - save_item(NAME(m_scanline)); - save_item(NAME(m_irq_mask)); -} - -void cninja_state::machine_reset() -{ - m_scanline = 0; - m_irq_mask = 0; -} - - -UINT16 cninja_pri_callback(UINT16 x) +DECOSPR_PRIORITY_CB_MEMBER(cninja_state::pri_callback) { /* Sprite/playfield priority */ - switch (x & 0xc000) + switch (pri & 0xc000) { case 0x0000: return 0; case 0x4000: return 0xf0; case 0x8000: return 0xf0 | 0xcc; case 0xc000: return 0xf0 | 0xcc; /* Perhaps 0xf0|0xcc|0xaa (Sprite under bottom layer) */ } - + return 0; } +void cninja_state::machine_start() +{ + save_item(NAME(m_scanline)); + save_item(NAME(m_irq_mask)); +} + +void cninja_state::machine_reset() +{ + m_scanline = 0; + m_irq_mask = 0; +} + static MACHINE_CONFIG_START( cninja, cninja_state ) /* basic machine hardware */ @@ -896,8 +895,8 @@ static MACHINE_CONFIG_START( cninja, cninja_state ) MCFG_DECO16IC_PALETTE("palette") MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0) - decospr_device::set_gfx_region(*device, 3); - decospr_device::set_pri_callback(*device, cninja_pri_callback); + MCFG_DECO_SPRITE_GFX_REGION(3) + MCFG_DECO_SPRITE_PRIORITY_CB(cninja_state, pri_callback) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO_SPRITE_PALETTE("palette") @@ -986,8 +985,8 @@ static MACHINE_CONFIG_START( stoneage, cninja_state ) MCFG_DECO16IC_PALETTE("palette") MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0) - decospr_device::set_gfx_region(*device, 3); - decospr_device::set_pri_callback(*device, cninja_pri_callback); + MCFG_DECO_SPRITE_GFX_REGION(3) + MCFG_DECO_SPRITE_PRIORITY_CB(cninja_state, pri_callback) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO_SPRITE_PALETTE("palette") @@ -1143,8 +1142,8 @@ static MACHINE_CONFIG_START( edrandy, cninja_state ) MCFG_DECO16IC_PALETTE("palette") MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0) - decospr_device::set_gfx_region(*device, 3); - decospr_device::set_pri_callback(*device, cninja_pri_callback); + MCFG_DECO_SPRITE_GFX_REGION(3) + MCFG_DECO_SPRITE_PRIORITY_CB(cninja_state, pri_callback) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO_SPRITE_PALETTE("palette") @@ -1231,8 +1230,8 @@ static MACHINE_CONFIG_START( robocop2, cninja_state ) MCFG_DECO16IC_PALETTE("palette") MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0) - decospr_device::set_gfx_region(*device, 3); - decospr_device::set_pri_callback(*device, cninja_pri_callback); + MCFG_DECO_SPRITE_GFX_REGION(3) + MCFG_DECO_SPRITE_PRIORITY_CB(cninja_state, pri_callback) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO_SPRITE_PALETTE("palette") @@ -1325,12 +1324,12 @@ static MACHINE_CONFIG_START( mutantf, cninja_state ) MCFG_DECO16IC_PALETTE("palette") MCFG_DEVICE_ADD("spritegen1", DECO_SPRITE, 0) - decospr_device::set_gfx_region(*device, 3); + MCFG_DECO_SPRITE_GFX_REGION(3) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO_SPRITE_PALETTE("palette") MCFG_DEVICE_ADD("spritegen2", DECO_SPRITE, 0) - decospr_device::set_gfx_region(*device, 4); + MCFG_DECO_SPRITE_GFX_REGION(4) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO_SPRITE_PALETTE("palette") diff --git a/src/mame/drivers/crospang.c b/src/mame/drivers/crospang.c index f86b2fa24c2..36477ab754c 100644 --- a/src/mame/drivers/crospang.c +++ b/src/mame/drivers/crospang.c @@ -361,9 +361,9 @@ static MACHINE_CONFIG_START( crospang, crospang_state ) 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); + MCFG_DECO_SPRITE_GFX_REGION(0) + MCFG_DECO_SPRITE_ISBOOTLEG(true) + MCFG_DECO_SPRITE_OFFSETS(5, 7) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO_SPRITE_PALETTE("palette") diff --git a/src/mame/drivers/darkseal.c b/src/mame/drivers/darkseal.c index a1c5aeedda1..63626c11aeb 100644 --- a/src/mame/drivers/darkseal.c +++ b/src/mame/drivers/darkseal.c @@ -273,7 +273,7 @@ static MACHINE_CONFIG_START( darkseal, darkseal_state ) MCFG_DECO16IC_PALETTE("palette") MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0) - decospr_device::set_gfx_region(*device, 4); + MCFG_DECO_SPRITE_GFX_REGION(4) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO_SPRITE_PALETTE("palette") diff --git a/src/mame/drivers/dassault.c b/src/mame/drivers/dassault.c index cdd4152b9f2..d55dc288c72 100644 --- a/src/mame/drivers/dassault.c +++ b/src/mame/drivers/dassault.c @@ -525,12 +525,12 @@ static MACHINE_CONFIG_START( dassault, dassault_state ) MCFG_DECO16IC_PALETTE("palette") MCFG_DEVICE_ADD("spritegen1", DECO_SPRITE, 0) - decospr_device::set_gfx_region(*device, 3); + MCFG_DECO_SPRITE_GFX_REGION(3) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO_SPRITE_PALETTE("palette") MCFG_DEVICE_ADD("spritegen2", DECO_SPRITE, 0) - decospr_device::set_gfx_region(*device, 4); + MCFG_DECO_SPRITE_GFX_REGION(4) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO_SPRITE_PALETTE("palette") diff --git a/src/mame/drivers/dblewing.c b/src/mame/drivers/dblewing.c index a0163feb8e2..a651ab6f2d1 100644 --- a/src/mame/drivers/dblewing.c +++ b/src/mame/drivers/dblewing.c @@ -114,18 +114,13 @@ public: UINT32 screen_update_dblewing(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); DECO16IC_BANK_CB_MEMBER(bank_callback); + DECOSPR_PRIORITY_CB_MEMBER(pri_callback); void dblewing_sound_cb( address_space &space, UINT16 data, UINT16 mem_mask ); READ16_MEMBER( wf_protection_region_0_104_r ); WRITE16_MEMBER( wf_protection_region_0_104_w ); }; -UINT16 dblwings_pri_callback(UINT16 x) -{ - return 0; // sprites always on top? -} - - UINT32 dblewing_state::screen_update_dblewing(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { @@ -337,6 +332,12 @@ DECO16IC_BANK_CB_MEMBER(dblewing_state::bank_callback) return ((bank >> 4) & 0x7) * 0x1000; } +DECOSPR_PRIORITY_CB_MEMBER(dblewing_state::pri_callback) +{ + return 0; // sprites always on top? +} + + void dblewing_state::machine_start() { save_item(NAME(m_sound_irq)); @@ -398,8 +399,8 @@ static MACHINE_CONFIG_START( dblewing, dblewing_state ) MCFG_DECO16IC_PALETTE("palette") MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0) - decospr_device::set_gfx_region(*device, 2); - decospr_device::set_pri_callback(*device, dblwings_pri_callback); + MCFG_DECO_SPRITE_GFX_REGION(2) + MCFG_DECO_SPRITE_PRIORITY_CB(dblewing_state, pri_callback) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO_SPRITE_PALETTE("palette") diff --git a/src/mame/drivers/deco156.c b/src/mame/drivers/deco156.c index 15191b91429..f1afc304757 100644 --- a/src/mame/drivers/deco156.c +++ b/src/mame/drivers/deco156.c @@ -66,6 +66,7 @@ public: void descramble_sound( const char *tag ); DECLARE_WRITE_LINE_MEMBER(sound_irq_gen); DECO16IC_BANK_CB_MEMBER(bank_callback); + DECOSPR_PRIORITY_CB_MEMBER(pri_callback); }; @@ -327,9 +328,9 @@ DECO16IC_BANK_CB_MEMBER(deco156_state::bank_callback) return ((bank >> 4) & 0x7) * 0x1000; } -UINT16 deco156_pri_callback(UINT16 x) +DECOSPR_PRIORITY_CB_MEMBER(deco156_state::pri_callback) { - switch (x & 0xc000) + switch (pri & 0xc000) { case 0x0000: return 0; case 0x4000: return 0xf0; @@ -340,7 +341,6 @@ UINT16 deco156_pri_callback(UINT16 x) return 0; } - static MACHINE_CONFIG_START( hvysmsh, deco156_state ) /* basic machine hardware */ @@ -377,8 +377,8 @@ static MACHINE_CONFIG_START( hvysmsh, deco156_state ) MCFG_DECO16IC_PALETTE("palette") MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0) - decospr_device::set_gfx_region(*device, 2); - decospr_device::set_pri_callback(*device, deco156_pri_callback); + MCFG_DECO_SPRITE_GFX_REGION(2) + MCFG_DECO_SPRITE_PRIORITY_CB(deco156_state, pri_callback) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO_SPRITE_PALETTE("palette") @@ -430,8 +430,8 @@ static MACHINE_CONFIG_START( wcvol95, deco156_state ) MCFG_DECO16IC_PALETTE("palette") MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0) - decospr_device::set_gfx_region(*device, 2); - decospr_device::set_pri_callback(*device, deco156_pri_callback); + MCFG_DECO_SPRITE_GFX_REGION(2) + MCFG_DECO_SPRITE_PRIORITY_CB(deco156_state, pri_callback) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO_SPRITE_PALETTE("palette") diff --git a/src/mame/drivers/deco32.c b/src/mame/drivers/deco32.c index 86a114042e5..a8568b6eb24 100644 --- a/src/mame/drivers/deco32.c +++ b/src/mame/drivers/deco32.c @@ -1645,17 +1645,17 @@ INTERRUPT_GEN_MEMBER(deco32_state::deco32_vbl_interrupt) device.execute().set_input_line(ARM_IRQ_LINE, HOLD_LINE); } -UINT16 captaven_pri_callback(UINT16 x) +DECOSPR_PRIORITY_CB_MEMBER(deco32_state::captaven_pri_callback) { - if ((x&0x60)==0x00) + if ((pri & 0x60) == 0x00) { return 0; // above everything } - else if ((x&0x60)==0x20) + else if ((pri & 0x60) == 0x20) { return 0xfff0; // above the 2nd playfield } - else if ((x&0x60)==0x40) + else if ((pri & 0x60) == 0x40) { return 0xfffc; // above the 1st playfield } @@ -1729,8 +1729,8 @@ static MACHINE_CONFIG_START( captaven, deco32_state ) MCFG_DECO16IC_PALETTE("palette") MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0) - decospr_device::set_gfx_region(*device, 3); - decospr_device::set_pri_callback(*device, captaven_pri_callback); + MCFG_DECO_SPRITE_GFX_REGION(3) + MCFG_DECO_SPRITE_PRIORITY_CB(deco32_state, captaven_pri_callback) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO_SPRITE_PALETTE("palette") @@ -1835,7 +1835,7 @@ static MACHINE_CONFIG_START( fghthist, deco32_state ) /* DE-0380-2 PCB */ MCFG_DECO16IC_PALETTE("palette") MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0) - decospr_device::set_gfx_region(*device, 3); + MCFG_DECO_SPRITE_GFX_REGION(3) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO_SPRITE_PALETTE("palette") @@ -1921,7 +1921,7 @@ static MACHINE_CONFIG_START( fghthsta, deco32_state ) /* DE-0395-1 PCB */ MCFG_DECO16IC_PALETTE("palette") MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0) - decospr_device::set_gfx_region(*device, 3); + MCFG_DECO_SPRITE_GFX_REGION(3) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO_SPRITE_PALETTE("palette") @@ -2225,12 +2225,12 @@ static MACHINE_CONFIG_START( tattass, deco32_state ) MCFG_DECO16IC_PALETTE("palette") MCFG_DEVICE_ADD("spritegen1", DECO_SPRITE, 0) - decospr_device::set_gfx_region(*device, 3); + MCFG_DECO_SPRITE_GFX_REGION(3) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO_SPRITE_PALETTE("palette") MCFG_DEVICE_ADD("spritegen2", DECO_SPRITE, 0) - decospr_device::set_gfx_region(*device, 4); + MCFG_DECO_SPRITE_GFX_REGION(4) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO_SPRITE_PALETTE("palette") @@ -2302,12 +2302,12 @@ static MACHINE_CONFIG_START( nslasher, deco32_state ) MCFG_DECO16IC_PALETTE("palette") MCFG_DEVICE_ADD("spritegen1", DECO_SPRITE, 0) - decospr_device::set_gfx_region(*device, 3); + MCFG_DECO_SPRITE_GFX_REGION(3) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO_SPRITE_PALETTE("palette") MCFG_DEVICE_ADD("spritegen2", DECO_SPRITE, 0) - decospr_device::set_gfx_region(*device, 4); + MCFG_DECO_SPRITE_GFX_REGION(4) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO_SPRITE_PALETTE("palette") diff --git a/src/mame/drivers/dietgo.c b/src/mame/drivers/dietgo.c index b33f265d625..029f1fece3b 100644 --- a/src/mame/drivers/dietgo.c +++ b/src/mame/drivers/dietgo.c @@ -241,7 +241,7 @@ static MACHINE_CONFIG_START( dietgo, dietgo_state ) MCFG_DECO16IC_PALETTE("palette") MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0) - decospr_device::set_gfx_region(*device, 2); + MCFG_DECO_SPRITE_GFX_REGION(2) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO_SPRITE_PALETTE("palette") diff --git a/src/mame/drivers/esd16.c b/src/mame/drivers/esd16.c index a627604d0d5..f377c4e3115 100644 --- a/src/mame/drivers/esd16.c +++ b/src/mame/drivers/esd16.c @@ -592,9 +592,9 @@ void esd16_state::machine_reset() m_tilemap0_color = 0; } -UINT16 esd16_state::hedpanic_pri_callback(UINT16 x) +DECOSPR_PRIORITY_CB_MEMBER(esd16_state::hedpanic_pri_callback) { - if (x & 0x8000) + if (pri & 0x8000) return 0xfffe; // under "tilemap 1" else return 0; // above everything @@ -623,10 +623,10 @@ static MACHINE_CONFIG_START( esd16, esd16_state ) MCFG_SCREEN_PALETTE("palette") 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, esd16_state::hedpanic_pri_callback); - decospr_device::set_flipallx(*device, 1); + MCFG_DECO_SPRITE_GFX_REGION(0) + MCFG_DECO_SPRITE_ISBOOTLEG(true) + MCFG_DECO_SPRITE_PRIORITY_CB(esd16_state, hedpanic_pri_callback) + MCFG_DECO_SPRITE_FLIPALLX(1) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO_SPRITE_PALETTE("palette") @@ -679,7 +679,7 @@ MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( hedpanic, hedpanio ) MCFG_DEVICE_MODIFY("spritegen") - decospr_device::set_offsets(*device, -0x18,-0x100); + MCFG_DECO_SPRITE_OFFSETS(-0x18, -0x100) MACHINE_CONFIG_END /* ESD 08-26-1999 PCBs with different memory maps */ diff --git a/src/mame/drivers/funkyjet.c b/src/mame/drivers/funkyjet.c index 8130e447a56..845337af97e 100644 --- a/src/mame/drivers/funkyjet.c +++ b/src/mame/drivers/funkyjet.c @@ -347,7 +347,7 @@ static MACHINE_CONFIG_START( funkyjet, funkyjet_state ) MCFG_DECO16IC_PALETTE("palette") MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0) - decospr_device::set_gfx_region(*device, 2); + MCFG_DECO_SPRITE_GFX_REGION(2) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO_SPRITE_PALETTE("palette") diff --git a/src/mame/drivers/gotcha.c b/src/mame/drivers/gotcha.c index ed4e1a97746..c34f870ee23 100644 --- a/src/mame/drivers/gotcha.c +++ b/src/mame/drivers/gotcha.c @@ -281,9 +281,9 @@ static MACHINE_CONFIG_START( gotcha, gotcha_state ) MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0) - decospr_device::set_gfx_region(*device, 1); - decospr_device::set_is_bootleg(*device, true); - decospr_device::set_offsets(*device, 5,-1); // aligned to 2nd instruction screen in attract + MCFG_DECO_SPRITE_GFX_REGION(1) + MCFG_DECO_SPRITE_ISBOOTLEG(true) + MCFG_DECO_SPRITE_OFFSETS(5, -1) // aligned to 2nd instruction screen in attract MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO_SPRITE_PALETTE("palette") diff --git a/src/mame/drivers/lemmings.c b/src/mame/drivers/lemmings.c index 608698e4505..12423a7af82 100644 --- a/src/mame/drivers/lemmings.c +++ b/src/mame/drivers/lemmings.c @@ -256,12 +256,12 @@ static MACHINE_CONFIG_START( lemmings, lemmings_state ) MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0) - decospr_device::set_gfx_region(*device, 1); + MCFG_DECO_SPRITE_GFX_REGION(1) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO_SPRITE_PALETTE("palette") MCFG_DEVICE_ADD("spritegen2", DECO_SPRITE, 0) - decospr_device::set_gfx_region(*device, 0); + MCFG_DECO_SPRITE_GFX_REGION(0) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO_SPRITE_PALETTE("palette") diff --git a/src/mame/drivers/mirage.c b/src/mame/drivers/mirage.c index 920c573a6e7..fcb1182b750 100644 --- a/src/mame/drivers/mirage.c +++ b/src/mame/drivers/mirage.c @@ -343,7 +343,7 @@ static MACHINE_CONFIG_START( mirage, miragemi_state ) MCFG_DECO16IC_PALETTE("palette") MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0) - decospr_device::set_gfx_region(*device, 2); + MCFG_DECO_SPRITE_GFX_REGION(2) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO_SPRITE_PALETTE("palette") diff --git a/src/mame/drivers/nmg5.c b/src/mame/drivers/nmg5.c index b66b90c9eae..2007ee84350 100644 --- a/src/mame/drivers/nmg5.c +++ b/src/mame/drivers/nmg5.c @@ -1025,10 +1025,10 @@ static MACHINE_CONFIG_START( nmg5, nmg5_state ) MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR) 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); + MCFG_DECO_SPRITE_GFX_REGION(1) + MCFG_DECO_SPRITE_ISBOOTLEG(true) + MCFG_DECO_SPRITE_FLIPALLX(1) + MCFG_DECO_SPRITE_OFFSETS(0, 8) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO_SPRITE_PALETTE("palette") diff --git a/src/mame/drivers/pktgaldx.c b/src/mame/drivers/pktgaldx.c index da660c714e9..41c1c279cab 100644 --- a/src/mame/drivers/pktgaldx.c +++ b/src/mame/drivers/pktgaldx.c @@ -355,7 +355,7 @@ static MACHINE_CONFIG_START( pktgaldx, pktgaldx_state ) MCFG_DECO16IC_PALETTE("palette") MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0) - decospr_device::set_gfx_region(*device, 2); + MCFG_DECO_SPRITE_GFX_REGION(2) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO_SPRITE_PALETTE("palette") diff --git a/src/mame/drivers/rohga.c b/src/mame/drivers/rohga.c index adce2b1dd9d..b850c389fb5 100644 --- a/src/mame/drivers/rohga.c +++ b/src/mame/drivers/rohga.c @@ -764,6 +764,33 @@ DECO16IC_BANK_CB_MEMBER(rohga_state::bank_callback) return ((bank >> 4) & 0x3) << 12; } +DECOSPR_PRIORITY_CB_MEMBER(rohga_state::rohga_pri_callback) +{ + switch (pri & 0x6000) + { + case 0x0000: return 0; + case 0x4000: return 0xf0; + case 0x6000: return 0xf0 | 0xcc; + case 0x2000: return 0;//0xf0|0xcc; /* Perhaps 0xf0|0xcc|0xaa (Sprite under bottom layer) */ + } + + return 0; +} + +DECOSPR_COLOUR_CB_MEMBER(rohga_state::rohga_col_callback) +{ + return (col >> 9) & 0xf; +} + +DECOSPR_COLOUR_CB_MEMBER(rohga_state::schmeisr_col_callback) +{ + UINT16 colour = ((col >> 9) & 0xf) << 2; + if (col & 0x8000) + colour++; + + return colour; +} + static MACHINE_CONFIG_START( rohga, rohga_state ) /* basic machine hardware */ @@ -788,8 +815,6 @@ static MACHINE_CONFIG_START( rohga, rohga_state ) MCFG_GFXDECODE_ADD("gfxdecode", "palette", rohga) MCFG_PALETTE_ADD("palette", 2048) - MCFG_VIDEO_START_OVERRIDE(rohga_state,rohga) - MCFG_DECOCOMN_ADD("deco_common") MCFG_DECOCOMN_PALETTE("palette") @@ -826,7 +851,9 @@ static MACHINE_CONFIG_START( rohga, rohga_state ) MCFG_DECO16IC_PALETTE("palette") MCFG_DEVICE_ADD("spritegen1", DECO_SPRITE, 0) - decospr_device::set_gfx_region(*device, 3); + MCFG_DECO_SPRITE_PRIORITY_CB(rohga_state, rohga_pri_callback) + MCFG_DECO_SPRITE_COLOUR_CB(rohga_state, rohga_col_callback) + MCFG_DECO_SPRITE_GFX_REGION(3) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO_SPRITE_PALETTE("palette") @@ -910,19 +937,19 @@ static MACHINE_CONFIG_START( wizdfire, rohga_state ) MCFG_DECO16IC_PALETTE("palette") MCFG_DEVICE_ADD("spritegen1", DECO_SPRITE, 0) - decospr_device::set_gfx_region(*device, 3); + MCFG_DECO_SPRITE_GFX_REGION(3) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO_SPRITE_PALETTE("palette") MCFG_DEVICE_ADD("spritegen2", DECO_SPRITE, 0) - decospr_device::set_gfx_region(*device, 4); + MCFG_DECO_SPRITE_GFX_REGION(4) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO_SPRITE_PALETTE("palette") MCFG_DECO104_ADD("ioprot104") MCFG_DECO146_SET_INTERFACE_SCRAMBLE_REVERSE - MCFG_VIDEO_START_OVERRIDE(rohga_state,wizdfire) + MCFG_VIDEO_START_OVERRIDE(rohga_state, wizdfire) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") @@ -1002,16 +1029,16 @@ static MACHINE_CONFIG_START( nitrobal, rohga_state ) MCFG_DECO16IC_PALETTE("palette") MCFG_DEVICE_ADD("spritegen1", DECO_SPRITE, 0) - decospr_device::set_gfx_region(*device, 3); + MCFG_DECO_SPRITE_GFX_REGION(3) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO_SPRITE_PALETTE("palette") MCFG_DEVICE_ADD("spritegen2", DECO_SPRITE, 0) - decospr_device::set_gfx_region(*device, 4); + MCFG_DECO_SPRITE_GFX_REGION(4) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO_SPRITE_PALETTE("palette") - MCFG_VIDEO_START_OVERRIDE(rohga_state,wizdfire) + MCFG_VIDEO_START_OVERRIDE(rohga_state, wizdfire) MCFG_DECO146_ADD("ioprot") MCFG_DECO146_SET_INTERFACE_SCRAMBLE_REVERSE @@ -1060,8 +1087,6 @@ static MACHINE_CONFIG_START( schmeisr, rohga_state ) MCFG_GFXDECODE_ADD("gfxdecode", "palette", schmeisr) MCFG_PALETTE_ADD("palette", 2048) - MCFG_VIDEO_START_OVERRIDE(rohga_state,schmeisr) - MCFG_DECOCOMN_ADD("deco_common") MCFG_DECOCOMN_PALETTE("palette") @@ -1098,7 +1123,9 @@ static MACHINE_CONFIG_START( schmeisr, rohga_state ) MCFG_DECO16IC_PALETTE("palette") MCFG_DEVICE_ADD("spritegen1", DECO_SPRITE, 0) - decospr_device::set_gfx_region(*device, 3); + MCFG_DECO_SPRITE_PRIORITY_CB(rohga_state, rohga_pri_callback) + MCFG_DECO_SPRITE_COLOUR_CB(rohga_state, schmeisr_col_callback) // wire mods on pcb... + MCFG_DECO_SPRITE_GFX_REGION(3) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO_SPRITE_PALETTE("palette") diff --git a/src/mame/drivers/silvmil.c b/src/mame/drivers/silvmil.c index b9e9e4d6897..ff2c0c57796 100644 --- a/src/mame/drivers/silvmil.c +++ b/src/mame/drivers/silvmil.c @@ -329,9 +329,9 @@ static MACHINE_CONFIG_START( silvmil, silvmil_state ) 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); + MCFG_DECO_SPRITE_GFX_REGION(0) + MCFG_DECO_SPRITE_ISBOOTLEG(true) + MCFG_DECO_SPRITE_OFFSETS(5, 7) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO_SPRITE_PALETTE("palette") diff --git a/src/mame/drivers/simpl156.c b/src/mame/drivers/simpl156.c index 839976b6800..684c3f3bcdc 100644 --- a/src/mame/drivers/simpl156.c +++ b/src/mame/drivers/simpl156.c @@ -392,9 +392,9 @@ DECO16IC_BANK_CB_MEMBER(simpl156_state::bank_callback) return ((bank >> 4) & 0x7) * 0x1000; } -UINT16 simpl156_pri_callback(UINT16 x) +DECOSPR_PRIORITY_CB_MEMBER(simpl156_state::pri_callback) { - switch (x & 0xc000) + switch (pri & 0xc000) { case 0x0000: return 0; case 0x4000: return 0xf0; @@ -444,8 +444,8 @@ static MACHINE_CONFIG_START( chainrec, simpl156_state ) MCFG_DECO16IC_PALETTE("palette") MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0) - decospr_device::set_gfx_region(*device, 2); - decospr_device::set_pri_callback(*device, simpl156_pri_callback); + MCFG_DECO_SPRITE_GFX_REGION(2) + MCFG_DECO_SPRITE_PRIORITY_CB(simpl156_state, pri_callback) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO_SPRITE_PALETTE("palette") diff --git a/src/mame/drivers/sshangha.c b/src/mame/drivers/sshangha.c index 75538436c52..1a86ff428a2 100644 --- a/src/mame/drivers/sshangha.c +++ b/src/mame/drivers/sshangha.c @@ -424,12 +424,12 @@ static MACHINE_CONFIG_START( sshangha, sshangha_state ) MCFG_DECO16IC_PALETTE("palette") MCFG_DEVICE_ADD("spritegen1", DECO_SPRITE, 0) - decospr_device::set_gfx_region(*device, 2); + MCFG_DECO_SPRITE_GFX_REGION(2) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO_SPRITE_PALETTE("palette") MCFG_DEVICE_ADD("spritegen2", DECO_SPRITE, 0) - decospr_device::set_gfx_region(*device, 2); + MCFG_DECO_SPRITE_GFX_REGION(2) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO_SPRITE_PALETTE("palette") diff --git a/src/mame/drivers/supbtime.c b/src/mame/drivers/supbtime.c index 0ab95a18c23..8da461ce703 100644 --- a/src/mame/drivers/supbtime.c +++ b/src/mame/drivers/supbtime.c @@ -350,7 +350,7 @@ static MACHINE_CONFIG_START( supbtime, supbtime_state ) MCFG_DECO16IC_PALETTE("palette") MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0) - decospr_device::set_gfx_region(*device, 2); + MCFG_DECO_SPRITE_GFX_REGION(2) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO_SPRITE_PALETTE("palette") @@ -406,7 +406,7 @@ static MACHINE_CONFIG_START( chinatwn, supbtime_state ) MCFG_DECO16IC_PALETTE("palette") MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0) - decospr_device::set_gfx_region(*device, 2); + MCFG_DECO_SPRITE_GFX_REGION(2) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO_SPRITE_PALETTE("palette") diff --git a/src/mame/drivers/tumbleb.c b/src/mame/drivers/tumbleb.c index 7c9a8ebaf30..3bf3db2a0e8 100644 --- a/src/mame/drivers/tumbleb.c +++ b/src/mame/drivers/tumbleb.c @@ -2060,8 +2060,8 @@ static MACHINE_CONFIG_START( tumblepb, tumbleb_state ) MCFG_SCREEN_PALETTE("palette") MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0) - decospr_device::set_gfx_region(*device, 3); - decospr_device::set_is_bootleg(*device, true); + MCFG_DECO_SPRITE_GFX_REGION(3) + MCFG_DECO_SPRITE_ISBOOTLEG(true) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO_SPRITE_PALETTE("palette") @@ -2099,8 +2099,8 @@ static MACHINE_CONFIG_START( tumbleb2, tumbleb_state ) MCFG_SCREEN_PALETTE("palette") MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0) - decospr_device::set_gfx_region(*device, 3); - decospr_device::set_is_bootleg(*device, true); + MCFG_DECO_SPRITE_GFX_REGION(3) + MCFG_DECO_SPRITE_ISBOOTLEG(true) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO_SPRITE_PALETTE("palette") @@ -2141,8 +2141,8 @@ static MACHINE_CONFIG_START( jumpkids, tumbleb_state ) MCFG_SCREEN_PALETTE("palette") MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0) - decospr_device::set_gfx_region(*device, 3); - decospr_device::set_is_bootleg(*device, true); + MCFG_DECO_SPRITE_GFX_REGION(3) + MCFG_DECO_SPRITE_ISBOOTLEG(true) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO_SPRITE_PALETTE("palette") @@ -2179,9 +2179,9 @@ static MACHINE_CONFIG_START( fncywld, tumbleb_state ) MCFG_SCREEN_PALETTE("palette") 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_DECO_SPRITE_GFX_REGION(3) + MCFG_DECO_SPRITE_ISBOOTLEG(true) + MCFG_DECO_SPRITE_TRANSPEN(15) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO_SPRITE_PALETTE("palette") @@ -2240,8 +2240,8 @@ static MACHINE_CONFIG_START( htchctch, tumbleb_state ) MCFG_SCREEN_PALETTE("palette") MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0) - decospr_device::set_gfx_region(*device, 3); - decospr_device::set_is_bootleg(*device, true); + MCFG_DECO_SPRITE_GFX_REGION(3) + MCFG_DECO_SPRITE_ISBOOTLEG(true) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO_SPRITE_PALETTE("palette") @@ -2351,8 +2351,8 @@ static MACHINE_CONFIG_START( suprtrio, tumbleb_state ) MCFG_SCREEN_PALETTE("palette") MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0) - decospr_device::set_gfx_region(*device, 3); - decospr_device::set_is_bootleg(*device, true); + MCFG_DECO_SPRITE_GFX_REGION(3) + MCFG_DECO_SPRITE_ISBOOTLEG(true) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO_SPRITE_PALETTE("palette") @@ -2390,8 +2390,8 @@ static MACHINE_CONFIG_START( pangpang, tumbleb_state ) MCFG_SCREEN_PALETTE("palette") MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0) - decospr_device::set_gfx_region(*device, 3); - decospr_device::set_is_bootleg(*device, true); + MCFG_DECO_SPRITE_GFX_REGION(3) + MCFG_DECO_SPRITE_ISBOOTLEG(true) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO_SPRITE_PALETTE("palette") diff --git a/src/mame/drivers/tumblep.c b/src/mame/drivers/tumblep.c index 4ad0aad6713..c1803eb925d 100644 --- a/src/mame/drivers/tumblep.c +++ b/src/mame/drivers/tumblep.c @@ -314,7 +314,7 @@ static MACHINE_CONFIG_START( tumblep, tumblep_state ) MCFG_DECO16IC_PALETTE("palette") MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0) - decospr_device::set_gfx_region(*device, 2); + MCFG_DECO_SPRITE_GFX_REGION(2) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO_SPRITE_PALETTE("palette") diff --git a/src/mame/includes/cninja.h b/src/mame/includes/cninja.h index 462a917d045..a979f643981 100644 --- a/src/mame/includes/cninja.h +++ b/src/mame/includes/cninja.h @@ -97,6 +97,8 @@ public: DECO16IC_BANK_CB_MEMBER(mutantf_1_bank_callback); DECO16IC_BANK_CB_MEMBER(mutantf_2_bank_callback); + DECOSPR_PRIORITY_CB_MEMBER(pri_callback); + DECLARE_READ16_MEMBER( sshangha_protection_region_6_146_r ); DECLARE_WRITE16_MEMBER( sshangha_protection_region_6_146_w ); DECLARE_READ16_MEMBER( sshangha_protection_region_8_146_r ); diff --git a/src/mame/includes/deco32.h b/src/mame/includes/deco32.h index 289f263c53e..5be8e5904e8 100644 --- a/src/mame/includes/deco32.h +++ b/src/mame/includes/deco32.h @@ -171,6 +171,7 @@ public: DECO16IC_BANK_CB_MEMBER(fghthist_bank_callback); DECO16IC_BANK_CB_MEMBER(captaven_bank_callback); DECO16IC_BANK_CB_MEMBER(tattass_bank_callback); + DECOSPR_PRIORITY_CB_MEMBER(captaven_pri_callback); }; class dragngun_state : public deco32_state diff --git a/src/mame/includes/esd16.h b/src/mame/includes/esd16.h index 09aa316bad0..750f1bfc0ee 100644 --- a/src/mame/includes/esd16.h +++ b/src/mame/includes/esd16.h @@ -69,7 +69,8 @@ public: virtual void machine_reset(); virtual void video_start(); UINT32 screen_update_hedpanic(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - static UINT16 hedpanic_pri_callback(UINT16 x); + DECOSPR_PRIORITY_CB_MEMBER(hedpanic_pri_callback); + required_device<cpu_device> m_maincpu; required_device<cpu_device> m_audiocpu; required_device<gfxdecode_device> m_gfxdecode; diff --git a/src/mame/includes/rohga.h b/src/mame/includes/rohga.h index c081034a9a0..7a3f226caa3 100644 --- a/src/mame/includes/rohga.h +++ b/src/mame/includes/rohga.h @@ -69,21 +69,18 @@ public: DECLARE_DRIVER_INIT(nitrobal); DECLARE_DRIVER_INIT(schmeisr); DECLARE_DRIVER_INIT(rohga); - DECLARE_VIDEO_START(rohga); DECLARE_VIDEO_START(wizdfire); - DECLARE_VIDEO_START(schmeisr); UINT32 screen_update_rohga(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_wizdfire(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); UINT32 screen_update_nitrobal(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); void mixwizdfirelayer(bitmap_rgb32 &bitmap, const rectangle &cliprect, int gfxregion, UINT16 pri, UINT16 primask); DECO16IC_BANK_CB_MEMBER(bank_callback); + DECOSPR_PRIORITY_CB_MEMBER(rohga_pri_callback); + DECOSPR_COLOUR_CB_MEMBER(rohga_col_callback); + DECOSPR_COLOUR_CB_MEMBER(schmeisr_col_callback); READ16_MEMBER( nb_protection_region_0_146_r ); WRITE16_MEMBER( nb_protection_region_0_146_w ); READ16_MEMBER( wf_protection_region_0_104_r ); WRITE16_MEMBER( wf_protection_region_0_104_w ); }; -/*----------- defined in video/rohga.c -----------*/ -UINT16 rohga_pri_callback(UINT16 x); -UINT16 schmeisr_col_callback(UINT16 x); -UINT16 rohga_col_callback(UINT16 x); diff --git a/src/mame/includes/simpl156.h b/src/mame/includes/simpl156.h index 4e65daf5085..1dae6b9ee85 100644 --- a/src/mame/includes/simpl156.h +++ b/src/mame/includes/simpl156.h @@ -39,6 +39,7 @@ public: UINT16 *m_spriteram; size_t m_spriteram_size; DECO16IC_BANK_CB_MEMBER(bank_callback); + DECOSPR_PRIORITY_CB_MEMBER(pri_callback); DECLARE_READ32_MEMBER(simpl156_inputs_read); DECLARE_READ32_MEMBER(simpl156_palette_r); diff --git a/src/mame/video/decospr.c b/src/mame/video/decospr.c index 54805dc1cdf..8cd4b1f5b08 100644 --- a/src/mame/video/decospr.c +++ b/src/mame/video/decospr.c @@ -131,7 +131,7 @@ passing offs+2 which lacks the extra priority bit #include "emu.h" #include "decospr.h" -UINT16 decospr_default_colour_callback(UINT16 col) +DECOSPR_COLOUR_CB_MEMBER(decospr_device::default_col_cb) { return (col >> 9) & 0x1f; } @@ -143,28 +143,12 @@ void decospr_device::set_gfx_region(device_t &device, int gfxregion) // printf("decospr_device::set_gfx_region()\n"); } -void decospr_device::set_pri_callback(device_t &device, decospr_priority_callback_func callback) -{ - decospr_device &dev = downcast<decospr_device &>(device); - dev.m_pricallback = callback; -} - -void decospr_device::set_col_callback(device_t &device, decospr_colour_callback_func callback) -{ - decospr_device &dev = downcast<decospr_device &>(device); - dev.m_colcallback = callback; -} - - - const device_type DECO_SPRITE = &device_creator<decospr_device>; 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, "decospr", __FILE__), device_video_interface(mconfig, *this), m_gfxregion(0), - m_pricallback(NULL), - m_colcallback(decospr_default_colour_callback), m_is_bootleg(false), m_x_offset(0), m_y_offset(0), @@ -173,6 +157,8 @@ decospr_device::decospr_device(const machine_config &mconfig, const char *tag, d m_gfxdecode(*this), m_palette(*this) { + // default color callback + m_col_cb = decospr_col_cb_delegate(FUNC(decospr_device::default_col_cb), this); } //------------------------------------------------- @@ -187,7 +173,9 @@ void decospr_device::static_set_gfxdecode_tag(device_t &device, const char *tag) void decospr_device::device_start() { -// printf("decospr_device::device_start()\n"); + m_pri_cb.bind_relative_to(*owner()); + m_col_cb.bind_relative_to(*owner()); + m_alt_format = 0; m_pixmask = 0xf; m_raw_shift = 4; // set to 8 on tattass / nslashers for the custom mixing (because they have 5bpp sprites, and shifting by 4 isn't good enough) @@ -203,24 +191,13 @@ void decospr_device::alloc_sprite_bitmap() m_screen->register_screen_bitmap(m_sprite_bitmap); } -void decospr_device::set_pri_callback(decospr_priority_callback_func callback) -{ - m_pricallback = callback; -} - -void decospr_device::set_col_callback(decospr_priority_callback_func callback) -{ - m_colcallback = callback; -} - - template<class _BitmapClass> void decospr_device::draw_sprites_common(_BitmapClass &bitmap, const rectangle &cliprect, UINT16* spriteram, int sizewords, bool invert_flip ) { //printf("cliprect %04x, %04x\n", cliprect.min_y, cliprect.max_y); - if (m_sprite_bitmap.valid() && m_pricallback) - fatalerror("m_sprite_bitmap && m_pricallback is invalid\n"); + if (m_sprite_bitmap.valid() && !m_pri_cb.isnull()) + fatalerror("m_sprite_bitmap && m_pri_cb is invalid\n"); if (m_sprite_bitmap.valid()) m_sprite_bitmap.fill(0, cliprect); @@ -234,7 +211,7 @@ void decospr_device::draw_sprites_common(_BitmapClass &bitmap, const rectangle & flipscreen = !flipscreen; - if (m_pricallback) + if (!m_pri_cb.isnull()) { offs = sizewords-4; end = -4; @@ -265,7 +242,7 @@ void decospr_device::draw_sprites_common(_BitmapClass &bitmap, const rectangle & if (!m_sprite_bitmap.valid()) { - colour = m_colcallback(x); + colour = m_col_cb(x); } else { @@ -274,8 +251,8 @@ void decospr_device::draw_sprites_common(_BitmapClass &bitmap, const rectangle & } - if (m_pricallback) - pri = m_pricallback(x); + if (!m_pri_cb.isnull()) + pri = m_pri_cb(x); else pri = 0; @@ -355,7 +332,7 @@ void decospr_device::draw_sprites_common(_BitmapClass &bitmap, const rectangle & { if ((ypos<=cliprect.max_y) && (ypos>=(cliprect.min_y)-16)) { - if (m_pricallback) + if (!m_pri_cb.isnull()) m_gfxdecode->gfx(m_gfxregion)->prio_transpen(bitmap,cliprect, sprite - multi * inc, colour, @@ -374,7 +351,7 @@ void decospr_device::draw_sprites_common(_BitmapClass &bitmap, const rectangle & // double wing uses this flag if (w) { - if (m_pricallback) + if (!m_pri_cb.isnull()) m_gfxdecode->gfx(m_gfxregion)->prio_transpen(bitmap,cliprect, (sprite - multi * inc)-mult2, colour, @@ -423,8 +400,8 @@ void decospr_device::draw_sprites_common(_BitmapClass &bitmap, const rectangle & sprite = spriteram[offs+3] & 0xffff; - if (m_pricallback) - pri = m_pricallback(spriteram[offs+2]&0x00ff); + if (!m_pri_cb.isnull()) + pri = m_pri_cb(spriteram[offs+2]&0x00ff); else pri = 0; @@ -474,7 +451,7 @@ void decospr_device::draw_sprites_common(_BitmapClass &bitmap, const rectangle & { if(!m_sprite_bitmap.valid()) { - if (m_pricallback) + if (!m_pri_cb.isnull()) { ypos = y + mult2 * (h-yy); diff --git a/src/mame/video/decospr.h b/src/mame/video/decospr.h index 3ce8e63e06d..8df47bdb7cd 100644 --- a/src/mame/video/decospr.h +++ b/src/mame/video/decospr.h @@ -1,6 +1,12 @@ -typedef UINT16 (*decospr_priority_callback_func)(UINT16 pri); -typedef UINT16 (*decospr_colour_callback_func)(UINT16 col); +typedef device_delegate<UINT16 (UINT16 pri)> decospr_pri_cb_delegate; +typedef device_delegate<UINT16 (UINT16 col)> decospr_col_cb_delegate; + + +// function definition for a callback +#define DECOSPR_PRIORITY_CB_MEMBER(_name) UINT16 _name(UINT16 pri) +#define DECOSPR_COLOUR_CB_MEMBER(_name) UINT16 _name(UINT16 col) + class decospr_device : public device_t, public device_video_interface @@ -12,15 +18,11 @@ public: static void static_set_gfxdecode_tag(device_t &device, const char *tag); static void static_set_palette_tag(device_t &device, const char *tag); static void set_gfx_region(device_t &device, int gfxregion); - static void set_pri_callback(device_t &device, decospr_priority_callback_func callback); - static void set_col_callback(device_t &device, decospr_colour_callback_func callback); - - static void set_is_bootleg(device_t &device, bool is_bootleg) - { - decospr_device &dev = downcast<decospr_device &>(device); - dev.m_is_bootleg = is_bootleg; - } - + static void set_pri_callback(device_t &device, decospr_pri_cb_delegate callback) { downcast<decospr_device &>(device).m_pri_cb = callback; } + static void set_col_callback(device_t &device, decospr_col_cb_delegate callback) { downcast<decospr_device &>(device).m_col_cb = callback; } + static void set_is_bootleg(device_t &device, bool is_bootleg) { downcast<decospr_device &>(device).m_is_bootleg = is_bootleg; } + static void set_flipallx(device_t &device, int flipallx) { downcast<decospr_device &>(device).m_flipallx = flipallx; } + static void set_transpen(device_t &device, int transpen) { downcast<decospr_device &>(device).m_transpen = transpen; } static void set_offsets(device_t &device, int x_offset, int y_offset) { decospr_device &dev = downcast<decospr_device &>(device); @@ -28,42 +30,24 @@ public: dev.m_y_offset = y_offset; } - static void set_flipallx(device_t &device, int flipallx) - { - decospr_device &dev = downcast<decospr_device &>(device); - dev.m_flipallx = flipallx; - } - - static void set_transpen(device_t &device, int transpen) - { - decospr_device &dev = downcast<decospr_device &>(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); - void set_col_callback(decospr_colour_callback_func callback); - void set_gfxregion(int region) { m_gfxregion = region; }; 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; }; + DECOSPR_PRIORITY_CB_MEMBER(default_col_cb); + protected: virtual void device_start(); virtual void device_reset(); - UINT8 m_gfxregion; - decospr_priority_callback_func m_pricallback; - decospr_colour_callback_func m_colcallback; + UINT8 m_gfxregion; + decospr_pri_cb_delegate m_pri_cb; + decospr_col_cb_delegate m_col_cb; bitmap_ind16 m_sprite_bitmap;// optional sprite bitmap (should be INDEXED16) bool m_alt_format; UINT16 m_pixmask; @@ -84,6 +68,27 @@ private: extern const device_type DECO_SPRITE; +#define MCFG_DECO_SPRITE_GFX_REGION(_region) \ + decospr_device::set_gfx_region(*device, _region); + +#define MCFG_DECO_SPRITE_PRIORITY_CB(_class, _method) \ + decospr_device::set_pri_callback(*device, decospr_pri_cb_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner))); + +#define MCFG_DECO_SPRITE_COLOUR_CB(_class, _method) \ + decospr_device::set_col_callback(*device, decospr_col_cb_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner))); + +#define MCFG_DECO_SPRITE_ISBOOTLEG(_boot) \ + decospr_device::set_is_bootleg(*device, _boot); + +#define MCFG_DECO_SPRITE_FLIPALLX(_flip) \ + decospr_device::set_flipallx(*device, _flip); + +#define MCFG_DECO_SPRITE_TRANSPEN(_pen) \ + decospr_device::set_transpen(*device, _pen); + +#define MCFG_DECO_SPRITE_OFFSETS(_xoffs, _yoffs) \ + decospr_device::set_offsets(*device, _xoffs, _yoffs); + #define MCFG_DECO_SPRITE_GFXDECODE(_gfxtag) \ decospr_device::static_set_gfxdecode_tag(*device, "^" _gfxtag); diff --git a/src/mame/video/rohga.c b/src/mame/video/rohga.c index 948a1df74d9..538036a1719 100644 --- a/src/mame/video/rohga.c +++ b/src/mame/video/rohga.c @@ -15,49 +15,6 @@ WRITE16_MEMBER(rohga_state::rohga_buffer_spriteram16_w) m_spriteram->copy(); } -VIDEO_START_MEMBER(rohga_state,rohga) -{ - m_sprgen1->set_col_callback(rohga_col_callback); - m_sprgen1->set_pri_callback(rohga_pri_callback); -} - -VIDEO_START_MEMBER(rohga_state,schmeisr) -{ - VIDEO_START_CALL_MEMBER( rohga ); - // wire mods on pcb.. - m_sprgen1->set_col_callback(schmeisr_col_callback); -} - - -UINT16 rohga_pri_callback(UINT16 x) -{ - switch (x & 0x6000) - { - case 0x0000: return 0; - case 0x4000: return 0xf0; - case 0x6000: return 0xf0 | 0xcc; - case 0x2000: return 0;//0xf0|0xcc; /* Perhaps 0xf0|0xcc|0xaa (Sprite under bottom layer) */ - } - - return 0; -} - -UINT16 schmeisr_col_callback(UINT16 x) -{ - UINT16 colour = ((x >> 9) & 0xf) << 2; - if (x & 0x8000) - colour++; - - return colour; -} - -UINT16 rohga_col_callback(UINT16 x) -{ - return (x >> 9) & 0xf; -} - - - /******************************************************************************/ UINT32 rohga_state::screen_update_rohga(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |