Skip to content

Commit

Permalink
Sort Pokemon and trainer sprite palettes, with Makefile-specified exc…
Browse files Browse the repository at this point in the history
…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 #1136
  • Loading branch information
Rangi42 committed Aug 28, 2024
1 parent 7b59860 commit 5a9bfb4
Show file tree
Hide file tree
Showing 6 changed files with 495 additions and 259 deletions.
47 changes: 42 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -207,12 +207,48 @@ gfx/pokemon/girafarig/front.animated.tilemap: gfx/pokemon/girafarig/front.2bpp g
tools/pokemon_animation_graphics --girafarig -t $@ $^


### Misc file-specific graphics rules
### Pokemon and trainer sprite rules

gfx/pokemon/%/back.2bpp: gfx/pokemon/%/back.png gfx/pokemon/%/normal.gbcpal
$(RGBGFX) -Z -c gbc:$(word 2,$^) -o $@ $<
gfx/pokemon/%/front.2bpp: gfx/pokemon/%/front.png gfx/pokemon/%/normal.gbcpal
$(RGBGFX) -c gbc:$(word 2,$^) -o $@ $<
gfx/pokemon/%/normal.gbcpal: gfx/pokemon/%/front.gbcpal gfx/pokemon/%/back.gbcpal
tools/gbcpal $(tools/gbcpal) $@ $^

gfx/trainers/%.2bpp: gfx/trainers/%.png gfx/trainers/%.gbcpal
$(RGBGFX) -Z -c gbc:$(word 2,$^) -o $@ $<


### Rules to match specific Pokemon and trainer sprites

gfx/pokemon/%/back.2bpp: rgbgfx += --columns --colors embedded
gfx/pokemon/%/front.2bpp: rgbgfx += --colors embedded
gfx/pokemon/caterpie/normal.gbcpal: tools/gbcpal += --reverse
gfx/pokemon/diglett/normal.gbcpal: tools/gbcpal += --reverse
gfx/pokemon/dugtrio/normal.gbcpal: tools/gbcpal += --reverse
gfx/pokemon/farfetch_d/normal.gbcpal: tools/gbcpal += --reverse
gfx/pokemon/fearow/normal.gbcpal: tools/gbcpal += --reverse
gfx/pokemon/jynx/normal.gbcpal: tools/gbcpal += --reverse
gfx/pokemon/magnemite/normal.gbcpal: tools/gbcpal += --reverse
gfx/pokemon/magneton/normal.gbcpal: tools/gbcpal += --reverse
gfx/pokemon/marill/normal.gbcpal: tools/gbcpal += --reverse
gfx/pokemon/porygon2/normal.gbcpal: tools/gbcpal += --reverse
gfx/pokemon/scyther/normal.gbcpal: tools/gbcpal += --reverse
gfx/pokemon/shellder/normal.gbcpal: tools/gbcpal += --reverse
gfx/pokemon/spearow/normal.gbcpal: tools/gbcpal += --reverse

gfx/trainers/%.2bpp: rgbgfx += --columns --colors embedded
gfx/trainers/swimmer_m.gbcpal: tools/gbcpal += --reverse

# Egg does not have a back sprite, so it only uses front.gbcpal
gfx/pokemon/egg/front.2bpp: gfx/pokemon/egg/front.png gfx/pokemon/egg/front.gbcpal
gfx/pokemon/egg/front.2bpp: rgbgfx += -c gbc:$(word 2,$^)

# Unown letters share one normal.pal, so they don't already build each normal.gbcpal
$(foreach png, $(wildcard gfx/pokemon/unown_*/front.png),\
$(eval $(png:.png=.2bpp): $(png) $(png:front.png=normal.gbcpal)))
gfx/pokemon/unown_%/front.2bpp: rgbgfx += -c gbc:$(@:front.2bpp=normal.gbcpal)


### Misc file-specific graphics rules

gfx/pokemon/egg/unused_front.2bpp: rgbgfx += --columns

Expand Down Expand Up @@ -315,7 +351,8 @@ gfx/mobile/stadium2_n64.2bpp: tools/gfx += --trim-whitespace
tools/gfx $(tools/gfx) --depth 1 -o $@ $@)

%.gbcpal: %.png
$(RGBGFX) --colors embedded -p $@ $<
$(RGBGFX) -p $@ $<
tools/gbcpal $(tools/gbcpal) $@

%.dimensions: %.png
tools/png_dimensions $< $@
Loading

0 comments on commit 5a9bfb4

Please sign in to comment.