Sync trainer_battle.inc

This commit is contained in:
GriffinR
2020-03-03 14:42:15 -05:00
parent 4c4b19da7e
commit 1aa1f18972
9 changed files with 83 additions and 85 deletions
+1 -1
View File
@@ -109,7 +109,7 @@
create_movement emote_x create_movement emote_x
create_movement emote_double_exclamation_mark create_movement emote_double_exclamation_mark
create_movement emote_smile create_movement emote_smile
create_movement step_67 create_movement reveal_trainer
create_movement rock_smash_break create_movement rock_smash_break
create_movement cut_tree create_movement cut_tree
+59 -60
View File
@@ -1,143 +1,142 @@
gUnknown_81A4EB4:: @ 81A4EB4 EventScript_DoTrainerBattleFromApproach:: @ 81A4EB4
lock lock
special PlayTrainerEncounterMusic special PlayTrainerEncounterMusic
special ScrSpecial_EndTrainerApproach special EndTrainerApproach
waitstate waitstate
goto EventScript_1A4FC7 goto EventScript_DoTrainerBattle
EventScript_TryDoNormalTrainerBattle:: @ 81A4EC1 EventScript_TryDoNormalTrainerBattle:: @ 81A4EC1
lock lock
faceplayer faceplayer
applymovement VAR_LAST_TALKED, Movement_1A4FC5 applymovement VAR_LAST_TALKED, Movement_RevealTrainer
waitmovement 0 waitmovement 0
specialvar VAR_RESULT, ScrSpecial_HasTrainerBeenFought specialvar VAR_RESULT, ScrSpecial_HasTrainerBeenFought
compare VAR_RESULT, 0 compare VAR_RESULT, FALSE
goto_if_ne EventScript_1A4EE8 goto_if_ne EventScript_NoTrainerBattle
special PlayTrainerEncounterMusic special PlayTrainerEncounterMusic
special SetUpTrainerMovement special SetUpTrainerMovement
goto EventScript_1A4FC7 goto EventScript_DoTrainerBattle
EventScript_1A4EE8:: @ 81A4EE8 EventScript_NoTrainerBattle:: @ 81A4EE8
ontrainerbattleend ontrainerbattleend
EventScript_TryDoDoubleTrainerBattle:: @ 81A4EE9 EventScript_TryDoDoubleTrainerBattle:: @ 81A4EE9
lock lock
faceplayer faceplayer
call EventScript_1A4FBA call EventScript_RevealTrainer
specialvar VAR_RESULT, ScrSpecial_HasTrainerBeenFought specialvar VAR_RESULT, ScrSpecial_HasTrainerBeenFought
compare VAR_RESULT, 0 compare VAR_RESULT, FALSE
goto_if_ne EventScript_1A4F20 goto_if_ne EventScript_NoDoubleTrainerBattle
special HasEnoughMonsForDoubleBattle special HasEnoughMonsForDoubleBattle
compare VAR_RESULT, PLAYER_HAS_TWO_USABLE_MONS compare VAR_RESULT, PLAYER_HAS_TWO_USABLE_MONS
goto_if_ne EventScript_1A4F19 goto_if_ne EventScript_NotEnoughMonsForDoubleBattle
special PlayTrainerEncounterMusic special PlayTrainerEncounterMusic
special SetUpTrainerMovement special SetUpTrainerMovement
goto EventScript_1A4FC7 goto EventScript_DoTrainerBattle
EventScript_1A4F19:: @ 81A4F19 EventScript_NotEnoughMonsForDoubleBattle:: @ 81A4F19
special ScrSpecial_ShowTrainerNonBattlingSpeech special ShowTrainerCantBattleSpeech
waitmessage waitmessage
waitbuttonpress waitbuttonpress
release release
end end
EventScript_1A4F20:: @ 81A4F20 EventScript_NoDoubleTrainerBattle:: @ 81A4F20
ontrainerbattleend ontrainerbattleend
EventScript_DoTrainerBattle:: @ 81A4F21 EventScript_DoNoIntroTrainerBattle:: @ 81A4F21
applymovement VAR_LAST_TALKED, Movement_1A4FC5 applymovement VAR_LAST_TALKED, Movement_RevealTrainer
waitmovement 0 waitmovement 0
special PlayTrainerEncounterMusic special PlayTrainerEncounterMusic
goto_if_questlog EventScript_1A501A goto_if_questlog EventScript_EndQuestLogBattle
battlebegin battlebegin
ontrainerbattleend ontrainerbattleend
EventScript_TryDoRematchBattle:: @ 81A4F3E EventScript_TryDoRematchBattle:: @ 81A4F3E
call EventScript_1A4FBA call EventScript_RevealTrainer
specialvar VAR_RESULT, ScrSpecial_GetTrainerEyeRematchFlag specialvar VAR_RESULT, IsTrainerReadyForRematch
compare VAR_RESULT, 0 compare VAR_RESULT, FALSE
goto_if_eq EventScript_1A4F72 goto_if_eq EventScript_NoRematchBattle
special PlayTrainerEncounterMusic special PlayTrainerEncounterMusic
special SetUpTrainerMovement special SetUpTrainerMovement
special ScrSpecial_ShowTrainerIntroSpeech special ShowTrainerIntroSpeech
waitmessage waitmessage
waitbuttonpress waitbuttonpress
goto_if_questlog EventScript_1A4FB8 goto_if_questlog EventScript_EndQuestLogRematch
special ScrSpecial_StartTrainerEyeRematch special BattleSetup_StartRematchBattle
waitstate waitstate
releaseall releaseall
end end
EventScript_1A4F72:: @ 81A4F72 EventScript_NoRematchBattle:: @ 81A4F72
ontrainerbattleend ontrainerbattleend
EventScript_TryDoDoubleRematchBattle:: @ 81A4F73 EventScript_TryDoDoubleRematchBattle:: @ 81A4F73
specialvar VAR_RESULT, ScrSpecial_GetTrainerEyeRematchFlag specialvar VAR_RESULT, IsTrainerReadyForRematch
compare VAR_RESULT, 0 compare VAR_RESULT, FALSE
goto_if_eq EventScript_1A4FB0 goto_if_eq EventScript_NoDoubleRematchBattle
special HasEnoughMonsForDoubleBattle special HasEnoughMonsForDoubleBattle
compare VAR_RESULT, PLAYER_HAS_TWO_USABLE_MONS compare VAR_RESULT, PLAYER_HAS_TWO_USABLE_MONS
goto_if_ne EventScript_1A4FB1 goto_if_ne EventScript_NotEnoughMonsForDoubleRematchBattle
special PlayTrainerEncounterMusic special PlayTrainerEncounterMusic
special SetUpTrainerMovement special SetUpTrainerMovement
special ScrSpecial_ShowTrainerIntroSpeech special ShowTrainerIntroSpeech
waitmessage waitmessage
waitbuttonpress waitbuttonpress
goto_if_questlog EventScript_1A4FB8 goto_if_questlog EventScript_EndQuestLogRematch
special ScrSpecial_StartTrainerEyeRematch special BattleSetup_StartRematchBattle
waitstate waitstate
releaseall releaseall
end end
EventScript_1A4FB0:: @ 81A4FB0 EventScript_NoDoubleRematchBattle:: @ 81A4FB0
ontrainerbattleend ontrainerbattleend
EventScript_1A4FB1:: @ 81A4FB1 EventScript_NotEnoughMonsForDoubleRematchBattle:: @ 81A4FB1
special ScrSpecial_ShowTrainerNonBattlingSpeech special ShowTrainerCantBattleSpeech
waitmessage waitmessage
waitbuttonpress waitbuttonpress
release release
end end
EventScript_1A4FB8:: @ 81A4FB8 EventScript_EndQuestLogRematch:: @ 81A4FB8
releaseall releaseall
end end
EventScript_1A4FBA:: @ 81A4FBA EventScript_RevealTrainer:: @ 81A4FBA
applymovement VAR_LAST_TALKED, Movement_1A4FC5 applymovement VAR_LAST_TALKED, Movement_RevealTrainer
waitmovement 0 waitmovement 0
return return
Movement_1A4FC5:: @ 81A4FC5 Movement_RevealTrainer:: @ 81A4FC5
step_67 reveal_trainer
step_end step_end
EventScript_1A4FC7:: @ 81A4FC7 EventScript_DoTrainerBattle:: @ 81A4FC7
special ScrSpecial_ShowTrainerIntroSpeech special ShowTrainerIntroSpeech
waitmessage waitmessage
waitbuttonpress waitbuttonpress
goto_if_questlog EventScript_1A501A goto_if_questlog EventScript_EndQuestLogBattle
battlebegin battlebegin
specialvar VAR_RESULT, ScrSpecial_GetTrainerBattleMode specialvar VAR_RESULT, GetTrainerBattleMode
compare VAR_RESULT, 0 compare VAR_RESULT, TRAINER_BATTLE_SINGLE
goto_if_eq EventScript_1A5017 goto_if_eq EventScript_EndTrainerBattle
compare VAR_RESULT, 2 compare VAR_RESULT, TRAINER_BATTLE_CONTINUE_SCRIPT
goto_if_eq EventScript_1A5019 goto_if_eq EventScript_EndTrainerBattleContinueScript
compare VAR_RESULT, 1 compare VAR_RESULT, TRAINER_BATTLE_CONTINUE_SCRIPT_NO_MUSIC
goto_if_eq EventScript_1A5019 goto_if_eq EventScript_EndTrainerBattleContinueScript
compare VAR_RESULT, 6 compare VAR_RESULT, TRAINER_BATTLE_CONTINUE_SCRIPT_DOUBLE
goto_if_eq EventScript_1A5019 goto_if_eq EventScript_EndTrainerBattleContinueScript
compare VAR_RESULT, 8 compare VAR_RESULT, TRAINER_BATTLE_CONTINUE_SCRIPT_DOUBLE_NO_MUSIC
goto_if_eq EventScript_1A5019 goto_if_eq EventScript_EndTrainerBattleContinueScript
EventScript_EndTrainerBattle:: @ 81A5017
EventScript_1A5017:: @ 81A5017
releaseall releaseall
end end
EventScript_1A5019:: @ 81A5019 EventScript_EndTrainerBattleContinueScript:: @ 81A5019
ontrainerbattleendgoto ontrainerbattleendgoto
EventScript_1A501A:: @ 81A501A EventScript_EndQuestLogBattle:: @ 81A501A
special SetBattledTrainerFlag special SetBattledTrainerFlag
releaseall releaseall
end end
+6 -6
View File
@@ -59,15 +59,15 @@ gSpecials:: @ 815FD60
def_special NullFieldSpecial def_special NullFieldSpecial
def_special NullFieldSpecial def_special NullFieldSpecial
def_special IsEnigmaBerryValid def_special IsEnigmaBerryValid
def_special ScrSpecial_GetTrainerBattleMode def_special GetTrainerBattleMode
def_special ScrSpecial_ShowTrainerIntroSpeech def_special ShowTrainerIntroSpeech
def_special ScrSpecial_ShowTrainerNonBattlingSpeech def_special ShowTrainerCantBattleSpeech
def_special ScrSpecial_HasTrainerBeenFought def_special ScrSpecial_HasTrainerBeenFought
def_special ScrSpecial_EndTrainerApproach def_special EndTrainerApproach
def_special PlayTrainerEncounterMusic def_special PlayTrainerEncounterMusic
def_special ShouldTryRematchBattle def_special ShouldTryRematchBattle
def_special ScrSpecial_GetTrainerEyeRematchFlag def_special IsTrainerReadyForRematch
def_special ScrSpecial_StartTrainerEyeRematch def_special BattleSetup_StartRematchBattle
def_special ShowPokemonStorageSystem def_special ShowPokemonStorageSystem
def_special HasEnoughMonsForDoubleBattle def_special HasEnoughMonsForDoubleBattle
def_special NullFieldSpecial def_special NullFieldSpecial
+4 -5
View File
@@ -18,19 +18,18 @@ const u8 *BattleSetup_ConfigureTrainerBattle(const u8 *data);
void ConfigureAndSetUpOneTrainerBattle(u8 trainerEventObjId, const u8 *trainerScript); void ConfigureAndSetUpOneTrainerBattle(u8 trainerEventObjId, const u8 *trainerScript);
bool32 GetTrainerFlagFromScriptPointer(const u8 *data); bool32 GetTrainerFlagFromScriptPointer(const u8 *data);
void SetUpTrainerMovement(void); void SetUpTrainerMovement(void);
u8 ScrSpecial_GetTrainerBattleMode(void); u8 GetTrainerBattleMode(void);
u16 GetRivalBattleFlags(void); u16 GetRivalBattleFlags(void);
u16 ScrSpecial_HasTrainerBeenFought(void);
void SetBattledTrainerFlag(void); void SetBattledTrainerFlag(void);
bool8 HasTrainerBeenFought(u16 trainerId); bool8 HasTrainerBeenFought(u16 trainerId);
void SetTrainerFlag(u16 trainerId); void SetTrainerFlag(u16 trainerId);
void ClearTrainerFlag(u16 trainerId); void ClearTrainerFlag(u16 trainerId);
void BattleSetup_StartTrainerBattle(void); void BattleSetup_StartTrainerBattle(void);
void ScrSpecial_StartTrainerEyeRematch(void); void BattleSetup_StartRematchBattle(void);
void ScrSpecial_ShowTrainerIntroSpeech(void); void ShowTrainerIntroSpeech(void);
const u8 *BattleSetup_GetScriptAddrAfterBattle(void); const u8 *BattleSetup_GetScriptAddrAfterBattle(void);
const u8 *BattleSetup_GetTrainerPostBattleScript(void); const u8 *BattleSetup_GetTrainerPostBattleScript(void);
void ScrSpecial_ShowTrainerNonBattlingSpeech(void); void ShowTrainerCantBattleSpeech(void);
void PlayTrainerEncounterMusic(void); void PlayTrainerEncounterMusic(void);
const u8 *GetTrainerALoseText(void); const u8 *GetTrainerALoseText(void);
const u8 *GetTrainerWonSpeech(void); const u8 *GetTrainerWonSpeech(void);
+2 -2
View File
@@ -1155,12 +1155,12 @@ extern const u8 SafariZone_EventScript_OutOfBalls[];
extern const u8 EventScript_ItemfinderDigUpUnderfootItem[]; extern const u8 EventScript_ItemfinderDigUpUnderfootItem[];
// battle_setup // battle_setup
extern const u8 EventScript_DoTrainerBattle[]; extern const u8 EventScript_DoNoIntroTrainerBattle[];
extern const u8 EventScript_TryDoDoubleTrainerBattle[]; extern const u8 EventScript_TryDoDoubleTrainerBattle[];
extern const u8 EventScript_TryDoNormalTrainerBattle[]; extern const u8 EventScript_TryDoNormalTrainerBattle[];
extern const u8 EventScript_TryDoDoubleRematchBattle[]; extern const u8 EventScript_TryDoDoubleRematchBattle[];
extern const u8 EventScript_TryDoRematchBattle[]; extern const u8 EventScript_TryDoRematchBattle[];
extern const u8 gUnknown_81A4EB4[]; extern const u8 EventScript_DoTrainerBattleFromApproach[];
extern const u8 Test_EventScript_Sign[]; extern const u8 Test_EventScript_Sign[];
// new_game // new_game
+1 -1
View File
@@ -3713,7 +3713,7 @@ static void HandleEndTurn_BattleLost(void)
} }
else else
{ {
if (gBattleTypeFlags & BATTLE_TYPE_TRAINER && ScrSpecial_GetTrainerBattleMode() == TRAINER_BATTLE_EARLY_RIVAL) if (gBattleTypeFlags & BATTLE_TYPE_TRAINER && GetTrainerBattleMode() == TRAINER_BATTLE_EARLY_RIVAL)
{ {
if (GetRivalBattleFlags() & RIVAL_BATTLE_HEAL_AFTER) if (GetRivalBattleFlags() & RIVAL_BATTLE_HEAL_AFTER)
gBattleCommunication[MULTISTRING_CHOOSER] = 1; // Dont do white out text gBattleCommunication[MULTISTRING_CHOOSER] = 1; // Dont do white out text
+8 -8
View File
@@ -778,7 +778,7 @@ const u8 *BattleSetup_ConfigureTrainerBattle(const u8 *data)
{ {
case TRAINER_BATTLE_SINGLE_NO_INTRO_TEXT: case TRAINER_BATTLE_SINGLE_NO_INTRO_TEXT:
TrainerBattleLoadArgs(sOrdinaryNoIntroBattleParams, data); TrainerBattleLoadArgs(sOrdinaryNoIntroBattleParams, data);
return EventScript_DoTrainerBattle; return EventScript_DoNoIntroTrainerBattle;
case TRAINER_BATTLE_DOUBLE: case TRAINER_BATTLE_DOUBLE:
TrainerBattleLoadArgs(sDoubleBattleParams, data); TrainerBattleLoadArgs(sDoubleBattleParams, data);
SetMapVarsToTrainer(); SetMapVarsToTrainer();
@@ -807,7 +807,7 @@ const u8 *BattleSetup_ConfigureTrainerBattle(const u8 *data)
return EventScript_TryDoRematchBattle; return EventScript_TryDoRematchBattle;
case TRAINER_BATTLE_EARLY_RIVAL: case TRAINER_BATTLE_EARLY_RIVAL:
TrainerBattleLoadArgs(sEarlyRivalBattleParams, data); TrainerBattleLoadArgs(sEarlyRivalBattleParams, data);
return EventScript_DoTrainerBattle; return EventScript_DoNoIntroTrainerBattle;
default: default:
TrainerBattleLoadArgs(sOrdinaryBattleParams, data); TrainerBattleLoadArgs(sOrdinaryBattleParams, data);
SetMapVarsToTrainer(); SetMapVarsToTrainer();
@@ -820,7 +820,7 @@ void ConfigureAndSetUpOneTrainerBattle(u8 trainerEventObjId, const u8 *trainerSc
gSelectedObjectEvent = trainerEventObjId; gSelectedObjectEvent = trainerEventObjId;
gSpecialVar_LastTalked = gObjectEvents[trainerEventObjId].localId; gSpecialVar_LastTalked = gObjectEvents[trainerEventObjId].localId;
BattleSetup_ConfigureTrainerBattle(trainerScript + 1); BattleSetup_ConfigureTrainerBattle(trainerScript + 1);
ScriptContext1_SetupScript(gUnknown_81A4EB4); ScriptContext1_SetupScript(EventScript_DoTrainerBattleFromApproach);
ScriptContext2_Enable(); ScriptContext2_Enable();
} }
@@ -838,7 +838,7 @@ void SetUpTrainerMovement(void)
SetTrainerMovementType(objectEvent, GetTrainerFacingDirectionMovementType(objectEvent->facingDirection)); SetTrainerMovementType(objectEvent, GetTrainerFacingDirectionMovementType(objectEvent->facingDirection));
} }
u8 ScrSpecial_GetTrainerBattleMode(void) u8 GetTrainerBattleMode(void)
{ {
return sTrainerBattleMode; return sTrainerBattleMode;
} }
@@ -882,7 +882,7 @@ void ClearTrainerFlag(u16 trainerId)
void BattleSetup_StartTrainerBattle(void) void BattleSetup_StartTrainerBattle(void)
{ {
gBattleTypeFlags = BATTLE_TYPE_TRAINER; gBattleTypeFlags = BATTLE_TYPE_TRAINER;
if (ScrSpecial_GetTrainerBattleMode() == TRAINER_BATTLE_EARLY_RIVAL && GetRivalBattleFlags() & RIVAL_BATTLE_TUTORIAL) if (GetTrainerBattleMode() == TRAINER_BATTLE_EARLY_RIVAL && GetRivalBattleFlags() & RIVAL_BATTLE_TUTORIAL)
gBattleTypeFlags |= BATTLE_TYPE_FIRST_BATTLE; gBattleTypeFlags |= BATTLE_TYPE_FIRST_BATTLE;
gMain.savedCallback = CB2_EndTrainerBattle; gMain.savedCallback = CB2_EndTrainerBattle;
DoTrainerBattle(); DoTrainerBattle();
@@ -956,7 +956,7 @@ static void CB2_EndRematchBattle(void)
} }
} }
void ScrSpecial_StartTrainerEyeRematch(void) void BattleSetup_StartRematchBattle(void)
{ {
gBattleTypeFlags = BATTLE_TYPE_TRAINER; gBattleTypeFlags = BATTLE_TYPE_TRAINER;
gMain.savedCallback = CB2_EndRematchBattle; gMain.savedCallback = CB2_EndRematchBattle;
@@ -964,7 +964,7 @@ void ScrSpecial_StartTrainerEyeRematch(void)
ScriptContext1_Stop(); ScriptContext1_Stop();
} }
void ScrSpecial_ShowTrainerIntroSpeech(void) void ShowTrainerIntroSpeech(void)
{ {
ShowFieldMessage(GetIntroSpeechOfApproachingTrainer()); ShowFieldMessage(GetIntroSpeechOfApproachingTrainer());
} }
@@ -985,7 +985,7 @@ const u8 *BattleSetup_GetTrainerPostBattleScript(void)
return Test_EventScript_Sign; return Test_EventScript_Sign;
} }
void ScrSpecial_ShowTrainerNonBattlingSpeech(void) void ShowTrainerCantBattleSpeech(void)
{ {
ShowFieldMessage(GetTrainerCantBattleSpeech()); ShowFieldMessage(GetTrainerCantBattleSpeech());
} }
+1 -1
View File
@@ -544,7 +544,7 @@ void MovementAction_RevealTrainer_RunTrainerSeeFuncList(struct ObjectEvent *var)
StoreWordInTwoHalfwords((u16 *)&gTasks[CreateTask(Task_RevealTrainer_RunTrainerSeeFuncList, 0)].data[1], (u32)var); StoreWordInTwoHalfwords((u16 *)&gTasks[CreateTask(Task_RevealTrainer_RunTrainerSeeFuncList, 0)].data[1], (u32)var);
} }
void ScrSpecial_EndTrainerApproach(void) void EndTrainerApproach(void)
{ {
StartTrainerApproachWithFollowupTask(Task_DestroyTrainerApproachTask); StartTrainerApproachWithFollowupTask(Task_DestroyTrainerApproachTask);
} }
+1 -1
View File
@@ -1086,7 +1086,7 @@ s32 GetRematchTrainerId(u16 a0)
return sVsSeekerData[i].trainerIdxs[j]; return sVsSeekerData[i].trainerIdxs[j];
} }
u8 ScrSpecial_GetTrainerEyeRematchFlag(void) // unreferenced, or reference not disassembled u8 IsTrainerReadyForRematch(void)
{ {
return sub_810CED0(sVsSeekerData, gTrainerBattleOpponent_A); return sub_810CED0(sVsSeekerData, gTrainerBattleOpponent_A);
} }