From 952542d189ed3b0f9c19a1a90485fdfde39cd2f2 Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Thu, 5 Jan 2017 00:42:11 -0800 Subject: Fix Mode 4 sprite collision flag --- vdp.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'vdp.c') 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; } -- cgit v1.2.3