mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
Fix textual palettes not accepting to be filled
A weird case of off-by-one error
This commit is contained in:
@@ -371,13 +371,13 @@ static void parseGPLFile(std::filebuf &file) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
++nbColors;
|
|
||||||
if (nbColors < maxNbColors) {
|
if (nbColors < maxNbColors) {
|
||||||
if (nbColors % options.nbColorsPerPal == 1) {
|
if (nbColors % options.nbColorsPerPal == 0) {
|
||||||
options.palSpec.emplace_back();
|
options.palSpec.emplace_back();
|
||||||
}
|
}
|
||||||
options.palSpec.back()[nbColors % options.nbColorsPerPal] = *color;
|
options.palSpec.back()[nbColors % options.nbColorsPerPal] = *color;
|
||||||
}
|
}
|
||||||
|
++nbColors;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nbColors > maxNbColors) {
|
if (nbColors > maxNbColors) {
|
||||||
@@ -419,13 +419,13 @@ static void parseHEXFile(std::filebuf &file) {
|
|||||||
Rgba color =
|
Rgba color =
|
||||||
Rgba(toHex(line[0], line[1]), toHex(line[2], line[3]), toHex(line[4], line[5]), 0xFF);
|
Rgba(toHex(line[0], line[1]), toHex(line[2], line[3]), toHex(line[4], line[5]), 0xFF);
|
||||||
|
|
||||||
++nbColors;
|
|
||||||
if (nbColors < maxNbColors) {
|
if (nbColors < maxNbColors) {
|
||||||
if (nbColors % options.nbColorsPerPal == 1) {
|
if (nbColors % options.nbColorsPerPal == 0) {
|
||||||
options.palSpec.emplace_back();
|
options.palSpec.emplace_back();
|
||||||
}
|
}
|
||||||
options.palSpec.back()[nbColors % options.nbColorsPerPal] = color;
|
options.palSpec.back()[nbColors % options.nbColorsPerPal] = color;
|
||||||
}
|
}
|
||||||
|
++nbColors;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nbColors > maxNbColors) {
|
if (nbColors > maxNbColors) {
|
||||||
|
|||||||
1
test/gfx/full_hex.flags
Normal file
1
test/gfx/full_hex.flags
Normal file
@@ -0,0 +1 @@
|
|||||||
|
-c hex:full_hex.hex
|
||||||
39
test/gfx/full_hex.hex
Normal file
39
test/gfx/full_hex.hex
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
e77300
|
||||||
|
008cce
|
||||||
|
634218
|
||||||
|
000000
|
||||||
|
|
||||||
|
efd600
|
||||||
|
5ad639
|
||||||
|
008cce
|
||||||
|
000000
|
||||||
|
|
||||||
|
efd600
|
||||||
|
ef9c8c
|
||||||
|
5ab5ef
|
||||||
|
008cce
|
||||||
|
|
||||||
|
efd600
|
||||||
|
5ad639
|
||||||
|
39217b
|
||||||
|
000000
|
||||||
|
|
||||||
|
efd600
|
||||||
|
00ef63
|
||||||
|
5ab5ef
|
||||||
|
316331
|
||||||
|
|
||||||
|
efd600
|
||||||
|
adadc6
|
||||||
|
ef9c8c
|
||||||
|
5ab5ef
|
||||||
|
|
||||||
|
e77300
|
||||||
|
634218
|
||||||
|
39217b
|
||||||
|
000000
|
||||||
|
|
||||||
|
5ad639
|
||||||
|
316331
|
||||||
|
39217b
|
||||||
|
000000
|
||||||
BIN
test/gfx/full_hex.png
Normal file
BIN
test/gfx/full_hex.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 881 B |
Reference in New Issue
Block a user