summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPikalaxALT <PikalaxALT@gmail.com>2016-03-01 22:31:28 -0500
committerPikalaxALT <PikalaxALT@gmail.com>2016-03-01 22:31:28 -0500
commitf31da089bbd46f56d488b5657f08f8595490e51e (patch)
treed6455d4a4c893c997d44241f3599c27039900f8e
parent599e6e8d16571235f2054aa38f39e66181da3796 (diff)
parent0be6e6c910ea4ab7909d878aa12c4c7989d5ca13 (diff)
Merge branch 'master' of https://github.com/pret/pokecrystal
-rw-r--r--INSTALL.md12
-rw-r--r--Makefile58
-rw-r--r--crystal11.asm4
-rw-r--r--data/egg_moves_crystal.asm2
-rw-r--r--data/evos_attacks_crystal.asm2
-rw-r--r--engine/credits_crystal.asm2
-rw-r--r--engine/events_crystal.asm2
-rw-r--r--event/poke_seer.asm2
m---------extras0
-rw-r--r--gfx.py63
-rw-r--r--hram.asm1
-rw-r--r--includes.asm1
-rw-r--r--maps_crystal.asm2
-rwxr-xr-xmisc/mobile_12.asm4
-rwxr-xr-xmisc/mobile_5c.asm2
-rw-r--r--version.asm (renamed from pokecrystal.asm)0
-rw-r--r--wram11.asm3
17 files changed, 78 insertions, 82 deletions
diff --git a/INSTALL.md b/INSTALL.md
index befa3418a..f595ca176 100644
--- a/INSTALL.md
+++ b/INSTALL.md
@@ -7,8 +7,7 @@ These instructions explain how to set up the tools required to build.
Python 2.7 is required.
```bash
-sudo apt-get install make gcc bison git python python-pip
-pip install pypng
+sudo apt-get install make gcc bison git python
git clone https://github.com/bentley/rgbds
cd rgbds
@@ -32,7 +31,6 @@ In **Terminal**, run:
```bash
xcode-select --install
-sudo easy_install pypng
git clone https://github.com/bentley/rgbds
cd rgbds
@@ -54,7 +52,7 @@ make
To build on Windows, use [**Cygwin**](http://cygwin.com/install.html). Use the default settings.
-In the installer, select the following packages: `make` `git` `python` `python-setuptools` `gcc-core` `libsasl2-3` `ca-certificates`
+In the installer, select the following packages: `make` `git` `python` `gettext`
Then get the most recent version of [**rgbds**](https://github.com/bentley/rgbds/releases/).
Extract the archive and put `rgbasm.exe`, `rgblink.exe` and `rgbfix.exe` in `C:\cygwin\usr\local\bin`.
@@ -62,8 +60,6 @@ Extract the archive and put `rgbasm.exe`, `rgblink.exe` and `rgbfix.exe` in `C:\
In the **Cygwin terminal**:
```bash
-lynx -source bootstrap.pypa.io/get-pip.py | python
-pip install pypng
git clone --recursive https://github.com/pret/pokecrystal
cd pokecrystal
@@ -74,3 +70,7 @@ To build **pokecrystal.gbc**:
```bash
make
```
+
+## notes
+
+- If `gettext` no longer exists, grab `libsasl2-3` `ca-certificates`.
diff --git a/Makefile b/Makefile
index 261b58c24..65c64ede0 100644
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,9 @@
PYTHON := python
MD5 := md5sum -c --quiet
-.SUFFIXES: .asm .o .gbc .png .2bpp .1bpp .lz .pal .bin .blk .tilemap
-.PHONY: all clean crystal crystal11 pngs
+.SUFFIXES:
+.SUFFIXES: .2bpp
+.PHONY: all clean crystal crystal11
.SECONDEXPANSION:
poketools := extras/pokemontools
@@ -10,61 +11,45 @@ gfx := $(PYTHON) gfx.py
includes := $(PYTHON) $(poketools)/scan_includes.py
-crystal11_obj := \
-wram11.o \
-crystal11.o \
-lib/mobile/main.o \
-home.o \
-audio.o \
-maps_crystal.o \
-engine/events_crystal.o \
-engine/credits_crystal.o \
-data/egg_moves_crystal.o \
-data/evos_attacks_crystal.o \
-data/pokedex/entries_crystal.o \
-misc/crystal_misc.o \
-text/common_text.o \
-gfx/pics.o
-
crystal_obj := \
wram.o \
main.o \
lib/mobile/main.o \
home.o \
audio.o \
-maps_crystal.o \
-engine/events_crystal.o \
-engine/credits_crystal.o \
-data/egg_moves_crystal.o \
-data/evos_attacks_crystal.o \
-data/pokedex/entries_crystal.o \
+maps.o \
+engine/events.o \
+engine/credits.o \
+data/egg_moves.o \
+data/evos_attacks.o \
+data/pokedex/entries.o \
misc/crystal_misc.o \
text/common_text.o \
gfx/pics.o
-all_obj := $(crystal_obj) crystal11.o wram11.o
-
-# object dependencies
-$(foreach obj, $(all_obj), \
- $(eval $(obj:.o=)_dep := $(shell $(includes) $(obj:.o=.asm))) \
-)
+crystal11_obj := $(crystal_obj:.o=11.o)
roms := pokecrystal.gbc
all: $(roms)
crystal: pokecrystal.gbc
-
crystal11: pokecrystal11.gbc
clean:
- rm -f $(roms) $(all_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
@$(MD5) roms.md5
%.asm: ;
-$(all_obj): $$*.asm $$($$*_dep)
+
+%11.o: dep = $(shell $(includes) $(@D)/$*.asm)
+%11.o: %.asm $$(dep)
+ rgbasm -D CRYSTAL11 -o $@ $<
+
+%.o: dep = $(shell $(includes) $(@D)/$*.asm)
+%.o: %.asm $$(dep)
rgbasm -o $@ $<
pokecrystal11.gbc: $(crystal11_obj)
@@ -76,12 +61,7 @@ pokecrystal.gbc: $(crystal_obj)
rgbfix -Cjv -i BYTE -k 01 -l 0x33 -m 0x10 -p 0 -r 3 -t PM_CRYSTAL $@
-pngs:
- find . -iname "*.lz" -exec $(gfx) unlz {} +
- find . -iname "*.[12]bpp" -exec $(gfx) png {} +
- find . -iname "*.[12]bpp" -exec touch {} \;
- find . -iname "*.lz" -exec touch {} \;
-
+%.png: ;
%.2bpp: %.png ; $(gfx) 2bpp $<
%.1bpp: %.png ; $(gfx) 1bpp $<
%.lz: % ; $(gfx) lz $<
diff --git a/crystal11.asm b/crystal11.asm
deleted file mode 100644
index c4c7712e8..000000000
--- a/crystal11.asm
+++ /dev/null
@@ -1,4 +0,0 @@
-CRYSTAL11 = 1
-CORRUPT_TILES = 1
-
-INCLUDE "main.asm"
diff --git a/data/egg_moves_crystal.asm b/data/egg_moves_crystal.asm
deleted file mode 100644
index 50fbb1471..000000000
--- a/data/egg_moves_crystal.asm
+++ /dev/null
@@ -1,2 +0,0 @@
-INCLUDE "pokecrystal.asm"
-INCLUDE "data/egg_moves.asm"
diff --git a/data/evos_attacks_crystal.asm b/data/evos_attacks_crystal.asm
deleted file mode 100644
index 22ec9d84c..000000000
--- a/data/evos_attacks_crystal.asm
+++ /dev/null
@@ -1,2 +0,0 @@
-INCLUDE "pokecrystal.asm"
-INCLUDE "data/evos_attacks.asm"
diff --git a/engine/credits_crystal.asm b/engine/credits_crystal.asm
deleted file mode 100644
index 51265434b..000000000
--- a/engine/credits_crystal.asm
+++ /dev/null
@@ -1,2 +0,0 @@
-INCLUDE "pokecrystal.asm"
-INCLUDE "engine/credits.asm"
diff --git a/engine/events_crystal.asm b/engine/events_crystal.asm
deleted file mode 100644
index 56cb7a200..000000000
--- a/engine/events_crystal.asm
+++ /dev/null
@@ -1,2 +0,0 @@
-INCLUDE "pokecrystal.asm"
-INCLUDE "engine/events.asm"
diff --git a/event/poke_seer.asm b/event/poke_seer.asm
index c963076e9..c033a0944 100644
--- a/event/poke_seer.asm
+++ b/event/poke_seer.asm
@@ -169,7 +169,7 @@ GetCaughtLevel: ; 4f18c
jr z, .unknown
cp 1 ; hatched from an egg
jr nz, .print
- ld a, 5 ; egg hatch level
+ ld a, EGG_LEVEL ; egg hatch level
.print
ld [wSeerCaughtLevel], a
diff --git a/extras b/extras
-Subproject adbc204d741bec7a68c1e6cd67751f226d0347c
+Subproject 68edf51f1070b056c281471242220f9c6142e1b
diff --git a/gfx.py b/gfx.py
index ec5bbb9d8..75af28b80 100644
--- a/gfx.py
+++ b/gfx.py
@@ -12,37 +12,59 @@ pics = [
'gfx/shrink2',
]
+def recursive_read(filename):
+ def recurse(filename_):
+ lines = []
+ for line in open(filename_):
+ if 'include "' in line.lower():
+ lines += recurse(line.split('"')[1])
+ else:
+ lines += [line]
+ return lines
+ lines = recurse(filename)
+ return ''.join(lines)
+
base_stats = None
def get_base_stats():
global base_stats
if not base_stats:
- base_stats = open('data/base_stats.asm').read()
+ base_stats = recursive_read('data/base_stats.asm')
return base_stats
def get_pokemon_dimensions(name):
- if name == 'egg':
- return 5, 5
- if name.startswith('unown_'):
- name = 'unown'
- base_stats = get_base_stats()
- start = base_stats.find(name.title() + 'BaseData:')
- start = base_stats.find('\tdn ', start)
- end = base_stats.find('\n', start)
- line = base_stats[start:end].replace(',', ' ')
- w, h = map(int, line.split()[1:3])
- return w, h
+ try:
+ if name == 'egg':
+ return 5, 5
+ if name == 'questionmark':
+ return 7, 7
+ if name.startswith('unown_'):
+ name = 'unown'
+ base_stats = get_base_stats()
+ start = base_stats.find('\tdb ' + name.upper())
+ start = base_stats.find('\tdn ', start)
+ end = base_stats.find('\n', start)
+ line = base_stats[start:end].replace(',', ' ')
+ w, h = map(int, line.split()[1:3])
+ return w, h
+ except:
+ return 7, 7
def filepath_rules(filepath):
"""Infer attributes of certain graphics by their location in the filesystem."""
args = {}
filedir, filename = os.path.split(filepath)
+ if filedir.startswith('./'):
+ filedir = filedir[2:]
+
name, ext = os.path.splitext(filename)
+ if ext == '.lz':
+ name, ext = os.path.splitext(name)
pokemon_name = ''
if 'gfx/pics/' in filedir:
- pokemon_name = filedir.split('/')[3]
+ pokemon_name = filedir.split('/')[-1]
if pokemon_name.startswith('unown_'):
index = filedir.find(pokemon_name)
if index != -1:
@@ -84,22 +106,31 @@ def filepath_rules(filepath):
def to_1bpp(filename, **kwargs):
- _, ext = os.path.splitext(filename)
+ name, ext = os.path.splitext(filename)
if ext == '.1bpp': pass
elif ext == '.2bpp': gfx.export_2bpp_to_1bpp(filename, **kwargs)
elif ext == '.png': gfx.export_png_to_1bpp(filename, **kwargs)
+ elif ext == '.lz':
+ decompress(filename, **kwargs)
+ to_1bpp(name, **kwargs)
def to_2bpp(filename, **kwargs):
- _, ext = os.path.splitext(filename)
+ name, ext = os.path.splitext(filename)
if ext == '.1bpp': gfx.export_1bpp_to_2bpp(filename, **kwargs)
elif ext == '.2bpp': pass
elif ext == '.png': gfx.export_png_to_2bpp(filename, **kwargs)
+ elif ext == '.lz':
+ decompress(filename, **kwargs)
+ to_2bpp(name, **kwargs)
def to_png(filename, **kwargs):
- _, ext = os.path.splitext(filename)
+ name, ext = os.path.splitext(filename)
if ext == '.1bpp': gfx.export_1bpp_to_png(filename, **kwargs)
elif ext == '.2bpp': gfx.export_2bpp_to_png(filename, **kwargs)
elif ext == '.png': pass
+ elif ext == '.lz':
+ decompress(filename, **kwargs)
+ to_png(name, **kwargs)
def compress(filename, **kwargs):
data = open(filename, 'rb').read()
diff --git a/hram.asm b/hram.asm
index 3e921f78e..dc6c480bf 100644
--- a/hram.asm
+++ b/hram.asm
@@ -50,6 +50,7 @@ hStringCmpString2 EQU $ffb5
hDividend EQU $ffb3 ; length in b register, before 'call Divide' (max 4 bytes)
hDivisor EQU $ffb7 ; 1 byte long
hQuotient EQU $ffb4 ; result (3 bytes long)
+hRemainder EQU $ffb7
hMultiplicand EQU $ffb4 ; 3 bytes long
hMultiplier EQU $ffb7 ; 1 byte long
diff --git a/includes.asm b/includes.asm
index 456623d9f..1b3d6bed5 100644
--- a/includes.asm
+++ b/includes.asm
@@ -1,2 +1,3 @@
+INCLUDE "version.asm"
INCLUDE "contents.asm"
INCLUDE "constants.asm"
diff --git a/maps_crystal.asm b/maps_crystal.asm
deleted file mode 100644
index 7bb87d329..000000000
--- a/maps_crystal.asm
+++ /dev/null
@@ -1,2 +0,0 @@
-INCLUDE "pokecrystal.asm"
-INCLUDE "maps.asm"
diff --git a/misc/mobile_12.asm b/misc/mobile_12.asm
index 48e740681..dd0f63135 100755
--- a/misc/mobile_12.asm
+++ b/misc/mobile_12.asm
@@ -1805,8 +1805,8 @@ Function48d94: ; 48d94 (12:4d94)
ld [hDivisor], a
ld b, 2
call Divide
- ld a, [hDivisor]
- ld c, $a
+ ld a, [hRemainder]
+ ld c, 10
call SimpleDivide
sla b
sla b
diff --git a/misc/mobile_5c.asm b/misc/mobile_5c.asm
index b8710a78a..8ecd35edf 100755
--- a/misc/mobile_5c.asm
+++ b/misc/mobile_5c.asm
@@ -934,7 +934,7 @@ GFX_172f1f:
INCBIN "gfx/unknown/172f1f.2bpp"
Tilemap_1733af:
-IF DEF(CORRUPT_TILES)
+IF DEF(CRYSTAL11)
INCBIN "gfx/unknown/1733af_corrupt.tilemap"
ELSE
INCBIN "gfx/unknown/1733af.tilemap"
diff --git a/pokecrystal.asm b/version.asm
index b42aceaee..b42aceaee 100644
--- a/pokecrystal.asm
+++ b/version.asm
diff --git a/wram11.asm b/wram11.asm
deleted file mode 100644
index 4d3303fd0..000000000
--- a/wram11.asm
+++ /dev/null
@@ -1,3 +0,0 @@
-CRYSTAL11 = 1
-
-INCLUDE "wram.asm"