diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e36793d13..1dfc17e00 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -38,7 +38,9 @@ jobs: path: 'agbcc' - name: Install binutils - run: sudo apt install gcc-arm-none-eabi binutils-arm-none-eabi libpng-dev + run: | + sudo apt-get update + sudo apt-get install gcc-arm-none-eabi binutils-arm-none-eabi libpng-dev # build-essential and git are already installed # gcc-arm-none-eabi is only needed for the modern build # as an alternative to dkP diff --git a/Makefile b/Makefile index d09b00049..5e71a91c3 100644 --- a/Makefile +++ b/Makefile @@ -80,7 +80,7 @@ include make_tools.mk SHA1SUM := $(shell { command -v sha1sum || command -v shasum; } 2>/dev/null) -c GBAGFX := tools/gbagfx/gbagfx$(EXE) RSFONT := tools/rsfont/rsfont$(EXE) -AIF2PCM := tools/aif2pcm/aif2pcm$(EXE) +WAV2AGB := tools/wav2agb/wav2agb$(EXE) MID2AGB := tools/mid2agb/mid2agb$(EXE) PREPROC := tools/preproc/preproc$(EXE) SCANINC := tools/scaninc/scaninc$(EXE) @@ -221,11 +221,12 @@ tidy: $(ROM): %.gba: %.elf $(OBJCOPY) -O binary --gap-fill 0xFF --pad-to 0x9000000 $< $@ + $(GBAFIX) $@ -p --silent %.elf: $(LD_SCRIPT) $(ALL_OBJECTS) @echo "cd $(BUILD_DIR) && $(LD) -T $(LD_SCRIPT:$(BUILD_DIR)/%=%) -Map ../../$(MAP) -o ../../$@ " @cd $(BUILD_DIR) && $(LD) -T $(LD_SCRIPT:$(BUILD_DIR)/%=%) -Map ../../$(MAP) -o ../../$@ $(OBJS_REL) $(LDFLAGS) - $(GBAFIX) $@ -p -t"$(TITLE)" -c$(GAME_CODE) -m$(MAKER_CODE) -r$(GAME_REVISION) --silent + $(GBAFIX) $@ -t"$(TITLE)" -c$(GAME_CODE) -m$(MAKER_CODE) -r$(GAME_REVISION) --silent $(LD_SCRIPT): $(LD_SCRIPT:$(BUILD_DIR)/%.ld=%.txt) $(BUILD_DIR)/sym_common.ld $(BUILD_DIR)/sym_ewram.ld $(BUILD_DIR)/sym_bss.ld sed -e "s#tools/#../../tools/#g" $< >$@ @@ -242,7 +243,7 @@ $(C_OBJECTS): $(BUILD_DIR)/%.o: %.c $$(C_DEP) # Only .s files in data need preproc $(BUILD_DIR)/data/%.o: data/%.s $$(ASM_DEP) @echo "$(AS) -o $@ $<" - @$(PREPROC) $< charmap.txt | $(CPP) -I include | $(AS) $(ASFLAGS) -o $@ + @$(PREPROC) $< charmap.txt | $(CPP) -I include | $(PREPROC) -ie $< charmap.txt | $(AS) $(ASFLAGS) -o $@ $(BUILD_DIR)/%.o: %.s $$(ASM_DEP) @echo "$(AS) -o $@ $<" @@ -320,11 +321,11 @@ generated: $(AUTO_GEN_TARGETS) #### Sound Rules #### -sound/direct_sound_samples/cries/cry_%.bin: sound/direct_sound_samples/cries/cry_%.aif - $(AIF2PCM) $< $@ --compress +sound/direct_sound_samples/cries/cry_%.bin: sound/direct_sound_samples/cries/cry_%.wav + $(WAV2AGB) -b -c -l 1 --no-pad $< $@ -sound/%.bin: sound/%.aif - $(AIF2PCM) $< $@ +sound/%.bin: sound/%.wav + $(WAV2AGB) -b $< $@ sound/songs/%.s: sound/songs/%.mid cd $(@D) && ../../$(MID2AGB) $(> 8) -#define MAP_NUM(map) (MAP_##map & 0xFF) +#define MAP_GROUP(map) (map >> 8) +#define MAP_NUM(map) (map & 0xFF) // IDs for dynamic warps. Both are used in the dest_warp_id field for warp events, but they // are never read in practice. A dest_map of MAP_DYNAMIC is used to indicate that a diff --git a/include/constants/region_map_sections.h b/include/constants/region_map_sections.h deleted file mode 100644 index 4fd9aa894..000000000 --- a/include/constants/region_map_sections.h +++ /dev/null @@ -1,94 +0,0 @@ -#ifndef GUARD_REGIONMAPSEC_H -#define GUARD_REGIONMAPSEC_H - -#define MAPSEC_LITTLEROOT_TOWN 0x00 -#define MAPSEC_OLDALE_TOWN 0x01 -#define MAPSEC_DEWFORD_TOWN 0x02 -#define MAPSEC_LAVARIDGE_TOWN 0x03 -#define MAPSEC_FALLARBOR_TOWN 0x04 -#define MAPSEC_VERDANTURF_TOWN 0x05 -#define MAPSEC_PACIFIDLOG_TOWN 0x06 -#define MAPSEC_PETALBURG_CITY 0x07 -#define MAPSEC_SLATEPORT_CITY 0x08 -#define MAPSEC_MAUVILLE_CITY 0x09 -#define MAPSEC_RUSTBORO_CITY 0x0A -#define MAPSEC_FORTREE_CITY 0x0B -#define MAPSEC_LILYCOVE_CITY 0x0C -#define MAPSEC_MOSSDEEP_CITY 0x0D -#define MAPSEC_SOOTOPOLIS_CITY 0x0E -#define MAPSEC_EVER_GRANDE_CITY 0x0F -#define MAPSEC_ROUTE_101 0x10 -#define MAPSEC_ROUTE_102 0x11 -#define MAPSEC_ROUTE_103 0x12 -#define MAPSEC_ROUTE_104 0x13 -#define MAPSEC_ROUTE_105 0x14 -#define MAPSEC_ROUTE_106 0x15 -#define MAPSEC_ROUTE_107 0x16 -#define MAPSEC_ROUTE_108 0x17 -#define MAPSEC_ROUTE_109 0x18 -#define MAPSEC_ROUTE_110 0x19 -#define MAPSEC_ROUTE_111 0x1A -#define MAPSEC_ROUTE_112 0x1B -#define MAPSEC_ROUTE_113 0x1C -#define MAPSEC_ROUTE_114 0x1D -#define MAPSEC_ROUTE_115 0x1E -#define MAPSEC_ROUTE_116 0x1F -#define MAPSEC_ROUTE_117 0x20 -#define MAPSEC_ROUTE_118 0x21 -#define MAPSEC_ROUTE_119 0x22 -#define MAPSEC_ROUTE_120 0x23 -#define MAPSEC_ROUTE_121 0x24 -#define MAPSEC_ROUTE_122 0x25 -#define MAPSEC_ROUTE_123 0x26 -#define MAPSEC_ROUTE_124 0x27 -#define MAPSEC_ROUTE_125 0x28 -#define MAPSEC_ROUTE_126 0x29 -#define MAPSEC_ROUTE_127 0x2A -#define MAPSEC_ROUTE_128 0x2B -#define MAPSEC_ROUTE_129 0x2C -#define MAPSEC_ROUTE_130 0x2D -#define MAPSEC_ROUTE_131 0x2E -#define MAPSEC_ROUTE_132 0x2F -#define MAPSEC_ROUTE_133 0x30 -#define MAPSEC_ROUTE_134 0x31 -#define MAPSEC_UNDERWATER_124 0x32 -#define MAPSEC_UNDERWATER_125 0x33 -#define MAPSEC_UNDERWATER_126 0x34 -#define MAPSEC_UNDERWATER_127 0x35 -#define MAPSEC_UNDERWATER_SOOTOPOLIS 0x36 -#define MAPSEC_GRANITE_CAVE 0x37 -#define MAPSEC_MT_CHIMNEY 0x38 -#define MAPSEC_SAFARI_ZONE 0x39 -#define MAPSEC_BATTLE_TOWER 0x3A -#define MAPSEC_PETALBURG_WOODS 0x3B -#define MAPSEC_RUSTURF_TUNNEL 0x3C -#define MAPSEC_ABANDONED_SHIP 0x3D -#define MAPSEC_NEW_MAUVILLE 0x3E -#define MAPSEC_METEOR_FALLS 0x3F -#define MAPSEC_METEOR_FALLS_2 0x40 -#define MAPSEC_MT_PYRE 0x41 -#define MAPSEC_EVIL_TEAM_HIDEOUT 0x42 -#define MAPSEC_SHOAL_CAVE 0x43 -#define MAPSEC_SEAFLOOR_CAVERN 0x44 -#define MAPSEC_UNDERWATER_128 0x45 -#define MAPSEC_VICTORY_ROAD 0x46 -#define MAPSEC_MIRAGE_ISLAND 0x47 -#define MAPSEC_CAVE_OF_ORIGIN 0x48 -#define MAPSEC_SOUTHERN_ISLAND 0x49 -#define MAPSEC_FIERY_PATH 0x4A -#define MAPSEC_FIERY_PATH_2 0x4B -#define MAPSEC_JAGGED_PASS 0x4C -#define MAPSEC_JAGGED_PASS_2 0x4D -#define MAPSEC_SEALED_CHAMBER 0x4E -#define MAPSEC_UNDERWATER_SEALED_CHAMBER 0x4F -#define MAPSEC_SCORCHED_SLAB 0x50 -#define MAPSEC_ISLAND_CAVE 0x51 -#define MAPSEC_DESERT_RUINS 0x52 -#define MAPSEC_ANCIENT_TOMB 0x53 -#define MAPSEC_INSIDE_OF_TRUCK 0x54 -#define MAPSEC_SKY_PILLAR 0x55 -#define MAPSEC_SECRET_BASE 0x56 -#define MAPSEC_DYNAMIC 0x57 -#define MAPSEC_NONE 0x58 - -#endif // GUARD_REGIONMAPSEC_H diff --git a/include/global.h b/include/global.h index 4858b9d8c..faa9c9a52 100644 --- a/include/global.h +++ b/include/global.h @@ -123,7 +123,7 @@ enum f; \ }) -#define TEST_BUTTON(value, button) ({(value) & (button);}) +#define TEST_BUTTON(value, button) ((value) & (button)) #define JOY_NEW(button) (TEST_BUTTON(gMain.newKeys, button)) #define JOY_HELD(button) (TEST_BUTTON(gMain.heldKeys, button)) #define JOY_REPT(button) (TEST_BUTTON(gMain.newAndRepeatedKeys, button)) diff --git a/include/heal_location.h b/include/heal_location.h index 46f0d785a..c087cfb3c 100644 --- a/include/heal_location.h +++ b/include/heal_location.h @@ -3,8 +3,8 @@ struct HealLocation { - s8 group; - s8 map; + s8 mapGroup; + s8 mapNum; u16 x; u16 y; }; diff --git a/include/macros/battle_script.inc b/include/macros/battle_script.inc index d92e28934..660196da2 100644 --- a/include/macros/battle_script.inc +++ b/include/macros/battle_script.inc @@ -1350,7 +1350,7 @@ .endm .macro chosenstatus2animation bank, status - chosenstatusanimation \bank 0x1 \status + chosenstatusanimation \bank, 0x1, \status .endm .macro sethword dst, value diff --git a/include/macros/event.inc b/include/macros/event.inc index c516e993f..8c10e3182 100644 --- a/include/macros/event.inc +++ b/include/macros/event.inc @@ -548,15 +548,17 @@ .endif .endm - @ Blocks script execution until the movements being applied to the specified (index) Object event finish. If the specified Object event is 0x0000, then the command will block script execution until all Object events affected by applymovement finish their movements. If the specified Object event is not currently being manipulated with applymovement, then this command does nothing. + @ Blocks script execution until the movements being applied to the specified (localId) object finish. + @ If localId is LOCALID_NONE (0), then the id of the last-moved object will be used instead. + @ If the specified object is not currently being manipulated with applymovement, then this command does nothing. @ If no map is specified, then the current map is used. - .macro waitmovement index:req, map + .macro waitmovement localId=LOCALID_NONE, map .ifb \map .byte 0x51 - .2byte \index + .2byte \localId .else .byte 0x52 - .2byte \index + .2byte \localId map \map .endif .endm @@ -877,6 +879,16 @@ .4byte \text .endm + @ Formatting for the braille window, to be put at the start of a pointer used by braillemessage. + .macro brailleformat winLeft:req, winTop:req, winRight:req, winBottom:req, textLeft:req, textTop:req + .byte \winLeft + .byte \winTop + .byte \winRight + .byte \winBottom + .byte \textLeft + .byte \textTop + .endm + @ Gives the player one of the specified (species) Pokemon at level level holding item. The trailing 0s are unused parameters .macro givemon species:req, level:req, item:req .byte 0x79 diff --git a/json_data_rules.mk b/json_data_rules.mk index 0b0e41882..20c7845aa 100644 --- a/json_data_rules.mk +++ b/json_data_rules.mk @@ -12,3 +12,17 @@ $(DATA_SRC_SUBDIR)/region_map/region_map_entries.h: $(DATA_SRC_SUBDIR)/region_ma $(JSONPROC) $^ $@ $(BUILD_DIR)/src/region_map.o: C_DEP += $(DATA_SRC_SUBDIR)/region_map/region_map_entries.h + +AUTO_GEN_TARGETS += include/constants/region_map_sections.h +include/constants/region_map_sections.h: $(DATA_SRC_SUBDIR)/region_map/region_map_sections.json $(DATA_SRC_SUBDIR)/region_map/region_map_sections.constants.json.txt + $(JSONPROC) $^ $@ + +AUTO_GEN_TARGETS += $(DATA_SRC_SUBDIR)/heal_locations.h +$(DATA_SRC_SUBDIR)/heal_locations.h: $(DATA_SRC_SUBDIR)/heal_locations.json $(DATA_SRC_SUBDIR)/heal_locations.json.txt + $(JSONPROC) $^ $@ + +$(C_BUILDDIR)/heal_location.o: c_dep += $(DATA_SRC_SUBDIR)/heal_locations.h + +AUTO_GEN_TARGETS += include/constants/heal_locations.h +include/constants/heal_locations.h: $(DATA_SRC_SUBDIR)/heal_locations.json $(DATA_SRC_SUBDIR)/heal_locations.constants.json.txt + $(JSONPROC) $^ $@ diff --git a/make_tools.mk b/make_tools.mk index b955f73f5..1df3f6a7b 100644 --- a/make_tools.mk +++ b/make_tools.mk @@ -5,7 +5,7 @@ MAKEFLAGS += --no-print-directory # Inclusive list. If you don't want a tool to be built, don't add it here. TOOLS_DIR := tools -TOOL_NAMES := aif2pcm bin2c gbafix gbagfx jsonproc mapjson mid2agb preproc ramscrgen rsfont scaninc +TOOL_NAMES := bin2c gbafix gbagfx jsonproc mapjson mid2agb preproc ramscrgen rsfont scaninc wav2agb TOOLDIRS := $(TOOL_NAMES:%=$(TOOLS_DIR)/%) diff --git a/map_data_rules.mk b/map_data_rules.mk index 6a7d4c96c..c174179b8 100755 --- a/map_data_rules.mk +++ b/map_data_rules.mk @@ -11,11 +11,13 @@ INCLUDECONSTS_OUTDIR := include/constants AUTO_GEN_TARGETS += $(INCLUDECONSTS_OUTDIR)/map_groups.h AUTO_GEN_TARGETS += $(INCLUDECONSTS_OUTDIR)/layouts.h +AUTO_GEN_TARGETS += $(INCLUDECONSTS_OUTDIR)/map_event_ids.h MAP_DIRS := $(dir $(wildcard $(MAPS_DIR)/*/map.json)) MAP_CONNECTIONS := $(patsubst $(MAPS_DIR)/%/,$(MAPS_DIR)/%/connections.inc,$(MAP_DIRS)) MAP_EVENTS := $(patsubst $(MAPS_DIR)/%/,$(MAPS_DIR)/%/events.inc,$(MAP_DIRS)) MAP_HEADERS := $(patsubst $(MAPS_DIR)/%/,$(MAPS_DIR)/%/header.inc,$(MAP_DIRS)) +MAP_JSONS := $(patsubst $(MAPS_DIR)/%/,$(MAPS_DIR)/%/map.json,$(MAP_DIRS)) $(BUILD_DIR)/data/maps.o: data/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 -nostdinc -undef -Wno-unicode - | $(PREPROC) -ie $< charmap.txt | $(AS) $(ASFLAGS) -o $@ @@ -30,3 +32,9 @@ $(MAPS_OUTDIR)/connections.inc $(MAPS_OUTDIR)/groups.inc $(MAPS_OUTDIR)/events.i $(LAYOUTS_OUTDIR)/layouts.inc $(LAYOUTS_OUTDIR)/layouts_table.inc $(INCLUDECONSTS_OUTDIR)/layouts.h: $(LAYOUTS_DIR)/layouts.json $(MAPJSON) layouts ruby $< $(LAYOUTS_OUTDIR) $(INCLUDECONSTS_OUTDIR) + +# Generate constants for map events, which depend on data that's distributed across the map.json files. +# There's a lot of map.json files, so we print an abbreviated output with echo. +$(INCLUDECONSTS_OUTDIR)/map_event_ids.h: $(MAP_JSONS) + @$(MAPJSON) event_constants ruby $^ $(INCLUDECONSTS_OUTDIR)/map_event_ids.h + @echo "$(MAPJSON) event_constants ruby $(INCLUDECONSTS_OUTDIR)/map_event_ids.h" diff --git a/sound/direct_sound_samples/cries/cry_abra.aif b/sound/direct_sound_samples/cries/cry_abra.aif deleted file mode 100644 index 7df4446db..000000000 Binary files a/sound/direct_sound_samples/cries/cry_abra.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_abra.wav b/sound/direct_sound_samples/cries/cry_abra.wav new file mode 100644 index 000000000..34d645d9d Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_abra.wav differ diff --git a/sound/direct_sound_samples/cries/cry_absol.aif b/sound/direct_sound_samples/cries/cry_absol.aif deleted file mode 100644 index 884ab22b3..000000000 Binary files a/sound/direct_sound_samples/cries/cry_absol.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_absol.wav b/sound/direct_sound_samples/cries/cry_absol.wav new file mode 100644 index 000000000..2da72c44a Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_absol.wav differ diff --git a/sound/direct_sound_samples/cries/cry_aerodactyl.aif b/sound/direct_sound_samples/cries/cry_aerodactyl.aif deleted file mode 100644 index c0e40f6d1..000000000 Binary files a/sound/direct_sound_samples/cries/cry_aerodactyl.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_aerodactyl.wav b/sound/direct_sound_samples/cries/cry_aerodactyl.wav new file mode 100644 index 000000000..23479e744 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_aerodactyl.wav differ diff --git a/sound/direct_sound_samples/cries/cry_aggron.aif b/sound/direct_sound_samples/cries/cry_aggron.aif deleted file mode 100644 index b89ea1222..000000000 Binary files a/sound/direct_sound_samples/cries/cry_aggron.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_aggron.wav b/sound/direct_sound_samples/cries/cry_aggron.wav new file mode 100644 index 000000000..1d2247036 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_aggron.wav differ diff --git a/sound/direct_sound_samples/cries/cry_aipom.aif b/sound/direct_sound_samples/cries/cry_aipom.aif deleted file mode 100644 index 5ca276de2..000000000 Binary files a/sound/direct_sound_samples/cries/cry_aipom.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_aipom.wav b/sound/direct_sound_samples/cries/cry_aipom.wav new file mode 100644 index 000000000..2fe15f875 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_aipom.wav differ diff --git a/sound/direct_sound_samples/cries/cry_alakazam.aif b/sound/direct_sound_samples/cries/cry_alakazam.aif deleted file mode 100644 index 920e2ff94..000000000 Binary files a/sound/direct_sound_samples/cries/cry_alakazam.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_alakazam.wav b/sound/direct_sound_samples/cries/cry_alakazam.wav new file mode 100644 index 000000000..911472dec Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_alakazam.wav differ diff --git a/sound/direct_sound_samples/cries/cry_altaria.aif b/sound/direct_sound_samples/cries/cry_altaria.aif deleted file mode 100644 index 3e8e35e8e..000000000 Binary files a/sound/direct_sound_samples/cries/cry_altaria.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_altaria.wav b/sound/direct_sound_samples/cries/cry_altaria.wav new file mode 100644 index 000000000..08395d0d6 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_altaria.wav differ diff --git a/sound/direct_sound_samples/cries/cry_ampharos.aif b/sound/direct_sound_samples/cries/cry_ampharos.aif deleted file mode 100644 index 4f6e255a0..000000000 Binary files a/sound/direct_sound_samples/cries/cry_ampharos.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_ampharos.wav b/sound/direct_sound_samples/cries/cry_ampharos.wav new file mode 100644 index 000000000..da0bd761c Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_ampharos.wav differ diff --git a/sound/direct_sound_samples/cries/cry_anorith.aif b/sound/direct_sound_samples/cries/cry_anorith.aif deleted file mode 100644 index 96e87e919..000000000 Binary files a/sound/direct_sound_samples/cries/cry_anorith.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_anorith.wav b/sound/direct_sound_samples/cries/cry_anorith.wav new file mode 100644 index 000000000..5840c5769 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_anorith.wav differ diff --git a/sound/direct_sound_samples/cries/cry_arbok.aif b/sound/direct_sound_samples/cries/cry_arbok.aif deleted file mode 100644 index 6ccace9f9..000000000 Binary files a/sound/direct_sound_samples/cries/cry_arbok.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_arbok.wav b/sound/direct_sound_samples/cries/cry_arbok.wav new file mode 100644 index 000000000..a7b9de89e Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_arbok.wav differ diff --git a/sound/direct_sound_samples/cries/cry_arcanine.aif b/sound/direct_sound_samples/cries/cry_arcanine.aif deleted file mode 100644 index 61d802153..000000000 Binary files a/sound/direct_sound_samples/cries/cry_arcanine.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_arcanine.wav b/sound/direct_sound_samples/cries/cry_arcanine.wav new file mode 100644 index 000000000..65aa4e21f Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_arcanine.wav differ diff --git a/sound/direct_sound_samples/cries/cry_ariados.aif b/sound/direct_sound_samples/cries/cry_ariados.aif deleted file mode 100644 index 1748624fb..000000000 Binary files a/sound/direct_sound_samples/cries/cry_ariados.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_ariados.wav b/sound/direct_sound_samples/cries/cry_ariados.wav new file mode 100644 index 000000000..168f97552 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_ariados.wav differ diff --git a/sound/direct_sound_samples/cries/cry_armaldo.aif b/sound/direct_sound_samples/cries/cry_armaldo.aif deleted file mode 100644 index 756bf0842..000000000 Binary files a/sound/direct_sound_samples/cries/cry_armaldo.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_armaldo.wav b/sound/direct_sound_samples/cries/cry_armaldo.wav new file mode 100644 index 000000000..aecebd18e Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_armaldo.wav differ diff --git a/sound/direct_sound_samples/cries/cry_aron.aif b/sound/direct_sound_samples/cries/cry_aron.aif deleted file mode 100644 index cce70b73b..000000000 Binary files a/sound/direct_sound_samples/cries/cry_aron.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_aron.wav b/sound/direct_sound_samples/cries/cry_aron.wav new file mode 100644 index 000000000..42860d46b Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_aron.wav differ diff --git a/sound/direct_sound_samples/cries/cry_articuno.aif b/sound/direct_sound_samples/cries/cry_articuno.aif deleted file mode 100644 index 4f237dd0f..000000000 Binary files a/sound/direct_sound_samples/cries/cry_articuno.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_articuno.wav b/sound/direct_sound_samples/cries/cry_articuno.wav new file mode 100644 index 000000000..7ad8dfcd0 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_articuno.wav differ diff --git a/sound/direct_sound_samples/cries/cry_azumarill.aif b/sound/direct_sound_samples/cries/cry_azumarill.aif deleted file mode 100644 index 18411f93c..000000000 Binary files a/sound/direct_sound_samples/cries/cry_azumarill.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_azumarill.wav b/sound/direct_sound_samples/cries/cry_azumarill.wav new file mode 100644 index 000000000..331da9d90 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_azumarill.wav differ diff --git a/sound/direct_sound_samples/cries/cry_azurill.aif b/sound/direct_sound_samples/cries/cry_azurill.aif deleted file mode 100644 index 7f651c3d3..000000000 Binary files a/sound/direct_sound_samples/cries/cry_azurill.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_azurill.wav b/sound/direct_sound_samples/cries/cry_azurill.wav new file mode 100644 index 000000000..b3eda262b Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_azurill.wav differ diff --git a/sound/direct_sound_samples/cries/cry_bagon.aif b/sound/direct_sound_samples/cries/cry_bagon.aif deleted file mode 100644 index 3843fb9f4..000000000 Binary files a/sound/direct_sound_samples/cries/cry_bagon.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_bagon.wav b/sound/direct_sound_samples/cries/cry_bagon.wav new file mode 100644 index 000000000..2f36926ee Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_bagon.wav differ diff --git a/sound/direct_sound_samples/cries/cry_baltoy.aif b/sound/direct_sound_samples/cries/cry_baltoy.aif deleted file mode 100644 index 25e1a708a..000000000 Binary files a/sound/direct_sound_samples/cries/cry_baltoy.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_baltoy.wav b/sound/direct_sound_samples/cries/cry_baltoy.wav new file mode 100644 index 000000000..59867a0ed Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_baltoy.wav differ diff --git a/sound/direct_sound_samples/cries/cry_banette.aif b/sound/direct_sound_samples/cries/cry_banette.aif deleted file mode 100644 index 23713f1b5..000000000 Binary files a/sound/direct_sound_samples/cries/cry_banette.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_banette.wav b/sound/direct_sound_samples/cries/cry_banette.wav new file mode 100644 index 000000000..b2af33b68 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_banette.wav differ diff --git a/sound/direct_sound_samples/cries/cry_barboach.aif b/sound/direct_sound_samples/cries/cry_barboach.aif deleted file mode 100644 index 4b9228259..000000000 Binary files a/sound/direct_sound_samples/cries/cry_barboach.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_barboach.wav b/sound/direct_sound_samples/cries/cry_barboach.wav new file mode 100644 index 000000000..a955c76c2 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_barboach.wav differ diff --git a/sound/direct_sound_samples/cries/cry_bayleef.aif b/sound/direct_sound_samples/cries/cry_bayleef.aif deleted file mode 100644 index 8cef22df3..000000000 Binary files a/sound/direct_sound_samples/cries/cry_bayleef.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_bayleef.wav b/sound/direct_sound_samples/cries/cry_bayleef.wav new file mode 100644 index 000000000..6dbcaf918 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_bayleef.wav differ diff --git a/sound/direct_sound_samples/cries/cry_beautifly.aif b/sound/direct_sound_samples/cries/cry_beautifly.aif deleted file mode 100644 index 0924b6c55..000000000 Binary files a/sound/direct_sound_samples/cries/cry_beautifly.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_beautifly.wav b/sound/direct_sound_samples/cries/cry_beautifly.wav new file mode 100644 index 000000000..248428abc Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_beautifly.wav differ diff --git a/sound/direct_sound_samples/cries/cry_beedrill.aif b/sound/direct_sound_samples/cries/cry_beedrill.aif deleted file mode 100644 index 00d0bc96c..000000000 Binary files a/sound/direct_sound_samples/cries/cry_beedrill.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_beedrill.wav b/sound/direct_sound_samples/cries/cry_beedrill.wav new file mode 100644 index 000000000..a3fa107ac Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_beedrill.wav differ diff --git a/sound/direct_sound_samples/cries/cry_beldum.aif b/sound/direct_sound_samples/cries/cry_beldum.aif deleted file mode 100644 index 76435a6a8..000000000 Binary files a/sound/direct_sound_samples/cries/cry_beldum.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_beldum.wav b/sound/direct_sound_samples/cries/cry_beldum.wav new file mode 100644 index 000000000..427bb2477 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_beldum.wav differ diff --git a/sound/direct_sound_samples/cries/cry_bellossom.aif b/sound/direct_sound_samples/cries/cry_bellossom.aif deleted file mode 100644 index 86580df65..000000000 Binary files a/sound/direct_sound_samples/cries/cry_bellossom.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_bellossom.wav b/sound/direct_sound_samples/cries/cry_bellossom.wav new file mode 100644 index 000000000..7d47d8a78 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_bellossom.wav differ diff --git a/sound/direct_sound_samples/cries/cry_bellsprout.aif b/sound/direct_sound_samples/cries/cry_bellsprout.aif deleted file mode 100644 index cfdd7aed2..000000000 Binary files a/sound/direct_sound_samples/cries/cry_bellsprout.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_bellsprout.wav b/sound/direct_sound_samples/cries/cry_bellsprout.wav new file mode 100644 index 000000000..0f7a8ed63 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_bellsprout.wav differ diff --git a/sound/direct_sound_samples/cries/cry_blastoise.aif b/sound/direct_sound_samples/cries/cry_blastoise.aif deleted file mode 100644 index 76dac2bcc..000000000 Binary files a/sound/direct_sound_samples/cries/cry_blastoise.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_blastoise.wav b/sound/direct_sound_samples/cries/cry_blastoise.wav new file mode 100644 index 000000000..bcd068dd8 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_blastoise.wav differ diff --git a/sound/direct_sound_samples/cries/cry_blaziken.aif b/sound/direct_sound_samples/cries/cry_blaziken.aif deleted file mode 100644 index 83e5ccf23..000000000 Binary files a/sound/direct_sound_samples/cries/cry_blaziken.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_blaziken.wav b/sound/direct_sound_samples/cries/cry_blaziken.wav new file mode 100644 index 000000000..dd570e0bb Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_blaziken.wav differ diff --git a/sound/direct_sound_samples/cries/cry_blissey.aif b/sound/direct_sound_samples/cries/cry_blissey.aif deleted file mode 100644 index 897eb3d69..000000000 Binary files a/sound/direct_sound_samples/cries/cry_blissey.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_blissey.wav b/sound/direct_sound_samples/cries/cry_blissey.wav new file mode 100644 index 000000000..5cd44825d Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_blissey.wav differ diff --git a/sound/direct_sound_samples/cries/cry_breloom.aif b/sound/direct_sound_samples/cries/cry_breloom.aif deleted file mode 100644 index ea3f1bb66..000000000 Binary files a/sound/direct_sound_samples/cries/cry_breloom.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_breloom.wav b/sound/direct_sound_samples/cries/cry_breloom.wav new file mode 100644 index 000000000..226a65193 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_breloom.wav differ diff --git a/sound/direct_sound_samples/cries/cry_bulbasaur.aif b/sound/direct_sound_samples/cries/cry_bulbasaur.aif deleted file mode 100644 index 040fb1df7..000000000 Binary files a/sound/direct_sound_samples/cries/cry_bulbasaur.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_bulbasaur.wav b/sound/direct_sound_samples/cries/cry_bulbasaur.wav new file mode 100644 index 000000000..d081218ba Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_bulbasaur.wav differ diff --git a/sound/direct_sound_samples/cries/cry_butterfree.aif b/sound/direct_sound_samples/cries/cry_butterfree.aif deleted file mode 100644 index f27616395..000000000 Binary files a/sound/direct_sound_samples/cries/cry_butterfree.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_butterfree.wav b/sound/direct_sound_samples/cries/cry_butterfree.wav new file mode 100644 index 000000000..19e781569 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_butterfree.wav differ diff --git a/sound/direct_sound_samples/cries/cry_cacnea.aif b/sound/direct_sound_samples/cries/cry_cacnea.aif deleted file mode 100644 index 4fd5acd36..000000000 Binary files a/sound/direct_sound_samples/cries/cry_cacnea.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_cacnea.wav b/sound/direct_sound_samples/cries/cry_cacnea.wav new file mode 100644 index 000000000..dcf4323c4 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_cacnea.wav differ diff --git a/sound/direct_sound_samples/cries/cry_cacturne.aif b/sound/direct_sound_samples/cries/cry_cacturne.aif deleted file mode 100644 index d9fb8fda8..000000000 Binary files a/sound/direct_sound_samples/cries/cry_cacturne.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_cacturne.wav b/sound/direct_sound_samples/cries/cry_cacturne.wav new file mode 100644 index 000000000..bc5446317 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_cacturne.wav differ diff --git a/sound/direct_sound_samples/cries/cry_camerupt.aif b/sound/direct_sound_samples/cries/cry_camerupt.aif deleted file mode 100644 index 325df1220..000000000 Binary files a/sound/direct_sound_samples/cries/cry_camerupt.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_camerupt.wav b/sound/direct_sound_samples/cries/cry_camerupt.wav new file mode 100644 index 000000000..bef89f41d Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_camerupt.wav differ diff --git a/sound/direct_sound_samples/cries/cry_carvanha.aif b/sound/direct_sound_samples/cries/cry_carvanha.aif deleted file mode 100644 index c7cdedf91..000000000 Binary files a/sound/direct_sound_samples/cries/cry_carvanha.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_carvanha.wav b/sound/direct_sound_samples/cries/cry_carvanha.wav new file mode 100644 index 000000000..07a2f9d45 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_carvanha.wav differ diff --git a/sound/direct_sound_samples/cries/cry_cascoon.aif b/sound/direct_sound_samples/cries/cry_cascoon.aif deleted file mode 100644 index 17eef0ee9..000000000 Binary files a/sound/direct_sound_samples/cries/cry_cascoon.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_cascoon.wav b/sound/direct_sound_samples/cries/cry_cascoon.wav new file mode 100644 index 000000000..3e3daf626 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_cascoon.wav differ diff --git a/sound/direct_sound_samples/cries/cry_castform.aif b/sound/direct_sound_samples/cries/cry_castform.aif deleted file mode 100644 index c10745640..000000000 Binary files a/sound/direct_sound_samples/cries/cry_castform.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_castform.wav b/sound/direct_sound_samples/cries/cry_castform.wav new file mode 100644 index 000000000..8b50b35d9 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_castform.wav differ diff --git a/sound/direct_sound_samples/cries/cry_caterpie.aif b/sound/direct_sound_samples/cries/cry_caterpie.aif deleted file mode 100644 index b0b246b4f..000000000 Binary files a/sound/direct_sound_samples/cries/cry_caterpie.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_caterpie.wav b/sound/direct_sound_samples/cries/cry_caterpie.wav new file mode 100644 index 000000000..c50736446 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_caterpie.wav differ diff --git a/sound/direct_sound_samples/cries/cry_celebi.aif b/sound/direct_sound_samples/cries/cry_celebi.aif deleted file mode 100644 index 9f9f3ea39..000000000 Binary files a/sound/direct_sound_samples/cries/cry_celebi.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_celebi.wav b/sound/direct_sound_samples/cries/cry_celebi.wav new file mode 100644 index 000000000..c5a560e4b Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_celebi.wav differ diff --git a/sound/direct_sound_samples/cries/cry_chansey.aif b/sound/direct_sound_samples/cries/cry_chansey.aif deleted file mode 100644 index d764c86ce..000000000 Binary files a/sound/direct_sound_samples/cries/cry_chansey.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_chansey.wav b/sound/direct_sound_samples/cries/cry_chansey.wav new file mode 100644 index 000000000..418acc387 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_chansey.wav differ diff --git a/sound/direct_sound_samples/cries/cry_charizard.aif b/sound/direct_sound_samples/cries/cry_charizard.aif deleted file mode 100644 index 48321b792..000000000 Binary files a/sound/direct_sound_samples/cries/cry_charizard.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_charizard.wav b/sound/direct_sound_samples/cries/cry_charizard.wav new file mode 100644 index 000000000..fd748e8ee Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_charizard.wav differ diff --git a/sound/direct_sound_samples/cries/cry_charmander.aif b/sound/direct_sound_samples/cries/cry_charmander.aif deleted file mode 100644 index d72c0f9e0..000000000 Binary files a/sound/direct_sound_samples/cries/cry_charmander.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_charmander.wav b/sound/direct_sound_samples/cries/cry_charmander.wav new file mode 100644 index 000000000..09762f210 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_charmander.wav differ diff --git a/sound/direct_sound_samples/cries/cry_charmeleon.aif b/sound/direct_sound_samples/cries/cry_charmeleon.aif deleted file mode 100644 index 8e84af0d8..000000000 Binary files a/sound/direct_sound_samples/cries/cry_charmeleon.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_charmeleon.wav b/sound/direct_sound_samples/cries/cry_charmeleon.wav new file mode 100644 index 000000000..a5289e2b0 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_charmeleon.wav differ diff --git a/sound/direct_sound_samples/cries/cry_chikorita.aif b/sound/direct_sound_samples/cries/cry_chikorita.aif deleted file mode 100644 index 67ceafdc3..000000000 Binary files a/sound/direct_sound_samples/cries/cry_chikorita.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_chikorita.wav b/sound/direct_sound_samples/cries/cry_chikorita.wav new file mode 100644 index 000000000..485f364e7 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_chikorita.wav differ diff --git a/sound/direct_sound_samples/cries/cry_chimecho.aif b/sound/direct_sound_samples/cries/cry_chimecho.aif deleted file mode 100644 index 87ee2faee..000000000 Binary files a/sound/direct_sound_samples/cries/cry_chimecho.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_chimecho.wav b/sound/direct_sound_samples/cries/cry_chimecho.wav new file mode 100644 index 000000000..2ffa59350 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_chimecho.wav differ diff --git a/sound/direct_sound_samples/cries/cry_chinchou.aif b/sound/direct_sound_samples/cries/cry_chinchou.aif deleted file mode 100644 index 356475678..000000000 Binary files a/sound/direct_sound_samples/cries/cry_chinchou.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_chinchou.wav b/sound/direct_sound_samples/cries/cry_chinchou.wav new file mode 100644 index 000000000..4fe6c6a77 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_chinchou.wav differ diff --git a/sound/direct_sound_samples/cries/cry_clamperl.aif b/sound/direct_sound_samples/cries/cry_clamperl.aif deleted file mode 100644 index 7250bd703..000000000 Binary files a/sound/direct_sound_samples/cries/cry_clamperl.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_clamperl.wav b/sound/direct_sound_samples/cries/cry_clamperl.wav new file mode 100644 index 000000000..5e80ebab6 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_clamperl.wav differ diff --git a/sound/direct_sound_samples/cries/cry_claydol.aif b/sound/direct_sound_samples/cries/cry_claydol.aif deleted file mode 100644 index b89772021..000000000 Binary files a/sound/direct_sound_samples/cries/cry_claydol.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_claydol.wav b/sound/direct_sound_samples/cries/cry_claydol.wav new file mode 100644 index 000000000..27b7ed576 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_claydol.wav differ diff --git a/sound/direct_sound_samples/cries/cry_clefable.aif b/sound/direct_sound_samples/cries/cry_clefable.aif deleted file mode 100644 index 9c2d8c664..000000000 Binary files a/sound/direct_sound_samples/cries/cry_clefable.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_clefable.wav b/sound/direct_sound_samples/cries/cry_clefable.wav new file mode 100644 index 000000000..602577cab Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_clefable.wav differ diff --git a/sound/direct_sound_samples/cries/cry_clefairy.aif b/sound/direct_sound_samples/cries/cry_clefairy.aif deleted file mode 100644 index c370c4a9b..000000000 Binary files a/sound/direct_sound_samples/cries/cry_clefairy.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_clefairy.wav b/sound/direct_sound_samples/cries/cry_clefairy.wav new file mode 100644 index 000000000..2214cb445 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_clefairy.wav differ diff --git a/sound/direct_sound_samples/cries/cry_cleffa.aif b/sound/direct_sound_samples/cries/cry_cleffa.aif deleted file mode 100644 index b27cdeca9..000000000 Binary files a/sound/direct_sound_samples/cries/cry_cleffa.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_cleffa.wav b/sound/direct_sound_samples/cries/cry_cleffa.wav new file mode 100644 index 000000000..946a75959 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_cleffa.wav differ diff --git a/sound/direct_sound_samples/cries/cry_cloyster.aif b/sound/direct_sound_samples/cries/cry_cloyster.aif deleted file mode 100644 index b406deab0..000000000 Binary files a/sound/direct_sound_samples/cries/cry_cloyster.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_cloyster.wav b/sound/direct_sound_samples/cries/cry_cloyster.wav new file mode 100644 index 000000000..acd5f7fc3 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_cloyster.wav differ diff --git a/sound/direct_sound_samples/cries/cry_combusken.aif b/sound/direct_sound_samples/cries/cry_combusken.aif deleted file mode 100644 index 7d4b0d4cc..000000000 Binary files a/sound/direct_sound_samples/cries/cry_combusken.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_combusken.wav b/sound/direct_sound_samples/cries/cry_combusken.wav new file mode 100644 index 000000000..6c23eb499 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_combusken.wav differ diff --git a/sound/direct_sound_samples/cries/cry_corphish.aif b/sound/direct_sound_samples/cries/cry_corphish.aif deleted file mode 100644 index f0f5ca01e..000000000 Binary files a/sound/direct_sound_samples/cries/cry_corphish.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_corphish.wav b/sound/direct_sound_samples/cries/cry_corphish.wav new file mode 100644 index 000000000..72af4a9e0 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_corphish.wav differ diff --git a/sound/direct_sound_samples/cries/cry_corsola.aif b/sound/direct_sound_samples/cries/cry_corsola.aif deleted file mode 100644 index 68e743bfd..000000000 Binary files a/sound/direct_sound_samples/cries/cry_corsola.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_corsola.wav b/sound/direct_sound_samples/cries/cry_corsola.wav new file mode 100644 index 000000000..c40b570a1 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_corsola.wav differ diff --git a/sound/direct_sound_samples/cries/cry_cradily.aif b/sound/direct_sound_samples/cries/cry_cradily.aif deleted file mode 100644 index 197dc8d92..000000000 Binary files a/sound/direct_sound_samples/cries/cry_cradily.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_cradily.wav b/sound/direct_sound_samples/cries/cry_cradily.wav new file mode 100644 index 000000000..ba4f755c7 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_cradily.wav differ diff --git a/sound/direct_sound_samples/cries/cry_crawdaunt.aif b/sound/direct_sound_samples/cries/cry_crawdaunt.aif deleted file mode 100644 index a203ce2fb..000000000 Binary files a/sound/direct_sound_samples/cries/cry_crawdaunt.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_crawdaunt.wav b/sound/direct_sound_samples/cries/cry_crawdaunt.wav new file mode 100644 index 000000000..2ce6659a3 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_crawdaunt.wav differ diff --git a/sound/direct_sound_samples/cries/cry_crobat.aif b/sound/direct_sound_samples/cries/cry_crobat.aif deleted file mode 100644 index 75d039bd8..000000000 Binary files a/sound/direct_sound_samples/cries/cry_crobat.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_crobat.wav b/sound/direct_sound_samples/cries/cry_crobat.wav new file mode 100644 index 000000000..9000b8c29 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_crobat.wav differ diff --git a/sound/direct_sound_samples/cries/cry_croconaw.aif b/sound/direct_sound_samples/cries/cry_croconaw.aif deleted file mode 100644 index afb7f3fdc..000000000 Binary files a/sound/direct_sound_samples/cries/cry_croconaw.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_croconaw.wav b/sound/direct_sound_samples/cries/cry_croconaw.wav new file mode 100644 index 000000000..9fd775fc0 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_croconaw.wav differ diff --git a/sound/direct_sound_samples/cries/cry_cubone.aif b/sound/direct_sound_samples/cries/cry_cubone.aif deleted file mode 100644 index 170745da1..000000000 Binary files a/sound/direct_sound_samples/cries/cry_cubone.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_cubone.wav b/sound/direct_sound_samples/cries/cry_cubone.wav new file mode 100644 index 000000000..44b97c4bb Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_cubone.wav differ diff --git a/sound/direct_sound_samples/cries/cry_cyndaquil.aif b/sound/direct_sound_samples/cries/cry_cyndaquil.aif deleted file mode 100644 index 4aa580199..000000000 Binary files a/sound/direct_sound_samples/cries/cry_cyndaquil.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_cyndaquil.wav b/sound/direct_sound_samples/cries/cry_cyndaquil.wav new file mode 100644 index 000000000..23e9b3273 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_cyndaquil.wav differ diff --git a/sound/direct_sound_samples/cries/cry_delcatty.aif b/sound/direct_sound_samples/cries/cry_delcatty.aif deleted file mode 100644 index dd665b110..000000000 Binary files a/sound/direct_sound_samples/cries/cry_delcatty.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_delcatty.wav b/sound/direct_sound_samples/cries/cry_delcatty.wav new file mode 100644 index 000000000..780705266 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_delcatty.wav differ diff --git a/sound/direct_sound_samples/cries/cry_delibird.aif b/sound/direct_sound_samples/cries/cry_delibird.aif deleted file mode 100644 index dbedc42d4..000000000 Binary files a/sound/direct_sound_samples/cries/cry_delibird.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_delibird.wav b/sound/direct_sound_samples/cries/cry_delibird.wav new file mode 100644 index 000000000..f4b27e732 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_delibird.wav differ diff --git a/sound/direct_sound_samples/cries/cry_deoxys.aif b/sound/direct_sound_samples/cries/cry_deoxys.aif deleted file mode 100644 index b9623b337..000000000 Binary files a/sound/direct_sound_samples/cries/cry_deoxys.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_deoxys.wav b/sound/direct_sound_samples/cries/cry_deoxys.wav new file mode 100644 index 000000000..c5943318d Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_deoxys.wav differ diff --git a/sound/direct_sound_samples/cries/cry_dewgong.aif b/sound/direct_sound_samples/cries/cry_dewgong.aif deleted file mode 100644 index 72d69b773..000000000 Binary files a/sound/direct_sound_samples/cries/cry_dewgong.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_dewgong.wav b/sound/direct_sound_samples/cries/cry_dewgong.wav new file mode 100644 index 000000000..c99284027 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_dewgong.wav differ diff --git a/sound/direct_sound_samples/cries/cry_diglett.aif b/sound/direct_sound_samples/cries/cry_diglett.aif deleted file mode 100644 index b116af7f2..000000000 Binary files a/sound/direct_sound_samples/cries/cry_diglett.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_diglett.wav b/sound/direct_sound_samples/cries/cry_diglett.wav new file mode 100644 index 000000000..ba098f64a Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_diglett.wav differ diff --git a/sound/direct_sound_samples/cries/cry_ditto.aif b/sound/direct_sound_samples/cries/cry_ditto.aif deleted file mode 100644 index 2c797f4c4..000000000 Binary files a/sound/direct_sound_samples/cries/cry_ditto.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_ditto.wav b/sound/direct_sound_samples/cries/cry_ditto.wav new file mode 100644 index 000000000..b26b2d56c Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_ditto.wav differ diff --git a/sound/direct_sound_samples/cries/cry_dodrio.aif b/sound/direct_sound_samples/cries/cry_dodrio.aif deleted file mode 100644 index 111d8bf3e..000000000 Binary files a/sound/direct_sound_samples/cries/cry_dodrio.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_dodrio.wav b/sound/direct_sound_samples/cries/cry_dodrio.wav new file mode 100644 index 000000000..c23d097d8 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_dodrio.wav differ diff --git a/sound/direct_sound_samples/cries/cry_doduo.aif b/sound/direct_sound_samples/cries/cry_doduo.aif deleted file mode 100644 index 5700b91d9..000000000 Binary files a/sound/direct_sound_samples/cries/cry_doduo.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_doduo.wav b/sound/direct_sound_samples/cries/cry_doduo.wav new file mode 100644 index 000000000..3d7bad39e Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_doduo.wav differ diff --git a/sound/direct_sound_samples/cries/cry_donphan.aif b/sound/direct_sound_samples/cries/cry_donphan.aif deleted file mode 100644 index a41c124b1..000000000 Binary files a/sound/direct_sound_samples/cries/cry_donphan.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_donphan.wav b/sound/direct_sound_samples/cries/cry_donphan.wav new file mode 100644 index 000000000..64a69a34f Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_donphan.wav differ diff --git a/sound/direct_sound_samples/cries/cry_dragonair.aif b/sound/direct_sound_samples/cries/cry_dragonair.aif deleted file mode 100644 index 38c3955ef..000000000 Binary files a/sound/direct_sound_samples/cries/cry_dragonair.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_dragonair.wav b/sound/direct_sound_samples/cries/cry_dragonair.wav new file mode 100644 index 000000000..ab902f69d Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_dragonair.wav differ diff --git a/sound/direct_sound_samples/cries/cry_dragonite.aif b/sound/direct_sound_samples/cries/cry_dragonite.aif deleted file mode 100644 index d1e7b11cf..000000000 Binary files a/sound/direct_sound_samples/cries/cry_dragonite.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_dragonite.wav b/sound/direct_sound_samples/cries/cry_dragonite.wav new file mode 100644 index 000000000..98f044cc3 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_dragonite.wav differ diff --git a/sound/direct_sound_samples/cries/cry_dratini.aif b/sound/direct_sound_samples/cries/cry_dratini.aif deleted file mode 100644 index 298497480..000000000 Binary files a/sound/direct_sound_samples/cries/cry_dratini.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_dratini.wav b/sound/direct_sound_samples/cries/cry_dratini.wav new file mode 100644 index 000000000..ab59d4c18 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_dratini.wav differ diff --git a/sound/direct_sound_samples/cries/cry_drowzee.aif b/sound/direct_sound_samples/cries/cry_drowzee.aif deleted file mode 100644 index 0d53eb2ff..000000000 Binary files a/sound/direct_sound_samples/cries/cry_drowzee.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_drowzee.wav b/sound/direct_sound_samples/cries/cry_drowzee.wav new file mode 100644 index 000000000..3294d5f83 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_drowzee.wav differ diff --git a/sound/direct_sound_samples/cries/cry_dugtrio.aif b/sound/direct_sound_samples/cries/cry_dugtrio.aif deleted file mode 100644 index dff573dfe..000000000 Binary files a/sound/direct_sound_samples/cries/cry_dugtrio.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_dugtrio.wav b/sound/direct_sound_samples/cries/cry_dugtrio.wav new file mode 100644 index 000000000..59be4c5a7 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_dugtrio.wav differ diff --git a/sound/direct_sound_samples/cries/cry_dunsparce.aif b/sound/direct_sound_samples/cries/cry_dunsparce.aif deleted file mode 100644 index 454617c05..000000000 Binary files a/sound/direct_sound_samples/cries/cry_dunsparce.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_dunsparce.wav b/sound/direct_sound_samples/cries/cry_dunsparce.wav new file mode 100644 index 000000000..b3bc21a04 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_dunsparce.wav differ diff --git a/sound/direct_sound_samples/cries/cry_dusclops.aif b/sound/direct_sound_samples/cries/cry_dusclops.aif deleted file mode 100644 index de9657e4f..000000000 Binary files a/sound/direct_sound_samples/cries/cry_dusclops.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_dusclops.wav b/sound/direct_sound_samples/cries/cry_dusclops.wav new file mode 100644 index 000000000..0ae486972 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_dusclops.wav differ diff --git a/sound/direct_sound_samples/cries/cry_duskull.aif b/sound/direct_sound_samples/cries/cry_duskull.aif deleted file mode 100644 index d84ea274e..000000000 Binary files a/sound/direct_sound_samples/cries/cry_duskull.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_duskull.wav b/sound/direct_sound_samples/cries/cry_duskull.wav new file mode 100644 index 000000000..7ef72a397 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_duskull.wav differ diff --git a/sound/direct_sound_samples/cries/cry_dustox.aif b/sound/direct_sound_samples/cries/cry_dustox.aif deleted file mode 100644 index 56d8eb336..000000000 Binary files a/sound/direct_sound_samples/cries/cry_dustox.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_dustox.wav b/sound/direct_sound_samples/cries/cry_dustox.wav new file mode 100644 index 000000000..764758562 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_dustox.wav differ diff --git a/sound/direct_sound_samples/cries/cry_eevee.aif b/sound/direct_sound_samples/cries/cry_eevee.aif deleted file mode 100644 index 8711a1470..000000000 Binary files a/sound/direct_sound_samples/cries/cry_eevee.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_eevee.wav b/sound/direct_sound_samples/cries/cry_eevee.wav new file mode 100644 index 000000000..833528278 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_eevee.wav differ diff --git a/sound/direct_sound_samples/cries/cry_ekans.aif b/sound/direct_sound_samples/cries/cry_ekans.aif deleted file mode 100644 index 9eb396735..000000000 Binary files a/sound/direct_sound_samples/cries/cry_ekans.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_ekans.wav b/sound/direct_sound_samples/cries/cry_ekans.wav new file mode 100644 index 000000000..5a7515847 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_ekans.wav differ diff --git a/sound/direct_sound_samples/cries/cry_electabuzz.aif b/sound/direct_sound_samples/cries/cry_electabuzz.aif deleted file mode 100644 index 5abdb49b7..000000000 Binary files a/sound/direct_sound_samples/cries/cry_electabuzz.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_electabuzz.wav b/sound/direct_sound_samples/cries/cry_electabuzz.wav new file mode 100644 index 000000000..8443823fb Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_electabuzz.wav differ diff --git a/sound/direct_sound_samples/cries/cry_electrike.aif b/sound/direct_sound_samples/cries/cry_electrike.aif deleted file mode 100644 index 56c9666df..000000000 Binary files a/sound/direct_sound_samples/cries/cry_electrike.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_electrike.wav b/sound/direct_sound_samples/cries/cry_electrike.wav new file mode 100644 index 000000000..9b09301ff Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_electrike.wav differ diff --git a/sound/direct_sound_samples/cries/cry_electrode.aif b/sound/direct_sound_samples/cries/cry_electrode.aif deleted file mode 100644 index cbd7f0971..000000000 Binary files a/sound/direct_sound_samples/cries/cry_electrode.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_electrode.wav b/sound/direct_sound_samples/cries/cry_electrode.wav new file mode 100644 index 000000000..4ad346759 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_electrode.wav differ diff --git a/sound/direct_sound_samples/cries/cry_elekid.aif b/sound/direct_sound_samples/cries/cry_elekid.aif deleted file mode 100644 index 839bdee17..000000000 Binary files a/sound/direct_sound_samples/cries/cry_elekid.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_elekid.wav b/sound/direct_sound_samples/cries/cry_elekid.wav new file mode 100644 index 000000000..249111386 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_elekid.wav differ diff --git a/sound/direct_sound_samples/cries/cry_entei.aif b/sound/direct_sound_samples/cries/cry_entei.aif deleted file mode 100644 index 56a740207..000000000 Binary files a/sound/direct_sound_samples/cries/cry_entei.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_entei.wav b/sound/direct_sound_samples/cries/cry_entei.wav new file mode 100644 index 000000000..cce2db4b0 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_entei.wav differ diff --git a/sound/direct_sound_samples/cries/cry_espeon.aif b/sound/direct_sound_samples/cries/cry_espeon.aif deleted file mode 100644 index 53dc62f4d..000000000 Binary files a/sound/direct_sound_samples/cries/cry_espeon.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_espeon.wav b/sound/direct_sound_samples/cries/cry_espeon.wav new file mode 100644 index 000000000..8456a350d Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_espeon.wav differ diff --git a/sound/direct_sound_samples/cries/cry_exeggcute.aif b/sound/direct_sound_samples/cries/cry_exeggcute.aif deleted file mode 100644 index 147912c2f..000000000 Binary files a/sound/direct_sound_samples/cries/cry_exeggcute.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_exeggcute.wav b/sound/direct_sound_samples/cries/cry_exeggcute.wav new file mode 100644 index 000000000..865aedc1f Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_exeggcute.wav differ diff --git a/sound/direct_sound_samples/cries/cry_exeggutor.aif b/sound/direct_sound_samples/cries/cry_exeggutor.aif deleted file mode 100644 index c0b9177bf..000000000 Binary files a/sound/direct_sound_samples/cries/cry_exeggutor.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_exeggutor.wav b/sound/direct_sound_samples/cries/cry_exeggutor.wav new file mode 100644 index 000000000..831eb36cd Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_exeggutor.wav differ diff --git a/sound/direct_sound_samples/cries/cry_exploud.aif b/sound/direct_sound_samples/cries/cry_exploud.aif deleted file mode 100644 index 5b80870cc..000000000 Binary files a/sound/direct_sound_samples/cries/cry_exploud.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_exploud.wav b/sound/direct_sound_samples/cries/cry_exploud.wav new file mode 100644 index 000000000..1b81512ce Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_exploud.wav differ diff --git a/sound/direct_sound_samples/cries/cry_farfetchd.aif b/sound/direct_sound_samples/cries/cry_farfetchd.aif deleted file mode 100644 index f1db556dc..000000000 Binary files a/sound/direct_sound_samples/cries/cry_farfetchd.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_farfetchd.wav b/sound/direct_sound_samples/cries/cry_farfetchd.wav new file mode 100644 index 000000000..294322e04 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_farfetchd.wav differ diff --git a/sound/direct_sound_samples/cries/cry_fearow.aif b/sound/direct_sound_samples/cries/cry_fearow.aif deleted file mode 100644 index 74a76f6d4..000000000 Binary files a/sound/direct_sound_samples/cries/cry_fearow.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_fearow.wav b/sound/direct_sound_samples/cries/cry_fearow.wav new file mode 100644 index 000000000..d2ab288dd Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_fearow.wav differ diff --git a/sound/direct_sound_samples/cries/cry_feebas.aif b/sound/direct_sound_samples/cries/cry_feebas.aif deleted file mode 100644 index c386522f1..000000000 Binary files a/sound/direct_sound_samples/cries/cry_feebas.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_feebas.wav b/sound/direct_sound_samples/cries/cry_feebas.wav new file mode 100644 index 000000000..1e9037b7e Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_feebas.wav differ diff --git a/sound/direct_sound_samples/cries/cry_feraligatr.aif b/sound/direct_sound_samples/cries/cry_feraligatr.aif deleted file mode 100644 index 9fcd93cff..000000000 Binary files a/sound/direct_sound_samples/cries/cry_feraligatr.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_feraligatr.wav b/sound/direct_sound_samples/cries/cry_feraligatr.wav new file mode 100644 index 000000000..f17eec474 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_feraligatr.wav differ diff --git a/sound/direct_sound_samples/cries/cry_flaaffy.aif b/sound/direct_sound_samples/cries/cry_flaaffy.aif deleted file mode 100644 index 93dfacfaf..000000000 Binary files a/sound/direct_sound_samples/cries/cry_flaaffy.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_flaaffy.wav b/sound/direct_sound_samples/cries/cry_flaaffy.wav new file mode 100644 index 000000000..9459c8e06 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_flaaffy.wav differ diff --git a/sound/direct_sound_samples/cries/cry_flareon.aif b/sound/direct_sound_samples/cries/cry_flareon.aif deleted file mode 100644 index 58d28e60a..000000000 Binary files a/sound/direct_sound_samples/cries/cry_flareon.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_flareon.wav b/sound/direct_sound_samples/cries/cry_flareon.wav new file mode 100644 index 000000000..d138a75e0 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_flareon.wav differ diff --git a/sound/direct_sound_samples/cries/cry_flygon.aif b/sound/direct_sound_samples/cries/cry_flygon.aif deleted file mode 100644 index c8c377016..000000000 Binary files a/sound/direct_sound_samples/cries/cry_flygon.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_flygon.wav b/sound/direct_sound_samples/cries/cry_flygon.wav new file mode 100644 index 000000000..2d64627ee Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_flygon.wav differ diff --git a/sound/direct_sound_samples/cries/cry_forretress.aif b/sound/direct_sound_samples/cries/cry_forretress.aif deleted file mode 100644 index 288dacbea..000000000 Binary files a/sound/direct_sound_samples/cries/cry_forretress.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_forretress.wav b/sound/direct_sound_samples/cries/cry_forretress.wav new file mode 100644 index 000000000..008140c1e Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_forretress.wav differ diff --git a/sound/direct_sound_samples/cries/cry_furret.aif b/sound/direct_sound_samples/cries/cry_furret.aif deleted file mode 100644 index 6b4e9ce11..000000000 Binary files a/sound/direct_sound_samples/cries/cry_furret.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_furret.wav b/sound/direct_sound_samples/cries/cry_furret.wav new file mode 100644 index 000000000..605eeec17 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_furret.wav differ diff --git a/sound/direct_sound_samples/cries/cry_gardevoir.aif b/sound/direct_sound_samples/cries/cry_gardevoir.aif deleted file mode 100644 index a14780990..000000000 Binary files a/sound/direct_sound_samples/cries/cry_gardevoir.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_gardevoir.wav b/sound/direct_sound_samples/cries/cry_gardevoir.wav new file mode 100644 index 000000000..a40ef1262 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_gardevoir.wav differ diff --git a/sound/direct_sound_samples/cries/cry_gastly.aif b/sound/direct_sound_samples/cries/cry_gastly.aif deleted file mode 100644 index 93cef851d..000000000 Binary files a/sound/direct_sound_samples/cries/cry_gastly.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_gastly.wav b/sound/direct_sound_samples/cries/cry_gastly.wav new file mode 100644 index 000000000..7d9c25de3 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_gastly.wav differ diff --git a/sound/direct_sound_samples/cries/cry_gengar.aif b/sound/direct_sound_samples/cries/cry_gengar.aif deleted file mode 100644 index 379b5d37e..000000000 Binary files a/sound/direct_sound_samples/cries/cry_gengar.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_gengar.wav b/sound/direct_sound_samples/cries/cry_gengar.wav new file mode 100644 index 000000000..74ec623df Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_gengar.wav differ diff --git a/sound/direct_sound_samples/cries/cry_geodude.aif b/sound/direct_sound_samples/cries/cry_geodude.aif deleted file mode 100644 index 143b9031c..000000000 Binary files a/sound/direct_sound_samples/cries/cry_geodude.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_geodude.wav b/sound/direct_sound_samples/cries/cry_geodude.wav new file mode 100644 index 000000000..0c1336a8e Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_geodude.wav differ diff --git a/sound/direct_sound_samples/cries/cry_girafarig.aif b/sound/direct_sound_samples/cries/cry_girafarig.aif deleted file mode 100644 index 1dd5f93e2..000000000 Binary files a/sound/direct_sound_samples/cries/cry_girafarig.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_girafarig.wav b/sound/direct_sound_samples/cries/cry_girafarig.wav new file mode 100644 index 000000000..089b8bb04 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_girafarig.wav differ diff --git a/sound/direct_sound_samples/cries/cry_glalie.aif b/sound/direct_sound_samples/cries/cry_glalie.aif deleted file mode 100644 index e4e896547..000000000 Binary files a/sound/direct_sound_samples/cries/cry_glalie.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_glalie.wav b/sound/direct_sound_samples/cries/cry_glalie.wav new file mode 100644 index 000000000..6f81e7a2a Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_glalie.wav differ diff --git a/sound/direct_sound_samples/cries/cry_gligar.aif b/sound/direct_sound_samples/cries/cry_gligar.aif deleted file mode 100644 index 4050f08b0..000000000 Binary files a/sound/direct_sound_samples/cries/cry_gligar.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_gligar.wav b/sound/direct_sound_samples/cries/cry_gligar.wav new file mode 100644 index 000000000..fa49131d8 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_gligar.wav differ diff --git a/sound/direct_sound_samples/cries/cry_gloom.aif b/sound/direct_sound_samples/cries/cry_gloom.aif deleted file mode 100644 index e930328ac..000000000 Binary files a/sound/direct_sound_samples/cries/cry_gloom.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_gloom.wav b/sound/direct_sound_samples/cries/cry_gloom.wav new file mode 100644 index 000000000..ce3da9708 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_gloom.wav differ diff --git a/sound/direct_sound_samples/cries/cry_golbat.aif b/sound/direct_sound_samples/cries/cry_golbat.aif deleted file mode 100644 index 11413df3a..000000000 Binary files a/sound/direct_sound_samples/cries/cry_golbat.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_golbat.wav b/sound/direct_sound_samples/cries/cry_golbat.wav new file mode 100644 index 000000000..4f098e5f2 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_golbat.wav differ diff --git a/sound/direct_sound_samples/cries/cry_goldeen.aif b/sound/direct_sound_samples/cries/cry_goldeen.aif deleted file mode 100644 index 81fd1ecdf..000000000 Binary files a/sound/direct_sound_samples/cries/cry_goldeen.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_goldeen.wav b/sound/direct_sound_samples/cries/cry_goldeen.wav new file mode 100644 index 000000000..ec3b48ad4 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_goldeen.wav differ diff --git a/sound/direct_sound_samples/cries/cry_golduck.aif b/sound/direct_sound_samples/cries/cry_golduck.aif deleted file mode 100644 index b6b71a7a4..000000000 Binary files a/sound/direct_sound_samples/cries/cry_golduck.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_golduck.wav b/sound/direct_sound_samples/cries/cry_golduck.wav new file mode 100644 index 000000000..bc6cc95af Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_golduck.wav differ diff --git a/sound/direct_sound_samples/cries/cry_golem.aif b/sound/direct_sound_samples/cries/cry_golem.aif deleted file mode 100644 index 0d2c4515e..000000000 Binary files a/sound/direct_sound_samples/cries/cry_golem.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_golem.wav b/sound/direct_sound_samples/cries/cry_golem.wav new file mode 100644 index 000000000..9a26adcc9 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_golem.wav differ diff --git a/sound/direct_sound_samples/cries/cry_gorebyss.aif b/sound/direct_sound_samples/cries/cry_gorebyss.aif deleted file mode 100644 index b7605062c..000000000 Binary files a/sound/direct_sound_samples/cries/cry_gorebyss.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_gorebyss.wav b/sound/direct_sound_samples/cries/cry_gorebyss.wav new file mode 100644 index 000000000..cd14f26dd Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_gorebyss.wav differ diff --git a/sound/direct_sound_samples/cries/cry_granbull.aif b/sound/direct_sound_samples/cries/cry_granbull.aif deleted file mode 100644 index 146b3bd0c..000000000 Binary files a/sound/direct_sound_samples/cries/cry_granbull.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_granbull.wav b/sound/direct_sound_samples/cries/cry_granbull.wav new file mode 100644 index 000000000..faffbc562 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_granbull.wav differ diff --git a/sound/direct_sound_samples/cries/cry_graveler.aif b/sound/direct_sound_samples/cries/cry_graveler.aif deleted file mode 100644 index 773994228..000000000 Binary files a/sound/direct_sound_samples/cries/cry_graveler.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_graveler.wav b/sound/direct_sound_samples/cries/cry_graveler.wav new file mode 100644 index 000000000..e5a2e9d19 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_graveler.wav differ diff --git a/sound/direct_sound_samples/cries/cry_grimer.aif b/sound/direct_sound_samples/cries/cry_grimer.aif deleted file mode 100644 index 95eed1061..000000000 Binary files a/sound/direct_sound_samples/cries/cry_grimer.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_grimer.wav b/sound/direct_sound_samples/cries/cry_grimer.wav new file mode 100644 index 000000000..8ae15f406 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_grimer.wav differ diff --git a/sound/direct_sound_samples/cries/cry_groudon.aif b/sound/direct_sound_samples/cries/cry_groudon.aif deleted file mode 100644 index 62452b4d9..000000000 Binary files a/sound/direct_sound_samples/cries/cry_groudon.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_groudon.wav b/sound/direct_sound_samples/cries/cry_groudon.wav new file mode 100644 index 000000000..057120579 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_groudon.wav differ diff --git a/sound/direct_sound_samples/cries/cry_grovyle.aif b/sound/direct_sound_samples/cries/cry_grovyle.aif deleted file mode 100644 index 983bcfff3..000000000 Binary files a/sound/direct_sound_samples/cries/cry_grovyle.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_grovyle.wav b/sound/direct_sound_samples/cries/cry_grovyle.wav new file mode 100644 index 000000000..6ae949e00 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_grovyle.wav differ diff --git a/sound/direct_sound_samples/cries/cry_growlithe.aif b/sound/direct_sound_samples/cries/cry_growlithe.aif deleted file mode 100644 index 134e29834..000000000 Binary files a/sound/direct_sound_samples/cries/cry_growlithe.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_growlithe.wav b/sound/direct_sound_samples/cries/cry_growlithe.wav new file mode 100644 index 000000000..96ea21385 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_growlithe.wav differ diff --git a/sound/direct_sound_samples/cries/cry_grumpig.aif b/sound/direct_sound_samples/cries/cry_grumpig.aif deleted file mode 100644 index 97c372076..000000000 Binary files a/sound/direct_sound_samples/cries/cry_grumpig.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_grumpig.wav b/sound/direct_sound_samples/cries/cry_grumpig.wav new file mode 100644 index 000000000..99f7684d1 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_grumpig.wav differ diff --git a/sound/direct_sound_samples/cries/cry_gulpin.aif b/sound/direct_sound_samples/cries/cry_gulpin.aif deleted file mode 100644 index f3043b422..000000000 Binary files a/sound/direct_sound_samples/cries/cry_gulpin.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_gulpin.wav b/sound/direct_sound_samples/cries/cry_gulpin.wav new file mode 100644 index 000000000..af1c2dd99 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_gulpin.wav differ diff --git a/sound/direct_sound_samples/cries/cry_gyarados.aif b/sound/direct_sound_samples/cries/cry_gyarados.aif deleted file mode 100644 index 238b6d721..000000000 Binary files a/sound/direct_sound_samples/cries/cry_gyarados.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_gyarados.wav b/sound/direct_sound_samples/cries/cry_gyarados.wav new file mode 100644 index 000000000..b76327da2 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_gyarados.wav differ diff --git a/sound/direct_sound_samples/cries/cry_hariyama.aif b/sound/direct_sound_samples/cries/cry_hariyama.aif deleted file mode 100644 index 1ac1f3f7e..000000000 Binary files a/sound/direct_sound_samples/cries/cry_hariyama.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_hariyama.wav b/sound/direct_sound_samples/cries/cry_hariyama.wav new file mode 100644 index 000000000..879f7d1e1 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_hariyama.wav differ diff --git a/sound/direct_sound_samples/cries/cry_haunter.aif b/sound/direct_sound_samples/cries/cry_haunter.aif deleted file mode 100644 index 60ec72171..000000000 Binary files a/sound/direct_sound_samples/cries/cry_haunter.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_haunter.wav b/sound/direct_sound_samples/cries/cry_haunter.wav new file mode 100644 index 000000000..999a0d02d Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_haunter.wav differ diff --git a/sound/direct_sound_samples/cries/cry_heracross.aif b/sound/direct_sound_samples/cries/cry_heracross.aif deleted file mode 100644 index a0734748f..000000000 Binary files a/sound/direct_sound_samples/cries/cry_heracross.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_heracross.wav b/sound/direct_sound_samples/cries/cry_heracross.wav new file mode 100644 index 000000000..148249908 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_heracross.wav differ diff --git a/sound/direct_sound_samples/cries/cry_hitmonchan.aif b/sound/direct_sound_samples/cries/cry_hitmonchan.aif deleted file mode 100644 index 40479452c..000000000 Binary files a/sound/direct_sound_samples/cries/cry_hitmonchan.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_hitmonchan.wav b/sound/direct_sound_samples/cries/cry_hitmonchan.wav new file mode 100644 index 000000000..130169e6e Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_hitmonchan.wav differ diff --git a/sound/direct_sound_samples/cries/cry_hitmonlee.aif b/sound/direct_sound_samples/cries/cry_hitmonlee.aif deleted file mode 100644 index 3a4bcddca..000000000 Binary files a/sound/direct_sound_samples/cries/cry_hitmonlee.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_hitmonlee.wav b/sound/direct_sound_samples/cries/cry_hitmonlee.wav new file mode 100644 index 000000000..9ec63520a Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_hitmonlee.wav differ diff --git a/sound/direct_sound_samples/cries/cry_hitmontop.aif b/sound/direct_sound_samples/cries/cry_hitmontop.aif deleted file mode 100644 index 3fbee8041..000000000 Binary files a/sound/direct_sound_samples/cries/cry_hitmontop.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_hitmontop.wav b/sound/direct_sound_samples/cries/cry_hitmontop.wav new file mode 100644 index 000000000..fa26c699b Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_hitmontop.wav differ diff --git a/sound/direct_sound_samples/cries/cry_ho_oh.aif b/sound/direct_sound_samples/cries/cry_ho_oh.aif deleted file mode 100644 index 52f8dd307..000000000 Binary files a/sound/direct_sound_samples/cries/cry_ho_oh.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_ho_oh.wav b/sound/direct_sound_samples/cries/cry_ho_oh.wav new file mode 100644 index 000000000..e098f9806 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_ho_oh.wav differ diff --git a/sound/direct_sound_samples/cries/cry_hoothoot.aif b/sound/direct_sound_samples/cries/cry_hoothoot.aif deleted file mode 100644 index 59e685dcc..000000000 Binary files a/sound/direct_sound_samples/cries/cry_hoothoot.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_hoothoot.wav b/sound/direct_sound_samples/cries/cry_hoothoot.wav new file mode 100644 index 000000000..303fddb12 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_hoothoot.wav differ diff --git a/sound/direct_sound_samples/cries/cry_hoppip.aif b/sound/direct_sound_samples/cries/cry_hoppip.aif deleted file mode 100644 index ea47877d0..000000000 Binary files a/sound/direct_sound_samples/cries/cry_hoppip.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_hoppip.wav b/sound/direct_sound_samples/cries/cry_hoppip.wav new file mode 100644 index 000000000..525c720e9 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_hoppip.wav differ diff --git a/sound/direct_sound_samples/cries/cry_horsea.aif b/sound/direct_sound_samples/cries/cry_horsea.aif deleted file mode 100644 index e41eff4b1..000000000 Binary files a/sound/direct_sound_samples/cries/cry_horsea.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_horsea.wav b/sound/direct_sound_samples/cries/cry_horsea.wav new file mode 100644 index 000000000..26efb0ca7 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_horsea.wav differ diff --git a/sound/direct_sound_samples/cries/cry_houndoom.aif b/sound/direct_sound_samples/cries/cry_houndoom.aif deleted file mode 100644 index 6fec16d39..000000000 Binary files a/sound/direct_sound_samples/cries/cry_houndoom.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_houndoom.wav b/sound/direct_sound_samples/cries/cry_houndoom.wav new file mode 100644 index 000000000..1add97cb8 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_houndoom.wav differ diff --git a/sound/direct_sound_samples/cries/cry_houndour.aif b/sound/direct_sound_samples/cries/cry_houndour.aif deleted file mode 100644 index 7431bbf29..000000000 Binary files a/sound/direct_sound_samples/cries/cry_houndour.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_houndour.wav b/sound/direct_sound_samples/cries/cry_houndour.wav new file mode 100644 index 000000000..ef683e68f Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_houndour.wav differ diff --git a/sound/direct_sound_samples/cries/cry_huntail.aif b/sound/direct_sound_samples/cries/cry_huntail.aif deleted file mode 100644 index f1d3b29d9..000000000 Binary files a/sound/direct_sound_samples/cries/cry_huntail.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_huntail.wav b/sound/direct_sound_samples/cries/cry_huntail.wav new file mode 100644 index 000000000..9c4e7af02 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_huntail.wav differ diff --git a/sound/direct_sound_samples/cries/cry_hypno.aif b/sound/direct_sound_samples/cries/cry_hypno.aif deleted file mode 100644 index 32672a3c3..000000000 Binary files a/sound/direct_sound_samples/cries/cry_hypno.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_hypno.wav b/sound/direct_sound_samples/cries/cry_hypno.wav new file mode 100644 index 000000000..3b1e2dab6 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_hypno.wav differ diff --git a/sound/direct_sound_samples/cries/cry_igglybuff.aif b/sound/direct_sound_samples/cries/cry_igglybuff.aif deleted file mode 100644 index 8de8394d5..000000000 Binary files a/sound/direct_sound_samples/cries/cry_igglybuff.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_igglybuff.wav b/sound/direct_sound_samples/cries/cry_igglybuff.wav new file mode 100644 index 000000000..0b8a7dfca Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_igglybuff.wav differ diff --git a/sound/direct_sound_samples/cries/cry_illumise.aif b/sound/direct_sound_samples/cries/cry_illumise.aif deleted file mode 100644 index 75e03efc8..000000000 Binary files a/sound/direct_sound_samples/cries/cry_illumise.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_illumise.wav b/sound/direct_sound_samples/cries/cry_illumise.wav new file mode 100644 index 000000000..f0234b92e Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_illumise.wav differ diff --git a/sound/direct_sound_samples/cries/cry_ivysaur.aif b/sound/direct_sound_samples/cries/cry_ivysaur.aif deleted file mode 100644 index ea474ff88..000000000 Binary files a/sound/direct_sound_samples/cries/cry_ivysaur.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_ivysaur.wav b/sound/direct_sound_samples/cries/cry_ivysaur.wav new file mode 100644 index 000000000..1110a6338 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_ivysaur.wav differ diff --git a/sound/direct_sound_samples/cries/cry_jigglypuff.aif b/sound/direct_sound_samples/cries/cry_jigglypuff.aif deleted file mode 100644 index 780424b4f..000000000 Binary files a/sound/direct_sound_samples/cries/cry_jigglypuff.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_jigglypuff.wav b/sound/direct_sound_samples/cries/cry_jigglypuff.wav new file mode 100644 index 000000000..4b8d4ccc8 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_jigglypuff.wav differ diff --git a/sound/direct_sound_samples/cries/cry_jirachi.aif b/sound/direct_sound_samples/cries/cry_jirachi.aif deleted file mode 100644 index ea8a5c8ad..000000000 Binary files a/sound/direct_sound_samples/cries/cry_jirachi.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_jirachi.wav b/sound/direct_sound_samples/cries/cry_jirachi.wav new file mode 100644 index 000000000..f548e50bf Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_jirachi.wav differ diff --git a/sound/direct_sound_samples/cries/cry_jolteon.aif b/sound/direct_sound_samples/cries/cry_jolteon.aif deleted file mode 100644 index 013369158..000000000 Binary files a/sound/direct_sound_samples/cries/cry_jolteon.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_jolteon.wav b/sound/direct_sound_samples/cries/cry_jolteon.wav new file mode 100644 index 000000000..61b5cb160 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_jolteon.wav differ diff --git a/sound/direct_sound_samples/cries/cry_jumpluff.aif b/sound/direct_sound_samples/cries/cry_jumpluff.aif deleted file mode 100644 index 13b0fd315..000000000 Binary files a/sound/direct_sound_samples/cries/cry_jumpluff.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_jumpluff.wav b/sound/direct_sound_samples/cries/cry_jumpluff.wav new file mode 100644 index 000000000..d58b0b11f Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_jumpluff.wav differ diff --git a/sound/direct_sound_samples/cries/cry_jynx.aif b/sound/direct_sound_samples/cries/cry_jynx.aif deleted file mode 100644 index 7394a48a2..000000000 Binary files a/sound/direct_sound_samples/cries/cry_jynx.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_jynx.wav b/sound/direct_sound_samples/cries/cry_jynx.wav new file mode 100644 index 000000000..bb833749e Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_jynx.wav differ diff --git a/sound/direct_sound_samples/cries/cry_kabuto.aif b/sound/direct_sound_samples/cries/cry_kabuto.aif deleted file mode 100644 index 6ae9801b5..000000000 Binary files a/sound/direct_sound_samples/cries/cry_kabuto.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_kabuto.wav b/sound/direct_sound_samples/cries/cry_kabuto.wav new file mode 100644 index 000000000..598845740 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_kabuto.wav differ diff --git a/sound/direct_sound_samples/cries/cry_kabutops.aif b/sound/direct_sound_samples/cries/cry_kabutops.aif deleted file mode 100644 index f23778e57..000000000 Binary files a/sound/direct_sound_samples/cries/cry_kabutops.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_kabutops.wav b/sound/direct_sound_samples/cries/cry_kabutops.wav new file mode 100644 index 000000000..a9ccbfe09 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_kabutops.wav differ diff --git a/sound/direct_sound_samples/cries/cry_kadabra.aif b/sound/direct_sound_samples/cries/cry_kadabra.aif deleted file mode 100644 index bfcc18031..000000000 Binary files a/sound/direct_sound_samples/cries/cry_kadabra.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_kadabra.wav b/sound/direct_sound_samples/cries/cry_kadabra.wav new file mode 100644 index 000000000..f2e3788e4 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_kadabra.wav differ diff --git a/sound/direct_sound_samples/cries/cry_kakuna.aif b/sound/direct_sound_samples/cries/cry_kakuna.aif deleted file mode 100644 index 7c4e9d7a8..000000000 Binary files a/sound/direct_sound_samples/cries/cry_kakuna.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_kakuna.wav b/sound/direct_sound_samples/cries/cry_kakuna.wav new file mode 100644 index 000000000..0a7b43f94 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_kakuna.wav differ diff --git a/sound/direct_sound_samples/cries/cry_kangaskhan.aif b/sound/direct_sound_samples/cries/cry_kangaskhan.aif deleted file mode 100644 index 643e81eb7..000000000 Binary files a/sound/direct_sound_samples/cries/cry_kangaskhan.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_kangaskhan.wav b/sound/direct_sound_samples/cries/cry_kangaskhan.wav new file mode 100644 index 000000000..32a12fcbc Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_kangaskhan.wav differ diff --git a/sound/direct_sound_samples/cries/cry_kecleon.aif b/sound/direct_sound_samples/cries/cry_kecleon.aif deleted file mode 100644 index f27ae1832..000000000 Binary files a/sound/direct_sound_samples/cries/cry_kecleon.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_kecleon.wav b/sound/direct_sound_samples/cries/cry_kecleon.wav new file mode 100644 index 000000000..5d16ee144 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_kecleon.wav differ diff --git a/sound/direct_sound_samples/cries/cry_kingdra.aif b/sound/direct_sound_samples/cries/cry_kingdra.aif deleted file mode 100644 index ade230c82..000000000 Binary files a/sound/direct_sound_samples/cries/cry_kingdra.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_kingdra.wav b/sound/direct_sound_samples/cries/cry_kingdra.wav new file mode 100644 index 000000000..2263e72cb Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_kingdra.wav differ diff --git a/sound/direct_sound_samples/cries/cry_kingler.aif b/sound/direct_sound_samples/cries/cry_kingler.aif deleted file mode 100644 index a1d845f45..000000000 Binary files a/sound/direct_sound_samples/cries/cry_kingler.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_kingler.wav b/sound/direct_sound_samples/cries/cry_kingler.wav new file mode 100644 index 000000000..6d3f58e8c Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_kingler.wav differ diff --git a/sound/direct_sound_samples/cries/cry_kirlia.aif b/sound/direct_sound_samples/cries/cry_kirlia.aif deleted file mode 100644 index 692e03e5f..000000000 Binary files a/sound/direct_sound_samples/cries/cry_kirlia.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_kirlia.wav b/sound/direct_sound_samples/cries/cry_kirlia.wav new file mode 100644 index 000000000..36706ca6f Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_kirlia.wav differ diff --git a/sound/direct_sound_samples/cries/cry_koffing.aif b/sound/direct_sound_samples/cries/cry_koffing.aif deleted file mode 100644 index 7ca9de088..000000000 Binary files a/sound/direct_sound_samples/cries/cry_koffing.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_koffing.wav b/sound/direct_sound_samples/cries/cry_koffing.wav new file mode 100644 index 000000000..5fd7b7d4a Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_koffing.wav differ diff --git a/sound/direct_sound_samples/cries/cry_krabby.aif b/sound/direct_sound_samples/cries/cry_krabby.aif deleted file mode 100644 index 6b7692f21..000000000 Binary files a/sound/direct_sound_samples/cries/cry_krabby.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_krabby.wav b/sound/direct_sound_samples/cries/cry_krabby.wav new file mode 100644 index 000000000..31644bacc Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_krabby.wav differ diff --git a/sound/direct_sound_samples/cries/cry_kyogre.aif b/sound/direct_sound_samples/cries/cry_kyogre.aif deleted file mode 100644 index 290948319..000000000 Binary files a/sound/direct_sound_samples/cries/cry_kyogre.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_kyogre.wav b/sound/direct_sound_samples/cries/cry_kyogre.wav new file mode 100644 index 000000000..d73951bb6 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_kyogre.wav differ diff --git a/sound/direct_sound_samples/cries/cry_lairon.aif b/sound/direct_sound_samples/cries/cry_lairon.aif deleted file mode 100644 index b487165bf..000000000 Binary files a/sound/direct_sound_samples/cries/cry_lairon.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_lairon.wav b/sound/direct_sound_samples/cries/cry_lairon.wav new file mode 100644 index 000000000..1d82d0654 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_lairon.wav differ diff --git a/sound/direct_sound_samples/cries/cry_lanturn.aif b/sound/direct_sound_samples/cries/cry_lanturn.aif deleted file mode 100644 index dfeac1fbd..000000000 Binary files a/sound/direct_sound_samples/cries/cry_lanturn.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_lanturn.wav b/sound/direct_sound_samples/cries/cry_lanturn.wav new file mode 100644 index 000000000..3b68f58ad Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_lanturn.wav differ diff --git a/sound/direct_sound_samples/cries/cry_lapras.aif b/sound/direct_sound_samples/cries/cry_lapras.aif deleted file mode 100644 index 61de32408..000000000 Binary files a/sound/direct_sound_samples/cries/cry_lapras.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_lapras.wav b/sound/direct_sound_samples/cries/cry_lapras.wav new file mode 100644 index 000000000..2c0714995 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_lapras.wav differ diff --git a/sound/direct_sound_samples/cries/cry_larvitar.aif b/sound/direct_sound_samples/cries/cry_larvitar.aif deleted file mode 100644 index 1ab0e1d5f..000000000 Binary files a/sound/direct_sound_samples/cries/cry_larvitar.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_larvitar.wav b/sound/direct_sound_samples/cries/cry_larvitar.wav new file mode 100644 index 000000000..6ef5d4566 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_larvitar.wav differ diff --git a/sound/direct_sound_samples/cries/cry_latias.aif b/sound/direct_sound_samples/cries/cry_latias.aif deleted file mode 100644 index 46f7235f3..000000000 Binary files a/sound/direct_sound_samples/cries/cry_latias.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_latias.wav b/sound/direct_sound_samples/cries/cry_latias.wav new file mode 100644 index 000000000..dac6c463f Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_latias.wav differ diff --git a/sound/direct_sound_samples/cries/cry_latios.aif b/sound/direct_sound_samples/cries/cry_latios.aif deleted file mode 100644 index b8ace2a30..000000000 Binary files a/sound/direct_sound_samples/cries/cry_latios.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_latios.wav b/sound/direct_sound_samples/cries/cry_latios.wav new file mode 100644 index 000000000..f07efb29f Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_latios.wav differ diff --git a/sound/direct_sound_samples/cries/cry_ledian.aif b/sound/direct_sound_samples/cries/cry_ledian.aif deleted file mode 100644 index baefb5fa3..000000000 Binary files a/sound/direct_sound_samples/cries/cry_ledian.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_ledian.wav b/sound/direct_sound_samples/cries/cry_ledian.wav new file mode 100644 index 000000000..075bb15f0 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_ledian.wav differ diff --git a/sound/direct_sound_samples/cries/cry_ledyba.aif b/sound/direct_sound_samples/cries/cry_ledyba.aif deleted file mode 100644 index 4f26859a7..000000000 Binary files a/sound/direct_sound_samples/cries/cry_ledyba.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_ledyba.wav b/sound/direct_sound_samples/cries/cry_ledyba.wav new file mode 100644 index 000000000..95d9dff2e Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_ledyba.wav differ diff --git a/sound/direct_sound_samples/cries/cry_lickitung.aif b/sound/direct_sound_samples/cries/cry_lickitung.aif deleted file mode 100644 index ef889a275..000000000 Binary files a/sound/direct_sound_samples/cries/cry_lickitung.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_lickitung.wav b/sound/direct_sound_samples/cries/cry_lickitung.wav new file mode 100644 index 000000000..a55baecbd Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_lickitung.wav differ diff --git a/sound/direct_sound_samples/cries/cry_lileep.aif b/sound/direct_sound_samples/cries/cry_lileep.aif deleted file mode 100644 index ed8258eb7..000000000 Binary files a/sound/direct_sound_samples/cries/cry_lileep.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_lileep.wav b/sound/direct_sound_samples/cries/cry_lileep.wav new file mode 100644 index 000000000..5fd0ba803 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_lileep.wav differ diff --git a/sound/direct_sound_samples/cries/cry_linoone.aif b/sound/direct_sound_samples/cries/cry_linoone.aif deleted file mode 100644 index 4e5e7d3b5..000000000 Binary files a/sound/direct_sound_samples/cries/cry_linoone.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_linoone.wav b/sound/direct_sound_samples/cries/cry_linoone.wav new file mode 100644 index 000000000..a182b4f32 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_linoone.wav differ diff --git a/sound/direct_sound_samples/cries/cry_lombre.aif b/sound/direct_sound_samples/cries/cry_lombre.aif deleted file mode 100644 index abafe4321..000000000 Binary files a/sound/direct_sound_samples/cries/cry_lombre.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_lombre.wav b/sound/direct_sound_samples/cries/cry_lombre.wav new file mode 100644 index 000000000..f7c36acdd Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_lombre.wav differ diff --git a/sound/direct_sound_samples/cries/cry_lotad.aif b/sound/direct_sound_samples/cries/cry_lotad.aif deleted file mode 100644 index 2596f4390..000000000 Binary files a/sound/direct_sound_samples/cries/cry_lotad.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_lotad.wav b/sound/direct_sound_samples/cries/cry_lotad.wav new file mode 100644 index 000000000..ee0cb6f69 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_lotad.wav differ diff --git a/sound/direct_sound_samples/cries/cry_loudred.aif b/sound/direct_sound_samples/cries/cry_loudred.aif deleted file mode 100644 index fed7ebec8..000000000 Binary files a/sound/direct_sound_samples/cries/cry_loudred.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_loudred.wav b/sound/direct_sound_samples/cries/cry_loudred.wav new file mode 100644 index 000000000..06495bf49 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_loudred.wav differ diff --git a/sound/direct_sound_samples/cries/cry_ludicolo.aif b/sound/direct_sound_samples/cries/cry_ludicolo.aif deleted file mode 100644 index 7cf670f38..000000000 Binary files a/sound/direct_sound_samples/cries/cry_ludicolo.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_ludicolo.wav b/sound/direct_sound_samples/cries/cry_ludicolo.wav new file mode 100644 index 000000000..fa300674f Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_ludicolo.wav differ diff --git a/sound/direct_sound_samples/cries/cry_lugia.aif b/sound/direct_sound_samples/cries/cry_lugia.aif deleted file mode 100644 index 45890a2fc..000000000 Binary files a/sound/direct_sound_samples/cries/cry_lugia.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_lugia.wav b/sound/direct_sound_samples/cries/cry_lugia.wav new file mode 100644 index 000000000..1a1c46ef4 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_lugia.wav differ diff --git a/sound/direct_sound_samples/cries/cry_lunatone.aif b/sound/direct_sound_samples/cries/cry_lunatone.aif deleted file mode 100644 index 42cbc5e3c..000000000 Binary files a/sound/direct_sound_samples/cries/cry_lunatone.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_lunatone.wav b/sound/direct_sound_samples/cries/cry_lunatone.wav new file mode 100644 index 000000000..afd9473b8 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_lunatone.wav differ diff --git a/sound/direct_sound_samples/cries/cry_luvdisc.aif b/sound/direct_sound_samples/cries/cry_luvdisc.aif deleted file mode 100644 index 3cc0cc744..000000000 Binary files a/sound/direct_sound_samples/cries/cry_luvdisc.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_luvdisc.wav b/sound/direct_sound_samples/cries/cry_luvdisc.wav new file mode 100644 index 000000000..c4261d76e Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_luvdisc.wav differ diff --git a/sound/direct_sound_samples/cries/cry_machamp.aif b/sound/direct_sound_samples/cries/cry_machamp.aif deleted file mode 100644 index ddeaf22c8..000000000 Binary files a/sound/direct_sound_samples/cries/cry_machamp.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_machamp.wav b/sound/direct_sound_samples/cries/cry_machamp.wav new file mode 100644 index 000000000..9535dcbab Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_machamp.wav differ diff --git a/sound/direct_sound_samples/cries/cry_machoke.aif b/sound/direct_sound_samples/cries/cry_machoke.aif deleted file mode 100644 index 97065ee09..000000000 Binary files a/sound/direct_sound_samples/cries/cry_machoke.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_machoke.wav b/sound/direct_sound_samples/cries/cry_machoke.wav new file mode 100644 index 000000000..de76612e3 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_machoke.wav differ diff --git a/sound/direct_sound_samples/cries/cry_machop.aif b/sound/direct_sound_samples/cries/cry_machop.aif deleted file mode 100644 index d92419e84..000000000 Binary files a/sound/direct_sound_samples/cries/cry_machop.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_machop.wav b/sound/direct_sound_samples/cries/cry_machop.wav new file mode 100644 index 000000000..2e5af3e55 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_machop.wav differ diff --git a/sound/direct_sound_samples/cries/cry_magby.aif b/sound/direct_sound_samples/cries/cry_magby.aif deleted file mode 100644 index 12f3dc889..000000000 Binary files a/sound/direct_sound_samples/cries/cry_magby.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_magby.wav b/sound/direct_sound_samples/cries/cry_magby.wav new file mode 100644 index 000000000..c8129db69 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_magby.wav differ diff --git a/sound/direct_sound_samples/cries/cry_magcargo.aif b/sound/direct_sound_samples/cries/cry_magcargo.aif deleted file mode 100644 index bef0351c0..000000000 Binary files a/sound/direct_sound_samples/cries/cry_magcargo.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_magcargo.wav b/sound/direct_sound_samples/cries/cry_magcargo.wav new file mode 100644 index 000000000..1bdd97d3b Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_magcargo.wav differ diff --git a/sound/direct_sound_samples/cries/cry_magikarp.aif b/sound/direct_sound_samples/cries/cry_magikarp.aif deleted file mode 100644 index f4f9219c5..000000000 Binary files a/sound/direct_sound_samples/cries/cry_magikarp.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_magikarp.wav b/sound/direct_sound_samples/cries/cry_magikarp.wav new file mode 100644 index 000000000..115fa23f2 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_magikarp.wav differ diff --git a/sound/direct_sound_samples/cries/cry_magmar.aif b/sound/direct_sound_samples/cries/cry_magmar.aif deleted file mode 100644 index b79c8b9a1..000000000 Binary files a/sound/direct_sound_samples/cries/cry_magmar.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_magmar.wav b/sound/direct_sound_samples/cries/cry_magmar.wav new file mode 100644 index 000000000..6a3621c3c Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_magmar.wav differ diff --git a/sound/direct_sound_samples/cries/cry_magnemite.aif b/sound/direct_sound_samples/cries/cry_magnemite.aif deleted file mode 100644 index ebb9103d9..000000000 Binary files a/sound/direct_sound_samples/cries/cry_magnemite.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_magnemite.wav b/sound/direct_sound_samples/cries/cry_magnemite.wav new file mode 100644 index 000000000..7dd1d550b Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_magnemite.wav differ diff --git a/sound/direct_sound_samples/cries/cry_magneton.aif b/sound/direct_sound_samples/cries/cry_magneton.aif deleted file mode 100644 index 53083ac62..000000000 Binary files a/sound/direct_sound_samples/cries/cry_magneton.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_magneton.wav b/sound/direct_sound_samples/cries/cry_magneton.wav new file mode 100644 index 000000000..12513343d Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_magneton.wav differ diff --git a/sound/direct_sound_samples/cries/cry_makuhita.aif b/sound/direct_sound_samples/cries/cry_makuhita.aif deleted file mode 100644 index 38d7f4b44..000000000 Binary files a/sound/direct_sound_samples/cries/cry_makuhita.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_makuhita.wav b/sound/direct_sound_samples/cries/cry_makuhita.wav new file mode 100644 index 000000000..6df74f2c1 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_makuhita.wav differ diff --git a/sound/direct_sound_samples/cries/cry_manectric.aif b/sound/direct_sound_samples/cries/cry_manectric.aif deleted file mode 100644 index 18a8f4666..000000000 Binary files a/sound/direct_sound_samples/cries/cry_manectric.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_manectric.wav b/sound/direct_sound_samples/cries/cry_manectric.wav new file mode 100644 index 000000000..db806c46a Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_manectric.wav differ diff --git a/sound/direct_sound_samples/cries/cry_mankey.aif b/sound/direct_sound_samples/cries/cry_mankey.aif deleted file mode 100644 index dda929d4c..000000000 Binary files a/sound/direct_sound_samples/cries/cry_mankey.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_mankey.wav b/sound/direct_sound_samples/cries/cry_mankey.wav new file mode 100644 index 000000000..9cf9f4866 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_mankey.wav differ diff --git a/sound/direct_sound_samples/cries/cry_mantine.aif b/sound/direct_sound_samples/cries/cry_mantine.aif deleted file mode 100644 index d1840aafa..000000000 Binary files a/sound/direct_sound_samples/cries/cry_mantine.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_mantine.wav b/sound/direct_sound_samples/cries/cry_mantine.wav new file mode 100644 index 000000000..bc6f17e5e Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_mantine.wav differ diff --git a/sound/direct_sound_samples/cries/cry_mareep.aif b/sound/direct_sound_samples/cries/cry_mareep.aif deleted file mode 100644 index 2615b9def..000000000 Binary files a/sound/direct_sound_samples/cries/cry_mareep.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_mareep.wav b/sound/direct_sound_samples/cries/cry_mareep.wav new file mode 100644 index 000000000..b0a523d7d Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_mareep.wav differ diff --git a/sound/direct_sound_samples/cries/cry_marill.aif b/sound/direct_sound_samples/cries/cry_marill.aif deleted file mode 100644 index 48d936e7d..000000000 Binary files a/sound/direct_sound_samples/cries/cry_marill.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_marill.wav b/sound/direct_sound_samples/cries/cry_marill.wav new file mode 100644 index 000000000..8842fb018 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_marill.wav differ diff --git a/sound/direct_sound_samples/cries/cry_marowak.aif b/sound/direct_sound_samples/cries/cry_marowak.aif deleted file mode 100644 index 279381bb5..000000000 Binary files a/sound/direct_sound_samples/cries/cry_marowak.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_marowak.wav b/sound/direct_sound_samples/cries/cry_marowak.wav new file mode 100644 index 000000000..6701514d2 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_marowak.wav differ diff --git a/sound/direct_sound_samples/cries/cry_marshtomp.aif b/sound/direct_sound_samples/cries/cry_marshtomp.aif deleted file mode 100644 index c0106ff6c..000000000 Binary files a/sound/direct_sound_samples/cries/cry_marshtomp.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_marshtomp.wav b/sound/direct_sound_samples/cries/cry_marshtomp.wav new file mode 100644 index 000000000..ed906f7d1 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_marshtomp.wav differ diff --git a/sound/direct_sound_samples/cries/cry_masquerain.aif b/sound/direct_sound_samples/cries/cry_masquerain.aif deleted file mode 100644 index 107bed2f7..000000000 Binary files a/sound/direct_sound_samples/cries/cry_masquerain.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_masquerain.wav b/sound/direct_sound_samples/cries/cry_masquerain.wav new file mode 100644 index 000000000..d7f5c700a Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_masquerain.wav differ diff --git a/sound/direct_sound_samples/cries/cry_mawile.aif b/sound/direct_sound_samples/cries/cry_mawile.aif deleted file mode 100644 index 81b252b57..000000000 Binary files a/sound/direct_sound_samples/cries/cry_mawile.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_mawile.wav b/sound/direct_sound_samples/cries/cry_mawile.wav new file mode 100644 index 000000000..bf0eb2e0a Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_mawile.wav differ diff --git a/sound/direct_sound_samples/cries/cry_medicham.aif b/sound/direct_sound_samples/cries/cry_medicham.aif deleted file mode 100644 index dc85dd3b5..000000000 Binary files a/sound/direct_sound_samples/cries/cry_medicham.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_medicham.wav b/sound/direct_sound_samples/cries/cry_medicham.wav new file mode 100644 index 000000000..e0853bfa7 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_medicham.wav differ diff --git a/sound/direct_sound_samples/cries/cry_meditite.aif b/sound/direct_sound_samples/cries/cry_meditite.aif deleted file mode 100644 index 8ac680f79..000000000 Binary files a/sound/direct_sound_samples/cries/cry_meditite.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_meditite.wav b/sound/direct_sound_samples/cries/cry_meditite.wav new file mode 100644 index 000000000..08675830b Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_meditite.wav differ diff --git a/sound/direct_sound_samples/cries/cry_meganium.aif b/sound/direct_sound_samples/cries/cry_meganium.aif deleted file mode 100644 index ea1e1aa51..000000000 Binary files a/sound/direct_sound_samples/cries/cry_meganium.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_meganium.wav b/sound/direct_sound_samples/cries/cry_meganium.wav new file mode 100644 index 000000000..2aaf87034 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_meganium.wav differ diff --git a/sound/direct_sound_samples/cries/cry_meowth.aif b/sound/direct_sound_samples/cries/cry_meowth.aif deleted file mode 100644 index aaf3825d5..000000000 Binary files a/sound/direct_sound_samples/cries/cry_meowth.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_meowth.wav b/sound/direct_sound_samples/cries/cry_meowth.wav new file mode 100644 index 000000000..a3b97ff95 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_meowth.wav differ diff --git a/sound/direct_sound_samples/cries/cry_metagross.aif b/sound/direct_sound_samples/cries/cry_metagross.aif deleted file mode 100644 index b96e6647c..000000000 Binary files a/sound/direct_sound_samples/cries/cry_metagross.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_metagross.wav b/sound/direct_sound_samples/cries/cry_metagross.wav new file mode 100644 index 000000000..35aa032c4 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_metagross.wav differ diff --git a/sound/direct_sound_samples/cries/cry_metang.aif b/sound/direct_sound_samples/cries/cry_metang.aif deleted file mode 100644 index da544ce4d..000000000 Binary files a/sound/direct_sound_samples/cries/cry_metang.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_metang.wav b/sound/direct_sound_samples/cries/cry_metang.wav new file mode 100644 index 000000000..d9203a330 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_metang.wav differ diff --git a/sound/direct_sound_samples/cries/cry_metapod.aif b/sound/direct_sound_samples/cries/cry_metapod.aif deleted file mode 100644 index ddba3ed44..000000000 Binary files a/sound/direct_sound_samples/cries/cry_metapod.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_metapod.wav b/sound/direct_sound_samples/cries/cry_metapod.wav new file mode 100644 index 000000000..1ef8849fc Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_metapod.wav differ diff --git a/sound/direct_sound_samples/cries/cry_mew.aif b/sound/direct_sound_samples/cries/cry_mew.aif deleted file mode 100644 index 2651b96ca..000000000 Binary files a/sound/direct_sound_samples/cries/cry_mew.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_mew.wav b/sound/direct_sound_samples/cries/cry_mew.wav new file mode 100644 index 000000000..067c71b85 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_mew.wav differ diff --git a/sound/direct_sound_samples/cries/cry_mewtwo.aif b/sound/direct_sound_samples/cries/cry_mewtwo.aif deleted file mode 100644 index 8e1e6c7f1..000000000 Binary files a/sound/direct_sound_samples/cries/cry_mewtwo.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_mewtwo.wav b/sound/direct_sound_samples/cries/cry_mewtwo.wav new file mode 100644 index 000000000..554564c04 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_mewtwo.wav differ diff --git a/sound/direct_sound_samples/cries/cry_mightyena.aif b/sound/direct_sound_samples/cries/cry_mightyena.aif deleted file mode 100644 index 53a645edc..000000000 Binary files a/sound/direct_sound_samples/cries/cry_mightyena.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_mightyena.wav b/sound/direct_sound_samples/cries/cry_mightyena.wav new file mode 100644 index 000000000..4c818b12b Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_mightyena.wav differ diff --git a/sound/direct_sound_samples/cries/cry_milotic.aif b/sound/direct_sound_samples/cries/cry_milotic.aif deleted file mode 100644 index 93a14161b..000000000 Binary files a/sound/direct_sound_samples/cries/cry_milotic.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_milotic.wav b/sound/direct_sound_samples/cries/cry_milotic.wav new file mode 100644 index 000000000..016657130 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_milotic.wav differ diff --git a/sound/direct_sound_samples/cries/cry_miltank.aif b/sound/direct_sound_samples/cries/cry_miltank.aif deleted file mode 100644 index ad8a41a45..000000000 Binary files a/sound/direct_sound_samples/cries/cry_miltank.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_miltank.wav b/sound/direct_sound_samples/cries/cry_miltank.wav new file mode 100644 index 000000000..949fd2812 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_miltank.wav differ diff --git a/sound/direct_sound_samples/cries/cry_minun.aif b/sound/direct_sound_samples/cries/cry_minun.aif deleted file mode 100644 index a55aa5631..000000000 Binary files a/sound/direct_sound_samples/cries/cry_minun.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_minun.wav b/sound/direct_sound_samples/cries/cry_minun.wav new file mode 100644 index 000000000..80d608c67 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_minun.wav differ diff --git a/sound/direct_sound_samples/cries/cry_misdreavus.aif b/sound/direct_sound_samples/cries/cry_misdreavus.aif deleted file mode 100644 index 39a09f4d0..000000000 Binary files a/sound/direct_sound_samples/cries/cry_misdreavus.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_misdreavus.wav b/sound/direct_sound_samples/cries/cry_misdreavus.wav new file mode 100644 index 000000000..cce18c27b Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_misdreavus.wav differ diff --git a/sound/direct_sound_samples/cries/cry_moltres.aif b/sound/direct_sound_samples/cries/cry_moltres.aif deleted file mode 100644 index 2e038a3d7..000000000 Binary files a/sound/direct_sound_samples/cries/cry_moltres.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_moltres.wav b/sound/direct_sound_samples/cries/cry_moltres.wav new file mode 100644 index 000000000..c9c65b334 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_moltres.wav differ diff --git a/sound/direct_sound_samples/cries/cry_mr_mime.aif b/sound/direct_sound_samples/cries/cry_mr_mime.aif deleted file mode 100644 index ff870dbc4..000000000 Binary files a/sound/direct_sound_samples/cries/cry_mr_mime.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_mr_mime.wav b/sound/direct_sound_samples/cries/cry_mr_mime.wav new file mode 100644 index 000000000..a8121159b Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_mr_mime.wav differ diff --git a/sound/direct_sound_samples/cries/cry_mudkip.aif b/sound/direct_sound_samples/cries/cry_mudkip.aif deleted file mode 100644 index e8fa5c212..000000000 Binary files a/sound/direct_sound_samples/cries/cry_mudkip.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_mudkip.wav b/sound/direct_sound_samples/cries/cry_mudkip.wav new file mode 100644 index 000000000..bcb613e41 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_mudkip.wav differ diff --git a/sound/direct_sound_samples/cries/cry_muk.aif b/sound/direct_sound_samples/cries/cry_muk.aif deleted file mode 100644 index f61ff4075..000000000 Binary files a/sound/direct_sound_samples/cries/cry_muk.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_muk.wav b/sound/direct_sound_samples/cries/cry_muk.wav new file mode 100644 index 000000000..3cb281382 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_muk.wav differ diff --git a/sound/direct_sound_samples/cries/cry_murkrow.aif b/sound/direct_sound_samples/cries/cry_murkrow.aif deleted file mode 100644 index 4beddff1e..000000000 Binary files a/sound/direct_sound_samples/cries/cry_murkrow.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_murkrow.wav b/sound/direct_sound_samples/cries/cry_murkrow.wav new file mode 100644 index 000000000..1ba1f5514 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_murkrow.wav differ diff --git a/sound/direct_sound_samples/cries/cry_natu.aif b/sound/direct_sound_samples/cries/cry_natu.aif deleted file mode 100644 index e6e38d5cc..000000000 Binary files a/sound/direct_sound_samples/cries/cry_natu.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_natu.wav b/sound/direct_sound_samples/cries/cry_natu.wav new file mode 100644 index 000000000..3cf1fc15b Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_natu.wav differ diff --git a/sound/direct_sound_samples/cries/cry_nidoking.aif b/sound/direct_sound_samples/cries/cry_nidoking.aif deleted file mode 100644 index a0c86f9ab..000000000 Binary files a/sound/direct_sound_samples/cries/cry_nidoking.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_nidoking.wav b/sound/direct_sound_samples/cries/cry_nidoking.wav new file mode 100644 index 000000000..4a068c909 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_nidoking.wav differ diff --git a/sound/direct_sound_samples/cries/cry_nidoqueen.aif b/sound/direct_sound_samples/cries/cry_nidoqueen.aif deleted file mode 100644 index 6c8f5254b..000000000 Binary files a/sound/direct_sound_samples/cries/cry_nidoqueen.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_nidoqueen.wav b/sound/direct_sound_samples/cries/cry_nidoqueen.wav new file mode 100644 index 000000000..2835f1b36 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_nidoqueen.wav differ diff --git a/sound/direct_sound_samples/cries/cry_nidoran_f.aif b/sound/direct_sound_samples/cries/cry_nidoran_f.aif deleted file mode 100644 index b7c8a5317..000000000 Binary files a/sound/direct_sound_samples/cries/cry_nidoran_f.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_nidoran_f.wav b/sound/direct_sound_samples/cries/cry_nidoran_f.wav new file mode 100644 index 000000000..3d50a6917 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_nidoran_f.wav differ diff --git a/sound/direct_sound_samples/cries/cry_nidoran_m.aif b/sound/direct_sound_samples/cries/cry_nidoran_m.aif deleted file mode 100644 index 08fc81c8b..000000000 Binary files a/sound/direct_sound_samples/cries/cry_nidoran_m.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_nidoran_m.wav b/sound/direct_sound_samples/cries/cry_nidoran_m.wav new file mode 100644 index 000000000..94fcf0e5b Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_nidoran_m.wav differ diff --git a/sound/direct_sound_samples/cries/cry_nidorina.aif b/sound/direct_sound_samples/cries/cry_nidorina.aif deleted file mode 100644 index 91e293a50..000000000 Binary files a/sound/direct_sound_samples/cries/cry_nidorina.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_nidorina.wav b/sound/direct_sound_samples/cries/cry_nidorina.wav new file mode 100644 index 000000000..a2e1aa9d6 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_nidorina.wav differ diff --git a/sound/direct_sound_samples/cries/cry_nidorino.aif b/sound/direct_sound_samples/cries/cry_nidorino.aif deleted file mode 100644 index 959351363..000000000 Binary files a/sound/direct_sound_samples/cries/cry_nidorino.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_nidorino.wav b/sound/direct_sound_samples/cries/cry_nidorino.wav new file mode 100644 index 000000000..f4dea729c Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_nidorino.wav differ diff --git a/sound/direct_sound_samples/cries/cry_nincada.aif b/sound/direct_sound_samples/cries/cry_nincada.aif deleted file mode 100644 index 5f96bda50..000000000 Binary files a/sound/direct_sound_samples/cries/cry_nincada.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_nincada.wav b/sound/direct_sound_samples/cries/cry_nincada.wav new file mode 100644 index 000000000..ec9b88858 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_nincada.wav differ diff --git a/sound/direct_sound_samples/cries/cry_ninetales.aif b/sound/direct_sound_samples/cries/cry_ninetales.aif deleted file mode 100644 index 70c8cf528..000000000 Binary files a/sound/direct_sound_samples/cries/cry_ninetales.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_ninetales.wav b/sound/direct_sound_samples/cries/cry_ninetales.wav new file mode 100644 index 000000000..0e5939ed2 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_ninetales.wav differ diff --git a/sound/direct_sound_samples/cries/cry_ninjask.aif b/sound/direct_sound_samples/cries/cry_ninjask.aif deleted file mode 100644 index a6f07e8d3..000000000 Binary files a/sound/direct_sound_samples/cries/cry_ninjask.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_ninjask.wav b/sound/direct_sound_samples/cries/cry_ninjask.wav new file mode 100644 index 000000000..20b496bc3 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_ninjask.wav differ diff --git a/sound/direct_sound_samples/cries/cry_noctowl.aif b/sound/direct_sound_samples/cries/cry_noctowl.aif deleted file mode 100644 index fe2e63d45..000000000 Binary files a/sound/direct_sound_samples/cries/cry_noctowl.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_noctowl.wav b/sound/direct_sound_samples/cries/cry_noctowl.wav new file mode 100644 index 000000000..64f38a044 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_noctowl.wav differ diff --git a/sound/direct_sound_samples/cries/cry_none.aif b/sound/direct_sound_samples/cries/cry_none.aif deleted file mode 100644 index 44bb79c3c..000000000 Binary files a/sound/direct_sound_samples/cries/cry_none.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_nosepass.aif b/sound/direct_sound_samples/cries/cry_nosepass.aif deleted file mode 100644 index be65ba082..000000000 Binary files a/sound/direct_sound_samples/cries/cry_nosepass.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_nosepass.wav b/sound/direct_sound_samples/cries/cry_nosepass.wav new file mode 100644 index 000000000..996cfbe7d Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_nosepass.wav differ diff --git a/sound/direct_sound_samples/cries/cry_numel.aif b/sound/direct_sound_samples/cries/cry_numel.aif deleted file mode 100644 index 55cce5f2c..000000000 Binary files a/sound/direct_sound_samples/cries/cry_numel.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_numel.wav b/sound/direct_sound_samples/cries/cry_numel.wav new file mode 100644 index 000000000..a0ae3ebd8 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_numel.wav differ diff --git a/sound/direct_sound_samples/cries/cry_nuzleaf.aif b/sound/direct_sound_samples/cries/cry_nuzleaf.aif deleted file mode 100644 index d668f3fd3..000000000 Binary files a/sound/direct_sound_samples/cries/cry_nuzleaf.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_nuzleaf.wav b/sound/direct_sound_samples/cries/cry_nuzleaf.wav new file mode 100644 index 000000000..60d0809ef Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_nuzleaf.wav differ diff --git a/sound/direct_sound_samples/cries/cry_octillery.aif b/sound/direct_sound_samples/cries/cry_octillery.aif deleted file mode 100644 index 75ee28ceb..000000000 Binary files a/sound/direct_sound_samples/cries/cry_octillery.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_octillery.wav b/sound/direct_sound_samples/cries/cry_octillery.wav new file mode 100644 index 000000000..11bc1361d Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_octillery.wav differ diff --git a/sound/direct_sound_samples/cries/cry_oddish.aif b/sound/direct_sound_samples/cries/cry_oddish.aif deleted file mode 100644 index 6909a8dad..000000000 Binary files a/sound/direct_sound_samples/cries/cry_oddish.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_oddish.wav b/sound/direct_sound_samples/cries/cry_oddish.wav new file mode 100644 index 000000000..bffae4bcf Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_oddish.wav differ diff --git a/sound/direct_sound_samples/cries/cry_omanyte.aif b/sound/direct_sound_samples/cries/cry_omanyte.aif deleted file mode 100644 index 15ec2d1ef..000000000 Binary files a/sound/direct_sound_samples/cries/cry_omanyte.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_omanyte.wav b/sound/direct_sound_samples/cries/cry_omanyte.wav new file mode 100644 index 000000000..46e47b0a2 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_omanyte.wav differ diff --git a/sound/direct_sound_samples/cries/cry_omastar.aif b/sound/direct_sound_samples/cries/cry_omastar.aif deleted file mode 100644 index e67d5d7fc..000000000 Binary files a/sound/direct_sound_samples/cries/cry_omastar.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_omastar.wav b/sound/direct_sound_samples/cries/cry_omastar.wav new file mode 100644 index 000000000..021355da9 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_omastar.wav differ diff --git a/sound/direct_sound_samples/cries/cry_onix.aif b/sound/direct_sound_samples/cries/cry_onix.aif deleted file mode 100644 index aa8a16505..000000000 Binary files a/sound/direct_sound_samples/cries/cry_onix.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_onix.wav b/sound/direct_sound_samples/cries/cry_onix.wav new file mode 100644 index 000000000..f0dd1f45e Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_onix.wav differ diff --git a/sound/direct_sound_samples/cries/cry_paras.aif b/sound/direct_sound_samples/cries/cry_paras.aif deleted file mode 100644 index f9d69c21c..000000000 Binary files a/sound/direct_sound_samples/cries/cry_paras.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_paras.wav b/sound/direct_sound_samples/cries/cry_paras.wav new file mode 100644 index 000000000..27101a52f Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_paras.wav differ diff --git a/sound/direct_sound_samples/cries/cry_parasect.aif b/sound/direct_sound_samples/cries/cry_parasect.aif deleted file mode 100644 index d6d9433e9..000000000 Binary files a/sound/direct_sound_samples/cries/cry_parasect.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_parasect.wav b/sound/direct_sound_samples/cries/cry_parasect.wav new file mode 100644 index 000000000..909803da7 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_parasect.wav differ diff --git a/sound/direct_sound_samples/cries/cry_pelipper.aif b/sound/direct_sound_samples/cries/cry_pelipper.aif deleted file mode 100644 index 26718f848..000000000 Binary files a/sound/direct_sound_samples/cries/cry_pelipper.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_pelipper.wav b/sound/direct_sound_samples/cries/cry_pelipper.wav new file mode 100644 index 000000000..5af1e7998 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_pelipper.wav differ diff --git a/sound/direct_sound_samples/cries/cry_persian.aif b/sound/direct_sound_samples/cries/cry_persian.aif deleted file mode 100644 index 40b3a2c56..000000000 Binary files a/sound/direct_sound_samples/cries/cry_persian.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_persian.wav b/sound/direct_sound_samples/cries/cry_persian.wav new file mode 100644 index 000000000..890089a51 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_persian.wav differ diff --git a/sound/direct_sound_samples/cries/cry_phanpy.aif b/sound/direct_sound_samples/cries/cry_phanpy.aif deleted file mode 100644 index 2fcab3c82..000000000 Binary files a/sound/direct_sound_samples/cries/cry_phanpy.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_phanpy.wav b/sound/direct_sound_samples/cries/cry_phanpy.wav new file mode 100644 index 000000000..dcd679342 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_phanpy.wav differ diff --git a/sound/direct_sound_samples/cries/cry_pichu.aif b/sound/direct_sound_samples/cries/cry_pichu.aif deleted file mode 100644 index de47bbab8..000000000 Binary files a/sound/direct_sound_samples/cries/cry_pichu.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_pichu.wav b/sound/direct_sound_samples/cries/cry_pichu.wav new file mode 100644 index 000000000..cfbbb6adb Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_pichu.wav differ diff --git a/sound/direct_sound_samples/cries/cry_pidgeot.aif b/sound/direct_sound_samples/cries/cry_pidgeot.aif deleted file mode 100644 index af400cdc6..000000000 Binary files a/sound/direct_sound_samples/cries/cry_pidgeot.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_pidgeot.wav b/sound/direct_sound_samples/cries/cry_pidgeot.wav new file mode 100644 index 000000000..d56e2e559 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_pidgeot.wav differ diff --git a/sound/direct_sound_samples/cries/cry_pidgeotto.aif b/sound/direct_sound_samples/cries/cry_pidgeotto.aif deleted file mode 100644 index 7c71c8f3e..000000000 Binary files a/sound/direct_sound_samples/cries/cry_pidgeotto.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_pidgeotto.wav b/sound/direct_sound_samples/cries/cry_pidgeotto.wav new file mode 100644 index 000000000..b8d075754 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_pidgeotto.wav differ diff --git a/sound/direct_sound_samples/cries/cry_pidgey.aif b/sound/direct_sound_samples/cries/cry_pidgey.aif deleted file mode 100644 index b9c3a5d2a..000000000 Binary files a/sound/direct_sound_samples/cries/cry_pidgey.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_pidgey.wav b/sound/direct_sound_samples/cries/cry_pidgey.wav new file mode 100644 index 000000000..5b58ae59b Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_pidgey.wav differ diff --git a/sound/direct_sound_samples/cries/cry_pikachu.aif b/sound/direct_sound_samples/cries/cry_pikachu.aif deleted file mode 100644 index 690bf5e1d..000000000 Binary files a/sound/direct_sound_samples/cries/cry_pikachu.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_pikachu.wav b/sound/direct_sound_samples/cries/cry_pikachu.wav new file mode 100644 index 000000000..dc1d354c8 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_pikachu.wav differ diff --git a/sound/direct_sound_samples/cries/cry_piloswine.aif b/sound/direct_sound_samples/cries/cry_piloswine.aif deleted file mode 100644 index b1f34d3b5..000000000 Binary files a/sound/direct_sound_samples/cries/cry_piloswine.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_piloswine.wav b/sound/direct_sound_samples/cries/cry_piloswine.wav new file mode 100644 index 000000000..f28be1f9b Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_piloswine.wav differ diff --git a/sound/direct_sound_samples/cries/cry_pineco.aif b/sound/direct_sound_samples/cries/cry_pineco.aif deleted file mode 100644 index 80292bda0..000000000 Binary files a/sound/direct_sound_samples/cries/cry_pineco.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_pineco.wav b/sound/direct_sound_samples/cries/cry_pineco.wav new file mode 100644 index 000000000..cfaf5b9ee Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_pineco.wav differ diff --git a/sound/direct_sound_samples/cries/cry_pinsir.aif b/sound/direct_sound_samples/cries/cry_pinsir.aif deleted file mode 100644 index cf27a11de..000000000 Binary files a/sound/direct_sound_samples/cries/cry_pinsir.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_pinsir.wav b/sound/direct_sound_samples/cries/cry_pinsir.wav new file mode 100644 index 000000000..76ac8fa15 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_pinsir.wav differ diff --git a/sound/direct_sound_samples/cries/cry_plusle.aif b/sound/direct_sound_samples/cries/cry_plusle.aif deleted file mode 100644 index d68984263..000000000 Binary files a/sound/direct_sound_samples/cries/cry_plusle.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_plusle.wav b/sound/direct_sound_samples/cries/cry_plusle.wav new file mode 100644 index 000000000..dcbe5fdd0 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_plusle.wav differ diff --git a/sound/direct_sound_samples/cries/cry_politoed.aif b/sound/direct_sound_samples/cries/cry_politoed.aif deleted file mode 100644 index 38b1883b4..000000000 Binary files a/sound/direct_sound_samples/cries/cry_politoed.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_politoed.wav b/sound/direct_sound_samples/cries/cry_politoed.wav new file mode 100644 index 000000000..9a90e1785 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_politoed.wav differ diff --git a/sound/direct_sound_samples/cries/cry_poliwag.aif b/sound/direct_sound_samples/cries/cry_poliwag.aif deleted file mode 100644 index 8467f0540..000000000 Binary files a/sound/direct_sound_samples/cries/cry_poliwag.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_poliwag.wav b/sound/direct_sound_samples/cries/cry_poliwag.wav new file mode 100644 index 000000000..64fe686c9 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_poliwag.wav differ diff --git a/sound/direct_sound_samples/cries/cry_poliwhirl.aif b/sound/direct_sound_samples/cries/cry_poliwhirl.aif deleted file mode 100644 index f0851c693..000000000 Binary files a/sound/direct_sound_samples/cries/cry_poliwhirl.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_poliwhirl.wav b/sound/direct_sound_samples/cries/cry_poliwhirl.wav new file mode 100644 index 000000000..924bb457c Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_poliwhirl.wav differ diff --git a/sound/direct_sound_samples/cries/cry_poliwrath.aif b/sound/direct_sound_samples/cries/cry_poliwrath.aif deleted file mode 100644 index 8d19f1d86..000000000 Binary files a/sound/direct_sound_samples/cries/cry_poliwrath.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_poliwrath.wav b/sound/direct_sound_samples/cries/cry_poliwrath.wav new file mode 100644 index 000000000..93afcf2b6 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_poliwrath.wav differ diff --git a/sound/direct_sound_samples/cries/cry_ponyta.aif b/sound/direct_sound_samples/cries/cry_ponyta.aif deleted file mode 100644 index 46feb123d..000000000 Binary files a/sound/direct_sound_samples/cries/cry_ponyta.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_ponyta.wav b/sound/direct_sound_samples/cries/cry_ponyta.wav new file mode 100644 index 000000000..bfa5b06ef Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_ponyta.wav differ diff --git a/sound/direct_sound_samples/cries/cry_poochyena.aif b/sound/direct_sound_samples/cries/cry_poochyena.aif deleted file mode 100644 index 3b464ce13..000000000 Binary files a/sound/direct_sound_samples/cries/cry_poochyena.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_poochyena.wav b/sound/direct_sound_samples/cries/cry_poochyena.wav new file mode 100644 index 000000000..8d46225c5 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_poochyena.wav differ diff --git a/sound/direct_sound_samples/cries/cry_porygon.aif b/sound/direct_sound_samples/cries/cry_porygon.aif deleted file mode 100644 index ced70b379..000000000 Binary files a/sound/direct_sound_samples/cries/cry_porygon.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_porygon.wav b/sound/direct_sound_samples/cries/cry_porygon.wav new file mode 100644 index 000000000..48c43c2db Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_porygon.wav differ diff --git a/sound/direct_sound_samples/cries/cry_porygon2.aif b/sound/direct_sound_samples/cries/cry_porygon2.aif deleted file mode 100644 index c08a3caaf..000000000 Binary files a/sound/direct_sound_samples/cries/cry_porygon2.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_porygon2.wav b/sound/direct_sound_samples/cries/cry_porygon2.wav new file mode 100644 index 000000000..965c1b703 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_porygon2.wav differ diff --git a/sound/direct_sound_samples/cries/cry_primeape.aif b/sound/direct_sound_samples/cries/cry_primeape.aif deleted file mode 100644 index a868b3120..000000000 Binary files a/sound/direct_sound_samples/cries/cry_primeape.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_primeape.wav b/sound/direct_sound_samples/cries/cry_primeape.wav new file mode 100644 index 000000000..146e92407 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_primeape.wav differ diff --git a/sound/direct_sound_samples/cries/cry_psyduck.aif b/sound/direct_sound_samples/cries/cry_psyduck.aif deleted file mode 100644 index d2d0612f2..000000000 Binary files a/sound/direct_sound_samples/cries/cry_psyduck.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_psyduck.wav b/sound/direct_sound_samples/cries/cry_psyduck.wav new file mode 100644 index 000000000..7b1a76da7 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_psyduck.wav differ diff --git a/sound/direct_sound_samples/cries/cry_pupitar.aif b/sound/direct_sound_samples/cries/cry_pupitar.aif deleted file mode 100644 index 7386636ce..000000000 Binary files a/sound/direct_sound_samples/cries/cry_pupitar.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_pupitar.wav b/sound/direct_sound_samples/cries/cry_pupitar.wav new file mode 100644 index 000000000..776896729 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_pupitar.wav differ diff --git a/sound/direct_sound_samples/cries/cry_quagsire.aif b/sound/direct_sound_samples/cries/cry_quagsire.aif deleted file mode 100644 index 1953d0e42..000000000 Binary files a/sound/direct_sound_samples/cries/cry_quagsire.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_quagsire.wav b/sound/direct_sound_samples/cries/cry_quagsire.wav new file mode 100644 index 000000000..116c1bdf4 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_quagsire.wav differ diff --git a/sound/direct_sound_samples/cries/cry_quilava.aif b/sound/direct_sound_samples/cries/cry_quilava.aif deleted file mode 100644 index efe873229..000000000 Binary files a/sound/direct_sound_samples/cries/cry_quilava.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_quilava.wav b/sound/direct_sound_samples/cries/cry_quilava.wav new file mode 100644 index 000000000..5b44632ec Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_quilava.wav differ diff --git a/sound/direct_sound_samples/cries/cry_qwilfish.aif b/sound/direct_sound_samples/cries/cry_qwilfish.aif deleted file mode 100644 index 268c5c89d..000000000 Binary files a/sound/direct_sound_samples/cries/cry_qwilfish.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_qwilfish.wav b/sound/direct_sound_samples/cries/cry_qwilfish.wav new file mode 100644 index 000000000..1f857d2c2 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_qwilfish.wav differ diff --git a/sound/direct_sound_samples/cries/cry_raichu.aif b/sound/direct_sound_samples/cries/cry_raichu.aif deleted file mode 100644 index e59ffbad4..000000000 Binary files a/sound/direct_sound_samples/cries/cry_raichu.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_raichu.wav b/sound/direct_sound_samples/cries/cry_raichu.wav new file mode 100644 index 000000000..7b93bb5a3 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_raichu.wav differ diff --git a/sound/direct_sound_samples/cries/cry_raikou.aif b/sound/direct_sound_samples/cries/cry_raikou.aif deleted file mode 100644 index a57a2365c..000000000 Binary files a/sound/direct_sound_samples/cries/cry_raikou.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_raikou.wav b/sound/direct_sound_samples/cries/cry_raikou.wav new file mode 100644 index 000000000..35757a0ac Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_raikou.wav differ diff --git a/sound/direct_sound_samples/cries/cry_ralts.aif b/sound/direct_sound_samples/cries/cry_ralts.aif deleted file mode 100644 index 0baef5760..000000000 Binary files a/sound/direct_sound_samples/cries/cry_ralts.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_ralts.wav b/sound/direct_sound_samples/cries/cry_ralts.wav new file mode 100644 index 000000000..37948dc49 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_ralts.wav differ diff --git a/sound/direct_sound_samples/cries/cry_rapidash.aif b/sound/direct_sound_samples/cries/cry_rapidash.aif deleted file mode 100644 index 920f510e4..000000000 Binary files a/sound/direct_sound_samples/cries/cry_rapidash.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_rapidash.wav b/sound/direct_sound_samples/cries/cry_rapidash.wav new file mode 100644 index 000000000..953acc450 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_rapidash.wav differ diff --git a/sound/direct_sound_samples/cries/cry_raticate.aif b/sound/direct_sound_samples/cries/cry_raticate.aif deleted file mode 100644 index 01601cab5..000000000 Binary files a/sound/direct_sound_samples/cries/cry_raticate.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_raticate.wav b/sound/direct_sound_samples/cries/cry_raticate.wav new file mode 100644 index 000000000..bbef0c0af Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_raticate.wav differ diff --git a/sound/direct_sound_samples/cries/cry_rattata.aif b/sound/direct_sound_samples/cries/cry_rattata.aif deleted file mode 100644 index cb0e1f422..000000000 Binary files a/sound/direct_sound_samples/cries/cry_rattata.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_rattata.wav b/sound/direct_sound_samples/cries/cry_rattata.wav new file mode 100644 index 000000000..951c3bd8a Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_rattata.wav differ diff --git a/sound/direct_sound_samples/cries/cry_rayquaza.aif b/sound/direct_sound_samples/cries/cry_rayquaza.aif deleted file mode 100644 index 6115e11d8..000000000 Binary files a/sound/direct_sound_samples/cries/cry_rayquaza.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_rayquaza.wav b/sound/direct_sound_samples/cries/cry_rayquaza.wav new file mode 100644 index 000000000..94c4f7c01 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_rayquaza.wav differ diff --git a/sound/direct_sound_samples/cries/cry_regice.aif b/sound/direct_sound_samples/cries/cry_regice.aif deleted file mode 100644 index 6fa23dd73..000000000 Binary files a/sound/direct_sound_samples/cries/cry_regice.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_regice.wav b/sound/direct_sound_samples/cries/cry_regice.wav new file mode 100644 index 000000000..8a2bfe742 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_regice.wav differ diff --git a/sound/direct_sound_samples/cries/cry_regirock.aif b/sound/direct_sound_samples/cries/cry_regirock.aif deleted file mode 100644 index ab2a47eb8..000000000 Binary files a/sound/direct_sound_samples/cries/cry_regirock.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_regirock.wav b/sound/direct_sound_samples/cries/cry_regirock.wav new file mode 100644 index 000000000..271b91f31 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_regirock.wav differ diff --git a/sound/direct_sound_samples/cries/cry_registeel.aif b/sound/direct_sound_samples/cries/cry_registeel.aif deleted file mode 100644 index f5374e5f0..000000000 Binary files a/sound/direct_sound_samples/cries/cry_registeel.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_registeel.wav b/sound/direct_sound_samples/cries/cry_registeel.wav new file mode 100644 index 000000000..8bab7591f Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_registeel.wav differ diff --git a/sound/direct_sound_samples/cries/cry_relicanth.aif b/sound/direct_sound_samples/cries/cry_relicanth.aif deleted file mode 100644 index 60af9cf4e..000000000 Binary files a/sound/direct_sound_samples/cries/cry_relicanth.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_relicanth.wav b/sound/direct_sound_samples/cries/cry_relicanth.wav new file mode 100644 index 000000000..8561780d6 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_relicanth.wav differ diff --git a/sound/direct_sound_samples/cries/cry_remoraid.aif b/sound/direct_sound_samples/cries/cry_remoraid.aif deleted file mode 100644 index 16d3f1d65..000000000 Binary files a/sound/direct_sound_samples/cries/cry_remoraid.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_remoraid.wav b/sound/direct_sound_samples/cries/cry_remoraid.wav new file mode 100644 index 000000000..ebab789ad Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_remoraid.wav differ diff --git a/sound/direct_sound_samples/cries/cry_rhydon.aif b/sound/direct_sound_samples/cries/cry_rhydon.aif deleted file mode 100644 index cfa709ee9..000000000 Binary files a/sound/direct_sound_samples/cries/cry_rhydon.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_rhydon.wav b/sound/direct_sound_samples/cries/cry_rhydon.wav new file mode 100644 index 000000000..2c3907c91 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_rhydon.wav differ diff --git a/sound/direct_sound_samples/cries/cry_rhyhorn.aif b/sound/direct_sound_samples/cries/cry_rhyhorn.aif deleted file mode 100644 index 47f344ba2..000000000 Binary files a/sound/direct_sound_samples/cries/cry_rhyhorn.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_rhyhorn.wav b/sound/direct_sound_samples/cries/cry_rhyhorn.wav new file mode 100644 index 000000000..858375991 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_rhyhorn.wav differ diff --git a/sound/direct_sound_samples/cries/cry_roselia.aif b/sound/direct_sound_samples/cries/cry_roselia.aif deleted file mode 100644 index 50b60b77b..000000000 Binary files a/sound/direct_sound_samples/cries/cry_roselia.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_roselia.wav b/sound/direct_sound_samples/cries/cry_roselia.wav new file mode 100644 index 000000000..f9c67fae1 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_roselia.wav differ diff --git a/sound/direct_sound_samples/cries/cry_sableye.aif b/sound/direct_sound_samples/cries/cry_sableye.aif deleted file mode 100644 index 1b3a9be30..000000000 Binary files a/sound/direct_sound_samples/cries/cry_sableye.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_sableye.wav b/sound/direct_sound_samples/cries/cry_sableye.wav new file mode 100644 index 000000000..a1458cadc Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_sableye.wav differ diff --git a/sound/direct_sound_samples/cries/cry_salamence.aif b/sound/direct_sound_samples/cries/cry_salamence.aif deleted file mode 100644 index d2957809c..000000000 Binary files a/sound/direct_sound_samples/cries/cry_salamence.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_salamence.wav b/sound/direct_sound_samples/cries/cry_salamence.wav new file mode 100644 index 000000000..135d90ecd Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_salamence.wav differ diff --git a/sound/direct_sound_samples/cries/cry_sandshrew.aif b/sound/direct_sound_samples/cries/cry_sandshrew.aif deleted file mode 100644 index 6879be11d..000000000 Binary files a/sound/direct_sound_samples/cries/cry_sandshrew.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_sandshrew.wav b/sound/direct_sound_samples/cries/cry_sandshrew.wav new file mode 100644 index 000000000..94f98193d Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_sandshrew.wav differ diff --git a/sound/direct_sound_samples/cries/cry_sandslash.aif b/sound/direct_sound_samples/cries/cry_sandslash.aif deleted file mode 100644 index ee4a458ed..000000000 Binary files a/sound/direct_sound_samples/cries/cry_sandslash.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_sandslash.wav b/sound/direct_sound_samples/cries/cry_sandslash.wav new file mode 100644 index 000000000..ba3e29e08 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_sandslash.wav differ diff --git a/sound/direct_sound_samples/cries/cry_sceptile.aif b/sound/direct_sound_samples/cries/cry_sceptile.aif deleted file mode 100644 index 7252cb85f..000000000 Binary files a/sound/direct_sound_samples/cries/cry_sceptile.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_sceptile.wav b/sound/direct_sound_samples/cries/cry_sceptile.wav new file mode 100644 index 000000000..5ff4d5101 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_sceptile.wav differ diff --git a/sound/direct_sound_samples/cries/cry_scizor.aif b/sound/direct_sound_samples/cries/cry_scizor.aif deleted file mode 100644 index f1f7832ce..000000000 Binary files a/sound/direct_sound_samples/cries/cry_scizor.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_scizor.wav b/sound/direct_sound_samples/cries/cry_scizor.wav new file mode 100644 index 000000000..bc37f521c Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_scizor.wav differ diff --git a/sound/direct_sound_samples/cries/cry_scyther.aif b/sound/direct_sound_samples/cries/cry_scyther.aif deleted file mode 100644 index 2b8cbc104..000000000 Binary files a/sound/direct_sound_samples/cries/cry_scyther.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_scyther.wav b/sound/direct_sound_samples/cries/cry_scyther.wav new file mode 100644 index 000000000..021a6e017 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_scyther.wav differ diff --git a/sound/direct_sound_samples/cries/cry_seadra.aif b/sound/direct_sound_samples/cries/cry_seadra.aif deleted file mode 100644 index 2f60cce4a..000000000 Binary files a/sound/direct_sound_samples/cries/cry_seadra.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_seadra.wav b/sound/direct_sound_samples/cries/cry_seadra.wav new file mode 100644 index 000000000..84c6ad7c7 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_seadra.wav differ diff --git a/sound/direct_sound_samples/cries/cry_seaking.aif b/sound/direct_sound_samples/cries/cry_seaking.aif deleted file mode 100644 index e4fc7e70d..000000000 Binary files a/sound/direct_sound_samples/cries/cry_seaking.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_seaking.wav b/sound/direct_sound_samples/cries/cry_seaking.wav new file mode 100644 index 000000000..0534a12ed Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_seaking.wav differ diff --git a/sound/direct_sound_samples/cries/cry_sealeo.aif b/sound/direct_sound_samples/cries/cry_sealeo.aif deleted file mode 100644 index d9ea50026..000000000 Binary files a/sound/direct_sound_samples/cries/cry_sealeo.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_sealeo.wav b/sound/direct_sound_samples/cries/cry_sealeo.wav new file mode 100644 index 000000000..744ab7390 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_sealeo.wav differ diff --git a/sound/direct_sound_samples/cries/cry_seedot.aif b/sound/direct_sound_samples/cries/cry_seedot.aif deleted file mode 100644 index c37b769f8..000000000 Binary files a/sound/direct_sound_samples/cries/cry_seedot.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_seedot.wav b/sound/direct_sound_samples/cries/cry_seedot.wav new file mode 100644 index 000000000..367104936 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_seedot.wav differ diff --git a/sound/direct_sound_samples/cries/cry_seel.aif b/sound/direct_sound_samples/cries/cry_seel.aif deleted file mode 100644 index 84c4a0a94..000000000 Binary files a/sound/direct_sound_samples/cries/cry_seel.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_seel.wav b/sound/direct_sound_samples/cries/cry_seel.wav new file mode 100644 index 000000000..95e027d5e Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_seel.wav differ diff --git a/sound/direct_sound_samples/cries/cry_sentret.aif b/sound/direct_sound_samples/cries/cry_sentret.aif deleted file mode 100644 index 4aed7cd70..000000000 Binary files a/sound/direct_sound_samples/cries/cry_sentret.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_sentret.wav b/sound/direct_sound_samples/cries/cry_sentret.wav new file mode 100644 index 000000000..c7e1bb8a6 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_sentret.wav differ diff --git a/sound/direct_sound_samples/cries/cry_seviper.aif b/sound/direct_sound_samples/cries/cry_seviper.aif deleted file mode 100644 index 6a15dd6e2..000000000 Binary files a/sound/direct_sound_samples/cries/cry_seviper.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_seviper.wav b/sound/direct_sound_samples/cries/cry_seviper.wav new file mode 100644 index 000000000..73529d9c1 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_seviper.wav differ diff --git a/sound/direct_sound_samples/cries/cry_sharpedo.aif b/sound/direct_sound_samples/cries/cry_sharpedo.aif deleted file mode 100644 index 1b02b56ce..000000000 Binary files a/sound/direct_sound_samples/cries/cry_sharpedo.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_sharpedo.wav b/sound/direct_sound_samples/cries/cry_sharpedo.wav new file mode 100644 index 000000000..7f773d4fb Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_sharpedo.wav differ diff --git a/sound/direct_sound_samples/cries/cry_shedinja.aif b/sound/direct_sound_samples/cries/cry_shedinja.aif deleted file mode 100644 index 6d1d565f3..000000000 Binary files a/sound/direct_sound_samples/cries/cry_shedinja.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_shedinja.wav b/sound/direct_sound_samples/cries/cry_shedinja.wav new file mode 100644 index 000000000..6dda64b5d Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_shedinja.wav differ diff --git a/sound/direct_sound_samples/cries/cry_shelgon.aif b/sound/direct_sound_samples/cries/cry_shelgon.aif deleted file mode 100644 index 24f234ffe..000000000 Binary files a/sound/direct_sound_samples/cries/cry_shelgon.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_shelgon.wav b/sound/direct_sound_samples/cries/cry_shelgon.wav new file mode 100644 index 000000000..85ed3939c Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_shelgon.wav differ diff --git a/sound/direct_sound_samples/cries/cry_shellder.aif b/sound/direct_sound_samples/cries/cry_shellder.aif deleted file mode 100644 index b2ea85228..000000000 Binary files a/sound/direct_sound_samples/cries/cry_shellder.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_shellder.wav b/sound/direct_sound_samples/cries/cry_shellder.wav new file mode 100644 index 000000000..5c38501ba Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_shellder.wav differ diff --git a/sound/direct_sound_samples/cries/cry_shiftry.aif b/sound/direct_sound_samples/cries/cry_shiftry.aif deleted file mode 100644 index c91ece114..000000000 Binary files a/sound/direct_sound_samples/cries/cry_shiftry.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_shiftry.wav b/sound/direct_sound_samples/cries/cry_shiftry.wav new file mode 100644 index 000000000..dbba7208b Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_shiftry.wav differ diff --git a/sound/direct_sound_samples/cries/cry_shroomish.aif b/sound/direct_sound_samples/cries/cry_shroomish.aif deleted file mode 100644 index 9e944ca20..000000000 Binary files a/sound/direct_sound_samples/cries/cry_shroomish.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_shroomish.wav b/sound/direct_sound_samples/cries/cry_shroomish.wav new file mode 100644 index 000000000..05fa69670 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_shroomish.wav differ diff --git a/sound/direct_sound_samples/cries/cry_shuckle.aif b/sound/direct_sound_samples/cries/cry_shuckle.aif deleted file mode 100644 index d835d2de6..000000000 Binary files a/sound/direct_sound_samples/cries/cry_shuckle.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_shuckle.wav b/sound/direct_sound_samples/cries/cry_shuckle.wav new file mode 100644 index 000000000..afc303e4d Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_shuckle.wav differ diff --git a/sound/direct_sound_samples/cries/cry_shuppet.aif b/sound/direct_sound_samples/cries/cry_shuppet.aif deleted file mode 100644 index 1cd9a2f14..000000000 Binary files a/sound/direct_sound_samples/cries/cry_shuppet.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_shuppet.wav b/sound/direct_sound_samples/cries/cry_shuppet.wav new file mode 100644 index 000000000..da206414c Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_shuppet.wav differ diff --git a/sound/direct_sound_samples/cries/cry_silcoon.aif b/sound/direct_sound_samples/cries/cry_silcoon.aif deleted file mode 100644 index ff48950ad..000000000 Binary files a/sound/direct_sound_samples/cries/cry_silcoon.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_silcoon.wav b/sound/direct_sound_samples/cries/cry_silcoon.wav new file mode 100644 index 000000000..e5af66fbc Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_silcoon.wav differ diff --git a/sound/direct_sound_samples/cries/cry_skarmory.aif b/sound/direct_sound_samples/cries/cry_skarmory.aif deleted file mode 100644 index 88d3985a3..000000000 Binary files a/sound/direct_sound_samples/cries/cry_skarmory.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_skarmory.wav b/sound/direct_sound_samples/cries/cry_skarmory.wav new file mode 100644 index 000000000..7062c9813 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_skarmory.wav differ diff --git a/sound/direct_sound_samples/cries/cry_skiploom.aif b/sound/direct_sound_samples/cries/cry_skiploom.aif deleted file mode 100644 index 201744d12..000000000 Binary files a/sound/direct_sound_samples/cries/cry_skiploom.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_skiploom.wav b/sound/direct_sound_samples/cries/cry_skiploom.wav new file mode 100644 index 000000000..8aa05f5b7 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_skiploom.wav differ diff --git a/sound/direct_sound_samples/cries/cry_skitty.aif b/sound/direct_sound_samples/cries/cry_skitty.aif deleted file mode 100644 index 7dc4578f4..000000000 Binary files a/sound/direct_sound_samples/cries/cry_skitty.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_skitty.wav b/sound/direct_sound_samples/cries/cry_skitty.wav new file mode 100644 index 000000000..ee5717d07 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_skitty.wav differ diff --git a/sound/direct_sound_samples/cries/cry_slaking.aif b/sound/direct_sound_samples/cries/cry_slaking.aif deleted file mode 100644 index b6a4160f3..000000000 Binary files a/sound/direct_sound_samples/cries/cry_slaking.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_slaking.wav b/sound/direct_sound_samples/cries/cry_slaking.wav new file mode 100644 index 000000000..44681126d Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_slaking.wav differ diff --git a/sound/direct_sound_samples/cries/cry_slakoth.aif b/sound/direct_sound_samples/cries/cry_slakoth.aif deleted file mode 100644 index 0e4bbc3c3..000000000 Binary files a/sound/direct_sound_samples/cries/cry_slakoth.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_slakoth.wav b/sound/direct_sound_samples/cries/cry_slakoth.wav new file mode 100644 index 000000000..4c442f9c1 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_slakoth.wav differ diff --git a/sound/direct_sound_samples/cries/cry_slowbro.aif b/sound/direct_sound_samples/cries/cry_slowbro.aif deleted file mode 100644 index f74b753d2..000000000 Binary files a/sound/direct_sound_samples/cries/cry_slowbro.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_slowbro.wav b/sound/direct_sound_samples/cries/cry_slowbro.wav new file mode 100644 index 000000000..c46e751f5 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_slowbro.wav differ diff --git a/sound/direct_sound_samples/cries/cry_slowking.aif b/sound/direct_sound_samples/cries/cry_slowking.aif deleted file mode 100644 index 245a42023..000000000 Binary files a/sound/direct_sound_samples/cries/cry_slowking.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_slowking.wav b/sound/direct_sound_samples/cries/cry_slowking.wav new file mode 100644 index 000000000..a32fea33d Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_slowking.wav differ diff --git a/sound/direct_sound_samples/cries/cry_slowpoke.aif b/sound/direct_sound_samples/cries/cry_slowpoke.aif deleted file mode 100644 index 82b05a9a7..000000000 Binary files a/sound/direct_sound_samples/cries/cry_slowpoke.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_slowpoke.wav b/sound/direct_sound_samples/cries/cry_slowpoke.wav new file mode 100644 index 000000000..275c2d9da Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_slowpoke.wav differ diff --git a/sound/direct_sound_samples/cries/cry_slugma.aif b/sound/direct_sound_samples/cries/cry_slugma.aif deleted file mode 100644 index fed42817c..000000000 Binary files a/sound/direct_sound_samples/cries/cry_slugma.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_slugma.wav b/sound/direct_sound_samples/cries/cry_slugma.wav new file mode 100644 index 000000000..fed73cced Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_slugma.wav differ diff --git a/sound/direct_sound_samples/cries/cry_smeargle.aif b/sound/direct_sound_samples/cries/cry_smeargle.aif deleted file mode 100644 index 00dbedead..000000000 Binary files a/sound/direct_sound_samples/cries/cry_smeargle.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_smeargle.wav b/sound/direct_sound_samples/cries/cry_smeargle.wav new file mode 100644 index 000000000..abb48580b Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_smeargle.wav differ diff --git a/sound/direct_sound_samples/cries/cry_smoochum.aif b/sound/direct_sound_samples/cries/cry_smoochum.aif deleted file mode 100644 index 4005b4ad4..000000000 Binary files a/sound/direct_sound_samples/cries/cry_smoochum.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_smoochum.wav b/sound/direct_sound_samples/cries/cry_smoochum.wav new file mode 100644 index 000000000..33f50b046 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_smoochum.wav differ diff --git a/sound/direct_sound_samples/cries/cry_sneasel.aif b/sound/direct_sound_samples/cries/cry_sneasel.aif deleted file mode 100644 index 54242a23f..000000000 Binary files a/sound/direct_sound_samples/cries/cry_sneasel.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_sneasel.wav b/sound/direct_sound_samples/cries/cry_sneasel.wav new file mode 100644 index 000000000..dc960be0d Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_sneasel.wav differ diff --git a/sound/direct_sound_samples/cries/cry_snorlax.aif b/sound/direct_sound_samples/cries/cry_snorlax.aif deleted file mode 100644 index f95128e3a..000000000 Binary files a/sound/direct_sound_samples/cries/cry_snorlax.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_snorlax.wav b/sound/direct_sound_samples/cries/cry_snorlax.wav new file mode 100644 index 000000000..c0e45a457 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_snorlax.wav differ diff --git a/sound/direct_sound_samples/cries/cry_snorunt.aif b/sound/direct_sound_samples/cries/cry_snorunt.aif deleted file mode 100644 index 53b05b229..000000000 Binary files a/sound/direct_sound_samples/cries/cry_snorunt.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_snorunt.wav b/sound/direct_sound_samples/cries/cry_snorunt.wav new file mode 100644 index 000000000..586c13116 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_snorunt.wav differ diff --git a/sound/direct_sound_samples/cries/cry_snubbull.aif b/sound/direct_sound_samples/cries/cry_snubbull.aif deleted file mode 100644 index bbba023fd..000000000 Binary files a/sound/direct_sound_samples/cries/cry_snubbull.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_snubbull.wav b/sound/direct_sound_samples/cries/cry_snubbull.wav new file mode 100644 index 000000000..626da01c1 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_snubbull.wav differ diff --git a/sound/direct_sound_samples/cries/cry_solrock.aif b/sound/direct_sound_samples/cries/cry_solrock.aif deleted file mode 100644 index 64c71f289..000000000 Binary files a/sound/direct_sound_samples/cries/cry_solrock.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_solrock.wav b/sound/direct_sound_samples/cries/cry_solrock.wav new file mode 100644 index 000000000..d99dcbd2b Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_solrock.wav differ diff --git a/sound/direct_sound_samples/cries/cry_spearow.aif b/sound/direct_sound_samples/cries/cry_spearow.aif deleted file mode 100644 index 7ce86ae29..000000000 Binary files a/sound/direct_sound_samples/cries/cry_spearow.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_spearow.wav b/sound/direct_sound_samples/cries/cry_spearow.wav new file mode 100644 index 000000000..e441d27ed Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_spearow.wav differ diff --git a/sound/direct_sound_samples/cries/cry_spheal.aif b/sound/direct_sound_samples/cries/cry_spheal.aif deleted file mode 100644 index fb6470210..000000000 Binary files a/sound/direct_sound_samples/cries/cry_spheal.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_spheal.wav b/sound/direct_sound_samples/cries/cry_spheal.wav new file mode 100644 index 000000000..560239934 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_spheal.wav differ diff --git a/sound/direct_sound_samples/cries/cry_spinarak.aif b/sound/direct_sound_samples/cries/cry_spinarak.aif deleted file mode 100644 index 3c4c1eff1..000000000 Binary files a/sound/direct_sound_samples/cries/cry_spinarak.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_spinarak.wav b/sound/direct_sound_samples/cries/cry_spinarak.wav new file mode 100644 index 000000000..764efce71 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_spinarak.wav differ diff --git a/sound/direct_sound_samples/cries/cry_spinda.aif b/sound/direct_sound_samples/cries/cry_spinda.aif deleted file mode 100644 index 0217573c7..000000000 Binary files a/sound/direct_sound_samples/cries/cry_spinda.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_spinda.wav b/sound/direct_sound_samples/cries/cry_spinda.wav new file mode 100644 index 000000000..a86581778 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_spinda.wav differ diff --git a/sound/direct_sound_samples/cries/cry_spoink.aif b/sound/direct_sound_samples/cries/cry_spoink.aif deleted file mode 100644 index 6cc9bf546..000000000 Binary files a/sound/direct_sound_samples/cries/cry_spoink.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_spoink.wav b/sound/direct_sound_samples/cries/cry_spoink.wav new file mode 100644 index 000000000..880637b5c Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_spoink.wav differ diff --git a/sound/direct_sound_samples/cries/cry_squirtle.aif b/sound/direct_sound_samples/cries/cry_squirtle.aif deleted file mode 100644 index 43a98a53d..000000000 Binary files a/sound/direct_sound_samples/cries/cry_squirtle.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_squirtle.wav b/sound/direct_sound_samples/cries/cry_squirtle.wav new file mode 100644 index 000000000..fb533d718 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_squirtle.wav differ diff --git a/sound/direct_sound_samples/cries/cry_stantler.aif b/sound/direct_sound_samples/cries/cry_stantler.aif deleted file mode 100644 index 36ba54658..000000000 Binary files a/sound/direct_sound_samples/cries/cry_stantler.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_stantler.wav b/sound/direct_sound_samples/cries/cry_stantler.wav new file mode 100644 index 000000000..febf2e616 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_stantler.wav differ diff --git a/sound/direct_sound_samples/cries/cry_starmie.aif b/sound/direct_sound_samples/cries/cry_starmie.aif deleted file mode 100644 index 7452a78f9..000000000 Binary files a/sound/direct_sound_samples/cries/cry_starmie.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_starmie.wav b/sound/direct_sound_samples/cries/cry_starmie.wav new file mode 100644 index 000000000..40edec6b9 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_starmie.wav differ diff --git a/sound/direct_sound_samples/cries/cry_staryu.aif b/sound/direct_sound_samples/cries/cry_staryu.aif deleted file mode 100644 index 6ab5584bf..000000000 Binary files a/sound/direct_sound_samples/cries/cry_staryu.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_staryu.wav b/sound/direct_sound_samples/cries/cry_staryu.wav new file mode 100644 index 000000000..611c0571b Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_staryu.wav differ diff --git a/sound/direct_sound_samples/cries/cry_steelix.aif b/sound/direct_sound_samples/cries/cry_steelix.aif deleted file mode 100644 index aa05e2d4c..000000000 Binary files a/sound/direct_sound_samples/cries/cry_steelix.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_steelix.wav b/sound/direct_sound_samples/cries/cry_steelix.wav new file mode 100644 index 000000000..85de343ab Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_steelix.wav differ diff --git a/sound/direct_sound_samples/cries/cry_sudowoodo.aif b/sound/direct_sound_samples/cries/cry_sudowoodo.aif deleted file mode 100644 index 1af7e18eb..000000000 Binary files a/sound/direct_sound_samples/cries/cry_sudowoodo.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_sudowoodo.wav b/sound/direct_sound_samples/cries/cry_sudowoodo.wav new file mode 100644 index 000000000..97bb1d51a Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_sudowoodo.wav differ diff --git a/sound/direct_sound_samples/cries/cry_suicune.aif b/sound/direct_sound_samples/cries/cry_suicune.aif deleted file mode 100644 index 697732d68..000000000 Binary files a/sound/direct_sound_samples/cries/cry_suicune.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_suicune.wav b/sound/direct_sound_samples/cries/cry_suicune.wav new file mode 100644 index 000000000..90218ad01 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_suicune.wav differ diff --git a/sound/direct_sound_samples/cries/cry_sunflora.aif b/sound/direct_sound_samples/cries/cry_sunflora.aif deleted file mode 100644 index 126931adc..000000000 Binary files a/sound/direct_sound_samples/cries/cry_sunflora.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_sunflora.wav b/sound/direct_sound_samples/cries/cry_sunflora.wav new file mode 100644 index 000000000..ccad9c8c3 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_sunflora.wav differ diff --git a/sound/direct_sound_samples/cries/cry_sunkern.aif b/sound/direct_sound_samples/cries/cry_sunkern.aif deleted file mode 100644 index bede3bf95..000000000 Binary files a/sound/direct_sound_samples/cries/cry_sunkern.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_sunkern.wav b/sound/direct_sound_samples/cries/cry_sunkern.wav new file mode 100644 index 000000000..0b670dadb Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_sunkern.wav differ diff --git a/sound/direct_sound_samples/cries/cry_surskit.aif b/sound/direct_sound_samples/cries/cry_surskit.aif deleted file mode 100644 index 438b5b67a..000000000 Binary files a/sound/direct_sound_samples/cries/cry_surskit.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_surskit.wav b/sound/direct_sound_samples/cries/cry_surskit.wav new file mode 100644 index 000000000..650fde3d1 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_surskit.wav differ diff --git a/sound/direct_sound_samples/cries/cry_swablu.aif b/sound/direct_sound_samples/cries/cry_swablu.aif deleted file mode 100644 index 066095f55..000000000 Binary files a/sound/direct_sound_samples/cries/cry_swablu.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_swablu.wav b/sound/direct_sound_samples/cries/cry_swablu.wav new file mode 100644 index 000000000..0fafb27d0 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_swablu.wav differ diff --git a/sound/direct_sound_samples/cries/cry_swalot.aif b/sound/direct_sound_samples/cries/cry_swalot.aif deleted file mode 100644 index 518a9bf5a..000000000 Binary files a/sound/direct_sound_samples/cries/cry_swalot.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_swalot.wav b/sound/direct_sound_samples/cries/cry_swalot.wav new file mode 100644 index 000000000..56e0b170b Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_swalot.wav differ diff --git a/sound/direct_sound_samples/cries/cry_swampert.aif b/sound/direct_sound_samples/cries/cry_swampert.aif deleted file mode 100644 index 56bd26405..000000000 Binary files a/sound/direct_sound_samples/cries/cry_swampert.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_swampert.wav b/sound/direct_sound_samples/cries/cry_swampert.wav new file mode 100644 index 000000000..eab813edb Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_swampert.wav differ diff --git a/sound/direct_sound_samples/cries/cry_swellow.aif b/sound/direct_sound_samples/cries/cry_swellow.aif deleted file mode 100644 index 2b94eb432..000000000 Binary files a/sound/direct_sound_samples/cries/cry_swellow.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_swellow.wav b/sound/direct_sound_samples/cries/cry_swellow.wav new file mode 100644 index 000000000..118eb684c Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_swellow.wav differ diff --git a/sound/direct_sound_samples/cries/cry_swinub.aif b/sound/direct_sound_samples/cries/cry_swinub.aif deleted file mode 100644 index dc68d62d8..000000000 Binary files a/sound/direct_sound_samples/cries/cry_swinub.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_swinub.wav b/sound/direct_sound_samples/cries/cry_swinub.wav new file mode 100644 index 000000000..e84ba9454 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_swinub.wav differ diff --git a/sound/direct_sound_samples/cries/cry_taillow.aif b/sound/direct_sound_samples/cries/cry_taillow.aif deleted file mode 100644 index 8322a3224..000000000 Binary files a/sound/direct_sound_samples/cries/cry_taillow.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_taillow.wav b/sound/direct_sound_samples/cries/cry_taillow.wav new file mode 100644 index 000000000..7d4135c76 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_taillow.wav differ diff --git a/sound/direct_sound_samples/cries/cry_tangela.aif b/sound/direct_sound_samples/cries/cry_tangela.aif deleted file mode 100644 index c900b426d..000000000 Binary files a/sound/direct_sound_samples/cries/cry_tangela.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_tangela.wav b/sound/direct_sound_samples/cries/cry_tangela.wav new file mode 100644 index 000000000..991b787ff Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_tangela.wav differ diff --git a/sound/direct_sound_samples/cries/cry_tauros.aif b/sound/direct_sound_samples/cries/cry_tauros.aif deleted file mode 100644 index 84fa9b317..000000000 Binary files a/sound/direct_sound_samples/cries/cry_tauros.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_tauros.wav b/sound/direct_sound_samples/cries/cry_tauros.wav new file mode 100644 index 000000000..f7610d2dd Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_tauros.wav differ diff --git a/sound/direct_sound_samples/cries/cry_teddiursa.aif b/sound/direct_sound_samples/cries/cry_teddiursa.aif deleted file mode 100644 index ba5cb5bc3..000000000 Binary files a/sound/direct_sound_samples/cries/cry_teddiursa.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_teddiursa.wav b/sound/direct_sound_samples/cries/cry_teddiursa.wav new file mode 100644 index 000000000..d55bc9e4a Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_teddiursa.wav differ diff --git a/sound/direct_sound_samples/cries/cry_tentacool.aif b/sound/direct_sound_samples/cries/cry_tentacool.aif deleted file mode 100644 index 332bec4b2..000000000 Binary files a/sound/direct_sound_samples/cries/cry_tentacool.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_tentacool.wav b/sound/direct_sound_samples/cries/cry_tentacool.wav new file mode 100644 index 000000000..f35d2a625 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_tentacool.wav differ diff --git a/sound/direct_sound_samples/cries/cry_tentacruel.aif b/sound/direct_sound_samples/cries/cry_tentacruel.aif deleted file mode 100644 index e8ec1b14c..000000000 Binary files a/sound/direct_sound_samples/cries/cry_tentacruel.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_tentacruel.wav b/sound/direct_sound_samples/cries/cry_tentacruel.wav new file mode 100644 index 000000000..3799a1075 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_tentacruel.wav differ diff --git a/sound/direct_sound_samples/cries/cry_togepi.aif b/sound/direct_sound_samples/cries/cry_togepi.aif deleted file mode 100644 index 87ef6ef2d..000000000 Binary files a/sound/direct_sound_samples/cries/cry_togepi.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_togepi.wav b/sound/direct_sound_samples/cries/cry_togepi.wav new file mode 100644 index 000000000..ac6bbf9ff Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_togepi.wav differ diff --git a/sound/direct_sound_samples/cries/cry_togetic.aif b/sound/direct_sound_samples/cries/cry_togetic.aif deleted file mode 100644 index 8aa18ac41..000000000 Binary files a/sound/direct_sound_samples/cries/cry_togetic.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_togetic.wav b/sound/direct_sound_samples/cries/cry_togetic.wav new file mode 100644 index 000000000..f8b70c0f4 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_togetic.wav differ diff --git a/sound/direct_sound_samples/cries/cry_torchic.aif b/sound/direct_sound_samples/cries/cry_torchic.aif deleted file mode 100644 index 185a79499..000000000 Binary files a/sound/direct_sound_samples/cries/cry_torchic.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_torchic.wav b/sound/direct_sound_samples/cries/cry_torchic.wav new file mode 100644 index 000000000..5dd5c56be Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_torchic.wav differ diff --git a/sound/direct_sound_samples/cries/cry_torkoal.aif b/sound/direct_sound_samples/cries/cry_torkoal.aif deleted file mode 100644 index 9e56d3810..000000000 Binary files a/sound/direct_sound_samples/cries/cry_torkoal.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_torkoal.wav b/sound/direct_sound_samples/cries/cry_torkoal.wav new file mode 100644 index 000000000..aed384296 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_torkoal.wav differ diff --git a/sound/direct_sound_samples/cries/cry_totodile.aif b/sound/direct_sound_samples/cries/cry_totodile.aif deleted file mode 100644 index dbf2179a7..000000000 Binary files a/sound/direct_sound_samples/cries/cry_totodile.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_totodile.wav b/sound/direct_sound_samples/cries/cry_totodile.wav new file mode 100644 index 000000000..4a4263ec2 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_totodile.wav differ diff --git a/sound/direct_sound_samples/cries/cry_trapinch.aif b/sound/direct_sound_samples/cries/cry_trapinch.aif deleted file mode 100644 index 01664b72e..000000000 Binary files a/sound/direct_sound_samples/cries/cry_trapinch.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_trapinch.wav b/sound/direct_sound_samples/cries/cry_trapinch.wav new file mode 100644 index 000000000..abb851c1b Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_trapinch.wav differ diff --git a/sound/direct_sound_samples/cries/cry_treecko.aif b/sound/direct_sound_samples/cries/cry_treecko.aif deleted file mode 100644 index a7416e8da..000000000 Binary files a/sound/direct_sound_samples/cries/cry_treecko.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_treecko.wav b/sound/direct_sound_samples/cries/cry_treecko.wav new file mode 100644 index 000000000..da4304845 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_treecko.wav differ diff --git a/sound/direct_sound_samples/cries/cry_tropius.aif b/sound/direct_sound_samples/cries/cry_tropius.aif deleted file mode 100644 index bbb52787b..000000000 Binary files a/sound/direct_sound_samples/cries/cry_tropius.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_tropius.wav b/sound/direct_sound_samples/cries/cry_tropius.wav new file mode 100644 index 000000000..f7f7cbc38 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_tropius.wav differ diff --git a/sound/direct_sound_samples/cries/cry_typhlosion.aif b/sound/direct_sound_samples/cries/cry_typhlosion.aif deleted file mode 100644 index f0238d066..000000000 Binary files a/sound/direct_sound_samples/cries/cry_typhlosion.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_typhlosion.wav b/sound/direct_sound_samples/cries/cry_typhlosion.wav new file mode 100644 index 000000000..cd525d561 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_typhlosion.wav differ diff --git a/sound/direct_sound_samples/cries/cry_tyranitar.aif b/sound/direct_sound_samples/cries/cry_tyranitar.aif deleted file mode 100644 index 557f61769..000000000 Binary files a/sound/direct_sound_samples/cries/cry_tyranitar.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_tyranitar.wav b/sound/direct_sound_samples/cries/cry_tyranitar.wav new file mode 100644 index 000000000..f2b768210 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_tyranitar.wav differ diff --git a/sound/direct_sound_samples/cries/cry_tyrogue.aif b/sound/direct_sound_samples/cries/cry_tyrogue.aif deleted file mode 100644 index e5065f58b..000000000 Binary files a/sound/direct_sound_samples/cries/cry_tyrogue.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_tyrogue.wav b/sound/direct_sound_samples/cries/cry_tyrogue.wav new file mode 100644 index 000000000..4905a8566 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_tyrogue.wav differ diff --git a/sound/direct_sound_samples/cries/cry_umbreon.aif b/sound/direct_sound_samples/cries/cry_umbreon.aif deleted file mode 100644 index 38129b1a7..000000000 Binary files a/sound/direct_sound_samples/cries/cry_umbreon.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_umbreon.wav b/sound/direct_sound_samples/cries/cry_umbreon.wav new file mode 100644 index 000000000..8735d9fde Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_umbreon.wav differ diff --git a/sound/direct_sound_samples/cries/cry_unown.aif b/sound/direct_sound_samples/cries/cry_unown.aif deleted file mode 100644 index 8339ccb6b..000000000 Binary files a/sound/direct_sound_samples/cries/cry_unown.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_unown.wav b/sound/direct_sound_samples/cries/cry_unown.wav new file mode 100644 index 000000000..befaaedd0 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_unown.wav differ diff --git a/sound/direct_sound_samples/cries/cry_unused_265.aif b/sound/direct_sound_samples/cries/cry_unused_265.aif deleted file mode 100644 index 7f5965f06..000000000 Binary files a/sound/direct_sound_samples/cries/cry_unused_265.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_unused_265.wav b/sound/direct_sound_samples/cries/cry_unused_265.wav new file mode 100644 index 000000000..5735db46f Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_unused_265.wav differ diff --git a/sound/direct_sound_samples/cries/cry_unused_268.aif b/sound/direct_sound_samples/cries/cry_unused_268.aif deleted file mode 100644 index 5cae364c3..000000000 Binary files a/sound/direct_sound_samples/cries/cry_unused_268.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_unused_268.wav b/sound/direct_sound_samples/cries/cry_unused_268.wav new file mode 100644 index 000000000..c698955e8 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_unused_268.wav differ diff --git a/sound/direct_sound_samples/cries/cry_ursaring.aif b/sound/direct_sound_samples/cries/cry_ursaring.aif deleted file mode 100644 index fcc748bd1..000000000 Binary files a/sound/direct_sound_samples/cries/cry_ursaring.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_ursaring.wav b/sound/direct_sound_samples/cries/cry_ursaring.wav new file mode 100644 index 000000000..e8ccc67ca Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_ursaring.wav differ diff --git a/sound/direct_sound_samples/cries/cry_vaporeon.aif b/sound/direct_sound_samples/cries/cry_vaporeon.aif deleted file mode 100644 index 4967cfdeb..000000000 Binary files a/sound/direct_sound_samples/cries/cry_vaporeon.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_vaporeon.wav b/sound/direct_sound_samples/cries/cry_vaporeon.wav new file mode 100644 index 000000000..861bc93cb Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_vaporeon.wav differ diff --git a/sound/direct_sound_samples/cries/cry_venomoth.aif b/sound/direct_sound_samples/cries/cry_venomoth.aif deleted file mode 100644 index bc291ec33..000000000 Binary files a/sound/direct_sound_samples/cries/cry_venomoth.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_venomoth.wav b/sound/direct_sound_samples/cries/cry_venomoth.wav new file mode 100644 index 000000000..76deea6e8 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_venomoth.wav differ diff --git a/sound/direct_sound_samples/cries/cry_venonat.aif b/sound/direct_sound_samples/cries/cry_venonat.aif deleted file mode 100644 index e89d87fa8..000000000 Binary files a/sound/direct_sound_samples/cries/cry_venonat.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_venonat.wav b/sound/direct_sound_samples/cries/cry_venonat.wav new file mode 100644 index 000000000..52763c4ea Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_venonat.wav differ diff --git a/sound/direct_sound_samples/cries/cry_venusaur.aif b/sound/direct_sound_samples/cries/cry_venusaur.aif deleted file mode 100644 index 8a1f69e6e..000000000 Binary files a/sound/direct_sound_samples/cries/cry_venusaur.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_venusaur.wav b/sound/direct_sound_samples/cries/cry_venusaur.wav new file mode 100644 index 000000000..4273ac847 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_venusaur.wav differ diff --git a/sound/direct_sound_samples/cries/cry_vibrava.aif b/sound/direct_sound_samples/cries/cry_vibrava.aif deleted file mode 100644 index 3e3180219..000000000 Binary files a/sound/direct_sound_samples/cries/cry_vibrava.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_vibrava.wav b/sound/direct_sound_samples/cries/cry_vibrava.wav new file mode 100644 index 000000000..9f4b2b362 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_vibrava.wav differ diff --git a/sound/direct_sound_samples/cries/cry_victreebel.aif b/sound/direct_sound_samples/cries/cry_victreebel.aif deleted file mode 100644 index d6e6a4fe9..000000000 Binary files a/sound/direct_sound_samples/cries/cry_victreebel.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_victreebel.wav b/sound/direct_sound_samples/cries/cry_victreebel.wav new file mode 100644 index 000000000..cea271b30 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_victreebel.wav differ diff --git a/sound/direct_sound_samples/cries/cry_vigoroth.aif b/sound/direct_sound_samples/cries/cry_vigoroth.aif deleted file mode 100644 index fc414f33d..000000000 Binary files a/sound/direct_sound_samples/cries/cry_vigoroth.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_vigoroth.wav b/sound/direct_sound_samples/cries/cry_vigoroth.wav new file mode 100644 index 000000000..800a4989f Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_vigoroth.wav differ diff --git a/sound/direct_sound_samples/cries/cry_vileplume.aif b/sound/direct_sound_samples/cries/cry_vileplume.aif deleted file mode 100644 index 723eec697..000000000 Binary files a/sound/direct_sound_samples/cries/cry_vileplume.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_vileplume.wav b/sound/direct_sound_samples/cries/cry_vileplume.wav new file mode 100644 index 000000000..06dfaab47 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_vileplume.wav differ diff --git a/sound/direct_sound_samples/cries/cry_volbeat.aif b/sound/direct_sound_samples/cries/cry_volbeat.aif deleted file mode 100644 index 6f765081e..000000000 Binary files a/sound/direct_sound_samples/cries/cry_volbeat.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_volbeat.wav b/sound/direct_sound_samples/cries/cry_volbeat.wav new file mode 100644 index 000000000..d29a8ddbe Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_volbeat.wav differ diff --git a/sound/direct_sound_samples/cries/cry_voltorb.aif b/sound/direct_sound_samples/cries/cry_voltorb.aif deleted file mode 100644 index 96e3bff31..000000000 Binary files a/sound/direct_sound_samples/cries/cry_voltorb.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_voltorb.wav b/sound/direct_sound_samples/cries/cry_voltorb.wav new file mode 100644 index 000000000..0c698af27 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_voltorb.wav differ diff --git a/sound/direct_sound_samples/cries/cry_vulpix.aif b/sound/direct_sound_samples/cries/cry_vulpix.aif deleted file mode 100644 index 20da23fb4..000000000 Binary files a/sound/direct_sound_samples/cries/cry_vulpix.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_vulpix.wav b/sound/direct_sound_samples/cries/cry_vulpix.wav new file mode 100644 index 000000000..895bf7f35 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_vulpix.wav differ diff --git a/sound/direct_sound_samples/cries/cry_wailmer.aif b/sound/direct_sound_samples/cries/cry_wailmer.aif deleted file mode 100644 index e8de91333..000000000 Binary files a/sound/direct_sound_samples/cries/cry_wailmer.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_wailmer.wav b/sound/direct_sound_samples/cries/cry_wailmer.wav new file mode 100644 index 000000000..514200f85 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_wailmer.wav differ diff --git a/sound/direct_sound_samples/cries/cry_wailord.aif b/sound/direct_sound_samples/cries/cry_wailord.aif deleted file mode 100644 index 2c0468010..000000000 Binary files a/sound/direct_sound_samples/cries/cry_wailord.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_wailord.wav b/sound/direct_sound_samples/cries/cry_wailord.wav new file mode 100644 index 000000000..163660c6a Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_wailord.wav differ diff --git a/sound/direct_sound_samples/cries/cry_walrein.aif b/sound/direct_sound_samples/cries/cry_walrein.aif deleted file mode 100644 index 24c00a596..000000000 Binary files a/sound/direct_sound_samples/cries/cry_walrein.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_walrein.wav b/sound/direct_sound_samples/cries/cry_walrein.wav new file mode 100644 index 000000000..f79d0ad6c Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_walrein.wav differ diff --git a/sound/direct_sound_samples/cries/cry_wartortle.aif b/sound/direct_sound_samples/cries/cry_wartortle.aif deleted file mode 100644 index 5dab7fd93..000000000 Binary files a/sound/direct_sound_samples/cries/cry_wartortle.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_wartortle.wav b/sound/direct_sound_samples/cries/cry_wartortle.wav new file mode 100644 index 000000000..040292e12 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_wartortle.wav differ diff --git a/sound/direct_sound_samples/cries/cry_weedle.aif b/sound/direct_sound_samples/cries/cry_weedle.aif deleted file mode 100644 index 773c2c8ae..000000000 Binary files a/sound/direct_sound_samples/cries/cry_weedle.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_weedle.wav b/sound/direct_sound_samples/cries/cry_weedle.wav new file mode 100644 index 000000000..2c891cd30 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_weedle.wav differ diff --git a/sound/direct_sound_samples/cries/cry_weepinbell.aif b/sound/direct_sound_samples/cries/cry_weepinbell.aif deleted file mode 100644 index cdd61380a..000000000 Binary files a/sound/direct_sound_samples/cries/cry_weepinbell.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_weepinbell.wav b/sound/direct_sound_samples/cries/cry_weepinbell.wav new file mode 100644 index 000000000..206bd24e4 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_weepinbell.wav differ diff --git a/sound/direct_sound_samples/cries/cry_weezing.aif b/sound/direct_sound_samples/cries/cry_weezing.aif deleted file mode 100644 index 2e4a7fe13..000000000 Binary files a/sound/direct_sound_samples/cries/cry_weezing.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_weezing.wav b/sound/direct_sound_samples/cries/cry_weezing.wav new file mode 100644 index 000000000..ee6058595 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_weezing.wav differ diff --git a/sound/direct_sound_samples/cries/cry_whiscash.aif b/sound/direct_sound_samples/cries/cry_whiscash.aif deleted file mode 100644 index 219737f32..000000000 Binary files a/sound/direct_sound_samples/cries/cry_whiscash.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_whiscash.wav b/sound/direct_sound_samples/cries/cry_whiscash.wav new file mode 100644 index 000000000..927713b05 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_whiscash.wav differ diff --git a/sound/direct_sound_samples/cries/cry_whismur.aif b/sound/direct_sound_samples/cries/cry_whismur.aif deleted file mode 100644 index 4da92ca6a..000000000 Binary files a/sound/direct_sound_samples/cries/cry_whismur.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_whismur.wav b/sound/direct_sound_samples/cries/cry_whismur.wav new file mode 100644 index 000000000..3470acc99 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_whismur.wav differ diff --git a/sound/direct_sound_samples/cries/cry_wigglytuff.aif b/sound/direct_sound_samples/cries/cry_wigglytuff.aif deleted file mode 100644 index 90aa90a23..000000000 Binary files a/sound/direct_sound_samples/cries/cry_wigglytuff.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_wigglytuff.wav b/sound/direct_sound_samples/cries/cry_wigglytuff.wav new file mode 100644 index 000000000..7e9e668a4 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_wigglytuff.wav differ diff --git a/sound/direct_sound_samples/cries/cry_wingull.aif b/sound/direct_sound_samples/cries/cry_wingull.aif deleted file mode 100644 index 182ef18e6..000000000 Binary files a/sound/direct_sound_samples/cries/cry_wingull.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_wingull.wav b/sound/direct_sound_samples/cries/cry_wingull.wav new file mode 100644 index 000000000..b78029593 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_wingull.wav differ diff --git a/sound/direct_sound_samples/cries/cry_wobbuffet.aif b/sound/direct_sound_samples/cries/cry_wobbuffet.aif deleted file mode 100644 index 70ee1f704..000000000 Binary files a/sound/direct_sound_samples/cries/cry_wobbuffet.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_wobbuffet.wav b/sound/direct_sound_samples/cries/cry_wobbuffet.wav new file mode 100644 index 000000000..049aa83ba Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_wobbuffet.wav differ diff --git a/sound/direct_sound_samples/cries/cry_wooper.aif b/sound/direct_sound_samples/cries/cry_wooper.aif deleted file mode 100644 index 51a6b627e..000000000 Binary files a/sound/direct_sound_samples/cries/cry_wooper.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_wooper.wav b/sound/direct_sound_samples/cries/cry_wooper.wav new file mode 100644 index 000000000..280845b2b Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_wooper.wav differ diff --git a/sound/direct_sound_samples/cries/cry_wurmple.aif b/sound/direct_sound_samples/cries/cry_wurmple.aif deleted file mode 100644 index 6442a4063..000000000 Binary files a/sound/direct_sound_samples/cries/cry_wurmple.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_wurmple.wav b/sound/direct_sound_samples/cries/cry_wurmple.wav new file mode 100644 index 000000000..09ac95d59 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_wurmple.wav differ diff --git a/sound/direct_sound_samples/cries/cry_wynaut.aif b/sound/direct_sound_samples/cries/cry_wynaut.aif deleted file mode 100644 index 798732c74..000000000 Binary files a/sound/direct_sound_samples/cries/cry_wynaut.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_wynaut.wav b/sound/direct_sound_samples/cries/cry_wynaut.wav new file mode 100644 index 000000000..dcdc2b339 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_wynaut.wav differ diff --git a/sound/direct_sound_samples/cries/cry_xatu.aif b/sound/direct_sound_samples/cries/cry_xatu.aif deleted file mode 100644 index ac758fdbf..000000000 Binary files a/sound/direct_sound_samples/cries/cry_xatu.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_xatu.wav b/sound/direct_sound_samples/cries/cry_xatu.wav new file mode 100644 index 000000000..47c470c4c Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_xatu.wav differ diff --git a/sound/direct_sound_samples/cries/cry_yanma.aif b/sound/direct_sound_samples/cries/cry_yanma.aif deleted file mode 100644 index df76534c5..000000000 Binary files a/sound/direct_sound_samples/cries/cry_yanma.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_yanma.wav b/sound/direct_sound_samples/cries/cry_yanma.wav new file mode 100644 index 000000000..3fea5ab36 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_yanma.wav differ diff --git a/sound/direct_sound_samples/cries/cry_zangoose.aif b/sound/direct_sound_samples/cries/cry_zangoose.aif deleted file mode 100644 index ce1622043..000000000 Binary files a/sound/direct_sound_samples/cries/cry_zangoose.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_zangoose.wav b/sound/direct_sound_samples/cries/cry_zangoose.wav new file mode 100644 index 000000000..f4b564ba3 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_zangoose.wav differ diff --git a/sound/direct_sound_samples/cries/cry_zapdos.aif b/sound/direct_sound_samples/cries/cry_zapdos.aif deleted file mode 100644 index a8d914d14..000000000 Binary files a/sound/direct_sound_samples/cries/cry_zapdos.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_zapdos.wav b/sound/direct_sound_samples/cries/cry_zapdos.wav new file mode 100644 index 000000000..f8168a603 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_zapdos.wav differ diff --git a/sound/direct_sound_samples/cries/cry_zigzagoon.aif b/sound/direct_sound_samples/cries/cry_zigzagoon.aif deleted file mode 100644 index 52b9bb4f4..000000000 Binary files a/sound/direct_sound_samples/cries/cry_zigzagoon.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_zigzagoon.wav b/sound/direct_sound_samples/cries/cry_zigzagoon.wav new file mode 100644 index 000000000..fca81cf0f Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_zigzagoon.wav differ diff --git a/sound/direct_sound_samples/cries/cry_zubat.aif b/sound/direct_sound_samples/cries/cry_zubat.aif deleted file mode 100644 index 45036d072..000000000 Binary files a/sound/direct_sound_samples/cries/cry_zubat.aif and /dev/null differ diff --git a/sound/direct_sound_samples/cries/cry_zubat.wav b/sound/direct_sound_samples/cries/cry_zubat.wav new file mode 100644 index 000000000..58c0c16e5 Binary files /dev/null and b/sound/direct_sound_samples/cries/cry_zubat.wav differ diff --git a/sound/direct_sound_samples/phonemes/vowel_1.aif b/sound/direct_sound_samples/phonemes/vowel_1.aif deleted file mode 100644 index 9521d0b6e..000000000 Binary files a/sound/direct_sound_samples/phonemes/vowel_1.aif and /dev/null differ diff --git a/sound/direct_sound_samples/phonemes/vowel_1.wav b/sound/direct_sound_samples/phonemes/vowel_1.wav new file mode 100644 index 000000000..39d75f2de Binary files /dev/null and b/sound/direct_sound_samples/phonemes/vowel_1.wav differ diff --git a/sound/direct_sound_samples/phonemes/vowel_10.aif b/sound/direct_sound_samples/phonemes/vowel_10.aif deleted file mode 100644 index 3b136fa43..000000000 Binary files a/sound/direct_sound_samples/phonemes/vowel_10.aif and /dev/null differ diff --git a/sound/direct_sound_samples/phonemes/vowel_10.wav b/sound/direct_sound_samples/phonemes/vowel_10.wav new file mode 100644 index 000000000..ecba93ebf Binary files /dev/null and b/sound/direct_sound_samples/phonemes/vowel_10.wav differ diff --git a/sound/direct_sound_samples/phonemes/vowel_11.aif b/sound/direct_sound_samples/phonemes/vowel_11.aif deleted file mode 100644 index fd72512cf..000000000 Binary files a/sound/direct_sound_samples/phonemes/vowel_11.aif and /dev/null differ diff --git a/sound/direct_sound_samples/phonemes/vowel_11.wav b/sound/direct_sound_samples/phonemes/vowel_11.wav new file mode 100644 index 000000000..d7726826a Binary files /dev/null and b/sound/direct_sound_samples/phonemes/vowel_11.wav differ diff --git a/sound/direct_sound_samples/phonemes/vowel_12.aif b/sound/direct_sound_samples/phonemes/vowel_12.aif deleted file mode 100644 index 6f7794bec..000000000 Binary files a/sound/direct_sound_samples/phonemes/vowel_12.aif and /dev/null differ diff --git a/sound/direct_sound_samples/phonemes/vowel_12.wav b/sound/direct_sound_samples/phonemes/vowel_12.wav new file mode 100644 index 000000000..003448504 Binary files /dev/null and b/sound/direct_sound_samples/phonemes/vowel_12.wav differ diff --git a/sound/direct_sound_samples/phonemes/vowel_13.aif b/sound/direct_sound_samples/phonemes/vowel_13.aif deleted file mode 100644 index 89b845f21..000000000 Binary files a/sound/direct_sound_samples/phonemes/vowel_13.aif and /dev/null differ diff --git a/sound/direct_sound_samples/phonemes/vowel_13.wav b/sound/direct_sound_samples/phonemes/vowel_13.wav new file mode 100644 index 000000000..5ed58e701 Binary files /dev/null and b/sound/direct_sound_samples/phonemes/vowel_13.wav differ diff --git a/sound/direct_sound_samples/phonemes/vowel_14.aif b/sound/direct_sound_samples/phonemes/vowel_14.aif deleted file mode 100644 index 1d99a3a93..000000000 Binary files a/sound/direct_sound_samples/phonemes/vowel_14.aif and /dev/null differ diff --git a/sound/direct_sound_samples/phonemes/vowel_14.wav b/sound/direct_sound_samples/phonemes/vowel_14.wav new file mode 100644 index 000000000..c353b5c50 Binary files /dev/null and b/sound/direct_sound_samples/phonemes/vowel_14.wav differ diff --git a/sound/direct_sound_samples/phonemes/vowel_15.aif b/sound/direct_sound_samples/phonemes/vowel_15.aif deleted file mode 100644 index 883398129..000000000 Binary files a/sound/direct_sound_samples/phonemes/vowel_15.aif and /dev/null differ diff --git a/sound/direct_sound_samples/phonemes/vowel_15.wav b/sound/direct_sound_samples/phonemes/vowel_15.wav new file mode 100644 index 000000000..b0eb9bd4b Binary files /dev/null and b/sound/direct_sound_samples/phonemes/vowel_15.wav differ diff --git a/sound/direct_sound_samples/phonemes/vowel_16.aif b/sound/direct_sound_samples/phonemes/vowel_16.aif deleted file mode 100644 index 776815e63..000000000 Binary files a/sound/direct_sound_samples/phonemes/vowel_16.aif and /dev/null differ diff --git a/sound/direct_sound_samples/phonemes/vowel_16.wav b/sound/direct_sound_samples/phonemes/vowel_16.wav new file mode 100644 index 000000000..e931a7d9d Binary files /dev/null and b/sound/direct_sound_samples/phonemes/vowel_16.wav differ diff --git a/sound/direct_sound_samples/phonemes/vowel_17.aif b/sound/direct_sound_samples/phonemes/vowel_17.aif deleted file mode 100644 index 545bd1292..000000000 Binary files a/sound/direct_sound_samples/phonemes/vowel_17.aif and /dev/null differ diff --git a/sound/direct_sound_samples/phonemes/vowel_17.wav b/sound/direct_sound_samples/phonemes/vowel_17.wav new file mode 100644 index 000000000..949865e64 Binary files /dev/null and b/sound/direct_sound_samples/phonemes/vowel_17.wav differ diff --git a/sound/direct_sound_samples/phonemes/vowel_18.aif b/sound/direct_sound_samples/phonemes/vowel_18.aif deleted file mode 100644 index c0a3be10d..000000000 Binary files a/sound/direct_sound_samples/phonemes/vowel_18.aif and /dev/null differ diff --git a/sound/direct_sound_samples/phonemes/vowel_18.wav b/sound/direct_sound_samples/phonemes/vowel_18.wav new file mode 100644 index 000000000..573867ca9 Binary files /dev/null and b/sound/direct_sound_samples/phonemes/vowel_18.wav differ diff --git a/sound/direct_sound_samples/phonemes/vowel_19.aif b/sound/direct_sound_samples/phonemes/vowel_19.aif deleted file mode 100644 index d26ecdd6d..000000000 Binary files a/sound/direct_sound_samples/phonemes/vowel_19.aif and /dev/null differ diff --git a/sound/direct_sound_samples/phonemes/vowel_19.wav b/sound/direct_sound_samples/phonemes/vowel_19.wav new file mode 100644 index 000000000..a4629fa1d Binary files /dev/null and b/sound/direct_sound_samples/phonemes/vowel_19.wav differ diff --git a/sound/direct_sound_samples/phonemes/vowel_2.aif b/sound/direct_sound_samples/phonemes/vowel_2.aif deleted file mode 100644 index 2519572e2..000000000 Binary files a/sound/direct_sound_samples/phonemes/vowel_2.aif and /dev/null differ diff --git a/sound/direct_sound_samples/phonemes/vowel_2.wav b/sound/direct_sound_samples/phonemes/vowel_2.wav new file mode 100644 index 000000000..79fe36dc1 Binary files /dev/null and b/sound/direct_sound_samples/phonemes/vowel_2.wav differ diff --git a/sound/direct_sound_samples/phonemes/vowel_20.aif b/sound/direct_sound_samples/phonemes/vowel_20.aif deleted file mode 100644 index 2b51201a4..000000000 Binary files a/sound/direct_sound_samples/phonemes/vowel_20.aif and /dev/null differ diff --git a/sound/direct_sound_samples/phonemes/vowel_20.wav b/sound/direct_sound_samples/phonemes/vowel_20.wav new file mode 100644 index 000000000..d6ae4c4bc Binary files /dev/null and b/sound/direct_sound_samples/phonemes/vowel_20.wav differ diff --git a/sound/direct_sound_samples/phonemes/vowel_21.aif b/sound/direct_sound_samples/phonemes/vowel_21.aif deleted file mode 100644 index cf5ac4e03..000000000 Binary files a/sound/direct_sound_samples/phonemes/vowel_21.aif and /dev/null differ diff --git a/sound/direct_sound_samples/phonemes/vowel_21.wav b/sound/direct_sound_samples/phonemes/vowel_21.wav new file mode 100644 index 000000000..80ac82c0e Binary files /dev/null and b/sound/direct_sound_samples/phonemes/vowel_21.wav differ diff --git a/sound/direct_sound_samples/phonemes/vowel_22.aif b/sound/direct_sound_samples/phonemes/vowel_22.aif deleted file mode 100644 index 606742e60..000000000 Binary files a/sound/direct_sound_samples/phonemes/vowel_22.aif and /dev/null differ diff --git a/sound/direct_sound_samples/phonemes/vowel_22.wav b/sound/direct_sound_samples/phonemes/vowel_22.wav new file mode 100644 index 000000000..451b571f8 Binary files /dev/null and b/sound/direct_sound_samples/phonemes/vowel_22.wav differ diff --git a/sound/direct_sound_samples/phonemes/vowel_23.aif b/sound/direct_sound_samples/phonemes/vowel_23.aif deleted file mode 100644 index 71d4987d6..000000000 Binary files a/sound/direct_sound_samples/phonemes/vowel_23.aif and /dev/null differ diff --git a/sound/direct_sound_samples/phonemes/vowel_23.wav b/sound/direct_sound_samples/phonemes/vowel_23.wav new file mode 100644 index 000000000..79ddc5e75 Binary files /dev/null and b/sound/direct_sound_samples/phonemes/vowel_23.wav differ diff --git a/sound/direct_sound_samples/phonemes/vowel_24.aif b/sound/direct_sound_samples/phonemes/vowel_24.aif deleted file mode 100644 index 070c44a37..000000000 Binary files a/sound/direct_sound_samples/phonemes/vowel_24.aif and /dev/null differ diff --git a/sound/direct_sound_samples/phonemes/vowel_24.wav b/sound/direct_sound_samples/phonemes/vowel_24.wav new file mode 100644 index 000000000..5bff7c6b9 Binary files /dev/null and b/sound/direct_sound_samples/phonemes/vowel_24.wav differ diff --git a/sound/direct_sound_samples/phonemes/vowel_25.aif b/sound/direct_sound_samples/phonemes/vowel_25.aif deleted file mode 100644 index b0ca84a38..000000000 Binary files a/sound/direct_sound_samples/phonemes/vowel_25.aif and /dev/null differ diff --git a/sound/direct_sound_samples/phonemes/vowel_25.wav b/sound/direct_sound_samples/phonemes/vowel_25.wav new file mode 100644 index 000000000..5f846bea0 Binary files /dev/null and b/sound/direct_sound_samples/phonemes/vowel_25.wav differ diff --git a/sound/direct_sound_samples/phonemes/vowel_26.aif b/sound/direct_sound_samples/phonemes/vowel_26.aif deleted file mode 100644 index f44101b23..000000000 Binary files a/sound/direct_sound_samples/phonemes/vowel_26.aif and /dev/null differ diff --git a/sound/direct_sound_samples/phonemes/vowel_26.wav b/sound/direct_sound_samples/phonemes/vowel_26.wav new file mode 100644 index 000000000..e79694f65 Binary files /dev/null and b/sound/direct_sound_samples/phonemes/vowel_26.wav differ diff --git a/sound/direct_sound_samples/phonemes/vowel_27.aif b/sound/direct_sound_samples/phonemes/vowel_27.aif deleted file mode 100644 index a33809d42..000000000 Binary files a/sound/direct_sound_samples/phonemes/vowel_27.aif and /dev/null differ diff --git a/sound/direct_sound_samples/phonemes/vowel_27.wav b/sound/direct_sound_samples/phonemes/vowel_27.wav new file mode 100644 index 000000000..b399a3bd5 Binary files /dev/null and b/sound/direct_sound_samples/phonemes/vowel_27.wav differ diff --git a/sound/direct_sound_samples/phonemes/vowel_28.aif b/sound/direct_sound_samples/phonemes/vowel_28.aif deleted file mode 100644 index 6a005efcc..000000000 Binary files a/sound/direct_sound_samples/phonemes/vowel_28.aif and /dev/null differ diff --git a/sound/direct_sound_samples/phonemes/vowel_28.wav b/sound/direct_sound_samples/phonemes/vowel_28.wav new file mode 100644 index 000000000..13f47560d Binary files /dev/null and b/sound/direct_sound_samples/phonemes/vowel_28.wav differ diff --git a/sound/direct_sound_samples/phonemes/vowel_29.aif b/sound/direct_sound_samples/phonemes/vowel_29.aif deleted file mode 100644 index 62f9493fd..000000000 Binary files a/sound/direct_sound_samples/phonemes/vowel_29.aif and /dev/null differ diff --git a/sound/direct_sound_samples/phonemes/vowel_29.wav b/sound/direct_sound_samples/phonemes/vowel_29.wav new file mode 100644 index 000000000..f399a12fe Binary files /dev/null and b/sound/direct_sound_samples/phonemes/vowel_29.wav differ diff --git a/sound/direct_sound_samples/phonemes/vowel_3.aif b/sound/direct_sound_samples/phonemes/vowel_3.aif deleted file mode 100644 index d411e6612..000000000 Binary files a/sound/direct_sound_samples/phonemes/vowel_3.aif and /dev/null differ diff --git a/sound/direct_sound_samples/phonemes/vowel_3.wav b/sound/direct_sound_samples/phonemes/vowel_3.wav new file mode 100644 index 000000000..2a44425a5 Binary files /dev/null and b/sound/direct_sound_samples/phonemes/vowel_3.wav differ diff --git a/sound/direct_sound_samples/phonemes/vowel_30.aif b/sound/direct_sound_samples/phonemes/vowel_30.aif deleted file mode 100644 index 5767bd6d9..000000000 Binary files a/sound/direct_sound_samples/phonemes/vowel_30.aif and /dev/null differ diff --git a/sound/direct_sound_samples/phonemes/vowel_30.wav b/sound/direct_sound_samples/phonemes/vowel_30.wav new file mode 100644 index 000000000..f7d92b633 Binary files /dev/null and b/sound/direct_sound_samples/phonemes/vowel_30.wav differ diff --git a/sound/direct_sound_samples/phonemes/vowel_31.aif b/sound/direct_sound_samples/phonemes/vowel_31.aif deleted file mode 100644 index 33e328a82..000000000 Binary files a/sound/direct_sound_samples/phonemes/vowel_31.aif and /dev/null differ diff --git a/sound/direct_sound_samples/phonemes/vowel_31.wav b/sound/direct_sound_samples/phonemes/vowel_31.wav new file mode 100644 index 000000000..429f608fb Binary files /dev/null and b/sound/direct_sound_samples/phonemes/vowel_31.wav differ diff --git a/sound/direct_sound_samples/phonemes/vowel_32.aif b/sound/direct_sound_samples/phonemes/vowel_32.aif deleted file mode 100644 index 548e740c8..000000000 Binary files a/sound/direct_sound_samples/phonemes/vowel_32.aif and /dev/null differ diff --git a/sound/direct_sound_samples/phonemes/vowel_32.wav b/sound/direct_sound_samples/phonemes/vowel_32.wav new file mode 100644 index 000000000..032ab3fd3 Binary files /dev/null and b/sound/direct_sound_samples/phonemes/vowel_32.wav differ diff --git a/sound/direct_sound_samples/phonemes/vowel_33.aif b/sound/direct_sound_samples/phonemes/vowel_33.aif deleted file mode 100644 index cbbe09266..000000000 Binary files a/sound/direct_sound_samples/phonemes/vowel_33.aif and /dev/null differ diff --git a/sound/direct_sound_samples/phonemes/vowel_33.wav b/sound/direct_sound_samples/phonemes/vowel_33.wav new file mode 100644 index 000000000..73589258c Binary files /dev/null and b/sound/direct_sound_samples/phonemes/vowel_33.wav differ diff --git a/sound/direct_sound_samples/phonemes/vowel_34.aif b/sound/direct_sound_samples/phonemes/vowel_34.aif deleted file mode 100644 index 8bdf7faaa..000000000 Binary files a/sound/direct_sound_samples/phonemes/vowel_34.aif and /dev/null differ diff --git a/sound/direct_sound_samples/phonemes/vowel_34.wav b/sound/direct_sound_samples/phonemes/vowel_34.wav new file mode 100644 index 000000000..4050d3511 Binary files /dev/null and b/sound/direct_sound_samples/phonemes/vowel_34.wav differ diff --git a/sound/direct_sound_samples/phonemes/vowel_35.aif b/sound/direct_sound_samples/phonemes/vowel_35.aif deleted file mode 100644 index f96f8853b..000000000 Binary files a/sound/direct_sound_samples/phonemes/vowel_35.aif and /dev/null differ diff --git a/sound/direct_sound_samples/phonemes/vowel_35.wav b/sound/direct_sound_samples/phonemes/vowel_35.wav new file mode 100644 index 000000000..ae48eac22 Binary files /dev/null and b/sound/direct_sound_samples/phonemes/vowel_35.wav differ diff --git a/sound/direct_sound_samples/phonemes/vowel_36.aif b/sound/direct_sound_samples/phonemes/vowel_36.aif deleted file mode 100644 index ab9abbf79..000000000 Binary files a/sound/direct_sound_samples/phonemes/vowel_36.aif and /dev/null differ diff --git a/sound/direct_sound_samples/phonemes/vowel_36.wav b/sound/direct_sound_samples/phonemes/vowel_36.wav new file mode 100644 index 000000000..fd76403a0 Binary files /dev/null and b/sound/direct_sound_samples/phonemes/vowel_36.wav differ diff --git a/sound/direct_sound_samples/phonemes/vowel_37.aif b/sound/direct_sound_samples/phonemes/vowel_37.aif deleted file mode 100644 index 9d21d0ab4..000000000 Binary files a/sound/direct_sound_samples/phonemes/vowel_37.aif and /dev/null differ diff --git a/sound/direct_sound_samples/phonemes/vowel_37.wav b/sound/direct_sound_samples/phonemes/vowel_37.wav new file mode 100644 index 000000000..b43bba09a Binary files /dev/null and b/sound/direct_sound_samples/phonemes/vowel_37.wav differ diff --git a/sound/direct_sound_samples/phonemes/vowel_38.aif b/sound/direct_sound_samples/phonemes/vowel_38.aif deleted file mode 100644 index c037ed4af..000000000 Binary files a/sound/direct_sound_samples/phonemes/vowel_38.aif and /dev/null differ diff --git a/sound/direct_sound_samples/phonemes/vowel_38.wav b/sound/direct_sound_samples/phonemes/vowel_38.wav new file mode 100644 index 000000000..02599973e Binary files /dev/null and b/sound/direct_sound_samples/phonemes/vowel_38.wav differ diff --git a/sound/direct_sound_samples/phonemes/vowel_39.aif b/sound/direct_sound_samples/phonemes/vowel_39.aif deleted file mode 100644 index ac1f8b66f..000000000 Binary files a/sound/direct_sound_samples/phonemes/vowel_39.aif and /dev/null differ diff --git a/sound/direct_sound_samples/phonemes/vowel_39.wav b/sound/direct_sound_samples/phonemes/vowel_39.wav new file mode 100644 index 000000000..0a88ce09d Binary files /dev/null and b/sound/direct_sound_samples/phonemes/vowel_39.wav differ diff --git a/sound/direct_sound_samples/phonemes/vowel_4.aif b/sound/direct_sound_samples/phonemes/vowel_4.aif deleted file mode 100644 index 3bc1aa839..000000000 Binary files a/sound/direct_sound_samples/phonemes/vowel_4.aif and /dev/null differ diff --git a/sound/direct_sound_samples/phonemes/vowel_4.wav b/sound/direct_sound_samples/phonemes/vowel_4.wav new file mode 100644 index 000000000..d9a4ae6a4 Binary files /dev/null and b/sound/direct_sound_samples/phonemes/vowel_4.wav differ diff --git a/sound/direct_sound_samples/phonemes/vowel_40.aif b/sound/direct_sound_samples/phonemes/vowel_40.aif deleted file mode 100644 index 1fd9111c8..000000000 Binary files a/sound/direct_sound_samples/phonemes/vowel_40.aif and /dev/null differ diff --git a/sound/direct_sound_samples/phonemes/vowel_40.wav b/sound/direct_sound_samples/phonemes/vowel_40.wav new file mode 100644 index 000000000..145cf68e8 Binary files /dev/null and b/sound/direct_sound_samples/phonemes/vowel_40.wav differ diff --git a/sound/direct_sound_samples/phonemes/vowel_41.aif b/sound/direct_sound_samples/phonemes/vowel_41.aif deleted file mode 100644 index 5d6ae2282..000000000 Binary files a/sound/direct_sound_samples/phonemes/vowel_41.aif and /dev/null differ diff --git a/sound/direct_sound_samples/phonemes/vowel_41.wav b/sound/direct_sound_samples/phonemes/vowel_41.wav new file mode 100644 index 000000000..9c6543345 Binary files /dev/null and b/sound/direct_sound_samples/phonemes/vowel_41.wav differ diff --git a/sound/direct_sound_samples/phonemes/vowel_42.aif b/sound/direct_sound_samples/phonemes/vowel_42.aif deleted file mode 100644 index f26700690..000000000 Binary files a/sound/direct_sound_samples/phonemes/vowel_42.aif and /dev/null differ diff --git a/sound/direct_sound_samples/phonemes/vowel_42.wav b/sound/direct_sound_samples/phonemes/vowel_42.wav new file mode 100644 index 000000000..146528678 Binary files /dev/null and b/sound/direct_sound_samples/phonemes/vowel_42.wav differ diff --git a/sound/direct_sound_samples/phonemes/vowel_43.aif b/sound/direct_sound_samples/phonemes/vowel_43.aif deleted file mode 100644 index 3ba97a9fc..000000000 Binary files a/sound/direct_sound_samples/phonemes/vowel_43.aif and /dev/null differ diff --git a/sound/direct_sound_samples/phonemes/vowel_43.wav b/sound/direct_sound_samples/phonemes/vowel_43.wav new file mode 100644 index 000000000..9ecae8d50 Binary files /dev/null and b/sound/direct_sound_samples/phonemes/vowel_43.wav differ diff --git a/sound/direct_sound_samples/phonemes/vowel_44.aif b/sound/direct_sound_samples/phonemes/vowel_44.aif deleted file mode 100644 index 37f1be4b1..000000000 Binary files a/sound/direct_sound_samples/phonemes/vowel_44.aif and /dev/null differ diff --git a/sound/direct_sound_samples/phonemes/vowel_44.wav b/sound/direct_sound_samples/phonemes/vowel_44.wav new file mode 100644 index 000000000..49aaa6863 Binary files /dev/null and b/sound/direct_sound_samples/phonemes/vowel_44.wav differ diff --git a/sound/direct_sound_samples/phonemes/vowel_45.aif b/sound/direct_sound_samples/phonemes/vowel_45.aif deleted file mode 100644 index 4b3facb99..000000000 Binary files a/sound/direct_sound_samples/phonemes/vowel_45.aif and /dev/null differ diff --git a/sound/direct_sound_samples/phonemes/vowel_45.wav b/sound/direct_sound_samples/phonemes/vowel_45.wav new file mode 100644 index 000000000..89d0abc6f Binary files /dev/null and b/sound/direct_sound_samples/phonemes/vowel_45.wav differ diff --git a/sound/direct_sound_samples/phonemes/vowel_46.aif b/sound/direct_sound_samples/phonemes/vowel_46.aif deleted file mode 100644 index 8a4d7653b..000000000 Binary files a/sound/direct_sound_samples/phonemes/vowel_46.aif and /dev/null differ diff --git a/sound/direct_sound_samples/phonemes/vowel_46.wav b/sound/direct_sound_samples/phonemes/vowel_46.wav new file mode 100644 index 000000000..d6f65e912 Binary files /dev/null and b/sound/direct_sound_samples/phonemes/vowel_46.wav differ diff --git a/sound/direct_sound_samples/phonemes/vowel_47.aif b/sound/direct_sound_samples/phonemes/vowel_47.aif deleted file mode 100644 index db5bae244..000000000 Binary files a/sound/direct_sound_samples/phonemes/vowel_47.aif and /dev/null differ diff --git a/sound/direct_sound_samples/phonemes/vowel_47.wav b/sound/direct_sound_samples/phonemes/vowel_47.wav new file mode 100644 index 000000000..917ca8a16 Binary files /dev/null and b/sound/direct_sound_samples/phonemes/vowel_47.wav differ diff --git a/sound/direct_sound_samples/phonemes/vowel_48.aif b/sound/direct_sound_samples/phonemes/vowel_48.aif deleted file mode 100644 index 6612dd54d..000000000 Binary files a/sound/direct_sound_samples/phonemes/vowel_48.aif and /dev/null differ diff --git a/sound/direct_sound_samples/phonemes/vowel_48.wav b/sound/direct_sound_samples/phonemes/vowel_48.wav new file mode 100644 index 000000000..a97bbadcb Binary files /dev/null and b/sound/direct_sound_samples/phonemes/vowel_48.wav differ diff --git a/sound/direct_sound_samples/phonemes/vowel_49.aif b/sound/direct_sound_samples/phonemes/vowel_49.aif deleted file mode 100644 index 441eecfcd..000000000 Binary files a/sound/direct_sound_samples/phonemes/vowel_49.aif and /dev/null differ diff --git a/sound/direct_sound_samples/phonemes/vowel_49.wav b/sound/direct_sound_samples/phonemes/vowel_49.wav new file mode 100644 index 000000000..8b7392277 Binary files /dev/null and b/sound/direct_sound_samples/phonemes/vowel_49.wav differ diff --git a/sound/direct_sound_samples/phonemes/vowel_5.aif b/sound/direct_sound_samples/phonemes/vowel_5.aif deleted file mode 100644 index 3bacf3676..000000000 Binary files a/sound/direct_sound_samples/phonemes/vowel_5.aif and /dev/null differ diff --git a/sound/direct_sound_samples/phonemes/vowel_5.wav b/sound/direct_sound_samples/phonemes/vowel_5.wav new file mode 100644 index 000000000..a13c322bf Binary files /dev/null and b/sound/direct_sound_samples/phonemes/vowel_5.wav differ diff --git a/sound/direct_sound_samples/phonemes/vowel_50.aif b/sound/direct_sound_samples/phonemes/vowel_50.aif deleted file mode 100644 index 95670cf0a..000000000 Binary files a/sound/direct_sound_samples/phonemes/vowel_50.aif and /dev/null differ diff --git a/sound/direct_sound_samples/phonemes/vowel_50.wav b/sound/direct_sound_samples/phonemes/vowel_50.wav new file mode 100644 index 000000000..4b412698b Binary files /dev/null and b/sound/direct_sound_samples/phonemes/vowel_50.wav differ diff --git a/sound/direct_sound_samples/phonemes/vowel_51.aif b/sound/direct_sound_samples/phonemes/vowel_51.aif deleted file mode 100644 index 0fadcba8e..000000000 Binary files a/sound/direct_sound_samples/phonemes/vowel_51.aif and /dev/null differ diff --git a/sound/direct_sound_samples/phonemes/vowel_51.wav b/sound/direct_sound_samples/phonemes/vowel_51.wav new file mode 100644 index 000000000..0e2bfb567 Binary files /dev/null and b/sound/direct_sound_samples/phonemes/vowel_51.wav differ diff --git a/sound/direct_sound_samples/phonemes/vowel_52.aif b/sound/direct_sound_samples/phonemes/vowel_52.aif deleted file mode 100644 index 6017c55b4..000000000 Binary files a/sound/direct_sound_samples/phonemes/vowel_52.aif and /dev/null differ diff --git a/sound/direct_sound_samples/phonemes/vowel_52.wav b/sound/direct_sound_samples/phonemes/vowel_52.wav new file mode 100644 index 000000000..589cc1cd1 Binary files /dev/null and b/sound/direct_sound_samples/phonemes/vowel_52.wav differ diff --git a/sound/direct_sound_samples/phonemes/vowel_53.aif b/sound/direct_sound_samples/phonemes/vowel_53.aif deleted file mode 100644 index 2327b6d65..000000000 Binary files a/sound/direct_sound_samples/phonemes/vowel_53.aif and /dev/null differ diff --git a/sound/direct_sound_samples/phonemes/vowel_53.wav b/sound/direct_sound_samples/phonemes/vowel_53.wav new file mode 100644 index 000000000..45668adda Binary files /dev/null and b/sound/direct_sound_samples/phonemes/vowel_53.wav differ diff --git a/sound/direct_sound_samples/phonemes/vowel_54.aif b/sound/direct_sound_samples/phonemes/vowel_54.aif deleted file mode 100644 index 19ceca0d0..000000000 Binary files a/sound/direct_sound_samples/phonemes/vowel_54.aif and /dev/null differ diff --git a/sound/direct_sound_samples/phonemes/vowel_54.wav b/sound/direct_sound_samples/phonemes/vowel_54.wav new file mode 100644 index 000000000..d4ad0fec8 Binary files /dev/null and b/sound/direct_sound_samples/phonemes/vowel_54.wav differ diff --git a/sound/direct_sound_samples/phonemes/vowel_55.aif b/sound/direct_sound_samples/phonemes/vowel_55.aif deleted file mode 100644 index 8438d301a..000000000 Binary files a/sound/direct_sound_samples/phonemes/vowel_55.aif and /dev/null differ diff --git a/sound/direct_sound_samples/phonemes/vowel_55.wav b/sound/direct_sound_samples/phonemes/vowel_55.wav new file mode 100644 index 000000000..f9f949503 Binary files /dev/null and b/sound/direct_sound_samples/phonemes/vowel_55.wav differ diff --git a/sound/direct_sound_samples/phonemes/vowel_56.aif b/sound/direct_sound_samples/phonemes/vowel_56.aif deleted file mode 100644 index 74d4bcf4a..000000000 Binary files a/sound/direct_sound_samples/phonemes/vowel_56.aif and /dev/null differ diff --git a/sound/direct_sound_samples/phonemes/vowel_56.wav b/sound/direct_sound_samples/phonemes/vowel_56.wav new file mode 100644 index 000000000..bdb57f46e Binary files /dev/null and b/sound/direct_sound_samples/phonemes/vowel_56.wav differ diff --git a/sound/direct_sound_samples/phonemes/vowel_57.aif b/sound/direct_sound_samples/phonemes/vowel_57.aif deleted file mode 100644 index dfef8a82b..000000000 Binary files a/sound/direct_sound_samples/phonemes/vowel_57.aif and /dev/null differ diff --git a/sound/direct_sound_samples/phonemes/vowel_57.wav b/sound/direct_sound_samples/phonemes/vowel_57.wav new file mode 100644 index 000000000..9c734aaba Binary files /dev/null and b/sound/direct_sound_samples/phonemes/vowel_57.wav differ diff --git a/sound/direct_sound_samples/phonemes/vowel_6.aif b/sound/direct_sound_samples/phonemes/vowel_6.aif deleted file mode 100644 index 5ddaa153d..000000000 Binary files a/sound/direct_sound_samples/phonemes/vowel_6.aif and /dev/null differ diff --git a/sound/direct_sound_samples/phonemes/vowel_6.wav b/sound/direct_sound_samples/phonemes/vowel_6.wav new file mode 100644 index 000000000..639dd8fcc Binary files /dev/null and b/sound/direct_sound_samples/phonemes/vowel_6.wav differ diff --git a/sound/direct_sound_samples/phonemes/vowel_7.aif b/sound/direct_sound_samples/phonemes/vowel_7.aif deleted file mode 100644 index 4b15a94b7..000000000 Binary files a/sound/direct_sound_samples/phonemes/vowel_7.aif and /dev/null differ diff --git a/sound/direct_sound_samples/phonemes/vowel_7.wav b/sound/direct_sound_samples/phonemes/vowel_7.wav new file mode 100644 index 000000000..ebc90ac2f Binary files /dev/null and b/sound/direct_sound_samples/phonemes/vowel_7.wav differ diff --git a/sound/direct_sound_samples/phonemes/vowel_8.aif b/sound/direct_sound_samples/phonemes/vowel_8.aif deleted file mode 100644 index 74c129073..000000000 Binary files a/sound/direct_sound_samples/phonemes/vowel_8.aif and /dev/null differ diff --git a/sound/direct_sound_samples/phonemes/vowel_8.wav b/sound/direct_sound_samples/phonemes/vowel_8.wav new file mode 100644 index 000000000..4c6bdbff7 Binary files /dev/null and b/sound/direct_sound_samples/phonemes/vowel_8.wav differ diff --git a/sound/direct_sound_samples/phonemes/vowel_9.aif b/sound/direct_sound_samples/phonemes/vowel_9.aif deleted file mode 100644 index 359972c16..000000000 Binary files a/sound/direct_sound_samples/phonemes/vowel_9.aif and /dev/null differ diff --git a/sound/direct_sound_samples/phonemes/vowel_9.wav b/sound/direct_sound_samples/phonemes/vowel_9.wav new file mode 100644 index 000000000..d2e993437 Binary files /dev/null and b/sound/direct_sound_samples/phonemes/vowel_9.wav differ diff --git a/sound/direct_sound_samples/synth/848A8A4.aif b/sound/direct_sound_samples/synth/848A8A4.aif deleted file mode 100644 index ee6ff45b7..000000000 Binary files a/sound/direct_sound_samples/synth/848A8A4.aif and /dev/null differ diff --git a/sound/direct_sound_samples/synth/848A8A4.wav b/sound/direct_sound_samples/synth/848A8A4.wav new file mode 100644 index 000000000..4e069d0bf Binary files /dev/null and b/sound/direct_sound_samples/synth/848A8A4.wav differ diff --git a/sound/direct_sound_samples/synth/848F448.aif b/sound/direct_sound_samples/synth/848F448.aif deleted file mode 100644 index 5c55d91ed..000000000 Binary files a/sound/direct_sound_samples/synth/848F448.aif and /dev/null differ diff --git a/sound/direct_sound_samples/synth/848F448.wav b/sound/direct_sound_samples/synth/848F448.wav new file mode 100644 index 000000000..d2d216aa9 Binary files /dev/null and b/sound/direct_sound_samples/synth/848F448.wav differ diff --git a/sound/direct_sound_samples/synth/8493D20.aif b/sound/direct_sound_samples/synth/8493D20.aif deleted file mode 100644 index 515818a4d..000000000 Binary files a/sound/direct_sound_samples/synth/8493D20.aif and /dev/null differ diff --git a/sound/direct_sound_samples/synth/8493D20.wav b/sound/direct_sound_samples/synth/8493D20.wav new file mode 100644 index 000000000..c344cc5c6 Binary files /dev/null and b/sound/direct_sound_samples/synth/8493D20.wav differ diff --git a/sound/direct_sound_samples/synth/8495028.aif b/sound/direct_sound_samples/synth/8495028.aif deleted file mode 100644 index 102830efa..000000000 Binary files a/sound/direct_sound_samples/synth/8495028.aif and /dev/null differ diff --git a/sound/direct_sound_samples/synth/8495028.wav b/sound/direct_sound_samples/synth/8495028.wav new file mode 100644 index 000000000..01ac24db5 Binary files /dev/null and b/sound/direct_sound_samples/synth/8495028.wav differ diff --git a/sound/direct_sound_samples/synth/8499110.aif b/sound/direct_sound_samples/synth/8499110.aif deleted file mode 100644 index 556be0238..000000000 Binary files a/sound/direct_sound_samples/synth/8499110.aif and /dev/null differ diff --git a/sound/direct_sound_samples/synth/8499110.wav b/sound/direct_sound_samples/synth/8499110.wav new file mode 100644 index 000000000..437393e8b Binary files /dev/null and b/sound/direct_sound_samples/synth/8499110.wav differ diff --git a/sound/direct_sound_samples/synth/849B320.aif b/sound/direct_sound_samples/synth/849B320.aif deleted file mode 100644 index dd80b1185..000000000 Binary files a/sound/direct_sound_samples/synth/849B320.aif and /dev/null differ diff --git a/sound/direct_sound_samples/synth/849B320.wav b/sound/direct_sound_samples/synth/849B320.wav new file mode 100644 index 000000000..70fbefc21 Binary files /dev/null and b/sound/direct_sound_samples/synth/849B320.wav differ diff --git a/sound/direct_sound_samples/synth/849D45C.aif b/sound/direct_sound_samples/synth/849D45C.aif deleted file mode 100644 index ebd46eeaa..000000000 Binary files a/sound/direct_sound_samples/synth/849D45C.aif and /dev/null differ diff --git a/sound/direct_sound_samples/synth/849D45C.wav b/sound/direct_sound_samples/synth/849D45C.wav new file mode 100644 index 000000000..1ed463a66 Binary files /dev/null and b/sound/direct_sound_samples/synth/849D45C.wav differ diff --git a/sound/direct_sound_samples/synth/84A3B50.aif b/sound/direct_sound_samples/synth/84A3B50.aif deleted file mode 100644 index 6a11945c5..000000000 Binary files a/sound/direct_sound_samples/synth/84A3B50.aif and /dev/null differ diff --git a/sound/direct_sound_samples/synth/84A3B50.wav b/sound/direct_sound_samples/synth/84A3B50.wav new file mode 100644 index 000000000..5732a06ed Binary files /dev/null and b/sound/direct_sound_samples/synth/84A3B50.wav differ diff --git a/sound/direct_sound_samples/synth/84A5690.aif b/sound/direct_sound_samples/synth/84A5690.aif deleted file mode 100644 index a0fb49f89..000000000 Binary files a/sound/direct_sound_samples/synth/84A5690.aif and /dev/null differ diff --git a/sound/direct_sound_samples/synth/84A5690.wav b/sound/direct_sound_samples/synth/84A5690.wav new file mode 100644 index 000000000..e911c04a9 Binary files /dev/null and b/sound/direct_sound_samples/synth/84A5690.wav differ diff --git a/sound/direct_sound_samples/synth/bicycle_bell.aif b/sound/direct_sound_samples/synth/bicycle_bell.aif deleted file mode 100644 index 578a81c2f..000000000 Binary files a/sound/direct_sound_samples/synth/bicycle_bell.aif and /dev/null differ diff --git a/sound/direct_sound_samples/synth/bicycle_bell.wav b/sound/direct_sound_samples/synth/bicycle_bell.wav new file mode 100644 index 000000000..d07fcceec Binary files /dev/null and b/sound/direct_sound_samples/synth/bicycle_bell.wav differ diff --git a/sound/direct_sound_samples/synth/machine_sound1.aif b/sound/direct_sound_samples/synth/machine_sound1.aif deleted file mode 100644 index 49f24936f..000000000 Binary files a/sound/direct_sound_samples/synth/machine_sound1.aif and /dev/null differ diff --git a/sound/direct_sound_samples/synth/machine_sound1.wav b/sound/direct_sound_samples/synth/machine_sound1.wav new file mode 100644 index 000000000..922f43db1 Binary files /dev/null and b/sound/direct_sound_samples/synth/machine_sound1.wav differ diff --git a/sound/direct_sound_samples/synth/machine_sound2.aif b/sound/direct_sound_samples/synth/machine_sound2.aif deleted file mode 100644 index 2e09d0822..000000000 Binary files a/sound/direct_sound_samples/synth/machine_sound2.aif and /dev/null differ diff --git a/sound/direct_sound_samples/synth/machine_sound2.wav b/sound/direct_sound_samples/synth/machine_sound2.wav new file mode 100644 index 000000000..7c87e021b Binary files /dev/null and b/sound/direct_sound_samples/synth/machine_sound2.wav differ diff --git a/sound/direct_sound_samples/synth/sc88pro_accordion.aif b/sound/direct_sound_samples/synth/sc88pro_accordion.aif deleted file mode 100644 index 6d6c2e998..000000000 Binary files a/sound/direct_sound_samples/synth/sc88pro_accordion.aif and /dev/null differ diff --git a/sound/direct_sound_samples/synth/sc88pro_accordion.wav b/sound/direct_sound_samples/synth/sc88pro_accordion.wav new file mode 100644 index 000000000..1b28fa0e6 Binary files /dev/null and b/sound/direct_sound_samples/synth/sc88pro_accordion.wav differ diff --git a/sound/direct_sound_samples/synth/sc88pro_accordion_duplicate.aif b/sound/direct_sound_samples/synth/sc88pro_accordion_duplicate.aif deleted file mode 100644 index 6d6c2e998..000000000 Binary files a/sound/direct_sound_samples/synth/sc88pro_accordion_duplicate.aif and /dev/null differ diff --git a/sound/direct_sound_samples/synth/sc88pro_accordion_duplicate.wav b/sound/direct_sound_samples/synth/sc88pro_accordion_duplicate.wav new file mode 100644 index 000000000..1b28fa0e6 Binary files /dev/null and b/sound/direct_sound_samples/synth/sc88pro_accordion_duplicate.wav differ diff --git a/sound/direct_sound_samples/synth/sc88pro_bubbles.aif b/sound/direct_sound_samples/synth/sc88pro_bubbles.aif deleted file mode 100644 index 89872bf55..000000000 Binary files a/sound/direct_sound_samples/synth/sc88pro_bubbles.aif and /dev/null differ diff --git a/sound/direct_sound_samples/synth/sc88pro_bubbles.wav b/sound/direct_sound_samples/synth/sc88pro_bubbles.wav new file mode 100644 index 000000000..17d3eaa64 Binary files /dev/null and b/sound/direct_sound_samples/synth/sc88pro_bubbles.wav differ diff --git a/sound/direct_sound_samples/synth/sc88pro_fingered_bass.aif b/sound/direct_sound_samples/synth/sc88pro_fingered_bass.aif deleted file mode 100644 index f244a9982..000000000 Binary files a/sound/direct_sound_samples/synth/sc88pro_fingered_bass.aif and /dev/null differ diff --git a/sound/direct_sound_samples/synth/sc88pro_fingered_bass.wav b/sound/direct_sound_samples/synth/sc88pro_fingered_bass.wav new file mode 100644 index 000000000..dff67c22c Binary files /dev/null and b/sound/direct_sound_samples/synth/sc88pro_fingered_bass.wav differ diff --git a/sound/direct_sound_samples/synth/sc88pro_flute.aif b/sound/direct_sound_samples/synth/sc88pro_flute.aif deleted file mode 100644 index 703f3adbd..000000000 Binary files a/sound/direct_sound_samples/synth/sc88pro_flute.aif and /dev/null differ diff --git a/sound/direct_sound_samples/synth/sc88pro_flute.wav b/sound/direct_sound_samples/synth/sc88pro_flute.wav new file mode 100644 index 000000000..6ec093c81 Binary files /dev/null and b/sound/direct_sound_samples/synth/sc88pro_flute.wav differ diff --git a/sound/direct_sound_samples/synth/sc88pro_french_horn_60.aif b/sound/direct_sound_samples/synth/sc88pro_french_horn_60.aif deleted file mode 100644 index 742c4385e..000000000 Binary files a/sound/direct_sound_samples/synth/sc88pro_french_horn_60.aif and /dev/null differ diff --git a/sound/direct_sound_samples/synth/sc88pro_french_horn_60.wav b/sound/direct_sound_samples/synth/sc88pro_french_horn_60.wav new file mode 100644 index 000000000..da82c73b6 Binary files /dev/null and b/sound/direct_sound_samples/synth/sc88pro_french_horn_60.wav differ diff --git a/sound/direct_sound_samples/synth/sc88pro_french_horn_72.aif b/sound/direct_sound_samples/synth/sc88pro_french_horn_72.aif deleted file mode 100644 index 004fda6a1..000000000 Binary files a/sound/direct_sound_samples/synth/sc88pro_french_horn_72.aif and /dev/null differ diff --git a/sound/direct_sound_samples/synth/sc88pro_french_horn_72.wav b/sound/direct_sound_samples/synth/sc88pro_french_horn_72.wav new file mode 100644 index 000000000..3221dc49b Binary files /dev/null and b/sound/direct_sound_samples/synth/sc88pro_french_horn_72.wav differ diff --git a/sound/direct_sound_samples/synth/sc88pro_fretless_bass.aif b/sound/direct_sound_samples/synth/sc88pro_fretless_bass.aif deleted file mode 100644 index f3aa47d91..000000000 Binary files a/sound/direct_sound_samples/synth/sc88pro_fretless_bass.aif and /dev/null differ diff --git a/sound/direct_sound_samples/synth/sc88pro_fretless_bass.wav b/sound/direct_sound_samples/synth/sc88pro_fretless_bass.wav new file mode 100644 index 000000000..e7c59f564 Binary files /dev/null and b/sound/direct_sound_samples/synth/sc88pro_fretless_bass.wav differ diff --git a/sound/direct_sound_samples/synth/sc88pro_glockenspiel.aif b/sound/direct_sound_samples/synth/sc88pro_glockenspiel.aif deleted file mode 100644 index 199ead811..000000000 Binary files a/sound/direct_sound_samples/synth/sc88pro_glockenspiel.aif and /dev/null differ diff --git a/sound/direct_sound_samples/synth/sc88pro_glockenspiel.wav b/sound/direct_sound_samples/synth/sc88pro_glockenspiel.wav new file mode 100644 index 000000000..d24e64efe Binary files /dev/null and b/sound/direct_sound_samples/synth/sc88pro_glockenspiel.wav differ diff --git a/sound/direct_sound_samples/synth/sc88pro_harp.aif b/sound/direct_sound_samples/synth/sc88pro_harp.aif deleted file mode 100644 index 083c45e3d..000000000 Binary files a/sound/direct_sound_samples/synth/sc88pro_harp.aif and /dev/null differ diff --git a/sound/direct_sound_samples/synth/sc88pro_harp.wav b/sound/direct_sound_samples/synth/sc88pro_harp.wav new file mode 100644 index 000000000..3a137c593 Binary files /dev/null and b/sound/direct_sound_samples/synth/sc88pro_harp.wav differ diff --git a/sound/direct_sound_samples/synth/sc88pro_mute_high_conga.aif b/sound/direct_sound_samples/synth/sc88pro_mute_high_conga.aif deleted file mode 100644 index 2e1bf9c64..000000000 Binary files a/sound/direct_sound_samples/synth/sc88pro_mute_high_conga.aif and /dev/null differ diff --git a/sound/direct_sound_samples/synth/sc88pro_mute_high_conga.wav b/sound/direct_sound_samples/synth/sc88pro_mute_high_conga.wav new file mode 100644 index 000000000..afa56506a Binary files /dev/null and b/sound/direct_sound_samples/synth/sc88pro_mute_high_conga.wav differ diff --git a/sound/direct_sound_samples/synth/sc88pro_nylon_str_guitar.aif b/sound/direct_sound_samples/synth/sc88pro_nylon_str_guitar.aif deleted file mode 100644 index dea429a25..000000000 Binary files a/sound/direct_sound_samples/synth/sc88pro_nylon_str_guitar.aif and /dev/null differ diff --git a/sound/direct_sound_samples/synth/sc88pro_nylon_str_guitar.wav b/sound/direct_sound_samples/synth/sc88pro_nylon_str_guitar.wav new file mode 100644 index 000000000..e40e64180 Binary files /dev/null and b/sound/direct_sound_samples/synth/sc88pro_nylon_str_guitar.wav differ diff --git a/sound/direct_sound_samples/synth/sc88pro_open_low_conga.aif b/sound/direct_sound_samples/synth/sc88pro_open_low_conga.aif deleted file mode 100644 index 8e1cb620a..000000000 Binary files a/sound/direct_sound_samples/synth/sc88pro_open_low_conga.aif and /dev/null differ diff --git a/sound/direct_sound_samples/synth/sc88pro_open_low_conga.wav b/sound/direct_sound_samples/synth/sc88pro_open_low_conga.wav new file mode 100644 index 000000000..030797c0d Binary files /dev/null and b/sound/direct_sound_samples/synth/sc88pro_open_low_conga.wav differ diff --git a/sound/direct_sound_samples/synth/sc88pro_orchestra_cymbal_crash.aif b/sound/direct_sound_samples/synth/sc88pro_orchestra_cymbal_crash.aif deleted file mode 100644 index 576e3e19e..000000000 Binary files a/sound/direct_sound_samples/synth/sc88pro_orchestra_cymbal_crash.aif and /dev/null differ diff --git a/sound/direct_sound_samples/synth/sc88pro_orchestra_cymbal_crash.wav b/sound/direct_sound_samples/synth/sc88pro_orchestra_cymbal_crash.wav new file mode 100644 index 000000000..58d90c404 Binary files /dev/null and b/sound/direct_sound_samples/synth/sc88pro_orchestra_cymbal_crash.wav differ diff --git a/sound/direct_sound_samples/synth/sc88pro_orchestra_snare.aif b/sound/direct_sound_samples/synth/sc88pro_orchestra_snare.aif deleted file mode 100644 index 36b640758..000000000 Binary files a/sound/direct_sound_samples/synth/sc88pro_orchestra_snare.aif and /dev/null differ diff --git a/sound/direct_sound_samples/synth/sc88pro_orchestra_snare.wav b/sound/direct_sound_samples/synth/sc88pro_orchestra_snare.wav new file mode 100644 index 000000000..43bb9ed9b Binary files /dev/null and b/sound/direct_sound_samples/synth/sc88pro_orchestra_snare.wav differ diff --git a/sound/direct_sound_samples/synth/sc88pro_organ2.aif b/sound/direct_sound_samples/synth/sc88pro_organ2.aif deleted file mode 100644 index 6372bbc32..000000000 Binary files a/sound/direct_sound_samples/synth/sc88pro_organ2.aif and /dev/null differ diff --git a/sound/direct_sound_samples/synth/sc88pro_organ2.wav b/sound/direct_sound_samples/synth/sc88pro_organ2.wav new file mode 100644 index 000000000..437ee2d03 Binary files /dev/null and b/sound/direct_sound_samples/synth/sc88pro_organ2.wav differ diff --git a/sound/direct_sound_samples/synth/sc88pro_piano1_48.aif b/sound/direct_sound_samples/synth/sc88pro_piano1_48.aif deleted file mode 100644 index c2b3757b0..000000000 Binary files a/sound/direct_sound_samples/synth/sc88pro_piano1_48.aif and /dev/null differ diff --git a/sound/direct_sound_samples/synth/sc88pro_piano1_48.wav b/sound/direct_sound_samples/synth/sc88pro_piano1_48.wav new file mode 100644 index 000000000..72e1cb4aa Binary files /dev/null and b/sound/direct_sound_samples/synth/sc88pro_piano1_48.wav differ diff --git a/sound/direct_sound_samples/synth/sc88pro_piano1_60.aif b/sound/direct_sound_samples/synth/sc88pro_piano1_60.aif deleted file mode 100644 index 7de586c9b..000000000 Binary files a/sound/direct_sound_samples/synth/sc88pro_piano1_60.aif and /dev/null differ diff --git a/sound/direct_sound_samples/synth/sc88pro_piano1_60.wav b/sound/direct_sound_samples/synth/sc88pro_piano1_60.wav new file mode 100644 index 000000000..29cb5a880 Binary files /dev/null and b/sound/direct_sound_samples/synth/sc88pro_piano1_60.wav differ diff --git a/sound/direct_sound_samples/synth/sc88pro_piano1_72.aif b/sound/direct_sound_samples/synth/sc88pro_piano1_72.aif deleted file mode 100644 index 5236141ba..000000000 Binary files a/sound/direct_sound_samples/synth/sc88pro_piano1_72.aif and /dev/null differ diff --git a/sound/direct_sound_samples/synth/sc88pro_piano1_72.wav b/sound/direct_sound_samples/synth/sc88pro_piano1_72.wav new file mode 100644 index 000000000..396f09452 Binary files /dev/null and b/sound/direct_sound_samples/synth/sc88pro_piano1_72.wav differ diff --git a/sound/direct_sound_samples/synth/sc88pro_piano1_84.aif b/sound/direct_sound_samples/synth/sc88pro_piano1_84.aif deleted file mode 100644 index a7c4e94f8..000000000 Binary files a/sound/direct_sound_samples/synth/sc88pro_piano1_84.aif and /dev/null differ diff --git a/sound/direct_sound_samples/synth/sc88pro_piano1_84.wav b/sound/direct_sound_samples/synth/sc88pro_piano1_84.wav new file mode 100644 index 000000000..1956f95da Binary files /dev/null and b/sound/direct_sound_samples/synth/sc88pro_piano1_84.wav differ diff --git a/sound/direct_sound_samples/synth/sc88pro_pizzicato_strings.aif b/sound/direct_sound_samples/synth/sc88pro_pizzicato_strings.aif deleted file mode 100644 index 1c0a027f7..000000000 Binary files a/sound/direct_sound_samples/synth/sc88pro_pizzicato_strings.aif and /dev/null differ diff --git a/sound/direct_sound_samples/synth/sc88pro_pizzicato_strings.wav b/sound/direct_sound_samples/synth/sc88pro_pizzicato_strings.wav new file mode 100644 index 000000000..d89ea7c8d Binary files /dev/null and b/sound/direct_sound_samples/synth/sc88pro_pizzicato_strings.wav differ diff --git a/sound/direct_sound_samples/synth/sc88pro_rnd_kick.aif b/sound/direct_sound_samples/synth/sc88pro_rnd_kick.aif deleted file mode 100644 index 9c504e3d0..000000000 Binary files a/sound/direct_sound_samples/synth/sc88pro_rnd_kick.aif and /dev/null differ diff --git a/sound/direct_sound_samples/synth/sc88pro_rnd_kick.wav b/sound/direct_sound_samples/synth/sc88pro_rnd_kick.wav new file mode 100644 index 000000000..02c440ce4 Binary files /dev/null and b/sound/direct_sound_samples/synth/sc88pro_rnd_kick.wav differ diff --git a/sound/direct_sound_samples/synth/sc88pro_rnd_snare.aif b/sound/direct_sound_samples/synth/sc88pro_rnd_snare.aif deleted file mode 100644 index 544b187d5..000000000 Binary files a/sound/direct_sound_samples/synth/sc88pro_rnd_snare.aif and /dev/null differ diff --git a/sound/direct_sound_samples/synth/sc88pro_rnd_snare.wav b/sound/direct_sound_samples/synth/sc88pro_rnd_snare.wav new file mode 100644 index 000000000..69c9a6010 Binary files /dev/null and b/sound/direct_sound_samples/synth/sc88pro_rnd_snare.wav differ diff --git a/sound/direct_sound_samples/synth/sc88pro_slap_bass.aif b/sound/direct_sound_samples/synth/sc88pro_slap_bass.aif deleted file mode 100644 index 9175b63c5..000000000 Binary files a/sound/direct_sound_samples/synth/sc88pro_slap_bass.aif and /dev/null differ diff --git a/sound/direct_sound_samples/synth/sc88pro_slap_bass.wav b/sound/direct_sound_samples/synth/sc88pro_slap_bass.wav new file mode 100644 index 000000000..488369516 Binary files /dev/null and b/sound/direct_sound_samples/synth/sc88pro_slap_bass.wav differ diff --git a/sound/direct_sound_samples/synth/sc88pro_square_wave.aif b/sound/direct_sound_samples/synth/sc88pro_square_wave.aif deleted file mode 100644 index 09e17f0ca..000000000 Binary files a/sound/direct_sound_samples/synth/sc88pro_square_wave.aif and /dev/null differ diff --git a/sound/direct_sound_samples/synth/sc88pro_square_wave.wav b/sound/direct_sound_samples/synth/sc88pro_square_wave.wav new file mode 100644 index 000000000..5689c13f4 Binary files /dev/null and b/sound/direct_sound_samples/synth/sc88pro_square_wave.wav differ diff --git a/sound/direct_sound_samples/synth/sc88pro_string_ensemble_60.aif b/sound/direct_sound_samples/synth/sc88pro_string_ensemble_60.aif deleted file mode 100644 index bfaa5c196..000000000 Binary files a/sound/direct_sound_samples/synth/sc88pro_string_ensemble_60.aif and /dev/null differ diff --git a/sound/direct_sound_samples/synth/sc88pro_string_ensemble_60.wav b/sound/direct_sound_samples/synth/sc88pro_string_ensemble_60.wav new file mode 100644 index 000000000..1e43b2e5e Binary files /dev/null and b/sound/direct_sound_samples/synth/sc88pro_string_ensemble_60.wav differ diff --git a/sound/direct_sound_samples/synth/sc88pro_string_ensemble_72.aif b/sound/direct_sound_samples/synth/sc88pro_string_ensemble_72.aif deleted file mode 100644 index 3e76cacdd..000000000 Binary files a/sound/direct_sound_samples/synth/sc88pro_string_ensemble_72.aif and /dev/null differ diff --git a/sound/direct_sound_samples/synth/sc88pro_string_ensemble_72.wav b/sound/direct_sound_samples/synth/sc88pro_string_ensemble_72.wav new file mode 100644 index 000000000..5a3560bd3 Binary files /dev/null and b/sound/direct_sound_samples/synth/sc88pro_string_ensemble_72.wav differ diff --git a/sound/direct_sound_samples/synth/sc88pro_string_ensemble_84.aif b/sound/direct_sound_samples/synth/sc88pro_string_ensemble_84.aif deleted file mode 100644 index 2647c78ec..000000000 Binary files a/sound/direct_sound_samples/synth/sc88pro_string_ensemble_84.aif and /dev/null differ diff --git a/sound/direct_sound_samples/synth/sc88pro_string_ensemble_84.wav b/sound/direct_sound_samples/synth/sc88pro_string_ensemble_84.wav new file mode 100644 index 000000000..c07c8c431 Binary files /dev/null and b/sound/direct_sound_samples/synth/sc88pro_string_ensemble_84.wav differ diff --git a/sound/direct_sound_samples/synth/sc88pro_synth_bass.aif b/sound/direct_sound_samples/synth/sc88pro_synth_bass.aif deleted file mode 100644 index f39931a7e..000000000 Binary files a/sound/direct_sound_samples/synth/sc88pro_synth_bass.aif and /dev/null differ diff --git a/sound/direct_sound_samples/synth/sc88pro_synth_bass.wav b/sound/direct_sound_samples/synth/sc88pro_synth_bass.wav new file mode 100644 index 000000000..98f6a4ef2 Binary files /dev/null and b/sound/direct_sound_samples/synth/sc88pro_synth_bass.wav differ diff --git a/sound/direct_sound_samples/synth/sc88pro_tambourine.aif b/sound/direct_sound_samples/synth/sc88pro_tambourine.aif deleted file mode 100644 index 39ec57d29..000000000 Binary files a/sound/direct_sound_samples/synth/sc88pro_tambourine.aif and /dev/null differ diff --git a/sound/direct_sound_samples/synth/sc88pro_tambourine.wav b/sound/direct_sound_samples/synth/sc88pro_tambourine.wav new file mode 100644 index 000000000..929ed5dac Binary files /dev/null and b/sound/direct_sound_samples/synth/sc88pro_tambourine.wav differ diff --git a/sound/direct_sound_samples/synth/sc88pro_timpani.aif b/sound/direct_sound_samples/synth/sc88pro_timpani.aif deleted file mode 100644 index dfdfd702e..000000000 Binary files a/sound/direct_sound_samples/synth/sc88pro_timpani.aif and /dev/null differ diff --git a/sound/direct_sound_samples/synth/sc88pro_timpani.wav b/sound/direct_sound_samples/synth/sc88pro_timpani.wav new file mode 100644 index 000000000..03fb3ee71 Binary files /dev/null and b/sound/direct_sound_samples/synth/sc88pro_timpani.wav differ diff --git a/sound/direct_sound_samples/synth/sc88pro_timpani_with_snare.aif b/sound/direct_sound_samples/synth/sc88pro_timpani_with_snare.aif deleted file mode 100644 index 7270872d6..000000000 Binary files a/sound/direct_sound_samples/synth/sc88pro_timpani_with_snare.aif and /dev/null differ diff --git a/sound/direct_sound_samples/synth/sc88pro_timpani_with_snare.wav b/sound/direct_sound_samples/synth/sc88pro_timpani_with_snare.wav new file mode 100644 index 000000000..1c1560ed2 Binary files /dev/null and b/sound/direct_sound_samples/synth/sc88pro_timpani_with_snare.wav differ diff --git a/sound/direct_sound_samples/synth/sc88pro_tr909_hand_clap.aif b/sound/direct_sound_samples/synth/sc88pro_tr909_hand_clap.aif deleted file mode 100644 index b11787ffc..000000000 Binary files a/sound/direct_sound_samples/synth/sc88pro_tr909_hand_clap.aif and /dev/null differ diff --git a/sound/direct_sound_samples/synth/sc88pro_tr909_hand_clap.wav b/sound/direct_sound_samples/synth/sc88pro_tr909_hand_clap.wav new file mode 100644 index 000000000..9dba2ac9d Binary files /dev/null and b/sound/direct_sound_samples/synth/sc88pro_tr909_hand_clap.wav differ diff --git a/sound/direct_sound_samples/synth/sc88pro_trumpet_60.aif b/sound/direct_sound_samples/synth/sc88pro_trumpet_60.aif deleted file mode 100644 index e56df7f60..000000000 Binary files a/sound/direct_sound_samples/synth/sc88pro_trumpet_60.aif and /dev/null differ diff --git a/sound/direct_sound_samples/synth/sc88pro_trumpet_60.wav b/sound/direct_sound_samples/synth/sc88pro_trumpet_60.wav new file mode 100644 index 000000000..0675873a1 Binary files /dev/null and b/sound/direct_sound_samples/synth/sc88pro_trumpet_60.wav differ diff --git a/sound/direct_sound_samples/synth/sc88pro_trumpet_72.aif b/sound/direct_sound_samples/synth/sc88pro_trumpet_72.aif deleted file mode 100644 index 8c68a83b3..000000000 Binary files a/sound/direct_sound_samples/synth/sc88pro_trumpet_72.aif and /dev/null differ diff --git a/sound/direct_sound_samples/synth/sc88pro_trumpet_72.wav b/sound/direct_sound_samples/synth/sc88pro_trumpet_72.wav new file mode 100644 index 000000000..27f75206e Binary files /dev/null and b/sound/direct_sound_samples/synth/sc88pro_trumpet_72.wav differ diff --git a/sound/direct_sound_samples/synth/sc88pro_trumpet_84.aif b/sound/direct_sound_samples/synth/sc88pro_trumpet_84.aif deleted file mode 100644 index a03bafc97..000000000 Binary files a/sound/direct_sound_samples/synth/sc88pro_trumpet_84.aif and /dev/null differ diff --git a/sound/direct_sound_samples/synth/sc88pro_trumpet_84.wav b/sound/direct_sound_samples/synth/sc88pro_trumpet_84.wav new file mode 100644 index 000000000..f1713f901 Binary files /dev/null and b/sound/direct_sound_samples/synth/sc88pro_trumpet_84.wav differ diff --git a/sound/direct_sound_samples/synth/sc88pro_tuba_39.aif b/sound/direct_sound_samples/synth/sc88pro_tuba_39.aif deleted file mode 100644 index d4077b481..000000000 Binary files a/sound/direct_sound_samples/synth/sc88pro_tuba_39.aif and /dev/null differ diff --git a/sound/direct_sound_samples/synth/sc88pro_tuba_39.wav b/sound/direct_sound_samples/synth/sc88pro_tuba_39.wav new file mode 100644 index 000000000..619ebf6e3 Binary files /dev/null and b/sound/direct_sound_samples/synth/sc88pro_tuba_39.wav differ diff --git a/sound/direct_sound_samples/synth/sc88pro_tuba_51.aif b/sound/direct_sound_samples/synth/sc88pro_tuba_51.aif deleted file mode 100644 index 2ad86876b..000000000 Binary files a/sound/direct_sound_samples/synth/sc88pro_tuba_51.aif and /dev/null differ diff --git a/sound/direct_sound_samples/synth/sc88pro_tuba_51.wav b/sound/direct_sound_samples/synth/sc88pro_tuba_51.wav new file mode 100644 index 000000000..4bb436de7 Binary files /dev/null and b/sound/direct_sound_samples/synth/sc88pro_tuba_51.wav differ diff --git a/sound/direct_sound_samples/synth/sc88pro_tubular_bell.aif b/sound/direct_sound_samples/synth/sc88pro_tubular_bell.aif deleted file mode 100644 index 9d00ecae6..000000000 Binary files a/sound/direct_sound_samples/synth/sc88pro_tubular_bell.aif and /dev/null differ diff --git a/sound/direct_sound_samples/synth/sc88pro_tubular_bell.wav b/sound/direct_sound_samples/synth/sc88pro_tubular_bell.wav new file mode 100644 index 000000000..eed5b32b2 Binary files /dev/null and b/sound/direct_sound_samples/synth/sc88pro_tubular_bell.wav differ diff --git a/sound/direct_sound_samples/synth/sc88pro_wind.aif b/sound/direct_sound_samples/synth/sc88pro_wind.aif deleted file mode 100644 index ece919ea5..000000000 Binary files a/sound/direct_sound_samples/synth/sc88pro_wind.aif and /dev/null differ diff --git a/sound/direct_sound_samples/synth/sc88pro_wind.wav b/sound/direct_sound_samples/synth/sc88pro_wind.wav new file mode 100644 index 000000000..1b3c78c42 Binary files /dev/null and b/sound/direct_sound_samples/synth/sc88pro_wind.wav differ diff --git a/sound/direct_sound_samples/synth/sc88pro_xylophone.aif b/sound/direct_sound_samples/synth/sc88pro_xylophone.aif deleted file mode 100644 index 1bd43ca92..000000000 Binary files a/sound/direct_sound_samples/synth/sc88pro_xylophone.aif and /dev/null differ diff --git a/sound/direct_sound_samples/synth/sc88pro_xylophone.wav b/sound/direct_sound_samples/synth/sc88pro_xylophone.wav new file mode 100644 index 000000000..59aec0711 Binary files /dev/null and b/sound/direct_sound_samples/synth/sc88pro_xylophone.wav differ diff --git a/sound/direct_sound_samples/synth/trinity_30303_mega_bass.aif b/sound/direct_sound_samples/synth/trinity_30303_mega_bass.aif deleted file mode 100644 index 09fe6f12e..000000000 Binary files a/sound/direct_sound_samples/synth/trinity_30303_mega_bass.aif and /dev/null differ diff --git a/sound/direct_sound_samples/synth/trinity_30303_mega_bass.wav b/sound/direct_sound_samples/synth/trinity_30303_mega_bass.wav new file mode 100644 index 000000000..6a6e249a4 Binary files /dev/null and b/sound/direct_sound_samples/synth/trinity_30303_mega_bass.wav differ diff --git a/sound/direct_sound_samples/synth/trinity_big_boned.aif b/sound/direct_sound_samples/synth/trinity_big_boned.aif deleted file mode 100644 index 455ced13e..000000000 Binary files a/sound/direct_sound_samples/synth/trinity_big_boned.aif and /dev/null differ diff --git a/sound/direct_sound_samples/synth/trinity_big_boned.wav b/sound/direct_sound_samples/synth/trinity_big_boned.wav new file mode 100644 index 000000000..5967713d6 Binary files /dev/null and b/sound/direct_sound_samples/synth/trinity_big_boned.wav differ diff --git a/sound/direct_sound_samples/synth/trinity_cymbal_crash.aif b/sound/direct_sound_samples/synth/trinity_cymbal_crash.aif deleted file mode 100644 index 4aec6882f..000000000 Binary files a/sound/direct_sound_samples/synth/trinity_cymbal_crash.aif and /dev/null differ diff --git a/sound/direct_sound_samples/synth/trinity_cymbal_crash.wav b/sound/direct_sound_samples/synth/trinity_cymbal_crash.wav new file mode 100644 index 000000000..36337b641 Binary files /dev/null and b/sound/direct_sound_samples/synth/trinity_cymbal_crash.wav differ diff --git a/sound/direct_sound_samples/synth/unknown_bell.aif b/sound/direct_sound_samples/synth/unknown_bell.aif deleted file mode 100644 index 7de79e747..000000000 Binary files a/sound/direct_sound_samples/synth/unknown_bell.aif and /dev/null differ diff --git a/sound/direct_sound_samples/synth/unknown_bell.wav b/sound/direct_sound_samples/synth/unknown_bell.wav new file mode 100644 index 000000000..d996d9274 Binary files /dev/null and b/sound/direct_sound_samples/synth/unknown_bell.wav differ diff --git a/sound/direct_sound_samples/synth/unknown_close_hihat.aif b/sound/direct_sound_samples/synth/unknown_close_hihat.aif deleted file mode 100644 index 8747aef28..000000000 Binary files a/sound/direct_sound_samples/synth/unknown_close_hihat.aif and /dev/null differ diff --git a/sound/direct_sound_samples/synth/unknown_close_hihat.wav b/sound/direct_sound_samples/synth/unknown_close_hihat.wav new file mode 100644 index 000000000..1c0ddae80 Binary files /dev/null and b/sound/direct_sound_samples/synth/unknown_close_hihat.wav differ diff --git a/sound/direct_sound_samples/synth/unknown_open_hihat.aif b/sound/direct_sound_samples/synth/unknown_open_hihat.aif deleted file mode 100644 index 5ad9410d0..000000000 Binary files a/sound/direct_sound_samples/synth/unknown_open_hihat.aif and /dev/null differ diff --git a/sound/direct_sound_samples/synth/unknown_open_hihat.wav b/sound/direct_sound_samples/synth/unknown_open_hihat.wav new file mode 100644 index 000000000..d9fb05ab7 Binary files /dev/null and b/sound/direct_sound_samples/synth/unknown_open_hihat.wav differ diff --git a/sound/direct_sound_samples/synth/unknown_synth_snare.aif b/sound/direct_sound_samples/synth/unknown_synth_snare.aif deleted file mode 100644 index b3122457d..000000000 Binary files a/sound/direct_sound_samples/synth/unknown_synth_snare.aif and /dev/null differ diff --git a/sound/direct_sound_samples/synth/unknown_synth_snare.wav b/sound/direct_sound_samples/synth/unknown_synth_snare.wav new file mode 100644 index 000000000..1ec62fb57 Binary files /dev/null and b/sound/direct_sound_samples/synth/unknown_synth_snare.wav differ diff --git a/sound/direct_sound_samples/synth/unused_sc55_tom.aif b/sound/direct_sound_samples/synth/unused_sc55_tom.aif deleted file mode 100644 index 04f990b13..000000000 Binary files a/sound/direct_sound_samples/synth/unused_sc55_tom.aif and /dev/null differ diff --git a/sound/direct_sound_samples/synth/unused_sc55_tom.wav b/sound/direct_sound_samples/synth/unused_sc55_tom.wav new file mode 100644 index 000000000..944e1031f Binary files /dev/null and b/sound/direct_sound_samples/synth/unused_sc55_tom.wav differ diff --git a/src/battle_ai_script_commands.c b/src/battle_ai_script_commands.c index 0d1a4c351..f83691d7f 100644 --- a/src/battle_ai_script_commands.c +++ b/src/battle_ai_script_commands.c @@ -1331,13 +1331,13 @@ static void BattleAICmd_if_status_not_in_party(void) static void BattleAICmd_get_weather(void) { - if (gBattleWeather & WEATHER_RAIN_ANY) + if (gBattleWeather & B_WEATHER_RAIN) AI_THINKING_STRUCT->funcResult = WEATHER_TYPE_RAIN; - if (gBattleWeather & WEATHER_SANDSTORM_ANY) + if (gBattleWeather & B_WEATHER_SANDSTORM) AI_THINKING_STRUCT->funcResult = WEATHER_TYPE_SANDSTORM; - if (gBattleWeather & WEATHER_SUN_ANY) + if (gBattleWeather & B_WEATHER_SUN) AI_THINKING_STRUCT->funcResult = WEATHER_TYPE_SUN; - if (gBattleWeather & WEATHER_HAIL) + if (gBattleWeather & B_WEATHER_HAIL_TEMPORARY) AI_THINKING_STRUCT->funcResult = WEATHER_TYPE_HAIL; gAIScriptPtr += 1; diff --git a/src/battle_anim_effects_3.c b/src/battle_anim_effects_3.c index 3de6aacf1..a50f47ace 100644 --- a/src/battle_anim_effects_3.c +++ b/src/battle_anim_effects_3.c @@ -6007,13 +6007,13 @@ static void AnimRecycleStep(struct Sprite *sprite) void AnimTask_GetWeather(u8 taskId) { gBattleAnimArgs[7] = ANIM_WEATHER_NONE; - if (gWeatherMoveAnim & WEATHER_SUN_ANY) + if (gWeatherMoveAnim & B_WEATHER_SUN) gBattleAnimArgs[7] = ANIM_WEATHER_SUN; - else if (gWeatherMoveAnim & WEATHER_RAIN_ANY) + else if (gWeatherMoveAnim & B_WEATHER_RAIN) gBattleAnimArgs[7] = ANIM_WEATHER_RAIN; - else if (gWeatherMoveAnim & WEATHER_SANDSTORM_ANY) + else if (gWeatherMoveAnim & B_WEATHER_SANDSTORM) gBattleAnimArgs[7] = ANIM_WEATHER_SANDSTORM; - else if (gWeatherMoveAnim & WEATHER_HAIL_ANY) + else if (gWeatherMoveAnim & B_WEATHER_HAIL) gBattleAnimArgs[7] = ANIM_WEATHER_HAIL; DestroyAnimVisualTask(taskId); diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index 6f429c301..7062b9694 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -367,7 +367,7 @@ void sub_802C098(void) dp11b_obj_instanciate(gActiveBattler, 1, 7, 1); dp11b_obj_instanciate(gActiveBattler, 0, 7, 1); - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); DestroyMenuCursor(); @@ -390,7 +390,7 @@ void sub_802C098(void) } PlayerBufferExecCompleted(); } - else if (gMain.newKeys & DPAD_LEFT) + else if (JOY_NEW(DPAD_LEFT)) { if (gActionSelectionCursor[gActiveBattler] & 1) { @@ -400,7 +400,7 @@ void sub_802C098(void) sub_802E3E4(gActionSelectionCursor[gActiveBattler], 0); } } - else if (gMain.newKeys & DPAD_RIGHT) + else if (JOY_NEW(DPAD_RIGHT)) { if (!(gActionSelectionCursor[gActiveBattler] & 1)) { @@ -410,7 +410,7 @@ void sub_802C098(void) sub_802E3E4(gActionSelectionCursor[gActiveBattler], 0); } } - else if (gMain.newKeys & DPAD_UP) + else if (JOY_NEW(DPAD_UP)) { if (gActionSelectionCursor[gActiveBattler] & 2) { @@ -420,7 +420,7 @@ void sub_802C098(void) sub_802E3E4(gActionSelectionCursor[gActiveBattler], 0); } } - else if (gMain.newKeys & DPAD_DOWN) + else if (JOY_NEW(DPAD_DOWN)) { if (!(gActionSelectionCursor[gActiveBattler] & 2)) { @@ -430,7 +430,7 @@ void sub_802C098(void) sub_802E3E4(gActionSelectionCursor[gActiveBattler], 0); } } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE) && GetBattlerPosition(gActiveBattler) == 2 @@ -451,7 +451,7 @@ void sub_802C098(void) DestroyMenuCursor(); } } - else if (gMain.newKeys & START_BUTTON) + else if (JOY_NEW(START_BUTTON)) { sub_804454C(); } @@ -481,7 +481,7 @@ void sub_802C2EC(void) i++; } while (i < gBattlersCount); } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { DestroyMenuCursor(); PlaySE(SE_SELECT); @@ -491,7 +491,7 @@ void sub_802C2EC(void) PlayerBufferExecCompleted(); } //_0802C3A8 - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); gSprites[gBattlerSpriteIds[gUnknown_03004344]].callback = sub_8010574; @@ -500,7 +500,7 @@ void sub_802C2EC(void) dp11b_obj_instanciate(gActiveBattler, 0, 7, 1); dp11b_obj_free(gUnknown_03004344, 1); } - else if (gMain.newKeys & 0x60) + else if (JOY_NEW(DPAD_LEFT | DPAD_UP)) { PlaySE(SE_SELECT); gSprites[gBattlerSpriteIds[gUnknown_03004344]].callback = sub_8010574; @@ -547,7 +547,7 @@ void sub_802C2EC(void) gSprites[gBattlerSpriteIds[gUnknown_03004344]].callback = sub_8010520; } //_0802C540 - else if (gMain.newKeys & 0x90) + else if (JOY_NEW(DPAD_RIGHT | DPAD_DOWN)) { PlaySE(SE_SELECT); gSprites[gBattlerSpriteIds[gUnknown_03004344]].callback = sub_8010574; @@ -606,7 +606,7 @@ static void HandleAction_ChooseMove(void) #endif struct ChooseMoveStruct *r6 = (struct ChooseMoveStruct *)(gBattleBufferA[gActiveBattler] + 4); - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { u32 r4; @@ -664,7 +664,7 @@ static void HandleAction_ChooseMove(void) gSprites[gBattlerSpriteIds[gUnknown_03004344]].callback = sub_8010520; } } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { DestroyMenuCursor(); PlaySE(SE_SELECT); @@ -673,7 +673,7 @@ static void HandleAction_ChooseMove(void) BtlController_EmitTwoReturnValues(1, 10, 0xFFFF); PlayerBufferExecCompleted(); } - else if (gMain.newKeys & DPAD_LEFT) + else if (JOY_NEW(DPAD_LEFT)) { if (gMoveSelectionCursor[gActiveBattler] & 1) { @@ -685,7 +685,7 @@ static void HandleAction_ChooseMove(void) sub_802E2D4(); } } - else if (gMain.newKeys & DPAD_RIGHT) + else if (JOY_NEW(DPAD_RIGHT)) { if (!(gMoveSelectionCursor[gActiveBattler] & 1) && (gMoveSelectionCursor[gActiveBattler] ^ 1) < gUnknown_03004348) @@ -698,7 +698,7 @@ static void HandleAction_ChooseMove(void) sub_802E2D4(); } } - else if (gMain.newKeys & DPAD_UP) + else if (JOY_NEW(DPAD_UP)) { if (gMoveSelectionCursor[gActiveBattler] & 2) { @@ -710,7 +710,7 @@ static void HandleAction_ChooseMove(void) sub_802E2D4(); } } - else if (gMain.newKeys & DPAD_DOWN) + else if (JOY_NEW(DPAD_DOWN)) { if (!(gMoveSelectionCursor[gActiveBattler] & 2) && (gMoveSelectionCursor[gActiveBattler] ^ 2) < gUnknown_03004348) @@ -723,7 +723,7 @@ static void HandleAction_ChooseMove(void) sub_802E2D4(); } } - else if (gMain.newKeys & SELECT_BUTTON) + else if (JOY_NEW(SELECT_BUTTON)) { if (gUnknown_03004348 > 1 && !(gBattleTypeFlags & BATTLE_TYPE_LINK)) { @@ -740,7 +740,7 @@ static void HandleAction_ChooseMove(void) } } #if DEBUG - else if (gUnknown_020297ED == 1 && (gMain.newKeys & START_BUTTON)) + else if (gUnknown_020297ED == 1 && JOY_NEW(START_BUTTON)) { const u8 *moveName; s32 i; @@ -792,7 +792,7 @@ void sub_802CA60(void) //struct ChooseMoveStruct sp0; u8 totalPPBonuses; - if (gMain.newKeys & (A_BUTTON | SELECT_BUTTON)) + if (JOY_NEW(A_BUTTON | SELECT_BUTTON)) { PlaySE(SE_SELECT); if (gMoveSelectionCursor[gActiveBattler] != gUnknown_03004344) @@ -836,7 +836,7 @@ void sub_802CA60(void) gBattleMons[gActiveBattler].moves[i] = r9->moves[i]; gBattleMons[gActiveBattler].pp[i] = r9->currentPp[i]; } - if (!(gBattleMons[gActiveBattler].status2 & 0x200000)) + if (!(gBattleMons[gActiveBattler].status2 & STATUS2_TRANSFORMED)) { for (i = 0; i < 4; i++) { @@ -885,7 +885,7 @@ void sub_802CA60(void) sub_802E220(); sub_802E2D4(); } - if (gMain.newKeys & (B_BUTTON | SELECT_BUTTON)) + if (JOY_NEW(B_BUTTON | SELECT_BUTTON)) { PlaySE(SE_SELECT); nullsub_7(gUnknown_03004344); @@ -898,7 +898,7 @@ void sub_802CA60(void) sub_802E220(); sub_802E2D4(); } - if ((gMain.newKeys & DPAD_LEFT) && (gUnknown_03004344 & 1)) + if (JOY_NEW(DPAD_LEFT) && (gUnknown_03004344 & 1)) { if (gUnknown_03004344 == gMoveSelectionCursor[gActiveBattler]) sub_802E3B4(gMoveSelectionCursor[gActiveBattler], 0x1D); @@ -911,7 +911,7 @@ void sub_802CA60(void) else sub_802E3B4(gUnknown_03004344, 0x1B); } - if ((gMain.newKeys & DPAD_RIGHT) && !(gUnknown_03004344 & 1) && (gUnknown_03004344 ^ 1) < gUnknown_03004348) + if (JOY_NEW(DPAD_RIGHT) && !(gUnknown_03004344 & 1) && (gUnknown_03004344 ^ 1) < gUnknown_03004348) { if (gUnknown_03004344 == gMoveSelectionCursor[gActiveBattler]) sub_802E3B4(gMoveSelectionCursor[gActiveBattler], 0x1D); @@ -924,7 +924,7 @@ void sub_802CA60(void) else sub_802E3B4(gUnknown_03004344, 0x1B); } - if ((gMain.newKeys & DPAD_UP) && (gUnknown_03004344 & 2)) + if (JOY_NEW(DPAD_UP) && (gUnknown_03004344 & 2)) { if (gUnknown_03004344 == gMoveSelectionCursor[gActiveBattler]) sub_802E3B4(gMoveSelectionCursor[gActiveBattler], 0x1D); @@ -937,7 +937,7 @@ void sub_802CA60(void) else sub_802E3B4(gUnknown_03004344, 0x1B); } - if ((gMain.newKeys & DPAD_DOWN) && !(gUnknown_03004344 & 2) && (gUnknown_03004344 ^ 2) < gUnknown_03004348) + if (JOY_NEW(DPAD_DOWN) && !(gUnknown_03004344 & 2) && (gUnknown_03004344 ^ 2) < gUnknown_03004348) { if (gUnknown_03004344 == gMoveSelectionCursor[gActiveBattler]) sub_802E3B4(gMoveSelectionCursor[gActiveBattler], 0x1D); diff --git a/src/battle_controller_safari.c b/src/battle_controller_safari.c index cf09ef164..678f49909 100644 --- a/src/battle_controller_safari.c +++ b/src/battle_controller_safari.c @@ -206,7 +206,7 @@ void SafariBufferRunCommand(void) void bx_battle_menu_t6_2(void) { - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); DestroyMenuCursor(); @@ -229,7 +229,7 @@ void bx_battle_menu_t6_2(void) } SafariBufferExecCompleted(); } - else if (gMain.newKeys & DPAD_LEFT) + else if (JOY_NEW(DPAD_LEFT)) { if (gActionSelectionCursor[gActiveBattler] & 1) { @@ -239,7 +239,7 @@ void bx_battle_menu_t6_2(void) sub_802E3E4(gActionSelectionCursor[gActiveBattler], 0); } } - else if (gMain.newKeys & DPAD_RIGHT) + else if (JOY_NEW(DPAD_RIGHT)) { if (!(gActionSelectionCursor[gActiveBattler] & 1)) { @@ -249,7 +249,7 @@ void bx_battle_menu_t6_2(void) sub_802E3E4(gActionSelectionCursor[gActiveBattler], 0); } } - else if (gMain.newKeys & DPAD_UP) + else if (JOY_NEW(DPAD_UP)) { if (gActionSelectionCursor[gActiveBattler] & 2) { @@ -259,7 +259,7 @@ void bx_battle_menu_t6_2(void) sub_802E3E4(gActionSelectionCursor[gActiveBattler], 0); } } - else if (gMain.newKeys & DPAD_DOWN) + else if (JOY_NEW(DPAD_DOWN)) { if (!(gActionSelectionCursor[gActiveBattler] & 2)) { @@ -270,12 +270,12 @@ void bx_battle_menu_t6_2(void) } } #if DEBUG - else if (gMain.newKeys & R_BUTTON) + else if (JOY_NEW(R_BUTTON)) { if (!ewram17810[gActiveBattler].unk0_5) move_anim_start_t3(gActiveBattler, gActiveBattler, gActiveBattler, 4, 0); } - else if (gMain.newKeys & START_BUTTON) + else if (JOY_NEW(START_BUTTON)) { sub_804454C(); } diff --git a/src/battle_main.c b/src/battle_main.c index d846f6562..481ac61b6 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -967,7 +967,7 @@ void BattleMainCB2(void) BuildOamBuffer(); #if DEBUG - if ((gMain.heldKeys & (R_BUTTON | SELECT_BUTTON)) == ((R_BUTTON | SELECT_BUTTON))) + if (JOY_HELD(R_BUTTON | SELECT_BUTTON) == ((R_BUTTON | SELECT_BUTTON))) { gSpecialVar_Result = gBattleOutcome = 1; gMain.inBattle = FALSE; @@ -1685,7 +1685,7 @@ void debug_sub_8010CAC(void) } debug_sub_80125A0(); } - if (gMain.newAndRepeatedKeys & B_BUTTON) + if (JOY_REPT(B_BUTTON)) { switch (gUnknown_Debug_030043A0 + gUnknown_Debug_030043A4 * 5) { @@ -1746,7 +1746,7 @@ void debug_sub_8010CAC(void) break; } } - if (gMain.newAndRepeatedKeys & A_BUTTON) + if (JOY_REPT(A_BUTTON)) { switch (gUnknown_Debug_030043A0 + gUnknown_Debug_030043A4 * 5) { @@ -1807,7 +1807,7 @@ void debug_sub_8010CAC(void) break; } } - if (gMain.newAndRepeatedKeys & L_BUTTON) + if (JOY_REPT(L_BUTTON)) { if (gUnknown_Debug_030043A0 == 4 && gUnknown_Debug_030043A4 < 6) { @@ -1834,7 +1834,7 @@ void debug_sub_8010CAC(void) debug_sub_8011EA0(gUnknown_Debug_030043A4 * 5 + gUnknown_Debug_030043A0); debug_sub_80123D8(gUnknown_Debug_030043A4 * 5); } - if (gMain.newAndRepeatedKeys & R_BUTTON) + if (JOY_REPT(R_BUTTON)) { if (gUnknown_Debug_030043A0 == 4 && gUnknown_Debug_030043A4 < 6) { @@ -1892,28 +1892,28 @@ void debug_sub_8011498(void) gUnknown_Debug_030043A8 ^= 1; debug_sub_8012628(); } - if (gMain.newAndRepeatedKeys & B_BUTTON) + if (JOY_REPT(B_BUTTON)) { gUnknown_Debug_2023B02[gUnknown_Debug_03004360][r9 / 5][gUnknown_Debug_030043A8]--; if (gUnknown_Debug_2023B02[gUnknown_Debug_03004360][r9 / 5][gUnknown_Debug_030043A8] < gUnknown_Debug_821F564[gUnknown_Debug_030043A8][4]) gUnknown_Debug_2023B02[gUnknown_Debug_03004360][r9 / 5][gUnknown_Debug_030043A8] = gUnknown_Debug_821F564[gUnknown_Debug_030043A8][3]; debug_sub_8012294(); } - if (gMain.newAndRepeatedKeys & A_BUTTON) + if (JOY_REPT(A_BUTTON)) { gUnknown_Debug_2023B02[gUnknown_Debug_03004360][r9 / 5][gUnknown_Debug_030043A8]++; if (gUnknown_Debug_2023B02[gUnknown_Debug_03004360][r9 / 5][gUnknown_Debug_030043A8] > gUnknown_Debug_821F564[gUnknown_Debug_030043A8][3]) gUnknown_Debug_2023B02[gUnknown_Debug_03004360][r9 / 5][gUnknown_Debug_030043A8] = gUnknown_Debug_821F564[gUnknown_Debug_030043A8][4]; debug_sub_8012294(); } - if (gMain.newAndRepeatedKeys & L_BUTTON) + if (JOY_REPT(L_BUTTON)) { gUnknown_Debug_2023B02[gUnknown_Debug_03004360][r9 / 5][gUnknown_Debug_030043A8] -= 10; while (gUnknown_Debug_2023B02[gUnknown_Debug_03004360][r9 / 5][gUnknown_Debug_030043A8] < gUnknown_Debug_821F564[gUnknown_Debug_030043A8][4]) gUnknown_Debug_2023B02[gUnknown_Debug_03004360][r9 / 5][gUnknown_Debug_030043A8] += gUnknown_Debug_821F564[gUnknown_Debug_030043A8][3]; debug_sub_8012294(); } - if (gMain.newAndRepeatedKeys & R_BUTTON) + if (JOY_REPT(R_BUTTON)) { gUnknown_Debug_2023B02[gUnknown_Debug_03004360][r9 / 5][gUnknown_Debug_030043A8] += 10; while (gUnknown_Debug_2023B02[gUnknown_Debug_03004360][r9 / 5][gUnknown_Debug_030043A8] > gUnknown_Debug_821F564[gUnknown_Debug_030043A8][3]) @@ -2779,35 +2779,35 @@ void debug_sub_8012D10(u8 taskId) sub_802E3E4(gTasks[taskId].data[2], 0); break; case 1: - if (gMain.newKeys & DPAD_UP) + if (JOY_NEW(DPAD_UP)) { PlaySE(SE_SELECT); nullsub_8(gTasks[taskId].data[2]); gTasks[taskId].data[2] &= ~2; sub_802E3E4(gTasks[taskId].data[2], 0); } - else if (gMain.newKeys & DPAD_DOWN) + else if (JOY_NEW(DPAD_DOWN)) { PlaySE(SE_SELECT); nullsub_8(gTasks[taskId].data[2]); gTasks[taskId].data[2] |= 2; sub_802E3E4(gTasks[taskId].data[2], 0); } - else if (gMain.newKeys & DPAD_LEFT) + else if (JOY_NEW(DPAD_LEFT)) { PlaySE(SE_SELECT); nullsub_8(gTasks[taskId].data[2]); gTasks[taskId].data[2] &= ~1; sub_802E3E4(gTasks[taskId].data[2], 0); } - else if (gMain.newKeys & DPAD_RIGHT) + else if (JOY_NEW(DPAD_RIGHT)) { PlaySE(SE_SELECT); nullsub_8(gTasks[taskId].data[2]); gTasks[taskId].data[2] |= 1; sub_802E3E4(gTasks[taskId].data[2], 0); } - else if (gMain.newAndRepeatedKeys & A_BUTTON) + else if (JOY_REPT(A_BUTTON)) { PlaySE(SE_SELECT); switch (gTasks[taskId].data[2]) @@ -2836,7 +2836,7 @@ void debug_sub_8012D10(u8 taskId) break; } } - else if (gMain.newAndRepeatedKeys & B_BUTTON) + else if (JOY_REPT(B_BUTTON)) { PlaySE(SE_SELECT); switch (gTasks[taskId].data[2]) @@ -2865,7 +2865,7 @@ void debug_sub_8012D10(u8 taskId) break; } } - else if (gMain.newAndRepeatedKeys & R_BUTTON) + else if (JOY_REPT(R_BUTTON)) { PlaySE(SE_SELECT); switch (gTasks[taskId].data[2]) @@ -2896,7 +2896,7 @@ void debug_sub_8012D10(u8 taskId) break; } } - else if (gMain.newAndRepeatedKeys & L_BUTTON) + else if (JOY_REPT(L_BUTTON)) { PlaySE(SE_SELECT); switch (gTasks[taskId].data[2]) @@ -2930,26 +2930,26 @@ void debug_sub_8012D10(u8 taskId) } break; case 2: - if (gMain.newKeys & DPAD_UP) + if (JOY_NEW(DPAD_UP)) { PlaySE(SE_SELECT); debug_sub_8012B4C(gTasks[taskId].data[3]); gTasks[taskId].data[3] = 0; debug_sub_8012B2C(0); } - else if (gMain.newKeys & DPAD_DOWN) + else if (JOY_NEW(DPAD_DOWN)) { PlaySE(SE_SELECT); debug_sub_8012B4C(gTasks[taskId].data[3]); gTasks[taskId].data[3] = 1; debug_sub_8012B2C(1); } - else if (gMain.newKeys & A_BUTTON) + else if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); debug_sub_8012C08(taskId, gTasks[taskId].data[3]); } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); asm(""); @@ -2957,56 +2957,56 @@ void debug_sub_8012D10(u8 taskId) } return; case 3: - if (gMain.newKeys & DPAD_UP) + if (JOY_NEW(DPAD_UP)) { PlaySE(SE_SELECT); debug_sub_8012B4C(gTasks[taskId].data[3]); gTasks[taskId].data[3] = 0; debug_sub_8012B2C(0); } - else if (gMain.newKeys & DPAD_DOWN) + else if (JOY_NEW(DPAD_DOWN)) { PlaySE(SE_SELECT); debug_sub_8012B4C(gTasks[taskId].data[3]); gTasks[taskId].data[3] = 1; debug_sub_8012B2C(1); } - else if (gMain.newKeys & A_BUTTON) + else if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); if (gTasks[taskId].data[3] == 0) debug_sub_80132C8(31, gUnknown_Debug_2023B62, 411); debug_sub_8012B70(taskId, 1); } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); debug_sub_8012B70(taskId, 1); } break; case 4: - if (gMain.newKeys & DPAD_UP) + if (JOY_NEW(DPAD_UP)) { PlaySE(SE_SELECT); debug_sub_8012B4C(gTasks[taskId].data[3]); gTasks[taskId].data[3] = 0; debug_sub_8012B2C(0); } - else if (gMain.newKeys & DPAD_DOWN) + else if (JOY_NEW(DPAD_DOWN)) { PlaySE(SE_SELECT); debug_sub_8012B4C(gTasks[taskId].data[3]); gTasks[taskId].data[3] = 1; debug_sub_8012B2C(1); } - else if (gMain.newKeys & A_BUTTON) + else if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); if (gTasks[taskId].data[3] == 0) debug_sub_8013294(31, gUnknown_Debug_2023B62, 411); debug_sub_8012B70(taskId, 1); } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); debug_sub_8012B70(taskId, 1); @@ -3546,7 +3546,7 @@ void SwitchInClearSetData(void) && (gDisableStructs[i].battlerWithSureHit == gActiveBattler)) { gStatuses3[i] &= ~STATUS3_ALWAYS_HITS; - gStatuses3[i] |= 0x10; + gStatuses3[i] |= STATUS3_ALWAYS_HITS_TURN(2); } } } @@ -3558,8 +3558,8 @@ void SwitchInClearSetData(void) for (i = 0; i < gBattlersCount; i++) { - if (gBattleMons[i].status2 & (gBitTable[gActiveBattler] << 16)) - gBattleMons[i].status2 &= ~(gBitTable[gActiveBattler] << 16); + if (gBattleMons[i].status2 & STATUS2_INFATUATED_WITH(gActiveBattler)) + gBattleMons[i].status2 &= ~STATUS2_INFATUATED_WITH(gActiveBattler); if ((gBattleMons[i].status2 & STATUS2_WRAPPED) && gSharedMem[BSTRUCT_OFF(wrappedBy) + i] == gActiveBattler) gBattleMons[i].status2 &= ~STATUS2_WRAPPED; } @@ -3612,8 +3612,8 @@ void UndoEffectsAfterFainting(void) { if ((gBattleMons[i].status2 & STATUS2_ESCAPE_PREVENTION) && gDisableStructs[i].bankPreventingEscape == gActiveBattler) gBattleMons[i].status2 &= ~STATUS2_ESCAPE_PREVENTION; - if (gBattleMons[i].status2 & (gBitTable[gActiveBattler] << 16)) - gBattleMons[i].status2 &= ~(gBitTable[gActiveBattler] << 16); + if (gBattleMons[i].status2 & STATUS2_INFATUATED_WITH(gActiveBattler)) + gBattleMons[i].status2 &= ~STATUS2_INFATUATED_WITH(gActiveBattler); if ((gBattleMons[i].status2 & STATUS2_WRAPPED) && gSharedMem[BSTRUCT_OFF(wrappedBy) + i] == gActiveBattler) gBattleMons[i].status2 &= ~STATUS2_WRAPPED; } @@ -4032,7 +4032,7 @@ void BattleBeginFirstTurn(void) for (i = 0; i < 8; i++) gBattleCommunication[i] = 0; for (i = 0; i < gBattlersCount; i++) - gBattleMons[i].status2 &= ~8; + gBattleMons[i].status2 &= ~STATUS2_FLINCHED; gBattleStruct->turnEffectsTracker = 0; gBattleStruct->turnEffectsBattlerId = 0; gBattleStruct->wishPerishSongState = 0; @@ -4056,8 +4056,8 @@ void bc_8013B1C(void) gBattleCommunication[i] = 0; for (i = 0; i < gBattlersCount; i++) { - gBattleMons[i].status2 &= ~8; - if ((gBattleMons[i].status1 & 7) && (gBattleMons[i].status2 & 0x1000)) + gBattleMons[i].status2 &= ~STATUS2_FLINCHED; + if ((gBattleMons[i].status1 & STATUS1_SLEEP) && (gBattleMons[i].status2 & STATUS2_MULTIPLETURNS)) CancelMultiTurnMoves(i); } gBattleStruct->turnEffectsTracker = 0; @@ -4258,8 +4258,8 @@ void sub_8012324(void) break; } //_08012468 - if ((gBattleMons[gActiveBattler].status2 & 0x1000) - || (gBattleMons[gActiveBattler].status2 & 0x400000)) + if ((gBattleMons[gActiveBattler].status2 & STATUS2_MULTIPLETURNS) + || (gBattleMons[gActiveBattler].status2 & STATUS2_RECHARGE)) { gActionForBanks[gActiveBattler] = 0; gBattleCommunication[gActiveBattler] = 3; @@ -4594,14 +4594,14 @@ u8 GetWhoStrikesFirst(u8 bank1, u8 bank2, bool8 ignoreMovePriorities) // Check for abilities that boost speed in weather. if (WEATHER_HAS_EFFECT) { - if ((gBattleMons[bank1].ability == ABILITY_SWIFT_SWIM && (gBattleWeather & WEATHER_RAIN_ANY)) - || (gBattleMons[bank1].ability == ABILITY_CHLOROPHYLL && (gBattleWeather & WEATHER_SUN_ANY))) + if ((gBattleMons[bank1].ability == ABILITY_SWIFT_SWIM && (gBattleWeather & B_WEATHER_RAIN)) + || (gBattleMons[bank1].ability == ABILITY_CHLOROPHYLL && (gBattleWeather & B_WEATHER_SUN))) bank1SpeedMultiplier = 2; else bank1SpeedMultiplier = 1; - if ((gBattleMons[bank2].ability == ABILITY_SWIFT_SWIM && (gBattleWeather & WEATHER_RAIN_ANY)) - || (gBattleMons[bank2].ability == ABILITY_CHLOROPHYLL && (gBattleWeather & WEATHER_SUN_ANY))) + if ((gBattleMons[bank2].ability == ABILITY_SWIFT_SWIM && (gBattleWeather & B_WEATHER_RAIN)) + || (gBattleMons[bank2].ability == ABILITY_CHLOROPHYLL && (gBattleWeather & B_WEATHER_SUN))) bank2SpeedMultiplier = 2; else bank2SpeedMultiplier = 1; @@ -4913,7 +4913,7 @@ static void RunTurnActionsFunctions(void) if (gCurrentTurnActionNumber >= gBattlersCount) // everyone did their actions, turn finished { - gHitMarker &= ~(HITMARKER_x100000); + gHitMarker &= ~(HITMARKER_PASSIVE_HP_UPDATE); gBattleMainFunc = gUnknown_081FA678[gBattleOutcome & 0x7F]; } else @@ -5660,9 +5660,9 @@ void HandleAction_NothingIsFainted(void) gCurrentActionFuncId = gActionsByTurnOrder[gCurrentTurnActionNumber]; gHitMarker &= ~(HITMARKER_DESTINYBOND | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_ATTACKSTRING_PRINTED | HITMARKER_NO_PPDEDUCT | HITMARKER_STATUS_ABILITY_EFFECT | HITMARKER_IGNORE_ON_AIR - | HITMARKER_IGNORE_UNDERGROUND | HITMARKER_IGNORE_UNDERWATER | HITMARKER_x100000 - | HITMARKER_OBEYS | HITMARKER_x10 | HITMARKER_SYNCHRONISE_EFFECT - | HITMARKER_CHARGING | HITMARKER_x4000000); + | HITMARKER_IGNORE_UNDERGROUND | HITMARKER_IGNORE_UNDERWATER | HITMARKER_PASSIVE_HP_UPDATE + | HITMARKER_OBEYS | HITMARKER_WAKE_UP_CLEAR | HITMARKER_SYNCHRONIZE_EFFECT + | HITMARKER_CHARGING | HITMARKER_NEVER_SET); } void HandleAction_ActionFinished(void) @@ -5672,9 +5672,9 @@ void HandleAction_ActionFinished(void) SpecialStatusesClear(); gHitMarker &= ~(HITMARKER_DESTINYBOND | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_ATTACKSTRING_PRINTED | HITMARKER_NO_PPDEDUCT | HITMARKER_STATUS_ABILITY_EFFECT | HITMARKER_IGNORE_ON_AIR - | HITMARKER_IGNORE_UNDERGROUND | HITMARKER_IGNORE_UNDERWATER | HITMARKER_x100000 - | HITMARKER_OBEYS | HITMARKER_x10 | HITMARKER_SYNCHRONISE_EFFECT - | HITMARKER_CHARGING | HITMARKER_x4000000); + | HITMARKER_IGNORE_UNDERGROUND | HITMARKER_IGNORE_UNDERWATER | HITMARKER_PASSIVE_HP_UPDATE + | HITMARKER_OBEYS | HITMARKER_WAKE_UP_CLEAR | HITMARKER_SYNCHRONIZE_EFFECT + | HITMARKER_CHARGING | HITMARKER_NEVER_SET); gBattleMoveDamage = 0; gBattleStruct->animTurn = 0; diff --git a/src/battle_party_menu.c b/src/battle_party_menu.c index a1389ddff..d02155eab 100644 --- a/src/battle_party_menu.c +++ b/src/battle_party_menu.c @@ -584,19 +584,19 @@ static void Task_HandlePopupMenuInput(u8 taskId) if (!gPaletteFade.active) { - if (gMain.newAndRepeatedKeys & DPAD_UP) + if (JOY_REPT(DPAD_UP)) { PlaySE(SE_SELECT); Menu_MoveCursor(-1); return; } - if (gMain.newAndRepeatedKeys & DPAD_DOWN) + if (JOY_REPT(DPAD_DOWN)) { PlaySE(SE_SELECT); Menu_MoveCursor(1); return; } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); func = PartyMenuGetPopupMenuFunc(gTasks[taskId].data[4], @@ -606,7 +606,7 @@ static void Task_HandlePopupMenuInput(u8 taskId) func(taskId); return; } - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); Task_BattlePartyMenuCancel(taskId); diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 46000157c..70b185c71 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -1054,7 +1054,7 @@ static void atk00_attackcanceler(void) return; if (AbilityBattleEffects(ABILITYEFFECT_MOVES_BLOCK, gBattlerTarget, 0, 0, 0)) return; - if (!gBattleMons[gBattlerAttacker].pp[gCurrMovePos] && gCurrentMove != MOVE_STRUGGLE && !(gHitMarker & (HITMARKER_x800000 | HITMARKER_NO_ATTACKSTRING)) + if (!gBattleMons[gBattlerAttacker].pp[gCurrMovePos] && gCurrentMove != MOVE_STRUGGLE && !(gHitMarker & (HITMARKER_ALLOW_NO_PP | HITMARKER_NO_ATTACKSTRING)) && !(gBattleMons[gBattlerAttacker].status2 & STATUS2_MULTIPLETURNS)) { gBattlescriptCurrInstr = BattleScript_NoPPForMove; @@ -1062,7 +1062,7 @@ static void atk00_attackcanceler(void) return; } - gHitMarker &= ~(HITMARKER_x800000); + gHitMarker &= ~(HITMARKER_ALLOW_NO_PP); if (!(gHitMarker & HITMARKER_OBEYS) && !(gBattleMons[gBattlerAttacker].status2 & STATUS2_MULTIPLETURNS)) { @@ -1209,7 +1209,7 @@ static bool8 AccuracyCalcHelper(u16 move) gHitMarker &= ~HITMARKER_IGNORE_UNDERWATER; - if ((WEATHER_HAS_EFFECT && (gBattleWeather & WEATHER_RAIN_ANY) && gBattleMoves[move].effect == EFFECT_THUNDER) + if ((WEATHER_HAS_EFFECT && (gBattleWeather & B_WEATHER_RAIN) && gBattleMoves[move].effect == EFFECT_THUNDER) || (gBattleMoves[move].effect == EFFECT_ALWAYS_HIT || gBattleMoves[move].effect == EFFECT_VITAL_THROW)) { JumpIfMoveFailed(7, move); @@ -1266,7 +1266,7 @@ static void atk01_accuracycheck(void) moveAcc = gBattleMoves[move].accuracy; // check Thunder on sunny weather - if (WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_SUN_ANY && gBattleMoves[move].effect == EFFECT_THUNDER) + if (WEATHER_HAS_EFFECT && gBattleWeather & B_WEATHER_SUN && gBattleMoves[move].effect == EFFECT_THUNDER) moveAcc = 50; calc = gAccuracyStageRatios[buff].dividend * moveAcc; @@ -1274,7 +1274,7 @@ static void atk01_accuracycheck(void) if (gBattleMons[gBattlerAttacker].ability == ABILITY_COMPOUND_EYES) calc = (calc * 130) / 100; // 1.3 compound eyes boost - if (WEATHER_HAS_EFFECT && gBattleMons[gBattlerTarget].ability == ABILITY_SAND_VEIL && gBattleWeather & WEATHER_SANDSTORM_ANY) + if (WEATHER_HAS_EFFECT && gBattleMons[gBattlerTarget].ability == ABILITY_SAND_VEIL && gBattleWeather & B_WEATHER_SANDSTORM) calc = (calc * 80) / 100; // 1.2 sand veil loss; if (gBattleMons[gBattlerAttacker].ability == ABILITY_HUSTLE && type < 9) calc = (calc * 80) / 100; // 1.2 hustle loss; @@ -2001,9 +2001,9 @@ static void atk0C_datahpupdate(void) } else // hp goes down { - if (gHitMarker & HITMARKER_x20) + if (gHitMarker & HITMARKER_IGNORE_BIDE) { - gHitMarker &= ~(HITMARKER_x20); + gHitMarker &= ~(HITMARKER_IGNORE_BIDE); } else { @@ -2025,10 +2025,10 @@ static void atk0C_datahpupdate(void) gBattleMons[gActiveBattler].hp = 0; } - if (!gSpecialStatuses[gActiveBattler].dmg && !(gHitMarker & HITMARKER_x100000)) + if (!gSpecialStatuses[gActiveBattler].dmg && !(gHitMarker & HITMARKER_PASSIVE_HP_UPDATE)) gSpecialStatuses[gActiveBattler].dmg = gHpDealt; - if (IS_TYPE_PHYSICAL(moveType) && !(gHitMarker & HITMARKER_x100000) && gCurrentMove != MOVE_PAIN_SPLIT) + if (IS_TYPE_PHYSICAL(moveType) && !(gHitMarker & HITMARKER_PASSIVE_HP_UPDATE) && gCurrentMove != MOVE_PAIN_SPLIT) { gProtectStructs[gActiveBattler].physicalDmg = gHpDealt; gSpecialStatuses[gActiveBattler].physicalDmg = gHpDealt; @@ -2043,7 +2043,7 @@ static void atk0C_datahpupdate(void) gSpecialStatuses[gActiveBattler].physicalBattlerId = gBattlerTarget; } } - else if (!IS_TYPE_PHYSICAL(moveType) && !(gHitMarker & HITMARKER_x100000)) + else if (!IS_TYPE_PHYSICAL(moveType) && !(gHitMarker & HITMARKER_PASSIVE_HP_UPDATE)) { gProtectStructs[gActiveBattler].specialDmg = gHpDealt; gSpecialStatuses[gActiveBattler].specialDmg = gHpDealt; @@ -2059,7 +2059,7 @@ static void atk0C_datahpupdate(void) } } } - gHitMarker &= ~(HITMARKER_x100000); + gHitMarker &= ~(HITMARKER_PASSIVE_HP_UPDATE); BtlController_EmitSetMonData(0, REQUEST_HP_BATTLE, 0, 2, &gBattleMons[gActiveBattler].hp); MarkBattlerForControllerExec(gActiveBattler); } @@ -2459,7 +2459,7 @@ void SetMoveEffect(bool8 primary, u8 certain) statusChanged = TRUE; break; case STATUS1_FREEZE: - if (WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_SUN_ANY) + if (WEATHER_HAS_EFFECT && gBattleWeather & B_WEATHER_SUN) noSunCanFreeze = FALSE; if (IS_BATTLER_OF_TYPE(gEffectBattler, TYPE_ICE)) break; @@ -2585,7 +2585,7 @@ void SetMoveEffect(bool8 primary, u8 certain) || gBattleCommunication[MOVE_EFFECT_BYTE] == MOVE_EFFECT_BURN) { gBattleStruct->synchroniseEffect = gBattleCommunication[MOVE_EFFECT_BYTE]; - gHitMarker |= HITMARKER_SYNCHRONISE_EFFECT; + gHitMarker |= HITMARKER_SYNCHRONIZE_EFFECT; } return; } @@ -3089,7 +3089,7 @@ static void atk19_tryfaintmon(void) gBattlescriptCurrInstr = BS_ptr; if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) { - gHitMarker |= HITMARKER_x400000; + gHitMarker |= HITMARKER_PLAYER_FAINTED; if (gBattleResults.playerFaintCounter < 0xFF) gBattleResults.playerFaintCounter++; if (gBattleMons[battlerId].level > gBattleMons[gActiveBattler].level) @@ -3619,13 +3619,13 @@ static void atk24(void) { for (found1 = 0, i = 0; i < gBattlersCount; i += 2) { - if ((gHitMarker & HITMARKER_UNK(i)) && !gSpecialStatuses[i].flag40) + if ((gHitMarker & HITMARKER_FAINTED2(i)) && !gSpecialStatuses[i].flag40) found1++; } for (found2 = 0, i = 1; i < gBattlersCount; i += 2) { - if ((gHitMarker & HITMARKER_UNK(i)) && !gSpecialStatuses[i].flag40) + if ((gHitMarker & HITMARKER_FAINTED2(i)) && !gSpecialStatuses[i].flag40) found2++; } @@ -3659,7 +3659,7 @@ static void MoveValuesCleanUp(void) gBattleCommunication[MOVE_EFFECT_BYTE] = 0; gBattleCommunication[6] = 0; gHitMarker &= ~(HITMARKER_DESTINYBOND); - gHitMarker &= ~(HITMARKER_SYNCHRONISE_EFFECT); + gHitMarker &= ~(HITMARKER_SYNCHRONIZE_EFFECT); } static void atk25_movevaluescleanup(void) @@ -5294,21 +5294,21 @@ static void atk5A_yesnoboxlearnmove(void) sub_802BC6C(); break; case 1: - if (gMain.newKeys & DPAD_UP && gBattleCommunication[1] != 0) + if (JOY_NEW(DPAD_UP) && gBattleCommunication[1] != 0) { PlaySE(SE_SELECT); nullsub_6(); gBattleCommunication[1] = 0; sub_802BC6C(); } - if (gMain.newKeys & DPAD_DOWN && gBattleCommunication[1] == 0) + if (JOY_NEW(DPAD_DOWN) && gBattleCommunication[1] == 0) { PlaySE(SE_SELECT); nullsub_6(); gBattleCommunication[1] = 1; sub_802BC6C(); } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); if (gBattleCommunication[1] == 0) @@ -5320,7 +5320,7 @@ static void atk5A_yesnoboxlearnmove(void) } goto state_tracker_4; } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); state_tracker_4: @@ -5406,21 +5406,21 @@ static void atk5B_yesnoboxstoplearningmove(void) sub_802BC6C(); break; case 1: - if (gMain.newKeys & DPAD_UP && gBattleCommunication[1] != 0) + if (JOY_NEW(DPAD_UP) && gBattleCommunication[1] != 0) { PlaySE(SE_SELECT); nullsub_6(); gBattleCommunication[1] = 0; sub_802BC6C(); } - if (gMain.newKeys & DPAD_DOWN && gBattleCommunication[1] == 0) + if (JOY_NEW(DPAD_DOWN) && gBattleCommunication[1] == 0) { PlaySE(SE_SELECT); nullsub_6(); gBattleCommunication[1] = 1; sub_802BC6C(); } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); if (gBattleCommunication[1] != 0) @@ -5429,7 +5429,7 @@ static void atk5B_yesnoboxstoplearningmove(void) gBattlescriptCurrInstr += 5; sub_8023AD8(); } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1); @@ -5664,28 +5664,28 @@ static void atk67_yesnobox(void) sub_802BC6C(); break; case 1: - if (gMain.newKeys & DPAD_UP && gBattleCommunication[1] != 0) + if (JOY_NEW(DPAD_UP) && gBattleCommunication[1] != 0) { PlaySE(SE_SELECT); nullsub_6(); gBattleCommunication[1] = 0; sub_802BC6C(); } - if (gMain.newKeys & DPAD_DOWN && gBattleCommunication[1] == 0) + if (JOY_NEW(DPAD_DOWN) && gBattleCommunication[1] == 0) { PlaySE(SE_SELECT); nullsub_6(); gBattleCommunication[1] = 1; sub_802BC6C(); } - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { gBattleCommunication[1] = 1; PlaySE(SE_SELECT); sub_8023AD8(); gBattlescriptCurrInstr++; } - else if (gMain.newKeys & A_BUTTON) + else if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); sub_8023AD8(); @@ -6253,14 +6253,14 @@ static void atk7C_trymirrormove(void) static void atk7D_setrain(void) { - if (gBattleWeather & WEATHER_RAIN_ANY) + if (gBattleWeather & B_WEATHER_RAIN) { gMoveResultFlags |= MOVE_RESULT_MISSED; gBattleCommunication[MULTISTRING_CHOOSER] = 2; } else { - gBattleWeather = WEATHER_RAIN_TEMPORARY; + gBattleWeather = B_WEATHER_RAIN_TEMPORARY; gBattleCommunication[MULTISTRING_CHOOSER] = 0; gWishFutureKnock.weatherDuration = 5; } @@ -7338,14 +7338,14 @@ static void atk94_damagetohalftargethp(void) //super fang static void atk95_setsandstorm(void) { - if (gBattleWeather & WEATHER_SANDSTORM_ANY) + if (gBattleWeather & B_WEATHER_SANDSTORM) { gMoveResultFlags |= MOVE_RESULT_MISSED; gBattleCommunication[MULTISTRING_CHOOSER] = 2; } else { - gBattleWeather = WEATHER_SANDSTORM_TEMPORARY; + gBattleWeather = B_WEATHER_SANDSTORM_TEMPORARY; gBattleCommunication[MULTISTRING_CHOOSER] = 3; gWishFutureKnock.weatherDuration = 5; } @@ -7356,7 +7356,7 @@ static void atk96_weatherdamage(void) { if (WEATHER_HAS_EFFECT) { - if (gBattleWeather & WEATHER_SANDSTORM_ANY) + if (gBattleWeather & B_WEATHER_SANDSTORM) { if (gBattleMons[gBattlerAttacker].type1 != TYPE_ROCK && gBattleMons[gBattlerAttacker].type1 != TYPE_STEEL && gBattleMons[gBattlerAttacker].type1 != TYPE_GROUND && gBattleMons[gBattlerAttacker].type2 != TYPE_ROCK && gBattleMons[gBattlerAttacker].type2 != TYPE_STEEL && gBattleMons[gBattlerAttacker].type2 != TYPE_GROUND @@ -7371,7 +7371,7 @@ static void atk96_weatherdamage(void) gBattleMoveDamage = 0; } } - if (gBattleWeather & WEATHER_HAIL) + if (gBattleWeather & B_WEATHER_HAIL_TEMPORARY) { if (gBattleMons[gBattlerAttacker].type1 != TYPE_ICE && gBattleMons[gBattlerAttacker].type2 != TYPE_ICE && !(gStatuses3[gBattlerAttacker] & STATUS3_UNDERGROUND) && !(gStatuses3[gBattlerAttacker] & STATUS3_UNDERWATER)) { @@ -7431,7 +7431,7 @@ static void atk97_tryinfatuating(void) } else { - gBattleMons[gBattlerTarget].status2 |= (gBitTable[gBattlerAttacker] << 16); + gBattleMons[gBattlerTarget].status2 |= STATUS2_INFATUATED_WITH(gBattlerAttacker); gBattlescriptCurrInstr += 5; } } @@ -7876,7 +7876,7 @@ static void atkA6_settypetorandomresistance(void) static void atkA7_setalwayshitflag(void) { gStatuses3[gBattlerTarget] &= ~(STATUS3_ALWAYS_HITS); - gStatuses3[gBattlerTarget] |= 0x10; + gStatuses3[gBattlerTarget] |= STATUS3_ALWAYS_HITS_TURN(2); gDisableStructs[gBattlerTarget].battlerWithSureHit = gBattlerAttacker; gBattlescriptCurrInstr++; } @@ -7950,7 +7950,7 @@ static u8 AttacksThisTurn(u8 bank, u16 move) //Note: returns 1 if it's a chargin { //first argument is unused u8 effect; - if (gBattleMoves[move].effect == EFFECT_SOLARBEAM && (gBattleWeather & WEATHER_SUN_ANY)) + if (gBattleMoves[move].effect == EFFECT_SOLARBEAM && (gBattleWeather & B_WEATHER_SUN)) return 2; effect = gBattleMoves[move].effect; if (effect == EFFECT_SKULL_BASH || effect == EFFECT_RAZOR_WIND || effect == EFFECT_SKY_ATTACK || effect == EFFECT_SOLARBEAM || effect == EFFECT_FLY || effect == EFFECT_BIDE) @@ -8414,14 +8414,14 @@ static void atkBA_jumpifnopursuitswitchdmg(void) static void atkBB_setsunny(void) { - if (gBattleWeather & WEATHER_SUN_ANY) + if (gBattleWeather & B_WEATHER_SUN) { gMoveResultFlags |= MOVE_RESULT_MISSED; gBattleCommunication[MULTISTRING_CHOOSER] = 2; } else { - gBattleWeather = WEATHER_SUN_TEMPORARY; + gBattleWeather = B_WEATHER_SUN_TEMPORARY; gBattleCommunication[MULTISTRING_CHOOSER] = 4; gWishFutureKnock.weatherDuration = 5; } @@ -8503,7 +8503,7 @@ static void atkC0_recoverbasedonsunlight(void) { if (!gBattleWeather || !WEATHER_HAS_EFFECT) gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 2; - else if (gBattleWeather & WEATHER_SUN_ANY) + else if (gBattleWeather & B_WEATHER_SUN) gBattleMoveDamage = 20 * gBattleMons[gBattlerAttacker].maxHP / 30; else //not sunny weather gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 4; @@ -8677,14 +8677,14 @@ static void atkC7_setminimize(void) static void atkC8_sethail(void) { - if (gBattleWeather & WEATHER_HAIL) + if (gBattleWeather & B_WEATHER_HAIL_TEMPORARY) { gMoveResultFlags |= MOVE_RESULT_MISSED; gBattleCommunication[MULTISTRING_CHOOSER] = 2; } else { - gBattleWeather = WEATHER_HAIL; + gBattleWeather = B_WEATHER_HAIL_TEMPORARY; gBattleCommunication[MULTISTRING_CHOOSER] = 5; gWishFutureKnock.weatherDuration = 5; } @@ -8934,7 +8934,7 @@ static void atkD7_setyawn(void) gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1); else { - gStatuses3[gBattlerTarget] |= 0x1000; + gStatuses3[gBattlerTarget] |= STATUS3_YAWN_TURN(2); gBattlescriptCurrInstr += 5; } } @@ -9280,13 +9280,13 @@ static void atkE9_setweatherballtype(void) { if ((u8)(gBattleWeather)) gBattleStruct->dmgMultiplier = 2; - if (gBattleWeather & WEATHER_RAIN_ANY) + if (gBattleWeather & B_WEATHER_RAIN) gBattleStruct->dynamicMoveType = TYPE_WATER | 0x80; - else if (gBattleWeather & WEATHER_SANDSTORM_ANY) + else if (gBattleWeather & B_WEATHER_SANDSTORM) gBattleStruct->dynamicMoveType = TYPE_ROCK | 0x80; - else if (gBattleWeather & WEATHER_SUN_ANY) + else if (gBattleWeather & B_WEATHER_SUN) gBattleStruct->dynamicMoveType = TYPE_FIRE | 0x80; - else if (gBattleWeather & WEATHER_HAIL) + else if (gBattleWeather & B_WEATHER_HAIL_TEMPORARY) gBattleStruct->dynamicMoveType = TYPE_ICE | 0x80; else gBattleStruct->dynamicMoveType = TYPE_NORMAL | 0x80; @@ -9633,21 +9633,21 @@ static void atkF3_trygivecaughtmonnick(void) sub_802BC6C(); break; case 1: - if (gMain.newKeys & DPAD_UP && gBattleCommunication[1] != 0) + if (JOY_NEW(DPAD_UP) && gBattleCommunication[1] != 0) { PlaySE(SE_SELECT); nullsub_6(); gBattleCommunication[1] = 0; sub_802BC6C(); } - if (gMain.newKeys & DPAD_DOWN && gBattleCommunication[1] == 0) + if (JOY_NEW(DPAD_DOWN) && gBattleCommunication[1] == 0) { PlaySE(SE_SELECT); nullsub_6(); gBattleCommunication[1] = 1; sub_802BC6C(); } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); if (gBattleCommunication[1] == 0) @@ -9658,7 +9658,7 @@ static void atkF3_trygivecaughtmonnick(void) else gBattleCommunication[0] = 4; } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); gBattleCommunication[0] = 4; diff --git a/src/battle_setup.c b/src/battle_setup.c index b6e2faff0..e5d0a9f53 100644 --- a/src/battle_setup.c +++ b/src/battle_setup.c @@ -3,6 +3,7 @@ #include "battle.h" #include "battle_transition.h" #include "constants/battle_setup.h" +#include "constants/event_objects.h" #include "constants/items.h" #include "constants/map_types.h" #include "constants/maps.h" @@ -163,283 +164,283 @@ const struct TrainerEyeTrainer gTrainerEyeTrainers[] = { { {TRAINER_ROSE_1, TRAINER_ROSE_2, TRAINER_ROSE_3, TRAINER_ROSE_4, TRAINER_ROSE_5}, - MAP_GROUP(ROUTE118), - MAP_NUM(ROUTE118), + MAP_GROUP(MAP_ROUTE118), + MAP_NUM(MAP_ROUTE118), }, { {TRAINER_DUSTY_1, TRAINER_DUSTY_2, TRAINER_DUSTY_3, TRAINER_DUSTY_4, TRAINER_DUSTY_5}, - MAP_GROUP(ROUTE111), - MAP_NUM(ROUTE111), + MAP_GROUP(MAP_ROUTE111), + MAP_NUM(MAP_ROUTE111), }, { {TRAINER_LOLA_1, TRAINER_LOLA_2, TRAINER_LOLA_3, TRAINER_LOLA_4, TRAINER_LOLA_5}, - MAP_GROUP(ROUTE109), - MAP_NUM(ROUTE109), + MAP_GROUP(MAP_ROUTE109), + MAP_NUM(MAP_ROUTE109), }, { {TRAINER_RICKY_1, TRAINER_RICKY_2, TRAINER_RICKY_3, TRAINER_RICKY_4, TRAINER_RICKY_5}, - MAP_GROUP(ROUTE109), - MAP_NUM(ROUTE109), + MAP_GROUP(MAP_ROUTE109), + MAP_NUM(MAP_ROUTE109), }, { {TRAINER_RITA_AND_SAM_1, TRAINER_RITA_AND_SAM_2, TRAINER_RITA_AND_SAM_3, TRAINER_RITA_AND_SAM_4, TRAINER_RITA_AND_SAM_5}, - MAP_GROUP(ROUTE124), - MAP_NUM(ROUTE124), + MAP_GROUP(MAP_ROUTE124), + MAP_NUM(MAP_ROUTE124), }, { {TRAINER_BROOKE_1, TRAINER_BROOKE_2, TRAINER_BROOKE_3, TRAINER_BROOKE_4, TRAINER_BROOKE_5}, - MAP_GROUP(ROUTE111), - MAP_NUM(ROUTE111), + MAP_GROUP(MAP_ROUTE111), + MAP_NUM(MAP_ROUTE111), }, { {TRAINER_WILTON_1, TRAINER_WILTON_2, TRAINER_WILTON_3, TRAINER_WILTON_4, TRAINER_WILTON_5}, - MAP_GROUP(ROUTE111), - MAP_NUM(ROUTE111), + MAP_GROUP(MAP_ROUTE111), + MAP_NUM(MAP_ROUTE111), }, { {TRAINER_VALERIE_1, TRAINER_VALERIE_2, TRAINER_VALERIE_3, TRAINER_VALERIE_4, TRAINER_VALERIE_5}, - MAP_GROUP(MT_PYRE_6F), - MAP_NUM(MT_PYRE_6F), + MAP_GROUP(MAP_MT_PYRE_6F), + MAP_NUM(MAP_MT_PYRE_6F), }, { {TRAINER_CINDY_1, TRAINER_CINDY_3, TRAINER_CINDY_4, TRAINER_CINDY_5, TRAINER_CINDY_6}, - MAP_GROUP(ROUTE104), - MAP_NUM(ROUTE104), + MAP_GROUP(MAP_ROUTE104), + MAP_NUM(MAP_ROUTE104), }, { {TRAINER_JESSICA_1, TRAINER_JESSICA_2, TRAINER_JESSICA_3, TRAINER_JESSICA_4, TRAINER_JESSICA_5}, - MAP_GROUP(ROUTE121), - MAP_NUM(ROUTE121), + MAP_GROUP(MAP_ROUTE121), + MAP_NUM(MAP_ROUTE121), }, { {TRAINER_WINSTON_1, TRAINER_WINSTON_2, TRAINER_WINSTON_3, TRAINER_WINSTON_4, TRAINER_WINSTON_5}, - MAP_GROUP(ROUTE104), - MAP_NUM(ROUTE104), + MAP_GROUP(MAP_ROUTE104), + MAP_NUM(MAP_ROUTE104), }, { {TRAINER_STEVE_1, TRAINER_STEVE_2, TRAINER_STEVE_3, TRAINER_STEVE_4, TRAINER_STEVE_5}, - MAP_GROUP(ROUTE114), - MAP_NUM(ROUTE114), + MAP_GROUP(MAP_ROUTE114), + MAP_NUM(MAP_ROUTE114), }, { {TRAINER_TONY_1, TRAINER_TONY_2, TRAINER_TONY_3, TRAINER_TONY_4, TRAINER_TONY_5}, - MAP_GROUP(ROUTE107), - MAP_NUM(ROUTE107), + MAP_GROUP(MAP_ROUTE107), + MAP_NUM(MAP_ROUTE107), }, { {TRAINER_NOB_1, TRAINER_NOB_2, TRAINER_NOB_3, TRAINER_NOB_4, TRAINER_NOB_5}, - MAP_GROUP(ROUTE115), - MAP_NUM(ROUTE115), + MAP_GROUP(MAP_ROUTE115), + MAP_NUM(MAP_ROUTE115), }, { {TRAINER_DALTON_1, TRAINER_DALTON_2, TRAINER_DALTON_3, TRAINER_DALTON_4, TRAINER_DALTON_5}, - MAP_GROUP(ROUTE118), - MAP_NUM(ROUTE118), + MAP_GROUP(MAP_ROUTE118), + MAP_NUM(MAP_ROUTE118), }, { {TRAINER_BERNIE_1, TRAINER_BERNIE_2, TRAINER_BERNIE_3, TRAINER_BERNIE_4, TRAINER_BERNIE_5}, - MAP_GROUP(ROUTE114), - MAP_NUM(ROUTE114), + MAP_GROUP(MAP_ROUTE114), + MAP_NUM(MAP_ROUTE114), }, { {TRAINER_ETHAN_1, TRAINER_ETHAN_2, TRAINER_ETHAN_3, TRAINER_ETHAN_4, TRAINER_ETHAN_5}, - MAP_GROUP(JAGGED_PASS), - MAP_NUM(JAGGED_PASS), + MAP_GROUP(MAP_JAGGED_PASS), + MAP_NUM(MAP_JAGGED_PASS), }, { {TRAINER_JOHN_AND_JAY_1, TRAINER_JOHN_AND_JAY_2, TRAINER_JOHN_AND_JAY_3, TRAINER_JOHN_AND_JAY_4, TRAINER_JOHN_AND_JAY_5}, - MAP_GROUP(METEOR_FALLS_1F_2R), - MAP_NUM(METEOR_FALLS_1F_2R), + MAP_GROUP(MAP_METEOR_FALLS_1F_2R), + MAP_NUM(MAP_METEOR_FALLS_1F_2R), }, { {TRAINER_BRANDON_1, TRAINER_BRANDON_2, TRAINER_BRANDON_3, TRAINER_BRANDON_4, TRAINER_BRANDON_5}, - MAP_GROUP(ROUTE120), - MAP_NUM(ROUTE120), + MAP_GROUP(MAP_ROUTE120), + MAP_NUM(MAP_ROUTE120), }, { {TRAINER_CAMERON_1, TRAINER_CAMERON_2, TRAINER_CAMERON_3, TRAINER_CAMERON_4, TRAINER_CAMERON_5}, - MAP_GROUP(ROUTE123), - MAP_NUM(ROUTE123), + MAP_GROUP(MAP_ROUTE123), + MAP_NUM(MAP_ROUTE123), }, { {TRAINER_JACKI_1, TRAINER_JACKI_2, TRAINER_JACKI_3, TRAINER_JACKI_4, TRAINER_JACKI_5}, - MAP_GROUP(ROUTE123), - MAP_NUM(ROUTE123), + MAP_GROUP(MAP_ROUTE123), + MAP_NUM(MAP_ROUTE123), }, { {TRAINER_WALTER_1, TRAINER_WALTER_2, TRAINER_WALTER_3, TRAINER_WALTER_4, TRAINER_WALTER_5}, - MAP_GROUP(ROUTE121), - MAP_NUM(ROUTE121), + MAP_GROUP(MAP_ROUTE121), + MAP_NUM(MAP_ROUTE121), }, { {TRAINER_KAREN_1, TRAINER_KAREN_2, TRAINER_KAREN_3, TRAINER_KAREN_4, TRAINER_KAREN_5}, - MAP_GROUP(ROUTE116), - MAP_NUM(ROUTE116), + MAP_GROUP(MAP_ROUTE116), + MAP_NUM(MAP_ROUTE116), }, { {TRAINER_JERRY_1, TRAINER_JERRY_2, TRAINER_JERRY_3, TRAINER_JERRY_4, TRAINER_JERRY_5}, - MAP_GROUP(ROUTE116), - MAP_NUM(ROUTE116), + MAP_GROUP(MAP_ROUTE116), + MAP_NUM(MAP_ROUTE116), }, { {TRAINER_ANNA_AND_MEG_1, TRAINER_ANNA_AND_MEG_2, TRAINER_ANNA_AND_MEG_3, TRAINER_ANNA_AND_MEG_4, TRAINER_ANNA_AND_MEG_5}, - MAP_GROUP(ROUTE117), - MAP_NUM(ROUTE117), + MAP_GROUP(MAP_ROUTE117), + MAP_NUM(MAP_ROUTE117), }, { {TRAINER_ISABEL_1, TRAINER_ISABEL_2, TRAINER_ISABEL_3, TRAINER_ISABEL_4, TRAINER_ISABEL_5}, - MAP_GROUP(ROUTE110), - MAP_NUM(ROUTE110), + MAP_GROUP(MAP_ROUTE110), + MAP_NUM(MAP_ROUTE110), }, { {TRAINER_MIGUEL_1, TRAINER_MIGUEL_2, TRAINER_MIGUEL_3, TRAINER_MIGUEL_4, TRAINER_MIGUEL_5}, - MAP_GROUP(ROUTE103), - MAP_NUM(ROUTE103), + MAP_GROUP(MAP_ROUTE103), + MAP_NUM(MAP_ROUTE103), }, { {TRAINER_TIMOTHY_1, TRAINER_TIMOTHY_2, TRAINER_TIMOTHY_3, TRAINER_TIMOTHY_4, TRAINER_TIMOTHY_5}, - MAP_GROUP(ROUTE115), - MAP_NUM(ROUTE115), + MAP_GROUP(MAP_ROUTE115), + MAP_NUM(MAP_ROUTE115), }, { {TRAINER_SHELBY_1, TRAINER_SHELBY_2, TRAINER_SHELBY_3, TRAINER_SHELBY_4, TRAINER_SHELBY_5}, - MAP_GROUP(MT_CHIMNEY), - MAP_NUM(MT_CHIMNEY), + MAP_GROUP(MAP_MT_CHIMNEY), + MAP_NUM(MAP_MT_CHIMNEY), }, { {TRAINER_CALVIN_1, TRAINER_CALVIN_2, TRAINER_CALVIN_3, TRAINER_CALVIN_4, TRAINER_CALVIN_5}, - MAP_GROUP(ROUTE102), - MAP_NUM(ROUTE102), + MAP_GROUP(MAP_ROUTE102), + MAP_NUM(MAP_ROUTE102), }, { {TRAINER_ELLIOT_1, TRAINER_ELLIOT_2, TRAINER_ELLIOT_3, TRAINER_ELLIOT_4, TRAINER_ELLIOT_5}, - MAP_GROUP(ROUTE106), - MAP_NUM(ROUTE106), + MAP_GROUP(MAP_ROUTE106), + MAP_NUM(MAP_ROUTE106), }, { {TRAINER_ABIGAIL_1, TRAINER_ABIGAIL_2, TRAINER_ABIGAIL_3, TRAINER_ABIGAIL_4, TRAINER_ABIGAIL_5}, - MAP_GROUP(ROUTE110), - MAP_NUM(ROUTE110), + MAP_GROUP(MAP_ROUTE110), + MAP_NUM(MAP_ROUTE110), }, { {TRAINER_BENJAMIN_1, TRAINER_BENJAMIN_2, TRAINER_BENJAMIN_3, TRAINER_BENJAMIN_4, TRAINER_BENJAMIN_5}, - MAP_GROUP(ROUTE110), - MAP_NUM(ROUTE110), + MAP_GROUP(MAP_ROUTE110), + MAP_NUM(MAP_ROUTE110), }, { {TRAINER_ISAIAH_1, TRAINER_ISAIAH_2, TRAINER_ISAIAH_3, TRAINER_ISAIAH_4, TRAINER_ISAIAH_5}, - MAP_GROUP(ROUTE128), - MAP_NUM(ROUTE128), + MAP_GROUP(MAP_ROUTE128), + MAP_NUM(MAP_ROUTE128), }, { {TRAINER_KATELYN_1, TRAINER_KATELYN_2, TRAINER_KATELYN_3, TRAINER_KATELYN_4, TRAINER_KATELYN_5}, - MAP_GROUP(ROUTE128), - MAP_NUM(ROUTE128), + MAP_GROUP(MAP_ROUTE128), + MAP_NUM(MAP_ROUTE128), }, { {TRAINER_MARIA_1, TRAINER_MARIA_2, TRAINER_MARIA_3, TRAINER_MARIA_4, TRAINER_MARIA_5}, - MAP_GROUP(ROUTE117), - MAP_NUM(ROUTE117), + MAP_GROUP(MAP_ROUTE117), + MAP_NUM(MAP_ROUTE117), }, { {TRAINER_DYLAN_1, TRAINER_DYLAN_2, TRAINER_DYLAN_3, TRAINER_DYLAN_4, TRAINER_DYLAN_5}, - MAP_GROUP(ROUTE117), - MAP_NUM(ROUTE117), + MAP_GROUP(MAP_ROUTE117), + MAP_NUM(MAP_ROUTE117), }, { {TRAINER_NICOLAS_1, TRAINER_NICOLAS_2, TRAINER_NICOLAS_3, TRAINER_NICOLAS_4, TRAINER_NICOLAS_5}, - MAP_GROUP(METEOR_FALLS_1F_2R), - MAP_NUM(METEOR_FALLS_1F_2R), + MAP_GROUP(MAP_METEOR_FALLS_1F_2R), + MAP_NUM(MAP_METEOR_FALLS_1F_2R), }, { {TRAINER_ROBERT_1, TRAINER_ROBERT_2, TRAINER_ROBERT_3, TRAINER_ROBERT_4, TRAINER_ROBERT_5}, - MAP_GROUP(ROUTE120), - MAP_NUM(ROUTE120), + MAP_GROUP(MAP_ROUTE120), + MAP_NUM(MAP_ROUTE120), }, { {TRAINER_LAO_1, TRAINER_LAO_2, TRAINER_LAO_3, TRAINER_LAO_4, TRAINER_LAO_5}, - MAP_GROUP(ROUTE113), - MAP_NUM(ROUTE113), + MAP_GROUP(MAP_ROUTE113), + MAP_NUM(MAP_ROUTE113), }, { {TRAINER_CYNDY_1, TRAINER_CYNDY_2, TRAINER_CYNDY_3, TRAINER_CYNDY_4, TRAINER_CYNDY_5}, - MAP_GROUP(ROUTE115), - MAP_NUM(ROUTE115), + MAP_GROUP(MAP_ROUTE115), + MAP_NUM(MAP_ROUTE115), }, { {TRAINER_MADELINE_1, TRAINER_MADELINE_2, TRAINER_MADELINE_3, TRAINER_MADELINE_4, TRAINER_MADELINE_5}, - MAP_GROUP(ROUTE113), - MAP_NUM(ROUTE113), + MAP_GROUP(MAP_ROUTE113), + MAP_NUM(MAP_ROUTE113), }, { {TRAINER_JENNY_1, TRAINER_JENNY_2, TRAINER_JENNY_3, TRAINER_JENNY_4, TRAINER_JENNY_5}, - MAP_GROUP(ROUTE124), - MAP_NUM(ROUTE124), + MAP_GROUP(MAP_ROUTE124), + MAP_NUM(MAP_ROUTE124), }, { {TRAINER_DIANA_1, TRAINER_DIANA_2, TRAINER_DIANA_3, TRAINER_DIANA_4, TRAINER_DIANA_5}, - MAP_GROUP(JAGGED_PASS), - MAP_NUM(JAGGED_PASS), + MAP_GROUP(MAP_JAGGED_PASS), + MAP_NUM(MAP_JAGGED_PASS), }, { {TRAINER_AMY_AND_LIV_1, TRAINER_AMY_AND_LIV_2, TRAINER_AMY_AND_LIV_4, TRAINER_AMY_AND_LIV_5, TRAINER_AMY_AND_LIV_6}, - MAP_GROUP(ROUTE103), - MAP_NUM(ROUTE103), + MAP_GROUP(MAP_ROUTE103), + MAP_NUM(MAP_ROUTE103), }, { {TRAINER_ERNEST_1, TRAINER_ERNEST_2, TRAINER_ERNEST_3, TRAINER_ERNEST_4, TRAINER_ERNEST_5}, - MAP_GROUP(ROUTE125), - MAP_NUM(ROUTE125), + MAP_GROUP(MAP_ROUTE125), + MAP_NUM(MAP_ROUTE125), }, { {TRAINER_EDWIN_1, TRAINER_EDWIN_2, TRAINER_EDWIN_3, TRAINER_EDWIN_4, TRAINER_EDWIN_5}, - MAP_GROUP(ROUTE110), - MAP_NUM(ROUTE110), + MAP_GROUP(MAP_ROUTE110), + MAP_NUM(MAP_ROUTE110), }, { {TRAINER_LYDIA_1, TRAINER_LYDIA_2, TRAINER_LYDIA_3, TRAINER_LYDIA_4, TRAINER_LYDIA_5}, - MAP_GROUP(ROUTE117), - MAP_NUM(ROUTE117), + MAP_GROUP(MAP_ROUTE117), + MAP_NUM(MAP_ROUTE117), }, { {TRAINER_ISAAC_1, TRAINER_ISAAC_2, TRAINER_ISAAC_3, TRAINER_ISAAC_4, TRAINER_ISAAC_5}, - MAP_GROUP(ROUTE117), - MAP_NUM(ROUTE117), + MAP_GROUP(MAP_ROUTE117), + MAP_NUM(MAP_ROUTE117), }, { {TRAINER_CATHERINE_1, TRAINER_CATHERINE_2, TRAINER_CATHERINE_3, TRAINER_CATHERINE_4, TRAINER_CATHERINE_5}, - MAP_GROUP(ROUTE119), - MAP_NUM(ROUTE119), + MAP_GROUP(MAP_ROUTE119), + MAP_NUM(MAP_ROUTE119), }, { {TRAINER_JACKSON_1, TRAINER_JACKSON_2, TRAINER_JACKSON_3, TRAINER_JACKSON_4, TRAINER_JACKSON_5}, - MAP_GROUP(ROUTE119), - MAP_NUM(ROUTE119), + MAP_GROUP(MAP_ROUTE119), + MAP_NUM(MAP_ROUTE119), }, { {TRAINER_HALEY_1, TRAINER_HALEY_2, TRAINER_HALEY_3, TRAINER_HALEY_4, TRAINER_HALEY_5}, - MAP_GROUP(ROUTE104), - MAP_NUM(ROUTE104), + MAP_GROUP(MAP_ROUTE104), + MAP_NUM(MAP_ROUTE104), }, { {TRAINER_JAMES_1, TRAINER_JAMES_2, TRAINER_JAMES_3, TRAINER_JAMES_4, TRAINER_JAMES_5}, - MAP_GROUP(PETALBURG_WOODS), - MAP_NUM(PETALBURG_WOODS), + MAP_GROUP(MAP_PETALBURG_WOODS), + MAP_NUM(MAP_PETALBURG_WOODS), }, { {TRAINER_TRENT_1, TRAINER_TRENT_2, TRAINER_TRENT_3, TRAINER_TRENT_4, TRAINER_TRENT_5}, - MAP_GROUP(ROUTE112), - MAP_NUM(ROUTE112), + MAP_GROUP(MAP_ROUTE112), + MAP_NUM(MAP_ROUTE112), }, { {TRAINER_LOIS_AND_HAL_1, TRAINER_LOIS_AND_HAL_2, TRAINER_LOIS_AND_HAL_3, TRAINER_LOIS_AND_HAL_4, TRAINER_LOIS_AND_HAL_5}, - MAP_GROUP(ABANDONED_SHIP_ROOMS2_1F), - MAP_NUM(ABANDONED_SHIP_ROOMS2_1F), + MAP_GROUP(MAP_ABANDONED_SHIP_ROOMS2_1F), + MAP_NUM(MAP_ABANDONED_SHIP_ROOMS2_1F), }, { {TRAINER_WALLY_3, TRAINER_WALLY_4, TRAINER_WALLY_5, TRAINER_WALLY_6, TRAINER_NONE}, - MAP_GROUP(VICTORY_ROAD_1F), - MAP_NUM(VICTORY_ROAD_1F), + MAP_GROUP(MAP_VICTORY_ROAD_1F), + MAP_NUM(MAP_VICTORY_ROAD_1F), }, }; @@ -694,7 +695,7 @@ s8 BattleSetup_GetTerrain(void) if (MetatileBehavior_IsBridge(tileBehavior) == TRUE) return BATTLE_TERRAIN_WATER; } - if (gSaveBlock1.location.mapGroup == MAP_GROUP(ROUTE113) && gSaveBlock1.location.mapNum == MAP_NUM(ROUTE113)) + if (gSaveBlock1.location.mapGroup == MAP_GROUP(MAP_ROUTE113) && gSaveBlock1.location.mapNum == MAP_NUM(MAP_ROUTE113)) return BATTLE_TERRAIN_SAND; if (GetSav1Weather() == 8) return BATTLE_TERRAIN_SAND; @@ -946,7 +947,7 @@ static void ResetTrainerOpponentIds(void) { sTrainerBattleMode = 0; gTrainerBattleOpponent = 0; - sTrainerObjectEventLocalId = 0; + sTrainerObjectEventLocalId = LOCALID_NONE; sTrainerIntroSpeech = 0; sTrainerDefeatSpeech = 0; sTrainerVictorySpeech = 0; @@ -992,7 +993,7 @@ static void TrainerBattleLoadArgs(const struct TrainerBattleParameter *specs, co static void SetMapVarsToTrainer(void) { - if (sTrainerObjectEventLocalId) + if (sTrainerObjectEventLocalId != LOCALID_NONE) { gSpecialVar_LastTalked = sTrainerObjectEventLocalId; gSelectedObjectEvent = GetObjectEventIdByLocalIdAndMap(sTrainerObjectEventLocalId, gSaveBlock1.location.mapNum, gSaveBlock1.location.mapGroup); diff --git a/src/battle_util.c b/src/battle_util.c index 136195e7f..ecf311b3c 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -769,22 +769,22 @@ u8 DoFieldEndTurnEffects(void) } break; case ENDTURN_RAIN: - if (gBattleWeather & WEATHER_RAIN_ANY) + if (gBattleWeather & B_WEATHER_RAIN) { - if (!(gBattleWeather & WEATHER_RAIN_PERMANENT)) + if (!(gBattleWeather & B_WEATHER_RAIN_PERMANENT)) { if (--gWishFutureKnock.weatherDuration == 0) { - gBattleWeather &= ~WEATHER_RAIN_TEMPORARY; - gBattleWeather &= ~WEATHER_RAIN_DOWNPOUR; + gBattleWeather &= ~B_WEATHER_RAIN_TEMPORARY; + gBattleWeather &= ~B_WEATHER_RAIN_DOWNPOUR; gBattleCommunication[MULTISTRING_CHOOSER] = 2; } - else if (gBattleWeather & WEATHER_RAIN_DOWNPOUR) + else if (gBattleWeather & B_WEATHER_RAIN_DOWNPOUR) gBattleCommunication[MULTISTRING_CHOOSER] = 1; else gBattleCommunication[MULTISTRING_CHOOSER] = 0; } - else if (gBattleWeather & WEATHER_RAIN_DOWNPOUR) + else if (gBattleWeather & B_WEATHER_RAIN_DOWNPOUR) { gBattleCommunication[MULTISTRING_CHOOSER] = 1; } @@ -799,11 +799,11 @@ u8 DoFieldEndTurnEffects(void) gBattleStruct->turnCountersTracker++; break; case ENDTURN_SANDSTORM: - if (gBattleWeather & WEATHER_SANDSTORM_ANY) + if (gBattleWeather & B_WEATHER_SANDSTORM) { - if (!(gBattleWeather & WEATHER_SANDSTORM_PERMANENT) && --gWishFutureKnock.weatherDuration == 0) + if (!(gBattleWeather & B_WEATHER_SANDSTORM_PERMANENT) && --gWishFutureKnock.weatherDuration == 0) { - gBattleWeather &= ~WEATHER_SANDSTORM_TEMPORARY; + gBattleWeather &= ~B_WEATHER_SANDSTORM_TEMPORARY; gBattlescriptCurrInstr = BattleScript_SandStormHailEnds; } else @@ -819,11 +819,11 @@ u8 DoFieldEndTurnEffects(void) gBattleStruct->turnCountersTracker++; break; case ENDTURN_SUN: - if (gBattleWeather & WEATHER_SUN_ANY) + if (gBattleWeather & B_WEATHER_SUN) { - if (!(gBattleWeather & WEATHER_SUN_PERMANENT) && --gWishFutureKnock.weatherDuration == 0) + if (!(gBattleWeather & B_WEATHER_SUN_PERMANENT) && --gWishFutureKnock.weatherDuration == 0) { - gBattleWeather &= ~WEATHER_SUN_TEMPORARY; + gBattleWeather &= ~B_WEATHER_SUN_TEMPORARY; gBattlescriptCurrInstr = BattleScript_SunlightFaded; } else @@ -837,11 +837,11 @@ u8 DoFieldEndTurnEffects(void) gBattleStruct->turnCountersTracker++; break; case ENDTURN_HAIL: - if (gBattleWeather & WEATHER_HAIL) + if (gBattleWeather & B_WEATHER_HAIL_TEMPORARY) { if (--gWishFutureKnock.weatherDuration == 0) { - gBattleWeather &= ~WEATHER_HAIL; + gBattleWeather &= ~B_WEATHER_HAIL_TEMPORARY; gBattlescriptCurrInstr = BattleScript_SandStormHailEnds; } else @@ -894,7 +894,7 @@ u8 TurnBasedEffects(void) { u8 effect = 0; - gHitMarker |= (HITMARKER_GRUDGE | HITMARKER_x20); + gHitMarker |= (HITMARKER_GRUDGE | HITMARKER_IGNORE_BIDE); while (gBattleStruct->turnEffectsBattlerId < gBattlersCount && gBattleStruct->turnEffectsTracker <= TURNBASED_MAX_CASE) { gActiveBattler = gBattlerAttacker = gBattlerByTurnOrder[gBattleStruct->turnEffectsBattlerId]; @@ -968,9 +968,9 @@ u8 TurnBasedEffects(void) gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / 16; if (gBattleMoveDamage == 0) gBattleMoveDamage = 1; - if ((gBattleMons[gActiveBattler].status1 & 0xF00) != 0xF00) // not 16 turns - gBattleMons[gActiveBattler].status1 += 0x100; - gBattleMoveDamage *= (gBattleMons[gActiveBattler].status1 & 0xF00) >> 8; + if ((gBattleMons[gActiveBattler].status1 & STATUS1_TOXIC_COUNTER) != STATUS1_TOXIC_TURN(15)) // not 16 turns + gBattleMons[gActiveBattler].status1 += STATUS1_TOXIC_TURN(1); + gBattleMoveDamage *= (gBattleMons[gActiveBattler].status1 & STATUS1_TOXIC_COUNTER) >> 8; BattleScriptExecute(BattleScript_PoisonTurnDmg); effect++; } @@ -1013,7 +1013,7 @@ u8 TurnBasedEffects(void) case ENDTURN_WRAP: // wrap if ((gBattleMons[gActiveBattler].status2 & STATUS2_WRAPPED) && gBattleMons[gActiveBattler].hp != 0) { - gBattleMons[gActiveBattler].status2 -= 0x2000; + gBattleMons[gActiveBattler].status2 -= STATUS2_WRAPPED_TURN(1); if (gBattleMons[gActiveBattler].status2 & STATUS2_WRAPPED) // damaged by wrap { gBattleStruct->animArg1 = gSharedMem[BSTRUCT_OFF(wrappedMove) + 2 * gActiveBattler + 0]; @@ -1068,7 +1068,7 @@ u8 TurnBasedEffects(void) else { gBattlerAttacker = gActiveBattler; - gBattleMons[gActiveBattler].status2 -= 0x10; // uproar timer goes down + gBattleMons[gActiveBattler].status2 -= STATUS2_UPROAR_TURN(1); if (WasUnableToUseMove(gActiveBattler)) { CancelMultiTurnMoves(gActiveBattler); @@ -1094,7 +1094,7 @@ u8 TurnBasedEffects(void) case ENDTURN_THRASH: // thrash if (gBattleMons[gActiveBattler].status2 & STATUS2_LOCK_CONFUSE) { - gBattleMons[gActiveBattler].status2 -= 0x400; + gBattleMons[gActiveBattler].status2 -= STATUS2_LOCK_CONFUSE_TURN(1); if (WasUnableToUseMove(gActiveBattler)) CancelMultiTurnMoves(gActiveBattler); else if (!(gBattleMons[gActiveBattler].status2 & STATUS2_LOCK_CONFUSE) @@ -1157,7 +1157,7 @@ u8 TurnBasedEffects(void) break; case ENDTURN_LOCK_ON: // lock-on decrement if (gStatuses3[gActiveBattler] & STATUS3_ALWAYS_HITS) - gStatuses3[gActiveBattler] -= 0x8; + gStatuses3[gActiveBattler] -= STATUS3_ALWAYS_HITS_TURN(1); gBattleStruct->turnEffectsTracker++; break; case ENDTURN_CHARGE: // charge @@ -1173,7 +1173,7 @@ u8 TurnBasedEffects(void) case ENDTURN_YAWN: // yawn if (gStatuses3[gActiveBattler] & STATUS3_YAWN) { - gStatuses3[gActiveBattler] -= 0x800; + gStatuses3[gActiveBattler] -= STATUS3_YAWN_TURN(1); if (!(gStatuses3[gActiveBattler] & STATUS3_YAWN) && !(gBattleMons[gActiveBattler].status1 & STATUS1_ANY) && gBattleMons[gActiveBattler].ability != ABILITY_VITAL_SPIRIT && gBattleMons[gActiveBattler].ability != ABILITY_INSOMNIA && !UproarWakeUpCheck(gActiveBattler)) @@ -1198,13 +1198,13 @@ u8 TurnBasedEffects(void) return effect; } } - gHitMarker &= ~(HITMARKER_GRUDGE | HITMARKER_x20); + gHitMarker &= ~(HITMARKER_GRUDGE | HITMARKER_IGNORE_BIDE); return 0; } bool8 HandleWishPerishSongOnTurnEnd(void) { - gHitMarker |= (HITMARKER_GRUDGE | HITMARKER_x20); + gHitMarker |= (HITMARKER_GRUDGE | HITMARKER_IGNORE_BIDE); switch (gBattleStruct->wishPerishSongState) { @@ -1276,7 +1276,7 @@ bool8 HandleWishPerishSongOnTurnEnd(void) } break; } - gHitMarker &= ~(HITMARKER_GRUDGE | HITMARKER_x20); + gHitMarker &= ~(HITMARKER_GRUDGE | HITMARKER_IGNORE_BIDE); return 0; } @@ -1581,7 +1581,7 @@ u8 AtkCanceller_UnableToUseMove(void) case 12: // bide if (gBattleMons[gBattlerAttacker].status2 & STATUS2_BIDE) { - gBattleMons[gBattlerAttacker].status2 -= 0x100; + gBattleMons[gBattlerAttacker].status2 -= STATUS2_BIDE_TURN(1);; if (gBattleMons[gBattlerAttacker].status2 & STATUS2_BIDE) gBattlescriptCurrInstr = BattleScript_BideStoringEnergy; else @@ -1704,25 +1704,25 @@ u8 CastformDataTypeChange(u8 bank) } if (!WEATHER_HAS_EFFECT) return CASTFORM_NO_CHANGE; - if (!(gBattleWeather & (WEATHER_RAIN_ANY | WEATHER_SUN_ANY | WEATHER_HAIL)) && gBattleMons[bank].type1 != TYPE_NORMAL && gBattleMons[bank].type2 != TYPE_NORMAL) + if (!(gBattleWeather & (B_WEATHER_RAIN | B_WEATHER_SUN | B_WEATHER_HAIL_TEMPORARY)) && gBattleMons[bank].type1 != TYPE_NORMAL && gBattleMons[bank].type2 != TYPE_NORMAL) { gBattleMons[bank].type1 = TYPE_NORMAL; gBattleMons[bank].type2 = TYPE_NORMAL; formChange = CASTFORM_TO_NORMAL; } - if (gBattleWeather & WEATHER_SUN_ANY && gBattleMons[bank].type1 != TYPE_FIRE && gBattleMons[bank].type2 != TYPE_FIRE) + if (gBattleWeather & B_WEATHER_SUN && gBattleMons[bank].type1 != TYPE_FIRE && gBattleMons[bank].type2 != TYPE_FIRE) { gBattleMons[bank].type1 = TYPE_FIRE; gBattleMons[bank].type2 = TYPE_FIRE; formChange = CASTFORM_TO_FIRE; } - if (gBattleWeather & WEATHER_RAIN_ANY && gBattleMons[bank].type1 != TYPE_WATER && gBattleMons[bank].type2 != TYPE_WATER) + if (gBattleWeather & B_WEATHER_RAIN && gBattleMons[bank].type1 != TYPE_WATER && gBattleMons[bank].type2 != TYPE_WATER) { gBattleMons[bank].type1 = TYPE_WATER; gBattleMons[bank].type2 = TYPE_WATER; formChange = CASTFORM_TO_WATER; } - if (gBattleWeather & WEATHER_HAIL && gBattleMons[bank].type1 != TYPE_ICE && gBattleMons[bank].type2 != TYPE_ICE) + if (gBattleWeather & B_WEATHER_HAIL_TEMPORARY && gBattleMons[bank].type1 != TYPE_ICE && gBattleMons[bank].type2 != TYPE_ICE) { gBattleMons[bank].type1 = TYPE_ICE; gBattleMons[bank].type2 = TYPE_ICE; @@ -1797,27 +1797,27 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg) case WEATHER_RAIN_LIGHT: case WEATHER_RAIN_MED: case WEATHER_RAIN_HEAVY: - if (!(gBattleWeather & WEATHER_RAIN_ANY)) + if (!(gBattleWeather & B_WEATHER_RAIN)) { - gBattleWeather = (WEATHER_RAIN_TEMPORARY | WEATHER_RAIN_PERMANENT); + gBattleWeather = (B_WEATHER_RAIN_TEMPORARY | B_WEATHER_RAIN_PERMANENT); gBattleStruct->animArg1 = B_ANIM_RAIN_CONTINUES; gBattleStruct->scriptingActive = bank; effect++; } break; case WEATHER_SANDSTORM: - if (!(gBattleWeather & WEATHER_SANDSTORM_ANY)) + if (!(gBattleWeather & B_WEATHER_SANDSTORM)) { - gBattleWeather = (WEATHER_SANDSTORM_PERMANENT | WEATHER_SANDSTORM_TEMPORARY); + gBattleWeather = (B_WEATHER_SANDSTORM_PERMANENT | B_WEATHER_SANDSTORM_TEMPORARY); gBattleStruct->animArg1 = B_ANIM_SANDSTORM_CONTINUES; gBattleStruct->scriptingActive = bank; effect++; } break; case WEATHER_DROUGHT: - if (!(gBattleWeather & WEATHER_SUN_ANY)) + if (!(gBattleWeather & B_WEATHER_SUN)) { - gBattleWeather = (WEATHER_SUN_PERMANENT | WEATHER_SUN_TEMPORARY); + gBattleWeather = (B_WEATHER_SUN_PERMANENT | B_WEATHER_SUN_TEMPORARY); gBattleStruct->animArg1 = B_ANIM_SUN_CONTINUES; gBattleStruct->scriptingActive = bank; effect++; @@ -1831,27 +1831,27 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg) } break; case ABILITY_DRIZZLE: - if (!(gBattleWeather & WEATHER_RAIN_PERMANENT)) + if (!(gBattleWeather & B_WEATHER_RAIN_PERMANENT)) { - gBattleWeather = (WEATHER_RAIN_PERMANENT | WEATHER_RAIN_TEMPORARY); + gBattleWeather = (B_WEATHER_RAIN_PERMANENT | B_WEATHER_RAIN_TEMPORARY); BattleScriptPushCursorAndCallback(BattleScript_DrizzleActivates); gBattleStruct->scriptingActive = bank; effect++; } break; case ABILITY_SAND_STREAM: - if (!(gBattleWeather & WEATHER_SANDSTORM_PERMANENT)) + if (!(gBattleWeather & B_WEATHER_SANDSTORM_PERMANENT)) { - gBattleWeather = (WEATHER_SANDSTORM_PERMANENT | WEATHER_SANDSTORM_TEMPORARY); + gBattleWeather = (B_WEATHER_SANDSTORM_PERMANENT | B_WEATHER_SANDSTORM_TEMPORARY); BattleScriptPushCursorAndCallback(BattleScript_SandstreamActivates); gBattleStruct->scriptingActive = bank; effect++; } break; case ABILITY_DROUGHT: - if (!(gBattleWeather & WEATHER_SUN_PERMANENT)) + if (!(gBattleWeather & B_WEATHER_SUN_PERMANENT)) { - gBattleWeather = (WEATHER_SUN_PERMANENT | WEATHER_SUN_TEMPORARY); + gBattleWeather = (B_WEATHER_SUN_PERMANENT | B_WEATHER_SUN_TEMPORARY); BattleScriptPushCursorAndCallback(BattleScript_DroughtActivates); gBattleStruct->scriptingActive = bank; effect++; @@ -1906,7 +1906,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg) switch (gLastUsedAbility) { case ABILITY_RAIN_DISH: - if (WEATHER_HAS_EFFECT && (gBattleWeather & WEATHER_RAIN_ANY) + if (WEATHER_HAS_EFFECT && (gBattleWeather & B_WEATHER_RAIN) && gBattleMons[bank].maxHP > gBattleMons[bank].hp) { gLastUsedAbility = ABILITY_RAIN_DISH; // why @@ -2241,7 +2241,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg) && GetGenderFromSpeciesAndPersonality(speciesAtk, pidAtk) != 0xFF && GetGenderFromSpeciesAndPersonality(speciesDef, pidDef) != 0xFF) { - gBattleMons[gBattlerAttacker].status2 |= (gBitTable[gBattlerTarget] << 0x10); + gBattleMons[gBattlerAttacker].status2 |= STATUS2_INFATUATED_WITH(gBattlerTarget); BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_CuteCharmActivates; effect++; @@ -2262,7 +2262,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg) && GetGenderFromSpeciesAndPersonality(speciesAtk, pidAtk) != 0xFF && GetGenderFromSpeciesAndPersonality(speciesDef, pidDef) != 0xFF) { - gBattleMons[gBattlerAttacker].status2 |= (gBitTable[gBattlerTarget] << 0x10); + gBattleMons[gBattlerAttacker].status2 |= STATUS2_INFATUATED_WITH(gBattlerTarget); BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_CuteCharmActivates; effect++; @@ -2373,9 +2373,9 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg) } break; case ABILITYEFFECT_SYNCHRONIZE: // 7 - if (gLastUsedAbility == ABILITY_SYNCHRONIZE && (gHitMarker & HITMARKER_SYNCHRONISE_EFFECT)) + if (gLastUsedAbility == ABILITY_SYNCHRONIZE && (gHitMarker & HITMARKER_SYNCHRONIZE_EFFECT)) { - gHitMarker &= ~(HITMARKER_SYNCHRONISE_EFFECT); + gHitMarker &= ~(HITMARKER_SYNCHRONIZE_EFFECT); gBattleStruct->synchroniseEffect &= 0x3F; if (gBattleStruct->synchroniseEffect == 6) gBattleStruct->synchroniseEffect = 2; @@ -2388,9 +2388,9 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg) } break; case ABILITYEFFECT_ATK_SYNCHRONIZE: // 8 - if (gLastUsedAbility == ABILITY_SYNCHRONIZE && (gHitMarker & HITMARKER_SYNCHRONISE_EFFECT)) + if (gLastUsedAbility == ABILITY_SYNCHRONIZE && (gHitMarker & HITMARKER_SYNCHRONIZE_EFFECT)) { - gHitMarker &= ~(HITMARKER_SYNCHRONISE_EFFECT); + gHitMarker &= ~(HITMARKER_SYNCHRONIZE_EFFECT); gBattleStruct->synchroniseEffect &= 0x3F; if (gBattleStruct->synchroniseEffect == 6) gBattleStruct->synchroniseEffect = 2; @@ -3552,7 +3552,7 @@ u8 IsMonDisobedient(void) gBattleStruct->dynamicMoveType = 0; gBattlescriptCurrInstr = BattleScript_IgnoresAndUsesRandomMove; gBattlerTarget = GetMoveTarget(gRandomMove, 0); - gHitMarker |= HITMARKER_x200000; + gHitMarker |= HITMARKER_DISOBEDIENT_MOVE; return 2; } } diff --git a/src/berry_blender.c b/src/berry_blender.c index 35c5a473d..5b305f621 100644 --- a/src/berry_blender.c +++ b/src/berry_blender.c @@ -1815,9 +1815,9 @@ static void sub_80500A8(void) u8 var2 = gBerryBlenderData->field_A2[GetMultiplayerId()]; if (gBerryBlenderData->field_6F == 0) { - if (gSaveBlock2.optionsButtonMode == OPTIONS_BUTTON_MODE_L_EQUALS_A && gMain.newKeys & A_BUTTON) + if (gSaveBlock2.optionsButtonMode == OPTIONS_BUTTON_MODE_L_EQUALS_A && JOY_NEW(A_BUTTON)) A_pressed = ((gMain.heldKeysRaw & (A_BUTTON | L_BUTTON)) != (A_BUTTON | L_BUTTON)); - else if (gMain.newKeys & A_BUTTON) + else if (JOY_NEW(A_BUTTON)) A_pressed = 1; if (A_pressed) { @@ -1838,7 +1838,7 @@ static void sub_80500A8(void) gBerryBlenderData->field_56--; gBerryBlenderData->field_7E = 0; } - if (gUnknown_020297ED && gMain.newKeys & L_BUTTON) + if (gUnknown_020297ED && JOY_NEW(L_BUTTON)) gBerryBlenderData->field_14B ^= 1; } @@ -2240,24 +2240,24 @@ static void sub_8050954(void) gBerryBlenderData->field_6F++; break; case 10: - if (gMain.newKeys & DPAD_UP) + if (JOY_NEW(DPAD_UP)) { if (gBerryBlenderData->field_AA != 0) PlaySE(SE_SELECT); sub_80508D4(0); } - else if (gMain.newKeys & DPAD_DOWN) + else if (JOY_NEW(DPAD_DOWN)) { if (gBerryBlenderData->field_AA != 1) PlaySE(SE_SELECT); sub_80508D4(1); } - else if (gMain.newKeys & A_BUTTON) + else if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); gBerryBlenderData->field_6F++; } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); gBerryBlenderData->field_6F++; @@ -2742,7 +2742,7 @@ void unref_sub_80516F8(u8 taskID) Menu_PrintText(gOtherText_PressAToStart, 1, 15); } } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { sub_8007E4C(); DestroyTask(taskID); @@ -3067,7 +3067,7 @@ bool8 Blender_PrintBlendingResults(void) } break; case 4: - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) gBerryBlenderData->field_0++; break; case 5: @@ -3242,7 +3242,7 @@ static bool8 Blender_PrintBlendingRanking(void) gBerryBlenderData->field_0++; break; case 5: - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); gBerryBlenderData->field_0++; @@ -3412,47 +3412,47 @@ static void sub_80527BC(void) static void sub_8052918(void) { - if (gMain.newKeys & R_BUTTON) + if (JOY_NEW(R_BUTTON)) { sBlenderDebug.BPM += 1000; if (sBlenderDebug.BPM > 30000) sBlenderDebug.BPM = 1000; sBlenderDebug.field_10++; } - if (gMain.newKeys & L_BUTTON) + if (JOY_NEW(L_BUTTON)) { sBlenderDebug.BPM -= 1000; if (sBlenderDebug.BPM < 0) sBlenderDebug.BPM = 30000; sBlenderDebug.field_10++; } - if (gMain.newKeys & DPAD_UP) + if (JOY_NEW(DPAD_UP)) { sBlenderDebug.cursorPos -= 1; if (sBlenderDebug.cursorPos < 0) sBlenderDebug.cursorPos = 3; sBlenderDebug.field_10++; } - if (gMain.newKeys & DPAD_DOWN) + if (JOY_NEW(DPAD_DOWN)) { sBlenderDebug.cursorPos += 1; if (sBlenderDebug.cursorPos > 3) sBlenderDebug.cursorPos = 0; sBlenderDebug.field_10++; } - if (gMain.newKeys & DPAD_LEFT) + if (JOY_NEW(DPAD_LEFT)) { if (--sBlenderDebug.berries[sBlenderDebug.cursorPos] < 0) sBlenderDebug.berries[sBlenderDebug.cursorPos] = 42; sBlenderDebug.field_10++; } - if (gMain.newKeys & DPAD_RIGHT) + if (JOY_NEW(DPAD_RIGHT)) { if (++sBlenderDebug.berries[sBlenderDebug.cursorPos] > 42) sBlenderDebug.berries[sBlenderDebug.cursorPos] = 0; sBlenderDebug.field_10++; } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { u16 berryIDs[4]; struct BlenderBerry berries[4]; @@ -3482,7 +3482,7 @@ static void sub_8052918(void) BlenderDebug_PrintBerryData(); sBlenderDebug.field_10 = 0; } - if (gMain.newKeys & SELECT_BUTTON && gUnknown_020297DC == 0) + if (JOY_NEW(SELECT_BUTTON) && gUnknown_020297DC == 0) { gUnknown_020297DC++; gUnknown_020297E0 = 0; diff --git a/src/berry_tag_screen.c b/src/berry_tag_screen.c index 2a2ff6ae2..9343b0fb3 100644 --- a/src/berry_tag_screen.c +++ b/src/berry_tag_screen.c @@ -253,11 +253,11 @@ static void sub_8146480(u8 taskid) { if (!gPaletteFade.active) { - if ((gMain.newAndRepeatedKeys & (DPAD_RIGHT | DPAD_LEFT | DPAD_UP | DPAD_DOWN)) == DPAD_UP) + if (JOY_REPT(DPAD_ANY) == DPAD_UP) sub_81466E8(taskid, -1); - if ((gMain.newAndRepeatedKeys & (DPAD_RIGHT | DPAD_LEFT | DPAD_UP | DPAD_DOWN)) == DPAD_DOWN) + if (JOY_REPT(DPAD_ANY) == DPAD_DOWN) sub_81466E8(taskid, 1); - if (gMain.newKeys & A_BUTTON || gMain.newKeys & B_BUTTON) + if (JOY_NEW(A_BUTTON) || JOY_NEW(B_BUTTON)) sub_8146440(taskid); } } diff --git a/src/braille_puzzles.c b/src/braille_puzzles.c index 53c1ae8c7..6b09e3333 100644 --- a/src/braille_puzzles.c +++ b/src/braille_puzzles.c @@ -27,8 +27,8 @@ extern u8 S_OpenRegiceChamber[]; // regiice event script bool8 ShouldDoBrailleDigEffect(void) { if (!FlagGet(FLAG_SYS_BRAILLE_DIG) - && (gSaveBlock1.location.mapGroup == MAP_GROUP(SEALED_CHAMBER_OUTER_ROOM) - && gSaveBlock1.location.mapNum == MAP_NUM(SEALED_CHAMBER_OUTER_ROOM))) + && (gSaveBlock1.location.mapGroup == MAP_GROUP(MAP_SEALED_CHAMBER_OUTER_ROOM) + && gSaveBlock1.location.mapNum == MAP_NUM(MAP_SEALED_CHAMBER_OUTER_ROOM))) { if (gSaveBlock1.pos.x == 10 && gSaveBlock1.pos.y == 3) return TRUE; @@ -70,7 +70,7 @@ bool8 CheckRelicanthWailord(void) bool8 ShouldDoBrailleStrengthEffect(void) { - if (!FlagGet(FLAG_SYS_BRAILLE_STRENGTH) && (gSaveBlock1.location.mapGroup == MAP_GROUP(DESERT_RUINS) && gSaveBlock1.location.mapNum == MAP_NUM(DESERT_RUINS))) + if (!FlagGet(FLAG_SYS_BRAILLE_STRENGTH) && (gSaveBlock1.location.mapGroup == MAP_GROUP(MAP_DESERT_RUINS) && gSaveBlock1.location.mapNum == MAP_NUM(MAP_DESERT_RUINS))) { if (gSaveBlock1.pos.x == 10 && gSaveBlock1.pos.y == 23) return TRUE; @@ -100,7 +100,7 @@ void DoBrailleStrengthEffect(void) bool8 ShouldDoBrailleFlyEffect(void) { - if (!FlagGet(FLAG_SYS_BRAILLE_FLY) && (gSaveBlock1.location.mapGroup == MAP_GROUP(ANCIENT_TOMB) && gSaveBlock1.location.mapNum == MAP_NUM(ANCIENT_TOMB))) + if (!FlagGet(FLAG_SYS_BRAILLE_FLY) && (gSaveBlock1.location.mapGroup == MAP_GROUP(MAP_ANCIENT_TOMB) && gSaveBlock1.location.mapNum == MAP_NUM(MAP_ANCIENT_TOMB))) { if (gSaveBlock1.pos.x == 8 && gSaveBlock1.pos.y == 25) return TRUE; @@ -212,7 +212,7 @@ bool32 BrailleWait_CheckButtonPress(void) if (gSaveBlock2.optionsButtonMode == OPTIONS_BUTTON_MODE_L_EQUALS_A) keyMask |= L_BUTTON; - if (gMain.newKeys & keyMask) + if (JOY_NEW(keyMask)) return TRUE; else return FALSE; diff --git a/src/cable_club.c b/src/cable_club.c index 961ab739f..346c2af94 100644 --- a/src/cable_club.c +++ b/src/cable_club.c @@ -227,7 +227,7 @@ static bool32 sub_8082DF4(u8 taskId) static bool32 sub_8082E28(u8 taskId) { - if ((gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON) && IsLinkConnectionEstablished() == FALSE) { gTasks[taskId].func = sub_80833EC; @@ -241,7 +241,7 @@ static bool32 sub_8082E6C(u8 taskId) if (IsLinkConnectionEstablished()) SetSuppressLinkErrorMessage(TRUE); - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { gTasks[taskId].func = sub_80833EC; return TRUE; @@ -337,7 +337,7 @@ static void sub_808303C(u8 taskId) sub_8082D60(taskId, linkPlayerCount); - if (!(gMain.newKeys & A_BUTTON)) + if (!JOY_NEW(A_BUTTON)) return; #if ENGLISH @@ -376,12 +376,12 @@ static void sub_80830E4(u8 taskId) ShowFieldAutoScrollMessage(gUnknown_081A4932); gTasks[taskId].func = sub_8082FEC; } - else if (gMain.heldKeys & B_BUTTON) + else if (JOY_HELD(B_BUTTON)) { ShowFieldAutoScrollMessage(gUnknown_081A4932); gTasks[taskId].func = sub_8082FEC; } - else if (gMain.heldKeys & A_BUTTON) + else if (JOY_HELD(A_BUTTON)) { PlaySE(SE_SELECT); sub_8007F4C(); diff --git a/src/calculate_base_damage.c b/src/calculate_base_damage.c index c15b94d8f..035132c6b 100644 --- a/src/calculate_base_damage.c +++ b/src/calculate_base_damage.c @@ -297,7 +297,7 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de if (!AbilityBattleEffects(ABILITYEFFECT_FIELD_SPORT, 0, ABILITY_CLOUD_NINE, 0, 0) && !AbilityBattleEffects(ABILITYEFFECT_FIELD_SPORT, 0, ABILITY_AIR_LOCK, 0, 0)) { - if (gBattleWeather & WEATHER_RAIN_TEMPORARY) + if (gBattleWeather & B_WEATHER_RAIN_TEMPORARY) { switch (type) { @@ -311,11 +311,11 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de } // any weather except sun weakens solar beam - if ((gBattleWeather & (WEATHER_RAIN_ANY | WEATHER_SANDSTORM_ANY | WEATHER_HAIL)) && gCurrentMove == MOVE_SOLAR_BEAM) + if ((gBattleWeather & (B_WEATHER_RAIN | B_WEATHER_SANDSTORM | B_WEATHER_HAIL_TEMPORARY)) && gCurrentMove == MOVE_SOLAR_BEAM) damage /= 2; // sunny - if (gBattleWeather & WEATHER_SUN_ANY) + if (gBattleWeather & B_WEATHER_SUN) { switch (type) { diff --git a/src/choose_party.c b/src/choose_party.c index ded31efbd..3b2f6dea7 100644 --- a/src/choose_party.c +++ b/src/choose_party.c @@ -318,7 +318,7 @@ static void sub_812238C(u8 taskId) { if (!gPaletteFade.active) { - if (gMain.newAndRepeatedKeys & 0x40) + if (JOY_REPT(0x40)) { if (Menu_GetCursorPos() != 0) { @@ -327,7 +327,7 @@ static void sub_812238C(u8 taskId) } return; } - if (gMain.newAndRepeatedKeys & 0x80) + if (JOY_REPT(0x80)) { if (Menu_GetCursorPos() != 3) { @@ -336,7 +336,7 @@ static void sub_812238C(u8 taskId) } return; } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { TaskFunc popupMenuFunc; @@ -349,7 +349,7 @@ static void sub_812238C(u8 taskId) popupMenuFunc(taskId); return; } - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { BattleTowerEntryMenuCallback_Exit(taskId); return; @@ -370,7 +370,7 @@ static void sub_8122450(u8 taskId) // Wait for A or B press static void sub_8122480(u8 taskId) { - if ((gMain.newKeys & A_BUTTON) || (gMain.newKeys & B_BUTTON)) + if (JOY_NEW(A_BUTTON) || JOY_NEW(B_BUTTON)) BattleTowerEntryMenuCallback_Exit(taskId); } @@ -475,7 +475,7 @@ static void sub_8122728(u8 taskId) if (gPartyMenuMessage_IsPrinting == 1) return; - if ((gMain.newKeys & A_BUTTON) || (gMain.newKeys & B_BUTTON)) + if (JOY_NEW(A_BUTTON) || JOY_NEW(B_BUTTON)) { Menu_EraseWindowRect(0, 14, 29, 19); Menu_DestroyCursor(); @@ -836,7 +836,7 @@ static void Task_DaycareStorageMenu8122EAC(u8 taskId) { if (!gPaletteFade.active) { - if (gMain.newAndRepeatedKeys & 0x40) + if (JOY_REPT(0x40)) { if (Menu_GetCursorPos() != 0) { @@ -845,7 +845,7 @@ static void Task_DaycareStorageMenu8122EAC(u8 taskId) } return; } - if (gMain.newAndRepeatedKeys & 0x80) + if (JOY_REPT(0x80)) { if (Menu_GetCursorPos() != 3) { @@ -854,7 +854,7 @@ static void Task_DaycareStorageMenu8122EAC(u8 taskId) } return; } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { TaskFunc popupMenuFunc; @@ -867,7 +867,7 @@ static void Task_DaycareStorageMenu8122EAC(u8 taskId) popupMenuFunc(taskId); return; } - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { DaycareStorageMenuCallback_Exit(taskId); return; diff --git a/src/contest.c b/src/contest.c index 820ae326a..c01fa15f0 100644 --- a/src/contest.c +++ b/src/contest.c @@ -461,7 +461,7 @@ void sub_80ABC3C(u8 taskId) void Task_TryShowMoveSelectScreen(u8 taskId) { - if ((gMain.newKeys & A_BUTTON) || (gMain.newKeys == B_BUTTON)) + if (JOY_NEW(A_BUTTON) || (gMain.newKeys == B_BUTTON)) { PlaySE(SE_SELECT); if (!Contest_IsMonsTurnDisabled(gContestPlayerMonIndex)) @@ -544,7 +544,7 @@ void Task_HandleMoveSelectInput(u8 taskId) numMoves++; } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { DestroyMenuCursor(); PlaySE(SE_SELECT); diff --git a/src/contest_link_util.c b/src/contest_link_util.c index e8f27ed57..448c07265 100644 --- a/src/contest_link_util.c +++ b/src/contest_link_util.c @@ -684,7 +684,7 @@ static void sub_80C2D1C(u8 taskId) { int i; - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { if (!(gIsLinkContest & 1)) { diff --git a/src/contest_painting.c b/src/contest_painting.c index 1f127f760..6d8de0d2b 100644 --- a/src/contest_painting.c +++ b/src/contest_painting.c @@ -194,7 +194,7 @@ static void HoldContestPainting(void) sFrameCounter--; break; case 1: - if ((gMain.newKeys & A_BUTTON) || (gMain.newKeys & B_BUTTON)) + if (JOY_NEW(A_BUTTON) || JOY_NEW(B_BUTTON)) { sHoldState++; BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); diff --git a/src/contest_util.c b/src/contest_util.c index f4c3c2e1c..c525a3077 100644 --- a/src/contest_util.c +++ b/src/contest_util.c @@ -23,6 +23,7 @@ #include "pokemon.h" #include "random.h" #include "task.h" +#include "constants/event_objects.h" #define CONTEST_ENTRY_PIC_LEFT 10 #define CONTEST_ENTRY_PIC_TOP 3 @@ -52,15 +53,15 @@ void GetNpcContestantLocalId(void) switch(specialVar) { case 0: - localId = 3; + localId = LOCALID_CONTESTANT_1; break; case 1: - localId = 4; + localId = LOCALID_CONTESTANT_2; break; case 2: - localId = 5; + localId = LOCALID_CONTESTANT_3; break; - default: + default: // Invalid localId = 100; break; } diff --git a/src/credits.c b/src/credits.c index 49bbf80bd..69e4adefa 100644 --- a/src/credits.c +++ b/src/credits.c @@ -436,7 +436,7 @@ static void CB2_Credits(void) BuildOamBuffer(); UpdatePaletteFade(); - if ((gMain.heldKeys & B_BUTTON) + if (JOY_HELD(B_BUTTON) && gHasHallOfFameRecords != 0 && gTasks[sSavedTaskId].func == Task_CreditsMain) { diff --git a/src/data/.gitignore b/src/data/.gitignore index eaf9e1f6d..65490f828 100644 --- a/src/data/.gitignore +++ b/src/data/.gitignore @@ -1 +1,2 @@ +heal_locations.h wild_encounters.h diff --git a/src/data/heal_locations.constants.json.txt b/src/data/heal_locations.constants.json.txt new file mode 100644 index 000000000..e9ca860b3 --- /dev/null +++ b/src/data/heal_locations.constants.json.txt @@ -0,0 +1,14 @@ +#ifndef GUARD_CONSTANTS_HEAL_LOCATIONS_H +#define GUARD_CONSTANTS_HEAL_LOCATIONS_H + +{{ doNotModifyHeader }} + +enum { + HEAL_LOCATION_NONE, +## for heal_location in heal_locations + {{ heal_location.id }}, +## endfor + NUM_HEAL_LOCATIONS +}; + +#endif // GUARD_CONSTANTS_HEAL_LOCATIONS_H diff --git a/src/data/heal_locations.h b/src/data/heal_locations.h deleted file mode 100644 index a6bdbdd15..000000000 --- a/src/data/heal_locations.h +++ /dev/null @@ -1,25 +0,0 @@ -static const struct HealLocation sHealLocations[] = -{ - [HEAL_LOCATION_LITTLEROOT_TOWN_BRENDANS_HOUSE_2F - 1] = {MAP_GROUP(LITTLEROOT_TOWN_BRENDANS_HOUSE_2F), MAP_NUM(LITTLEROOT_TOWN_BRENDANS_HOUSE_2F), 4, 2}, - [HEAL_LOCATION_LITTLEROOT_TOWN_MAYS_HOUSE_2F - 1] = {MAP_GROUP(LITTLEROOT_TOWN_MAYS_HOUSE_2F), MAP_NUM(LITTLEROOT_TOWN_MAYS_HOUSE_2F), 4, 2}, - [HEAL_LOCATION_PETALBURG_CITY - 1] = {MAP_GROUP(PETALBURG_CITY), MAP_NUM(PETALBURG_CITY), 20, 17}, - [HEAL_LOCATION_SLATEPORT_CITY - 1] = {MAP_GROUP(SLATEPORT_CITY), MAP_NUM(SLATEPORT_CITY), 19, 20}, - [HEAL_LOCATION_MAUVILLE_CITY - 1] = {MAP_GROUP(MAUVILLE_CITY), MAP_NUM(MAUVILLE_CITY), 22, 6}, - [HEAL_LOCATION_RUSTBORO_CITY - 1] = {MAP_GROUP(RUSTBORO_CITY), MAP_NUM(RUSTBORO_CITY), 16, 39}, - [HEAL_LOCATION_FORTREE_CITY - 1] = {MAP_GROUP(FORTREE_CITY), MAP_NUM(FORTREE_CITY), 5, 7}, - [HEAL_LOCATION_LILYCOVE_CITY - 1] = {MAP_GROUP(LILYCOVE_CITY), MAP_NUM(LILYCOVE_CITY), 24, 15}, - [HEAL_LOCATION_MOSSDEEP_CITY - 1] = {MAP_GROUP(MOSSDEEP_CITY), MAP_NUM(MOSSDEEP_CITY), 28, 17}, - [HEAL_LOCATION_SOOTOPOLIS_CITY - 1] = {MAP_GROUP(SOOTOPOLIS_CITY), MAP_NUM(SOOTOPOLIS_CITY), 43, 32}, - [HEAL_LOCATION_EVER_GRANDE_CITY - 1] = {MAP_GROUP(EVER_GRANDE_CITY), MAP_NUM(EVER_GRANDE_CITY), 27, 49}, - [HEAL_LOCATION_LITTLEROOT_TOWN_BRENDANS_HOUSE - 1] = {MAP_GROUP(LITTLEROOT_TOWN), MAP_NUM(LITTLEROOT_TOWN), 5, 9}, - [HEAL_LOCATION_LITTLEROOT_TOWN_MAYS_HOUSE - 1] = {MAP_GROUP(LITTLEROOT_TOWN), MAP_NUM(LITTLEROOT_TOWN), 14, 9}, - [HEAL_LOCATION_OLDALE_TOWN - 1] = {MAP_GROUP(OLDALE_TOWN), MAP_NUM(OLDALE_TOWN), 6, 17}, - [HEAL_LOCATION_DEWFORD_TOWN - 1] = {MAP_GROUP(DEWFORD_TOWN), MAP_NUM(DEWFORD_TOWN), 2, 11}, - [HEAL_LOCATION_LAVARIDGE_TOWN - 1] = {MAP_GROUP(LAVARIDGE_TOWN), MAP_NUM(LAVARIDGE_TOWN), 9, 7}, - [HEAL_LOCATION_FALLARBOR_TOWN - 1] = {MAP_GROUP(FALLARBOR_TOWN), MAP_NUM(FALLARBOR_TOWN), 14, 8}, - [HEAL_LOCATION_VERDANTURF_TOWN - 1] = {MAP_GROUP(VERDANTURF_TOWN), MAP_NUM(VERDANTURF_TOWN), 16, 4}, - [HEAL_LOCATION_PACIFIDLOG_TOWN - 1] = {MAP_GROUP(PACIFIDLOG_TOWN), MAP_NUM(PACIFIDLOG_TOWN), 8, 16}, - [HEAL_LOCATION_EVER_GRANDE_CITY_POKEMON_LEAGUE - 1] = {MAP_GROUP(EVER_GRANDE_CITY), MAP_NUM(EVER_GRANDE_CITY), 18, 6}, - [HEAL_LOCATION_BATTLE_TOWER_OUTSIDE - 1] = {MAP_GROUP(BATTLE_TOWER_OUTSIDE), MAP_NUM(BATTLE_TOWER_OUTSIDE), 14, 9}, - [HEAL_LOCATION_SOUTHERN_ISLAND_EXTERIOR - 1] = {MAP_GROUP(SOUTHERN_ISLAND_EXTERIOR), MAP_NUM(SOUTHERN_ISLAND_EXTERIOR), 15, 20}, -}; diff --git a/src/data/heal_locations.json b/src/data/heal_locations.json new file mode 100644 index 000000000..51c3526be --- /dev/null +++ b/src/data/heal_locations.json @@ -0,0 +1,136 @@ +{ + "heal_locations": [ + { + "id": "HEAL_LOCATION_LITTLEROOT_TOWN_BRENDANS_HOUSE_2F", + "map": "MAP_LITTLEROOT_TOWN_BRENDANS_HOUSE_2F", + "x": 4, + "y": 2 + }, + { + "id": "HEAL_LOCATION_LITTLEROOT_TOWN_MAYS_HOUSE_2F", + "map": "MAP_LITTLEROOT_TOWN_MAYS_HOUSE_2F", + "x": 4, + "y": 2 + }, + { + "id": "HEAL_LOCATION_PETALBURG_CITY", + "map": "MAP_PETALBURG_CITY", + "x": 20, + "y": 17 + }, + { + "id": "HEAL_LOCATION_SLATEPORT_CITY", + "map": "MAP_SLATEPORT_CITY", + "x": 19, + "y": 20 + }, + { + "id": "HEAL_LOCATION_MAUVILLE_CITY", + "map": "MAP_MAUVILLE_CITY", + "x": 22, + "y": 6 + }, + { + "id": "HEAL_LOCATION_RUSTBORO_CITY", + "map": "MAP_RUSTBORO_CITY", + "x": 16, + "y": 39 + }, + { + "id": "HEAL_LOCATION_FORTREE_CITY", + "map": "MAP_FORTREE_CITY", + "x": 5, + "y": 7 + }, + { + "id": "HEAL_LOCATION_LILYCOVE_CITY", + "map": "MAP_LILYCOVE_CITY", + "x": 24, + "y": 15 + }, + { + "id": "HEAL_LOCATION_MOSSDEEP_CITY", + "map": "MAP_MOSSDEEP_CITY", + "x": 28, + "y": 17 + }, + { + "id": "HEAL_LOCATION_SOOTOPOLIS_CITY", + "map": "MAP_SOOTOPOLIS_CITY", + "x": 43, + "y": 32 + }, + { + "id": "HEAL_LOCATION_EVER_GRANDE_CITY", + "map": "MAP_EVER_GRANDE_CITY", + "x": 27, + "y": 49 + }, + { + "id": "HEAL_LOCATION_LITTLEROOT_TOWN_BRENDANS_HOUSE", + "map": "MAP_LITTLEROOT_TOWN", + "x": 5, + "y": 9 + }, + { + "id": "HEAL_LOCATION_LITTLEROOT_TOWN_MAYS_HOUSE", + "map": "MAP_LITTLEROOT_TOWN", + "x": 14, + "y": 9 + }, + { + "id": "HEAL_LOCATION_OLDALE_TOWN", + "map": "MAP_OLDALE_TOWN", + "x": 6, + "y": 17 + }, + { + "id": "HEAL_LOCATION_DEWFORD_TOWN", + "map": "MAP_DEWFORD_TOWN", + "x": 2, + "y": 11 + }, + { + "id": "HEAL_LOCATION_LAVARIDGE_TOWN", + "map": "MAP_LAVARIDGE_TOWN", + "x": 9, + "y": 7 + }, + { + "id": "HEAL_LOCATION_FALLARBOR_TOWN", + "map": "MAP_FALLARBOR_TOWN", + "x": 14, + "y": 8 + }, + { + "id": "HEAL_LOCATION_VERDANTURF_TOWN", + "map": "MAP_VERDANTURF_TOWN", + "x": 16, + "y": 4 + }, + { + "id": "HEAL_LOCATION_PACIFIDLOG_TOWN", + "map": "MAP_PACIFIDLOG_TOWN", + "x": 8, + "y": 16 + }, + { + "id": "HEAL_LOCATION_EVER_GRANDE_CITY_POKEMON_LEAGUE", + "map": "MAP_EVER_GRANDE_CITY", + "x": 18, + "y": 6 + }, + { + "id": "HEAL_LOCATION_BATTLE_TOWER_OUTSIDE", + "map": "MAP_BATTLE_TOWER_OUTSIDE", + "x": 14, + "y": 9 + }, + { + "id": "HEAL_LOCATION_SOUTHERN_ISLAND_EXTERIOR", + "map": "MAP_SOUTHERN_ISLAND_EXTERIOR", + "x": 15, + "y": 20 + } + ] +} diff --git a/src/data/heal_locations.json.txt b/src/data/heal_locations.json.txt new file mode 100644 index 000000000..fd63228e3 --- /dev/null +++ b/src/data/heal_locations.json.txt @@ -0,0 +1,28 @@ +{{ doNotModifyHeader }} + +static const struct HealLocation sHealLocations[NUM_HEAL_LOCATIONS - 1] = { +## for heal_location in heal_locations + [{{ heal_location.id }} - 1] = { + .mapGroup = MAP_GROUP({{ heal_location.map }}), + .mapNum = MAP_NUM({{ heal_location.map }}), + .x = {{ heal_location.x }}, + .y = {{ heal_location.y }}, + }, +## endfor +}; + +static const u16 sWhiteoutRespawnHealCenterMapIdxs[][2] = { +## for heal_location in heal_locations +{% if existsIn(heal_location, "respawn_map") %} + [{{ heal_location.id }} - 1] = { MAP_GROUP({{ heal_location.respawn_map }}), MAP_NUM({{ heal_location.respawn_map }})}, +{% endif %} +## endfor +}; + +static const u8 sWhiteoutRespawnHealerNpcIds[] = { +## for heal_location in heal_locations +{% if existsIn(heal_location, "respawn_npc") %} + [{{ heal_location.id }} - 1] = {{ heal_location.respawn_npc }}, +{% endif %} +## endfor +}; diff --git a/src/data/region_map/.gitignore b/src/data/region_map/.gitignore index 4e0e7501c..84a80c7b1 100644 --- a/src/data/region_map/.gitignore +++ b/src/data/region_map/.gitignore @@ -1 +1,2 @@ region_map_entries.h +porymap_config.json diff --git a/src/data/region_map/region_map_sections.constants.json.txt b/src/data/region_map/region_map_sections.constants.json.txt new file mode 100644 index 000000000..c6f45c793 --- /dev/null +++ b/src/data/region_map/region_map_sections.constants.json.txt @@ -0,0 +1,18 @@ +{{ doNotModifyHeader }} +#ifndef GUARD_CONSTANTS_REGION_MAP_SECTIONS_H +#define GUARD_CONSTANTS_REGION_MAP_SECTIONS_H + +enum { +## for map_section in map_sections + {{ map_section.id }}, +## endfor + MAPSEC_NONE, + MAPSEC_COUNT +}; + +// Special location IDs that use the same value space as MAPSECs. +#define METLOC_SPECIAL_EGG 0xFD +#define METLOC_IN_GAME_TRADE 0xFE +#define METLOC_FATEFUL_ENCOUNTER 0xFF + +#endif // GUARD_CONSTANTS_REGION_MAP_SECTIONS_H diff --git a/src/data/region_map/region_map_sections.json b/src/data/region_map/region_map_sections.json index 24e17cfd2..70461e7d4 100644 --- a/src/data/region_map/region_map_sections.json +++ b/src/data/region_map/region_map_sections.json @@ -1,7 +1,7 @@ { "map_sections": [ { - "map_section": "MAPSEC_LITTLEROOT_TOWN", + "id": "MAPSEC_LITTLEROOT_TOWN", "name": "LITTLEROOT{NAME_END} TOWN", "x": 4, "y": 11, @@ -9,7 +9,7 @@ "height": 1 }, { - "map_section": "MAPSEC_OLDALE_TOWN", + "id": "MAPSEC_OLDALE_TOWN", "name": "OLDALE{NAME_END} TOWN", "x": 4, "y": 9, @@ -17,7 +17,7 @@ "height": 1 }, { - "map_section": "MAPSEC_DEWFORD_TOWN", + "id": "MAPSEC_DEWFORD_TOWN", "name": "DEWFORD{NAME_END} TOWN", "x": 2, "y": 14, @@ -25,7 +25,7 @@ "height": 1 }, { - "map_section": "MAPSEC_LAVARIDGE_TOWN", + "id": "MAPSEC_LAVARIDGE_TOWN", "name": "LAVARIDGE{NAME_END} TOWN", "x": 5, "y": 3, @@ -33,7 +33,7 @@ "height": 1 }, { - "map_section": "MAPSEC_FALLARBOR_TOWN", + "id": "MAPSEC_FALLARBOR_TOWN", "name": "FALLARBOR{NAME_END} TOWN", "x": 3, "y": 0, @@ -41,7 +41,7 @@ "height": 1 }, { - "map_section": "MAPSEC_VERDANTURF_TOWN", + "id": "MAPSEC_VERDANTURF_TOWN", "name": "VERDANTURF{NAME_END} TOWN", "x": 4, "y": 6, @@ -49,7 +49,7 @@ "height": 1 }, { - "map_section": "MAPSEC_PACIFIDLOG_TOWN", + "id": "MAPSEC_PACIFIDLOG_TOWN", "name": "PACIFIDLOG{NAME_END} TOWN", "x": 17, "y": 10, @@ -57,7 +57,7 @@ "height": 1 }, { - "map_section": "MAPSEC_PETALBURG_CITY", + "id": "MAPSEC_PETALBURG_CITY", "name": "PETALBURG{NAME_END} CITY", "x": 1, "y": 9, @@ -65,7 +65,7 @@ "height": 1 }, { - "map_section": "MAPSEC_SLATEPORT_CITY", + "id": "MAPSEC_SLATEPORT_CITY", "name": "SLATEPORT{NAME_END} CITY", "x": 8, "y": 10, @@ -73,7 +73,7 @@ "height": 2 }, { - "map_section": "MAPSEC_MAUVILLE_CITY", + "id": "MAPSEC_MAUVILLE_CITY", "name": "MAUVILLE{NAME_END} CITY", "x": 8, "y": 6, @@ -81,7 +81,7 @@ "height": 1 }, { - "map_section": "MAPSEC_RUSTBORO_CITY", + "id": "MAPSEC_RUSTBORO_CITY", "name": "RUSTBORO{NAME_END} CITY", "x": 0, "y": 5, @@ -89,7 +89,7 @@ "height": 2 }, { - "map_section": "MAPSEC_FORTREE_CITY", + "id": "MAPSEC_FORTREE_CITY", "name": "FORTREE{NAME_END} CITY", "x": 12, "y": 0, @@ -97,7 +97,7 @@ "height": 1 }, { - "map_section": "MAPSEC_LILYCOVE_CITY", + "id": "MAPSEC_LILYCOVE_CITY", "name": "LILYCOVE{NAME_END} CITY", "x": 18, "y": 3, @@ -105,7 +105,7 @@ "height": 1 }, { - "map_section": "MAPSEC_MOSSDEEP_CITY", + "id": "MAPSEC_MOSSDEEP_CITY", "name": "MOSSDEEP{NAME_END} CITY", "x": 24, "y": 5, @@ -113,7 +113,7 @@ "height": 1 }, { - "map_section": "MAPSEC_SOOTOPOLIS_CITY", + "id": "MAPSEC_SOOTOPOLIS_CITY", "name": "SOOTOPOLIS{NAME_END} CITY", "x": 21, "y": 7, @@ -121,7 +121,7 @@ "height": 1 }, { - "map_section": "MAPSEC_EVER_GRANDE_CITY", + "id": "MAPSEC_EVER_GRANDE_CITY", "name": "EVER GRANDE{NAME_END} CITY", "x": 27, "y": 8, @@ -129,7 +129,7 @@ "height": 2 }, { - "map_section": "MAPSEC_ROUTE_101", + "id": "MAPSEC_ROUTE_101", "name": "ROUTE 101", "x": 4, "y": 10, @@ -137,7 +137,7 @@ "height": 1 }, { - "map_section": "MAPSEC_ROUTE_102", + "id": "MAPSEC_ROUTE_102", "name": "ROUTE 102", "x": 2, "y": 9, @@ -145,7 +145,7 @@ "height": 1 }, { - "map_section": "MAPSEC_ROUTE_103", + "id": "MAPSEC_ROUTE_103", "name": "ROUTE 103", "x": 4, "y": 8, @@ -153,7 +153,7 @@ "height": 1 }, { - "map_section": "MAPSEC_ROUTE_104", + "id": "MAPSEC_ROUTE_104", "name": "ROUTE 104", "x": 0, "y": 7, @@ -161,7 +161,7 @@ "height": 3 }, { - "map_section": "MAPSEC_ROUTE_105", + "id": "MAPSEC_ROUTE_105", "name": "ROUTE 105", "x": 0, "y": 10, @@ -169,7 +169,7 @@ "height": 3 }, { - "map_section": "MAPSEC_ROUTE_106", + "id": "MAPSEC_ROUTE_106", "name": "ROUTE 106", "x": 0, "y": 13, @@ -177,7 +177,7 @@ "height": 1 }, { - "map_section": "MAPSEC_ROUTE_107", + "id": "MAPSEC_ROUTE_107", "name": "ROUTE 107", "x": 3, "y": 14, @@ -185,7 +185,7 @@ "height": 1 }, { - "map_section": "MAPSEC_ROUTE_108", + "id": "MAPSEC_ROUTE_108", "name": "ROUTE 108", "x": 6, "y": 14, @@ -193,7 +193,7 @@ "height": 1 }, { - "map_section": "MAPSEC_ROUTE_109", + "id": "MAPSEC_ROUTE_109", "name": "ROUTE 109", "x": 8, "y": 12, @@ -201,7 +201,7 @@ "height": 3 }, { - "map_section": "MAPSEC_ROUTE_110", + "id": "MAPSEC_ROUTE_110", "name": "ROUTE 110", "x": 8, "y": 7, @@ -209,7 +209,7 @@ "height": 3 }, { - "map_section": "MAPSEC_ROUTE_111", + "id": "MAPSEC_ROUTE_111", "name": "ROUTE 111", "x": 8, "y": 0, @@ -217,7 +217,7 @@ "height": 6 }, { - "map_section": "MAPSEC_ROUTE_112", + "id": "MAPSEC_ROUTE_112", "name": "ROUTE 112", "x": 6, "y": 3, @@ -225,7 +225,7 @@ "height": 1 }, { - "map_section": "MAPSEC_ROUTE_113", + "id": "MAPSEC_ROUTE_113", "name": "ROUTE 113", "x": 4, "y": 0, @@ -233,7 +233,7 @@ "height": 1 }, { - "map_section": "MAPSEC_ROUTE_114", + "id": "MAPSEC_ROUTE_114", "name": "ROUTE 114", "x": 1, "y": 0, @@ -241,7 +241,7 @@ "height": 3 }, { - "map_section": "MAPSEC_ROUTE_115", + "id": "MAPSEC_ROUTE_115", "name": "ROUTE 115", "x": 0, "y": 2, @@ -249,7 +249,7 @@ "height": 3 }, { - "map_section": "MAPSEC_ROUTE_116", + "id": "MAPSEC_ROUTE_116", "name": "ROUTE 116", "x": 1, "y": 5, @@ -257,7 +257,7 @@ "height": 1 }, { - "map_section": "MAPSEC_ROUTE_117", + "id": "MAPSEC_ROUTE_117", "name": "ROUTE 117", "x": 5, "y": 6, @@ -265,7 +265,7 @@ "height": 1 }, { - "map_section": "MAPSEC_ROUTE_118", + "id": "MAPSEC_ROUTE_118", "name": "ROUTE 118", "x": 10, "y": 6, @@ -273,7 +273,7 @@ "height": 1 }, { - "map_section": "MAPSEC_ROUTE_119", + "id": "MAPSEC_ROUTE_119", "name": "ROUTE 119", "x": 11, "y": 0, @@ -281,7 +281,7 @@ "height": 6 }, { - "map_section": "MAPSEC_ROUTE_120", + "id": "MAPSEC_ROUTE_120", "name": "ROUTE 120", "x": 13, "y": 0, @@ -289,7 +289,7 @@ "height": 4 }, { - "map_section": "MAPSEC_ROUTE_121", + "id": "MAPSEC_ROUTE_121", "name": "ROUTE 121", "x": 14, "y": 3, @@ -297,7 +297,7 @@ "height": 1 }, { - "map_section": "MAPSEC_ROUTE_122", + "id": "MAPSEC_ROUTE_122", "name": "ROUTE 122", "x": 16, "y": 4, @@ -305,7 +305,7 @@ "height": 2 }, { - "map_section": "MAPSEC_ROUTE_123", + "id": "MAPSEC_ROUTE_123", "name": "ROUTE 123", "x": 12, "y": 6, @@ -313,7 +313,7 @@ "height": 1 }, { - "map_section": "MAPSEC_ROUTE_124", + "id": "MAPSEC_ROUTE_124", "name": "ROUTE 124", "x": 20, "y": 3, @@ -321,7 +321,7 @@ "height": 3 }, { - "map_section": "MAPSEC_ROUTE_125", + "id": "MAPSEC_ROUTE_125", "name": "ROUTE 125", "x": 24, "y": 3, @@ -329,7 +329,7 @@ "height": 2 }, { - "map_section": "MAPSEC_ROUTE_126", + "id": "MAPSEC_ROUTE_126", "name": "ROUTE 126", "x": 20, "y": 6, @@ -337,7 +337,7 @@ "height": 3 }, { - "map_section": "MAPSEC_ROUTE_127", + "id": "MAPSEC_ROUTE_127", "name": "ROUTE 127", "x": 23, "y": 6, @@ -345,7 +345,7 @@ "height": 3 }, { - "map_section": "MAPSEC_ROUTE_128", + "id": "MAPSEC_ROUTE_128", "name": "ROUTE 128", "x": 23, "y": 9, @@ -353,7 +353,7 @@ "height": 1 }, { - "map_section": "MAPSEC_ROUTE_129", + "id": "MAPSEC_ROUTE_129", "name": "ROUTE 129", "x": 24, "y": 10, @@ -361,7 +361,7 @@ "height": 1 }, { - "map_section": "MAPSEC_ROUTE_130", + "id": "MAPSEC_ROUTE_130", "name": "ROUTE 130", "x": 21, "y": 10, @@ -369,7 +369,7 @@ "height": 1 }, { - "map_section": "MAPSEC_ROUTE_131", + "id": "MAPSEC_ROUTE_131", "name": "ROUTE 131", "x": 18, "y": 10, @@ -377,7 +377,7 @@ "height": 1 }, { - "map_section": "MAPSEC_ROUTE_132", + "id": "MAPSEC_ROUTE_132", "name": "ROUTE 132", "x": 15, "y": 10, @@ -385,7 +385,7 @@ "height": 1 }, { - "map_section": "MAPSEC_ROUTE_133", + "id": "MAPSEC_ROUTE_133", "name": "ROUTE 133", "x": 12, "y": 10, @@ -393,7 +393,7 @@ "height": 1 }, { - "map_section": "MAPSEC_ROUTE_134", + "id": "MAPSEC_ROUTE_134", "name": "ROUTE 134", "x": 9, "y": 10, @@ -401,7 +401,7 @@ "height": 1 }, { - "map_section": "MAPSEC_UNDERWATER_124", + "id": "MAPSEC_UNDERWATER_124", "name": "UNDERWATER", "x": 20, "y": 3, @@ -409,7 +409,7 @@ "height": 3 }, { - "map_section": "MAPSEC_UNDERWATER_125", + "id": "MAPSEC_UNDERWATER_125", "name": "UNDERWATER", "x": 20, "y": 6, @@ -417,7 +417,7 @@ "height": 3 }, { - "map_section": "MAPSEC_UNDERWATER_126", + "id": "MAPSEC_UNDERWATER_126", "name": "UNDERWATER", "x": 23, "y": 6, @@ -425,7 +425,7 @@ "height": 3 }, { - "map_section": "MAPSEC_UNDERWATER_127", + "id": "MAPSEC_UNDERWATER_127", "name": "UNDERWATER", "x": 23, "y": 9, @@ -433,7 +433,7 @@ "height": 1 }, { - "map_section": "MAPSEC_UNDERWATER_SOOTOPOLIS", + "id": "MAPSEC_UNDERWATER_SOOTOPOLIS", "name": "UNDERWATER", "x": 21, "y": 7, @@ -441,7 +441,7 @@ "height": 1 }, { - "map_section": "MAPSEC_GRANITE_CAVE", + "id": "MAPSEC_GRANITE_CAVE", "name": "GRANITE CAVE", "x": 1, "y": 13, @@ -449,7 +449,7 @@ "height": 1 }, { - "map_section": "MAPSEC_MT_CHIMNEY", + "id": "MAPSEC_MT_CHIMNEY", "name": "MT. CHIMNEY", "x": 6, "y": 2, @@ -457,7 +457,7 @@ "height": 1 }, { - "map_section": "MAPSEC_SAFARI_ZONE", + "id": "MAPSEC_SAFARI_ZONE", "name": "SAFARI ZONE", "x": 16, "y": 2, @@ -465,7 +465,7 @@ "height": 1 }, { - "map_section": "MAPSEC_BATTLE_TOWER", + "id": "MAPSEC_BATTLE_TOWER", "name": "BATTLE TOWER", "x": 22, "y": 12, @@ -473,7 +473,7 @@ "height": 1 }, { - "map_section": "MAPSEC_PETALBURG_WOODS", + "id": "MAPSEC_PETALBURG_WOODS", "name": "PETALBURG WOODS", "x": 0, "y": 8, @@ -481,7 +481,7 @@ "height": 1 }, { - "map_section": "MAPSEC_RUSTURF_TUNNEL", + "id": "MAPSEC_RUSTURF_TUNNEL", "name": "RUSTURF TUNNEL", "x": 2, "y": 5, @@ -489,7 +489,7 @@ "height": 1 }, { - "map_section": "MAPSEC_ABANDONED_SHIP", + "id": "MAPSEC_ABANDONED_SHIP", "name": "ABANDONED SHIP", "x": 6, "y": 14, @@ -497,7 +497,7 @@ "height": 1 }, { - "map_section": "MAPSEC_NEW_MAUVILLE", + "id": "MAPSEC_NEW_MAUVILLE", "name": "NEW MAUVILLE", "x": 8, "y": 7, @@ -505,7 +505,7 @@ "height": 1 }, { - "map_section": "MAPSEC_METEOR_FALLS", + "id": "MAPSEC_METEOR_FALLS", "name": "METEOR FALLS", "x": 0, "y": 3, @@ -513,7 +513,7 @@ "height": 1 }, { - "map_section": "MAPSEC_METEOR_FALLS_2", + "id": "MAPSEC_METEOR_FALLS_2", "name": "METEOR FALLS", "x": 1, "y": 2, @@ -521,7 +521,7 @@ "height": 1 }, { - "map_section": "MAPSEC_MT_PYRE", + "id": "MAPSEC_MT_PYRE", "name": "MT. PYRE", "x": 16, "y": 4, @@ -529,7 +529,7 @@ "height": 1 }, { - "map_section": "MAPSEC_EVIL_TEAM_HIDEOUT", + "id": "MAPSEC_EVIL_TEAM_HIDEOUT", "name": "{EVIL_TEAM} HIDEOUT", "x": 19, "y": 3, @@ -537,7 +537,7 @@ "height": 1 }, { - "map_section": "MAPSEC_SHOAL_CAVE", + "id": "MAPSEC_SHOAL_CAVE", "name": "SHOAL CAVE", "x": 24, "y": 4, @@ -545,7 +545,7 @@ "height": 1 }, { - "map_section": "MAPSEC_SEAFLOOR_CAVERN", + "id": "MAPSEC_SEAFLOOR_CAVERN", "name": "SEAFLOOR CAVERN", "x": 24, "y": 9, @@ -553,7 +553,7 @@ "height": 1 }, { - "map_section": "MAPSEC_UNDERWATER_128", + "id": "MAPSEC_UNDERWATER_128", "name": "UNDERWATER", "x": 24, "y": 9, @@ -561,7 +561,7 @@ "height": 1 }, { - "map_section": "MAPSEC_VICTORY_ROAD", + "id": "MAPSEC_VICTORY_ROAD", "name": "VICTORY ROAD", "x": 27, "y": 9, @@ -569,7 +569,7 @@ "height": 1 }, { - "map_section": "MAPSEC_MIRAGE_ISLAND", + "id": "MAPSEC_MIRAGE_ISLAND", "name": "MIRAGE ISLAND", "x": 17, "y": 10, @@ -577,7 +577,7 @@ "height": 1 }, { - "map_section": "MAPSEC_CAVE_OF_ORIGIN", + "id": "MAPSEC_CAVE_OF_ORIGIN", "name": "CAVE OF ORIGIN", "x": 21, "y": 7, @@ -585,7 +585,7 @@ "height": 1 }, { - "map_section": "MAPSEC_SOUTHERN_ISLAND", + "id": "MAPSEC_SOUTHERN_ISLAND", "name": "SOUTHERN ISLAND", "x": 12, "y": 14, @@ -593,7 +593,7 @@ "height": 1 }, { - "map_section": "MAPSEC_FIERY_PATH", + "id": "MAPSEC_FIERY_PATH", "name": "FIERY PATH", "x": 6, "y": 3, @@ -601,7 +601,7 @@ "height": 1 }, { - "map_section": "MAPSEC_FIERY_PATH_2", + "id": "MAPSEC_FIERY_PATH_2", "name": "FIERY PATH", "x": 7, "y": 3, @@ -609,7 +609,7 @@ "height": 1 }, { - "map_section": "MAPSEC_JAGGED_PASS", + "id": "MAPSEC_JAGGED_PASS", "name": "JAGGED PASS", "x": 6, "y": 3, @@ -617,7 +617,7 @@ "height": 1 }, { - "map_section": "MAPSEC_JAGGED_PASS_2", + "id": "MAPSEC_JAGGED_PASS_2", "name": "JAGGED PASS", "x": 7, "y": 2, @@ -625,7 +625,7 @@ "height": 1 }, { - "map_section": "MAPSEC_SEALED_CHAMBER", + "id": "MAPSEC_SEALED_CHAMBER", "name": "SEALED CHAMBER", "x": 11, "y": 10, @@ -633,7 +633,7 @@ "height": 1 }, { - "map_section": "MAPSEC_UNDERWATER_SEALED_CHAMBER", + "id": "MAPSEC_UNDERWATER_SEALED_CHAMBER", "name": "UNDERWATER", "x": 11, "y": 10, @@ -641,7 +641,7 @@ "height": 1 }, { - "map_section": "MAPSEC_SCORCHED_SLAB", + "id": "MAPSEC_SCORCHED_SLAB", "name": "SCORCHED SLAB", "x": 13, "y": 0, @@ -649,7 +649,7 @@ "height": 1 }, { - "map_section": "MAPSEC_ISLAND_CAVE", + "id": "MAPSEC_ISLAND_CAVE", "name": "ISLAND CAVE", "x": 0, "y": 10, @@ -657,7 +657,7 @@ "height": 1 }, { - "map_section": "MAPSEC_DESERT_RUINS", + "id": "MAPSEC_DESERT_RUINS", "name": "DESERT RUINS", "x": 8, "y": 3, @@ -665,7 +665,7 @@ "height": 1 }, { - "map_section": "MAPSEC_ANCIENT_TOMB", + "id": "MAPSEC_ANCIENT_TOMB", "name": "ANCIENT TOMB", "x": 13, "y": 2, @@ -673,7 +673,7 @@ "height": 1 }, { - "map_section": "MAPSEC_INSIDE_OF_TRUCK", + "id": "MAPSEC_INSIDE_OF_TRUCK", "name": "INSIDE OF TRUCK", "x": 0, "y": 0, @@ -681,7 +681,7 @@ "height": 1 }, { - "map_section": "MAPSEC_SKY_PILLAR", + "id": "MAPSEC_SKY_PILLAR", "name": "SKY PILLAR", "x": 19, "y": 10, @@ -689,7 +689,7 @@ "height": 1 }, { - "map_section": "MAPSEC_SECRET_BASE", + "id": "MAPSEC_SECRET_BASE", "name": "SECRET BASE", "x": 0, "y": 0, @@ -697,7 +697,7 @@ "height": 1 }, { - "map_section": "MAPSEC_DYNAMIC", + "id": "MAPSEC_DYNAMIC", "name": "", "x": 0, "y": 0, diff --git a/src/data/region_map/region_map_sections.json.txt b/src/data/region_map/region_map_sections.json.txt index e9c372cb5..b73f992d6 100644 --- a/src/data/region_map/region_map_sections.json.txt +++ b/src/data/region_map/region_map_sections.json.txt @@ -3,21 +3,25 @@ #define GUARD_DATA_REGION_MAP_REGION_MAP_ENTRIES_H ## for map_section in map_sections -{% if isEmptyString(getVar(map_section.name)) and not existsIn(map_section, "name_clone") %}{{ setVar(map_section.name, map_section.map_section) }}{% endif %} +{% if existsIn(map_section, "name") and isEmptyString(getVar(map_section.name)) and not existsIn(map_section, "name_clone") %}{{ setVar(map_section.name, map_section.id) }}{% endif %} ## endfor ## for map_section in map_sections -{% if getVar(map_section.name) == map_section.map_section %} +{% if existsIn(map_section, "name") %} +{% if getVar(map_section.name) == map_section.id %} static const u8 sMapName_{{ cleanString(map_section.name) }}[] = _("{{ map_section.name }}"); {% endif %} {% if existsIn(map_section, "name_clone") %} static const u8 sMapName_{{ cleanString(map_section.name) }}_Clone[] = _("{{ map_section.name }}"); {% endif %} +{% endif %} ## endfor const struct RegionMapLocation gRegionMapEntries[] = { ## for map_section in map_sections - [{{ map_section.map_section }}] = { {{ map_section.x }}, {{ map_section.y }}, {{ map_section.width }}, {{ map_section.height }}, sMapName_{{ cleanString(map_section.name) }}{% if existsIn(map_section, "name_clone") %}_Clone{% endif %} }, +{% if existsIn(map_section, "x") and existsIn(map_section, "y") and existsIn(map_section, "width") and existsIn(map_section, "height") and existsIn(map_section, "name") %} + [{{ map_section.id }}] = { {{ map_section.x }}, {{ map_section.y }}, {{ map_section.width }}, {{ map_section.height }}, sMapName_{{ cleanString(map_section.name) }}{% if existsIn(map_section, "name_clone") %}_Clone{% endif %} }, +{% endif %} ## endfor }; diff --git a/src/data/wild_encounters.json.txt b/src/data/wild_encounters.json.txt index 103a6e7b1..26d8fa0f3 100644 --- a/src/data/wild_encounters.json.txt +++ b/src/data/wild_encounters.json.txt @@ -83,8 +83,8 @@ const struct WildPokemonHeader {{ wild_encounter_group.label }}[] = #ifdef RUBY {% endif %} { - .mapGroup = {% if wild_encounter_group.for_maps %}MAP_GROUP({{ removePrefix(encounter.map, "MAP_") }}){% else %}0{% endif %}, - .mapNum = {% if wild_encounter_group.for_maps %}MAP_NUM({{ removePrefix(encounter.map, "MAP_") }}){% else %}{{ loop.index1 }}{% endif %}, + .mapGroup = {% if wild_encounter_group.for_maps %}MAP_GROUP({{ encounter.map }}){% else %}0{% endif %}, + .mapNum = {% if wild_encounter_group.for_maps %}MAP_NUM({{ encounter.map }}){% else %}{{ loop.index1 }}{% endif %}, .landMonsInfo = {% if existsIn(encounter, "land_mons") %}&{{ encounter.base_label }}_LandMonsInfo{% else %}NULL{% endif %}, .waterMonsInfo = {% if existsIn(encounter, "water_mons") %}&{{ encounter.base_label }}_WaterMonsInfo{% else %}NULL{% endif %}, .rockSmashMonsInfo = {% if existsIn(encounter, "rock_smash_mons") %}&{{ encounter.base_label }}_RockSmashMonsInfo{% else %}NULL{% endif %}, @@ -95,8 +95,8 @@ const struct WildPokemonHeader {{ wild_encounter_group.label }}[] = {% endif %} ## endfor { - .mapGroup = MAP_GROUP(UNDEFINED), - .mapNum = MAP_NUM(UNDEFINED), + .mapGroup = MAP_GROUP(MAP_UNDEFINED), + .mapNum = MAP_NUM(MAP_UNDEFINED), .landMonsInfo = NULL, .waterMonsInfo = NULL, .rockSmashMonsInfo = NULL, diff --git a/src/daycare.c b/src/daycare.c index 616b1dd22..02eb5cd82 100644 --- a/src/daycare.c +++ b/src/daycare.c @@ -1019,7 +1019,7 @@ static void GetDaycareLevelMenuLevelText(struct DayCare *daycare, u8 *dest) static void HandleDaycareLevelMenuInput(u8 taskId) { - if (gMain.newKeys & DPAD_UP) + if (JOY_NEW(DPAD_UP)) { if (gTasks[taskId].data[0] != 0) { @@ -1028,7 +1028,7 @@ static void HandleDaycareLevelMenuInput(u8 taskId) PlaySE(SE_SELECT); } } - else if (gMain.newKeys & DPAD_DOWN) + else if (JOY_NEW(DPAD_DOWN)) { if (gTasks[taskId].data[0] != 2) { @@ -1037,7 +1037,7 @@ static void HandleDaycareLevelMenuInput(u8 taskId) PlaySE(SE_SELECT); } } - else if (gMain.newKeys & A_BUTTON) + else if (JOY_NEW(A_BUTTON)) { Menu_DestroyCursor(); PlaySE(SE_SELECT); @@ -1046,7 +1046,7 @@ static void HandleDaycareLevelMenuInput(u8 taskId) Menu_EraseWindowRect(15, 6, 29, 13); EnableBothScriptContexts(); } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { Menu_DestroyCursor(); gLastFieldPokeMenuOpened = gSpecialVar_Result = 2; diff --git a/src/debug/matsuda_debug_menu.c b/src/debug/matsuda_debug_menu.c index 086b20abd..0fd0d8a36 100644 --- a/src/debug/matsuda_debug_menu.c +++ b/src/debug/matsuda_debug_menu.c @@ -201,7 +201,7 @@ static void sub_80A9DD8(u8 taskId) static void sub_80A9E04(u8 taskId) { - if (gMain.newKeys == 2) + if (gMain.newKeys == B_BUTTON) gTasks[(u8)gTasks[taskId].data[10]].func = sub_80A9D30; } @@ -464,7 +464,7 @@ static void sub_80AA064(void) BuildOamBuffer(); RunTasks(); UpdatePaletteFade(); - if (gMain.newKeys == 4) + if (gMain.newKeys == SELECT_BUTTON) SetMainCallback2(c2_exit_to_overworld_1_sub_8080DEC); } diff --git a/src/debug/mori_debug_menu.c b/src/debug/mori_debug_menu.c index d5cae8352..86994e5b8 100644 --- a/src/debug/mori_debug_menu.c +++ b/src/debug/mori_debug_menu.c @@ -74,7 +74,7 @@ void unref_sub_8083CF0(void) bool8 sub_8083D4C(void) { - if ( gMain.newKeys & A_BUTTON ) + if (JOY_NEW(A_BUTTON)) { CloseMenu(); return TRUE; diff --git a/src/debug/nakamura_debug_menu.c b/src/debug/nakamura_debug_menu.c index e8f40f08e..c8f2bf49e 100644 --- a/src/debug/nakamura_debug_menu.c +++ b/src/debug/nakamura_debug_menu.c @@ -87,17 +87,17 @@ bool8 InitNakamuraDebugMenu(void) static bool8 TopMenu_HandleJoypad(void) { - if (gMain.newKeys & DPAD_UP) + if (JOY_NEW(DPAD_UP)) { Menu_MoveCursor(-1); } - if (gMain.newKeys & DPAD_DOWN) + if (JOY_NEW(DPAD_DOWN)) { Menu_MoveCursor(+1); } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { MenuFunc func = sNakamuraTopMenuActions[Menu_GetCursorPos()].func; #if !(ENGLISH && REVISION == 0) @@ -106,7 +106,7 @@ static bool8 TopMenu_HandleJoypad(void) return func(); } - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { CloseMenu(); return TRUE; @@ -342,7 +342,7 @@ static void BaseLocation_Redraw(void) static bool8 BaseLocation_HandleJoypad(void) { - if (gMain.newKeys & DPAD_LEFT) + if (JOY_NEW(DPAD_LEFT)) { if (sSecretBaseIdx == 0) sSecretBaseIdx = 19; @@ -352,7 +352,7 @@ static bool8 BaseLocation_HandleJoypad(void) return FALSE; } - if (gMain.newKeys & DPAD_RIGHT) + if (JOY_NEW(DPAD_RIGHT)) { if (sSecretBaseIdx == 19) sSecretBaseIdx = 0; @@ -362,7 +362,7 @@ static bool8 BaseLocation_HandleJoypad(void) return FALSE; } - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { CloseMenu(); return TRUE; @@ -514,7 +514,7 @@ static bool8 MoveYourBase_HandleJoypad_2(void) { u32 r4 = sMoveYourBase_CursorPos == 0 ? 7 : 10; - if (gMain.newAndRepeatedKeys & DPAD_UP) + if (JOY_REPT(DPAD_UP)) { if (sMoveYourBase_CursorPos) MoveYourBase_EditOwnerID(1); @@ -523,7 +523,7 @@ static bool8 MoveYourBase_HandleJoypad_2(void) return FALSE; } - if (gMain.newAndRepeatedKeys & DPAD_DOWN) + if (JOY_REPT(DPAD_DOWN)) { if (sMoveYourBase_CursorPos) MoveYourBase_EditOwnerID(-1); @@ -532,7 +532,7 @@ static bool8 MoveYourBase_HandleJoypad_2(void) return FALSE; } - if (gMain.newAndRepeatedKeys & DPAD_LEFT) + if (JOY_REPT(DPAD_LEFT)) { if (sMoveYourBase_XCursorPos == 0) sMoveYourBase_XCursorPos = r4 - 1; @@ -542,7 +542,7 @@ static bool8 MoveYourBase_HandleJoypad_2(void) return FALSE; } - if (gMain.newAndRepeatedKeys & DPAD_RIGHT) + if (JOY_REPT(DPAD_RIGHT)) { if (sMoveYourBase_XCursorPos == r4 - 1) sMoveYourBase_XCursorPos = 0; @@ -552,7 +552,7 @@ static bool8 MoveYourBase_HandleJoypad_2(void) return FALSE; } - if (gMain.newKeys & SELECT_BUTTON) + if (JOY_NEW(SELECT_BUTTON)) { if (sMoveYourBase_CursorPos == 0) sSecretBaseNameCharGroup = (sSecretBaseNameCharGroup + 1) % 5; @@ -560,7 +560,7 @@ static bool8 MoveYourBase_HandleJoypad_2(void) return FALSE; } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { Menu_BlankWindowRect(2, 5, 11, 6); Menu_BlankWindowRect(11, 1, 11, 2); @@ -568,7 +568,7 @@ static bool8 MoveYourBase_HandleJoypad_2(void) return FALSE; } - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { if (sMoveYourBase_CursorPos == 0) MoveYourBase_EditOwnerNameChar(100); @@ -580,19 +580,19 @@ static bool8 MoveYourBase_HandleJoypad_2(void) static bool8 MoveYourBase_JoypadAction(void) { - if (gMain.newKeys & DPAD_UP) + if (JOY_NEW(DPAD_UP)) { Menu_MoveCursor(-2); return FALSE; } - if (gMain.newKeys & DPAD_DOWN) + if (JOY_NEW(DPAD_DOWN)) { Menu_MoveCursor(+2); return FALSE; } - if (gMain.newKeys & DPAD_LEFT) + if (JOY_NEW(DPAD_LEFT)) { if (sSecretBaseIdx == 0) sSecretBaseIdx = 19; @@ -602,7 +602,7 @@ static bool8 MoveYourBase_JoypadAction(void) return FALSE; } - if (gMain.newKeys & DPAD_RIGHT) + if (JOY_NEW(DPAD_RIGHT)) { if (sSecretBaseIdx == 19) sSecretBaseIdx = 0; @@ -612,7 +612,7 @@ static bool8 MoveYourBase_JoypadAction(void) return FALSE; } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { if (sSecretBaseIdx != 0 && gSaveBlock1.secretBases[sSecretBaseIdx].secretBaseId != 0) { @@ -625,7 +625,7 @@ static bool8 MoveYourBase_JoypadAction(void) return FALSE; } - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { CloseMenu(); return TRUE; @@ -657,19 +657,19 @@ static const u8 Str_843E580[] = _( static bool8 MovingPKMN_HandleJoypad(void) { - if (gMain.newKeys & DPAD_UP) + if (JOY_NEW(DPAD_UP)) { Menu_MoveCursor(-1); return FALSE; } - if (gMain.newKeys & DPAD_DOWN) + if (JOY_NEW(DPAD_DOWN)) { Menu_MoveCursor(+1); return FALSE; } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { CloseMenu(); switch (Menu_GetCursorPos()) @@ -685,7 +685,7 @@ static bool8 MovingPKMN_HandleJoypad(void) return TRUE; } - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { CloseMenu(); return TRUE; @@ -814,7 +814,7 @@ static u16 FishingPoints_GetIndexOfCurrentFishingSpot(void) static bool8 FishingPoints_HandleJoypad(void) { - if (gMain.newKeys & A_BUTTON || gMain.newKeys & B_BUTTON) + if (JOY_NEW(A_BUTTON) || JOY_NEW(B_BUTTON)) { Menu_EraseWindowRect(0, 0, 29, 19); CloseMenu(); @@ -1072,31 +1072,31 @@ static void NakaGenderTest_JoypadAction(u8 i) static bool8 NakaGenderTest_HandleJoypad(void) { - if (gMain.newKeys & DPAD_UP) + if (JOY_NEW(DPAD_UP)) { NakaGenderTest_JoypadAction(0); return FALSE; } - if (gMain.newKeys & DPAD_DOWN) + if (JOY_NEW(DPAD_DOWN)) { NakaGenderTest_JoypadAction(1); return FALSE; } - if (gMain.newKeys & DPAD_LEFT) + if (JOY_NEW(DPAD_LEFT)) { NakaGenderTest_JoypadAction(2); return FALSE; } - if (gMain.newKeys & DPAD_RIGHT) + if (JOY_NEW(DPAD_RIGHT)) { NakaGenderTest_JoypadAction(3); return FALSE; } - if (gMain.newAndRepeatedKeys & A_BUTTON) + if (JOY_REPT(A_BUTTON)) { if (sNakaGenderTest_CursorPosition < 6) NakaGenderTest_AdjustSpecies(sNakaGenderTest_CursorPosition, +1); @@ -1108,7 +1108,7 @@ static bool8 NakaGenderTest_HandleJoypad(void) return FALSE; } - if (gMain.newAndRepeatedKeys & B_BUTTON) + if (JOY_REPT(B_BUTTON)) { if (sNakaGenderTest_CursorPosition < 6) NakaGenderTest_AdjustSpecies(sNakaGenderTest_CursorPosition, -1); @@ -1120,7 +1120,7 @@ static bool8 NakaGenderTest_HandleJoypad(void) return FALSE; } - if (gMain.newAndRepeatedKeys & R_BUTTON) + if (JOY_REPT(R_BUTTON)) { if (sNakaGenderTest_CursorPosition < 6) NakaGenderTest_AdjustSpecies(sNakaGenderTest_CursorPosition, +10); @@ -1132,7 +1132,7 @@ static bool8 NakaGenderTest_HandleJoypad(void) return FALSE; } - if (gMain.newAndRepeatedKeys & L_BUTTON) + if (JOY_REPT(L_BUTTON)) { if (sNakaGenderTest_CursorPosition < 6) NakaGenderTest_AdjustSpecies(sNakaGenderTest_CursorPosition, -10); @@ -1144,7 +1144,7 @@ static bool8 NakaGenderTest_HandleJoypad(void) return FALSE; } - if (gMain.newKeys & START_BUTTON) + if (JOY_NEW(START_BUTTON)) { NakaGenderTest_PartyCompactionEnsureAtLeastOne(); CloseMenu(); @@ -1879,19 +1879,19 @@ static void SetPokeblock_GivePokeblock(void) static bool8 SetPokeblock_HandleJoypad(void) { - if (gMain.newAndRepeatedKeys & DPAD_UP) + if (JOY_REPT(DPAD_UP)) { Menu_MoveCursor(-1); return FALSE; } - if (gMain.newAndRepeatedKeys & DPAD_DOWN) + if (JOY_REPT(DPAD_DOWN)) { Menu_MoveCursor(+1); return FALSE; } - if (gMain.newAndRepeatedKeys & DPAD_LEFT) + if (JOY_REPT(DPAD_LEFT)) { SetPokeblock_AdjustFlavor(Menu_GetCursorPos(), -1); SetPokeblock_PrintFlavorValue(Menu_GetCursorPos()); @@ -1899,7 +1899,7 @@ static bool8 SetPokeblock_HandleJoypad(void) return FALSE; } - if (gMain.newAndRepeatedKeys & DPAD_RIGHT) + if (JOY_REPT(DPAD_RIGHT)) { SetPokeblock_AdjustFlavor(Menu_GetCursorPos(), +1); SetPokeblock_PrintFlavorValue(Menu_GetCursorPos()); @@ -1907,14 +1907,14 @@ static bool8 SetPokeblock_HandleJoypad(void) return FALSE; } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { SetPokeblock_GivePokeblock(); PlaySE(SE_SELECT); return FALSE; } - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { Menu_EraseWindowRect(0, 0, 29, 19); CloseMenu(); @@ -2050,21 +2050,21 @@ static void EVTest_MovePartyCursor(s8 a0) static bool8 EVTest_HandleJoypad(void) { - if (gMain.newKeys & DPAD_LEFT) + if (JOY_NEW(DPAD_LEFT)) { EVTest_MovePartyCursor(-1); EVTest_PrintMonData(gPlayerParty + sEVTest_CursorPosition); return FALSE; } - if (gMain.newKeys & DPAD_RIGHT) + if (JOY_NEW(DPAD_RIGHT)) { EVTest_MovePartyCursor(+1); EVTest_PrintMonData(gPlayerParty + sEVTest_CursorPosition); return FALSE; } - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { Menu_EraseWindowRect(0, 0, 29, 19); CloseMenu(); @@ -2161,22 +2161,22 @@ static void RNGTest_AdjustAndPrintNumAtLine(u16 * a0, s8 a1, u8 a2) static bool8 RNGTest_HandleJoypad(void) { - s8 r5 = gMain.heldKeys & R_BUTTON ? 100 : 1; + s8 r5 = JOY_HELD(R_BUTTON) ? 100 : 1; s8 r4; - if (gMain.newAndRepeatedKeys & DPAD_UP) + if (JOY_REPT(DPAD_UP)) { Menu_MoveCursor(-1); return FALSE; } - if (gMain.newAndRepeatedKeys & DPAD_DOWN) + if (JOY_REPT(DPAD_DOWN)) { Menu_MoveCursor(+1); return FALSE; } - if (gMain.newAndRepeatedKeys & DPAD_LEFT) + if (JOY_REPT(DPAD_LEFT)) { r4 = Menu_GetCursorPos(); if (r4 == 0) @@ -2190,7 +2190,7 @@ static bool8 RNGTest_HandleJoypad(void) return FALSE; } - if (gMain.newAndRepeatedKeys & DPAD_RIGHT) + if (JOY_REPT(DPAD_RIGHT)) { r4 = Menu_GetCursorPos(); if (r4 == 0) @@ -2204,7 +2204,7 @@ static bool8 RNGTest_HandleJoypad(void) return FALSE; } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { if (sRngMax != 0) { @@ -2214,7 +2214,7 @@ static bool8 RNGTest_HandleJoypad(void) return FALSE; } - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { Menu_EraseWindowRect(0, 0, 29, 19); CloseMenu(); diff --git a/src/debug/nohara_debug_menu.c b/src/debug/nohara_debug_menu.c index 80527ad42..63a031a32 100644 --- a/src/debug/nohara_debug_menu.c +++ b/src/debug/nohara_debug_menu.c @@ -306,7 +306,7 @@ bool8 debug_sub_808F5D8(void) bool8 debug_sub_808F648(void) { - if (gMain.newKeys & DPAD_LEFT) + if (JOY_NEW(DPAD_LEFT)) { Menu_EraseWindowRect(10, 0, 29, 13); gDebug_03000726 ^= 1; @@ -415,7 +415,7 @@ void debug_sub_808F8CC(void) bool8 debug_sub_808F93C(void) { bool8 updateDisplay = FALSE; - if (gMain.newKeys & DPAD_UP) + if (JOY_NEW(DPAD_UP)) { gDebug_03000725++; if (gDebug_03000725 == 24) @@ -423,7 +423,7 @@ bool8 debug_sub_808F93C(void) PlaySE(SE_SELECT); updateDisplay = TRUE; } - if (gMain.newKeys & DPAD_DOWN) + if (JOY_NEW(DPAD_DOWN)) { if (gDebug_03000725 == 0) gDebug_03000725 = 24; @@ -431,7 +431,7 @@ bool8 debug_sub_808F93C(void) PlaySE(SE_SELECT); updateDisplay = TRUE; } - if (gMain.newKeys & DPAD_RIGHT) + if (JOY_NEW(DPAD_RIGHT)) { gDebug_03000724++; if (gDebug_03000724 == 12) @@ -439,7 +439,7 @@ bool8 debug_sub_808F93C(void) PlaySE(SE_SELECT); updateDisplay = TRUE; } - if (gMain.newKeys & DPAD_LEFT) + if (JOY_NEW(DPAD_LEFT)) { if (gDebug_03000724 == 0) gDebug_03000724 = 12; @@ -455,12 +455,12 @@ bool8 debug_sub_808F93C(void) ConvertIntToDecimalStringN(gStringVar1, gDebug_03000725, STR_CONV_MODE_LEFT_ALIGN, 2); Menu_PrintText(gStringVar1, 23, 1); } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { PlaySE(SE_PIN); debug_sub_808FA88(gDebug_03000725, gUnknown_Debug_083C4ABD[gDebug_03000724]); } - if (gMain.newKeys & (B_BUTTON | START_BUTTON)) + if (JOY_NEW(B_BUTTON | START_BUTTON)) { sub_80BF588(gSaveBlock1.tvShows); CloseMenu(); @@ -764,7 +764,7 @@ bool8 debug_sub_808FF3C(void) { bool8 updateDisplay = FALSE; - if (gMain.newKeys & DPAD_UP) + if (JOY_NEW(DPAD_UP)) { gDebug_03000725++; if (gDebug_03000725 == 16) @@ -773,7 +773,7 @@ bool8 debug_sub_808FF3C(void) updateDisplay = TRUE; } - if (gMain.newKeys & DPAD_DOWN) + if (JOY_NEW(DPAD_DOWN)) { if (gDebug_03000725 == 0) gDebug_03000725 = 16; @@ -782,7 +782,7 @@ bool8 debug_sub_808FF3C(void) updateDisplay = TRUE; } - if (gMain.newKeys & DPAD_RIGHT) + if (JOY_NEW(DPAD_RIGHT)) { gDebug_03000724++; if (gDebug_03000724 == 3) @@ -791,7 +791,7 @@ bool8 debug_sub_808FF3C(void) updateDisplay = TRUE; } - if (gMain.newKeys & DPAD_LEFT) + if (JOY_NEW(DPAD_LEFT)) { if (gDebug_03000724 == 0) gDebug_03000724 = 3; @@ -809,13 +809,13 @@ bool8 debug_sub_808FF3C(void) Menu_PrintText(gStringVar1, 23, 1); } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { PlaySE(SE_PIN); debug_sub_8090080(gDebug_03000725, gUnknown_Debug_083C4B20[gDebug_03000724]); } - if (gMain.newKeys & (B_BUTTON | START_BUTTON)) + if (JOY_NEW(B_BUTTON | START_BUTTON)) { sub_80BEC40(); CloseMenu(); @@ -963,7 +963,7 @@ bool8 debug_sub_8090238(void) bool8 debug_sub_8090278(void) { - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { CloseMenu(); return TRUE; diff --git a/src/debug/sound_check_menu.c b/src/debug/sound_check_menu.c index 6f6ee58dd..b18823326 100644 --- a/src/debug/sound_check_menu.c +++ b/src/debug/sound_check_menu.c @@ -199,19 +199,19 @@ void sub_80BA384(u8 taskId) // Task_HandleDrawingSoundCheckMenuText bool8 Task_ProcessSoundCheckMenuInput(u8 taskId) { - if (gMain.newKeys & R_BUTTON) // driver test + if (JOY_NEW(R_BUTTON)) // driver test { gTasks[taskId].func = Task_DrawDriverTestMenu; } - else if (gMain.newKeys & L_BUTTON) + else if (JOY_NEW(L_BUTTON)) { gTasks[taskId].func = sub_80BAF84; } - else if (gMain.newKeys & START_BUTTON) + else if (JOY_NEW(START_BUTTON)) { gTasks[taskId].func = Task_InitCryTest; } - else if (gMain.newKeys & A_BUTTON) + else if (JOY_NEW(A_BUTTON)) { if (gTasks[taskId].tWindowSelected != 0) // is playing? { @@ -258,23 +258,23 @@ bool8 Task_ProcessSoundCheckMenuInput(u8 taskId) } } } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { m4aSongNumStart(SE_SELECT); BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB(0, 0, 0)); gTasks[taskId].func = sub_80BA68C; } - else if (gMain.newAndRepeatedKeys & DPAD_UP) + else if (JOY_REPT(DPAD_UP)) { gTasks[taskId].tWindowSelected ^= 1; return TRUE; } - else if (gMain.newAndRepeatedKeys & DPAD_DOWN) + else if (JOY_REPT(DPAD_DOWN)) { gTasks[taskId].tWindowSelected ^= 1; return TRUE; } - else if (gMain.newAndRepeatedKeys & DPAD_RIGHT) + else if (JOY_REPT(DPAD_RIGHT)) { if (gTasks[taskId].tWindowSelected != 0) { @@ -292,7 +292,7 @@ bool8 Task_ProcessSoundCheckMenuInput(u8 taskId) } return TRUE; } - else if (gMain.newAndRepeatedKeys & DPAD_LEFT) + else if (JOY_REPT(DPAD_LEFT)) { if (gTasks[taskId].tWindowSelected != 0) { @@ -310,7 +310,7 @@ bool8 Task_ProcessSoundCheckMenuInput(u8 taskId) } return TRUE; } - else if (gMain.heldKeys & SELECT_BUTTON) + else if (JOY_HELD(SELECT_BUTTON)) { gUnknown_020387B0 = 1; } @@ -454,7 +454,7 @@ void Task_DrawDriverTestMenu(u8 taskId) // Task_DrawDriverTestMenu void Task_ProcessDriverTestInput(u8 taskId) { - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { REG_DISPCNT = 0x7140; REG_WIN0H = WIN_RANGE(17, 223); @@ -463,7 +463,7 @@ void Task_ProcessDriverTestInput(u8 taskId) gTasks[taskId].func = Task_InitSoundCheckMenu; return; } - if (gMain.newAndRepeatedKeys & DPAD_UP) // _080BAAA8 + if (JOY_REPT(DPAD_UP)) // _080BAAA8 { u8 old = sDriverTestSelection; @@ -472,7 +472,7 @@ void Task_ProcessDriverTestInput(u8 taskId) sub_80BAE10(old, sDriverTestSelection); return; } - if (gMain.newAndRepeatedKeys & DPAD_DOWN) // _080BAAD0 + if (JOY_REPT(DPAD_DOWN)) // _080BAAD0 { u8 old = sDriverTestSelection; @@ -481,44 +481,44 @@ void Task_ProcessDriverTestInput(u8 taskId) sub_80BAE10(old, sDriverTestSelection); return; } - if (gMain.newKeys & START_BUTTON) // _080BAAF8 + if (JOY_NEW(START_BUTTON)) // _080BAAF8 { gUnknown_020387D8 ^= 1; PrintDriverTestMenuText(); return; } - if (gMain.newKeys & SELECT_BUTTON) // _080BAB14 + if (JOY_NEW(SELECT_BUTTON)) // _080BAB14 { gUnknown_020387D9 ^= 1; PrintDriverTestMenuText(); SetPokemonCryStereo(gUnknown_020387D9); return; } - if (gMain.newAndRepeatedKeys & R_BUTTON) // _080BAB38 + if (JOY_REPT(R_BUTTON)) // _080BAB38 { AdjustSelectedDriverParam(10); PrintDriverTestMenuText(); return; } - if (gMain.newAndRepeatedKeys & L_BUTTON) // _080BAB46 + if (JOY_REPT(L_BUTTON)) // _080BAB46 { AdjustSelectedDriverParam(-10); PrintDriverTestMenuText(); return; } - if (gMain.newAndRepeatedKeys & DPAD_LEFT) // _080BAB56 + if (JOY_REPT(DPAD_LEFT)) // _080BAB56 { AdjustSelectedDriverParam(-1); PrintDriverTestMenuText(); return; } - if (gMain.newAndRepeatedKeys & DPAD_RIGHT) // _080BAB64 + if (JOY_REPT(DPAD_RIGHT)) // _080BAB64 { AdjustSelectedDriverParam(1); PrintDriverTestMenuText(); return; } - if (gMain.newKeys & A_BUTTON) // _080BAB78 + if (JOY_NEW(A_BUTTON)) // _080BAB78 { u8 divide, remaining; @@ -728,7 +728,7 @@ void sub_80BB038(u8 taskId) } } // _080BB0A2 - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { REG_DISPCNT = 0x7140; REG_WIN0H = WIN_RANGE(17, 223); @@ -737,7 +737,7 @@ void sub_80BB038(u8 taskId) gTasks[taskId].func = Task_InitSoundCheckMenu; return; } - if (gMain.newKeys & A_BUTTON) // _080BB104 + if (JOY_NEW(A_BUTTON)) // _080BB104 { s8 panpot = gUnknown_083D03F8[sSoundTestParams[CRY_TEST_PANPOT]]; if (panpot != -128) @@ -764,25 +764,25 @@ void sub_80BB038(u8 taskId) sSoundTestParams[CRY_TEST_PROGRESS] = 0; return; } - if (gMain.newKeys & L_BUTTON) // _080BB15E + if (JOY_NEW(L_BUTTON)) // _080BB15E { sSoundTestParams[CRY_TEST_PANPOT]++; if (sSoundTestParams[CRY_TEST_PANPOT] > 4) sSoundTestParams[CRY_TEST_PANPOT] = 0; } - if (gMain.newKeys & R_BUTTON) // _080BB176 + if (JOY_NEW(R_BUTTON)) // _080BB176 { sSoundTestParams[CRY_TEST_PANPOT]--; if (sSoundTestParams[CRY_TEST_PANPOT] < 0) sSoundTestParams[CRY_TEST_PANPOT] = 4; } - if (gMain.newAndRepeatedKeys & DPAD_RIGHT) // _080BB192 + if (JOY_REPT(DPAD_RIGHT)) // _080BB192 { sSoundTestParams[CRY_TEST_VOICE]++; if (sSoundTestParams[CRY_TEST_VOICE] > 247) sSoundTestParams[CRY_TEST_VOICE] = 0; } - else if (gMain.newAndRepeatedKeys & DPAD_LEFT) // _080BB1B0 + else if (JOY_REPT(DPAD_LEFT)) // _080BB1B0 { sSoundTestParams[CRY_TEST_VOICE]--; if (sSoundTestParams[CRY_TEST_VOICE] < 0) @@ -1257,27 +1257,27 @@ void Task_ProcessCryTestInput(u8 taskId) { UpdateCryWaveformWindow(3); - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { CryScreenPlayButton(gSoundTestCryNum); } - if (gMain.newKeys & R_BUTTON) + if (JOY_NEW(R_BUTTON)) { StopCryAndClearCrySongs(); } - if (gMain.newAndRepeatedKeys & DPAD_UP) + if (JOY_REPT(DPAD_UP)) { if(--gSoundTestCryNum == 0) gSoundTestCryNum = 384; // total species PrintCryNumber(); } - if (gMain.newAndRepeatedKeys & DPAD_DOWN) + if (JOY_REPT(DPAD_DOWN)) { if(++gSoundTestCryNum > 384) gSoundTestCryNum = 1; PrintCryNumber(); } - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { REG_DISPCNT = 0x7140; REG_WIN0H = WIN_RANGE(17, 223); diff --git a/src/debug/start_menu_debug.c b/src/debug/start_menu_debug.c index ec1e6527a..36ebf4aba 100644 --- a/src/debug/start_menu_debug.c +++ b/src/debug/start_menu_debug.c @@ -445,7 +445,7 @@ void debug_sub_8076BB4(u8 taskId) gDebug_TestMenuItems[gUnknown_030006C4[cursorPos]].func(); break; case -2: - if (gMain.newKeys & 0x20) + if (JOY_NEW(DPAD_LEFT)) { if (data[0] == 0) data[0] = 1; @@ -454,7 +454,7 @@ void debug_sub_8076BB4(u8 taskId) debug_sub_8076AC8(data[0]); PlaySE(SE_SELECT); } - else if (gMain.newKeys & 0x10) + else if (JOY_NEW(DPAD_RIGHT)) { if (data[0] == 1) data[0] = 0; @@ -574,7 +574,7 @@ void DebugMenu_8076D6C(u8 taskId) data[0]++; break; case 1: - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { Menu_DisplayDialogueFrame(); Menu_PrintText(Str_839BD4C, 2, 15); @@ -582,14 +582,14 @@ void DebugMenu_8076D6C(u8 taskId) RtcReset(); data[0]++; } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { DestroyTask(taskId); DoSoftReset(); } break; case 2: - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { DestroyTask(taskId); DoSoftReset(); @@ -617,7 +617,7 @@ void DebugMenu_8076E30(u8 taskId) data[0]++; break; case 1: - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { Menu_DisplayDialogueFrame(); sub_813B79C(); @@ -625,14 +625,14 @@ void DebugMenu_8076E30(u8 taskId) PlaySE(SE_DING_DONG); data[0]++; } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { DestroyTask(taskId); DoSoftReset(); // noreturn } break; case 2: - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { DestroyTask(taskId); DoSoftReset(); // noreturn @@ -757,17 +757,17 @@ u8 DebugMenu_807709C(void) { u8 actionRet; - if (gMain.newKeys & DPAD_UP) + if (JOY_NEW(DPAD_UP)) { PlaySE(SE_SELECT); gUnknown_030006C0 = Menu_MoveCursor(-1); } - if (gMain.newKeys & DPAD_DOWN) + if (JOY_NEW(DPAD_DOWN)) { PlaySE(SE_SELECT); gUnknown_030006C0 = Menu_MoveCursor(+1); } - if (gMain.newKeys & DPAD_LEFT) + if (JOY_NEW(DPAD_LEFT)) { PlaySE(SE_SELECT); if (gUnknown_030006C1 == 0) @@ -777,7 +777,7 @@ u8 DebugMenu_807709C(void) DebugMenu_8077004(); DebugMenu_807719C(); } - if (gMain.newKeys & DPAD_RIGHT) + if (JOY_NEW(DPAD_RIGHT)) { PlaySE(SE_SELECT); if (gUnknown_030006C1 == 7) @@ -787,7 +787,7 @@ u8 DebugMenu_807709C(void) DebugMenu_8077004(); DebugMenu_807719C(); } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); actionRet = gDebug0x839B9BC[gUnknown_030006C4[gUnknown_030006C0]].func(); @@ -798,7 +798,7 @@ u8 DebugMenu_807709C(void) #endif return actionRet; } - if (gMain.newKeys & (B_BUTTON | START_BUTTON)) + if (JOY_NEW(B_BUTTON | START_BUTTON)) { CloseMenu(); // TODO: see if this is in rev1+ @@ -1131,7 +1131,7 @@ void DebugMenu_8077704(void) u8 DebugMenu_8077760(void) { - if (gMain.newKeys & DPAD_UP) + if (JOY_NEW(DPAD_UP)) { PlaySE(SE_SELECT); Menu_MoveCursor(-1); @@ -1140,7 +1140,7 @@ u8 DebugMenu_8077760(void) else gUnknown_030006B8 = 3; } - if (gMain.newKeys & DPAD_DOWN) + if (JOY_NEW(DPAD_DOWN)) { PlaySE(SE_SELECT); Menu_MoveCursor(+1); @@ -1149,13 +1149,13 @@ u8 DebugMenu_8077760(void) else gUnknown_030006B8 = 0; } - if (gMain.newKeys & (DPAD_LEFT | DPAD_RIGHT)) + if (JOY_NEW(DPAD_LEFT | DPAD_RIGHT)) { PlaySE(SE_SELECT); gUnknown_030006C8 ^= (1 << Menu_GetCursorPos()); DebugMenu_80776B4(Menu_GetCursorPos()); } - if (gMain.newKeys & A_BUTTON || gMain.newKeys & B_BUTTON) + if (JOY_NEW(A_BUTTON) || JOY_NEW(B_BUTTON)) { REG_DISPCNT = (REG_DISPCNT & 0xF0FF) + (gUnknown_030006C8 << 8); CloseMenu(); @@ -1184,13 +1184,13 @@ void DebugMenu_807786C(u8 a0) u8 DebugMenu_80778A8(void) { - if (gMain.newKeys & (DPAD_LEFT | DPAD_RIGHT)) + if (JOY_NEW(DPAD_LEFT | DPAD_RIGHT)) { PlaySE(SE_SELECT); gWildEncountersDisabled ^= 1; DebugMenu_807786C(gWildEncountersDisabled); } - if (gMain.newKeys & A_BUTTON || gMain.newKeys & B_BUTTON) + if (JOY_NEW(A_BUTTON) || JOY_NEW(B_BUTTON)) { CloseMenu(); return TRUE; @@ -1554,7 +1554,7 @@ u8 DebugMenu_8077D78(const struct MenuAction *menuActions) bool8 DebugMenu_8077DB4(void) { - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { CloseMenu(); return TRUE; @@ -1595,12 +1595,12 @@ bool32 DebugMenu_8077DD8(s16 * a0, s32 a1, s32 a2, u16 a3) int DebugMenu_8077E40(int flag) { - if (gMain.newKeys & A_BUTTON || gMain.newKeys & B_BUTTON) + if (JOY_NEW(A_BUTTON) || JOY_NEW(B_BUTTON)) { CloseMenu(); return -1; } - if (gMain.newKeys & (DPAD_LEFT | DPAD_RIGHT)) + if (JOY_NEW(DPAD_LEFT | DPAD_RIGHT)) { PlaySE(SE_SELECT); if (flag) @@ -1659,14 +1659,14 @@ const u8 Str_839C014[] = _("How many?"); void DebugMenu_8077F7C(u8 taskId) { struct Task *task = gTasks + taskId; - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { Menu_DisplayDialogueFrame(); Menu_PrintText(Str_839C014, 2, 15); DebugMenu_8077EE0(task->data[1], task->data[2]); task->func = DebugMenu_8077FFC; } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { task->func = DebugMenu_807806C; } @@ -1679,13 +1679,13 @@ void DebugMenu_8077F7C(u8 taskId) void DebugMenu_8077FFC(u8 taskId) { struct Task *task = gTasks + taskId; - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { if (AddBagItem(task->data[1], task->data[2]) == TRUE) PlaySE(SE_SELECT); task->func = DebugMenu_8077F40; } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { task->func = DebugMenu_8077F40; } @@ -1755,7 +1755,7 @@ void DebugMenu_807808C(u32 a0) void DebugMenu_807817C(u8 taskId) { - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { Menu_EraseScreen(); DestroyTask(taskId); @@ -1769,13 +1769,13 @@ void DebugMenu_80781A8(u8 taskId) if (task->data[0] == 0) task->data[0]++; - else if (gMain.newKeys & A_BUTTON) + else if (JOY_NEW(A_BUTTON)) { DebugMenu_807808C(task->data[0]); task->func = DebugMenu_807817C; return; } - else if (!DebugMenu_8077DD8(task->data + 0, 1, 13, gMain.newAndRepeatedKeys & (DPAD_UP | DPAD_DOWN))) + else if (!DebugMenu_8077DD8(task->data + 0, 1, 13, JOY_REPT(DPAD_UP | DPAD_DOWN))) return; Menu_BlankWindowRect(4, 17, 22, 18); ConvertIntToDecimalStringN(gStringVar1, task->data[0], STR_CONV_MODE_RIGHT_ALIGN, 3); @@ -1846,7 +1846,7 @@ void DebugMenu_8078310(u8 taskId) data[0]++; break; case 1: - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { PlaySE(SE_DING_DONG); *GetVarPointer(VAR_MIRAGE_RND_H) = data[1]; @@ -1854,7 +1854,7 @@ void DebugMenu_8078310(u8 taskId) DestroyTask(taskId); ScriptContext2_Disable(); } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { Menu_EraseScreen(); DestroyTask(taskId); @@ -1876,7 +1876,7 @@ u8 DebugMenu_MiragaIslandRND(void) bool8 DebugMenu_80783C8(void) { - if (gMain.newKeys & (DPAD_LEFT | DPAD_RIGHT)) + if (JOY_NEW(DPAD_LEFT | DPAD_RIGHT)) { PlaySE(SE_SELECT); if (!FlagGet(FLAG_SYS_GAME_CLEAR)) @@ -1890,7 +1890,7 @@ bool8 DebugMenu_80783C8(void) DebugMenu_807786C(1); } } - if (gMain.newKeys & A_BUTTON || gMain.newKeys & B_BUTTON) + if (JOY_NEW(A_BUTTON) || JOY_NEW(B_BUTTON)) { CloseMenu(); return TRUE; @@ -2101,23 +2101,23 @@ bool32 DebugMenu_807860C(u8 taskId) data[0]++; return FALSE; case 1: - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { data[0]--; return TRUE; } - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { data[0]++; return FALSE; } - if (gMain.newAndRepeatedKeys & DPAD_UP) + if (JOY_REPT(DPAD_UP)) { data[1]++; if (data[1] == NUM_GAME_STATS) data[1] = 0; } - else if (gMain.newAndRepeatedKeys & DPAD_DOWN) + else if (JOY_REPT(DPAD_DOWN)) { data[1]--; if (data[1] < 0) @@ -2240,7 +2240,7 @@ void DebugMenu_8078880(u8 taskId) gTasks[taskId].data[0]++; break; case 2: - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { Menu_EraseScreen(); ScriptContext2_Disable(); @@ -2309,18 +2309,18 @@ void DebugMenu_80789CC(u8 taskId) void DebugMenu_8078A14(u8 taskId) { s16 * data = gTasks[taskId].data; - if (gMain.newKeys & (DPAD_UP | DPAD_DOWN)) + if (JOY_NEW(DPAD_UP | DPAD_DOWN)) { data[0] = data[0] == 0 ? 1 : 0; DebugMenu_8078968(data[0]); } - else if (gMain.newKeys & A_BUTTON) + else if (JOY_NEW(A_BUTTON)) { data[1] = gSaveBlock2.battleTower.curStreakChallengesNum[data[0]]; DebugMenu_80789A4(data[1]); gTasks[taskId].func = DebugMenu_8078AA4; } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { gTasks[taskId].func = DebugMenu_8078B38; } @@ -2333,13 +2333,13 @@ void DebugMenu_8078AA4(u8 taskId) { DebugMenu_80789A4(data[1]); } - else if (gMain.newKeys & A_BUTTON) + else if (JOY_NEW(A_BUTTON)) { gSaveBlock2.battleTower.curStreakChallengesNum[data[0]] = data[1]; PlaySE(SE_DING_DONG); gTasks[taskId].func = DebugMenu_8078B38; } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { DebugMenu_8078950(); DebugMenu_8078968(data[0]); @@ -2433,7 +2433,7 @@ void DebugMenu_8078BD4(u8 taskId) data[0]++; break; case 1: - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { PlaySE(SE_DING_DONG); Menu_EraseScreen(); @@ -2441,7 +2441,7 @@ void DebugMenu_8078BD4(u8 taskId) ScriptContext2_Disable(); DebugMenu_8078B94(); } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { Menu_EraseScreen(); DestroyTask(taskId); @@ -2484,12 +2484,12 @@ bool8 DebugMenu_8078C80(void) bool8 DebugMenu_8078CA8(void) { - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { gMenuCallback = DebugMenu_8078CE4; return FALSE; } - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { CloseMenu(); return TRUE; @@ -2537,7 +2537,7 @@ bool8 DebugMenu_8078D7C(void) bool8 DebugMenu_8078DA4(void) { - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { CloseMenu(); return TRUE; @@ -2637,7 +2637,7 @@ void DebugMenu_8078F68(u8 taskId) { s16 * data = gTasks[taskId].data; - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { gSaveBlock2.playTimeHours = data[1]; gSaveBlock2.playTimeMinutes = data[2]; @@ -2645,11 +2645,11 @@ void DebugMenu_8078F68(u8 taskId) PlaySE(SE_DING_DONG); gTasks[taskId].func = DebugMenu_8079020; } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { gTasks[taskId].func = DebugMenu_8079020; } - else if (gMain.newKeys & DPAD_LEFT) + else if (JOY_NEW(DPAD_LEFT)) { if ((u16)data[0] > 0) { @@ -2657,7 +2657,7 @@ void DebugMenu_8078F68(u8 taskId) DebugMenu_8078E80(data); } } - else if (gMain.newKeys & DPAD_RIGHT) + else if (JOY_NEW(DPAD_RIGHT)) { if ((u16)data[0] < 2) { @@ -2767,7 +2767,7 @@ void DebugMenu_8079110(u8 taskId) gTasks[taskId].data[0]++; break; case 2: - if (Menu_UpdateWindowText() && gMain.newKeys & A_BUTTON) + if (Menu_UpdateWindowText() && JOY_NEW(A_BUTTON)) { Menu_EraseScreen(); ScriptContext2_Disable(); diff --git a/src/debug/taya_debug_window.c b/src/debug/taya_debug_window.c index 9a997a566..995b92fec 100644 --- a/src/debug/taya_debug_window.c +++ b/src/debug/taya_debug_window.c @@ -231,7 +231,7 @@ bool8 TayaDebugMenu_Trend(void) bool8 debug_sub_8090808(void) { - if (gMain.newKeys & (A_BUTTON | B_BUTTON)) + if (JOY_NEW(A_BUTTON | B_BUTTON)) { Menu_EraseScreen(); CloseMenu(); @@ -445,17 +445,17 @@ bool8 debug_sub_8090C88(void) do { - if (gMain.newKeys & DPAD_LEFT && eTayaLuckyNumber.digit != 0) + if (JOY_NEW(DPAD_LEFT) && eTayaLuckyNumber.digit != 0) { eTayaLuckyNumber.digit--; break; } - if (gMain.newKeys & DPAD_RIGHT && eTayaLuckyNumber.digit < 4) + if (JOY_NEW(DPAD_RIGHT) && eTayaLuckyNumber.digit < 4) { eTayaLuckyNumber.digit++; break; } - if (gMain.newAndRepeatedKeys & DPAD_UP) + if (JOY_REPT(DPAD_UP)) { u8 r4; @@ -472,7 +472,7 @@ bool8 debug_sub_8090C88(void) break; } } - if (gMain.newAndRepeatedKeys & DPAD_DOWN) + if (JOY_REPT(DPAD_DOWN)) { u8 r4; @@ -489,12 +489,12 @@ bool8 debug_sub_8090C88(void) break; } } - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { CloseMenu(); return TRUE; } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { SetLotteryNumber16_Unused(eTayaLuckyNumber.curLuckyId); CloseMenu(); @@ -658,14 +658,14 @@ bool8 TayaDebugMenu_8091190(void) return FALSE; case -2: r4 = sTayaTopMenuPage; - if (gMain.newKeys & DPAD_LEFT) + if (JOY_NEW(DPAD_LEFT)) { sTayaTopMenuPage--; if (sTayaTopMenuPage < 0) sTayaTopMenuPage = 1; } - if (gMain.newKeys & DPAD_RIGHT) + if (JOY_NEW(DPAD_RIGHT)) { sTayaTopMenuPage++; if ((u8)sTayaTopMenuPage > 1) @@ -729,7 +729,7 @@ void debug_sub_8091334(void) { case 0: eTayaMonData.redraw = 0; - if (gMain.newKeys & DPAD_UP) + if (JOY_NEW(DPAD_UP)) { if (eTayaMonData.y != 0) { @@ -737,7 +737,7 @@ void debug_sub_8091334(void) eTayaMonData.redraw = 1; } } - if (gMain.newKeys & DPAD_DOWN) + if (JOY_NEW(DPAD_DOWN)) { if (eTayaMonData.x != 2) { @@ -756,7 +756,7 @@ void debug_sub_8091334(void) } } } - if (gMain.newKeys & DPAD_LEFT) + if (JOY_NEW(DPAD_LEFT)) { if (eTayaMonData.x != 0) { @@ -764,7 +764,7 @@ void debug_sub_8091334(void) eTayaMonData.redraw = 1; } } - if (gMain.newKeys & DPAD_RIGHT) + if (JOY_NEW(DPAD_RIGHT)) { if (eTayaMonData.y != 5) { @@ -787,7 +787,7 @@ void debug_sub_8091334(void) { debug_sub_80916AC(); } - else if (gMain.newKeys & A_BUTTON) + else if (JOY_NEW(A_BUTTON)) { u16 param = gUnknown_Debug_083C50EC[eTayaMonData.y][eTayaMonData.x].param; if (param >= MON_DATA_COOL_RIBBON && param <= MON_DATA_TOUGH_RIBBON) @@ -796,7 +796,7 @@ void debug_sub_8091334(void) eTayaMonData.maxVal = 1; eTayaMonData.state = 1; } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { BlendPalettes(0xFFFFFFFF, 16, RGB(0, 0, 0)); SetMainCallback2(sub_80546F0); @@ -804,7 +804,7 @@ void debug_sub_8091334(void) break; case 1: eTayaMonData.redraw = 0; - if (gMain.newKeys & DPAD_UP) + if (JOY_NEW(DPAD_UP)) { if (eTayaMonData.data[eTayaMonData.y][eTayaMonData.x] < eTayaMonData.maxVal) { @@ -812,7 +812,7 @@ void debug_sub_8091334(void) eTayaMonData.redraw = 1; } } - if (gMain.newKeys & DPAD_DOWN) + if (JOY_NEW(DPAD_DOWN)) { if (eTayaMonData.data[eTayaMonData.y][eTayaMonData.x] != 0) { @@ -826,13 +826,13 @@ void debug_sub_8091334(void) } else { - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { eTayaMonData.data[eTayaMonData.y][eTayaMonData.x] = GetMonData(gPlayerParty, gUnknown_Debug_083C50EC[eTayaMonData.y][eTayaMonData.x].param); debug_sub_80916AC(); eTayaMonData.state = 0; } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { if (gUnknown_Debug_083C50EC[eTayaMonData.y][eTayaMonData.x].param) SetMonData(gPlayerParty, gUnknown_Debug_083C50EC[eTayaMonData.y][eTayaMonData.x].param, &eTayaMonData.data[eTayaMonData.y][eTayaMonData.x]); diff --git a/src/debug/tomomichi_debug_menu.c b/src/debug/tomomichi_debug_menu.c index cc0c89c71..6b217e287 100644 --- a/src/debug/tomomichi_debug_menu.c +++ b/src/debug/tomomichi_debug_menu.c @@ -1961,22 +1961,22 @@ static bool8 InitDebugWindow(void) static bool8 TopMenu_HandleInput(void) { - if (gMain.newKeys & DPAD_UP) + if (JOY_NEW(DPAD_UP)) { PlaySE(SE_SELECT); sTopMenuCursorPos = Menu_MoveCursor(-1); } - if (gMain.newKeys & DPAD_DOWN) + if (JOY_NEW(DPAD_DOWN)) { PlaySE(SE_SELECT); sTopMenuCursorPos = Menu_MoveCursor(+1); } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); return sMenuActions_TopMenu[sTopMenuCursorPos].func(); } - if (gMain.newKeys & (B_BUTTON | START_BUTTON)) + if (JOY_NEW(B_BUTTON | START_BUTTON)) { CloseMenu(); return TRUE; @@ -2171,22 +2171,22 @@ static bool8 PreviewData_HandleInput(void) static bool8 TrickHouse_HandleInput(void) { - if (gMain.newKeys & DPAD_UP) + if (JOY_NEW(DPAD_UP)) { PlaySE(SE_SELECT); sTrickRelatedMenuCursorPos = Menu_MoveCursor(-1); } - if (gMain.newKeys & DPAD_DOWN) + if (JOY_NEW(DPAD_DOWN)) { PlaySE(SE_SELECT); sTrickRelatedMenuCursorPos = Menu_MoveCursor(+1); } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); return sMenuActions_TrickRelated[sTrickRelatedMenuCursorPos].func(); } - if (gMain.newKeys & (B_BUTTON | START_BUTTON)) + if (JOY_NEW(B_BUTTON | START_BUTTON)) { CloseMenu(); return TRUE; @@ -2196,22 +2196,22 @@ static bool8 TrickHouse_HandleInput(void) static bool8 ControlEvents_HandleInput(void) { - if (gMain.newKeys & DPAD_UP) + if (JOY_NEW(DPAD_UP)) { PlaySE(SE_SELECT); sControlEventsCursorPos = Menu_MoveCursor(-1); } - if (gMain.newKeys & DPAD_DOWN) + if (JOY_NEW(DPAD_DOWN)) { PlaySE(SE_SELECT); sControlEventsCursorPos = Menu_MoveCursor(+1); } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); return sMenuActions_ControlEvents[sControlEventsCursorPos].func(); } - if (gMain.newKeys & (B_BUTTON | START_BUTTON)) + if (JOY_NEW(B_BUTTON | START_BUTTON)) { CloseMenu(); return TRUE; @@ -2221,22 +2221,22 @@ static bool8 ControlEvents_HandleInput(void) static bool8 ControlFlags_HandleInput(void) { - if (gMain.newKeys & DPAD_UP) + if (JOY_NEW(DPAD_UP)) { PlaySE(SE_SELECT); sControlFlagsCursorPos = Menu_MoveCursor(-1); } - if (gMain.newKeys & DPAD_DOWN) + if (JOY_NEW(DPAD_DOWN)) { PlaySE(SE_SELECT); sControlFlagsCursorPos = Menu_MoveCursor(+1); } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); return sMenuActions_ControlFlags[sControlFlagsCursorPos].func(); } - if (gMain.newKeys & (B_BUTTON | START_BUTTON)) + if (JOY_NEW(B_BUTTON | START_BUTTON)) { CloseMenu(); return TRUE; @@ -2246,22 +2246,22 @@ static bool8 ControlFlags_HandleInput(void) static bool8 ControlWorks_HandleInput(void) { - if (gMain.newKeys & DPAD_UP) + if (JOY_NEW(DPAD_UP)) { PlaySE(SE_SELECT); sControlWORKCursorPos = Menu_MoveCursor(-1); } - if (gMain.newKeys & DPAD_DOWN) + if (JOY_NEW(DPAD_DOWN)) { PlaySE(SE_SELECT); sControlWORKCursorPos = Menu_MoveCursor(+1); } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); return sMenuActions_ControlWorks[sControlWORKCursorPos].func(); } - if (gMain.newKeys & (B_BUTTON | START_BUTTON)) + if (JOY_NEW(B_BUTTON | START_BUTTON)) { CloseMenu(); return TRUE; @@ -2607,7 +2607,7 @@ static bool8 debug_sub_808C6C8(void) static void debug_sub_808C714(u8 whichMenu, u8 cursorPos) { - if (gMain.newKeys & R_BUTTON) + if (JOY_NEW(R_BUTTON)) { if (!FlagGet(gUnknown_Debug_83C31E6[whichMenu][cursorPos])) FlagSet(gUnknown_Debug_83C31E6[whichMenu][cursorPos]); @@ -2769,7 +2769,7 @@ static bool8 debug_sub_808CB74(void) static void debug_sub_808CBC0(u8 whichMenu, u8 cursorPos) { - if (gMain.newKeys & R_BUTTON) + if (JOY_NEW(R_BUTTON)) { if (!FlagGet(gUnknown_Debug_083C271A[whichMenu][cursorPos])) FlagSet(gUnknown_Debug_083C271A[whichMenu][cursorPos]); @@ -2865,7 +2865,7 @@ static bool8 debug_sub_808CE10(void) static void debug_sub_808CE5C(u8 whichMenu, u8 cursorPos) { - if (gMain.newKeys & R_BUTTON) + if (JOY_NEW(R_BUTTON)) { if (!FlagGet(gUnknown_Debug_083C1C38[whichMenu][cursorPos])) FlagSet(gUnknown_Debug_083C1C38[whichMenu][cursorPos]); @@ -3027,7 +3027,7 @@ static bool8 debug_sub_808D2BC(void) static void debug_sub_808D308(u8 whichMenu, u8 cursorPos) { - if (gMain.newKeys & R_BUTTON) + if (JOY_NEW(R_BUTTON)) { if (!FlagGet(gUnknown_Debug_083C19C6[whichMenu][cursorPos])) FlagSet(gUnknown_Debug_083C19C6[whichMenu][cursorPos]); @@ -3112,7 +3112,7 @@ static bool8 ControlFlags_FH_OBJ_Subsubmenu_HandleInput(void) static void ControlFlags_FH_OBJ_FlagToggle(u8 whichMenu, u8 cursorPos) { - if (gMain.newKeys & R_BUTTON) + if (JOY_NEW(R_BUTTON)) { if (!FlagGet(sControlFlags_FH_OBJ_FlagsArrays[whichMenu][cursorPos])) FlagSet(sControlFlags_FH_OBJ_FlagsArrays[whichMenu][cursorPos]); @@ -3197,7 +3197,7 @@ static bool8 debug_sub_808D744(void) static void debug_sub_808D790(u8 whichMenu, u8 cursorPos) { - if (gMain.newKeys & R_BUTTON) + if (JOY_NEW(R_BUTTON)) { if (!FlagGet(gUnknown_Debug_083C12D2[whichMenu][cursorPos])) FlagSet(gUnknown_Debug_083C12D2[whichMenu][cursorPos]); @@ -3271,7 +3271,7 @@ static bool8 debug_sub_808D930(void) static void debug_sub_808D97C(u8 whichMenu, u8 cursorPos) { - if (gMain.newKeys & R_BUTTON) + if (JOY_NEW(R_BUTTON)) { if (!FlagGet(gUnknown_Debug_083C1AAE[whichMenu][cursorPos])) FlagSet(gUnknown_Debug_083C1AAE[whichMenu][cursorPos]); @@ -3326,11 +3326,11 @@ static void ControlWorks_AnsWork_AdjustRESULT(void) { u16 delta; - if (gMain.newKeys & R_BUTTON) + if (JOY_NEW(R_BUTTON)) { delta = +1; } - else if (gMain.newKeys & L_BUTTON) + else if (JOY_NEW(L_BUTTON)) { delta = -1; } @@ -3494,9 +3494,9 @@ static void debug_sub_808DF64(u8 whichMenu, u8 cursorPos) { u16 delta; - if (gMain.newKeys & R_BUTTON) + if (JOY_NEW(R_BUTTON)) delta = +1; - else if (gMain.newKeys & L_BUTTON) + else if (JOY_NEW(L_BUTTON)) delta = -1; else return; @@ -3625,9 +3625,9 @@ static void debug_sub_808E310(u8 whichMenu, u8 cursorPos) { u16 delta; - if (gMain.newKeys & R_BUTTON) + if (JOY_NEW(R_BUTTON)) delta = +1; - else if (gMain.newKeys & L_BUTTON) + else if (JOY_NEW(L_BUTTON)) delta = -1; else return; @@ -3735,9 +3735,9 @@ static void debug_sub_808E604(u8 whichMenu, u8 cursorPos) { u16 delta; - if (gMain.newAndRepeatedKeys & R_BUTTON) + if (JOY_REPT(R_BUTTON)) delta = +1; - else if (gMain.newAndRepeatedKeys & L_BUTTON) + else if (JOY_REPT(L_BUTTON)) delta = -1; else return; @@ -3822,9 +3822,9 @@ static void debug_sub_808E850(u8 whichMenu, u8 cursorPos) { u16 delta; - if (gMain.newKeys & R_BUTTON) + if (JOY_NEW(R_BUTTON)) delta = +1; - else if (gMain.newKeys & L_BUTTON) + else if (JOY_NEW(L_BUTTON)) delta = -1; else return; @@ -3919,9 +3919,9 @@ static void debug_sub_808EAFC(u8 whichMenu, u8 cursorPos) { u16 delta; - if (gMain.newKeys & R_BUTTON) + if (JOY_NEW(R_BUTTON)) delta = +1; - else if (gMain.newKeys & L_BUTTON) + else if (JOY_NEW(L_BUTTON)) delta = -1; else return; @@ -4013,24 +4013,24 @@ static bool8 DummyMenuAction(void) static void PicTest_SelectPokemon(void) { - if (gMain.newAndRepeatedKeys & DPAD_LEFT) + if (JOY_REPT(DPAD_LEFT)) { if (sPicTest_Species != SPECIES_BULBASAUR) sPicTest_Species--; } - if (gMain.newAndRepeatedKeys & DPAD_RIGHT) + if (JOY_REPT(DPAD_RIGHT)) { if (sPicTest_Species != SPECIES_CHIMECHO) sPicTest_Species++; } - if (gMain.newAndRepeatedKeys & L_BUTTON) + if (JOY_REPT(L_BUTTON)) { if (sPicTest_Species >= SPECIES_BULBASAUR + 10) sPicTest_Species -= 10; else sPicTest_Species = SPECIES_BULBASAUR; } - if (gMain.newAndRepeatedKeys & R_BUTTON) + if (JOY_REPT(R_BUTTON)) { if (sPicTest_Species <= SPECIES_CHIMECHO - 10) sPicTest_Species += 10; @@ -4041,31 +4041,31 @@ static void PicTest_SelectPokemon(void) static void PicTest_SelectPersonality(void) { - if (gMain.newAndRepeatedKeys & DPAD_LEFT) + if (JOY_REPT(DPAD_LEFT)) { if (sPicTest_Personality != 0) sPicTest_Personality--; } - if (gMain.newAndRepeatedKeys & DPAD_RIGHT) + if (JOY_REPT(DPAD_RIGHT)) { if (sPicTest_Personality != UINT32_MAX) sPicTest_Personality++; } - if (gMain.newAndRepeatedKeys & L_BUTTON) + if (JOY_REPT(L_BUTTON)) { if (sPicTest_Personality >= 0x10) sPicTest_Personality -= 0x10; else sPicTest_Personality = 0; } - if (gMain.newAndRepeatedKeys & R_BUTTON) + if (JOY_REPT(R_BUTTON)) { if (sPicTest_Personality <= UINT32_MAX - 0x10) sPicTest_Personality += 0x10; else sPicTest_Personality = UINT32_MAX; } - if ((gMain.newKeys & (L_BUTTON | R_BUTTON)) == (L_BUTTON | R_BUTTON)) + if (JOY_NEW(L_BUTTON | R_BUTTON) == (L_BUTTON | R_BUTTON)) { sPicTest_Personality = UINT32_MAX; } @@ -4073,42 +4073,42 @@ static void PicTest_SelectPersonality(void) static void ContestPicTest_SelectContestType(void) { - if (gMain.newAndRepeatedKeys & DPAD_LEFT) + if (JOY_REPT(DPAD_LEFT)) { if (sPicTest_ContestType != CONTEST_COOL + 1) sPicTest_ContestType--; } - if (gMain.newAndRepeatedKeys & DPAD_RIGHT) + if (JOY_REPT(DPAD_RIGHT)) { if (sPicTest_ContestType != CONTEST_TOUGH + 1) sPicTest_ContestType++; } - if (gMain.newAndRepeatedKeys & L_BUTTON) + if (JOY_REPT(L_BUTTON)) sPicTest_ContestType = CONTEST_COOL + 1; - if (gMain.newAndRepeatedKeys & R_BUTTON) + if (JOY_REPT(R_BUTTON)) sPicTest_ContestType = CONTEST_TOUGH + 1; } static void MuseumArtPicTest_SelectTitleType(void) { - if (gMain.newAndRepeatedKeys & DPAD_LEFT) + if (JOY_REPT(DPAD_LEFT)) { if (sPicTest_MuseumArtTitleType != 1) sPicTest_MuseumArtTitleType--; } - if (gMain.newAndRepeatedKeys & DPAD_RIGHT) + if (JOY_REPT(DPAD_RIGHT)) { if (sPicTest_MuseumArtTitleType != 15) sPicTest_MuseumArtTitleType++; } - if (gMain.newAndRepeatedKeys & L_BUTTON) + if (JOY_REPT(L_BUTTON)) { if (sPicTest_MuseumArtTitleType >= 11) sPicTest_MuseumArtTitleType -= 10; else sPicTest_MuseumArtTitleType = 0; // Causes underflow when pressing left on the dpad shortly thereafter. } - if (gMain.newAndRepeatedKeys & R_BUTTON) + if (JOY_REPT(R_BUTTON)) { if (sPicTest_MuseumArtTitleType <= 5) sPicTest_MuseumArtTitleType += 10; @@ -4119,24 +4119,24 @@ static void MuseumArtPicTest_SelectTitleType(void) static void PreviewPicTest_SelectType(void) { - if (gMain.newAndRepeatedKeys & DPAD_LEFT) + if (JOY_REPT(DPAD_LEFT)) { if (sPicTest_PreviewType != 1) sPicTest_PreviewType--; } - if (gMain.newAndRepeatedKeys & DPAD_RIGHT) + if (JOY_REPT(DPAD_RIGHT)) { if (sPicTest_PreviewType != 15) sPicTest_PreviewType++; } - if (gMain.newAndRepeatedKeys & L_BUTTON) + if (JOY_REPT(L_BUTTON)) { if (sPicTest_PreviewType >= 11) sPicTest_PreviewType -= 10; else sPicTest_PreviewType = 0; // Causes underflow when pressing left on the dpad shortly thereafter. } - if (gMain.newAndRepeatedKeys & R_BUTTON) + if (JOY_REPT(R_BUTTON)) { if (sPicTest_PreviewType <= 5) sPicTest_PreviewType += 10; diff --git a/src/debug/watanabe_debug_menu.c b/src/debug/watanabe_debug_menu.c index aefd85bb2..df8b1eec0 100644 --- a/src/debug/watanabe_debug_menu.c +++ b/src/debug/watanabe_debug_menu.c @@ -809,23 +809,23 @@ NAKED void debug_80C3A50(u8 taskId) void debug_80C3D2C(u8 taskId) { - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB(0, 0, 0)); SetMainCallback2(debug_80C370C); gTasks[taskId].func = debug_80C373C; } - else if (gMain.newKeys & A_BUTTON) + else if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); gTasks[taskId].data[8] ^= 1; } - else if (gMain.newAndRepeatedKeys & DPAD_LEFT) + else if (JOY_REPT(DPAD_LEFT)) { if (gTasks[taskId].data[8]) { - if (gMain.heldKeys & R_BUTTON) + if (JOY_HELD(R_BUTTON)) gTasks[taskId].data[6] += 16; else gTasks[taskId].data[6] += 1; @@ -834,7 +834,7 @@ void debug_80C3D2C(u8 taskId) } else { - if (gMain.heldKeys & R_BUTTON) + if (JOY_HELD(R_BUTTON)) gTasks[taskId].data[7] += 16; else gTasks[taskId].data[7] += 1; @@ -842,11 +842,11 @@ void debug_80C3D2C(u8 taskId) gTasks[taskId].data[7] = 0x8000; } } - else if (gMain.newAndRepeatedKeys & DPAD_RIGHT) + else if (JOY_REPT(DPAD_RIGHT)) { if (gTasks[taskId].data[8]) { - if (gMain.heldKeys & R_BUTTON) + if (JOY_HELD(R_BUTTON)) gTasks[taskId].data[6] -= 16; else gTasks[taskId].data[6] -= 1; @@ -855,7 +855,7 @@ void debug_80C3D2C(u8 taskId) } else { - if (gMain.heldKeys & R_BUTTON) + if (JOY_HELD(R_BUTTON)) gTasks[taskId].data[7] -= 16; else gTasks[taskId].data[7] -= 1; @@ -863,7 +863,7 @@ void debug_80C3D2C(u8 taskId) gTasks[taskId].data[7] = 0x100; } } - else if (gMain.newAndRepeatedKeys & DPAD_UP) + else if (JOY_REPT(DPAD_UP)) { if (gTasks[taskId].data[8]) { @@ -874,7 +874,7 @@ void debug_80C3D2C(u8 taskId) gTasks[taskId].data[5]--; } } - else if (gMain.newAndRepeatedKeys & DPAD_DOWN) + else if (JOY_REPT(DPAD_DOWN)) { if (gTasks[taskId].data[8]) { @@ -885,7 +885,7 @@ void debug_80C3D2C(u8 taskId) gTasks[taskId].data[5]++; } } - else if (gMain.newAndRepeatedKeys & START_BUTTON) + else if (JOY_REPT(START_BUTTON)) { if (gTasks[taskId].data[0] < 0x182) gTasks[taskId].data[0]++; @@ -895,7 +895,7 @@ void debug_80C3D2C(u8 taskId) DestroySprite(gSprites + gTasks[taskId].data[3]); gTasks[taskId].func = debug_80C3A50; } - else if (gMain.newAndRepeatedKeys & SELECT_BUTTON) + else if (JOY_REPT(SELECT_BUTTON)) { if (gTasks[taskId].data[0] > 1) gTasks[taskId].data[0]--; @@ -1133,17 +1133,17 @@ void debug_80C4348(u8 taskId) void debug_80C43A8(u8 taskId) { - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); debug_sub_80A433C(gPlayerParty + gUnknown_Debug_2038A0C[1], debug_80C41D4); DestroyTask(taskId); } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { gTasks[taskId].func = debug_80C4F48; } - else if (gMain.newKeys & START_BUTTON) + else if (JOY_NEW(START_BUTTON)) { if (debug_80C4774()) { @@ -1153,17 +1153,17 @@ void debug_80C43A8(u8 taskId) gTasks[taskId].func = debug_80C4D14; } } - else if (gMain.newKeys & (R_BUTTON | DPAD_RIGHT)) + else if (JOY_NEW(R_BUTTON | DPAD_RIGHT)) { debug_80C38E4(0, 1, 1, 14, 0); gTasks[taskId].func = debug_80C44EC; } - else if (gMain.newAndRepeatedKeys & DPAD_UP && gUnknown_Debug_2038A0C[1] != 0) + else if (JOY_REPT(DPAD_UP) && gUnknown_Debug_2038A0C[1] != 0) { gUnknown_Debug_2038A0C[1]--; gTasks[taskId].func = debug_80C4348; } - else if (gMain.newAndRepeatedKeys & DPAD_DOWN && gUnknown_Debug_2038A0C[1] < 5 && GetMonData(gPlayerParty + gUnknown_Debug_2038A0C[1], MON_DATA_SPECIES) != SPECIES_NONE) + else if (JOY_REPT(DPAD_DOWN) && gUnknown_Debug_2038A0C[1] < 5 && GetMonData(gPlayerParty + gUnknown_Debug_2038A0C[1], MON_DATA_SPECIES) != SPECIES_NONE) { gUnknown_Debug_2038A0C[1]++; gTasks[taskId].func = debug_80C4348; @@ -1180,17 +1180,17 @@ void debug_80C44EC(u8 taskId) void debug_80C4550(u8 taskId) { - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); debug_sub_80A433C(gEnemyParty + gUnknown_Debug_2038A0C[2], debug_80C41F4); DestroyTask(taskId); } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { gTasks[taskId].func = debug_80C4F48; } - else if (gMain.newKeys & START_BUTTON) + else if (JOY_NEW(START_BUTTON)) { if (debug_80C4774()) { @@ -1200,17 +1200,17 @@ void debug_80C4550(u8 taskId) gTasks[taskId].func = debug_80C4D14; } } - else if (gMain.newKeys & (L_BUTTON | DPAD_LEFT)) + else if (JOY_NEW(L_BUTTON | DPAD_LEFT)) { debug_80C38E4(0, 16, 1, 14, 0); gTasks[taskId].func = debug_80C4348; } - else if (gMain.newAndRepeatedKeys & DPAD_UP && gUnknown_Debug_2038A0C[2] != 0) + else if (JOY_REPT(DPAD_UP) && gUnknown_Debug_2038A0C[2] != 0) { gUnknown_Debug_2038A0C[2]--; gTasks[taskId].func = debug_80C44EC; } - else if (gMain.newAndRepeatedKeys & DPAD_DOWN && gUnknown_Debug_2038A0C[2] < 5 && GetMonData(gEnemyParty + gUnknown_Debug_2038A0C[2], MON_DATA_SPECIES) != SPECIES_NONE) + else if (JOY_REPT(DPAD_DOWN) && gUnknown_Debug_2038A0C[2] < 5 && GetMonData(gEnemyParty + gUnknown_Debug_2038A0C[2], MON_DATA_SPECIES) != SPECIES_NONE) { gUnknown_Debug_2038A0C[2]++; gTasks[taskId].func = debug_80C44EC; @@ -1291,7 +1291,7 @@ void debug_80C48A0(u8 taskId) void debug_80C4900(u8 taskId) { - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB(0, 0, 0)); @@ -1302,7 +1302,7 @@ void debug_80C4900(u8 taskId) gUnknown_02023A14_50 = 0; gTasks[taskId].func = debug_80C373C; } - else if (gMain.newKeys & START_BUTTON || gMain.newKeys & A_BUTTON) + else if (JOY_NEW(START_BUTTON) || JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); gBattleTypeFlags = gUnknown_Debug_083F8068[gUnknown_Debug_2038A0C[3]].data.type1[0]; @@ -1318,12 +1318,12 @@ void debug_80C4900(u8 taskId) gTasks[taskId].func = debug_80C4F48; } } - else if (gMain.newAndRepeatedKeys & DPAD_UP && gUnknown_Debug_2038A0C[3] > 0) + else if (JOY_REPT(DPAD_UP) && gUnknown_Debug_2038A0C[3] > 0) { gUnknown_Debug_2038A0C[3]--; gTasks[taskId].func = debug_80C48A0; } - else if (gMain.newAndRepeatedKeys & DPAD_DOWN && gUnknown_Debug_2038A0C[3] < 2) + else if (JOY_REPT(DPAD_DOWN) && gUnknown_Debug_2038A0C[3] < 2) { gUnknown_Debug_2038A0C[3]++; gTasks[taskId].func = debug_80C48A0; @@ -1342,7 +1342,7 @@ void debug_80C4AC4(u8 taskId) { u8 r1 = gUnknown_Debug_2038A0C[4] + gUnknown_Debug_2038A0C[5]; - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { u32 mask = gUnknown_Debug_083F80D8[r1].data.type2; if (byte_3005E30 & mask) @@ -1352,12 +1352,12 @@ void debug_80C4AC4(u8 taskId) debug_80C4C44(gUnknown_Debug_2038A0C[4]); gTasks[taskId].func = debug_80C4A60; } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { debug_80C38E4(0, 16, 1, 14, 0); gTasks[taskId].func = debug_80C48A0; } - else if (gMain.newKeys & START_BUTTON) + else if (JOY_NEW(START_BUTTON)) { PlaySE(SE_SELECT); gTrainerBattleOpponent = SECRET_BASE_OPPONENT; @@ -1370,7 +1370,7 @@ void debug_80C4AC4(u8 taskId) eWatanabe17000.contestant = 0; gTasks[taskId].func = debug_80C4F48; } - else if (gMain.newAndRepeatedKeys & DPAD_UP) + else if (JOY_REPT(DPAD_UP)) { if (gUnknown_Debug_2038A0C[5] > 0) gUnknown_Debug_2038A0C[5]--; @@ -1381,7 +1381,7 @@ void debug_80C4AC4(u8 taskId) } gTasks[taskId].func = debug_80C4A60; } - else if (gMain.newAndRepeatedKeys & DPAD_DOWN && gUnknown_Debug_2038A0C[5] < 9) + else if (JOY_REPT(DPAD_DOWN) && gUnknown_Debug_2038A0C[5] < 9) { if (gUnknown_Debug_2038A0C[5] < 5) gUnknown_Debug_2038A0C[5]++; @@ -1453,17 +1453,17 @@ void debug_80C4DB8(u8 taskId) void debug_80C4E18(u8 taskId) { u8 r6 = gUnknown_Debug_2038A0C[6] + gUnknown_Debug_2038A0C[7]; - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { gTasks[taskId].func = debug_80C42B8; } - else if (gMain.newKeys & START_BUTTON || gMain.newKeys & A_BUTTON) + else if (JOY_NEW(START_BUTTON) || JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); gBattleTerrain = gUnknown_Debug_083F814C[r6].data.type3; gTasks[taskId].func = debug_80C5158; } - else if (gMain.newAndRepeatedKeys & DPAD_UP) + else if (JOY_REPT(DPAD_UP)) { if (gUnknown_Debug_2038A0C[7] > 0) gUnknown_Debug_2038A0C[7]--; @@ -1474,7 +1474,7 @@ void debug_80C4E18(u8 taskId) } gTasks[taskId].func = debug_80C4DB8; } - else if (gMain.newAndRepeatedKeys & DPAD_DOWN && gUnknown_Debug_2038A0C[7] < 8) + else if (JOY_REPT(DPAD_DOWN) && gUnknown_Debug_2038A0C[7] < 8) { if (gUnknown_Debug_2038A0C[7] < 5) gUnknown_Debug_2038A0C[7]++; @@ -1533,22 +1533,22 @@ void debug_80C5038(u8 taskId) void debug_80C5098(u8 taskId) { - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { gTasks[taskId].func = debug_80C47BC; } - else if (gMain.newKeys & START_BUTTON || gMain.newKeys & A_BUTTON) + else if (JOY_NEW(START_BUTTON) || JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); gSaveBlock2.playerGender = gUnknown_Debug_2038A0C[8]; gTasks[taskId].func = debug_80C42B8; } - else if (gMain.newAndRepeatedKeys & DPAD_UP && gUnknown_Debug_2038A0C[8] > 0) + else if (JOY_REPT(DPAD_UP) && gUnknown_Debug_2038A0C[8] > 0) { gUnknown_Debug_2038A0C[8]--; gTasks[taskId].func = debug_80C5038; } - else if (gMain.newAndRepeatedKeys & DPAD_DOWN && gUnknown_Debug_2038A0C[8] < 1) + else if (JOY_REPT(DPAD_DOWN) && gUnknown_Debug_2038A0C[8] < 1) { gUnknown_Debug_2038A0C[8]++; gTasks[taskId].func = debug_80C5038; @@ -1892,20 +1892,20 @@ void debug_80C53C0(u8 taskId) void debug_80C53F0(u8 taskId) { - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { gUnknown_Debug_2038A1C->unk164 = gUnknown_Debug_2038A1C->unk64[gUnknown_Debug_083F8698[gUnknown_Debug_2038A1C->unk168].text[gUnknown_Debug_2038A1C->unk169]]; gUnknown_Debug_2038A1C->unk16a = 0; debug_80C643C(); gTasks[taskId].func = debug_80C55E4; } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB(0, 0, 0)); SetMainCallback2(debug_80C370C); gTasks[taskId].func = debug_80C373C; } - else if (gMain.newKeys & START_BUTTON) + else if (JOY_NEW(START_BUTTON)) { bool8 r4; PlaySE(SE_SELECT); @@ -1918,28 +1918,28 @@ void debug_80C53F0(u8 taskId) Menu_PrintText(gUnknown_Debug_083F8720, 4, 9); gTasks[taskId].func = debug_80C5708; } - else if (gMain.newKeys & SELECT_BUTTON) + else if (JOY_NEW(SELECT_BUTTON)) { u32 r4 = gUnknown_Debug_2038A1C->unk64[0]; GetSetPokedexFlag(r4, 2); GetSetPokedexFlag(r4, 3); PlaySE(SE_SELECT); } - else if (gMain.newKeys & DPAD_UP) + else if (JOY_NEW(DPAD_UP)) { debug_80C627C(2); } - else if (gMain.newKeys & DPAD_DOWN) + else if (JOY_NEW(DPAD_DOWN)) { debug_80C627C(1); } - else if (gMain.newKeys & L_BUTTON && gUnknown_Debug_2038A1C->unk168 > 0) + else if (JOY_NEW(L_BUTTON) && gUnknown_Debug_2038A1C->unk168 > 0) { gUnknown_Debug_2038A1C->unk168--; gUnknown_Debug_2038A1C->unk169 = 0; gTasks[taskId].func = debug_80C53C0; } - else if (gMain.newKeys & R_BUTTON && gUnknown_Debug_2038A1C->unk168 < 5) + else if (JOY_NEW(R_BUTTON) && gUnknown_Debug_2038A1C->unk168 < 5) { gUnknown_Debug_2038A1C->unk168++; gUnknown_Debug_2038A1C->unk169 = 0; @@ -1950,33 +1950,33 @@ void debug_80C53F0(u8 taskId) void debug_80C55E4(u8 taskId) { u8 r7 = gUnknown_Debug_083F8698[gUnknown_Debug_2038A1C->unk168].text[gUnknown_Debug_2038A1C->unk169]; - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { gTasks[taskId].func = debug_80C53C0; } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { gUnknown_Debug_2038A1C->unk64[r7] = gUnknown_Debug_2038A1C->unk164; gTasks[taskId].func = debug_80C53C0; } - else if (gMain.newAndRepeatedKeys & DPAD_UP) + else if (JOY_REPT(DPAD_UP)) { debug_80C6544(1); debug_80C643C(); } - else if (gMain.newAndRepeatedKeys & DPAD_DOWN) + else if (JOY_REPT(DPAD_DOWN)) { debug_80C6544(2); debug_80C643C(); } else if (gUnknown_Debug_083F8554[r7].data.type4->unk9 != 0xFF) { - if (gMain.newKeys & DPAD_LEFT && gUnknown_Debug_2038A1C->unk16a < gUnknown_Debug_083F8554[r7].data.type4->unk9 - 1) + if (JOY_NEW(DPAD_LEFT) && gUnknown_Debug_2038A1C->unk16a < gUnknown_Debug_083F8554[r7].data.type4->unk9 - 1) { gUnknown_Debug_2038A1C->unk16a++; debug_80C643C(); } - else if (gMain.newKeys & DPAD_RIGHT && gUnknown_Debug_2038A1C->unk16a > 0) + else if (JOY_NEW(DPAD_RIGHT) && gUnknown_Debug_2038A1C->unk16a > 0) { gUnknown_Debug_2038A1C->unk16a--; debug_80C643C(); @@ -1986,7 +1986,7 @@ void debug_80C55E4(u8 taskId) void debug_80C5708(u8 taskId) { - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { gTasks[taskId].func = debug_80C53C0; } @@ -2725,45 +2725,45 @@ void debug_80C6EE8(u8 taskId) #ifdef NONMATCHING void debug_80C6FA8(u8 taskId) { - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB(0, 0, 0)); SetMainCallback2(debug_80C370C); gTasks[taskId].func = debug_80C373C; } - else if (gMain.newAndRepeatedKeys & R_BUTTON) + else if (JOY_REPT(R_BUTTON)) { gUnknown_Debug_2038A20->totalPoints = debug_80C3878(0, gUnknown_Debug_2038A20->totalPoints); gTasks[taskId].func = debug_80C71FC; } - else if (gMain.newAndRepeatedKeys & L_BUTTON) + else if (JOY_REPT(L_BUTTON)) { gUnknown_Debug_2038A20->totalPoints = debug_80C3878(1, gUnknown_Debug_2038A20->totalPoints); gTasks[taskId].func = debug_80C71FC; } - else if (gMain.newKeys & A_BUTTON) + else if (JOY_NEW(A_BUTTON)) { gUnknown_Debug_2038A20->contestant = 1; REG_WIN0H = 0x51EF; REG_WIN0V = 0x4167; gTasks[taskId].func = debug_80C7294; } - else if (gMain.newAndRepeatedKeys & DPAD_RIGHT && gUnknown_Debug_2038A20->unk7 < 14) + else if (JOY_REPT(DPAD_RIGHT) && gUnknown_Debug_2038A20->unk7 < 14) { ((u16 *)PLTT)[0x81 + gUnknown_Debug_2038A20->unk7] = 0; do; while(0); gUnknown_Debug_2038A20->unk7++; gTasks[taskId].func = debug_80C6EE8; } - else if (gMain.newAndRepeatedKeys & DPAD_LEFT && gUnknown_Debug_2038A20->unk7 > 0) + else if (JOY_REPT(DPAD_LEFT) && gUnknown_Debug_2038A20->unk7 > 0) { ((u16 *)PLTT)[0x81 + gUnknown_Debug_2038A20->unk7] = 0; do; while(0); gUnknown_Debug_2038A20->unk7--; gTasks[taskId].func = debug_80C6EE8; } - else if (gMain.newKeys & START_BUTTON) + else if (JOY_NEW(START_BUTTON)) { gUnknown_Debug_2038A20->unk9 ^= 1; if (gUnknown_Debug_2038A20->unk9) @@ -2776,7 +2776,7 @@ void debug_80C6FA8(u8 taskId) } else { - if (gMain.newKeys & SELECT_BUTTON) + if (JOY_NEW(SELECT_BUTTON)) { StopCryAndClearCrySongs(); PlayCry1(gUnknown_Debug_2038A20->totalPoints, 0); @@ -3098,14 +3098,14 @@ void debug_80C71FC(u8 taskId) void debug_80C7294(u8 taskId) { - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { gUnknown_Debug_2038A20->contestant = 0; REG_WIN0H = 0x51EF; REG_WIN0V = 0x699F; gTasks[taskId].func = debug_80C6EE8; } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { gUnknown_Debug_2038A20->contestant = 0; REG_WIN0H = 0x51EF; @@ -3116,15 +3116,15 @@ void debug_80C7294(u8 taskId) CpuCopy16(gUnknown_Debug_2038A20->personality2, gPlttBufferFaded + 0x100 + gUnknown_Debug_2038A20->unk6 * 16, 32); gTasks[taskId].func = debug_80C6EE8; } - else if (gMain.newAndRepeatedKeys & DPAD_DOWN && gUnknown_Debug_2038A20->unkA < 2) + else if (JOY_REPT(DPAD_DOWN) && gUnknown_Debug_2038A20->unkA < 2) { gUnknown_Debug_2038A20->unkA++; } - else if (gMain.newAndRepeatedKeys & DPAD_UP && gUnknown_Debug_2038A20->unkA > 0) + else if (JOY_REPT(DPAD_UP) && gUnknown_Debug_2038A20->unkA > 0) { gUnknown_Debug_2038A20->unkA--; } - else if (gMain.newAndRepeatedKeys & DPAD_RIGHT) + else if (JOY_REPT(DPAD_RIGHT)) { switch (gUnknown_Debug_2038A20->unkA) { @@ -3145,7 +3145,7 @@ void debug_80C7294(u8 taskId) break; } } - else if (gMain.newAndRepeatedKeys & DPAD_LEFT) + else if (JOY_REPT(DPAD_LEFT)) { switch (gUnknown_Debug_2038A20->unkA) { @@ -3333,45 +3333,45 @@ void debug_80C7A54(u8 taskId) #ifdef NONMATCHING void debug_80C7B14(u8 taskId) { - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB(0, 0, 0)); SetMainCallback2(debug_80C370C); gTasks[taskId].func = debug_80C373C; } - else if (gMain.newAndRepeatedKeys & R_BUTTON) + else if (JOY_REPT(R_BUTTON)) { gUnknown_Debug_2038A20->totalPoints = debug_80C38B4(0, gUnknown_Debug_2038A20->totalPoints); gTasks[taskId].func = debug_80C7D44; } - else if (gMain.newAndRepeatedKeys & L_BUTTON) + else if (JOY_REPT(L_BUTTON)) { gUnknown_Debug_2038A20->totalPoints = debug_80C38B4(1, gUnknown_Debug_2038A20->totalPoints); gTasks[taskId].func = debug_80C7D44; } - else if (gMain.newKeys & A_BUTTON) + else if (JOY_NEW(A_BUTTON)) { gUnknown_Debug_2038A20->contestant = 1; REG_WIN0H = 0x51EF; REG_WIN0V = 0x4167; gTasks[taskId].func = debug_80C7DDC; } - else if (gMain.newAndRepeatedKeys & DPAD_RIGHT && gUnknown_Debug_2038A20->unk7 < 14) + else if (JOY_REPT(DPAD_RIGHT) && gUnknown_Debug_2038A20->unk7 < 14) { ((u16 *)PLTT)[0x81 + gUnknown_Debug_2038A20->unk7] = 0; do; while (0); // this matches the asm here... gUnknown_Debug_2038A20->unk7++; gTasks[taskId].func = debug_80C7A54; } - else if (gMain.newAndRepeatedKeys & DPAD_LEFT && gUnknown_Debug_2038A20->unk7 > 0) + else if (JOY_REPT(DPAD_LEFT) && gUnknown_Debug_2038A20->unk7 > 0) { ((u16 *)PLTT)[0x81 + gUnknown_Debug_2038A20->unk7] = 0; do; while (0); // ... but not here gUnknown_Debug_2038A20->unk7--; gTasks[taskId].func = debug_80C7A54; } - else if (gMain.newKeys & START_BUTTON) + else if (JOY_NEW(START_BUTTON)) { gUnknown_Debug_2038A20->unk9 ^= 1; if (gUnknown_Debug_2038A20->unk9) @@ -3689,14 +3689,14 @@ void debug_80C7D44(u8 taskId) void debug_80C7DDC(u8 taskId) { - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { gUnknown_Debug_2038A20->contestant = 0; REG_WIN0H = 0x51EF; REG_WIN0V = 0x699F; gTasks[taskId].func = debug_80C7A54; } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { gUnknown_Debug_2038A20->contestant = 0; REG_WIN0H = 0x51EF; @@ -3707,15 +3707,15 @@ void debug_80C7DDC(u8 taskId) CpuCopy16(gUnknown_Debug_2038A20->personality2, gPlttBufferFaded + 0x100 + gUnknown_Debug_2038A20->unk6 * 16, 32); gTasks[taskId].func = debug_80C7A54; } - else if (gMain.newAndRepeatedKeys & DPAD_DOWN && gUnknown_Debug_2038A20->unkA < 2) + else if (JOY_REPT(DPAD_DOWN) && gUnknown_Debug_2038A20->unkA < 2) { gUnknown_Debug_2038A20->unkA++; } - else if (gMain.newAndRepeatedKeys & DPAD_UP && gUnknown_Debug_2038A20->unkA > 0) + else if (JOY_REPT(DPAD_UP) && gUnknown_Debug_2038A20->unkA > 0) { gUnknown_Debug_2038A20->unkA--; } - else if (gMain.newAndRepeatedKeys & DPAD_RIGHT) + else if (JOY_REPT(DPAD_RIGHT)) { switch (gUnknown_Debug_2038A20->unkA) { @@ -3736,7 +3736,7 @@ void debug_80C7DDC(u8 taskId) break; } } - else if (gMain.newAndRepeatedKeys & DPAD_LEFT) + else if (JOY_REPT(DPAD_LEFT)) { switch (gUnknown_Debug_2038A20->unkA) { diff --git a/src/decoration.c b/src/decoration.c index a957abf39..81d6b13dc 100644 --- a/src/decoration.c +++ b/src/decoration.c @@ -1486,23 +1486,23 @@ void Task_DecorationPCProcessMenuInput(u8 taskId) { if (!gPaletteFade.active) { - if (gMain.newKeys & DPAD_UP) + if (JOY_NEW(DPAD_UP)) { PlaySE(SE_SELECT); gUnknown_020388D4 = Menu_MoveCursor(-1); sub_80FE394(); } - if (gMain.newKeys & DPAD_DOWN) + if (JOY_NEW(DPAD_DOWN)) { PlaySE(SE_SELECT); gUnknown_020388D4 = Menu_MoveCursor(1); sub_80FE394(); } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); gUnknown_083EC604[gUnknown_020388D4].func(taskId); - } else if (gMain.newKeys & B_BUTTON) + } else if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); gpu_pal_decompress_alloc_tag_and_upload(taskId); @@ -1596,15 +1596,15 @@ void sub_80FE604(u8 taskId) { if (!gPaletteFade.active) { - if (gMain.newAndRepeatedKeys & DPAD_UP) + if (JOY_REPT(DPAD_UP)) { PlaySE(SE_SELECT); Menu_MoveCursor(-1); - } else if (gMain.newAndRepeatedKeys & DPAD_DOWN) + } else if (JOY_REPT(DPAD_DOWN)) { PlaySE(SE_SELECT); Menu_MoveCursor(1); - } else if (gMain.newKeys & A_BUTTON) + } else if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); gUnknown_020388F6 = Menu_GetCursorPos(); @@ -1630,7 +1630,7 @@ void sub_80FE604(u8 taskId) { sub_80FE728(taskId); } - } else if (gMain.newKeys & B_BUTTON) + } else if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); sub_80FE728(taskId); @@ -1737,7 +1737,7 @@ void sub_80FE948(u8 taskId) { if (!gPaletteFade.active) { - if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_UP) + if (JOY_REPT(DPAD_ANY) == DPAD_UP) { if (gUnknown_020388F2 != 0) { @@ -1747,7 +1747,7 @@ void sub_80FE948(u8 taskId) sub_80FE894(taskId, 0, -1); } } - if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_DOWN) + if (JOY_REPT(DPAD_ANY) == DPAD_DOWN) { if (gUnknown_020388F2 != gUnknown_020388F3) { @@ -1757,7 +1757,7 @@ void sub_80FE948(u8 taskId) sub_80FE894(taskId, 0, 1); } } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { Menu_DestroyCursor(); PlaySE(SE_SELECT); @@ -1769,7 +1769,7 @@ void sub_80FE948(u8 taskId) { gUnknown_083EC634[gTasks[taskId].data[11]].yesFunc(taskId); } - } else if (gMain.newKeys & B_BUTTON) + } else if (JOY_NEW(B_BUTTON)) { Menu_DestroyCursor(); PlaySE(SE_SELECT); @@ -1993,7 +1993,7 @@ bool8 sub_80FEFA4(void) void sub_80FEFF4(u8 taskId) { - if (gMain.newKeys & A_BUTTON || gMain.newKeys & B_BUTTON) + if (JOY_NEW(A_BUTTON) || JOY_NEW(B_BUTTON)) { LoadScrollIndicatorPalette(); gTasks[taskId].func = sub_80FE868; @@ -2688,7 +2688,7 @@ bool8 sub_810038C(u8 taskId) bool8 sub_8100430(void) { - if ((gMain.heldKeys & DPAD_ANY) != DPAD_UP && (gMain.heldKeys & DPAD_ANY) != DPAD_DOWN && (gMain.heldKeys & DPAD_ANY) != DPAD_LEFT && (gMain.heldKeys & DPAD_ANY) != DPAD_RIGHT) + if (JOY_HELD(DPAD_ANY) != DPAD_UP && JOY_HELD(DPAD_ANY) != DPAD_DOWN && JOY_HELD(DPAD_ANY) != DPAD_LEFT && JOY_HELD(DPAD_ANY) != DPAD_RIGHT) { return FALSE; } @@ -2715,28 +2715,28 @@ void sub_8100494(u8 taskId) gUnknown_083EC96C[gTasks[taskId].data[12]].noFunc(taskId); return; } - if ((gMain.heldKeys & DPAD_ANY) == DPAD_UP) + if (JOY_HELD(DPAD_ANY) == DPAD_UP) { gUnknown_020391AA = DIR_SOUTH; gSprites[gUnknown_020391A8].data[2] = 0; gSprites[gUnknown_020391A8].data[3] = -2; gTasks[taskId].data[1]--; } - if ((gMain.heldKeys & DPAD_ANY) == DPAD_DOWN) + if (JOY_HELD(DPAD_ANY) == DPAD_DOWN) { gUnknown_020391AA = DIR_NORTH; gSprites[gUnknown_020391A8].data[2] = 0; gSprites[gUnknown_020391A8].data[3] = 2; gTasks[taskId].data[1]++; } - if ((gMain.heldKeys & DPAD_ANY) == DPAD_LEFT) + if (JOY_HELD(DPAD_ANY) == DPAD_LEFT) { gUnknown_020391AA = DIR_WEST; gSprites[gUnknown_020391A8].data[2] = -2; gSprites[gUnknown_020391A8].data[3] = 0; gTasks[taskId].data[0]--; } - if ((gMain.heldKeys & DPAD_ANY) == DPAD_RIGHT) + if (JOY_HELD(DPAD_ANY) == DPAD_RIGHT) { gUnknown_020391AA = DIR_EAST; gSprites[gUnknown_020391A8].data[2] = 2; @@ -2755,11 +2755,11 @@ void sub_8100494(u8 taskId) } if (!gTasks[taskId].data[10]) { - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { gTasks[taskId].data[10] = A_BUTTON; } - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { gTasks[taskId].data[10] = B_BUTTON; } @@ -2776,7 +2776,7 @@ void sub_810065C(u8 taskId) void sub_81006A8(u8 taskId) { - if ((gMain.newKeys & A_BUTTON) || (gMain.newKeys & B_BUTTON)) + if (JOY_NEW(A_BUTTON) || JOY_NEW(B_BUTTON)) { sub_810065C(taskId); } @@ -3288,7 +3288,7 @@ void sub_8101024(u8 taskId) void sub_81010F0(u8 taskId) { - if ((gMain.newKeys & A_BUTTON) || (gMain.newKeys & B_BUTTON)) + if (JOY_NEW(A_BUTTON) || JOY_NEW(B_BUTTON)) { sub_8100EEC(taskId); } diff --git a/src/diploma.c b/src/diploma.c index c92491cc6..cd5503f4f 100644 --- a/src/diploma.c +++ b/src/diploma.c @@ -107,7 +107,7 @@ static void Task_DiplomaFadeIn(u8 taskId) static void Task_DiplomaWaitForKeyPress(u8 taskId) { - if (gMain.newKeys & (A_BUTTON | B_BUTTON)) + if (JOY_NEW(A_BUTTON | B_BUTTON)) { BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB(0, 0, 0)); gTasks[taskId].func = Task_DiplomaFadeOut; diff --git a/src/easy_chat_1.c b/src/easy_chat_1.c index ba2fded16..b86a8417b 100644 --- a/src/easy_chat_1.c +++ b/src/easy_chat_1.c @@ -685,7 +685,7 @@ void sub_80E6AE4(void) gEasyChatStruct->unk87 = sub_80E75D8(); if (gEasyChatStruct->unk87) PlaySE(SE_SELECT); - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); if (gEasyChatStruct->unk86 == gEasyChatStruct->unk84) @@ -711,7 +711,7 @@ void sub_80E6AE4(void) return; } } - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { sub_80E682C(sub_80E6C84); } @@ -756,7 +756,7 @@ void sub_80E6BC0(void) sub_80E682C(sub_80E6AC4); break; case 100: - if (gMain.newKeys & (A_BUTTON | B_BUTTON)) + if (JOY_NEW(A_BUTTON | B_BUTTON)) sub_80E682C(sub_80E6AC4); break; } @@ -898,7 +898,7 @@ void sub_80E6D7C(void) } break; case 10: - if (gMain.newKeys & (A_BUTTON | B_BUTTON)) + if (JOY_NEW(A_BUTTON | B_BUTTON)) sub_80E682C(sub_80E6AC4); break; case 100: @@ -906,7 +906,7 @@ void sub_80E6D7C(void) gEasyChatStruct->unk24++; // fall through case 101: - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) gEasyChatStruct->unk24++; break; case 102: @@ -954,7 +954,7 @@ void sub_80E6FC8(void) { if (gEasyChatStruct->unk96) PlaySE(SE_SELECT); - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { if (gEasyChatStruct->unk1B7 != 0) { @@ -988,11 +988,11 @@ void sub_80E6FC8(void) } } } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { sub_80E682C(sub_80E7114); } - else if (gMain.newKeys & SELECT_BUTTON) + else if (JOY_NEW(SELECT_BUTTON)) { sub_80E682C(sub_80E718C); } @@ -1105,12 +1105,12 @@ void sub_80E7294(void) { if (gEasyChatStruct->unk1B9) PlaySE(SE_SELECT); - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); sub_80E682C(sub_80E7324); } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { sub_80E682C(sub_80E73D0); } @@ -1253,21 +1253,21 @@ bool8 sub_80E75D8(void) bool8 pressedUpDown = FALSE; u8 r0; - if (gMain.newKeys & START_BUTTON) + if (JOY_NEW(START_BUTTON)) { gEasyChatStruct->unk86 = gEasyChatStruct->unk84; gEasyChatStruct->unk85 = 2; return TRUE; } - if (gMain.newAndRepeatedKeys & DPAD_UP) + if (JOY_REPT(DPAD_UP)) { gEasyChatStruct->unk86--; if (gEasyChatStruct->unk86 < 0) gEasyChatStruct->unk86 = gEasyChatStruct->unk84; pressedUpDown = TRUE; } - else if (gMain.newAndRepeatedKeys & DPAD_DOWN) + else if (JOY_REPT(DPAD_DOWN)) { gEasyChatStruct->unk86++; if (gEasyChatStruct->unk86 > gEasyChatStruct->unk84) @@ -1300,7 +1300,7 @@ bool8 sub_80E75D8(void) } else { - if (gMain.newAndRepeatedKeys & DPAD_LEFT) + if (JOY_REPT(DPAD_LEFT)) { if (--gEasyChatStruct->unk85 < 0) { @@ -1318,7 +1318,7 @@ bool8 sub_80E75D8(void) } return TRUE; } - if (gMain.newAndRepeatedKeys & DPAD_RIGHT) + if (JOY_REPT(DPAD_RIGHT)) { if (gEasyChatStruct->unk86 == gEasyChatStruct->unk84) { @@ -1346,14 +1346,14 @@ bool8 sub_80E77C8(void) if (gEasyChatStruct->unk1B7 != 0) { - if (gMain.newAndRepeatedKeys & DPAD_UP) + if (JOY_REPT(DPAD_UP)) { gEasyChatStruct->unk1A8--; if (gEasyChatStruct->unk1A8 < 1) gEasyChatStruct->unk1A8 = 3; return TRUE; } - else if (gMain.newAndRepeatedKeys & DPAD_DOWN) + else if (JOY_REPT(DPAD_DOWN)) { gEasyChatStruct->unk1A8++; if (gEasyChatStruct->unk1A8 > 3) @@ -1367,14 +1367,14 @@ bool8 sub_80E77C8(void) { pressedUpDown = FALSE; - if (gMain.newAndRepeatedKeys & DPAD_UP) + if (JOY_REPT(DPAD_UP)) { gEasyChatStruct->unk1A8--; if (gEasyChatStruct->unk1A8 < 0) gEasyChatStruct->unk1A8 = 3; pressedUpDown = TRUE; } - else if (gMain.newAndRepeatedKeys & DPAD_DOWN) + else if (JOY_REPT(DPAD_DOWN)) { gEasyChatStruct->unk1A8++; if (gEasyChatStruct->unk1A8 > 3) @@ -1393,7 +1393,7 @@ bool8 sub_80E77C8(void) pressedUpDown = FALSE; gEasyChatStruct->unk1C0 = 0; - if (gMain.newAndRepeatedKeys & DPAD_UP) + if (JOY_REPT(DPAD_UP)) { if (gEasyChatStruct->unk1A8 == 0) return FALSE; @@ -1402,7 +1402,7 @@ bool8 sub_80E77C8(void) gEasyChatStruct->unk1C0 = -1; pressedUpDown = TRUE; } - else if (gMain.newAndRepeatedKeys & DPAD_DOWN) + else if (JOY_REPT(DPAD_DOWN)) { if (gEasyChatStruct->unk1A8 >= gEasyChatStruct->unk1B6 - 1) return FALSE; @@ -1424,7 +1424,7 @@ bool8 sub_80E77C8(void) } } - if (gMain.newAndRepeatedKeys & DPAD_LEFT) + if (JOY_REPT(DPAD_LEFT)) { if (gEasyChatStruct->unk1A9 != 0) gEasyChatStruct->unk1A9--; @@ -1432,7 +1432,7 @@ bool8 sub_80E77C8(void) gEasyChatStruct->unk1A9 = gEasyChatStruct->unk1AA[gEasyChatStruct->unk1A8]; pressedLeftRight = TRUE; } - else if (gMain.newAndRepeatedKeys & DPAD_RIGHT) + else if (JOY_REPT(DPAD_RIGHT)) { if (gEasyChatStruct->unk1B7 != 0 || gEasyChatStruct->unk1A9 == gEasyChatStruct->unk1AA[gEasyChatStruct->unk1A8]) @@ -1487,7 +1487,7 @@ bool8 sub_80E7B40(void) bool8 pressedUpDown = FALSE; gEasyChatStruct->unk1C0 = 0; - if (gMain.newAndRepeatedKeys & DPAD_UP) + if (JOY_REPT(DPAD_UP)) { if (gEasyChatStruct->unk99A4 == 0) return FALSE; @@ -1499,7 +1499,7 @@ bool8 sub_80E7B40(void) } pressedUpDown = TRUE; } - else if (gMain.newAndRepeatedKeys & DPAD_DOWN) + else if (JOY_REPT(DPAD_DOWN)) { if (gEasyChatStruct->unk99A4 >= gEasyChatStruct->unk9A28 - 1) return FALSE; @@ -1518,14 +1518,14 @@ bool8 sub_80E7B40(void) return TRUE; } - if (gMain.newAndRepeatedKeys & DPAD_LEFT) + if (JOY_REPT(DPAD_LEFT)) { gEasyChatStruct->unk99A5--; if (gEasyChatStruct->unk99A5 < 0) gEasyChatStruct->unk99A5 = gEasyChatStruct->unk99A6[gEasyChatStruct->unk99A4] - 1; return TRUE; } - else if (gMain.newAndRepeatedKeys & DPAD_RIGHT) + else if (JOY_REPT(DPAD_RIGHT)) { gEasyChatStruct->unk99A5++; if (gEasyChatStruct->unk99A5 >= gEasyChatStruct->unk99A6[gEasyChatStruct->unk99A4]) @@ -1533,7 +1533,7 @@ bool8 sub_80E7B40(void) return TRUE; } - if (gMain.newKeys & START_BUTTON) + if (JOY_NEW(START_BUTTON)) { if (gEasyChatStruct->unk9A29 != 0) { @@ -1544,7 +1544,7 @@ bool8 sub_80E7B40(void) gEasyChatStruct->unk99A4 += gEasyChatStruct->unk1C0; gEasyChatStruct->unk1BE = 4; } - else if (gMain.newKeys & SELECT_BUTTON) + else if (JOY_NEW(SELECT_BUTTON)) { if (gEasyChatStruct->unk9A29 < gEasyChatStruct->unk9A28 - 4) { diff --git a/src/event_object_lock.c b/src/event_object_lock.c index 26f90f813..b5b14b2a0 100644 --- a/src/event_object_lock.c +++ b/src/event_object_lock.c @@ -4,6 +4,7 @@ #include "field_player_avatar.h" #include "script_movement.h" #include "task.h" +#include "constants/event_objects.h" extern u16 gSpecialVar_Facing; u8 gSelectedObjectEvent; @@ -89,7 +90,7 @@ void LockSelectedObjectEvent(void) void ScriptUnfreezeObjectEvents(void) { - u8 playerObjectId = GetObjectEventIdByLocalIdAndMap(0xFF, 0, 0); + u8 playerObjectId = GetObjectEventIdByLocalIdAndMap(LOCALID_PLAYER, 0, 0); ObjectEventClearHeldMovementIfFinished(&gObjectEvents[playerObjectId]); sub_80A2178(); UnfreezeObjectEvents(); @@ -101,7 +102,7 @@ void unref_sub_8064E5C(void) if (gObjectEvents[gSelectedObjectEvent].active) ObjectEventClearHeldMovementIfFinished(&gObjectEvents[gSelectedObjectEvent]); - playerObjectId = GetObjectEventIdByLocalIdAndMap(0xFF, 0, 0); + playerObjectId = GetObjectEventIdByLocalIdAndMap(LOCALID_PLAYER, 0, 0); ObjectEventClearHeldMovementIfFinished(&gObjectEvents[playerObjectId]); sub_80A2178(); UnfreezeObjectEvents(); diff --git a/src/event_object_movement.c b/src/event_object_movement.c index f168a191b..bb8c100f4 100644 --- a/src/event_object_movement.c +++ b/src/event_object_movement.c @@ -1039,9 +1039,9 @@ u8 gUnknown_Debug_03004BC0; static void ClearObjectEvent(struct ObjectEvent *objectEvent) { memset(objectEvent, 0, sizeof(struct ObjectEvent)); - objectEvent->localId = 0xFF; - objectEvent->mapNum = 0xFF; - objectEvent->mapGroup = 0xFF; + objectEvent->localId = LOCALID_PLAYER; + objectEvent->mapNum = MAP_NUM(MAP_UNDEFINED); + objectEvent->mapGroup = MAP_GROUP(MAP_UNDEFINED); objectEvent->movementActionId = 0xFF; } @@ -1098,7 +1098,7 @@ u8 GetFirstInactiveObjectEventId(void) u8 GetObjectEventIdByLocalIdAndMap(u8 localId, u8 mapNum, u8 mapGroup) { - if (localId < 0xFF) + if (localId < LOCALID_PLAYER) return GetObjectEventIdByLocalIdAndMapInternal(localId, mapNum, mapGroup); else return GetObjectEventIdByLocalId(localId); @@ -6029,7 +6029,7 @@ bool8 MovementAction_FacePlayer_Step0(struct ObjectEvent *objectEvent, struct Sp { u8 playerObjectId; - if (!TryGetObjectEventIdByLocalIdAndMap(0xFF, 0, 0, &playerObjectId)) + if (!TryGetObjectEventIdByLocalIdAndMap(LOCALID_PLAYER, 0, 0, &playerObjectId)) { FaceDirection(objectEvent, sprite, GetDirectionToFace(objectEvent->currentCoords.x, objectEvent->currentCoords.y, gObjectEvents[playerObjectId].currentCoords.x, gObjectEvents[playerObjectId].currentCoords.y)); } @@ -6041,7 +6041,7 @@ bool8 MovementAction_FaceAwayPlayer_Step0(struct ObjectEvent *objectEvent, struc { u8 playerObjectId; - if (!TryGetObjectEventIdByLocalIdAndMap(0xFF, 0, 0, &playerObjectId)) + if (!TryGetObjectEventIdByLocalIdAndMap(LOCALID_PLAYER, 0, 0, &playerObjectId)) { FaceDirection(objectEvent, sprite, GetOppositeDirection(GetDirectionToFace(objectEvent->currentCoords.x, objectEvent->currentCoords.y, gObjectEvents[playerObjectId].currentCoords.x, gObjectEvents[playerObjectId].currentCoords.y))); } diff --git a/src/evolution_scene.c b/src/evolution_scene.c index ac30d2c3f..405ab9fe4 100644 --- a/src/evolution_scene.c +++ b/src/evolution_scene.c @@ -767,21 +767,21 @@ static void Task_EvolutionScene(u8 taskID) } break; case 4: - if (gMain.newKeys & DPAD_UP && sEvoCursorPos != 0) + if (JOY_NEW(DPAD_UP) && sEvoCursorPos != 0) { PlaySE(SE_SELECT); nullsub_6(); sEvoCursorPos = 0; sub_802BC6C(); } - if (gMain.newKeys & DPAD_DOWN && sEvoCursorPos == 0) + if (JOY_NEW(DPAD_DOWN) && sEvoCursorPos == 0) { PlaySE(SE_SELECT); nullsub_6(); sEvoCursorPos = 1; sub_802BC6C(); } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { sub_8023AD8(); BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[292]); @@ -796,7 +796,7 @@ static void Task_EvolutionScene(u8 taskID) BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB(0, 0, 0)); } } - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { sub_8023AD8(); BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[292]); @@ -1121,21 +1121,21 @@ static void Task_TradeEvolutionScene(u8 taskID) } break; case 4: - if (gMain.newKeys & DPAD_UP && sEvoCursorPos != 0) + if (JOY_NEW(DPAD_UP) && sEvoCursorPos != 0) { PlaySE(SE_SELECT); EvoDummyFunc2(); sEvoCursorPos = 0; sub_81150D8(); } - if (gMain.newKeys & DPAD_DOWN && sEvoCursorPos == 0) + if (JOY_NEW(DPAD_DOWN) && sEvoCursorPos == 0) { PlaySE(SE_SELECT); EvoDummyFunc2(); sEvoCursorPos = 1; sub_81150D8(); } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { Text_EraseWindowRect(&gUnknown_03004828->window, 0x18, 8, 0x1D, 0xD); DestroyMenuCursor(); @@ -1155,7 +1155,7 @@ static void Task_TradeEvolutionScene(u8 taskID) BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB(0, 0, 0)); } } - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { Text_EraseWindowRect(&gUnknown_03004828->window, 0x18, 8, 0x1D, 0xD); DestroyMenuCursor(); diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index a62abfa7c..f4890c503 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -25,6 +25,7 @@ #include "constants/vars.h" #include "wild_encounter.h" #include "constants/event_bg.h" +#include "constants/event_objects.h" #include "constants/map_types.h" #include "constants/maps.h" @@ -358,7 +359,7 @@ const u8 *GetInteractedLinkPlayerScript(struct MapPosition *position, u8 metatil else objectEventId = GetObjectEventIdByXYZ(position->x + gDirectionToVectors[direction].x, position->y + gDirectionToVectors[direction].y, position->height); - if (objectEventId == 16 || gObjectEvents[objectEventId].localId == 0xFF) + if (objectEventId == 16 || gObjectEvents[objectEventId].localId == LOCALID_PLAYER) return NULL; for (i = 0; i < 4; i++) @@ -379,14 +380,14 @@ static const u8 *GetInteractedObjectEventScript(struct MapPosition *position, u8 const u8 *script; objectEventId = GetObjectEventIdByXYZ(position->x, position->y, position->height); - if (objectEventId == 16 || gObjectEvents[objectEventId].localId == 0xFF) + if (objectEventId == 16 || gObjectEvents[objectEventId].localId == LOCALID_PLAYER) { if (MetatileBehavior_IsCounter(metatileBehavior) != TRUE) return NULL; // Look for an object event on the other side of the counter. objectEventId = GetObjectEventIdByXYZ(position->x + gDirectionToVectors[direction].x, position->y + gDirectionToVectors[direction].y, position->height); - if (objectEventId == 16 || gObjectEvents[objectEventId].localId == 0xFF) + if (objectEventId == 16 || gObjectEvents[objectEventId].localId == LOCALID_PLAYER) return NULL; } @@ -766,7 +767,7 @@ static void sub_8068C30(struct MapHeader *unused, s8 warpEventId, struct MapPosi { const struct WarpEvent *warpEvent = &gMapHeader.events->warps[warpEventId]; - if (warpEvent->mapNum == MAP_NUM(DYNAMIC)) + if (warpEvent->mapNum == MAP_NUM(MAP_DYNAMIC)) { copy_saved_warp2_bank_and_enter_x_to_warp1(warpEvent->warpId); } @@ -777,7 +778,7 @@ static void sub_8068C30(struct MapHeader *unused, s8 warpEventId, struct MapPosi warp1_set_2(warpEvent->mapGroup, warpEvent->mapNum, warpEvent->warpId); sub_80535C4(position->x, position->y); mapHeader = Overworld_GetMapHeaderByGroupAndId(warpEvent->mapGroup, warpEvent->mapNum); - if (mapHeader->events->warps[warpEvent->warpId].mapNum == MAP_NUM(DYNAMIC)) + if (mapHeader->events->warps[warpEvent->warpId].mapNum == MAP_NUM(MAP_DYNAMIC)) saved_warp2_set(mapHeader->events->warps[warpEventId].warpId, gSaveBlock1.location.mapGroup, gSaveBlock1.location.mapNum, warpEventId); } } diff --git a/src/field_fadetransition.c b/src/field_fadetransition.c index 5ca114f49..037b99a28 100644 --- a/src/field_fadetransition.c +++ b/src/field_fadetransition.c @@ -21,6 +21,7 @@ #include "task.h" #include "new_game.h" #include "constants/event_object_movement.h" +#include "constants/event_objects.h" #include "constants/songs.h" void sub_8080B9C(u8); @@ -232,7 +233,7 @@ void sub_8080B9C(u8 taskId) { u8 objEventId; sub_8080958(1); - objEventId = GetObjectEventIdByLocalIdAndMap(0xFF, 0, 0); + objEventId = GetObjectEventIdByLocalIdAndMap(LOCALID_PLAYER, 0, 0); ObjectEventSetHeldMovement(&gObjectEvents[objEventId], MOVEMENT_ACTION_WALK_NORMAL_DOWN); task->data[0] = 2; } @@ -242,7 +243,7 @@ void sub_8080B9C(u8 taskId) { u8 objEventId; task->data[1] = FieldAnimateDoorClose(*x, *y); - objEventId = GetObjectEventIdByLocalIdAndMap(0xFF, 0, 0); + objEventId = GetObjectEventIdByLocalIdAndMap(LOCALID_PLAYER, 0, 0); ObjectEventClearHeldMovementIfFinished(&gObjectEvents[objEventId]); task->data[0] = 3; } @@ -280,7 +281,7 @@ void task_map_chg_seq_0807E20C(u8 taskId) { u8 objEventId; sub_8080958(1); - objEventId = GetObjectEventIdByLocalIdAndMap(0xFF, 0, 0); + objEventId = GetObjectEventIdByLocalIdAndMap(LOCALID_PLAYER, 0, 0); ObjectEventSetHeldMovement(&gObjectEvents[objEventId], GetWalkNormalMovementAction(GetPlayerFacingDirection())); task->data[0] = 2; } @@ -572,9 +573,9 @@ void sub_808115C(u8 taskId) if (task->data[1] < 0 || gTasks[task->data[1]].isActive != TRUE) { u8 objEventId; - objEventId = GetObjectEventIdByLocalIdAndMap(0xFF, 0, 0); + objEventId = GetObjectEventIdByLocalIdAndMap(LOCALID_PLAYER, 0, 0); ObjectEventClearHeldMovementIfActive(&gObjectEvents[objEventId]); - objEventId = GetObjectEventIdByLocalIdAndMap(0xFF, 0, 0); + objEventId = GetObjectEventIdByLocalIdAndMap(LOCALID_PLAYER, 0, 0); ObjectEventSetHeldMovement(&gObjectEvents[objEventId], MOVEMENT_ACTION_WALK_NORMAL_UP); task->data[0] = 2; } @@ -584,7 +585,7 @@ void sub_808115C(u8 taskId) { u8 objEventId; task->data[1] = FieldAnimateDoorClose(*x, *y - 1); - objEventId = GetObjectEventIdByLocalIdAndMap(0xFF, 0, 0); + objEventId = GetObjectEventIdByLocalIdAndMap(LOCALID_PLAYER, 0, 0); ObjectEventClearHeldMovementIfFinished(&gObjectEvents[objEventId]); sub_8080958(0); task->data[0] = 3; diff --git a/src/field_player_avatar.c b/src/field_player_avatar.c index 97d38aa85..bbb2ad563 100644 --- a/src/field_player_avatar.c +++ b/src/field_player_avatar.c @@ -330,7 +330,7 @@ static void PlayerAllowForcedMovementIfMovingSameDirection(void) static bool8 TryDoMetatileBehaviorForcedMovement(void) { #if DEBUG - if (gUnknown_020297ED != 0 && (gMain.heldKeys & R_BUTTON)) + if (gUnknown_020297ED != 0 && JOY_HELD(R_BUTTON)) return 0; #endif return sForcedMovementFuncs[GetForcedMovementByMetatileBehavior()](); @@ -1182,7 +1182,7 @@ void InitPlayerAvatar(s16 x, s16 y, u8 direction, u8 gender) u8 objectEventId; struct ObjectEvent *objectEvent; - playerObjEventTemplate.localId = 0xFF; + playerObjEventTemplate.localId = LOCALID_PLAYER; playerObjEventTemplate.graphicsId = GetPlayerAvatarGraphicsIdByStateIdAndGender(PLAYER_AVATAR_STATE_NORMAL, gender); playerObjEventTemplate.x = x - 7; playerObjEventTemplate.y = y - 7; @@ -1586,7 +1586,7 @@ static bool8 Fishing5(struct Task *task) AlignFishingAnimationFrames(); task->tFrameCounter++; - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { task->tStep = FISHING_NO_BITE; if (task->tRoundsPlayed != 0) @@ -1646,7 +1646,7 @@ static bool8 Fishing8(struct Task *task) task->tFrameCounter++; if (task->tFrameCounter >= reelTimeouts[task->tFishingRod]) task->tStep = FISHING_GOT_AWAY; - else if (gMain.newKeys & A_BUTTON) + else if (JOY_NEW(A_BUTTON)) task->tStep++; return FALSE; } @@ -1826,7 +1826,7 @@ static void AlignFishingAnimationFrames(void) u8 debug_sub_805F2B0(u8 a) { - if (gMain.heldKeys & 0x100) + if (JOY_HELD(R_BUTTON)) return debug_sub_805F2DC(a); else return 0; diff --git a/src/field_special_scene.c b/src/field_special_scene.c index 03854a5ff..9d9e9d6d8 100644 --- a/src/field_special_scene.c +++ b/src/field_special_scene.c @@ -16,6 +16,7 @@ #include "sound.h" #include "sprite.h" #include "task.h" +#include "constants/event_objects.h" #define SECONDS(value) ((signed) (60.0 * value + 0.5)) @@ -99,11 +100,11 @@ void Task_Truck1(u8 taskId) s16 box1, box2, box3; box1 = GetTruckBoxMovement(data[0] + 30) * 4; // top box. - sub_805BD90(1, gSaveBlock1.location.mapNum, gSaveBlock1.location.mapGroup, 3 - cameraXpan, box1 + 3); + sub_805BD90(LOCALID_TRUCK_BOX_TOP, gSaveBlock1.location.mapNum, gSaveBlock1.location.mapGroup, 3 - cameraXpan, box1 + 3); box2 = GetTruckBoxMovement(data[0]) * 2; // bottom left box. - sub_805BD90(2, gSaveBlock1.location.mapNum, gSaveBlock1.location.mapGroup, -cameraXpan, box2 - 3); + sub_805BD90(LOCALID_TRUCK_BOX_BOTTOM_L, gSaveBlock1.location.mapNum, gSaveBlock1.location.mapGroup, -cameraXpan, box2 - 3); box3 = GetTruckBoxMovement(data[0]) * 4; // bottom right box. - sub_805BD90(3, gSaveBlock1.location.mapNum, gSaveBlock1.location.mapGroup, -3 - cameraXpan, box3); + sub_805BD90(LOCALID_TRUCK_BOX_BOTTOM_R, gSaveBlock1.location.mapNum, gSaveBlock1.location.mapGroup, -3 - cameraXpan, box3); if (++data[0] == SECONDS(500)) // this will never run data[0] = 0; // reset the timer if it gets stuck. @@ -141,11 +142,11 @@ void Task_Truck2(u8 taskId) cameraYpan = GetTruckCameraBobbingY(data[2]); SetCameraPanning(cameraXpan, cameraYpan); box1 = GetTruckBoxMovement(data[2] + 30) * 4; - sub_805BD90(1, gSaveBlock1.location.mapNum, gSaveBlock1.location.mapGroup, 3 - cameraXpan, box1 + 3); + sub_805BD90(LOCALID_TRUCK_BOX_TOP, gSaveBlock1.location.mapNum, gSaveBlock1.location.mapGroup, 3 - cameraXpan, box1 + 3); box2 = GetTruckBoxMovement(data[2]) * 2; - sub_805BD90(2, gSaveBlock1.location.mapNum, gSaveBlock1.location.mapGroup, -cameraXpan, box2 - 3); + sub_805BD90(LOCALID_TRUCK_BOX_BOTTOM_L, gSaveBlock1.location.mapNum, gSaveBlock1.location.mapGroup, -cameraXpan, box2 - 3); box3 = GetTruckBoxMovement(data[2]) * 4; - sub_805BD90(3, gSaveBlock1.location.mapNum, gSaveBlock1.location.mapGroup, -3 - cameraXpan, box3); + sub_805BD90(LOCALID_TRUCK_BOX_BOTTOM_R, gSaveBlock1.location.mapNum, gSaveBlock1.location.mapGroup, -3 - cameraXpan, box3); } } @@ -172,9 +173,9 @@ void Task_Truck3(u8 taskId) cameraXpan = gTruckCamera_HorizontalTable[data[1]]; cameraYpan = 0; SetCameraPanning(cameraXpan, cameraYpan); - sub_805BD90(1, gSaveBlock1.location.mapNum, gSaveBlock1.location.mapGroup, 3 - cameraXpan, cameraYpan + 3); - sub_805BD90(2, gSaveBlock1.location.mapNum, gSaveBlock1.location.mapGroup, -cameraXpan, cameraYpan - 3); - sub_805BD90(3, gSaveBlock1.location.mapNum, gSaveBlock1.location.mapGroup, -3 - cameraXpan, cameraYpan); + sub_805BD90(LOCALID_TRUCK_BOX_TOP, gSaveBlock1.location.mapNum, gSaveBlock1.location.mapGroup, 3 - cameraXpan, cameraYpan + 3); + sub_805BD90(LOCALID_TRUCK_BOX_BOTTOM_L, gSaveBlock1.location.mapNum, gSaveBlock1.location.mapGroup, -cameraXpan, cameraYpan - 3); + sub_805BD90(LOCALID_TRUCK_BOX_BOTTOM_R, gSaveBlock1.location.mapNum, gSaveBlock1.location.mapGroup, -3 - cameraXpan, cameraYpan); } } @@ -267,9 +268,9 @@ void EndTruckSequence(u8 taskId) { if (!FuncIsActiveTask(Task_HandleTruckSequence)) { - sub_805BD90(1, gSaveBlock1.location.mapNum, gSaveBlock1.location.mapGroup, 3, 3); - sub_805BD90(2, gSaveBlock1.location.mapNum, gSaveBlock1.location.mapGroup, 0, -3); - sub_805BD90(3, gSaveBlock1.location.mapNum, gSaveBlock1.location.mapGroup, -3, 0); + sub_805BD90(LOCALID_TRUCK_BOX_TOP, gSaveBlock1.location.mapNum, gSaveBlock1.location.mapGroup, 3, 3); + sub_805BD90(LOCALID_TRUCK_BOX_BOTTOM_L, gSaveBlock1.location.mapNum, gSaveBlock1.location.mapGroup, 0, -3); + sub_805BD90(LOCALID_TRUCK_BOX_BOTTOM_R, gSaveBlock1.location.mapNum, gSaveBlock1.location.mapGroup, -3, 0); } } @@ -305,9 +306,9 @@ void Task_HandlePorthole(u8 taskId) } break; case IDLE_CHECK: // idle and move. - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) data[1] = 1; - if (!ScriptMovement_IsObjectMovementFinished(0xFF, location->mapNum, location->mapGroup)) + if (!ScriptMovement_IsObjectMovementFinished(LOCALID_PLAYER, location->mapNum, location->mapGroup)) return; if (CountSSTidalStep(1) == TRUE) { @@ -328,12 +329,12 @@ void Task_HandlePorthole(u8 taskId) // run this once. if (*var == 2) // which direction? { - ScriptMovement_StartObjectMovementScript(0xFF, location->mapNum, location->mapGroup, gUnknown_083D295F); + ScriptMovement_StartObjectMovementScript(LOCALID_PLAYER, location->mapNum, location->mapGroup, gUnknown_083D295F); data[0] = IDLE_CHECK; // run case 1. } else { - ScriptMovement_StartObjectMovementScript(0xFF, location->mapNum, location->mapGroup, gUnknown_083D2961); + ScriptMovement_StartObjectMovementScript(LOCALID_PLAYER, location->mapNum, location->mapGroup, gUnknown_083D2961); data[0] = IDLE_CHECK; // run case 1. } break; diff --git a/src/field_specials.c b/src/field_specials.c index 6e5f5954c..c7e167c50 100644 --- a/src/field_specials.c +++ b/src/field_specials.c @@ -34,6 +34,7 @@ #include "random.h" #include "constants/abilities.h" #include "constants/event_object_movement.h" +#include "constants/event_objects.h" #include "constants/metatile_labels.h" #include "constants/moves.h" #include "constants/species.h" @@ -210,7 +211,7 @@ u16 GetRecordedCyclingRoadResults(void) { } void UpdateCyclingRoadState(void) { - if (gLastUsedWarp.mapNum == MAP_NUM(ROUTE110_SEASIDE_CYCLING_ROAD_NORTH_ENTRANCE) && gLastUsedWarp.mapGroup == MAP_GROUP(ROUTE110_SEASIDE_CYCLING_ROAD_NORTH_ENTRANCE)) + if (gLastUsedWarp.mapNum == MAP_NUM(MAP_ROUTE110_SEASIDE_CYCLING_ROAD_NORTH_ENTRANCE) && gLastUsedWarp.mapGroup == MAP_GROUP(MAP_ROUTE110_SEASIDE_CYCLING_ROAD_NORTH_ENTRANCE)) { return; } @@ -262,38 +263,38 @@ u8 GetSSTidalLocation(s8 *mapGroup, s8 *mapNum, s16 *x, s16 *y) case 2: if (*varCruiseStepCount < 60) { - *mapNum = MAP_NUM(ROUTE134); + *mapNum = MAP_NUM(MAP_ROUTE134); *x = *varCruiseStepCount + 19; } else if (*varCruiseStepCount < 140) { - *mapNum = MAP_NUM(ROUTE133); + *mapNum = MAP_NUM(MAP_ROUTE133); *x = *varCruiseStepCount - 60; } else { - *mapNum = MAP_NUM(ROUTE132); + *mapNum = MAP_NUM(MAP_ROUTE132); *x = *varCruiseStepCount - 140; } break; case 7: if (*varCruiseStepCount < 66) { - *mapNum = MAP_NUM(ROUTE132); + *mapNum = MAP_NUM(MAP_ROUTE132); *x = 65 - *varCruiseStepCount; } else if (*varCruiseStepCount < 146) { - *mapNum = MAP_NUM(ROUTE133); + *mapNum = MAP_NUM(MAP_ROUTE133); *x = 145 - *varCruiseStepCount; } else { - *mapNum = MAP_NUM(ROUTE134); + *mapNum = MAP_NUM(MAP_ROUTE134); *x = 224 - *varCruiseStepCount; } break; } - *mapGroup = MAP_GROUP(ROUTE132); + *mapGroup = MAP_GROUP(MAP_ROUTE132); *y = 20; return 0; } @@ -714,11 +715,11 @@ void CableCarWarp(void) { if (gSpecialVar_0x8004 != 0) { - Overworld_SetWarpDestination(MAP_GROUP(ROUTE112_CABLE_CAR_STATION), MAP_NUM(ROUTE112_CABLE_CAR_STATION), -1, 6, 4); + Overworld_SetWarpDestination(MAP_GROUP(MAP_ROUTE112_CABLE_CAR_STATION), MAP_NUM(MAP_ROUTE112_CABLE_CAR_STATION), -1, 6, 4); } else { - Overworld_SetWarpDestination(MAP_GROUP(MT_CHIMNEY_CABLE_CAR_STATION), MAP_NUM(MT_CHIMNEY_CABLE_CAR_STATION), -1, 6, 4); + Overworld_SetWarpDestination(MAP_GROUP(MAP_MT_CHIMNEY_CABLE_CAR_STATION), MAP_NUM(MAP_MT_CHIMNEY_CABLE_CAR_STATION), -1, 6, 4); } } @@ -1013,22 +1014,22 @@ void SetDepartmentStoreFloorVar(void) u8 deptStoreFloor; switch (gSaveBlock1.dynamicWarp.mapNum) { - case MAP_NUM(LILYCOVE_CITY_DEPARTMENT_STORE_1F): + case MAP_NUM(MAP_LILYCOVE_CITY_DEPARTMENT_STORE_1F): deptStoreFloor = 0; break; - case MAP_NUM(LILYCOVE_CITY_DEPARTMENT_STORE_2F): + case MAP_NUM(MAP_LILYCOVE_CITY_DEPARTMENT_STORE_2F): deptStoreFloor = 1; break; - case MAP_NUM(LILYCOVE_CITY_DEPARTMENT_STORE_3F): + case MAP_NUM(MAP_LILYCOVE_CITY_DEPARTMENT_STORE_3F): deptStoreFloor = 2; break; - case MAP_NUM(LILYCOVE_CITY_DEPARTMENT_STORE_4F): + case MAP_NUM(MAP_LILYCOVE_CITY_DEPARTMENT_STORE_4F): deptStoreFloor = 3; break; - case MAP_NUM(LILYCOVE_CITY_DEPARTMENT_STORE_5F): + case MAP_NUM(MAP_LILYCOVE_CITY_DEPARTMENT_STORE_5F): deptStoreFloor = 4; break; - case MAP_NUM(LILYCOVE_CITY_DEPARTMENT_STORE_ROOFTOP): + case MAP_NUM(MAP_LILYCOVE_CITY_DEPARTMENT_STORE_ROOFTOP): deptStoreFloor = 15; break; default: @@ -1119,7 +1120,7 @@ void sub_810E984(u8 taskId) Menu_MoveCursorNoWrap(+1); sub_810EAC8(curMenuPos, DPAD_DOWN); } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { saved_warp2_set_2(0, gUnknown_03000760[gUnknown_0203925B].var1, gUnknown_03000760[gUnknown_0203925B].var2, -1, 2, 1); if (gSpecialVar_0x8005 == gUnknown_0203925B) @@ -1140,7 +1141,7 @@ void sub_810E984(u8 taskId) DestroyTask(taskId); } } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { gSpecialVar_Result = 0; PlaySE(SE_SELECT); @@ -1488,7 +1489,7 @@ void sub_810F118(u8 taskId) Menu_MoveCursorNoWrap(1); sub_810F1F4(prevCursorPos, DPAD_DOWN); } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { Menu_DestroyCursor(); gSpecialVar_Result = gUnknown_0203925B; @@ -1497,7 +1498,7 @@ void sub_810F118(u8 taskId) Menu_EraseWindowRect(0, 0, 29, 12); sub_810EC9C(taskId); } - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { Menu_DestroyCursor(); gSpecialVar_Result = 0x7f; @@ -1595,7 +1596,7 @@ void GlassWorkshopUpdateScrollIndicators(u8 newPos, u8 maxItems) void SpawnCameraDummy(void) { - u8 objectEventId = SpawnSpecialObjectEventParametrized(7, MOVEMENT_TYPE_FACE_DOWN, 0x7f, gSaveBlock1.pos.x + 7, gSaveBlock1.pos.y + 7, 3); + u8 objectEventId = SpawnSpecialObjectEventParametrized(7, MOVEMENT_TYPE_FACE_DOWN, LOCALID_CAMERA, gSaveBlock1.pos.x + 7, gSaveBlock1.pos.y + 7, 3); gObjectEvents[objectEventId].invisible = TRUE; CameraObjectSetFollowedObjectId(gObjectEvents[objectEventId].spriteId); } @@ -1603,7 +1604,7 @@ void SpawnCameraDummy(void) void RemoveCameraDummy(void) { CameraObjectSetFollowedObjectId(GetPlayerAvatarObjectId()); - RemoveObjectEventByLocalIdAndMap(0x7f, gSaveBlock1.location.mapNum, gSaveBlock1.location.mapGroup); + RemoveObjectEventByLocalIdAndMap(LOCALID_CAMERA, gSaveBlock1.location.mapNum, gSaveBlock1.location.mapGroup); } u8 GetPokeblockNameByMonNature(void) @@ -1713,7 +1714,7 @@ bool8 ScrSpecial_AreLeadMonEVsMaxedOut(void) u8 TryUpdateRusturfTunnelState(void) { - if (!FlagGet(FLAG_RUSTURF_TUNNEL_OPENED) && gSaveBlock1.location.mapGroup == MAP_GROUP(RUSTURF_TUNNEL) && gSaveBlock1.location.mapNum == MAP_NUM(RUSTURF_TUNNEL)) + if (!FlagGet(FLAG_RUSTURF_TUNNEL_OPENED) && gSaveBlock1.location.mapGroup == MAP_GROUP(MAP_RUSTURF_TUNNEL) && gSaveBlock1.location.mapNum == MAP_NUM(MAP_RUSTURF_TUNNEL)) { if (FlagGet(FLAG_HIDE_RUSTURF_TUNNEL_ROCK_1)) { diff --git a/src/field_weather.c b/src/field_weather.c index c05fa3d3b..92cf4e550 100644 --- a/src/field_weather.c +++ b/src/field_weather.c @@ -1266,14 +1266,14 @@ bool8 debug_sub_8085564(void) { bool8 changed = FALSE; - if (gMain.newKeys & R_BUTTON) + if (JOY_NEW(R_BUTTON)) { sSelectedDebugWeather++; if (sSelectedDebugWeather == 15) sSelectedDebugWeather = 0; changed = TRUE; } - if (gMain.newKeys & L_BUTTON) + if (JOY_NEW(L_BUTTON)) { if (sSelectedDebugWeather != 0) sSelectedDebugWeather--; @@ -1288,7 +1288,7 @@ bool8 debug_sub_8085564(void) Menu_PrintText(sDebugText_Weather[sSelectedDebugWeather], 23, 1); } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { ChangeWeather(sSelectedDebugWeather); CloseMenu(); diff --git a/src/hall_of_fame.c b/src/hall_of_fame.c index 96012dc0e..50e969a04 100644 --- a/src/hall_of_fame.c +++ b/src/hall_of_fame.c @@ -737,7 +737,7 @@ static void sub_8142794(u8 taskID) static void sub_8142818(u8 taskID) { - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { FadeOutBGM(4); gTasks[taskID].func = sub_8142850; @@ -960,7 +960,7 @@ static void sub_8142CC8(u8 taskID) static void sub_8142DF4(u8 taskID) { u16 i; - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { if (gTasks[taskID].tCurrTeamNo != 0) // prepare another team to view { @@ -988,7 +988,7 @@ static void sub_8142DF4(u8 taskID) gTasks[taskID].func = sub_8142F78; } } - else if (gMain.newKeys & B_BUTTON) // turn off hall of fame PC + else if (JOY_NEW(B_BUTTON)) // turn off hall of fame PC { if (IsCryPlayingOrClearCrySongs()) { @@ -997,12 +997,12 @@ static void sub_8142DF4(u8 taskID) } gTasks[taskID].func = sub_8142F78; } - else if (gMain.newKeys & DPAD_UP && gTasks[taskID].tCurrPokeID != 0) // change poke -1 + else if (JOY_NEW(DPAD_UP) && gTasks[taskID].tCurrPokeID != 0) // change poke -1 { gTasks[taskID].tCurrPokeID--; gTasks[taskID].func = sub_8142CC8; } - else if (gMain.newKeys & DPAD_DOWN && gTasks[taskID].tCurrPokeID < gTasks[taskID].tPokesNo - 1) // change poke +1 + else if (JOY_NEW(DPAD_DOWN) && gTasks[taskID].tCurrPokeID < gTasks[taskID].tPokesNo - 1) // change poke +1 { gTasks[taskID].tCurrPokeID++; gTasks[taskID].func = sub_8142CC8; @@ -1035,7 +1035,7 @@ static void sub_8142FEC(u8 taskID) static void sub_814302C(u8 taskID) { - if (Menu_UpdateWindowText() && gMain.newKeys & A_BUTTON) + if (Menu_UpdateWindowText() && JOY_NEW(A_BUTTON)) gTasks[taskID].func = sub_8142F78; } diff --git a/src/heal_location.c b/src/heal_location.c index 5eda24d67..8e646b2d5 100644 --- a/src/heal_location.c +++ b/src/heal_location.c @@ -11,17 +11,17 @@ u32 GetHealLocationIndexByMap(u16 mapGroup, u16 mapNum) for (i = 0; i < ARRAY_COUNT(sHealLocations); i++) { - if (sHealLocations[i].group == mapGroup && sHealLocations[i].map == mapNum) + if (sHealLocations[i].mapGroup == mapGroup && sHealLocations[i].mapNum == mapNum) return i + 1; } - return 0; + return HEAL_LOCATION_NONE; } const struct HealLocation *GetHealLocationByMap(u16 mapGroup, u16 mapNum) { u32 index = GetHealLocationIndexByMap(mapGroup, mapNum); - if (index == 0) + if (index == HEAL_LOCATION_NONE) return NULL; else return &sHealLocations[index - 1]; @@ -29,7 +29,7 @@ const struct HealLocation *GetHealLocationByMap(u16 mapGroup, u16 mapNum) const struct HealLocation *GetHealLocation(u32 index) { - if (index == 0) + if (index == HEAL_LOCATION_NONE) return NULL; else if (index > ARRAY_COUNT(sHealLocations)) return NULL; diff --git a/src/item_menu.c b/src/item_menu.c index 33b4e1243..0852ce015 100644 --- a/src/item_menu.c +++ b/src/item_menu.c @@ -1552,7 +1552,7 @@ static bool8 sub_80A4F74(u8 a) { bool8 retVal = FALSE; - if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_UP) + if (JOY_REPT(DPAD_ANY) == DPAD_UP) { if (gBagPocketScrollStates[sCurrentBagPocket].cursorPos != 0) sub_80A4B58(-1, a); @@ -1562,7 +1562,7 @@ static bool8 sub_80A4F74(u8 a) gMain.keyRepeatCounter = 11; retVal = TRUE; } - else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_DOWN) + else if (JOY_REPT(DPAD_ANY) == DPAD_DOWN) { if (sReturnLocation != RETURN_TO_FIELD_5) { @@ -1618,7 +1618,7 @@ static void sub_80A50C8(u8 taskId) return; } - if ((gMain.newKeys & SELECT_BUTTON) + if (JOY_NEW(SELECT_BUTTON) && !(sCurrentBagPocket == BAG_POCKET_BERRIES || sCurrentBagPocket == BAG_POCKET_TMs_HMs) && (sReturnLocation == RETURN_TO_FIELD_0 || sReturnLocation == RETURN_TO_BATTLE)) { @@ -1647,7 +1647,7 @@ static void sub_80A50C8(u8 taskId) return; } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { if (gBagPocketScrollStates[sCurrentBagPocket].scrollTop + gBagPocketScrollStates[sCurrentBagPocket].cursorPos == gBagPocketScrollStates[sCurrentBagPocket].numSlots) { @@ -1685,7 +1685,7 @@ static void sub_80A50C8(u8 taskId) return; } - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { if (taskData[10] == 0) { @@ -1709,7 +1709,7 @@ bool8 SellMenu_QuantityRoller(u8 taskId, u16 b) { s16 *taskData = gTasks[taskId].data; - if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_UP) + if (JOY_REPT(DPAD_ANY) == DPAD_UP) { if (taskData[1] != b) taskData[1]++; @@ -1718,7 +1718,7 @@ bool8 SellMenu_QuantityRoller(u8 taskId, u16 b) return TRUE; } - if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_DOWN) + if (JOY_REPT(DPAD_ANY) == DPAD_DOWN) { if (taskData[1] != 1) taskData[1]--; @@ -1727,7 +1727,7 @@ bool8 SellMenu_QuantityRoller(u8 taskId, u16 b) return TRUE; } - if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_RIGHT) + if (JOY_REPT(DPAD_ANY) == DPAD_RIGHT) { if (taskData[1] + 10 < b) taskData[1] += 10; @@ -1736,7 +1736,7 @@ bool8 SellMenu_QuantityRoller(u8 taskId, u16 b) return TRUE; } - if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_LEFT) + if (JOY_REPT(DPAD_ANY) == DPAD_LEFT) { if (taskData[1] > 10) taskData[1] -= 10; @@ -1786,7 +1786,7 @@ static void sub_80A5414(u8 taskId) { while (1) { - if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_UP) + if (JOY_REPT(DPAD_ANY) == DPAD_UP) { if ((sPopupMenuSelection & 1) && sPopupMenuActionList[sPopupMenuSelection - 1] != 8) { @@ -1795,7 +1795,7 @@ static void sub_80A5414(u8 taskId) } break; } - if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_DOWN) + if (JOY_REPT(DPAD_ANY) == DPAD_DOWN) { if ((!(sPopupMenuSelection & 1)) && sPopupMenuActionList[sPopupMenuSelection + 1] != 8) { @@ -1804,7 +1804,7 @@ static void sub_80A5414(u8 taskId) } break; } - if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_LEFT) + if (JOY_REPT(DPAD_ANY) == DPAD_LEFT) { if ((sPopupMenuSelection >= 2) && sPopupMenuActionList[sPopupMenuSelection - 2] != 8) { @@ -1813,7 +1813,7 @@ static void sub_80A5414(u8 taskId) } break; } - if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_RIGHT) + if (JOY_REPT(DPAD_ANY) == DPAD_RIGHT) { if ((sPopupMenuSelection < 2) && sPopupMenuActionList[sPopupMenuSelection + 2] != 8) { @@ -1822,7 +1822,7 @@ static void sub_80A5414(u8 taskId) } break; } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { gTasks[taskId].data[10] = 0; sub_80A4DA4(gBGTilemapBuffers[1]); @@ -1830,7 +1830,7 @@ static void sub_80A5414(u8 taskId) r5(taskId); break; } - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { gTasks[taskId].data[10] = 0; sub_80A48E8(taskId, gBagPocketScrollStates[sCurrentBagPocket].cursorPos, gBagPocketScrollStates[sCurrentBagPocket].cursorPos); @@ -1869,7 +1869,7 @@ static void sub_80A5600(u8 taskId) while (1) { - if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_UP) + if (JOY_REPT(DPAD_ANY) == DPAD_UP) { if (sPopupMenuSelection != 0 && sPopupMenuActionList[sPopupMenuSelection - 1] != 8) { @@ -1878,7 +1878,7 @@ static void sub_80A5600(u8 taskId) } break; } - if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_DOWN) + if (JOY_REPT(DPAD_ANY) == DPAD_DOWN) { if (sPopupMenuSelection != gUnknown_02038564 - 1 && sPopupMenuSelection != 2 && sPopupMenuActionList[sPopupMenuSelection + 1] != 8) { @@ -1887,7 +1887,7 @@ static void sub_80A5600(u8 taskId) } break; } - if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_LEFT) + if (JOY_REPT(DPAD_ANY) == DPAD_LEFT) { if ((sPopupMenuSelection >= 3) && sPopupMenuActionList[sPopupMenuSelection - 3] != 8) { @@ -1896,7 +1896,7 @@ static void sub_80A5600(u8 taskId) } break; } - if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_RIGHT) + if (JOY_REPT(DPAD_ANY) == DPAD_RIGHT) { if ((sPopupMenuSelection < 3) && sPopupMenuActionList[sPopupMenuSelection + 3] != 8) { @@ -1905,7 +1905,7 @@ static void sub_80A5600(u8 taskId) } break; } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { gTasks[taskId].data[10] = 0; sub_80A4DA4(gBGTilemapBuffers[1]); @@ -1913,7 +1913,7 @@ static void sub_80A5600(u8 taskId) r5(taskId); break; } - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { gTasks[taskId].data[10] = 0; sub_80A48E8(taskId, gBagPocketScrollStates[sCurrentBagPocket].cursorPos, gBagPocketScrollStates[sCurrentBagPocket].cursorPos); @@ -1972,7 +1972,7 @@ static void sub_80A5888(u8 taskId) { if (sub_80A78A0() != 0) { - if (gMain.newAndRepeatedKeys & DPAD_UP) + if (JOY_REPT(DPAD_UP)) { if (sPopupMenuSelection != 0) { @@ -1980,7 +1980,7 @@ static void sub_80A5888(u8 taskId) sPopupMenuSelection = Menu_MoveCursor(-1); } } - else if (gMain.newAndRepeatedKeys & DPAD_DOWN) + else if (JOY_REPT(DPAD_DOWN)) { if (sPopupMenuSelection != gUnknown_02038564 - 1) { @@ -1988,14 +1988,14 @@ static void sub_80A5888(u8 taskId) sPopupMenuSelection = Menu_MoveCursor(1); } } - else if (gMain.newKeys & A_BUTTON) + else if (JOY_NEW(A_BUTTON)) { gTasks[taskId].data[10] = 0; sub_80A48E8(taskId, gBagPocketScrollStates[sCurrentBagPocket].cursorPos, gBagPocketScrollStates[sCurrentBagPocket].cursorPos); sub_80A4DA4(gBGTilemapBuffers[1]); sItemPopupMenuActions[sPopupMenuActionList[sPopupMenuSelection]].func(taskId); } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { gTasks[taskId].data[10] = 0; sub_80A4DA4(gBGTilemapBuffers[1]); @@ -2190,7 +2190,7 @@ static void sub_80A5DF8(void) static void sub_80A5E1C(u8 taskId) { - if ((gMain.newKeys & A_BUTTON) || (gMain.newKeys & B_BUTTON)) + if (JOY_NEW(A_BUTTON) || JOY_NEW(B_BUTTON)) { gTasks[taskId].data[10] = 0; sub_80A41D4(taskId); @@ -2214,13 +2214,13 @@ static void sub_80A5EA0(u8 taskId) { if (sub_80A5350(taskId) == TRUE) return; - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); sub_80A5DA0(gSpecialVar_ItemId, gTasks[taskId].data[1]); DoYesNoFuncWithChoice(taskId, &gUnknown_083C16F4); } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); sub_80A5D38(taskId); @@ -2278,7 +2278,7 @@ static void sub_80A6000(u8 taskId) static void sub_80A6024(u8 taskId) { - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { sub_80A36B8(gBGTilemapBuffers[1], 0, 0, 31, 31); Menu_EraseWindowRect(0, 14, 29, 19); @@ -2455,7 +2455,7 @@ static void sub_80A648C(u8 taskId) static void sub_80A6520(u8 taskId) { - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); BuyMenuPrintItemQuantityAndPrice(taskId); @@ -2505,7 +2505,7 @@ static void Task_BuyHowManyDialogueHandleInput(u8 taskId) Menu_EraseWindowRect(6, 11, 12, 11); BuyMenuDisplayMessage(gSpecialVar_ItemId, gTasks[taskId].data[1]); } - else if (gMain.newKeys & A_BUTTON) + else if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); Menu_EraseWindowRect(0, 10, 13, 13); @@ -2514,7 +2514,7 @@ static void Task_BuyHowManyDialogueHandleInput(u8 taskId) StringExpandPlaceholders(gStringVar4, gOtherText_CanPay); DisplayCannotUseItemMessage(taskId, gStringVar4, sub_80A6650, 1); } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); BuyMenuPrintItemQuantityAndPrice(taskId); @@ -2661,7 +2661,7 @@ static void sub_80A6A84(u8 taskId) static void sub_80A6B00(u8 taskId) { - if ((gMain.newKeys & A_BUTTON) || (gMain.newKeys & B_BUTTON)) + if (JOY_NEW(A_BUTTON) || JOY_NEW(B_BUTTON)) { gTasks[taskId].data[10] = 0; sub_80A48E8(taskId, gBagPocketScrollStates[sCurrentBagPocket].cursorPos, gBagPocketScrollStates[sCurrentBagPocket].cursorPos); @@ -2697,13 +2697,13 @@ static void sub_80A6BE0(u8 taskId) { if (sub_80A5350(taskId) == TRUE) return; - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); sub_80A4DA4(gBGTilemapBuffers[1]); sub_80A6B64(taskId); } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { gTasks[taskId].data[10] = 0; sub_80A48E8(taskId, gBagPocketScrollStates[sCurrentBagPocket].cursorPos, gBagPocketScrollStates[sCurrentBagPocket].cursorPos); @@ -2802,7 +2802,7 @@ static void sub_80A6DF0(u16 *a) static void sub_80A6EB8(u8 taskId) { - if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_UP) + if (JOY_REPT(DPAD_ANY) == DPAD_UP) { if (sPopupMenuSelection == 1) { @@ -2810,7 +2810,7 @@ static void sub_80A6EB8(u8 taskId) sPopupMenuSelection = Menu_MoveCursor(-1); } } - else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_DOWN) + else if (JOY_REPT(DPAD_ANY) == DPAD_DOWN) { if (sPopupMenuSelection + 1 < gUnknown_02038564) { @@ -2818,14 +2818,14 @@ static void sub_80A6EB8(u8 taskId) sPopupMenuSelection = Menu_MoveCursor(1); } } - else if (gMain.newKeys & A_BUTTON) + else if (JOY_NEW(A_BUTTON)) { gTasks[taskId].data[10] = 0; sub_80A48E8(taskId, gBagPocketScrollStates[sCurrentBagPocket].cursorPos, gBagPocketScrollStates[sCurrentBagPocket].cursorPos); sub_80A4DA4(gBGTilemapBuffers[1]); sItemPopupMenuActions[sPopupMenuActionList[sPopupMenuSelection]].func(taskId); } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { gTasks[taskId].data[10] = 0; sub_80A48E8(taskId, gBagPocketScrollStates[sCurrentBagPocket].cursorPos, gBagPocketScrollStates[sCurrentBagPocket].cursorPos); diff --git a/src/item_use.c b/src/item_use.c index a6defcfee..6fd6f5c33 100644 --- a/src/item_use.c +++ b/src/item_use.c @@ -35,6 +35,7 @@ #include "strings.h" #include "task.h" #include "constants/event_bg.h" +#include "constants/event_objects.h" #include "constants/map_types.h" #include "constants/species.h" #include "constants/vars.h" @@ -548,15 +549,15 @@ u8 GetPlayerDirectionTowardsHiddenItem(s16 itemX, s16 itemY) void SetPlayerDirectionTowardsItem(u8 direction) { - ObjectEventClearHeldMovementIfFinished(&gObjectEvents[GetObjectEventIdByLocalIdAndMap(0xFF, 0, 0)]); - ObjectEventClearHeldMovement(&gObjectEvents[GetObjectEventIdByLocalIdAndMap(0xFF, 0, 0)]); - UnfreezeObjectEvent(&gObjectEvents[GetObjectEventIdByLocalIdAndMap(0xFF, 0, 0)]); + ObjectEventClearHeldMovementIfFinished(&gObjectEvents[GetObjectEventIdByLocalIdAndMap(LOCALID_PLAYER, 0, 0)]); + ObjectEventClearHeldMovement(&gObjectEvents[GetObjectEventIdByLocalIdAndMap(LOCALID_PLAYER, 0, 0)]); + UnfreezeObjectEvent(&gObjectEvents[GetObjectEventIdByLocalIdAndMap(LOCALID_PLAYER, 0, 0)]); PlayerTurnInPlace(direction); } void DisplayItemRespondingMessageAndExitItemfinder(u8 taskId) { - if (ObjectEventCheckHeldMovementStatus(&gObjectEvents[GetObjectEventIdByLocalIdAndMap(0xFF, 0, 0)]) == TRUE) + if (ObjectEventCheckHeldMovementStatus(&gObjectEvents[GetObjectEventIdByLocalIdAndMap(LOCALID_PLAYER, 0, 0)]) == TRUE) DisplayItemMessageOnField(taskId, gOtherText_ItemfinderResponding, ExitItemfinder, 0); } @@ -564,7 +565,7 @@ void RotatePlayerAndExitItemfinder(u8 taskId) { s16 *data = gTasks[taskId].data; - if (ObjectEventCheckHeldMovementStatus(&gObjectEvents[GetObjectEventIdByLocalIdAndMap(0xFF, 0, 0)]) == TRUE + if (ObjectEventCheckHeldMovementStatus(&gObjectEvents[GetObjectEventIdByLocalIdAndMap(LOCALID_PLAYER, 0, 0)]) == TRUE || data[2] == FALSE) { SetPlayerDirectionTowardsItem(gItemFinderDirections[data[5]]); @@ -614,13 +615,13 @@ void ItemUseOutOfBattle_CoinCase(u8 taskId) static void SSTicketWaitForAButtonPress(u8 taskId) { - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) CleanUpItemMenuMessage(taskId); } static void SSTicketWaitForAButtonPress2(u8 taskId) { - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) CleanUpOverworldMessage(taskId); } @@ -750,7 +751,7 @@ static void BootTMHM(u8 taskId) static void WaitButtonPressAndDisplayTMHMInfo(u8 taskId) { - if (gMain.newKeys & A_BUTTON || gMain.newKeys & B_BUTTON) + if (JOY_NEW(A_BUTTON) || JOY_NEW(B_BUTTON)) { StringCopy(gStringVar1, gMoveNames[ItemIdToBattleMoveId(gSpecialVar_ItemId)]); StringExpandPlaceholders(gStringVar4, gOtherText_ContainsMove); @@ -888,7 +889,7 @@ void ItemUseInBattle_PokeBall(u8 taskId) void sub_80CA294(u8 taskId) { - if (gMain.newKeys & A_BUTTON || gMain.newKeys & B_BUTTON) + if (JOY_NEW(A_BUTTON) || JOY_NEW(B_BUTTON)) sub_80A7094(taskId); } diff --git a/src/link.c b/src/link.c index 2c79cdf13..a066f5e5c 100644 --- a/src/link.c +++ b/src/link.c @@ -403,17 +403,17 @@ static void TestBlockTransfer(u32 a1, u32 a2, u32 a3) static void LinkTestProcessKeyInput(void) { - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) gShouldAdvanceLinkState = 1; - if (gMain.heldKeys & B_BUTTON) + if (JOY_HELD(B_BUTTON)) InitBlockSend(gSharedMem + 0x4000, 0x2004); - if (gMain.newKeys & L_BUTTON) + if (JOY_NEW(L_BUTTON)) BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB(2, 0, 0)); - if (gMain.newKeys & START_BUTTON) + if (JOY_NEW(START_BUTTON)) SetSuppressLinkErrorMessage(TRUE); - if (gMain.newKeys & R_BUTTON) + if (JOY_NEW(R_BUTTON)) Save_WriteData(SAVE_LINK); - if (gMain.newKeys & SELECT_BUTTON) + if (JOY_NEW(SELECT_BUTTON)) SetCloseLinkCallback(); if (gLinkTestDebugValuesEnabled) { diff --git a/src/mail.c b/src/mail.c index c6ca4aaec..ee3aa12df 100644 --- a/src/mail.c +++ b/src/mail.c @@ -637,7 +637,7 @@ static void sub_80F8F58(void) static void sub_80F8F78(void) { - if (gMain.newKeys & (A_BUTTON | B_BUTTON)) + if (JOY_NEW(A_BUTTON | B_BUTTON)) { BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB(0, 0, 0)); sSharedMemPtr->varF0 = sub_80F8FB4; @@ -687,24 +687,24 @@ void debug_sub_810C910(u8 taskId) void debug_sub_810C990(u8 taskId) { - if (gMain.newKeys & (DPAD_LEFT | DPAD_DOWN)) + if (JOY_NEW(DPAD_LEFT | DPAD_DOWN)) { gSpecialVar_0x8006 = (gSpecialVar_0x8006 + 11) % 12; Menu_DrawStdWindowFrame(1, 1, 10, 4); Menu_PrintText(_84115C4[gSpecialVar_0x8006], 2, 2); } - else if (gMain.newKeys & (DPAD_UP | DPAD_RIGHT)) + else if (JOY_NEW(DPAD_UP | DPAD_RIGHT)) { gSpecialVar_0x8006 = (gSpecialVar_0x8006 + 1) % 12; Menu_DrawStdWindowFrame(1, 1, 10, 4); Menu_PrintText(_84115C4[gSpecialVar_0x8006], 2, 2); } - else if (gMain.newKeys & A_BUTTON) + else if (JOY_NEW(A_BUTTON)) { BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB(0, 0, 0)); gTasks[taskId].func = debug_sub_810C910; } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { Menu_DisplayDialogueFrame(); Menu_PrintText(Str_8411540, 4, 15); @@ -715,12 +715,12 @@ void debug_sub_810C990(u8 taskId) void debug_sub_810CA7C(u8 taskId) { - if (gMain.newKeys & 0xF0) + if (JOY_NEW(DPAD_ANY)) { gSpecialVar_0x8004 ^= 1; Menu_PrintText(_8411560[gSpecialVar_0x8004], 2, 2); } - else if (gMain.newKeys & A_BUTTON) + else if (JOY_NEW(A_BUTTON)) { if (gMain.watchedKeysPressed) { @@ -747,7 +747,7 @@ void debug_sub_810CB50(u8 taskId) u8 sp8[] = DTR("メール{STR_VAR_1} {STR_VAR_2}", "MAIL{STR_VAR_1} {STR_VAR_2}"); bool8 r2 = FALSE; - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { ConvertIntToDecimalStringN(gStringVar1, gSpecialVar_0x8005, 2, 1); StringCopy(gStringVar2, gSpeciesNames[gTasks[taskId].data[0]]); @@ -760,7 +760,7 @@ void debug_sub_810CB50(u8 taskId) debug_sub_810D340(); return; } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { DestroyTask(taskId); Menu_EraseScreen(); @@ -768,12 +768,12 @@ void debug_sub_810CB50(u8 taskId) debug_sub_810D340(); return; } - else if (gMain.newKeys & (DPAD_LEFT | DPAD_DOWN)) + else if (JOY_NEW(DPAD_LEFT | DPAD_DOWN)) { gTasks[taskId].data[0] = (gTasks[taskId].data[0] + 0x19B) % 0x19C; r2 = TRUE; } - else if (gMain.newKeys & (DPAD_UP | DPAD_RIGHT)) + else if (JOY_NEW(DPAD_UP | DPAD_RIGHT)) { gTasks[taskId].data[0] = (gTasks[taskId].data[0] + 1) % 0x19C; r2 = TRUE; diff --git a/src/main.c b/src/main.c index d8779b90c..33b560c73 100644 --- a/src/main.c +++ b/src/main.c @@ -250,14 +250,14 @@ static void ReadKeys(void) // Remap L to A if the L=A option is enabled. if (gSaveBlock2.optionsButtonMode == 2) { - if (gMain.newKeys & L_BUTTON) + if (JOY_NEW(L_BUTTON)) gMain.newKeys |= A_BUTTON; - if (gMain.heldKeys & L_BUTTON) + if (JOY_HELD(L_BUTTON)) gMain.heldKeys |= A_BUTTON; } - if (gMain.newKeys & gMain.watchedKeysMask) + if (JOY_NEW(gMain.watchedKeysMask)) gMain.watchedKeysPressed = TRUE; } diff --git a/src/main_menu.c b/src/main_menu.c index 93eb6fbbe..a224efe3b 100644 --- a/src/main_menu.c +++ b/src/main_menu.c @@ -323,7 +323,7 @@ void Task_MainMenuWaitForSaveErrorAck(u8 taskId) { if (Menu_UpdateWindowText()) { - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { Menu_EraseWindowRect(2, 14, 27, 19); gTasks[taskId].func = Task_MainMenuCheckRtc; @@ -362,7 +362,7 @@ void Task_MainMenuWaitForRtcErrorAck(u8 taskId) { if (Menu_UpdateWindowText()) { - if ( gMain.newKeys & 1 ) + if (JOY_NEW(A_BUTTON)) { Menu_EraseWindowRect(2, 14, 27, 19); gTasks[taskId].func = Task_MainMenuDraw; @@ -441,13 +441,13 @@ void Task_MainMenuHighlight(u8 taskId) bool8 MainMenuProcessKeyInput(u8 taskId) { - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB(0, 0, 0)); gTasks[taskId].func = Task_MainMenuPressedA; } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, FADE_COLOR_WHITE); @@ -473,7 +473,7 @@ bool8 MainMenuProcessKeyInput(u8 taskId) break; } - if (gMain.newKeys & DPAD_UP) + if (JOY_NEW(DPAD_UP)) { if (gTasks[taskId].tMenuSelection > 0) { @@ -481,7 +481,7 @@ bool8 MainMenuProcessKeyInput(u8 taskId) return TRUE; } } - if (gMain.newKeys & DPAD_DOWN) + if (JOY_NEW(DPAD_DOWN)) { if (gTasks[taskId].tMenuSelection < menuItemCount - 1) { diff --git a/src/menu.c b/src/menu.c index 6fabef96b..aae5a7434 100644 --- a/src/menu.c +++ b/src/menu.c @@ -269,7 +269,7 @@ u8 Menu_GetCursorPos(void) s8 Menu_ProcessInput(void) { - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); if (gMenu.menu_field_7) @@ -277,20 +277,20 @@ s8 Menu_ProcessInput(void) return gMenu.cursorPos; } - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { if (gMenu.menu_field_7) Menu_DestroyCursor(); return -1; } - if (gMain.newKeys & DPAD_UP) + if (JOY_NEW(DPAD_UP)) { PlaySE(SE_SELECT); Menu_MoveCursor(-1); return -2; } - else if (gMain.newKeys & DPAD_DOWN) + else if (JOY_NEW(DPAD_DOWN)) { PlaySE(SE_SELECT); Menu_MoveCursor(1); @@ -304,7 +304,7 @@ s8 Menu_ProcessInputNoWrap(void) { u8 cursorPos = gMenu.cursorPos; - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); if (gMenu.menu_field_7) @@ -312,20 +312,20 @@ s8 Menu_ProcessInputNoWrap(void) return gMenu.cursorPos; } - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { if (gMenu.menu_field_7) Menu_DestroyCursor(); return -1; } - if (gMain.newKeys & DPAD_UP) + if (JOY_NEW(DPAD_UP)) { if (cursorPos != Menu_MoveCursorNoWrap(-1)) PlaySE(SE_SELECT); return -2; } - else if (gMain.newKeys & DPAD_DOWN) + else if (JOY_NEW(DPAD_DOWN)) { if (cursorPos != Menu_MoveCursorNoWrap(1)) PlaySE(SE_SELECT); @@ -385,19 +385,19 @@ static u8 MoveMenuCursorGridLayout(s8 delta) // Returns TRUE if the cursor is on an edge and cannot move in the pressed direction static bool8 IsGridCursorMovementClamped(void) { - if (gMain.newKeys & DPAD_UP) + if (JOY_NEW(DPAD_UP)) { // is cursor on first row? if (gMenu.cursorPos < gMenu.width) return TRUE; } - if (gMain.newKeys & DPAD_DOWN) + if (JOY_NEW(DPAD_DOWN)) { // is cursor on last row? if (gMenu.cursorPos >= gMenu.maxCursorPos + 1 - gMenu.width) return TRUE; } - if (gMain.newKeys & DPAD_LEFT) + if (JOY_NEW(DPAD_LEFT)) { // is cursor on first column? if ((gMenu.cursorPos - gMenu.cursorPos % gMenu.width) % gMenu.width == 1 // always false @@ -405,7 +405,7 @@ static bool8 IsGridCursorMovementClamped(void) || gMenu.cursorPos % gMenu.width == 0) return TRUE; } - if (gMain.newKeys & DPAD_RIGHT) + if (JOY_NEW(DPAD_RIGHT)) { // is cursor on last column? if (gMenu.cursorPos % gMenu.width == gMenu.width - 1) @@ -531,7 +531,7 @@ void sub_807274C(u8 left, u8 top, u8 menuItemCount, u8 a4, const struct MenuActi s8 Menu_ProcessInputGridLayout(void) { - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { if (gMenu.menu_field_7) Menu_DestroyCursor(); @@ -539,34 +539,34 @@ s8 Menu_ProcessInputGridLayout(void) return Menu_GetCursorPos(); } - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { if (gMenu.menu_field_7) Menu_DestroyCursor(); return -1; } - if (gMain.newKeys & DPAD_UP) + if (JOY_NEW(DPAD_UP)) { PlaySE(SE_SELECT); // Move up one whole row MoveMenuCursorGridLayout(-gMenu.width); return -2; } - else if (gMain.newKeys & DPAD_DOWN) + else if (JOY_NEW(DPAD_DOWN)) { PlaySE(SE_SELECT); // Move down one whole column MoveMenuCursorGridLayout(gMenu.width); return -2; } - else if (gMain.newKeys & DPAD_LEFT) + else if (JOY_NEW(DPAD_LEFT)) { PlaySE(SE_SELECT); MoveMenuCursorGridLayout(-1); return -2; } - else if (gMain.newKeys & DPAD_RIGHT) + else if (JOY_NEW(DPAD_RIGHT)) { PlaySE(SE_SELECT); MoveMenuCursorGridLayout(1); diff --git a/src/menu_helpers.c b/src/menu_helpers.c index 87245fe81..14f84885b 100644 --- a/src/menu_helpers.c +++ b/src/menu_helpers.c @@ -224,11 +224,11 @@ u8 sub_80F9284(void) { if (gSaveBlock2.optionsButtonMode == OPTIONS_BUTTON_MODE_LR) { - if (gMain.newKeys & L_BUTTON) + if (JOY_NEW(L_BUTTON)) { return 1; } - if (gMain.newKeys & R_BUTTON) + if (JOY_NEW(R_BUTTON)) { return 2; } @@ -241,11 +241,11 @@ u8 sub_80F92BC(void) { if (gSaveBlock2.optionsButtonMode == OPTIONS_BUTTON_MODE_LR) { - if (gMain.newAndRepeatedKeys & L_BUTTON) + if (JOY_REPT(L_BUTTON)) { return 1; } - if (gMain.newAndRepeatedKeys & R_BUTTON) + if (JOY_REPT(R_BUTTON)) { return 2; } @@ -261,7 +261,7 @@ bool8 sub_80F92F4(u16 itemId) return TRUE; } - if (!(gSaveBlock1.location.mapGroup == MAP_GROUP(TRADE_CENTER) && gSaveBlock1.location.mapNum == MAP_NUM(TRADE_CENTER))) + if (!(gSaveBlock1.location.mapGroup == MAP_GROUP(MAP_TRADE_CENTER) && gSaveBlock1.location.mapNum == MAP_NUM(MAP_TRADE_CENTER))) { return TRUE; } diff --git a/src/mon_markings.c b/src/mon_markings.c index 7b4055421..31f415fce 100644 --- a/src/mon_markings.c +++ b/src/mon_markings.c @@ -408,7 +408,7 @@ bool8 sub_80F7500(void) sMenu->spriteSheetLoadRequired = FALSE; } - if (gMain.newKeys & DPAD_UP) + if (JOY_NEW(DPAD_UP)) { s8 pos; PlaySE(SE_SELECT); @@ -418,7 +418,7 @@ bool8 sub_80F7500(void) return TRUE; } - if (gMain.newKeys & DPAD_DOWN) + if (JOY_NEW(DPAD_DOWN)) { s8 pos; PlaySE(SE_SELECT); @@ -428,7 +428,7 @@ bool8 sub_80F7500(void) return TRUE; } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); @@ -447,7 +447,7 @@ bool8 sub_80F7500(void) return TRUE; } - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); return FALSE; diff --git a/src/move_tutor_menu.c b/src/move_tutor_menu.c index 50dcb4f5e..c1948dadd 100644 --- a/src/move_tutor_menu.c +++ b/src/move_tutor_menu.c @@ -617,7 +617,7 @@ static void MoveTutorMain(void) sMoveTutorMenu->state = 33; break; case 33: - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); sMoveTutorMenu->state = 14; @@ -664,10 +664,10 @@ static void DrawBattleMoveInfoHeaders(bool8 noTeachMoveText) static u8 ChangeToContestMoveInfoWindow(void) { - u32 result = (gMain.newKeys & DPAD_LEFT) || (gMain.newKeys & DPAD_RIGHT); + u32 result = JOY_NEW(DPAD_LEFT) || JOY_NEW(DPAD_RIGHT); if (gSaveBlock2.optionsButtonMode == OPTIONS_BUTTON_MODE_LR - && ((gMain.newKeys & L_BUTTON) || (gMain.newKeys & R_BUTTON))) + && (JOY_NEW(L_BUTTON) || JOY_NEW(R_BUTTON))) result++; if (result != 0) @@ -710,10 +710,10 @@ static void DrawContestMoveInfoHeaders(bool8 noTeachMoveText) static u8 ChangeToBattleMoveInfoWindow(void) { - u32 result = (gMain.newKeys & DPAD_LEFT) || (gMain.newKeys & DPAD_RIGHT); + u32 result = JOY_NEW(DPAD_LEFT) || JOY_NEW(DPAD_RIGHT); if (gSaveBlock2.optionsButtonMode == OPTIONS_BUTTON_MODE_LR - && ((gMain.newKeys & L_BUTTON) || (gMain.newKeys & R_BUTTON))) + && (JOY_NEW(L_BUTTON) || JOY_NEW(R_BUTTON))) result++; if (result != 0) @@ -826,7 +826,7 @@ static void MoveCursorPos(s8 delta) static void HandleMoveTutorMenuInput(void) { - if (gMain.newAndRepeatedKeys & DPAD_UP) + if (JOY_REPT(DPAD_UP)) { if (sMoveTutorMenu->menuSelection != 0) { @@ -844,7 +844,7 @@ static void HandleMoveTutorMenuInput(void) } } } - else if (gMain.newAndRepeatedKeys & DPAD_DOWN) + else if (JOY_REPT(DPAD_DOWN)) { if (sMoveTutorMenu->menuSelection < sMoveTutorMenu->numMenuChoices - 1) { @@ -862,7 +862,7 @@ static void HandleMoveTutorMenuInput(void) } } } - else if (gMain.newKeys & A_BUTTON) + else if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); if (sMoveTutorMenu->menuSelection != sMoveTutorMenu->numMenuChoices - 1) @@ -879,7 +879,7 @@ static void HandleMoveTutorMenuInput(void) sMoveTutorMenu->state = 12; } } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); sMoveTutorMenu->state = 12; diff --git a/src/mystery_event_menu.c b/src/mystery_event_menu.c index 987249f50..b1e161f85 100644 --- a/src/mystery_event_menu.c +++ b/src/mystery_event_menu.c @@ -113,7 +113,7 @@ static void CB2_MysteryEventMenu(void) MenuPrintMessageDefaultCoords(gSystemText_LoadEventPressA); gMain.state++; } - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); CloseLink(); @@ -133,7 +133,7 @@ static void CB2_MysteryEventMenu(void) gMain.state = 13; break; } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); sub_8007F4C(); @@ -141,7 +141,7 @@ static void CB2_MysteryEventMenu(void) Menu_PrintText(gSystemText_LoadingEvent, 7, 6); gMain.state++; } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); CloseLink(); @@ -179,7 +179,7 @@ static void CB2_MysteryEventMenu(void) break; } } - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); CloseLink(); @@ -193,7 +193,7 @@ static void CB2_MysteryEventMenu(void) { goto label; } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); sub_8007F4C(); @@ -201,7 +201,7 @@ static void CB2_MysteryEventMenu(void) Menu_PrintText(gSystemText_LoadingEvent, 7, 6); gMain.state++; } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); CloseLink(); @@ -258,7 +258,7 @@ static void CB2_MysteryEventMenu(void) } break; } - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); CloseLink(); @@ -307,7 +307,7 @@ static void CB2_MysteryEventMenu(void) } break; case 14: - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); gMain.state++; @@ -360,7 +360,7 @@ void debug_sub_815D04C(u8 taskId) gTasks[taskId].data[0]++; } - if (gMain.newKeys & 0x20) + if (JOY_NEW(DPAD_LEFT)) { if (gTasks[taskId].data[1] == 0) gTasks[taskId].data[1] = gUnknown_Debug_842E350 - 1; @@ -368,7 +368,7 @@ void debug_sub_815D04C(u8 taskId) gTasks[taskId].data[1]--; gTasks[taskId].data[0] = 0; } - if (gMain.newKeys & 0x10) + if (JOY_NEW(DPAD_RIGHT)) { if (gTasks[taskId].data[1] == gUnknown_Debug_842E350 - 1) gTasks[taskId].data[1] = 0; @@ -376,7 +376,7 @@ void debug_sub_815D04C(u8 taskId) gTasks[taskId].data[1]++; gTasks[taskId].data[0] = 0; } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { // TODO: fix this s32 var = gTasks[taskId].data[1]; @@ -422,7 +422,7 @@ void debug_sub_815D1D8(void) case 1: if (!gPaletteFade.active) { - if (gMain.heldKeys & 0x100) + if (JOY_HELD(R_BUTTON)) gUnknown_Debug_30030E0++; MenuPrintMessage(Str_843DA70, 4, 15); gMain.state++; @@ -473,7 +473,7 @@ void debug_sub_815D1D8(void) } break; case 10: - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB(0, 0, 0)); gMain.state++; diff --git a/src/naming_screen.c b/src/naming_screen.c index a1297d3ad..f3860017b 100644 --- a/src/naming_screen.c +++ b/src/naming_screen.c @@ -663,22 +663,22 @@ static void InputState_Disabled(struct Task *task) static void InputState_Enabled(struct Task *task) { task->tKeyboardEvent = 0; - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { task->tKeyboardEvent = KBEVENT_PRESSED_A; return; } - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { task->tKeyboardEvent = KBEVENT_PRESSED_B; return; } - if (gMain.newKeys & SELECT_BUTTON) + if (JOY_NEW(SELECT_BUTTON)) { task->tKeyboardEvent = KBEVENT_PRESSED_SELECT; return; } - if (gMain.newKeys & START_BUTTON) + if (JOY_NEW(START_BUTTON)) { task->tKeyboardEvent = KBEVENT_PRESSED_START; MoveCursorToOKButton(); @@ -717,13 +717,13 @@ static void HandleDpadMovement(struct Task *task) GetCursorPos(&cursorX, &cursorY); dpadDir = 0; - if (gMain.newAndRepeatedKeys & DPAD_UP) + if (JOY_REPT(DPAD_UP)) dpadDir = 1; - if (gMain.newAndRepeatedKeys & DPAD_DOWN) + if (JOY_REPT(DPAD_DOWN)) dpadDir = 2; - if (gMain.newAndRepeatedKeys & DPAD_LEFT) + if (JOY_REPT(DPAD_LEFT)) dpadDir = 3; - if (gMain.newAndRepeatedKeys & DPAD_RIGHT) + if (JOY_REPT(DPAD_RIGHT)) dpadDir = 4; //Get new cursor position diff --git a/src/new_game.c b/src/new_game.c index dede514bb..379e11591 100644 --- a/src/new_game.c +++ b/src/new_game.c @@ -49,10 +49,10 @@ static const struct ContestWinner sEmptyMuseumPortrait = #if DEBUG const s8 gUnknown_Debug_0823C788[][2] = { - { MAP_GROUP(INSIDE_OF_TRUCK), MAP_NUM(INSIDE_OF_TRUCK) }, - { MAP_GROUP(OLDALE_TOWN_POKEMON_CENTER_2F), MAP_NUM(OLDALE_TOWN_POKEMON_CENTER_2F) }, - { MAP_GROUP(LITTLEROOT_TOWN), MAP_NUM(LITTLEROOT_TOWN) }, - { MAP_GROUP(LITTLEROOT_TOWN_BRENDANS_HOUSE_2F), MAP_NUM(LITTLEROOT_TOWN_BRENDANS_HOUSE_2F) } + { MAP_GROUP(MAP_INSIDE_OF_TRUCK), MAP_NUM(MAP_INSIDE_OF_TRUCK) }, + { MAP_GROUP(MAP_OLDALE_TOWN_POKEMON_CENTER_2F), MAP_NUM(MAP_OLDALE_TOWN_POKEMON_CENTER_2F) }, + { MAP_GROUP(MAP_LITTLEROOT_TOWN), MAP_NUM(MAP_LITTLEROOT_TOWN) }, + { MAP_GROUP(MAP_LITTLEROOT_TOWN_BRENDANS_HOUSE_2F), MAP_NUM(MAP_LITTLEROOT_TOWN_BRENDANS_HOUSE_2F) } }; const u8 gUnknown_Debug_0823C790[] = _("KRÖTE"); @@ -136,7 +136,7 @@ void debug_sub_8052E04() void WarpToTruck(void) { - Overworld_SetWarpDestination(MAP_GROUP(INSIDE_OF_TRUCK), MAP_NUM(INSIDE_OF_TRUCK), -1, -1, -1); + Overworld_SetWarpDestination(MAP_GROUP(MAP_INSIDE_OF_TRUCK), MAP_NUM(MAP_INSIDE_OF_TRUCK), -1, -1, -1); WarpIntoMap(); } diff --git a/src/option_menu.c b/src/option_menu.c index 9362a776b..69cdc1473 100644 --- a/src/option_menu.c +++ b/src/option_menu.c @@ -197,16 +197,16 @@ static void Task_OptionMenuFadeIn(u8 taskId) static void Task_OptionMenuProcessInput(u8 taskId) { - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { if (gTasks[taskId].tMenuSelection == MENUITEM_CANCEL) gTasks[taskId].func = Task_OptionMenuSave; } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { gTasks[taskId].func = Task_OptionMenuSave; } - else if (gMain.newKeys & DPAD_UP) + else if (JOY_NEW(DPAD_UP)) { if (gTasks[taskId].tMenuSelection > 0) gTasks[taskId].tMenuSelection--; @@ -214,7 +214,7 @@ static void Task_OptionMenuProcessInput(u8 taskId) gTasks[taskId].tMenuSelection = 6; HighlightOptionMenuItem(gTasks[taskId].tMenuSelection); } - else if (gMain.newKeys & DPAD_DOWN) + else if (JOY_NEW(DPAD_DOWN)) { if (gTasks[taskId].tMenuSelection < 6) gTasks[taskId].tMenuSelection++; @@ -300,14 +300,14 @@ static void DrawOptionMenuChoice(const u8 *text, u8 x, u8 y, u8 style) static u8 TextSpeed_ProcessInput(u8 selection) { - if (gMain.newKeys & DPAD_RIGHT) + if (JOY_NEW(DPAD_RIGHT)) { if (selection < 2) selection++; else selection = 0; } - if (gMain.newKeys & DPAD_LEFT) + if (JOY_NEW(DPAD_LEFT)) { if (selection > 0) selection--; @@ -344,7 +344,7 @@ static void TextSpeed_DrawChoices(u8 selection) static u8 BattleScene_ProcessInput(u8 selection) { - if (gMain.newKeys & (DPAD_LEFT | DPAD_RIGHT)) + if (JOY_NEW(DPAD_LEFT | DPAD_RIGHT)) selection ^= 1; return selection; } @@ -363,7 +363,7 @@ static void BattleScene_DrawChoices(u8 selection) static u8 BattleStyle_ProcessInput(u8 selection) { - if (gMain.newKeys & (DPAD_LEFT | DPAD_RIGHT)) + if (JOY_NEW(DPAD_LEFT | DPAD_RIGHT)) selection ^= 1; return selection; } @@ -390,7 +390,7 @@ static void BattleStyle_DrawChoices(u8 selection) static u8 Sound_ProcessInput(u8 selection) { - if (gMain.newKeys & (DPAD_LEFT | DPAD_RIGHT)) + if (JOY_NEW(DPAD_LEFT | DPAD_RIGHT)) { selection ^= 1; SetPokemonCryStereo(selection); @@ -412,7 +412,7 @@ static void Sound_DrawChoices(u8 selection) static u8 FrameType_ProcessInput(u8 selection) { - if (gMain.newKeys & DPAD_RIGHT) + if (JOY_NEW(DPAD_RIGHT)) { if (selection < 19) selection++; @@ -420,7 +420,7 @@ static u8 FrameType_ProcessInput(u8 selection) selection = 0; Menu_LoadStdFrameGraphicsOverrideStyle(selection); } - if (gMain.newKeys & DPAD_LEFT) + if (JOY_NEW(DPAD_LEFT)) { if (selection > 0) selection--; @@ -485,14 +485,14 @@ static void FrameType_DrawChoices(u8 selection) static u8 ButtonMode_ProcessInput(u8 selection) { - if (gMain.newKeys & DPAD_RIGHT) + if (JOY_NEW(DPAD_RIGHT)) { if (selection < 2) selection++; else selection = 0; } - if (gMain.newKeys & DPAD_LEFT) + if (JOY_NEW(DPAD_LEFT)) { if (selection > 0) selection--; diff --git a/src/overworld.c b/src/overworld.c index 682de48b4..212eb7236 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -477,7 +477,7 @@ void sub_8053538(u8 a1) const struct HealLocation *warp = GetHealLocation(a1); if (warp) - Overworld_SetWarpDestination(warp->group, warp->map, -1, warp->x, warp->y); + Overworld_SetWarpDestination(warp->mapGroup, warp->mapNum, -1, warp->x, warp->y); } void Overworld_SetWarpDestToLastHealLoc(void) @@ -490,7 +490,7 @@ void Overworld_SetHealLocationWarp(u8 healLocationId) const struct HealLocation *healLocation = GetHealLocation(healLocationId); if (healLocation != NULL) - SetWarpData(&gSaveBlock1.lastHealLocation, healLocation->group, healLocation->map, -1, healLocation->x, healLocation->y); + SetWarpData(&gSaveBlock1.lastHealLocation, healLocation->mapGroup, healLocation->mapNum, -1, healLocation->x, healLocation->y); } void sub_80535C4(s16 a1, s16 a2) @@ -548,7 +548,7 @@ void sub_80537CC(u8 a1) { const struct HealLocation *warp = GetHealLocation(a1); if (warp) - SetWarpData(&gSaveBlock1.warp1, warp->group, warp->map, -1, warp->x, warp->y); + SetWarpData(&gSaveBlock1.warp1, warp->mapGroup, warp->mapNum, -1, warp->x, warp->y); } void gpu_sync_bg_hide() @@ -752,9 +752,9 @@ u16 GetCenterScreenMetatileBehavior(void) bool32 Overworld_IsBikingAllowed(void) { // is player in cycling road entrance? - if (gSaveBlock1.location.mapGroup == MAP_GROUP(ROUTE110_SEASIDE_CYCLING_ROAD_SOUTH_ENTRANCE) - && (gSaveBlock1.location.mapNum == MAP_NUM(ROUTE110_SEASIDE_CYCLING_ROAD_SOUTH_ENTRANCE) - || gSaveBlock1.location.mapNum == MAP_NUM(ROUTE110_SEASIDE_CYCLING_ROAD_NORTH_ENTRANCE))) + if (gSaveBlock1.location.mapGroup == MAP_GROUP(MAP_ROUTE110_SEASIDE_CYCLING_ROAD_SOUTH_ENTRANCE) + && (gSaveBlock1.location.mapNum == MAP_NUM(MAP_ROUTE110_SEASIDE_CYCLING_ROAD_SOUTH_ENTRANCE) + || gSaveBlock1.location.mapNum == MAP_NUM(MAP_ROUTE110_SEASIDE_CYCLING_ROAD_NORTH_ENTRANCE))) return TRUE; // is player indoor, in a secret base, or underwater? @@ -766,11 +766,11 @@ bool32 Overworld_IsBikingAllowed(void) return FALSE; // Thou shalt not bike on the sacred resting grounds of Kyogre/Groudon. - if (gSaveBlock1.location.mapGroup == MAP_GROUP(SEAFLOOR_CAVERN_ROOM9) - && gSaveBlock1.location.mapNum == MAP_NUM(SEAFLOOR_CAVERN_ROOM9)) + if (gSaveBlock1.location.mapGroup == MAP_GROUP(MAP_SEAFLOOR_CAVERN_ROOM9) + && gSaveBlock1.location.mapNum == MAP_NUM(MAP_SEAFLOOR_CAVERN_ROOM9)) return FALSE; - if (gSaveBlock1.location.mapGroup == MAP_GROUP(CAVE_OF_ORIGIN_B4F) - && gSaveBlock1.location.mapNum == MAP_NUM(CAVE_OF_ORIGIN_B4F)) + if (gSaveBlock1.location.mapGroup == MAP_GROUP(MAP_CAVE_OF_ORIGIN_B4F) + && gSaveBlock1.location.mapNum == MAP_NUM(MAP_CAVE_OF_ORIGIN_B4F)) return FALSE; return TRUE; @@ -812,16 +812,16 @@ static bool16 ShouldLegendaryMusicPlayAtLocation(struct WarpData *warp) { switch (warp->mapNum) { - case MAP_NUM(LILYCOVE_CITY): - case MAP_NUM(MOSSDEEP_CITY): - case MAP_NUM(SOOTOPOLIS_CITY): - case MAP_NUM(EVER_GRANDE_CITY): + case MAP_NUM(MAP_LILYCOVE_CITY): + case MAP_NUM(MAP_MOSSDEEP_CITY): + case MAP_NUM(MAP_SOOTOPOLIS_CITY): + case MAP_NUM(MAP_EVER_GRANDE_CITY): return TRUE; - case MAP_NUM(ROUTE124): - case MAP_NUM(ROUTE125): - case MAP_NUM(ROUTE126): - case MAP_NUM(ROUTE127): - case MAP_NUM(ROUTE128): + case MAP_NUM(MAP_ROUTE124): + case MAP_NUM(MAP_ROUTE125): + case MAP_NUM(MAP_ROUTE126): + case MAP_NUM(MAP_ROUTE127): + case MAP_NUM(MAP_ROUTE128): return TRUE; } } @@ -832,10 +832,10 @@ static bool16 IsInfiltratedWeatherInstitute(struct WarpData *warp) { if (VarGet(VAR_WEATHER_INSTITUTE_STATE)) return FALSE; - if (warp->mapGroup != MAP_GROUP(ROUTE119_WEATHER_INSTITUTE_1F)) + if (warp->mapGroup != MAP_GROUP(MAP_ROUTE119_WEATHER_INSTITUTE_1F)) return FALSE; - if (warp->mapNum == MAP_NUM(ROUTE119_WEATHER_INSTITUTE_1F) - || warp->mapNum == MAP_NUM(ROUTE119_WEATHER_INSTITUTE_2F)) + if (warp->mapNum == MAP_NUM(MAP_ROUTE119_WEATHER_INSTITUTE_1F) + || warp->mapNum == MAP_NUM(MAP_ROUTE119_WEATHER_INSTITUTE_2F)) return TRUE; return FALSE; } @@ -855,8 +855,8 @@ u16 GetCurrLocationDefaultMusic(void) u16 music; // Play the desert music only when the sandstorm is active on Route 111. - if (gSaveBlock1.location.mapGroup == MAP_GROUP(ROUTE111) - && gSaveBlock1.location.mapNum == MAP_NUM(ROUTE111) + if (gSaveBlock1.location.mapGroup == MAP_GROUP(MAP_ROUTE111) + && gSaveBlock1.location.mapNum == MAP_NUM(MAP_ROUTE111) && GetSav1Weather() == 8) return MUS_ROUTE111; @@ -883,8 +883,8 @@ u16 GetWarpDestinationMusic(void) } else { - if (gSaveBlock1.location.mapGroup == MAP_GROUP(MAUVILLE_CITY) - && gSaveBlock1.location.mapNum == MAP_NUM(MAUVILLE_CITY)) + if (gSaveBlock1.location.mapGroup == MAP_GROUP(MAP_MAUVILLE_CITY) + && gSaveBlock1.location.mapNum == MAP_NUM(MAP_MAUVILLE_CITY)) return MUS_ROUTE110; else return MUS_ROUTE119; @@ -1038,8 +1038,8 @@ void UpdateAmbientCry(s16 *state, u16 *delayCounter) static void ChooseAmbientCrySpecies(void) { - if ((gSaveBlock1.location.mapGroup == MAP_GROUP(ROUTE130) - && gSaveBlock1.location.mapNum == MAP_NUM(ROUTE130)) + if ((gSaveBlock1.location.mapGroup == MAP_GROUP(MAP_ROUTE130) + && gSaveBlock1.location.mapNum == MAP_NUM(MAP_ROUTE130)) && !IsMirageIslandPresent()) { // Only play water pokemon cries on this route @@ -1298,7 +1298,7 @@ void debug_sub_8058C00(void) ScriptContext1_Init(); ScriptContext2_Disable(); - if (gMain.heldKeys & R_BUTTON) + if (JOY_HELD(R_BUTTON)) gFieldCallback = ExecuteTruckSequence; else gFieldCallback = sub_8080B60; @@ -1467,7 +1467,7 @@ void CB2_ContinueSavedGame(void) FieldClearVBlankHBlankCallbacks(); StopMapMusic(); #if DEBUG - if (gMain.heldKeys & R_BUTTON) + if (JOY_HELD(R_BUTTON)) gUnknown_020297ED = TRUE; #endif ResetSafariZoneFlag_(); @@ -2075,27 +2075,27 @@ void sub_8055280(u16 a1) u16 sub_80552B0(u32 a1) { - if (gMain.heldKeys & DPAD_UP) + if (JOY_HELD(DPAD_UP)) { return 19; } - else if (gMain.heldKeys & DPAD_DOWN) + else if (JOY_HELD(DPAD_DOWN)) { return 18; } - else if (gMain.heldKeys & DPAD_LEFT) + else if (JOY_HELD(DPAD_LEFT)) { return 20; } - else if (gMain.heldKeys & DPAD_RIGHT) + else if (JOY_HELD(DPAD_RIGHT)) { return 21; } - else if (gMain.newKeys & START_BUTTON) + else if (JOY_NEW(START_BUTTON)) { return 24; } - else if (gMain.newKeys & A_BUTTON) + else if (JOY_NEW(A_BUTTON)) { return 25; } @@ -2207,7 +2207,7 @@ u16 sub_8055468(u32 a1) u16 sub_805546C(u32 linkPlayerId) { - if (gUnknown_03000580[linkPlayerId] == 0x82 && (gMain.newKeys & B_BUTTON)) + if (gUnknown_03000580[linkPlayerId] == 0x82 && JOY_NEW(B_BUTTON)) { sub_80543DC(sub_8055468); return 29; diff --git a/src/party_menu.c b/src/party_menu.c index c326073ae..fe825d009 100644 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -1225,14 +1225,14 @@ u16 HandleDefaultPartyMenuInput(u8 taskId) ChangePartyMenuSelection(taskId, menuDirectionPressed); return gMain.newAndRepeatedKeys; } - else if ((gMain.newKeys & A_BUTTON) && gSprites[sub_806CA00(taskId)].data[0] == 7) + else if (JOY_NEW(A_BUTTON) && gSprites[sub_806CA00(taskId)].data[0] == 7) { // Selected "CANCEL" return B_BUTTON; } else { - return gMain.newKeys & (A_BUTTON | B_BUTTON); + return JOY_NEW(A_BUTTON | B_BUTTON); } } @@ -1269,7 +1269,7 @@ u16 HandleBattleTowerPartyMenuInput(u8 taskId) } } - if (gMain.newKeys & START_BUTTON) + if (JOY_NEW(START_BUTTON)) { SelectBattleTowerOKButton(taskId); return START_BUTTON; @@ -1284,7 +1284,7 @@ u16 HandleBattleTowerPartyMenuInput(u8 taskId) } else { - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { if (gSprites[sub_806CA00(taskId)].data[0] == 7) return B_BUTTON; @@ -1292,7 +1292,7 @@ u16 HandleBattleTowerPartyMenuInput(u8 taskId) } } - return gMain.newKeys & (A_BUTTON | B_BUTTON); + return JOY_NEW(A_BUTTON | B_BUTTON); } void task_pc_turn_off(const u8 *a, u8 b) @@ -1836,7 +1836,7 @@ void HandlePartyMenuSwitchPokemonInput(u8 taskId) break; } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { PlaySE(5); gTasks[taskId].func = ePartyMenu.unkC; @@ -3285,7 +3285,7 @@ void Task_TeamMonTMMove4(u8 taskId) { if (IsFanfareTaskInactive()) { - if ((gMain.newKeys & A_BUTTON) || (gMain.newKeys & B_BUTTON)) + if (JOY_NEW(A_BUTTON) || JOY_NEW(B_BUTTON)) { SetHeldItemIconVisibility(gPartyMenu.unk4, gPartyMenu.primarySelectedMonIndex); if (ePartyMenu2.pmUnk282 == 1) @@ -3866,21 +3866,21 @@ void CreateItemUseMoveMenu(u8 partyMonIndex) void Task_HandleItemUseMoveMenuInput(u8 taskId) { - if (gMain.newKeys & DPAD_UP) + if (JOY_NEW(DPAD_UP)) { PlaySE(SE_SELECT); Menu_MoveCursor(-1); } - else if (gMain.newKeys & DPAD_DOWN) + else if (JOY_NEW(DPAD_DOWN)) { PlaySE(SE_SELECT); Menu_MoveCursor(1); } - else if (gMain.newKeys & A_BUTTON) + else if (JOY_NEW(A_BUTTON)) { gUnknown_08376B54[0](taskId); } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); gUnknown_08376B54[1](taskId); @@ -4044,7 +4044,7 @@ void Task_RareCandy1(u8 taskId) { if (WaitFanfare(0) && gPartyMenuMessage_IsPrinting == 0) { - if ((gMain.newKeys & A_BUTTON) || (gMain.newKeys & B_BUTTON)) + if (JOY_NEW(A_BUTTON) || JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); PrintStatGrowthsInLevelUpWindow(taskId); @@ -4055,7 +4055,7 @@ void Task_RareCandy1(u8 taskId) void Task_RareCandy2(u8 taskId) { - if ((gMain.newKeys & A_BUTTON) || (gMain.newKeys & B_BUTTON)) + if (JOY_NEW(A_BUTTON) || JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); PrintNewStatsInLevelUpWindow(taskId); @@ -4161,7 +4161,7 @@ void Task_RareCandy3(u8 taskId) { if (WaitFanfare(0)) { - if ((gMain.newKeys & A_BUTTON) || (gMain.newKeys & B_BUTTON)) + if (JOY_NEW(A_BUTTON) || JOY_NEW(B_BUTTON)) { u16 learnedMove; u16 evolutionSpecies; diff --git a/src/player_pc.c b/src/player_pc.c index f7c2379cd..c4d922c77 100644 --- a/src/player_pc.c +++ b/src/player_pc.c @@ -225,23 +225,23 @@ static void InitPlayerPCMenu(u8 taskId) static void PlayerPCProcessMenuInput(u8 taskId) { - if (gMain.newAndRepeatedKeys & DPAD_UP) + if (JOY_REPT(DPAD_UP)) { PlaySE(SE_SELECT); Menu_MoveCursor(-1); } - else if (gMain.newAndRepeatedKeys & DPAD_DOWN) + else if (JOY_REPT(DPAD_DOWN)) { PlaySE(SE_SELECT); Menu_MoveCursor(1); } - else if (gMain.newKeys & A_BUTTON) + else if (JOY_NEW(A_BUTTON)) { Menu_DestroyCursor(); PlaySE(SE_SELECT); sPlayerPCMenuActions[gPcItemMenuOptionOrder[Menu_GetCursorPos()]].func(taskId); } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { Menu_DestroyCursor(); PlaySE(SE_SELECT); @@ -320,24 +320,24 @@ static void ItemStorageMenuPrint(const u8 *textPtr) static void ItemStorageMenuProcessInput(u8 var) { - if (gMain.newAndRepeatedKeys & DPAD_UP) + if (JOY_REPT(DPAD_UP)) { PlaySE(SE_SELECT); Menu_MoveCursor(-1); ItemStorageMenuPrint(gPCText_OptionDescList[Menu_GetCursorPos()]); } - else if (gMain.newAndRepeatedKeys & DPAD_DOWN) + else if (JOY_REPT(DPAD_DOWN)) { PlaySE(SE_SELECT); Menu_MoveCursor(1); ItemStorageMenuPrint(gPCText_OptionDescList[Menu_GetCursorPos()]); } - else if (gMain.newKeys & A_BUTTON) + else if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); gPCText_ItemPCOptionsText[Menu_GetCursorPos()].func(var); } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { Menu_DestroyCursor(); PlaySE(SE_SELECT); @@ -445,7 +445,7 @@ static void ItemStorage_ProcessInput(u8 taskId) s16 *data = TASK.data; s16 trueIndex; - if (gMain.newAndRepeatedKeys & DPAD_UP) + if (JOY_REPT(DPAD_UP)) { if(PAGE_INDEX != 0) // did the cursor move physically upwards? { @@ -477,7 +477,7 @@ static void ItemStorage_ProcessInput(u8 taskId) Menu_MoveCursor(0); // don't move the cursor. it's at the top of the page index, but not the true index. } } - else if(gMain.newAndRepeatedKeys & DPAD_DOWN) // _0813A306 + else if (JOY_REPT(DPAD_DOWN)) // _0813A306 { if(PAGE_INDEX != NUM_PAGE_ITEMS - 1) { @@ -503,7 +503,7 @@ static void ItemStorage_ProcessInput(u8 taskId) Menu_MoveCursor(0); } } - else if(gMain.newKeys & SELECT_BUTTON) // _0813A3A0 + else if (JOY_NEW(SELECT_BUTTON)) // _0813A3A0 { if (SWITCH_MODE_ACTIVE == FALSE) { @@ -524,7 +524,7 @@ static void ItemStorage_ProcessInput(u8 taskId) ItemStorage_DrawBothListAndDescription(taskId); } } - else if(gMain.newKeys & A_BUTTON) + else if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); if(SWITCH_MODE_ACTIVE == FALSE) @@ -544,7 +544,7 @@ static void ItemStorage_ProcessInput(u8 taskId) ItemStorage_DrawBothListAndDescription(taskId); } } - else if(gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); if(SWITCH_MODE_ACTIVE == FALSE) @@ -613,7 +613,7 @@ static void ItemStorage_HandleQuantityRolling(u8 taskId) s16 *data = TASK.data; u8 trueIndex = PAGE_INDEX + ITEMS_ABOVE_TOP; - if(gMain.newAndRepeatedKeys & DPAD_UP) + if (JOY_REPT(DPAD_UP)) { if(NUM_QUANTITY_ROLLER != gSaveBlock1.pcItems[trueIndex].quantity) NUM_QUANTITY_ROLLER++; @@ -622,7 +622,7 @@ static void ItemStorage_HandleQuantityRolling(u8 taskId) sub_80A418C(NUM_QUANTITY_ROLLER, STR_CONV_MODE_RIGHT_ALIGN, 8, 9, 3); // print quantity? } - else if(gMain.newAndRepeatedKeys & DPAD_DOWN) + else if (JOY_REPT(DPAD_DOWN)) { if(NUM_QUANTITY_ROLLER != 1) NUM_QUANTITY_ROLLER--; @@ -631,7 +631,7 @@ static void ItemStorage_HandleQuantityRolling(u8 taskId) sub_80A418C(NUM_QUANTITY_ROLLER, STR_CONV_MODE_RIGHT_ALIGN, 8, 9, 3); // print quantity? } - else if(gMain.newAndRepeatedKeys & DPAD_LEFT) // reduce by 10. + else if (JOY_REPT(DPAD_LEFT)) // reduce by 10. { NUM_QUANTITY_ROLLER -= 10; @@ -640,7 +640,7 @@ static void ItemStorage_HandleQuantityRolling(u8 taskId) sub_80A418C(NUM_QUANTITY_ROLLER, STR_CONV_MODE_RIGHT_ALIGN, 8, 9, 3); // print quantity? } - else if(gMain.newAndRepeatedKeys & DPAD_RIGHT) // add 10. + else if (JOY_REPT(DPAD_RIGHT)) // add 10. { NUM_QUANTITY_ROLLER += 10; @@ -649,7 +649,7 @@ static void ItemStorage_HandleQuantityRolling(u8 taskId) sub_80A418C(NUM_QUANTITY_ROLLER, STR_CONV_MODE_RIGHT_ALIGN, 8, 9, 3); // print quantity? } - else if(gMain.newKeys & A_BUTTON) // confirm quantity. + else if (JOY_NEW(A_BUTTON)) // confirm quantity. { PlaySE(SE_SELECT); Menu_EraseWindowRect(6, 6, 0xD, 0xB); @@ -659,7 +659,7 @@ static void ItemStorage_HandleQuantityRolling(u8 taskId) else ItemStorage_DoItemToss(taskId); } - else if(gMain.newKeys & B_BUTTON) // cancel quantity. + else if (JOY_NEW(B_BUTTON)) // cancel quantity. { PlaySE(SE_SELECT); Menu_EraseWindowRect(6, 6, 0xD, 0xB); @@ -735,7 +735,7 @@ static void ItemStorage_HandleRemoveItem(u8 taskId) s16 *data = TASK.data; s16 oldNumItems; - if(gMain.newKeys & A_BUTTON || gMain.newKeys == B_BUTTON) + if (JOY_NEW(A_BUTTON) || gMain.newKeys == B_BUTTON) { RemovePCItem(PAGE_INDEX + ITEMS_ABOVE_TOP, NUM_QUANTITY_ROLLER); oldNumItems = NUM_ITEMS; @@ -754,7 +754,7 @@ static void ItemStorage_WaitPressHandleResumeProcessInput(u8 taskId) { s16 *data = TASK.data; - if(gMain.newKeys & A_BUTTON || gMain.newKeys == B_BUTTON) + if (JOY_NEW(A_BUTTON) || gMain.newKeys == B_BUTTON) { ItemStorage_PrintItemPcResponse(gSaveBlock1.pcItems[ITEMS_ABOVE_TOP + PAGE_INDEX].itemId); StartVerticalScrollIndicators(TOP_ARROW); @@ -1082,7 +1082,7 @@ static void Mailbox_ProcessInput(u8 taskId) { if(!gPaletteFade.active) { - if(gMain.newAndRepeatedKeys & DPAD_UP) + if (JOY_REPT(DPAD_UP)) { if(eMailboxInfo.cursorPos != 0) { @@ -1096,7 +1096,7 @@ static void Mailbox_ProcessInput(u8 taskId) Mailbox_DrawMailList(taskId); } } - else if(gMain.newAndRepeatedKeys & DPAD_DOWN) + else if (JOY_REPT(DPAD_DOWN)) { if(eMailboxInfo.cursorPos != eMailboxInfo.pageItems - 1) { @@ -1110,7 +1110,7 @@ static void Mailbox_ProcessInput(u8 taskId) Mailbox_DrawMailList(taskId); } } - else if(gMain.newKeys & A_BUTTON) + else if (JOY_NEW(A_BUTTON)) { Menu_DestroyCursor(); PlaySE(SE_SELECT); @@ -1125,7 +1125,7 @@ static void Mailbox_ProcessInput(u8 taskId) TASK.FUNC = Mailbox_PrintWhatToDoWithPlayerMailText; } } - else if(gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { Menu_DestroyCursor(); PlaySE(SE_SELECT); @@ -1172,22 +1172,22 @@ static void Mailbox_PrintMailOptions(u8 taskId) // Mailbox_PrintMailOptions static void Mailbox_MailOptionsProcessInput(u8 taskId) { - if(gMain.newAndRepeatedKeys & DPAD_UP) + if (JOY_REPT(DPAD_UP)) { PlaySE(SE_SELECT); Menu_MoveCursor(-1); } - else if(gMain.newAndRepeatedKeys & DPAD_DOWN) + else if (JOY_REPT(DPAD_DOWN)) { PlaySE(SE_SELECT); Menu_MoveCursor(1); } - else if(gMain.newKeys & A_BUTTON) + else if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); gMailboxMailOptions[Menu_GetCursorPos()].func(taskId); } - else if(gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); Mailbox_Cancel(taskId); diff --git a/src/pokeblock.c b/src/pokeblock.c index 5a0ea0810..cad0a211b 100644 --- a/src/pokeblock.c +++ b/src/pokeblock.c @@ -635,7 +635,7 @@ static void sub_810BF7C(u8 taskId) { if (!gPaletteFade.active) { - if (gMain.newAndRepeatedKeys & DPAD_UP) + if (JOY_REPT(DPAD_UP)) { if (gUnknown_02039248.unk0 != 0) { @@ -650,7 +650,7 @@ static void sub_810BF7C(u8 taskId) sub_810BF38(FALSE); } } - else if (gMain.newAndRepeatedKeys & DPAD_DOWN) + else if (JOY_REPT(DPAD_DOWN)) { if (gUnknown_02039248.unk0 != gUnknown_02039248.unk3) { @@ -665,7 +665,7 @@ static void sub_810BF7C(u8 taskId) sub_810BF38(FALSE); } } - else if (gMain.newKeys & SELECT_BUTTON) + else if (JOY_NEW(SELECT_BUTTON)) { if (gUnknown_02039248.unk1 + gUnknown_02039248.unk0 != gUnknown_02039248.unk2) { @@ -675,7 +675,7 @@ static void sub_810BF7C(u8 taskId) gTasks[taskId].func = sub_810C0C8; } } - else if (gMain.newKeys & A_BUTTON) + else if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); if (gUnknown_02039248.unk1 + gUnknown_02039248.unk0 == gUnknown_02039248.unk2) @@ -688,7 +688,7 @@ static void sub_810BF7C(u8 taskId) sub_810C368(taskId); } } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); gSpecialVar_Result = 0xffff; @@ -699,7 +699,7 @@ static void sub_810BF7C(u8 taskId) static void sub_810C0C8(u8 taskId) { - if (gMain.newAndRepeatedKeys & DPAD_UP) + if (JOY_REPT(DPAD_UP)) { if (gUnknown_02039248.unk0 != 0) { @@ -717,7 +717,7 @@ static void sub_810C0C8(u8 taskId) sub_810C1C8(taskId, 1); } } - else if (gMain.newAndRepeatedKeys & DPAD_DOWN) + else if (JOY_REPT(DPAD_DOWN)) { if (gUnknown_02039248.unk0 != gUnknown_02039248.unk3) { @@ -735,14 +735,14 @@ static void sub_810C0C8(u8 taskId) sub_810C1C8(taskId, 1); } } - else if (gMain.newKeys & A_BUTTON || gMain.newKeys & SELECT_BUTTON) + else if (JOY_NEW(A_BUTTON) || JOY_NEW(SELECT_BUTTON)) { PlaySE(SE_SELECT); sub_810C1C8(taskId, 0); sub_810C23C(taskId); gTasks[taskId].func = sub_810BF7C; } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); sub_810C1C8(taskId, 0); @@ -838,7 +838,7 @@ static void sub_810C368(u8 taskId) static void sub_810C40C(u8 taskId) { - if (gMain.newAndRepeatedKeys & DPAD_UP) + if (JOY_REPT(DPAD_UP)) { if (Menu_GetCursorPos()) { @@ -846,7 +846,7 @@ static void sub_810C40C(u8 taskId) Menu_MoveCursor(-1); } } - else if (gMain.newAndRepeatedKeys & DPAD_DOWN) + else if (JOY_REPT(DPAD_DOWN)) { if (Menu_GetCursorPos() != gUnknown_0203924C - 1) { @@ -854,12 +854,12 @@ static void sub_810C40C(u8 taskId) Menu_MoveCursor(+1); } } - else if (gMain.newKeys & A_BUTTON) + else if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); gUnknown_083F7EF4[gUnknown_03000758[Menu_GetCursorPos()]].func(taskId); } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); sub_810C748(taskId); @@ -930,7 +930,7 @@ static void sub_810C668(u8 taskId) static void sub_810C6DC(u8 taskId) { - if (gMain.newKeys & A_BUTTON || gMain.newKeys & B_BUTTON) + if (JOY_NEW(A_BUTTON) || JOY_NEW(B_BUTTON)) { sub_810C668(taskId); } diff --git a/src/pokedex.c b/src/pokedex.c index 105a1a2cf..a0270b5b2 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -1510,7 +1510,7 @@ void Task_PokedexMainScreen(u8 taskId) gPokedexView->menuY -= 8; else { - if ((gMain.newKeys & A_BUTTON) && gPokedexView->pokedexList[gPokedexView->selectedPokemon].seen) + if (JOY_NEW(A_BUTTON) && gPokedexView->pokedexList[gPokedexView->selectedPokemon].seen) { UpdateSelectedMonSpriteId(); BeginNormalPaletteFade( @@ -1520,7 +1520,7 @@ void Task_PokedexMainScreen(u8 taskId) gTasks[taskId].func = Task_OpenInfoScreenAfterMonMovement; PlaySE(SE_PIN); } - else if (gMain.newKeys & START_BUTTON) + else if (JOY_NEW(START_BUTTON)) { //Open menu gPokedexView->menuY = 0; @@ -1529,7 +1529,7 @@ void Task_PokedexMainScreen(u8 taskId) gTasks[taskId].func = Task_PokedexMainScreenMenu; PlaySE(SE_SELECT); } - else if (gMain.newKeys & SELECT_BUTTON) + else if (JOY_NEW(SELECT_BUTTON)) { PlaySE(SE_SELECT); BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB(0, 0, 0)); @@ -1542,7 +1542,7 @@ void Task_PokedexMainScreen(u8 taskId) gTasks[taskId].func = Task_WaitForExitSearch; PlaySE(SE_PC_LOGIN); } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB(0, 0, 0)); gTasks[taskId].func = Task_ClosePokedex; @@ -1576,7 +1576,7 @@ static void Task_PokedexMainScreenMenu(u8 taskId) gPokedexView->menuY += 8; else { - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { switch (gPokedexView->menuCursorPos) { @@ -1607,18 +1607,18 @@ static void Task_PokedexMainScreenMenu(u8 taskId) } //Exit menu when Start or B is pressed - if (gMain.newKeys & (START_BUTTON | B_BUTTON)) + if (JOY_NEW(START_BUTTON | B_BUTTON)) { gPokedexView->menuIsOpen = 0; gTasks[taskId].func = Task_PokedexMainScreen; PlaySE(SE_SELECT); } - else if ((gMain.newAndRepeatedKeys & DPAD_UP) && gPokedexView->menuCursorPos != 0) + else if (JOY_REPT(DPAD_UP) && gPokedexView->menuCursorPos != 0) { gPokedexView->menuCursorPos--; PlaySE(SE_SELECT); } - else if ((gMain.newAndRepeatedKeys & DPAD_DOWN) && gPokedexView->menuCursorPos <= 2) + else if (JOY_REPT(DPAD_DOWN) && gPokedexView->menuCursorPos <= 2) { gPokedexView->menuCursorPos++; PlaySE(SE_SELECT); @@ -1708,7 +1708,7 @@ static void Task_PokedexResultsScreen(u8 taskId) } else { - if ((gMain.newKeys & A_BUTTON) && gPokedexView->pokedexList[gPokedexView->selectedPokemon].seen) + if (JOY_NEW(A_BUTTON) && gPokedexView->pokedexList[gPokedexView->selectedPokemon].seen) { u32 excludedPalettes; @@ -1719,7 +1719,7 @@ static void Task_PokedexResultsScreen(u8 taskId) gTasks[taskId].func = Task_OpenSearchResultsInfoScreenAfterMonMovement; PlaySE(SE_PIN); } - else if (gMain.newKeys & START_BUTTON) + else if (JOY_NEW(START_BUTTON)) { gPokedexView->menuY = 0; gPokedexView->menuIsOpen = 1; @@ -1727,7 +1727,7 @@ static void Task_PokedexResultsScreen(u8 taskId) gTasks[taskId].func = Task_PokedexResultsScreenMenu; PlaySE(SE_SELECT); } - else if (gMain.newKeys & SELECT_BUTTON) + else if (JOY_NEW(SELECT_BUTTON)) { BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB(0, 0, 0)); gTasks[taskId].data[0] = LoadSearchMenu(); @@ -1735,7 +1735,7 @@ static void Task_PokedexResultsScreen(u8 taskId) gTasks[taskId].func = Task_WaitForExitSearch; PlaySE(SE_PC_LOGIN); } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB(0, 0, 0)); gTasks[taskId].func = Task_PokedexResultsScreenReturnToMainScreen; @@ -1769,7 +1769,7 @@ static void Task_PokedexResultsScreenMenu(u8 taskId) } else { - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { switch (gPokedexView->menuCursorPos) { @@ -1805,18 +1805,18 @@ static void Task_PokedexResultsScreenMenu(u8 taskId) } //Exit menu when Start or B is pressed - if (gMain.newKeys & (START_BUTTON | B_BUTTON)) + if (JOY_NEW(START_BUTTON | B_BUTTON)) { gPokedexView->menuIsOpen = 0; gTasks[taskId].func = Task_PokedexResultsScreen; PlaySE(SE_SELECT); } - else if ((gMain.newAndRepeatedKeys & DPAD_UP) && gPokedexView->menuCursorPos) + else if (JOY_REPT(DPAD_UP) && gPokedexView->menuCursorPos) { gPokedexView->menuCursorPos--; PlaySE(SE_SELECT); } - else if ((gMain.newAndRepeatedKeys & DPAD_DOWN) && gPokedexView->menuCursorPos <= 3) + else if (JOY_REPT(DPAD_DOWN) && gPokedexView->menuCursorPos <= 3) { gPokedexView->menuCursorPos++; PlaySE(SE_SELECT); @@ -2397,13 +2397,13 @@ static u16 TryDoPokedexScroll(u16 a, u16 b) u16 r6; u8 r10 = 0; - if (!((gMain.heldKeys & 0x40) && (a > 0))) + if (!(JOY_HELD(DPAD_UP) && (a > 0))) { //_0808E4B6 - if (!((gMain.heldKeys & 0x80) && (a < gPokedexView->pokemonListCount - 1))) + if (!(JOY_HELD(DPAD_DOWN) && (a < gPokedexView->pokemonListCount - 1))) //_0808E4CE { - if ((gMain.newKeys & 0x20) && (a > 0)) + if (JOY_NEW(DPAD_LEFT) && (a > 0)) { r6 = a; //_0808E4E0 @@ -2415,7 +2415,7 @@ static u16 TryDoPokedexScroll(u16 a, u16 b) PlaySE(0x6D); } //_0808E53C - else if ((gMain.newKeys & 0x10) && (a < gPokedexView->pokemonListCount - 1)) + else if (JOY_NEW(DPAD_RIGHT) && (a < gPokedexView->pokemonListCount - 1)) { r6 = a; for (i = 0; i < 7; i++) @@ -2489,7 +2489,7 @@ static u8 TryDoInfoScreenScroll(void) u16 r2; u16 r4 = gPokedexView->selectedPokemon; - if ((gMain.newKeys & DPAD_UP) && r4) + if (JOY_NEW(DPAD_UP) && r4) { r2 = r4; while (r2 != 0) @@ -2512,7 +2512,7 @@ static u8 TryDoInfoScreenScroll(void) return 1; } } - else if ((gMain.newKeys & DPAD_DOWN) && r4 < gPokedexView->pokemonListCount - 1) + else if (JOY_NEW(DPAD_DOWN) && r4 < gPokedexView->pokemonListCount - 1) { r2 = r4; while (r2 < gPokedexView->pokemonListCount - 1) @@ -3023,14 +3023,14 @@ static void Task_PageScreenProcessInput(u8 taskId) PlaySE(SE_DEX_SCROLL); return; } - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB(0, 0, 0)); gTasks[taskId].func = Task_ClosePageScreen; PlaySE(SE_PC_OFF); return; } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { switch (gPokedexView->selectedScreen) { @@ -3062,8 +3062,8 @@ static void Task_PageScreenProcessInput(u8 taskId) } return; } - if (((gMain.newKeys & DPAD_LEFT) - || ((gMain.newKeys & L_BUTTON) && gSaveBlock2.optionsButtonMode == OPTIONS_BUTTON_MODE_LR)) + if ((JOY_NEW(DPAD_LEFT) + || (JOY_NEW(L_BUTTON) && gSaveBlock2.optionsButtonMode == OPTIONS_BUTTON_MODE_LR)) && gPokedexView->selectedScreen > 0) { gPokedexView->selectedScreen--; @@ -3071,8 +3071,8 @@ static void Task_PageScreenProcessInput(u8 taskId) PlaySE(SE_DEX_PAGE); return; } - if (((gMain.newKeys & DPAD_RIGHT) - || ((gMain.newKeys & R_BUTTON) && gSaveBlock2.optionsButtonMode == OPTIONS_BUTTON_MODE_LR)) + if ((JOY_NEW(DPAD_RIGHT) + || (JOY_NEW(R_BUTTON) && gSaveBlock2.optionsButtonMode == OPTIONS_BUTTON_MODE_LR)) && gPokedexView->selectedScreen < 3) { gPokedexView->selectedScreen++; @@ -3258,7 +3258,7 @@ static void Task_CryScreenProcessInput(u8 taskId) else LoadPlayArrowPalette(0); - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { LoadPlayArrowPalette(1); CryScreenPlayButton(NationalPokedexNumToSpecies(sPokedexListItem->dexNum)); @@ -3266,7 +3266,7 @@ static void Task_CryScreenProcessInput(u8 taskId) } else if (!gPaletteFade.active) { - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { BeginNormalPaletteFade(0xFFFFFFEB, 0, 0, 16, RGB(0, 0, 0)); m4aMPlayContinue(&gMPlayInfo_BGM); @@ -3275,8 +3275,8 @@ static void Task_CryScreenProcessInput(u8 taskId) PlaySE(SE_PC_OFF); return; } - if ((gMain.newKeys & DPAD_LEFT) - || ((gMain.newKeys & L_BUTTON) && gSaveBlock2.optionsButtonMode == OPTIONS_BUTTON_MODE_LR)) + if (JOY_NEW(DPAD_LEFT) + || (JOY_NEW(L_BUTTON) && gSaveBlock2.optionsButtonMode == OPTIONS_BUTTON_MODE_LR)) { BeginNormalPaletteFade(0xFFFFFFEB, 0, 0, 16, RGB(0, 0, 0)); m4aMPlayContinue(&gMPlayInfo_BGM); @@ -3285,8 +3285,8 @@ static void Task_CryScreenProcessInput(u8 taskId) PlaySE(SE_DEX_PAGE); return; } - if ((gMain.newKeys & DPAD_RIGHT) - || ((gMain.newKeys & R_BUTTON) && gSaveBlock2.optionsButtonMode == OPTIONS_BUTTON_MODE_LR)) + if (JOY_NEW(DPAD_RIGHT) + || (JOY_NEW(R_BUTTON) && gSaveBlock2.optionsButtonMode == OPTIONS_BUTTON_MODE_LR)) { if (!sPokedexListItem->owned) { @@ -3430,15 +3430,15 @@ static void Task_InitSizeScreenMultistep(u8 taskId) static void Task_SizeScreenProcessInput(u8 taskId) { - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { BeginNormalPaletteFade(0xFFFFFFEB, 0, 0, 16, RGB(0, 0, 0)); gPokedexView->screenSwitchState = 1; gTasks[taskId].func = Task_SwitchScreensFromSizeScreen; PlaySE(SE_PC_OFF); } - else if ((gMain.newKeys & DPAD_LEFT) - || ((gMain.newKeys & L_BUTTON) && gSaveBlock2.optionsButtonMode == OPTIONS_BUTTON_MODE_LR)) + else if (JOY_NEW(DPAD_LEFT) + || (JOY_NEW(L_BUTTON) && gSaveBlock2.optionsButtonMode == OPTIONS_BUTTON_MODE_LR)) { BeginNormalPaletteFade(0xFFFFFFEB, 0, 0, 16, RGB(0, 0, 0)); gPokedexView->screenSwitchState = 2; @@ -3869,14 +3869,14 @@ static void sub_8090750(u8 taskId) static void sub_8090A3C(u8 taskId) { - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { BeginNormalPaletteFade(0xFFFC, 0, 0, 16, RGB(0, 0, 0)); gSprites[gTasks[taskId].data[3]].callback = sub_8090C28; gTasks[taskId].func = sub_8090B8C; return; } - else if (gMain.newKeys & A_BUTTON) + else if (JOY_NEW(A_BUTTON)) { if (gTasks[taskId].data[4] == 0) { @@ -4788,13 +4788,13 @@ static void Task_SwitchToSearchMenuTopBar(u8 taskId) static void Task_HandleSearchTopBarInput(u8 taskId) { - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { PlaySE(SE_PC_OFF); gTasks[taskId].func = Task_ExitSearch; return; } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { switch (gTasks[taskId].data[0]) { @@ -4815,13 +4815,13 @@ static void Task_HandleSearchTopBarInput(u8 taskId) } return; } - if ((gMain.newKeys & DPAD_LEFT) && gTasks[taskId].data[0] > 0) + if (JOY_NEW(DPAD_LEFT) && gTasks[taskId].data[0] > 0) { PlaySE(SE_DEX_PAGE); gTasks[taskId].data[0]--; HighlightSelectedSearchTopBarItem(gTasks[taskId].data[0]); } - if ((gMain.newKeys & DPAD_RIGHT) && gTasks[taskId].data[0] < 2) + if (JOY_NEW(DPAD_RIGHT) && gTasks[taskId].data[0] < 2) { PlaySE(SE_DEX_PAGE); gTasks[taskId].data[0]++; @@ -4855,14 +4855,14 @@ static void Task_HandleSearchMenuInput(u8 taskId) r6 = sSearchMovementMap_SearchNatDex; } - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { PlaySE(SE_BALL); SetDefaultSearchModeAndOrder(taskId); gTasks[taskId].func = Task_SwitchToSearchMenuTopBar; return; } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { if (gTasks[taskId].data[1] == 6) { @@ -4896,25 +4896,25 @@ static void Task_HandleSearchMenuInput(u8 taskId) return; } - if ((gMain.newKeys & DPAD_LEFT) && r6[gTasks[taskId].data[1]][0] != 0xFF) + if (JOY_NEW(DPAD_LEFT) && r6[gTasks[taskId].data[1]][0] != 0xFF) { PlaySE(SE_SELECT); gTasks[taskId].data[1] = r6[gTasks[taskId].data[1]][0]; HighlightSelectedSearchMenuItem(gTasks[taskId].data[0], gTasks[taskId].data[1]); } - if ((gMain.newKeys & DPAD_RIGHT) && r6[gTasks[taskId].data[1]][1] != 0xFF) + if (JOY_NEW(DPAD_RIGHT) && r6[gTasks[taskId].data[1]][1] != 0xFF) { PlaySE(SE_SELECT); gTasks[taskId].data[1] = r6[gTasks[taskId].data[1]][1]; HighlightSelectedSearchMenuItem(gTasks[taskId].data[0], gTasks[taskId].data[1]); } - if ((gMain.newKeys & DPAD_UP) && r6[gTasks[taskId].data[1]][2] != 0xFF) + if (JOY_NEW(DPAD_UP) && r6[gTasks[taskId].data[1]][2] != 0xFF) { PlaySE(SE_SELECT); gTasks[taskId].data[1] = r6[gTasks[taskId].data[1]][2]; HighlightSelectedSearchMenuItem(gTasks[taskId].data[0], gTasks[taskId].data[1]); } - if ((gMain.newKeys & DPAD_DOWN) && r6[gTasks[taskId].data[1]][3] != 0xFF) + if (JOY_NEW(DPAD_DOWN) && r6[gTasks[taskId].data[1]][3] != 0xFF) { PlaySE(SE_SELECT); gTasks[taskId].data[1] = r6[gTasks[taskId].data[1]][3]; @@ -4955,7 +4955,7 @@ static void Task_WaitAndCompleteSearch(u8 taskId) static void Task_SearchCompleteWaitForInput(u8 taskId) { - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { if (gPokedexView->pokemonListCount != 0) { @@ -5010,7 +5010,7 @@ static void Task_HandleSearchParameterInput(u8 taskId) p1 = (u16 *)&gTasks[taskId].data[sSearchOptions[r1].taskDataCursorPos]; p2 = (u16 *)&gTasks[taskId].data[sSearchOptions[r1].taskDataScrollOffset]; r2 = sSearchOptions[r1].numOptions - 1; - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { sub_814ADC8(); PlaySE(SE_PIN); @@ -5019,7 +5019,7 @@ static void Task_HandleSearchParameterInput(u8 taskId) gTasks[taskId].func = Task_SwitchToSearchMenu; return; } - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { sub_814ADC8(); PlaySE(SE_BALL); @@ -5031,7 +5031,7 @@ static void Task_HandleSearchParameterInput(u8 taskId) return; } r3 = FALSE; - if (gMain.newAndRepeatedKeys & DPAD_UP) + if (JOY_REPT(DPAD_UP)) { if (*p1 != 0) { @@ -5054,7 +5054,7 @@ static void Task_HandleSearchParameterInput(u8 taskId) } return; } - if (gMain.newAndRepeatedKeys & DPAD_DOWN) + if (JOY_REPT(DPAD_DOWN)) { if (*p1 < 5 && *p1 < r2) { diff --git a/src/pokedex_area_screen.c b/src/pokedex_area_screen.c index 1dbfdf6aa..abae23102 100644 --- a/src/pokedex_area_screen.c +++ b/src/pokedex_area_screen.c @@ -91,7 +91,7 @@ static const u8 gUnknown_083F8438[] = INCBIN_U8("graphics/pokedex/area_glow.4bpp static const u16 sSpeciesHiddenFromAreaScreen[] = {SPECIES_WYNAUT}; static const u16 sFeebasData[][3] = { - {SPECIES_FEEBAS, MAP_GROUP(ROUTE119), MAP_NUM(ROUTE119)}, + {SPECIES_FEEBAS, MAP_GROUP(MAP_ROUTE119), MAP_NUM(MAP_ROUTE119)}, {NUM_SPECIES} }; @@ -241,11 +241,11 @@ static void FindMapsWithMon(u16 mon) { switch (sFeebasData[i][1]) { - case MAP_GROUP(PETALBURG_CITY): + case MAP_GROUP(MAP_PETALBURG_CITY): SetAreaHasMon(sFeebasData[i][1], sFeebasData[i][2]); break; - case MAP_GROUP(METEOR_FALLS_1F_1R): - case MAP_GROUP(SAFARI_ZONE_NORTHWEST): + case MAP_GROUP(MAP_METEOR_FALLS_1F_1R): + case MAP_GROUP(MAP_SAFARI_ZONE_NORTHWEST): SetSpecialMapHasMon(sFeebasData[i][1], sFeebasData[i][2]); break; } @@ -257,11 +257,11 @@ static void FindMapsWithMon(u16 mon) { switch (gWildMonHeaders[i].mapGroup) { - case MAP_GROUP(PETALBURG_CITY): + case MAP_GROUP(MAP_PETALBURG_CITY): SetAreaHasMon(gWildMonHeaders[i].mapGroup, gWildMonHeaders[i].mapNum); break; - case MAP_GROUP(METEOR_FALLS_1F_1R): - case MAP_GROUP(SAFARI_ZONE_NORTHWEST): + case MAP_GROUP(MAP_METEOR_FALLS_1F_1R): + case MAP_GROUP(MAP_SAFARI_ZONE_NORTHWEST): SetSpecialMapHasMon(gWildMonHeaders[i].mapGroup, gWildMonHeaders[i].mapNum); break; } @@ -1142,11 +1142,11 @@ static void DebugCB_WaitButton(void) switch (gPokedexAreaScreenPtr->state) { case 0: - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { SetCallback(DebugCB_GoBack); } - else if (gMain.newKeys & DPAD_RIGHT || (gMain.newKeys & R_BUTTON && gSaveBlock2.optionsButtonMode == OPTIONS_BUTTON_MODE_LR)) + else if (JOY_NEW(DPAD_RIGHT) || (JOY_NEW(R_BUTTON) && gSaveBlock2.optionsButtonMode == OPTIONS_BUTTON_MODE_LR)) { SetCallback(DebugCB_GoNext); } @@ -1277,12 +1277,12 @@ static void Task_PokedexAreaScreen_1(u8 taskId) return; break; case 1: - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { gTasks[taskId].data[1] = 1; PlaySE(SE_PC_OFF); } - else if (gMain.newKeys & DPAD_RIGHT || (gMain.newKeys & R_BUTTON && gSaveBlock2.optionsButtonMode == OPTIONS_BUTTON_MODE_LR)) + else if (JOY_NEW(DPAD_RIGHT) || (JOY_NEW(R_BUTTON) && gSaveBlock2.optionsButtonMode == OPTIONS_BUTTON_MODE_LR)) { gTasks[taskId].data[1] = 2; PlaySE(SE_DEX_PAGE); diff --git a/src/pokemon_menu.c b/src/pokemon_menu.c index 1beace421..f1633fded 100644 --- a/src/pokemon_menu.c +++ b/src/pokemon_menu.c @@ -279,25 +279,25 @@ static void sub_8089D94(u8 taskID) { if (!gPaletteFade.active) { - if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_UP) + if (JOY_REPT(DPAD_ANY) == DPAD_UP) { PlaySE(SE_SELECT); sPokeMenuCursorPos = Menu_MoveCursor(-1); sub_808B5B4(taskID); } - else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_DOWN) + else if (JOY_REPT(DPAD_ANY) == DPAD_DOWN) { PlaySE(SE_SELECT); sPokeMenuCursorPos = Menu_MoveCursor(1); sub_808B5B4(taskID); } - else if (gMain.newKeys & A_BUTTON) + else if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); sPokemonMenuActions[sPokeMenuOptionsOrder[sPokeMenuCursorPos]].func(taskID); sub_808B5B4(taskID); } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { PokemonMenu_Cancel(taskID); sub_808B5B4(taskID); @@ -389,12 +389,12 @@ static void sub_808A060(u8 taskID) sPokeMenuCursorPos = Menu_MoveCursor(1); PlaySE(SE_SELECT); } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); PartyMenuGetPopupMenuFunc(0, &sUnknown_0839F578, sPokemonMenuActions, sPokeMenuCursorPos)(taskID); } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { ClosePartyPopupMenu(0, &sUnknown_0839F578); PokemonMenu_CancelSubmenu(taskID); @@ -644,12 +644,12 @@ static void sub_808A73C(u8 taskID) else sPokeMenuCursorPos = Menu_MoveCursor(1); } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); PartyMenuGetPopupMenuFunc(0, &sUnknown_0839F584, sPokemonMenuActions, sPokeMenuCursorPos)(taskID); } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { ClosePartyPopupMenu(0, &sUnknown_0839F584); PokemonMenu_Cancel(taskID); @@ -760,7 +760,7 @@ static void PokemonMenu_FieldMove(u8 taskID) static void sub_808AAF0(u8 taskID) { - if (gPartyMenuMessage_IsPrinting != 1 && (gMain.newKeys & A_BUTTON || gMain.newKeys & B_BUTTON)) + if (gPartyMenuMessage_IsPrinting != 1 && (JOY_NEW(A_BUTTON) || JOY_NEW(B_BUTTON))) { Menu_EraseWindowRect(0, 14, 29, 19); PokemonMenu_Cancel(taskID); @@ -799,7 +799,7 @@ static void FieldCallback_AfterFadeInFromMenu(u8 taskID) static void sub_808ABF4(u8 taskID) { - if (gMain.newKeys & A_BUTTON || gMain.newKeys & B_BUTTON) + if (JOY_NEW(A_BUTTON) || JOY_NEW(B_BUTTON)) { Menu_EraseWindowRect(1, 17, 28, 18); PokemonMenu_Cancel(taskID); diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index a2f384406..3bcaac984 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -268,10 +268,10 @@ void Task_PokemonStorageSystem(u8 taskId) { case -2: task->data[3] = task->data[1]; - if (gMain.newKeys & DPAD_UP && --task->data[3] < 0) + if (JOY_NEW(DPAD_UP) && --task->data[3] < 0) task->data[3] = 3; - if (gMain.newKeys & DPAD_DOWN && ++task->data[3] > 3) + if (JOY_NEW(DPAD_DOWN) && ++task->data[3] > 3) task->data[3] = 0; if (task->data[1] != task->data[3]) { @@ -310,13 +310,13 @@ void Task_PokemonStorageSystem(u8 taskId) } break; case 3: - if (gMain.newKeys & (A_BUTTON | B_BUTTON)) + if (JOY_NEW(A_BUTTON | B_BUTTON)) { StorageSystemClearMessageWindow(); Menu_PrintText(gUnknown_083B600C[task->data[1]].desc, 2, 15); task->data[0] = 2; } - else if (gMain.newKeys & DPAD_UP) + else if (JOY_NEW(DPAD_UP)) { if (--task->data[1] < 0) task->data[1] = 3; @@ -326,7 +326,7 @@ void Task_PokemonStorageSystem(u8 taskId) Menu_PrintText(gUnknown_083B600C[task->data[1]].desc, 2, 15); task->data[0] = 2; } - else if (gMain.newKeys & DPAD_DOWN) + else if (JOY_NEW(DPAD_DOWN)) { if (++task->data[1] > 3) task->data[1] = 0; @@ -612,22 +612,22 @@ void sub_809635C(void) u8 sub_8096368(void) { - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); return 201; } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); return gUnknown_02038478->curBox; } - if (gMain.newKeys & DPAD_LEFT) + if (JOY_NEW(DPAD_LEFT)) { PlaySE(SE_SELECT); sub_809662C(); } - else if (gMain.newKeys & DPAD_RIGHT) + else if (JOY_NEW(DPAD_RIGHT)) { PlaySE(SE_SELECT); sub_80965F8(); diff --git a/src/pokemon_storage_system_2.c b/src/pokemon_storage_system_2.c index 4ba25dd30..d19331904 100644 --- a/src/pokemon_storage_system_2.c +++ b/src/pokemon_storage_system_2.c @@ -579,7 +579,7 @@ void sub_8096C84(void) } break; case 3: - if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) { sub_8098A5C(); gPokemonStorageSystemPtr->unk_0004 = 0; @@ -596,7 +596,7 @@ void sub_8096C84(void) gPokemonStorageSystemPtr->unk_0004 = 6; break; case 6: - if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) { sub_8098A5C(); SetPSSCallback(sub_8096C84); @@ -766,7 +766,7 @@ void sub_8097078(void) gPokemonStorageSystemPtr->unk_0004 = 5; break; case 5: - if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) { sub_8098A5C(); SetPSSCallback(sub_8096C84); @@ -851,7 +851,7 @@ void sub_8097390(void) } break; case 1: - if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) { sub_8098A5C(); SetPSSCallback(sub_8096C84); @@ -938,7 +938,7 @@ void sub_809746C(void) } break; case 4: - if (gMain.newKeys & (A_BUTTON | B_BUTTON)) + if (JOY_NEW(A_BUTTON | B_BUTTON)) { PrintStorageActionText(PC_TEXT_DEPOSIT_IN_WHICH_BOX); gPokemonStorageSystemPtr->unk_0004 = 1; @@ -999,14 +999,14 @@ void sub_8097594(void) gPokemonStorageSystemPtr->unk_0004++; break; case 4: - if (gMain.newKeys & (A_BUTTON | B_BUTTON)) + if (JOY_NEW(A_BUTTON | B_BUTTON)) { PrintStorageActionText(PC_TEXT_BYE_BYE); gPokemonStorageSystemPtr->unk_0004++; } break; case 5: - if (gMain.newKeys & (A_BUTTON | B_BUTTON)) + if (JOY_NEW(A_BUTTON | B_BUTTON)) { sub_8098A5C(); if (gUnknown_0203847C) @@ -1038,14 +1038,14 @@ void sub_8097594(void) gPokemonStorageSystemPtr->unk_0004++; break; case 9: - if (gMain.newKeys & (A_BUTTON | B_BUTTON)) + if (JOY_NEW(A_BUTTON | B_BUTTON)) { PrintStorageActionText(PC_TEXT_SURPRISE); gPokemonStorageSystemPtr->unk_0004++; } break; case 10: - if (gMain.newKeys & (A_BUTTON | B_BUTTON)) + if (JOY_NEW(A_BUTTON | B_BUTTON)) { sub_8098A5C(); sub_8099958(); @@ -1061,14 +1061,14 @@ void sub_8097594(void) } break; case 12: - if (gMain.newKeys & (A_BUTTON | B_BUTTON)) + if (JOY_NEW(A_BUTTON | B_BUTTON)) { PrintStorageActionText(PC_TEXT_WORRIED); gPokemonStorageSystemPtr->unk_0004++; } break; case 13: - if (gMain.newKeys & (A_BUTTON | B_BUTTON)) + if (JOY_NEW(A_BUTTON | B_BUTTON)) { sub_8098A5C(); SetPSSCallback(sub_8096C84); @@ -1318,7 +1318,7 @@ void sub_8097BA0(void) } break; case 1: - if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) { sub_8098A5C(); SetPSSCallback(sub_8096C84); @@ -1377,7 +1377,7 @@ void sub_8097CC0(void) } break; case 1: - if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) { sub_8098A5C(); SetPSSCallback(sub_8096C84); diff --git a/src/pokemon_storage_system_4.c b/src/pokemon_storage_system_4.c index 48fdf425a..27c5bd1c5 100644 --- a/src/pokemon_storage_system_4.c +++ b/src/pokemon_storage_system_4.c @@ -2103,16 +2103,16 @@ u8 sub_809C85C(void) break; } - if (gMain.heldKeys & DPAD_LEFT) + if (JOY_HELD(DPAD_LEFT)) return 10; - if (gMain.heldKeys & DPAD_RIGHT) + if (JOY_HELD(DPAD_RIGHT)) return 9; if (gSaveBlock2.optionsButtonMode == OPTIONS_BUTTON_MODE_LR) { - if (gMain.heldKeys & L_BUTTON) + if (JOY_HELD(L_BUTTON)) return 10; - if (gMain.heldKeys & R_BUTTON) + if (JOY_HELD(R_BUTTON)) return 9; } diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 7d612d6b5..3b88f03be 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -32,6 +32,7 @@ #include "constants/items.h" #include "constants/songs.h" #include "constants/species.h" +#include "constants/region_map_sections.h" static void SummaryScreen_PrintPokemonInfoLabels(void); static void SummaryScreen_PrintPokemonSkillsLabels(void); @@ -941,30 +942,30 @@ static void SummaryScreenHandleKeyInput(u8 taskId) if (gPaletteFade.active) return; - if (gMain.newKeys & DPAD_UP) + if (JOY_NEW(DPAD_UP)) { SummaryScreenHandleUpDownInput(taskId, -1); } - else if (gMain.newKeys & DPAD_DOWN) + else if (JOY_NEW(DPAD_DOWN)) { SummaryScreenHandleUpDownInput(taskId, 1); } - else if ((gMain.newKeys & DPAD_LEFT) || sub_80F9284() == 1) + else if (JOY_NEW(DPAD_LEFT) || sub_80F9284() == 1) { SummaryScreenHandleLeftRightInput(taskId, -1); } - else if ((gMain.newKeys & DPAD_RIGHT) || sub_80F9284() == 2) + else if (JOY_NEW(DPAD_RIGHT) || sub_80F9284() == 2) { SummaryScreenHandleLeftRightInput(taskId, 1); } - else if (gMain.newKeys & A_BUTTON) + else if (JOY_NEW(A_BUTTON)) { if (pssData.page >= PSS_PAGE_BATTLE_MOVES) SummaryScreenHandleAButton(taskId); if (pssData.page == PSS_PAGE_INFO) SummaryScreenExit(taskId); } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { SummaryScreenExit(taskId); } @@ -975,23 +976,23 @@ static void sub_809E260(u8 taskId) if (gPaletteFade.active) return; - if (gMain.newKeys & DPAD_UP) + if (JOY_NEW(DPAD_UP)) { gTasks[taskId].data[0] = 4; sub_809E8F0(taskId, -1, &pssData.selectedMoveIndex); } - else if (gMain.newKeys & DPAD_DOWN) + else if (JOY_NEW(DPAD_DOWN)) { gTasks[taskId].data[0] = 4; sub_809E8F0(taskId, 1, &pssData.selectedMoveIndex); } - else if ((gMain.newKeys & DPAD_LEFT) || sub_80F9284() == 1) + else if (JOY_NEW(DPAD_LEFT) || sub_80F9284() == 1) { if (pssData.page == PSS_PAGE_CONTEST_MOVES && (pssData.selectedMoveIndex != 4 || pssData.moveToLearn != 0)) Menu_EraseWindowRect(0, 14, 9, 18); SummaryScreenHandleLeftRightInput(taskId, -1); } - else if ((gMain.newKeys & DPAD_RIGHT) || sub_80F9284() == 2) + else if (JOY_NEW(DPAD_RIGHT) || sub_80F9284() == 2) { if (pssData.page != pssData.lastPage) { @@ -1000,7 +1001,7 @@ static void sub_809E260(u8 taskId) SummaryScreenHandleLeftRightInput(taskId, 1); } } - else if (gMain.newKeys & A_BUTTON) + else if (JOY_NEW(A_BUTTON)) { if (SummaryScreen_CanForgetSelectedMove(taskId) == TRUE || pssData.selectedMoveIndex == 4) { @@ -1014,7 +1015,7 @@ static void sub_809E260(u8 taskId) sub_809F9D0(taskId, pssData.selectedMoveIndex); } } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { pssData.switchMoveIndex = 4; gSpecialVar_0x8005 = pssData.switchMoveIndex; @@ -1027,17 +1028,17 @@ static void SummaryScreen_MoveSelect_HandleInput(u8 taskId) if (gPaletteFade.active) return; - if (gMain.newKeys & DPAD_UP) + if (JOY_NEW(DPAD_UP)) { gTasks[taskId].data[0] = 4; sub_809E8F0(taskId, -1, &pssData.selectedMoveIndex); } - else if (gMain.newKeys & DPAD_DOWN) + else if (JOY_NEW(DPAD_DOWN)) { gTasks[taskId].data[0] = 4; sub_809E8F0(taskId, 1, &pssData.selectedMoveIndex); } - else if (gMain.newKeys & A_BUTTON) + else if (JOY_NEW(A_BUTTON)) { if (pssData.selectedMoveIndex != 4 && !pssData.disableMoveOrderEditing) { @@ -1062,7 +1063,7 @@ static void SummaryScreen_MoveSelect_HandleInput(u8 taskId) SummaryScreen_MoveSelect_Cancel(taskId); } } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); SummaryScreen_MoveSelect_Cancel(taskId); @@ -1085,21 +1086,21 @@ static bool8 MonKnowsMultipleMoves(struct Pokemon *mon) static void sub_809E534(u8 taskId) { - if (gMain.newKeys & DPAD_UP) + if (JOY_NEW(DPAD_UP)) { gTasks[taskId].data[0] = 3; sub_809E8F0(taskId, -1, &pssData.switchMoveIndex); } - else if (gMain.newKeys & DPAD_DOWN) + else if (JOY_NEW(DPAD_DOWN)) { gTasks[taskId].data[0] = 3; sub_809E8F0(taskId, 1, &pssData.switchMoveIndex); } - else if (gMain.newKeys & A_BUTTON) + else if (JOY_NEW(A_BUTTON)) { sub_809E83C(taskId, 1); } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { sub_809E83C(taskId, -1); } @@ -1907,7 +1908,7 @@ void sub_809F814(u8 taskId) { taskData[14]++; } - else if (gMain.newKeys & DPAD_UP) + else if (JOY_NEW(DPAD_UP)) { gTasks[taskId].func = sub_809E260; taskData[0] = 4; @@ -1915,7 +1916,7 @@ void sub_809F814(u8 taskId) pssData.selectedMoveIndex = taskData[15]; sub_809E8F0(taskId, -1, &pssData.selectedMoveIndex); } - else if (gMain.newKeys & DPAD_DOWN) + else if (JOY_NEW(DPAD_DOWN)) { gTasks[taskId].func = sub_809E260; taskData[0] = 4; @@ -1923,7 +1924,7 @@ void sub_809F814(u8 taskId) pssData.selectedMoveIndex = taskData[15]; sub_809E8F0(taskId, 1, &pssData.selectedMoveIndex); } - else if ((gMain.newKeys & DPAD_LEFT) || sub_80F9284() == 1) + else if (JOY_NEW(DPAD_LEFT) || sub_80F9284() == 1) { if (pssData.page != PSS_PAGE_BATTLE_MOVES) { @@ -1937,7 +1938,7 @@ void sub_809F814(u8 taskId) sub_80A1654(1, taskData[15]); } } - else if ((gMain.newKeys & DPAD_RIGHT) || sub_80F9284() == 2) + else if (JOY_NEW(DPAD_RIGHT) || sub_80F9284() == 2) { if (pssData.page != pssData.lastPage) { @@ -1951,7 +1952,7 @@ void sub_809F814(u8 taskId) sub_80A1654(1, taskData[15]); } } - else if ((gMain.newKeys & A_BUTTON) || (gMain.newKeys & B_BUTTON)) + else if (JOY_NEW(A_BUTTON) || JOY_NEW(B_BUTTON)) { sub_80A1488(2, taskData[15]); sub_80A1654(2, taskData[15]); @@ -2515,7 +2516,7 @@ static void PokemonSummaryScreen_PrintEggTrainerMemo(struct Pokemon *mon, u8 lef locationMet = GetMonData(mon, MON_DATA_MET_LOCATION); - if (locationMet == 255) + if (locationMet == METLOC_FATEFUL_ENCOUNTER) { // Eggs received from Pokemon Box. Menu_PrintText(gOtherText_EggNicePlace, left, top); @@ -2530,7 +2531,7 @@ static void PokemonSummaryScreen_PrintEggTrainerMemo(struct Pokemon *mon, u8 lef asm(""); // needed to match for some reason - if (locationMet == 253) + if (locationMet == METLOC_SPECIAL_EGG) { Menu_PrintText(gOtherText_EggHotSprings, left, top); return; @@ -2605,7 +2606,7 @@ static void PokemonSummaryScreen_PrintTrainerMemo(struct Pokemon *mon, u8 left, else { locationMet = GetMonData(mon, MON_DATA_MET_LOCATION); - if (locationMet == 0xFF) + if (locationMet == METLOC_FATEFUL_ENCOUNTER) { u8 levelMet = GetMonData(mon, MON_DATA_MET_LEVEL); @@ -2615,7 +2616,7 @@ static void PokemonSummaryScreen_PrintTrainerMemo(struct Pokemon *mon, u8 left, StringCopy(ptr, gOtherText_FatefulEncounter); } - else if (locationMet >= 88) + else if (locationMet >= MAPSEC_NONE) { *ptr = CHAR_NEWLINE; ptr++; diff --git a/src/pokenav.c b/src/pokenav.c index 77b8f57ef..a26019ffe 100644 --- a/src/pokenav.c +++ b/src/pokenav.c @@ -4483,19 +4483,19 @@ void sub_80F5CDC(u8 a0) u8 sub_80F5DD4(void) { - if (({gMain.newAndRepeatedKeys & DPAD_UP;})) + if (JOY_REPT(DPAD_UP)) { return sub_80F5E20(); } - else if (({gMain.newAndRepeatedKeys & DPAD_DOWN;})) + else if (JOY_REPT(DPAD_DOWN)) { return sub_80F5EE4(); } - else if (({gMain.newAndRepeatedKeys & DPAD_LEFT;})) + else if (JOY_REPT(DPAD_LEFT)) { return sub_80F5FB4(); } - else if (({gMain.newAndRepeatedKeys & DPAD_RIGHT;})) + else if (JOY_REPT(DPAD_RIGHT)) { return sub_80F6010(); } @@ -4952,7 +4952,7 @@ u8 sub_80F68E8(void) s8 r12 = 1; do { - if (({gMain.newAndRepeatedKeys & DPAD_UP;}) && r4 > 0) + if (JOY_REPT(DPAD_UP) && r4 > 0) { while (r4 > 0) { @@ -4968,7 +4968,7 @@ u8 sub_80F68E8(void) } r4 = gPokenavStructPtr->unkBC91; } - if (({gMain.newAndRepeatedKeys & DPAD_DOWN;}) && r4 < 3) + if (JOY_REPT(DPAD_DOWN) && r4 < 3) { while (r4 < 3) { @@ -4984,7 +4984,7 @@ u8 sub_80F68E8(void) } r4 = gPokenavStructPtr->unkBC91; } - if (({gMain.newAndRepeatedKeys & DPAD_LEFT;})) + if (JOY_REPT(DPAD_LEFT)) { if (r5 > 0) { @@ -4992,7 +4992,7 @@ u8 sub_80F68E8(void) break; } } - if (({gMain.newAndRepeatedKeys & DPAD_RIGHT;})) + if (JOY_REPT(DPAD_RIGHT)) { if (r5 < gPokenavStructPtr->unkBC96[r4] - 1) { diff --git a/src/pokenav_before.c b/src/pokenav_before.c index 806b91d94..d0a5dc484 100644 --- a/src/pokenav_before.c +++ b/src/pokenav_before.c @@ -1485,7 +1485,7 @@ void sub_80EC268() } else { - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { gPokenavStructPtr->unk6DDC = gPokenavStructPtr->unk6DAD; switch (gPokenavStructPtr->unk6DB2[gPokenavStructPtr->unk6DDC] - 1) @@ -1509,7 +1509,7 @@ void sub_80EC268() break; } } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { gPokenavStructPtr->unk304 = 1; } @@ -1565,7 +1565,7 @@ void sub_80EC268() gPokenavStructPtr->unk304 = 0; sub_80EED9C(); } - else if (gMain.newKeys & (A_BUTTON | B_BUTTON)) + else if (JOY_NEW(A_BUTTON | B_BUTTON)) { sub_80EF428(0, gPokenavStructPtr->unk6DAD); gPokenavStructPtr->unk304 = var1; @@ -1766,7 +1766,7 @@ void sub_80EC86C() sub_80EF428(1, gPokenavStructPtr->unk6DAD); sub_80EED9C(); } - else if (gMain.newKeys & A_BUTTON) + else if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); gPokenavStructPtr->unk6DF0 = gPokenavStructPtr->unk6DAD; @@ -1783,7 +1783,7 @@ void sub_80EC86C() break; } } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); gPokenavStructPtr->unk6DF0 = 0x2; @@ -1919,7 +1919,7 @@ void sub_80ECC08() sub_80EF428(2, gPokenavStructPtr->unk6DAD); sub_80EED9C(); } - else if (gMain.newKeys & A_BUTTON) + else if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); switch ((s8)gPokenavStructPtr->unk6DAD) @@ -1948,7 +1948,7 @@ void sub_80ECC08() gPokenavStructPtr->unk76AA = 1; sub_80EBDBC(&sub_80ED01C); } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); gPokenavStructPtr->unk6DAD = 0x5; @@ -2204,13 +2204,13 @@ void sub_80ED31C() gPokenavStructPtr->unk304++; return; default: - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); sub_80EBDBC(&sub_80ED4D8); return; } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); sub_80EBDBC(&sub_80ECD80); @@ -2478,7 +2478,7 @@ void sub_80ED858(void) } break; case 4: - if (({gMain.heldKeys & DPAD_UP;})) + if (JOY_HELD(DPAD_UP)) { if (gPokenavStructPtr->unk87CB && ( gPokenavStructPtr->unk76AA == 0 @@ -2492,7 +2492,7 @@ void sub_80ED858(void) break; } } - if (({gMain.heldKeys & DPAD_DOWN;})) + if (JOY_HELD(DPAD_DOWN)) { if (gPokenavStructPtr->unk87CB && ( gPokenavStructPtr->unk76AA == 0 @@ -2506,7 +2506,7 @@ void sub_80ED858(void) break; } } - if (({gMain.newKeys & B_BUTTON;})) + if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); sub_80F4FDC(); @@ -2514,7 +2514,7 @@ void sub_80ED858(void) gPokenavStructPtr->unk304 = 9; break; } - if (({gMain.newKeys & A_BUTTON;})) + if (JOY_NEW(A_BUTTON)) { if (gPokenavStructPtr->unk76AA == 0) { @@ -2708,13 +2708,13 @@ void sub_80EDDBC() gPokenavStructPtr->unk304++; return; default: - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); sub_80EBDBC(&sub_80EDEE4); return; } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); sub_80EBDBC(&sub_80EDE70); @@ -2836,25 +2836,25 @@ void sub_80EE06C() gPokenavStructPtr->unk304++; break; case 1: - if ((gMain.newAndRepeatedKeys & 0x40) && (gPokenavStructPtr->unk87DC)) + if (JOY_REPT(0x40) && (gPokenavStructPtr->unk87DC)) { PlaySE(SE_SELECT); sub_80F6A4C(-1); gPokenavStructPtr->unk304++; } - else if ((gMain.newAndRepeatedKeys & 0x80) && gPokenavStructPtr->unk87DC < gPokenavStructPtr->unk8774) + else if (JOY_REPT(0x80) && gPokenavStructPtr->unk87DC < gPokenavStructPtr->unk8774) { PlaySE(SE_SELECT); sub_80F6A4C(1); gPokenavStructPtr->unk304++; } - else if (gMain.newKeys & A_BUTTON) + else if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); sub_80EEFBC(0xB); gPokenavStructPtr->unk304 = 0x4; } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); sub_80EBDBC(&sub_80EE294); @@ -2890,7 +2890,7 @@ void sub_80EE06C() return; default: case 0: - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); sub_80F3B94(); @@ -3068,13 +3068,13 @@ void sub_80EE58C() gPokenavStructPtr->unk304++; return; default: - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); sub_80EBDBC(&sub_80EE658); return; } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); sub_80EBDBC(&sub_80EE8F4); @@ -3144,19 +3144,19 @@ void sub_80EE658() gPokenavStructPtr->unk304++; break; case 8: - if ((gMain.heldKeys & 0x40) && gPokenavStructPtr->unk87DC) + if (JOY_HELD(0x40) && gPokenavStructPtr->unk87DC) { PlaySE(SE_SELECT); sub_80F708C(-1); gPokenavStructPtr->unk304 = 0x10; } - else if ((gMain.heldKeys & 0x80) && gPokenavStructPtr->unk87DC < gPokenavStructPtr->unk8774) + else if (JOY_HELD(0x80) && gPokenavStructPtr->unk87DC < gPokenavStructPtr->unk8774) { PlaySE(SE_SELECT); sub_80F708C(1); gPokenavStructPtr->unk304 = 0x10; } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); sub_80F4394(); @@ -3337,7 +3337,7 @@ bool8 sub_80EEA0C(void) // var6dad and var6dae must be s8 in this func bool8 sub_80EEC10() { - if (gMain.newKeys & 0x40) + if (JOY_NEW(DPAD_UP)) { do { @@ -3346,7 +3346,7 @@ bool8 sub_80EEC10() } while (!gPokenavStructPtr->unk6DB2[gPokenavStructPtr->unk6DAD]); return TRUE; } - if (gMain.newKeys & 0x80) + if (JOY_NEW(DPAD_DOWN)) { do { @@ -3364,13 +3364,13 @@ bool8 sub_80EEC10() bool8 sub_80EEC90() { - if (gMain.newKeys & 0x40) + if (JOY_NEW(DPAD_UP)) { if (--gPokenavStructPtr->unk6DAD < 0) gPokenavStructPtr->unk6DAD = gPokenavStructPtr->unk6DAE - 1; return TRUE; } - if (gMain.newKeys & 0x80) + if (JOY_NEW(DPAD_DOWN)) { if (++gPokenavStructPtr->unk6DAD >= gPokenavStructPtr->unk6DAE) gPokenavStructPtr->unk6DAD = 0; diff --git a/src/region_map.c b/src/region_map.c index 0816edcea..b0ba059b6 100644 --- a/src/region_map.c +++ b/src/region_map.c @@ -211,30 +211,30 @@ static u8 sub_80FAB78(void) gRegionMap->cursorDeltaX = 0; gRegionMap->cursorDeltaY = 0; - if ((gMain.heldKeys & DPAD_UP) && gRegionMap->cursorPosY > MAPCURSOR_Y_MIN) + if (JOY_HELD(DPAD_UP) && gRegionMap->cursorPosY > MAPCURSOR_Y_MIN) { gRegionMap->cursorDeltaY = -1; event = INPUT_EVENT_DPAD; } - if ((gMain.heldKeys & DPAD_DOWN) && gRegionMap->cursorPosY < MAPCURSOR_Y_MAX) + if (JOY_HELD(DPAD_DOWN) && gRegionMap->cursorPosY < MAPCURSOR_Y_MAX) { gRegionMap->cursorDeltaY = 1; event = INPUT_EVENT_DPAD; } - if ((gMain.heldKeys & DPAD_LEFT) && gRegionMap->cursorPosX > MAPCURSOR_X_MIN) + if (JOY_HELD(DPAD_LEFT) && gRegionMap->cursorPosX > MAPCURSOR_X_MIN) { gRegionMap->cursorDeltaX = -1; event = INPUT_EVENT_DPAD; } - if ((gMain.heldKeys & DPAD_RIGHT) && gRegionMap->cursorPosX < MAPCURSOR_X_MAX) + if (JOY_HELD(DPAD_RIGHT) && gRegionMap->cursorPosX < MAPCURSOR_X_MAX) { gRegionMap->cursorDeltaX = 1; event = INPUT_EVENT_DPAD; } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) event = INPUT_EVENT_A_BUTTON; - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) event = INPUT_EVENT_B_BUTTON; if (event == INPUT_EVENT_DPAD) @@ -282,30 +282,30 @@ static u8 sub_80FAD04(void) gRegionMap->unk6A = 0; gRegionMap->unk68 = 0; - if ((gMain.heldKeys & DPAD_UP) && gRegionMap->scrollY > -52) + if (JOY_HELD(DPAD_UP) && gRegionMap->scrollY > -52) { gRegionMap->unk68 = -1; event = INPUT_EVENT_DPAD; } - if ((gMain.heldKeys & DPAD_DOWN) && gRegionMap->scrollY < 60) + if (JOY_HELD(DPAD_DOWN) && gRegionMap->scrollY < 60) { gRegionMap->unk68 = 1; event = INPUT_EVENT_DPAD; } - if ((gMain.heldKeys & DPAD_LEFT) && gRegionMap->scrollX > -44) + if (JOY_HELD(DPAD_LEFT) && gRegionMap->scrollX > -44) { gRegionMap->unk6A = -1; event = INPUT_EVENT_DPAD; } - if ((gMain.heldKeys & DPAD_RIGHT) && gRegionMap->scrollX < 172) + if (JOY_HELD(DPAD_RIGHT) && gRegionMap->scrollX < 172) { gRegionMap->unk6A = 1; event = INPUT_EVENT_DPAD; } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) event = INPUT_EVENT_A_BUTTON; - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) event = INPUT_EVENT_B_BUTTON; if (event == INPUT_EVENT_DPAD) @@ -520,9 +520,9 @@ static void InitializeCursorPosition(void) u16 r9; if (gSaveBlock1.location.mapGroup == 25 - && (gSaveBlock1.location.mapNum == MAP_NUM(SS_TIDAL_CORRIDOR) - || gSaveBlock1.location.mapNum == MAP_NUM(SS_TIDAL_LOWER_DECK) - || gSaveBlock1.location.mapNum == MAP_NUM(SS_TIDAL_ROOMS))) + && (gSaveBlock1.location.mapNum == MAP_NUM(MAP_SS_TIDAL_CORRIDOR) + || gSaveBlock1.location.mapNum == MAP_NUM(MAP_SS_TIDAL_LOWER_DECK) + || gSaveBlock1.location.mapNum == MAP_NUM(MAP_SS_TIDAL_ROOMS))) { sub_80FB600(); return; @@ -1164,56 +1164,56 @@ static const u8 sFlyTargetIcons_ImageLZ[] = INCBIN_U8("graphics/pokenav/fly_targ static const u8 sMapHealLocations[][3] = { - {MAP_GROUP(LITTLEROOT_TOWN), MAP_NUM(LITTLEROOT_TOWN), HEAL_LOCATION_LITTLEROOT_TOWN_BRENDANS_HOUSE_2F}, - {MAP_GROUP(OLDALE_TOWN), MAP_NUM(OLDALE_TOWN), HEAL_LOCATION_OLDALE_TOWN}, - {MAP_GROUP(DEWFORD_TOWN), MAP_NUM(DEWFORD_TOWN), HEAL_LOCATION_DEWFORD_TOWN}, - {MAP_GROUP(LAVARIDGE_TOWN), MAP_NUM(LAVARIDGE_TOWN), HEAL_LOCATION_LAVARIDGE_TOWN}, - {MAP_GROUP(FALLARBOR_TOWN), MAP_NUM(FALLARBOR_TOWN), HEAL_LOCATION_FALLARBOR_TOWN}, - {MAP_GROUP(VERDANTURF_TOWN), MAP_NUM(VERDANTURF_TOWN), HEAL_LOCATION_VERDANTURF_TOWN}, - {MAP_GROUP(PACIFIDLOG_TOWN), MAP_NUM(PACIFIDLOG_TOWN), HEAL_LOCATION_PACIFIDLOG_TOWN}, - {MAP_GROUP(PETALBURG_CITY), MAP_NUM(PETALBURG_CITY), HEAL_LOCATION_PETALBURG_CITY}, - {MAP_GROUP(SLATEPORT_CITY), MAP_NUM(SLATEPORT_CITY), HEAL_LOCATION_SLATEPORT_CITY}, - {MAP_GROUP(MAUVILLE_CITY), MAP_NUM(MAUVILLE_CITY), HEAL_LOCATION_MAUVILLE_CITY}, - {MAP_GROUP(RUSTBORO_CITY), MAP_NUM(RUSTBORO_CITY), HEAL_LOCATION_RUSTBORO_CITY}, - {MAP_GROUP(FORTREE_CITY), MAP_NUM(FORTREE_CITY), HEAL_LOCATION_FORTREE_CITY}, - {MAP_GROUP(LILYCOVE_CITY), MAP_NUM(LILYCOVE_CITY), HEAL_LOCATION_LILYCOVE_CITY}, - {MAP_GROUP(MOSSDEEP_CITY), MAP_NUM(MOSSDEEP_CITY), HEAL_LOCATION_MOSSDEEP_CITY}, - {MAP_GROUP(SOOTOPOLIS_CITY), MAP_NUM(SOOTOPOLIS_CITY), HEAL_LOCATION_SOOTOPOLIS_CITY}, - {MAP_GROUP(EVER_GRANDE_CITY), MAP_NUM(EVER_GRANDE_CITY), HEAL_LOCATION_EVER_GRANDE_CITY}, - {MAP_GROUP(ROUTE101), MAP_NUM(ROUTE101), 0}, - {MAP_GROUP(ROUTE102), MAP_NUM(ROUTE102), 0}, - {MAP_GROUP(ROUTE103), MAP_NUM(ROUTE103), 0}, - {MAP_GROUP(ROUTE104), MAP_NUM(ROUTE104), 0}, - {MAP_GROUP(ROUTE105), MAP_NUM(ROUTE105), 0}, - {MAP_GROUP(ROUTE106), MAP_NUM(ROUTE106), 0}, - {MAP_GROUP(ROUTE107), MAP_NUM(ROUTE107), 0}, - {MAP_GROUP(ROUTE108), MAP_NUM(ROUTE108), 0}, - {MAP_GROUP(ROUTE109), MAP_NUM(ROUTE109), 0}, - {MAP_GROUP(ROUTE110), MAP_NUM(ROUTE110), 0}, - {MAP_GROUP(ROUTE111), MAP_NUM(ROUTE111), 0}, - {MAP_GROUP(ROUTE112), MAP_NUM(ROUTE112), 0}, - {MAP_GROUP(ROUTE113), MAP_NUM(ROUTE113), 0}, - {MAP_GROUP(ROUTE114), MAP_NUM(ROUTE114), 0}, - {MAP_GROUP(ROUTE115), MAP_NUM(ROUTE115), 0}, - {MAP_GROUP(ROUTE116), MAP_NUM(ROUTE116), 0}, - {MAP_GROUP(ROUTE117), MAP_NUM(ROUTE117), 0}, - {MAP_GROUP(ROUTE118), MAP_NUM(ROUTE118), 0}, - {MAP_GROUP(ROUTE119), MAP_NUM(ROUTE119), 0}, - {MAP_GROUP(ROUTE120), MAP_NUM(ROUTE120), 0}, - {MAP_GROUP(ROUTE121), MAP_NUM(ROUTE121), 0}, - {MAP_GROUP(ROUTE122), MAP_NUM(ROUTE122), 0}, - {MAP_GROUP(ROUTE123), MAP_NUM(ROUTE123), 0}, - {MAP_GROUP(ROUTE124), MAP_NUM(ROUTE124), 0}, - {MAP_GROUP(ROUTE125), MAP_NUM(ROUTE125), 0}, - {MAP_GROUP(ROUTE126), MAP_NUM(ROUTE126), 0}, - {MAP_GROUP(ROUTE127), MAP_NUM(ROUTE127), 0}, - {MAP_GROUP(ROUTE128), MAP_NUM(ROUTE128), 0}, - {MAP_GROUP(ROUTE129), MAP_NUM(ROUTE129), 0}, - {MAP_GROUP(ROUTE130), MAP_NUM(ROUTE130), 0}, - {MAP_GROUP(ROUTE131), MAP_NUM(ROUTE131), 0}, - {MAP_GROUP(ROUTE132), MAP_NUM(ROUTE132), 0}, - {MAP_GROUP(ROUTE133), MAP_NUM(ROUTE133), 0}, - {MAP_GROUP(ROUTE134), MAP_NUM(ROUTE134), 0}, + [MAPSEC_LITTLEROOT_TOWN] = {MAP_GROUP(MAP_LITTLEROOT_TOWN), MAP_NUM(MAP_LITTLEROOT_TOWN), HEAL_LOCATION_LITTLEROOT_TOWN_BRENDANS_HOUSE_2F}, + [MAPSEC_OLDALE_TOWN] = {MAP_GROUP(MAP_OLDALE_TOWN), MAP_NUM(MAP_OLDALE_TOWN), HEAL_LOCATION_OLDALE_TOWN}, + [MAPSEC_DEWFORD_TOWN] = {MAP_GROUP(MAP_DEWFORD_TOWN), MAP_NUM(MAP_DEWFORD_TOWN), HEAL_LOCATION_DEWFORD_TOWN}, + [MAPSEC_LAVARIDGE_TOWN] = {MAP_GROUP(MAP_LAVARIDGE_TOWN), MAP_NUM(MAP_LAVARIDGE_TOWN), HEAL_LOCATION_LAVARIDGE_TOWN}, + [MAPSEC_FALLARBOR_TOWN] = {MAP_GROUP(MAP_FALLARBOR_TOWN), MAP_NUM(MAP_FALLARBOR_TOWN), HEAL_LOCATION_FALLARBOR_TOWN}, + [MAPSEC_VERDANTURF_TOWN] = {MAP_GROUP(MAP_VERDANTURF_TOWN), MAP_NUM(MAP_VERDANTURF_TOWN), HEAL_LOCATION_VERDANTURF_TOWN}, + [MAPSEC_PACIFIDLOG_TOWN] = {MAP_GROUP(MAP_PACIFIDLOG_TOWN), MAP_NUM(MAP_PACIFIDLOG_TOWN), HEAL_LOCATION_PACIFIDLOG_TOWN}, + [MAPSEC_PETALBURG_CITY] = {MAP_GROUP(MAP_PETALBURG_CITY), MAP_NUM(MAP_PETALBURG_CITY), HEAL_LOCATION_PETALBURG_CITY}, + [MAPSEC_SLATEPORT_CITY] = {MAP_GROUP(MAP_SLATEPORT_CITY), MAP_NUM(MAP_SLATEPORT_CITY), HEAL_LOCATION_SLATEPORT_CITY}, + [MAPSEC_MAUVILLE_CITY] = {MAP_GROUP(MAP_MAUVILLE_CITY), MAP_NUM(MAP_MAUVILLE_CITY), HEAL_LOCATION_MAUVILLE_CITY}, + [MAPSEC_RUSTBORO_CITY] = {MAP_GROUP(MAP_RUSTBORO_CITY), MAP_NUM(MAP_RUSTBORO_CITY), HEAL_LOCATION_RUSTBORO_CITY}, + [MAPSEC_FORTREE_CITY] = {MAP_GROUP(MAP_FORTREE_CITY), MAP_NUM(MAP_FORTREE_CITY), HEAL_LOCATION_FORTREE_CITY}, + [MAPSEC_LILYCOVE_CITY] = {MAP_GROUP(MAP_LILYCOVE_CITY), MAP_NUM(MAP_LILYCOVE_CITY), HEAL_LOCATION_LILYCOVE_CITY}, + [MAPSEC_MOSSDEEP_CITY] = {MAP_GROUP(MAP_MOSSDEEP_CITY), MAP_NUM(MAP_MOSSDEEP_CITY), HEAL_LOCATION_MOSSDEEP_CITY}, + [MAPSEC_SOOTOPOLIS_CITY] = {MAP_GROUP(MAP_SOOTOPOLIS_CITY), MAP_NUM(MAP_SOOTOPOLIS_CITY), HEAL_LOCATION_SOOTOPOLIS_CITY}, + [MAPSEC_EVER_GRANDE_CITY] = {MAP_GROUP(MAP_EVER_GRANDE_CITY), MAP_NUM(MAP_EVER_GRANDE_CITY), HEAL_LOCATION_EVER_GRANDE_CITY}, + [MAPSEC_ROUTE_101] = {MAP_GROUP(MAP_ROUTE101), MAP_NUM(MAP_ROUTE101), HEAL_LOCATION_NONE}, + [MAPSEC_ROUTE_102] = {MAP_GROUP(MAP_ROUTE102), MAP_NUM(MAP_ROUTE102), HEAL_LOCATION_NONE}, + [MAPSEC_ROUTE_103] = {MAP_GROUP(MAP_ROUTE103), MAP_NUM(MAP_ROUTE103), HEAL_LOCATION_NONE}, + [MAPSEC_ROUTE_104] = {MAP_GROUP(MAP_ROUTE104), MAP_NUM(MAP_ROUTE104), HEAL_LOCATION_NONE}, + [MAPSEC_ROUTE_105] = {MAP_GROUP(MAP_ROUTE105), MAP_NUM(MAP_ROUTE105), HEAL_LOCATION_NONE}, + [MAPSEC_ROUTE_106] = {MAP_GROUP(MAP_ROUTE106), MAP_NUM(MAP_ROUTE106), HEAL_LOCATION_NONE}, + [MAPSEC_ROUTE_107] = {MAP_GROUP(MAP_ROUTE107), MAP_NUM(MAP_ROUTE107), HEAL_LOCATION_NONE}, + [MAPSEC_ROUTE_108] = {MAP_GROUP(MAP_ROUTE108), MAP_NUM(MAP_ROUTE108), HEAL_LOCATION_NONE}, + [MAPSEC_ROUTE_109] = {MAP_GROUP(MAP_ROUTE109), MAP_NUM(MAP_ROUTE109), HEAL_LOCATION_NONE}, + [MAPSEC_ROUTE_110] = {MAP_GROUP(MAP_ROUTE110), MAP_NUM(MAP_ROUTE110), HEAL_LOCATION_NONE}, + [MAPSEC_ROUTE_111] = {MAP_GROUP(MAP_ROUTE111), MAP_NUM(MAP_ROUTE111), HEAL_LOCATION_NONE}, + [MAPSEC_ROUTE_112] = {MAP_GROUP(MAP_ROUTE112), MAP_NUM(MAP_ROUTE112), HEAL_LOCATION_NONE}, + [MAPSEC_ROUTE_113] = {MAP_GROUP(MAP_ROUTE113), MAP_NUM(MAP_ROUTE113), HEAL_LOCATION_NONE}, + [MAPSEC_ROUTE_114] = {MAP_GROUP(MAP_ROUTE114), MAP_NUM(MAP_ROUTE114), HEAL_LOCATION_NONE}, + [MAPSEC_ROUTE_115] = {MAP_GROUP(MAP_ROUTE115), MAP_NUM(MAP_ROUTE115), HEAL_LOCATION_NONE}, + [MAPSEC_ROUTE_116] = {MAP_GROUP(MAP_ROUTE116), MAP_NUM(MAP_ROUTE116), HEAL_LOCATION_NONE}, + [MAPSEC_ROUTE_117] = {MAP_GROUP(MAP_ROUTE117), MAP_NUM(MAP_ROUTE117), HEAL_LOCATION_NONE}, + [MAPSEC_ROUTE_118] = {MAP_GROUP(MAP_ROUTE118), MAP_NUM(MAP_ROUTE118), HEAL_LOCATION_NONE}, + [MAPSEC_ROUTE_119] = {MAP_GROUP(MAP_ROUTE119), MAP_NUM(MAP_ROUTE119), HEAL_LOCATION_NONE}, + [MAPSEC_ROUTE_120] = {MAP_GROUP(MAP_ROUTE120), MAP_NUM(MAP_ROUTE120), HEAL_LOCATION_NONE}, + [MAPSEC_ROUTE_121] = {MAP_GROUP(MAP_ROUTE121), MAP_NUM(MAP_ROUTE121), HEAL_LOCATION_NONE}, + [MAPSEC_ROUTE_122] = {MAP_GROUP(MAP_ROUTE122), MAP_NUM(MAP_ROUTE122), HEAL_LOCATION_NONE}, + [MAPSEC_ROUTE_123] = {MAP_GROUP(MAP_ROUTE123), MAP_NUM(MAP_ROUTE123), HEAL_LOCATION_NONE}, + [MAPSEC_ROUTE_124] = {MAP_GROUP(MAP_ROUTE124), MAP_NUM(MAP_ROUTE124), HEAL_LOCATION_NONE}, + [MAPSEC_ROUTE_125] = {MAP_GROUP(MAP_ROUTE125), MAP_NUM(MAP_ROUTE125), HEAL_LOCATION_NONE}, + [MAPSEC_ROUTE_126] = {MAP_GROUP(MAP_ROUTE126), MAP_NUM(MAP_ROUTE126), HEAL_LOCATION_NONE}, + [MAPSEC_ROUTE_127] = {MAP_GROUP(MAP_ROUTE127), MAP_NUM(MAP_ROUTE127), HEAL_LOCATION_NONE}, + [MAPSEC_ROUTE_128] = {MAP_GROUP(MAP_ROUTE128), MAP_NUM(MAP_ROUTE128), HEAL_LOCATION_NONE}, + [MAPSEC_ROUTE_129] = {MAP_GROUP(MAP_ROUTE129), MAP_NUM(MAP_ROUTE129), HEAL_LOCATION_NONE}, + [MAPSEC_ROUTE_130] = {MAP_GROUP(MAP_ROUTE130), MAP_NUM(MAP_ROUTE130), HEAL_LOCATION_NONE}, + [MAPSEC_ROUTE_131] = {MAP_GROUP(MAP_ROUTE131), MAP_NUM(MAP_ROUTE131), HEAL_LOCATION_NONE}, + [MAPSEC_ROUTE_132] = {MAP_GROUP(MAP_ROUTE132), MAP_NUM(MAP_ROUTE132), HEAL_LOCATION_NONE}, + [MAPSEC_ROUTE_133] = {MAP_GROUP(MAP_ROUTE133), MAP_NUM(MAP_ROUTE133), HEAL_LOCATION_NONE}, + [MAPSEC_ROUTE_134] = {MAP_GROUP(MAP_ROUTE134), MAP_NUM(MAP_ROUTE134), HEAL_LOCATION_NONE}, }; static const u8 *const sEverGrandeCityAreaNames[] = @@ -1631,7 +1631,7 @@ void sub_80FC69C(void) sub_8053538((FlagGet(FLAG_SYS_POKEMON_LEAGUE_FLY) && gRegionMapState->regionMap.everGrandeCityArea == 0) ? HEAL_LOCATION_EVER_GRANDE_CITY_POKEMON_LEAGUE : HEAL_LOCATION_EVER_GRANDE_CITY); break; default: - if (sMapHealLocations[gRegionMapState->regionMap.mapSectionId][2] != 0) + if (sMapHealLocations[gRegionMapState->regionMap.mapSectionId][2] != HEAL_LOCATION_NONE) sub_8053538(sMapHealLocations[gRegionMapState->regionMap.mapSectionId][2]); else warp1_set_2(sMapHealLocations[gRegionMapState->regionMap.mapSectionId][0], sMapHealLocations[gRegionMapState->regionMap.mapSectionId][1], -1); @@ -1724,7 +1724,7 @@ void debug_sub_8110D84(void) { debug_sub_8110CCC(); } - else if (gMain.newKeys & A_BUTTON) + else if (JOY_NEW(A_BUTTON)) { sub_80FBCA0(); sub_80FAEC4(); @@ -1743,7 +1743,7 @@ void debug_sub_8110D84(void) { debug_sub_8110CCC(); } - if (gMain.newKeys & A_BUTTON) // no "else if" like above? + if (JOY_NEW(A_BUTTON)) // no "else if" like above? { sub_80FBCA0(); sub_80FAEC4(); diff --git a/src/reset_rtc_screen.c b/src/reset_rtc_screen.c index ee207582b..9328a28ad 100644 --- a/src/reset_rtc_screen.c +++ b/src/reset_rtc_screen.c @@ -349,7 +349,7 @@ void Task_ResetRtc_1(u8 taskId) u8 selection = data[2]; const struct ResetRtcStruct *selectionInfo = &gUnknown_08376420[selection - 1]; - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { gTasks[taskId].func = Task_ResetRtc_2; data[1] = 0; @@ -358,7 +358,7 @@ void Task_ResetRtc_1(u8 taskId) return; } - if (gMain.newKeys & DPAD_RIGHT) + if (JOY_NEW(DPAD_RIGHT)) { if (selectionInfo->right) { @@ -368,7 +368,7 @@ void Task_ResetRtc_1(u8 taskId) } } - if (gMain.newKeys & DPAD_LEFT) + if (JOY_NEW(DPAD_LEFT)) { if (selectionInfo->left) { @@ -380,7 +380,7 @@ void Task_ResetRtc_1(u8 taskId) if (selection == 5) { - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { gLocalTime.days = data[3]; gLocalTime.hours = data[4]; @@ -392,7 +392,7 @@ void Task_ResetRtc_1(u8 taskId) data[2] = 6; } } - else if (ResetRtcScreen_MoveTimeUpDown(&data[selectionInfo->dataIndex], selectionInfo->minVal, selectionInfo->maxVal, gMain.newAndRepeatedKeys & (DPAD_UP | DPAD_DOWN))) + else if (ResetRtcScreen_MoveTimeUpDown(&data[selectionInfo->dataIndex], selectionInfo->minVal, selectionInfo->maxVal, JOY_REPT(DPAD_UP | DPAD_DOWN))) { PlaySE(SE_SELECT); ResetRtcScreen_PrintTime(4, 9, data[3], data[4], data[5], data[6]); @@ -483,12 +483,12 @@ void Task_ShowResetRtcPrompt(u8 taskId) ResetRtcScreen_ShowMessage(gSystemText_ResetRTCPrompt); data[0]++; case 1: - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { DestroyTask(taskId); DoSoftReset(); } - else if (gMain.newKeys & A_BUTTON) + else if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); DestroyTask(taskId); @@ -572,7 +572,7 @@ void Task_ResetRtcScreen(u8 taskId) data[0] = 5; // fall through case 5: - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { BeginNormalPaletteFade(0xFFFFFFFF, 1, 0, 16, FADE_COLOR_WHITE); data[0] = 6; @@ -679,7 +679,7 @@ void debug_sub_806F9E4(u8 taskId) } else { - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { Menu_EraseScreen(); DestroyTask(taskId); diff --git a/src/rotating_gate.c b/src/rotating_gate.c index 934a7beb1..5ceb77bbd 100644 --- a/src/rotating_gate.c +++ b/src/rotating_gate.c @@ -622,14 +622,14 @@ static EWRAM_DATA u8 gRotatingGate_PuzzleCount = 0; static int GetCurrentMapRotatingGatePuzzleType(void) { - if (gSaveBlock1.location.mapGroup == MAP_GROUP(FORTREE_CITY_GYM) && - gSaveBlock1.location.mapNum == MAP_NUM(FORTREE_CITY_GYM)) + if (gSaveBlock1.location.mapGroup == MAP_GROUP(MAP_FORTREE_CITY_GYM) && + gSaveBlock1.location.mapNum == MAP_NUM(MAP_FORTREE_CITY_GYM)) { return PUZZLE_FORTREE_CITY_GYM; } - if (gSaveBlock1.location.mapGroup == MAP_GROUP(ROUTE110_TRICK_HOUSE_PUZZLE6) && - gSaveBlock1.location.mapNum == MAP_NUM(ROUTE110_TRICK_HOUSE_PUZZLE6)) + if (gSaveBlock1.location.mapGroup == MAP_GROUP(MAP_ROUTE110_TRICK_HOUSE_PUZZLE6) && + gSaveBlock1.location.mapNum == MAP_NUM(MAP_ROUTE110_TRICK_HOUSE_PUZZLE6)) { return PUZZLE_ROUTE110_TRICK_HOUSE_PUZZLE6; } diff --git a/src/roulette.c b/src/roulette.c index 34f0fa7b6..8178ba3ae 100644 --- a/src/roulette.c +++ b/src/roulette.c @@ -541,7 +541,7 @@ void sub_8115634(u8 taskId) eRoulette->var2C.b = sin; eRoulette->var2C.c = -sin; #if DEBUG - if (unk_203955C[0] != 0 && (gMain.newKeys & START_BUTTON)) + if (unk_203955C[0] != 0 && JOY_NEW(START_BUTTON)) { gTasks[eRoulette->varA4].func = sub_81157AC; m4aMPlayStop(&gMPlayInfo_SE1); @@ -701,25 +701,25 @@ void sub_8115B58(u8 r0) { u8 z = 0; bool8 var0 = FALSE; - if (gMain.newKeys & DPAD_UP) + if (JOY_NEW(DPAD_UP)) { var0 = TRUE; if (!sub_8115A94(&gTasks[r0].data[4], 0)) return; } - if (gMain.newKeys & DPAD_DOWN) + if (JOY_NEW(DPAD_DOWN)) { var0 = TRUE; if (!sub_8115A94(&gTasks[r0].data[4], 1)) return; } - if (gMain.newKeys & DPAD_LEFT) + if (JOY_NEW(DPAD_LEFT)) { var0 = TRUE; if (!sub_8115A94(&gTasks[r0].data[4], 2)) return; } - if (gMain.newKeys & DPAD_RIGHT) + if (JOY_NEW(DPAD_RIGHT)) { var0 = TRUE; if (!sub_8115A94(&gTasks[r0].data[4], 3)) @@ -795,7 +795,7 @@ void sub_8115E14(u8 taskid) default: gTasks[taskid].data[1]++; } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { if ((eRoulette->var08 & gUnknown_083F8C00[gTasks[taskid].data[4]].var08)) PlaySE(SE_BOO); @@ -1010,7 +1010,7 @@ void sub_811637C(u8 taskid) } if (gTasks[taskid].data[1] < 61) { - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) gTasks[taskid].data[1] = 60; gTasks[taskid].data[1]++; } @@ -1274,7 +1274,7 @@ void sub_8116B40(u8 taskId) // end roulette ? void sub_8116BC0(u8 taskid) { - if (eRoulette->varA8 == 0 || gMain.newKeys & eRoulette->varAA) + if (eRoulette->varA8 == 0 || JOY_NEW(eRoulette->varAA)) { gTasks[taskid].func = eRoulette->varAC; if (eRoulette->varAA > 0) @@ -1605,7 +1605,7 @@ void sub_81175C0(u8 taskid) void sub_81175DC(u8 taskid) { gTasks[taskid].data[0]++; - if (!(gMain.newKeys & (A_BUTTON | B_BUTTON)) && gTasks[taskid].data[0] < 61) + if (!JOY_NEW(A_BUTTON | B_BUTTON) && gTasks[taskid].data[0] < 61) return; gSpecialVar_0x8004 = 1; Menu_EraseScreen(); @@ -1673,7 +1673,7 @@ void debug_sub_812CDE4(u8 taskId) u8 coinText[] = {0xFD, 0x02, 0xFF}; #endif - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { gTasks[taskId].data[13]++; if (gTasks[taskId].data[13] == 10000) @@ -1687,7 +1687,7 @@ void debug_sub_812CDE4(u8 taskId) MenuPrint_RightAligned(gStringVar4, 9, 1); #endif } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { gTasks[taskId].data[13]--; if (gTasks[taskId].data[13] == -1) @@ -1701,7 +1701,7 @@ void debug_sub_812CDE4(u8 taskId) MenuPrint_RightAligned(gStringVar4, 9, 1); #endif } - else if (gMain.newKeys & R_BUTTON) + else if (JOY_NEW(R_BUTTON)) { gTasks[taskId].data[13] += 10; if (gTasks[taskId].data[13] > 9999) @@ -1715,7 +1715,7 @@ void debug_sub_812CDE4(u8 taskId) MenuPrint_RightAligned(gStringVar4, 9, 1); #endif } - else if (gMain.newKeys & L_BUTTON) + else if (JOY_NEW(L_BUTTON)) { gTasks[taskId].data[13] -= 10; if (gTasks[taskId].data[13] < 0) @@ -1729,7 +1729,7 @@ void debug_sub_812CDE4(u8 taskId) MenuPrint_RightAligned(gStringVar4, 9, 1); #endif } - else if (gMain.newKeys & START_BUTTON) + else if (JOY_NEW(START_BUTTON)) { gSaveBlock1.coins = gTasks[taskId].data[13]; gTasks[taskId].func = Task_Roulette_0; @@ -1743,7 +1743,7 @@ void debug_sub_812CDE4(u8 taskId) #endif unk_2039560 = 0; } - else if (gMain.newKeys & SELECT_BUTTON) + else if (JOY_NEW(SELECT_BUTTON)) { gSaveBlock1.coins = gTasks[taskId].data[13]; gTasks[taskId].func = Task_Roulette_0; diff --git a/src/save_failed_screen.c b/src/save_failed_screen.c index 9ef5f541c..3eff4b6af 100644 --- a/src/save_failed_screen.c +++ b/src/save_failed_screen.c @@ -209,7 +209,7 @@ static void CB2_GameplayCannotBeContinued(void) { gSaveFailedClockInfo[0] = FALSE; - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { Menu_DrawStdWindowFrame(1, MSG_WIN_TOP, 28, 19); Menu_PrintText(gSystemText_GameplayEnded, 2, MSG_WIN_TOP + 1); @@ -222,7 +222,7 @@ static void CB2_FadeAndReturnToTitleScreen(void) { gSaveFailedClockInfo[0] = FALSE; - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB(0, 0, 0)); SetVBlankCallback(VBlankCB); diff --git a/src/scrcmd.c b/src/scrcmd.c index 0fb970642..e6c0354c3 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -42,6 +42,7 @@ #include "sound.h" #include "string_util.h" #include "tv.h" +#include "constants/event_objects.h" #include "constants/maps.h" typedef u16 (*SpecialFunc)(void); @@ -766,7 +767,7 @@ bool8 ScrCmd_warphole(struct ScriptContext *ctx) u16 y; PlayerGetDestCoords(&x, &y); - if (mapGroup == MAP_GROUP(UNDEFINED) && mapNum == MAP_NUM(UNDEFINED)) + if (mapGroup == MAP_GROUP(MAP_UNDEFINED) && mapNum == MAP_NUM(MAP_UNDEFINED)) SetFixedHoleWarpAsDestination(x - 7, y - 7); else Overworld_SetWarpDestination(mapGroup, mapNum, -1, x - 7, y - 7); @@ -985,7 +986,7 @@ bool8 ScrCmd_waitmovement(struct ScriptContext *ctx) { u16 localId = VarGet(ScriptReadHalfword(ctx)); - if (localId != 0) + if (localId != LOCALID_NONE) sMovingNpcId = localId; sMovingNpcMapBank = gSaveBlock1.location.mapGroup; sMovingNpcMapId = gSaveBlock1.location.mapNum; @@ -999,7 +1000,7 @@ bool8 ScrCmd_waitmovement_at(struct ScriptContext *ctx) u8 mapBank; u8 mapId; - if (localId != 0) + if (localId != LOCALID_NONE) sMovingNpcId = localId; mapBank = ScriptReadByte(ctx); mapId = ScriptReadByte(ctx); @@ -1205,7 +1206,7 @@ bool8 ScrCmd_releaseall(struct ScriptContext *ctx) u8 objectId; HideFieldMessageBox(); - objectId = GetObjectEventIdByLocalIdAndMap(0xFF, 0, 0); + objectId = GetObjectEventIdByLocalIdAndMap(LOCALID_PLAYER, 0, 0); ObjectEventClearHeldMovementIfFinished(&gObjectEvents[objectId]); sub_80A2178(); UnfreezeObjectEvents(); @@ -1219,7 +1220,7 @@ bool8 ScrCmd_release(struct ScriptContext *ctx) HideFieldMessageBox(); if (gObjectEvents[gSelectedObjectEvent].active) ObjectEventClearHeldMovementIfFinished(&gObjectEvents[gSelectedObjectEvent]); - objectId = GetObjectEventIdByLocalIdAndMap(0xFF, 0, 0); + objectId = GetObjectEventIdByLocalIdAndMap(LOCALID_PLAYER, 0, 0); ObjectEventClearHeldMovementIfFinished(&gObjectEvents[objectId]); sub_80A2178(); UnfreezeObjectEvents(); @@ -1260,9 +1261,9 @@ bool8 ScrCmd_closemessage(struct ScriptContext *ctx) static bool8 WaitForAorBPress(void) { - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) return TRUE; - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) return TRUE; return FALSE; } @@ -1421,15 +1422,15 @@ bool8 ScrCmd_braillemessage(struct ScriptContext *ctx) { u8 *ptr = (u8 *)ScriptReadWord(ctx); - u8 v2 = ptr[0]; - u8 v3 = ptr[1]; - u8 v4 = ptr[2]; - u8 v5 = ptr[3]; - u8 v6 = ptr[4]; - u8 v7 = ptr[5]; + u8 winLeft = ptr[0]; + u8 winTop = ptr[1]; + u8 winRight = ptr[2]; + u8 winBottom = ptr[3]; + u8 textLeft = ptr[4]; + u8 textTop = ptr[5]; StringBraille(gStringVar4, ptr + 6); - Menu_DrawStdWindowFrame(v2, v3, v4, v5); - Menu_PrintText(gStringVar4, v6, v7); + Menu_DrawStdWindowFrame(winLeft, winTop, winRight, winBottom); + Menu_PrintText(gStringVar4, textLeft, textTop); return FALSE; } diff --git a/src/secret_base.c b/src/secret_base.c index 6762e4e58..754e2e925 100644 --- a/src/secret_base.c +++ b/src/secret_base.c @@ -73,30 +73,30 @@ const struct const u8 gUnknown_083D1374[] = { - MAP_NUM(SECRET_BASE_RED_CAVE1), 0, 1, 3, - MAP_NUM(SECRET_BASE_RED_CAVE2), 0, 5, 9, - MAP_NUM(SECRET_BASE_RED_CAVE3), 0, 1, 3, - MAP_NUM(SECRET_BASE_RED_CAVE4), 0, 7, 13, - MAP_NUM(SECRET_BASE_BROWN_CAVE1), 0, 2, 3, - MAP_NUM(SECRET_BASE_BROWN_CAVE2), 0, 9, 2, - MAP_NUM(SECRET_BASE_BROWN_CAVE3), 0, 13, 4, - MAP_NUM(SECRET_BASE_BROWN_CAVE4), 0, 1, 2, - MAP_NUM(SECRET_BASE_BLUE_CAVE1), 0, 1, 3, - MAP_NUM(SECRET_BASE_BLUE_CAVE2), 0, 1, 2, - MAP_NUM(SECRET_BASE_BLUE_CAVE3), 0, 3, 15, - MAP_NUM(SECRET_BASE_BLUE_CAVE4), 0, 3, 14, - MAP_NUM(SECRET_BASE_YELLOW_CAVE1), 0, 9, 3, - MAP_NUM(SECRET_BASE_YELLOW_CAVE2), 0, 8, 7, - MAP_NUM(SECRET_BASE_YELLOW_CAVE3), 0, 3, 6, - MAP_NUM(SECRET_BASE_YELLOW_CAVE4), 0, 5, 9, - MAP_NUM(SECRET_BASE_TREE1), 0, 2, 3, - MAP_NUM(SECRET_BASE_TREE2), 0, 5, 6, - MAP_NUM(SECRET_BASE_TREE3), 0, 15, 3, - MAP_NUM(SECRET_BASE_TREE4), 0, 4, 10, - MAP_NUM(SECRET_BASE_SHRUB1), 0, 3, 3, - MAP_NUM(SECRET_BASE_SHRUB2), 0, 1, 2, - MAP_NUM(SECRET_BASE_SHRUB3), 0, 7, 8, - MAP_NUM(SECRET_BASE_SHRUB4), 0, 9, 6 + MAP_NUM(MAP_SECRET_BASE_RED_CAVE1), 0, 1, 3, + MAP_NUM(MAP_SECRET_BASE_RED_CAVE2), 0, 5, 9, + MAP_NUM(MAP_SECRET_BASE_RED_CAVE3), 0, 1, 3, + MAP_NUM(MAP_SECRET_BASE_RED_CAVE4), 0, 7, 13, + MAP_NUM(MAP_SECRET_BASE_BROWN_CAVE1), 0, 2, 3, + MAP_NUM(MAP_SECRET_BASE_BROWN_CAVE2), 0, 9, 2, + MAP_NUM(MAP_SECRET_BASE_BROWN_CAVE3), 0, 13, 4, + MAP_NUM(MAP_SECRET_BASE_BROWN_CAVE4), 0, 1, 2, + MAP_NUM(MAP_SECRET_BASE_BLUE_CAVE1), 0, 1, 3, + MAP_NUM(MAP_SECRET_BASE_BLUE_CAVE2), 0, 1, 2, + MAP_NUM(MAP_SECRET_BASE_BLUE_CAVE3), 0, 3, 15, + MAP_NUM(MAP_SECRET_BASE_BLUE_CAVE4), 0, 3, 14, + MAP_NUM(MAP_SECRET_BASE_YELLOW_CAVE1), 0, 9, 3, + MAP_NUM(MAP_SECRET_BASE_YELLOW_CAVE2), 0, 8, 7, + MAP_NUM(MAP_SECRET_BASE_YELLOW_CAVE3), 0, 3, 6, + MAP_NUM(MAP_SECRET_BASE_YELLOW_CAVE4), 0, 5, 9, + MAP_NUM(MAP_SECRET_BASE_TREE1), 0, 2, 3, + MAP_NUM(MAP_SECRET_BASE_TREE2), 0, 5, 6, + MAP_NUM(MAP_SECRET_BASE_TREE3), 0, 15, 3, + MAP_NUM(MAP_SECRET_BASE_TREE4), 0, 4, 10, + MAP_NUM(MAP_SECRET_BASE_SHRUB1), 0, 3, 3, + MAP_NUM(MAP_SECRET_BASE_SHRUB2), 0, 1, 2, + MAP_NUM(MAP_SECRET_BASE_SHRUB3), 0, 7, 8, + MAP_NUM(MAP_SECRET_BASE_SHRUB4), 0, 9, 6 }; const struct MenuAction2 gUnknown_083D13D4[] = { @@ -356,7 +356,7 @@ void SetOccupiedSecretBaseEntranceMetatiles(const struct MapEvents *events) void sub_80BBA14(void) { s8 idx = 4 * (gCurrentSecretBaseId / 10); - warp1_set_2(MAP_GROUP(SECRET_BASE_RED_CAVE1), gUnknown_083D1374[idx], gUnknown_083D1374[idx + 1]); + warp1_set_2(MAP_GROUP(MAP_SECRET_BASE_RED_CAVE1), gUnknown_083D1374[idx], gUnknown_083D1374[idx + 1]); } void sub_80BBA48(u8 taskid) @@ -445,7 +445,7 @@ void sub_80BBC78(void) bool8 CurrentMapIsSecretBase(void) { - if (gSaveBlock1.location.mapGroup == MAP_GROUP(SECRET_BASE_SHRUB4) && (u8)(gSaveBlock1.location.mapNum) <= MAP_NUM(SECRET_BASE_SHRUB4)) + if (gSaveBlock1.location.mapGroup == MAP_GROUP(MAP_SECRET_BASE_SHRUB4) && (u8)(gSaveBlock1.location.mapNum) <= MAP_NUM(MAP_SECRET_BASE_SHRUB4)) return TRUE; return FALSE; } @@ -902,7 +902,7 @@ void sub_80BC824(u8 taskId) { s16 *taskData = gTasks[taskId].data; - if (gMain.newAndRepeatedKeys & DPAD_UP) + if (JOY_REPT(DPAD_UP)) { if (taskData[1]) { @@ -916,7 +916,7 @@ void sub_80BC824(u8 taskId) sub_80BC6B0(taskId); } } - else if (gMain.newAndRepeatedKeys & DPAD_DOWN) + else if (JOY_REPT(DPAD_DOWN)) { if (taskData[1] == taskData[3]) { @@ -933,7 +933,7 @@ void sub_80BC824(u8 taskId) taskData[1] = Menu_MoveCursor(1); } } - else if (gMain.newKeys & A_BUTTON) + else if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); if (taskData[1] + taskData[2] == taskData[0]) @@ -949,7 +949,7 @@ void sub_80BC824(u8 taskId) sub_80BC980(taskId); } } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); Menu_DestroyCursor(); @@ -991,7 +991,7 @@ void sub_80BC980(u8 taskId) void sub_80BC9E4(u8 taskId) { - if (gMain.newAndRepeatedKeys & DPAD_UP) + if (JOY_REPT(DPAD_UP)) { if (Menu_GetCursorPos()) { @@ -999,7 +999,7 @@ void sub_80BC9E4(u8 taskId) Menu_MoveCursor(-1); } } - else if (gMain.newAndRepeatedKeys & DPAD_DOWN) + else if (JOY_REPT(DPAD_DOWN)) { if (Menu_GetCursorPos() != 1) { @@ -1007,12 +1007,12 @@ void sub_80BC9E4(u8 taskId) Menu_MoveCursor(1); } } - else if (gMain.newKeys & A_BUTTON) + else if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); gUnknown_083D13D4[Menu_GetCursorPos()].func(taskId); } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); sub_80BCBF8(taskId); diff --git a/src/shop.c b/src/shop.c index 34086958e..1f9658a23 100644 --- a/src/shop.c +++ b/src/shop.c @@ -133,7 +133,7 @@ static void Task_DoBuySellMenu(u8 taskId) { const u8 taskIdConst = taskId; // why is a local const needed to match? - if (gMain.newAndRepeatedKeys & DPAD_UP) + if (JOY_REPT(DPAD_UP)) { if (gMartInfo.cursor) // can move cursor up? { @@ -141,7 +141,7 @@ static void Task_DoBuySellMenu(u8 taskId) gMartInfo.cursor = Menu_MoveCursor(-1); } } - else if (gMain.newAndRepeatedKeys & DPAD_DOWN) + else if (JOY_REPT(DPAD_DOWN)) { if (gMartInfo.cursor != gMartInfo.numChoices) // can move cursor down? { @@ -149,7 +149,7 @@ static void Task_DoBuySellMenu(u8 taskId) gMartInfo.cursor = Menu_MoveCursor(1); } } - else if (gMain.newKeys & A_BUTTON) + else if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); if (gMartInfo.martType == MART_TYPE_0) @@ -157,7 +157,7 @@ static void Task_DoBuySellMenu(u8 taskId) else sBuySellQuitMenuActions[gMartBuyNoSellOptionList[gMartInfo.cursor]].func(taskIdConst); } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); Task_HandleShopMenuQuit(taskIdConst); @@ -622,7 +622,7 @@ static void Shop_PrintItemDescText(void) static void Shop_DoPremierBallCheck(u8 taskId) { - if (gMain.newKeys & A_BUTTON || gMain.newKeys & B_BUTTON) + if (JOY_NEW(A_BUTTON) || JOY_NEW(B_BUTTON)) { Shop_DisplayPriceInList(gMartInfo.cursor, gMartInfo.cursor, 0); PlaySE(SE_SELECT); @@ -712,7 +712,7 @@ static void Shop_PrintPrice(u8 taskId) if (SellMenu_QuantityRoller(taskId, gMartInfo.curItemCount) == TRUE) Shop_DisplayPriceInCheckoutWindow(taskId); - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { gMartTotalCost = (ItemId_GetPrice(gMartInfo.itemList[gMartInfo.choicesAbove + gMartInfo.cursor]) >> GetPriceReduction(1)) * gTasks[taskId].tItemCount; // set total cost of your purchase. Menu_EraseWindowRect(0, 0xA, 0xD, 0xD); @@ -725,7 +725,7 @@ static void Shop_PrintPrice(u8 taskId) StringExpandPlaceholders(gStringVar4, gOtherText_ThatWillBe); DisplayItemMessageOnField(taskId, gStringVar4, Shop_DoYesNoPurchase, 0xC3E1); } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { Shop_DisplayPriceInList(gMartInfo.cursor, gMartInfo.cursor, 0); Task_ReturnToBuyMenu(taskId); @@ -1029,7 +1029,7 @@ static void Shop_DoCursorAction(u8 taskId) { if (!gPaletteFade.active) { - if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_UP) // only up can be pressed + if (JOY_REPT(DPAD_ANY) == DPAD_UP) // only up can be pressed { if (gMartInfo.cursor == 0) { @@ -1050,7 +1050,7 @@ static void Shop_DoCursorAction(u8 taskId) Shop_PrintItemDescText(); } } - else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_DOWN) // only down can be pressed + else if (JOY_REPT(DPAD_ANY) == DPAD_DOWN) // only down can be pressed { if (gMartInfo.cursor == 7) // are you at the bottom of the menu? { @@ -1071,7 +1071,7 @@ static void Shop_DoCursorAction(u8 taskId) Shop_PrintItemDescText(); } } - else if (gMain.newKeys & A_BUTTON) + else if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); @@ -1124,7 +1124,7 @@ static void Shop_DoCursorAction(u8 taskId) Task_ExitBuyMenu(taskId); } } - else if (gMain.newKeys & B_BUTTON) // go back to buy/sell/exit menu + else if (JOY_NEW(B_BUTTON)) // go back to buy/sell/exit menu { PlaySE(SE_SELECT); Task_ExitBuyMenu(taskId); diff --git a/src/slot_machine.c b/src/slot_machine.c index 41b9c42a5..ab590d555 100644 --- a/src/slot_machine.c +++ b/src/slot_machine.c @@ -672,7 +672,7 @@ static bool8 sub_8101E3C(struct Task *task) #if DEBUG if (unk_debug_bss_1_1 != 0 && unk_debug_bss_1_4 != 0) { - if (sSlotMachine->coins <= 3 || (gMain.heldKeys & B_BUTTON)) + if (sSlotMachine->coins <= 3 || JOY_HELD(B_BUTTON)) { unk_debug_bss_1_4 = 0; } @@ -687,7 +687,7 @@ static bool8 sub_8101E3C(struct Task *task) return 0; } } - if (unk_debug_bss_1_1 != 0 && (gMain.newKeys & 8)) + if (unk_debug_bss_1_1 != 0 && JOY_NEW(START_BUTTON)) { debug_sub_811B620(); sSlotMachine->state = 29; @@ -695,12 +695,12 @@ static bool8 sub_8101E3C(struct Task *task) } #endif - if (gMain.newKeys & SELECT_BUTTON) + if (JOY_NEW(SELECT_BUTTON)) { sub_8104AB8(0); sSlotMachine->state = 8; } - else if (gMain.newKeys & R_BUTTON) + else if (JOY_NEW(R_BUTTON)) { if (sSlotMachine->coins - (3 - sSlotMachine->bet) >= 0) { @@ -718,16 +718,16 @@ static bool8 sub_8101E3C(struct Task *task) } else { - if (gMain.newKeys & DPAD_DOWN && sSlotMachine->coins != 0) + if (JOY_NEW(DPAD_DOWN) && sSlotMachine->coins != 0) { PlaySE(SE_SHOP); sub_8103D50(sSlotMachine->bet); sSlotMachine->coins--; sSlotMachine->bet++; } - if (sSlotMachine->bet >= 3 || (sSlotMachine->bet != 0 && gMain.newKeys & A_BUTTON)) + if (sSlotMachine->bet >= 3 || (sSlotMachine->bet != 0 && JOY_NEW(A_BUTTON))) sSlotMachine->state = 9; - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) sSlotMachine->state = 21; } return FALSE; @@ -748,7 +748,7 @@ static bool8 sub_8101F44(struct Task *task) static bool8 sub_8101F60(struct Task *task) { - if (gMain.newKeys & (A_BUTTON | B_BUTTON)) + if (JOY_NEW(A_BUTTON | B_BUTTON)) { Menu_EraseScreen(); sSlotMachine->state = 5; @@ -834,7 +834,7 @@ static bool8 sub_8102058(struct Task *task) } #endif - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { PlaySE(SE_CONTEST_PLACE); sub_8102E1C(sSlotMachine->unk18); @@ -1088,7 +1088,7 @@ static bool8 sub_810239C(struct Task *task) static bool8 sub_81023B8(struct Task *task) { - if (gMain.newKeys & (A_BUTTON | B_BUTTON)) + if (JOY_NEW(A_BUTTON | B_BUTTON)) { Menu_EraseScreen(); sSlotMachine->state = 5; @@ -1105,7 +1105,7 @@ static bool8 sub_81023E0(struct Task *task) static bool8 sub_81023FC(struct Task *task) { - if (gMain.newKeys & (A_BUTTON | B_BUTTON)) + if (JOY_NEW(A_BUTTON | B_BUTTON)) { Menu_EraseScreen(); sSlotMachine->state = 27; @@ -1543,10 +1543,10 @@ static bool8 sub_8102AD0(struct Task *task) if (sSlotMachine->coins < 9999) sSlotMachine->coins++; task->data[1] = 8; - if (gMain.heldKeys & A_BUTTON) + if (JOY_HELD(A_BUTTON)) task->data[1] = 4; } - if (IsFanfareTaskInactive() && gMain.newKeys & START_BUTTON) + if (IsFanfareTaskInactive() && JOY_NEW(START_BUTTON)) { PlaySE(SE_PIN); sSlotMachine->coins += sSlotMachine->payout; @@ -3035,7 +3035,7 @@ static void sub_8104B80(struct Task *task) static void sub_8104BC8(struct Task *task) { - if (gMain.newKeys & (B_BUTTON | SELECT_BUTTON)) + if (JOY_NEW(B_BUTTON | SELECT_BUTTON)) { BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB(0, 0, 0)); task->data[0]++; @@ -5797,13 +5797,13 @@ static void debug_sub_811B654(u8 taskId) task->data[0]++; break; case 1: - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { Menu_EraseScreen(); DestroyTask(taskId); break; } - if (gMain.newKeys & 0x20) + if (JOY_NEW(DPAD_LEFT)) { sSlotMachine->unk01--; if ((s8)sSlotMachine->unk01 < 0) // Why? It's unsigned @@ -5811,7 +5811,7 @@ static void debug_sub_811B654(u8 taskId) debug_sub_811B2E8(); break; } - if (gMain.newKeys & 0x10) + if (JOY_NEW(DPAD_RIGHT)) { sSlotMachine->unk01++; if (sSlotMachine->unk01 > 5) @@ -5819,7 +5819,7 @@ static void debug_sub_811B654(u8 taskId) debug_sub_811B2E8(); break; } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { task->data[0] = 3; Menu_EraseScreen(); @@ -5828,7 +5828,7 @@ static void debug_sub_811B654(u8 taskId) Menu_PrintText(Str_841B264, 1, 3); break; } - if (gMain.newKeys & 4) + if (JOY_NEW(SELECT_BUTTON)) { unk_debug_bss_1_2 = 0; unk_debug_bss_1_3 = 0; @@ -5839,7 +5839,7 @@ static void debug_sub_811B654(u8 taskId) InitMenu(0, 1, 3, 8, 0, 9); task->data[0]++; } - if (gMain.newKeys & 8) + if (JOY_NEW(START_BUTTON)) { unk_debug_bss_1_4 = 1; Menu_EraseScreen(); @@ -5859,35 +5859,35 @@ static void debug_sub_811B654(u8 taskId) DestroyTask(taskId); break; case 3: - if (gMain.newAndRepeatedKeys & 0x80) + if (JOY_REPT(0x80)) { sSlotMachine->coins += 100; if (sSlotMachine->coins > 9999) sSlotMachine->coins = 9999; break; } - if (gMain.newAndRepeatedKeys & 0x40) + if (JOY_REPT(0x40)) { sSlotMachine->coins -= 100; if (sSlotMachine->coins <= 0) sSlotMachine->coins = 9999; break; } - if (gMain.newAndRepeatedKeys & 0x20) + if (JOY_REPT(0x20)) { sSlotMachine->coins -= 1000; if (sSlotMachine->coins <= 0) sSlotMachine->coins = 9999; break; } - if (gMain.newAndRepeatedKeys & 0x10) + if (JOY_REPT(0x10)) { sSlotMachine->coins += 1000; if (sSlotMachine->coins > 9999) sSlotMachine->coins = 9999; break; } - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { Menu_EraseScreen(); DestroyTask(taskId); diff --git a/src/start_menu.c b/src/start_menu.c index 6dc024c1b..a2082a1d9 100644 --- a/src/start_menu.c +++ b/src/start_menu.c @@ -195,7 +195,7 @@ void debug_sub_8075C40(u8 taskId) data[0]++; break; case 3: - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { Menu_EraseScreen(); ScriptContext2_Disable(); @@ -415,17 +415,17 @@ void sub_8071310(void) static u8 StartMenu_InputProcessCallback(void) { - if (gMain.newKeys & DPAD_UP) + if (JOY_NEW(DPAD_UP)) { PlaySE(SE_SELECT); sStartMenuCursorPos = Menu_MoveCursor(-1); } - if (gMain.newKeys & DPAD_DOWN) + if (JOY_NEW(DPAD_DOWN)) { PlaySE(SE_SELECT); sStartMenuCursorPos = Menu_MoveCursor(1); } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); if (sStartMenuItems[sCurrentStartMenuActions[sStartMenuCursorPos]].func == StartMenu_PokedexCallback) @@ -440,7 +440,7 @@ static u8 StartMenu_InputProcessCallback(void) FadeScreen(1, 0); return 0; } - if (gMain.newKeys & (START_BUTTON | B_BUTTON)) + if (JOY_NEW(START_BUTTON | B_BUTTON)) { CloseMenu(); return 1; @@ -666,7 +666,7 @@ static void SaveDialogStartTimeout(void) static bool8 SaveDialogCheckForTimeoutOrKeypress(void) { saveDialogTimer--; - if (gMain.heldKeys & A_BUTTON) + if (JOY_HELD(A_BUTTON)) { PlaySE(SE_SELECT); return TRUE; @@ -680,7 +680,7 @@ static bool8 SaveDialogCheckForTimeoutAndKeypress(void) { if (saveDialogTimer != 0) saveDialogTimer--; - else if (gMain.heldKeys & A_BUTTON) + else if (JOY_HELD(A_BUTTON)) return TRUE; return FALSE; } diff --git a/src/starter_choose.c b/src/starter_choose.c index 9cdd26f09..eb10294f5 100644 --- a/src/starter_choose.c +++ b/src/starter_choose.c @@ -364,7 +364,7 @@ static void Task_StarterChoose2(u8 taskId) { u8 selection = gTasks[taskId].tStarterSelection; - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { u8 spriteId; @@ -398,12 +398,12 @@ static void Task_StarterChoose2(u8 taskId) } else { - if ((gMain.newKeys & DPAD_LEFT) && selection > 0) + if (JOY_NEW(DPAD_LEFT) && selection > 0) { gTasks[taskId].tStarterSelection--; CreateStarterPokemonLabel(selection, gTasks[taskId].tStarterSelection); } - else if ((gMain.newKeys & DPAD_RIGHT) && selection < 2) + else if (JOY_NEW(DPAD_RIGHT) && selection < 2) { gTasks[taskId].tStarterSelection++; CreateStarterPokemonLabel(selection, gTasks[taskId].tStarterSelection); diff --git a/src/text.c b/src/text.c index 8b4d17d78..b952475af 100644 --- a/src/text.c +++ b/src/text.c @@ -2409,7 +2409,7 @@ static u8 UpdateWindowText(struct Window *win) case WIN_STATE_WAIT_BUTTON: if (PlayerCanInterruptDelay(win)) { - if (gMain.newKeys & (A_BUTTON | B_BUTTON)) + if (JOY_NEW(A_BUTTON | B_BUTTON)) { PlaySE(SE_SELECT); } @@ -2429,7 +2429,7 @@ static u8 UpdateWindowText(struct Window *win) case WIN_STATE_CHAR_DELAY: // Allow the player to speed up text by holding a button if (PlayerCanInterruptDelay(win) - && (gMain.heldKeys & (A_BUTTON | B_BUTTON)) + && JOY_HELD(A_BUTTON | B_BUTTON) && gMain.watchedKeysPressed == TRUE) { win->delayCounter = 0; @@ -3247,7 +3247,7 @@ static u8 WaitWithDownArrow(struct Window *win) } else { - if (gMain.newKeys & (A_BUTTON | B_BUTTON)) + if (JOY_NEW(A_BUTTON | B_BUTTON)) { PlaySE(SE_SELECT); TryEraseDownArrow(win); diff --git a/src/title_screen.c b/src/title_screen.c index c686c8d89..11719a30b 100644 --- a/src/title_screen.c +++ b/src/title_screen.c @@ -637,7 +637,7 @@ static void MainCB2(void) static void Task_TitleScreenPhase1(u8 taskId) { //Skip to next phase when A, B, Start, or Select is pressed - if ((gMain.newKeys & A_B_START_SELECT) || gTasks[taskId].data[1] != 0) + if (JOY_NEW(A_B_START_SELECT) || gTasks[taskId].data[1] != 0) { gTasks[taskId].tSkipToNext = TRUE; gTasks[taskId].tCounter = 0; @@ -682,7 +682,7 @@ static void Task_TitleScreenPhase1(u8 taskId) static void Task_TitleScreenPhase2(u8 taskId) { //Skip to next phase when A, B, Start, or Select is pressed - if ((gMain.newKeys & A_B_START_SELECT) || gTasks[taskId].tSkipToNext) + if (JOY_NEW(A_B_START_SELECT) || gTasks[taskId].tSkipToNext) { gTasks[taskId].tSkipToNext = TRUE; gTasks[taskId].tCounter = 0; @@ -719,7 +719,7 @@ static void Task_TitleScreenPhase3(u8 taskId) REG_BLDALPHA = 0x1F0F; REG_BLDY = 0; - if ((gMain.newKeys & A_BUTTON) || (gMain.newKeys & START_BUTTON)) + if (JOY_NEW(A_BUTTON) || JOY_NEW(START_BUTTON)) { FadeOutBGM(4); BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, FADE_COLOR_WHITE); @@ -727,9 +727,9 @@ static void Task_TitleScreenPhase3(u8 taskId) } else { - if ((gMain.heldKeys & CLEAR_SAVE_BUTTON_COMBO) == CLEAR_SAVE_BUTTON_COMBO) + if (JOY_HELD(CLEAR_SAVE_BUTTON_COMBO) == CLEAR_SAVE_BUTTON_COMBO) SetMainCallback2(CB2_GoToClearSaveDataScreen); - if ((gMain.heldKeys & RESET_RTC_BUTTON_COMBO) == RESET_RTC_BUTTON_COMBO + if (JOY_HELD(RESET_RTC_BUTTON_COMBO) == RESET_RTC_BUTTON_COMBO && CanResetRTC() == 1) { FadeOutBGM(4); diff --git a/src/trade.c b/src/trade.c index 8433d087f..b3a714da5 100644 --- a/src/trade.c +++ b/src/trade.c @@ -1873,23 +1873,23 @@ static void sub_8049620(void) static void sub_8049680(void) { int i; - if (gMain.newAndRepeatedKeys & DPAD_UP) + if (JOY_REPT(DPAD_UP)) { TradeMenuMoveCursor(&gUnknown_03004824->tradeMenuCursorPosition, 0); } - else if (gMain.newAndRepeatedKeys & DPAD_DOWN) + else if (JOY_REPT(DPAD_DOWN)) { TradeMenuMoveCursor(&gUnknown_03004824->tradeMenuCursorPosition, 1); } - else if (gMain.newAndRepeatedKeys & DPAD_LEFT) + else if (JOY_REPT(DPAD_LEFT)) { TradeMenuMoveCursor(&gUnknown_03004824->tradeMenuCursorPosition, 2); } - else if (gMain.newAndRepeatedKeys & DPAD_RIGHT) + else if (JOY_REPT(DPAD_RIGHT)) { TradeMenuMoveCursor(&gUnknown_03004824->tradeMenuCursorPosition, 3); } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); if (gUnknown_03004824->tradeMenuCursorPosition < PARTY_SIZE) @@ -1912,7 +1912,7 @@ static void sub_8049680(void) sub_804ACD8(gUnknown_0820C14C[4], BG_CHAR_ADDR(4) + 32 * gUnknown_03004824->unk_007e, 20); } } - if (gMain.newKeys & R_BUTTON) + if (JOY_NEW(R_BUTTON)) { for (i = 0; i < 10; i ++) { @@ -1933,17 +1933,17 @@ static void sub_8049804(void) static void sub_8049860(void) { - if (gMain.newAndRepeatedKeys & DPAD_UP) + if (JOY_REPT(DPAD_UP)) { PlaySE(SE_SELECT); gUnknown_03004824->unk_007c = Menu_MoveCursor(-1); } - else if (gMain.newAndRepeatedKeys & DPAD_DOWN) + else if (JOY_REPT(DPAD_DOWN)) { PlaySE(SE_SELECT); gUnknown_03004824->unk_007c = Menu_MoveCursor(+1); } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); if (Menu_GetCursorPos() == 0) @@ -1962,7 +1962,7 @@ static void sub_8049860(void) gSprites[gUnknown_03004824->tradeMenuCursorSpriteIdx].invisible = TRUE; } } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); sub_8049804(); @@ -1971,7 +1971,7 @@ static void sub_8049860(void) static void sub_8049954(void) { - if (gMain.newKeys & A_BUTTON || gMain.newKeys & B_BUTTON) + if (JOY_NEW(A_BUTTON) || JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); sub_8049804(); @@ -2034,17 +2034,17 @@ static void sub_8049A20(void) static void sub_8049AC0(void) { - if (gMain.newAndRepeatedKeys & DPAD_UP) + if (JOY_REPT(DPAD_UP)) { PlaySE(SE_SELECT); gUnknown_03004824->unk_007c = Menu_MoveCursor(-1); } - else if (gMain.newAndRepeatedKeys & DPAD_DOWN) + else if (JOY_REPT(DPAD_DOWN)) { PlaySE(SE_SELECT); gUnknown_03004824->unk_007c = Menu_MoveCursor(+1); } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); if (Menu_GetCursorPos() == 0) @@ -2062,7 +2062,7 @@ static void sub_8049AC0(void) } gUnknown_03004824->unk_007b = 100; } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { sub_804AADC(3, 1); if (Menu_GetCursorPos() == 0) @@ -2077,17 +2077,17 @@ static void sub_8049AC0(void) static void sub_8049BC0(void) { - if (gMain.newAndRepeatedKeys & DPAD_UP) + if (JOY_REPT(DPAD_UP)) { PlaySE(SE_SELECT); gUnknown_03004824->unk_007c = Menu_MoveCursor(-1); } - else if (gMain.newAndRepeatedKeys & DPAD_DOWN) + else if (JOY_REPT(DPAD_DOWN)) { PlaySE(SE_SELECT); gUnknown_03004824->unk_007c = Menu_MoveCursor(+1); } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); if (Menu_GetCursorPos() == 0) @@ -2104,7 +2104,7 @@ static void sub_8049BC0(void) sub_8049804(); } } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); sub_8049804(); @@ -2144,7 +2144,7 @@ static void DisplayMessageAndContinueTask(void) static void sub_8049D44(void) { - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); sub_804A840(0); @@ -4765,7 +4765,7 @@ static bool8 sub_804C29C(void) { return TRUE; } - else if (gMain.newKeys & A_BUTTON) + else if (JOY_NEW(A_BUTTON)) { gUnknown_03004828->unk_00c4 ++; } diff --git a/src/trader.c b/src/trader.c index 5403f53eb..7b14c99ce 100644 --- a/src/trader.c +++ b/src/trader.c @@ -145,17 +145,17 @@ void Task_HandleGetDecorationMenuInput(u8 taskId) { struct MauvilleManTrader *trader = &gSaveBlock1.mauvilleMan.trader; - if (gMain.newKeys & DPAD_UP) + if (JOY_NEW(DPAD_UP)) { PlaySE(SE_SELECT); Menu_MoveCursor(-1); } - else if (gMain.newKeys & DPAD_DOWN) + else if (JOY_NEW(DPAD_DOWN)) { PlaySE(SE_SELECT); Menu_MoveCursor(1); } - else if (gMain.newKeys & A_BUTTON) + else if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); gSpecialVar_0x8005 = Menu_GetCursorPos(); @@ -169,7 +169,7 @@ void Task_HandleGetDecorationMenuInput(u8 taskId) sub_8109B34(taskId, trader->unk1[gSpecialVar_0x8005]); } } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); sub_8109B34(taskId, 0); diff --git a/src/trainer_card.c b/src/trainer_card.c index afd7a8d03..8caf463cd 100644 --- a/src/trainer_card.c +++ b/src/trainer_card.c @@ -687,12 +687,12 @@ bool8 TrainerCard_WaitForFadeInToFinish(struct Task *task) bool8 TrainerCard_WaitForKeys(struct Task *task) { - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { gTrainerCardPtr->current_state = 5; /* Jump to fadeout state */ return TRUE; } - else if (gMain.newKeys & A_BUTTON) + else if (JOY_NEW(A_BUTTON)) { /* It appears that it was previously possible to return the the front side after viewing the back side. This was probably removed due to being @@ -709,7 +709,7 @@ bool8 TrainerCard_WaitForKeys(struct Task *task) return TRUE; } #if DEBUG - else if (gDebug_03000748 && gMain.newKeys & R_BUTTON) + else if (gDebug_03000748 && JOY_NEW(R_BUTTON)) { gTrainerCardPtr->starCount++; gTrainerCardPtr->starCount %= 5; diff --git a/src/tv.c b/src/tv.c index 19a2765d5..96a8295c0 100644 --- a/src/tv.c +++ b/src/tv.c @@ -40,6 +40,7 @@ #include "strings.h" #include "text.h" #include "ewram.h" +#include "constants/event_objects.h" #include "constants/moves.h" #include "constants/region_map_sections.h" #include "constants/metatile_labels.h" @@ -543,8 +544,8 @@ void UpdateTVScreensOnMap(int width, int height) case 2: break; default: - if (gSaveBlock1.location.mapGroup == MAP_GROUP(LILYCOVE_CITY_COVE_LILY_MOTEL_1F) - && gSaveBlock1.location.mapNum == MAP_NUM(LILYCOVE_CITY_COVE_LILY_MOTEL_1F)) + if (gSaveBlock1.location.mapGroup == MAP_GROUP(MAP_LILYCOVE_CITY_COVE_LILY_MOTEL_1F) + && gSaveBlock1.location.mapNum == MAP_NUM(MAP_LILYCOVE_CITY_COVE_LILY_MOTEL_1F)) { SetTVMetatilesOnMap(width, height, METATILE_ID(Building, TV_On)); } @@ -721,41 +722,41 @@ u8 GabbyAndTyGetLastBattleTrivia(void) return 0; } -void GabbyAndTySetScriptVarsToObjectEventLocalIds(void) +void GetGabbyAndTyLocalIds(void) { switch (GabbyAndTyGetBattleNum()) { case 1: - gSpecialVar_0x8004 = 0xE; - gSpecialVar_0x8005 = 0xD; + gSpecialVar_0x8004 = LOCALID_ROUTE111_GABBY_1; + gSpecialVar_0x8005 = LOCALID_ROUTE111_TY_1; break; case 2: - gSpecialVar_0x8004 = 0x5; - gSpecialVar_0x8005 = 0x6; + gSpecialVar_0x8004 = LOCALID_ROUTE118_GABBY_1; + gSpecialVar_0x8005 = LOCALID_ROUTE118_TY_1; break; case 3: - gSpecialVar_0x8004 = 0x12; - gSpecialVar_0x8005 = 0x11; + gSpecialVar_0x8004 = LOCALID_ROUTE120_GABBY_1; + gSpecialVar_0x8005 = LOCALID_ROUTE120_TY_1; break; case 4: - gSpecialVar_0x8004 = 0x15; - gSpecialVar_0x8005 = 0x16; + gSpecialVar_0x8004 = LOCALID_ROUTE111_GABBY_2; + gSpecialVar_0x8005 = LOCALID_ROUTE111_TY_2; break; case 5: - gSpecialVar_0x8004 = 0x8; - gSpecialVar_0x8005 = 0x9; + gSpecialVar_0x8004 = LOCALID_ROUTE118_GABBY_2; + gSpecialVar_0x8005 = LOCALID_ROUTE118_TY_2; break; case 6: - gSpecialVar_0x8004 = 0x13; - gSpecialVar_0x8005 = 0x14; + gSpecialVar_0x8004 = LOCALID_ROUTE120_GABBY_2; + gSpecialVar_0x8005 = LOCALID_ROUTE120_TY_2; break; case 7: - gSpecialVar_0x8004 = 0x17; - gSpecialVar_0x8005 = 0x18; + gSpecialVar_0x8004 = LOCALID_ROUTE111_GABBY_3; + gSpecialVar_0x8005 = LOCALID_ROUTE111_TY_3; break; case 8: - gSpecialVar_0x8004 = 0xA; - gSpecialVar_0x8005 = 0xB; + gSpecialVar_0x8004 = LOCALID_ROUTE118_GABBY_3; + gSpecialVar_0x8005 = LOCALID_ROUTE118_TY_3; break; } } @@ -1452,16 +1453,16 @@ bool8 IsPriceDiscounted(u8 arg0) switch (arg0) { case 1: - if (gSaveBlock1.location.mapGroup == MAP_GROUP(SLATEPORT_CITY) - && gSaveBlock1.location.mapNum == MAP_NUM(SLATEPORT_CITY) + if (gSaveBlock1.location.mapGroup == MAP_GROUP(MAP_SLATEPORT_CITY) + && gSaveBlock1.location.mapNum == MAP_NUM(MAP_SLATEPORT_CITY) && gSpecialVar_LastTalked == 0x1a) return TRUE; else return FALSE; break; case 3: - if (gSaveBlock1.location.mapGroup == MAP_GROUP(LILYCOVE_CITY_DEPARTMENT_STORE_ROOFTOP) - && gSaveBlock1.location.mapNum == MAP_NUM(LILYCOVE_CITY_DEPARTMENT_STORE_ROOFTOP)) + if (gSaveBlock1.location.mapGroup == MAP_GROUP(MAP_LILYCOVE_CITY_DEPARTMENT_STORE_ROOFTOP) + && gSaveBlock1.location.mapNum == MAP_NUM(MAP_LILYCOVE_CITY_DEPARTMENT_STORE_ROOFTOP)) return TRUE; else return FALSE; @@ -2113,16 +2114,16 @@ u32 GetPlayerTrainerId(void) u8 CheckForBigMovieOrEmergencyNewsOnTV(void) { - if (gSaveBlock1.location.mapGroup != MAP_GROUP(LITTLEROOT_TOWN_BRENDANS_HOUSE_1F)) + if (gSaveBlock1.location.mapGroup != MAP_GROUP(MAP_LITTLEROOT_TOWN_BRENDANS_HOUSE_1F)) return 0; if (gSaveBlock2.playerGender == MALE) { - if (gSaveBlock1.location.mapNum != MAP_NUM(LITTLEROOT_TOWN_BRENDANS_HOUSE_1F)) + if (gSaveBlock1.location.mapNum != MAP_NUM(MAP_LITTLEROOT_TOWN_BRENDANS_HOUSE_1F)) return 0; } else { - if (gSaveBlock1.location.mapNum != MAP_NUM(LITTLEROOT_TOWN_MAYS_HOUSE_1F)) + if (gSaveBlock1.location.mapNum != MAP_NUM(MAP_LITTLEROOT_TOWN_MAYS_HOUSE_1F)) return 0; } if (FlagGet(FLAG_SYS_TV_LATI) == 1) @@ -2134,11 +2135,11 @@ u8 CheckForBigMovieOrEmergencyNewsOnTV(void) void GetMomOrDadStringForTVMessage(void) { - if (gSaveBlock1.location.mapGroup == MAP_GROUP(LITTLEROOT_TOWN_BRENDANS_HOUSE_1F)) + if (gSaveBlock1.location.mapGroup == MAP_GROUP(MAP_LITTLEROOT_TOWN_BRENDANS_HOUSE_1F)) { if (gSaveBlock2.playerGender == MALE) { - if (gSaveBlock1.location.mapNum == MAP_NUM(LITTLEROOT_TOWN_BRENDANS_HOUSE_1F)) + if (gSaveBlock1.location.mapNum == MAP_NUM(MAP_LITTLEROOT_TOWN_BRENDANS_HOUSE_1F)) { StringCopy(gStringVar1, gOtherText_Mom); VarSet(VAR_TEMP_3, 1); @@ -2146,7 +2147,7 @@ void GetMomOrDadStringForTVMessage(void) } else { - if (gSaveBlock1.location.mapNum == MAP_NUM(LITTLEROOT_TOWN_MAYS_HOUSE_1F)) + if (gSaveBlock1.location.mapNum == MAP_NUM(MAP_LITTLEROOT_TOWN_MAYS_HOUSE_1F)) { StringCopy(gStringVar1, gOtherText_Mom); VarSet(VAR_TEMP_3, 1); @@ -2186,7 +2187,7 @@ void GetMomOrDadStringForTVMessage(void) void sub_80BFD20(void) { VarSet(VAR_BRAVO_TRAINER_BATTLE_TOWER_ON, 0); - RemoveObjectEventByLocalIdAndMap(5, gSaveBlock1.location.mapNum, gSaveBlock1.location.mapGroup); + RemoveObjectEventByLocalIdAndMap(LOCALID_TOWER_LOBBY_REPORTER, gSaveBlock1.location.mapNum, gSaveBlock1.location.mapGroup); } void sub_80BFE24(TVShow arg0[TV_SHOWS_COUNT], TVShow arg1[TV_SHOWS_COUNT], TVShow arg2[TV_SHOWS_COUNT], TVShow arg3[TV_SHOWS_COUNT]); diff --git a/src/use_pokeblock.c b/src/use_pokeblock.c index 78b5db4a8..22b31aab0 100644 --- a/src/use_pokeblock.c +++ b/src/use_pokeblock.c @@ -374,26 +374,26 @@ static void sub_8136638(void) switch (gUnknown_02039304->unk50) { case 0: - if (gMain.heldKeys & DPAD_UP) + if (JOY_HELD(DPAD_UP)) { PlaySE(SE_SELECT); sub_80F5060(TRUE); move_anim_execute(); gUnknown_02039304->unk50 = 1; } - else if (gMain.heldKeys & DPAD_DOWN) + else if (JOY_HELD(DPAD_DOWN)) { PlaySE(SE_SELECT); sub_80F5060(FALSE); move_anim_execute(); gUnknown_02039304->unk50 = 1; } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); gUnknown_02039304->unk50 = 3; } - else if (gMain.newKeys & A_BUTTON) + else if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); if (gPokenavStructPtr->unk87DC == gPokenavStructPtr->unk87DA - 1) @@ -450,7 +450,7 @@ static void sub_8136638(void) } break; case 7: - if (gMain.newKeys & (A_BUTTON | B_BUTTON)) + if (JOY_NEW(A_BUTTON | B_BUTTON)) { sub_8136D8C(); gUnknown_02039304->unk50 = 0; @@ -544,7 +544,7 @@ static void sub_81369CC(void) gUnknown_02039304->unk50++; break; case 1: - if (gMain.newKeys & (A_BUTTON | B_BUTTON)) + if (JOY_NEW(A_BUTTON | B_BUTTON)) gUnknown_02039304->unk50++; break; case 2: @@ -571,7 +571,7 @@ static void sub_81369CC(void) } break; case 5: - if (gMain.newKeys & (A_BUTTON | B_BUTTON) && !sub_8136D00()) + if (JOY_NEW(A_BUTTON | B_BUTTON) && !sub_8136D00()) { PokeblockClearIfExists((u8)gSpecialVar_ItemId); launch_c3_walk_stairs_and_run_once(sub_8136B44); diff --git a/src/wallclock.c b/src/wallclock.c index 85f9f1419..82f1992ac 100644 --- a/src/wallclock.c +++ b/src/wallclock.c @@ -737,17 +737,17 @@ static void Task_SetClock2(u8 taskId) { gTasks[taskId].tMinuteHandAngle = gTasks[taskId].tMinutes * 6; gTasks[taskId].tHourHandAngle = (gTasks[taskId].tHours % 12) * 30 + (gTasks[taskId].tMinutes / 10) * 5; - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { gTasks[taskId].func = Task_SetClock3; return; } else { - gTasks[taskId].tMvmtDir = gMain.newKeys & A_BUTTON; - if (gMain.heldKeys & DPAD_LEFT) + gTasks[taskId].tMvmtDir = JOY_NEW(A_BUTTON); + if (JOY_HELD(DPAD_LEFT)) gTasks[taskId].tMvmtDir = MVMT_BACKWARD; - if (gMain.heldKeys & DPAD_RIGHT) + if (JOY_HELD(DPAD_RIGHT)) gTasks[taskId].tMvmtDir = MVMT_FORWARD; if (gTasks[taskId].tMvmtDir) { @@ -821,7 +821,7 @@ static void Task_ViewClock1(u8 taskId) static void Task_ViewClock2(u8 taskId) { InitClockWithRtc(taskId); - if (gMain.newKeys & (A_BUTTON | B_BUTTON)) + if (JOY_NEW(A_BUTTON | B_BUTTON)) gTasks[taskId].func = Task_ViewClock3; } diff --git a/src/wild_encounter.c b/src/wild_encounter.c index 3aed641b0..c00b7c87c 100644 --- a/src/wild_encounter.c +++ b/src/wild_encounter.c @@ -18,6 +18,8 @@ #include "data/wild_encounters.h" +#define MAX_ENCOUNTER_RATE 2880 + const struct WildPokemon gWildFeebasRoute119Data = {20, 25, SPECIES_FEEBAS}; const u16 gRoute119WaterTileData[] = @@ -79,8 +81,8 @@ static bool8 CheckFeebas(void) u8 route119section = 0; u16 waterTileNum; - if (gSaveBlock1.location.mapGroup == MAP_GROUP(ROUTE119) - && gSaveBlock1.location.mapNum == MAP_NUM(ROUTE119)) + if (gSaveBlock1.location.mapGroup == MAP_GROUP(MAP_ROUTE119) + && gSaveBlock1.location.mapNum == MAP_NUM(MAP_ROUTE119)) { GetXYCoordsOneStepInFrontOfPlayer(&x, &y); x -= 7; @@ -374,7 +376,7 @@ static bool8 DoMassOutbreakEncounterTest(void) static bool8 DoWildEncounterRateDiceRoll(u16 encounterRate) { - if (Random() % 2880 < encounterRate) + if (Random() % MAX_ENCOUNTER_RATE < encounterRate) return TRUE; else return FALSE; @@ -417,8 +419,8 @@ static bool8 DoWildEncounterTest(u32 encounterRate, bool8 ignoreAbility) encounterRate *= 2; } } - if (encounterRate > 2880) - encounterRate = 2880; + if (encounterRate > MAX_ENCOUNTER_RATE) + encounterRate = MAX_ENCOUNTER_RATE; return DoWildEncounterRateDiceRoll(encounterRate); } diff --git a/tools/aif2pcm/.gitignore b/tools/aif2pcm/.gitignore deleted file mode 100644 index 31531797e..000000000 --- a/tools/aif2pcm/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -aif2pcm - diff --git a/tools/aif2pcm/Makefile b/tools/aif2pcm/Makefile deleted file mode 100644 index dd48a8759..000000000 --- a/tools/aif2pcm/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -CC ?= gcc - -CFLAGS = -Wall -Wextra -Wno-switch -Werror -std=c11 -O2 - -LIBS = -lm - -SRCS = main.c extended.c - -ifeq ($(OS),Windows_NT) -EXE := .exe -else -EXE := -endif - -.PHONY: all clean - -all: aif2pcm$(EXE) - @: - -aif2pcm$(EXE): $(SRCS) - $(CC) $(CFLAGS) $(SRCS) -o $@ $(LDFLAGS) $(LIBS) - -clean: - $(RM) aif2pcm aif2pcm.exe diff --git a/tools/aif2pcm/extended.c b/tools/aif2pcm/extended.c deleted file mode 100644 index 94449164b..000000000 --- a/tools/aif2pcm/extended.c +++ /dev/null @@ -1,172 +0,0 @@ -/* $Id: extended.c,v 1.8 2006/12/23 11:17:49 toad32767 Exp $ */ -/*- - * Copyright (c) 2005, 2006 by Marco Trillo - * - * Permission is hereby granted, free of charge, to any - * person obtaining a copy of this software and associated - * documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the - * Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice - * shall be included in all copies or substantial portions of - * the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY - * KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE - * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR - * PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS - * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#include -#include -#include - -/* - * Infinite & NAN values - * for non-IEEE systems - */ -#ifndef HUGE_VAL -#ifdef HUGE -#define INFINITE_VALUE HUGE -#define NAN_VALUE HUGE -#endif -#else -#define INFINITE_VALUE HUGE_VAL -#define NAN_VALUE HUGE_VAL -#endif - -/* - * IEEE 754 Extended Precision - * - * Implementation here is the 80-bit extended precision - * format of Motorola 68881, Motorola 68882 and Motorola - * 68040 FPUs, as well as Intel 80x87 FPUs. - * - * See: - * http://www.freescale.com/files/32bit/doc/fact_sheet/BR509.pdf - */ -/* - * Exponent range: [-16383,16383] - * Precision for mantissa: 64 bits with no hidden bit - * Bias: 16383 - */ - -/* - * Write IEEE Extended Precision Numbers - */ -void -ieee754_write_extended(double in, uint8_t* out) -{ - int sgn, exp, shift; - double fraction, t; - unsigned int lexp, hexp; - unsigned long low, high; - - if (in == 0.0) { - memset(out, 0, 10); - return; - } - if (in < 0.0) { - in = fabs(in); - sgn = 1; - } else - sgn = 0; - - fraction = frexp(in, &exp); - - if (exp == 0 || exp > 16384) { - if (exp > 16384) /* infinite value */ - low = high = 0; - else { - low = 0x80000000; - high = 0; - } - exp = 32767; - goto done; - } - fraction = ldexp(fraction, 32); - t = floor(fraction); - low = (unsigned long) t; - fraction -= t; - t = floor(ldexp(fraction, 32)); - high = (unsigned long) t; - - /* Convert exponents < -16382 to -16382 (then they will be - * stored as -16383) */ - if (exp < -16382) { - shift = 0 - exp - 16382; - high >>= shift; - high |= (low << (32 - shift)); - low >>= shift; - exp = -16382; - } - exp += 16383 - 1; /* bias */ - -done: - lexp = ((unsigned int) exp) >> 8; - hexp = ((unsigned int) exp) & 0xFF; - - /* big endian */ - out[0] = ((uint8_t) sgn) << 7; - out[0] |= (uint8_t) lexp; - out[1] = (uint8_t) hexp; - out[2] = (uint8_t) (low >> 24); - out[3] = (uint8_t) ((low >> 16) & 0xFF); - out[4] = (uint8_t) ((low >> 8) & 0xFF); - out[5] = (uint8_t) (low & 0xFF); - out[6] = (uint8_t) (high >> 24); - out[7] = (uint8_t) ((high >> 16) & 0xFF); - out[8] = (uint8_t) ((high >> 8) & 0xFF); - out[9] = (uint8_t) (high & 0xFF); - - return; -} - - -/* - * Read IEEE Extended Precision Numbers - */ -double -ieee754_read_extended(uint8_t* in) -{ - int sgn, exp; - unsigned long low, high; - double out; - - /* Extract the components from the big endian buffer */ - sgn = (int) (in[0] >> 7); - exp = ((int) (in[0] & 0x7F) << 8) | ((int) in[1]); - low = (((unsigned long) in[2]) << 24) - | (((unsigned long) in[3]) << 16) - | (((unsigned long) in[4]) << 8) | (unsigned long) in[5]; - high = (((unsigned long) in[6]) << 24) - | (((unsigned long) in[7]) << 16) - | (((unsigned long) in[8]) << 8) | (unsigned long) in[9]; - - if (exp == 0 && low == 0 && high == 0) - return (sgn ? -0.0 : 0.0); - - switch (exp) { - case 32767: - if (low == 0 && high == 0) - return (sgn ? -INFINITE_VALUE : INFINITE_VALUE); - else - return (sgn ? -NAN_VALUE : NAN_VALUE); - default: - exp -= 16383; /* unbias exponent */ - - } - - out = ldexp((double) low, -31 + exp); - out += ldexp((double) high, -63 + exp); - - return (sgn ? -out : out); -} diff --git a/tools/aif2pcm/main.c b/tools/aif2pcm/main.c deleted file mode 100644 index 0824b92da..000000000 --- a/tools/aif2pcm/main.c +++ /dev/null @@ -1,945 +0,0 @@ -// Copyright(c) 2016 huderlem -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#include -#include -#include -#include -#include -#include - -/* extended.c */ -void ieee754_write_extended (double, uint8_t*); -double ieee754_read_extended (uint8_t*); - -#ifdef _MSC_VER - -#define FATAL_ERROR(format, ...) \ -do \ -{ \ - fprintf(stderr, format, __VA_ARGS__); \ - exit(1); \ -} while (0) - -#else - -#define FATAL_ERROR(format, ...) \ -do \ -{ \ - fprintf(stderr, format, ##__VA_ARGS__); \ - exit(1); \ -} while (0) - -#endif // _MSC_VER - -typedef struct { - unsigned long num_samples; - union { - uint8_t *samples8; - uint16_t *samples16; - }; - uint8_t midi_note; - uint8_t sample_size; - bool has_loop; - unsigned long loop_offset; - double sample_rate; - unsigned long real_num_samples; -} AifData; - -struct Bytes { - unsigned long length; - uint8_t *data; -}; - -struct Marker { - unsigned short id; - unsigned long position; - // don't care about the name -}; - -struct Bytes *read_bytearray(const char *filename) -{ - struct Bytes *bytes = malloc(sizeof(struct Bytes)); - FILE *f = fopen(filename, "rb"); - if (!f) - { - FATAL_ERROR("Failed to open '%s' for reading!\n", filename); - } - fseek(f, 0, SEEK_END); - bytes->length = ftell(f); - fseek(f, 0, SEEK_SET); - bytes->data = malloc(bytes->length); - unsigned long read = fread(bytes->data, bytes->length, 1, f); - fclose(f); - if (read <= 0) - { - FATAL_ERROR("Failed to read data from '%s'!\n", filename); - } - return bytes; -} - -void write_bytearray(const char *filename, struct Bytes *bytes) -{ - FILE *f = fopen(filename, "wb"); - if (!f) - { - FATAL_ERROR("Failed to open '%s' for writing!\n", filename); - } - fwrite(bytes->data, bytes->length, 1, f); - fclose(f); -} - -void free_bytearray(struct Bytes *bytes) -{ - free(bytes->data); - free(bytes); -} - -char *get_file_extension(char *filename) -{ - char *index = strrchr(filename, '.'); - if (!index || index == filename) - { - return NULL; - } - return index + 1; -} - -char *new_file_extension(char *filename, char *ext) -{ - char *index = strrchr(filename, '.'); - if (!index || index == filename) - { - index = filename + strlen(filename); - } - int length = index - filename; - char *new_filename = malloc(length + 1 + strlen(ext) + 1); - if (new_filename) - { - strcpy(new_filename, filename); - new_filename[length] = '.'; - strcpy(new_filename + length + 1, ext); - } - return new_filename; -} - -void read_aif(struct Bytes *aif, AifData *aif_data) -{ - aif_data->has_loop = false; - aif_data->num_samples = 0; - - unsigned long pos = 0; - char chunk_name[5]; chunk_name[4] = '\0'; - char chunk_type[5]; chunk_type[4] = '\0'; - - // Check for FORM Chunk - memcpy(chunk_name, &aif->data[pos], 4); - pos += 4; - if (strcmp(chunk_name, "FORM") != 0) - { - FATAL_ERROR("Input .aif file has invalid header Chunk '%s'!\n", chunk_name); - } - - // Read size of whole file. - unsigned long whole_chunk_size = aif->data[pos++] << 24; - whole_chunk_size |= (aif->data[pos++] << 16); - whole_chunk_size |= (aif->data[pos++] << 8); - whole_chunk_size |= (uint8_t)aif->data[pos++]; - - unsigned long expected_whole_chunk_size = aif->length - 8; - if (whole_chunk_size != expected_whole_chunk_size) - { - FATAL_ERROR("FORM Chunk ckSize '%lu' doesn't match actual size '%lu'!\n", whole_chunk_size, expected_whole_chunk_size); - } - - // Check for AIFF Form Type - memcpy(chunk_type, &aif->data[pos], 4); - pos += 4; - if (strcmp(chunk_type, "AIFF") != 0) - { - FATAL_ERROR("FORM Type is '%s', but it must be AIFF!", chunk_type); - } - - struct Marker *markers = NULL; - unsigned short num_markers = 0, loop_start = 0, loop_end = 0; - unsigned long num_sample_frames = 0; - - // Read all the Chunks to populate the AifData struct. - while ((pos + 8) < aif->length) - { - // Read Chunk id - memcpy(chunk_name, &aif->data[pos], 4); - pos += 4; - - unsigned long chunk_size = (aif->data[pos++] << 24); - chunk_size |= (aif->data[pos++] << 16); - chunk_size |= (aif->data[pos++] << 8); - chunk_size |= aif->data[pos++]; - - if ((pos + chunk_size) > aif->length) - { - FATAL_ERROR("%s chunk at 0x%lx reached end of file before finishing\n", chunk_name, pos); - } - - if (strcmp(chunk_name, "COMM") == 0) - { - short num_channels = (aif->data[pos++] << 8); - num_channels |= (uint8_t)aif->data[pos++]; - if (num_channels != 1) - { - FATAL_ERROR("numChannels (%d) in the COMM Chunk must be 1!\n", num_channels); - } - - num_sample_frames = (aif->data[pos++] << 24); - num_sample_frames |= (aif->data[pos++] << 16); - num_sample_frames |= (aif->data[pos++] << 8); - num_sample_frames |= (uint8_t)aif->data[pos++]; - - aif_data->sample_size = (aif->data[pos++] << 8); - aif_data->sample_size |= (uint8_t)aif->data[pos++]; - if (aif_data->sample_size != 8 && aif_data->sample_size != 16) - { - FATAL_ERROR("sampleSize (%d) in the COMM Chunk must be 8 or 16!\n", aif_data->sample_size); - } - - double sample_rate = ieee754_read_extended((uint8_t*)(aif->data + pos)); - pos += 10; - - aif_data->sample_rate = sample_rate; - - if (aif_data->num_samples == 0) - { - aif_data->num_samples = num_sample_frames; - } - } - else if (strcmp(chunk_name, "MARK") == 0) - { - num_markers = (aif->data[pos++] << 8); - num_markers |= (uint8_t)aif->data[pos++]; - - if (markers) - { - FATAL_ERROR("More than one MARK Chunk in file!\n"); - } - - markers = calloc(num_markers, sizeof(struct Marker)); - - // Read each marker. - for (int i = 0; i < num_markers; i++) - { - unsigned short marker_id = (aif->data[pos++] << 8); - marker_id |= (uint8_t)aif->data[pos++]; - - unsigned long marker_position = (aif->data[pos++] << 24); - marker_position |= (aif->data[pos++] << 16); - marker_position |= (aif->data[pos++] << 8); - marker_position |= (uint8_t)aif->data[pos++]; - - // Marker name is a Pascal-style string. - uint8_t marker_name_size = aif->data[pos++]; - // We don't actually need the marker name for anything anymore. - /*char *marker_name = (char *)malloc((marker_name_size + 1) * sizeof(char)); - memcpy(marker_name, &aif->data[pos], marker_name_size); - marker_name[marker_name_size] = '\0';*/ - pos += marker_name_size + !(marker_name_size & 1); - - markers[i].id = marker_id; - markers[i].position = marker_position; - } - } - else if (strcmp(chunk_name, "INST") == 0) - { - uint8_t midi_note = (uint8_t)aif->data[pos++]; - - aif_data->midi_note = midi_note; - - // Skip over data we don't need. - pos += 7; - - unsigned short loop_type = (aif->data[pos++] << 8); - loop_type |= (uint8_t)aif->data[pos++]; - - if (loop_type) - { - loop_start = (aif->data[pos++] << 8); - loop_start |= (uint8_t)aif->data[pos++]; - - loop_end = (aif->data[pos++] << 8); - loop_end |= (uint8_t)aif->data[pos++]; - } - else - { - // Skip NoLooping sustain loop. - pos += 4; - } - - // Skip release loop, we don't need it. - pos += 6; - } - else if (strcmp(chunk_name, "SSND") == 0) - { - // Skip offset and blockSize - pos += 8; - - unsigned long num_samples = chunk_size - 8; - if (aif_data->sample_size == 8) - { - uint8_t *sample_data = (uint8_t *)malloc(num_samples * sizeof(uint8_t)); - memcpy(sample_data, &aif->data[pos], num_samples); - - aif_data->samples8 = sample_data; - aif_data->real_num_samples = num_samples; - } - else - { - uint16_t *sample_data = (uint16_t *)malloc(num_samples * sizeof(uint16_t)); - uint16_t *sample_data_swapped = (uint16_t *)malloc(num_samples * sizeof(uint16_t)); - memcpy(sample_data, &aif->data[pos], num_samples); - for (long unsigned i = 0; i < num_samples; i++) - { - sample_data_swapped[i] = __builtin_bswap16(sample_data[i]); - } - - aif_data->samples16 = sample_data_swapped; - aif_data->real_num_samples = num_samples; - free(sample_data); - } - pos += chunk_size - 8; - } - else - { - // Skip over unsupported chunks. - pos += chunk_size; - } - } - - if (markers) - { - // Resolve loop points. - struct Marker *cur_marker = markers; - - // Grab loop start point. - for (int i = 0; i < num_markers; i++, cur_marker++) - { - if (cur_marker->id == loop_start) - { - aif_data->loop_offset = cur_marker->position; - aif_data->has_loop = true; - break; - } - } - - cur_marker = markers; - - // Grab loop end point. - for (int i = 0; i < num_markers; i++, cur_marker++) - { - if (cur_marker->id == loop_end) - { - if (cur_marker->position < aif_data->loop_offset) { - aif_data->loop_offset = cur_marker->position; - aif_data->has_loop = true; - } - aif_data->num_samples = cur_marker->position; - break; - } - } - - free(markers); - } -} - -// This is a table of deltas between sample values in compressed PCM data. -const int gDeltaEncodingTable[] = { - 0, 1, 4, 9, 16, 25, 36, 49, - -64, -49, -36, -25, -16, -9, -4, -1, -}; - -#define POSITIVE_DELTAS_START 0 -#define POSITIVE_DELTAS_END 8 - -#define NEGATIVE_DELTAS_START 8 -#define NEGATIVE_DELTAS_END 16 - -struct Bytes *delta_decompress(struct Bytes *delta, unsigned int expected_length) -{ - struct Bytes *pcm = malloc(sizeof(struct Bytes)); - pcm->length = expected_length; - pcm->data = malloc(pcm->length + 0x40); - - uint8_t hi, lo; - unsigned int i = 0; - unsigned int j = 0; - int k; - int8_t base; - while (i < delta->length) - { - base = (int8_t)delta->data[i++]; - pcm->data[j++] = (uint8_t)base; - if (i >= delta->length) - { - break; - } - if (j >= pcm->length) - { - break; - } - lo = delta->data[i] & 0xf; - base += gDeltaEncodingTable[lo]; - pcm->data[j++] = base; - i++; - if (i >= delta->length) - { - break; - } - if (j >= pcm->length) - { - break; - } - for (k = 0; k < 31; k++) - { - hi = (delta->data[i] >> 4) & 0xf; - base += gDeltaEncodingTable[hi]; - pcm->data[j++] = base; - if (j >= pcm->length) - { - break; - } - lo = delta->data[i] & 0xf; - base += gDeltaEncodingTable[lo]; - pcm->data[j++] = base; - i++; - if (i >= delta->length) - { - break; - } - if (j >= pcm->length) - { - break; - } - } - if (j >= pcm->length) - { - break; - } - } - - pcm->length = j; - return pcm; -} - -#define U8_TO_S8(value) ((value) < 128 ? (value) : (value) - 256) -#define ABS(value) ((value) >= 0 ? (value) : -(value)) - -int get_delta_index(uint8_t sample, uint8_t prev_sample) -{ - int best_error = INT_MAX; - int best_index = -1; - int delta_table_start_index; - int delta_table_end_index; - int sample_signed = U8_TO_S8(sample); - int prev_sample_signed = U8_TO_S8(prev_sample); - - // if we're going up (or equal), only choose positive deltas - if (prev_sample_signed <= sample_signed) { - delta_table_start_index = POSITIVE_DELTAS_START; - delta_table_end_index = POSITIVE_DELTAS_END; - } else { - delta_table_start_index = NEGATIVE_DELTAS_START; - delta_table_end_index = NEGATIVE_DELTAS_END; - } - - for (int i = delta_table_start_index; i < delta_table_end_index; i++) - { - uint8_t new_sample = prev_sample + gDeltaEncodingTable[i]; - int new_sample_signed = U8_TO_S8(new_sample); - int error = ABS(new_sample_signed - sample_signed); - - if (error < best_error) - { - best_error = error; - best_index = i; - } - } - - return best_index; -} - -struct Bytes *delta_compress(struct Bytes *pcm) -{ - struct Bytes *delta = malloc(sizeof(struct Bytes)); - // estimate the length so we can malloc - int num_blocks = pcm->length / 64; - delta->length = num_blocks * 33; - - int extra = pcm->length % 64; - if (extra) - { - delta->length += 1; - extra -= 1; - } - if (extra) - { - delta->length += 1; - extra -= 1; - } - if (extra) - { - delta->length += (extra + 1) / 2; - } - - delta->data = malloc(delta->length + 33); - - unsigned int i = 0; - unsigned int j = 0; - int k; - uint8_t base; - int delta_index; - - while (i < pcm->length) - { - base = pcm->data[i++]; - delta->data[j++] = base; - - if (i >= pcm->length) - { - break; - } - delta_index = get_delta_index(pcm->data[i++], base); - base += gDeltaEncodingTable[delta_index]; - delta->data[j++] = delta_index; - - for (k = 0; k < 31; k++) - { - if (i >= pcm->length) - { - break; - } - delta_index = get_delta_index(pcm->data[i++], base); - base += gDeltaEncodingTable[delta_index]; - delta->data[j] = (delta_index << 4); - - if (i >= pcm->length) - { - break; - } - delta_index = get_delta_index(pcm->data[i++], base); - base += gDeltaEncodingTable[delta_index]; - delta->data[j++] |= delta_index; - } - } - - delta->length = j; - - return delta; -} - -#define STORE_U32_LE(dest, value) \ -do { \ - *(dest) = (value) & 0xff; \ - *((dest) + 1) = ((value) >> 8) & 0xff; \ - *((dest) + 2) = ((value) >> 16) & 0xff; \ - *((dest) + 3) = ((value) >> 24) & 0xff; \ -} while (0) - -#define LOAD_U32_LE(var, src) \ -do { \ - (var) = *(src); \ - (var) |= (*((src) + 1) << 8); \ - (var) |= (*((src) + 2) << 16); \ - (var) |= (*((src) + 3) << 24); \ -} while (0) - -// Reads an .aif file and produces a .pcm file containing an array of 8-bit samples. -void aif2pcm(const char *aif_filename, const char *pcm_filename, bool compress) -{ - struct Bytes *aif = read_bytearray(aif_filename); - AifData aif_data = {0}; - read_aif(aif, &aif_data); - - // Convert 16-bit to 8-bit if necessary - if (aif_data.sample_size == 16) - { - aif_data.real_num_samples /= 2; - uint8_t *converted_samples = malloc(aif_data.real_num_samples * sizeof(uint8_t)); - for (unsigned long i = 0; i < aif_data.real_num_samples; i++) - { - converted_samples[i] = aif_data.samples16[i] >> 8; - } - free(aif_data.samples16); - aif_data.samples8 = converted_samples; - } - - int header_size = 0x10; - struct Bytes *pcm; - struct Bytes output = {0,0}; - - if (compress) - { - struct Bytes *input = malloc(sizeof(struct Bytes)); - input->data = aif_data.samples8; - input->length = aif_data.real_num_samples; - pcm = delta_compress(input); - free(input); - } - else - { - pcm = malloc(sizeof(struct Bytes)); - pcm->data = aif_data.samples8; - pcm->length = aif_data.real_num_samples; - } - output.length = header_size + pcm->length; - output.data = malloc(output.length); - - uint32_t pitch_adjust = (uint32_t)(aif_data.sample_rate * 1024); - uint32_t loop_offset = (uint32_t)(aif_data.loop_offset); - uint32_t adjusted_num_samples = (uint32_t)(aif_data.num_samples - 1); - uint32_t flags = 0; - if (aif_data.has_loop) flags |= 0x40000000; - if (compress) flags |= 1; - STORE_U32_LE(output.data + 0, flags); - STORE_U32_LE(output.data + 4, pitch_adjust); - STORE_U32_LE(output.data + 8, loop_offset); - STORE_U32_LE(output.data + 12, adjusted_num_samples); - memcpy(&output.data[header_size], pcm->data, pcm->length); - write_bytearray(pcm_filename, &output); - - free(aif->data); - free(aif); - free(pcm); - free(output.data); - free(aif_data.samples8); -} - -// Reads a .pcm file containing an array of 8-bit samples and produces an .aif file. -// See http://www-mmsp.ece.mcgill.ca/documents/audioformats/aiff/Docs/AIFF-1.3.pdf for .aif file specification. -void pcm2aif(const char *pcm_filename, const char *aif_filename, uint32_t base_note) -{ - struct Bytes *pcm = read_bytearray(pcm_filename); - - AifData *aif_data = malloc(sizeof(AifData)); - - uint32_t flags; - LOAD_U32_LE(flags, pcm->data + 0); - aif_data->has_loop = flags & 0x40000000; - bool compressed = flags & 1; - - uint32_t pitch_adjust; - LOAD_U32_LE(pitch_adjust, pcm->data + 4); - aif_data->sample_rate = pitch_adjust / 1024.0; - - LOAD_U32_LE(aif_data->loop_offset, pcm->data + 8); - LOAD_U32_LE(aif_data->num_samples, pcm->data + 12); - aif_data->num_samples += 1; - - if (compressed) - { - struct Bytes *delta = pcm; - uint8_t *pcm_data = pcm->data; - delta->length -= 0x10; - delta->data += 0x10; - pcm = delta_decompress(delta, aif_data->num_samples); - free(pcm_data); - free(delta); - } - else - { - pcm->length -= 0x10; - pcm->data += 0x10; - } - - aif_data->samples8 = malloc(pcm->length); - memcpy(aif_data->samples8, pcm->data, pcm->length); - - struct Bytes *aif = malloc(sizeof(struct Bytes)); - aif->length = 54 + 60 + pcm->length; - aif->data = malloc(aif->length); - - long pos = 0; - - // First, write the FORM header chunk. - // FORM Chunk ckID - aif->data[pos++] = 'F'; - aif->data[pos++] = 'O'; - aif->data[pos++] = 'R'; - aif->data[pos++] = 'M'; - - // FORM Chunk ckSize - unsigned long form_size = pos; - unsigned long data_size = aif->length - 8; - aif->data[pos++] = ((data_size >> 24) & 0xFF); - aif->data[pos++] = ((data_size >> 16) & 0xFF); - aif->data[pos++] = ((data_size >> 8) & 0xFF); - aif->data[pos++] = (data_size & 0xFF); - - // FORM Chunk formType - aif->data[pos++] = 'A'; - aif->data[pos++] = 'I'; - aif->data[pos++] = 'F'; - aif->data[pos++] = 'F'; - - // Next, write the Common Chunk - // Common Chunk ckID - aif->data[pos++] = 'C'; - aif->data[pos++] = 'O'; - aif->data[pos++] = 'M'; - aif->data[pos++] = 'M'; - - // Common Chunk ckSize - aif->data[pos++] = 0; - aif->data[pos++] = 0; - aif->data[pos++] = 0; - aif->data[pos++] = 18; - - // Common Chunk numChannels - aif->data[pos++] = 0; - aif->data[pos++] = 1; // 1 channel - - // Common Chunk numSampleFrames - aif->data[pos++] = ((aif_data->num_samples >> 24) & 0xFF); - aif->data[pos++] = ((aif_data->num_samples >> 16) & 0xFF); - aif->data[pos++] = ((aif_data->num_samples >> 8) & 0xFF); - aif->data[pos++] = (aif_data->num_samples & 0xFF); - - // Common Chunk sampleSize - aif->data[pos++] = 0; - aif->data[pos++] = 8; // 8 bits per sample - - // Common Chunk sampleRate - //double sample_rate = pitch_adjust / 1024.0; - uint8_t sample_rate_buffer[10]; - ieee754_write_extended(aif_data->sample_rate, sample_rate_buffer); - for (int i = 0; i < 10; i++) - { - aif->data[pos++] = sample_rate_buffer[i]; - } - - if (aif_data->has_loop) - { - - // Marker Chunk ckID - aif->data[pos++] = 'M'; - aif->data[pos++] = 'A'; - aif->data[pos++] = 'R'; - aif->data[pos++] = 'K'; - - // Marker Chunk ckSize - aif->data[pos++] = 0; - aif->data[pos++] = 0; - aif->data[pos++] = 0; - aif->data[pos++] = 12 + (aif_data->has_loop ? 12 : 0); - - // Marker Chunk numMarkers - aif->data[pos++] = 0; - aif->data[pos++] = (aif_data->has_loop ? 2 : 1); - - // Marker loop start - aif->data[pos++] = 0; - aif->data[pos++] = 1; // id = 1 - - long loop_start = aif_data->loop_offset; - aif->data[pos++] = ((loop_start >> 24) & 0xFF); - aif->data[pos++] = ((loop_start >> 16) & 0xFF); - aif->data[pos++] = ((loop_start >> 8) & 0xFF); - aif->data[pos++] = (loop_start & 0xFF); // position - - aif->data[pos++] = 5; // pascal-style string length - aif->data[pos++] = 'S'; - aif->data[pos++] = 'T'; - aif->data[pos++] = 'A'; - aif->data[pos++] = 'R'; - aif->data[pos++] = 'T'; // markerName - - // Marker loop end - aif->data[pos++] = 0; - aif->data[pos++] = (aif_data->has_loop ? 2 : 1); // id = 2 - - long loop_end = aif_data->num_samples; - aif->data[pos++] = ((loop_end >> 24) & 0xFF); - aif->data[pos++] = ((loop_end >> 16) & 0xFF); - aif->data[pos++] = ((loop_end >> 8) & 0xFF); - aif->data[pos++] = (loop_end & 0xFF); // position - - aif->data[pos++] = 3; // pascal-style string length - aif->data[pos++] = 'E'; - aif->data[pos++] = 'N'; - aif->data[pos++] = 'D'; - } - - // Instrument Chunk ckID - aif->data[pos++] = 'I'; - aif->data[pos++] = 'N'; - aif->data[pos++] = 'S'; - aif->data[pos++] = 'T'; - - // Instrument Chunk ckSize - aif->data[pos++] = 0; - aif->data[pos++] = 0; - aif->data[pos++] = 0; - aif->data[pos++] = 20; - - aif->data[pos++] = base_note; // baseNote - aif->data[pos++] = 0; // detune - aif->data[pos++] = 0; // lowNote - aif->data[pos++] = 127; // highNote - aif->data[pos++] = 1; // lowVelocity - aif->data[pos++] = 127; // highVelocity - aif->data[pos++] = 0; // gain (hi) - aif->data[pos++] = 0; // gain (lo) - - // Instrument Chunk sustainLoop - aif->data[pos++] = 0; - aif->data[pos++] = 1; // playMode = ForwardLooping - - aif->data[pos++] = 0; - aif->data[pos++] = 1; // beginLoop marker id - - aif->data[pos++] = 0; - aif->data[pos++] = 2; // endLoop marker id - - // Instrument Chunk releaseLoop - aif->data[pos++] = 0; - aif->data[pos++] = 1; // playMode = ForwardLooping - - aif->data[pos++] = 0; - aif->data[pos++] = 1; // beginLoop marker id - - aif->data[pos++] = 0; - aif->data[pos++] = 2; // endLoop marker id - - // Finally, write the Sound Data Chunk - // Sound Data Chunk ckID - aif->data[pos++] = 'S'; - aif->data[pos++] = 'S'; - aif->data[pos++] = 'N'; - aif->data[pos++] = 'D'; - - // Sound Data Chunk ckSize - unsigned long sound_data_size = pcm->length + 8; - aif->data[pos++] = ((sound_data_size >> 24) & 0xFF); - aif->data[pos++] = ((sound_data_size >> 16) & 0xFF); - aif->data[pos++] = ((sound_data_size >> 8) & 0xFF); - aif->data[pos++] = (sound_data_size & 0xFF); - - // Sound Data Chunk offset - aif->data[pos++] = 0; - aif->data[pos++] = 0; - aif->data[pos++] = 0; - aif->data[pos++] = 0; - - // Sound Data Chunk blockSize - aif->data[pos++] = 0; - aif->data[pos++] = 0; - aif->data[pos++] = 0; - aif->data[pos++] = 0; - - // Sound Data Chunk soundData - for (unsigned int i = 0; i < aif_data->loop_offset; i++) - { - aif->data[pos++] = aif_data->samples8[i]; - } - - int j = 0; - for (unsigned int i = aif_data->loop_offset; i < pcm->length; i++) - { - int pcm_index = aif_data->loop_offset + (j++ % (pcm->length - aif_data->loop_offset)); - aif->data[pos++] = aif_data->samples8[pcm_index]; - } - - aif->length = pos; - - // Go back and rewrite ckSize - data_size = aif->length - 8; - aif->data[form_size + 0] = ((data_size >> 24) & 0xFF); - aif->data[form_size + 1] = ((data_size >> 16) & 0xFF); - aif->data[form_size + 2] = ((data_size >> 8) & 0xFF); - aif->data[form_size + 3] = (data_size & 0xFF); - - write_bytearray(aif_filename, aif); - - free(aif->data); - free(aif); -} - -void usage(void) -{ - fprintf(stderr, "Usage: aif2pcm bin_file [aif_file]\n"); - fprintf(stderr, " aif2pcm aif_file [bin_file] [--compress]\n"); -} - -int main(int argc, char **argv) -{ - if (argc < 2) - { - usage(); - exit(1); - } - - char *input_file = argv[1]; - char *extension = get_file_extension(input_file); - char *output_file; - bool compressed = false; - - if (argc > 3) - { - for (int i = 3; i < argc; i++) - { - if (strcmp(argv[i], "--compress") == 0) - { - compressed = true; - } - } - } - - if (strcmp(extension, "aif") == 0 || strcmp(extension, "aiff") == 0) - { - if (argc >= 3) - { - output_file = argv[2]; - aif2pcm(input_file, output_file, compressed); - } - else - { - output_file = new_file_extension(input_file, "bin"); - aif2pcm(input_file, output_file, compressed); - free(output_file); - } - } - else if (strcmp(extension, "bin") == 0) - { - if (argc >= 3) - { - output_file = argv[2]; - pcm2aif(input_file, output_file, 60); - } - else - { - output_file = new_file_extension(input_file, "aif"); - pcm2aif(input_file, output_file, 60); - free(output_file); - } - } - else - { - FATAL_ERROR("Input file must be .aif or .bin: '%s'\n", input_file); - } - - return 0; -} diff --git a/tools/mapjson/json11.cpp b/tools/mapjson/json11.cpp index 3ac5f392a..4f2c80c70 100644 --- a/tools/mapjson/json11.cpp +++ b/tools/mapjson/json11.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include namespace json11 { diff --git a/tools/mapjson/mapjson.cpp b/tools/mapjson/mapjson.cpp index 94328b485..8d8ec4e4e 100644 --- a/tools/mapjson/mapjson.cpp +++ b/tools/mapjson/mapjson.cpp @@ -96,6 +96,29 @@ string json_to_string(const Json &data, const string &field = "", bool silent = return output; } +string get_generated_warning(const string &filename, bool isAsm) { + string comment = isAsm ? "@" : "//"; + + ostringstream warning; + warning << comment << "\n" + << comment << " DO NOT MODIFY THIS FILE! It is auto-generated from " << filename << "\n" + << comment << "\n\n"; + return warning.str(); +} + +string get_include_guard_start(const string &name) { + ostringstream guard; + guard << "#ifndef GUARD_" << name << "_H\n" + << "#define GUARD_" << name << "_H\n\n"; + return guard.str(); +} + +string get_include_guard_end(const string &name) { + ostringstream guard; + guard << "#endif // GUARD_" << name << "_H\n"; + return guard.str(); +} + string generate_map_header_text(Json map_data, Json layouts_data) { string map_layout_id = json_to_string(map_data, "layout"); @@ -114,8 +137,7 @@ string generate_map_header_text(Json map_data, Json layouts_data) { ostringstream text; string mapName = json_to_string(map_data, "name"); - - text << "@\n@ DO NOT MODIFY THIS FILE! It is auto-generated from data/maps/" << mapName << "/map.json\n@\n\n"; + text << get_generated_warning("data/maps/" + mapName + "/map.json", true); text << mapName << ":\n" << "\t.4byte " << json_to_string(layout, "name") << "\n"; @@ -167,12 +189,10 @@ string generate_map_connections_text(Json map_data) { if (map_data["connections"] == Json()) return string("\n"); - ostringstream text; - string mapName = json_to_string(map_data, "name"); - text << "@\n@ DO NOT MODIFY THIS FILE! It is auto-generated from data/maps/" << mapName << "/map.json\n@\n\n"; - + ostringstream text; + text << get_generated_warning("data/maps/" + mapName + "/map.json", true); text << mapName << "_MapConnectionsList:\n"; for (auto &connection : map_data["connections"].array_items()) { @@ -193,11 +213,11 @@ string generate_map_events_text(Json map_data) { if (map_data.object_items().find("shared_events_map") != map_data.object_items().end()) return string("\n"); - ostringstream text; - string mapName = json_to_string(map_data, "name"); - text << "@\n@ DO NOT MODIFY THIS FILE! It is auto-generated from data/maps/" << mapName << "/map.json\n@\n\n\t.align 2\n\n"; + ostringstream text; + text << get_generated_warning("data/maps/" + mapName + "/map.json", true); + text << "\t.align 2\n\n"; string objects_label, warps_label, coords_label, bgs_label; @@ -371,10 +391,52 @@ void process_map(string map_filepath, string layouts_filepath, string output_dir write_text_file(out_dir + "connections.inc", connections_text); } +void process_event_constants(const vector &map_filepaths, string output_ids_file) { + string warning = get_generated_warning("data/maps/*/map.json", false); + + string guard_name = "CONSTANTS_MAP_EVENT_IDS"; + ostringstream ids_file_text; + ids_file_text << get_include_guard_start(guard_name) << warning; + + for (const string &filepath : map_filepaths) { + string err; + string map_json_text = read_text_file(filepath); + Json map_data = Json::parse(map_json_text, err); + if (map_data == Json()) + FATAL_ERROR("Failed to read '%s' while generating map event constants: %s\n", filepath.c_str(), err.c_str()); + + string map_id = json_to_string(map_data, "id"); + + // Get IDs from the object/clone events. + ostringstream map_ids_text; + auto obj_events = map_data["object_events"].array_items(); + for (unsigned int i = 0; i < obj_events.size(); i++) { + auto obj_event = obj_events[i]; + if (obj_event.object_items().find("local_id") != obj_event.object_items().end()) + map_ids_text << "#define " << json_to_string(obj_event, "local_id") << " " << i + 1 << "\n"; + } + // Get IDs from the warp events. + auto warp_events = map_data["warp_events"].array_items(); + for (unsigned int i = 0; i < warp_events.size(); i++) { + auto warp_event = warp_events[i]; + if (warp_event.object_items().find("warp_id") != warp_event.object_items().end()) + map_ids_text << "#define " << json_to_string(warp_event, "warp_id") << " " << i << "\n"; + } + // Only output if we found any IDs + string temp = map_ids_text.str(); + if (!temp.empty()) { + ids_file_text << "// " << map_id << "\n" << temp << "\n"; + } + } + + ids_file_text << get_include_guard_end(guard_name); + write_text_file(output_ids_file, ids_file_text.str()); +} + 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 << get_generated_warning("data/maps/map_groups.json", true); for (auto &key : groups_data["group_order"].array_items()) { string group = json_to_string(key); @@ -415,7 +477,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 data/maps/map_groups.json\n@\n\n"; + text << get_generated_warning("data/maps/map_groups.json", true); for (Json map_name : map_names) text << "\t.include \"" << include_path << "/" << json_to_string(map_name) << "/connections.inc\"\n"; @@ -432,7 +494,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 data/maps/map_groups.json\n@\n\n"; + text << get_generated_warning("data/maps/map_groups.json", true); for (string map_name : map_names) text << "\t.include \"" << include_path << "/" << map_name << "/header.inc\"\n"; @@ -449,7 +511,7 @@ string generate_events_text(Json groups_data, string include_path) { ostringstream text; - text << "@\n@ DO NOT MODIFY THIS FILE! It is auto-generated from " << include_path << "/map_groups.json\n@\n\n"; + text << get_generated_warning(include_path + "/map_groups.json", true); for (string map_name : map_names) text << "\t.include \"" << include_path << "/" << map_name << "/events.inc\"\n"; @@ -460,12 +522,9 @@ string generate_events_text(Json groups_data, string include_path) { string generate_map_constants_text(string groups_filepath, Json groups_data) { string file_dir = file_parent(groups_filepath) + sep; + string guard_name = "CONSTANTS_MAP_GROUPS"; 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 << get_include_guard_start(guard_name) << get_generated_warning("data/maps/map_groups.json", false); int group_num = 0; @@ -498,7 +557,7 @@ string generate_map_constants_text(string groups_filepath, Json groups_data) { } text << "#define MAP_GROUPS_COUNT " << group_num << "\n\n"; - text << "#endif // GUARD_CONSTANTS_MAP_GROUPS_H\n"; + text << get_include_guard_end(guard_name); return text.str(); } @@ -530,7 +589,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 data/layouts/layouts.json\n@\n\n"; + text << get_generated_warning("data/layouts/layouts.json", true); for (auto &layout : layouts_data["layouts"].array_items()) { if (layout == Json::object()) continue; @@ -563,7 +622,7 @@ string generate_layout_headers_text(Json layouts_data) { string generate_layouts_table_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 << get_generated_warning("data/layouts/layouts.json", true); text << "\t.align 2\n" << json_to_string(layouts_data, "layouts_table_label") << "::\n"; @@ -578,12 +637,9 @@ string generate_layouts_table_text(Json layouts_data) { } string generate_layouts_constants_text(Json layouts_data) { + string guard_name = "CONSTANTS_LAYOUTS"; ostringstream text; - - text << "#ifndef GUARD_CONSTANTS_LAYOUTS_H\n" - << "#define GUARD_CONSTANTS_LAYOUTS_H\n\n"; - - text << "//\n// DO NOT MODIFY THIS FILE! It is auto-generated from data/layouts/layouts.json\n//\n\n"; + text << get_include_guard_start(guard_name) << get_generated_warning("data/layouts/layouts.json", false); int i = 1; for (auto &layout : layouts_data["layouts"].array_items()) { @@ -592,7 +648,7 @@ string generate_layouts_constants_text(Json layouts_data) { i++; } - text << "\n#endif // GUARD_CONSTANTS_LAYOUTS_H\n"; + text << get_include_guard_end(guard_name); return text.str(); } @@ -627,9 +683,6 @@ int main(int argc, char *argv[]) { char *mode_arg = argv[1]; string mode(mode_arg); - if (mode != "layouts" && mode != "map" && mode != "groups") - FATAL_ERROR("ERROR: must be 'layouts', 'map', or 'groups'.\n"); - if (mode == "map") { if (argc != 6) FATAL_ERROR("USAGE: mapjson map \n"); @@ -663,8 +716,24 @@ int main(int argc, char *argv[]) { process_layouts(filepath, output_asm, output_c); } + else if (mode == "event_constants") { + if (argc < 5) + FATAL_ERROR("USAGE: mapjson event_constants [additional_map_files] "); + + infer_separator(argv[3]); + + vector filepaths; + const int firstMapFileArg = 3; + const int lastMapFileArg = argc - 2; + for (int i = firstMapFileArg; i <= lastMapFileArg; i++) { + filepaths.push_back(argv[i]); + } + string output_ids_file(argv[argc - 1]); + + process_event_constants(filepaths, output_ids_file); + } else { - FATAL_ERROR("ERROR: must be 'layouts', 'map', or 'groups'.\n"); + FATAL_ERROR("ERROR: must be 'layouts', 'map', 'event_constants', or 'groups'.\n"); } return 0; diff --git a/tools/wav2agb/.gitignore b/tools/wav2agb/.gitignore new file mode 100644 index 000000000..271540565 --- /dev/null +++ b/tools/wav2agb/.gitignore @@ -0,0 +1,10 @@ +*.o +*.exe +*.s +*.gba +*.sdf + +wav2agb +Debug +Release +.vs diff --git a/tools/aif2pcm/LICENSE b/tools/wav2agb/LICENSE similarity index 77% rename from tools/aif2pcm/LICENSE rename to tools/wav2agb/LICENSE index 966b92bd6..d52bf8ee6 100644 --- a/tools/aif2pcm/LICENSE +++ b/tools/wav2agb/LICENSE @@ -1,5 +1,6 @@ -Copyright (c) 2016 huderlem -Copyright (c) 2005, 2006 by Marco Trillo +The MIT License (MIT) + +Copyright (c) 2016 ipatix Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -8,13 +9,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/tools/wav2agb/Makefile b/tools/wav2agb/Makefile new file mode 100644 index 000000000..a38f71758 --- /dev/null +++ b/tools/wav2agb/Makefile @@ -0,0 +1,23 @@ +CXX ?= g++ + +CXXFLAGS := -Wall -Werror -std=c++17 -O2 + +SRCS := $(wildcard *.cpp) +HEADERS := $(wildcard *.h) + +EXE := +ifeq ($(OS),Windows_NT) + EXE := .exe +endif +BINARY = wav2agb$(EXE) + +.PHONY: all clean + +all: $(BINARY) + @: + +$(BINARY): $(SRCS) $(HEADERS) + $(CXX) $(CXXFLAGS) $(SRCS) -o $@ $(LDFLAGS) + +clean: + $(RM) $(BINARY) diff --git a/tools/wav2agb/README.md b/tools/wav2agb/README.md new file mode 100644 index 000000000..3b8b32e9b --- /dev/null +++ b/tools/wav2agb/README.md @@ -0,0 +1,55 @@ +# wav2agb +"wav2agb" is a tool to convert standard .wav files to GBA compatible .s or .bin files. Intended to convert .wav files for the use with the mp2k/m4a sound driver. + +This copy has been slightly modified from [ipatix's original implementation](https://github.com/ipatix/wav2agb) in the following ways: +1. Support outputting `.bin` files with a command line option `-b, --binary`. (The original only supports outputting `.s` assembly files.) +2. Support reading an override "pitch" value from a custom `agbp` RIFF chunk. + - This is needed to properly match some samples, due to float-point rounding errors when attempting to infer the pitch/sample rate from the .wav file's sample rate. + - If the custom `agbp` chunk isn't present, it will simply use the .wav's sample rate to calculate this "pitch" value. +3. Support reading an override "loop end" value from a custom `agbl` RIFF chunk. + - This is needed to properly match vanilla samples, due their their inherent off-by-one error (the last sample is mistakenly ignored). + - This `agbl` chunk can be added to existing .wav files with the `--set-agbl` option (described below). +4. Optionally omits trailing padding from compressed output. + +Usage: +``` +Usage: wav2agb [options] [] + +Options: +-s, --symbol | symbol name for wave header (default: file name) +-l, --lookahead | DPCM compression lookahead 1..8 (default: 3) +-c, --compress | compress output with DPCM +-f, --fast-compress | compress output with DPCM fast +--no-pad | omit trailing padding in compressed output +-b, --binary | output raw binary instead of assembly +--loop-start | override loop start (integer) +--loop-end | override loop end (integer) +--tune | override tuning (float) +--key | override midi key (int) +--rate | override base samplerate (int) +--set-agbl | adds the custom agbl chunk to the given input .wav file +``` + +Flag -c enables compression (only supported by Pokemon Games) + +## Adding agbl Chunk to WAV Files + +The `--set-agbl` option allows you to add or update the custom `agbl` chunk in a WAV file. When this option is used, `wav2agb` will output a WAV file with the agbl chunk added, rather than converting to `.s` or `.bin` format. + +The loop-end value can be specified as either: +- **Positive value**: Used as an absolute sample position +- **Negative value**: Treated as an offset from the end of the file + +This is useful for correcting the off-by-one loop-end error in vanilla samples. The typical fix is `--set-agbl -1`, which sets the loop-end to `(total_samples - 1)`. + +Example: +```bash +# Set agbl to (total_samples - 1), the most common case for fixing the off-by-one error +wav2agb --set-agbl -1 input.wav + +# Set agbl chunk to specific sample position 12345 +wav2agb --set-agbl 12345 input.wav output.wav + +# If no output file is specified, the input file is modified in place +wav2agb --set-agbl -1 input.wav +``` diff --git a/tools/wav2agb/converter.cpp b/tools/wav2agb/converter.cpp new file mode 100644 index 000000000..c826e0a78 --- /dev/null +++ b/tools/wav2agb/converter.cpp @@ -0,0 +1,466 @@ +#include "converter.h" + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "wav_file.h" + +static void agb_out(std::ofstream& ofs, const char *msg, ...) { + char buf[256]; + va_list args; + va_start(args, msg); + vsnprintf(buf, sizeof(buf), msg, args); + va_end(args); + ofs << buf; +} + +static void data_write(std::ofstream& ofs, uint32_t& block_pos, int data, bool hex) { + if (block_pos++ == 0) { + if (hex) + agb_out(ofs, "\n .byte 0x%02X", data); + else + agb_out(ofs, "\n .byte %4d", data); + } else { + if (hex) + agb_out(ofs, ", 0x%02X", data); + else + agb_out(ofs, ", %4d", data); + } + block_pos %= 16; +} + +static void bin_write_u8(std::vector& data, uint8_t value) { + data.push_back(value); +} + +static void bin_write_u32_le(std::vector& data, uint32_t value) { + data.push_back(static_cast(value & 0xFF)); + data.push_back(static_cast((value >> 8) & 0xFF)); + data.push_back(static_cast((value >> 16) & 0xFF)); + data.push_back(static_cast((value >> 24) & 0xFF)); +} + +template +const T& clamp(const T& v, const T& lo, const T& hi) { + return (v < lo) ? lo : (hi < v) ? hi : v; +} + +static void convert_uncompressed(wav_file& wf, std::ofstream& ofs) +{ + int loop_sample = 0; + + uint32_t block_pos = 0; + + for (size_t i = 0; i < wf.loopEnd; i++) { + double ds; + wf.readData(i, &ds, 1); + // TODO apply dither noise + int s = clamp(static_cast(floor(ds * 128.0)), -128, 127); + + if (wf.loopEnabled && i == wf.loopStart) + loop_sample = s; + + data_write(ofs, block_pos, s, false); + } + + data_write(ofs, block_pos, loop_sample, false); +} + +static void convert_uncompressed_bin(wav_file& wf, std::vector& data) +{ + for (size_t i = 0; i < wf.loopEnd; i++) { + double ds; + wf.readData(i, &ds, 1); + // TODO apply dither noise + int s = clamp(static_cast(floor(ds * 128.0)), -128, 127); + + bin_write_u8(data, static_cast(s)); + } + + // Align to 4 bytes. + while (data.size() % 4 != 0) { + bin_write_u8(data, 0); + } +} + +static uint32_t wav_loop_start; +static bool wav_loop_start_override = false; +static uint32_t wav_loop_end; +static bool wav_loop_end_override = false; +static double wav_tune; +static bool wav_tune_override = false; +static uint8_t wav_key; +static bool wav_key_override = false; +static uint32_t wav_rate; +static bool wav_rate_override = false; + +static bool dpcm_verbose = false; +static bool dpcm_lookahead_fast = false; +static bool dpcm_include_padding = true; +static size_t dpcm_enc_lookahead = 3; +static const size_t DPCM_BLK_SIZE = 0x40; +static const std::vector dpcmLookupTable = { + 0, 1, 4, 9, 16, 25, 36, 49, -64, -49, -36, -25, -16, -9, -4, -1 +}; +static const std::vector dpcmIndexTable = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 +}; +static const std::vector> dpcmFastLookupTable = { + {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, + {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, + {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, + {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, + {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, + {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, + {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, + {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, + {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, + {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, + {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, + {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, {8}, + {8, 9}, {8, 9}, {8, 9}, {8, 9}, {8, 9}, {8, 9}, {8, 9}, {8, 9}, {8, 9}, {8, 9}, {8, 9}, {8, 9}, {8, 9}, {8, 9}, {9, 10}, {9, 10}, + {9, 10}, {9, 10}, {9, 10}, {9, 10}, {9, 10}, {9, 10}, {9, 10}, {9, 10}, {9, 10}, {9, 10}, {9, 10}, {10, 11}, {10, 11}, {10, 11}, {10, 11}, {10, 11}, + {10, 11}, {10, 11}, {10, 11}, {10, 11}, {10, 11}, {10, 11}, {11, 12}, {11, 12}, {11, 12}, {11, 12}, {11, 12}, {11, 12}, {11, 12}, {11, 12}, {11, 12}, {12, 13}, + {12, 13}, {12, 13}, {12, 13}, {12, 13}, {12, 13}, {12, 13}, {13, 14}, {13, 14}, {13, 14}, {13, 14}, {13, 14}, {14, 15}, {14, 15}, {14, 15}, {0, 15}, {0, 1, 15}, + {1, 0}, {1, 2}, {1, 2}, {2, 1}, {2, 3}, {2, 3}, {2, 3}, {2, 3}, {3, 2}, {3, 4}, {3, 4}, {3, 4}, {3, 4}, {3, 4}, {3, 4}, {4, 3}, + {4, 5}, {4, 5}, {4, 5}, {4, 5}, {4, 5}, {4, 5}, {4, 5}, {4, 5}, {5, 4}, {5, 6}, {5, 6}, {5, 6}, {5, 6}, {5, 6}, {5, 6}, {5, 6}, + {5, 6}, {5, 6}, {5, 6}, {6, 5}, {6, 7}, {6, 7}, {6, 7}, {6, 7}, {6, 7}, {6, 7}, {6, 7}, {6, 7}, {6, 7}, {6, 7}, {6, 7}, {6, 7}, + {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, + {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, + {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, + {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, + {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, + {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, + {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, + {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, + {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, + {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, + {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, + {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, + {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7}, {7} +}; + +static int squared(int x) { return x * x; } + +static void dpcm_lookahead( + int& minimumError, size_t& minimumErrorIndex, + const double *sampleBuf, const size_t lookahead, const int prevLevel) +{ + if (lookahead == 0) { + minimumError = 0; + return; + } + + minimumError = std::numeric_limits::max(); + minimumErrorIndex = dpcmLookupTable.size(); + const int s = clamp(static_cast(floor(sampleBuf[0] * 128.0)), -128, 127); + const std::vector indexCandicateSet = dpcm_lookahead_fast? dpcmFastLookupTable[s - prevLevel + 255]: dpcmIndexTable; + + for (auto i : indexCandicateSet) { + int newLevel = prevLevel + dpcmLookupTable[i]; + + int recMinimumError; + size_t recMinimumErrorIndex; + + // TODO apply dither noise + int errorEstimation = squared(s - newLevel); + if (errorEstimation >= minimumError) + continue; + + dpcm_lookahead(recMinimumError, recMinimumErrorIndex, + sampleBuf + 1, lookahead - 1, newLevel); + + // TODO weigh the error squared + int error = squared(s - newLevel) + recMinimumError; + if (error < minimumError) { + if (newLevel <= 127 && newLevel >= -128) { + minimumError = error; + minimumErrorIndex = i; + } + } + } +} + +static double calculate_snr(const std::vector& uncompressedData, const std::vector& decompressedData) +{ + int sum_son = 0; + int sum_mum = 0; + + assert(uncompressedData.size() == decompressedData.size()); + + for (size_t i = 0; i < uncompressedData.size(); i++) { + const int s = clamp(static_cast(floor(uncompressedData[i] * 128.0)), -128, 127) + 128; + sum_son += s * s; + const int sub = decompressedData[i] + 128 - s; + sum_mum += sub * sub; + } + + if (sum_mum == 0) { + return 100; + } + + return 10 * std::log10((double)sum_son / sum_mum); +} + +template +static void convert_dpcm_impl(wav_file& wf, InitialSampleWriter writeInitialSample, CompressedDataWriter writeCompressedData) +{ + int minimumError; + size_t minimumErrorIndex; + + std::vector uncompressedData; + std::vector decompressedData; + + const auto startTime = std::chrono::high_resolution_clock::now(); + + for (size_t i = 0; i < wf.loopEnd; i += DPCM_BLK_SIZE) { + double ds[DPCM_BLK_SIZE]; + size_t samples_in_block = std::min(DPCM_BLK_SIZE, wf.loopEnd - i); + wf.readData(i, ds, samples_in_block); + // Pad remaining samples in block with zeros if needed + for (size_t j = samples_in_block; j < DPCM_BLK_SIZE; j++) { + ds[j] = 0.0; + } + if (dpcm_verbose) { + uncompressedData.insert(uncompressedData.end(), std::begin(ds), std::end(ds)); + } + // TODO apply dither noise + int s = clamp(static_cast(floor(ds[0] * 128.0)), -128, 127); + + writeInitialSample(s); + if (dpcm_verbose) { + decompressedData.push_back(s); + } + + size_t innerLoopCount = 1; + size_t samples_to_process = dpcm_include_padding ? DPCM_BLK_SIZE : samples_in_block; + uint8_t outData = 0; + size_t sampleBufReadLen; + + goto initial_loop_enter; + + do { + if (innerLoopCount >= samples_to_process) + break; + sampleBufReadLen = std::min(dpcm_enc_lookahead, DPCM_BLK_SIZE - innerLoopCount); + dpcm_lookahead( + minimumError, minimumErrorIndex, + &ds[innerLoopCount], sampleBufReadLen, s); + outData = static_cast((minimumErrorIndex & 0xF) << 4); + s += dpcmLookupTable[minimumErrorIndex]; + if (dpcm_verbose) { + decompressedData.push_back(s); + } + innerLoopCount += 1; +initial_loop_enter: + if (innerLoopCount >= samples_to_process) + break; + sampleBufReadLen = std::min(dpcm_enc_lookahead, DPCM_BLK_SIZE - innerLoopCount); + dpcm_lookahead( + minimumError, minimumErrorIndex, + &ds[innerLoopCount], sampleBufReadLen, s); + outData |= static_cast(minimumErrorIndex & 0xF); + s += dpcmLookupTable[minimumErrorIndex]; + innerLoopCount += 1; + if (dpcm_verbose) { + decompressedData.push_back(s); + } + writeCompressedData(outData); + } while (innerLoopCount < DPCM_BLK_SIZE); + } + + const auto endTime = std::chrono::high_resolution_clock::now(); + + if (dpcm_verbose) { + const auto dur = std::chrono::duration_cast(endTime - startTime); + const double durSecs = static_cast(dur.count()) / 1000000000.0; + printf("SNR: %.2fdB, run time: %.2fs\n", calculate_snr(uncompressedData, decompressedData), durSecs); + } +} + +static void convert_dpcm(wav_file& wf, std::ofstream& ofs) +{ + uint32_t block_pos = 0; + convert_dpcm_impl(wf, + [&](int s) { data_write(ofs, block_pos, s, false); }, + [&](uint8_t outData) { data_write(ofs, block_pos, outData, true); }); +} + +static void convert_dpcm_bin(wav_file& wf, std::vector& data) +{ + convert_dpcm_impl(wf, + [&](int s) { bin_write_u8(data, static_cast(s)); }, + [&](uint8_t outData) { bin_write_u8(data, outData); }); +} + +void enable_dpcm_verbose() +{ + dpcm_verbose = true; +} + +void enable_dpcm_lookahead_fast() +{ + dpcm_lookahead_fast = true; +} + +void disable_dpcm_padding() +{ + dpcm_include_padding = false; +} + +void set_dpcm_lookahead(size_t lookahead) +{ + dpcm_enc_lookahead = clamp(lookahead, 1, 8); +} + +void set_wav_loop_start(uint32_t start) +{ + wav_loop_start = start; + wav_loop_start_override = true; +} + +void set_wav_loop_end(uint32_t end) +{ + wav_loop_end = end; + wav_loop_end_override = true; +} + +void set_wav_tune(double tune) +{ + wav_tune = tune; + wav_tune_override = true; +} + +void set_wav_key(uint8_t key) +{ + wav_key = key; + wav_key_override = true; +} + +void set_wav_rate(uint32_t rate) +{ + wav_rate = rate; + wav_rate_override = true; +} + +void convert(const std::string& wav_file_str, const std::string& out_file_str, + const std::string& sym, cmp_type ct, out_type ot) +{ + wav_file wf(wav_file_str); + + // check command line overrides + if (wav_loop_start_override) { + wf.loopStart = std::min(wav_loop_start, wf.loopEnd); + wf.loopEnabled = true; + } + if (wav_loop_end_override) { + wf.loopEnd = std::min(wav_loop_end, wf.loopEnd); + } + if (wav_tune_override) { + wf.tuning = wav_tune; + } + if (wav_key_override) { + wf.midiKey = wav_key; + } + if (wav_rate_override) { + wf.sampleRate = wav_rate; + } + + uint8_t fmt; + if (ct == cmp_type::none) + fmt = 0; + else if (ct == cmp_type::dpcm) + fmt = 1; + else + throw std::runtime_error("convert: invalid compression type"); + + double pitch; + if (wf.midiKey == 60 && wf.tuning == 0.0) { + pitch = wf.sampleRate; + } else { + pitch = wf.sampleRate * pow(2.0, (60.0 - wf.midiKey) / 12.0 + wf.tuning / 1200.0); + } + + uint32_t pitch_value; + if (wf.agbPitch != 0) { + pitch_value = wf.agbPitch; + } else { + pitch_value = static_cast(pitch * 1024.0); + } + + uint32_t loop_end = wf.loopEnd; + if (wf.agbLoopEnd != 0) { + loop_end = wf.agbLoopEnd; + } + + if (ot == out_type::binary) { + // Binary output mode + std::vector bin_data; + + // Write header (16 bytes) + // Bytes 0-3: flags (format in bit 0, loop in bit 30) + uint32_t flags = fmt; + if (wf.loopEnabled) + flags |= 0x40000000; + bin_write_u32_le(bin_data, flags); + + // Bytes 4-7: pitch + bin_write_u32_le(bin_data, pitch_value); + + // Bytes 8-11: loop start + bin_write_u32_le(bin_data, wf.loopStart); + + // Bytes 12-15: loop end + bin_write_u32_le(bin_data, loop_end); + + // Write sample data + if (ct == cmp_type::none) + convert_uncompressed_bin(wf, bin_data); + else if (ct == cmp_type::dpcm) + convert_dpcm_bin(wf, bin_data); + else + throw std::runtime_error("convert: invalid compression type"); + + // Write binary file + std::ofstream fout(out_file_str, std::ios::out | std::ios::binary); + if (!fout.is_open()) { + perror("ofstream"); + throw std::runtime_error("unable to open output file"); + } + fout.write(reinterpret_cast(bin_data.data()), bin_data.size()); + fout.close(); + } else { + // Assembly output mode + std::ofstream fout(out_file_str, std::ios::out); + if (!fout.is_open()) { + perror("ofstream"); + throw std::runtime_error("unable to open output file"); + } + + agb_out(fout, " .section .rodata\n"); + agb_out(fout, " .global %s\n", sym.c_str()); + agb_out(fout, " .align 2\n\n%s:\n\n", sym.c_str()); + + agb_out(fout, " .byte 0x%X, 0x0, 0x0, 0x%X\n", fmt, wf.loopEnabled ? 0x40 : 0x0); + agb_out(fout, " .word 0x%08X @ Mid-C ~%f\n", pitch_value, pitch); + agb_out(fout, " .word %u, %u\n", wf.loopStart, loop_end); + + if (ct == cmp_type::none) + convert_uncompressed(wf, fout); + else if (ct == cmp_type::dpcm) + convert_dpcm(wf, fout); + else + throw std::runtime_error("convert: invalid compression type"); + + agb_out(fout, "\n\n .end\n"); + fout.close(); + } +} diff --git a/tools/wav2agb/converter.h b/tools/wav2agb/converter.h new file mode 100644 index 000000000..df59ebe2d --- /dev/null +++ b/tools/wav2agb/converter.h @@ -0,0 +1,26 @@ +#pragma once + +#include +#include +#include + +enum class cmp_type { + none, dpcm +}; + +enum class out_type { + assembly, binary +}; + +void enable_dpcm_verbose(); +void enable_dpcm_lookahead_fast(); +void disable_dpcm_padding(); +void set_dpcm_lookahead(size_t lookahead); +void set_wav_loop_start(uint32_t start); +void set_wav_loop_end(uint32_t end); +void set_wav_tune(double tune); +void set_wav_key(uint8_t key); +void set_wav_rate(uint32_t rate); + +void convert(const std::string&, const std::string&, + const std::string& sym, cmp_type ct, out_type ot); diff --git a/tools/wav2agb/test_fast_compress.sh b/tools/wav2agb/test_fast_compress.sh new file mode 100644 index 000000000..3ef56b4d9 --- /dev/null +++ b/tools/wav2agb/test_fast_compress.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +for l in $(seq 1 8) +do + echo lookahead="$l": + wav2agb "$1" -c -l "$l" --verbose + echo lookahead="$l" fast: + wav2agb "$1" -f -l "$l" --verbose +done diff --git a/tools/wav2agb/wav2agb.cpp b/tools/wav2agb/wav2agb.cpp new file mode 100644 index 000000000..2d4a84517 --- /dev/null +++ b/tools/wav2agb/wav2agb.cpp @@ -0,0 +1,247 @@ +#include +#include +#include +#include +#include + +#include + +#include "converter.h" +#include "wav_file.h" + +static void usage() { + fprintf(stderr, "wav2agb\n"); + fprintf(stderr, "\n"); + fprintf(stderr, "Usage: wav2agb [options] []\n"); + fprintf(stderr, "\n"); + fprintf(stderr, "Options:\n"); + fprintf(stderr, "-s, --symbol | symbol name for wave header (default: file name)\n"); + fprintf(stderr, "-l, --lookahead | DPCM compression lookahead 1..8 (default: 3)\n"); + fprintf(stderr, "-c, --compress | compress output with DPCM\n"); + fprintf(stderr, "-f, --fast-compress | compress output with DPCM fast\n"); + fprintf(stderr, "--no-pad | omit trailing padding in compressed output\n"); + fprintf(stderr, "-b, --binary | output raw binary instead of assembly\n"); + fprintf(stderr, "--loop-start | override loop start (integer)\n"); + fprintf(stderr, "--loop-end | override loop end (integer)\n"); + fprintf(stderr, "--tune | override tuning (float)\n"); + fprintf(stderr, "--key | override midi key (int)\n"); + fprintf(stderr, "--rate | override base samplerate (int)\n"); + fprintf(stderr, "--set-agbl | adds the custom agbl chunk to the given input .wav file\n"); + exit(1); +} + +static void version() { + printf("wav2agb v1.1 (c) 2019 ipatix\n"); + exit(0); +} + +static void die(const char *msg, ...) { + va_list args; + va_start(args, msg); + vfprintf(stderr, msg, args); + va_end(args); + exit(1); +} + +static void fix_str(std::string& str) { + // replaces all characters that are not alphanumerical + for (size_t i = 0; i < str.size(); i++) { + if (str[i] >= 'a' && str[i] <= 'z') + continue; + if (str[i] >= 'A' && str[i] <= 'Z') + continue; + if (str[i] >= '0' && str[i] <= '9' && i > 0) + continue; + str[i] = '_'; + } +} + +static char path_seperators[] = { + '/', +#ifdef _WIN32 + '\\', +#endif + '\0' +}; + +static std::string filename_without_ext(const std::string& str) { + size_t last_path_seperator = 0; + char *sep = path_seperators; + while (*sep) { + size_t pos = str.find_last_of(*sep); + if (pos != std::string::npos) + last_path_seperator = std::max(pos, last_path_seperator); + sep += 1; + } + size_t file_ext_dot_pos = str.find_last_of('.'); + if (file_ext_dot_pos == std::string::npos) + return std::string(str); + assert(file_ext_dot_pos != last_path_seperator); + if (file_ext_dot_pos > last_path_seperator) + return str.substr(0, file_ext_dot_pos); + return std::string(str); +} + +static std::string filename_without_dir(const std::string& str) { + size_t last_path_seperator = 0; + bool path_seperator_found = false; + char *sep = path_seperators; + while (*sep) { + size_t pos = str.find_last_of(*sep); + if (pos != std::string::npos) { + last_path_seperator = std::max(pos, last_path_seperator); + path_seperator_found = true; + } + sep += 1; + } + if (str.size() > 0 && path_seperator_found) { + return str.substr(last_path_seperator + 1); + } else { + return std::string(str); + } +} + +static cmp_type arg_compress = cmp_type::none; +static out_type arg_output_type = out_type::assembly; +static std::string arg_sym; +static bool arg_input_file_read = false; +static bool arg_output_file_read = false; +static std::string arg_input_file; +static std::string arg_output_file; +static bool arg_set_agbl = false; +static int32_t arg_agbl_value = 0; + +int main(int argc, char *argv[]) { + try { + if (argc == 1) + usage(); + + for (int i = 1; i < argc; i++) { + std::string st(argv[i]); + if (st == "-s" || st == "--symbol") { + if (++i >= argc) + die("-s: missing symbol name\n"); + arg_sym = argv[i]; + fix_str(arg_sym); + } else if (st == "-c" || st == "--compress") { + arg_compress = cmp_type::dpcm; + } else if (st == "-f" || st == "--compress-fast") { + arg_compress = cmp_type::dpcm; + enable_dpcm_lookahead_fast(); + } else if (st == "--no-pad") { + disable_dpcm_padding(); + } else if (st == "-b" || st == "--binary") { + arg_output_type = out_type::binary; + } else if (st == "--verbose") { + enable_dpcm_verbose(); + } else if (st == "-l" || st == "--lookahead") { + if (++i >= argc) + die("-l: missing parameter"); + set_dpcm_lookahead(std::stoul(argv[i], nullptr, 10)); + } else if (st == "--version") { + version(); + } else if (st == "--loop-start") { + if (++i >= argc) + die("--loop-start: missing parameter"); + uint32_t start = static_cast(std::stoul(argv[i], nullptr, 10)); + set_wav_loop_start(start); + } else if (st == "--loop-end") { + if (++i >= argc) + die("--loop-end: missing parameter"); + uint32_t end = static_cast(std::stoul(argv[i], nullptr, 10)); + set_wav_loop_end(end); + } else if (st == "--tune") { + if (++i >= argc) + die("--tune: missing parameter"); + double tune = std::stod(argv[i], nullptr); + set_wav_tune(tune); + } else if (st == "--key") { + if (++i >= argc) + die("--key: missing parameter"); + int key = std::stoi(argv[i], nullptr, 10); + if (key < 0) key = 0; + if (key > 127) key = 127; + set_wav_key(static_cast(key)); + } else if (st == "--rate") { + if (++i >= argc) + die("--rate: missing parameter"); + uint32_t rate = static_cast(std::stoul(argv[i], nullptr, 10)); + set_wav_rate(rate); + } else if (st == "--set-agbl") { + if (++i >= argc) + die("--set-agbl: missing parameter"); + arg_agbl_value = std::stoi(argv[i], nullptr, 10); + arg_set_agbl = true; + } else { + if (st == "--") { + if (++i >= argc) + die("--: missing file name\n"); + } + if (!arg_input_file_read) { + arg_input_file = argv[i]; + if (arg_input_file.size() < 1) + die("empty input file name\n"); + arg_input_file_read = true; + } else if (!arg_output_file_read) { + arg_output_file = argv[i]; + if (arg_output_file.size() < 1) + die("empty output file name\n"); + arg_output_file_read = true; + } else { + die("Too many files specified\n"); + } + } + } + + // check arguments + if (!arg_input_file_read) { + die("No input file specified\n"); + } + + if (!arg_output_file_read) { + // create output file name if none is provided + if (arg_set_agbl) { + arg_output_file = arg_input_file; + } else if (arg_output_type == out_type::binary) { + arg_output_file = filename_without_ext(arg_input_file) + ".bin"; + } else { + arg_output_file = filename_without_ext(arg_input_file) + ".s"; + } + arg_output_file_read = true; + } + + if (arg_sym.size() == 0) { + arg_sym = filename_without_dir(filename_without_ext(arg_output_file)); + fix_str(arg_sym); + } + + if (arg_set_agbl) { + // Parse the WAV file once to get both chunks and metadata + wav_file wav(arg_input_file); + + // Calculate actual loop-end value + uint32_t loop_end_value; + if (arg_agbl_value < 0) { + // Negative value: offset from end of samples + int64_t calculated = static_cast(wav.numSamples) + arg_agbl_value; + if (calculated < 0) { + die("--set-agbl: negative offset %d exceeds total samples %u\n", + arg_agbl_value, wav.numSamples); + } + loop_end_value = static_cast(calculated); + } else { + // Positive value: use directly + loop_end_value = static_cast(arg_agbl_value); + } + + write_wav_with_agbl_chunk(arg_output_file, wav.chunks, loop_end_value); + return 0; + } + + convert(arg_input_file, arg_output_file, arg_sym, arg_compress, arg_output_type); + return 0; + } catch (const std::exception& e) { + fprintf(stderr, "std lib error:\n%s\n", e.what()); + } + return 1; +} diff --git a/tools/wav2agb/wav_file.cpp b/tools/wav2agb/wav_file.cpp new file mode 100644 index 000000000..79cfed5d7 --- /dev/null +++ b/tools/wav2agb/wav_file.cpp @@ -0,0 +1,374 @@ +#include "wav_file.h" + +#include +#include +#include +#include +#include + +static uint32_t read_u32(std::ifstream& ifs) +{ + uint8_t lenBytes[4]; + ifs.read(reinterpret_cast(lenBytes), sizeof(lenBytes)); + uint32_t retval = lenBytes[0] | (lenBytes[1] << 8) | (lenBytes[2] << 16) | (lenBytes[3] << 24); + return retval; +} + +static void write_u32(std::ofstream& ofs, uint32_t value) +{ + uint8_t bytes[4]; + bytes[0] = value & 0xFF; + bytes[1] = (value >> 8) & 0xFF; + bytes[2] = (value >> 16) & 0xFF; + bytes[3] = (value >> 24) & 0xFF; + ofs.write(reinterpret_cast(bytes), sizeof(bytes)); +} + +//static uint16_t read_u16(std::ifstream& ifs) +//{ +// uint8_t lenBytes[2]; +// ifs.read(reinterpret_cast(lenBytes), sizeof(lenBytes)); +// uint16_t retval = uint16_t(lenBytes[0] | (lenBytes[1] << 8)); +// return retval; +//} + +static std::string read_str(std::ifstream& ifs, size_t len) +{ + std::vector buf(len); + ifs.read(buf.data(), buf.size()); + return std::string(buf.data(), buf.size()); +} + +static std::vector read_arr(std::ifstream& ifs, size_t len) +{ + std::vector buf(len); + ifs.read(reinterpret_cast(buf.data()), buf.size()); + return buf; +} + +static uint16_t arr_u16(const std::vector& arr, size_t pos) +{ + uint16_t val = uint16_t(arr.at(pos) | (arr.at(pos + 1) << 8)); + return val; +} + +static uint32_t arr_u32(const std::vector& arr, size_t pos) +{ + uint32_t val = uint32_t(arr.at(pos) | (arr.at(pos + 1) << 8) | + (arr.at(pos + 2) << 16) | (arr.at(pos + 3) << 24)); + return val; +} + +static const size_t loadChunkSize = 2048; + +uint32_t wav_file::fmt_size() const +{ + if (fmt == format_type::u8) + return 1; + else if (fmt == format_type::s16) + return 2; + else if (fmt == format_type::s24) + return 3; + else if (fmt == format_type::s32) + return 4; + else if (fmt == format_type::f32) + return 4; + else if (fmt == format_type::f64) + return 8; + else + throw std::runtime_error("INTERNAL ERROR: invalid format type"); +} + +wav_file::wav_file(const std::string& path) : loadBuffer(loadChunkSize) +{ + ifs.exceptions(std::ios::badbit | std::ios::eofbit); + ifs.open(path, std::ios::binary); + if (!ifs.good()) + throw std::runtime_error("failed to open file: " + path + ", reason: " + strerror(errno)); + if (!ifs.is_open()) + throw std::runtime_error("failed to open file: " + path + ", reason: " + strerror(errno)); + + ifs.seekg(0, ifs.end); + std::streampos len = ifs.tellg(); + ifs.seekg(0, ifs.beg); + + std::string chunkId = read_str(ifs, 4); + if (chunkId != "RIFF") + throw std::runtime_error("RIFF ID invalid"); + uint32_t mainChunkLen = read_u32(ifs); + if (mainChunkLen + 8 != len) + throw std::runtime_error("RIFF chunk len (=" + + std::to_string(mainChunkLen) + + ") doesn't match file len (=" + + std::to_string(len) + + ")"); + std::string riffType = read_str(ifs, 4); + if (riffType != "WAVE") + throw std::runtime_error("WAVE ID invalid"); + + bool dataChunkFound = false; + bool fmtChunkFound = false; + // search all chunks + std::streampos curPos; + while ((curPos = ifs.tellg()) + std::streampos(8) <= len) { + chunkId = read_str(ifs, 4); + uint32_t chunkLen = read_u32(ifs); + if (curPos + std::streampos(8) + std::streampos(chunkLen) > len) + throw std::runtime_error("ERROR: chunk goes beyond end of file: offset=" + std::to_string(curPos)); + + std::vector chunkData = read_arr(ifs, chunkLen); + WavChunk chunk; + chunk.id = chunkId; + chunk.data = chunkData; + this->chunks.push_back(chunk); + + if (chunkId == "fmt ") { + fmtChunkFound = true; + uint16_t fmtTag = arr_u16(chunkData, 0); + uint16_t numChannels = arr_u16(chunkData, 2); + if (numChannels != 1) + throw std::runtime_error("ERROR: input file is NOT mono"); + this->sampleRate = arr_u32(chunkData, 4); + uint16_t block_align = arr_u16(chunkData, 12); + uint16_t bits_per_sample = arr_u16(chunkData, 14); + if (fmtTag == 1) { + // integer + if (block_align == 1 && bits_per_sample == 8) + this->fmt = format_type::u8; + else if (block_align == 2 && bits_per_sample == 16) + this->fmt = format_type::s16; + else if (block_align == 3 && bits_per_sample == 24) + this->fmt = format_type::s24; + else if (block_align == 4 && bits_per_sample == 32) + this->fmt = format_type::s32; + else + throw std::runtime_error("ERROR: unsupported integer format combination"); + } else if (fmtTag == 3) { + // float + if (block_align == 4 && bits_per_sample == 32) + this->fmt = format_type::f32; + else if (block_align == 8 && bits_per_sample == 64) + this->fmt = format_type::f64; + else + throw std::runtime_error("ERROR: unsupported float format combination"); + } else { + throw std::runtime_error("ERROR: unsupported format code: " + std::to_string(fmtTag)); + } + } else if (chunkId == "data") { + dataChunkFound = true; + // For data chunk, we need to track position in the file for later reading + // The data was already read into chunkData and saved to chunks vector + // But we need to calculate the position for the readData function + // Since we already read the data, we're now past it in the file + dataChunkPos = curPos + std::streampos(8); // Skip chunk ID and size + dataChunkEndPos = dataChunkPos + std::streampos(chunkLen); + } else if (chunkId == "smpl") { + uint32_t midiUnityNote = arr_u32(chunkData, 12); + this->midiKey = static_cast(std::min(midiUnityNote, 127u)); + uint32_t midiPitchFraction = arr_u32(chunkData, 16); + // the values below convert the uint32_t range to 0.0 to 100.0 range + this->tuning = static_cast(midiPitchFraction) / (4294967296.0 * 100.0); + uint32_t numLoops = arr_u32(chunkData, 28); + if (numLoops > 1) + throw std::runtime_error("ERROR: too many loops in smpl chunk"); + if (numLoops == 1) { + uint32_t loopType = arr_u32(chunkData, 36 + 4); + if (loopType != 0) + throw std::runtime_error("ERROR: loop type not supported: " + std::to_string(loopType)); + this->loopStart = arr_u32(chunkData, 36 + 8); + // sampler chunks tell the last sample to be played (so including rather than excluding), thus +1 + this->loopEnd = arr_u32(chunkData, 36 + 12) + 1; + this->loopEnabled = true; + } + } else if (chunkId == "agbp") { + // Custom chunk: exact GBA pitch value (sample_rate * 1024) + // This allows perfect round-trip conversion without period-based precision loss + if (chunkLen >= 4) { + this->agbPitch = arr_u32(chunkData, 0); + } + } else if (chunkId == "agbl") { + // Custom chunk: exact loop end override (handles off-by-one from original game) + if (chunkLen >= 4) { + this->agbLoopEnd = arr_u32(chunkData, 0); + } + } + + /* https://en.wikipedia.org/wiki/Resource_Interchange_File_Format#Explanation + * If chunk size is odd, skip the pad byte */ + if ((chunkLen % 2) == 1) + ifs.seekg(1, ifs.cur); + } + + if (!fmtChunkFound) + throw std::runtime_error("ERROR: fmt chunk not found"); + if (!dataChunkFound) + throw std::runtime_error("ERROR: data chunk not found"); + + this->numSamples = static_cast(dataChunkEndPos - dataChunkPos) / fmt_size(); + this->loopEnd = std::min(this->loopEnd, this->numSamples); +} + +wav_file::~wav_file() +{ + ifs.close(); +} + +void wav_file::readData(size_t location, double *data, size_t len) +{ + while (len-- > 0) { + if (loadedChunk != location - (location % loadChunkSize)) { + loadedChunk = location - (location % loadChunkSize); + + std::streampos blockpos = this->dataChunkPos + std::streampos(loadedChunk * fmt_size()); + std::streampos endblockpos = this->dataChunkEndPos; + size_t actualChunkSize = std::min(loadChunkSize, static_cast(endblockpos - blockpos) / fmt_size()); + + if (actualChunkSize == 0) { + std::fill(loadBuffer.begin(), loadBuffer.end(), 0.0); + goto load_sample; + } + + ifs.seekg(blockpos, ifs.beg); + std::vector ld(actualChunkSize * fmt_size()); + ifs.read(reinterpret_cast(ld.data()), ld.size()); + + if (fmt == format_type::u8) { + for (size_t i = 0; i < actualChunkSize; i++) { + loadBuffer[i] = (double(ld[i]) - 128.0) / 128.0; + } + } else if (fmt == format_type::s16) { + for (size_t i = 0; i < actualChunkSize; i++) { + int32_t s = + (ld[i * fmt_size() + 0] << 0) | + (ld[i * fmt_size() + 1] << 8); + s <<= 16; + s >>= 16; + loadBuffer[i] = double(s) / 32768.0; + } + } else if (fmt == format_type::s24) { + for (size_t i = 0; i < actualChunkSize; i++) { + int32_t s = + (ld[i * fmt_size() + 0] << 0) | + (ld[i * fmt_size() + 1] << 8) | + (ld[i * fmt_size() + 2] << 16); + s <<= 8; + s >>= 8; + loadBuffer[i] = double(s) / 8388608.0; + } + } else if (fmt == format_type::s32) { + for (size_t i = 0; i < actualChunkSize; i++) { + int32_t s = + (ld[i * fmt_size() + 0] << 0) | + (ld[i * fmt_size() + 1] << 8) | + (ld[i * fmt_size() + 2] << 16) | + (ld[i * fmt_size() + 3] << 24); + loadBuffer[i] = double(s) / 2147483648.0; + } + } else if (fmt == format_type::f32) { + for (size_t i = 0; i < actualChunkSize; i++) { + union { + uint32_t s; + float f; + } u; + u.s = + (ld[i * fmt_size() + 0] << 0) | + (ld[i * fmt_size() + 1] << 8) | + (ld[i * fmt_size() + 2] << 16) | + (ld[i * fmt_size() + 3] << 24); + loadBuffer[i] = u.f; + } + } else if (fmt == format_type::f64) { + for (size_t i = 0; i < actualChunkSize; i++) { + union { + uint64_t s; + double d; + } u; + u.s = + (uint64_t(ld[i * fmt_size() + 0]) << 0) | + (uint64_t(ld[i * fmt_size() + 1]) << 8) | + (uint64_t(ld[i * fmt_size() + 2]) << 16) | + (uint64_t(ld[i * fmt_size() + 3]) << 24) | + (uint64_t(ld[i * fmt_size() + 4]) << 32) | + (uint64_t(ld[i * fmt_size() + 5]) << 40) | + (uint64_t(ld[i * fmt_size() + 6]) << 48) | + (uint64_t(ld[i * fmt_size() + 7]) << 56); + loadBuffer[i] = u.d; + } + } + for (size_t i = actualChunkSize; i < loadChunkSize; i++) { + loadBuffer[i] = 0.0; + } + } +load_sample: + *data++ = loadBuffer[location % loadChunkSize]; + location++; + } +} + +// In the future, if wav2agb gains the ability to construct .wav files from .bin files, +// this function should be rolled into that flow. +void write_wav_with_agbl_chunk(const std::string& output_path, + std::vector& chunks, + uint32_t loop_end_value) +{ + bool has_agbl = false; + for (auto& chunk : chunks) { + if (chunk.id == "agbl") { + has_agbl = true; + chunk.data.resize(4); + chunk.data[0] = loop_end_value & 0xFF; + chunk.data[1] = (loop_end_value >> 8) & 0xFF; + chunk.data[2] = (loop_end_value >> 16) & 0xFF; + chunk.data[3] = (loop_end_value >> 24) & 0xFF; + break; + } + } + + if (!has_agbl) { + WavChunk agbl_chunk; + agbl_chunk.id = "agbl"; + agbl_chunk.data.resize(4); + agbl_chunk.data[0] = loop_end_value & 0xFF; + agbl_chunk.data[1] = (loop_end_value >> 8) & 0xFF; + agbl_chunk.data[2] = (loop_end_value >> 16) & 0xFF; + agbl_chunk.data[3] = (loop_end_value >> 24) & 0xFF; + for (size_t i = 0; i < chunks.size(); i++) { + if (chunks[i].id == "data") { + chunks.insert(chunks.begin() + i, agbl_chunk); + break; + } + } + } + + // Calculate total RIFF size + uint32_t total_chunk_size = 0; + for (const auto& chunk : chunks) { + total_chunk_size += 8 + chunk.data.size(); + if (chunk.data.size() % 2 == 1) { + total_chunk_size += 1; + } + } + uint32_t riff_size = 4 + total_chunk_size; + + std::ofstream ofs(output_path, std::ios::binary); + if (!ofs.good()) + throw std::runtime_error("Failed to open output file: " + output_path); + + ofs.write("RIFF", 4); + write_u32(ofs, riff_size); + ofs.write("WAVE", 4); + + for (const auto& chunk : chunks) { + ofs.write(chunk.id.c_str(), 4); + write_u32(ofs, chunk.data.size()); + if (!chunk.data.empty()) { + ofs.write(reinterpret_cast(chunk.data.data()), chunk.data.size()); + } + + if (chunk.data.size() % 2 == 1) { + ofs.put(0); + } + } + + ofs.close(); +} diff --git a/tools/wav2agb/wav_file.h b/tools/wav2agb/wav_file.h new file mode 100644 index 000000000..cea278970 --- /dev/null +++ b/tools/wav2agb/wav_file.h @@ -0,0 +1,51 @@ +#pragma once + +#include +#include +#include +#include +#include + +#define WAV_INVALID_VAL 0xFFFFFFFFu + +// Structure for WAV chunk utilities +struct WavChunk { + std::string id; + std::vector data; +}; + +void write_wav_with_agbl_chunk(const std::string& output_path, + std::vector& chunks, + uint32_t loop_end_value); + +class wav_file { +public: + wav_file(const std::string& path); + ~wav_file(); + + void readData(size_t location, double *data, size_t len); +private: + std::ifstream ifs; + std::streampos dataChunkPos; + std::streampos dataChunkEndPos; + size_t loadedChunk = WAV_INVALID_VAL; + + std::vector loadBuffer; + size_t loadBufferBlock = std::numeric_limits::max(); + enum class format_type { + u8, s16, s24, s32, + f32, f64, + } fmt; + uint32_t fmt_size() const; +public: + uint32_t loopStart = 0; // samples + uint32_t loopEnd = std::numeric_limits::max(); // samples + bool loopEnabled = false; + double tuning = 0.0; // cents + uint8_t midiKey = 60; + uint32_t sampleRate; + uint32_t numSamples = 0; // total number of samples in the file + uint32_t agbPitch = 0; // optional: exact GBA pitch value from 'agbp' chunk (0 = not present) + uint32_t agbLoopEnd = 0; // optional: exact loop end from 'agbl' chunk (0 = not present) + std::vector chunks; // raw chunks from the WAV file (for re-writing with modifications) +};