shithub: pokered

Download patch

ref: b45dbd897070aca848ac64888abc63fa20f4469d
parent: 7f8974dab5c6c307a8e15e139dfab9264fcc639f
parent: 7023b740617a8433f5b4755a7e9c4cba4d985b38
author: yenatch <yenatch@gmail.com>
date: Tue Apr 15 17:29:01 EDT 2014

Merge remote-tracking branch 'yenatch/png'

git/query: bad hash 61b83803be9ccdcdcd95b7f8ea7accafab8d4d4d
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,3 @@
-# global label defs are generated
-globals.asm
-
 # precompiled python
 *.pyc
 
@@ -20,6 +17,11 @@
 
 # generated
 *.tx
+
+# converted image data
+*.2bpp
+*.1bpp
+*.pic
 
 # swap files for vim
 .*.swp
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,16 @@
 PYTHON := python
+
+.SUFFIXES:
 .SUFFIXES: .asm .tx .o .gbc
-.PHONY: all clean red blue compare
+.PHONY: all clean red blue compare pngs
+.PRECIOUS: %.2bpp
 .SECONDEXPANSION:
 
+POKEMONTOOLS := extras/pokemontools
+GFX          := $(PYTHON) $(POKEMONTOOLS)/gfx.py
+PIC          := $(PYTHON) $(POKEMONTOOLS)/pic.py
+INCLUDES     := $(PYTHON) $(POKEMONTOOLS)/scan_includes.py
+PREPROCESS   := $(PYTHON) prequeue.py
 
 TEXTQUEUE :=
 
@@ -23,10 +31,8 @@
 
 ROMS := pokered.gbc pokeblue.gbc
 
-# generate dependencies for each object
-$(shell $(foreach obj, $(OBJS), \
-	$(eval $(obj:.o=)_DEPENDENCIES := $(shell $(PYTHON) extras/pokemontools/scan_includes.py $(obj:.o=.asm))) \
-))
+# object dependencies
+$(shell $(foreach obj, $(OBJS), $(eval $(obj:.o=)_DEPENDENCIES := $(shell $(INCLUDES) $(obj:.o=.asm)))))
 
 all: $(ROMS)
 red:  pokered.gbc
@@ -36,7 +42,10 @@
 clean:
 	rm -f $(ROMS)
 	rm -f $(OBJS)
-	find . -iname '*.tx' -exec rm {} +
+	find .   -iname '*.tx'      -exec rm {} +
+	find gfx -iname '*.[12]bpp' -exec rm {} +
+	find pic -iname '*.pic'     -exec rm {} +
+	find pic -iname '*.2bpp'    -exec rm {} +
 	rm -f redrle
 
 
@@ -50,8 +59,14 @@
 	@rm -f $@
 
 $(OBJS): $$*.tx $$(patsubst %.asm, %.tx, $$($$*_DEPENDENCIES))
-	@$(PYTHON) prequeue.py $(TEXTQUEUE)
+	@$(PREPROCESS) $(TEXTQUEUE)
 	@$(eval TEXTQUEUE :=)
+	@$(GFX) 2bpp $(2BPPQUEUE)
+	@$(eval 2BPPQUEUE :=)
+	@$(GFX) 1bpp $(1BPPQUEUE)
+	@$(eval 1BPPQUEUE :=)
+	@$(PIC) compress $(PICQUEUE)
+	@$(eval PICQUEUE  :=)
 	rgbasm -o $@ $*.tx
 
 
@@ -64,4 +79,16 @@
 pokeblue.gbc: $(BLUE_OBJS)
 	rgblink -n $*.sym -m $*.map -o $@ $^
 	rgbfix $(OPTIONS) -t "POKEMON BLUE" $@
+
+
+%.2bpp: %.png
+	$(eval 2BPPQUEUE += $<)
+	@rm -f $@
+%.1bpp: %.png
+	$(eval 1BPPQUEUE += $<)
+	@rm -f $@
+%.pic: %.2bpp
+	$(eval PICQUEUE  += $<)
+	@rm -f $@
+