summaryrefslogtreecommitdiff
path: root/tools/nitrogfx/jasc_pal.c
diff options
context:
space:
mode:
authorred031000 <rubenru09@aol.com>2020-06-07 15:57:16 +0100
committerred031000 <rubenru09@aol.com>2020-06-07 15:57:16 +0100
commitcc67cafa094351a033f295d054380acc63fddd78 (patch)
treebdfae5029031b07a4c525a7378fe546f05de79b3 /tools/nitrogfx/jasc_pal.c
parentcc5a1e59920fe0ed975af40aa49b7870832323af (diff)
fix bitdepth
Diffstat (limited to 'tools/nitrogfx/jasc_pal.c')
-rw-r--r--tools/nitrogfx/jasc_pal.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/nitrogfx/jasc_pal.c b/tools/nitrogfx/jasc_pal.c
index e5ba9c3c..4f80f5d9 100644
--- a/tools/nitrogfx/jasc_pal.c
+++ b/tools/nitrogfx/jasc_pal.c
@@ -91,6 +91,8 @@ void ReadJascPalette(char *path, struct Palette *palette)
if (palette->numColors < 1 || palette->numColors > 256)
FATAL_ERROR("%d is an invalid number of colors. The number of colors must be in the range [1, 256].\n", palette->numColors);
+ palette->bitDepth = 4;
+
for (int i = 0; i < palette->numColors; i++)
{
ReadJascPaletteLine(fp, line);
@@ -146,6 +148,11 @@ void ReadJascPalette(char *path, struct Palette *palette)
palette->colors[i].red = red;
palette->colors[i].green = green;
palette->colors[i].blue = blue;
+ if (i >= 16)
+ {
+ if (red || green || blue)
+ palette->bitDepth = 8;
+ }
}
if (fgetc(fp) != EOF)