Merge pull request #6380 from cam900/decospr_pri

decospr.cpp : Allow priority/color callback usable with external mixing bit
This commit is contained in:
ajrhacker 2020-03-02 09:20:47 -05:00 committed by GitHub
commit f660c45620
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 25 additions and 16 deletions

View File

@ -874,6 +874,15 @@ DECOSPR_PRIORITY_CB_MEMBER( captaven_state::captaven_pri_callback )
}
}
DECOSPR_PRIORITY_CB_MEMBER( fghthist_state::fghthist_pri_callback )
{
u32 mask = GFX_PMASK_8; // under the text layer
if (extpri)
mask |= GFX_PMASK_4; // under the uppermost playfield
return mask;
}
DECO16IC_BANK_CB_MEMBER( captaven_state::bank_callback )
{
return (bank & 0x20) << 9;
@ -1966,6 +1975,7 @@ void fghthist_state::fghthist(machine_config &config)
DECO_SPRITE(config, m_sprgen[0], 0);
m_sprgen[0]->set_gfx_region(3);
m_sprgen[0]->set_pri_callback(FUNC(fghthist_state::fghthist_pri_callback));
m_sprgen[0]->set_gfxdecode_tag(m_gfxdecode);
DECO146PROT(config, m_ioprot, 0);

View File

@ -153,6 +153,7 @@ private:
u32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
DECO16IC_BANK_CB_MEMBER(bank_callback);
DECOSPR_PRIORITY_CB_MEMBER(fghthist_pri_callback);
void fghthist_map(address_map &map);
void fghthsta_memmap(address_map &map);

View File

@ -112,7 +112,6 @@ void captaven_state::video_start()
void fghthist_state::video_start()
{
m_sprgen[0]->alloc_sprite_bitmap();
deco32_state::allocate_spriteram(0);
deco32_state::allocate_rowscroll(0x2000/4, 0x2000/4, 0x2000/4, 0x2000/4);
deco32_state::allocate_buffered_palette();
@ -219,29 +218,26 @@ u32 fghthist_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, c
m_deco_tilegen[0]->pf_update(m_pf_rowscroll[0].get(), m_pf_rowscroll[1].get());
m_deco_tilegen[1]->pf_update(m_pf_rowscroll[2].get(), m_pf_rowscroll[3].get());
// sprites are flipped relative to tilemaps
m_sprgen[0]->set_flip_screen(true);
m_sprgen[0]->draw_sprites(bitmap, cliprect, m_spriteram16_buffered[0].get(), 0x800);
/* Draw screen */
m_deco_tilegen[1]->tilemap_2_draw(screen, bitmap, cliprect, 0, 1);
if (m_pri & 1)
{
m_deco_tilegen[0]->tilemap_2_draw(screen, bitmap, cliprect, 0, 2);
m_sprgen[0]->inefficient_copy_sprite_bitmap(bitmap, cliprect, 0x0800, 0x0800, 1024, 0x1ff);
m_deco_tilegen[1]->tilemap_1_draw(screen, bitmap, cliprect, 0, 4);
}
else
{
m_deco_tilegen[1]->tilemap_1_draw(screen, bitmap, cliprect, 0, 2);
m_sprgen[0]->inefficient_copy_sprite_bitmap(bitmap, cliprect, 0x0800, 0x0800, 1024, 0x1ff);
m_deco_tilegen[0]->tilemap_2_draw(screen, bitmap, cliprect, 0, 4);
}
m_sprgen[0]->inefficient_copy_sprite_bitmap(bitmap, cliprect, 0x0000, 0x0800, 1024, 0x1ff);
m_deco_tilegen[0]->tilemap_1_draw(screen, bitmap, cliprect, 0, 8);
// sprites are flipped relative to tilemaps
m_sprgen[0]->set_flip_screen(true);
m_sprgen[0]->draw_sprites(bitmap, cliprect, m_spriteram16_buffered[0].get(), 0x800);
m_deco_tilegen[0]->tilemap_1_draw(screen, bitmap, cliprect, 0, 0);
return 0;
}

View File

@ -118,6 +118,8 @@ ssssSSSS pppccccc
s = size (height)
S = size (width)
p = priority
c = colour palette
offs +3
-------- --------
@ -237,7 +239,7 @@ void decospr_device::draw_sprites_common(_BitmapClass &bitmap, const rectangle &
if (!m_sprite_bitmap.valid())
{
colour = m_col_cb(x);
colour = m_col_cb(x, y & 0x8000);
}
else
{
@ -247,7 +249,7 @@ void decospr_device::draw_sprites_common(_BitmapClass &bitmap, const rectangle &
if (!m_pri_cb.isnull())
pri = m_pri_cb(x);
pri = m_pri_cb(x, y & 0x8000);
else
pri = 0;
@ -409,7 +411,7 @@ void decospr_device::draw_sprites_common(_BitmapClass &bitmap, const rectangle &
if (!m_pri_cb.isnull())
pri = m_pri_cb(spriteram[offs+2]&0x00ff);
pri = m_pri_cb(spriteram[offs+2]&0x00ff, false);
else
pri = 0;

View File

@ -5,13 +5,13 @@
#pragma once
typedef device_delegate<uint16_t (uint16_t pri)> decospr_pri_cb_delegate;
typedef device_delegate<uint16_t (uint16_t col)> decospr_col_cb_delegate;
typedef device_delegate<uint16_t (uint16_t pri, bool extpri)> decospr_pri_cb_delegate;
typedef device_delegate<uint16_t (uint16_t col, bool extcol)> decospr_col_cb_delegate;
// function definition for a callback
#define DECOSPR_PRIORITY_CB_MEMBER(_name) uint16_t _name(uint16_t pri)
#define DECOSPR_COLOUR_CB_MEMBER(_name) uint16_t _name(uint16_t col)
#define DECOSPR_PRIORITY_CB_MEMBER(_name) uint16_t _name(uint16_t pri, bool extpri)
#define DECOSPR_COLOUR_CB_MEMBER(_name) uint16_t _name(uint16_t col, bool extcol)
class decospr_device : public device_t, public device_video_interface