From 4439253f3970d6402ee087d91886401a003c7bb7 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Sun, 3 Sep 2023 20:57:54 -0400 Subject: [PATCH 1/5] Add include guards for assembly constants files --- constants/gba_constants.inc | 5 +++++ constants/global.inc | 5 +++++ constants/m4a_constants.inc | 5 +++++ constants/tms_hms.inc | 5 +++++ 4 files changed, 20 insertions(+) diff --git a/constants/gba_constants.inc b/constants/gba_constants.inc index 3ff857ee8..9f51b0f02 100644 --- a/constants/gba_constants.inc +++ b/constants/gba_constants.inc @@ -1,3 +1,6 @@ +#ifndef GUARD_CONSTANTS_GBA_CONSTANTS_INC +#define GUARD_CONSTANTS_GBA_CONSTANTS_INC + .set PSR_USR_MODE, 0x00000010 .set PSR_FIQ_MODE, 0x00000011 .set PSR_IRQ_MODE, 0x00000012 @@ -511,3 +514,5 @@ .set BLDCNT_TGT2_OBJ, 1 << 12 .set BLDCNT_TGT2_BD, 1 << 13 .set BLDCNT_TGT2_ALL, BLDCNT_TGT2_BG0 | BLDCNT_TGT2_BG1 | BLDCNT_TGT2_BG2 | BLDCNT_TGT2_BG3 | BLDCNT_TGT2_OBJ | BLDCNT_TGT2_BD + +#endif @ GUARD_CONSTANTS_GBA_CONSTANTS_INC diff --git a/constants/global.inc b/constants/global.inc index 621ba2af8..b9462fa26 100644 --- a/constants/global.inc +++ b/constants/global.inc @@ -1,3 +1,6 @@ +#ifndef GUARD_CONSTANTS_GLOBAL_INC +#define GUARD_CONSTANTS_GLOBAL_INC + .set TRUE, 1 .set FALSE, 0 @@ -20,3 +23,5 @@ .set OBJ_IMAGE_ANIM_H_FLIP, 1 << 6 .set OBJ_IMAGE_ANIM_V_FLIP, 1 << 7 + +#endif @ GUARD_CONSTANTS_GLOBAL_INC diff --git a/constants/m4a_constants.inc b/constants/m4a_constants.inc index 1a744dc7f..2599b6c4a 100644 --- a/constants/m4a_constants.inc +++ b/constants/m4a_constants.inc @@ -1,3 +1,6 @@ +#ifndef GUARD_CONSTANTS_M4A_CONSTANTS_INC +#define GUARD_CONSTANTS_M4A_CONSTANTS_INC + .equiv ID_NUMBER, 0x68736d53 .equiv PCM_DMA_BUF_SIZE, 1584 @@ -250,3 +253,5 @@ struct_field o_CgbChannel_nextChannelPointer, 4 struct_field o_CgbChannel_dummy4, 8 struct_field CgbChannel_size, 0 + +#endif @ GUARD_CONSTANTS_M4A_CONSTANTS_INC diff --git a/constants/tms_hms.inc b/constants/tms_hms.inc index 3450aa73b..4ce6d9032 100644 --- a/constants/tms_hms.inc +++ b/constants/tms_hms.inc @@ -1,3 +1,6 @@ +#ifndef GUARD_CONSTANTS_TMS_HMS_INC +#define GUARD_CONSTANTS_TMS_HMS_INC + #include "constants/tms_hms.h" /* Expands to: @@ -15,3 +18,5 @@ FOREACH_TM(EQUIV_TM) FOREACH_HM(EQUIV_HM) #undef EQUIV_TM #undef EQUIV_HM + +#endif @ GUARD_CONSTANTS_TMS_HMS_INC From d31b168522afe0151378b5fc9a0a433ed8315f5c Mon Sep 17 00:00:00 2001 From: citrusbolt Date: Tue, 5 Sep 2023 06:17:10 -0600 Subject: [PATCH 2/5] Add `blockBoxRS` field to `struct BoxPokemon` --- include/pokemon.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/pokemon.h b/include/pokemon.h index f4f6d6989..6d08f4874 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -202,7 +202,8 @@ struct BoxPokemon u8 isBadEgg:1; u8 hasSpecies:1; u8 isEgg:1; - u8 unused:5; + u8 blockBoxRS:1; // Unused, but Pokémon Box Ruby & Sapphire will refuse to deposit a Pokémon with this flag set + u8 unused:4; u8 otName[PLAYER_NAME_LENGTH]; u8 markings; u16 checksum; From b89722500f776781c30c8b18fbc81986d5089a68 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Tue, 12 Sep 2023 13:09:56 -0300 Subject: [PATCH 3/5] Fixed Mr. Mime capitalization --- include/graphics.h | 14 +++++++------- src/anim_mon_front_pics.c | 2 +- src/data/graphics/pokemon.h | 12 ++++++------ src/data/pokemon/level_up_learnset_pointers.h | 2 +- src/data/pokemon/level_up_learnsets.h | 2 +- src/data/pokemon/pokedex_entries.h | 2 +- src/data/pokemon/pokedex_text.h | 2 +- src/data/pokemon_graphics/back_pic_table.h | 2 +- src/data/pokemon_graphics/footprint_table.h | 2 +- src/data/pokemon_graphics/front_pic_table.h | 2 +- src/data/pokemon_graphics/palette_table.h | 2 +- src/data/pokemon_graphics/shiny_palette_table.h | 2 +- src/data/pokemon_graphics/still_front_pic_table.h | 2 +- src/pokemon_icon.c | 2 +- 14 files changed, 25 insertions(+), 25 deletions(-) diff --git a/include/graphics.h b/include/graphics.h index 9fab084f2..5b13ab562 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -881,13 +881,13 @@ extern const u32 gMonShinyPalette_Starmie[]; extern const u32 gMonStillFrontPic_Starmie[]; extern const u8 gMonIcon_Starmie[]; extern const u8 gMonFootprint_Starmie[]; -extern const u32 gMonFrontPic_Mrmime[]; -extern const u32 gMonPalette_Mrmime[]; -extern const u32 gMonBackPic_Mrmime[]; -extern const u32 gMonShinyPalette_Mrmime[]; -extern const u32 gMonStillFrontPic_Mrmime[]; -extern const u8 gMonIcon_Mrmime[]; -extern const u8 gMonFootprint_Mrmime[]; +extern const u32 gMonFrontPic_MrMime[]; +extern const u32 gMonPalette_MrMime[]; +extern const u32 gMonBackPic_MrMime[]; +extern const u32 gMonShinyPalette_MrMime[]; +extern const u32 gMonStillFrontPic_MrMime[]; +extern const u8 gMonIcon_MrMime[]; +extern const u8 gMonFootprint_MrMime[]; extern const u32 gMonFrontPic_Scyther[]; extern const u32 gMonPalette_Scyther[]; extern const u32 gMonBackPic_Scyther[]; diff --git a/src/anim_mon_front_pics.c b/src/anim_mon_front_pics.c index e36cf3492..de7014607 100644 --- a/src/anim_mon_front_pics.c +++ b/src/anim_mon_front_pics.c @@ -123,7 +123,7 @@ const u32 gMonFrontPic_Goldeen[] = INCBIN_U32("graphics/pokemon/goldeen/anim_fro const u32 gMonFrontPic_Seaking[] = INCBIN_U32("graphics/pokemon/seaking/anim_front.4bpp.lz"); const u32 gMonFrontPic_Staryu[] = INCBIN_U32("graphics/pokemon/staryu/anim_front.4bpp.lz"); const u32 gMonFrontPic_Starmie[] = INCBIN_U32("graphics/pokemon/starmie/anim_front.4bpp.lz"); -const u32 gMonFrontPic_Mrmime[] = INCBIN_U32("graphics/pokemon/mr_mime/anim_front.4bpp.lz"); +const u32 gMonFrontPic_MrMime[] = INCBIN_U32("graphics/pokemon/mr_mime/anim_front.4bpp.lz"); const u32 gMonFrontPic_Scyther[] = INCBIN_U32("graphics/pokemon/scyther/anim_front.4bpp.lz"); const u32 gMonFrontPic_Jynx[] = INCBIN_U32("graphics/pokemon/jynx/anim_front.4bpp.lz"); const u32 gMonFrontPic_Electabuzz[] = INCBIN_U32("graphics/pokemon/electabuzz/anim_front.4bpp.lz"); diff --git a/src/data/graphics/pokemon.h b/src/data/graphics/pokemon.h index f69fafec8..fdd9fd87c 100644 --- a/src/data/graphics/pokemon.h +++ b/src/data/graphics/pokemon.h @@ -845,12 +845,12 @@ const u32 gMonShinyPalette_Starmie[] = INCBIN_U32("graphics/pokemon/starmie/shin const u8 gMonIcon_Starmie[] = INCBIN_U8("graphics/pokemon/starmie/icon.4bpp"); const u8 gMonFootprint_Starmie[] = INCBIN_U8("graphics/pokemon/starmie/footprint.1bpp"); -const u32 gMonStillFrontPic_Mrmime[] = INCBIN_U32("graphics/pokemon/mr_mime/front.4bpp.lz"); -const u32 gMonPalette_Mrmime[] = INCBIN_U32("graphics/pokemon/mr_mime/normal.gbapal.lz"); -const u32 gMonBackPic_Mrmime[] = INCBIN_U32("graphics/pokemon/mr_mime/back.4bpp.lz"); -const u32 gMonShinyPalette_Mrmime[] = INCBIN_U32("graphics/pokemon/mr_mime/shiny.gbapal.lz"); -const u8 gMonIcon_Mrmime[] = INCBIN_U8("graphics/pokemon/mr_mime/icon.4bpp"); -const u8 gMonFootprint_Mrmime[] = INCBIN_U8("graphics/pokemon/mr_mime/footprint.1bpp"); +const u32 gMonStillFrontPic_MrMime[] = INCBIN_U32("graphics/pokemon/mr_mime/front.4bpp.lz"); +const u32 gMonPalette_MrMime[] = INCBIN_U32("graphics/pokemon/mr_mime/normal.gbapal.lz"); +const u32 gMonBackPic_MrMime[] = INCBIN_U32("graphics/pokemon/mr_mime/back.4bpp.lz"); +const u32 gMonShinyPalette_MrMime[] = INCBIN_U32("graphics/pokemon/mr_mime/shiny.gbapal.lz"); +const u8 gMonIcon_MrMime[] = INCBIN_U8("graphics/pokemon/mr_mime/icon.4bpp"); +const u8 gMonFootprint_MrMime[] = INCBIN_U8("graphics/pokemon/mr_mime/footprint.1bpp"); const u32 gMonStillFrontPic_Scyther[] = INCBIN_U32("graphics/pokemon/scyther/front.4bpp.lz"); const u32 gMonPalette_Scyther[] = INCBIN_U32("graphics/pokemon/scyther/normal.gbapal.lz"); diff --git a/src/data/pokemon/level_up_learnset_pointers.h b/src/data/pokemon/level_up_learnset_pointers.h index 5ac7b3bd7..661458ce3 100644 --- a/src/data/pokemon/level_up_learnset_pointers.h +++ b/src/data/pokemon/level_up_learnset_pointers.h @@ -122,7 +122,7 @@ const u16 *const gLevelUpLearnsets[NUM_SPECIES] = [SPECIES_SEAKING] = sSeakingLevelUpLearnset, [SPECIES_STARYU] = sStaryuLevelUpLearnset, [SPECIES_STARMIE] = sStarmieLevelUpLearnset, - [SPECIES_MR_MIME] = sMrmimeLevelUpLearnset, + [SPECIES_MR_MIME] = sMrMimeLevelUpLearnset, [SPECIES_SCYTHER] = sScytherLevelUpLearnset, [SPECIES_JYNX] = sJynxLevelUpLearnset, [SPECIES_ELECTABUZZ] = sElectabuzzLevelUpLearnset, diff --git a/src/data/pokemon/level_up_learnsets.h b/src/data/pokemon/level_up_learnsets.h index c78b9ef0a..212b969a7 100644 --- a/src/data/pokemon/level_up_learnsets.h +++ b/src/data/pokemon/level_up_learnsets.h @@ -1681,7 +1681,7 @@ static const u16 sStarmieLevelUpLearnset[] = { LEVEL_UP_END }; -static const u16 sMrmimeLevelUpLearnset[] = { +static const u16 sMrMimeLevelUpLearnset[] = { LEVEL_UP_MOVE( 1, MOVE_BARRIER), LEVEL_UP_MOVE( 5, MOVE_CONFUSION), LEVEL_UP_MOVE( 9, MOVE_SUBSTITUTE), diff --git a/src/data/pokemon/pokedex_entries.h b/src/data/pokemon/pokedex_entries.h index 007c73248..8a15a1856 100644 --- a/src/data/pokemon/pokedex_entries.h +++ b/src/data/pokemon/pokedex_entries.h @@ -1469,7 +1469,7 @@ const struct PokedexEntry gPokedexEntries[] = .categoryName = _("BARRIER"), .height = 13, .weight = 545, - .description = gMrmimePokedexText, + .description = gMrMimePokedexText, .pokemonScale = 258, .pokemonOffset = 6, .trainerScale = 256, diff --git a/src/data/pokemon/pokedex_text.h b/src/data/pokemon/pokedex_text.h index 0daf7fc86..ec4a831f8 100644 --- a/src/data/pokemon/pokedex_text.h +++ b/src/data/pokemon/pokedex_text.h @@ -730,7 +730,7 @@ const u8 gStarmiePokedexText[] = _( "reflections of stars that twinkled on\n" "gentle waves at night."); -const u8 gMrmimePokedexText[] = _( +const u8 gMrMimePokedexText[] = _( "A MR. MIME is a master of pantomime. It can\n" "convince others that something unseeable\n" "actually exists. Once believed, the\n" diff --git a/src/data/pokemon_graphics/back_pic_table.h b/src/data/pokemon_graphics/back_pic_table.h index 9a98927aa..1a51f9ccd 100644 --- a/src/data/pokemon_graphics/back_pic_table.h +++ b/src/data/pokemon_graphics/back_pic_table.h @@ -122,7 +122,7 @@ const struct CompressedSpriteSheet gMonBackPicTable[] = SPECIES_SPRITE(SEAKING, gMonBackPic_Seaking), SPECIES_SPRITE(STARYU, gMonBackPic_Staryu), SPECIES_SPRITE(STARMIE, gMonBackPic_Starmie), - SPECIES_SPRITE(MR_MIME, gMonBackPic_Mrmime), + SPECIES_SPRITE(MR_MIME, gMonBackPic_MrMime), SPECIES_SPRITE(SCYTHER, gMonBackPic_Scyther), SPECIES_SPRITE(JYNX, gMonBackPic_Jynx), SPECIES_SPRITE(ELECTABUZZ, gMonBackPic_Electabuzz), diff --git a/src/data/pokemon_graphics/footprint_table.h b/src/data/pokemon_graphics/footprint_table.h index 86ca06790..d63e33e5b 100644 --- a/src/data/pokemon_graphics/footprint_table.h +++ b/src/data/pokemon_graphics/footprint_table.h @@ -122,7 +122,7 @@ const u8 *const gMonFootprintTable[] = [SPECIES_SEAKING] = gMonFootprint_Seaking, [SPECIES_STARYU] = gMonFootprint_Staryu, [SPECIES_STARMIE] = gMonFootprint_Starmie, - [SPECIES_MR_MIME] = gMonFootprint_Mrmime, + [SPECIES_MR_MIME] = gMonFootprint_MrMime, [SPECIES_SCYTHER] = gMonFootprint_Scyther, [SPECIES_JYNX] = gMonFootprint_Jynx, [SPECIES_ELECTABUZZ] = gMonFootprint_Electabuzz, diff --git a/src/data/pokemon_graphics/front_pic_table.h b/src/data/pokemon_graphics/front_pic_table.h index 82af860d3..acb0bba25 100644 --- a/src/data/pokemon_graphics/front_pic_table.h +++ b/src/data/pokemon_graphics/front_pic_table.h @@ -122,7 +122,7 @@ const struct CompressedSpriteSheet gMonFrontPicTable[] = SPECIES_SPRITE(SEAKING, gMonFrontPic_Seaking), SPECIES_SPRITE(STARYU, gMonFrontPic_Staryu), SPECIES_SPRITE(STARMIE, gMonFrontPic_Starmie), - SPECIES_SPRITE(MR_MIME, gMonFrontPic_Mrmime), + SPECIES_SPRITE(MR_MIME, gMonFrontPic_MrMime), SPECIES_SPRITE(SCYTHER, gMonFrontPic_Scyther), SPECIES_SPRITE(JYNX, gMonFrontPic_Jynx), SPECIES_SPRITE(ELECTABUZZ, gMonFrontPic_Electabuzz), diff --git a/src/data/pokemon_graphics/palette_table.h b/src/data/pokemon_graphics/palette_table.h index 35edcc76c..8bdfd2dbd 100644 --- a/src/data/pokemon_graphics/palette_table.h +++ b/src/data/pokemon_graphics/palette_table.h @@ -122,7 +122,7 @@ const struct CompressedSpritePalette gMonPaletteTable[] = SPECIES_PAL(SEAKING, gMonPalette_Seaking), SPECIES_PAL(STARYU, gMonPalette_Staryu), SPECIES_PAL(STARMIE, gMonPalette_Starmie), - SPECIES_PAL(MR_MIME, gMonPalette_Mrmime), + SPECIES_PAL(MR_MIME, gMonPalette_MrMime), SPECIES_PAL(SCYTHER, gMonPalette_Scyther), SPECIES_PAL(JYNX, gMonPalette_Jynx), SPECIES_PAL(ELECTABUZZ, gMonPalette_Electabuzz), diff --git a/src/data/pokemon_graphics/shiny_palette_table.h b/src/data/pokemon_graphics/shiny_palette_table.h index 8b1cfcaac..1db14d864 100644 --- a/src/data/pokemon_graphics/shiny_palette_table.h +++ b/src/data/pokemon_graphics/shiny_palette_table.h @@ -122,7 +122,7 @@ const struct CompressedSpritePalette gMonShinyPaletteTable[] = SPECIES_SHINY_PAL(SEAKING, gMonShinyPalette_Seaking), SPECIES_SHINY_PAL(STARYU, gMonShinyPalette_Staryu), SPECIES_SHINY_PAL(STARMIE, gMonShinyPalette_Starmie), - SPECIES_SHINY_PAL(MR_MIME, gMonShinyPalette_Mrmime), + SPECIES_SHINY_PAL(MR_MIME, gMonShinyPalette_MrMime), SPECIES_SHINY_PAL(SCYTHER, gMonShinyPalette_Scyther), SPECIES_SHINY_PAL(JYNX, gMonShinyPalette_Jynx), SPECIES_SHINY_PAL(ELECTABUZZ, gMonShinyPalette_Electabuzz), diff --git a/src/data/pokemon_graphics/still_front_pic_table.h b/src/data/pokemon_graphics/still_front_pic_table.h index 985a3aa2f..9a77855ab 100644 --- a/src/data/pokemon_graphics/still_front_pic_table.h +++ b/src/data/pokemon_graphics/still_front_pic_table.h @@ -122,7 +122,7 @@ const struct CompressedSpriteSheet gMonStillFrontPicTable[] = SPECIES_SPRITE(SEAKING, gMonStillFrontPic_Seaking), SPECIES_SPRITE(STARYU, gMonStillFrontPic_Staryu), SPECIES_SPRITE(STARMIE, gMonStillFrontPic_Starmie), - SPECIES_SPRITE(MR_MIME, gMonStillFrontPic_Mrmime), + SPECIES_SPRITE(MR_MIME, gMonStillFrontPic_MrMime), SPECIES_SPRITE(SCYTHER, gMonStillFrontPic_Scyther), SPECIES_SPRITE(JYNX, gMonStillFrontPic_Jynx), SPECIES_SPRITE(ELECTABUZZ, gMonStillFrontPic_Electabuzz), diff --git a/src/pokemon_icon.c b/src/pokemon_icon.c index 8e37018cb..e659eebe2 100644 --- a/src/pokemon_icon.c +++ b/src/pokemon_icon.c @@ -146,7 +146,7 @@ const u8 *const gMonIconTable[] = [SPECIES_SEAKING] = gMonIcon_Seaking, [SPECIES_STARYU] = gMonIcon_Staryu, [SPECIES_STARMIE] = gMonIcon_Starmie, - [SPECIES_MR_MIME] = gMonIcon_Mrmime, + [SPECIES_MR_MIME] = gMonIcon_MrMime, [SPECIES_SCYTHER] = gMonIcon_Scyther, [SPECIES_JYNX] = gMonIcon_Jynx, [SPECIES_ELECTABUZZ] = gMonIcon_Electabuzz, From 4ed4b690198357a5bd68759b977c57e7d3f07f39 Mon Sep 17 00:00:00 2001 From: sbird Date: Fri, 15 Sep 2023 19:11:25 +0200 Subject: [PATCH 4/5] [BUGFIX] for abilities affecting wild encounter tables fixes a potential buffer overread in TryGetAbilityInfluencedWildMonIndex. The bug can occur if an electric type mon is in the first slots of a fishing encounter table and the player carries a mon with the `ABILITY_STATIC` ability. This never happens in the vanilla codebase. --- src/wild_encounter.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/wild_encounter.c b/src/wild_encounter.c index 87d7d866b..3a7f6cab2 100644 --- a/src/wild_encounter.c +++ b/src/wild_encounter.c @@ -52,7 +52,11 @@ static void FeebasSeedRng(u16 seed); static bool8 IsWildLevelAllowedByRepel(u8 level); static void ApplyFluteEncounterRateMod(u32 *encRate); static void ApplyCleanseTagEncounterRateMod(u32 *encRate); +#ifdef BUGFIX +static bool8 TryGetAbilityInfluencedWildMonIndex(const struct WildPokemon *wildMon, u8 type, u8 ability, u8 *monIndex, u32 size); +#else static bool8 TryGetAbilityInfluencedWildMonIndex(const struct WildPokemon *wildMon, u8 type, u8 ability, u8 *monIndex); +#endif static bool8 IsAbilityAllowingEncounter(u8 level); EWRAM_DATA static u8 sWildEncountersDisabled = 0; @@ -409,6 +413,11 @@ static void CreateWildMon(u16 species, u8 level) CreateMonWithNature(&gEnemyParty[0], species, level, USE_RANDOM_IVS, PickWildMonNature()); } +#ifdef BUGFIX +#define TRY_GET_ABILITY_INFLUENCED_WILD_MON_INDEX(wildPokemon, type, ability, ptr, count) TryGetAbilityInfluencedWildMonIndex(wildPokemon, type, ability, ptr, count) +#else +#define TRY_GET_ABILITY_INFLUENCED_WILD_MON_INDEX(wildPokemon, type, ability, ptr, count) TryGetAbilityInfluencedWildMonIndex(wildPokemon, type, ability, ptr) +#endif static bool8 TryGenerateWildMon(const struct WildPokemonInfo *wildMonInfo, u8 area, u8 flags) { @@ -418,15 +427,15 @@ static bool8 TryGenerateWildMon(const struct WildPokemonInfo *wildMonInfo, u8 ar switch (area) { case WILD_AREA_LAND: - if (TryGetAbilityInfluencedWildMonIndex(wildMonInfo->wildPokemon, TYPE_STEEL, ABILITY_MAGNET_PULL, &wildMonIndex)) + if (TRY_GET_ABILITY_INFLUENCED_WILD_MON_INDEX(wildMonInfo->wildPokemon, TYPE_STEEL, ABILITY_MAGNET_PULL, &wildMonIndex, LAND_WILD_COUNT)) break; - if (TryGetAbilityInfluencedWildMonIndex(wildMonInfo->wildPokemon, TYPE_ELECTRIC, ABILITY_STATIC, &wildMonIndex)) + if (TRY_GET_ABILITY_INFLUENCED_WILD_MON_INDEX(wildMonInfo->wildPokemon, TYPE_ELECTRIC, ABILITY_STATIC, &wildMonIndex, LAND_WILD_COUNT)) break; wildMonIndex = ChooseWildMonIndex_Land(); break; case WILD_AREA_WATER: - if (TryGetAbilityInfluencedWildMonIndex(wildMonInfo->wildPokemon, TYPE_ELECTRIC, ABILITY_STATIC, &wildMonIndex)) + if (TRY_GET_ABILITY_INFLUENCED_WILD_MON_INDEX(wildMonInfo->wildPokemon, TYPE_ELECTRIC, ABILITY_STATIC, &wildMonIndex, WATER_WILD_COUNT)) break; wildMonIndex = ChooseWildMonIndex_WaterRock(); @@ -923,8 +932,11 @@ static bool8 TryGetRandomWildMonIndexByType(const struct WildPokemon *wildMon, u *monIndex = validIndexes[Random() % validMonCount]; return TRUE; } - +#ifdef BUGFIX +static bool8 TryGetAbilityInfluencedWildMonIndex(const struct WildPokemon *wildMon, u8 type, u8 ability, u8 *monIndex, u32 size) +#else static bool8 TryGetAbilityInfluencedWildMonIndex(const struct WildPokemon *wildMon, u8 type, u8 ability, u8 *monIndex) +#endif { if (GetMonData(&gPlayerParty[0], MON_DATA_SANITY_IS_EGG)) return FALSE; @@ -933,7 +945,11 @@ static bool8 TryGetAbilityInfluencedWildMonIndex(const struct WildPokemon *wildM else if (Random() % 2 != 0) return FALSE; +#ifdef BUGFIX + return TryGetRandomWildMonIndexByType(wildMon, type, size, monIndex); +#else return TryGetRandomWildMonIndexByType(wildMon, type, LAND_WILD_COUNT, monIndex); +#endif } static void ApplyFluteEncounterRateMod(u32 *encRate) From 6eb6282c89387f4636fd7725f555623d3f3c5ec7 Mon Sep 17 00:00:00 2001 From: Kurausukun Date: Sat, 23 Sep 2023 17:06:12 -0400 Subject: [PATCH 5/5] add missing constant usage in m4a_1 --- src/m4a_1.s | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/m4a_1.s b/src/m4a_1.s index 3f1578806..20f9197a8 100644 --- a/src/m4a_1.s +++ b/src/m4a_1.s @@ -1395,7 +1395,7 @@ _081DD9F6: cmp r6, 0 beq _081DDA14 ldrb r0, [r4, o_CgbChannel_modify] - movs r1, 0x1 + movs r1, CGB_CHANNEL_MO_VOL orrs r0, r1 strb r0, [r4, o_CgbChannel_modify] _081DDA14: