summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author cam900 <dbtlrchl@naver.com>2020-03-30 02:51:58 +0900
committer cam900 <dbtlrchl@naver.com>2020-03-30 02:51:58 +0900
commit1e065e4ec62b159676b9e6ff4b902c5f252a886e (patch)
treeb5c58f8091f4b996d6227d1ce84cbe90ce6922b7
parent2f8be19d90d04fa500732c08c102b3b1b61f66a7 (diff)
decbac06.cpp : Fix flagsmap handling, Reduce unnecessary values
-rw-r--r--src/mame/video/decbac06.cpp67
-rw-r--r--src/mame/video/decbac06.h13
2 files changed, 32 insertions, 48 deletions
diff --git a/src/mame/video/decbac06.cpp b/src/mame/video/decbac06.cpp
index c575ba10bda..84e6f19be1f 100644
--- a/src/mame/video/decbac06.cpp
+++ b/src/mame/video/decbac06.cpp
@@ -90,10 +90,6 @@ deco_bac06_device::deco_bac06_device(const machine_config &mconfig, const char *
, m_gfxregion8x8(0)
, m_gfxregion16x16(0)
, m_wide(0)
- , m_bppmult_8x8(0)
- , m_bppmask_8x8(0)
- , m_bppmult_16x16(0)
- , m_bppmask_16x16(0)
, m_gfxdecode(*this, finder_base::DUMMY_TAG)
, m_thedeep_kludge(0)
{
@@ -113,12 +109,6 @@ void deco_bac06_device::device_start()
create_tilemaps(m_gfxregion8x8, m_gfxregion16x16);
m_gfxcolmask = 0x0f;
- m_bppmult_8x8 = m_gfxdecode->gfx(m_gfxregion8x8)->granularity();
- m_bppmask_8x8 = m_gfxdecode->gfx(m_gfxregion8x8)->depth() - 1;
-
- m_bppmult_16x16 = m_gfxdecode->gfx(m_gfxregion16x16)->granularity();
- m_bppmask_16x16 = m_gfxdecode->gfx(m_gfxregion16x16)->depth() - 1;
-
m_rambank = 0;
m_flip_screen = false;
@@ -199,8 +189,8 @@ TILE_GET_INFO_MEMBER(deco_bac06_device::get_pf8x8_tile_info)
if (m_rambank & 1) tile_index += 0x1000;
int tile = m_pf_data[tile_index];
int colourpri = (tile >> 12);
- int flags = (m_pf_control_0[0] & 2) ? 0 : TILE_FLIPX;
- tileinfo.set(m_tile_region_8,tile & 0xfff,0,flags);
+ u32 flags = (m_pf_control_0[0] & 2) ? 0 : TILE_FLIPX;
+ tileinfo.set(m_tile_region_8,tile & 0xfff,colourpri,flags);
tileinfo.category = colourpri;
}
@@ -209,8 +199,8 @@ TILE_GET_INFO_MEMBER(deco_bac06_device::get_pf16x16_tile_info)
if (m_rambank & 1) tile_index += 0x1000;
int tile = m_pf_data[tile_index];
int colourpri = (tile >> 12);
- int flags = (BIT(m_pf_control_0[0], 1) ^ m_thedeep_kludge) ? 0 : TILE_FLIPX;
- tileinfo.set(m_tile_region_16,tile & 0xfff,0,flags);
+ u32 flags = (BIT(m_pf_control_0[0], 1) ^ m_thedeep_kludge) ? 0 : TILE_FLIPX;
+ tileinfo.set(m_tile_region_16,tile & 0xfff,colourpri,flags);
tileinfo.category = colourpri;
}
@@ -223,6 +213,10 @@ void deco_bac06_device::create_tilemaps(int region8x8, int region16x16)
m_pf8x8_tilemap[1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(deco_bac06_device::get_pf8x8_tile_info)), tilemap_mapper_delegate(*this, FUNC(deco_bac06_device::tile_shape1_8x8_scan)), 8, 8, 64, 64);
m_pf8x8_tilemap[2] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(deco_bac06_device::get_pf8x8_tile_info)), tilemap_mapper_delegate(*this, FUNC(deco_bac06_device::tile_shape2_8x8_scan)), 8, 8, 32, 128);
+ m_pf8x8_tilemap[0]->set_transparent_pen(0);
+ m_pf8x8_tilemap[1]->set_transparent_pen(0);
+ m_pf8x8_tilemap[2]->set_transparent_pen(0);
+
if (m_wide == 2)
{
m_pf16x16_tilemap[0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(deco_bac06_device::get_pf16x16_tile_info)), tilemap_mapper_delegate(*this, FUNC(deco_bac06_device::tile_shape0_scan)), 16, 16, 256, 16);
@@ -241,6 +235,10 @@ void deco_bac06_device::create_tilemaps(int region8x8, int region16x16)
m_pf16x16_tilemap[1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(deco_bac06_device::get_pf16x16_tile_info)), tilemap_mapper_delegate(*this, FUNC(deco_bac06_device::tile_shape1_scan)), 16, 16, 32, 32);
m_pf16x16_tilemap[2] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(deco_bac06_device::get_pf16x16_tile_info)), tilemap_mapper_delegate(*this, FUNC(deco_bac06_device::tile_shape2_scan)), 16, 16, 16, 64);
}
+
+ m_pf16x16_tilemap[0]->set_transparent_pen(0);
+ m_pf16x16_tilemap[1]->set_transparent_pen(0);
+ m_pf16x16_tilemap[2]->set_transparent_pen(0);
}
void deco_bac06_device::custom_tilemap_draw(bitmap_ind16 &bitmap,
@@ -251,13 +249,11 @@ void deco_bac06_device::custom_tilemap_draw(bitmap_ind16 &bitmap,
const u16 *colscroll_ptr,
const u16 *control0,
const u16 *control1,
- int flags,
+ u32 flags,
u16 penmask,
u16 pencondition,
u16 colprimask,
u16 colpricondition,
- u8 bppmult,
- u8 bppmask,
u8 pri,
u8 pmask)
{
@@ -291,6 +287,10 @@ void deco_bac06_device::custom_tilemap_draw(bitmap_ind16 &bitmap,
const int width_mask = src_bitmap.width() - 1;
const int height_mask = src_bitmap.height() - 1;
+ // initialize draw layer flags
+ if ((flags & (TILEMAP_DRAW_LAYER0 | TILEMAP_DRAW_LAYER1 | TILEMAP_DRAW_LAYER2)) == 0)
+ flags |= TILEMAP_DRAW_LAYER0;
+
/* Column scroll & row scroll may per applied per pixel, there are
shift registers for each which control the granularity of the row/col
offset (down to per line level for row, and per 8 lines for column).
@@ -334,15 +334,20 @@ void deco_bac06_device::custom_tilemap_draw(bitmap_ind16 &bitmap,
column_offset=colscroll_ptr[((src_x >> 3) >> (control1[2] & 0xf)) & (0x3f >> (control1[2] & 0xf))];
const u16 p = src_bitmap.pix16((src_y + column_offset) & height_mask, src_x & width_mask);
- const u8 colpri = flags_bitmap.pix8((src_y + column_offset) & height_mask, src_x & width_mask) & 0xf;
+ const u8 colpri = flags_bitmap.pix8((src_y + column_offset) & height_mask, src_x & width_mask);
+
+ const bool is_drawed = ((flags & TILEMAP_DRAW_OPAQUE) ||
+ ((colpri & TILEMAP_PIXEL_LAYER0) && (flags & TILEMAP_DRAW_LAYER0)) ||
+ ((colpri & TILEMAP_PIXEL_LAYER1) && (flags & TILEMAP_DRAW_LAYER1)) ||
+ ((colpri & TILEMAP_PIXEL_LAYER2) && (flags & TILEMAP_DRAW_LAYER2)));
src_x++;
- if ((flags & TILEMAP_DRAW_OPAQUE) || (p & bppmask))
+ if (is_drawed)
{
if ((p & penmask) == pencondition)
if((colpri & colprimask) == colpricondition)
{
- dstpix[x] = p + (colpri & m_gfxcolmask) * bppmult;
+ dstpix[x] = p;
dstpri[x] = (dstpri[x] & pmask) | pri;
}
}
@@ -351,10 +356,9 @@ void deco_bac06_device::custom_tilemap_draw(bitmap_ind16 &bitmap,
}
}
-void deco_bac06_device::deco_bac06_pf_draw(screen_device &screen,bitmap_ind16 &bitmap,const rectangle &cliprect,int flags,u16 penmask, u16 pencondition,u16 colprimask, u16 colpricondition, u8 pri, u8 primask)
+void deco_bac06_device::deco_bac06_pf_draw(screen_device &screen,bitmap_ind16 &bitmap,const rectangle &cliprect,u32 flags,u16 penmask, u16 pencondition,u16 colprimask, u16 colpricondition, u8 pri, u8 primask)
{
tilemap_t* tm = nullptr;
- u8 bppmult = 0, bppmask = 0;
int tm_dimensions = m_pf_control_0[3] & 0x3;
if (tm_dimensions == 3) tm_dimensions = 1; // 3 is invalid / the same as 1?
@@ -364,14 +368,10 @@ void deco_bac06_device::deco_bac06_pf_draw(screen_device &screen,bitmap_ind16 &b
if (m_supports_8x8)
{
tm = m_pf8x8_tilemap[tm_dimensions];
- bppmult = m_bppmult_8x8;
- bppmask = m_bppmask_8x8;
}
else if (m_supports_16x16)
{
tm = m_pf16x16_tilemap[tm_dimensions];
- bppmult = m_bppmult_16x16;
- bppmask = m_bppmask_16x16;
}
}
else // 16x16 tiles mode is selected
@@ -379,40 +379,31 @@ void deco_bac06_device::deco_bac06_pf_draw(screen_device &screen,bitmap_ind16 &b
if (m_supports_16x16)
{
tm = m_pf16x16_tilemap[tm_dimensions];
- bppmult = m_bppmult_16x16;
- bppmask = m_bppmask_16x16;
}
else if (m_supports_8x8)
{
tm = m_pf8x8_tilemap[tm_dimensions];
- bppmult = m_bppmult_8x8;
- bppmask = m_bppmask_8x8;
}
}
if (tm)
- custom_tilemap_draw(bitmap,screen.priority(),cliprect,tm,m_pf_rowscroll.get(),m_pf_colscroll.get(),m_pf_control_0,m_pf_control_1,flags, penmask, pencondition, colprimask, colpricondition, bppmult, bppmask, pri, primask);
+ custom_tilemap_draw(bitmap,screen.priority(),cliprect,tm,m_pf_rowscroll.get(),m_pf_colscroll.get(),m_pf_control_0,m_pf_control_1,flags, penmask, pencondition, colprimask, colpricondition, pri, primask);
}
// used for pocket gal bootleg, which doesn't set registers properly and simply expects a fixed size tilemap.
-void deco_bac06_device::deco_bac06_pf_draw_bootleg(screen_device &screen,bitmap_ind16 &bitmap,const rectangle &cliprect,int flags, int mode, int type, u8 pri, u8 primask)
+void deco_bac06_device::deco_bac06_pf_draw_bootleg(screen_device &screen,bitmap_ind16 &bitmap,const rectangle &cliprect,u32 flags, int mode, int type, u8 pri, u8 primask)
{
tilemap_t* tm = nullptr;
- u8 bppmult, bppmask;
if (!mode)
{
tm = m_pf8x8_tilemap[type];
- bppmult = m_bppmult_8x8;
- bppmask = m_bppmask_8x8;
}
else
{
tm = m_pf16x16_tilemap[type];
- bppmult = m_bppmult_16x16;
- bppmask = m_bppmask_16x16;
}
- custom_tilemap_draw(bitmap,screen.priority(),cliprect,tm,m_pf_rowscroll.get(),m_pf_colscroll.get(),nullptr,nullptr,flags, 0, 0, 0, 0, bppmult, bppmask, pri, primask);
+ custom_tilemap_draw(bitmap,screen.priority(),cliprect,tm,m_pf_rowscroll.get(),m_pf_colscroll.get(),nullptr,nullptr,flags, 0, 0, 0, 0, pri, primask);
}
diff --git a/src/mame/video/decbac06.h b/src/mame/video/decbac06.h
index 9607daea8bb..8029343fa78 100644
--- a/src/mame/video/decbac06.h
+++ b/src/mame/video/decbac06.h
@@ -45,8 +45,8 @@ public:
u16 m_pf_control_0[8];
u16 m_pf_control_1[8];
- void deco_bac06_pf_draw(screen_device &screen,bitmap_ind16 &bitmap,const rectangle &cliprect,int flags,u16 penmask, u16 pencondition,u16 colprimask, u16 colpricondition, u8 pri = 0, u8 primask = 0xff);
- void deco_bac06_pf_draw_bootleg(screen_device &screen,bitmap_ind16 &bitmap,const rectangle &cliprect,int flags, int mode, int type, u8 pri = 0, u8 primask = 0xff);
+ void deco_bac06_pf_draw(screen_device &screen,bitmap_ind16 &bitmap,const rectangle &cliprect,u32 flags,u16 penmask, u16 pencondition,u16 colprimask, u16 colpricondition, u8 pri = 0, u8 primask = 0xff);
+ void deco_bac06_pf_draw_bootleg(screen_device &screen,bitmap_ind16 &bitmap,const rectangle &cliprect,u32 flags, int mode, int type, u8 pri = 0, u8 primask = 0xff);
/* I wonder if pf_control_0 is really registers, or a selection of pins.
@@ -114,12 +114,6 @@ protected:
u8 m_gfxregion16x16;
int m_wide;
- u8 m_bppmult_8x8;
- u8 m_bppmask_8x8;
-
- u8 m_bppmult_16x16;
- u8 m_bppmask_16x16;
-
void custom_tilemap_draw(bitmap_ind16 &bitmap,
bitmap_ind8 &primap,
const rectangle &cliprect,
@@ -128,9 +122,8 @@ protected:
const u16 *colscroll_ptr,
const u16 *control0,
const u16 *control1,
- int flags,
+ u32 flags,
u16 penmask, u16 pencondition,u16 colprimask, u16 colpricondition,
- u8 bppmult, u8 bppmask,
u8 pri = 0, u8 pmask = 0xff);
private: