Merge pull request #4809 from cam900/oneshot_args

oneshot.cpp : Updates
This commit is contained in:
R. Belmont 2019-03-25 13:07:40 -04:00 committed by GitHub
commit 856a9e0fb0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 110 additions and 105 deletions

View File

@ -129,9 +129,9 @@ For One Shot One Kill:
#include "speaker.h" #include "speaker.h"
READ16_MEMBER(oneshot_state::oneshot_in0_word_r) u16 oneshot_state::oneshot_in0_word_r()
{ {
int data = ioport("DSW1")->read(); const u16 data = m_io_dsw1->read();
switch (data & 0x0c) switch (data & 0x0c)
{ {
@ -152,7 +152,7 @@ READ16_MEMBER(oneshot_state::oneshot_in0_word_r)
return data; return data;
} }
READ16_MEMBER(oneshot_state::oneshot_gun_x_p1_r) u16 oneshot_state::oneshot_gun_x_p1_r()
{ {
/* shots must be in a different location to register */ /* shots must be in a different location to register */
m_p1_wobble ^= 1; m_p1_wobble ^= 1;
@ -160,12 +160,12 @@ READ16_MEMBER(oneshot_state::oneshot_gun_x_p1_r)
return m_gun_x_p1 ^ m_p1_wobble; return m_gun_x_p1 ^ m_p1_wobble;
} }
READ16_MEMBER(oneshot_state::oneshot_gun_y_p1_r) u16 oneshot_state::oneshot_gun_y_p1_r()
{ {
return m_gun_y_p1; return m_gun_y_p1;
} }
READ16_MEMBER(oneshot_state::oneshot_gun_x_p2_r) u16 oneshot_state::oneshot_gun_x_p2_r()
{ {
/* shots must be in a different location to register */ /* shots must be in a different location to register */
m_p2_wobble ^= 1; m_p2_wobble ^= 1;
@ -173,34 +173,32 @@ READ16_MEMBER(oneshot_state::oneshot_gun_x_p2_r)
return m_gun_x_p2 ^ m_p2_wobble; return m_gun_x_p2 ^ m_p2_wobble;
} }
READ16_MEMBER(oneshot_state::oneshot_gun_y_p2_r) u16 oneshot_state::oneshot_gun_y_p2_r()
{ {
return m_gun_y_p2; return m_gun_y_p2;
} }
WRITE16_MEMBER(oneshot_state::soundbank_w) void oneshot_state::soundbank_w(u8 data)
{ {
if (ACCESSING_BITS_0_7) m_oki->set_rom_bank((data & 0x03) ^ 0x03);
{
m_oki->set_rom_bank((data & 0x03) ^ 0x03);
}
} }
void oneshot_state::oneshot_map(address_map &map) void oneshot_state::mem_map(address_map &map)
{ {
map(0x000000, 0x03ffff).rom(); map(0x000000, 0x03ffff).rom();
map(0x080000, 0x087fff).ram(); map(0x080000, 0x087fff).ram();
map(0x0c0000, 0x0c07ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette"); map(0x0c0000, 0x0c07ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette");
map(0x120000, 0x120fff).ram().share("sprites"); map(0x120000, 0x120fff).ram().share("spriteram");
map(0x180000, 0x180fff).ram().w(FUNC(oneshot_state::oneshot_mid_videoram_w)).share("mid_videoram"); // some people , girl etc. //map(0x13f000, 0x13f000).noprw(); // Unknown read / writes
map(0x181000, 0x181fff).ram().w(FUNC(oneshot_state::oneshot_fg_videoram_w)).share("fg_videoram"); // credits etc. map(0x180000, 0x180fff).ram().w(FUNC(oneshot_state::mid_videoram_w)).share("mid_videoram"); // some people , girl etc.
map(0x182000, 0x182fff).ram().w(FUNC(oneshot_state::oneshot_bg_videoram_w)).share("bg_videoram"); // credits etc. map(0x181000, 0x181fff).ram().w(FUNC(oneshot_state::fg_videoram_w)).share("fg_videoram"); // credits etc.
map(0x182000, 0x182fff).ram().w(FUNC(oneshot_state::bg_videoram_w)).share("bg_videoram"); // credits etc.
map(0x188000, 0x18800f).writeonly().share("scroll"); // scroll registers map(0x188000, 0x18800f).writeonly().share("scroll"); // scroll registers
map(0x190003, 0x190003).r("soundlatch", FUNC(generic_latch_8_device::read)); map(0x190003, 0x190003).r("soundlatch", FUNC(generic_latch_8_device::read));
map(0x190011, 0x190011).w("soundlatch", FUNC(generic_latch_8_device::write)); map(0x190011, 0x190011).w("soundlatch", FUNC(generic_latch_8_device::write));
map(0x190018, 0x190019).w(FUNC(oneshot_state::soundbank_w)); map(0x190019, 0x190019).w(FUNC(oneshot_state::soundbank_w));
map(0x190026, 0x190027).r(FUNC(oneshot_state::oneshot_gun_x_p1_r)); map(0x190026, 0x190027).r(FUNC(oneshot_state::oneshot_gun_x_p1_r));
map(0x19002e, 0x19002f).r(FUNC(oneshot_state::oneshot_gun_x_p2_r)); map(0x19002e, 0x19002f).r(FUNC(oneshot_state::oneshot_gun_x_p2_r));
map(0x190036, 0x190037).r(FUNC(oneshot_state::oneshot_gun_y_p1_r)); map(0x190036, 0x190037).r(FUNC(oneshot_state::oneshot_gun_y_p1_r));
@ -212,7 +210,7 @@ void oneshot_state::oneshot_map(address_map &map)
map(0x19c034, 0x19c035).portr("P2"); map(0x19c034, 0x19c035).portr("P2");
} }
void oneshot_state::oneshot_sound_map(address_map &map) void oneshot_state::sound_map(address_map &map)
{ {
map(0x0000, 0x7fff).rom(); map(0x0000, 0x7fff).rom();
map(0x8000, 0x8000).rw("soundlatch", FUNC(generic_latch_8_device::read), FUNC(generic_latch_8_device::write)); map(0x8000, 0x8000).rw("soundlatch", FUNC(generic_latch_8_device::read), FUNC(generic_latch_8_device::write));
@ -395,10 +393,8 @@ static const gfx_layout oneshot16x16_layout =
RGN_FRAC(1,8), RGN_FRAC(1,8),
8, 8,
{ RGN_FRAC(0,8),RGN_FRAC(1,8),RGN_FRAC(2,8),RGN_FRAC(3,8),RGN_FRAC(4,8),RGN_FRAC(5,8),RGN_FRAC(6,8),RGN_FRAC(7,8) }, { RGN_FRAC(0,8),RGN_FRAC(1,8),RGN_FRAC(2,8),RGN_FRAC(3,8),RGN_FRAC(4,8),RGN_FRAC(5,8),RGN_FRAC(6,8),RGN_FRAC(7,8) },
{ 0,1,2,3,4,5,6,7, { STEP8(0,1), STEP8(8*8,1) },
64+0,64+1,64+2,64+3,64+4,64+5,64+6,64+7 }, { STEP8(0,8), STEP8(8*8*2,8) },
{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
128+0*8, 128+1*8, 128+2*8, 128+3*8, 128+4*8, 128+5*8, 128+6*8, 128+7*8 },
16*16 16*16
}; };
@ -408,15 +404,15 @@ static const gfx_layout oneshot8x8_layout =
RGN_FRAC(1,8), RGN_FRAC(1,8),
8, 8,
{ RGN_FRAC(0,8),RGN_FRAC(1,8),RGN_FRAC(2,8),RGN_FRAC(3,8),RGN_FRAC(4,8),RGN_FRAC(5,8),RGN_FRAC(6,8),RGN_FRAC(7,8) }, { RGN_FRAC(0,8),RGN_FRAC(1,8),RGN_FRAC(2,8),RGN_FRAC(3,8),RGN_FRAC(4,8),RGN_FRAC(5,8),RGN_FRAC(6,8),RGN_FRAC(7,8) },
{ 0,1,2,3,4,5,6,7 }, { STEP8(0,1) },
{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, { STEP8(0,8) },
8*8 8*8
}; };
static GFXDECODE_START( gfx_oneshot ) static GFXDECODE_START( gfx_oneshot )
GFXDECODE_ENTRY( "gfx1", 0, oneshot16x16_layout, 0x00, 4 ) /* sprites */ GFXDECODE_ENTRY( "gfx1", 0, oneshot16x16_layout, 0, 4 ) /* sprites */
GFXDECODE_ENTRY( "gfx1", 0, oneshot8x8_layout, 0x00, 4 ) /* sprites */ GFXDECODE_ENTRY( "gfx1", 0, oneshot8x8_layout, 0, 4 ) /* sprites */
GFXDECODE_END GFXDECODE_END
void oneshot_state::machine_start() void oneshot_state::machine_start()
@ -445,10 +441,10 @@ void oneshot_state::oneshot(machine_config &config)
{ {
/* basic machine hardware */ /* basic machine hardware */
M68000(config, m_maincpu, 12_MHz_XTAL); M68000(config, m_maincpu, 12_MHz_XTAL);
m_maincpu->set_addrmap(AS_PROGRAM, &oneshot_state::oneshot_map); m_maincpu->set_addrmap(AS_PROGRAM, &oneshot_state::mem_map);
m_maincpu->set_vblank_int("screen", FUNC(oneshot_state::irq4_line_hold)); m_maincpu->set_vblank_int("screen", FUNC(oneshot_state::irq4_line_hold));
Z80(config, "audiocpu", 5_MHz_XTAL).set_addrmap(AS_PROGRAM, &oneshot_state::oneshot_sound_map); // Not verified Z80(config, "audiocpu", 5_MHz_XTAL).set_addrmap(AS_PROGRAM, &oneshot_state::sound_map); // Not verified
/* video hardware */ /* video hardware */
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
@ -497,14 +493,14 @@ ROM_START( oneshot )
ROM_LOAD( "1shot.ua2", 0x00000, 0x010000, CRC(f655b80e) SHA1(2574a812c35801755c187a47f46ccdb0983c5feb) ) ROM_LOAD( "1shot.ua2", 0x00000, 0x010000, CRC(f655b80e) SHA1(2574a812c35801755c187a47f46ccdb0983c5feb) )
ROM_REGION( 0x400000, "gfx1", 0 ) /* Sprites */ ROM_REGION( 0x400000, "gfx1", 0 ) /* Sprites */
ROM_LOAD( "1shot-ui.16a",0x000000, 0x080000, CRC(f765f9a2) SHA1(f6c386e0421fcb0e420585dd27d9dad951bb2556) ) ROM_LOAD( "1shot-ui.16a", 0x000000, 0x080000, CRC(f765f9a2) SHA1(f6c386e0421fcb0e420585dd27d9dad951bb2556) )
ROM_LOAD( "1shot-ui.13a",0x080000, 0x080000, CRC(3361b5d8) SHA1(f7db674d479765d4e58fb663aa5e13dde2abcce7) ) ROM_LOAD( "1shot-ui.13a", 0x080000, 0x080000, CRC(3361b5d8) SHA1(f7db674d479765d4e58fb663aa5e13dde2abcce7) )
ROM_LOAD( "1shot-ui.11a",0x100000, 0x080000, CRC(8f8bd027) SHA1(fbec952ab5604c8e20c5e7cfd2844f4fe5441186) ) ROM_LOAD( "1shot-ui.11a", 0x100000, 0x080000, CRC(8f8bd027) SHA1(fbec952ab5604c8e20c5e7cfd2844f4fe5441186) )
ROM_LOAD( "1shot-ui.08a",0x180000, 0x080000, CRC(254b1701) SHA1(163bfa70508fca20be70dd0af8b768ab6bf211b9) ) ROM_LOAD( "1shot-ui.08a", 0x180000, 0x080000, CRC(254b1701) SHA1(163bfa70508fca20be70dd0af8b768ab6bf211b9) )
ROM_LOAD( "1shot-ui.16", 0x200000, 0x080000, CRC(ff246b27) SHA1(fef6029030268174ef9648b8f437aeda68475346) ) ROM_LOAD( "1shot-ui.16", 0x200000, 0x080000, CRC(ff246b27) SHA1(fef6029030268174ef9648b8f437aeda68475346) )
ROM_LOAD( "1shot-ui.13", 0x280000, 0x080000, CRC(80342e83) SHA1(2ac2b300382a607a539d2b0982ab596f05be3ad3) ) ROM_LOAD( "1shot-ui.13", 0x280000, 0x080000, CRC(80342e83) SHA1(2ac2b300382a607a539d2b0982ab596f05be3ad3) )
ROM_LOAD( "1shot-ui.11", 0x300000, 0x080000, CRC(b8938345) SHA1(318cf0d070db786680a45811bbd765fa37caaf62) ) ROM_LOAD( "1shot-ui.11", 0x300000, 0x080000, CRC(b8938345) SHA1(318cf0d070db786680a45811bbd765fa37caaf62) )
ROM_LOAD( "1shot-ui.08", 0x380000, 0x080000, CRC(c9953bef) SHA1(21917a9dcc0afaeec20672ad863d0c9d583369e3) ) ROM_LOAD( "1shot-ui.08", 0x380000, 0x080000, CRC(c9953bef) SHA1(21917a9dcc0afaeec20672ad863d0c9d583369e3) )
ROM_REGION( 0x100000, "oki", 0 ) /* Samples */ ROM_REGION( 0x100000, "oki", 0 ) /* Samples */
ROM_LOAD( "1shot.u15", 0x000000, 0x080000, CRC(e3759a47) SHA1(1159335924a6d68a0a24bfbe0c9182107f3f05f8) ) ROM_LOAD( "1shot.u15", 0x000000, 0x080000, CRC(e3759a47) SHA1(1159335924a6d68a0a24bfbe0c9182107f3f05f8) )
@ -527,10 +523,10 @@ ROM_START( maddonna )
ROM_LOAD( "maddonna.b7", 0x080000, 0x080000, CRC(4920d2ec) SHA1(e72a374bca81ffa4f925326455e007df7227ae08) ) ROM_LOAD( "maddonna.b7", 0x080000, 0x080000, CRC(4920d2ec) SHA1(e72a374bca81ffa4f925326455e007df7227ae08) )
ROM_LOAD( "maddonna.b9", 0x100000, 0x080000, CRC(3a8a3feb) SHA1(832654902963c163644134431fd1221e1895cfec) ) ROM_LOAD( "maddonna.b9", 0x100000, 0x080000, CRC(3a8a3feb) SHA1(832654902963c163644134431fd1221e1895cfec) )
ROM_LOAD( "maddonna.b11", 0x180000, 0x080000, CRC(6f9b7fdf) SHA1(14ced1d43eae3b6db4a0a4c12fb26cbd13eb7428) ) ROM_LOAD( "maddonna.b11", 0x180000, 0x080000, CRC(6f9b7fdf) SHA1(14ced1d43eae3b6db4a0a4c12fb26cbd13eb7428) )
ROM_LOAD( "maddonna.b6", 0x200000, 0x080000, CRC(b02e9e0e) SHA1(6e527a2bfda0f4f420c10139c75dac2704e08d08) ) ROM_LOAD( "maddonna.b6", 0x200000, 0x080000, CRC(b02e9e0e) SHA1(6e527a2bfda0f4f420c10139c75dac2704e08d08) )
ROM_LOAD( "maddonna.b8", 0x280000, 0x080000, CRC(03f1de40) SHA1(bb0c0525155404c0740ac5f048f71ae7651a5941) ) ROM_LOAD( "maddonna.b8", 0x280000, 0x080000, CRC(03f1de40) SHA1(bb0c0525155404c0740ac5f048f71ae7651a5941) )
ROM_LOAD( "maddonna.b10", 0x300000, 0x080000, CRC(87936423) SHA1(dda42f3685427edad7686d9712ff07d2fd9bf57e) ) ROM_LOAD( "maddonna.b10", 0x300000, 0x080000, CRC(87936423) SHA1(dda42f3685427edad7686d9712ff07d2fd9bf57e) )
ROM_LOAD( "maddonna.b12", 0x380000, 0x080000, CRC(879ab23c) SHA1(5288016542a10e60ccb28a930d8dfe4db41c6fc6) ) ROM_LOAD( "maddonna.b12", 0x380000, 0x080000, CRC(879ab23c) SHA1(5288016542a10e60ccb28a930d8dfe4db41c6fc6) )
ROM_REGION( 0x100000, "oki", ROMREGION_ERASE00 ) /* Samples */ ROM_REGION( 0x100000, "oki", ROMREGION_ERASE00 ) /* Samples */
/* no samples for this game */ /* no samples for this game */

View File

@ -13,11 +13,14 @@ class oneshot_state : public driver_device
public: public:
oneshot_state(const machine_config &mconfig, device_type type, const char *tag) : oneshot_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag), driver_device(mconfig, type, tag),
m_sprites(*this, "sprites"), m_spriteram(*this, "spriteram"),
m_bg_videoram(*this, "bg_videoram"), m_bg_videoram(*this, "bg_videoram"),
m_mid_videoram(*this, "mid_videoram"), m_mid_videoram(*this, "mid_videoram"),
m_fg_videoram(*this, "fg_videoram"), m_fg_videoram(*this, "fg_videoram"),
m_scroll(*this, "scroll"), m_scroll(*this, "scroll"),
m_io_dsw1(*this, "DSW1"),
m_io_lightgun_x(*this, "LIGHT%u_X", 0U),
m_io_lightgun_y(*this, "LIGHT%u_Y", 0U),
m_maincpu(*this, "maincpu"), m_maincpu(*this, "maincpu"),
m_oki(*this, "oki"), m_oki(*this, "oki"),
m_gfxdecode(*this, "gfxdecode"), m_gfxdecode(*this, "gfxdecode"),
@ -35,11 +38,15 @@ protected:
private: private:
/* memory pointers */ /* memory pointers */
required_shared_ptr<uint16_t> m_sprites; required_shared_ptr<u16> m_spriteram;
required_shared_ptr<uint16_t> m_bg_videoram; required_shared_ptr<u16> m_bg_videoram;
required_shared_ptr<uint16_t> m_mid_videoram; required_shared_ptr<u16> m_mid_videoram;
required_shared_ptr<uint16_t> m_fg_videoram; required_shared_ptr<u16> m_fg_videoram;
required_shared_ptr<uint16_t> m_scroll; required_shared_ptr<u16> m_scroll;
optional_ioport m_io_dsw1;
optional_ioport_array<2> m_io_lightgun_x;
optional_ioport_array<2> m_io_lightgun_y;
/* video-related */ /* video-related */
tilemap_t *m_bg_tilemap; tilemap_t *m_bg_tilemap;
@ -61,25 +68,25 @@ private:
required_device<gfxdecode_device> m_gfxdecode; required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette; required_device<palette_device> m_palette;
DECLARE_READ16_MEMBER(oneshot_in0_word_r); u16 oneshot_in0_word_r();
DECLARE_READ16_MEMBER(oneshot_gun_x_p1_r); u16 oneshot_gun_x_p1_r();
DECLARE_READ16_MEMBER(oneshot_gun_y_p1_r); u16 oneshot_gun_y_p1_r();
DECLARE_READ16_MEMBER(oneshot_gun_x_p2_r); u16 oneshot_gun_x_p2_r();
DECLARE_READ16_MEMBER(oneshot_gun_y_p2_r); u16 oneshot_gun_y_p2_r();
DECLARE_WRITE16_MEMBER(oneshot_bg_videoram_w); void bg_videoram_w(offs_t offset, u16 data, u16 mem_mask = ~0);
DECLARE_WRITE16_MEMBER(oneshot_mid_videoram_w); void mid_videoram_w(offs_t offset, u16 data, u16 mem_mask = ~0);
DECLARE_WRITE16_MEMBER(oneshot_fg_videoram_w); void fg_videoram_w(offs_t offset, u16 data, u16 mem_mask = ~0);
DECLARE_WRITE16_MEMBER(soundbank_w); void soundbank_w(u8 data);
TILE_GET_INFO_MEMBER(get_oneshot_bg_tile_info); TILE_GET_INFO_MEMBER(get_bg_tile_info);
TILE_GET_INFO_MEMBER(get_oneshot_mid_tile_info); TILE_GET_INFO_MEMBER(get_mid_tile_info);
TILE_GET_INFO_MEMBER(get_oneshot_fg_tile_info); TILE_GET_INFO_MEMBER(get_fg_tile_info);
uint32_t screen_update_oneshot(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); u32 screen_update_oneshot(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_maddonna(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); u32 screen_update_maddonna(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_komocomo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); u32 screen_update_komocomo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_crosshairs( bitmap_ind16 &bitmap, const rectangle &cliprect ); void draw_crosshairs();
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
void oneshot_map(address_map &map); void mem_map(address_map &map);
void oneshot_sound_map(address_map &map); void sound_map(address_map &map);
}; };
#endif // MAME_INCLUDES_ONESHOT_H #endif // MAME_INCLUDES_ONESHOT_H

View File

@ -7,28 +7,28 @@
/* bg tilemap */ /* bg tilemap */
TILE_GET_INFO_MEMBER(oneshot_state::get_oneshot_bg_tile_info) TILE_GET_INFO_MEMBER(oneshot_state::get_bg_tile_info)
{ {
int tileno = m_bg_videoram[tile_index * 2 + 1]; const u32 tileno = m_bg_videoram[tile_index * 2 + 1];
SET_TILE_INFO_MEMBER(0, tileno, 0, 0); SET_TILE_INFO_MEMBER(0, tileno, 0, 0);
} }
WRITE16_MEMBER(oneshot_state::oneshot_bg_videoram_w) void oneshot_state::bg_videoram_w(offs_t offset, u16 data, u16 mem_mask)
{ {
COMBINE_DATA(&m_bg_videoram[offset]); COMBINE_DATA(&m_bg_videoram[offset]);
m_bg_tilemap->mark_tile_dirty(offset / 2); m_bg_tilemap->mark_tile_dirty(offset / 2);
} }
/* mid tilemap */ /* mid tilemap */
TILE_GET_INFO_MEMBER(oneshot_state::get_oneshot_mid_tile_info) TILE_GET_INFO_MEMBER(oneshot_state::get_mid_tile_info)
{ {
int tileno = m_mid_videoram[tile_index * 2 + 1]; const u32 tileno = m_mid_videoram[tile_index * 2 + 1];
SET_TILE_INFO_MEMBER(0, tileno, 2, 0); SET_TILE_INFO_MEMBER(0, tileno, 2, 0);
} }
WRITE16_MEMBER(oneshot_state::oneshot_mid_videoram_w) void oneshot_state::mid_videoram_w(offs_t offset, u16 data, u16 mem_mask)
{ {
COMBINE_DATA(&m_mid_videoram[offset]); COMBINE_DATA(&m_mid_videoram[offset]);
m_mid_tilemap->mark_tile_dirty(offset / 2); m_mid_tilemap->mark_tile_dirty(offset / 2);
@ -36,14 +36,14 @@ WRITE16_MEMBER(oneshot_state::oneshot_mid_videoram_w)
/* fg tilemap */ /* fg tilemap */
TILE_GET_INFO_MEMBER(oneshot_state::get_oneshot_fg_tile_info) TILE_GET_INFO_MEMBER(oneshot_state::get_fg_tile_info)
{ {
int tileno = m_fg_videoram[tile_index * 2 + 1]; const u32 tileno = m_fg_videoram[tile_index * 2 + 1];
SET_TILE_INFO_MEMBER(0, tileno, 3, 0); SET_TILE_INFO_MEMBER(0, tileno, 3, 0);
} }
WRITE16_MEMBER(oneshot_state::oneshot_fg_videoram_w) void oneshot_state::fg_videoram_w(offs_t offset, u16 data, u16 mem_mask)
{ {
COMBINE_DATA(&m_fg_videoram[offset]); COMBINE_DATA(&m_fg_videoram[offset]);
m_fg_tilemap->mark_tile_dirty(offset / 2); m_fg_tilemap->mark_tile_dirty(offset / 2);
@ -51,22 +51,22 @@ WRITE16_MEMBER(oneshot_state::oneshot_fg_videoram_w)
void oneshot_state::video_start() void oneshot_state::video_start()
{ {
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(oneshot_state::get_oneshot_bg_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 32, 32); m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(oneshot_state::get_bg_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 32, 32);
m_mid_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(oneshot_state::get_oneshot_mid_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 32, 32); m_mid_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(oneshot_state::get_mid_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 32, 32);
m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(oneshot_state::get_oneshot_fg_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 32, 32); m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(oneshot_state::get_fg_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 32, 32);
m_bg_tilemap->set_transparent_pen(0); m_bg_tilemap->set_transparent_pen(0);
m_mid_tilemap->set_transparent_pen(0); m_mid_tilemap->set_transparent_pen(0);
m_fg_tilemap->set_transparent_pen(0); m_fg_tilemap->set_transparent_pen(0);
} }
void oneshot_state::draw_crosshairs( bitmap_ind16 &bitmap, const rectangle &cliprect ) void oneshot_state::draw_crosshairs()
{ {
//int xpos,ypos; //int xpos,ypos;
/* get gun raw coordinates (player 1) */ /* get gun raw coordinates (player 1) */
m_gun_x_p1 = (ioport("LIGHT0_X")->read() & 0xff) * 320 / 256; m_gun_x_p1 = (m_io_lightgun_x[0]->read() & 0xff) * 320 / 256;
m_gun_y_p1 = (ioport("LIGHT0_Y")->read() & 0xff) * 240 / 256; m_gun_y_p1 = (m_io_lightgun_y[0]->read() & 0xff) * 240 / 256;
/* compute the coordinates for drawing (from routine at 0x009ab0) */ /* compute the coordinates for drawing (from routine at 0x009ab0) */
//xpos = m_gun_x_p1; //xpos = m_gun_x_p1;
@ -80,8 +80,8 @@ void oneshot_state::draw_crosshairs( bitmap_ind16 &bitmap, const rectangle &clip
/* get gun raw coordinates (player 2) */ /* get gun raw coordinates (player 2) */
m_gun_x_p2 = (ioport("LIGHT1_X")->read() & 0xff) * 320 / 256; m_gun_x_p2 = (m_io_lightgun_x[1]->read() & 0xff) * 320 / 256;
m_gun_y_p2 = (ioport("LIGHT1_Y")->read() & 0xff) * 240 / 256; m_gun_y_p2 = (m_io_lightgun_y[1]->read() & 0xff) * 240 / 256;
/* compute the coordinates for drawing (from routine at 0x009b6e) */ /* compute the coordinates for drawing (from routine at 0x009b6e) */
//xpos = m_gun_x_p2; //xpos = m_gun_x_p2;
@ -92,37 +92,41 @@ void oneshot_state::draw_crosshairs( bitmap_ind16 &bitmap, const rectangle &clip
m_gun_x_p2 = 0; m_gun_x_p2 = 0;
} }
void oneshot_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) void oneshot_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
{ {
const uint16_t *source = m_sprites; const u16 *source = m_spriteram;
const uint16_t *finish = source + (0x1000 / 2); const u16 *finish = source + (0x1000 / 2);
gfx_element *gfx = m_gfxdecode->gfx(1); gfx_element *gfx = m_gfxdecode->gfx(1);
int xpos, ypos;
while (source < finish) while (source < finish)
{ {
int blockx, blocky; const u16 attr = source[0];
int num = source[1] & 0xffff;
int xsize = (source[2] & 0x000f) + 1;
int ysize = (source[3] & 0x000f) + 1;
ypos = source[3] & 0xff80; if (attr & 0x0001) // end of sprites
xpos = source[2] & 0xff80; break;
if (!(attr & 0x8000)) // visible bit
{
source += 0x4;
continue;
}
const u32 num = source[1] & 0xffff;
const int xsize = (source[2] & 0x000f) + 1;
const int ysize = (source[3] & 0x000f) + 1;
int ypos = source[3] & 0xff80;
int xpos = source[2] & 0xff80;
ypos = ypos >> 7; ypos = ypos >> 7;
xpos = xpos >> 7; xpos = xpos >> 7;
if (source[0] == 0x0001)
break;
xpos -= 8; xpos -= 8;
ypos -= 6; ypos -= 6;
for (blockx = 0; blockx < xsize; blockx++) for (int blockx = 0; blockx < xsize; blockx++)
{ {
for (blocky = 0; blocky < ysize; blocky++) for (int blocky = 0; blocky < ysize; blocky++)
{ {
gfx->transpen( gfx->transpen(
bitmap, bitmap,
@ -132,7 +136,6 @@ void oneshot_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprec
0,0, 0,0,
xpos + blockx * 8, ypos + blocky * 8, 0); xpos + blockx * 8, ypos + blocky * 8, 0);
gfx->transpen( gfx->transpen(
bitmap, bitmap,
cliprect, cliprect,
@ -144,10 +147,9 @@ void oneshot_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprec
} }
source += 0x4; source += 0x4;
} }
} }
uint32_t oneshot_state::screen_update_oneshot(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) u32 oneshot_state::screen_update_oneshot(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{ {
bitmap.fill(m_palette->black_pen(), cliprect); bitmap.fill(m_palette->black_pen(), cliprect);
@ -158,11 +160,11 @@ uint32_t oneshot_state::screen_update_oneshot(screen_device &screen, bitmap_ind1
m_mid_tilemap->draw(screen, bitmap, cliprect, 0, 0); m_mid_tilemap->draw(screen, bitmap, cliprect, 0, 0);
draw_sprites(bitmap, cliprect); draw_sprites(bitmap, cliprect);
m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0); m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
draw_crosshairs(bitmap, cliprect); draw_crosshairs();
return 0; return 0;
} }
uint32_t oneshot_state::screen_update_maddonna(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) u32 oneshot_state::screen_update_maddonna(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{ {
bitmap.fill(m_palette->black_pen(), cliprect); bitmap.fill(m_palette->black_pen(), cliprect);
@ -178,7 +180,7 @@ uint32_t oneshot_state::screen_update_maddonna(screen_device &screen, bitmap_ind
} }
// why are the layers in a different order? // why are the layers in a different order?
uint32_t oneshot_state::screen_update_komocomo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) u32 oneshot_state::screen_update_komocomo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{ {
bitmap.fill(m_palette->black_pen(), cliprect); bitmap.fill(m_palette->black_pen(), cliprect);