From a02ae653e051743dd5d4fe6f7319045492da722a Mon Sep 17 00:00:00 2001 From: Scott Stone Date: Mon, 15 Oct 2012 12:09:31 +0000 Subject: [PATCH] Video System 14/10/12 - Moved the per-game tile indirections into game states. From Haze (nw) --- src/mame/drivers/aerofgt.c | 2 +- src/mame/drivers/taotaido.c | 2 + src/mame/includes/aerofgt.h | 2 + src/mame/includes/crshrace.h | 1 + src/mame/includes/f1gp.h | 1 + src/mame/includes/inufuku.h | 1 + src/mame/includes/suprslam.h | 3 +- src/mame/includes/taotaido.h | 1 + src/mame/video/aerofgt.c | 35 +++++++++++++-- src/mame/video/crshrace.c | 13 +++++- src/mame/video/f1gp.c | 17 +++++-- src/mame/video/inufuku.c | 16 ++++--- src/mame/video/suprslam.c | 13 +++++- src/mame/video/taotaido.c | 20 ++++++++- src/mame/video/vsystem_spr.c | 87 ++++++++++++++---------------------- src/mame/video/vsystem_spr.h | 24 +++++----- 16 files changed, 152 insertions(+), 86 deletions(-) diff --git a/src/mame/drivers/aerofgt.c b/src/mame/drivers/aerofgt.c index 9f2775c51a1..6436d6587d7 100644 --- a/src/mame/drivers/aerofgt.c +++ b/src/mame/drivers/aerofgt.c @@ -1655,7 +1655,7 @@ static MACHINE_CONFIG_START( aerofgt, aerofgt_state ) MCFG_DEVICE_ADD("vsystem_spr", VSYSTEM_SPR, 0) - MCFG_VIDEO_START_OVERRIDE(aerofgt_state,turbofrc) + MCFG_VIDEO_START_OVERRIDE(aerofgt_state,aerofgt) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") diff --git a/src/mame/drivers/taotaido.c b/src/mame/drivers/taotaido.c index cabf63f05b8..a01214e319b 100644 --- a/src/mame/drivers/taotaido.c +++ b/src/mame/drivers/taotaido.c @@ -330,6 +330,8 @@ static const ym2610_interface ym2610_config = irqhandler }; + + static MACHINE_CONFIG_START( taotaido, taotaido_state ) MCFG_CPU_ADD("maincpu", M68000, 32000000/2) MCFG_CPU_PROGRAM_MAP(main_map) diff --git a/src/mame/includes/aerofgt.h b/src/mame/includes/aerofgt.h index d9a3ee3286a..e0a20d61e99 100644 --- a/src/mame/includes/aerofgt.h +++ b/src/mame/includes/aerofgt.h @@ -50,6 +50,7 @@ public: int m_spritepalettebank; int m_sprite_gfx; int m_spikes91_lookup; + UINT32 aerofgt_tile_callback( UINT32 code ); /* misc */ int m_pending_command; @@ -97,6 +98,7 @@ 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); diff --git a/src/mame/includes/crshrace.h b/src/mame/includes/crshrace.h index d5fce0310cf..25a22631b09 100644 --- a/src/mame/includes/crshrace.h +++ b/src/mame/includes/crshrace.h @@ -33,6 +33,7 @@ public: int m_roz_bank; int m_gfxctrl; int m_flipscreen; + UINT32 crshrace_tile_callback( UINT32 code ); /* misc */ int m_pending_command; diff --git a/src/mame/includes/f1gp.h b/src/mame/includes/f1gp.h index 413b3877e4b..2728295534b 100644 --- a/src/mame/includes/f1gp.h +++ b/src/mame/includes/f1gp.h @@ -53,6 +53,7 @@ public: int m_flipscreen; int m_gfxctrl; int m_scroll[2]; + UINT32 f1gp2_tile_callback( UINT32 code ); /* misc */ int m_pending_command; diff --git a/src/mame/includes/inufuku.h b/src/mame/includes/inufuku.h index d31be82a4d9..eb5f142ad2e 100644 --- a/src/mame/includes/inufuku.h +++ b/src/mame/includes/inufuku.h @@ -32,6 +32,7 @@ public: int m_bg_palettebank; int m_tx_palettebank; UINT16* m_spriteram1_old; + UINT32 inufuku_tile_callback( UINT32 code ); /* misc */ UINT16 m_pending_command; diff --git a/src/mame/includes/suprslam.h b/src/mame/includes/suprslam.h index f4fa713eeeb..98b52633ea5 100644 --- a/src/mame/includes/suprslam.h +++ b/src/mame/includes/suprslam.h @@ -33,7 +33,8 @@ public: tilemap_t *m_bg_tilemap; UINT16 m_screen_bank; UINT16 m_bg_bank; - + UINT32 suprslam_tile_callback( UINT32 code ); + /* misc */ int m_pending_command; diff --git a/src/mame/includes/taotaido.h b/src/mame/includes/taotaido.h index 0739f6e7a5e..de97a2f35cd 100644 --- a/src/mame/includes/taotaido.h +++ b/src/mame/includes/taotaido.h @@ -17,6 +17,7 @@ public: required_shared_ptr m_bgram; required_device m_spr; + UINT32 taotaido_tile_callback( UINT32 code ); UINT16 m_sprite_character_bank_select[8]; UINT16 m_video_bank_select[8]; tilemap_t *m_bg_tilemap; diff --git a/src/mame/video/aerofgt.c b/src/mame/video/aerofgt.c index 937107377b2..ee0dc1f7f31 100644 --- a/src/mame/video/aerofgt.c +++ b/src/mame/video/aerofgt.c @@ -78,6 +78,8 @@ TILE_GET_INFO_MEMBER(aerofgt_state::get_bg2_tile_info) ***************************************************************************/ + + static void aerofgt_register_state_globals( running_machine &machine ) { aerofgt_state *state = machine.driver_data(); @@ -157,6 +159,31 @@ VIDEO_START_MEMBER(aerofgt_state,turbofrc) } + +UINT32 aerofgt_state::aerofgt_tile_callback( UINT32 code ) +{ + return m_spriteram1[code&0x7fff]; +} + + +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? +} + + + + /*************************************************************************** Memory handlers @@ -381,13 +408,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(), m_spriteram1, m_spriteram2, machine(), bitmap, cliprect, 0); - m_spr->draw_sprites_aerofght(m_spriteram3, m_spriteram3.bytes(), m_spriteram1, m_spriteram2, machine(), bitmap, cliprect, 1); + 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_bg2_tilemap->draw(bitmap, cliprect, 0, 0); - m_spr->draw_sprites_aerofght(m_spriteram3, m_spriteram3.bytes(), m_spriteram1, m_spriteram2, machine(), bitmap, cliprect, 2); - m_spr->draw_sprites_aerofght(m_spriteram3, m_spriteram3.bytes(), m_spriteram1, m_spriteram2, machine(), bitmap, cliprect, 3); + 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); return 0; } diff --git a/src/mame/video/crshrace.c b/src/mame/video/crshrace.c index 839609bcc8b..193d16948a0 100644 --- a/src/mame/video/crshrace.c +++ b/src/mame/video/crshrace.c @@ -30,6 +30,13 @@ TILE_GET_INFO_MEMBER(crshrace_state::get_tile_info2) ***************************************************************************/ + +UINT32 crshrace_state::crshrace_tile_callback( UINT32 code ) +{ + return m_spriteram2->buffer()[code&0x7fff]; +} + + void crshrace_state::video_start() { @@ -38,6 +45,8 @@ 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? } @@ -122,7 +131,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, m_spriteram2->buffer(), machine(), bitmap, cliprect, m_flipscreen); + m_spr->draw_sprites_crshrace(m_spriteram->buffer(), 0x2000, machine(), bitmap, cliprect, m_flipscreen); draw_bg(machine(), bitmap, cliprect); draw_fg(machine(), bitmap, cliprect); break; @@ -130,7 +139,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, m_spriteram2->buffer(), machine(), bitmap, cliprect, m_flipscreen); + m_spr->draw_sprites_crshrace(m_spriteram->buffer(), 0x2000, machine(), bitmap, cliprect, m_flipscreen); break; default: popmessage("gfxctrl = %02x", m_gfxctrl); diff --git a/src/mame/video/f1gp.c b/src/mame/video/f1gp.c index d6f5de5275d..31feefe6f1c 100644 --- a/src/mame/video/f1gp.c +++ b/src/mame/video/f1gp.c @@ -40,6 +40,9 @@ TILE_GET_INFO_MEMBER(f1gp_state::get_fg_tile_info) ***************************************************************************/ + + + VIDEO_START_MEMBER(f1gp_state,f1gp) { @@ -69,6 +72,12 @@ VIDEO_START_MEMBER(f1gp_state,f1gpb) // save_pointer(NAME(m_zoomdata), memregion("gfx4")->bytes()); } +UINT32 f1gp_state::f1gp2_tile_callback( UINT32 code ) +{ + return m_sprcgram[code&0x3fff]; +} + + VIDEO_START_MEMBER(f1gp_state,f1gp2) { @@ -80,6 +89,8 @@ 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? } @@ -199,18 +210,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_sprcgram, m_flipscreen, machine(), bitmap, cliprect); + m_spr->f1gp2_draw_sprites(m_spritelist, m_flipscreen, 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_sprcgram, m_flipscreen, machine(), bitmap, cliprect); + m_spr->f1gp2_draw_sprites(m_spritelist, m_flipscreen, 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_sprcgram, m_flipscreen, machine(), bitmap, cliprect); + m_spr->f1gp2_draw_sprites(m_spritelist, m_flipscreen, machine(), bitmap, cliprect); break; #ifdef MAME_DEBUG case 3: diff --git a/src/mame/video/inufuku.c b/src/mame/video/inufuku.c index de5e7dbb10f..1fd42d8fe51 100644 --- a/src/mame/video/inufuku.c +++ b/src/mame/video/inufuku.c @@ -54,12 +54,6 @@ WRITE16_MEMBER(inufuku_state::inufuku_scrollreg_w) ******************************************************************************/ -static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) -{ - inufuku_state *state = machine.driver_data(); - - state->m_spr->draw_sprites_inufuku( state->m_spriteram1_old, state->m_spriteram1.bytes(), state->m_spriteram2, machine, bitmap, cliprect ); -} /****************************************************************************** @@ -109,6 +103,12 @@ WRITE16_MEMBER(inufuku_state::inufuku_tx_videoram_w) } +UINT32 inufuku_state::inufuku_tile_callback( UINT32 code ) +{ + return ((m_spriteram2[code*2] & 0x0007) << 16) + m_spriteram2[(code*2)+ 1]; +} + + /****************************************************************************** Start the video hardware emulation @@ -125,6 +125,8 @@ void inufuku_state::video_start() m_tx_tilemap->set_transparent_pen(255); 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? } @@ -159,7 +161,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); - draw_sprites(machine(), bitmap, cliprect); + m_spr->draw_sprites_inufuku( m_spriteram1_old, m_spriteram1.bytes(), machine(), bitmap, cliprect ); return 0; } diff --git a/src/mame/video/suprslam.c b/src/mame/video/suprslam.c index c232a904438..6f235840479 100644 --- a/src/mame/video/suprslam.c +++ b/src/mame/video/suprslam.c @@ -48,6 +48,13 @@ TILE_GET_INFO_MEMBER(suprslam_state::get_suprslam_bg_tile_info) } +UINT32 suprslam_state::suprslam_tile_callback( UINT32 code ) +{ + return m_sp_videoram[code]; +} + + + void suprslam_state::video_start() { @@ -55,6 +62,8 @@ 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) @@ -64,10 +73,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(), m_sp_videoram, machine(), bitmap, cliprect); + m_spr->draw_sprites_suprslam(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(), m_sp_videoram, machine(), bitmap, cliprect); + m_spr->draw_sprites_suprslam(m_spriteram, m_spriteram.bytes(), machine(), bitmap, cliprect); return 0; } diff --git a/src/mame/video/taotaido.c b/src/mame/video/taotaido.c index 05dd531bd17..2d10f17fb0a 100644 --- a/src/mame/video/taotaido.c +++ b/src/mame/video/taotaido.c @@ -79,6 +79,22 @@ TILEMAP_MAPPER_MEMBER(taotaido_state::taotaido_tilemap_scan_rows) return row*0x40 + (col&0x3f) + ((col&0x40)<<6); } + +UINT32 taotaido_state::taotaido_tile_callback( UINT32 code ) +{ + code = m_spriteram2_older[code&0x7fff]; + + if (code > 0x3fff) + { + int block = (code & 0x3800)>>11; + code &= 0x07ff; + code |= m_sprite_character_bank_select[block] * 0x800; + } + + return code; +} + + void taotaido_state::video_start() { m_bg_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(taotaido_state::taotaido_bg_tile_info),this),tilemap_mapper_delegate(FUNC(taotaido_state::taotaido_tilemap_scan_rows),this),16,16,128,64); @@ -88,6 +104,8 @@ 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? } @@ -113,7 +131,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(), m_spriteram2_older, m_sprite_character_bank_select, machine(), bitmap,cliprect); + m_spr->draw_sprites_taotaido(m_spriteram_older, m_spriteram.bytes(), machine(), bitmap,cliprect); return 0; } diff --git a/src/mame/video/vsystem_spr.c b/src/mame/video/vsystem_spr.c index 68bcb43c23d..78ad9703bc2 100644 --- a/src/mame/video/vsystem_spr.c +++ b/src/mame/video/vsystem_spr.c @@ -62,46 +62,9 @@ Abstracts the VS9210 #include "emu.h" #include "vsystem_spr.h" -/* game specific tile indirection callbacks for different HW hookups */ -UINT32 inufuku_tile_callback( UINT32 code, UINT16* lookupram1, UINT16* lookupram2 ) -{ - return ((lookupram1[code*2] & 0x0007) << 16) + lookupram1[(code*2)+ 1]; -} -UINT32 suprslam_tile_callback( UINT32 code, UINT16* lookupram1, UINT16* lookupram2 ) -{ - return lookupram1[code]; -} -UINT32 crshrace_tile_callback( UINT32 code, UINT16* lookupram1, UINT16* lookupram2 ) -{ - return lookupram1[code&0x7fff]; -} -UINT32 f1gp2_tile_callback( UINT32 code, UINT16* lookupram1, UINT16* lookupram2 ) -{ - return lookupram1[code&0x3fff]; -} - -UINT32 gstriker_tile_callback( UINT32 code, UINT16* lookupram1, UINT16* lookupram2 ) -{ - // straight through - return code; -} - -UINT32 taotaido_tile_callback( UINT32 code, UINT16* lookupram1, UINT16* lookupram2 ) -{ - code = lookupram1[code&0x7fff]; - - if (code > 0x3fff) - { - int block = (code & 0x3800)>>11; - code &= 0x07ff; - code |= lookupram2[block] * 0x800; - } - - return code; -} const device_type VSYSTEM_SPR = &device_creator; @@ -114,8 +77,24 @@ vsystem_spr_device::vsystem_spr_device(const machine_config &mconfig, const char m_xoffs = 0; m_yoffs = 0; m_pdraw = false; + + m_newtilecb = vsystem_tile_indirection_delegate(FUNC(vsystem_spr_device::tile_callback_noindirect), this); } +UINT32 vsystem_spr_device::tile_callback_noindirect(UINT32 tile) +{ + return tile; +} + + +// static +void vsystem_spr_device::set_tile_indirect_callback(device_t &device,vsystem_tile_indirection_delegate newtilecb) +{ + vsystem_spr_device &dev = downcast(device); + dev.m_newtilecb = newtilecb; +} + + // static void vsystem_spr_device::set_offsets(device_t &device, int xoffs, int yoffs) { @@ -183,7 +162,7 @@ void vsystem_spr_device::get_sprite_attributes(UINT16* ram) } -void vsystem_spr_device::common_sprite_drawgfx(int gfxrgn, UINT16* spriteram2, UINT16* spriteram3, vsystem_spr_tile_indirection_callback tilecb, running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) +void vsystem_spr_device::common_sprite_drawgfx(int gfxrgn, running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) { gfx_element *gfx = machine.gfx[gfxrgn]; int priority_mask = 0x00; @@ -222,7 +201,7 @@ void vsystem_spr_device::common_sprite_drawgfx(int gfxrgn, UINT16* spriteram2, U int xcnt = xstart; while (xcnt != xend) { - int startno = tilecb(curr_sprite.map++, spriteram2, spriteram3); + int startno = m_newtilecb(curr_sprite.map++); if (m_pdraw) { pdrawgfxzoom_transpen(bitmap, cliprect, gfx, startno, curr_sprite.color + m_pal_base, curr_sprite.flipx, curr_sprite.flipy, curr_sprite.ox + xcnt * curr_sprite.zoomx/2, curr_sprite.oy + ycnt * curr_sprite.zoomy/2, curr_sprite.zoomx << 11, curr_sprite.zoomy << 11, machine.priority_bitmap,priority_mask, m_transpen); @@ -246,7 +225,7 @@ void vsystem_spr_device::common_sprite_drawgfx(int gfxrgn, UINT16* spriteram2, U -void vsystem_spr_device::draw_sprites_inufuku( UINT16* spriteram, int spriteram_bytes, UINT16* spriteram2, running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) +void vsystem_spr_device::draw_sprites_inufuku( UINT16* spriteram, int spriteram_bytes, running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) { int offs; int end = 0; @@ -269,13 +248,13 @@ void vsystem_spr_device::draw_sprites_inufuku( UINT16* spriteram, int spriteram_ curr_sprite.map &= 0x7fff; - common_sprite_drawgfx(2, spriteram2, NULL, inufuku_tile_callback, machine, bitmap, cliprect); + common_sprite_drawgfx(2, machine, bitmap, cliprect); } } } -void vsystem_spr_device::draw_sprites_suprslam( UINT16* spriteram, int spriteram_bytes, UINT16* spriteram2, running_machine &machine, bitmap_ind16 &bitmap, const rectangle &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; @@ -293,13 +272,13 @@ void vsystem_spr_device::draw_sprites_suprslam( UINT16* spriteram, int spriteram curr_sprite.map &= 0x7fff; - common_sprite_drawgfx(1, spriteram2, NULL, suprslam_tile_callback, machine, bitmap, cliprect); + common_sprite_drawgfx(1, machine, bitmap, cliprect); } } -void vsystem_spr_device::draw_sprite_taotaido( UINT16* spriteram, int spriteram_bytes, UINT16* spriteram2, UINT16* spriteram3, running_machine &machine, UINT16 spriteno, bitmap_ind16 &bitmap, const rectangle &cliprect ) +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]; @@ -308,10 +287,10 @@ void vsystem_spr_device::draw_sprite_taotaido( UINT16* spriteram, int spriteram_ curr_sprite.map &= 0xffff; curr_sprite.color &= 0x1f; - common_sprite_drawgfx(0, spriteram2, spriteram3, taotaido_tile_callback, machine, bitmap, cliprect); + common_sprite_drawgfx(0, machine, bitmap, cliprect); } -void vsystem_spr_device::draw_sprites_taotaido( UINT16* spriteram, int spriteram_bytes, UINT16* spriteram2, UINT16* spriteram3, running_machine &machine, bitmap_ind16 &bitmap, const rectangle &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; @@ -320,7 +299,7 @@ void vsystem_spr_device::draw_sprites_taotaido( UINT16* spriteram, int spriteram { if (source[0] == 0x4000) break; - draw_sprite_taotaido(spriteram, spriteram_bytes, spriteram2, spriteram3, machine, source[0]&0x3ff, bitmap, cliprect); + draw_sprite_taotaido(spriteram, spriteram_bytes, machine, source[0]&0x3ff, bitmap, cliprect); source++; } @@ -328,7 +307,7 @@ void vsystem_spr_device::draw_sprites_taotaido( UINT16* spriteram, int spriteram -void vsystem_spr_device::draw_sprites_crshrace(UINT16* spriteram, int spriteram_bytes, UINT16* spriteram2, running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect, int flipscreen) +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; @@ -344,13 +323,13 @@ void vsystem_spr_device::draw_sprites_crshrace(UINT16* spriteram, int spriteram_ curr_sprite.color &= 0x1f; curr_sprite.map &= 0x7fff; - common_sprite_drawgfx(2, spriteram2, NULL, crshrace_tile_callback, machine, bitmap, cliprect); + common_sprite_drawgfx(2, machine, bitmap, cliprect); } } -void vsystem_spr_device::draw_sprites_aerofght( UINT16* spriteram3, int spriteram_bytes, UINT16* spriteram1, UINT16* spriteram2, running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int pri ) +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; @@ -368,7 +347,7 @@ void vsystem_spr_device::draw_sprites_aerofght( UINT16* spriteram3, int spritera curr_sprite.color &=0x1f; curr_sprite.map &= 0x3fff; - common_sprite_drawgfx(2, spriteram1, NULL, crshrace_tile_callback, machine, bitmap, cliprect); + common_sprite_drawgfx(2, machine, bitmap, cliprect); } offs++; @@ -376,7 +355,7 @@ void vsystem_spr_device::draw_sprites_aerofght( UINT16* spriteram3, int spritera } -void vsystem_spr_device::f1gp2_draw_sprites(UINT16* spritelist, UINT16* sprcgram, int flipscreen, running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) +void vsystem_spr_device::f1gp2_draw_sprites(UINT16* spritelist, int flipscreen, running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) { int offs; @@ -392,7 +371,7 @@ void vsystem_spr_device::f1gp2_draw_sprites(UINT16* spritelist, UINT16* sprcgram curr_sprite.color &= 0x1f; curr_sprite.map &= 0x7fff; - common_sprite_drawgfx(1, sprcgram, NULL, f1gp2_tile_callback, machine, bitmap, cliprect); + common_sprite_drawgfx(1, machine, bitmap, cliprect); } } @@ -407,7 +386,7 @@ void vsystem_spr_device::CG10103_draw_sprite(running_machine &machine, bitmap_in if (curr_sprite.pri != drawpri) return; - common_sprite_drawgfx(m_gfx_region, NULL, NULL, gstriker_tile_callback, machine, bitmap, cliprect); + common_sprite_drawgfx(m_gfx_region, machine, bitmap, cliprect); } diff --git a/src/mame/video/vsystem_spr.h b/src/mame/video/vsystem_spr.h index ca0fcc5f5d6..e9c9a5d9291 100644 --- a/src/mame/video/vsystem_spr.h +++ b/src/mame/video/vsystem_spr.h @@ -1,9 +1,9 @@ // Video System Sprites -/*** CG10103 **********************************************/ +typedef delegate vsystem_tile_indirection_delegate; -typedef UINT32 (*vsystem_spr_tile_indirection_callback)(UINT32 code, UINT16* lookupram1, UINT16* lookupram2); +/*** CG10103 **********************************************/ class vsystem_spr_device : public device_t { @@ -12,8 +12,10 @@ 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); - + UINT32 tile_callback_noindirect(UINT32 tile); + vsystem_tile_indirection_delegate m_newtilecb; int m_xoffs, m_yoffs; bool m_pdraw; @@ -39,15 +41,15 @@ public: } curr_sprite; void get_sprite_attributes(UINT16* ram); - void common_sprite_drawgfx(int gfxrgn, UINT16* spriteram2, UINT16* spriteram3, vsystem_spr_tile_indirection_callback tilecb, running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect); + void common_sprite_drawgfx(int gfxrgn, running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect); - void draw_sprites_inufuku( UINT16* spriteram, int spriteram_bytes, UINT16* spriteram2, running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ); - void draw_sprites_suprslam( UINT16* spriteram, int spriteram_bytes, UINT16* spriteram2, running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ); - void draw_sprite_taotaido( UINT16* spriteram, int spriteram_bytes, UINT16* spriteram2, UINT16* spriteram3, running_machine &machine, UINT16 spriteno, bitmap_ind16 &bitmap, const rectangle &cliprect ); - void draw_sprites_taotaido( UINT16* spriteram, int spriteram_bytes, UINT16* spriteram2, UINT16* spriteram3, running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ); - void draw_sprites_crshrace( UINT16* spriteram, int spriteram_bytes, UINT16* spriteram2, running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect, int flipscreen); - void draw_sprites_aerofght( UINT16* spriteram3, int spriteram_bytes, UINT16* spriteram1, UINT16* spriteram2, running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int priority ); - void f1gp2_draw_sprites(UINT16* spritelist, UINT16* sprcgram, int flipscreen, 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 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);