d_rohga/deco16ic Nitroball: use alpha for 32bpp, fix some sprite prio issues

This commit is contained in:
dinkc64 2017-05-19 02:29:23 +00:00
parent c4848e391b
commit 603ac12c48
3 changed files with 57 additions and 17 deletions

View File

@ -1471,9 +1471,9 @@ static void wizdfire_draw_sprites(UINT8 *ram, UINT8 *gfx, INT32 coloff, INT32 mo
}
}
static void nitrobal_draw_sprites(UINT8 *ram, INT32 gfxbank, INT32 /*bpp*/)
static void nitrobal_draw_sprites(UINT8 *ram, INT32 gfxbank, INT32 alpha_on)
{
// if (bpp != (nBurnBpp & 0x04)) return;
//if (bpp != (nBurnBpp & 0x04)) return;
UINT16 *spriteptr = (UINT16*)ram;
@ -1584,11 +1584,11 @@ static void nitrobal_draw_sprites(UINT8 *ram, INT32 gfxbank, INT32 /*bpp*/)
{
for (y = 0; y < h; y++)
{
//if (!bpp) {
deco16_draw_prio_sprite(pTransDraw, gfx, sprite + y + h * x, (colour << 4) + coloff, sx + x_mult * (w-x), sy + y_mult * (h-y), fx, fy, tilemap_pri, sprite_pri);
//} else {
// deco16_draw_alphaprio_sprite(DrvPalette, gfx, sprite + y + h * x, (colour << 4) + coloff, sx + x_mult * (w-x), sy + y_mult * (h-y), fx, fy, tilemap_pri, sprite_pri, alpha);
//}
if (!alpha_on) {
deco16_draw_prio_sprite_nitrobal(pTransDraw, gfx, sprite + y + h * x, (colour << 4) + coloff, sx + x_mult * (w-x), sy + y_mult * (h-y), fx, fy, tilemap_pri, sprite_pri);
} else {
deco16_draw_alphaprio_sprite(DrvPalette, gfx, sprite + y + h * x, (colour << 4) + coloff, sx + x_mult * (w-x), sy + y_mult * (h-y), fx, fy, tilemap_pri, sprite_pri, alpha);
}
}
}
@ -1748,25 +1748,27 @@ static INT32 NitrobalDraw()
pTransDraw[i] = 0x200;
}
draw_combined_playfield_step1();
deco16_clear_prio_map();
draw_combined_playfield_step1();
draw_combined_playfield(0x200, 0);
// if (nBurnLayer & 1) deco16_draw_layer(3, pTransDraw, DECO16_LAYER_OPAQUE);
deco16_draw_layer(1, pTransDraw, 16);
nitrobal_draw_sprites(DrvSprBuf , 3, 0);
nitrobal_draw_sprites(DrvSprBuf2, 4, 0);
if (nBurnBpp != 4) { // regular (non-alpha) draw for anything !32bpp
nitrobal_draw_sprites(DrvSprBuf , 3, 0);
nitrobal_draw_sprites(DrvSprBuf2, 4, 0);
}
deco16_draw_layer(0, pTransDraw, DECO16_LAYER_PRIORITY(0xff));
deco16_draw_layer(0, pTransDraw, DECO16_LAYER_PRIORITY(0xff));
BurnTransferCopy(DrvPalette);
// nitrobal_draw_sprites(DrvSprBuf , 3, 4);
// nitrobal_draw_sprites(DrvSprBuf2, 4, 4);
if (nBurnBpp == 4) { // draw alpha sprites if 32bpp
nitrobal_draw_sprites(DrvSprBuf , 3, 1);
nitrobal_draw_sprites(DrvSprBuf2, 4, 1);
}
return 0;
}

View File

@ -90,7 +90,7 @@ void deco16_draw_prio_sprite(UINT16 *dest, UINT8 *gfx, INT32 code, INT32 color,
if (pri != -1) {
INT32 bpriority = deco16_prio_map[(sy * 512) + sx];
if (spri == -1) {
if ((pri & (1 << (bpriority & 0x1f))) || (bpriority & 0x80)) continue;
deco16_prio_map[sy * 512 + sx] |= 0x80; // right?
@ -110,6 +110,43 @@ void deco16_draw_prio_sprite(UINT16 *dest, UINT8 *gfx, INT32 code, INT32 color,
}
}
void deco16_draw_prio_sprite_nitrobal(UINT16 *dest, UINT8 *gfx, INT32 code, INT32 color, INT32 sx, INT32 sy, INT32 flipx, INT32 flipy, INT32 pri, INT32 spri)
{
gfx += code * 0x100;
INT32 flip = 0;
if (flipx) flip |= 0x0f;
if (flipy) flip |= 0xf0;
sy -= deco16_global_y_offset;
sx -= deco16_global_x_offset;
for (INT32 yy = 0; yy < 16; yy++, sy++) {
if (sy < 0 || sy >= nScreenHeight) continue;
for (INT32 xx = 0; xx < 16; xx++, sx++) {
if (sx < 0 || sx >= nScreenWidth) continue;
INT32 pxl = gfx[((yy * 16) + xx) ^ flip];
if (!pxl) continue;
if (pri != -1) {
INT32 bpriority = deco16_prio_map[(sy * 512) + sx];
if (pri > bpriority && spri > deco16_sprite_prio_map[sy * 512 + sx]) {
dest[sy * nScreenWidth + sx] = pxl | color;
deco16_prio_map[sy * 512 + sx] |= pri; // right?
}
deco16_sprite_prio_map[sy * 512 + sx] |= spri;
}
}
sx -= 16;
}
}
void deco16_draw_prio_sprite(UINT16 *dest, UINT8 *gfx, INT32 code, INT32 color, INT32 sx, INT32 sy, INT32 flipx, INT32 flipy, INT32 pri)
{
deco16_draw_prio_sprite(dest, gfx, code, color, sx, sy, flipx, flipy, pri, -1);

View File

@ -23,6 +23,7 @@ extern UINT8 *deco16_prio_map;
void deco16_clear_prio_map();
void deco16_draw_prio_sprite(UINT16 *dest, UINT8 *gfx, INT32 code, INT32 color, INT32 sx, INT32 sy, INT32 flipx, INT32 flipy, INT32 pri);
void deco16_draw_prio_sprite(UINT16 *dest, UINT8 *gfx, INT32 code, INT32 color, INT32 sx, INT32 sy, INT32 flipx, INT32 flipy, INT32 pri, INT32 spri);
void deco16_draw_prio_sprite_nitrobal(UINT16 *dest, UINT8 *gfx, INT32 code, INT32 color, INT32 sx, INT32 sy, INT32 flipx, INT32 flipy, INT32 pri, INT32 spri);
void deco16_draw_alphaprio_sprite(UINT32 *palette, UINT8 *gfx, INT32 code, INT32 color, INT32 sx, INT32 sy, INT32 flipx, INT32 flipy, INT32 pri, INT32 spri, INT32 alpha);
void deco16_set_graphics(UINT8 *gfx0, INT32 len0, UINT8 *gfx1, INT32 len1, UINT8 *gfx2, INT32 len2);