From 7fa9819d9a91ea6641b966d13b5135d6a40074c9 Mon Sep 17 00:00:00 2001 From: Icedude907 <34080011+Icedude907@users.noreply.github.com> Date: Sat, 11 Nov 2023 22:51:04 +1300 Subject: [PATCH 01/10] Makefile uses make_tools, mapjson takes out dir. Removed generated files (layouts.h, map_groups.h) from git. --- Makefile | 55 ++- include/constants/.gitignore | 3 + include/constants/layouts.h | 450 ------------------------- include/constants/map_groups.h | 596 --------------------------------- make_tools.mk | 18 +- map_data_rules.mk | 30 +- tools/jsonproc/jsonproc.cpp | 2 + tools/mapjson/mapjson.cpp | 122 ++++--- 8 files changed, 131 insertions(+), 1145 deletions(-) create mode 100644 include/constants/.gitignore delete mode 100755 include/constants/layouts.h delete mode 100755 include/constants/map_groups.h diff --git a/Makefile b/Makefile index 5c073b36ca..7d92bad21c 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,9 @@ ifeq (compare,$(MAKECMDGOALS)) COMPARE := 1 endif +# Default make rule +all: rom + # don't use dkP's base_tools anymore # because the redefinition of $(CC) conflicts # with when we want to use $(CC) to preprocess files @@ -121,24 +124,21 @@ endif LDFLAGS = -Map ../../$(MAP) +AUTO_GEN_TARGETS := +include make_tools.mk 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) +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) 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 -TOOLBASE = $(TOOLDIRS:tools/%=%) -TOOLS = $(foreach tool,$(TOOLBASE),tools/$(tool)/$(tool)$(EXE)) - MAKEFLAGS += --no-print-directory # Clear the default suffixes @@ -151,7 +151,7 @@ MAKEFLAGS += --no-print-directory # Secondary expansion is required for dependency variables in object rules. .SECONDEXPANSION: -.PHONY: all rom clean compare tidy tools mostlyclean clean-tools $(TOOLDIRS) libagbsyscall modern tidymodern tidynonmodern +.PHONY: all rom clean compare tidy mostlyclean libagbsyscall modern tidymodern tidynonmodern infoshell = $(foreach line, $(shell $1 | sed "s/ /__SPACE__/g"), $(info $(subst __SPACE__, ,$(line)))) @@ -161,6 +161,7 @@ infoshell = $(foreach line, $(shell $1 | sed "s/ /__SPACE__/g"), $(info $(subst # Since we don't need to reload most of this makefile ifeq (,$(filter-out all rom compare modern libagbsyscall syms,$(MAKECMDGOALS))) $(call infoshell, $(MAKE) -f make_tools.mk) +$(call infoshell, $(MAKE) generated) else NODEP ?= 1 endif @@ -211,17 +212,8 @@ SUBDIRS := $(sort $(dir $(OBJS))) $(shell mkdir -p $(SUBDIRS)) endif -AUTO_GEN_TARGETS := - -all: rom - -tools: $(TOOLDIRS) - syms: $(SYM) -$(TOOLDIRS): - @$(MAKE) -C $@ - rom: $(ROM) ifeq ($(COMPARE),1) @$(SHA1) rom.sha1 @@ -232,9 +224,6 @@ compare: all clean: mostlyclean clean-tools -clean-tools: - @$(foreach tooldir,$(TOOLDIRS),$(MAKE) clean -C $(tooldir);) - mostlyclean: tidynonmodern tidymodern find sound -iname '*.bin' -exec rm {} + rm -f $(MID_SUBDIR)/*.s @@ -265,6 +254,8 @@ include spritesheet_rules.mk include json_data_rules.mk include songs.mk +generated: $(AUTO_GEN_TARGETS) + %.s: ; %.png: ; %.pal: ; @@ -282,7 +273,7 @@ sound/%.bin: sound/%.aif ; $(AIF) $< $@ 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 @@ -291,10 +282,10 @@ $(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)/m4a.o: CC1 := $(TOOLS_DIR)/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 @@ -322,7 +313,7 @@ else endif else define C_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 -I gflib $2) ifeq (,$$(KEEP_TEMPS)) @echo "$$(CC1) -o $$@ $$<" @$$(CPP) $$(CPPFLAGS) $$< | $$(PREPROC) $$< charmap.txt -i | $$(CC1) $$(CFLAGS) -o - - | cat - <(echo -e ".text\n\t.align\t2, 0") | $$(AS) $$(ASFLAGS) -o $$@ - @@ -349,7 +340,7 @@ else endif else define GFLIB_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 -I gflib $2) ifeq (,$$(KEEP_TEMPS)) @echo "$$(CC1) -o $$@ $$<" @$$(CPP) $$(CPPFLAGS) $$< | $$(PREPROC) $$< charmap.txt -i | $$(CC1) $$(CFLAGS) -o - - | cat - <(echo -e ".text\n\t.align\t2, 0") | $$(AS) $$(ASFLAGS) -o $$@ - diff --git a/include/constants/.gitignore b/include/constants/.gitignore new file mode 100644 index 0000000000..761af9db76 --- /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/include/constants/layouts.h b/include/constants/layouts.h deleted file mode 100755 index db92c95942..0000000000 --- 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 eaf40a525d..0000000000 --- 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/make_tools.mk b/make_tools.mk index 7e0baf8900..00824adda6 100644 --- a/make_tools.mk +++ b/make_tools.mk @@ -1,12 +1,24 @@ +# 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 -.PHONY: all $(TOOLDIRS) +TOOLDIRS := $(TOOL_NAMES:%=$(TOOLS_DIR)/%) -all: $(TOOLDIRS) +.PHONY: tools check-tools clean-tools $(TOOLDIRS) $(CHECKTOOLDIRS) + +tools: $(TOOLDIRS) +check-tools: $(CHECKTOOLDIRS) $(TOOLDIRS): @$(MAKE) -C $@ + +$(CHECKTOOLDIRS): + @$(MAKE) -C $@ + +clean-tools: + @$(foreach tooldir,$(TOOLDIRS),$(MAKE) clean -C $(tooldir);) diff --git a/map_data_rules.mk b/map_data_rules.mk index 626cd47240..974a82f14a 100755 --- a/map_data_rules.mk +++ b/map_data_rules.mk @@ -1,8 +1,17 @@ # 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)) @@ -13,19 +22,12 @@ $(DATA_ASM_BUILDDIR)/maps.o: $(DATA_ASM_SUBDIR)/maps.s $(LAYOUTS_DIR)/layouts.in $(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 ; -include/constants/map_groups.h: $(MAPS_DIR)/headers.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) -$(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)/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) \ No newline at end of file diff --git a/tools/jsonproc/jsonproc.cpp b/tools/jsonproc/jsonproc.cpp index 23056a5ff3..a43c5b7624 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/mapjson.cpp b/tools/mapjson/mapjson.cpp index e53ac7924d..1632b56be6 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); @@ -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,16 +365,16 @@ 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) { 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 /map_groups.json\n@\n\n"; for (auto &key : groups_data["group_order"].array_items()) { string group = json_to_string(key); @@ -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()) @@ -404,15 +415,15 @@ string generate_connections_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 /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()) @@ -421,15 +432,15 @@ string generate_headers_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 /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,24 +449,23 @@ 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; text << "#ifndef GUARD_CONSTANTS_MAP_GROUPS_H\n" << "#define GUARD_CONSTANTS_MAP_GROUPS_H\n\n"; - 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 /map_groups.json\n//\n\n"; int group_num = 0; @@ -466,7 +476,7 @@ string generate_map_constants_text(string groups_filepath, Json groups_data) { size_t max_length = 0; 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()) @@ -493,7 +503,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); @@ -501,25 +515,22 @@ 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) { ostringstream text; - text << "@\n@ DO NOT MODIFY THIS FILE! It is auto-generated from data/layouts/layouts.json\n@\n\n"; + text << "@\n@ DO NOT MODIFY THIS FILE! It is auto-generated from layouts.json\n@\n\n"; for (auto &layout : layouts_data["layouts"].array_items()) { if (layout == Json::object()) continue; @@ -586,7 +597,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); @@ -597,12 +611,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[]) { @@ -620,29 +631,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; From 2198ca31c7a5239176b92bc577408bc1e7715cd4 Mon Sep 17 00:00:00 2001 From: Icedude907 <34080011+Icedude907@users.noreply.github.com> Date: Sun, 12 Nov 2023 13:20:09 +1300 Subject: [PATCH 02/10] Reordered makefile. Added some documentation and simplified dependency scanning. --- Makefile | 359 ++++++++++++++++++++++++-------------------------- make_tools.mk | 4 +- 2 files changed, 178 insertions(+), 185 deletions(-) diff --git a/Makefile b/Makefile index 7d92bad21c..1eb4b8b55a 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,22 @@ -TOOLCHAIN := $(DEVKITARM) -COMPARE ?= 0 +# GBA rom header +TITLE := POKEMON EMER +GAME_CODE := BPEE +MAKER_CODE := 01 +REVISION := 0 +MODERN ?= 0 +# `File name`.gba ('_modern' will be appended to the modern builds) +FILE_NAME := pokeemerald +BUILD_DIR := build + +# Builds the ROM using a modern compiler +MODERN ?= 0 +# Compares the ROM to a checksum of the original - only makes sense using when non-modern +COMPARE ?= 0 + +ifeq (modern,$(MAKECMDGOALS)) + MODERN := 1 +endif ifeq (compare,$(MAKECMDGOALS)) COMPARE := 1 endif @@ -8,45 +24,29 @@ 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 ?= 0 - -ifeq (modern,$(MAKECMDGOALS)) - MODERN := 1 +ifeq ($(OS),Windows_NT) + EXE := .exe endif # use arm-none-eabi-cpp for macOS @@ -66,22 +66,29 @@ else CPP := $(PREFIX)cpp endif -ROM_NAME := pokeemerald.gba +ROM_NAME := $(FILE_NAME).gba +OBJ_DIR_NAME := $(BUILD_DIR)/emerald +MODERN_ROM_NAME := $(FILE_NAME)_modern.gba +MODERN_OBJ_DIR_NAME := $(BUILD_DIR)/modern + ELF_NAME := $(ROM_NAME:.gba=.elf) MAP_NAME := $(ROM_NAME:.gba=.map) -OBJ_DIR_NAME := build/emerald - -MODERN_ROM_NAME := pokeemerald_modern.gba MODERN_ELF_NAME := $(MODERN_ROM_NAME:.gba=.elf) MODERN_MAP_NAME := $(MODERN_ROM_NAME:.gba=.map) -MODERN_OBJ_DIR_NAME := build/modern -SHELL := /bin/bash -o pipefail - -ELF = $(ROM:.gba=.elf) -MAP = $(ROM:.gba=.map) -SYM = $(ROM:.gba=.sym) +# Pick our active variables +ifeq ($(MODERN),0) + ROM := $(ROM_NAME) + OBJ_DIR := $(OBJ_DIR_NAME) +else + ROM := $(MODERN_ROM_NAME) + OBJ_DIR := $(MODERN_OBJ_DIR_NAME) +endif +ELF := $(ROM:.gba=.elf) +MAP := $(ROM:.gba=.map) +SYM := $(ROM:.gba=.sym) +# Commonly used directories C_SUBDIR = src GFLIB_SUBDIR = gflib ASM_SUBDIR = asm @@ -99,34 +106,43 @@ DATA_ASM_BUILDDIR = $(OBJ_DIR)/$(DATA_ASM_SUBDIR) SONG_BUILDDIR = $(OBJ_DIR)/$(SONG_SUBDIR) MID_BUILDDIR = $(OBJ_DIR)/$(MID_SUBDIR) +SHELL := /bin/bash -o pipefail + +# Set flags for tools ASFLAGS := -mcpu=arm7tdmi --defsym MODERN=$(MODERN) -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 -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 -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 +INCLUDE_DIRS := include +INCLUDE_CPP_ARGS := $(INCLUDE_DIRS:%=-iquote %) +INCLUDE_SCANINC_ARGS := $(INCLUDE_DIRS:%=-I %) -CPPFLAGS := -iquote include -iquote $(GFLIB_SUBDIR) -Wno-trigraphs -DMODERN=$(MODERN) -ifneq ($(MODERN),1) -CPPFLAGS += -I tools/agbcc/include -I tools/agbcc -nostdinc -undef +O_LEVEL ?= 2 +CPPFLAGS := $(INCLUDE_CPP_ARGS) -iquote $(GFLIB_SUBDIR) -Wno-trigraphs -DMODERN=$(MODERN) +ifeq ($(MODERN),0) + 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 + # 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 + 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 +# Enable debug info if set +ifeq ($(DINFO),1) + override CFLAGS += -g endif LDFLAGS = -Map ../../$(MAP) +# Variable filled out in other make files AUTO_GEN_TARGETS := include make_tools.mk -SHA1 := $(shell { command -v sha1sum || command -v shasum; } 2>/dev/null) -c +# Tool executables GFX := $(TOOLS_DIR)/gbagfx/gbagfx$(EXE) AIF := $(TOOLS_DIR)/aif2pcm/aif2pcm$(EXE) MID := $(TOOLS_DIR)/mid2agb/mid2agb$(EXE) @@ -138,6 +154,7 @@ MAPJSON := $(TOOLS_DIR)/mapjson/mapjson$(EXE) JSONPROC := $(TOOLS_DIR)/jsonproc/jsonproc$(EXE) PERL := perl +SHA1 := $(shell { command -v sha1sum || command -v shasum; } 2>/dev/null) -c MAKEFLAGS += --no-print-directory @@ -147,39 +164,36 @@ MAKEFLAGS += --no-print-directory .SECONDARY: # 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 mostlyclean libagbsyscall modern tidymodern tidynonmodern +RULES_NO_SCAN += libagbsyscall clean clean-assets tidy tidymodern tidynonmodern generated clean-generated +.PHONY: all rom modern compare +.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 modern libagbsyscall syms,$(MAKECMDGOALS))) -$(call infoshell, $(MAKE) -f make_tools.mk) -$(call infoshell, $(MAKE) generated) -else -NODEP ?= 1 -endif - -# check if we need to scan dependencies based on the rule -ifeq (,$(MAKECMDGOALS)) - SCAN_DEPS ?= 1 -else - # clean, tidy, tools, mostlyclean, clean-tools, $(TOOLDIRS), tidymodern, tidynonmodern don't even build the ROM - # libagbsyscall does its own thing - ifeq (,$(filter-out clean tidy tools mostlyclean clean-tools $(TOOLDIRS) tidymodern tidynonmodern libagbsyscall,$(MAKECMDGOALS))) - SCAN_DEPS ?= 0 - else - SCAN_DEPS ?= 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 -ifeq ($(SCAN_DEPS),1) +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. + $(call infoshell, $(MAKE) -f make_tools.mk) + # Oh and also generate mapjson sources before we use `SCANINC`. + $(call infoshell, $(MAKE) generated) +endif + +# 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)) @@ -187,7 +201,7 @@ C_OBJS := $(patsubst $(C_SUBDIR)/%.c,$(C_BUILDDIR)/%.o,$(C_SRCS)) 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) @@ -210,29 +224,29 @@ OBJS_REL := $(patsubst $(OBJ_DIR)/%,%,$(OBJS)) SUBDIRS := $(sort $(dir $(OBJS))) $(shell mkdir -p $(SUBDIRS)) -endif -syms: $(SYM) +# Pretend rules that are actually flags defer to `make all` +modern: all +compare: all +# 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 +syms: $(SYM) -clean: mostlyclean clean-tools +clean: tidy clean-tools clean-generated clean-assets + @$(MAKE) clean -C libagbsyscall -mostlyclean: tidynonmodern tidymodern - 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 + 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 @@ -244,18 +258,13 @@ tidymodern: rm -f $(MODERN_ROM_NAME) $(MODERN_ELF_NAME) $(MODERN_MAP_NAME) rm -rf $(MODERN_OBJ_DIR_NAME) -ifneq ($(MODERN),0) -$(C_BUILDDIR)/berry_crush.o: override CFLAGS += -Wno-address-of-packed-member -endif - +# Other rules include graphics_file_rules.mk include map_data_rules.mk include spritesheet_rules.mk include json_data_rules.mk include songs.mk -generated: $(AUTO_GEN_TARGETS) - %.s: ; %.png: ; %.pal: ; @@ -271,119 +280,101 @@ generated: $(AUTO_GEN_TARGETS) $(CRY_SUBDIR)/%.bin: $(CRY_SUBDIR)/%.aif ; $(AIF) $< $@ --compress sound/%.bin: sound/%.aif ; $(AIF) $< $@ +# NOTE: Tools must have been built prior (FIXME) +generated: tools $(AUTO_GEN_TARGETS) +clean-generated: + -rm -f $(AUTO_GEN_TARGETS) ifeq ($(MODERN),0) -$(C_BUILDDIR)/libc.o: CC1 := $(TOOLS_DIR)/agbcc/bin/old_agbcc$(EXE) +$(C_BUILDDIR)/libc.o: CC1 := tools/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_DIR)/agbcc/bin/old_agbcc$(EXE) - +$(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_DIR)/agbcc/bin/agbcc_arm$(EXE) +$(C_BUILDDIR)/librfu_intr.o: CC1 := tools/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 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)) - @echo "$(CC1) -o $@ $<" - @$(CPP) $(CPPFLAGS) $< | $(PREPROC) $< charmap.txt -i | $(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 +# For C dependencies. +# Args: $1 = Output file without extension (build/assets/src/data), $2 = Input file (src/data.c) define C_DEP -$1: $2 $$(shell $(SCANINC) -I include -I $(TOOLS_DIR)/agbcc/include -I gflib $2) -ifeq (,$$(KEEP_TEMPS)) - @echo "$$(CC1) -o $$@ $$<" - @$$(CPP) $$(CPPFLAGS) $$< | $$(PREPROC) $$< charmap.txt -i | $$(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 +$(call C_DEP_IMPL,$1,$2,$1) endef -$(foreach src, $(C_SRCS), $(eval $(call C_DEP,$(patsubst $(C_SUBDIR)/%.c,$(C_BUILDDIR)/%.o,$(src)),$(src),$(patsubst $(C_SUBDIR)/%.c,%,$(src))))) -endif - -ifeq ($(NODEP),1) -$(GFLIB_BUILDDIR)/%.o: $(GFLIB_SUBDIR)/%.c $$(c_dep) +# Internal implementation details. +# $1: Output file without extension, $2 input file, $3 temp path (if keeping) +define C_DEP_IMPL +$1.o: $2 ifeq (,$(KEEP_TEMPS)) - @echo "$(CC1) -o $@ $<" - @$(CPP) $(CPPFLAGS) $< | $(PREPROC) $< charmap.txt -i | $(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_DIR)/agbcc/include -I gflib $2) -ifeq (,$$(KEEP_TEMPS)) @echo "$$(CC1) -o $$@ $$<" @$$(CPP) $$(CPPFLAGS) $$< | $$(PREPROC) $$< charmap.txt -i | $$(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 + @$$(CPP) $$(CPPFLAGS) $$< -o $3.i + @$$(PREPROC) $3.i charmap.txt | $$(CC1) $$(CFLAGS) -o $3.s + @echo -e ".text\n\t.align\t2, 0\n" >> $3.s + $$(AS) $$(ASFLAGS) -o $$@ $3.s +endif +$(call C_SCANINC,$1,$2) +endef +# Calls SCANINC to find dependencies +define C_SCANINC +ifneq ($(NODEP),1) +$1.o: $2 $$(shell $(SCANINC) $(INCLUDE_SCANINC_ARGS) -I tools/agbcc/include -I gflib $2) endif endef -$(foreach src, $(GFLIB_SRCS), $(eval $(call GFLIB_DEP,$(patsubst $(GFLIB_SUBDIR)/%.c,$(GFLIB_BUILDDIR)/%.o, $(src)),$(src),$(patsubst $(GFLIB_SUBDIR)/%.c,%, $(src))))) + +# Create generic rules if no dependency scanning, else create the real rules +ifeq ($(NODEP),1) +$(eval $(call C_DEP,$(C_BUILDDIR)/%,$(C_SUBDIR)/%.c)) +$(eval $(call C_DEP,$(GFLIB_BUILDDIR)/%,$(GFLIB_SUBDIR)/%.c)) +else +$(foreach src,$(C_SRCS),$(eval $(call C_DEP,$(OBJ_DIR)/$(basename $(src)),$(src)))) +$(foreach src,$(GFLIB_SRCS),$(eval $(call C_DEP,$(OBJ_DIR)/$(basename $(src)),$(src)))) endif -ifeq ($(NODEP),1) -$(C_BUILDDIR)/%.o: $(C_SUBDIR)/%.s - $(PREPROC) $< charmap.txt | $(CPP) -I include - | $(AS) $(ASFLAGS) -o $@ -else -define SRC_ASM_DATA_DEP -$1: $2 $$(shell $(SCANINC) -I include -I "" $2) - $$(PREPROC) $$< charmap.txt | $$(CPP) -I include - | $$(AS) $$(ASFLAGS) -o $$@ -endef -$(foreach src, $(C_ASM_SRCS), $(eval $(call SRC_ASM_DATA_DEP,$(patsubst $(C_SUBDIR)/%.s,$(C_BUILDDIR)/%.o, $(src)),$(src)))) -endif - -ifeq ($(NODEP),1) -$(ASM_BUILDDIR)/%.o: $(ASM_SUBDIR)/%.s - $(AS) $(ASFLAGS) -o $@ $< -else +# Similar methodology for Assembly files +# $1: Output path without extension, $2: Input file (`*.s`) define ASM_DEP -$1: $2 $$(shell $(SCANINC) -I include -I "" $2) +$1.o: $2 $$(AS) $$(ASFLAGS) -o $$@ $$< +$(call ASM_SCANINC,$1,$2) +endef +# As above but first doing a preprocessor pass +define ASM_DEP_PREPROC +$1.o: $2 + $$(PREPROC) $$< charmap.txt | $$(CPP) $(INCLUDE_SCANINC_ARGS) - | $$(AS) $$(ASFLAGS) -o $$@ +$(call ASM_SCANINC,$1,$2) endef -$(foreach src, $(ASM_SRCS), $(eval $(call ASM_DEP,$(patsubst $(ASM_SUBDIR)/%.s,$(ASM_BUILDDIR)/%.o, $(src)),$(src)))) -endif +define ASM_SCANINC +ifneq ($(NODEP),1) +$1.o: $2 $$(shell $(SCANINC) $(INCLUDE_SCANINC_ARGS) -I "" $2) +endif +endef + +# Dummy rules or real rules ifeq ($(NODEP),1) -$(DATA_ASM_BUILDDIR)/%.o: $(DATA_ASM_SUBDIR)/%.s - $(PREPROC) $< charmap.txt | $(CPP) -I include - | $(AS) $(ASFLAGS) -o $@ +$(eval $(call ASM_DEP,$(ASM_BUILDDIR)/%,$(ASM_SUBDIR)/%.s)) +$(eval $(call ASM_DEP_PREPROC,$(C_BUILDDIR)/%,$(C_SUBDIR)/%.s)) +$(eval $(call ASM_DEP_PREPROC,$(DATA_ASM_BUILDDIR)/%,$(DATA_ASM_SUBDIR)/%.s)) else -$(foreach src, $(REGULAR_DATA_ASM_SRCS), $(eval $(call SRC_ASM_DATA_DEP,$(patsubst $(DATA_ASM_SUBDIR)/%.s,$(DATA_ASM_BUILDDIR)/%.o, $(src)),$(src)))) -endif +$(foreach src, $(ASM_SRCS), $(eval $(call ASM_DEP,$(src:%.s=$(OBJ_DIR)/%),$(src)))) +$(foreach src, $(C_ASM_SRCS), $(eval $(call ASM_DEP_PREPROC,$(src:%.s=$(OBJ_DIR)/%),$(src)))) +$(foreach src, $(REGULAR_DATA_ASM_SRCS), $(eval $(call ASM_DEP_PREPROC,$(src:%.s=$(OBJ_DIR)/%),$(src)))) endif +# Additional rules $(SONG_BUILDDIR)/%.o: $(SONG_SUBDIR)/%.s $(AS) $(ASFLAGS) -I sound -o $@ $< @@ -396,6 +387,7 @@ $(OBJ_DIR)/sym_common.ld: sym_common.txt $(C_OBJS) $(wildcard common_syms/*.txt) $(OBJ_DIR)/sym_ewram.ld: sym_ewram.txt $(RAMSCRGEN) ewram_data $< ENGLISH > $@ +# Linker script ifeq ($(MODERN),0) LD_SCRIPT := ld_script.txt LD_SCRIPT_DEPS := $(OBJ_DIR)/sym_bss.ld $(OBJ_DIR)/sym_common.ld $(OBJ_DIR)/sym_ewram.ld @@ -405,25 +397,24 @@ 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 + sed "s#tools/#tools/#g" $(LD_SCRIPT) > $(OBJ_DIR)/ld_script.ld +# Final rules + +libagbsyscall: + @$(MAKE) -C libagbsyscall TOOLCHAIN=$(TOOLCHAIN) MODERN=$(MODERN) + +# Elf from object files $(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 -o ../../$@ $(OBJS_REL) $(LIB) $(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 -modern: all - -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/make_tools.mk b/make_tools.mk index 00824adda6..78ff1beeb0 100644 --- a/make_tools.mk +++ b/make_tools.mk @@ -9,7 +9,9 @@ TOOL_NAMES := aif2pcm bin2c gbafix gbagfx jsonproc mapjson mid2agb preproc ramsc TOOLDIRS := $(TOOL_NAMES:%=$(TOOLS_DIR)/%) -.PHONY: tools check-tools clean-tools $(TOOLDIRS) $(CHECKTOOLDIRS) +# Tool making doesnt require a pokeemerald dependency scan. +RULES_NO_SCAN += tools check-tools clean-tools $(TOOLDIRS) $(CHECKTOOLDIRS) +.PHONY: $(RULES_NO_SCAN) tools: $(TOOLDIRS) check-tools: $(CHECKTOOLDIRS) From 5eea3d39cd50955e62904d146f67f65dc001b735 Mon Sep 17 00:00:00 2001 From: cawtds <38510667+cawtds@users.noreply.github.com> Date: Tue, 25 Jun 2024 21:53:05 +0200 Subject: [PATCH 03/10] UB fix ClockwiseWipe_TopRight --- src/battle_transition.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/battle_transition.c b/src/battle_transition.c index 11f9cddf4b..c23578e608 100644 --- a/src/battle_transition.c +++ b/src/battle_transition.c @@ -1907,7 +1907,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); From 7d921fa89b877ec0a76d6441453c005fa516590d Mon Sep 17 00:00:00 2001 From: luckytyphlosion <10688458+luckytyphlosion@users.noreply.github.com> Date: Wed, 14 Aug 2024 18:27:44 -0400 Subject: [PATCH 04/10] Slight storage system documentation --- src/pokemon_storage_system.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index b398b88752..48eefd66fd 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -4824,7 +4824,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; } @@ -8258,7 +8258,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++; } @@ -8291,7 +8291,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; @@ -8335,25 +8335,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; From c1ee43254e7f9e5032fd61eac65e090c3a80049f Mon Sep 17 00:00:00 2001 From: Bassoonian Date: Thu, 15 Aug 2024 19:34:56 +0200 Subject: [PATCH 05/10] Clean up defines lacking spaces --- include/battle.h | 16 ++++++++-------- include/battle_main.h | 6 +++--- include/battle_util.h | 6 +++--- include/constants/items.h | 4 ++-- include/data.h | 8 ++++---- include/gba/defines.h | 2 +- include/global.h | 4 ++-- include/mail.h | 2 +- include/menu_specialized.h | 2 +- include/random.h | 4 ++-- src/battle_setup.c | 2 +- src/data/decoration/tilemaps.h | 2 +- src/data/pokemon/experience_tables.h | 12 ++++++------ src/data/union_room.h | 8 ++++---- src/field_specials.c | 14 +++++++------- src/fieldmap.c | 2 +- src/frontier_pass.c | 2 +- src/link_rfu_2.c | 2 +- src/menu_specialized.c | 2 +- src/pokemon_jump.c | 2 +- src/pokenav_ribbons_summary.c | 2 +- src/region_map.c | 2 +- src/roulette.c | 10 +++++----- src/union_room_player_avatar.c | 2 +- 24 files changed, 59 insertions(+), 59 deletions(-) diff --git a/include/battle.h b/include/battle.h index eb25b96550..1edd784030 100644 --- a/include/battle.h +++ b/include/battle.h @@ -460,26 +460,26 @@ STATIC_ASSERT(sizeof(((struct BattleStruct *)0)->palaceFlags) * 8 >= MAX_BATTLER typeArg = gBattleMoves[move].type; \ } -#define IS_TYPE_PHYSICAL(moveType)(moveType < TYPE_MYSTERY) -#define IS_TYPE_SPECIAL(moveType)(moveType > TYPE_MYSTERY) +#define IS_TYPE_PHYSICAL(moveType) (moveType < TYPE_MYSTERY) +#define IS_TYPE_SPECIAL(moveType) (moveType > TYPE_MYSTERY) #define TARGET_TURN_DAMAGED ((gSpecialStatuses[gBattlerTarget].physicalDmg != 0 || gSpecialStatuses[gBattlerTarget].specialDmg != 0)) -#define IS_BATTLER_OF_TYPE(battlerId, type)((gBattleMons[battlerId].types[0] == type || gBattleMons[battlerId].types[1] == type)) +#define IS_BATTLER_OF_TYPE(battlerId, type) ((gBattleMons[battlerId].types[0] == type || gBattleMons[battlerId].types[1] == type)) #define SET_BATTLER_TYPE(battlerId, type) \ { \ gBattleMons[battlerId].types[0] = type; \ gBattleMons[battlerId].types[1] = type; \ } -#define GET_STAT_BUFF_ID(n)((n & 0xF)) // first four bits 0x1, 0x2, 0x4, 0x8 -#define GET_STAT_BUFF_VALUE2(n)((n & 0xF0)) -#define GET_STAT_BUFF_VALUE(n)(((n >> 4) & 7)) // 0x10, 0x20, 0x40 +#define GET_STAT_BUFF_ID(n) ((n & 0xF)) // first four bits 0x1, 0x2, 0x4, 0x8 +#define GET_STAT_BUFF_VALUE2(n) ((n & 0xF0)) +#define GET_STAT_BUFF_VALUE(n) (((n >> 4) & 7)) // 0x10, 0x20, 0x40 #define STAT_BUFF_NEGATIVE 0x80 // 0x80, the sign bit -#define SET_STAT_BUFF_VALUE(n)((((n) << 4) & 0xF0)) +#define SET_STAT_BUFF_VALUE(n) ((((n) << 4) & 0xF0)) -#define SET_STATCHANGER(statId, stage, goesDown)(gBattleScripting.statChanger = (statId) + (stage << 4) + (goesDown << 7)) +#define SET_STATCHANGER(statId, stage, goesDown) (gBattleScripting.statChanger = (statId) + (stage << 4) + (goesDown << 7)) // NOTE: The members of this struct have hard-coded offsets // in include/constants/battle_script_commands.h diff --git a/include/battle_main.h b/include/battle_main.h index e3e0cb7ea4..ae970286ca 100644 --- a/include/battle_main.h +++ b/include/battle_main.h @@ -23,9 +23,9 @@ struct MultiPartnerMenuPokemon }; // defines for the u8 array gTypeEffectiveness -#define TYPE_EFFECT_ATK_TYPE(i)((gTypeEffectiveness[i + 0])) -#define TYPE_EFFECT_DEF_TYPE(i)((gTypeEffectiveness[i + 1])) -#define TYPE_EFFECT_MULTIPLIER(i)((gTypeEffectiveness[i + 2])) +#define TYPE_EFFECT_ATK_TYPE(i) ((gTypeEffectiveness[i + 0])) +#define TYPE_EFFECT_DEF_TYPE(i) ((gTypeEffectiveness[i + 1])) +#define TYPE_EFFECT_MULTIPLIER(i) ((gTypeEffectiveness[i + 2])) // defines for the gTypeEffectiveness multipliers #define TYPE_MUL_NO_EFFECT 0 diff --git a/include/battle_util.h b/include/battle_util.h index c7de9aae86..870990e9f5 100644 --- a/include/battle_util.h +++ b/include/battle_util.h @@ -33,9 +33,9 @@ #define ABILITYEFFECT_WATER_SPORT 254 #define ABILITYEFFECT_SWITCH_IN_WEATHER 255 -#define ABILITY_ON_OPPOSING_FIELD(battlerId, abilityId)(AbilityBattleEffects(ABILITYEFFECT_CHECK_OTHER_SIDE, battlerId, abilityId, 0, 0)) -#define ABILITY_ON_FIELD(abilityId)(AbilityBattleEffects(ABILITYEFFECT_CHECK_ON_FIELD, 0, abilityId, 0, 0)) -#define ABILITY_ON_FIELD2(abilityId)(AbilityBattleEffects(ABILITYEFFECT_FIELD_SPORT, 0, abilityId, 0, 0)) +#define ABILITY_ON_OPPOSING_FIELD(battlerId, abilityId) (AbilityBattleEffects(ABILITYEFFECT_CHECK_OTHER_SIDE, battlerId, abilityId, 0, 0)) +#define ABILITY_ON_FIELD(abilityId) (AbilityBattleEffects(ABILITYEFFECT_CHECK_ON_FIELD, 0, abilityId, 0, 0)) +#define ABILITY_ON_FIELD2(abilityId) (AbilityBattleEffects(ABILITYEFFECT_FIELD_SPORT, 0, abilityId, 0, 0)) // For the first argument of ItemBattleEffects, to deteremine which block of item effects to try #define ITEMEFFECT_ON_SWITCH_IN 0 diff --git a/include/constants/items.h b/include/constants/items.h index ed9bfb5ec8..9e6fecf014 100644 --- a/include/constants/items.h +++ b/include/constants/items.h @@ -441,8 +441,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 NUM_TECHNICAL_MACHINES 50 diff --git a/include/data.h b/include/data.h index 41b34d73e2..558b1dfff3 100644 --- a/include/data.h +++ b/include/data.h @@ -28,9 +28,9 @@ struct MonCoords u8 y_offset; }; -#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) struct TrainerMonNoItemDefaultMoves { @@ -91,7 +91,7 @@ struct Trainer /*0x24*/ union TrainerMonPtr party; }; -#define TRAINER_ENCOUNTER_MUSIC(trainer)((gTrainers[trainer].encounterMusic_gender & 0x7F)) +#define TRAINER_ENCOUNTER_MUSIC(trainer) ((gTrainers[trainer].encounterMusic_gender & 0x7F)) extern const u16 gMinigameDigits_Pal[]; extern const u32 gMinigameDigits_Gfx[]; diff --git a/include/gba/defines.h b/include/gba/defines.h index fa3a30fd6e..febe6882cf 100644 --- a/include/gba/defines.h +++ b/include/gba/defines.h @@ -75,7 +75,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 658af43da7..00d608e672 100644 --- a/include/global.h +++ b/include/global.h @@ -89,7 +89,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) @@ -130,7 +130,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/include/mail.h b/include/mail.h index f4590a70ec..403078f097 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/include/menu_specialized.h b/include/menu_specialized.h index 06a188b8a0..152afb59ac 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 6bf61de6c6..ba7aeccc1a 100644 --- a/include/random.h +++ b/include/random.h @@ -13,8 +13,8 @@ u16 Random2(void); // 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) //Sets the initial seed value of the pseudorandom number generator void SeedRng(u16 seed); diff --git a/src/battle_setup.c b/src/battle_setup.c index e87ce6dd27..be5b09e5e5 100644 --- a/src/battle_setup.c +++ b/src/battle_setup.c @@ -859,7 +859,7 @@ static 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; diff --git a/src/data/decoration/tilemaps.h b/src/data/decoration/tilemaps.h index eebb3acb25..d6c351ae85 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 8f50e10918..848d5c5016 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 129c629941..c4bd984736 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/src/field_specials.c b/src/field_specials.c index 7d20d3571d..d8fc96c49d 100644 --- a/src/field_specials.c +++ b/src/field_specials.c @@ -3957,14 +3957,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 5fdc4cbfb7..e4dc0026a3 100644 --- a/src/fieldmap.c +++ b/src/fieldmap.c @@ -48,7 +48,7 @@ static const struct MapConnection *GetIncomingConnection(u8 direction, int x, in static bool8 IsPosInIncomingConnectingMap(u8 direction, int x, int y, const struct MapConnection *connection); static bool8 IsCoordInIncomingConnectingMap(int coord, int srcMax, int destMax, int offset); -#define GetBorderBlockAt(x, y)({ \ +#define GetBorderBlockAt(x, y) ({ \ u16 block; \ int i; \ const u16 *border = gMapHeader.mapLayout->border; /* Unused, they read it again below */ \ diff --git a/src/frontier_pass.c b/src/frontier_pass.c index 07e06ad3b9..a351d81ce9 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/src/link_rfu_2.c b/src/link_rfu_2.c index 9979097a49..b34c7184cf 100644 --- a/src/link_rfu_2.c +++ b/src/link_rfu_2.c @@ -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/menu_specialized.c b/src/menu_specialized.c index 20ddce1f44..1272277aa5 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/pokemon_jump.c b/src/pokemon_jump.c index d744ff6650..a1c401c6df 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/pokenav_ribbons_summary.c b/src/pokenav_ribbons_summary.c index e77f839a80..c799daf57b 100644 --- a/src/pokenav_ribbons_summary.c +++ b/src/pokenav_ribbons_summary.c @@ -1080,7 +1080,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/region_map.c b/src/region_map.c index 21c6314d30..8fa53a0e7b 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 ec4c8cfcfe..f4e6012a8d 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/union_room_player_avatar.c b/src/union_room_player_avatar.c index a7d5045b38..1bb7968359 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; From 3f49c5cbaf5bd8bdb02cb54d0a44e61faba114f4 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Wed, 7 Aug 2024 16:24:30 -0400 Subject: [PATCH 06/10] Fix trainer match call flags --- include/constants/flags.h | 164 +++++++++++++++++----------------- include/constants/rematches.h | 89 ++++++++++++++++++ include/gym_leader_rematch.h | 85 +----------------- map_data_rules.mk | 4 +- src/battle_setup.c | 4 +- src/field_specials.c | 2 +- src/match_call.c | 11 +-- src/pokenav_match_call_data.c | 16 ++-- src/pokenav_match_call_list.c | 2 +- 9 files changed, 194 insertions(+), 183 deletions(-) create mode 100644 include/constants/rematches.h diff --git a/include/constants/flags.h b/include/constants/flags.h index 8d98e3aa04..5b1b5efd19 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 diff --git a/include/constants/rematches.h b/include/constants/rematches.h new file mode 100644 index 0000000000..2ddefcc578 --- /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/gym_leader_rematch.h b/include/gym_leader_rematch.h index b31fb5e228..622d2db1bc 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/map_data_rules.mk b/map_data_rules.mk index 626cd47240..d3f47a352e 100755 --- a/map_data_rules.mk +++ b/map_data_rules.mk @@ -9,9 +9,9 @@ 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 $@ + $(PREPROC) $< charmap.txt | $(CPP) -I include - | $(PREPROC) -ie $< charmap.txt | $(AS) $(ASFLAGS) -o $@ $(MAPS_DIR)/%/header.inc: $(MAPS_DIR)/%/map.json $(MAPJSON) map emerald $< $(LAYOUTS_DIR)/layouts.json diff --git a/src/battle_setup.c b/src/battle_setup.c index e87ce6dd27..435ba4b8a3 100644 --- a/src/battle_setup.c +++ b/src/battle_setup.c @@ -1615,7 +1615,7 @@ static bool32 UpdateRandomTrainerRematches(const struct RematchTrainer *table, u // Trainer already wants a rematch. Don't bother updating it. ret = TRUE; } - else if (FlagGet(FLAG_MATCH_CALL_REGISTERED + i) + else if (FlagGet(TRAINER_REGISTERED_FLAGS_START + i) && (Random() % 100) <= 30) // 31% chance of getting a rematch. { SetRematchIdForTrainer(table, i); @@ -1744,7 +1744,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/field_specials.c b/src/field_specials.c index 7d20d3571d..1bbbbf4e17 100644 --- a/src/field_specials.c +++ b/src/field_specials.c @@ -3620,7 +3620,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; diff --git a/src/match_call.c b/src/match_call.c index a9d18b3477..2c1ad924a5 100644 --- a/src/match_call.c +++ b/src/match_call.c @@ -131,7 +131,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); @@ -1098,7 +1098,7 @@ static bool32 UpdateMatchCallStepCounter(void) static bool32 SelectMatchCallTrainer(void) { u32 matchCallId; - u32 numRegistered = GetNumRegisteredNPCs(); + u32 numRegistered = GetNumRegisteredTrainers(); if (numRegistered == 0) return FALSE; @@ -1114,12 +1114,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++; } @@ -1131,7 +1132,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/pokenav_match_call_data.c b/src/pokenav_match_call_data.c index f6d71009bb..1c3cf9aeeb 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, @@ -1136,7 +1136,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 8d1a73f557..fb89e33e0b 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; } From 5c55cc374815fb99ef43f55b8d2332d3798efc59 Mon Sep 17 00:00:00 2001 From: Martin Griffin Date: Wed, 21 Aug 2024 07:50:41 +0100 Subject: [PATCH 07/10] [preproc] support arbitrary expressions in enums --- tools/preproc/asm_file.cpp | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/tools/preproc/asm_file.cpp b/tools/preproc/asm_file.cpp index ca8b8cc4ae..36b6c7ed06 100644 --- a/tools/preproc/asm_file.cpp +++ b/tools/preproc/asm_file.cpp @@ -520,6 +520,7 @@ bool AsmFile::ParseEnum() long currentHeaderLine = SkipWhitespaceAndEol(); std::string enumName = ReadIdentifier(); currentHeaderLine += SkipWhitespaceAndEol(); + std::string enumBase = "0"; long enumCounter = 0; long symbolCount = 0; @@ -542,11 +543,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++; } From 625a006cabbf44734be2d0324264d86c3edba51b Mon Sep 17 00:00:00 2001 From: Icedude907 <34080011+Icedude907@users.noreply.github.com> Date: Fri, 30 Aug 2024 06:01:01 +1200 Subject: [PATCH 08/10] [Build System Rewrite] `mapjson` now takes output directory parameters. (#1949) --- Makefile | 57 ++-- include/constants/.gitignore | 3 + include/constants/layouts.h | 450 ------------------------- include/constants/map_groups.h | 596 --------------------------------- make_tools.mk | 14 +- map_data_rules.mk | 30 +- tools/jsonproc/jsonproc.cpp | 2 + tools/mapjson/mapjson.cpp | 112 ++++--- 8 files changed, 124 insertions(+), 1140 deletions(-) create mode 100644 include/constants/.gitignore delete mode 100755 include/constants/layouts.h delete mode 100755 include/constants/map_groups.h diff --git a/Makefile b/Makefile index bf74e0331a..15cbd709e4 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,9 @@ ifeq (compare,$(MAKECMDGOALS)) COMPARE := 1 endif +# Default make rule +all: rom + # don't use dkP's base_tools anymore # because the redefinition of $(CC) conflicts # with when we want to use $(CC) to preprocess files @@ -119,24 +122,23 @@ ifneq ($(MODERN),1) CPPFLAGS += -I tools/agbcc/include -I tools/agbcc -nostdinc -undef endif +# Variable filled out in other make files +AUTO_GEN_TARGETS := +include make_tools.mk + 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) +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) 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 -TOOLBASE = $(TOOLDIRS:tools/%=%) -TOOLS = $(foreach tool,$(TOOLBASE),tools/$(tool)/$(tool)$(EXE)) - MAKEFLAGS += --no-print-directory # Clear the default suffixes @@ -149,7 +151,7 @@ MAKEFLAGS += --no-print-directory # Secondary expansion is required for dependency variables in object rules. .SECONDEXPANSION: -.PHONY: all rom clean compare tidy tools mostlyclean clean-tools $(TOOLDIRS) libagbsyscall modern tidymodern tidynonmodern +.PHONY: all rom clean compare tidy mostlyclean libagbsyscall modern tidymodern tidynonmodern infoshell = $(foreach line, $(shell $1 | sed "s/ /__SPACE__/g"), $(info $(subst __SPACE__, ,$(line)))) @@ -159,6 +161,7 @@ infoshell = $(foreach line, $(shell $1 | sed "s/ /__SPACE__/g"), $(info $(subst # Since we don't need to reload most of this makefile ifeq (,$(filter-out all rom compare modern libagbsyscall syms,$(MAKECMDGOALS))) $(call infoshell, $(MAKE) -f make_tools.mk) +$(call infoshell, $(MAKE) generated) else NODEP ?= 1 endif @@ -209,17 +212,8 @@ SUBDIRS := $(sort $(dir $(OBJS))) $(shell mkdir -p $(SUBDIRS)) endif -AUTO_GEN_TARGETS := - -all: rom - -tools: $(TOOLDIRS) - syms: $(SYM) -$(TOOLDIRS): - @$(MAKE) -C $@ - rom: $(ROM) ifeq ($(COMPARE),1) @$(SHA1) rom.sha1 @@ -230,9 +224,6 @@ compare: all clean: mostlyclean clean-tools -clean-tools: - @$(foreach tooldir,$(TOOLDIRS),$(MAKE) clean -C $(tooldir);) - mostlyclean: tidynonmodern tidymodern find sound -iname '*.bin' -exec rm {} + rm -f $(MID_SUBDIR)/*.s @@ -263,6 +254,8 @@ include spritesheet_rules.mk include json_data_rules.mk include songs.mk +generated: $(AUTO_GEN_TARGETS) + %.s: ; %.png: ; %.pal: ; @@ -280,7 +273,7 @@ sound/%.bin: sound/%.aif ; $(AIF) $< $@ 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 @@ -289,10 +282,10 @@ $(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)/m4a.o: CC1 := $(TOOLS_DIR)/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 @@ -320,7 +313,7 @@ else endif else define C_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 -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 $$@ - @@ -347,7 +340,7 @@ else endif else define GFLIB_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 -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 $$@ - diff --git a/include/constants/.gitignore b/include/constants/.gitignore new file mode 100644 index 0000000000..761af9db76 --- /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/include/constants/layouts.h b/include/constants/layouts.h deleted file mode 100755 index db92c95942..0000000000 --- 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 eaf40a525d..0000000000 --- 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/make_tools.mk b/make_tools.mk index 7e0baf8900..7adf510319 100644 --- a/make_tools.mk +++ b/make_tools.mk @@ -1,12 +1,20 @@ +# 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 -.PHONY: all $(TOOLDIRS) +TOOLDIRS := $(TOOL_NAMES:%=$(TOOLS_DIR)/%) -all: $(TOOLDIRS) +.PHONY: tools check-tools clean-tools $(TOOLDIRS) + +tools: $(TOOLDIRS) $(TOOLDIRS): @$(MAKE) -C $@ + +clean-tools: + @$(foreach tooldir,$(TOOLDIRS),$(MAKE) clean -C $(tooldir);) diff --git a/map_data_rules.mk b/map_data_rules.mk index d3f47a352e..ed7c08edea 100755 --- a/map_data_rules.mk +++ b/map_data_rules.mk @@ -1,8 +1,17 @@ # 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)) @@ -13,19 +22,12 @@ $(DATA_ASM_BUILDDIR)/maps.o: $(DATA_ASM_SUBDIR)/maps.s $(LAYOUTS_DIR)/layouts.in $(DATA_ASM_BUILDDIR)/map_events.o: $(DATA_ASM_SUBDIR)/map_events.s $(MAPS_DIR)/events.inc $(MAP_EVENTS) $(PREPROC) $< charmap.txt | $(CPP) -I include - | $(PREPROC) -ie $< charmap.txt | $(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 ; -include/constants/map_groups.h: $(MAPS_DIR)/headers.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) -$(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)/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/tools/jsonproc/jsonproc.cpp b/tools/jsonproc/jsonproc.cpp index 9ef23cd43e..03e51b765a 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/mapjson.cpp b/tools/mapjson/mapjson.cpp index e53ac7924d..1a10c9dab8 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); @@ -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; @@ -466,7 +476,7 @@ string generate_map_constants_text(string groups_filepath, Json groups_data) { size_t max_length = 0; 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()) @@ -493,7 +503,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); @@ -501,19 +515,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) { @@ -586,7 +597,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); @@ -597,12 +611,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[]) { @@ -620,29 +631,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; From a4dd8216587f73841ba9016678c1af88cb78b62c Mon Sep 17 00:00:00 2001 From: GriffinR Date: Sat, 31 Aug 2024 00:32:43 -0400 Subject: [PATCH 09/10] Restore review changes from dependent PR --- map_data_rules.mk | 1 + tools/mapjson/mapjson.cpp | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/map_data_rules.mk b/map_data_rules.mk index 3ec86da7dd..ed7c08edea 100755 --- a/map_data_rules.mk +++ b/map_data_rules.mk @@ -22,6 +22,7 @@ $(DATA_ASM_BUILDDIR)/maps.o: $(DATA_ASM_SUBDIR)/maps.s $(LAYOUTS_DIR)/layouts.in $(DATA_ASM_BUILDDIR)/map_events.o: $(DATA_ASM_SUBDIR)/map_events.s $(MAPS_DIR)/events.inc $(MAP_EVENTS) $(PREPROC) $< charmap.txt | $(CPP) -I include - | $(PREPROC) -ie $< charmap.txt | $(AS) $(ASFLAGS) -o $@ + $(MAPS_OUTDIR)/%/header.inc $(MAPS_OUTDIR)/%/events.inc $(MAPS_OUTDIR)/%/connections.inc: $(MAPS_DIR)/%/map.json $(MAPJSON) map emerald $< $(LAYOUTS_DIR)/layouts.json $(@D) diff --git a/tools/mapjson/mapjson.cpp b/tools/mapjson/mapjson.cpp index 1632b56be6..1a10c9dab8 100644 --- a/tools/mapjson/mapjson.cpp +++ b/tools/mapjson/mapjson.cpp @@ -374,7 +374,7 @@ void process_map(string map_filepath, string layouts_filepath, string output_dir string generate_groups_text(Json groups_data) { ostringstream text; - text << "@\n@ DO NOT MODIFY THIS FILE! It is auto-generated from /map_groups.json\n@\n\n"; + text << "@\n@ DO NOT MODIFY THIS FILE! It is auto-generated from data/maps/map_groups.json\n@\n\n"; for (auto &key : groups_data["group_order"].array_items()) { string group = json_to_string(key); @@ -415,7 +415,7 @@ string generate_connections_text(Json groups_data, string include_path) { ostringstream text; - text << "@\n@ DO NOT MODIFY THIS FILE! It is auto-generated from /map_groups.json\n@\n\n"; + 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 \"" << include_path << "/" << json_to_string(map_name) << "/connections.inc\"\n"; @@ -432,7 +432,7 @@ string generate_headers_text(Json groups_data, string include_path) { ostringstream text; - text << "@\n@ DO NOT MODIFY THIS FILE! It is auto-generated from /map_groups.json\n@\n\n"; + 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 \"" << include_path << "/" << map_name << "/header.inc\"\n"; @@ -465,7 +465,7 @@ string generate_map_constants_text(string groups_filepath, Json groups_data) { text << "#ifndef GUARD_CONSTANTS_MAP_GROUPS_H\n" << "#define GUARD_CONSTANTS_MAP_GROUPS_H\n\n"; - text << "//\n// DO NOT MODIFY THIS FILE! It is auto-generated from /map_groups.json\n//\n\n"; + text << "//\n// DO NOT MODIFY THIS FILE! It is auto-generated from data/maps/map_groups.json\n//\n\n"; int group_num = 0; @@ -530,7 +530,7 @@ void process_groups(string groups_filepath, string output_asm, string output_c) string generate_layout_headers_text(Json layouts_data) { ostringstream text; - text << "@\n@ DO NOT MODIFY THIS FILE! It is auto-generated from layouts.json\n@\n\n"; + text << "@\n@ DO NOT MODIFY THIS FILE! It is auto-generated from data/layouts/layouts.json\n@\n\n"; for (auto &layout : layouts_data["layouts"].array_items()) { if (layout == Json::object()) continue; From 04197b49126604a310fae1d314709334f6d2460d Mon Sep 17 00:00:00 2001 From: GriffinR Date: Sat, 31 Aug 2024 01:54:25 -0400 Subject: [PATCH 10/10] Fix swapped cycling road entrances --- data/event_scripts.s | 2 +- data/maps/Route110/map.json | 8 ++++---- .../map.json | 8 ++++---- .../scripts.inc | 16 ++++++++++++++++ .../map.json | 8 ++++---- .../scripts.inc | 16 ---------------- data/maps/map_groups.json | 4 ++-- src/field_specials.c | 2 +- 8 files changed, 32 insertions(+), 32 deletions(-) diff --git a/data/event_scripts.s b/data/event_scripts.s index e8fb9dcbd1..55720a6add 100644 --- a/data/event_scripts.s +++ b/data/event_scripts.s @@ -563,8 +563,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/Route110/map.json b/data/maps/Route110/map.json index 2b52164113..6e4982fa22 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 6f3c6c75c5..88cbf1cc88 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 5eb1f3dea2..fb1cdc5c71 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 59e3e5be65..943984075d 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 df53f55ccf..5c4dcfa219 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 ebef431b30..8a90679c8d 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/src/field_specials.c b/src/field_specials.c index f1e5d7bb2d..f8d493493c 100644 --- a/src/field_specials.c +++ b/src/field_specials.c @@ -263,7 +263,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)