From 633370ee5f6261d883202ed8690ce801b5b4583c Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Wed, 11 May 2016 22:43:18 -0700 Subject: Fix implementation of sprite collision flag. Old implementation did not make sense. --- vdp.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'vdp.c') diff --git a/vdp.c b/vdp.c index 2e35afe..1b3007a 100644 --- a/vdp.c +++ b/vdp.c @@ -185,18 +185,20 @@ void render_sprite_cells(vdp_context * context) //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; } -- cgit v1.2.3