fix 06613, game sets rowscroll to be bigger than assumed size of tilemap

This commit is contained in:
David Haywood 2017-07-03 12:28:46 +01:00
parent cbbbd07484
commit b77eefdd01

View File

@ -724,11 +724,18 @@ static int deco16_pf_update(
if (tilemap_16x16) if (tilemap_16x16)
{ {
int numrows = rows;
// cap at tilemap size
if (numrows > tilemap_16x16->height())
numrows = tilemap_16x16->height();
tilemap_16x16->set_scroll_cols(1); tilemap_16x16->set_scroll_cols(1);
tilemap_16x16->set_scroll_rows(rows); tilemap_16x16->set_scroll_rows(numrows);
tilemap_16x16->set_scrolly(0, scrolly); tilemap_16x16->set_scrolly(0, scrolly);
for (offs = 0; offs < rows; offs++)
for (offs = 0; offs < numrows; offs++)
tilemap_16x16->set_scrollx(offs, scrollx + rowscroll_ptr[offs]); tilemap_16x16->set_scrollx(offs, scrollx + rowscroll_ptr[offs]);
} }
@ -740,6 +747,10 @@ static int deco16_pf_update(
if (!(tilemapsizes & 4)) if (!(tilemapsizes & 4))
numrows = rows >> 1; numrows = rows >> 1;
// cap at tilemap size
if (numrows > tilemap_8x8->height())
numrows = tilemap_8x8->height();
tilemap_8x8->set_scroll_cols(1); tilemap_8x8->set_scroll_cols(1);
tilemap_8x8->set_scroll_rows(numrows); tilemap_8x8->set_scroll_rows(numrows);
tilemap_8x8->set_scrolly(0, scrolly); tilemap_8x8->set_scrolly(0, scrolly);