othunder.cpp : Updates

Simplify gfxdecodes, Reduce runtime tag lookups, Unnecessary lines, Use shorter / correct type values
This commit is contained in:
cam900 2019-06-07 00:31:41 +09:00
parent 4162b349b2
commit 3c8088e4f9
3 changed files with 95 additions and 111 deletions

View File

@ -368,7 +368,7 @@ void othunder_state::coins_w(u8 data)
void othunder_state::sound_bankswitch_w(u8 data)
{
membank("z80bank")->set_entry(data & 3);
m_z80bank->set_entry(data & 3);
}
void othunder_state::tc0310fam_w(offs_t offset, u8 data)
@ -555,26 +555,15 @@ static const gfx_layout tile16x8_layout =
16,8,
RGN_FRAC(1,1),
4,
{ 0, 8, 16, 24 },
{ 32, 33, 34, 35, 36, 37, 38, 39, 0, 1, 2, 3, 4, 5, 6, 7 },
{ 0*64, 1*64, 2*64, 3*64, 4*64, 5*64, 6*64, 7*64 },
{ STEP4(0,16) },
{ STEP16(0,1) },
{ STEP8(0,16*4) },
64*8
};
static const gfx_layout charlayout =
{
8,8,
RGN_FRAC(1,1),
4,
{ 0, 1, 2, 3 },
{ 2*4, 3*4, 0*4, 1*4, 6*4, 7*4, 4*4, 5*4 },
{ 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 },
32*8
};
static GFXDECODE_START( gfx_othunder )
GFXDECODE_ENTRY( "gfx2", 0, tile16x8_layout, 0, 256 ) /* sprite parts */
GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 256 ) /* sprites & playfield */
GFXDECODE_ENTRY( "sprites", 0, tile16x8_layout, 0, 256 ) /* sprite parts */
GFXDECODE_ENTRY( "tc0100scn", 0, gfx_8x8x4_packed_msb, 0, 256 ) /* sprites & playfield */
GFXDECODE_END
@ -584,7 +573,7 @@ GFXDECODE_END
void othunder_state::machine_start()
{
membank("z80bank")->configure_entries(0, 4, memregion("audiocpu")->base(), 0x4000);
m_z80bank->configure_entries(0, 4, memregion("audiocpu")->base(), 0x4000);
save_item(NAME(m_pan));
}
@ -661,7 +650,6 @@ void othunder_state::othunder(machine_config &config)
}
/***************************************************************************
DRIVERS
***************************************************************************/
@ -676,16 +664,16 @@ ROM_START( othunder )
ROM_REGION( 0x10000, "audiocpu", 0 ) /* sound cpu */
ROM_LOAD( "b67-13.ic40", 0x00000, 0x10000, CRC(2936b4b1) SHA1(39b41643464dd89e456ab6eb15a0ff0aef30afde) )
ROM_REGION( 0x80000, "gfx1", 0 )
ROM_LOAD( "b67-06.ic66", 0x00000, 0x80000, CRC(b9a38d64) SHA1(7ae8165b444d9da6ccdbc4a769535bcbb6738aaa) ) /* SCN */
ROM_REGION( 0x80000, "tc0100scn", 0 )
ROM_LOAD16_WORD_SWAP( "b67-06.ic66", 0x00000, 0x80000, CRC(b9a38d64) SHA1(7ae8165b444d9da6ccdbc4a769535bcbb6738aaa) ) /* SCN */
ROM_REGION( 0x200000, "gfx2", 0 )
ROM_LOAD32_BYTE( "b67-01.ic1", 0x00000, 0x80000, CRC(81ad9acb) SHA1(d9ad3f6332c6ca6b9872da57526a8158a3cf5b2f) ) /* OBJ: each rom has 1 bitplane, forming 16x8 tiles */
ROM_LOAD32_BYTE( "b67-02.ic2", 0x00001, 0x80000, CRC(c20cd2fb) SHA1(b015e1fe167e19826aa451b45cd143d66a6db83c) )
ROM_LOAD32_BYTE( "b67-03.ic3", 0x00002, 0x80000, CRC(bc9019ed) SHA1(7eddc83d71be97ce6637e6b35c226d58e6c39c3f) )
ROM_LOAD32_BYTE( "b67-04.ic4", 0x00003, 0x80000, CRC(2af4c8af) SHA1(b2ae7aad0c59ffc368811f4bd5546dbb6860f9a9) )
ROM_REGION( 0x200000, "sprites", 0 )
ROM_LOAD64_WORD_SWAP( "b67-01.ic1", 0x00000, 0x80000, CRC(81ad9acb) SHA1(d9ad3f6332c6ca6b9872da57526a8158a3cf5b2f) ) /* OBJ: each rom has 1 bitplane, forming 16x8 tiles */
ROM_LOAD64_WORD_SWAP( "b67-02.ic2", 0x00002, 0x80000, CRC(c20cd2fb) SHA1(b015e1fe167e19826aa451b45cd143d66a6db83c) )
ROM_LOAD64_WORD_SWAP( "b67-03.ic3", 0x00004, 0x80000, CRC(bc9019ed) SHA1(7eddc83d71be97ce6637e6b35c226d58e6c39c3f) )
ROM_LOAD64_WORD_SWAP( "b67-04.ic4", 0x00006, 0x80000, CRC(2af4c8af) SHA1(b2ae7aad0c59ffc368811f4bd5546dbb6860f9a9) )
ROM_REGION16_LE( 0x80000, "user1", 0 )
ROM_REGION16_LE( 0x80000, "sprmap_rom", 0 )
ROM_LOAD16_WORD( "b67-05.ic43", 0x00000, 0x80000, CRC(9593e42b) SHA1(54b5538c302a1734ff4b752ab87a8c45d5c6b23d) ) /* index used to create 64x64 sprites on the fly */
ROM_REGION( 0x80000, "ymsnd", 0 ) /* ADPCM samples */
@ -714,16 +702,16 @@ ROM_START( othundero )
ROM_REGION( 0x10000, "audiocpu", 0 ) /* sound cpu */
ROM_LOAD( "b67-13.ic40", 0x00000, 0x10000, CRC(2936b4b1) SHA1(39b41643464dd89e456ab6eb15a0ff0aef30afde) )
ROM_REGION( 0x80000, "gfx1", 0 )
ROM_LOAD( "b67-06.ic66", 0x00000, 0x80000, CRC(b9a38d64) SHA1(7ae8165b444d9da6ccdbc4a769535bcbb6738aaa) ) /* SCN */
ROM_REGION( 0x80000, "tc0100scn", 0 )
ROM_LOAD16_WORD_SWAP( "b67-06.ic66", 0x00000, 0x80000, CRC(b9a38d64) SHA1(7ae8165b444d9da6ccdbc4a769535bcbb6738aaa) ) /* SCN */
ROM_REGION( 0x200000, "gfx2", 0 )
ROM_LOAD32_BYTE( "b67-01.ic1", 0x00000, 0x80000, CRC(81ad9acb) SHA1(d9ad3f6332c6ca6b9872da57526a8158a3cf5b2f) ) /* OBJ: each rom has 1 bitplane, forming 16x8 tiles */
ROM_LOAD32_BYTE( "b67-02.ic2", 0x00001, 0x80000, CRC(c20cd2fb) SHA1(b015e1fe167e19826aa451b45cd143d66a6db83c) )
ROM_LOAD32_BYTE( "b67-03.ic3", 0x00002, 0x80000, CRC(bc9019ed) SHA1(7eddc83d71be97ce6637e6b35c226d58e6c39c3f) )
ROM_LOAD32_BYTE( "b67-04.ic4", 0x00003, 0x80000, CRC(2af4c8af) SHA1(b2ae7aad0c59ffc368811f4bd5546dbb6860f9a9) )
ROM_REGION( 0x200000, "sprites", 0 )
ROM_LOAD64_WORD_SWAP( "b67-01.ic1", 0x00000, 0x80000, CRC(81ad9acb) SHA1(d9ad3f6332c6ca6b9872da57526a8158a3cf5b2f) ) /* OBJ: each rom has 1 bitplane, forming 16x8 tiles */
ROM_LOAD64_WORD_SWAP( "b67-02.ic2", 0x00002, 0x80000, CRC(c20cd2fb) SHA1(b015e1fe167e19826aa451b45cd143d66a6db83c) )
ROM_LOAD64_WORD_SWAP( "b67-03.ic3", 0x00004, 0x80000, CRC(bc9019ed) SHA1(7eddc83d71be97ce6637e6b35c226d58e6c39c3f) )
ROM_LOAD64_WORD_SWAP( "b67-04.ic4", 0x00006, 0x80000, CRC(2af4c8af) SHA1(b2ae7aad0c59ffc368811f4bd5546dbb6860f9a9) )
ROM_REGION16_LE( 0x80000, "user1", 0 )
ROM_REGION16_LE( 0x80000, "sprmap_rom", 0 )
ROM_LOAD16_WORD( "b67-05.ic43", 0x00000, 0x80000, CRC(9593e42b) SHA1(54b5538c302a1734ff4b752ab87a8c45d5c6b23d) ) /* index used to create 64x64 sprites on the fly */
ROM_REGION( 0x80000, "ymsnd", 0 ) /* ADPCM samples */
@ -752,16 +740,16 @@ ROM_START( othunderu )
ROM_REGION( 0x10000, "audiocpu", 0 ) /* sound cpu */
ROM_LOAD( "b67-13.ic40", 0x00000, 0x10000, CRC(2936b4b1) SHA1(39b41643464dd89e456ab6eb15a0ff0aef30afde) )
ROM_REGION( 0x80000, "gfx1", 0 )
ROM_LOAD( "b67-06.ic66", 0x00000, 0x80000, CRC(b9a38d64) SHA1(7ae8165b444d9da6ccdbc4a769535bcbb6738aaa) ) /* SCN */
ROM_REGION( 0x80000, "tc0100scn", 0 )
ROM_LOAD16_WORD_SWAP( "b67-06.ic66", 0x00000, 0x80000, CRC(b9a38d64) SHA1(7ae8165b444d9da6ccdbc4a769535bcbb6738aaa) ) /* SCN */
ROM_REGION( 0x200000, "gfx2", 0 )
ROM_LOAD32_BYTE( "b67-01.ic1", 0x00000, 0x80000, CRC(81ad9acb) SHA1(d9ad3f6332c6ca6b9872da57526a8158a3cf5b2f) ) /* OBJ: each rom has 1 bitplane, forming 16x8 tiles */
ROM_LOAD32_BYTE( "b67-02.ic2", 0x00001, 0x80000, CRC(c20cd2fb) SHA1(b015e1fe167e19826aa451b45cd143d66a6db83c) )
ROM_LOAD32_BYTE( "b67-03.ic3", 0x00002, 0x80000, CRC(bc9019ed) SHA1(7eddc83d71be97ce6637e6b35c226d58e6c39c3f) )
ROM_LOAD32_BYTE( "b67-04.ic4", 0x00003, 0x80000, CRC(2af4c8af) SHA1(b2ae7aad0c59ffc368811f4bd5546dbb6860f9a9) )
ROM_REGION( 0x200000, "sprites", 0 )
ROM_LOAD64_WORD_SWAP( "b67-01.ic1", 0x00000, 0x80000, CRC(81ad9acb) SHA1(d9ad3f6332c6ca6b9872da57526a8158a3cf5b2f) ) /* OBJ: each rom has 1 bitplane, forming 16x8 tiles */
ROM_LOAD64_WORD_SWAP( "b67-02.ic2", 0x00002, 0x80000, CRC(c20cd2fb) SHA1(b015e1fe167e19826aa451b45cd143d66a6db83c) )
ROM_LOAD64_WORD_SWAP( "b67-03.ic3", 0x00004, 0x80000, CRC(bc9019ed) SHA1(7eddc83d71be97ce6637e6b35c226d58e6c39c3f) )
ROM_LOAD64_WORD_SWAP( "b67-04.ic4", 0x00006, 0x80000, CRC(2af4c8af) SHA1(b2ae7aad0c59ffc368811f4bd5546dbb6860f9a9) )
ROM_REGION16_LE( 0x80000, "user1", 0 )
ROM_REGION16_LE( 0x80000, "sprmap_rom", 0 )
ROM_LOAD16_WORD( "b67-05.ic43", 0x00000, 0x80000, CRC(9593e42b) SHA1(54b5538c302a1734ff4b752ab87a8c45d5c6b23d) ) /* index used to create 64x64 sprites on the fly */
ROM_REGION( 0x80000, "ymsnd", 0 ) /* ADPCM samples */
@ -790,16 +778,16 @@ ROM_START( othunderuo )
ROM_REGION( 0x10000, "audiocpu", 0 ) /* sound cpu */
ROM_LOAD( "b67-13.ic40", 0x00000, 0x10000, CRC(2936b4b1) SHA1(39b41643464dd89e456ab6eb15a0ff0aef30afde) )
ROM_REGION( 0x80000, "gfx1", 0 )
ROM_LOAD( "b67-06.ic66", 0x00000, 0x80000, CRC(b9a38d64) SHA1(7ae8165b444d9da6ccdbc4a769535bcbb6738aaa) ) /* SCN */
ROM_REGION( 0x80000, "tc0100scn", 0 )
ROM_LOAD16_WORD_SWAP( "b67-06.ic66", 0x00000, 0x80000, CRC(b9a38d64) SHA1(7ae8165b444d9da6ccdbc4a769535bcbb6738aaa) ) /* SCN */
ROM_REGION( 0x200000, "gfx2", 0 )
ROM_LOAD32_BYTE( "b67-01.ic1", 0x00000, 0x80000, CRC(81ad9acb) SHA1(d9ad3f6332c6ca6b9872da57526a8158a3cf5b2f) ) /* OBJ: each rom has 1 bitplane, forming 16x8 tiles */
ROM_LOAD32_BYTE( "b67-02.ic2", 0x00001, 0x80000, CRC(c20cd2fb) SHA1(b015e1fe167e19826aa451b45cd143d66a6db83c) )
ROM_LOAD32_BYTE( "b67-03.ic3", 0x00002, 0x80000, CRC(bc9019ed) SHA1(7eddc83d71be97ce6637e6b35c226d58e6c39c3f) )
ROM_LOAD32_BYTE( "b67-04.ic4", 0x00003, 0x80000, CRC(2af4c8af) SHA1(b2ae7aad0c59ffc368811f4bd5546dbb6860f9a9) )
ROM_REGION( 0x200000, "sprites", 0 )
ROM_LOAD64_WORD_SWAP( "b67-01.ic1", 0x00000, 0x80000, CRC(81ad9acb) SHA1(d9ad3f6332c6ca6b9872da57526a8158a3cf5b2f) ) /* OBJ: each rom has 1 bitplane, forming 16x8 tiles */
ROM_LOAD64_WORD_SWAP( "b67-02.ic2", 0x00002, 0x80000, CRC(c20cd2fb) SHA1(b015e1fe167e19826aa451b45cd143d66a6db83c) )
ROM_LOAD64_WORD_SWAP( "b67-03.ic3", 0x00004, 0x80000, CRC(bc9019ed) SHA1(7eddc83d71be97ce6637e6b35c226d58e6c39c3f) )
ROM_LOAD64_WORD_SWAP( "b67-04.ic4", 0x00006, 0x80000, CRC(2af4c8af) SHA1(b2ae7aad0c59ffc368811f4bd5546dbb6860f9a9) )
ROM_REGION16_LE( 0x80000, "user1", 0 )
ROM_REGION16_LE( 0x80000, "sprmap_rom", 0 )
ROM_LOAD16_WORD( "b67-05.ic43", 0x00000, 0x80000, CRC(9593e42b) SHA1(54b5538c302a1734ff4b752ab87a8c45d5c6b23d) ) /* index used to create 64x64 sprites on the fly */
ROM_REGION( 0x80000, "ymsnd", 0 ) /* ADPCM samples */
@ -828,16 +816,16 @@ ROM_START( othunderj )
ROM_REGION( 0x10000, "audiocpu", 0 ) /* sound cpu */
ROM_LOAD( "b67-13.ic40", 0x00000, 0x10000, CRC(2936b4b1) SHA1(39b41643464dd89e456ab6eb15a0ff0aef30afde) )
ROM_REGION( 0x80000, "gfx1", 0 )
ROM_LOAD( "b67-06.ic66", 0x00000, 0x80000, CRC(b9a38d64) SHA1(7ae8165b444d9da6ccdbc4a769535bcbb6738aaa) ) /* SCN */
ROM_REGION( 0x80000, "tc0100scn", 0 )
ROM_LOAD16_WORD_SWAP( "b67-06.ic66", 0x00000, 0x80000, CRC(b9a38d64) SHA1(7ae8165b444d9da6ccdbc4a769535bcbb6738aaa) ) /* SCN */
ROM_REGION( 0x200000, "gfx2", 0 )
ROM_LOAD32_BYTE( "b67-01.ic1", 0x00000, 0x80000, CRC(81ad9acb) SHA1(d9ad3f6332c6ca6b9872da57526a8158a3cf5b2f) ) /* OBJ: each rom has 1 bitplane, forming 16x8 tiles */
ROM_LOAD32_BYTE( "b67-02.ic2", 0x00001, 0x80000, CRC(c20cd2fb) SHA1(b015e1fe167e19826aa451b45cd143d66a6db83c) )
ROM_LOAD32_BYTE( "b67-03.ic3", 0x00002, 0x80000, CRC(bc9019ed) SHA1(7eddc83d71be97ce6637e6b35c226d58e6c39c3f) )
ROM_LOAD32_BYTE( "b67-04.ic4", 0x00003, 0x80000, CRC(2af4c8af) SHA1(b2ae7aad0c59ffc368811f4bd5546dbb6860f9a9) )
ROM_REGION( 0x200000, "sprites", 0 )
ROM_LOAD64_WORD_SWAP( "b67-01.ic1", 0x00000, 0x80000, CRC(81ad9acb) SHA1(d9ad3f6332c6ca6b9872da57526a8158a3cf5b2f) ) /* OBJ: each rom has 1 bitplane, forming 16x8 tiles */
ROM_LOAD64_WORD_SWAP( "b67-02.ic2", 0x00002, 0x80000, CRC(c20cd2fb) SHA1(b015e1fe167e19826aa451b45cd143d66a6db83c) )
ROM_LOAD64_WORD_SWAP( "b67-03.ic3", 0x00004, 0x80000, CRC(bc9019ed) SHA1(7eddc83d71be97ce6637e6b35c226d58e6c39c3f) )
ROM_LOAD64_WORD_SWAP( "b67-04.ic4", 0x00006, 0x80000, CRC(2af4c8af) SHA1(b2ae7aad0c59ffc368811f4bd5546dbb6860f9a9) )
ROM_REGION16_LE( 0x80000, "user1", 0 )
ROM_REGION16_LE( 0x80000, "sprmap_rom", 0 )
ROM_LOAD16_WORD( "b67-05.ic43", 0x00000, 0x80000, CRC(9593e42b) SHA1(54b5538c302a1734ff4b752ab87a8c45d5c6b23d) ) /* index used to create 64x64 sprites on the fly */
ROM_REGION( 0x80000, "ymsnd", 0 ) /* ADPCM samples */
@ -866,16 +854,16 @@ ROM_START( othunderjsc ) // SC stands for Shopping Center. It was put in a small
ROM_REGION( 0x10000, "audiocpu", 0 ) /* sound cpu */
ROM_LOAD( "b67-13.ic40", 0x00000, 0x10000, CRC(2936b4b1) SHA1(39b41643464dd89e456ab6eb15a0ff0aef30afde) )
ROM_REGION( 0x80000, "gfx1", 0 )
ROM_LOAD( "b67-06.ic66", 0x00000, 0x80000, CRC(b9a38d64) SHA1(7ae8165b444d9da6ccdbc4a769535bcbb6738aaa) ) /* SCN */
ROM_REGION( 0x80000, "tc0100scn", 0 )
ROM_LOAD16_WORD_SWAP( "b67-06.ic66", 0x00000, 0x80000, CRC(b9a38d64) SHA1(7ae8165b444d9da6ccdbc4a769535bcbb6738aaa) ) /* SCN */
ROM_REGION( 0x200000, "gfx2", 0 )
ROM_LOAD32_BYTE( "b67-01.ic1", 0x00000, 0x80000, CRC(81ad9acb) SHA1(d9ad3f6332c6ca6b9872da57526a8158a3cf5b2f) ) /* OBJ: each rom has 1 bitplane, forming 16x8 tiles */
ROM_LOAD32_BYTE( "b67-02.ic2", 0x00001, 0x80000, CRC(c20cd2fb) SHA1(b015e1fe167e19826aa451b45cd143d66a6db83c) )
ROM_LOAD32_BYTE( "b67-03.ic3", 0x00002, 0x80000, CRC(bc9019ed) SHA1(7eddc83d71be97ce6637e6b35c226d58e6c39c3f) )
ROM_LOAD32_BYTE( "b67-04.ic4", 0x00003, 0x80000, CRC(2af4c8af) SHA1(b2ae7aad0c59ffc368811f4bd5546dbb6860f9a9) )
ROM_REGION( 0x200000, "sprites", 0 )
ROM_LOAD64_WORD_SWAP( "b67-01.ic1", 0x00000, 0x80000, CRC(81ad9acb) SHA1(d9ad3f6332c6ca6b9872da57526a8158a3cf5b2f) ) /* OBJ: each rom has 1 bitplane, forming 16x8 tiles */
ROM_LOAD64_WORD_SWAP( "b67-02.ic2", 0x00002, 0x80000, CRC(c20cd2fb) SHA1(b015e1fe167e19826aa451b45cd143d66a6db83c) )
ROM_LOAD64_WORD_SWAP( "b67-03.ic3", 0x00004, 0x80000, CRC(bc9019ed) SHA1(7eddc83d71be97ce6637e6b35c226d58e6c39c3f) )
ROM_LOAD64_WORD_SWAP( "b67-04.ic4", 0x00006, 0x80000, CRC(2af4c8af) SHA1(b2ae7aad0c59ffc368811f4bd5546dbb6860f9a9) )
ROM_REGION16_LE( 0x80000, "user1", 0 )
ROM_REGION16_LE( 0x80000, "sprmap_rom", 0 )
ROM_LOAD16_WORD( "b67-05.ic43", 0x00000, 0x80000, CRC(9593e42b) SHA1(54b5538c302a1734ff4b752ab87a8c45d5c6b23d) ) /* index used to create 64x64 sprites on the fly */
ROM_REGION( 0x80000, "ymsnd", 0 ) /* ADPCM samples */

View File

@ -25,6 +25,8 @@ public:
othunder_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_spriteram(*this,"spriteram"),
m_sprmap_rom(*this,"sprmap_rom"),
m_z80bank(*this,"z80bank"),
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
m_eeprom(*this, "eeprom"),
@ -48,7 +50,7 @@ protected:
virtual void video_start() override;
private:
void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, const int *primasks, int y_offs);
void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, const u32 *primasks, int y_offs);
void irq_ack_w(offs_t offset, u16 data);
void eeprom_w(u8 data);
@ -56,24 +58,25 @@ private:
DECLARE_WRITE_LINE_MEMBER(adc_eoc_w);
void sound_bankswitch_w(u8 data);
void tc0310fam_w(offs_t offset, u8 data);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(vblank_w);
void othunder_map(address_map &map);
void z80_sound_map(address_map &map);
/* memory pointers */
required_shared_ptr<uint16_t> m_spriteram;
required_shared_ptr<u16> m_spriteram;
required_region_ptr<u16> m_sprmap_rom;
required_memory_bank m_z80bank;
/* video-related */
struct tempsprite
{
int gfx;
int code,color;
int flipx,flipy;
u32 code,color;
bool flipx,flipy;
int x,y;
int zoomx,zoomy;
int primask;
u32 primask;
};
std::unique_ptr<tempsprite[]> m_spritelist;

View File

@ -64,45 +64,38 @@ spriteram is being tested, take no notice of that.]
********************************************************/
void othunder_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, const int *primasks, int y_offs)
void othunder_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, const u32 *primasks, int y_offs)
{
uint16_t *spritemap = (uint16_t *)memregion("user1")->base();
uint16_t tile_mask = (m_gfxdecode->gfx(0)->elements()) - 1;
uint16_t *spriteram16 = m_spriteram;
int offs, data, tilenum, color, flipx, flipy;
int x, y, priority, curx, cury;
const u32 tile_mask = (m_gfxdecode->gfx(0)->elements()) - 1;
int sprites_flipscreen = 0;
int zoomx, zoomy, zx, zy;
int sprite_chunk, map_offset, code, j, k, px, py;
int bad_chunks;
/* 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 */
struct tempsprite *sprite_ptr = m_spritelist.get();
for (offs = (m_spriteram.bytes() / 2) - 4; offs >= 0; offs -= 4)
for (int offs = (m_spriteram.bytes() / 2) - 4; offs >= 0; offs -= 4)
{
data = spriteram16[offs + 0];
zoomy = (data & 0xfe00) >> 9;
y = data & 0x1ff;
u16 data = m_spriteram[offs + 0];
int zoomy = (data & 0xfe00) >> 9;
int y = data & 0x1ff;
data = spriteram16[offs + 1];
flipx = (data & 0x4000) >> 14;
priority = (data & 0x8000) >> 15;
x = data & 0x1ff;
data = m_spriteram[offs + 1];
int flipx = (data & 0x4000) >> 14;
const int priority = (data & 0x8000) >> 15;
int x = data & 0x1ff;
data = spriteram16[offs + 2];
color = (data & 0xff00) >> 8;
zoomx = (data & 0x7f);
data = m_spriteram[offs + 2];
const u32 color = (data & 0xff00) >> 8;
int zoomx = (data & 0x7f);
data = spriteram16[offs + 3];
tilenum = data & 0x1fff; // $80000 spritemap rom maps up to $2000 64x64 sprites
flipy = (data & 0x8000) >> 15;
data = m_spriteram[offs + 3];
const u16 tilenum = data & 0x1fff; // $80000 spritemap rom maps up to $2000 64x64 sprites
int flipy = (data & 0x8000) >> 15;
if (!tilenum)
continue;
map_offset = tilenum << 5;
const int map_offset = tilenum << 5;
zoomx += 1;
zoomy += 1;
@ -113,19 +106,19 @@ void othunder_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, c
if (x > 0x140) x -= 0x200;
if (y > 0x140) y -= 0x200;
bad_chunks = 0;
int bad_chunks = 0;
for (sprite_chunk = 0; sprite_chunk < 32; sprite_chunk++)
for (int sprite_chunk = 0; sprite_chunk < 32; sprite_chunk++)
{
k = sprite_chunk % 4; /* 4 chunks per row */
j = sprite_chunk / 4; /* 8 rows */
const int k = sprite_chunk % 4; /* 4 chunks per row */
const int j = sprite_chunk / 4; /* 8 rows */
px = k;
py = j;
int px = k;
int py = j;
if (flipx) px = 3 - k; /* pick tiles back to front for x and y flips */
if (flipy) py = 7 - j;
code = spritemap[map_offset + px + (py << 2)] & tile_mask;
const u16 code = m_sprmap_rom[map_offset + px + (py << 2)] & tile_mask;
if (code == 0xffff)
{
@ -133,11 +126,11 @@ void othunder_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, c
continue;
}
curx = x + ((k * zoomx) / 4);
cury = y + ((j * zoomy) / 8);
int curx = x + ((k * zoomx) / 4);
int cury = y + ((j * zoomy) / 8);
zx= x + (((k + 1) * zoomx) / 4) - curx;
zy= y + (((j + 1) * zoomy) / 8) - cury;
const int zx = x + (((k + 1) * zoomx) / 4) - curx;
const int zy = y + (((j + 1) * zoomy) / 8) - cury;
if (sprites_flipscreen)
{
@ -200,7 +193,7 @@ logerror("Sprite number %04x had %02x invalid chunks\n",tilenum,bad_chunks);
SCREEN REFRESH
**************************************************************/
uint32_t othunder_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
u32 othunder_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
int layer[3];
@ -221,7 +214,7 @@ uint32_t othunder_state::screen_update(screen_device &screen, bitmap_ind16 &bitm
/* Sprites can be under/over the layer below text layer */
{
static const int primasks[2] = {0xf0, 0xfc};
static const u32 primasks[2] = {0xf0, 0xfc};
draw_sprites(screen, bitmap, cliprect, primasks, 3);
}