deco_mlc.cpp : Updates

Make background color blendable, Slightly simpler blending behavior, Fix spacing
This commit is contained in:
cam900 2019-09-11 23:19:25 +09:00
parent 48e3eb4174
commit f33b1ee71d
2 changed files with 62 additions and 112 deletions

View File

@ -922,7 +922,8 @@ void deco_mlc_state::descramble_sound( )
for (u32 x = 0; x < length; x++) for (u32 x = 0; x < length; x++)
{ {
u32 addr = bitswap<24> (x,23,22,21,0, 20, const u32 addr = bitswap<24>(x,
23,22,21,0, 20,
19,18,17,16, 19,18,17,16,
15,14,13,12, 15,14,13,12,
11,10,9, 8, 11,10,9, 8,
@ -937,8 +938,8 @@ void deco_mlc_state::descramble_sound( )
READ32_MEMBER(deco_mlc_state::avengrgs_speedup_r) READ32_MEMBER(deco_mlc_state::avengrgs_speedup_r)
{ {
u32 a = m_mainram[0x89a0/4]; const u32 a = m_mainram[0x89a0 / 4];
u32 p = m_maincpu->pc(); const u32 p = m_maincpu->pc();
if ((p == 0x3234 || p == 0x32dc) && (a & 1)) m_maincpu->spin_until_interrupt(); if ((p == 0x3234 || p == 0x32dc) && (a & 1)) m_maincpu->spin_until_interrupt();

View File

@ -98,72 +98,8 @@ void deco_mlc_state::drawgfxzoomline(u32* dest, u8* pri,const rectangle &clip,gf
const u8 *code_base2 = gfx->get_data(code2 % gfx->elements()); const u8 *code_base2 = gfx->get_data(code2 % gfx->elements());
const u8 *source1 = code_base1 + (srcline) * gfx->rowbytes(); const u8 *source1 = code_base1 + (srcline) * gfx->rowbytes();
const u8 *source2 = code_base2 + (srcline) * gfx->rowbytes(); const u8 *source2 = code_base2 + (srcline) * gfx->rowbytes();
/* no alpha */
if (!shadowMode)
{
if (alphaMode & 0xc0)
{
int x, x_index = x_index_base;
for (x = sx; x < ex; x++)
{
if (!(pri[x] & 0x80))
{
int c = source1[x_index >> 16];
if (use8bpp)
c = (c << 4) | source2[x_index >> 16];
if (c != transparent_color)
{
u32 col = pal[c];
if ((pri[x] & 0x3) && ((pri[x] & 0x3) != 0x3))
{
const u8 a = (col >> 24) & 0xff;
const u8 r = (col >> 16) & 0xff;
const u8 g = (col >> 8) & 0xff;
const u8 b = (col >> 0) & 0xff;
if (pri[x] & 1) // shadow
{
col = rgb_t(a, r >> 1, g >> 1, b >> 1);
}
else if (pri[x] & 2) // hilight
{
col = rgb_t(a, 0x80 | (r >> 1), 0x80 | (g >> 1), 0x80 | (b >> 1));
}
}
dest[x] = col;
pri[x] |= 0x80; // Mark it drawn
}
}
x_index += dx;
}
}
else
{
int x, x_index = x_index_base;
for (x = sx; x < ex; x++)
{
if (!(pri[x] & 0x80))
{
int c = source1[x_index >> 16];
if (use8bpp)
c = (c << 4) | source2[x_index >> 16];
if (c != transparent_color)
{
dest[x] = pal[c];
pri[x] |= 0x80; // Mark it drawn
}
}
x_index += dx;
}
}
}
// alphaMode & 0xc0 = 0xc0 : Shadow, 0 : Alpha or Pre-shadowed, Other bits unknown // alphaMode & 0xc0 = 0xc0 : Shadow, 0 : Alpha or Pre-shadowed, Other bits unknown
else if (shadowMode && (alphaMode & 0xc0))
{
if (alphaMode & 0xc0)
{ /* TODO : 8bpp and shadow can use simultaneously? */ { /* TODO : 8bpp and shadow can use simultaneously? */
int x, x_index = x_index_base; int x, x_index = x_index_base;
for (x = sx; x < ex; x++) for (x = sx; x < ex; x++)
@ -193,8 +129,8 @@ void deco_mlc_state::drawgfxzoomline(u32* dest, u8* pri,const rectangle &clip,gf
if (c != transparent_color) if (c != transparent_color)
{ {
dest[x] = (shadowMode == 3) ? pal[c] : alpha_blend_r32(pal[c], shadowMode & 2 ? ~0 : 0, 0x80); dest[x] = pal[c];
pri[x] |= 0x80; // Mark it drawn pri[x] |= 0x80 | shadowMode; // Mark it drawn
} }
} }
x_index += dx; x_index += dx;
@ -203,7 +139,6 @@ void deco_mlc_state::drawgfxzoomline(u32* dest, u8* pri,const rectangle &clip,gf
} }
} }
} }
}
void deco_mlc_state::draw_sprites(const rectangle &cliprect, int scanline, u32* dest, u8* pri) void deco_mlc_state::draw_sprites(const rectangle &cliprect, int scanline, u32* dest, u8* pri)
@ -625,6 +560,20 @@ u32 deco_mlc_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, c
printf("\n"); printf("\n");
*/ */
draw_sprites(cliprect, i, dest, pri); draw_sprites(cliprect, i, dest, pri);
for (int x = cliprect.left(); x <= cliprect.right(); x++)
{
u32 col = dest[x];
const u8 shadow_flag = pri[x] & 3;
if ((shadow_flag & 3) && (shadow_flag != 3))
{
if (shadow_flag & 1) // shadow
col = (col & 0xff000000) | ((col & 0xfefefe) >> 1);
else if (shadow_flag & 2) // hilight
col = (col & 0xff000000) | ((col & 0xfefefe) >> 1) | 0x808080;
dest[x] = col;
}
}
} }
return 0; return 0;
} }