summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/video/oneshot.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/video/oneshot.cpp')
-rw-r--r--src/mame/video/oneshot.cpp82
1 files changed, 42 insertions, 40 deletions
diff --git a/src/mame/video/oneshot.cpp b/src/mame/video/oneshot.cpp
index 2105b36b24f..76646953b82 100644
--- a/src/mame/video/oneshot.cpp
+++ b/src/mame/video/oneshot.cpp
@@ -7,28 +7,28 @@
/* 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);
}
-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]);
m_bg_tilemap->mark_tile_dirty(offset / 2);
}
/* 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);
}
-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]);
m_mid_tilemap->mark_tile_dirty(offset / 2);
@@ -36,14 +36,14 @@ WRITE16_MEMBER(oneshot_state::oneshot_mid_videoram_w)
/* 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);
}
-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]);
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()
{
- 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_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_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_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_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_fg_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 32, 32);
m_bg_tilemap->set_transparent_pen(0);
m_mid_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;
/* get gun raw coordinates (player 1) */
- m_gun_x_p1 = (ioport("LIGHT0_X")->read() & 0xff) * 320 / 256;
- m_gun_y_p1 = (ioport("LIGHT0_Y")->read() & 0xff) * 240 / 256;
+ m_gun_x_p1 = (m_io_lightgun_x[0]->read() & 0xff) * 320 / 256;
+ m_gun_y_p1 = (m_io_lightgun_y[0]->read() & 0xff) * 240 / 256;
/* compute the coordinates for drawing (from routine at 0x009ab0) */
//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) */
- m_gun_x_p2 = (ioport("LIGHT1_X")->read() & 0xff) * 320 / 256;
- m_gun_y_p2 = (ioport("LIGHT1_Y")->read() & 0xff) * 240 / 256;
+ m_gun_x_p2 = (m_io_lightgun_x[1]->read() & 0xff) * 320 / 256;
+ m_gun_y_p2 = (m_io_lightgun_y[1]->read() & 0xff) * 240 / 256;
/* compute the coordinates for drawing (from routine at 0x009b6e) */
//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;
}
-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 uint16_t *finish = source + (0x1000 / 2);
+ const u16 *source = m_spriteram;
+ const u16 *finish = source + (0x1000 / 2);
gfx_element *gfx = m_gfxdecode->gfx(1);
- int xpos, ypos;
-
while (source < finish)
{
- int blockx, blocky;
- int num = source[1] & 0xffff;
- int xsize = (source[2] & 0x000f) + 1;
- int ysize = (source[3] & 0x000f) + 1;
+ const u16 attr = source[0];
- ypos = source[3] & 0xff80;
- xpos = source[2] & 0xff80;
+ if (attr & 0x0001) // end of sprites
+ break;
- ypos = ypos >> 7;
- xpos = xpos >> 7;
+ 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;
- if (source[0] == 0x0001)
- break;
+ int ypos = source[3] & 0xff80;
+ int xpos = source[2] & 0xff80;
+
+ ypos = ypos >> 7;
+ xpos = xpos >> 7;
xpos -= 8;
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(
bitmap,
@@ -132,7 +136,6 @@ void oneshot_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprec
0,0,
xpos + blockx * 8, ypos + blocky * 8, 0);
-
gfx->transpen(
bitmap,
cliprect,
@@ -144,10 +147,9 @@ void oneshot_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprec
}
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);
@@ -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);
draw_sprites(bitmap, cliprect);
m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
- draw_crosshairs(bitmap, cliprect);
+ draw_crosshairs();
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);
@@ -178,7 +180,7 @@ uint32_t oneshot_state::screen_update_maddonna(screen_device &screen, bitmap_ind
}
// 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);