# HG changeset patch # User Michael Pavone # Date 1483262203 28800 # Node ID fd3b8ac57aca6e4fcf8d88d1f22c6c62c31a90aa # Parent 136b1676109bcc121240f51aa5e0afdc70c849c3 Fix rendering of BG color index 0 in Mode 4. Only transparent with respect to sprites and not the backdrop like in Mode 5 diff -r 136b1676109b -r fd3b8ac57aca vdp.c --- a/vdp.c Sun Jan 01 01:10:44 2017 -0800 +++ b/vdp.c Sun Jan 01 01:16:43 2017 -0800 @@ -1260,32 +1260,19 @@ for (int i = 0; i < 8; i++, sprite_src++) { uint8_t *bg_src = context->tmp_buf_a + ((8 + i + col * 8 - (context->hscroll_a & 0x7)) & 15); - if ((*bg_src & 0x4F) > 0x40) { - //background plane has priority and is opaque - if (context->debug) { - *(dst++) = context->debugcolors[DBG_SRC_A]; - } else { - *(dst++) = context->colors[(*bg_src & 0x1F) + CRAM_SIZE*3]; - } - } else if (*sprite_src) { - //sprite layer is opaque - if (context->debug) { - *(dst++) = context->debugcolors[DBG_SRC_S]; - } else { - *(dst++) = context->colors[*sprite_src | 0x10 + CRAM_SIZE*3]; - } - } else if (*bg_src & 0xF) { - //background plane is opaque + if ((*bg_src & 0x4F) > 0x40 || !*sprite_src) { + //background plane has priority and is opaque or sprite layer is transparent if (context->debug) { *(dst++) = context->debugcolors[DBG_SRC_A]; } else { *(dst++) = context->colors[(*bg_src & 0x1F) + CRAM_SIZE*3]; } } else { + //sprite layer is opaque and not covered by high priority BG pixels if (context->debug) { - *(dst++) = context->debugcolors[DBG_SRC_BG]; + *(dst++) = context->debugcolors[DBG_SRC_S]; } else { - *(dst++) = context->colors[bgcolor]; + *(dst++) = context->colors[*sprite_src | 0x10 + CRAM_SIZE*3]; } } }