summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/video/darius.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/video/darius.cpp')
-rw-r--r--src/mame/video/darius.cpp73
1 files changed, 36 insertions, 37 deletions
diff --git a/src/mame/video/darius.cpp b/src/mame/video/darius.cpp
index e3858c189ce..f48b1cc490b 100644
--- a/src/mame/video/darius.cpp
+++ b/src/mame/video/darius.cpp
@@ -2,13 +2,14 @@
// copyright-holders:David Graves, Jarek Burczynski
#include "emu.h"
#include "includes/darius.h"
+#include "screen.h"
/***************************************************************************/
TILE_GET_INFO_MEMBER(darius_state::get_fg_tile_info)
{
- uint16_t code = (m_fg_ram[tile_index + 0x2000] & 0x7ff);
- uint16_t attr = m_fg_ram[tile_index];
+ u16 code = (m_fg_ram[tile_index + 0x2000] & 0x7ff);
+ u16 attr = m_fg_ram[tile_index];
SET_TILE_INFO_MEMBER(2,
code,
@@ -28,7 +29,7 @@ void darius_state::video_start()
/***************************************************************************/
-WRITE16_MEMBER(darius_state::darius_fg_layer_w)
+void darius_state::fg_layer_w(offs_t offset, u16 data, u16 mem_mask)
{
COMBINE_DATA(&m_fg_ram[offset]);
if (offset < 0x4000)
@@ -37,65 +38,63 @@ WRITE16_MEMBER(darius_state::darius_fg_layer_w)
/***************************************************************************/
-void darius_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int primask, int x_offs, int y_offs )
+void darius_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int x_offs, int y_offs)
{
- uint16_t *spriteram = m_spriteram;
- int offs, curx, cury;
- uint16_t code, data, sx, sy;
- uint8_t flipx, flipy, color, priority;
+ static const u32 primask[2] =
+ {
+ GFX_PMASK_2, // draw sprites with priority 0 which are under the mid layer
+ 0 // draw sprites with priority 1 which are over the mid layer
+ };
- for (offs = m_spriteram.bytes() / 2 - 4; offs >= 0; offs -= 4)
+ for (int offs = 0; offs < m_spriteram.bytes() / 2; offs += 4)
{
- code = spriteram[offs + 2] & 0x1fff;
+ const u32 code = m_spriteram[offs + 2] & 0x1fff;
if (code)
{
- data = spriteram[offs];
- sy = (256 - data) & 0x1ff;
+ u16 data = m_spriteram[offs];
+ const int sy = (256 - data) & 0x1ff;
- data = spriteram[offs + 1];
- sx = data & 0x3ff;
+ data = m_spriteram[offs + 1];
+ const int sx = data & 0x3ff;
- data = spriteram[offs + 2];
- flipx = ((data & 0x4000) >> 14);
- flipy = ((data & 0x8000) >> 15);
+ data = m_spriteram[offs + 2];
+ const bool flipx = ((data & 0x4000) >> 14);
+ const bool flipy = ((data & 0x8000) >> 15);
- data = spriteram[offs + 3];
- priority = (data & 0x80) >> 7; // 0 = low
- if (priority != primask)
- continue;
- color = (data & 0x7f);
+ data = m_spriteram[offs + 3];
+ const int priority = (data & 0x80) >> 7; // 0 = low
+ const u32 color = (data & 0x7f);
- curx = sx - x_offs;
- cury = sy + y_offs;
+ int curx = sx - x_offs;
+ int cury = sy + y_offs;
if (curx > 900) curx -= 1024;
if (cury > 400) cury -= 512;
- m_gfxdecode->gfx(0)->transpen(bitmap,cliprect,
+ m_gfxdecode->gfx(0)->prio_transpen(bitmap,cliprect,
code, color,
flipx, flipy,
- curx, cury, 0);
+ curx, cury,
+ screen.priority(), primask[priority], 0);
}
}
}
-
-uint32_t darius_state::update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int xoffs)
+u32 darius_state::update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int xoffs)
{
+ screen.priority().fill(0, cliprect);
m_pc080sn->tilemap_update();
// draw bottom layer(always active)
- m_pc080sn->tilemap_draw_offset(screen, bitmap, cliprect, 0, TILEMAP_DRAW_OPAQUE, 0, -xoffs, 0);
-
- /* Sprites can be under/over the layer below text layer */
- draw_sprites(bitmap, cliprect, 0, xoffs, -8); // draw sprites with priority 0 which are under the mid layer
+ m_pc080sn->tilemap_draw_offset(screen, bitmap, cliprect, 0, TILEMAP_DRAW_OPAQUE, 1, -xoffs, 0);
// draw middle layer
- m_pc080sn->tilemap_draw_offset(screen, bitmap, cliprect, 1, 0, 0, -xoffs, 0);
+ m_pc080sn->tilemap_draw_offset(screen, bitmap, cliprect, 1, 0, 2, -xoffs, 0);
- draw_sprites(bitmap, cliprect, 1, xoffs, -8); // draw sprites with priority 1 which are over the mid layer
+ /* Sprites can be under/over the layer below text layer */
+ draw_sprites(screen, bitmap, cliprect, xoffs, -8);
/* top(text) layer is in fixed position */
m_fg_tilemap->set_scrollx(0, 0 + xoffs);
@@ -104,6 +103,6 @@ uint32_t darius_state::update_screen(screen_device &screen, bitmap_ind16 &bitmap
return 0;
}
-uint32_t darius_state::screen_update_darius_left(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect){ return update_screen(screen, bitmap, cliprect, 36 * 8 * 0); }
-uint32_t darius_state::screen_update_darius_middle(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect){ return update_screen(screen, bitmap, cliprect, 36 * 8 * 1); }
-uint32_t darius_state::screen_update_darius_right(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect){ return update_screen(screen, bitmap, cliprect, 36 * 8 * 2); }
+u32 darius_state::screen_update_left(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect){ return update_screen(screen, bitmap, cliprect, 36 * 8 * 0); }
+u32 darius_state::screen_update_middle(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect){ return update_screen(screen, bitmap, cliprect, 36 * 8 * 1); }
+u32 darius_state::screen_update_right(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect){ return update_screen(screen, bitmap, cliprect, 36 * 8 * 2); }