diff --git a/asm/macros/event.inc b/asm/macros/event.inc index ede71eb19b6d..1a0177970257 100644 --- a/asm/macros/event.inc +++ b/asm/macros/event.inc @@ -1226,6 +1226,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 27c8cc1e700d..507a6352d36d 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_DEFENSE .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 9189df1f5098..8375f9b82ac3 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 751835caab5d..f7028c20f8cb 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 6618b6a6a3ee..cfe97d5e1fd4 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_DEFENSE - .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 acae50929d5c..54ca3aa6d87d 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_DEFENSE .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_DEFENSE .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 54b2dacef1ff..fec03cc681d6 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 65cc71babac5..50acba60b4dc 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_DEFENSE - .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_DEFENSE - .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 618f78c524b1..7b3171f67fd0 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_DEFENSE .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 efc63d656162..4efceaa1cccd 100644 --- a/data/maps/TrainerHill_Entrance/scripts.inc +++ b/data/maps/TrainerHill_Entrance/scripts.inc @@ -267,9 +267,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 @@ -291,9 +289,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 c809d6703ae5..3c6f77b3a5d3 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_SP_ATK .2byte ITEM_FLUFFY_TAIL - .2byte ITEM_NONE - release - end + pokemartlistend VerdanturfTown_Mart_EventScript_Boy:: msgbox VerdanturfTown_Mart_Text_XSpecialIsCrucial, MSGBOX_NPC 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/include/recorded_battle.h b/include/recorded_battle.h index c64a665b74fe..0945eefe9240 100644 --- a/include/recorded_battle.h +++ b/include/recorded_battle.h @@ -2,6 +2,7 @@ #define GUARD_RECORDED_BATTLE_H #include "constants/battle.h" +#include "link.h" #include "random.h" #define BATTLER_RECORD_SIZE 664 @@ -10,13 +11,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]; rng_value_t rngSeed; u32 battleFlags; - u8 playersBattlers[MAX_BATTLERS_COUNT]; + u8 playersBattlers[MAX_LINK_PLAYERS]; u16 opponentA; u16 opponentB; u16 partnerId; 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 da0faed03277..826586cf9bbb 100644 --- a/src/battle_anim_effects_1.c +++ b/src/battle_anim_effects_1.c @@ -5413,7 +5413,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 0a94cad2dc53..e751a1ca5125 100755 --- a/src/battle_anim_effects_2.c +++ b/src/battle_anim_effects_2.c @@ -2266,7 +2266,9 @@ static void AnimTask_Splash_Step(u8 taskId) task->data[4] -= 2; } else + { task->data[1]++; + } break; case 3: if (!RunAffineAnimFromTaskData(task)) @@ -3023,7 +3025,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 64114227e17f..6deb4667bbd6 100644 --- a/src/battle_anim_electric.c +++ b/src/battle_anim_electric.c @@ -731,7 +731,9 @@ static void AnimZapCannonSpark_Step(struct Sprite *sprite) sprite->invisible ^= 1; } else + { DestroyAnimSprite(sprite); + } } static void AnimThunderboltOrb_Step(struct Sprite *sprite) @@ -1013,7 +1015,9 @@ static void AnimTask_ElectricChargingParticles_Step(u8 taskId) } } else if(task->data[7] == 0) + { DestroyAnimVisualTask(taskId); + } } static void AnimElectricChargingParticles_Step(struct Sprite *sprite) @@ -1134,7 +1138,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 e583e446350a..f848cd794aa2 100644 --- a/src/battle_anim_ghost.c +++ b/src/battle_anim_ghost.c @@ -346,7 +346,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 611d12be562a..a8c6e4077edc 100644 --- a/src/battle_anim_throw.c +++ b/src/battle_anim_throw.c @@ -1339,7 +1339,9 @@ static void SpriteCB_Ball_Wobble_Step(struct Sprite *sprite) gBattleSpritesDataPtr->animationData->ballSubpx &= 0xFF; } else + { gBattleSpritesDataPtr->animationData->ballSubpx += 176; + } sprite->sTimer++; sprite->affineAnimPaused = FALSE; @@ -1364,7 +1366,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) @@ -1373,7 +1377,9 @@ static void SpriteCB_Ball_Wobble_Step(struct Sprite *sprite) gBattleSpritesDataPtr->animationData->ballSubpx &= 0xFF; } else + { gBattleSpritesDataPtr->animationData->ballSubpx += 176; + } sprite->sTimer++; sprite->affineAnimPaused = FALSE; @@ -1408,7 +1414,9 @@ static void SpriteCB_Ball_Wobble_Step(struct Sprite *sprite) gBattleSpritesDataPtr->animationData->ballSubpx &= 0xFF; } else + { gBattleSpritesDataPtr->animationData->ballSubpx += 176; + } sprite->sTimer++; sprite->affineAnimPaused = FALSE; @@ -1598,7 +1606,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); @@ -1618,7 +1628,9 @@ static void MakeCaptureStars(struct Sprite *sprite) u8 subpriority; if (sprite->subpriority) + { subpriority = sprite->subpriority - 1; + } else { subpriority = 0; @@ -2555,7 +2567,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 b6ffd67b75ae..2fbf8cf69f97 100644 --- a/src/battle_controller_opponent.c +++ b/src/battle_controller_opponent.c @@ -185,7 +185,9 @@ static void Intro_WaitForShinyAnimAndHealthbox(u32 battler) FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS); } else + { return; + } } else if (gBattleSpritesDataPtr->healthBoxesData[battler].finishedShinyMonAnim) { @@ -198,13 +200,17 @@ static void Intro_WaitForShinyAnimAndHealthbox(u32 battler) FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS); } else + { return; + } } - gBattleSpritesDataPtr->healthBoxesData[battler].triedShinyMonAnim = FALSE; - gBattleSpritesDataPtr->healthBoxesData[battler].finishedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[battler].triedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[battler].finishedShinyMonAnim = FALSE; } else + { return; + } gBattleSpritesDataPtr->healthBoxesData[battler].introEndDelay = 3; gBattlerControllerFuncs[battler] = Intro_DelayAndEnd; @@ -274,7 +280,9 @@ static void Intro_TryShinyAnimShowHealthbox(u32 battler) m4aMPlayContinue(&gMPlayInfo_BGM); } else + { m4aMPlayVolumeControl(&gMPlayInfo_BGM, TRACKS_ALL, 0x100); + } } gBattleSpritesDataPtr->healthBoxesData[battler].bgmRestored = TRUE; bgmRestored = TRUE; diff --git a/src/battle_gfx_sfx_util.c b/src/battle_gfx_sfx_util.c index e2a583dcc9f5..611c1bec59a3 100644 --- a/src/battle_gfx_sfx_util.c +++ b/src/battle_gfx_sfx_util.c @@ -754,13 +754,21 @@ bool8 BattleLoadAllHealthBoxesGfx(u8 state) LoadCompressedSpriteSheet(&sSpriteSheet_SinglesPlayerHealthbox); } else if (state == 3) + { LoadCompressedSpriteSheet(&sSpriteSheet_SinglesOpponentHealthbox); + } else if (state == 4) + { LoadCompressedSpriteSheet(&sSpriteSheets_HealthBar[GetBattlerPosition(0)]); + } else if (state == 5) + { LoadCompressedSpriteSheet(&sSpriteSheets_HealthBar[GetBattlerPosition(1)]); + } else + { retVal = TRUE; + } } else { diff --git a/src/battle_main.c b/src/battle_main.c index 332f6c461eab..7508c6cb3a3a 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -1520,7 +1520,9 @@ static void CB2_HandleStartMultiBattle(void) gBattleCommunication[MULTIUSE_STATE]++; } else + { break; + } // fall through case 3: if (IsLinkTaskFinished()) diff --git a/src/battle_message.c b/src/battle_message.c index 7841c18eacb9..7ad18214e1f2 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -2642,7 +2642,9 @@ u32 BattleStringExpandPlaceholders(const u8 *src, u8 *dst, u32 dstSize) toCpy = gStringVar2; } else + { toCpy = gBattleTextBuff2; + } break; case B_TXT_BUFF3: if (gBattleTextBuff3[0] == B_BUFF_PLACEHOLDER_BEGIN) @@ -2651,7 +2653,9 @@ u32 BattleStringExpandPlaceholders(const u8 *src, u8 *dst, u32 dstSize) toCpy = gStringVar3; } else + { toCpy = gBattleTextBuff3; + } break; case B_TXT_COPY_VAR_1: toCpy = gStringVar1; @@ -2760,7 +2764,9 @@ u32 BattleStringExpandPlaceholders(const u8 *src, u8 *dst, u32 dstSize) toCpy = text; } else + { toCpy = sText_EnigmaBerry; + } } } else diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 2279b3536961..b2f46f124cfe 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -2313,7 +2313,9 @@ static void Cmd_attackanimation(void) u8 multihit; if (gBattleMons[gBattlerTarget].status2 & STATUS2_SUBSTITUTE) + { multihit = gMultiHitCounter; + } else if (gMultiHitCounter != 0 && gMultiHitCounter != 1) { if (gBattleMons[gBattlerTarget].hp <= gBattleMoveDamage) @@ -2322,7 +2324,9 @@ static void Cmd_attackanimation(void) multihit = gMultiHitCounter; } else + { multihit = gMultiHitCounter; + } BtlController_EmitMoveAnimation(gBattlerAttacker, BUFFER_A, gCurrentMove, gBattleScripting.animTurn, gBattleMovePower, gBattleMoveDamage, gBattleMons[gBattlerAttacker].friendship, &gDisableStructs[gBattlerAttacker], multihit); gBattleScripting.animTurn++; @@ -3123,7 +3127,9 @@ void SetMoveEffect(bool32 primary, bool32 certain) RESET_RETURN } else + { break; + } } if (B_STATUS_TYPE_IMMUNITY == GEN_1) { @@ -4603,13 +4609,10 @@ static void Cmd_getexp(void) { if (gBattlerPartyIndexes[2] == *expMonId && !(gAbsentBattlerFlags & 4)) gBattleStruct->expGetterBattlerId = 2; + else if (!(gAbsentBattlerFlags & 1)) + gBattleStruct->expGetterBattlerId = 0; else - { - if (!(gAbsentBattlerFlags & 1)) - gBattleStruct->expGetterBattlerId = 0; - else - gBattleStruct->expGetterBattlerId = 2; - } + gBattleStruct->expGetterBattlerId = 2; } else { @@ -13940,6 +13943,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]) @@ -13957,9 +13961,13 @@ static void Cmd_trydobeatup(void) gBattleCommunication[0]++; } else if (beforeLoop != 0) + { gBattlescriptCurrInstr = cmd->endInstr; + } else + { gBattlescriptCurrInstr = cmd->failInstr; + } } #endif } diff --git a/src/battle_util.c b/src/battle_util.c index 4484fe254a4f..45be169dfdc3 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -1900,9 +1900,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) { diff --git a/src/berry.c b/src/berry.c index 88278db47b4b..a287073df166 100644 --- a/src/berry.c +++ b/src/berry.c @@ -1711,11 +1711,13 @@ bool32 IsEnigmaBerryValid(void) const struct Berry *GetBerryInfo(u8 berry) { if (berry == ITEM_TO_BERRY(ITEM_ENIGMA_BERRY_E_READER) && IsEnigmaBerryValid()) + { #if FREE_ENIGMA_BERRY == FALSE return (struct Berry *)(&gSaveBlock1Ptr->enigmaBerry.berry); #else return &gBerries[0]; //never reached, but will appease the compiler gods #endif //FREE_ENIGMA_BERRY + } else { if (berry == BERRY_NONE || berry > ITEM_TO_BERRY(LAST_BERRY_INDEX)) @@ -2037,7 +2039,9 @@ static u8 CalcBerryYieldInternal(u16 max, u16 min, u8 water) u32 extraYield; if (water == 0 || OW_BERRY_MOISTURE) + { return min; + } else { randMin = (max - min) * (water - 1); diff --git a/src/berry_crush.c b/src/berry_crush.c index 2bb03e60a363..1f997708a751 100755 --- 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 b369883093ef..5bbf647ce9dc 100644 --- a/src/bike.c +++ b/src/bike.c @@ -389,7 +389,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 e03d5e8b3b84..f740b46b6227 100644 --- a/src/contest.c +++ b/src/contest.c @@ -2767,7 +2767,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 aa22f1d13dc8..0de31339f4b8 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/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 b922c939b767..181081119158 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 898f19c291fe..501a249ee481 100644 --- a/src/field_effect.c +++ b/src/field_effect.c @@ -1300,7 +1300,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); } @@ -2022,7 +2023,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; } @@ -2036,7 +2038,8 @@ static bool8 LavaridgeGymB1FWarpEffect_Rise(struct Task *task, struct ObjectEven { task->data[3]++; } - } else + } + else { task->data[4] = 1; } @@ -2190,7 +2193,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)); @@ -2521,7 +2525,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 c9be4f5caad4..5d797029bbe5 100644 --- a/src/item_use.c +++ b/src/item_use.c @@ -132,7 +132,9 @@ static void SetUpItemUseOnFieldCallback(u8 taskId) SetUpItemUseCallback(taskId); } else + { sItemUseOnFieldCB(taskId); + } } static void FieldCB_UseItemOnField(void) @@ -158,7 +160,9 @@ static void DisplayCannotUseItemMessage(u8 taskId, bool8 isUsingRegisteredKeyIte DisplayItemMessageInBattlePyramid(taskId, gText_DadsAdvice, Task_CloseBattlePyramidBagMessage); } else + { DisplayItemMessageOnField(taskId, gStringVar4, Task_CloseCantUseKeyItemMessage); + } } void DisplayDadsAdviceCannotUseItemMessage(u8 taskId, bool8 isUsingRegisteredKeyItemOnField) @@ -239,7 +243,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) @@ -248,7 +254,9 @@ void ItemUseOutOfBattle_Bike(u8 taskId) SetUpItemUseOnFieldCallback(taskId); } else + { DisplayDadsAdviceCannotUseItemMessage(taskId, tUsingRegisteredKeyItem); + } } } @@ -301,7 +309,9 @@ void ItemUseOutOfBattle_Rod(u8 taskId) SetUpItemUseOnFieldCallback(taskId); } else + { DisplayDadsAdviceCannotUseItemMessage(taskId, gTasks[taskId].tUsingRegisteredKeyItem); + } } static void ItemUseOnFieldCB_Rod(u8 taskId) diff --git a/src/librfu_sio32id.c b/src/librfu_sio32id.c index 2a1b0c94c4eb..45b1bc33decf 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 4e58c2285808..1f2b3a4052e5 100644 --- a/src/lottery_corner.c +++ b/src/lottery_corner.c @@ -74,7 +74,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++) @@ -132,7 +134,9 @@ static u8 GetMatchingDigits(u16 winNumber, u16 otId) matchingDigits++; } else + { break; + } } return matchingDigits; } diff --git a/src/main_menu.c b/src/main_menu.c index 504fbfb18642..bae80e543a0a 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}; static const u8 gText_SaveFileCorrupted[] = _("The save file is corrupted. The\nprevious save file will be loaded."); static const u8 gText_SaveFileErased[] = _("The save file has been erased\ndue to corruption or damage."); @@ -1298,7 +1297,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(); diff --git a/src/mauville_old_man.c b/src/mauville_old_man.c index efadd4de1fe1..8b8bfb2db5dc 100644 --- a/src/mauville_old_man.c +++ b/src/mauville_old_man.c @@ -477,7 +477,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; @@ -527,7 +529,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; @@ -846,7 +850,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 9332a270a4ed..c2e35354f166 100644 --- a/src/mini_printf.c +++ b/src/mini_printf.c @@ -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 285ad5e8396f..064a0eec16c7 100644 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -5367,7 +5367,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 3dd5fcc36f26..49fa60f60a93 100644 --- a/src/player_pc.c +++ b/src/player_pc.c @@ -881,7 +881,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 87702d337151..e4b5076e5975 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -2416,7 +2416,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); @@ -2711,7 +2713,9 @@ static bool8 TryDoInfoScreenScroll(void) } if (sPokedexView->selectedPokemon == selectedPokemon) + { return FALSE; + } else { sPokedexView->selectedPokemon = selectedPokemon; @@ -2734,7 +2738,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 a605b43e5080..72aa2c7c627d 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -5724,7 +5724,9 @@ u16 GetBattleBGM(void) } } else if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED_LINK)) + { return MUS_VS_TRAINER; + } else if (gBattleTypeFlags & BATTLE_TYPE_TRAINER) { u8 trainerClass; @@ -5771,7 +5773,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 4889dd788c2b..09ad43706b55 100644 --- a/src/pokenav_conditions_search_results.c +++ b/src/pokenav_conditions_search_results.c @@ -186,13 +186,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 @@ -209,7 +217,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 09fb96f3dc55..42588aeed019 100644 --- a/src/pokenav_menu_handler_gfx.c +++ b/src/pokenav_menu_handler_gfx.c @@ -509,7 +509,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/recorded_battle.c b/src/recorded_battle.c index c32e86b525db..5e1ff63bbe1c 100644 --- a/src/recorded_battle.c +++ b/src/recorded_battle.c @@ -53,7 +53,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; @@ -116,7 +116,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; @@ -304,7 +304,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]; @@ -511,7 +511,7 @@ void SetVariablesForRecordedBattle(struct RecordedBattleSave *src) s32 i, j; SetPartiesFromRecordedSave(src); - 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++) { diff --git a/src/slot_machine.c b/src/slot_machine.c index e813f60c6682..7f1139651474 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 8ae96581c96e..14e9409c6649 100644 --- a/src/sprite.c +++ b/src/sprite.c @@ -1048,9 +1048,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 9030c21478c4..8313ee9bf5d8 100644 --- a/src/tv.c +++ b/src/tv.c @@ -5334,7 +5334,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); }