changeset 1155:da6a1f156f24

Fix Mode 4 sprite collision flag
author Michael Pavone <pavone@retrodev.com>
date Thu, 05 Jan 2017 00:42:11 -0800
parents c83ec07ddbac
children b519965f6394
files vdp.c
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/vdp.c	Thu Jan 05 00:36:23 2017 -0800
+++ b/vdp.c	Thu Jan 05 00:42:11 2017 -0800
@@ -251,8 +251,13 @@
 		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;
 			}