mirror of
https://github.com/pret/pokeplatinum.git
synced 2026-08-14 13:11:45 -05:00
236 lines
7.2 KiB
ArmAsm
236 lines
7.2 KiB
ArmAsm
#include "macros/scrcmd.inc"
|
|
#include "res/text/bank/common_strings.h"
|
|
#include "generated/trainer_message_types.h"
|
|
#include "constants/approach_type.h"
|
|
#include "res/trainers/trainer_scripts.h"
|
|
|
|
|
|
Battles_Trainer:
|
|
PlaySE SEQ_SE_CONFIRM
|
|
LockAll
|
|
FacePlayer
|
|
GetTrainerID VAR_0x8004
|
|
GetMovementType VAR_0x8001, VAR_LAST_TALKED
|
|
CallIfEq VAR_0x8001, MOVEMENT_TYPE_DISGUISE_SNOW, Battles_RevealTrainer
|
|
CallIfEq VAR_0x8001, MOVEMENT_TYPE_DISGUISE_SAND, Battles_RevealTrainer
|
|
CallIfEq VAR_0x8001, MOVEMENT_TYPE_DISGUISE_ROCK, Battles_RevealTrainer
|
|
CallIfEq VAR_0x8001, MOVEMENT_TYPE_DISGUISE_GRASS, Battles_RevealTrainer
|
|
GoToIfDefeated VAR_0x8004, Battles_TryRematch
|
|
CheckIsTrainerDoubleBattle VAR_RESULT
|
|
GoToIfNe VAR_RESULT, TRUE, Battles_StartTrainerEncounter
|
|
CheckHasTwoAliveMons VAR_RESULT
|
|
GoToIfEq VAR_RESULT, FALSE, Battles_NotEnoughPokemonMessage
|
|
GoTo Battles_StartTrainerEncounter
|
|
End
|
|
|
|
Battles_StartTrainerEncounter:
|
|
PlayTrainerEncounterBGM VAR_0x8004
|
|
OpenMessage
|
|
GetTrainerMessageTypes VAR_0x8000, VAR_0x8001, VAR_0x8002
|
|
PrintTrainerDialogue VAR_0x8004, VAR_0x8000
|
|
GoTo Battles_DoTrainerBattle
|
|
End
|
|
|
|
Battles_DoTrainerBattle:
|
|
CloseMessage
|
|
SetMoveCodeForFacingDirection
|
|
StartTrainerBattle VAR_0x8004
|
|
CheckWonBattle VAR_RESULT
|
|
GoToIfEq VAR_RESULT, FALSE, Battles_LostBattle
|
|
SetTrainerFlag VAR_0x8004
|
|
ReleaseAll
|
|
End
|
|
|
|
Battles_TryRematch:
|
|
GetRematchTrainerID VAR_0x8004, VAR_RESULT
|
|
GoToIfNe VAR_RESULT, TRAINER_NONE, Battles_Rematch
|
|
GoTo Battles_PostBattleMessage
|
|
End
|
|
|
|
Battles_PostBattleMessage:
|
|
OpenMessage
|
|
GetTrainerMessageTypes VAR_0x8000, VAR_0x8001, VAR_0x8002
|
|
PrintTrainerDialogue VAR_0x8004, VAR_0x8001
|
|
WaitButton
|
|
CloseMessage
|
|
ReleaseAll
|
|
End
|
|
|
|
Battles_Rematch:
|
|
SetVar VAR_0x8007, VAR_RESULT
|
|
CheckIsTrainerDoubleBattle VAR_RESULT
|
|
GoToIfNe VAR_RESULT, TRUE, Battles_StartRematchEncounter
|
|
CheckHasTwoAliveMons VAR_RESULT
|
|
GoToIfEq VAR_RESULT, FALSE, Battles_NotEnoughPokemonMessage
|
|
GoTo Battles_StartRematchEncounter
|
|
End
|
|
|
|
Battles_StartRematchEncounter:
|
|
PlayTrainerEncounterBGM VAR_0x8004
|
|
OpenMessage
|
|
GetTrainerRematchMessageTypes VAR_0x8000, VAR_0x8001, VAR_0x8002
|
|
PrintTrainerDialogue VAR_0x8004, VAR_0x8000
|
|
SetVar VAR_0x8004, VAR_0x8007
|
|
GoTo Battles_DoTrainerBattle
|
|
End
|
|
|
|
Battles_LostBattle:
|
|
BlackOutFromBattle
|
|
ReleaseAll
|
|
End
|
|
|
|
Battles_NotEnoughPokemonMessage:
|
|
GetTrainerID VAR_0x8004
|
|
OpenMessage
|
|
GetTrainerMessageTypes VAR_0x8000, VAR_0x8001, VAR_0x8002
|
|
PrintTrainerDialogue VAR_0x8004, VAR_0x8002
|
|
WaitABPress
|
|
CloseMessage
|
|
ReleaseAll
|
|
End
|
|
|
|
Battles_RevealTrainer:
|
|
ApplyMovement VAR_LAST_TALKED, Battles_Movement_RevealTrainer
|
|
WaitMovement
|
|
GetPlayerDir VAR_0x8000
|
|
CallIfEq VAR_0x8000, DIR_NORTH, Battles_SetTrainerLookSouth
|
|
CallIfEq VAR_0x8000, DIR_SOUTH, Battles_SetTrainerLookNorth
|
|
CallIfEq VAR_0x8000, DIR_WEST, Battles_SetTrainerLookEast
|
|
CallIfEq VAR_0x8000, DIR_EAST, Battles_SetTrainerLookWest
|
|
Return
|
|
|
|
Battles_SetTrainerLookSouth:
|
|
SetMovementType VAR_LAST_TALKED, MOVEMENT_TYPE_LOOK_SOUTH
|
|
Return
|
|
|
|
Battles_SetTrainerLookNorth:
|
|
SetMovementType VAR_LAST_TALKED, MOVEMENT_TYPE_LOOK_NORTH
|
|
Return
|
|
|
|
Battles_SetTrainerLookEast:
|
|
SetMovementType VAR_LAST_TALKED, MOVEMENT_TYPE_LOOK_EAST
|
|
Return
|
|
|
|
Battles_SetTrainerLookWest:
|
|
SetMovementType VAR_LAST_TALKED, MOVEMENT_TYPE_LOOK_WEST
|
|
Return
|
|
|
|
.balign 4, 0
|
|
Battles_Movement_RevealTrainer:
|
|
RevealTrainer
|
|
EndMovement
|
|
|
|
Battles_ApproachingTrainer:
|
|
LockAll
|
|
GetApproachingTrainerType VAR_RESULT
|
|
GoToIfEq VAR_RESULT, APPROACH_TYPE_SINGLES, Battles_ApproachingTrainerSingles
|
|
GoToIfEq VAR_RESULT, APPROACH_TYPE_DOUBLES, Battles_ApproachingTrainerDoubles
|
|
GoToIfEq VAR_RESULT, APPROACH_TYPE_VS2, Battles_ApproachingTrainerVS2
|
|
End
|
|
|
|
Battles_ApproachingTrainerSingles:
|
|
GetApproachingTrainerID 0, VAR_RESULT
|
|
SetVar VAR_0x8004, VAR_RESULT
|
|
PlayTrainerEncounterBGM VAR_0x8004
|
|
StartApproachingTrainerTask 0
|
|
Call Battles_WaitTrainerSinglesTaskDone
|
|
GetApproachingTrainerID 0, VAR_RESULT
|
|
SetVar VAR_0x8004, VAR_RESULT
|
|
OpenMessage
|
|
PrintTrainerDialogue VAR_0x8004, TRMSG_PRE_BATTLE
|
|
CloseMessage
|
|
StartTrainerBattle VAR_0x8004
|
|
CheckWonBattle VAR_RESULT
|
|
GoToIfEq VAR_RESULT, FALSE, Battles_LostBattle
|
|
GetApproachingTrainerID 0, VAR_RESULT
|
|
SetVar VAR_0x8004, VAR_RESULT
|
|
SetTrainerFlag VAR_0x8004
|
|
ReleaseAll
|
|
End
|
|
|
|
Battles_WaitTrainerSinglesTaskDone:
|
|
CheckIsApproachingTrainerTaskDone 0, VAR_RESULT
|
|
GoToIfEq VAR_RESULT, FALSE, Battles_WaitTrainerSinglesTaskDone
|
|
Return
|
|
|
|
Battles_ApproachingTrainerDoubles:
|
|
GetApproachingTrainerID 0, VAR_RESULT
|
|
SetVar VAR_0x8004, VAR_RESULT
|
|
PlayTrainerEncounterBGM VAR_0x8004
|
|
StartApproachingTrainerTask 0
|
|
StartApproachingTrainerTask 1
|
|
Call Battles_WaitTrainersDoublesTasksDone
|
|
GetApproachingTrainerID 0, VAR_RESULT
|
|
SetVar VAR_0x8004, VAR_RESULT
|
|
OpenMessage
|
|
PrintTrainerDialogue VAR_0x8004, TRMSG_PRE_DOUBLE_BATTLE_1
|
|
CloseMessage
|
|
GetApproachingTrainerID 1, VAR_RESULT
|
|
SetVar VAR_0x8005, VAR_RESULT
|
|
OpenMessage
|
|
PrintTrainerDialogue VAR_0x8005, TRMSG_PRE_DOUBLE_BATTLE_2
|
|
CloseMessage
|
|
StartTrainerBattle VAR_0x8004, VAR_0x8005
|
|
CheckWonBattle VAR_RESULT
|
|
GoToIfEq VAR_RESULT, FALSE, Battles_LostBattle
|
|
GetApproachingTrainerID 0, VAR_RESULT
|
|
SetVar VAR_0x8004, VAR_RESULT
|
|
SetTrainerFlag VAR_0x8004
|
|
GetApproachingTrainerID 1, VAR_RESULT
|
|
SetVar VAR_0x8005, VAR_RESULT
|
|
SetTrainerFlag VAR_0x8005
|
|
ReleaseAll
|
|
End
|
|
|
|
Battles_WaitTrainersDoublesTasksDone:
|
|
CheckIsApproachingTrainerTaskDone 0, VAR_RESULT
|
|
GoToIfEq VAR_RESULT, FALSE, Battles_WaitTrainersDoublesTasksDone
|
|
CheckIsApproachingTrainerTaskDone 1, VAR_RESULT
|
|
GoToIfEq VAR_RESULT, FALSE, Battles_WaitTrainersDoublesTasksDone
|
|
Return
|
|
|
|
Battles_ApproachingTrainerVS2:
|
|
GetApproachingTrainerID 0, VAR_RESULT
|
|
SetVar VAR_0x8004, VAR_RESULT
|
|
PlayTrainerEncounterBGM VAR_0x8004
|
|
StartApproachingTrainerTask 0
|
|
Call Battles_WaitTrainer0VS2TaskDone
|
|
GetApproachingTrainerID 0, VAR_RESULT
|
|
SetVar VAR_0x8004, VAR_RESULT
|
|
OpenMessage
|
|
PrintTrainerDialogue VAR_0x8004, TRMSG_PRE_BATTLE
|
|
CloseMessage
|
|
GetApproachingTrainerID 1, VAR_RESULT
|
|
SetVar VAR_0x8005, VAR_RESULT
|
|
PlayTrainerEncounterBGM VAR_0x8005
|
|
StartApproachingTrainerTask 1
|
|
Call Battles_WaitTrainer1VS2TaskDone
|
|
GetApproachingTrainerID 1, VAR_RESULT
|
|
SetVar VAR_0x8005, VAR_RESULT
|
|
OpenMessage
|
|
PrintTrainerDialogue VAR_0x8005, TRMSG_PRE_BATTLE
|
|
CloseMessage
|
|
StartTrainerBattle VAR_0x8004, VAR_0x8005
|
|
CheckWonBattle VAR_RESULT
|
|
GoToIfEq VAR_RESULT, FALSE, Battles_LostBattle
|
|
GetApproachingTrainerID 0, VAR_RESULT
|
|
SetVar VAR_0x8004, VAR_RESULT
|
|
SetTrainerFlag VAR_0x8004
|
|
GetApproachingTrainerID 1, VAR_RESULT
|
|
SetVar VAR_0x8005, VAR_RESULT
|
|
SetTrainerFlag VAR_0x8005
|
|
ReleaseAll
|
|
End
|
|
|
|
Battles_WaitTrainer0VS2TaskDone:
|
|
CheckIsApproachingTrainerTaskDone 0, VAR_RESULT
|
|
GoToIfEq VAR_RESULT, FALSE, Battles_WaitTrainer0VS2TaskDone
|
|
Return
|
|
|
|
Battles_WaitTrainer1VS2TaskDone:
|
|
CheckIsApproachingTrainerTaskDone 1, VAR_RESULT
|
|
GoToIfEq VAR_RESULT, FALSE, Battles_WaitTrainer1VS2TaskDone
|
|
Return
|
|
|
|
.balign 4, 0
|