summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author Scott Stone <tafoid@users.noreply.github.com>2012-10-10 16:46:21 +0000
committer Scott Stone <tafoid@users.noreply.github.com>2012-10-10 16:46:21 +0000
commit449c901d5da0d35a71371a0395ea32f2305d00a9 (patch)
tree6c4d8d1f24e71366dc20c371da5b28d0427bcd75 /src
parent3e33bb3e7bf769e9bfb804dc12de759b5b904fae (diff)
Continued cleanup of Video Systems drivers and associated dependencies. From Haze (nw)
Diffstat (limited to 'src')
-rw-r--r--src/mame/drivers/aerofgt.c30
-rw-r--r--src/mame/drivers/f1gp.c5
-rw-r--r--src/mame/drivers/pipedrm.c2
-rw-r--r--src/mame/drivers/welltris.c1
-rw-r--r--src/mame/includes/aerofgt.h16
-rw-r--r--src/mame/includes/f1gp.h13
-rw-r--r--src/mame/includes/fromance.h10
-rw-r--r--src/mame/includes/welltris.h9
-rw-r--r--src/mame/mame.mak1
-rw-r--r--src/mame/video/aerofgt.c469
-rw-r--r--src/mame/video/f1gp.c226
-rw-r--r--src/mame/video/fromance.c121
-rw-r--r--src/mame/video/vsystem_spr.c156
-rw-r--r--src/mame/video/vsystem_spr.h2
-rw-r--r--src/mame/video/vsystem_spr2.c525
-rw-r--r--src/mame/video/vsystem_spr2.h40
-rw-r--r--src/mame/video/welltris.c117
17 files changed, 972 insertions, 771 deletions
diff --git a/src/mame/drivers/aerofgt.c b/src/mame/drivers/aerofgt.c
index 89df34b0ec9..c81e4628c31 100644
--- a/src/mame/drivers/aerofgt.c
+++ b/src/mame/drivers/aerofgt.c
@@ -1348,6 +1348,8 @@ static MACHINE_CONFIG_START( pspikes, aerofgt_state )
MCFG_GFXDECODE(pspikes)
MCFG_PALETTE_LENGTH(2048)
+ MCFG_DEVICE_ADD("vsystem_spr_old", VSYSTEM_SPR2, 0)
+
MCFG_VIDEO_START_OVERRIDE(aerofgt_state,pspikes)
/* sound hardware */
@@ -1446,6 +1448,8 @@ static MACHINE_CONFIG_START( pspikesc, aerofgt_state )
MCFG_GFXDECODE(pspikes)
MCFG_PALETTE_LENGTH(2048)
+ MCFG_DEVICE_ADD("vsystem_spr_old", VSYSTEM_SPR2, 0)
+
MCFG_VIDEO_START_OVERRIDE(aerofgt_state,pspikes)
/* sound hardware */
@@ -1481,6 +1485,8 @@ static MACHINE_CONFIG_START( karatblz, aerofgt_state )
MCFG_GFXDECODE(turbofrc)
MCFG_PALETTE_LENGTH(1024)
+ MCFG_DEVICE_ADD("vsystem_spr_old", VSYSTEM_SPR2, 0)
+
MCFG_VIDEO_START_OVERRIDE(aerofgt_state,karatblz)
/* sound hardware */
@@ -1520,6 +1526,8 @@ static MACHINE_CONFIG_START( spinlbrk, aerofgt_state )
MCFG_GFXDECODE(turbofrc)
MCFG_PALETTE_LENGTH(1024)
+ MCFG_DEVICE_ADD("vsystem_spr_old", VSYSTEM_SPR2, 0)
+
MCFG_VIDEO_START_OVERRIDE(aerofgt_state,spinlbrk)
/* sound hardware */
@@ -1559,6 +1567,8 @@ static MACHINE_CONFIG_START( turbofrc, aerofgt_state )
MCFG_GFXDECODE(turbofrc)
MCFG_PALETTE_LENGTH(1024)
+ MCFG_DEVICE_ADD("vsystem_spr_old", VSYSTEM_SPR2, 0)
+
MCFG_VIDEO_START_OVERRIDE(aerofgt_state,turbofrc)
/* sound hardware */
@@ -1599,6 +1609,8 @@ static MACHINE_CONFIG_START( aerofgtb, aerofgt_state )
MCFG_GFXDECODE(aerofgtb)
MCFG_PALETTE_LENGTH(1024)
+ MCFG_DEVICE_ADD("vsystem_spr_old", VSYSTEM_SPR2, 0)
+
MCFG_VIDEO_START_OVERRIDE(aerofgt_state,turbofrc)
/* sound hardware */
@@ -1639,6 +1651,8 @@ static MACHINE_CONFIG_START( aerofgt, aerofgt_state )
MCFG_GFXDECODE(aerofgt)
MCFG_PALETTE_LENGTH(1024)
+ MCFG_DEVICE_ADD("vsystem_spr", VSYSTEM_SPR, 0)
+
MCFG_VIDEO_START_OVERRIDE(aerofgt_state,turbofrc)
/* sound hardware */
@@ -1741,6 +1755,8 @@ static MACHINE_CONFIG_START( wbbc97, aerofgt_state )
MCFG_GFXDECODE(wbbc97)
MCFG_PALETTE_LENGTH(2048)
+ MCFG_DEVICE_ADD("vsystem_spr_old", VSYSTEM_SPR2, 0)
+
MCFG_VIDEO_START_OVERRIDE(aerofgt_state,wbbc97)
/* sound hardware */
@@ -2495,6 +2511,7 @@ ROM_END
GAME( 1990, spinlbrk, 0, spinlbrk, spinlbrk, driver_device, 0, ROT0, "V-System Co.", "Spinal Breakers (World)", GAME_SUPPORTS_SAVE | GAME_NO_COCKTAIL )
GAME( 1990, spinlbrku,spinlbrk, spinlbrk, spinlbrku, driver_device,0, ROT0, "V-System Co.", "Spinal Breakers (US)", GAME_SUPPORTS_SAVE | GAME_NO_COCKTAIL )
GAME( 1990, spinlbrkj,spinlbrk, spinlbrk, spinlbrk, driver_device, 0, ROT0, "V-System Co.", "Spinal Breakers (Japan)", GAME_SUPPORTS_SAVE | GAME_NO_COCKTAIL )
+
GAME( 1991, pspikes, 0, pspikes, pspikes, driver_device, 0, ROT0, "Video System Co.", "Power Spikes (World)", GAME_SUPPORTS_SAVE | GAME_NO_COCKTAIL )
GAME( 1991, pspikesk, pspikes, pspikes, pspikes, driver_device, 0, ROT0, "Video System Co.", "Power Spikes (Korea)", GAME_SUPPORTS_SAVE | GAME_NO_COCKTAIL )
GAME( 1991, svolly91, pspikes, pspikes, pspikes, driver_device, 0, ROT0, "Video System Co.", "Super Volley '91 (Japan)", GAME_SUPPORTS_SAVE | GAME_NO_COCKTAIL )
@@ -2502,15 +2519,20 @@ GAME( 1991, pspikesb, pspikes, pspikesb, pspikesb, driver_device, 0, ROT0, "b
GAME( 1991, spikes91, pspikes, spikes91, pspikes, driver_device, 0, ROT0, "bootleg", "1991 Spikes (Italian bootleg)", GAME_SUPPORTS_SAVE | GAME_NO_SOUND | GAME_NO_COCKTAIL )
GAME( 1991, spikes91a,pspikes, spikes91, pspikes, driver_device, 0, ROT0, "bootleg", "1991 Spikes (Italian bootleg, set 2)", GAME_SUPPORTS_SAVE | GAME_NOT_WORKING | GAME_NO_SOUND | GAME_NO_COCKTAIL )
GAME( 1991, pspikesc, pspikes, pspikesc, pspikesc, driver_device, 0, ROT0, "bootleg", "Power Spikes (China)", GAME_SUPPORTS_SAVE | GAME_NO_COCKTAIL | GAME_IMPERFECT_SOUND )
+GAME( 1997, wbbc97, 0, wbbc97, wbbc97, driver_device, 0, ROT0, "Comad", "Beach Festival World Championship 1997", GAME_SUPPORTS_SAVE | GAME_NO_COCKTAIL ) // based on power spikes codebase
+
GAME( 1991, karatblz, 0, karatblz, karatblz, driver_device, 0, ROT0, "Video System Co.", "Karate Blazers (World)", GAME_SUPPORTS_SAVE | GAME_NO_COCKTAIL )
GAME( 1991, karatblzu,karatblz, karatblz, karatblz, driver_device, 0, ROT0, "Video System Co.", "Karate Blazers (US)", GAME_SUPPORTS_SAVE | GAME_NO_COCKTAIL )
GAME( 1991, karatblzj,karatblz, karatblz, karatblz, driver_device, 0, ROT0, "Video System Co.", "Karate Blazers (Japan)", GAME_SUPPORTS_SAVE | GAME_NO_COCKTAIL )
+
GAME( 1991, turbofrc, 0, turbofrc, turbofrc, driver_device, 0, ROT270, "Video System Co.", "Turbo Force (old revision)", GAME_SUPPORTS_SAVE | GAME_NO_COCKTAIL )
// there's also an undumped Turbo Force (new revision). Most notable thing in there is the points value of the rocks in level 6 (5.000 versus 500).
-GAME( 1992, aerofgt, 0, aerofgt, aerofgt, driver_device, 0, ROT270, "Video System Co.", "Aero Fighters", GAME_SUPPORTS_SAVE | GAME_NO_COCKTAIL )
-GAME( 1992, aerofgtb, aerofgt, aerofgtb, aerofgtb, driver_device, 0, ROT270, "Video System Co.", "Aero Fighters (Turbo Force hardware set 1)", GAME_SUPPORTS_SAVE | GAME_NO_COCKTAIL )
-GAME( 1992, aerofgtc, aerofgt, aerofgtb, aerofgtb, driver_device, 0, ROT270, "Video System Co.", "Aero Fighters (Turbo Force hardware set 2)", GAME_SUPPORTS_SAVE | GAME_NO_COCKTAIL )
+
+// the tiles on these also contain an alt title 'The Final War' for both the title screen and attract logo was it ever used?
+GAME( 1992, aerofgt, 0, aerofgt, aerofgt, driver_device, 0, ROT270, "Video System Co.", "Aero Fighters (World / USA + Canada / Korea / Hong Kong / Taiwan) (newer hardware)", GAME_SUPPORTS_SAVE | GAME_NO_COCKTAIL ) // this has the newer sprite chip etc. unlike all other games in this driver..
+GAME( 1992, aerofgtb, aerofgt, aerofgtb, aerofgtb, driver_device, 0, ROT270, "Video System Co.", "Aero Fighters (Taiwan / Japan, set 1)", GAME_SUPPORTS_SAVE | GAME_NO_COCKTAIL ) // probably intended for Taiwan because the Japanese name is Sonic Wings (below)
+GAME( 1992, aerofgtc, aerofgt, aerofgtb, aerofgtb, driver_device, 0, ROT270, "Video System Co.", "Aero Fighters (Taiwan / Japan, set 2)", GAME_SUPPORTS_SAVE | GAME_NO_COCKTAIL )
GAME( 1992, sonicwi, aerofgt, aerofgtb, aerofgtb, driver_device, 0, ROT270, "Video System Co.", "Sonic Wings (Japan)", GAME_SUPPORTS_SAVE | GAME_NO_COCKTAIL )
GAME( 1992, aerfboot, aerofgt, aerfboot, aerofgtb, driver_device, 0, ROT270, "bootleg", "Aero Fighters (bootleg set 1)", GAME_SUPPORTS_SAVE | GAME_NO_COCKTAIL | GAME_IMPERFECT_SOUND )
GAME( 1992, aerfboo2, aerofgt, aerfboo2, aerofgtb, driver_device, 0, ROT270, "bootleg", "Aero Fighters (bootleg set 2)", GAME_SUPPORTS_SAVE | GAME_NO_COCKTAIL | GAME_IMPERFECT_SOUND )
-GAME( 1997, wbbc97, 0, wbbc97, wbbc97, driver_device, 0, ROT0, "Comad", "Beach Festival World Championship 1997", GAME_SUPPORTS_SAVE | GAME_NO_COCKTAIL )
+
diff --git a/src/mame/drivers/f1gp.c b/src/mame/drivers/f1gp.c
index 94d4428ef39..d07930f7173 100644
--- a/src/mame/drivers/f1gp.c
+++ b/src/mame/drivers/f1gp.c
@@ -476,6 +476,8 @@ static MACHINE_CONFIG_START( f1gp, f1gp_state )
MCFG_GFXDECODE(f1gp)
MCFG_PALETTE_LENGTH(2048)
+ MCFG_DEVICE_ADD("vsystem_spr_old", VSYSTEM_SPR2, 0)
+
MCFG_VIDEO_START_OVERRIDE(f1gp_state,f1gp)
MCFG_K053936_ADD("k053936", f1gp_k053936_intf)
@@ -542,6 +544,9 @@ static MACHINE_CONFIG_DERIVED( f1gp2, f1gp )
MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 0*8, 28*8-1)
MCFG_SCREEN_UPDATE_DRIVER(f1gp_state, screen_update_f1gp2)
+ MCFG_DEVICE_REMOVE("vsystem_spr_old")
+ MCFG_DEVICE_ADD("vsystem_spr", VSYSTEM_SPR, 0)
+
MCFG_DEVICE_REMOVE("k053936")
MCFG_K053936_ADD("k053936", f1gp2_k053936_intf)
diff --git a/src/mame/drivers/pipedrm.c b/src/mame/drivers/pipedrm.c
index 318796b9866..c6c75d256e4 100644
--- a/src/mame/drivers/pipedrm.c
+++ b/src/mame/drivers/pipedrm.c
@@ -658,6 +658,8 @@ static MACHINE_CONFIG_START( pipedrm, fromance_state )
MCFG_GFXDECODE(pipedrm)
MCFG_PALETTE_LENGTH(2048)
+ MCFG_DEVICE_ADD("vsystem_spr_old", VSYSTEM_SPR2, 0)
+
MCFG_VIDEO_START_OVERRIDE(fromance_state,pipedrm)
/* sound hardware */
diff --git a/src/mame/drivers/welltris.c b/src/mame/drivers/welltris.c
index 073f4c4f46f..625e5348434 100644
--- a/src/mame/drivers/welltris.c
+++ b/src/mame/drivers/welltris.c
@@ -724,6 +724,7 @@ static MACHINE_CONFIG_START( welltris, welltris_state )
MCFG_GFXDECODE(welltris)
MCFG_PALETTE_LENGTH(2048)
+ MCFG_DEVICE_ADD("vsystem_spr_old", VSYSTEM_SPR2, 0)
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
diff --git a/src/mame/includes/aerofgt.h b/src/mame/includes/aerofgt.h
index 02c60e405ba..d9616e429f5 100644
--- a/src/mame/includes/aerofgt.h
+++ b/src/mame/includes/aerofgt.h
@@ -1,3 +1,5 @@
+#include "video/vsystem_spr.h"
+#include "video/vsystem_spr2.h"
class aerofgt_state : public driver_device
{
@@ -11,7 +13,10 @@ public:
m_spriteram1(*this, "spriteram1"),
m_spriteram2(*this, "spriteram2"),
m_spriteram3(*this, "spriteram3"),
- m_tx_tilemap_ram(*this, "tx_tilemap_ram"){ }
+ m_tx_tilemap_ram(*this, "tx_tilemap_ram"),
+ m_spr(*this, "vsystem_spr"),
+ m_spr_old(*this, "vsystem_spr_old")
+ { }
/* memory pointers */
required_shared_ptr<UINT16> m_bg1videoram;
@@ -24,6 +29,11 @@ public:
optional_shared_ptr<UINT16> m_tx_tilemap_ram;
// UINT16 * m_paletteram; // currently this uses generic palette handling
+ /* devices referenced above */
+ optional_device<vsystem_spr_device> m_spr; // only the aerofgt parent uses this chip
+ optional_device<vsystem_spr2_device> m_spr_old; // every other (non-bootleg) uses this
+
+
/* video-related */
tilemap_t *m_bg1_tilemap;
tilemap_t *m_bg2_tilemap;
@@ -42,8 +52,10 @@ public:
/* misc */
int m_pending_command;
- /* devices */
+ /* other devices */
cpu_device *m_audiocpu;
+
+ /* handlers */
DECLARE_WRITE16_MEMBER(sound_command_w);
DECLARE_WRITE16_MEMBER(turbofrc_sound_command_w);
DECLARE_WRITE16_MEMBER(aerfboot_soundlatch_w);
diff --git a/src/mame/includes/f1gp.h b/src/mame/includes/f1gp.h
index 4fbfc59ddee..3896309e004 100644
--- a/src/mame/includes/f1gp.h
+++ b/src/mame/includes/f1gp.h
@@ -1,3 +1,5 @@
+#include "video/vsystem_spr.h"
+#include "video/vsystem_spr2.h"
class f1gp_state : public driver_device
{
@@ -15,7 +17,10 @@ public:
m_spritelist(*this, "spritelist"),
m_spriteram(*this, "spriteram"),
m_fgregs(*this, "fgregs"),
- m_rozregs(*this, "rozregs"){ }
+ m_rozregs(*this, "rozregs"),
+ m_spr_old(*this, "vsystem_spr_old"),
+ m_spr(*this, "vsystem_spr")
+ { }
/* memory pointers */
required_shared_ptr<UINT16> m_sharedram;
@@ -30,6 +35,12 @@ public:
optional_shared_ptr<UINT16> m_spriteram;
optional_shared_ptr<UINT16> m_fgregs;
optional_shared_ptr<UINT16> m_rozregs;
+
+ /* devices referenced above */
+ optional_device<vsystem_spr2_device> m_spr_old; // f1gp
+ optional_device<vsystem_spr_device> m_spr; // f1gp2
+
+
UINT16 * m_zoomdata;
// UINT16 * m_paletteram; // currently this uses generic palette handling
diff --git a/src/mame/includes/fromance.h b/src/mame/includes/fromance.h
index 0d6c18553ba..b5a894fff06 100644
--- a/src/mame/includes/fromance.h
+++ b/src/mame/includes/fromance.h
@@ -7,19 +7,25 @@
***************************************************************************/
+#include "video/vsystem_spr2.h"
+
class fromance_state : public driver_device
{
public:
fromance_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
- m_videoram(*this, "videoram"),
- m_spriteram(*this, "spriteram") { }
+ m_videoram(*this, "videoram"),
+ m_spriteram(*this, "spriteram"),
+ m_spr_old(*this, "vsystem_spr_old")
+ { }
/* memory pointers (used by pipedrm) */
optional_shared_ptr<UINT8> m_videoram;
optional_shared_ptr<UINT8> m_spriteram;
// UINT8 * m_paletteram; // currently this uses generic palette handling
+ optional_device<vsystem_spr2_device> m_spr_old; // only used by pipe dream, split this state up and clean things...
+
/* video-related */
tilemap_t *m_bg_tilemap;
tilemap_t *m_fg_tilemap;
diff --git a/src/mame/includes/welltris.h b/src/mame/includes/welltris.h
index 6f6d3d05c16..11e7a2053aa 100644
--- a/src/mame/includes/welltris.h
+++ b/src/mame/includes/welltris.h
@@ -1,3 +1,5 @@
+#include "video/vsystem_spr2.h"
+
class welltris_state : public driver_device
{
public:
@@ -5,7 +7,9 @@ public:
: driver_device(mconfig, type, tag) ,
m_spriteram(*this, "spriteram"),
m_pixelram(*this, "pixelram"),
- m_charvideoram(*this, "charvideoram"){ }
+ m_charvideoram(*this, "charvideoram"),
+ m_spr_old(*this, "vsystem_spr_old")
+ { }
int m_pending_command;
@@ -13,6 +17,9 @@ public:
required_shared_ptr<UINT16> m_pixelram;
required_shared_ptr<UINT16> m_charvideoram;
+ /* devices referenced above */
+ required_device<vsystem_spr2_device> m_spr_old;
+
tilemap_t *m_char_tilemap;
UINT8 m_gfxbank[8];
UINT16 m_charpalettebank;
diff --git a/src/mame/mame.mak b/src/mame/mame.mak
index 12d0902c013..1e73ba0d36e 100644
--- a/src/mame/mame.mak
+++ b/src/mame/mame.mak
@@ -1593,6 +1593,7 @@ $(MAMEOBJ)/venture.a: \
$(MAMEOBJ)/vsystem.a: \
$(VIDEO)/vsystem_spr.o \
+ $(VIDEO)/vsystem_spr2.o \
$(DRIVERS)/aerofgt.o $(VIDEO)/aerofgt.o \
$(DRIVERS)/crshrace.o $(VIDEO)/crshrace.o \
$(DRIVERS)/f1gp.o $(VIDEO)/f1gp.o \
diff --git a/src/mame/video/aerofgt.c b/src/mame/video/aerofgt.c
index 5607952af38..60899be811b 100644
--- a/src/mame/video/aerofgt.c
+++ b/src/mame/video/aerofgt.c
@@ -156,19 +156,6 @@ VIDEO_START_MEMBER(aerofgt_state,turbofrc)
aerofgt_register_state_globals(machine());
}
-VIDEO_START_MEMBER(aerofgt_state,wbbc97)
-{
- m_bg1_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(aerofgt_state::get_pspikes_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
- /* no bg2 in this game */
-
- m_bg1_tilemap->set_transparent_pen(15);
-
- m_sprite_gfx = 1;
-
- aerofgt_register_state_globals(machine());
-
- save_item(NAME(m_wbbc97_bitmap_enable));
-}
/***************************************************************************
@@ -208,18 +195,6 @@ WRITE16_MEMBER(aerofgt_state::pspikes_gfxbank_w)
}
}
-WRITE16_MEMBER(aerofgt_state::pspikesb_gfxbank_w)
-{
- COMBINE_DATA(&m_rasterram[0x200 / 2]);
-
- setbank(machine(), m_bg1_tilemap, 0, (data & 0xf000) >> 12);
- setbank(machine(), m_bg1_tilemap, 1, (data & 0x0f00) >> 8);
-}
-
-WRITE16_MEMBER(aerofgt_state::spikes91_lookup_w)
-{
- m_spikes91_lookup = data & 1;
-}
WRITE16_MEMBER(aerofgt_state::karatblz_gfxbank_w)
{
@@ -294,10 +269,6 @@ WRITE16_MEMBER(aerofgt_state::pspikes_palette_bank_w)
}
}
-WRITE16_MEMBER(aerofgt_state::wbbc97_bitmap_enable_w)
-{
- COMBINE_DATA(&m_wbbc97_bitmap_enable);
-}
/***************************************************************************
@@ -305,247 +276,162 @@ WRITE16_MEMBER(aerofgt_state::wbbc97_bitmap_enable_w)
***************************************************************************/
-static void aerofgt_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int priority )
+
+UINT32 aerofgt_state::screen_update_pspikes(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
- aerofgt_state *state = machine.driver_data<aerofgt_state>();
- int offs;
- priority <<= 12;
+ int i, scrolly;
- offs = 0;
- while (offs < 0x0400 && (state->m_spriteram3[offs] & 0x8000) == 0)
- {
- int attr_start = 4 * (state->m_spriteram3[offs] & 0x03ff);
+ m_bg1_tilemap->set_scroll_rows(256);
+ scrolly = m_bg1scrolly;
+ for (i = 0; i < 256; i++)
+ m_bg1_tilemap->set_scrollx((i + scrolly) & 0xff, m_rasterram[i]);
+ m_bg1_tilemap->set_scrolly(0, scrolly);
- /* is the way I handle priority correct? Or should I just check bit 13? */
- if ((state->m_spriteram3[attr_start + 2] & 0x3000) == priority)
- {
- int map_start;
- int ox, oy, x, y, xsize, ysize, zoomx, zoomy, flipx, flipy, color;
-
- ox = state->m_spriteram3[attr_start + 1] & 0x01ff;
- xsize = (state->m_spriteram3[attr_start + 1] & 0x0e00) >> 9;
- zoomx = (state->m_spriteram3[attr_start + 1] & 0xf000) >> 12;
- oy = state->m_spriteram3[attr_start + 0] & 0x01ff;
- ysize = (state->m_spriteram3[attr_start + 0] & 0x0e00) >> 9;
- zoomy = (state->m_spriteram3[attr_start + 0] & 0xf000) >> 12;
- flipx = state->m_spriteram3[attr_start + 2] & 0x4000;
- flipy = state->m_spriteram3[attr_start + 2] & 0x8000;
- color = (state->m_spriteram3[attr_start + 2] & 0x0f00) >> 8;
- map_start = state->m_spriteram3[attr_start + 3] & 0x3fff;
-
- ox += (xsize * zoomx + 2) / 4;
- oy += (ysize * zoomy + 2) / 4;
-
- zoomx = 32 - zoomx;
- zoomy = 32 - zoomy;
-
- for (y = 0; y <= ysize; y++)
- {
- int sx, sy;
+ machine().priority_bitmap.fill(0, cliprect);
- if (flipy)
- sy = ((oy + zoomy * (ysize - y)/2 + 16) & 0x1ff) - 16;
- else
- sy = ((oy + zoomy * y / 2 + 16) & 0x1ff) - 16;
-
- for (x = 0; x <= xsize; x++)
- {
- int code;
-
- if (flipx)
- sx = ((ox + zoomx * (xsize - x) / 2 + 16) & 0x1ff) - 16;
- else
- sx = ((ox + zoomx * x / 2 + 16) & 0x1ff) - 16;
-
- if (map_start < 0x2000)
- code = state->m_spriteram1[map_start & 0x1fff] & 0x1fff;
- else
- code = state->m_spriteram2[map_start & 0x1fff] & 0x1fff;
-
- drawgfxzoom_transpen(bitmap,cliprect,machine.gfx[state->m_sprite_gfx + (map_start >= 0x2000 ? 1 : 0)],
- code,
- color,
- flipx,flipy,
- sx,sy,
- zoomx << 11, zoomy << 11,15);
- map_start++;
- }
- }
- }
- offs++;
- }
+ m_bg1_tilemap->draw(bitmap, cliprect, 0, 0);
+ m_spr_old->turbofrc_draw_sprites(m_spriteram3,m_spriteram3.bytes(),m_spriteram1,m_spriteram1.bytes(),m_spriteram2,m_spriteram2.bytes(),m_sprite_gfx,m_spritepalettebank, machine(), bitmap, cliprect, 0, -1);
+ m_spr_old->turbofrc_draw_sprites(m_spriteram3,m_spriteram3.bytes(),m_spriteram1,m_spriteram1.bytes(),m_spriteram2,m_spriteram2.bytes(),m_sprite_gfx,m_spritepalettebank, machine(), bitmap, cliprect, 0, 0);
+ return 0;
}
-template<class _BitmapClass>
-static void turbofrc_draw_sprites( running_machine &machine, _BitmapClass &bitmap, const rectangle &cliprect, int chip, int chip_disabled_pri )
+
+UINT32 aerofgt_state::screen_update_karatblz(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
- aerofgt_state *state = machine.driver_data<aerofgt_state>();
- int attr_start, base, first;
- base = chip * 0x0200;
- first = 4 * state->m_spriteram3[0x1fe + base];
+ m_bg1_tilemap->set_scrollx(0, m_bg1scrollx - 8);
+ m_bg1_tilemap->set_scrolly(0, m_bg1scrolly);
+ m_bg2_tilemap->set_scrollx(0, m_bg2scrollx - 4);
+ m_bg2_tilemap->set_scrolly(0, m_bg2scrolly);
- for (attr_start = base + 0x0200 - 8; attr_start >= first + base; attr_start -= 4)
- {
- int map_start;
- int ox, oy, x, y, xsize, ysize, zoomx, zoomy, flipx, flipy, color, pri;
-// some other drivers still use this wrong table, they have to be upgraded
-// int zoomtable[16] = { 0,7,14,20,25,30,34,38,42,46,49,52,54,57,59,61 };
+ machine().priority_bitmap.fill(0, cliprect);
- if (!(state->m_spriteram3[attr_start + 2] & 0x0080))
- continue;
+ m_bg1_tilemap->draw(bitmap, cliprect, 0, 0);
+ m_bg2_tilemap->draw(bitmap, cliprect, 0, 0);
- pri = state->m_spriteram3[attr_start + 2] & 0x0010;
+ /* we use the priority buffer so sprites are drawn front to back */
+ m_spr_old->turbofrc_draw_sprites(m_spriteram3,m_spriteram3.bytes(),m_spriteram1,m_spriteram1.bytes(),m_spriteram2,m_spriteram2.bytes(),m_sprite_gfx,m_spritepalettebank, machine(), bitmap, cliprect, 1, -1);
+ m_spr_old->turbofrc_draw_sprites(m_spriteram3,m_spriteram3.bytes(),m_spriteram1,m_spriteram1.bytes(),m_spriteram2,m_spriteram2.bytes(),m_sprite_gfx,m_spritepalettebank, machine(), bitmap, cliprect, 1, 0);
+ m_spr_old->turbofrc_draw_sprites(m_spriteram3,m_spriteram3.bytes(),m_spriteram1,m_spriteram1.bytes(),m_spriteram2,m_spriteram2.bytes(),m_sprite_gfx,m_spritepalettebank, machine(), bitmap, cliprect, 0, -1);
+ m_spr_old->turbofrc_draw_sprites(m_spriteram3,m_spriteram3.bytes(),m_spriteram1,m_spriteram1.bytes(),m_spriteram2,m_spriteram2.bytes(),m_sprite_gfx,m_spritepalettebank, machine(), bitmap, cliprect, 0, 0);
+ return 0;
+}
- if ( chip_disabled_pri & !pri)
- continue;
+UINT32 aerofgt_state::screen_update_spinlbrk(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+{
+ int i, scrolly;
- if ((!chip_disabled_pri) & (pri >> 4))
- continue;
+ m_bg1_tilemap->set_scroll_rows(512);
+ scrolly = 0;
+ for (i = 0; i < 256; i++)
+ m_bg1_tilemap->set_scrollx((i + scrolly) & 0x1ff, m_rasterram[i] - 8);
+// m_bg1_tilemap->set_scrolly(0, m_bg1scrolly);
+ m_bg2_tilemap->set_scrollx(0, m_bg2scrollx - 4);
+// m_bg2_tilemap->set_scrolly(0, m_bg2scrolly);
- ox = state->m_spriteram3[attr_start + 1] & 0x01ff;
- xsize = (state->m_spriteram3[attr_start + 2] & 0x0700) >> 8;
- zoomx = (state->m_spriteram3[attr_start + 1] & 0xf000) >> 12;
- oy = state->m_spriteram3[attr_start + 0] & 0x01ff;
- ysize = (state->m_spriteram3[attr_start + 2] & 0x7000) >> 12;
- zoomy = (state->m_spriteram3[attr_start + 0] & 0xf000) >> 12;
- flipx = state->m_spriteram3[attr_start + 2] & 0x0800;
- flipy = state->m_spriteram3[attr_start + 2] & 0x8000;
- color = (state->m_spriteram3[attr_start + 2] & 0x000f) + 16 * state->m_spritepalettebank;
+ machine().priority_bitmap.fill(0, cliprect);
- map_start = state->m_spriteram3[attr_start + 3];
+ m_bg1_tilemap->draw(bitmap, cliprect, 0, 0);
+ m_bg2_tilemap->draw(bitmap, cliprect, 0, 1);
-// aerofgt has this adjustment, but doing it here would break turbo force title screen
-// ox += (xsize*zoomx+2)/4;
-// oy += (ysize*zoomy+2)/4;
+ /* we use the priority buffer so sprites are drawn front to back */
+ m_spr_old->spinlbrk_draw_sprites(m_spriteram3,m_spriteram3.bytes(),m_spriteram1,m_spriteram1.bytes(),m_spriteram2,m_spriteram2.bytes(),m_sprite_gfx,m_spritepalettebank, machine(), bitmap, cliprect, 0, 0);
+ m_spr_old->spinlbrk_draw_sprites(m_spriteram3,m_spriteram3.bytes(),m_spriteram1,m_spriteram1.bytes(),m_spriteram2,m_spriteram2.bytes(),m_sprite_gfx,m_spritepalettebank, machine(), bitmap, cliprect, 0, -1);
+ m_spr_old->spinlbrk_draw_sprites(m_spriteram3,m_spriteram3.bytes(),m_spriteram1,m_spriteram1.bytes(),m_spriteram2,m_spriteram2.bytes(),m_sprite_gfx,m_spritepalettebank, machine(), bitmap, cliprect, 1, 0);
+ m_spr_old->spinlbrk_draw_sprites(m_spriteram3,m_spriteram3.bytes(),m_spriteram1,m_spriteram1.bytes(),m_spriteram2,m_spriteram2.bytes(),m_sprite_gfx,m_spritepalettebank, machine(), bitmap, cliprect, 1, -1);
+ return 0;
+}
- zoomx = 32 - zoomx;
- zoomy = 32 - zoomy;
+UINT32 aerofgt_state::screen_update_turbofrc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+{
+ int i, scrolly;
- for (y = 0; y <= ysize; y++)
- {
- int sx, sy;
+ m_bg1_tilemap->set_scroll_rows(512);
+ scrolly = m_bg1scrolly + 2;
+ for (i = 0; i < 256; i++)
+// m_bg1_tilemap->set_scrollx((i + scrolly) & 0x1ff, m_rasterram[i] - 11);
+ m_bg1_tilemap->set_scrollx((i + scrolly) & 0x1ff, m_rasterram[7] - 11);
+ m_bg1_tilemap->set_scrolly(0, scrolly);
+ m_bg2_tilemap->set_scrollx(0, m_bg2scrollx - 7);
+ m_bg2_tilemap->set_scrolly(0, m_bg2scrolly + 2);
- if (flipy)
- sy = ((oy + zoomy * (ysize - y)/2 + 16) & 0x1ff) - 16;
- else
- sy = ((oy + zoomy * y / 2 + 16) & 0x1ff) - 16;
+ machine().priority_bitmap.fill(0, cliprect);
- for (x = 0; x <= xsize; x++)
- {
- int code;
+ m_bg1_tilemap->draw(bitmap, cliprect, 0, 0);
+ m_bg2_tilemap->draw(bitmap, cliprect, 0, 1);
- if (flipx)
- sx = ((ox + zoomx * (xsize - x) / 2 + 16) & 0x1ff) - 16;
- else
- sx = ((ox + zoomx * x / 2 + 16) & 0x1ff) - 16;
+ /* we use the priority buffer so sprites are drawn front to back */
+ m_spr_old->turbofrc_draw_sprites(m_spriteram3,m_spriteram3.bytes(),m_spriteram1,m_spriteram1.bytes(),m_spriteram2,m_spriteram2.bytes(),m_sprite_gfx,m_spritepalettebank, machine(), bitmap, cliprect, 1, -1); //ship
+ m_spr_old->turbofrc_draw_sprites(m_spriteram3,m_spriteram3.bytes(),m_spriteram1,m_spriteram1.bytes(),m_spriteram2,m_spriteram2.bytes(),m_sprite_gfx,m_spritepalettebank, machine(), bitmap, cliprect, 1, 0); //intro
+ m_spr_old->turbofrc_draw_sprites(m_spriteram3,m_spriteram3.bytes(),m_spriteram1,m_spriteram1.bytes(),m_spriteram2,m_spriteram2.bytes(),m_sprite_gfx,m_spritepalettebank, machine(), bitmap, cliprect, 0, -1); //enemy
+ m_spr_old->turbofrc_draw_sprites(m_spriteram3,m_spriteram3.bytes(),m_spriteram1,m_spriteram1.bytes(),m_spriteram2,m_spriteram2.bytes(),m_sprite_gfx,m_spritepalettebank, machine(), bitmap, cliprect, 0, 0); //enemy
+ return 0;
+}
- if (chip == 0)
- code = state->m_spriteram1[map_start % (state->m_spriteram1.bytes()/2)];
- else
- code = state->m_spriteram2[map_start % (state->m_spriteram2.bytes()/2)];
+UINT32 aerofgt_state::screen_update_aerofgt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+{
+ m_bg1_tilemap->set_scrollx(0, m_rasterram[0x0000] - 18);
+ m_bg1_tilemap->set_scrolly(0, m_bg1scrolly);
+ m_bg2_tilemap->set_scrollx(0, m_rasterram[0x0200] - 20);
+ m_bg2_tilemap->set_scrolly(0, m_bg2scrolly);
- pdrawgfxzoom_transpen(bitmap,cliprect,machine.gfx[state->m_sprite_gfx + chip],
- code,
- color,
- flipx,flipy,
- sx,sy,
- zoomx << 11, zoomy << 11,
- machine.priority_bitmap,pri ? 0 : 2,15);
- map_start++;
- }
+ machine().priority_bitmap.fill(0, cliprect);
- if (xsize == 2) map_start += 1;
- if (xsize == 4) map_start += 3;
- if (xsize == 5) map_start += 2;
- if (xsize == 6) map_start += 1;
- }
- }
-}
+ m_bg1_tilemap->draw(bitmap, cliprect, 0, 0);
-static void spinlbrk_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int chip, int chip_disabled_pri )
-{
- aerofgt_state *state = machine.driver_data<aerofgt_state>();
- int attr_start, base, first;
- base = chip * 0x0200;
- first = 4 * state->m_spriteram3[0x1fe + base];
+ 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);
- for (attr_start = base + 0x0200-8; attr_start >= first + base; attr_start -= 4)
- {
- int map_start;
- int ox, oy, x, y, xsize, ysize, zoomx, zoomy, flipx, flipy, color, pri;
-// some other drivers still use this wrong table, they have to be upgraded
-// int zoomtable[16] = { 0,7,14,20,25,30,34,38,42,46,49,52,54,57,59,61 };
+ m_bg2_tilemap->draw(bitmap, cliprect, 0, 0);
- if (!(state->m_spriteram3[attr_start + 2] & 0x0080))
- continue;
+ 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);
+ return 0;
+}
- pri = state->m_spriteram3[attr_start + 2] & 0x0010;
- if ( chip_disabled_pri & !pri)
- continue;
- if ((!chip_disabled_pri) & (pri >> 4))
- continue;
+/***************************************************************************
- ox = state->m_spriteram3[attr_start + 1] & 0x01ff;
- xsize = (state->m_spriteram3[attr_start + 2] & 0x0700) >> 8;
- zoomx = (state->m_spriteram3[attr_start + 1] & 0xf000) >> 12;
- oy = state->m_spriteram3[attr_start + 0] & 0x01ff;
- ysize = (state->m_spriteram3[attr_start + 2] & 0x7000) >> 12;
- zoomy = (state->m_spriteram3[attr_start + 0] & 0xf000) >> 12;
- flipx = state->m_spriteram3[attr_start + 2] & 0x0800;
- flipy = state->m_spriteram3[attr_start + 2] & 0x8000;
- color = (state->m_spriteram3[attr_start + 2] & 0x000f) + 16 * state->m_spritepalettebank;
+ BOOTLEG SUPPORT
- map_start = state->m_spriteram3[attr_start + 3];
+***************************************************************************/
-// aerofgt has this adjustment, but doing it here would break turbo force title screen
-// ox += (xsize*zoomx+2)/4;
-// oy += (ysize*zoomy+2)/4;
+// BOOTLEG
+VIDEO_START_MEMBER(aerofgt_state,wbbc97)
+{
+ m_bg1_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(aerofgt_state::get_pspikes_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
+ /* no bg2 in this game */
- zoomx = 32 - zoomx;
- zoomy = 32 - zoomy;
+ m_bg1_tilemap->set_transparent_pen(15);
- for (y = 0; y <= ysize; y++)
- {
- int sx, sy;
+ m_sprite_gfx = 1;
- if (flipy)
- sy = ((oy + zoomy * (ysize - y)/2 + 16) & 0x1ff) - 16;
- else
- sy = ((oy + zoomy * y / 2 + 16) & 0x1ff) - 16;
+ aerofgt_register_state_globals(machine());
- for (x = 0; x <= xsize; x++)
- {
- int code;
+ save_item(NAME(m_wbbc97_bitmap_enable));
+}
- if (flipx)
- sx = ((ox + zoomx * (xsize - x) / 2 + 16) & 0x1ff) - 16;
- else
- sx = ((ox + zoomx * x / 2 + 16) & 0x1ff) - 16;
+// BOOTLEG
+WRITE16_MEMBER(aerofgt_state::pspikesb_gfxbank_w)
+{
+ COMBINE_DATA(&m_rasterram[0x200 / 2]);
- if (chip == 0)
- code = state->m_spriteram1[map_start % (state->m_spriteram1.bytes()/2)];
- else
- code = state->m_spriteram2[map_start % (state->m_spriteram2.bytes()/2)];
+ setbank(machine(), m_bg1_tilemap, 0, (data & 0xf000) >> 12);
+ setbank(machine(), m_bg1_tilemap, 1, (data & 0x0f00) >> 8);
+}
- pdrawgfxzoom_transpen(bitmap,cliprect,machine.gfx[state->m_sprite_gfx + chip],
- code,
- color,
- flipx,flipy,
- sx,sy,
- zoomx << 11, zoomy << 11,
- machine.priority_bitmap,pri ? 2 : 0,15);
- map_start++;
- }
+// BOOTLEG
+WRITE16_MEMBER(aerofgt_state::spikes91_lookup_w)
+{
+ m_spikes91_lookup = data & 1;
+}
- if (xsize == 2) map_start += 1;
- if (xsize == 4) map_start += 3;
- if (xsize == 5) map_start += 2;
- if (xsize == 6) map_start += 1;
- }
- }
+// BOOTLEG
+WRITE16_MEMBER(aerofgt_state::wbbc97_bitmap_enable_w)
+{
+ COMBINE_DATA(&m_wbbc97_bitmap_enable);
}
+// BOOTLEG
static void aerfboo2_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int chip, int chip_disabled_pri )
{
aerofgt_state *state = machine.driver_data<aerofgt_state>();
@@ -631,6 +517,7 @@ static void aerfboo2_draw_sprites( running_machine &machine, bitmap_ind16 &bitma
}
}
+// BOOTLEG
static void pspikesb_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
{
aerofgt_state *state = machine.driver_data<aerofgt_state>();
@@ -666,6 +553,7 @@ static void pspikesb_draw_sprites( running_machine &machine, bitmap_ind16 &bitma
}
}
+// BOOTLEG
static void spikes91_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
{
aerofgt_state *state = machine.driver_data<aerofgt_state>();
@@ -708,6 +596,7 @@ static void spikes91_draw_sprites( running_machine &machine, bitmap_ind16 &bitma
}
}
+// BOOTLEG
static void aerfboot_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
{
aerofgt_state *state = machine.driver_data<aerofgt_state>();
@@ -790,6 +679,7 @@ static void aerfboot_draw_sprites( running_machine &machine, bitmap_ind16 &bitma
}
}
+// BOOTLEG
static void wbbc97_draw_bitmap( running_machine &machine, bitmap_rgb32 &bitmap )
{
aerofgt_state *state = machine.driver_data<aerofgt_state>();
@@ -810,25 +700,7 @@ static void wbbc97_draw_bitmap( running_machine &machine, bitmap_rgb32 &bitmap )
}
}
-
-UINT32 aerofgt_state::screen_update_pspikes(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
-{
- int i, scrolly;
-
- m_bg1_tilemap->set_scroll_rows(256);
- scrolly = m_bg1scrolly;
- for (i = 0; i < 256; i++)
- m_bg1_tilemap->set_scrollx((i + scrolly) & 0xff, m_rasterram[i]);
- m_bg1_tilemap->set_scrolly(0, scrolly);
-
- machine().priority_bitmap.fill(0, cliprect);
-
- m_bg1_tilemap->draw(bitmap, cliprect, 0, 0);
- turbofrc_draw_sprites(machine(), bitmap, cliprect, 0, -1);
- turbofrc_draw_sprites(machine(), bitmap, cliprect, 0, 0);
- return 0;
-}
-
+// BOOTLEG
UINT32 aerofgt_state::screen_update_pspikesb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
int i, scrolly;
@@ -844,6 +716,7 @@ UINT32 aerofgt_state::screen_update_pspikesb(screen_device &screen, bitmap_ind16
return 0;
}
+// BOOTLEG
UINT32 aerofgt_state::screen_update_spikes91(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
int i, scrolly;
@@ -884,99 +757,7 @@ UINT32 aerofgt_state::screen_update_spikes91(screen_device &screen, bitmap_ind16
return 0;
}
-UINT32 aerofgt_state::screen_update_karatblz(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
-{
- m_bg1_tilemap->set_scrollx(0, m_bg1scrollx - 8);
- m_bg1_tilemap->set_scrolly(0, m_bg1scrolly);
- m_bg2_tilemap->set_scrollx(0, m_bg2scrollx - 4);
- m_bg2_tilemap->set_scrolly(0, m_bg2scrolly);
-
- machine().priority_bitmap.fill(0, cliprect);
-
- m_bg1_tilemap->draw(bitmap, cliprect, 0, 0);
- m_bg2_tilemap->draw(bitmap, cliprect, 0, 0);
-
- /* we use the priority buffer so sprites are drawn front to back */
- turbofrc_draw_sprites(machine(), bitmap, cliprect, 1, -1);
- turbofrc_draw_sprites(machine(), bitmap, cliprect, 1, 0);
- turbofrc_draw_sprites(machine(), bitmap, cliprect, 0, -1);
- turbofrc_draw_sprites(machine(), bitmap, cliprect, 0, 0);
- return 0;
-}
-
-UINT32 aerofgt_state::screen_update_spinlbrk(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
-{
- int i, scrolly;
-
- m_bg1_tilemap->set_scroll_rows(512);
- scrolly = 0;
- for (i = 0; i < 256; i++)
- m_bg1_tilemap->set_scrollx((i + scrolly) & 0x1ff, m_rasterram[i] - 8);
-// m_bg1_tilemap->set_scrolly(0, m_bg1scrolly);
- m_bg2_tilemap->set_scrollx(0, m_bg2scrollx - 4);
-// m_bg2_tilemap->set_scrolly(0, m_bg2scrolly);
-
- machine().priority_bitmap.fill(0, cliprect);
-
- m_bg1_tilemap->draw(bitmap, cliprect, 0, 0);
- m_bg2_tilemap->draw(bitmap, cliprect, 0, 1);
-
- /* we use the priority buffer so sprites are drawn front to back */
- spinlbrk_draw_sprites(machine(), bitmap, cliprect, 0, 0);
- spinlbrk_draw_sprites(machine(), bitmap, cliprect, 0, -1);
- spinlbrk_draw_sprites(machine(), bitmap, cliprect, 1, 0);
- spinlbrk_draw_sprites(machine(), bitmap, cliprect, 1, -1);
- return 0;
-}
-
-UINT32 aerofgt_state::screen_update_turbofrc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
-{
- int i, scrolly;
-
- m_bg1_tilemap->set_scroll_rows(512);
- scrolly = m_bg1scrolly + 2;
- for (i = 0; i < 256; i++)
-// m_bg1_tilemap->set_scrollx((i + scrolly) & 0x1ff, m_rasterram[i] - 11);
- m_bg1_tilemap->set_scrollx((i + scrolly) & 0x1ff, m_rasterram[7] - 11);
- m_bg1_tilemap->set_scrolly(0, scrolly);
- m_bg2_tilemap->set_scrollx(0, m_bg2scrollx - 7);
- m_bg2_tilemap->set_scrolly(0, m_bg2scrolly + 2);
-
- machine().priority_bitmap.fill(0, cliprect);
-
- m_bg1_tilemap->draw(bitmap, cliprect, 0, 0);
- m_bg2_tilemap->draw(bitmap, cliprect, 0, 1);
-
- /* we use the priority buffer so sprites are drawn front to back */
- turbofrc_draw_sprites(machine(), bitmap, cliprect, 1, -1); //ship
- turbofrc_draw_sprites(machine(), bitmap, cliprect, 1, 0); //intro
- turbofrc_draw_sprites(machine(), bitmap, cliprect, 0, -1); //enemy
- turbofrc_draw_sprites(machine(), bitmap, cliprect, 0, 0); //enemy
- return 0;
-}
-
-UINT32 aerofgt_state::screen_update_aerofgt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
-{
- m_bg1_tilemap->set_scrollx(0, m_rasterram[0x0000] - 18);
- m_bg1_tilemap->set_scrolly(0, m_bg1scrolly);
- m_bg2_tilemap->set_scrollx(0, m_rasterram[0x0200] - 20);
- m_bg2_tilemap->set_scrolly(0, m_bg2scrolly);
-
- machine().priority_bitmap.fill(0, cliprect);
-
- m_bg1_tilemap->draw(bitmap, cliprect, 0, 0);
-
- aerofgt_draw_sprites(machine(), bitmap, cliprect, 0);
- aerofgt_draw_sprites(machine(), bitmap, cliprect, 1);
-
- m_bg2_tilemap->draw(bitmap, cliprect, 0, 0);
-
- aerofgt_draw_sprites(machine(), bitmap, cliprect, 2);
- aerofgt_draw_sprites(machine(), bitmap, cliprect, 3);
- return 0;
-}
-
-
+// BOOTLEG
UINT32 aerofgt_state::screen_update_aerfboot(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
int i, scrolly;
@@ -999,6 +780,7 @@ UINT32 aerofgt_state::screen_update_aerfboot(screen_device &screen, bitmap_ind16
return 0;
}
+// BOOTLEG
UINT32 aerofgt_state::screen_update_aerfboo2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
int i, scrolly;
@@ -1025,6 +807,7 @@ UINT32 aerofgt_state::screen_update_aerfboo2(screen_device &screen, bitmap_ind16
return 0;
}
+// BOOTLEG (still uses original sprite type)
UINT32 aerofgt_state::screen_update_wbbc97(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
int i, scrolly;
@@ -1047,7 +830,7 @@ UINT32 aerofgt_state::screen_update_wbbc97(screen_device &screen, bitmap_rgb32 &
m_bg1_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0);
}
- turbofrc_draw_sprites(machine(), bitmap, cliprect, 0, -1);
- turbofrc_draw_sprites(machine(), bitmap, cliprect, 0, 0);
+ m_spr_old->turbofrc_draw_sprites(m_spriteram3,m_spriteram3.bytes(),m_spriteram1,m_spriteram1.bytes(),m_spriteram2,m_spriteram2.bytes(),m_sprite_gfx,m_spritepalettebank, machine(), bitmap, cliprect, 0, -1);
+ m_spr_old->turbofrc_draw_sprites(m_spriteram3,m_spriteram3.bytes(),m_spriteram1,m_spriteram1.bytes(),m_spriteram2,m_spriteram2.bytes(),m_sprite_gfx,m_spritepalettebank, machine(), bitmap, cliprect, 0, 0);
return 0;
}
diff --git a/src/mame/video/f1gp.c b/src/mame/video/f1gp.c
index 82146c285cb..46e09dd1661 100644
--- a/src/mame/video/f1gp.c
+++ b/src/mame/video/f1gp.c
@@ -163,78 +163,6 @@ WRITE16_MEMBER(f1gp_state::f1gp2_gfxctrl_w)
***************************************************************************/
-static void f1gp_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int chip, int primask )
-{
- f1gp_state *state = machine.driver_data<f1gp_state>();
- int attr_start, first;
- UINT16 *spram = chip ? state->m_spr2vram : state->m_spr1vram;
-
- first = 4 * spram[0x1fe];
-
- for (attr_start = 0x0200 - 8; attr_start >= first; attr_start -= 4)
- {
- int map_start;
- int ox, oy, x, y, xsize, ysize, zoomx, zoomy, flipx, flipy, color/*, pri*/;
- /* table hand made by looking at the ship explosion in attract mode */
- /* it's almost a logarithmic scale but not exactly */
- static const int zoomtable[16] = { 0,7,14,20,25,30,34,38,42,46,49,52,54,57,59,61 };
-
- if (!(spram[attr_start + 2] & 0x0080)) continue;
-
- ox = spram[attr_start + 1] & 0x01ff;
- xsize = (spram[attr_start + 2] & 0x0700) >> 8;
- zoomx = (spram[attr_start + 1] & 0xf000) >> 12;
- oy = spram[attr_start + 0] & 0x01ff;
- ysize = (spram[attr_start + 2] & 0x7000) >> 12;
- zoomy = (spram[attr_start + 0] & 0xf000) >> 12;
- flipx = spram[attr_start + 2] & 0x0800;
- flipy = spram[attr_start + 2] & 0x8000;
- color = (spram[attr_start + 2] & 0x000f);// + 16 * spritepalettebank;
- //pri = spram[attr_start + 2] & 0x0010;
- map_start = spram[attr_start + 3];
-
- zoomx = 16 - zoomtable[zoomx] / 8;
- zoomy = 16 - zoomtable[zoomy] / 8;
-
- for (y = 0; y <= ysize; y++)
- {
- int sx, sy;
-
- if (flipy) sy = ((oy + zoomy * (ysize - y) + 16) & 0x1ff) - 16;
- else sy = ((oy + zoomy * y + 16) & 0x1ff) - 16;
-
- for (x = 0; x <= xsize; x++)
- {
- int code;
-
- if (flipx) sx = ((ox + zoomx * (xsize - x) + 16) & 0x1ff) - 16;
- else sx = ((ox + zoomx * x + 16) & 0x1ff) - 16;
-
- if (chip == 0)
- code = state->m_spr1cgram[map_start % (state->m_spr1cgram.bytes() / 2)];
- else
- code = state->m_spr2cgram[map_start % (state->m_spr2cgram.bytes() / 2)];
-
- pdrawgfxzoom_transpen(bitmap,cliprect,machine.gfx[1 + chip],
- code,
- color,
- flipx,flipy,
- sx,sy,
- 0x1000 * zoomx,0x1000 * zoomy,
- machine.priority_bitmap,
-// pri ? 0 : 0x2);
- primask,15);
- map_start++;
- }
-
- if (xsize == 2) map_start += 1;
- if (xsize == 4) map_start += 3;
- if (xsize == 5) map_start += 2;
- if (xsize == 6) map_start += 1;
- }
- }
-}
-
UINT32 f1gp_state::screen_update_f1gp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
@@ -248,18 +176,58 @@ UINT32 f1gp_state::screen_update_f1gp(screen_device &screen, bitmap_ind16 &bitma
/* quick kludge for "continue" screen priority */
if (m_gfxctrl == 0x00)
{
- f1gp_draw_sprites(machine(), bitmap, cliprect, 0, 0x02);
- f1gp_draw_sprites(machine(), bitmap, cliprect, 1, 0x02);
+ m_spr_old->f1gp_draw_sprites(m_spr1vram, m_spr2vram, m_spr1cgram,m_spr1cgram.bytes(), m_spr2cgram, m_spr2cgram.bytes(), machine(), bitmap, cliprect, 0, 0x02);
+ m_spr_old->f1gp_draw_sprites(m_spr1vram, m_spr2vram, m_spr1cgram,m_spr1cgram.bytes(), m_spr2cgram, m_spr2cgram.bytes(), machine(), bitmap, cliprect, 1, 0x02);
}
else
{
- f1gp_draw_sprites(machine(), bitmap, cliprect, 0, 0x00);
- f1gp_draw_sprites(machine(), bitmap, cliprect, 1, 0x02);
+ m_spr_old->f1gp_draw_sprites(m_spr1vram, m_spr2vram, m_spr1cgram,m_spr1cgram.bytes(), m_spr2cgram, m_spr2cgram.bytes(), machine(), bitmap, cliprect, 0, 0x00);
+ m_spr_old->f1gp_draw_sprites(m_spr1vram, m_spr2vram, m_spr1cgram,m_spr1cgram.bytes(), m_spr2cgram, m_spr2cgram.bytes(), machine(), bitmap, cliprect, 1, 0x02);
}
return 0;
}
+UINT32 f1gp_state::screen_update_f1gp2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+{
+
+ if (m_gfxctrl & 4) /* blank screen */
+ bitmap.fill(get_black_pen(machine()), cliprect);
+ else
+ {
+ switch (m_gfxctrl & 3)
+ {
+ 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_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);
+ 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);
+ break;
+#ifdef MAME_DEBUG
+ case 3:
+ popmessage("unsupported priority 3\n");
+#endif
+ }
+ }
+ return 0;
+}
+
+/***************************************************************************
+
+ BOOTLEG SUPPORT
+
+***************************************************************************/
+
+// BOOTLEG
static void f1gpb_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect )
{
f1gp_state *state = machine.driver_data<f1gp_state>();
@@ -328,6 +296,7 @@ static void f1gpb_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap,c
}
}
+// BOOTLEG
UINT32 f1gp_state::screen_update_f1gpb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
UINT32 startx, starty;
@@ -355,108 +324,3 @@ UINT32 f1gp_state::screen_update_f1gpb(screen_device &screen, bitmap_ind16 &bitm
return 0;
}
-
-static void f1gp2_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
-{
- f1gp_state *state = machine.driver_data<f1gp_state>();
- int offs;
-
- offs = 0;
- while (offs < 0x0400 && (state->m_spritelist[offs] & 0x4000) == 0)
- {
- int attr_start;
- int map_start;
- int ox, oy, x, y, xsize, ysize, zoomx, zoomy, flipx, flipy, color;
-
- attr_start = 4 * (state->m_spritelist[offs++] & 0x01ff);
-
- ox = state->m_spritelist[attr_start + 1] & 0x01ff;
- xsize = (state->m_spritelist[attr_start + 1] & 0x0e00) >> 9;
- zoomx = (state->m_spritelist[attr_start + 1] & 0xf000) >> 12;
- oy = state->m_spritelist[attr_start + 0] & 0x01ff;
- ysize = (state->m_spritelist[attr_start + 0] & 0x0e00) >> 9;
- zoomy = (state->m_spritelist[attr_start + 0] & 0xf000) >> 12;
- flipx = state->m_spritelist[attr_start + 2] & 0x4000;
- flipy = state->m_spritelist[attr_start + 2] & 0x8000;
- color = (state->m_spritelist[attr_start + 2] & 0x1f00) >> 8;
- map_start = state->m_spritelist[attr_start + 3] & 0x7fff;
-
-// aerofgt has the following adjustment, but doing it here would break the title screen
-// ox += (xsize*zoomx+2)/4;
-// oy += (ysize*zoomy+2)/4;
-
- zoomx = 32 - zoomx;
- zoomy = 32 - zoomy;
-
- if (state->m_spritelist[attr_start + 2] & 0x20ff)
- color = machine.rand();
-
- for (y = 0; y <= ysize; y++)
- {
- int sx,sy;
-
- if (flipy) sy = ((oy + zoomy * (ysize - y)/2 + 16) & 0x1ff) - 16;
- else sy = ((oy + zoomy * y / 2 + 16) & 0x1ff) - 16;
-
- for (x = 0; x <= xsize; x++)
- {
- int code;
-
- if (flipx) sx = ((ox + zoomx * (xsize - x) / 2 + 16) & 0x1ff) - 16;
- else sx = ((ox + zoomx * x / 2 + 16) & 0x1ff) - 16;
-
- code = state->m_sprcgram[map_start & 0x3fff];
- map_start++;
-
- if (state->m_flipscreen)
- drawgfxzoom_transpen(bitmap,cliprect,machine.gfx[1],
- code,
- color,
- !flipx,!flipy,
- 304-sx,208-sy,
- zoomx << 11,zoomy << 11,15);
- else
- drawgfxzoom_transpen(bitmap,cliprect,machine.gfx[1],
- code,
- color,
- flipx,flipy,
- sx,sy,
- zoomx << 11,zoomy << 11,15);
- }
- }
- }
-}
-
-
-UINT32 f1gp_state::screen_update_f1gp2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
-{
-
- if (m_gfxctrl & 4) /* blank screen */
- bitmap.fill(get_black_pen(machine()), cliprect);
- else
- {
- switch (m_gfxctrl & 3)
- {
- case 0:
- k053936_zoom_draw(m_k053936, bitmap, cliprect, m_roz_tilemap, TILEMAP_DRAW_OPAQUE, 0, 1);
- f1gp2_draw_sprites(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);
- f1gp2_draw_sprites(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);
- f1gp2_draw_sprites(machine(), bitmap, cliprect);
- break;
-#ifdef MAME_DEBUG
- case 3:
- popmessage("unsupported priority 3\n");
-#endif
- }
- }
- return 0;
-}
diff --git a/src/mame/video/fromance.c b/src/mame/video/fromance.c
index 693c3cd0baa..594a44eae33 100644
--- a/src/mame/video/fromance.c
+++ b/src/mame/video/fromance.c
@@ -284,123 +284,6 @@ WRITE8_MEMBER(fromance_state::fromance_crtc_register_w)
-/*************************************
- *
- * Sprite routines (Pipe Dream)
- *
- *************************************/
-
-static void draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int draw_priority )
-{
- fromance_state *state = screen.machine().driver_data<fromance_state>();
- static const UINT8 zoomtable[16] = { 0,7,14,20,25,30,34,38,42,46,49,52,54,57,59,61 };
- const rectangle &visarea = screen.visible_area();
- UINT8 *spriteram = state->m_spriteram;
- int offs;
-
- /* draw the sprites */
- for (offs = 0; offs < state->m_spriteram.bytes(); offs += 8)
- {
- int data2 = spriteram[offs + 4] | (spriteram[offs + 5] << 8);
- int priority = (data2 >> 4) & 1;
-
- /* turns out the sprites are the same as in aerofgt.c */
- if ((data2 & 0x80) && priority == draw_priority)
- {
- int data0 = spriteram[offs + 0] | (spriteram[offs + 1] << 8);
- int data1 = spriteram[offs + 2] | (spriteram[offs + 3] << 8);
- int data3 = spriteram[offs + 6] | (spriteram[offs + 7] << 8);
- int code = data3 & 0xfff;
- int color = data2 & 0x0f;
- int y = (data0 & 0x1ff) - 6;
- int x = (data1 & 0x1ff) - 13;
- int yzoom = (data0 >> 12) & 15;
- int xzoom = (data1 >> 12) & 15;
- int zoomed = (xzoom | yzoom);
- int ytiles = ((data2 >> 12) & 7) + 1;
- int xtiles = ((data2 >> 8) & 7) + 1;
- int yflip = (data2 >> 15) & 1;
- int xflip = (data2 >> 11) & 1;
- int xt, yt;
-
- /* compute the zoom factor -- stolen from aerofgt.c */
- xzoom = 16 - zoomtable[xzoom] / 8;
- yzoom = 16 - zoomtable[yzoom] / 8;
-
- /* wrap around */
- if (x > visarea.max_x)
- x -= 0x200;
- if (y > visarea.max_y)
- y -= 0x200;
-
- /* flip ? */
- if (state->m_flipscreen)
- {
- y = visarea.max_y - y - 16 * ytiles - 4;
- x = visarea.max_x - x - 16 * xtiles - 24;
- xflip=!xflip;
- yflip=!yflip;
- }
-
- /* normal case */
- if (!xflip && !yflip)
- {
- for (yt = 0; yt < ytiles; yt++)
- for (xt = 0; xt < xtiles; xt++, code++)
- if (!zoomed)
- drawgfx_transpen(bitmap, cliprect, screen.machine().gfx[2], code, color, 0, 0,
- x + xt * 16, y + yt * 16, 15);
- else
- drawgfxzoom_transpen(bitmap, cliprect, screen.machine().gfx[2], code, color, 0, 0,
- x + xt * xzoom, y + yt * yzoom,
- 0x1000 * xzoom, 0x1000 * yzoom, 15);
- }
-
- /* xflipped case */
- else if (xflip && !yflip)
- {
- for (yt = 0; yt < ytiles; yt++)
- for (xt = 0; xt < xtiles; xt++, code++)
- if (!zoomed)
- drawgfx_transpen(bitmap, cliprect, screen.machine().gfx[2], code, color, 1, 0,
- x + (xtiles - 1 - xt) * 16, y + yt * 16, 15);
- else
- drawgfxzoom_transpen(bitmap, cliprect, screen.machine().gfx[2], code, color, 1, 0,
- x + (xtiles - 1 - xt) * xzoom, y + yt * yzoom,
- 0x1000 * xzoom, 0x1000 * yzoom, 15);
- }
-
- /* yflipped case */
- else if (!xflip && yflip)
- {
- for (yt = 0; yt < ytiles; yt++)
- for (xt = 0; xt < xtiles; xt++, code++)
- if (!zoomed)
- drawgfx_transpen(bitmap, cliprect, screen.machine().gfx[2], code, color, 0, 1,
- x + xt * 16, y + (ytiles - 1 - yt) * 16, 15);
- else
- drawgfxzoom_transpen(bitmap, cliprect, screen.machine().gfx[2], code, color, 0, 1,
- x + xt * xzoom, y + (ytiles - 1 - yt) * yzoom,
- 0x1000 * xzoom, 0x1000 * yzoom, 15);
- }
-
- /* x & yflipped case */
- else
- {
- for (yt = 0; yt < ytiles; yt++)
- for (xt = 0; xt < xtiles; xt++, code++)
- if (!zoomed)
- drawgfx_transpen(bitmap, cliprect, screen.machine().gfx[2], code, color, 1, 1,
- x + (xtiles - 1 - xt) * 16, y + (ytiles - 1 - yt) * 16, 15);
- else
- drawgfxzoom_transpen(bitmap, cliprect, screen.machine().gfx[2], code, color, 1, 1,
- x + (xtiles - 1 - xt) * xzoom, y + (ytiles - 1 - yt) * yzoom,
- 0x1000 * xzoom, 0x1000 * yzoom, 15);
- }
- }
- }
-}
-
/*************************************
@@ -433,7 +316,7 @@ UINT32 fromance_state::screen_update_pipedrm(screen_device &screen, bitmap_ind16
m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
m_fg_tilemap->draw(bitmap, cliprect, 0, 0);
- draw_sprites(screen, bitmap, cliprect, 0);
- draw_sprites(screen, bitmap, cliprect, 1);
+ m_spr_old->draw_sprites_pipedrm(m_spriteram, m_spriteram.bytes(), m_flipscreen, screen, bitmap, cliprect, 0);
+ m_spr_old->draw_sprites_pipedrm(m_spriteram, m_spriteram.bytes(), m_flipscreen, screen, bitmap, cliprect, 1);
return 0;
}
diff --git a/src/mame/video/vsystem_spr.c b/src/mame/video/vsystem_spr.c
index 68f18f8a48b..9403714b9a8 100644
--- a/src/mame/video/vsystem_spr.c
+++ b/src/mame/video/vsystem_spr.c
@@ -1,10 +1,20 @@
// Video System Sprites
// todo:
-// move various vsystem sprite functions here
-// unify common ones + convert to device (secondary stage tile lookup differs between games, use callback)
+// unify these functions (secondary stage tile lookup differs between games, use callback)
// according to gstriker this is probably the Fujitsu CG10103
+// Aero Fighters (newer hardware)
+// Quiz & Variety Sukusuku Inufuku
+// 3 On 3 Dunk Madness
+// Super Slams
+// Formula 1 Grand Prix 2
+// (Lethal) Crash Race
+// Grand Striker
+// V Goal Soccer
+// Tecmo World Cup '94
+// Tao Taido
+
#include "emu.h"
#include "vsystem_spr.h"
@@ -401,6 +411,148 @@ void vsystem_spr_device::draw_sprites_crshrace(UINT16* spriteram, int spriteram_
+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 priority )
+{
+ int offs;
+ priority <<= 12;
+
+ offs = 0;
+ while (offs < 0x0400 && (spriteram3[offs] & 0x8000) == 0)
+ {
+ int attr_start = 4 * (spriteram3[offs] & 0x03ff);
+
+ /* is the way I handle priority correct? Or should I just check bit 13? */
+ if ((spriteram3[attr_start + 2] & 0x3000) == priority)
+ {
+ int map_start;
+ int ox, oy, x, y, xsize, ysize, zoomx, zoomy, flipx, flipy, color;
+
+ ox = spriteram3[attr_start + 1] & 0x01ff;
+ xsize = (spriteram3[attr_start + 1] & 0x0e00) >> 9;
+ zoomx = (spriteram3[attr_start + 1] & 0xf000) >> 12;
+ oy = spriteram3[attr_start + 0] & 0x01ff;
+ ysize = (spriteram3[attr_start + 0] & 0x0e00) >> 9;
+ zoomy = (spriteram3[attr_start + 0] & 0xf000) >> 12;
+ flipx = spriteram3[attr_start + 2] & 0x4000;
+ flipy = spriteram3[attr_start + 2] & 0x8000;
+ color = (spriteram3[attr_start + 2] & 0x0f00) >> 8;
+ map_start = spriteram3[attr_start + 3] & 0x3fff;
+
+ ox += (xsize * zoomx + 2) / 4;
+ oy += (ysize * zoomy + 2) / 4;
+
+ zoomx = 32 - zoomx;
+ zoomy = 32 - zoomy;
+
+ for (y = 0; y <= ysize; y++)
+ {
+ int sx, sy;
+
+ if (flipy)
+ sy = ((oy + zoomy * (ysize - y)/2 + 16) & 0x1ff) - 16;
+ else
+ sy = ((oy + zoomy * y / 2 + 16) & 0x1ff) - 16;
+
+ for (x = 0; x <= xsize; x++)
+ {
+ int code;
+
+ if (flipx)
+ sx = ((ox + zoomx * (xsize - x) / 2 + 16) & 0x1ff) - 16;
+ else
+ sx = ((ox + zoomx * x / 2 + 16) & 0x1ff) - 16;
+
+ if (map_start < 0x2000)
+ code = spriteram1[map_start & 0x1fff] & 0x1fff;
+ else
+ code = spriteram2[map_start & 0x1fff] & 0x1fff;
+
+ drawgfxzoom_transpen(bitmap,cliprect,machine.gfx[2 + (map_start >= 0x2000 ? 1 : 0)],
+ code,
+ color,
+ flipx,flipy,
+ sx,sy,
+ zoomx << 11, zoomy << 11,15);
+ map_start++;
+ }
+ }
+ }
+ offs++;
+ }
+}
+
+
+void vsystem_spr_device::f1gp2_draw_sprites(UINT16* spritelist, UINT16* sprcgram, 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;
+ int map_start;
+ int ox, oy, x, y, xsize, ysize, zoomx, zoomy, flipx, flipy, color;
+
+ attr_start = 4 * (spritelist[offs++] & 0x01ff);
+
+ ox = spritelist[attr_start + 1] & 0x01ff;
+ xsize = (spritelist[attr_start + 1] & 0x0e00) >> 9;
+ zoomx = (spritelist[attr_start + 1] & 0xf000) >> 12;
+ oy = spritelist[attr_start + 0] & 0x01ff;
+ ysize = (spritelist[attr_start + 0] & 0x0e00) >> 9;
+ zoomy = (spritelist[attr_start + 0] & 0xf000) >> 12;
+ flipx = spritelist[attr_start + 2] & 0x4000;
+ flipy = spritelist[attr_start + 2] & 0x8000;
+ color = (spritelist[attr_start + 2] & 0x1f00) >> 8;
+ map_start = spritelist[attr_start + 3] & 0x7fff;
+
+// aerofgt has the following adjustment, but doing it here would break the title screen
+// ox += (xsize*zoomx+2)/4;
+// oy += (ysize*zoomy+2)/4;
+
+ zoomx = 32 - zoomx;
+ zoomy = 32 - zoomy;
+
+ if (spritelist[attr_start + 2] & 0x20ff)
+ color = machine.rand();
+
+ for (y = 0; y <= ysize; y++)
+ {
+ int sx,sy;
+
+ if (flipy) sy = ((oy + zoomy * (ysize - y)/2 + 16) & 0x1ff) - 16;
+ else sy = ((oy + zoomy * y / 2 + 16) & 0x1ff) - 16;
+
+ for (x = 0; x <= xsize; x++)
+ {
+ int code;
+
+ if (flipx) sx = ((ox + zoomx * (xsize - x) / 2 + 16) & 0x1ff) - 16;
+ else sx = ((ox + zoomx * x / 2 + 16) & 0x1ff) - 16;
+
+ code = sprcgram[map_start & 0x3fff];
+ map_start++;
+
+ if (flipscreen)
+ drawgfxzoom_transpen(bitmap,cliprect,machine.gfx[1],
+ code,
+ color,
+ !flipx,!flipy,
+ 304-sx,208-sy,
+ zoomx << 11,zoomy << 11,15);
+ else
+ drawgfxzoom_transpen(bitmap,cliprect,machine.gfx[1],
+ code,
+ color,
+ flipx,flipy,
+ sx,sy,
+ zoomx << 11,zoomy << 11,15);
+ }
+ }
+ }
+}
+
+
/*** Fujitsu CG10103 **********************************************/
/*
diff --git a/src/mame/video/vsystem_spr.h b/src/mame/video/vsystem_spr.h
index ab95c92b10c..38fa40f3976 100644
--- a/src/mame/video/vsystem_spr.h
+++ b/src/mame/video/vsystem_spr.h
@@ -25,6 +25,8 @@ public:
void draw_sprites_suprslam( UINT16* spriteram, int spriteram_bytes, UINT16* spriteram2, running_machine &machine, 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 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);
diff --git a/src/mame/video/vsystem_spr2.c b/src/mame/video/vsystem_spr2.c
new file mode 100644
index 00000000000..b4696264c11
--- /dev/null
+++ b/src/mame/video/vsystem_spr2.c
@@ -0,0 +1,525 @@
+// Video System Sprites (type 2)
+// todo:
+// move various vsystem sprite functions here
+// unify common ones + convert to device
+
+// this is probably the VS 8904/8905 combo
+
+// Spinal Breakers
+// Power Spikes
+// Karate Blazers
+// Turbo Force
+// Aero Fighters (older hardware types)
+// World Beach Championships 97 (modern Power Spikes bootleg, not original hw)
+// Welltris
+// Formula 1 Grand Prix (1)
+// Pipe Dream
+
+
+#include "emu.h"
+#include "vsystem_spr2.h"
+
+
+const device_type VSYSTEM_SPR2 = &device_creator<vsystem_spr2_device>;
+
+vsystem_spr2_device::vsystem_spr2_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : device_t(mconfig, VSYSTEM_SPR2, "vsystem_spr2_device", tag, owner, clock)
+{
+}
+
+
+
+void vsystem_spr2_device::device_start()
+{
+
+}
+
+void vsystem_spr2_device::device_reset()
+{
+
+}
+
+
+
+
+template<class _BitmapClass>
+void vsystem_spr2_device::turbofrc_draw_sprites_common( UINT16* spriteram3, int spriteram3_bytes, UINT16* spriteram1, int spriteram1_bytes, UINT16* spriteram2, int spriteram2_bytes, int sprite_gfx, int spritepalettebank, running_machine &machine, _BitmapClass &bitmap, const rectangle &cliprect, int chip, int chip_disabled_pri )
+{
+ int attr_start, base, first;
+ base = chip * 0x0200;
+ first = 4 * spriteram3[0x1fe + base];
+
+ for (attr_start = base + 0x0200 - 8; attr_start >= first + base; attr_start -= 4)
+ {
+ int map_start;
+ int ox, oy, x, y, xsize, ysize, zoomx, zoomy, flipx, flipy, color, pri;
+// some other drivers still use this wrong table, they have to be upgraded
+// int zoomtable[16] = { 0,7,14,20,25,30,34,38,42,46,49,52,54,57,59,61 };
+
+ if (!(spriteram3[attr_start + 2] & 0x0080))
+ continue;
+
+ pri = spriteram3[attr_start + 2] & 0x0010;
+
+ if ( chip_disabled_pri & !pri)
+ continue;
+
+ if ((!chip_disabled_pri) & (pri >> 4))
+ continue;
+
+ ox = spriteram3[attr_start + 1] & 0x01ff;
+ xsize = (spriteram3[attr_start + 2] & 0x0700) >> 8;
+ zoomx = (spriteram3[attr_start + 1] & 0xf000) >> 12;
+ oy = spriteram3[attr_start + 0] & 0x01ff;
+ ysize = (spriteram3[attr_start + 2] & 0x7000) >> 12;
+ zoomy = (spriteram3[attr_start + 0] & 0xf000) >> 12;
+ flipx = spriteram3[attr_start + 2] & 0x0800;
+ flipy = spriteram3[attr_start + 2] & 0x8000;
+ color = (spriteram3[attr_start + 2] & 0x000f) + 16 * spritepalettebank;
+
+ map_start = spriteram3[attr_start + 3];
+
+// aerofgt has this adjustment, but doing it here would break turbo force title screen
+// ox += (xsize*zoomx+2)/4;
+// oy += (ysize*zoomy+2)/4;
+
+ zoomx = 32 - zoomx;
+ zoomy = 32 - zoomy;
+
+ for (y = 0; y <= ysize; y++)
+ {
+ int sx, sy;
+
+ if (flipy)
+ sy = ((oy + zoomy * (ysize - y)/2 + 16) & 0x1ff) - 16;
+ else
+ sy = ((oy + zoomy * y / 2 + 16) & 0x1ff) - 16;
+
+ for (x = 0; x <= xsize; x++)
+ {
+ int code;
+
+ if (flipx)
+ sx = ((ox + zoomx * (xsize - x) / 2 + 16) & 0x1ff) - 16;
+ else
+ sx = ((ox + zoomx * x / 2 + 16) & 0x1ff) - 16;
+
+ if (chip == 0)
+ code = spriteram1[map_start % (spriteram1_bytes/2)];
+ else
+ code = spriteram2[map_start % (spriteram2_bytes/2)];
+
+ pdrawgfxzoom_transpen(bitmap,cliprect,machine.gfx[sprite_gfx + chip],
+ code,
+ color,
+ flipx,flipy,
+ sx,sy,
+ zoomx << 11, zoomy << 11,
+ machine.priority_bitmap,pri ? 0 : 2,15);
+ map_start++;
+ }
+
+ if (xsize == 2) map_start += 1;
+ if (xsize == 4) map_start += 3;
+ if (xsize == 5) map_start += 2;
+ if (xsize == 6) map_start += 1;
+ }
+ }
+}
+
+void vsystem_spr2_device::turbofrc_draw_sprites( UINT16* spriteram3, int spriteram3_bytes, UINT16* spriteram1, int spriteram1_bytes, UINT16* spriteram2, int spriteram2_bytes, int sprite_gfx, int spritepalettebank, running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int chip, int chip_disabled_pri )
+{ turbofrc_draw_sprites_common( spriteram3, spriteram3_bytes, spriteram1, spriteram1_bytes, spriteram2, spriteram2_bytes, sprite_gfx, spritepalettebank, machine, bitmap, cliprect, chip, chip_disabled_pri ); }
+
+void vsystem_spr2_device::turbofrc_draw_sprites( UINT16* spriteram3, int spriteram3_bytes, UINT16* spriteram1, int spriteram1_bytes, UINT16* spriteram2, int spriteram2_bytes, int sprite_gfx, int spritepalettebank, running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, int chip, int chip_disabled_pri )
+{ turbofrc_draw_sprites_common( spriteram3, spriteram3_bytes, spriteram1, spriteram1_bytes, spriteram2, spriteram2_bytes, sprite_gfx, spritepalettebank, machine, bitmap, cliprect, chip, chip_disabled_pri ); }
+
+
+template<class _BitmapClass>
+void vsystem_spr2_device::spinlbrk_draw_sprites_common( UINT16* spriteram3, int spriteram3_bytes, UINT16* spriteram1, int spriteram1_bytes, UINT16* spriteram2, int spriteram2_bytes, int sprite_gfx, int spritepalettebank, running_machine &machine, _BitmapClass &bitmap, const rectangle &cliprect, int chip, int chip_disabled_pri )
+{
+ int attr_start, base, first;
+ base = chip * 0x0200;
+ first = 4 * spriteram3[0x1fe + base];
+
+ for (attr_start = base + 0x0200-8; attr_start >= first + base; attr_start -= 4)
+ {
+ int map_start;
+ int ox, oy, x, y, xsize, ysize, zoomx, zoomy, flipx, flipy, color, pri;
+// some other drivers still use this wrong table, they have to be upgraded
+// int zoomtable[16] = { 0,7,14,20,25,30,34,38,42,46,49,52,54,57,59,61 };
+
+ if (!(spriteram3[attr_start + 2] & 0x0080))
+ continue;
+
+ pri = spriteram3[attr_start + 2] & 0x0010;
+
+ if ( chip_disabled_pri & !pri)
+ continue;
+ if ((!chip_disabled_pri) & (pri >> 4))
+ continue;
+
+ ox = spriteram3[attr_start + 1] & 0x01ff;
+ xsize = (spriteram3[attr_start + 2] & 0x0700) >> 8;
+ zoomx = (spriteram3[attr_start + 1] & 0xf000) >> 12;
+ oy = spriteram3[attr_start + 0] & 0x01ff;
+ ysize = (spriteram3[attr_start + 2] & 0x7000) >> 12;
+ zoomy = (spriteram3[attr_start + 0] & 0xf000) >> 12;
+ flipx = spriteram3[attr_start + 2] & 0x0800;
+ flipy = spriteram3[attr_start + 2] & 0x8000;
+ color = (spriteram3[attr_start + 2] & 0x000f) + 16 * spritepalettebank;
+
+ map_start = spriteram3[attr_start + 3];
+
+// aerofgt has this adjustment, but doing it here would break turbo force title screen
+// ox += (xsize*zoomx+2)/4;
+// oy += (ysize*zoomy+2)/4;
+
+ zoomx = 32 - zoomx;
+ zoomy = 32 - zoomy;
+
+ for (y = 0; y <= ysize; y++)
+ {
+ int sx, sy;
+
+ if (flipy)
+ sy = ((oy + zoomy * (ysize - y)/2 + 16) & 0x1ff) - 16;
+ else
+ sy = ((oy + zoomy * y / 2 + 16) & 0x1ff) - 16;
+
+ for (x = 0; x <= xsize; x++)
+ {
+ int code;
+
+ if (flipx)
+ sx = ((ox + zoomx * (xsize - x) / 2 + 16) & 0x1ff) - 16;
+ else
+ sx = ((ox + zoomx * x / 2 + 16) & 0x1ff) - 16;
+
+ if (chip == 0)
+ code = spriteram1[map_start % (spriteram1_bytes/2)];
+ else
+ code = spriteram2[map_start % (spriteram2_bytes/2)];
+
+ pdrawgfxzoom_transpen(bitmap,cliprect,machine.gfx[sprite_gfx + chip],
+ code,
+ color,
+ flipx,flipy,
+ sx,sy,
+ zoomx << 11, zoomy << 11,
+ machine.priority_bitmap,pri ? 2 : 0,15);
+ map_start++;
+ }
+
+ if (xsize == 2) map_start += 1;
+ if (xsize == 4) map_start += 3;
+ if (xsize == 5) map_start += 2;
+ if (xsize == 6) map_start += 1;
+ }
+ }
+}
+
+void vsystem_spr2_device::spinlbrk_draw_sprites( UINT16* spriteram3, int spriteram3_bytes, UINT16* spriteram1, int spriteram1_bytes, UINT16* spriteram2, int spriteram2_bytes, int sprite_gfx, int spritepalettebank, running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int chip, int chip_disabled_pri )
+{ spinlbrk_draw_sprites_common( spriteram3, spriteram3_bytes, spriteram1, spriteram1_bytes, spriteram2, spriteram2_bytes, sprite_gfx, spritepalettebank, machine, bitmap, cliprect, chip, chip_disabled_pri ); }
+
+void vsystem_spr2_device::spinlbrk_draw_sprites( UINT16* spriteram3, int spriteram3_bytes, UINT16* spriteram1, int spriteram1_bytes, UINT16* spriteram2, int spriteram2_bytes, int sprite_gfx, int spritepalettebank, running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, int chip, int chip_disabled_pri )
+{ spinlbrk_draw_sprites_common( spriteram3, spriteram3_bytes, spriteram1, spriteram1_bytes, spriteram2, spriteram2_bytes, sprite_gfx, spritepalettebank, machine, bitmap, cliprect, chip, chip_disabled_pri ); }
+
+
+
+// like above but no secondary indirection?
+void vsystem_spr2_device::welltris_draw_sprites( UINT16* spriteram, int spritepalettebank, running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect)
+{
+ static const UINT8 zoomtable[16] = { 0,7,14,20,25,30,34,38,42,46,49,52,54,57,59,61 };
+ int offs;
+ const rectangle &visarea = machine.primary_screen->visible_area();
+
+ /* draw the sprites */
+ for (offs = 0; offs < 0x200 - 4; offs += 4) {
+ int data0 = spriteram[offs + 0];
+ int data1 = spriteram[offs + 1];
+ int data2 = spriteram[offs + 2];
+ int data3 = spriteram[offs + 3];
+ int code = data3 & 0x1fff;
+ int color = (data2 & 0x0f) + (0x10 * spritepalettebank);
+ int y = (data0 & 0x1ff) + 1;
+ int x = (data1 & 0x1ff) + 6;
+ int yzoom = (data0 >> 12) & 15;
+ int xzoom = (data1 >> 12) & 15;
+ int zoomed = (xzoom | yzoom);
+ int ytiles = ((data2 >> 12) & 7) + 1;
+ int xtiles = ((data2 >> 8) & 7) + 1;
+ int yflip = (data2 >> 15) & 1;
+ int xflip = (data2 >> 11) & 1;
+ int xt, yt;
+
+ if (!(spriteram[offs + 2] & 0x0080)) continue;
+
+ /* compute the zoom factor -- stolen from aerofgt.c */
+ xzoom = 16 - zoomtable[xzoom] / 8;
+ yzoom = 16 - zoomtable[yzoom] / 8;
+
+ /* wrap around */
+ if (x > visarea.max_x) x -= 0x200;
+ if (y > visarea.max_y) y -= 0x200;
+
+ /* normal case */
+ if (!xflip && !yflip) {
+ for (yt = 0; yt < ytiles; yt++) {
+ for (xt = 0; xt < xtiles; xt++, code++) {
+ if (!zoomed)
+ drawgfx_transpen(bitmap, cliprect, machine.gfx[1], code, color, 0, 0,
+ x + xt * 16, y + yt * 16, 15);
+ else
+ drawgfxzoom_transpen(bitmap, cliprect, machine.gfx[1], code, color, 0, 0,
+ x + xt * xzoom, y + yt * yzoom,
+ 0x1000 * xzoom, 0x1000 * yzoom, 15);
+ }
+ if (xtiles == 3) code += 1;
+ if (xtiles == 5) code += 3;
+ if (xtiles == 6) code += 2;
+ if (xtiles == 7) code += 1;
+ }
+ }
+
+ /* xflipped case */
+ else if (xflip && !yflip) {
+ for (yt = 0; yt < ytiles; yt++) {
+ for (xt = 0; xt < xtiles; xt++, code++) {
+ if (!zoomed)
+ drawgfx_transpen(bitmap, cliprect, machine.gfx[1], code, color, 1, 0,
+ x + (xtiles - 1 - xt) * 16, y + yt * 16, 15);
+ else
+ drawgfxzoom_transpen(bitmap, cliprect, machine.gfx[1], code, color, 1, 0,
+ x + (xtiles - 1 - xt) * xzoom, y + yt * yzoom,
+ 0x1000 * xzoom, 0x1000 * yzoom, 15);
+ }
+ if (xtiles == 3) code += 1;
+ if (xtiles == 5) code += 3;
+ if (xtiles == 6) code += 2;
+ if (xtiles == 7) code += 1;
+ }
+ }
+
+ /* yflipped case */
+ else if (!xflip && yflip) {
+ for (yt = 0; yt < ytiles; yt++) {
+ for (xt = 0; xt < xtiles; xt++, code++) {
+ if (!zoomed)
+ drawgfx_transpen(bitmap, cliprect, machine.gfx[1], code, color, 0, 1,
+ x + xt * 16, y + (ytiles - 1 - yt) * 16, 15);
+ else
+ drawgfxzoom_transpen(bitmap, cliprect, machine.gfx[1], code, color, 0, 1,
+ x + xt * xzoom, y + (ytiles - 1 - yt) * yzoom,
+ 0x1000 * xzoom, 0x1000 * yzoom, 15);
+ }
+ if (xtiles == 3) code += 1;
+ if (xtiles == 5) code += 3;
+ if (xtiles == 6) code += 2;
+ if (xtiles == 7) code += 1;
+ }
+ }
+
+ /* x & yflipped case */
+ else {
+ for (yt = 0; yt < ytiles; yt++) {
+ for (xt = 0; xt < xtiles; xt++, code++) {
+ if (!zoomed)
+ drawgfx_transpen(bitmap, cliprect, machine.gfx[1], code, color, 1, 1,
+ x + (xtiles - 1 - xt) * 16, y + (ytiles - 1 - yt) * 16, 15);
+ else
+ drawgfxzoom_transpen(bitmap, cliprect, machine.gfx[1], code, color, 1, 1,
+ x + (xtiles - 1 - xt) * xzoom, y + (ytiles - 1 - yt) * yzoom,
+ 0x1000 * xzoom, 0x1000 * yzoom, 15);
+ }
+ if (xtiles == 3) code += 1;
+ if (xtiles == 5) code += 3;
+ if (xtiles == 6) code += 2;
+ if (xtiles == 7) code += 1;
+ }
+ }
+ }
+}
+
+
+
+void vsystem_spr2_device::f1gp_draw_sprites( UINT16* spr1vram, UINT16* spr2vram, UINT16* spr1cgram, int spr1cgram_bytes, UINT16* spr2cgram, int spr2cgram_bytes, running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int chip, int primask )
+{
+ int attr_start, first;
+ UINT16 *spram = chip ? spr2vram : spr1vram;
+
+ first = 4 * spram[0x1fe];
+
+ for (attr_start = 0x0200 - 8; attr_start >= first; attr_start -= 4)
+ {
+ int map_start;
+ int ox, oy, x, y, xsize, ysize, zoomx, zoomy, flipx, flipy, color/*, pri*/;
+ /* table hand made by looking at the ship explosion in attract mode */
+ /* it's almost a logarithmic scale but not exactly */
+ static const int zoomtable[16] = { 0,7,14,20,25,30,34,38,42,46,49,52,54,57,59,61 };
+
+ if (!(spram[attr_start + 2] & 0x0080)) continue;
+
+ ox = spram[attr_start + 1] & 0x01ff;
+ xsize = (spram[attr_start + 2] & 0x0700) >> 8;
+ zoomx = (spram[attr_start + 1] & 0xf000) >> 12;
+ oy = spram[attr_start + 0] & 0x01ff;
+ ysize = (spram[attr_start + 2] & 0x7000) >> 12;
+ zoomy = (spram[attr_start + 0] & 0xf000) >> 12;
+ flipx = spram[attr_start + 2] & 0x0800;
+ flipy = spram[attr_start + 2] & 0x8000;
+ color = (spram[attr_start + 2] & 0x000f);// + 16 * spritepalettebank;
+ //pri = spram[attr_start + 2] & 0x0010;
+ map_start = spram[attr_start + 3];
+
+ zoomx = 16 - zoomtable[zoomx] / 8;
+ zoomy = 16 - zoomtable[zoomy] / 8;
+
+ for (y = 0; y <= ysize; y++)
+ {
+ int sx, sy;
+
+ if (flipy) sy = ((oy + zoomy * (ysize - y) + 16) & 0x1ff) - 16;
+ else sy = ((oy + zoomy * y + 16) & 0x1ff) - 16;
+
+ for (x = 0; x <= xsize; x++)
+ {
+ int code;
+
+ if (flipx) sx = ((ox + zoomx * (xsize - x) + 16) & 0x1ff) - 16;
+ else sx = ((ox + zoomx * x + 16) & 0x1ff) - 16;
+
+ if (chip == 0)
+ code = spr1cgram[map_start % (spr1cgram_bytes / 2)];
+ else
+ code = spr2cgram[map_start % (spr2cgram_bytes / 2)];
+
+ pdrawgfxzoom_transpen(bitmap,cliprect,machine.gfx[1 + chip],
+ code,
+ color,
+ flipx,flipy,
+ sx,sy,
+ 0x1000 * zoomx,0x1000 * zoomy,
+ machine.priority_bitmap,
+// pri ? 0 : 0x2);
+ primask,15);
+ map_start++;
+ }
+
+ if (xsize == 2) map_start += 1;
+ if (xsize == 4) map_start += 3;
+ if (xsize == 5) map_start += 2;
+ if (xsize == 6) map_start += 1;
+ }
+ }
+}
+
+// the same but for an 8-bit system..
+void vsystem_spr2_device::draw_sprites_pipedrm( UINT8* spriteram, int spriteram_bytes, int flipscreen, screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int draw_priority )
+{
+ static const UINT8 zoomtable[16] = { 0,7,14,20,25,30,34,38,42,46,49,52,54,57,59,61 };
+ const rectangle &visarea = screen.visible_area();
+// UINT8 *spriteram = spriteram;
+ int offs;
+
+ /* draw the sprites */
+ for (offs = 0; offs < spriteram_bytes; offs += 8)
+ {
+ int data2 = spriteram[offs + 4] | (spriteram[offs + 5] << 8);
+ int priority = (data2 >> 4) & 1;
+
+ /* turns out the sprites are the same as in aerofgt.c */
+ if ((data2 & 0x80) && priority == draw_priority)
+ {
+ int data0 = spriteram[offs + 0] | (spriteram[offs + 1] << 8);
+ int data1 = spriteram[offs + 2] | (spriteram[offs + 3] << 8);
+ int data3 = spriteram[offs + 6] | (spriteram[offs + 7] << 8);
+ int code = data3 & 0xfff;
+ int color = data2 & 0x0f;
+ int y = (data0 & 0x1ff) - 6;
+ int x = (data1 & 0x1ff) - 13;
+ int yzoom = (data0 >> 12) & 15;
+ int xzoom = (data1 >> 12) & 15;
+ int zoomed = (xzoom | yzoom);
+ int ytiles = ((data2 >> 12) & 7) + 1;
+ int xtiles = ((data2 >> 8) & 7) + 1;
+ int yflip = (data2 >> 15) & 1;
+ int xflip = (data2 >> 11) & 1;
+ int xt, yt;
+
+ /* compute the zoom factor -- stolen from aerofgt.c */
+ xzoom = 16 - zoomtable[xzoom] / 8;
+ yzoom = 16 - zoomtable[yzoom] / 8;
+
+ /* wrap around */
+ if (x > visarea.max_x)
+ x -= 0x200;
+ if (y > visarea.max_y)
+ y -= 0x200;
+
+ /* flip ? */
+ if (flipscreen)
+ {
+ y = visarea.max_y - y - 16 * ytiles - 4;
+ x = visarea.max_x - x - 16 * xtiles - 24;
+ xflip=!xflip;
+ yflip=!yflip;
+ }
+
+ /* normal case */
+ if (!xflip && !yflip)
+ {
+ for (yt = 0; yt < ytiles; yt++)
+ for (xt = 0; xt < xtiles; xt++, code++)
+ if (!zoomed)
+ drawgfx_transpen(bitmap, cliprect, screen.machine().gfx[2], code, color, 0, 0,
+ x + xt * 16, y + yt * 16, 15);
+ else
+ drawgfxzoom_transpen(bitmap, cliprect, screen.machine().gfx[2], code, color, 0, 0,
+ x + xt * xzoom, y + yt * yzoom,
+ 0x1000 * xzoom, 0x1000 * yzoom, 15);
+ }
+
+ /* xflipped case */
+ else if (xflip && !yflip)
+ {
+ for (yt = 0; yt < ytiles; yt++)
+ for (xt = 0; xt < xtiles; xt++, code++)
+ if (!zoomed)
+ drawgfx_transpen(bitmap, cliprect, screen.machine().gfx[2], code, color, 1, 0,
+ x + (xtiles - 1 - xt) * 16, y + yt * 16, 15);
+ else
+ drawgfxzoom_transpen(bitmap, cliprect, screen.machine().gfx[2], code, color, 1, 0,
+ x + (xtiles - 1 - xt) * xzoom, y + yt * yzoom,
+ 0x1000 * xzoom, 0x1000 * yzoom, 15);
+ }
+
+ /* yflipped case */
+ else if (!xflip && yflip)
+ {
+ for (yt = 0; yt < ytiles; yt++)
+ for (xt = 0; xt < xtiles; xt++, code++)
+ if (!zoomed)
+ drawgfx_transpen(bitmap, cliprect, screen.machine().gfx[2], code, color, 0, 1,
+ x + xt * 16, y + (ytiles - 1 - yt) * 16, 15);
+ else
+ drawgfxzoom_transpen(bitmap, cliprect, screen.machine().gfx[2], code, color, 0, 1,
+ x + xt * xzoom, y + (ytiles - 1 - yt) * yzoom,
+ 0x1000 * xzoom, 0x1000 * yzoom, 15);
+ }
+
+ /* x & yflipped case */
+ else
+ {
+ for (yt = 0; yt < ytiles; yt++)
+ for (xt = 0; xt < xtiles; xt++, code++)
+ if (!zoomed)
+ drawgfx_transpen(bitmap, cliprect, screen.machine().gfx[2], code, color, 1, 1,
+ x + (xtiles - 1 - xt) * 16, y + (ytiles - 1 - yt) * 16, 15);
+ else
+ drawgfxzoom_transpen(bitmap, cliprect, screen.machine().gfx[2], code, color, 1, 1,
+ x + (xtiles - 1 - xt) * xzoom, y + (ytiles - 1 - yt) * yzoom,
+ 0x1000 * xzoom, 0x1000 * yzoom, 15);
+ }
+ }
+ }
+}
diff --git a/src/mame/video/vsystem_spr2.h b/src/mame/video/vsystem_spr2.h
new file mode 100644
index 00000000000..b8ed73520be
--- /dev/null
+++ b/src/mame/video/vsystem_spr2.h
@@ -0,0 +1,40 @@
+// Video System Sprites
+
+
+class vsystem_spr2_device : public device_t
+{
+public:
+ vsystem_spr2_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ template<class _BitmapClass>
+ void turbofrc_draw_sprites_common( UINT16* spriteram3, int spriteram3_bytes, UINT16* spriteram1, int spriteram1_bytes, UINT16* spriteram2, int spriteram2_bytes, int sprite_gfx, int spritepalettebank, running_machine &machine, _BitmapClass &bitmap, const rectangle &cliprect, int chip, int chip_disabled_pri );
+
+ void turbofrc_draw_sprites( UINT16* spriteram3, int spriteram3_bytes, UINT16* spriteram1, int spriteram1_bytes, UINT16* spriteram2, int spriteram2_bytes, int sprite_gfx, int spritepalettebank, running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int chip, int chip_disabled_pri );
+ void turbofrc_draw_sprites( UINT16* spriteram3, int spriteram3_bytes, UINT16* spriteram1, int spriteram1_bytes, UINT16* spriteram2, int spriteram2_bytes, int sprite_gfx, int spritepalettebank, running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, int chip, int chip_disabled_pri );
+
+ template<class _BitmapClass>
+ void spinlbrk_draw_sprites_common( UINT16* spriteram3, int spriteram3_bytes, UINT16* spriteram1, int spriteram1_bytes, UINT16* spriteram2, int spriteram2_bytes, int sprite_gfx, int spritepalettebank, running_machine &machine, _BitmapClass &bitmap, const rectangle &cliprect, int chip, int chip_disabled_pri );
+
+ void spinlbrk_draw_sprites( UINT16* spriteram3, int spriteram3_bytes, UINT16* spriteram1, int spriteram1_bytes, UINT16* spriteram2, int spriteram2_bytes, int sprite_gfx, int spritepalettebank, running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int chip, int chip_disabled_pri );
+ void spinlbrk_draw_sprites( UINT16* spriteram3, int spriteram3_bytes, UINT16* spriteram1, int spriteram1_bytes, UINT16* spriteram2, int spriteram2_bytes, int sprite_gfx, int spritepalettebank, running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, int chip, int chip_disabled_pri );
+
+
+ void welltris_draw_sprites( UINT16* spriteram, int spritepalettebank, running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect);
+ void f1gp_draw_sprites( UINT16* spr1vram, UINT16* spr2vram, UINT16* spr1cgram, int spr1cgram_bytes, UINT16* spr2cgram, int spr2cgram_bytes, running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int chip, int primask );
+ void draw_sprites_pipedrm( UINT8* spriteram, int spriteram_bytes, int flipscreen, screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int draw_priority );
+
+protected:
+ virtual void device_start();
+ virtual void device_reset();
+
+
+private:
+
+
+};
+
+
+extern const device_type VSYSTEM_SPR2;
+
+
+
diff --git a/src/mame/video/welltris.c b/src/mame/video/welltris.c
index f903fd2ee28..13327112669 100644
--- a/src/mame/video/welltris.c
+++ b/src/mame/video/welltris.c
@@ -27,121 +27,6 @@ WRITE16_MEMBER(welltris_state::welltris_spriteram_w)
}
-/* Sprite Drawing is pretty much the same as fromance.c */
-static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect)
-{
- static const UINT8 zoomtable[16] = { 0,7,14,20,25,30,34,38,42,46,49,52,54,57,59,61 };
- welltris_state *state = machine.driver_data<welltris_state>();
- int offs;
- const rectangle &visarea = machine.primary_screen->visible_area();
-
- /* draw the sprites */
- for (offs = 0; offs < 0x200 - 4; offs += 4) {
- int data0 = state->m_spriteram[offs + 0];
- int data1 = state->m_spriteram[offs + 1];
- int data2 = state->m_spriteram[offs + 2];
- int data3 = state->m_spriteram[offs + 3];
- int code = data3 & 0x1fff;
- int color = (data2 & 0x0f) + (0x10 * state->m_spritepalettebank);
- int y = (data0 & 0x1ff) + 1;
- int x = (data1 & 0x1ff) + 6;
- int yzoom = (data0 >> 12) & 15;
- int xzoom = (data1 >> 12) & 15;
- int zoomed = (xzoom | yzoom);
- int ytiles = ((data2 >> 12) & 7) + 1;
- int xtiles = ((data2 >> 8) & 7) + 1;
- int yflip = (data2 >> 15) & 1;
- int xflip = (data2 >> 11) & 1;
- int xt, yt;
-
- if (!(state->m_spriteram[offs + 2] & 0x0080)) continue;
-
- /* compute the zoom factor -- stolen from aerofgt.c */
- xzoom = 16 - zoomtable[xzoom] / 8;
- yzoom = 16 - zoomtable[yzoom] / 8;
-
- /* wrap around */
- if (x > visarea.max_x) x -= 0x200;
- if (y > visarea.max_y) y -= 0x200;
-
- /* normal case */
- if (!xflip && !yflip) {
- for (yt = 0; yt < ytiles; yt++) {
- for (xt = 0; xt < xtiles; xt++, code++) {
- if (!zoomed)
- drawgfx_transpen(bitmap, cliprect, machine.gfx[1], code, color, 0, 0,
- x + xt * 16, y + yt * 16, 15);
- else
- drawgfxzoom_transpen(bitmap, cliprect, machine.gfx[1], code, color, 0, 0,
- x + xt * xzoom, y + yt * yzoom,
- 0x1000 * xzoom, 0x1000 * yzoom, 15);
- }
- if (xtiles == 3) code += 1;
- if (xtiles == 5) code += 3;
- if (xtiles == 6) code += 2;
- if (xtiles == 7) code += 1;
- }
- }
-
- /* xflipped case */
- else if (xflip && !yflip) {
- for (yt = 0; yt < ytiles; yt++) {
- for (xt = 0; xt < xtiles; xt++, code++) {
- if (!zoomed)
- drawgfx_transpen(bitmap, cliprect, machine.gfx[1], code, color, 1, 0,
- x + (xtiles - 1 - xt) * 16, y + yt * 16, 15);
- else
- drawgfxzoom_transpen(bitmap, cliprect, machine.gfx[1], code, color, 1, 0,
- x + (xtiles - 1 - xt) * xzoom, y + yt * yzoom,
- 0x1000 * xzoom, 0x1000 * yzoom, 15);
- }
- if (xtiles == 3) code += 1;
- if (xtiles == 5) code += 3;
- if (xtiles == 6) code += 2;
- if (xtiles == 7) code += 1;
- }
- }
-
- /* yflipped case */
- else if (!xflip && yflip) {
- for (yt = 0; yt < ytiles; yt++) {
- for (xt = 0; xt < xtiles; xt++, code++) {
- if (!zoomed)
- drawgfx_transpen(bitmap, cliprect, machine.gfx[1], code, color, 0, 1,
- x + xt * 16, y + (ytiles - 1 - yt) * 16, 15);
- else
- drawgfxzoom_transpen(bitmap, cliprect, machine.gfx[1], code, color, 0, 1,
- x + xt * xzoom, y + (ytiles - 1 - yt) * yzoom,
- 0x1000 * xzoom, 0x1000 * yzoom, 15);
- }
- if (xtiles == 3) code += 1;
- if (xtiles == 5) code += 3;
- if (xtiles == 6) code += 2;
- if (xtiles == 7) code += 1;
- }
- }
-
- /* x & yflipped case */
- else {
- for (yt = 0; yt < ytiles; yt++) {
- for (xt = 0; xt < xtiles; xt++, code++) {
- if (!zoomed)
- drawgfx_transpen(bitmap, cliprect, machine.gfx[1], code, color, 1, 1,
- x + (xtiles - 1 - xt) * 16, y + (ytiles - 1 - yt) * 16, 15);
- else
- drawgfxzoom_transpen(bitmap, cliprect, machine.gfx[1], code, color, 1, 1,
- x + (xtiles - 1 - xt) * xzoom, y + (ytiles - 1 - yt) * yzoom,
- 0x1000 * xzoom, 0x1000 * yzoom, 15);
- }
- if (xtiles == 3) code += 1;
- if (xtiles == 5) code += 3;
- if (xtiles == 6) code += 2;
- if (xtiles == 7) code += 1;
- }
- }
- }
-}
-
void welltris_state::setbank(int num, int bank)
{
if (m_gfxbank[num] != bank)
@@ -240,6 +125,6 @@ UINT32 welltris_state::screen_update_welltris(screen_device &screen, bitmap_ind1
draw_background(machine(), bitmap, cliprect);
m_char_tilemap->draw(bitmap, cliprect, 0, 0);
- draw_sprites(machine(), bitmap, cliprect);
+ m_spr_old->welltris_draw_sprites(m_spriteram, m_spritepalettebank, machine(), bitmap, cliprect);
return 0;
}