From 041e27932b4c714436a44183459ace518770e016 Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Sun, 1 Jan 2017 01:16:43 -0800 Subject: Fix rendering of BG color index 0 in Mode 4. Only transparent with respect to sprites and not the backdrop like in Mode 5 --- vdp.c | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) (limited to 'vdp.c') diff --git a/vdp.c b/vdp.c index 870d439..3a8014e 100644 --- a/vdp.c +++ b/vdp.c @@ -1260,33 +1260,20 @@ static void render_map_mode4(uint32_t line, int32_t col, vdp_context * context) 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 ((*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 if (*sprite_src) { - //sprite layer is opaque + } else { + //sprite layer is opaque and not covered by high priority BG pixels 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 (context->debug) { - *(dst++) = context->debugcolors[DBG_SRC_A]; - } else { - *(dst++) = context->colors[(*bg_src & 0x1F) + CRAM_SIZE*3]; - } - } else { - if (context->debug) { - *(dst++) = context->debugcolors[DBG_SRC_BG]; - } else { - *(dst++) = context->colors[bgcolor]; - } } } } else { -- cgit v1.2.3