mirror of
https://github.com/holub/mame
synced 2025-04-23 00:39:36 +03:00
work in progress (nw)
This commit is contained in:
parent
773ccd25e8
commit
6819179b10
@ -2146,7 +2146,7 @@ static MACHINE_CONFIG_START( lockload, dragngun_state )
|
||||
MCFG_DEVICE_ADD("spritegen_zoom", DECO_ZOOMSPR, 0)
|
||||
MCFG_DECO_ZOOMSPR_GFXDECODE("gfxdecode")
|
||||
MCFG_DECO_ZOOMSPR_PALETTE("palette")
|
||||
|
||||
|
||||
MCFG_DECO146_ADD("ioprot")
|
||||
MCFG_DECO146_SET_SOUNDLATCH_CALLBACK(deco32_state, deco32_sound_cb)
|
||||
MCFG_DECO146_SET_INTERFACE_SCRAMBLE_REVERSE
|
||||
|
@ -214,4 +214,7 @@ public:
|
||||
|
||||
DECO16IC_BANK_CB_MEMBER(bank_1_callback);
|
||||
DECO16IC_BANK_CB_MEMBER(bank_2_callback);
|
||||
|
||||
bitmap_rgb32 m_temp_render_bitmap;
|
||||
|
||||
};
|
||||
|
@ -159,10 +159,15 @@ VIDEO_START_MEMBER(dragngun_state,dragngun)
|
||||
{
|
||||
m_dirty_palette = auto_alloc_array(machine(), UINT8, 4096);
|
||||
|
||||
|
||||
m_screen->register_screen_bitmap(m_temp_render_bitmap);
|
||||
|
||||
memset(m_dirty_palette,0,4096);
|
||||
|
||||
save_item(NAME(m_dragngun_sprite_ctrl));
|
||||
m_has_ace_ram=0;
|
||||
|
||||
|
||||
}
|
||||
|
||||
VIDEO_START_MEMBER(dragngun_state,lockload)
|
||||
@ -237,6 +242,7 @@ UINT32 deco32_state::screen_update_captaven(screen_device &screen, bitmap_ind16
|
||||
|
||||
UINT32 dragngun_state::screen_update_dragngun(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
screen.priority().fill(0, cliprect);
|
||||
bitmap.fill(m_palette->black_pen(), cliprect);
|
||||
|
||||
m_deco_tilegen1->pf_update(m_pf1_rowscroll, m_pf2_rowscroll);
|
||||
@ -244,9 +250,10 @@ UINT32 dragngun_state::screen_update_dragngun(screen_device &screen, bitmap_rgb3
|
||||
|
||||
//m_deco_tilegen1->set_pf3_8bpp_mode(1); // despite being 8bpp this doesn't require the same shifting as captaven, why not?
|
||||
|
||||
m_deco_tilegen2->tilemap_2_draw(screen, bitmap, cliprect, 0, 0); // it uses pf3 in 8bpp mode instead, like captaven
|
||||
m_deco_tilegen2->tilemap_1_draw(screen, bitmap, cliprect, 0, 0);
|
||||
m_deco_tilegen1->tilemap_2_draw(screen, bitmap, cliprect, 0, 0);
|
||||
m_deco_tilegen2->tilemap_2_draw(screen, bitmap, cliprect, 0, 1); // it uses pf3 in 8bpp mode instead, like captaven
|
||||
m_deco_tilegen2->tilemap_1_draw(screen, bitmap, cliprect, 0, 2);
|
||||
m_deco_tilegen1->tilemap_2_draw(screen, bitmap, cliprect, 0, 4);
|
||||
m_deco_tilegen1->tilemap_1_draw(screen, bitmap, cliprect, 0, 8);
|
||||
|
||||
// zooming sprite draw is very slow, and sprites are buffered.. however, one of the levels attempts to use
|
||||
// partial updates for every line, which causes things to be very slow... the sprites appear to support
|
||||
@ -259,8 +266,7 @@ UINT32 dragngun_state::screen_update_dragngun(screen_device &screen, bitmap_rgb3
|
||||
{
|
||||
rectangle clip(cliprect.min_x, cliprect.max_x, 8, 247);
|
||||
|
||||
m_sprgenzoom->dragngun_draw_sprites(bitmap,clip,m_spriteram->buffer(), m_dragngun_sprite_layout_0_ram, m_dragngun_sprite_layout_1_ram, m_dragngun_sprite_lookup_0_ram, m_dragngun_sprite_lookup_1_ram, m_dragngun_sprite_ctrl );
|
||||
m_deco_tilegen1->tilemap_1_draw(screen, bitmap, clip, 0, 0);
|
||||
m_sprgenzoom->dragngun_draw_sprites(bitmap,clip,m_spriteram->buffer(), m_dragngun_sprite_layout_0_ram, m_dragngun_sprite_layout_1_ram, m_dragngun_sprite_lookup_0_ram, m_dragngun_sprite_lookup_1_ram, m_dragngun_sprite_ctrl, screen.priority(), m_temp_render_bitmap );
|
||||
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,9 @@ inline void deco_zoomspr_device::dragngun_drawgfxzoom(
|
||||
bitmap_rgb32 &dest_bmp,const rectangle &clip,gfx_element *gfx,
|
||||
UINT32 code,UINT32 color,int flipx,int flipy,int sx,int sy,
|
||||
int transparent_color,
|
||||
int scalex, int scaley,bitmap_ind8 *pri_buffer,UINT32 pri_mask, int sprite_screen_width, int sprite_screen_height, UINT8 alpha )
|
||||
int scalex, int scaley,bitmap_ind8 *pri_buffer,UINT32 pri_mask, int sprite_screen_width, int sprite_screen_height, UINT8 alpha,
|
||||
bitmap_ind8 &pri_bitmap, bitmap_rgb32 &temp_bitmap,
|
||||
int priority)
|
||||
{
|
||||
rectangle myclip;
|
||||
|
||||
@ -66,7 +68,7 @@ inline void deco_zoomspr_device::dragngun_drawgfxzoom(
|
||||
|
||||
/* KW 991012 -- Added code to force clip to bitmap boundary */
|
||||
myclip = clip;
|
||||
myclip &= dest_bmp.cliprect();
|
||||
myclip &= temp_bitmap.cliprect();
|
||||
|
||||
{
|
||||
if( gfx )
|
||||
@ -137,42 +139,31 @@ inline void deco_zoomspr_device::dragngun_drawgfxzoom(
|
||||
/* case 1: no alpha */
|
||||
if (alpha == 0xff)
|
||||
{
|
||||
if (pri_buffer)
|
||||
{
|
||||
for( y=sy; y<ey; y++ )
|
||||
{
|
||||
const UINT8 *source = code_base + (y_index>>16) * gfx->rowbytes();
|
||||
UINT32 *dest = &dest_bmp.pix32(y);
|
||||
UINT8 *pri = &pri_buffer->pix8(y);
|
||||
UINT32 *dest = &temp_bitmap.pix32(y);
|
||||
UINT8 *pri = &pri_bitmap.pix8(y);
|
||||
|
||||
|
||||
int x, x_index = x_index_base;
|
||||
for( x=sx; x<ex; x++ )
|
||||
{
|
||||
int c = source[x_index>>16];
|
||||
if( c != transparent_color )
|
||||
if (c != transparent_color)
|
||||
{
|
||||
if (((1 << pri[x]) & pri_mask) == 0)
|
||||
if (priority >= pri[x])
|
||||
{
|
||||
dest[x] = pal[c];
|
||||
pri[x] = 31;
|
||||
dest[x] |= 0xff000000;
|
||||
}
|
||||
else // sprites can have a 'masking' effect on other sprites
|
||||
{
|
||||
dest[x] = 0x00000000;
|
||||
}
|
||||
}
|
||||
x_index += dx;
|
||||
}
|
||||
|
||||
y_index += dy;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for( y=sy; y<ey; y++ )
|
||||
{
|
||||
const UINT8 *source = code_base + (y_index>>16) * gfx->rowbytes();
|
||||
UINT32 *dest = &dest_bmp.pix32(y);
|
||||
|
||||
int x, x_index = x_index_base;
|
||||
for( x=sx; x<ex; x++ )
|
||||
{
|
||||
int c = source[x_index>>16];
|
||||
if( c != transparent_color ) dest[x] = pal[c];
|
||||
x_index += dx;
|
||||
}
|
||||
|
||||
@ -184,42 +175,36 @@ inline void deco_zoomspr_device::dragngun_drawgfxzoom(
|
||||
/* alpha-blended */
|
||||
else
|
||||
{
|
||||
if (pri_buffer)
|
||||
{
|
||||
for( y=sy; y<ey; y++ )
|
||||
{
|
||||
const UINT8 *source = code_base + (y_index>>16) * gfx->rowbytes();
|
||||
UINT32 *dest = &dest_bmp.pix32(y);
|
||||
UINT8 *pri = &pri_buffer->pix8(y);
|
||||
UINT32 *dest = &temp_bitmap.pix32(y);
|
||||
UINT8 *pri = &pri_bitmap.pix8(y);
|
||||
UINT32 *tmapcolor = &dest_bmp.pix32(y);
|
||||
|
||||
|
||||
int x, x_index = x_index_base;
|
||||
for( x=sx; x<ex; x++ )
|
||||
{
|
||||
int c = source[x_index>>16];
|
||||
if( c != transparent_color )
|
||||
if (c != transparent_color)
|
||||
{
|
||||
if (((1 << pri[x]) & pri_mask) == 0)
|
||||
dest[x] = alpha_blend_r32(dest[x], pal[c], alpha);
|
||||
pri[x] = 31;
|
||||
if (priority >= pri[x])
|
||||
{
|
||||
if ((dest[x] & 0xff000000) == 0x00000000)
|
||||
dest[x] = alpha_blend_r32(tmapcolor[x] & 0x00ffffff, pal[c] & 0x00ffffff, alpha); // if nothing has been drawn pull the pixel from the tilemap to blend with
|
||||
else
|
||||
dest[x] = alpha_blend_r32(dest[x] & 0x00ffffff, pal[c] & 0x00ffffff, alpha); // otherwise blend with what was previously drawn
|
||||
|
||||
dest[x] |= 0xff000000;
|
||||
}
|
||||
else // sprites can have a 'masking' effect on other sprites
|
||||
{
|
||||
dest[x] = 0x00000000;
|
||||
}
|
||||
}
|
||||
x_index += dx;
|
||||
}
|
||||
|
||||
y_index += dy;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for( y=sy; y<ey; y++ )
|
||||
{
|
||||
const UINT8 *source = code_base + (y_index>>16) * gfx->rowbytes();
|
||||
UINT32 *dest = &dest_bmp.pix32(y);
|
||||
|
||||
int x, x_index = x_index_base;
|
||||
for( x=sx; x<ex; x++ )
|
||||
{
|
||||
int c = source[x_index>>16];
|
||||
if( c != transparent_color ) dest[x] = alpha_blend_r32(dest[x], pal[c], alpha);
|
||||
x_index += dx;
|
||||
}
|
||||
|
||||
@ -233,11 +218,12 @@ inline void deco_zoomspr_device::dragngun_drawgfxzoom(
|
||||
}
|
||||
}
|
||||
|
||||
void deco_zoomspr_device::dragngun_draw_sprites( bitmap_rgb32 &bitmap, const rectangle &cliprect, const UINT32 *spritedata, UINT32* dragngun_sprite_layout_0_ram, UINT32* dragngun_sprite_layout_1_ram, UINT32* dragngun_sprite_lookup_0_ram, UINT32* dragngun_sprite_lookup_1_ram, UINT32 dragngun_sprite_ctrl )
|
||||
void deco_zoomspr_device::dragngun_draw_sprites( bitmap_rgb32 &bitmap, const rectangle &cliprect, const UINT32 *spritedata, UINT32* dragngun_sprite_layout_0_ram, UINT32* dragngun_sprite_layout_1_ram, UINT32* dragngun_sprite_lookup_0_ram, UINT32* dragngun_sprite_lookup_1_ram, UINT32 dragngun_sprite_ctrl, bitmap_ind8 &pri_bitmap, bitmap_rgb32 &temp_bitmap)
|
||||
{
|
||||
const UINT32 *layout_ram;
|
||||
const UINT32 *lookup_ram;
|
||||
int offs;
|
||||
temp_bitmap.fill(0x00000000, cliprect);
|
||||
|
||||
/*
|
||||
Sprites are built from main control ram, which references tile
|
||||
@ -319,6 +305,15 @@ void deco_zoomspr_device::dragngun_draw_sprites( bitmap_rgb32 &bitmap, const rec
|
||||
|
||||
colour = spritedata[offs+6]&0x1f;
|
||||
|
||||
int priority = (spritedata[offs + 6] & 0x60) >> 5;
|
||||
/*
|
||||
if (priority == 0) priority = 1;
|
||||
else if (priority == 1) priority = 1;
|
||||
else if (priority == 2) priority = 1;
|
||||
else if (priority == 3) priority = 1;
|
||||
*/
|
||||
priority = 7;
|
||||
|
||||
if (spritedata[offs+6]&0x80)
|
||||
alpha=0x80;
|
||||
else
|
||||
@ -378,7 +373,6 @@ void deco_zoomspr_device::dragngun_draw_sprites( bitmap_rgb32 &bitmap, const rec
|
||||
if (sprite&0x8000) bank=4; else bank=3;
|
||||
sprite&=0x7fff;
|
||||
|
||||
if (zoomx!=0x10000 || zoomy!=0x10000)
|
||||
dragngun_drawgfxzoom(
|
||||
bitmap,cliprect,m_gfxdecode->gfx(bank),
|
||||
sprite,
|
||||
@ -386,14 +380,11 @@ void deco_zoomspr_device::dragngun_draw_sprites( bitmap_rgb32 &bitmap, const rec
|
||||
fx,fy,
|
||||
xpos>>16,ypos>>16,
|
||||
15,zoomx,zoomy,NULL,0,
|
||||
((xpos+(zoomx<<4))>>16) - (xpos>>16), ((ypos+(zoomy<<4))>>16) - (ypos>>16), alpha );
|
||||
else
|
||||
m_gfxdecode->gfx(bank)->alpha(bitmap,cliprect,
|
||||
sprite,
|
||||
colour,
|
||||
fx,fy,
|
||||
xpos>>16,ypos>>16,
|
||||
15,alpha);
|
||||
((xpos+(zoomx<<4))>>16) - (xpos>>16), ((ypos+(zoomy<<4))>>16) - (ypos>>16), alpha,
|
||||
pri_bitmap, temp_bitmap,
|
||||
priority
|
||||
);
|
||||
|
||||
|
||||
if (fx)
|
||||
xpos-=zoomx<<4;
|
||||
@ -406,5 +397,23 @@ void deco_zoomspr_device::dragngun_draw_sprites( bitmap_rgb32 &bitmap, const rec
|
||||
ypos+=zoomy<<4;
|
||||
}
|
||||
}
|
||||
|
||||
for (int y = cliprect.min_y; y <= cliprect.max_y; y++)
|
||||
{
|
||||
UINT32 *src = &temp_bitmap.pix32(y);
|
||||
UINT32 *dst = &bitmap.pix32(y);
|
||||
|
||||
for (int x = cliprect.min_x; x <= cliprect.max_x; x++)
|
||||
{
|
||||
UINT32 srcpix = src[x];
|
||||
|
||||
if ((srcpix & 0xff000000) == 0xff000000)
|
||||
{
|
||||
dst[x] = srcpix & 0x00ffffff;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ public:
|
||||
static void static_set_palette_tag(device_t &device, const char *tag);
|
||||
static void static_set_gfxdecode_tag(device_t &device, const char *tag);
|
||||
|
||||
void dragngun_draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, const UINT32 *spritedata, UINT32* dragngun_sprite_layout_0_ram, UINT32* dragngun_sprite_layout_1_ram, UINT32* dragngun_sprite_lookup_0_ram, UINT32* dragngun_sprite_lookup_1_ram, UINT32 dragngun_sprite_ctrl);
|
||||
void dragngun_draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, const UINT32 *spritedata, UINT32* dragngun_sprite_layout_0_ram, UINT32* dragngun_sprite_layout_1_ram, UINT32* dragngun_sprite_lookup_0_ram, UINT32* dragngun_sprite_lookup_1_ram, UINT32 dragngun_sprite_ctrl, bitmap_ind8 &pri_bitmap, bitmap_rgb32 &temp_bitmap);
|
||||
|
||||
|
||||
protected:
|
||||
@ -23,7 +23,8 @@ private:
|
||||
bitmap_rgb32 &dest_bmp, const rectangle &clip, gfx_element *gfx,
|
||||
UINT32 code, UINT32 color, int flipx, int flipy, int sx, int sy,
|
||||
int transparent_color,
|
||||
int scalex, int scaley, bitmap_ind8 *pri_buffer, UINT32 pri_mask, int sprite_screen_width, int sprite_screen_height, UINT8 alpha);
|
||||
int scalex, int scaley, bitmap_ind8 *pri_buffer, UINT32 pri_mask, int sprite_screen_width, int sprite_screen_height, UINT8 alpha, bitmap_ind8 &pri_bitmap, bitmap_rgb32 &temp_bitmap,
|
||||
int priority);
|
||||
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user