From e605ffba539fd54f2a5d105493c2943a6bdd91c1 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Wed, 4 Dec 2024 18:22:16 -0300 Subject: [PATCH 1/4] Fix recorded battle link player loops (#2071) --- src/recorded_battle.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/recorded_battle.c b/src/recorded_battle.c index 42866c723b73..ebd2a5800f1e 100644 --- a/src/recorded_battle.c +++ b/src/recorded_battle.c @@ -35,13 +35,13 @@ struct RecordedBattleSave { struct Pokemon playerParty[PARTY_SIZE]; struct Pokemon opponentParty[PARTY_SIZE]; - u8 playersName[MAX_BATTLERS_COUNT][PLAYER_NAME_LENGTH + 1]; - u8 playersGender[MAX_BATTLERS_COUNT]; - u32 playersTrainerId[MAX_BATTLERS_COUNT]; - u8 playersLanguage[MAX_BATTLERS_COUNT]; + u8 playersName[MAX_LINK_PLAYERS][PLAYER_NAME_LENGTH + 1]; + u8 playersGender[MAX_LINK_PLAYERS]; + u32 playersTrainerId[MAX_LINK_PLAYERS]; + u8 playersLanguage[MAX_LINK_PLAYERS]; u32 rngSeed; u32 battleFlags; - u8 playersBattlers[MAX_BATTLERS_COUNT]; + u8 playersBattlers[MAX_LINK_PLAYERS]; u16 opponentA; u16 opponentB; u16 partnerId; @@ -85,7 +85,7 @@ EWRAM_DATA static u32 sAI_Scripts = 0; EWRAM_DATA static struct Pokemon sSavedPlayerParty[PARTY_SIZE] = {0}; EWRAM_DATA static struct Pokemon sSavedOpponentParty[PARTY_SIZE] = {0}; EWRAM_DATA static u16 sPlayerMonMoves[MAX_BATTLERS_COUNT / 2][MAX_MON_MOVES] = {0}; -EWRAM_DATA static struct PlayerInfo sPlayers[MAX_BATTLERS_COUNT] = {0}; +EWRAM_DATA static struct PlayerInfo sPlayers[MAX_LINK_PLAYERS] = {0}; EWRAM_DATA static bool8 sIsPlaybackFinished = 0; EWRAM_DATA static u8 sRecordMixFriendName[PLAYER_NAME_LENGTH + 1] = {0}; EWRAM_DATA static u8 sRecordMixFriendClass = 0; @@ -148,7 +148,7 @@ void RecordedBattle_SetTrainerInfo(void) gRecordedBattleMultiplayerId = GetMultiplayerId(); linkPlayersCount = GetLinkPlayerCount(); - for (i = 0; i < MAX_BATTLERS_COUNT; i++) + for (i = 0; i < MAX_LINK_PLAYERS; i++) { sPlayers[i].trainerId = gLinkPlayers[i].trainerId; sPlayers[i].gender = gLinkPlayers[i].gender; @@ -333,7 +333,7 @@ bool32 MoveRecordedBattleToSaveData(void) battleSave->opponentParty[i] = sSavedOpponentParty[i]; } - for (i = 0; i < MAX_BATTLERS_COUNT; i++) + for (i = 0; i < MAX_LINK_PLAYERS; i++) { for (j = 0; j < PLAYER_NAME_LENGTH + 1; j++) battleSave->playersName[i][j] = sPlayers[i].name[j]; @@ -535,7 +535,7 @@ static void SetVariablesForRecordedBattle(struct RecordedBattleSave *src) gEnemyParty[i] = src->opponentParty[i]; } - for (i = 0; i < MAX_BATTLERS_COUNT; i++) + for (i = 0; i < MAX_LINK_PLAYERS; i++) { for (var = FALSE, j = 0; j < PLAYER_NAME_LENGTH + 1; j++) { From 3f98c782973c912907ecc941aa98e519d15b27fc Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Wed, 4 Dec 2024 19:38:23 -0300 Subject: [PATCH 2/4] Added POKEMART_LIST_END to avoid users accidentally removing it (#1947) --- asm/macros/event.inc | 7 +++++++ data/maps/BattleFrontier_Mart/scripts.inc | 4 +--- .../EverGrandeCity_PokemonLeague_1F/scripts.inc | 4 +--- data/maps/FallarborTown_Mart/scripts.inc | 4 +--- data/maps/FortreeCity_DecorationShop/scripts.inc | 8 ++------ data/maps/FortreeCity_Mart/scripts.inc | 4 +--- data/maps/LavaridgeTown_HerbShop/scripts.inc | 4 +--- data/maps/LavaridgeTown_Mart/scripts.inc | 4 +--- .../LilycoveCity_DepartmentStore_2F/scripts.inc | 8 ++------ .../LilycoveCity_DepartmentStore_3F/scripts.inc | 8 ++------ .../LilycoveCity_DepartmentStore_4F/scripts.inc | 8 ++------ .../LilycoveCity_DepartmentStore_5F/scripts.inc | 16 ++++------------ data/maps/MauvilleCity_Mart/scripts.inc | 4 +--- data/maps/MossdeepCity_Mart/scripts.inc | 4 +--- data/maps/OldaleTown_Mart/scripts.inc | 8 ++------ data/maps/PetalburgCity_Mart/scripts.inc | 8 ++------ .../Route104_PrettyPetalFlowerShop/scripts.inc | 4 +--- data/maps/RustboroCity_Mart/scripts.inc | 8 ++------ data/maps/SlateportCity/scripts.inc | 16 ++++------------ data/maps/SlateportCity_Mart/scripts.inc | 4 +--- data/maps/SootopolisCity_Mart/scripts.inc | 4 +--- data/maps/TrainerHill_Entrance/scripts.inc | 8 ++------ data/maps/VerdanturfTown_Mart/scripts.inc | 4 +--- 23 files changed, 43 insertions(+), 108 deletions(-) diff --git a/asm/macros/event.inc b/asm/macros/event.inc index b91ac682107c..66aeb8482de3 100644 --- a/asm/macros/event.inc +++ b/asm/macros/event.inc @@ -1108,6 +1108,13 @@ .4byte \products .endm + @ Used as the endpoint for a Pokemart item list + .macro pokemartlistend + .2byte ITEM_NONE + release + end + .endm + @ Opens the Pokemart system and treats the list of items as decorations. @ Products should be a list of .2byte decoration values preceded by an .align 2 .macro pokemartdecoration products:req diff --git a/data/maps/BattleFrontier_Mart/scripts.inc b/data/maps/BattleFrontier_Mart/scripts.inc index 6afe6a0186b0..f118476cfe30 100644 --- a/data/maps/BattleFrontier_Mart/scripts.inc +++ b/data/maps/BattleFrontier_Mart/scripts.inc @@ -28,9 +28,7 @@ BattleFrontier_Mart_Pokemart: .2byte ITEM_ZINC .2byte ITEM_CARBOS .2byte ITEM_HP_UP - .2byte ITEM_NONE - release - end + pokemartlistend BattleFrontier_Mart_EventScript_OldMan:: msgbox BattleFrontier_Mart_Text_ChaperonGrandson, MSGBOX_NPC diff --git a/data/maps/EverGrandeCity_PokemonLeague_1F/scripts.inc b/data/maps/EverGrandeCity_PokemonLeague_1F/scripts.inc index c13e71697586..37e691fa3b3b 100644 --- a/data/maps/EverGrandeCity_PokemonLeague_1F/scripts.inc +++ b/data/maps/EverGrandeCity_PokemonLeague_1F/scripts.inc @@ -45,9 +45,7 @@ EverGrandeCity_PokemonLeague_1F_Pokemart: .2byte ITEM_FULL_HEAL .2byte ITEM_REVIVE .2byte ITEM_MAX_REPEL - .2byte ITEM_NONE - release - end + pokemartlistend @ The door guards only check for FLAG_BADGE06_GET because Winonas badge is the only one that can be skipped @ Its assumed the player has the remaining badges diff --git a/data/maps/FallarborTown_Mart/scripts.inc b/data/maps/FallarborTown_Mart/scripts.inc index cb92f28f520e..0cdb11ee5ed0 100644 --- a/data/maps/FallarborTown_Mart/scripts.inc +++ b/data/maps/FallarborTown_Mart/scripts.inc @@ -25,9 +25,7 @@ FallarborTown_Mart_Pokemart: .2byte ITEM_X_DEFEND .2byte ITEM_DIRE_HIT .2byte ITEM_GUARD_SPEC - .2byte ITEM_NONE - release - end + pokemartlistend FallarborTown_Mart_EventScript_Woman:: msgbox FallarborTown_Mart_Text_DecidingSkittyEvolve, MSGBOX_NPC diff --git a/data/maps/FortreeCity_DecorationShop/scripts.inc b/data/maps/FortreeCity_DecorationShop/scripts.inc index 43943128769e..4da66f27b980 100644 --- a/data/maps/FortreeCity_DecorationShop/scripts.inc +++ b/data/maps/FortreeCity_DecorationShop/scripts.inc @@ -29,9 +29,7 @@ FortreeCity_DecorationShop_PokemartDecor_Desks: .2byte DECOR_BRICK_DESK .2byte DECOR_CAMP_DESK .2byte DECOR_HARD_DESK - .2byte DECOR_NONE - release - end + pokemartlistend FortreeCity_DecorationShop_EventScript_ClerkChairs:: lock @@ -53,9 +51,7 @@ FortreeCity_DecorationShop_PokemartDecor_Chairs: .2byte DECOR_BRICK_CHAIR .2byte DECOR_CAMP_CHAIR .2byte DECOR_HARD_CHAIR - .2byte DECOR_NONE - release - end + pokemartlistend FortreeCity_DecorationShop_Text_MerchandiseSentToPC: .string "Merchandise you buy here is sent to\n" diff --git a/data/maps/FortreeCity_Mart/scripts.inc b/data/maps/FortreeCity_Mart/scripts.inc index c37716bc85a1..0986e68c0ca4 100644 --- a/data/maps/FortreeCity_Mart/scripts.inc +++ b/data/maps/FortreeCity_Mart/scripts.inc @@ -23,9 +23,7 @@ FortreeCity_Mart_Pokemart: .2byte ITEM_REVIVE .2byte ITEM_SUPER_REPEL .2byte ITEM_WOOD_MAIL - .2byte ITEM_NONE - release - end + pokemartlistend FortreeCity_Mart_EventScript_Woman:: msgbox FortreeCity_Mart_Text_SuperRepelBetter, MSGBOX_NPC diff --git a/data/maps/LavaridgeTown_HerbShop/scripts.inc b/data/maps/LavaridgeTown_HerbShop/scripts.inc index dbe1b564aca4..22e3851e9d1d 100644 --- a/data/maps/LavaridgeTown_HerbShop/scripts.inc +++ b/data/maps/LavaridgeTown_HerbShop/scripts.inc @@ -17,9 +17,7 @@ LavaridgeTown_HerbShop_Pokemart: .2byte ITEM_ENERGY_ROOT .2byte ITEM_HEAL_POWDER .2byte ITEM_REVIVAL_HERB - .2byte ITEM_NONE - release - end + pokemartlistend LavaridgeTown_HerbShop_EventScript_ExpertM:: msgbox LavaridgeTown_HerbShop_Text_HerbalMedicineWorksButMonWillDislike, MSGBOX_NPC diff --git a/data/maps/LavaridgeTown_Mart/scripts.inc b/data/maps/LavaridgeTown_Mart/scripts.inc index 001df3140105..8df5d02dfcc4 100644 --- a/data/maps/LavaridgeTown_Mart/scripts.inc +++ b/data/maps/LavaridgeTown_Mart/scripts.inc @@ -22,9 +22,7 @@ LavaridgeTown_Mart_Pokemart: .2byte ITEM_REVIVE .2byte ITEM_SUPER_REPEL .2byte ITEM_X_SPEED - .2byte ITEM_NONE - release - end + pokemartlistend LavaridgeTown_Mart_EventScript_ExpertM:: msgbox LavaridgeTown_Mart_Text_XSpeedFirstStrike, MSGBOX_NPC diff --git a/data/maps/LilycoveCity_DepartmentStore_2F/scripts.inc b/data/maps/LilycoveCity_DepartmentStore_2F/scripts.inc index 478f5cfd3122..0a502a4f0e4e 100644 --- a/data/maps/LilycoveCity_DepartmentStore_2F/scripts.inc +++ b/data/maps/LilycoveCity_DepartmentStore_2F/scripts.inc @@ -36,9 +36,7 @@ LilycoveCity_DepartmentStore_2F_Pokemart1: .2byte ITEM_ICE_HEAL .2byte ITEM_AWAKENING .2byte ITEM_FLUFFY_TAIL - .2byte ITEM_NONE - release - end + pokemartlistend LilycoveCity_DepartmentStore_2F_EventScript_ClerkRight:: lock @@ -62,9 +60,7 @@ LilycoveCity_DepartmentStore_2F_Pokemart2: .2byte ITEM_MAX_REPEL .2byte ITEM_WAVE_MAIL .2byte ITEM_MECH_MAIL - .2byte ITEM_NONE - release - end + pokemartlistend LilycoveCity_DepartmentStore_2F_Text_LearnToUseItemsProperly: .string "Learn to use items properly.\n" diff --git a/data/maps/LilycoveCity_DepartmentStore_3F/scripts.inc b/data/maps/LilycoveCity_DepartmentStore_3F/scripts.inc index 20480068b8a2..bc42b293be9a 100644 --- a/data/maps/LilycoveCity_DepartmentStore_3F/scripts.inc +++ b/data/maps/LilycoveCity_DepartmentStore_3F/scripts.inc @@ -19,9 +19,7 @@ LilycoveCity_DepartmentStore_3F_Pokemart_Vitamins: .2byte ITEM_ZINC .2byte ITEM_CARBOS .2byte ITEM_HP_UP - .2byte ITEM_NONE - release - end + pokemartlistend LilycoveCity_DepartmentStore_3F_EventScript_ClerkRight:: lock @@ -42,9 +40,7 @@ LilycoveCity_DepartmentStore_3F_Pokemart_StatBoosters: .2byte ITEM_DIRE_HIT .2byte ITEM_GUARD_SPEC .2byte ITEM_X_ACCURACY - .2byte ITEM_NONE - release - end + pokemartlistend LilycoveCity_DepartmentStore_3F_EventScript_TriathleteM:: msgbox LilycoveCity_DepartmentStore_3F_Text_ItemsBestForTougheningPokemon, MSGBOX_NPC diff --git a/data/maps/LilycoveCity_DepartmentStore_4F/scripts.inc b/data/maps/LilycoveCity_DepartmentStore_4F/scripts.inc index 760abc600d33..0d6403b20650 100644 --- a/data/maps/LilycoveCity_DepartmentStore_4F/scripts.inc +++ b/data/maps/LilycoveCity_DepartmentStore_4F/scripts.inc @@ -29,9 +29,7 @@ LilycoveCity_DepartmentStore_4F_Pokemart_AttackTMs: .2byte ITEM_TM_THUNDER .2byte ITEM_TM_BLIZZARD .2byte ITEM_TM_HYPER_BEAM - .2byte ITEM_NONE - release - end + pokemartlistend LilycoveCity_DepartmentStore_4F_EventScript_ClerkRight:: lock @@ -49,9 +47,7 @@ LilycoveCity_DepartmentStore_4F_Pokemart_DefenseTMs: .2byte ITEM_TM_SAFEGUARD .2byte ITEM_TM_REFLECT .2byte ITEM_TM_LIGHT_SCREEN - .2byte ITEM_NONE - release - end + pokemartlistend LilycoveCity_DepartmentStore_4F_Text_AttackOrDefenseTM: .string "Hmm…\p" diff --git a/data/maps/LilycoveCity_DepartmentStore_5F/scripts.inc b/data/maps/LilycoveCity_DepartmentStore_5F/scripts.inc index a9683d13c9b6..f75a48e70835 100644 --- a/data/maps/LilycoveCity_DepartmentStore_5F/scripts.inc +++ b/data/maps/LilycoveCity_DepartmentStore_5F/scripts.inc @@ -41,9 +41,7 @@ LilycoveCity_DepartmentStore_5F_Pokemart_Dolls: .2byte DECOR_SKITTY_DOLL .2byte DECOR_SWABLU_DOLL .2byte DECOR_GULPIN_DOLL - .2byte DECOR_NONE - release - end + pokemartlistend LilycoveCity_DepartmentStore_5F_EventScript_ClerkMidLeft:: lock @@ -66,9 +64,7 @@ LilycoveCity_DepartmentStore_5F_Pokemart_Cushions: .2byte DECOR_GRASS_CUSHION .2byte DECOR_FIRE_CUSHION .2byte DECOR_WATER_CUSHION - .2byte DECOR_NONE - release - end + pokemartlistend LilycoveCity_DepartmentStore_5F_EventScript_ClerkMidRight:: lock @@ -91,9 +87,7 @@ LilycoveCity_DepartmentStore_5F_Pokemart_Posters: .2byte DECOR_LONG_POSTER .2byte DECOR_SEA_POSTER .2byte DECOR_SKY_POSTER - .2byte DECOR_NONE - release - end + pokemartlistend LilycoveCity_DepartmentStore_5F_EventScript_ClerkFarRight:: lock @@ -117,9 +111,7 @@ LilycoveCity_DepartmentStore_5F_Pokemart_Mats: .2byte DECOR_GLITTER_MAT .2byte DECOR_JUMP_MAT .2byte DECOR_SPIN_MAT - .2byte DECOR_NONE - release - end + pokemartlistend LilycoveCity_DepartmentStore_5F_EventScript_PokefanF:: msgbox LilycoveCity_DepartmentStore_5F_Text_PlaceFullOfCuteDolls, MSGBOX_NPC diff --git a/data/maps/MauvilleCity_Mart/scripts.inc b/data/maps/MauvilleCity_Mart/scripts.inc index 4cf5bc20bb82..3a416b59074e 100644 --- a/data/maps/MauvilleCity_Mart/scripts.inc +++ b/data/maps/MauvilleCity_Mart/scripts.inc @@ -25,9 +25,7 @@ MauvilleCity_Mart_Pokemart: .2byte ITEM_GUARD_SPEC .2byte ITEM_DIRE_HIT .2byte ITEM_X_ACCURACY - .2byte ITEM_NONE - release - end + pokemartlistend MauvilleCity_Mart_EventScript_ExpertM:: msgbox MauvilleCity_Mart_Text_ItemsToTemporarilyElevateStats, MSGBOX_NPC diff --git a/data/maps/MossdeepCity_Mart/scripts.inc b/data/maps/MossdeepCity_Mart/scripts.inc index 50edddd09aba..b66fbe4209f9 100644 --- a/data/maps/MossdeepCity_Mart/scripts.inc +++ b/data/maps/MossdeepCity_Mart/scripts.inc @@ -22,9 +22,7 @@ MossdeepCity_Mart_Pokemart: .2byte ITEM_MAX_REPEL .2byte ITEM_X_ATTACK .2byte ITEM_X_DEFEND - .2byte ITEM_NONE - release - end + pokemartlistend MossdeepCity_Mart_EventScript_Woman:: msgbox MossdeepCity_Mart_Text_ReviveIsFantastic, MSGBOX_NPC diff --git a/data/maps/OldaleTown_Mart/scripts.inc b/data/maps/OldaleTown_Mart/scripts.inc index 0b3c7b1a3441..1e1aacbb104b 100644 --- a/data/maps/OldaleTown_Mart/scripts.inc +++ b/data/maps/OldaleTown_Mart/scripts.inc @@ -18,9 +18,7 @@ OldaleTown_Mart_Pokemart_Basic: .2byte ITEM_ANTIDOTE .2byte ITEM_PARALYZE_HEAL .2byte ITEM_AWAKENING - .2byte ITEM_NONE - release - end + pokemartlistend OldaleTown_Mart_ExpandedItems:: pokemart OldaleTown_Mart_Pokemart_Expanded @@ -35,9 +33,7 @@ OldaleTown_Mart_Pokemart_Expanded: .2byte ITEM_ANTIDOTE .2byte ITEM_PARALYZE_HEAL .2byte ITEM_AWAKENING - .2byte ITEM_NONE - release - end + pokemartlistend OldaleTown_Mart_EventScript_Woman:: lock diff --git a/data/maps/PetalburgCity_Mart/scripts.inc b/data/maps/PetalburgCity_Mart/scripts.inc index abaa7b5b0ec3..27393c51bf00 100644 --- a/data/maps/PetalburgCity_Mart/scripts.inc +++ b/data/maps/PetalburgCity_Mart/scripts.inc @@ -25,9 +25,7 @@ PetalburgCity_Mart_Pokemart_Basic: .2byte ITEM_X_ATTACK .2byte ITEM_X_DEFEND .2byte ITEM_ORANGE_MAIL - .2byte ITEM_NONE - release - end + pokemartlistend PetalburgCity_Mart_EventScript_ExpandedItems:: pokemart PetalburgCity_Mart_Pokemart_Expanded @@ -50,9 +48,7 @@ PetalburgCity_Mart_Pokemart_Expanded: .2byte ITEM_X_ATTACK .2byte ITEM_X_DEFEND .2byte ITEM_ORANGE_MAIL - .2byte ITEM_NONE - release - end + pokemartlistend PetalburgCity_Mart_EventScript_Woman:: msgbox PetalburgCity_Mart_Text_WeakWillGrowStronger, MSGBOX_NPC diff --git a/data/maps/Route104_PrettyPetalFlowerShop/scripts.inc b/data/maps/Route104_PrettyPetalFlowerShop/scripts.inc index 5f0ec28fa51d..e239ea658bba 100644 --- a/data/maps/Route104_PrettyPetalFlowerShop/scripts.inc +++ b/data/maps/Route104_PrettyPetalFlowerShop/scripts.inc @@ -59,9 +59,7 @@ Route104_PrettyPetalFlowerShop_Pokemart_Plants: .2byte DECOR_COLORFUL_PLANT .2byte DECOR_BIG_PLANT .2byte DECOR_GORGEOUS_PLANT - .2byte DECOR_NONE - release - end + pokemartlistend Route104_PrettyPetalFlowerShop_EventScript_WailmerPailGirl:: lock diff --git a/data/maps/RustboroCity_Mart/scripts.inc b/data/maps/RustboroCity_Mart/scripts.inc index 18120cb4def8..5d6a7fe5f7d7 100644 --- a/data/maps/RustboroCity_Mart/scripts.inc +++ b/data/maps/RustboroCity_Mart/scripts.inc @@ -28,9 +28,7 @@ RustboroCity_Mart_Pokemart_Basic: .2byte ITEM_X_SPEED .2byte ITEM_X_ATTACK .2byte ITEM_X_DEFEND - .2byte ITEM_NONE - release - end + pokemartlistend RustboroCity_Mart_EventScript_PokemartExpanded:: pokemart RustboroCity_Mart_Pokemart_Expanded @@ -52,9 +50,7 @@ RustboroCity_Mart_Pokemart_Expanded: .2byte ITEM_X_SPEED .2byte ITEM_X_ATTACK .2byte ITEM_X_DEFEND - .2byte ITEM_NONE - release - end + pokemartlistend RustboroCity_Mart_EventScript_PokefanF:: msgbox RustboroCity_Mart_Text_BuyingHealsInCaseOfShroomish, MSGBOX_NPC diff --git a/data/maps/SlateportCity/scripts.inc b/data/maps/SlateportCity/scripts.inc index ae3910750e6c..5438a7f364cc 100644 --- a/data/maps/SlateportCity/scripts.inc +++ b/data/maps/SlateportCity/scripts.inc @@ -154,9 +154,7 @@ SlateportCity_Pokemart_EnergyGuru: .2byte ITEM_ZINC .2byte ITEM_CALCIUM .2byte ITEM_HP_UP - .2byte ITEM_NONE - release - end + pokemartlistend SlateportCity_EventScript_EffortRibbonWoman:: lock @@ -514,9 +512,7 @@ SlateportCity_PokemartDecor_Dolls: .2byte DECOR_AZURILL_DOLL .2byte DECOR_MARILL_DOLL .2byte DECOR_SKITTY_DOLL - .2byte DECOR_NONE - release - end + pokemartlistend SlateportCity_EventScript_ComeBackWithSecretPower:: msgbox gText_ComeBackWithSecretPower, MSGBOX_DEFAULT @@ -550,9 +546,7 @@ SlateportCity_PokemartDecor: .2byte DECOR_A_NOTE_MAT .2byte DECOR_B_NOTE_MAT .2byte DECOR_C_HIGH_NOTE_MAT - .2byte DECOR_NONE - release - end + pokemartlistend SlateportCity_EventScript_PowerTMClerk:: lock @@ -568,9 +562,7 @@ SlateportCity_EventScript_PowerTMClerk:: SlateportCity_Pokemart_PowerTMs: .2byte ITEM_TM_HIDDEN_POWER .2byte ITEM_TM_SECRET_POWER - .2byte ITEM_NONE - release - end + pokemartlistend @ Scene with Capt Sterns interview and Team Aqua announcing plans to steal Submarine SlateportCity_EventScript_CaptStern:: diff --git a/data/maps/SlateportCity_Mart/scripts.inc b/data/maps/SlateportCity_Mart/scripts.inc index a0c0a8612e39..ce7dd45b868d 100644 --- a/data/maps/SlateportCity_Mart/scripts.inc +++ b/data/maps/SlateportCity_Mart/scripts.inc @@ -22,9 +22,7 @@ SlateportCity_Mart_Pokemart: .2byte ITEM_ESCAPE_ROPE .2byte ITEM_REPEL .2byte ITEM_HARBOR_MAIL - .2byte ITEM_NONE - release - end + pokemartlistend SlateportCity_Mart_EventScript_BlackBelt:: msgbox SlateportCity_Mart_Text_SomeItemsOnlyAtMart, MSGBOX_NPC diff --git a/data/maps/SootopolisCity_Mart/scripts.inc b/data/maps/SootopolisCity_Mart/scripts.inc index 3cade5fbc428..5539eb8be122 100644 --- a/data/maps/SootopolisCity_Mart/scripts.inc +++ b/data/maps/SootopolisCity_Mart/scripts.inc @@ -22,9 +22,7 @@ SootopolisCity_Mart_Pokemart: .2byte ITEM_X_ATTACK .2byte ITEM_X_DEFEND .2byte ITEM_SHADOW_MAIL - .2byte ITEM_NONE - release - end + pokemartlistend SootopolisCity_Mart_EventScript_FatMan:: lock diff --git a/data/maps/TrainerHill_Entrance/scripts.inc b/data/maps/TrainerHill_Entrance/scripts.inc index 2dd001a3baba..83a12e1c9752 100644 --- a/data/maps/TrainerHill_Entrance/scripts.inc +++ b/data/maps/TrainerHill_Entrance/scripts.inc @@ -265,9 +265,7 @@ TrainerHill_Entrance_Pokemart_Basic: .2byte ITEM_DIRE_HIT .2byte ITEM_GUARD_SPEC .2byte ITEM_X_ACCURACY - .2byte ITEM_NONE - release - end + pokemartlistend TrainerHill_Entrance_EventScript_ExpandedPokemart:: pokemart TrainerHill_Entrance_Pokemart_Expanded @@ -289,9 +287,7 @@ TrainerHill_Entrance_Pokemart_Expanded: .2byte ITEM_DIRE_HIT .2byte ITEM_GUARD_SPEC .2byte ITEM_X_ACCURACY - .2byte ITEM_NONE - release - end + pokemartlistend TrainerHill_Entrance_Text_StillGettingReady: .string "This is the TRAINER HILL where\n" diff --git a/data/maps/VerdanturfTown_Mart/scripts.inc b/data/maps/VerdanturfTown_Mart/scripts.inc index 7eb340df2ad3..e67ccd0e609e 100644 --- a/data/maps/VerdanturfTown_Mart/scripts.inc +++ b/data/maps/VerdanturfTown_Mart/scripts.inc @@ -24,9 +24,7 @@ VerdanturfTown_Mart_Pokemart: .2byte ITEM_REPEL .2byte ITEM_X_SPECIAL .2byte ITEM_FLUFFY_TAIL - .2byte ITEM_NONE - release - end + pokemartlistend VerdanturfTown_Mart_EventScript_Boy:: msgbox VerdanturfTown_Mart_Text_XSpecialIsCrucial, MSGBOX_NPC From 5483e05db65f2085fe8c4969eb3f1f9dcec3e1a0 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Thu, 5 Dec 2024 12:46:50 -0300 Subject: [PATCH 3/4] Fixed brace style inconsistencies --- src/AgbRfu_LinkManager.c | 2 ++ src/battle_anim_effects_1.c | 2 ++ src/battle_anim_effects_2.c | 4 +++ src/battle_anim_electric.c | 6 ++++ src/battle_anim_ghost.c | 2 ++ src/battle_anim_throw.c | 14 +++++++++ src/battle_controller_opponent.c | 12 ++++++-- src/battle_gfx_sfx_util.c | 8 +++++ src/battle_main.c | 34 ++++++++++++++++++++ src/battle_message.c | 6 ++++ src/battle_script_commands.c | 41 +++++++++++++++++++++---- src/battle_util.c | 10 ++++++ src/berry.c | 4 +++ src/berry_crush.c | 2 ++ src/bike.c | 2 ++ src/contest.c | 2 ++ src/contest_effect.c | 15 +++++++-- src/decompress.c | 12 ++++++++ src/evolution_graphics.c | 32 +++++++++++++++++++ src/field_camera.c | 2 ++ src/field_door.c | 2 ++ src/field_effect.c | 15 ++++++--- src/item_use.c | 12 ++++++++ src/librfu_sio32id.c | 2 ++ src/link_rfu_2.c | 11 +++++-- src/lottery_corner.c | 4 +++ src/mauville_old_man.c | 6 ++++ src/mini_printf.c | 18 ++++++----- src/party_menu.c | 2 ++ src/player_pc.c | 2 ++ src/pokedex.c | 6 ++++ src/pokemon.c | 15 ++++++++- src/pokenav_conditions_search_results.c | 10 ++++++ src/pokenav_menu_handler_gfx.c | 2 ++ src/slot_machine.c | 2 ++ src/sprite.c | 4 +++ src/tv.c | 3 +- 37 files changed, 301 insertions(+), 27 deletions(-) diff --git a/src/AgbRfu_LinkManager.c b/src/AgbRfu_LinkManager.c index d696c01d3c14..b53b69c48b44 100644 --- a/src/AgbRfu_LinkManager.c +++ b/src/AgbRfu_LinkManager.c @@ -59,7 +59,9 @@ void rfu_LMAN_REQ_sendData(bool8 clockChangeFlag) clockChangeFlag = FALSE; } else + { lman.parentAck_flag = 0; + } rfu_REQ_sendData(clockChangeFlag); } diff --git a/src/battle_anim_effects_1.c b/src/battle_anim_effects_1.c index 3a558969b55d..ee532f4134e2 100644 --- a/src/battle_anim_effects_1.c +++ b/src/battle_anim_effects_1.c @@ -4043,7 +4043,9 @@ static void AnimMilkBottle_Step1(struct Sprite *sprite) sprite->data[6]++; } else if (sprite->data[7] > 0) + { sprite->data[7]--; + } SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(sprite->data[6], sprite->data[7])); if (sprite->data[6] == 16 && sprite->data[7] == 0) diff --git a/src/battle_anim_effects_2.c b/src/battle_anim_effects_2.c index 3d2e72cacbff..bf7e774f6b3d 100644 --- a/src/battle_anim_effects_2.c +++ b/src/battle_anim_effects_2.c @@ -2209,7 +2209,9 @@ static void AnimTask_Splash_Step(u8 taskId) task->data[4] -= 2; } else + { task->data[1]++; + } break; case 3: if (!RunAffineAnimFromTaskData(task)) @@ -2956,7 +2958,9 @@ static void AnimTask_SpeedDust_Step(u8 taskId) task->data[8] = 1; } else + { task->data[8] = 2; + } } } break; diff --git a/src/battle_anim_electric.c b/src/battle_anim_electric.c index b6a82b8d9a1e..cc36e608f891 100644 --- a/src/battle_anim_electric.c +++ b/src/battle_anim_electric.c @@ -597,7 +597,9 @@ static void AnimZapCannonSpark_Step(struct Sprite *sprite) sprite->invisible ^= 1; } else + { DestroyAnimSprite(sprite); + } } static void AnimThunderboltOrb_Step(struct Sprite *sprite) @@ -870,7 +872,9 @@ static void AnimTask_ElectricChargingParticles_Step(u8 taskId) } } else if(task->data[7] == 0) + { DestroyAnimVisualTask(taskId); + } } static void AnimElectricChargingParticles_Step(struct Sprite *sprite) @@ -991,7 +995,9 @@ void AnimTask_VoltTackleAttackerReappear(u8 taskId) gSprites[task->data[15]].x2 = task->data[14]; } else + { task->data[0]++; + } } break; diff --git a/src/battle_anim_ghost.c b/src/battle_anim_ghost.c index d6afd4c304fe..6cb7da5c206d 100644 --- a/src/battle_anim_ghost.c +++ b/src/battle_anim_ghost.c @@ -280,7 +280,9 @@ static void AnimConfuseRayBallBounce_Step2(struct Sprite *sprite) sprite->callback = DestroyAnimSpriteAndDisableBlend; } else + { UpdateConfuseRayBallBlend(sprite); + } } static void UpdateConfuseRayBallBlend(struct Sprite *sprite) diff --git a/src/battle_anim_throw.c b/src/battle_anim_throw.c index 951794fc54c9..956020b30503 100755 --- a/src/battle_anim_throw.c +++ b/src/battle_anim_throw.c @@ -1147,7 +1147,9 @@ static void SpriteCB_Ball_Wobble_Step(struct Sprite *sprite) gBattleSpritesDataPtr->animationData->ballSubpx &= 0xFF; } else + { gBattleSpritesDataPtr->animationData->ballSubpx += 176; + } sprite->sTimer++; sprite->affineAnimPaused = FALSE; @@ -1172,7 +1174,9 @@ static void SpriteCB_Ball_Wobble_Step(struct Sprite *sprite) ChangeSpriteAffineAnim(sprite, BALL_ROTATE_RIGHT); } else + { sprite->affineAnimPaused = TRUE; + } break; case BALL_ROLL_2: if (gBattleSpritesDataPtr->animationData->ballSubpx > 255) @@ -1181,7 +1185,9 @@ static void SpriteCB_Ball_Wobble_Step(struct Sprite *sprite) gBattleSpritesDataPtr->animationData->ballSubpx &= 0xFF; } else + { gBattleSpritesDataPtr->animationData->ballSubpx += 176; + } sprite->sTimer++; sprite->affineAnimPaused = FALSE; @@ -1216,7 +1222,9 @@ static void SpriteCB_Ball_Wobble_Step(struct Sprite *sprite) gBattleSpritesDataPtr->animationData->ballSubpx &= 0xFF; } else + { gBattleSpritesDataPtr->animationData->ballSubpx += 176; + } sprite->sTimer++; sprite->affineAnimPaused = FALSE; @@ -1390,7 +1398,9 @@ static void SpriteCB_Ball_FadeOut(struct Sprite *sprite) static void DestroySpriteAfterOneFrame(struct Sprite *sprite) { if (sprite->sFrame == 0) + { sprite->sFrame = -1; + } else { FreeSpriteOamMatrix(sprite); @@ -1410,7 +1420,9 @@ static void MakeCaptureStars(struct Sprite *sprite) u8 subpriority; if (sprite->subpriority) + { subpriority = sprite->subpriority - 1; + } else { subpriority = 0; @@ -2358,7 +2370,9 @@ static void SpriteCB_ShinyStars_Diagonal(struct Sprite *sprite) { // Delayed four frames to de-sync from encircling stars if (sprite->sTimer < 4) + { sprite->sTimer++; + } else { sprite->invisible = FALSE; diff --git a/src/battle_controller_opponent.c b/src/battle_controller_opponent.c index dc3652b4575f..c01dcb442f69 100644 --- a/src/battle_controller_opponent.c +++ b/src/battle_controller_opponent.c @@ -257,7 +257,9 @@ static void Intro_WaitForShinyAnimAndHealthbox(void) FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS); } else + { return; + } } else if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim) { @@ -270,13 +272,17 @@ static void Intro_WaitForShinyAnimAndHealthbox(void) FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS); } else + { return; + } } - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim = FALSE; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim = FALSE; } else + { return; + } gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay = 3; gBattlerControllerFuncs[gActiveBattler] = Intro_DelayAndEnd; @@ -331,7 +337,9 @@ static void Intro_TryShinyAnimShowHealthbox(void) m4aMPlayContinue(&gMPlayInfo_BGM); } else + { m4aMPlayVolumeControl(&gMPlayInfo_BGM, TRACKS_ALL, 0x100); + } } gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].bgmRestored = TRUE; bgmRestored = TRUE; diff --git a/src/battle_gfx_sfx_util.c b/src/battle_gfx_sfx_util.c index ed8cf572ea71..2deced13c00d 100644 --- a/src/battle_gfx_sfx_util.c +++ b/src/battle_gfx_sfx_util.c @@ -773,13 +773,21 @@ bool8 BattleLoadAllHealthBoxesGfx(u8 state) LoadCompressedSpriteSheet(&sSpriteSheet_SinglesPlayerHealthbox); } else if (state == 3) + { LoadCompressedSpriteSheet(&sSpriteSheet_SinglesOpponentHealthbox); + } else if (state == 4) + { LoadCompressedSpriteSheet(&sSpriteSheets_HealthBar[gBattlerPositions[0]]); + } else if (state == 5) + { LoadCompressedSpriteSheet(&sSpriteSheets_HealthBar[gBattlerPositions[1]]); + } else + { retVal = TRUE; + } } else { diff --git a/src/battle_main.c b/src/battle_main.c index 7ee8d8cf55a3..25b1cfa8448c 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -1654,7 +1654,9 @@ static void CB2_HandleStartMultiBattle(void) gBattleCommunication[MULTIUSE_STATE]++; } else + { break; + } // fall through case 3: if (IsLinkTaskFinished()) @@ -3084,7 +3086,9 @@ static void BattleStartClearSetData(void) gHitMarker |= HITMARKER_NO_ANIMATIONS; } else if (!(gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED_LINK)) && GetBattleSceneInRecordedBattle()) + { gHitMarker |= HITMARKER_NO_ANIMATIONS; + } gBattleScripting.battleStyle = gSaveBlock2Ptr->optionsBattleStyle; @@ -3584,7 +3588,9 @@ static void BattleIntroPrintOpponentSendsOut(void) return; if (!(gBattleTypeFlags & BATTLE_TYPE_RECORDED)) + { position = B_POSITION_OPPONENT_LEFT; + } else if (gBattleTypeFlags & BATTLE_TYPE_RECORDED_LINK) { if (gBattleTypeFlags & BATTLE_TYPE_RECORDED_IS_MASTER) @@ -3593,7 +3599,9 @@ static void BattleIntroPrintOpponentSendsOut(void) position = B_POSITION_PLAYER_LEFT; } else + { position = B_POSITION_OPPONENT_LEFT; + } PrepareStringBattle(STRINGID_INTROSENDOUT, GetBattlerAtPosition(position)); gBattleMainFunc = BattleIntroOpponent1SendsOutMonAnimation; @@ -3604,7 +3612,9 @@ static void BattleIntroOpponent2SendsOutMonAnimation(void) u32 position; if (!(gBattleTypeFlags & BATTLE_TYPE_RECORDED)) + { position = B_POSITION_OPPONENT_RIGHT; + } else if (gBattleTypeFlags & BATTLE_TYPE_RECORDED_LINK) { if (gBattleTypeFlags & BATTLE_TYPE_RECORDED_IS_MASTER) @@ -3613,7 +3623,9 @@ static void BattleIntroOpponent2SendsOutMonAnimation(void) position = B_POSITION_PLAYER_RIGHT; } else + { position = B_POSITION_OPPONENT_RIGHT; + } for (gActiveBattler = 0; gActiveBattler < gBattlersCount; gActiveBattler++) { @@ -3641,10 +3653,14 @@ static void BattleIntroOpponent1SendsOutMonAnimation(void) position = B_POSITION_PLAYER_LEFT; } else + { position = B_POSITION_OPPONENT_LEFT; + } } else + { position = B_POSITION_OPPONENT_LEFT; + } if (gBattleControllerExecFlags) return; @@ -3699,7 +3715,9 @@ static void BattleIntroPrintPlayerSendsOut(void) u8 position; if (!(gBattleTypeFlags & BATTLE_TYPE_RECORDED)) + { position = B_POSITION_PLAYER_LEFT; + } else if (gBattleTypeFlags & BATTLE_TYPE_RECORDED_LINK) { if (gBattleTypeFlags & BATTLE_TYPE_RECORDED_IS_MASTER) @@ -3708,7 +3726,9 @@ static void BattleIntroPrintPlayerSendsOut(void) position = B_POSITION_OPPONENT_LEFT; } else + { position = B_POSITION_PLAYER_LEFT; + } if (!(gBattleTypeFlags & BATTLE_TYPE_SAFARI)) PrepareStringBattle(STRINGID_INTROSENDOUT, GetBattlerAtPosition(position)); @@ -3722,7 +3742,9 @@ static void BattleIntroPlayer2SendsOutMonAnimation(void) u32 position; if (!(gBattleTypeFlags & BATTLE_TYPE_RECORDED)) + { position = B_POSITION_PLAYER_RIGHT; + } else if (gBattleTypeFlags & BATTLE_TYPE_RECORDED_LINK) { if (gBattleTypeFlags & BATTLE_TYPE_RECORDED_IS_MASTER) @@ -3731,7 +3753,9 @@ static void BattleIntroPlayer2SendsOutMonAnimation(void) position = B_POSITION_OPPONENT_RIGHT; } else + { position = B_POSITION_PLAYER_RIGHT; + } for (gActiveBattler = 0; gActiveBattler < gBattlersCount; gActiveBattler++) { @@ -3754,7 +3778,9 @@ static void BattleIntroPlayer1SendsOutMonAnimation(void) u32 position; if (!(gBattleTypeFlags & BATTLE_TYPE_RECORDED)) + { position = B_POSITION_PLAYER_LEFT; + } else if (gBattleTypeFlags & BATTLE_TYPE_RECORDED_LINK) { if (gBattleTypeFlags & BATTLE_TYPE_RECORDED_IS_MASTER) @@ -3763,7 +3789,9 @@ static void BattleIntroPlayer1SendsOutMonAnimation(void) position = B_POSITION_OPPONENT_LEFT; } else + { position = B_POSITION_PLAYER_LEFT; + } if (gBattleControllerExecFlags) return; @@ -4678,7 +4706,9 @@ u8 GetWhoStrikesFirst(u8 battler1, u8 battler2, bool8 ignoreChosenMoves) moveBattler1 = gBattleMons[battler1].moves[*(gBattleStruct->chosenMovePositions + battler1)]; } else + { moveBattler1 = MOVE_NONE; + } if (gChosenActionByBattler[battler2] == B_ACTION_USE_MOVE) { @@ -4688,7 +4718,9 @@ u8 GetWhoStrikesFirst(u8 battler1, u8 battler2, bool8 ignoreChosenMoves) moveBattler2 = gBattleMons[battler2].moves[*(gBattleStruct->chosenMovePositions + battler2)]; } else + { moveBattler2 = MOVE_NONE; + } } // both move priorities are different than 0 @@ -4705,7 +4737,9 @@ u8 GetWhoStrikesFirst(u8 battler1, u8 battler2, bool8 ignoreChosenMoves) // else battler1 has more speed } else if (gBattleMoves[moveBattler1].priority < gBattleMoves[moveBattler2].priority) + { strikesFirst = 1; // battler2's move has greater priority + } // else battler1's move has greater priority } diff --git a/src/battle_message.c b/src/battle_message.c index e50fcff3de0b..d539bc540dcc 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -2350,7 +2350,9 @@ u32 BattleStringExpandPlaceholders(const u8 *src, u8 *dst) toCpy = gStringVar2; } else + { toCpy = gBattleTextBuff2; + } break; case B_TXT_BUFF3: if (gBattleTextBuff3[0] == B_BUFF_PLACEHOLDER_BEGIN) @@ -2359,7 +2361,9 @@ u32 BattleStringExpandPlaceholders(const u8 *src, u8 *dst) toCpy = gStringVar3; } else + { toCpy = gBattleTextBuff3; + } break; case B_TXT_COPY_VAR_1: toCpy = gStringVar1; @@ -2486,7 +2490,9 @@ u32 BattleStringExpandPlaceholders(const u8 *src, u8 *dst) toCpy = text; } else + { toCpy = sText_EnigmaBerry; + } } } else diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 6f43c6af706b..1891ea92857d 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -1769,7 +1769,9 @@ static void Cmd_attackanimation(void) gActiveBattler = gBattlerAttacker; if (gBattleMons[gBattlerTarget].status2 & STATUS2_SUBSTITUTE) + { multihit = gMultiHitCounter; + } else if (gMultiHitCounter != 0 && gMultiHitCounter != 1) { if (gBattleMons[gBattlerTarget].hp <= gBattleMoveDamage) @@ -1778,7 +1780,9 @@ static void Cmd_attackanimation(void) multihit = gMultiHitCounter; } else + { multihit = gMultiHitCounter; + } BtlController_EmitMoveAnimation(BUFFER_A, gCurrentMove, gBattleScripting.animTurn, gBattleMovePower, gBattleMoveDamage, gBattleMons[gBattlerAttacker].friendship, &gDisableStructs[gBattlerAttacker], multihit); gBattleScripting.animTurn++; @@ -2276,7 +2280,9 @@ void SetMoveEffect(bool8 primary, u8 certain) {} } else + { gActiveBattler = gBattlersCount; + } if (gBattleMons[gEffectBattler].status1) break; @@ -2409,7 +2415,9 @@ void SetMoveEffect(bool8 primary, u8 certain) RESET_RETURN } else + { break; + } } if (gBattleMons[gEffectBattler].status1) break; @@ -3111,7 +3119,9 @@ static void Cmd_jumpifability(void) gBattleScripting.battlerWithAbility = battlerId - 1; } else + { gBattlescriptCurrInstr += 7; + } } else if (gBattlescriptCurrInstr[1] == BS_NOT_ATTACKER_SIDE) { @@ -3124,7 +3134,9 @@ static void Cmd_jumpifability(void) gBattleScripting.battlerWithAbility = battlerId - 1; } else + { gBattlescriptCurrInstr += 7; + } } else { @@ -3137,7 +3149,9 @@ static void Cmd_jumpifability(void) gBattleScripting.battlerWithAbility = battlerId; } else + { gBattlescriptCurrInstr += 7; + } } } @@ -3387,13 +3401,10 @@ static void Cmd_getexp(void) { if (gBattlerPartyIndexes[2] == gBattleStruct->expGetterMonId && !(gAbsentBattlerFlags & gBitTable[2])) gBattleStruct->expGetterBattlerId = 2; + else if (!(gAbsentBattlerFlags & gBitTable[0])) + gBattleStruct->expGetterBattlerId = 0; else - { - if (!(gAbsentBattlerFlags & gBitTable[0])) - gBattleStruct->expGetterBattlerId = 0; - else - gBattleStruct->expGetterBattlerId = 2; - } + gBattleStruct->expGetterBattlerId = 2; } else { @@ -8558,11 +8569,17 @@ static void Cmd_presentdamagecalculation(void) s32 rand = Random() & 0xFF; if (rand < 102) + { gDynamicBasePower = 40; + } else if (rand < 178) + { gDynamicBasePower = 80; + } else if (rand < 204) + { gDynamicBasePower = 120; + } else { gBattleMoveDamage = gBattleMons[gBattlerTarget].maxHP / 4; @@ -8570,10 +8587,15 @@ static void Cmd_presentdamagecalculation(void) gBattleMoveDamage = 1; gBattleMoveDamage *= -1; } + if (rand < 204) + { gBattlescriptCurrInstr = BattleScript_HitFromCritCalc; + } else if (gBattleMons[gBattlerTarget].maxHP == gBattleMons[gBattlerTarget].hp) + { gBattlescriptCurrInstr = BattleScript_AlreadyAtFullHp; + } else { gMoveResultFlags &= ~MOVE_RESULT_DOESNT_AFFECT_FOE; @@ -8910,6 +8932,7 @@ static void Cmd_trydobeatup(void) && !GetMonData(&party[gBattleCommunication[0]], MON_DATA_STATUS)) break; } + if (gBattleCommunication[0] < PARTY_SIZE) { PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff1, gBattlerAttacker, gBattleCommunication[0]) @@ -8927,9 +8950,13 @@ static void Cmd_trydobeatup(void) gBattleCommunication[0]++; } else if (beforeLoop != 0) + { gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1); + } else + { gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 5); + } } } @@ -9907,7 +9934,9 @@ static void Cmd_handleballthrow(void) } } else + { ballMultiplier = sBallCatchBonuses[gLastUsedItem - ITEM_ULTRA_BALL]; + } odds = (catchRate * ballMultiplier / 10) * (gBattleMons[gBattlerTarget].maxHP * 3 - gBattleMons[gBattlerTarget].hp * 2) diff --git a/src/battle_util.c b/src/battle_util.c index d79c61b38253..6e201a2956a1 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -1336,9 +1336,13 @@ u8 DoFieldEndTurnEffects(void) gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_RAIN_STOPPED; } else if (gBattleWeather & B_WEATHER_RAIN_DOWNPOUR) + { gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_DOWNPOUR_CONTINUES; + } else + { gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_RAIN_CONTINUES; + } } else if (gBattleWeather & B_WEATHER_RAIN_DOWNPOUR) { @@ -3824,7 +3828,9 @@ u8 GetMoveTarget(u16 move, u8 setTarget) case MOVE_TARGET_SELECTED: side = BATTLE_OPPOSITE(GetBattlerSide(gBattlerAttacker)); if (gSideTimers[side].followmeTimer && gBattleMons[gSideTimers[side].followmeTarget].hp) + { targetBattler = gSideTimers[side].followmeTarget; + } else { side = GetBattlerSide(gBattlerAttacker); @@ -3853,7 +3859,9 @@ u8 GetMoveTarget(u16 move, u8 setTarget) case MOVE_TARGET_RANDOM: side = BATTLE_OPPOSITE(GetBattlerSide(gBattlerAttacker)); if (gSideTimers[side].followmeTimer && gBattleMons[gSideTimers[side].followmeTarget].hp) + { targetBattler = gSideTimers[side].followmeTarget; + } else if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && moveTarget & MOVE_TARGET_RANDOM) { if (GetBattlerSide(gBattlerAttacker) == B_SIDE_PLAYER) @@ -3874,7 +3882,9 @@ u8 GetMoveTarget(u16 move, u8 setTarget) targetBattler ^= BIT_FLANK; } else + { targetBattler = GetBattlerAtPosition(BATTLE_OPPOSITE(GET_BATTLER_SIDE(gBattlerAttacker))); + } break; case MOVE_TARGET_USER_OR_SELECTED: case MOVE_TARGET_USER: diff --git a/src/berry.c b/src/berry.c index 389a09a10644..543041e52687 100644 --- a/src/berry.c +++ b/src/berry.c @@ -980,7 +980,9 @@ bool32 IsEnigmaBerryValid(void) const struct Berry *GetBerryInfo(u8 berry) { if (berry == ITEM_TO_BERRY(ITEM_ENIGMA_BERRY) && IsEnigmaBerryValid()) + { return (struct Berry *)(&gSaveBlock1Ptr->enigmaBerry.berry); + } else { if (berry == BERRY_NONE || berry > ITEM_TO_BERRY(LAST_BERRY_INDEX)) @@ -1219,7 +1221,9 @@ static u8 CalcBerryYieldInternal(u16 max, u16 min, u8 water) u32 extraYield; if (water == 0) + { return min; + } else { randMin = (max - min) * (water - 1); diff --git a/src/berry_crush.c b/src/berry_crush.c index 05e708162d55..c7bff2abcdbe 100644 --- a/src/berry_crush.c +++ b/src/berry_crush.c @@ -3398,7 +3398,9 @@ static u32 Cmd_StopGame(struct BerryCrushGame *game, u8 *args) break; case 2: if (game->gfx.counter != 0) + { game->gfx.counter--; + } else { RunOrScheduleCommand(CMD_CLOSE_LINK, SCHEDULE_CMD, NULL); diff --git a/src/bike.c b/src/bike.c index ae9dfd3e9170..d8a3d1ab5221 100644 --- a/src/bike.c +++ b/src/bike.c @@ -372,7 +372,9 @@ static u8 AcroBikeHandleInputWheelieStanding(u8 *newDirection, u16 newKeys, u16 gPlayerAvatar.runningState = NOT_MOVING; if (heldKeys & B_BUTTON) + { gPlayerAvatar.bikeFrameCounter++; + } else { // B button was released. diff --git a/src/contest.c b/src/contest.c index 40a42a35292b..0615f7b50475 100644 --- a/src/contest.c +++ b/src/contest.c @@ -2667,7 +2667,9 @@ static void Task_EndAppeals(u8 taskId) CalculateFinalScores(); ContestClearGeneralTextWindow(); if (!(gLinkContestFlags & LINK_CONTEST_FLAG_IS_LINK)) + { BravoTrainerPokemonProfile_BeforeInterview1(eContestantStatus[gContestPlayerMonIndex].prevMove); + } else { CalculateContestLiveUpdateData(); diff --git a/src/contest_effect.c b/src/contest_effect.c index 24de8e169291..92cc5a169c49 100644 --- a/src/contest_effect.c +++ b/src/contest_effect.c @@ -619,15 +619,18 @@ static void ContestEffect_QualityDependsOnTiming(void) { appeal = 10; SetContestantEffectStringID(eContestAppealResults.contestant, CONTEST_STRING_APPEAL_NOT_VERY_WELL); - } else if (rval < 6) + } + else if (rval < 6) { appeal = 20; SetContestantEffectStringID(eContestAppealResults.contestant, CONTEST_STRING_APPEAL_SLIGHTLY_WELL2); - } else if (rval < 8) + } + else if (rval < 8) { appeal = 40; SetContestantEffectStringID(eContestAppealResults.contestant, CONTEST_STRING_APPEAL_PRETTY_WELL2); - } else if (rval < 9) + } + else if (rval < 9) { appeal = 60; SetContestantEffectStringID(eContestAppealResults.contestant, CONTEST_STRING_APPEAL_VERY_WELL); @@ -868,7 +871,9 @@ static void ContestEffect_ScrambleNextTurnOrder(void) break; } else + { rval--; + } } } } @@ -908,7 +913,9 @@ static void ContestEffect_BadlyStartleMonsWithGoodAppeals(void) eContestAppealResults.jam = RoundUp(eContestAppealResults.jam); } else + { eContestAppealResults.jam = 10; + } eContestAppealResults.jamQueue[0] = i; eContestAppealResults.jamQueue[1] = CONTESTANT_NONE; if (WasAtLeastOneOpponentJammed()) @@ -1071,7 +1078,9 @@ static s16 RoundTowardsZero(s16 score) score -= 10 - absScore; } else + { score -= absScore; + } return score; } diff --git a/src/decompress.c b/src/decompress.c index 55807e89bb05..491ae8587f77 100644 --- a/src/decompress.c +++ b/src/decompress.c @@ -100,9 +100,13 @@ void LoadSpecialPokePic(const struct CompressedSpriteSheet *src, void *dest, s32 LZ77UnCompWram(gMonFrontPicTable[i].data, dest); } else if (species > NUM_SPECIES) // is species unknown? draw the ? icon + { LZ77UnCompWram(gMonFrontPicTable[0].data, dest); + } else + { LZ77UnCompWram(src->data, dest); + } DuplicateDeoxysTiles(dest, species); DrawSpindaSpots(species, personality, dest, isFrontPic); @@ -327,9 +331,13 @@ void LoadSpecialPokePic_2(const struct CompressedSpriteSheet *src, void *dest, s LZ77UnCompWram(gMonFrontPicTable[i].data, dest); } else if (species > NUM_SPECIES) // is species unknown? draw the ? icon + { LZ77UnCompWram(gMonFrontPicTable[0].data, dest); + } else + { LZ77UnCompWram(src->data, dest); + } DuplicateDeoxysTiles(dest, species); DrawSpindaSpots(species, personality, dest, isFrontPic); @@ -385,9 +393,13 @@ void LoadSpecialPokePic_DontHandleDeoxys(const struct CompressedSpriteSheet *src LZ77UnCompWram(gMonFrontPicTable[i].data, dest); } else if (species > NUM_SPECIES) // is species unknown? draw the ? icon + { LZ77UnCompWram(gMonFrontPicTable[0].data, dest); + } else + { LZ77UnCompWram(src->data, dest); + } DrawSpindaSpots(species, personality, dest, isFrontPic); } diff --git a/src/evolution_graphics.c b/src/evolution_graphics.c index 96ff1b52df80..1568c18d5fba 100644 --- a/src/evolution_graphics.c +++ b/src/evolution_graphics.c @@ -150,7 +150,9 @@ static void SpriteCB_Sparkle_SpiralUpward(struct Sprite *sprite) sprite->oam.matrixNum = matrixNum; } else + { DestroySprite(sprite); + } } static void CreateSparkle_SpiralUpward(u8 trigIdx) @@ -178,7 +180,9 @@ static void SpriteCB_Sparkle_ArcDown(struct Sprite *sprite) sprite->sTimer++; } else + { DestroySprite(sprite); + } } static void CreateSparkle_ArcDown(u8 trigIdx) @@ -206,7 +210,9 @@ static void SpriteCB_Sparkle_CircleInward(struct Sprite *sprite) sprite->sTrigIdx += 4; } else + { DestroySprite(sprite); + } } static void CreateSparkle_CircleInward(u8 trigIdx, u8 speed) @@ -238,7 +244,9 @@ static void SpriteCB_Sparkle_Spray(struct Sprite *sprite) sprite->sTrigIdx++; matrixNum = 31 - (sprite->sTrigIdx * 12 / 128); if (sprite->sTrigIdx > 64) + { sprite->subpriority = 1; + } else { sprite->invisible = FALSE; @@ -252,7 +260,9 @@ static void SpriteCB_Sparkle_Spray(struct Sprite *sprite) sprite->sTimer++; } else + { DestroySprite(sprite); + } } static void CreateSparkle_Spray(u8 id) @@ -348,7 +358,9 @@ static void Task_Sparkles_ArcDown(u8 taskId) gTasks[taskId].tTimer++; } else + { gTasks[taskId].func = Task_Sparkles_ArcDown_End; + } } static void Task_Sparkles_ArcDown_End(u8 taskId) @@ -388,7 +400,9 @@ static void Task_Sparkles_CircleInward(u8 taskId) gTasks[taskId].tTimer++; } else + { gTasks[taskId].func = Task_Sparkles_CircleInward_End; + } } static void Task_Sparkles_CircleInward_End(u8 taskId) @@ -437,7 +451,9 @@ static void Task_Sparkles_SprayAndFlash(u8 taskId) gTasks[taskId].tTimer++; } else + { gTasks[taskId].func = Task_Sparkles_SprayAndFlash_End; + } } static void Task_Sparkles_SprayAndFlash_End(u8 taskId) @@ -486,7 +502,9 @@ static void Task_Sparkles_SprayAndFlashTrade(u8 taskId) gTasks[taskId].tTimer++; } else + { gTasks[taskId].func = Task_Sparkles_SprayAndFlash_End; + } } #undef tTimer @@ -560,9 +578,13 @@ static void Task_CycleEvolutionMonSprite_Init(u8 taskId) static void Task_CycleEvolutionMonSprite_TryEnd(u8 taskId) { if (gTasks[taskId].tEvoStopped) + { EndOnPreEvoMon(taskId); + } else if (gTasks[taskId].tScaleSpeed == 128) + { EndOnPostEvoMon(taskId); + } else { gTasks[taskId].tScaleSpeed += 2; @@ -574,7 +596,9 @@ static void Task_CycleEvolutionMonSprite_TryEnd(u8 taskId) static void Task_CycleEvolutionMonSprite_UpdateSize(u8 taskId) { if (gTasks[taskId].tEvoStopped) + { gTasks[taskId].func = EndOnPreEvoMon; + } else { u16 oamMatrixArg; @@ -583,7 +607,9 @@ static void Task_CycleEvolutionMonSprite_UpdateSize(u8 taskId) { // Set pre-evo sprite growth if (gTasks[taskId].tPreEvoScale < MON_MAX_SCALE - gTasks[taskId].tScaleSpeed) + { gTasks[taskId].tPreEvoScale += gTasks[taskId].tScaleSpeed; + } else { gTasks[taskId].tPreEvoScale = MON_MAX_SCALE; @@ -592,7 +618,9 @@ static void Task_CycleEvolutionMonSprite_UpdateSize(u8 taskId) // Set post-evo sprite shrink if (gTasks[taskId].tPostEvoScale > MON_MIN_SCALE + gTasks[taskId].tScaleSpeed) + { gTasks[taskId].tPostEvoScale -= gTasks[taskId].tScaleSpeed; + } else { gTasks[taskId].tPostEvoScale = MON_MIN_SCALE; @@ -603,7 +631,9 @@ static void Task_CycleEvolutionMonSprite_UpdateSize(u8 taskId) { // Set post-evo sprite growth if (gTasks[taskId].tPostEvoScale < MON_MAX_SCALE - gTasks[taskId].tScaleSpeed) + { gTasks[taskId].tPostEvoScale += gTasks[taskId].tScaleSpeed; + } else { gTasks[taskId].tPostEvoScale = MON_MAX_SCALE; @@ -612,7 +642,9 @@ static void Task_CycleEvolutionMonSprite_UpdateSize(u8 taskId) // Set pre-evo sprite shrink if (gTasks[taskId].tPreEvoScale > MON_MIN_SCALE + gTasks[taskId].tScaleSpeed) + { gTasks[taskId].tPreEvoScale -= gTasks[taskId].tScaleSpeed; + } else { gTasks[taskId].tPreEvoScale = MON_MIN_SCALE; diff --git a/src/field_camera.c b/src/field_camera.c index 290ddddaf178..e76ba3d855cd 100644 --- a/src/field_camera.c +++ b/src/field_camera.c @@ -231,7 +231,9 @@ static void DrawMetatileAt(const struct MapLayout *mapLayout, u16 offset, int x, if (metatileId > NUM_METATILES_TOTAL) metatileId = 0; if (metatileId < NUM_METATILES_IN_PRIMARY) + { metatiles = mapLayout->primaryTileset->metatiles; + } else { metatiles = mapLayout->secondaryTileset->metatiles; diff --git a/src/field_door.c b/src/field_door.c index 255233ec2346..908a65a453ea 100644 --- a/src/field_door.c +++ b/src/field_door.c @@ -437,7 +437,9 @@ static const struct DoorGraphics *GetDoorGraphics(const struct DoorGraphics *gfx static s8 StartDoorAnimationTask(const struct DoorGraphics *gfx, const struct DoorAnimFrame *frames, u32 x, u32 y) { if (FuncIsActiveTask(Task_AnimateDoor) == TRUE) + { return -1; + } else { u8 taskId = CreateTask(Task_AnimateDoor, 0x50); diff --git a/src/field_effect.c b/src/field_effect.c index d907c3f16da3..5dcc4b3c080e 100644 --- a/src/field_effect.c +++ b/src/field_effect.c @@ -1293,7 +1293,8 @@ static void CreateHofMonitorSprite(s16 taskId, s16 x, s16 y, bool8 isSmallMonito { spriteId = CreateSpriteAtEnd(&sSpriteTemplate_HofMonitorBig, x, y, 0); SetSubspriteTables(&gSprites[spriteId], &sSubspriteTable_HofMonitorBig); - } else + } + else { spriteId = CreateSpriteAtEnd(&sSpriteTemplate_HofMonitorSmall, x, y, 0); } @@ -2003,7 +2004,8 @@ static bool8 LavaridgeGymB1FWarpEffect_Rise(struct Task *task, struct ObjectEven { task->data[1] <<= 1; } - } else if (!(task->data[2] & 4) && (task->data[1] > 0)) + } + else if (!(task->data[2] & 4) && (task->data[1] > 0)) { task->data[1] >>= 1; } @@ -2017,7 +2019,8 @@ static bool8 LavaridgeGymB1FWarpEffect_Rise(struct Task *task, struct ObjectEven { task->data[3]++; } - } else + } + else { task->data[4] = 1; } @@ -2169,7 +2172,8 @@ static bool8 LavaridgeGym1FWarpEffect_AshPuff(struct Task *task, struct ObjectEv gFieldEffectArguments[3] = sprite->oam.priority; task->data[1] = FieldEffectStart(FLDEFF_ASH_PUFF); task->data[0]++; - } else + } + else { task->data[1]++; ObjectEventSetHeldMovement(objectEvent, GetWalkInPlaceFasterMovementAction(objectEvent->facingDirection)); @@ -2499,7 +2503,8 @@ static void TeleportWarpInFieldEffect_SpinEnter(struct Task *task) objectEvent->triggerGroundEffectsOnMove = TRUE; sprite->subspriteMode = task->data[14]; } - } else + } + else { sprite->oam.priority = 1; if (sprite->subspriteMode != SUBSPRITES_OFF) diff --git a/src/item_use.c b/src/item_use.c index abd80e0eae3b..322eaf76c072 100755 --- a/src/item_use.c +++ b/src/item_use.c @@ -122,7 +122,9 @@ static void SetUpItemUseOnFieldCallback(u8 taskId) SetUpItemUseCallback(taskId); } else + { sItemUseOnFieldCB(taskId); + } } static void FieldCB_UseItemOnField(void) @@ -148,7 +150,9 @@ static void DisplayCannotUseItemMessage(u8 taskId, bool8 isUsingRegisteredKeyIte DisplayItemMessageInBattlePyramid(taskId, gText_DadsAdvice, Task_CloseBattlePyramidBagMessage); } else + { DisplayItemMessageOnField(taskId, gStringVar4, Task_CloseCantUseKeyItemMessage); + } } static void DisplayDadsAdviceCannotUseItemMessage(u8 taskId, bool8 isUsingRegisteredKeyItemOnField) @@ -202,7 +206,9 @@ void ItemUseOutOfBattle_Bike(u8 taskId) PlayerGetDestCoords(&coordsX, &coordsY); behavior = MapGridGetMetatileBehaviorAt(coordsX, coordsY); if (FlagGet(FLAG_SYS_CYCLING_ROAD) == TRUE || MetatileBehavior_IsVerticalRail(behavior) == TRUE || MetatileBehavior_IsHorizontalRail(behavior) == TRUE || MetatileBehavior_IsIsolatedVerticalRail(behavior) == TRUE || MetatileBehavior_IsIsolatedHorizontalRail(behavior) == TRUE) + { DisplayCannotDismountBikeMessage(taskId, tUsingRegisteredKeyItem); + } else { if (Overworld_IsBikingAllowed() == TRUE && IsBikingDisallowedByPlayer() == 0) @@ -211,7 +217,9 @@ void ItemUseOutOfBattle_Bike(u8 taskId) SetUpItemUseOnFieldCallback(taskId); } else + { DisplayDadsAdviceCannotUseItemMessage(taskId, tUsingRegisteredKeyItem); + } } } @@ -264,7 +272,9 @@ void ItemUseOutOfBattle_Rod(u8 taskId) SetUpItemUseOnFieldCallback(taskId); } else + { DisplayDadsAdviceCannotUseItemMessage(taskId, gTasks[taskId].tUsingRegisteredKeyItem); + } } static void ItemUseOnFieldCB_Rod(u8 taskId) @@ -951,7 +961,9 @@ void ItemUseInBattle_PokeBall(u8 taskId) DisplayItemMessage(taskId, FONT_NORMAL, gText_BoxFull, CloseItemMessage); } else + { DisplayItemMessageInBattlePyramid(taskId, gText_BoxFull, Task_CloseBattlePyramidBagMessage); + } } static void Task_CloseStatIncreaseMessage(u8 taskId) diff --git a/src/librfu_sio32id.c b/src/librfu_sio32id.c index 32391d781c43..c40bb825b3e1 100644 --- a/src/librfu_sio32id.c +++ b/src/librfu_sio32id.c @@ -145,7 +145,9 @@ static void Sio32IDIntr(void) } } else + { gRfuSIO32Id.lastId = regSIODATA32; + } } else { diff --git a/src/link_rfu_2.c b/src/link_rfu_2.c index 4c4323c1edc7..6b20cf967814 100644 --- a/src/link_rfu_2.c +++ b/src/link_rfu_2.c @@ -1175,7 +1175,9 @@ static void RfuHandleReceiveCommand(u8 unused) gRfu.numBlocksReceived[i] = 0; } else + { gRfu.numBlocksReceived[i]++; + } } } } @@ -1302,7 +1304,9 @@ bool32 Rfu_InitBlockSend(const u8 *src, size_t size) gRfu.sendBlock.count = (size / 12) + r4; gRfu.sendBlock.next = 0; if (size > BLOCK_BUFFER_SIZE) + { gRfu.sendBlock.payload = src; + } else { if (src != gBlockSendBuffer) @@ -1629,9 +1633,8 @@ static bool8 CheckForLeavingGroupMembers(void) } else if (gRfuSlotStatusNI[gRfu.childSlot]->recv.state == SLOT_STATE_RECV_FAILED) - rfu_clearSlot(TYPE_NI_RECV, i); { - + rfu_clearSlot(TYPE_NI_RECV, i); } } } @@ -1777,7 +1780,9 @@ static void Task_PlayerExchange(u8 taskId) gTasks[taskId].tState = 101; } else + { gTasks[taskId].tState = 2; + } break; case 101: if (gSendCmd[0] == 0) @@ -1798,7 +1803,9 @@ static void Task_PlayerExchange(u8 taskId) } } else + { gTasks[taskId].tState++; + } break; case 4: if (AreAllPlayersFinishedReceiving()) diff --git a/src/lottery_corner.c b/src/lottery_corner.c index 052e2cfc382b..117a5d633195 100644 --- a/src/lottery_corner.c +++ b/src/lottery_corner.c @@ -76,7 +76,9 @@ void PickLotteryCornerTicket(void) } } 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; + } } for (i = 0; i < TOTAL_BOXES_COUNT; i++) @@ -134,7 +136,9 @@ static u8 GetMatchingDigits(u16 winNumber, u16 otId) matchingDigits++; } else + { break; + } } return matchingDigits; } diff --git a/src/mauville_old_man.c b/src/mauville_old_man.c index dda6e6bffaf7..7338afb94b22 100644 --- a/src/mauville_old_man.c +++ b/src/mauville_old_man.c @@ -481,7 +481,9 @@ static void BardSing(struct Task *task, struct BardSong *song) GetWordPhonemes(song, MACRO1(word)); song->currWord++; if (song->sound->songLengthId != 0xFF) + { song->state = 0; + } else { song->state = 3; @@ -531,7 +533,9 @@ static void BardSing(struct Task *task, struct BardSong *song) { song->currPhoneme++; if (song->currPhoneme != 6 && song->sound[song->currPhoneme].songLengthId != 0xFF) + { song->state = 0; + } else { song->state = 3; @@ -850,7 +854,9 @@ void SanitizeReceivedRubyOldMan(union OldMan * oldMan, u32 version, u32 language trader->language[i] = LANGUAGE_JAPANESE; } else + { trader->language[i] = language; + } } } else diff --git a/src/mini_printf.c b/src/mini_printf.c index e4b893724284..17665cdf06c2 100644 --- a/src/mini_printf.c +++ b/src/mini_printf.c @@ -167,9 +167,9 @@ static s32 _putsEncoded(char *s, s32 len, void *buf) static s32 mini_strlen(const char *s) { - s32 len = 0; - while (s[len] != '\0') len++; - return len; + s32 len = 0; + while (s[len] != '\0') len++; + return len; } static s32 mini_itoa(s32 value, u32 radix, s32 uppercase, bool32 unsig, char *buffer) @@ -274,7 +274,8 @@ s32 mini_vpprintf(void* buf, const char *fmt, va_list va) { len = 1; len = _putsAscii(&ch, len, buf); - } else + } + else { char pad_char = ' '; s32 pad_to = 0; @@ -310,7 +311,8 @@ s32 mini_vpprintf(void* buf, const char *fmt, va_list va) if(l) { len = mini_itoa(va_arg(va, u32), 10, 0, (ch=='u'), bf2); - } else + } + else { if(ch == 'u') { @@ -352,7 +354,8 @@ s32 mini_vpprintf(void* buf, const char *fmt, va_list va) { len = mini_pad(ptr, len, pad_char, pad_to, bf); len = _putsAscii(bf, len, buf); - } else + } + else { len = _putsAscii(ptr, len, buf); } @@ -364,7 +367,8 @@ s32 mini_vpprintf(void* buf, const char *fmt, va_list va) { len = mini_pad(ptr, len, pad_char, pad_to, bf); len = _putsEncoded(bf, len, buf); - } else + } + else { len = _putsEncoded(ptr, len, buf); } diff --git a/src/party_menu.c b/src/party_menu.c index 56625d09a3f9..cbd469713a93 100755 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -4800,7 +4800,9 @@ static void Task_LearnNextMoveOrClosePartyMenu(u8 taskId) if (IsFanfareTaskInactive() && ((JOY_NEW(A_BUTTON)) || (JOY_NEW(B_BUTTON)))) { if (gPartyMenu.learnMoveState == 1) + { Task_TryLearningNextMove(taskId); + } else { if (gPartyMenu.learnMoveState == 2) // never occurs diff --git a/src/player_pc.c b/src/player_pc.c index 009aa7810f79..81170a86c920 100644 --- a/src/player_pc.c +++ b/src/player_pc.c @@ -880,7 +880,9 @@ static void Mailbox_CancelMoveToBag(u8 taskId) static void Mailbox_Give(u8 taskId) { if (CalculatePlayerPartyCount() == 0) + { Mailbox_NoPokemonForMail(taskId); + } else { FadeScreen(FADE_TO_BLACK, 0); diff --git a/src/pokedex.c b/src/pokedex.c index c0b20bf9d6b3..030020df8913 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -2396,7 +2396,9 @@ static void CreateMonListEntry(u8 position, u16 b, u16 ignored) if (vOffset >= LIST_SCROLL_STEP) vOffset -= LIST_SCROLL_STEP; if (entryNum < 0 || entryNum >= NATIONAL_DEX_COUNT || sPokedexView->pokedexList[entryNum].dexNum == 0xFFFF) + { ClearMonListEntry(17, vOffset * 2, ignored); + } else { ClearMonListEntry(17, vOffset * 2, ignored); @@ -2685,7 +2687,9 @@ static bool8 TryDoInfoScreenScroll(void) } if (sPokedexView->selectedPokemon == selectedPokemon) + { return FALSE; + } else { sPokedexView->selectedPokemon = selectedPokemon; @@ -2708,7 +2712,9 @@ static bool8 TryDoInfoScreenScroll(void) } if (sPokedexView->selectedPokemon == selectedPokemon) + { return FALSE; + } else { sPokedexView->selectedPokemon = selectedPokemon; diff --git a/src/pokemon.c b/src/pokemon.c index d59f46ada1be..e98182b0ae3b 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -2874,8 +2874,11 @@ void CalculateMonStats(struct Pokemon *mon) else { if (currentHP == 0 && oldMaxHP == 0) + { currentHP = newMaxHP; - else if (currentHP != 0) { + } + else if (currentHP != 0) + { // BUG: currentHP is unintentionally able to become <= 0 after the instruction below. This causes the pomeg berry glitch. currentHP += newMaxHP - oldMaxHP; #ifdef BUGFIX @@ -2884,7 +2887,9 @@ void CalculateMonStats(struct Pokemon *mon) #endif } else + { return; + } } SetMonData(mon, MON_DATA_HP, ¤tHP); @@ -6394,11 +6399,17 @@ void ClearBattleMonForms(void) u16 GetBattleBGM(void) { if (gBattleTypeFlags & BATTLE_TYPE_KYOGRE_GROUDON) + { return MUS_VS_KYOGRE_GROUDON; + } else if (gBattleTypeFlags & BATTLE_TYPE_REGI) + { return MUS_VS_REGI; + } else if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED_LINK)) + { return MUS_VS_TRAINER; + } else if (gBattleTypeFlags & BATTLE_TYPE_TRAINER) { u8 trainerClass; @@ -6445,7 +6456,9 @@ u16 GetBattleBGM(void) } } else + { return MUS_VS_WILD; + } } void PlayBattleBGM(void) diff --git a/src/pokenav_conditions_search_results.c b/src/pokenav_conditions_search_results.c index 181739802004..e42f35481bb3 100644 --- a/src/pokenav_conditions_search_results.c +++ b/src/pokenav_conditions_search_results.c @@ -184,13 +184,21 @@ static bool32 HandleConditionSearchInput_WaitSetup(struct Pokenav_SearchResults static u32 HandleConditionSearchInput(struct Pokenav_SearchResults *menu) { if (JOY_REPEAT(DPAD_UP)) + { return CONDITION_SEARCH_FUNC_MOVE_UP; + } else if (JOY_REPEAT(DPAD_DOWN)) + { return CONDITION_SEARCH_FUNC_MOVE_DOWN; + } else if (JOY_NEW(DPAD_LEFT)) + { return CONDITION_SEARCH_FUNC_PAGE_UP; + } else if (JOY_NEW(DPAD_RIGHT)) + { return CONDITION_SEARCH_FUNC_PAGE_DOWN; + } else if (JOY_NEW(B_BUTTON)) { // Exiting back to main search menu @@ -207,7 +215,9 @@ static u32 HandleConditionSearchInput(struct Pokenav_SearchResults *menu) return CONDITION_SEARCH_FUNC_SELECT_MON; } else + { return CONDITION_SEARCH_FUNC_NONE; + } } static u32 ReturnToConditionSearchList(struct Pokenav_SearchResults *menu) diff --git a/src/pokenav_menu_handler_gfx.c b/src/pokenav_menu_handler_gfx.c index ede88affdbee..e223b7caba31 100644 --- a/src/pokenav_menu_handler_gfx.c +++ b/src/pokenav_menu_handler_gfx.c @@ -505,7 +505,9 @@ static u32 LoopedTask_OpenMenu(s32 state) ShowBg(2); ShowBg(3); if (gfx->pokenavAlreadyOpen) + { PokenavFadeScreen(POKENAV_FADE_FROM_BLACK); + } else { PlaySE(SE_POKENAV_ON); diff --git a/src/slot_machine.c b/src/slot_machine.c index 34c7ef8849f2..217767fc9e98 100644 --- a/src/slot_machine.c +++ b/src/slot_machine.c @@ -2324,7 +2324,9 @@ static bool8 ReelTask_MoveToStop(struct Task *task) memcpy(reelStopShocks, sReelStopShocks, sizeof(sReelStopShocks)); reelPixelPos = sSlotMachine->reelPixelOffsets[task->tReelId] % REEL_SYMBOL_HEIGHT; if (reelPixelPos != 0) + { reelPixelPos = AdvanceSlotReelToNextSymbol(task->tReelId, sSlotMachine->reelSpeed); + } else if (sSlotMachine->reelExtraTurns[task->tReelId]) { sSlotMachine->reelExtraTurns[task->tReelId]--; diff --git a/src/sprite.c b/src/sprite.c index 0736269be0a3..d11277400ff2 100644 --- a/src/sprite.c +++ b/src/sprite.c @@ -1090,9 +1090,13 @@ void ContinueAffineAnim(struct Sprite *sprite) u8 matrixNum = GetSpriteMatrixNum(sprite); if (sAffineAnimStates[matrixNum].delayCounter) + { AffineAnimDelay(matrixNum, sprite); + } else if (sprite->affineAnimPaused) + { return; + } else { s16 type; diff --git a/src/tv.c b/src/tv.c index 9ab9fc8969a4..26d568642f99 100644 --- a/src/tv.c +++ b/src/tv.c @@ -5364,7 +5364,8 @@ static void DoTVShow3CheersForPokeblocks(void) if (show->threeCheers.sheen > 24) { StringCopy(gStringVar2, gText_Excellent); - } else if (show->threeCheers.sheen > 22) + } + else if (show->threeCheers.sheen > 22) { StringCopy(gStringVar2, gText_VeryGood); } From 861c579c11d995c1f5d3c7d3c591988935913697 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Fri, 13 Dec 2024 23:39:51 +0100 Subject: [PATCH 4/4] remove sBirchSpeechPlatformBlackPal (#2075) --- graphics/birch_speech/bg2.pal | 10 +++++++++- src/main_menu.c | 3 +-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/graphics/birch_speech/bg2.pal b/graphics/birch_speech/bg2.pal index 3457f9b4557d..33f619ee4490 100644 --- a/graphics/birch_speech/bg2.pal +++ b/graphics/birch_speech/bg2.pal @@ -1,6 +1,6 @@ JASC-PAL 0100 -8 +16 255 255 164 255 255 106 222 222 90 @@ -9,3 +9,11 @@ JASC-PAL 123 123 49 90 90 32 57 57 16 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 diff --git a/src/main_menu.c b/src/main_menu.c index 6a6ee9955730..10b34728b364 100644 --- a/src/main_menu.c +++ b/src/main_menu.c @@ -255,7 +255,6 @@ static const u16 sBirchSpeechBgPals[][16] = { static const u32 sBirchSpeechShadowGfx[] = INCBIN_U32("graphics/birch_speech/shadow.4bpp.lz"); static const u32 sBirchSpeechBgMap[] = INCBIN_U32("graphics/birch_speech/map.bin.lz"); static const u16 sBirchSpeechBgGradientPal[] = INCBIN_U16("graphics/birch_speech/bg2.gbapal"); -static const u16 sBirchSpeechPlatformBlackPal[] = {RGB_BLACK, RGB_BLACK, RGB_BLACK, RGB_BLACK, RGB_BLACK, RGB_BLACK, RGB_BLACK, RGB_BLACK}; #define MENU_LEFT 2 #define MENU_TOP_WIN0 1 @@ -1278,7 +1277,7 @@ static void Task_NewGameBirchSpeech_Init(u8 taskId) LZ77UnCompVram(sBirchSpeechShadowGfx, (void *)VRAM); LZ77UnCompVram(sBirchSpeechBgMap, (void *)(BG_SCREEN_ADDR(7))); LoadPalette(sBirchSpeechBgPals, BG_PLTT_ID(0), 2 * PLTT_SIZE_4BPP); - LoadPalette(sBirchSpeechPlatformBlackPal, BG_PLTT_ID(0) + 1, PLTT_SIZEOF(8)); + LoadPalette(&sBirchSpeechBgGradientPal[8], BG_PLTT_ID(0) + 1, PLTT_SIZEOF(8)); ScanlineEffect_Stop(); ResetSpriteData(); FreeAllSpritePalettes();