diff options
Diffstat (limited to 'src/mame/video/decmxc06.cpp')
-rw-r--r-- | src/mame/video/decmxc06.cpp | 143 |
1 files changed, 67 insertions, 76 deletions
diff --git a/src/mame/video/decmxc06.cpp b/src/mame/video/decmxc06.cpp index fbf91e3cbaa..621e5e1d161 100644 --- a/src/mame/video/decmxc06.cpp +++ b/src/mame/video/decmxc06.cpp @@ -47,35 +47,37 @@ DEFINE_DEVICE_TYPE(DECO_MXC06, deco_mxc06_device, "deco_mxc06", "DECO MXC06 Spri deco_mxc06_device::deco_mxc06_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, DECO_MXC06, tag, owner, clock) , device_video_interface(mconfig, *this) - , m_gfxregion(0) - , m_ramsize(0x800) - , m_gfxdecode(*this, finder_base::DUMMY_TAG) { } /* this implementation was originally from Mad Motor */ -void deco_mxc06_device::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, uint16_t* spriteram, int pri_mask, int pri_val, int col_mask ) +void deco_mxc06_device::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element *gfx, u16* spriteram, int size) { - int offs; + const bool priority = !m_colpri_cb.isnull(); + int start, end, inc; + if (priority) { start = size - 4; end = -4; inc = -4; } + else { start = 0; end = size; inc = +4; } - offs = 0; - while (offs < m_ramsize / 2) + for (int offs = start; offs != end; offs += inc) { - int sx, sy, code, color, w, h, flipx, flipy, incy, flash, mult, x, y, parentFlipY; + u32 pri_mask = 0; + int flipy, incy, mult, parentFlipY; - sy = spriteram[offs]; - sx = spriteram[offs + 2]; - color = sx >> 12; + const u16 data0 = spriteram[offs]; + const u16 data2 = spriteram[offs + 2]; + u32 colour = data2 >> 12; + if (priority) + m_colpri_cb(colour, pri_mask); - flash = sx & 0x800; + const bool flash = data2 & 0x800; - flipx = sy & 0x2000; - parentFlipY = flipy = sy & 0x4000; - h = (1 << ((sy & 0x1800) >> 11)); /* 1x, 2x, 4x, 8x height */ - w = (1 << ((sy & 0x0600) >> 9)); /* 1x, 2x, 4x, 8x width */ + int flipx = data0 & 0x2000; + parentFlipY = flipy = data0 & 0x4000; + const u16 h = (1 << ((data0 & 0x1800) >> 11)); /* 1x, 2x, 4x, 8x height */ + const u16 w = (1 << ((data0 & 0x0600) >> 9)); /* 1x, 2x, 4x, 8x width */ - sx = sx & 0x01ff; - sy = sy & 0x01ff; + int sx = data2 & 0x01ff; + int sy = data0 & 0x01ff; if (sx >= 256) sx -= 512; if (sy >= 256) sy -= 512; sx = 240 - sx; @@ -92,19 +94,14 @@ void deco_mxc06_device::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cli else mult = -16; - // thedeep strongly suggests that this check goes here, otherwise the radar breaks if (!(spriteram[offs] & 0x8000)) - { - offs += 4; continue; - } - - for (x = 0; x < w; x++) + for (int x = 0; x < w; x++) { // maybe, birdie try appears to specify the base code for each part.. - code = spriteram[offs + 1] & 0x1fff; + u16 code = spriteram[offs + 1] & 0x1fff; code &= ~(h - 1); @@ -117,88 +114,82 @@ void deco_mxc06_device::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cli incy = 1; } - for (y = 0; y < h; y++) + for (int y = 0; y < h; y++) { + if (!flash || (screen.frame_number() & 1)) { - int draw = 0; - if (!flash || (screen().frame_number() & 1)) + if (priority) { - if (m_priority_type == 0) // most cases - { - if ((color & pri_mask) == pri_val) - { - draw = 1; - } - } - else if (m_priority_type == 1) // vaportra - { - if (pri_mask && (color >= pri_val)) - continue; - - if (!pri_mask && !(color >= pri_val)) - continue; - - draw = 1; - } + gfx->prio_transpen(bitmap, cliprect, + code - y * incy, + colour, + flipx, flipy, + sx + (mult * x), sy + (mult * y), screen.priority(), pri_mask, 0); } - - if (draw) + else { - m_gfxdecode->gfx(m_gfxregion)->transpen(bitmap, cliprect, + gfx->transpen(bitmap, cliprect, code - y * incy, - color & col_mask, + colour, flipx, flipy, sx + (mult * x), sy + (mult * y), 0); } } } - - offs += 4; - if (offs >= m_ramsize / 2) - return; - - } } } /* this is used by the automat bootleg, it seems to have greatly simplified sprites compared to the real chip */ /* spriteram is twice the size tho! */ -void deco_mxc06_device::draw_sprites_bootleg( bitmap_ind16 &bitmap, const rectangle &cliprect, uint16_t* spriteram, int pri_mask, int pri_val, int col_mask ) +void deco_mxc06_device::draw_sprites_bootleg(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element *gfx, u16* spriteram, int size) { - int offs; + const bool priority = !m_colpri_cb.isnull(); + int start, end, inc; + if (priority) { start = size - 4; end = -4; inc = -4; } + else { start = 0; end = size; inc = +4; } - offs = 0; - while (offs < m_ramsize / 2) + for (int offs = start; offs != end; offs += inc) { - int sx, sy, code, color, flipx, flipy; - - code = spriteram[offs]; - sy = 240-spriteram[offs + 1]; // 241- will align robocop with the ground but causes other issues too - sx = spriteram[offs + 2]; + u32 pri_mask = 0; + u32 code = spriteram[offs]; + int sy = 240-spriteram[offs + 1]; // 241- will align robocop with the ground but causes other issues too + int sx = spriteram[offs + 2]; code |= (spriteram[offs + 3] &0x0f)<<8; - flipx = !(spriteram[offs + 3] &0x20); - flipy = (spriteram[offs + 3] &0x40); - color = (spriteram[offs + 0x400]&0xf0)>>4; - sx |= (spriteram[offs + 0x400]&0x01)<<8; + const bool flipx = !(spriteram[offs + 3] &0x20); + const bool flipy = (spriteram[offs + 3] &0x40); + u32 colour = (spriteram[offs + 0x400] & 0xf0) >> 4; + if (priority) + m_colpri_cb(colour, pri_mask); + + sx |= (spriteram[offs + 0x400] & 0x01) << 8; sx -= 16; sx &=0x1ff; sx -= 0x100; - m_gfxdecode->gfx(m_gfxregion)->transpen(bitmap,cliprect, - code, - color & col_mask, - flipx,flipy, - sx,sy,0); - - offs += 4; + if (priority) + { + gfx->prio_transpen(bitmap,cliprect, + code, + colour, + flipx,flipy, + sx,sy,screen.priority(),pri_mask,0); + } + else + { + gfx->transpen(bitmap,cliprect, + code, + colour, + flipx,flipy, + sx,sy,0); + } } } void deco_mxc06_device::device_start() { - m_priority_type = 0; + m_colpri_cb.bind_relative_to(*owner()); m_flip_screen = false; save_item(NAME(m_flip_screen)); |