diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 7a76b748e575..03dbf8623dbd 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -21,5 +21,5 @@ ## **Discord contact info** - + diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0322cbe11f00..b9f68e51da4c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,7 +32,7 @@ jobs: run: | sudo apt update sudo apt install -y build-essential libpng-dev libelf-dev - # build-essential, git, and libpng-dev are already installed + # build-essential and git are already installed # gcc-arm-none-eabi is only needed for the modern build # as an alternative to dkP @@ -59,5 +59,4 @@ jobs: MODERN: 1 TEST: 1 run: | - make -j${nproc} -O pokeemerald-test.elf make -j${nproc} check diff --git a/.gitignore b/.gitignore index ba80433cf721..abad67b044aa 100644 --- a/.gitignore +++ b/.gitignore @@ -38,5 +38,7 @@ prefabs.json *.diff *.sym *.js +/pokeemerald-*.png +/pokeemerald_agbcc-*.png src/data/map_group_count.h tools/trainerproc/trainerproc diff --git a/INSTALL.md b/INSTALL.md index 5744adcb04a9..51eea4f19327 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -24,7 +24,7 @@ Unscientific benchmarks suggest **msys2 is 2x slower** than WSL1, and **Cygwin i All of the Windows instructions assume that the default drive is C:\\. If this differs to your actual drive letter, then replace C with the correct drive letter when reading the instructions. -**A note of caution**: As Windows 7 is officially unsupported by Microsoft and Windows 8 has very little usage, some maintainers are unwilling to maintain the Windows 7/8 instructions. Thus, these instructions may break in the future with fixes taking longer than fixes to the Windows 10 instructions. +**A note of caution**: As Windows 7 and Windows 8 are officially unsupported by Microsoft, some maintainers are unwilling to maintain the Windows 7/8 instructions. Thus, these instructions may break in the future with fixes taking longer than fixes to the Windows 10/11 instructions. ## Windows 10/11 (WSL1) WSL1 is the preferred terminal to build **pokeemerald Expansion**. The following instructions will explain how to install WSL1 (referred to interchangeably as WSL). diff --git a/Makefile b/Makefile index 6dacf8b1d348..a807cbf8bf56 100644 --- a/Makefile +++ b/Makefile @@ -1,56 +1,61 @@ -TOOLCHAIN := $(DEVKITARM) -COMPARE ?= 0 +# GBA rom header +TITLE := POKEMON EMER +GAME_CODE := BPEE +MAKER_CODE := 01 +REVISION := 0 +KEEP_TEMPS ?= 0 + +# `File name`.gba ('_agbcc' will be appended to the non-modern builds) +FILE_NAME := pokeemerald +BUILD_DIR := build + +# Builds the ROM using a modern compiler +MODERN ?= 1 +# Compares the ROM to a checksum of the original - only makes sense using when non-modern +COMPARE ?= 0 +# Executes the Test Runner System that checks that all mechanics work as expected +TEST ?= 0 +# Enables -fanalyzer C flag to analyze in depth potential UBs +ANALYZE ?= 0 +# Count unused warnings as errors. Used by RH-Hideout's repo +UNUSED_ERROR ?= 0 +ifeq (agbcc,$(MAKECMDGOALS)) + MODERN := 0 +endif ifeq (compare,$(MAKECMDGOALS)) COMPARE := 1 endif +ifeq (check,$(MAKECMDGOALS)) + TEST := 1 +endif +# Default make rule +all: rom + +# Toolchain selection +TOOLCHAIN := $(DEVKITARM) # don't use dkP's base_tools anymore # because the redefinition of $(CC) conflicts # with when we want to use $(CC) to preprocess files # thus, manually create the variables for the bin # files, or use arm-none-eabi binaries on the system # if dkP is not installed on this system - ifneq (,$(TOOLCHAIN)) -ifneq ($(wildcard $(TOOLCHAIN)/bin),) -export PATH := $(TOOLCHAIN)/bin:$(PATH) -endif + ifneq ($(wildcard $(TOOLCHAIN)/bin),) + export PATH := $(TOOLCHAIN)/bin:$(PATH) + endif endif PREFIX := arm-none-eabi- OBJCOPY := $(PREFIX)objcopy OBJDUMP := $(PREFIX)objdump AS := $(PREFIX)as - LD := $(PREFIX)ld -# note: the makefile must be set up so MODERNCC is never called -# if MODERN=0 -MODERNCC := $(PREFIX)gcc -PATH_MODERNCC := PATH="$(PATH)" $(MODERNCC) - -ifeq ($(OS),Windows_NT) -EXE := .exe -else EXE := -endif - -TITLE := POKEMON EMER -GAME_CODE := BPEE -MAKER_CODE := 01 -REVISION := 0 -MODERN ?= 1 -TEST ?= 0 -ANALYZE ?= 0 -UNUSED_ERROR ?= 0 - -ifeq (agbcc,$(MAKECMDGOALS)) - MODERN := 0 -endif - -ifeq (check,$(MAKECMDGOALS)) - TEST := 1 +ifeq ($(OS),Windows_NT) + EXE := .exe endif # use arm-none-eabi-cpp for macOS @@ -70,114 +75,119 @@ else CPP := $(PREFIX)cpp endif -ROM_NAME := pokeemerald_agbcc.gba +ROM_NAME := $(FILE_NAME)_agbcc.gba +OBJ_DIR_NAME := $(BUILD_DIR)/emerald +OBJ_DIR_NAME_TEST := $(BUILD_DIR)/test +MODERN_ROM_NAME := $(FILE_NAME).gba +MODERN_OBJ_DIR_NAME := $(BUILD_DIR)/modern +MODERN_OBJ_DIR_NAME_TEST := $(BUILD_DIR)/modern-test + ELF_NAME := $(ROM_NAME:.gba=.elf) MAP_NAME := $(ROM_NAME:.gba=.map) -OBJ_DIR_NAME := build/emerald - -MODERN_ROM_NAME := pokeemerald.gba MODERN_ELF_NAME := $(MODERN_ROM_NAME:.gba=.elf) MODERN_MAP_NAME := $(MODERN_ROM_NAME:.gba=.map) -MODERN_OBJ_DIR_NAME := build/modern - -SHELL := bash -o pipefail - -ELF = $(ROM:.gba=.elf) -MAP = $(ROM:.gba=.map) -SYM = $(ROM:.gba=.sym) - -TEST_OBJ_DIR_NAME_MODERN := build/modern-test -TEST_OBJ_DIR_NAME_AGBCC := build/test +TESTELF = $(ROM_NAME:.gba=-test.elf) +HEADLESSELF = $(ROM_NAME:.gba=-test-headless.elf) +# Pick our active variables ifeq ($(MODERN),0) -TEST_OBJ_DIR_NAME := $(TEST_OBJ_DIR_NAME_AGBCC) + ROM := $(ROM_NAME) + ifeq ($(TEST), 0) + OBJ_DIR := $(OBJ_DIR_NAME) + else + OBJ_DIR := $(OBJ_DIR_NAME_TEST) + endif else -TEST_OBJ_DIR_NAME := $(TEST_OBJ_DIR_NAME_MODERN) + ROM := $(MODERN_ROM_NAME) + ifeq ($(TEST), 0) + OBJ_DIR := $(MODERN_OBJ_DIR_NAME) + else + OBJ_DIR := $(MODERN_OBJ_DIR_NAME_TEST) + endif +endif +ifeq ($(TESTELF),$(MAKECMDGOALS)) + TEST := 1 endif -TESTELF = $(ROM:.gba=-test.elf) -HEADLESSELF = $(ROM:.gba=-test-headless.elf) +ELF := $(ROM:.gba=.elf) +MAP := $(ROM:.gba=.map) +SYM := $(ROM:.gba=.sym) +# Commonly used directories C_SUBDIR = src -GFLIB_SUBDIR = gflib ASM_SUBDIR = asm DATA_SRC_SUBDIR = src/data DATA_ASM_SUBDIR = data SONG_SUBDIR = sound/songs MID_SUBDIR = sound/songs/midi -SAMPLE_SUBDIR = sound/direct_sound_samples -CRY_SUBDIR = sound/direct_sound_samples/cries TEST_SUBDIR = test C_BUILDDIR = $(OBJ_DIR)/$(C_SUBDIR) -GFLIB_BUILDDIR = $(OBJ_DIR)/$(GFLIB_SUBDIR) ASM_BUILDDIR = $(OBJ_DIR)/$(ASM_SUBDIR) DATA_ASM_BUILDDIR = $(OBJ_DIR)/$(DATA_ASM_SUBDIR) SONG_BUILDDIR = $(OBJ_DIR)/$(SONG_SUBDIR) MID_BUILDDIR = $(OBJ_DIR)/$(MID_SUBDIR) TEST_BUILDDIR = $(OBJ_DIR)/$(TEST_SUBDIR) +SHELL := bash -o pipefail + +# Set flags for tools ASFLAGS := -mcpu=arm7tdmi --defsym MODERN=$(MODERN) +INCLUDE_DIRS := include +INCLUDE_CPP_ARGS := $(INCLUDE_DIRS:%=-iquote %) +INCLUDE_SCANINC_ARGS := $(INCLUDE_DIRS:%=-I %) + +O_LEVEL ?= 2 +CPPFLAGS := $(INCLUDE_CPP_ARGS) -Wno-trigraphs -DMODERN=$(MODERN) -DTESTING=$(TEST) ifeq ($(MODERN),0) -CC1 := tools/agbcc/bin/agbcc$(EXE) -override CFLAGS += -mthumb-interwork -Wimplicit -Wparentheses -Werror -O2 -fhex-asm -g -ROM := $(ROM_NAME) -OBJ_DIR := $(OBJ_DIR_NAME) -LIBPATH := -L ../../tools/agbcc/lib -LIB := $(LIBPATH) -lgcc -lc -L../../libagbsyscall -lagbsyscall + CPPFLAGS += -I tools/agbcc/include -I tools/agbcc -nostdinc -undef + CC1 := tools/agbcc/bin/agbcc$(EXE) + override CFLAGS += -mthumb-interwork -Wimplicit -Wparentheses -Werror -O$(O_LEVEL) -fhex-asm -g + LIBPATH := -L ../../tools/agbcc/lib + LIB := $(LIBPATH) -lgcc -lc -L../../libagbsyscall -lagbsyscall else -CC1 = $(shell $(PATH_MODERNCC) --print-prog-name=cc1) -quiet -override CFLAGS += -mthumb -mthumb-interwork -O2 -mabi=apcs-gnu -mtune=arm7tdmi -march=armv4t -fno-toplevel-reorder -Wno-pointer-to-int-cast -std=gnu17 -Werror -Wall -Wno-strict-aliasing -Wno-attribute-alias -Woverride-init -ifeq ($(ANALYZE),1) -override CFLAGS += -fanalyzer -endif -# Only throw an error for unused elements if its RH-Hideout's repo -ifeq ($(UNUSED_ERROR),0) -ifneq ($(GITHUB_REPOSITORY_OWNER),rh-hideout) -override CFLAGS += -Wno-error=unused-variable -Wno-error=unused-const-variable -Wno-error=unused-parameter -Wno-error=unused-function -Wno-error=unused-but-set-parameter -Wno-error=unused-but-set-variable -Wno-error=unused-value -Wno-error=unused-local-typedefs -endif -endif -ROM := $(MODERN_ROM_NAME) -OBJ_DIR := $(MODERN_OBJ_DIR_NAME) -LIBPATH := -L "$(dir $(shell $(PATH_MODERNCC) -mthumb -print-file-name=libgcc.a))" -L "$(dir $(shell $(PATH_MODERNCC) -mthumb -print-file-name=libnosys.a))" -L "$(dir $(shell $(PATH_MODERNCC) -mthumb -print-file-name=libc.a))" -LIB := $(LIBPATH) -lc -lnosys -lgcc -L../../libagbsyscall -lagbsyscall -endif - -ifeq ($(TESTELF),$(MAKECMDGOALS)) - TEST := 1 -endif - -ifeq ($(TEST),1) -OBJ_DIR := $(TEST_OBJ_DIR_NAME) + # Note: The makefile must be set up to not call these if modern == 0 + MODERNCC := $(PREFIX)gcc + PATH_MODERNCC := PATH="$(PATH)" $(MODERNCC) + CC1 := $(shell $(PATH_MODERNCC) --print-prog-name=cc1) -quiet + override CFLAGS += -mthumb -mthumb-interwork -O$(O_LEVEL) -mabi=apcs-gnu -mtune=arm7tdmi -march=armv4t -fno-toplevel-reorder -Wno-pointer-to-int-cast -std=gnu17 -Werror -Wall -Wno-strict-aliasing -Wno-attribute-alias -Woverride-init + ifeq ($(ANALYZE),1) + override CFLAGS += -fanalyzer + endif + # Only throw an error for unused elements if its RH-Hideout's repo + ifeq ($(UNUSED_ERROR),0) + ifneq ($(GITHUB_REPOSITORY_OWNER),rh-hideout) + override CFLAGS += -Wno-error=unused-variable -Wno-error=unused-const-variable -Wno-error=unused-parameter -Wno-error=unused-function -Wno-error=unused-but-set-parameter -Wno-error=unused-but-set-variable -Wno-error=unused-value -Wno-error=unused-local-typedefs + endif + endif + LIBPATH := -L "$(dir $(shell $(PATH_MODERNCC) -mthumb -print-file-name=libgcc.a))" -L "$(dir $(shell $(PATH_MODERNCC) -mthumb -print-file-name=libnosys.a))" -L "$(dir $(shell $(PATH_MODERNCC) -mthumb -print-file-name=libc.a))" + LIB := $(LIBPATH) -lc -lnosys -lgcc -L../../libagbsyscall -lagbsyscall endif - -CPPFLAGS := -iquote include -iquote $(GFLIB_SUBDIR) -Wno-trigraphs -DMODERN=$(MODERN) -DTESTING=$(TEST) -ifneq ($(MODERN),1) -CPPFLAGS += -I tools/agbcc/include -I tools/agbcc -nostdinc -undef +# Enable debug info if set +ifeq ($(DINFO),1) + override CFLAGS += -g endif -SHA1 := $(shell { command -v sha1sum || command -v shasum; } 2>/dev/null) -c -GFX := tools/gbagfx/gbagfx$(EXE) -AIF := tools/aif2pcm/aif2pcm$(EXE) -MID := tools/mid2agb/mid2agb$(EXE) -SCANINC := tools/scaninc/scaninc$(EXE) -PREPROC := tools/preproc/preproc$(EXE) -RAMSCRGEN := tools/ramscrgen/ramscrgen$(EXE) -FIX := tools/gbafix/gbafix$(EXE) -MAPJSON := tools/mapjson/mapjson$(EXE) -JSONPROC := tools/jsonproc/jsonproc$(EXE) -PATCHELF := tools/patchelf/patchelf$(EXE) -ROMTEST ?= $(shell { command -v mgba-rom-test || command -v tools/mgba/mgba-rom-test$(EXE); } 2>/dev/null) -ROMTESTHYDRA := tools/mgba-rom-test-hydra/mgba-rom-test-hydra$(EXE) -TRAINERPROC := tools/trainerproc/trainerproc$(EXE) +# Variable filled out in other make files +AUTO_GEN_TARGETS := +include make_tools.mk +# Tool executables +GFX := $(TOOLS_DIR)/gbagfx/gbagfx$(EXE) +AIF := $(TOOLS_DIR)/aif2pcm/aif2pcm$(EXE) +MID := $(TOOLS_DIR)/mid2agb/mid2agb$(EXE) +SCANINC := $(TOOLS_DIR)/scaninc/scaninc$(EXE) +PREPROC := $(TOOLS_DIR)/preproc/preproc$(EXE) +RAMSCRGEN := $(TOOLS_DIR)/ramscrgen/ramscrgen$(EXE) +FIX := $(TOOLS_DIR)/gbafix/gbafix$(EXE) +MAPJSON := $(TOOLS_DIR)/mapjson/mapjson$(EXE) +JSONPROC := $(TOOLS_DIR)/jsonproc/jsonproc$(EXE) +TRAINERPROC := $(TOOLS_DIR)/trainerproc/trainerproc$(EXE) +PATCHELF := $(TOOLS_DIR)/patchelf/patchelf$(EXE) +ROMTEST ?= $(shell { command -v mgba-rom-test || command -v $(TOOLS_DIR)/mgba/mgba-rom-test$(EXE); } 2>/dev/null) +ROMTESTHYDRA := $(TOOLS_DIR)/mgba-rom-test-hydra/mgba-rom-test-hydra$(EXE) PERL := perl - -# Inclusive list. If you don't want a tool to be built, don't add it here. -TOOLDIRS := tools/aif2pcm tools/bin2c tools/gbafix tools/gbagfx tools/jsonproc tools/mapjson tools/mid2agb tools/preproc tools/ramscrgen tools/rsfont tools/scaninc tools/trainerproc -CHECKTOOLDIRS = tools/patchelf tools/mgba-rom-test-hydra -TOOLBASE = $(TOOLDIRS:tools/%=%) -TOOLS = $(foreach tool,$(TOOLBASE),tools/$(tool)/$(tool)$(EXE)) +SHA1 := $(shell { command -v sha1sum || command -v shasum; } 2>/dev/null) -c MAKEFLAGS += --no-print-directory @@ -188,37 +198,41 @@ MAKEFLAGS += --no-print-directory # Delete files that weren't built properly .DELETE_ON_ERROR: -# Secondary expansion is required for dependency variables in object rules. -.SECONDEXPANSION: - -.PHONY: all rom clean compare tidy tools check-tools mostlyclean clean-tools clean-check-tools $(TOOLDIRS) $(CHECKTOOLDIRS) libagbsyscall agbcc modern tidymodern tidynonmodern check history +RULES_NO_SCAN += libagbsyscall clean clean-assets tidy tidymodern tidynonmodern tidycheck generated clean-generated $(TESTELF) +.PHONY: all rom agbcc modern compare check +.PHONY: $(RULES_NO_SCAN) infoshell = $(foreach line, $(shell $1 | sed "s/ /__SPACE__/g"), $(info $(subst __SPACE__, ,$(line)))) -# Build tools when building the rom -# Disable dependency scanning for clean/tidy/tools -# Use a separate minimal makefile for speed -# Since we don't need to reload most of this makefile -ifeq (,$(filter-out all rom compare agbcc modern check libagbsyscall syms $(TESTELF),$(MAKECMDGOALS))) -$(call infoshell, $(MAKE) -f make_tools.mk) -else -NODEP ?= 1 +# Check if we need to scan dependencies based on the chosen rule OR user preference +NODEP ?= 0 +# Check if we need to pre-build tools and generate assets based on the chosen rule. +SETUP_PREREQS ?= 1 +# Disable dependency scanning for rules that don't need it. +ifneq (,$(MAKECMDGOALS)) + ifeq (,$(filter-out $(RULES_NO_SCAN),$(MAKECMDGOALS))) + NODEP := 1 + SETUP_PREREQS := 0 + endif endif -# check if we need to scan dependencies based on the rule -ifeq (,$(MAKECMDGOALS)) - SCAN_DEPS ?= 1 -else - # clean, tidy, tools, check-tools, mostlyclean, clean-tools, clean-check-tools, $(TOOLDIRS), $(CHECKTOOLDIRS), tidymodern, tidynonmodern, tidycheck don't even build the ROM - # libagbsyscall does its own thing - ifeq (,$(filter-out clean tidy tools mostlyclean clean-tools $(TOOLDIRS) clean-check-tools $(CHECKTOOLDIRS) tidymodern tidynonmodern tidycheck libagbsyscall,$(MAKECMDGOALS))) - SCAN_DEPS ?= 0 - else - SCAN_DEPS ?= 1 +.SHELLSTATUS ?= 0 + +ifeq ($(SETUP_PREREQS),1) + # If set on: Default target or a rule requiring a scan + # Forcibly execute `make tools` since we need them for what we are doing. + $(foreach line, $(shell $(MAKE) -f make_tools.mk | sed "s/ /__SPACE__/g"), $(info $(subst __SPACE__, ,$(line)))) + ifneq ($(.SHELLSTATUS),0) + $(error Errors occurred while building tools. See error messages above for more details) + endif + # Oh and also generate mapjson sources before we use `SCANINC`. + $(foreach line, $(shell $(MAKE) generated | sed "s/ /__SPACE__/g"), $(info $(subst __SPACE__, ,$(line)))) + ifneq ($(.SHELLSTATUS),0) + $(error Errors occurred while generating map-related sources. See error messages above for more details) endif endif -ifeq ($(SCAN_DEPS),1) +# Collect sources C_SRCS_IN := $(wildcard $(C_SUBDIR)/*.c $(C_SUBDIR)/*/*.c $(C_SUBDIR)/*/*/*.c) C_SRCS := $(foreach src,$(C_SRCS_IN),$(if $(findstring .inc.c,$(src)),,$(src))) C_OBJS := $(patsubst $(C_SUBDIR)/%.c,$(C_BUILDDIR)/%.o,$(C_SRCS)) @@ -228,10 +242,7 @@ TEST_SRCS := $(foreach src,$(TEST_SRCS_IN),$(if $(findstring .inc.c,$(src)),,$(s TEST_OBJS := $(patsubst $(TEST_SUBDIR)/%.c,$(TEST_BUILDDIR)/%.o,$(TEST_SRCS)) TEST_OBJS_REL := $(patsubst $(OBJ_DIR)/%,%,$(TEST_OBJS)) -GFLIB_SRCS := $(wildcard $(GFLIB_SUBDIR)/*.c) -GFLIB_OBJS := $(patsubst $(GFLIB_SUBDIR)/%.c,$(GFLIB_BUILDDIR)/%.o,$(GFLIB_SRCS)) - -C_ASM_SRCS += $(wildcard $(C_SUBDIR)/*.s $(C_SUBDIR)/*/*.s $(C_SUBDIR)/*/*/*.s) +C_ASM_SRCS := $(wildcard $(C_SUBDIR)/*.s $(C_SUBDIR)/*/*.s $(C_SUBDIR)/*/*/*.s) C_ASM_OBJS := $(patsubst $(C_SUBDIR)/%.s,$(C_BUILDDIR)/%.o,$(C_ASM_SRCS)) ASM_SRCS := $(wildcard $(ASM_SUBDIR)/*.s) @@ -249,57 +260,62 @@ SONG_OBJS := $(patsubst $(SONG_SUBDIR)/%.s,$(SONG_BUILDDIR)/%.o,$(SONG_SRCS)) MID_SRCS := $(wildcard $(MID_SUBDIR)/*.mid) MID_OBJS := $(patsubst $(MID_SUBDIR)/%.mid,$(MID_BUILDDIR)/%.o,$(MID_SRCS)) -OBJS := $(C_OBJS) $(GFLIB_OBJS) $(C_ASM_OBJS) $(ASM_OBJS) $(DATA_ASM_OBJS) $(SONG_OBJS) $(MID_OBJS) +OBJS := $(C_OBJS) $(C_ASM_OBJS) $(ASM_OBJS) $(DATA_ASM_OBJS) $(SONG_OBJS) $(MID_OBJS) OBJS_REL := $(patsubst $(OBJ_DIR)/%,%,$(OBJS)) SUBDIRS := $(sort $(dir $(OBJS) $(dir $(TEST_OBJS)))) $(shell mkdir -p $(SUBDIRS)) -endif -AUTO_GEN_TARGETS := - -all: history rom - -history: - @bash ./check_history.sh +# Pretend rules that are actually flags defer to `make all` +modern: all +compare: all +# Uncomment the next line, and then comment the 4 lines after it to reenable agbcc. +#agbcc: all +agbcc: + @echo "'make agbcc' is deprecated as of pokeemerald-expansion 1.9 and will be removed in 1.10." + @echo "Search for 'agbcc: all' in Makefile to reenable agbcc." + @exit 1 -tools: $(TOOLDIRS) +LD_SCRIPT_TEST := ld_script_test.ld -check-tools: $(CHECKTOOLDIRS) +$(OBJ_DIR)/ld_script_test.ld: $(LD_SCRIPT_TEST) $(LD_SCRIPT_DEPS) + cd $(OBJ_DIR) && sed "s#tools/#../../tools/#g" ../../$(LD_SCRIPT_TEST) > ld_script_test.ld -syms: $(SYM) +$(TESTELF): $(OBJ_DIR)/ld_script_test.ld $(OBJS) $(TEST_OBJS) libagbsyscall tools check-tools + @echo "cd $(OBJ_DIR) && $(LD) -T ld_script_test.ld -o ../../$@ " + @cd $(OBJ_DIR) && $(LD) $(TESTLDFLAGS) -T ld_script_test.ld -o ../../$@ $(OBJS_REL) $(TEST_OBJS_REL) $(LIB) + $(FIX) $@ -t"$(TITLE)" -c$(GAME_CODE) -m$(MAKER_CODE) -r$(REVISION) -d0 --silent + $(PATCHELF) $(TESTELF) gTestRunnerArgv "$(TESTS)\0" -$(TOOLDIRS): - @$(MAKE) -C $@ +ifeq ($(GITHUB_REPOSITORY_OWNER),rh-hideout) +TEST_SKIP_IS_FAIL := \x01 +else +TEST_SKIP_IS_FAIL := \x00 +endif -$(CHECKTOOLDIRS): - @$(MAKE) -C $@ +check: $(TESTELF) + @cp $< $(HEADLESSELF) + $(PATCHELF) $(HEADLESSELF) gTestRunnerHeadless '\x01' gTestRunnerSkipIsFail "$(TEST_SKIP_IS_FAIL)" + $(ROMTESTHYDRA) $(ROMTEST) $(OBJCOPY) $(HEADLESSELF) +# Other rules rom: $(ROM) ifeq ($(COMPARE),1) @$(SHA1) rom.sha1 endif -# For contributors to make sure a change didn't affect the contents of the ROM. -compare: all - -clean: mostlyclean clean-tools clean-check-tools - -clean-tools: - @$(foreach tooldir,$(TOOLDIRS),$(MAKE) clean -C $(tooldir);) +syms: $(SYM) -clean-check-tools: - @$(foreach tooldir,$(CHECKTOOLDIRS),$(MAKE) clean -C $(tooldir);) +clean: tidy clean-tools clean-check-tools clean-generated clean-assets + @$(MAKE) clean -C libagbsyscall -mostlyclean: tidynonmodern tidymodern tidycheck - find sound -iname '*.bin' -exec rm {} + +clean-assets: rm -f $(MID_SUBDIR)/*.s - find . \( -iname '*.1bpp' -o -iname '*.4bpp' -o -iname '*.8bpp' -o -iname '*.gbapal' -o -iname '*.lz' -o -iname '*.rl' -o -iname '*.latfont' -o -iname '*.hwjpnfont' -o -iname '*.fwjpnfont' \) -exec rm {} + rm -f $(DATA_ASM_SUBDIR)/layouts/layouts.inc $(DATA_ASM_SUBDIR)/layouts/layouts_table.inc rm -f $(DATA_ASM_SUBDIR)/maps/connections.inc $(DATA_ASM_SUBDIR)/maps/events.inc $(DATA_ASM_SUBDIR)/maps/groups.inc $(DATA_ASM_SUBDIR)/maps/headers.inc $(DATA_SRC_SUBDIR)/map_group_count.h + find sound -iname '*.bin' -exec rm {} + + find . \( -iname '*.1bpp' -o -iname '*.4bpp' -o -iname '*.8bpp' -o -iname '*.gbapal' -o -iname '*.lz' -o -iname '*.rl' -o -iname '*.latfont' -o -iname '*.hwjpnfont' -o -iname '*.fwjpnfont' \) -exec rm {} + find $(DATA_ASM_SUBDIR)/maps \( -iname 'connections.inc' -o -iname 'events.inc' -o -iname 'header.inc' \) -exec rm {} + - rm -f $(AUTO_GEN_TARGETS) - @$(MAKE) clean -C libagbsyscall tidy: tidynonmodern tidymodern tidycheck @@ -313,159 +329,113 @@ tidymodern: tidycheck: rm -f $(TESTELF) $(HEADLESSELF) - rm -rf $(TEST_OBJ_DIR_NAME_MODERN) - rm -rf $(TEST_OBJ_DIR_NAME_AGBCC) - - -ifneq ($(MODERN),0) -$(C_BUILDDIR)/berry_crush.o: override CFLAGS += -Wno-address-of-packed-member -endif + rm -rf $(MODERN_OBJ_DIR_NAME_TEST) + rm -rf $(OBJ_DIR_NAME_TEST) +# Other rules include graphics_file_rules.mk include map_data_rules.mk include spritesheet_rules.mk include json_data_rules.mk -include songs.mk +include audio_rules.mk + +# NOTE: Tools must have been built prior (FIXME) +# so you can't really call this rule directly +generated: $(AUTO_GEN_TARGETS) -%.s: ; +%.s: ; %.png: ; %.pal: ; %.aif: ; -%.1bpp: %.png ; $(GFX) $< $@ -%.4bpp: %.png ; $(GFX) $< $@ -%.8bpp: %.png ; $(GFX) $< $@ -%.gbapal: %.pal ; $(GFX) $< $@ -%.gbapal: %.png ; $(GFX) $< $@ -%.lz: % ; $(GFX) $< $@ -%.rl: % ; $(GFX) $< $@ +%.1bpp: %.png ; $(GFX) $< $@ +%.4bpp: %.png ; $(GFX) $< $@ +%.8bpp: %.png ; $(GFX) $< $@ +%.gbapal: %.pal ; $(GFX) $< $@ +%.gbapal: %.png ; $(GFX) $< $@ +%.lz: % ; $(GFX) $< $@ +%.rl: % ; $(GFX) $< $@ -$(CRY_SUBDIR)/uncomp_%.bin: $(CRY_SUBDIR)/uncomp_%.aif ; $(AIF) $< $@ -$(CRY_SUBDIR)/%.bin: $(CRY_SUBDIR)/%.aif ; $(AIF) $< $@ --compress -sound/%.bin: sound/%.aif ; $(AIF) $< $@ +clean-generated: + -rm -f $(AUTO_GEN_TARGETS) -COMPETITIVE_PARTY_SYNTAX := $(shell PATH="$(PATH)"; echo 'COMPETITIVE_PARTY_SYNTAX' | $(CPP) $(CPPFLAGS) -imacros include/global.h | tail -n1) +COMPETITIVE_PARTY_SYNTAX := $(shell PATH="$(PATH)"; echo 'COMPETITIVE_PARTY_SYNTAX' | $(CPP) $(CPPFLAGS) -imacros include/gba/defines.h -imacros include/config/general.h | tail -n1) ifeq ($(COMPETITIVE_PARTY_SYNTAX),1) -%.h: %.party tools ; $(CPP) $(CPPFLAGS) -traditional-cpp - < $< | $(TRAINERPROC) -o $@ -i $< - +%.h: %.party ; $(CPP) $(CPPFLAGS) -traditional-cpp - < $< | $(TRAINERPROC) -o $@ -i $< - endif ifeq ($(MODERN),0) -$(C_BUILDDIR)/libc.o: CC1 := tools/agbcc/bin/old_agbcc$(EXE) +$(C_BUILDDIR)/libc.o: CC1 := $(TOOLS_DIR)/agbcc/bin/old_agbcc$(EXE) $(C_BUILDDIR)/libc.o: CFLAGS := -O2 - $(C_BUILDDIR)/siirtc.o: CFLAGS := -mthumb-interwork - $(C_BUILDDIR)/agb_flash.o: CFLAGS := -O -mthumb-interwork $(C_BUILDDIR)/agb_flash_1m.o: CFLAGS := -O -mthumb-interwork $(C_BUILDDIR)/agb_flash_mx.o: CFLAGS := -O -mthumb-interwork - $(C_BUILDDIR)/m4a.o: CC1 := tools/agbcc/bin/old_agbcc$(EXE) - $(C_BUILDDIR)/record_mixing.o: CFLAGS += -ffreestanding -$(C_BUILDDIR)/librfu_intr.o: CC1 := tools/agbcc/bin/agbcc_arm$(EXE) +$(C_BUILDDIR)/librfu_intr.o: CC1 := $(TOOLS_DIR)/agbcc/bin/agbcc_arm$(EXE) $(C_BUILDDIR)/librfu_intr.o: CFLAGS := -O2 -mthumb-interwork -quiet else $(C_BUILDDIR)/librfu_intr.o: CFLAGS := -mthumb-interwork -O2 -mabi=apcs-gnu -mtune=arm7tdmi -march=armv4t -fno-toplevel-reorder -Wno-pointer-to-int-cast +$(C_BUILDDIR)/berry_crush.o: override CFLAGS += -Wno-address-of-packed-member $(C_BUILDDIR)/pokedex_plus_hgss.o: CFLAGS := -mthumb -mthumb-interwork -O2 -mabi=apcs-gnu -mtune=arm7tdmi -march=armv4t -Wno-pointer-to-int-cast -std=gnu17 -Werror -Wall -Wno-strict-aliasing -Wno-attribute-alias -Woverride-init # Annoyingly we can't turn this on just for src/data/trainers.h $(C_BUILDDIR)/data.o: CFLAGS += -fno-show-column -fno-diagnostics-show-caret endif -ifeq ($(DINFO),1) -override CFLAGS += -g -endif +# Dependency rules (for the *.c & *.s sources to .o files) +# Have to be explicit or else missing files won't be reported. -# The dep rules have to be explicit or else missing files won't be reported. # As a side effect, they're evaluated immediately instead of when the rule is invoked. -# It doesn't look like $(shell) can be deferred so there might not be a better way. +# It doesn't look like $(shell) can be deferred so there might not be a better way (Icedude_907: there is soon). -ifeq ($(SCAN_DEPS),1) -ifeq ($(NODEP),1) $(C_BUILDDIR)/%.o: $(C_SUBDIR)/%.c -ifeq (,$(KEEP_TEMPS)) +ifneq ($(KEEP_TEMPS),1) @echo "$(CC1) -o $@ $<" @$(CPP) $(CPPFLAGS) $< | $(PREPROC) -i $< charmap.txt | $(CC1) $(CFLAGS) -o - - | cat - <(echo -e ".text\n\t.align\t2, 0") | $(AS) $(ASFLAGS) -o $@ - else - @$(CPP) $(CPPFLAGS) $< -o $(C_BUILDDIR)/$*.i - @$(PREPROC) $(C_BUILDDIR)/$*.i charmap.txt | $(CC1) $(CFLAGS) -o $(C_BUILDDIR)/$*.s - @echo -e ".text\n\t.align\t2, 0\n" >> $(C_BUILDDIR)/$*.s - $(AS) $(ASFLAGS) -o $@ $(C_BUILDDIR)/$*.s -endif -else -define C_DEP -$1: $2 $$(shell $(SCANINC) -I include -I tools/agbcc/include -I gflib $2) -ifeq (,$$(KEEP_TEMPS)) - @echo "$$(CC1) -o $$@ $$<" - @$$(CPP) $$(CPPFLAGS) $$< | $$(PREPROC) -i $$< charmap.txt | $$(CC1) $$(CFLAGS) -o - - | cat - <(echo -e ".text\n\t.align\t2, 0") | $$(AS) $$(ASFLAGS) -o $$@ - -else - @$$(CPP) $$(CPPFLAGS) $$< -o $$(C_BUILDDIR)/$3.i - @$$(PREPROC) $$(C_BUILDDIR)/$3.i charmap.txt | $$(CC1) $$(CFLAGS) -o $$(C_BUILDDIR)/$3.s - @echo -e ".text\n\t.align\t2, 0\n" >> $$(C_BUILDDIR)/$3.s - $$(AS) $$(ASFLAGS) -o $$@ $$(C_BUILDDIR)/$3.s -endif -endef -$(foreach src, $(C_SRCS), $(eval $(call C_DEP,$(patsubst $(C_SUBDIR)/%.c,$(C_BUILDDIR)/%.o,$(src)),$(src),$(patsubst $(C_SUBDIR)/%.c,%,$(src))))) + @$(CPP) $(CPPFLAGS) $< -o $*.i + @$(PREPROC) $*.i charmap.txt | $(CC1) $(CFLAGS) -o $*.s + @echo -e ".text\n\t.align\t2, 0\n" >> $*.s + $(AS) $(ASFLAGS) -o $@ $*.s endif -ifeq ($(NODEP),1) -$(GFLIB_BUILDDIR)/%.o: $(GFLIB_SUBDIR)/%.c $$(c_dep) -ifeq (,$(KEEP_TEMPS)) - @echo "$(CC1) -o $@ $<" - @$(CPP) $(CPPFLAGS) $< | $(PREPROC) -i $< charmap.txt | $(CC1) $(CFLAGS) -o - - | cat - <(echo -e ".text\n\t.align\t2, 0") | $(AS) $(ASFLAGS) -o $@ - -else - @$(CPP) $(CPPFLAGS) $< -o $(GFLIB_BUILDDIR)/$*.i - @$(PREPROC) $(GFLIB_BUILDDIR)/$*.i charmap.txt | $(CC1) $(CFLAGS) -o $(GFLIB_BUILDDIR)/$*.s - @echo -e ".text\n\t.align\t2, 0\n" >> $(GFLIB_BUILDDIR)/$*.s - $(AS) $(ASFLAGS) -o $@ $(GFLIB_BUILDDIR)/$*.s -endif -else -define GFLIB_DEP -$1: $2 $$(shell $(SCANINC) -I include -I tools/agbcc/include -I gflib $2) -ifeq (,$$(KEEP_TEMPS)) - @echo "$$(CC1) -o $$@ $$<" - @$$(CPP) $$(CPPFLAGS) $$< | $$(PREPROC) -i $$< charmap.txt | $$(CC1) $$(CFLAGS) -o - - | cat - <(echo -e ".text\n\t.align\t2, 0") | $$(AS) $$(ASFLAGS) -o $$@ - -else - @$$(CPP) $$(CPPFLAGS) $$< -o $$(GFLIB_BUILDDIR)/$3.i - @$$(PREPROC) $$(GFLIB_BUILDDIR)/$3.i charmap.txt | $$(CC1) $$(CFLAGS) -o $$(GFLIB_BUILDDIR)/$3.s - @echo -e ".text\n\t.align\t2, 0\n" >> $$(GFLIB_BUILDDIR)/$3.s - $$(AS) $$(ASFLAGS) -o $$@ $$(GFLIB_BUILDDIR)/$3.s -endif -endef -$(foreach src, $(GFLIB_SRCS), $(eval $(call GFLIB_DEP,$(patsubst $(GFLIB_SUBDIR)/%.c,$(GFLIB_BUILDDIR)/%.o, $(src)),$(src),$(patsubst $(GFLIB_SUBDIR)/%.c,%, $(src))))) -endif +$(C_BUILDDIR)/%.d: $(C_SUBDIR)/%.c + $(SCANINC) -M $@ $(INCLUDE_SCANINC_ARGS) -I tools/agbcc/include $< -ifeq ($(NODEP),1) -$(C_BUILDDIR)/%.o: $(C_SUBDIR)/%.s - $(PREPROC) $< charmap.txt | $(CPP) -I include - | $(PREPROC) -i $$< charmap.txt | $(AS) $(ASFLAGS) -o $@ -else -define SRC_ASM_DATA_DEP -$1: $2 $$(shell $(SCANINC) -I include -I "" $2) - $$(PREPROC) $$< charmap.txt | $$(CPP) -I include - | $$(PREPROC) -ie $$< charmap.txt | $$(AS) $$(ASFLAGS) -o $$@ -endef -$(foreach src, $(C_ASM_SRCS), $(eval $(call SRC_ASM_DATA_DEP,$(patsubst $(C_SUBDIR)/%.s,$(C_BUILDDIR)/%.o, $(src)),$(src)))) +ifneq ($(NODEP),1) +-include $(addprefix $(OBJ_DIR)/,$(C_SRCS:.c=.d)) endif -ifeq ($(NODEP),1) $(ASM_BUILDDIR)/%.o: $(ASM_SUBDIR)/%.s $(AS) $(ASFLAGS) -o $@ $< -else -define ASM_DEP -$1: $2 $$(shell $(SCANINC) -I include -I "" $2) - $$(AS) $$(ASFLAGS) -o $$@ $$< -endef -$(foreach src, $(ASM_SRCS), $(eval $(call ASM_DEP,$(patsubst $(ASM_SUBDIR)/%.s,$(ASM_BUILDDIR)/%.o, $(src)),$(src)))) -endif -ifeq ($(NODEP),1) -$(DATA_ASM_BUILDDIR)/%.o: $(DATA_ASM_SUBDIR)/%.s - $(PREPROC) $< charmap.txt | $(CPP) -I include - | $(PREPROC) -ie $$< charmap.txt | $(AS) $(ASFLAGS) -o $@ -else -$(foreach src, $(REGULAR_DATA_ASM_SRCS), $(eval $(call SRC_ASM_DATA_DEP,$(patsubst $(DATA_ASM_SUBDIR)/%.s,$(DATA_ASM_BUILDDIR)/%.o, $(src)),$(src)))) +$(ASM_BUILDDIR)/%.d: $(ASM_SUBDIR)/%.s + $(SCANINC) -M $@ $(INCLUDE_SCANINC_ARGS) -I "" $< + +ifneq ($(NODEP),1) +-include $(addprefix $(OBJ_DIR)/,$(ASM_SRCS:.s=.d)) endif + +$(C_BUILDDIR)/%.o: $(C_SUBDIR)/%.s + $(PREPROC) $< charmap.txt | $(CPP) $(INCLUDE_SCANINC_ARGS) - | $(PREPROC) -ie $< charmap.txt | $(AS) $(ASFLAGS) -o $@ + +$(C_BUILDDIR)/%.d: $(C_SUBDIR)/%.s + $(SCANINC) -M $@ $(INCLUDE_SCANINC_ARGS) -I "" $< + +ifneq ($(NODEP),1) +-include $(addprefix $(OBJ_DIR)/,$(C_ASM_SRCS:.s=.d)) endif -$(SONG_BUILDDIR)/%.o: $(SONG_SUBDIR)/%.s - $(AS) $(ASFLAGS) -I sound -o $@ $< +$(DATA_ASM_BUILDDIR)/%.o: $(DATA_ASM_SUBDIR)/%.s + $(PREPROC) $< charmap.txt | $(CPP) $(INCLUDE_SCANINC_ARGS) - | $(PREPROC) -ie $< charmap.txt | $(AS) $(ASFLAGS) -o $@ + +$(DATA_ASM_BUILDDIR)/%.d: $(DATA_ASM_SUBDIR)/%.s + $(SCANINC) -M $@ $(INCLUDE_SCANINC_ARGS) -I "" $< + +ifneq ($(NODEP),1) +-include $(addprefix $(OBJ_DIR)/,$(REGULAR_DATA_ASM_SRCS:.s=.d)) +endif $(OBJ_DIR)/sym_bss.ld: sym_bss.txt $(RAMSCRGEN) .bss $< ENGLISH > $@ @@ -478,16 +448,17 @@ $(OBJ_DIR)/sym_ewram.ld: sym_ewram.txt # NOTE: Depending on event_scripts.o is hacky, but we want to depend on everything event_scripts.s depends on without having to alter scaninc $(DATA_SRC_SUBDIR)/pokemon/teachable_learnsets.h: $(DATA_ASM_BUILDDIR)/event_scripts.o - python3 tools/learnset_helpers/teachable.py + python3 $(TOOLS_DIR)/learnset_helpers/teachable.py # NOTE: Based on C_DEP above, but without NODEP and KEEP_TEMPS handling. define TEST_DEP -$1: $2 $$(shell $(SCANINC) -I include -I tools/agbcc/include -I gflib $2) +$1: $2 $$(shell $(SCANINC) -I include -I $(TOOLS_DIR)/agbcc/include $2) @echo "$$(CC1) -o $$@ $$<" @$$(CPP) $$(CPPFLAGS) $$< | $$(PREPROC) -i $$< charmap.txt | $$(CC1) $$(CFLAGS) -o - - | cat - <(echo -e ".text\n\t.align\t2, 0") | $$(AS) $$(ASFLAGS) -o $$@ - endef $(foreach src, $(TEST_SRCS), $(eval $(call TEST_DEP,$(patsubst $(TEST_SUBDIR)/%.c,$(TEST_BUILDDIR)/%.o,$(src)),$(src),$(patsubst $(TEST_SUBDIR)/%.c,%,$(src))))) +# Linker script ifeq ($(MODERN),0) LD_SCRIPT := ld_script.ld LD_SCRIPT_DEPS := $(OBJ_DIR)/sym_bss.ld $(OBJ_DIR)/sym_common.ld $(OBJ_DIR)/sym_ewram.ld @@ -496,56 +467,22 @@ LD_SCRIPT := ld_script_modern.ld LD_SCRIPT_DEPS := endif -$(OBJ_DIR)/ld_script.ld: $(LD_SCRIPT) $(LD_SCRIPT_DEPS) - cd $(OBJ_DIR) && sed "s#tools/#../../tools/#g" ../../$(LD_SCRIPT) > ld_script.ld +# Final rules -LDFLAGS = -Map ../../$(MAP) -$(ELF): $(OBJ_DIR)/ld_script.ld $(OBJS) libagbsyscall - @echo "cd $(OBJ_DIR) && $(LD) $(LDFLAGS) -T ld_script.ld -o ../../$@ " - @cd $(OBJ_DIR) && $(LD) $(LDFLAGS) -T ld_script.ld --print-memory-usage -o ../../$@ $(OBJS_REL) $(LIB) | cat +libagbsyscall: + @$(MAKE) -C libagbsyscall TOOLCHAIN=$(TOOLCHAIN) MODERN=$(MODERN) + +# Elf from object files +$(ELF): $(LD_SCRIPT) $(LD_SCRIPT_DEPS) $(OBJS) libagbsyscall + @cd $(OBJ_DIR) && $(LD) $(LDFLAGS) -T ../../$< --print-memory-usage -o ../../$@ $(OBJS_REL) $(LIB) | cat + @echo "cd $(OBJ_DIR) && $(LD) $(LDFLAGS) -T ../../$< --print-memory-usage -o ../../$@ | cat" $(FIX) $@ -t"$(TITLE)" -c$(GAME_CODE) -m$(MAKER_CODE) -r$(REVISION) --silent +# Builds the rom from the elf file $(ROM): $(ELF) $(OBJCOPY) -O binary $< $@ $(FIX) $@ -p --silent -# Uncomment the next line, and then comment the 4 lines after it to reenable agbcc. -#agbcc: all -agbcc: - @echo "'make agbcc' is deprecated as of pokeemerald-expansion 1.9 and will be removed in 1.10." - @echo "Search for 'agbcc: all' in Makefile to reenable agbcc." - @exit 1 - -modern: all - -LD_SCRIPT_TEST := ld_script_test.ld - -$(OBJ_DIR)/ld_script_test.ld: $(LD_SCRIPT_TEST) $(LD_SCRIPT_DEPS) - cd $(OBJ_DIR) && sed "s#tools/#../../tools/#g" ../../$(LD_SCRIPT_TEST) > ld_script_test.ld - -$(TESTELF): $(OBJ_DIR)/ld_script_test.ld $(OBJS) $(TEST_OBJS) libagbsyscall tools check-tools - @echo "cd $(OBJ_DIR) && $(LD) -T ld_script_test.ld -o ../../$@ " - @cd $(OBJ_DIR) && $(LD) $(TESTLDFLAGS) -T ld_script_test.ld -o ../../$@ $(OBJS_REL) $(TEST_OBJS_REL) $(LIB) - $(FIX) $@ -t"$(TITLE)" -c$(GAME_CODE) -m$(MAKER_CODE) -r$(REVISION) -d0 --silent - $(PATCHELF) $(TESTELF) gTestRunnerArgv "$(TESTS)\0" - -ifeq ($(GITHUB_REPOSITORY_OWNER),rh-hideout) -TEST_SKIP_IS_FAIL := \x01 -else -TEST_SKIP_IS_FAIL := \x00 -endif - -check: $(TESTELF) - @cp $< $(HEADLESSELF) - $(PATCHELF) $(HEADLESSELF) gTestRunnerHeadless '\x01' gTestRunnerSkipIsFail "$(TEST_SKIP_IS_FAIL)" - $(ROMTESTHYDRA) $(ROMTEST) $(OBJCOPY) $(HEADLESSELF) - -libagbsyscall: - @$(MAKE) -C libagbsyscall TOOLCHAIN=$(TOOLCHAIN) MODERN=$(MODERN) - -################### -### Symbol file ### -################### - +# Symbol file (`make syms`) $(SYM): $(ELF) $(OBJDUMP) -t $< | sort -u | grep -E "^0[2389]" | $(PERL) -p -e 's/^(\w{8}) (\w).{6} \S+\t(\w{8}) (\S+)$$/\1 \2 \3 \4/g' > $@ diff --git a/asm/macros/contest_ai_script.inc b/asm/macros/contest_ai_script.inc index 9ab7184c3cc5..d66d9a8ffd99 100644 --- a/asm/macros/contest_ai_script.inc +++ b/asm/macros/contest_ai_script.inc @@ -141,25 +141,25 @@ .macro if_points_less_than num:req, destination:req .byte 0x16 - .byte \num + .2byte \num .4byte \destination .endm .macro if_points_more_than num:req, destination:req .byte 0x17 - .byte \num + .2byte \num .4byte \destination .endm .macro if_points_eq num:req, destination:req .byte 0x18 - .byte \num + .2byte \num .4byte \destination .endm .macro if_points_not_eq num:req, destination:req .byte 0x19 - .byte \num + .2byte \num .4byte \destination .endm @@ -171,25 +171,25 @@ .macro if_preliminary_points_less_than num:req, destination:req .byte 0x1B - .byte \num + .2byte \num .4byte \destination .endm .macro if_preliminary_points_more_than num:req, destination:req .byte 0x1C - .byte \num + .2byte \num .4byte \destination .endm .macro if_preliminary_points_eq num:req, destination:req .byte 0x1D - .byte \num + .2byte \num .4byte \destination .endm .macro if_preliminary_points_not_eq num:req, destination:req .byte 0x1E - .byte \num + .2byte \num .4byte \destination .endm diff --git a/audio_rules.mk b/audio_rules.mk new file mode 100644 index 000000000000..63a2e21addad --- /dev/null +++ b/audio_rules.mk @@ -0,0 +1,49 @@ +# This file contains rules for making assemblies for most music in the game. + +CRY_SUBDIR := sound/direct_sound_samples/cries + +MID_ASM_DIR := $(MID_SUBDIR) +CRY_BIN_DIR := $(CRY_SUBDIR) +SOUND_BIN_DIR := sound + +SPECIAL_OUTDIRS := $(MID_ASM_DIR) $(CRY_BIN_DIR) +SPECIAL_OUTDIRS += $(SOUND_BIN_DIR) $(SOUND_BIN_DIR)/direct_sound_samples/phonemes $(SOUND_BIN_DIR)/direct_sound_samples/cries +$(shell mkdir -p $(SPECIAL_OUTDIRS) ) + +# Assembly song compilation +$(SONG_BUILDDIR)/%.o: $(SONG_SUBDIR)/%.s + $(AS) $(ASFLAGS) -I sound -o $@ $< +$(MID_BUILDDIR)/%.o: $(MID_ASM_DIR)/%.s + $(AS) $(ASFLAGS) -I sound -o $@ $< + +# Compressed cries +$(CRY_BIN_DIR)/%.bin: $(CRY_SUBDIR)/%.aif + $(AIF) $< $@ --compress + +# Uncompressed cries +$(CRY_BIN_DIR)/uncomp_%.bin: $(CRY_SUBDIR)/uncomp_%.aif + $(AIF) $< $@ + +# Uncompressed sounds +$(SOUND_BIN_DIR)/%.bin: sound/%.aif + $(AIF) $< $@ + +# For each line in midi.cfg, we do some trickery to convert it into a make rule for the `.mid` file described on the line +# Data following the colon in said file corresponds to arguments passed into mid2agb +MID_CFG_PATH := $(MID_SUBDIR)/midi.cfg + +# $1: Source path no extension, $2 Options +define MID_RULE +$(MID_ASM_DIR)/$1.s: $(MID_SUBDIR)/$1.mid $(MID_CFG_PATH) + $(MID) $$< $$@ $2 +endef +# source path, remaining text (options) +define MID_EXPANSION + $(eval $(call MID_RULE,$(basename $(patsubst %:,%,$(word 1,$1))),$(wordlist 2,999,$1))) +endef + +$(foreach line,$(shell cat $(MID_CFG_PATH) | sed "s/ /__SPACE__/g"),$(call MID_EXPANSION,$(subst __SPACE__, ,$(line)))) + +# Warn users building without a .cfg - build will fail at link time +$(MID_ASM_DIR)/%.s: $(MID_SUBDIR)/%.mid + $(warning $< does not have an associated entry in midi.cfg! It cannot be built) diff --git a/common_syms/AgbRfu_LinkManager.txt b/common_syms/AgbRfu_LinkManager.txt deleted file mode 100644 index 7ff8cd53dd5d..000000000000 --- a/common_syms/AgbRfu_LinkManager.txt +++ /dev/null @@ -1 +0,0 @@ -lman diff --git a/common_syms/agb_flash.txt b/common_syms/agb_flash.txt deleted file mode 100644 index cb421ec80d1a..000000000000 --- a/common_syms/agb_flash.txt +++ /dev/null @@ -1,10 +0,0 @@ -gFlashTimeoutFlag -PollFlashStatus -WaitForFlashWrite -ProgramFlashSector -gFlash -ProgramFlashByte -gFlashNumRemainingBytes -EraseFlashChip -EraseFlashSector -gFlashMaxTime diff --git a/common_syms/apprentice.txt b/common_syms/apprentice.txt deleted file mode 100644 index 0d3569dcbbca..000000000000 --- a/common_syms/apprentice.txt +++ /dev/null @@ -1,3 +0,0 @@ -gApprenticePartyMovesData -gApprenticeQuestionData -gApprenticeFunc diff --git a/common_syms/battle_anim_throw.txt b/common_syms/battle_anim_throw.txt deleted file mode 100755 index 5e2e8b3ff39d..000000000000 --- a/common_syms/battle_anim_throw.txt +++ /dev/null @@ -1,3 +0,0 @@ -gMonShrinkDuration -gMonShrinkDelta -gMonShrinkDistance diff --git a/common_syms/battle_controllers.txt b/common_syms/battle_controllers.txt deleted file mode 100644 index 0b3c25266a1c..000000000000 --- a/common_syms/battle_controllers.txt +++ /dev/null @@ -1,3 +0,0 @@ -gBattlerControllerFuncs -gBattleControllerData -gBattlerControllerEndFuncs diff --git a/common_syms/battle_factory_screen.txt b/common_syms/battle_factory_screen.txt deleted file mode 100644 index 3ddeb6d3b188..000000000000 --- a/common_syms/battle_factory_screen.txt +++ /dev/null @@ -1 +0,0 @@ -gFactorySelect_CurrentOptionFunc diff --git a/common_syms/battle_main.txt b/common_syms/battle_main.txt deleted file mode 100644 index 7a9faa5a13e2..000000000000 --- a/common_syms/battle_main.txt +++ /dev/null @@ -1,7 +0,0 @@ -gPreBattleCallback1 -gBattleMainFunc -gBattleResults -gLeveledUpInBattle -gHealthboxSpriteIds -gMultiUsePlayerCursor -gNumberOfMovesToChoose diff --git a/common_syms/battle_tower.txt b/common_syms/battle_tower.txt deleted file mode 100644 index 7371109d51f3..000000000000 --- a/common_syms/battle_tower.txt +++ /dev/null @@ -1 +0,0 @@ -gFrontierTempParty diff --git a/common_syms/berry_blender.txt b/common_syms/berry_blender.txt deleted file mode 100644 index 1b15a33d6113..000000000000 --- a/common_syms/berry_blender.txt +++ /dev/null @@ -1 +0,0 @@ -gInGameOpponentsNo diff --git a/common_syms/bg.txt b/common_syms/bg.txt deleted file mode 100644 index 0a3c3aecca31..000000000000 --- a/common_syms/bg.txt +++ /dev/null @@ -1 +0,0 @@ -gWindowTileAutoAllocEnabled diff --git a/common_syms/contest.txt b/common_syms/contest.txt deleted file mode 100644 index 6a519fb463d7..000000000000 --- a/common_syms/contest.txt +++ /dev/null @@ -1 +0,0 @@ -gContestRngValue diff --git a/common_syms/contest_painting.txt b/common_syms/contest_painting.txt deleted file mode 100644 index 32bb8be16153..000000000000 --- a/common_syms/contest_painting.txt +++ /dev/null @@ -1,4 +0,0 @@ -gContestMonPixels -gImageProcessingContext -gContestPaintingWinner -gContestPaintingMonPalette diff --git a/common_syms/ereader_screen.txt b/common_syms/ereader_screen.txt deleted file mode 100644 index 2189eedbc925..000000000000 --- a/common_syms/ereader_screen.txt +++ /dev/null @@ -1 +0,0 @@ -gEReaderData diff --git a/common_syms/evolution_scene.txt b/common_syms/evolution_scene.txt deleted file mode 100644 index 137cd3e05df7..000000000000 --- a/common_syms/evolution_scene.txt +++ /dev/null @@ -1 +0,0 @@ -gCB2_AfterEvolution diff --git a/common_syms/faraway_island.txt b/common_syms/faraway_island.txt deleted file mode 100755 index e02ca2ec2528..000000000000 --- a/common_syms/faraway_island.txt +++ /dev/null @@ -1,3 +0,0 @@ -sPlayerToMewDeltaX -sPlayerToMewDeltaY -sMewDirectionCandidates diff --git a/common_syms/field_camera.txt b/common_syms/field_camera.txt deleted file mode 100644 index 02301ce23cd1..000000000000 --- a/common_syms/field_camera.txt +++ /dev/null @@ -1,3 +0,0 @@ -gFieldCamera -gTotalCameraPixelOffsetY -gTotalCameraPixelOffsetX diff --git a/common_syms/field_control_avatar.txt b/common_syms/field_control_avatar.txt deleted file mode 100644 index 268f60c64177..000000000000 --- a/common_syms/field_control_avatar.txt +++ /dev/null @@ -1 +0,0 @@ -gSelectedObjectEvent diff --git a/common_syms/field_specials.txt b/common_syms/field_specials.txt deleted file mode 100644 index 7adb3f669235..000000000000 --- a/common_syms/field_specials.txt +++ /dev/null @@ -1 +0,0 @@ -gScrollableMultichoice_ListMenuTemplate diff --git a/common_syms/fieldmap.txt b/common_syms/fieldmap.txt deleted file mode 100644 index 0ead758462c9..000000000000 --- a/common_syms/fieldmap.txt +++ /dev/null @@ -1 +0,0 @@ -gBackupMapLayout diff --git a/common_syms/image_processing_effects.txt b/common_syms/image_processing_effects.txt deleted file mode 100644 index 134f7e88b25c..000000000000 --- a/common_syms/image_processing_effects.txt +++ /dev/null @@ -1,10 +0,0 @@ -gCanvasColumnStart -gCanvasPixels -gCanvasRowEnd -gCanvasHeight -gCanvasColumnEnd -gCanvasRowStart -gCanvasMonPersonality -gCanvasWidth -gCanvasPalette -gCanvasPaletteStart diff --git a/common_syms/intro.txt b/common_syms/intro.txt deleted file mode 100644 index d069b1014ff4..000000000000 --- a/common_syms/intro.txt +++ /dev/null @@ -1,2 +0,0 @@ -gIntroFrameCounter -gMultibootProgramStruct diff --git a/common_syms/librfu_rfu.txt b/common_syms/librfu_rfu.txt deleted file mode 100644 index 4b742dcd256c..000000000000 --- a/common_syms/librfu_rfu.txt +++ /dev/null @@ -1,5 +0,0 @@ -gRfuSlotStatusUNI -gRfuSlotStatusNI -gRfuLinkStatus -gRfuStatic -gRfuFixed diff --git a/common_syms/librfu_sio32id.txt b/common_syms/librfu_sio32id.txt deleted file mode 100644 index 97395e84b310..000000000000 --- a/common_syms/librfu_sio32id.txt +++ /dev/null @@ -1 +0,0 @@ -gRfuSIO32Id diff --git a/common_syms/librfu_stwi.txt b/common_syms/librfu_stwi.txt deleted file mode 100644 index a1f773553591..000000000000 --- a/common_syms/librfu_stwi.txt +++ /dev/null @@ -1 +0,0 @@ -gSTWIStatus diff --git a/common_syms/link.txt b/common_syms/link.txt deleted file mode 100644 index 4118d1eb4bee..000000000000 --- a/common_syms/link.txt +++ /dev/null @@ -1,35 +0,0 @@ -gLinkPartnersHeldKeys -gLinkDebugSeed -gLocalLinkPlayerBlock -gLinkErrorOccurred -gLinkDebugFlags -gLinkFiller1 -gRemoteLinkPlayersNotReceived -gBlockReceivedStatus -gLinkFiller2 -gLinkHeldKeys -gRecvCmds -gLinkStatus -gLinkDummy1 -gLinkDummy2 -gReadyToExitStandby -gReadyToCloseLink -gReadyCloseLinkType -gSuppressLinkErrorMessage -gWirelessCommType -gSavedLinkPlayerCount -gSendCmd -gSavedMultiplayerId -gReceivedRemoteLinkPlayers -gLinkTestBGInfo -gLinkCallback -gShouldAdvanceLinkState -gLinkTestBlockChecksums -gBlockRequestType -gLinkFiller3 -gLinkFiller4 -gLinkFiller5 -gLastSendQueueCount -gLink -gLastRecvQueueCount -gLinkSavedIme diff --git a/common_syms/link_rfu_2.txt b/common_syms/link_rfu_2.txt deleted file mode 100644 index 4b8f02bad8f2..000000000000 --- a/common_syms/link_rfu_2.txt +++ /dev/null @@ -1,2 +0,0 @@ -gRfuAPIBuffer -gRfu diff --git a/common_syms/list_menu.txt b/common_syms/list_menu.txt deleted file mode 100644 index ed5343618ccc..000000000000 --- a/common_syms/list_menu.txt +++ /dev/null @@ -1,2 +0,0 @@ -gListMenuOverride -gMultiuseListMenuTemplate diff --git a/common_syms/load_save.txt b/common_syms/load_save.txt deleted file mode 100644 index 2d3d9b802ffc..000000000000 --- a/common_syms/load_save.txt +++ /dev/null @@ -1,4 +0,0 @@ -gFlashMemoryPresent -gSaveBlock1Ptr -gSaveBlock2Ptr -gPokemonStoragePtr diff --git a/common_syms/m4a.txt b/common_syms/m4a.txt deleted file mode 100644 index 0d6b13a79bd1..000000000000 --- a/common_syms/m4a.txt +++ /dev/null @@ -1,12 +0,0 @@ -gSoundInfo -gPokemonCrySongs -gPokemonCryMusicPlayers -gMPlayInfo_BGM -gMPlayJumpTable -gCgbChans -gMPlayInfo_SE1 -gMPlayInfo_SE2 -gPokemonCryTracks -gPokemonCrySong -gMPlayMemAccArea -gMPlayInfo_SE3 diff --git a/common_syms/main.txt b/common_syms/main.txt deleted file mode 100644 index f1f8076adf9d..000000000000 --- a/common_syms/main.txt +++ /dev/null @@ -1,10 +0,0 @@ -gKeyRepeatStartDelay -gLinkTransferringData -gMain -gKeyRepeatContinueDelay -gSoftResetDisabled -gIntrTable -gLinkVSyncDisabled -IntrMain_Buffer -gPcmDmaCounter -gAgbMainLoop_sp diff --git a/common_syms/mauville_old_man.txt b/common_syms/mauville_old_man.txt deleted file mode 100644 index 9d77b8692b70..000000000000 --- a/common_syms/mauville_old_man.txt +++ /dev/null @@ -1 +0,0 @@ -gBardSong diff --git a/common_syms/overworld.txt b/common_syms/overworld.txt deleted file mode 100644 index dcada0bbefe8..000000000000 --- a/common_syms/overworld.txt +++ /dev/null @@ -1,8 +0,0 @@ -gOverworldTilemapBuffer_Bg2 -gOverworldTilemapBuffer_Bg1 -gOverworldTilemapBuffer_Bg3 -gHeldKeyCodeToSend -gFieldCallback -gFieldCallback2 -gLocalLinkPlayerId -gFieldLinkPlayerCount diff --git a/common_syms/party_menu.txt b/common_syms/party_menu.txt deleted file mode 100644 index 6ed37392c2de..000000000000 --- a/common_syms/party_menu.txt +++ /dev/null @@ -1 +0,0 @@ -gItemUseCB diff --git a/common_syms/pokedex.txt b/common_syms/pokedex.txt deleted file mode 100644 index c7a297b2af90..000000000000 --- a/common_syms/pokedex.txt +++ /dev/null @@ -1,2 +0,0 @@ -gUnusedPokedexU8 -gPokedexVBlankCB diff --git a/common_syms/pokedex_cry_screen.txt b/common_syms/pokedex_cry_screen.txt deleted file mode 100644 index d16ec36d64fa..000000000000 --- a/common_syms/pokedex_cry_screen.txt +++ /dev/null @@ -1 +0,0 @@ -gDexCryScreenState diff --git a/common_syms/random.txt b/common_syms/random.txt deleted file mode 100644 index 8037c69586b1..000000000000 --- a/common_syms/random.txt +++ /dev/null @@ -1,2 +0,0 @@ -gRngValue -gRng2Value diff --git a/common_syms/rtc.txt b/common_syms/rtc.txt deleted file mode 100644 index fa00a34d5172..000000000000 --- a/common_syms/rtc.txt +++ /dev/null @@ -1 +0,0 @@ -gLocalTime diff --git a/common_syms/save.txt b/common_syms/save.txt deleted file mode 100644 index 131031d5063b..000000000000 --- a/common_syms/save.txt +++ /dev/null @@ -1,13 +0,0 @@ -gLastWrittenSector -gLastSaveCounter -gLastKnownGoodSector -gDamagedSaveSectors -gSaveCounter -gReadWriteSector -gIncrementalSectorId -gSaveUnusedVar -gSaveFileStatus -gGameContinueCallback -gRamSaveSectorLocations -gSaveUnusedVar2 -gSaveAttemptStatus diff --git a/common_syms/sound.txt b/common_syms/sound.txt deleted file mode 100644 index 0f6f2fc75888..000000000000 --- a/common_syms/sound.txt +++ /dev/null @@ -1 +0,0 @@ -gDisableMusic diff --git a/common_syms/sprite.txt b/common_syms/sprite.txt deleted file mode 100644 index 627c01c0d073..000000000000 --- a/common_syms/sprite.txt +++ /dev/null @@ -1,2 +0,0 @@ -gOamMatrixAllocBitmap -gReservedSpritePaletteCount diff --git a/common_syms/start_menu.txt b/common_syms/start_menu.txt deleted file mode 100644 index 05beaf57c23b..000000000000 --- a/common_syms/start_menu.txt +++ /dev/null @@ -1 +0,0 @@ -gMenuCallback diff --git a/common_syms/task.txt b/common_syms/task.txt deleted file mode 100644 index 6601bd11bb84..000000000000 --- a/common_syms/task.txt +++ /dev/null @@ -1 +0,0 @@ -gTasks diff --git a/common_syms/text.txt b/common_syms/text.txt deleted file mode 100644 index cd8886e5b1f5..000000000000 --- a/common_syms/text.txt +++ /dev/null @@ -1,4 +0,0 @@ -gFonts -gDisableTextPrinters -gCurGlyph -gTextFlags diff --git a/common_syms/trainer_see.txt b/common_syms/trainer_see.txt deleted file mode 100644 index 0b30a632a005..000000000000 --- a/common_syms/trainer_see.txt +++ /dev/null @@ -1,5 +0,0 @@ -gWhichTrainerToFaceAfterBattle -gPostBattleMovementScript -gApproachingTrainers -gNoOfApproachingTrainers -gTrainerApproachedPlayer diff --git a/common_syms/tv.txt b/common_syms/tv.txt deleted file mode 100644 index 0370f65e1f67..000000000000 --- a/common_syms/tv.txt +++ /dev/null @@ -1,4 +0,0 @@ -sCurTVShowSlot -sTV_SecretBaseVisitMovesTemp -sTV_DecorationsBuffer -sTV_SecretBaseVisitMonsTemp diff --git a/common_syms/window.txt b/common_syms/window.txt deleted file mode 100644 index 24c093a22612..000000000000 --- a/common_syms/window.txt +++ /dev/null @@ -1,2 +0,0 @@ -gTransparentTileNumber -gWindowBgTilemapBuffers diff --git a/data/event_scripts.s b/data/event_scripts.s index 07eafe1c35ea..4307da339599 100644 --- a/data/event_scripts.s +++ b/data/event_scripts.s @@ -565,8 +565,8 @@ gStdScripts_End:: .include "data/maps/Route110_TrickHousePuzzle6/scripts.inc" .include "data/maps/Route110_TrickHousePuzzle7/scripts.inc" .include "data/maps/Route110_TrickHousePuzzle8/scripts.inc" - .include "data/maps/Route110_SeasideCyclingRoadNorthEntrance/scripts.inc" .include "data/maps/Route110_SeasideCyclingRoadSouthEntrance/scripts.inc" + .include "data/maps/Route110_SeasideCyclingRoadNorthEntrance/scripts.inc" .include "data/maps/Route113_GlassWorkshop/scripts.inc" .include "data/maps/Route123_BerryMastersHouse/scripts.inc" .include "data/maps/Route119_WeatherInstitute_1F/scripts.inc" diff --git a/data/maps/FallarborTown_PokemonCenter_1F/map.json b/data/maps/FallarborTown_PokemonCenter_1F/map.json index 93204a215a0d..0c3dd726df4b 100644 --- a/data/maps/FallarborTown_PokemonCenter_1F/map.json +++ b/data/maps/FallarborTown_PokemonCenter_1F/map.json @@ -64,7 +64,7 @@ "trainer_type": "TRAINER_TYPE_NONE", "trainer_sight_or_berry_tree_id": "0", "script": "FallarborTown_PokemonCenter_1F_EventScript_Lanette", - "flag": "FLAG_HIDE_FALLORBOR_POKEMON_CENTER_LANETTE" + "flag": "FLAG_HIDE_FALLARBOR_POKEMON_CENTER_LANETTE" } ], "warp_events": [ diff --git a/data/maps/Route110/map.json b/data/maps/Route110/map.json index 448cd442d036..5db6ad5d2f54 100644 --- a/data/maps/Route110/map.json +++ b/data/maps/Route110/map.json @@ -518,28 +518,28 @@ "x": 15, "y": 16, "elevation": 0, - "dest_map": "MAP_ROUTE110_SEASIDE_CYCLING_ROAD_SOUTH_ENTRANCE", + "dest_map": "MAP_ROUTE110_SEASIDE_CYCLING_ROAD_NORTH_ENTRANCE", "dest_warp_id": "0" }, { "x": 18, "y": 16, "elevation": 0, - "dest_map": "MAP_ROUTE110_SEASIDE_CYCLING_ROAD_SOUTH_ENTRANCE", + "dest_map": "MAP_ROUTE110_SEASIDE_CYCLING_ROAD_NORTH_ENTRANCE", "dest_warp_id": "2" }, { "x": 16, "y": 88, "elevation": 0, - "dest_map": "MAP_ROUTE110_SEASIDE_CYCLING_ROAD_NORTH_ENTRANCE", + "dest_map": "MAP_ROUTE110_SEASIDE_CYCLING_ROAD_SOUTH_ENTRANCE", "dest_warp_id": "0" }, { "x": 19, "y": 88, "elevation": 0, - "dest_map": "MAP_ROUTE110_SEASIDE_CYCLING_ROAD_NORTH_ENTRANCE", + "dest_map": "MAP_ROUTE110_SEASIDE_CYCLING_ROAD_SOUTH_ENTRANCE", "dest_warp_id": "2" } ], diff --git a/data/maps/Route110_SeasideCyclingRoadNorthEntrance/map.json b/data/maps/Route110_SeasideCyclingRoadNorthEntrance/map.json index 6f3c6c75c574..88cbf1cc882b 100644 --- a/data/maps/Route110_SeasideCyclingRoadNorthEntrance/map.json +++ b/data/maps/Route110_SeasideCyclingRoadNorthEntrance/map.json @@ -34,28 +34,28 @@ "y": 5, "elevation": 0, "dest_map": "MAP_ROUTE110", - "dest_warp_id": "4" + "dest_warp_id": "2" }, { "x": 2, "y": 5, "elevation": 0, "dest_map": "MAP_ROUTE110", - "dest_warp_id": "4" + "dest_warp_id": "2" }, { "x": 12, "y": 5, "elevation": 0, "dest_map": "MAP_ROUTE110", - "dest_warp_id": "5" + "dest_warp_id": "3" }, { "x": 13, "y": 5, "elevation": 0, "dest_map": "MAP_ROUTE110", - "dest_warp_id": "5" + "dest_warp_id": "3" } ], "coord_events": [ diff --git a/data/maps/Route110_SeasideCyclingRoadNorthEntrance/scripts.inc b/data/maps/Route110_SeasideCyclingRoadNorthEntrance/scripts.inc index 5eb1f3dea2a2..fb1cdc5c7122 100644 --- a/data/maps/Route110_SeasideCyclingRoadNorthEntrance/scripts.inc +++ b/data/maps/Route110_SeasideCyclingRoadNorthEntrance/scripts.inc @@ -1,6 +1,16 @@ Route110_SeasideCyclingRoadNorthEntrance_MapScripts:: + map_script MAP_SCRIPT_ON_TRANSITION, Route110_SeasideCyclingRoadNorthEntrance_OnTransition .byte 0 +Route110_SeasideCyclingRoadNorthEntrance_OnTransition: + call_if_eq VAR_CYCLING_CHALLENGE_STATE, 3, Route110_SeasideCyclingRoadNorthEntrance_EventScript_RestartChallenge + call_if_eq VAR_CYCLING_CHALLENGE_STATE, 2, Route110_SeasideCyclingRoadNorthEntrance_EventScript_RestartChallenge + end + +Route110_SeasideCyclingRoadNorthEntrance_EventScript_RestartChallenge:: + setvar VAR_CYCLING_CHALLENGE_STATE, 1 + return + Route110_SeasideCyclingRoadNorthEntrance_EventScript_Clerk:: lock faceplayer @@ -11,12 +21,17 @@ Route110_SeasideCyclingRoadNorthEntrance_EventScript_Clerk:: Route110_SeasideCyclingRoadNorthEntrance_EventScript_BikeCheck:: lockall specialvar VAR_RESULT, GetPlayerAvatarBike + call_if_eq VAR_RESULT, 2, Route110_SeasideCyclingRoadNorthEntrance_EventScript_OnMachBike goto_if_eq VAR_RESULT, 0, Route110_SeasideCyclingRoadNorthEntrance_EventScript_NoBike setflag FLAG_SYS_CYCLING_ROAD setvar VAR_TEMP_1, 1 releaseall end +Route110_SeasideCyclingRoadNorthEntrance_EventScript_OnMachBike:: + setvar VAR_CYCLING_CHALLENGE_STATE, 1 + return + Route110_SeasideCyclingRoadNorthEntrance_EventScript_NoBike:: msgbox Route110_SeasideCyclingRoadNorthEntrance_Text_TooDangerousToWalk, MSGBOX_DEFAULT closemessage @@ -31,6 +46,7 @@ Route110_SeasideCyclingRoadNorthEntrance_Movement_PushPlayerBackFromCounter: Route110_SeasideCyclingRoadNorthEntrance_EventScript_ClearCyclingRoad:: lockall + setvar VAR_CYCLING_CHALLENGE_STATE, 0 clearflag FLAG_SYS_CYCLING_ROAD setvar VAR_TEMP_1, 0 releaseall diff --git a/data/maps/Route110_SeasideCyclingRoadSouthEntrance/map.json b/data/maps/Route110_SeasideCyclingRoadSouthEntrance/map.json index 59e3e5be6501..943984075d19 100644 --- a/data/maps/Route110_SeasideCyclingRoadSouthEntrance/map.json +++ b/data/maps/Route110_SeasideCyclingRoadSouthEntrance/map.json @@ -34,28 +34,28 @@ "y": 5, "elevation": 0, "dest_map": "MAP_ROUTE110", - "dest_warp_id": "2" + "dest_warp_id": "4" }, { "x": 2, "y": 5, "elevation": 0, "dest_map": "MAP_ROUTE110", - "dest_warp_id": "2" + "dest_warp_id": "4" }, { "x": 12, "y": 5, "elevation": 0, "dest_map": "MAP_ROUTE110", - "dest_warp_id": "3" + "dest_warp_id": "5" }, { "x": 13, "y": 5, "elevation": 0, "dest_map": "MAP_ROUTE110", - "dest_warp_id": "3" + "dest_warp_id": "5" } ], "coord_events": [ diff --git a/data/maps/Route110_SeasideCyclingRoadSouthEntrance/scripts.inc b/data/maps/Route110_SeasideCyclingRoadSouthEntrance/scripts.inc index df53f55ccf17..5c4dcfa2194c 100644 --- a/data/maps/Route110_SeasideCyclingRoadSouthEntrance/scripts.inc +++ b/data/maps/Route110_SeasideCyclingRoadSouthEntrance/scripts.inc @@ -1,16 +1,6 @@ Route110_SeasideCyclingRoadSouthEntrance_MapScripts:: - map_script MAP_SCRIPT_ON_TRANSITION, Route110_SeasideCyclingRoadSouthEntrance_OnTransition .byte 0 -Route110_SeasideCyclingRoadSouthEntrance_OnTransition: - call_if_eq VAR_CYCLING_CHALLENGE_STATE, 3, Route110_SeasideCyclingRoadSouthEntrance_EventScript_RestartChallenge - call_if_eq VAR_CYCLING_CHALLENGE_STATE, 2, Route110_SeasideCyclingRoadSouthEntrance_EventScript_RestartChallenge - end - -Route110_SeasideCyclingRoadSouthEntrance_EventScript_RestartChallenge:: - setvar VAR_CYCLING_CHALLENGE_STATE, 1 - return - Route110_SeasideCyclingRoadSouthEntrance_EventScript_Clerk:: lock faceplayer @@ -21,17 +11,12 @@ Route110_SeasideCyclingRoadSouthEntrance_EventScript_Clerk:: Route110_SeasideCyclingRoadSouthEntrance_EventScript_BikeCheck:: lockall specialvar VAR_RESULT, GetPlayerAvatarBike - call_if_eq VAR_RESULT, 2, Route110_SeasideCyclingRoadSouthEntrance_EventScript_OnMachBike goto_if_eq VAR_RESULT, 0, Route110_SeasideCyclingRoadSouthEntrance_EventScript_NoBike setflag FLAG_SYS_CYCLING_ROAD setvar VAR_TEMP_1, 1 releaseall end -Route110_SeasideCyclingRoadSouthEntrance_EventScript_OnMachBike:: - setvar VAR_CYCLING_CHALLENGE_STATE, 1 - return - Route110_SeasideCyclingRoadSouthEntrance_EventScript_NoBike:: msgbox Route110_SeasideCyclingRoadSouthEntrance_Text_TooDangerousToWalk, MSGBOX_DEFAULT closemessage @@ -46,7 +31,6 @@ Route110_SeasideCyclingRoadSouthEntrance_Movement_PushPlayerBackFromCounter: Route110_SeasideCyclingRoadSouthEntrance_EventScript_ClearCyclingRoad:: lockall - setvar VAR_CYCLING_CHALLENGE_STATE, 0 clearflag FLAG_SYS_CYCLING_ROAD setvar VAR_TEMP_1, 0 releaseall diff --git a/data/maps/map_groups.json b/data/maps/map_groups.json index ebef431b300d..8a90679c8ddb 100644 --- a/data/maps/map_groups.json +++ b/data/maps/map_groups.json @@ -604,8 +604,8 @@ "Route110_TrickHousePuzzle6", "Route110_TrickHousePuzzle7", "Route110_TrickHousePuzzle8", - "Route110_SeasideCyclingRoadNorthEntrance", - "Route110_SeasideCyclingRoadSouthEntrance" + "Route110_SeasideCyclingRoadSouthEntrance", + "Route110_SeasideCyclingRoadNorthEntrance" ], "gMapGroup_IndoorRoute113": [ "Route113_GlassWorkshop" diff --git a/include/battle.h b/include/battle.h index 636eb51cdb85..f2e5297189c0 100644 --- a/include/battle.h +++ b/include/battle.h @@ -862,14 +862,14 @@ STATIC_ASSERT(sizeof(((struct BattleStruct *)0)->palaceFlags) * 8 >= MAX_BATTLER || gProtectStructs[battlerId].obstructed \ || gProtectStructs[battlerId].silkTrapped) -#define GET_STAT_BUFF_ID(n)((n & 7)) // first three bits 0x1, 0x2, 0x4 -#define GET_STAT_BUFF_VALUE_WITH_SIGN(n)((n & 0xF8)) -#define GET_STAT_BUFF_VALUE(n)(((n >> 3) & 0xF)) // 0x8, 0x10, 0x20, 0x40 +#define GET_STAT_BUFF_ID(n) ((n & 7)) // first three bits 0x1, 0x2, 0x4 +#define GET_STAT_BUFF_VALUE_WITH_SIGN(n) ((n & 0xF8)) +#define GET_STAT_BUFF_VALUE(n) (((n >> 3) & 0xF)) // 0x8, 0x10, 0x20, 0x40 #define STAT_BUFF_NEGATIVE 0x80 // 0x80, the sign bit -#define SET_STAT_BUFF_VALUE(n)((((n) << 3) & 0xF8)) +#define SET_STAT_BUFF_VALUE(n) ((((n) << 3) & 0xF8)) -#define SET_STATCHANGER(statId, stage, goesDown)(gBattleScripting.statChanger = (statId) + ((stage) << 3) + (goesDown << 7)) +#define SET_STATCHANGER(statId, stage, goesDown) (gBattleScripting.statChanger = (statId) + ((stage) << 3) + (goesDown << 7)) #define SET_STATCHANGER2(dst, statId, stage, goesDown)(dst = (statId) + ((stage) << 3) + (goesDown << 7)) // NOTE: The members of this struct have hard-coded offsets diff --git a/gflib/bg.h b/include/bg.h similarity index 100% rename from gflib/bg.h rename to include/bg.h diff --git a/gflib/blit.h b/include/blit.h similarity index 100% rename from gflib/blit.h rename to include/blit.h diff --git a/include/constants/.gitignore b/include/constants/.gitignore new file mode 100644 index 000000000000..761af9db7625 --- /dev/null +++ b/include/constants/.gitignore @@ -0,0 +1,3 @@ +# Will be moved to build/ eventually +map_groups.h +layouts.h \ No newline at end of file diff --git a/gflib/characters.h b/include/constants/characters.h similarity index 100% rename from gflib/characters.h rename to include/constants/characters.h diff --git a/include/constants/flags.h b/include/constants/flags.h index 01e941d9f2fb..b1fcae5eb77d 100644 --- a/include/constants/flags.h +++ b/include/constants/flags.h @@ -2,6 +2,7 @@ #define GUARD_CONSTANTS_FLAGS_H #include "constants/opponents.h" +#include "constants/rematches.h" // Temporary Flags // These temporary flags are are cleared every time a map is loaded. They are used @@ -375,86 +376,89 @@ #define FLAG_MET_FRONTIER_BEAUTY_MOVE_TUTOR 0x15A #define FLAG_MET_FRONTIER_SWIMMER_MOVE_TUTOR 0x15B -// Trainer Rematch Flags -#define FLAG_MATCH_CALL_REGISTERED 0x15C -#define FLAG_REMATCH_ROSE 0x15D -#define FLAG_REMATCH_ANDRES 0x15E -#define FLAG_REMATCH_DUSTY 0x15F -#define FLAG_REMATCH_LOLA 0x160 -#define FLAG_REMATCH_RICKY 0x161 -#define FLAG_REMATCH_LILA_AND_ROY 0x162 -#define FLAG_REMATCH_CRISTIN 0x163 -#define FLAG_REMATCH_BROOKE 0x164 -#define FLAG_REMATCH_WILTON 0x165 -#define FLAG_REMATCH_VALERIE 0x166 -#define FLAG_REMATCH_CINDY 0x167 -#define FLAG_REMATCH_THALIA 0x168 -#define FLAG_REMATCH_JESSICA 0x169 -#define FLAG_REMATCH_WINSTON 0x16A -#define FLAG_REMATCH_STEVE 0x16B -#define FLAG_REMATCH_TONY 0x16C -#define FLAG_REMATCH_NOB 0x16D -#define FLAG_REMATCH_KOJI 0x16E -#define FLAG_REMATCH_FERNANDO 0x16F -#define FLAG_REMATCH_DALTON 0x170 -#define FLAG_REMATCH_BERNIE 0x171 -#define FLAG_REMATCH_ETHAN 0x172 -#define FLAG_REMATCH_JOHN_AND_JAY 0x173 -#define FLAG_REMATCH_JEFFREY 0x174 -#define FLAG_REMATCH_CAMERON 0x175 -#define FLAG_REMATCH_JACKI 0x176 -#define FLAG_REMATCH_WALTER 0x177 -#define FLAG_REMATCH_KAREN 0x178 -#define FLAG_REMATCH_JERRY 0x179 -#define FLAG_REMATCH_ANNA_AND_MEG 0x17A -#define FLAG_REMATCH_ISABEL 0x17B -#define FLAG_REMATCH_MIGUEL 0x17C -#define FLAG_REMATCH_TIMOTHY 0x17D -#define FLAG_REMATCH_SHELBY 0x17E -#define FLAG_REMATCH_CALVIN 0x17F -#define FLAG_REMATCH_ELLIOT 0x180 -#define FLAG_REMATCH_ISAIAH 0x181 -#define FLAG_REMATCH_MARIA 0x182 -#define FLAG_REMATCH_ABIGAIL 0x183 -#define FLAG_REMATCH_DYLAN 0x184 -#define FLAG_REMATCH_KATELYN 0x185 -#define FLAG_REMATCH_BENJAMIN 0x186 -#define FLAG_REMATCH_PABLO 0x187 -#define FLAG_REMATCH_NICOLAS 0x188 -#define FLAG_REMATCH_ROBERT 0x189 -#define FLAG_REMATCH_LAO 0x18A -#define FLAG_REMATCH_CYNDY 0x18B -#define FLAG_REMATCH_MADELINE 0x18C -#define FLAG_REMATCH_JENNY 0x18D -#define FLAG_REMATCH_DIANA 0x18E -#define FLAG_REMATCH_AMY_AND_LIV 0x18F -#define FLAG_REMATCH_ERNEST 0x190 -#define FLAG_REMATCH_CORY 0x191 -#define FLAG_REMATCH_EDWIN 0x192 -#define FLAG_REMATCH_LYDIA 0x193 -#define FLAG_REMATCH_ISAAC 0x194 -#define FLAG_REMATCH_GABRIELLE 0x195 -#define FLAG_REMATCH_CATHERINE 0x196 -#define FLAG_REMATCH_JACKSON 0x197 -#define FLAG_REMATCH_HALEY 0x198 -#define FLAG_REMATCH_JAMES 0x199 -#define FLAG_REMATCH_TRENT 0x19A -#define FLAG_REMATCH_SAWYER 0x19B -#define FLAG_REMATCH_KIRA_AND_DAN 0x19C -#define FLAG_REMATCH_WALLY 0x19D -#define FLAG_REMATCH_ROXANNE 0x19E -#define FLAG_REMATCH_BRAWLY 0x19F -#define FLAG_REMATCH_WATTSON 0x1A0 -#define FLAG_REMATCH_FLANNERY 0x1A1 -#define FLAG_REMATCH_NORMAN 0x1A2 -#define FLAG_REMATCH_WINONA 0x1A3 -#define FLAG_REMATCH_TATE_AND_LIZA 0x1A4 -// Note: FLAG_REMATCH_JUAN is handled by FLAG_ENABLE_JUAN_MATCH_CALL instead. -#define FLAG_REMATCH_SIDNEY 0x1A5 -#define FLAG_REMATCH_PHOEBE 0x1A6 -#define FLAG_REMATCH_GLACIA 0x1A7 -#define FLAG_REMATCH_DRAKE 0x1A8 -#define FLAG_REMATCH_WALLACE 0x1A9 +// Flags for whether a rematchable trainer has been registered in the player's Match Call. +// Most are used implicitly by adding their REMATCH_* id to TRAINER_REGISTERED_FLAGS_START. +// Some Match Call entries (like those for gym leaders, Wally, and all non-trainer NPCs like Prof. Birch) +// have their own separate flag that needs to be set to be enabled; see src/pokenav_match_call_data.c +#define TRAINER_REGISTERED_FLAGS_START 0x15C +#define FLAG_REGISTERED_ROSE (TRAINER_REGISTERED_FLAGS_START + REMATCH_ROSE) +#define FLAG_REGISTERED_ANDRES (TRAINER_REGISTERED_FLAGS_START + REMATCH_ANDRES) +#define FLAG_REGISTERED_DUSTY (TRAINER_REGISTERED_FLAGS_START + REMATCH_DUSTY) +#define FLAG_REGISTERED_LOLA (TRAINER_REGISTERED_FLAGS_START + REMATCH_LOLA) +#define FLAG_REGISTERED_RICKY (TRAINER_REGISTERED_FLAGS_START + REMATCH_RICKY) +#define FLAG_REGISTERED_LILA_AND_ROY (TRAINER_REGISTERED_FLAGS_START + REMATCH_LILA_AND_ROY) +#define FLAG_REGISTERED_CRISTIN (TRAINER_REGISTERED_FLAGS_START + REMATCH_CRISTIN) +#define FLAG_REGISTERED_BROOKE (TRAINER_REGISTERED_FLAGS_START + REMATCH_BROOKE) +#define FLAG_REGISTERED_WILTON (TRAINER_REGISTERED_FLAGS_START + REMATCH_WILTON) +#define FLAG_REGISTERED_VALERIE (TRAINER_REGISTERED_FLAGS_START + REMATCH_VALERIE) +#define FLAG_REGISTERED_CINDY (TRAINER_REGISTERED_FLAGS_START + REMATCH_CINDY) +#define FLAG_REGISTERED_THALIA (TRAINER_REGISTERED_FLAGS_START + REMATCH_THALIA) +#define FLAG_REGISTERED_JESSICA (TRAINER_REGISTERED_FLAGS_START + REMATCH_JESSICA) +#define FLAG_REGISTERED_WINSTON (TRAINER_REGISTERED_FLAGS_START + REMATCH_WINSTON) +#define FLAG_REGISTERED_STEVE (TRAINER_REGISTERED_FLAGS_START + REMATCH_STEVE) +#define FLAG_REGISTERED_TONY (TRAINER_REGISTERED_FLAGS_START + REMATCH_TONY) +#define FLAG_REGISTERED_NOB (TRAINER_REGISTERED_FLAGS_START + REMATCH_NOB) +#define FLAG_REGISTERED_KOJI (TRAINER_REGISTERED_FLAGS_START + REMATCH_KOJI) +#define FLAG_REGISTERED_FERNANDO (TRAINER_REGISTERED_FLAGS_START + REMATCH_FERNANDO) +#define FLAG_REGISTERED_DALTON (TRAINER_REGISTERED_FLAGS_START + REMATCH_DALTON) +#define FLAG_REGISTERED_BERNIE (TRAINER_REGISTERED_FLAGS_START + REMATCH_BERNIE) +#define FLAG_REGISTERED_ETHAN (TRAINER_REGISTERED_FLAGS_START + REMATCH_ETHAN) +#define FLAG_REGISTERED_JOHN_AND_JAY (TRAINER_REGISTERED_FLAGS_START + REMATCH_JOHN_AND_JAY) +#define FLAG_REGISTERED_JEFFREY (TRAINER_REGISTERED_FLAGS_START + REMATCH_JEFFREY) +#define FLAG_REGISTERED_CAMERON (TRAINER_REGISTERED_FLAGS_START + REMATCH_CAMERON) +#define FLAG_REGISTERED_JACKI (TRAINER_REGISTERED_FLAGS_START + REMATCH_JACKI) +#define FLAG_REGISTERED_WALTER (TRAINER_REGISTERED_FLAGS_START + REMATCH_WALTER) +#define FLAG_REGISTERED_KAREN (TRAINER_REGISTERED_FLAGS_START + REMATCH_KAREN) +#define FLAG_REGISTERED_JERRY (TRAINER_REGISTERED_FLAGS_START + REMATCH_JERRY) +#define FLAG_REGISTERED_ANNA_AND_MEG (TRAINER_REGISTERED_FLAGS_START + REMATCH_ANNA_AND_MEG) +#define FLAG_REGISTERED_ISABEL (TRAINER_REGISTERED_FLAGS_START + REMATCH_ISABEL) +#define FLAG_REGISTERED_MIGUEL (TRAINER_REGISTERED_FLAGS_START + REMATCH_MIGUEL) +#define FLAG_REGISTERED_TIMOTHY (TRAINER_REGISTERED_FLAGS_START + REMATCH_TIMOTHY) +#define FLAG_REGISTERED_SHELBY (TRAINER_REGISTERED_FLAGS_START + REMATCH_SHELBY) +#define FLAG_REGISTERED_CALVIN (TRAINER_REGISTERED_FLAGS_START + REMATCH_CALVIN) +#define FLAG_REGISTERED_ELLIOT (TRAINER_REGISTERED_FLAGS_START + REMATCH_ELLIOT) +#define FLAG_REGISTERED_ISAIAH (TRAINER_REGISTERED_FLAGS_START + REMATCH_ISAIAH) +#define FLAG_REGISTERED_MARIA (TRAINER_REGISTERED_FLAGS_START + REMATCH_MARIA) +#define FLAG_REGISTERED_ABIGAIL (TRAINER_REGISTERED_FLAGS_START + REMATCH_ABIGAIL) +#define FLAG_REGISTERED_DYLAN (TRAINER_REGISTERED_FLAGS_START + REMATCH_DYLAN) +#define FLAG_REGISTERED_KATELYN (TRAINER_REGISTERED_FLAGS_START + REMATCH_KATELYN) +#define FLAG_REGISTERED_BENJAMIN (TRAINER_REGISTERED_FLAGS_START + REMATCH_BENJAMIN) +#define FLAG_REGISTERED_PABLO (TRAINER_REGISTERED_FLAGS_START + REMATCH_PABLO) +#define FLAG_REGISTERED_NICOLAS (TRAINER_REGISTERED_FLAGS_START + REMATCH_NICOLAS) +#define FLAG_REGISTERED_ROBERT (TRAINER_REGISTERED_FLAGS_START + REMATCH_ROBERT) +#define FLAG_REGISTERED_LAO (TRAINER_REGISTERED_FLAGS_START + REMATCH_LAO) +#define FLAG_REGISTERED_CYNDY (TRAINER_REGISTERED_FLAGS_START + REMATCH_CYNDY) +#define FLAG_REGISTERED_MADELINE (TRAINER_REGISTERED_FLAGS_START + REMATCH_MADELINE) +#define FLAG_REGISTERED_JENNY (TRAINER_REGISTERED_FLAGS_START + REMATCH_JENNY) +#define FLAG_REGISTERED_DIANA (TRAINER_REGISTERED_FLAGS_START + REMATCH_DIANA) +#define FLAG_REGISTERED_AMY_AND_LIV (TRAINER_REGISTERED_FLAGS_START + REMATCH_AMY_AND_LIV) +#define FLAG_REGISTERED_ERNEST (TRAINER_REGISTERED_FLAGS_START + REMATCH_ERNEST) +#define FLAG_REGISTERED_CORY (TRAINER_REGISTERED_FLAGS_START + REMATCH_CORY) +#define FLAG_REGISTERED_EDWIN (TRAINER_REGISTERED_FLAGS_START + REMATCH_EDWIN) +#define FLAG_REGISTERED_LYDIA (TRAINER_REGISTERED_FLAGS_START + REMATCH_LYDIA) +#define FLAG_REGISTERED_ISAAC (TRAINER_REGISTERED_FLAGS_START + REMATCH_ISAAC) +#define FLAG_REGISTERED_GABRIELLE (TRAINER_REGISTERED_FLAGS_START + REMATCH_GABRIELLE) +#define FLAG_REGISTERED_CATHERINE (TRAINER_REGISTERED_FLAGS_START + REMATCH_CATHERINE) +#define FLAG_REGISTERED_JACKSON (TRAINER_REGISTERED_FLAGS_START + REMATCH_JACKSON) +#define FLAG_REGISTERED_HALEY (TRAINER_REGISTERED_FLAGS_START + REMATCH_HALEY) +#define FLAG_REGISTERED_JAMES (TRAINER_REGISTERED_FLAGS_START + REMATCH_JAMES) +#define FLAG_REGISTERED_TRENT (TRAINER_REGISTERED_FLAGS_START + REMATCH_TRENT) +#define FLAG_REGISTERED_SAWYER (TRAINER_REGISTERED_FLAGS_START + REMATCH_SAWYER) +#define FLAG_REGISTERED_KIRA_AND_DAN (TRAINER_REGISTERED_FLAGS_START + REMATCH_KIRA_AND_DAN) +#define FLAG_REGISTERED_WALLY (TRAINER_REGISTERED_FLAGS_START + REMATCH_WALLY) +#define FLAG_REGISTERED_ROXANNE (TRAINER_REGISTERED_FLAGS_START + REMATCH_ROXANNE) +#define FLAG_REGISTERED_BRAWLY (TRAINER_REGISTERED_FLAGS_START + REMATCH_BRAWLY) +#define FLAG_REGISTERED_WATTSON (TRAINER_REGISTERED_FLAGS_START + REMATCH_WATTSON) +#define FLAG_REGISTERED_FLANNERY (TRAINER_REGISTERED_FLAGS_START + REMATCH_FLANNERY) +#define FLAG_REGISTERED_NORMAN (TRAINER_REGISTERED_FLAGS_START + REMATCH_NORMAN) +#define FLAG_REGISTERED_WINONA (TRAINER_REGISTERED_FLAGS_START + REMATCH_WINONA) +#define FLAG_REGISTERED_TATE_AND_LIZA (TRAINER_REGISTERED_FLAGS_START + REMATCH_TATE_AND_LIZA) +#define FLAG_REGISTERED_JUAN (TRAINER_REGISTERED_FLAGS_START + REMATCH_JUAN) +#define FLAG_REGISTERED_SIDNEY (TRAINER_REGISTERED_FLAGS_START + REMATCH_SIDNEY) +#define FLAG_REGISTERED_PHOEBE (TRAINER_REGISTERED_FLAGS_START + REMATCH_PHOEBE) +#define FLAG_REGISTERED_GLACIA (TRAINER_REGISTERED_FLAGS_START + REMATCH_GLACIA) +#define FLAG_REGISTERED_DRAKE (TRAINER_REGISTERED_FLAGS_START + REMATCH_DRAKE) +#define FLAG_REGISTERED_WALLACE (TRAINER_REGISTERED_FLAGS_START + REMATCH_WALLACE) #define FLAG_UNUSED_0x1AA 0x1AA // Unused Flag #define FLAG_UNUSED_0x1AB 0x1AB // Unused Flag @@ -915,7 +919,7 @@ #define FLAG_HIDE_LITTLEROOT_TOWN_FAT_MAN 0x364 #define FLAG_HIDE_SLATEPORT_CITY_STERNS_SHIPYARD_MR_BRINEY 0x365 #define FLAG_HIDE_LANETTES_HOUSE_LANETTE 0x366 -#define FLAG_HIDE_FALLORBOR_POKEMON_CENTER_LANETTE 0x367 +#define FLAG_HIDE_FALLARBOR_POKEMON_CENTER_LANETTE 0x367 #define FLAG_HIDE_TRICK_HOUSE_ENTRANCE_MAN 0x368 #define FLAG_HIDE_LILYCOVE_CONTEST_HALL_BLEND_MASTER_REPLACEMENT 0x369 #define FLAG_HIDE_DESERT_UNDERPASS_FOSSIL 0x36A diff --git a/include/constants/items.h b/include/constants/items.h index bc9fdf2dc401..e26f033c09e1 100644 --- a/include/constants/items.h +++ b/include/constants/items.h @@ -1026,8 +1026,8 @@ #define NUM_ROUTE_114_MAN_BERRIES (LAST_ROUTE_114_MAN_BERRY - FIRST_ROUTE_114_MAN_BERRY + 1) #define NUM_ROUTE_114_MAN_BERRIES_SKIPPED (FIRST_ROUTE_114_MAN_BERRY - FIRST_BERRY_INDEX) -#define ITEM_TO_BERRY(itemId)(((itemId) - FIRST_BERRY_INDEX) + 1) -#define ITEM_TO_MAIL(itemId)((itemId) - FIRST_MAIL_INDEX) +#define ITEM_TO_BERRY(itemId) (((itemId) - FIRST_BERRY_INDEX) + 1) +#define ITEM_TO_MAIL(itemId) ((itemId) - FIRST_MAIL_INDEX) #define MAIL_NONE 0xFF #define ITEM_TO_MULCH(itemId)(((itemId) - ITEM_GROWTH_MULCH) + 1) diff --git a/include/constants/layouts.h b/include/constants/layouts.h deleted file mode 100755 index db92c9594264..000000000000 --- a/include/constants/layouts.h +++ /dev/null @@ -1,450 +0,0 @@ -#ifndef GUARD_CONSTANTS_LAYOUTS_H -#define GUARD_CONSTANTS_LAYOUTS_H - -// -// DO NOT MODIFY THIS FILE! It is auto-generated from data/layouts/layouts.json -// - -#define LAYOUT_PETALBURG_CITY 1 -#define LAYOUT_SLATEPORT_CITY 2 -#define LAYOUT_MAUVILLE_CITY 3 -#define LAYOUT_RUSTBORO_CITY 4 -#define LAYOUT_FORTREE_CITY 5 -#define LAYOUT_LILYCOVE_CITY 6 -#define LAYOUT_MOSSDEEP_CITY 7 -#define LAYOUT_SOOTOPOLIS_CITY 8 -#define LAYOUT_EVER_GRANDE_CITY 9 -#define LAYOUT_LITTLEROOT_TOWN 10 -#define LAYOUT_OLDALE_TOWN 11 -#define LAYOUT_DEWFORD_TOWN 12 -#define LAYOUT_LAVARIDGE_TOWN 13 -#define LAYOUT_FALLARBOR_TOWN 14 -#define LAYOUT_VERDANTURF_TOWN 15 -#define LAYOUT_PACIFIDLOG_TOWN 16 -#define LAYOUT_ROUTE101 17 -#define LAYOUT_ROUTE102 18 -#define LAYOUT_ROUTE103 19 -#define LAYOUT_ROUTE104 20 -#define LAYOUT_ROUTE105 21 -#define LAYOUT_ROUTE106 22 -#define LAYOUT_ROUTE107 23 -#define LAYOUT_ROUTE108 24 -#define LAYOUT_ROUTE109 25 -#define LAYOUT_ROUTE110 26 -#define LAYOUT_ROUTE111 27 -#define LAYOUT_ROUTE112 28 -#define LAYOUT_ROUTE113 29 -#define LAYOUT_ROUTE114 30 -#define LAYOUT_ROUTE115 31 -#define LAYOUT_ROUTE116 32 -#define LAYOUT_ROUTE117 33 -#define LAYOUT_ROUTE118 34 -#define LAYOUT_ROUTE119 35 -#define LAYOUT_ROUTE120 36 -#define LAYOUT_ROUTE121 37 -#define LAYOUT_ROUTE122 38 -#define LAYOUT_ROUTE123 39 -#define LAYOUT_ROUTE124 40 -#define LAYOUT_ROUTE125 41 -#define LAYOUT_ROUTE126 42 -#define LAYOUT_ROUTE127 43 -#define LAYOUT_ROUTE128 44 -#define LAYOUT_ROUTE129 45 -#define LAYOUT_ROUTE130_MIRAGE_ISLAND 46 -#define LAYOUT_ROUTE131 47 -#define LAYOUT_ROUTE132 48 -#define LAYOUT_ROUTE133 49 -#define LAYOUT_ROUTE134 50 -#define LAYOUT_UNDERWATER_ROUTE126 51 -#define LAYOUT_UNDERWATER_ROUTE127 52 -#define LAYOUT_UNDERWATER_ROUTE128 53 -#define LAYOUT_LITTLEROOT_TOWN_BRENDANS_HOUSE_1F 54 -#define LAYOUT_LITTLEROOT_TOWN_BRENDANS_HOUSE_2F 55 -#define LAYOUT_LITTLEROOT_TOWN_MAYS_HOUSE_1F 56 -#define LAYOUT_LITTLEROOT_TOWN_MAYS_HOUSE_2F 57 -#define LAYOUT_LITTLEROOT_TOWN_PROFESSOR_BIRCHS_LAB 58 -#define LAYOUT_HOUSE1 59 -#define LAYOUT_HOUSE2 60 -#define LAYOUT_POKEMON_CENTER_1F 61 -#define LAYOUT_POKEMON_CENTER_2F 62 -#define LAYOUT_MART 63 -#define LAYOUT_HOUSE3 64 -#define LAYOUT_DEWFORD_TOWN_GYM 65 -#define LAYOUT_DEWFORD_TOWN_HALL 66 -#define LAYOUT_HOUSE4 67 -#define LAYOUT_LAVARIDGE_TOWN_HERB_SHOP 68 -#define LAYOUT_LAVARIDGE_TOWN_GYM_1F 69 -#define LAYOUT_LAVARIDGE_TOWN_GYM_B1F 70 -#define LAYOUT_LAVARIDGE_TOWN_POKEMON_CENTER_1F 71 -#define LAYOUT_FALLARBOR_TOWN_LEFTOVER_RSCONTEST_LOBBY 72 -#define LAYOUT_FALLARBOR_TOWN_LEFTOVER_RSCONTEST_HALL 73 -#define LAYOUT_LILYCOVE_CITY_HOUSE2 74 -#define LAYOUT_UNUSED_CONTEST_ROOM1 75 -#define LAYOUT_VERDANTURF_TOWN_WANDAS_HOUSE 76 -#define LAYOUT_PACIFIDLOG_TOWN_HOUSE1 77 -#define LAYOUT_PACIFIDLOG_TOWN_HOUSE2 78 -#define LAYOUT_PETALBURG_CITY_GYM 79 -#define LAYOUT_HOUSE_WITH_BED 80 -#define LAYOUT_SLATEPORT_CITY_STERNS_SHIPYARD_1F 81 -#define LAYOUT_SLATEPORT_CITY_STERNS_SHIPYARD_2F 82 -#define LAYOUT_UNUSED_CONTEST_ROOM2 83 -#define LAYOUT_UNUSED_CONTEST_ROOM3 84 -#define LAYOUT_SLATEPORT_CITY_POKEMON_FAN_CLUB 85 -#define LAYOUT_SLATEPORT_CITY_OCEANIC_MUSEUM_1F 86 -#define LAYOUT_SLATEPORT_CITY_OCEANIC_MUSEUM_2F 87 -#define LAYOUT_HARBOR 88 -#define LAYOUT_MAUVILLE_CITY_GYM 89 -#define LAYOUT_MAUVILLE_CITY_BIKE_SHOP 90 -#define LAYOUT_MAUVILLE_CITY_GAME_CORNER 91 -#define LAYOUT_RUSTBORO_CITY_DEVON_CORP_1F 92 -#define LAYOUT_RUSTBORO_CITY_DEVON_CORP_2F 93 -#define LAYOUT_RUSTBORO_CITY_GYM 94 -#define LAYOUT_RUSTBORO_CITY_POKEMON_SCHOOL 95 -#define LAYOUT_RUSTBORO_CITY_HOUSE 96 -#define LAYOUT_RUSTBORO_CITY_HOUSE1 97 -#define LAYOUT_RUSTBORO_CITY_CUTTERS_HOUSE 98 -#define LAYOUT_FORTREE_CITY_HOUSE1 99 -#define LAYOUT_FORTREE_CITY_GYM 100 -#define LAYOUT_FORTREE_CITY_HOUSE2 101 -#define LAYOUT_ROUTE104_MR_BRINEYS_HOUSE 102 -#define LAYOUT_LILYCOVE_CITY_LILYCOVE_MUSEUM_1F 103 -#define LAYOUT_LILYCOVE_CITY_LILYCOVE_MUSEUM_2F 104 -#define LAYOUT_LILYCOVE_CITY_CONTEST_LOBBY 105 -#define LAYOUT_LILYCOVE_CITY_CONTEST_HALL 106 -#define LAYOUT_LILYCOVE_CITY_POKEMON_TRAINER_FAN_CLUB 107 -#define LAYOUT_MOSSDEEP_CITY_GYM 108 -#define LAYOUT_SOOTOPOLIS_CITY_GYM_1F 109 -#define LAYOUT_SOOTOPOLIS_CITY_GYM_B1F 110 -#define LAYOUT_EVER_GRANDE_CITY_SIDNEYS_ROOM 111 -#define LAYOUT_EVER_GRANDE_CITY_PHOEBES_ROOM 112 -#define LAYOUT_EVER_GRANDE_CITY_GLACIAS_ROOM 113 -#define LAYOUT_EVER_GRANDE_CITY_DRAKES_ROOM 114 -#define LAYOUT_EVER_GRANDE_CITY_CHAMPIONS_ROOM 115 -#define LAYOUT_EVER_GRANDE_CITY_SHORT_HALL 116 -#define LAYOUT_ROUTE104_PRETTY_PETAL_FLOWER_SHOP 117 -#define LAYOUT_CABLE_CAR_STATION 118 -#define LAYOUT_ROUTE114_FOSSIL_MANIACS_HOUSE 119 -#define LAYOUT_ROUTE114_FOSSIL_MANIACS_TUNNEL 120 -#define LAYOUT_ROUTE114_LANETTES_HOUSE 121 -#define LAYOUT_ROUTE116_TUNNELERS_REST_HOUSE 122 -#define LAYOUT_ROUTE117_POKEMON_DAY_CARE 123 -#define LAYOUT_ROUTE121_SAFARI_ZONE_ENTRANCE 124 -#define LAYOUT_METEOR_FALLS_1F_1R 125 -#define LAYOUT_METEOR_FALLS_1F_2R 126 -#define LAYOUT_METEOR_FALLS_B1F_1R 127 -#define LAYOUT_METEOR_FALLS_B1F_2R 128 -#define LAYOUT_RUSTURF_TUNNEL 129 -#define LAYOUT_UNDERWATER_SOOTOPOLIS_CITY 130 -#define LAYOUT_DESERT_RUINS 131 -#define LAYOUT_GRANITE_CAVE_1F 132 -#define LAYOUT_GRANITE_CAVE_B1F 133 -#define LAYOUT_GRANITE_CAVE_B2F 134 -#define LAYOUT_PETALBURG_WOODS 135 -#define LAYOUT_MT_CHIMNEY 136 -#define LAYOUT_MT_PYRE_1F 137 -#define LAYOUT_MT_PYRE_2F 138 -#define LAYOUT_MT_PYRE_3F 139 -#define LAYOUT_MT_PYRE_4F 140 -#define LAYOUT_MT_PYRE_5F 141 -#define LAYOUT_MT_PYRE_6F 142 -#define LAYOUT_AQUA_HIDEOUT_1F 143 -#define LAYOUT_AQUA_HIDEOUT_B1F 144 -#define LAYOUT_AQUA_HIDEOUT_B2F 145 -#define LAYOUT_UNDERWATER_SEAFLOOR_CAVERN 146 -#define LAYOUT_SEAFLOOR_CAVERN_ENTRANCE 147 -#define LAYOUT_SEAFLOOR_CAVERN_ROOM1 148 -#define LAYOUT_SEAFLOOR_CAVERN_ROOM2 149 -#define LAYOUT_SEAFLOOR_CAVERN_ROOM3 150 -#define LAYOUT_SEAFLOOR_CAVERN_ROOM4 151 -#define LAYOUT_SEAFLOOR_CAVERN_ROOM5 152 -#define LAYOUT_SEAFLOOR_CAVERN_ROOM6 153 -#define LAYOUT_SEAFLOOR_CAVERN_ROOM7 154 -#define LAYOUT_SEAFLOOR_CAVERN_ROOM8 155 -#define LAYOUT_SEAFLOOR_CAVERN_ROOM9 156 -#define LAYOUT_CAVE_OF_ORIGIN_ENTRANCE 157 -#define LAYOUT_CAVE_OF_ORIGIN_1F 158 -#define LAYOUT_CAVE_OF_ORIGIN_UNUSED_RUBY_SAPPHIRE_MAP1 159 -#define LAYOUT_CAVE_OF_ORIGIN_UNUSED_RUBY_SAPPHIRE_MAP2 160 -#define LAYOUT_CAVE_OF_ORIGIN_UNUSED_RUBY_SAPPHIRE_MAP3 161 -#define LAYOUT_CAVE_OF_ORIGIN_B1F 162 -#define LAYOUT_VICTORY_ROAD_1F 163 -#define LAYOUT_SHOAL_CAVE_LOW_TIDE_ENTRANCE_ROOM 164 -#define LAYOUT_SHOAL_CAVE_LOW_TIDE_INNER_ROOM 165 -#define LAYOUT_SHOAL_CAVE_LOW_TIDE_STAIRS_ROOM 166 -#define LAYOUT_SHOAL_CAVE_LOW_TIDE_LOWER_ROOM 167 -#define LAYOUT_SHOAL_CAVE_HIGH_TIDE_ENTRANCE_ROOM 168 -#define LAYOUT_SHOAL_CAVE_HIGH_TIDE_INNER_ROOM 169 -#define LAYOUT_UNUSED_CAVE1 170 -#define LAYOUT_UNUSED_CAVE2 171 -#define LAYOUT_UNUSED_CAVE3 172 -#define LAYOUT_UNUSED_CAVE4 173 -#define LAYOUT_UNUSED_CAVE5 174 -#define LAYOUT_UNUSED_CAVE6 175 -#define LAYOUT_UNUSED_CAVE7 176 -#define LAYOUT_UNUSED_CAVE8 177 -#define LAYOUT_UNUSED_CAVE9 178 -#define LAYOUT_UNUSED_CAVE10 179 -#define LAYOUT_UNUSED_CAVE11 180 -#define LAYOUT_UNUSED_CAVE12 181 -#define LAYOUT_UNUSED_CAVE13 182 -#define LAYOUT_UNUSED_CAVE14 183 -#define LAYOUT_NEW_MAUVILLE_ENTRANCE 184 -#define LAYOUT_NEW_MAUVILLE_INSIDE 185 -#define LAYOUT_ABANDONED_SHIP_DECK 186 -#define LAYOUT_ABANDONED_SHIP_CORRIDORS_1F 187 -#define LAYOUT_ABANDONED_SHIP_ROOMS_1F 188 -#define LAYOUT_ABANDONED_SHIP_CORRIDORS_B1F 189 -#define LAYOUT_ABANDONED_SHIP_ROOMS_B1F 190 -#define LAYOUT_ABANDONED_SHIP_ROOMS2_B1F 191 -#define LAYOUT_ABANDONED_SHIP_UNDERWATER1 192 -#define LAYOUT_ABANDONED_SHIP_ROOM_B1F 193 -#define LAYOUT_ABANDONED_SHIP_ROOMS2_1F 194 -#define LAYOUT_ABANDONED_SHIP_CAPTAINS_OFFICE 195 -#define LAYOUT_ABANDONED_SHIP_UNDERWATER2 196 -#define LAYOUT_SECRET_BASE_RED_CAVE1 197 -#define LAYOUT_SECRET_BASE_BROWN_CAVE1 198 -#define LAYOUT_SECRET_BASE_BLUE_CAVE1 199 -#define LAYOUT_SECRET_BASE_YELLOW_CAVE1 200 -#define LAYOUT_SECRET_BASE_TREE1 201 -#define LAYOUT_SECRET_BASE_SHRUB1 202 -#define LAYOUT_SECRET_BASE_RED_CAVE2 203 -#define LAYOUT_SECRET_BASE_BROWN_CAVE2 204 -#define LAYOUT_SECRET_BASE_BLUE_CAVE2 205 -#define LAYOUT_SECRET_BASE_YELLOW_CAVE2 206 -#define LAYOUT_SECRET_BASE_TREE2 207 -#define LAYOUT_SECRET_BASE_SHRUB2 208 -#define LAYOUT_SECRET_BASE_RED_CAVE3 209 -#define LAYOUT_SECRET_BASE_BROWN_CAVE3 210 -#define LAYOUT_SECRET_BASE_BLUE_CAVE3 211 -#define LAYOUT_SECRET_BASE_YELLOW_CAVE3 212 -#define LAYOUT_SECRET_BASE_TREE3 213 -#define LAYOUT_SECRET_BASE_SHRUB3 214 -#define LAYOUT_SECRET_BASE_RED_CAVE4 215 -#define LAYOUT_SECRET_BASE_BROWN_CAVE4 216 -#define LAYOUT_SECRET_BASE_BLUE_CAVE4 217 -#define LAYOUT_SECRET_BASE_YELLOW_CAVE4 218 -#define LAYOUT_SECRET_BASE_TREE4 219 -#define LAYOUT_SECRET_BASE_SHRUB4 220 -#define LAYOUT_BATTLE_COLOSSEUM_2P 221 -#define LAYOUT_TRADE_CENTER 222 -#define LAYOUT_RECORD_CORNER 223 -#define LAYOUT_BATTLE_COLOSSEUM_4P 224 -#define LAYOUT_CONTEST_HALL 225 -#define LAYOUT_UNUSED_CONTEST_HALL1 226 -#define LAYOUT_UNUSED_CONTEST_HALL2 227 -#define LAYOUT_UNUSED_CONTEST_HALL3 228 -#define LAYOUT_UNUSED_CONTEST_HALL4 229 -#define LAYOUT_UNUSED_CONTEST_HALL5 230 -#define LAYOUT_UNUSED_CONTEST_HALL6 231 -#define LAYOUT_CONTEST_HALL_BEAUTY 232 -#define LAYOUT_CONTEST_HALL_TOUGH 233 -#define LAYOUT_CONTEST_HALL_COOL 234 -#define LAYOUT_CONTEST_HALL_SMART 235 -#define LAYOUT_CONTEST_HALL_CUTE 236 -#define LAYOUT_INSIDE_OF_TRUCK 237 -#define LAYOUT_SAFARI_ZONE_NORTHWEST 238 -#define LAYOUT_SAFARI_ZONE_NORTH 239 -#define LAYOUT_SAFARI_ZONE_SOUTHWEST 240 -#define LAYOUT_SAFARI_ZONE_SOUTH 241 -#define LAYOUT_UNUSED_OUTDOOR_AREA 242 -#define LAYOUT_ROUTE109_SEASHORE_HOUSE 243 -#define LAYOUT_ROUTE110_TRICK_HOUSE_ENTRANCE 244 -#define LAYOUT_ROUTE110_TRICK_HOUSE_END 245 -#define LAYOUT_ROUTE110_TRICK_HOUSE_CORRIDOR 246 -#define LAYOUT_ROUTE110_TRICK_HOUSE_PUZZLE1 247 -#define LAYOUT_ROUTE110_TRICK_HOUSE_PUZZLE2 248 -#define LAYOUT_ROUTE110_TRICK_HOUSE_PUZZLE3 249 -#define LAYOUT_ROUTE110_TRICK_HOUSE_PUZZLE4 250 -#define LAYOUT_ROUTE110_TRICK_HOUSE_PUZZLE5 251 -#define LAYOUT_ROUTE110_TRICK_HOUSE_PUZZLE6 252 -#define LAYOUT_ROUTE110_TRICK_HOUSE_PUZZLE7 253 -#define LAYOUT_ROUTE110_TRICK_HOUSE_PUZZLE8 254 -#define LAYOUT_FORTREE_CITY_DECORATION_SHOP 255 -#define LAYOUT_ROUTE110_SEASIDE_CYCLING_ROAD_ENTRANCE 256 -#define LAYOUT_LILYCOVE_CITY_DEPARTMENT_STORE_1F 257 -#define LAYOUT_LILYCOVE_CITY_DEPARTMENT_STORE_2F 258 -#define LAYOUT_LILYCOVE_CITY_DEPARTMENT_STORE_3F 259 -#define LAYOUT_LILYCOVE_CITY_DEPARTMENT_STORE_4F 260 -#define LAYOUT_LILYCOVE_CITY_DEPARTMENT_STORE_5F 261 -#define LAYOUT_LILYCOVE_CITY_DEPARTMENT_STORE_ROOFTOP 262 -#define LAYOUT_ROUTE130 263 -#define LAYOUT_BATTLE_FRONTIER_BATTLE_TOWER_LOBBY 264 -#define LAYOUT_BATTLE_FRONTIER_OUTSIDE_WEST 265 -#define LAYOUT_BATTLE_ELEVATOR 266 -#define LAYOUT_BATTLE_FRONTIER_BATTLE_TOWER_CORRIDOR 267 -#define LAYOUT_BATTLE_FRONTIER_BATTLE_TOWER_BATTLE_ROOM 268 -#define LAYOUT_RUSTBORO_CITY_DEVON_CORP_3F 269 -#define LAYOUT_EVER_GRANDE_CITY_POKEMON_LEAGUE_1F 270 -#define LAYOUT_ROUTE119_WEATHER_INSTITUTE_1F 271 -#define LAYOUT_ROUTE119_WEATHER_INSTITUTE_2F 272 -#define LAYOUT_LILYCOVE_CITY_DEPARTMENT_STORE_ELEVATOR 273 -#define LAYOUT_UNDERWATER_ROUTE124 274 -#define LAYOUT_MOSSDEEP_CITY_SPACE_CENTER_1F 275 -#define LAYOUT_MOSSDEEP_CITY_SPACE_CENTER_2F 276 -#define LAYOUT_SS_TIDAL_CORRIDOR 277 -#define LAYOUT_SS_TIDAL_LOWER_DECK 278 -#define LAYOUT_SS_TIDAL_ROOMS 279 -#define LAYOUT_ISLAND_CAVE 280 -#define LAYOUT_ANCIENT_TOMB 281 -#define LAYOUT_UNDERWATER_ROUTE134 282 -#define LAYOUT_UNDERWATER_SEALED_CHAMBER 283 -#define LAYOUT_SEALED_CHAMBER_OUTER_ROOM 284 -#define LAYOUT_VICTORY_ROAD_B1F 285 -#define LAYOUT_VICTORY_ROAD_B2F 286 -#define LAYOUT_ROUTE104_PROTOTYPE 287 -#define LAYOUT_GRANITE_CAVE_STEVENS_ROOM 288 -#define LAYOUT_ABANDONED_SHIP_HIDDEN_FLOOR_CORRIDORS 289 -#define LAYOUT_SOUTHERN_ISLAND_EXTERIOR 290 -#define LAYOUT_SOUTHERN_ISLAND_INTERIOR 291 -#define LAYOUT_JAGGED_PASS 292 -#define LAYOUT_FIERY_PATH 293 -#define LAYOUT_RUSTBORO_CITY_FLAT2_1F 294 -#define LAYOUT_RUSTBORO_CITY_FLAT2_2F 295 -#define LAYOUT_RUSTBORO_CITY_FLAT2_3F 296 -#define LAYOUT_SOOTOPOLIS_CITY_LOTAD_AND_SEEDOT_HOUSE 297 -#define LAYOUT_EVER_GRANDE_CITY_HALL_OF_FAME 298 -#define LAYOUT_LILYCOVE_CITY_COVE_LILY_MOTEL_1F 299 -#define LAYOUT_LILYCOVE_CITY_COVE_LILY_MOTEL_2F 300 -#define LAYOUT_ROUTE124_DIVING_TREASURE_HUNTERS_HOUSE 301 -#define LAYOUT_MT_PYRE_EXTERIOR 302 -#define LAYOUT_MT_PYRE_SUMMIT 303 -#define LAYOUT_SEALED_CHAMBER_INNER_ROOM 304 -#define LAYOUT_MOSSDEEP_CITY_GAME_CORNER_1F 305 -#define LAYOUT_MOSSDEEP_CITY_GAME_CORNER_B1F 306 -#define LAYOUT_SOOTOPOLIS_CITY_HOUSE1 307 -#define LAYOUT_SOOTOPOLIS_CITY_HOUSE2 308 -#define LAYOUT_SOOTOPOLIS_CITY_HOUSE3 309 -#define LAYOUT_ABANDONED_SHIP_HIDDEN_FLOOR_ROOMS 310 -#define LAYOUT_SCORCHED_SLAB 311 -#define LAYOUT_CAVE_OF_ORIGIN_UNUSED_B4F_LAVA 312 -#define LAYOUT_RUSTBORO_CITY_FLAT1_1F 313 -#define LAYOUT_RUSTBORO_CITY_FLAT1_2F 314 -#define LAYOUT_EVER_GRANDE_CITY_HALL4 315 -#define LAYOUT_AQUA_HIDEOUT_UNUSED_RUBY_MAP1 316 -#define LAYOUT_AQUA_HIDEOUT_UNUSED_RUBY_MAP2 317 -#define LAYOUT_AQUA_HIDEOUT_UNUSED_RUBY_MAP3 318 -#define LAYOUT_ROUTE131_SKY_PILLAR 319 -#define LAYOUT_SKY_PILLAR_ENTRANCE 320 -#define LAYOUT_SKY_PILLAR_OUTSIDE 321 -#define LAYOUT_SKY_PILLAR_1F 322 -#define LAYOUT_SKY_PILLAR_2F 323 -#define LAYOUT_SKY_PILLAR_3F 324 -#define LAYOUT_SKY_PILLAR_4F 325 -#define LAYOUT_SEAFLOOR_CAVERN_ROOM9_LAVA 326 -#define LAYOUT_MOSSDEEP_CITY_STEVENS_HOUSE 327 -#define LAYOUT_SHOAL_CAVE_LOW_TIDE_ICE_ROOM 328 -#define LAYOUT_SAFARI_ZONE_REST_HOUSE 329 -#define LAYOUT_SKY_PILLAR_5F 330 -#define LAYOUT_SKY_PILLAR_TOP 331 -#define LAYOUT_BATTLE_FRONTIER_BATTLE_DOME_LOBBY 332 -#define LAYOUT_BATTLE_FRONTIER_BATTLE_DOME_CORRIDOR 333 -#define LAYOUT_BATTLE_FRONTIER_BATTLE_DOME_PRE_BATTLE_ROOM 334 -#define LAYOUT_BATTLE_FRONTIER_BATTLE_DOME_BATTLE_ROOM 335 -#define LAYOUT_MAGMA_HIDEOUT_1F 336 -#define LAYOUT_MAGMA_HIDEOUT_2F_1R 337 -#define LAYOUT_MAGMA_HIDEOUT_2F_2R 338 -#define LAYOUT_MAGMA_HIDEOUT_3F_1R 339 -#define LAYOUT_MAGMA_HIDEOUT_3F_2R 340 -#define LAYOUT_MAGMA_HIDEOUT_4F 341 -#define LAYOUT_BATTLE_FRONTIER_BATTLE_PALACE_LOBBY 342 -#define LAYOUT_BATTLE_FRONTIER_BATTLE_PALACE_CORRIDOR 343 -#define LAYOUT_BATTLE_FRONTIER_BATTLE_PALACE_BATTLE_ROOM 344 -#define LAYOUT_BATTLE_FRONTIER_OUTSIDE_EAST 345 -#define LAYOUT_BATTLE_FRONTIER_BATTLE_FACTORY_LOBBY 346 -#define LAYOUT_BATTLE_FRONTIER_BATTLE_FACTORY_PRE_BATTLE_ROOM 347 -#define LAYOUT_BATTLE_FRONTIER_BATTLE_FACTORY_BATTLE_ROOM 348 -#define LAYOUT_BATTLE_FRONTIER_BATTLE_PIKE_LOBBY 349 -#define LAYOUT_BATTLE_FRONTIER_BATTLE_PIKE_CORRIDOR 350 -#define LAYOUT_BATTLE_FRONTIER_BATTLE_PIKE_THREE_PATH_ROOM 351 -#define LAYOUT_BATTLE_FRONTIER_BATTLE_PIKE_ROOM_NORMAL 352 -#define LAYOUT_BATTLE_FRONTIER_BATTLE_PIKE_ROOM_FINAL 353 -#define LAYOUT_BATTLE_FRONTIER_BATTLE_ARENA_LOBBY 354 -#define LAYOUT_BATTLE_FRONTIER_BATTLE_ARENA_CORRIDOR 355 -#define LAYOUT_BATTLE_FRONTIER_BATTLE_ARENA_BATTLE_ROOM 356 -#define LAYOUT_SOOTOPOLIS_CITY_LEGENDS_BATTLE 357 -#define LAYOUT_BATTLE_FRONTIER_BATTLE_PIKE_ROOM_WILD_MONS 358 -#define LAYOUT_BATTLE_FRONTIER_BATTLE_PIKE_ROOM_UNUSED 359 -#define LAYOUT_BATTLE_FRONTIER_BATTLE_PYRAMID_LOBBY 360 -#define LAYOUT_BATTLE_FRONTIER_BATTLE_PYRAMID_FLOOR 361 -#define LAYOUT_BATTLE_PYRAMID_SQUARE01 362 -#define LAYOUT_BATTLE_PYRAMID_SQUARE02 363 -#define LAYOUT_BATTLE_PYRAMID_SQUARE03 364 -#define LAYOUT_BATTLE_PYRAMID_SQUARE04 365 -#define LAYOUT_BATTLE_PYRAMID_SQUARE05 366 -#define LAYOUT_BATTLE_PYRAMID_SQUARE06 367 -#define LAYOUT_BATTLE_PYRAMID_SQUARE07 368 -#define LAYOUT_BATTLE_PYRAMID_SQUARE08 369 -#define LAYOUT_BATTLE_PYRAMID_SQUARE09 370 -#define LAYOUT_BATTLE_PYRAMID_SQUARE10 371 -#define LAYOUT_BATTLE_PYRAMID_SQUARE11 372 -#define LAYOUT_BATTLE_PYRAMID_SQUARE12 373 -#define LAYOUT_BATTLE_PYRAMID_SQUARE13 374 -#define LAYOUT_BATTLE_PYRAMID_SQUARE14 375 -#define LAYOUT_BATTLE_PYRAMID_SQUARE15 376 -#define LAYOUT_BATTLE_PYRAMID_SQUARE16 377 -#define LAYOUT_BATTLE_FRONTIER_BATTLE_PYRAMID_TOP 378 -#define LAYOUT_MAGMA_HIDEOUT_3F_3R 379 -#define LAYOUT_MAGMA_HIDEOUT_2F_3R 380 -#define LAYOUT_MIRAGE_TOWER_1F 381 -#define LAYOUT_MIRAGE_TOWER_2F 382 -#define LAYOUT_MIRAGE_TOWER_3F 383 -#define LAYOUT_BATTLE_TENT_LOBBY 384 -#define LAYOUT_BATTLE_TENT_CORRIDOR 385 -#define LAYOUT_BATTLE_TENT_BATTLE_ROOM 386 -#define LAYOUT_VERDANTURF_TOWN_BATTLE_TENT_BATTLE_ROOM 387 -#define LAYOUT_MIRAGE_TOWER_4F 388 -#define LAYOUT_DESERT_UNDERPASS 389 -#define LAYOUT_BATTLE_FRONTIER_BATTLE_TOWER_MULTI_PARTNER_ROOM 390 -#define LAYOUT_BATTLE_FRONTIER_BATTLE_TOWER_MULTI_CORRIDOR 391 -#define LAYOUT_ROUTE111_NO_MIRAGE_TOWER 392 -#define LAYOUT_UNION_ROOM 393 -#define LAYOUT_SAFARI_ZONE_NORTHEAST 394 -#define LAYOUT_SAFARI_ZONE_SOUTHEAST 395 -#define LAYOUT_BATTLE_FRONTIER_RANKING_HALL 396 -#define LAYOUT_BATTLE_FRONTIER_LOUNGE1 397 -#define LAYOUT_BATTLE_FRONTIER_EXCHANGE_SERVICE_CORNER 398 -#define LAYOUT_BATTLE_FRONTIER_RECEPTION_GATE 399 -#define LAYOUT_ARTISAN_CAVE_B1F 400 -#define LAYOUT_ARTISAN_CAVE_1F 401 -#define LAYOUT_FARAWAY_ISLAND_ENTRANCE 402 -#define LAYOUT_FARAWAY_ISLAND_INTERIOR 403 -#define LAYOUT_BIRTH_ISLAND_EXTERIOR 404 -#define LAYOUT_ISLAND_HARBOR 405 -#define LAYOUT_UNDERWATER_MARINE_CAVE 406 -#define LAYOUT_MARINE_CAVE_ENTRANCE 407 -#define LAYOUT_TERRA_CAVE_ENTRANCE 408 -#define LAYOUT_TERRA_CAVE_END 409 -#define LAYOUT_UNDERWATER_ROUTE105 410 -#define LAYOUT_UNDERWATER_ROUTE125 411 -#define LAYOUT_UNDERWATER_ROUTE129 412 -#define LAYOUT_MARINE_CAVE_END 413 -#define LAYOUT_TRAINER_HILL_ENTRANCE 414 -#define LAYOUT_TRAINER_HILL_1F 415 -#define LAYOUT_TRAINER_HILL_2F 416 -#define LAYOUT_TRAINER_HILL_3F 417 -#define LAYOUT_TRAINER_HILL_4F 418 -#define LAYOUT_TRAINER_HILL_ROOF 419 -#define LAYOUT_ALTERING_CAVE 420 -#define LAYOUT_NAVEL_ROCK_EXTERIOR 421 -#define LAYOUT_NAVEL_ROCK_ENTRANCE 422 -#define LAYOUT_NAVEL_ROCK_TOP 423 -#define LAYOUT_NAVEL_ROCK_BOTTOM 424 -#define LAYOUT_NAVEL_ROCK_LADDER_ROOM1 425 -#define LAYOUT_NAVEL_ROCK_LADDER_ROOM2 426 -#define LAYOUT_NAVEL_ROCK_B1F 427 -#define LAYOUT_NAVEL_ROCK_FORK 428 -#define LAYOUT_BATTLE_FRONTIER_LOUNGE2 429 -#define LAYOUT_BATTLE_FRONTIER_SCOTTS_HOUSE 430 -#define LAYOUT_METEOR_FALLS_STEVENS_CAVE 431 -#define LAYOUT_LITTLEROOT_TOWN_PROFESSOR_BIRCHS_LAB_WITH_TABLE 432 -#define LAYOUT_SKY_PILLAR_1F_CLEAN 433 -#define LAYOUT_SKY_PILLAR_2F_CLEAN 434 -#define LAYOUT_SKY_PILLAR_3F_CLEAN 435 -#define LAYOUT_SKY_PILLAR_4F_CLEAN 436 -#define LAYOUT_SKY_PILLAR_5F_CLEAN 437 -#define LAYOUT_SKY_PILLAR_TOP_CLEAN 438 -#define LAYOUT_SOOTOPOLIS_CITY_MYSTERY_EVENTS_HOUSE_1F 439 -#define LAYOUT_SOOTOPOLIS_CITY_MYSTERY_EVENTS_HOUSE_B1F 440 -#define LAYOUT_SOOTOPOLIS_CITY_MYSTERY_EVENTS_HOUSE_1F_STAIRS_UNBLOCKED 441 - -#endif // GUARD_CONSTANTS_LAYOUTS_H diff --git a/include/constants/map_groups.h b/include/constants/map_groups.h deleted file mode 100755 index eaf40a525d00..000000000000 --- a/include/constants/map_groups.h +++ /dev/null @@ -1,596 +0,0 @@ -#ifndef GUARD_CONSTANTS_MAP_GROUPS_H -#define GUARD_CONSTANTS_MAP_GROUPS_H - -// -// DO NOT MODIFY THIS FILE! It is auto-generated from data/maps/map_groups.json -// - -// gMapGroup_TownsAndRoutes -#define MAP_PETALBURG_CITY (0 | (0 << 8)) -#define MAP_SLATEPORT_CITY (1 | (0 << 8)) -#define MAP_MAUVILLE_CITY (2 | (0 << 8)) -#define MAP_RUSTBORO_CITY (3 | (0 << 8)) -#define MAP_FORTREE_CITY (4 | (0 << 8)) -#define MAP_LILYCOVE_CITY (5 | (0 << 8)) -#define MAP_MOSSDEEP_CITY (6 | (0 << 8)) -#define MAP_SOOTOPOLIS_CITY (7 | (0 << 8)) -#define MAP_EVER_GRANDE_CITY (8 | (0 << 8)) -#define MAP_LITTLEROOT_TOWN (9 | (0 << 8)) -#define MAP_OLDALE_TOWN (10 | (0 << 8)) -#define MAP_DEWFORD_TOWN (11 | (0 << 8)) -#define MAP_LAVARIDGE_TOWN (12 | (0 << 8)) -#define MAP_FALLARBOR_TOWN (13 | (0 << 8)) -#define MAP_VERDANTURF_TOWN (14 | (0 << 8)) -#define MAP_PACIFIDLOG_TOWN (15 | (0 << 8)) -#define MAP_ROUTE101 (16 | (0 << 8)) -#define MAP_ROUTE102 (17 | (0 << 8)) -#define MAP_ROUTE103 (18 | (0 << 8)) -#define MAP_ROUTE104 (19 | (0 << 8)) -#define MAP_ROUTE105 (20 | (0 << 8)) -#define MAP_ROUTE106 (21 | (0 << 8)) -#define MAP_ROUTE107 (22 | (0 << 8)) -#define MAP_ROUTE108 (23 | (0 << 8)) -#define MAP_ROUTE109 (24 | (0 << 8)) -#define MAP_ROUTE110 (25 | (0 << 8)) -#define MAP_ROUTE111 (26 | (0 << 8)) -#define MAP_ROUTE112 (27 | (0 << 8)) -#define MAP_ROUTE113 (28 | (0 << 8)) -#define MAP_ROUTE114 (29 | (0 << 8)) -#define MAP_ROUTE115 (30 | (0 << 8)) -#define MAP_ROUTE116 (31 | (0 << 8)) -#define MAP_ROUTE117 (32 | (0 << 8)) -#define MAP_ROUTE118 (33 | (0 << 8)) -#define MAP_ROUTE119 (34 | (0 << 8)) -#define MAP_ROUTE120 (35 | (0 << 8)) -#define MAP_ROUTE121 (36 | (0 << 8)) -#define MAP_ROUTE122 (37 | (0 << 8)) -#define MAP_ROUTE123 (38 | (0 << 8)) -#define MAP_ROUTE124 (39 | (0 << 8)) -#define MAP_ROUTE125 (40 | (0 << 8)) -#define MAP_ROUTE126 (41 | (0 << 8)) -#define MAP_ROUTE127 (42 | (0 << 8)) -#define MAP_ROUTE128 (43 | (0 << 8)) -#define MAP_ROUTE129 (44 | (0 << 8)) -#define MAP_ROUTE130 (45 | (0 << 8)) -#define MAP_ROUTE131 (46 | (0 << 8)) -#define MAP_ROUTE132 (47 | (0 << 8)) -#define MAP_ROUTE133 (48 | (0 << 8)) -#define MAP_ROUTE134 (49 | (0 << 8)) -#define MAP_UNDERWATER_ROUTE124 (50 | (0 << 8)) -#define MAP_UNDERWATER_ROUTE126 (51 | (0 << 8)) -#define MAP_UNDERWATER_ROUTE127 (52 | (0 << 8)) -#define MAP_UNDERWATER_ROUTE128 (53 | (0 << 8)) -#define MAP_UNDERWATER_ROUTE129 (54 | (0 << 8)) -#define MAP_UNDERWATER_ROUTE105 (55 | (0 << 8)) -#define MAP_UNDERWATER_ROUTE125 (56 | (0 << 8)) - -// gMapGroup_IndoorLittleroot -#define MAP_LITTLEROOT_TOWN_BRENDANS_HOUSE_1F (0 | (1 << 8)) -#define MAP_LITTLEROOT_TOWN_BRENDANS_HOUSE_2F (1 | (1 << 8)) -#define MAP_LITTLEROOT_TOWN_MAYS_HOUSE_1F (2 | (1 << 8)) -#define MAP_LITTLEROOT_TOWN_MAYS_HOUSE_2F (3 | (1 << 8)) -#define MAP_LITTLEROOT_TOWN_PROFESSOR_BIRCHS_LAB (4 | (1 << 8)) - -// gMapGroup_IndoorOldale -#define MAP_OLDALE_TOWN_HOUSE1 (0 | (2 << 8)) -#define MAP_OLDALE_TOWN_HOUSE2 (1 | (2 << 8)) -#define MAP_OLDALE_TOWN_POKEMON_CENTER_1F (2 | (2 << 8)) -#define MAP_OLDALE_TOWN_POKEMON_CENTER_2F (3 | (2 << 8)) -#define MAP_OLDALE_TOWN_MART (4 | (2 << 8)) - -// gMapGroup_IndoorDewford -#define MAP_DEWFORD_TOWN_HOUSE1 (0 | (3 << 8)) -#define MAP_DEWFORD_TOWN_POKEMON_CENTER_1F (1 | (3 << 8)) -#define MAP_DEWFORD_TOWN_POKEMON_CENTER_2F (2 | (3 << 8)) -#define MAP_DEWFORD_TOWN_GYM (3 | (3 << 8)) -#define MAP_DEWFORD_TOWN_HALL (4 | (3 << 8)) -#define MAP_DEWFORD_TOWN_HOUSE2 (5 | (3 << 8)) - -// gMapGroup_IndoorLavaridge -#define MAP_LAVARIDGE_TOWN_HERB_SHOP (0 | (4 << 8)) -#define MAP_LAVARIDGE_TOWN_GYM_1F (1 | (4 << 8)) -#define MAP_LAVARIDGE_TOWN_GYM_B1F (2 | (4 << 8)) -#define MAP_LAVARIDGE_TOWN_HOUSE (3 | (4 << 8)) -#define MAP_LAVARIDGE_TOWN_MART (4 | (4 << 8)) -#define MAP_LAVARIDGE_TOWN_POKEMON_CENTER_1F (5 | (4 << 8)) -#define MAP_LAVARIDGE_TOWN_POKEMON_CENTER_2F (6 | (4 << 8)) - -// gMapGroup_IndoorFallarbor -#define MAP_FALLARBOR_TOWN_MART (0 | (5 << 8)) -#define MAP_FALLARBOR_TOWN_BATTLE_TENT_LOBBY (1 | (5 << 8)) -#define MAP_FALLARBOR_TOWN_BATTLE_TENT_CORRIDOR (2 | (5 << 8)) -#define MAP_FALLARBOR_TOWN_BATTLE_TENT_BATTLE_ROOM (3 | (5 << 8)) -#define MAP_FALLARBOR_TOWN_POKEMON_CENTER_1F (4 | (5 << 8)) -#define MAP_FALLARBOR_TOWN_POKEMON_CENTER_2F (5 | (5 << 8)) -#define MAP_FALLARBOR_TOWN_COZMOS_HOUSE (6 | (5 << 8)) -#define MAP_FALLARBOR_TOWN_MOVE_RELEARNERS_HOUSE (7 | (5 << 8)) - -// gMapGroup_IndoorVerdanturf -#define MAP_VERDANTURF_TOWN_BATTLE_TENT_LOBBY (0 | (6 << 8)) -#define MAP_VERDANTURF_TOWN_BATTLE_TENT_CORRIDOR (1 | (6 << 8)) -#define MAP_VERDANTURF_TOWN_BATTLE_TENT_BATTLE_ROOM (2 | (6 << 8)) -#define MAP_VERDANTURF_TOWN_MART (3 | (6 << 8)) -#define MAP_VERDANTURF_TOWN_POKEMON_CENTER_1F (4 | (6 << 8)) -#define MAP_VERDANTURF_TOWN_POKEMON_CENTER_2F (5 | (6 << 8)) -#define MAP_VERDANTURF_TOWN_WANDAS_HOUSE (6 | (6 << 8)) -#define MAP_VERDANTURF_TOWN_FRIENDSHIP_RATERS_HOUSE (7 | (6 << 8)) -#define MAP_VERDANTURF_TOWN_HOUSE (8 | (6 << 8)) - -// gMapGroup_IndoorPacifidlog -#define MAP_PACIFIDLOG_TOWN_POKEMON_CENTER_1F (0 | (7 << 8)) -#define MAP_PACIFIDLOG_TOWN_POKEMON_CENTER_2F (1 | (7 << 8)) -#define MAP_PACIFIDLOG_TOWN_HOUSE1 (2 | (7 << 8)) -#define MAP_PACIFIDLOG_TOWN_HOUSE2 (3 | (7 << 8)) -#define MAP_PACIFIDLOG_TOWN_HOUSE3 (4 | (7 << 8)) -#define MAP_PACIFIDLOG_TOWN_HOUSE4 (5 | (7 << 8)) -#define MAP_PACIFIDLOG_TOWN_HOUSE5 (6 | (7 << 8)) - -// gMapGroup_IndoorPetalburg -#define MAP_PETALBURG_CITY_WALLYS_HOUSE (0 | (8 << 8)) -#define MAP_PETALBURG_CITY_GYM (1 | (8 << 8)) -#define MAP_PETALBURG_CITY_HOUSE1 (2 | (8 << 8)) -#define MAP_PETALBURG_CITY_HOUSE2 (3 | (8 << 8)) -#define MAP_PETALBURG_CITY_POKEMON_CENTER_1F (4 | (8 << 8)) -#define MAP_PETALBURG_CITY_POKEMON_CENTER_2F (5 | (8 << 8)) -#define MAP_PETALBURG_CITY_MART (6 | (8 << 8)) - -// gMapGroup_IndoorSlateport -#define MAP_SLATEPORT_CITY_STERNS_SHIPYARD_1F (0 | (9 << 8)) -#define MAP_SLATEPORT_CITY_STERNS_SHIPYARD_2F (1 | (9 << 8)) -#define MAP_SLATEPORT_CITY_BATTLE_TENT_LOBBY (2 | (9 << 8)) -#define MAP_SLATEPORT_CITY_BATTLE_TENT_CORRIDOR (3 | (9 << 8)) -#define MAP_SLATEPORT_CITY_BATTLE_TENT_BATTLE_ROOM (4 | (9 << 8)) -#define MAP_SLATEPORT_CITY_NAME_RATERS_HOUSE (5 | (9 << 8)) -#define MAP_SLATEPORT_CITY_POKEMON_FAN_CLUB (6 | (9 << 8)) -#define MAP_SLATEPORT_CITY_OCEANIC_MUSEUM_1F (7 | (9 << 8)) -#define MAP_SLATEPORT_CITY_OCEANIC_MUSEUM_2F (8 | (9 << 8)) -#define MAP_SLATEPORT_CITY_HARBOR (9 | (9 << 8)) -#define MAP_SLATEPORT_CITY_HOUSE (10 | (9 << 8)) -#define MAP_SLATEPORT_CITY_POKEMON_CENTER_1F (11 | (9 << 8)) -#define MAP_SLATEPORT_CITY_POKEMON_CENTER_2F (12 | (9 << 8)) -#define MAP_SLATEPORT_CITY_MART (13 | (9 << 8)) - -// gMapGroup_IndoorMauville -#define MAP_MAUVILLE_CITY_GYM (0 | (10 << 8)) -#define MAP_MAUVILLE_CITY_BIKE_SHOP (1 | (10 << 8)) -#define MAP_MAUVILLE_CITY_HOUSE1 (2 | (10 << 8)) -#define MAP_MAUVILLE_CITY_GAME_CORNER (3 | (10 << 8)) -#define MAP_MAUVILLE_CITY_HOUSE2 (4 | (10 << 8)) -#define MAP_MAUVILLE_CITY_POKEMON_CENTER_1F (5 | (10 << 8)) -#define MAP_MAUVILLE_CITY_POKEMON_CENTER_2F (6 | (10 << 8)) -#define MAP_MAUVILLE_CITY_MART (7 | (10 << 8)) - -// gMapGroup_IndoorRustboro -#define MAP_RUSTBORO_CITY_DEVON_CORP_1F (0 | (11 << 8)) -#define MAP_RUSTBORO_CITY_DEVON_CORP_2F (1 | (11 << 8)) -#define MAP_RUSTBORO_CITY_DEVON_CORP_3F (2 | (11 << 8)) -#define MAP_RUSTBORO_CITY_GYM (3 | (11 << 8)) -#define MAP_RUSTBORO_CITY_POKEMON_SCHOOL (4 | (11 << 8)) -#define MAP_RUSTBORO_CITY_POKEMON_CENTER_1F (5 | (11 << 8)) -#define MAP_RUSTBORO_CITY_POKEMON_CENTER_2F (6 | (11 << 8)) -#define MAP_RUSTBORO_CITY_MART (7 | (11 << 8)) -#define MAP_RUSTBORO_CITY_FLAT1_1F (8 | (11 << 8)) -#define MAP_RUSTBORO_CITY_FLAT1_2F (9 | (11 << 8)) -#define MAP_RUSTBORO_CITY_HOUSE1 (10 | (11 << 8)) -#define MAP_RUSTBORO_CITY_CUTTERS_HOUSE (11 | (11 << 8)) -#define MAP_RUSTBORO_CITY_HOUSE2 (12 | (11 << 8)) -#define MAP_RUSTBORO_CITY_FLAT2_1F (13 | (11 << 8)) -#define MAP_RUSTBORO_CITY_FLAT2_2F (14 | (11 << 8)) -#define MAP_RUSTBORO_CITY_FLAT2_3F (15 | (11 << 8)) -#define MAP_RUSTBORO_CITY_HOUSE3 (16 | (11 << 8)) - -// gMapGroup_IndoorFortree -#define MAP_FORTREE_CITY_HOUSE1 (0 | (12 << 8)) -#define MAP_FORTREE_CITY_GYM (1 | (12 << 8)) -#define MAP_FORTREE_CITY_POKEMON_CENTER_1F (2 | (12 << 8)) -#define MAP_FORTREE_CITY_POKEMON_CENTER_2F (3 | (12 << 8)) -#define MAP_FORTREE_CITY_MART (4 | (12 << 8)) -#define MAP_FORTREE_CITY_HOUSE2 (5 | (12 << 8)) -#define MAP_FORTREE_CITY_HOUSE3 (6 | (12 << 8)) -#define MAP_FORTREE_CITY_HOUSE4 (7 | (12 << 8)) -#define MAP_FORTREE_CITY_HOUSE5 (8 | (12 << 8)) -#define MAP_FORTREE_CITY_DECORATION_SHOP (9 | (12 << 8)) - -// gMapGroup_IndoorLilycove -#define MAP_LILYCOVE_CITY_COVE_LILY_MOTEL_1F (0 | (13 << 8)) -#define MAP_LILYCOVE_CITY_COVE_LILY_MOTEL_2F (1 | (13 << 8)) -#define MAP_LILYCOVE_CITY_LILYCOVE_MUSEUM_1F (2 | (13 << 8)) -#define MAP_LILYCOVE_CITY_LILYCOVE_MUSEUM_2F (3 | (13 << 8)) -#define MAP_LILYCOVE_CITY_CONTEST_LOBBY (4 | (13 << 8)) -#define MAP_LILYCOVE_CITY_CONTEST_HALL (5 | (13 << 8)) -#define MAP_LILYCOVE_CITY_POKEMON_CENTER_1F (6 | (13 << 8)) -#define MAP_LILYCOVE_CITY_POKEMON_CENTER_2F (7 | (13 << 8)) -#define MAP_LILYCOVE_CITY_UNUSED_MART (8 | (13 << 8)) -#define MAP_LILYCOVE_CITY_POKEMON_TRAINER_FAN_CLUB (9 | (13 << 8)) -#define MAP_LILYCOVE_CITY_HARBOR (10 | (13 << 8)) -#define MAP_LILYCOVE_CITY_MOVE_DELETERS_HOUSE (11 | (13 << 8)) -#define MAP_LILYCOVE_CITY_HOUSE1 (12 | (13 << 8)) -#define MAP_LILYCOVE_CITY_HOUSE2 (13 | (13 << 8)) -#define MAP_LILYCOVE_CITY_HOUSE3 (14 | (13 << 8)) -#define MAP_LILYCOVE_CITY_HOUSE4 (15 | (13 << 8)) -#define MAP_LILYCOVE_CITY_DEPARTMENT_STORE_1F (16 | (13 << 8)) -#define MAP_LILYCOVE_CITY_DEPARTMENT_STORE_2F (17 | (13 << 8)) -#define MAP_LILYCOVE_CITY_DEPARTMENT_STORE_3F (18 | (13 << 8)) -#define MAP_LILYCOVE_CITY_DEPARTMENT_STORE_4F (19 | (13 << 8)) -#define MAP_LILYCOVE_CITY_DEPARTMENT_STORE_5F (20 | (13 << 8)) -#define MAP_LILYCOVE_CITY_DEPARTMENT_STORE_ROOFTOP (21 | (13 << 8)) -#define MAP_LILYCOVE_CITY_DEPARTMENT_STORE_ELEVATOR (22 | (13 << 8)) - -// gMapGroup_IndoorMossdeep -#define MAP_MOSSDEEP_CITY_GYM (0 | (14 << 8)) -#define MAP_MOSSDEEP_CITY_HOUSE1 (1 | (14 << 8)) -#define MAP_MOSSDEEP_CITY_HOUSE2 (2 | (14 << 8)) -#define MAP_MOSSDEEP_CITY_POKEMON_CENTER_1F (3 | (14 << 8)) -#define MAP_MOSSDEEP_CITY_POKEMON_CENTER_2F (4 | (14 << 8)) -#define MAP_MOSSDEEP_CITY_MART (5 | (14 << 8)) -#define MAP_MOSSDEEP_CITY_HOUSE3 (6 | (14 << 8)) -#define MAP_MOSSDEEP_CITY_STEVENS_HOUSE (7 | (14 << 8)) -#define MAP_MOSSDEEP_CITY_HOUSE4 (8 | (14 << 8)) -#define MAP_MOSSDEEP_CITY_SPACE_CENTER_1F (9 | (14 << 8)) -#define MAP_MOSSDEEP_CITY_SPACE_CENTER_2F (10 | (14 << 8)) -#define MAP_MOSSDEEP_CITY_GAME_CORNER_1F (11 | (14 << 8)) -#define MAP_MOSSDEEP_CITY_GAME_CORNER_B1F (12 | (14 << 8)) - -// gMapGroup_IndoorSootopolis -#define MAP_SOOTOPOLIS_CITY_GYM_1F (0 | (15 << 8)) -#define MAP_SOOTOPOLIS_CITY_GYM_B1F (1 | (15 << 8)) -#define MAP_SOOTOPOLIS_CITY_POKEMON_CENTER_1F (2 | (15 << 8)) -#define MAP_SOOTOPOLIS_CITY_POKEMON_CENTER_2F (3 | (15 << 8)) -#define MAP_SOOTOPOLIS_CITY_MART (4 | (15 << 8)) -#define MAP_SOOTOPOLIS_CITY_HOUSE1 (5 | (15 << 8)) -#define MAP_SOOTOPOLIS_CITY_HOUSE2 (6 | (15 << 8)) -#define MAP_SOOTOPOLIS_CITY_HOUSE3 (7 | (15 << 8)) -#define MAP_SOOTOPOLIS_CITY_HOUSE4 (8 | (15 << 8)) -#define MAP_SOOTOPOLIS_CITY_HOUSE5 (9 | (15 << 8)) -#define MAP_SOOTOPOLIS_CITY_HOUSE6 (10 | (15 << 8)) -#define MAP_SOOTOPOLIS_CITY_HOUSE7 (11 | (15 << 8)) -#define MAP_SOOTOPOLIS_CITY_LOTAD_AND_SEEDOT_HOUSE (12 | (15 << 8)) -#define MAP_SOOTOPOLIS_CITY_MYSTERY_EVENTS_HOUSE_1F (13 | (15 << 8)) -#define MAP_SOOTOPOLIS_CITY_MYSTERY_EVENTS_HOUSE_B1F (14 | (15 << 8)) - -// gMapGroup_IndoorEverGrande -#define MAP_EVER_GRANDE_CITY_SIDNEYS_ROOM (0 | (16 << 8)) -#define MAP_EVER_GRANDE_CITY_PHOEBES_ROOM (1 | (16 << 8)) -#define MAP_EVER_GRANDE_CITY_GLACIAS_ROOM (2 | (16 << 8)) -#define MAP_EVER_GRANDE_CITY_DRAKES_ROOM (3 | (16 << 8)) -#define MAP_EVER_GRANDE_CITY_CHAMPIONS_ROOM (4 | (16 << 8)) -#define MAP_EVER_GRANDE_CITY_HALL1 (5 | (16 << 8)) -#define MAP_EVER_GRANDE_CITY_HALL2 (6 | (16 << 8)) -#define MAP_EVER_GRANDE_CITY_HALL3 (7 | (16 << 8)) -#define MAP_EVER_GRANDE_CITY_HALL4 (8 | (16 << 8)) -#define MAP_EVER_GRANDE_CITY_HALL5 (9 | (16 << 8)) -#define MAP_EVER_GRANDE_CITY_POKEMON_LEAGUE_1F (10 | (16 << 8)) -#define MAP_EVER_GRANDE_CITY_HALL_OF_FAME (11 | (16 << 8)) -#define MAP_EVER_GRANDE_CITY_POKEMON_CENTER_1F (12 | (16 << 8)) -#define MAP_EVER_GRANDE_CITY_POKEMON_CENTER_2F (13 | (16 << 8)) -#define MAP_EVER_GRANDE_CITY_POKEMON_LEAGUE_2F (14 | (16 << 8)) - -// gMapGroup_IndoorRoute104 -#define MAP_ROUTE104_MR_BRINEYS_HOUSE (0 | (17 << 8)) -#define MAP_ROUTE104_PRETTY_PETAL_FLOWER_SHOP (1 | (17 << 8)) - -// gMapGroup_IndoorRoute111 -#define MAP_ROUTE111_WINSTRATE_FAMILYS_HOUSE (0 | (18 << 8)) -#define MAP_ROUTE111_OLD_LADYS_REST_STOP (1 | (18 << 8)) - -// gMapGroup_IndoorRoute112 -#define MAP_ROUTE112_CABLE_CAR_STATION (0 | (19 << 8)) -#define MAP_MT_CHIMNEY_CABLE_CAR_STATION (1 | (19 << 8)) - -// gMapGroup_IndoorRoute114 -#define MAP_ROUTE114_FOSSIL_MANIACS_HOUSE (0 | (20 << 8)) -#define MAP_ROUTE114_FOSSIL_MANIACS_TUNNEL (1 | (20 << 8)) -#define MAP_ROUTE114_LANETTES_HOUSE (2 | (20 << 8)) - -// gMapGroup_IndoorRoute116 -#define MAP_ROUTE116_TUNNELERS_REST_HOUSE (0 | (21 << 8)) - -// gMapGroup_IndoorRoute117 -#define MAP_ROUTE117_POKEMON_DAY_CARE (0 | (22 << 8)) - -// gMapGroup_IndoorRoute121 -#define MAP_ROUTE121_SAFARI_ZONE_ENTRANCE (0 | (23 << 8)) - -// gMapGroup_Dungeons -#define MAP_METEOR_FALLS_1F_1R (0 | (24 << 8)) -#define MAP_METEOR_FALLS_1F_2R (1 | (24 << 8)) -#define MAP_METEOR_FALLS_B1F_1R (2 | (24 << 8)) -#define MAP_METEOR_FALLS_B1F_2R (3 | (24 << 8)) -#define MAP_RUSTURF_TUNNEL (4 | (24 << 8)) -#define MAP_UNDERWATER_SOOTOPOLIS_CITY (5 | (24 << 8)) -#define MAP_DESERT_RUINS (6 | (24 << 8)) -#define MAP_GRANITE_CAVE_1F (7 | (24 << 8)) -#define MAP_GRANITE_CAVE_B1F (8 | (24 << 8)) -#define MAP_GRANITE_CAVE_B2F (9 | (24 << 8)) -#define MAP_GRANITE_CAVE_STEVENS_ROOM (10 | (24 << 8)) -#define MAP_PETALBURG_WOODS (11 | (24 << 8)) -#define MAP_MT_CHIMNEY (12 | (24 << 8)) -#define MAP_JAGGED_PASS (13 | (24 << 8)) -#define MAP_FIERY_PATH (14 | (24 << 8)) -#define MAP_MT_PYRE_1F (15 | (24 << 8)) -#define MAP_MT_PYRE_2F (16 | (24 << 8)) -#define MAP_MT_PYRE_3F (17 | (24 << 8)) -#define MAP_MT_PYRE_4F (18 | (24 << 8)) -#define MAP_MT_PYRE_5F (19 | (24 << 8)) -#define MAP_MT_PYRE_6F (20 | (24 << 8)) -#define MAP_MT_PYRE_EXTERIOR (21 | (24 << 8)) -#define MAP_MT_PYRE_SUMMIT (22 | (24 << 8)) -#define MAP_AQUA_HIDEOUT_1F (23 | (24 << 8)) -#define MAP_AQUA_HIDEOUT_B1F (24 | (24 << 8)) -#define MAP_AQUA_HIDEOUT_B2F (25 | (24 << 8)) -#define MAP_UNDERWATER_SEAFLOOR_CAVERN (26 | (24 << 8)) -#define MAP_SEAFLOOR_CAVERN_ENTRANCE (27 | (24 << 8)) -#define MAP_SEAFLOOR_CAVERN_ROOM1 (28 | (24 << 8)) -#define MAP_SEAFLOOR_CAVERN_ROOM2 (29 | (24 << 8)) -#define MAP_SEAFLOOR_CAVERN_ROOM3 (30 | (24 << 8)) -#define MAP_SEAFLOOR_CAVERN_ROOM4 (31 | (24 << 8)) -#define MAP_SEAFLOOR_CAVERN_ROOM5 (32 | (24 << 8)) -#define MAP_SEAFLOOR_CAVERN_ROOM6 (33 | (24 << 8)) -#define MAP_SEAFLOOR_CAVERN_ROOM7 (34 | (24 << 8)) -#define MAP_SEAFLOOR_CAVERN_ROOM8 (35 | (24 << 8)) -#define MAP_SEAFLOOR_CAVERN_ROOM9 (36 | (24 << 8)) -#define MAP_CAVE_OF_ORIGIN_ENTRANCE (37 | (24 << 8)) -#define MAP_CAVE_OF_ORIGIN_1F (38 | (24 << 8)) -#define MAP_CAVE_OF_ORIGIN_UNUSED_RUBY_SAPPHIRE_MAP1 (39 | (24 << 8)) -#define MAP_CAVE_OF_ORIGIN_UNUSED_RUBY_SAPPHIRE_MAP2 (40 | (24 << 8)) -#define MAP_CAVE_OF_ORIGIN_UNUSED_RUBY_SAPPHIRE_MAP3 (41 | (24 << 8)) -#define MAP_CAVE_OF_ORIGIN_B1F (42 | (24 << 8)) -#define MAP_VICTORY_ROAD_1F (43 | (24 << 8)) -#define MAP_VICTORY_ROAD_B1F (44 | (24 << 8)) -#define MAP_VICTORY_ROAD_B2F (45 | (24 << 8)) -#define MAP_SHOAL_CAVE_LOW_TIDE_ENTRANCE_ROOM (46 | (24 << 8)) -#define MAP_SHOAL_CAVE_LOW_TIDE_INNER_ROOM (47 | (24 << 8)) -#define MAP_SHOAL_CAVE_LOW_TIDE_STAIRS_ROOM (48 | (24 << 8)) -#define MAP_SHOAL_CAVE_LOW_TIDE_LOWER_ROOM (49 | (24 << 8)) -#define MAP_SHOAL_CAVE_HIGH_TIDE_ENTRANCE_ROOM (50 | (24 << 8)) -#define MAP_SHOAL_CAVE_HIGH_TIDE_INNER_ROOM (51 | (24 << 8)) -#define MAP_NEW_MAUVILLE_ENTRANCE (52 | (24 << 8)) -#define MAP_NEW_MAUVILLE_INSIDE (53 | (24 << 8)) -#define MAP_ABANDONED_SHIP_DECK (54 | (24 << 8)) -#define MAP_ABANDONED_SHIP_CORRIDORS_1F (55 | (24 << 8)) -#define MAP_ABANDONED_SHIP_ROOMS_1F (56 | (24 << 8)) -#define MAP_ABANDONED_SHIP_CORRIDORS_B1F (57 | (24 << 8)) -#define MAP_ABANDONED_SHIP_ROOMS_B1F (58 | (24 << 8)) -#define MAP_ABANDONED_SHIP_ROOMS2_B1F (59 | (24 << 8)) -#define MAP_ABANDONED_SHIP_UNDERWATER1 (60 | (24 << 8)) -#define MAP_ABANDONED_SHIP_ROOM_B1F (61 | (24 << 8)) -#define MAP_ABANDONED_SHIP_ROOMS2_1F (62 | (24 << 8)) -#define MAP_ABANDONED_SHIP_CAPTAINS_OFFICE (63 | (24 << 8)) -#define MAP_ABANDONED_SHIP_UNDERWATER2 (64 | (24 << 8)) -#define MAP_ABANDONED_SHIP_HIDDEN_FLOOR_CORRIDORS (65 | (24 << 8)) -#define MAP_ABANDONED_SHIP_HIDDEN_FLOOR_ROOMS (66 | (24 << 8)) -#define MAP_ISLAND_CAVE (67 | (24 << 8)) -#define MAP_ANCIENT_TOMB (68 | (24 << 8)) -#define MAP_UNDERWATER_ROUTE134 (69 | (24 << 8)) -#define MAP_UNDERWATER_SEALED_CHAMBER (70 | (24 << 8)) -#define MAP_SEALED_CHAMBER_OUTER_ROOM (71 | (24 << 8)) -#define MAP_SEALED_CHAMBER_INNER_ROOM (72 | (24 << 8)) -#define MAP_SCORCHED_SLAB (73 | (24 << 8)) -#define MAP_AQUA_HIDEOUT_UNUSED_RUBY_MAP1 (74 | (24 << 8)) -#define MAP_AQUA_HIDEOUT_UNUSED_RUBY_MAP2 (75 | (24 << 8)) -#define MAP_AQUA_HIDEOUT_UNUSED_RUBY_MAP3 (76 | (24 << 8)) -#define MAP_SKY_PILLAR_ENTRANCE (77 | (24 << 8)) -#define MAP_SKY_PILLAR_OUTSIDE (78 | (24 << 8)) -#define MAP_SKY_PILLAR_1F (79 | (24 << 8)) -#define MAP_SKY_PILLAR_2F (80 | (24 << 8)) -#define MAP_SKY_PILLAR_3F (81 | (24 << 8)) -#define MAP_SKY_PILLAR_4F (82 | (24 << 8)) -#define MAP_SHOAL_CAVE_LOW_TIDE_ICE_ROOM (83 | (24 << 8)) -#define MAP_SKY_PILLAR_5F (84 | (24 << 8)) -#define MAP_SKY_PILLAR_TOP (85 | (24 << 8)) -#define MAP_MAGMA_HIDEOUT_1F (86 | (24 << 8)) -#define MAP_MAGMA_HIDEOUT_2F_1R (87 | (24 << 8)) -#define MAP_MAGMA_HIDEOUT_2F_2R (88 | (24 << 8)) -#define MAP_MAGMA_HIDEOUT_3F_1R (89 | (24 << 8)) -#define MAP_MAGMA_HIDEOUT_3F_2R (90 | (24 << 8)) -#define MAP_MAGMA_HIDEOUT_4F (91 | (24 << 8)) -#define MAP_MAGMA_HIDEOUT_3F_3R (92 | (24 << 8)) -#define MAP_MAGMA_HIDEOUT_2F_3R (93 | (24 << 8)) -#define MAP_MIRAGE_TOWER_1F (94 | (24 << 8)) -#define MAP_MIRAGE_TOWER_2F (95 | (24 << 8)) -#define MAP_MIRAGE_TOWER_3F (96 | (24 << 8)) -#define MAP_MIRAGE_TOWER_4F (97 | (24 << 8)) -#define MAP_DESERT_UNDERPASS (98 | (24 << 8)) -#define MAP_ARTISAN_CAVE_B1F (99 | (24 << 8)) -#define MAP_ARTISAN_CAVE_1F (100 | (24 << 8)) -#define MAP_UNDERWATER_MARINE_CAVE (101 | (24 << 8)) -#define MAP_MARINE_CAVE_ENTRANCE (102 | (24 << 8)) -#define MAP_MARINE_CAVE_END (103 | (24 << 8)) -#define MAP_TERRA_CAVE_ENTRANCE (104 | (24 << 8)) -#define MAP_TERRA_CAVE_END (105 | (24 << 8)) -#define MAP_ALTERING_CAVE (106 | (24 << 8)) -#define MAP_METEOR_FALLS_STEVENS_CAVE (107 | (24 << 8)) - -// gMapGroup_IndoorDynamic -#define MAP_SECRET_BASE_RED_CAVE1 (0 | (25 << 8)) -#define MAP_SECRET_BASE_BROWN_CAVE1 (1 | (25 << 8)) -#define MAP_SECRET_BASE_BLUE_CAVE1 (2 | (25 << 8)) -#define MAP_SECRET_BASE_YELLOW_CAVE1 (3 | (25 << 8)) -#define MAP_SECRET_BASE_TREE1 (4 | (25 << 8)) -#define MAP_SECRET_BASE_SHRUB1 (5 | (25 << 8)) -#define MAP_SECRET_BASE_RED_CAVE2 (6 | (25 << 8)) -#define MAP_SECRET_BASE_BROWN_CAVE2 (7 | (25 << 8)) -#define MAP_SECRET_BASE_BLUE_CAVE2 (8 | (25 << 8)) -#define MAP_SECRET_BASE_YELLOW_CAVE2 (9 | (25 << 8)) -#define MAP_SECRET_BASE_TREE2 (10 | (25 << 8)) -#define MAP_SECRET_BASE_SHRUB2 (11 | (25 << 8)) -#define MAP_SECRET_BASE_RED_CAVE3 (12 | (25 << 8)) -#define MAP_SECRET_BASE_BROWN_CAVE3 (13 | (25 << 8)) -#define MAP_SECRET_BASE_BLUE_CAVE3 (14 | (25 << 8)) -#define MAP_SECRET_BASE_YELLOW_CAVE3 (15 | (25 << 8)) -#define MAP_SECRET_BASE_TREE3 (16 | (25 << 8)) -#define MAP_SECRET_BASE_SHRUB3 (17 | (25 << 8)) -#define MAP_SECRET_BASE_RED_CAVE4 (18 | (25 << 8)) -#define MAP_SECRET_BASE_BROWN_CAVE4 (19 | (25 << 8)) -#define MAP_SECRET_BASE_BLUE_CAVE4 (20 | (25 << 8)) -#define MAP_SECRET_BASE_YELLOW_CAVE4 (21 | (25 << 8)) -#define MAP_SECRET_BASE_TREE4 (22 | (25 << 8)) -#define MAP_SECRET_BASE_SHRUB4 (23 | (25 << 8)) -#define MAP_BATTLE_COLOSSEUM_2P (24 | (25 << 8)) -#define MAP_TRADE_CENTER (25 | (25 << 8)) -#define MAP_RECORD_CORNER (26 | (25 << 8)) -#define MAP_BATTLE_COLOSSEUM_4P (27 | (25 << 8)) -#define MAP_CONTEST_HALL (28 | (25 << 8)) -#define MAP_UNUSED_CONTEST_HALL1 (29 | (25 << 8)) -#define MAP_UNUSED_CONTEST_HALL2 (30 | (25 << 8)) -#define MAP_UNUSED_CONTEST_HALL3 (31 | (25 << 8)) -#define MAP_UNUSED_CONTEST_HALL4 (32 | (25 << 8)) -#define MAP_UNUSED_CONTEST_HALL5 (33 | (25 << 8)) -#define MAP_UNUSED_CONTEST_HALL6 (34 | (25 << 8)) -#define MAP_CONTEST_HALL_BEAUTY (35 | (25 << 8)) -#define MAP_CONTEST_HALL_TOUGH (36 | (25 << 8)) -#define MAP_CONTEST_HALL_COOL (37 | (25 << 8)) -#define MAP_CONTEST_HALL_SMART (38 | (25 << 8)) -#define MAP_CONTEST_HALL_CUTE (39 | (25 << 8)) -#define MAP_INSIDE_OF_TRUCK (40 | (25 << 8)) -#define MAP_SS_TIDAL_CORRIDOR (41 | (25 << 8)) -#define MAP_SS_TIDAL_LOWER_DECK (42 | (25 << 8)) -#define MAP_SS_TIDAL_ROOMS (43 | (25 << 8)) -#define MAP_BATTLE_PYRAMID_SQUARE01 (44 | (25 << 8)) -#define MAP_BATTLE_PYRAMID_SQUARE02 (45 | (25 << 8)) -#define MAP_BATTLE_PYRAMID_SQUARE03 (46 | (25 << 8)) -#define MAP_BATTLE_PYRAMID_SQUARE04 (47 | (25 << 8)) -#define MAP_BATTLE_PYRAMID_SQUARE05 (48 | (25 << 8)) -#define MAP_BATTLE_PYRAMID_SQUARE06 (49 | (25 << 8)) -#define MAP_BATTLE_PYRAMID_SQUARE07 (50 | (25 << 8)) -#define MAP_BATTLE_PYRAMID_SQUARE08 (51 | (25 << 8)) -#define MAP_BATTLE_PYRAMID_SQUARE09 (52 | (25 << 8)) -#define MAP_BATTLE_PYRAMID_SQUARE10 (53 | (25 << 8)) -#define MAP_BATTLE_PYRAMID_SQUARE11 (54 | (25 << 8)) -#define MAP_BATTLE_PYRAMID_SQUARE12 (55 | (25 << 8)) -#define MAP_BATTLE_PYRAMID_SQUARE13 (56 | (25 << 8)) -#define MAP_BATTLE_PYRAMID_SQUARE14 (57 | (25 << 8)) -#define MAP_BATTLE_PYRAMID_SQUARE15 (58 | (25 << 8)) -#define MAP_BATTLE_PYRAMID_SQUARE16 (59 | (25 << 8)) -#define MAP_UNION_ROOM (60 | (25 << 8)) - -// gMapGroup_SpecialArea -#define MAP_SAFARI_ZONE_NORTHWEST (0 | (26 << 8)) -#define MAP_SAFARI_ZONE_NORTH (1 | (26 << 8)) -#define MAP_SAFARI_ZONE_SOUTHWEST (2 | (26 << 8)) -#define MAP_SAFARI_ZONE_SOUTH (3 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_OUTSIDE_WEST (4 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_BATTLE_TOWER_LOBBY (5 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_BATTLE_TOWER_ELEVATOR (6 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_BATTLE_TOWER_CORRIDOR (7 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_BATTLE_TOWER_BATTLE_ROOM (8 | (26 << 8)) -#define MAP_SOUTHERN_ISLAND_EXTERIOR (9 | (26 << 8)) -#define MAP_SOUTHERN_ISLAND_INTERIOR (10 | (26 << 8)) -#define MAP_SAFARI_ZONE_REST_HOUSE (11 | (26 << 8)) -#define MAP_SAFARI_ZONE_NORTHEAST (12 | (26 << 8)) -#define MAP_SAFARI_ZONE_SOUTHEAST (13 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_OUTSIDE_EAST (14 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_BATTLE_TOWER_MULTI_PARTNER_ROOM (15 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_BATTLE_TOWER_MULTI_CORRIDOR (16 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_BATTLE_TOWER_MULTI_BATTLE_ROOM (17 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_BATTLE_DOME_LOBBY (18 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_BATTLE_DOME_CORRIDOR (19 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_BATTLE_DOME_PRE_BATTLE_ROOM (20 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_BATTLE_DOME_BATTLE_ROOM (21 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_BATTLE_PALACE_LOBBY (22 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_BATTLE_PALACE_CORRIDOR (23 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_BATTLE_PALACE_BATTLE_ROOM (24 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_BATTLE_PYRAMID_LOBBY (25 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_BATTLE_PYRAMID_FLOOR (26 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_BATTLE_PYRAMID_TOP (27 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_BATTLE_ARENA_LOBBY (28 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_BATTLE_ARENA_CORRIDOR (29 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_BATTLE_ARENA_BATTLE_ROOM (30 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_BATTLE_FACTORY_LOBBY (31 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_BATTLE_FACTORY_PRE_BATTLE_ROOM (32 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_BATTLE_FACTORY_BATTLE_ROOM (33 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_BATTLE_PIKE_LOBBY (34 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_BATTLE_PIKE_CORRIDOR (35 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_BATTLE_PIKE_THREE_PATH_ROOM (36 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_BATTLE_PIKE_ROOM_NORMAL (37 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_BATTLE_PIKE_ROOM_FINAL (38 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_BATTLE_PIKE_ROOM_WILD_MONS (39 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_RANKING_HALL (40 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_LOUNGE1 (41 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_EXCHANGE_SERVICE_CORNER (42 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_LOUNGE2 (43 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_LOUNGE3 (44 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_LOUNGE4 (45 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_SCOTTS_HOUSE (46 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_LOUNGE5 (47 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_LOUNGE6 (48 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_LOUNGE7 (49 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_RECEPTION_GATE (50 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_LOUNGE8 (51 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_LOUNGE9 (52 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_POKEMON_CENTER_1F (53 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_POKEMON_CENTER_2F (54 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_MART (55 | (26 << 8)) -#define MAP_FARAWAY_ISLAND_ENTRANCE (56 | (26 << 8)) -#define MAP_FARAWAY_ISLAND_INTERIOR (57 | (26 << 8)) -#define MAP_BIRTH_ISLAND_EXTERIOR (58 | (26 << 8)) -#define MAP_BIRTH_ISLAND_HARBOR (59 | (26 << 8)) -#define MAP_TRAINER_HILL_ENTRANCE (60 | (26 << 8)) -#define MAP_TRAINER_HILL_1F (61 | (26 << 8)) -#define MAP_TRAINER_HILL_2F (62 | (26 << 8)) -#define MAP_TRAINER_HILL_3F (63 | (26 << 8)) -#define MAP_TRAINER_HILL_4F (64 | (26 << 8)) -#define MAP_TRAINER_HILL_ROOF (65 | (26 << 8)) -#define MAP_NAVEL_ROCK_EXTERIOR (66 | (26 << 8)) -#define MAP_NAVEL_ROCK_HARBOR (67 | (26 << 8)) -#define MAP_NAVEL_ROCK_ENTRANCE (68 | (26 << 8)) -#define MAP_NAVEL_ROCK_B1F (69 | (26 << 8)) -#define MAP_NAVEL_ROCK_FORK (70 | (26 << 8)) -#define MAP_NAVEL_ROCK_UP1 (71 | (26 << 8)) -#define MAP_NAVEL_ROCK_UP2 (72 | (26 << 8)) -#define MAP_NAVEL_ROCK_UP3 (73 | (26 << 8)) -#define MAP_NAVEL_ROCK_UP4 (74 | (26 << 8)) -#define MAP_NAVEL_ROCK_TOP (75 | (26 << 8)) -#define MAP_NAVEL_ROCK_DOWN01 (76 | (26 << 8)) -#define MAP_NAVEL_ROCK_DOWN02 (77 | (26 << 8)) -#define MAP_NAVEL_ROCK_DOWN03 (78 | (26 << 8)) -#define MAP_NAVEL_ROCK_DOWN04 (79 | (26 << 8)) -#define MAP_NAVEL_ROCK_DOWN05 (80 | (26 << 8)) -#define MAP_NAVEL_ROCK_DOWN06 (81 | (26 << 8)) -#define MAP_NAVEL_ROCK_DOWN07 (82 | (26 << 8)) -#define MAP_NAVEL_ROCK_DOWN08 (83 | (26 << 8)) -#define MAP_NAVEL_ROCK_DOWN09 (84 | (26 << 8)) -#define MAP_NAVEL_ROCK_DOWN10 (85 | (26 << 8)) -#define MAP_NAVEL_ROCK_DOWN11 (86 | (26 << 8)) -#define MAP_NAVEL_ROCK_BOTTOM (87 | (26 << 8)) -#define MAP_TRAINER_HILL_ELEVATOR (88 | (26 << 8)) - -// gMapGroup_IndoorRoute104Prototype -#define MAP_ROUTE104_PROTOTYPE (0 | (27 << 8)) -#define MAP_ROUTE104_PROTOTYPE_PRETTY_PETAL_FLOWER_SHOP (1 | (27 << 8)) - -// gMapGroup_IndoorRoute109 -#define MAP_ROUTE109_SEASHORE_HOUSE (0 | (28 << 8)) - -// gMapGroup_IndoorRoute110 -#define MAP_ROUTE110_TRICK_HOUSE_ENTRANCE (0 | (29 << 8)) -#define MAP_ROUTE110_TRICK_HOUSE_END (1 | (29 << 8)) -#define MAP_ROUTE110_TRICK_HOUSE_CORRIDOR (2 | (29 << 8)) -#define MAP_ROUTE110_TRICK_HOUSE_PUZZLE1 (3 | (29 << 8)) -#define MAP_ROUTE110_TRICK_HOUSE_PUZZLE2 (4 | (29 << 8)) -#define MAP_ROUTE110_TRICK_HOUSE_PUZZLE3 (5 | (29 << 8)) -#define MAP_ROUTE110_TRICK_HOUSE_PUZZLE4 (6 | (29 << 8)) -#define MAP_ROUTE110_TRICK_HOUSE_PUZZLE5 (7 | (29 << 8)) -#define MAP_ROUTE110_TRICK_HOUSE_PUZZLE6 (8 | (29 << 8)) -#define MAP_ROUTE110_TRICK_HOUSE_PUZZLE7 (9 | (29 << 8)) -#define MAP_ROUTE110_TRICK_HOUSE_PUZZLE8 (10 | (29 << 8)) -#define MAP_ROUTE110_SEASIDE_CYCLING_ROAD_NORTH_ENTRANCE (11 | (29 << 8)) -#define MAP_ROUTE110_SEASIDE_CYCLING_ROAD_SOUTH_ENTRANCE (12 | (29 << 8)) - -// gMapGroup_IndoorRoute113 -#define MAP_ROUTE113_GLASS_WORKSHOP (0 | (30 << 8)) - -// gMapGroup_IndoorRoute123 -#define MAP_ROUTE123_BERRY_MASTERS_HOUSE (0 | (31 << 8)) - -// gMapGroup_IndoorRoute119 -#define MAP_ROUTE119_WEATHER_INSTITUTE_1F (0 | (32 << 8)) -#define MAP_ROUTE119_WEATHER_INSTITUTE_2F (1 | (32 << 8)) -#define MAP_ROUTE119_HOUSE (2 | (32 << 8)) - -// gMapGroup_IndoorRoute124 -#define MAP_ROUTE124_DIVING_TREASURE_HUNTERS_HOUSE (0 | (33 << 8)) - -#define MAP_GROUPS_COUNT 34 - -#endif // GUARD_CONSTANTS_MAP_GROUPS_H diff --git a/include/constants/rematches.h b/include/constants/rematches.h new file mode 100644 index 000000000000..2ddefcc578a8 --- /dev/null +++ b/include/constants/rematches.h @@ -0,0 +1,89 @@ +#ifndef GUARD_REMATCHES_H +#define GUARD_REMATCHES_H + +enum { + REMATCH_ROSE, + REMATCH_ANDRES, + REMATCH_DUSTY, + REMATCH_LOLA, + REMATCH_RICKY, + REMATCH_LILA_AND_ROY, + REMATCH_CRISTIN, + REMATCH_BROOKE, + REMATCH_WILTON, + REMATCH_VALERIE, + REMATCH_CINDY, + REMATCH_THALIA, + REMATCH_JESSICA, + REMATCH_WINSTON, + REMATCH_STEVE, + REMATCH_TONY, + REMATCH_NOB, + REMATCH_KOJI, + REMATCH_FERNANDO, + REMATCH_DALTON, + REMATCH_BERNIE, + REMATCH_ETHAN, + REMATCH_JOHN_AND_JAY, + REMATCH_JEFFREY, + REMATCH_CAMERON, + REMATCH_JACKI, + REMATCH_WALTER, + REMATCH_KAREN, + REMATCH_JERRY, + REMATCH_ANNA_AND_MEG, + REMATCH_ISABEL, + REMATCH_MIGUEL, + REMATCH_TIMOTHY, + REMATCH_SHELBY, + REMATCH_CALVIN, + REMATCH_ELLIOT, + REMATCH_ISAIAH, + REMATCH_MARIA, + REMATCH_ABIGAIL, + REMATCH_DYLAN, + REMATCH_KATELYN, + REMATCH_BENJAMIN, + REMATCH_PABLO, + REMATCH_NICOLAS, + REMATCH_ROBERT, + REMATCH_LAO, + REMATCH_CYNDY, + REMATCH_MADELINE, + REMATCH_JENNY, + REMATCH_DIANA, + REMATCH_AMY_AND_LIV, + REMATCH_ERNEST, + REMATCH_CORY, + REMATCH_EDWIN, + REMATCH_LYDIA, + REMATCH_ISAAC, + REMATCH_GABRIELLE, + REMATCH_CATHERINE, + REMATCH_JACKSON, + REMATCH_HALEY, + REMATCH_JAMES, + REMATCH_TRENT, + REMATCH_SAWYER, + REMATCH_KIRA_AND_DAN, + REMATCH_WALLY_VR, // Entries above WALLY are considered normal trainers, from Wally below are special trainers + REMATCH_ROXANNE, + REMATCH_BRAWLY, + REMATCH_WATTSON, + REMATCH_FLANNERY, + REMATCH_NORMAN, + REMATCH_WINONA, + REMATCH_TATE_AND_LIZA, + REMATCH_JUAN, + REMATCH_SIDNEY, // Entries from SIDNEY below are considered part of REMATCH_ELITE_FOUR_ENTRIES. + REMATCH_PHOEBE, + REMATCH_GLACIA, + REMATCH_DRAKE, + REMATCH_WALLACE, + REMATCH_TABLE_ENTRIES // The total number of rematch entries. Must be last in enum +}; + +#define REMATCH_SPECIAL_TRAINER_START REMATCH_WALLY_VR +#define REMATCH_ELITE_FOUR_ENTRIES REMATCH_SIDNEY + +#endif // GUARD_REMATCHES_H diff --git a/include/data.h b/include/data.h index 69c1a19a3c49..d635bb6af7a3 100644 --- a/include/data.h +++ b/include/data.h @@ -45,9 +45,9 @@ struct TrainerBacksprite const union AnimCmd *const *const animation; }; -#define MON_COORDS_SIZE(width, height)(DIV_ROUND_UP(width, 8) << 4 | DIV_ROUND_UP(height, 8)) -#define GET_MON_COORDS_WIDTH(size)((size >> 4) * 8) -#define GET_MON_COORDS_HEIGHT(size)((size & 0xF) * 8) +#define MON_COORDS_SIZE(width, height) (DIV_ROUND_UP(width, 8) << 4 | DIV_ROUND_UP(height, 8)) +#define GET_MON_COORDS_WIDTH(size) ((size >> 4) * 8) +#define GET_MON_COORDS_HEIGHT(size) ((size & 0xF) * 8) #define TRAINER_PARTY_IVS(hp, atk, def, speed, spatk, spdef) (hp | (atk << 5) | (def << 10) | (speed << 15) | (spatk << 20) | (spdef << 25)) #define TRAINER_PARTY_EVS(hp, atk, def, speed, spatk, spdef) ((const u8[6]){hp,atk,def,spatk,spdef,speed}) diff --git a/gflib/dma3.h b/include/dma3.h similarity index 100% rename from gflib/dma3.h rename to include/dma3.h diff --git a/include/gba/defines.h b/include/gba/defines.h index 63663558752e..c54dac8c1388 100644 --- a/include/gba/defines.h +++ b/include/gba/defines.h @@ -10,6 +10,7 @@ #define EWRAM_DATA __attribute__((section(".sbss"))) #define IWRAM_INIT __attribute__((section(".iwram"))) #define EWRAM_INIT __attribute__((section(".ewram"))) +#define COMMON_DATA __attribute__((section("common_data"))) #define UNUSED __attribute__((unused)) #if MODERN @@ -81,7 +82,7 @@ #define DISPLAY_TILE_HEIGHT (DISPLAY_HEIGHT / TILE_HEIGHT) // Size of different tile formats in bytes -#define TILE_SIZE(bpp)((bpp) * TILE_WIDTH * TILE_HEIGHT / 8) +#define TILE_SIZE(bpp) ((bpp) * TILE_WIDTH * TILE_HEIGHT / 8) #define TILE_SIZE_1BPP TILE_SIZE(1) // 8 #define TILE_SIZE_4BPP TILE_SIZE(4) // 32 #define TILE_SIZE_8BPP TILE_SIZE(8) // 64 diff --git a/include/global.h b/include/global.h index f5ada78360d8..659546886acc 100644 --- a/include/global.h +++ b/include/global.h @@ -76,7 +76,7 @@ // There are cases where GF does a&(n-1) where we would really like to have a%n, because // if n is changed to a value that isn't a power of 2 then a&(n-1) is unlikely to work as // intended, and a%n for powers of 2 isn't always optimized to use &. -#define MOD(a, n)(((n) & ((n)-1)) ? ((a) % (n)) : ((a) & ((n)-1))) +#define MOD(a, n) (((n) & ((n)-1)) ? ((a) % (n)) : ((a) & ((n)-1))) // Extracts the upper 16 bits of a 32-bit number #define HIHALF(n) (((n) & 0xFFFF0000) >> 16) @@ -117,7 +117,7 @@ f; \ }) -#define DIV_ROUND_UP(val, roundBy)(((val) / (roundBy)) + (((val) % (roundBy)) ? 1 : 0)) +#define DIV_ROUND_UP(val, roundBy) (((val) / (roundBy)) + (((val) % (roundBy)) ? 1 : 0)) #define ROUND_BITS_TO_BYTES(numBits) DIV_ROUND_UP(numBits, 8) diff --git a/gflib/gpu_regs.h b/include/gpu_regs.h similarity index 100% rename from gflib/gpu_regs.h rename to include/gpu_regs.h diff --git a/include/gym_leader_rematch.h b/include/gym_leader_rematch.h index b31fb5e22863..622d2db1bc2c 100644 --- a/include/gym_leader_rematch.h +++ b/include/gym_leader_rematch.h @@ -1,90 +1,7 @@ #ifndef GUARD_TRAINER_REMATCH_H #define GUARD_TRAINER_REMATCH_H -enum { - REMATCH_ROSE, - REMATCH_ANDRES, - REMATCH_DUSTY, - REMATCH_LOLA, - REMATCH_RICKY, - REMATCH_LILA_AND_ROY, - REMATCH_CRISTIN, - REMATCH_BROOKE, - REMATCH_WILTON, - REMATCH_VALERIE, - REMATCH_CINDY, - REMATCH_THALIA, - REMATCH_JESSICA, - REMATCH_WINSTON, - REMATCH_STEVE, - REMATCH_TONY, - REMATCH_NOB, - REMATCH_KOJI, - REMATCH_FERNANDO, - REMATCH_DALTON, - REMATCH_BERNIE, - REMATCH_ETHAN, - REMATCH_JOHN_AND_JAY, - REMATCH_JEFFREY, - REMATCH_CAMERON, - REMATCH_JACKI, - REMATCH_WALTER, - REMATCH_KAREN, - REMATCH_JERRY, - REMATCH_ANNA_AND_MEG, - REMATCH_ISABEL, - REMATCH_MIGUEL, - REMATCH_TIMOTHY, - REMATCH_SHELBY, - REMATCH_CALVIN, - REMATCH_ELLIOT, - REMATCH_ISAIAH, - REMATCH_MARIA, - REMATCH_ABIGAIL, - REMATCH_DYLAN, - REMATCH_KATELYN, - REMATCH_BENJAMIN, - REMATCH_PABLO, - REMATCH_NICOLAS, - REMATCH_ROBERT, - REMATCH_LAO, - REMATCH_CYNDY, - REMATCH_MADELINE, - REMATCH_JENNY, - REMATCH_DIANA, - REMATCH_AMY_AND_LIV, - REMATCH_ERNEST, - REMATCH_CORY, - REMATCH_EDWIN, - REMATCH_LYDIA, - REMATCH_ISAAC, - REMATCH_GABRIELLE, - REMATCH_CATHERINE, - REMATCH_JACKSON, - REMATCH_HALEY, - REMATCH_JAMES, - REMATCH_TRENT, - REMATCH_SAWYER, - REMATCH_KIRA_AND_DAN, - REMATCH_WALLY_VR, // Entries above WALLY are considered normal trainers, from Wally below are special trainers - REMATCH_ROXANNE, - REMATCH_BRAWLY, - REMATCH_WATTSON, - REMATCH_FLANNERY, - REMATCH_NORMAN, - REMATCH_WINONA, - REMATCH_TATE_AND_LIZA, - REMATCH_JUAN, - REMATCH_SIDNEY, // Entries from SIDNEY below are considered part of REMATCH_ELITE_FOUR_ENTRIES. - REMATCH_PHOEBE, - REMATCH_GLACIA, - REMATCH_DRAKE, - REMATCH_WALLACE, - REMATCH_TABLE_ENTRIES // The total number of rematch entries. Must be last in enum -}; - -#define REMATCH_SPECIAL_TRAINER_START REMATCH_WALLY_VR -#define REMATCH_ELITE_FOUR_ENTRIES REMATCH_SIDNEY +#include "constants/rematches.h" void UpdateGymLeaderRematch(void); diff --git a/gflib/io_reg.h b/include/io_reg.h similarity index 100% rename from gflib/io_reg.h rename to include/io_reg.h diff --git a/include/mail.h b/include/mail.h index f4590a70ec44..403078f0975f 100644 --- a/include/mail.h +++ b/include/mail.h @@ -1,7 +1,7 @@ #ifndef GUARD_MAIL_H #define GUARD_MAIL_H -#define IS_ITEM_MAIL(itemId)((itemId == ITEM_ORANGE_MAIL \ +#define IS_ITEM_MAIL(itemId) ((itemId == ITEM_ORANGE_MAIL \ || itemId == ITEM_HARBOR_MAIL \ || itemId == ITEM_GLITTER_MAIL \ || itemId == ITEM_MECH_MAIL \ diff --git a/gflib/malloc.h b/include/malloc.h similarity index 100% rename from gflib/malloc.h rename to include/malloc.h diff --git a/include/menu_specialized.h b/include/menu_specialized.h index 06a188b8a06f..152afb59ac9e 100644 --- a/include/menu_specialized.h +++ b/include/menu_specialized.h @@ -44,7 +44,7 @@ enum { // The number of extra sparkles shown on a Pokémon's condition screen. // All Pokémon start with 1, so the max here is MAX_CONDITION_SPARKLES - 1 -#define GET_NUM_CONDITION_SPARKLES(sheen)((sheen) != MAX_SHEEN) ? (sheen) / ((u32)MAX_SHEEN / (MAX_CONDITION_SPARKLES - 1) + 1) : MAX_CONDITION_SPARKLES - 1; +#define GET_NUM_CONDITION_SPARKLES(sheen) ((sheen) != MAX_SHEEN) ? (sheen) / ((u32)MAX_SHEEN / (MAX_CONDITION_SPARKLES - 1) + 1) : MAX_CONDITION_SPARKLES - 1; #define CONDITION_GRAPH_TOP_Y 56 #define CONDITION_GRAPH_BOTTOM_Y 121 diff --git a/include/random.h b/include/random.h index b2eddce27dc1..6d3d1adb2d9b 100644 --- a/include/random.h +++ b/include/random.h @@ -3,8 +3,8 @@ // The number 1103515245 comes from the example implementation of rand and srand // in the ISO C standard. -#define ISO_RANDOMIZE1(val)(1103515245 * (val) + 24691) -#define ISO_RANDOMIZE2(val)(1103515245 * (val) + 12345) +#define ISO_RANDOMIZE1(val) (1103515245 * (val) + 24691) +#define ISO_RANDOMIZE2(val) (1103515245 * (val) + 12345) /* Some functions have been added to support HQ_RANDOM. * diff --git a/include/secret_base.h b/include/secret_base.h index cb3b95ee780e..567316cf9cb8 100644 --- a/include/secret_base.h +++ b/include/secret_base.h @@ -24,7 +24,6 @@ void SetCurSecretBaseIdFromPosition(const struct MapPosition *position, const st void TrySetCurSecretBaseIndex(void); void CheckPlayerHasSecretBase(void); void ToggleSecretBaseEntranceMetatile(void); -void ScriptContext_Enable(void); void ReceiveSecretBasesData(void *records, size_t recordSize, u8 linkIdx); #endif //GUARD_SECRET_BASE_H diff --git a/gflib/sprite.h b/include/sprite.h similarity index 100% rename from gflib/sprite.h rename to include/sprite.h diff --git a/gflib/string_util.h b/include/string_util.h similarity index 100% rename from gflib/string_util.h rename to include/string_util.h diff --git a/gflib/text.h b/include/text.h similarity index 99% rename from gflib/text.h rename to include/text.h index fc457e5a00f0..7be070252831 100644 --- a/gflib/text.h +++ b/include/text.h @@ -1,7 +1,7 @@ #ifndef GUARD_TEXT_H #define GUARD_TEXT_H -#include "characters.h" +#include "constants/characters.h" // Given as a text speed when all the text should be // loaded at once but not copied to vram yet. diff --git a/gflib/window.h b/include/window.h similarity index 100% rename from gflib/window.h rename to include/window.h diff --git a/ld_script.ld b/ld_script.ld index 6c8467a002b1..4e7a368fc38b 100644 --- a/ld_script.ld +++ b/ld_script.ld @@ -27,7 +27,6 @@ SECTIONS { { INCLUDE "sym_ewram.ld" src/*.o(.sbss); - gflib/*.o(.sbss); *libc.a:impure.o(.data); *libc.a:locale.o(.data); @@ -49,7 +48,6 @@ SECTIONS { /* .bss starts at 0x3000000 */ INCLUDE "sym_bss.ld" src/*.o(.bss); - gflib/*.o(.bss); data/*.o(.bss); /* .bss.code starts at 0x3001AA8 */ @@ -57,6 +55,7 @@ SECTIONS { /* COMMON starts at 0x30022A8 */ INCLUDE "sym_common.ld" + src/*.o(COMMON); *libc.a:sbrkr.o(COMMON); } > IWRAM @@ -71,15 +70,15 @@ SECTIONS { src/rom_header_rhh.o(.text.*); src/crt0.o(.text); src/main.o(.text); - gflib/malloc.o(.text); - gflib/dma3_manager.o(.text); - gflib/gpu_regs.o(.text); - gflib/bg.o(.text); - gflib/blit.o(.text); - gflib/window.o(.text); - gflib/text.o(.text); - gflib/sprite.o(.text); - gflib/string_util.o(.text); + src/malloc.o(.text); + src/dma3_manager.o(.text); + src/gpu_regs.o(.text); + src/bg.o(.text); + src/blit.o(.text); + src/window.o(.text); + src/text.o(.text); + src/sprite.o(.text); + src/string_util.o(.text); src/link.o(.text); src/AgbRfu_LinkManager.o(.text); src/link_rfu_3.o(.text); @@ -466,12 +465,12 @@ SECTIONS { src/rom_header.o(.rodata); src/rom_header_gf.o(.rodata); src/main.o(.rodata); - gflib/bg.o(.rodata); - gflib/window.o(.rodata); - gflib/text.o(.rodata); - gflib/sprite.o(.rodata); - gflib/io_reg.o(.rodata); - gflib/string_util.o(.rodata); + src/bg.o(.rodata); + src/window.o(.rodata); + src/text.o(.rodata); + src/sprite.o(.rodata); + src/io_reg.o(.rodata); + src/string_util.o(.rodata); src/link.o(.rodata); src/link.o(.rodata.str1.4); src/AgbRfu_LinkManager.o(.rodata); @@ -1338,9 +1337,7 @@ SECTIONS { ALIGN(4) { src/*.o(.text); - gflib/*.o(.text); src/*.o(.rodata); - gflib/*.o(.rodata); data/*.o(.rodata); } > ROM = 0 diff --git a/ld_script_modern.ld b/ld_script_modern.ld index 11e53db63df9..ee4713ab177e 100644 --- a/ld_script_modern.ld +++ b/ld_script_modern.ld @@ -27,7 +27,6 @@ SECTIONS { ALIGN(4) { src/*.o(.sbss); - gflib/*.o(.sbss); } > EWRAM .iwram ORIGIN(IWRAM) : AT (__iwram_lma) @@ -43,15 +42,14 @@ SECTIONS { ALIGN(4) { src/*.o(.bss); - gflib/*.o(.bss); data/*.o(.bss); *libc.a:*.o(.bss*); *libnosys.a:*.o(.bss*); src/m4a.o(.bss.code); + src/*.o(common_data); src/*.o(COMMON); - gflib/*.o(COMMON); *libc.a:*.o(COMMON); *libnosys.a:*.o(COMMON); } > IWRAM @@ -66,7 +64,6 @@ SECTIONS { src/rom_header_rhh.o(.text.*); src/crt0.o(.text); src/main.o(.text); - gflib/*.o(.text*); src/*.o(.text*); asm/*.o(.text*); } > ROM =0 @@ -102,7 +99,6 @@ SECTIONS { ALIGN(4) { src/*.o(.rodata*); - gflib/*.o(.rodata*); data/*.o(.rodata*); } > ROM =0 diff --git a/ld_script_test.ld b/ld_script_test.ld index a9a2434c5714..8972a97b008d 100644 --- a/ld_script_test.ld +++ b/ld_script_test.ld @@ -25,7 +25,6 @@ SECTIONS { ALIGN(4) { src/*.o(.sbss); - gflib/*.o(.sbss); test/*.o(.sbss); . = ALIGN(4); } > EWRAM @@ -43,7 +42,6 @@ SECTIONS { ALIGN(4) { src/*.o(.bss); - gflib/*.o(.bss); data/*.o(.bss); test/*.o(.bss); *libc.a:*.o(.bss*); @@ -52,8 +50,8 @@ SECTIONS { src/m4a.o(.bss.code); + src/*.o(common_data); src/*.o(COMMON); - gflib/*.o(COMMON); data/*.o(COMMON); test/*.o(COMMON); *libc.a:sbrkr.o(COMMON); @@ -76,7 +74,6 @@ SECTIONS { src/rom_header_gf.o(.text.*); src/rom_header_rhh.o(.text.*); src/*.o(.text); - gflib/*.o(.text); } > ROM =0 script_data : @@ -98,7 +95,6 @@ SECTIONS { ALIGN(4) { src/*.o(.rodata*); - gflib/*.o(.rodata*); data/*.o(.rodata*); } > ROM =0 diff --git a/make_tools.mk b/make_tools.mk index c2c5a800cf0b..75ebc05c9625 100644 --- a/make_tools.mk +++ b/make_tools.mk @@ -1,11 +1,32 @@ +# This controls building executables in the `tools` folder. +# Can be invoked through the `Makefile` or standalone. + MAKEFLAGS += --no-print-directory # Inclusive list. If you don't want a tool to be built, don't add it here. -TOOLDIRS := tools/aif2pcm tools/bin2c tools/gbafix tools/gbagfx tools/jsonproc tools/mapjson tools/mid2agb tools/preproc tools/ramscrgen tools/rsfont tools/scaninc +TOOLS_DIR := tools +TOOL_NAMES := aif2pcm bin2c gbafix gbagfx jsonproc mapjson mid2agb preproc ramscrgen rsfont scaninc trainerproc +CHECK_TOOL_NAMES = patchelf mgba-rom-test-hydra + +TOOLDIRS := $(TOOL_NAMES:%=$(TOOLS_DIR)/%) +CHECKTOOLDIRS := $(CHECK_TOOL_NAMES:%=$(TOOLS_DIR)/%) -.PHONY: all $(TOOLDIRS) +# Tool making doesnt require a pokeemerald dependency scan. +RULES_NO_SCAN += tools check-tools clean-tools clean-check-tools $(TOOLDIRS) $(CHECKTOOLDIRS) +.PHONY: $(RULES_NO_SCAN) -all: $(TOOLDIRS) +tools: $(TOOLDIRS) + +check-tools: $(CHECKTOOLDIRS) $(TOOLDIRS): @$(MAKE) -C $@ + +$(CHECKTOOLDIRS): + @$(MAKE) -C $@ + +clean-tools: + @$(foreach tooldir,$(TOOLDIRS),$(MAKE) clean -C $(tooldir);) + +clean-check-tools: + @$(foreach tooldir,$(CHECKTOOLDIRS),$(MAKE) clean -C $(tooldir);) diff --git a/map_data_rules.mk b/map_data_rules.mk index a045d1d42061..ecad6d3bd30e 100755 --- a/map_data_rules.mk +++ b/map_data_rules.mk @@ -1,32 +1,34 @@ # Map JSON data +# Inputs MAPS_DIR = $(DATA_ASM_SUBDIR)/maps LAYOUTS_DIR = $(DATA_ASM_SUBDIR)/layouts +# Outputs +MAPS_OUTDIR := $(MAPS_DIR) +LAYOUTS_OUTDIR := $(LAYOUTS_DIR) +INCLUDECONSTS_OUTDIR := include/constants + +AUTO_GEN_TARGETS += $(INCLUDECONSTS_OUTDIR)/map_groups.h +AUTO_GEN_TARGETS += $(INCLUDECONSTS_OUTDIR)/layouts.h + MAP_DIRS := $(dir $(wildcard $(MAPS_DIR)/*/map.json)) MAP_CONNECTIONS := $(patsubst $(MAPS_DIR)/%/,$(MAPS_DIR)/%/connections.inc,$(MAP_DIRS)) MAP_EVENTS := $(patsubst $(MAPS_DIR)/%/,$(MAPS_DIR)/%/events.inc,$(MAP_DIRS)) MAP_HEADERS := $(patsubst $(MAPS_DIR)/%/,$(MAPS_DIR)/%/header.inc,$(MAP_DIRS)) $(DATA_ASM_BUILDDIR)/maps.o: $(DATA_ASM_SUBDIR)/maps.s $(LAYOUTS_DIR)/layouts.inc $(LAYOUTS_DIR)/layouts_table.inc $(MAPS_DIR)/headers.inc $(MAPS_DIR)/groups.inc $(MAPS_DIR)/connections.inc $(MAP_CONNECTIONS) $(MAP_HEADERS) - $(PREPROC) $< charmap.txt | $(CPP) -I include - | $(AS) $(ASFLAGS) -o $@ + $(PREPROC) $< charmap.txt | $(CPP) -I include - | $(PREPROC) -ie $< charmap.txt | $(AS) $(ASFLAGS) -o $@ $(DATA_ASM_BUILDDIR)/map_events.o: $(DATA_ASM_SUBDIR)/map_events.s $(MAPS_DIR)/events.inc $(MAP_EVENTS) - $(PREPROC) $< charmap.txt | $(CPP) -I include - | $(AS) $(ASFLAGS) -o $@ - -$(MAPS_DIR)/%/header.inc: $(MAPS_DIR)/%/map.json - $(MAPJSON) map emerald $< $(LAYOUTS_DIR)/layouts.json -$(MAPS_DIR)/%/events.inc: $(MAPS_DIR)/%/header.inc ; -$(MAPS_DIR)/%/connections.inc: $(MAPS_DIR)/%/events.inc ; - -$(MAPS_DIR)/groups.inc: $(MAPS_DIR)/map_groups.json - $(MAPJSON) groups emerald $< -$(MAPS_DIR)/connections.inc: $(MAPS_DIR)/groups.inc ; -$(MAPS_DIR)/events.inc: $(MAPS_DIR)/connections.inc ; -$(MAPS_DIR)/headers.inc: $(MAPS_DIR)/events.inc ; + $(PREPROC) $< charmap.txt | $(CPP) -I include - | $(PREPROC) -ie $< charmap.txt | $(AS) $(ASFLAGS) -o $@ + $(DATA_SRC_SUBDIR)/map_group_count.h: $(MAPS_DIR)/headers.inc ; -include/constants/map_groups.h: $(MAPS_DIR)/headers.inc ; -$(LAYOUTS_DIR)/layouts.inc: $(LAYOUTS_DIR)/layouts.json - $(MAPJSON) layouts emerald $< -$(LAYOUTS_DIR)/layouts_table.inc: $(LAYOUTS_DIR)/layouts.inc ; -include/constants/layouts.h: $(LAYOUTS_DIR)/layouts_table.inc ; +$(MAPS_OUTDIR)/%/header.inc $(MAPS_OUTDIR)/%/events.inc $(MAPS_OUTDIR)/%/connections.inc: $(MAPS_DIR)/%/map.json + $(MAPJSON) map emerald $< $(LAYOUTS_DIR)/layouts.json $(@D) + +$(MAPS_OUTDIR)/connections.inc $(MAPS_OUTDIR)/groups.inc $(MAPS_OUTDIR)/events.inc $(MAPS_OUTDIR)/headers.inc $(INCLUDECONSTS_OUTDIR)/map_groups.h: $(MAPS_DIR)/map_groups.json + $(MAPJSON) groups emerald $< $(MAPS_OUTDIR) $(INCLUDECONSTS_OUTDIR) + +$(LAYOUTS_OUTDIR)/layouts.inc $(LAYOUTS_OUTDIR)/layouts_table.inc $(INCLUDECONSTS_OUTDIR)/layouts.h: $(LAYOUTS_DIR)/layouts.json + $(MAPJSON) layouts emerald $< $(LAYOUTS_OUTDIR) $(INCLUDECONSTS_OUTDIR) diff --git a/songs.mk b/songs.mk deleted file mode 100644 index 698f983cebcb..000000000000 --- a/songs.mk +++ /dev/null @@ -1,1264 +0,0 @@ -STD_REVERB = 50 - -$(MID_BUILDDIR)/%.o: $(MID_SUBDIR)/%.s - $(AS) $(ASFLAGS) -I sound -o $@ $< - -$(MID_SUBDIR)/mus_aqua_magma_hideout.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G076 -V084 - -$(MID_SUBDIR)/mus_encounter_aqua.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G065 -V086 - -$(MID_SUBDIR)/mus_route111.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G055 -V076 - -$(MID_SUBDIR)/mus_encounter_suspicious.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G069 -V078 - -$(MID_SUBDIR)/mus_b_arena.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G104 -V090 - -$(MID_SUBDIR)/mus_b_dome.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G111 -V090 - -$(MID_SUBDIR)/mus_b_dome_lobby.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G111 -V056 - -$(MID_SUBDIR)/mus_b_factory.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G113 -V100 - -$(MID_SUBDIR)/mus_b_frontier.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G103 -V094 - -$(MID_SUBDIR)/mus_b_palace.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G108 -V105 - -$(MID_SUBDIR)/mus_b_tower_rs.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G035 -V080 - -$(MID_SUBDIR)/mus_b_pike.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G112 -V092 - -$(MID_SUBDIR)/mus_vs_trainer.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G119 -V080 -P1 - -$(MID_SUBDIR)/mus_vs_wild.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G117 -V080 -P1 - -$(MID_SUBDIR)/mus_vs_aqua_magma_leader.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G126 -V080 -P1 - -$(MID_SUBDIR)/mus_vs_aqua_magma.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G118 -V080 -P1 - -$(MID_SUBDIR)/mus_vs_gym_leader.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G120 -V080 -P1 - -$(MID_SUBDIR)/mus_vs_champion.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G121 -V080 -P1 - -$(MID_SUBDIR)/mus_vs_kyogre_groudon.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G123 -V080 -P1 - -$(MID_SUBDIR)/mus_vs_rival.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G124 -V080 -P1 - -$(MID_SUBDIR)/mus_vs_regi.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G122 -V080 -P1 - -$(MID_SUBDIR)/mus_vs_elite_four.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G125 -V080 -P1 - -$(MID_SUBDIR)/mus_roulette.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G038 -V080 - -$(MID_SUBDIR)/mus_lilycove_museum.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G020 -V080 - -$(MID_SUBDIR)/mus_encounter_brendan.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G067 -V078 - -$(MID_SUBDIR)/mus_encounter_male.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G028 -V080 - -$(MID_SUBDIR)/mus_victory_road.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G075 -V076 - -$(MID_SUBDIR)/mus_game_corner.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G072 -V072 - -$(MID_SUBDIR)/mus_contest_winner.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G085 -V100 - -$(MID_SUBDIR)/mus_contest_results.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G092 -V080 - -$(MID_SUBDIR)/mus_contest_lobby.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G098 -V060 - -$(MID_SUBDIR)/mus_contest.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G086 -V088 - -$(MID_SUBDIR)/mus_cycling.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G049 -V083 - -$(MID_SUBDIR)/mus_encounter_champion.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G100 -V076 - -$(MID_SUBDIR)/mus_petalburg_woods.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G018 -V080 - -$(MID_SUBDIR)/mus_abandoned_ship.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G030 -V080 - -$(MID_SUBDIR)/mus_cave_of_origin.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G037 -V080 - -$(MID_SUBDIR)/mus_underwater.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G057 -V094 - -$(MID_SUBDIR)/mus_intro.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G060 -V090 - -$(MID_SUBDIR)/mus_hall_of_fame.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G082 -V078 - -$(MID_SUBDIR)/mus_route110.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G010 -V080 - -$(MID_SUBDIR)/mus_route120.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G014 -V080 - -$(MID_SUBDIR)/mus_route122.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G021 -V080 - -$(MID_SUBDIR)/mus_route101.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G011 -V080 - -$(MID_SUBDIR)/mus_dummy.s: %.s: %.mid - $(MID) $< $@ -E -R40 - -$(MID_SUBDIR)/mus_hall_of_fame_room.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G093 -V080 - -$(MID_SUBDIR)/mus_end.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G102 -V036 - -$(MID_SUBDIR)/mus_help.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G056 -V078 - -$(MID_SUBDIR)/mus_level_up.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G012 -V090 -P5 - -$(MID_SUBDIR)/mus_obtain_item.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G012 -V090 -P5 - -$(MID_SUBDIR)/mus_evolved.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G012 -V090 -P5 - -$(MID_SUBDIR)/mus_gsc_route38.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -V080 - -$(MID_SUBDIR)/mus_slateport.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G079 -V070 - -$(MID_SUBDIR)/mus_poke_mart.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G050 -V085 - -$(MID_SUBDIR)/mus_oceanic_museum.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G023 -V080 - -$(MID_SUBDIR)/mus_gym.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G013 -V080 - -$(MID_SUBDIR)/mus_encounter_may.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G061 -V078 - -$(MID_SUBDIR)/mus_encounter_female.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G053 -V072 - -$(MID_SUBDIR)/mus_verdanturf.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G044 -V090 - -$(MID_SUBDIR)/mus_rustboro.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G045 -V085 - -$(MID_SUBDIR)/mus_route119.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G048 -V096 - -$(MID_SUBDIR)/mus_encounter_intense.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G062 -V078 - -$(MID_SUBDIR)/mus_weather_groudon.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G090 -V050 - -$(MID_SUBDIR)/mus_dewford.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G073 -V078 - -$(MID_SUBDIR)/mus_encounter_twins.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G095 -V075 - -$(MID_SUBDIR)/mus_encounter_interviewer.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G099 -V062 - -$(MID_SUBDIR)/mus_victory_trainer.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G058 -V091 - -$(MID_SUBDIR)/mus_victory_wild.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G025 -V080 - -$(MID_SUBDIR)/mus_victory_gym_leader.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G024 -V080 - -$(MID_SUBDIR)/mus_victory_aqua_magma.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G070 -V088 - -$(MID_SUBDIR)/mus_victory_league.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G029 -V080 - -$(MID_SUBDIR)/mus_caught.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G025 -V080 - -$(MID_SUBDIR)/mus_encounter_cool.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G063 -V086 - -$(MID_SUBDIR)/mus_trick_house.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G094 -V070 - -$(MID_SUBDIR)/mus_route113.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G064 -V084 - -$(MID_SUBDIR)/mus_sailing.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G077 -V086 - -$(MID_SUBDIR)/mus_mt_pyre.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G078 -V088 - -$(MID_SUBDIR)/mus_sealed_chamber.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G084 -V100 - -$(MID_SUBDIR)/mus_petalburg.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G015 -V080 - -$(MID_SUBDIR)/mus_fortree.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G032 -V080 - -$(MID_SUBDIR)/mus_oldale.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G019 -V080 - -$(MID_SUBDIR)/mus_mt_pyre_exterior.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G080 -V080 - -$(MID_SUBDIR)/mus_heal.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G012 -V090 -P5 - -$(MID_SUBDIR)/mus_slots_jackpot.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G012 -V090 -P5 - -$(MID_SUBDIR)/mus_slots_win.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G012 -V090 -P5 - -$(MID_SUBDIR)/mus_obtain_badge.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G012 -V090 -P5 - -$(MID_SUBDIR)/mus_obtain_berry.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G012 -V090 -P5 - -$(MID_SUBDIR)/mus_obtain_b_points.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G103 -V090 -P5 - -$(MID_SUBDIR)/mus_rg_photo.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G180 -V100 -P5 - -$(MID_SUBDIR)/mus_evolution_intro.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G026 -V080 - -$(MID_SUBDIR)/mus_obtain_symbol.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G103 -V100 -P5 - -$(MID_SUBDIR)/mus_awaken_legend.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G012 -V090 -P5 - -$(MID_SUBDIR)/mus_register_match_call.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G105 -V090 -P5 - -$(MID_SUBDIR)/mus_move_deleted.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G012 -V090 -P5 - -$(MID_SUBDIR)/mus_obtain_tmhm.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G012 -V090 -P5 - -$(MID_SUBDIR)/mus_too_bad.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G012 -V090 -P5 - -$(MID_SUBDIR)/mus_encounter_magma.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G087 -V072 - -$(MID_SUBDIR)/mus_lilycove.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G054 -V085 - -$(MID_SUBDIR)/mus_littleroot.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G051 -V100 - -$(MID_SUBDIR)/mus_surf.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G017 -V080 - -$(MID_SUBDIR)/mus_route104.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G047 -V097 - -$(MID_SUBDIR)/mus_gsc_pewter.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -V080 - -$(MID_SUBDIR)/mus_birch_lab.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G033 -V080 - -$(MID_SUBDIR)/mus_abnormal_weather.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G089 -V080 - -$(MID_SUBDIR)/mus_school.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G081 -V100 - -$(MID_SUBDIR)/mus_c_comm_center.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -V080 - -$(MID_SUBDIR)/mus_poke_center.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G046 -V092 - -$(MID_SUBDIR)/mus_b_pyramid.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G106 -V079 - -$(MID_SUBDIR)/mus_b_pyramid_top.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G107 -V077 - -$(MID_SUBDIR)/mus_ever_grande.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G068 -V086 - -$(MID_SUBDIR)/mus_rayquaza_appears.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G109 -V090 - -$(MID_SUBDIR)/mus_rg_rocket_hideout.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G133 -V090 - -$(MID_SUBDIR)/mus_rg_follow_me.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G131 -V068 - -$(MID_SUBDIR)/mus_rg_victory_road.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G154 -V090 - -$(MID_SUBDIR)/mus_rg_cycling.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G141 -V090 - -$(MID_SUBDIR)/mus_rg_intro_fight.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G136 -V090 - -$(MID_SUBDIR)/mus_rg_hall_of_fame.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G145 -V079 - -$(MID_SUBDIR)/mus_rg_encounter_deoxys.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G184 -V079 - -$(MID_SUBDIR)/mus_rg_credits.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G149 -V090 - -$(MID_SUBDIR)/mus_rg_encounter_gym_leader.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G144 -V090 - -$(MID_SUBDIR)/mus_rg_dex_rating.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G175 -V070 -P5 - -$(MID_SUBDIR)/mus_rg_obtain_key_item.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G178 -V077 -P5 - -$(MID_SUBDIR)/mus_rg_caught_intro.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G179 -V094 -P5 - -$(MID_SUBDIR)/mus_rg_caught.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G170 -V100 - -$(MID_SUBDIR)/mus_rg_cinnabar.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G138 -V090 - -$(MID_SUBDIR)/mus_rg_gym.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G134 -V090 - -$(MID_SUBDIR)/mus_rg_fuchsia.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G167 -V090 - -$(MID_SUBDIR)/mus_rg_poke_jump.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G132 -V090 - -$(MID_SUBDIR)/mus_rg_heal.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G140 -V090 - -$(MID_SUBDIR)/mus_rg_oak_lab.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G160 -V075 - -$(MID_SUBDIR)/mus_rg_berry_pick.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G132 -V090 - -$(MID_SUBDIR)/mus_rg_vermillion.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G172 -V090 - -$(MID_SUBDIR)/mus_rg_route1.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G150 -V079 - -$(MID_SUBDIR)/mus_rg_route3.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G152 -V083 - -$(MID_SUBDIR)/mus_rg_route11.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G153 -V090 - -$(MID_SUBDIR)/mus_rg_pallet.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G159 -V100 - -$(MID_SUBDIR)/mus_rg_surf.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G164 -V071 - -$(MID_SUBDIR)/mus_rg_sevii_45.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G188 -V084 - -$(MID_SUBDIR)/mus_rg_sevii_67.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G189 -V084 - -$(MID_SUBDIR)/mus_rg_sevii_123.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G173 -V084 - -$(MID_SUBDIR)/mus_rg_sevii_cave.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G147 -V090 - -$(MID_SUBDIR)/mus_rg_sevii_dungeon.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G146 -V090 - -$(MID_SUBDIR)/mus_rg_sevii_route.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G187 -V080 - -$(MID_SUBDIR)/mus_rg_net_center.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G162 -V096 - -$(MID_SUBDIR)/mus_rg_pewter.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G173 -V084 - -$(MID_SUBDIR)/mus_rg_oak.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G161 -V086 - -$(MID_SUBDIR)/mus_rg_mystery_gift.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G183 -V100 - -$(MID_SUBDIR)/mus_rg_route24.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G151 -V086 - -$(MID_SUBDIR)/mus_rg_teachy_tv_show.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G131 -V068 - -$(MID_SUBDIR)/mus_rg_mt_moon.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G147 -V090 - -$(MID_SUBDIR)/mus_rg_poke_tower.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G165 -V090 - -$(MID_SUBDIR)/mus_rg_poke_center.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G162 -V096 - -$(MID_SUBDIR)/mus_rg_poke_flute.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G165 -V048 -P5 - -$(MID_SUBDIR)/mus_rg_poke_mansion.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G148 -V090 - -$(MID_SUBDIR)/mus_rg_jigglypuff.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G135 -V068 -P5 - -$(MID_SUBDIR)/mus_rg_encounter_rival.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G174 -V079 - -$(MID_SUBDIR)/mus_rg_rival_exit.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G174 -V079 - -$(MID_SUBDIR)/mus_rg_encounter_rocket.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G142 -V096 - -$(MID_SUBDIR)/mus_rg_ss_anne.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G163 -V090 - -$(MID_SUBDIR)/mus_rg_new_game_exit.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G182 -V088 - -$(MID_SUBDIR)/mus_rg_new_game_intro.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G182 -V088 - -$(MID_SUBDIR)/mus_rg_lavender.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G139 -V090 - -$(MID_SUBDIR)/mus_rg_silph.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G166 -V076 - -$(MID_SUBDIR)/mus_rg_encounter_girl.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G143 -V051 - -$(MID_SUBDIR)/mus_rg_encounter_boy.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G144 -V090 - -$(MID_SUBDIR)/mus_rg_game_corner.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G132 -V090 - -$(MID_SUBDIR)/mus_rg_slow_pallet.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G159 -V092 - -$(MID_SUBDIR)/mus_rg_new_game_instruct.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G182 -V085 - -$(MID_SUBDIR)/mus_rg_viridian_forest.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G146 -V090 - -$(MID_SUBDIR)/mus_rg_trainer_tower.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G134 -V090 - -$(MID_SUBDIR)/mus_rg_celadon.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G168 -V070 - -$(MID_SUBDIR)/mus_rg_title.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G137 -V090 - -$(MID_SUBDIR)/mus_rg_game_freak.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G181 -V075 - -$(MID_SUBDIR)/mus_rg_teachy_tv_menu.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G186 -V059 - -$(MID_SUBDIR)/mus_rg_union_room.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G132 -V090 - -$(MID_SUBDIR)/mus_rg_vs_legend.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G157 -V090 - -$(MID_SUBDIR)/mus_rg_vs_deoxys.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G185 -V080 - -$(MID_SUBDIR)/mus_rg_vs_gym_leader.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G155 -V090 - -$(MID_SUBDIR)/mus_rg_vs_champion.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G158 -V090 - -$(MID_SUBDIR)/mus_rg_vs_mewtwo.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G157 -V090 - -$(MID_SUBDIR)/mus_rg_vs_trainer.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G156 -V090 - -$(MID_SUBDIR)/mus_rg_vs_wild.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G157 -V090 - -$(MID_SUBDIR)/mus_rg_victory_gym_leader.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G171 -V090 - -$(MID_SUBDIR)/mus_rg_victory_trainer.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G169 -V089 - -$(MID_SUBDIR)/mus_rg_victory_wild.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G170 -V090 - -$(MID_SUBDIR)/mus_cable_car.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G071 -V078 - -$(MID_SUBDIR)/mus_sootopolis.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G091 -V062 - -$(MID_SUBDIR)/mus_safari_zone.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G074 -V082 - -$(MID_SUBDIR)/mus_b_tower.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G110 -V100 - -$(MID_SUBDIR)/mus_evolution.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G026 -V080 - -$(MID_SUBDIR)/mus_encounter_elite_four.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G096 -V078 - -$(MID_SUBDIR)/mus_c_vs_legend_beast.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -V080 - -$(MID_SUBDIR)/mus_encounter_swimmer.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G036 -V080 - -$(MID_SUBDIR)/mus_encounter_girl.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G027 -V080 - -$(MID_SUBDIR)/mus_intro_battle.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G088 -V088 - -$(MID_SUBDIR)/mus_encounter_rich.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G043 -V094 - -$(MID_SUBDIR)/mus_link_contest_p1.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G039 -V079 - -$(MID_SUBDIR)/mus_link_contest_p2.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G040 -V090 - -$(MID_SUBDIR)/mus_link_contest_p3.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G041 -V075 - -$(MID_SUBDIR)/mus_link_contest_p4.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G042 -V090 - -$(MID_SUBDIR)/mus_littleroot_test.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G034 -V099 - -$(MID_SUBDIR)/mus_credits.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G101 -V100 - -$(MID_SUBDIR)/mus_title.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G059 -V090 - -$(MID_SUBDIR)/mus_fallarbor.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G083 -V100 - -$(MID_SUBDIR)/mus_mt_chimney.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G052 -V078 - -$(MID_SUBDIR)/mus_follow_me.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G066 -V074 - -$(MID_SUBDIR)/mus_vs_frontier_brain.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G115 -V090 -P1 - -$(MID_SUBDIR)/mus_vs_mew.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G116 -V090 - -$(MID_SUBDIR)/mus_vs_rayquaza.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G114 -V080 -P1 - -$(MID_SUBDIR)/mus_encounter_hiker.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G097 -V076 - -$(MID_SUBDIR)/ph_choice_blend.s: %.s: %.mid - $(MID) $< $@ -E -G130 -P4 - -$(MID_SUBDIR)/ph_choice_held.s: %.s: %.mid - $(MID) $< $@ -E -G130 -P4 - -$(MID_SUBDIR)/ph_choice_solo.s: %.s: %.mid - $(MID) $< $@ -E -G130 -P4 - -$(MID_SUBDIR)/ph_cloth_blend.s: %.s: %.mid - $(MID) $< $@ -E -G130 -P4 - -$(MID_SUBDIR)/ph_cloth_held.s: %.s: %.mid - $(MID) $< $@ -E -G130 -P4 - -$(MID_SUBDIR)/ph_cloth_solo.s: %.s: %.mid - $(MID) $< $@ -E -G130 -P4 - -$(MID_SUBDIR)/ph_cure_blend.s: %.s: %.mid - $(MID) $< $@ -E -G130 -P4 - -$(MID_SUBDIR)/ph_cure_held.s: %.s: %.mid - $(MID) $< $@ -E -G130 -P4 - -$(MID_SUBDIR)/ph_cure_solo.s: %.s: %.mid - $(MID) $< $@ -E -G130 -P4 - -$(MID_SUBDIR)/ph_dress_blend.s: %.s: %.mid - $(MID) $< $@ -E -G130 -P4 - -$(MID_SUBDIR)/ph_dress_held.s: %.s: %.mid - $(MID) $< $@ -E -G130 -P4 - -$(MID_SUBDIR)/ph_dress_solo.s: %.s: %.mid - $(MID) $< $@ -E -G130 -P4 - -$(MID_SUBDIR)/ph_face_blend.s: %.s: %.mid - $(MID) $< $@ -E -G130 -P4 - -$(MID_SUBDIR)/ph_face_held.s: %.s: %.mid - $(MID) $< $@ -E -G130 -P4 - -$(MID_SUBDIR)/ph_face_solo.s: %.s: %.mid - $(MID) $< $@ -E -G130 -P4 - -$(MID_SUBDIR)/ph_fleece_blend.s: %.s: %.mid - $(MID) $< $@ -E -G130 -P4 - -$(MID_SUBDIR)/ph_fleece_held.s: %.s: %.mid - $(MID) $< $@ -E -G130 -P4 - -$(MID_SUBDIR)/ph_fleece_solo.s: %.s: %.mid - $(MID) $< $@ -E -G130 -P4 - -$(MID_SUBDIR)/ph_foot_blend.s: %.s: %.mid - $(MID) $< $@ -E -G130 -P4 - -$(MID_SUBDIR)/ph_foot_held.s: %.s: %.mid - $(MID) $< $@ -E -G130 -P4 - -$(MID_SUBDIR)/ph_foot_solo.s: %.s: %.mid - $(MID) $< $@ -E -G130 -P4 - -$(MID_SUBDIR)/ph_goat_blend.s: %.s: %.mid - $(MID) $< $@ -E -G130 -P4 - -$(MID_SUBDIR)/ph_goat_held.s: %.s: %.mid - $(MID) $< $@ -E -G130 -P4 - -$(MID_SUBDIR)/ph_goat_solo.s: %.s: %.mid - $(MID) $< $@ -E -G130 -P4 - -$(MID_SUBDIR)/ph_goose_blend.s: %.s: %.mid - $(MID) $< $@ -E -G130 -P4 - -$(MID_SUBDIR)/ph_goose_held.s: %.s: %.mid - $(MID) $< $@ -E -G130 -P4 - -$(MID_SUBDIR)/ph_goose_solo.s: %.s: %.mid - $(MID) $< $@ -E -G130 -P4 - -$(MID_SUBDIR)/ph_kit_blend.s: %.s: %.mid - $(MID) $< $@ -E -G130 -P4 - -$(MID_SUBDIR)/ph_kit_held.s: %.s: %.mid - $(MID) $< $@ -E -G130 -P4 - -$(MID_SUBDIR)/ph_kit_solo.s: %.s: %.mid - $(MID) $< $@ -E -G130 -P4 - -$(MID_SUBDIR)/ph_lot_blend.s: %.s: %.mid - $(MID) $< $@ -E -G130 -P4 - -$(MID_SUBDIR)/ph_lot_held.s: %.s: %.mid - $(MID) $< $@ -E -G130 -P4 - -$(MID_SUBDIR)/ph_lot_solo.s: %.s: %.mid - $(MID) $< $@ -E -G130 -P4 - -$(MID_SUBDIR)/ph_mouth_blend.s: %.s: %.mid - $(MID) $< $@ -E -G130 -P4 - -$(MID_SUBDIR)/ph_mouth_held.s: %.s: %.mid - $(MID) $< $@ -E -G130 -P4 - -$(MID_SUBDIR)/ph_mouth_solo.s: %.s: %.mid - $(MID) $< $@ -E -G130 -P4 - -$(MID_SUBDIR)/ph_nurse_blend.s: %.s: %.mid - $(MID) $< $@ -E -G130 -P4 - -$(MID_SUBDIR)/ph_nurse_held.s: %.s: %.mid - $(MID) $< $@ -E -G130 -P4 - -$(MID_SUBDIR)/ph_nurse_solo.s: %.s: %.mid - $(MID) $< $@ -E -G130 -P4 - -$(MID_SUBDIR)/ph_price_blend.s: %.s: %.mid - $(MID) $< $@ -E -G130 -P4 - -$(MID_SUBDIR)/ph_price_held.s: %.s: %.mid - $(MID) $< $@ -E -G130 -P4 - -$(MID_SUBDIR)/ph_price_solo.s: %.s: %.mid - $(MID) $< $@ -E -G130 -P4 - -$(MID_SUBDIR)/ph_strut_blend.s: %.s: %.mid - $(MID) $< $@ -E -G130 -P4 - -$(MID_SUBDIR)/ph_strut_held.s: %.s: %.mid - $(MID) $< $@ -E -G130 -P4 - -$(MID_SUBDIR)/ph_strut_solo.s: %.s: %.mid - $(MID) $< $@ -E -G130 -P4 - -$(MID_SUBDIR)/ph_thought_blend.s: %.s: %.mid - $(MID) $< $@ -E -G130 -P4 - -$(MID_SUBDIR)/ph_thought_held.s: %.s: %.mid - $(MID) $< $@ -E -G130 -P4 - -$(MID_SUBDIR)/ph_thought_solo.s: %.s: %.mid - $(MID) $< $@ -E -G130 -P4 - -$(MID_SUBDIR)/ph_trap_blend.s: %.s: %.mid - $(MID) $< $@ -E -G130 -P4 - -$(MID_SUBDIR)/ph_trap_held.s: %.s: %.mid - $(MID) $< $@ -E -G130 -P4 - -$(MID_SUBDIR)/ph_trap_solo.s: %.s: %.mid - $(MID) $< $@ -E -G130 -P4 - -$(MID_SUBDIR)/se_a.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V095 -P4 - -$(MID_SUBDIR)/se_bang.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P4 - -$(MID_SUBDIR)/se_taillow_wing_flap.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V105 -P5 - -$(MID_SUBDIR)/se_glass_flute.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V105 -P5 - -$(MID_SUBDIR)/se_boo.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G127 -V110 -P4 - -$(MID_SUBDIR)/se_ball.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G127 -V070 -P4 - -$(MID_SUBDIR)/se_ball_open.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G127 -V100 -P5 - -$(MID_SUBDIR)/se_mugshot.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V090 -P5 - -$(MID_SUBDIR)/se_contest_heart.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V090 -P5 - -$(MID_SUBDIR)/se_contest_curtain_fall.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V070 -P5 - -$(MID_SUBDIR)/se_contest_curtain_rise.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V070 -P5 - -$(MID_SUBDIR)/se_contest_icon_change.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P5 - -$(MID_SUBDIR)/se_contest_mons_turn.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V090 -P5 - -$(MID_SUBDIR)/se_contest_icon_clear.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V090 -P5 - -$(MID_SUBDIR)/se_card.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G127 -V100 -P4 - -$(MID_SUBDIR)/se_pike_curtain_close.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G129 -P5 - -$(MID_SUBDIR)/se_pike_curtain_open.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G129 -P5 - -$(MID_SUBDIR)/se_ledge.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G127 -V100 -P4 - -$(MID_SUBDIR)/se_itemfinder.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G127 -V090 -P5 - -$(MID_SUBDIR)/se_applause.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V100 -P5 - -$(MID_SUBDIR)/se_field_poison.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G127 -V110 -P5 - -$(MID_SUBDIR)/se_door.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G127 -V080 -P5 - -$(MID_SUBDIR)/se_e.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V120 -P4 - -$(MID_SUBDIR)/se_elevator.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V100 -P4 - -$(MID_SUBDIR)/se_escalator.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V100 -P4 - -$(MID_SUBDIR)/se_exp.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G127 -V080 -P5 - -$(MID_SUBDIR)/se_exp_max.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V094 -P5 - -$(MID_SUBDIR)/se_fu_zaku.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G127 -V120 -P4 - -$(MID_SUBDIR)/se_contest_condition_lose.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G127 -V110 -P4 - -$(MID_SUBDIR)/se_lavaridge_fall_warp.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G127 -P4 - -$(MID_SUBDIR)/se_balloon_red.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V105 -P4 - -$(MID_SUBDIR)/se_balloon_blue.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V105 -P4 - -$(MID_SUBDIR)/se_balloon_yellow.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V105 -P4 - -$(MID_SUBDIR)/se_arena_timeup1.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G129 -P5 - -$(MID_SUBDIR)/se_arena_timeup2.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G129 -P5 - -$(MID_SUBDIR)/se_bridge_walk.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V095 -P4 - -$(MID_SUBDIR)/se_failure.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G127 -V120 -P4 - -$(MID_SUBDIR)/se_rotating_gate.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V090 -P4 - -$(MID_SUBDIR)/se_low_health.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G127 -V100 -P3 - -$(MID_SUBDIR)/se_i.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V120 -P4 - -$(MID_SUBDIR)/se_sliding_door.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V095 -P4 - -$(MID_SUBDIR)/se_vend.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P4 - -$(MID_SUBDIR)/se_bike_hop.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G127 -V090 -P4 - -$(MID_SUBDIR)/se_bike_bell.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V090 -P4 - -$(MID_SUBDIR)/se_contest_place.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G127 -V110 -P4 - -$(MID_SUBDIR)/se_exit.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G127 -V120 -P5 - -$(MID_SUBDIR)/se_use_item.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G127 -V100 -P5 - -$(MID_SUBDIR)/se_unlock.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V100 -P4 - -$(MID_SUBDIR)/se_ball_bounce_1.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V100 -P4 - -$(MID_SUBDIR)/se_ball_bounce_2.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V100 -P4 - -$(MID_SUBDIR)/se_ball_bounce_3.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V100 -P4 - -$(MID_SUBDIR)/se_ball_bounce_4.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V100 -P4 - -$(MID_SUBDIR)/se_super_effective.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G127 -V110 -P5 - -$(MID_SUBDIR)/se_not_effective.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G127 -V110 -P5 - -$(MID_SUBDIR)/se_effective.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G127 -V110 -P5 - -$(MID_SUBDIR)/se_puddle.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V020 -P4 - -$(MID_SUBDIR)/se_berry_blender.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V090 -P4 - -$(MID_SUBDIR)/se_switch.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G127 -V100 -P4 - -$(MID_SUBDIR)/se_n.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -P4 - -$(MID_SUBDIR)/se_ball_throw.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V120 -P5 - -$(MID_SUBDIR)/se_ship.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G127 -V075 -P4 - -$(MID_SUBDIR)/se_flee.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G127 -V090 -P5 - -$(MID_SUBDIR)/se_o.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V120 -P4 - -$(MID_SUBDIR)/se_intro_blast.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G127 -V100 -P5 - -$(MID_SUBDIR)/se_pc_login.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G127 -V100 -P5 - -$(MID_SUBDIR)/se_pc_off.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G127 -V100 -P5 - -$(MID_SUBDIR)/se_pc_on.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G127 -V100 -P5 - -$(MID_SUBDIR)/se_pin.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G127 -V060 -P4 - -$(MID_SUBDIR)/se_ding_dong.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G127 -V090 -P5 - -$(MID_SUBDIR)/se_pokenav_off.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G127 -V100 -P5 - -$(MID_SUBDIR)/se_pokenav_on.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G127 -V100 -P5 - -$(MID_SUBDIR)/se_faint.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G127 -V110 -P5 - -$(MID_SUBDIR)/se_shiny.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V095 -P5 - -$(MID_SUBDIR)/se_shop.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G127 -V090 -P5 - -$(MID_SUBDIR)/se_rg_bag_cursor.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G129 -P5 - -$(MID_SUBDIR)/se_rg_bag_pocket.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G129 -P5 - -$(MID_SUBDIR)/se_rg_card_flip.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G129 -P5 - -$(MID_SUBDIR)/se_rg_card_flipping.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G129 -P5 - -$(MID_SUBDIR)/se_rg_card_open.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G129 -V112 -P5 - -$(MID_SUBDIR)/se_rg_deoxys_move.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G129 -V080 -P5 - -$(MID_SUBDIR)/se_rg_poke_jump_success.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P5 - -$(MID_SUBDIR)/se_rg_ball_click.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G129 -V100 -P5 - -$(MID_SUBDIR)/se_rg_help_close.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G129 -V095 -P5 - -$(MID_SUBDIR)/se_rg_help_error.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G129 -V125 -P5 - -$(MID_SUBDIR)/se_rg_help_open.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G129 -V096 -P5 - -$(MID_SUBDIR)/se_rg_ss_anne_horn.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G129 -V096 -P5 - -$(MID_SUBDIR)/se_rg_poke_jump_failure.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G127 -P5 - -$(MID_SUBDIR)/se_rg_shop.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G129 -V080 -P5 - -$(MID_SUBDIR)/se_rg_door.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G129 -V100 -P5 - -$(MID_SUBDIR)/se_ice_crack.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G127 -V100 -P4 - -$(MID_SUBDIR)/se_ice_stairs.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V090 -P4 - -$(MID_SUBDIR)/se_ice_break.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V100 -P4 - -$(MID_SUBDIR)/se_fall.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P4 - -$(MID_SUBDIR)/se_save.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V080 -P5 - -$(MID_SUBDIR)/se_success.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G127 -V080 -P4 - -$(MID_SUBDIR)/se_select.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G127 -V080 -P5 - -$(MID_SUBDIR)/se_ball_trade.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G127 -V100 -P5 - -$(MID_SUBDIR)/se_thunderstorm.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V080 -P2 - -$(MID_SUBDIR)/se_thunderstorm_stop.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V080 -P2 - -$(MID_SUBDIR)/se_thunder.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P3 - -$(MID_SUBDIR)/se_thunder2.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P3 - -$(MID_SUBDIR)/se_rain.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V080 -P2 - -$(MID_SUBDIR)/se_rain_stop.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V080 -P2 - -$(MID_SUBDIR)/se_downpour.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V100 -P2 - -$(MID_SUBDIR)/se_downpour_stop.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V100 -P2 - -$(MID_SUBDIR)/se_orb.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V100 -P5 - -$(MID_SUBDIR)/se_egg_hatch.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V120 -P5 - -$(MID_SUBDIR)/se_roulette_ball.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P2 - -$(MID_SUBDIR)/se_roulette_ball2.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P2 - -$(MID_SUBDIR)/se_ball_tray_exit.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G127 -V100 -P5 - -$(MID_SUBDIR)/se_ball_tray_ball.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P5 - -$(MID_SUBDIR)/se_ball_tray_enter.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P5 - -$(MID_SUBDIR)/se_click.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G127 -V110 -P4 - -$(MID_SUBDIR)/se_warp_in.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G127 -V090 -P4 - -$(MID_SUBDIR)/se_warp_out.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G127 -V090 -P4 - -$(MID_SUBDIR)/se_pokenav_call.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G129 -V120 -P5 - -$(MID_SUBDIR)/se_pokenav_hang_up.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G129 -V110 -P5 - -$(MID_SUBDIR)/se_note_a.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P4 - -$(MID_SUBDIR)/se_note_b.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P4 - -$(MID_SUBDIR)/se_note_c.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P4 - -$(MID_SUBDIR)/se_note_c_high.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P4 - -$(MID_SUBDIR)/se_note_d.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P4 - -$(MID_SUBDIR)/se_mud_ball.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P4 - -$(MID_SUBDIR)/se_note_e.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P4 - -$(MID_SUBDIR)/se_note_f.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P4 - -$(MID_SUBDIR)/se_note_g.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P4 - -$(MID_SUBDIR)/se_breakable_door.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P4 - -$(MID_SUBDIR)/se_truck_door.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P4 - -$(MID_SUBDIR)/se_truck_unload.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G127 -P4 - -$(MID_SUBDIR)/se_truck_move.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -P4 - -$(MID_SUBDIR)/se_truck_stop.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -P4 - -$(MID_SUBDIR)/se_repel.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G127 -V090 -P4 - -$(MID_SUBDIR)/se_u.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -P4 - -$(MID_SUBDIR)/se_sudowoodo_shake.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G129 -V077 -P5 - -$(MID_SUBDIR)/se_m_double_slap.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P4 - -$(MID_SUBDIR)/se_m_comet_punch.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V120 -P4 - -$(MID_SUBDIR)/se_m_pay_day.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V095 -P4 - -$(MID_SUBDIR)/se_m_fire_punch.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P4 - -$(MID_SUBDIR)/se_m_scratch.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P4 - -$(MID_SUBDIR)/se_m_vicegrip.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P4 - -$(MID_SUBDIR)/se_m_razor_wind.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P4 - -$(MID_SUBDIR)/se_m_razor_wind2.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V090 -P4 - -$(MID_SUBDIR)/se_m_swords_dance.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V100 -P4 - -$(MID_SUBDIR)/se_m_cut.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V120 -P4 - -$(MID_SUBDIR)/se_m_gust.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P4 - -$(MID_SUBDIR)/se_m_gust2.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P4 - -$(MID_SUBDIR)/se_m_wing_attack.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V105 -P4 - -$(MID_SUBDIR)/se_m_fly.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P4 - -$(MID_SUBDIR)/se_m_bind.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V100 -P4 - -$(MID_SUBDIR)/se_m_mega_kick.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V090 -P4 - -$(MID_SUBDIR)/se_m_mega_kick2.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P4 - -$(MID_SUBDIR)/se_m_jump_kick.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P4 - -$(MID_SUBDIR)/se_m_sand_attack.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P4 - -$(MID_SUBDIR)/se_m_headbutt.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P4 - -$(MID_SUBDIR)/se_m_horn_attack.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P4 - -$(MID_SUBDIR)/se_m_take_down.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V105 -P4 - -$(MID_SUBDIR)/se_m_tail_whip.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P4 - -$(MID_SUBDIR)/se_m_leer.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G128 -V110 -P4 - -$(MID_SUBDIR)/se_dex_search.s: %.s: %.mid - $(MID) $< $@ -E -R$(STD_REVERB) -G127 -v100 -P5 diff --git a/sound/songs/midi/midi.cfg b/sound/songs/midi/midi.cfg new file mode 100644 index 000000000000..5802904b4130 --- /dev/null +++ b/sound/songs/midi/midi.cfg @@ -0,0 +1,420 @@ +mus_abandoned_ship.mid: -E -R50 -G030 -V080 +mus_abnormal_weather.mid: -E -R50 -G089 -V080 +mus_aqua_magma_hideout.mid: -E -R50 -G076 -V084 +mus_awaken_legend.mid: -E -R50 -G012 -V090 -P5 +mus_b_arena.mid: -E -R50 -G104 -V090 +mus_b_dome_lobby.mid: -E -R50 -G111 -V056 +mus_b_dome.mid: -E -R50 -G111 -V090 +mus_b_factory.mid: -E -R50 -G113 -V100 +mus_b_frontier.mid: -E -R50 -G103 -V094 +mus_b_palace.mid: -E -R50 -G108 -V105 +mus_b_pike.mid: -E -R50 -G112 -V092 +mus_b_pyramid_top.mid: -E -R50 -G107 -V077 +mus_b_pyramid.mid: -E -R50 -G106 -V079 +mus_b_tower_rs.mid: -E -R50 -G035 -V080 +mus_b_tower.mid: -E -R50 -G110 -V100 +mus_birch_lab.mid: -E -R50 -G033 -V080 +mus_c_comm_center.mid: -E -R50 -V080 +mus_c_vs_legend_beast.mid: -E -R50 -V080 +mus_cable_car.mid: -E -R50 -G071 -V078 +mus_caught.mid: -E -R50 -G025 -V080 +mus_cave_of_origin.mid: -E -R50 -G037 -V080 +mus_contest_lobby.mid: -E -R50 -G098 -V060 +mus_contest_results.mid: -E -R50 -G092 -V080 +mus_contest_winner.mid: -E -R50 -G085 -V100 +mus_contest.mid: -E -R50 -G086 -V088 +mus_credits.mid: -E -R50 -G101 -V100 +mus_cycling.mid: -E -R50 -G049 -V083 +mus_dewford.mid: -E -R50 -G073 -V078 +mus_dummy.mid: -E -R40 +mus_encounter_aqua.mid: -E -R50 -G065 -V086 +mus_encounter_brendan.mid: -E -R50 -G067 -V078 +mus_encounter_champion.mid: -E -R50 -G100 -V076 +mus_encounter_cool.mid: -E -R50 -G063 -V086 +mus_encounter_elite_four.mid: -E -R50 -G096 -V078 +mus_encounter_female.mid: -E -R50 -G053 -V072 +mus_encounter_girl.mid: -E -R50 -G027 -V080 +mus_encounter_hiker.mid: -E -R50 -G097 -V076 +mus_encounter_intense.mid: -E -R50 -G062 -V078 +mus_encounter_interviewer.mid: -E -R50 -G099 -V062 +mus_encounter_magma.mid: -E -R50 -G087 -V072 +mus_encounter_male.mid: -E -R50 -G028 -V080 +mus_encounter_may.mid: -E -R50 -G061 -V078 +mus_encounter_rich.mid: -E -R50 -G043 -V094 +mus_encounter_suspicious.mid: -E -R50 -G069 -V078 +mus_encounter_swimmer.mid: -E -R50 -G036 -V080 +mus_encounter_twins.mid: -E -R50 -G095 -V075 +mus_end.mid: -E -R50 -G102 -V036 +mus_ever_grande.mid: -E -R50 -G068 -V086 +mus_evolution_intro.mid: -E -R50 -G026 -V080 +mus_evolution.mid: -E -R50 -G026 -V080 +mus_evolved.mid: -E -R50 -G012 -V090 -P5 +mus_fallarbor.mid: -E -R50 -G083 -V100 +mus_follow_me.mid: -E -R50 -G066 -V074 +mus_fortree.mid: -E -R50 -G032 -V080 +mus_game_corner.mid: -E -R50 -G072 -V072 +mus_gsc_pewter.mid: -E -R50 -V080 +mus_gsc_route38.mid: -E -R50 -V080 +mus_gym.mid: -E -R50 -G013 -V080 +mus_hall_of_fame_room.mid: -E -R50 -G093 -V080 +mus_hall_of_fame.mid: -E -R50 -G082 -V078 +mus_heal.mid: -E -R50 -G012 -V090 -P5 +mus_help.mid: -E -R50 -G056 -V078 +mus_intro_battle.mid: -E -R50 -G088 -V088 +mus_intro.mid: -E -R50 -G060 -V090 +mus_level_up.mid: -E -R50 -G012 -V090 -P5 +mus_lilycove_museum.mid: -E -R50 -G020 -V080 +mus_lilycove.mid: -E -R50 -G054 -V085 +mus_link_contest_p1.mid: -E -R50 -G039 -V079 +mus_link_contest_p2.mid: -E -R50 -G040 -V090 +mus_link_contest_p3.mid: -E -R50 -G041 -V075 +mus_link_contest_p4.mid: -E -R50 -G042 -V090 +mus_littleroot_test.mid: -E -R50 -G034 -V099 +mus_littleroot.mid: -E -R50 -G051 -V100 +mus_move_deleted.mid: -E -R50 -G012 -V090 -P5 +mus_mt_chimney.mid: -E -R50 -G052 -V078 +mus_mt_pyre_exterior.mid: -E -R50 -G080 -V080 +mus_mt_pyre.mid: -E -R50 -G078 -V088 +mus_obtain_b_points.mid: -E -R50 -G103 -V090 -P5 +mus_obtain_badge.mid: -E -R50 -G012 -V090 -P5 +mus_obtain_berry.mid: -E -R50 -G012 -V090 -P5 +mus_obtain_item.mid: -E -R50 -G012 -V090 -P5 +mus_obtain_symbol.mid: -E -R50 -G103 -V100 -P5 +mus_obtain_tmhm.mid: -E -R50 -G012 -V090 -P5 +mus_oceanic_museum.mid: -E -R50 -G023 -V080 +mus_oldale.mid: -E -R50 -G019 -V080 +mus_petalburg_woods.mid: -E -R50 -G018 -V080 +mus_petalburg.mid: -E -R50 -G015 -V080 +mus_poke_center.mid: -E -R50 -G046 -V092 +mus_poke_mart.mid: -E -R50 -G050 -V085 +mus_rayquaza_appears.mid: -E -R50 -G109 -V090 +mus_register_match_call.mid: -E -R50 -G105 -V090 -P5 +mus_rg_berry_pick.mid: -E -R50 -G132 -V090 +mus_rg_caught_intro.mid: -E -R50 -G179 -V094 -P5 +mus_rg_caught.mid: -E -R50 -G170 -V100 +mus_rg_celadon.mid: -E -R50 -G168 -V070 +mus_rg_cinnabar.mid: -E -R50 -G138 -V090 +mus_rg_credits.mid: -E -R50 -G149 -V090 +mus_rg_cycling.mid: -E -R50 -G141 -V090 +mus_rg_dex_rating.mid: -E -R50 -G175 -V070 -P5 +mus_rg_encounter_boy.mid: -E -R50 -G144 -V090 +mus_rg_encounter_deoxys.mid: -E -R50 -G184 -V079 +mus_rg_encounter_girl.mid: -E -R50 -G143 -V051 +mus_rg_encounter_gym_leader: -E -R50 -G144 -V090 +mus_rg_encounter_rival.mid: -E -R50 -G174 -V079 +mus_rg_encounter_rocket.mid: -E -R50 -G142 -V096 +mus_rg_follow_me.mid: -E -R50 -G131 -V068 +mus_rg_fuchsia.mid: -E -R50 -G167 -V090 +mus_rg_game_corner.mid: -E -R50 -G132 -V090 +mus_rg_game_freak.mid: -E -R50 -G181 -V075 +mus_rg_gym.mid: -E -R50 -G134 -V090 +mus_rg_hall_of_fame.mid: -E -R50 -G145 -V079 +mus_rg_heal.mid: -E -R50 -G140 -V090 +mus_rg_intro_fight.mid: -E -R50 -G136 -V090 +mus_rg_jigglypuff.mid: -E -R50 -G135 -V068 -P5 +mus_rg_lavender.mid: -E -R50 -G139 -V090 +mus_rg_mt_moon.mid: -E -R50 -G147 -V090 +mus_rg_mystery_gift.mid: -E -R50 -G183 -V100 +mus_rg_net_center.mid: -E -R50 -G162 -V096 +mus_rg_new_game_exit.mid: -E -R50 -G182 -V088 +mus_rg_new_game_instruct.mid: -E -R50 -G182 -V085 +mus_rg_new_game_intro.mid: -E -R50 -G182 -V088 +mus_rg_oak_lab.mid: -E -R50 -G160 -V075 +mus_rg_oak.mid: -E -R50 -G161 -V086 +mus_rg_obtain_key_item.mid: -E -R50 -G178 -V077 -P5 +mus_rg_pallet.mid: -E -R50 -G159 -V100 +mus_rg_pewter.mid: -E -R50 -G173 -V084 +mus_rg_photo.mid: -E -R50 -G180 -V100 -P5 +mus_rg_poke_center.mid: -E -R50 -G162 -V096 +mus_rg_poke_flute.mid: -E -R50 -G165 -V048 -P5 +mus_rg_poke_jump.mid: -E -R50 -G132 -V090 +mus_rg_poke_mansion.mid: -E -R50 -G148 -V090 +mus_rg_poke_tower.mid: -E -R50 -G165 -V090 +mus_rg_rival_exit.mid: -E -R50 -G174 -V079 +mus_rg_rocket_hideout.mid: -E -R50 -G133 -V090 +mus_rg_route1.mid: -E -R50 -G150 -V079 +mus_rg_route3.mid: -E -R50 -G152 -V083 +mus_rg_route11.mid: -E -R50 -G153 -V090 +mus_rg_route24.mid: -E -R50 -G151 -V086 +mus_rg_sevii_45.mid: -E -R50 -G188 -V084 +mus_rg_sevii_67.mid: -E -R50 -G189 -V084 +mus_rg_sevii_123.mid: -E -R50 -G173 -V084 +mus_rg_sevii_cave.mid: -E -R50 -G147 -V090 +mus_rg_sevii_dungeon.mid: -E -R50 -G146 -V090 +mus_rg_sevii_route.mid: -E -R50 -G187 -V080 +mus_rg_silph.mid: -E -R50 -G166 -V076 +mus_rg_slow_pallet.mid: -E -R50 -G159 -V092 +mus_rg_ss_anne.mid: -E -R50 -G163 -V090 +mus_rg_surf.mid: -E -R50 -G164 -V071 +mus_rg_teachy_tv_menu.mid: -E -R50 -G186 -V059 +mus_rg_teachy_tv_show.mid: -E -R50 -G131 -V068 +mus_rg_title.mid: -E -R50 -G137 -V090 +mus_rg_trainer_tower.mid: -E -R50 -G134 -V090 +mus_rg_union_room.mid: -E -R50 -G132 -V090 +mus_rg_vermillion.mid: -E -R50 -G172 -V090 +mus_rg_victory_gym_leader.mid: -E -R50 -G171 -V090 +mus_rg_victory_road.mid: -E -R50 -G154 -V090 +mus_rg_victory_trainer.mid: -E -R50 -G169 -V089 +mus_rg_victory_wild.mid: -E -R50 -G170 -V090 +mus_rg_viridian_forest.mid: -E -R50 -G146 -V090 +mus_rg_vs_champion.mid: -E -R50 -G158 -V090 +mus_rg_vs_deoxys.mid: -E -R50 -G185 -V080 +mus_rg_vs_gym_leader.mid: -E -R50 -G155 -V090 +mus_rg_vs_legend.mid: -E -R50 -G157 -V090 +mus_rg_vs_mewtwo.mid: -E -R50 -G157 -V090 +mus_rg_vs_trainer.mid: -E -R50 -G156 -V090 +mus_rg_vs_wild.mid: -E -R50 -G157 -V090 +mus_roulette.mid: -E -R50 -G038 -V080 +mus_route101.mid: -E -R50 -G011 -V080 +mus_route104.mid: -E -R50 -G047 -V097 +mus_route110.mid: -E -R50 -G010 -V080 +mus_route111.mid: -E -R50 -G055 -V076 +mus_route113.mid: -E -R50 -G064 -V084 +mus_route119.mid: -E -R50 -G048 -V096 +mus_route120.mid: -E -R50 -G014 -V080 +mus_route122.mid: -E -R50 -G021 -V080 +mus_rustboro.mid: -E -R50 -G045 -V085 +mus_safari_zone.mid: -E -R50 -G074 -V082 +mus_sailing.mid: -E -R50 -G077 -V086 +mus_school.mid: -E -R50 -G081 -V100 +mus_sealed_chamber.mid: -E -R50 -G084 -V100 +mus_slateport.mid: -E -R50 -G079 -V070 +mus_slots_jackpot.mid: -E -R50 -G012 -V090 -P5 +mus_slots_win.mid: -E -R50 -G012 -V090 -P5 +mus_sootopolis.mid: -E -R50 -G091 -V062 +mus_surf.mid: -E -R50 -G017 -V080 +mus_title.mid: -E -R50 -G059 -V090 +mus_too_bad.mid: -E -R50 -G012 -V090 -P5 +mus_trick_house.mid: -E -R50 -G094 -V070 +mus_underwater.mid: -E -R50 -G057 -V094 +mus_verdanturf.mid: -E -R50 -G044 -V090 +mus_victory_aqua_magma.mid: -E -R50 -G070 -V088 +mus_victory_gym_leader.mid: -E -R50 -G024 -V080 +mus_victory_league.mid: -E -R50 -G029 -V080 +mus_victory_road.mid: -E -R50 -G075 -V076 +mus_victory_trainer.mid: -E -R50 -G058 -V091 +mus_victory_wild.mid: -E -R50 -G025 -V080 +mus_vs_aqua_magma_leader.mid: -E -R50 -G126 -V080 -P1 +mus_vs_aqua_magma.mid: -E -R50 -G118 -V080 -P1 +mus_vs_champion.mid: -E -R50 -G121 -V080 -P1 +mus_vs_elite_four.mid: -E -R50 -G125 -V080 -P1 +mus_vs_frontier_brain.mid: -E -R50 -G115 -V090 -P1 +mus_vs_gym_leader.mid: -E -R50 -G120 -V080 -P1 +mus_vs_kyogre_groudon.mid: -E -R50 -G123 -V080 -P1 +mus_vs_mew.mid: -E -R50 -G116 -V090 +mus_vs_rayquaza.mid: -E -R50 -G114 -V080 -P1 +mus_vs_regi.mid: -E -R50 -G122 -V080 -P1 +mus_vs_rival.mid: -E -R50 -G124 -V080 -P1 +mus_vs_trainer.mid: -E -R50 -G119 -V080 -P1 +mus_vs_wild.mid: -E -R50 -G117 -V080 -P1 +mus_weather_groudon.mid: -E -R50 -G090 -V050 +ph_choice_blend.mid: -E -G130 -P4 +ph_choice_held.mid: -E -G130 -P4 +ph_choice_solo.mid: -E -G130 -P4 +ph_cloth_blend.mid: -E -G130 -P4 +ph_cloth_held.mid: -E -G130 -P4 +ph_cloth_solo.mid: -E -G130 -P4 +ph_cure_blend.mid: -E -G130 -P4 +ph_cure_held.mid: -E -G130 -P4 +ph_cure_solo.mid: -E -G130 -P4 +ph_dress_blend.mid: -E -G130 -P4 +ph_dress_held.mid: -E -G130 -P4 +ph_dress_solo.mid: -E -G130 -P4 +ph_face_blend.mid: -E -G130 -P4 +ph_face_held.mid: -E -G130 -P4 +ph_face_solo.mid: -E -G130 -P4 +ph_fleece_blend.mid: -E -G130 -P4 +ph_fleece_held.mid: -E -G130 -P4 +ph_fleece_solo.mid: -E -G130 -P4 +ph_foot_blend.mid: -E -G130 -P4 +ph_foot_held.mid: -E -G130 -P4 +ph_foot_solo.mid: -E -G130 -P4 +ph_goat_blend.mid: -E -G130 -P4 +ph_goat_held.mid: -E -G130 -P4 +ph_goat_solo.mid: -E -G130 -P4 +ph_goose_blend.mid: -E -G130 -P4 +ph_goose_held.mid: -E -G130 -P4 +ph_goose_solo.mid: -E -G130 -P4 +ph_kit_blend.mid: -E -G130 -P4 +ph_kit_held.mid: -E -G130 -P4 +ph_kit_solo.mid: -E -G130 -P4 +ph_lot_blend.mid: -E -G130 -P4 +ph_lot_held.mid: -E -G130 -P4 +ph_lot_solo.mid: -E -G130 -P4 +ph_mouth_blend.mid: -E -G130 -P4 +ph_mouth_held.mid: -E -G130 -P4 +ph_mouth_solo.mid: -E -G130 -P4 +ph_nurse_blend.mid: -E -G130 -P4 +ph_nurse_held.mid: -E -G130 -P4 +ph_nurse_solo.mid: -E -G130 -P4 +ph_price_blend.mid: -E -G130 -P4 +ph_price_held.mid: -E -G130 -P4 +ph_price_solo.mid: -E -G130 -P4 +ph_strut_blend.mid: -E -G130 -P4 +ph_strut_held.mid: -E -G130 -P4 +ph_strut_solo.mid: -E -G130 -P4 +ph_thought_blend.mid: -E -G130 -P4 +ph_thought_held.mid: -E -G130 -P4 +ph_thought_solo.mid: -E -G130 -P4 +ph_trap_blend.mid: -E -G130 -P4 +ph_trap_held.mid: -E -G130 -P4 +ph_trap_solo.mid: -E -G130 -P4 +se_a.mid: -E -R50 -G128 -V095 -P4 +se_applause.mid: -E -R50 -G128 -V100 -P5 +se_arena_timeup1.mid: -E -R50 -G129 -P5 +se_arena_timeup2.mid: -E -R50 -G129 -P5 +se_ball_bounce_1.mid: -E -R50 -G128 -V100 -P4 +se_ball_bounce_2.mid: -E -R50 -G128 -V100 -P4 +se_ball_bounce_3.mid: -E -R50 -G128 -V100 -P4 +se_ball_bounce_4.mid: -E -R50 -G128 -V100 -P4 +se_ball_open.mid: -E -R50 -G127 -V100 -P5 +se_ball_throw.mid: -E -R50 -G128 -V120 -P5 +se_ball_trade.mid: -E -R50 -G127 -V100 -P5 +se_ball_tray_ball.mid: -E -R50 -G128 -V110 -P5 +se_ball_tray_enter.mid: -E -R50 -G128 -V110 -P5 +se_ball_tray_exit.mid: -E -R50 -G127 -V100 -P5 +se_ball.mid: -E -R50 -G127 -V070 -P4 +se_balloon_blue.mid: -E -R50 -G128 -V105 -P4 +se_balloon_red.mid: -E -R50 -G128 -V105 -P4 +se_balloon_yellow.mid: -E -R50 -G128 -V105 -P4 +se_bang.mid: -E -R50 -G128 -V110 -P4 +se_berry_blender.mid: -E -R50 -G128 -V090 -P4 +se_bike_bell.mid: -E -R50 -G128 -V090 -P4 +se_bike_hop.mid: -E -R50 -G127 -V090 -P4 +se_boo.mid: -E -R50 -G127 -V110 -P4 +se_breakable_door.mid: -E -R50 -G128 -V110 -P4 +se_bridge_walk.mid: -E -R50 -G128 -V095 -P4 +se_card.mid: -E -R50 -G127 -V100 -P4 +se_click.mid: -E -R50 -G127 -V110 -P4 +se_contest_condition_lose.mid: -E -R50 -G127 -V110 -P4 +se_contest_curtain_fall.mid: -E -R50 -G128 -V070 -P5 +se_contest_curtain_rise.mid: -E -R50 -G128 -V070 -P5 +se_contest_heart.mid: -E -R50 -G128 -V090 -P5 +se_contest_icon_change.mid: -E -R50 -G128 -V110 -P5 +se_contest_icon_clear.mid: -E -R50 -G128 -V090 -P5 +se_contest_mons_turn.mid: -E -R50 -G128 -V090 -P5 +se_contest_place.mid: -E -R50 -G127 -V110 -P4 +se_dex_search.mid: -E -R50 -G127 -v100 -P5 +se_ding_dong.mid: -E -R50 -G127 -V090 -P5 +se_door.mid: -E -R50 -G127 -V080 -P5 +se_downpour_stop.mid: -E -R50 -G128 -V100 -P2 +se_downpour.mid: -E -R50 -G128 -V100 -P2 +se_e.mid: -E -R50 -G128 -V120 -P4 +se_effective.mid: -E -R50 -G127 -V110 -P5 +se_egg_hatch.mid: -E -R50 -G128 -V120 -P5 +se_elevator.mid: -E -R50 -G128 -V100 -P4 +se_escalator.mid: -E -R50 -G128 -V100 -P4 +se_exit.mid: -E -R50 -G127 -V120 -P5 +se_exp_max.mid: -E -R50 -G128 -V094 -P5 +se_exp.mid: -E -R50 -G127 -V080 -P5 +se_failure.mid: -E -R50 -G127 -V120 -P4 +se_faint.mid: -E -R50 -G127 -V110 -P5 +se_fall.mid: -E -R50 -G128 -V110 -P4 +se_field_poison.mid: -E -R50 -G127 -V110 -P5 +se_flee.mid: -E -R50 -G127 -V090 -P5 +se_fu_zaku.mid: -E -R50 -G127 -V120 -P4 +se_glass_flute.mid: -E -R50 -G128 -V105 -P5 +se_i.mid: -E -R50 -G128 -V120 -P4 +se_ice_break.mid: -E -R50 -G128 -V100 -P4 +se_ice_crack.mid: -E -R50 -G127 -V100 -P4 +se_ice_stairs.mid: -E -R50 -G128 -V090 -P4 +se_intro_blast.mid: -E -R50 -G127 -V100 -P5 +se_itemfinder.mid: -E -R50 -G127 -V090 -P5 +se_lavaridge_fall_warp.mid: -E -R50 -G127 -P4 +se_ledge.mid: -E -R50 -G127 -V100 -P4 +se_low_health.mid: -E -R50 -G127 -V100 -P3 +se_m_bind.mid: -E -R50 -G128 -V100 -P4 +se_m_comet_punch.mid: -E -R50 -G128 -V120 -P4 +se_m_cut.mid: -E -R50 -G128 -V120 -P4 +se_m_double_slap.mid: -E -R50 -G128 -V110 -P4 +se_m_fire_punch.mid: -E -R50 -G128 -V110 -P4 +se_m_fly.mid: -E -R50 -G128 -V110 -P4 +se_m_gust.mid: -E -R50 -G128 -V110 -P4 +se_m_gust2.mid: -E -R50 -G128 -V110 -P4 +se_m_headbutt.mid: -E -R50 -G128 -V110 -P4 +se_m_horn_attack.mid: -E -R50 -G128 -V110 -P4 +se_m_jump_kick.mid: -E -R50 -G128 -V110 -P4 +se_m_leer.mid: -E -R50 -G128 -V110 -P4 +se_m_mega_kick.mid: -E -R50 -G128 -V090 -P4 +se_m_mega_kick2.mid: -E -R50 -G128 -V110 -P4 +se_m_pay_day.mid: -E -R50 -G128 -V095 -P4 +se_m_razor_wind.mid: -E -R50 -G128 -V110 -P4 +se_m_razor_wind2.mid: -E -R50 -G128 -V090 -P4 +se_m_sand_attack.mid: -E -R50 -G128 -V110 -P4 +se_m_scratch.mid: -E -R50 -G128 -V110 -P4 +se_m_swords_dance.mid: -E -R50 -G128 -V100 -P4 +se_m_tail_whip.mid: -E -R50 -G128 -V110 -P4 +se_m_take_down.mid: -E -R50 -G128 -V105 -P4 +se_m_vicegrip.mid: -E -R50 -G128 -V110 -P4 +se_m_wing_attack.mid: -E -R50 -G128 -V105 -P4 +se_mud_ball.mid: -E -R50 -G128 -V110 -P4 +se_mugshot.mid: -E -R50 -G128 -V090 -P5 +se_n.mid: -E -R50 -G128 -P4 +se_not_effective.mid: -E -R50 -G127 -V110 -P5 +se_note_a.mid: -E -R50 -G128 -V110 -P4 +se_note_b.mid: -E -R50 -G128 -V110 -P4 +se_note_c_high.mid: -E -R50 -G128 -V110 -P4 +se_note_c.mid: -E -R50 -G128 -V110 -P4 +se_note_d.mid: -E -R50 -G128 -V110 -P4 +se_note_e.mid: -E -R50 -G128 -V110 -P4 +se_note_f.mid: -E -R50 -G128 -V110 -P4 +se_note_g.mid: -E -R50 -G128 -V110 -P4 +se_o.mid: -E -R50 -G128 -V120 -P4 +se_orb.mid: -E -R50 -G128 -V100 -P5 +se_pc_login.mid: -E -R50 -G127 -V100 -P5 +se_pc_off.mid: -E -R50 -G127 -V100 -P5 +se_pc_on.mid: -E -R50 -G127 -V100 -P5 +se_pike_curtain_close.mid: -E -R50 -G129 -P5 +se_pike_curtain_open.mid: -E -R50 -G129 -P5 +se_pin.mid: -E -R50 -G127 -V060 -P4 +se_pokenav_call.mid: -E -R50 -G129 -V120 -P5 +se_pokenav_hang_up.mid: -E -R50 -G129 -V110 -P5 +se_pokenav_off.mid: -E -R50 -G127 -V100 -P5 +se_pokenav_on.mid: -E -R50 -G127 -V100 -P5 +se_puddle.mid: -E -R50 -G128 -V020 -P4 +se_rain_stop.mid: -E -R50 -G128 -V080 -P2 +se_rain.mid: -E -R50 -G128 -V080 -P2 +se_repel.mid: -E -R50 -G127 -V090 -P4 +se_rg_bag_cursor.mid: -E -R50 -G129 -P5 +se_rg_bag_pocket.mid: -E -R50 -G129 -P5 +se_rg_ball_click.mid: -E -R50 -G129 -V100 -P5 +se_rg_card_flip.mid: -E -R50 -G129 -P5 +se_rg_card_flipping.mid: -E -R50 -G129 -P5 +se_rg_card_open.mid: -E -R50 -G129 -V112 -P5 +se_rg_deoxys_move.mid: -E -R50 -G129 -V080 -P5 +se_rg_door.mid: -E -R50 -G129 -V100 -P5 +se_rg_help_close.mid: -E -R50 -G129 -V095 -P5 +se_rg_help_error.mid: -E -R50 -G129 -V125 -P5 +se_rg_help_open.mid: -E -R50 -G129 -V096 -P5 +se_rg_poke_jump_failure.mid: -E -R50 -G127 -P5 +se_rg_poke_jump_success.mid: -E -R50 -G128 -V110 -P5 +se_rg_shop.mid: -E -R50 -G129 -V080 -P5 +se_rg_ss_anne_horn.mid: -E -R50 -G129 -V096 -P5 +se_rotating_gate.mid: -E -R50 -G128 -V090 -P4 +se_roulette_ball.mid: -E -R50 -G128 -V110 -P2 +se_roulette_ball2.mid: -E -R50 -G128 -V110 -P2 +se_save.mid: -E -R50 -G128 -V080 -P5 +se_select.mid: -E -R50 -G127 -V080 -P5 +se_shiny.mid: -E -R50 -G128 -V095 -P5 +se_ship.mid: -E -R50 -G127 -V075 -P4 +se_shop.mid: -E -R50 -G127 -V090 -P5 +se_sliding_door.mid: -E -R50 -G128 -V095 -P4 +se_success.mid: -E -R50 -G127 -V080 -P4 +se_sudowoodo_shake.mid: -E -R50 -G129 -V077 -P5 +se_super_effective.mid: -E -R50 -G127 -V110 -P5 +se_switch.mid: -E -R50 -G127 -V100 -P4 +se_taillow_wing_flap.mid: -E -R50 -G128 -V105 -P5 +se_thunder.mid: -E -R50 -G128 -V110 -P3 +se_thunder2.mid: -E -R50 -G128 -V110 -P3 +se_thunderstorm_stop.mid: -E -R50 -G128 -V080 -P2 +se_thunderstorm.mid: -E -R50 -G128 -V080 -P2 +se_truck_door.mid: -E -R50 -G128 -V110 -P4 +se_truck_move.mid: -E -R50 -G128 -P4 +se_truck_stop.mid: -E -R50 -G128 -P4 +se_truck_unload.mid: -E -R50 -G127 -P4 +se_u.mid: -E -R50 -G128 -P4 +se_unlock.mid: -E -R50 -G128 -V100 -P4 +se_use_item.mid: -E -R50 -G127 -V100 -P5 +se_vend.mid: -E -R50 -G128 -V110 -P4 +se_warp_in.mid: -E -R50 -G127 -V090 -P4 +se_warp_out.mid: -E -R50 -G127 -V090 -P4 diff --git a/src/AgbRfu_LinkManager.c b/src/AgbRfu_LinkManager.c index e4ee377f7b7d..d696c01d3c14 100644 --- a/src/AgbRfu_LinkManager.c +++ b/src/AgbRfu_LinkManager.c @@ -14,7 +14,7 @@ #define FSP_ON 0x01 #define FSP_START 0x02 -LINK_MANAGER lman; +COMMON_DATA LINK_MANAGER lman = {0}; static void rfu_LMAN_clearVariables(void); static void rfu_LMAN_settingPCSWITCH(u32 rand); diff --git a/src/agb_flash.c b/src/agb_flash.c index 6b9381c704da..ffec206fee09 100644 --- a/src/agb_flash.c +++ b/src/agb_flash.c @@ -6,16 +6,16 @@ static u16 sTimerCount; static vu16 *sTimerReg; static u16 sSavedIme; -u8 gFlashTimeoutFlag; -u8 (*PollFlashStatus)(u8 *); -u16 (*WaitForFlashWrite)(u8 phase, u8 *addr, u8 lastData); -u16 (*ProgramFlashSector)(u16 sectorNum, u8 *src); -const struct FlashType *gFlash; -u16 (*ProgramFlashByte)(u16 sectorNum, u32 offset, u8 data); -u16 gFlashNumRemainingBytes; -u16 (*EraseFlashChip)(); -u16 (*EraseFlashSector)(u16 sectorNum); -const u16 *gFlashMaxTime; +COMMON_DATA u8 gFlashTimeoutFlag = 0; +COMMON_DATA u8 (*PollFlashStatus)(u8 *) = NULL; +COMMON_DATA u16 (*WaitForFlashWrite)(u8 phase, u8 *addr, u8 lastData) = NULL; +COMMON_DATA u16 (*ProgramFlashSector)(u16 sectorNum, u8 *src) = NULL; +COMMON_DATA const struct FlashType *gFlash = NULL; +COMMON_DATA u16 (*ProgramFlashByte)(u16 sectorNum, u32 offset, u8 data) = NULL; +COMMON_DATA u16 gFlashNumRemainingBytes = 0; +COMMON_DATA u16 (*EraseFlashChip)() = NULL; +COMMON_DATA u16 (*EraseFlashSector)(u16 sectorNum) = 0; +COMMON_DATA const u16 *gFlashMaxTime = NULL; void SetReadFlash1(u16 *dest); diff --git a/src/apprentice.c b/src/apprentice.c index 6a7137606347..66011fe76ce9 100644 --- a/src/apprentice.c +++ b/src/apprentice.c @@ -75,9 +75,9 @@ struct ApprenticeQuestionData }; // IWRAM common -struct ApprenticePartyMovesData *gApprenticePartyMovesData; -struct ApprenticeQuestionData *gApprenticeQuestionData; -void (*gApprenticeFunc)(void); +COMMON_DATA struct ApprenticePartyMovesData *gApprenticePartyMovesData = NULL; +COMMON_DATA struct ApprenticeQuestionData *gApprenticeQuestionData = NULL; +COMMON_DATA void (*gApprenticeFunc)(void) = NULL; // This file's functions. static u16 GetRandomAlternateMove(u8 monId); diff --git a/src/battle_anim_throw.c b/src/battle_anim_throw.c index 6a23807a133a..81407824fa17 100644 --- a/src/battle_anim_throw.c +++ b/src/battle_anim_throw.c @@ -23,9 +23,9 @@ #include "constants/rgb.h" // iwram -u32 gMonShrinkDuration; -u16 gMonShrinkDelta; -u16 gMonShrinkDistance; +COMMON_DATA u32 gMonShrinkDuration = 0; +COMMON_DATA u16 gMonShrinkDelta = 0; +COMMON_DATA u16 gMonShrinkDistance = 0; enum { BALL_ROLL_1, diff --git a/src/battle_controllers.c b/src/battle_controllers.c index 37e89d8acb64..a983263c0443 100644 --- a/src/battle_controllers.c +++ b/src/battle_controllers.c @@ -30,9 +30,9 @@ static EWRAM_DATA u8 sLinkSendTaskId = 0; static EWRAM_DATA u8 sLinkReceiveTaskId = 0; EWRAM_DATA struct UnusedControllerStruct gUnusedControllerStruct = {}; // Debug? Unused code that writes to it, never read -void (*gBattlerControllerFuncs[MAX_BATTLERS_COUNT])(u32 battler); -u8 gBattleControllerData[MAX_BATTLERS_COUNT]; // Used by the battle controllers to store misc sprite/task IDs for each battler -void (*gBattlerControllerEndFuncs[MAX_BATTLERS_COUNT])(u32 battler); // Controller's buffer complete function for each battler +COMMON_DATA void (*gBattlerControllerFuncs[MAX_BATTLERS_COUNT])(u32 battler) = {0}; +COMMON_DATA u8 gBattleControllerData[MAX_BATTLERS_COUNT] = {0}; // Used by the battle controllers to store misc sprite/task IDs for each battler +COMMON_DATA void (*gBattlerControllerEndFuncs[MAX_BATTLERS_COUNT])(u32 battler) = {0}; // Controller's buffer complete function for each battler static void CreateTasksForSendRecvLinkBuffers(void); static void InitLinkBtlControllers(void); diff --git a/src/battle_factory_screen.c b/src/battle_factory_screen.c index f76c6a2fc830..4119db47bd21 100644 --- a/src/battle_factory_screen.c +++ b/src/battle_factory_screen.c @@ -256,7 +256,7 @@ static struct FactorySelectScreen *sFactorySelectScreen; static void (*sSwap_CurrentOptionFunc)(u8 taskId); static struct FactorySwapScreen *sFactorySwapScreen; -u8 (*gFactorySelect_CurrentOptionFunc)(void); +COMMON_DATA u8 (*gFactorySelect_CurrentOptionFunc)(void) = NULL; static const u16 sPokeballGray_Pal[] = INCBIN_U16("graphics/battle_frontier/factory_screen/pokeball_gray.gbapal"); static const u16 sPokeballSelected_Pal[] = INCBIN_U16("graphics/battle_frontier/factory_screen/pokeball_selected.gbapal"); diff --git a/src/battle_main.c b/src/battle_main.c index df39e745ac06..8ff460b0fb5c 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -236,13 +236,13 @@ EWRAM_DATA u8 gPartyCriticalHits[PARTY_SIZE] = {0}; EWRAM_DATA static u8 sTriedEvolving = 0; EWRAM_DATA u8 gCategoryIconSpriteId = 0; -void (*gPreBattleCallback1)(void); -void (*gBattleMainFunc)(void); -struct BattleResults gBattleResults; -u8 gLeveledUpInBattle; -u8 gHealthboxSpriteIds[MAX_BATTLERS_COUNT]; -u8 gMultiUsePlayerCursor; -u8 gNumberOfMovesToChoose; +COMMON_DATA void (*gPreBattleCallback1)(void) = NULL; +COMMON_DATA void (*gBattleMainFunc)(void) = NULL; +COMMON_DATA struct BattleResults gBattleResults = {0}; +COMMON_DATA u8 gLeveledUpInBattle = 0; +COMMON_DATA u8 gHealthboxSpriteIds[MAX_BATTLERS_COUNT] = {0}; +COMMON_DATA u8 gMultiUsePlayerCursor = 0; +COMMON_DATA u8 gNumberOfMovesToChoose = 0; static const struct ScanlineEffectParams sIntroScanlineParams16Bit = { diff --git a/src/battle_setup.c b/src/battle_setup.c index 54c4f99b9289..0c13fcdd09ca 100644 --- a/src/battle_setup.c +++ b/src/battle_setup.c @@ -927,7 +927,7 @@ u8 GetTrainerBattleTransition(void) return sBattleTransitionTable_Trainer[transitionType][1]; } -#define RANDOM_TRANSITION(table)(table[Random() % ARRAY_COUNT(table)]) +#define RANDOM_TRANSITION(table) (table[Random() % ARRAY_COUNT(table)]) u8 GetSpecialBattleTransition(s32 id) { u16 var; @@ -1729,7 +1729,7 @@ static inline bool32 DoesCurrentMapMatchRematchTrainerMap(s32 i, const struct Re bool32 TrainerIsMatchCallRegistered(s32 i) { - return FlagGet(FLAG_MATCH_CALL_REGISTERED + i); + return FlagGet(TRAINER_REGISTERED_FLAGS_START + i); } #if FREE_MATCH_CALL == FALSE @@ -1887,7 +1887,7 @@ static u32 GetTrainerMatchCallFlag(u32 trainerId) for (i = 0; i < REMATCH_TABLE_ENTRIES; i++) { if (gRematchTable[i].trainerIds[0] == trainerId) - return FLAG_MATCH_CALL_REGISTERED + i; + return TRAINER_REGISTERED_FLAGS_START + i; } return 0xFFFF; diff --git a/src/battle_tower.c b/src/battle_tower.c index 72858a854c72..6f80823b9857 100644 --- a/src/battle_tower.c +++ b/src/battle_tower.c @@ -45,7 +45,7 @@ EWRAM_DATA const struct BattleFrontierTrainer *gFacilityTrainers = NULL; EWRAM_DATA const struct TrainerMon *gFacilityTrainerMons = NULL; // IWRAM common -u16 gFrontierTempParty[MAX_FRONTIER_PARTY_SIZE]; +COMMON_DATA u16 gFrontierTempParty[MAX_FRONTIER_PARTY_SIZE] = {0}; // This file's functions. static void InitTowerChallenge(void); diff --git a/src/battle_transition.c b/src/battle_transition.c index b2b295e16e71..fbaa5cc0de34 100644 --- a/src/battle_transition.c +++ b/src/battle_transition.c @@ -1873,7 +1873,11 @@ static bool8 ClockwiseWipe_TopRight(struct Task *task) { sTransitionData->VBlank_DMA = FALSE; +#ifdef UBFIX + InitBlackWipe(sTransitionData->data, DISPLAY_WIDTH / 2, DISPLAY_HEIGHT / 2, sTransitionData->tWipeEndX, 0, 1, 1); +#else InitBlackWipe(sTransitionData->data, DISPLAY_WIDTH / 2, DISPLAY_HEIGHT / 2, sTransitionData->tWipeEndX, -1, 1, 1); +#endif do { gScanlineEffectRegBuffers[0][sTransitionData->tWipeCurrY] = (sTransitionData->tWipeCurrX + 1) | ((DISPLAY_WIDTH / 2) << 8); diff --git a/src/berry_blender.c b/src/berry_blender.c index 0af3fd3ba646..c758a572ab2e 100644 --- a/src/berry_blender.c +++ b/src/berry_blender.c @@ -246,7 +246,7 @@ static s16 sPokeblockPresentFlavors[FLAVOR_COUNT + 1]; static s16 sDebug_MaxRPMStage; static s16 sDebug_GameTimeStage; -u8 gInGameOpponentsNo; +COMMON_DATA u8 gInGameOpponentsNo = 0; static const u16 sBlenderCenter_Pal[] = INCBIN_U16("graphics/berry_blender/center.gbapal"); static const u8 sBlenderCenter_Tilemap[] = INCBIN_U8("graphics/berry_blender/center_map.bin"); diff --git a/gflib/bg.c b/src/bg.c similarity index 99% rename from gflib/bg.c rename to src/bg.c index 08bc402f7191..27a5fb0501bd 100644 --- a/gflib/bg.c +++ b/src/bg.c @@ -38,7 +38,7 @@ static struct BgControl sGpuBgConfigs; static struct BgConfig2 sGpuBgConfigs2[NUM_BACKGROUNDS]; static u32 sDmaBusyBitfield[NUM_BACKGROUNDS]; -u32 gWindowTileAutoAllocEnabled; +COMMON_DATA u32 gWindowTileAutoAllocEnabled = 0; static const struct BgConfig sZeroedBgControlStruct = { 0 }; diff --git a/gflib/blit.c b/src/blit.c similarity index 100% rename from gflib/blit.c rename to src/blit.c diff --git a/src/cable_car.c b/src/cable_car.c index 347f4e87e85f..b5d3d0f53f6f 100644 --- a/src/cable_car.c +++ b/src/cable_car.c @@ -880,8 +880,12 @@ static void CreateCableCarSprites(void) // 1/64 chance for an NPC to appear hiking on the ground below the Cable Car if ((rval % 64) == 0) { - // Unclear if this was intentional, but the - 1 in the below ARRAY_COUNT means the Zigzagoon is never used + // BUGFIX: The - 1 in the below ARRAY_COUNT means the Zigzagoon is never used +#ifdef BUGFIX + spriteId = CreateObjectGraphicsSprite(hikerGraphicsIds[rval % ARRAY_COUNT(hikerGraphicsIds)], hikerCallbacks[GOING_DOWN], hikerCoords[GOING_DOWN][0], hikerCoords[GOING_DOWN][1], 106); +#else spriteId = CreateObjectGraphicsSprite(hikerGraphicsIds[rval % (ARRAY_COUNT(hikerGraphicsIds) - 1)], hikerCallbacks[GOING_DOWN], hikerCoords[GOING_DOWN][0], hikerCoords[GOING_DOWN][1], 106); +#endif if (spriteId != MAX_SPRITES) { gSprites[spriteId].oam.priority = 2; diff --git a/src/contest.c b/src/contest.c index be8bb3e92b3a..16e5fde9afcf 100644 --- a/src/contest.c +++ b/src/contest.c @@ -358,7 +358,7 @@ EWRAM_DATA bool8 gCurContestWinnerIsForArtist = 0; EWRAM_DATA u8 gCurContestWinnerSaveIdx = 0; // IWRAM common vars. -rng_value_t gContestRngValue; +COMMON_DATA rng_value_t gContestRngValue = {0}; extern const u8 gText_LinkStandby4[]; extern const u8 gText_BDot[]; diff --git a/src/contest_painting.c b/src/contest_painting.c index 922b8785314f..8b647be12f04 100644 --- a/src/contest_painting.c +++ b/src/contest_painting.c @@ -21,10 +21,10 @@ #include "window.h" #include "constants/rgb.h" -u16 (*gContestMonPixels)[][32]; -struct ImageProcessingContext gImageProcessingContext; -struct ContestWinner *gContestPaintingWinner; -u16 *gContestPaintingMonPalette; +COMMON_DATA u16 (*gContestMonPixels)[][32] = {0}; +COMMON_DATA struct ImageProcessingContext gImageProcessingContext = {0}; +COMMON_DATA struct ContestWinner *gContestPaintingWinner = {0}; +COMMON_DATA u16 *gContestPaintingMonPalette = NULL; static u8 sHoldState; static u16 sMosaicVal; diff --git a/src/data/decoration/tilemaps.h b/src/data/decoration/tilemaps.h index eebb3acb251d..d6c351ae85f3 100644 --- a/src/data/decoration/tilemaps.h +++ b/src/data/decoration/tilemaps.h @@ -171,7 +171,7 @@ static const u8 sDecorTilemap_3x2_X[] = { 0x06, 0x07, 0x06, 0x07, 0x06, 0x07 }; -#define DECORSIZE(width, height)((width) * (height) * 4) +#define DECORSIZE(width, height) ((width) * (height) * 4) static const struct { const u8 *tiles; diff --git a/src/data/pokemon/experience_tables.h b/src/data/pokemon/experience_tables.h index 8f50e1091856..848d5c5016bd 100644 --- a/src/data/pokemon/experience_tables.h +++ b/src/data/pokemon/experience_tables.h @@ -1,10 +1,10 @@ -#define SQUARE(n)((n) * (n)) -#define CUBE(n)((n) * (n) * (n)) +#define SQUARE(n) ((n) * (n)) +#define CUBE(n) ((n) * (n) * (n)) -#define EXP_SLOW(n)((5 * CUBE(n)) / 4) // (5 * (n)^3) / 4 -#define EXP_FAST(n)((4 * CUBE(n)) / 5) // (4 * (n)^3) / 5 -#define EXP_MEDIUM_FAST(n)(CUBE(n)) // (n)^3 -#define EXP_MEDIUM_SLOW(n)((6 * CUBE(n)) / 5 - (15 * SQUARE(n)) + (100 * n) - 140) // (6 * (n)^3) / 5 - (15 * (n)^2) + (100 * n) - 140 +#define EXP_SLOW(n) ((5 * CUBE(n)) / 4) // (5 * (n)^3) / 4 +#define EXP_FAST(n) ((4 * CUBE(n)) / 5) // (4 * (n)^3) / 5 +#define EXP_MEDIUM_FAST(n) (CUBE(n)) // (n)^3 +#define EXP_MEDIUM_SLOW(n) ((6 * CUBE(n)) / 5 - (15 * SQUARE(n)) + (100 * n) - 140) // (6 * (n)^3) / 5 - (15 * (n)^2) + (100 * n) - 140 #define EXP_ERRATIC(n) \ (n <= 50) ? ((100 - n) * CUBE(n) / 50) \ :(n <= 68) ? ((150 - n) * CUBE(n) / 100) \ diff --git a/src/data/union_room.h b/src/data/union_room.h index 89b57c3d39f1..ada118b96aae 100644 --- a/src/data/union_room.h +++ b/src/data/union_room.h @@ -633,10 +633,10 @@ static const struct WindowTemplate sWindowTemplate_BButtonCancel = { // Minimum and maximum number of players for a link group // A minimum of 0 means the min and max are equal -#define LINK_GROUP_CAPACITY(min, max)(((min) << 12) | ((max) << 8)) -#define GROUP_MAX(capacity)(capacity & 0x0F) -#define GROUP_MIN(capacity)(capacity >> 4) -#define GROUP_MIN2(capacity)(capacity & 0xF0) // Unnecessary to have both, but needed to match +#define LINK_GROUP_CAPACITY(min, max) (((min) << 12) | ((max) << 8)) +#define GROUP_MAX(capacity) (capacity & 0x0F) +#define GROUP_MIN(capacity) (capacity >> 4) +#define GROUP_MIN2(capacity) (capacity & 0xF0) // Unnecessary to have both, but needed to match static const u32 sLinkGroupToActivityAndCapacity[NUM_LINK_GROUP_TYPES] = { [LINK_GROUP_SINGLE_BATTLE] = ACTIVITY_BATTLE_SINGLE | LINK_GROUP_CAPACITY(0, 2), diff --git a/gflib/dma3_manager.c b/src/dma3_manager.c similarity index 100% rename from gflib/dma3_manager.c rename to src/dma3_manager.c diff --git a/src/ereader_screen.c b/src/ereader_screen.c index c625c78a9e3c..556acf8e3c59 100755 --- a/src/ereader_screen.c +++ b/src/ereader_screen.c @@ -40,7 +40,10 @@ struct EReaderData static void Task_EReader(u8); -struct EReaderData gEReaderData; +// This belongs in COMMON somewhere between party_menu and ereader_screen, but it's unused so it's unclear where. +COMMON_DATA UNUSED u8 gUnknownSpace[64] = {0}; + +COMMON_DATA struct EReaderData gEReaderData = {0}; extern const u8 gMultiBootProgram_EReader_Start[]; extern const u8 gMultiBootProgram_EReader_End[]; diff --git a/src/evolution_scene.c b/src/evolution_scene.c index 98879430cb37..e52e5b9a4344 100644 --- a/src/evolution_scene.c +++ b/src/evolution_scene.c @@ -47,7 +47,7 @@ struct EvoInfo static EWRAM_DATA struct EvoInfo *sEvoStructPtr = NULL; static EWRAM_DATA u16 *sBgAnimPal = NULL; -void (*gCB2_AfterEvolution)(void); +COMMON_DATA void (*gCB2_AfterEvolution)(void) = NULL; #define sEvoCursorPos gBattleCommunication[1] // when learning a new move #define sEvoGraphicsTaskId gBattleCommunication[2] diff --git a/src/field_camera.c b/src/field_camera.c index 31ebc63c0529..290ddddaf178 100644 --- a/src/field_camera.c +++ b/src/field_camera.c @@ -39,9 +39,9 @@ static s16 sVerticalCameraPan; static bool8 sBikeCameraPanFlag; static void (*sFieldCameraPanningCallback)(void); -struct CameraObject gFieldCamera; -u16 gTotalCameraPixelOffsetY; -u16 gTotalCameraPixelOffsetX; +COMMON_DATA struct CameraObject gFieldCamera = {0}; +COMMON_DATA u16 gTotalCameraPixelOffsetY = 0; +COMMON_DATA u16 gTotalCameraPixelOffsetX = 0; static void ResetCameraOffset(struct FieldCameraOffset *cameraOffset) { diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index 582617d555a1..8f3f8c697a3d 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -40,7 +40,7 @@ static EWRAM_DATA u8 sWildEncounterImmunitySteps = 0; static EWRAM_DATA u16 sPrevMetatileBehavior = 0; -u8 gSelectedObjectEvent; +COMMON_DATA u8 gSelectedObjectEvent = 0; static void GetPlayerPosition(struct MapPosition *); static void GetInFrontOfPlayerPosition(struct MapPosition *); diff --git a/src/field_poison.c b/src/field_poison.c index 655bd9ec023c..30ae7c21a7a1 100644 --- a/src/field_poison.c +++ b/src/field_poison.c @@ -93,7 +93,11 @@ static void Task_TryFieldPoisonWhiteOut(u8 taskId) if (AllMonsFainted()) { // Battle facilities have their own white out script to handle the challenge loss +#ifdef BUGFIX + if (InBattlePyramid() || InBattlePike() || InTrainerHillChallenge()) +#else if (InBattlePyramid() | InBattlePike() || InTrainerHillChallenge()) +#endif gSpecialVar_Result = FLDPSN_FRONTIER_WHITEOUT; else gSpecialVar_Result = FLDPSN_WHITEOUT; diff --git a/src/field_specials.c b/src/field_specials.c index e00aa0380313..a8b8427d15cd 100644 --- a/src/field_specials.c +++ b/src/field_specials.c @@ -96,7 +96,7 @@ static EWRAM_DATA u8 sFrontierExchangeCorner_ItemIconWindowId = 0; static EWRAM_DATA u8 sPCBoxToSendMon = 0; static EWRAM_DATA u32 sBattleTowerMultiBattleTypeFlags = 0; -struct ListMenuTemplate gScrollableMultichoice_ListMenuTemplate; +COMMON_DATA struct ListMenuTemplate gScrollableMultichoice_ListMenuTemplate = {0}; EWRAM_DATA u16 gScrollableMultichoice_ScrollOffset = 0; void TryLoseFansFromPlayTime(void); @@ -272,7 +272,7 @@ u16 GetRecordedCyclingRoadResults(void) void UpdateCyclingRoadState(void) { - if (gLastUsedWarp.mapNum == MAP_NUM(ROUTE110_SEASIDE_CYCLING_ROAD_SOUTH_ENTRANCE) && gLastUsedWarp.mapGroup == MAP_GROUP(ROUTE110_SEASIDE_CYCLING_ROAD_SOUTH_ENTRANCE)) + if (gLastUsedWarp.mapNum == MAP_NUM(ROUTE110_SEASIDE_CYCLING_ROAD_NORTH_ENTRANCE) && gLastUsedWarp.mapGroup == MAP_GROUP(ROUTE110_SEASIDE_CYCLING_ROAD_NORTH_ENTRANCE)) return; if (VarGet(VAR_CYCLING_CHALLENGE_STATE) == 2 || VarGet(VAR_CYCLING_CHALLENGE_STATE) == 3) @@ -3550,7 +3550,7 @@ bool32 IsTrainerRegistered(void) int index = GetRematchIdxByTrainerIdx(gSpecialVar_0x8004); if (index >= 0) { - if (FlagGet(FLAG_MATCH_CALL_REGISTERED + index) == TRUE) + if (FlagGet(TRAINER_REGISTERED_FLAGS_START + index) == TRUE) return TRUE; } return FALSE; @@ -3887,14 +3887,14 @@ bool8 InPokemonCenter(void) #define FANCLUB_BITFIELD (gSaveBlock1Ptr->vars[VAR_FANCLUB_FAN_COUNTER - VARS_START]) #define FANCLUB_COUNTER 0x007F -#define GET_TRAINER_FAN_CLUB_FLAG(flag) (FANCLUB_BITFIELD >> (flag) & 1) -#define SET_TRAINER_FAN_CLUB_FLAG(flag) (FANCLUB_BITFIELD |= 1 << (flag)) -#define FLIP_TRAINER_FAN_CLUB_FLAG(flag)(FANCLUB_BITFIELD ^= 1 << (flag)) +#define GET_TRAINER_FAN_CLUB_FLAG(flag) (FANCLUB_BITFIELD >> (flag) & 1) +#define SET_TRAINER_FAN_CLUB_FLAG(flag) (FANCLUB_BITFIELD |= 1 << (flag)) +#define FLIP_TRAINER_FAN_CLUB_FLAG(flag) (FANCLUB_BITFIELD ^= 1 << (flag)) -#define GET_TRAINER_FAN_CLUB_COUNTER (FANCLUB_BITFIELD & FANCLUB_COUNTER) -#define SET_TRAINER_FAN_CLUB_COUNTER(count) (FANCLUB_BITFIELD = (FANCLUB_BITFIELD & ~FANCLUB_COUNTER) | (count)) -#define INCR_TRAINER_FAN_CLUB_COUNTER(count)(FANCLUB_BITFIELD += (count)) -#define CLEAR_TRAINER_FAN_CLUB_COUNTER (FANCLUB_BITFIELD &= ~FANCLUB_COUNTER) +#define GET_TRAINER_FAN_CLUB_COUNTER (FANCLUB_BITFIELD & FANCLUB_COUNTER) +#define SET_TRAINER_FAN_CLUB_COUNTER(count) (FANCLUB_BITFIELD = (FANCLUB_BITFIELD & ~FANCLUB_COUNTER) | (count)) +#define INCR_TRAINER_FAN_CLUB_COUNTER(count) (FANCLUB_BITFIELD += (count)) +#define CLEAR_TRAINER_FAN_CLUB_COUNTER (FANCLUB_BITFIELD &= ~FANCLUB_COUNTER) void ResetFanClub(void) { diff --git a/src/fieldmap.c b/src/fieldmap.c index 7c40c755c4fc..34a654861ae6 100644 --- a/src/fieldmap.c +++ b/src/fieldmap.c @@ -32,7 +32,7 @@ EWRAM_DATA struct Camera gCamera = {0}; EWRAM_DATA static struct ConnectionFlags sMapConnectionFlags = {0}; EWRAM_DATA static u32 UNUSED sFiller = 0; // without this, the next file won't align properly -struct BackupMapLayout gBackupMapLayout; +COMMON_DATA struct BackupMapLayout gBackupMapLayout = {0}; static const struct ConnectionFlags sDummyConnectionFlags = {0}; diff --git a/src/frontier_pass.c b/src/frontier_pass.c index 07e06ad3b9a3..a351d81ce940 100644 --- a/src/frontier_pass.c +++ b/src/frontier_pass.c @@ -1241,7 +1241,7 @@ static void ShowHideZoomingArea(bool8 show, bool8 zoomedIn) static void UpdateAreaHighlight(u8 cursorArea, u8 previousCursorArea) { - #define NON_HIGHLIGHT_AREA(area)((area) == CURSOR_AREA_NOTHING || (area) > CURSOR_AREA_CANCEL) + #define NON_HIGHLIGHT_AREA(area) ((area) == CURSOR_AREA_NOTHING || (area) > CURSOR_AREA_CANCEL) // If moving off highlightable area, unhighlight it switch (previousCursorArea) diff --git a/gflib/gpu_regs.c b/src/gpu_regs.c similarity index 100% rename from gflib/gpu_regs.c rename to src/gpu_regs.c diff --git a/src/image_processing_effects.c b/src/image_processing_effects.c index 51a5d13993a9..b09e881fe0d0 100644 --- a/src/image_processing_effects.c +++ b/src/image_processing_effects.c @@ -4,16 +4,16 @@ #include "constants/rgb.h" // IWRAM common -u8 gCanvasColumnStart; -u16 *gCanvasPixels; -u8 gCanvasRowEnd; -u8 gCanvasHeight; -u8 gCanvasColumnEnd; -u8 gCanvasRowStart; -u8 gCanvasMonPersonality; -u8 gCanvasWidth; -u16 *gCanvasPalette; -u16 gCanvasPaletteStart; +COMMON_DATA u8 gCanvasColumnStart = 0; +COMMON_DATA u16 *gCanvasPixels = NULL; +COMMON_DATA u8 gCanvasRowEnd = 0; +COMMON_DATA u8 gCanvasHeight = 0; +COMMON_DATA u8 gCanvasColumnEnd = 0; +COMMON_DATA u8 gCanvasRowStart = 0; +COMMON_DATA u8 gCanvasMonPersonality = 0; +COMMON_DATA u8 gCanvasWidth = 0; +COMMON_DATA u16 *gCanvasPalette = NULL; +COMMON_DATA u16 gCanvasPaletteStart = 0; static void ApplyImageEffect_Pointillism(void); static void ApplyImageEffect_Blur(void); diff --git a/src/intro.c b/src/intro.c index e575f4e0faa5..cda31aa15bbf 100644 --- a/src/intro.c +++ b/src/intro.c @@ -112,6 +112,12 @@ extern const struct CompressedSpriteSheet gBattleAnimPicTable[]; extern const struct CompressedSpritePalette gBattleAnimPaletteTable[]; extern const struct SpriteTemplate gAncientPowerRockSpriteTemplate[]; +enum { + COPYRIGHT_INITIALIZE, + COPYRIGHT_START_FADE = 140, + COPYRIGHT_START_INTRO, +}; + #define TAG_VOLBEAT 1500 #define TAG_TORCHIC 1501 #define TAG_MANECTRIC 1502 @@ -172,8 +178,8 @@ static EWRAM_DATA u16 sIntroCharacterGender = 0; static EWRAM_DATA u16 UNUSED sUnusedVar = 0; static EWRAM_DATA u16 sFlygonYOffset = 0; -u32 gIntroFrameCounter; -struct GcmbStruct gMultibootProgramStruct; +COMMON_DATA u32 gIntroFrameCounter = 0; +COMMON_DATA struct GcmbStruct gMultibootProgramStruct = {0}; static const u16 sIntroDrops_Pal[] = INCBIN_U16("graphics/intro/scene_1/drops.gbapal"); static const u16 sIntroLogo_Pal[] = INCBIN_U16("graphics/intro/scene_1/logo.gbapal"); @@ -1067,7 +1073,7 @@ static u8 SetUpCopyrightScreen(void) { switch (gMain.state) { - case 0: + case COPYRIGHT_INITIALIZE: SetVBlankCallback(NULL); SetGpuReg(REG_OFFSET_BLDCNT, 0); SetGpuReg(REG_OFFSET_BLDALPHA, 0); @@ -1105,7 +1111,7 @@ static u8 SetUpCopyrightScreen(void) gMain.state++; GameCubeMultiBoot_Main(&gMultibootProgramStruct); break; - case 140: + case COPYRIGHT_START_FADE: GameCubeMultiBoot_Main(&gMultibootProgramStruct); if (gMultibootProgramStruct.gcmb_field_2 != 1) { @@ -1113,7 +1119,7 @@ static u8 SetUpCopyrightScreen(void) gMain.state++; } break; - case 141: + case COPYRIGHT_START_INTRO: if (UpdatePaletteFade()) break; #if EXPANSION_INTRO == TRUE diff --git a/gflib/io_reg.c b/src/io_reg.c similarity index 100% rename from gflib/io_reg.c rename to src/io_reg.c diff --git a/src/librfu_rfu.c b/src/librfu_rfu.c index 152bb716e92a..f06646df3c7c 100644 --- a/src/librfu_rfu.c +++ b/src/librfu_rfu.c @@ -76,11 +76,11 @@ static void rfu_STC_NI_receive_Sender(u8, u8, const struct RfuLocalStruct *, UNU static void rfu_STC_NI_initSlot_asRecvDataEntity(u8, struct NIComm *); static void rfu_STC_NI_initSlot_asRecvControllData(u8, struct NIComm *); -struct RfuSlotStatusUNI *gRfuSlotStatusUNI[RFU_CHILD_MAX]; -struct RfuSlotStatusNI *gRfuSlotStatusNI[RFU_CHILD_MAX]; -struct RfuLinkStatus *gRfuLinkStatus; -struct RfuStatic *gRfuStatic; -struct RfuFixed *gRfuFixed; +COMMON_DATA struct RfuSlotStatusUNI *gRfuSlotStatusUNI[RFU_CHILD_MAX] = {0}; +COMMON_DATA struct RfuSlotStatusNI *gRfuSlotStatusNI[RFU_CHILD_MAX] = {0}; +COMMON_DATA struct RfuLinkStatus *gRfuLinkStatus = NULL; +COMMON_DATA struct RfuStatic *gRfuStatic = NULL; +COMMON_DATA struct RfuFixed *gRfuFixed = NULL; static const struct LLSFStruct llsf_struct[2] = { [MODE_CHILD] = { diff --git a/src/librfu_sio32id.c b/src/librfu_sio32id.c index 4f49fbd1b4c3..2a1b0c94c4eb 100644 --- a/src/librfu_sio32id.c +++ b/src/librfu_sio32id.c @@ -15,7 +15,7 @@ struct RfuSIO32Id u16 lastId; }; -struct RfuSIO32Id gRfuSIO32Id; +COMMON_DATA struct RfuSIO32Id gRfuSIO32Id = {0}; static const u16 Sio32ConnectionData[] = { 0x494e, 0x544e, 0x4e45, 0x4f44 }; // NINTENDO static const char Sio32IDLib_Var[] = "Sio32ID_030820"; diff --git a/src/librfu_stwi.c b/src/librfu_stwi.c index b515f338e0ef..13a7e340828c 100644 --- a/src/librfu_stwi.c +++ b/src/librfu_stwi.c @@ -8,7 +8,7 @@ static void STWI_stop_timer(void); static s32 STWI_restart_Command(void); static s32 STWI_reset_ClockCounter(void); -struct STWIStatus *gSTWIStatus; +COMMON_DATA struct STWIStatus *gSTWIStatus = NULL; void STWI_init_all(struct RfuIntrStruct *interruptStruct, IntrFunc *interrupt, bool8 copyInterruptToRam) { diff --git a/src/link.c b/src/link.c index f784a36c679a..bb74574a316e 100644 --- a/src/link.c +++ b/src/link.c @@ -68,41 +68,41 @@ static u16 sRecvNonzeroCheck; static u8 sChecksumAvailable; static u8 sHandshakePlayerCount; -u16 gLinkPartnersHeldKeys[6]; -u32 gLinkDebugSeed; -struct LinkPlayerBlock gLocalLinkPlayerBlock; -bool8 gLinkErrorOccurred; -u32 gLinkDebugFlags; -u32 gLinkFiller1; -bool8 gRemoteLinkPlayersNotReceived[MAX_LINK_PLAYERS]; -u8 gBlockReceivedStatus[MAX_LINK_PLAYERS]; -u32 gLinkFiller2; -u16 gLinkHeldKeys; -u16 ALIGNED(4) gRecvCmds[MAX_RFU_PLAYERS][CMD_LENGTH]; -u32 gLinkStatus; -bool8 gLinkDummy1; // Never read -bool8 gLinkDummy2; // Never read -bool8 gReadyToExitStandby[MAX_LINK_PLAYERS]; -bool8 gReadyToCloseLink[MAX_LINK_PLAYERS]; -u16 gReadyCloseLinkType; // Never read -u8 gSuppressLinkErrorMessage; -bool8 gWirelessCommType; -bool8 gSavedLinkPlayerCount; -u16 gSendCmd[CMD_LENGTH]; -u8 gSavedMultiplayerId; -bool8 gReceivedRemoteLinkPlayers; -struct LinkTestBGInfo gLinkTestBGInfo; -void (*gLinkCallback)(void); -u8 gShouldAdvanceLinkState; -u16 gLinkTestBlockChecksums[MAX_LINK_PLAYERS]; -u8 gBlockRequestType; -u32 gLinkFiller3; -u32 gLinkFiller4; -u32 gLinkFiller5; -u8 gLastSendQueueCount; -struct Link gLink; -u8 gLastRecvQueueCount; -u16 gLinkSavedIme; +COMMON_DATA u16 gLinkPartnersHeldKeys[6] = {0}; +COMMON_DATA u32 gLinkDebugSeed = 0; +COMMON_DATA struct LinkPlayerBlock gLocalLinkPlayerBlock = {0}; +COMMON_DATA bool8 gLinkErrorOccurred = 0; +COMMON_DATA u32 gLinkDebugFlags = 0; +COMMON_DATA u32 gLinkFiller1 = 0; +COMMON_DATA bool8 gRemoteLinkPlayersNotReceived[MAX_LINK_PLAYERS] = {0}; +COMMON_DATA u8 gBlockReceivedStatus[MAX_LINK_PLAYERS] = {0}; +COMMON_DATA u32 gLinkFiller2 = 0; +COMMON_DATA u16 gLinkHeldKeys = 0; +COMMON_DATA u16 ALIGNED(4) gRecvCmds[MAX_RFU_PLAYERS][CMD_LENGTH] = {0}; +COMMON_DATA u32 gLinkStatus = 0; +COMMON_DATA bool8 gLinkDummy1 = 0; // Never read +COMMON_DATA bool8 gLinkDummy2 = 0; // Never read +COMMON_DATA bool8 gReadyToExitStandby[MAX_LINK_PLAYERS] = {0}; +COMMON_DATA bool8 gReadyToCloseLink[MAX_LINK_PLAYERS] = {0}; +COMMON_DATA u16 gReadyCloseLinkType = 0; // Never read +COMMON_DATA u8 gSuppressLinkErrorMessage = 0; +COMMON_DATA bool8 gWirelessCommType = 0; +COMMON_DATA bool8 gSavedLinkPlayerCount = 0; +COMMON_DATA u16 gSendCmd[CMD_LENGTH] = {0}; +COMMON_DATA u8 gSavedMultiplayerId = 0; +COMMON_DATA bool8 gReceivedRemoteLinkPlayers = 0; +COMMON_DATA struct LinkTestBGInfo gLinkTestBGInfo = {0}; +COMMON_DATA void (*gLinkCallback)(void) = NULL; +COMMON_DATA u8 gShouldAdvanceLinkState = 0; +COMMON_DATA u16 gLinkTestBlockChecksums[MAX_LINK_PLAYERS] = {0}; +COMMON_DATA u8 gBlockRequestType = 0; +COMMON_DATA u32 gLinkFiller3 = 0; +COMMON_DATA u32 gLinkFiller4 = 0; +COMMON_DATA u32 gLinkFiller5 = 0; +COMMON_DATA u8 gLastSendQueueCount = 0; +COMMON_DATA struct Link gLink = {0}; +COMMON_DATA u8 gLastRecvQueueCount = 0; +COMMON_DATA u16 gLinkSavedIme = 0; static EWRAM_DATA u8 sLinkTestDebugValuesEnabled = 0; static EWRAM_DATA u8 sDummyFlag = FALSE; diff --git a/src/link_rfu_2.c b/src/link_rfu_2.c index 9979097a49a9..4c4323c1edc7 100644 --- a/src/link_rfu_2.c +++ b/src/link_rfu_2.c @@ -77,8 +77,8 @@ struct RfuDebug u8 unused4[88]; }; -u32 gRfuAPIBuffer[RFU_API_BUFF_SIZE_RAM / 4]; -struct RfuManager gRfu; +COMMON_DATA u32 gRfuAPIBuffer[RFU_API_BUFF_SIZE_RAM / 4] = {0}; +COMMON_DATA struct RfuManager gRfu = {0}; static u8 sHeldKeyCount; static u8 sResendBlock8[CMD_LENGTH * 2]; @@ -138,7 +138,7 @@ static const u8 sAvailSlots[] = { [4] = AVAIL_SLOT4 }; -#define BLOCK_MASK(bitNum)((1 << (bitNum)) - 1) +#define BLOCK_MASK(bitNum) ((1 << (bitNum)) - 1) static const u32 sAllBlocksReceived[] = { BLOCK_MASK(0), BLOCK_MASK(1), diff --git a/src/list_menu.c b/src/list_menu.c index aa65683eddc6..ab93961fd5f2 100644 --- a/src/list_menu.c +++ b/src/list_menu.c @@ -98,7 +98,7 @@ static EWRAM_DATA struct { EWRAM_DATA struct ScrollArrowsTemplate gTempScrollArrowTemplate = {0}; // IWRAM common -struct { +COMMON_DATA struct { u8 cursorPal:4; u8 fillValue:4; u8 cursorShadowPal:4; @@ -106,9 +106,9 @@ struct { u8 field_2_2:6; // unused u8 fontId:7; bool8 enabled:1; -} gListMenuOverride; +} gListMenuOverride = {0}; -struct ListMenuTemplate gMultiuseListMenuTemplate; +COMMON_DATA struct ListMenuTemplate gMultiuseListMenuTemplate = {0}; // const rom data static const struct diff --git a/src/load_save.c b/src/load_save.c index a5f269353834..6fde540b8c4e 100644 --- a/src/load_save.c +++ b/src/load_save.c @@ -40,11 +40,11 @@ EWRAM_DATA struct LoadedSaveData gLoadedSaveData = {0}; EWRAM_DATA u32 gLastEncryptionKey = 0; // IWRAM common -bool32 gFlashMemoryPresent; -struct SaveBlock1 *gSaveBlock1Ptr; -struct SaveBlock2 *gSaveBlock2Ptr; +COMMON_DATA bool32 gFlashMemoryPresent = 0; +COMMON_DATA struct SaveBlock1 *gSaveBlock1Ptr = NULL; +COMMON_DATA struct SaveBlock2 *gSaveBlock2Ptr = NULL; IWRAM_INIT struct SaveBlock3 *gSaveBlock3Ptr = &gSaveblock3; -struct PokemonStorage *gPokemonStoragePtr; +COMMON_DATA struct PokemonStorage *gPokemonStoragePtr = NULL; // code void CheckForFlashMemory(void) diff --git a/src/m4a.c b/src/m4a.c index b80a357974f4..e90e9b06f0ac 100644 --- a/src/m4a.c +++ b/src/m4a.c @@ -8,18 +8,18 @@ extern const u8 gCgb3Vol[]; BSS_CODE ALIGNED(4) char SoundMainRAM_Buffer[0x800] = {0}; -struct SoundInfo gSoundInfo; -struct PokemonCrySong gPokemonCrySongs[MAX_POKEMON_CRIES]; -struct MusicPlayerInfo gPokemonCryMusicPlayers[MAX_POKEMON_CRIES]; -MPlayFunc gMPlayJumpTable[36]; -struct CgbChannel gCgbChans[4]; -struct MusicPlayerTrack gPokemonCryTracks[MAX_POKEMON_CRIES * 2]; -struct PokemonCrySong gPokemonCrySong; -struct MusicPlayerInfo gMPlayInfo_BGM; -struct MusicPlayerInfo gMPlayInfo_SE1; -struct MusicPlayerInfo gMPlayInfo_SE2; -struct MusicPlayerInfo gMPlayInfo_SE3; -u8 gMPlayMemAccArea[0x10]; +COMMON_DATA struct SoundInfo gSoundInfo = {0}; +COMMON_DATA struct PokemonCrySong gPokemonCrySongs[MAX_POKEMON_CRIES] = {0}; +COMMON_DATA struct MusicPlayerInfo gPokemonCryMusicPlayers[MAX_POKEMON_CRIES] = {0}; +COMMON_DATA struct MusicPlayerInfo gMPlayInfo_BGM = {0}; +COMMON_DATA MPlayFunc gMPlayJumpTable[36] = {0}; +COMMON_DATA struct CgbChannel gCgbChans[4] = {0}; +COMMON_DATA struct MusicPlayerInfo gMPlayInfo_SE1 = {0}; +COMMON_DATA struct MusicPlayerInfo gMPlayInfo_SE2 = {0}; +COMMON_DATA struct MusicPlayerTrack gPokemonCryTracks[MAX_POKEMON_CRIES * 2] = {0}; +COMMON_DATA struct PokemonCrySong gPokemonCrySong = {0}; +COMMON_DATA u8 gMPlayMemAccArea[0x10] = {0}; +COMMON_DATA struct MusicPlayerInfo gMPlayInfo_SE3 = {0}; u32 MidiKeyToFreq(struct WaveData *wav, u8 key, u8 fineAdjust) { diff --git a/src/main.c b/src/main.c index b0bba2f3f394..c82dc5871883 100644 --- a/src/main.c +++ b/src/main.c @@ -61,16 +61,16 @@ const IntrFunc gIntrTableTemplate[] = #define INTR_COUNT ((int)(sizeof(gIntrTableTemplate)/sizeof(IntrFunc))) -u16 gKeyRepeatStartDelay; -bool8 gLinkTransferringData; -struct Main gMain; -u16 gKeyRepeatContinueDelay; -bool8 gSoftResetDisabled; -IntrFunc gIntrTable[INTR_COUNT]; -u8 gLinkVSyncDisabled; -u32 IntrMain_Buffer[0x200]; -s8 gPcmDmaCounter; -void *gAgbMainLoop_sp; +COMMON_DATA u16 gKeyRepeatStartDelay = 0; +COMMON_DATA bool8 gLinkTransferringData = 0; +COMMON_DATA struct Main gMain = {0}; +COMMON_DATA u16 gKeyRepeatContinueDelay = 0; +COMMON_DATA bool8 gSoftResetDisabled = 0; +COMMON_DATA IntrFunc gIntrTable[INTR_COUNT] = {0}; +COMMON_DATA u8 gLinkVSyncDisabled = 0; +COMMON_DATA u32 IntrMain_Buffer[0x200] = {0}; +COMMON_DATA s8 gPcmDmaCounter = 0; +COMMON_DATA void *gAgbMainLoop_sp = NULL; static EWRAM_DATA u16 sTrainerId = 0; diff --git a/gflib/malloc.c b/src/malloc.c similarity index 100% rename from gflib/malloc.c rename to src/malloc.c diff --git a/src/match_call.c b/src/match_call.c index 95028221c282..662dd209a49b 100644 --- a/src/match_call.c +++ b/src/match_call.c @@ -132,7 +132,7 @@ static EWRAM_DATA struct MatchCallState sMatchCallState = {0}; static EWRAM_DATA struct BattleFrontierStreakInfo sBattleFrontierStreakInfo = {0}; static u32 GetCurrentTotalMinutes(struct Time *); -static u32 GetNumRegisteredNPCs(void); +static u32 GetNumRegisteredTrainers(void); static u32 GetActiveMatchCallTrainerId(u32); static int GetTrainerMatchCallId(int); static u16 GetRematchTrainerLocation(int); @@ -1099,7 +1099,7 @@ static bool32 UpdateMatchCallStepCounter(void) static bool32 SelectMatchCallTrainer(void) { u32 matchCallId; - u32 numRegistered = GetNumRegisteredNPCs(); + u32 numRegistered = GetNumRegisteredTrainers(); if (numRegistered == 0) return FALSE; @@ -1115,12 +1115,13 @@ static bool32 SelectMatchCallTrainer(void) return TRUE; } -static u32 GetNumRegisteredNPCs(void) +// Ignores registrable non-trainer NPCs, and special trainers like Wally and the gym leaders. +static u32 GetNumRegisteredTrainers(void) { u32 i, count; for (i = 0, count = 0; i < REMATCH_SPECIAL_TRAINER_START; i++) { - if (FlagGet(FLAG_MATCH_CALL_REGISTERED + i)) + if (FlagGet(TRAINER_REGISTERED_FLAGS_START + i)) count++; } @@ -1132,7 +1133,7 @@ static u32 GetActiveMatchCallTrainerId(u32 activeMatchCallId) u32 i; for (i = 0; i < REMATCH_SPECIAL_TRAINER_START; i++) { - if (FlagGet(FLAG_MATCH_CALL_REGISTERED + i)) + if (FlagGet(TRAINER_REGISTERED_FLAGS_START + i)) { if (!activeMatchCallId) return gRematchTable[i].trainerIds[0]; diff --git a/src/mauville_old_man.c b/src/mauville_old_man.c index 0c0714354a4f..efadd4de1fe1 100644 --- a/src/mauville_old_man.c +++ b/src/mauville_old_man.c @@ -31,7 +31,7 @@ static void Storyteller_ResetFlag(void); static u8 sSelectedStory; -struct BardSong gBardSong; +COMMON_DATA struct BardSong gBardSong = {0}; static EWRAM_DATA u16 sUnknownBardRelated = 0; static EWRAM_DATA struct MauvilleManStoryteller * sStorytellerPtr = NULL; diff --git a/src/menu_specialized.c b/src/menu_specialized.c index a709a878dc0c..693e9f12bc02 100644 --- a/src/menu_specialized.c +++ b/src/menu_specialized.c @@ -317,7 +317,7 @@ void MailboxMenu_Free(void) // filled with the graph color. //--------------------------------------- -#define SHIFT_RIGHT_ADJUSTED(n, s)(((n) >> (s)) + (((n) >> ((s) - 1)) & 1)) +#define SHIFT_RIGHT_ADJUSTED(n, s) (((n) >> (s)) + (((n) >> ((s) - 1)) & 1)) void ConditionGraph_Init(struct ConditionGraph *graph) { diff --git a/src/mini_printf.c b/src/mini_printf.c index 2420efbd180b..57ae3e58b068 100644 --- a/src/mini_printf.c +++ b/src/mini_printf.c @@ -36,8 +36,7 @@ #include "gba/types.h" #include "gba/defines.h" #include "config/general.h" -#include "characters.h" -#include "string_util.h" +#include "constants/characters.h" #ifndef NDEBUG diff --git a/src/overworld.c b/src/overworld.c index 37a9642e282e..f031a8fe4ee6 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -182,14 +182,14 @@ static u16 (*sPlayerKeyInterceptCallback)(u32); static bool8 sReceivingFromLink; static u8 sRfuKeepAliveTimer; -u16 *gOverworldTilemapBuffer_Bg2; -u16 *gOverworldTilemapBuffer_Bg1; -u16 *gOverworldTilemapBuffer_Bg3; -u16 gHeldKeyCodeToSend; -void (*gFieldCallback)(void); -bool8 (*gFieldCallback2)(void); -u8 gLocalLinkPlayerId; // This is our player id in a multiplayer mode. -u8 gFieldLinkPlayerCount; +COMMON_DATA u16 *gOverworldTilemapBuffer_Bg2 = NULL; +COMMON_DATA u16 *gOverworldTilemapBuffer_Bg1 = NULL; +COMMON_DATA u16 *gOverworldTilemapBuffer_Bg3 = NULL; +COMMON_DATA u16 gHeldKeyCodeToSend = 0; +COMMON_DATA void (*gFieldCallback)(void) = NULL; +COMMON_DATA bool8 (*gFieldCallback2)(void) = NULL; +COMMON_DATA u8 gLocalLinkPlayerId = 0; // This is our player id in a multiplayer mode. +COMMON_DATA u8 gFieldLinkPlayerCount = 0; EWRAM_DATA static u8 sObjectEventLoadFlag = 0; EWRAM_DATA struct WarpData gLastUsedWarp = {0}; diff --git a/src/party_menu.c b/src/party_menu.c index b4c973b60144..703834cc0bce 100644 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -245,7 +245,7 @@ static EWRAM_DATA u8 sInitialLevel = 0; static EWRAM_DATA u8 sFinalLevel = 0; // IWRAM common -void (*gItemUseCB)(u8, TaskFunc); +COMMON_DATA void (*gItemUseCB)(u8, TaskFunc) = NULL; static void ResetPartyMenu(void); static void CB2_InitPartyMenu(void); diff --git a/src/pokedex.c b/src/pokedex.c index 2cf8274db524..87702d337151 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -122,8 +122,8 @@ static EWRAM_DATA u8 sPokeBallRotation = 0; static EWRAM_DATA struct PokedexListItem *sPokedexListItem = NULL; // This is written to, but never read. -u8 gUnusedPokedexU8; -void (*gPokedexVBlankCB)(void); +COMMON_DATA u8 gUnusedPokedexU8 = 0; +COMMON_DATA void (*gPokedexVBlankCB)(void) = NULL; struct SearchOptionText { diff --git a/src/pokedex_cry_screen.c b/src/pokedex_cry_screen.c index 437ef8cf5a68..2fb3d55a2455 100644 --- a/src/pokedex_cry_screen.c +++ b/src/pokedex_cry_screen.c @@ -60,7 +60,7 @@ static void SpriteCB_CryMeterNeedle(struct Sprite *); static void SetCryMeterNeedleTarget(s8); // IWRAM common -u8 gDexCryScreenState; +COMMON_DATA u8 gDexCryScreenState = 0; // EWRAM vars static EWRAM_DATA struct PokedexCryScreen *sDexCryScreen = NULL; diff --git a/src/pokemon_jump.c b/src/pokemon_jump.c index c2a0a4170ad9..74bb640b75d8 100755 --- a/src/pokemon_jump.c +++ b/src/pokemon_jump.c @@ -108,7 +108,7 @@ enum { // the lower 8 bits are a timer to the next state. // When the timer is incremented above 255, it increments // the vine state and the timer is reset. -#define VINE_STATE_TIMER(vineState)(((vineState) << 8) | 0xFF) +#define VINE_STATE_TIMER(vineState) (((vineState) << 8) | 0xFF) enum { MONSTATE_NORMAL, // Pokémon is either on the ground or in the middle of a jump diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index fe65df011485..2c0b52780ff2 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -4861,7 +4861,7 @@ static void MovePartySpriteToNextSlot(struct Sprite *sprite, u16 partyId) sprite->sMonY = (u16)(sprite->y) * 8; sprite->sSpeedX = ((x * 8) - sprite->sMonX) / 8; sprite->sSpeedY = ((y * 8) - sprite->sMonY) / 8; - sprite->data[6] = 8; + sprite->sMoveSteps = 8; sprite->callback = SpriteCB_MovePartyMonToNextSlot; } @@ -8363,7 +8363,7 @@ static bool8 MultiMove_GrabSelection(void) if (!DoMonPlaceChange()) { StartCursorAnim(CURSOR_ANIM_FIST); - MultiMove_InitMove(0, 256, 8); + MultiMove_InitMove(0, Q_8_8(1), 8); InitMultiMonPlaceChange(TRUE); sMultiMove->state++; } @@ -8396,7 +8396,7 @@ static bool8 MultiMove_PlaceMons(void) { case 0: MultiMove_SetPlacedMonData(); - MultiMove_InitMove(0, -256, 8); + MultiMove_InitMove(0, Q_8_8(-1), 8); InitMultiMonPlaceChange(FALSE); sMultiMove->state++; break; @@ -8440,25 +8440,25 @@ static bool8 MultiMove_TryMoveGroup(u8 dir) if (sMultiMove->minRow == 0) return FALSE; sMultiMove->minRow--; - MultiMove_InitMove(0, 1024, 6); + MultiMove_InitMove(0, Q_8_8(4), 6); break; case 1: // Down if (sMultiMove->minRow + sMultiMove->rowsTotal >= IN_BOX_ROWS) return FALSE; sMultiMove->minRow++; - MultiMove_InitMove(0, -1024, 6); + MultiMove_InitMove(0, Q_8_8(-4), 6); break; case 2: // Left if (sMultiMove->minColumn == 0) return FALSE; sMultiMove->minColumn--; - MultiMove_InitMove(1024, 0, 6); + MultiMove_InitMove(Q_8_8(4), 0, 6); break; case 3: // Right if (sMultiMove->minColumn + sMultiMove->columnsTotal >= IN_BOX_COLUMNS) return FALSE; sMultiMove->minColumn++; - MultiMove_InitMove(-1024, 0, 6); + MultiMove_InitMove(Q_8_8(-4), 0, 6); break; } return TRUE; diff --git a/src/pokenav_match_call_data.c b/src/pokenav_match_call_data.c index ca027380d4df..aecf2caf9fd9 100644 --- a/src/pokenav_match_call_data.c +++ b/src/pokenav_match_call_data.c @@ -506,7 +506,7 @@ static const struct MatchCallStructTrainer sSidneyMatchCallHeader = { .type = MC_TYPE_LEADER, .mapSec = MAPSEC_EVER_GRANDE_CITY, - .flag = FLAG_REMATCH_SIDNEY, + .flag = FLAG_REGISTERED_SIDNEY, .rematchTableIdx = REMATCH_SIDNEY, .desc = gText_EliteFourMatchCallDesc, .name = NULL, @@ -522,7 +522,7 @@ static const struct MatchCallStructTrainer sPhoebeMatchCallHeader = { .type = MC_TYPE_LEADER, .mapSec = MAPSEC_EVER_GRANDE_CITY, - .flag = FLAG_REMATCH_PHOEBE, + .flag = FLAG_REGISTERED_PHOEBE, .rematchTableIdx = REMATCH_PHOEBE, .desc = gText_EliteFourMatchCallDesc, .name = NULL, @@ -538,7 +538,7 @@ static const struct MatchCallStructTrainer sGlaciaMatchCallHeader = { .type = MC_TYPE_LEADER, .mapSec = MAPSEC_EVER_GRANDE_CITY, - .flag = FLAG_REMATCH_GLACIA, + .flag = FLAG_REGISTERED_GLACIA, .rematchTableIdx = REMATCH_GLACIA, .desc = gText_EliteFourMatchCallDesc, .name = NULL, @@ -554,7 +554,7 @@ static const struct MatchCallStructTrainer sDrakeMatchCallHeader = { .type = MC_TYPE_LEADER, .mapSec = MAPSEC_EVER_GRANDE_CITY, - .flag = FLAG_REMATCH_DRAKE, + .flag = FLAG_REGISTERED_DRAKE, .rematchTableIdx = REMATCH_DRAKE, .desc = gText_EliteFourMatchCallDesc, .name = NULL, @@ -570,7 +570,7 @@ static const struct MatchCallStructTrainer sWallaceMatchCallHeader = { .type = MC_TYPE_LEADER, .mapSec = MAPSEC_EVER_GRANDE_CITY, - .flag = FLAG_REMATCH_WALLACE, + .flag = FLAG_REGISTERED_WALLACE, .rematchTableIdx = REMATCH_WALLACE, .desc = gText_ChampionMatchCallDesc, .name = NULL, @@ -1146,7 +1146,7 @@ bool32 MatchCall_HasRematchId(u32 idx) void SetMatchCallRegisteredFlag(void) { - int r0 = GetRematchIdxByTrainerIdx(gSpecialVar_0x8004); - if (r0 >= 0) - FlagSet(FLAG_MATCH_CALL_REGISTERED + r0); + int index = GetRematchIdxByTrainerIdx(gSpecialVar_0x8004); + if (index >= 0) + FlagSet(TRAINER_REGISTERED_FLAGS_START + index); } diff --git a/src/pokenav_match_call_list.c b/src/pokenav_match_call_list.c index 43cd5220dd05..ac384c423d79 100755 --- a/src/pokenav_match_call_list.c +++ b/src/pokenav_match_call_list.c @@ -261,7 +261,7 @@ static u32 LoopedTask_BuildMatchCallList(s32 taskState) bool32 IsRematchEntryRegistered(int rematchIndex) { if (rematchIndex < REMATCH_TABLE_ENTRIES) - return FlagGet(FLAG_MATCH_CALL_REGISTERED + rematchIndex); + return FlagGet(TRAINER_REGISTERED_FLAGS_START + rematchIndex); return FALSE; } diff --git a/src/pokenav_ribbons_summary.c b/src/pokenav_ribbons_summary.c index bba1c3600cb0..bcb1398a7e6e 100644 --- a/src/pokenav_ribbons_summary.c +++ b/src/pokenav_ribbons_summary.c @@ -1082,7 +1082,7 @@ enum { RIBBONGFX_GIFT_3, }; -#define TO_PAL_OFFSET(palNum)((palNum) - PALTAG_RIBBON_ICONS_1) +#define TO_PAL_OFFSET(palNum) ((palNum) - PALTAG_RIBBON_ICONS_1) struct { diff --git a/src/random.c b/src/random.c index 9d43ae37408f..284a49fc84f4 100644 --- a/src/random.c +++ b/src/random.c @@ -5,8 +5,8 @@ #endif // IWRAM common -rng_value_t gRngValue; -rng_value_t gRng2Value; +COMMON_DATA rng_value_t gRngValue = {0}; +COMMON_DATA rng_value_t gRng2Value = {0}; #if HQ_RANDOM == TRUE diff --git a/src/region_map.c b/src/region_map.c index 8936e668acb0..92771c822073 100644 --- a/src/region_map.c +++ b/src/region_map.c @@ -189,7 +189,7 @@ static const u16 sTerraOrMarineCaveMapSecIds[ABNORMAL_WEATHER_LOCATIONS] = [ABNORMAL_WEATHER_ROUTE_129_EAST - 1] = MAPSEC_ROUTE_129 }; -#define MARINE_CAVE_COORD(location)(ABNORMAL_WEATHER_##location - MARINE_CAVE_LOCATIONS_START) +#define MARINE_CAVE_COORD(location) (ABNORMAL_WEATHER_##location - MARINE_CAVE_LOCATIONS_START) static const struct UCoords16 sMarineCaveLocationCoords[MARINE_CAVE_LOCATIONS] = { diff --git a/src/roulette.c b/src/roulette.c index ec4c8cfcfeb3..f4e6012a8dcd 100644 --- a/src/roulette.c +++ b/src/roulette.c @@ -70,13 +70,13 @@ // Get the id of the col/row from the selection ID // e.g. GET_ROW(SQU_PURPLE_SKITTY) is ROW_PURPLE -#define GET_COL(selectionId)((selectionId) % (NUM_BOARD_POKES + 1)) -#define GET_ROW(selectionId)((selectionId) / (NUM_BOARD_POKES + 1) * (NUM_BOARD_POKES + 1)) +#define GET_COL(selectionId) ((selectionId) % (NUM_BOARD_POKES + 1)) +#define GET_ROW(selectionId) ((selectionId) / (NUM_BOARD_POKES + 1) * (NUM_BOARD_POKES + 1)) // Get the col/row index from the selection ID // e.g. GET_ROW_IDX(SQU_PURPLE_SKITTY) is 2 (purple being the 3rd row) -#define GET_COL_IDX(selectionId)(selectionId - 1) -#define GET_ROW_IDX(selectionId)(selectionId / 5 - 1) +#define GET_COL_IDX(selectionId) (selectionId - 1) +#define GET_ROW_IDX(selectionId) (selectionId / 5 - 1) // Flags for the above selections, used to set which spaces have been hit or bet on #define F_WYNAUT_COL (1 << COL_WYNAUT) @@ -149,7 +149,7 @@ // 2 different Roulette tables with 2 different rates (normal vs service day special) // & 1 gets which table, >> 7 gets if ROULETTE_SPECIAL_RATE is set -#define GET_MIN_BET_ID(var)(((var) & 1) + (((var) >> 7) * 2)) +#define GET_MIN_BET_ID(var) (((var) & 1) + (((var) >> 7) * 2)) // Having Shroomish or Taillow in the party can make rolls more consistent in length // It also increases the likelihood that, if they appear to unstick a ball, they'll move it to a slot the player bet on diff --git a/src/rtc.c b/src/rtc.c index 5ccafec621bd..e5a8b2d1df38 100644 --- a/src/rtc.c +++ b/src/rtc.c @@ -12,7 +12,7 @@ static u8 sProbeResult; static u16 sSavedIme; // iwram common -struct Time gLocalTime; +COMMON_DATA struct Time gLocalTime = {0}; // const rom diff --git a/src/save.c b/src/save.c index e65dda971e7f..7d7d1e42926b 100644 --- a/src/save.c +++ b/src/save.c @@ -82,19 +82,19 @@ STATIC_ASSERT(sizeof(struct SaveBlock2) <= SECTOR_DATA_SIZE, SaveBlock2FreeSpace STATIC_ASSERT(sizeof(struct SaveBlock1) <= SECTOR_DATA_SIZE * (SECTOR_ID_SAVEBLOCK1_END - SECTOR_ID_SAVEBLOCK1_START + 1), SaveBlock1FreeSpace); STATIC_ASSERT(sizeof(struct PokemonStorage) <= SECTOR_DATA_SIZE * (SECTOR_ID_PKMN_STORAGE_END - SECTOR_ID_PKMN_STORAGE_START + 1), PokemonStorageFreeSpace); -u16 gLastWrittenSector; -u32 gLastSaveCounter; -u16 gLastKnownGoodSector; -u32 gDamagedSaveSectors; -u32 gSaveCounter; -struct SaveSector *gReadWriteSector; // Pointer to a buffer for reading/writing a sector -u16 gIncrementalSectorId; -u16 gSaveUnusedVar; -u16 gSaveFileStatus; -void (*gGameContinueCallback)(void); -struct SaveSectorLocation gRamSaveSectorLocations[NUM_SECTORS_PER_SLOT]; -u16 gSaveUnusedVar2; -u16 gSaveAttemptStatus; +COMMON_DATA u16 gLastWrittenSector = 0; +COMMON_DATA u32 gLastSaveCounter = 0; +COMMON_DATA u16 gLastKnownGoodSector = 0; +COMMON_DATA u32 gDamagedSaveSectors = 0; +COMMON_DATA u32 gSaveCounter = 0; +COMMON_DATA struct SaveSector *gReadWriteSector = NULL; // Pointer to a buffer for reading/writing a sector +COMMON_DATA u16 gIncrementalSectorId = 0; +COMMON_DATA u16 gSaveUnusedVar = 0; +COMMON_DATA u16 gSaveFileStatus = 0; +COMMON_DATA void (*gGameContinueCallback)(void) = NULL; +COMMON_DATA struct SaveSectorLocation gRamSaveSectorLocations[NUM_SECTORS_PER_SLOT] = {0}; +COMMON_DATA u16 gSaveUnusedVar2 = 0; +COMMON_DATA u16 gSaveAttemptStatus = 0; EWRAM_DATA struct SaveSector gSaveDataBuffer = {0}; // Buffer used for reading/writing sectors diff --git a/src/sound.c b/src/sound.c index 548e48f163a9..95c26121cae6 100644 --- a/src/sound.c +++ b/src/sound.c @@ -24,7 +24,7 @@ static u8 sMapMusicState; static u8 sMapMusicFadeInSpeed; static u16 sFanfareCounter; -bool8 gDisableMusic; +COMMON_DATA bool8 gDisableMusic = 0; extern struct ToneData gCryTable[]; extern struct ToneData gCryTable_Reverse[]; diff --git a/gflib/sprite.c b/src/sprite.c similarity index 99% rename from gflib/sprite.c rename to src/sprite.c index 7823888cb529..a2a01d6d9415 100644 --- a/gflib/sprite.c +++ b/src/sprite.c @@ -260,8 +260,8 @@ static struct AffineAnimState sAffineAnimStates[OAM_MATRIX_COUNT]; static u16 sSpritePaletteTags[16]; // iwram common -u32 gOamMatrixAllocBitmap; -u8 gReservedSpritePaletteCount; +COMMON_DATA u32 gOamMatrixAllocBitmap = 0; +COMMON_DATA u8 gReservedSpritePaletteCount = 0; EWRAM_DATA struct Sprite gSprites[MAX_SPRITES + 1] = {0}; EWRAM_DATA static u8 sSpriteOrder[MAX_SPRITES] = {0}; diff --git a/src/start_menu.c b/src/start_menu.c index 0525ccf70d7c..2ed6ea32dae2 100644 --- a/src/start_menu.c +++ b/src/start_menu.c @@ -77,7 +77,7 @@ enum }; // IWRAM common -bool8 (*gMenuCallback)(void); +COMMON_DATA bool8 (*gMenuCallback)(void) = NULL; // EWRAM EWRAM_DATA static u8 sSafariBallsWindowId = 0; diff --git a/gflib/string_util.c b/src/string_util.c similarity index 100% rename from gflib/string_util.c rename to src/string_util.c diff --git a/src/task.c b/src/task.c index 68fb679b3e59..b188cbbcba75 100644 --- a/src/task.c +++ b/src/task.c @@ -1,7 +1,7 @@ #include "global.h" #include "task.h" -struct Task gTasks[NUM_TASKS]; +COMMON_DATA struct Task gTasks[NUM_TASKS] = {0}; static void InsertTask(u8 newTaskId); static u8 FindFirstActiveTask(void); diff --git a/gflib/text.c b/src/text.c similarity index 99% rename from gflib/text.c rename to src/text.c index 59c6e3f4e8c3..e18361ddf51c 100644 --- a/gflib/text.c +++ b/src/text.c @@ -52,10 +52,10 @@ static u16 sLastTextBgColor; static u16 sLastTextFgColor; static u16 sLastTextShadowColor; -const struct FontInfo *gFonts; -bool8 gDisableTextPrinters; -struct TextGlyph gCurGlyph; -TextFlags gTextFlags; +COMMON_DATA const struct FontInfo *gFonts = NULL; +COMMON_DATA bool8 gDisableTextPrinters = 0; +COMMON_DATA struct TextGlyph gCurGlyph = {0}; +COMMON_DATA TextFlags gTextFlags = {0}; static const u8 sFontHalfRowOffsets[] = { diff --git a/src/trainer_see.c b/src/trainer_see.c index 67ab2ebe1d22..2582637aa186 100644 --- a/src/trainer_see.c +++ b/src/trainer_see.c @@ -49,11 +49,11 @@ static bool8 WaitRevealBuriedTrainer(u8 taskId, struct Task *task, struct Object static void SpriteCB_TrainerIcons(struct Sprite *sprite); // IWRAM common -u16 gWhichTrainerToFaceAfterBattle; -u8 gPostBattleMovementScript[4]; -struct ApproachingTrainer gApproachingTrainers[2]; -u8 gNoOfApproachingTrainers; -bool8 gTrainerApproachedPlayer; +COMMON_DATA u16 gWhichTrainerToFaceAfterBattle = 0; +COMMON_DATA u8 gPostBattleMovementScript[4] = {0}; +COMMON_DATA struct ApproachingTrainer gApproachingTrainers[2] = {0}; +COMMON_DATA u8 gNoOfApproachingTrainers = 0; +COMMON_DATA bool8 gTrainerApproachedPlayer = 0; // EWRAM EWRAM_DATA u8 gApproachingTrainerId = 0; diff --git a/src/tv.c b/src/tv.c index e0f910eaaf89..c67d98407e4e 100644 --- a/src/tv.c +++ b/src/tv.c @@ -63,14 +63,14 @@ enum { ROULETTE, }; -s8 sCurTVShowSlot; -u16 sTV_SecretBaseVisitMovesTemp[8]; -u8 sTV_DecorationsBuffer[DECOR_MAX_SECRET_BASE]; -struct { +COMMON_DATA s8 sCurTVShowSlot = 0; +COMMON_DATA u16 sTV_SecretBaseVisitMovesTemp[8] = {0}; +COMMON_DATA u8 sTV_DecorationsBuffer[DECOR_MAX_SECRET_BASE] = {0}; +COMMON_DATA struct { u8 level; u16 species; u16 move; -} sTV_SecretBaseVisitMonsTemp[10]; +} sTV_SecretBaseVisitMonsTemp[10] = {0}; static u8 sTVShowMixingNumPlayers; static u8 sTVShowNewsMixingNumPlayers; diff --git a/src/union_room_player_avatar.c b/src/union_room_player_avatar.c index 6a2d6081c161..c99cc0e493c0 100644 --- a/src/union_room_player_avatar.c +++ b/src/union_room_player_avatar.c @@ -14,7 +14,7 @@ // Each parent player can lead a group of up to MAX_RFU_PLAYERS (including themselves). // Multiply the leader's id by MAX_RFU_PLAYERS and add the member's id (0 if the leader) to // get the sprite index of that player. -#define UR_PLAYER_SPRITE_ID(leaderId, memberId)(MAX_RFU_PLAYERS * leaderId + memberId) +#define UR_PLAYER_SPRITE_ID(leaderId, memberId) (MAX_RFU_PLAYERS * leaderId + memberId) static EWRAM_DATA struct UnionRoomObject * sUnionObjWork = NULL; static EWRAM_DATA u32 sUnionObjRefreshTimer = 0; diff --git a/gflib/window.c b/src/window.c similarity index 99% rename from gflib/window.c rename to src/window.c index 5e77283945b5..ec998083a04c 100644 --- a/gflib/window.c +++ b/src/window.c @@ -5,8 +5,8 @@ #include "blit.h" // This global is set to 0 and never changed. -u8 gTransparentTileNumber; -void *gWindowBgTilemapBuffers[NUM_BACKGROUNDS]; +COMMON_DATA u8 gTransparentTileNumber = 0; +COMMON_DATA void *gWindowBgTilemapBuffers[NUM_BACKGROUNDS] = {0}; extern u32 gWindowTileAutoAllocEnabled; EWRAM_DATA struct Window gWindows[WINDOWS_MAX] = {0}; diff --git a/sym_bss.txt b/sym_bss.txt index 3a23e747890e..0520e0b5b0a9 100644 --- a/sym_bss.txt +++ b/sym_bss.txt @@ -1,10 +1,10 @@ .include "src/main.o" - .include "gflib/malloc.o" - .include "gflib/dma3_manager.o" - .include "gflib/gpu_regs.o" - .include "gflib/bg.o" - .include "gflib/text.o" - .include "gflib/sprite.o" + .include "src/malloc.o" + .include "src/dma3_manager.o" + .include "src/gpu_regs.o" + .include "src/bg.o" + .include "src/text.o" + .include "src/sprite.o" .include "src/link.o" .include "src/AgbRfu_LinkManager.o" .include "src/link_rfu_3.o" diff --git a/sym_common.txt b/sym_common.txt index 170aee2f42a4..4df67008428a 100644 --- a/sym_common.txt +++ b/sym_common.txt @@ -1,37 +1,10 @@ - .space 0x8 - .include "main.o" - @ ../gflib/bg.o - .align 2 -gWindowTileAutoAllocEnabled: - .space 4 - @ ../gflib/window.o - .align 4 -gTransparentTileNumber: - .space 1 - .align 4 -gWindowBgTilemapBuffers: - .space 16 - @ ../gflib/text.o - .align 4 -gFonts: - .space 4 - .align 2 -gDisableTextPrinters: - .space 1 .align 4 -gCurGlyph: - .space 132 - .align 2 -gTextFlags: - .space 4 - @ ../gflib/sprite.o - .align 2 -gOamMatrixAllocBitmap: - .space 4 - .align 2 -gReservedSpritePaletteCount: - .space 1 + .include "main.o" + .include "bg.o" .align 4 + .include "window.o" + .include "text.o" + .include "sprite.o" .include "link.o" .include "AgbRfu_LinkManager.o" .include "link_rfu_2.o" @@ -54,9 +27,7 @@ gReservedSpritePaletteCount: .include "tv.o" .include "mauville_old_man.o" .include "image_processing_effects.o" - - .space 0x4 - + .align 4 .include "contest_painting.o" .include "field_specials.o" .include "evolution_scene.o" @@ -67,14 +38,9 @@ gReservedSpritePaletteCount: .include "battle_anim_throw.o" .include "battle_factory_screen.o" .include "apprentice.o" - - .space 0x8 - + .align 4 .include "list_menu.o" .include "party_menu.o" - - .space 0x44 - .include "ereader_screen.o" .include "m4a.o" .include "agb_flash.o" diff --git a/sym_ewram.txt b/sym_ewram.txt index 3123b3388aa1..81613166dcab 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -1,10 +1,10 @@ - .include "gflib/malloc.o" + .include "src/malloc.o" .include "src/decompress.o" .include "src/main.o" - .include "gflib/window.o" - .include "gflib/text.o" - .include "gflib/sprite.o" - .include "gflib/string_util.o" + .include "src/window.o" + .include "src/text.o" + .include "src/sprite.o" + .include "src/string_util.o" .include "src/link.o" .include "src/AgbRfu_LinkManager.o" .include "src/link_rfu_3.o" diff --git a/test/test_runner.c b/test/test_runner.c index 3e8ef696d836..3e7202526dea 100644 --- a/test/test_runner.c +++ b/test/test_runner.c @@ -1,11 +1,11 @@ #include #include "global.h" -#include "characters.h" #include "gpu_regs.h" #include "load_save.h" #include "main.h" #include "malloc.h" #include "random.h" +#include "constants/characters.h" #include "test_runner.h" #include "test/test.h" diff --git a/test/test_runner_battle.c b/test/test_runner_battle.c index c8e4496030b1..d870d4ae416a 100644 --- a/test/test_runner_battle.c +++ b/test/test_runner_battle.c @@ -5,7 +5,6 @@ #include "battle_controllers.h" #include "battle_gimmick.h" #include "battle_z_move.h" -#include "characters.h" #include "event_data.h" #include "fieldmap.h" #include "item_menu.h" @@ -14,6 +13,7 @@ #include "random.h" #include "test/battle.h" #include "window.h" +#include "constants/characters.h" #include "constants/trainers.h" #if defined(__INTELLISENSE__) diff --git a/tools/jsonproc/jsonproc.cpp b/tools/jsonproc/jsonproc.cpp index 9ef23cd43e58..03e51b765a0a 100755 --- a/tools/jsonproc/jsonproc.cpp +++ b/tools/jsonproc/jsonproc.cpp @@ -1,4 +1,6 @@ // jsonproc.cpp +// jsonproc converts JSON data to an output file based on an Inja template. +// https://github.com/pantor/inja #include "jsonproc.h" diff --git a/tools/mapjson/json11.cpp b/tools/mapjson/json11.cpp index 1da530206bd7..3ac5f392a0bd 100644 --- a/tools/mapjson/json11.cpp +++ b/tools/mapjson/json11.cpp @@ -33,7 +33,6 @@ using std::vector; using std::map; using std::make_shared; using std::initializer_list; -using std::move; /* Helper for representing null - just a do-nothing struct, plus comparison * operators so the helpers in JsonValue work. We can't use nullptr_t because @@ -149,7 +148,7 @@ class Value : public JsonValue { // Constructors explicit Value(const T &value) : m_value(value) {} - explicit Value(T &&value) : m_value(move(value)) {} + explicit Value(T &&value) : m_value(std::move(value)) {} // Get type tag Json::Type type() const override { @@ -196,7 +195,7 @@ class JsonString final : public Value { const string &string_value() const override { return m_value; } public: explicit JsonString(const string &value) : Value(value) {} - explicit JsonString(string &&value) : Value(move(value)) {} + explicit JsonString(string &&value) : Value(std::move(value)) {} }; class JsonArray final : public Value { @@ -204,7 +203,7 @@ class JsonArray final : public Value { const Json & operator[](size_t i) const override; public: explicit JsonArray(const Json::array &value) : Value(value) {} - explicit JsonArray(Json::array &&value) : Value(move(value)) {} + explicit JsonArray(Json::array &&value) : Value(std::move(value)) {} }; class JsonObject final : public Value { @@ -212,7 +211,7 @@ class JsonObject final : public Value { const Json & operator[](const string &key) const override; public: explicit JsonObject(const Json::object &value) : Value(value) {} - explicit JsonObject(Json::object &&value) : Value(move(value)) {} + explicit JsonObject(Json::object &&value) : Value(std::move(value)) {} }; class JsonNull final : public Value { @@ -254,12 +253,12 @@ Json::Json(double value) : m_ptr(make_shared(value)) { Json::Json(int value) : m_ptr(make_shared(value)) {} Json::Json(bool value) : m_ptr(value ? statics().t : statics().f) {} Json::Json(const string &value) : m_ptr(make_shared(value)) {} -Json::Json(string &&value) : m_ptr(make_shared(move(value))) {} +Json::Json(string &&value) : m_ptr(make_shared(std::move(value))) {} Json::Json(const char * value) : m_ptr(make_shared(value)) {} Json::Json(const Json::array &values) : m_ptr(make_shared(values)) {} -Json::Json(Json::array &&values) : m_ptr(make_shared(move(values))) {} +Json::Json(Json::array &&values) : m_ptr(make_shared(std::move(values))) {} Json::Json(const Json::object &values) : m_ptr(make_shared(values)) {} -Json::Json(Json::object &&values) : m_ptr(make_shared(move(values))) {} +Json::Json(Json::object &&values) : m_ptr(make_shared(std::move(values))) {} /* * * * * * * * * * * * * * * * * * * * * Accessors @@ -357,7 +356,7 @@ struct JsonParser final { * Mark this parse as failed. */ Json fail(string &&msg) { - return fail(move(msg), Json()); + return fail(std::move(msg), Json()); } template diff --git a/tools/mapjson/mapjson.cpp b/tools/mapjson/mapjson.cpp index 4f59dc7575c0..5956ddc5068e 100644 --- a/tools/mapjson/mapjson.cpp +++ b/tools/mapjson/mapjson.cpp @@ -30,6 +30,8 @@ using json11::Json; #include "mapjson.h" string version; +// System directory separator +string sep; string read_text_file(string filepath) { ifstream in_file(filepath); @@ -195,7 +197,7 @@ string generate_map_events_text(Json map_data) { string mapName = json_to_string(map_data, "name"); - text << "@\n@ DO NOT MODIFY THIS FILE! It is auto-generated from data/maps/" << mapName << "/map.json\n@\n\n"; + text << "@\n@ DO NOT MODIFY THIS FILE! It is auto-generated from data/maps/" << mapName << "/map.json\n@\n\n\t.align 2\n\n"; string objects_label, warps_label, coords_label, bgs_label; @@ -330,13 +332,22 @@ string generate_map_events_text(Json map_data) { return text.str(); } -string get_directory_name(string filename) { - size_t dir_pos = filename.find_last_of("/\\"); +string strip_trailing_separator(string filename) { + if(filename.back() == '/' || filename.back() == '\\') + filename.pop_back(); + return filename; +} +void infer_separator(string filename) { + size_t dir_pos = filename.find_last_of("/\\"); + sep = filename[dir_pos]; +} +string file_parent(string filename){ + size_t dir_pos = filename.find_last_of("/\\"); return filename.substr(0, dir_pos + 1); } -void process_map(string map_filepath, string layouts_filepath) { +void process_map(string map_filepath, string layouts_filepath, string output_dir) { string mapdata_err, layouts_err; string mapdata_json_text = read_text_file(map_filepath); @@ -354,10 +365,10 @@ void process_map(string map_filepath, string layouts_filepath) { string events_text = generate_map_events_text(map_data); string connections_text = generate_map_connections_text(map_data); - string files_dir = get_directory_name(map_filepath); - write_text_file(files_dir + "header.inc", header_text); - write_text_file(files_dir + "events.inc", events_text); - write_text_file(files_dir + "connections.inc", connections_text); + string out_dir = strip_trailing_separator(output_dir).append(sep); + write_text_file(out_dir + "header.inc", header_text); + write_text_file(out_dir + "events.inc", events_text); + write_text_file(out_dir + "connections.inc", connections_text); } string generate_groups_text(Json groups_data) { @@ -382,7 +393,7 @@ string generate_groups_text(Json groups_data) { return text.str(); } -string generate_connections_text(Json groups_data) { +string generate_connections_text(Json groups_data, string include_path) { vector map_names; for (auto &group : groups_data["group_order"].array_items()) @@ -407,12 +418,12 @@ string generate_connections_text(Json groups_data) { text << "@\n@ DO NOT MODIFY THIS FILE! It is auto-generated from data/maps/map_groups.json\n@\n\n"; for (Json map_name : map_names) - text << "\t.include \"data/maps/" << json_to_string(map_name) << "/connections.inc\"\n"; + text << "\t.include \"" << include_path << "/" << json_to_string(map_name) << "/connections.inc\"\n"; return text.str(); } -string generate_headers_text(Json groups_data) { +string generate_headers_text(Json groups_data, string include_path) { vector map_names; for (auto &group : groups_data["group_order"].array_items()) @@ -424,12 +435,12 @@ string generate_headers_text(Json groups_data) { text << "@\n@ DO NOT MODIFY THIS FILE! It is auto-generated from data/maps/map_groups.json\n@\n\n"; for (string map_name : map_names) - text << "\t.include \"data/maps/" << map_name << "/header.inc\"\n"; + text << "\t.include \"" << include_path << "/" << map_name << "/header.inc\"\n"; return text.str(); } -string generate_events_text(Json groups_data) { +string generate_events_text(Json groups_data, string include_path) { vector map_names; for (auto &group : groups_data["group_order"].array_items()) @@ -438,17 +449,16 @@ string generate_events_text(Json groups_data) { ostringstream text; - text << "@\n@ DO NOT MODIFY THIS FILE! It is auto-generated from data/maps/map_groups.json\n@\n\n"; + text << "@\n@ DO NOT MODIFY THIS FILE! It is auto-generated from " << include_path << "/map_groups.json\n@\n\n"; for (string map_name : map_names) - text << "\t.include \"data/maps/" << map_name << "/events.inc\"\n"; + text << "\t.include \"" << include_path << "/" << map_name << "/events.inc\"\n"; return text.str(); } string generate_map_constants_text(string groups_filepath, Json groups_data) { - string file_dir = get_directory_name(groups_filepath); - char dir_separator = file_dir.back(); + string file_dir = file_parent(groups_filepath) + sep; ostringstream text; ostringstream mapCountText; @@ -470,7 +480,7 @@ string generate_map_constants_text(string groups_filepath, Json groups_data) { int map_count = 0; //DEBUG for (auto &map_name : groups_data[groupName].array_items()) { - string map_filepath = file_dir + json_to_string(map_name) + dir_separator + "map.json"; + string map_filepath = file_dir + json_to_string(map_name) + sep + "map.json"; string err_str; Json map_data = Json::parse(read_text_file(map_filepath), err_str); if (map_data == Json()) @@ -507,7 +517,11 @@ string generate_map_constants_text(string groups_filepath, Json groups_data) { return text.str(); } -void process_groups(string groups_filepath) { +// Output paths are directories with trailing path separators +void process_groups(string groups_filepath, string output_asm, string output_c) { + output_asm = strip_trailing_separator(output_asm); // Remove separator if existing. + output_c = strip_trailing_separator(output_c); + string err; Json groups_data = Json::parse(read_text_file(groups_filepath), err); @@ -515,19 +529,16 @@ void process_groups(string groups_filepath) { FATAL_ERROR("%s\n", err.c_str()); string groups_text = generate_groups_text(groups_data); - string connections_text = generate_connections_text(groups_data); - string headers_text = generate_headers_text(groups_data); - string events_text = generate_events_text(groups_data); + string connections_text = generate_connections_text(groups_data, output_asm); + string headers_text = generate_headers_text(groups_data, output_asm); + string events_text = generate_events_text(groups_data, output_asm); string map_header_text = generate_map_constants_text(groups_filepath, groups_data); - string file_dir = get_directory_name(groups_filepath); - char s = file_dir.back(); - - write_text_file(file_dir + "groups.inc", groups_text); - write_text_file(file_dir + "connections.inc", connections_text); - write_text_file(file_dir + "headers.inc", headers_text); - write_text_file(file_dir + "events.inc", events_text); - write_text_file(file_dir + ".." + s + ".." + s + "include" + s + "constants" + s + "map_groups.h", map_header_text); + write_text_file(output_asm + sep + "groups.inc", groups_text); + write_text_file(output_asm + sep + "connections.inc", connections_text); + write_text_file(output_asm + sep + "headers.inc", headers_text); + write_text_file(output_asm + sep + "events.inc", events_text); + write_text_file(output_c + sep + "map_groups.h", map_header_text); } string generate_layout_headers_text(Json layouts_data) { @@ -600,7 +611,10 @@ string generate_layouts_constants_text(Json layouts_data) { return text.str(); } -void process_layouts(string layouts_filepath) { +void process_layouts(string layouts_filepath, string output_asm, string output_c) { + output_asm = strip_trailing_separator(output_asm).append(sep); + output_c = strip_trailing_separator(output_c).append(sep); + string err; Json layouts_data = Json::parse(read_text_file(layouts_filepath), err); @@ -611,12 +625,9 @@ void process_layouts(string layouts_filepath) { string layouts_table_text = generate_layouts_table_text(layouts_data); string layouts_constants_text = generate_layouts_constants_text(layouts_data); - string file_dir = get_directory_name(layouts_filepath); - char s = file_dir.back(); - - write_text_file(file_dir + "layouts.inc", layout_headers_text); - write_text_file(file_dir + "layouts_table.inc", layouts_table_text); - write_text_file(file_dir + ".." + s + ".." + s + "include" + s + "constants" + s + "layouts.h", layouts_constants_text); + write_text_file(output_asm + "layouts.inc", layout_headers_text); + write_text_file(output_asm + "layouts_table.inc", layouts_table_text); + write_text_file(output_c + "layouts.h", layouts_constants_text); } int main(int argc, char *argv[]) { @@ -634,29 +645,40 @@ int main(int argc, char *argv[]) { FATAL_ERROR("ERROR: must be 'layouts', 'map', or 'groups'.\n"); if (mode == "map") { - if (argc != 5) - FATAL_ERROR("USAGE: mapjson map \n"); + if (argc != 6) + FATAL_ERROR("USAGE: mapjson map \n"); + infer_separator(argv[3]); string filepath(argv[3]); string layouts_filepath(argv[4]); + string output_dir(argv[5]); - process_map(filepath, layouts_filepath); + process_map(filepath, layouts_filepath, output_dir); } else if (mode == "groups") { - if (argc != 4) - FATAL_ERROR("USAGE: mapjson groups \n"); + if (argc != 6) + FATAL_ERROR("USAGE: mapjson groups \n"); + infer_separator(argv[3]); string filepath(argv[3]); + string output_asm(argv[4]); + string output_c(argv[5]); - process_groups(filepath); + process_groups(filepath, output_asm, output_c); } else if (mode == "layouts") { - if (argc != 4) - FATAL_ERROR("USAGE: mapjson layouts \n"); + if (argc != 6) + FATAL_ERROR("USAGE: mapjson layouts \n"); + infer_separator(argv[3]); string filepath(argv[3]); + string output_asm(argv[4]); + string output_c(argv[5]); - process_layouts(filepath); + process_layouts(filepath, output_asm, output_c); + } + else { + FATAL_ERROR("ERROR: must be 'layouts', 'map', or 'groups'.\n"); } return 0; diff --git a/tools/preproc/asm_file.cpp b/tools/preproc/asm_file.cpp index 39d352bbd7ad..66667935a1f1 100644 --- a/tools/preproc/asm_file.cpp +++ b/tools/preproc/asm_file.cpp @@ -26,7 +26,7 @@ #include "char_util.h" #include "utf8.h" #include "string_parser.h" -#include "../../gflib/characters.h" +#include "../../include/constants/characters.h" #include "io.h" AsmFile::AsmFile(std::string filename, bool isStdin, bool doEnum) : m_filename(filename) @@ -520,9 +520,21 @@ bool AsmFile::ParseEnum() long currentHeaderLine = SkipWhitespaceAndEol(); std::string enumName = ReadIdentifier(); currentHeaderLine += SkipWhitespaceAndEol(); + std::string enumBase = "0"; long enumCounter = 0; long symbolCount = 0; + if (m_buffer[m_pos] == ':') // : + { + m_pos++; + std::string underlyingType; + do { + currentHeaderLine += SkipWhitespaceAndEol(); + underlyingType = ReadIdentifier(); + } while (!underlyingType.empty()); + currentHeaderLine += SkipWhitespaceAndEol(); + } + if (m_buffer[m_pos] != '{') // assume assembly macro, otherwise assume enum and report errors accordingly { m_pos = fallbackPosition - 4; @@ -542,11 +554,28 @@ bool AsmFile::ParseEnum() if (m_buffer[m_pos] == '=') { m_pos++; - currentHeaderLine += SkipWhitespaceAndEol(); - enumCounter = ReadInteger(headerFilename, currentHeaderLine); - currentHeaderLine += SkipWhitespaceAndEol(); + SkipWhitespace(); + enumBase.clear(); + for (;;) + { + if (m_pos == m_size) + RaiseError("unexpected EOF"); + if (m_buffer[m_pos] == ',') + break; + if (m_buffer[m_pos] == '\n') + { + currentHeaderLine++; + enumBase.push_back(' '); + } + else + { + enumBase.push_back(m_buffer[m_pos]); + } + m_pos++; + } + enumCounter = 0; } - std::printf(".equiv %s, %ld\n", currentIdentName.c_str(), enumCounter); + std::printf(".equiv %s, (%s) + %ld\n", currentIdentName.c_str(), enumBase.c_str(), enumCounter); enumCounter++; symbolCount++; } diff --git a/tools/ramscrgen/elf.cpp b/tools/ramscrgen/elf.cpp index 7e78704b8c11..077fcc82a4f3 100644 --- a/tools/ramscrgen/elf.cpp +++ b/tools/ramscrgen/elf.cpp @@ -1,7 +1,6 @@ #include #include #include -#include #include #include #include "ramscrgen.h" @@ -22,6 +21,7 @@ static int s_shstrtabIndex; static std::uint32_t s_symtabOffset; static std::uint32_t s_strtabOffset; +static std::uint32_t s_pseudoCommonSectionIndex; static std::uint32_t s_symbolCount; static std::uint32_t s_elfFileOffset; @@ -101,18 +101,6 @@ static void VerifyElfIdent() FATAL_ERROR("error: \"%s\" not little-endian ELF\n", s_elfPath.c_str()); } -static void VerifyAr() -{ - char expectedMagic[8] = {'!', '<', 'a', 'r', 'c', 'h', '>', '\n'}; - char magic[8]; - - if (std::fread(magic, 8, 1, s_file) != 1) - FATAL_ERROR("error: failed to read AR magic from \"%s\"\n", s_archiveFilePath.c_str()); - - if (std::memcmp(magic, expectedMagic, 8) != 0) - FATAL_ERROR("error: AR magic did not match in \"%s\"\n", s_archiveFilePath.c_str()); -} - static void ReadElfHeader() { Seek(0x20); @@ -123,40 +111,6 @@ static void ReadElfHeader() s_shstrtabIndex = ReadInt16(); } -static void FindArObj() -{ - char file_ident[17] = {0}; - char filesize_s[11] = {0}; - char expectedEndMagic[2] = { 0x60, 0x0a }; - char end_magic[2]; - std::size_t filesize; - - Seek(8); - while (!std::feof(s_file)) { - if (std::fread(file_ident, 16, 1, s_file) != 1) - FATAL_ERROR("error: failed to read file ident in \"%s\"\n", s_archiveFilePath.c_str()); - Skip(32); - if (std::fread(filesize_s, 10, 1, s_file) != 1) - FATAL_ERROR("error: failed to read filesize in \"%s\"\n", s_archiveFilePath.c_str()); - if (std::fread(end_magic, 2, 1, s_file) != 1) - FATAL_ERROR("error: failed to read end sentinel in \"%s\"\n", s_archiveFilePath.c_str()); - if (std::memcmp(end_magic, expectedEndMagic, 2) != 0) - FATAL_ERROR("error: corrupted archive header in \"%s\" at \"%s\"\n", s_archiveFilePath.c_str(), file_ident); - - char * ptr = std::strchr(file_ident, '/'); - if (ptr != nullptr) - *ptr = 0; - filesize = std::strtoul(filesize_s, nullptr, 10); - if (std::strncmp(s_archiveObjectPath.c_str(), file_ident, 16) == 0) { - s_elfFileOffset = std::ftell(s_file); - return; - } - Skip(filesize); - } - - FATAL_ERROR("error: could not find object \"%s\" in archive \"%s\"\n", s_archiveObjectPath.c_str(), s_archiveFilePath.c_str()); -} - static std::string GetSectionName(std::uint32_t shstrtabOffset, int index) { Seek(s_sectionHeaderOffset + s_sectionHeaderEntrySize * index); @@ -169,6 +123,7 @@ static void FindTableOffsets() { s_symtabOffset = 0; s_strtabOffset = 0; + s_pseudoCommonSectionIndex = 0; Seek(s_sectionHeaderOffset + s_sectionHeaderEntrySize * s_shstrtabIndex + 0x10); std::uint32_t shstrtabOffset = ReadInt32(); @@ -192,6 +147,11 @@ static void FindTableOffsets() FATAL_ERROR("error: mutiple .strtab sections found in \"%s\"\n", s_elfPath.c_str()); Seek(s_sectionHeaderOffset + s_sectionHeaderEntrySize * i + 0x10); s_strtabOffset = ReadInt32(); + } else if (name == "common_data") { + if (s_pseudoCommonSectionIndex) { + FATAL_ERROR("error: mutiple common_data sections found in \"%s\"\n", s_elfPath.c_str()); + } + s_pseudoCommonSectionIndex = i; } } @@ -202,65 +162,50 @@ static void FindTableOffsets() FATAL_ERROR("error: couldn't find .strtab section in \"%s\"\n", s_elfPath.c_str()); } -static std::map GetCommonSymbols_Shared() +static std::vector> GetCommonSymbols_Shared() { VerifyElfIdent(); ReadElfHeader(); FindTableOffsets(); - std::map commonSymbols; - - std::vector commonSymbolVec; - - Seek(s_symtabOffset); - - for (std::uint32_t i = 0; i < s_symbolCount; i++) - { - Symbol sym; - sym.nameOffset = ReadInt32(); - Skip(4); - sym.size = ReadInt32(); - Skip(2); - std::uint16_t sectionIndex = ReadInt16(); - if (sectionIndex == SHN_COMMON) - commonSymbolVec.push_back(sym); - } + std::vector> commonSymbols; - for (const Symbol& sym : commonSymbolVec) - { - Seek(s_strtabOffset + sym.nameOffset); - std::string name = ReadString(); - commonSymbols[name] = sym.size; + if (s_pseudoCommonSectionIndex) { + std::vector commonSymbolVec; + + Seek(s_symtabOffset); + + for (std::uint32_t i = 0; i < s_symbolCount; i++) + { + Symbol sym; + sym.nameOffset = ReadInt32(); + Skip(4); + sym.size = ReadInt32(); + Skip(2); + std::uint16_t sectionIndex = ReadInt16(); + if (sectionIndex == s_pseudoCommonSectionIndex) + commonSymbolVec.push_back(sym); + } + + for (const Symbol& sym : commonSymbolVec) + { + Seek(s_strtabOffset + sym.nameOffset); + std::string name = ReadString(); + if (name == "$d" || name == "") { + continue; + } + commonSymbols.emplace_back(name, sym.size); + } } return commonSymbols; } -std::map GetCommonSymbolsFromLib(std::string sourcePath, std::string libpath) -{ - std::size_t colonPos = libpath.find(':'); - if (colonPos == std::string::npos) - FATAL_ERROR("error: missing colon separator in libfile \"%s\"\n", s_elfPath.c_str()); - - s_archiveObjectPath = libpath.substr(colonPos + 1); - s_archiveFilePath = sourcePath + "/" + libpath.substr(1, colonPos - 1); - s_elfPath = sourcePath + "/" + libpath.substr(1); - - s_file = std::fopen(s_archiveFilePath.c_str(), "rb"); - - if (s_file == NULL) - FATAL_ERROR("error: failed to open \"%s\" for reading\n", s_archiveFilePath.c_str()); - - VerifyAr(); - FindArObj(); - return GetCommonSymbols_Shared(); -} - -std::map GetCommonSymbols(std::string sourcePath, std::string path) +std::vector> GetCommonSymbols(std::string sourcePath, std::string path) { s_elfFileOffset = 0; if (path[0] == '*') - return GetCommonSymbolsFromLib(sourcePath, path); + FATAL_ERROR("error: library common syms are unsupported (filename: \"%s\")\n", path.c_str()); s_elfPath = sourcePath + "/" + path; s_file = std::fopen(s_elfPath.c_str(), "rb"); diff --git a/tools/ramscrgen/elf.h b/tools/ramscrgen/elf.h index 3704860c0e47..bf79a954e08b 100644 --- a/tools/ramscrgen/elf.h +++ b/tools/ramscrgen/elf.h @@ -22,9 +22,9 @@ #define ELF_H #include -#include +#include #include -std::map GetCommonSymbols(std::string sourcePath, std::string path); +std::vector> GetCommonSymbols(std::string sourcePath, std::string path); #endif // ELF_H diff --git a/tools/ramscrgen/main.cpp b/tools/ramscrgen/main.cpp index 5e5894f470de..e99cf9fa307a 100644 --- a/tools/ramscrgen/main.cpp +++ b/tools/ramscrgen/main.cpp @@ -28,54 +28,19 @@ void HandleCommonInclude(std::string filename, std::string sourcePath, std::string symOrderPath, std::string lang) { auto commonSymbols = GetCommonSymbols(sourcePath, filename); - std::size_t dotIndex; - if (filename[0] == '*') { - dotIndex = filename.find_last_of(':'); - filename = filename.substr(dotIndex + 1); - } - - dotIndex = filename.find_last_of('.'); - - if (dotIndex == std::string::npos) - FATAL_ERROR("error: \"%s\" doesn't have a file extension\n", filename.c_str()); - - std::string symOrderFilename = filename.substr(0, dotIndex + 1) + "txt"; - - SymFile symFile(symOrderPath + "/" + symOrderFilename); - - while (!symFile.IsAtEnd()) + for (const auto& commonSym : commonSymbols) { - symFile.HandleLangConditional(lang); - - std::string label = symFile.GetLabel(false); - - if (label.length() == 0) - { - unsigned long length; - if (symFile.ReadInteger(length)) - { - if (length & 3) - symFile.RaiseWarning("gap length %d is not multiple of 4", length); - printf(". += 0x%lX;\n", length); - } - } - else - { - if (commonSymbols.count(label) == 0) - symFile.RaiseError("no common symbol named \"%s\"", label.c_str()); - unsigned long size = commonSymbols[label]; - int alignment = 4; - if (size > 4) - alignment = 8; - if (size > 8) - alignment = 16; - printf(". = ALIGN(%d);\n", alignment); - printf("%s = .;\n", label.c_str()); - printf(". += 0x%lX;\n", size); - } - - symFile.ExpectEmptyRestOfLine(); + unsigned long size = commonSym.second; + + int alignment = 4; + if (size > 4) + alignment = 8; + if (size > 8) + alignment = 16; + printf(". = ALIGN(%d);\n", alignment); + printf("%s = .;\n", commonSym.first.c_str()); + printf(". += 0x%lX;\n", size); } } diff --git a/tools/scaninc/c_file.cpp b/tools/scaninc/c_file.cpp index e1d98acbd0fb..a978b9a50660 100644 --- a/tools/scaninc/c_file.cpp +++ b/tools/scaninc/c_file.cpp @@ -33,6 +33,11 @@ CFile::CFile(std::string path) m_size = std::ftell(fp); + if (m_size < 0) + FATAL_ERROR("File size of \"%s\" is less than zero.\n", path.c_str()); + else if (m_size == 0) + return; // Empty file + m_buffer = new char[m_size + 1]; m_buffer[m_size] = 0; @@ -49,7 +54,7 @@ CFile::CFile(std::string path) CFile::~CFile() { - delete[] m_buffer; + if (m_size > 0) delete[] m_buffer; } void CFile::FindIncbins() diff --git a/tools/scaninc/scaninc.cpp b/tools/scaninc/scaninc.cpp index dcb16c0e7944..d470a3f163e3 100644 --- a/tools/scaninc/scaninc.cpp +++ b/tools/scaninc/scaninc.cpp @@ -24,6 +24,9 @@ #include #include #include +#include +#include +#include #include "scaninc.h" #include "source_file.h" @@ -38,15 +41,19 @@ bool CanOpenFile(std::string path) return true; } -const char *const USAGE = "Usage: scaninc [-I INCLUDE_PATH] FILE_PATH\n"; +const char *const USAGE = "Usage: scaninc [-I INCLUDE_PATH] [-M DEPENDENCY_OUT_PATH] FILE_PATH\n"; int main(int argc, char **argv) { std::queue filesToProcess; std::set dependencies; + std::set dependencies_includes; std::vector includeDirs; + bool makeformat = false; + std::string make_outfile; + argc--; argv++; @@ -68,6 +75,13 @@ int main(int argc, char **argv) } includeDirs.push_back(includeDir); } + else if(arg.substr(0, 2) == "-M") + { + makeformat = true; + argc--; + argv++; + make_outfile = std::string(argv[0]); + } else { FATAL_ERROR(USAGE); @@ -111,7 +125,13 @@ int main(int argc, char **argv) if (!exists && (file.FileType() == SourceFileType::Asm || file.FileType() == SourceFileType::Inc)) { path = include; + if (CanOpenFile(path)) + exists = true; } + if (!exists) + continue; + + dependencies_includes.insert(path); bool inserted = dependencies.insert(path).second; if (inserted && exists) { @@ -121,8 +141,46 @@ int main(int argc, char **argv) includeDirs.pop_back(); } - for (const std::string &path : dependencies) + if(!makeformat) + { + for (const std::string &path : dependencies) + { + std::printf("%s\n", path.c_str()); + } + std::cout << std::endl; + } + else { - std::printf("%s\n", path.c_str()); + // Write out make rules to a file + std::ofstream output(make_outfile); + + // Print a make rule for the object file + size_t ext_pos = make_outfile.find_last_of("."); + auto object_file = make_outfile.substr(0, ext_pos + 1) + "o"; + output << object_file.c_str() << ":"; + for (const std::string &path : dependencies) + { + output << " " << path; + } + output << '\n'; + + // Dependency list rule. + // Although these rules are identical, they need to be separate, else make will trigger the rule again after the file is created for the first time. + output << make_outfile.c_str() << ":"; + for (const std::string &path : dependencies_includes) + { + output << " " << path; + } + output << '\n'; + + // Dummy rules + // If a dependency is deleted, make will try to make it, instead of rescanning the dependencies before trying to do that. + for (const std::string &path : dependencies) + { + output << path << ":\n"; + } + + output.flush(); + output.close(); } }