diff --git a/.gitattributes b/.gitattributes index e9cde0f1b48..b5404fcd045 100644 --- a/.gitattributes +++ b/.gitattributes @@ -5456,6 +5456,8 @@ src/mame/video/volfied.c svneol=native#text/plain src/mame/video/vrender0.c svneol=native#text/plain src/mame/video/vrender0.h svneol=native#text/plain src/mame/video/vsnes.c svneol=native#text/plain +src/mame/video/vsystem_spr.c svneol=native#text/plain +src/mame/video/vsystem_spr.h svneol=native#text/plain src/mame/video/vulgus.c svneol=native#text/plain src/mame/video/warpwarp.c svneol=native#text/plain src/mame/video/warriorb.c svneol=native#text/plain diff --git a/src/mame/drivers/inufuku.c b/src/mame/drivers/inufuku.c index 3948099f0a1..b3c1edc918b 100644 --- a/src/mame/drivers/inufuku.c +++ b/src/mame/drivers/inufuku.c @@ -5,6 +5,9 @@ Quiz & Variety Sukusuku Inufuku (Japan) (c)1998 Video System Co.,Ltd. + 3 On 3 Dunk Madness (US, prototype?) + (c)1996 Video System Co.,Ltd. + Driver by Takahiro Nogi 2003/08/09 - based on other Video System drivers @@ -127,7 +130,7 @@ CUSTOM_INPUT_MEMBER(inufuku_state::soundflag_r) static ADDRESS_MAP_START( inufuku_map, AS_PROGRAM, 16, inufuku_state ) AM_RANGE(0x000000, 0x0fffff) AM_ROM // main rom - AM_RANGE(0x100000, 0x100007) AM_WRITENOP // ? +// AM_RANGE(0x100000, 0x100007) AM_WRITENOP // ? AM_RANGE(0x180000, 0x180001) AM_READ_PORT("P1") AM_RANGE(0x180002, 0x180003) AM_READ_PORT("P2") @@ -143,7 +146,8 @@ static ADDRESS_MAP_START( inufuku_map, AS_PROGRAM, 16, inufuku_state ) AM_RANGE(0x380000, 0x3801ff) AM_WRITEONLY AM_SHARE("bg_rasterram") // bg raster ram AM_RANGE(0x400000, 0x401fff) AM_READWRITE(inufuku_bg_videoram_r, inufuku_bg_videoram_w) AM_SHARE("bg_videoram") // bg ram AM_RANGE(0x402000, 0x403fff) AM_READWRITE(inufuku_tx_videoram_r, inufuku_tx_videoram_w) AM_SHARE("tx_videoram") // text ram - AM_RANGE(0x580000, 0x580fff) AM_RAM AM_SHARE("spriteram1") // sprite table + sprite attribute + AM_RANGE(0x404000, 0x40ffff) AM_RAM // ?? mirror (3on3dunk) + AM_RANGE(0x580000, 0x581fff) AM_RAM AM_SHARE("spriteram1") // sprite table + sprite attribute AM_RANGE(0x600000, 0x61ffff) AM_RAM AM_SHARE("spriteram2") // cell table AM_RANGE(0x780000, 0x780013) AM_WRITE(inufuku_palettereg_w) // bg & text palettebank register @@ -222,16 +226,17 @@ static INPUT_PORTS_START( inufuku ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(4) PORT_START("EXTRA") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN3 ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN4 ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START3 ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START4 ) - PORT_DIPNAME( 0x10, 0x10, "3P/4P" ) - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("eeprom", eeprom_device, read_bit) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, inufuku_state,soundflag_r, NULL) // pending sound command + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN3 ) + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN4 ) + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_START3 ) + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_START4 ) + PORT_DIPNAME( 0x0010, 0x0010, "3P/4P" ) + PORT_DIPSETTING( 0x0010, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("eeprom", eeprom_device, read_bit) + PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, inufuku_state,soundflag_r, NULL) // pending sound command + PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN ) // 3on3dunk cares about something in here, possibly a vblank flag PORT_START( "EEPROMOUT" ) PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("eeprom", eeprom_device, write_bit) @@ -250,6 +255,8 @@ static INPUT_PORTS_START( inufuku ) INPUT_PORTS_END + + /****************************************************************************** Graphics definitions @@ -280,12 +287,31 @@ static const gfx_layout spritelayout = 128*8 }; +static const gfx_layout spritelayout_alt = +{ + 16, 16, + RGN_FRAC(1, 1), + 4, + { 0, 1, 2, 3 }, + { 1*4, 0*4, 3*4, 2*4, 5*4, 4*4, 7*4, 6*4, + 9*4, 8*4, 11*4, 10*4, 13*4, 12*4, 15*4, 14*4 }, + { 0*64, 1*64, 2*64, 3*64, 4*64, 5*64, 6*64, 7*64, + 8*64, 9*64, 10*64, 11*64, 12*64, 13*64, 14*64, 15*64 }, + 128*8 +}; + static GFXDECODE_START( inufuku ) GFXDECODE_ENTRY( "gfx1", 0, tilelayout, 0, 256*16 ) // bg GFXDECODE_ENTRY( "gfx2", 0, tilelayout, 0, 256*16 ) // text GFXDECODE_ENTRY( "gfx3", 0, spritelayout, 0, 256*16 ) // sprite GFXDECODE_END +static GFXDECODE_START( _3on3dunk ) + GFXDECODE_ENTRY( "gfx1", 0, tilelayout, 0, 256*16 ) // bg + GFXDECODE_ENTRY( "gfx2", 0, tilelayout, 0, 256*16 ) // text + GFXDECODE_ENTRY( "gfx3", 0, spritelayout_alt, 0, 256*16 ) // sprite +GFXDECODE_END + /****************************************************************************** @@ -315,7 +341,7 @@ void inufuku_state::machine_start() { UINT8 *ROM = memregion("audiocpu")->base(); - membank("bank1")->configure_entries(0, 4, &ROM[0x10000], 0x8000); + membank("bank1")->configure_entries(0, 4, &ROM[0x00000], 0x8000); membank("bank1")->set_entry(0); m_audiocpu = machine().device("audiocpu"); @@ -361,10 +387,11 @@ static MACHINE_CONFIG_START( inufuku, inufuku_state ) /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2300)) MCFG_SCREEN_SIZE(2048, 256) MCFG_SCREEN_VISIBLE_AREA(0, 319-1, 1, 224-1) MCFG_SCREEN_UPDATE_DRIVER(inufuku_state, screen_update_inufuku) + MCFG_SCREEN_VBLANK_DRIVER(inufuku_state, screen_eof_inufuku) MCFG_GFXDECODE(inufuku) MCFG_PALETTE_LENGTH(4096) @@ -381,6 +408,14 @@ static MACHINE_CONFIG_START( inufuku, inufuku_state ) MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( _3on3dunk, inufuku ) + MCFG_GFXDECODE(_3on3dunk) +MACHINE_CONFIG_END + + + + + /****************************************************************************** ROM definitions @@ -393,9 +428,8 @@ ROM_START( inufuku ) ROM_LOAD16_WORD_SWAP( "u146.bin", 0x0080000, 0x080000, CRC(e05e9bd4) SHA1(af0fdf31c2bdf851bf15c9de725dcbbb58464d54) ) ROM_LOAD16_WORD_SWAP( "lhmn5l28.148", 0x0800000, 0x400000, CRC(802d17e7) SHA1(43b26efea65fd051c094d19784cb977ced39a1a0) ) - ROM_REGION( 0x0030000, "audiocpu", 0 ) // sound cpu + ROM_REGION( 0x0020000, "audiocpu", 0 ) // sound cpu ROM_LOAD( "u107.bin", 0x0000000, 0x020000, CRC(1744ef90) SHA1(e019f4ca83e21aa25710cc0ca40ffe765c7486c9) ) - ROM_RELOAD( 0x010000, 0x020000 ) ROM_REGION( 0x0400000, "gfx1", 0 ) // bg ROM_LOAD16_WORD_SWAP( "lhmn5ku8.u40", 0x0000000, 0x400000, CRC(8cbca80a) SHA1(063e9be97f5a1f021f8326f2994b51f9af5e1eaf) ) @@ -412,6 +446,37 @@ ROM_START( inufuku ) ROM_LOAD( "lhmn5ku6.u53", 0x0000000, 0x400000, CRC(b320c5c9) SHA1(7c99da2d85597a3c008ed61a3aa5f47ad36186ec) ) ROM_END +ROM_START( 3on3dunk ) + ROM_REGION( 0x1000000, "maincpu", 0 ) // main cpu + data + ROM_LOAD16_WORD_SWAP( "prog0_2_4_usa.u147", 0x0000000, 0x080000, CRC(957924ab) SHA1(6fe8ca711d11239310d58188e9d6d28cd27bc5af) ) + ROM_LOAD16_WORD_SWAP( "prog1_2_4_usa.u146", 0x0080000, 0x080000, CRC(2479e236) SHA1(729e6c85d34d6925c8d6557b138e2bed43e1de6a) ) + ROM_LOAD16_WORD_SWAP( "u148", 0x0800000, 0x400000, CRC(aa33e02a) SHA1(86381ecf18fba9065cbc02112751c435bbf8b8b4) ) + + ROM_REGION( 0x0020000, "audiocpu", 0 ) // sound cpu + ROM_LOAD( "sound_prog_97_1_13.u107", 0x0000000, 0x020000, CRC(d9d42805) SHA1(ab5cb7c141d9c9ed5121ba4dbc1d0fa187bd9f68) ) + + ROM_REGION( 0x0400000, "gfx1", 0 ) // bg + ROM_LOAD16_WORD_SWAP( "u40", 0x0000000, 0x400000, CRC(aaa426d1) SHA1(2f9a2981f336caf3188baec9a34f61452dee2203) ) + + ROM_REGION( 0x0400000, "gfx2", 0 ) // text + ROM_LOAD16_WORD_SWAP( "u8", 0x0000000, 0x200000, CRC(2b7be1d8) SHA1(aac274a8f4028db7429478601a1761e61ab4f9a2) ) + + ROM_REGION( 0x2000000, "gfx3", 0 ) // sprite + ROM_LOAD( "u34", 0x0000000, 0x400000, CRC(7372ce78) SHA1(ed2a861986357fad7ef983750cd906c3d722b862) ) + ROM_LOAD( "u36", 0x0400000, 0x400000, CRC(247e5741) SHA1(8d71d964791fb4b86e390bcdf7744f616d6357b1) ) + ROM_LOAD( "u38", 0x0800000, 0x400000, CRC(76449b1e) SHA1(b63d50c6f0dc91dc94dbcdda9842598529c1c26e) ) + ROM_LOAD( "u20", 0x0c00000, 0x200000, CRC(f457cd3b) SHA1(cc13f5dc44e4675c1074a365b10f34e684817d81) ) + /* 0x0e00000, 0x200000 empty */ + ROM_LOAD( "u32", 0x1000000, 0x400000, CRC(bc39e449) SHA1(5aea90b66ee03c70797ddc42dbcb064d83ce8cc7) ) + + ROM_REGION( 0x0400000, "ymsnd", 0 ) // adpcm data + ROM_LOAD( "u53", 0x0000000, 0x100000, CRC(765d892f) SHA1(9b078c879d0437d1669bf4301fd52a768aa4d293) ) + + ROM_REGION( 0x400000, "ymsnd.deltat", 0 ) /* Samples */ // plays speech clips from here + ROM_LOAD( "u51", 0x0000000, 0x400000, CRC(153989b1) SHA1(754cce382d9a7bfcebdfd0f23c5e04ee30449aa4) ) +ROM_END + + /****************************************************************************** @@ -420,3 +485,4 @@ ROM_END ******************************************************************************/ GAME( 1998, inufuku, 0, inufuku, inufuku, driver_device, 0, ROT0, "Video System Co.", "Quiz & Variety Sukusuku Inufuku (Japan)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) +GAME( 1996, 3on3dunk, 0, _3on3dunk, inufuku, driver_device, 0, ROT0, "Video System Co.", "3 On 3 Dunk Madness (US, prototype?)", GAME_NOT_WORKING ) diff --git a/src/mame/includes/inufuku.h b/src/mame/includes/inufuku.h index b7dab9ec4d4..b3db8b979a8 100644 --- a/src/mame/includes/inufuku.h +++ b/src/mame/includes/inufuku.h @@ -28,6 +28,7 @@ public: int m_bg_raster; int m_bg_palettebank; int m_tx_palettebank; + UINT16* m_spriteram1_old; /* misc */ UINT16 m_pending_command; @@ -50,4 +51,6 @@ public: virtual void machine_reset(); virtual void video_start(); UINT32 screen_update_inufuku(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void screen_eof_inufuku(screen_device &screen, bool state); + }; diff --git a/src/mame/mame.lst b/src/mame/mame.lst index 1bbb92ec535..cf02c0f3816 100644 --- a/src/mame/mame.lst +++ b/src/mame/mame.lst @@ -8077,6 +8077,7 @@ fromanc2 // (c) 1995 Video System Co. (Japan) fromancr // (c) 1995 Video System Co. (Japan) fromanc4 // (c) 1998 Video System Co. (Japan) inufuku // (c) 1998 Video System Co. (Japan) +3on3dunk // (c) 1996 Video System Co. (Japan) // Psikyo games // 68020 board diff --git a/src/mame/mame.mak b/src/mame/mame.mak index d6d8892a33a..3f93d9f3394 100644 --- a/src/mame/mame.mak +++ b/src/mame/mame.mak @@ -1592,6 +1592,7 @@ $(MAMEOBJ)/venture.a: \ $(DRIVERS)/suprridr.o $(VIDEO)/suprridr.o \ $(MAMEOBJ)/vsystem.a: \ + $(VIDEO)/vsystem_spr.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/inufuku.c b/src/mame/video/inufuku.c index 2339055f793..33e33936af5 100644 --- a/src/mame/video/inufuku.c +++ b/src/mame/video/inufuku.c @@ -13,6 +13,7 @@ #include "emu.h" #include "includes/inufuku.h" +#include "vsystem_spr.h" /****************************************************************************** @@ -56,102 +57,8 @@ 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(); - int offs; - for (offs = (state->m_spriteram1.bytes() / 16) - 1; offs >= 0; offs--) - { - if ((state->m_spriteram1[offs] & 0x8000) == 0x0000) - { - int attr_start; - int map_start; - int ox, oy, x, y, xsize, ysize, zoomx, zoomy, flipx, flipy, color; - int priority, priority_mask; - - attr_start = 4 * (state->m_spriteram1[offs] & 0x03ff); - - /* - attr_start + 0x0000 - ---- ---x xxxx xxxx oy - ---- xxx- ---- ---- ysize - xxxx ---- ---- ---- zoomy - - attr_start + 0x0001 - ---- ---x xxxx xxxx ox - ---- xxx- ---- ---- xsize - xxxx ---- ---- ---- zoomx - - attr_start + 0x0002 - -x-- ---- ---- ---- flipx - x--- ---- ---- ---- flipy - --xx xxxx ---- ---- color - --xx ---- ---- ---- priority? - ---- ---- xxxx xxxx unused? - - attr_start + 0x0003 - -xxx xxxx xxxx xxxx map start - x--- ---- ---- ---- unused? - */ - - ox = (state->m_spriteram1[attr_start + 1] & 0x01ff) + 0; - xsize = (state->m_spriteram1[attr_start + 1] & 0x0e00) >> 9; - zoomx = (state->m_spriteram1[attr_start + 1] & 0xf000) >> 12; - oy = (state->m_spriteram1[attr_start + 0] & 0x01ff) + 1; - ysize = (state->m_spriteram1[attr_start + 0] & 0x0e00) >> 9; - zoomy = (state->m_spriteram1[attr_start + 0] & 0xf000) >> 12; - flipx = state->m_spriteram1[attr_start + 2] & 0x4000; - flipy = state->m_spriteram1[attr_start + 2] & 0x8000; - color = (state->m_spriteram1[attr_start + 2] & 0x3f00) >> 8; - priority = (state->m_spriteram1[attr_start + 2] & 0x3000) >> 12; - map_start = (state->m_spriteram1[attr_start + 3] & 0x7fff) << 1; - - switch (priority) - { - default: - case 0: priority_mask = 0x00; break; - case 3: priority_mask = 0xfe; break; - case 2: priority_mask = 0xfc; break; - case 1: priority_mask = 0xf0; break; - } - - 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; - else - sy = (oy + zoomy * y / 2 + 16) & 0x1ff; - - for (x = 0; x <= xsize; x++) - { - int code; - - if (flipx) - sx = (ox + zoomx * (xsize - x) / 2 + 16) & 0x1ff; - else - sx = (ox + zoomx * x / 2 + 16) & 0x1ff; - - code = ((state->m_spriteram2[map_start] & 0x0007) << 16) + state->m_spriteram2[map_start + 1]; - - pdrawgfxzoom_transpen(bitmap, cliprect, machine.gfx[2], - code, - color, - flipx, flipy, - sx - 16, sy - 16, - zoomx << 11, zoomy << 11, - machine.priority_bitmap,priority_mask, 15); - - map_start += 2; - } - } - } - } + draw_sprites_inufuku( state->m_spriteram1_old, state->m_spriteram1.bytes(), state->m_spriteram2, machine, bitmap, cliprect ); } @@ -216,6 +123,8 @@ void inufuku_state::video_start() m_bg_tilemap->set_transparent_pen(255); m_tx_tilemap->set_transparent_pen(255); + + m_spriteram1_old = auto_alloc_array_clear(machine(), UINT16, m_spriteram1.bytes()/2); } @@ -236,7 +145,7 @@ UINT32 inufuku_state::screen_update_inufuku(screen_device &screen, bitmap_ind16 { m_bg_tilemap->set_scroll_rows(512); for (i = 0; i < 256; i++) - m_bg_tilemap->set_scrollx((m_bg_scrolly + i) & 0x1ff, m_bg_rasterram[i]); + m_bg_tilemap->set_scrollx((m_bg_scrolly + i) & 0x1ff, m_bg_scrollx+m_bg_rasterram[i]); } else { @@ -253,3 +162,13 @@ UINT32 inufuku_state::screen_update_inufuku(screen_device &screen, bitmap_ind16 draw_sprites(machine(), bitmap, cliprect); return 0; } + +void inufuku_state::screen_eof_inufuku(screen_device &screen, bool state) +{ + // rising edge + if (state) + { + memcpy(m_spriteram1_old,m_spriteram1,m_spriteram1.bytes()); + } +} + diff --git a/src/mame/video/suprslam.c b/src/mame/video/suprslam.c index 718f910ac9e..b9101c5ec3c 100644 --- a/src/mame/video/suprslam.c +++ b/src/mame/video/suprslam.c @@ -3,97 +3,7 @@ #include "emu.h" #include "video/konicdev.h" #include "includes/suprslam.h" - - -/* todo, fix zooming correctly, it's _not_ like aerofgt */ -static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) -{ - /* SPRITE INFO - - Video System hardware, like aerofgt etc. - - the sprites use 2 areas of ram, one containing a spritelist + sprite attributes, the other - contains the sprite tile #'s to use - - sprite attribute info (4 words per sprite) - - | ZZZZ hhhy yyyy yyyy | zzzz wwwx xxxx xxxx | -fpp pppp ---- ---- | -ooo oooo oooo oooo | - - x = x position - y = y position - w = width - h = height - zZ = y zoom / x zoom - f = xflip - p = palette / colour - o = offset to tile data in other ram area - - */ - - suprslam_state *state = machine.driver_data(); - gfx_element *gfx = machine.gfx[1]; - UINT16 *source = state->m_spriteram; - UINT16 *source2 = state->m_spriteram; - UINT16 *finish = source + 0x2000/2; - - while (source < finish) - { - UINT32 sprnum = source[0] & 0x03ff; - if (source[0] == 0x4000) break; - - sprnum *= 4; - - source++; - /* DRAW START */ - { - int ypos = source2[sprnum + 0] & 0x1ff; - int high = (source2[sprnum + 0] & 0x0e00) >> 9; - int yzoom = (source2[sprnum + 0] & 0xf000) >> 12; - - int xpos = source2[sprnum + 1] & 0x1ff; - int wide = (source2[sprnum + 1] & 0x0e00) >> 9; - int xzoom = (source2[sprnum + 1] & 0xf000) >> 12; - - int col = (source2[sprnum + 2] & 0x3f00) >> 8; - int flipx = (source2[sprnum + 2] & 0x4000) >> 14; -// int flipy = (source2[sprnum + 2] & 0x8000) >> 15; - - int word_offset = source2[sprnum + 3] & 0x7fff; - int xcnt, ycnt; - - int loopno = 0; - - xzoom = 32 - xzoom; - yzoom = 32 - yzoom; - - if (ypos > 0xff) ypos -=0x200; - - for (ycnt = 0; ycnt < high+1; ycnt ++) - { - if (!flipx) - { - for (xcnt = 0; xcnt < wide+1; xcnt ++) - { - int tileno = state->m_sp_videoram[word_offset + loopno]; - drawgfxzoom_transpen(bitmap, cliprect, gfx, tileno, col, 0, 0,xpos + xcnt * xzoom/2, ypos + ycnt * yzoom/2,xzoom << 11, yzoom << 11, 15); - drawgfxzoom_transpen(bitmap, cliprect, gfx, tileno, col, 0, 0,-0x200+xpos + xcnt * xzoom/2, ypos + ycnt * yzoom/2,xzoom << 11, yzoom << 11, 15); - loopno ++; - } - } - else - { - for (xcnt = wide; xcnt >= 0; xcnt --) - { - int tileno = state->m_sp_videoram[word_offset + loopno]; - drawgfxzoom_transpen(bitmap, cliprect, gfx, tileno, col, 1, 0,xpos + xcnt * xzoom/2, ypos + ycnt * yzoom/2,xzoom << 11, yzoom << 11, 15); - drawgfxzoom_transpen(bitmap, cliprect, gfx, tileno, col, 1, 0,-0x200+xpos + xcnt * xzoom/2, ypos + ycnt * yzoom/2,xzoom << 11, yzoom << 11, 15); - loopno ++; - } - } - } - } - } -} +#include "vsystem_spr.h" /* FG 'SCREEN' LAYER */ @@ -154,10 +64,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)) - draw_sprites(machine(), bitmap, cliprect); + draw_sprites_suprslam(m_spriteram, m_spriteram.bytes(), m_sp_videoram, machine(), bitmap, cliprect); m_screen_tilemap->draw(bitmap, cliprect, 0, 0); if(m_spr_ctrl[0] & 8) - draw_sprites(machine(), bitmap, cliprect); + draw_sprites_suprslam(m_spriteram, m_spriteram.bytes(), m_sp_videoram, machine(), bitmap, cliprect); return 0; } diff --git a/src/mame/video/vsystem_spr.c b/src/mame/video/vsystem_spr.c new file mode 100644 index 00000000000..c184ba6eb96 --- /dev/null +++ b/src/mame/video/vsystem_spr.c @@ -0,0 +1,205 @@ +// Video System Sprites +// todo: +// move various vsystem sprite functions here +// unify common ones + convert to device + +#include "emu.h" + +// zooming is wrong for 3on3dunk ... suprslam implementation is probably better +void draw_sprites_inufuku( UINT16* spriteram1, int spriteram1_bytes, UINT16* spriteram2, running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) +{ + int offs; + int end = 0; + + for (offs = 0; offs < (spriteram1_bytes / 16 ); offs++) + { + if (spriteram1[offs] & 0x4000) break; + } + end = offs; + + for (offs = end - 1; offs >= 0; offs--) + { + if ((spriteram1[offs] & 0x8000) == 0x0000) + { + int attr_start; + int map_start; + int ox, oy, x, y, xsize, ysize, zoomx, zoomy, flipx, flipy, color; + int priority, priority_mask; + + attr_start = 4 * (spriteram1[offs] & 0x03ff); + + /* + attr_start + 0x0000 + ---- ---x xxxx xxxx oy + ---- xxx- ---- ---- ysize + xxxx ---- ---- ---- zoomy + + attr_start + 0x0001 + ---- ---x xxxx xxxx ox + ---- xxx- ---- ---- xsize + xxxx ---- ---- ---- zoomx + + attr_start + 0x0002 + -x-- ---- ---- ---- flipx + x--- ---- ---- ---- flipy + --xx xxxx ---- ---- color + --xx ---- ---- ---- priority? + ---- ---- xxxx xxxx unused? + + attr_start + 0x0003 + -xxx xxxx xxxx xxxx map start + x--- ---- ---- ---- unused? + */ + + ox = (spriteram1[attr_start + 1] & 0x01ff) + 0; + xsize = (spriteram1[attr_start + 1] & 0x0e00) >> 9; + zoomx = (spriteram1[attr_start + 1] & 0xf000) >> 12; + oy = (spriteram1[attr_start + 0] & 0x01ff) + 1; + ysize = (spriteram1[attr_start + 0] & 0x0e00) >> 9; + zoomy = (spriteram1[attr_start + 0] & 0xf000) >> 12; + flipx = spriteram1[attr_start + 2] & 0x4000; + flipy = spriteram1[attr_start + 2] & 0x8000; + color = (spriteram1[attr_start + 2] & 0x3f00) >> 8; + priority = (spriteram1[attr_start + 2] & 0x3000) >> 12; + map_start = (spriteram1[attr_start + 3] & 0x7fff) << 1; + + switch (priority) + { + default: + case 0: priority_mask = 0x00; break; + case 3: priority_mask = 0xfe; break; + case 2: priority_mask = 0xfc; break; + case 1: priority_mask = 0xf0; break; + } + + 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; + else + sy = (oy + zoomy * y / 2 + 16) & 0x1ff; + + for (x = 0; x <= xsize; x++) + { + int code; + + if (flipx) + sx = (ox + zoomx * (xsize - x) / 2 + 16) & 0x1ff; + else + sx = (ox + zoomx * x / 2 + 16) & 0x1ff; + + code = ((spriteram2[map_start] & 0x0007) << 16) + spriteram2[map_start + 1]; + + pdrawgfxzoom_transpen(bitmap, cliprect, machine.gfx[2], + code, + color, + flipx, flipy, + sx - 16, sy - 16, + zoomx << 11, zoomy << 11, + machine.priority_bitmap,priority_mask, 15); + + map_start += 2; + } + } + } + } +} + + + +/* todo, fix zooming correctly, it's _not_ like aerofgt */ +void draw_sprites_suprslam( UINT16* spriteram, int spriteram_bytes, UINT16* sp_videoram, running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) +{ + /* SPRITE INFO + + Video System hardware, like aerofgt etc. + + the sprites use 2 areas of ram, one containing a spritelist + sprite attributes, the other + contains the sprite tile #'s to use + + sprite attribute info (4 words per sprite) + + | ZZZZ hhhy yyyy yyyy | zzzz wwwx xxxx xxxx | -fpp pppp ---- ---- | -ooo oooo oooo oooo | + + x = x position + y = y position + w = width + h = height + zZ = y zoom / x zoom + f = xflip + p = palette / colour + o = offset to tile data in other ram area + + */ + + gfx_element *gfx = machine.gfx[1]; + UINT16 *source = spriteram; + UINT16 *source2 = spriteram; + UINT16 *finish = source + 0x2000/2; + + while (source < finish) + { + UINT32 sprnum = source[0] & 0x03ff; + if (source[0] == 0x4000) break; + + sprnum *= 4; + + source++; + /* DRAW START */ + { + int ypos = source2[sprnum + 0] & 0x1ff; + int high = (source2[sprnum + 0] & 0x0e00) >> 9; + int yzoom = (source2[sprnum + 0] & 0xf000) >> 12; + + int xpos = source2[sprnum + 1] & 0x1ff; + int wide = (source2[sprnum + 1] & 0x0e00) >> 9; + int xzoom = (source2[sprnum + 1] & 0xf000) >> 12; + + int col = (source2[sprnum + 2] & 0x3f00) >> 8; + int flipx = (source2[sprnum + 2] & 0x4000) >> 14; +// int flipy = (source2[sprnum + 2] & 0x8000) >> 15; + + int word_offset = source2[sprnum + 3] & 0x7fff; + int xcnt, ycnt; + + int loopno = 0; + + xzoom = 32 - xzoom; + yzoom = 32 - yzoom; + + if (ypos > 0xff) ypos -=0x200; + + for (ycnt = 0; ycnt < high+1; ycnt ++) + { + if (!flipx) + { + for (xcnt = 0; xcnt < wide+1; xcnt ++) + { + int tileno = sp_videoram[word_offset + loopno]; + drawgfxzoom_transpen(bitmap, cliprect, gfx, tileno, col, 0, 0,xpos + xcnt * xzoom/2, ypos + ycnt * yzoom/2,xzoom << 11, yzoom << 11, 15); + drawgfxzoom_transpen(bitmap, cliprect, gfx, tileno, col, 0, 0,-0x200+xpos + xcnt * xzoom/2, ypos + ycnt * yzoom/2,xzoom << 11, yzoom << 11, 15); + loopno ++; + } + } + else + { + for (xcnt = wide; xcnt >= 0; xcnt --) + { + int tileno = sp_videoram[word_offset + loopno]; + drawgfxzoom_transpen(bitmap, cliprect, gfx, tileno, col, 1, 0,xpos + xcnt * xzoom/2, ypos + ycnt * yzoom/2,xzoom << 11, yzoom << 11, 15); + drawgfxzoom_transpen(bitmap, cliprect, gfx, tileno, col, 1, 0,-0x200+xpos + xcnt * xzoom/2, ypos + ycnt * yzoom/2,xzoom << 11, yzoom << 11, 15); + loopno ++; + } + } + } + } + } +} diff --git a/src/mame/video/vsystem_spr.h b/src/mame/video/vsystem_spr.h new file mode 100644 index 00000000000..170b183caac --- /dev/null +++ b/src/mame/video/vsystem_spr.h @@ -0,0 +1,4 @@ +// Video System Sprites + +void draw_sprites_inufuku( UINT16* spriteram1, int spriteram1_bytes, UINT16* spriteram2, running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ); +void draw_sprites_suprslam( UINT16* spriteram, int spriteram_bytes, UINT16* sp_videoram, running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ); \ No newline at end of file