# HG changeset patch # User Michael Pavone # Date 1463031798 25200 # Node ID 4263dc9cf86dcd94c8c44ccb9d72f6953a1d9474 # Parent 56b1748a8473cf570b20ae6f7bd29aa9302be4cd Fix implementation of sprite collision flag. Old implementation did not make sense. diff -r 56b1748a8473 -r 4263dc9cf86d vdp.c --- a/vdp.c Wed May 11 01:15:54 2016 -0700 +++ b/vdp.c Wed May 11 22:43:18 2016 -0700 @@ -185,18 +185,20 @@ //printf("Draw Slot %d of %d, Rendering sprite cell from %X to x: %d\n", context->cur_slot, context->sprite_draws, d->address, x); context->cur_slot--; for (uint16_t address = d->address; address != ((d->address+4) & 0xFFFF); address++) { - if (x >= 0 && x < 320 && !(context->linebuf[x] & 0xF)) { - if (context->linebuf[x] && (context->vdpmem[address] >> 4)) { + if (x >= 0 && x < 320) { + if (!(context->linebuf[x] & 0xF)) { + context->linebuf[x] = (context->vdpmem[address] >> 4) | d->pal_priority; + } else if (context->vdpmem[address] >> 4) { context->flags2 |= FLAG2_SPRITE_COLLIDE; } - context->linebuf[x] = (context->vdpmem[address] >> 4) | d->pal_priority; } x += dir; - if (x >= 0 && x < 320 && !(context->linebuf[x] & 0xF)) { - if (context->linebuf[x] && (context->vdpmem[address] & 0xF)) { + if (x >= 0 && x < 320) { + if (!(context->linebuf[x] & 0xF)) { + context->linebuf[x] = (context->vdpmem[address] & 0xF) | d->pal_priority; + } else if (context->vdpmem[address] & 0xF) { context->flags2 |= FLAG2_SPRITE_COLLIDE; } - context->linebuf[x] = (context->vdpmem[address] & 0xF) | d->pal_priority; } x += dir; }