comparison vdp.c @ 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 cb4771f4543a
children 28363cb568c4
comparison
equal deleted inserted replaced
1131:136b1676109b 1132:fd3b8ac57aca
1258 sprite_src += 8; 1258 sprite_src += 8;
1259 } 1259 }
1260 for (int i = 0; i < 8; i++, sprite_src++) 1260 for (int i = 0; i < 8; i++, sprite_src++)
1261 { 1261 {
1262 uint8_t *bg_src = context->tmp_buf_a + ((8 + i + col * 8 - (context->hscroll_a & 0x7)) & 15); 1262 uint8_t *bg_src = context->tmp_buf_a + ((8 + i + col * 8 - (context->hscroll_a & 0x7)) & 15);
1263 if ((*bg_src & 0x4F) > 0x40) { 1263 if ((*bg_src & 0x4F) > 0x40 || !*sprite_src) {
1264 //background plane has priority and is opaque 1264 //background plane has priority and is opaque or sprite layer is transparent
1265 if (context->debug) {
1266 *(dst++) = context->debugcolors[DBG_SRC_A];
1267 } else {
1268 *(dst++) = context->colors[(*bg_src & 0x1F) + CRAM_SIZE*3];
1269 }
1270 } else if (*sprite_src) {
1271 //sprite layer is opaque
1272 if (context->debug) {
1273 *(dst++) = context->debugcolors[DBG_SRC_S];
1274 } else {
1275 *(dst++) = context->colors[*sprite_src | 0x10 + CRAM_SIZE*3];
1276 }
1277 } else if (*bg_src & 0xF) {
1278 //background plane is opaque
1279 if (context->debug) { 1265 if (context->debug) {
1280 *(dst++) = context->debugcolors[DBG_SRC_A]; 1266 *(dst++) = context->debugcolors[DBG_SRC_A];
1281 } else { 1267 } else {
1282 *(dst++) = context->colors[(*bg_src & 0x1F) + CRAM_SIZE*3]; 1268 *(dst++) = context->colors[(*bg_src & 0x1F) + CRAM_SIZE*3];
1283 } 1269 }
1284 } else { 1270 } else {
1271 //sprite layer is opaque and not covered by high priority BG pixels
1285 if (context->debug) { 1272 if (context->debug) {
1286 *(dst++) = context->debugcolors[DBG_SRC_BG]; 1273 *(dst++) = context->debugcolors[DBG_SRC_S];
1287 } else { 1274 } else {
1288 *(dst++) = context->colors[bgcolor]; 1275 *(dst++) = context->colors[*sprite_src | 0x10 + CRAM_SIZE*3];
1289 } 1276 }
1290 } 1277 }
1291 } 1278 }
1292 } else { 1279 } else {
1293 for (int i = 0; i < 8; i++) 1280 for (int i = 0; i < 8; i++)