You've already forked pokecrystal-board
mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2025-04-09 05:44:44 -07:00
Merge branch 'master' of https://github.com/pret/pokecrystal
This commit is contained in:
12
INSTALL.md
12
INSTALL.md
@@ -7,8 +7,7 @@ These instructions explain how to set up the tools required to build.
|
|||||||
Python 2.7 is required.
|
Python 2.7 is required.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sudo apt-get install make gcc bison git python python-pip
|
sudo apt-get install make gcc bison git python
|
||||||
pip install pypng
|
|
||||||
|
|
||||||
git clone https://github.com/bentley/rgbds
|
git clone https://github.com/bentley/rgbds
|
||||||
cd rgbds
|
cd rgbds
|
||||||
@@ -32,7 +31,6 @@ In **Terminal**, run:
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
xcode-select --install
|
xcode-select --install
|
||||||
sudo easy_install pypng
|
|
||||||
|
|
||||||
git clone https://github.com/bentley/rgbds
|
git clone https://github.com/bentley/rgbds
|
||||||
cd rgbds
|
cd rgbds
|
||||||
@@ -54,7 +52,7 @@ make
|
|||||||
|
|
||||||
To build on Windows, use [**Cygwin**](http://cygwin.com/install.html). Use the default settings.
|
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/).
|
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`.
|
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**:
|
In the **Cygwin terminal**:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
lynx -source bootstrap.pypa.io/get-pip.py | python
|
|
||||||
pip install pypng
|
|
||||||
|
|
||||||
git clone --recursive https://github.com/pret/pokecrystal
|
git clone --recursive https://github.com/pret/pokecrystal
|
||||||
cd pokecrystal
|
cd pokecrystal
|
||||||
@@ -74,3 +70,7 @@ To build **pokecrystal.gbc**:
|
|||||||
```bash
|
```bash
|
||||||
make
|
make
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## notes
|
||||||
|
|
||||||
|
- If `gettext` no longer exists, grab `libsasl2-3` `ca-certificates`.
|
||||||
|
58
Makefile
58
Makefile
@@ -1,8 +1,9 @@
|
|||||||
PYTHON := python
|
PYTHON := python
|
||||||
MD5 := md5sum -c --quiet
|
MD5 := md5sum -c --quiet
|
||||||
|
|
||||||
.SUFFIXES: .asm .o .gbc .png .2bpp .1bpp .lz .pal .bin .blk .tilemap
|
.SUFFIXES:
|
||||||
.PHONY: all clean crystal crystal11 pngs
|
.SUFFIXES: .2bpp
|
||||||
|
.PHONY: all clean crystal crystal11
|
||||||
.SECONDEXPANSION:
|
.SECONDEXPANSION:
|
||||||
|
|
||||||
poketools := extras/pokemontools
|
poketools := extras/pokemontools
|
||||||
@@ -10,61 +11,45 @@ gfx := $(PYTHON) gfx.py
|
|||||||
includes := $(PYTHON) $(poketools)/scan_includes.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 := \
|
crystal_obj := \
|
||||||
wram.o \
|
wram.o \
|
||||||
main.o \
|
main.o \
|
||||||
lib/mobile/main.o \
|
lib/mobile/main.o \
|
||||||
home.o \
|
home.o \
|
||||||
audio.o \
|
audio.o \
|
||||||
maps_crystal.o \
|
maps.o \
|
||||||
engine/events_crystal.o \
|
engine/events.o \
|
||||||
engine/credits_crystal.o \
|
engine/credits.o \
|
||||||
data/egg_moves_crystal.o \
|
data/egg_moves.o \
|
||||||
data/evos_attacks_crystal.o \
|
data/evos_attacks.o \
|
||||||
data/pokedex/entries_crystal.o \
|
data/pokedex/entries.o \
|
||||||
misc/crystal_misc.o \
|
misc/crystal_misc.o \
|
||||||
text/common_text.o \
|
text/common_text.o \
|
||||||
gfx/pics.o
|
gfx/pics.o
|
||||||
|
|
||||||
all_obj := $(crystal_obj) crystal11.o wram11.o
|
crystal11_obj := $(crystal_obj:.o=11.o)
|
||||||
|
|
||||||
# object dependencies
|
|
||||||
$(foreach obj, $(all_obj), \
|
|
||||||
$(eval $(obj:.o=)_dep := $(shell $(includes) $(obj:.o=.asm))) \
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
roms := pokecrystal.gbc
|
roms := pokecrystal.gbc
|
||||||
|
|
||||||
all: $(roms)
|
all: $(roms)
|
||||||
crystal: pokecrystal.gbc
|
crystal: pokecrystal.gbc
|
||||||
|
|
||||||
crystal11: pokecrystal11.gbc
|
crystal11: pokecrystal11.gbc
|
||||||
|
|
||||||
clean:
|
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
|
compare: pokecrystal.gbc pokecrystal11.gbc
|
||||||
@$(MD5) roms.md5
|
@$(MD5) roms.md5
|
||||||
|
|
||||||
%.asm: ;
|
%.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 $@ $<
|
rgbasm -o $@ $<
|
||||||
|
|
||||||
pokecrystal11.gbc: $(crystal11_obj)
|
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 $@
|
rgbfix -Cjv -i BYTE -k 01 -l 0x33 -m 0x10 -p 0 -r 3 -t PM_CRYSTAL $@
|
||||||
|
|
||||||
|
|
||||||
pngs:
|
%.png: ;
|
||||||
find . -iname "*.lz" -exec $(gfx) unlz {} +
|
|
||||||
find . -iname "*.[12]bpp" -exec $(gfx) png {} +
|
|
||||||
find . -iname "*.[12]bpp" -exec touch {} \;
|
|
||||||
find . -iname "*.lz" -exec touch {} \;
|
|
||||||
|
|
||||||
%.2bpp: %.png ; $(gfx) 2bpp $<
|
%.2bpp: %.png ; $(gfx) 2bpp $<
|
||||||
%.1bpp: %.png ; $(gfx) 1bpp $<
|
%.1bpp: %.png ; $(gfx) 1bpp $<
|
||||||
%.lz: % ; $(gfx) lz $<
|
%.lz: % ; $(gfx) lz $<
|
||||||
|
@@ -1,4 +0,0 @@
|
|||||||
CRYSTAL11 = 1
|
|
||||||
CORRUPT_TILES = 1
|
|
||||||
|
|
||||||
INCLUDE "main.asm"
|
|
@@ -1,2 +0,0 @@
|
|||||||
INCLUDE "pokecrystal.asm"
|
|
||||||
INCLUDE "data/egg_moves.asm"
|
|
@@ -1,2 +0,0 @@
|
|||||||
INCLUDE "pokecrystal.asm"
|
|
||||||
INCLUDE "data/evos_attacks.asm"
|
|
@@ -1,2 +0,0 @@
|
|||||||
INCLUDE "pokecrystal.asm"
|
|
||||||
INCLUDE "engine/credits.asm"
|
|
@@ -1,2 +0,0 @@
|
|||||||
INCLUDE "pokecrystal.asm"
|
|
||||||
INCLUDE "engine/events.asm"
|
|
@@ -169,7 +169,7 @@ GetCaughtLevel: ; 4f18c
|
|||||||
jr z, .unknown
|
jr z, .unknown
|
||||||
cp 1 ; hatched from an egg
|
cp 1 ; hatched from an egg
|
||||||
jr nz, .print
|
jr nz, .print
|
||||||
ld a, 5 ; egg hatch level
|
ld a, EGG_LEVEL ; egg hatch level
|
||||||
|
|
||||||
.print
|
.print
|
||||||
ld [wSeerCaughtLevel], a
|
ld [wSeerCaughtLevel], a
|
||||||
|
2
extras
2
extras
Submodule extras updated: adbc204d74...68edf51f10
43
gfx.py
43
gfx.py
@@ -12,37 +12,59 @@ pics = [
|
|||||||
'gfx/shrink2',
|
'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
|
base_stats = None
|
||||||
def get_base_stats():
|
def get_base_stats():
|
||||||
global base_stats
|
global base_stats
|
||||||
if not 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
|
return base_stats
|
||||||
|
|
||||||
def get_pokemon_dimensions(name):
|
def get_pokemon_dimensions(name):
|
||||||
|
try:
|
||||||
if name == 'egg':
|
if name == 'egg':
|
||||||
return 5, 5
|
return 5, 5
|
||||||
|
if name == 'questionmark':
|
||||||
|
return 7, 7
|
||||||
if name.startswith('unown_'):
|
if name.startswith('unown_'):
|
||||||
name = 'unown'
|
name = 'unown'
|
||||||
base_stats = get_base_stats()
|
base_stats = get_base_stats()
|
||||||
start = base_stats.find(name.title() + 'BaseData:')
|
start = base_stats.find('\tdb ' + name.upper())
|
||||||
start = base_stats.find('\tdn ', start)
|
start = base_stats.find('\tdn ', start)
|
||||||
end = base_stats.find('\n', start)
|
end = base_stats.find('\n', start)
|
||||||
line = base_stats[start:end].replace(',', ' ')
|
line = base_stats[start:end].replace(',', ' ')
|
||||||
w, h = map(int, line.split()[1:3])
|
w, h = map(int, line.split()[1:3])
|
||||||
return w, h
|
return w, h
|
||||||
|
except:
|
||||||
|
return 7, 7
|
||||||
|
|
||||||
def filepath_rules(filepath):
|
def filepath_rules(filepath):
|
||||||
"""Infer attributes of certain graphics by their location in the filesystem."""
|
"""Infer attributes of certain graphics by their location in the filesystem."""
|
||||||
args = {}
|
args = {}
|
||||||
|
|
||||||
filedir, filename = os.path.split(filepath)
|
filedir, filename = os.path.split(filepath)
|
||||||
|
if filedir.startswith('./'):
|
||||||
|
filedir = filedir[2:]
|
||||||
|
|
||||||
name, ext = os.path.splitext(filename)
|
name, ext = os.path.splitext(filename)
|
||||||
|
if ext == '.lz':
|
||||||
|
name, ext = os.path.splitext(name)
|
||||||
|
|
||||||
pokemon_name = ''
|
pokemon_name = ''
|
||||||
|
|
||||||
if 'gfx/pics/' in filedir:
|
if 'gfx/pics/' in filedir:
|
||||||
pokemon_name = filedir.split('/')[3]
|
pokemon_name = filedir.split('/')[-1]
|
||||||
if pokemon_name.startswith('unown_'):
|
if pokemon_name.startswith('unown_'):
|
||||||
index = filedir.find(pokemon_name)
|
index = filedir.find(pokemon_name)
|
||||||
if index != -1:
|
if index != -1:
|
||||||
@@ -84,22 +106,31 @@ def filepath_rules(filepath):
|
|||||||
|
|
||||||
|
|
||||||
def to_1bpp(filename, **kwargs):
|
def to_1bpp(filename, **kwargs):
|
||||||
_, ext = os.path.splitext(filename)
|
name, ext = os.path.splitext(filename)
|
||||||
if ext == '.1bpp': pass
|
if ext == '.1bpp': pass
|
||||||
elif ext == '.2bpp': gfx.export_2bpp_to_1bpp(filename, **kwargs)
|
elif ext == '.2bpp': gfx.export_2bpp_to_1bpp(filename, **kwargs)
|
||||||
elif ext == '.png': gfx.export_png_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):
|
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)
|
if ext == '.1bpp': gfx.export_1bpp_to_2bpp(filename, **kwargs)
|
||||||
elif ext == '.2bpp': pass
|
elif ext == '.2bpp': pass
|
||||||
elif ext == '.png': gfx.export_png_to_2bpp(filename, **kwargs)
|
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):
|
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)
|
if ext == '.1bpp': gfx.export_1bpp_to_png(filename, **kwargs)
|
||||||
elif ext == '.2bpp': gfx.export_2bpp_to_png(filename, **kwargs)
|
elif ext == '.2bpp': gfx.export_2bpp_to_png(filename, **kwargs)
|
||||||
elif ext == '.png': pass
|
elif ext == '.png': pass
|
||||||
|
elif ext == '.lz':
|
||||||
|
decompress(filename, **kwargs)
|
||||||
|
to_png(name, **kwargs)
|
||||||
|
|
||||||
def compress(filename, **kwargs):
|
def compress(filename, **kwargs):
|
||||||
data = open(filename, 'rb').read()
|
data = open(filename, 'rb').read()
|
||||||
|
1
hram.asm
1
hram.asm
@@ -50,6 +50,7 @@ hStringCmpString2 EQU $ffb5
|
|||||||
hDividend EQU $ffb3 ; length in b register, before 'call Divide' (max 4 bytes)
|
hDividend EQU $ffb3 ; length in b register, before 'call Divide' (max 4 bytes)
|
||||||
hDivisor EQU $ffb7 ; 1 byte long
|
hDivisor EQU $ffb7 ; 1 byte long
|
||||||
hQuotient EQU $ffb4 ; result (3 bytes long)
|
hQuotient EQU $ffb4 ; result (3 bytes long)
|
||||||
|
hRemainder EQU $ffb7
|
||||||
|
|
||||||
hMultiplicand EQU $ffb4 ; 3 bytes long
|
hMultiplicand EQU $ffb4 ; 3 bytes long
|
||||||
hMultiplier EQU $ffb7 ; 1 byte long
|
hMultiplier EQU $ffb7 ; 1 byte long
|
||||||
|
@@ -1,2 +1,3 @@
|
|||||||
|
INCLUDE "version.asm"
|
||||||
INCLUDE "contents.asm"
|
INCLUDE "contents.asm"
|
||||||
INCLUDE "constants.asm"
|
INCLUDE "constants.asm"
|
||||||
|
@@ -1,2 +0,0 @@
|
|||||||
INCLUDE "pokecrystal.asm"
|
|
||||||
INCLUDE "maps.asm"
|
|
@@ -1805,8 +1805,8 @@ Function48d94: ; 48d94 (12:4d94)
|
|||||||
ld [hDivisor], a
|
ld [hDivisor], a
|
||||||
ld b, 2
|
ld b, 2
|
||||||
call Divide
|
call Divide
|
||||||
ld a, [hDivisor]
|
ld a, [hRemainder]
|
||||||
ld c, $a
|
ld c, 10
|
||||||
call SimpleDivide
|
call SimpleDivide
|
||||||
sla b
|
sla b
|
||||||
sla b
|
sla b
|
||||||
|
@@ -934,7 +934,7 @@ GFX_172f1f:
|
|||||||
INCBIN "gfx/unknown/172f1f.2bpp"
|
INCBIN "gfx/unknown/172f1f.2bpp"
|
||||||
|
|
||||||
Tilemap_1733af:
|
Tilemap_1733af:
|
||||||
IF DEF(CORRUPT_TILES)
|
IF DEF(CRYSTAL11)
|
||||||
INCBIN "gfx/unknown/1733af_corrupt.tilemap"
|
INCBIN "gfx/unknown/1733af_corrupt.tilemap"
|
||||||
ELSE
|
ELSE
|
||||||
INCBIN "gfx/unknown/1733af.tilemap"
|
INCBIN "gfx/unknown/1733af.tilemap"
|
||||||
|
@@ -1,3 +0,0 @@
|
|||||||
CRYSTAL11 = 1
|
|
||||||
|
|
||||||
INCLUDE "wram.asm"
|
|
Reference in New Issue
Block a user