Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sort Pokemon and trainer sprite palettes, with Makefile-specified exceptions #1137

Merged
merged 1 commit into from
Oct 16, 2024

Conversation

Rangi42
Copy link
Member

@Rangi42 Rangi42 commented Aug 28, 2024

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.

@Rangi42
Copy link
Member Author

Rangi42 commented Aug 28, 2024

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).

@Rangi42 Rangi42 requested a review from vulcandth August 28, 2024 17:11
Copy link
Member

@mid-kid mid-kid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love this! It is clean and simple, and will be relatively unintrusive to current workflows.

...I just have a few nitpicks.

tools/gbcpal.c Show resolved Hide resolved
tools/gbcpal.c Outdated Show resolved Hide resolved
tools/gbcpal.c Outdated Show resolved Hide resolved
tools/gbcpal.c Outdated Show resolved Hide resolved
tools/gbcpal.c Outdated Show resolved Hide resolved
tools/gbcpal.c Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
Makefile Show resolved Hide resolved
Copy link
Member

@dannye dannye left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like a good way to enforce that the front and back pics use essentially the same palette.

@Rangi42
Copy link
Member Author

Rangi42 commented Oct 7, 2024

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.

@Rangi42 Rangi42 force-pushed the gbcpals branch 5 times, most recently from f75d9e0 to c2ec317 Compare October 9, 2024 13:20
@Rangi42 Rangi42 force-pushed the gbcpals branch 3 times, most recently from dd74cff to 2c53a44 Compare October 16, 2024 13:57
@Rangi42 Rangi42 force-pushed the gbcpals branch 4 times, most recently from 78e22d8 to aea7f4c Compare October 16, 2024 14:41
…eptions

This avoids the need to define their order via indexed PNG palettes

It also avoids the need to use tools/palfix.py on custom sprites

Fixes pret#1136
@Rangi42 Rangi42 merged commit 5a53e29 into pret:master Oct 16, 2024
1 check passed
@Rangi42 Rangi42 deleted the gbcpals branch October 16, 2024 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sort Pokemon and trainer sprite palettes from lightest to darkest, with Makefile-specified exceptions
3 participants