changeset 2563:f51d750b4d06

Fix sprite overflow regression in Super Hang-On and other games
author Michael Pavone <pavone@retrodev.com>
date Sat, 25 Jan 2025 23:54:13 -0800
parents 595719fe69f2
children 553a0b4888db
files vdp.c
diffstat 1 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/vdp.c	Sat Jan 25 21:25:01 2025 -0800
+++ b/vdp.c	Sat Jan 25 23:54:13 2025 -0800
@@ -913,6 +913,8 @@
 			context->sprite_draw_list[context->sprite_draws].width = width;
 			context->sprite_draw_list[context->sprite_draws].height = height;
 		}
+	} else if (context->sprite_draws) {
+		context->sprite_draw_list[context->sprite_draws - 1].x_pos = 0;
 	}
 	context->cur_slot++;
 }
@@ -3080,6 +3082,9 @@
 		context->col_1
 	);
 	context->flags &= ~FLAG_MASKED;
+	if (context->sprite_draws) {
+		context->sprite_draw_list[context->sprite_draws - 1].x_pos = 0;
+	}
 	render_sprite_cells(context);
 	//164
 	render_border_garbage(
@@ -3315,6 +3320,9 @@
 			context->col_1
 		);
 		context->flags &= ~FLAG_MASKED;
+		if (context->sprite_draws) {
+			context->sprite_draw_list[context->sprite_draws - 1].x_pos = 0;
+		}
 		render_sprite_cells(context);
 		CHECK_LIMIT
 	case 164:
@@ -3533,6 +3541,9 @@
 			context->col_1
 		);
 		context->flags &= ~FLAG_MASKED;
+		if (context->sprite_draws) {
+			context->sprite_draw_list[context->sprite_draws - 1].x_pos = 0;
+		}
 		render_sprite_cells(context);
 		CHECK_LIMIT
 	case 132: