ref: d536990828adee8a47e71f24ec45900ea783cd7a
parent: 18656332b7b4ca67461d4cd4b6b8282d3bc7ab0c
parent: 81c5f251a6e253a43344e4695209df871c41045c
author: Bryan Bishop <[email protected]>
date: Wed Sep 11 14:05:41 EDT 2013
Merge pull request #203 from yenatch/globals consolidate labels across objects into globals.asm
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,6 @@
+# global label defs are generated
+globals.asm
+
# precompiled python
*.pyc
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,7 @@
.PHONY: all clean pngs gfx
.SECONDEXPANSION:
-TEXTFILES := $(shell find ./ -type f -name '*.asm')
+TEXTFILES := $(shell find ./ -type f -name '*.asm' | grep -v globals.asm)
TEXTQUEUE :=
OBJS := pokecrystal.o
@@ -13,12 +13,19 @@
_2BPPS := $(shell find gfx/ -type f -name '*.2bpp')
_1BPPS := $(shell find gfx/ -type f -name '*.1bpp')
-$(shell $(foreach obj, $(OBJS), $(eval OBJ_$(obj:.o=) := $(shell $(PYTHON) scan_includes.py $(obj:.o=.asm)))))
+# generate a list of dependencies for each object file
+$(shell \
+ $(foreach obj, $(OBJS), \
+ $(eval OBJ_$(obj:.o=) := \
+ $(shell $(PYTHON) scan_includes.py $(obj:.o=.asm) | sed s/globals.asm//g)) \
+ ) \
+)
-all: baserom.gbc pokecrystal.gbc
+all: baserom.gbc globals.asm pokecrystal.gbc
cmp baserom.gbc pokecrystal.gbc
clean:
rm -f pokecrystal.o pokecrystal.gbc
+ rm -f globals.asm globals.tx
@echo 'Removing preprocessed .tx files...'
@rm -f $(TEXTFILES:.asm=.tx)
@@ -29,14 +36,17 @@
$(eval TEXTQUEUE := $(TEXTQUEUE) $<)
@rm -f $@
-$(OBJS): $$(patsubst %.o,%.tx,$$@) $$(patsubst %.asm,%.tx,$$(OBJ_$$(patsubst %.o,%,$$@)))
+globals.asm: $(TEXTFILES:.asm=.tx)
+ @echo "Creating globals.asm..."
+ @touch globals.asm
@echo "Preprocessing .asm to .tx..."
- @$(PYTHON) prequeue.py $(TEXTQUEUE)
- $(eval TEXTQUEUE := )
+ @$(PYTHON) prequeue.py $(TEXTQUEUE) globals.asm
+
+$(OBJS): $$(patsubst %.o,%.tx,$$@) $$(patsubst %.asm,%.tx,$$(OBJ_$$(patsubst %.o,%,$$@)))
rgbasm -o $@ $(@:.o=.tx)
pokecrystal.gbc: $(OBJS)
- rgblink -n pokecrystal.sym -m pokecrystal.map -o pokecrystal.gbc $<
+ rgblink -n pokecrystal.sym -m pokecrystal.map -o pokecrystal.gbc $^
rgbfix -Cjv -i BYTE -k 01 -l 0x33 -m 0x10 -p 0 -r 3 -t PM_CRYSTAL $@
pngs:
--- a/constants.asm
+++ b/constants.asm
@@ -6,6 +6,73 @@
VERSION EQU 1
endc
+; wram constants
+; MonType: ; cf5f
+PARTYMON EQU 0
+OTPARTYMON EQU 1
+BOXMON EQU 2
+WILDMON EQU 4
+
+; WalkingDirection: ; d043
+STANDING EQU -1
+DOWN EQU 0
+UP EQU 1
+LEFT EQU 2
+RIGHT EQU 3
+
+; FacingDirection: ; d044
+FACE_CURRENT EQU 0
+FACE_DOWN EQU 8
+FACE_UP EQU 4
+FACE_LEFT EQU 2
+FACE_RIGHT EQU 1
+
+; TimeOfDay: ; d269
+MORN EQU 0
+DAY EQU 1
+NITE EQU 2
+DARKNESS EQU 3
+
+; ScriptFlags: ; d434
+SCRIPT_RUNNING EQU 2
+
+; ScriptMode: ; d437
+SCRIPT_OFF EQU 0
+SCRIPT_READ EQU 1
+SCRIPT_WAIT_MOVEMENT EQU 2
+SCRIPT_WAIT EQU 3
+
+; CurDay: ; d4cb
+SUNDAY EQU 0
+MONDAY EQU 1
+TUESDAY EQU 2
+WEDNESDAY EQU 3
+THURSDAY EQU 4
+FRIDAY EQU 5
+SATURDAY EQU 6
+
+; MapObjects: ; d71e
+
+PLAYER_OBJECT EQU 0
+
+NUM_OBJECTS EQU $10
+OBJECT_LENGTH EQU $10
+
+; InputType: ; c2c7
+AUTO_INPUT EQU $ff
+
+; WhichRegisteredItem: ; d95b
+REGISTERED_POCKET EQU %11000000
+REGISTERED_NUMBER EQU %00111111
+
+; PlayerState: ; d95d
+PLAYER_NORMAL EQU 0
+PLAYER_BIKE EQU 1
+PLAYER_SLIP EQU 2
+PLAYER_SURF EQU 4
+PLAYER_SURF_PIKA EQU 8
+
+
INCLUDE "gbhw.asm"
INCLUDE "hram.asm"