tatsumi rotating sprite device refactor take 2 (#13470)

This commit is contained in:
mamehaze 2025-03-20 10:03:31 +00:00 committed by GitHub
parent d34540af25
commit b1caba31a6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 712 additions and 639 deletions

View File

@ -806,17 +806,6 @@ INPUT_PORTS_END
/******************************************************************************/
static const gfx_layout spritelayout =
{
8,8,
RGN_FRAC(1,1),
4,
{ STEP4(0,1) },
{ 8,12,0,4, 24,28,16,20 },
{ STEP8(0,4*8) },
32*8
};
static const gfx_layout roundup5_vramlayout =
{
8,8,
@ -829,17 +818,14 @@ static const gfx_layout roundup5_vramlayout =
};
static GFXDECODE_START( gfx_apache3 )
GFXDECODE_ENTRY( "sprites", 0, spritelayout, 1024, 256)
GFXDECODE_ENTRY( "text", 0, gfx_8x8x3_planar, 768, 16)
GFXDECODE_END
static GFXDECODE_START( gfx_roundup5 )
GFXDECODE_ENTRY( "sprites", 0, spritelayout, 1024, 256)
GFXDECODE_RAM( nullptr, 0, roundup5_vramlayout, 0, 16)
GFXDECODE_END
static GFXDECODE_START( gfx_cyclwarr )
GFXDECODE_ENTRY( "sprites", 0, spritelayout, 8192, 512)
GFXDECODE_ENTRY( "tilerom", 0, gfx_8x8x3_planar, 0, 16)
GFXDECODE_END
@ -900,8 +886,14 @@ void apache3_state::apache3(machine_config &config)
screen.set_raw(CLOCK_2 / 8, 400, 0, 320, 272, 0, 240); // TODO: Hook up CRTC
screen.set_screen_update(FUNC(apache3_state::screen_update_apache3));
TZB215_SPRITES(config, m_rotatingsprites, 0, 0x800);
m_rotatingsprites->set_sprite_palette_base(0);
m_rotatingsprites->set_palette("rotatingsprites:fakepalette");
m_rotatingsprites->set_basepalette(m_palette);
m_rotatingsprites->set_spriteram(m_spriteram);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_apache3);
PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 1024 + 4096); // 1024 real colours, and 4096 arranged as series of CLUTs
PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 2048); // 2048 real colours
/* apache 3 schematics state
bit 4: 250
@ -952,8 +944,14 @@ void roundup5_state::roundup5(machine_config &config)
screen.set_raw(CLOCK_2 / 8, 400, 0, 320, 272, 0, 240); // TODO: Hook up CRTC
screen.set_screen_update(FUNC(roundup5_state::screen_update_roundup5));
TZB315_SPRITES(config, m_rotatingsprites, 0, 0x800); // probably TZB215, so this is likely incorrectly documented
m_rotatingsprites->set_sprite_palette_base(512);
m_rotatingsprites->set_palette("rotatingsprites:fakepalette");
m_rotatingsprites->set_basepalette(m_palette);
m_rotatingsprites->set_spriteram(m_spriteram);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_roundup5);
PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 1024 + 4096); // 1024 real colours, and 4096 arranged as series of CLUTs
PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 1024); // 1024 real colours
m_palette->set_membits(8).set_endianness(ENDIANNESS_BIG);
MCFG_VIDEO_START_OVERRIDE(roundup5_state,roundup5)
@ -1033,8 +1031,14 @@ void cyclwarr_state::cyclwarr(machine_config &config)
screen.set_raw(CLOCK_2 / 8, 400, 0, 320, 272, 0, 240); // TODO: Hook up CRTC
screen.set_screen_update(FUNC(cyclwarr_state::screen_update_cyclwarr));
TZB315_SPRITES(config, m_rotatingsprites, 0, 0x1000);
m_rotatingsprites->set_sprite_palette_base(4096);
m_rotatingsprites->set_palette("rotatingsprites:fakepalette");
m_rotatingsprites->set_basepalette(m_palette);
m_rotatingsprites->set_spriteram(m_spriteram);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_cyclwarr);
PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 8192 + 8192);
PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 8192);
MCFG_VIDEO_START_OVERRIDE(cyclwarr_state, cyclwarr)
@ -1087,10 +1091,7 @@ ROM_START( apache3 )
ROM_REGION( 0x10000, "sound_rom", 0 ) /* 64k code for sound V20 */
ROM_LOAD( "ap-27d.151", 0x00000, 0x10000, CRC(294b4d79) SHA1(2b03418a12a2aaf3919b98161d8d0ce6ae29a2bb) )
ROM_REGION( 0x200000, "sprites", ROMREGION_ERASE00 )
/* Filled in by both regions below */
ROM_REGION( 0x100000, "sprites_l", 0)
ROM_REGION( 0x100000, "rotatingsprites:sprites_l", 0)
ROM_LOAD32_BYTE( "ap-00c.15", 0x000000, 0x20000, CRC(ad1ddc2b) SHA1(81f64663c4892ab5fb0e2dc99513dbfee73f15b8) )
ROM_LOAD32_BYTE( "ap-01c.22", 0x000001, 0x20000, CRC(6286ff00) SHA1(920da4a3a441dbf54ad86c0f4fb6f47a867e9cda) )
ROM_LOAD32_BYTE( "ap-04c.58", 0x000002, 0x20000, CRC(dc6d55e4) SHA1(9f48f8d6aa1a329a71913139a8d5a50d95a9b9e5) )
@ -1100,7 +1101,7 @@ ROM_START( apache3 )
ROM_LOAD32_BYTE( "ap-06c.71", 0x080002, 0x20000, CRC(0ea90e55) SHA1(b16d6b8be4853797507d3e5c933a9dd1d451308e) )
ROM_LOAD32_BYTE( "ap-07c.75", 0x080003, 0x20000, CRC(ba685543) SHA1(140a2b708d4e4de4d207fc2c4a96a5cab8639988) )
ROM_REGION( 0x100000, "sprites_h", 0)
ROM_REGION( 0x100000, "rotatingsprites:sprites_h", 0)
ROM_LOAD32_BYTE( "ap-08c.14", 0x000000, 0x20000, CRC(6437b580) SHA1(2b2ba42add18bbec04fbcf53645a8d44b972e26a) )
ROM_LOAD32_BYTE( "ap-09c.21", 0x000001, 0x20000, CRC(54d18ef9) SHA1(40ebc6ea49b2a501fe843d60bec8c32d07f2d25d) )
ROM_LOAD32_BYTE( "ap-12c.57", 0x000002, 0x20000, CRC(f95cf5cf) SHA1(ce373c648cbf3e4863bbc3a1175efe065c75eb13) )
@ -1139,10 +1140,7 @@ ROM_START( apache3a )
ROM_REGION( 0x10000, "sound_rom", 0 ) /* 64k code for sound V20 */
ROM_LOAD( "ap-27d.151", 0x00000, 0x10000, CRC(294b4d79) SHA1(2b03418a12a2aaf3919b98161d8d0ce6ae29a2bb) )
ROM_REGION( 0x200000, "sprites", ROMREGION_ERASE00 )
/* Filled in by both regions below */
ROM_REGION( 0x100000, "sprites_l", 0)
ROM_REGION( 0x100000, "rotatingsprites:sprites_l", 0)
ROM_LOAD32_BYTE( "ap-00c.15", 0x000000, 0x20000, CRC(ad1ddc2b) SHA1(81f64663c4892ab5fb0e2dc99513dbfee73f15b8) )
ROM_LOAD32_BYTE( "ap-01c.22", 0x000001, 0x20000, CRC(6286ff00) SHA1(920da4a3a441dbf54ad86c0f4fb6f47a867e9cda) )
ROM_LOAD32_BYTE( "ap-04c.58", 0x000002, 0x20000, CRC(dc6d55e4) SHA1(9f48f8d6aa1a329a71913139a8d5a50d95a9b9e5) )
@ -1152,7 +1150,7 @@ ROM_START( apache3a )
ROM_LOAD32_BYTE( "ap-06c.71", 0x080002, 0x20000, CRC(0ea90e55) SHA1(b16d6b8be4853797507d3e5c933a9dd1d451308e) )
ROM_LOAD32_BYTE( "ap-07c.75", 0x080003, 0x20000, CRC(ba685543) SHA1(140a2b708d4e4de4d207fc2c4a96a5cab8639988) )
ROM_REGION( 0x100000, "sprites_h", 0)
ROM_REGION( 0x100000, "rotatingsprites:sprites_h", 0)
ROM_LOAD32_BYTE( "ap-08c.14", 0x000000, 0x20000, CRC(6437b580) SHA1(2b2ba42add18bbec04fbcf53645a8d44b972e26a) )
ROM_LOAD32_BYTE( "ap-09c.21", 0x000001, 0x20000, CRC(54d18ef9) SHA1(40ebc6ea49b2a501fe843d60bec8c32d07f2d25d) )
ROM_LOAD32_BYTE( "ap-12c.57", 0x000002, 0x20000, CRC(f95cf5cf) SHA1(ce373c648cbf3e4863bbc3a1175efe065c75eb13) )
@ -1191,10 +1189,7 @@ ROM_START( apache3b )
ROM_REGION( 0x10000, "sound_rom", 0 ) /* 64k code for sound V20 */
ROM_LOAD( "ap-27d.151", 0x00000, 0x10000, CRC(294b4d79) SHA1(2b03418a12a2aaf3919b98161d8d0ce6ae29a2bb) )
ROM_REGION( 0x200000, "sprites", ROMREGION_ERASE00 )
/* Filled in by both regions below */
ROM_REGION( 0x100000, "sprites_l", 0)
ROM_REGION( 0x100000, "rotatingsprites:sprites_l", 0)
ROM_LOAD32_BYTE( "ap-00c.15", 0x000000, 0x20000, CRC(ad1ddc2b) SHA1(81f64663c4892ab5fb0e2dc99513dbfee73f15b8) )
ROM_LOAD32_BYTE( "ap-01c.22", 0x000001, 0x20000, CRC(6286ff00) SHA1(920da4a3a441dbf54ad86c0f4fb6f47a867e9cda) )
ROM_LOAD32_BYTE( "ap-04c.58", 0x000002, 0x20000, CRC(dc6d55e4) SHA1(9f48f8d6aa1a329a71913139a8d5a50d95a9b9e5) )
@ -1204,7 +1199,7 @@ ROM_START( apache3b )
ROM_LOAD32_BYTE( "ap-06c.71", 0x080002, 0x20000, CRC(0ea90e55) SHA1(b16d6b8be4853797507d3e5c933a9dd1d451308e) )
ROM_LOAD32_BYTE( "ap-07c.75", 0x080003, 0x20000, CRC(ba685543) SHA1(140a2b708d4e4de4d207fc2c4a96a5cab8639988) )
ROM_REGION( 0x100000, "sprites_h", 0)
ROM_REGION( 0x100000, "rotatingsprites:sprites_h", 0)
ROM_LOAD32_BYTE( "ap-08c.14", 0x000000, 0x20000, CRC(6437b580) SHA1(2b2ba42add18bbec04fbcf53645a8d44b972e26a) )
ROM_LOAD32_BYTE( "ap-09c.21", 0x000001, 0x20000, CRC(54d18ef9) SHA1(40ebc6ea49b2a501fe843d60bec8c32d07f2d25d) )
ROM_LOAD32_BYTE( "ap-12c.57", 0x000002, 0x20000, CRC(f95cf5cf) SHA1(ce373c648cbf3e4863bbc3a1175efe065c75eb13) )
@ -1243,10 +1238,7 @@ ROM_START( roundup5 )
ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k code for sound Z80 */
ROM_LOAD( "ru-28d", 0x000000, 0x10000, CRC(df36c6c5) SHA1(c046482043f6b54c55696ba3d339ffb11d78f674) )
ROM_REGION( 0x180000, "sprites", ROMREGION_ERASE00 )
/* Filled in by both regions below */
ROM_REGION( 0x0c0000, "sprites_l", 0)
ROM_REGION( 0x0c0000, "rotatingsprites:sprites_l", 0)
ROM_LOAD32_BYTE( "ru-00b", 0x000000, 0x20000, CRC(388a0647) SHA1(e4ab43832872f44c0fe1aaede4372cc00ca7d32b) )
ROM_LOAD32_BYTE( "ru-02b", 0x000001, 0x20000, CRC(eff33945) SHA1(3f4c3aaa11ccf945c2f898dfdf815705d8539e21) )
ROM_LOAD32_BYTE( "ru-04b", 0x000002, 0x20000, CRC(40fda247) SHA1(f5fbc07fda024baedf35ac209210e94df9f15065) )
@ -1256,7 +1248,7 @@ ROM_START( roundup5 )
ROM_LOAD32_BYTE( "ru-05b", 0x080002, 0x10000, CRC(23dd10e1) SHA1(f30ff1a8c7ed9bc567b901cbdd202028fffb9f80) )
ROM_LOAD32_BYTE( "ru-07b", 0x080003, 0x10000, CRC(bb40f46e) SHA1(da694e16d19f60a0dee47551f00f3e50b2d5dcaf) )
ROM_REGION( 0x0c0000, "sprites_h", 0)
ROM_REGION( 0x0c0000, "rotatingsprites:sprites_h", 0)
ROM_LOAD32_BYTE( "ru-08b", 0x000000, 0x20000, CRC(01729e3c) SHA1(1445287fde0b993d053aab73efafc902a6b7e2cc) )
ROM_LOAD32_BYTE( "ru-10b", 0x000001, 0x20000, CRC(cd2357a7) SHA1(313460a74244325ce2c659816f2b738f3dc5358a) )
ROM_LOAD32_BYTE( "ru-12b", 0x000002, 0x20000, CRC(ca63b1f8) SHA1(a50ef8259745dc166eb0a1b2c812ff620818a755) )
@ -1295,10 +1287,7 @@ ROM_START( cyclwarr )
ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k code for sound Z80 */
ROM_LOAD( "cw26a.ic91", 0x000000, 0x10000, CRC(f7a70e3a) SHA1(5581633bf1f15d7f5c1e03de897d65d60f9f1e33) )
ROM_REGION( 0x200000, "sprites", ROMREGION_ERASE00 )
/* Filled in by both regions below */
ROM_REGION( 0x100000, "sprites_l", 0)
ROM_REGION( 0x100000, "rotatingsprites:sprites_l", 0)
ROM_LOAD32_BYTE( "cw00a.ic26", 0x000000, 0x20000, CRC(058a77f1) SHA1(93f99fcf6ce6714d76af6f6e930115516f0379d3) )
ROM_LOAD32_BYTE( "cw08a.ic45", 0x000001, 0x20000, CRC(f53993e7) SHA1(ef2d502ab180d2bc0bdb698c2878fdee9a2c33a8) )
ROM_LOAD32_BYTE( "cw02a.ic28", 0x000002, 0x20000, CRC(4dadf3cb) SHA1(e42c56e295a443cb605d48eba23a16fab3c86525) )
@ -1308,7 +1297,7 @@ ROM_START( cyclwarr )
ROM_LOAD32_BYTE( "cw03a.ic29", 0x080002, 0x20000, CRC(3ca6f98e) SHA1(8526fe38d3b4c66e09049ba18651a9e7255d85d6) )
ROM_LOAD32_BYTE( "cw11a.ic48", 0x080003, 0x20000, CRC(5d760392) SHA1(7bbda2880af4659c267193ce10ed887a1b54a981) )
ROM_REGION( 0x100000, "sprites_h", 0)
ROM_REGION( 0x100000, "rotatingsprites:sprites_h", 0)
ROM_LOAD32_BYTE( "cw04a.ic30", 0x000000, 0x20000, CRC(f05f594d) SHA1(80effaa517b2154c013419e0bc05fd0797b74c8d) )
ROM_LOAD32_BYTE( "cw12a.ic49", 0x000001, 0x20000, CRC(4ac07e8b) SHA1(f9de96fba39d5752d61b8f6be87fb605694624ed) )
ROM_LOAD32_BYTE( "cw06a.ic32", 0x000002, 0x20000, CRC(f628edc9) SHA1(473f7ec28000e6bf72782c1c3f4afb5e021bd430) )
@ -1355,10 +1344,7 @@ ROM_START( cyclwarra )
ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k code for sound Z80 */
ROM_LOAD( "cw26a.ic91", 0x000000, 0x10000, CRC(f7a70e3a) SHA1(5581633bf1f15d7f5c1e03de897d65d60f9f1e33) )
ROM_REGION( 0x200000, "sprites", ROMREGION_ERASE00 )
/* Filled in by both regions below */
ROM_REGION( 0x100000, "sprites_l", 0)
ROM_REGION( 0x100000, "rotatingsprites:sprites_l", 0)
ROM_LOAD32_BYTE( "cw00a.ic26", 0x000000, 0x20000, CRC(058a77f1) SHA1(93f99fcf6ce6714d76af6f6e930115516f0379d3) )
ROM_LOAD32_BYTE( "cw08a.ic45", 0x000001, 0x20000, CRC(f53993e7) SHA1(ef2d502ab180d2bc0bdb698c2878fdee9a2c33a8) )
ROM_LOAD32_BYTE( "cw02a.ic28", 0x000002, 0x20000, CRC(4dadf3cb) SHA1(e42c56e295a443cb605d48eba23a16fab3c86525) )
@ -1368,7 +1354,7 @@ ROM_START( cyclwarra )
ROM_LOAD32_BYTE( "cw03a.ic29", 0x080002, 0x20000, CRC(3ca6f98e) SHA1(8526fe38d3b4c66e09049ba18651a9e7255d85d6) )
ROM_LOAD32_BYTE( "cw11a.ic48", 0x080003, 0x20000, CRC(5d760392) SHA1(7bbda2880af4659c267193ce10ed887a1b54a981) )
ROM_REGION( 0x100000, "sprites_h", 0)
ROM_REGION( 0x100000, "rotatingsprites:sprites_h", 0)
ROM_LOAD32_BYTE( "cw04a.ic30", 0x000000, 0x20000, CRC(f05f594d) SHA1(80effaa517b2154c013419e0bc05fd0797b74c8d) )
ROM_LOAD32_BYTE( "cw12a.ic49", 0x000001, 0x20000, CRC(4ac07e8b) SHA1(f9de96fba39d5752d61b8f6be87fb605694624ed) )
ROM_LOAD32_BYTE( "cw06a.ic32", 0x000002, 0x20000, CRC(f628edc9) SHA1(473f7ec28000e6bf72782c1c3f4afb5e021bd430) )
@ -1415,10 +1401,7 @@ ROM_START( cyclwarrb )
ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k code for sound Z80 */
ROM_LOAD( "cw26.ic91", 0x000000, 0x10000, CRC(a6485a3a) SHA1(b4fcf541efe48b3ca32065221fe2f59476a4f96a) )
ROM_REGION( 0x200000, "sprites", ROMREGION_ERASE00 )
/* Filled in by both regions below */
ROM_REGION( 0x100000, "sprites_l", 0)
ROM_REGION( 0x100000, "rotatingsprites:sprites_l", 0)
ROM_LOAD32_BYTE( "cw00.ic26", 0x000000, 0x20000, CRC(ba00c582) SHA1(2cd645b828595acbe62e2f7aad037fcbdc5a543f) )
ROM_LOAD32_BYTE( "cw08.ic45", 0x000001, 0x20000, CRC(1583e576) SHA1(646762d1d181231090a18698378f60d09f26f49f) )
ROM_LOAD32_BYTE( "cw02.ic28", 0x000002, 0x20000, CRC(8376a744) SHA1(633d20199382f760adfb528f5b13730ddf9016e3) )
@ -1428,7 +1411,7 @@ ROM_START( cyclwarrb )
ROM_LOAD32_BYTE( "cw03.ic29", 0x080002, 0x20000, CRC(951ed812) SHA1(b3db6b467fd626936568773367099c9abcabfab6) )
ROM_LOAD32_BYTE( "cw11.ic48", 0x080003, 0x20000, CRC(a7e5bf0b) SHA1(883b943d40f4516a21692beffb12514ad9301f20) )
ROM_REGION( 0x100000, "sprites_h", 0)
ROM_REGION( 0x100000, "rotatingsprites:sprites_h", 0)
ROM_LOAD32_BYTE( "cw04.ic30", 0x000000, 0x20000, CRC(890ea7b1) SHA1(737e58800aa6863aff043ba46c9cebc8ba6c1501) )
ROM_LOAD32_BYTE( "cw12.ic49", 0x000001, 0x20000, CRC(1587e96d) SHA1(2ffcb27d90ef29bc79d0a29f46a1d43565935a15) )
ROM_LOAD32_BYTE( "cw06.ic32", 0x000002, 0x20000, CRC(47decb23) SHA1(4868c01035175698cb8af7aae80627b51583213f) )
@ -1467,16 +1450,13 @@ ROM_START( bigfight )
ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k code for sound Z80 */
ROM_LOAD( "rom20.ic91", 0x000000, 0x10000, CRC(b3add091) SHA1(8a67bfff75c13fe4d9b89d30449199200d11cea7) ) // == bf36b.ic91
ROM_REGION( 0x400000, "sprites", ROMREGION_ERASE00 )
/* Filled in by both regions below */
ROM_REGION( 0x200000, "sprites_l", 0 )
ROM_REGION( 0x200000, "rotatingsprites:sprites_l", 0 )
ROM_LOAD32_BYTE( "rom0.ic26", 0x000000, 0x80000, CRC(a4a3c8d6) SHA1(b5365d9bc6068260c23ba9d5971c7c7d7cc07a97) )
ROM_LOAD32_BYTE( "rom8.ic45", 0x000001, 0x80000, CRC(220956ed) SHA1(68e0ba1e850101b4cc2778819dfa76f04d88d2d6) )
ROM_LOAD32_BYTE( "rom2.ic28", 0x000002, 0x80000, CRC(c4f6d243) SHA1(e23b241b5a40b332165a34e2f1bc4366973b2070) )
ROM_LOAD32_BYTE( "rom10.ic47", 0x000003, 0x80000, CRC(0212d472) SHA1(5549461195fd7b6b43c0174462d7fe1a1bac24e9) )
ROM_REGION( 0x200000, "sprites_h", 0 )
ROM_REGION( 0x200000, "rotatingsprites:sprites_h", 0 )
ROM_LOAD32_BYTE( "rom4.ic30", 0x000000, 0x80000, CRC(999ff7e9) SHA1(a53b06ad084722d7a52fcf01c52967f68620e609) )
ROM_LOAD32_BYTE( "rom12.ic49", 0x000001, 0x80000, CRC(cb4c1f0b) SHA1(32d64b78ed3d5971eb5d25be2c38e6f2c9048f74) )
ROM_LOAD32_BYTE( "rom6.ic32", 0x000002, 0x80000, CRC(f70e2d47) SHA1(00517b5f3b2deb6f3f3bd12df421e63884c22b2e) )
@ -1518,10 +1498,7 @@ ROM_START( bigfightj ) // ABA-011 main board + ABA-012 daughter board
ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k code for sound Z80 */
ROM_LOAD( "bf36b.ic91", 0x000000, 0x10000, CRC(b3add091) SHA1(8a67bfff75c13fe4d9b89d30449199200d11cea7) ) // rev B
ROM_REGION( 0x400000, "sprites", ROMREGION_ERASE00 )
/* Filled in by both regions below */
ROM_REGION( 0x200000, "sprites_l", 0 )
ROM_REGION( 0x200000, "rotatingsprites:sprites_l", 0 )
ROM_LOAD32_BYTE( "bf00d.ic26", 0x000000, 0x40000, CRC(f506d508) SHA1(86255631ac139f1b5c0f5d6e54a0858625497a1e) ) // all rev D
ROM_LOAD32_BYTE( "bf08d.ic45", 0x000001, 0x40000, CRC(4bf948b9) SHA1(c65b95c454d04c7e4a0cf426ac2d45ddc5e8885e) )
ROM_LOAD32_BYTE( "bf02d.ic28", 0x000002, 0x40000, CRC(af30acf7) SHA1(8f4778b33abb18b113d5d27c0e957d633557c988) )
@ -1530,9 +1507,9 @@ ROM_START( bigfightj ) // ABA-011 main board + ABA-012 daughter board
ROM_LOAD32_BYTE( "bf09d.ic46", 0x100001, 0x20000, CRC(284837ed) SHA1(b1c130b45ff0f22985962240c47b7b01df6ac636) )
ROM_LOAD32_BYTE( "bf03d.ic29", 0x100002, 0x20000, CRC(2ba0398e) SHA1(ec9a29b661b18980c07a446afc89becb1ebddd57) )
ROM_LOAD32_BYTE( "bf11d.ic48", 0x100003, 0x20000, CRC(3f2fa72f) SHA1(4b4821b6933ea753e092f11d80bcc7698f85ccf2) )
ROM_COPY("sprites_l", 0x100000, 0x180000, 0x080000 )
ROM_COPY("rotatingsprites:sprites_l", 0x100000, 0x180000, 0x080000 )
ROM_REGION( 0x200000, "sprites_h", 0)
ROM_REGION( 0x200000, "rotatingsprites:sprites_h", 0)
ROM_LOAD32_BYTE( "bf04d.ic30", 0x000000, 0x40000, CRC(6203d320) SHA1(d58225d8a362971a0eb63c94abc1e8c76198fd2a) ) // all rev D
ROM_LOAD32_BYTE( "bf12d.ic49", 0x000001, 0x40000, CRC(d261dfa7) SHA1(e787901112780e9770300999722fc80aa1d7ab18) )
ROM_LOAD32_BYTE( "bf06d.ic32", 0x000002, 0x40000, CRC(be187c3c) SHA1(46383eb40c0caeb1bc636630a4d849aa2d1a12d2) )
@ -1541,7 +1518,7 @@ ROM_START( bigfightj ) // ABA-011 main board + ABA-012 daughter board
ROM_LOAD32_BYTE( "bf13d.ic50", 0x100001, 0x20000, CRC(1e46cd79) SHA1(c81c96b287a6cc91d3ab4dd8043153814560be3d) )
ROM_LOAD32_BYTE( "bf07d.ic33", 0x100002, 0x20000, CRC(4940b0bb) SHA1(762f21055921093349ca09c35ef516bde6330aa8) )
ROM_LOAD32_BYTE( "bf15d.ic52", 0x100003, 0x20000, CRC(dab0c80a) SHA1(a172937c9599acbd77dcac02ea7e43f576d66d8c) )
ROM_COPY("sprites_h", 0x100000, 0x180000, 0x080000 )
ROM_COPY("rotatingsprites:sprites_h", 0x100000, 0x180000, 0x080000 )
ROM_REGION( 0x20000, "cw_tileclut", 0 )
ROM_LOAD( "bf27.ic128", 0x000000, 0x20000, CRC(da027dcf) SHA1(47d18a8a273fea72cb3ad3d58166fe38ca28a860) )
@ -1560,27 +1537,7 @@ ROM_END
void apache3_state::init_apache3()
{
uint8_t *dst = memregion("sprites")->base();
uint8_t *src1 = memregion("sprites_l")->base();
uint8_t *src2 = memregion("sprites_h")->base();
for (int i = 0; i < 0x100000; i += 32)
{
memcpy(dst,src1,32);
src1+=32;
dst+=32;
memcpy(dst,src2,32);
dst+=32;
src2+=32;
}
// Copy sprite & palette data out of GFX rom area
m_rom_sprite_lookup[0] = memregion("sprites_l")->base();
m_rom_sprite_lookup[1] = memregion("sprites_h")->base();
m_rom_clut[0] = memregion("sprites_l")->base()+ 0x100000 - 0x800;
m_rom_clut[1] = memregion("sprites_h")->base()+ 0x100000 - 0x800;
tatsumi_reset();
init_tatsumi();
m_apache3_rot_idx = 0;
@ -1590,55 +1547,8 @@ void apache3_state::init_apache3()
// TODO: ym2151_set_port_write_handler for CT1/CT2 outputs
}
void roundup5_state::init_roundup5()
void tatsumi_state::init_tatsumi()
{
uint8_t *dst = memregion("sprites")->base();
uint8_t *src1 = memregion("sprites_l")->base();
uint8_t *src2 = memregion("sprites_h")->base();
for (int i = 0; i < 0xc0000; i += 32)
{
memcpy(dst,src1,32);
src1+=32;
dst+=32;
memcpy(dst,src2,32);
dst+=32;
src2+=32;
}
// Copy sprite & palette data out of GFX rom area
m_rom_sprite_lookup[0] = memregion("sprites_l")->base();
m_rom_sprite_lookup[1] = memregion("sprites_h")->base();
m_rom_clut[0] = memregion("sprites_l")->base()+ 0xc0000 - 0x800;
m_rom_clut[1] = memregion("sprites_h")->base()+ 0xc0000 - 0x800;
tatsumi_reset();
}
void cyclwarr_state::init_cyclwarr()
{
uint8_t *dst = memregion("sprites")->base();
uint8_t *src1 = memregion("sprites_l")->base();
int len1 = memregion("sprites_l")->bytes();
uint8_t *src2 = memregion("sprites_h")->base();
int len2 = memregion("sprites_h")->bytes();
for (int i = 0; i < len1; i += 32)
{
memcpy(dst,src1,32);
src1+=32;
dst+=32;
memcpy(dst,src2,32);
dst+=32;
src2+=32;
}
// Copy sprite & palette data out of GFX rom area
m_rom_sprite_lookup[0] = memregion("sprites_l")->base();
m_rom_sprite_lookup[1] = memregion("sprites_h")->base();
m_rom_clut[0] = memregion("sprites_l")->base() + len1 - 0x1000;
m_rom_clut[1] = memregion("sprites_h")->base() + len2 - 0x1000;
tatsumi_reset();
}
@ -1650,9 +1560,9 @@ void cyclwarr_state::init_cyclwarr()
GAME( 1988, apache3, 0, apache3, apache3, apache3_state, init_apache3, ROT0, "Tatsumi", "Apache 3 (rev F)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING ) // Rev F CPU code
GAME( 1988, apache3a, apache3, apache3, apache3, apache3_state, init_apache3, ROT0, "Tatsumi", "Apache 3 (rev E)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING ) // Rev C & E CPU code
GAME( 1988, apache3b, apache3, apache3, apache3, apache3_state, init_apache3, ROT0, "Tatsumi (Kana Corporation license)", "Apache 3 (Kana Corporation license, rev G)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING ) // Rev C & G CPU code
GAMEL(1989, roundup5, 0, roundup5, roundup5, roundup5_state, init_roundup5, ROT0, "Tatsumi", "Round Up 5 - Super Delta Force", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING, layout_roundup5 )
GAME( 1991, cyclwarr, 0, cyclwarr, cyclwarr, cyclwarr_state, init_cyclwarr, ROT0, "Tatsumi", "Cycle Warriors (rev C)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING ) // Rev C & B CPU code
GAME( 1991, cyclwarra, cyclwarr, cyclwarr, cyclwarb, cyclwarr_state, init_cyclwarr, ROT0, "Tatsumi", "Cycle Warriors (rev B)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING ) // Rev B & A CPU code
GAME( 1991, cyclwarrb, cyclwarr, cyclwarr, cyclwarb, cyclwarr_state, init_cyclwarr, ROT0, "Tatsumi", "Cycle Warriors", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING ) // Original version with no Rev roms
GAME( 1992, bigfight, 0, bigfight, bigfight, cyclwarr_state, init_cyclwarr, ROT0, "Tatsumi", "Big Fight - Big Trouble In The Atlantic Ocean", MACHINE_IMPERFECT_GRAPHICS )
GAME( 1992, bigfightj, bigfight, bigfight, bigfight, cyclwarr_state, init_cyclwarr, ROT0, "Tatsumi", "Big Fight - Big Trouble In The Atlantic Ocean (Japan, rev F)", MACHINE_IMPERFECT_GRAPHICS ) // Rev D through F CPU codes
GAMEL(1989, roundup5, 0, roundup5, roundup5, roundup5_state, init_tatsumi, ROT0, "Tatsumi", "Round Up 5 - Super Delta Force", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING, layout_roundup5 )
GAME( 1991, cyclwarr, 0, cyclwarr, cyclwarr, cyclwarr_state, init_tatsumi, ROT0, "Tatsumi", "Cycle Warriors (rev C)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING ) // Rev C & B CPU code
GAME( 1991, cyclwarra, cyclwarr, cyclwarr, cyclwarb, cyclwarr_state, init_tatsumi, ROT0, "Tatsumi", "Cycle Warriors (rev B)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING ) // Rev B & A CPU code
GAME( 1991, cyclwarrb, cyclwarr, cyclwarr, cyclwarb, cyclwarr_state, init_tatsumi, ROT0, "Tatsumi", "Cycle Warriors", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING ) // Original version with no Rev roms
GAME( 1992, bigfight, 0, bigfight, bigfight, cyclwarr_state, init_tatsumi, ROT0, "Tatsumi", "Big Fight - Big Trouble In The Atlantic Ocean", MACHINE_IMPERFECT_GRAPHICS )
GAME( 1992, bigfightj, bigfight, bigfight, bigfight, cyclwarr_state, init_tatsumi, ROT0, "Tatsumi", "Big Fight - Big Trouble In The Atlantic Ocean (Japan, rev F)", MACHINE_IMPERFECT_GRAPHICS ) // Rev D through F CPU codes

View File

@ -5,6 +5,8 @@
#pragma once
#include "tzbx15_sprites.h"
#include "sound/okim6295.h"
#include "sound/ymopm.h"
#include "cpu/m68000/m68000.h"
@ -23,6 +25,7 @@ public:
, m_subcpu(*this, "sub")
, m_ym2151(*this, "ymsnd")
, m_oki(*this, "oki")
, m_rotatingsprites(*this, "rotatingsprites")
, m_gfxdecode(*this, "gfxdecode")
, m_palette(*this, "palette")
, m_videoram(*this, "videoram")
@ -33,6 +36,8 @@ public:
, m_subregion(*this, "slave_rom")
{ }
void init_tatsumi();
void hd6445_crt_w(offs_t offset, uint8_t data);
INTERRUPT_GEN_MEMBER(v30_interrupt);
TILE_GET_INFO_MEMBER(get_text_tile_info);
@ -43,6 +48,7 @@ protected:
required_device<m68000_base_device> m_subcpu;
optional_device<ym2151_device> m_ym2151;
required_device<okim6295_device> m_oki;
required_device<tzbx15_device> m_rotatingsprites;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
@ -53,13 +59,9 @@ protected:
required_memory_region m_mainregion;
required_memory_region m_subregion;
uint8_t *m_rom_sprite_lookup[2];
uint8_t *m_rom_clut[2];
uint16_t m_control_word;
uint8_t m_last_control;
tilemap_t *m_tx_layer;
bitmap_rgb32 m_temp_bitmap;
std::unique_ptr<uint8_t[]> m_shadow_pen_array;
void text_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
uint16_t tatsumi_v30_68000_r(offs_t offset);
void tatsumi_v30_68000_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
@ -67,11 +69,6 @@ protected:
void tatsumi_sprite_control_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
void tatsumi_reset();
template<class BitmapClass> void draw_sprites(BitmapClass &bitmap, const rectangle &cliprect, int write_priority_only, int rambank);
template<class BitmapClass> inline void roundupt_drawgfxzoomrotate( BitmapClass &dest_bmp, const rectangle &clip,
gfx_element *gfx, uint32_t code,uint32_t color,int flipx,int flipy,uint32_t ssx,uint32_t ssy,
int scalex, int scaley, int rotate, int write_priority_only );
void update_cluts(int fake_palette_offset, int object_base, int length);
uint8_t m_hd6445_reg[64];
void apply_shadow_bitmap(bitmap_rgb32 &bitmap, const rectangle &cliprect, bitmap_ind8 &shadow_bitmap, uint8_t xor_output);
@ -154,8 +151,6 @@ public:
void roundup5(machine_config &config);
void init_roundup5();
private:
uint16_t roundup_v30_z80_r(offs_t offset);
void roundup_v30_z80_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
@ -206,8 +201,6 @@ public:
void cyclwarr(machine_config &config);
void bigfight(machine_config &config);
void init_cyclwarr();
protected:
virtual void machine_reset() override ATTR_COLD;

View File

@ -85,467 +85,9 @@ void tatsumi_state::text_w(offs_t offset, uint16_t data, uint16_t mem_mask)
TILE_GET_INFO_MEMBER(tatsumi_state::get_text_tile_info)
{
int tile = m_videoram[tile_index];
tileinfo.set(1,
tile & 0xfff,
tile >> 12,
0);
tileinfo.set(0, tile & 0xfff, tile >> 12, 0);
}
template<class BitmapClass>
inline void tatsumi_state::roundupt_drawgfxzoomrotate( BitmapClass &dest_bmp, const rectangle &clip,
gfx_element *gfx, uint32_t code,uint32_t color,int flipx,int flipy,uint32_t ssx,uint32_t ssy,
int scalex, int scaley, int rotate, int write_priority_only )
{
if (!scalex || !scaley) return;
/*
scalex and scaley are 16.16 fixed point numbers
1<<15 : shrink to 50%
1<<16 : uniform scale
1<<17 : double to 200%
*/
/* KW 991012 -- Added code to force clip to bitmap boundary */
rectangle myclip = clip;
myclip &= dest_bmp.cliprect();
if( gfx )
{
const pen_t *pal = &m_palette->pen(gfx->colorbase() + gfx->granularity() * (color % gfx->colors()));
const uint8_t *shadow_pens = m_shadow_pen_array.get() + (gfx->granularity() * (color % gfx->colors()));
const uint8_t *code_base = gfx->get_data(code % gfx->elements());
int block_size = 8 * scalex;
int sprite_screen_height = ((ssy&0xffff)+block_size)>>16;
int sprite_screen_width = ((ssx&0xffff)+block_size)>>16;
if (sprite_screen_width && sprite_screen_height)
{
/* compute sprite increment per screen pixel */
int dx = (gfx->width()<<16)/sprite_screen_width;
int dy = (gfx->height()<<16)/sprite_screen_height;
int sx;//=ssx>>16;
int sy;//=ssy>>16;
// int ex = sx+sprite_screen_width;
// int ey = sy+sprite_screen_height;
int incxx=0x10000;//(int)((float)dx * cos(theta));
// int incxy=0x0;//(int)((float)dy * -sin(theta));
int incyx=0x0;//(int)((float)dx * sin(theta));
// int incyy=0x10000;//(int)((float)dy * cos(theta));
if (flipx)
{
}
if (ssx&0x80000000) sx=0-(0x10000 - (ssx>>16)); else sx=ssx>>16;
if (ssy&0x80000000) sy=0-(0x10000 - (ssy>>16)); else sy=ssy>>16;
int ex = sx+sprite_screen_width;
int ey = sy+sprite_screen_height;
int x_index_base;
if( flipx )
{
x_index_base = (sprite_screen_width-1)*dx;
dx = -dx;
incxx=-incxx;
incyx=-incyx;
}
else
{
x_index_base = 0;
}
int y_index;
if( flipy )
{
y_index = (sprite_screen_height-1)*dy;
dy = -dy;
}
else
{
y_index = 0;
}
if( sx < myclip.min_x)
{ /* clip left */
int pixels = myclip.min_x-sx;
sx += pixels;
x_index_base += pixels*dx;
}
if( sy < myclip.min_y )
{ /* clip top */
int pixels = myclip.min_y-sy;
sy += pixels;
y_index += pixels*dy;
}
/* NS 980211 - fixed incorrect clipping */
if( ex > myclip.max_x+1 )
{ /* clip right */
int pixels = ex-myclip.max_x-1;
ex -= pixels;
}
if( ey > myclip.max_y+1 )
{ /* clip bottom */
int pixels = ey-myclip.max_y-1;
ey -= pixels;
}
if( ex>sx )
{ /* skip if inner loop doesn't draw anything */
#if 0
int startx=0;
int starty=0;
// int incxx=0x10000;
// int incxy=0;
// int incyx=0;
// int incyy=0x10000;
double theta=rotate * ((2.0 * M_PI)/512.0);
double c=cos(theta);
double s=sin(theta);
// if (ey-sy > 0)
// dy=dy / (ey-sy);
{
float angleAsRadians=(float)rotate * (7.28f / 512.0f);
//float ccx = cosf(angleAsRadians);
//float ccy = sinf(angleAsRadians);
float a=0;
}
for( int y=sy; y<ey; y++ )
{
uint32_t *const dest = &dest_bmp.pix(y);
int cx = startx;
int cy = starty;
int x_index = x_index_base;
for( int x=sx; x<ex; x++ )
{
const uint8_t *source = code_base + (cy>>16) * gfx->rowbytes();
int c = source[(cx >> 16)];
if( c != transparent_color )
{
if (write_priority_only)
dest[x]=shadow_pens[c];
else
dest[x]=pal[c];
}
cx += incxx;
cy += incxy;
}
startx += incyx;
starty += incyy;
}
#endif
#if 1 // old
for( int y=sy; y<ey; y++ )
{
uint8_t const *const source = code_base + (y_index>>16) * gfx->rowbytes();
typename BitmapClass::pixel_t *const dest = &dest_bmp.pix(y);
int x_index = x_index_base;
for( int x=sx; x<ex; x++ )
{
int c = source[x_index>>16];
if( c )
{
// Only draw shadow pens if writing priority buffer
if (write_priority_only)
dest[x]=shadow_pens[c];
else if (!shadow_pens[c])
dest[x]=pal[c];
}
x_index += dx;
}
y_index += dy;
}
#endif
}
}
}
}
static void mycopyrozbitmap_core(bitmap_ind8 &bitmap, const bitmap_rgb32 &srcbitmap,
int dstx, int dsty, int srcwidth, int srcheight, int incxx, int incxy, int incyx, int incyy,
const rectangle &clip, int transparent_color)
{ }
static void mycopyrozbitmap_core(bitmap_rgb32 &bitmap, const bitmap_rgb32 &srcbitmap,
int dstx, int dsty, int srcwidth, int srcheight, int incxx, int incxy, int incyx, int incyy,
const rectangle &clip, int transparent_color)
{
// const int xmask = srcbitmap.width()-1;
// const int ymask = srcbitmap.height()-1;
const int widthshifted = srcwidth << 16;
const int heightshifted = srcheight << 16;
uint32_t startx=0;
uint32_t starty=0;
int sx = dstx;
int sy = dsty;
int ex = dstx + srcwidth;
int ey = dsty + srcheight;
if (sx<clip.min_x) sx=clip.min_x;
if (ex>clip.max_x) ex=clip.max_x;
if (sy<clip.min_y) sy=clip.min_y;
if (ey>clip.max_y) ey=clip.max_y;
if (sx <= ex)
{
while (sy <= ey)
{
int x = sx;
uint32_t cx = startx;
uint32_t cy = starty;
uint32_t *dest = &bitmap.pix(sy, sx);
while (x <= ex)
{
if (cx < widthshifted && cy < heightshifted)
{
int c = srcbitmap.pix(cy >> 16, cx >> 16);
if (c != transparent_color)
*dest = c;
}
cx += incxx;
cy += incxy;
x++;
dest++;
}
startx += incyx;
starty += incyy;
sy++;
}
}
}
template<class BitmapClass>
void tatsumi_state::draw_sprites(BitmapClass &bitmap, const rectangle &cliprect, int write_priority_only, int rambank)
{
// Sprite data is double buffered
for (int offs = rambank;offs < rambank + 0x800;offs += 6)
{
/*
Sprite RAM itself uses an index into two ROM tables to actually draw the object.
Sprite RAM format:
Word 0: 0xf000 - ?
0x0fff - Index into ROM sprite table
Word 1: 0x8000 - X Flip
0x4000 - Y Flip
0x3000 - ?
0x0ff8 - Color
0x0007 - ?
Word 2: 0xffff - X position
Word 3: 0xffff - Y position
Word 4: 0x01ff - Scale
Word 5: 0x01ff - Rotation
Sprite ROM table format, alternate lines come from each bank, with the
very first line indicating control information:
First bank:
Byte 0: Y destination offset (in scanlines, unaffected by scale).
Byte 1: Always 0?
Byte 2: Number of source scanlines to render from (so unaffected by destination scale).
Byte 3: Usually 0, sometimes 0x80??
Other banks:
Byte 0: Width of line in tiles (-1)
Byte 1: X offset to start drawing line at (multipled by scale * 8)
Bytes 2/3: Tile index to start fetching tiles from (increments per tile).
*/
int y = m_spriteram[offs+3];
int x = m_spriteram[offs+2];
int scale = m_spriteram[offs+4] & 0x1ff;
int color = m_spriteram[offs+1] >> 3 & 0x1ff;
int flip_x = m_spriteram[offs+1] & 0x8000;
int flip_y = m_spriteram[offs+1] & 0x4000;
int rotate = 0;//m_spriteram[offs+5]&0x1ff; // Todo: Turned off for now
int index = m_spriteram[offs];
// if (m_spriteram[offs+1]&0x7)
// color=machine().rand()%0xff;
/* End of sprite list marker */
if (index == 0xffff || m_spriteram[offs + 4] == 0xffff) // todo
return;
if (index >= 0x4000)
continue;
uint8_t const *src1 = m_rom_sprite_lookup[0] + (index * 4);
uint8_t const *src2 = m_rom_sprite_lookup[1] + (index * 4);
int lines = src1[2];
int y_offset = src1[0]&0xf8;
lines -= y_offset;
int render_x = x << 16;
int render_y = y << 16;
scale = scale << 9; /* 0x80 becomes 0x10000 */
if (flip_y)
render_y -= y_offset * scale;
else
render_y += y_offset * scale;
if (rotate)
{
render_y = 0;
m_temp_bitmap.fill(0);
}
int extent_x = 0, extent_y = 0;
src1 += 4;
int h = 0;
while (lines > 0) {
int base, x_offs, x_width, x_pos, draw_this_line = 1;
int this_extent = 0;
/* Odd and even lines come from different banks */
if (h & 1) {
x_width = src1[0] + 1;
x_offs = src1[1] * scale * 8;
base = src1[2] | (src1[3] << 8);
}
else {
x_width = src2[0] + 1;
x_offs = src2[1] * scale * 8;
base = src2[2] | (src2[3] << 8);
}
if (draw_this_line) {
base *= 2;
if (!rotate)
{
if (flip_x)
x_pos = render_x - x_offs - scale * 8;
else
x_pos = render_x + x_offs;
}
else
x_pos = x_offs;
for (int w = 0; w < x_width; w++) {
if (rotate)
roundupt_drawgfxzoomrotate(
m_temp_bitmap,cliprect,m_gfxdecode->gfx(0),
base,
color,flip_x,flip_y,x_pos,render_y,
scale,scale,0,write_priority_only);
else
roundupt_drawgfxzoomrotate(
bitmap,cliprect,m_gfxdecode->gfx(0),
base,
color,flip_x,flip_y,x_pos,render_y,
scale,scale,0,write_priority_only);
base++;
if (flip_x)
x_pos -= scale * 8;
else
x_pos += scale * 8;
this_extent += scale * 8;
}
if (h & 1)
src1 += 4;
else
src2 += 4;
if (this_extent > extent_x)
extent_x = this_extent;
this_extent = 0;
if (flip_y)
render_y -= 8 * scale;
else
render_y += 8 * scale;
extent_y += 8 * scale;
h++;
lines -= 8;
}
else
{
h = 32; // hack
}
}
if (rotate)
{
double theta = rotate * ((2.0 * M_PI) / 512.0);
int incxx = (int)(65536.0 * cos(theta));
int incxy = (int)(65536.0 * -sin(theta));
int incyx = (int)(65536.0 * sin(theta));
int incyy = (int)(65536.0 * cos(theta));
extent_x = extent_x >> 16;
extent_y = extent_y >> 16;
if (extent_x > 2 && extent_y > 2)
mycopyrozbitmap_core(bitmap, m_temp_bitmap, x/* + (extent_x/2)*/, y /*+ (extent_y/2)*/, extent_x, extent_y, incxx, incxy, incyx, incyy, cliprect, 0);
}
}
}
/*
* Object palettes are build from a series of cluts stored in the object roms.
*
* We update 'Mame palettes' from the clut here in order to simplify the
* draw routines. We also note down any uses of the 'shadow' pen (index 255).
*/
void tatsumi_state::update_cluts(int fake_palette_offset, int object_base, int length)
{
const uint8_t* bank1 = m_rom_clut[0];
const uint8_t* bank2 = m_rom_clut[1];
for (int i=0; i<length; i+=8)
{
m_palette->set_pen_color(fake_palette_offset+i+0,m_palette->pen_color(bank1[1]+object_base));
m_shadow_pen_array[i+0]=(bank1[1]==255);
m_palette->set_pen_color(fake_palette_offset+i+1,m_palette->pen_color(bank1[0]+object_base));
m_shadow_pen_array[i+1]=(bank1[0]==255);
m_palette->set_pen_color(fake_palette_offset+i+2,m_palette->pen_color(bank1[3]+object_base));
m_shadow_pen_array[i+2]=(bank1[3]==255);
m_palette->set_pen_color(fake_palette_offset+i+3,m_palette->pen_color(bank1[2]+object_base));
m_shadow_pen_array[i+3]=(bank1[2]==255);
m_palette->set_pen_color(fake_palette_offset+i+4,m_palette->pen_color(bank2[1]+object_base));
m_shadow_pen_array[i+4]=(bank2[1]==255);
m_palette->set_pen_color(fake_palette_offset+i+5,m_palette->pen_color(bank2[0]+object_base));
m_shadow_pen_array[i+5]=(bank2[0]==255);
m_palette->set_pen_color(fake_palette_offset+i+6,m_palette->pen_color(bank2[3]+object_base));
m_shadow_pen_array[i+6]=(bank2[3]==255);
m_palette->set_pen_color(fake_palette_offset+i+7,m_palette->pen_color(bank2[2]+object_base));
m_shadow_pen_array[i+7]=(bank2[2]==255);
bank1+=4;
bank2+=4;
}
}
/**********************************
*
* Apache 3
@ -645,8 +187,6 @@ void apache3_state::draw_ground(bitmap_rgb32 &dst, const rectangle &cliprect)
VIDEO_START_MEMBER(apache3_state,apache3)
{
m_tx_layer = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(tatsumi_state::get_text_tile_info)), TILEMAP_SCAN_ROWS, 8,8, 64,64);
m_shadow_pen_array = make_unique_clear<uint8_t[]>(8192);
m_temp_bitmap.allocate(512, 512);
m_apache3_road_x_ram = std::make_unique<uint8_t[]>(512);
m_tx_layer->set_transparent_pen(0);
@ -654,17 +194,17 @@ VIDEO_START_MEMBER(apache3_state,apache3)
uint32_t apache3_state::screen_update_apache3(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
update_cluts(1024, 0, 2048+2048);
m_rotatingsprites->update_cluts();
m_tx_layer->set_scrollx(0,24);
bitmap.fill(m_palette->pen(0), cliprect);
screen.priority().fill(0, cliprect);
draw_sprites(screen.priority(),cliprect,1,(m_sprite_control_ram[0xe0]&0x1000) ? 0x1000 : 0); // Alpha pass only
m_rotatingsprites->draw_sprites(screen.priority(),cliprect,1,(m_sprite_control_ram[0xe0]&0x1000) ? 0x1000 : 0); // Alpha pass only
draw_sky(bitmap, cliprect, 256, m_apache3_rotate_ctrl[1]);
apply_shadow_bitmap(bitmap,cliprect,screen.priority(), 0);
// draw_ground(bitmap, cliprect);
draw_sprites(bitmap,cliprect,0, (m_sprite_control_ram[0x20]&0x1000) ? 0x1000 : 0);
m_rotatingsprites->draw_sprites(bitmap,cliprect,0, (m_sprite_control_ram[0x20]&0x1000) ? 0x1000 : 0);
m_tx_layer->draw(screen, bitmap, cliprect, 0,0);
return 0;
}
@ -706,19 +246,18 @@ void roundup5_state::gfxdata_w(offs_t offset, uint8_t data)
offset=offset%0x8000;
m_gfxdecode->gfx(1)->mark_dirty(offset/8);
m_gfxdecode->gfx(0)->mark_dirty(offset/8);
}
VIDEO_START_MEMBER(roundup5_state,roundup5)
{
m_tx_layer = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(tatsumi_state::get_text_tile_info)), TILEMAP_SCAN_ROWS, 8,8, 128,64);
m_shadow_pen_array = make_unique_clear<uint8_t[]>(8192);
m_tx_gfxram = std::make_unique<uint8_t[]>(0x20000);
m_bg_gfxram = std::make_unique<uint8_t[]>(0x20000);
m_tx_layer->set_transparent_pen(0);
m_gfxdecode->gfx(1)->set_source(m_tx_gfxram.get());
m_gfxdecode->gfx(0)->set_source(m_tx_gfxram.get());
save_pointer(NAME(m_tx_gfxram), 0x20000);
save_pointer(NAME(m_bg_gfxram), 0x20000);
@ -986,14 +525,14 @@ uint32_t roundup5_state::screen_update_roundup5(screen_device &screen, bitmap_rg
tx_start_addr = (m_hd6445_reg[0xc] << 8) | (m_hd6445_reg[0xd]);
tx_start_addr &= 0x3fff;
update_cluts(1024, 512, 4096);
m_rotatingsprites->update_cluts();
m_tx_layer->set_scrollx(0,24);
m_tx_layer->set_scrolly(0,(tx_start_addr >> 4) | m_hd6445_reg[0x1d]);
bitmap.fill(m_palette->pen(384), cliprect); // todo
screen.priority().fill(0, cliprect);
draw_sprites(screen.priority(),cliprect,1,(m_sprite_control_ram[0xe0]&0x1000) ? 0x1000 : 0); // Alpha pass only
m_rotatingsprites->draw_sprites(screen.priority(),cliprect,1,(m_sprite_control_ram[0xe0]&0x1000) ? 0x1000 : 0); // Alpha pass only
draw_landscape(bitmap,cliprect,0);
draw_landscape(bitmap,cliprect,1);
draw_road(bitmap,cliprect);
@ -1001,11 +540,11 @@ uint32_t roundup5_state::screen_update_roundup5(screen_device &screen, bitmap_rg
if(m_control_word & 0x80) // enabled on map screen after a play
{
m_tx_layer->draw(screen, bitmap, cliprect, 0,0);
draw_sprites(bitmap,cliprect,0,(m_sprite_control_ram[0xe0]&0x1000) ? 0x1000 : 0); // Full pass
m_rotatingsprites->draw_sprites(bitmap,cliprect,0,(m_sprite_control_ram[0xe0]&0x1000) ? 0x1000 : 0); // Full pass
}
else
{
draw_sprites(bitmap,cliprect,0,(m_sprite_control_ram[0xe0]&0x1000) ? 0x1000 : 0); // Full pass
m_rotatingsprites->draw_sprites(bitmap,cliprect,0,(m_sprite_control_ram[0xe0]&0x1000) ? 0x1000 : 0); // Full pass
m_tx_layer->draw(screen, bitmap, cliprect, 0,0);
}
return 0;
@ -1065,10 +604,7 @@ TILE_GET_INFO_MEMBER(cyclwarr_state::get_tile_info_bigfight)
// bit 14: ignore transparency on this tile
int opaque = ((tile >> 14) & 1) == 1;
tileinfo.set(1,
tileno,
color,
opaque ? TILE_FORCE_LAYER0 : 0);
tileinfo.set(0, tileno, color, opaque ? TILE_FORCE_LAYER0 : 0);
// bit 15: tile appears in front of sprites
tileinfo.category = (tile >> 15) & 1;
@ -1088,10 +624,7 @@ TILE_GET_INFO_MEMBER(cyclwarr_state::get_tile_info_cyclwarr_road)
color |= 4;
int opaque = ((tile >> 14) & 1) == 1;
tileinfo.set(1,
tileno,
color | m_road_color_bank,
opaque ? TILE_FORCE_LAYER0 : 0);
tileinfo.set(0, tileno, color | m_road_color_bank, opaque ? TILE_FORCE_LAYER0 : 0);
tileinfo.category = (tile >> 15) & 1;
tileinfo.mask_data = &m_mask[((tile&0x3ff)|(bank<<10))<<3];
@ -1103,7 +636,7 @@ void cyclwarr_state::tile_expand()
Each tile (0x4000 of them) has a lookup table in ROM to build an individual 3-bit palette
from sets of 8 bit palettes!
*/
gfx_element *gx0 = m_gfxdecode->gfx(1);
gfx_element *gx0 = m_gfxdecode->gfx(0);
m_mask.resize(gx0->elements() << 3,0);
uint8_t *dest;
@ -1146,8 +679,6 @@ VIDEO_START_MEMBER(cyclwarr_state,cyclwarr)
m_layer[2] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(cyclwarr_state::get_tile_info_bigfight<2>)), TILEMAP_SCAN_ROWS, 8,8, 64,512);
m_layer[3] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(cyclwarr_state::get_tile_info_bigfight<3>)), TILEMAP_SCAN_ROWS, 8,8, 64,512);
m_shadow_pen_array = make_unique_clear<uint8_t[]>(8192);
// set up scroll bases
// TODO: more HW configs
m_layer[3]->set_scrolldx(-8,-8);
@ -1170,8 +701,6 @@ VIDEO_START_MEMBER(cyclwarr_state,bigfight)
m_layer[2] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(cyclwarr_state::get_tile_info_bigfight<2>)), TILEMAP_SCAN_ROWS, 8,8, 128,256);
m_layer[3] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(cyclwarr_state::get_tile_info_bigfight<3>)), TILEMAP_SCAN_ROWS, 8,8, 128,256);
m_shadow_pen_array = make_unique_clear<uint8_t[]>(8192);
// set up scroll bases
// TODO: more HW configs
m_layer[3]->set_scrolldx(-8,-8);
@ -1260,7 +789,7 @@ uint32_t cyclwarr_state::screen_update_cyclwarr(screen_device &screen, bitmap_rg
}
m_bigfight_last_bank=m_bigfight_bank;
}
update_cluts(8192, 4096, 8192);
m_rotatingsprites->update_cluts();
bitmap.fill(m_palette->pen(0), cliprect);
@ -1275,10 +804,10 @@ uint32_t cyclwarr_state::screen_update_cyclwarr(screen_device &screen, bitmap_rg
// popmessage("%04x %04x %04x %04x",m_video_config[0],m_video_config[1],m_video_config[2],m_video_config[3]);
screen.priority().fill(0, cliprect);
draw_sprites(screen.priority(),cliprect,1,(m_sprite_control_ram[0xe0]&0x1000) ? 0x1000 : 0); // Alpha pass only
m_rotatingsprites->draw_sprites(screen.priority(),cliprect,1,(m_sprite_control_ram[0xe0]&0x1000) ? 0x1000 : 0); // Alpha pass only
draw_bg_layers(screen, bitmap, cliprect, 0);
apply_shadow_bitmap(bitmap,cliprect,screen.priority(), m_mixing_control & 1);
draw_sprites(bitmap,cliprect,0,(m_sprite_control_ram[0xe0]&0x1000) ? 0x1000 : 0);
m_rotatingsprites->draw_sprites(bitmap,cliprect,0,(m_sprite_control_ram[0xe0]&0x1000) ? 0x1000 : 0);
draw_bg_layers(screen, bitmap, cliprect, 1);
return 0;
}

View File

@ -0,0 +1,559 @@
// license:BSD-3-Clause
// copyright-holders:Bryan McPhail, Angelo Salese
#include "emu.h"
#include "tzbx15_sprites.h"
#include "screen.h"
// TZB215 on Apache 3
// TZB315 on Round Up 5, Big Fight, Cycle Warriors
// differences, if any, unknown
// (does not appear to be CLUT size, even if that would have made sense. Round Up 5 uses the smaller CLUT like Apache 3 yet is claimed to be TZB315)
DEFINE_DEVICE_TYPE(TZB215_SPRITES, tzb215_device, "tzb215_spr", "Tatsumi TZB215 Rotating Sprites")
DEFINE_DEVICE_TYPE(TZB315_SPRITES, tzb315_device, "tzb315_spr", "Tatsumi TZB315 Rotating Sprites")
tzbx15_device::tzbx15_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock)
: device_t(mconfig, type, tag, owner, clock)
, device_gfx_interface(mconfig, *this)
, m_fakepalette(*this, "fakepalette")
, m_basepalette(*this, finder_base::DUMMY_TAG)
, m_spriteram(*this, finder_base::DUMMY_TAG)
, m_sprites_l_rom(*this, "sprites_l")
, m_sprites_h_rom(*this, "sprites_h")
{
}
tzbx15_device::tzbx15_device(const machine_config& mconfig, device_type type, const char* tag, device_t* owner, u32 clock, u32 clut_size)
: tzbx15_device(mconfig, type, tag, owner, clock)
{
m_rom_clut_size = clut_size;
}
tzb215_device::tzb215_device(const machine_config& mconfig, const char* tag, device_t* owner, u32 clock, u32 clut_size)
: tzbx15_device(mconfig, TZB215_SPRITES, tag, owner, clock, clut_size)
{
}
tzb215_device::tzb215_device(const machine_config& mconfig, const char* tag, device_t* owner, u32 clock)
: tzbx15_device(mconfig, TZB215_SPRITES, tag, owner, clock, 0)
{
}
tzb315_device::tzb315_device(const machine_config& mconfig, const char* tag, device_t* owner, u32 clock, u32 clut_size)
: tzbx15_device(mconfig, TZB315_SPRITES, tag, owner, clock, clut_size)
{
}
tzb315_device::tzb315_device(const machine_config& mconfig, const char* tag, device_t* owner, u32 clock)
: tzbx15_device(mconfig, TZB315_SPRITES, tag, owner, clock, 0)
{
}
void tzbx15_device::common_init()
{
m_rom_clut_offset = memregion("sprites_l")->bytes() - m_rom_clut_size;
m_shadow_pen_array = make_unique_clear<uint8_t[]>(m_rom_clut_size * 2);
m_temp_bitmap.allocate(512, 512);
}
static const gfx_layout spritelayout =
{
8,8,
RGN_FRAC(1,1),
4,
{ STEP4(0,1) },
{ 8,12,0,4, 24,28,16,20 },
{ STEP8(0,4*8) },
32*8
};
GFXDECODE_MEMBER( tzbx15_device::gfxinfo )
GFXDECODE_DEVICE("sprites_l", 0, spritelayout, 0, 256)
GFXDECODE_DEVICE("sprites_h", 0, spritelayout, 0, 256)
GFXDECODE_END
void tzbx15_device::device_start()
{
common_init();
decode_gfx(gfxinfo);
gfx(0)->set_colors(m_rom_clut_size / 8);
gfx(1)->set_colors(m_rom_clut_size / 8);
}
void tzbx15_device::device_reset()
{
}
void tzbx15_device::device_add_mconfig(machine_config &config)
{
PALETTE(config, m_fakepalette).set_format(palette_device::xRGB_555, m_rom_clut_size * 2); // 4096 or 8192 arranged as series of CLUTs
}
void tzbx15_device::mycopyrozbitmap_core(bitmap_ind8 &bitmap, const bitmap_rgb32 &srcbitmap,
int dstx, int dsty, int srcwidth, int srcheight, int incxx, int incxy, int incyx, int incyy,
const rectangle &clip, int transparent_color)
{ }
void tzbx15_device::mycopyrozbitmap_core(bitmap_rgb32 &bitmap, const bitmap_rgb32 &srcbitmap,
int dstx, int dsty, int srcwidth, int srcheight, int incxx, int incxy, int incyx, int incyy,
const rectangle &clip, int transparent_color)
{
// const int xmask = srcbitmap.width()-1;
// const int ymask = srcbitmap.height()-1;
const int widthshifted = srcwidth << 16;
const int heightshifted = srcheight << 16;
uint32_t startx = 0;
uint32_t starty = 0;
int sx = dstx;
int sy = dsty;
int ex = dstx + srcwidth;
int ey = dsty + srcheight;
if (sx < clip.min_x) sx = clip.min_x;
if (ex > clip.max_x) ex = clip.max_x;
if (sy < clip.min_y) sy = clip.min_y;
if (ey > clip.max_y) ey = clip.max_y;
if (sx <= ex)
{
while (sy <= ey)
{
int x = sx;
uint32_t cx = startx;
uint32_t cy = starty;
uint32_t* dest = &bitmap.pix(sy, sx);
while (x <= ex)
{
if (cx < widthshifted && cy < heightshifted)
{
int c = srcbitmap.pix(cy >> 16, cx >> 16);
if (c != transparent_color)
*dest = c;
}
cx += incxx;
cy += incxy;
x++;
dest++;
}
startx += incyx;
starty += incyy;
sy++;
}
}
}
template<class BitmapClass>
void tzbx15_device::roundupt_drawgfxzoomrotate( BitmapClass &dest_bmp, const rectangle &clip,
gfx_element *gfx, uint32_t code,uint32_t color,int flipx,int flipy,uint32_t ssx,uint32_t ssy,
int scalex, int scaley, int rotate, int write_priority_only )
{
if (!scalex || !scaley) return;
/*
scalex and scaley are 16.16 fixed point numbers
1<<15 : shrink to 50%
1<<16 : uniform scale
1<<17 : double to 200%
*/
/* KW 991012 -- Added code to force clip to bitmap boundary */
rectangle myclip = clip;
myclip &= dest_bmp.cliprect();
if( gfx )
{
const pen_t *pal = &m_fakepalette->pen(gfx->colorbase() + gfx->granularity() * (color % gfx->colors()));
const uint8_t *shadow_pens = m_shadow_pen_array.get() + (gfx->granularity() * (color % gfx->colors()));
const uint8_t *code_base = gfx->get_data(code % gfx->elements());
int block_size = 8 * scalex;
int sprite_screen_height = ((ssy&0xffff)+block_size)>>16;
int sprite_screen_width = ((ssx&0xffff)+block_size)>>16;
if (sprite_screen_width && sprite_screen_height)
{
/* compute sprite increment per screen pixel */
int dx = (gfx->width()<<16)/sprite_screen_width;
int dy = (gfx->height()<<16)/sprite_screen_height;
int sx;//=ssx>>16;
int sy;//=ssy>>16;
// int ex = sx+sprite_screen_width;
// int ey = sy+sprite_screen_height;
int incxx=0x10000;//(int)((float)dx * cos(theta));
// int incxy=0x0;//(int)((float)dy * -sin(theta));
int incyx=0x0;//(int)((float)dx * sin(theta));
// int incyy=0x10000;//(int)((float)dy * cos(theta));
if (flipx)
{
}
if (ssx&0x80000000) sx=0-(0x10000 - (ssx>>16)); else sx=ssx>>16;
if (ssy&0x80000000) sy=0-(0x10000 - (ssy>>16)); else sy=ssy>>16;
int ex = sx+sprite_screen_width;
int ey = sy+sprite_screen_height;
int x_index_base;
if( flipx )
{
x_index_base = (sprite_screen_width-1)*dx;
dx = -dx;
incxx=-incxx;
incyx=-incyx;
}
else
{
x_index_base = 0;
}
int y_index;
if( flipy )
{
y_index = (sprite_screen_height-1)*dy;
dy = -dy;
}
else
{
y_index = 0;
}
if( sx < myclip.min_x)
{ /* clip left */
int pixels = myclip.min_x-sx;
sx += pixels;
x_index_base += pixels*dx;
}
if( sy < myclip.min_y )
{ /* clip top */
int pixels = myclip.min_y-sy;
sy += pixels;
y_index += pixels*dy;
}
/* NS 980211 - fixed incorrect clipping */
if( ex > myclip.max_x+1 )
{ /* clip right */
int pixels = ex-myclip.max_x-1;
ex -= pixels;
}
if( ey > myclip.max_y+1 )
{ /* clip bottom */
int pixels = ey-myclip.max_y-1;
ey -= pixels;
}
if( ex>sx )
{ /* skip if inner loop doesn't draw anything */
#if 0
int startx=0;
int starty=0;
// int incxx=0x10000;
// int incxy=0;
// int incyx=0;
// int incyy=0x10000;
double theta=rotate * ((2.0 * M_PI)/512.0);
double c=cos(theta);
double s=sin(theta);
// if (ey-sy > 0)
// dy=dy / (ey-sy);
{
float angleAsRadians=(float)rotate * (7.28f / 512.0f);
//float ccx = cosf(angleAsRadians);
//float ccy = sinf(angleAsRadians);
float a=0;
}
for( int y=sy; y<ey; y++ )
{
uint32_t *const dest = &dest_bmp.pix(y);
int cx = startx;
int cy = starty;
int x_index = x_index_base;
for( int x=sx; x<ex; x++ )
{
const uint8_t *source = code_base + (cy>>16) * gfx->rowbytes();
int c = source[(cx >> 16)];
if( c != transparent_color )
{
if (write_priority_only)
dest[x]=shadow_pens[c];
else
dest[x]=pal[c];
}
cx += incxx;
cy += incxy;
}
startx += incyx;
starty += incyy;
}
#endif
#if 1 // old
for( int y=sy; y<ey; y++ )
{
uint8_t const *const source = code_base + (y_index>>16) * gfx->rowbytes();
typename BitmapClass::pixel_t *const dest = &dest_bmp.pix(y);
int x_index = x_index_base;
for( int x=sx; x<ex; x++ )
{
int c = source[x_index>>16];
if( c )
{
// Only draw shadow pens if writing priority buffer
if (write_priority_only)
dest[x]=shadow_pens[c];
else if (!shadow_pens[c])
dest[x]=pal[c];
}
x_index += dx;
}
y_index += dy;
}
#endif
}
}
}
}
template<class BitmapClass>
void tzbx15_device::draw_sprites_main(BitmapClass &bitmap, const rectangle &cliprect, int write_priority_only, int rambank)
{
// Sprite data is double buffered
for (int offs = rambank;offs < rambank + 0x800;offs += 6)
{
/*
Sprite RAM itself uses an index into two ROM tables to actually draw the object.
Sprite RAM format:
Word 0: 0xf000 - ?
0x0fff - Index into ROM sprite table
Word 1: 0x8000 - X Flip
0x4000 - Y Flip
0x3000 - ?
0x0ff8 - Color
0x0007 - ?
Word 2: 0xffff - X position
Word 3: 0xffff - Y position
Word 4: 0x01ff - Scale
Word 5: 0x01ff - Rotation
Sprite ROM table format, alternate lines come from each bank, with the
very first line indicating control information:
First bank:
Byte 0: Y destination offset (in scanlines, unaffected by scale).
Byte 1: Always 0?
Byte 2: Number of source scanlines to render from (so unaffected by destination scale).
Byte 3: Usually 0, sometimes 0x80??
Other banks:
Byte 0: Width of line in tiles (-1)
Byte 1: X offset to start drawing line at (multipled by scale * 8)
Bytes 2/3: Tile index to start fetching tiles from (increments per tile).
*/
int y = m_spriteram[offs+3];
int x = m_spriteram[offs+2];
int scale = m_spriteram[offs+4] & 0x1ff;
int color = m_spriteram[offs+1] >> 3 & 0x1ff;
int flip_x = m_spriteram[offs+1] & 0x8000;
int flip_y = m_spriteram[offs+1] & 0x4000;
int rotate = 0;//m_spriteram[offs+5]&0x1ff; // Todo: Turned off for now
int index = m_spriteram[offs];
// if (m_spriteram[offs+1]&0x7)
// color=machine().rand()%0xff;
/* End of sprite list marker */
if (index == 0xffff || m_spriteram[offs + 4] == 0xffff) // todo
return;
if (index >= 0x4000)
continue;
uint8_t const *src1 = m_sprites_l_rom + (index * 4);
uint8_t const *src2 = m_sprites_h_rom + (index * 4);
int lines = src1[2];
int y_offset = src1[0]&0xf8;
lines -= y_offset;
int render_x = x << 16;
int render_y = y << 16;
scale = scale << 9; /* 0x80 becomes 0x10000 */
if (flip_y)
render_y -= y_offset * scale;
else
render_y += y_offset * scale;
if (rotate)
{
render_y = 0;
m_temp_bitmap.fill(0);
}
int extent_x = 0, extent_y = 0;
src1 += 4;
int h = 0;
while (lines > 0) {
int base, x_offs, x_width, x_pos, draw_this_line = 1;
int this_extent = 0;
/* Odd and even lines come from different banks */
if (h & 1) {
x_width = src1[0] + 1;
x_offs = src1[1] * scale * 8;
base = src1[2] | (src1[3] << 8);
}
else {
x_width = src2[0] + 1;
x_offs = src2[1] * scale * 8;
base = src2[2] | (src2[3] << 8);
}
if (draw_this_line) {
base *= 2;
if (!rotate)
{
if (flip_x)
x_pos = render_x - x_offs - scale * 8;
else
x_pos = render_x + x_offs;
}
else
x_pos = x_offs;
for (int w = 0; w < x_width; w++) {
if (rotate)
roundupt_drawgfxzoomrotate(
m_temp_bitmap,cliprect,gfx(0 + (base & 1)),
base >> 1,
color,flip_x,flip_y,x_pos,render_y,
scale,scale,0,write_priority_only);
else
roundupt_drawgfxzoomrotate(
bitmap,cliprect,gfx(0 + (base & 1)),
base >> 1,
color,flip_x,flip_y,x_pos,render_y,
scale,scale,0,write_priority_only);
base++;
if (flip_x)
x_pos -= scale * 8;
else
x_pos += scale * 8;
this_extent += scale * 8;
}
if (h & 1)
src1 += 4;
else
src2 += 4;
if (this_extent > extent_x)
extent_x = this_extent;
this_extent = 0;
if (flip_y)
render_y -= 8 * scale;
else
render_y += 8 * scale;
extent_y += 8 * scale;
h++;
lines -= 8;
}
else
{
h = 32; // hack
}
}
if (rotate)
{
double theta = rotate * ((2.0 * M_PI) / 512.0);
int incxx = (int)(65536.0 * cos(theta));
int incxy = (int)(65536.0 * -sin(theta));
int incyx = (int)(65536.0 * sin(theta));
int incyy = (int)(65536.0 * cos(theta));
extent_x = extent_x >> 16;
extent_y = extent_y >> 16;
if (extent_x > 2 && extent_y > 2)
mycopyrozbitmap_core(bitmap, m_temp_bitmap, x/* + (extent_x/2)*/, y /*+ (extent_y/2)*/, extent_x, extent_y, incxx, incxy, incyx, incyy, cliprect, 0);
}
}
}
void tzbx15_device::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, int write_priority_only, int rambank)
{
draw_sprites_main(bitmap, cliprect, write_priority_only, rambank);
}
void tzbx15_device::draw_sprites(bitmap_ind8& bitmap, const rectangle &cliprect, int write_priority_only, int rambank)
{
draw_sprites_main(bitmap, cliprect, write_priority_only, rambank);
}
/*
* Object palettes are build from a series of cluts stored in the object roms.
*
* We update 'Mame palettes' from the clut here in order to simplify the
* draw routines. We also note down any uses of the 'shadow' pen (index 255).
*/
void tzbx15_device::update_cluts()
{
const int length = m_rom_clut_size * 2;
const uint8_t* bank1 = m_sprites_l_rom + m_rom_clut_offset;
const uint8_t* bank2 = m_sprites_h_rom + m_rom_clut_offset;
for (int i=0; i<length; i+=8)
{
m_fakepalette->set_pen_color(i+0,m_basepalette->pen_color(bank1[1]+m_sprite_palette_base));
m_shadow_pen_array[i+0]=(bank1[1]==255);
m_fakepalette->set_pen_color(i+1,m_basepalette->pen_color(bank1[0]+m_sprite_palette_base));
m_shadow_pen_array[i+1]=(bank1[0]==255);
m_fakepalette->set_pen_color(i+2,m_basepalette->pen_color(bank1[3]+m_sprite_palette_base));
m_shadow_pen_array[i+2]=(bank1[3]==255);
m_fakepalette->set_pen_color(i+3,m_basepalette->pen_color(bank1[2]+m_sprite_palette_base));
m_shadow_pen_array[i+3]=(bank1[2]==255);
m_fakepalette->set_pen_color(i+4,m_basepalette->pen_color(bank2[1]+m_sprite_palette_base));
m_shadow_pen_array[i+4]=(bank2[1]==255);
m_fakepalette->set_pen_color(i+5,m_basepalette->pen_color(bank2[0]+m_sprite_palette_base));
m_shadow_pen_array[i+5]=(bank2[0]==255);
m_fakepalette->set_pen_color(i+6,m_basepalette->pen_color(bank2[3]+m_sprite_palette_base));
m_shadow_pen_array[i+6]=(bank2[3]==255);
m_fakepalette->set_pen_color(i+7,m_basepalette->pen_color(bank2[2]+m_sprite_palette_base));
m_shadow_pen_array[i+7]=(bank2[2]==255);
bank1+=4;
bank2+=4;
}
}

View File

@ -0,0 +1,82 @@
// license:BSD-3-Clause
// copyright-holders:Bryan McPhail, Angelo Salese
#ifndef MAME_TATSUMI_TZB215_TZB315_SPRITES_H
#define MAME_TATSUMI_TZB215_TZB315_SPRITES_H
#pragma once
#include "emupal.h"
class tzbx15_device : public device_t, public device_gfx_interface
{
public:
void set_sprite_palette_base(int sprite_palette_base) { m_sprite_palette_base = sprite_palette_base; }
template <typename T> void set_basepalette(T &&tag) { m_basepalette.set_tag(std::forward<T>(tag)); }
template <typename T> void set_spriteram(T &&tag) { m_spriteram.set_tag(std::forward<T>(tag)); }
void draw_sprites(bitmap_rgb32& bitmap, const rectangle& cliprect, int write_priority_only, int rambank);
void draw_sprites(bitmap_ind8& bitmap, const rectangle& cliprect, int write_priority_only, int rambank);
void update_cluts();
protected:
tzbx15_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock);
tzbx15_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u32 clut_size);
private:
virtual void device_add_mconfig(machine_config &config) override ATTR_COLD;
virtual void device_start() override ATTR_COLD;
virtual void device_reset() override ATTR_COLD;
void common_init() ATTR_COLD;
void mycopyrozbitmap_core(bitmap_ind8 &bitmap, const bitmap_rgb32 &srcbitmap,
int dstx, int dsty, int srcwidth, int srcheight, int incxx, int incxy, int incyx, int incyy,
const rectangle &clip, int transparent_color);
void mycopyrozbitmap_core(bitmap_rgb32 &bitmap, const bitmap_rgb32 &srcbitmap,
int dstx, int dsty, int srcwidth, int srcheight, int incxx, int incxy, int incyx, int incyy,
const rectangle &clip, int transparent_color);
template<class BitmapClass> void draw_sprites_main(BitmapClass &bitmap, const rectangle &cliprect, int write_priority_only, int rambank);
template<class BitmapClass> inline void roundupt_drawgfxzoomrotate( BitmapClass &dest_bmp, const rectangle &clip,
gfx_element *gfx, uint32_t code,uint32_t color,int flipx,int flipy,uint32_t ssx,uint32_t ssy,
int scalex, int scaley, int rotate, int write_priority_only );
DECLARE_GFXDECODE_MEMBER(gfxinfo);
required_device<palette_device> m_fakepalette;
required_device<palette_device> m_basepalette;
required_shared_ptr<uint16_t> m_spriteram;
required_region_ptr<uint8_t> m_sprites_l_rom;
required_region_ptr<uint8_t> m_sprites_h_rom;
std::unique_ptr<uint8_t[]> m_shadow_pen_array;
bitmap_rgb32 m_temp_bitmap;
// config
int m_rom_clut_size;
int m_rom_clut_offset;
int m_sprite_palette_base;
};
class tzb215_device : public tzbx15_device
{
public:
tzb215_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock, u32 clut_size);
tzb215_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
};
class tzb315_device : public tzbx15_device
{
public:
tzb315_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock, u32 clut_size);
tzb315_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
};
DECLARE_DEVICE_TYPE(TZB215_SPRITES, tzb215_device)
DECLARE_DEVICE_TYPE(TZB315_SPRITES, tzb315_device)
#endif // MAME_TATSUMI_TZB215_TZB315_SPRITES_H