diff options
-rw-r--r-- | constants/constants.inc | 1 | ||||
-rw-r--r-- | constants/type_constants.inc | 18 | ||||
-rw-r--r-- | data-de/event_scripts.s | 140 | ||||
-rw-r--r-- | data/battle_ai_scripts.s | 1 | ||||
-rw-r--r-- | data/battle_scripts_1.s | 1 | ||||
-rw-r--r-- | data/btl_attrs.s | 1 | ||||
-rw-r--r-- | data/event_scripts.s | 140 | ||||
-rw-r--r-- | data/scripts/cable_club.inc | 4 | ||||
-rw-r--r-- | data/scripts/trainer_battle.inc | 136 | ||||
-rw-r--r-- | data/specials.inc | 14 | ||||
-rw-r--r-- | include/battle_setup.h | 4 | ||||
-rw-r--r-- | include/constants/pokemon.h | 4 | ||||
-rw-r--r-- | include/pokemon.h | 2 | ||||
-rw-r--r-- | include/trainer_see.h | 1 | ||||
-rw-r--r-- | src/battle_setup.c | 38 | ||||
-rw-r--r-- | src/pokemon_2.c | 6 | ||||
-rw-r--r-- | src/script_pokemon_util_80C4BF0.c | 18 | ||||
-rw-r--r-- | src/trainer_see.c | 2 |
18 files changed, 188 insertions, 343 deletions
diff --git a/constants/constants.inc b/constants/constants.inc index 57b6ae2a5..47d8d2aa4 100644 --- a/constants/constants.inc +++ b/constants/constants.inc @@ -1,6 +1,5 @@ .include "constants/gba_constants.inc" .include "constants/misc_constants.inc" - .include "constants/type_constants.inc" .include "constants/contest_constants.inc" .include "constants/item_data_constants.inc" .include "constants/trainer_constants.inc" diff --git a/constants/type_constants.inc b/constants/type_constants.inc deleted file mode 100644 index c6611bd8a..000000000 --- a/constants/type_constants.inc +++ /dev/null @@ -1,18 +0,0 @@ - .set TYPE_NORMAL, 0x00 - .set TYPE_FIGHTING, 0x01 - .set TYPE_FLYING, 0x02 - .set TYPE_POISON, 0x03 - .set TYPE_GROUND, 0x04 - .set TYPE_ROCK, 0x05 - .set TYPE_BUG, 0x06 - .set TYPE_GHOST, 0x07 - .set TYPE_STEEL, 0x08 - .set TYPE_MYSTERY, 0x09 - .set TYPE_FIRE, 0x0a - .set TYPE_WATER, 0x0b - .set TYPE_GRASS, 0x0c - .set TYPE_ELECTRIC, 0x0d - .set TYPE_PSYCHIC, 0x0e - .set TYPE_ICE, 0x0f - .set TYPE_DRAGON, 0x10 - .set TYPE_DARK, 0x11 diff --git a/data-de/event_scripts.s b/data-de/event_scripts.s index e1c097459..8ac608327 100644 --- a/data-de/event_scripts.s +++ b/data-de/event_scripts.s @@ -15,6 +15,7 @@ #include "constants/metatile_labels.h" #include "constants/battle_setup.h" #include "constants/map_scripts.h" +#include "constants/pokemon.h" .include "include/macros.inc" .include "include/macros/event.inc" .include "constants/constants.inc" @@ -711,144 +712,7 @@ UnknownString_819C21F: @ 819C21F .include "data/maps/Route124_DivingTreasureHuntersHouse/text.inc" .include "data/scripts/std_msgbox.inc" - -gUnknown_0819F80B:: @ 819F80B - lock - special PlayTrainerEncounterMusic - special ScrSpecial_EndTrainerApproach - waitstate - goto EventScript_19F8F2 - -gUnknown_0819F818:: @ 819F818 - lock - faceplayer - applymovement VAR_LAST_TALKED, Movement_19F8F0 - waitmovement 0 - specialvar VAR_RESULT, ScrSpecial_HasTrainerBeenFought - compare VAR_RESULT, 0 - goto_if_ne EventScript_19F83F - special PlayTrainerEncounterMusic - special sub_8082524 - goto EventScript_19F8F2 - -EventScript_19F83F: - gotopostbattlescript - -gUnknown_0819F840:: @ 819F840 - lock - faceplayer - call EventScript_19F8E5 - specialvar VAR_RESULT, ScrSpecial_HasTrainerBeenFought - compare VAR_RESULT, 0 - goto_if_ne EventScript_19F877 - special CheckForAlivePartyMons - compare VAR_RESULT, 0 - goto_if_ne EventScript_19F870 - special PlayTrainerEncounterMusic - special sub_8082524 - goto EventScript_19F8F2 - -EventScript_19F870: - special ScrSpecial_ShowTrainerNonBattlingSpeech - waitmessage - waitbuttonpress - release - end - -EventScript_19F877: - gotopostbattlescript - -gUnknown_0819F878:: @ 819F878 - applymovement VAR_LAST_TALKED, Movement_19F8F0 - waitmovement 0 - special PlayTrainerEncounterMusic - trainerbattlebegin - gotopostbattlescript - -gUnknown_0819F887:: @ 819F887 - call EventScript_19F8E5 - specialvar VAR_RESULT, ScrSpecial_GetTrainerEyeRematchFlag - compare VAR_RESULT, 0 - goto_if_eq EventScript_19F8AD - special PlayTrainerEncounterMusic - special sub_8082524 - special ScrSpecial_ShowTrainerIntroSpeech - waitmessage - waitbuttonpress - special ScrSpecial_StartTrainerEyeRematch - waitstate - releaseall - end - -EventScript_19F8AD: - gotopostbattlescript - -gUnknown_0819F8AE:: @ 819F8AE - specialvar VAR_RESULT, ScrSpecial_GetTrainerEyeRematchFlag - compare VAR_RESULT, 0 - goto_if_eq EventScript_19F8DD - special CheckForAlivePartyMons - compare VAR_RESULT, 0 - goto_if_ne EventScript_19F8DE - special PlayTrainerEncounterMusic - special sub_8082524 - special ScrSpecial_ShowTrainerIntroSpeech - waitmessage - waitbuttonpress - special ScrSpecial_StartTrainerEyeRematch - waitstate - releaseall - end - -EventScript_19F8DD: - gotopostbattlescript - -EventScript_19F8DE: - special ScrSpecial_ShowTrainerNonBattlingSpeech - waitmessage - waitbuttonpress - release - end - -EventScript_19F8E5: - applymovement VAR_LAST_TALKED, Movement_19F8F0 - waitmovement 0 - return - -Movement_19F8F0:: - reveal_trainer - end_movement - -EventScript_19F8F2: - special ScrSpecial_ShowTrainerIntroSpeech - waitmessage - waitbuttonpress - trainerbattlebegin - specialvar VAR_RESULT, ScrSpecial_GetTrainerBattleMode - compare VAR_RESULT, 0 - goto_if_eq EventScript_19F934 - compare VAR_RESULT, 2 - goto_if_eq EventScript_19F936 - compare VAR_RESULT, 1 - goto_if_eq EventScript_19F936 - compare VAR_RESULT, 6 - goto_if_eq EventScript_19F936 - compare VAR_RESULT, 8 - goto_if_eq EventScript_19F936 - -EventScript_19F934: - releaseall - end - -EventScript_19F936: - gotobeatenscript - -Std_MsgboxAutoclose:: - message 0x0 - waitmessage - waitbuttonpress - release - return + .include "data/scripts/trainer_battle.inc" Event_ResetBerryTrees: @ 19F940 setberrytree 2, 7, 5 diff --git a/data/battle_ai_scripts.s b/data/battle_ai_scripts.s index ab83f2bf8..9a2714a0e 100644 --- a/data/battle_ai_scripts.s +++ b/data/battle_ai_scripts.s @@ -3,6 +3,7 @@ #include "constants/hold_effects.h" #include "constants/items.h" #include "constants/moves.h" +#include "constants/pokemon.h" .include "include/macros.inc" .include "constants/constants.inc" .include "include/macros/battle_ai_script.inc" diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 00f0fd97b..a62b74fe5 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -2,6 +2,7 @@ #include "constants/battle.h" #include "constants/moves.h" #include "constants/songs.h" +#include "constants/pokemon.h" .include "include/macros.inc" .include "include/macros/battle_script.inc" .include "constants/constants.inc" diff --git a/data/btl_attrs.s b/data/btl_attrs.s index 06ab16430..3cee4e1c8 100644 --- a/data/btl_attrs.s +++ b/data/btl_attrs.s @@ -3,6 +3,7 @@ #include "constants/items.h" #include "constants/moves.h" #include "constants/species.h" +#include "constants/pokemon.h" .include "include/macros.inc" .include "constants/constants.inc" diff --git a/data/event_scripts.s b/data/event_scripts.s index 268d0f3f8..9e1b02e2d 100644 --- a/data/event_scripts.s +++ b/data/event_scripts.s @@ -15,6 +15,7 @@ #include "constants/metatile_labels.h" #include "constants/battle_setup.h" #include "constants/map_scripts.h" +#include "constants/pokemon.h" .include "include/macros.inc" .include "include/macros/event.inc" .include "constants/constants.inc" @@ -710,144 +711,7 @@ UnknownString_819C21F: @ 819C21F .include "data/maps/Route124_DivingTreasureHuntersHouse/text.inc" .include "data/scripts/std_msgbox.inc" - -gUnknown_0819F80B:: @ 819F80B - lock - special PlayTrainerEncounterMusic - special ScrSpecial_EndTrainerApproach - waitstate - goto EventScript_19F8F2 - -gUnknown_0819F818:: @ 819F818 - lock - faceplayer - applymovement VAR_LAST_TALKED, Movement_19F8F0 - waitmovement 0 - specialvar VAR_RESULT, ScrSpecial_HasTrainerBeenFought - compare VAR_RESULT, 0 - goto_if_ne EventScript_19F83F - special PlayTrainerEncounterMusic - special sub_8082524 - goto EventScript_19F8F2 - -EventScript_19F83F: - gotopostbattlescript - -gUnknown_0819F840:: @ 819F840 - lock - faceplayer - call EventScript_19F8E5 - specialvar VAR_RESULT, ScrSpecial_HasTrainerBeenFought - compare VAR_RESULT, 0 - goto_if_ne EventScript_19F877 - special CheckForAlivePartyMons - compare VAR_RESULT, 0 - goto_if_ne EventScript_19F870 - special PlayTrainerEncounterMusic - special sub_8082524 - goto EventScript_19F8F2 - -EventScript_19F870: - special ScrSpecial_ShowTrainerNonBattlingSpeech - waitmessage - waitbuttonpress - release - end - -EventScript_19F877: - gotopostbattlescript - -gUnknown_0819F878:: @ 819F878 - applymovement VAR_LAST_TALKED, Movement_19F8F0 - waitmovement 0 - special PlayTrainerEncounterMusic - trainerbattlebegin - gotopostbattlescript - -gUnknown_0819F887:: @ 819F887 - call EventScript_19F8E5 - specialvar VAR_RESULT, ScrSpecial_GetTrainerEyeRematchFlag - compare VAR_RESULT, 0 - goto_if_eq EventScript_19F8AD - special PlayTrainerEncounterMusic - special sub_8082524 - special ScrSpecial_ShowTrainerIntroSpeech - waitmessage - waitbuttonpress - special ScrSpecial_StartTrainerEyeRematch - waitstate - releaseall - end - -EventScript_19F8AD: - gotopostbattlescript - -gUnknown_0819F8AE:: @ 819F8AE - specialvar VAR_RESULT, ScrSpecial_GetTrainerEyeRematchFlag - compare VAR_RESULT, 0 - goto_if_eq EventScript_19F8DD - special CheckForAlivePartyMons - compare VAR_RESULT, 0 - goto_if_ne EventScript_19F8DE - special PlayTrainerEncounterMusic - special sub_8082524 - special ScrSpecial_ShowTrainerIntroSpeech - waitmessage - waitbuttonpress - special ScrSpecial_StartTrainerEyeRematch - waitstate - releaseall - end - -EventScript_19F8DD: - gotopostbattlescript - -EventScript_19F8DE: - special ScrSpecial_ShowTrainerNonBattlingSpeech - waitmessage - waitbuttonpress - release - end - -EventScript_19F8E5: - applymovement VAR_LAST_TALKED, Movement_19F8F0 - waitmovement 0 - return - -Movement_19F8F0:: - reveal_trainer - end_movement - -EventScript_19F8F2: - special ScrSpecial_ShowTrainerIntroSpeech - waitmessage - waitbuttonpress - trainerbattlebegin - specialvar VAR_RESULT, ScrSpecial_GetTrainerBattleMode - compare VAR_RESULT, 0 - goto_if_eq EventScript_19F934 - compare VAR_RESULT, 2 - goto_if_eq EventScript_19F936 - compare VAR_RESULT, 1 - goto_if_eq EventScript_19F936 - compare VAR_RESULT, 6 - goto_if_eq EventScript_19F936 - compare VAR_RESULT, 8 - goto_if_eq EventScript_19F936 - -EventScript_19F934: - releaseall - end - -EventScript_19F936: - gotobeatenscript - -Std_MsgboxAutoclose:: - message 0x0 - waitmessage - waitbuttonpress - release - return + .include "data/scripts/trainer_battle.inc" Event_ResetBerryTrees: @ 19F940 setberrytree 2, 7, 5 diff --git a/data/scripts/cable_club.inc b/data/scripts/cable_club.inc index 1da7d0dda..caf02fe7b 100644 --- a/data/scripts/cable_club.inc +++ b/data/scripts/cable_club.inc @@ -279,8 +279,8 @@ OldaleTown_PokemonCenter_2F_EventScript_1A403C:: @ 81A403C return OldaleTown_PokemonCenter_2F_EventScript_1A4042:: @ 81A4042 - special CheckForAlivePartyMons - compare VAR_RESULT, 0 + special HasEnoughMonsForDoubleBattle + compare VAR_RESULT, PLAYER_HAS_TWO_USABLE_MONS goto_if_ne OldaleTown_PokemonCenter_2F_EventScript_1A4056 setvar VAR_0x8004, 2 return diff --git a/data/scripts/trainer_battle.inc b/data/scripts/trainer_battle.inc new file mode 100644 index 000000000..95dc54c88 --- /dev/null +++ b/data/scripts/trainer_battle.inc @@ -0,0 +1,136 @@ +EventScript_StartTrainerBattle:: @ 819F80B + lock + special PlayTrainerEncounterMusic + special EndTrainerApproach + waitstate + goto EventScript_DoTrainerBattle + +EventScript_TryDoNormalTrainerBattle:: @ 819F818 + lock + faceplayer + applymovement VAR_LAST_TALKED, Movement_RevealTrainer + waitmovement 0 + specialvar VAR_RESULT, GetTrainerFlag + compare VAR_RESULT, 0 + goto_if_ne EventScript_NoNormalTrainerBattle + special PlayTrainerEncounterMusic + special SetUpTrainerMovement + goto EventScript_DoTrainerBattle + +EventScript_NoNormalTrainerBattle: + gotopostbattlescript + +EventScript_TryDoDoubleTrainerBattle:: @ 819F840 + lock + faceplayer + call EventScript_RevealTrainer + specialvar VAR_RESULT, GetTrainerFlag + compare VAR_RESULT, 0 + goto_if_ne EventScript_NoDoubleTrainerBattle + special HasEnoughMonsForDoubleBattle + compare VAR_RESULT, PLAYER_HAS_TWO_USABLE_MONS + goto_if_ne EventScript_NotEnoughMonsForDoubleBattle + special PlayTrainerEncounterMusic + special SetUpTrainerMovement + goto EventScript_DoTrainerBattle + +EventScript_NotEnoughMonsForDoubleBattle: + special ScrSpecial_ShowTrainerNonBattlingSpeech + waitmessage + waitbuttonpress + release + end + +EventScript_NoDoubleTrainerBattle: + gotopostbattlescript + +EventScript_DoNoIntroTrainerBattle:: @ 819F878 + applymovement VAR_LAST_TALKED, Movement_RevealTrainer + waitmovement 0 + special PlayTrainerEncounterMusic + trainerbattlebegin + gotopostbattlescript + +EventScript_TryDoRematchBattle:: @ 819F887 + call EventScript_RevealTrainer + specialvar VAR_RESULT, IsTrainerReadyForRematch + compare VAR_RESULT, FALSE + goto_if_eq EventScript_NoRematchTrainerBattle + special PlayTrainerEncounterMusic + special SetUpTrainerMovement + special ShowTrainerIntroSpeech + waitmessage + waitbuttonpress + special BattleSetup_StartRematchBattle + waitstate + releaseall + end + +EventScript_NoRematchTrainerBattle: + gotopostbattlescript + +EventScript_TryDoDoubleRematchBattle:: @ 819F8AE + specialvar VAR_RESULT, IsTrainerReadyForRematch + compare VAR_RESULT, FALSE + goto_if_eq EventScript_NoDoubleRematchTrainerBattle + special HasEnoughMonsForDoubleBattle + compare VAR_RESULT, PLAYER_HAS_TWO_USABLE_MONS + goto_if_ne EventScript_NotEnoughMonsForDoubleRematchBattle + special PlayTrainerEncounterMusic + special SetUpTrainerMovement + special ShowTrainerIntroSpeech + waitmessage + waitbuttonpress + special BattleSetup_StartRematchBattle + waitstate + releaseall + end + +EventScript_NoDoubleRematchTrainerBattle: + gotopostbattlescript + +EventScript_NotEnoughMonsForDoubleRematchBattle: + special ScrSpecial_ShowTrainerNonBattlingSpeech + waitmessage + waitbuttonpress + release + end + +EventScript_RevealTrainer: + applymovement VAR_LAST_TALKED, Movement_RevealTrainer + waitmovement 0 + return + +Movement_RevealTrainer:: + reveal_trainer + end_movement + +EventScript_DoTrainerBattle: + special ShowTrainerIntroSpeech + waitmessage + waitbuttonpress + trainerbattlebegin + specialvar VAR_RESULT, ScrSpecial_GetTrainerBattleMode + compare VAR_RESULT, TRAINER_BATTLE_SINGLE + goto_if_eq EventScript_EndTrainerBattle + compare VAR_RESULT, TRAINER_BATTLE_CONTINUE_SCRIPT + goto_if_eq EventScript_GoToBeatenScript + compare VAR_RESULT, TRAINER_BATTLE_CONTINUE_SCRIPT_NO_MUSIC + goto_if_eq EventScript_GoToBeatenScript + compare VAR_RESULT, TRAINER_BATTLE_CONTINUE_SCRIPT_DOUBLE + goto_if_eq EventScript_GoToBeatenScript + compare VAR_RESULT, TRAINER_BATTLE_CONTINUE_SCRIPT_DOUBLE_NO_MUSIC + goto_if_eq EventScript_GoToBeatenScript +EventScript_EndTrainerBattle: + releaseall + end + +EventScript_GoToBeatenScript: + gotobeatenscript + +Std_MsgboxAutoclose:: + message 0x0 + waitmessage + waitbuttonpress + release + return diff --git a/data/specials.inc b/data/specials.inc index 6988d90c4..07187eb47 100644 --- a/data/specials.inc +++ b/data/specials.inc @@ -60,16 +60,16 @@ gSpecials:: def_special PlayerHasBerries def_special IsEnigmaBerryValid def_special ScrSpecial_GetTrainerBattleMode - def_special ScrSpecial_ShowTrainerIntroSpeech + def_special ShowTrainerIntroSpeech def_special ScrSpecial_ShowTrainerNonBattlingSpeech - def_special ScrSpecial_HasTrainerBeenFought - def_special ScrSpecial_EndTrainerApproach + def_special GetTrainerFlag + def_special EndTrainerApproach def_special PlayTrainerEncounterMusic def_special ShouldTryRematchBattle - def_special ScrSpecial_GetTrainerEyeRematchFlag - def_special ScrSpecial_StartTrainerEyeRematch + def_special IsTrainerReadyForRematch + def_special BattleSetup_StartRematchBattle def_special ShowPokemonStorageSystem - def_special CheckForAlivePartyMons + def_special HasEnoughMonsForDoubleBattle def_special TurnOffTVScreen def_special DoTVShow def_special DoPokeNews @@ -322,7 +322,7 @@ gSpecials:: def_special ScrSpecial_StartGroudonKyogreBattle def_special ScrSpecial_StartRayquazaBattle def_special ScrSpecial_StartRegiBattle - def_special sub_8082524 + def_special SetUpTrainerMovement def_special DoSealedChamberShakingEffect2 def_special FoundBlackGlasses def_special sub_807E25C diff --git a/include/battle_setup.h b/include/battle_setup.h index f0608cb21..1676ddde1 100644 --- a/include/battle_setup.h +++ b/include/battle_setup.h @@ -59,7 +59,6 @@ void TrainerWantsBattle(u8, const u8 *); bool32 GetTrainerFlagFromScriptPointer(const u8 *data); //u8 ScrSpecial_GetTrainerBattleMode(void); -//u8 ScrSpecial_HasTrainerBeenFought(void); //void sub_808257C(void); //void unref_sub_8082590(void); // unused u8 HasTrainerAlreadyBeenFought(u16); @@ -68,8 +67,6 @@ void ClearTrainerFlag(u16); void BattleSetup_StartTrainerBattle(void); void CB2_EndTrainerBattle(void); void do_choose_name_or_words_screen(void); -//void ScrSpecial_StartTrainerEyeRematch(void); -//void ScrSpecial_ShowTrainerIntroSpeech(void); u8 *BattleSetup_GetScriptAddrAfterBattle(void); u8 *BattleSetup_GetTrainerPostBattleScript(void); //void ScrSpecial_ShowTrainerNonBattlingSpeech(void); @@ -94,6 +91,5 @@ void TryUpdateRandomTrainerRematches(u16, u16); s32 DoesSomeoneWantRematchIn(u16 mapGroup, u16 mapNum); s32 IsRematchTrainerIn(u16 mapGroup, u16 mapNum); u16 GetRematchTrainerId(u16 a1); -//u8 ScrSpecial_GetTrainerEyeRematchFlag(void); #endif // GUARD_BATTLE_SETUP_H diff --git a/include/constants/pokemon.h b/include/constants/pokemon.h index 8e7c01eb5..5d1539179 100644 --- a/include/constants/pokemon.h +++ b/include/constants/pokemon.h @@ -141,4 +141,8 @@ #define NUM_STATS 6 #define UNOWN_FORM_COUNT 28 +#define PLAYER_HAS_TWO_USABLE_MONS 0 +#define PLAYER_HAS_ONE_MON 1 +#define PLAYER_HAS_ONE_USABLE_MON 2 + #endif // GUARD_CONSTANTS_POKEMON_H diff --git a/include/pokemon.h b/include/pokemon.h index df2d42522..5c19c0447 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -440,7 +440,7 @@ u8 GiveMonToPlayer(struct Pokemon *mon); u8 SendMonToPC(struct Pokemon *mon); u8 CalculatePlayerPartyCount(void); u8 CalculateEnemyPartyCount(void); -u8 sub_803DAA0(void); +u8 GetMonsStateToDoubles(void); u8 GetAbilityBySpecies(u16 species, bool8 altAbility); u8 GetMonAbility(struct Pokemon *mon); void CreateSecretBaseEnemyParty(struct SecretBaseRecord *secretBaseRecord); diff --git a/include/trainer_see.h b/include/trainer_see.h index 78487aa57..5c65cb313 100644 --- a/include/trainer_see.h +++ b/include/trainer_see.h @@ -6,6 +6,5 @@ bool8 CheckTrainers(void); void sub_8084794(struct ObjectEvent *var); -void ScrSpecial_EndTrainerApproach(void); #endif // GUARD_TRAINER_SEE_H diff --git a/src/battle_setup.c b/src/battle_setup.c index b3a42858d..cb07c5049 100644 --- a/src/battle_setup.c +++ b/src/battle_setup.c @@ -55,13 +55,13 @@ extern u8 gBattleOutcome; extern struct ObjectEvent gObjectEvents[]; -extern u8 gUnknown_0819F818[]; -extern u8 gUnknown_0819F840[]; -extern u8 gUnknown_0819F878[]; -extern u8 gUnknown_0819F887[]; -extern u8 gUnknown_0819F8AE[]; +extern u8 EventScript_TryDoNormalTrainerBattle[]; +extern u8 EventScript_TryDoDoubleTrainerBattle[]; +extern u8 EventScript_DoNoIntroTrainerBattle[]; +extern u8 EventScript_TryDoRematchBattle[]; +extern u8 EventScript_TryDoDoubleRematchBattle[]; -extern u8 gUnknown_0819F80B[]; +extern u8 EventScript_StartTrainerBattle[]; extern u8 gUnknown_081C6C02[]; // The first transition is used if the enemy pokemon are lower level than our pokemon. @@ -1008,35 +1008,35 @@ u8 *BattleSetup_ConfigureTrainerBattle(const u8 *data) { case TRAINER_BATTLE_SINGLE_NO_INTRO_TEXT: TrainerBattleLoadArgs(gTrainerBattleSpecs_3, data); - return gUnknown_0819F878; + return EventScript_DoNoIntroTrainerBattle; case TRAINER_BATTLE_DOUBLE: TrainerBattleLoadArgs(gTrainerBattleSpecs_2, data); SetMapVarsToTrainer(); - return gUnknown_0819F840; + return EventScript_TryDoDoubleTrainerBattle; case TRAINER_BATTLE_CONTINUE_SCRIPT_NO_MUSIC: case TRAINER_BATTLE_CONTINUE_SCRIPT: TrainerBattleLoadArgs(gTrainerBattleSpecs_1, data); SetMapVarsToTrainer(); - return gUnknown_0819F818; + return EventScript_TryDoNormalTrainerBattle; case TRAINER_BATTLE_CONTINUE_SCRIPT_DOUBLE: case TRAINER_BATTLE_CONTINUE_SCRIPT_DOUBLE_NO_MUSIC: TrainerBattleLoadArgs(gTrainerBattleSpecs_4, data); SetMapVarsToTrainer(); - return gUnknown_0819F840; + return EventScript_TryDoDoubleTrainerBattle; case TRAINER_BATTLE_REMATCH_DOUBLE: TrainerBattleLoadArgs(gTrainerBattleSpecs_2, data); SetMapVarsToTrainer(); gTrainerBattleOpponent = GetRematchTrainerId(gTrainerBattleOpponent); - return gUnknown_0819F8AE; + return EventScript_TryDoDoubleRematchBattle; case TRAINER_BATTLE_REMATCH: TrainerBattleLoadArgs(gTrainerBattleSpecs_0, data); SetMapVarsToTrainer(); gTrainerBattleOpponent = GetRematchTrainerId(gTrainerBattleOpponent); - return gUnknown_0819F887; + return EventScript_TryDoRematchBattle; default: // TRAINER_BATTLE_SINGLE TrainerBattleLoadArgs(gTrainerBattleSpecs_0, data); SetMapVarsToTrainer(); - return gUnknown_0819F818; + return EventScript_TryDoNormalTrainerBattle; } } @@ -1045,7 +1045,7 @@ void TrainerWantsBattle(u8 trainerObjEventId, const u8 *trainerScript) gSelectedObjectEvent = trainerObjEventId; gSpecialVar_LastTalked = gObjectEvents[trainerObjEventId].localId; BattleSetup_ConfigureTrainerBattle(trainerScript + 1); - ScriptContext1_SetupScript(gUnknown_0819F80B); + ScriptContext1_SetupScript(EventScript_StartTrainerBattle); ScriptContext2_Enable(); } @@ -1055,7 +1055,7 @@ bool32 GetTrainerFlagFromScriptPointer(const u8 *data) return FlagGet(TRAINER_FLAG_START + flag); } -void sub_8082524(void) +void SetUpTrainerMovement(void) { struct ObjectEvent *objectEvent = &gObjectEvents[gSelectedObjectEvent]; @@ -1067,7 +1067,7 @@ u8 ScrSpecial_GetTrainerBattleMode(void) return sTrainerBattleMode; } -u8 ScrSpecial_HasTrainerBeenFought(void) +u8 GetTrainerFlag(void) { return FlagGet(CurrentOpponentTrainerFlag()); } @@ -1140,7 +1140,7 @@ void CB2_EndTrainerEyeRematchBattle(void) } } -void ScrSpecial_StartTrainerEyeRematch(void) +void BattleSetup_StartRematchBattle(void) { gBattleTypeFlags = BATTLE_TYPE_TRAINER; gMain.savedCallback = CB2_EndTrainerEyeRematchBattle; @@ -1151,7 +1151,7 @@ void ScrSpecial_StartTrainerEyeRematch(void) static const u8 *GetTrainerIntroSpeech(void); static const u8 *GetTrainerNonBattlingSpeech(void); -void ScrSpecial_ShowTrainerIntroSpeech(void) +void ShowTrainerIntroSpeech(void) { ShowFieldMessage(GetTrainerIntroSpeech()); } @@ -1472,7 +1472,7 @@ bool8 ShouldTryRematchBattle(void) return WasSecondRematchWon(gTrainerEyeTrainers, gTrainerBattleOpponent); } -u8 ScrSpecial_GetTrainerEyeRematchFlag(void) +u8 IsTrainerReadyForRematch(void) { return GetTrainerEyeRematchFlag(gTrainerEyeTrainers, gTrainerBattleOpponent); } diff --git a/src/pokemon_2.c b/src/pokemon_2.c index a92d12fd9..9fd145b80 100644 --- a/src/pokemon_2.c +++ b/src/pokemon_2.c @@ -1031,14 +1031,14 @@ u8 CalculateEnemyPartyCount(void) return gEnemyPartyCount; } -u8 sub_803DAA0(void) +u8 GetMonsStateToDoubles(void) { s32 aliveCount = 0; s32 i; CalculatePlayerPartyCount(); if (gPlayerPartyCount == 1) - return gPlayerPartyCount; + return gPlayerPartyCount; // PLAYER_HAS_ONE_MON for (i = 0; i < gPlayerPartyCount; i++) { @@ -1048,7 +1048,7 @@ u8 sub_803DAA0(void) aliveCount++; } - return (aliveCount > 1) ? 0 : 2; + return (aliveCount > 1) ? PLAYER_HAS_TWO_USABLE_MONS : PLAYER_HAS_ONE_USABLE_MON; } u8 GetAbilityBySpecies(u16 species, bool8 altAbility) diff --git a/src/script_pokemon_util_80C4BF0.c b/src/script_pokemon_util_80C4BF0.c index ce6c01439..c405d9cb4 100644 --- a/src/script_pokemon_util_80C4BF0.c +++ b/src/script_pokemon_util_80C4BF0.c @@ -437,20 +437,18 @@ u8 ScriptGiveEgg(u16 species) return GiveMonToPlayer(&mon); } -void CheckForAlivePartyMons(void) +void HasEnoughMonsForDoubleBattle(void) { - u8 var = sub_803DAA0(); - - switch(var) + switch (GetMonsStateToDoubles()) { - case 1: - gSpecialVar_Result = var; + case PLAYER_HAS_TWO_USABLE_MONS: + gSpecialVar_Result = PLAYER_HAS_TWO_USABLE_MONS; break; - case 0: - gSpecialVar_Result = var; + case PLAYER_HAS_ONE_MON: + gSpecialVar_Result = PLAYER_HAS_ONE_MON; break; - case 2: - gSpecialVar_Result = var; + case PLAYER_HAS_ONE_USABLE_MON: + gSpecialVar_Result = PLAYER_HAS_ONE_USABLE_MON; break; } } diff --git a/src/trainer_see.c b/src/trainer_see.c index 5fc0a346d..f70eeb3a9 100644 --- a/src/trainer_see.c +++ b/src/trainer_see.c @@ -448,7 +448,7 @@ void sub_8084794(struct ObjectEvent *var) static void Task_DestroyTrainerApproachTask(u8); -void ScrSpecial_EndTrainerApproach(void) +void EndTrainerApproach(void) { sub_80842FC(Task_DestroyTrainerApproachTask); } |