Use macros for Trainer Hill

This commit is contained in:
GriffinR 2019-11-23 16:08:50 -05:00 committed by huderlem
parent 4dfa959fa2
commit 08a8dc46e3
7 changed files with 153 additions and 82 deletions

View File

@ -166,12 +166,107 @@ setvar VAR_0x8004, BATTLE_PIKE_FUNC_IS_PARTY_FULL_HEALTH
special CallBattlePikeFunction
.endm
@ Battle Pyramid
@ Battle Tent
@ Trainer Hill
.macro trainerhill_start
setvar VAR_0x8004, TRAINER_HILL_FUNC_START
special CallTrainerHillFunction
.endm
.macro trainerhill_getownerstate
setvar VAR_0x8004, TRAINER_HILL_FUNC_GET_OWNER_STATE
special CallTrainerHillFunction
.endm
.macro trainerhill_giveprize
setvar VAR_0x8004, TRAINER_HILL_FUNC_GIVE_PRIZE
special CallTrainerHillFunction
.endm
.macro trainerhill_finaltime
setvar VAR_0x8004, TRAINER_HILL_FUNC_CHECK_FINAL_TIME
special CallTrainerHillFunction
.endm
.macro trainerhill_resumetimer
setvar VAR_0x8004, TRAINER_HILL_FUNC_RESUME_TIMER
special CallTrainerHillFunction
.endm
.macro trainerhill_lost
setvar VAR_0x8004, TRAINER_HILL_FUNC_SET_LOST
special CallTrainerHillFunction
.endm
.macro trainerhill_getstatus
setvar VAR_0x8004, TRAINER_HILL_FUNC_GET_CHALLENGE_STATUS
special CallTrainerHillFunction
.endm
.macro trainerhill_gettime
setvar VAR_0x8004, TRAINER_HILL_FUNC_GET_CHALLENGE_TIME
special CallTrainerHillFunction
.endm
.macro trainerhill_allfloorsused
setvar VAR_0x8004, TRAINER_HILL_FUNC_GET_ALL_FLOORS_USED
special CallTrainerHillFunction
.endm
.macro trainerhill_clearresult
setvar VAR_0x8004, TRAINER_HILL_FUNC_CLEAR_RESULT
special CallTrainerHillFunction
.endm
.macro trainerhill_inchallenge
setvar VAR_0x8004, TRAINER_HILL_FUNC_IN_CHALLENGE
special CallTrainerHillFunction
.endm
.macro trainerhill_postbattletext
setvar VAR_0x8004, TRAINER_HILL_FUNC_POST_BATTLE_TEXT
special CallTrainerHillFunction
.endm
.macro trainerhill_settrainerflags
setvar VAR_0x8004, TRAINER_HILL_FUNC_SET_ALL_TRAINER_FLAGS
special CallTrainerHillFunction
.endm
.macro trainerhill_getsaved
setvar VAR_0x8004, TRAINER_HILL_FUNC_GET_GAME_SAVED
special CallTrainerHillFunction
.endm
.macro trainerhill_setsaved
setvar VAR_0x8004, TRAINER_HILL_FUNC_SET_GAME_SAVED
special CallTrainerHillFunction
.endm
.macro trainerhill_clearsaved
setvar VAR_0x8004, TRAINER_HILL_FUNC_CLEAR_GAME_SAVED
special CallTrainerHillFunction
.endm
.macro trainerhill_getwon
setvar VAR_0x8004, TRAINER_HILL_FUNC_GET_WON
special CallTrainerHillFunction
.endm
.macro trainerhill_settag tag:req
setvar VAR_0x8004, TRAINER_HILL_FUNC_SET_TAG
copyvar VAR_0x8005, \tag
special CallTrainerHillFunction
.endm
@ Apprentice
.macro apprentice_gavelvlmode

View File

@ -16,11 +16,9 @@ TrainerHill_Entrance_OnWarp: @ 82680CF
end
TrainerHill_Entrance_OnResume: @ 82680D0
setvar VAR_0x8004, TRAINER_HILL_FUNC_RESUME_TIMER
special CallTrainerHillFunction
trainerhill_resumetimer
setvar VAR_TEMP_0, 0
setvar VAR_0x8004, TRAINER_HILL_FUNC_CLEAR_RESULT
special CallTrainerHillFunction
trainerhill_clearresult
compare VAR_RESULT, 0 @ VAR_RESULT always 0 here
goto_if_eq TrainerHill_Entrance_EventScript_TryFaceAttendant
setobjectxy EVENT_OBJ_ID_PLAYER, 9, 6
@ -28,8 +26,7 @@ TrainerHill_Entrance_OnResume: @ 82680D0
end
TrainerHill_Entrance_EventScript_TryFaceAttendant:: @ 82680FF
setvar VAR_0x8004, TRAINER_HILL_FUNC_GET_WON
special CallTrainerHillFunction
trainerhill_getwon
compare VAR_RESULT, TRUE
goto_if_eq TrainerHill_Entrance_EventScript_PlayerDontFaceAttendant
applymovement EVENT_OBJ_ID_PLAYER, TrainerHill_Entrance_Movement_PlayerFaceAttendant
@ -75,8 +72,7 @@ TrainerHill_Entrance_EventScript_ExitElevator:: @ 8268160
TrainerHill_Entrance_EventScript_ExitChallenge:: @ 8268182
setvar VAR_TEMP_0, 1
setvar VAR_0x8004, TRAINER_HILL_FUNC_GET_CHALLENGE_STATUS
special CallTrainerHillFunction
trainerhill_getstatus
switch VAR_RESULT
case TRAINER_HILL_PLAYER_STATUS_LOST, TrainerHill_Entrance_EventScript_ExitChallengeLost
case TRAINER_HILL_PLAYER_STATUS_ECARD_SCANNED, TrainerHill_Entrance_EventScript_ExitChallengeECard
@ -113,8 +109,7 @@ TrainerHill_Entrance_EventScript_Nurse:: @ 82681EF
TrainerHill_Entrance_EventScript_Attendant:: @ 82681FD
lock
faceplayer
setvar VAR_0x8004, TRAINER_HILL_FUNC_IN_CHALLENGE
special CallTrainerHillFunction
trainerhill_inchallenge
compare VAR_RESULT, FALSE
goto_if_eq TrainerHill_Entrance_EventScript_ThanksForPlaying
msgbox TrainerHill_Entrance_Text_HopeYouGiveItYourBest, MSGBOX_DEFAULT
@ -131,12 +126,10 @@ TrainerHill_Entrance_EventScript_EntryTrigger:: @ 8268229
applymovement EVENT_OBJ_ID_PLAYER, TrainerHill_Entrance_Movement_PlayerFaceAttendant
goto_if_unset FLAG_SYS_GAME_CLEAR, TrainerHill_Entrance_EventScript_Closed
msgbox TrainerHill_Entrance_Text_WelcomeToTrainerHill, MSGBOX_DEFAULT
setvar VAR_0x8004, TRAINER_HILL_FUNC_GET_GAME_SAVED
special CallTrainerHillFunction
trainerhill_getsaved
compare VAR_RESULT, FALSE
call_if_eq TrainerHill_Entrance_EventScript_SaveGame
setvar VAR_0x8004, TRAINER_HILL_FUNC_GET_ALL_FLOORS_USED
special CallTrainerHillFunction
trainerhill_allfloorsused
compare VAR_RESULT, TRUE
goto_if_eq TrainerHill_Entrance_EventScript_AllFloorsUsed
msgbox TrainerHill_Entrance_Text_TrainersUpToFloorX, MSGBOX_DEFAULT
@ -165,15 +158,12 @@ TrainerHill_Entrance_EventScript_ChooseChallenge:: @ 82682C8
switch VAR_RESULT
case 4, TrainerHill_Entrance_EventScript_CancelEntry
case MULTI_B_PRESSED, TrainerHill_Entrance_EventScript_CancelEntry
setvar VAR_0x8004, TRAINER_HILL_FUNC_SET_TAG
copyvar VAR_0x8005, VAR_RESULT
special CallTrainerHillFunction
trainerhill_settag VAR_RESULT
setvar VAR_TRAINER_HILL_IS_ACTIVE, 1
setvar VAR_TEMP_5, 0
special HealPlayerParty
msgbox TrainerHill_Entrance_Text_TimeProgessGetSetGo, MSGBOX_DEFAULT
setvar VAR_0x8004, TRAINER_HILL_FUNC_START
special CallTrainerHillFunction
trainerhill_start
releaseall
end
@ -188,19 +178,16 @@ TrainerHill_Entrance_EventScript_CancelEntry:: @ 8268314
TrainerHill_Entrance_EventScript_SaveGame:: @ 826832E
msgbox TrainerHill_Entrance_Text_SaveGameBeforeEnter, MSGBOX_DEFAULT
setvar VAR_0x8004, TRAINER_HILL_FUNC_SET_GAME_SAVED
special CallTrainerHillFunction
trainerhill_setsaved
setvar VAR_TEMP_5, 1
call Common_EventScript_SaveGame
compare VAR_RESULT, FALSE
goto_if_eq TrainerHill_Entrance_EventScript_SaveFailed
setvar VAR_0x8004, TRAINER_HILL_FUNC_SET_GAME_SAVED
special CallTrainerHillFunction
trainerhill_setsaved
return
TrainerHill_Entrance_EventScript_SaveFailed:: @ 826835C
setvar VAR_0x8004, TRAINER_HILL_FUNC_CLEAR_GAME_SAVED
special CallTrainerHillFunction
trainerhill_clearsaved
goto TrainerHill_Entrance_EventScript_CancelEntry
end

View File

@ -4,12 +4,10 @@ TrainerHill_Roof_MapScripts:: @ 8268FA7
.byte 0
TrainerHill_Roof_EventScript_Owner:: @ 8268FB2
setvar VAR_0x8004, TRAINER_HILL_FUNC_SET_ALL_TRAINER_FLAGS
special CallTrainerHillFunction
trainerhill_settrainerflags
lock
faceplayer
setvar VAR_0x8004, TRAINER_HILL_FUNC_GET_OWNER_STATE
special CallTrainerHillFunction
trainerhill_getownerstate
switch VAR_RESULT
case 0, TrainerHill_Roof_EventScript_Arrived
case 1, TrainerHill_Roof_EventScript_GivePrize
@ -17,8 +15,7 @@ TrainerHill_Roof_EventScript_Owner:: @ 8268FB2
TrainerHill_Roof_EventScript_Arrived:: @ 8268FEA
msgbox TrainerHill_Roof_Text_YouFinallyCameBravo, MSGBOX_DEFAULT
TrainerHill_Roof_EventScript_GivePrize:: @ 8268FF2
setvar VAR_0x8004, TRAINER_HILL_FUNC_GIVE_PRIZE
special CallTrainerHillFunction
trainerhill_giveprize
switch VAR_RESULT
case 0, TrainerHill_Roof_EventScript_ReceivePrize
case 1, TrainerHill_Roof_EventScript_NoRoomForPrize
@ -38,8 +35,7 @@ TrainerHill_Roof_EventScript_NoRoomForPrize:: @ 8269037
goto TrainerHill_Roof_EventScript_CheckFinalTime
TrainerHill_Roof_EventScript_CheckFinalTime:: @ 8269054
setvar VAR_0x8004, TRAINER_HILL_FUNC_CHECK_FINAL_TIME
special CallTrainerHillFunction
trainerhill_finaltime
switch VAR_RESULT
case 0, TrainerHill_Roof_EventScript_NewRecord
case 1, TrainerHill_Roof_EventScript_NoNewRecord

View File

@ -39,9 +39,8 @@ EventScript_FrontierFieldWhiteOut:: @ 82736F8
goto_if_eq BattleFrontier_BattlePyramidTop_EventScript_252B42
compare VAR_RESULT, 2
goto_if_eq BattleFrontier_BattlePyramidTop_EventScript_252B42
setvar VAR_0x8004, TRAINER_HILL_FUNC_IN_CHALLENGE
special CallTrainerHillFunction
compare VAR_RESULT, 1
trainerhill_inchallenge
compare VAR_RESULT, TRUE
goto_if_eq TrainerHill_1F_EventScript_Lost
special Script_FadeOutMapMusic
waitstate

View File

@ -1,7 +1,6 @@
TrainerHill_OnResume: @ 82C8336
setvar VAR_TEMP_2, 0
setvar VAR_0x8004, TRAINER_HILL_FUNC_RESUME_TIMER
special CallTrainerHillFunction
trainerhill_resumetimer
frontier_getbattleoutcome
compare VAR_RESULT, B_OUTCOME_LOST
goto_if_eq TrainerHill_1F_EventScript_Lost
@ -26,16 +25,14 @@ TrainerHill_OnFrame: @ 82C8381
EventScript_TrainerHillTimer:: @ 82C8393
lockall
setvar VAR_0x8004, TRAINER_HILL_FUNC_GET_CHALLENGE_TIME
special CallTrainerHillFunction
trainerhill_gettime
msgbox TrainerHill_Entrance_Text_ChallengeTime, MSGBOX_DEFAULT
releaseall
end
TrainerHill_1F_EventScript_DummyWarpToEntranceCounter:: @ 82C83A6
setvar VAR_TEMP_2, 1
setvar VAR_0x8004, TRAINER_HILL_FUNC_CLEAR_RESULT
special CallTrainerHillFunction
trainerhill_clearresult
compare VAR_RESULT, 1 @ VAR_RESULT always 0 here
goto_if_eq TrainerHill_1F_EventScript_WarpSilentToEntranceCounter
end
@ -47,10 +44,8 @@ TrainerHill_1F_EventScript_WarpSilentToEntranceCounter:: @ 82C83BF
end
TrainerHill_1F_EventScript_Lost:: @ 82C83C9
setvar VAR_0x8004, TRAINER_HILL_FUNC_SET_ALL_TRAINER_FLAGS
special CallTrainerHillFunction
setvar VAR_0x8004, TRAINER_HILL_FUNC_SET_LOST
special CallTrainerHillFunction
trainerhill_settrainerflags
trainerhill_lost
setvar VAR_TEMP_1, 1
end
@ -68,8 +63,7 @@ TrainerHill_1F_Movement_SetInvisible:: @ 82C83EE
@ TRAINER_PHILLIP is an actual Trainer on the SS Tidal, but is used as a placeholder here
TrainerHill_EventScript_TrainerBattle:: @ 82C83F0
trainerbattle TRAINER_BATTLE_HILL, TRAINER_PHILLIP, 0, BattleFacility_TrainerBattle_PlaceholderText, BattleFacility_TrainerBattle_PlaceholderText
setvar VAR_0x8004, TRAINER_HILL_FUNC_POST_BATTLE_TEXT
special CallTrainerHillFunction
trainerhill_postbattletext
waitmessage
waitbuttonpress
closemessage