No Description

sprites.makefile 9.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. AS = @arm-none-eabi-as
  2. AR = @arm-none-eabi-ar
  3. LD = @arm-none-eabi-ld
  4. GRIT = @grit
  5. GFX_BUILD_DIR = gfx_build
  6. TMP_LD = $(GFX_BUILD_DIR)/tmp.ld
  7. LDFLAGS := -z muldefs
  8. ASSET_ROOT = sots-private/assets
  9. SPRITES_BINARY = object/pkmn_sprites.o
  10. PNG_TITLE_BG := $(ASSET_ROOT)/misc/title/title_tileset_background.png
  11. PNG_TITLE_AEON := $(ASSET_ROOT)/misc/title/title_tileset_latias_latios_deoxys.png
  12. PNG_TITLE_LOGO := $(ASSET_ROOT)/misc/title/title_tileset_logo_name.png
  13. PNG_TITLE_START := $(ASSET_ROOT)/misc/title/title_tileset_press_start.png
  14. PNG_TITLE_CLOUD := $(ASSET_ROOT)/misc/title/title_sprite_sky.png
  15. PNG_HERO := $(ASSET_ROOT)/misc/char/hero_backsprite.png
  16. PNG_HEROINE := $(ASSET_ROOT)/misc/char/heroine_backsprite.png
  17. PNG_HERO_B := $(ASSET_ROOT)/misc/char/hero_bag.png
  18. PNG_HEROINE_B := $(ASSET_ROOT)/misc/char/heroine_bag.png
  19. S_HERO := $(GFX_BUILD_DIR)/char/hero_backsprite.S
  20. S_HEROINE := $(GFX_BUILD_DIR)/char/heroine_backsprite.S
  21. S_HERO_B := $(GFX_BUILD_DIR)/char/hero_bag.S
  22. S_HEROINE_B := $(GFX_BUILD_DIR)/char/heroine_bag.S
  23. O_HERO := $(GFX_BUILD_DIR)/char/hero_backsprite.o
  24. O_HEROINE := $(GFX_BUILD_DIR)/char/heroine_backsprite.o
  25. O_HERO_B := $(GFX_BUILD_DIR)/char/hero_bag.o
  26. O_HEROINE_B := $(GFX_BUILD_DIR)/char/heroine_bag.o
  27. S_TITLE_BG := $(GFX_BUILD_DIR)/title_screen/title_tileset_background.S
  28. S_TITLE_AEON := $(GFX_BUILD_DIR)/title_screen/title_tileset_latias_latios_deoxys.S
  29. S_TITLE_LOGO := $(GFX_BUILD_DIR)/title_screen/title_tileset_logo_name.S
  30. S_TITLE_START := $(GFX_BUILD_DIR)/title_screen/title_tileset_press_start.S
  31. S_TITLE_CLOUD := $(GFX_BUILD_DIR)/title_screen/title_sprite_sky.S
  32. O_TITLE_BG := $(GFX_BUILD_DIR)/title_screen/title_tileset_background.o
  33. O_TITLE_AEON := $(GFX_BUILD_DIR)/title_screen/title_tileset_latias_latios_deoxys.o
  34. O_TITLE_LOGO := $(GFX_BUILD_DIR)/title_screen/title_tileset_logo_name.o
  35. O_TITLE_START := $(GFX_BUILD_DIR)/title_screen/title_tileset_press_start.o
  36. O_TITLE_CLOUD := $(GFX_BUILD_DIR)/title_screen/title_sprite_sky.o
  37. TITLE_OBJ := $(O_TITLE_BG) $(O_TITLE_AEON) $(O_TITLE_LOGO) $(O_TITLE_START) $(O_TITLE_CLOUD)
  38. HERO_OBJ := $(O_HERO) $(O_HEROINE) $(O_HERO_B) $(O_HEROINE_B)
  39. ITEM_PNG = $(sort $(wildcard $(ASSET_ROOT)/item_icons/*.png))
  40. ITEM_OBJ = $(addprefix $(GFX_BUILD_DIR)/item/,$(notdir $(ITEM_PNG:.png=.o)))
  41. NORMAL_PNG = $(sort $(wildcard $(ASSET_ROOT)/pkmn_sprites/normal_*.png))
  42. NORMAL_PAL_OBJ = $(addprefix $(GFX_BUILD_DIR)/sprites/normal_pal/,$(notdir $(NORMAL_PNG:.png=.o)))
  43. SHINY_PNG = $(sort $(wildcard $(ASSET_ROOT)/pkmn_sprites/shiny_*.png))
  44. SHINY_PAL_OBJ = $(addprefix $(GFX_BUILD_DIR)/sprites/shiny_pal/,$(notdir $(SHINY_PNG:.png=.o)))
  45. SPRITE_FRONT_OBJ = $(addprefix $(GFX_BUILD_DIR)/sprites/front_sprites/,$(notdir $(NORMAL_PNG:.png=.o)))
  46. SPRITE_BACK_OBJ = $(addprefix $(GFX_BUILD_DIR)/sprites/back_sprites/,$(notdir $(NORMAL_PNG:.png=.o)))
  47. OW_PNG = $(sort $(wildcard $(ASSET_ROOT)/overworld/*.png))
  48. OW_OBJ = $(addprefix $(GFX_BUILD_DIR)/overworlds/,$(notdir $(OW_PNG:.png=.o)))
  49. TS_PNG = $(sort $(wildcard $(ASSET_ROOT)/trainer_sprites/*.png))
  50. TS_OBJ = $(addprefix $(GFX_BUILD_DIR)/trainer_sprites/,$(notdir $(TS_PNG:.png=.o)))
  51. CASTFORM_PNG = $(ASSET_ROOT)/pkmn_sprites/castform/castform.png
  52. NORMAL_CASTFORM_PAL_OBJ = $(GFX_BUILD_DIR)/sprites/castform/castform_normal_pal.o
  53. SHINY_CASTFORM_PAL_OBJ = $(GFX_BUILD_DIR)/sprites/castform/castform_shiny_pal.o
  54. CASTFORM_FRONT_OBJ = $(GFX_BUILD_DIR)/sprites/castform/castform_front.o
  55. CASTFORM_BACK_OBJ = $(GFX_BUILD_DIR)/sprites/castform/castform_back.o
  56. all: $(SPRITES_BINARY)
  57. .PHONY: clean
  58. clean:
  59. rm -f $(TMP_FILE) $(GFX_BUILD_DIR)/sprites/castform/*
  60. rm -f $(GFX_BUILD_DIR)/sprites/normal_pal/*
  61. rm -f $(GFX_BUILD_DIR)/sprites/shiny_pal/*
  62. rm -f $(GFX_BUILD_DIR)/sprites/front_sprites/*
  63. rm -f $(GFX_BUILD_DIR)/sprites/back_sprites/*
  64. rm -f $(GFX_BUILD_DIR)/overworlds/*
  65. rm -f $(GFX_BUILD_DIR)/item/*
  66. rm -f $(GFX_BUILD_DIR)/char/*
  67. rm -f $(GFX_BUILD_DIR)/title_screen/*
  68. rm -f $(GFX_BUILD_DIR)/trainer_sprites/*
  69. $(SPRITES_BINARY): $(NORMAL_PAL_OBJ) $(HERO_OBJ) $(SHINY_PAL_OBJ) $(SPRITE_FRONT_OBJ) $(SPRITE_BACK_OBJ) $(NORMAL_CASTFORM_PAL_OBJ) $(SHINY_CASTFORM_PAL_OBJ) $(CASTFORM_FRONT_OBJ) $(CASTFORM_BACK_OBJ) $(OW_OBJ) $(TS_OBJ) $(ITEM_OBJ) $(TITLE_OBJ)
  70. @echo -e "\e[1;32mLinking $@\e[0m"
  71. @echo "INPUT($^)" > $(TMP_LD)
  72. $(LD) -r -o $@ -T $(TMP_LD)
  73. # Characters
  74. $(GFX_BUILD_DIR)/char/%.o: $(GFX_BUILD_DIR)/char/%.S
  75. $(AS) -o $@ $<
  76. $(S_HERO): $(PNG_HERO)
  77. $(GRIT) $< -fts -fh! -gt -gB4 -gz! -p -pzl -m! -pu16 -o $@
  78. $(S_HERO_B): $(PNG_HERO_B)
  79. $(GRIT) $< -fts -fh! -gt -gB4 -gzl -p -pzl -m! -pu16 -o $@
  80. $(S_HEROINE): $(PNG_HEROINE)
  81. $(GRIT) $< -fts -fh! -gt -gB4 -gz! -p -pzl -m! -pu16 -o $@
  82. $(S_HEROINE_B): $(PNG_HEROINE_B)
  83. $(GRIT) $< -fts -fh! -gt -gB4 -gzl -p -pzl -m! -pu16 -o $@
  84. # Special titlescreen targets
  85. $(GFX_BUILD_DIR)/title_screen/%.o: $(GFX_BUILD_DIR)/title_screen/%.S
  86. $(AS) -o $@ $<
  87. $(S_TITLE_BG): $(PNG_TITLE_BG)
  88. $(GRIT) $< -fts -fh! -gt -gB4 -gzl -p! -pz! -m -mzl -mp 4 -mRtf -pu16 -o $@
  89. $(S_TITLE_AEON): $(PNG_TITLE_AEON)
  90. $(GRIT) $< -fts -fh! -gt -gB4 -gzl -p! -pz! -m -mzl -mp 2 -mRtf -pu16 -o $@
  91. $(S_TITLE_LOGO): $(PNG_TITLE_LOGO)
  92. $(GRIT) $< -fts -fh! -gt -gB8 -gzl -p! -pz! -m -mzl -mRtf -pu16 -o $@
  93. $(S_TITLE_START): $(PNG_TITLE_START)
  94. $(GRIT) $< -fts -fh! -gt -gB4 -gzl -p! -pz! -m -mzl -mp 3 -mRtf -pu16 -o $@
  95. $(S_TITLE_CLOUD): $(PNG_TITLE_CLOUD)
  96. $(GRIT) $< -fts -fh! -gt -gB4 -gzl -p -pz! -m! -pu16 -o $@
  97. # Item Targets
  98. $(GFX_BUILD_DIR)/item/%.o: $(GFX_BUILD_DIR)/item/%.s
  99. @echo -e "\e[32mAssembling $<\e[0m"
  100. $(AS) -o $@ $<
  101. .PRECIOUS: $(GFX_BUILD_DIR)/item/%.s
  102. $(GFX_BUILD_DIR)/item/%.s: $(ASSET_ROOT)/item_icons/%.png
  103. @echo -e "\e[34mProcessing image $<\e[0m"
  104. $(GRIT) $< -fts -fh! -gt -gB4 -gzl -p -pzl -m! -pu16 -o $@
  105. # OW Targets
  106. $(GFX_BUILD_DIR)/overworlds/%.o: $(GFX_BUILD_DIR)/overworlds/%.s
  107. @echo -e "\e[32mAssembling $<\e[0m"
  108. $(AS) -o $@ $<
  109. .PRECIOUS: $(GFX_BUILD_DIR)/overworlds/%.s
  110. $(GFX_BUILD_DIR)/overworlds/%.s: $(ASSET_ROOT)/overworld/%.png
  111. @echo -e "\e[34mProcessing image $<\e[0m"
  112. $(GRIT) $< -fts -fh! -gt -gB4 -gz! -p -pz! -m! -pu16 -o $@
  113. # Trainer Sprite Targets
  114. $(GFX_BUILD_DIR)/trainer_sprites/%.o: $(GFX_BUILD_DIR)/trainer_sprites/%.s
  115. @echo -e "\e[32mAssembling $<\e[0m"
  116. $(AS) -o $@ $<
  117. $(GFX_BUILD_DIR)/trainer_sprites/%.s: $(ASSET_ROOT)/trainer_sprites/%.png
  118. @echo -e "\e[34mProcessing image $<\e[0m"
  119. $(GRIT) $< -fts -fh! -gt -gB4 -gzl -p -pzl -m! -o $@
  120. # Normal Palette Targets
  121. $(GFX_BUILD_DIR)/sprites/normal_pal/%.o: $(GFX_BUILD_DIR)/sprites/normal_pal/%.s
  122. @echo -e "\e[32mAssembling $<\e[0m"
  123. $(AS) -o $@ $<
  124. $(GFX_BUILD_DIR)/sprites/normal_pal/%.s: $(ASSET_ROOT)/pkmn_sprites/%.png
  125. @echo -e "\e[34mProcessing palette $< (normal)\e[0m"
  126. $(GRIT) $< -fts -fh! -g! -gB 4 -gt -m! -p -pzl -pu16 -pn 16 \
  127. -s $(shell echo $(notdir $(basename $<)) | sed "s/normal_/n_p_/g") \
  128. -o $@
  129. # Shiny Palette Targets
  130. $(GFX_BUILD_DIR)/sprites/shiny_pal/%.o: $(GFX_BUILD_DIR)/sprites/shiny_pal/%.s
  131. @echo -e "\e[32mAssembling $<\e[0m"
  132. $(AS) -o $@ $<
  133. $(GFX_BUILD_DIR)/sprites/shiny_pal/%.s: $(ASSET_ROOT)/pkmn_sprites/%.png
  134. @echo -e "\e[34mProcessing palette $< (shiny)\e[0m"
  135. $(GRIT) $< -fts -fh! -g! -gB 4 -gt -m! -p -pzl -pu16 -pn 16 \
  136. -s $(shell echo $(notdir $(basename $<)) | sed "s/shiny_/s_p_/g") \
  137. -o $@
  138. # Front Sprite Targets
  139. $(GFX_BUILD_DIR)/sprites/front_sprites/%.o: $(GFX_BUILD_DIR)/sprites/front_sprites/%.s
  140. @echo -e "\e[32mAssembling $<\e[0m"
  141. $(AS) -o $@ $<
  142. $(GFX_BUILD_DIR)/sprites/front_sprites/%.s: $(ASSET_ROOT)/pkmn_sprites/%.png
  143. @echo -e "\e[34mProcessing sprite $< (front)\e[0m"
  144. $(GRIT) $< -fts -fh! -g -gB 4 -gt -gzl -al 0 -aw 64 -m! -p! \
  145. -s $(shell echo $(notdir $(basename $<)) | sed "s/normal_/front_/g") \
  146. -o $@
  147. # Back Sprite Targets
  148. $(GFX_BUILD_DIR)/sprites/back_sprites/%.o: $(GFX_BUILD_DIR)/sprites/bacj_sprites/%.s
  149. @echo -e "\e[32mAssembling $<\e[0m"
  150. $(AS) -o $@ $<
  151. $(GFX_BUILD_DIR)/sprites/back_sprites/%.s: $(ASSET_ROOT)/pkmn_sprites/%.png
  152. @echo -e "\e[34mProcessing sprite $< (back)\e[0m"
  153. $(GRIT) $< -fts -fh! -g -gB 4 -gt -gzl -al 64 -aw 64 -m! -p! \
  154. -s $(shell echo $(notdir $(basename $<)) | sed "s/normal_/back_/g") \
  155. -o $@
  156. # Misc hardcoded targets
  157. $(NORMAL_CASTFORM_PAL_OBJ): $(NORMAL_CASTFORM_PAL_OBJ:.o=.s)
  158. @echo -e "\e[32mAssembling $<\e[0m"
  159. $(AS) -o $@ $<
  160. $(NORMAL_CASTFORM_PAL_OBJ:.o=.s): $(CASTFORM_PNG)
  161. @echo -e "\e[34mProcessing palette $< (normal)\e[0m"
  162. $(GRIT) $< -fts -fh! -g! -gB 4 -gt -m! -p -pzl -pu16 -pn 64 \
  163. -s n_p_0385 -o $@
  164. $(SHINY_CASTFORM_PAL_OBJ): $(SHINY_CASTFORM_PAL_OBJ:.o=.s)
  165. @echo -e "\e[32mAssembling $<\e[0m"
  166. $(AS) -o $@ $<
  167. $(SHINY_CASTFORM_PAL_OBJ:.o=.s): $(CASTFORM_PNG)
  168. @echo -e "\e[34mProcessing palette $< (shiny)\e[0m"
  169. $(GRIT) $< -fts -fh! -g! -gB 4 -gt -m! -p -pzl -pu16 -pn 64 \
  170. -s s_p_0385 -o $@
  171. $(CASTFORM_FRONT_OBJ): $(CASTFORM_FRONT_OBJ:.o=.s)
  172. @echo -e "\e[32mAssembling $<\e[0m"
  173. $(AS) -o $@ $<
  174. $(CASTFORM_FRONT_OBJ:.o=.s): $(CASTFORM_PNG)
  175. @echo -e "\e[34mProcessing sprite $< (front)\e[0m"
  176. $(GRIT) $< -fts -fh! -g -gB 4 -gt -gzl -al 0 -aw 256 -ah 64 -m! -p! \
  177. -s front_0385 -o $@
  178. $(CASTFORM_BACK_OBJ): $(CASTFORM_BACK_OBJ:.o=.s)
  179. @echo -e "\e[32mAssembling $<\e[0m"
  180. $(AS) -o $@ $<
  181. $(CASTFORM_BACK_OBJ:.o=.s): $(CASTFORM_PNG)
  182. @echo -e "\e[34mProcessing sprite $< (back)\e[0m"
  183. $(GRIT) $< -fts -fh! -g -gB 4 -gt -gzl -al 0 -aw 256 -at 64 -ah 64 -m! -p! \
  184. -s back_0385 -o $@