Merge pull request #5177 from cam900/taito_f2_gfx

tc0280grd.cpp : Internalize gfxdecode, Allow masked priority
This commit is contained in:
R. Belmont 2019-06-08 15:01:27 -04:00 committed by GitHub
commit 3d3518abb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 384 additions and 415 deletions

File diff suppressed because it is too large Load Diff

View File

@ -199,7 +199,7 @@ protected:
void sprite_extension_w(offs_t offset, u16 data, u16 mem_mask = ~0);
void spritebank_w(offs_t offset, u16 data);
void koshien_spritebank_w(u16 data);
DECLARE_WRITE8_MEMBER(cameltrya_porta_w);
void cameltrya_porta_w(u8 data);
void mjnquest_gfxbank_w(u8 data);
TC0100SCN_CB_MEMBER(mjnquest_tmap_cb);
@ -247,7 +247,7 @@ protected:
void update_spritebanks();
void handle_sprite_buffering();
void update_sprites_active_area();
void draw_roz_layer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, u32 priority);
void draw_roz_layer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, u8 priority, u8 priority_mask = 0xff);
void taito_f2_tc360_spritemixdraw(screen_device &screen, bitmap_ind16 &dest_bmp, const rectangle &clip, gfx_element *gfx,
u32 code, u32 color, int flipx, int flipy, int sx, int sy, int scalex, int scaley);

View File

@ -696,7 +696,7 @@ void taitof2_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, co
if (m_sprite_type == 0)
{
code = m_spriteram_buffered[(offs) / 2] & 0x1fff;
u32 i = (code & 0x1c00) >> 10;
const u32 i = (code & 0x1c00) >> 10;
code = m_spritebank[i] + (code & 0x3ff);
}
@ -1033,13 +1033,13 @@ u32 taitof2_state::screen_update_pri(screen_device &screen, bitmap_ind16 &bitmap
void taitof2_state::draw_roz_layer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, u32 priority)
void taitof2_state::draw_roz_layer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, u8 priority, u8 priority_mask)
{
if (m_tc0280grd != nullptr)
m_tc0280grd->tc0280grd_zoom_draw(screen, bitmap, cliprect, m_pivot_xdisp, m_pivot_ydisp, priority);
m_tc0280grd->tc0280grd_zoom_draw(screen, bitmap, cliprect, m_pivot_xdisp, m_pivot_ydisp, priority, priority_mask);
if (m_tc0430grw != nullptr)
m_tc0430grw->tc0430grw_zoom_draw(screen, bitmap, cliprect, m_pivot_xdisp, m_pivot_ydisp, priority);
m_tc0430grw->tc0430grw_zoom_draw(screen, bitmap, cliprect, m_pivot_xdisp, m_pivot_ydisp, priority, priority_mask);
}
u32 taitof2_state::screen_update_pri_roz(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
@ -1105,7 +1105,6 @@ u32 taitof2_state::screen_update_pri_roz(screen_device &screen, bitmap_ind16 &bi
}
/* Thunderfox */
u32 taitof2_state::screen_update_thundfox(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
@ -1207,7 +1206,6 @@ u32 taitof2_state::screen_update_thundfox(screen_device &screen, bitmap_ind16 &b
}
/*********************************************************************
Deadconx and Footchmp use in the PRI chip

View File

@ -31,23 +31,35 @@ DEFINE_DEVICE_TYPE(TC0280GRD, tc0280grd_device, "tc0280grd", "Taito TC0280GRD /
tc0280grd_device::tc0280grd_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: device_t(mconfig, TC0280GRD, tag, owner, clock)
, device_gfx_interface(mconfig, *this)
, m_ram(nullptr)
, m_base_color(0)
, m_gfxdecode(*this, finder_base::DUMMY_TAG)
, m_colorbase(0)
{
std::fill(std::begin(m_ctrl), std::end(m_ctrl), 0);
}
/*************************************
*
* Graphics definitions
*
*************************************/
GFXDECODE_MEMBER(tc0280grd_device::gfxinfo)
GFXDECODE_DEVICE(DEVICE_SELF, 0, gfx_8x8x4_packed_msb, 0, 256)
GFXDECODE_END
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void tc0280grd_device::device_start()
{
if(!m_gfxdecode->started())
throw device_missing_dependencies();
// decode our graphics
decode_gfx(gfxinfo);
gfx(0)->set_colorbase(m_colorbase);
m_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(tc0280grd_device::get_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 64);
m_tilemap = &machine().tilemap().create(*this, tilemap_get_info_delegate(FUNC(tc0280grd_device::get_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 64);
m_tilemap->set_transparent_pen(0);
m_ram = make_unique_clear<u16[]>(TC0280GRD_RAM_SIZE / 2);
@ -62,8 +74,7 @@ void tc0280grd_device::device_start()
void tc0280grd_device::device_reset()
{
for (int i = 0; i < 8; i++)
m_ctrl[i] = 0;
std::fill(std::begin(m_ctrl), std::end(m_ctrl), 0);
}
/*****************************************************************************
@ -73,7 +84,7 @@ void tc0280grd_device::device_reset()
TILE_GET_INFO_MEMBER(tc0280grd_device::get_tile_info)
{
int attr = m_ram[tile_index];
SET_TILE_INFO_MEMBER(m_gfxnum,
SET_TILE_INFO_MEMBER(0,
attr & 0x3fff,
((attr & 0xc000) >> 14) + m_base_color,
0);
@ -124,7 +135,7 @@ void tc0280grd_device::tc0430grw_tilemap_update(int base_color)
tc0280grd_tilemap_update(base_color);
}
void tc0280grd_device::zoom_draw(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int xoffset, int yoffset, u32 priority, int xmultiply)
void tc0280grd_device::zoom_draw(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int xoffset, int yoffset, u8 priority, int xmultiply, u8 priority_mask)
{
/* 24-bit signed */
u32 startx = ((m_ctrl[0] & 0xff) << 16) + m_ctrl[1];
@ -152,15 +163,15 @@ void tc0280grd_device::zoom_draw(screen_device &screen, bitmap_ind16 &bitmap, co
m_tilemap->draw_roz(screen, bitmap, cliprect, startx << 4, starty << 4,
incxx << 4, incxy << 4, incyx << 4, incyy << 4,
1, /* copy with wraparound */
0, priority);
0, priority, priority_mask);
}
void tc0280grd_device::tc0280grd_zoom_draw(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int xoffset, int yoffset, u32 priority)
void tc0280grd_device::tc0280grd_zoom_draw(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int xoffset, int yoffset, u8 priority, u8 priority_mask)
{
zoom_draw(screen, bitmap, cliprect, xoffset, yoffset, priority, 2);
zoom_draw(screen, bitmap, cliprect, xoffset, yoffset, priority, 2, priority_mask);
}
void tc0280grd_device::tc0430grw_zoom_draw(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int xoffset, int yoffset, u32 priority)
void tc0280grd_device::tc0430grw_zoom_draw(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int xoffset, int yoffset, u8 priority, u8 priority_mask)
{
zoom_draw(screen, bitmap, cliprect, xoffset, yoffset, priority, 1);
zoom_draw(screen, bitmap, cliprect, xoffset, yoffset, priority, 1, priority_mask);
}

View File

@ -5,26 +5,25 @@
#pragma once
class tc0280grd_device : public device_t
class tc0280grd_device : public device_t, public device_gfx_interface
{
public:
tc0280grd_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
// configuration
template <typename T> void set_gfxdecode_tag(T &&tag) { m_gfxdecode.set_tag(std::forward<T>(tag)); }
void set_gfx_region(int gfxregion) { m_gfxnum = gfxregion; }
void set_color_base(u16 base) { m_colorbase = base; }
u16 tc0280grd_word_r(offs_t offset);
void tc0280grd_word_w(offs_t offset, u16 data, u16 mem_mask = ~0);
void tc0280grd_ctrl_word_w(offs_t offset, u16 data, u16 mem_mask = ~0);
void tc0280grd_tilemap_update(int base_color);
void tc0280grd_zoom_draw(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int xoffset, int yoffset, u32 priority);
void tc0280grd_zoom_draw(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int xoffset, int yoffset, u8 priority, u8 priority_mask = 0xff);
u16 tc0430grw_word_r(offs_t offset);
void tc0430grw_word_w(offs_t offset, u16 data, u16 mem_mask = ~0);
void tc0430grw_ctrl_word_w(offs_t offset, u16 data, u16 mem_mask = ~0);
void tc0430grw_tilemap_update(int base_color);
void tc0430grw_zoom_draw(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int xoffset, int yoffset, u32 priority);
void tc0430grw_zoom_draw(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int xoffset, int yoffset, u8 priority, u8 priority_mask = 0xff);
protected:
// device-level overrides
@ -39,11 +38,13 @@ private:
u16 m_ctrl[8];
int m_base_color;
int m_gfxnum;
required_device<gfxdecode_device> m_gfxdecode;
// decoding info
DECLARE_GFXDECODE_MEMBER(gfxinfo);
u16 m_colorbase;
TILE_GET_INFO_MEMBER(get_tile_info);
void zoom_draw(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int xoffset, int yoffset, u32 priority, int xmultiply);
void zoom_draw(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int xoffset, int yoffset, u8 priority, int xmultiply, u8 priority_mask = 0xff);
};
DECLARE_DEVICE_TYPE(TC0280GRD, tc0280grd_device)