/* Recording of custom chip register changes. */
static int current_change_set;
-static struct sprite_entry sprite_entries[2][MAX_SPR_PIXELS / 32];
+#define MAX_SPRITE_ENTRIES ((MAXVPOS + MAXVPOS_WRAPLINES) * 16)
+static struct sprite_entry sprite_entries[2][MAX_SPRITE_ENTRIES];
static struct color_change color_changes[2][MAX_REG_CHANGE];
struct decision line_decisions[2 * (MAXVPOS + MAXVPOS_WRAPLINES) + 1];
#define COLOR_TABLE_SIZE (MAXVPOS + MAXVPOS_WRAPLINES) * 2
static struct color_entry color_tables[2][COLOR_TABLE_SIZE];
-static int next_sprite_entry = 0, last_sprite_entry = 0, end_sprite_entry;
+static int next_sprite_entry = 0, end_sprite_entry;
static int prev_next_sprite_entry;
static int next_sprite_forced = 1;
static int spixels_max;
/* Try to coalesce entries if they aren't too far apart */
/* Don't coelesce 64-bit wide sprites, needed to support FMODE change tricks */
- if (!next_sprite_forced && e[-1].max + spr_width >= sprxp) {
+ if (next_sprite_entry > 0 && !next_sprite_forced && e[-1].max + spr_width >= sprxp) {
e--;
} else {
next_sprite_entry++;
int first_pixel = prev_sprite_entries[0].first_pixel;
int npixels = prev_sprite_entries[prev_next_sprite_entry].first_pixel - first_pixel;
if (npixels > 0) {
- memset(spixels + first_pixel, 0, npixels * sizeof * spixels);
- memset(spixstate.stb + first_pixel, 0, npixels * sizeof * spixstate.stb);
+ memset(spixels + first_pixel, 0, npixels * sizeof *spixels);
+ memset(spixstate.stb + first_pixel, 0, npixels * sizeof *spixstate.stb);
if (aga_mode) {
- memset(spixstate.stbfm + first_pixel, 0, npixels * sizeof * spixstate.stbfm);
+ memset(spixstate.stbfm + first_pixel, 0, npixels * sizeof *spixstate.stbfm);
}
}
}
+
prev_next_sprite_entry = next_sprite_entry;
next_sprite_entry = 0;
- last_sprite_entry = MAX_SPR_PIXELS - 1;
- end_sprite_entry = MAX_SPR_PIXELS - 2;
+ end_sprite_entry = MAX_SPRITE_ENTRIES - 2;
spixels_max = sizeof(spixels) / sizeof(*spixels) - MAX_PIXELS_PER_LINE;
next_lineno = calculate_lineno(vpos);