From 1f6fad1918e246a835535394978628d775414c19 Mon Sep 17 00:00:00 2001 From: David Haywood <28625134+DavidHaywood@users.noreply.github.com> Date: Sun, 23 May 2021 17:16:35 +0100 Subject: use derived classes for Namco System 2 sprites, give Final Lap its own based on schematics showing 32x32 select is different. (#8096) (cherry picked from commit e3aa064b18d74cb5e3fe0fa314f15e1a99afd44e) --- src/mame/drivers/namcos2.cpp | 86 ++++++++++++++++++++------------------- src/mame/includes/namcos2.h | 1 + src/mame/video/namcos2.cpp | 2 +- src/mame/video/namcos2_sprite.cpp | 52 ++++++++++++++++++----- src/mame/video/namcos2_sprite.h | 35 +++++++++++++--- 5 files changed, 116 insertions(+), 60 deletions(-) diff --git a/src/mame/drivers/namcos2.cpp b/src/mame/drivers/namcos2.cpp index ca8b0308fbf..e1472c894e8 100644 --- a/src/mame/drivers/namcos2.cpp +++ b/src/mame/drivers/namcos2.cpp @@ -1927,20 +1927,28 @@ void namcos2_state::finallap_noio(machine_config &config) configure_c123tmap_standard(config); configure_c45road_standard(config); - m_ns2sprite->force_32x32_sprites(true); - m_c140->add_route(0, "lspeaker", 0.75); m_c140->add_route(1, "rspeaker", 0.75); YM2151(config, "ymsnd", YM2151_SOUND_CLOCK).add_route(0, "lspeaker", 0.80).add_route(1, "rspeaker", 0.80); /* 3.579545MHz */ } -void namcos2_state::finallap(machine_config &config) +void namcos2_state::base_fl(machine_config &config) { finallap_noio(config); configure_c65_standard(config); } +void namcos2_state::finallap(machine_config &config) +{ + base_fl(config); + + NAMCOS2_SPRITE_FINALLAP(config.replace(), m_ns2sprite, 0); + m_ns2sprite->set_gfxdecode_tag("gfxdecode"); + m_ns2sprite->set_spriteram_tag("spriteram"); +} + + void namcos2_state::finallap_c68(machine_config &config) { finallap_noio(config); @@ -1951,11 +1959,9 @@ void namcos2_state::finallap_c68(machine_config &config) // finalap2 has different mangle void namcos2_state::finalap2(machine_config &config) { - finallap(config); + base_fl(config); m_c123tmap->set_tile_callback(namco_c123tmap_device::c123_tilemap_delegate(&namcos2_state::TilemapCB_finalap2, this)); - - m_ns2sprite->force_32x32_sprites(false); } void namcos2_state::finalap3(machine_config &config) @@ -1963,8 +1969,6 @@ void namcos2_state::finalap3(machine_config &config) finallap_c68(config); m_c123tmap->set_tile_callback(namco_c123tmap_device::c123_tilemap_delegate(&namcos2_state::TilemapCB_finalap2, this)); - - m_ns2sprite->force_32x32_sprites(false); } @@ -2088,7 +2092,10 @@ void namcos2_state::metlhawk(machine_config &config) GFXDECODE(config, m_gfxdecode, m_c116, gfx_metlhawk); - configure_namcos2_sprite_standard(config); + NAMCOS2_SPRITE_METALHAWK(config, m_ns2sprite, 0); + m_ns2sprite->set_gfxdecode_tag("gfxdecode"); + m_ns2sprite->set_spriteram_tag("spriteram"); + configure_c123tmap_standard(config); configure_c169roz_standard(config); m_c169roz->set_tile_callback(namco_c169roz_device::c169_tilemap_delegate(&namcos2_state::RozCB_metlhawk, this)); @@ -2702,12 +2709,11 @@ ROM_START( finallap ) ROM_REGION( 0x8000, "c65mcu:external", ROMREGION_ERASE00 ) /* I/O MCU */ /* no external MCU ROM? previously loaded type C, but the game predates it */ - ROM_REGION( 0x400000, "sprite", 0 ) /* Sprites */ - ROM_FILL( 0, 0x200000, 0xff ) - ROM_LOAD32_BYTE( "obj-0b", 0x200003, 0x80000, CRC(c6986523) SHA1(1a4b0e95ade6314850b6e44f2debda0ab6e91397) ) - ROM_LOAD32_BYTE( "obj-1b", 0x200002, 0x80000, CRC(6af7d284) SHA1(c74f975c301ff15040be1b38359624ec9c83ac76) ) - ROM_LOAD32_BYTE( "obj-2b", 0x200001, 0x80000, CRC(de45ca8d) SHA1(f476ff1719f60d721d55fd1e40e465f48e7ed019) ) - ROM_LOAD32_BYTE( "obj-3b", 0x200000, 0x80000, CRC(dba830a2) SHA1(5bd899b39458978dd419bf01082782a02b2d9c20) ) + ROM_REGION( 0x200000, "sprite", 0 ) /* Sprites */ + ROM_LOAD32_BYTE( "obj-0b", 0x000003, 0x80000, CRC(c6986523) SHA1(1a4b0e95ade6314850b6e44f2debda0ab6e91397) ) + ROM_LOAD32_BYTE( "obj-1b", 0x000002, 0x80000, CRC(6af7d284) SHA1(c74f975c301ff15040be1b38359624ec9c83ac76) ) + ROM_LOAD32_BYTE( "obj-2b", 0x000001, 0x80000, CRC(de45ca8d) SHA1(f476ff1719f60d721d55fd1e40e465f48e7ed019) ) + ROM_LOAD32_BYTE( "obj-3b", 0x000000, 0x80000, CRC(dba830a2) SHA1(5bd899b39458978dd419bf01082782a02b2d9c20) ) ROM_REGION( 0x400000, "c123tmap", 0 ) /* Tiles */ NAMCOS2_GFXROM_LOAD_128K( "fl1-c0", 0x000000, CRC(cd9d2966) SHA1(39671f846542ba6ae47764674509127cf73e3d71) ) @@ -2748,12 +2754,11 @@ ROM_START( finallapd ) ROM_REGION( 0x8000, "c65mcu:external", ROMREGION_ERASE00 ) /* I/O MCU */ /* no external MCU ROM? previously loaded type C, but the game predates it */ - ROM_REGION( 0x400000, "sprite", 0 ) /* Sprites */ - ROM_FILL( 0, 0x200000, 0xff ) - ROM_LOAD32_BYTE( "obj-0b", 0x200003, 0x80000, CRC(c6986523) SHA1(1a4b0e95ade6314850b6e44f2debda0ab6e91397) ) - ROM_LOAD32_BYTE( "obj-1b", 0x200002, 0x80000, CRC(6af7d284) SHA1(c74f975c301ff15040be1b38359624ec9c83ac76) ) - ROM_LOAD32_BYTE( "obj-2b", 0x200001, 0x80000, CRC(de45ca8d) SHA1(f476ff1719f60d721d55fd1e40e465f48e7ed019) ) - ROM_LOAD32_BYTE( "obj-3b", 0x200000, 0x80000, CRC(dba830a2) SHA1(5bd899b39458978dd419bf01082782a02b2d9c20) ) + ROM_REGION( 0x200000, "sprite", 0 ) /* Sprites */ + ROM_LOAD32_BYTE( "obj-0b", 0x000003, 0x80000, CRC(c6986523) SHA1(1a4b0e95ade6314850b6e44f2debda0ab6e91397) ) + ROM_LOAD32_BYTE( "obj-1b", 0x000002, 0x80000, CRC(6af7d284) SHA1(c74f975c301ff15040be1b38359624ec9c83ac76) ) + ROM_LOAD32_BYTE( "obj-2b", 0x000001, 0x80000, CRC(de45ca8d) SHA1(f476ff1719f60d721d55fd1e40e465f48e7ed019) ) + ROM_LOAD32_BYTE( "obj-3b", 0x000000, 0x80000, CRC(dba830a2) SHA1(5bd899b39458978dd419bf01082782a02b2d9c20) ) ROM_REGION( 0x400000, "c123tmap", 0 ) /* Tiles */ NAMCOS2_GFXROM_LOAD_128K( "fl1-c0", 0x000000, CRC(cd9d2966) SHA1(39671f846542ba6ae47764674509127cf73e3d71) ) @@ -2794,12 +2799,11 @@ ROM_START( finallapc ) ROM_REGION( 0x8000, "c65mcu:external", ROMREGION_ERASE00 ) /* I/O MCU */ /* no external MCU ROM? previously loaded type C, but the game predates it */ - ROM_REGION( 0x400000, "sprite", 0 ) /* Sprites */ - ROM_FILL( 0, 0x200000, 0xff ) - ROM_LOAD32_BYTE( "obj-0b", 0x200003, 0x80000, CRC(c6986523) SHA1(1a4b0e95ade6314850b6e44f2debda0ab6e91397) ) - ROM_LOAD32_BYTE( "obj-1b", 0x200002, 0x80000, CRC(6af7d284) SHA1(c74f975c301ff15040be1b38359624ec9c83ac76) ) - ROM_LOAD32_BYTE( "obj-2b", 0x200001, 0x80000, CRC(de45ca8d) SHA1(f476ff1719f60d721d55fd1e40e465f48e7ed019) ) - ROM_LOAD32_BYTE( "obj-3b", 0x200000, 0x80000, CRC(dba830a2) SHA1(5bd899b39458978dd419bf01082782a02b2d9c20) ) + ROM_REGION( 0x200000, "sprite", 0 ) /* Sprites */ + ROM_LOAD32_BYTE( "obj-0b", 0x000003, 0x80000, CRC(c6986523) SHA1(1a4b0e95ade6314850b6e44f2debda0ab6e91397) ) + ROM_LOAD32_BYTE( "obj-1b", 0x000002, 0x80000, CRC(6af7d284) SHA1(c74f975c301ff15040be1b38359624ec9c83ac76) ) + ROM_LOAD32_BYTE( "obj-2b", 0x000001, 0x80000, CRC(de45ca8d) SHA1(f476ff1719f60d721d55fd1e40e465f48e7ed019) ) + ROM_LOAD32_BYTE( "obj-3b", 0x000000, 0x80000, CRC(dba830a2) SHA1(5bd899b39458978dd419bf01082782a02b2d9c20) ) ROM_REGION( 0x400000, "c123tmap", 0 ) /* Tiles */ NAMCOS2_GFXROM_LOAD_128K( "fl1-c0", 0x000000, CRC(cd9d2966) SHA1(39671f846542ba6ae47764674509127cf73e3d71) ) @@ -2840,12 +2844,11 @@ ROM_START( finallapjc ) ROM_REGION( 0x8000, "c65mcu:external", ROMREGION_ERASE00 ) /* I/O MCU */ /* no external MCU ROM? previously loaded type C, but the game predates it */ - ROM_REGION( 0x400000, "sprite", 0 ) /* Sprites */ - ROM_FILL( 0, 0x200000, 0xff ) - ROM_LOAD32_BYTE( "obj-0b", 0x200003, 0x80000, CRC(c6986523) SHA1(1a4b0e95ade6314850b6e44f2debda0ab6e91397) ) - ROM_LOAD32_BYTE( "obj-1b", 0x200002, 0x80000, CRC(6af7d284) SHA1(c74f975c301ff15040be1b38359624ec9c83ac76) ) - ROM_LOAD32_BYTE( "obj-2b", 0x200001, 0x80000, CRC(de45ca8d) SHA1(f476ff1719f60d721d55fd1e40e465f48e7ed019) ) - ROM_LOAD32_BYTE( "obj-3b", 0x200000, 0x80000, CRC(dba830a2) SHA1(5bd899b39458978dd419bf01082782a02b2d9c20) ) + ROM_REGION( 0x200000, "sprite", 0 ) /* Sprites */ + ROM_LOAD32_BYTE( "obj-0b", 0x000003, 0x80000, CRC(c6986523) SHA1(1a4b0e95ade6314850b6e44f2debda0ab6e91397) ) + ROM_LOAD32_BYTE( "obj-1b", 0x000002, 0x80000, CRC(6af7d284) SHA1(c74f975c301ff15040be1b38359624ec9c83ac76) ) + ROM_LOAD32_BYTE( "obj-2b", 0x000001, 0x80000, CRC(de45ca8d) SHA1(f476ff1719f60d721d55fd1e40e465f48e7ed019) ) + ROM_LOAD32_BYTE( "obj-3b", 0x000000, 0x80000, CRC(dba830a2) SHA1(5bd899b39458978dd419bf01082782a02b2d9c20) ) ROM_REGION( 0x400000, "c123tmap", 0 ) /* Tiles */ NAMCOS2_GFXROM_LOAD_128K( "fl1-c0", 0x000000, CRC(cd9d2966) SHA1(39671f846542ba6ae47764674509127cf73e3d71) ) @@ -2886,12 +2889,11 @@ ROM_START( finallapjb ) ROM_REGION( 0x8000, "c65mcu:external", ROMREGION_ERASE00 ) /* I/O MCU */ /* no external MCU ROM? previously loaded type C, but the game predates it */ - ROM_REGION( 0x400000, "sprite", 0 ) /* Sprites */ - ROM_FILL( 0, 0x200000, 0xff ) - ROM_LOAD32_BYTE( "obj-0b", 0x200003, 0x80000, CRC(c6986523) SHA1(1a4b0e95ade6314850b6e44f2debda0ab6e91397) ) - ROM_LOAD32_BYTE( "obj-1b", 0x200002, 0x80000, CRC(6af7d284) SHA1(c74f975c301ff15040be1b38359624ec9c83ac76) ) - ROM_LOAD32_BYTE( "obj-2b", 0x200001, 0x80000, CRC(de45ca8d) SHA1(f476ff1719f60d721d55fd1e40e465f48e7ed019) ) - ROM_LOAD32_BYTE( "obj-3b", 0x200000, 0x80000, CRC(dba830a2) SHA1(5bd899b39458978dd419bf01082782a02b2d9c20) ) + ROM_REGION( 0x200000, "sprite", 0 ) /* Sprites */ + ROM_LOAD32_BYTE( "obj-0b", 0x000003, 0x80000, CRC(c6986523) SHA1(1a4b0e95ade6314850b6e44f2debda0ab6e91397) ) + ROM_LOAD32_BYTE( "obj-1b", 0x000002, 0x80000, CRC(6af7d284) SHA1(c74f975c301ff15040be1b38359624ec9c83ac76) ) + ROM_LOAD32_BYTE( "obj-2b", 0x000001, 0x80000, CRC(de45ca8d) SHA1(f476ff1719f60d721d55fd1e40e465f48e7ed019) ) + ROM_LOAD32_BYTE( "obj-3b", 0x000000, 0x80000, CRC(dba830a2) SHA1(5bd899b39458978dd419bf01082782a02b2d9c20) ) ROM_REGION( 0x400000, "c123tmap", 0 ) /* Tiles */ NAMCOS2_GFXROM_LOAD_128K( "fl1-c0", 0x000000, CRC(cd9d2966) SHA1(39671f846542ba6ae47764674509127cf73e3d71) ) @@ -5712,9 +5714,9 @@ GAME( 1988, pheliosj, phelios, base2, base, namcos2_state, init_pheli GAME( 1989, dirtfoxj, 0, base2, dirtfox, namcos2_state, init_dirtfoxj, ROT90, "Namco", "Dirt Fox (Japan)", MACHINE_NODEVICE_LAN | MACHINE_SUPPORTS_SAVE ) -GAMEL( 1989, fourtrax, 0, finallap, fourtrax, namcos2_state, init_fourtrax, ROT0, "Namco", "Four Trax (World)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NODEVICE_LAN | MACHINE_SUPPORTS_SAVE, layout_finallap ) -GAMEL( 1989, fourtraxj, fourtrax, finallap, fourtrax, namcos2_state, init_fourtrax, ROT0, "Namco", "Four Trax (Japan)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NODEVICE_LAN | MACHINE_SUPPORTS_SAVE, layout_finallap ) -GAMEL( 1989, fourtraxa, fourtrax, finallap, fourtrax, namcos2_state, init_fourtrax, ROT0, "Namco (Atari license?)", "Four Trax (US?, censored banners)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NODEVICE_LAN | MACHINE_SUPPORTS_SAVE, layout_finallap ) // boards using the ROM code FX4 were produced for Atari? there's no US region warning or Atari copyright tho, modded version of the World code +GAMEL( 1989, fourtrax, 0, base_fl, fourtrax, namcos2_state, init_fourtrax, ROT0, "Namco", "Four Trax (World)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NODEVICE_LAN | MACHINE_SUPPORTS_SAVE, layout_finallap ) +GAMEL( 1989, fourtraxj, fourtrax, base_fl, fourtrax, namcos2_state, init_fourtrax, ROT0, "Namco", "Four Trax (Japan)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NODEVICE_LAN | MACHINE_SUPPORTS_SAVE, layout_finallap ) +GAMEL( 1989, fourtraxa, fourtrax, base_fl, fourtrax, namcos2_state, init_fourtrax, ROT0, "Namco (Atari license?)", "Four Trax (US?, censored banners)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NODEVICE_LAN | MACHINE_SUPPORTS_SAVE, layout_finallap ) // boards using the ROM code FX4 were produced for Atari? there's no US region warning or Atari copyright tho, modded version of the World code GAME( 1989, valkyrie, 0, base3, base, namcos2_state, init_valkyrie, ROT90, "Namco", "Valkyrie no Densetsu (Japan)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/includes/namcos2.h b/src/mame/includes/namcos2.h index 14cad5bc2cc..9181d69f1c6 100644 --- a/src/mame/includes/namcos2.h +++ b/src/mame/includes/namcos2.h @@ -80,6 +80,7 @@ public: void sgunner2(machine_config &config); void base2(machine_config &config); void finallap_noio(machine_config &config); + void base_fl(machine_config &config); void finallap(machine_config &config); void finallap_c68(machine_config &config); void finalap2(machine_config &config); diff --git a/src/mame/video/namcos2.cpp b/src/mame/video/namcos2.cpp index 922a9def87b..6b6a8ac0fca 100644 --- a/src/mame/video/namcos2.cpp +++ b/src/mame/video/namcos2.cpp @@ -234,7 +234,7 @@ uint32_t namcos2_state::screen_update_metlhawk(screen_device &screen, bitmap_ind m_c123tmap->draw(screen, bitmap, clip, pri / 2); } m_c169roz->draw(screen, bitmap, clip, pri); - m_ns2sprite->draw_sprites_metalhawk(screen, bitmap, clip, pri); + m_ns2sprite->draw_sprites(screen, bitmap, clip, pri, 0); } return 0; } diff --git a/src/mame/video/namcos2_sprite.cpp b/src/mame/video/namcos2_sprite.cpp index 8ef0f328d0d..b7ed3f38858 100644 --- a/src/mame/video/namcos2_sprite.cpp +++ b/src/mame/video/namcos2_sprite.cpp @@ -22,12 +22,29 @@ #include "namcos2_sprite.h" DEFINE_DEVICE_TYPE(NAMCOS2_SPRITE, namcos2_sprite_device, "namcos2_sprite", "Namco System 2 Sprites (C106,C134,C135,C146)") +DEFINE_DEVICE_TYPE(NAMCOS2_SPRITE_FINALLAP, namcos2_sprite_finallap_device, "namcos2_sprite_finallap", "Namco System 2 Sprites (C106,C134,C135,C146) (Final Lap)") +DEFINE_DEVICE_TYPE(NAMCOS2_SPRITE_METALHAWK, namcos2_sprite_metalhawk_device, "namcos2_sprite_metalhawk", "Namco System 2 Sprites (C106,C134,C135,C146) (Metal Hawk)") namcos2_sprite_device::namcos2_sprite_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : - device_t(mconfig, NAMCOS2_SPRITE, tag, owner, clock), + namcos2_sprite_device(mconfig, NAMCOS2_SPRITE, tag, owner, clock) +{ +} + +namcos2_sprite_device::namcos2_sprite_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock) : + device_t(mconfig, type, tag, owner, clock), m_gfxdecode(*this, finder_base::DUMMY_TAG), - m_spriteram(*this, finder_base::DUMMY_TAG), - m_force_32x32(false) + m_spriteram(*this, finder_base::DUMMY_TAG) +{ +} + + +namcos2_sprite_metalhawk_device::namcos2_sprite_metalhawk_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : + namcos2_sprite_device(mconfig, NAMCOS2_SPRITE_METALHAWK, tag, owner, clock) +{ +} + +namcos2_sprite_finallap_device::namcos2_sprite_finallap_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : + namcos2_sprite_device(mconfig, NAMCOS2_SPRITE_FINALLAP, tag, owner, clock) { } @@ -192,6 +209,22 @@ void namcos2_sprite_device::zdrawgfxzoom( /* nop */ } +void namcos2_sprite_device::get_tilenum_and_size(const u16 word0, const u16 word1, u32 &sprn, bool &is_32) +{ + sprn = (word1 >> 2) & 0x0fff; + is_32 = bool(word0 & 0x200); +} + +void namcos2_sprite_finallap_device::get_tilenum_and_size(const u16 word0, const u16 word1, u32 &sprn, bool &is_32) +{ + // Final Lap schematics show an older sprite board with lower capacity + // and the 32/16 pixel mode select on a different bit + // this is needed for the title screen to look correct, in addition to various in game sparks effects etc. + + sprn = (word1 >> 2) & 0x07ff; + is_32 = bool((word1 >> 2) & 0x800); +} + void namcos2_sprite_device::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int pri, int control) { int offset = (control & 0x000f) * (128 * 4); @@ -229,12 +262,10 @@ void namcos2_sprite_device::draw_sprites(screen_device &screen, bitmap_ind16 &bi const u16 offset4 = m_spriteram[offset + (loop * 4) + 2]; const int sizey = ((word0 >> 10) & 0x003f) + 1; - // It appears that Final Lap does not support 16x16 sprites, otherwise the titlescreen and - // rear-view mirror have glitches. Other games (eg. mirninja) do correctly set it. - // - // It's not expected that there's a missing emulation feature for disabling 16x16 sprite mode, - // but simply the early Namco System 2 hardware that Final Lap runs on does not support it. - bool is_32 = bool(word0 & 0x200) || m_force_32x32; + u32 sprn; + bool is_32; + + get_tilenum_and_size(word0, word1, sprn, is_32); int sizex = (word3 >> 10) & 0x003f; if (!is_32) sizex >>= 1; @@ -242,7 +273,6 @@ void namcos2_sprite_device::draw_sprites(screen_device &screen, bitmap_ind16 &bi if ((sizey - 1) && sizex) { const u32 color = (word3 >> 4) & 0x000f; - const u32 sprn = (word1 >> 2) & 0x0fff; const int ypos = (0x1ff - (word0 & 0x01ff)) - 0x50 + 0x02; const int xpos = (offset4 & 0x03ff) - 0x50 + 0x07; const bool flipy = word1 & 0x8000; @@ -275,7 +305,7 @@ void namcos2_sprite_device::draw_sprites(screen_device &screen, bitmap_ind16 &bi } } /* draw_sprites */ -void namcos2_sprite_device::draw_sprites_metalhawk(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int pri) +void namcos2_sprite_metalhawk_device::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int pri, int control) { /** * word#0 diff --git a/src/mame/video/namcos2_sprite.h b/src/mame/video/namcos2_sprite.h index 9e824273c71..4b9e4a03040 100644 --- a/src/mame/video/namcos2_sprite.h +++ b/src/mame/video/namcos2_sprite.h @@ -18,27 +18,50 @@ public: template void set_gfxdecode_tag(T &&tag) { m_gfxdecode.set_tag(std::forward(tag)); } template void set_spriteram_tag(T &&tag) { m_spriteram.set_tag(std::forward(tag)); } - void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int pri, int control ); - void draw_sprites_metalhawk(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int pri ); - - void force_32x32_sprites(bool force) { m_force_32x32 = force; } + virtual void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int pri, int control ); protected: + namcos2_sprite_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock); + // device-level overrides virtual void device_start() override; -private: // general void zdrawgfxzoom(screen_device &screen, bitmap_ind16 &dest_bmp, const rectangle &clip, gfx_element *gfx, u32 code, u32 color, bool flipx, bool flipy, int sx, int sy, int scalex, int scaley, int zpos); void zdrawgfxzoom(screen_device &screen, bitmap_rgb32 &dest_bmp, const rectangle &clip, gfx_element *gfx, u32 code, u32 color, bool flipx, bool flipy, int sx, int sy, int scalex, int scaley, int zpos); + virtual void get_tilenum_and_size(const u16 word0, const u16 word1, u32 &sprn, bool &is_32); + required_device m_gfxdecode; required_shared_ptr m_spriteram; - bool m_force_32x32; }; +class namcos2_sprite_finallap_device : public namcos2_sprite_device +{ +public: + // construction/destruction + namcos2_sprite_finallap_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + +protected: + virtual void get_tilenum_and_size(const u16 word0, const u16 word1, u32& sprn, bool& is_32) override; +}; + + +class namcos2_sprite_metalhawk_device : public namcos2_sprite_device +{ +public: + // construction/destruction + namcos2_sprite_metalhawk_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + + virtual void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int pri, int control ) override; +}; + + + // device type definition DECLARE_DEVICE_TYPE(NAMCOS2_SPRITE, namcos2_sprite_device) +DECLARE_DEVICE_TYPE(NAMCOS2_SPRITE_FINALLAP, namcos2_sprite_finallap_device) +DECLARE_DEVICE_TYPE(NAMCOS2_SPRITE_METALHAWK, namcos2_sprite_metalhawk_device) #endif // MAME_VIDEO_NAMCOS2_SPRITE_H -- cgit v1.2.3 From dbb54033db5fc8358e2f5b5ce96cdd030526e846 Mon Sep 17 00:00:00 2001 From: cracyc Date: Sun, 23 May 2021 10:57:26 -0500 Subject: fmtowns: fix sprite gaps --- src/mame/video/fmtowns.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/mame/video/fmtowns.cpp b/src/mame/video/fmtowns.cpp index 7ded2586296..2235e03897c 100644 --- a/src/mame/video/fmtowns.cpp +++ b/src/mame/video/fmtowns.cpp @@ -900,19 +900,19 @@ void towns_state::render_sprite_16(uint32_t poffset, uint16_t x, uint16_t y, boo if(xflip) { if (xhalfsize) - xstart = x+8; + xstart = x+7; else - xstart = x+16; - xend = x; + xstart = x+15; + xend = x-1; xdir = -1; } else { - xstart = x+1; + xstart = x; if (xhalfsize) - xend = x+9; + xend = x+8; else - xend = x+17; + xend = x+16; xdir = 1; } if(yflip) @@ -1018,7 +1018,7 @@ TIMER_CALLBACK_MEMBER(towns_state::draw_sprites) poffset = (attr & 0x3ff) << 7; coffset = (colour & 0xfff) << 5; #ifdef SPR_DEBUG - printf("Sprite4 #%i, X %i Y %i Attr %04x Col %04x Poff %08x Coff %08x\n", + logerror("Sprite4 #%i, X %i Y %i Attr %04x Col %04x Poff %08x Coff %08x\n", n,x,y,attr,colour,poffset,coffset); #endif if(!(colour & 0x2000)) @@ -1028,7 +1028,7 @@ TIMER_CALLBACK_MEMBER(towns_state::draw_sprites) { poffset = (attr & 0x3ff) << 7; #ifdef SPR_DEBUG - printf("Sprite16 #%i, X %i Y %i Attr %04x Col %04x Poff %08x", + logerror("Sprite16 #%i, X %i Y %i Attr %04x Col %04x Poff %08x\n", n,x,y,attr,colour,poffset); #endif if(!(colour & 0x2000)) -- cgit v1.2.3 From 7f6658b5f67d65719d0c7c1eada2627b673c8373 Mon Sep 17 00:00:00 2001 From: Olivier Galibert Date: Mon, 24 May 2021 18:44:27 +0200 Subject: swim: Fixed bugs linked to device selection --- src/devices/machine/swim1.cpp | 11 +++++++++-- src/devices/machine/swim2.cpp | 2 +- src/devices/machine/swim3.cpp | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/devices/machine/swim1.cpp b/src/devices/machine/swim1.cpp index 75c3b12b186..8e747a219bd 100644 --- a/src/devices/machine/swim1.cpp +++ b/src/devices/machine/swim1.cpp @@ -298,8 +298,12 @@ void swim1_device::ism_write(offs_t offset, u8 data) m_ism_mode &= ~data; m_ism_param_idx = 0; ism_show_mode(); - if(!(m_ism_mode & 0x40)) + if(!(m_ism_mode & 0x40)) { logerror("switch to iwm\n"); + u8 ism_devsel = m_ism_mode & 0x80 ? (m_ism_mode >> 1) & 3 : 0; + if(ism_devsel != m_iwm_devsel) + m_devsel_cb(m_iwm_devsel); + } break; case 0x7: @@ -315,7 +319,7 @@ void swim1_device::ism_write(offs_t offset, u8 data) if(m_ism_mode & 0x01) ism_fifo_clear(); - if((m_ism_mode ^ prev_mode) & 0x06) + if((m_ism_mode ^ prev_mode) & 0x86) m_devsel_cb(m_ism_mode & 0x80 ? (m_ism_mode >> 1) & 3 : 0); if((m_ism_mode ^ prev_mode) & 0x20) m_hdsel_cb((m_ism_mode >> 5) & 1); @@ -533,6 +537,9 @@ u8 swim1_device::iwm_control(int offset, u8 data) if(data & 0x40) { m_ism_mode |= 0x40; logerror("switch to ism\n"); + u8 ism_devsel = m_ism_mode & 0x80 ? (m_ism_mode >> 1) & 3 : 0; + if(ism_devsel != m_iwm_devsel) + m_devsel_cb(ism_devsel); } break; } diff --git a/src/devices/machine/swim2.cpp b/src/devices/machine/swim2.cpp index da26c70cb41..69b718a4cef 100644 --- a/src/devices/machine/swim2.cpp +++ b/src/devices/machine/swim2.cpp @@ -297,7 +297,7 @@ void swim2_device::write(offs_t offset, u8 data) if(m_mode & 0x01) fifo_clear(); - if((m_mode ^ prev_mode) & 0x06) + if((m_mode ^ prev_mode) & 0x86) m_devsel_cb(m_mode & 0x80 ? (m_mode >> 1) & 3 : 0); if((m_mode ^ prev_mode) & 0x20) m_hdsel_cb((m_mode >> 5) & 1); diff --git a/src/devices/machine/swim3.cpp b/src/devices/machine/swim3.cpp index ec24c6e2606..1be0e9937f6 100644 --- a/src/devices/machine/swim3.cpp +++ b/src/devices/machine/swim3.cpp @@ -254,7 +254,7 @@ void swim3_device::write(offs_t offset, u8 data) break; } - if((m_mode ^ prev_mode) & 0x06) + if((m_mode ^ prev_mode) & 0x86) m_devsel_cb((m_mode >> 1) & 3); if((m_mode ^ prev_mode) & 0x20) m_hdsel_cb((m_mode >> 5) & 1); -- cgit v1.2.3