summaryrefslogtreecommitdiff
path: root/vdp.c
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2016-05-11 22:43:18 -0700
committerMichael Pavone <pavone@retrodev.com>2016-05-11 22:43:18 -0700
commit633370ee5f6261d883202ed8690ce801b5b4583c (patch)
treed43ab52ecf19f309e2546c4849d4302ed0e29a31 /vdp.c
parent617489dfc2c1a2502ebdb8df0edfa1897d0bf6b6 (diff)
Fix implementation of sprite collision flag. Old implementation did not make sense.
Diffstat (limited to 'vdp.c')
-rw-r--r--vdp.c14
1 files changed, 8 insertions, 6 deletions
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;
}