暫無描述

sprites.makefile 7.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. AS = arm-none-eabi-as
  2. AR = arm-none-eabi-ar
  3. LD = arm-none-eabi-ld
  4. GFX_BUILD_DIR = gfx_build
  5. TMP_LD = $(GFX_BUILD_DIR)/tmp.ld
  6. LDFLAGS := -z muldefs
  7. ASSET_ROOT = sots-private/assets
  8. SPRITES_BINARY = object/pkmn_sprites.o
  9. PNG_TITLE_BG := $(ASSET_ROOT)/misc/title/title_tileset_background.png
  10. PNG_TITLE_AEON := $(ASSET_ROOT)/misc/title/title_tileset_latias_latios_deoxys.png
  11. PNG_TITLE_LOGO := $(ASSET_ROOT)/misc/title/title_tileset_logo_name.png
  12. PNG_TITLE_START := $(ASSET_ROOT)/misc/title/title_tileset_press_start.png
  13. PNG_TITLE_CLOUD := $(ASSET_ROOT)/misc/title/title_sprite_sky.png
  14. S_TITLE_BG := $(GFX_BUILD_DIR)/title_screen/title_tileset_background.S
  15. S_TITLE_AEON := $(GFX_BUILD_DIR)/title_screen/title_tileset_latias_latios_deoxys.S
  16. S_TITLE_LOGO := $(GFX_BUILD_DIR)/title_screen/title_tileset_logo_name.S
  17. S_TITLE_START := $(GFX_BUILD_DIR)/title_screen/title_tileset_press_start.S
  18. S_TITLE_CLOUD := $(GFX_BUILD_DIR)/title_screen/title_sprite_sky.S
  19. O_TITLE_BG := $(GFX_BUILD_DIR)/title_screen/title_tileset_background.o
  20. O_TITLE_AEON := $(GFX_BUILD_DIR)/title_screen/title_tileset_latias_latios_deoxys.o
  21. O_TITLE_LOGO := $(GFX_BUILD_DIR)/title_screen/title_tileset_logo_name.o
  22. O_TITLE_START := $(GFX_BUILD_DIR)/title_screen/title_tileset_press_start.o
  23. O_TITLE_CLOUD := $(GFX_BUILD_DIR)/title_screen/title_sprite_sky.o
  24. TITLE_OBJ := $(O_TITLE_BG) $(O_TITLE_AEON) $(O_TITLE_LOGO) $(O_TITLE_START) $(O_TITLE_CLOUD)
  25. ITEM_PNG = $(sort $(wildcard $(ASSET_ROOT)/item_icons/*.png))
  26. ITEM_OBJ = $(addprefix $(GFX_BUILD_DIR)/item/,$(notdir $(ITEM_PNG:.png=.o)))
  27. NORMAL_PNG = $(sort $(wildcard $(ASSET_ROOT)/pkmn_sprites/normal_*.png))
  28. NORMAL_PAL_OBJ = $(addprefix $(GFX_BUILD_DIR)/sprites/normal_pal/,$(notdir $(NORMAL_PNG:.png=.o)))
  29. SHINY_PNG = $(sort $(wildcard $(ASSET_ROOT)/pkmn_sprites/shiny_*.png))
  30. SHINY_PAL_OBJ = $(addprefix $(GFX_BUILD_DIR)/sprites/shiny_pal/,$(notdir $(SHINY_PNG:.png=.o)))
  31. SPRITE_FRONT_OBJ = $(addprefix $(GFX_BUILD_DIR)/sprites/front_sprites/,$(notdir $(NORMAL_PNG:.png=.o)))
  32. SPRITE_BACK_OBJ = $(addprefix $(GFX_BUILD_DIR)/sprites/back_sprites/,$(notdir $(NORMAL_PNG:.png=.o)))
  33. OW_PNG = $(sort $(wildcard $(ASSET_ROOT)/overworld/*.png))
  34. OW_OBJ = $(addprefix $(GFX_BUILD_DIR)/overworlds/,$(notdir $(OW_PNG:.png=.o)))
  35. TS_PNG = $(sort $(wildcard $(ASSET_ROOT)/trainer_sprites/*.png))
  36. TS_OBJ = $(addprefix $(GFX_BUILD_DIR)/trainer_sprites/,$(notdir $(TS_PNG:.png=.o)))
  37. CASTFORM_PNG = $(ASSET_ROOT)/pkmn_sprites/castform/castform.png
  38. NORMAL_CASTFORM_PAL_OBJ = $(GFX_BUILD_DIR)/sprites/castform/castform_normal_pal.o
  39. SHINY_CASTFORM_PAL_OBJ = $(GFX_BUILD_DIR)/sprites/castform/castform_shiny_pal.o
  40. CASTFORM_FRONT_OBJ = $(GFX_BUILD_DIR)/sprites/castform/castform_front.o
  41. CASTFORM_BACK_OBJ = $(GFX_BUILD_DIR)/sprites/castform/castform_back.o
  42. all: $(SPRITES_BINARY)
  43. .PHONY: clean
  44. clean:
  45. rm -f $(TMP_FILE) $(GFX_BUILD_DIR)/sprites/castform/*
  46. rm -f $(GFX_BUILD_DIR)/sprites/normal_pal/*
  47. rm -f $(GFX_BUILD_DIR)/sprites/shiny_pal/*
  48. rm -f $(GFX_BUILD_DIR)/sprites/front_sprites/*
  49. rm -f $(GFX_BUILD_DIR)/sprites/back_sprites/*
  50. rm -f $(GFX_BUILD_DIR)/overworlds/*
  51. $(SPRITES_BINARY): $(NORMAL_PAL_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)
  52. echo "INPUT($^)" > $(TMP_LD)
  53. $(LD) -r -o $@ -T $(TMP_LD)
  54. # Special titlescreen targets
  55. $(GFX_BUILD_DIR)/title_screen/%.o: $(GFX_BUILD_DIR)/title_screen/%.S
  56. $(AS) -o $@ $<
  57. $(S_TITLE_BG): $(PNG_TITLE_BG)
  58. grit $< -fts -fh! -gt -gB4 -gzl -p! -pz! -m -mzl -mp 4 -mRtf -pu16 -o $@
  59. $(S_TITLE_AEON): $(PNG_TITLE_AEON)
  60. grit $< -fts -fh! -gt -gB4 -gzl -p! -pz! -m -mzl -mp 2 -mRtf -pu16 -o $@
  61. $(S_TITLE_LOGO): $(PNG_TITLE_LOGO)
  62. grit $< -fts -fh! -gt -gB8 -gzl -p! -pz! -m -mzl -mRtf -pu16 -o $@
  63. $(S_TITLE_START): $(PNG_TITLE_START)
  64. grit $< -fts -fh! -gt -gB4 -gzl -p! -pz! -m -mzl -mp 3 -mRtf -pu16 -o $@
  65. $(S_TITLE_CLOUD): $(PNG_TITLE_CLOUD)
  66. grit $< -fts -fh! -gt -gB4 -gzl -p -pz! -m! -pu16 -o $@
  67. # Item Targets
  68. $(GFX_BUILD_DIR)/item/%.o: $(GFX_BUILD_DIR)/item/%.s
  69. $(AS) -o $@ $<
  70. .PRECIOUS: $(GFX_BUILD_DIR)/item/%.s
  71. $(GFX_BUILD_DIR)/item/%.s: $(ASSET_ROOT)/item_icons/%.png
  72. grit $< -fts -fh! -gt -gB4 -gzl -p -pzl -m! -pu16 -o $@
  73. # OW Targets
  74. $(GFX_BUILD_DIR)/overworlds/%.o: $(GFX_BUILD_DIR)/overworlds/%.s
  75. $(AS) -o $@ $<
  76. .PRECIOUS: $(GFX_BUILD_DIR)/overworlds/%.s
  77. $(GFX_BUILD_DIR)/overworlds/%.s: $(ASSET_ROOT)/overworld/%.png
  78. grit $< -fts -fh! -gt -gB4 -gz! -p -pz! -m! -pu16 -o $@
  79. # Trainer Sprite Targets
  80. $(GFX_BUILD_DIR)/trainer_sprites/%.o: $(GFX_BUILD_DIR)/trainer_sprites/%.s
  81. $(AS) -o $@ $<
  82. .PRECIOUS: $(GFX_BUILD_DIR)/trainer_sprites/%.s
  83. $(GFX_BUILD_DIR)/trainer_sprites/%.s: $(ASSET_ROOT)/trainer_sprites/%.png
  84. grit $< -fts -fh! -gt -gB4 -gzl -p -pzl -m! -o $@
  85. # Normal Palette Targets
  86. $(GFX_BUILD_DIR)/sprites/normal_pal/%.o: $(GFX_BUILD_DIR)/sprites/normal_pal/%.s
  87. $(AS) -o $@ $<
  88. .PRECIOUS: $(GFX_BUILD_DIR)/sprites/normal_pal/%.s
  89. $(GFX_BUILD_DIR)/sprites/normal_pal/%.s: $(ASSET_ROOT)/pkmn_sprites/%.png
  90. grit $< -fts -fh! -g! -gB 4 -gt -m! -p -pzl -pu16 -pn 16 \
  91. -s $(shell echo $(notdir $(basename $<)) | sed "s/normal_/n_p_/g") \
  92. -o $@
  93. # Shiny Palette Targets
  94. $(GFX_BUILD_DIR)/sprites/shiny_pal/%.o: $(GFX_BUILD_DIR)/sprites/shiny_pal/%.s
  95. $(AS) -o $@ $<
  96. .PRECIOUS: $(GFX_BUILD_DIR)/sprites/shiny_pal/%.s
  97. $(GFX_BUILD_DIR)/sprites/shiny_pal/%.s: $(ASSET_ROOT)/pkmn_sprites/%.png
  98. grit $< -fts -fh! -g! -gB 4 -gt -m! -p -pzl -pu16 -pn 16 \
  99. -s $(shell echo $(notdir $(basename $<)) | sed "s/shiny_/s_p_/g") \
  100. -o $@
  101. # Front Sprite Targets
  102. $(GFX_BUILD_DIR)/sprites/front_sprites/%.o: $(GFX_BUILD_DIR)/sprites/front_sprites/%.s
  103. $(AS) -o $@ $<
  104. .PRECIOUS: $(GFX_BUILD_DIR)/sprites/front_sprites/%.s
  105. $(GFX_BUILD_DIR)/sprites/front_sprites/%.s: $(ASSET_ROOT)/pkmn_sprites/%.png
  106. grit $< -fts -fh! -g -gB 4 -gt -gzl -al 0 -aw 64 -m! -p! \
  107. -s $(shell echo $(notdir $(basename $<)) | sed "s/normal_/front_/g") \
  108. -o $@
  109. # Back Sprite Targets
  110. $(GFX_BUILD_DIR)/sprites/back_sprites/%.o: $(GFX_BUILD_DIR)/sprites/bacj_sprites/%.s
  111. $(AS) -o $@ $<
  112. .PRECIOUS: $(GFX_BUILD_DIR)/sprites/back_sprites/%.s
  113. $(GFX_BUILD_DIR)/sprites/back_sprites/%.s: $(ASSET_ROOT)/pkmn_sprites/%.png
  114. grit $< -fts -fh! -g -gB 4 -gt -gzl -al 64 -aw 64 -m! -p! \
  115. -s $(shell echo $(notdir $(basename $<)) | sed "s/normal_/back_/g") \
  116. -o $@
  117. # Misc hardcoded targets
  118. $(NORMAL_CASTFORM_PAL_OBJ): $(NORMAL_CASTFORM_PAL_OBJ:.o=.s)
  119. $(AS) -o $@ $<
  120. $(NORMAL_CASTFORM_PAL_OBJ:.o=.s): $(CASTFORM_PNG)
  121. grit $< -fts -fh! -g! -gB 4 -gt -m! -p -pzl -pu16 -pn 64 \
  122. -s n_p_0385 -o $@
  123. $(SHINY_CASTFORM_PAL_OBJ): $(SHINY_CASTFORM_PAL_OBJ:.o=.s)
  124. $(AS) -o $@ $<
  125. $(SHINY_CASTFORM_PAL_OBJ:.o=.s): $(CASTFORM_PNG)
  126. grit $< -fts -fh! -g! -gB 4 -gt -m! -p -pzl -pu16 -pn 64 \
  127. -s s_p_0385 -o $@
  128. $(CASTFORM_FRONT_OBJ): $(CASTFORM_FRONT_OBJ:.o=.s)
  129. $(AS) -o $@ $<
  130. $(CASTFORM_FRONT_OBJ:.o=.s): $(CASTFORM_PNG)
  131. grit $< -fts -fh! -g -gB 4 -gt -gzl -al 0 -aw 256 -ah 64 -m! -p! \
  132. -s front_0385 -o $@
  133. $(CASTFORM_BACK_OBJ): $(CASTFORM_BACK_OBJ:.o=.s)
  134. $(AS) -o $@ $<
  135. $(CASTFORM_BACK_OBJ:.o=.s): $(CASTFORM_PNG)
  136. grit $< -fts -fh! -g -gB 4 -gt -gzl -al 0 -aw 256 -at 64 -ah 64 -m! -p! \
  137. -s back_0385 -o $@