Mercurial > repos > blastem
changeset 1132:fd3b8ac57aca
Fix rendering of BG color index 0 in Mode 4. Only transparent with respect to sprites and not the backdrop like in Mode 5
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sun, 01 Jan 2017 01:16:43 -0800 |
parents | 136b1676109b |
children | 28363cb568c4 |
files | vdp.c |
diffstat | 1 files changed, 5 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- 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]; } } }