mirror of
https://github.com/holub/mame
synced 2025-05-12 17:14:19 +03:00
gunbustr.cpp : Updates
Simplify handlers, Simplify gfxdecodes, Reduce unuseds, Runtime tag lookups, Unnecessary lines, Fix namings, Spacings, Use shorter / correct type values
This commit is contained in:
parent
16828b749a
commit
053d61faf1
@ -76,7 +76,7 @@ INTERRUPT_GEN_MEMBER(gunbustr_state::gunbustr_interrupt)
|
|||||||
device.execute().set_input_line(4, HOLD_LINE);
|
device.execute().set_input_line(4, HOLD_LINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
WRITE8_MEMBER(gunbustr_state::coin_word_w)
|
void gunbustr_state::coin_word_w(u8 data)
|
||||||
{
|
{
|
||||||
if (m_coin_lockout)
|
if (m_coin_lockout)
|
||||||
{
|
{
|
||||||
@ -89,24 +89,24 @@ WRITE8_MEMBER(gunbustr_state::coin_word_w)
|
|||||||
machine().bookkeeping().coin_counter_w(1, data & 0x04);
|
machine().bookkeeping().coin_counter_w(1, data & 0x04);
|
||||||
}
|
}
|
||||||
|
|
||||||
WRITE32_MEMBER(gunbustr_state::motor_control_w)
|
void gunbustr_state::motor_control_w(u32 data)
|
||||||
{
|
{
|
||||||
// Standard value poked into MSW is 0x3c00
|
// Standard value poked into MSW is 0x3c00
|
||||||
// (0x2000 and zero are written at startup)
|
// (0x2000 and zero are written at startup)
|
||||||
output().set_value("Player1_Gun_Recoil", (data & 0x1000000) ? 1 : 0);
|
output().set_value("Player1_Gun_Recoil", BIT(data, 24));
|
||||||
output().set_value("Player2_Gun_Recoil", (data & 0x10000) ? 1 : 0);
|
output().set_value("Player2_Gun_Recoil", BIT(data, 16));
|
||||||
output().set_value("Hit_lamp", (data & 0x40000) ? 1 : 0);
|
output().set_value("Hit_lamp", BIT(data, 18));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
READ32_MEMBER(gunbustr_state::gunbustr_gun_r)
|
READ32_MEMBER(gunbustr_state::gun_r)
|
||||||
{
|
{
|
||||||
return ( ioport("LIGHT0_X")->read() << 24) | (ioport("LIGHT0_Y")->read() << 16) |
|
return (m_io_light_x[0]->read() << 24) | (m_io_light_y[0]->read() << 16) |
|
||||||
( ioport("LIGHT1_X")->read() << 8) | ioport("LIGHT1_Y")->read();
|
(m_io_light_x[1]->read() << 8) | m_io_light_y[1]->read();
|
||||||
}
|
}
|
||||||
|
|
||||||
WRITE32_MEMBER(gunbustr_state::gunbustr_gun_w)
|
void gunbustr_state::gun_w(u32 data)
|
||||||
{
|
{
|
||||||
/* 10000 cycle delay is arbitrary */
|
/* 10000 cycle delay is arbitrary */
|
||||||
m_interrupt5_timer->adjust(m_maincpu->cycles_to_attotime(10000));
|
m_interrupt5_timer->adjust(m_maincpu->cycles_to_attotime(10000));
|
||||||
@ -125,7 +125,7 @@ void gunbustr_state::gunbustr_map(address_map &map)
|
|||||||
map(0x380000, 0x380003).w(FUNC(gunbustr_state::motor_control_w)); /* motor, lamps etc. */
|
map(0x380000, 0x380003).w(FUNC(gunbustr_state::motor_control_w)); /* motor, lamps etc. */
|
||||||
map(0x390000, 0x3907ff).rw("taito_en:dpram", FUNC(mb8421_device::left_r), FUNC(mb8421_device::left_w)); /* Sound shared ram */
|
map(0x390000, 0x3907ff).rw("taito_en:dpram", FUNC(mb8421_device::left_r), FUNC(mb8421_device::left_w)); /* Sound shared ram */
|
||||||
map(0x400000, 0x400007).rw("tc0510nio", FUNC(tc0510nio_device::read), FUNC(tc0510nio_device::write));
|
map(0x400000, 0x400007).rw("tc0510nio", FUNC(tc0510nio_device::read), FUNC(tc0510nio_device::write));
|
||||||
map(0x500000, 0x500003).rw(FUNC(gunbustr_state::gunbustr_gun_r), FUNC(gunbustr_state::gunbustr_gun_w)); /* gun coord read */
|
map(0x500000, 0x500003).rw(FUNC(gunbustr_state::gun_r), FUNC(gunbustr_state::gun_w)); /* gun coord read */
|
||||||
map(0x800000, 0x80ffff).rw(m_tc0480scp, FUNC(tc0480scp_device::ram_r), FUNC(tc0480scp_device::ram_w));
|
map(0x800000, 0x80ffff).rw(m_tc0480scp, FUNC(tc0480scp_device::ram_r), FUNC(tc0480scp_device::ram_w));
|
||||||
map(0x830000, 0x83002f).rw(m_tc0480scp, FUNC(tc0480scp_device::ctrl_r), FUNC(tc0480scp_device::ctrl_w));
|
map(0x830000, 0x83002f).rw(m_tc0480scp, FUNC(tc0480scp_device::ctrl_r), FUNC(tc0480scp_device::ctrl_w));
|
||||||
map(0x900000, 0x901fff).ram().w(m_palette, FUNC(palette_device::write32)).share("palette");
|
map(0x900000, 0x901fff).ram().w(m_palette, FUNC(palette_device::write32)).share("palette");
|
||||||
@ -202,11 +202,10 @@ static const gfx_layout tile16x16_layout =
|
|||||||
16,16, /* 16*16 sprites */
|
16,16, /* 16*16 sprites */
|
||||||
RGN_FRAC(1,1),
|
RGN_FRAC(1,1),
|
||||||
4, /* 4 bits per pixel */
|
4, /* 4 bits per pixel */
|
||||||
{ 0, 8, 16, 24 },
|
{ STEP4(0,8) },
|
||||||
{ 32, 33, 34, 35, 36, 37, 38, 39, 0, 1, 2, 3, 4, 5, 6, 7 },
|
{ STEP8(8*4,1), STEP8(0,1) },
|
||||||
{ 0*64, 1*64, 2*64, 3*64, 4*64, 5*64, 6*64, 7*64,
|
{ STEP16(0,8*4*2) },
|
||||||
8*64, 9*64, 10*64, 11*64, 12*64, 13*64, 14*64, 15*64 },
|
16*16*4 /* every sprite takes 128 consecutive bytes */
|
||||||
64*16 /* every sprite takes 128 consecutive bytes */
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static const gfx_layout charlayout =
|
static const gfx_layout charlayout =
|
||||||
@ -214,10 +213,10 @@ static const gfx_layout charlayout =
|
|||||||
16,16, /* 16*16 characters */
|
16,16, /* 16*16 characters */
|
||||||
RGN_FRAC(1,1),
|
RGN_FRAC(1,1),
|
||||||
4, /* 4 bits per pixel */
|
4, /* 4 bits per pixel */
|
||||||
{ 0, 1, 2, 3 },
|
{ STEP4(0,1) },
|
||||||
{ 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 },
|
{ STEP8(7*4,-4), STEP8(15*4,-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 },
|
{ STEP16(0,16*4) },
|
||||||
128*8 /* every sprite takes 128 consecutive bytes */
|
16*16*4 /* every sprite takes 128 consecutive bytes */
|
||||||
};
|
};
|
||||||
|
|
||||||
static GFXDECODE_START( gfx_gunbustr )
|
static GFXDECODE_START( gfx_gunbustr )
|
||||||
@ -255,7 +254,7 @@ void gunbustr_state::gunbustr(machine_config &config)
|
|||||||
screen.set_vblank_time(ATTOSECONDS_IN_USEC(0));
|
screen.set_vblank_time(ATTOSECONDS_IN_USEC(0));
|
||||||
screen.set_size(40*8, 32*8);
|
screen.set_size(40*8, 32*8);
|
||||||
screen.set_visarea(0, 40*8-1, 2*8, 32*8-1);
|
screen.set_visarea(0, 40*8-1, 2*8, 32*8-1);
|
||||||
screen.set_screen_update(FUNC(gunbustr_state::screen_update_gunbustr));
|
screen.set_screen_update(FUNC(gunbustr_state::screen_update));
|
||||||
screen.set_palette(m_palette);
|
screen.set_palette(m_palette);
|
||||||
|
|
||||||
GFXDECODE(config, m_gfxdecode, m_palette, gfx_gunbustr);
|
GFXDECODE(config, m_gfxdecode, m_palette, gfx_gunbustr);
|
||||||
@ -287,8 +286,8 @@ ROM_START( gunbustr )
|
|||||||
ROM_LOAD16_BYTE( "d27-24.bin", 0x100001, 0x20000, CRC(084bd8bd) SHA1(93229bc7de4550ead1bb12f666ddbacbe357488d) )
|
ROM_LOAD16_BYTE( "d27-24.bin", 0x100001, 0x20000, CRC(084bd8bd) SHA1(93229bc7de4550ead1bb12f666ddbacbe357488d) )
|
||||||
|
|
||||||
ROM_REGION( 0x100000, "gfx1", 0 )
|
ROM_REGION( 0x100000, "gfx1", 0 )
|
||||||
ROM_LOAD16_BYTE( "d27-01.bin", 0x00000, 0x80000, CRC(f41759ce) SHA1(30789f43dd09b56399e1dfdb8c6a1e01a21562bd) ) /* SCR 16x16 tiles */
|
ROM_LOAD32_WORD_SWAP( "d27-01.bin", 0x00002, 0x80000, CRC(f41759ce) SHA1(30789f43dd09b56399e1dfdb8c6a1e01a21562bd) ) /* SCR 16x16 tiles */
|
||||||
ROM_LOAD16_BYTE( "d27-02.bin", 0x00001, 0x80000, CRC(92ab6430) SHA1(28ed80391c732b09d10c74ed6b78ac76cb62e083) )
|
ROM_LOAD32_WORD_SWAP( "d27-02.bin", 0x00000, 0x80000, CRC(92ab6430) SHA1(28ed80391c732b09d10c74ed6b78ac76cb62e083) )
|
||||||
|
|
||||||
ROM_REGION( 0x400000, "gfx2", 0 )
|
ROM_REGION( 0x400000, "gfx2", 0 )
|
||||||
ROM_LOAD32_BYTE( "d27-04.bin", 0x000003, 0x100000, CRC(ff8b9234) SHA1(6095b7daf9b7e9a22b0d44d9d6a642ddecb2bd29) ) /* OBJ 16x16 tiles: each rom has 1 bitplane */
|
ROM_LOAD32_BYTE( "d27-04.bin", 0x000003, 0x100000, CRC(ff8b9234) SHA1(6095b7daf9b7e9a22b0d44d9d6a642ddecb2bd29) ) /* OBJ 16x16 tiles: each rom has 1 bitplane */
|
||||||
@ -296,7 +295,7 @@ ROM_START( gunbustr )
|
|||||||
ROM_LOAD32_BYTE( "d27-06.bin", 0x000001, 0x100000, CRC(bbb934db) SHA1(9e9b5cf05b9275f1182f5b499b8ee897c4f25b96) )
|
ROM_LOAD32_BYTE( "d27-06.bin", 0x000001, 0x100000, CRC(bbb934db) SHA1(9e9b5cf05b9275f1182f5b499b8ee897c4f25b96) )
|
||||||
ROM_LOAD32_BYTE( "d27-07.bin", 0x000000, 0x100000, CRC(8ab4854e) SHA1(bd2750cdaa2918e56f8aef3732875952a1eeafea) )
|
ROM_LOAD32_BYTE( "d27-07.bin", 0x000000, 0x100000, CRC(8ab4854e) SHA1(bd2750cdaa2918e56f8aef3732875952a1eeafea) )
|
||||||
|
|
||||||
ROM_REGION16_LE( 0x80000, "user1", 0 )
|
ROM_REGION16_LE( 0x80000, "spritemap", 0 )
|
||||||
ROM_LOAD16_WORD( "d27-03.bin", 0x00000, 0x80000, CRC(23bf2000) SHA1(49b29e771a47fcd7e6cd4e2704b217f9727f8299) ) /* STY, used to create big sprites on the fly */
|
ROM_LOAD16_WORD( "d27-03.bin", 0x00000, 0x80000, CRC(23bf2000) SHA1(49b29e771a47fcd7e6cd4e2704b217f9727f8299) ) /* STY, used to create big sprites on the fly */
|
||||||
|
|
||||||
ROM_REGION16_BE( 0x800000, "ensoniq.0" , ROMREGION_ERASE00 )
|
ROM_REGION16_BE( 0x800000, "ensoniq.0" , ROMREGION_ERASE00 )
|
||||||
@ -321,8 +320,8 @@ ROM_START( gunbustru )
|
|||||||
ROM_LOAD16_BYTE( "d27-24.bin", 0x100001, 0x20000, CRC(084bd8bd) SHA1(93229bc7de4550ead1bb12f666ddbacbe357488d) )
|
ROM_LOAD16_BYTE( "d27-24.bin", 0x100001, 0x20000, CRC(084bd8bd) SHA1(93229bc7de4550ead1bb12f666ddbacbe357488d) )
|
||||||
|
|
||||||
ROM_REGION( 0x100000, "gfx1", 0 )
|
ROM_REGION( 0x100000, "gfx1", 0 )
|
||||||
ROM_LOAD16_BYTE( "d27-01.bin", 0x00000, 0x80000, CRC(f41759ce) SHA1(30789f43dd09b56399e1dfdb8c6a1e01a21562bd) ) /* SCR 16x16 tiles */
|
ROM_LOAD32_WORD_SWAP( "d27-01.bin", 0x00002, 0x80000, CRC(f41759ce) SHA1(30789f43dd09b56399e1dfdb8c6a1e01a21562bd) ) /* SCR 16x16 tiles */
|
||||||
ROM_LOAD16_BYTE( "d27-02.bin", 0x00001, 0x80000, CRC(92ab6430) SHA1(28ed80391c732b09d10c74ed6b78ac76cb62e083) )
|
ROM_LOAD32_WORD_SWAP( "d27-02.bin", 0x00000, 0x80000, CRC(92ab6430) SHA1(28ed80391c732b09d10c74ed6b78ac76cb62e083) )
|
||||||
|
|
||||||
ROM_REGION( 0x400000, "gfx2", 0 )
|
ROM_REGION( 0x400000, "gfx2", 0 )
|
||||||
ROM_LOAD32_BYTE( "d27-04.bin", 0x000003, 0x100000, CRC(ff8b9234) SHA1(6095b7daf9b7e9a22b0d44d9d6a642ddecb2bd29) ) /* OBJ 16x16 tiles: each rom has 1 bitplane */
|
ROM_LOAD32_BYTE( "d27-04.bin", 0x000003, 0x100000, CRC(ff8b9234) SHA1(6095b7daf9b7e9a22b0d44d9d6a642ddecb2bd29) ) /* OBJ 16x16 tiles: each rom has 1 bitplane */
|
||||||
@ -330,7 +329,7 @@ ROM_START( gunbustru )
|
|||||||
ROM_LOAD32_BYTE( "d27-06.bin", 0x000001, 0x100000, CRC(bbb934db) SHA1(9e9b5cf05b9275f1182f5b499b8ee897c4f25b96) )
|
ROM_LOAD32_BYTE( "d27-06.bin", 0x000001, 0x100000, CRC(bbb934db) SHA1(9e9b5cf05b9275f1182f5b499b8ee897c4f25b96) )
|
||||||
ROM_LOAD32_BYTE( "d27-07.bin", 0x000000, 0x100000, CRC(8ab4854e) SHA1(bd2750cdaa2918e56f8aef3732875952a1eeafea) )
|
ROM_LOAD32_BYTE( "d27-07.bin", 0x000000, 0x100000, CRC(8ab4854e) SHA1(bd2750cdaa2918e56f8aef3732875952a1eeafea) )
|
||||||
|
|
||||||
ROM_REGION16_LE( 0x80000, "user1", 0 )
|
ROM_REGION16_LE( 0x80000, "spritemap", 0 )
|
||||||
ROM_LOAD16_WORD( "d27-03.bin", 0x00000, 0x80000, CRC(23bf2000) SHA1(49b29e771a47fcd7e6cd4e2704b217f9727f8299) ) /* STY, used to create big sprites on the fly */
|
ROM_LOAD16_WORD( "d27-03.bin", 0x00000, 0x80000, CRC(23bf2000) SHA1(49b29e771a47fcd7e6cd4e2704b217f9727f8299) ) /* STY, used to create big sprites on the fly */
|
||||||
|
|
||||||
ROM_REGION16_BE( 0x800000, "ensoniq.0" , ROMREGION_ERASE00 )
|
ROM_REGION16_BE( 0x800000, "ensoniq.0" , ROMREGION_ERASE00 )
|
||||||
@ -355,8 +354,8 @@ ROM_START( gunbustrj )
|
|||||||
ROM_LOAD16_BYTE( "d27-24.bin", 0x100001, 0x20000, CRC(084bd8bd) SHA1(93229bc7de4550ead1bb12f666ddbacbe357488d) )
|
ROM_LOAD16_BYTE( "d27-24.bin", 0x100001, 0x20000, CRC(084bd8bd) SHA1(93229bc7de4550ead1bb12f666ddbacbe357488d) )
|
||||||
|
|
||||||
ROM_REGION( 0x100000, "gfx1", 0 )
|
ROM_REGION( 0x100000, "gfx1", 0 )
|
||||||
ROM_LOAD16_BYTE( "d27-01.bin", 0x00000, 0x80000, CRC(f41759ce) SHA1(30789f43dd09b56399e1dfdb8c6a1e01a21562bd) ) /* SCR 16x16 tiles */
|
ROM_LOAD32_WORD_SWAP( "d27-01.bin", 0x00002, 0x80000, CRC(f41759ce) SHA1(30789f43dd09b56399e1dfdb8c6a1e01a21562bd) ) /* SCR 16x16 tiles */
|
||||||
ROM_LOAD16_BYTE( "d27-02.bin", 0x00001, 0x80000, CRC(92ab6430) SHA1(28ed80391c732b09d10c74ed6b78ac76cb62e083) )
|
ROM_LOAD32_WORD_SWAP( "d27-02.bin", 0x00000, 0x80000, CRC(92ab6430) SHA1(28ed80391c732b09d10c74ed6b78ac76cb62e083) )
|
||||||
|
|
||||||
ROM_REGION( 0x400000, "gfx2", 0 )
|
ROM_REGION( 0x400000, "gfx2", 0 )
|
||||||
ROM_LOAD32_BYTE( "d27-04.bin", 0x000003, 0x100000, CRC(ff8b9234) SHA1(6095b7daf9b7e9a22b0d44d9d6a642ddecb2bd29) ) /* OBJ 16x16 tiles: each rom has 1 bitplane */
|
ROM_LOAD32_BYTE( "d27-04.bin", 0x000003, 0x100000, CRC(ff8b9234) SHA1(6095b7daf9b7e9a22b0d44d9d6a642ddecb2bd29) ) /* OBJ 16x16 tiles: each rom has 1 bitplane */
|
||||||
@ -364,7 +363,7 @@ ROM_START( gunbustrj )
|
|||||||
ROM_LOAD32_BYTE( "d27-06.bin", 0x000001, 0x100000, CRC(bbb934db) SHA1(9e9b5cf05b9275f1182f5b499b8ee897c4f25b96) )
|
ROM_LOAD32_BYTE( "d27-06.bin", 0x000001, 0x100000, CRC(bbb934db) SHA1(9e9b5cf05b9275f1182f5b499b8ee897c4f25b96) )
|
||||||
ROM_LOAD32_BYTE( "d27-07.bin", 0x000000, 0x100000, CRC(8ab4854e) SHA1(bd2750cdaa2918e56f8aef3732875952a1eeafea) )
|
ROM_LOAD32_BYTE( "d27-07.bin", 0x000000, 0x100000, CRC(8ab4854e) SHA1(bd2750cdaa2918e56f8aef3732875952a1eeafea) )
|
||||||
|
|
||||||
ROM_REGION16_LE( 0x80000, "user1", 0 )
|
ROM_REGION16_LE( 0x80000, "spritemap", 0 )
|
||||||
ROM_LOAD16_WORD( "d27-03.bin", 0x00000, 0x80000, CRC(23bf2000) SHA1(49b29e771a47fcd7e6cd4e2704b217f9727f8299) ) /* STY, used to create big sprites on the fly */
|
ROM_LOAD16_WORD( "d27-03.bin", 0x00000, 0x80000, CRC(23bf2000) SHA1(49b29e771a47fcd7e6cd4e2704b217f9727f8299) ) /* STY, used to create big sprites on the fly */
|
||||||
|
|
||||||
ROM_REGION16_BE( 0x800000, "ensoniq.0" , ROMREGION_ERASE00 )
|
ROM_REGION16_BE( 0x800000, "ensoniq.0" , ROMREGION_ERASE00 )
|
||||||
@ -379,7 +378,7 @@ ROM_END
|
|||||||
|
|
||||||
READ32_MEMBER(gunbustr_state::main_cycle_r)
|
READ32_MEMBER(gunbustr_state::main_cycle_r)
|
||||||
{
|
{
|
||||||
if (m_maincpu->pc()==0x55a && (m_ram[0x3acc/4]&0xff000000)==0)
|
if (m_maincpu->pc() == 0x55a && (m_ram[0x3acc/4] & 0xff000000) == 0)
|
||||||
m_maincpu->spin_until_interrupt();
|
m_maincpu->spin_until_interrupt();
|
||||||
|
|
||||||
return m_ram[0x3acc/4];
|
return m_ram[0x3acc/4];
|
||||||
|
@ -30,7 +30,10 @@ public:
|
|||||||
m_spriteram(*this,"spriteram"),
|
m_spriteram(*this,"spriteram"),
|
||||||
m_eeprom(*this, "eeprom"),
|
m_eeprom(*this, "eeprom"),
|
||||||
m_gfxdecode(*this, "gfxdecode"),
|
m_gfxdecode(*this, "gfxdecode"),
|
||||||
m_palette(*this, "palette")
|
m_palette(*this, "palette"),
|
||||||
|
m_spritemap(*this, "spritemap"),
|
||||||
|
m_io_light_x(*this, "LIGHT%u_X", 0U),
|
||||||
|
m_io_light_y(*this, "LIGHT%u_Y", 0U)
|
||||||
{
|
{
|
||||||
m_coin_lockout = true;
|
m_coin_lockout = true;
|
||||||
}
|
}
|
||||||
@ -48,26 +51,29 @@ private:
|
|||||||
|
|
||||||
required_device<cpu_device> m_maincpu;
|
required_device<cpu_device> m_maincpu;
|
||||||
required_device<tc0480scp_device> m_tc0480scp;
|
required_device<tc0480scp_device> m_tc0480scp;
|
||||||
required_shared_ptr<uint32_t> m_ram;
|
required_shared_ptr<u32> m_ram;
|
||||||
required_shared_ptr<uint32_t> m_spriteram;
|
required_shared_ptr<u32> m_spriteram;
|
||||||
required_device<eeprom_serial_93cxx_device> m_eeprom;
|
required_device<eeprom_serial_93cxx_device> m_eeprom;
|
||||||
required_device<gfxdecode_device> m_gfxdecode;
|
required_device<gfxdecode_device> m_gfxdecode;
|
||||||
required_device<palette_device> m_palette;
|
required_device<palette_device> m_palette;
|
||||||
|
required_region_ptr<u16> m_spritemap;
|
||||||
|
|
||||||
|
required_ioport_array<2> m_io_light_x;
|
||||||
|
required_ioport_array<2> m_io_light_y;
|
||||||
|
|
||||||
bool m_coin_lockout;
|
bool m_coin_lockout;
|
||||||
std::unique_ptr<gb_tempsprite[]> m_spritelist;
|
std::unique_ptr<gb_tempsprite[]> m_spritelist;
|
||||||
uint32_t m_mem[2];
|
|
||||||
emu_timer *m_interrupt5_timer;
|
emu_timer *m_interrupt5_timer;
|
||||||
|
|
||||||
DECLARE_WRITE32_MEMBER(motor_control_w);
|
void motor_control_w(u32 data);
|
||||||
DECLARE_READ32_MEMBER(gunbustr_gun_r);
|
DECLARE_READ32_MEMBER(gun_r);
|
||||||
DECLARE_WRITE32_MEMBER(gunbustr_gun_w);
|
void gun_w(u32 data);
|
||||||
DECLARE_READ32_MEMBER(main_cycle_r);
|
DECLARE_READ32_MEMBER(main_cycle_r);
|
||||||
DECLARE_WRITE8_MEMBER(coin_word_w);
|
void coin_word_w(u8 data);
|
||||||
virtual void video_start() override;
|
virtual void video_start() override;
|
||||||
uint32_t screen_update_gunbustr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||||
INTERRUPT_GEN_MEMBER(gunbustr_interrupt);
|
INTERRUPT_GEN_MEMBER(gunbustr_interrupt);
|
||||||
void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap,const rectangle &cliprect,const int *primasks,int x_offs,int y_offs);
|
void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap,const rectangle &cliprect,const u32 *primasks,int x_offs,int y_offs);
|
||||||
|
|
||||||
void gunbustr_map(address_map &map);
|
void gunbustr_map(address_map &map);
|
||||||
|
|
||||||
|
@ -57,38 +57,31 @@ Heavy use is made of sprite zooming.
|
|||||||
|
|
||||||
********************************************************/
|
********************************************************/
|
||||||
|
|
||||||
void gunbustr_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap,const rectangle &cliprect,const int *primasks,int x_offs,int y_offs)
|
void gunbustr_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap,const rectangle &cliprect,const u32 *primasks,int x_offs,int y_offs)
|
||||||
{
|
{
|
||||||
uint32_t *spriteram32 = m_spriteram;
|
|
||||||
uint16_t *spritemap = (uint16_t *)memregion("user1")->base();
|
|
||||||
int offs, data, tilenum, color, flipx, flipy;
|
|
||||||
int x, y, priority, dblsize, curx, cury;
|
|
||||||
int sprites_flipscreen = 0;
|
int sprites_flipscreen = 0;
|
||||||
int zoomx, zoomy, zx, zy;
|
|
||||||
int sprite_chunk,map_offset,code,j,k,px,py;
|
|
||||||
int dimension,total_chunks,bad_chunks;
|
|
||||||
|
|
||||||
/* pdrawgfx() needs us to draw sprites front to back, so we have to build a list
|
/* 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 */
|
while processing sprite ram and then draw them all at the end */
|
||||||
struct gb_tempsprite *sprite_ptr = m_spritelist.get();
|
struct gb_tempsprite *sprite_ptr = m_spritelist.get();
|
||||||
|
|
||||||
for (offs = (m_spriteram.bytes()/4-4);offs >= 0;offs -= 4)
|
for (int offs = (m_spriteram.bytes() / 4 - 4); offs >= 0; offs -= 4)
|
||||||
{
|
{
|
||||||
data = spriteram32[offs+0];
|
u32 data = m_spriteram[offs+0];
|
||||||
flipx = (data & 0x00800000) >> 23;
|
int flipx = (data & 0x00800000) >> 23;
|
||||||
zoomx = (data & 0x007f0000) >> 16;
|
int zoomx = (data & 0x007f0000) >> 16;
|
||||||
tilenum = (data & 0x00007fff);
|
const u32 tilenum = (data & 0x00007fff);
|
||||||
|
|
||||||
data = spriteram32[offs+2];
|
data = m_spriteram[offs+2];
|
||||||
priority = (data & 0x000c0000) >> 18;
|
const int priority = (data & 0x000c0000) >> 18;
|
||||||
color = (data & 0x0003fc00) >> 10;
|
int color = (data & 0x0003fc00) >> 10;
|
||||||
x = (data & 0x000003ff);
|
int x = (data & 0x000003ff);
|
||||||
|
|
||||||
data = spriteram32[offs+3];
|
data = m_spriteram[offs+3];
|
||||||
dblsize = (data & 0x00040000) >> 18;
|
const int dblsize = (data & 0x00040000) >> 18;
|
||||||
flipy = (data & 0x00020000) >> 17;
|
int flipy = (data & 0x00020000) >> 17;
|
||||||
zoomy = (data & 0x0001fc00) >> 10;
|
int zoomy = (data & 0x0001fc00) >> 10;
|
||||||
y = (data & 0x000003ff);
|
int y = (data & 0x000003ff);
|
||||||
|
|
||||||
color |= 0x80;
|
color |= 0x80;
|
||||||
|
|
||||||
@ -101,41 +94,40 @@ void gunbustr_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap,co
|
|||||||
y += y_offs;
|
y += y_offs;
|
||||||
|
|
||||||
/* treat coords as signed */
|
/* treat coords as signed */
|
||||||
if (x>0x340) x -= 0x400;
|
if (x > 0x340) x -= 0x400;
|
||||||
if (y>0x340) y -= 0x400;
|
if (y > 0x340) y -= 0x400;
|
||||||
|
|
||||||
x -= x_offs;
|
x -= x_offs;
|
||||||
|
|
||||||
bad_chunks = 0;
|
int bad_chunks = 0;
|
||||||
dimension = ((dblsize*2) + 2); // 2 or 4
|
const int dimension = ((dblsize*2) + 2); // 2 or 4
|
||||||
total_chunks = ((dblsize*3) + 1) << 2; // 4 or 16
|
const int total_chunks = ((dblsize*3) + 1) << 2; // 4 or 16
|
||||||
map_offset = tilenum << 2;
|
const int map_offset = tilenum << 2;
|
||||||
|
|
||||||
|
for (int sprite_chunk = 0; sprite_chunk < total_chunks; sprite_chunk++)
|
||||||
{
|
{
|
||||||
for (sprite_chunk=0;sprite_chunk<total_chunks;sprite_chunk++)
|
const int j = sprite_chunk / dimension; /* rows */
|
||||||
{
|
const int k = sprite_chunk % dimension; /* chunks per row */
|
||||||
j = sprite_chunk / dimension; /* rows */
|
|
||||||
k = sprite_chunk % dimension; /* chunks per row */
|
|
||||||
|
|
||||||
px = k;
|
int px = k;
|
||||||
py = j;
|
int py = j;
|
||||||
/* pick tiles back to front for x and y flips */
|
/* pick tiles back to front for x and y flips */
|
||||||
if (flipx) px = dimension-1-k;
|
if (flipx) px = dimension - 1 - k;
|
||||||
if (flipy) py = dimension-1-j;
|
if (flipy) py = dimension - 1 - j;
|
||||||
|
|
||||||
code = spritemap[map_offset + px + (py<<(dblsize+1))];
|
const u32 code = m_spritemap[map_offset + px + (py<<(dblsize+1))];
|
||||||
|
|
||||||
if (code==0xffff)
|
if (code == 0xffff)
|
||||||
{
|
{
|
||||||
bad_chunks += 1;
|
bad_chunks += 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
curx = x + ((k*zoomx)/dimension);
|
int curx = x + ((k * zoomx) / dimension);
|
||||||
cury = y + ((j*zoomy)/dimension);
|
int cury = y + ((j * zoomy) / dimension);
|
||||||
|
|
||||||
zx= x + (((k+1)*zoomx)/dimension) - curx;
|
const int zx = x + (((k + 1) * zoomx) / dimension) - curx;
|
||||||
zy= y + (((j+1)*zoomy)/dimension) - cury;
|
const int zy = y + (((j + 1) * zoomy) / dimension) - cury;
|
||||||
|
|
||||||
if (sprites_flipscreen)
|
if (sprites_flipscreen)
|
||||||
{
|
{
|
||||||
@ -175,7 +167,6 @@ void gunbustr_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap,co
|
|||||||
sprite_ptr->zoomx,sprite_ptr->zoomy,0);
|
sprite_ptr->zoomx,sprite_ptr->zoomy,0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (bad_chunks)
|
if (bad_chunks)
|
||||||
logerror("Sprite number %04x had %02x invalid chunks\n",tilenum,bad_chunks);
|
logerror("Sprite number %04x had %02x invalid chunks\n",tilenum,bad_chunks);
|
||||||
@ -202,11 +193,11 @@ logerror("Sprite number %04x had %02x invalid chunks\n",tilenum,bad_chunks);
|
|||||||
SCREEN REFRESH
|
SCREEN REFRESH
|
||||||
**************************************************************/
|
**************************************************************/
|
||||||
|
|
||||||
uint32_t gunbustr_state::screen_update_gunbustr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
u32 gunbustr_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||||
{
|
{
|
||||||
uint8_t layer[5];
|
u8 layer[5];
|
||||||
uint16_t priority;
|
u16 priority;
|
||||||
static const int primasks[4] = {0xfffc, 0xfff0, 0xff00, 0x0};
|
static const u32 primasks[4] = {0xfffc, 0xfff0, 0xff00, 0x0};
|
||||||
|
|
||||||
m_tc0480scp->tilemap_update();
|
m_tc0480scp->tilemap_update();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user