diff --git a/asm/macros/event.inc b/asm/macros/event.inc index ede71eb19b..1a01779702 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/battle_scripts_1.s b/data/battle_scripts_1.s index 52eb931fd6..f8a8747752 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -2798,6 +2798,10 @@ BattleScript_EffectHitEscape:: jumpifbattleend BattleScript_HitEscapeEnd jumpifbyte CMP_NOT_EQUAL, gBattleOutcome, 0, BattleScript_HitEscapeEnd jumpifemergencyexited BS_TARGET, BattleScript_HitEscapeEnd + jumpiffainted BS_TARGET, FALSE, BattleScript_HitEscapeSwitch + setbyte sGIVEEXP_STATE, 0 + getexp BS_TARGET +BattleScript_HitEscapeSwitch: goto BattleScript_MoveSwitchPursuit BattleScript_HitEscapeEnd: end diff --git a/data/maps/BattleFrontier_Mart/scripts.inc b/data/maps/BattleFrontier_Mart/scripts.inc index 6afe6a0186..f118476cfe 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 c13e716975..37e691fa3b 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 27c8cc1e70..507a6352d3 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 4394312876..4da66f27b9 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 c37716bc85..0986e68c0c 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 dbe1b564ac..22e3851e9d 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 001df31401..8df5d02dfc 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 478f5cfd31..0a502a4f0e 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 9189df1f50..8375f9b82a 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 760abc600d..0d6403b206 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 a9683d13c9..f75a48e708 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 751835caab..f7028c20f8 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 6618b6a6a3..cfe97d5e1f 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 0b3c7b1a34..1e1aacbb10 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 acae50929d..54ca3aa6d8 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 54b2dacef1..fec03cc681 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 65cc71baba..50acba60b4 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 ae3910750e..5438a7f364 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 a0c0a8612e..ce7dd45b86 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 618f78c524..7b3171f67f 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 efc63d6561..4efceaa1cc 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 c809d6703a..3c6f77b3a5 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/docs/tutorials/how_to_battle_script_command_macro.md b/docs/tutorials/how_to_battle_script_command_macro.md index 042a87601d..2bbf503fbe 100644 --- a/docs/tutorials/how_to_battle_script_command_macro.md +++ b/docs/tutorials/how_to_battle_script_command_macro.md @@ -1,51 +1,47 @@ ## How to add new Battle Script Commands/Macros -To preface this tutorial, the battle engine upgrade has exhausted all battle script command IDs, and instead uses the `various` command to effectively add new commands. This is preferential to creating a secondary battle script command table like is done in the CFRU. +To preface this tutorial, the battle engine upgrade has exhausted all battle script command IDs. Historically, we've used the `various` command to effectively add new commands. However, this has caused issues of maintainability and readability due to the massive switch needed for it. Thanks to the cleanup made by the team and contributors, we now are able to call an infinite amount of commands by using `callnative`. This is preferential to creating a secondary battle script command table like is done in the CFRU. -In general, `gBattlescriptCurrInstr` tracks the current battle script position as a ROM address. Fortunately, we don't need to worry about ROM addresses when using the decomps, but it is important to understand because of how the `various` command is set up. +In general, `gBattlescriptCurrInstr` tracks the current battle script position as a ROM address. Fortunately, we don't need to worry about ROM addresses when using the decomps, but it is important to understand because of how the `callnative` command is set up. ``` -.macro various battler:req, param1:req - .byte 0x76 - .byte \battler - .byte \param1 - .endm + .macro callnative func:req + .byte 0xff + .4byte \func + .endm ``` +`callnative` uses the last battle script command ID in order to pass a native function as an argument. Additional optional arguments are added recursively via a macro, so no need to worry about how they need to align to the amount of instructions to skip. -`various` is 3 bytes in size, so if we wanted to advance to the next battle script command, we would write `gBattlescriptCurrInstr += 3`. Coincidentally, this is found at the end of `Cmd_Various` in `src/battle_script_commands.c`. - -Now, how might we add a custom various command case? Here are the steps. We will use `VARIOUS_SET_SIMPLE_BEAM` as an example. -### 1. Add a definition to `include/constants/battle_script_commands.h`. - -For example, `#define VARIOUS_SET_SIMPLE_BEAM 39` - -### 2. Create a macro in `asm/macros/battle_script.inc`. For example: +Now, how might we add a custom `callnative` command? Here are the steps. We will use `BS_TrySetOctolock` as an example. +### 1. Create a macro in `asm/macros/battle_script.inc`. For example: ```c -.macro setabilitysimple battler:req, ptr:req - various \battler VARIOUS_SET_SIMPLE_BEAM - .4byte \ptr - .endm + .macro trysetoctolock battler:req, failInstr:req + callnative BS_TrySetOctolock + .byte \battler + .4byte \failInstr + .endm ``` - -### 3. Add your new various command ID to `Cmd_Various`. For example: +### 2. Add your new callnative command ID to `src/battle_script_commands.c`. For example: ```c - case VARIOUS_SET_SIMPLE_BEAM: - if (IsEntrainmentTargetOrSimpleBeamBannedAbility(gBattleMons[gBattlerTarget].ability) - || gBattleMons[gBattlerTarget].ability == ABILITY_SIMPLE) - { - gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3); - } - else - { - gBattleMons[gBattlerTarget].ability = ABILITY_SIMPLE; - RecordAbilityBattle(gActiveBattler, ABILITY_SIMPLE); - gBattlescriptCurrInstr += 7; - } - return; +void BS_TrySetOctolock(void) +{ + NATIVE_ARGS(u8 battler, const u8 *failInstr); + u32 battler = GetBattlerForBattleScript(cmd->battler); + + if (gDisableStructs[battler].octolock) + { + gBattlescriptCurrInstr = cmd->failInstr; + } + else + { + gDisableStructs[battler].octolock = TRUE; + gBattleMons[battler].status2 |= STATUS2_ESCAPE_PREVENTION; + gDisableStructs[battler].battlerPreventingEscape = gBattlerAttacker; + gBattlescriptCurrInstr = cmd->nextInstr; + } +} ``` - -The macros' `battler` argument is the battler who will be affected/considered by your command. In our case, which battler we will try to give `ABILITY_SIMPLE`. Note that `gActiveBattler` is always set to this battler at the beginning of `Cmd_Various`. - -The `ptr` argument is an extra argument that, in this case, provides a battle script to jump to in the event that we fail to set `ABILITY_SIMPLE`. We must add the `.4byte \ptr` inside our macro. So now when we want to advance to the next battle script command in our script, we must increment `gBattlescriptCurrInstr` by `7` because our overall macro is 3 bytes for the various command, and 4 bytes for the pointer. *IMPORTANT* the `return` at the end of the switch case is required because remember that `various` always defaults to `gBattlescriptCurrInstr += 3` at the very end of the function, so if we included `gBattlescriptCurrInstr += 7` with a `break`, we would end up effectively doing `gBattlescriptCurrInstr += 10`. - -This behavior can be found under the `else` statement in the example above, corresponding to `ABILITY_SIMPLE` being correctly applied. If we are unable to set `ABILITY_SIMPLE`, however, notice the following `gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);`. This means we are jumping to the battle script provided by the pointer 3 bytes after our various command (which is the `ptr` argument described previously). We still must `return` or else we would actually jump to 3 bytes after the `ptr` battle script begins. +Each of the arguments defined in the macro (`battler`, `failInstr`) need to be called at the start of the command using `NATIVE_ARGS`. +The byte count in the macro should correspond to the type that will be used for the command (eg, `u8` is `byte`, while the pointer are `4byte`). +These arguments can then be accessed as `cmd->battler` and `cmd->battler`. +`gBattlescriptCurrInstr = cmd->nextInstr;` advances to the next instruction. diff --git a/graphics/birch_speech/bg2.pal b/graphics/birch_speech/bg2.pal index 3457f9b455..33f619ee44 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 c64a665b74..0945eefe92 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 d696c01d3c..b53b69c48b 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 da0faed032..826586cf9b 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 0a94cad2dc..e751a1ca51 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 929dc972f0..6e7c1c1e0c 100644 --- a/src/battle_anim_electric.c +++ b/src/battle_anim_electric.c @@ -742,7 +742,9 @@ static void AnimZapCannonSpark_Step(struct Sprite *sprite) sprite->invisible ^= 1; } else + { DestroyAnimSprite(sprite); + } } static void AnimThunderboltOrb_Step(struct Sprite *sprite) @@ -1024,7 +1026,9 @@ static void AnimTask_ElectricChargingParticles_Step(u8 taskId) } } else if(task->data[7] == 0) + { DestroyAnimVisualTask(taskId); + } } static void AnimElectricChargingParticles_Step(struct Sprite *sprite) @@ -1145,7 +1149,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 e583e44635..f848cd794a 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 611d12be56..a8c6e4077e 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 b6ffd67b75..2fbf8cf69f 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 e2a583dcc9..611c1bec59 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 b09cc5b910..a324ec9173 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -1517,7 +1517,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 6ad2d6c35a..662473eb5d 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; @@ -2764,7 +2768,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 0a58299408..25d1f78996 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -2503,7 +2503,9 @@ static void Cmd_attackanimation(void) { u32 multihit; if (gBattleMons[gBattlerTarget].status2 & STATUS2_SUBSTITUTE) + { multihit = gMultiHitCounter; + } else if (gMultiHitCounter != 0 && gMultiHitCounter != 1) { if (gBattleMons[gBattlerTarget].hp <= gBattleStruct->moveDamage[gBattlerTarget]) @@ -2512,7 +2514,9 @@ static void Cmd_attackanimation(void) multihit = gMultiHitCounter; } else + { multihit = gMultiHitCounter; + } BtlController_EmitMoveAnimation(gBattlerAttacker, BUFFER_A, @@ -3404,7 +3408,9 @@ void SetMoveEffect(bool32 primary, bool32 certain) RESET_RETURN } else + { break; + } } if (B_STATUS_TYPE_IMMUNITY == GEN_1) { @@ -4889,13 +4895,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 { @@ -14300,6 +14303,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]) @@ -14317,9 +14321,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 10170875f4..f43f285e93 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -1808,9 +1808,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 88278db47b..a287073df1 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 2bb03e60a3..1f997708a7 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 b369883093..5bbf647ce9 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 e03d5e8b3b..f740b46b62 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 aa22f1d13d..0de31339f4 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 96ff1b52df..1568c18d5f 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 290ddddaf1..e76ba3d855 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 b922c939b7..1810811191 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 898f19c291..501a249ee4 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 36cec810d5..64db57a16d 100644 --- a/src/item_use.c +++ b/src/item_use.c @@ -147,7 +147,9 @@ static void SetUpItemUseOnFieldCallback(u8 taskId) SetUpItemUseCallback(taskId); } else + { sItemUseOnFieldCB(taskId); + } } static void FieldCB_UseItemOnField(void) @@ -173,7 +175,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) @@ -254,7 +258,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) @@ -263,7 +269,9 @@ void ItemUseOutOfBattle_Bike(u8 taskId) SetUpItemUseOnFieldCallback(taskId); } else + { DisplayDadsAdviceCannotUseItemMessage(taskId, tUsingRegisteredKeyItem); + } } } @@ -316,7 +324,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 2a1b0c94c4..45b1bc33de 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 4c4323c1ed..6b20cf9678 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 4e58c22858..1f2b3a4052 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 504fbfb186..bae80e543a 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 efadd4de1f..8b8bfb2db5 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 9332a270a4..c2e35354f1 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 285ad5e839..064a0eec16 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 b44799223c..352a7a11f8 100644 --- a/src/player_pc.c +++ b/src/player_pc.c @@ -891,7 +891,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 87702d3371..e4b5076e59 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 d377af1c42..835c635f96 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -5748,7 +5748,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; @@ -5795,7 +5797,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 4889dd788c..09ad43706b 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 09fb96f3dc..42588aeed0 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 c32e86b525..5e1ff63bbe 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 e813f60c66..7f11396514 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 8ae96581c9..14e9409c66 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 9030c21478..8313ee9bf5 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); }