[nostalgia][core][sdl] Fix bug in loading 8 bpp ng files

This commit is contained in:
Gary Talent 2020-03-25 02:05:09 -05:00
parent 26747a6d0f
commit a2c012ead4

View File

@ -113,7 +113,7 @@ ox::Error loadTileSheet(Context *ctx,
auto surface = SDL_CreateRGBSurfaceWithFormat(0, width, height, 16, format); auto surface = SDL_CreateRGBSurfaceWithFormat(0, width, height, 16, format);
auto sdlPalette = createSDL_Palette(palette); auto sdlPalette = createSDL_Palette(palette);
SDL_SetSurfacePalette(surface, sdlPalette); SDL_SetSurfacePalette(surface, sdlPalette);
if (bytesPerTile == 1) { if (bytesPerTile == 64) {
SDL_memcpy(surface->pixels, tilesheet.tiles.data(), bytesPerTile * tiles); SDL_memcpy(surface->pixels, tilesheet.tiles.data(), bytesPerTile * tiles);
} else { } else {
for (std::size_t i = 0; i < tilesheet.tiles.size(); ++i) { for (std::size_t i = 0; i < tilesheet.tiles.size(); ++i) {