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 pret#1136
  • Loading branch information
Rangi42 committed Aug 28, 2024
1 parent 746a06f commit 3063a31
Show file tree
Hide file tree
Showing 6 changed files with 499 additions and 259 deletions.
49 changes: 44 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -207,12 +207,50 @@ 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 += -Z -c embedded
gfx/pokemon/%/front.2bpp: rgbgfx += -c embedded
# These Pokemon sort their darker color before their lighter one
gfx/pokemon/caterpie/normal.gbcpal: tools/gbcpal += -r
gfx/pokemon/diglett/normal.gbcpal: tools/gbcpal += -r
gfx/pokemon/dugtrio/normal.gbcpal: tools/gbcpal += -r
gfx/pokemon/farfetch_d/normal.gbcpal: tools/gbcpal += -r
gfx/pokemon/fearow/normal.gbcpal: tools/gbcpal += -r
gfx/pokemon/jynx/normal.gbcpal: tools/gbcpal += -r
gfx/pokemon/magnemite/normal.gbcpal: tools/gbcpal += -r
gfx/pokemon/magneton/normal.gbcpal: tools/gbcpal += -r
gfx/pokemon/marill/normal.gbcpal: tools/gbcpal += -r
gfx/pokemon/porygon2/normal.gbcpal: tools/gbcpal += -r
gfx/pokemon/scyther/normal.gbcpal: tools/gbcpal += -r
gfx/pokemon/shellder/normal.gbcpal: tools/gbcpal += -r
gfx/pokemon/spearow/normal.gbcpal: tools/gbcpal += -r

gfx/trainers/%.2bpp: rgbgfx += -Z -c embedded
# These trainers sort their darker color before their lighter one
gfx/trainers/swimmer_m.gbcpal: tools/gbcpal += -r

# 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 += -Z

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

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

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

0 comments on commit 3063a31

Please sign in to comment.