summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2017-01-05 00:42:11 -0800
committerMichael Pavone <pavone@retrodev.com>2017-01-05 00:42:11 -0800
commit952542d189ed3b0f9c19a1a90485fdfde39cd2f2 (patch)
treee50bcccec760d2344c09de5bcabc0c1d866cc925
parent25908ea88742215abdc04c491736e0061e99498e (diff)
Fix Mode 4 sprite collision flag
-rw-r--r--vdp.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/vdp.c b/vdp.c
index af04a05..0f772d0 100644
--- a/vdp.c
+++ b/vdp.c
@@ -251,8 +251,13 @@ static void render_sprite_cells_mode4(vdp_context * context)
int x = d->x_pos & 0xFF;
for (int i = 28; i >= 0; i -= 4, x++)
{
- if (context->linebuf[x]) {
- context->flags2 |= FLAG2_SPRITE_COLLIDE;
+ if (context->linebuf[x] && (pixels >> i & 0xF)) {
+ if (
+ ((context->regs[REG_MODE_1] & BIT_SPRITE_8PX) && x > 8)
+ || ((!(context->regs[REG_MODE_1] & BIT_SPRITE_8PX)) && x < 256)
+ ) {
+ context->flags2 |= FLAG2_SPRITE_COLLIDE;
+ }
} else {
context->linebuf[x] = pixels >> i & 0xF;
}