From 5a9bfb4e32b44c758f20a577c8e6ad15a93bf44c Mon Sep 17 00:00:00 2001 From: Rangi42 Date: Tue, 27 Aug 2024 23:16:54 -0400 Subject: [PATCH 1/8] Sort Pokemon and trainer sprite palettes, with Makefile-specified exceptions 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 --- Makefile | 47 +++- data/pokemon/palettes.asm | 508 +++++++++++++++++++------------------- tools/.gitignore | 1 + tools/Makefile | 2 + tools/gbcpal.c | 156 ++++++++++++ tools/revpals.py | 40 +++ 6 files changed, 495 insertions(+), 259 deletions(-) create mode 100644 tools/gbcpal.c create mode 100755 tools/revpals.py diff --git a/Makefile b/Makefile index 05d64d3bc82..6fe7a482e9a 100644 --- a/Makefile +++ b/Makefile @@ -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 @@ -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 $< $@ diff --git a/data/pokemon/palettes.asm b/data/pokemon/palettes.asm index 5cefbd38ea5..1ea96302d3d 100644 --- a/data/pokemon/palettes.asm +++ b/data/pokemon/palettes.asm @@ -1,11 +1,11 @@ PokemonPalettes: ; entries correspond to Pokémon species, two apiece -; Each front.gbcpal is generated from the corresponding .png, and +; Each normal.gbcpal is generated from the corresponding .png, and ; only the middle two colors are included, not black or white. ; Shiny palettes are defined directly, not generated. - ; 2 middle palettes, front and shiny, with 2 colors each + ; 2 middle palettes, normal and shiny, with 2 colors each table_width PAL_COLOR_SIZE * 2 * 2, PokemonPalettes ; 000 @@ -15,507 +15,507 @@ PokemonPalettes: RGB 30, 22, 17 RGB 16, 14, 19 -INCBIN "gfx/pokemon/bulbasaur/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/bulbasaur/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/bulbasaur/shiny.pal" -INCBIN "gfx/pokemon/ivysaur/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/ivysaur/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/ivysaur/shiny.pal" -INCBIN "gfx/pokemon/venusaur/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/venusaur/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/venusaur/shiny.pal" -INCBIN "gfx/pokemon/charmander/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/charmander/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/charmander/shiny.pal" -INCBIN "gfx/pokemon/charmeleon/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/charmeleon/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/charmeleon/shiny.pal" -INCBIN "gfx/pokemon/charizard/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/charizard/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/charizard/shiny.pal" -INCBIN "gfx/pokemon/squirtle/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/squirtle/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/squirtle/shiny.pal" -INCBIN "gfx/pokemon/wartortle/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/wartortle/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/wartortle/shiny.pal" -INCBIN "gfx/pokemon/blastoise/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/blastoise/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/blastoise/shiny.pal" -INCBIN "gfx/pokemon/caterpie/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/caterpie/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/caterpie/shiny.pal" -INCBIN "gfx/pokemon/metapod/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/metapod/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/metapod/shiny.pal" -INCBIN "gfx/pokemon/butterfree/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/butterfree/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/butterfree/shiny.pal" -INCBIN "gfx/pokemon/weedle/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/weedle/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/weedle/shiny.pal" -INCBIN "gfx/pokemon/kakuna/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/kakuna/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/kakuna/shiny.pal" -INCBIN "gfx/pokemon/beedrill/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/beedrill/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/beedrill/shiny.pal" -INCBIN "gfx/pokemon/pidgey/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/pidgey/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/pidgey/shiny.pal" -INCBIN "gfx/pokemon/pidgeotto/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/pidgeotto/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/pidgeotto/shiny.pal" -INCBIN "gfx/pokemon/pidgeot/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/pidgeot/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/pidgeot/shiny.pal" -INCBIN "gfx/pokemon/rattata/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/rattata/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/rattata/shiny.pal" -INCBIN "gfx/pokemon/raticate/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/raticate/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/raticate/shiny.pal" -INCBIN "gfx/pokemon/spearow/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/spearow/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/spearow/shiny.pal" -INCBIN "gfx/pokemon/fearow/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/fearow/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/fearow/shiny.pal" -INCBIN "gfx/pokemon/ekans/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/ekans/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/ekans/shiny.pal" -INCBIN "gfx/pokemon/arbok/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/arbok/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/arbok/shiny.pal" -INCBIN "gfx/pokemon/pikachu/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/pikachu/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/pikachu/shiny.pal" -INCBIN "gfx/pokemon/raichu/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/raichu/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/raichu/shiny.pal" -INCBIN "gfx/pokemon/sandshrew/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/sandshrew/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/sandshrew/shiny.pal" -INCBIN "gfx/pokemon/sandslash/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/sandslash/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/sandslash/shiny.pal" -INCBIN "gfx/pokemon/nidoran_f/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/nidoran_f/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/nidoran_f/shiny.pal" -INCBIN "gfx/pokemon/nidorina/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/nidorina/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/nidorina/shiny.pal" -INCBIN "gfx/pokemon/nidoqueen/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/nidoqueen/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/nidoqueen/shiny.pal" -INCBIN "gfx/pokemon/nidoran_m/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/nidoran_m/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/nidoran_m/shiny.pal" -INCBIN "gfx/pokemon/nidorino/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/nidorino/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/nidorino/shiny.pal" -INCBIN "gfx/pokemon/nidoking/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/nidoking/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/nidoking/shiny.pal" -INCBIN "gfx/pokemon/clefairy/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/clefairy/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/clefairy/shiny.pal" -INCBIN "gfx/pokemon/clefable/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/clefable/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/clefable/shiny.pal" -INCBIN "gfx/pokemon/vulpix/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/vulpix/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/vulpix/shiny.pal" -INCBIN "gfx/pokemon/ninetales/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/ninetales/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/ninetales/shiny.pal" -INCBIN "gfx/pokemon/jigglypuff/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/jigglypuff/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/jigglypuff/shiny.pal" -INCBIN "gfx/pokemon/wigglytuff/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/wigglytuff/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/wigglytuff/shiny.pal" -INCBIN "gfx/pokemon/zubat/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/zubat/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/zubat/shiny.pal" -INCBIN "gfx/pokemon/golbat/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/golbat/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/golbat/shiny.pal" -INCBIN "gfx/pokemon/oddish/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/oddish/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/oddish/shiny.pal" -INCBIN "gfx/pokemon/gloom/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/gloom/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/gloom/shiny.pal" -INCBIN "gfx/pokemon/vileplume/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/vileplume/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/vileplume/shiny.pal" -INCBIN "gfx/pokemon/paras/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/paras/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/paras/shiny.pal" -INCBIN "gfx/pokemon/parasect/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/parasect/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/parasect/shiny.pal" -INCBIN "gfx/pokemon/venonat/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/venonat/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/venonat/shiny.pal" -INCBIN "gfx/pokemon/venomoth/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/venomoth/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/venomoth/shiny.pal" -INCBIN "gfx/pokemon/diglett/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/diglett/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/diglett/shiny.pal" -INCBIN "gfx/pokemon/dugtrio/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/dugtrio/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/dugtrio/shiny.pal" -INCBIN "gfx/pokemon/meowth/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/meowth/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/meowth/shiny.pal" -INCBIN "gfx/pokemon/persian/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/persian/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/persian/shiny.pal" -INCBIN "gfx/pokemon/psyduck/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/psyduck/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/psyduck/shiny.pal" -INCBIN "gfx/pokemon/golduck/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/golduck/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/golduck/shiny.pal" -INCBIN "gfx/pokemon/mankey/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/mankey/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/mankey/shiny.pal" -INCBIN "gfx/pokemon/primeape/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/primeape/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/primeape/shiny.pal" -INCBIN "gfx/pokemon/growlithe/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/growlithe/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/growlithe/shiny.pal" -INCBIN "gfx/pokemon/arcanine/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/arcanine/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/arcanine/shiny.pal" -INCBIN "gfx/pokemon/poliwag/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/poliwag/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/poliwag/shiny.pal" -INCBIN "gfx/pokemon/poliwhirl/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/poliwhirl/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/poliwhirl/shiny.pal" -INCBIN "gfx/pokemon/poliwrath/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/poliwrath/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/poliwrath/shiny.pal" -INCBIN "gfx/pokemon/abra/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/abra/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/abra/shiny.pal" -INCBIN "gfx/pokemon/kadabra/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/kadabra/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/kadabra/shiny.pal" -INCBIN "gfx/pokemon/alakazam/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/alakazam/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/alakazam/shiny.pal" -INCBIN "gfx/pokemon/machop/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/machop/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/machop/shiny.pal" -INCBIN "gfx/pokemon/machoke/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/machoke/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/machoke/shiny.pal" -INCBIN "gfx/pokemon/machamp/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/machamp/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/machamp/shiny.pal" -INCBIN "gfx/pokemon/bellsprout/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/bellsprout/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/bellsprout/shiny.pal" -INCBIN "gfx/pokemon/weepinbell/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/weepinbell/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/weepinbell/shiny.pal" -INCBIN "gfx/pokemon/victreebel/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/victreebel/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/victreebel/shiny.pal" -INCBIN "gfx/pokemon/tentacool/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/tentacool/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/tentacool/shiny.pal" -INCBIN "gfx/pokemon/tentacruel/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/tentacruel/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/tentacruel/shiny.pal" -INCBIN "gfx/pokemon/geodude/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/geodude/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/geodude/shiny.pal" -INCBIN "gfx/pokemon/graveler/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/graveler/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/graveler/shiny.pal" -INCBIN "gfx/pokemon/golem/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/golem/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/golem/shiny.pal" -INCBIN "gfx/pokemon/ponyta/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/ponyta/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/ponyta/shiny.pal" -INCBIN "gfx/pokemon/rapidash/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/rapidash/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/rapidash/shiny.pal" -INCBIN "gfx/pokemon/slowpoke/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/slowpoke/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/slowpoke/shiny.pal" -INCBIN "gfx/pokemon/slowbro/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/slowbro/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/slowbro/shiny.pal" -INCBIN "gfx/pokemon/magnemite/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/magnemite/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/magnemite/shiny.pal" -INCBIN "gfx/pokemon/magneton/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/magneton/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/magneton/shiny.pal" -INCBIN "gfx/pokemon/farfetch_d/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/farfetch_d/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/farfetch_d/shiny.pal" -INCBIN "gfx/pokemon/doduo/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/doduo/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/doduo/shiny.pal" -INCBIN "gfx/pokemon/dodrio/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/dodrio/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/dodrio/shiny.pal" -INCBIN "gfx/pokemon/seel/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/seel/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/seel/shiny.pal" -INCBIN "gfx/pokemon/dewgong/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/dewgong/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/dewgong/shiny.pal" -INCBIN "gfx/pokemon/grimer/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/grimer/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/grimer/shiny.pal" -INCBIN "gfx/pokemon/muk/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/muk/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/muk/shiny.pal" -INCBIN "gfx/pokemon/shellder/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/shellder/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/shellder/shiny.pal" -INCBIN "gfx/pokemon/cloyster/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/cloyster/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/cloyster/shiny.pal" -INCBIN "gfx/pokemon/gastly/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/gastly/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/gastly/shiny.pal" -INCBIN "gfx/pokemon/haunter/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/haunter/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/haunter/shiny.pal" -INCBIN "gfx/pokemon/gengar/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/gengar/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/gengar/shiny.pal" -INCBIN "gfx/pokemon/onix/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/onix/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/onix/shiny.pal" -INCBIN "gfx/pokemon/drowzee/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/drowzee/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/drowzee/shiny.pal" -INCBIN "gfx/pokemon/hypno/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/hypno/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/hypno/shiny.pal" -INCBIN "gfx/pokemon/krabby/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/krabby/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/krabby/shiny.pal" -INCBIN "gfx/pokemon/kingler/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/kingler/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/kingler/shiny.pal" -INCBIN "gfx/pokemon/voltorb/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/voltorb/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/voltorb/shiny.pal" -INCBIN "gfx/pokemon/electrode/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/electrode/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/electrode/shiny.pal" -INCBIN "gfx/pokemon/exeggcute/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/exeggcute/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/exeggcute/shiny.pal" -INCBIN "gfx/pokemon/exeggutor/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/exeggutor/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/exeggutor/shiny.pal" -INCBIN "gfx/pokemon/cubone/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/cubone/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/cubone/shiny.pal" -INCBIN "gfx/pokemon/marowak/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/marowak/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/marowak/shiny.pal" -INCBIN "gfx/pokemon/hitmonlee/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/hitmonlee/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/hitmonlee/shiny.pal" -INCBIN "gfx/pokemon/hitmonchan/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/hitmonchan/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/hitmonchan/shiny.pal" -INCBIN "gfx/pokemon/lickitung/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/lickitung/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/lickitung/shiny.pal" -INCBIN "gfx/pokemon/koffing/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/koffing/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/koffing/shiny.pal" -INCBIN "gfx/pokemon/weezing/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/weezing/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/weezing/shiny.pal" -INCBIN "gfx/pokemon/rhyhorn/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/rhyhorn/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/rhyhorn/shiny.pal" -INCBIN "gfx/pokemon/rhydon/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/rhydon/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/rhydon/shiny.pal" -INCBIN "gfx/pokemon/chansey/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/chansey/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/chansey/shiny.pal" -INCBIN "gfx/pokemon/tangela/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/tangela/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/tangela/shiny.pal" -INCBIN "gfx/pokemon/kangaskhan/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/kangaskhan/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/kangaskhan/shiny.pal" -INCBIN "gfx/pokemon/horsea/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/horsea/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/horsea/shiny.pal" -INCBIN "gfx/pokemon/seadra/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/seadra/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/seadra/shiny.pal" -INCBIN "gfx/pokemon/goldeen/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/goldeen/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/goldeen/shiny.pal" -INCBIN "gfx/pokemon/seaking/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/seaking/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/seaking/shiny.pal" -INCBIN "gfx/pokemon/staryu/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/staryu/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/staryu/shiny.pal" -INCBIN "gfx/pokemon/starmie/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/starmie/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/starmie/shiny.pal" -INCBIN "gfx/pokemon/mr__mime/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/mr__mime/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/mr__mime/shiny.pal" -INCBIN "gfx/pokemon/scyther/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/scyther/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/scyther/shiny.pal" -INCBIN "gfx/pokemon/jynx/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/jynx/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/jynx/shiny.pal" -INCBIN "gfx/pokemon/electabuzz/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/electabuzz/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/electabuzz/shiny.pal" -INCBIN "gfx/pokemon/magmar/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/magmar/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/magmar/shiny.pal" -INCBIN "gfx/pokemon/pinsir/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/pinsir/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/pinsir/shiny.pal" -INCBIN "gfx/pokemon/tauros/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/tauros/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/tauros/shiny.pal" -INCBIN "gfx/pokemon/magikarp/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/magikarp/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/magikarp/shiny.pal" -INCBIN "gfx/pokemon/gyarados/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/gyarados/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/gyarados/shiny.pal" -INCBIN "gfx/pokemon/lapras/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/lapras/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/lapras/shiny.pal" -INCBIN "gfx/pokemon/ditto/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/ditto/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/ditto/shiny.pal" -INCBIN "gfx/pokemon/eevee/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/eevee/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/eevee/shiny.pal" -INCBIN "gfx/pokemon/vaporeon/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/vaporeon/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/vaporeon/shiny.pal" -INCBIN "gfx/pokemon/jolteon/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/jolteon/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/jolteon/shiny.pal" -INCBIN "gfx/pokemon/flareon/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/flareon/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/flareon/shiny.pal" -INCBIN "gfx/pokemon/porygon/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/porygon/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/porygon/shiny.pal" -INCBIN "gfx/pokemon/omanyte/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/omanyte/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/omanyte/shiny.pal" -INCBIN "gfx/pokemon/omastar/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/omastar/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/omastar/shiny.pal" -INCBIN "gfx/pokemon/kabuto/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/kabuto/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/kabuto/shiny.pal" -INCBIN "gfx/pokemon/kabutops/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/kabutops/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/kabutops/shiny.pal" -INCBIN "gfx/pokemon/aerodactyl/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/aerodactyl/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/aerodactyl/shiny.pal" -INCBIN "gfx/pokemon/snorlax/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/snorlax/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/snorlax/shiny.pal" -INCBIN "gfx/pokemon/articuno/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/articuno/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/articuno/shiny.pal" -INCBIN "gfx/pokemon/zapdos/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/zapdos/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/zapdos/shiny.pal" -INCBIN "gfx/pokemon/moltres/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/moltres/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/moltres/shiny.pal" -INCBIN "gfx/pokemon/dratini/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/dratini/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/dratini/shiny.pal" -INCBIN "gfx/pokemon/dragonair/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/dragonair/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/dragonair/shiny.pal" -INCBIN "gfx/pokemon/dragonite/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/dragonite/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/dragonite/shiny.pal" -INCBIN "gfx/pokemon/mewtwo/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/mewtwo/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/mewtwo/shiny.pal" -INCBIN "gfx/pokemon/mew/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/mew/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/mew/shiny.pal" -INCBIN "gfx/pokemon/chikorita/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/chikorita/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/chikorita/shiny.pal" -INCBIN "gfx/pokemon/bayleef/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/bayleef/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/bayleef/shiny.pal" -INCBIN "gfx/pokemon/meganium/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/meganium/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/meganium/shiny.pal" -INCBIN "gfx/pokemon/cyndaquil/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/cyndaquil/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/cyndaquil/shiny.pal" -INCBIN "gfx/pokemon/quilava/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/quilava/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/quilava/shiny.pal" -INCBIN "gfx/pokemon/typhlosion/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/typhlosion/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/typhlosion/shiny.pal" -INCBIN "gfx/pokemon/totodile/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/totodile/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/totodile/shiny.pal" -INCBIN "gfx/pokemon/croconaw/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/croconaw/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/croconaw/shiny.pal" -INCBIN "gfx/pokemon/feraligatr/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/feraligatr/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/feraligatr/shiny.pal" -INCBIN "gfx/pokemon/sentret/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/sentret/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/sentret/shiny.pal" -INCBIN "gfx/pokemon/furret/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/furret/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/furret/shiny.pal" -INCBIN "gfx/pokemon/hoothoot/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/hoothoot/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/hoothoot/shiny.pal" -INCBIN "gfx/pokemon/noctowl/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/noctowl/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/noctowl/shiny.pal" -INCBIN "gfx/pokemon/ledyba/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/ledyba/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/ledyba/shiny.pal" -INCBIN "gfx/pokemon/ledian/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/ledian/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/ledian/shiny.pal" -INCBIN "gfx/pokemon/spinarak/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/spinarak/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/spinarak/shiny.pal" -INCBIN "gfx/pokemon/ariados/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/ariados/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/ariados/shiny.pal" -INCBIN "gfx/pokemon/crobat/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/crobat/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/crobat/shiny.pal" -INCBIN "gfx/pokemon/chinchou/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/chinchou/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/chinchou/shiny.pal" -INCBIN "gfx/pokemon/lanturn/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/lanturn/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/lanturn/shiny.pal" -INCBIN "gfx/pokemon/pichu/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/pichu/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/pichu/shiny.pal" -INCBIN "gfx/pokemon/cleffa/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/cleffa/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/cleffa/shiny.pal" -INCBIN "gfx/pokemon/igglybuff/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/igglybuff/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/igglybuff/shiny.pal" -INCBIN "gfx/pokemon/togepi/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/togepi/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/togepi/shiny.pal" -INCBIN "gfx/pokemon/togetic/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/togetic/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/togetic/shiny.pal" -INCBIN "gfx/pokemon/natu/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/natu/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/natu/shiny.pal" -INCBIN "gfx/pokemon/xatu/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/xatu/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/xatu/shiny.pal" -INCBIN "gfx/pokemon/mareep/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/mareep/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/mareep/shiny.pal" -INCBIN "gfx/pokemon/flaaffy/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/flaaffy/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/flaaffy/shiny.pal" -INCBIN "gfx/pokemon/ampharos/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/ampharos/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/ampharos/shiny.pal" -INCBIN "gfx/pokemon/bellossom/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/bellossom/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/bellossom/shiny.pal" -INCBIN "gfx/pokemon/marill/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/marill/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/marill/shiny.pal" -INCBIN "gfx/pokemon/azumarill/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/azumarill/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/azumarill/shiny.pal" -INCBIN "gfx/pokemon/sudowoodo/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/sudowoodo/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/sudowoodo/shiny.pal" -INCBIN "gfx/pokemon/politoed/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/politoed/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/politoed/shiny.pal" -INCBIN "gfx/pokemon/hoppip/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/hoppip/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/hoppip/shiny.pal" -INCBIN "gfx/pokemon/skiploom/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/skiploom/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/skiploom/shiny.pal" -INCBIN "gfx/pokemon/jumpluff/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/jumpluff/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/jumpluff/shiny.pal" -INCBIN "gfx/pokemon/aipom/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/aipom/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/aipom/shiny.pal" -INCBIN "gfx/pokemon/sunkern/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/sunkern/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/sunkern/shiny.pal" -INCBIN "gfx/pokemon/sunflora/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/sunflora/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/sunflora/shiny.pal" -INCBIN "gfx/pokemon/yanma/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/yanma/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/yanma/shiny.pal" -INCBIN "gfx/pokemon/wooper/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/wooper/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/wooper/shiny.pal" -INCBIN "gfx/pokemon/quagsire/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/quagsire/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/quagsire/shiny.pal" -INCBIN "gfx/pokemon/espeon/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/espeon/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/espeon/shiny.pal" -INCBIN "gfx/pokemon/umbreon/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/umbreon/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/umbreon/shiny.pal" -INCBIN "gfx/pokemon/murkrow/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/murkrow/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/murkrow/shiny.pal" -INCBIN "gfx/pokemon/slowking/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/slowking/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/slowking/shiny.pal" -INCBIN "gfx/pokemon/misdreavus/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/misdreavus/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/misdreavus/shiny.pal" -INCLUDE "gfx/pokemon/unown/normal.pal" ; not front.gbcpal +INCLUDE "gfx/pokemon/unown/normal.pal" ; not normal.gbcpal INCLUDE "gfx/pokemon/unown/shiny.pal" -INCBIN "gfx/pokemon/wobbuffet/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/wobbuffet/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/wobbuffet/shiny.pal" -INCBIN "gfx/pokemon/girafarig/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/girafarig/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/girafarig/shiny.pal" -INCBIN "gfx/pokemon/pineco/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/pineco/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/pineco/shiny.pal" -INCBIN "gfx/pokemon/forretress/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/forretress/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/forretress/shiny.pal" -INCBIN "gfx/pokemon/dunsparce/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/dunsparce/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/dunsparce/shiny.pal" -INCBIN "gfx/pokemon/gligar/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/gligar/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/gligar/shiny.pal" -INCBIN "gfx/pokemon/steelix/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/steelix/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/steelix/shiny.pal" -INCBIN "gfx/pokemon/snubbull/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/snubbull/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/snubbull/shiny.pal" -INCBIN "gfx/pokemon/granbull/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/granbull/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/granbull/shiny.pal" -INCBIN "gfx/pokemon/qwilfish/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/qwilfish/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/qwilfish/shiny.pal" -INCBIN "gfx/pokemon/scizor/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/scizor/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/scizor/shiny.pal" -INCBIN "gfx/pokemon/shuckle/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/shuckle/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/shuckle/shiny.pal" -INCBIN "gfx/pokemon/heracross/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/heracross/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/heracross/shiny.pal" -INCBIN "gfx/pokemon/sneasel/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/sneasel/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/sneasel/shiny.pal" -INCBIN "gfx/pokemon/teddiursa/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/teddiursa/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/teddiursa/shiny.pal" -INCBIN "gfx/pokemon/ursaring/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/ursaring/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/ursaring/shiny.pal" -INCBIN "gfx/pokemon/slugma/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/slugma/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/slugma/shiny.pal" -INCBIN "gfx/pokemon/magcargo/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/magcargo/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/magcargo/shiny.pal" -INCBIN "gfx/pokemon/swinub/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/swinub/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/swinub/shiny.pal" -INCBIN "gfx/pokemon/piloswine/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/piloswine/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/piloswine/shiny.pal" -INCBIN "gfx/pokemon/corsola/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/corsola/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/corsola/shiny.pal" -INCBIN "gfx/pokemon/remoraid/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/remoraid/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/remoraid/shiny.pal" -INCBIN "gfx/pokemon/octillery/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/octillery/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/octillery/shiny.pal" -INCBIN "gfx/pokemon/delibird/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/delibird/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/delibird/shiny.pal" -INCBIN "gfx/pokemon/mantine/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/mantine/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/mantine/shiny.pal" -INCBIN "gfx/pokemon/skarmory/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/skarmory/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/skarmory/shiny.pal" -INCBIN "gfx/pokemon/houndour/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/houndour/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/houndour/shiny.pal" -INCBIN "gfx/pokemon/houndoom/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/houndoom/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/houndoom/shiny.pal" -INCBIN "gfx/pokemon/kingdra/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/kingdra/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/kingdra/shiny.pal" -INCBIN "gfx/pokemon/phanpy/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/phanpy/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/phanpy/shiny.pal" -INCBIN "gfx/pokemon/donphan/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/donphan/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/donphan/shiny.pal" -INCBIN "gfx/pokemon/porygon2/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/porygon2/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/porygon2/shiny.pal" -INCBIN "gfx/pokemon/stantler/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/stantler/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/stantler/shiny.pal" -INCBIN "gfx/pokemon/smeargle/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/smeargle/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/smeargle/shiny.pal" -INCBIN "gfx/pokemon/tyrogue/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/tyrogue/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/tyrogue/shiny.pal" -INCBIN "gfx/pokemon/hitmontop/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/hitmontop/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/hitmontop/shiny.pal" -INCBIN "gfx/pokemon/smoochum/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/smoochum/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/smoochum/shiny.pal" -INCBIN "gfx/pokemon/elekid/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/elekid/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/elekid/shiny.pal" -INCBIN "gfx/pokemon/magby/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/magby/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/magby/shiny.pal" -INCBIN "gfx/pokemon/miltank/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/miltank/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/miltank/shiny.pal" -INCBIN "gfx/pokemon/blissey/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/blissey/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/blissey/shiny.pal" -INCBIN "gfx/pokemon/raikou/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/raikou/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/raikou/shiny.pal" -INCBIN "gfx/pokemon/entei/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/entei/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/entei/shiny.pal" -INCBIN "gfx/pokemon/suicune/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/suicune/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/suicune/shiny.pal" -INCBIN "gfx/pokemon/larvitar/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/larvitar/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/larvitar/shiny.pal" -INCBIN "gfx/pokemon/pupitar/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/pupitar/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/pupitar/shiny.pal" -INCBIN "gfx/pokemon/tyranitar/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/tyranitar/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/tyranitar/shiny.pal" -INCBIN "gfx/pokemon/lugia/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/lugia/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/lugia/shiny.pal" -INCBIN "gfx/pokemon/ho_oh/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/ho_oh/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/ho_oh/shiny.pal" -INCBIN "gfx/pokemon/celebi/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/celebi/normal.gbcpal", middle_colors INCLUDE "gfx/pokemon/celebi/shiny.pal" assert_table_length NUM_POKEMON + 1 @@ -527,7 +527,7 @@ INCLUDE "gfx/pokemon/celebi/shiny.pal" RGB 30, 26, 11 RGB 23, 16, 00 -INCBIN "gfx/pokemon/egg/front.gbcpal", middle_colors +INCBIN "gfx/pokemon/egg/front.gbcpal", middle_colors ; not normal.gbcpal INCLUDE "gfx/pokemon/egg/shiny.pal" assert_table_length EGG + 1 diff --git a/tools/.gitignore b/tools/.gitignore index 7825a9e6549..f7759dbe050 100644 --- a/tools/.gitignore +++ b/tools/.gitignore @@ -1,4 +1,5 @@ bpp2png +gbcpal gfx lzcomp make_patch diff --git a/tools/Makefile b/tools/Makefile index 3c213f0d05d..f244f2ef51c 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -6,6 +6,7 @@ CFLAGS := -O3 -flto -std=c11 -Wall -Wextra -pedantic tools := \ bpp2png \ lzcomp \ + gbcpal \ gfx \ make_patch \ png_dimensions \ @@ -20,6 +21,7 @@ all: $(tools) clean: $(RM) $(tools) +gbcpal: common.h gfx: common.h png_dimensions: common.h pokemon_animation: common.h diff --git a/tools/gbcpal.c b/tools/gbcpal.c new file mode 100644 index 00000000000..d0d484d8366 --- /dev/null +++ b/tools/gbcpal.c @@ -0,0 +1,156 @@ +#define PROGRAM_NAME "gbcpal" +#define USAGE_OPTS "[-h|--help] [-r|--reverse] out.gbcpal [in.gbcpal...]" + +#include "common.h" + +bool reverse; + +void parse_args(int argc, char *argv[]) { + struct option long_options[] = { + {"reverse", no_argument, 0, 'r'}, + {"help", no_argument, 0, 'h'}, + {0} + }; + for (int opt; (opt = getopt_long(argc, argv, "rh", long_options)) != -1;) { + switch (opt) { + case 'r': + reverse = true; + break; + case 'h': + usage_exit(0); + break; + default: + usage_exit(1); + } + } +} + +struct Color { + uint8_t r, g, b; +}; + +uint16_t pack_color(struct Color color) { + return (color.b << 10) | (color.g << 5) | color.r; +} + +struct Color unpack_color(uint8_t lo, uint8_t hi) { + return (struct Color){ + .r = lo & 0x1f, + .g = ((hi << 3) & 0x18) | ((lo >> 5) & 0x07), + .b = (hi >> 2) & 0x1f, + }; +} + +double luminance(struct Color color) { + return 0.299 * color.r * color.r + 0.587 * color.g * color.g + 0.114 * color.b * color.b; +} + +int compare_colors(const void *color1, const void *color2) { + double lum1 = luminance(*(const struct Color *)color1); + double lum2 = luminance(*(const struct Color *)color2); + return lum1 < lum2 ? 1 : lum1 > lum2 ? -1 : 0; +} + +void read_gbcpal(const char *filename, struct Color **colors, size_t *num_colors) { + long filesize; + uint8_t *bytes = read_u8(filename, &filesize); + if (filesize == 0) { + error_exit("%s: empty gbcpal file\n", filename); + } + if (filesize % 2) { + error_exit("%s: invalid gbcpal file\n", filename); + } + + size_t new_colors = filesize / 2; + *colors = xrealloc(*colors, (sizeof **colors) * (*num_colors + new_colors)); + for (size_t i = 0; i < new_colors; i++) { + (*colors)[*num_colors + i] = unpack_color(bytes[i * 2], bytes[i * 2 + 1]); + } + *num_colors += new_colors; + + free(bytes); +} + +void filter_colors(struct Color **colors, size_t *num_colors) { + size_t num_filtered = 0; + struct Color *filtered = xmalloc((sizeof **colors) * *num_colors); + + for (size_t i = 0; i < *num_colors; i++) { + struct Color color = (*colors)[i]; + if (color.r == 0 && color.g == 0 && color.b == 0) { + continue; // filter out black + } + if (color.r == 31 && color.g == 31 && color.b == 31) { + continue; // filter out white + } + if (num_filtered > 0) { + struct Color last = filtered[num_filtered - 1]; + if (color.r == last.r && color.g == last.g && color.b == last.b) { + continue; // filter out duplicates + } + } + filtered[num_filtered++] = color; + } + + free(*colors); + *num_colors = num_filtered; + *colors = filtered; +} + +int main(int argc, char *argv[]) { + parse_args(argc, argv); + + argc -= optind; + argv += optind; + if (argc < 1) { + usage_exit(1); + } + + const char *out_filename = argv[0]; + + struct Color *colors = NULL; + size_t num_colors = 0; + if (argc == 1) { + read_gbcpal(out_filename, &colors, &num_colors); + } + for (int i = 1; i < argc; i++) { + read_gbcpal(argv[i], &colors, &num_colors); + } + + qsort(colors, num_colors, sizeof(*colors), compare_colors); + filter_colors(&colors, &num_colors); + + uint16_t first, second; + if (num_colors == 0) { + // colors are white and black + first = 0x7fff; + second = 0x0000; + } else if (num_colors == 1) { + // colors are both the same one + first = pack_color(colors[0]); + second = first; + } else if (num_colors == 2) { + // colors are light and dark + first = pack_color(colors[0]); + second = pack_color(colors[1]); + if (reverse) { + // darker color is first + uint16_t tmp = first; + first = second; + second = tmp; + } + } else { + error_exit("%s: more than 2 colors besides black and white (%zu)\n", out_filename, num_colors); + } + + uint8_t bytes[8] = { + 0xff, 0x7f, // white + first & 0xff, first >> 8, + second & 0xff, second >> 8, + 0x00, 0x00, // black + }; + write_u8(out_filename, bytes, COUNTOF(bytes)); + + free(colors); + return 0; +} diff --git a/tools/revpals.py b/tools/revpals.py new file mode 100755 index 00000000000..edfdc63ec27 --- /dev/null +++ b/tools/revpals.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +""" +Usage: python revpals.py + +List Pokemon and trainer sprites with reversed palettes (darker color first). +""" + +import sys +import glob + +import png + +def luminance(c): + r, g, b = c + return 0.299 * r**2 + 0.587 * g**2 + 0.114 * b**2 + +def is_reversed(filename): + with open(filename, 'rb') as file: + reader = png.Reader(file) + reader.preamble() + try: + palette = [c[:3] for c in reader.palette()] + except: + return False + if len(palette) != 4 or palette[0] != (255, 255, 255) or palette[3] != (0, 0, 0): + return False + return luminance(palette[1]) < luminance(palette[2]) + +def main(): + for filename in sorted(glob.glob('gfx/pokemon/*/front.png')): + if is_reversed(filename): + print(filename) + for filename in sorted(glob.glob('gfx/trainers/*.png')): + if is_reversed(filename): + print(filename) + +if __name__ == '__main__': + main() From f99f0e69557f2f3e3b6e0b00137c6c797bf70390 Mon Sep 17 00:00:00 2001 From: Rangi42 Date: Wed, 28 Aug 2024 13:17:25 -0400 Subject: [PATCH 2/8] Use long option flags for rgbgfx, same as tools/gfx --- Makefile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 6fe7a482e9a..fef1e369606 100644 --- a/Makefile +++ b/Makefile @@ -210,14 +210,14 @@ gfx/pokemon/girafarig/front.animated.tilemap: gfx/pokemon/girafarig/front.2bpp g ### Pokemon and trainer sprite rules gfx/pokemon/%/back.2bpp: gfx/pokemon/%/back.png gfx/pokemon/%/normal.gbcpal - $(RGBGFX) -Z -c gbc:$(word 2,$^) -o $@ $< + $(RGBGFX) --columns --colors gbc:$(word 2,$^) -o $@ $< gfx/pokemon/%/front.2bpp: gfx/pokemon/%/front.png gfx/pokemon/%/normal.gbcpal - $(RGBGFX) -c gbc:$(word 2,$^) -o $@ $< + $(RGBGFX) --colors 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 $@ $< + $(RGBGFX) --columns --colors gbc:$(word 2,$^) -o $@ $< ### Rules to match specific Pokemon and trainer sprites @@ -240,12 +240,12 @@ 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,$^) +gfx/pokemon/egg/front.2bpp: rgbgfx += --colors 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) +gfx/pokemon/unown_%/front.2bpp: rgbgfx += --colors gbc:$(@:front.2bpp=normal.gbcpal) ### Misc file-specific graphics rules From c0173db27c6c13509026c65303ea29d1da6fc766 Mon Sep 17 00:00:00 2001 From: Rangi42 Date: Wed, 28 Aug 2024 13:21:16 -0400 Subject: [PATCH 3/8] Separate the usual rgbgfx flags from the `--color` specification --- Makefile | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index fef1e369606..3abec3db47d 100644 --- a/Makefile +++ b/Makefile @@ -209,15 +209,19 @@ gfx/pokemon/girafarig/front.animated.tilemap: gfx/pokemon/girafarig/front.2bpp g ### Pokemon and trainer sprite rules +gfx/pokemon/%/back.2bpp: rgbgfx += --columns + +gfx/trainers/%.2bpp: rgbgfx += --columns + gfx/pokemon/%/back.2bpp: gfx/pokemon/%/back.png gfx/pokemon/%/normal.gbcpal - $(RGBGFX) --columns --colors gbc:$(word 2,$^) -o $@ $< + $(RGBGFX) $(rgbgfx) --colors gbc:$(word 2,$^) -o $@ $< gfx/pokemon/%/front.2bpp: gfx/pokemon/%/front.png gfx/pokemon/%/normal.gbcpal - $(RGBGFX) --colors gbc:$(word 2,$^) -o $@ $< + $(RGBGFX) $(rgbgfx) --colors 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) --columns --colors gbc:$(word 2,$^) -o $@ $< + $(RGBGFX) $(rgbgfx) --colors gbc:$(word 2,$^) -o $@ $< ### Rules to match specific Pokemon and trainer sprites From 4783ffff6b7caef7c026f92c482e862b3d70d2b1 Mon Sep 17 00:00:00 2001 From: Rangi42 Date: Wed, 28 Aug 2024 13:26:05 -0400 Subject: [PATCH 4/8] Reorganize some Makefile rules --- Makefile | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index 3abec3db47d..3f7d4c99392 100644 --- a/Makefile +++ b/Makefile @@ -210,9 +210,6 @@ gfx/pokemon/girafarig/front.animated.tilemap: gfx/pokemon/girafarig/front.2bpp g ### Pokemon and trainer sprite rules gfx/pokemon/%/back.2bpp: rgbgfx += --columns - -gfx/trainers/%.2bpp: rgbgfx += --columns - gfx/pokemon/%/back.2bpp: gfx/pokemon/%/back.png gfx/pokemon/%/normal.gbcpal $(RGBGFX) $(rgbgfx) --colors gbc:$(word 2,$^) -o $@ $< gfx/pokemon/%/front.2bpp: gfx/pokemon/%/front.png gfx/pokemon/%/normal.gbcpal @@ -220,11 +217,23 @@ gfx/pokemon/%/front.2bpp: gfx/pokemon/%/front.png gfx/pokemon/%/normal.gbcpal gfx/pokemon/%/normal.gbcpal: gfx/pokemon/%/front.gbcpal gfx/pokemon/%/back.gbcpal tools/gbcpal $(tools/gbcpal) $@ $^ +gfx/trainers/%.2bpp: rgbgfx += --columns gfx/trainers/%.2bpp: gfx/trainers/%.png gfx/trainers/%.gbcpal $(RGBGFX) $(rgbgfx) --colors gbc:$(word 2,$^) -o $@ $< +# 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 += --colors 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 += --colors gbc:$(@:front.2bpp=normal.gbcpal) + + +### Misc file-specific graphics rules -### Rules to match specific Pokemon and trainer sprites +gfx/pokemon/egg/unused_front.2bpp: rgbgfx += --columns gfx/pokemon/caterpie/normal.gbcpal: tools/gbcpal += --reverse gfx/pokemon/diglett/normal.gbcpal: tools/gbcpal += --reverse @@ -242,20 +251,6 @@ gfx/pokemon/spearow/normal.gbcpal: tools/gbcpal += --reverse 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 += --colors 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 += --colors gbc:$(@:front.2bpp=normal.gbcpal) - - -### Misc file-specific graphics rules - -gfx/pokemon/egg/unused_front.2bpp: rgbgfx += --columns - gfx/new_game/shrink1.2bpp: rgbgfx += --columns gfx/new_game/shrink2.2bpp: rgbgfx += --columns From 56f20b2e5d90bcd07a655aef05b37b78a083fb7c Mon Sep 17 00:00:00 2001 From: Rangi42 Date: Sat, 31 Aug 2024 11:08:29 -0400 Subject: [PATCH 5/8] Pass a `uint16_t` to `unpack_color` --- tools/gbcpal.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tools/gbcpal.c b/tools/gbcpal.c index d0d484d8366..fdca04b2299 100644 --- a/tools/gbcpal.c +++ b/tools/gbcpal.c @@ -33,11 +33,11 @@ uint16_t pack_color(struct Color color) { return (color.b << 10) | (color.g << 5) | color.r; } -struct Color unpack_color(uint8_t lo, uint8_t hi) { +struct Color unpack_color(uint16_t gbc_color) { return (struct Color){ - .r = lo & 0x1f, - .g = ((hi << 3) & 0x18) | ((lo >> 5) & 0x07), - .b = (hi >> 2) & 0x1f, + .r = gbc_color & 0x1f, + .g = (gbc_color >> 5) & 0x1f, + .b = (gbc_color >> 10) & 0x1f, }; } @@ -64,7 +64,8 @@ void read_gbcpal(const char *filename, struct Color **colors, size_t *num_colors size_t new_colors = filesize / 2; *colors = xrealloc(*colors, (sizeof **colors) * (*num_colors + new_colors)); for (size_t i = 0; i < new_colors; i++) { - (*colors)[*num_colors + i] = unpack_color(bytes[i * 2], bytes[i * 2 + 1]); + uint16_t gbc_color = (bytes[i * 2 + 1] << 8) | bytes[i * 2]; + (*colors)[*num_colors + i] = unpack_color(gbc_color); } *num_colors += new_colors; From 97f7888873c84639cfc61de38fd634e00a77a0b0 Mon Sep 17 00:00:00 2001 From: Rangi42 Date: Sat, 31 Aug 2024 11:15:58 -0400 Subject: [PATCH 6/8] Use terser comparator definitions --- tools/gbcpal.c | 2 +- tools/make_patch.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/gbcpal.c b/tools/gbcpal.c index fdca04b2299..8e49e529b91 100644 --- a/tools/gbcpal.c +++ b/tools/gbcpal.c @@ -48,7 +48,7 @@ double luminance(struct Color color) { int compare_colors(const void *color1, const void *color2) { double lum1 = luminance(*(const struct Color *)color1); double lum2 = luminance(*(const struct Color *)color2); - return lum1 < lum2 ? 1 : lum1 > lum2 ? -1 : 0; + return lum1 > lum2 ? -1 : lum1 < lum2; // sort lightest to darkest } void read_gbcpal(const char *filename, struct Color **colors, size_t *num_colors) { diff --git a/tools/make_patch.c b/tools/make_patch.c index 85ffb34bfa4..1218339f422 100644 --- a/tools/make_patch.c +++ b/tools/make_patch.c @@ -417,7 +417,7 @@ struct Buffer *process_template(const char *template_filename, const char *patch int compare_patch(const void *patch1, const void *patch2) { unsigned int offset1 = ((const struct Patch *)patch1)->offset; unsigned int offset2 = ((const struct Patch *)patch2)->offset; - return offset1 > offset2 ? 1 : offset1 < offset2 ? -1 : 0; + return offset1 < offset2 ? -1 : offset1 > offset2; } bool verify_completeness(FILE *restrict orig_rom, FILE *restrict new_rom, struct Buffer *patches) { From 900ce2ddf769fe659f87ac6430c663b948469891 Mon Sep 17 00:00:00 2001 From: Rangi42 Date: Sat, 31 Aug 2024 11:18:40 -0400 Subject: [PATCH 7/8] Require an explicit separate output and input file --- Makefile | 2 +- tools/gbcpal.c | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 3f7d4c99392..3dd8779ef62 100644 --- a/Makefile +++ b/Makefile @@ -351,7 +351,7 @@ gfx/mobile/stadium2_n64.2bpp: tools/gfx += --trim-whitespace %.gbcpal: %.png $(RGBGFX) -p $@ $< - tools/gbcpal $(tools/gbcpal) $@ + tools/gbcpal $(tools/gbcpal) $@ $@ %.dimensions: %.png tools/png_dimensions $< $@ diff --git a/tools/gbcpal.c b/tools/gbcpal.c index 8e49e529b91..09440731217 100644 --- a/tools/gbcpal.c +++ b/tools/gbcpal.c @@ -1,5 +1,5 @@ #define PROGRAM_NAME "gbcpal" -#define USAGE_OPTS "[-h|--help] [-r|--reverse] out.gbcpal [in.gbcpal...]" +#define USAGE_OPTS "[-h|--help] [-r|--reverse] out.gbcpal in.gbcpal..." #include "common.h" @@ -103,7 +103,7 @@ int main(int argc, char *argv[]) { argc -= optind; argv += optind; - if (argc < 1) { + if (argc < 2) { usage_exit(1); } @@ -111,9 +111,6 @@ int main(int argc, char *argv[]) { struct Color *colors = NULL; size_t num_colors = 0; - if (argc == 1) { - read_gbcpal(out_filename, &colors, &num_colors); - } for (int i = 1; i < argc; i++) { read_gbcpal(argv[i], &colors, &num_colors); } From 4d462e97e08e99a065d73f168eeadf963004aa19 Mon Sep 17 00:00:00 2001 From: Rangi42 Date: Sat, 31 Aug 2024 11:30:45 -0400 Subject: [PATCH 8/8] Use even terser comparator definitions --- tools/gbcpal.c | 2 +- tools/make_patch.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/gbcpal.c b/tools/gbcpal.c index 09440731217..b5cdeea8b00 100644 --- a/tools/gbcpal.c +++ b/tools/gbcpal.c @@ -48,7 +48,7 @@ double luminance(struct Color color) { int compare_colors(const void *color1, const void *color2) { double lum1 = luminance(*(const struct Color *)color1); double lum2 = luminance(*(const struct Color *)color2); - return lum1 > lum2 ? -1 : lum1 < lum2; // sort lightest to darkest + return (lum1 < lum2) - (lum1 > lum2); // sort lightest to darkest } void read_gbcpal(const char *filename, struct Color **colors, size_t *num_colors) { diff --git a/tools/make_patch.c b/tools/make_patch.c index 1218339f422..3a36accdd87 100644 --- a/tools/make_patch.c +++ b/tools/make_patch.c @@ -417,7 +417,7 @@ struct Buffer *process_template(const char *template_filename, const char *patch int compare_patch(const void *patch1, const void *patch2) { unsigned int offset1 = ((const struct Patch *)patch1)->offset; unsigned int offset2 = ((const struct Patch *)patch2)->offset; - return offset1 < offset2 ? -1 : offset1 > offset2; + return (offset1 > offset2) - (offset1 < offset2); } bool verify_completeness(FILE *restrict orig_rom, FILE *restrict new_rom, struct Buffer *patches) {