mirror of
https://github.com/holub/mame
synced 2025-06-02 02:49:44 +03:00
VSystem: This gets us down to a single set of functions for one of the sprite chips, a couple of games still rely on some undesirable behaviour (multiple calls for different priorities) but we're all going through the same code now at least, and those cases can be cleaned up later. From Haze (nw)
This commit is contained in:
parent
be84fb55e2
commit
2b6cd8198a
@ -1654,8 +1654,10 @@ static MACHINE_CONFIG_START( aerofgt, aerofgt_state )
|
||||
MCFG_PALETTE_LENGTH(1024)
|
||||
|
||||
MCFG_DEVICE_ADD("vsystem_spr", VSYSTEM_SPR, 0)
|
||||
MCFG_VSYSTEM_SPR_SET_TILE_INDIRECT( aerofgt_state, aerofgt_tile_callback )
|
||||
MCFG_VSYSTEM_SPR_SET_GFXREGION(2)
|
||||
|
||||
MCFG_VIDEO_START_OVERRIDE(aerofgt_state,aerofgt)
|
||||
MCFG_VIDEO_START_OVERRIDE(aerofgt_state,turbofrc)
|
||||
|
||||
/* sound hardware */
|
||||
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
||||
|
@ -482,6 +482,8 @@ static MACHINE_CONFIG_START( crshrace, crshrace_state )
|
||||
MCFG_PALETTE_LENGTH(2048)
|
||||
|
||||
MCFG_DEVICE_ADD("vsystem_spr", VSYSTEM_SPR, 0)
|
||||
MCFG_VSYSTEM_SPR_SET_TILE_INDIRECT( crshrace_state, crshrace_tile_callback )
|
||||
MCFG_VSYSTEM_SPR_SET_GFXREGION(2)
|
||||
|
||||
MCFG_BUFFERED_SPRITERAM16_ADD("spriteram")
|
||||
MCFG_BUFFERED_SPRITERAM16_ADD("spriteram2")
|
||||
|
@ -547,6 +547,8 @@ static MACHINE_CONFIG_DERIVED( f1gp2, f1gp )
|
||||
|
||||
MCFG_DEVICE_REMOVE("vsystem_spr_old")
|
||||
MCFG_DEVICE_ADD("vsystem_spr", VSYSTEM_SPR, 0)
|
||||
MCFG_VSYSTEM_SPR_SET_TILE_INDIRECT( f1gp_state, f1gp2_tile_callback )
|
||||
MCFG_VSYSTEM_SPR_SET_GFXREGION(1)
|
||||
|
||||
MCFG_DEVICE_REMOVE("k053936")
|
||||
MCFG_K053936_ADD("k053936", f1gp2_k053936_intf)
|
||||
|
@ -561,6 +561,10 @@ static MACHINE_CONFIG_START( gstriker, gstriker_state )
|
||||
MCFG_PALETTE_LENGTH(0x800)
|
||||
|
||||
MCFG_DEVICE_ADD("vsystem_spr", VSYSTEM_SPR, 0)
|
||||
MCFG_VSYSTEM_SPR_SET_GFXREGION(2)
|
||||
MCFG_VSYSTEM_SPR_SET_PALBASE(0x10)
|
||||
MCFG_VSYSTEM_SPR_SET_PALMASK(0x1f)
|
||||
MCFG_VSYSTEM_SPR_SET_TRANSPEN(0)
|
||||
|
||||
MCFG_VIDEO_START_OVERRIDE(gstriker_state,gstriker)
|
||||
|
||||
@ -576,6 +580,10 @@ MACHINE_CONFIG_END
|
||||
|
||||
static MACHINE_CONFIG_DERIVED( twrldc94, gstriker )
|
||||
MCFG_VIDEO_START_OVERRIDE(gstriker_state, twrldc94 )
|
||||
|
||||
MCFG_DEVICE_MODIFY("vsystem_spr")
|
||||
MCFG_VSYSTEM_SPR_SET_PALBASE(0x60)
|
||||
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
|
||||
@ -601,6 +609,8 @@ static MACHINE_CONFIG_START( vgoal, gstriker_state )
|
||||
MCFG_PALETTE_LENGTH(0x2000)
|
||||
|
||||
MCFG_DEVICE_ADD("vsystem_spr", VSYSTEM_SPR, 0)
|
||||
MCFG_VSYSTEM_SPR_SET_GFXREGION(2)
|
||||
MCFG_VSYSTEM_SPR_SET_PALBASE(0x00)
|
||||
|
||||
MCFG_VIDEO_START_OVERRIDE(gstriker_state,vgoalsoc)
|
||||
|
||||
|
@ -397,6 +397,8 @@ static MACHINE_CONFIG_START( inufuku, inufuku_state )
|
||||
MCFG_DEVICE_ADD("vsystem_spr", VSYSTEM_SPR, 0)
|
||||
vsystem_spr_device::set_offsets(*device, 0,1); // reference videos confirm at least the +1 against tilemaps in 3on3dunk (the highscore header text and black box are meant to be 1 pixel misaligned, although there is currently a priority bug there too)
|
||||
vsystem_spr_device::set_pdraw(*device, true);
|
||||
MCFG_VSYSTEM_SPR_SET_TILE_INDIRECT( inufuku_state, inufuku_tile_callback )
|
||||
MCFG_VSYSTEM_SPR_SET_GFXREGION(2)
|
||||
|
||||
MCFG_GFXDECODE(inufuku)
|
||||
MCFG_PALETTE_LENGTH(4096)
|
||||
|
@ -338,6 +338,8 @@ static MACHINE_CONFIG_START( suprslam, suprslam_state )
|
||||
MCFG_PALETTE_LENGTH(0x800)
|
||||
|
||||
MCFG_DEVICE_ADD("vsystem_spr", VSYSTEM_SPR, 0)
|
||||
MCFG_VSYSTEM_SPR_SET_TILE_INDIRECT( suprslam_state, suprslam_tile_callback )
|
||||
MCFG_VSYSTEM_SPR_SET_GFXREGION(1)
|
||||
|
||||
MCFG_K053936_ADD("k053936", suprslam_k053936_intf)
|
||||
|
||||
|
@ -355,6 +355,8 @@ static MACHINE_CONFIG_START( taotaido, taotaido_state )
|
||||
MCFG_PALETTE_LENGTH(0x800)
|
||||
|
||||
MCFG_DEVICE_ADD("vsystem_spr", VSYSTEM_SPR, 0)
|
||||
MCFG_VSYSTEM_SPR_SET_TILE_INDIRECT( taotaido_state, taotaido_tile_callback )
|
||||
MCFG_VSYSTEM_SPR_SET_GFXREGION(0)
|
||||
|
||||
/* sound hardware */
|
||||
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
||||
|
@ -98,7 +98,6 @@ public:
|
||||
DECLARE_VIDEO_START(spinlbrk);
|
||||
DECLARE_VIDEO_START(turbofrc);
|
||||
DECLARE_VIDEO_START(wbbc97);
|
||||
DECLARE_VIDEO_START(aerofgt);
|
||||
UINT32 screen_update_pspikes(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
UINT32 screen_update_spikes91(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
UINT32 screen_update_pspikesb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
|
@ -166,20 +166,6 @@ UINT32 aerofgt_state::aerofgt_tile_callback( UINT32 code )
|
||||
}
|
||||
|
||||
|
||||
VIDEO_START_MEMBER(aerofgt_state,aerofgt)
|
||||
{
|
||||
m_bg1_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(aerofgt_state::get_bg1_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 64);
|
||||
m_bg2_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(aerofgt_state::get_bg2_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 64);
|
||||
|
||||
m_bg2_tilemap->set_transparent_pen(15);
|
||||
|
||||
m_spritepalettebank = 0;
|
||||
m_sprite_gfx = 2;
|
||||
|
||||
aerofgt_register_state_globals(machine());
|
||||
|
||||
vsystem_spr_device::set_tile_indirect_callback(m_spr, vsystem_tile_indirection_delegate(FUNC(aerofgt_state::aerofgt_tile_callback), this)); // can this be moved to the MACHINE_CONFIG?
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -408,13 +394,13 @@ UINT32 aerofgt_state::screen_update_aerofgt(screen_device &screen, bitmap_ind16
|
||||
|
||||
m_bg1_tilemap->draw(bitmap, cliprect, 0, 0);
|
||||
|
||||
m_spr->draw_sprites_aerofght(m_spriteram3, m_spriteram3.bytes(), machine(), bitmap, cliprect, 0);
|
||||
m_spr->draw_sprites_aerofght(m_spriteram3, m_spriteram3.bytes(), machine(), bitmap, cliprect, 1);
|
||||
m_spr->draw_sprites(m_spriteram3, m_spriteram3.bytes(), machine(), bitmap, cliprect, 0x03, 0x00);
|
||||
m_spr->draw_sprites(m_spriteram3, m_spriteram3.bytes(), machine(), bitmap, cliprect, 0x03, 0x01);
|
||||
|
||||
m_bg2_tilemap->draw(bitmap, cliprect, 0, 0);
|
||||
|
||||
m_spr->draw_sprites_aerofght(m_spriteram3, m_spriteram3.bytes(), machine(), bitmap, cliprect, 2);
|
||||
m_spr->draw_sprites_aerofght(m_spriteram3, m_spriteram3.bytes(), machine(), bitmap, cliprect, 3);
|
||||
m_spr->draw_sprites(m_spriteram3, m_spriteram3.bytes(), machine(), bitmap, cliprect, 0x03, 0x02);
|
||||
m_spr->draw_sprites(m_spriteram3, m_spriteram3.bytes(), machine(), bitmap, cliprect, 0x03, 0x03);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,6 @@ void crshrace_state::video_start()
|
||||
m_tilemap1->set_transparent_pen(0x0f);
|
||||
m_tilemap2->set_transparent_pen(0xff);
|
||||
|
||||
vsystem_spr_device::set_tile_indirect_callback(m_spr, vsystem_tile_indirection_delegate(FUNC(crshrace_state::crshrace_tile_callback), this)); // can this be moved to the MACHINE_CONFIG?
|
||||
}
|
||||
|
||||
|
||||
@ -131,7 +130,7 @@ UINT32 crshrace_state::screen_update_crshrace(screen_device &screen, bitmap_ind1
|
||||
switch (m_gfxctrl & 0xfb)
|
||||
{
|
||||
case 0x00: /* high score screen */
|
||||
m_spr->draw_sprites_crshrace(m_spriteram->buffer(), 0x2000, machine(), bitmap, cliprect, m_flipscreen);
|
||||
m_spr->draw_sprites(m_spriteram->buffer(), 0x2000, machine(), bitmap, cliprect);
|
||||
draw_bg(machine(), bitmap, cliprect);
|
||||
draw_fg(machine(), bitmap, cliprect);
|
||||
break;
|
||||
@ -139,7 +138,7 @@ UINT32 crshrace_state::screen_update_crshrace(screen_device &screen, bitmap_ind1
|
||||
case 0x02:
|
||||
draw_bg(machine(), bitmap, cliprect);
|
||||
draw_fg(machine(), bitmap, cliprect);
|
||||
m_spr->draw_sprites_crshrace(m_spriteram->buffer(), 0x2000, machine(), bitmap, cliprect, m_flipscreen);
|
||||
m_spr->draw_sprites(m_spriteram->buffer(), 0x2000, machine(), bitmap, cliprect);
|
||||
break;
|
||||
default:
|
||||
popmessage("gfxctrl = %02x", m_gfxctrl);
|
||||
|
@ -90,7 +90,6 @@ VIDEO_START_MEMBER(f1gp_state,f1gp2)
|
||||
m_fg_tilemap->set_scrolldx(-80, 0);
|
||||
m_fg_tilemap->set_scrolldy(-26, 0);
|
||||
|
||||
vsystem_spr_device::set_tile_indirect_callback(m_spr, vsystem_tile_indirection_delegate(FUNC(f1gp_state::f1gp2_tile_callback), this)); // can this be moved to the MACHINE_CONFIG?
|
||||
}
|
||||
|
||||
|
||||
@ -210,18 +209,18 @@ UINT32 f1gp_state::screen_update_f1gp2(screen_device &screen, bitmap_ind16 &bitm
|
||||
{
|
||||
case 0:
|
||||
k053936_zoom_draw(m_k053936, bitmap, cliprect, m_roz_tilemap, TILEMAP_DRAW_OPAQUE, 0, 1);
|
||||
m_spr->f1gp2_draw_sprites(m_spritelist, m_flipscreen, machine(), bitmap, cliprect);
|
||||
m_spr->draw_sprites(m_spritelist, 0x2000, machine(), bitmap, cliprect);
|
||||
m_fg_tilemap->draw(bitmap, cliprect, 0, 0);
|
||||
break;
|
||||
case 1:
|
||||
k053936_zoom_draw(m_k053936, bitmap, cliprect, m_roz_tilemap, TILEMAP_DRAW_OPAQUE, 0, 1);
|
||||
m_fg_tilemap->draw(bitmap, cliprect, 0, 0);
|
||||
m_spr->f1gp2_draw_sprites(m_spritelist, m_flipscreen, machine(), bitmap, cliprect);
|
||||
m_spr->draw_sprites(m_spritelist, 0x2000, machine(), bitmap, cliprect);
|
||||
break;
|
||||
case 2:
|
||||
m_fg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0);
|
||||
k053936_zoom_draw(m_k053936, bitmap, cliprect, m_roz_tilemap, 0, 0, 1);
|
||||
m_spr->f1gp2_draw_sprites(m_spritelist, m_flipscreen, machine(), bitmap, cliprect);
|
||||
m_spr->draw_sprites(m_spritelist, 0x2000, machine(), bitmap, cliprect);
|
||||
break;
|
||||
#ifdef MAME_DEBUG
|
||||
case 3:
|
||||
|
@ -340,11 +340,11 @@ UINT32 gstriker_state::screen_update_gstriker(screen_device &screen, bitmap_ind1
|
||||
// needs sprite orthogonality
|
||||
MB60553_draw(machine(), 0, bitmap,cliprect, 0);
|
||||
|
||||
m_spr->CG10103_draw(machine(), 0, bitmap, cliprect, 0);
|
||||
m_spr->draw_sprites(m_CG10103_vram, 0x2000, machine(), bitmap, cliprect, 0x2, 0x0);
|
||||
|
||||
VS920A_draw(this, 0, bitmap, cliprect, 0);
|
||||
|
||||
m_spr->CG10103_draw(machine(), 0, bitmap, cliprect, 1);
|
||||
m_spr->draw_sprites(m_CG10103_vram, 0x2000, machine(), bitmap, cliprect, 0x2, 0x2);
|
||||
|
||||
#if 0
|
||||
popmessage("%04x %04x %04x %04x %04x %04x %04x %04x",
|
||||
@ -378,12 +378,6 @@ VIDEO_START_MEMBER(gstriker_state,gstriker)
|
||||
MB60553_set_gfx_region(this, 0, 1);
|
||||
MB60553_set_pal_base(this, 0, 0);
|
||||
MB60553_get_tilemap(this, 0)->set_transparent_pen(0xf);
|
||||
|
||||
// Initialize the sprite generator
|
||||
m_spr->CG10103_set_ram(m_CG10103_vram);
|
||||
m_spr->CG10103_set_gfx_region(2);
|
||||
m_spr->CG10103_set_pal_base(0x10);
|
||||
m_spr->CG10103_set_transpen(0x0);
|
||||
}
|
||||
|
||||
VIDEO_START_MEMBER(gstriker_state,twrldc94)
|
||||
@ -402,12 +396,6 @@ VIDEO_START_MEMBER(gstriker_state,twrldc94)
|
||||
MB60553_set_gfx_region(this, 0, 1);
|
||||
MB60553_set_pal_base(this, 0, 0x50);
|
||||
MB60553_get_tilemap(this, 0)->set_transparent_pen(0xf);
|
||||
|
||||
// Initialize the sprite generator
|
||||
m_spr->CG10103_set_ram(m_CG10103_vram);
|
||||
m_spr->CG10103_set_gfx_region(2);
|
||||
m_spr->CG10103_set_pal_base(0x60);
|
||||
m_spr->CG10103_set_transpen(0x0);
|
||||
}
|
||||
|
||||
VIDEO_START_MEMBER(gstriker_state,vgoalsoc)
|
||||
@ -426,10 +414,4 @@ VIDEO_START_MEMBER(gstriker_state,vgoalsoc)
|
||||
MB60553_set_gfx_region(this, 0, 1);
|
||||
MB60553_set_pal_base(this, 0, 0x20);
|
||||
MB60553_get_tilemap(this, 0)->set_transparent_pen(0xf);
|
||||
|
||||
// Initialize the sprite generator
|
||||
m_spr->CG10103_set_ram(m_CG10103_vram);
|
||||
m_spr->CG10103_set_gfx_region(2);
|
||||
m_spr->CG10103_set_pal_base(0x00);
|
||||
m_spr->CG10103_set_transpen(0xf);
|
||||
}
|
||||
|
@ -126,7 +126,6 @@ void inufuku_state::video_start()
|
||||
|
||||
m_spriteram1_old = auto_alloc_array_clear(machine(), UINT16, m_spriteram1.bytes()/2);
|
||||
|
||||
vsystem_spr_device::set_tile_indirect_callback(m_spr, vsystem_tile_indirection_delegate(FUNC(inufuku_state::inufuku_tile_callback), this)); // can this be moved to the MACHINE_CONFIG?
|
||||
}
|
||||
|
||||
|
||||
@ -161,7 +160,7 @@ UINT32 inufuku_state::screen_update_inufuku(screen_device &screen, bitmap_ind16
|
||||
m_tx_tilemap->set_scrolly(0, m_tx_scrolly);
|
||||
m_tx_tilemap->draw(bitmap, cliprect, 0, 4);
|
||||
|
||||
m_spr->draw_sprites_inufuku( m_spriteram1_old, m_spriteram1.bytes(), machine(), bitmap, cliprect );
|
||||
m_spr->draw_sprites( m_spriteram1_old, m_spriteram1.bytes(), machine(), bitmap, cliprect );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -62,8 +62,6 @@ void suprslam_state::video_start()
|
||||
m_screen_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(suprslam_state::get_suprslam_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
|
||||
|
||||
m_screen_tilemap->set_transparent_pen(15);
|
||||
|
||||
vsystem_spr_device::set_tile_indirect_callback(m_spr, vsystem_tile_indirection_delegate(FUNC(suprslam_state::suprslam_tile_callback), this)); // can this be moved to the MACHINE_CONFIG?
|
||||
}
|
||||
|
||||
UINT32 suprslam_state::screen_update_suprslam(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
@ -73,10 +71,10 @@ UINT32 suprslam_state::screen_update_suprslam(screen_device &screen, bitmap_ind1
|
||||
bitmap.fill(get_black_pen(machine()), cliprect);
|
||||
k053936_zoom_draw(m_k053936, bitmap, cliprect, m_bg_tilemap, 0, 0, 1);
|
||||
if(!(m_spr_ctrl[0] & 8))
|
||||
m_spr->draw_sprites_suprslam(m_spriteram, m_spriteram.bytes(), machine(), bitmap, cliprect);
|
||||
m_spr->draw_sprites(m_spriteram, m_spriteram.bytes(), machine(), bitmap, cliprect);
|
||||
m_screen_tilemap->draw(bitmap, cliprect, 0, 0);
|
||||
if(m_spr_ctrl[0] & 8)
|
||||
m_spr->draw_sprites_suprslam(m_spriteram, m_spriteram.bytes(), machine(), bitmap, cliprect);
|
||||
m_spr->draw_sprites(m_spriteram, m_spriteram.bytes(), machine(), bitmap, cliprect);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,6 @@ void taotaido_state::video_start()
|
||||
m_spriteram2_old = auto_alloc_array(machine(), UINT16, 0x10000/2);
|
||||
m_spriteram2_older = auto_alloc_array(machine(), UINT16, 0x10000/2);
|
||||
|
||||
vsystem_spr_device::set_tile_indirect_callback(m_spr, vsystem_tile_indirection_delegate(FUNC(taotaido_state::taotaido_tile_callback), this)); // can this be moved to the MACHINE_CONFIG?
|
||||
}
|
||||
|
||||
|
||||
@ -131,7 +130,7 @@ UINT32 taotaido_state::screen_update_taotaido(screen_device &screen, bitmap_ind1
|
||||
m_bg_tilemap->draw(bitmap, clip, 0,0);
|
||||
}
|
||||
|
||||
m_spr->draw_sprites_taotaido(m_spriteram_older, m_spriteram.bytes(), machine(), bitmap,cliprect);
|
||||
m_spr->draw_sprites(m_spriteram_older, m_spriteram.bytes(), machine(), bitmap,cliprect);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
// Video System Sprites
|
||||
// todo:
|
||||
// unify these functions (secondary stage lookup differs between games, use callback)
|
||||
// update drivers which call multiple priority passes to use the pdrawgfx version (aerofgt, gstriker)
|
||||
|
||||
// according to gstriker this is probably the Fujitsu CG10103
|
||||
|
||||
@ -77,6 +77,8 @@ vsystem_spr_device::vsystem_spr_device(const machine_config &mconfig, const char
|
||||
m_xoffs = 0;
|
||||
m_yoffs = 0;
|
||||
m_pdraw = false;
|
||||
m_gfx_region = -1;
|
||||
m_pal_mask = 0x3f;
|
||||
|
||||
m_newtilecb = vsystem_tile_indirection_delegate(FUNC(vsystem_spr_device::tile_callback_noindirect), this);
|
||||
}
|
||||
@ -88,7 +90,7 @@ UINT32 vsystem_spr_device::tile_callback_noindirect(UINT32 tile)
|
||||
|
||||
|
||||
// static
|
||||
void vsystem_spr_device::set_tile_indirect_callback(device_t &device,vsystem_tile_indirection_delegate newtilecb)
|
||||
void vsystem_spr_device::set_tile_indirect_cb(device_t &device,vsystem_tile_indirection_delegate newtilecb)
|
||||
{
|
||||
vsystem_spr_device &dev = downcast<vsystem_spr_device &>(device);
|
||||
dev.m_newtilecb = newtilecb;
|
||||
@ -110,9 +112,39 @@ void vsystem_spr_device::set_pdraw(device_t &device, bool pdraw)
|
||||
dev.m_pdraw = pdraw;
|
||||
}
|
||||
|
||||
// static
|
||||
void vsystem_spr_device::CG10103_set_gfx_region(device_t &device, int gfx_region)
|
||||
{
|
||||
vsystem_spr_device &dev = downcast<vsystem_spr_device &>(device);
|
||||
dev.m_gfx_region = gfx_region;
|
||||
}
|
||||
|
||||
// static
|
||||
void vsystem_spr_device::CG10103_set_pal_base(device_t &device, int pal_base)
|
||||
{
|
||||
vsystem_spr_device &dev = downcast<vsystem_spr_device &>(device);
|
||||
dev.m_pal_base = pal_base;
|
||||
}
|
||||
|
||||
// static
|
||||
void vsystem_spr_device::set_pal_mask(device_t &device, int pal_mask)
|
||||
{
|
||||
vsystem_spr_device &dev = downcast<vsystem_spr_device &>(device);
|
||||
dev.m_pal_mask = pal_mask;
|
||||
}
|
||||
|
||||
// static
|
||||
void vsystem_spr_device::CG10103_set_transpen(device_t &device, int transpen)
|
||||
{
|
||||
vsystem_spr_device &dev = downcast<vsystem_spr_device &>(device);
|
||||
dev.m_transpen = transpen;
|
||||
}
|
||||
|
||||
|
||||
void vsystem_spr_device::device_start()
|
||||
{
|
||||
|
||||
// bind our handler
|
||||
m_newtilecb.bind_relative_to(*owner());
|
||||
}
|
||||
|
||||
void vsystem_spr_device::device_reset()
|
||||
@ -162,9 +194,9 @@ void vsystem_spr_device::get_sprite_attributes(UINT16* ram)
|
||||
}
|
||||
|
||||
|
||||
void vsystem_spr_device::common_sprite_drawgfx(int gfxrgn, running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
void vsystem_spr_device::common_sprite_drawgfx( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
gfx_element *gfx = machine.gfx[gfxrgn];
|
||||
gfx_element *gfx = machine.gfx[m_gfx_region];
|
||||
int priority_mask = 0x00;
|
||||
|
||||
curr_sprite.oy += m_yoffs;
|
||||
@ -225,18 +257,36 @@ void vsystem_spr_device::common_sprite_drawgfx(int gfxrgn, running_machine &mach
|
||||
|
||||
|
||||
|
||||
void vsystem_spr_device::draw_sprites_inufuku( UINT16* spriteram, int spriteram_bytes, running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
|
||||
void vsystem_spr_device::draw_sprites( UINT16* spriteram, int spriteram_bytes, running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int prihack_mask, int prihack_val )
|
||||
{
|
||||
int offs;
|
||||
int end = 0;
|
||||
|
||||
// find the end of the list
|
||||
for (offs = 0; offs < (spriteram_bytes / 16 ); offs++)
|
||||
{
|
||||
if (spriteram[offs] & 0x4000) break;
|
||||
}
|
||||
end = offs;
|
||||
|
||||
for (offs = end - 1; offs >= 0; offs--)
|
||||
// decide our drawing order (if we're using pdrawgfx we must go in reverse)
|
||||
int first, last, inc;
|
||||
if (m_pdraw)
|
||||
{
|
||||
first = end - 1;
|
||||
last = -1;
|
||||
inc = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
first = 0;
|
||||
last = end;
|
||||
inc = 1;
|
||||
}
|
||||
|
||||
// draw
|
||||
offs = first;
|
||||
while (offs != last)
|
||||
{
|
||||
if ((spriteram[offs] & 0x8000) == 0x0000)
|
||||
{
|
||||
@ -246,195 +296,24 @@ void vsystem_spr_device::draw_sprites_inufuku( UINT16* spriteram, int spriteram_
|
||||
|
||||
get_sprite_attributes(&spriteram[attr_start]);
|
||||
|
||||
curr_sprite.map &= 0x7fff;
|
||||
curr_sprite.color &= m_pal_mask;
|
||||
|
||||
common_sprite_drawgfx(2, machine, bitmap, cliprect);
|
||||
// hack for aero fighters and other which still call us multiple times with different priorities instead of using the pdrawgfx version
|
||||
if (prihack_mask != -1)
|
||||
{
|
||||
if ((curr_sprite.pri & prihack_mask) == prihack_val)
|
||||
common_sprite_drawgfx(machine, bitmap, cliprect);
|
||||
}
|
||||
else
|
||||
{
|
||||
common_sprite_drawgfx(machine, bitmap, cliprect);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void vsystem_spr_device::draw_sprites_suprslam( UINT16* spriteram, int spriteram_bytes, running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
|
||||
{
|
||||
UINT16 *source = spriteram;
|
||||
UINT16 *source2 = spriteram;
|
||||
UINT16 *finish = source + 0x2000/2;
|
||||
|
||||
while (source < finish)
|
||||
{
|
||||
UINT32 sprnum = source[0] & 0x03ff;
|
||||
if (source[0] == 0x4000) break;
|
||||
sprnum *= 4;
|
||||
source++;
|
||||
|
||||
|
||||
get_sprite_attributes(&source2[sprnum]);
|
||||
|
||||
curr_sprite.map &= 0x7fff;
|
||||
|
||||
common_sprite_drawgfx(1, machine, bitmap, cliprect);
|
||||
offs+=inc;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void vsystem_spr_device::draw_sprite_taotaido( UINT16* spriteram, int spriteram_bytes, running_machine &machine, UINT16 spriteno, bitmap_ind16 &bitmap, const rectangle &cliprect )
|
||||
{
|
||||
UINT16 *source = &spriteram[spriteno*4];
|
||||
|
||||
get_sprite_attributes(&source[0]);
|
||||
|
||||
curr_sprite.map &= 0xffff;
|
||||
curr_sprite.color &= 0x1f;
|
||||
|
||||
common_sprite_drawgfx(0, machine, bitmap, cliprect);
|
||||
}
|
||||
|
||||
void vsystem_spr_device::draw_sprites_taotaido( UINT16* spriteram, int spriteram_bytes, running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
|
||||
{
|
||||
UINT16 *source = spriteram;
|
||||
UINT16 *finish = spriteram + spriteram_bytes/2;
|
||||
|
||||
while( source<finish )
|
||||
{
|
||||
if (source[0] == 0x4000) break;
|
||||
|
||||
draw_sprite_taotaido(spriteram, spriteram_bytes, machine, source[0]&0x3ff, bitmap, cliprect);
|
||||
|
||||
source++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void vsystem_spr_device::draw_sprites_crshrace(UINT16* spriteram, int spriteram_bytes, running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect, int flipscreen)
|
||||
{
|
||||
int offs;
|
||||
|
||||
offs = 0;
|
||||
while (offs < 0x0400 && (spriteram[offs] & 0x4000) == 0)
|
||||
{
|
||||
int attr_start;
|
||||
|
||||
attr_start = 4 * (spriteram[offs++] & 0x03ff);
|
||||
|
||||
get_sprite_attributes(&spriteram[attr_start]);
|
||||
|
||||
curr_sprite.color &= 0x1f;
|
||||
curr_sprite.map &= 0x7fff;
|
||||
|
||||
common_sprite_drawgfx(2, machine, bitmap, cliprect);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void vsystem_spr_device::draw_sprites_aerofght( UINT16* spriteram3, int spriteram_bytes, running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int pri )
|
||||
{
|
||||
int offs;
|
||||
pri <<= 12;
|
||||
|
||||
offs = 0;
|
||||
while (offs < 0x0400 && (spriteram3[offs] & 0x8000) == 0)
|
||||
{
|
||||
int attr_start = 4 * (spriteram3[offs] & 0x03ff);
|
||||
|
||||
/* is the way I handle pri correct? Or should I just check bit 13? */
|
||||
if ((spriteram3[attr_start + 2] & 0x3000) == pri)
|
||||
{
|
||||
get_sprite_attributes(&spriteram3[attr_start]);
|
||||
|
||||
curr_sprite.color &=0x1f;
|
||||
curr_sprite.map &= 0x3fff;
|
||||
|
||||
common_sprite_drawgfx(2, machine, bitmap, cliprect);
|
||||
|
||||
}
|
||||
offs++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void vsystem_spr_device::f1gp2_draw_sprites(UINT16* spritelist, int flipscreen, running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
|
||||
{
|
||||
int offs;
|
||||
|
||||
offs = 0;
|
||||
while (offs < 0x0400 && (spritelist[offs] & 0x4000) == 0)
|
||||
{
|
||||
int attr_start;
|
||||
|
||||
attr_start = 4 * (spritelist[offs++] & 0x01ff);
|
||||
|
||||
get_sprite_attributes(&spritelist[attr_start]);
|
||||
|
||||
curr_sprite.color &= 0x1f;
|
||||
curr_sprite.map &= 0x7fff;
|
||||
|
||||
common_sprite_drawgfx(1, machine, bitmap, cliprect);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void vsystem_spr_device::CG10103_draw_sprite(running_machine &machine, bitmap_ind16& bitmap, const rectangle &cliprect, UINT16* spr, int drawpri)
|
||||
{
|
||||
get_sprite_attributes(&spr[0]);
|
||||
curr_sprite.color &=0x1f;
|
||||
curr_sprite.pri >>= 1;
|
||||
|
||||
// Check if we want to draw this sprite now
|
||||
if (curr_sprite.pri != drawpri)
|
||||
return;
|
||||
|
||||
common_sprite_drawgfx(m_gfx_region, machine, bitmap, cliprect);
|
||||
}
|
||||
|
||||
|
||||
void vsystem_spr_device::CG10103_draw(running_machine &machine, int numchip, bitmap_ind16& screen, const rectangle &cliprect, int pri)
|
||||
{
|
||||
UINT16* splist;
|
||||
int i;
|
||||
|
||||
splist = m_vram;
|
||||
|
||||
// Parse the sorting list
|
||||
for (i=0;i<0x400;i++)
|
||||
{
|
||||
UINT16 cmd = *splist++;
|
||||
|
||||
// End of list
|
||||
if (cmd & 0x4000)
|
||||
break;
|
||||
|
||||
if (!(cmd & 0x8000))
|
||||
{
|
||||
// Extract sprite index
|
||||
int num = cmd & 0x3FF;
|
||||
|
||||
// Draw the sprite
|
||||
CG10103_draw_sprite(machine, screen, cliprect, m_vram + num*4, pri);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void vsystem_spr_device::CG10103_set_pal_base(int pal_base)
|
||||
{
|
||||
m_pal_base = pal_base;
|
||||
}
|
||||
|
||||
void vsystem_spr_device::CG10103_set_gfx_region(int gfx_region)
|
||||
{
|
||||
m_gfx_region = gfx_region;
|
||||
}
|
||||
|
||||
void vsystem_spr_device::CG10103_set_transpen(int transpen)
|
||||
{
|
||||
m_transpen = transpen;
|
||||
}
|
||||
|
||||
void vsystem_spr_device::CG10103_set_ram(UINT16* vram)
|
||||
{
|
||||
m_vram = vram;
|
||||
}
|
||||
|
@ -1,7 +1,23 @@
|
||||
// Video System Sprites
|
||||
|
||||
|
||||
typedef delegate<UINT32 (UINT32)> vsystem_tile_indirection_delegate;
|
||||
typedef device_delegate<UINT32 (UINT32)> vsystem_tile_indirection_delegate;
|
||||
|
||||
#define MCFG_VSYSTEM_SPR_SET_TILE_INDIRECT( _class, _method) \
|
||||
vsystem_spr_device::set_tile_indirect_cb(*device, vsystem_tile_indirection_delegate(&_class::_method, #_class "::" #_method, NULL, (_class *)0)); \
|
||||
|
||||
#define MCFG_VSYSTEM_SPR_SET_GFXREGION( _rgn ) \
|
||||
vsystem_spr_device::CG10103_set_gfx_region(*device, _rgn); \
|
||||
|
||||
#define MCFG_VSYSTEM_SPR_SET_PALBASE( _palbase ) \
|
||||
vsystem_spr_device::CG10103_set_pal_base(*device, _palbase); \
|
||||
|
||||
#define MCFG_VSYSTEM_SPR_SET_PALMASK( _palmask ) \
|
||||
vsystem_spr_device::set_pal_mask(*device, _palmask); \
|
||||
|
||||
#define MCFG_VSYSTEM_SPR_SET_TRANSPEN( _transpen ) \
|
||||
vsystem_spr_device::CG10103_set_transpen(*device, _transpen); \
|
||||
|
||||
|
||||
/*** CG10103 **********************************************/
|
||||
|
||||
@ -12,7 +28,11 @@ public:
|
||||
|
||||
static void set_offsets(device_t &device, int xoffs, int yoffs);
|
||||
static void set_pdraw(device_t &device, bool pdraw);
|
||||
static void set_tile_indirect_callback(device_t &device,vsystem_tile_indirection_delegate newtilecb);
|
||||
static void set_tile_indirect_cb(device_t &device,vsystem_tile_indirection_delegate newtilecb);
|
||||
static void CG10103_set_gfx_region(device_t &device, int gfx_region);
|
||||
static void CG10103_set_pal_base(device_t &device, int pal_base);
|
||||
static void set_pal_mask(device_t &device, int pal_mask);
|
||||
static void CG10103_set_transpen(device_t &device, int transpen);
|
||||
|
||||
UINT32 tile_callback_noindirect(UINT32 tile);
|
||||
vsystem_tile_indirection_delegate m_newtilecb;
|
||||
@ -22,6 +42,7 @@ public:
|
||||
|
||||
UINT16* m_vram;
|
||||
UINT16 m_pal_base;
|
||||
UINT16 m_pal_mask;
|
||||
UINT8 m_gfx_region;
|
||||
UINT8 m_transpen;
|
||||
|
||||
@ -41,22 +62,10 @@ public:
|
||||
} curr_sprite;
|
||||
|
||||
void get_sprite_attributes(UINT16* ram);
|
||||
void common_sprite_drawgfx(int gfxrgn, running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
void common_sprite_drawgfx(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
|
||||
void draw_sprites_inufuku( UINT16* spriteram, int spriteram_bytes, running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect );
|
||||
void draw_sprites_suprslam( UINT16* spriteram, int spriteram_bytes, running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect );
|
||||
void draw_sprite_taotaido( UINT16* spriteram, int spriteram_bytes, running_machine &machine, UINT16 spriteno, bitmap_ind16 &bitmap, const rectangle &cliprect );
|
||||
void draw_sprites_taotaido( UINT16* spriteram, int spriteram_bytes, running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect );
|
||||
void draw_sprites_crshrace( UINT16* spriteram, int spriteram_bytes, running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect, int flipscreen);
|
||||
void draw_sprites_aerofght( UINT16* spriteram3, int spriteram_bytes, running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int priority );
|
||||
void f1gp2_draw_sprites(UINT16* spritelist, int flipscreen, running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect );
|
||||
void draw_sprites( UINT16* spriteram, int spriteram_bytes, running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int prihack_mask = -1, int prihack_val = -1 );
|
||||
|
||||
void CG10103_draw_sprite(running_machine &machine, bitmap_ind16& screen, const rectangle &cliprect, UINT16* spr, int drawpri);
|
||||
void CG10103_draw(running_machine &machine, int numchip, bitmap_ind16& screen, const rectangle &cliprect, int priority);
|
||||
void CG10103_set_pal_base(int pal_base);
|
||||
void CG10103_set_gfx_region(int gfx_region);
|
||||
void CG10103_set_transpen(int transpen);
|
||||
void CG10103_set_ram(UINT16* vram);
|
||||
|
||||
protected:
|
||||
virtual void device_start();
|
||||
|
Loading…
Reference in New Issue
Block a user