From 0c7623ab64e3425b8623312e37035a7fdf584d6c Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Wed, 13 Dec 2023 19:04:49 -0300 Subject: [PATCH] Fixed compile when setting everything to GEN_1 --- include/constants/moves.h | 6 +++++ src/battle_script_commands.c | 4 +++ src/daycare.c | 48 +++++++++++++++++------------------- src/pokemon_storage_system.c | 14 +++++------ 4 files changed, 40 insertions(+), 32 deletions(-) diff --git a/include/constants/moves.h b/include/constants/moves.h index 8c76f65e3e8e..eaa50265d429 100644 --- a/include/constants/moves.h +++ b/include/constants/moves.h @@ -179,6 +179,9 @@ #define MOVE_SLASH 163 #define MOVE_SUBSTITUTE 164 #define MOVE_STRUGGLE 165 + +#define MOVES_COUNT_GEN1 166 + #define MOVE_SKETCH 166 #define MOVE_TRIPLE_KICK 167 #define MOVE_THIEF 168 @@ -270,6 +273,9 @@ #define MOVE_ROCK_SMASH 249 #define MOVE_WHIRLPOOL 250 #define MOVE_BEAT_UP 251 + +#define MOVES_COUNT_GEN2 252 + #define MOVE_FAKE_OUT 252 #define MOVE_UPROAR 253 #define MOVE_STOCKPILE 254 diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 3d21c922ebf0..6eead682a48e 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -12400,6 +12400,10 @@ static void Cmd_metronome(void) u32 moveCount = MOVES_COUNT_GEN4; #elif B_METRONOME_MOVES >= GEN_3 u32 moveCount = MOVES_COUNT_GEN3; +#elif B_METRONOME_MOVES >= GEN_2 + u32 moveCount = MOVES_COUNT_GEN2; +#else + u32 moveCount = MOVES_COUNT_GEN1; #endif gCurrentMove = RandomUniformExcept(RNG_METRONOME, 1, moveCount - 1, InvalidMetronomeMove); diff --git a/src/daycare.c b/src/daycare.c index f5f0f3ac327f..33b3d8ac1b8a 100644 --- a/src/daycare.c +++ b/src/daycare.c @@ -235,9 +235,8 @@ static void StorePokemonInDaycare(struct Pokemon *mon, struct DaycareMon *daycar CompactPartySlots(); CalculatePlayerPartyCount(); -#if P_EGG_MOVE_TRANSFER >= GEN_8 - TransferEggMoves(); -#endif + if (P_EGG_MOVE_TRANSFER >= GEN_8) + TransferEggMoves(); } static void StorePokemonInEmptyDaycareSlot(struct Pokemon *mon, struct DayCare *daycare) @@ -698,16 +697,19 @@ static void InheritPokeball(struct Pokemon *egg, struct BoxPokemon *father, stru if (motherBall == ITEM_MASTER_BALL || motherBall == ITEM_CHERISH_BALL) motherBall = ITEM_POKE_BALL; -#if P_BALL_INHERITING >= GEN_7 - if (fatherSpecies == motherSpecies) - inheritBall = (Random() % 2 == 0 ? motherBall : fatherBall); - else if (motherSpecies != SPECIES_DITTO) + if (P_BALL_INHERITING >= GEN_7) + { + if (fatherSpecies == motherSpecies) + inheritBall = (Random() % 2 == 0 ? motherBall : fatherBall); + else if (motherSpecies != SPECIES_DITTO) + inheritBall = motherBall; + else + inheritBall = fatherBall; + } + else if (P_BALL_INHERITING == GEN_6) + { inheritBall = motherBall; - else - inheritBall = fatherBall; -#elif P_BALL_INHERITING == GEN_6 - inheritBall = motherBall; -#endif + } SetMonData(egg, MON_DATA_POKEBALL, &inheritBall); } @@ -719,21 +721,18 @@ static void InheritAbility(struct Pokemon *egg, struct BoxPokemon *father, struc u8 inheritAbility = motherAbility; if (motherSpecies == SPECIES_DITTO) - #if P_ABILITY_INHERITANCE < GEN_6 - return; - #else - inheritAbility = fatherAbility; - #endif + { + if (P_ABILITY_INHERITANCE >= GEN_6) + inheritAbility = fatherAbility; + else + return; + } if (inheritAbility < 2 && (Random() % 10 < 8)) { SetMonData(egg, MON_DATA_ABILITY_NUM, &inheritAbility); } -#if P_ABILITY_INHERITANCE < GEN_6 - else if (Random() % 10 < 8) -#else - else if (Random() % 10 < 6) -#endif + else if (Random() % 10 < (P_ABILITY_INHERITANCE >= GEN_6 ? 6 : 8)) { // Hidden Abilities have a different chance of being passed down SetMonData(egg, MON_DATA_ABILITY_NUM, &inheritAbility); @@ -1088,9 +1087,8 @@ static void _GiveEggFromDaycare(struct DayCare *daycare) InheritIVs(&egg, daycare); InheritPokeball(&egg, &daycare->mons[parentSlots[1]].mon, &daycare->mons[parentSlots[0]].mon); BuildEggMoveset(&egg, &daycare->mons[parentSlots[1]].mon, &daycare->mons[parentSlots[0]].mon); -#if P_ABILITY_INHERITANCE >= GEN_6 - InheritAbility(&egg, &daycare->mons[parentSlots[1]].mon, &daycare->mons[parentSlots[0]].mon); -#endif + if (P_ABILITY_INHERITANCE >= GEN_6) + InheritAbility(&egg, &daycare->mons[parentSlots[1]].mon, &daycare->mons[parentSlots[0]].mon); GiveMoveIfItem(&egg, daycare); diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index a5bfc51dec9c..817ec51543cf 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -3682,12 +3682,13 @@ static void Task_OnBPressed(u8 taskId) case 0: if (IsMonBeingMoved()) { - #if OW_PC_PRESS_B < GEN_4 - PlaySE(SE_FAILURE); - PrintMessage(MSG_HOLDING_POKE); - sStorage->state = 1; - #else - if (CanPlaceMon()) + if (OW_PC_PRESS_B < GEN_4) + { + PlaySE(SE_FAILURE); + PrintMessage(MSG_HOLDING_POKE); + sStorage->state = 1; + } + else if (CanPlaceMon()) { PlaySE(SE_SELECT); SetPokeStorageTask(Task_PlaceMon); @@ -3696,7 +3697,6 @@ static void Task_OnBPressed(u8 taskId) { SetPokeStorageTask(Task_PokeStorageMain); } - #endif } else if (IsMovingItem()) {