- for (y = 0; y < native_sp_level.height; y++)
- for (x = 0; x < native_sp_level.width; x++)
- native_sp_level.playfield[x][y] = getFile8Bit(file);
+ /* (MPX levels may have non-standard playfield size -- check max. size) */
+ for (y = 0; y < height; y++)
+ {
+ for (x = 0; x < width; x++)
+ {
+ byte element = getFile8Bit(file);
+
+ if (x < SP_MAX_PLAYFIELD_WIDTH &&
+ y < SP_MAX_PLAYFIELD_HEIGHT)
+ native_sp_level.playfield[x][y] = element;
+ }
+ }