Closed Rangi42 closed 2 weeks ago
The algorithm here is slightly different than what was described in the issue:
Both front.2bpp and back.2bpp are created using the same normal.gbcpal input. The normal.gbcpal is generated by combining front.gbcpal and back.gbcpal. This means that front and back can each use a subset of the overall palette (e.g. Jigglypuff's back doesn't use its eye-blue color).
tools/gbcpal.c checks the colors by sorting them, filtering out duplicates, also filtering our black and white, and then allowing zero, one, or two colors. This allows for any valid sprite, including "all black and white" (fills in the middle colors as white and black also) or "all color, no black or white" (if we checked for "first color is white" or "last color is black", this would fail).
Thanks, dannye! I've just rebased this after removing most other helper scripts; @mid-kid does it look okay to you? If so we can merge and remove palfix.py too.
Fixes #1136
This avoids the need to define the palette order via indexed PNG palettes.
It also avoids the need to use tools/palfix.py on custom sprites.
(After this is merged, palfix.py and png.py should be removed; they're still available in gb-asm-tools anyway.)
Note that the sprites with reversed palettes can be found with revpals.py.