Merge pull request #362 from yenatch/c-tools

Replace the python tools with C tools and rgbgfx. Add Pokemon pngs
This commit is contained in:
yenatch
2017-05-29 23:27:19 -04:00
committed by GitHub
1927 changed files with 1603 additions and 13259 deletions

8
.gitignore vendored
View File

@@ -34,3 +34,11 @@ pokecrystal.txt
# swap files for gedit # swap files for gedit
*~ *~
*.dimensions
*.gbcpal
*.2bpp
*.lz
*.pal
*.animated.tilemap
gfx/pics/*/bitmask.asm
gfx/pics/*/frames.asm

View File

@@ -19,6 +19,7 @@ before_script:
fi; fi;
} }
script: script:
- make tools
- make crystal crystal11 - make crystal crystal11
- make compare - make compare
# - check_status # - check_status

View File

@@ -1,4 +1,4 @@
The source files are assembled into a rom using [**rgbds**](https://github.com/bentley/rgbds). The source files are assembled into a rom using [**rgbds**](https://github.com/rednex/rgbds).
These instructions explain how to set up the tools required to build. These instructions explain how to set up the tools required to build.
If you run into trouble, ask on irc ([**freenode#pret**](https://kiwiirc.com/client/irc.freenode.net/?#pret)). If you run into trouble, ask on irc ([**freenode#pret**](https://kiwiirc.com/client/irc.freenode.net/?#pret)).
@@ -6,18 +6,18 @@ If you run into trouble, ask on irc ([**freenode#pret**](https://kiwiirc.com/cli
# Linux # Linux
Python 2.7 is required.
```bash ```bash
sudo apt-get install make gcc bison git python sudo apt-get install make gcc bison git
git clone https://github.com/bentley/rgbds git clone https://github.com/rednex/rgbds
cd rgbds cd rgbds
git checkout v0.2.5
sudo make install sudo make install
cd .. cd ..
git clone --recursive https://github.com/pret/pokecrystal git clone https://github.com/pret/pokecrystal
cd pokecrystal cd pokecrystal
make tools
``` ```
To build **pokecrystal.gbc**: To build **pokecrystal.gbc**:
@@ -34,13 +34,15 @@ In **Terminal**, run:
```bash ```bash
xcode-select --install xcode-select --install
git clone https://github.com/bentley/rgbds git clone https://github.com/rednex/rgbds
cd rgbds cd rgbds
git checkout v0.2.5
sudo make install sudo make install
cd .. cd ..
git clone --recursive https://github.com/pret/pokecrystal git clone https://github.com/pret/pokecrystal
cd pokecrystal cd pokecrystal
make tools
``` ```
To build **pokecrystal.gbc**: To build **pokecrystal.gbc**:
@@ -54,17 +56,18 @@ make
To build on Windows, install [**Cygwin**](http://cygwin.com/install.html) with the default settings. To build on Windows, install [**Cygwin**](http://cygwin.com/install.html) with the default settings.
In the installer, select the following packages: `make` `git` `python` `gettext` In the installer, select the following packages: `make` `git` `gettext`
Then get the most recent version of [**rgbds**](https://github.com/bentley/rgbds/releases/). Then get [**rgbds 0.2.5**](https://github.com/rednex/rgbds/releases/). Versions 0.3.0 and later are not compatible.
Extract the archive and put `rgbasm.exe`, `rgblink.exe` and `rgbfix.exe` in `C:\cygwin64\usr\local\bin`. Extract the archive and put `rgbasm.exe`, `rgblink.exe`, `rgbfix.exe` and `rgbgfx.exe` in `C:\cygwin64\usr\local\bin`.
In the **Cygwin terminal**: In the **Cygwin terminal**:
```bash ```bash
git clone --recursive https://github.com/pret/pokecrystal git clone https://github.com/pret/pokecrystal
cd pokecrystal cd pokecrystal
make tools
``` ```
To build **pokecrystal.gbc**: To build **pokecrystal.gbc**:

111
Makefile
View File

@@ -1,13 +1,10 @@
PYTHON := python MD5 := md5sum -c
MD5 := md5sum -c --quiet
.SUFFIXES: .SUFFIXES:
.PHONY: all clean crystal crystal11 .PHONY: all clean tools compare crystal crystal11
.SECONDEXPANSION: .SECONDEXPANSION:
.PRECIOUS: %.2bpp %.1bpp .PRECIOUS:
.SECONDARY:
gfx := $(PYTHON) gfx.py
includes := $(PYTHON) scan_includes.py
crystal_obj := \ crystal_obj := \
@@ -29,25 +26,26 @@ gfx/pics.o
crystal11_obj := $(crystal_obj:.o=11.o) crystal11_obj := $(crystal_obj:.o=11.o)
roms := pokecrystal.gbc roms := pokecrystal.gbc pokecrystal11.gbc
all: $(roms) all: crystal
crystal: pokecrystal.gbc crystal: pokecrystal.gbc
crystal11: pokecrystal11.gbc crystal11: pokecrystal11.gbc
clean: clean:
rm -f $(roms) $(crystal_obj) $(crystal11_obj) $(roms:.gbc=.map) $(roms:.gbc=.sym) rm -f $(roms) $(crystal_obj) $(crystal11_obj) $(roms:.gbc=.map) $(roms:.gbc=.sym)
compare: pokecrystal.gbc pokecrystal11.gbc compare: $(roms)
@$(MD5) roms.md5 @$(MD5) roms.md5
%.asm: ; tools:
make -C tools/
%11.o: dep = $(shell $(includes) $(@D)/$*.asm) %11.o: dep = $(shell tools/scan_includes $(@D)/$*.asm)
%11.o: %.asm $$(dep) %11.o: %.asm $$(dep)
rgbasm -D CRYSTAL11 -o $@ $< rgbasm -D CRYSTAL11 -o $@ $<
%.o: dep = $(shell $(includes) $(@D)/$*.asm) %.o: dep = $(shell tools/scan_includes $(@D)/$*.asm)
%.o: %.asm $$(dep) %.o: %.asm $$(dep)
rgbasm -o $@ $< rgbasm -o $@ $<
@@ -59,13 +57,86 @@ pokecrystal.gbc: $(crystal_obj)
rgblink -n pokecrystal.sym -m pokecrystal.map -o $@ $^ rgblink -n pokecrystal.sym -m pokecrystal.map -o $@ $^
rgbfix -Cjv -i BYTE -k 01 -l 0x33 -m 0x10 -p 0 -r 3 -t PM_CRYSTAL $@ rgbfix -Cjv -i BYTE -k 01 -l 0x33 -m 0x10 -p 0 -r 3 -t PM_CRYSTAL $@
%.png: ;
%.2bpp: %.png ; $(gfx) 2bpp $<
%.1bpp: %.png ; $(gfx) 1bpp $<
%.lz: % ; $(gfx) lz $<
%.pal: %.2bpp ; define LOUD
gfx/pics/%/normal.pal gfx/pics/%/bitmask.asm gfx/pics/%/frames.asm: gfx/pics/%/front.2bpp ; echo "$1"; $1
endef
# For files that the compressor can't match, there will be a .lz file suffixed with the hash of the correct uncompressed file.
# If the hash of the uncompressed file matches, use this .lz instead.
# This allows pngs to be used for compressed graphics and still match.
%.lz: hash = $(shell md5sum $(*D)/$(*F) | sed "s/\(.\{8\}\).*/\1/")
%.lz: %
$(eval filename := $@.$(hash))
@if [ -f $(filename) ]; then \
$(call LOUD, cp $(filename) $@); \
else \
$(call LOUD, tools/lzcomp $< $@); \
fi
# Terrible hacks to match animations. Delete these rules if you don't care about matching.
# Dewgong has an unused tile id in its last frame. The tile itself is missing.
gfx/pics/dewgong/frames.asm: gfx/pics/dewgong/front.animated.tilemap gfx/pics/dewgong/front.dimensions
tools/pokemon_animation -f $^ > $@
echo " db \$$4d" >> $@
# Lugia has two unused tile ids in its last frame. The tiles themselves are missing.
gfx/pics/lugia/frames.asm: gfx/pics/lugia/front.animated.tilemap gfx/pics/lugia/front.dimensions
tools/pokemon_animation -f $^ > $@
echo " db \$$5e, \$$59" >> $@
# Girafarig has a redundant tile after the end. It is used in two frames, so it must be injected into the generated graphics.
# This is more involved, so it's hacked into pokemon_animation_graphics.
gfx/pics/girafarig/front.animated.2bpp: gfx/pics/girafarig/front.2bpp gfx/pics/girafarig/front.dimensions
tools/pokemon_animation_graphics --girafarig -o $@ $^
gfx/pics/girafarig/front.animated.tilemap: gfx/pics/girafarig/front.2bpp gfx/pics/girafarig/front.dimensions
tools/pokemon_animation_graphics --girafarig -t $@ $^
# Pokemon pic graphics rules
gfx/pics/%/normal.gbcpal: gfx/pics/%/front.png
rgbgfx -p $@ $<
gfx/pics/%/normal.pal: gfx/pics/%/normal.gbcpal
tools/palette -p $< > $@
gfx/pics/%/back.2bpp: gfx/pics/%/back.png
rgbgfx -h -o $@ $<
gfx/pics/%/bitmask.asm: gfx/pics/%/front.animated.tilemap gfx/pics/%/front.dimensions
tools/pokemon_animation -b $^ > $@
gfx/pics/%/frames.asm: gfx/pics/%/front.animated.tilemap gfx/pics/%/front.dimensions
tools/pokemon_animation -f $^ > $@
gfx/pics/%/front.animated.2bpp: gfx/pics/%/front.2bpp gfx/pics/%/front.dimensions
tools/pokemon_animation_graphics -o $@ $^
gfx/pics/%/front.animated.tilemap: gfx/pics/%/front.2bpp gfx/pics/%/front.dimensions
tools/pokemon_animation_graphics -t $@ $^
# Don't use -h, pokemon_animation_graphics takes care of it
#gfx/pics/%/front.2bpp: gfx/pics/%/front.png
# rgbgfx -o $@ $<
# Misc file-specific graphics rules
gfx/shrink%.2bpp: gfx/shrink%.png
rgbgfx -h -o $@ $<
gfx/trainers/%.2bpp: gfx/trainers/%.png
rgbgfx -h -o $@ $<
%.bin: ; %.bin: ;
%.blk: ; %.blk: ;
%.tilemap: ;
%.2bpp: %.png
rgbgfx -o $@ $<
%.1bpp: %.png
rgbgfx -d1 -o $@ $<
%.tilemap: %.png
rgbgfx -t $@ $<
%.gbcpal: %.png
rgbgfx -p $@ $<
%.pal: %.gbcpal
tools/palette $< > $@
%.dimensions: %.png
tools/png_dimensions $< $@

View File

@@ -462,4 +462,4 @@ CopyDayHourMinToHL: ; 1162e
ld a, [hMinutes] ld a, [hMinutes]
ld [hli], a ld [hli], a
ret ret
; 11639 ; 11639

2
gfx.py
View File

@@ -74,7 +74,7 @@ def filepath_rules(filepath):
args['pic'] = True args['pic'] = True
args['animate'] = True args['animate'] = True
elif name == 'back': elif name == 'back':
args['pal_file'] = os.path.join(filedir, 'shiny.pal') args['pal_file'] = os.path.join(filedir, 'normal.pal')
args['pic'] = True args['pic'] = True
elif 'gfx/trainers' in filedir: elif 'gfx/trainers' in filedir:

File diff suppressed because it is too large Load Diff

BIN
gfx/pics/abra/back.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 445 B

View File

@@ -1,16 +0,0 @@
; 0
db %10011100
db %01100011
db %00000100
db %00000000
; 1
db %10011100
db %01100011
db %00001100
db %00000001
; 2
db %00000000
db %00000000
db %00001000
db %00000001
; 0xd2b78

View File

@@ -1,13 +0,0 @@
dw .frame1
dw .frame2
dw .frame3
.frame1
db $00 ; bitmask
db $19, $1a, $1b, $1c, $1d, $1e, $1f, $20, $21
.frame2
db $01 ; bitmask
db $19, $1a, $1b, $1c, $1d, $1e, $1f, $20, $21, $22, $23
.frame3
db $02 ; bitmask
db $22, $23
; 0xd4ef3

BIN
gfx/pics/abra/front.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 674 B

View File

@@ -1,4 +0,0 @@
RGB 28, 19, 03
RGB 12, 08, 10

Binary file not shown.

After

Width:  |  Height:  |  Size: 414 B

View File

@@ -1,25 +0,0 @@
; 0
db %10011111
db %00000111
db %10000000
db %11110111
db %11111001
db %00111100
db %00000000
; 1
db %00001000
db %00001110
db %00000111
db %00000000
db %00000000
db %00000000
db %00000000
; 2
db %00000000
db %10000000
db %00000000
db %00000000
db %00000000
db %00000000
db %00000000
; 0xd321a

View File

@@ -1,15 +0,0 @@
dw .frame1
dw .frame2
dw .frame3
.frame1
db $00 ; bitmask
db $30, $31, $32, $33, $34, $35, $36, $37, $38, $39, $3a, $3b
db $3c, $30, $30, $3d, $3e, $3f, $30, $30, $20, $40, $41, $30
db $30, $30, $30
.frame2
db $01 ; bitmask
db $30, $42, $43, $44, $45, $46, $47
.frame3
db $02 ; bitmask
db $48
; 0xd5fa7

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Some files were not shown because too many files have changed in this diff Show More