From 81f397360e391507534b154e4f976c2b99c09731 Mon Sep 17 00:00:00 2001 From: Icedude907 <34080011+Icedude907@users.noreply.github.com> Date: Sun, 12 Nov 2023 14:28:11 +1300 Subject: [PATCH 01/54] Moved files - spinda spots, jp fonts, redyellowgreen_frame.bin --- ..._female_font.png => japanese_frlg_female.png} | Bin ...frlg_male_font.png => japanese_frlg_male.png} | Bin .../spinda/spots}/spot_0.png | Bin .../spinda/spots}/spot_1.png | Bin .../spinda/spots}/spot_2.png | Bin .../spinda/spots}/spot_3.png | Bin graphics/unused/.gitignore | 1 + graphics/unused/redyellowgreen_frame.bin | Bin 8192 -> 0 bytes graphics_file_rules.mk | 6 +++--- src/pokemon.c | 8 ++++---- 10 files changed, 8 insertions(+), 7 deletions(-) rename graphics/fonts/{japanese_frlg_female_font.png => japanese_frlg_female.png} (100%) rename graphics/fonts/{japanese_frlg_male_font.png => japanese_frlg_male.png} (100%) rename graphics/{spinda_spots => pokemon/spinda/spots}/spot_0.png (100%) rename graphics/{spinda_spots => pokemon/spinda/spots}/spot_1.png (100%) rename graphics/{spinda_spots => pokemon/spinda/spots}/spot_2.png (100%) rename graphics/{spinda_spots => pokemon/spinda/spots}/spot_3.png (100%) create mode 100644 graphics/unused/.gitignore delete mode 100644 graphics/unused/redyellowgreen_frame.bin diff --git a/graphics/fonts/japanese_frlg_female_font.png b/graphics/fonts/japanese_frlg_female.png similarity index 100% rename from graphics/fonts/japanese_frlg_female_font.png rename to graphics/fonts/japanese_frlg_female.png diff --git a/graphics/fonts/japanese_frlg_male_font.png b/graphics/fonts/japanese_frlg_male.png similarity index 100% rename from graphics/fonts/japanese_frlg_male_font.png rename to graphics/fonts/japanese_frlg_male.png diff --git a/graphics/spinda_spots/spot_0.png b/graphics/pokemon/spinda/spots/spot_0.png similarity index 100% rename from graphics/spinda_spots/spot_0.png rename to graphics/pokemon/spinda/spots/spot_0.png diff --git a/graphics/spinda_spots/spot_1.png b/graphics/pokemon/spinda/spots/spot_1.png similarity index 100% rename from graphics/spinda_spots/spot_1.png rename to graphics/pokemon/spinda/spots/spot_1.png diff --git a/graphics/spinda_spots/spot_2.png b/graphics/pokemon/spinda/spots/spot_2.png similarity index 100% rename from graphics/spinda_spots/spot_2.png rename to graphics/pokemon/spinda/spots/spot_2.png diff --git a/graphics/spinda_spots/spot_3.png b/graphics/pokemon/spinda/spots/spot_3.png similarity index 100% rename from graphics/spinda_spots/spot_3.png rename to graphics/pokemon/spinda/spots/spot_3.png diff --git a/graphics/unused/.gitignore b/graphics/unused/.gitignore new file mode 100644 index 0000000000..b929a6cae7 --- /dev/null +++ b/graphics/unused/.gitignore @@ -0,0 +1 @@ +redyellowgreen_frame.bin \ No newline at end of file diff --git a/graphics/unused/redyellowgreen_frame.bin b/graphics/unused/redyellowgreen_frame.bin deleted file mode 100644 index 6852998fb85d057fa16a892b867f0343b6764ec7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8192 zcmeI!+X{m)5CqV9D7fD5|NpC{Hc%{3u4D}*?zg_@9F)gu3!3ct5E`l3oKZj+Ni*e z*{PlGf6B{`3;g%`S!{J`qyJBO|M=|B;PapAPd{#Ilz;>zAOQ(TKmrnwz)c0-iL^Nf diff --git a/graphics_file_rules.mk b/graphics_file_rules.mk index 090620ebe8..92cc3338dc 100644 --- a/graphics_file_rules.mk +++ b/graphics_file_rules.mk @@ -21,7 +21,7 @@ JPCONTESTGFXDIR := graphics/contest/japanese POKEDEXGFXDIR := graphics/pokedex STARTERGFXDIR := graphics/starter_choose NAMINGGFXDIR := graphics/naming_screen -SPINDAGFXDIR := graphics/spinda_spots +SPINDAGFXDIR := graphics/pokemon/spinda/spots types := normal fight flying poison ground rock bug ghost steel mystery fire water grass electric psychic ice dragon dark contest_types := cool beauty cute smart tough @@ -290,10 +290,10 @@ $(FONTGFXDIR)/short.fwjpnfont: $(FONTGFXDIR)/japanese_short.png $(FONTGFXDIR)/braille.fwjpnfont: $(FONTGFXDIR)/braille.png $(GFX) $< $@ -$(FONTGFXDIR)/frlg_male.fwjpnfont: $(FONTGFXDIR)/japanese_frlg_male_font.png +$(FONTGFXDIR)/frlg_male.fwjpnfont: $(FONTGFXDIR)/japanese_frlg_male.png $(GFX) $< $@ -$(FONTGFXDIR)/frlg_female.fwjpnfont: $(FONTGFXDIR)/japanese_frlg_female_font.png +$(FONTGFXDIR)/frlg_female.fwjpnfont: $(FONTGFXDIR)/japanese_frlg_female.png $(GFX) $< $@ diff --git a/src/pokemon.c b/src/pokemon.c index d3a570e72f..6ee052fda5 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -1354,10 +1354,10 @@ static const u16 sHoennToNationalOrder[NUM_SPECIES - 1] = const struct SpindaSpot gSpindaSpotGraphics[] = { - {.x = 16, .y = 7, .image = INCBIN_U16("graphics/spinda_spots/spot_0.1bpp")}, - {.x = 40, .y = 8, .image = INCBIN_U16("graphics/spinda_spots/spot_1.1bpp")}, - {.x = 22, .y = 25, .image = INCBIN_U16("graphics/spinda_spots/spot_2.1bpp")}, - {.x = 34, .y = 26, .image = INCBIN_U16("graphics/spinda_spots/spot_3.1bpp")} + {.x = 16, .y = 7, .image = INCBIN_U16("graphics/pokemon/spinda/spots/spot_0.1bpp")}, + {.x = 40, .y = 8, .image = INCBIN_U16("graphics/pokemon/spinda/spots/spot_1.1bpp")}, + {.x = 22, .y = 25, .image = INCBIN_U16("graphics/pokemon/spinda/spots/spot_2.1bpp")}, + {.x = 34, .y = 26, .image = INCBIN_U16("graphics/pokemon/spinda/spots/spot_3.1bpp")} }; #include "data/pokemon/item_effects.h" From a0bf504bc1364e15d7c60e1d8a043e6044376770 Mon Sep 17 00:00:00 2001 From: Icedude907 <34080011+Icedude907@users.noreply.github.com> Date: Sun, 12 Nov 2023 15:19:50 +1300 Subject: [PATCH 02/54] Linkerscript now tracks RAM/ROM usage --- .gitignore | 1 - Makefile | 9 ++- gflib/malloc.c | 3 + gflib/malloc.h | 3 +- ld_script.txt => ld_script.ld | 50 ++++++++--------- ld_script_modern.txt => ld_script_modern.ld | 61 ++++++++++----------- 6 files changed, 64 insertions(+), 63 deletions(-) rename ld_script.txt => ld_script.ld (99%) rename ld_script_modern.txt => ld_script_modern.ld (83%) diff --git a/.gitignore b/.gitignore index 082430d794..9fa431e143 100644 --- a/.gitignore +++ b/.gitignore @@ -21,7 +21,6 @@ sound/**/*.bin sound/songs/midi/*.s tools/agbcc *.map -*.ld *.bat *.dump *.sa* diff --git a/Makefile b/Makefile index 5c073b36ca..50953be79c 100644 --- a/Makefile +++ b/Makefile @@ -119,8 +119,6 @@ ifneq ($(MODERN),1) CPPFLAGS += -I tools/agbcc/include -I tools/agbcc -nostdinc -undef endif -LDFLAGS = -Map ../../$(MAP) - SHA1 := $(shell { command -v sha1sum || command -v shasum; } 2>/dev/null) -c GFX := tools/gbagfx/gbagfx$(EXE) AIF := tools/aif2pcm/aif2pcm$(EXE) @@ -406,19 +404,20 @@ $(OBJ_DIR)/sym_ewram.ld: sym_ewram.txt $(RAMSCRGEN) ewram_data $< ENGLISH > $@ ifeq ($(MODERN),0) -LD_SCRIPT := ld_script.txt +LD_SCRIPT := ld_script.ld LD_SCRIPT_DEPS := $(OBJ_DIR)/sym_bss.ld $(OBJ_DIR)/sym_common.ld $(OBJ_DIR)/sym_ewram.ld else -LD_SCRIPT := ld_script_modern.txt +LD_SCRIPT := ld_script_modern.ld LD_SCRIPT_DEPS := endif $(OBJ_DIR)/ld_script.ld: $(LD_SCRIPT) $(LD_SCRIPT_DEPS) cd $(OBJ_DIR) && sed "s#tools/#../../tools/#g" ../../$(LD_SCRIPT) > ld_script.ld +LDFLAGS = -Map ../../$(MAP) $(ELF): $(OBJ_DIR)/ld_script.ld $(OBJS) libagbsyscall @echo "cd $(OBJ_DIR) && $(LD) $(LDFLAGS) -T ld_script.ld -o ../../$@ " - @cd $(OBJ_DIR) && $(LD) $(LDFLAGS) -T ld_script.ld -o ../../$@ $(OBJS_REL) $(LIB) + @cd $(OBJ_DIR) && $(LD) $(LDFLAGS) -T ld_script.ld --print-memory-usage -o ../../$@ $(OBJS_REL) $(LIB) | cat $(FIX) $@ -t"$(TITLE)" -c$(GAME_CODE) -m$(MAKER_CODE) -r$(REVISION) --silent $(ROM): $(ELF) diff --git a/gflib/malloc.c b/gflib/malloc.c index d0b9497635..7229c20e8b 100644 --- a/gflib/malloc.c +++ b/gflib/malloc.c @@ -1,8 +1,11 @@ #include "global.h" +#include "malloc.h" static void *sHeapStart; static u32 sHeapSize; +__attribute__((section("__EWRAM_HEAP"))) u8 gHeap[HEAP_SIZE] = {0}; + #define MALLOC_SYSTEM_ID 0xA3A3 struct MemBlock { diff --git a/gflib/malloc.h b/gflib/malloc.h index 851db83a62..2792ff1cb7 100644 --- a/gflib/malloc.h +++ b/gflib/malloc.h @@ -1,7 +1,6 @@ #ifndef GUARD_ALLOC_H #define GUARD_ALLOC_H -#define HEAP_SIZE 0x1C000 #define FREE_AND_SET_NULL(ptr) \ { \ @@ -11,6 +10,8 @@ #define TRY_FREE_AND_SET_NULL(ptr) if (ptr != NULL) FREE_AND_SET_NULL(ptr) +// 122 KB. Max size of the heap without running into other data +#define HEAP_SIZE 0x1C000 extern u8 gHeap[]; void *Alloc(u32 size); diff --git a/ld_script.txt b/ld_script.ld similarity index 99% rename from ld_script.txt rename to ld_script.ld index 4be5965240..ee0556d5a0 100644 --- a/ld_script.txt +++ b/ld_script.ld @@ -3,6 +3,13 @@ ENTRY(Start) gNumMusicPlayers = 4; gMaxLines = 0; +MEMORY +{ + EWRAM (rwx) : ORIGIN = 0x2000000, LENGTH = 256K + IWRAM (rwx) : ORIGIN = 0x3000000, LENGTH = 32K + ROM (rx) : ORIGIN = 0x8000000, LENGTH = 16M +} + /* Modify the following load addresses as needed to make more room. Alternately, delete both the declarations below and their references further down to get rid of the gaps. */ @@ -10,28 +17,22 @@ __anim_mon_load_address = 0x8b00000; __gfx_load_address = 0x8c00000; SECTIONS { - . = 0x2000000; - ewram (NOLOAD) : + ewram 0x2000000 (NOLOAD) : ALIGN(4) { - gHeap = .; - - . = 0x1C000; + *(__EWRAM_HEAP); INCLUDE "sym_ewram.ld" - src/*.o(ewram_data); - gflib/*.o(ewram_data); + src/*.o(ewram_data); /**/ + gflib/*.o(ewram_data); /**/ *libc.a:impure.o(.data); *libc.a:locale.o(.data); *libc.a:mallocr.o(.data); - . = 0x40000; - } + } > EWRAM - . = 0x3000000; - - iwram (NOLOAD) : + iwram 0x3000000 (NOLOAD) : ALIGN(4) { /* .bss starts at 0x3000000 */ @@ -46,10 +47,9 @@ SECTIONS { /* COMMON starts at 0x30022A8 */ INCLUDE "sym_common.ld" *libc.a:sbrkr.o(COMMON); - end = .; - . = 0x8000; - } + } > IWRAM + /* BEGIN ROM DATA */ . = 0x8000000; .text : @@ -343,7 +343,7 @@ SECTIONS { src/gym_leader_rematch.o(.text); src/battle_transition_frontier.o(.text); src/international_string_util.o(.text); - } =0 + } > ROM =0 script_data : ALIGN(4) @@ -356,7 +356,7 @@ SECTIONS { data/battle_ai_scripts.o(script_data); data/contest_ai_scripts.o(script_data); data/mystery_event_script_cmd_table.o(script_data); - } =0 + } > ROM =0 lib_text : ALIGN(4) @@ -440,7 +440,7 @@ SECTIONS { *libc.a:libcfunc.o(.text); *libc.a:lseekr.o(.text); *libc.a:readr.o(.text); - } =0 + } > ROM =0 .rodata : ALIGN(4) @@ -705,7 +705,7 @@ SECTIONS { data/mystery_gift.o(.rodata); src/m4a_tables.o(.rodata); data/sound_data.o(.rodata); - } =0 + } > ROM =0 song_data : ALIGN(4) @@ -1240,7 +1240,7 @@ SECTIONS { sound/songs/midi/ph_nurse_blend.o(.rodata); sound/songs/midi/ph_nurse_held.o(.rodata); sound/songs/midi/ph_nurse_solo.o(.rodata); - } =0 + } > ROM =0 lib_rodata : SUBALIGN(4) @@ -1293,7 +1293,7 @@ SECTIONS { *libc.a:lseekr.o(.rodata); *libc.a:readr.o(.rodata); src/libisagbprn.o(.rodata); - } =0 + } > ROM =0 multiboot_data : ALIGN(4) @@ -1301,19 +1301,19 @@ SECTIONS { data/multiboot_ereader.o(.rodata); data/multiboot_berry_glitch_fix.o(.rodata); data/multiboot_pokemon_colosseum.o(.rodata); - } =0 + } > ROM =0 anim_mon_front_pic_data __anim_mon_load_address : ALIGN(4) { src/anim_mon_front_pics.o(.rodata); - } =0 + } > ROM =0 gfx_data __gfx_load_address : ALIGN(4) { src/graphics.o(.rodata); - } =0 + } > ROM =0 extra : ALIGN(4) @@ -1323,7 +1323,7 @@ SECTIONS { src/*.o(.rodata); gflib/*.o(.rodata); data/*.o(.rodata); - } = 0 + } > ROM = 0 /* DWARF debug sections. Symbols in the DWARF debugging sections are relative to the beginning diff --git a/ld_script_modern.txt b/ld_script_modern.ld similarity index 83% rename from ld_script_modern.txt rename to ld_script_modern.ld index 549d040e1e..05b2b815ff 100644 --- a/ld_script_modern.txt +++ b/ld_script_modern.ld @@ -3,28 +3,28 @@ ENTRY(Start) gNumMusicPlayers = 4; gMaxLines = 0; -SECTIONS { - . = 0x2000000; - - ewram (NOLOAD) : - ALIGN(4) - { - gHeap = .; - - . = 0x1C000; - - src/*.o(ewram_data); - gflib/*.o(ewram_data); - - . = 0x40000; +/* Memory Spaces */ +MEMORY +{ + EWRAM (rwx) : ORIGIN = 0x2000000, LENGTH = 256K + IWRAM (rwx) : ORIGIN = 0x3000000, LENGTH = 32K + ROM (rx) : ORIGIN = 0x8000000, LENGTH = 16M } - . = 0x3000000; +SECTIONS { - iwram (NOLOAD) : + ewram 0x2000000 (NOLOAD) : + ALIGN(4) + { + *(__EWRAM_HEAP); + + src/*.o(ewram_data); /**/ + gflib/*.o(ewram_data); /**/ + } > EWRAM + + iwram 0x3000000 (NOLOAD) : ALIGN(4) { - /* .bss starts at 0x3000000 */ src/*.o(.bss); gflib/*.o(.bss); data/*.o(.bss); @@ -35,14 +35,13 @@ SECTIONS { src/m4a.o(.bss.code); /* COMMON starts at 0x30022A8 */ - src/*.o(COMMON); - gflib/*.o(COMMON); - *libc.a:*.o(COMMON); + src/*.o(COMMON); /**/ + gflib/*.o(COMMON); /**/ + *libc.a:*.o(COMMON); *libnosys.a:*.o(COMMON); - end = .; - . = 0x8000; - } + } > IWRAM + /* BEGIN ROM DATA */ . = 0x8000000; .text : @@ -55,13 +54,13 @@ SECTIONS { gflib/*.o(.text*); src/*.o(.text*); asm/*.o(.text*); - } =0 + } > ROM =0 script_data : ALIGN(4) { data/*.o(script_data); - } =0 + } > ROM =0 lib_text : ALIGN(4) @@ -82,7 +81,7 @@ SECTIONS { *libc.a:*.o(.text*); *libnosys.a:*.o(.text*); src/libisagbprn.o(.text); - } =0 + } > ROM =0 .rodata : ALIGN(4) @@ -90,13 +89,13 @@ SECTIONS { src/*.o(.rodata*); gflib/*.o(.rodata*); data/*.o(.rodata*); - } =0 + } > ROM =0 song_data : ALIGN(4) { sound/songs/*.o(.rodata); - } =0 + } > ROM =0 lib_rodata : SUBALIGN(4) @@ -121,19 +120,19 @@ SECTIONS { data/multiboot_ereader.o(.rodata); data/multiboot_berry_glitch_fix.o(.rodata); data/multiboot_pokemon_colosseum.o(.rodata); - } =0 + } > ROM =0 anim_mon_front_pic_data : ALIGN(4) { src/anim_mon_front_pics.o(.rodata); - } =0 + } > ROM =0 gfx_data : ALIGN(4) { src/graphics.o(.rodata); - } =0 + } > ROM =0 /* DWARF debug sections. Symbols in the DWARF debugging sections are relative to the beginning From 190e77e9c886174e0edaecbe8bb44365e55bfebd Mon Sep 17 00:00:00 2001 From: SnorlaxMonster Date: Sat, 18 Nov 2023 12:53:00 +1100 Subject: [PATCH 03/54] Rename HITMARKER_IGNORE_SAFEGUARD Rename HITMARKER_IGNORE_SAFEGUARD to HITMARKER_STATUS_ABILITY_EFFECT. This flag is used exclusively by status-inflicting Abilities, and has 3 main functions: - Whether the effect bypasses Shield Dust - Whether the effect bypasses Safeguard - Which text string to display when the status condition is inflicted (i.e. whether it was inflicted by a move or Ability) I believe this new name better represents what the flag actually does. This name was structured to parallel HITMARKER_SYNCHRONISE_EFFECT. --- include/constants/battle.h | 2 +- src/battle_script_commands.c | 30 +++++++++++++++--------------- src/battle_util.c | 16 ++++++++-------- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/include/constants/battle.h b/include/constants/battle.h index c4c1bc5e68..50c93083f8 100644 --- a/include/constants/battle.h +++ b/include/constants/battle.h @@ -176,7 +176,7 @@ #define HITMARKER_ATTACKSTRING_PRINTED (1 << 10) #define HITMARKER_NO_PPDEDUCT (1 << 11) #define HITMARKER_SWAP_ATTACKER_TARGET (1 << 12) -#define HITMARKER_IGNORE_SAFEGUARD (1 << 13) +#define HITMARKER_STATUS_ABILITY_EFFECT (1 << 13) #define HITMARKER_SYNCHRONISE_EFFECT (1 << 14) #define HITMARKER_RUN (1 << 15) #define HITMARKER_IGNORE_ON_AIR (1 << 16) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 96ae0e68a3..2bc8e73f43 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -2246,11 +2246,11 @@ void SetMoveEffect(bool8 primary, u8 certain) gBattleScripting.battler = gBattlerAttacker; } - if (gBattleMons[gEffectBattler].ability == ABILITY_SHIELD_DUST && !(gHitMarker & HITMARKER_IGNORE_SAFEGUARD) + if (gBattleMons[gEffectBattler].ability == ABILITY_SHIELD_DUST && !(gHitMarker & HITMARKER_STATUS_ABILITY_EFFECT) && !primary && gBattleCommunication[MOVE_EFFECT_BYTE] <= 9) INCREMENT_RESET_RETURN - if (gSideStatuses[GET_BATTLER_SIDE(gEffectBattler)] & SIDE_STATUS_SAFEGUARD && !(gHitMarker & HITMARKER_IGNORE_SAFEGUARD) + if (gSideStatuses[GET_BATTLER_SIDE(gEffectBattler)] & SIDE_STATUS_SAFEGUARD && !(gHitMarker & HITMARKER_STATUS_ABILITY_EFFECT) && !primary && gBattleCommunication[MOVE_EFFECT_BYTE] <= 7) INCREMENT_RESET_RETURN @@ -2300,10 +2300,10 @@ void SetMoveEffect(bool8 primary, u8 certain) BattleScriptPush(gBattlescriptCurrInstr + 1); gBattlescriptCurrInstr = BattleScript_PSNPrevention; - if (gHitMarker & HITMARKER_IGNORE_SAFEGUARD) + if (gHitMarker & HITMARKER_STATUS_ABILITY_EFFECT) { gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_ABILITY_PREVENTS_ABILITY_STATUS; - gHitMarker &= ~HITMARKER_IGNORE_SAFEGUARD; + gHitMarker &= ~HITMARKER_STATUS_ABILITY_EFFECT; } else { @@ -2312,7 +2312,7 @@ void SetMoveEffect(bool8 primary, u8 certain) RESET_RETURN } if ((IS_BATTLER_OF_TYPE(gEffectBattler, TYPE_POISON) || IS_BATTLER_OF_TYPE(gEffectBattler, TYPE_STEEL)) - && (gHitMarker & HITMARKER_IGNORE_SAFEGUARD) + && (gHitMarker & HITMARKER_STATUS_ABILITY_EFFECT) && (primary == TRUE || certain == MOVE_EFFECT_CERTAIN)) { BattleScriptPush(gBattlescriptCurrInstr + 1); @@ -2341,10 +2341,10 @@ void SetMoveEffect(bool8 primary, u8 certain) BattleScriptPush(gBattlescriptCurrInstr + 1); gBattlescriptCurrInstr = BattleScript_BRNPrevention; - if (gHitMarker & HITMARKER_IGNORE_SAFEGUARD) + if (gHitMarker & HITMARKER_STATUS_ABILITY_EFFECT) { gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_ABILITY_PREVENTS_ABILITY_STATUS; - gHitMarker &= ~HITMARKER_IGNORE_SAFEGUARD; + gHitMarker &= ~HITMARKER_STATUS_ABILITY_EFFECT; } else { @@ -2353,7 +2353,7 @@ void SetMoveEffect(bool8 primary, u8 certain) RESET_RETURN } if (IS_BATTLER_OF_TYPE(gEffectBattler, TYPE_FIRE) - && (gHitMarker & HITMARKER_IGNORE_SAFEGUARD) + && (gHitMarker & HITMARKER_STATUS_ABILITY_EFFECT) && (primary == TRUE || certain == MOVE_EFFECT_CERTAIN)) { BattleScriptPush(gBattlescriptCurrInstr + 1); @@ -2397,10 +2397,10 @@ void SetMoveEffect(bool8 primary, u8 certain) BattleScriptPush(gBattlescriptCurrInstr + 1); gBattlescriptCurrInstr = BattleScript_PRLZPrevention; - if (gHitMarker & HITMARKER_IGNORE_SAFEGUARD) + if (gHitMarker & HITMARKER_STATUS_ABILITY_EFFECT) { gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_ABILITY_PREVENTS_ABILITY_STATUS; - gHitMarker &= ~HITMARKER_IGNORE_SAFEGUARD; + gHitMarker &= ~HITMARKER_STATUS_ABILITY_EFFECT; } else { @@ -2425,10 +2425,10 @@ void SetMoveEffect(bool8 primary, u8 certain) BattleScriptPush(gBattlescriptCurrInstr + 1); gBattlescriptCurrInstr = BattleScript_PSNPrevention; - if (gHitMarker & HITMARKER_IGNORE_SAFEGUARD) + if (gHitMarker & HITMARKER_STATUS_ABILITY_EFFECT) { gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_ABILITY_PREVENTS_ABILITY_STATUS; - gHitMarker &= ~HITMARKER_IGNORE_SAFEGUARD; + gHitMarker &= ~HITMARKER_STATUS_ABILITY_EFFECT; } else { @@ -2437,7 +2437,7 @@ void SetMoveEffect(bool8 primary, u8 certain) RESET_RETURN } if ((IS_BATTLER_OF_TYPE(gEffectBattler, TYPE_POISON) || IS_BATTLER_OF_TYPE(gEffectBattler, TYPE_STEEL)) - && (gHitMarker & HITMARKER_IGNORE_SAFEGUARD) + && (gHitMarker & HITMARKER_STATUS_ABILITY_EFFECT) && (primary == TRUE || certain == MOVE_EFFECT_CERTAIN)) { BattleScriptPush(gBattlescriptCurrInstr + 1); @@ -2480,10 +2480,10 @@ void SetMoveEffect(bool8 primary, u8 certain) BtlController_EmitSetMonData(BUFFER_A, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[gEffectBattler].status1), &gBattleMons[gEffectBattler].status1); MarkBattlerForControllerExec(gActiveBattler); - if (gHitMarker & HITMARKER_IGNORE_SAFEGUARD) + if (gHitMarker & HITMARKER_STATUS_ABILITY_EFFECT) { gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_STATUSED_BY_ABILITY; - gHitMarker &= ~HITMARKER_IGNORE_SAFEGUARD; + gHitMarker &= ~HITMARKER_STATUS_ABILITY_EFFECT; } else { diff --git a/src/battle_util.c b/src/battle_util.c index 5a2b6392f0..735d1ba810 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -649,7 +649,7 @@ void HandleAction_NothingIsFainted(void) gCurrentTurnActionNumber++; gCurrentActionFuncId = gActionsByTurnOrder[gCurrentTurnActionNumber]; gHitMarker &= ~(HITMARKER_DESTINYBOND | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_ATTACKSTRING_PRINTED - | HITMARKER_NO_PPDEDUCT | HITMARKER_IGNORE_SAFEGUARD | HITMARKER_IGNORE_ON_AIR + | HITMARKER_NO_PPDEDUCT | HITMARKER_STATUS_ABILITY_EFFECT | HITMARKER_IGNORE_ON_AIR | HITMARKER_IGNORE_UNDERGROUND | HITMARKER_IGNORE_UNDERWATER | HITMARKER_PASSIVE_DAMAGE | HITMARKER_OBEYS | HITMARKER_WAKE_UP_CLEAR | HITMARKER_SYNCHRONISE_EFFECT | HITMARKER_CHARGING | HITMARKER_NEVER_SET); @@ -662,7 +662,7 @@ void HandleAction_ActionFinished(void) gCurrentActionFuncId = gActionsByTurnOrder[gCurrentTurnActionNumber]; SpecialStatusesClear(); gHitMarker &= ~(HITMARKER_DESTINYBOND | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_ATTACKSTRING_PRINTED - | HITMARKER_NO_PPDEDUCT | HITMARKER_IGNORE_SAFEGUARD | HITMARKER_IGNORE_ON_AIR + | HITMARKER_NO_PPDEDUCT | HITMARKER_STATUS_ABILITY_EFFECT | HITMARKER_IGNORE_ON_AIR | HITMARKER_IGNORE_UNDERGROUND | HITMARKER_IGNORE_UNDERWATER | HITMARKER_PASSIVE_DAMAGE | HITMARKER_OBEYS | HITMARKER_WAKE_UP_CLEAR | HITMARKER_SYNCHRONISE_EFFECT | HITMARKER_CHARGING | HITMARKER_NEVER_SET); @@ -2782,7 +2782,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA gBattleCommunication[MOVE_EFFECT_BYTE] += MOVE_EFFECT_AFFECTS_USER; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_ApplySecondaryEffect; - gHitMarker |= HITMARKER_IGNORE_SAFEGUARD; + gHitMarker |= HITMARKER_STATUS_ABILITY_EFFECT; effect++; } break; @@ -2797,7 +2797,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA gBattleCommunication[MOVE_EFFECT_BYTE] = MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_POISON; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_ApplySecondaryEffect; - gHitMarker |= HITMARKER_IGNORE_SAFEGUARD; + gHitMarker |= HITMARKER_STATUS_ABILITY_EFFECT; effect++; } break; @@ -2812,7 +2812,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA gBattleCommunication[MOVE_EFFECT_BYTE] = MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_PARALYSIS; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_ApplySecondaryEffect; - gHitMarker |= HITMARKER_IGNORE_SAFEGUARD; + gHitMarker |= HITMARKER_STATUS_ABILITY_EFFECT; effect++; } break; @@ -2827,7 +2827,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA gBattleCommunication[MOVE_EFFECT_BYTE] = MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_BURN; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_ApplySecondaryEffect; - gHitMarker |= HITMARKER_IGNORE_SAFEGUARD; + gHitMarker |= HITMARKER_STATUS_ABILITY_EFFECT; effect++; } break; @@ -2963,7 +2963,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA gBattleScripting.battler = gBattlerTarget; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_SynchronizeActivates; - gHitMarker |= HITMARKER_IGNORE_SAFEGUARD; + gHitMarker |= HITMARKER_STATUS_ABILITY_EFFECT; effect++; } break; @@ -2979,7 +2979,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA gBattleScripting.battler = gBattlerAttacker; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_SynchronizeActivates; - gHitMarker |= HITMARKER_IGNORE_SAFEGUARD; + gHitMarker |= HITMARKER_STATUS_ABILITY_EFFECT; effect++; } break; From 2db9ab2a2f68f66383edde08b9d731002f9a9b33 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Thu, 16 Nov 2023 13:08:47 -0500 Subject: [PATCH 04/54] Document camera sprite functions --- include/event_object_movement.h | 10 +++- src/event_object_movement.c | 102 ++++++++++++++++---------------- src/field_camera.c | 4 +- src/field_effect.c | 28 ++++----- src/field_player_avatar.c | 6 +- 5 files changed, 78 insertions(+), 72 deletions(-) diff --git a/include/event_object_movement.h b/include/event_object_movement.h index 01269cdb5e..2a273b7991 100644 --- a/include/event_object_movement.h +++ b/include/event_object_movement.h @@ -71,6 +71,12 @@ enum ReflectionTypes #define GROUND_EFFECT_FLAG_HOT_SPRINGS (1 << 18) #define GROUND_EFFECT_FLAG_SEAWEED (1 << 19) +// Sprite data for the CameraObject functions +#define sCamera_FollowSpriteId data[0] +#define sCamera_State data[1] +#define sCamera_MoveX data[2] +#define sCamera_MoveY data[3] + struct StepAnimTable { const union AnimCmd *const *anims; @@ -123,7 +129,7 @@ u8 TrySpawnObjectEvent(u8 localId, u8 mapNum, u8 mapGroup); u8 SpawnSpecialObjectEventParameterized(u8 graphicsId, u8 movementBehavior, u8 localId, s16 x, s16 y, u8 elevation); u8 SpawnSpecialObjectEvent(struct ObjectEventTemplate *); void SetSpritePosToMapCoords(s16 mapX, s16 mapY, s16 *destX, s16 *destY); -void CameraObjectReset1(void); +void CameraObjectReset(void); void ObjectEventSetGraphicsId(struct ObjectEvent *, u8 graphicsId); void ObjectEventTurn(struct ObjectEvent *, u8 direction); void ObjectEventTurnByLocalIdAndMap(u8 localId, u8 mapNum, u8 mapGroup, u8 direction); @@ -211,7 +217,7 @@ u16 GetObjectPaletteTag(u8 palSlot); void UpdateObjectEventSpriteInvisibility(struct Sprite *sprite, bool8 invisible); s16 GetFigure8XOffset(s16 idx); s16 GetFigure8YOffset(s16 idx); -void CameraObjectReset2(void); +void CameraObjectFreeze(void); u8 GetObjectEventBerryTreeId(u8 objectEventId); void SetBerryTreeJustPicked(u8 mapId, u8 mapNumber, u8 mapGroup); bool8 IsBerryTreeSparkling(u8 localId, u8 mapNum, u8 mapGroup); diff --git a/src/event_object_movement.c b/src/event_object_movement.c index a181ea9f21..5a746579d4 100644 --- a/src/event_object_movement.c +++ b/src/event_object_movement.c @@ -144,9 +144,9 @@ static u8 FindObjectEventPaletteIndexByTag(u16); static void _PatchObjectPalette(u16, u8); static bool8 ObjectEventDoesElevationMatch(struct ObjectEvent *, u8); static void SpriteCB_CameraObject(struct Sprite *); -static void CameraObject_0(struct Sprite *); -static void CameraObject_1(struct Sprite *); -static void CameraObject_2(struct Sprite *); +static void CameraObject_Init(struct Sprite *); +static void CameraObject_UpdateMove(struct Sprite *); +static void CameraObject_UpdateFrozen(struct Sprite *); static const struct ObjectEventTemplate *FindObjectEventTemplateByLocalId(u8, const struct ObjectEventTemplate *, u8); static void ClearObjectEventMovement(struct ObjectEvent *, struct Sprite *); static void ObjectEventSetSingleMovement(struct ObjectEvent *, struct Sprite *, u8); @@ -193,10 +193,16 @@ static const struct SpriteTemplate sCameraSpriteTemplate = { .callback = SpriteCB_CameraObject }; +enum { + CAMERA_STATE_INIT, + CAMERA_STATE_MOVE, + CAMERA_STATE_FROZEN, +}; + static void (*const sCameraObjectFuncs[])(struct Sprite *) = { - CameraObject_0, - CameraObject_1, - CameraObject_2, + [CAMERA_STATE_INIT] = CameraObject_Init, + [CAMERA_STATE_MOVE] = CameraObject_UpdateMove, + [CAMERA_STATE_FROZEN] = CameraObject_UpdateFrozen, }; #include "data/object_events/object_event_graphics.h" @@ -1836,7 +1842,7 @@ void ObjectEventSetGraphicsId(struct ObjectEvent *objectEvent, u8 graphicsId) sprite->x += 8; sprite->y += 16 + sprite->centerToCornerVecY; if (objectEvent->trackedByCamera) - CameraObjectReset1(); + CameraObjectReset(); } void ObjectEventSetGraphicsIdByLocalIdAndMap(u8 localId, u8 mapNum, u8 mapGroup, u8 graphicsId) @@ -2128,7 +2134,7 @@ void MoveObjectEventToMapCoords(struct ObjectEvent *objectEvent, s16 x, s16 y) sprite->y += 16 + sprite->centerToCornerVecY; ResetObjectEventFldEffData(objectEvent); if (objectEvent->trackedByCamera) - CameraObjectReset1(); + CameraObjectReset(); } void TryMoveObjectEventToMapCoords(u8 localId, u8 mapNum, u8 mapGroup, s16 x, s16 y) @@ -2204,15 +2210,15 @@ void UpdateObjectEventsForCameraUpdate(s16 x, s16 y) RemoveObjectEventsOutsideView(); } -#define sLinkedSpriteId data[0] -#define sState data[1] - -u8 AddCameraObject(u8 linkedSpriteId) +// The "CameraObject" functions below are responsible for an invisible sprite +// that follows the movements of a different sprite (normally the player's sprite) +// and tracks x/y movement distances for the camera so it knows where to move. +u8 AddCameraObject(u8 followSpriteId) { u8 spriteId = CreateSprite(&sCameraSpriteTemplate, 0, 0, 4); gSprites[spriteId].invisible = TRUE; - gSprites[spriteId].sLinkedSpriteId = linkedSpriteId; + gSprites[spriteId].sCamera_FollowSpriteId = followSpriteId; return spriteId; } @@ -2221,35 +2227,37 @@ static void SpriteCB_CameraObject(struct Sprite *sprite) void (*callbacks[ARRAY_COUNT(sCameraObjectFuncs)])(struct Sprite *); memcpy(callbacks, sCameraObjectFuncs, sizeof sCameraObjectFuncs); - callbacks[sprite->sState](sprite); + callbacks[sprite->sCamera_State](sprite); } -static void CameraObject_0(struct Sprite *sprite) +static void CameraObject_Init(struct Sprite *sprite) { - sprite->x = gSprites[sprite->sLinkedSpriteId].x; - sprite->y = gSprites[sprite->sLinkedSpriteId].y; + sprite->x = gSprites[sprite->sCamera_FollowSpriteId].x; + sprite->y = gSprites[sprite->sCamera_FollowSpriteId].y; sprite->invisible = TRUE; - sprite->sState = 1; - CameraObject_1(sprite); + sprite->sCamera_State = CAMERA_STATE_MOVE; + CameraObject_UpdateMove(sprite); } -static void CameraObject_1(struct Sprite *sprite) +static void CameraObject_UpdateMove(struct Sprite *sprite) { - s16 x = gSprites[sprite->sLinkedSpriteId].x; - s16 y = gSprites[sprite->sLinkedSpriteId].y; + s16 x = gSprites[sprite->sCamera_FollowSpriteId].x; + s16 y = gSprites[sprite->sCamera_FollowSpriteId].y; - sprite->data[2] = x - sprite->x; - sprite->data[3] = y - sprite->y; + sprite->sCamera_MoveX = x - sprite->x; + sprite->sCamera_MoveY = y - sprite->y; sprite->x = x; sprite->y = y; } -static void CameraObject_2(struct Sprite *sprite) +// Invisible sprite will continue to follow the parent sprite, +// but no corresponding camera movement will be shown. +static void CameraObject_UpdateFrozen(struct Sprite *sprite) { - sprite->x = gSprites[sprite->sLinkedSpriteId].x; - sprite->y = gSprites[sprite->sLinkedSpriteId].y; - sprite->data[2] = 0; - sprite->data[3] = 0; + sprite->x = gSprites[sprite->sCamera_FollowSpriteId].x; + sprite->y = gSprites[sprite->sCamera_FollowSpriteId].y; + sprite->sCamera_MoveX = 0; + sprite->sCamera_MoveY = 0; } static struct Sprite *FindCameraSprite(void) @@ -2264,51 +2272,43 @@ static struct Sprite *FindCameraSprite(void) return NULL; } -void CameraObjectReset1(void) +void CameraObjectReset(void) { - struct Sprite *camera; - - camera = FindCameraSprite(); + struct Sprite *camera = FindCameraSprite(); if (camera != NULL) { - camera->sState = 0; + camera->sCamera_State = CAMERA_STATE_INIT; camera->callback(camera); } } void CameraObjectSetFollowedSpriteId(u8 spriteId) { - struct Sprite *camera; - - camera = FindCameraSprite(); + struct Sprite *camera = FindCameraSprite(); if (camera != NULL) { - camera->sLinkedSpriteId = spriteId; - CameraObjectReset1(); + camera->sCamera_FollowSpriteId = spriteId; + CameraObjectReset(); } } static u8 UNUSED CameraObjectGetFollowedSpriteId(void) { - struct Sprite *camera; - - camera = FindCameraSprite(); + struct Sprite *camera = FindCameraSprite(); if (camera == NULL) return MAX_SPRITES; - return camera->sLinkedSpriteId; + return camera->sCamera_FollowSpriteId; } -void CameraObjectReset2(void) +void CameraObjectFreeze(void) { - // UB: Possible null dereference -#ifdef UBFIX struct Sprite *camera = FindCameraSprite(); - if (camera) - camera->sState = 2; -#else - FindCameraSprite()->sState = 2; -#endif // UBFIX +#ifdef UBFIX // Possible null dereference + if (camera == NULL) + return; +#endif + camera->sCamera_State = CAMERA_STATE_FROZEN; } u8 CopySprite(struct Sprite *sprite, s16 x, s16 y, u8 subpriority) diff --git a/src/field_camera.c b/src/field_camera.c index 3f7e29208c..31ebc63c05 100644 --- a/src/field_camera.c +++ b/src/field_camera.c @@ -331,8 +331,8 @@ static void CameraUpdateCallback(struct CameraObject *fieldCamera) { if (fieldCamera->spriteId != 0) { - fieldCamera->movementSpeedX = gSprites[fieldCamera->spriteId].data[2]; - fieldCamera->movementSpeedY = gSprites[fieldCamera->spriteId].data[3]; + fieldCamera->movementSpeedX = gSprites[fieldCamera->spriteId].sCamera_MoveX; + fieldCamera->movementSpeedY = gSprites[fieldCamera->spriteId].sCamera_MoveY; } } diff --git a/src/field_effect.c b/src/field_effect.c index 86f1ca97d2..4c82d0f0c4 100644 --- a/src/field_effect.c +++ b/src/field_effect.c @@ -1444,7 +1444,7 @@ static bool8 FallWarpEffect_Init(struct Task *task) struct Sprite *playerSprite; playerObject = &gObjectEvents[gPlayerAvatar.objectEventId]; playerSprite = &gSprites[gPlayerAvatar.spriteId]; - CameraObjectReset2(); + CameraObjectFreeze(); gObjectEvents[gPlayerAvatar.objectEventId].invisible = TRUE; gPlayerAvatar.preventStep = TRUE; ObjectEventSetHeldMovement(playerObject, GetFaceDirectionMovementAction(GetPlayerFacingDirection())); @@ -1540,7 +1540,7 @@ static bool8 FallWarpEffect_End(struct Task *task) { gPlayerAvatar.preventStep = FALSE; UnlockPlayerFieldControls(); - CameraObjectReset1(); + CameraObjectReset(); UnfreezeObjectEvents(); InstallCameraPanAheadCallback(); DestroyTask(FindTaskIdByFunc(Task_FallWarpFieldEffect)); @@ -1579,7 +1579,7 @@ static void Task_EscalatorWarpOut(u8 taskId) static bool8 EscalatorWarpOut_Init(struct Task *task) { FreezeObjectEvents(); - CameraObjectReset2(); + CameraObjectFreeze(); StartEscalator(task->tGoingUp); task->tState++; return FALSE; @@ -1711,7 +1711,7 @@ static bool8 EscalatorWarpIn_Init(struct Task *task) s16 x; s16 y; u8 behavior; - CameraObjectReset2(); + CameraObjectFreeze(); objectEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; ObjectEventSetHeldMovement(objectEvent, GetFaceDirectionMovementAction(DIR_EAST)); PlayerGetDestCoords(&x, &y); @@ -1811,7 +1811,7 @@ static bool8 EscalatorWarpIn_End(struct Task *task) objectEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; if (ObjectEventClearHeldMovementIfFinished(objectEvent)) { - CameraObjectReset1(); + CameraObjectReset(); UnlockPlayerFieldControls(); ObjectEventSetHeldMovement(objectEvent, GetWalkNormalMovementAction(DIR_EAST)); DestroyTask(FindTaskIdByFunc(Task_EscalatorWarpIn)); @@ -1957,7 +1957,7 @@ static void Task_LavaridgeGymB1FWarp(u8 taskId) static bool8 LavaridgeGymB1FWarpEffect_Init(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) { FreezeObjectEvents(); - CameraObjectReset2(); + CameraObjectFreeze(); SetCameraPanningCallback(NULL); gPlayerAvatar.preventStep = TRUE; objectEvent->fixedPriority = 1; @@ -2072,7 +2072,7 @@ static void Task_LavaridgeGymB1FWarpExit(u8 taskId) static bool8 LavaridgeGymB1FWarpExitEffect_Init(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) { - CameraObjectReset2(); + CameraObjectFreeze(); FreezeObjectEvents(); gPlayerAvatar.preventStep = TRUE; objectEvent->invisible = TRUE; @@ -2101,7 +2101,7 @@ static bool8 LavaridgeGymB1FWarpExitEffect_PopOut(struct Task *task, struct Obje { task->data[0]++; objectEvent->invisible = FALSE; - CameraObjectReset1(); + CameraObjectReset(); PlaySE(SE_M_DIG); ObjectEventSetHeldMovement(objectEvent, GetJumpMovementAction(DIR_EAST)); } @@ -2150,7 +2150,7 @@ static void Task_LavaridgeGym1FWarp(u8 taskId) static bool8 LavaridgeGym1FWarpEffect_Init(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite) { FreezeObjectEvents(); - CameraObjectReset2(); + CameraObjectFreeze(); gPlayerAvatar.preventStep = TRUE; objectEvent->fixedPriority = 1; task->data[0]++; @@ -2370,7 +2370,7 @@ static void TeleportWarpOutFieldEffect_Init(struct Task *task) { LockPlayerFieldControls(); FreezeObjectEvents(); - CameraObjectReset2(); + CameraObjectFreeze(); task->data[15] = GetPlayerFacingDirection(); task->tState++; } @@ -2452,7 +2452,7 @@ static void FieldCallback_TeleportWarpIn(void) FreezeObjectEvents(); gFieldCallback = NULL; gObjectEvents[gPlayerAvatar.objectEventId].invisible = TRUE; - CameraObjectReset2(); + CameraObjectFreeze(); CreateTask(Task_TeleportWarpIn, 0); } @@ -2536,7 +2536,7 @@ static void TeleportWarpInFieldEffect_SpinGround(struct Task *task) if ((++task->data[2]) > 4 && task->data[14] == objectEvent->facingDirection) { UnlockPlayerFieldControls(); - CameraObjectReset1(); + CameraObjectReset(); UnfreezeObjectEvents(); DestroyTask(FindTaskIdByFunc(Task_TeleportWarpIn)); } @@ -3268,7 +3268,7 @@ static void FlyOutFieldEffect_FlyOffWithBird(struct Task *task) objectEvent->inanimate = FALSE; objectEvent->hasShadow = FALSE; SetFlyBirdPlayerSpriteId(task->tBirdSpriteId, objectEvent->spriteId); - CameraObjectReset2(); + CameraObjectFreeze(); task->tState++; } } @@ -3483,7 +3483,7 @@ static void FlyInFieldEffect_BirdSwoopDown(struct Task *task) SetSurfBlob_BobState(objectEvent->fieldEffectSpriteId, BOB_NONE); } ObjectEventSetGraphicsId(objectEvent, GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_SURFING)); - CameraObjectReset2(); + CameraObjectFreeze(); ObjectEventTurn(objectEvent, DIR_WEST); StartSpriteAnim(&gSprites[objectEvent->spriteId], ANIM_GET_ON_OFF_POKEMON_WEST); objectEvent->invisible = FALSE; diff --git a/src/field_player_avatar.c b/src/field_player_avatar.c index 5f4573c533..04aa5383bd 100644 --- a/src/field_player_avatar.c +++ b/src/field_player_avatar.c @@ -2093,7 +2093,7 @@ static void Task_DoPlayerSpinExit(u8 taskId) tSpeed = 1; tCurY = (u16)(sprite->y + sprite->y2) << 4; sprite->y2 = 0; - CameraObjectReset2(); + CameraObjectFreeze(); object->fixedPriority = TRUE; sprite->oam.priority = 0; sprite->subpriority = 0; @@ -2162,7 +2162,7 @@ static void Task_DoPlayerSpinEntrance(u8 taskId) tSubpriority = sprite->subpriority; tCurY = -((u16)sprite->y2 + 32) * 16; sprite->y2 = 0; - CameraObjectReset2(); + CameraObjectFreeze(); object->fixedPriority = TRUE; sprite->oam.priority = 1; sprite->subpriority = 0; @@ -2197,7 +2197,7 @@ static void Task_DoPlayerSpinEntrance(u8 taskId) object->fixedPriority = 0; sprite->oam.priority = tPriority; sprite->subpriority = tSubpriority; - CameraObjectReset1(); + CameraObjectReset(); DestroyTask(taskId); } break; From e5ac2a103ee301bbac1db281136b047192287362 Mon Sep 17 00:00:00 2001 From: Icedude907 <34080011+Icedude907@users.noreply.github.com> Date: Fri, 24 Nov 2023 10:13:50 +1300 Subject: [PATCH 05/54] Incorporate review changes --- gflib/malloc.c | 2 +- gflib/malloc.h | 3 +-- ld_script.ld | 8 +++----- ld_script_modern.ld | 17 ++++++----------- sym_ewram.txt | 1 + 5 files changed, 12 insertions(+), 19 deletions(-) diff --git a/gflib/malloc.c b/gflib/malloc.c index 7229c20e8b..f54c751a4c 100644 --- a/gflib/malloc.c +++ b/gflib/malloc.c @@ -4,7 +4,7 @@ static void *sHeapStart; static u32 sHeapSize; -__attribute__((section("__EWRAM_HEAP"))) u8 gHeap[HEAP_SIZE] = {0}; +EWRAM_DATA u8 gHeap[HEAP_SIZE] = {0}; #define MALLOC_SYSTEM_ID 0xA3A3 diff --git a/gflib/malloc.h b/gflib/malloc.h index 2792ff1cb7..72e1a5e1d3 100644 --- a/gflib/malloc.h +++ b/gflib/malloc.h @@ -10,9 +10,8 @@ #define TRY_FREE_AND_SET_NULL(ptr) if (ptr != NULL) FREE_AND_SET_NULL(ptr) -// 122 KB. Max size of the heap without running into other data #define HEAP_SIZE 0x1C000 -extern u8 gHeap[]; +extern u8 gHeap[HEAP_SIZE]; void *Alloc(u32 size); void *AllocZeroed(u32 size); diff --git a/ld_script.ld b/ld_script.ld index ee0556d5a0..c4abf075f8 100644 --- a/ld_script.ld +++ b/ld_script.ld @@ -7,7 +7,7 @@ MEMORY { EWRAM (rwx) : ORIGIN = 0x2000000, LENGTH = 256K IWRAM (rwx) : ORIGIN = 0x3000000, LENGTH = 32K - ROM (rx) : ORIGIN = 0x8000000, LENGTH = 16M + ROM (rx) : ORIGIN = 0x8000000, LENGTH = 32M } /* Modify the following load addresses as needed to make more room. Alternately, delete both the @@ -21,11 +21,9 @@ SECTIONS { ewram 0x2000000 (NOLOAD) : ALIGN(4) { - *(__EWRAM_HEAP); - INCLUDE "sym_ewram.ld" - src/*.o(ewram_data); /**/ - gflib/*.o(ewram_data); /**/ + src/*.o(ewram_data); + gflib/*.o(ewram_data); *libc.a:impure.o(.data); *libc.a:locale.o(.data); diff --git a/ld_script_modern.ld b/ld_script_modern.ld index 05b2b815ff..4ccbfbaa0f 100644 --- a/ld_script_modern.ld +++ b/ld_script_modern.ld @@ -3,12 +3,11 @@ ENTRY(Start) gNumMusicPlayers = 4; gMaxLines = 0; -/* Memory Spaces */ MEMORY { EWRAM (rwx) : ORIGIN = 0x2000000, LENGTH = 256K IWRAM (rwx) : ORIGIN = 0x3000000, LENGTH = 32K - ROM (rx) : ORIGIN = 0x8000000, LENGTH = 16M + ROM (rx) : ORIGIN = 0x8000000, LENGTH = 32M } SECTIONS { @@ -16,10 +15,8 @@ SECTIONS { ewram 0x2000000 (NOLOAD) : ALIGN(4) { - *(__EWRAM_HEAP); - - src/*.o(ewram_data); /**/ - gflib/*.o(ewram_data); /**/ + src/*.o(ewram_data); + gflib/*.o(ewram_data); } > EWRAM iwram 0x3000000 (NOLOAD) : @@ -31,13 +28,11 @@ SECTIONS { *libc.a:*.o(.bss*); *libnosys.a:*.o(.bss*); - /* .bss.code starts at 0x3001AA8 */ src/m4a.o(.bss.code); - /* COMMON starts at 0x30022A8 */ - src/*.o(COMMON); /**/ - gflib/*.o(COMMON); /**/ - *libc.a:*.o(COMMON); + src/*.o(COMMON); + gflib/*.o(COMMON); + *libc.a:*.o(COMMON); *libnosys.a:*.o(COMMON); } > IWRAM diff --git a/sym_ewram.txt b/sym_ewram.txt index 414b7a3b23..31c507ee9b 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -1,3 +1,4 @@ + .include "gflib/malloc.o" .include "src/decompress.o" .include "src/main.o" .include "gflib/window.o" From 05708ace88b4c5cf3e57b4b4aa4bcb6a7a11abe3 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Sat, 2 Dec 2023 12:11:22 -0300 Subject: [PATCH 06/54] Updated the size of the struct InGameTrade's otName variable --- src/trade.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/trade.c b/src/trade.c index 5728a6ee51..ec9486afa1 100644 --- a/src/trade.c +++ b/src/trade.c @@ -157,7 +157,7 @@ struct InGameTrade { u32 personality; u16 heldItem; u8 mailNum; - u8 otName[11]; + u8 otName[TRAINER_NAME_LENGTH + 1]; u8 otGender; u8 sheen; u16 requestedSpecies; From e5ac2fe0b152cb3b51b07ef36d562f1300936802 Mon Sep 17 00:00:00 2001 From: Bassoonian Date: Tue, 12 Dec 2023 19:02:36 +0100 Subject: [PATCH 07/54] Clean up pokemon/ball/dex mentions in comments --- include/battle.h | 6 ++-- include/constants/battle_palace.h | 4 +-- include/constants/field_specials.h | 2 +- include/constants/global.h | 4 +-- include/constants/items.h | 4 +-- include/constants/pokedex.h | 6 ++-- include/constants/pokemon.h | 12 +++---- include/constants/tv.h | 2 +- include/contest.h | 2 +- include/global.h | 4 +-- include/graphics.h | 8 ++--- include/pokemon_summary_screen.h | 2 +- include/strings.h | 6 ++-- src/battle_ai_script_commands.c | 8 ++--- src/battle_ai_switch_items.c | 6 ++-- src/battle_anim_mon_movement.c | 2 +- src/battle_anim_mons.c | 4 +-- src/battle_controller_link_opponent.c | 2 +- src/battle_controller_link_partner.c | 2 +- src/battle_controller_opponent.c | 2 +- src/battle_controller_player.c | 6 ++-- src/battle_controller_player_partner.c | 2 +- src/battle_controller_recorded_opponent.c | 2 +- src/battle_controller_recorded_player.c | 2 +- src/battle_controller_wally.c | 2 +- src/battle_dome.c | 16 ++++----- src/battle_factory.c | 8 ++--- src/battle_factory_screen.c | 34 +++++++++--------- src/battle_gfx_sfx_util.c | 6 ++-- src/battle_message.c | 4 +-- src/battle_pike.c | 2 +- src/battle_script_commands.c | 10 +++--- src/battle_setup.c | 4 +-- src/battle_tent.c | 4 +-- src/battle_tower.c | 36 +++++++++---------- src/battle_transition.c | 2 +- src/battle_tv.c | 2 +- src/battle_util.c | 10 +++--- src/birch_pc.c | 2 +- src/contest.c | 10 +++--- src/credits.c | 22 ++++++------ src/data/bard_music/bard_sounds.h | 4 +-- .../battle_frontier_trainer_mons.h | 2 +- src/data/party_menu.h | 6 ++-- src/data/pokemon/pokedex_orders.h | 2 +- src/daycare.c | 6 ++-- src/field_effect.c | 2 +- src/fldeff_misc.c | 2 +- src/frontier_util.c | 4 +-- src/graphics.c | 8 ++--- src/hall_of_fame.c | 2 +- src/lottery_corner.c | 2 +- src/move_relearner.c | 2 +- src/overworld.c | 6 ++-- src/party_menu.c | 6 ++-- src/pokeball.c | 6 ++-- src/pokedex.c | 8 ++--- src/pokemon.c | 2 +- src/pokemon_storage_system.c | 6 ++-- src/pokemon_summary_screen.c | 12 +++---- src/rom_header_gf.c | 2 +- src/roulette.c | 8 ++--- src/save_location.c | 4 +-- src/script_pokemon_util.c | 2 +- src/sound.c | 4 +-- src/start_menu.c | 2 +- src/starter_choose.c | 12 +++---- src/title_screen.c | 6 ++-- src/trade.c | 30 ++++++++-------- src/trainer_pokemon_sprites.c | 2 +- src/tv.c | 2 +- src/use_pokeblock.c | 12 +++---- src/wild_encounter.c | 8 ++--- 73 files changed, 228 insertions(+), 228 deletions(-) diff --git a/include/battle.h b/include/battle.h index 68beaf219f..6c4d780186 100644 --- a/include/battle.h +++ b/include/battle.h @@ -420,7 +420,7 @@ struct BattleStruct u8 arenaTurnCounter; u8 turnSideTracker; u8 unused_6[3]; - u8 givenExpMons; // Bits for enemy party's pokemon that gave exp to player's party. + u8 givenExpMons; // Bits for enemy party's Pokémon that gave exp to player's party. u8 lastTakenMoveFrom[MAX_BATTLERS_COUNT * MAX_BATTLERS_COUNT * 2]; // a 3-D array [target][attacker][byte] u16 castformPalette[NUM_CASTFORM_FORMS][16]; union { @@ -440,7 +440,7 @@ struct BattleStruct u16 arenaStartHp[2]; u8 arenaLostPlayerMons; // Bits for party member, lost as in referee's decision, not by fainting. u8 arenaLostOpponentMons; - u8 alreadyStatusedMoveAttempt; // As bits for battlers; For example when using Thunder Wave on an already paralyzed pokemon. + u8 alreadyStatusedMoveAttempt; // As bits for battlers; For example when using Thunder Wave on an already paralyzed Pokémon. }; // The palaceFlags member of struct BattleStruct contains 1 flag per move to indicate which moves the AI should consider, @@ -595,7 +595,7 @@ struct BattleSpriteData struct MonSpritesGfx { - void *firstDecompressed; // ptr to the decompressed sprite of the first pokemon + void *firstDecompressed; // ptr to the decompressed sprite of the first Pokémon union { void *ptr[MAX_BATTLERS_COUNT]; u8 *byte[MAX_BATTLERS_COUNT]; diff --git a/include/constants/battle_palace.h b/include/constants/battle_palace.h index 8516550892..1d8c2f2dda 100644 --- a/include/constants/battle_palace.h +++ b/include/constants/battle_palace.h @@ -16,12 +16,12 @@ #define PALACE_DATA_WIN_STREAK 1 #define PALACE_DATA_WIN_STREAK_ACTIVE 2 -// Pokemon in Battle Palace have a move "group" type preference depending on nature +// Pokémon in Battle Palace have a move "group" type preference depending on nature #define PALACE_MOVE_GROUP_ATTACK 0 #define PALACE_MOVE_GROUP_DEFENSE 1 #define PALACE_MOVE_GROUP_SUPPORT 2 -// In palace doubles battles pokemon have a target preference depending on nature +// In palace doubles battles Pokémon have a target preference depending on nature #define PALACE_TARGET_STRONGER 0 #define PALACE_TARGET_WEAKER 1 #define PALACE_TARGET_RANDOM 2 diff --git a/include/constants/field_specials.h b/include/constants/field_specials.h index 6659403313..1e08a47f95 100644 --- a/include/constants/field_specials.h +++ b/include/constants/field_specials.h @@ -62,7 +62,7 @@ #define DEPT_STORE_FLOORNUM_11F 14 #define DEPT_STORE_FLOORNUM_ROOFTOP 15 -// Lilycove Pokemon Trainer Fan Club +// Lilycove Pokémon Trainer Fan Club #define NUM_TRAINER_FAN_CLUB_MEMBERS 8 #define FANCLUB_GOT_FIRST_FANS 7 diff --git a/include/constants/global.h b/include/constants/global.h index 2b70378ff5..b409e80eb1 100644 --- a/include/constants/global.h +++ b/include/constants/global.h @@ -2,9 +2,9 @@ #define GUARD_CONSTANTS_GLOBAL_H // Invalid Versions show as "----------" in Gen 4 and Gen 5's summary screen. // In Gens 6 and 7, invalid versions instead show "a distant land" in the summary screen. -// In Gen 4 only, migrated Pokemon with Diamond, Pearl, or Platinum's ID show as "----------". +// In Gen 4 only, migrated Pokémon with Diamond, Pearl, or Platinum's ID show as "----------". // Gen 5 and up read Diamond, Pearl, or Platinum's ID as "Sinnoh". -// In Gen 4 and up, migrated Pokemon with HeartGold or SoulSilver's ID show the otherwise unused "Johto" string. +// In Gen 4 and up, migrated Pokémon with HeartGold or SoulSilver's ID show the otherwise unused "Johto" string. #define VERSION_SAPPHIRE 1 #define VERSION_RUBY 2 #define VERSION_EMERALD 3 diff --git a/include/constants/items.h b/include/constants/items.h index 63cbfe6b97..ed9bfb5ec8 100644 --- a/include/constants/items.h +++ b/include/constants/items.h @@ -23,7 +23,7 @@ #define FIRST_BALL ITEM_MASTER_BALL #define LAST_BALL ITEM_PREMIER_BALL -// Pokemon Items +// Pokémon Items #define ITEM_POTION 13 #define ITEM_ANTIDOTE 14 #define ITEM_BURN_HEAL 15 @@ -476,7 +476,7 @@ #define ITEM_B_USE_MEDICINE 1 #define ITEM_B_USE_OTHER 2 -// Check if the item is one that can be used on a Pokemon. +// Check if the item is one that can be used on a Pokémon. #define ITEM_HAS_EFFECT(item) ((item) >= ITEM_POTION && (item) <= MAX_BERRY_INDEX) #endif // GUARD_CONSTANTS_ITEMS_H diff --git a/include/constants/pokedex.h b/include/constants/pokedex.h index 7ee1b3760e..c9c51623e5 100644 --- a/include/constants/pokedex.h +++ b/include/constants/pokedex.h @@ -1,7 +1,7 @@ #ifndef GUARD_CONSTANTS_POKEDEX_H #define GUARD_CONSTANTS_POKEDEX_H -// National Pokedex order +// National Pokédex order enum { NATIONAL_DEX_NONE, // Kanto @@ -425,7 +425,7 @@ enum { #define JOHTO_DEX_COUNT NATIONAL_DEX_CELEBI #define NATIONAL_DEX_COUNT NATIONAL_DEX_DEOXYS -// Hoenn Pokedex order +// Hoenn Pokédex order enum { HOENN_DEX_NONE, HOENN_DEX_TREECKO, @@ -631,7 +631,7 @@ enum { HOENN_DEX_JIRACHI, HOENN_DEX_DEOXYS, // End of Hoenn Dex (see HOENN_DEX_COUNT) - // Here below have values but are excluded from the Pokedex + // Here below have values but are excluded from the Pokédex HOENN_DEX_BULBASAUR, HOENN_DEX_IVYSAUR, HOENN_DEX_VENUSAUR, diff --git a/include/constants/pokemon.h b/include/constants/pokemon.h index 6265c027aa..0d6a20e2b9 100644 --- a/include/constants/pokemon.h +++ b/include/constants/pokemon.h @@ -1,7 +1,7 @@ #ifndef GUARD_CONSTANTS_POKEMON_H #define GUARD_CONSTANTS_POKEMON_H -// Pokemon types +// Pokémon types #define TYPE_NONE 255 #define TYPE_NORMAL 0 #define TYPE_FIGHTING 1 @@ -23,7 +23,7 @@ #define TYPE_DARK 17 #define NUMBER_OF_MON_TYPES 18 -// Pokemon egg groups +// Pokémon egg groups #define EGG_GROUP_NONE 0 #define EGG_GROUP_MONSTER 1 #define EGG_GROUP_WATER_1 2 @@ -43,7 +43,7 @@ #define EGG_GROUPS_PER_MON 2 -// Pokemon natures +// Pokémon natures #define NATURE_HARDY 0 #define NATURE_LONELY 1 #define NATURE_BRAVE 2 @@ -71,7 +71,7 @@ #define NATURE_QUIRKY 24 #define NUM_NATURES 25 -// Pokemon Stats +// Pokémon Stats #define STAT_HP 0 #define STAT_ATK 1 #define STAT_DEF 2 @@ -220,7 +220,7 @@ #define GROWTH_FAST 4 #define GROWTH_SLOW 5 -// Body colors for pokedex search +// Body colors for Pokédex search #define BODY_COLOR_RED 0 #define BODY_COLOR_BLUE 1 #define BODY_COLOR_YELLOW 2 @@ -263,7 +263,7 @@ #define MON_PIC_HEIGHT 64 #define MON_PIC_SIZE (MON_PIC_WIDTH * MON_PIC_HEIGHT / 2) -// Most pokemon have 2 frames (a default and an alternate for their animation). +// Most Pokémon have 2 frames (a default and an alternate for their animation). // There are 4 exceptions: // - Castform has 4 frames, 1 for each form // - Deoxys has 2 frames, 1 for each form diff --git a/include/constants/tv.h b/include/constants/tv.h index 13ec88ecdc..1b629fb039 100644 --- a/include/constants/tv.h +++ b/include/constants/tv.h @@ -170,7 +170,7 @@ #define NUM_SECRET_BASE_FLAGS 32 // by definition, bitfield of 2 u16s -// TV Show states for Pokemon Contest Live Updates +// TV Show states for Pokémon Contest Live Updates #define CONTESTLIVE_STATE_INTRO 0 #define CONTESTLIVE_STATE_WON_BOTH_ROUNDS 1 #define CONTESTLIVE_STATE_BETTER_ROUND2 2 diff --git a/include/contest.h b/include/contest.h index d0630a8011..9328188b97 100644 --- a/include/contest.h +++ b/include/contest.h @@ -209,7 +209,7 @@ struct ContestantStatus u8 comboAppealBonus; u8 repeatJam; u8 nextTurnOrder; // turn position - u8 attentionLevel; // How much the Pokemon "stood out" + u8 attentionLevel; // How much the Pokémon "stood out" u8 contestantAnimTarget; }; diff --git a/include/global.h b/include/global.h index e6d58f36e0..1ea3b65d64 100644 --- a/include/global.h +++ b/include/global.h @@ -135,7 +135,7 @@ #define ROUND_BITS_TO_BYTES(numBits) DIV_ROUND_UP(numBits, 8) // NUM_DEX_FLAG_BYTES allocates more flags than it needs to, as NUM_SPECIES includes the "old unown" -// values that don't appear in the Pokedex. NATIONAL_DEX_COUNT does not include these values. +// values that don't appear in the Pokédex. NATIONAL_DEX_COUNT does not include these values. #define NUM_DEX_FLAG_BYTES ROUND_BITS_TO_BYTES(NUM_SPECIES) #define NUM_FLAG_BYTES ROUND_BITS_TO_BYTES(FLAGS_COUNT) #define NUM_TRENDY_SAYING_BYTES ROUND_BITS_TO_BYTES(NUM_TRENDY_SAYINGS) @@ -520,7 +520,7 @@ struct SaveBlock2 /*0x90*/ u8 filler_90[0x8]; /*0x98*/ struct Time localTimeOffset; /*0xA0*/ struct Time lastBerryTreeUpdate; - /*0xA8*/ u32 gcnLinkFlags; // Read by Pokemon Colosseum/XD + /*0xA8*/ u32 gcnLinkFlags; // Read by Pokémon Colosseum/XD /*0xAC*/ u32 encryptionKey; /*0xB0*/ struct PlayersApprentice playerApprentice; /*0xDC*/ struct Apprentice apprentices[APPRENTICE_COUNT]; diff --git a/include/graphics.h b/include/graphics.h index 5b13ab562f..e98b707957 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -32,7 +32,7 @@ extern const u32 gBallGfx_Premier[]; extern const u32 gBallPal_Premier[]; extern const u32 gOpenPokeballGfx[]; -// pokemon gfx +// Pokémon gfx extern const u32 gMonFrontPic_Bulbasaur[]; extern const u32 gMonPalette_Bulbasaur[]; extern const u32 gMonBackPic_Bulbasaur[]; @@ -3282,7 +3282,7 @@ extern const u32 gBattleTerrainPalette_StadiumGlacia[]; extern const u32 gBattleTerrainPalette_StadiumDrake[]; extern const u32 gBattleTerrainPalette_StadiumWallace[]; -// pokedex +// Pokédex extern const u32 gPokedexInterface_Gfx[]; extern const u16 gPokedexBgHoenn_Pal[]; extern const u32 gPokedexMenu_Gfx[]; @@ -4879,11 +4879,11 @@ extern const u16 gSlotMachineReelTimePikachu_Pal[]; extern const u32 gBattleAnimBgTilemap_Sandstorm[]; extern const u32 gBattleAnimBgImage_Sandstorm[]; -// Pokedex Area Screen +// Pokédex Area Screen extern const u32 gPokedexAreaScreenAreaUnknown_Gfx[]; extern const u16 gPokedexAreaScreenAreaUnknown_Pal[]; -// Pokemon Storage System +// Pokémon Storage System extern const u32 gStorageSystemMenu_Gfx[]; extern const u16 gStorageSystemPartyMenu_Pal[]; extern const u32 gStorageSystemPartyMenu_Tilemap[]; diff --git a/include/pokemon_summary_screen.h b/include/pokemon_summary_screen.h index b026baa533..df9e477524 100755 --- a/include/pokemon_summary_screen.h +++ b/include/pokemon_summary_screen.h @@ -14,7 +14,7 @@ void ShowPokemonSummaryScreenHandleDeoxys(u8 mode, struct BoxPokemon *mons, u8 m u8 GetMoveSlotToReplace(void); void SummaryScreen_SetAnimDelayTaskId(u8 taskId); -// The Pokemon Summary Screen can operate in different modes. Certain features, +// The Pokémon Summary Screen can operate in different modes. Certain features, // such as move re-ordering, are available in the different modes. enum PokemonSummaryScreenMode { diff --git a/include/strings.h b/include/strings.h index eeada2b943..914082779b 100644 --- a/include/strings.h +++ b/include/strings.h @@ -519,7 +519,7 @@ extern const u8 gText_Speed[]; extern const u8 gText_Dash[]; extern const u8 gText_Plus[]; -//pokedex text +//Pokédex text extern const u8 gText_CryOf[]; extern const u8 gText_SizeComparedTo[]; extern const u8 gText_PokedexRegistration[]; @@ -1121,7 +1121,7 @@ extern const u8 gTrickHouse_Mechadoll_Six2[]; extern const u8 gTrickHouse_Mechadoll_Seven2[]; extern const u8 gTrickHouse_Mechadoll_Eight2[]; -// Pokedex strings +// Pokédex strings extern const u8 gText_SearchForPkmnBasedOnParameters[]; extern const u8 gText_SwitchPokedexListings[]; extern const u8 gText_ReturnToPokedex[]; @@ -2874,7 +2874,7 @@ extern const u8 gText_WantToPlayAgain[]; extern const u8 gText_CommunicationStandby3[]; extern const u8 gText_SomeoneDroppedOut[]; -// Pokemon jump +// Pokémon jump extern const u8 gText_WantToPlayAgain2[]; extern const u8 gText_SomeoneDroppedOut2[]; extern const u8 gText_CommunicationStandby4[]; diff --git a/src/battle_ai_script_commands.c b/src/battle_ai_script_commands.c index d8a9760ff2..4cb4c51654 100644 --- a/src/battle_ai_script_commands.c +++ b/src/battle_ai_script_commands.c @@ -1392,7 +1392,7 @@ static void Cmd_get_ability(void) } else { - AI_THINKING_STRUCT->funcResult = gSpeciesInfo[gBattleMons[battlerId].species].abilities[1]; // AI can't actually reach this part since no pokemon has ability 2 and no ability 1. + AI_THINKING_STRUCT->funcResult = gSpeciesInfo[gBattleMons[battlerId].species].abilities[1]; // AI can't actually reach this part since no Pokémon has ability 2 and no ability 1. } } else @@ -1445,7 +1445,7 @@ static void Cmd_check_ability(void) } else { - ability = gSpeciesInfo[gBattleMons[battlerId].species].abilities[1]; // AI can't actually reach this part since no pokemon has ability 2 and no ability 1. + ability = gSpeciesInfo[gBattleMons[battlerId].species].abilities[1]; // AI can't actually reach this part since no Pokémon has ability 2 and no ability 1. } } else @@ -1457,9 +1457,9 @@ static void Cmd_check_ability(void) if (ability == 0) AI_THINKING_STRUCT->funcResult = 2; // Unable to answer. else if (ability == gAIScriptPtr[2]) - AI_THINKING_STRUCT->funcResult = 1; // Pokemon has the ability we wanted to check. + AI_THINKING_STRUCT->funcResult = 1; // Pokémon has the ability we wanted to check. else - AI_THINKING_STRUCT->funcResult = 0; // Pokemon doesn't have the ability we wanted to check. + AI_THINKING_STRUCT->funcResult = 0; // Pokémon doesn't have the ability we wanted to check. gAIScriptPtr += 3; } diff --git a/src/battle_ai_switch_items.c b/src/battle_ai_switch_items.c index 06cdd6c82f..5ef15b627a 100644 --- a/src/battle_ai_switch_items.c +++ b/src/battle_ai_switch_items.c @@ -51,7 +51,7 @@ static bool8 ShouldSwitchIfWonderGuard(void) if (gBattleMons[GetBattlerAtPosition(opposingPosition)].ability != ABILITY_WONDER_GUARD) return FALSE; - // Check if Pokemon has a super effective move. + // Check if Pokémon has a super effective move. for (opposingBattler = GetBattlerAtPosition(opposingPosition), i = 0; i < MAX_MON_MOVES; i++) { move = gBattleMons[gActiveBattler].moves[i]; @@ -81,7 +81,7 @@ static bool8 ShouldSwitchIfWonderGuard(void) else party = gEnemyParty; - // Find a Pokemon in the party that has a super effective move. + // Find a Pokémon in the party that has a super effective move. for (i = firstId; i < lastId; i++) { if (GetMonData(&party[i], MON_DATA_HP) == 0) @@ -113,7 +113,7 @@ static bool8 ShouldSwitchIfWonderGuard(void) } } - return FALSE; // There is not a single Pokemon in the party that has a super effective move against a mon with Wonder Guard. + return FALSE; // There is not a single Pokémon in the party that has a super effective move against a mon with Wonder Guard. } static bool8 FindMonThatAbsorbsOpponentsMove(void) diff --git a/src/battle_anim_mon_movement.c b/src/battle_anim_mon_movement.c index 247aba1a42..4c8e79cb9f 100644 --- a/src/battle_anim_mon_movement.c +++ b/src/battle_anim_mon_movement.c @@ -535,7 +535,7 @@ static void SlideMonToOriginalPos_Step(struct Sprite *sprite) } // Linearly translates a mon to a target offset. The horizontal offset -// is mirrored for the opponent's pokemon, and the vertical offset +// is mirrored for the opponent's Pokémon, and the vertical offset // is only mirrored if arg 3 is set to 1. // arg 0: 0 = attacker, 1 = target // arg 1: target x pixel offset diff --git a/src/battle_anim_mons.c b/src/battle_anim_mons.c index 6dd0d20852..d28ec804fe 100644 --- a/src/battle_anim_mons.c +++ b/src/battle_anim_mons.c @@ -77,7 +77,7 @@ static const u8 sCastformBackSpriteYCoords[NUM_CASTFORM_FORMS] = [CASTFORM_ICE] = 0, }; -// Placeholders for pokemon sprites to be created for a move animation effect (e.g. Role Play / Snatch) +// Placeholders for Pokémon sprites to be created for a move animation effect (e.g. Role Play / Snatch) #define TAG_MOVE_EFFECT_MON_1 55125 #define TAG_MOVE_EFFECT_MON_2 55126 @@ -2085,7 +2085,7 @@ u8 GetBattlerSpriteBGPriorityRank(u8 battlerId) return 1; } -// Create pokemon sprite to be used for a move animation effect (e.g. Role Play / Snatch) +// Create Pokémon sprite to be used for a move animation effect (e.g. Role Play / Snatch) u8 CreateAdditionalMonSpriteForMoveAnim(u16 species, bool8 isBackpic, u8 id, s16 x, s16 y, u8 subpriority, u32 personality, u32 trainerId, u32 battlerId, bool32 ignoreDeoxysForm) { u8 spriteId; diff --git a/src/battle_controller_link_opponent.c b/src/battle_controller_link_opponent.c index 2104298775..236db2a428 100644 --- a/src/battle_controller_link_opponent.c +++ b/src/battle_controller_link_opponent.c @@ -529,7 +529,7 @@ static void LinkOpponentBufferExecCompleted(void) static void LinkOpponentHandleGetMonData(void) { - u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two pokemon, trying to get more will result in overwriting data + u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two Pokémon, trying to get more will result in overwriting data u32 size = 0; u8 monToCheck; s32 i; diff --git a/src/battle_controller_link_partner.c b/src/battle_controller_link_partner.c index 054563ad3a..7a437b958c 100644 --- a/src/battle_controller_link_partner.c +++ b/src/battle_controller_link_partner.c @@ -423,7 +423,7 @@ static void CompleteOnFinishedBattleAnimation(void) static void LinkPartnerHandleGetMonData(void) { - u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two pokemon, trying to get more will result in overwriting data + u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two Pokémon, trying to get more will result in overwriting data u32 size = 0; u8 monToCheck; s32 i; diff --git a/src/battle_controller_opponent.c b/src/battle_controller_opponent.c index e434e3ee62..e5284f9abc 100644 --- a/src/battle_controller_opponent.c +++ b/src/battle_controller_opponent.c @@ -534,7 +534,7 @@ static void OpponentBufferExecCompleted(void) static void OpponentHandleGetMonData(void) { - u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two pokemon, trying to get more will result in overwriting data + u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two Pokémon, trying to get more will result in overwriting data u32 size = 0; u8 monToCheck; s32 i; diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index 357912d4b6..8e09d126c9 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -981,12 +981,12 @@ static void Intro_TryShinyAnimShowHealthbox(void) bool32 bgmRestored = FALSE; bool32 battlerAnimsDone = FALSE; - // Start shiny animation if applicable for 1st pokemon + // Start shiny animation if applicable for 1st Pokémon if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive) TryShinyAnimation(gActiveBattler, &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]]); - // Start shiny animation if applicable for 2nd pokemon + // Start shiny animation if applicable for 2nd Pokémon if (!gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].triedShinyMonAnim && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].ballAnimActive) TryShinyAnimation(BATTLE_PARTNER(gActiveBattler), &gPlayerParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]]); @@ -1581,7 +1581,7 @@ static void PrintLinkStandbyMsg(void) static void PlayerHandleGetMonData(void) { - u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two pokemon, trying to get more will result in overwriting data + u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two Pokémon, trying to get more will result in overwriting data u32 size = 0; u8 monToCheck; s32 i; diff --git a/src/battle_controller_player_partner.c b/src/battle_controller_player_partner.c index 236a66ce83..307eeca26a 100644 --- a/src/battle_controller_player_partner.c +++ b/src/battle_controller_player_partner.c @@ -607,7 +607,7 @@ static void CompleteOnFinishedBattleAnimation(void) static void PlayerPartnerHandleGetMonData(void) { - u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two pokemon, trying to get more will result in overwriting data + u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two Pokémon, trying to get more will result in overwriting data u32 size = 0; u8 monToCheck; s32 i; diff --git a/src/battle_controller_recorded_opponent.c b/src/battle_controller_recorded_opponent.c index 9c37cd0a92..7cb5839bc5 100644 --- a/src/battle_controller_recorded_opponent.c +++ b/src/battle_controller_recorded_opponent.c @@ -515,7 +515,7 @@ static void RecordedOpponentBufferExecCompleted(void) static void RecordedOpponentHandleGetMonData(void) { - u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two pokemon, trying to get more will result in overwriting data + u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two Pokémon, trying to get more will result in overwriting data u32 size = 0; u8 monToCheck; s32 i; diff --git a/src/battle_controller_recorded_player.c b/src/battle_controller_recorded_player.c index 591ddb67e3..5a7be7f347 100644 --- a/src/battle_controller_recorded_player.c +++ b/src/battle_controller_recorded_player.c @@ -498,7 +498,7 @@ static void CompleteOnFinishedBattleAnimation(void) static void RecordedPlayerHandleGetMonData(void) { - u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two pokemon, trying to get more will result in overwriting data + u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two Pokémon, trying to get more will result in overwriting data u32 size = 0; u8 monToCheck; s32 i; diff --git a/src/battle_controller_wally.c b/src/battle_controller_wally.c index ce357319a5..67950b8965 100644 --- a/src/battle_controller_wally.c +++ b/src/battle_controller_wally.c @@ -425,7 +425,7 @@ static void UNUSED CompleteOnFinishedStatusAnimation(void) static void WallyHandleGetMonData(void) { - u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two pokemon, trying to get more will result in overwriting data + u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two Pokémon, trying to get more will result in overwriting data u32 size = 0; u8 monToCheck; s32 i; diff --git a/src/battle_dome.c b/src/battle_dome.c index 8364515e59..68cae14a6e 100644 --- a/src/battle_dome.c +++ b/src/battle_dome.c @@ -2588,7 +2588,7 @@ static void CreateDomeOpponentMon(u8 monPartyId, u16 tournamentTrainerId, u8 tou #ifdef BUGFIX u8 fixedIv = GetDomeTrainerMonIvs(DOME_TRAINERS[tournamentTrainerId].trainerId); #else - u8 fixedIv = GetDomeTrainerMonIvs(tournamentTrainerId); // BUG: Using the wrong ID. As a result, all Pokemon have ivs of 3. + u8 fixedIv = GetDomeTrainerMonIvs(tournamentTrainerId); // BUG: Using the wrong ID. As a result, all Pokémon have ivs of 3. #endif u8 level = SetFacilityPtrsGetLevel(); CreateMonWithEVSpreadNatureOTID(&gEnemyParty[monPartyId], @@ -2650,13 +2650,13 @@ static void CreateDomeOpponentMons(u16 tournamentTrainerId) } } -// Returns a bitmask representing which 2 of the trainer's 3 pokemon to select. +// Returns a bitmask representing which 2 of the trainer's 3 Pokémon to select. // The choice is calculated solely depending on the type effectiveness of their -// movesets against the player's pokemon. +// movesets against the player's Pokémon. // There is a 50% chance of either a "good" or "bad" selection mode being used. // In the good mode movesets are preferred which are more effective against the -// player, and in the bad mode the opposite is true. If all 3 pokemon tie, the -// other mode will be tried. If they tie again, the pokemon selection is random. +// player, and in the bad mode the opposite is true. If all 3 Pokémon tie, the +// other mode will be tried. If they tie again, the Pokémon selection is random. int GetDomeTrainerSelectedMons(u16 tournamentTrainerId) { int selectedMonBits; @@ -4837,7 +4837,7 @@ static void DisplayMatchInfoOnCard(u8 flags, u8 matchNo) if (lost[1]) gSprites[sInfoCard->spriteIds[1 + arrId]].oam.paletteNum = 3; - // Draw left trainer's pokemon icons. + // Draw left trainer's Pokémon icons. for (i = 0; i < FRONTIER_PARTY_SIZE; i++) { if (trainerIds[0] == TRAINER_PLAYER) @@ -4877,7 +4877,7 @@ static void DisplayMatchInfoOnCard(u8 flags, u8 matchNo) } } - // Draw right trainer's pokemon icons. + // Draw right trainer's Pokémon icons. for (i = 0; i < FRONTIER_PARTY_SIZE; i++) { if (trainerIds[1] == TRAINER_PLAYER) @@ -5228,7 +5228,7 @@ static u16 GetWinningMove(int winnerTournamentId, int loserTournamentId, u8 roun int movePower = 0; SetFacilityPtrsGetLevel(); - // Calc move points of all 4 moves for all 3 pokemon hitting all 3 target mons. + // Calc move points of all 4 moves for all 3 Pokémon hitting all 3 target mons. for (i = 0; i < FRONTIER_PARTY_SIZE; i++) { for (j = 0; j < MAX_MON_MOVES; j++) diff --git a/src/battle_factory.c b/src/battle_factory.c index 0f4ed9816d..faed16ebb0 100644 --- a/src/battle_factory.c +++ b/src/battle_factory.c @@ -337,7 +337,7 @@ static void GenerateOpponentMons(void) if (gFacilityTrainerMons[monId].species == SPECIES_UNOWN) continue; - // Ensure none of the opponent's pokemon are the same as the potential rental pokemon for the player + // Ensure none of the opponent's Pokémon are the same as the potential rental Pokémon for the player for (j = 0; j < (int)ARRAY_COUNT(gSaveBlock2Ptr->frontier.rentalMons); j++) { if (gFacilityTrainerMons[monId].species == gFacilityTrainerMons[gSaveBlock2Ptr->frontier.rentalMons[j].monId].species) @@ -346,7 +346,7 @@ static void GenerateOpponentMons(void) if (j != (int)ARRAY_COUNT(gSaveBlock2Ptr->frontier.rentalMons)) continue; - // "High tier" pokemon are only allowed on open level mode + // "High tier" Pokémon are only allowed on open level mode if (lvlMode == FRONTIER_LVL_50 && monId > FRONTIER_MONS_HIGH_TIER) continue; @@ -554,7 +554,7 @@ static void GenerateInitialRentalMons(void) i = 0; while (i != PARTY_SIZE) { - if (i < rentalRank) // The more times the player has rented, the more initial rentals are generated from a better set of pokemon + if (i < rentalRank) // The more times the player has rented, the more initial rentals are generated from a better set of Pokémon monId = GetFactoryMonId(factoryLvlMode, challengeNum, TRUE); else monId = GetFactoryMonId(factoryLvlMode, challengeNum, FALSE); @@ -562,7 +562,7 @@ static void GenerateInitialRentalMons(void) if (gFacilityTrainerMons[monId].species == SPECIES_UNOWN) continue; - // Cannot have two pokemon of the same species. + // Cannot have two Pokémon of the same species. for (j = firstMonId; j < firstMonId + i; j++) { u16 existingMonId = monIds[j]; diff --git a/src/battle_factory_screen.c b/src/battle_factory_screen.c index a543e64c93..0533d1e2a3 100644 --- a/src/battle_factory_screen.c +++ b/src/battle_factory_screen.c @@ -32,15 +32,15 @@ #include "constants/songs.h" #include "constants/rgb.h" -// Select_ refers to the first Pokemon selection screen where you choose your initial 3 rental Pokemon. -// Swap_ refers to the subsequent selection screens where you can swap a Pokemon with one from the beaten trainer +// Select_ refers to the first Pokémon selection screen where you choose your initial 3 rental Pokémon. +// Swap_ refers to the subsequent selection screens where you can swap a Pokémon with one from the beaten trainer // Note that, generally, "Action" will refer to the immediate actions that can be taken on each screen, -// i.e. selecting a pokemon or selecting the Cancel button +// i.e. selecting a Pokémon or selecting the Cancel button // The "Options menu" will refer to the popup menu that shows when some actions have been selected -#define SWAP_PLAYER_SCREEN 0 // The screen where the player selects which of their pokemon to swap away -#define SWAP_ENEMY_SCREEN 1 // The screen where the player selects which new pokemon from the defeated party to swap for +#define SWAP_PLAYER_SCREEN 0 // The screen where the player selects which of their Pokémon to swap away +#define SWAP_ENEMY_SCREEN 1 // The screen where the player selects which new Pokémon from the defeated party to swap for #define SELECTABLE_MONS_COUNT 6 @@ -89,7 +89,7 @@ struct FactorySelectableMon { u16 monId; u16 ballSpriteId; - u8 selectedId; // 0 - not selected, 1 - first pokemon, 2 - second pokemon, 3 - third pokemon + u8 selectedId; // 0 - not selected, 1 - first Pokémon, 2 - second Pokémon, 3 - third Pokémon struct Pokemon monData; }; @@ -1060,7 +1060,7 @@ static void SpriteCB_Pokeball(struct Sprite *sprite) { if (sprite->oam.paletteNum == IndexOfSpritePaletteTag(PALTAG_BALL_SELECTED)) { - // Pokeball selected, do rocking animation + // Poké Ball selected, do rocking animation if (sprite->animEnded) { if (sprite->data[0] != 0) @@ -1084,7 +1084,7 @@ static void SpriteCB_Pokeball(struct Sprite *sprite) } else { - // Pokeball not selected, remain still + // Poké Ball not selected, remain still StartSpriteAnimIfDifferent(sprite, 0); } } @@ -1521,7 +1521,7 @@ static void Select_Task_Exit(u8 taskId) } } -// Handles the Yes/No prompt when confirming the 3 selected rental pokemon +// Handles the Yes/No prompt when confirming the 3 selected rental Pokémon static void Select_Task_HandleYesNo(u8 taskId) { if (sFactorySelectScreen->monPicAnimating == TRUE) @@ -1543,14 +1543,14 @@ static void Select_Task_HandleYesNo(u8 taskId) PlaySE(SE_SELECT); if (sFactorySelectScreen->yesNoCursorPos == 0) { - // Selected Yes, confirmed selected pokemon + // Selected Yes, confirmed selected Pokémon Select_HideChosenMons(); gTasks[taskId].tState = 0; gTasks[taskId].func = Select_Task_Exit; } else { - // Selected No, continue choosing pokemon + // Selected No, continue choosing Pokémon Select_ErasePopupMenu(SELECT_WIN_YES_NO); Select_DeclineChosenMons(); sFactorySelectScreen->fadeSpeciesNameActive = TRUE; @@ -1560,7 +1560,7 @@ static void Select_Task_HandleYesNo(u8 taskId) } else if (JOY_NEW(B_BUTTON)) { - // Pressed B, Continue choosing pokemon + // Pressed B, Continue choosing Pokémon PlaySE(SE_SELECT); Select_ErasePopupMenu(SELECT_WIN_YES_NO); Select_DeclineChosenMons(); @@ -1582,7 +1582,7 @@ static void Select_Task_HandleYesNo(u8 taskId) } } -// Handles the popup menu that shows when a pokemon is selected +// Handles the popup menu that shows when a Pokémon is selected static void Select_Task_HandleMenu(u8 taskId) { switch (gTasks[taskId].tState) @@ -2415,7 +2415,7 @@ static void Swap_Task_Exit(u8 taskId) { case 0: // Set return value for script - // TRUE if player kept their current pokemon + // TRUE if player kept their current Pokémon if (sFactorySwapScreen->monSwapped == TRUE) { gTasks[taskId].tState++; @@ -2630,7 +2630,7 @@ static void Swap_Task_HandleMenu(u8 taskId) } } -// Handles input on the two main swap screens (choosing a current pokeon to get rid of, and choosing a new pokemon to receive) +// Handles input on the two main swap screens (choosing a current pokeon to get rid of, and choosing a new Pokémon to receive) static void Swap_Task_HandleChooseMons(u8 taskId) { switch (gTasks[taskId].tState) @@ -2645,7 +2645,7 @@ static void Swap_Task_HandleChooseMons(u8 taskId) case STATE_CHOOSE_MONS_HANDLE_INPUT: if (JOY_NEW(A_BUTTON)) { - // Run whatever action is currently selected (a pokeball, the Cancel button, etc.) + // Run whatever action is currently selected (a Poké Ball, the Cancel button, etc.) PlaySE(SE_SELECT); sFactorySwapScreen->fadeSpeciesNameActive = FALSE; Swap_PrintMonSpeciesAtFade(); @@ -3553,7 +3553,7 @@ static void Swap_HandleActionCursorChange(u8 cursorId) { if (cursorId < FRONTIER_PARTY_SIZE) { - // Cursor is on one of the pokemon + // Cursor is on one of the Pokémon gSprites[sFactorySwapScreen->cursorSpriteId].invisible = FALSE; Swap_HideActionButtonHighlights(); gSprites[sFactorySwapScreen->cursorSpriteId].x = gSprites[sFactorySwapScreen->ballSpriteIds[cursorId]].x; diff --git a/src/battle_gfx_sfx_util.c b/src/battle_gfx_sfx_util.c index d4326860a9..a17ebcb5ab 100644 --- a/src/battle_gfx_sfx_util.c +++ b/src/battle_gfx_sfx_util.c @@ -105,7 +105,7 @@ void FreeBattleSpritesData(void) FREE_AND_SET_NULL(gBattleSpritesDataPtr); } -// Pokemon chooses move to use in Battle Palace rather than player +// Pokémon chooses move to use in Battle Palace rather than player u16 ChooseMoveAndTargetInBattlePalace(void) { s32 i, var1, var2; @@ -165,7 +165,7 @@ u16 ChooseMoveAndTargetInBattlePalace(void) chosenMoveId = BattleAI_ChooseMoveOrAction(); } - // If no moves matched the selected group, pick a new move from groups the pokemon has + // If no moves matched the selected group, pick a new move from groups the Pokémon has // In this case the AI is not checked again, so the choice may be worse // If a move is chosen this way, there's a 50% chance that it will be unable to use it anyway if (chosenMoveId == -1) @@ -357,7 +357,7 @@ static u16 GetBattlePalaceTarget(void) return BATTLE_OPPOSITE(gActiveBattler) << 8; } -// Wait for the pokemon to finish appearing out from the pokeball on send out +// Wait for the Pokémon to finish appearing out from the Poké Ball on send out void SpriteCB_WaitForBattlerBallReleaseAnim(struct Sprite *sprite) { u8 spriteId = sprite->data[1]; diff --git a/src/battle_message.c b/src/battle_message.c index f005404ead..e50fcff3de 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -2152,7 +2152,7 @@ void BufferStringBattle(u16 stringID) } } break; - case STRINGID_USEDMOVE: // pokemon used a move msg + case STRINGID_USEDMOVE: // Pokémon used a move msg ChooseMoveUsedParticle(gBattleTextBuff1); // buff1 doesn't appear in the string, leftover from japanese move names if (gBattleMsgDataPtr->currentMove >= MOVES_COUNT) @@ -2313,7 +2313,7 @@ u32 BattleStringExpandPlaceholders(const u8 *src, u8 *dst) { u32 dstID = 0; // if they used dstID, why not use srcID as well? const u8 *toCpy = NULL; - // This buffer may hold either the name of a trainer, pokemon, or item. + // This buffer may hold either the name of a trainer, Pokémon, or item. u8 text[max(max(max(32, TRAINER_NAME_LENGTH + 1), POKEMON_NAME_LENGTH + 1), ITEM_NAME_LENGTH)]; u8 multiplayerId; s32 i; diff --git a/src/battle_pike.c b/src/battle_pike.c index 7505621201..ba24e58ae7 100644 --- a/src/battle_pike.c +++ b/src/battle_pike.c @@ -1267,7 +1267,7 @@ static void TryHealMons(u8 healCount) for (i = 0; i < FRONTIER_PARTY_SIZE; i++) indices[i] = i; - // Only 'healCount' number of pokemon will be healed. + // Only 'healCount' number of Pokémon will be healed. // The order in which they're (attempted to be) healed is random, // and determined by performing 10 random swaps to this index array. for (k = 0; k < 10; k++) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 2bc8e73f43..49279bdb9c 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -3366,7 +3366,7 @@ static void Cmd_getexp(void) if (IsTradedMon(&gPlayerParty[gBattleStruct->expGetterMonId])) { - // check if the pokemon doesn't belong to the player + // check if the Pokémon doesn't belong to the player if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && gBattleStruct->expGetterMonId >= 3) { i = STRINGID_EMPTYSTRING4; @@ -4448,7 +4448,7 @@ static void Cmd_moveend(void) } gBattleScripting.moveendState++; break; - case MOVEEND_NEXT_TARGET: // For moves hitting two opposing Pokemon. + case MOVEEND_NEXT_TARGET: // For moves hitting two opposing Pokémon. if (!(gHitMarker & HITMARKER_UNABLE_TO_USE_MOVE) && gBattleTypeFlags & BATTLE_TYPE_DOUBLE && !gProtectStructs[gBattlerAttacker].chargingTurn && gBattleMoves[gCurrentMove].target == MOVE_TARGET_BOTH && !(gHitMarker & HITMARKER_NO_ATTACKSTRING)) @@ -7270,7 +7270,7 @@ static void Cmd_forcerandomswitch(void) lastMonId = PARTY_SIZE; monsCount = PARTY_SIZE; minNeeded = 1; - battler2PartyId = gBattlerPartyIndexes[gBattlerTarget]; // there is only one pokemon out in single battles + battler2PartyId = gBattlerPartyIndexes[gBattlerTarget]; // there is only one Pokémon out in single battles battler1PartyId = gBattlerPartyIndexes[gBattlerTarget]; } @@ -7761,7 +7761,7 @@ static void Cmd_setsubstitute(void) } else { - gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 4; // one bit value will only work for pokemon which max hp can go to 1020(which is more than possible in games) + gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 4; // one bit value will only work for Pokémon which max hp can go to 1020(which is more than possible in games) if (gBattleMoveDamage == 0) gBattleMoveDamage = 1; @@ -9142,7 +9142,7 @@ static void Cmd_tryswapitems(void) { gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1); } - // can't swap if two pokemon don't have an item + // can't swap if two Pokémon don't have an item // or if either of them is an enigma berry or a mail else if ((gBattleMons[gBattlerAttacker].item == ITEM_NONE && gBattleMons[gBattlerTarget].item == ITEM_NONE) || gBattleMons[gBattlerAttacker].item == ITEM_ENIGMA_BERRY diff --git a/src/battle_setup.c b/src/battle_setup.c index a9cfc48ffb..e87ce6dd27 100644 --- a/src/battle_setup.c +++ b/src/battle_setup.c @@ -108,7 +108,7 @@ EWRAM_DATA static u8 *sTrainerBBattleScriptRetAddr = NULL; EWRAM_DATA static bool8 sShouldCheckTrainerBScript = FALSE; EWRAM_DATA static u8 sNoOfPossibleTrainerRetScripts = 0; -// The first transition is used if the enemy pokemon are lower level than our pokemon. +// The first transition is used if the enemy Pokémon are lower level than our Pokémon. // Otherwise, the second transition is used. static const u8 sBattleTransitionTable_Wild[][2] = { @@ -845,7 +845,7 @@ static u8 GetTrainerBattleTransition(void) return B_TRANSITION_AQUA; if (gTrainers[gTrainerBattleOpponent_A].doubleBattle == TRUE) - minPartyCount = 2; // double battles always at least have 2 pokemon. + minPartyCount = 2; // double battles always at least have 2 Pokémon. else minPartyCount = 1; diff --git a/src/battle_tent.c b/src/battle_tent.c index b7a9daecba..c003affebe 100644 --- a/src/battle_tent.c +++ b/src/battle_tent.c @@ -309,7 +309,7 @@ static void GenerateInitialRentalMons(void) i = 0; while (i != PARTY_SIZE) { - // Cannot have two pokemon of the same species. + // Cannot have two Pokémon of the same species. monSetId = Random() % NUM_SLATEPORT_TENT_MONS; for (j = firstMonId; j < firstMonId + i; j++) { @@ -390,7 +390,7 @@ static void GenerateOpponentMons(void) { sRandMonId = monSet[Random() % numMons]; - // Ensure none of the opponent's pokemon are the same as the potential rental pokemon for the player + // Ensure none of the opponent's Pokémon are the same as the potential rental Pokémon for the player for (j = 0; j < (int)ARRAY_COUNT(gSaveBlock2Ptr->frontier.rentalMons); j++) { if (gFacilityTrainerMons[sRandMonId].species == gFacilityTrainerMons[gSaveBlock2Ptr->frontier.rentalMons[j].monId].species) diff --git a/src/battle_tower.c b/src/battle_tower.c index 15509a7dcf..ec6019afb0 100644 --- a/src/battle_tower.c +++ b/src/battle_tower.c @@ -1680,8 +1680,8 @@ static void FillTrainerParty(u16 trainerId, u8 firstMonId, u8 monCount) } // Regular battle frontier trainer. - // Attempt to fill the trainer's party with random Pokemon until 3 have been - // successfully chosen. The trainer's party may not have duplicate pokemon species + // Attempt to fill the trainer's party with random Pokémon until 3 have been + // successfully chosen. The trainer's party may not have duplicate Pokémon species // or duplicate held items. for (bfMonCount = 0; monSet[bfMonCount] != 0xFFFF; bfMonCount++) ; @@ -1691,12 +1691,12 @@ static void FillTrainerParty(u16 trainerId, u8 firstMonId, u8 monCount) { u16 monId = monSet[Random() % bfMonCount]; - // "High tier" pokemon are only allowed on open level mode + // "High tier" Pokémon are only allowed on open level mode // 20 is not a possible value for level here if ((level == FRONTIER_MAX_LEVEL_50 || level == 20) && monId > FRONTIER_MONS_HIGH_TIER) continue; - // Ensure this pokemon species isn't a duplicate. + // Ensure this Pokémon species isn't a duplicate. for (j = 0; j < i + firstMonId; j++) { if (GetMonData(&gEnemyParty[j], MON_DATA_SPECIES, NULL) == gFacilityTrainerMons[monId].species) @@ -1715,7 +1715,7 @@ static void FillTrainerParty(u16 trainerId, u8 firstMonId, u8 monCount) if (j != i + firstMonId) continue; - // Ensure this exact pokemon index isn't a duplicate. This check doesn't seem necessary + // Ensure this exact Pokémon index isn't a duplicate. This check doesn't seem necessary // because the species and held items were already checked directly above. for (j = 0; j < i; j++) { @@ -1727,7 +1727,7 @@ static void FillTrainerParty(u16 trainerId, u8 firstMonId, u8 monCount) chosenMonIndices[i] = monId; - // Place the chosen pokemon into the trainer's party. + // Place the chosen Pokémon into the trainer's party. CreateMonWithEVSpreadNatureOTID(&gEnemyParty[i + firstMonId], gFacilityTrainerMons[monId].species, level, @@ -1737,7 +1737,7 @@ static void FillTrainerParty(u16 trainerId, u8 firstMonId, u8 monCount) otID); friendship = MAX_FRIENDSHIP; - // Give the chosen pokemon its specified moves. + // Give the chosen Pokémon its specified moves. for (j = 0; j < MAX_MON_MOVES; j++) { SetMonMoveSlot(&gEnemyParty[i + firstMonId], gFacilityTrainerMons[monId].moves[j], j); @@ -1748,7 +1748,7 @@ static void FillTrainerParty(u16 trainerId, u8 firstMonId, u8 monCount) SetMonData(&gEnemyParty[i + firstMonId], MON_DATA_FRIENDSHIP, &friendship); SetMonData(&gEnemyParty[i + firstMonId], MON_DATA_HELD_ITEM, &gBattleFrontierHeldItems[gFacilityTrainerMons[monId].itemTableId]); - // The pokemon was successfully added to the trainer's party, so it's safe to move on to + // The Pokémon was successfully added to the trainer's party, so it's safe to move on to // the next party slot. i++; } @@ -1804,7 +1804,7 @@ u16 GetRandomFrontierMonFromSet(u16 trainerId) do { - // "High tier" pokemon are only allowed on open level mode + // "High tier" Pokémon are only allowed on open level mode // 20 is not a possible value for level here monId = monSet[Random() % numMons]; } while((level == FRONTIER_MAX_LEVEL_50 || level == 20) && monId > FRONTIER_MONS_HIGH_TIER); @@ -2454,8 +2454,8 @@ static void GetPotentialPartnerMoveAndSpecies(u16 trainerId, u16 monId) // These partners can be an NPC or a former/record-mixed Apprentice // When talked to, their response consists of: // PARTNER_MSGID_INTRO - A greeting -// PARTNER_MSGID_MON1 - Naming one pokemon on their team, and a move it has -// PARTNER_MSGID_MON2_ASK - Naming a second pokemon on their team, a move it has, and asking if they'd like to be their partner +// PARTNER_MSGID_MON1 - Naming one Pokémon on their team, and a move it has +// PARTNER_MSGID_MON2_ASK - Naming a second Pokémon on their team, a move it has, and asking if they'd like to be their partner // PARTNER_MSGID_ACCEPT - If the player agrees to be their partner // PARTNER_MSGID_REJECT - If the player declines to be their partner static void ShowPartnerCandidateMessage(void) @@ -2773,7 +2773,7 @@ static void AwardBattleTowerRibbons(void) #ifdef BUGFIX struct RibbonCounter ribbons[MAX_FRONTIER_PARTY_SIZE]; #else - struct RibbonCounter ribbons[3]; // BUG: 4 Pokemon can receive ribbons in a double battle mode. + struct RibbonCounter ribbons[3]; // BUG: 4 Pokémon can receive ribbons in a double battle mode. #endif u8 ribbonType = 0; u8 lvlMode = gSaveBlock2Ptr->frontier.lvlMode; @@ -2982,7 +2982,7 @@ static void FillPartnerParty(u16 trainerId) #ifdef BUGFIX j, #else - i, // BUG: personality was stored in the 'j' variable. As a result, Steven's pokemon do not have the intended natures. + i, // BUG: personality was stored in the 'j' variable. As a result, Steven's Pokémon do not have the intended natures. #endif OT_ID_PRESET, STEVEN_OTID); for (j = 0; j < PARTY_SIZE; j++) @@ -3409,7 +3409,7 @@ static void FillTentTrainerParty_(u16 trainerId, u8 firstMonId, u8 monCount) { u16 monId = monSet[Random() % bfMonCount]; - // Ensure this pokemon species isn't a duplicate. + // Ensure this Pokémon species isn't a duplicate. for (j = 0; j < i + firstMonId; j++) { if (GetMonData(&gEnemyParty[j], MON_DATA_SPECIES, NULL) == gFacilityTrainerMons[monId].species) @@ -3428,7 +3428,7 @@ static void FillTentTrainerParty_(u16 trainerId, u8 firstMonId, u8 monCount) if (j != i + firstMonId) continue; - // Ensure this exact pokemon index isn't a duplicate. This check doesn't seem necessary + // Ensure this exact Pokémon index isn't a duplicate. This check doesn't seem necessary // because the species and held items were already checked directly above. for (j = 0; j < i; j++) { @@ -3440,7 +3440,7 @@ static void FillTentTrainerParty_(u16 trainerId, u8 firstMonId, u8 monCount) chosenMonIndices[i] = monId; - // Place the chosen pokemon into the trainer's party. + // Place the chosen Pokémon into the trainer's party. CreateMonWithEVSpreadNatureOTID(&gEnemyParty[i + firstMonId], gFacilityTrainerMons[monId].species, level, @@ -3450,7 +3450,7 @@ static void FillTentTrainerParty_(u16 trainerId, u8 firstMonId, u8 monCount) otID); friendship = MAX_FRIENDSHIP; - // Give the chosen pokemon its specified moves. + // Give the chosen Pokémon its specified moves. for (j = 0; j < MAX_MON_MOVES; j++) { SetMonMoveSlot(&gEnemyParty[i + firstMonId], gFacilityTrainerMons[monId].moves[j], j); @@ -3461,7 +3461,7 @@ static void FillTentTrainerParty_(u16 trainerId, u8 firstMonId, u8 monCount) SetMonData(&gEnemyParty[i + firstMonId], MON_DATA_FRIENDSHIP, &friendship); SetMonData(&gEnemyParty[i + firstMonId], MON_DATA_HELD_ITEM, &gBattleFrontierHeldItems[gFacilityTrainerMons[monId].itemTableId]); - // The pokemon was successfully added to the trainer's party, so it's safe to move on to + // The Pokémon was successfully added to the trainer's party, so it's safe to move on to // the next party slot. i++; } diff --git a/src/battle_transition.c b/src/battle_transition.c index 11f9cddf4b..1c5b38faf8 100644 --- a/src/battle_transition.c +++ b/src/battle_transition.c @@ -1315,7 +1315,7 @@ static void HBlankCB_Shuffle(void) #undef tAmplitude //------------------------------------------------------------------------ -// B_TRANSITION_BIG_POKEBALL, B_TRANSITION_AQUA, B_TRANSITION_MAGMA, +// B_TRANSITION_BIG_Poké Ball, B_TRANSITION_AQUA, B_TRANSITION_MAGMA, // B_TRANSITION_REGICE, B_TRANSITION_REGISTEEL, B_TRANSITION_REGIROCK // and B_TRANSITION_KYOGRE. // diff --git a/src/battle_tv.c b/src/battle_tv.c index b9008b47a7..e9f518f605 100644 --- a/src/battle_tv.c +++ b/src/battle_tv.c @@ -526,7 +526,7 @@ static const u16 *const sPointsArray[] = }; // Points will always be calculated for these messages -// even if current pokemon does not have corresponding move +// even if current Pokémon does not have corresponding move static const u16 sSpecialBattleStrings[] = { STRINGID_PKMNPERISHCOUNTFELL, STRINGID_PKMNWISHCAMETRUE, STRINGID_PKMNLOSTPPGRUDGE, diff --git a/src/battle_util.c b/src/battle_util.c index 735d1ba810..d79c61b382 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -1545,7 +1545,7 @@ u8 DoBattlerEndTurnEffects(void) if ((gBattleMons[gActiveBattler].status2 & STATUS2_NIGHTMARE) && gBattleMons[gActiveBattler].hp != 0) { // R/S does not perform this sleep check, which causes the nightmare effect to - // persist even after the affected Pokemon has been awakened by Shed Skin. + // persist even after the affected Pokémon has been awakened by Shed Skin. if (gBattleMons[gActiveBattler].status1 & STATUS1_SLEEP) { gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / 4; @@ -1625,7 +1625,7 @@ u8 DoBattlerEndTurnEffects(void) } if (gBattlerAttacker != gBattlersCount) { - effect = 2; // a pokemon was awaken + effect = 2; // a Pokémon was awaken break; } else @@ -1685,7 +1685,7 @@ u8 DoBattlerEndTurnEffects(void) if (gDisableStructs[gActiveBattler].disabledMove == gBattleMons[gActiveBattler].moves[i]) break; } - if (i == MAX_MON_MOVES) // pokemon does not have the disabled move anymore + if (i == MAX_MON_MOVES) // Pokémon does not have the disabled move anymore { gDisableStructs[gActiveBattler].disabledMove = MOVE_NONE; gDisableStructs[gActiveBattler].disableTimer = 0; @@ -1702,7 +1702,7 @@ u8 DoBattlerEndTurnEffects(void) case ENDTURN_ENCORE: // encore if (gDisableStructs[gActiveBattler].encoreTimer != 0) { - if (gBattleMons[gActiveBattler].moves[gDisableStructs[gActiveBattler].encoredMovePos] != gDisableStructs[gActiveBattler].encoredMove) // pokemon does not have the encored move anymore + if (gBattleMons[gActiveBattler].moves[gDisableStructs[gActiveBattler].encoredMovePos] != gDisableStructs[gActiveBattler].encoredMove) // Pokémon does not have the encored move anymore { gDisableStructs[gActiveBattler].encoredMove = MOVE_NONE; gDisableStructs[gActiveBattler].encoreTimer = 0; @@ -3003,7 +3003,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA if (gBattleMons[i].ability == ABILITY_TRACE && (gStatuses3[i] & STATUS3_TRACE)) { u8 target2; - side = BATTLE_OPPOSITE(GetBattlerPosition(i)) & BIT_SIDE; // side of the opposing pokemon + side = BATTLE_OPPOSITE(GetBattlerPosition(i)) & BIT_SIDE; // side of the opposing Pokémon target1 = GetBattlerAtPosition(side); target2 = GetBattlerAtPosition(side + BIT_FLANK); if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) diff --git a/src/birch_pc.c b/src/birch_pc.c index 1f0ab23498..8256a1378b 100644 --- a/src/birch_pc.c +++ b/src/birch_pc.c @@ -20,7 +20,7 @@ bool16 ScriptGetPokedexInfo(void) return IsNationalPokedexEnabled(); } -// This shows your Hoenn Pokedex rating and not your National Dex. +// This shows your Hoenn Pokédex rating and not your National Dex. const u8 *GetPokedexRatingText(u16 count) { if (count < 10) diff --git a/src/contest.c b/src/contest.c index e183c2bd74..8f0ad7fbfe 100644 --- a/src/contest.c +++ b/src/contest.c @@ -194,7 +194,7 @@ static void SwapMoveDescAndContestTilemaps(void); #define CONTESTANT_TEXT_COLOR_START 10 enum { -// The "{Pokemon Name} / {Trainer Name}" windows. +// The "{Pokémon Name} / {Trainer Name}" windows. WIN_CONTESTANT0_NAME, WIN_CONTESTANT1_NAME, WIN_CONTESTANT2_NAME, @@ -3434,11 +3434,11 @@ static void RankContestants(void) // For each contestant, find the best rank with their point total. // Normally, each point total is different, and this will output the - // rankings as expected. However, if two pokemon are tied, then they + // rankings as expected. However, if two Pokémon are tied, then they // both get the best rank for that point total. // // For example if the point totals are [100, 80, 80, 50], the ranks will - // be [1, 2, 2, 4]. The pokemon with a point total of 80 stop looking + // be [1, 2, 2, 4]. The Pokémon with a point total of 80 stop looking // when they see the first 80 in the array, so they both share the '2' // rank. for (i = 0; i < CONTESTANT_COUNT; i++) @@ -4590,10 +4590,10 @@ void MakeContestantNervous(u8 p) // ContestantStatus::nextTurnOrder field of each contestant. The remaining // turns are assigned such that the turn order will reverse. // -// For example, if no pokemon have a defined nextTurnOrder, then the 4th +// For example, if no Pokémon have a defined nextTurnOrder, then the 4th // will become 1st, the 3rd will become 2nd, etc. // -// Note: This function assumes that multiple pokemon cannot have the same +// Note: This function assumes that multiple Pokémon cannot have the same // nextTurnOrder value. static void ApplyNextTurnOrder(void) { diff --git a/src/credits.c b/src/credits.c index 69a4ebbbf3..c433baf1d1 100644 --- a/src/credits.c +++ b/src/credits.c @@ -63,12 +63,12 @@ enum { struct CreditsData { - u16 monToShow[NUM_MON_SLIDES]; // List of Pokemon species ids that will show during the credits + u16 monToShow[NUM_MON_SLIDES]; // List of Pokémon species ids that will show during the credits u16 imgCounter; //how many mon images have been shown u16 nextImgPos; //if the next image spawns left/center/right u16 currShownMon; //index into monToShow - u16 numMonToShow; //number of pokemon to show, always NUM_MON_SLIDES after determine function - u16 caughtMonIds[NATIONAL_DEX_COUNT]; //temporary location to hold a condensed array of all caught pokemon + u16 numMonToShow; //number of Pokémon to show, always NUM_MON_SLIDES after determine function + u16 caughtMonIds[NATIONAL_DEX_COUNT]; //temporary location to hold a condensed array of all caught Pokémon u16 numCaughtMon; //count of filled spaces in caughtMonIds u16 unused[7]; }; @@ -1555,8 +1555,8 @@ static void DeterminePokemonToShow(void) u16 dexNum; u16 j; - // Go through the Pokedex, and anything that has gotten caught we put into our massive array. - // This basically packs all of the caught pokemon into the front of the array + // Go through the Pokédex, and anything that has gotten caught we put into our massive array. + // This basically packs all of the caught Pokémon into the front of the array for (dexNum = 1, j = 0; dexNum < NATIONAL_DEX_COUNT; dexNum++) { if (GetSetPokedexFlag(dexNum, FLAG_GET_CAUGHT)) @@ -1570,14 +1570,14 @@ static void DeterminePokemonToShow(void) for (dexNum = j; dexNum < NATIONAL_DEX_COUNT; dexNum++) sCreditsData->caughtMonIds[dexNum] = NATIONAL_DEX_NONE; - // Cap the number of pokemon we care about to NUM_MON_SLIDES, the max we show in the credits scene (-1 for the starter) + // Cap the number of Pokémon we care about to NUM_MON_SLIDES, the max we show in the credits scene (-1 for the starter) sCreditsData->numCaughtMon = j; if (sCreditsData->numCaughtMon < NUM_MON_SLIDES) sCreditsData->numMonToShow = j; else sCreditsData->numMonToShow = NUM_MON_SLIDES; - // Loop through our list of caught pokemon and select randomly from it to fill the images to show + // Loop through our list of caught Pokémon and select randomly from it to fill the images to show j = 0; do { @@ -1598,7 +1598,7 @@ static void DeterminePokemonToShow(void) } while (sCreditsData->numCaughtMon != 0 && j < NUM_MON_SLIDES); - // If we don't have enough pokemon in the dex to fill everything, copy the selected mon into the end of the array, so it loops + // If we don't have enough Pokémon in the dex to fill everything, copy the selected mon into the end of the array, so it loops if (sCreditsData->numMonToShow < NUM_MON_SLIDES) { for (j = sCreditsData->numMonToShow, page = 0; j < NUM_MON_SLIDES; j++) @@ -1609,7 +1609,7 @@ static void DeterminePokemonToShow(void) if (page == sCreditsData->numMonToShow) page = 0; } - // Ensure the last pokemon is our starter + // Ensure the last Pokémon is our starter sCreditsData->monToShow[NUM_MON_SLIDES - 1] = starter; } else @@ -1617,7 +1617,7 @@ static void DeterminePokemonToShow(void) // Check to see if our starter has already appeared in this list, break if it has for (dexNum = 0; sCreditsData->monToShow[dexNum] != starter && dexNum < NUM_MON_SLIDES; dexNum++); - // If it has, swap it with the last pokemon, to ensure our starter is the last image + // If it has, swap it with the last Pokémon, to ensure our starter is the last image if (dexNum < sCreditsData->numMonToShow - 1) { sCreditsData->monToShow[dexNum] = sCreditsData->monToShow[NUM_MON_SLIDES-1]; @@ -1625,7 +1625,7 @@ static void DeterminePokemonToShow(void) } else { - // Ensure the last pokemon is our starter + // Ensure the last Pokémon is our starter sCreditsData->monToShow[NUM_MON_SLIDES - 1] = starter; } } diff --git a/src/data/bard_music/bard_sounds.h b/src/data/bard_music/bard_sounds.h index 291d22872a..bc6f88ba57 100644 --- a/src/data/bard_music/bard_sounds.h +++ b/src/data/bard_music/bard_sounds.h @@ -25,7 +25,7 @@ #include "trendysaying.h" const struct BardSound (*const gBardSoundsTable[EC_NUM_GROUPS])[6] = { - [EC_GROUP_POKEMON] = NULL, // Handled by gBardSounds_Pokemon + [EC_GROUP_POKEMON] = NULL, // Handled by gBardSounds_Pokémon [EC_GROUP_TRAINER] = gBardSounds_Trainer, [EC_GROUP_STATUS] = gBardSounds_Status, [EC_GROUP_BATTLE] = gBardSounds_Battle, @@ -46,7 +46,7 @@ const struct BardSound (*const gBardSoundsTable[EC_NUM_GROUPS])[6] = { [EC_GROUP_MOVE_1] = NULL, // Handled by gBardSounds_Moves [EC_GROUP_MOVE_2] = NULL, // Handled by gBardSounds_Moves [EC_GROUP_TRENDY_SAYING] = gBardSounds_TrendySaying, - [EC_GROUP_POKEMON_NATIONAL] = NULL // Handled by gBardSounds_Pokemon + [EC_GROUP_POKEMON_NATIONAL] = NULL // Handled by gBardSounds_Pokémon }; #endif //GUARD_BARD_SOUNDS_TABLE_H diff --git a/src/data/battle_frontier/battle_frontier_trainer_mons.h b/src/data/battle_frontier/battle_frontier_trainer_mons.h index 625a602658..f0a203d56d 100644 --- a/src/data/battle_frontier/battle_frontier_trainer_mons.h +++ b/src/data/battle_frontier/battle_frontier_trainer_mons.h @@ -4172,7 +4172,7 @@ FRONTIER_MON_##lastmon##_10,\ -1 -// The strong Psychic M/F trainers all use the below pokemon +// The strong Psychic M/F trainers all use the below Pokémon // Additionally they use 1 of 3 legendary trios, and Latios or Latias depending on gender #define FRONTIER_MONS_PSYCHIC_2(lati, legend1, legend2, legend3) \ FRONTIER_MON_WOBBUFFET_1, \ diff --git a/src/data/party_menu.h b/src/data/party_menu.h index 90faab0777..04e073df17 100644 --- a/src/data/party_menu.h +++ b/src/data/party_menu.h @@ -64,7 +64,7 @@ static const struct PartyMenuBoxInfoRects sPartyBoxInfoRects[] = // Each layout array has an array for each of the 6 party slots // The array for each slot has the sprite coords of its various sprites in the following order -// Pokemon icon (x, y), held item (x, y), status condition (x, y), menu pokeball (x, y) +// Pokémon icon (x, y), held item (x, y), status condition (x, y), menu Poké Ball (x, y) static const u8 sPartyMenuSpriteCoords[PARTY_LAYOUT_COUNT][PARTY_SIZE][4 * 2] = { [PARTY_LAYOUT_SINGLE] = @@ -902,7 +902,7 @@ static const struct CompressedSpritePalette sSpritePalette_MenuPokeball = gPartyMenuPokeball_Pal, TAG_POKEBALL }; -// Used for the pokeball sprite on each party slot / Cancel button +// Used for the Poké Ball sprite on each party slot / Cancel button static const struct SpriteTemplate sSpriteTemplate_MenuPokeball = { .tileTag = TAG_POKEBALL, @@ -983,7 +983,7 @@ static const struct CompressedSpriteSheet sSpriteSheet_MenuPokeballSmall = gPartyMenuPokeballSmall_Gfx, 0x0300, TAG_POKEBALL_SMALL }; -// Used for the pokeball sprite next to Cancel and Confirm when both are present, otherwise sSpriteTemplate_MenuPokeball is used +// Used for the pokeball sprite next to Cancel and Confirm when both are present, otherwise sSpriteTemplate_MenuPoké Ball is used static const struct SpriteTemplate sSpriteTemplate_MenuPokeballSmall = { .tileTag = TAG_POKEBALL_SMALL, diff --git a/src/data/pokemon/pokedex_orders.h b/src/data/pokemon/pokedex_orders.h index 55b0abcea8..aa09948ec0 100644 --- a/src/data/pokemon/pokedex_orders.h +++ b/src/data/pokemon/pokedex_orders.h @@ -25,7 +25,7 @@ const u16 gPokedexOrder_Alphabetical[] = NATIONAL_DEX_OLD_UNOWN_X, NATIONAL_DEX_OLD_UNOWN_Y, NATIONAL_DEX_OLD_UNOWN_Z, - // Actual pokemon start here. + // Actual Pokémon start here. NATIONAL_DEX_ABRA, NATIONAL_DEX_ABSOL, NATIONAL_DEX_AERODACTYL, diff --git a/src/daycare.c b/src/daycare.c index d62bd589d0..5ebe255b39 100644 --- a/src/daycare.c +++ b/src/daycare.c @@ -193,10 +193,10 @@ void StoreSelectedPokemonInDaycare(void) StorePokemonInEmptyDaycareSlot(&gPlayerParty[monId], &gSaveBlock1Ptr->daycare); } -// Shifts the second daycare pokemon slot into the first slot. +// Shifts the second daycare Pokémon slot into the first slot. static void ShiftDaycareSlots(struct DayCare *daycare) { - // This condition is only satisfied when the player takes out the first pokemon from the daycare. + // This condition is only satisfied when the player takes out the first Pokémon from the daycare. if (GetBoxMonData(&daycare->mons[1].mon, MON_DATA_SPECIES) != SPECIES_NONE && GetBoxMonData(&daycare->mons[0].mon, MON_DATA_SPECIES) == SPECIES_NONE) { @@ -596,7 +596,7 @@ static void InheritIVs(struct Pokemon *egg, struct DayCare *daycare) } } -// Counts the number of egg moves a pokemon learns and stores the moves in +// Counts the number of egg moves a Pokémon learns and stores the moves in // the given array. static u8 GetEggMoves(struct Pokemon *pokemon, u16 *eggMoves) { diff --git a/src/field_effect.c b/src/field_effect.c index 86f1ca97d2..a906492d13 100644 --- a/src/field_effect.c +++ b/src/field_effect.c @@ -254,7 +254,7 @@ static const u32 sHofMonitorBig_Gfx[] = INCBIN_U32("graphics/field_effects/pics/ static const u8 sHofMonitorSmall_Gfx[] = INCBIN_U8("graphics/field_effects/pics/hof_monitor_small.4bpp"); static const u16 sHofMonitor_Pal[16] = INCBIN_U16("graphics/field_effects/palettes/hof_monitor.gbapal"); -// Graphics for the lights streaking past your Pokemon when it uses a field move. +// Graphics for the lights streaking past your Pokémon when it uses a field move. static const u32 sFieldMoveStreaksOutdoors_Gfx[] = INCBIN_U32("graphics/field_effects/pics/field_move_streaks.4bpp"); static const u16 sFieldMoveStreaksOutdoors_Pal[16] = INCBIN_U16("graphics/field_effects/pics/field_move_streaks.gbapal"); static const u16 sFieldMoveStreaksOutdoors_Tilemap[320] = INCBIN_U16("graphics/field_effects/pics/field_move_streaks.bin"); diff --git a/src/fldeff_misc.c b/src/fldeff_misc.c index c01e88b512..513cd13e76 100644 --- a/src/fldeff_misc.c +++ b/src/fldeff_misc.c @@ -308,7 +308,7 @@ static const struct SpriteTemplate sSpriteTemplate_RecordMixLights = .callback = SpriteCallbackDummy, }; -// For accessing pokemon storage PC or the Hall of Fame PC +// For accessing Pokémon storage PC or the Hall of Fame PC void ComputerScreenOpenEffect(u16 increment, u16 unused, u8 priority) { CreateComputerScreenEffectTask(Task_ComputerScreenOpenEffect, increment, unused, priority); diff --git a/src/frontier_util.c b/src/frontier_util.c index 08b0e68d2e..1858792b4e 100644 --- a/src/frontier_util.c +++ b/src/frontier_util.c @@ -326,7 +326,7 @@ static const struct FrontierBrainMon sFrontierBrainsMons[][2][FRONTIER_PARTY_SIZ }, [FRONTIER_FACILITY_FACTORY] = { - // Because Factory's pokemon are random, this facility's Brain also uses random pokemon. + // Because Factory's Pokémon are random, this facility's Brain also uses random Pokémon. // What is interesting, this team is actually the one Steven uses in the multi tag battle alongside the player. { { @@ -2006,7 +2006,7 @@ static void AppendIfValid(u16 species, u16 heldItem, u16 hp, u8 lvlMode, u8 monL // gSpecialVar_Result is the level mode before and after calls to this function // gSpecialVar_0x8004 is used to store the return value instead (TRUE if there are insufficient eligible mons) -// The names of ineligible pokemon that have been caught are also buffered to print +// The names of ineligible Pokémon that have been caught are also buffered to print static void CheckPartyIneligibility(void) { u16 speciesArray[PARTY_SIZE]; diff --git a/src/graphics.c b/src/graphics.c index 17ea237df2..39b6c8e680 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -362,7 +362,7 @@ const u8 gHealthboxElementsGfxTable[] = INCBIN_U8("graphics/battle_interface/hpb "graphics/battle_interface/misc_frameend.4bpp", "graphics/battle_interface/ball_display.4bpp", "graphics/battle_interface/ball_caught_indicator.4bpp", - "graphics/battle_interface/status2.4bpp", // these three duplicate sets of graphics are for the opponent/partner pokemon + "graphics/battle_interface/status2.4bpp", // these three duplicate sets of graphics are for the opponent/partner Pokémon "graphics/battle_interface/status3.4bpp", "graphics/battle_interface/status4.4bpp", "graphics/battle_interface/healthbox_doubles_frameend.4bpp", @@ -953,7 +953,7 @@ const u32 gDomeTourneyLineUp_Tilemap[] = INCBIN_U32("graphics/battle_frontier/to const u32 gDomeTourneyInfoCard_Gfx[] = INCBIN_U32("graphics/battle_frontier/tourney_info_card.4bpp.lz"); const u32 gDomeTourneyInfoCard_Tilemap[] = INCBIN_U32("graphics/battle_frontier/tourney_info_card_tilemap.bin.lz"); const u32 gDomeTourneyInfoCardBg_Tilemap[] = INCBIN_U32("graphics/battle_frontier/tourney_info_card_bg.bin.lz"); -const u32 gDomeTourneyTreeButtons_Gfx[] = INCBIN_U32("graphics/battle_frontier/tourney_buttons.4bpp.lz"); // exit/cancel and pokeball buttons +const u32 gDomeTourneyTreeButtons_Gfx[] = INCBIN_U32("graphics/battle_frontier/tourney_buttons.4bpp.lz"); // exit/cancel and Poké Ball buttons const u32 gDomeTourneyTree_Pal[] = INCBIN_U32("graphics/battle_frontier/tourney_tree.gbapal.lz"); const u32 gDomeTourneyTreeButtons_Pal[] = INCBIN_U32("graphics/battle_frontier/tourney_buttons.gbapal.lz"); const u32 gDomeTourneyMatchCardBg_Pal[] = INCBIN_U32("graphics/battle_frontier/tourney_match_card_bg.gbapal.lz"); @@ -1228,7 +1228,7 @@ const u16 gFrontierPassMapCursor_Pal[] = INCBIN_U16("graphics/frontier_pass/map_ const u16 gFrontierPassMedalsSilver_Pal[] = INCBIN_U16("graphics/frontier_pass/silver.gbapal"); const u16 gFrontierPassMedalsGold_Pal[] = INCBIN_U16("graphics/frontier_pass/gold.gbapal"); -// Pokedex +// Pokédex const u16 gPokedexBgHoenn_Pal[] = INCBIN_U16("graphics/pokedex/bg_hoenn.gbapal"); const u16 gPokedexCaughtScreen_Pal[] = INCBIN_U16("graphics/pokedex/caught_screen.gbapal"); const u16 gPokedexSearchResults_Pal[] = INCBIN_U16("graphics/pokedex/search_results_bg.gbapal"); @@ -1383,7 +1383,7 @@ const u32 gKantoTrainerCardFront_Tilemap[] = INCBIN_U32("graphics/trainer_card/f const u32 gKantoTrainerCardBack_Tilemap[] = INCBIN_U32("graphics/trainer_card/frlg/back.bin.lz"); const u32 gKantoTrainerCardFrontLink_Tilemap[] = INCBIN_U32("graphics/trainer_card/frlg/front_link.bin.lz"); -// pokemon storage system +// Pokémon storage system const u32 gStorageSystemMenu_Gfx[] = INCBIN_U32("graphics/pokemon_storage/menu.4bpp.lz"); const u16 gStorageSystemPartyMenu_Pal[] = INCBIN_U16("graphics/pokemon_storage/party_menu.gbapal"); diff --git a/src/hall_of_fame.c b/src/hall_of_fame.c index 63c7c30c26..91850ec72e 100644 --- a/src/hall_of_fame.c +++ b/src/hall_of_fame.c @@ -621,7 +621,7 @@ static void Task_Hof_TryDisplayAnotherMon(u8 taskId) else { sHofFadePalettes |= (0x10000 << gSprites[gTasks[taskId].tMonSpriteId(currPokeID)].oam.paletteNum); - if (gTasks[taskId].tDisplayedMonId < PARTY_SIZE - 1 && currMon[1].species != SPECIES_NONE) // there is another pokemon to display + if (gTasks[taskId].tDisplayedMonId < PARTY_SIZE - 1 && currMon[1].species != SPECIES_NONE) // there is another Pokémon to display { gTasks[taskId].tDisplayedMonId++; BeginNormalPaletteFade(sHofFadePalettes, 0, 12, 12, RGB(16, 29, 24)); diff --git a/src/lottery_corner.c b/src/lottery_corner.c index f19e9f7b7b..052e2cfc38 100644 --- a/src/lottery_corner.c +++ b/src/lottery_corner.c @@ -75,7 +75,7 @@ void PickLotteryCornerTicket(void) } } } - else // pokemon are always arranged from populated spots first to unpopulated, so the moment a NONE species is found, that's the end of the list. + else // Pokémon are always arranged from populated spots first to unpopulated, so the moment a NONE species is found, that's the end of the list. break; } diff --git a/src/move_relearner.c b/src/move_relearner.c index af4593e533..975663e4d3 100644 --- a/src/move_relearner.c +++ b/src/move_relearner.c @@ -369,7 +369,7 @@ static void VBlankCB_MoveRelearner(void) TransferPlttBuffer(); } -// Script arguments: The pokemon to teach is in VAR_0x8004 +// Script arguments: The Pokémon to teach is in VAR_0x8004 void TeachMoveRelearnerMove(void) { LockPlayerFieldControls(); diff --git a/src/overworld.c b/src/overworld.c index e9245ce0a0..2e01a2e52f 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -1297,7 +1297,7 @@ void UpdateAmbientCry(s16 *state, u16 *delayCounter) } } // Ambient cries after the first one take between 1200-2399 frames (~20-40 seconds) - // If the player has a pokemon with the ability Swarm in their party, the time is halved to 600-1199 frames (~10-20 seconds) + // If the player has a Pokémon with the ability Swarm in their party, the time is halved to 600-1199 frames (~10-20 seconds) *delayCounter = ((Random() % 1200) + 1200) / divBy; *state = AMB_CRY_WAIT; break; @@ -1309,7 +1309,7 @@ void UpdateAmbientCry(s16 *state, u16 *delayCounter) } break; case AMB_CRY_IDLE: - // No land/water pokemon on this map + // No land/water Pokémon on this map break; } } @@ -1320,7 +1320,7 @@ static void ChooseAmbientCrySpecies(void) && gSaveBlock1Ptr->location.mapNum == MAP_NUM(ROUTE130)) && !IsMirageIslandPresent()) { - // Only play water pokemon cries on this route + // Only play water Pokémon cries on this route // when Mirage Island is not present sIsAmbientCryWaterMon = TRUE; sAmbientCrySpecies = GetLocalWaterMon(); diff --git a/src/party_menu.c b/src/party_menu.c index 9b076755c8..2abceb50ae 100755 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -169,7 +169,7 @@ enum { }; enum { - // Window ids 0-5 are implicitly assigned to each party pokemon in InitPartyMenuBoxes + // Window ids 0-5 are implicitly assigned to each party Pokémon in InitPartyMenuBoxes WIN_MSG = PARTY_SIZE, }; @@ -3512,7 +3512,7 @@ static void CursorCb_SendMon(u8 taskId) } else { - // gStringVar4 below is the error message buffered by TrySwitchInPokemon + // gStringVar4 below is the error message buffered by TrySwitchInPokémon PartyMenuRemoveWindow(&sPartyMenuInternal->windowId[1]); DisplayPartyMenuMessage(gStringVar4, TRUE); gTasks[taskId].func = Task_ReturnToChooseMonAfterText; @@ -5801,7 +5801,7 @@ static bool8 TrySwitchInPokemon(void) u8 newSlot; u8 i; - // In a multi battle, slots 1, 4, and 5 are the partner's pokemon + // In a multi battle, slots 1, 4, and 5 are the partner's Pokémon if (IsMultiBattle() == TRUE && (slot == 1 || slot == 4 || slot == 5)) { StringCopy(gStringVar1, GetTrainerPartnerName()); diff --git a/src/pokeball.c b/src/pokeball.c index bdc2b70369..445f048924 100644 --- a/src/pokeball.c +++ b/src/pokeball.c @@ -1014,10 +1014,10 @@ static u8 LaunchBallFadeMonTaskForPokeball(bool8 unFadeLater, u8 spritePalNum, u return LaunchBallFadeMonTask(unFadeLater, spritePalNum, selectedPalettes, BALL_POKE); } -// Sprite data for the pokemon +// Sprite data for the Pokémon #define sSpecies data[7] -// Sprite data for the pokeball +// Sprite data for the Poké Ball #define sMonSpriteId data[0] #define sDelay data[1] #define sMonPalNum data[2] @@ -1027,7 +1027,7 @@ static u8 LaunchBallFadeMonTaskForPokeball(bool8 unFadeLater, u8 spritePalNum, u #define sFinalMonY data[6] #define sTrigIdx data[7] -// Pokeball in Birch intro, and when receiving via trade +// Poké Ball in Birch intro, and when receiving via trade void CreatePokeballSpriteToReleaseMon(u8 monSpriteId, u8 monPalNum, u8 x, u8 y, u8 oamPriority, u8 subpriority, u8 delay, u32 fadePalettes, u16 species) { u8 spriteId; diff --git a/src/pokedex.c b/src/pokedex.c index bd824aa567..d5db9987dd 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -1758,7 +1758,7 @@ static void Task_HandlePokedexStartMenuInput(u8 taskId) CreateMonSpritesAtPos(sPokedexView->selectedPokemon, 0xE); gMain.newKeys |= START_BUTTON; //Exit menu break; - case 3: //CLOSE POKEDEX + case 3: //CLOSE Pokédex BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); gTasks[taskId].func = Task_ClosePokedex; PlaySE(SE_PC_OFF); @@ -1958,12 +1958,12 @@ static void Task_HandleSearchResultsStartMenuInput(u8 taskId) CreateMonSpritesAtPos(sPokedexView->selectedPokemon, 0xE); gMain.newKeys |= START_BUTTON; break; - case 3: //BACK TO POKEDEX + case 3: //BACK TO Pokédex BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); gTasks[taskId].func = Task_ReturnToPokedexFromSearchResults; PlaySE(SE_TRUCK_DOOR); break; - case 4: //CLOSE POKEDEX + case 4: //CLOSE Pokédex BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); gTasks[taskId].func = Task_ClosePokedexFromSearchResultsStartMenu; PlaySE(SE_PC_OFF); @@ -2049,7 +2049,7 @@ static void Task_ClosePokedexFromSearchResultsStartMenu(u8 taskId) #undef tLoadScreenTaskId -// For loading main pokedex page or pokedex search results +// For loading main pokedex page or Pokédex search results static bool8 LoadPokedexListPage(u8 page) { switch (gMain.state) diff --git a/src/pokemon.c b/src/pokemon.c index 6ee052fda5..51a512445e 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -98,7 +98,7 @@ static const struct CombinedMove sCombinedMoves[2] = }; // NOTE: The order of the elements in the 3 arrays below is irrelevant. -// To reorder the pokedex, see the values in include/constants/pokedex.h. +// To reorder the pokedex, see the values in include/constants/Pokédex.h. #define SPECIES_TO_HOENN(name) [SPECIES_##name - 1] = HOENN_DEX_##name #define SPECIES_TO_NATIONAL(name) [SPECIES_##name - 1] = NATIONAL_DEX_##name diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index 574e6ba51e..92afe8a4bb 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -199,7 +199,7 @@ enum { CURSOR_AREA_IN_BOX, CURSOR_AREA_IN_PARTY, CURSOR_AREA_BOX_TITLE, - CURSOR_AREA_BUTTONS, // Party Pokemon and Close Box + CURSOR_AREA_BUTTONS, // Party Pokémon and Close Box }; #define CURSOR_AREA_IN_HAND CURSOR_AREA_BOX_TITLE // Alt name for cursor area used by Move Items @@ -6687,8 +6687,8 @@ static void LoadSavedMovingMon(void) { if (sIsMonBeingMoved) { - // If it came from the party load a struct Pokemon, - // otherwise load a BoxPokemon + // If it came from the party load a struct Pokémon, + // otherwise load a BoxPokémon if (sMovingMonOrigBoxId == TOTAL_BOXES_COUNT) sStorage->movingMon = sSavedMovingMon; else diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 4545411124..642b176d6b 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -88,13 +88,13 @@ enum { #define PSS_LABEL_WINDOW_PORTRAIT_SPECIES 19 // The lower name #define PSS_LABEL_WINDOW_END 20 -// Dynamic fields for the Pokemon Info page +// Dynamic fields for the Pokémon Info page #define PSS_DATA_WINDOW_INFO_ORIGINAL_TRAINER 0 #define PSS_DATA_WINDOW_INFO_ID 1 #define PSS_DATA_WINDOW_INFO_ABILITY 2 #define PSS_DATA_WINDOW_INFO_MEMO 3 -// Dynamic fields for the Pokemon Skills page +// Dynamic fields for the Pokémon Skills page #define PSS_DATA_WINDOW_SKILLS_HELD_ITEM 0 #define PSS_DATA_WINDOW_SKILLS_RIBBON_COUNT 1 #define PSS_DATA_WINDOW_SKILLS_STATS_LEFT 2 // HP, Attack, Defense @@ -174,7 +174,7 @@ static EWRAM_DATA struct PokemonSummaryScreenData u8 currPageIndex; u8 minPageIndex; u8 maxPageIndex; - bool8 lockMonFlag; // This is used to prevent the player from changing pokemon in the move deleter select, etc, but it is not needed because the input is handled differently there + bool8 lockMonFlag; // This is used to prevent the player from changing Pokémon in the move deleter select, etc, but it is not needed because the input is handled differently there u16 newMove; u8 firstMoveIndex; u8 secondMoveIndex; @@ -184,7 +184,7 @@ static EWRAM_DATA struct PokemonSummaryScreenData u8 windowIds[8]; u8 spriteIds[SPRITE_ARR_ID_COUNT]; bool8 handleDeoxys; - s16 switchCounter; // Used for various switch statement cases that decompress/load graphics or pokemon data + s16 switchCounter; // Used for various switch statement cases that decompress/load graphics or Pokémon data u8 unk_filler4[6]; } *sMonSummaryScreen = NULL; EWRAM_DATA u8 gLastViewedMonIndex = 0; @@ -2682,7 +2682,7 @@ static void DrawContestMoveHearts(u16 move) } } -static void LimitEggSummaryPageDisplay(void) // If the pokemon is an egg, limit the number of pages displayed to 1 +static void LimitEggSummaryPageDisplay(void) // If the Pokémon is an egg, limit the number of pages displayed to 1 { if (sMonSummaryScreen->summary.isEgg) ChangeBgX(3, 0x10000, BG_COORD_SET); @@ -3999,7 +3999,7 @@ static bool32 UNUSED IsMonAnimationFinished(void) return TRUE; } -static void StopPokemonAnimations(void) // A subtle effect, this function stops pokemon animations when leaving the PSS +static void StopPokemonAnimations(void) // A subtle effect, this function stops Pokémon animations when leaving the PSS { u16 i; u16 paletteIndex; diff --git a/src/rom_header_gf.c b/src/rom_header_gf.c index 36ff3401d3..d5f7d7eefc 100644 --- a/src/rom_header_gf.c +++ b/src/rom_header_gf.c @@ -8,7 +8,7 @@ // The purpose of this struct is for outside applications to be // able to access parts of the ROM or its save file, like a public API. -// In vanilla, it was used by Colosseum and XD to access pokemon graphics. +// In vanilla, it was used by Colosseum and XD to access Pokémon graphics. // // If this struct is rearranged in any way, it defeats the purpose of // having it at all. Applications like PKHex or streaming HUDs may find diff --git a/src/roulette.c b/src/roulette.c index 44dac2db6c..ec4c8cfcfe 100644 --- a/src/roulette.c +++ b/src/roulette.c @@ -990,8 +990,8 @@ static const struct RouletteFlashSettings sFlashData_Colors[NUM_ROULETTE_SLOTS + }, }; -// Data to flash any pokemon icon (F_FLASH_ICON) on the roulette wheel. One entry for each color row -// Each poke icon flashes with the tint of the row color it belongs to, so the pokemon itself is irrelevant +// Data to flash any Pokémon icon (F_FLASH_ICON) on the roulette wheel. One entry for each color row +// Each poke icon flashes with the tint of the row color it belongs to, so the Pokémon itself is irrelevant static const struct RouletteFlashSettings sFlashData_PokeIcons[NUM_BOARD_COLORS] = { [GET_ROW_IDX(ROW_ORANGE)] = { @@ -2702,7 +2702,7 @@ static const struct SpriteTemplate sSpriteTemplates_GridIcons[NUM_BOARD_POKES] = } }; -// Wheel icons are listed clockwise starting from 1 oclock on the roulette wheel (with pokeball upside right) +// Wheel icons are listed clockwise starting from 1 oclock on the roulette wheel (with Poké Ball upside right) // They go Wynaut -> Azurill -> Skitty -> Makuhita, and Orange -> Green -> Purple static const struct SpriteTemplate sSpriteTemplates_WheelIcons[NUM_ROULETTE_SLOTS] = { @@ -4481,7 +4481,7 @@ static void SetBallStuck(struct Sprite *sprite) // The below slot ids are relative to the slot the ball got stuck on if ((sRoulette->useTaillow + 1) & sRoulette->partySpeciesFlags) { - // If the player has the corresponding pokemon in their party (HAS_SHROOMISH or HAS_TAILLOW), + // If the player has the corresponding Pokémon in their party (HAS_SHROOMISH or HAS_TAILLOW), // there's a 75% chance that the ball will be moved to a spot they bet on // assuming it was one of the slots identified as a candidate if (betSlotId && (rand % 256) < 192) diff --git a/src/save_location.c b/src/save_location.c index 74d2f2c44d..3384200598 100644 --- a/src/save_location.c +++ b/src/save_location.c @@ -119,9 +119,9 @@ void TrySetMapSaveWarpStatus(void) TrySetUnknownWarpStatus(); } -// In FRLG, only bits 0, 4, and 5 are set when the pokedex is received. +// In FRLG, only bits 0, 4, and 5 are set when the Pokédex is received. // Bits 1, 2, 3, and 15 are instead set by SetPostgameFlags. -// These flags are read by Pokemon Colosseum/XD for linking. XD Additionally requires FLAG_SYS_GAME_CLEAR +// These flags are read by Pokémon Colosseum/XD for linking. XD Additionally requires FLAG_SYS_GAME_CLEAR void SetUnlockedPokedexFlags(void) { gSaveBlock2Ptr->gcnLinkFlags |= (1 << 15); diff --git a/src/script_pokemon_util.c b/src/script_pokemon_util.c index 6e5653884b..ed28d47c5a 100755 --- a/src/script_pokemon_util.c +++ b/src/script_pokemon_util.c @@ -213,7 +213,7 @@ void ReducePlayerPartyToSelectedMons(void) CpuFill32(0, party, sizeof party); - // copy the selected pokemon according to the order. + // copy the selected Pokémon according to the order. for (i = 0; i < MAX_FRONTIER_PARTY_SIZE; i++) if (gSelectedOrderFromParty[i]) // as long as the order keeps going (did the player select 1 mon? 2? 3?), do not stop party[i] = gPlayerParty[gSelectedOrderFromParty[i] - 1]; // index is 0 based, not literal diff --git a/src/sound.c b/src/sound.c index bef3658ecd..8685383f78 100644 --- a/src/sound.c +++ b/src/sound.c @@ -463,9 +463,9 @@ void PlayCryInternal(u16 species, s8 pan, s8 volume, u8 priority, u8 mode) SetPokemonCryChorus(chorus); SetPokemonCryPriority(priority); - // This is a fancy way to get a cry of a pokemon. + // This is a fancy way to get a cry of a Pokémon. // It creates 4 sets of 128 mini cry tables. - // If you wish to expand pokemon, you need to + // If you wish to expand Pokémon, you need to // append new cases to the switch. species = SpeciesToCryId(species); index = species % 128; diff --git a/src/start_menu.c b/src/start_menu.c index 2faff8c63d..0c8fe01f0e 100644 --- a/src/start_menu.c +++ b/src/start_menu.c @@ -1374,7 +1374,7 @@ static void ShowSaveInfoWindow(void) if (FlagGet(FLAG_SYS_POKEDEX_GET) == TRUE) { - // Print pokedex count + // Print Pokédex count yOffset += 16; AddTextPrinterParameterized(sSaveInfoWindowId, FONT_NORMAL, gText_SavingPokedex, 0, yOffset, TEXT_SKIP_DRAW, NULL); BufferSaveMenuText(SAVE_MENU_CAUGHT, gStringVar4, color); diff --git a/src/starter_choose.c b/src/starter_choose.c index 3d5291e887..ef0b9388bf 100644 --- a/src/starter_choose.c +++ b/src/starter_choose.c @@ -26,7 +26,7 @@ #define STARTER_MON_COUNT 3 -// Position of the sprite of the selected starter Pokemon +// Position of the sprite of the selected starter Pokémon #define STARTER_PKMN_POS_X (DISPLAY_WIDTH / 2) #define STARTER_PKMN_POS_Y 64 @@ -367,7 +367,7 @@ static void VblankCB_StarterChoose(void) #define tPkmnSpriteId data[1] #define tCircleSpriteId data[2] -// Data for sSpriteTemplate_Pokeball +// Data for sSpriteTemplate_Poké Ball #define sTaskId data[0] #define sBallId data[1] @@ -446,7 +446,7 @@ void CB2_ChooseStarter(void) spriteId = CreateSprite(&sSpriteTemplate_Hand, 120, 56, 2); gSprites[spriteId].data[0] = taskId; - // Create three Pokeball sprites + // Create three Poké Ball sprites spriteId = CreateSprite(&sSpriteTemplate_Pokeball, sPokeballCoords[0][0], sPokeballCoords[0][1], 2); gSprites[spriteId].sTaskId = taskId; gSprites[spriteId].sBallId = 0; @@ -495,7 +495,7 @@ static void Task_HandleStarterChooseInput(u8 taskId) spriteId = CreateSprite(&sSpriteTemplate_StarterCircle, sPokeballCoords[selection][0], sPokeballCoords[selection][1], 1); gTasks[taskId].tCircleSpriteId = spriteId; - // Create Pokemon sprite + // Create Pokémon sprite spriteId = CreatePokemonFrontSprite(GetStarterPokemon(gTasks[taskId].tStarterSelection), sPokeballCoords[selection][0], sPokeballCoords[selection][1]); gSprites[spriteId].affineAnims = &sAffineAnims_StarterPokemon; gSprites[spriteId].callback = SpriteCB_StarterPokemon; @@ -637,7 +637,7 @@ static u8 CreatePokemonFrontSprite(u16 species, u8 x, u8 y) static void SpriteCB_SelectionHand(struct Sprite *sprite) { - // Float up and down above selected pokeball + // Float up and down above selected Poké Ball sprite->x = sCursorCoords[gTasks[sprite->data[0]].tStarterSelection][0]; sprite->y = sCursorCoords[gTasks[sprite->data[0]].tStarterSelection][1]; sprite->y2 = Sin(sprite->data[1], 8); @@ -646,7 +646,7 @@ static void SpriteCB_SelectionHand(struct Sprite *sprite) static void SpriteCB_Pokeball(struct Sprite *sprite) { - // Animate pokeball if currently selected + // Animate Poké Ball if currently selected if (gTasks[sprite->sTaskId].tStarterSelection == sprite->sBallId) StartSpriteAnimIfDifferent(sprite, 1); else diff --git a/src/title_screen.c b/src/title_screen.c index 12015b8bd8..1d605d1fc0 100644 --- a/src/title_screen.c +++ b/src/title_screen.c @@ -680,7 +680,7 @@ static void MainCB2(void) UpdatePaletteFade(); } -// Shine the Pokemon logo two more times, and fade in the version banner +// Shine the Pokémon logo two more times, and fade in the version banner static void Task_TitleScreenPhase1(u8 taskId) { // Skip to next phase when A, B, Start, or Select is pressed @@ -728,7 +728,7 @@ static void Task_TitleScreenPhase1(u8 taskId) #undef sParentTaskId #undef sAlphaBlendIdx -// Create "Press Start" and copyright banners, and slide Pokemon logo up +// Create "Press Start" and copyright banners, and slide Pokémon logo up static void Task_TitleScreenPhase2(u8 taskId) { u32 yPos; @@ -767,7 +767,7 @@ static void Task_TitleScreenPhase2(u8 taskId) if (!(gTasks[taskId].tCounter & 1) && gTasks[taskId].tBg2Y != 0) gTasks[taskId].tBg2Y++; - // Slide Pokemon logo up + // Slide Pokémon logo up yPos = gTasks[taskId].tBg2Y * 256; SetGpuReg(REG_OFFSET_BG2Y_L, yPos); SetGpuReg(REG_OFFSET_BG2Y_H, yPos / 0x10000); diff --git a/src/trade.c b/src/trade.c index ec9486afa1..e07e418d1a 100644 --- a/src/trade.c +++ b/src/trade.c @@ -168,7 +168,7 @@ static EWRAM_DATA u8 *sMenuTextTileBuffer = NULL; // Bytes 0-2 are used for the player's name text // Bytes 3-5 are used for the partner's name text // Bytes 6-7 are used for the Cancel text -// Bytes 8-13 are used for the Choose a Pokemon text +// Bytes 8-13 are used for the Choose a Pokémon text // See the corresponding GFXTAGs in src/data/trade.h static EWRAM_DATA u8 *sMenuTextTileBuffers[NUM_MENU_TEXT_SPRITES] = {NULL}; @@ -1010,25 +1010,25 @@ static void SetActiveMenuOptions(void) { if (i < sTradeMenu->partyCounts[TRADE_PLAYER]) { - // Present player pokemon + // Present player Pokémon gSprites[sTradeMenu->partySpriteIds[TRADE_PLAYER][i]].invisible = FALSE; sTradeMenu->optionsActive[i] = TRUE; } else { - // Absent player pokemon + // Absent player Pokémon sTradeMenu->optionsActive[i] = FALSE; } if (i < sTradeMenu->partyCounts[TRADE_PARTNER]) { - // Present partner pokemon + // Present partner Pokémon gSprites[sTradeMenu->partySpriteIds[TRADE_PARTNER][i]].invisible = FALSE; sTradeMenu->optionsActive[i + PARTY_SIZE] = TRUE; } else { - // Absent partner pokemon + // Absent partner Pokémon sTradeMenu->optionsActive[i + PARTY_SIZE] = FALSE; } } @@ -1285,7 +1285,7 @@ static void Leader_HandleCommunication(void) if (sTradeMenu->playerSelectStatus == STATUS_READY && sTradeMenu->partnerSelectStatus == STATUS_READY) { - // Both players have selected a pokemon to trade + // Both players have selected a Pokémon to trade sTradeMenu->callbackId = CB_SET_SELECTED_MONS; sTradeMenu->linkData[0] = LINKCMD_SET_MONS_TO_TRADE; sTradeMenu->linkData[1] = sTradeMenu->cursorPosition; @@ -1295,7 +1295,7 @@ static void Leader_HandleCommunication(void) else if (sTradeMenu->playerSelectStatus == STATUS_READY && sTradeMenu->partnerSelectStatus == STATUS_CANCEL) { - // The player has selected a pokemon to trade, + // The player has selected a Pokémon to trade, // but the partner has selected Cancel PrintTradeMessage(MSG_CANCELED); sTradeMenu->linkData[0] = LINKCMD_PARTNER_CANCEL_TRADE; @@ -1308,7 +1308,7 @@ static void Leader_HandleCommunication(void) else if (sTradeMenu->playerSelectStatus == STATUS_CANCEL && sTradeMenu->partnerSelectStatus == STATUS_READY) { - // The partner has selected a pokemon to trade, + // The partner has selected a Pokémon to trade, // but the player has selected cancel PrintTradeMessage(MSG_FRIEND_WANTS_TO_TRADE); sTradeMenu->linkData[0] = LINKCMD_PLAYER_CANCEL_TRADE; @@ -1465,7 +1465,7 @@ static void CB_ProcessMenuInput(void) if (sTradeMenu->cursorPosition < PARTY_SIZE) { - // Selected pokemon in player's party + // Selected Pokémon in player's party DrawTextBorderOuter(1, 1, 14); FillWindowPixelBuffer(1, PIXEL_FILL(1)); PrintMenuTable(1, ARRAY_COUNT(sSelectTradeMonActions), sSelectTradeMonActions); @@ -1476,7 +1476,7 @@ static void CB_ProcessMenuInput(void) } else if (sTradeMenu->cursorPosition < PARTY_SIZE * 2) { - // Selected pokemon in partner's party + // Selected Pokémon in partner's party BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); sTradeMenu->callbackId = CB_SHOW_MON_SUMMARY; } @@ -1855,7 +1855,7 @@ static void SetSelectedMon(u8 cursorPosition) if (sTradeMenu->drawSelectedMonState[whichParty] == 0) { // Start the animation to display just the selected - // pokemon in the middle of the screen + // Pokémon in the middle of the screen sTradeMenu->drawSelectedMonState[whichParty] = 1; sTradeMenu->selectedMonIdx[whichParty] = cursorPosition; } @@ -1889,10 +1889,10 @@ static void DrawSelectedMonScreen(u8 whichParty) for (i = 0; i < PARTY_SIZE; i++) ClearWindowTilemap(i + (whichParty * PARTY_SIZE + 2)); - // Re-display the selected pokemon + // Re-display the selected Pokémon gSprites[sTradeMenu->partySpriteIds[selectedMonParty][partyIdx]].invisible = FALSE; - // Move the selected pokemon to the center + // Move the selected Pokémon to the center gSprites[sTradeMenu->partySpriteIds[selectedMonParty][partyIdx]].data[0] = 20; gSprites[sTradeMenu->partySpriteIds[selectedMonParty][partyIdx]].data[2] = (sTradeMonSpriteCoords[selectedMonParty * PARTY_SIZE][0] + sTradeMonSpriteCoords[selectedMonParty * PARTY_SIZE + 1][0]) / 2 * 8 + 14; @@ -3109,13 +3109,13 @@ static void TradeMons(u8 playerPartyIdx, u8 partnerPartyIdx) struct Pokemon *partnerMon = &gEnemyParty[partnerPartyIdx]; u16 partnerMail = GetMonData(partnerMon, MON_DATA_MAIL); - // The mail attached to the sent Pokemon no longer exists in your file. + // The mail attached to the sent Pokémon no longer exists in your file. if (playerMail != MAIL_NONE) ClearMail(&gSaveBlock1Ptr->mail[playerMail]); SWAP(*playerMon, *partnerMon, sTradeAnim->tempMon); - // By default, a Pokemon received from a trade will have 70 Friendship. + // By default, a Pokémon received from a trade will have 70 Friendship. // Eggs use Friendship to track egg cycles, so don't set this on Eggs. friendship = 70; if (!GetMonData(playerMon, MON_DATA_IS_EGG)) diff --git a/src/trainer_pokemon_sprites.c b/src/trainer_pokemon_sprites.c index b6e2b63c35..f36060e8d1 100644 --- a/src/trainer_pokemon_sprites.c +++ b/src/trainer_pokemon_sprites.c @@ -11,7 +11,7 @@ #define PICS_COUNT 8 -// Needs to be large enough to store either a decompressed pokemon pic or trainer pic +// Needs to be large enough to store either a decompressed Pokémon pic or trainer pic #define PIC_SPRITE_SIZE max(MON_PIC_SIZE, TRAINER_PIC_SIZE) #define MAX_PIC_FRAMES max(MAX_MON_PIC_FRAMES, MAX_TRAINER_PIC_FRAMES) diff --git a/src/tv.c b/src/tv.c index ef493c10ce..0152dffa3e 100644 --- a/src/tv.c +++ b/src/tv.c @@ -6241,7 +6241,7 @@ static void DoTVShowSpotTheCuties(void) TVShowConvertInternationalString(gStringVar1, show->cuties.playerName, show->cuties.language); TVShowConvertInternationalString(gStringVar2, show->cuties.nickname, show->cuties.pokemonNameLanguage); - // Comments following the intro depend on how many ribbons the pokemon has + // Comments following the intro depend on how many ribbons the Pokémon has if (show->cuties.nRibbons < 10) sTVShowState = SPOTCUTIES_STATE_RIBBONS_LOW; else if (show->cuties.nRibbons < 20) diff --git a/src/use_pokeblock.c b/src/use_pokeblock.c index 2aefdedf38..7a37d88f0d 100644 --- a/src/use_pokeblock.c +++ b/src/use_pokeblock.c @@ -73,7 +73,7 @@ struct UsePokeblockSession u8 natureText[34]; }; -// This struct is identical to PokenavMonListItem, the struct used for managing lists of pokemon in the pokenav +// This struct is identical to PokenavMonListItem, the struct used for managing lists of Pokémon in the pokenav // Given that this screen is essentially duplicated in the poknav, this struct was probably the same one with // a more general name/purpose // TODO: Once the pokenav conditions screens are documented, resolve the above @@ -1259,7 +1259,7 @@ static void LoadAndCreateSelectionIcons(void) LoadSpriteSheets(spriteSheets); LoadSpritePalettes(spritePals); - // Fill pokeball selection icons up to number in party + // Fill Poké Ball selection icons up to number in party for (i = 0; i < sMenu->info.numSelections - 1; i++) { spriteId = CreateSprite(&spriteTemplate, 226, (i * 20) + 8, 0); @@ -1489,7 +1489,7 @@ static bool8 LoadNewSelection_CancelToMon(void) case 2: if (!ConditionMenu_UpdateMonEnter(&sMenu->graph, &sMenu->curMonXOffset)) { - // Load the new adjacent pokemon (not the one being shown) + // Load the new adjacent Pokémon (not the one being shown) LoadMonInfo(sMenu->toLoadSelection, sMenu->toLoadId); sMenu->info.helperState++; } @@ -1552,7 +1552,7 @@ static bool8 LoadNewSelection_MonToMon(void) case 2: if (!ConditionMenu_UpdateMonEnter(&sMenu->graph, &sMenu->curMonXOffset)) { - // Load the new adjacent pokemon (not the one being shown) + // Load the new adjacent Pokémon (not the one being shown) LoadMonInfo(sMenu->toLoadSelection, sMenu->toLoadId); sMenu->info.helperState++; } @@ -1593,8 +1593,8 @@ static void SpriteCB_SelectionIconCancel(struct Sprite *sprite) sprite->oam.paletteNum = IndexOfSpritePaletteTag(TAG_CONDITION_CANCEL); } -// Calculate the max id for sparkles/stars that appear around the pokemon on the condition screen -// All pokemon start with 1 sparkle (added by CreateConditionSparkleSprites), so the number here +1 +// Calculate the max id for sparkles/stars that appear around the Pokémon on the condition screen +// All Pokémon start with 1 sparkle (added by CreateConditionSparkleSprites), so the number here +1 // is the total number of sparkles that appear static void CalculateNumAdditionalSparkles(u8 monIndex) { diff --git a/src/wild_encounter.c b/src/wild_encounter.c index 3a7f6cab23..11d01f04ea 100644 --- a/src/wild_encounter.c +++ b/src/wild_encounter.c @@ -364,7 +364,7 @@ static u8 PickWildMonNature(void) } } } - // check synchronize for a pokemon with the same ability + // check synchronize for a Pokémon with the same ability if (!GetMonData(&gPlayerParty[0], MON_DATA_SANITY_IS_EGG) && GetMonAbility(&gPlayerParty[0]) == ABILITY_SYNCHRONIZE && Random() % 2 == 0) @@ -812,16 +812,16 @@ u16 GetLocalWildMon(bool8 *isWaterMon) // Neither if (landMonsInfo == NULL && waterMonsInfo == NULL) return SPECIES_NONE; - // Land Pokemon + // Land Pokémon else if (landMonsInfo != NULL && waterMonsInfo == NULL) return landMonsInfo->wildPokemon[ChooseWildMonIndex_Land()].species; - // Water Pokemon + // Water Pokémon else if (landMonsInfo == NULL && waterMonsInfo != NULL) { *isWaterMon = TRUE; return waterMonsInfo->wildPokemon[ChooseWildMonIndex_WaterRock()].species; } - // Either land or water Pokemon + // Either land or water Pokémon if ((Random() % 100) < 80) { return landMonsInfo->wildPokemon[ChooseWildMonIndex_Land()].species; From bc2a7451715a2a3dacd4c624aa763a480660a0de Mon Sep 17 00:00:00 2001 From: Bassoonian Date: Tue, 12 Dec 2023 23:18:35 +0100 Subject: [PATCH 08/54] Fix accidental symbol replacements --- src/battle_transition.c | 2 +- src/data/bard_music/bard_sounds.h | 4 ++-- src/data/party_menu.h | 2 +- src/party_menu.c | 2 +- src/pokemon.c | 2 +- src/pokemon_storage_system.c | 4 ++-- src/starter_choose.c | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/battle_transition.c b/src/battle_transition.c index 1c5b38faf8..11f9cddf4b 100644 --- a/src/battle_transition.c +++ b/src/battle_transition.c @@ -1315,7 +1315,7 @@ static void HBlankCB_Shuffle(void) #undef tAmplitude //------------------------------------------------------------------------ -// B_TRANSITION_BIG_Poké Ball, B_TRANSITION_AQUA, B_TRANSITION_MAGMA, +// B_TRANSITION_BIG_POKEBALL, B_TRANSITION_AQUA, B_TRANSITION_MAGMA, // B_TRANSITION_REGICE, B_TRANSITION_REGISTEEL, B_TRANSITION_REGIROCK // and B_TRANSITION_KYOGRE. // diff --git a/src/data/bard_music/bard_sounds.h b/src/data/bard_music/bard_sounds.h index bc6f88ba57..291d22872a 100644 --- a/src/data/bard_music/bard_sounds.h +++ b/src/data/bard_music/bard_sounds.h @@ -25,7 +25,7 @@ #include "trendysaying.h" const struct BardSound (*const gBardSoundsTable[EC_NUM_GROUPS])[6] = { - [EC_GROUP_POKEMON] = NULL, // Handled by gBardSounds_Pokémon + [EC_GROUP_POKEMON] = NULL, // Handled by gBardSounds_Pokemon [EC_GROUP_TRAINER] = gBardSounds_Trainer, [EC_GROUP_STATUS] = gBardSounds_Status, [EC_GROUP_BATTLE] = gBardSounds_Battle, @@ -46,7 +46,7 @@ const struct BardSound (*const gBardSoundsTable[EC_NUM_GROUPS])[6] = { [EC_GROUP_MOVE_1] = NULL, // Handled by gBardSounds_Moves [EC_GROUP_MOVE_2] = NULL, // Handled by gBardSounds_Moves [EC_GROUP_TRENDY_SAYING] = gBardSounds_TrendySaying, - [EC_GROUP_POKEMON_NATIONAL] = NULL // Handled by gBardSounds_Pokémon + [EC_GROUP_POKEMON_NATIONAL] = NULL // Handled by gBardSounds_Pokemon }; #endif //GUARD_BARD_SOUNDS_TABLE_H diff --git a/src/data/party_menu.h b/src/data/party_menu.h index 04e073df17..703e8e406e 100644 --- a/src/data/party_menu.h +++ b/src/data/party_menu.h @@ -983,7 +983,7 @@ static const struct CompressedSpriteSheet sSpriteSheet_MenuPokeballSmall = gPartyMenuPokeballSmall_Gfx, 0x0300, TAG_POKEBALL_SMALL }; -// Used for the pokeball sprite next to Cancel and Confirm when both are present, otherwise sSpriteTemplate_MenuPoké Ball is used +// Used for the pokeball sprite next to Cancel and Confirm when both are present, otherwise sSpriteTemplate_MenuPokeball is used static const struct SpriteTemplate sSpriteTemplate_MenuPokeballSmall = { .tileTag = TAG_POKEBALL_SMALL, diff --git a/src/party_menu.c b/src/party_menu.c index 2abceb50ae..adf833fe89 100755 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -3512,7 +3512,7 @@ static void CursorCb_SendMon(u8 taskId) } else { - // gStringVar4 below is the error message buffered by TrySwitchInPokémon + // gStringVar4 below is the error message buffered by TrySwitchInPokemon PartyMenuRemoveWindow(&sPartyMenuInternal->windowId[1]); DisplayPartyMenuMessage(gStringVar4, TRUE); gTasks[taskId].func = Task_ReturnToChooseMonAfterText; diff --git a/src/pokemon.c b/src/pokemon.c index 51a512445e..6ee052fda5 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -98,7 +98,7 @@ static const struct CombinedMove sCombinedMoves[2] = }; // NOTE: The order of the elements in the 3 arrays below is irrelevant. -// To reorder the pokedex, see the values in include/constants/Pokédex.h. +// To reorder the pokedex, see the values in include/constants/pokedex.h. #define SPECIES_TO_HOENN(name) [SPECIES_##name - 1] = HOENN_DEX_##name #define SPECIES_TO_NATIONAL(name) [SPECIES_##name - 1] = NATIONAL_DEX_##name diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index 92afe8a4bb..c8c87961c8 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -6687,8 +6687,8 @@ static void LoadSavedMovingMon(void) { if (sIsMonBeingMoved) { - // If it came from the party load a struct Pokémon, - // otherwise load a BoxPokémon + // If it came from the party load a struct Pokemon, + // otherwise load a BoxPokemon if (sMovingMonOrigBoxId == TOTAL_BOXES_COUNT) sStorage->movingMon = sSavedMovingMon; else diff --git a/src/starter_choose.c b/src/starter_choose.c index ef0b9388bf..cbbd163b03 100644 --- a/src/starter_choose.c +++ b/src/starter_choose.c @@ -367,7 +367,7 @@ static void VblankCB_StarterChoose(void) #define tPkmnSpriteId data[1] #define tCircleSpriteId data[2] -// Data for sSpriteTemplate_Poké Ball +// Data for sSpriteTemplate_Pokeball #define sTaskId data[0] #define sBallId data[1] From 63654311222936cc7ce18851847ac31b2791eef9 Mon Sep 17 00:00:00 2001 From: Bassoonian Date: Tue, 12 Dec 2023 23:20:22 +0100 Subject: [PATCH 09/54] =?UTF-8?q?Add=20Pok=C3=A9Nav=20too?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/graphics.h | 4 ++-- include/pokenav.h | 8 ++++---- include/strings.h | 6 +++--- src/graphics.c | 2 +- src/pokenav_menu_handler.c | 4 ++-- src/start_menu.c | 2 +- src/use_pokeblock.c | 4 ++-- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/include/graphics.h b/include/graphics.h index e98b707957..9e2fb79539 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -4005,7 +4005,7 @@ extern const u32 gBerryPalette_Starf[]; extern const u32 gBerryPic_Enigma[]; extern const u32 gBerryPalette_Enigma[]; -//pokenav +//PokéNav extern const u16 gPokenavCondition_Pal[]; extern const u32 gPokenavCondition_Gfx[]; extern const u32 gPokenavCondition_Tilemap[]; @@ -5011,7 +5011,7 @@ extern const u32 gBerryCrush_Crusher_Gfx[]; extern const u16 gBerryCrush_Crusher_Pal[]; extern const u32 gBerryCrush_TextWindows_Tilemap[]; -// Pokenav +// PokéNav extern const u32 gPokenavMessageBox_Gfx[]; extern const u32 gPokenavMessageBox_Tilemap[]; extern const u16 gPokenavMessageBox_Pal[]; diff --git a/include/pokenav.h b/include/pokenav.h index c6a8bb253e..174c338e27 100644 --- a/include/pokenav.h +++ b/include/pokenav.h @@ -65,8 +65,8 @@ struct PokenavMonList enum { POKENAV_MODE_NORMAL, // Chosen from Start menu. - POKENAV_MODE_FORCE_CALL_READY, // Pokenav tutorial before calling Mr. Stone - POKENAV_MODE_FORCE_CALL_EXIT, // Pokenav tutorial after calling Mr. Stone + POKENAV_MODE_FORCE_CALL_READY, // PokéNav tutorial before calling Mr. Stone + POKENAV_MODE_FORCE_CALL_EXIT, // PokéNav tutorial after calling Mr. Stone }; enum @@ -232,8 +232,8 @@ enum [CHECK_PAGE_INTRO_2] = gText_MatchCall##name##_Intro2} -// Pokenav Function IDs -// Indices into the LoopedTask tables for each of the main Pokenav features +// PokéNav Function IDs +// Indices into the LoopedTask tables for each of the main PokéNav features enum RegionMapFuncIds { diff --git a/include/strings.h b/include/strings.h index 914082779b..3215f70c88 100644 --- a/include/strings.h +++ b/include/strings.h @@ -2949,7 +2949,7 @@ extern const u8 gText_CutenessContest[]; extern const u8 gText_SmartnessContest[]; extern const u8 gText_ToughnessContest[]; -// Pokenav Match Call +// PokéNav Match Call extern const u8 gText_CallCantBeMadeHere[]; extern const u8 gText_NumberRegistered[]; extern const u8 gText_NumberOfBattles[]; @@ -2959,7 +2959,7 @@ extern const u8 gText_Call[]; extern const u8 gText_Check[]; extern const u8 gText_Cancel6[]; -// Pokenav Menu Handler +// PokéNav Menu Handler extern const u8 gText_CheckMapOfHoenn[]; extern const u8 gText_CheckPokemonInDetail[]; extern const u8 gText_CallRegisteredTrainer[]; @@ -2976,7 +2976,7 @@ extern const u8 gText_FindToughPokemon[]; extern const u8 gText_ReturnToConditionMenu[]; extern const u8 gText_NoRibbonWinners[]; -// Pokenav +// PokéNav extern const u8 gText_NumberIndex[]; extern const u8 gText_RibbonsF700[]; diff --git a/src/graphics.c b/src/graphics.c index 39b6c8e680..8f1bc89ea6 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -1282,7 +1282,7 @@ const u16 gContestResultsTitle_Smart_Tilemap[] = INCBIN_U16("graphics/contest/r const u16 gContestResultsTitle_Tough_Tilemap[] = INCBIN_U16("graphics/contest/results_screen/title_tough.bin"); const u16 gContestResultsTitle_Tilemap[] = INCBIN_U16("graphics/contest/results_screen/title.bin"); -// pokenav +// PokéNav const u16 gPokenavCondition_Pal[] = INCBIN_U16("graphics/pokenav/condition/graph.gbapal"); const u32 gPokenavCondition_Gfx[] = INCBIN_U32("graphics/pokenav/condition/graph.4bpp.lz"); diff --git a/src/pokenav_menu_handler.c b/src/pokenav_menu_handler.c index b81b4c892f..d67f61c1ea 100644 --- a/src/pokenav_menu_handler.c +++ b/src/pokenav_menu_handler.c @@ -257,7 +257,7 @@ static u32 HandleMainMenuInput(struct Pokenav_Menu *menu) return POKENAV_MENU_FUNC_NONE; } -// Force the player to select Match Call during the call Mr. Stone pokenav tutorial +// Force the player to select Match Call during the call Mr. Stone PokéNav tutorial static u32 HandleMainMenuInputTutorial(struct Pokenav_Menu *menu) { if (UpdateMenuCursorPos(menu)) @@ -287,7 +287,7 @@ static u32 HandleMainMenuInputTutorial(struct Pokenav_Menu *menu) return POKENAV_MENU_FUNC_NONE; } -// After calling Mr. Stone during the pokenav tutorial, force player to exit or use Match Call again +// After calling Mr. Stone during the PokéNav tutorial, force player to exit or use Match Call again static u32 HandleMainMenuInputEndTutorial(struct Pokenav_Menu *menu) { if (UpdateMenuCursorPos(menu)) diff --git a/src/start_menu.c b/src/start_menu.c index 0c8fe01f0e..63914cbb72 100644 --- a/src/start_menu.c +++ b/src/start_menu.c @@ -689,7 +689,7 @@ static bool8 StartMenuPokeNavCallback(void) PlayRainStoppingSoundEffect(); RemoveExtraStartMenuWindows(); CleanupOverworldWindowsAndTilemaps(); - SetMainCallback2(CB2_InitPokeNav); // Display PokeNav + SetMainCallback2(CB2_InitPokeNav); // Display PokéNav return TRUE; } diff --git a/src/use_pokeblock.c b/src/use_pokeblock.c index 7a37d88f0d..c9d5c56e5c 100644 --- a/src/use_pokeblock.c +++ b/src/use_pokeblock.c @@ -73,10 +73,10 @@ struct UsePokeblockSession u8 natureText[34]; }; -// This struct is identical to PokenavMonListItem, the struct used for managing lists of Pokémon in the pokenav +// This struct is identical to PokenavMonListItem, the struct used for managing lists of Pokémon in the PokéNav // Given that this screen is essentially duplicated in the poknav, this struct was probably the same one with // a more general name/purpose -// TODO: Once the pokenav conditions screens are documented, resolve the above +// TODO: Once the PokéNav conditions screens are documented, resolve the above struct UsePokeblockMenuPokemon { u8 boxId; // Because this screen is never used for the PC this is always set to TOTAL_BOXES_COUNT to refer to party From f8a4cf9d85a3ab02ca5d2b0a993acc2b69270119 Mon Sep 17 00:00:00 2001 From: Bassoonian Date: Wed, 13 Dec 2023 09:52:04 +0100 Subject: [PATCH 10/54] Update pokedex.c --- src/pokedex.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pokedex.c b/src/pokedex.c index d5db9987dd..0d1520a490 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -1758,7 +1758,7 @@ static void Task_HandlePokedexStartMenuInput(u8 taskId) CreateMonSpritesAtPos(sPokedexView->selectedPokemon, 0xE); gMain.newKeys |= START_BUTTON; //Exit menu break; - case 3: //CLOSE Pokédex + case 3: //CLOSE POKéDEX BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); gTasks[taskId].func = Task_ClosePokedex; PlaySE(SE_PC_OFF); @@ -1958,12 +1958,12 @@ static void Task_HandleSearchResultsStartMenuInput(u8 taskId) CreateMonSpritesAtPos(sPokedexView->selectedPokemon, 0xE); gMain.newKeys |= START_BUTTON; break; - case 3: //BACK TO Pokédex + case 3: //BACK TO POKéDEX BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); gTasks[taskId].func = Task_ReturnToPokedexFromSearchResults; PlaySE(SE_TRUCK_DOOR); break; - case 4: //CLOSE Pokédex + case 4: //CLOSE POKéDEX BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); gTasks[taskId].func = Task_ClosePokedexFromSearchResultsStartMenu; PlaySE(SE_PC_OFF); From 027dccfc95ef0712d3b802c791c2589d68d6cb94 Mon Sep 17 00:00:00 2001 From: Jaizu Date: Wed, 20 Dec 2023 12:24:52 +0100 Subject: [PATCH 11/54] Missing constant --- src/field_message_box.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/field_message_box.c b/src/field_message_box.c index 55124e7dfc..b797e1d353 100755 --- a/src/field_message_box.c +++ b/src/field_message_box.c @@ -84,7 +84,7 @@ bool8 ShowPokenavFieldMessage(const u8 *str) StringExpandPlaceholders(gStringVar4, str); CreateTask(Task_HidePokenavMessageWhenDone, 0); StartMatchCallFromScript(str); - sFieldMessageBoxMode = 2; + sFieldMessageBoxMode = FIELD_MESSAGE_BOX_NORMAL; return TRUE; } From 7567b0a57ad99a9988039f2434e5ec4622f7775b Mon Sep 17 00:00:00 2001 From: Kurausukun Date: Wed, 27 Dec 2023 17:29:35 -0500 Subject: [PATCH 12/54] safeguard SQUARE and CUBE macro arguments in parentheses --- src/data/pokemon/experience_tables.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/data/pokemon/experience_tables.h b/src/data/pokemon/experience_tables.h index 15bcadeb29..8f50e10918 100644 --- a/src/data/pokemon/experience_tables.h +++ b/src/data/pokemon/experience_tables.h @@ -1,5 +1,5 @@ -#define SQUARE(n)(n * n) -#define CUBE(n)(n * n * n) +#define SQUARE(n)((n) * (n)) +#define CUBE(n)((n) * (n) * (n)) #define EXP_SLOW(n)((5 * CUBE(n)) / 4) // (5 * (n)^3) / 4 #define EXP_FAST(n)((4 * CUBE(n)) / 5) // (4 * (n)^3) / 5 From 8e8d2f5efab9fff392326eee19a32ac936b99e5b Mon Sep 17 00:00:00 2001 From: GriffinR Date: Thu, 18 Jan 2024 14:31:04 -0500 Subject: [PATCH 13/54] Remove non-existent tilesets from label comments and alphabetize --- include/constants/metatile_labels.h | 142 ++++++++++++++-------------- 1 file changed, 71 insertions(+), 71 deletions(-) diff --git a/include/constants/metatile_labels.h b/include/constants/metatile_labels.h index c2c018761a..3b63d80f84 100644 --- a/include/constants/metatile_labels.h +++ b/include/constants/metatile_labels.h @@ -9,18 +9,6 @@ #define METATILE_BattleDome_Door_Lobby 0x209 #define METATILE_BattleDome_Door_PreBattleRoom 0x20A -// gTileset_BattleFrontierOutsideEast -#define METATILE_BattleFrontierOutsideEast_Door 0x3FC -#define METATILE_BattleFrontierOutsideEast_Door_BattleArena 0x291 -#define METATILE_BattleFrontierOutsideEast_Door_BattleTower 0x329 -#define METATILE_BattleFrontierOutsideEast_Door_Sliding 0x396 - -// gTileset_BattleFrontierOutsideWest -#define METATILE_BattleFrontierOutsideWest_Door 0x3FC -#define METATILE_BattleFrontierOutsideWest_Door_BattleDome 0x28A -#define METATILE_BattleFrontierOutsideWest_Door_BattleFactory 0x263 -#define METATILE_BattleFrontierOutsideWest_Door_Sliding 0x396 - // gTileset_BattleFrontier #define METATILE_BattleFrontier_CorridorOpenDoor_Bottom 0x20F #define METATILE_BattleFrontier_CorridorOpenDoor_Top 0x207 @@ -36,6 +24,18 @@ #define METATILE_BattleFrontier_Elevator_Top1 0x32A #define METATILE_BattleFrontier_Elevator_Top2 0x32B +// gTileset_BattleFrontierOutsideEast +#define METATILE_BattleFrontierOutsideEast_Door 0x3FC +#define METATILE_BattleFrontierOutsideEast_Door_BattleArena 0x291 +#define METATILE_BattleFrontierOutsideEast_Door_BattleTower 0x329 +#define METATILE_BattleFrontierOutsideEast_Door_Sliding 0x396 + +// gTileset_BattleFrontierOutsideWest +#define METATILE_BattleFrontierOutsideWest_Door 0x3FC +#define METATILE_BattleFrontierOutsideWest_Door_BattleDome 0x28A +#define METATILE_BattleFrontierOutsideWest_Door_BattleFactory 0x263 +#define METATILE_BattleFrontierOutsideWest_Door_Sliding 0x396 + // gTileset_BattlePalace #define METATILE_BattlePalace_Door 0x219 @@ -272,6 +272,18 @@ #define METATILE_Lavaridge_NormalGrass 0x206 #define METATILE_Lavaridge_RockWall 0x274 +// gTileset_Lilycove +#define METATILE_Lilycove_Door 0x246 +#define METATILE_Lilycove_Door_DeptStore 0x30C +#define METATILE_Lilycove_Door_SafariZone 0x32D +#define METATILE_Lilycove_Door_Wooden 0x28E +#define METATILE_Lilycove_Wailmer0 0x290 +#define METATILE_Lilycove_Wailmer0_Alt 0x298 +#define METATILE_Lilycove_Wailmer1 0x291 +#define METATILE_Lilycove_Wailmer1_Alt 0x299 +#define METATILE_Lilycove_Wailmer2 0x2A0 +#define METATILE_Lilycove_Wailmer3 0x2A1 + // gTileset_LilycoveMuseum #define METATILE_LilycoveMuseum_Painting0_Left 0x25A #define METATILE_LilycoveMuseum_Painting0_Right 0x25B @@ -284,17 +296,31 @@ #define METATILE_LilycoveMuseum_Painting4_Left 0x262 #define METATILE_LilycoveMuseum_Painting4_Right 0x263 -// gTileset_Lilycove -#define METATILE_Lilycove_Door 0x246 -#define METATILE_Lilycove_Door_DeptStore 0x30C -#define METATILE_Lilycove_Door_SafariZone 0x32D -#define METATILE_Lilycove_Door_Wooden 0x28E -#define METATILE_Lilycove_Wailmer0 0x290 -#define METATILE_Lilycove_Wailmer0_Alt 0x298 -#define METATILE_Lilycove_Wailmer1 0x291 -#define METATILE_Lilycove_Wailmer1_Alt 0x299 -#define METATILE_Lilycove_Wailmer2 0x2A0 -#define METATILE_Lilycove_Wailmer3 0x2A1 +// gTileset_Mauville +#define METATILE_Mauville_DeepSand_BottomMid 0x259 +#define METATILE_Mauville_DeepSand_Center 0x251 +#define METATILE_Mauville_Door 0x2AC +#define METATILE_Mauville_Door_BattleTent 0x3D4 +#define METATILE_Mauville_Door_CyclingRoad 0x289 +#define METATILE_Mauville_Door_Verdanturf 0x3A1 +#define METATILE_Mauville_MirageTower_Tile0 0x3D8 +#define METATILE_Mauville_MirageTower_Tile1 0x3D9 +#define METATILE_Mauville_MirageTower_Tile10 0x3E4 +#define METATILE_Mauville_MirageTower_Tile11 0x3E5 +#define METATILE_Mauville_MirageTower_Tile2 0x3DA +#define METATILE_Mauville_MirageTower_Tile3 0x3E0 +#define METATILE_Mauville_MirageTower_Tile4 0x3E1 +#define METATILE_Mauville_MirageTower_Tile5 0x3E2 +#define METATILE_Mauville_MirageTower_Tile6 0x3E8 +#define METATILE_Mauville_MirageTower_Tile7 0x3E9 +#define METATILE_Mauville_MirageTower_Tile8 0x3EA +#define METATILE_Mauville_MirageTower_Tile9 0x3F0 +#define METATILE_Mauville_MirageTower_TileA 0x3F1 +#define METATILE_Mauville_MirageTower_TileB 0x3F2 +#define METATILE_Mauville_MirageTower_TileC 0x3DB +#define METATILE_Mauville_MirageTower_TileD 0x3DC +#define METATILE_Mauville_MirageTower_TileE 0x3DD +#define METATILE_Mauville_MirageTower_TileF 0x3E3 // gTileset_MauvilleGym #define METATILE_MauvilleGym_FloorTile 0x21A @@ -325,38 +351,16 @@ #define METATILE_MauvilleGym_RedBeamV1_On 0x241 #define METATILE_MauvilleGym_RedBeamV2_On 0x249 -// gTileset_Mauville -#define METATILE_Mauville_DeepSand_BottomMid 0x259 -#define METATILE_Mauville_DeepSand_Center 0x251 -#define METATILE_Mauville_Door 0x2AC -#define METATILE_Mauville_Door_BattleTent 0x3D4 -#define METATILE_Mauville_Door_CyclingRoad 0x289 -#define METATILE_Mauville_Door_Verdanturf 0x3A1 -#define METATILE_Mauville_MirageTower_Tile0 0x3D8 -#define METATILE_Mauville_MirageTower_Tile1 0x3D9 -#define METATILE_Mauville_MirageTower_Tile10 0x3E4 -#define METATILE_Mauville_MirageTower_Tile11 0x3E5 -#define METATILE_Mauville_MirageTower_Tile2 0x3DA -#define METATILE_Mauville_MirageTower_Tile3 0x3E0 -#define METATILE_Mauville_MirageTower_Tile4 0x3E1 -#define METATILE_Mauville_MirageTower_Tile5 0x3E2 -#define METATILE_Mauville_MirageTower_Tile6 0x3E8 -#define METATILE_Mauville_MirageTower_Tile7 0x3E9 -#define METATILE_Mauville_MirageTower_Tile8 0x3EA -#define METATILE_Mauville_MirageTower_Tile9 0x3F0 -#define METATILE_Mauville_MirageTower_TileA 0x3F1 -#define METATILE_Mauville_MirageTower_TileB 0x3F2 -#define METATILE_Mauville_MirageTower_TileC 0x3DB -#define METATILE_Mauville_MirageTower_TileD 0x3DC -#define METATILE_Mauville_MirageTower_TileE 0x3DD -#define METATILE_Mauville_MirageTower_TileF 0x3E3 - // gTileset_MeteorFalls #define METATILE_MeteorFalls_CaveEntrance_Bottom 0x24E #define METATILE_MeteorFalls_CaveEntrance_Left 0x24D #define METATILE_MeteorFalls_CaveEntrance_Right 0x24F #define METATILE_MeteorFalls_CaveEntrance_Top 0x246 +// gTileset_Mossdeep +#define METATILE_Mossdeep_Door 0x2A1 +#define METATILE_Mossdeep_Door_SpaceCenter 0x2ED + // gTileset_MossdeepGameCorner #define METATILE_MossdeepGameCorner_CounterClosed_Bottom 0x232 #define METATILE_MossdeepGameCorner_CounterClosed_Top 0x22A @@ -366,10 +370,6 @@ // gTileset_MossdeepGym #define METATILE_MossdeepGym_YellowArrow_Right 0x250 -// gTileset_Mossdeep -#define METATILE_Mossdeep_Door 0x2A1 -#define METATILE_Mossdeep_Door_SpaceCenter 0x2ED - // gTileset_Pacifidlog #define METATILE_Pacifidlog_Door 0x21A #define METATILE_Pacifidlog_FloatingLogs_HorizontalLeft 0x250 @@ -388,6 +388,11 @@ #define METATILE_Pacifidlog_SubmergedLogs_VerticalBottom 0x262 #define METATILE_Pacifidlog_SubmergedLogs_VerticalTop 0x25A +// gTileset_Petalburg +#define METATILE_Petalburg_Door_BirchsLab 0x249 +#define METATILE_Petalburg_Door_Littleroot 0x248 +#define METATILE_Petalburg_Door_Oldale 0x287 + // gTileset_PetalburgGym #define METATILE_PetalburgGym_Door 0x224 #define METATILE_PetalburgGym_RoomEntrance_Left 0x210 @@ -398,11 +403,6 @@ #define METATILE_PetalburgGym_SlidingDoor_Frame3 0x21B #define METATILE_PetalburgGym_SlidingDoor_Frame4 0x21C -// gTileset_Petalburg -#define METATILE_Petalburg_Door_BirchsLab 0x249 -#define METATILE_Petalburg_Door_Littleroot 0x248 -#define METATILE_Petalburg_Door_Oldale 0x287 - // gTileset_PokemonCenter #define METATILE_PokemonCenter_CounterBarrier 0x25D #define METATILE_PokemonCenter_Door_CableClub 0x264 @@ -431,14 +431,6 @@ #define METATILE_PokemonCenter_Floor_ShadowTop 0x21E #define METATILE_PokemonCenter_Floor_ShadowTop_Alt 0x2DC -// gTileset_RSMossdeepGym -#define METATILE_RSMossdeepGym_RedArrow_Down 0x205 -#define METATILE_RSMossdeepGym_RedArrow_Left 0x20C -#define METATILE_RSMossdeepGym_RedArrow_Right 0x204 -#define METATILE_RSMossdeepGym_RedArrow_Up 0x20D -#define METATILE_RSMossdeepGym_Switch_Down 0x239 -#define METATILE_RSMossdeepGym_Switch_Up 0x238 - // gTileset_Rustboro #define METATILE_Rustboro_Door_Gray 0x21F #define METATILE_Rustboro_Door_Tan 0x22F @@ -726,11 +718,6 @@ #define METATILE_Slateport_Door 0x2DC #define METATILE_Slateport_Door_BattleTent 0x393 -// gTileset_SootopolisGym -#define METATILE_SootopolisGym_Ice_Broken 0x206 -#define METATILE_SootopolisGym_Ice_Cracked 0x20E -#define METATILE_SootopolisGym_Stairs 0x207 - // gTileset_Sootopolis #define METATILE_Sootopolis_Door 0x21E #define METATILE_Sootopolis_Door_Closed 0x248 @@ -738,6 +725,11 @@ #define METATILE_Sootopolis_GymDoor_Closed 0x250 #define METATILE_Sootopolis_RoughWater 0x290 +// gTileset_SootopolisGym +#define METATILE_SootopolisGym_Ice_Broken 0x206 +#define METATILE_SootopolisGym_Ice_Cracked 0x20E +#define METATILE_SootopolisGym_Stairs 0x207 + // gTileset_TrainerHill #define METATILE_TrainerHill_CounterDoor 0x334 #define METATILE_TrainerHill_Door_Elevator_Lobby 0x32C @@ -787,4 +779,12 @@ #define METATILE_Underwater_FloorShadow 0x228 #define METATILE_Underwater_RockWall 0x21E +// Other +#define METATILE_RSMossdeepGym_RedArrow_Down 0x205 +#define METATILE_RSMossdeepGym_RedArrow_Left 0x20C +#define METATILE_RSMossdeepGym_RedArrow_Right 0x204 +#define METATILE_RSMossdeepGym_RedArrow_Up 0x20D +#define METATILE_RSMossdeepGym_Switch_Down 0x239 +#define METATILE_RSMossdeepGym_Switch_Up 0x238 + #endif // GUARD_METATILE_LABELS_H From 8cab1b7094999e7b8c95fc47d23fbdc76b26b471 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Thu, 18 Jan 2024 17:07:17 -0300 Subject: [PATCH 14/54] Fixed braces style --- gflib/malloc.c | 34 +++++++++++++++++++++++----------- src/battle_anim_ghost.c | 6 ++++-- src/berry_blender.c | 3 ++- src/contest_effect.c | 3 ++- src/decompress.c | 15 ++++++++++----- src/decoration.c | 6 ++++-- src/dodrio_berry_picking.c | 21 ++++++++++++++------- src/mini_printf.c | 15 ++++++++++----- src/slot_machine.c | 3 ++- 9 files changed, 71 insertions(+), 35 deletions(-) diff --git a/gflib/malloc.c b/gflib/malloc.c index f54c751a4c..829877d892 100644 --- a/gflib/malloc.c +++ b/gflib/malloc.c @@ -55,18 +55,24 @@ void *AllocInternal(void *heapStart, u32 size) if (size & 3) size = 4 * ((size / 4) + 1); - for (;;) { + for (;;) + { // Loop through the blocks looking for unused block that's big enough. - if (!pos->flag) { + if (!pos->flag) + { foundBlockSize = pos->size; - if (foundBlockSize >= size) { - if (foundBlockSize - size < 2 * sizeof(struct MemBlock)) { + if (foundBlockSize >= size) + { + if (foundBlockSize - size < 2 * sizeof(struct MemBlock)) + { // The block isn't much bigger than the requested size, // so just use it. pos->flag = TRUE; - } else { + } + else + { // The block is significantly bigger than the requested // size, so split the rest into a separate block. foundBlockSize -= sizeof(struct MemBlock); @@ -98,15 +104,18 @@ void *AllocInternal(void *heapStart, u32 size) void FreeInternal(void *heapStart, void *pointer) { - if (pointer) { + if (pointer) + { struct MemBlock *head = (struct MemBlock *)heapStart; struct MemBlock *block = (struct MemBlock *)((u8 *)pointer - sizeof(struct MemBlock)); block->flag = FALSE; // If the freed block isn't the last one, merge with the next block // if it's not in use. - if (block->next != head) { - if (!block->next->flag) { + if (block->next != head) + { + if (!block->next->flag) + { block->size += sizeof(struct MemBlock) + block->next->size; block->next->magic = 0; block->next = block->next->next; @@ -117,8 +126,10 @@ void FreeInternal(void *heapStart, void *pointer) // If the freed block isn't the first one, merge with the previous block // if it's not in use. - if (block != head) { - if (!block->prev->flag) { + if (block != head) + { + if (!block->prev->flag) + { block->prev->next = block->next; if (block->next != head) @@ -135,7 +146,8 @@ void *AllocZeroedInternal(void *heapStart, u32 size) { void *mem = AllocInternal(heapStart, size); - if (mem != NULL) { + if (mem != NULL) + { if (size & 3) size = 4 * ((size / 4) + 1); diff --git a/src/battle_anim_ghost.c b/src/battle_anim_ghost.c index fed1325bc3..d6afd4c304 100644 --- a/src/battle_anim_ghost.c +++ b/src/battle_anim_ghost.c @@ -628,11 +628,13 @@ static void AnimTask_SpiteTargetShadow_Step1(u8 taskId) task->data[3] = 16; task->data[13] = GetAnimBattlerSpriteId(ANIM_TARGET); task->data[4] = OBJ_PLTT_ID2(gSprites[task->data[13]].oam.paletteNum); - if (position == 1) { + if (position == 1) + { u16 mask = DISPCNT_BG1_ON; mask2 = mask; } - else { + else + { u16 mask = DISPCNT_BG2_ON; mask2 = mask; } diff --git a/src/berry_blender.c b/src/berry_blender.c index 97262a4e2f..a91cafb0fb 100644 --- a/src/berry_blender.c +++ b/src/berry_blender.c @@ -2050,7 +2050,8 @@ static void UpdateSpeedFromHit(u16 cmd) switch (cmd) { case LINKCMD_BLENDER_SCORE_BEST: - if (sBerryBlender->speed < 1500) { + if (sBerryBlender->speed < 1500) + { sBerryBlender->speed += (384 / sNumPlayersToSpeedDivisor[sBerryBlender->numPlayers]); } else diff --git a/src/contest_effect.c b/src/contest_effect.c index b927943036..24de8e1692 100644 --- a/src/contest_effect.c +++ b/src/contest_effect.c @@ -138,7 +138,8 @@ static void ContestEffect_StartleFrontMon(void) u8 idx = 0; u8 a = eContestAppealResults.contestant; - if (eContestAppealResults.turnOrder[a] != 0) { + if (eContestAppealResults.turnOrder[a] != 0) + { int i; for (i = 0; i < CONTESTANT_COUNT; i++) diff --git a/src/decompress.c b/src/decompress.c index 8452f340ed..55807e89bb 100644 --- a/src/decompress.c +++ b/src/decompress.c @@ -214,7 +214,8 @@ static void UNUSED StitchObjectsOn8x8Canvas(s32 object_size, s32 object_count, u // While the remaining space will be filled with actual data if (object_size == 6) { - for (k = 0; k < 256; k++) { + for (k = 0; k < 256; k++) + { *dest = 0; dest++; } @@ -224,14 +225,16 @@ static void UNUSED StitchObjectsOn8x8Canvas(s32 object_size, s32 object_count, u { if (object_size == 6) { - for (k = 0; k < 32; k++) { + for (k = 0; k < 32; k++) + { *dest = 0; dest++; } } // Copy tile data - for (k = 0; k < 32 * object_size; k++) { + for (k = 0; k < 32 * object_size; k++) + { *dest = *src; src++; dest++; @@ -239,7 +242,8 @@ static void UNUSED StitchObjectsOn8x8Canvas(s32 object_size, s32 object_count, u if (object_size == 6) { - for (k = 0; k < 32; k++) { + for (k = 0; k < 32; k++) + { *dest = 0; dest++; } @@ -248,7 +252,8 @@ static void UNUSED StitchObjectsOn8x8Canvas(s32 object_size, s32 object_count, u if (object_size == 6) { - for (k = 0; k < 256; k++) { + for (k = 0; k < 256; k++) + { *dest = 0; dest++; } diff --git a/src/decoration.c b/src/decoration.c index f4fae6cc5e..18d6e2e680 100644 --- a/src/decoration.c +++ b/src/decoration.c @@ -1340,7 +1340,8 @@ static void DecorationItemsMenuAction_AttemptPlace(u8 taskId) else { ConvertIntToDecimalStringN(gStringVar1, sDecorationContext.size, STR_CONV_MODE_RIGHT_ALIGN, 2); - if (sDecorationContext.isPlayerRoom == FALSE) { + if (sDecorationContext.isPlayerRoom == FALSE) + { StringExpandPlaceholders(gStringVar4, gText_NoMoreDecorations); } else @@ -2254,7 +2255,8 @@ static void Task_PutAwayDecoration(u8 taskId) gTasks[taskId].tState = 1; break; case 1: - if (!gPaletteFade.active) { + if (!gPaletteFade.active) + { DrawWholeMapView(); ScriptContext_SetupScript(SecretBase_EventScript_PutAwayDecoration); ClearDialogWindowAndFrame(0, TRUE); diff --git a/src/dodrio_berry_picking.c b/src/dodrio_berry_picking.c index 1b4500002c..ce1877c6cd 100644 --- a/src/dodrio_berry_picking.c +++ b/src/dodrio_berry_picking.c @@ -1091,32 +1091,39 @@ static void InitResults_Member(void) { u8 i; - switch (sGame->state) { + switch (sGame->state) + { case 0: - if (SendBlock(0, sGame->berryResults[sGame->timer], sizeof(sGame->berryResults))) { + if (SendBlock(0, sGame->berryResults[sGame->timer], sizeof(sGame->berryResults))) + { sGame->playersReceived = 0; sGame->state++; } break; case 1: - if (IsLinkTaskFinished()) { + if (IsLinkTaskFinished()) + { sGame->state++; } break; case 2: - if (AllLinkBlocksReceived()) { - for (i = 0; i < sGame->numPlayers; i++) { + if (AllLinkBlocksReceived()) + { + for (i = 0; i < sGame->numPlayers; i++) + { memcpy(sGame->berryResults, gBlockRecvBuffer, sizeof(sGame->berryResults)); sGame->playersReceived = sGame->numPlayers; } } - if (sGame->playersReceived >= sGame->numPlayers) { + if (sGame->playersReceived >= sGame->numPlayers) + { sGame->timer++; sGame->state++; } break; default: - if (WaitFanfare(TRUE)) { + if (WaitFanfare(TRUE)) + { sGame->maxBerriesPickedInRow = sGame->berryResults[sGame->multiplayerId][BERRY_IN_ROW]; SetGameFunc(FUNC_RESULTS); FadeOutAndPlayNewMapMusic(MUS_RG_VICTORY_WILD, 4); diff --git a/src/mini_printf.c b/src/mini_printf.c index 2a8c6e5cb7..cab78d7611 100644 --- a/src/mini_printf.c +++ b/src/mini_printf.c @@ -102,8 +102,10 @@ static s32 _putsAscii(char *s, s32 len, void *buf) p0 = b->buffer; /* Copy to buffer */ - for (i = 0; i < len; i++) { - if(b->pbuffer == b->buffer + b->buffer_len - 1) { + for (i = 0; i < len; i++) + { + if(b->pbuffer == b->buffer + b->buffer_len - 1) + { break; } *(b->pbuffer ++) = s[i]; @@ -125,8 +127,10 @@ static s32 _putsEncoded(char *s, s32 len, void *buf) p0 = b->buffer; /* Copy to buffer */ - for (i = 0; i < len; i++) { - if(b->pbuffer == b->buffer + b->buffer_len - 1) { + for (i = 0; i < len; i++) + { + if(b->pbuffer == b->buffer + b->buffer_len - 1) + { break; } *(b->pbuffer ++) = mini_pchar_decode(s[i]); @@ -191,7 +195,8 @@ static s32 mini_pad(char* ptr, s32 len, char pad_char, s32 pad_to, char *buffer) char * pbuffer = buffer; if(pad_to == 0) pad_to = len; - if (len > pad_to) { + if (len > pad_to) + { len = pad_to; overflow = TRUE; } diff --git a/src/slot_machine.c b/src/slot_machine.c index 5ae0f9f1d5..4941ec0c7e 100644 --- a/src/slot_machine.c +++ b/src/slot_machine.c @@ -3324,7 +3324,8 @@ static void SpriteCB_FlashMatchingLines(struct Sprite *sprite) if (sprite->sNumFullFlashes) sprite->sNumFullFlashes--; } - else if (sprite->sColor >= maxColorChange) { + else if (sprite->sColor >= maxColorChange) + { // Reached peak darkness, reverse sprite->sColorIncr = -sprite->sColorIncr; } From e85750bb55d040e829a141f9fe23732a952a4361 Mon Sep 17 00:00:00 2001 From: Sierraffinity Date: Sat, 27 Jan 2024 14:29:31 -0800 Subject: [PATCH 15/54] gbagfx bit depth upconversion fix --- tools/gbagfx/convert_png.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/gbagfx/convert_png.c b/tools/gbagfx/convert_png.c index c9c240efbb..58371229c0 100644 --- a/tools/gbagfx/convert_png.c +++ b/tools/gbagfx/convert_png.c @@ -62,7 +62,7 @@ static unsigned char *ConvertBitDepth(unsigned char *src, int srcBitDepth, int d for (j = 8 - srcBitDepth; j >= 0; j -= srcBitDepth) { - unsigned char pixel = (srcByte >> j) % (1 << destBitDepth); + unsigned char pixel = ((srcByte >> j) % (1 << srcBitDepth)) % (1 << destBitDepth); *dest |= pixel << destBit; destBit -= destBitDepth; if (destBit < 0) From b98e044ce914a9068ee5e763831179b83398b585 Mon Sep 17 00:00:00 2001 From: Sierraffinity Date: Sat, 27 Jan 2024 19:29:29 -0800 Subject: [PATCH 16/54] jsonproc: filter out every non-alphanumeric character --- tools/jsonproc/jsonproc.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/jsonproc/jsonproc.cpp b/tools/jsonproc/jsonproc.cpp index 23056a5ff3..9ef23cd43e 100755 --- a/tools/jsonproc/jsonproc.cpp +++ b/tools/jsonproc/jsonproc.cpp @@ -105,10 +105,13 @@ int main(int argc, char *argv[]) }); env.add_callback("cleanString", 1, [](Arguments& args) { - string badChars = ".'{} \n\t-\u00e9"; string str = args.at(0)->get(); for (unsigned int i = 0; i < str.length(); i++) { - if (badChars.find(str[i]) != std::string::npos) { + // This code is not Unicode aware, so UTF-8 is not easily parsable without introducing + // another library. Just filter out any non-alphanumeric characters for now. + // TODO: proper Unicode string normalization + if ((i == 0 && isdigit(str[i])) + || !isalnum(str[i])) { str[i] = '_'; } } From e2eca97b02c322f16e023e9e0915739640d1a74e Mon Sep 17 00:00:00 2001 From: sbird Date: Sun, 28 Jan 2024 12:36:36 +0100 Subject: [PATCH 17/54] fix(linking): link gflib/malloc.c at top of EWRAM in ld_script_modern.ld --- ld_script_modern.ld | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ld_script_modern.ld b/ld_script_modern.ld index 4ccbfbaa0f..4f4bdae492 100644 --- a/ld_script_modern.ld +++ b/ld_script_modern.ld @@ -15,6 +15,11 @@ SECTIONS { ewram 0x2000000 (NOLOAD) : ALIGN(4) { + /* + We link malloc.o here to prevent `gHeap` from landing in the middle of EWRAM. + Otherwise this causes corruption issues on some ld versions + */ + gflib/malloc.o(ewram_data); src/*.o(ewram_data); gflib/*.o(ewram_data); } > EWRAM From 5be69b2713df03e9ca991c419f193bf972809a90 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Tue, 30 Jan 2024 11:46:19 -0500 Subject: [PATCH 18/54] Merge slot machine smoke SubspriteTable arrays --- src/slot_machine.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/slot_machine.c b/src/slot_machine.c index 4941ec0c7e..34c7ef8849 100644 --- a/src/slot_machine.c +++ b/src/slot_machine.c @@ -6985,7 +6985,7 @@ static const struct SubspriteTable sSubspriteTable_DigitalDisplay_Win[] = {ARRAY_COUNT(sSubsprites_DigitalDisplay_Win), sSubsprites_DigitalDisplay_Win} }; -static const struct Subsprite sSubsprites_DigitalDisplay_Smoke[] = +static const struct Subsprite sSubsprites_DigitalDisplay_SmokeBig[] = { { .x = -16, @@ -6997,7 +6997,7 @@ static const struct Subsprite sSubsprites_DigitalDisplay_Smoke[] = } }; -static const struct Subsprite sSubsprites_DigitalDisplay_Unused2[] = +static const struct Subsprite sSubsprites_DigitalDisplay_SmokeSmall[] = { { .x = -8, @@ -7011,12 +7011,8 @@ static const struct Subsprite sSubsprites_DigitalDisplay_Unused2[] = static const struct SubspriteTable sSubspriteTable_DigitalDisplay_Smoke[] = { - {ARRAY_COUNT(sSubsprites_DigitalDisplay_Smoke), sSubsprites_DigitalDisplay_Smoke} -}; - -static const struct SubspriteTable sSubspriteTable_DigitalDisplay_Unused2[] = -{ - {ARRAY_COUNT(sSubsprites_DigitalDisplay_Unused2), sSubsprites_DigitalDisplay_Unused2} + {ARRAY_COUNT(sSubsprites_DigitalDisplay_SmokeBig), sSubsprites_DigitalDisplay_SmokeBig}, + {ARRAY_COUNT(sSubsprites_DigitalDisplay_SmokeSmall), sSubsprites_DigitalDisplay_SmokeSmall} }; /* From e87a69a5e7fd9cf2e51bcdff021de6d51d3426e6 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Fri, 2 Feb 2024 22:31:20 +0100 Subject: [PATCH 19/54] Fix HideMapNamePopUpWindow possible overflow --- ld_script_modern.ld | 5 ----- src/map_name_popup.c | 9 +++++++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ld_script_modern.ld b/ld_script_modern.ld index 4f4bdae492..4ccbfbaa0f 100644 --- a/ld_script_modern.ld +++ b/ld_script_modern.ld @@ -15,11 +15,6 @@ SECTIONS { ewram 0x2000000 (NOLOAD) : ALIGN(4) { - /* - We link malloc.o here to prevent `gHeap` from landing in the middle of EWRAM. - Otherwise this causes corruption issues on some ld versions - */ - gflib/malloc.o(ewram_data); src/*.o(ewram_data); gflib/*.o(ewram_data); } > EWRAM diff --git a/src/map_name_popup.c b/src/map_name_popup.c index eed2f2b714..d004b18d56 100644 --- a/src/map_name_popup.c +++ b/src/map_name_popup.c @@ -317,8 +317,13 @@ void HideMapNamePopUpWindow(void) { if (FuncIsActiveTask(Task_MapNamePopUpWindow)) { - ClearStdWindowAndFrame(GetMapNamePopUpWindowId(), TRUE); - RemoveMapNamePopUpWindow(); + #ifdef UBFIX + if (GetMapNamePopUpWindowId() != WINDOW_NONE) + #endif // UBFIX + { + ClearStdWindowAndFrame(GetMapNamePopUpWindowId(), TRUE); + RemoveMapNamePopUpWindow(); + } SetGpuReg_ForcedBlank(REG_OFFSET_BG0VOFS, 0); DestroyTask(sPopupTaskId); } From 132ca1be145176893efe4ff31e7794cfa890ddc2 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Fri, 2 Feb 2024 22:57:02 +0100 Subject: [PATCH 20/54] Change Safe Div to explicitly check b != 0 --- include/global.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/global.h b/include/global.h index 1ea3b65d64..658af43da7 100644 --- a/include/global.h +++ b/include/global.h @@ -80,7 +80,7 @@ // Used in cases where division by 0 can occur in the retail version. // Avoids invalid opcodes on some emulators, and the otherwise UB. #ifdef UBFIX -#define SAFE_DIV(a, b) ((b) ? (a) / (b) : 0) +#define SAFE_DIV(a, b) (((b) != 0) ? (a) / (b) : 0) #else #define SAFE_DIV(a, b) ((a) / (b)) #endif From 3342fdafc2f51825e7b05ae48aed3663eefc5f48 Mon Sep 17 00:00:00 2001 From: Kurausukun Date: Sat, 10 Feb 2024 05:32:03 -0500 Subject: [PATCH 21/54] add missing constant --- src/pokedex_cry_screen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pokedex_cry_screen.c b/src/pokedex_cry_screen.c index 2c352c67a0..437ef8cf5a 100644 --- a/src/pokedex_cry_screen.c +++ b/src/pokedex_cry_screen.c @@ -362,7 +362,7 @@ static void BufferCryWaveformSegment(void) else baseBuffer = gSoundInfo.pcmBuffer + (gSoundInfo.pcmDmaPeriod + 1 - gPcmDmaCounter) * gSoundInfo.pcmSamplesPerVBlank; - buffer = baseBuffer + 0x630; + buffer = baseBuffer + PCM_DMA_BUF_SIZE; for (i = 0; i < ARRAY_COUNT(sDexCryScreen->cryWaveformBuffer); i++) sDexCryScreen->cryWaveformBuffer[i] = buffer[i * 2] * 2; } From 7da5cb421ecd65d5b607158feebde53728e1171c Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Wed, 6 Mar 2024 16:13:06 +0100 Subject: [PATCH 22/54] Make sure gHeap is always aligned --- gflib/malloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gflib/malloc.c b/gflib/malloc.c index 829877d892..8573611bb9 100644 --- a/gflib/malloc.c +++ b/gflib/malloc.c @@ -4,7 +4,7 @@ static void *sHeapStart; static u32 sHeapSize; -EWRAM_DATA u8 gHeap[HEAP_SIZE] = {0}; +ALIGNED(4) EWRAM_DATA u8 gHeap[HEAP_SIZE] = {0}; #define MALLOC_SYSTEM_ID 0xA3A3 From 9e67594dcea5f69c5dc264509a442bd43eba871e Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Fri, 8 Mar 2024 16:19:04 +0100 Subject: [PATCH 23/54] Simplify weirdly matching division/substraction code --- src/battle_anim_effects_2.c | 13 ++----------- src/battle_anim_fight.c | 2 +- src/battle_anim_rock.c | 9 +-------- src/battle_intro.c | 4 ++-- src/international_string_util.c | 5 +---- src/pokemon_animation.c | 19 +++++++------------ 6 files changed, 14 insertions(+), 38 deletions(-) mode change 100755 => 100644 src/battle_anim_effects_2.c diff --git a/src/battle_anim_effects_2.c b/src/battle_anim_effects_2.c old mode 100755 new mode 100644 index d26e0ba4c7..3d2e72cacb --- a/src/battle_anim_effects_2.c +++ b/src/battle_anim_effects_2.c @@ -3673,7 +3673,6 @@ static void AnimTask_UproarDistortion_Step(u8 taskId) static void AnimJaggedMusicNote(struct Sprite *sprite) { - int var1; u8 battler = !gBattleAnimArgs[0] ? gBattleAnimAttacker : gBattleAnimTarget; if (GetBattlerSide(battler) == B_SIDE_OPPONENT) @@ -3684,16 +3683,8 @@ static void AnimJaggedMusicNote(struct Sprite *sprite) sprite->data[0] = 0; sprite->data[1] = (u16)sprite->x << 3; sprite->data[2] = (u16)sprite->y << 3; - - var1 = gBattleAnimArgs[1] << 3; - if (var1 < 0) - var1 += 7; - sprite->data[3] = var1 >> 3; - - var1 = gBattleAnimArgs[2] << 3; - if (var1 < 0) - var1 += 7; - sprite->data[4] = var1 >> 3; + sprite->data[3] = (gBattleAnimArgs[1] << 3) / 8; + sprite->data[4] = (gBattleAnimArgs[2] << 3) / 8; sprite->oam.tileNum += gBattleAnimArgs[3] * 16; sprite->callback = AnimJaggedMusicNote_Step; diff --git a/src/battle_anim_fight.c b/src/battle_anim_fight.c index 764a951ef8..cbefb41f1e 100644 --- a/src/battle_anim_fight.c +++ b/src/battle_anim_fight.c @@ -493,7 +493,7 @@ static void AnimFistOrFootRandomPos(struct Sprite *sprite) y *= -1; if (GET_BATTLER_SIDE2(battler) == B_SIDE_PLAYER) - y += 0xFFF0; + y -= 16; sprite->x += x; sprite->y += y; diff --git a/src/battle_anim_rock.c b/src/battle_anim_rock.c index f9253675ca..bb8c3aa2f6 100644 --- a/src/battle_anim_rock.c +++ b/src/battle_anim_rock.c @@ -558,7 +558,6 @@ void AnimTask_Rollout(u8 taskId) { u16 var0, var1, var2, var3; u8 rolloutCounter; - int var5; s16 pan1, pan2; struct Task *task; @@ -582,13 +581,7 @@ void AnimTask_Rollout(u8 taskId) task->data[11] = 0; task->data[9] = 0; task->data[12] = 1; - - var5 = task->data[8]; - if (var5 < 0) - var5 += 7; - - task->data[10] = (var5 >> 3) - 1; - + task->data[10] = (task->data[8] / 8) - 1; task->data[2] = var0 * 8; task->data[3] = var1 * 8; task->data[4] = ((var2 - var0) * 8) / task->data[8]; diff --git a/src/battle_intro.c b/src/battle_intro.c index 5df697e3ae..571c5e85a2 100644 --- a/src/battle_intro.c +++ b/src/battle_intro.c @@ -196,12 +196,12 @@ static void BattleIntroSlide1(u8 taskId) { if (gTasks[taskId].tTerrain == BATTLE_TERRAIN_LONG_GRASS) { - if (gBattle_BG1_Y != 0xFFB0) + if (gBattle_BG1_Y != (u16)(-80)) gBattle_BG1_Y -= 2; } else { - if (gBattle_BG1_Y != 0xFFC8) + if (gBattle_BG1_Y != (u16)(-56)) gBattle_BG1_Y -= 1; } } diff --git a/src/international_string_util.c b/src/international_string_util.c index 457e3260be..6186bd116c 100644 --- a/src/international_string_util.c +++ b/src/international_string_util.c @@ -76,10 +76,7 @@ int Intl_GetListMenuWidth(const struct ListMenuTemplate *listMenu) } finalWidth = maxWidth + listMenu->item_X + 9; - if (finalWidth < 0) - finalWidth += 7; - - finalWidth >>= 3; + finalWidth /= 8; if (finalWidth > 28) finalWidth = 28; diff --git a/src/pokemon_animation.c b/src/pokemon_animation.c index 25c7778f8b..c5ef33878f 100644 --- a/src/pokemon_animation.c +++ b/src/pokemon_animation.c @@ -4969,29 +4969,24 @@ static void ShrinkGrowVibrate(struct Sprite *sprite) } else { - u8 posY_unsigned; - s8 posY_signed; - s32 posY; - s16 index = (u16)(sprite->data[2] % sprite->data[6] * 256) / sprite->data[6] % 256; + s8 sinY; + u16 y; + s16 index = ((u16)(sprite->data[2] % sprite->data[6] * 256) / sprite->data[6]) % 256; if (sprite->data[2] % 2 == 0) { sprite->data[4] = Sin(index, 32) + 256; sprite->data[5] = Sin(index, 32) + 256; - posY_unsigned = Sin(index, 32); - posY_signed = posY_unsigned; + sinY = Sin(index, 32); } else { sprite->data[4] = Sin(index, 8) + 256; sprite->data[5] = Sin(index, 8) + 256; - posY_unsigned = Sin(index, 8); - posY_signed = posY_unsigned; + sinY = Sin(index, 8); } - posY = posY_signed; - if (posY < 0) - posY += 7; - sprite->y2 = (u32)(posY) >> 3; + y = sinY / 8; + sprite->y2 = y; HandleSetAffineData(sprite, sprite->data[4], sprite->data[5], 0); } From 82f8636502afa4ed0960eb7457551538d38a5457 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sat, 9 Mar 2024 20:06:58 +0100 Subject: [PATCH 24/54] Simplify division in berry_crush and field weather functions --- src/berry_crush.c | 7 +------ src/field_weather.c | 7 +------ 2 files changed, 2 insertions(+), 12 deletions(-) mode change 100755 => 100644 src/berry_crush.c diff --git a/src/berry_crush.c b/src/berry_crush.c old mode 100755 new mode 100644 index 4e789f27a4..05e708162d --- a/src/berry_crush.c +++ b/src/berry_crush.c @@ -1373,7 +1373,6 @@ static void CreateBerrySprites(struct BerryCrushGame *game, struct BerryCrushGam u8 spriteId; s16 distance, var1; s16 *data; - s32 amplitude; s16 speed; u32 var2; @@ -1395,11 +1394,7 @@ static void CreateBerrySprites(struct BerryCrushGame *game, struct BerryCrushGam sYAccel = 32; sBitfield = 112; // Setting bits in MASK_TARGET_Y distance = gfx->playerCoords[i]->berryXDest - gfx->playerCoords[i]->berryXOffset; - amplitude = distance; - if (distance < 0) - amplitude += 3; - - sAmplitude = amplitude >> 2; + sAmplitude = distance / 4; distance *= 128; var2 = speed + 32; var2 = var2 / 2; diff --git a/src/field_weather.c b/src/field_weather.c index 5ca9075250..bc86bcdc7d 100644 --- a/src/field_weather.c +++ b/src/field_weather.c @@ -277,7 +277,6 @@ static void BuildColorMaps(void) u16 brightnessDelta; u16 colorMapIndex; u16 baseBrightness; - u32 remainingBrightness; s16 diff; sPaletteColorMapTypes = sBasePaletteColorMapTypes; @@ -305,11 +304,7 @@ static void BuildColorMaps(void) } baseBrightness = curBrightness; - remainingBrightness = 0x1f00 - curBrightness; - if ((0x1f00 - curBrightness) < 0) - remainingBrightness += 0xf; - - brightnessDelta = remainingBrightness / (NUM_WEATHER_COLOR_MAPS - 3); + brightnessDelta = (0x1f00 - curBrightness) / (NUM_WEATHER_COLOR_MAPS - 3); if (colorVal < 12) { // For shadows (color values < 12), the remaining color mappings are From 927f098cf5ea42fb67ed045cd00d13e772eb7a33 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Mon, 11 Mar 2024 01:41:07 -0300 Subject: [PATCH 25/54] Renamed setmodernfatefulencounter and checkmodernfatefulencounter for consistency reasons --- data/script_cmd_table.inc | 4 ++-- src/scrcmd.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/data/script_cmd_table.inc b/data/script_cmd_table.inc index f50ce5322b..e73a39a5dd 100644 --- a/data/script_cmd_table.inc +++ b/data/script_cmd_table.inc @@ -205,8 +205,8 @@ gScriptCmdTable:: .4byte ScrCmd_nop1 @ 0xca .4byte ScrCmd_nop1 @ 0xcb .4byte ScrCmd_nop1 @ 0xcc - .4byte ScrCmd_setmonmodernfatefulencounter @ 0xcd - .4byte ScrCmd_checkmonmodernfatefulencounter @ 0xce + .4byte ScrCmd_setmodernfatefulencounter @ 0xcd + .4byte ScrCmd_checkmodernfatefulencounter @ 0xce .4byte ScrCmd_trywondercardscript @ 0xcf .4byte ScrCmd_nop1 @ 0xd0 .4byte ScrCmd_warpspinenter @ 0xd1 diff --git a/src/scrcmd.c b/src/scrcmd.c index 147a11b869..218be539f5 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -2207,7 +2207,7 @@ bool8 ScrCmd_lockfortrainer(struct ScriptContext *ctx) } // This command will set a Pokémon's modernFatefulEncounter bit; there is no similar command to clear it. -bool8 ScrCmd_setmonmodernfatefulencounter(struct ScriptContext *ctx) +bool8 ScrCmd_setmodernfatefulencounter(struct ScriptContext *ctx) { bool8 isModernFatefulEncounter = TRUE; u16 partyIndex = VarGet(ScriptReadHalfword(ctx)); @@ -2216,7 +2216,7 @@ bool8 ScrCmd_setmonmodernfatefulencounter(struct ScriptContext *ctx) return FALSE; } -bool8 ScrCmd_checkmonmodernfatefulencounter(struct ScriptContext *ctx) +bool8 ScrCmd_checkmodernfatefulencounter(struct ScriptContext *ctx) { u16 partyIndex = VarGet(ScriptReadHalfword(ctx)); From 7ee921e9dae948713f94c5f286855e3001f05a3f Mon Sep 17 00:00:00 2001 From: pkmnsnfrn Date: Thu, 4 Apr 2024 16:17:48 -0400 Subject: [PATCH 26/54] Added BUGFIX for groundEffectsOnMove when the player stops Surfing --- src/field_player_avatar.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/field_player_avatar.c b/src/field_player_avatar.c index 04aa5383bd..1f0708af22 100644 --- a/src/field_player_avatar.c +++ b/src/field_player_avatar.c @@ -1663,6 +1663,10 @@ static void Task_WaitStopSurfing(u8 taskId) gPlayerAvatar.preventStep = FALSE; UnlockPlayerFieldControls(); DestroySprite(&gSprites[playerObjEvent->fieldEffectSpriteId]); +#ifdef BUGFIX + // If this is not defined but the player steps into grass from surfing, they will appear over the grass instead of in the grass. + playerObjEvent->triggerGroundEffectsOnMove = TRUE; +#endif DestroyTask(taskId); } } From 71b8d2039732554235cee49f765d0a0dd7f03dff Mon Sep 17 00:00:00 2001 From: pkmnsnfrn Date: Thu, 4 Apr 2024 16:21:34 -0400 Subject: [PATCH 27/54] Replaced magic numbers regarding triggerGroundEffectsOnMove to TRUE / FALSE --- src/event_object_movement.c | 4 ++-- src/field_effect.c | 2 +- src/overworld.c | 4 ++-- src/trainer_see.c | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/event_object_movement.c b/src/event_object_movement.c index 5a746579d4..ece1bfa631 100644 --- a/src/event_object_movement.c +++ b/src/event_object_movement.c @@ -8077,7 +8077,7 @@ static void DoGroundEffects_OnSpawn(struct ObjectEvent *objEvent, struct Sprite GetAllGroundEffectFlags_OnSpawn(objEvent, &flags); SetObjectEventSpriteOamTableForLongGrass(objEvent, sprite); DoFlaggedGroundEffects(objEvent, sprite, flags); - objEvent->triggerGroundEffectsOnMove = 0; + objEvent->triggerGroundEffectsOnMove = FALSE; objEvent->disableCoveringGroundEffects = 0; } } @@ -8094,7 +8094,7 @@ static void DoGroundEffects_OnBeginStep(struct ObjectEvent *objEvent, struct Spr SetObjectEventSpriteOamTableForLongGrass(objEvent, sprite); filters_out_some_ground_effects(objEvent, &flags); DoFlaggedGroundEffects(objEvent, sprite, flags); - objEvent->triggerGroundEffectsOnMove = 0; + objEvent->triggerGroundEffectsOnMove = FALSE; objEvent->disableCoveringGroundEffects = 0; } } diff --git a/src/field_effect.c b/src/field_effect.c index 9ef70a1655..d907c3f16d 100644 --- a/src/field_effect.c +++ b/src/field_effect.c @@ -2496,7 +2496,7 @@ static void TeleportWarpInFieldEffect_SpinEnter(struct Task *task) if (task->data[13] == 0) { task->data[13]++; - objectEvent->triggerGroundEffectsOnMove = 1; + objectEvent->triggerGroundEffectsOnMove = TRUE; sprite->subspriteMode = task->data[14]; } } else diff --git a/src/overworld.c b/src/overworld.c index 2e01a2e52f..e1cb0a1cad 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -3050,7 +3050,7 @@ static void SetPlayerFacingDirection(u8 linkPlayerId, u8 facing) { if (facing > FACING_FORCED_RIGHT) { - objEvent->triggerGroundEffectsOnMove = 1; + objEvent->triggerGroundEffectsOnMove = TRUE; } else { @@ -3199,7 +3199,7 @@ static void CreateLinkPlayerSprite(u8 linkPlayerId, u8 gameVersion) sprite = &gSprites[objEvent->spriteId]; sprite->coordOffsetEnabled = TRUE; sprite->data[0] = linkPlayerId; - objEvent->triggerGroundEffectsOnMove = 0; + objEvent->triggerGroundEffectsOnMove = FALSE; } } diff --git a/src/trainer_see.c b/src/trainer_see.c index 88f9215f77..51cc64f4a0 100644 --- a/src/trainer_see.c +++ b/src/trainer_see.c @@ -595,7 +595,7 @@ static bool8 JumpInPlaceBuriedTrainer(u8 taskId, struct Task *task, struct Objec if (gSprites[task->tOutOfAshSpriteId].animCmdIndex == 2) { trainerObj->fixedPriority = 0; - trainerObj->triggerGroundEffectsOnMove = 1; + trainerObj->triggerGroundEffectsOnMove = TRUE; sprite = &gSprites[trainerObj->spriteId]; sprite->oam.priority = 2; From 3135a1fc2b1461c328c6a11e88d1df6b7a6b1455 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Fri, 5 Apr 2024 17:04:46 -0300 Subject: [PATCH 28/54] Updated value-setting of gMain.inBattle at OpponentHandleEndLinkBattle --- src/battle_controller_opponent.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/battle_controller_opponent.c b/src/battle_controller_opponent.c index e5284f9abc..dc3652b457 100644 --- a/src/battle_controller_opponent.c +++ b/src/battle_controller_opponent.c @@ -2007,7 +2007,7 @@ static void OpponentHandleEndLinkBattle(void) { if (gBattleTypeFlags & BATTLE_TYPE_LINK && !(gBattleTypeFlags & BATTLE_TYPE_IS_MASTER)) { - gMain.inBattle = 0; + gMain.inBattle = FALSE; gMain.callback1 = gPreBattleCallback1; SetMainCallback2(gMain.savedCallback); } From f9d690bafeeea422d113ab44297704269abf2f48 Mon Sep 17 00:00:00 2001 From: pkmnsnfrn Date: Fri, 5 Apr 2024 14:58:31 -0700 Subject: [PATCH 29/54] Added fix to Keep the Camera from Making Waves --- src/event_object_movement.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/event_object_movement.c b/src/event_object_movement.c index 5a746579d4..d668aa1a08 100644 --- a/src/event_object_movement.c +++ b/src/event_object_movement.c @@ -8070,7 +8070,11 @@ static void DoGroundEffects_OnSpawn(struct ObjectEvent *objEvent, struct Sprite { u32 flags; +#ifdef BUGFIX + if (objEvent->triggerGroundEffectsOnMove && objEvent->localId != OBJ_EVENT_ID_CAMERA) +#else if (objEvent->triggerGroundEffectsOnMove) +#endif { flags = 0; UpdateObjectEventElevationAndPriority(objEvent, sprite); @@ -8086,7 +8090,11 @@ static void DoGroundEffects_OnBeginStep(struct ObjectEvent *objEvent, struct Spr { u32 flags; +#ifdef BUGFIX + if (objEvent->triggerGroundEffectsOnMove && objEvent->localId != OBJ_EVENT_ID_CAMERA) +#else if (objEvent->triggerGroundEffectsOnMove) +#endif { flags = 0; UpdateObjectEventElevationAndPriority(objEvent, sprite); @@ -8103,7 +8111,11 @@ static void DoGroundEffects_OnFinishStep(struct ObjectEvent *objEvent, struct Sp { u32 flags; +#ifdef BUGFIX + if (objEvent->triggerGroundEffectsOnStop && objEvent->localId != OBJ_EVENT_ID_CAMERA) +#else if (objEvent->triggerGroundEffectsOnStop) +#endif { flags = 0; UpdateObjectEventElevationAndPriority(objEvent, sprite); From c64453efe50959e6286e984a2a7dda47a1d86831 Mon Sep 17 00:00:00 2001 From: NT_x86 Date: Sat, 13 Apr 2024 10:14:31 +0300 Subject: [PATCH 30/54] Fix poison projectile array being incorrectly combined into three seperate arrays --- src/battle_anim_poison.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/battle_anim_poison.c b/src/battle_anim_poison.c index d9a15c835c..bfe1fc835f 100644 --- a/src/battle_anim_poison.c +++ b/src/battle_anim_poison.c @@ -59,15 +59,7 @@ static const union AnimCmd sAnim_SludgeBombHit[] = static const union AnimCmd *const sAnims_PoisonProjectile[] = { sAnim_PoisonProjectile, -}; - -static const union AnimCmd *const sAnims_AcidPoisonDroplet[] = -{ sAnim_AcidPoisonDroplet, -}; - -static const union AnimCmd *const sAnims_SludgeBombHit[] = -{ sAnim_SludgeBombHit, }; @@ -122,7 +114,7 @@ const struct SpriteTemplate gSludgeBombHitParticleSpriteTemplate = .tileTag = ANIM_TAG_POISON_BUBBLE, .paletteTag = ANIM_TAG_POISON_BUBBLE, .oam = &gOamData_AffineNormal_ObjNormal_16x16, - .anims = sAnims_SludgeBombHit, + .anims = &sAnims_PoisonProjectile[2], .images = NULL, .affineAnims = sAffineAnims_SludgeBombHit, .callback = AnimSludgeBombHitParticle, @@ -145,7 +137,7 @@ const struct SpriteTemplate gAcidPoisonDropletSpriteTemplate = .tileTag = ANIM_TAG_POISON_BUBBLE, .paletteTag = ANIM_TAG_POISON_BUBBLE, .oam = &gOamData_AffineDouble_ObjNormal_16x16, - .anims = sAnims_AcidPoisonDroplet, + .anims = &sAnims_PoisonProjectile[1], .images = NULL, .affineAnims = gAffineAnims_Droplet, .callback = AnimAcidPoisonDroplet, From 2b78a85828eb40b68a0973615665fd22b961bfd9 Mon Sep 17 00:00:00 2001 From: NT_x86 Date: Sat, 13 Apr 2024 13:09:24 +0300 Subject: [PATCH 31/54] Fix hoenn pokedex palette being split in two --- graphics/pokedex/bg_hoenn.pal | 50 ++++++++++++++++++++++++++++- graphics/pokedex/caught_screen.pal | 51 ------------------------------ src/graphics.c | 1 - src/pokedex.c | 2 +- 4 files changed, 50 insertions(+), 54 deletions(-) delete mode 100644 graphics/pokedex/caught_screen.pal diff --git a/graphics/pokedex/bg_hoenn.pal b/graphics/pokedex/bg_hoenn.pal index 569c7821a9..01bd8a3a3d 100644 --- a/graphics/pokedex/bg_hoenn.pal +++ b/graphics/pokedex/bg_hoenn.pal @@ -1,6 +1,6 @@ JASC-PAL 0100 -48 +96 123 131 0 255 255 255 222 222 222 @@ -49,3 +49,51 @@ JASC-PAL 49 139 255 189 156 90 0 0 0 +123 131 0 +255 255 255 +255 238 0 +255 189 0 +255 115 0 +98 98 115 +41 57 65 +41 57 106 +0 0 41 +255 255 255 +238 246 57 +255 0 189 +49 213 74 +24 131 32 +189 156 90 +0 0 0 +123 131 0 +255 255 255 +197 32 32 +189 189 189 +164 164 164 +98 98 115 +41 57 65 +41 57 106 +0 0 41 +255 255 255 +238 246 57 +189 0 0 +74 148 180 +8 90 131 +189 156 90 +0 0 0 +123 131 0 +255 255 255 +197 32 32 +189 189 189 +164 164 164 +98 98 115 +41 57 65 +41 57 106 +0 0 41 +255 255 255 +238 246 57 +255 0 189 +180 205 246 +49 139 255 +189 156 90 +0 0 0 diff --git a/graphics/pokedex/caught_screen.pal b/graphics/pokedex/caught_screen.pal deleted file mode 100644 index 26da98a84c..0000000000 --- a/graphics/pokedex/caught_screen.pal +++ /dev/null @@ -1,51 +0,0 @@ -JASC-PAL -0100 -48 -123 131 0 -255 255 255 -255 238 0 -255 189 0 -255 115 0 -98 98 115 -41 57 65 -41 57 106 -0 0 41 -255 255 255 -238 246 57 -255 0 189 -49 213 74 -24 131 32 -189 156 90 -0 0 0 -123 131 0 -255 255 255 -197 32 32 -189 189 189 -164 164 164 -98 98 115 -41 57 65 -41 57 106 -0 0 41 -255 255 255 -238 246 57 -189 0 0 -74 148 180 -8 90 131 -189 156 90 -0 0 0 -123 131 0 -255 255 255 -197 32 32 -189 189 189 -164 164 164 -98 98 115 -41 57 65 -41 57 106 -0 0 41 -255 255 255 -238 246 57 -255 0 189 -180 205 246 -49 139 255 -189 156 90 -0 0 0 diff --git a/src/graphics.c b/src/graphics.c index 8f1bc89ea6..2612022695 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -1230,7 +1230,6 @@ const u16 gFrontierPassMedalsGold_Pal[] = INCBIN_U16("graphics/frontier_pass/gol // Pokédex const u16 gPokedexBgHoenn_Pal[] = INCBIN_U16("graphics/pokedex/bg_hoenn.gbapal"); -const u16 gPokedexCaughtScreen_Pal[] = INCBIN_U16("graphics/pokedex/caught_screen.gbapal"); const u16 gPokedexSearchResults_Pal[] = INCBIN_U16("graphics/pokedex/search_results_bg.gbapal"); const u16 gPokedexBgNational_Pal[] = INCBIN_U16("graphics/pokedex/bg_national.gbapal"); const u32 gPokedexMenu_Gfx[] = INCBIN_U32("graphics/pokedex/menu.4bpp.lz"); diff --git a/src/pokedex.c b/src/pokedex.c index 0d1520a490..09a25b872b 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -4036,7 +4036,7 @@ static void Task_HandleCaughtMonPageInput(u8 taskId) } else { - LoadPalette(gPokedexCaughtScreen_Pal + 1, BG_PLTT_ID(3) + 1, PLTT_SIZEOF(7)); + LoadPalette(gPokedexBgHoenn_Pal + 49, BG_PLTT_ID(3) + 1, PLTT_SIZEOF(7)); } } From 5dbd90b917c2474cd89b45b2c2e33e1544c43b0e Mon Sep 17 00:00:00 2001 From: Kurausukun Date: Fri, 19 Apr 2024 14:17:12 -0400 Subject: [PATCH 32/54] Use Only One Loop in RandomlyGivePartyPokerus (#1991) --- src/pokemon.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/pokemon.c b/src/pokemon.c index 6ee052fda5..2b8f4fc95f 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -6038,14 +6038,10 @@ void RandomlyGivePartyPokerus(struct Pokemon *party) do { - do - { - rnd = Random() % PARTY_SIZE; - mon = &party[rnd]; - } - while (!GetMonData(mon, MON_DATA_SPECIES, 0)); + rnd = Random() % PARTY_SIZE; + mon = &party[rnd]; } - while (GetMonData(mon, MON_DATA_IS_EGG, 0)); + while (!GetMonData(mon, MON_DATA_SPECIES, 0) || GetMonData(mon, MON_DATA_IS_EGG, 0)); if (!(CheckPartyHasHadPokerus(party, gBitTable[rnd]))) { From 411d7e617777a3a7e7c60fdaf5d73d39a2695599 Mon Sep 17 00:00:00 2001 From: Jaizu Date: Tue, 14 May 2024 12:48:20 +0200 Subject: [PATCH 33/54] Make AdjustFriendship more readable --- src/pokemon.c | 60 ++++++++++++++++++++++++++++++--------------------- 1 file changed, 36 insertions(+), 24 deletions(-) diff --git a/src/pokemon.c b/src/pokemon.c index 2b8f4fc95f..ef8e7e9e05 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -5877,16 +5877,11 @@ u16 ModifyStatByNature(u8 nature, u16 stat, u8 statIndex) return retVal; } -#define IS_LEAGUE_BATTLE \ - ((gBattleTypeFlags & BATTLE_TYPE_TRAINER) \ - && (gTrainers[gTrainerBattleOpponent_A].trainerClass == TRAINER_CLASS_ELITE_FOUR \ - || gTrainers[gTrainerBattleOpponent_A].trainerClass == TRAINER_CLASS_LEADER \ - || gTrainers[gTrainerBattleOpponent_A].trainerClass == TRAINER_CLASS_CHAMPION)) \ - void AdjustFriendship(struct Pokemon *mon, u8 event) { u16 species, heldItem; u8 holdEffect; + s8 mod; if (ShouldSkipFriendshipChange()) return; @@ -5916,26 +5911,43 @@ void AdjustFriendship(struct Pokemon *mon, u8 event) if (friendship > 199) friendshipLevel++; - if ((event != FRIENDSHIP_EVENT_WALKING || !(Random() & 1)) - && (event != FRIENDSHIP_EVENT_LEAGUE_BATTLE || IS_LEAGUE_BATTLE)) + if (event == FRIENDSHIP_EVENT_WALKING) { - s8 mod = sFriendshipEventModifiers[event][friendshipLevel]; - if (mod > 0 && holdEffect == HOLD_EFFECT_FRIENDSHIP_UP) - mod = (150 * mod) / 100; - friendship += mod; - if (mod > 0) - { - if (GetMonData(mon, MON_DATA_POKEBALL, 0) == ITEM_LUXURY_BALL) - friendship++; - if (GetMonData(mon, MON_DATA_MET_LOCATION, 0) == GetCurrentRegionMapSectionId()) - friendship++; - } - if (friendship < 0) - friendship = 0; - if (friendship > MAX_FRIENDSHIP) - friendship = MAX_FRIENDSHIP; - SetMonData(mon, MON_DATA_FRIENDSHIP, &friendship); + // 50% chance every 128 steps + if (Random() & 1) + return; } + if (event == FRIENDSHIP_EVENT_LEAGUE_BATTLE) + { + // Only if it's a trainer battle with league progression significance + if (!(gBattleTypeFlags & BATTLE_TYPE_TRAINER)) + return; + if (!(gTrainers[gTrainerBattleOpponent_A].trainerClass == TRAINER_CLASS_LEADER + || gTrainers[gTrainerBattleOpponent_A].trainerClass == TRAINER_CLASS_ELITE_FOUR + || gTrainers[gTrainerBattleOpponent_A].trainerClass == TRAINER_CLASS_CHAMPION)) + return; + } + + mod = sFriendshipEventModifiers[event][friendshipLevel]; + if (mod > 0 && holdEffect == HOLD_EFFECT_FRIENDSHIP_UP) + // 50% increase, rounding down + mod = (150 * mod) / 100; + + friendship += mod; + if (mod > 0) + { + if (GetMonData(mon, MON_DATA_POKEBALL, NULL) == ITEM_LUXURY_BALL) + friendship++; + if (GetMonData(mon, MON_DATA_MET_LOCATION, NULL) == GetCurrentRegionMapSectionId()) + friendship++; + } + + if (friendship < 0) + friendship = 0; + if (friendship > MAX_FRIENDSHIP) + friendship = MAX_FRIENDSHIP; + + SetMonData(mon, MON_DATA_FRIENDSHIP, &friendship); } } From ef03daf6d4798e450d1bb3cfab1267738d3d0a92 Mon Sep 17 00:00:00 2001 From: Jaizu Date: Sun, 19 May 2024 12:52:04 +0200 Subject: [PATCH 34/54] Fix Pokeblock script missing a releaseall --- data/scripts/safari_zone.inc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/data/scripts/safari_zone.inc b/data/scripts/safari_zone.inc index eb6a90abdf..77e795a0eb 100644 --- a/data/scripts/safari_zone.inc +++ b/data/scripts/safari_zone.inc @@ -53,6 +53,9 @@ SafariZone_EventScript_ChoosePokeblock:: special OpenPokeblockCaseOnFeeder waitstate goto_if_ne VAR_RESULT, 0xFFFF, SafariZone_EventScript_PokeblockPlaced +#ifdef BUGFIX + releaseall @ Only gets called from EventScript_PokeBlockFeeder which uses lockall. +#endif end SafariZone_EventScript_PokeblockPlaced:: From b592c6eae5015e6b01198212444a3b852bda27d0 Mon Sep 17 00:00:00 2001 From: sneed Date: Thu, 23 May 2024 02:45:22 +0300 Subject: [PATCH 35/54] Add POKE_ICON_BASE_PAL_TAG to a header --- include/constants/pokemon_icon.h | 6 ++++++ src/pokemon_icon.c | 3 +-- src/pokemon_storage_system.c | 3 ++- 3 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 include/constants/pokemon_icon.h diff --git a/include/constants/pokemon_icon.h b/include/constants/pokemon_icon.h new file mode 100644 index 0000000000..d57d5111a9 --- /dev/null +++ b/include/constants/pokemon_icon.h @@ -0,0 +1,6 @@ +#ifndef GUARD_CONSTANTS_POKEMON_ICON_H +#define GUARD_CONSTANTS_POKEMON_ICON_H + +#define POKE_ICON_BASE_PAL_TAG 56000 + +#endif // GUARD_CONSTANTS_POKEMON_ICON_H diff --git a/src/pokemon_icon.c b/src/pokemon_icon.c index e659eebe21..caed0bcdc3 100644 --- a/src/pokemon_icon.c +++ b/src/pokemon_icon.c @@ -4,8 +4,7 @@ #include "palette.h" #include "pokemon_icon.h" #include "sprite.h" - -#define POKE_ICON_BASE_PAL_TAG 56000 +#include "constants/pokemon_icon.h" #define INVALID_ICON_SPECIES SPECIES_OLD_UNOWN_J // Oddly specific, used when an icon should be a ?. Any of the 'old unown' would work diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index c8c87961c8..b398b88752 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -40,6 +40,7 @@ #include "constants/moves.h" #include "constants/rgb.h" #include "constants/songs.h" +#include "constants/pokemon_icon.h" /* NOTE: This file is large. Some general groups of functions have @@ -215,7 +216,7 @@ enum { #define BOXID_CANCELED 201 enum { - PALTAG_MON_ICON_0 = 56000, + PALTAG_MON_ICON_0 = POKE_ICON_BASE_PAL_TAG, PALTAG_MON_ICON_1, // Used implicitly in CreateMonIconSprite PALTAG_MON_ICON_2, // Used implicitly in CreateMonIconSprite PALTAG_3, // Unused From ef2330593c7762d20865b2442d9b3e30c1b5e6f2 Mon Sep 17 00:00:00 2001 From: leo60228 Date: Wed, 29 May 2024 19:32:17 -0400 Subject: [PATCH 36/54] Don't assume bash is at /bin/bash --- Makefile | 2 +- asmdiff.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 50953be79c..21c010003b 100644 --- a/Makefile +++ b/Makefile @@ -73,7 +73,7 @@ MODERN_ELF_NAME := $(MODERN_ROM_NAME:.gba=.elf) MODERN_MAP_NAME := $(MODERN_ROM_NAME:.gba=.map) MODERN_OBJ_DIR_NAME := build/modern -SHELL := /bin/bash -o pipefail +SHELL := bash -o pipefail ELF = $(ROM:.gba=.elf) MAP = $(ROM:.gba=.map) diff --git a/asmdiff.sh b/asmdiff.sh index f5a7010747..aca670e324 100755 --- a/asmdiff.sh +++ b/asmdiff.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash if [[ -d "$DEVKITARM/bin/" ]]; then OBJDUMP_BIN="$DEVKITARM/bin/arm-none-eabi-objdump" From d8d4885c11dbf99538b6c474cf23f77d1b7ce95b Mon Sep 17 00:00:00 2001 From: leo60228 Date: Wed, 29 May 2024 18:53:16 -0400 Subject: [PATCH 37/54] Add NixOS install instructions --- INSTALL.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/INSTALL.md b/INSTALL.md index 920e03c713..964de4b68f 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -354,6 +354,13 @@ Then proceed to [Choosing where to store pokeemerald (Linux)](#choosing-where-to > [install devkitARM on Arch Linux](#installing-devkitarm-on-arch-linux). +### NixOS +Run the following command to start an interactive shell with the necessary packages: +```bash +nix-shell -p pkgsCross.arm-embedded.stdenv.cc git pkg-config libpng +``` +Then proceed to [Choosing where to store pokeemerald Expansion (Linux)](#choosing-where-to-store-pokeemerald-expansion-linux). + ### Other distributions _(Specific instructions for other distributions would be greatly appreciated!)_ From 189d542520e57b9a09a223ba3ee99115f6726af2 Mon Sep 17 00:00:00 2001 From: Jaizu Date: Mon, 17 Jun 2024 21:44:52 +0200 Subject: [PATCH 38/54] Fix Steven partner battle post-battle script (#2001) --- data/maps/MossdeepCity_SpaceCenter_2F/scripts.inc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/data/maps/MossdeepCity_SpaceCenter_2F/scripts.inc b/data/maps/MossdeepCity_SpaceCenter_2F/scripts.inc index 4a22bf8eea..c82a33e78d 100644 --- a/data/maps/MossdeepCity_SpaceCenter_2F/scripts.inc +++ b/data/maps/MossdeepCity_SpaceCenter_2F/scripts.inc @@ -320,6 +320,9 @@ MossdeepCity_SpaceCenter_2F_EventScript_DefeatedMaxieTabitha:: setobjectmovementtype LOCALID_SCIENTIST, MOVEMENT_TYPE_WANDER_AROUND addobject LOCALID_SCIENTIST fadescreen FADE_FROM_BLACK +#ifdef BUGFIX + releaseall +#endif end MossdeepCity_SpaceCenter_2F_EventScript_StevenFacePlayer:: From c0d630ee6304df61a5304942386308a872aeb504 Mon Sep 17 00:00:00 2001 From: Alex Nash Date: Mon, 17 Jun 2024 22:45:10 -0400 Subject: [PATCH 39/54] Add support for LF line endings to gbagfx --- tools/gbagfx/jasc_pal.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/gbagfx/jasc_pal.c b/tools/gbagfx/jasc_pal.c index e5ba9c3c2f..8d4bb137d5 100644 --- a/tools/gbagfx/jasc_pal.c +++ b/tools/gbagfx/jasc_pal.c @@ -46,10 +46,14 @@ void ReadJascPaletteLine(FILE *fp, char *line) } if (c == '\n') - FATAL_ERROR("LF line endings aren't supported.\n"); + { + line[length] = 0; + + return; + } if (c == EOF) - FATAL_ERROR("Unexpected EOF. No CRLF at end of file.\n"); + FATAL_ERROR("Unexpected EOF. No LF or CRLF at end of file.\n"); if (c == 0) FATAL_ERROR("NUL character in file.\n"); From 5dac97aa5d7f562fa544a9e57b4e8ba78db3115b Mon Sep 17 00:00:00 2001 From: leo60228 Date: Thu, 20 Jun 2024 15:55:47 -0400 Subject: [PATCH 40/54] Fix pokeemerald-expansion reference in INSTALL.md --- INSTALL.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/INSTALL.md b/INSTALL.md index 964de4b68f..30b5d0f25a 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -359,7 +359,7 @@ Run the following command to start an interactive shell with the necessary packa ```bash nix-shell -p pkgsCross.arm-embedded.stdenv.cc git pkg-config libpng ``` -Then proceed to [Choosing where to store pokeemerald Expansion (Linux)](#choosing-where-to-store-pokeemerald-expansion-linux). +Then proceed to [Choosing where to store pokeemerald (Linux)](#choosing-where-to-store-pokeemerald-linux). ### Other distributions _(Specific instructions for other distributions would be greatly appreciated!)_ From 5eea3d39cd50955e62904d146f67f65dc001b735 Mon Sep 17 00:00:00 2001 From: cawtds <38510667+cawtds@users.noreply.github.com> Date: Tue, 25 Jun 2024 21:53:05 +0200 Subject: [PATCH 41/54] UB fix ClockwiseWipe_TopRight --- src/battle_transition.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/battle_transition.c b/src/battle_transition.c index 11f9cddf4b..c23578e608 100644 --- a/src/battle_transition.c +++ b/src/battle_transition.c @@ -1907,7 +1907,11 @@ static bool8 ClockwiseWipe_TopRight(struct Task *task) { sTransitionData->VBlank_DMA = FALSE; +#ifdef UBFIX + InitBlackWipe(sTransitionData->data, DISPLAY_WIDTH / 2, DISPLAY_HEIGHT / 2, sTransitionData->tWipeEndX, 0, 1, 1); +#else InitBlackWipe(sTransitionData->data, DISPLAY_WIDTH / 2, DISPLAY_HEIGHT / 2, sTransitionData->tWipeEndX, -1, 1, 1); +#endif do { gScanlineEffectRegBuffers[0][sTransitionData->tWipeCurrY] = (sTransitionData->tWipeCurrX + 1) | ((DISPLAY_WIDTH / 2) << 8); From 779855ee02226cb4da16ab6d7a7822a8b0a6e3be Mon Sep 17 00:00:00 2001 From: abcboy101 <16735361+abcboy101@users.noreply.github.com> Date: Sat, 29 Jun 2024 13:59:30 -0400 Subject: [PATCH 42/54] Decode unused JP text in berry_blender.c --- src/berry_blender.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/berry_blender.c b/src/berry_blender.c index a91cafb0fb..1242a1dad9 100644 --- a/src/berry_blender.c +++ b/src/berry_blender.c @@ -916,14 +916,14 @@ static const u8 sBlackPokeblockFlavorFlags[] = { (1 << FLAVOR_SOUR) | (1 << FLAVOR_SWEET) | (1 << FLAVOR_SPICY), }; -static const u8 sUnused[] = -{ - 0xfe, 0x02, 0x02, 0xce, 0xd0, 0x37, 0x44, 0x07, 0x1f, 0x0c, 0x10, - 0x00, 0xff, 0xfe, 0x91, 0x72, 0xce, 0xd0, 0x37, 0x44, 0x07, 0x1f, - 0x0c, 0x10, 0x00, 0xff, 0x06, 0x27, 0x02, 0xff, 0x00, 0x0c, 0x48, - 0x02, 0xff, 0x00, 0x01, 0x1f, 0x02, 0xff, 0x00, 0x16, 0x37, 0x02, - 0xff, 0x00, 0x0d, 0x50, 0x4b, 0x02, 0xff, 0x06, 0x06, 0x06, 0x06, - 0x05, 0x03, 0x03, 0x03, 0x02, 0x02, 0x03, 0x03, 0x03, 0x03, 0x02 +static const u8 sJPText_GoodTvReady[] = _("\nいいTVができました "); // Unused +static const u8 sJPText_BadTvReady[] = _("\nダメTVができました "); // Unused +static const u8 sJPText_Flavors[][5] = {_("からい"), _("しぶい"), _("あまい"), _("にがい"), _("すっぱい")}; // Unused + +static const u8 sUnused[] = { + 6, 6, 6, 6, 5, + 3, 3, 3, 2, 2, + 3, 3, 3, 3, 2 }; static const struct WindowTemplate sBlenderRecordWindowTemplate = From 47533e3a7ebd60e54b34c6ef3a367bf19b5dd96f Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Thu, 4 Jul 2024 20:56:22 +0200 Subject: [PATCH 43/54] Berry blender's Task_HandleOpponent small fixes --- src/berry_blender.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/src/berry_blender.c b/src/berry_blender.c index 1242a1dad9..a5102d48fb 100644 --- a/src/berry_blender.c +++ b/src/berry_blender.c @@ -1908,7 +1908,7 @@ static void Task_HandleOpponent1(u8 taskId) static void Task_HandleOpponent2(u8 taskId) { u32 var1 = (sBerryBlender->arrowPos + 0x1800) & 0xFFFF; - u32 arrowId = sBerryBlender->playerIdToArrowId[2] & 0xFF; + u8 arrowId = sBerryBlender->playerIdToArrowId[2]; if ((var1 >> 8) > sArrowHitRangeStart[arrowId] + 20 && (var1 >> 8) < sArrowHitRangeStart[arrowId] + 40) { if (!gTasks[taskId].tDidInput) @@ -1925,11 +1925,9 @@ static void Task_HandleOpponent2(u8 taskId) } else { - u8 value; if (rand > 65) gRecvCmds[2][BLENDER_COMM_SCORE] = LINKCMD_BLENDER_SCORE_BEST; - value = rand - 41; - if (value < 25) + if (rand > 40 && rand <= 65) gRecvCmds[2][BLENDER_COMM_SCORE] = LINKCMD_BLENDER_SCORE_GOOD; if (rand < 10) CreateOpponentMissTask(2, 5); @@ -1953,7 +1951,7 @@ static void Task_HandleOpponent2(u8 taskId) static void Task_HandleOpponent3(u8 taskId) { u32 var1 = (sBerryBlender->arrowPos + 0x1800) & 0xFFFF; - u32 arrowId = sBerryBlender->playerIdToArrowId[3] & 0xFF; + u8 arrowId = sBerryBlender->playerIdToArrowId[3]; if ((var1 >> 8) > sArrowHitRangeStart[arrowId] + 20 && (var1 >> 8) < sArrowHitRangeStart[arrowId] + 40) { if (gTasks[taskId].data[0] == 0) @@ -1971,16 +1969,9 @@ static void Task_HandleOpponent3(u8 taskId) else { if (rand > 60) - { gRecvCmds[3][BLENDER_COMM_SCORE] = LINKCMD_BLENDER_SCORE_BEST; - } - else - { - s8 value = rand - 56; // makes me wonder what the original code was - u8 value2 = value; - if (value2 < 5) - gRecvCmds[3][BLENDER_COMM_SCORE] = LINKCMD_BLENDER_SCORE_GOOD; - } + else if (rand > 55 && rand <= 60) + gRecvCmds[3][BLENDER_COMM_SCORE] = LINKCMD_BLENDER_SCORE_GOOD; if (rand < 5) CreateOpponentMissTask(3, 5); } From 550e6688aa3b511a9aa9ea851c49ba4d90c7708a Mon Sep 17 00:00:00 2001 From: Philipp AUER Date: Sat, 13 Jul 2024 19:26:33 +0200 Subject: [PATCH 44/54] Support C-Style `enum` in preproc (#1984) * [preproc] C-style enums - asm files parseable from stdin - 2nd preproc pass - add parser for C-style `enum` - positional arguments at end of command --------- Co-authored-by: sbird Co-authored-by: Martin Griffin --- Makefile | 14 +-- tools/preproc/Makefile | 4 +- tools/preproc/asm_file.cpp | 223 ++++++++++++++++++++++++++++++++----- tools/preproc/asm_file.h | 9 +- tools/preproc/c_file.cpp | 48 +------- tools/preproc/c_file.h | 2 - tools/preproc/io.cpp | 51 +++++++++ tools/preproc/io.h | 8 ++ tools/preproc/preproc.cpp | 83 ++++++++++---- 9 files changed, 339 insertions(+), 103 deletions(-) create mode 100644 tools/preproc/io.cpp create mode 100644 tools/preproc/io.h diff --git a/Makefile b/Makefile index 21c010003b..bf74e0331a 100644 --- a/Makefile +++ b/Makefile @@ -311,7 +311,7 @@ ifeq ($(NODEP),1) $(C_BUILDDIR)/%.o: $(C_SUBDIR)/%.c ifeq (,$(KEEP_TEMPS)) @echo "$(CC1) -o $@ $<" - @$(CPP) $(CPPFLAGS) $< | $(PREPROC) $< charmap.txt -i | $(CC1) $(CFLAGS) -o - - | cat - <(echo -e ".text\n\t.align\t2, 0") | $(AS) $(ASFLAGS) -o $@ - + @$(CPP) $(CPPFLAGS) $< | $(PREPROC) -i $< charmap.txt | $(CC1) $(CFLAGS) -o - - | cat - <(echo -e ".text\n\t.align\t2, 0") | $(AS) $(ASFLAGS) -o $@ - else @$(CPP) $(CPPFLAGS) $< -o $(C_BUILDDIR)/$*.i @$(PREPROC) $(C_BUILDDIR)/$*.i charmap.txt | $(CC1) $(CFLAGS) -o $(C_BUILDDIR)/$*.s @@ -323,7 +323,7 @@ define C_DEP $1: $2 $$(shell $(SCANINC) -I include -I tools/agbcc/include -I gflib $2) ifeq (,$$(KEEP_TEMPS)) @echo "$$(CC1) -o $$@ $$<" - @$$(CPP) $$(CPPFLAGS) $$< | $$(PREPROC) $$< charmap.txt -i | $$(CC1) $$(CFLAGS) -o - - | cat - <(echo -e ".text\n\t.align\t2, 0") | $$(AS) $$(ASFLAGS) -o $$@ - + @$$(CPP) $$(CPPFLAGS) $$< | $$(PREPROC) -i $$< charmap.txt | $$(CC1) $$(CFLAGS) -o - - | cat - <(echo -e ".text\n\t.align\t2, 0") | $$(AS) $$(ASFLAGS) -o $$@ - else @$$(CPP) $$(CPPFLAGS) $$< -o $$(C_BUILDDIR)/$3.i @$$(PREPROC) $$(C_BUILDDIR)/$3.i charmap.txt | $$(CC1) $$(CFLAGS) -o $$(C_BUILDDIR)/$3.s @@ -338,7 +338,7 @@ ifeq ($(NODEP),1) $(GFLIB_BUILDDIR)/%.o: $(GFLIB_SUBDIR)/%.c $$(c_dep) ifeq (,$(KEEP_TEMPS)) @echo "$(CC1) -o $@ $<" - @$(CPP) $(CPPFLAGS) $< | $(PREPROC) $< charmap.txt -i | $(CC1) $(CFLAGS) -o - - | cat - <(echo -e ".text\n\t.align\t2, 0") | $(AS) $(ASFLAGS) -o $@ - + @$(CPP) $(CPPFLAGS) $< | $(PREPROC) -i $< charmap.txt | $(CC1) $(CFLAGS) -o - - | cat - <(echo -e ".text\n\t.align\t2, 0") | $(AS) $(ASFLAGS) -o $@ - else @$(CPP) $(CPPFLAGS) $< -o $(GFLIB_BUILDDIR)/$*.i @$(PREPROC) $(GFLIB_BUILDDIR)/$*.i charmap.txt | $(CC1) $(CFLAGS) -o $(GFLIB_BUILDDIR)/$*.s @@ -350,7 +350,7 @@ define GFLIB_DEP $1: $2 $$(shell $(SCANINC) -I include -I tools/agbcc/include -I gflib $2) ifeq (,$$(KEEP_TEMPS)) @echo "$$(CC1) -o $$@ $$<" - @$$(CPP) $$(CPPFLAGS) $$< | $$(PREPROC) $$< charmap.txt -i | $$(CC1) $$(CFLAGS) -o - - | cat - <(echo -e ".text\n\t.align\t2, 0") | $$(AS) $$(ASFLAGS) -o $$@ - + @$$(CPP) $$(CPPFLAGS) $$< | $$(PREPROC) -i $$< charmap.txt | $$(CC1) $$(CFLAGS) -o - - | cat - <(echo -e ".text\n\t.align\t2, 0") | $$(AS) $$(ASFLAGS) -o $$@ - else @$$(CPP) $$(CPPFLAGS) $$< -o $$(GFLIB_BUILDDIR)/$3.i @$$(PREPROC) $$(GFLIB_BUILDDIR)/$3.i charmap.txt | $$(CC1) $$(CFLAGS) -o $$(GFLIB_BUILDDIR)/$3.s @@ -363,11 +363,11 @@ endif ifeq ($(NODEP),1) $(C_BUILDDIR)/%.o: $(C_SUBDIR)/%.s - $(PREPROC) $< charmap.txt | $(CPP) -I include - | $(AS) $(ASFLAGS) -o $@ + $(PREPROC) $< charmap.txt | $(CPP) -I include - | $(PREPROC) -i $$< charmap.txt | $(AS) $(ASFLAGS) -o $@ else define SRC_ASM_DATA_DEP $1: $2 $$(shell $(SCANINC) -I include -I "" $2) - $$(PREPROC) $$< charmap.txt | $$(CPP) -I include - | $$(AS) $$(ASFLAGS) -o $$@ + $$(PREPROC) $$< charmap.txt | $$(CPP) -I include - | $$(PREPROC) -ie $$< charmap.txt | $$(AS) $$(ASFLAGS) -o $$@ endef $(foreach src, $(C_ASM_SRCS), $(eval $(call SRC_ASM_DATA_DEP,$(patsubst $(C_SUBDIR)/%.s,$(C_BUILDDIR)/%.o, $(src)),$(src)))) endif @@ -385,7 +385,7 @@ endif ifeq ($(NODEP),1) $(DATA_ASM_BUILDDIR)/%.o: $(DATA_ASM_SUBDIR)/%.s - $(PREPROC) $< charmap.txt | $(CPP) -I include - | $(AS) $(ASFLAGS) -o $@ + $(PREPROC) $< charmap.txt | $(CPP) -I include - | $(PREPROC) -ie $$< charmap.txt | $(AS) $(ASFLAGS) -o $@ else $(foreach src, $(REGULAR_DATA_ASM_SRCS), $(eval $(call SRC_ASM_DATA_DEP,$(patsubst $(DATA_ASM_SUBDIR)/%.s,$(DATA_ASM_BUILDDIR)/%.o, $(src)),$(src)))) endif diff --git a/tools/preproc/Makefile b/tools/preproc/Makefile index 1507c973f2..606318944c 100644 --- a/tools/preproc/Makefile +++ b/tools/preproc/Makefile @@ -3,10 +3,10 @@ CXX ?= g++ CXXFLAGS := -std=c++11 -O2 -Wall -Wno-switch -Werror SRCS := asm_file.cpp c_file.cpp charmap.cpp preproc.cpp string_parser.cpp \ - utf8.cpp + utf8.cpp io.cpp HEADERS := asm_file.h c_file.h char_util.h charmap.h preproc.h string_parser.h \ - utf8.h + utf8.h io.h ifeq ($(OS),Windows_NT) EXE := .exe diff --git a/tools/preproc/asm_file.cpp b/tools/preproc/asm_file.cpp index 04a7410e00..ca8b8cc4ae 100644 --- a/tools/preproc/asm_file.cpp +++ b/tools/preproc/asm_file.cpp @@ -27,33 +27,12 @@ #include "utf8.h" #include "string_parser.h" #include "../../gflib/characters.h" +#include "io.h" -AsmFile::AsmFile(std::string filename) : m_filename(filename) +AsmFile::AsmFile(std::string filename, bool isStdin, bool doEnum) : m_filename(filename) { - FILE *fp = std::fopen(filename.c_str(), "rb"); - - if (fp == NULL) - FATAL_ERROR("Failed to open \"%s\" for reading.\n", filename.c_str()); - - std::fseek(fp, 0, SEEK_END); - - m_size = std::ftell(fp); - - if (m_size < 0) - FATAL_ERROR("File size of \"%s\" is less than zero.\n", filename.c_str()); - else if (m_size == 0) - return; // Empty file - - m_buffer = new char[m_size + 1]; - - std::rewind(fp); - - if (std::fread(m_buffer, m_size, 1, fp) != 1) - FATAL_ERROR("Failed to read \"%s\".\n", filename.c_str()); - - m_buffer[m_size] = 0; - - std::fclose(fp); + m_buffer = ReadFileToBuffer(filename.c_str(), isStdin, &m_size); + m_doEnum = doEnum; m_pos = 0; m_lineNum = 1; @@ -65,6 +44,7 @@ AsmFile::AsmFile(std::string filename) : m_filename(filename) AsmFile::AsmFile(AsmFile&& other) : m_filename(std::move(other.m_filename)) { m_buffer = other.m_buffer; + m_doEnum = other.m_doEnum; m_pos = other.m_pos; m_size = other.m_size; m_lineNum = other.m_lineNum; @@ -174,6 +154,8 @@ Directive AsmFile::GetDirective() return Directive::String; else if (CheckForDirective(".braille")) return Directive::Braille; + else if (CheckForDirective("enum")) + return Directive::Enum; else return Directive::Unknown; } @@ -527,6 +509,70 @@ void AsmFile::OutputLine() } } +// parses an assumed C `enum`. Returns false if `enum { ...` is not matched +bool AsmFile::ParseEnum() +{ + if (!m_doEnum) + return false; + + long fallbackPosition = m_pos; + std::string headerFilename = ""; + long currentHeaderLine = SkipWhitespaceAndEol(); + std::string enumName = ReadIdentifier(); + currentHeaderLine += SkipWhitespaceAndEol(); + long enumCounter = 0; + long symbolCount = 0; + + if (m_buffer[m_pos] != '{') // assume assembly macro, otherwise assume enum and report errors accordingly + { + m_pos = fallbackPosition - 4; + return false; + } + + currentHeaderLine += FindLastLineNumber(headerFilename); + m_pos++; + for (;;) + { + currentHeaderLine += SkipWhitespaceAndEol(); + std::string currentIdentName = ReadIdentifier(); + if (!currentIdentName.empty()) + { + std::printf("# %ld \"%s\"\n", currentHeaderLine, headerFilename.c_str()); + currentHeaderLine += SkipWhitespaceAndEol(); + if (m_buffer[m_pos] == '=') + { + m_pos++; + currentHeaderLine += SkipWhitespaceAndEol(); + enumCounter = ReadInteger(headerFilename, currentHeaderLine); + currentHeaderLine += SkipWhitespaceAndEol(); + } + std::printf(".equiv %s, %ld\n", currentIdentName.c_str(), enumCounter); + enumCounter++; + symbolCount++; + } + else if (symbolCount == 0) + { + RaiseError("%s:%ld: empty enum is invalid", headerFilename.c_str(), currentHeaderLine); + } + + if (m_buffer[m_pos] != ',') + { + currentHeaderLine += SkipWhitespaceAndEol(); + if (m_buffer[m_pos++] == '}' && m_buffer[m_pos++] == ';') + { + ExpectEmptyRestOfLine(); + break; + } + else + { + RaiseError("unterminated enum from included file %s:%ld", headerFilename.c_str(), currentHeaderLine); + } + } + m_pos++; + } + return true; +} + // Asserts that the rest of the line is empty and moves to the next one. void AsmFile::ExpectEmptyRestOfLine() { @@ -599,3 +645,130 @@ void AsmFile::RaiseWarning(const char* format, ...) { DO_REPORT("warning"); } + +// Skips Whitespace including newlines and returns the amount of newlines skipped +int AsmFile::SkipWhitespaceAndEol() +{ + int newlines = 0; + while (m_buffer[m_pos] == '\t' || m_buffer[m_pos] == ' ' || m_buffer[m_pos] == '\n') + { + if (m_buffer[m_pos] == '\n') + newlines++; + m_pos++; + } + return newlines; +} + +// returns the last line indicator and its corresponding file name without modifying the token index +int AsmFile::FindLastLineNumber(std::string& filename) +{ + long pos = m_pos; + long linebreaks = 0; + while (m_buffer[pos] != '#' && pos >= 0) + { + if (m_buffer[pos] == '\n') + linebreaks++; + pos--; + } + + if (pos < 0) + RaiseError("line indicator for header file not found before `enum`"); + + pos++; + while (m_buffer[pos] == ' ' || m_buffer[pos] == '\t') + pos++; + + if (!IsAsciiDigit(m_buffer[pos])) + RaiseError("malformatted line indicator found before `enum`, expected line number"); + + unsigned n = 0; + int digit = 0; + while ((digit = ConvertDigit(m_buffer[pos++], 10)) != -1) + n = 10 * n + digit; + + while (m_buffer[pos] == ' ' || m_buffer[pos] == '\t') + pos++; + + if (m_buffer[pos++] != '"') + RaiseError("malformatted line indicator found before `enum`, expected filename"); + + while (m_buffer[pos] != '"') + { + unsigned char c = m_buffer[pos++]; + + if (c == 0) + { + if (pos >= m_size) + RaiseError("unexpected EOF in line indicator"); + else + RaiseError("unexpected null character in line indicator"); + } + + if (!IsAsciiPrintable(c)) + RaiseError("unexpected character '\\x%02X' in line indicator", c); + + if (c == '\\') + { + c = m_buffer[pos]; + RaiseError("unexpected escape '\\%c' in line indicator", c); + } + + filename += c; + } + + return n + linebreaks - 1; +} + +std::string AsmFile::ReadIdentifier() +{ + long start = m_pos; + if (!IsIdentifierStartingChar(m_buffer[m_pos])) + return std::string(); + + m_pos++; + + while (IsIdentifierChar(m_buffer[m_pos])) + m_pos++; + + return std::string(&m_buffer[start], m_pos - start); +} + +long AsmFile::ReadInteger(std::string filename, long line) +{ + bool negate = false; + int radix = 10; + if (!IsAsciiDigit(m_buffer[m_pos])) + { + if (m_buffer[m_pos++] == '-') + negate = true; + else + RaiseError("expected number in included file %s:%ld", filename.c_str(), line); + } + + if (m_buffer[m_pos] == '0' && m_buffer[m_pos + 1] == 'x') + { + radix = 16; + m_pos += 2; + } + else if (m_buffer[m_pos] == '0' && m_buffer[m_pos + 1] == 'b') + { + radix = 2; + m_pos += 2; + } + else if (m_buffer[m_pos] == '0' && IsAsciiDigit(m_buffer[m_pos+1])) + { + radix = 8; + m_pos++; + } + + long n = 0; + int digit; + + while ((digit = ConvertDigit(m_buffer[m_pos], radix)) != -1) + { + n = n * radix + digit; + m_pos++; + } + + return negate ? -n : n; +} diff --git a/tools/preproc/asm_file.h b/tools/preproc/asm_file.h index 29435f76a4..33e6ce5c49 100644 --- a/tools/preproc/asm_file.h +++ b/tools/preproc/asm_file.h @@ -31,13 +31,14 @@ enum class Directive Include, String, Braille, + Enum, Unknown }; class AsmFile { public: - AsmFile(std::string filename); + AsmFile(std::string filename, bool isStdin, bool doEnum); AsmFile(AsmFile&& other); AsmFile(const AsmFile&) = delete; ~AsmFile(); @@ -49,9 +50,11 @@ public: bool IsAtEnd(); void OutputLine(); void OutputLocation(); + bool ParseEnum(); private: char* m_buffer; + bool m_doEnum; long m_pos; long m_size; long m_lineNum; @@ -68,6 +71,10 @@ private: void RaiseError(const char* format, ...); void RaiseWarning(const char* format, ...); void VerifyStringLength(int length); + int SkipWhitespaceAndEol(); + int FindLastLineNumber(std::string& filename); + std::string ReadIdentifier(); + long ReadInteger(std::string filename, long line); }; #endif // ASM_FILE_H diff --git a/tools/preproc/c_file.cpp b/tools/preproc/c_file.cpp index 508c628731..191ca4c152 100644 --- a/tools/preproc/c_file.cpp +++ b/tools/preproc/c_file.cpp @@ -30,56 +30,16 @@ #include "char_util.h" #include "utf8.h" #include "string_parser.h" +#include "io.h" CFile::CFile(const char * filenameCStr, bool isStdin) { - FILE *fp; - - if (isStdin) { - fp = stdin; + if (isStdin) m_filename = std::string{"/"}.append(filenameCStr); - } else { - fp = std::fopen(filenameCStr, "rb"); + else m_filename = std::string(filenameCStr); - } - std::string& filename = m_filename; - - if (fp == NULL) - FATAL_ERROR("Failed to open \"%s\" for reading.\n", filename.c_str()); - - m_size = 0; - m_buffer = (char *)malloc(CHUNK_SIZE + 1); - if (m_buffer == NULL) { - FATAL_ERROR("Failed to allocate memory to process file \"%s\"!", filename.c_str()); - } - - std::size_t numAllocatedBytes = CHUNK_SIZE + 1; - std::size_t bufferOffset = 0; - std::size_t count; - - while ((count = std::fread(m_buffer + bufferOffset, 1, CHUNK_SIZE, fp)) != 0) { - if (!std::ferror(fp)) { - m_size += count; - - if (std::feof(fp)) { - break; - } - - numAllocatedBytes += CHUNK_SIZE; - bufferOffset += CHUNK_SIZE; - m_buffer = (char *)realloc(m_buffer, numAllocatedBytes); - if (m_buffer == NULL) { - FATAL_ERROR("Failed to allocate memory to process file \"%s\"!", filename.c_str()); - } - } else { - FATAL_ERROR("Failed to read \"%s\". (error: %s)", filename.c_str(), std::strerror(errno)); - } - } - - m_buffer[m_size] = 0; - - std::fclose(fp); + m_buffer = ReadFileToBuffer(filenameCStr, isStdin, &m_size); m_pos = 0; m_lineNum = 1; diff --git a/tools/preproc/c_file.h b/tools/preproc/c_file.h index 49e633a18d..c40c33c962 100644 --- a/tools/preproc/c_file.h +++ b/tools/preproc/c_file.h @@ -56,6 +56,4 @@ private: void RaiseWarning(const char* format, ...); }; -#define CHUNK_SIZE 4096 - #endif // C_FILE_H diff --git a/tools/preproc/io.cpp b/tools/preproc/io.cpp new file mode 100644 index 0000000000..321676180d --- /dev/null +++ b/tools/preproc/io.cpp @@ -0,0 +1,51 @@ +#include "preproc.h" +#include "io.h" +#include +#include +#include + +char *ReadFileToBuffer(const char *filename, bool isStdin, long *size) +{ + FILE *fp; + if (isStdin) + fp = stdin; + else + fp = std::fopen(filename, "rb"); + + if (fp == NULL) + FATAL_ERROR("Failed to open \"%s\" for reading.\n", filename); + + *size = 0; + char *buffer = (char *)malloc(CHUNK_SIZE + 1); + if (buffer == NULL) { + FATAL_ERROR("Failed to allocate memory to process file \"%s\"!", filename); + } + + std::size_t numAllocatedBytes = CHUNK_SIZE + 1; + std::size_t bufferOffset = 0; + std::size_t count; + + while ((count = std::fread(buffer + bufferOffset, 1, CHUNK_SIZE, fp)) != 0) { + if (!std::ferror(fp)) { + *size += count; + + if (std::feof(fp)) { + break; + } + + numAllocatedBytes += CHUNK_SIZE; + bufferOffset += CHUNK_SIZE; + buffer = (char *)realloc(buffer, numAllocatedBytes); + if (buffer == NULL) { + FATAL_ERROR("Failed to allocate memory to process file \"%s\"!", filename); + } + } else { + FATAL_ERROR("Failed to read \"%s\". (error: %s)", filename, std::strerror(errno)); + } + } + + buffer[*size] = 0; + + std::fclose(fp); + return buffer; +} diff --git a/tools/preproc/io.h b/tools/preproc/io.h new file mode 100644 index 0000000000..ac4e91051f --- /dev/null +++ b/tools/preproc/io.h @@ -0,0 +1,8 @@ +#ifndef IO_H_ +#define IO_H_ + +#define CHUNK_SIZE 4096 + +char *ReadFileToBuffer(const char *filename, bool isStdin, long *size); + +#endif // IO_H_ diff --git a/tools/preproc/preproc.cpp b/tools/preproc/preproc.cpp index eb2d4c8a23..20c2de51b6 100644 --- a/tools/preproc/preproc.cpp +++ b/tools/preproc/preproc.cpp @@ -20,11 +20,14 @@ #include #include +#include #include "preproc.h" #include "asm_file.h" #include "c_file.h" #include "charmap.h" +static void UsageAndExit(const char *program); + Charmap* g_charmap; void PrintAsmBytes(unsigned char *s, int length) @@ -43,11 +46,12 @@ void PrintAsmBytes(unsigned char *s, int length) } } -void PreprocAsmFile(std::string filename) +void PreprocAsmFile(std::string filename, bool isStdin, bool doEnum) { std::stack stack; - stack.push(AsmFile(filename)); + stack.push(AsmFile(filename, isStdin, doEnum)); + std::printf("# 1 \"%s\"\n", filename.c_str()); for (;;) { @@ -66,7 +70,7 @@ void PreprocAsmFile(std::string filename) switch (directive) { case Directive::Include: - stack.push(AsmFile(stack.top().ReadPath())); + stack.push(AsmFile(stack.top().ReadPath(), false, doEnum)); stack.top().OutputLocation(); break; case Directive::String: @@ -83,6 +87,12 @@ void PreprocAsmFile(std::string filename) PrintAsmBytes(s, length); break; } + case Directive::Enum: + { + if (!stack.top().ParseEnum()) + stack.top().OutputLine(); + break; + } case Directive::Unknown: { std::string globalLabel = stack.top().GetGlobalLabel(); @@ -109,9 +119,9 @@ void PreprocCFile(const char * filename, bool isStdin) cFile.Preproc(); } -char* GetFileExtension(char* filename) +const char* GetFileExtension(const char* filename) { - char* extension = filename; + const char* extension = filename; while (*extension != 0) extension++; @@ -130,35 +140,64 @@ char* GetFileExtension(char* filename) return extension; } +static void UsageAndExit(const char *program) +{ + std::fprintf(stderr, "Usage: %s [-i] [-e] SRC_FILE CHARMAP_FILE\nwhere -i denotes if input is from stdin\n -e enables enum handling\n", program); + std::exit(EXIT_FAILURE); +} + int main(int argc, char **argv) { - if (argc < 3 || argc > 4) + int opt; + const char *source = NULL; + const char *charmap = NULL; + bool isStdin = false; + bool doEnum = false; + + /* preproc [-i] [-e] SRC_FILE CHARMAP_FILE */ + while ((opt = getopt(argc, argv, "ie")) != -1) { - std::fprintf(stderr, "Usage: %s SRC_FILE CHARMAP_FILE [-i]\nwhere -i denotes if input is from stdin\n", argv[0]); - return 1; + switch (opt) + { + case 'i': + isStdin = true; + break; + case 'e': + doEnum = true; + break; + default: + UsageAndExit(argv[0]); + break; + } } - g_charmap = new Charmap(argv[2]); + if (optind + 2 != argc) + UsageAndExit(argv[0]); - char* extension = GetFileExtension(argv[1]); + source = argv[optind + 0]; + charmap = argv[optind + 1]; + + g_charmap = new Charmap(charmap); + + const char* extension = GetFileExtension(source); if (!extension) FATAL_ERROR("\"%s\" has no file extension.\n", argv[1]); if ((extension[0] == 's') && extension[1] == 0) - PreprocAsmFile(argv[1]); - else if ((extension[0] == 'c' || extension[0] == 'i') && extension[1] == 0) { - if (argc == 4) { - if (argv[3][0] == '-' && argv[3][1] == 'i' && argv[3][2] == '\0') { - PreprocCFile(argv[1], true); - } else { - FATAL_ERROR("unknown argument flag \"%s\".\n", argv[3]); - } - } else { - PreprocCFile(argv[1], false); - } - } else + { + PreprocAsmFile(source, isStdin, doEnum); + } + else if ((extension[0] == 'c' || extension[0] == 'i') && extension[1] == 0) + { + if (doEnum) + FATAL_ERROR("-e is invalid for C sources\n"); + PreprocCFile(source, isStdin); + } + else + { FATAL_ERROR("\"%s\" has an unknown file extension of \"%s\".\n", argv[1], extension); + } return 0; } From 3d2b861436a522c83dce702961587dc5486d7fdc Mon Sep 17 00:00:00 2001 From: luckytyphlosion <10688458+luckytyphlosion@users.noreply.github.com> Date: Tue, 23 Jul 2024 17:53:19 -0400 Subject: [PATCH 45/54] Fix WSL1 install instructions --- INSTALL.md | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 30b5d0f25a..7ffcdee07b 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -33,27 +33,23 @@ WSL1 is the preferred terminal to build **pokeemerald**. The following instructi - Otherwise, **open WSL** and go to [Choosing where to store pokeemerald (WSL1)](#Choosing-where-to-store-pokeemerald-WSL1). ### Installing WSL1 -1. Open [Windows Powershell **as Administrator**](https://i.imgur.com/QKmVbP9.png), and run the following command (Right Click or Shift+Insert is paste in the Powershell). +1. Open [Windows Powershell **as Administrator**](https://i.imgur.com/QKmVbP9.png), and run the following commands (Right Click or Shift+Insert is paste in the Powershell). ```powershell - dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart + wsl --install -d Ubuntu --enable-wsl1 ``` 2. Once the process finishes, restart your machine. -3. The next step is to choose and install a Linux distribution from the Microsoft Store. The following instructions will assume Ubuntu as the Linux distribution of choice. +3. Open Windows Powershell **as Administrator** again (after restarting), and run the following command to configure Ubuntu to use WSL1. + + ```powershell + wsl --set-version Ubuntu 1 + ```
- Note for advanced users... + Note... - > You can pick a preferred Linux distribution, but setup instructions may differ. Debian should work with the given instructions, but has not been tested. -
- -4. Open the [Microsoft Store Linux Selection](https://aka.ms/wslstore), click Ubuntu, then click Get, which will install the Ubuntu distribution. -
- Notes... - - > Note 1: If a dialog pops up asking for you to sign into a Microsoft Account, then just close the dialog. - > Note 2: If the link does not work, then open the Microsoft Store manually, and search for the Ubuntu app (choose the one with no version number). + > WSL may open automatically after restarting, but you can ignore it for now.
### Setting up WSL1 From 91b48a10d4f0b4c85ffa0363c19f6979b34889c9 Mon Sep 17 00:00:00 2001 From: pkmnsnfrn Date: Fri, 26 Jul 2024 21:57:42 -0700 Subject: [PATCH 46/54] Added constant for NUM_SNOWFLAKE_SPRITES --- include/constants/field_weather.h | 1 + src/field_weather_effect.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/include/constants/field_weather.h b/include/constants/field_weather.h index e84dbc48c4..fe7eb6a1ae 100644 --- a/include/constants/field_weather.h +++ b/include/constants/field_weather.h @@ -8,6 +8,7 @@ #define NUM_FOG_DIAGONAL_SPRITES 20 #define NUM_SANDSTORM_SPRITES 20 #define NUM_SWIRL_SANDSTORM_SPRITES 5 +#define NUM_SNOWFLAKE_SPRITES 16 // Controls how the weather should be changing the screen palettes. #define WEATHER_PAL_STATE_CHANGING_WEATHER 0 diff --git a/src/field_weather_effect.c b/src/field_weather_effect.c index de0b90c480..10ce1bc37a 100644 --- a/src/field_weather_effect.c +++ b/src/field_weather_effect.c @@ -770,7 +770,7 @@ void Snow_InitVars(void) gWeatherPtr->weatherGfxLoaded = FALSE; gWeatherPtr->targetColorMapIndex = 3; gWeatherPtr->colorMapStepDelay = 20; - gWeatherPtr->targetSnowflakeSpriteCount = 16; + gWeatherPtr->targetSnowflakeSpriteCount = NUM_SNOWFLAKE_SPRITES; gWeatherPtr->snowflakeVisibleCounter = 0; } From 62b4ea5aaad856f7aa43235bcd1384d70f68eb2e Mon Sep 17 00:00:00 2001 From: Frank Date: Thu, 1 Aug 2024 13:18:29 -0400 Subject: [PATCH 47/54] Fixed bottom half of Mt. Pyre not being labeled in PokeNav --- src/landmark.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/landmark.c b/src/landmark.c index 615a9bfe3e..d2bb3c4105 100644 --- a/src/landmark.c +++ b/src/landmark.c @@ -369,8 +369,13 @@ static const struct LandmarkList sLandmarkLists[] = {MAPSEC_ROUTE_120, 2, Landmarks_Route120_2}, {MAPSEC_ROUTE_121, 2, Landmarks_Route121_2}, {MAPSEC_ROUTE_122, 0, Landmarks_Route122_0}, +#ifdef BUGFIX + {MAPSEC_ROUTE_122, 1, Landmarks_Route122_0}, + {MAPSEC_ROUTE_123, 0, Landmarks_Route123_0}, +#else {MAPSEC_ROUTE_123, 0, Landmarks_Route123_0}, {MAPSEC_ROUTE_122, 1, Landmarks_Route122_0}, +#endif {MAPSEC_ROUTE_124, 7, Landmarks_Route124_7}, {MAPSEC_ROUTE_125, 2, Landmarks_Route125_2}, {MAPSEC_ROUTE_128, 1, Landmarks_Route128_1}, From 312749dd3109e607779bb1a15f3669ea2b0979dc Mon Sep 17 00:00:00 2001 From: psf <77138753+pkmnsnfrn@users.noreply.github.com> Date: Tue, 6 Aug 2024 22:44:03 -0700 Subject: [PATCH 48/54] Changed type1 and type2 to be consistent (#2021) * Changed type1 and type2 in gBattleMons to match gSpeciesInfo * Changed monType1 and monType2 to monTypes to match gSpeciesInfo --- include/battle.h | 6 +-- include/battle_controllers.h | 3 +- include/pokemon.h | 3 +- src/battle_ai_script_commands.c | 10 ++--- src/battle_ai_switch_items.c | 4 +- src/battle_controller_player.c | 2 +- src/battle_gfx_sfx_util.c | 2 +- src/battle_main.c | 12 +++--- src/battle_script_commands.c | 68 ++++++++++++++++----------------- src/pokemon.c | 4 +- 10 files changed, 56 insertions(+), 58 deletions(-) diff --git a/include/battle.h b/include/battle.h index 6c4d780186..eb25b96550 100644 --- a/include/battle.h +++ b/include/battle.h @@ -465,11 +465,11 @@ STATIC_ASSERT(sizeof(((struct BattleStruct *)0)->palaceFlags) * 8 >= MAX_BATTLER #define TARGET_TURN_DAMAGED ((gSpecialStatuses[gBattlerTarget].physicalDmg != 0 || gSpecialStatuses[gBattlerTarget].specialDmg != 0)) -#define IS_BATTLER_OF_TYPE(battlerId, type)((gBattleMons[battlerId].type1 == type || gBattleMons[battlerId].type2 == type)) +#define IS_BATTLER_OF_TYPE(battlerId, type)((gBattleMons[battlerId].types[0] == type || gBattleMons[battlerId].types[1] == type)) #define SET_BATTLER_TYPE(battlerId, type) \ { \ - gBattleMons[battlerId].type1 = type; \ - gBattleMons[battlerId].type2 = type; \ + gBattleMons[battlerId].types[0] = type; \ + gBattleMons[battlerId].types[1] = type; \ } #define GET_STAT_BUFF_ID(n)((n & 0xF)) // first four bits 0x1, 0x2, 0x4, 0x8 diff --git a/include/battle_controllers.h b/include/battle_controllers.h index 064c080f61..0024e006b6 100644 --- a/include/battle_controllers.h +++ b/include/battle_controllers.h @@ -124,8 +124,7 @@ struct ChooseMoveStruct u8 currentPp[MAX_MON_MOVES]; u8 maxPp[MAX_MON_MOVES]; u16 species; - u8 monType1; - u8 monType2; + u8 monTypes[2]; }; enum diff --git a/include/pokemon.h b/include/pokemon.h index 6d08f48746..771d947f0a 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -276,8 +276,7 @@ struct BattlePokemon /*0x17*/ u32 abilityNum:1; /*0x18*/ s8 statStages[NUM_BATTLE_STATS]; /*0x20*/ u8 ability; - /*0x21*/ u8 type1; - /*0x22*/ u8 type2; + /*0x21*/ u8 types[2]; /*0x23*/ u8 unknown; /*0x24*/ u8 pp[MAX_MON_MOVES]; /*0x28*/ u16 hp; diff --git a/src/battle_ai_script_commands.c b/src/battle_ai_script_commands.c index 4cb4c51654..716c456794 100644 --- a/src/battle_ai_script_commands.c +++ b/src/battle_ai_script_commands.c @@ -1119,16 +1119,16 @@ static void Cmd_get_type(void) switch (typeVar) { case AI_TYPE1_USER: // AI user primary type - AI_THINKING_STRUCT->funcResult = gBattleMons[sBattler_AI].type1; + AI_THINKING_STRUCT->funcResult = gBattleMons[sBattler_AI].types[0]; break; case AI_TYPE1_TARGET: // target primary type - AI_THINKING_STRUCT->funcResult = gBattleMons[gBattlerTarget].type1; + AI_THINKING_STRUCT->funcResult = gBattleMons[gBattlerTarget].types[0]; break; case AI_TYPE2_USER: // AI user secondary type - AI_THINKING_STRUCT->funcResult = gBattleMons[sBattler_AI].type2; + AI_THINKING_STRUCT->funcResult = gBattleMons[sBattler_AI].types[1]; break; case AI_TYPE2_TARGET: // target secondary type - AI_THINKING_STRUCT->funcResult = gBattleMons[gBattlerTarget].type2; + AI_THINKING_STRUCT->funcResult = gBattleMons[gBattlerTarget].types[1]; break; case AI_TYPE_MOVE: // type of move being pointed to AI_THINKING_STRUCT->funcResult = gBattleMoves[AI_THINKING_STRUCT->moveConsidered].type; @@ -1527,7 +1527,7 @@ static void Cmd_if_type_effectiveness(void) // TypeCalc does not assign to gMoveResultFlags, Cmd_typecalc does // This makes the check for gMoveResultFlags below always fail - // This is how you get the "dual non-immunity" glitch, where AI + // This is how you get the "dual non-immunity" glitch, where AI // will use ineffective moves on immune pokémon if the second type // has a non-neutral, non-immune effectiveness #ifdef BUGFIX diff --git a/src/battle_ai_switch_items.c b/src/battle_ai_switch_items.c index 5ef15b627a..eeb28f8f0f 100644 --- a/src/battle_ai_switch_items.c +++ b/src/battle_ai_switch_items.c @@ -706,8 +706,8 @@ u8 GetMostSuitableMonToSwitchInto(void) u8 type1 = gSpeciesInfo[species].types[0]; u8 type2 = gSpeciesInfo[species].types[1]; u8 typeDmg = TYPE_MUL_NORMAL; - ModulateByTypeEffectiveness(gBattleMons[opposingBattler].type1, type1, type2, &typeDmg); - ModulateByTypeEffectiveness(gBattleMons[opposingBattler].type2, type1, type2, &typeDmg); + ModulateByTypeEffectiveness(gBattleMons[opposingBattler].types[0], type1, type2, &typeDmg); + ModulateByTypeEffectiveness(gBattleMons[opposingBattler].types[1], type1, type2, &typeDmg); /* Possible bug: this comparison gives the type that takes the most damage, when a "good" AI would want to select the type that takes the least damage. Unknown if this diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index 8e09d126c9..e447858fc8 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -485,7 +485,7 @@ static void HandleInputChooseMove(void) PlaySE(SE_SELECT); if (moveInfo->moves[gMoveSelectionCursor[gActiveBattler]] == MOVE_CURSE) { - if (moveInfo->monType1 != TYPE_GHOST && moveInfo->monType2 != TYPE_GHOST) + if (moveInfo->monTypes[0] != TYPE_GHOST && moveInfo->monTypes[1] != TYPE_GHOST) moveTarget = MOVE_TARGET_USER; else moveTarget = MOVE_TARGET_SELECTED; diff --git a/src/battle_gfx_sfx_util.c b/src/battle_gfx_sfx_util.c index a17ebcb5ab..ed8cf572ea 100644 --- a/src/battle_gfx_sfx_util.c +++ b/src/battle_gfx_sfx_util.c @@ -264,7 +264,7 @@ u16 ChooseMoveAndTargetInBattlePalace(void) if (moveInfo->moves[chosenMoveId] == MOVE_CURSE) { - if (moveInfo->monType1 != TYPE_GHOST && moveInfo->monType2 != TYPE_GHOST) + if (moveInfo->monTypes[0] != TYPE_GHOST && moveInfo->monTypes[1] != TYPE_GHOST) moveTarget = MOVE_TARGET_USER; else moveTarget = MOVE_TARGET_SELECTED; diff --git a/src/battle_main.c b/src/battle_main.c index c19089deb0..9039655c4d 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -3343,8 +3343,8 @@ void FaintClearSetData(void) gBattleResources->flags->flags[gActiveBattler] = 0; - gBattleMons[gActiveBattler].type1 = gSpeciesInfo[gBattleMons[gActiveBattler].species].types[0]; - gBattleMons[gActiveBattler].type2 = gSpeciesInfo[gBattleMons[gActiveBattler].species].types[1]; + gBattleMons[gActiveBattler].types[0] = gSpeciesInfo[gBattleMons[gActiveBattler].species].types[0]; + gBattleMons[gActiveBattler].types[1] = gSpeciesInfo[gBattleMons[gActiveBattler].species].types[1]; ClearBattlerMoveHistory(gActiveBattler); ClearBattlerAbilityHistory(gActiveBattler); @@ -3411,8 +3411,8 @@ static void BattleIntroDrawTrainersOrMonsSprites(void) for (i = 0; i < sizeof(struct BattlePokemon); i++) ptr[i] = gBattleBufferB[gActiveBattler][4 + i]; - gBattleMons[gActiveBattler].type1 = gSpeciesInfo[gBattleMons[gActiveBattler].species].types[0]; - gBattleMons[gActiveBattler].type2 = gSpeciesInfo[gBattleMons[gActiveBattler].species].types[1]; + gBattleMons[gActiveBattler].types[0] = gSpeciesInfo[gBattleMons[gActiveBattler].species].types[0]; + gBattleMons[gActiveBattler].types[1] = gSpeciesInfo[gBattleMons[gActiveBattler].species].types[1]; gBattleMons[gActiveBattler].ability = GetAbilityBySpecies(gBattleMons[gActiveBattler].species, gBattleMons[gActiveBattler].abilityNum); hpOnSwitchout = &gBattleStruct->hpOnSwitchout[GetBattlerSide(gActiveBattler)]; *hpOnSwitchout = gBattleMons[gActiveBattler].hp; @@ -4173,8 +4173,8 @@ static void HandleTurnActionSelectionState(void) struct ChooseMoveStruct moveInfo; moveInfo.species = gBattleMons[gActiveBattler].species; - moveInfo.monType1 = gBattleMons[gActiveBattler].type1; - moveInfo.monType2 = gBattleMons[gActiveBattler].type2; + moveInfo.monTypes[0] = gBattleMons[gActiveBattler].types[0]; + moveInfo.monTypes[1] = gBattleMons[gActiveBattler].types[1]; for (i = 0; i < MAX_MON_MOVES; i++) { diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 49279bdb9c..6f43c6af70 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -1395,11 +1395,11 @@ static void Cmd_typecalc(void) else if (TYPE_EFFECT_ATK_TYPE(i) == moveType) { // check type1 - if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].type1) + if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].types[0]) ModulateDmgByType(TYPE_EFFECT_MULTIPLIER(i)); // check type2 - if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].type2 && - gBattleMons[gBattlerTarget].type1 != gBattleMons[gBattlerTarget].type2) + if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].types[1] && + gBattleMons[gBattlerTarget].types[0] != gBattleMons[gBattlerTarget].types[1]) ModulateDmgByType(TYPE_EFFECT_MULTIPLIER(i)); } i += 3; @@ -1454,14 +1454,14 @@ static void CheckWonderGuardAndLevitate(void) if (TYPE_EFFECT_ATK_TYPE(i) == moveType) { // check no effect - if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].type1 + if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].types[0] && TYPE_EFFECT_MULTIPLIER(i) == TYPE_MUL_NO_EFFECT) { gMoveResultFlags |= MOVE_RESULT_DOESNT_AFFECT_FOE; gProtectStructs[gBattlerAttacker].targetNotAffected = 1; } - if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].type2 && - gBattleMons[gBattlerTarget].type1 != gBattleMons[gBattlerTarget].type2 && + if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].types[1] && + gBattleMons[gBattlerTarget].types[0] != gBattleMons[gBattlerTarget].types[1] && TYPE_EFFECT_MULTIPLIER(i) == TYPE_MUL_NO_EFFECT) { gMoveResultFlags |= MOVE_RESULT_DOESNT_AFFECT_FOE; @@ -1469,18 +1469,18 @@ static void CheckWonderGuardAndLevitate(void) } // check super effective - if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].type1 && TYPE_EFFECT_MULTIPLIER(i) == 20) + if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].types[0] && TYPE_EFFECT_MULTIPLIER(i) == 20) flags |= 1; - if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].type2 - && gBattleMons[gBattlerTarget].type1 != gBattleMons[gBattlerTarget].type2 + if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].types[1] + && gBattleMons[gBattlerTarget].types[0] != gBattleMons[gBattlerTarget].types[1] && TYPE_EFFECT_MULTIPLIER(i) == TYPE_MUL_SUPER_EFFECTIVE) flags |= 1; // check not very effective - if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].type1 && TYPE_EFFECT_MULTIPLIER(i) == 5) + if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].types[0] && TYPE_EFFECT_MULTIPLIER(i) == 5) flags |= 2; - if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].type2 - && gBattleMons[gBattlerTarget].type1 != gBattleMons[gBattlerTarget].type2 + if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].types[1] + && gBattleMons[gBattlerTarget].types[0] != gBattleMons[gBattlerTarget].types[1] && TYPE_EFFECT_MULTIPLIER(i) == TYPE_MUL_NOT_EFFECTIVE) flags |= 2; } @@ -1570,11 +1570,11 @@ u8 TypeCalc(u16 move, u8 attacker, u8 defender) else if (TYPE_EFFECT_ATK_TYPE(i) == moveType) { // check type1 - if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[defender].type1) + if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[defender].types[0]) ModulateDmgByType2(TYPE_EFFECT_MULTIPLIER(i), move, &flags); // check type2 - if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[defender].type2 && - gBattleMons[defender].type1 != gBattleMons[defender].type2) + if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[defender].types[1] && + gBattleMons[defender].types[0] != gBattleMons[defender].types[1]) ModulateDmgByType2(TYPE_EFFECT_MULTIPLIER(i), move, &flags); } i += 3; @@ -3971,7 +3971,7 @@ static void Cmd_jumpiftype2(void) { u8 battlerId = GetBattlerForBattleScript(gBattlescriptCurrInstr[1]); - if (gBattlescriptCurrInstr[2] == gBattleMons[battlerId].type1 || gBattlescriptCurrInstr[2] == gBattleMons[battlerId].type2) + if (gBattlescriptCurrInstr[2] == gBattleMons[battlerId].types[0] || gBattlescriptCurrInstr[2] == gBattleMons[battlerId].types[1]) gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3); else gBattlescriptCurrInstr += 7; @@ -4520,7 +4520,7 @@ static void Cmd_typecalc2(void) if (TYPE_EFFECT_ATK_TYPE(i) == moveType) { // check type1 - if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].type1) + if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].types[0]) { if (TYPE_EFFECT_MULTIPLIER(i) == TYPE_MUL_NO_EFFECT) { @@ -4537,22 +4537,22 @@ static void Cmd_typecalc2(void) } } // check type2 - if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].type2) + if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].types[1]) { - if (gBattleMons[gBattlerTarget].type1 != gBattleMons[gBattlerTarget].type2 + if (gBattleMons[gBattlerTarget].types[0] != gBattleMons[gBattlerTarget].types[1] && TYPE_EFFECT_MULTIPLIER(i) == TYPE_MUL_NO_EFFECT) { gMoveResultFlags |= MOVE_RESULT_DOESNT_AFFECT_FOE; break; } - if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].type2 - && gBattleMons[gBattlerTarget].type1 != gBattleMons[gBattlerTarget].type2 + if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].types[1] + && gBattleMons[gBattlerTarget].types[0] != gBattleMons[gBattlerTarget].types[1] && TYPE_EFFECT_MULTIPLIER(i) == TYPE_MUL_NOT_EFFECTIVE) { flags |= MOVE_RESULT_NOT_VERY_EFFECTIVE; } - if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].type2 - && gBattleMons[gBattlerTarget].type1 != gBattleMons[gBattlerTarget].type2 + if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].types[1] + && gBattleMons[gBattlerTarget].types[0] != gBattleMons[gBattlerTarget].types[1] && TYPE_EFFECT_MULTIPLIER(i) == TYPE_MUL_SUPER_EFFECTIVE) { flags |= MOVE_RESULT_SUPER_EFFECTIVE; @@ -4623,8 +4623,8 @@ static void Cmd_switchindataupdate(void) for (i = 0; i < sizeof(struct BattlePokemon); i++) monData[i] = gBattleBufferB[gActiveBattler][4 + i]; - gBattleMons[gActiveBattler].type1 = gSpeciesInfo[gBattleMons[gActiveBattler].species].types[0]; - gBattleMons[gActiveBattler].type2 = gSpeciesInfo[gBattleMons[gActiveBattler].species].types[1]; + gBattleMons[gActiveBattler].types[0] = gSpeciesInfo[gBattleMons[gActiveBattler].species].types[0]; + gBattleMons[gActiveBattler].types[1] = gSpeciesInfo[gBattleMons[gActiveBattler].species].types[1]; gBattleMons[gActiveBattler].ability = GetAbilityBySpecies(gBattleMons[gActiveBattler].species, gBattleMons[gActiveBattler].abilityNum); // check knocked off item @@ -7354,8 +7354,8 @@ static void Cmd_tryconversiontypechange(void) else moveType = TYPE_NORMAL; } - if (moveType != gBattleMons[gBattlerAttacker].type1 - && moveType != gBattleMons[gBattlerAttacker].type2) + if (moveType != gBattleMons[gBattlerAttacker].types[0] + && moveType != gBattleMons[gBattlerAttacker].types[1]) { break; } @@ -7381,7 +7381,7 @@ static void Cmd_tryconversiontypechange(void) moveType = TYPE_NORMAL; } } - while (moveType == gBattleMons[gBattlerAttacker].type1 || moveType == gBattleMons[gBattlerAttacker].type2); + while (moveType == gBattleMons[gBattlerAttacker].types[0] || moveType == gBattleMons[gBattlerAttacker].types[1]); SET_BATTLER_TYPE(gBattlerAttacker, moveType); PREPARE_TYPE_BUFFER(gBattleTextBuff1, moveType); @@ -7548,12 +7548,12 @@ static void Cmd_weatherdamage(void) { 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 + if (gBattleMons[gBattlerAttacker].types[0] != TYPE_ROCK + && gBattleMons[gBattlerAttacker].types[0] != TYPE_STEEL + && gBattleMons[gBattlerAttacker].types[0] != TYPE_GROUND + && gBattleMons[gBattlerAttacker].types[1] != TYPE_ROCK + && gBattleMons[gBattlerAttacker].types[1] != TYPE_STEEL + && gBattleMons[gBattlerAttacker].types[1] != TYPE_GROUND && gBattleMons[gBattlerAttacker].ability != ABILITY_SAND_VEIL && !(gStatuses3[gBattlerAttacker] & STATUS3_UNDERGROUND) && !(gStatuses3[gBattlerAttacker] & STATUS3_UNDERWATER)) diff --git a/src/pokemon.c b/src/pokemon.c index ef8e7e9e05..077b856793 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -4670,8 +4670,8 @@ void CopyPlayerPartyMonToBattleData(u8 battlerId, u8 partyIndex) gBattleMons[battlerId].isEgg = GetMonData(&gPlayerParty[partyIndex], MON_DATA_IS_EGG, NULL); gBattleMons[battlerId].abilityNum = GetMonData(&gPlayerParty[partyIndex], MON_DATA_ABILITY_NUM, NULL); gBattleMons[battlerId].otId = GetMonData(&gPlayerParty[partyIndex], MON_DATA_OT_ID, NULL); - gBattleMons[battlerId].type1 = gSpeciesInfo[gBattleMons[battlerId].species].types[0]; - gBattleMons[battlerId].type2 = gSpeciesInfo[gBattleMons[battlerId].species].types[1]; + gBattleMons[battlerId].types[0] = gSpeciesInfo[gBattleMons[battlerId].species].types[0]; + gBattleMons[battlerId].types[1] = gSpeciesInfo[gBattleMons[battlerId].species].types[1]; gBattleMons[battlerId].ability = GetAbilityBySpecies(gBattleMons[battlerId].species, gBattleMons[battlerId].abilityNum); GetMonData(&gPlayerParty[partyIndex], MON_DATA_NICKNAME, nickname); StringCopy_Nickname(gBattleMons[battlerId].nickname, nickname); From a3d5f54b7588d6b5b3125c6c61356dcc0123b544 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Mon, 1 Jul 2024 15:51:15 -0400 Subject: [PATCH 49/54] Fix type for offset in MapConnection --- include/global.fieldmap.h | 2 +- src/fieldmap.c | 2 +- src/item_use.c | 45 ++++++++++++++++++--------------------- 3 files changed, 23 insertions(+), 26 deletions(-) diff --git a/include/global.fieldmap.h b/include/global.fieldmap.h index 7461929c3a..c7a4133ea8 100644 --- a/include/global.fieldmap.h +++ b/include/global.fieldmap.h @@ -131,7 +131,7 @@ struct MapEvents struct MapConnection { u8 direction; - u32 offset; + s32 offset; u8 mapGroup; u8 mapNum; }; diff --git a/src/fieldmap.c b/src/fieldmap.c index d9c4fa371a..5fdc4cbfb7 100644 --- a/src/fieldmap.c +++ b/src/fieldmap.c @@ -144,7 +144,7 @@ static void InitBackupMapLayoutConnections(struct MapHeader *mapHeader) for (i = 0; i < count; i++, connection++) { struct MapHeader const *cMap = GetMapHeaderFromConnection(connection); - u32 offset = connection->offset; + s32 offset = connection->offset; switch (connection->direction) { case CONNECTION_SOUTH: diff --git a/src/item_use.c b/src/item_use.c index 60338e437a..abd80e0eae 100755 --- a/src/item_use.c +++ b/src/item_use.c @@ -393,46 +393,43 @@ static bool8 IsHiddenItemPresentAtCoords(const struct MapEvents *events, s16 x, static bool8 IsHiddenItemPresentInConnection(const struct MapConnection *connection, int x, int y) { + s16 connectionX, connectionY; + struct MapHeader const *const connectionHeader = GetMapHeaderFromConnection(connection); - u16 localX, localY; - u32 localOffset; - s32 localLength; - - struct MapHeader const *const mapHeader = GetMapHeaderFromConnection(connection); - +// To convert our x/y into coordinates that are relative to the connected map, we must: +// - Subtract the virtual offset used for the border buffer (MAP_OFFSET). +// - Subtract the horizontal offset between North/South connections, or the vertical offset for East/West +// - Account for map size. (0,0) is in the NW corner of our map, so when looking North/West we have to add the height/width of the connected map, +// and when looking South/East we have to subtract the height/width of our current map. +#define localX (x - MAP_OFFSET) +#define localY (y - MAP_OFFSET) switch (connection->direction) { - // same weird temp variable behavior seen in IsHiddenItemPresentAtCoords case CONNECTION_NORTH: - localOffset = connection->offset + MAP_OFFSET; - localX = x - localOffset; - localLength = mapHeader->mapLayout->height - MAP_OFFSET; - localY = localLength + y; // additions are reversed for some reason + connectionX = localX - connection->offset; + connectionY = connectionHeader->mapLayout->height + localY; break; case CONNECTION_SOUTH: - localOffset = connection->offset + MAP_OFFSET; - localX = x - localOffset; - localLength = gMapHeader.mapLayout->height + MAP_OFFSET; - localY = y - localLength; + connectionX = localX - connection->offset; + connectionY = localY - gMapHeader.mapLayout->height; break; case CONNECTION_WEST: - localLength = mapHeader->mapLayout->width - MAP_OFFSET; - localX = localLength + x; // additions are reversed for some reason - localOffset = connection->offset + MAP_OFFSET; - localY = y - localOffset; + connectionX = connectionHeader->mapLayout->width + localX; + connectionY = localY - connection->offset; break; case CONNECTION_EAST: - localLength = gMapHeader.mapLayout->width + MAP_OFFSET; - localX = x - localLength; - localOffset = connection->offset + MAP_OFFSET; - localY = y - localOffset; + connectionX = localX - gMapHeader.mapLayout->width; + connectionY = localY - connection->offset; break; default: return FALSE; } - return IsHiddenItemPresentAtCoords(mapHeader->events, localX, localY); + return IsHiddenItemPresentAtCoords(connectionHeader->events, connectionX, connectionY); } +#undef localX +#undef localY + static void CheckForHiddenItemsInMapConnection(u8 taskId) { s16 playerX, playerY; From 7d921fa89b877ec0a76d6441453c005fa516590d Mon Sep 17 00:00:00 2001 From: luckytyphlosion <10688458+luckytyphlosion@users.noreply.github.com> Date: Wed, 14 Aug 2024 18:27:44 -0400 Subject: [PATCH 50/54] Slight storage system documentation --- src/pokemon_storage_system.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index b398b88752..48eefd66fd 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -4824,7 +4824,7 @@ static void MovePartySpriteToNextSlot(struct Sprite *sprite, u16 partyId) sprite->sMonY = (u16)(sprite->y) * 8; sprite->sSpeedX = ((x * 8) - sprite->sMonX) / 8; sprite->sSpeedY = ((y * 8) - sprite->sMonY) / 8; - sprite->data[6] = 8; + sprite->sMoveSteps = 8; sprite->callback = SpriteCB_MovePartyMonToNextSlot; } @@ -8258,7 +8258,7 @@ static bool8 MultiMove_GrabSelection(void) if (!DoMonPlaceChange()) { StartCursorAnim(CURSOR_ANIM_FIST); - MultiMove_InitMove(0, 256, 8); + MultiMove_InitMove(0, Q_8_8(1), 8); InitMultiMonPlaceChange(TRUE); sMultiMove->state++; } @@ -8291,7 +8291,7 @@ static bool8 MultiMove_PlaceMons(void) { case 0: MultiMove_SetPlacedMonData(); - MultiMove_InitMove(0, -256, 8); + MultiMove_InitMove(0, Q_8_8(-1), 8); InitMultiMonPlaceChange(FALSE); sMultiMove->state++; break; @@ -8335,25 +8335,25 @@ static bool8 MultiMove_TryMoveGroup(u8 dir) if (sMultiMove->minRow == 0) return FALSE; sMultiMove->minRow--; - MultiMove_InitMove(0, 1024, 6); + MultiMove_InitMove(0, Q_8_8(4), 6); break; case 1: // Down if (sMultiMove->minRow + sMultiMove->rowsTotal >= IN_BOX_ROWS) return FALSE; sMultiMove->minRow++; - MultiMove_InitMove(0, -1024, 6); + MultiMove_InitMove(0, Q_8_8(-4), 6); break; case 2: // Left if (sMultiMove->minColumn == 0) return FALSE; sMultiMove->minColumn--; - MultiMove_InitMove(1024, 0, 6); + MultiMove_InitMove(Q_8_8(4), 0, 6); break; case 3: // Right if (sMultiMove->minColumn + sMultiMove->columnsTotal >= IN_BOX_COLUMNS) return FALSE; sMultiMove->minColumn++; - MultiMove_InitMove(-1024, 0, 6); + MultiMove_InitMove(Q_8_8(-4), 0, 6); break; } return TRUE; From c1ee43254e7f9e5032fd61eac65e090c3a80049f Mon Sep 17 00:00:00 2001 From: Bassoonian Date: Thu, 15 Aug 2024 19:34:56 +0200 Subject: [PATCH 51/54] Clean up defines lacking spaces --- include/battle.h | 16 ++++++++-------- include/battle_main.h | 6 +++--- include/battle_util.h | 6 +++--- include/constants/items.h | 4 ++-- include/data.h | 8 ++++---- include/gba/defines.h | 2 +- include/global.h | 4 ++-- include/mail.h | 2 +- include/menu_specialized.h | 2 +- include/random.h | 4 ++-- src/battle_setup.c | 2 +- src/data/decoration/tilemaps.h | 2 +- src/data/pokemon/experience_tables.h | 12 ++++++------ src/data/union_room.h | 8 ++++---- src/field_specials.c | 14 +++++++------- src/fieldmap.c | 2 +- src/frontier_pass.c | 2 +- src/link_rfu_2.c | 2 +- src/menu_specialized.c | 2 +- src/pokemon_jump.c | 2 +- src/pokenav_ribbons_summary.c | 2 +- src/region_map.c | 2 +- src/roulette.c | 10 +++++----- src/union_room_player_avatar.c | 2 +- 24 files changed, 59 insertions(+), 59 deletions(-) diff --git a/include/battle.h b/include/battle.h index eb25b96550..1edd784030 100644 --- a/include/battle.h +++ b/include/battle.h @@ -460,26 +460,26 @@ STATIC_ASSERT(sizeof(((struct BattleStruct *)0)->palaceFlags) * 8 >= MAX_BATTLER typeArg = gBattleMoves[move].type; \ } -#define IS_TYPE_PHYSICAL(moveType)(moveType < TYPE_MYSTERY) -#define IS_TYPE_SPECIAL(moveType)(moveType > TYPE_MYSTERY) +#define IS_TYPE_PHYSICAL(moveType) (moveType < TYPE_MYSTERY) +#define IS_TYPE_SPECIAL(moveType) (moveType > TYPE_MYSTERY) #define TARGET_TURN_DAMAGED ((gSpecialStatuses[gBattlerTarget].physicalDmg != 0 || gSpecialStatuses[gBattlerTarget].specialDmg != 0)) -#define IS_BATTLER_OF_TYPE(battlerId, type)((gBattleMons[battlerId].types[0] == type || gBattleMons[battlerId].types[1] == type)) +#define IS_BATTLER_OF_TYPE(battlerId, type) ((gBattleMons[battlerId].types[0] == type || gBattleMons[battlerId].types[1] == type)) #define SET_BATTLER_TYPE(battlerId, type) \ { \ gBattleMons[battlerId].types[0] = type; \ gBattleMons[battlerId].types[1] = type; \ } -#define GET_STAT_BUFF_ID(n)((n & 0xF)) // first four bits 0x1, 0x2, 0x4, 0x8 -#define GET_STAT_BUFF_VALUE2(n)((n & 0xF0)) -#define GET_STAT_BUFF_VALUE(n)(((n >> 4) & 7)) // 0x10, 0x20, 0x40 +#define GET_STAT_BUFF_ID(n) ((n & 0xF)) // first four bits 0x1, 0x2, 0x4, 0x8 +#define GET_STAT_BUFF_VALUE2(n) ((n & 0xF0)) +#define GET_STAT_BUFF_VALUE(n) (((n >> 4) & 7)) // 0x10, 0x20, 0x40 #define STAT_BUFF_NEGATIVE 0x80 // 0x80, the sign bit -#define SET_STAT_BUFF_VALUE(n)((((n) << 4) & 0xF0)) +#define SET_STAT_BUFF_VALUE(n) ((((n) << 4) & 0xF0)) -#define SET_STATCHANGER(statId, stage, goesDown)(gBattleScripting.statChanger = (statId) + (stage << 4) + (goesDown << 7)) +#define SET_STATCHANGER(statId, stage, goesDown) (gBattleScripting.statChanger = (statId) + (stage << 4) + (goesDown << 7)) // NOTE: The members of this struct have hard-coded offsets // in include/constants/battle_script_commands.h diff --git a/include/battle_main.h b/include/battle_main.h index e3e0cb7ea4..ae970286ca 100644 --- a/include/battle_main.h +++ b/include/battle_main.h @@ -23,9 +23,9 @@ struct MultiPartnerMenuPokemon }; // defines for the u8 array gTypeEffectiveness -#define TYPE_EFFECT_ATK_TYPE(i)((gTypeEffectiveness[i + 0])) -#define TYPE_EFFECT_DEF_TYPE(i)((gTypeEffectiveness[i + 1])) -#define TYPE_EFFECT_MULTIPLIER(i)((gTypeEffectiveness[i + 2])) +#define TYPE_EFFECT_ATK_TYPE(i) ((gTypeEffectiveness[i + 0])) +#define TYPE_EFFECT_DEF_TYPE(i) ((gTypeEffectiveness[i + 1])) +#define TYPE_EFFECT_MULTIPLIER(i) ((gTypeEffectiveness[i + 2])) // defines for the gTypeEffectiveness multipliers #define TYPE_MUL_NO_EFFECT 0 diff --git a/include/battle_util.h b/include/battle_util.h index c7de9aae86..870990e9f5 100644 --- a/include/battle_util.h +++ b/include/battle_util.h @@ -33,9 +33,9 @@ #define ABILITYEFFECT_WATER_SPORT 254 #define ABILITYEFFECT_SWITCH_IN_WEATHER 255 -#define ABILITY_ON_OPPOSING_FIELD(battlerId, abilityId)(AbilityBattleEffects(ABILITYEFFECT_CHECK_OTHER_SIDE, battlerId, abilityId, 0, 0)) -#define ABILITY_ON_FIELD(abilityId)(AbilityBattleEffects(ABILITYEFFECT_CHECK_ON_FIELD, 0, abilityId, 0, 0)) -#define ABILITY_ON_FIELD2(abilityId)(AbilityBattleEffects(ABILITYEFFECT_FIELD_SPORT, 0, abilityId, 0, 0)) +#define ABILITY_ON_OPPOSING_FIELD(battlerId, abilityId) (AbilityBattleEffects(ABILITYEFFECT_CHECK_OTHER_SIDE, battlerId, abilityId, 0, 0)) +#define ABILITY_ON_FIELD(abilityId) (AbilityBattleEffects(ABILITYEFFECT_CHECK_ON_FIELD, 0, abilityId, 0, 0)) +#define ABILITY_ON_FIELD2(abilityId) (AbilityBattleEffects(ABILITYEFFECT_FIELD_SPORT, 0, abilityId, 0, 0)) // For the first argument of ItemBattleEffects, to deteremine which block of item effects to try #define ITEMEFFECT_ON_SWITCH_IN 0 diff --git a/include/constants/items.h b/include/constants/items.h index ed9bfb5ec8..9e6fecf014 100644 --- a/include/constants/items.h +++ b/include/constants/items.h @@ -441,8 +441,8 @@ #define NUM_ROUTE_114_MAN_BERRIES (LAST_ROUTE_114_MAN_BERRY - FIRST_ROUTE_114_MAN_BERRY + 1) #define NUM_ROUTE_114_MAN_BERRIES_SKIPPED (FIRST_ROUTE_114_MAN_BERRY - FIRST_BERRY_INDEX) -#define ITEM_TO_BERRY(itemId)(((itemId) - FIRST_BERRY_INDEX) + 1) -#define ITEM_TO_MAIL(itemId)((itemId) - FIRST_MAIL_INDEX) +#define ITEM_TO_BERRY(itemId) (((itemId) - FIRST_BERRY_INDEX) + 1) +#define ITEM_TO_MAIL(itemId) ((itemId) - FIRST_MAIL_INDEX) #define MAIL_NONE 0xFF #define NUM_TECHNICAL_MACHINES 50 diff --git a/include/data.h b/include/data.h index 41b34d73e2..558b1dfff3 100644 --- a/include/data.h +++ b/include/data.h @@ -28,9 +28,9 @@ struct MonCoords u8 y_offset; }; -#define MON_COORDS_SIZE(width, height)(DIV_ROUND_UP(width, 8) << 4 | DIV_ROUND_UP(height, 8)) -#define GET_MON_COORDS_WIDTH(size)((size >> 4) * 8) -#define GET_MON_COORDS_HEIGHT(size)((size & 0xF) * 8) +#define MON_COORDS_SIZE(width, height) (DIV_ROUND_UP(width, 8) << 4 | DIV_ROUND_UP(height, 8)) +#define GET_MON_COORDS_WIDTH(size) ((size >> 4) * 8) +#define GET_MON_COORDS_HEIGHT(size) ((size & 0xF) * 8) struct TrainerMonNoItemDefaultMoves { @@ -91,7 +91,7 @@ struct Trainer /*0x24*/ union TrainerMonPtr party; }; -#define TRAINER_ENCOUNTER_MUSIC(trainer)((gTrainers[trainer].encounterMusic_gender & 0x7F)) +#define TRAINER_ENCOUNTER_MUSIC(trainer) ((gTrainers[trainer].encounterMusic_gender & 0x7F)) extern const u16 gMinigameDigits_Pal[]; extern const u32 gMinigameDigits_Gfx[]; diff --git a/include/gba/defines.h b/include/gba/defines.h index fa3a30fd6e..febe6882cf 100644 --- a/include/gba/defines.h +++ b/include/gba/defines.h @@ -75,7 +75,7 @@ #define DISPLAY_TILE_HEIGHT (DISPLAY_HEIGHT / TILE_HEIGHT) // Size of different tile formats in bytes -#define TILE_SIZE(bpp)((bpp) * TILE_WIDTH * TILE_HEIGHT / 8) +#define TILE_SIZE(bpp) ((bpp) * TILE_WIDTH * TILE_HEIGHT / 8) #define TILE_SIZE_1BPP TILE_SIZE(1) // 8 #define TILE_SIZE_4BPP TILE_SIZE(4) // 32 #define TILE_SIZE_8BPP TILE_SIZE(8) // 64 diff --git a/include/global.h b/include/global.h index 658af43da7..00d608e672 100644 --- a/include/global.h +++ b/include/global.h @@ -89,7 +89,7 @@ // There are cases where GF does a&(n-1) where we would really like to have a%n, because // if n is changed to a value that isn't a power of 2 then a&(n-1) is unlikely to work as // intended, and a%n for powers of 2 isn't always optimized to use &. -#define MOD(a, n)(((n) & ((n)-1)) ? ((a) % (n)) : ((a) & ((n)-1))) +#define MOD(a, n) (((n) & ((n)-1)) ? ((a) % (n)) : ((a) & ((n)-1))) // Extracts the upper 16 bits of a 32-bit number #define HIHALF(n) (((n) & 0xFFFF0000) >> 16) @@ -130,7 +130,7 @@ f; \ }) -#define DIV_ROUND_UP(val, roundBy)(((val) / (roundBy)) + (((val) % (roundBy)) ? 1 : 0)) +#define DIV_ROUND_UP(val, roundBy) (((val) / (roundBy)) + (((val) % (roundBy)) ? 1 : 0)) #define ROUND_BITS_TO_BYTES(numBits) DIV_ROUND_UP(numBits, 8) diff --git a/include/mail.h b/include/mail.h index f4590a70ec..403078f097 100644 --- a/include/mail.h +++ b/include/mail.h @@ -1,7 +1,7 @@ #ifndef GUARD_MAIL_H #define GUARD_MAIL_H -#define IS_ITEM_MAIL(itemId)((itemId == ITEM_ORANGE_MAIL \ +#define IS_ITEM_MAIL(itemId) ((itemId == ITEM_ORANGE_MAIL \ || itemId == ITEM_HARBOR_MAIL \ || itemId == ITEM_GLITTER_MAIL \ || itemId == ITEM_MECH_MAIL \ diff --git a/include/menu_specialized.h b/include/menu_specialized.h index 06a188b8a0..152afb59ac 100644 --- a/include/menu_specialized.h +++ b/include/menu_specialized.h @@ -44,7 +44,7 @@ enum { // The number of extra sparkles shown on a Pokémon's condition screen. // All Pokémon start with 1, so the max here is MAX_CONDITION_SPARKLES - 1 -#define GET_NUM_CONDITION_SPARKLES(sheen)((sheen) != MAX_SHEEN) ? (sheen) / ((u32)MAX_SHEEN / (MAX_CONDITION_SPARKLES - 1) + 1) : MAX_CONDITION_SPARKLES - 1; +#define GET_NUM_CONDITION_SPARKLES(sheen) ((sheen) != MAX_SHEEN) ? (sheen) / ((u32)MAX_SHEEN / (MAX_CONDITION_SPARKLES - 1) + 1) : MAX_CONDITION_SPARKLES - 1; #define CONDITION_GRAPH_TOP_Y 56 #define CONDITION_GRAPH_BOTTOM_Y 121 diff --git a/include/random.h b/include/random.h index 6bf61de6c6..ba7aeccc1a 100644 --- a/include/random.h +++ b/include/random.h @@ -13,8 +13,8 @@ u16 Random2(void); // The number 1103515245 comes from the example implementation of rand and srand // in the ISO C standard. -#define ISO_RANDOMIZE1(val)(1103515245 * (val) + 24691) -#define ISO_RANDOMIZE2(val)(1103515245 * (val) + 12345) +#define ISO_RANDOMIZE1(val) (1103515245 * (val) + 24691) +#define ISO_RANDOMIZE2(val) (1103515245 * (val) + 12345) //Sets the initial seed value of the pseudorandom number generator void SeedRng(u16 seed); diff --git a/src/battle_setup.c b/src/battle_setup.c index e87ce6dd27..be5b09e5e5 100644 --- a/src/battle_setup.c +++ b/src/battle_setup.c @@ -859,7 +859,7 @@ static u8 GetTrainerBattleTransition(void) return sBattleTransitionTable_Trainer[transitionType][1]; } -#define RANDOM_TRANSITION(table)(table[Random() % ARRAY_COUNT(table)]) +#define RANDOM_TRANSITION(table) (table[Random() % ARRAY_COUNT(table)]) u8 GetSpecialBattleTransition(s32 id) { u16 var; diff --git a/src/data/decoration/tilemaps.h b/src/data/decoration/tilemaps.h index eebb3acb25..d6c351ae85 100644 --- a/src/data/decoration/tilemaps.h +++ b/src/data/decoration/tilemaps.h @@ -171,7 +171,7 @@ static const u8 sDecorTilemap_3x2_X[] = { 0x06, 0x07, 0x06, 0x07, 0x06, 0x07 }; -#define DECORSIZE(width, height)((width) * (height) * 4) +#define DECORSIZE(width, height) ((width) * (height) * 4) static const struct { const u8 *tiles; diff --git a/src/data/pokemon/experience_tables.h b/src/data/pokemon/experience_tables.h index 8f50e10918..848d5c5016 100644 --- a/src/data/pokemon/experience_tables.h +++ b/src/data/pokemon/experience_tables.h @@ -1,10 +1,10 @@ -#define SQUARE(n)((n) * (n)) -#define CUBE(n)((n) * (n) * (n)) +#define SQUARE(n) ((n) * (n)) +#define CUBE(n) ((n) * (n) * (n)) -#define EXP_SLOW(n)((5 * CUBE(n)) / 4) // (5 * (n)^3) / 4 -#define EXP_FAST(n)((4 * CUBE(n)) / 5) // (4 * (n)^3) / 5 -#define EXP_MEDIUM_FAST(n)(CUBE(n)) // (n)^3 -#define EXP_MEDIUM_SLOW(n)((6 * CUBE(n)) / 5 - (15 * SQUARE(n)) + (100 * n) - 140) // (6 * (n)^3) / 5 - (15 * (n)^2) + (100 * n) - 140 +#define EXP_SLOW(n) ((5 * CUBE(n)) / 4) // (5 * (n)^3) / 4 +#define EXP_FAST(n) ((4 * CUBE(n)) / 5) // (4 * (n)^3) / 5 +#define EXP_MEDIUM_FAST(n) (CUBE(n)) // (n)^3 +#define EXP_MEDIUM_SLOW(n) ((6 * CUBE(n)) / 5 - (15 * SQUARE(n)) + (100 * n) - 140) // (6 * (n)^3) / 5 - (15 * (n)^2) + (100 * n) - 140 #define EXP_ERRATIC(n) \ (n <= 50) ? ((100 - n) * CUBE(n) / 50) \ :(n <= 68) ? ((150 - n) * CUBE(n) / 100) \ diff --git a/src/data/union_room.h b/src/data/union_room.h index 129c629941..c4bd984736 100644 --- a/src/data/union_room.h +++ b/src/data/union_room.h @@ -633,10 +633,10 @@ static const struct WindowTemplate sWindowTemplate_BButtonCancel = { // Minimum and maximum number of players for a link group // A minimum of 0 means the min and max are equal -#define LINK_GROUP_CAPACITY(min, max)(((min) << 12) | ((max) << 8)) -#define GROUP_MAX(capacity)(capacity & 0x0F) -#define GROUP_MIN(capacity)(capacity >> 4) -#define GROUP_MIN2(capacity)(capacity & 0xF0) // Unnecessary to have both, but needed to match +#define LINK_GROUP_CAPACITY(min, max) (((min) << 12) | ((max) << 8)) +#define GROUP_MAX(capacity) (capacity & 0x0F) +#define GROUP_MIN(capacity) (capacity >> 4) +#define GROUP_MIN2(capacity) (capacity & 0xF0) // Unnecessary to have both, but needed to match static const u32 sLinkGroupToActivityAndCapacity[NUM_LINK_GROUP_TYPES] = { [LINK_GROUP_SINGLE_BATTLE] = ACTIVITY_BATTLE_SINGLE | LINK_GROUP_CAPACITY(0, 2), diff --git a/src/field_specials.c b/src/field_specials.c index 7d20d3571d..d8fc96c49d 100644 --- a/src/field_specials.c +++ b/src/field_specials.c @@ -3957,14 +3957,14 @@ bool8 InPokemonCenter(void) #define FANCLUB_BITFIELD (gSaveBlock1Ptr->vars[VAR_FANCLUB_FAN_COUNTER - VARS_START]) #define FANCLUB_COUNTER 0x007F -#define GET_TRAINER_FAN_CLUB_FLAG(flag) (FANCLUB_BITFIELD >> (flag) & 1) -#define SET_TRAINER_FAN_CLUB_FLAG(flag) (FANCLUB_BITFIELD |= 1 << (flag)) -#define FLIP_TRAINER_FAN_CLUB_FLAG(flag)(FANCLUB_BITFIELD ^= 1 << (flag)) +#define GET_TRAINER_FAN_CLUB_FLAG(flag) (FANCLUB_BITFIELD >> (flag) & 1) +#define SET_TRAINER_FAN_CLUB_FLAG(flag) (FANCLUB_BITFIELD |= 1 << (flag)) +#define FLIP_TRAINER_FAN_CLUB_FLAG(flag) (FANCLUB_BITFIELD ^= 1 << (flag)) -#define GET_TRAINER_FAN_CLUB_COUNTER (FANCLUB_BITFIELD & FANCLUB_COUNTER) -#define SET_TRAINER_FAN_CLUB_COUNTER(count) (FANCLUB_BITFIELD = (FANCLUB_BITFIELD & ~FANCLUB_COUNTER) | (count)) -#define INCR_TRAINER_FAN_CLUB_COUNTER(count)(FANCLUB_BITFIELD += (count)) -#define CLEAR_TRAINER_FAN_CLUB_COUNTER (FANCLUB_BITFIELD &= ~FANCLUB_COUNTER) +#define GET_TRAINER_FAN_CLUB_COUNTER (FANCLUB_BITFIELD & FANCLUB_COUNTER) +#define SET_TRAINER_FAN_CLUB_COUNTER(count) (FANCLUB_BITFIELD = (FANCLUB_BITFIELD & ~FANCLUB_COUNTER) | (count)) +#define INCR_TRAINER_FAN_CLUB_COUNTER(count) (FANCLUB_BITFIELD += (count)) +#define CLEAR_TRAINER_FAN_CLUB_COUNTER (FANCLUB_BITFIELD &= ~FANCLUB_COUNTER) void ResetFanClub(void) { diff --git a/src/fieldmap.c b/src/fieldmap.c index 5fdc4cbfb7..e4dc0026a3 100644 --- a/src/fieldmap.c +++ b/src/fieldmap.c @@ -48,7 +48,7 @@ static const struct MapConnection *GetIncomingConnection(u8 direction, int x, in static bool8 IsPosInIncomingConnectingMap(u8 direction, int x, int y, const struct MapConnection *connection); static bool8 IsCoordInIncomingConnectingMap(int coord, int srcMax, int destMax, int offset); -#define GetBorderBlockAt(x, y)({ \ +#define GetBorderBlockAt(x, y) ({ \ u16 block; \ int i; \ const u16 *border = gMapHeader.mapLayout->border; /* Unused, they read it again below */ \ diff --git a/src/frontier_pass.c b/src/frontier_pass.c index 07e06ad3b9..a351d81ce9 100644 --- a/src/frontier_pass.c +++ b/src/frontier_pass.c @@ -1241,7 +1241,7 @@ static void ShowHideZoomingArea(bool8 show, bool8 zoomedIn) static void UpdateAreaHighlight(u8 cursorArea, u8 previousCursorArea) { - #define NON_HIGHLIGHT_AREA(area)((area) == CURSOR_AREA_NOTHING || (area) > CURSOR_AREA_CANCEL) + #define NON_HIGHLIGHT_AREA(area) ((area) == CURSOR_AREA_NOTHING || (area) > CURSOR_AREA_CANCEL) // If moving off highlightable area, unhighlight it switch (previousCursorArea) diff --git a/src/link_rfu_2.c b/src/link_rfu_2.c index 9979097a49..b34c7184cf 100644 --- a/src/link_rfu_2.c +++ b/src/link_rfu_2.c @@ -138,7 +138,7 @@ static const u8 sAvailSlots[] = { [4] = AVAIL_SLOT4 }; -#define BLOCK_MASK(bitNum)((1 << (bitNum)) - 1) +#define BLOCK_MASK(bitNum) ((1 << (bitNum)) - 1) static const u32 sAllBlocksReceived[] = { BLOCK_MASK(0), BLOCK_MASK(1), diff --git a/src/menu_specialized.c b/src/menu_specialized.c index 20ddce1f44..1272277aa5 100644 --- a/src/menu_specialized.c +++ b/src/menu_specialized.c @@ -317,7 +317,7 @@ void MailboxMenu_Free(void) // filled with the graph color. //--------------------------------------- -#define SHIFT_RIGHT_ADJUSTED(n, s)(((n) >> (s)) + (((n) >> ((s) - 1)) & 1)) +#define SHIFT_RIGHT_ADJUSTED(n, s) (((n) >> (s)) + (((n) >> ((s) - 1)) & 1)) void ConditionGraph_Init(struct ConditionGraph *graph) { diff --git a/src/pokemon_jump.c b/src/pokemon_jump.c index d744ff6650..a1c401c6df 100755 --- a/src/pokemon_jump.c +++ b/src/pokemon_jump.c @@ -108,7 +108,7 @@ enum { // the lower 8 bits are a timer to the next state. // When the timer is incremented above 255, it increments // the vine state and the timer is reset. -#define VINE_STATE_TIMER(vineState)(((vineState) << 8) | 0xFF) +#define VINE_STATE_TIMER(vineState) (((vineState) << 8) | 0xFF) enum { MONSTATE_NORMAL, // Pokémon is either on the ground or in the middle of a jump diff --git a/src/pokenav_ribbons_summary.c b/src/pokenav_ribbons_summary.c index e77f839a80..c799daf57b 100644 --- a/src/pokenav_ribbons_summary.c +++ b/src/pokenav_ribbons_summary.c @@ -1080,7 +1080,7 @@ enum { RIBBONGFX_GIFT_3, }; -#define TO_PAL_OFFSET(palNum)((palNum) - PALTAG_RIBBON_ICONS_1) +#define TO_PAL_OFFSET(palNum) ((palNum) - PALTAG_RIBBON_ICONS_1) struct { diff --git a/src/region_map.c b/src/region_map.c index 21c6314d30..8fa53a0e7b 100644 --- a/src/region_map.c +++ b/src/region_map.c @@ -189,7 +189,7 @@ static const u16 sTerraOrMarineCaveMapSecIds[ABNORMAL_WEATHER_LOCATIONS] = [ABNORMAL_WEATHER_ROUTE_129_EAST - 1] = MAPSEC_ROUTE_129 }; -#define MARINE_CAVE_COORD(location)(ABNORMAL_WEATHER_##location - MARINE_CAVE_LOCATIONS_START) +#define MARINE_CAVE_COORD(location) (ABNORMAL_WEATHER_##location - MARINE_CAVE_LOCATIONS_START) static const struct UCoords16 sMarineCaveLocationCoords[MARINE_CAVE_LOCATIONS] = { diff --git a/src/roulette.c b/src/roulette.c index ec4c8cfcfe..f4e6012a8d 100644 --- a/src/roulette.c +++ b/src/roulette.c @@ -70,13 +70,13 @@ // Get the id of the col/row from the selection ID // e.g. GET_ROW(SQU_PURPLE_SKITTY) is ROW_PURPLE -#define GET_COL(selectionId)((selectionId) % (NUM_BOARD_POKES + 1)) -#define GET_ROW(selectionId)((selectionId) / (NUM_BOARD_POKES + 1) * (NUM_BOARD_POKES + 1)) +#define GET_COL(selectionId) ((selectionId) % (NUM_BOARD_POKES + 1)) +#define GET_ROW(selectionId) ((selectionId) / (NUM_BOARD_POKES + 1) * (NUM_BOARD_POKES + 1)) // Get the col/row index from the selection ID // e.g. GET_ROW_IDX(SQU_PURPLE_SKITTY) is 2 (purple being the 3rd row) -#define GET_COL_IDX(selectionId)(selectionId - 1) -#define GET_ROW_IDX(selectionId)(selectionId / 5 - 1) +#define GET_COL_IDX(selectionId) (selectionId - 1) +#define GET_ROW_IDX(selectionId) (selectionId / 5 - 1) // Flags for the above selections, used to set which spaces have been hit or bet on #define F_WYNAUT_COL (1 << COL_WYNAUT) @@ -149,7 +149,7 @@ // 2 different Roulette tables with 2 different rates (normal vs service day special) // & 1 gets which table, >> 7 gets if ROULETTE_SPECIAL_RATE is set -#define GET_MIN_BET_ID(var)(((var) & 1) + (((var) >> 7) * 2)) +#define GET_MIN_BET_ID(var) (((var) & 1) + (((var) >> 7) * 2)) // Having Shroomish or Taillow in the party can make rolls more consistent in length // It also increases the likelihood that, if they appear to unstick a ball, they'll move it to a slot the player bet on diff --git a/src/union_room_player_avatar.c b/src/union_room_player_avatar.c index a7d5045b38..1bb7968359 100644 --- a/src/union_room_player_avatar.c +++ b/src/union_room_player_avatar.c @@ -14,7 +14,7 @@ // Each parent player can lead a group of up to MAX_RFU_PLAYERS (including themselves). // Multiply the leader's id by MAX_RFU_PLAYERS and add the member's id (0 if the leader) to // get the sprite index of that player. -#define UR_PLAYER_SPRITE_ID(leaderId, memberId)(MAX_RFU_PLAYERS * leaderId + memberId) +#define UR_PLAYER_SPRITE_ID(leaderId, memberId) (MAX_RFU_PLAYERS * leaderId + memberId) static EWRAM_DATA struct UnionRoomObject * sUnionObjWork = NULL; static EWRAM_DATA u32 sUnionObjRefreshTimer = 0; From 3f49c5cbaf5bd8bdb02cb54d0a44e61faba114f4 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Wed, 7 Aug 2024 16:24:30 -0400 Subject: [PATCH 52/54] Fix trainer match call flags --- include/constants/flags.h | 164 +++++++++++++++++----------------- include/constants/rematches.h | 89 ++++++++++++++++++ include/gym_leader_rematch.h | 85 +----------------- map_data_rules.mk | 4 +- src/battle_setup.c | 4 +- src/field_specials.c | 2 +- src/match_call.c | 11 +-- src/pokenav_match_call_data.c | 16 ++-- src/pokenav_match_call_list.c | 2 +- 9 files changed, 194 insertions(+), 183 deletions(-) create mode 100644 include/constants/rematches.h diff --git a/include/constants/flags.h b/include/constants/flags.h index 8d98e3aa04..5b1b5efd19 100644 --- a/include/constants/flags.h +++ b/include/constants/flags.h @@ -2,6 +2,7 @@ #define GUARD_CONSTANTS_FLAGS_H #include "constants/opponents.h" +#include "constants/rematches.h" // Temporary Flags // These temporary flags are are cleared every time a map is loaded. They are used @@ -375,86 +376,89 @@ #define FLAG_MET_FRONTIER_BEAUTY_MOVE_TUTOR 0x15A #define FLAG_MET_FRONTIER_SWIMMER_MOVE_TUTOR 0x15B -// Trainer Rematch Flags -#define FLAG_MATCH_CALL_REGISTERED 0x15C -#define FLAG_REMATCH_ROSE 0x15D -#define FLAG_REMATCH_ANDRES 0x15E -#define FLAG_REMATCH_DUSTY 0x15F -#define FLAG_REMATCH_LOLA 0x160 -#define FLAG_REMATCH_RICKY 0x161 -#define FLAG_REMATCH_LILA_AND_ROY 0x162 -#define FLAG_REMATCH_CRISTIN 0x163 -#define FLAG_REMATCH_BROOKE 0x164 -#define FLAG_REMATCH_WILTON 0x165 -#define FLAG_REMATCH_VALERIE 0x166 -#define FLAG_REMATCH_CINDY 0x167 -#define FLAG_REMATCH_THALIA 0x168 -#define FLAG_REMATCH_JESSICA 0x169 -#define FLAG_REMATCH_WINSTON 0x16A -#define FLAG_REMATCH_STEVE 0x16B -#define FLAG_REMATCH_TONY 0x16C -#define FLAG_REMATCH_NOB 0x16D -#define FLAG_REMATCH_KOJI 0x16E -#define FLAG_REMATCH_FERNANDO 0x16F -#define FLAG_REMATCH_DALTON 0x170 -#define FLAG_REMATCH_BERNIE 0x171 -#define FLAG_REMATCH_ETHAN 0x172 -#define FLAG_REMATCH_JOHN_AND_JAY 0x173 -#define FLAG_REMATCH_JEFFREY 0x174 -#define FLAG_REMATCH_CAMERON 0x175 -#define FLAG_REMATCH_JACKI 0x176 -#define FLAG_REMATCH_WALTER 0x177 -#define FLAG_REMATCH_KAREN 0x178 -#define FLAG_REMATCH_JERRY 0x179 -#define FLAG_REMATCH_ANNA_AND_MEG 0x17A -#define FLAG_REMATCH_ISABEL 0x17B -#define FLAG_REMATCH_MIGUEL 0x17C -#define FLAG_REMATCH_TIMOTHY 0x17D -#define FLAG_REMATCH_SHELBY 0x17E -#define FLAG_REMATCH_CALVIN 0x17F -#define FLAG_REMATCH_ELLIOT 0x180 -#define FLAG_REMATCH_ISAIAH 0x181 -#define FLAG_REMATCH_MARIA 0x182 -#define FLAG_REMATCH_ABIGAIL 0x183 -#define FLAG_REMATCH_DYLAN 0x184 -#define FLAG_REMATCH_KATELYN 0x185 -#define FLAG_REMATCH_BENJAMIN 0x186 -#define FLAG_REMATCH_PABLO 0x187 -#define FLAG_REMATCH_NICOLAS 0x188 -#define FLAG_REMATCH_ROBERT 0x189 -#define FLAG_REMATCH_LAO 0x18A -#define FLAG_REMATCH_CYNDY 0x18B -#define FLAG_REMATCH_MADELINE 0x18C -#define FLAG_REMATCH_JENNY 0x18D -#define FLAG_REMATCH_DIANA 0x18E -#define FLAG_REMATCH_AMY_AND_LIV 0x18F -#define FLAG_REMATCH_ERNEST 0x190 -#define FLAG_REMATCH_CORY 0x191 -#define FLAG_REMATCH_EDWIN 0x192 -#define FLAG_REMATCH_LYDIA 0x193 -#define FLAG_REMATCH_ISAAC 0x194 -#define FLAG_REMATCH_GABRIELLE 0x195 -#define FLAG_REMATCH_CATHERINE 0x196 -#define FLAG_REMATCH_JACKSON 0x197 -#define FLAG_REMATCH_HALEY 0x198 -#define FLAG_REMATCH_JAMES 0x199 -#define FLAG_REMATCH_TRENT 0x19A -#define FLAG_REMATCH_SAWYER 0x19B -#define FLAG_REMATCH_KIRA_AND_DAN 0x19C -#define FLAG_REMATCH_WALLY 0x19D -#define FLAG_REMATCH_ROXANNE 0x19E -#define FLAG_REMATCH_BRAWLY 0x19F -#define FLAG_REMATCH_WATTSON 0x1A0 -#define FLAG_REMATCH_FLANNERY 0x1A1 -#define FLAG_REMATCH_NORMAN 0x1A2 -#define FLAG_REMATCH_WINONA 0x1A3 -#define FLAG_REMATCH_TATE_AND_LIZA 0x1A4 -// Note: FLAG_REMATCH_JUAN is handled by FLAG_ENABLE_JUAN_MATCH_CALL instead. -#define FLAG_REMATCH_SIDNEY 0x1A5 -#define FLAG_REMATCH_PHOEBE 0x1A6 -#define FLAG_REMATCH_GLACIA 0x1A7 -#define FLAG_REMATCH_DRAKE 0x1A8 -#define FLAG_REMATCH_WALLACE 0x1A9 +// Flags for whether a rematchable trainer has been registered in the player's Match Call. +// Most are used implicitly by adding their REMATCH_* id to TRAINER_REGISTERED_FLAGS_START. +// Some Match Call entries (like those for gym leaders, Wally, and all non-trainer NPCs like Prof. Birch) +// have their own separate flag that needs to be set to be enabled; see src/pokenav_match_call_data.c +#define TRAINER_REGISTERED_FLAGS_START 0x15C +#define FLAG_REGISTERED_ROSE (TRAINER_REGISTERED_FLAGS_START + REMATCH_ROSE) +#define FLAG_REGISTERED_ANDRES (TRAINER_REGISTERED_FLAGS_START + REMATCH_ANDRES) +#define FLAG_REGISTERED_DUSTY (TRAINER_REGISTERED_FLAGS_START + REMATCH_DUSTY) +#define FLAG_REGISTERED_LOLA (TRAINER_REGISTERED_FLAGS_START + REMATCH_LOLA) +#define FLAG_REGISTERED_RICKY (TRAINER_REGISTERED_FLAGS_START + REMATCH_RICKY) +#define FLAG_REGISTERED_LILA_AND_ROY (TRAINER_REGISTERED_FLAGS_START + REMATCH_LILA_AND_ROY) +#define FLAG_REGISTERED_CRISTIN (TRAINER_REGISTERED_FLAGS_START + REMATCH_CRISTIN) +#define FLAG_REGISTERED_BROOKE (TRAINER_REGISTERED_FLAGS_START + REMATCH_BROOKE) +#define FLAG_REGISTERED_WILTON (TRAINER_REGISTERED_FLAGS_START + REMATCH_WILTON) +#define FLAG_REGISTERED_VALERIE (TRAINER_REGISTERED_FLAGS_START + REMATCH_VALERIE) +#define FLAG_REGISTERED_CINDY (TRAINER_REGISTERED_FLAGS_START + REMATCH_CINDY) +#define FLAG_REGISTERED_THALIA (TRAINER_REGISTERED_FLAGS_START + REMATCH_THALIA) +#define FLAG_REGISTERED_JESSICA (TRAINER_REGISTERED_FLAGS_START + REMATCH_JESSICA) +#define FLAG_REGISTERED_WINSTON (TRAINER_REGISTERED_FLAGS_START + REMATCH_WINSTON) +#define FLAG_REGISTERED_STEVE (TRAINER_REGISTERED_FLAGS_START + REMATCH_STEVE) +#define FLAG_REGISTERED_TONY (TRAINER_REGISTERED_FLAGS_START + REMATCH_TONY) +#define FLAG_REGISTERED_NOB (TRAINER_REGISTERED_FLAGS_START + REMATCH_NOB) +#define FLAG_REGISTERED_KOJI (TRAINER_REGISTERED_FLAGS_START + REMATCH_KOJI) +#define FLAG_REGISTERED_FERNANDO (TRAINER_REGISTERED_FLAGS_START + REMATCH_FERNANDO) +#define FLAG_REGISTERED_DALTON (TRAINER_REGISTERED_FLAGS_START + REMATCH_DALTON) +#define FLAG_REGISTERED_BERNIE (TRAINER_REGISTERED_FLAGS_START + REMATCH_BERNIE) +#define FLAG_REGISTERED_ETHAN (TRAINER_REGISTERED_FLAGS_START + REMATCH_ETHAN) +#define FLAG_REGISTERED_JOHN_AND_JAY (TRAINER_REGISTERED_FLAGS_START + REMATCH_JOHN_AND_JAY) +#define FLAG_REGISTERED_JEFFREY (TRAINER_REGISTERED_FLAGS_START + REMATCH_JEFFREY) +#define FLAG_REGISTERED_CAMERON (TRAINER_REGISTERED_FLAGS_START + REMATCH_CAMERON) +#define FLAG_REGISTERED_JACKI (TRAINER_REGISTERED_FLAGS_START + REMATCH_JACKI) +#define FLAG_REGISTERED_WALTER (TRAINER_REGISTERED_FLAGS_START + REMATCH_WALTER) +#define FLAG_REGISTERED_KAREN (TRAINER_REGISTERED_FLAGS_START + REMATCH_KAREN) +#define FLAG_REGISTERED_JERRY (TRAINER_REGISTERED_FLAGS_START + REMATCH_JERRY) +#define FLAG_REGISTERED_ANNA_AND_MEG (TRAINER_REGISTERED_FLAGS_START + REMATCH_ANNA_AND_MEG) +#define FLAG_REGISTERED_ISABEL (TRAINER_REGISTERED_FLAGS_START + REMATCH_ISABEL) +#define FLAG_REGISTERED_MIGUEL (TRAINER_REGISTERED_FLAGS_START + REMATCH_MIGUEL) +#define FLAG_REGISTERED_TIMOTHY (TRAINER_REGISTERED_FLAGS_START + REMATCH_TIMOTHY) +#define FLAG_REGISTERED_SHELBY (TRAINER_REGISTERED_FLAGS_START + REMATCH_SHELBY) +#define FLAG_REGISTERED_CALVIN (TRAINER_REGISTERED_FLAGS_START + REMATCH_CALVIN) +#define FLAG_REGISTERED_ELLIOT (TRAINER_REGISTERED_FLAGS_START + REMATCH_ELLIOT) +#define FLAG_REGISTERED_ISAIAH (TRAINER_REGISTERED_FLAGS_START + REMATCH_ISAIAH) +#define FLAG_REGISTERED_MARIA (TRAINER_REGISTERED_FLAGS_START + REMATCH_MARIA) +#define FLAG_REGISTERED_ABIGAIL (TRAINER_REGISTERED_FLAGS_START + REMATCH_ABIGAIL) +#define FLAG_REGISTERED_DYLAN (TRAINER_REGISTERED_FLAGS_START + REMATCH_DYLAN) +#define FLAG_REGISTERED_KATELYN (TRAINER_REGISTERED_FLAGS_START + REMATCH_KATELYN) +#define FLAG_REGISTERED_BENJAMIN (TRAINER_REGISTERED_FLAGS_START + REMATCH_BENJAMIN) +#define FLAG_REGISTERED_PABLO (TRAINER_REGISTERED_FLAGS_START + REMATCH_PABLO) +#define FLAG_REGISTERED_NICOLAS (TRAINER_REGISTERED_FLAGS_START + REMATCH_NICOLAS) +#define FLAG_REGISTERED_ROBERT (TRAINER_REGISTERED_FLAGS_START + REMATCH_ROBERT) +#define FLAG_REGISTERED_LAO (TRAINER_REGISTERED_FLAGS_START + REMATCH_LAO) +#define FLAG_REGISTERED_CYNDY (TRAINER_REGISTERED_FLAGS_START + REMATCH_CYNDY) +#define FLAG_REGISTERED_MADELINE (TRAINER_REGISTERED_FLAGS_START + REMATCH_MADELINE) +#define FLAG_REGISTERED_JENNY (TRAINER_REGISTERED_FLAGS_START + REMATCH_JENNY) +#define FLAG_REGISTERED_DIANA (TRAINER_REGISTERED_FLAGS_START + REMATCH_DIANA) +#define FLAG_REGISTERED_AMY_AND_LIV (TRAINER_REGISTERED_FLAGS_START + REMATCH_AMY_AND_LIV) +#define FLAG_REGISTERED_ERNEST (TRAINER_REGISTERED_FLAGS_START + REMATCH_ERNEST) +#define FLAG_REGISTERED_CORY (TRAINER_REGISTERED_FLAGS_START + REMATCH_CORY) +#define FLAG_REGISTERED_EDWIN (TRAINER_REGISTERED_FLAGS_START + REMATCH_EDWIN) +#define FLAG_REGISTERED_LYDIA (TRAINER_REGISTERED_FLAGS_START + REMATCH_LYDIA) +#define FLAG_REGISTERED_ISAAC (TRAINER_REGISTERED_FLAGS_START + REMATCH_ISAAC) +#define FLAG_REGISTERED_GABRIELLE (TRAINER_REGISTERED_FLAGS_START + REMATCH_GABRIELLE) +#define FLAG_REGISTERED_CATHERINE (TRAINER_REGISTERED_FLAGS_START + REMATCH_CATHERINE) +#define FLAG_REGISTERED_JACKSON (TRAINER_REGISTERED_FLAGS_START + REMATCH_JACKSON) +#define FLAG_REGISTERED_HALEY (TRAINER_REGISTERED_FLAGS_START + REMATCH_HALEY) +#define FLAG_REGISTERED_JAMES (TRAINER_REGISTERED_FLAGS_START + REMATCH_JAMES) +#define FLAG_REGISTERED_TRENT (TRAINER_REGISTERED_FLAGS_START + REMATCH_TRENT) +#define FLAG_REGISTERED_SAWYER (TRAINER_REGISTERED_FLAGS_START + REMATCH_SAWYER) +#define FLAG_REGISTERED_KIRA_AND_DAN (TRAINER_REGISTERED_FLAGS_START + REMATCH_KIRA_AND_DAN) +#define FLAG_REGISTERED_WALLY (TRAINER_REGISTERED_FLAGS_START + REMATCH_WALLY) +#define FLAG_REGISTERED_ROXANNE (TRAINER_REGISTERED_FLAGS_START + REMATCH_ROXANNE) +#define FLAG_REGISTERED_BRAWLY (TRAINER_REGISTERED_FLAGS_START + REMATCH_BRAWLY) +#define FLAG_REGISTERED_WATTSON (TRAINER_REGISTERED_FLAGS_START + REMATCH_WATTSON) +#define FLAG_REGISTERED_FLANNERY (TRAINER_REGISTERED_FLAGS_START + REMATCH_FLANNERY) +#define FLAG_REGISTERED_NORMAN (TRAINER_REGISTERED_FLAGS_START + REMATCH_NORMAN) +#define FLAG_REGISTERED_WINONA (TRAINER_REGISTERED_FLAGS_START + REMATCH_WINONA) +#define FLAG_REGISTERED_TATE_AND_LIZA (TRAINER_REGISTERED_FLAGS_START + REMATCH_TATE_AND_LIZA) +#define FLAG_REGISTERED_JUAN (TRAINER_REGISTERED_FLAGS_START + REMATCH_JUAN) +#define FLAG_REGISTERED_SIDNEY (TRAINER_REGISTERED_FLAGS_START + REMATCH_SIDNEY) +#define FLAG_REGISTERED_PHOEBE (TRAINER_REGISTERED_FLAGS_START + REMATCH_PHOEBE) +#define FLAG_REGISTERED_GLACIA (TRAINER_REGISTERED_FLAGS_START + REMATCH_GLACIA) +#define FLAG_REGISTERED_DRAKE (TRAINER_REGISTERED_FLAGS_START + REMATCH_DRAKE) +#define FLAG_REGISTERED_WALLACE (TRAINER_REGISTERED_FLAGS_START + REMATCH_WALLACE) #define FLAG_UNUSED_0x1AA 0x1AA // Unused Flag #define FLAG_UNUSED_0x1AB 0x1AB // Unused Flag diff --git a/include/constants/rematches.h b/include/constants/rematches.h new file mode 100644 index 0000000000..2ddefcc578 --- /dev/null +++ b/include/constants/rematches.h @@ -0,0 +1,89 @@ +#ifndef GUARD_REMATCHES_H +#define GUARD_REMATCHES_H + +enum { + REMATCH_ROSE, + REMATCH_ANDRES, + REMATCH_DUSTY, + REMATCH_LOLA, + REMATCH_RICKY, + REMATCH_LILA_AND_ROY, + REMATCH_CRISTIN, + REMATCH_BROOKE, + REMATCH_WILTON, + REMATCH_VALERIE, + REMATCH_CINDY, + REMATCH_THALIA, + REMATCH_JESSICA, + REMATCH_WINSTON, + REMATCH_STEVE, + REMATCH_TONY, + REMATCH_NOB, + REMATCH_KOJI, + REMATCH_FERNANDO, + REMATCH_DALTON, + REMATCH_BERNIE, + REMATCH_ETHAN, + REMATCH_JOHN_AND_JAY, + REMATCH_JEFFREY, + REMATCH_CAMERON, + REMATCH_JACKI, + REMATCH_WALTER, + REMATCH_KAREN, + REMATCH_JERRY, + REMATCH_ANNA_AND_MEG, + REMATCH_ISABEL, + REMATCH_MIGUEL, + REMATCH_TIMOTHY, + REMATCH_SHELBY, + REMATCH_CALVIN, + REMATCH_ELLIOT, + REMATCH_ISAIAH, + REMATCH_MARIA, + REMATCH_ABIGAIL, + REMATCH_DYLAN, + REMATCH_KATELYN, + REMATCH_BENJAMIN, + REMATCH_PABLO, + REMATCH_NICOLAS, + REMATCH_ROBERT, + REMATCH_LAO, + REMATCH_CYNDY, + REMATCH_MADELINE, + REMATCH_JENNY, + REMATCH_DIANA, + REMATCH_AMY_AND_LIV, + REMATCH_ERNEST, + REMATCH_CORY, + REMATCH_EDWIN, + REMATCH_LYDIA, + REMATCH_ISAAC, + REMATCH_GABRIELLE, + REMATCH_CATHERINE, + REMATCH_JACKSON, + REMATCH_HALEY, + REMATCH_JAMES, + REMATCH_TRENT, + REMATCH_SAWYER, + REMATCH_KIRA_AND_DAN, + REMATCH_WALLY_VR, // Entries above WALLY are considered normal trainers, from Wally below are special trainers + REMATCH_ROXANNE, + REMATCH_BRAWLY, + REMATCH_WATTSON, + REMATCH_FLANNERY, + REMATCH_NORMAN, + REMATCH_WINONA, + REMATCH_TATE_AND_LIZA, + REMATCH_JUAN, + REMATCH_SIDNEY, // Entries from SIDNEY below are considered part of REMATCH_ELITE_FOUR_ENTRIES. + REMATCH_PHOEBE, + REMATCH_GLACIA, + REMATCH_DRAKE, + REMATCH_WALLACE, + REMATCH_TABLE_ENTRIES // The total number of rematch entries. Must be last in enum +}; + +#define REMATCH_SPECIAL_TRAINER_START REMATCH_WALLY_VR +#define REMATCH_ELITE_FOUR_ENTRIES REMATCH_SIDNEY + +#endif // GUARD_REMATCHES_H diff --git a/include/gym_leader_rematch.h b/include/gym_leader_rematch.h index b31fb5e228..622d2db1bc 100644 --- a/include/gym_leader_rematch.h +++ b/include/gym_leader_rematch.h @@ -1,90 +1,7 @@ #ifndef GUARD_TRAINER_REMATCH_H #define GUARD_TRAINER_REMATCH_H -enum { - REMATCH_ROSE, - REMATCH_ANDRES, - REMATCH_DUSTY, - REMATCH_LOLA, - REMATCH_RICKY, - REMATCH_LILA_AND_ROY, - REMATCH_CRISTIN, - REMATCH_BROOKE, - REMATCH_WILTON, - REMATCH_VALERIE, - REMATCH_CINDY, - REMATCH_THALIA, - REMATCH_JESSICA, - REMATCH_WINSTON, - REMATCH_STEVE, - REMATCH_TONY, - REMATCH_NOB, - REMATCH_KOJI, - REMATCH_FERNANDO, - REMATCH_DALTON, - REMATCH_BERNIE, - REMATCH_ETHAN, - REMATCH_JOHN_AND_JAY, - REMATCH_JEFFREY, - REMATCH_CAMERON, - REMATCH_JACKI, - REMATCH_WALTER, - REMATCH_KAREN, - REMATCH_JERRY, - REMATCH_ANNA_AND_MEG, - REMATCH_ISABEL, - REMATCH_MIGUEL, - REMATCH_TIMOTHY, - REMATCH_SHELBY, - REMATCH_CALVIN, - REMATCH_ELLIOT, - REMATCH_ISAIAH, - REMATCH_MARIA, - REMATCH_ABIGAIL, - REMATCH_DYLAN, - REMATCH_KATELYN, - REMATCH_BENJAMIN, - REMATCH_PABLO, - REMATCH_NICOLAS, - REMATCH_ROBERT, - REMATCH_LAO, - REMATCH_CYNDY, - REMATCH_MADELINE, - REMATCH_JENNY, - REMATCH_DIANA, - REMATCH_AMY_AND_LIV, - REMATCH_ERNEST, - REMATCH_CORY, - REMATCH_EDWIN, - REMATCH_LYDIA, - REMATCH_ISAAC, - REMATCH_GABRIELLE, - REMATCH_CATHERINE, - REMATCH_JACKSON, - REMATCH_HALEY, - REMATCH_JAMES, - REMATCH_TRENT, - REMATCH_SAWYER, - REMATCH_KIRA_AND_DAN, - REMATCH_WALLY_VR, // Entries above WALLY are considered normal trainers, from Wally below are special trainers - REMATCH_ROXANNE, - REMATCH_BRAWLY, - REMATCH_WATTSON, - REMATCH_FLANNERY, - REMATCH_NORMAN, - REMATCH_WINONA, - REMATCH_TATE_AND_LIZA, - REMATCH_JUAN, - REMATCH_SIDNEY, // Entries from SIDNEY below are considered part of REMATCH_ELITE_FOUR_ENTRIES. - REMATCH_PHOEBE, - REMATCH_GLACIA, - REMATCH_DRAKE, - REMATCH_WALLACE, - REMATCH_TABLE_ENTRIES // The total number of rematch entries. Must be last in enum -}; - -#define REMATCH_SPECIAL_TRAINER_START REMATCH_WALLY_VR -#define REMATCH_ELITE_FOUR_ENTRIES REMATCH_SIDNEY +#include "constants/rematches.h" void UpdateGymLeaderRematch(void); diff --git a/map_data_rules.mk b/map_data_rules.mk index 626cd47240..d3f47a352e 100755 --- a/map_data_rules.mk +++ b/map_data_rules.mk @@ -9,9 +9,9 @@ MAP_EVENTS := $(patsubst $(MAPS_DIR)/%/,$(MAPS_DIR)/%/events.inc,$(MAP_DIRS)) MAP_HEADERS := $(patsubst $(MAPS_DIR)/%/,$(MAPS_DIR)/%/header.inc,$(MAP_DIRS)) $(DATA_ASM_BUILDDIR)/maps.o: $(DATA_ASM_SUBDIR)/maps.s $(LAYOUTS_DIR)/layouts.inc $(LAYOUTS_DIR)/layouts_table.inc $(MAPS_DIR)/headers.inc $(MAPS_DIR)/groups.inc $(MAPS_DIR)/connections.inc $(MAP_CONNECTIONS) $(MAP_HEADERS) - $(PREPROC) $< charmap.txt | $(CPP) -I include - | $(AS) $(ASFLAGS) -o $@ + $(PREPROC) $< charmap.txt | $(CPP) -I include - | $(PREPROC) -ie $< charmap.txt | $(AS) $(ASFLAGS) -o $@ $(DATA_ASM_BUILDDIR)/map_events.o: $(DATA_ASM_SUBDIR)/map_events.s $(MAPS_DIR)/events.inc $(MAP_EVENTS) - $(PREPROC) $< charmap.txt | $(CPP) -I include - | $(AS) $(ASFLAGS) -o $@ + $(PREPROC) $< charmap.txt | $(CPP) -I include - | $(PREPROC) -ie $< charmap.txt | $(AS) $(ASFLAGS) -o $@ $(MAPS_DIR)/%/header.inc: $(MAPS_DIR)/%/map.json $(MAPJSON) map emerald $< $(LAYOUTS_DIR)/layouts.json diff --git a/src/battle_setup.c b/src/battle_setup.c index e87ce6dd27..435ba4b8a3 100644 --- a/src/battle_setup.c +++ b/src/battle_setup.c @@ -1615,7 +1615,7 @@ static bool32 UpdateRandomTrainerRematches(const struct RematchTrainer *table, u // Trainer already wants a rematch. Don't bother updating it. ret = TRUE; } - else if (FlagGet(FLAG_MATCH_CALL_REGISTERED + i) + else if (FlagGet(TRAINER_REGISTERED_FLAGS_START + i) && (Random() % 100) <= 30) // 31% chance of getting a rematch. { SetRematchIdForTrainer(table, i); @@ -1744,7 +1744,7 @@ static u32 GetTrainerMatchCallFlag(u32 trainerId) for (i = 0; i < REMATCH_TABLE_ENTRIES; i++) { if (gRematchTable[i].trainerIds[0] == trainerId) - return FLAG_MATCH_CALL_REGISTERED + i; + return TRAINER_REGISTERED_FLAGS_START + i; } return 0xFFFF; diff --git a/src/field_specials.c b/src/field_specials.c index 7d20d3571d..1bbbbf4e17 100644 --- a/src/field_specials.c +++ b/src/field_specials.c @@ -3620,7 +3620,7 @@ bool32 IsTrainerRegistered(void) int index = GetRematchIdxByTrainerIdx(gSpecialVar_0x8004); if (index >= 0) { - if (FlagGet(FLAG_MATCH_CALL_REGISTERED + index) == TRUE) + if (FlagGet(TRAINER_REGISTERED_FLAGS_START + index) == TRUE) return TRUE; } return FALSE; diff --git a/src/match_call.c b/src/match_call.c index a9d18b3477..2c1ad924a5 100644 --- a/src/match_call.c +++ b/src/match_call.c @@ -131,7 +131,7 @@ static EWRAM_DATA struct MatchCallState sMatchCallState = {0}; static EWRAM_DATA struct BattleFrontierStreakInfo sBattleFrontierStreakInfo = {0}; static u32 GetCurrentTotalMinutes(struct Time *); -static u32 GetNumRegisteredNPCs(void); +static u32 GetNumRegisteredTrainers(void); static u32 GetActiveMatchCallTrainerId(u32); static int GetTrainerMatchCallId(int); static u16 GetRematchTrainerLocation(int); @@ -1098,7 +1098,7 @@ static bool32 UpdateMatchCallStepCounter(void) static bool32 SelectMatchCallTrainer(void) { u32 matchCallId; - u32 numRegistered = GetNumRegisteredNPCs(); + u32 numRegistered = GetNumRegisteredTrainers(); if (numRegistered == 0) return FALSE; @@ -1114,12 +1114,13 @@ static bool32 SelectMatchCallTrainer(void) return TRUE; } -static u32 GetNumRegisteredNPCs(void) +// Ignores registrable non-trainer NPCs, and special trainers like Wally and the gym leaders. +static u32 GetNumRegisteredTrainers(void) { u32 i, count; for (i = 0, count = 0; i < REMATCH_SPECIAL_TRAINER_START; i++) { - if (FlagGet(FLAG_MATCH_CALL_REGISTERED + i)) + if (FlagGet(TRAINER_REGISTERED_FLAGS_START + i)) count++; } @@ -1131,7 +1132,7 @@ static u32 GetActiveMatchCallTrainerId(u32 activeMatchCallId) u32 i; for (i = 0; i < REMATCH_SPECIAL_TRAINER_START; i++) { - if (FlagGet(FLAG_MATCH_CALL_REGISTERED + i)) + if (FlagGet(TRAINER_REGISTERED_FLAGS_START + i)) { if (!activeMatchCallId) return gRematchTable[i].trainerIds[0]; diff --git a/src/pokenav_match_call_data.c b/src/pokenav_match_call_data.c index f6d71009bb..1c3cf9aeeb 100644 --- a/src/pokenav_match_call_data.c +++ b/src/pokenav_match_call_data.c @@ -506,7 +506,7 @@ static const struct MatchCallStructTrainer sSidneyMatchCallHeader = { .type = MC_TYPE_LEADER, .mapSec = MAPSEC_EVER_GRANDE_CITY, - .flag = FLAG_REMATCH_SIDNEY, + .flag = FLAG_REGISTERED_SIDNEY, .rematchTableIdx = REMATCH_SIDNEY, .desc = gText_EliteFourMatchCallDesc, .name = NULL, @@ -522,7 +522,7 @@ static const struct MatchCallStructTrainer sPhoebeMatchCallHeader = { .type = MC_TYPE_LEADER, .mapSec = MAPSEC_EVER_GRANDE_CITY, - .flag = FLAG_REMATCH_PHOEBE, + .flag = FLAG_REGISTERED_PHOEBE, .rematchTableIdx = REMATCH_PHOEBE, .desc = gText_EliteFourMatchCallDesc, .name = NULL, @@ -538,7 +538,7 @@ static const struct MatchCallStructTrainer sGlaciaMatchCallHeader = { .type = MC_TYPE_LEADER, .mapSec = MAPSEC_EVER_GRANDE_CITY, - .flag = FLAG_REMATCH_GLACIA, + .flag = FLAG_REGISTERED_GLACIA, .rematchTableIdx = REMATCH_GLACIA, .desc = gText_EliteFourMatchCallDesc, .name = NULL, @@ -554,7 +554,7 @@ static const struct MatchCallStructTrainer sDrakeMatchCallHeader = { .type = MC_TYPE_LEADER, .mapSec = MAPSEC_EVER_GRANDE_CITY, - .flag = FLAG_REMATCH_DRAKE, + .flag = FLAG_REGISTERED_DRAKE, .rematchTableIdx = REMATCH_DRAKE, .desc = gText_EliteFourMatchCallDesc, .name = NULL, @@ -570,7 +570,7 @@ static const struct MatchCallStructTrainer sWallaceMatchCallHeader = { .type = MC_TYPE_LEADER, .mapSec = MAPSEC_EVER_GRANDE_CITY, - .flag = FLAG_REMATCH_WALLACE, + .flag = FLAG_REGISTERED_WALLACE, .rematchTableIdx = REMATCH_WALLACE, .desc = gText_ChampionMatchCallDesc, .name = NULL, @@ -1136,7 +1136,7 @@ bool32 MatchCall_HasRematchId(u32 idx) void SetMatchCallRegisteredFlag(void) { - int r0 = GetRematchIdxByTrainerIdx(gSpecialVar_0x8004); - if (r0 >= 0) - FlagSet(FLAG_MATCH_CALL_REGISTERED + r0); + int index = GetRematchIdxByTrainerIdx(gSpecialVar_0x8004); + if (index >= 0) + FlagSet(TRAINER_REGISTERED_FLAGS_START + index); } diff --git a/src/pokenav_match_call_list.c b/src/pokenav_match_call_list.c index 8d1a73f557..fb89e33e0b 100755 --- a/src/pokenav_match_call_list.c +++ b/src/pokenav_match_call_list.c @@ -261,7 +261,7 @@ static u32 LoopedTask_BuildMatchCallList(s32 taskState) bool32 IsRematchEntryRegistered(int rematchIndex) { if (rematchIndex < REMATCH_TABLE_ENTRIES) - return FlagGet(FLAG_MATCH_CALL_REGISTERED + rematchIndex); + return FlagGet(TRAINER_REGISTERED_FLAGS_START + rematchIndex); return FALSE; } From 5c55cc374815fb99ef43f55b8d2332d3798efc59 Mon Sep 17 00:00:00 2001 From: Martin Griffin Date: Wed, 21 Aug 2024 07:50:41 +0100 Subject: [PATCH 53/54] [preproc] support arbitrary expressions in enums --- tools/preproc/asm_file.cpp | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/tools/preproc/asm_file.cpp b/tools/preproc/asm_file.cpp index ca8b8cc4ae..36b6c7ed06 100644 --- a/tools/preproc/asm_file.cpp +++ b/tools/preproc/asm_file.cpp @@ -520,6 +520,7 @@ bool AsmFile::ParseEnum() long currentHeaderLine = SkipWhitespaceAndEol(); std::string enumName = ReadIdentifier(); currentHeaderLine += SkipWhitespaceAndEol(); + std::string enumBase = "0"; long enumCounter = 0; long symbolCount = 0; @@ -542,11 +543,28 @@ bool AsmFile::ParseEnum() if (m_buffer[m_pos] == '=') { m_pos++; - currentHeaderLine += SkipWhitespaceAndEol(); - enumCounter = ReadInteger(headerFilename, currentHeaderLine); - currentHeaderLine += SkipWhitespaceAndEol(); + SkipWhitespace(); + enumBase.clear(); + for (;;) + { + if (m_pos == m_size) + RaiseError("unexpected EOF"); + if (m_buffer[m_pos] == ',') + break; + if (m_buffer[m_pos] == '\n') + { + currentHeaderLine++; + enumBase.push_back(' '); + } + else + { + enumBase.push_back(m_buffer[m_pos]); + } + m_pos++; + } + enumCounter = 0; } - std::printf(".equiv %s, %ld\n", currentIdentName.c_str(), enumCounter); + std::printf(".equiv %s, (%s) + %ld\n", currentIdentName.c_str(), enumBase.c_str(), enumCounter); enumCounter++; symbolCount++; } From 625a006cabbf44734be2d0324264d86c3edba51b Mon Sep 17 00:00:00 2001 From: Icedude907 <34080011+Icedude907@users.noreply.github.com> Date: Fri, 30 Aug 2024 06:01:01 +1200 Subject: [PATCH 54/54] [Build System Rewrite] `mapjson` now takes output directory parameters. (#1949) --- Makefile | 57 ++-- include/constants/.gitignore | 3 + include/constants/layouts.h | 450 ------------------------- include/constants/map_groups.h | 596 --------------------------------- make_tools.mk | 14 +- map_data_rules.mk | 30 +- tools/jsonproc/jsonproc.cpp | 2 + tools/mapjson/mapjson.cpp | 112 ++++--- 8 files changed, 124 insertions(+), 1140 deletions(-) create mode 100644 include/constants/.gitignore delete mode 100755 include/constants/layouts.h delete mode 100755 include/constants/map_groups.h diff --git a/Makefile b/Makefile index bf74e0331a..15cbd709e4 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,9 @@ ifeq (compare,$(MAKECMDGOALS)) COMPARE := 1 endif +# Default make rule +all: rom + # don't use dkP's base_tools anymore # because the redefinition of $(CC) conflicts # with when we want to use $(CC) to preprocess files @@ -119,24 +122,23 @@ ifneq ($(MODERN),1) CPPFLAGS += -I tools/agbcc/include -I tools/agbcc -nostdinc -undef endif +# Variable filled out in other make files +AUTO_GEN_TARGETS := +include make_tools.mk + SHA1 := $(shell { command -v sha1sum || command -v shasum; } 2>/dev/null) -c -GFX := tools/gbagfx/gbagfx$(EXE) -AIF := tools/aif2pcm/aif2pcm$(EXE) -MID := tools/mid2agb/mid2agb$(EXE) -SCANINC := tools/scaninc/scaninc$(EXE) -PREPROC := tools/preproc/preproc$(EXE) -RAMSCRGEN := tools/ramscrgen/ramscrgen$(EXE) -FIX := tools/gbafix/gbafix$(EXE) -MAPJSON := tools/mapjson/mapjson$(EXE) -JSONPROC := tools/jsonproc/jsonproc$(EXE) +GFX := $(TOOLS_DIR)/gbagfx/gbagfx$(EXE) +AIF := $(TOOLS_DIR)/aif2pcm/aif2pcm$(EXE) +MID := $(TOOLS_DIR)/mid2agb/mid2agb$(EXE) +SCANINC := $(TOOLS_DIR)/scaninc/scaninc$(EXE) +PREPROC := $(TOOLS_DIR)/preproc/preproc$(EXE) +RAMSCRGEN := $(TOOLS_DIR)/ramscrgen/ramscrgen$(EXE) +FIX := $(TOOLS_DIR)/gbafix/gbafix$(EXE) +MAPJSON := $(TOOLS_DIR)/mapjson/mapjson$(EXE) +JSONPROC := $(TOOLS_DIR)/jsonproc/jsonproc$(EXE) PERL := perl -# Inclusive list. If you don't want a tool to be built, don't add it here. -TOOLDIRS := tools/aif2pcm tools/bin2c tools/gbafix tools/gbagfx tools/jsonproc tools/mapjson tools/mid2agb tools/preproc tools/ramscrgen tools/rsfont tools/scaninc -TOOLBASE = $(TOOLDIRS:tools/%=%) -TOOLS = $(foreach tool,$(TOOLBASE),tools/$(tool)/$(tool)$(EXE)) - MAKEFLAGS += --no-print-directory # Clear the default suffixes @@ -149,7 +151,7 @@ MAKEFLAGS += --no-print-directory # Secondary expansion is required for dependency variables in object rules. .SECONDEXPANSION: -.PHONY: all rom clean compare tidy tools mostlyclean clean-tools $(TOOLDIRS) libagbsyscall modern tidymodern tidynonmodern +.PHONY: all rom clean compare tidy mostlyclean libagbsyscall modern tidymodern tidynonmodern infoshell = $(foreach line, $(shell $1 | sed "s/ /__SPACE__/g"), $(info $(subst __SPACE__, ,$(line)))) @@ -159,6 +161,7 @@ infoshell = $(foreach line, $(shell $1 | sed "s/ /__SPACE__/g"), $(info $(subst # Since we don't need to reload most of this makefile ifeq (,$(filter-out all rom compare modern libagbsyscall syms,$(MAKECMDGOALS))) $(call infoshell, $(MAKE) -f make_tools.mk) +$(call infoshell, $(MAKE) generated) else NODEP ?= 1 endif @@ -209,17 +212,8 @@ SUBDIRS := $(sort $(dir $(OBJS))) $(shell mkdir -p $(SUBDIRS)) endif -AUTO_GEN_TARGETS := - -all: rom - -tools: $(TOOLDIRS) - syms: $(SYM) -$(TOOLDIRS): - @$(MAKE) -C $@ - rom: $(ROM) ifeq ($(COMPARE),1) @$(SHA1) rom.sha1 @@ -230,9 +224,6 @@ compare: all clean: mostlyclean clean-tools -clean-tools: - @$(foreach tooldir,$(TOOLDIRS),$(MAKE) clean -C $(tooldir);) - mostlyclean: tidynonmodern tidymodern find sound -iname '*.bin' -exec rm {} + rm -f $(MID_SUBDIR)/*.s @@ -263,6 +254,8 @@ include spritesheet_rules.mk include json_data_rules.mk include songs.mk +generated: $(AUTO_GEN_TARGETS) + %.s: ; %.png: ; %.pal: ; @@ -280,7 +273,7 @@ sound/%.bin: sound/%.aif ; $(AIF) $< $@ ifeq ($(MODERN),0) -$(C_BUILDDIR)/libc.o: CC1 := tools/agbcc/bin/old_agbcc$(EXE) +$(C_BUILDDIR)/libc.o: CC1 := $(TOOLS_DIR)/agbcc/bin/old_agbcc$(EXE) $(C_BUILDDIR)/libc.o: CFLAGS := -O2 $(C_BUILDDIR)/siirtc.o: CFLAGS := -mthumb-interwork @@ -289,10 +282,10 @@ $(C_BUILDDIR)/agb_flash.o: CFLAGS := -O -mthumb-interwork $(C_BUILDDIR)/agb_flash_1m.o: CFLAGS := -O -mthumb-interwork $(C_BUILDDIR)/agb_flash_mx.o: CFLAGS := -O -mthumb-interwork -$(C_BUILDDIR)/m4a.o: CC1 := tools/agbcc/bin/old_agbcc$(EXE) +$(C_BUILDDIR)/m4a.o: CC1 := $(TOOLS_DIR)/agbcc/bin/old_agbcc$(EXE) $(C_BUILDDIR)/record_mixing.o: CFLAGS += -ffreestanding -$(C_BUILDDIR)/librfu_intr.o: CC1 := tools/agbcc/bin/agbcc_arm$(EXE) +$(C_BUILDDIR)/librfu_intr.o: CC1 := $(TOOLS_DIR)/agbcc/bin/agbcc_arm$(EXE) $(C_BUILDDIR)/librfu_intr.o: CFLAGS := -O2 -mthumb-interwork -quiet else $(C_BUILDDIR)/librfu_intr.o: CFLAGS := -mthumb-interwork -O2 -mabi=apcs-gnu -mtune=arm7tdmi -march=armv4t -fno-toplevel-reorder -Wno-pointer-to-int-cast @@ -320,7 +313,7 @@ else endif else define C_DEP -$1: $2 $$(shell $(SCANINC) -I include -I tools/agbcc/include -I gflib $2) +$1: $2 $$(shell $(SCANINC) -I include -I $(TOOLS_DIR)/agbcc/include -I gflib $2) ifeq (,$$(KEEP_TEMPS)) @echo "$$(CC1) -o $$@ $$<" @$$(CPP) $$(CPPFLAGS) $$< | $$(PREPROC) -i $$< charmap.txt | $$(CC1) $$(CFLAGS) -o - - | cat - <(echo -e ".text\n\t.align\t2, 0") | $$(AS) $$(ASFLAGS) -o $$@ - @@ -347,7 +340,7 @@ else endif else define GFLIB_DEP -$1: $2 $$(shell $(SCANINC) -I include -I tools/agbcc/include -I gflib $2) +$1: $2 $$(shell $(SCANINC) -I include -I $(TOOLS_DIR)/agbcc/include -I gflib $2) ifeq (,$$(KEEP_TEMPS)) @echo "$$(CC1) -o $$@ $$<" @$$(CPP) $$(CPPFLAGS) $$< | $$(PREPROC) -i $$< charmap.txt | $$(CC1) $$(CFLAGS) -o - - | cat - <(echo -e ".text\n\t.align\t2, 0") | $$(AS) $$(ASFLAGS) -o $$@ - diff --git a/include/constants/.gitignore b/include/constants/.gitignore new file mode 100644 index 0000000000..761af9db76 --- /dev/null +++ b/include/constants/.gitignore @@ -0,0 +1,3 @@ +# Will be moved to build/ eventually +map_groups.h +layouts.h \ No newline at end of file diff --git a/include/constants/layouts.h b/include/constants/layouts.h deleted file mode 100755 index db92c95942..0000000000 --- a/include/constants/layouts.h +++ /dev/null @@ -1,450 +0,0 @@ -#ifndef GUARD_CONSTANTS_LAYOUTS_H -#define GUARD_CONSTANTS_LAYOUTS_H - -// -// DO NOT MODIFY THIS FILE! It is auto-generated from data/layouts/layouts.json -// - -#define LAYOUT_PETALBURG_CITY 1 -#define LAYOUT_SLATEPORT_CITY 2 -#define LAYOUT_MAUVILLE_CITY 3 -#define LAYOUT_RUSTBORO_CITY 4 -#define LAYOUT_FORTREE_CITY 5 -#define LAYOUT_LILYCOVE_CITY 6 -#define LAYOUT_MOSSDEEP_CITY 7 -#define LAYOUT_SOOTOPOLIS_CITY 8 -#define LAYOUT_EVER_GRANDE_CITY 9 -#define LAYOUT_LITTLEROOT_TOWN 10 -#define LAYOUT_OLDALE_TOWN 11 -#define LAYOUT_DEWFORD_TOWN 12 -#define LAYOUT_LAVARIDGE_TOWN 13 -#define LAYOUT_FALLARBOR_TOWN 14 -#define LAYOUT_VERDANTURF_TOWN 15 -#define LAYOUT_PACIFIDLOG_TOWN 16 -#define LAYOUT_ROUTE101 17 -#define LAYOUT_ROUTE102 18 -#define LAYOUT_ROUTE103 19 -#define LAYOUT_ROUTE104 20 -#define LAYOUT_ROUTE105 21 -#define LAYOUT_ROUTE106 22 -#define LAYOUT_ROUTE107 23 -#define LAYOUT_ROUTE108 24 -#define LAYOUT_ROUTE109 25 -#define LAYOUT_ROUTE110 26 -#define LAYOUT_ROUTE111 27 -#define LAYOUT_ROUTE112 28 -#define LAYOUT_ROUTE113 29 -#define LAYOUT_ROUTE114 30 -#define LAYOUT_ROUTE115 31 -#define LAYOUT_ROUTE116 32 -#define LAYOUT_ROUTE117 33 -#define LAYOUT_ROUTE118 34 -#define LAYOUT_ROUTE119 35 -#define LAYOUT_ROUTE120 36 -#define LAYOUT_ROUTE121 37 -#define LAYOUT_ROUTE122 38 -#define LAYOUT_ROUTE123 39 -#define LAYOUT_ROUTE124 40 -#define LAYOUT_ROUTE125 41 -#define LAYOUT_ROUTE126 42 -#define LAYOUT_ROUTE127 43 -#define LAYOUT_ROUTE128 44 -#define LAYOUT_ROUTE129 45 -#define LAYOUT_ROUTE130_MIRAGE_ISLAND 46 -#define LAYOUT_ROUTE131 47 -#define LAYOUT_ROUTE132 48 -#define LAYOUT_ROUTE133 49 -#define LAYOUT_ROUTE134 50 -#define LAYOUT_UNDERWATER_ROUTE126 51 -#define LAYOUT_UNDERWATER_ROUTE127 52 -#define LAYOUT_UNDERWATER_ROUTE128 53 -#define LAYOUT_LITTLEROOT_TOWN_BRENDANS_HOUSE_1F 54 -#define LAYOUT_LITTLEROOT_TOWN_BRENDANS_HOUSE_2F 55 -#define LAYOUT_LITTLEROOT_TOWN_MAYS_HOUSE_1F 56 -#define LAYOUT_LITTLEROOT_TOWN_MAYS_HOUSE_2F 57 -#define LAYOUT_LITTLEROOT_TOWN_PROFESSOR_BIRCHS_LAB 58 -#define LAYOUT_HOUSE1 59 -#define LAYOUT_HOUSE2 60 -#define LAYOUT_POKEMON_CENTER_1F 61 -#define LAYOUT_POKEMON_CENTER_2F 62 -#define LAYOUT_MART 63 -#define LAYOUT_HOUSE3 64 -#define LAYOUT_DEWFORD_TOWN_GYM 65 -#define LAYOUT_DEWFORD_TOWN_HALL 66 -#define LAYOUT_HOUSE4 67 -#define LAYOUT_LAVARIDGE_TOWN_HERB_SHOP 68 -#define LAYOUT_LAVARIDGE_TOWN_GYM_1F 69 -#define LAYOUT_LAVARIDGE_TOWN_GYM_B1F 70 -#define LAYOUT_LAVARIDGE_TOWN_POKEMON_CENTER_1F 71 -#define LAYOUT_FALLARBOR_TOWN_LEFTOVER_RSCONTEST_LOBBY 72 -#define LAYOUT_FALLARBOR_TOWN_LEFTOVER_RSCONTEST_HALL 73 -#define LAYOUT_LILYCOVE_CITY_HOUSE2 74 -#define LAYOUT_UNUSED_CONTEST_ROOM1 75 -#define LAYOUT_VERDANTURF_TOWN_WANDAS_HOUSE 76 -#define LAYOUT_PACIFIDLOG_TOWN_HOUSE1 77 -#define LAYOUT_PACIFIDLOG_TOWN_HOUSE2 78 -#define LAYOUT_PETALBURG_CITY_GYM 79 -#define LAYOUT_HOUSE_WITH_BED 80 -#define LAYOUT_SLATEPORT_CITY_STERNS_SHIPYARD_1F 81 -#define LAYOUT_SLATEPORT_CITY_STERNS_SHIPYARD_2F 82 -#define LAYOUT_UNUSED_CONTEST_ROOM2 83 -#define LAYOUT_UNUSED_CONTEST_ROOM3 84 -#define LAYOUT_SLATEPORT_CITY_POKEMON_FAN_CLUB 85 -#define LAYOUT_SLATEPORT_CITY_OCEANIC_MUSEUM_1F 86 -#define LAYOUT_SLATEPORT_CITY_OCEANIC_MUSEUM_2F 87 -#define LAYOUT_HARBOR 88 -#define LAYOUT_MAUVILLE_CITY_GYM 89 -#define LAYOUT_MAUVILLE_CITY_BIKE_SHOP 90 -#define LAYOUT_MAUVILLE_CITY_GAME_CORNER 91 -#define LAYOUT_RUSTBORO_CITY_DEVON_CORP_1F 92 -#define LAYOUT_RUSTBORO_CITY_DEVON_CORP_2F 93 -#define LAYOUT_RUSTBORO_CITY_GYM 94 -#define LAYOUT_RUSTBORO_CITY_POKEMON_SCHOOL 95 -#define LAYOUT_RUSTBORO_CITY_HOUSE 96 -#define LAYOUT_RUSTBORO_CITY_HOUSE1 97 -#define LAYOUT_RUSTBORO_CITY_CUTTERS_HOUSE 98 -#define LAYOUT_FORTREE_CITY_HOUSE1 99 -#define LAYOUT_FORTREE_CITY_GYM 100 -#define LAYOUT_FORTREE_CITY_HOUSE2 101 -#define LAYOUT_ROUTE104_MR_BRINEYS_HOUSE 102 -#define LAYOUT_LILYCOVE_CITY_LILYCOVE_MUSEUM_1F 103 -#define LAYOUT_LILYCOVE_CITY_LILYCOVE_MUSEUM_2F 104 -#define LAYOUT_LILYCOVE_CITY_CONTEST_LOBBY 105 -#define LAYOUT_LILYCOVE_CITY_CONTEST_HALL 106 -#define LAYOUT_LILYCOVE_CITY_POKEMON_TRAINER_FAN_CLUB 107 -#define LAYOUT_MOSSDEEP_CITY_GYM 108 -#define LAYOUT_SOOTOPOLIS_CITY_GYM_1F 109 -#define LAYOUT_SOOTOPOLIS_CITY_GYM_B1F 110 -#define LAYOUT_EVER_GRANDE_CITY_SIDNEYS_ROOM 111 -#define LAYOUT_EVER_GRANDE_CITY_PHOEBES_ROOM 112 -#define LAYOUT_EVER_GRANDE_CITY_GLACIAS_ROOM 113 -#define LAYOUT_EVER_GRANDE_CITY_DRAKES_ROOM 114 -#define LAYOUT_EVER_GRANDE_CITY_CHAMPIONS_ROOM 115 -#define LAYOUT_EVER_GRANDE_CITY_SHORT_HALL 116 -#define LAYOUT_ROUTE104_PRETTY_PETAL_FLOWER_SHOP 117 -#define LAYOUT_CABLE_CAR_STATION 118 -#define LAYOUT_ROUTE114_FOSSIL_MANIACS_HOUSE 119 -#define LAYOUT_ROUTE114_FOSSIL_MANIACS_TUNNEL 120 -#define LAYOUT_ROUTE114_LANETTES_HOUSE 121 -#define LAYOUT_ROUTE116_TUNNELERS_REST_HOUSE 122 -#define LAYOUT_ROUTE117_POKEMON_DAY_CARE 123 -#define LAYOUT_ROUTE121_SAFARI_ZONE_ENTRANCE 124 -#define LAYOUT_METEOR_FALLS_1F_1R 125 -#define LAYOUT_METEOR_FALLS_1F_2R 126 -#define LAYOUT_METEOR_FALLS_B1F_1R 127 -#define LAYOUT_METEOR_FALLS_B1F_2R 128 -#define LAYOUT_RUSTURF_TUNNEL 129 -#define LAYOUT_UNDERWATER_SOOTOPOLIS_CITY 130 -#define LAYOUT_DESERT_RUINS 131 -#define LAYOUT_GRANITE_CAVE_1F 132 -#define LAYOUT_GRANITE_CAVE_B1F 133 -#define LAYOUT_GRANITE_CAVE_B2F 134 -#define LAYOUT_PETALBURG_WOODS 135 -#define LAYOUT_MT_CHIMNEY 136 -#define LAYOUT_MT_PYRE_1F 137 -#define LAYOUT_MT_PYRE_2F 138 -#define LAYOUT_MT_PYRE_3F 139 -#define LAYOUT_MT_PYRE_4F 140 -#define LAYOUT_MT_PYRE_5F 141 -#define LAYOUT_MT_PYRE_6F 142 -#define LAYOUT_AQUA_HIDEOUT_1F 143 -#define LAYOUT_AQUA_HIDEOUT_B1F 144 -#define LAYOUT_AQUA_HIDEOUT_B2F 145 -#define LAYOUT_UNDERWATER_SEAFLOOR_CAVERN 146 -#define LAYOUT_SEAFLOOR_CAVERN_ENTRANCE 147 -#define LAYOUT_SEAFLOOR_CAVERN_ROOM1 148 -#define LAYOUT_SEAFLOOR_CAVERN_ROOM2 149 -#define LAYOUT_SEAFLOOR_CAVERN_ROOM3 150 -#define LAYOUT_SEAFLOOR_CAVERN_ROOM4 151 -#define LAYOUT_SEAFLOOR_CAVERN_ROOM5 152 -#define LAYOUT_SEAFLOOR_CAVERN_ROOM6 153 -#define LAYOUT_SEAFLOOR_CAVERN_ROOM7 154 -#define LAYOUT_SEAFLOOR_CAVERN_ROOM8 155 -#define LAYOUT_SEAFLOOR_CAVERN_ROOM9 156 -#define LAYOUT_CAVE_OF_ORIGIN_ENTRANCE 157 -#define LAYOUT_CAVE_OF_ORIGIN_1F 158 -#define LAYOUT_CAVE_OF_ORIGIN_UNUSED_RUBY_SAPPHIRE_MAP1 159 -#define LAYOUT_CAVE_OF_ORIGIN_UNUSED_RUBY_SAPPHIRE_MAP2 160 -#define LAYOUT_CAVE_OF_ORIGIN_UNUSED_RUBY_SAPPHIRE_MAP3 161 -#define LAYOUT_CAVE_OF_ORIGIN_B1F 162 -#define LAYOUT_VICTORY_ROAD_1F 163 -#define LAYOUT_SHOAL_CAVE_LOW_TIDE_ENTRANCE_ROOM 164 -#define LAYOUT_SHOAL_CAVE_LOW_TIDE_INNER_ROOM 165 -#define LAYOUT_SHOAL_CAVE_LOW_TIDE_STAIRS_ROOM 166 -#define LAYOUT_SHOAL_CAVE_LOW_TIDE_LOWER_ROOM 167 -#define LAYOUT_SHOAL_CAVE_HIGH_TIDE_ENTRANCE_ROOM 168 -#define LAYOUT_SHOAL_CAVE_HIGH_TIDE_INNER_ROOM 169 -#define LAYOUT_UNUSED_CAVE1 170 -#define LAYOUT_UNUSED_CAVE2 171 -#define LAYOUT_UNUSED_CAVE3 172 -#define LAYOUT_UNUSED_CAVE4 173 -#define LAYOUT_UNUSED_CAVE5 174 -#define LAYOUT_UNUSED_CAVE6 175 -#define LAYOUT_UNUSED_CAVE7 176 -#define LAYOUT_UNUSED_CAVE8 177 -#define LAYOUT_UNUSED_CAVE9 178 -#define LAYOUT_UNUSED_CAVE10 179 -#define LAYOUT_UNUSED_CAVE11 180 -#define LAYOUT_UNUSED_CAVE12 181 -#define LAYOUT_UNUSED_CAVE13 182 -#define LAYOUT_UNUSED_CAVE14 183 -#define LAYOUT_NEW_MAUVILLE_ENTRANCE 184 -#define LAYOUT_NEW_MAUVILLE_INSIDE 185 -#define LAYOUT_ABANDONED_SHIP_DECK 186 -#define LAYOUT_ABANDONED_SHIP_CORRIDORS_1F 187 -#define LAYOUT_ABANDONED_SHIP_ROOMS_1F 188 -#define LAYOUT_ABANDONED_SHIP_CORRIDORS_B1F 189 -#define LAYOUT_ABANDONED_SHIP_ROOMS_B1F 190 -#define LAYOUT_ABANDONED_SHIP_ROOMS2_B1F 191 -#define LAYOUT_ABANDONED_SHIP_UNDERWATER1 192 -#define LAYOUT_ABANDONED_SHIP_ROOM_B1F 193 -#define LAYOUT_ABANDONED_SHIP_ROOMS2_1F 194 -#define LAYOUT_ABANDONED_SHIP_CAPTAINS_OFFICE 195 -#define LAYOUT_ABANDONED_SHIP_UNDERWATER2 196 -#define LAYOUT_SECRET_BASE_RED_CAVE1 197 -#define LAYOUT_SECRET_BASE_BROWN_CAVE1 198 -#define LAYOUT_SECRET_BASE_BLUE_CAVE1 199 -#define LAYOUT_SECRET_BASE_YELLOW_CAVE1 200 -#define LAYOUT_SECRET_BASE_TREE1 201 -#define LAYOUT_SECRET_BASE_SHRUB1 202 -#define LAYOUT_SECRET_BASE_RED_CAVE2 203 -#define LAYOUT_SECRET_BASE_BROWN_CAVE2 204 -#define LAYOUT_SECRET_BASE_BLUE_CAVE2 205 -#define LAYOUT_SECRET_BASE_YELLOW_CAVE2 206 -#define LAYOUT_SECRET_BASE_TREE2 207 -#define LAYOUT_SECRET_BASE_SHRUB2 208 -#define LAYOUT_SECRET_BASE_RED_CAVE3 209 -#define LAYOUT_SECRET_BASE_BROWN_CAVE3 210 -#define LAYOUT_SECRET_BASE_BLUE_CAVE3 211 -#define LAYOUT_SECRET_BASE_YELLOW_CAVE3 212 -#define LAYOUT_SECRET_BASE_TREE3 213 -#define LAYOUT_SECRET_BASE_SHRUB3 214 -#define LAYOUT_SECRET_BASE_RED_CAVE4 215 -#define LAYOUT_SECRET_BASE_BROWN_CAVE4 216 -#define LAYOUT_SECRET_BASE_BLUE_CAVE4 217 -#define LAYOUT_SECRET_BASE_YELLOW_CAVE4 218 -#define LAYOUT_SECRET_BASE_TREE4 219 -#define LAYOUT_SECRET_BASE_SHRUB4 220 -#define LAYOUT_BATTLE_COLOSSEUM_2P 221 -#define LAYOUT_TRADE_CENTER 222 -#define LAYOUT_RECORD_CORNER 223 -#define LAYOUT_BATTLE_COLOSSEUM_4P 224 -#define LAYOUT_CONTEST_HALL 225 -#define LAYOUT_UNUSED_CONTEST_HALL1 226 -#define LAYOUT_UNUSED_CONTEST_HALL2 227 -#define LAYOUT_UNUSED_CONTEST_HALL3 228 -#define LAYOUT_UNUSED_CONTEST_HALL4 229 -#define LAYOUT_UNUSED_CONTEST_HALL5 230 -#define LAYOUT_UNUSED_CONTEST_HALL6 231 -#define LAYOUT_CONTEST_HALL_BEAUTY 232 -#define LAYOUT_CONTEST_HALL_TOUGH 233 -#define LAYOUT_CONTEST_HALL_COOL 234 -#define LAYOUT_CONTEST_HALL_SMART 235 -#define LAYOUT_CONTEST_HALL_CUTE 236 -#define LAYOUT_INSIDE_OF_TRUCK 237 -#define LAYOUT_SAFARI_ZONE_NORTHWEST 238 -#define LAYOUT_SAFARI_ZONE_NORTH 239 -#define LAYOUT_SAFARI_ZONE_SOUTHWEST 240 -#define LAYOUT_SAFARI_ZONE_SOUTH 241 -#define LAYOUT_UNUSED_OUTDOOR_AREA 242 -#define LAYOUT_ROUTE109_SEASHORE_HOUSE 243 -#define LAYOUT_ROUTE110_TRICK_HOUSE_ENTRANCE 244 -#define LAYOUT_ROUTE110_TRICK_HOUSE_END 245 -#define LAYOUT_ROUTE110_TRICK_HOUSE_CORRIDOR 246 -#define LAYOUT_ROUTE110_TRICK_HOUSE_PUZZLE1 247 -#define LAYOUT_ROUTE110_TRICK_HOUSE_PUZZLE2 248 -#define LAYOUT_ROUTE110_TRICK_HOUSE_PUZZLE3 249 -#define LAYOUT_ROUTE110_TRICK_HOUSE_PUZZLE4 250 -#define LAYOUT_ROUTE110_TRICK_HOUSE_PUZZLE5 251 -#define LAYOUT_ROUTE110_TRICK_HOUSE_PUZZLE6 252 -#define LAYOUT_ROUTE110_TRICK_HOUSE_PUZZLE7 253 -#define LAYOUT_ROUTE110_TRICK_HOUSE_PUZZLE8 254 -#define LAYOUT_FORTREE_CITY_DECORATION_SHOP 255 -#define LAYOUT_ROUTE110_SEASIDE_CYCLING_ROAD_ENTRANCE 256 -#define LAYOUT_LILYCOVE_CITY_DEPARTMENT_STORE_1F 257 -#define LAYOUT_LILYCOVE_CITY_DEPARTMENT_STORE_2F 258 -#define LAYOUT_LILYCOVE_CITY_DEPARTMENT_STORE_3F 259 -#define LAYOUT_LILYCOVE_CITY_DEPARTMENT_STORE_4F 260 -#define LAYOUT_LILYCOVE_CITY_DEPARTMENT_STORE_5F 261 -#define LAYOUT_LILYCOVE_CITY_DEPARTMENT_STORE_ROOFTOP 262 -#define LAYOUT_ROUTE130 263 -#define LAYOUT_BATTLE_FRONTIER_BATTLE_TOWER_LOBBY 264 -#define LAYOUT_BATTLE_FRONTIER_OUTSIDE_WEST 265 -#define LAYOUT_BATTLE_ELEVATOR 266 -#define LAYOUT_BATTLE_FRONTIER_BATTLE_TOWER_CORRIDOR 267 -#define LAYOUT_BATTLE_FRONTIER_BATTLE_TOWER_BATTLE_ROOM 268 -#define LAYOUT_RUSTBORO_CITY_DEVON_CORP_3F 269 -#define LAYOUT_EVER_GRANDE_CITY_POKEMON_LEAGUE_1F 270 -#define LAYOUT_ROUTE119_WEATHER_INSTITUTE_1F 271 -#define LAYOUT_ROUTE119_WEATHER_INSTITUTE_2F 272 -#define LAYOUT_LILYCOVE_CITY_DEPARTMENT_STORE_ELEVATOR 273 -#define LAYOUT_UNDERWATER_ROUTE124 274 -#define LAYOUT_MOSSDEEP_CITY_SPACE_CENTER_1F 275 -#define LAYOUT_MOSSDEEP_CITY_SPACE_CENTER_2F 276 -#define LAYOUT_SS_TIDAL_CORRIDOR 277 -#define LAYOUT_SS_TIDAL_LOWER_DECK 278 -#define LAYOUT_SS_TIDAL_ROOMS 279 -#define LAYOUT_ISLAND_CAVE 280 -#define LAYOUT_ANCIENT_TOMB 281 -#define LAYOUT_UNDERWATER_ROUTE134 282 -#define LAYOUT_UNDERWATER_SEALED_CHAMBER 283 -#define LAYOUT_SEALED_CHAMBER_OUTER_ROOM 284 -#define LAYOUT_VICTORY_ROAD_B1F 285 -#define LAYOUT_VICTORY_ROAD_B2F 286 -#define LAYOUT_ROUTE104_PROTOTYPE 287 -#define LAYOUT_GRANITE_CAVE_STEVENS_ROOM 288 -#define LAYOUT_ABANDONED_SHIP_HIDDEN_FLOOR_CORRIDORS 289 -#define LAYOUT_SOUTHERN_ISLAND_EXTERIOR 290 -#define LAYOUT_SOUTHERN_ISLAND_INTERIOR 291 -#define LAYOUT_JAGGED_PASS 292 -#define LAYOUT_FIERY_PATH 293 -#define LAYOUT_RUSTBORO_CITY_FLAT2_1F 294 -#define LAYOUT_RUSTBORO_CITY_FLAT2_2F 295 -#define LAYOUT_RUSTBORO_CITY_FLAT2_3F 296 -#define LAYOUT_SOOTOPOLIS_CITY_LOTAD_AND_SEEDOT_HOUSE 297 -#define LAYOUT_EVER_GRANDE_CITY_HALL_OF_FAME 298 -#define LAYOUT_LILYCOVE_CITY_COVE_LILY_MOTEL_1F 299 -#define LAYOUT_LILYCOVE_CITY_COVE_LILY_MOTEL_2F 300 -#define LAYOUT_ROUTE124_DIVING_TREASURE_HUNTERS_HOUSE 301 -#define LAYOUT_MT_PYRE_EXTERIOR 302 -#define LAYOUT_MT_PYRE_SUMMIT 303 -#define LAYOUT_SEALED_CHAMBER_INNER_ROOM 304 -#define LAYOUT_MOSSDEEP_CITY_GAME_CORNER_1F 305 -#define LAYOUT_MOSSDEEP_CITY_GAME_CORNER_B1F 306 -#define LAYOUT_SOOTOPOLIS_CITY_HOUSE1 307 -#define LAYOUT_SOOTOPOLIS_CITY_HOUSE2 308 -#define LAYOUT_SOOTOPOLIS_CITY_HOUSE3 309 -#define LAYOUT_ABANDONED_SHIP_HIDDEN_FLOOR_ROOMS 310 -#define LAYOUT_SCORCHED_SLAB 311 -#define LAYOUT_CAVE_OF_ORIGIN_UNUSED_B4F_LAVA 312 -#define LAYOUT_RUSTBORO_CITY_FLAT1_1F 313 -#define LAYOUT_RUSTBORO_CITY_FLAT1_2F 314 -#define LAYOUT_EVER_GRANDE_CITY_HALL4 315 -#define LAYOUT_AQUA_HIDEOUT_UNUSED_RUBY_MAP1 316 -#define LAYOUT_AQUA_HIDEOUT_UNUSED_RUBY_MAP2 317 -#define LAYOUT_AQUA_HIDEOUT_UNUSED_RUBY_MAP3 318 -#define LAYOUT_ROUTE131_SKY_PILLAR 319 -#define LAYOUT_SKY_PILLAR_ENTRANCE 320 -#define LAYOUT_SKY_PILLAR_OUTSIDE 321 -#define LAYOUT_SKY_PILLAR_1F 322 -#define LAYOUT_SKY_PILLAR_2F 323 -#define LAYOUT_SKY_PILLAR_3F 324 -#define LAYOUT_SKY_PILLAR_4F 325 -#define LAYOUT_SEAFLOOR_CAVERN_ROOM9_LAVA 326 -#define LAYOUT_MOSSDEEP_CITY_STEVENS_HOUSE 327 -#define LAYOUT_SHOAL_CAVE_LOW_TIDE_ICE_ROOM 328 -#define LAYOUT_SAFARI_ZONE_REST_HOUSE 329 -#define LAYOUT_SKY_PILLAR_5F 330 -#define LAYOUT_SKY_PILLAR_TOP 331 -#define LAYOUT_BATTLE_FRONTIER_BATTLE_DOME_LOBBY 332 -#define LAYOUT_BATTLE_FRONTIER_BATTLE_DOME_CORRIDOR 333 -#define LAYOUT_BATTLE_FRONTIER_BATTLE_DOME_PRE_BATTLE_ROOM 334 -#define LAYOUT_BATTLE_FRONTIER_BATTLE_DOME_BATTLE_ROOM 335 -#define LAYOUT_MAGMA_HIDEOUT_1F 336 -#define LAYOUT_MAGMA_HIDEOUT_2F_1R 337 -#define LAYOUT_MAGMA_HIDEOUT_2F_2R 338 -#define LAYOUT_MAGMA_HIDEOUT_3F_1R 339 -#define LAYOUT_MAGMA_HIDEOUT_3F_2R 340 -#define LAYOUT_MAGMA_HIDEOUT_4F 341 -#define LAYOUT_BATTLE_FRONTIER_BATTLE_PALACE_LOBBY 342 -#define LAYOUT_BATTLE_FRONTIER_BATTLE_PALACE_CORRIDOR 343 -#define LAYOUT_BATTLE_FRONTIER_BATTLE_PALACE_BATTLE_ROOM 344 -#define LAYOUT_BATTLE_FRONTIER_OUTSIDE_EAST 345 -#define LAYOUT_BATTLE_FRONTIER_BATTLE_FACTORY_LOBBY 346 -#define LAYOUT_BATTLE_FRONTIER_BATTLE_FACTORY_PRE_BATTLE_ROOM 347 -#define LAYOUT_BATTLE_FRONTIER_BATTLE_FACTORY_BATTLE_ROOM 348 -#define LAYOUT_BATTLE_FRONTIER_BATTLE_PIKE_LOBBY 349 -#define LAYOUT_BATTLE_FRONTIER_BATTLE_PIKE_CORRIDOR 350 -#define LAYOUT_BATTLE_FRONTIER_BATTLE_PIKE_THREE_PATH_ROOM 351 -#define LAYOUT_BATTLE_FRONTIER_BATTLE_PIKE_ROOM_NORMAL 352 -#define LAYOUT_BATTLE_FRONTIER_BATTLE_PIKE_ROOM_FINAL 353 -#define LAYOUT_BATTLE_FRONTIER_BATTLE_ARENA_LOBBY 354 -#define LAYOUT_BATTLE_FRONTIER_BATTLE_ARENA_CORRIDOR 355 -#define LAYOUT_BATTLE_FRONTIER_BATTLE_ARENA_BATTLE_ROOM 356 -#define LAYOUT_SOOTOPOLIS_CITY_LEGENDS_BATTLE 357 -#define LAYOUT_BATTLE_FRONTIER_BATTLE_PIKE_ROOM_WILD_MONS 358 -#define LAYOUT_BATTLE_FRONTIER_BATTLE_PIKE_ROOM_UNUSED 359 -#define LAYOUT_BATTLE_FRONTIER_BATTLE_PYRAMID_LOBBY 360 -#define LAYOUT_BATTLE_FRONTIER_BATTLE_PYRAMID_FLOOR 361 -#define LAYOUT_BATTLE_PYRAMID_SQUARE01 362 -#define LAYOUT_BATTLE_PYRAMID_SQUARE02 363 -#define LAYOUT_BATTLE_PYRAMID_SQUARE03 364 -#define LAYOUT_BATTLE_PYRAMID_SQUARE04 365 -#define LAYOUT_BATTLE_PYRAMID_SQUARE05 366 -#define LAYOUT_BATTLE_PYRAMID_SQUARE06 367 -#define LAYOUT_BATTLE_PYRAMID_SQUARE07 368 -#define LAYOUT_BATTLE_PYRAMID_SQUARE08 369 -#define LAYOUT_BATTLE_PYRAMID_SQUARE09 370 -#define LAYOUT_BATTLE_PYRAMID_SQUARE10 371 -#define LAYOUT_BATTLE_PYRAMID_SQUARE11 372 -#define LAYOUT_BATTLE_PYRAMID_SQUARE12 373 -#define LAYOUT_BATTLE_PYRAMID_SQUARE13 374 -#define LAYOUT_BATTLE_PYRAMID_SQUARE14 375 -#define LAYOUT_BATTLE_PYRAMID_SQUARE15 376 -#define LAYOUT_BATTLE_PYRAMID_SQUARE16 377 -#define LAYOUT_BATTLE_FRONTIER_BATTLE_PYRAMID_TOP 378 -#define LAYOUT_MAGMA_HIDEOUT_3F_3R 379 -#define LAYOUT_MAGMA_HIDEOUT_2F_3R 380 -#define LAYOUT_MIRAGE_TOWER_1F 381 -#define LAYOUT_MIRAGE_TOWER_2F 382 -#define LAYOUT_MIRAGE_TOWER_3F 383 -#define LAYOUT_BATTLE_TENT_LOBBY 384 -#define LAYOUT_BATTLE_TENT_CORRIDOR 385 -#define LAYOUT_BATTLE_TENT_BATTLE_ROOM 386 -#define LAYOUT_VERDANTURF_TOWN_BATTLE_TENT_BATTLE_ROOM 387 -#define LAYOUT_MIRAGE_TOWER_4F 388 -#define LAYOUT_DESERT_UNDERPASS 389 -#define LAYOUT_BATTLE_FRONTIER_BATTLE_TOWER_MULTI_PARTNER_ROOM 390 -#define LAYOUT_BATTLE_FRONTIER_BATTLE_TOWER_MULTI_CORRIDOR 391 -#define LAYOUT_ROUTE111_NO_MIRAGE_TOWER 392 -#define LAYOUT_UNION_ROOM 393 -#define LAYOUT_SAFARI_ZONE_NORTHEAST 394 -#define LAYOUT_SAFARI_ZONE_SOUTHEAST 395 -#define LAYOUT_BATTLE_FRONTIER_RANKING_HALL 396 -#define LAYOUT_BATTLE_FRONTIER_LOUNGE1 397 -#define LAYOUT_BATTLE_FRONTIER_EXCHANGE_SERVICE_CORNER 398 -#define LAYOUT_BATTLE_FRONTIER_RECEPTION_GATE 399 -#define LAYOUT_ARTISAN_CAVE_B1F 400 -#define LAYOUT_ARTISAN_CAVE_1F 401 -#define LAYOUT_FARAWAY_ISLAND_ENTRANCE 402 -#define LAYOUT_FARAWAY_ISLAND_INTERIOR 403 -#define LAYOUT_BIRTH_ISLAND_EXTERIOR 404 -#define LAYOUT_ISLAND_HARBOR 405 -#define LAYOUT_UNDERWATER_MARINE_CAVE 406 -#define LAYOUT_MARINE_CAVE_ENTRANCE 407 -#define LAYOUT_TERRA_CAVE_ENTRANCE 408 -#define LAYOUT_TERRA_CAVE_END 409 -#define LAYOUT_UNDERWATER_ROUTE105 410 -#define LAYOUT_UNDERWATER_ROUTE125 411 -#define LAYOUT_UNDERWATER_ROUTE129 412 -#define LAYOUT_MARINE_CAVE_END 413 -#define LAYOUT_TRAINER_HILL_ENTRANCE 414 -#define LAYOUT_TRAINER_HILL_1F 415 -#define LAYOUT_TRAINER_HILL_2F 416 -#define LAYOUT_TRAINER_HILL_3F 417 -#define LAYOUT_TRAINER_HILL_4F 418 -#define LAYOUT_TRAINER_HILL_ROOF 419 -#define LAYOUT_ALTERING_CAVE 420 -#define LAYOUT_NAVEL_ROCK_EXTERIOR 421 -#define LAYOUT_NAVEL_ROCK_ENTRANCE 422 -#define LAYOUT_NAVEL_ROCK_TOP 423 -#define LAYOUT_NAVEL_ROCK_BOTTOM 424 -#define LAYOUT_NAVEL_ROCK_LADDER_ROOM1 425 -#define LAYOUT_NAVEL_ROCK_LADDER_ROOM2 426 -#define LAYOUT_NAVEL_ROCK_B1F 427 -#define LAYOUT_NAVEL_ROCK_FORK 428 -#define LAYOUT_BATTLE_FRONTIER_LOUNGE2 429 -#define LAYOUT_BATTLE_FRONTIER_SCOTTS_HOUSE 430 -#define LAYOUT_METEOR_FALLS_STEVENS_CAVE 431 -#define LAYOUT_LITTLEROOT_TOWN_PROFESSOR_BIRCHS_LAB_WITH_TABLE 432 -#define LAYOUT_SKY_PILLAR_1F_CLEAN 433 -#define LAYOUT_SKY_PILLAR_2F_CLEAN 434 -#define LAYOUT_SKY_PILLAR_3F_CLEAN 435 -#define LAYOUT_SKY_PILLAR_4F_CLEAN 436 -#define LAYOUT_SKY_PILLAR_5F_CLEAN 437 -#define LAYOUT_SKY_PILLAR_TOP_CLEAN 438 -#define LAYOUT_SOOTOPOLIS_CITY_MYSTERY_EVENTS_HOUSE_1F 439 -#define LAYOUT_SOOTOPOLIS_CITY_MYSTERY_EVENTS_HOUSE_B1F 440 -#define LAYOUT_SOOTOPOLIS_CITY_MYSTERY_EVENTS_HOUSE_1F_STAIRS_UNBLOCKED 441 - -#endif // GUARD_CONSTANTS_LAYOUTS_H diff --git a/include/constants/map_groups.h b/include/constants/map_groups.h deleted file mode 100755 index eaf40a525d..0000000000 --- a/include/constants/map_groups.h +++ /dev/null @@ -1,596 +0,0 @@ -#ifndef GUARD_CONSTANTS_MAP_GROUPS_H -#define GUARD_CONSTANTS_MAP_GROUPS_H - -// -// DO NOT MODIFY THIS FILE! It is auto-generated from data/maps/map_groups.json -// - -// gMapGroup_TownsAndRoutes -#define MAP_PETALBURG_CITY (0 | (0 << 8)) -#define MAP_SLATEPORT_CITY (1 | (0 << 8)) -#define MAP_MAUVILLE_CITY (2 | (0 << 8)) -#define MAP_RUSTBORO_CITY (3 | (0 << 8)) -#define MAP_FORTREE_CITY (4 | (0 << 8)) -#define MAP_LILYCOVE_CITY (5 | (0 << 8)) -#define MAP_MOSSDEEP_CITY (6 | (0 << 8)) -#define MAP_SOOTOPOLIS_CITY (7 | (0 << 8)) -#define MAP_EVER_GRANDE_CITY (8 | (0 << 8)) -#define MAP_LITTLEROOT_TOWN (9 | (0 << 8)) -#define MAP_OLDALE_TOWN (10 | (0 << 8)) -#define MAP_DEWFORD_TOWN (11 | (0 << 8)) -#define MAP_LAVARIDGE_TOWN (12 | (0 << 8)) -#define MAP_FALLARBOR_TOWN (13 | (0 << 8)) -#define MAP_VERDANTURF_TOWN (14 | (0 << 8)) -#define MAP_PACIFIDLOG_TOWN (15 | (0 << 8)) -#define MAP_ROUTE101 (16 | (0 << 8)) -#define MAP_ROUTE102 (17 | (0 << 8)) -#define MAP_ROUTE103 (18 | (0 << 8)) -#define MAP_ROUTE104 (19 | (0 << 8)) -#define MAP_ROUTE105 (20 | (0 << 8)) -#define MAP_ROUTE106 (21 | (0 << 8)) -#define MAP_ROUTE107 (22 | (0 << 8)) -#define MAP_ROUTE108 (23 | (0 << 8)) -#define MAP_ROUTE109 (24 | (0 << 8)) -#define MAP_ROUTE110 (25 | (0 << 8)) -#define MAP_ROUTE111 (26 | (0 << 8)) -#define MAP_ROUTE112 (27 | (0 << 8)) -#define MAP_ROUTE113 (28 | (0 << 8)) -#define MAP_ROUTE114 (29 | (0 << 8)) -#define MAP_ROUTE115 (30 | (0 << 8)) -#define MAP_ROUTE116 (31 | (0 << 8)) -#define MAP_ROUTE117 (32 | (0 << 8)) -#define MAP_ROUTE118 (33 | (0 << 8)) -#define MAP_ROUTE119 (34 | (0 << 8)) -#define MAP_ROUTE120 (35 | (0 << 8)) -#define MAP_ROUTE121 (36 | (0 << 8)) -#define MAP_ROUTE122 (37 | (0 << 8)) -#define MAP_ROUTE123 (38 | (0 << 8)) -#define MAP_ROUTE124 (39 | (0 << 8)) -#define MAP_ROUTE125 (40 | (0 << 8)) -#define MAP_ROUTE126 (41 | (0 << 8)) -#define MAP_ROUTE127 (42 | (0 << 8)) -#define MAP_ROUTE128 (43 | (0 << 8)) -#define MAP_ROUTE129 (44 | (0 << 8)) -#define MAP_ROUTE130 (45 | (0 << 8)) -#define MAP_ROUTE131 (46 | (0 << 8)) -#define MAP_ROUTE132 (47 | (0 << 8)) -#define MAP_ROUTE133 (48 | (0 << 8)) -#define MAP_ROUTE134 (49 | (0 << 8)) -#define MAP_UNDERWATER_ROUTE124 (50 | (0 << 8)) -#define MAP_UNDERWATER_ROUTE126 (51 | (0 << 8)) -#define MAP_UNDERWATER_ROUTE127 (52 | (0 << 8)) -#define MAP_UNDERWATER_ROUTE128 (53 | (0 << 8)) -#define MAP_UNDERWATER_ROUTE129 (54 | (0 << 8)) -#define MAP_UNDERWATER_ROUTE105 (55 | (0 << 8)) -#define MAP_UNDERWATER_ROUTE125 (56 | (0 << 8)) - -// gMapGroup_IndoorLittleroot -#define MAP_LITTLEROOT_TOWN_BRENDANS_HOUSE_1F (0 | (1 << 8)) -#define MAP_LITTLEROOT_TOWN_BRENDANS_HOUSE_2F (1 | (1 << 8)) -#define MAP_LITTLEROOT_TOWN_MAYS_HOUSE_1F (2 | (1 << 8)) -#define MAP_LITTLEROOT_TOWN_MAYS_HOUSE_2F (3 | (1 << 8)) -#define MAP_LITTLEROOT_TOWN_PROFESSOR_BIRCHS_LAB (4 | (1 << 8)) - -// gMapGroup_IndoorOldale -#define MAP_OLDALE_TOWN_HOUSE1 (0 | (2 << 8)) -#define MAP_OLDALE_TOWN_HOUSE2 (1 | (2 << 8)) -#define MAP_OLDALE_TOWN_POKEMON_CENTER_1F (2 | (2 << 8)) -#define MAP_OLDALE_TOWN_POKEMON_CENTER_2F (3 | (2 << 8)) -#define MAP_OLDALE_TOWN_MART (4 | (2 << 8)) - -// gMapGroup_IndoorDewford -#define MAP_DEWFORD_TOWN_HOUSE1 (0 | (3 << 8)) -#define MAP_DEWFORD_TOWN_POKEMON_CENTER_1F (1 | (3 << 8)) -#define MAP_DEWFORD_TOWN_POKEMON_CENTER_2F (2 | (3 << 8)) -#define MAP_DEWFORD_TOWN_GYM (3 | (3 << 8)) -#define MAP_DEWFORD_TOWN_HALL (4 | (3 << 8)) -#define MAP_DEWFORD_TOWN_HOUSE2 (5 | (3 << 8)) - -// gMapGroup_IndoorLavaridge -#define MAP_LAVARIDGE_TOWN_HERB_SHOP (0 | (4 << 8)) -#define MAP_LAVARIDGE_TOWN_GYM_1F (1 | (4 << 8)) -#define MAP_LAVARIDGE_TOWN_GYM_B1F (2 | (4 << 8)) -#define MAP_LAVARIDGE_TOWN_HOUSE (3 | (4 << 8)) -#define MAP_LAVARIDGE_TOWN_MART (4 | (4 << 8)) -#define MAP_LAVARIDGE_TOWN_POKEMON_CENTER_1F (5 | (4 << 8)) -#define MAP_LAVARIDGE_TOWN_POKEMON_CENTER_2F (6 | (4 << 8)) - -// gMapGroup_IndoorFallarbor -#define MAP_FALLARBOR_TOWN_MART (0 | (5 << 8)) -#define MAP_FALLARBOR_TOWN_BATTLE_TENT_LOBBY (1 | (5 << 8)) -#define MAP_FALLARBOR_TOWN_BATTLE_TENT_CORRIDOR (2 | (5 << 8)) -#define MAP_FALLARBOR_TOWN_BATTLE_TENT_BATTLE_ROOM (3 | (5 << 8)) -#define MAP_FALLARBOR_TOWN_POKEMON_CENTER_1F (4 | (5 << 8)) -#define MAP_FALLARBOR_TOWN_POKEMON_CENTER_2F (5 | (5 << 8)) -#define MAP_FALLARBOR_TOWN_COZMOS_HOUSE (6 | (5 << 8)) -#define MAP_FALLARBOR_TOWN_MOVE_RELEARNERS_HOUSE (7 | (5 << 8)) - -// gMapGroup_IndoorVerdanturf -#define MAP_VERDANTURF_TOWN_BATTLE_TENT_LOBBY (0 | (6 << 8)) -#define MAP_VERDANTURF_TOWN_BATTLE_TENT_CORRIDOR (1 | (6 << 8)) -#define MAP_VERDANTURF_TOWN_BATTLE_TENT_BATTLE_ROOM (2 | (6 << 8)) -#define MAP_VERDANTURF_TOWN_MART (3 | (6 << 8)) -#define MAP_VERDANTURF_TOWN_POKEMON_CENTER_1F (4 | (6 << 8)) -#define MAP_VERDANTURF_TOWN_POKEMON_CENTER_2F (5 | (6 << 8)) -#define MAP_VERDANTURF_TOWN_WANDAS_HOUSE (6 | (6 << 8)) -#define MAP_VERDANTURF_TOWN_FRIENDSHIP_RATERS_HOUSE (7 | (6 << 8)) -#define MAP_VERDANTURF_TOWN_HOUSE (8 | (6 << 8)) - -// gMapGroup_IndoorPacifidlog -#define MAP_PACIFIDLOG_TOWN_POKEMON_CENTER_1F (0 | (7 << 8)) -#define MAP_PACIFIDLOG_TOWN_POKEMON_CENTER_2F (1 | (7 << 8)) -#define MAP_PACIFIDLOG_TOWN_HOUSE1 (2 | (7 << 8)) -#define MAP_PACIFIDLOG_TOWN_HOUSE2 (3 | (7 << 8)) -#define MAP_PACIFIDLOG_TOWN_HOUSE3 (4 | (7 << 8)) -#define MAP_PACIFIDLOG_TOWN_HOUSE4 (5 | (7 << 8)) -#define MAP_PACIFIDLOG_TOWN_HOUSE5 (6 | (7 << 8)) - -// gMapGroup_IndoorPetalburg -#define MAP_PETALBURG_CITY_WALLYS_HOUSE (0 | (8 << 8)) -#define MAP_PETALBURG_CITY_GYM (1 | (8 << 8)) -#define MAP_PETALBURG_CITY_HOUSE1 (2 | (8 << 8)) -#define MAP_PETALBURG_CITY_HOUSE2 (3 | (8 << 8)) -#define MAP_PETALBURG_CITY_POKEMON_CENTER_1F (4 | (8 << 8)) -#define MAP_PETALBURG_CITY_POKEMON_CENTER_2F (5 | (8 << 8)) -#define MAP_PETALBURG_CITY_MART (6 | (8 << 8)) - -// gMapGroup_IndoorSlateport -#define MAP_SLATEPORT_CITY_STERNS_SHIPYARD_1F (0 | (9 << 8)) -#define MAP_SLATEPORT_CITY_STERNS_SHIPYARD_2F (1 | (9 << 8)) -#define MAP_SLATEPORT_CITY_BATTLE_TENT_LOBBY (2 | (9 << 8)) -#define MAP_SLATEPORT_CITY_BATTLE_TENT_CORRIDOR (3 | (9 << 8)) -#define MAP_SLATEPORT_CITY_BATTLE_TENT_BATTLE_ROOM (4 | (9 << 8)) -#define MAP_SLATEPORT_CITY_NAME_RATERS_HOUSE (5 | (9 << 8)) -#define MAP_SLATEPORT_CITY_POKEMON_FAN_CLUB (6 | (9 << 8)) -#define MAP_SLATEPORT_CITY_OCEANIC_MUSEUM_1F (7 | (9 << 8)) -#define MAP_SLATEPORT_CITY_OCEANIC_MUSEUM_2F (8 | (9 << 8)) -#define MAP_SLATEPORT_CITY_HARBOR (9 | (9 << 8)) -#define MAP_SLATEPORT_CITY_HOUSE (10 | (9 << 8)) -#define MAP_SLATEPORT_CITY_POKEMON_CENTER_1F (11 | (9 << 8)) -#define MAP_SLATEPORT_CITY_POKEMON_CENTER_2F (12 | (9 << 8)) -#define MAP_SLATEPORT_CITY_MART (13 | (9 << 8)) - -// gMapGroup_IndoorMauville -#define MAP_MAUVILLE_CITY_GYM (0 | (10 << 8)) -#define MAP_MAUVILLE_CITY_BIKE_SHOP (1 | (10 << 8)) -#define MAP_MAUVILLE_CITY_HOUSE1 (2 | (10 << 8)) -#define MAP_MAUVILLE_CITY_GAME_CORNER (3 | (10 << 8)) -#define MAP_MAUVILLE_CITY_HOUSE2 (4 | (10 << 8)) -#define MAP_MAUVILLE_CITY_POKEMON_CENTER_1F (5 | (10 << 8)) -#define MAP_MAUVILLE_CITY_POKEMON_CENTER_2F (6 | (10 << 8)) -#define MAP_MAUVILLE_CITY_MART (7 | (10 << 8)) - -// gMapGroup_IndoorRustboro -#define MAP_RUSTBORO_CITY_DEVON_CORP_1F (0 | (11 << 8)) -#define MAP_RUSTBORO_CITY_DEVON_CORP_2F (1 | (11 << 8)) -#define MAP_RUSTBORO_CITY_DEVON_CORP_3F (2 | (11 << 8)) -#define MAP_RUSTBORO_CITY_GYM (3 | (11 << 8)) -#define MAP_RUSTBORO_CITY_POKEMON_SCHOOL (4 | (11 << 8)) -#define MAP_RUSTBORO_CITY_POKEMON_CENTER_1F (5 | (11 << 8)) -#define MAP_RUSTBORO_CITY_POKEMON_CENTER_2F (6 | (11 << 8)) -#define MAP_RUSTBORO_CITY_MART (7 | (11 << 8)) -#define MAP_RUSTBORO_CITY_FLAT1_1F (8 | (11 << 8)) -#define MAP_RUSTBORO_CITY_FLAT1_2F (9 | (11 << 8)) -#define MAP_RUSTBORO_CITY_HOUSE1 (10 | (11 << 8)) -#define MAP_RUSTBORO_CITY_CUTTERS_HOUSE (11 | (11 << 8)) -#define MAP_RUSTBORO_CITY_HOUSE2 (12 | (11 << 8)) -#define MAP_RUSTBORO_CITY_FLAT2_1F (13 | (11 << 8)) -#define MAP_RUSTBORO_CITY_FLAT2_2F (14 | (11 << 8)) -#define MAP_RUSTBORO_CITY_FLAT2_3F (15 | (11 << 8)) -#define MAP_RUSTBORO_CITY_HOUSE3 (16 | (11 << 8)) - -// gMapGroup_IndoorFortree -#define MAP_FORTREE_CITY_HOUSE1 (0 | (12 << 8)) -#define MAP_FORTREE_CITY_GYM (1 | (12 << 8)) -#define MAP_FORTREE_CITY_POKEMON_CENTER_1F (2 | (12 << 8)) -#define MAP_FORTREE_CITY_POKEMON_CENTER_2F (3 | (12 << 8)) -#define MAP_FORTREE_CITY_MART (4 | (12 << 8)) -#define MAP_FORTREE_CITY_HOUSE2 (5 | (12 << 8)) -#define MAP_FORTREE_CITY_HOUSE3 (6 | (12 << 8)) -#define MAP_FORTREE_CITY_HOUSE4 (7 | (12 << 8)) -#define MAP_FORTREE_CITY_HOUSE5 (8 | (12 << 8)) -#define MAP_FORTREE_CITY_DECORATION_SHOP (9 | (12 << 8)) - -// gMapGroup_IndoorLilycove -#define MAP_LILYCOVE_CITY_COVE_LILY_MOTEL_1F (0 | (13 << 8)) -#define MAP_LILYCOVE_CITY_COVE_LILY_MOTEL_2F (1 | (13 << 8)) -#define MAP_LILYCOVE_CITY_LILYCOVE_MUSEUM_1F (2 | (13 << 8)) -#define MAP_LILYCOVE_CITY_LILYCOVE_MUSEUM_2F (3 | (13 << 8)) -#define MAP_LILYCOVE_CITY_CONTEST_LOBBY (4 | (13 << 8)) -#define MAP_LILYCOVE_CITY_CONTEST_HALL (5 | (13 << 8)) -#define MAP_LILYCOVE_CITY_POKEMON_CENTER_1F (6 | (13 << 8)) -#define MAP_LILYCOVE_CITY_POKEMON_CENTER_2F (7 | (13 << 8)) -#define MAP_LILYCOVE_CITY_UNUSED_MART (8 | (13 << 8)) -#define MAP_LILYCOVE_CITY_POKEMON_TRAINER_FAN_CLUB (9 | (13 << 8)) -#define MAP_LILYCOVE_CITY_HARBOR (10 | (13 << 8)) -#define MAP_LILYCOVE_CITY_MOVE_DELETERS_HOUSE (11 | (13 << 8)) -#define MAP_LILYCOVE_CITY_HOUSE1 (12 | (13 << 8)) -#define MAP_LILYCOVE_CITY_HOUSE2 (13 | (13 << 8)) -#define MAP_LILYCOVE_CITY_HOUSE3 (14 | (13 << 8)) -#define MAP_LILYCOVE_CITY_HOUSE4 (15 | (13 << 8)) -#define MAP_LILYCOVE_CITY_DEPARTMENT_STORE_1F (16 | (13 << 8)) -#define MAP_LILYCOVE_CITY_DEPARTMENT_STORE_2F (17 | (13 << 8)) -#define MAP_LILYCOVE_CITY_DEPARTMENT_STORE_3F (18 | (13 << 8)) -#define MAP_LILYCOVE_CITY_DEPARTMENT_STORE_4F (19 | (13 << 8)) -#define MAP_LILYCOVE_CITY_DEPARTMENT_STORE_5F (20 | (13 << 8)) -#define MAP_LILYCOVE_CITY_DEPARTMENT_STORE_ROOFTOP (21 | (13 << 8)) -#define MAP_LILYCOVE_CITY_DEPARTMENT_STORE_ELEVATOR (22 | (13 << 8)) - -// gMapGroup_IndoorMossdeep -#define MAP_MOSSDEEP_CITY_GYM (0 | (14 << 8)) -#define MAP_MOSSDEEP_CITY_HOUSE1 (1 | (14 << 8)) -#define MAP_MOSSDEEP_CITY_HOUSE2 (2 | (14 << 8)) -#define MAP_MOSSDEEP_CITY_POKEMON_CENTER_1F (3 | (14 << 8)) -#define MAP_MOSSDEEP_CITY_POKEMON_CENTER_2F (4 | (14 << 8)) -#define MAP_MOSSDEEP_CITY_MART (5 | (14 << 8)) -#define MAP_MOSSDEEP_CITY_HOUSE3 (6 | (14 << 8)) -#define MAP_MOSSDEEP_CITY_STEVENS_HOUSE (7 | (14 << 8)) -#define MAP_MOSSDEEP_CITY_HOUSE4 (8 | (14 << 8)) -#define MAP_MOSSDEEP_CITY_SPACE_CENTER_1F (9 | (14 << 8)) -#define MAP_MOSSDEEP_CITY_SPACE_CENTER_2F (10 | (14 << 8)) -#define MAP_MOSSDEEP_CITY_GAME_CORNER_1F (11 | (14 << 8)) -#define MAP_MOSSDEEP_CITY_GAME_CORNER_B1F (12 | (14 << 8)) - -// gMapGroup_IndoorSootopolis -#define MAP_SOOTOPOLIS_CITY_GYM_1F (0 | (15 << 8)) -#define MAP_SOOTOPOLIS_CITY_GYM_B1F (1 | (15 << 8)) -#define MAP_SOOTOPOLIS_CITY_POKEMON_CENTER_1F (2 | (15 << 8)) -#define MAP_SOOTOPOLIS_CITY_POKEMON_CENTER_2F (3 | (15 << 8)) -#define MAP_SOOTOPOLIS_CITY_MART (4 | (15 << 8)) -#define MAP_SOOTOPOLIS_CITY_HOUSE1 (5 | (15 << 8)) -#define MAP_SOOTOPOLIS_CITY_HOUSE2 (6 | (15 << 8)) -#define MAP_SOOTOPOLIS_CITY_HOUSE3 (7 | (15 << 8)) -#define MAP_SOOTOPOLIS_CITY_HOUSE4 (8 | (15 << 8)) -#define MAP_SOOTOPOLIS_CITY_HOUSE5 (9 | (15 << 8)) -#define MAP_SOOTOPOLIS_CITY_HOUSE6 (10 | (15 << 8)) -#define MAP_SOOTOPOLIS_CITY_HOUSE7 (11 | (15 << 8)) -#define MAP_SOOTOPOLIS_CITY_LOTAD_AND_SEEDOT_HOUSE (12 | (15 << 8)) -#define MAP_SOOTOPOLIS_CITY_MYSTERY_EVENTS_HOUSE_1F (13 | (15 << 8)) -#define MAP_SOOTOPOLIS_CITY_MYSTERY_EVENTS_HOUSE_B1F (14 | (15 << 8)) - -// gMapGroup_IndoorEverGrande -#define MAP_EVER_GRANDE_CITY_SIDNEYS_ROOM (0 | (16 << 8)) -#define MAP_EVER_GRANDE_CITY_PHOEBES_ROOM (1 | (16 << 8)) -#define MAP_EVER_GRANDE_CITY_GLACIAS_ROOM (2 | (16 << 8)) -#define MAP_EVER_GRANDE_CITY_DRAKES_ROOM (3 | (16 << 8)) -#define MAP_EVER_GRANDE_CITY_CHAMPIONS_ROOM (4 | (16 << 8)) -#define MAP_EVER_GRANDE_CITY_HALL1 (5 | (16 << 8)) -#define MAP_EVER_GRANDE_CITY_HALL2 (6 | (16 << 8)) -#define MAP_EVER_GRANDE_CITY_HALL3 (7 | (16 << 8)) -#define MAP_EVER_GRANDE_CITY_HALL4 (8 | (16 << 8)) -#define MAP_EVER_GRANDE_CITY_HALL5 (9 | (16 << 8)) -#define MAP_EVER_GRANDE_CITY_POKEMON_LEAGUE_1F (10 | (16 << 8)) -#define MAP_EVER_GRANDE_CITY_HALL_OF_FAME (11 | (16 << 8)) -#define MAP_EVER_GRANDE_CITY_POKEMON_CENTER_1F (12 | (16 << 8)) -#define MAP_EVER_GRANDE_CITY_POKEMON_CENTER_2F (13 | (16 << 8)) -#define MAP_EVER_GRANDE_CITY_POKEMON_LEAGUE_2F (14 | (16 << 8)) - -// gMapGroup_IndoorRoute104 -#define MAP_ROUTE104_MR_BRINEYS_HOUSE (0 | (17 << 8)) -#define MAP_ROUTE104_PRETTY_PETAL_FLOWER_SHOP (1 | (17 << 8)) - -// gMapGroup_IndoorRoute111 -#define MAP_ROUTE111_WINSTRATE_FAMILYS_HOUSE (0 | (18 << 8)) -#define MAP_ROUTE111_OLD_LADYS_REST_STOP (1 | (18 << 8)) - -// gMapGroup_IndoorRoute112 -#define MAP_ROUTE112_CABLE_CAR_STATION (0 | (19 << 8)) -#define MAP_MT_CHIMNEY_CABLE_CAR_STATION (1 | (19 << 8)) - -// gMapGroup_IndoorRoute114 -#define MAP_ROUTE114_FOSSIL_MANIACS_HOUSE (0 | (20 << 8)) -#define MAP_ROUTE114_FOSSIL_MANIACS_TUNNEL (1 | (20 << 8)) -#define MAP_ROUTE114_LANETTES_HOUSE (2 | (20 << 8)) - -// gMapGroup_IndoorRoute116 -#define MAP_ROUTE116_TUNNELERS_REST_HOUSE (0 | (21 << 8)) - -// gMapGroup_IndoorRoute117 -#define MAP_ROUTE117_POKEMON_DAY_CARE (0 | (22 << 8)) - -// gMapGroup_IndoorRoute121 -#define MAP_ROUTE121_SAFARI_ZONE_ENTRANCE (0 | (23 << 8)) - -// gMapGroup_Dungeons -#define MAP_METEOR_FALLS_1F_1R (0 | (24 << 8)) -#define MAP_METEOR_FALLS_1F_2R (1 | (24 << 8)) -#define MAP_METEOR_FALLS_B1F_1R (2 | (24 << 8)) -#define MAP_METEOR_FALLS_B1F_2R (3 | (24 << 8)) -#define MAP_RUSTURF_TUNNEL (4 | (24 << 8)) -#define MAP_UNDERWATER_SOOTOPOLIS_CITY (5 | (24 << 8)) -#define MAP_DESERT_RUINS (6 | (24 << 8)) -#define MAP_GRANITE_CAVE_1F (7 | (24 << 8)) -#define MAP_GRANITE_CAVE_B1F (8 | (24 << 8)) -#define MAP_GRANITE_CAVE_B2F (9 | (24 << 8)) -#define MAP_GRANITE_CAVE_STEVENS_ROOM (10 | (24 << 8)) -#define MAP_PETALBURG_WOODS (11 | (24 << 8)) -#define MAP_MT_CHIMNEY (12 | (24 << 8)) -#define MAP_JAGGED_PASS (13 | (24 << 8)) -#define MAP_FIERY_PATH (14 | (24 << 8)) -#define MAP_MT_PYRE_1F (15 | (24 << 8)) -#define MAP_MT_PYRE_2F (16 | (24 << 8)) -#define MAP_MT_PYRE_3F (17 | (24 << 8)) -#define MAP_MT_PYRE_4F (18 | (24 << 8)) -#define MAP_MT_PYRE_5F (19 | (24 << 8)) -#define MAP_MT_PYRE_6F (20 | (24 << 8)) -#define MAP_MT_PYRE_EXTERIOR (21 | (24 << 8)) -#define MAP_MT_PYRE_SUMMIT (22 | (24 << 8)) -#define MAP_AQUA_HIDEOUT_1F (23 | (24 << 8)) -#define MAP_AQUA_HIDEOUT_B1F (24 | (24 << 8)) -#define MAP_AQUA_HIDEOUT_B2F (25 | (24 << 8)) -#define MAP_UNDERWATER_SEAFLOOR_CAVERN (26 | (24 << 8)) -#define MAP_SEAFLOOR_CAVERN_ENTRANCE (27 | (24 << 8)) -#define MAP_SEAFLOOR_CAVERN_ROOM1 (28 | (24 << 8)) -#define MAP_SEAFLOOR_CAVERN_ROOM2 (29 | (24 << 8)) -#define MAP_SEAFLOOR_CAVERN_ROOM3 (30 | (24 << 8)) -#define MAP_SEAFLOOR_CAVERN_ROOM4 (31 | (24 << 8)) -#define MAP_SEAFLOOR_CAVERN_ROOM5 (32 | (24 << 8)) -#define MAP_SEAFLOOR_CAVERN_ROOM6 (33 | (24 << 8)) -#define MAP_SEAFLOOR_CAVERN_ROOM7 (34 | (24 << 8)) -#define MAP_SEAFLOOR_CAVERN_ROOM8 (35 | (24 << 8)) -#define MAP_SEAFLOOR_CAVERN_ROOM9 (36 | (24 << 8)) -#define MAP_CAVE_OF_ORIGIN_ENTRANCE (37 | (24 << 8)) -#define MAP_CAVE_OF_ORIGIN_1F (38 | (24 << 8)) -#define MAP_CAVE_OF_ORIGIN_UNUSED_RUBY_SAPPHIRE_MAP1 (39 | (24 << 8)) -#define MAP_CAVE_OF_ORIGIN_UNUSED_RUBY_SAPPHIRE_MAP2 (40 | (24 << 8)) -#define MAP_CAVE_OF_ORIGIN_UNUSED_RUBY_SAPPHIRE_MAP3 (41 | (24 << 8)) -#define MAP_CAVE_OF_ORIGIN_B1F (42 | (24 << 8)) -#define MAP_VICTORY_ROAD_1F (43 | (24 << 8)) -#define MAP_VICTORY_ROAD_B1F (44 | (24 << 8)) -#define MAP_VICTORY_ROAD_B2F (45 | (24 << 8)) -#define MAP_SHOAL_CAVE_LOW_TIDE_ENTRANCE_ROOM (46 | (24 << 8)) -#define MAP_SHOAL_CAVE_LOW_TIDE_INNER_ROOM (47 | (24 << 8)) -#define MAP_SHOAL_CAVE_LOW_TIDE_STAIRS_ROOM (48 | (24 << 8)) -#define MAP_SHOAL_CAVE_LOW_TIDE_LOWER_ROOM (49 | (24 << 8)) -#define MAP_SHOAL_CAVE_HIGH_TIDE_ENTRANCE_ROOM (50 | (24 << 8)) -#define MAP_SHOAL_CAVE_HIGH_TIDE_INNER_ROOM (51 | (24 << 8)) -#define MAP_NEW_MAUVILLE_ENTRANCE (52 | (24 << 8)) -#define MAP_NEW_MAUVILLE_INSIDE (53 | (24 << 8)) -#define MAP_ABANDONED_SHIP_DECK (54 | (24 << 8)) -#define MAP_ABANDONED_SHIP_CORRIDORS_1F (55 | (24 << 8)) -#define MAP_ABANDONED_SHIP_ROOMS_1F (56 | (24 << 8)) -#define MAP_ABANDONED_SHIP_CORRIDORS_B1F (57 | (24 << 8)) -#define MAP_ABANDONED_SHIP_ROOMS_B1F (58 | (24 << 8)) -#define MAP_ABANDONED_SHIP_ROOMS2_B1F (59 | (24 << 8)) -#define MAP_ABANDONED_SHIP_UNDERWATER1 (60 | (24 << 8)) -#define MAP_ABANDONED_SHIP_ROOM_B1F (61 | (24 << 8)) -#define MAP_ABANDONED_SHIP_ROOMS2_1F (62 | (24 << 8)) -#define MAP_ABANDONED_SHIP_CAPTAINS_OFFICE (63 | (24 << 8)) -#define MAP_ABANDONED_SHIP_UNDERWATER2 (64 | (24 << 8)) -#define MAP_ABANDONED_SHIP_HIDDEN_FLOOR_CORRIDORS (65 | (24 << 8)) -#define MAP_ABANDONED_SHIP_HIDDEN_FLOOR_ROOMS (66 | (24 << 8)) -#define MAP_ISLAND_CAVE (67 | (24 << 8)) -#define MAP_ANCIENT_TOMB (68 | (24 << 8)) -#define MAP_UNDERWATER_ROUTE134 (69 | (24 << 8)) -#define MAP_UNDERWATER_SEALED_CHAMBER (70 | (24 << 8)) -#define MAP_SEALED_CHAMBER_OUTER_ROOM (71 | (24 << 8)) -#define MAP_SEALED_CHAMBER_INNER_ROOM (72 | (24 << 8)) -#define MAP_SCORCHED_SLAB (73 | (24 << 8)) -#define MAP_AQUA_HIDEOUT_UNUSED_RUBY_MAP1 (74 | (24 << 8)) -#define MAP_AQUA_HIDEOUT_UNUSED_RUBY_MAP2 (75 | (24 << 8)) -#define MAP_AQUA_HIDEOUT_UNUSED_RUBY_MAP3 (76 | (24 << 8)) -#define MAP_SKY_PILLAR_ENTRANCE (77 | (24 << 8)) -#define MAP_SKY_PILLAR_OUTSIDE (78 | (24 << 8)) -#define MAP_SKY_PILLAR_1F (79 | (24 << 8)) -#define MAP_SKY_PILLAR_2F (80 | (24 << 8)) -#define MAP_SKY_PILLAR_3F (81 | (24 << 8)) -#define MAP_SKY_PILLAR_4F (82 | (24 << 8)) -#define MAP_SHOAL_CAVE_LOW_TIDE_ICE_ROOM (83 | (24 << 8)) -#define MAP_SKY_PILLAR_5F (84 | (24 << 8)) -#define MAP_SKY_PILLAR_TOP (85 | (24 << 8)) -#define MAP_MAGMA_HIDEOUT_1F (86 | (24 << 8)) -#define MAP_MAGMA_HIDEOUT_2F_1R (87 | (24 << 8)) -#define MAP_MAGMA_HIDEOUT_2F_2R (88 | (24 << 8)) -#define MAP_MAGMA_HIDEOUT_3F_1R (89 | (24 << 8)) -#define MAP_MAGMA_HIDEOUT_3F_2R (90 | (24 << 8)) -#define MAP_MAGMA_HIDEOUT_4F (91 | (24 << 8)) -#define MAP_MAGMA_HIDEOUT_3F_3R (92 | (24 << 8)) -#define MAP_MAGMA_HIDEOUT_2F_3R (93 | (24 << 8)) -#define MAP_MIRAGE_TOWER_1F (94 | (24 << 8)) -#define MAP_MIRAGE_TOWER_2F (95 | (24 << 8)) -#define MAP_MIRAGE_TOWER_3F (96 | (24 << 8)) -#define MAP_MIRAGE_TOWER_4F (97 | (24 << 8)) -#define MAP_DESERT_UNDERPASS (98 | (24 << 8)) -#define MAP_ARTISAN_CAVE_B1F (99 | (24 << 8)) -#define MAP_ARTISAN_CAVE_1F (100 | (24 << 8)) -#define MAP_UNDERWATER_MARINE_CAVE (101 | (24 << 8)) -#define MAP_MARINE_CAVE_ENTRANCE (102 | (24 << 8)) -#define MAP_MARINE_CAVE_END (103 | (24 << 8)) -#define MAP_TERRA_CAVE_ENTRANCE (104 | (24 << 8)) -#define MAP_TERRA_CAVE_END (105 | (24 << 8)) -#define MAP_ALTERING_CAVE (106 | (24 << 8)) -#define MAP_METEOR_FALLS_STEVENS_CAVE (107 | (24 << 8)) - -// gMapGroup_IndoorDynamic -#define MAP_SECRET_BASE_RED_CAVE1 (0 | (25 << 8)) -#define MAP_SECRET_BASE_BROWN_CAVE1 (1 | (25 << 8)) -#define MAP_SECRET_BASE_BLUE_CAVE1 (2 | (25 << 8)) -#define MAP_SECRET_BASE_YELLOW_CAVE1 (3 | (25 << 8)) -#define MAP_SECRET_BASE_TREE1 (4 | (25 << 8)) -#define MAP_SECRET_BASE_SHRUB1 (5 | (25 << 8)) -#define MAP_SECRET_BASE_RED_CAVE2 (6 | (25 << 8)) -#define MAP_SECRET_BASE_BROWN_CAVE2 (7 | (25 << 8)) -#define MAP_SECRET_BASE_BLUE_CAVE2 (8 | (25 << 8)) -#define MAP_SECRET_BASE_YELLOW_CAVE2 (9 | (25 << 8)) -#define MAP_SECRET_BASE_TREE2 (10 | (25 << 8)) -#define MAP_SECRET_BASE_SHRUB2 (11 | (25 << 8)) -#define MAP_SECRET_BASE_RED_CAVE3 (12 | (25 << 8)) -#define MAP_SECRET_BASE_BROWN_CAVE3 (13 | (25 << 8)) -#define MAP_SECRET_BASE_BLUE_CAVE3 (14 | (25 << 8)) -#define MAP_SECRET_BASE_YELLOW_CAVE3 (15 | (25 << 8)) -#define MAP_SECRET_BASE_TREE3 (16 | (25 << 8)) -#define MAP_SECRET_BASE_SHRUB3 (17 | (25 << 8)) -#define MAP_SECRET_BASE_RED_CAVE4 (18 | (25 << 8)) -#define MAP_SECRET_BASE_BROWN_CAVE4 (19 | (25 << 8)) -#define MAP_SECRET_BASE_BLUE_CAVE4 (20 | (25 << 8)) -#define MAP_SECRET_BASE_YELLOW_CAVE4 (21 | (25 << 8)) -#define MAP_SECRET_BASE_TREE4 (22 | (25 << 8)) -#define MAP_SECRET_BASE_SHRUB4 (23 | (25 << 8)) -#define MAP_BATTLE_COLOSSEUM_2P (24 | (25 << 8)) -#define MAP_TRADE_CENTER (25 | (25 << 8)) -#define MAP_RECORD_CORNER (26 | (25 << 8)) -#define MAP_BATTLE_COLOSSEUM_4P (27 | (25 << 8)) -#define MAP_CONTEST_HALL (28 | (25 << 8)) -#define MAP_UNUSED_CONTEST_HALL1 (29 | (25 << 8)) -#define MAP_UNUSED_CONTEST_HALL2 (30 | (25 << 8)) -#define MAP_UNUSED_CONTEST_HALL3 (31 | (25 << 8)) -#define MAP_UNUSED_CONTEST_HALL4 (32 | (25 << 8)) -#define MAP_UNUSED_CONTEST_HALL5 (33 | (25 << 8)) -#define MAP_UNUSED_CONTEST_HALL6 (34 | (25 << 8)) -#define MAP_CONTEST_HALL_BEAUTY (35 | (25 << 8)) -#define MAP_CONTEST_HALL_TOUGH (36 | (25 << 8)) -#define MAP_CONTEST_HALL_COOL (37 | (25 << 8)) -#define MAP_CONTEST_HALL_SMART (38 | (25 << 8)) -#define MAP_CONTEST_HALL_CUTE (39 | (25 << 8)) -#define MAP_INSIDE_OF_TRUCK (40 | (25 << 8)) -#define MAP_SS_TIDAL_CORRIDOR (41 | (25 << 8)) -#define MAP_SS_TIDAL_LOWER_DECK (42 | (25 << 8)) -#define MAP_SS_TIDAL_ROOMS (43 | (25 << 8)) -#define MAP_BATTLE_PYRAMID_SQUARE01 (44 | (25 << 8)) -#define MAP_BATTLE_PYRAMID_SQUARE02 (45 | (25 << 8)) -#define MAP_BATTLE_PYRAMID_SQUARE03 (46 | (25 << 8)) -#define MAP_BATTLE_PYRAMID_SQUARE04 (47 | (25 << 8)) -#define MAP_BATTLE_PYRAMID_SQUARE05 (48 | (25 << 8)) -#define MAP_BATTLE_PYRAMID_SQUARE06 (49 | (25 << 8)) -#define MAP_BATTLE_PYRAMID_SQUARE07 (50 | (25 << 8)) -#define MAP_BATTLE_PYRAMID_SQUARE08 (51 | (25 << 8)) -#define MAP_BATTLE_PYRAMID_SQUARE09 (52 | (25 << 8)) -#define MAP_BATTLE_PYRAMID_SQUARE10 (53 | (25 << 8)) -#define MAP_BATTLE_PYRAMID_SQUARE11 (54 | (25 << 8)) -#define MAP_BATTLE_PYRAMID_SQUARE12 (55 | (25 << 8)) -#define MAP_BATTLE_PYRAMID_SQUARE13 (56 | (25 << 8)) -#define MAP_BATTLE_PYRAMID_SQUARE14 (57 | (25 << 8)) -#define MAP_BATTLE_PYRAMID_SQUARE15 (58 | (25 << 8)) -#define MAP_BATTLE_PYRAMID_SQUARE16 (59 | (25 << 8)) -#define MAP_UNION_ROOM (60 | (25 << 8)) - -// gMapGroup_SpecialArea -#define MAP_SAFARI_ZONE_NORTHWEST (0 | (26 << 8)) -#define MAP_SAFARI_ZONE_NORTH (1 | (26 << 8)) -#define MAP_SAFARI_ZONE_SOUTHWEST (2 | (26 << 8)) -#define MAP_SAFARI_ZONE_SOUTH (3 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_OUTSIDE_WEST (4 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_BATTLE_TOWER_LOBBY (5 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_BATTLE_TOWER_ELEVATOR (6 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_BATTLE_TOWER_CORRIDOR (7 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_BATTLE_TOWER_BATTLE_ROOM (8 | (26 << 8)) -#define MAP_SOUTHERN_ISLAND_EXTERIOR (9 | (26 << 8)) -#define MAP_SOUTHERN_ISLAND_INTERIOR (10 | (26 << 8)) -#define MAP_SAFARI_ZONE_REST_HOUSE (11 | (26 << 8)) -#define MAP_SAFARI_ZONE_NORTHEAST (12 | (26 << 8)) -#define MAP_SAFARI_ZONE_SOUTHEAST (13 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_OUTSIDE_EAST (14 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_BATTLE_TOWER_MULTI_PARTNER_ROOM (15 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_BATTLE_TOWER_MULTI_CORRIDOR (16 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_BATTLE_TOWER_MULTI_BATTLE_ROOM (17 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_BATTLE_DOME_LOBBY (18 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_BATTLE_DOME_CORRIDOR (19 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_BATTLE_DOME_PRE_BATTLE_ROOM (20 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_BATTLE_DOME_BATTLE_ROOM (21 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_BATTLE_PALACE_LOBBY (22 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_BATTLE_PALACE_CORRIDOR (23 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_BATTLE_PALACE_BATTLE_ROOM (24 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_BATTLE_PYRAMID_LOBBY (25 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_BATTLE_PYRAMID_FLOOR (26 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_BATTLE_PYRAMID_TOP (27 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_BATTLE_ARENA_LOBBY (28 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_BATTLE_ARENA_CORRIDOR (29 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_BATTLE_ARENA_BATTLE_ROOM (30 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_BATTLE_FACTORY_LOBBY (31 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_BATTLE_FACTORY_PRE_BATTLE_ROOM (32 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_BATTLE_FACTORY_BATTLE_ROOM (33 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_BATTLE_PIKE_LOBBY (34 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_BATTLE_PIKE_CORRIDOR (35 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_BATTLE_PIKE_THREE_PATH_ROOM (36 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_BATTLE_PIKE_ROOM_NORMAL (37 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_BATTLE_PIKE_ROOM_FINAL (38 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_BATTLE_PIKE_ROOM_WILD_MONS (39 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_RANKING_HALL (40 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_LOUNGE1 (41 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_EXCHANGE_SERVICE_CORNER (42 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_LOUNGE2 (43 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_LOUNGE3 (44 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_LOUNGE4 (45 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_SCOTTS_HOUSE (46 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_LOUNGE5 (47 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_LOUNGE6 (48 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_LOUNGE7 (49 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_RECEPTION_GATE (50 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_LOUNGE8 (51 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_LOUNGE9 (52 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_POKEMON_CENTER_1F (53 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_POKEMON_CENTER_2F (54 | (26 << 8)) -#define MAP_BATTLE_FRONTIER_MART (55 | (26 << 8)) -#define MAP_FARAWAY_ISLAND_ENTRANCE (56 | (26 << 8)) -#define MAP_FARAWAY_ISLAND_INTERIOR (57 | (26 << 8)) -#define MAP_BIRTH_ISLAND_EXTERIOR (58 | (26 << 8)) -#define MAP_BIRTH_ISLAND_HARBOR (59 | (26 << 8)) -#define MAP_TRAINER_HILL_ENTRANCE (60 | (26 << 8)) -#define MAP_TRAINER_HILL_1F (61 | (26 << 8)) -#define MAP_TRAINER_HILL_2F (62 | (26 << 8)) -#define MAP_TRAINER_HILL_3F (63 | (26 << 8)) -#define MAP_TRAINER_HILL_4F (64 | (26 << 8)) -#define MAP_TRAINER_HILL_ROOF (65 | (26 << 8)) -#define MAP_NAVEL_ROCK_EXTERIOR (66 | (26 << 8)) -#define MAP_NAVEL_ROCK_HARBOR (67 | (26 << 8)) -#define MAP_NAVEL_ROCK_ENTRANCE (68 | (26 << 8)) -#define MAP_NAVEL_ROCK_B1F (69 | (26 << 8)) -#define MAP_NAVEL_ROCK_FORK (70 | (26 << 8)) -#define MAP_NAVEL_ROCK_UP1 (71 | (26 << 8)) -#define MAP_NAVEL_ROCK_UP2 (72 | (26 << 8)) -#define MAP_NAVEL_ROCK_UP3 (73 | (26 << 8)) -#define MAP_NAVEL_ROCK_UP4 (74 | (26 << 8)) -#define MAP_NAVEL_ROCK_TOP (75 | (26 << 8)) -#define MAP_NAVEL_ROCK_DOWN01 (76 | (26 << 8)) -#define MAP_NAVEL_ROCK_DOWN02 (77 | (26 << 8)) -#define MAP_NAVEL_ROCK_DOWN03 (78 | (26 << 8)) -#define MAP_NAVEL_ROCK_DOWN04 (79 | (26 << 8)) -#define MAP_NAVEL_ROCK_DOWN05 (80 | (26 << 8)) -#define MAP_NAVEL_ROCK_DOWN06 (81 | (26 << 8)) -#define MAP_NAVEL_ROCK_DOWN07 (82 | (26 << 8)) -#define MAP_NAVEL_ROCK_DOWN08 (83 | (26 << 8)) -#define MAP_NAVEL_ROCK_DOWN09 (84 | (26 << 8)) -#define MAP_NAVEL_ROCK_DOWN10 (85 | (26 << 8)) -#define MAP_NAVEL_ROCK_DOWN11 (86 | (26 << 8)) -#define MAP_NAVEL_ROCK_BOTTOM (87 | (26 << 8)) -#define MAP_TRAINER_HILL_ELEVATOR (88 | (26 << 8)) - -// gMapGroup_IndoorRoute104Prototype -#define MAP_ROUTE104_PROTOTYPE (0 | (27 << 8)) -#define MAP_ROUTE104_PROTOTYPE_PRETTY_PETAL_FLOWER_SHOP (1 | (27 << 8)) - -// gMapGroup_IndoorRoute109 -#define MAP_ROUTE109_SEASHORE_HOUSE (0 | (28 << 8)) - -// gMapGroup_IndoorRoute110 -#define MAP_ROUTE110_TRICK_HOUSE_ENTRANCE (0 | (29 << 8)) -#define MAP_ROUTE110_TRICK_HOUSE_END (1 | (29 << 8)) -#define MAP_ROUTE110_TRICK_HOUSE_CORRIDOR (2 | (29 << 8)) -#define MAP_ROUTE110_TRICK_HOUSE_PUZZLE1 (3 | (29 << 8)) -#define MAP_ROUTE110_TRICK_HOUSE_PUZZLE2 (4 | (29 << 8)) -#define MAP_ROUTE110_TRICK_HOUSE_PUZZLE3 (5 | (29 << 8)) -#define MAP_ROUTE110_TRICK_HOUSE_PUZZLE4 (6 | (29 << 8)) -#define MAP_ROUTE110_TRICK_HOUSE_PUZZLE5 (7 | (29 << 8)) -#define MAP_ROUTE110_TRICK_HOUSE_PUZZLE6 (8 | (29 << 8)) -#define MAP_ROUTE110_TRICK_HOUSE_PUZZLE7 (9 | (29 << 8)) -#define MAP_ROUTE110_TRICK_HOUSE_PUZZLE8 (10 | (29 << 8)) -#define MAP_ROUTE110_SEASIDE_CYCLING_ROAD_NORTH_ENTRANCE (11 | (29 << 8)) -#define MAP_ROUTE110_SEASIDE_CYCLING_ROAD_SOUTH_ENTRANCE (12 | (29 << 8)) - -// gMapGroup_IndoorRoute113 -#define MAP_ROUTE113_GLASS_WORKSHOP (0 | (30 << 8)) - -// gMapGroup_IndoorRoute123 -#define MAP_ROUTE123_BERRY_MASTERS_HOUSE (0 | (31 << 8)) - -// gMapGroup_IndoorRoute119 -#define MAP_ROUTE119_WEATHER_INSTITUTE_1F (0 | (32 << 8)) -#define MAP_ROUTE119_WEATHER_INSTITUTE_2F (1 | (32 << 8)) -#define MAP_ROUTE119_HOUSE (2 | (32 << 8)) - -// gMapGroup_IndoorRoute124 -#define MAP_ROUTE124_DIVING_TREASURE_HUNTERS_HOUSE (0 | (33 << 8)) - -#define MAP_GROUPS_COUNT 34 - -#endif // GUARD_CONSTANTS_MAP_GROUPS_H diff --git a/make_tools.mk b/make_tools.mk index 7e0baf8900..7adf510319 100644 --- a/make_tools.mk +++ b/make_tools.mk @@ -1,12 +1,20 @@ +# This controls building executables in the `tools` folder. +# Can be invoked through the `Makefile` or standalone. MAKEFLAGS += --no-print-directory # Inclusive list. If you don't want a tool to be built, don't add it here. -TOOLDIRS := tools/aif2pcm tools/bin2c tools/gbafix tools/gbagfx tools/jsonproc tools/mapjson tools/mid2agb tools/preproc tools/ramscrgen tools/rsfont tools/scaninc +TOOLS_DIR := tools +TOOL_NAMES := aif2pcm bin2c gbafix gbagfx jsonproc mapjson mid2agb preproc ramscrgen rsfont scaninc -.PHONY: all $(TOOLDIRS) +TOOLDIRS := $(TOOL_NAMES:%=$(TOOLS_DIR)/%) -all: $(TOOLDIRS) +.PHONY: tools check-tools clean-tools $(TOOLDIRS) + +tools: $(TOOLDIRS) $(TOOLDIRS): @$(MAKE) -C $@ + +clean-tools: + @$(foreach tooldir,$(TOOLDIRS),$(MAKE) clean -C $(tooldir);) diff --git a/map_data_rules.mk b/map_data_rules.mk index d3f47a352e..ed7c08edea 100755 --- a/map_data_rules.mk +++ b/map_data_rules.mk @@ -1,8 +1,17 @@ # Map JSON data +# Inputs MAPS_DIR = $(DATA_ASM_SUBDIR)/maps LAYOUTS_DIR = $(DATA_ASM_SUBDIR)/layouts +# Outputs +MAPS_OUTDIR := $(MAPS_DIR) +LAYOUTS_OUTDIR := $(LAYOUTS_DIR) +INCLUDECONSTS_OUTDIR := include/constants + +AUTO_GEN_TARGETS += $(INCLUDECONSTS_OUTDIR)/map_groups.h +AUTO_GEN_TARGETS += $(INCLUDECONSTS_OUTDIR)/layouts.h + MAP_DIRS := $(dir $(wildcard $(MAPS_DIR)/*/map.json)) MAP_CONNECTIONS := $(patsubst $(MAPS_DIR)/%/,$(MAPS_DIR)/%/connections.inc,$(MAP_DIRS)) MAP_EVENTS := $(patsubst $(MAPS_DIR)/%/,$(MAPS_DIR)/%/events.inc,$(MAP_DIRS)) @@ -13,19 +22,12 @@ $(DATA_ASM_BUILDDIR)/maps.o: $(DATA_ASM_SUBDIR)/maps.s $(LAYOUTS_DIR)/layouts.in $(DATA_ASM_BUILDDIR)/map_events.o: $(DATA_ASM_SUBDIR)/map_events.s $(MAPS_DIR)/events.inc $(MAP_EVENTS) $(PREPROC) $< charmap.txt | $(CPP) -I include - | $(PREPROC) -ie $< charmap.txt | $(AS) $(ASFLAGS) -o $@ -$(MAPS_DIR)/%/header.inc: $(MAPS_DIR)/%/map.json - $(MAPJSON) map emerald $< $(LAYOUTS_DIR)/layouts.json -$(MAPS_DIR)/%/events.inc: $(MAPS_DIR)/%/header.inc ; -$(MAPS_DIR)/%/connections.inc: $(MAPS_DIR)/%/events.inc ; -$(MAPS_DIR)/groups.inc: $(MAPS_DIR)/map_groups.json - $(MAPJSON) groups emerald $< -$(MAPS_DIR)/connections.inc: $(MAPS_DIR)/groups.inc ; -$(MAPS_DIR)/events.inc: $(MAPS_DIR)/connections.inc ; -$(MAPS_DIR)/headers.inc: $(MAPS_DIR)/events.inc ; -include/constants/map_groups.h: $(MAPS_DIR)/headers.inc ; +$(MAPS_OUTDIR)/%/header.inc $(MAPS_OUTDIR)/%/events.inc $(MAPS_OUTDIR)/%/connections.inc: $(MAPS_DIR)/%/map.json + $(MAPJSON) map emerald $< $(LAYOUTS_DIR)/layouts.json $(@D) -$(LAYOUTS_DIR)/layouts.inc: $(LAYOUTS_DIR)/layouts.json - $(MAPJSON) layouts emerald $< -$(LAYOUTS_DIR)/layouts_table.inc: $(LAYOUTS_DIR)/layouts.inc ; -include/constants/layouts.h: $(LAYOUTS_DIR)/layouts_table.inc ; +$(MAPS_OUTDIR)/connections.inc $(MAPS_OUTDIR)/groups.inc $(MAPS_OUTDIR)/events.inc $(MAPS_OUTDIR)/headers.inc $(INCLUDECONSTS_OUTDIR)/map_groups.h: $(MAPS_DIR)/map_groups.json + $(MAPJSON) groups emerald $< $(MAPS_OUTDIR) $(INCLUDECONSTS_OUTDIR) + +$(LAYOUTS_OUTDIR)/layouts.inc $(LAYOUTS_OUTDIR)/layouts_table.inc $(INCLUDECONSTS_OUTDIR)/layouts.h: $(LAYOUTS_DIR)/layouts.json + $(MAPJSON) layouts emerald $< $(LAYOUTS_OUTDIR) $(INCLUDECONSTS_OUTDIR) diff --git a/tools/jsonproc/jsonproc.cpp b/tools/jsonproc/jsonproc.cpp index 9ef23cd43e..03e51b765a 100755 --- a/tools/jsonproc/jsonproc.cpp +++ b/tools/jsonproc/jsonproc.cpp @@ -1,4 +1,6 @@ // jsonproc.cpp +// jsonproc converts JSON data to an output file based on an Inja template. +// https://github.com/pantor/inja #include "jsonproc.h" diff --git a/tools/mapjson/mapjson.cpp b/tools/mapjson/mapjson.cpp index e53ac7924d..1a10c9dab8 100644 --- a/tools/mapjson/mapjson.cpp +++ b/tools/mapjson/mapjson.cpp @@ -30,6 +30,8 @@ using json11::Json; #include "mapjson.h" string version; +// System directory separator +string sep; string read_text_file(string filepath) { ifstream in_file(filepath); @@ -330,13 +332,22 @@ string generate_map_events_text(Json map_data) { return text.str(); } -string get_directory_name(string filename) { - size_t dir_pos = filename.find_last_of("/\\"); +string strip_trailing_separator(string filename) { + if(filename.back() == '/' || filename.back() == '\\') + filename.pop_back(); + return filename; +} +void infer_separator(string filename) { + size_t dir_pos = filename.find_last_of("/\\"); + sep = filename[dir_pos]; +} +string file_parent(string filename){ + size_t dir_pos = filename.find_last_of("/\\"); return filename.substr(0, dir_pos + 1); } -void process_map(string map_filepath, string layouts_filepath) { +void process_map(string map_filepath, string layouts_filepath, string output_dir) { string mapdata_err, layouts_err; string mapdata_json_text = read_text_file(map_filepath); @@ -354,10 +365,10 @@ void process_map(string map_filepath, string layouts_filepath) { string events_text = generate_map_events_text(map_data); string connections_text = generate_map_connections_text(map_data); - string files_dir = get_directory_name(map_filepath); - write_text_file(files_dir + "header.inc", header_text); - write_text_file(files_dir + "events.inc", events_text); - write_text_file(files_dir + "connections.inc", connections_text); + string out_dir = strip_trailing_separator(output_dir).append(sep); + write_text_file(out_dir + "header.inc", header_text); + write_text_file(out_dir + "events.inc", events_text); + write_text_file(out_dir + "connections.inc", connections_text); } string generate_groups_text(Json groups_data) { @@ -382,7 +393,7 @@ string generate_groups_text(Json groups_data) { return text.str(); } -string generate_connections_text(Json groups_data) { +string generate_connections_text(Json groups_data, string include_path) { vector map_names; for (auto &group : groups_data["group_order"].array_items()) @@ -407,12 +418,12 @@ string generate_connections_text(Json groups_data) { text << "@\n@ DO NOT MODIFY THIS FILE! It is auto-generated from data/maps/map_groups.json\n@\n\n"; for (Json map_name : map_names) - text << "\t.include \"data/maps/" << json_to_string(map_name) << "/connections.inc\"\n"; + text << "\t.include \"" << include_path << "/" << json_to_string(map_name) << "/connections.inc\"\n"; return text.str(); } -string generate_headers_text(Json groups_data) { +string generate_headers_text(Json groups_data, string include_path) { vector map_names; for (auto &group : groups_data["group_order"].array_items()) @@ -424,12 +435,12 @@ string generate_headers_text(Json groups_data) { text << "@\n@ DO NOT MODIFY THIS FILE! It is auto-generated from data/maps/map_groups.json\n@\n\n"; for (string map_name : map_names) - text << "\t.include \"data/maps/" << map_name << "/header.inc\"\n"; + text << "\t.include \"" << include_path << "/" << map_name << "/header.inc\"\n"; return text.str(); } -string generate_events_text(Json groups_data) { +string generate_events_text(Json groups_data, string include_path) { vector map_names; for (auto &group : groups_data["group_order"].array_items()) @@ -438,17 +449,16 @@ string generate_events_text(Json groups_data) { ostringstream text; - text << "@\n@ DO NOT MODIFY THIS FILE! It is auto-generated from data/maps/map_groups.json\n@\n\n"; + text << "@\n@ DO NOT MODIFY THIS FILE! It is auto-generated from " << include_path << "/map_groups.json\n@\n\n"; for (string map_name : map_names) - text << "\t.include \"data/maps/" << map_name << "/events.inc\"\n"; + text << "\t.include \"" << include_path << "/" << map_name << "/events.inc\"\n"; return text.str(); } string generate_map_constants_text(string groups_filepath, Json groups_data) { - string file_dir = get_directory_name(groups_filepath); - char dir_separator = file_dir.back(); + string file_dir = file_parent(groups_filepath) + sep; ostringstream text; @@ -466,7 +476,7 @@ string generate_map_constants_text(string groups_filepath, Json groups_data) { size_t max_length = 0; for (auto &map_name : groups_data[groupName].array_items()) { - string map_filepath = file_dir + json_to_string(map_name) + dir_separator + "map.json"; + string map_filepath = file_dir + json_to_string(map_name) + sep + "map.json"; string err_str; Json map_data = Json::parse(read_text_file(map_filepath), err_str); if (map_data == Json()) @@ -493,7 +503,11 @@ string generate_map_constants_text(string groups_filepath, Json groups_data) { return text.str(); } -void process_groups(string groups_filepath) { +// Output paths are directories with trailing path separators +void process_groups(string groups_filepath, string output_asm, string output_c) { + output_asm = strip_trailing_separator(output_asm); // Remove separator if existing. + output_c = strip_trailing_separator(output_c); + string err; Json groups_data = Json::parse(read_text_file(groups_filepath), err); @@ -501,19 +515,16 @@ void process_groups(string groups_filepath) { FATAL_ERROR("%s\n", err.c_str()); string groups_text = generate_groups_text(groups_data); - string connections_text = generate_connections_text(groups_data); - string headers_text = generate_headers_text(groups_data); - string events_text = generate_events_text(groups_data); + string connections_text = generate_connections_text(groups_data, output_asm); + string headers_text = generate_headers_text(groups_data, output_asm); + string events_text = generate_events_text(groups_data, output_asm); string map_header_text = generate_map_constants_text(groups_filepath, groups_data); - string file_dir = get_directory_name(groups_filepath); - char s = file_dir.back(); - - write_text_file(file_dir + "groups.inc", groups_text); - write_text_file(file_dir + "connections.inc", connections_text); - write_text_file(file_dir + "headers.inc", headers_text); - write_text_file(file_dir + "events.inc", events_text); - write_text_file(file_dir + ".." + s + ".." + s + "include" + s + "constants" + s + "map_groups.h", map_header_text); + write_text_file(output_asm + sep + "groups.inc", groups_text); + write_text_file(output_asm + sep + "connections.inc", connections_text); + write_text_file(output_asm + sep + "headers.inc", headers_text); + write_text_file(output_asm + sep + "events.inc", events_text); + write_text_file(output_c + sep + "map_groups.h", map_header_text); } string generate_layout_headers_text(Json layouts_data) { @@ -586,7 +597,10 @@ string generate_layouts_constants_text(Json layouts_data) { return text.str(); } -void process_layouts(string layouts_filepath) { +void process_layouts(string layouts_filepath, string output_asm, string output_c) { + output_asm = strip_trailing_separator(output_asm).append(sep); + output_c = strip_trailing_separator(output_c).append(sep); + string err; Json layouts_data = Json::parse(read_text_file(layouts_filepath), err); @@ -597,12 +611,9 @@ void process_layouts(string layouts_filepath) { string layouts_table_text = generate_layouts_table_text(layouts_data); string layouts_constants_text = generate_layouts_constants_text(layouts_data); - string file_dir = get_directory_name(layouts_filepath); - char s = file_dir.back(); - - write_text_file(file_dir + "layouts.inc", layout_headers_text); - write_text_file(file_dir + "layouts_table.inc", layouts_table_text); - write_text_file(file_dir + ".." + s + ".." + s + "include" + s + "constants" + s + "layouts.h", layouts_constants_text); + write_text_file(output_asm + "layouts.inc", layout_headers_text); + write_text_file(output_asm + "layouts_table.inc", layouts_table_text); + write_text_file(output_c + "layouts.h", layouts_constants_text); } int main(int argc, char *argv[]) { @@ -620,29 +631,40 @@ int main(int argc, char *argv[]) { FATAL_ERROR("ERROR: must be 'layouts', 'map', or 'groups'.\n"); if (mode == "map") { - if (argc != 5) - FATAL_ERROR("USAGE: mapjson map \n"); + if (argc != 6) + FATAL_ERROR("USAGE: mapjson map \n"); + infer_separator(argv[3]); string filepath(argv[3]); string layouts_filepath(argv[4]); + string output_dir(argv[5]); - process_map(filepath, layouts_filepath); + process_map(filepath, layouts_filepath, output_dir); } else if (mode == "groups") { - if (argc != 4) - FATAL_ERROR("USAGE: mapjson groups \n"); + if (argc != 6) + FATAL_ERROR("USAGE: mapjson groups \n"); + infer_separator(argv[3]); string filepath(argv[3]); + string output_asm(argv[4]); + string output_c(argv[5]); - process_groups(filepath); + process_groups(filepath, output_asm, output_c); } else if (mode == "layouts") { - if (argc != 4) - FATAL_ERROR("USAGE: mapjson layouts \n"); + if (argc != 6) + FATAL_ERROR("USAGE: mapjson layouts \n"); + infer_separator(argv[3]); string filepath(argv[3]); + string output_asm(argv[4]); + string output_c(argv[5]); - process_layouts(filepath); + process_layouts(filepath, output_asm, output_c); + } + else { + FATAL_ERROR("ERROR: must be 'layouts', 'map', or 'groups'.\n"); } return 0;