Merge pull request #5017 from cam900/slapshot_args

slapshot.cpp : Updates
This commit is contained in:
R. Belmont 2019-05-10 11:34:44 -04:00 committed by GitHub
commit 7bf4459620
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 125 additions and 145 deletions

View File

@ -173,13 +173,13 @@ INTERRUPT_GEN_MEMBER(slapshot_state::interrupt)
GAME INPUTS
**********************************************************/
READ16_MEMBER(slapshot_state::service_input_r)
u16 slapshot_state::service_input_r(offs_t offset)
{
switch (offset)
{
case 0x03:
return ((ioport("SYSTEM")->read() & 0xef) |
(ioport("SERVICE")->read() & 0x10)) << 8; /* IN3 + service switch */
return ((m_io_system->read() & 0xef) |
(m_io_service->read() & 0x10)) << 8; /* IN3 + service switch */
default:
return m_tc0640fio->read(offset) << 8;
@ -200,7 +200,7 @@ void slapshot_state::coin_control_w(u8 data)
void slapshot_state::sound_bankswitch_w(u8 data)
{
membank("z80bank")->set_entry(data & 3);
m_z80bank->set_entry(data & 3);
}
/***********************************************************
@ -246,7 +246,7 @@ void slapshot_state::opwolf3_map(address_map &map)
/***************************************************************************/
void slapshot_state::opwolf3_z80_sound_map(address_map &map)
void slapshot_state::sound_map(address_map &map)
{
map(0x0000, 0x3fff).rom();
map(0x4000, 0x7fff).bankr("z80bank");
@ -380,14 +380,9 @@ static const gfx_layout tilelayout =
16,16,
RGN_FRAC(1,2),
6,
{ RGN_FRAC(1,2)+0, RGN_FRAC(1,2)+1, 0, 1, 2, 3 },
{
4, 0, 12, 8,
16+4, 16+0, 16+12, 16+8,
32+4, 32+0, 32+12, 32+8,
48+4, 48+0, 48+12, 48+8 },
{ 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 },
{ RGN_FRAC(1,2)+0, RGN_FRAC(1,2)+1, STEP4(0,1) },
{ STEP4(3*4,-4), STEP4(7*4,-4), STEP4(11*4,-4), STEP4(15*4,-4), },
{ STEP16(0,16*4) },
128*8 /* every sprite takes 128 consecutive bytes */
};
@ -396,15 +391,15 @@ static const gfx_layout charlayout =
16,16, /* 16*16 characters */
RGN_FRAC(1,1),
4, /* 4 bits per pixel */
{ 0, 1, 2, 3 },
{ 1*4, 0*4, 5*4, 4*4, 3*4, 2*4, 7*4, 6*4, 9*4, 8*4, 13*4, 12*4, 11*4, 10*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 },
{ STEP4(0,1) },
{ STEP8(7*4,-4), STEP8(15*4,-4) },
{ STEP16(0,16*4) },
128*8 /* every sprite takes 128 consecutive bytes */
};
static GFXDECODE_START( gfx_slapshot )
GFXDECODE_ENTRY( "gfx2", 0x0, tilelayout, 0, 256 ) /* sprite parts */
GFXDECODE_ENTRY( "gfx1", 0x0, charlayout, 4096, 256 ) /* sprites & playfield */
GFXDECODE_ENTRY( "gfx1", 0x0, charlayout, 4096, 256 ) /* playfield */
GFXDECODE_END
@ -414,7 +409,7 @@ GFXDECODE_END
void slapshot_state::machine_start()
{
membank("z80bank")->configure_entries(0, 4, memregion("audiocpu")->base(), 0x4000);
m_z80bank->configure_entries(0, 4, memregion("audiocpu")->base(), 0x4000);
m_int6_timer = timer_alloc(TIMER_SLAPSHOT_INTERRUPT6);
}
@ -428,7 +423,7 @@ void slapshot_state::slapshot(machine_config &config)
m_maincpu->set_vblank_int("screen", FUNC(slapshot_state::interrupt));
z80_device &audiocpu(Z80(config, "audiocpu", 32000000/8)); /* 4 MHz */
audiocpu.set_addrmap(AS_PROGRAM, &slapshot_state::opwolf3_z80_sound_map);
audiocpu.set_addrmap(AS_PROGRAM, &slapshot_state::sound_map);
config.m_minimum_quantum = attotime::from_hz(600);
@ -446,7 +441,7 @@ void slapshot_state::slapshot(machine_config &config)
screen.set_size(40*8, 32*8);
screen.set_visarea(0*8, 40*8-1, 2*8, 30*8-1);
screen.set_screen_update(FUNC(slapshot_state::screen_update));
screen.screen_vblank().set(FUNC(slapshot_state::screen_vblank_taito_no_buffer));
screen.screen_vblank().set(FUNC(slapshot_state::screen_vblank_no_buffer));
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_slapshot);
@ -489,7 +484,7 @@ void slapshot_state::opwolf3(machine_config &config)
m_maincpu->set_vblank_int("screen", FUNC(slapshot_state::interrupt));
z80_device &audiocpu(Z80(config, "audiocpu", 32000000/8)); /* 4 MHz */
audiocpu.set_addrmap(AS_PROGRAM, &slapshot_state::opwolf3_z80_sound_map);
audiocpu.set_addrmap(AS_PROGRAM, &slapshot_state::sound_map);
config.m_minimum_quantum = attotime::from_hz(600);
@ -514,7 +509,7 @@ void slapshot_state::opwolf3(machine_config &config)
screen.set_size(40*8, 32*8);
screen.set_visarea(0*8, 40*8-1, 2*8, 30*8-1);
screen.set_screen_update(FUNC(slapshot_state::screen_update));
screen.screen_vblank().set(FUNC(slapshot_state::screen_vblank_taito_no_buffer));
screen.screen_vblank().set(FUNC(slapshot_state::screen_vblank_no_buffer));
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_slapshot);
@ -563,12 +558,12 @@ ROM_START( slapshot )
ROM_LOAD ( "d71-07.77", 0x00000, 0x10000, CRC(dd5f670c) SHA1(743a9563c40fe40178c9ec8eece71a08380c2239) )
ROM_REGION( 0x100000, "gfx1", 0 )
ROM_LOAD16_BYTE( "d71-04.79", 0x00000, 0x80000, CRC(b727b81c) SHA1(9f56160e2b3e4d59cfa96b5c013f4e368781666e) ) /* SCR */
ROM_LOAD16_BYTE( "d71-05.80", 0x00001, 0x80000, CRC(7b0f5d6d) SHA1(a54e4a651dc7cdc160286afb3d38531c7b9396b1) )
ROM_LOAD32_WORD_SWAP( "d71-04.79", 0x00002, 0x80000, CRC(b727b81c) SHA1(9f56160e2b3e4d59cfa96b5c013f4e368781666e) ) /* SCR */
ROM_LOAD32_WORD_SWAP( "d71-05.80", 0x00000, 0x80000, CRC(7b0f5d6d) SHA1(a54e4a651dc7cdc160286afb3d38531c7b9396b1) )
ROM_REGION( 0x400000, "gfx2", 0 )
ROM_LOAD16_BYTE( "d71-01.23", 0x000000, 0x100000, CRC(0b1e8c27) SHA1(ffa452f7414f3d61edb69bb61b29a0cc8d9176d0) ) /* OBJ 6bpp */
ROM_LOAD16_BYTE( "d71-02.24", 0x000001, 0x100000, CRC(ccaaea2d) SHA1(71b507f215f37e991abae5523642417a6b23a70d) )
ROM_LOAD16_BYTE( "d71-01.23", 0x000001, 0x100000, CRC(0b1e8c27) SHA1(ffa452f7414f3d61edb69bb61b29a0cc8d9176d0) ) /* OBJ 6bpp */
ROM_LOAD16_BYTE( "d71-02.24", 0x000000, 0x100000, CRC(ccaaea2d) SHA1(71b507f215f37e991abae5523642417a6b23a70d) )
ROM_LOAD ( "d71-03.25", 0x300000, 0x100000, CRC(dccef9ec) SHA1(ee7a49727b822cf4c1d7acff994b77ea6191c423) )
ROM_FILL ( 0x200000, 0x100000, 0x00 )
@ -597,12 +592,12 @@ ROM_START( opwolf3 )
ROM_LOAD ( "d74_22.77", 0x00000, 0x10000, CRC(118374a6) SHA1(cc1d0d28efdf1df3e648e7d932405811854ba4ee) )
ROM_REGION( 0x400000, "gfx1", 0 )
ROM_LOAD16_BYTE( "d74_05.80", 0x000000, 0x200000, CRC(85ea64cc) SHA1(1960a934191c451df1554323d47f6fc64939b0ce) ) /* SCR */
ROM_LOAD16_BYTE( "d74_06.81", 0x000001, 0x200000, CRC(2fa1e08d) SHA1(f1f34b308202fe08e73535424b5b4e3d91295224) )
ROM_LOAD32_WORD_SWAP( "d74_05.80", 0x000002, 0x200000, CRC(85ea64cc) SHA1(1960a934191c451df1554323d47f6fc64939b0ce) ) /* SCR */
ROM_LOAD32_WORD_SWAP( "d74_06.81", 0x000000, 0x200000, CRC(2fa1e08d) SHA1(f1f34b308202fe08e73535424b5b4e3d91295224) )
ROM_REGION( 0x800000, "gfx2", 0 )
ROM_LOAD16_BYTE( "d74_02.23", 0x000000, 0x200000, CRC(aab86332) SHA1(b9133407504e9ef4fd5ae7d284cdb0c7f78f9a99) ) /* OBJ 6bpp */
ROM_LOAD16_BYTE( "d74_03.24", 0x000001, 0x200000, CRC(3f398916) SHA1(4b6a3ee0baf5f32e24e5040f233300f1ca347fe7) )
ROM_LOAD16_BYTE( "d74_02.23", 0x000001, 0x200000, CRC(aab86332) SHA1(b9133407504e9ef4fd5ae7d284cdb0c7f78f9a99) ) /* OBJ 6bpp */
ROM_LOAD16_BYTE( "d74_03.24", 0x000000, 0x200000, CRC(3f398916) SHA1(4b6a3ee0baf5f32e24e5040f233300f1ca347fe7) )
ROM_LOAD ( "d74_04.25", 0x600000, 0x200000, CRC(2f385638) SHA1(1ba2ec7d9b1c491e1cc6d7e646e09ef2bc063f25) )
ROM_FILL ( 0x400000, 0x200000, 0x00 )
@ -623,12 +618,12 @@ ROM_START( opwolf3u )
ROM_LOAD ( "d74_19.77", 0x00000, 0x10000, CRC(05d53f06) SHA1(48b0cd68ad3758f424552a4e3833c5a1c2f1825b) )
ROM_REGION( 0x400000, "gfx1", 0 )
ROM_LOAD16_BYTE( "d74_05.80", 0x000000, 0x200000, CRC(85ea64cc) SHA1(1960a934191c451df1554323d47f6fc64939b0ce) ) /* SCR */
ROM_LOAD16_BYTE( "d74_06.81", 0x000001, 0x200000, CRC(2fa1e08d) SHA1(f1f34b308202fe08e73535424b5b4e3d91295224) )
ROM_LOAD32_WORD_SWAP( "d74_05.80", 0x000002, 0x200000, CRC(85ea64cc) SHA1(1960a934191c451df1554323d47f6fc64939b0ce) ) /* SCR */
ROM_LOAD32_WORD_SWAP( "d74_06.81", 0x000000, 0x200000, CRC(2fa1e08d) SHA1(f1f34b308202fe08e73535424b5b4e3d91295224) )
ROM_REGION( 0x800000, "gfx2", 0 )
ROM_LOAD16_BYTE( "d74_02.23", 0x000000, 0x200000, CRC(aab86332) SHA1(b9133407504e9ef4fd5ae7d284cdb0c7f78f9a99) ) /* OBJ 6bpp */
ROM_LOAD16_BYTE( "d74_03.24", 0x000001, 0x200000, CRC(3f398916) SHA1(4b6a3ee0baf5f32e24e5040f233300f1ca347fe7) )
ROM_LOAD16_BYTE( "d74_02.23", 0x000001, 0x200000, CRC(aab86332) SHA1(b9133407504e9ef4fd5ae7d284cdb0c7f78f9a99) ) /* OBJ 6bpp */
ROM_LOAD16_BYTE( "d74_03.24", 0x000000, 0x200000, CRC(3f398916) SHA1(4b6a3ee0baf5f32e24e5040f233300f1ca347fe7) )
ROM_LOAD ( "d74_04.25", 0x600000, 0x200000, CRC(2f385638) SHA1(1ba2ec7d9b1c491e1cc6d7e646e09ef2bc063f25) )
ROM_FILL ( 0x400000, 0x200000, 0x00 )
@ -639,29 +634,29 @@ ROM_START( opwolf3u )
ROM_END
void slapshot_state::init_slapshot()
void slapshot_state::driver_init()
{
uint8_t *gfx = memregion("gfx2")->base();
int size = memregion("gfx2")->bytes();
u8 *gfx = memregion("gfx2")->base();
const u32 size = memregion("gfx2")->bytes();
uint32_t offset = size / 2;
for (uint32_t i = size / 2 + size / 4; i < size; i++)
u32 offset = size / 2;
for (u32 i = size / 2 + size / 4; i < size; i++)
{
/* Expand 2bits into 4bits format */
int data = gfx[i];
int d1 = (data >> 0) & 3;
int d2 = (data >> 2) & 3;
int d3 = (data >> 4) & 3;
int d4 = (data >> 6) & 3;
gfx[offset] = (d1 << 2) | (d2 << 6);
offset++;
const u8 data = gfx[i];
const u8 d1 = (data >> 0) & 3;
const u8 d2 = (data >> 2) & 3;
const u8 d3 = (data >> 4) & 3;
const u8 d4 = (data >> 6) & 3;
gfx[offset] = (d3 << 2) | (d4 << 6);
offset++;
gfx[offset] = (d1 << 2) | (d2 << 6);
offset++;
}
}
GAME( 1994, slapshot, 0, slapshot, slapshot, slapshot_state, init_slapshot, ROT0, "Taito Corporation", "Slap Shot (Japan)", MACHINE_SUPPORTS_SAVE )
GAME( 1994, opwolf3, 0, opwolf3, opwolf3, slapshot_state, init_slapshot, ROT0, "Taito Corporation Japan", "Operation Wolf 3 (World)", MACHINE_SUPPORTS_SAVE )
GAME( 1994, opwolf3u, opwolf3, opwolf3, opwolf3, slapshot_state, init_slapshot, ROT0, "Taito America Corporation", "Operation Wolf 3 (US)", MACHINE_SUPPORTS_SAVE )
GAME( 1994, slapshot, 0, slapshot, slapshot, slapshot_state, driver_init, ROT0, "Taito Corporation", "Slap Shot (Japan)", MACHINE_SUPPORTS_SAVE )
GAME( 1994, opwolf3, 0, opwolf3, opwolf3, slapshot_state, driver_init, ROT0, "Taito Corporation Japan", "Operation Wolf 3 (World)", MACHINE_SUPPORTS_SAVE )
GAME( 1994, opwolf3u, opwolf3, opwolf3, opwolf3, slapshot_state, driver_init, ROT0, "Taito America Corporation", "Operation Wolf 3 (US)", MACHINE_SUPPORTS_SAVE )

View File

@ -29,13 +29,16 @@ public:
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
m_spriteram(*this,"spriteram"),
m_spriteext(*this,"spriteext")
m_spriteext(*this,"spriteext"),
m_z80bank(*this,"z80bank"),
m_io_system(*this,"SYSTEM"),
m_io_service(*this,"SERVICE")
{ }
void opwolf3(machine_config &config);
void slapshot(machine_config &config);
void init_slapshot();
void driver_init() override;
protected:
enum
@ -50,12 +53,12 @@ protected:
private:
struct slapshot_tempsprite
{
int gfx;
int code,color;
int flipx,flipy;
u8 gfx;
u32 code,color;
bool flipx,flipy;
int x,y;
int zoomx,zoomy;
int primask;
u32 primask;
};
/* devices */
@ -68,39 +71,43 @@ private:
required_device<palette_device> m_palette;
/* memory pointers */
required_shared_ptr<uint16_t> m_spriteram;
required_shared_ptr<uint16_t> m_spriteext;
std::unique_ptr<uint16_t[]> m_spriteram_buffered;
std::unique_ptr<uint16_t[]> m_spriteram_delayed;
required_shared_ptr<u16> m_spriteram;
required_shared_ptr<u16> m_spriteext;
std::unique_ptr<u16[]> m_spriteram_buffered;
std::unique_ptr<u16[]> m_spriteram_delayed;
required_memory_bank m_z80bank;
optional_ioport m_io_system;
optional_ioport m_io_service;
/* video-related */
slapshot_tempsprite *m_spritelist;
int32_t m_sprites_disabled;
int32_t m_sprites_active_area;
int32_t m_sprites_master_scrollx;
int32_t m_sprites_master_scrolly;
int m_sprites_flipscreen;
int m_prepare_sprites;
int m_dislayer[5];
bool m_sprites_disabled;
s32 m_sprites_active_area;
s32 m_sprites_master_scrollx;
s32 m_sprites_master_scrolly;
bool m_sprites_flipscreen;
bool m_prepare_sprites;
int m_dislayer[5];
emu_timer *m_int6_timer;
// generic
DECLARE_READ16_MEMBER(service_input_r);
u16 service_input_r(offs_t offset);
void sound_bankswitch_w(u8 data);
void coin_control_w(u8 data);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(screen_vblank_taito_no_buffer);
void draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int *primasks, int y_offset );
void taito_handle_sprite_buffering();
void taito_update_sprites_active_area();
u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(screen_vblank_no_buffer);
void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, u32 *primasks, int y_offset);
void handle_sprite_buffering();
void update_sprites_active_area();
INTERRUPT_GEN_MEMBER(interrupt);
void opwolf3_map(address_map &map);
void opwolf3_z80_sound_map(address_map &map);
void slapshot_map(address_map &map);
void sound_map(address_map &map);
};
#endif // MAME_INCLUDES_SLAPSHOT_H

View File

@ -8,11 +8,11 @@
void slapshot_state::video_start()
{
m_spriteram_delayed = std::make_unique<uint16_t[]>(m_spriteram.bytes() / 2);
m_spriteram_buffered = std::make_unique<uint16_t[]>(m_spriteram.bytes() / 2);
m_spriteram_delayed = std::make_unique<u16[]>(m_spriteram.bytes() / 2);
m_spriteram_buffered = std::make_unique<u16[]>(m_spriteram.bytes() / 2);
m_spritelist = auto_alloc_array(machine(), struct slapshot_tempsprite, 0x400);
m_sprites_disabled = 1;
m_sprites_disabled = true;
m_sprites_active_area = 0;
save_item(NAME(m_sprites_disabled));
@ -29,7 +29,7 @@ void slapshot_state::video_start()
SPRITE DRAW ROUTINES
************************************************************/
void slapshot_state::draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int *primasks, int y_offset )
void slapshot_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, u32 *primasks, int y_offset)
{
/*
Sprite format:
@ -84,15 +84,10 @@ void slapshot_state::draw_sprites( screen_device &screen, bitmap_ind16 &bitmap,
000b - 000f : unused
*/
int x, y, off, extoffs;
int code, color, spritedata, spritecont, flipx, flipy;
int xcurrent, ycurrent, big_sprite = 0;
int big_sprite = 0;
int y_no = 0, x_no = 0, xlatch = 0, ylatch = 0, last_continuation_tile = 0; /* for zooms */
uint32_t zoomword, zoomx, zoomy, zx = 0, zy = 0, zoomxlatch = 0, zoomylatch = 0; /* for zooms */
int scroll1x, scroll1y;
u32 zoomword, zoomx, zoomy, zx = 0, zy = 0, zoomxlatch = 0, zoomylatch = 0; /* for zooms */
int scrollx = 0, scrolly = 0;
int curx, cury;
int x_offset;
/* pdrawgfx() needs us to draw sprites front to back, so we have to build a list
while processing sprite ram and then draw them all at the end */
@ -100,7 +95,7 @@ void slapshot_state::draw_sprites( screen_device &screen, bitmap_ind16 &bitmap,
/* must remember enable status from last frame because driftout fails to
reactivate them from a certain point onwards. */
int disabled = m_sprites_disabled;
bool disabled = m_sprites_disabled;
/* must remember master scroll from previous frame because driftout
sometimes doesn't set it. */
@ -110,13 +105,13 @@ void slapshot_state::draw_sprites( screen_device &screen, bitmap_ind16 &bitmap,
/* must also remember the sprite bank from previous frame. */
int area = m_sprites_active_area;
scroll1x = 0;
scroll1y = 0;
x = y = 0;
xcurrent = ycurrent = 0;
color = 0;
int scroll1x = 0;
int scroll1y = 0;
int x = 0, y = 0;
int xcurrent = 0, ycurrent = 0;
u32 color = 0;
x_offset = 3; /* Get rid of 0-3 unwanted pixels on edge of screen. */
int x_offset = 3; /* Get rid of 0-3 unwanted pixels on edge of screen. */
if (m_sprites_flipscreen) x_offset = -x_offset;
/* safety check to avoid getting stuck in bank 2 for games using only one bank */
@ -125,11 +120,10 @@ void slapshot_state::draw_sprites( screen_device &screen, bitmap_ind16 &bitmap,
m_spriteram_buffered[(0x8000 + 10) / 2] == 0)
area = 0;
for (off = 0; off < 0x4000; off += 16)
for (int off = 0; off < 0x4000; off += 16)
{
/* sprites_active_area may change during processing */
int offs = off + area;
const int offs = off + area;
if (m_spriteram_buffered[(offs + 6) / 2] & 0x8000)
{
@ -169,9 +163,8 @@ void slapshot_state::draw_sprites( screen_device &screen, bitmap_ind16 &bitmap,
if (disabled)
continue;
spritedata = m_spriteram_buffered[(offs + 8) / 2];
spritecont = (spritedata & 0xff00) >> 8;
const u16 spritedata = m_spriteram_buffered[(offs + 8) / 2];
const u16 spritecont = (spritedata & 0xff00) >> 8;
if ((spritecont & 0x08) != 0) /* sprite continuation flag set */
{
@ -192,11 +185,9 @@ void slapshot_state::draw_sprites( screen_device &screen, bitmap_ind16 &bitmap,
last_continuation_tile = 1; /* don't clear big_sprite until last tile done */
}
if ((spritecont & 0x04) == 0)
color = spritedata & 0xff;
// DG: the bigsprite == 0 check fixes "tied-up" little sprites in Thunderfox
// which (mostly?) have spritecont = 0x20 when they are not continuations
// of anything.
@ -286,28 +277,22 @@ void slapshot_state::draw_sprites( screen_device &screen, bitmap_ind16 &bitmap,
last_continuation_tile = 0;
}
code = 0;
extoffs = offs;
u32 code = 0;
int extoffs = offs;
if (extoffs >= 0x8000) extoffs -= 0x4000; /* spriteram[0x4000-7fff] has no corresponding extension area */
{
int i;
code = m_spriteram_buffered[(offs)/2] & 0xff;
i = (m_spriteext[(extoffs >> 4)] & 0xff00 );
code = (i | code);
}
code = m_spriteram_buffered[(offs)/2] & 0xff;
code |= (m_spriteext[(extoffs >> 4)] & 0xff00);
if (code == 0) continue;
flipx = spritecont & 0x01;
flipy = spritecont & 0x02;
int flipx = spritecont & 0x01;
int flipy = spritecont & 0x02;
curx = (x + scrollx) & 0xfff;
int curx = (x + scrollx) & 0xfff;
if (curx >= 0x800) curx -= 0x1000; /* treat it as signed */
cury = (y + scrolly) & 0xfff;
int cury = (y + scrolly) & 0xfff;
if (cury >= 0x800) cury -= 0x1000; /* treat it as signed */
if (m_sprites_flipscreen)
@ -371,21 +356,19 @@ void slapshot_state::draw_sprites( screen_device &screen, bitmap_ind16 &bitmap,
}
void slapshot_state::taito_handle_sprite_buffering( )
void slapshot_state::handle_sprite_buffering()
{
if (m_prepare_sprites) /* no buffering */
{
memcpy(m_spriteram_buffered.get(), m_spriteram, m_spriteram.bytes());
m_prepare_sprites = 0;
m_prepare_sprites = false;
}
}
void slapshot_state::taito_update_sprites_active_area( )
void slapshot_state::update_sprites_active_area()
{
int off;
/* if the frame was skipped, we'll have to do the buffering now */
taito_handle_sprite_buffering();
handle_sprite_buffering();
/* safety check to avoid getting stuck in bank 2 for games using only one bank */
if (m_sprites_active_area == 0x8000 &&
@ -393,7 +376,7 @@ void slapshot_state::taito_update_sprites_active_area( )
m_spriteram_buffered[(0x8000 + 10) / 2] == 0)
m_sprites_active_area = 0;
for (off = 0; off < 0x4000; off += 16)
for (int off = 0; off < 0x4000; off += 16)
{
/* sprites_active_area may change during processing */
int offs = off + m_sprites_active_area;
@ -419,14 +402,13 @@ void slapshot_state::taito_update_sprites_active_area( )
}
}
WRITE_LINE_MEMBER(slapshot_state::screen_vblank_taito_no_buffer)
WRITE_LINE_MEMBER(slapshot_state::screen_vblank_no_buffer)
{
// rising edge
if (state)
{
taito_update_sprites_active_area();
m_prepare_sprites = 1;
update_sprites_active_area();
m_prepare_sprites = true;
}
}
@ -434,7 +416,7 @@ WRITE_LINE_MEMBER(slapshot_state::screen_vblank_taito_no_buffer)
/**************************************************************
SCREEN REFRESH
Slapshot and Metalb use in the PRI chip
Slapshot and Opwolf3 use in the PRI chip
---------------------------------------
+4 xxxx0000 BG1
@ -447,12 +429,11 @@ One exception is the "puck" in early attract which is
a bg layer given priority over some sprites.
********************************************************************/
uint32_t slapshot_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
u32 slapshot_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
uint8_t layer[5];
uint8_t tilepri[5];
uint8_t spritepri[4];
uint16_t priority;
u8 layer[5];
u8 tilepri[5];
u8 spritepri[4];
#ifdef MAME_DEBUG
if (machine().input().code_pressed_once (KEYCODE_Z))
@ -486,11 +467,11 @@ uint32_t slapshot_state::screen_update(screen_device &screen, bitmap_ind16 &bitm
}
#endif
taito_handle_sprite_buffering();
handle_sprite_buffering();
m_tc0480scp->tilemap_update();
priority = m_tc0480scp->get_bg_priority();
const u16 priority = m_tc0480scp->get_bg_priority();
layer[0] = (priority & 0xf000) >> 12; /* tells us which bg layer is bottom */
layer[1] = (priority & 0x0f00) >> 8;
@ -534,21 +515,18 @@ uint32_t slapshot_state::screen_update(screen_device &screen, bitmap_ind16 &bitm
#endif
m_tc0480scp->tilemap_draw(screen, bitmap, cliprect, layer[3], 0, 8);
u32 primasks[4] = {0,0,0,0};
for (int i = 0; i < 4; i++)
{
int primasks[4] = {0,0,0,0};
int i;
for (i = 0; i < 4; i++)
{
if (spritepri[i] < tilepri[(layer[0])]) primasks[i] |= 0xaaaa;
if (spritepri[i] < tilepri[(layer[1])]) primasks[i] |= 0xcccc;
if (spritepri[i] < tilepri[(layer[2])]) primasks[i] |= 0xf0f0;
if (spritepri[i] < tilepri[(layer[3])]) primasks[i] |= 0xff00;
}
draw_sprites(screen,bitmap,cliprect,primasks,0);
if (spritepri[i] < tilepri[(layer[0])]) primasks[i] |= 0xaaaa;
if (spritepri[i] < tilepri[(layer[1])]) primasks[i] |= 0xcccc;
if (spritepri[i] < tilepri[(layer[2])]) primasks[i] |= 0xf0f0;
if (spritepri[i] < tilepri[(layer[3])]) primasks[i] |= 0xff00;
}
draw_sprites(screen,bitmap,cliprect,primasks,0);
/*
TODO: This isn't the correct way to handle the priority. At the moment of
writing, pdrawgfx() doesn't support 5 layers, so I have to cheat, assuming