Ignore num_tiles if it would truncate non-transparent tiles (#1729)

This commit is contained in:
Martin Griffin
2022-08-19 04:07:25 +01:00
committed by GitHub
parent 936ebbd973
commit 5e593a62fb
8 changed files with 154 additions and 119 deletions
+8 -1
View File
@@ -77,7 +77,7 @@ void ConvertPngToGba(char *inputPath, char *outputPath, struct PngToGbaOptions *
ReadPng(inputPath, &image);
WriteImage(outputPath, options->numTiles, options->bitDepth, options->metatileWidth, options->metatileHeight, &image, !image.hasPalette);
WriteImage(outputPath, options->numTilesMode, options->numTiles, options->bitDepth, options->metatileWidth, options->metatileHeight, &image, !image.hasPalette);
FreeImage(&image);
}
@@ -179,6 +179,7 @@ void HandlePngToGbaCommand(char *inputPath, char *outputPath, int argc, char **a
char *outputFileExtension = GetFileExtensionAfterDot(outputPath);
int bitDepth = outputFileExtension[0] - '0';
struct PngToGbaOptions options;
options.numTilesMode = NUM_TILES_IGNORE;
options.numTiles = 0;
options.bitDepth = bitDepth;
options.metatileWidth = 1;
@@ -203,6 +204,12 @@ void HandlePngToGbaCommand(char *inputPath, char *outputPath, int argc, char **a
if (options.numTiles < 1)
FATAL_ERROR("Number of tiles must be positive.\n");
}
else if (strcmp(option, "-Wnum_tiles") == 0) {
options.numTilesMode = NUM_TILES_WARN;
}
else if (strcmp(option, "-Werror=num_tiles") == 0) {
options.numTilesMode = NUM_TILES_ERROR;
}
else if (strcmp(option, "-mwidth") == 0)
{
if (i + 1 >= argc)