Document Trainer Hill

This commit is contained in:
GriffinR
2019-11-13 16:10:05 -05:00
committed by huderlem
parent 2c3726a328
commit 5e01871f8b
27 changed files with 640 additions and 608 deletions
+1 -1
View File
@@ -677,7 +677,7 @@
.elseif \type == TRAINER_BATTLE_SET_TRAINER_B .elseif \type == TRAINER_BATTLE_SET_TRAINER_B
.4byte \pointer1 @ text .4byte \pointer1 @ text
.4byte \pointer2 @ text .4byte \pointer2 @ text
.elseif \type == TRAINER_BATTLE_12 .elseif \type == TRAINER_BATTLE_HILL
.4byte \pointer1 @ text .4byte \pointer1 @ text
.4byte \pointer2 @ text .4byte \pointer2 @ text
.endif .endif
@@ -152,6 +152,7 @@ BattleFrontier_BattlePyramidEmptySquare_EventScript_252C45:: @ 8252C45
waitstate waitstate
end end
@ TRAINER_PHILLIP is used as a placeholder
BattlePyramid_TrainerBattle:: @ 8252C4F BattlePyramid_TrainerBattle:: @ 8252C4F
trainerbattle TRAINER_BATTLE_PYRAMID, TRAINER_PHILLIP, 0, BattleFacility_TrainerBattle_PlaceholderText, BattleFacility_TrainerBattle_PlaceholderText trainerbattle TRAINER_BATTLE_PYRAMID, TRAINER_PHILLIP, 0, BattleFacility_TrainerBattle_PlaceholderText, BattleFacility_TrainerBattle_PlaceholderText
setvar VAR_0x8004, BATTLE_PYRAMID_FUNC_SHOW_HINT_TEXT setvar VAR_0x8004, BATTLE_PYRAMID_FUNC_SHOW_HINT_TEXT
+3 -3
View File
@@ -1,6 +1,6 @@
TrainerHill_1F_MapScripts:: @ 8268F71 TrainerHill_1F_MapScripts:: @ 8268F71
map_script MAP_SCRIPT_ON_RESUME, TrainerHill_1F_MapScript1_2C8336 map_script MAP_SCRIPT_ON_RESUME, TrainerHill_OnResume
map_script MAP_SCRIPT_ON_WARP_INTO_MAP_TABLE, TrainerHill_1F_MapScript2_2C8372 map_script MAP_SCRIPT_ON_WARP_INTO_MAP_TABLE, TrainerHill_OnWarp
map_script MAP_SCRIPT_ON_FRAME_TABLE, TrainerHill_1F_MapScript2_2C8381 map_script MAP_SCRIPT_ON_FRAME_TABLE, TrainerHill_OnFrame
.byte 0 .byte 0
+3 -3
View File
@@ -1,6 +1,6 @@
TrainerHill_2F_MapScripts:: @ 8268F81 TrainerHill_2F_MapScripts:: @ 8268F81
map_script MAP_SCRIPT_ON_RESUME, TrainerHill_2F_MapScript1_2C8336 map_script MAP_SCRIPT_ON_RESUME, TrainerHill_OnResume
map_script MAP_SCRIPT_ON_WARP_INTO_MAP_TABLE, TrainerHill_2F_MapScript2_2C8372 map_script MAP_SCRIPT_ON_WARP_INTO_MAP_TABLE, TrainerHill_OnWarp
map_script MAP_SCRIPT_ON_FRAME_TABLE, TrainerHill_2F_MapScript2_2C8381 map_script MAP_SCRIPT_ON_FRAME_TABLE, TrainerHill_OnFrame
.byte 0 .byte 0
+2 -2
View File
@@ -1,5 +1,5 @@
TrainerHill_3F_MapScripts:: @ 8268F91 TrainerHill_3F_MapScripts:: @ 8268F91
map_script MAP_SCRIPT_ON_RESUME, TrainerHill_3F_MapScript1_2C8336 map_script MAP_SCRIPT_ON_RESUME, TrainerHill_OnResume
map_script MAP_SCRIPT_ON_FRAME_TABLE, TrainerHill_3F_MapScript2_2C8381 map_script MAP_SCRIPT_ON_FRAME_TABLE, TrainerHill_OnFrame
.byte 0 .byte 0
+2 -2
View File
@@ -1,5 +1,5 @@
TrainerHill_4F_MapScripts:: @ 8268F9C TrainerHill_4F_MapScripts:: @ 8268F9C
map_script MAP_SCRIPT_ON_RESUME, TrainerHill_4F_MapScript1_2C8336 map_script MAP_SCRIPT_ON_RESUME, TrainerHill_OnResume
map_script MAP_SCRIPT_ON_FRAME_TABLE, TrainerHill_4F_MapScript2_2C8381 map_script MAP_SCRIPT_ON_FRAME_TABLE, TrainerHill_OnFrame
.byte 0 .byte 0
+1 -1
View File
@@ -24,7 +24,7 @@
"movement_range_y": 1, "movement_range_y": 1,
"trainer_type": "0", "trainer_type": "0",
"trainer_sight_or_berry_tree_id": "0", "trainer_sight_or_berry_tree_id": "0",
"script": "TrainerHill_Elevator_EventScript_26935F", "script": "TrainerHill_Elevator_EventScript_Attendant",
"flag": "0" "flag": "0"
} }
], ],
+25 -25
View File
@@ -1,89 +1,89 @@
TrainerHill_Elevator_MapScripts:: @ 826934F TrainerHill_Elevator_MapScripts:: @ 826934F
map_script MAP_SCRIPT_ON_FRAME_TABLE, TrainerHill_Elevator_MapScript2_269355 map_script MAP_SCRIPT_ON_FRAME_TABLE, TrainerHill_Elevator_OnFrame
.byte 0 .byte 0
TrainerHill_Elevator_MapScript2_269355: @ 8269355 TrainerHill_Elevator_OnFrame: @ 8269355
map_script_2 VAR_TEMP_4, 0, TrainerHill_Elevator_EventScript_269375 map_script_2 VAR_TEMP_4, 0, TrainerHill_Elevator_EventScript_EnterElevator
.2byte 0 .2byte 0
TrainerHill_Elevator_EventScript_26935F:: @ 826935F TrainerHill_Elevator_EventScript_Attendant:: @ 826935F
end end
TrainerHill_Elevator_EventScript_269360:: @ 8269360 TrainerHill_Elevator_EventScript_ExitToRoof:: @ 8269360
applymovement EVENT_OBJ_ID_PLAYER, TrainerHill_Elevator_Movement_2693EB applymovement EVENT_OBJ_ID_PLAYER, TrainerHill_Elevator_Movement_PlayerExitElevatorToRoof
waitmovement 0 waitmovement 0
releaseall releaseall
warp MAP_TRAINER_HILL_ROOF, 255, 15, 5 warp MAP_TRAINER_HILL_ROOF, 255, 15, 5
waitstate waitstate
end end
TrainerHill_Elevator_EventScript_269375:: @ 8269375 TrainerHill_Elevator_EventScript_EnterElevator:: @ 8269375
applymovement EVENT_OBJ_ID_PLAYER, TrainerHill_Elevator_Movement_2693E4 applymovement EVENT_OBJ_ID_PLAYER, TrainerHill_Elevator_Movement_PlayerApproachAttendant
waitmovement 0 waitmovement 0
applymovement 1, TrainerHill_Elevator_Movement_2693EE applymovement 1, TrainerHill_Elevator_Movement_AttendantFacePlayer
waitmovement 0 waitmovement 0
lockall lockall
msgbox TrainerHill_Elevator_Text_268F3E, MSGBOX_YESNO msgbox TrainerHill_Elevator_Text_ReturnToReception, MSGBOX_YESNO
compare VAR_RESULT, NO compare VAR_RESULT, NO
goto_if_eq TrainerHill_Elevator_EventScript_269360 goto_if_eq TrainerHill_Elevator_EventScript_ExitToRoof
releaseall releaseall
applymovement 1, TrainerHill_Elevator_Movement_2693F0 applymovement 1, TrainerHill_Elevator_Movement_AttendantFaceDown
waitmovement 0 waitmovement 0
applymovement EVENT_OBJ_ID_PLAYER, TrainerHill_Elevator_Movement_2693DF applymovement EVENT_OBJ_ID_PLAYER, TrainerHill_Elevator_Movement_PlayerMoveToCenterOfElevator
waitmovement 0 waitmovement 0
call TrainerHill_Elevator_EventScript_2693D9 call TrainerHill_Elevator_EventScript_MoveElevator
delay 25 delay 25
applymovement EVENT_OBJ_ID_PLAYER, TrainerHill_Elevator_Movement_2693E7 applymovement EVENT_OBJ_ID_PLAYER, TrainerHill_Elevator_Movement_PlayerExitElevator
waitmovement 0 waitmovement 0
warp MAP_TRAINER_HILL_ENTRANCE, 255, 17, 8 warp MAP_TRAINER_HILL_ENTRANCE, 255, 17, 8
waitstate waitstate
end end
@ Unused @ Unused
TrainerHill_Elevator_EventScript_2693CE:: @ 82693CE TrainerHill_Elevator_EventScript_ExitFloorSelect:: @ 82693CE
goto TrainerHill_Elevator_EventScript_2693D4 goto TrainerHill_Elevator_EventScript_CloseFloorSelect
end end
@ Functionally unused @ Functionally unused
TrainerHill_Elevator_EventScript_2693D4:: @ 82693D4 TrainerHill_Elevator_EventScript_CloseFloorSelect:: @ 82693D4
special CloseDeptStoreElevatorWindow special CloseDeptStoreElevatorWindow
releaseall releaseall
end end
TrainerHill_Elevator_EventScript_2693D9:: @ 82693D9 TrainerHill_Elevator_EventScript_MoveElevator:: @ 82693D9
waitse waitse
special MoveElevator special MoveElevator
waitstate waitstate
return return
TrainerHill_Elevator_Movement_2693DF: @ 82693DF TrainerHill_Elevator_Movement_PlayerMoveToCenterOfElevator: @ 82693DF
walk_up walk_up
walk_up walk_up
walk_right walk_right
face_down face_down
step_end step_end
TrainerHill_Elevator_Movement_2693E4: @ 82693E4 TrainerHill_Elevator_Movement_PlayerApproachAttendant: @ 82693E4
delay_16 delay_16
walk_left walk_left
step_end step_end
TrainerHill_Elevator_Movement_2693E7: @ 82693E7 TrainerHill_Elevator_Movement_PlayerExitElevator: @ 82693E7
delay_16 delay_16
walk_down walk_down
walk_down walk_down
step_end step_end
TrainerHill_Elevator_Movement_2693EB: @ 82693EB TrainerHill_Elevator_Movement_PlayerExitElevatorToRoof: @ 82693EB
face_down face_down
delay_16 delay_16
step_end step_end
TrainerHill_Elevator_Movement_2693EE: @ 82693EE TrainerHill_Elevator_Movement_AttendantFacePlayer: @ 82693EE
face_right face_right
step_end step_end
TrainerHill_Elevator_Movement_2693F0: @ 82693F0 TrainerHill_Elevator_Movement_AttendantFaceDown: @ 82693F0
face_down face_down
step_end step_end
+7 -7
View File
@@ -24,7 +24,7 @@
"movement_range_y": 1, "movement_range_y": 1,
"trainer_type": "0", "trainer_type": "0",
"trainer_sight_or_berry_tree_id": "0", "trainer_sight_or_berry_tree_id": "0",
"script": "TrainerHill_Entrance_EventScript_2681FD", "script": "TrainerHill_Entrance_EventScript_Attendant",
"flag": "0" "flag": "0"
}, },
{ {
@@ -37,7 +37,7 @@
"movement_range_y": 1, "movement_range_y": 1,
"trainer_type": "0", "trainer_type": "0",
"trainer_sight_or_berry_tree_id": "0", "trainer_sight_or_berry_tree_id": "0",
"script": "TrainerHill_Entrance_EventScript_2681EF", "script": "TrainerHill_Entrance_EventScript_Nurse",
"flag": "0" "flag": "0"
}, },
{ {
@@ -50,7 +50,7 @@
"movement_range_y": 1, "movement_range_y": 1,
"trainer_type": "0", "trainer_type": "0",
"trainer_sight_or_berry_tree_id": "0", "trainer_sight_or_berry_tree_id": "0",
"script": "TrainerHill_Entrance_EventScript_2683C7", "script": "TrainerHill_Entrance_EventScript_Clerk",
"flag": "0" "flag": "0"
}, },
{ {
@@ -63,7 +63,7 @@
"movement_range_y": 1, "movement_range_y": 1,
"trainer_type": "0", "trainer_type": "0",
"trainer_sight_or_berry_tree_id": "0", "trainer_sight_or_berry_tree_id": "0",
"script": "TrainerHill_Entrance_EventScript_2683AC", "script": "TrainerHill_Entrance_EventScript_Girl",
"flag": "0" "flag": "0"
}, },
{ {
@@ -76,7 +76,7 @@
"movement_range_y": 1, "movement_range_y": 1,
"trainer_type": "0", "trainer_type": "0",
"trainer_sight_or_berry_tree_id": "0", "trainer_sight_or_berry_tree_id": "0",
"script": "TrainerHill_Entrance_EventScript_268391", "script": "TrainerHill_Entrance_EventScript_Man",
"flag": "0" "flag": "0"
} }
], ],
@@ -111,7 +111,7 @@
"elevation": 3, "elevation": 3,
"var": "VAR_TRAINER_HILL_IS_ACTIVE", "var": "VAR_TRAINER_HILL_IS_ACTIVE",
"var_value": "0", "var_value": "0",
"script": "TrainerHill_Entrance_EventScript_268229" "script": "TrainerHill_Entrance_EventScript_EntryTrigger"
} }
], ],
"bg_events": [ "bg_events": [
@@ -121,7 +121,7 @@
"y": 10, "y": 10,
"elevation": 0, "elevation": 0,
"player_facing_dir": "BG_EVENT_PLAYER_FACING_NORTH", "player_facing_dir": "BG_EVENT_PLAYER_FACING_NORTH",
"script": "TrainerHill_Entrance_EventScript_268388" "script": "TrainerHill_Entrance_EventScript_Records"
} }
] ]
} }
+144 -145
View File
@@ -1,9 +1,9 @@
TrainerHill_Entrance_MapScripts:: @ 82680AC TrainerHill_Entrance_MapScripts:: @ 82680AC
map_script MAP_SCRIPT_ON_RESUME, TrainerHill_Entrance_MapScript1_2680D0 map_script MAP_SCRIPT_ON_RESUME, TrainerHill_Entrance_OnResume
map_script MAP_SCRIPT_ON_RETURN_TO_FIELD, TrainerHill_Entrance_MapScript1_26811B map_script MAP_SCRIPT_ON_RETURN_TO_FIELD, TrainerHill_Entrance_OnReturn
map_script MAP_SCRIPT_ON_TRANSITION, TrainerHill_Entrance_OnTransition map_script MAP_SCRIPT_ON_TRANSITION, TrainerHill_Entrance_OnTransition
map_script MAP_SCRIPT_ON_LOAD, TrainerHill_Entrance_MapScript1_268128 map_script MAP_SCRIPT_ON_LOAD, TrainerHill_Entrance_OnLoad
map_script MAP_SCRIPT_ON_FRAME_TABLE, TrainerHill_Entrance_MapScript2_26813E map_script MAP_SCRIPT_ON_FRAME_TABLE, TrainerHill_Entrance_OnFrame
.byte 0 .byte 0
TrainerHill_Entrance_OnTransition: @ 82680C6 TrainerHill_Entrance_OnTransition: @ 82680C6
@@ -11,58 +11,59 @@ TrainerHill_Entrance_OnTransition: @ 82680C6
getplayerxy VAR_TEMP_D, VAR_RESULT getplayerxy VAR_TEMP_D, VAR_RESULT
end end
TrainerHill_Entrance_MapScript1_2680CF: @ 82680CF @ Unused
TrainerHill_Entrance_OnWarp: @ 82680CF
end end
TrainerHill_Entrance_MapScript1_2680D0: @ 82680D0 TrainerHill_Entrance_OnResume: @ 82680D0
setvar VAR_0x8004, TRAINER_HILL_FUNC_RESUME_TIMER setvar VAR_0x8004, TRAINER_HILL_FUNC_RESUME_TIMER
special CallTrainerHillFunction special CallTrainerHillFunction
setvar VAR_TEMP_0, 0 setvar VAR_TEMP_0, 0
setvar VAR_0x8004, TRAINER_HILL_FUNC_9 setvar VAR_0x8004, TRAINER_HILL_FUNC_CLEAR_RESULT
special CallTrainerHillFunction special CallTrainerHillFunction
compare VAR_RESULT, 0 compare VAR_RESULT, 0 @ VAR_RESULT always 0 here
goto_if_eq TrainerHill_Entrance_EventScript_2680FF goto_if_eq TrainerHill_Entrance_EventScript_TryFaceAttendant
setobjectxy EVENT_OBJ_ID_PLAYER, 9, 6 setobjectxy EVENT_OBJ_ID_PLAYER, 9, 6
applymovement EVENT_OBJ_ID_PLAYER, TrainerHill_Entrance_Movement_26837F applymovement EVENT_OBJ_ID_PLAYER, TrainerHill_Entrance_Movement_PlayerFaceAttendant
end end
TrainerHill_Entrance_EventScript_2680FF:: @ 82680FF TrainerHill_Entrance_EventScript_TryFaceAttendant:: @ 82680FF
setvar VAR_0x8004, TRAINER_HILL_FUNC_16 setvar VAR_0x8004, TRAINER_HILL_FUNC_GET_WON
special CallTrainerHillFunction special CallTrainerHillFunction
compare VAR_RESULT, 1 compare VAR_RESULT, TRUE
goto_if_eq TrainerHill_Entrance_EventScript_26811A goto_if_eq TrainerHill_Entrance_EventScript_PlayerDontFaceAttendant
applymovement EVENT_OBJ_ID_PLAYER, TrainerHill_Entrance_Movement_26837F applymovement EVENT_OBJ_ID_PLAYER, TrainerHill_Entrance_Movement_PlayerFaceAttendant
end end
TrainerHill_Entrance_EventScript_26811A:: @ 826811A TrainerHill_Entrance_EventScript_PlayerDontFaceAttendant:: @ 826811A
end end
TrainerHill_Entrance_MapScript1_26811B: @ 826811B TrainerHill_Entrance_OnReturn: @ 826811B
addobject 2 addobject 2
addobject 1 addobject 1
addobject 5 addobject 5
addobject 4 addobject 4
end end
TrainerHill_Entrance_MapScript1_268128: @ 8268128 TrainerHill_Entrance_OnLoad: @ 8268128
compare VAR_TEMP_D, 17 compare VAR_TEMP_D, 17
call_if_eq TrainerHill_Entrance_EventScript_268134 call_if_eq TrainerHill_Entrance_EventScript_OpenCounterDoor
end end
TrainerHill_Entrance_EventScript_268134:: @ 8268134 TrainerHill_Entrance_EventScript_OpenCounterDoor:: @ 8268134
setmetatile 17, 10, METATILE_TrainerHill_GreenFloorTile, 0 setmetatile 17, 10, METATILE_TrainerHill_GreenFloorTile, 0
return return
TrainerHill_Entrance_MapScript2_26813E: @ 826813E TrainerHill_Entrance_OnFrame: @ 826813E
map_script_2 VAR_TEMP_0, 0, TrainerHill_Entrance_EventScript_268182 map_script_2 VAR_TEMP_0, 0, TrainerHill_Entrance_EventScript_ExitChallenge
map_script_2 VAR_TEMP_D, 17, TrainerHill_Entrance_EventScript_268160 map_script_2 VAR_TEMP_D, 17, TrainerHill_Entrance_EventScript_ExitElevator
map_script_2 VAR_TEMP_5, 1, TrainerHill_Entrance_EventScript_268229 map_script_2 VAR_TEMP_5, 1, TrainerHill_Entrance_EventScript_EntryTrigger
map_script_2 VAR_TEMP_1, 1, TrainerHill_Entrance_EventScript_2C83DF map_script_2 VAR_TEMP_1, 1, TrainerHill_EventScript_WarpToEntranceCounter
.2byte 0 .2byte 0
TrainerHill_Entrance_EventScript_268160:: @ 8268160 TrainerHill_Entrance_EventScript_ExitElevator:: @ 8268160
lockall lockall
applymovement EVENT_OBJ_ID_PLAYER, TrainerHill_Entrance_Movement_268385 applymovement EVENT_OBJ_ID_PLAYER, TrainerHill_Entrance_Movement_PlayerExitElevator
waitmovement 0 waitmovement 0
setmetatile 17, 10, METATILE_TrainerHill_CounterDoor, 1 setmetatile 17, 10, METATILE_TrainerHill_CounterDoor, 1
special DrawWholeMapView special DrawWholeMapView
@@ -72,38 +73,36 @@ TrainerHill_Entrance_EventScript_268160:: @ 8268160
releaseall releaseall
end end
TrainerHill_Entrance_EventScript_268182:: @ 8268182 TrainerHill_Entrance_EventScript_ExitChallenge:: @ 8268182
setvar VAR_TEMP_0, 1 setvar VAR_TEMP_0, 1
setvar VAR_0x8004, TRAINER_HILL_FUNC_GET_CHALLENGE_STATUS setvar VAR_0x8004, TRAINER_HILL_FUNC_GET_CHALLENGE_STATUS
special CallTrainerHillFunction special CallTrainerHillFunction
switch VAR_RESULT switch VAR_RESULT
case TRAINER_HILL_PLAYER_STATUS_LOST, TrainerHill_Entrance_EventScript_2681B5 case TRAINER_HILL_PLAYER_STATUS_LOST, TrainerHill_Entrance_EventScript_ExitChallengeLost
case TRAINER_HILL_PLAYER_STATUS_ECARD_SCANNED, TrainerHill_Entrance_EventScript_2681CA case TRAINER_HILL_PLAYER_STATUS_ECARD_SCANNED, TrainerHill_Entrance_EventScript_ExitChallengeECard
case TRAINER_HILL_PLAYER_STATUS_NORMAL, TrainerHill_Entrance_EventScript_2681EE case TRAINER_HILL_PLAYER_STATUS_NORMAL, TrainerHill_Entrance_EventScript_EndExitChallenge
TrainerHill_Entrance_EventScript_2681B5:: @ 82681B5 TrainerHill_Entrance_EventScript_ExitChallengeLost:: @ 82681B5
lockall lockall
applymovement EVENT_OBJ_ID_PLAYER, TrainerHill_Entrance_Movement_26837F applymovement EVENT_OBJ_ID_PLAYER, TrainerHill_Entrance_Movement_PlayerFaceAttendant
msgbox TrainerHill_Entrance_Text_268689, MSGBOX_DEFAULT msgbox TrainerHill_Entrance_Text_TooBadTremendousEffort, MSGBOX_DEFAULT
goto TrainerHill_Entrance_EventScript_2681DA goto TrainerHill_Entrance_EventScript_PlayerExitChallenge
TrainerHill_Entrance_EventScript_2681CA:: @ 82681CA TrainerHill_Entrance_EventScript_ExitChallengeECard:: @ 82681CA
lockall lockall
applymovement EVENT_OBJ_ID_PLAYER, TrainerHill_Entrance_Movement_26837F applymovement EVENT_OBJ_ID_PLAYER, TrainerHill_Entrance_Movement_PlayerFaceAttendant
msgbox TrainerHill_Entrance_Text_268712, MSGBOX_DEFAULT msgbox TrainerHill_Entrance_Text_MovedReceptionHereForSwitch, MSGBOX_DEFAULT
TrainerHill_Entrance_EventScript_PlayerExitChallenge:: @ 82681DA
TrainerHill_Entrance_EventScript_2681DA:: @ 82681DA
closemessage closemessage
applymovement EVENT_OBJ_ID_PLAYER, TrainerHill_Entrance_Movement_268381 applymovement EVENT_OBJ_ID_PLAYER, TrainerHill_Entrance_Movement_PushPlayerBackFromCounter
waitmovement 0 waitmovement 0
setvar VAR_TRAINER_HILL_IS_ACTIVE, 0 setvar VAR_TRAINER_HILL_IS_ACTIVE, 0
special HealPlayerParty special HealPlayerParty
releaseall releaseall
TrainerHill_Entrance_EventScript_EndExitChallenge:: @ 82681EE
TrainerHill_Entrance_EventScript_2681EE:: @ 82681EE
end end
TrainerHill_Entrance_EventScript_2681EF:: @ 82681EF TrainerHill_Entrance_EventScript_Nurse:: @ 82681EF
setvar VAR_0x800B, 2 setvar VAR_0x800B, 2
call Common_EventScript_PkmnCenterNurse call Common_EventScript_PkmnCenterNurse
waitmessage waitmessage
@@ -111,115 +110,113 @@ TrainerHill_Entrance_EventScript_2681EF:: @ 82681EF
release release
end end
TrainerHill_Entrance_EventScript_2681FD:: @ 82681FD TrainerHill_Entrance_EventScript_Attendant:: @ 82681FD
lock lock
faceplayer faceplayer
setvar VAR_0x8004, TRAINER_HILL_FUNC_IS_IN setvar VAR_0x8004, TRAINER_HILL_FUNC_IN_CHALLENGE
special CallTrainerHillFunction special CallTrainerHillFunction
compare VAR_RESULT, 0 compare VAR_RESULT, FALSE
goto_if_eq TrainerHill_Entrance_EventScript_26821F goto_if_eq TrainerHill_Entrance_EventScript_ThanksForPlaying
msgbox TrainerHill_Entrance_Text_2686F4, MSGBOX_DEFAULT msgbox TrainerHill_Entrance_Text_HopeYouGiveItYourBest, MSGBOX_DEFAULT
goto TrainerHill_Entrance_EventScript_268227 goto TrainerHill_Entrance_EventScript_AttendantEnd
TrainerHill_Entrance_EventScript_26821F:: @ 826821F TrainerHill_Entrance_EventScript_ThanksForPlaying:: @ 826821F
msgbox TrainerHill_Entrance_Text_2687AC, MSGBOX_DEFAULT msgbox TrainerHill_Entrance_Text_ThankYouForPlaying, MSGBOX_DEFAULT
TrainerHill_Entrance_EventScript_AttendantEnd:: @ 8268227
TrainerHill_Entrance_EventScript_268227:: @ 8268227
release release
end end
TrainerHill_Entrance_EventScript_268229:: @ 8268229 TrainerHill_Entrance_EventScript_EntryTrigger:: @ 8268229
lockall lockall
applymovement EVENT_OBJ_ID_PLAYER, TrainerHill_Entrance_Movement_26837F applymovement EVENT_OBJ_ID_PLAYER, TrainerHill_Entrance_Movement_PlayerFaceAttendant
goto_if_unset FLAG_SYS_GAME_CLEAR, TrainerHill_Entrance_EventScript_26836A goto_if_unset FLAG_SYS_GAME_CLEAR, TrainerHill_Entrance_EventScript_Closed
msgbox TrainerHill_Entrance_Text_2684C6, MSGBOX_DEFAULT msgbox TrainerHill_Entrance_Text_WelcomeToTrainerHill, MSGBOX_DEFAULT
setvar VAR_0x8004, TRAINER_HILL_FUNC_13 setvar VAR_0x8004, TRAINER_HILL_FUNC_GET_GAME_SAVED
special CallTrainerHillFunction special CallTrainerHillFunction
compare VAR_RESULT, 0 compare VAR_RESULT, FALSE
call_if_eq TrainerHill_Entrance_EventScript_26832E call_if_eq TrainerHill_Entrance_EventScript_SaveGame
setvar VAR_0x8004, TRAINER_HILL_FUNC_8 setvar VAR_0x8004, TRAINER_HILL_FUNC_GET_ALL_FLOORS_USED
special CallTrainerHillFunction special CallTrainerHillFunction
compare VAR_RESULT, 1 compare VAR_RESULT, TRUE
goto_if_eq TrainerHill_Entrance_EventScript_268275 goto_if_eq TrainerHill_Entrance_EventScript_AllFloorsUsed
msgbox TrainerHill_Entrance_Text_268564, MSGBOX_DEFAULT msgbox TrainerHill_Entrance_Text_TrainersUpToFloorX, MSGBOX_DEFAULT
goto TrainerHill_Entrance_EventScript_26827D goto TrainerHill_Entrance_EventScript_AskChallengeTrainers
TrainerHill_Entrance_EventScript_268275:: @ 8268275 TrainerHill_Entrance_EventScript_AllFloorsUsed:: @ 8268275
msgbox TrainerHill_Entrance_Text_26859E, MSGBOX_DEFAULT msgbox TrainerHill_Entrance_Text_TrainersInEveryRoom, MSGBOX_DEFAULT
TrainerHill_Entrance_EventScript_AskChallengeTrainers:: @ 826827D
TrainerHill_Entrance_EventScript_26827D:: @ 826827D message TrainerHill_Entrance_Text_LikeToChallengeTrainers
message TrainerHill_Entrance_Text_2685F8
waitmessage waitmessage
multichoice 15, 6, MULTI_YESNOINFO, 0 multichoice 15, 6, MULTI_YESNOINFO, 0
switch VAR_RESULT switch VAR_RESULT
case 0, TrainerHill_Entrance_EventScript_2682C8 case 0, TrainerHill_Entrance_EventScript_ChooseChallenge
case 1, TrainerHill_Entrance_EventScript_268314 case 1, TrainerHill_Entrance_EventScript_CancelEntry
case 2, TrainerHill_Entrance_EventScript_2682BA case 2, TrainerHill_Entrance_EventScript_Info
case MULTI_B_PRESSED, TrainerHill_Entrance_EventScript_268314 case MULTI_B_PRESSED, TrainerHill_Entrance_EventScript_CancelEntry
end end
TrainerHill_Entrance_EventScript_2682BA:: @ 82682BA TrainerHill_Entrance_EventScript_Info:: @ 82682BA
msgbox TrainerHill_Entrance_Text_2687C3, MSGBOX_DEFAULT msgbox TrainerHill_Entrance_Text_ExplainTrainerHill, MSGBOX_DEFAULT
goto TrainerHill_Entrance_EventScript_26827D goto TrainerHill_Entrance_EventScript_AskChallengeTrainers
end end
TrainerHill_Entrance_EventScript_2682C8:: @ 82682C8 TrainerHill_Entrance_EventScript_ChooseChallenge:: @ 82682C8
multichoice 13, 2, MULTI_TAG_MATCH_TYPE, 0 multichoice 13, 2, MULTI_TAG_MATCH_TYPE, 0
switch VAR_RESULT switch VAR_RESULT
case 4, TrainerHill_Entrance_EventScript_268314 case 4, TrainerHill_Entrance_EventScript_CancelEntry
case MULTI_B_PRESSED, TrainerHill_Entrance_EventScript_268314 case MULTI_B_PRESSED, TrainerHill_Entrance_EventScript_CancelEntry
setvar VAR_0x8004, TRAINER_HILL_FUNC_SET_TAG setvar VAR_0x8004, TRAINER_HILL_FUNC_SET_TAG
copyvar VAR_0x8005, VAR_RESULT copyvar VAR_0x8005, VAR_RESULT
special CallTrainerHillFunction special CallTrainerHillFunction
setvar VAR_TRAINER_HILL_IS_ACTIVE, 1 setvar VAR_TRAINER_HILL_IS_ACTIVE, 1
setvar VAR_TEMP_5, 0 setvar VAR_TEMP_5, 0
special HealPlayerParty special HealPlayerParty
msgbox TrainerHill_Entrance_Text_26862A, MSGBOX_DEFAULT msgbox TrainerHill_Entrance_Text_TimeProgessGetSetGo, MSGBOX_DEFAULT
setvar VAR_0x8004, TRAINER_HILL_FUNC_START setvar VAR_0x8004, TRAINER_HILL_FUNC_START
special CallTrainerHillFunction special CallTrainerHillFunction
releaseall releaseall
end end
TrainerHill_Entrance_EventScript_268314:: @ 8268314 TrainerHill_Entrance_EventScript_CancelEntry:: @ 8268314
setvar VAR_TEMP_5, 0 setvar VAR_TEMP_5, 0
msgbox TrainerHill_Entrance_Text_26866F, MSGBOX_DEFAULT msgbox TrainerHill_Entrance_Text_PleaseVisitUsAgain, MSGBOX_DEFAULT
closemessage closemessage
applymovement EVENT_OBJ_ID_PLAYER, TrainerHill_Entrance_Movement_268381 applymovement EVENT_OBJ_ID_PLAYER, TrainerHill_Entrance_Movement_PushPlayerBackFromCounter
waitmovement 0 waitmovement 0
releaseall releaseall
end end
TrainerHill_Entrance_EventScript_26832E:: @ 826832E TrainerHill_Entrance_EventScript_SaveGame:: @ 826832E
msgbox TrainerHill_Entrance_Text_26851C, MSGBOX_DEFAULT msgbox TrainerHill_Entrance_Text_SaveGameBeforeEnter, MSGBOX_DEFAULT
setvar VAR_0x8004, TRAINER_HILL_FUNC_14 setvar VAR_0x8004, TRAINER_HILL_FUNC_SET_GAME_SAVED
special CallTrainerHillFunction special CallTrainerHillFunction
setvar VAR_TEMP_5, 1 setvar VAR_TEMP_5, 1
call Common_EventScript_SaveGame call Common_EventScript_SaveGame
compare VAR_RESULT, 0 compare VAR_RESULT, FALSE
goto_if_eq TrainerHill_Entrance_EventScript_26835C goto_if_eq TrainerHill_Entrance_EventScript_SaveFailed
setvar VAR_0x8004, TRAINER_HILL_FUNC_14 setvar VAR_0x8004, TRAINER_HILL_FUNC_SET_GAME_SAVED
special CallTrainerHillFunction special CallTrainerHillFunction
return return
TrainerHill_Entrance_EventScript_26835C:: @ 826835C TrainerHill_Entrance_EventScript_SaveFailed:: @ 826835C
setvar VAR_0x8004, TRAINER_HILL_FUNC_15 setvar VAR_0x8004, TRAINER_HILL_FUNC_CLEAR_GAME_SAVED
special CallTrainerHillFunction special CallTrainerHillFunction
goto TrainerHill_Entrance_EventScript_268314 goto TrainerHill_Entrance_EventScript_CancelEntry
end end
TrainerHill_Entrance_EventScript_26836A:: @ 826836A TrainerHill_Entrance_EventScript_Closed:: @ 826836A
msgbox TrainerHill_Entrance_Text_268430, MSGBOX_DEFAULT msgbox TrainerHill_Entrance_Text_StillGettingReady, MSGBOX_DEFAULT
closemessage closemessage
applymovement EVENT_OBJ_ID_PLAYER, TrainerHill_Entrance_Movement_268381 applymovement EVENT_OBJ_ID_PLAYER, TrainerHill_Entrance_Movement_PushPlayerBackFromCounter
waitmovement 0 waitmovement 0
releaseall releaseall
end end
TrainerHill_Entrance_Movement_26837F: @ 826837F TrainerHill_Entrance_Movement_PlayerFaceAttendant: @ 826837F
face_right face_right
step_end step_end
TrainerHill_Entrance_Movement_268381: @ 8268381 TrainerHill_Entrance_Movement_PushPlayerBackFromCounter: @ 8268381
walk_down walk_down
step_end step_end
@@ -227,12 +224,12 @@ TrainerHill_Entrance_Movement_268383: @ 8268383
face_up face_up
step_end step_end
TrainerHill_Entrance_Movement_268385: @ 8268385 TrainerHill_Entrance_Movement_PlayerExitElevator: @ 8268385
walk_down walk_down
walk_down walk_down
step_end step_end
TrainerHill_Entrance_EventScript_268388:: @ 8268388 TrainerHill_Entrance_EventScript_Records:: @ 8268388
lockall lockall
fadescreen 1 fadescreen 1
special ShowTrainerHillRecords special ShowTrainerHillRecords
@@ -240,37 +237,37 @@ TrainerHill_Entrance_EventScript_268388:: @ 8268388
releaseall releaseall
end end
TrainerHill_Entrance_EventScript_268391:: @ 8268391 TrainerHill_Entrance_EventScript_Man:: @ 8268391
goto_if_unset FLAG_SYS_GAME_CLEAR, TrainerHill_Entrance_EventScript_2683A3 goto_if_unset FLAG_SYS_GAME_CLEAR, TrainerHill_Entrance_EventScript_ManTrainerHillClosed
msgbox TrainerHill_Entrance_Text_268D5A, MSGBOX_NPC msgbox TrainerHill_Entrance_Text_WhatSortOfTrainersAreAhead, MSGBOX_NPC
end end
TrainerHill_Entrance_EventScript_2683A3:: @ 82683A3 TrainerHill_Entrance_EventScript_ManTrainerHillClosed:: @ 82683A3
msgbox TrainerHill_Entrance_Text_268DDA, MSGBOX_NPC msgbox TrainerHill_Entrance_Text_CantWaitToTestTheWaters, MSGBOX_NPC
end end
TrainerHill_Entrance_EventScript_2683AC:: @ 82683AC TrainerHill_Entrance_EventScript_Girl:: @ 82683AC
goto_if_unset FLAG_SYS_GAME_CLEAR, TrainerHill_Entrance_EventScript_2683BE goto_if_unset FLAG_SYS_GAME_CLEAR, TrainerHill_Entrance_EventScript_GirlTrainerHillClosed
msgbox TrainerHill_Entrance_Text_268E6A, MSGBOX_NPC msgbox TrainerHill_Entrance_Text_FriendsTryingToReachTimeBoardTop, MSGBOX_NPC
end end
TrainerHill_Entrance_EventScript_2683BE:: @ 82683BE TrainerHill_Entrance_EventScript_GirlTrainerHillClosed:: @ 82683BE
msgbox TrainerHill_Entrance_Text_268EDC, MSGBOX_NPC msgbox TrainerHill_Entrance_Text_DoYouKnowWhenTheyOpen, MSGBOX_NPC
end end
TrainerHill_Entrance_EventScript_2683C7:: @ 82683C7 TrainerHill_Entrance_EventScript_Clerk:: @ 82683C7
lock lock
faceplayer faceplayer
message gText_HowMayIServeYou message gText_HowMayIServeYou
waitmessage waitmessage
goto_if_set FLAG_SYS_GAME_CLEAR, TrainerHill_Entrance_EventScript_268402 goto_if_set FLAG_SYS_GAME_CLEAR, TrainerHill_Entrance_EventScript_ExpandedPokemart
pokemart TrainerHill_Entrance_Pokemart_2683E8 pokemart TrainerHill_Entrance_Pokemart_Basic
msgbox gText_PleaseComeAgain, MSGBOX_DEFAULT msgbox gText_PleaseComeAgain, MSGBOX_DEFAULT
release release
end end
.align 2 .align 2
TrainerHill_Entrance_Pokemart_2683E8: @ 82683E8 TrainerHill_Entrance_Pokemart_Basic: @ 82683E8
.2byte ITEM_SUPER_POTION .2byte ITEM_SUPER_POTION
.2byte ITEM_ANTIDOTE .2byte ITEM_ANTIDOTE
.2byte ITEM_PARALYZE_HEAL .2byte ITEM_PARALYZE_HEAL
@@ -286,14 +283,14 @@ TrainerHill_Entrance_Pokemart_2683E8: @ 82683E8
release release
end end
TrainerHill_Entrance_EventScript_268402:: @ 8268402 TrainerHill_Entrance_EventScript_ExpandedPokemart:: @ 8268402
pokemart TrainerHill_Entrance_Pokemart_268414 pokemart TrainerHill_Entrance_Pokemart_Expanded
msgbox gText_PleaseComeAgain, MSGBOX_DEFAULT msgbox gText_PleaseComeAgain, MSGBOX_DEFAULT
release release
end end
.align 2 .align 2
TrainerHill_Entrance_Pokemart_268414: @ 8268414 TrainerHill_Entrance_Pokemart_Expanded: @ 8268414
.2byte ITEM_HYPER_POTION .2byte ITEM_HYPER_POTION
.2byte ITEM_MAX_POTION .2byte ITEM_MAX_POTION
.2byte ITEM_FULL_RESTORE .2byte ITEM_FULL_RESTORE
@@ -310,69 +307,69 @@ TrainerHill_Entrance_Pokemart_268414: @ 8268414
release release
end end
TrainerHill_Entrance_Text_268430: @ 8268430 TrainerHill_Entrance_Text_StillGettingReady: @ 8268430
.string "This is the TRAINER HILL where\n" .string "This is the TRAINER HILL where\n"
.string "you may enjoy tag battles with many\l" .string "you may enjoy tag battles with many\l"
.string "TRAINERS.\p" .string "TRAINERS.\p"
.string "Unfortunately, we're still getting\n" .string "Unfortunately, we're still getting\n"
.string "things ready. Please come back later!$" .string "things ready. Please come back later!$"
TrainerHill_Entrance_Text_2684C6: @ 82684C6 TrainerHill_Entrance_Text_WelcomeToTrainerHill: @ 82684C6
.string "Welcome!\p" .string "Welcome!\p"
.string "This is the TRAINER HILL where\n" .string "This is the TRAINER HILL where\n"
.string "you may enjoy tag battles with many\l" .string "you may enjoy tag battles with many\l"
.string "TRAINERS!$" .string "TRAINERS!$"
TrainerHill_Entrance_Text_26851C: @ 826851C TrainerHill_Entrance_Text_SaveGameBeforeEnter: @ 826851C
.string "Is this your first visit here?\p" .string "Is this your first visit here?\p"
.string "Before you enter, please save\n" .string "Before you enter, please save\n"
.string "your game.$" .string "your game.$"
TrainerHill_Entrance_Text_268564: @ 8268564 TrainerHill_Entrance_Text_TrainersUpToFloorX: @ 8268564
.string "Let's see…\n" .string "Let's see…\n"
.string "The TRAINERS here now are…\p" .string "The TRAINERS here now are…\p"
.string "Up to floor no. {STR_VAR_1}.$" .string "Up to floor no. {STR_VAR_1}.$"
TrainerHill_Entrance_Text_26859E: @ 826859E TrainerHill_Entrance_Text_TrainersInEveryRoom: @ 826859E
.string "Let's see…\n" .string "Let's see…\n"
.string "The TRAINERS here now are…\p" .string "The TRAINERS here now are…\p"
.string "There appear to be TRAINERS gathered\n" .string "There appear to be TRAINERS gathered\n"
.string "in every room.$" .string "in every room.$"
TrainerHill_Entrance_Text_2685F8: @ 82685F8 TrainerHill_Entrance_Text_LikeToChallengeTrainers: @ 82685F8
.string "Would you like to challenge the\n" .string "Would you like to challenge the\n"
.string "waiting TRAINERS?$" .string "waiting TRAINERS?$"
TrainerHill_Entrance_Text_26862A: @ 826862A TrainerHill_Entrance_Text_TimeProgessGetSetGo: @ 826862A
.string "I will time your progress.\n" .string "I will time your progress.\n"
.string "Best of luck!\p" .string "Best of luck!\p"
.string "On your marks…\p" .string "On your marks…\p"
.string "Get set…\p" .string "Get set…\p"
.string "Go!$" .string "Go!$"
TrainerHill_Entrance_Text_26866F: @ 826866F TrainerHill_Entrance_Text_PleaseVisitUsAgain: @ 826866F
.string "Please do visit us again!$" .string "Please do visit us again!$"
TrainerHill_Entrance_Text_268689: @ 8268689 TrainerHill_Entrance_Text_TooBadTremendousEffort: @ 8268689
.string "That was too bad.\p" .string "That was too bad.\p"
.string "I think you put in a tremendous\n" .string "I think you put in a tremendous\n"
.string "effort in your battling.\p" .string "effort in your battling.\p"
.string "Please come back and try again!$" .string "Please come back and try again!$"
TrainerHill_Entrance_Text_2686F4: @ 82686F4 TrainerHill_Entrance_Text_HopeYouGiveItYourBest: @ 82686F4
.string "I hope you give it your best.$" .string "I hope you give it your best.$"
TrainerHill_Entrance_Text_268712: @ 8268712 TrainerHill_Entrance_Text_MovedReceptionHereForSwitch: @ 8268712
.string "When the TRAINERS switch places,\n" .string "When the TRAINERS switch places,\n"
.string "the movement can be hectic.\p" .string "the movement can be hectic.\p"
.string "To avoid the stampede, we moved\n" .string "To avoid the stampede, we moved\n"
.string "the reception counter here.\p" .string "the reception counter here.\p"
.string "I'm sorry for the inconvenience.$" .string "I'm sorry for the inconvenience.$"
TrainerHill_Entrance_Text_2687AC: @ 82687AC TrainerHill_Entrance_Text_ThankYouForPlaying: @ 82687AC
.string "Thank you for playing!$" .string "Thank you for playing!$"
TrainerHill_Entrance_Text_2687C3: @ 82687C3 TrainerHill_Entrance_Text_ExplainTrainerHill: @ 82687C3
.string "Here at the TRAINER HILL, we conduct\n" .string "Here at the TRAINER HILL, we conduct\n"
.string "an event called the Time Attack.\p" .string "an event called the Time Attack.\p"
.string "It is a race that measures how long\n" .string "It is a race that measures how long\n"
@@ -385,13 +382,14 @@ TrainerHill_Entrance_Text_2687C3: @ 82687C3
.string "neither Exp. Points nor money will\l" .string "neither Exp. Points nor money will\l"
.string "be awarded.$" .string "be awarded.$"
TrainerHill_Entrance_Text_26890D: @ 826890D @ Unused
TrainerHill_Entrance_Text_NeedAtLeastTwoPokemon: @ 826890D
.string "Oh, I'm sorry, but you appear to have\n" .string "Oh, I'm sorry, but you appear to have\n"
.string "only one POKéMON with you.\p" .string "only one POKéMON with you.\p"
.string "You will need at least two POKéMON\n" .string "You will need at least two POKéMON\n"
.string "to enter this event.$" .string "to enter this event.$"
TrainerHill_Roof_Text_268986: @ 8268986 TrainerHill_Roof_Text_YouFinallyCameBravo: @ 8268986
.string "Hm! Hm!\p" .string "Hm! Hm!\p"
.string "You finally came!\n" .string "You finally came!\n"
.string "Yes, you have arrived!\p" .string "Yes, you have arrived!\p"
@@ -407,15 +405,15 @@ TrainerHill_Roof_Text_268986: @ 8268986
.string "Anyway, I watched you on your way up.\n" .string "Anyway, I watched you on your way up.\n"
.string "Marvelous battling! Bravo, indeed!$" .string "Marvelous battling! Bravo, indeed!$"
TrainerHill_Roof_Text_268AC5: @ 8268AC5 TrainerHill_Roof_Text_HaveTheMostMarvelousGift: @ 8268AC5
.string "For a marvelous someone like you,\n" .string "For a marvelous someone like you,\n"
.string "I have the most marvelous gift!$" .string "I have the most marvelous gift!$"
TrainerHill_Roof_Text_268B07: @ 8268B07 TrainerHill_Roof_Text_FullUpBeBackLaterForThis: @ 8268B07
.string "Oh, no, full up with things!\n" .string "Oh, no, full up with things!\n"
.string "You'll be back later for this!$" .string "You'll be back later for this!$"
TrainerHill_Roof_Text_268B43: @ 8268B43 TrainerHill_Roof_Text_GotHereMarvelouslyQuickly: @ 8268B43
.string "Oh, hold on here! Did you possibly get\n" .string "Oh, hold on here! Did you possibly get\n"
.string "here marvelously quickly?\p" .string "here marvelously quickly?\p"
.string "How splendid! You needn't have\n" .string "How splendid! You needn't have\n"
@@ -423,50 +421,51 @@ TrainerHill_Roof_Text_268B43: @ 8268B43
.string "That is so delightful. I'll have the Time\n" .string "That is so delightful. I'll have the Time\n"
.string "Board at the reception updated!$" .string "Board at the reception updated!$"
TrainerHill_Roof_Text_268C03: @ 8268C03 TrainerHill_Roof_Text_YouWerentVeryQuick: @ 8268C03
.string "But, oh…\n" .string "But, oh…\n"
.string "You weren't very quick getting here.$" .string "You weren't very quick getting here.$"
TrainerHill_Roof_Text_268C31: @ 8268C31 TrainerHill_Roof_Text_ArriveZippierNextTime: @ 8268C31
.string "Perhaps it would please me more if you\n" .string "Perhaps it would please me more if you\n"
.string "arrived zippier next time.\p" .string "arrived zippier next time.\p"
.string "Then, I should be pleased to form\n" .string "Then, I should be pleased to form\n"
.string "a tag team with you!\p" .string "a tag team with you!\p"
.string "Until we meet again, amigo!$" .string "Until we meet again, amigo!$"
TrainerHill_Roof_Text_268CC6: @ 8268CC6 @ Unused
TrainerHill_Roof_Text_BuiltTrainerHillToFindPartner: @ 8268CC6
.string "I had the TRAINER HILL built for but\n" .string "I had the TRAINER HILL built for but\n"
.string "one reason and one only!\p" .string "one reason and one only!\p"
.string "To find the most suitable partner\n" .string "To find the most suitable partner\n"
.string "with whom I may form a tag team!$" .string "with whom I may form a tag team!$"
TrainerHill_Entrance_Text_268D47: @ 8268D47 TrainerHill_Entrance_Text_ChallengeTime: @ 8268D47
.string "{STR_VAR_1} min. {STR_VAR_2}.{STR_VAR_3} sec.$" .string "{STR_VAR_1} min. {STR_VAR_2}.{STR_VAR_3} sec.$"
TrainerHill_Entrance_Text_268D5A: @ 8268D5A TrainerHill_Entrance_Text_WhatSortOfTrainersAreAhead: @ 8268D5A
.string "Who knows what sort of TRAINERS\n" .string "Who knows what sort of TRAINERS\n"
.string "and POKéMON combos are ahead?\p" .string "and POKéMON combos are ahead?\p"
.string "All I know is that I'll knock aside\n" .string "All I know is that I'll knock aside\n"
.string "anyone that stands in my way!$" .string "anyone that stands in my way!$"
TrainerHill_Entrance_Text_268DDA: @ 8268DDA TrainerHill_Entrance_Text_CantWaitToTestTheWaters: @ 8268DDA
.string "I heard tough TRAINERS come to this\n" .string "I heard tough TRAINERS come to this\n"
.string "TRAINER HILL from all over.\p" .string "TRAINER HILL from all over.\p"
.string "I can't wait to test the waters!\p" .string "I can't wait to test the waters!\p"
.string "I'll knock aside anyone that stands\n" .string "I'll knock aside anyone that stands\n"
.string "in my way!$" .string "in my way!$"
TrainerHill_Entrance_Text_268E6A: @ 8268E6A TrainerHill_Entrance_Text_FriendsTryingToReachTimeBoardTop: @ 8268E6A
.string "Do you see the Time Board over there?\p" .string "Do you see the Time Board over there?\p"
.string "My friends and I are trying to see who\n" .string "My friends and I are trying to see who\n"
.string "can reach the top in the least time.$" .string "can reach the top in the least time.$"
TrainerHill_Entrance_Text_268EDC: @ 8268EDC TrainerHill_Entrance_Text_DoYouKnowWhenTheyOpen: @ 8268EDC
.string "Do you know when they're opening\n" .string "Do you know when they're opening\n"
.string "this place up?\p" .string "this place up?\p"
.string "I'm waiting here to be the first\n" .string "I'm waiting here to be the first\n"
.string "challenger ever!$" .string "challenger ever!$"
TrainerHill_Elevator_Text_268F3E: @ 8268F3E TrainerHill_Elevator_Text_ReturnToReception: @ 8268F3E
.string "Would you like to return to\n" .string "Would you like to return to\n"
.string "the reception counter?$" .string "the reception counter?$"
+1 -1
View File
@@ -24,7 +24,7 @@
"movement_range_y": 1, "movement_range_y": 1,
"trainer_type": "0", "trainer_type": "0",
"trainer_sight_or_berry_tree_id": "0", "trainer_sight_or_berry_tree_id": "0",
"script": "TrainerHill_Roof_EventScript_268FB2", "script": "TrainerHill_Roof_EventScript_Owner",
"flag": "0" "flag": "0"
} }
], ],
+37 -41
View File
@@ -1,70 +1,66 @@
TrainerHill_Roof_MapScripts:: @ 8268FA7 TrainerHill_Roof_MapScripts:: @ 8268FA7
map_script MAP_SCRIPT_ON_RESUME, TrainerHill_Roof_MapScript1_2C8336 map_script MAP_SCRIPT_ON_RESUME, TrainerHill_OnResume
map_script MAP_SCRIPT_ON_FRAME_TABLE, TrainerHill_Roof_MapScript2_2C8381 map_script MAP_SCRIPT_ON_FRAME_TABLE, TrainerHill_OnFrame
.byte 0 .byte 0
TrainerHill_Roof_EventScript_268FB2:: @ 8268FB2 TrainerHill_Roof_EventScript_Owner:: @ 8268FB2
setvar VAR_0x8004, TRAINER_HILL_FUNC_12 setvar VAR_0x8004, TRAINER_HILL_FUNC_SET_ALL_TRAINER_FLAGS
special CallTrainerHillFunction special CallTrainerHillFunction
lock lock
faceplayer faceplayer
setvar VAR_0x8004, TRAINER_HILL_FUNC_1 setvar VAR_0x8004, TRAINER_HILL_FUNC_GET_OWNER_STATE
special CallTrainerHillFunction special CallTrainerHillFunction
switch VAR_RESULT switch VAR_RESULT
case 0, TrainerHill_Roof_EventScript_268FEA case 0, TrainerHill_Roof_EventScript_Arrived
case 1, TrainerHill_Roof_EventScript_268FF2 case 1, TrainerHill_Roof_EventScript_GivePrize
case 2, TrainerHill_Roof_EventScript_2690A8 case 2, TrainerHill_Roof_EventScript_AlreadyReceivedPrize
TrainerHill_Roof_EventScript_Arrived:: @ 8268FEA
TrainerHill_Roof_EventScript_268FEA:: @ 8268FEA msgbox TrainerHill_Roof_Text_YouFinallyCameBravo, MSGBOX_DEFAULT
msgbox TrainerHill_Roof_Text_268986, MSGBOX_DEFAULT TrainerHill_Roof_EventScript_GivePrize:: @ 8268FF2
setvar VAR_0x8004, TRAINER_HILL_FUNC_GIVE_PRIZE
TrainerHill_Roof_EventScript_268FF2:: @ 8268FF2
setvar VAR_0x8004, TRAINER_HILL_FUNC_2
special CallTrainerHillFunction special CallTrainerHillFunction
switch VAR_RESULT switch VAR_RESULT
case 0, TrainerHill_Roof_EventScript_269020 case 0, TrainerHill_Roof_EventScript_ReceivePrize
case 1, TrainerHill_Roof_EventScript_269037 case 1, TrainerHill_Roof_EventScript_NoRoomForPrize
case 2, TrainerHill_Roof_EventScript_269054 case 2, TrainerHill_Roof_EventScript_CheckFinalTime
TrainerHill_Roof_EventScript_ReceivePrize:: @ 8269020
TrainerHill_Roof_EventScript_269020:: @ 8269020 msgbox TrainerHill_Roof_Text_HaveTheMostMarvelousGift, MSGBOX_DEFAULT
msgbox TrainerHill_Roof_Text_268AC5, MSGBOX_DEFAULT
playfanfare MUS_FANFA1 playfanfare MUS_FANFA1
message gText_ObtainedTheItem message gText_ObtainedTheItem
waitfanfare waitfanfare
waitmessage waitmessage
goto TrainerHill_Roof_EventScript_269054 goto TrainerHill_Roof_EventScript_CheckFinalTime
TrainerHill_Roof_EventScript_269037:: @ 8269037 TrainerHill_Roof_EventScript_NoRoomForPrize:: @ 8269037
msgbox TrainerHill_Roof_Text_268AC5, MSGBOX_DEFAULT msgbox TrainerHill_Roof_Text_HaveTheMostMarvelousGift, MSGBOX_DEFAULT
msgbox gText_TheBagIsFull, MSGBOX_DEFAULT msgbox gText_TheBagIsFull, MSGBOX_DEFAULT
msgbox TrainerHill_Roof_Text_268B07, MSGBOX_DEFAULT msgbox TrainerHill_Roof_Text_FullUpBeBackLaterForThis, MSGBOX_DEFAULT
goto TrainerHill_Roof_EventScript_269054 goto TrainerHill_Roof_EventScript_CheckFinalTime
TrainerHill_Roof_EventScript_269054:: @ 8269054 TrainerHill_Roof_EventScript_CheckFinalTime:: @ 8269054
setvar VAR_0x8004, TRAINER_HILL_FUNC_3 setvar VAR_0x8004, TRAINER_HILL_FUNC_CHECK_FINAL_TIME
special CallTrainerHillFunction special CallTrainerHillFunction
switch VAR_RESULT switch VAR_RESULT
case 0, TrainerHill_Roof_EventScript_269082 case 0, TrainerHill_Roof_EventScript_NewRecord
case 1, TrainerHill_Roof_EventScript_269090 case 1, TrainerHill_Roof_EventScript_NoNewRecord
case 2, TrainerHill_Roof_EventScript_26909E case 2, TrainerHill_Roof_EventScript_EndSpeakToOwner
TrainerHill_Roof_EventScript_NewRecord:: @ 8269082
TrainerHill_Roof_EventScript_269082:: @ 8269082 msgbox TrainerHill_Roof_Text_GotHereMarvelouslyQuickly, MSGBOX_DEFAULT
msgbox TrainerHill_Roof_Text_268B43, MSGBOX_DEFAULT goto TrainerHill_Roof_EventScript_EndSpeakToOwner
goto TrainerHill_Roof_EventScript_26909E
end end
TrainerHill_Roof_EventScript_269090:: @ 8269090 TrainerHill_Roof_EventScript_NoNewRecord:: @ 8269090
msgbox TrainerHill_Roof_Text_268C03, MSGBOX_DEFAULT msgbox TrainerHill_Roof_Text_YouWerentVeryQuick, MSGBOX_DEFAULT
goto TrainerHill_Roof_EventScript_26909E goto TrainerHill_Roof_EventScript_EndSpeakToOwner
end end
TrainerHill_Roof_EventScript_26909E:: @ 826909E TrainerHill_Roof_EventScript_EndSpeakToOwner:: @ 826909E
msgbox TrainerHill_Roof_Text_268C31, MSGBOX_DEFAULT msgbox TrainerHill_Roof_Text_ArriveZippierNextTime, MSGBOX_DEFAULT
release release
end end
TrainerHill_Roof_EventScript_2690A8:: @ 82690A8 TrainerHill_Roof_EventScript_AlreadyReceivedPrize:: @ 82690A8
msgbox TrainerHill_Roof_Text_268C31, MSGBOX_DEFAULT msgbox TrainerHill_Roof_Text_ArriveZippierNextTime, MSGBOX_DEFAULT
release release
end end
+1 -1
View File
@@ -39,7 +39,7 @@ EventScript_FrontierFieldWhiteOut:: @ 82736F8
goto_if_eq BattleFrontier_BattlePyramidTop_EventScript_252B42 goto_if_eq BattleFrontier_BattlePyramidTop_EventScript_252B42
compare VAR_RESULT, 2 compare VAR_RESULT, 2
goto_if_eq BattleFrontier_BattlePyramidTop_EventScript_252B42 goto_if_eq BattleFrontier_BattlePyramidTop_EventScript_252B42
setvar VAR_0x8004, TRAINER_HILL_FUNC_IS_IN setvar VAR_0x8004, TRAINER_HILL_FUNC_IN_CHALLENGE
special CallTrainerHillFunction special CallTrainerHillFunction
compare VAR_RESULT, 1 compare VAR_RESULT, 1
goto_if_eq TrainerHill_1F_EventScript_Lost goto_if_eq TrainerHill_1F_EventScript_Lost
+23 -30
View File
@@ -1,8 +1,4 @@
TrainerHill_1F_MapScript1_2C8336: @ 82C8336 TrainerHill_OnResume: @ 82C8336
TrainerHill_2F_MapScript1_2C8336: @ 82C8336
TrainerHill_3F_MapScript1_2C8336: @ 82C8336
TrainerHill_4F_MapScript1_2C8336: @ 82C8336
TrainerHill_Roof_MapScript1_2C8336: @ 82C8336
setvar VAR_TEMP_2, 0 setvar VAR_TEMP_2, 0
setvar VAR_0x8004, TRAINER_HILL_FUNC_RESUME_TIMER setvar VAR_0x8004, TRAINER_HILL_FUNC_RESUME_TIMER
special CallTrainerHillFunction special CallTrainerHillFunction
@@ -17,67 +13,64 @@ TrainerHill_Roof_MapScript1_2C8336: @ 82C8336
goto_if_eq TrainerHill_1F_EventScript_Lost goto_if_eq TrainerHill_1F_EventScript_Lost
end end
TrainerHill_1F_MapScript2_2C8372: @ 82C8372 TrainerHill_OnWarp: @ 82C8372
TrainerHill_2F_MapScript2_2C8372: @ 82C8372 map_script_2 VAR_TEMP_3, 0, TrainerHill_1F_EventScript_DummyOnWarp
map_script_2 VAR_TEMP_3, 0, TrainerHill_1F_EventScript_2C837C
.2byte 0 .2byte 0
TrainerHill_1F_EventScript_2C837C:: @ 82C837C TrainerHill_1F_EventScript_DummyOnWarp:: @ 82C837C
setvar VAR_TEMP_3, 1 setvar VAR_TEMP_3, 1
@ forced stop @ forced stop
TrainerHill_1F_MapScript2_2C8381: @ 82C8381 TrainerHill_OnFrame: @ 82C8381
TrainerHill_2F_MapScript2_2C8381: @ 82C8381 map_script_2 VAR_TEMP_2, 0, TrainerHill_1F_EventScript_DummyWarpToEntranceCounter
TrainerHill_3F_MapScript2_2C8381: @ 82C8381 map_script_2 VAR_TEMP_1, 1, TrainerHill_EventScript_WarpToEntranceCounter
TrainerHill_4F_MapScript2_2C8381: @ 82C8381
TrainerHill_Roof_MapScript2_2C8381: @ 82C8381
map_script_2 VAR_TEMP_2, 0, TrainerHill_1F_EventScript_2C83A6
map_script_2 VAR_TEMP_1, 1, TrainerHill_1F_EventScript_2C83DF
.2byte 0 .2byte 0
EventScript_TrainerHillTimer:: @ 82C8393 EventScript_TrainerHillTimer:: @ 82C8393
lockall lockall
setvar VAR_0x8004, TRAINER_HILL_FUNC_7 setvar VAR_0x8004, TRAINER_HILL_FUNC_GET_CHALLENGE_TIME
special CallTrainerHillFunction special CallTrainerHillFunction
msgbox TrainerHill_Entrance_Text_268D47, MSGBOX_DEFAULT msgbox TrainerHill_Entrance_Text_ChallengeTime, MSGBOX_DEFAULT
releaseall releaseall
end end
TrainerHill_1F_EventScript_2C83A6:: @ 82C83A6 TrainerHill_1F_EventScript_DummyWarpToEntranceCounter:: @ 82C83A6
setvar VAR_TEMP_2, 1 setvar VAR_TEMP_2, 1
setvar VAR_0x8004, TRAINER_HILL_FUNC_9 setvar VAR_0x8004, TRAINER_HILL_FUNC_CLEAR_RESULT
special CallTrainerHillFunction special CallTrainerHillFunction
compare VAR_RESULT, 1 compare VAR_RESULT, 1 @ VAR_RESULT always 0 here
goto_if_eq TrainerHill_1F_EventScript_2C83BF goto_if_eq TrainerHill_1F_EventScript_WarpSilentToEntranceCounter
end end
TrainerHill_1F_EventScript_2C83BF:: @ 82C83BF @ Never reached
TrainerHill_1F_EventScript_WarpSilentToEntranceCounter:: @ 82C83BF
warpsilent MAP_TRAINER_HILL_ENTRANCE, 255, 9, 6 warpsilent MAP_TRAINER_HILL_ENTRANCE, 255, 9, 6
waitstate waitstate
end end
TrainerHill_1F_EventScript_Lost:: @ 82C83C9 TrainerHill_1F_EventScript_Lost:: @ 82C83C9
setvar VAR_0x8004, TRAINER_HILL_FUNC_12 setvar VAR_0x8004, TRAINER_HILL_FUNC_SET_ALL_TRAINER_FLAGS
special CallTrainerHillFunction special CallTrainerHillFunction
setvar VAR_0x8004, TRAINER_HILL_FUNC_SET_LOST setvar VAR_0x8004, TRAINER_HILL_FUNC_SET_LOST
special CallTrainerHillFunction special CallTrainerHillFunction
setvar VAR_TEMP_1, 1 setvar VAR_TEMP_1, 1
end end
TrainerHill_1F_EventScript_2C83DF:: @ 82C83DF TrainerHill_EventScript_WarpToEntranceCounter:: @ 82C83DF
TrainerHill_Entrance_EventScript_2C83DF:: @ 82C83DF
setvar VAR_TEMP_1, 0 setvar VAR_TEMP_1, 0
warp MAP_TRAINER_HILL_ENTRANCE, 255, 9, 6 warp MAP_TRAINER_HILL_ENTRANCE, 255, 9, 6
waitstate waitstate
end end
TrainerHill_1F_Movement_2C83EE:: @ 82C83EE @ Unused
TrainerHill_1F_Movement_SetInvisible:: @ 82C83EE
set_invisible set_invisible
step_end step_end
EventScript_2C83F0:: @ 82C83F0 @ TRAINER_PHILLIP is an actual Trainer on the SS Tidal, but is used as a placeholder here
trainerbattle TRAINER_BATTLE_12, TRAINER_PHILLIP, 0, BattleFacility_TrainerBattle_PlaceholderText, BattleFacility_TrainerBattle_PlaceholderText TrainerHill_EventScript_TrainerBattle:: @ 82C83F0
setvar VAR_0x8004, TRAINER_HILL_FUNC_11 trainerbattle TRAINER_BATTLE_HILL, TRAINER_PHILLIP, 0, BattleFacility_TrainerBattle_PlaceholderText, BattleFacility_TrainerBattle_PlaceholderText
setvar VAR_0x8004, TRAINER_HILL_FUNC_POST_BATTLE_TEXT
special CallTrainerHillFunction special CallTrainerHillFunction
waitmessage waitmessage
waitbuttonpress waitbuttonpress
+1 -1
View File
@@ -13,6 +13,6 @@
#define TRAINER_BATTLE_PYRAMID 9 #define TRAINER_BATTLE_PYRAMID 9
#define TRAINER_BATTLE_SET_TRAINER_A 10 #define TRAINER_BATTLE_SET_TRAINER_A 10
#define TRAINER_BATTLE_SET_TRAINER_B 11 #define TRAINER_BATTLE_SET_TRAINER_B 11
#define TRAINER_BATTLE_12 12 #define TRAINER_BATTLE_HILL 12
#endif // GUARD_CONSTANTS_BATTLE_SETUP_H #endif // GUARD_CONSTANTS_BATTLE_SETUP_H
+33 -15
View File
@@ -1,27 +1,45 @@
#ifndef GUARD_CONSTANTS_TRAINER_HILL_H #ifndef GUARD_CONSTANTS_TRAINER_HILL_H
#define GUARD_CONSTANTS_TRAINER_HILL_H #define GUARD_CONSTANTS_TRAINER_HILL_H
#define TRAINER_HILL_1F 1
#define TRAINER_HILL_2F 2
#define TRAINER_HILL_3F 3
#define TRAINER_HILL_4F 4
#define TRAINER_HILL_ROOF 5
#define TRAINER_HILL_ENTRANCE 6
#define NUM_TRAINER_HILL_FLOORS 4
#define NUM_TRAINER_HILL_PRIZE_LISTS 10
#define TRAINER_HILL_FUNC_START 0 #define TRAINER_HILL_FUNC_START 0
#define TRAINER_HILL_FUNC_1 1 #define TRAINER_HILL_FUNC_GET_OWNER_STATE 1
#define TRAINER_HILL_FUNC_2 2 #define TRAINER_HILL_FUNC_GIVE_PRIZE 2
#define TRAINER_HILL_FUNC_3 3 #define TRAINER_HILL_FUNC_CHECK_FINAL_TIME 3
#define TRAINER_HILL_FUNC_RESUME_TIMER 4 #define TRAINER_HILL_FUNC_RESUME_TIMER 4
#define TRAINER_HILL_FUNC_SET_LOST 5 #define TRAINER_HILL_FUNC_SET_LOST 5
#define TRAINER_HILL_FUNC_GET_CHALLENGE_STATUS 6 #define TRAINER_HILL_FUNC_GET_CHALLENGE_STATUS 6
#define TRAINER_HILL_FUNC_7 7 #define TRAINER_HILL_FUNC_GET_CHALLENGE_TIME 7
#define TRAINER_HILL_FUNC_8 8 #define TRAINER_HILL_FUNC_GET_ALL_FLOORS_USED 8
#define TRAINER_HILL_FUNC_9 9 #define TRAINER_HILL_FUNC_CLEAR_RESULT 9
#define TRAINER_HILL_FUNC_IS_IN 10 #define TRAINER_HILL_FUNC_IN_CHALLENGE 10
#define TRAINER_HILL_FUNC_11 11 #define TRAINER_HILL_FUNC_POST_BATTLE_TEXT 11
#define TRAINER_HILL_FUNC_12 12 #define TRAINER_HILL_FUNC_SET_ALL_TRAINER_FLAGS 12
#define TRAINER_HILL_FUNC_13 13 #define TRAINER_HILL_FUNC_GET_GAME_SAVED 13
#define TRAINER_HILL_FUNC_14 14 #define TRAINER_HILL_FUNC_SET_GAME_SAVED 14
#define TRAINER_HILL_FUNC_15 15 #define TRAINER_HILL_FUNC_CLEAR_GAME_SAVED 15
#define TRAINER_HILL_FUNC_16 16 #define TRAINER_HILL_FUNC_GET_WON 16
#define TRAINER_HILL_FUNC_SET_TAG 17 #define TRAINER_HILL_FUNC_SET_TAG 17
// Values returned by the TrainerHillGetChallengeStatus #define TRAINER_HILL_TEXT_INTRO 2
// function. #define TRAINER_HILL_TEXT_PLAYER_LOST 3
#define TRAINER_HILL_TEXT_PLAYER_WON 4
#define TRAINER_HILL_TEXT_AFTER 5
#define HILL_TRAINER_TYPE_EREADER 4
#define HILL_TRAINER_TYPE_NPC 8
// Values returned by TrainerHillGetChallengeStatus
#define TRAINER_HILL_PLAYER_STATUS_LOST 0 #define TRAINER_HILL_PLAYER_STATUS_LOST 0
#define TRAINER_HILL_PLAYER_STATUS_ECARD_SCANNED 1 #define TRAINER_HILL_PLAYER_STATUS_ECARD_SCANNED 1
#define TRAINER_HILL_PLAYER_STATUS_NORMAL 2 #define TRAINER_HILL_PLAYER_STATUS_NORMAL 2
+1 -1
View File
@@ -582,6 +582,6 @@ extern const u8 SecretBase_EventScript_TreeUseSecretPower[];
extern const u8 SecretBase_EventScript_ShrubUseSecretPower[]; extern const u8 SecretBase_EventScript_ShrubUseSecretPower[];
// trainer hill // trainer hill
extern const u8 EventScript_2C83F0[]; extern const u8 TrainerHill_EventScript_TrainerBattle[];
#endif // GUARD_EVENT_SCRIPTS_H #endif // GUARD_EVENT_SCRIPTS_H
+11 -11
View File
@@ -391,11 +391,11 @@ struct BattleFrontier
/*0xEBA*/ u16 field_EBA; /*0xEBA*/ u16 field_EBA;
/*0xEBC*/ u32 battlesCount; /*0xEBC*/ u32 battlesCount;
/*0xEC0*/ u16 field_EC0[16]; /*0xEC0*/ u16 field_EC0[16];
/*0xEE0*/ u8 field_EE0; /*0xEE0*/ u8 trainerFlags;
/*0xEE1*/ u8 opponentName[2][PLAYER_NAME_LENGTH + 1]; /*0xEE1*/ u8 opponentName[2][PLAYER_NAME_LENGTH + 1];
/*0xEF1*/ u8 field_EF1[2][4]; /*0xEF1*/ u8 field_EF1[2][4];
/*0xEF9*/ u8 field_EF9_0:7; /*0xEF9*/ u8 neverRead:7;
/*0xEF9*/ u8 field_EF9_1:1; /*0xEF9*/ u8 savedGame:1;
/*0xEFA*/ u8 field_EFA; /*0xEFA*/ u8 field_EFA;
/*0xEFB*/ u8 field_EFB; /*0xEFB*/ u8 field_EFB;
/*0xEFC*/ struct FrontierMonData field_EFC[3]; /*0xEFC*/ struct FrontierMonData field_EFC[3];
@@ -806,15 +806,15 @@ struct SaveTrainerHill
{ {
/*0x3D64*/ u32 timer; /*0x3D64*/ u32 timer;
/*0x3D68*/ u32 bestTime; /*0x3D68*/ u32 bestTime;
/*0x3D6C*/ u8 field_3D6C; /*0x3D6C*/ u8 neverRead;
/*0x3D6D*/ u8 unused; /*0x3D6D*/ u8 unused;
/*0x3D6E*/ u16 field_3D6E_0a:1; // 1 /*0x3D6E*/ u16 receivedPrize:1;
/*0x3D6E*/ u16 field_3D6E_0b:1; // 2 /*0x3D6E*/ u16 checkedFinalTime:1;
/*0x3D6E*/ u16 field_3D6E_0c:1; // 4 /*0x3D6E*/ u16 spokeToOwner:1;
/*0x3D6E*/ u16 hasLost:1; // 8 /*0x3D6E*/ u16 hasLost:1;
/*0x3D6E*/ u16 maybeECardScanDuringChallenge:1; // x10 /*0x3D6E*/ u16 maybeECardScanDuringChallenge:1;
/*0x3D6E*/ u16 field_3D6E_0f:1; // x20 /*0x3D6E*/ u16 field_3D6E_0f:1;
/*0x3D6E*/ u16 tag:2; // x40, x80 = xC0 /*0x3D6E*/ u16 tag:2;
}; };
struct MysteryEventStruct struct MysteryEventStruct
+9 -10
View File
@@ -32,15 +32,15 @@ struct TrHillDisplay
struct TrHillFloor struct TrHillFloor
{ {
u8 unk0; u8 trainerNum1;
u8 unk1; u8 trainerNum2;
struct TrainerHillTrainer trainers[2]; struct TrainerHillTrainer trainers[2];
struct TrHillDisplay display; struct TrHillDisplay display;
}; };
struct TrHillTag struct TrHillTag
{ {
u8 unkField_0; u8 trainerType;
u8 unused1; u8 unused1;
u8 numFloors; u8 numFloors;
u32 checksum; u32 checksum;
@@ -60,22 +60,21 @@ void CopyTrainerHillTrainerText(u8 which, u16 trainerId);
bool8 InTrainerHillChallenge(void); bool8 InTrainerHillChallenge(void);
void nullsub_129(void); void nullsub_129(void);
void PrintOnTrainerHillRecordsWindow(void); void PrintOnTrainerHillRecordsWindow(void);
void sub_81D5DF8(void); void LoadTrainerHillEventObjectTemplates(void);
bool32 sub_81D5F48(void); bool32 LoadTrainerHillFloorEventObjectScripts(void);
void sub_81D5FB4(u16 *mapArg); void GenerateTrainerHillFloorLayout(u16 *mapArg);
bool32 InTrainerHill(void); bool32 InTrainerHill(void);
u8 GetCurrentTrainerHillMapId(void); u8 GetCurrentTrainerHillMapId(void);
const struct WarpEvent* sub_81D6120(void); const struct WarpEvent* SetWarpDestinationTrainerHill4F(void);
const struct WarpEvent* sub_81D6134(u8 warpEventId); const struct WarpEvent* SetWarpDestinationTrainerHillFinalFloor(u8 warpEventId);
u16 LocalIdToHillTrainerId(u8 localId); u16 LocalIdToHillTrainerId(u8 localId);
bool8 GetHillTrainerFlag(u8 eventObjectId); bool8 GetHillTrainerFlag(u8 eventObjectId);
void SetHillTrainerFlag(void); void SetHillTrainerFlag(void);
const u8 *GetTrainerHillTrainerScript(void); const u8 *GetTrainerHillTrainerScript(void);
void FillHillTrainerParty(void); void FillHillTrainerParty(void);
void FillHillTrainersParties(void); void FillHillTrainersParties(void);
u32 sub_81D63C4(void);
u8 GetTrainerEncounterMusicIdInTrainerHill(u16 trainerId); u8 GetTrainerEncounterMusicIdInTrainerHill(u16 trainerId);
u8 sub_81D6490(void); u8 GetNumFloorsInTrainerHillChallenge(void);
void sub_81D64C0(void); void sub_81D64C0(void);
bool32 sub_81D6534(void); bool32 sub_81D6534(void);
+5 -4
View File
@@ -24,6 +24,7 @@
#include "constants/items.h" #include "constants/items.h"
#include "constants/moves.h" #include "constants/moves.h"
#include "constants/trainers.h" #include "constants/trainers.h"
#include "constants/trainer_hill.h"
struct BattleWindowText struct BattleWindowText
{ {
@@ -2574,7 +2575,7 @@ u32 BattleStringExpandPlaceholders(const u8 *src, u8 *dst)
} }
else if (gBattleTypeFlags & BATTLE_TYPE_TRAINER_HILL) else if (gBattleTypeFlags & BATTLE_TYPE_TRAINER_HILL)
{ {
CopyTrainerHillTrainerText(4, gTrainerBattleOpponent_A); CopyTrainerHillTrainerText(TRAINER_HILL_TEXT_PLAYER_WON, gTrainerBattleOpponent_A);
toCpy = gStringVar4; toCpy = gStringVar4;
} }
else else
@@ -2590,7 +2591,7 @@ u32 BattleStringExpandPlaceholders(const u8 *src, u8 *dst)
} }
else if (gBattleTypeFlags & BATTLE_TYPE_TRAINER_HILL) else if (gBattleTypeFlags & BATTLE_TYPE_TRAINER_HILL)
{ {
CopyTrainerHillTrainerText(3, gTrainerBattleOpponent_A); CopyTrainerHillTrainerText(TRAINER_HILL_TEXT_PLAYER_LOST, gTrainerBattleOpponent_A);
toCpy = gStringVar4; toCpy = gStringVar4;
} }
break; break;
@@ -2671,7 +2672,7 @@ u32 BattleStringExpandPlaceholders(const u8 *src, u8 *dst)
} }
else if (gBattleTypeFlags & BATTLE_TYPE_TRAINER_HILL) else if (gBattleTypeFlags & BATTLE_TYPE_TRAINER_HILL)
{ {
CopyTrainerHillTrainerText(4, gTrainerBattleOpponent_B); CopyTrainerHillTrainerText(TRAINER_HILL_TEXT_PLAYER_WON, gTrainerBattleOpponent_B);
toCpy = gStringVar4; toCpy = gStringVar4;
} }
else else
@@ -2687,7 +2688,7 @@ u32 BattleStringExpandPlaceholders(const u8 *src, u8 *dst)
} }
else if (gBattleTypeFlags & BATTLE_TYPE_TRAINER_HILL) else if (gBattleTypeFlags & BATTLE_TYPE_TRAINER_HILL)
{ {
CopyTrainerHillTrainerText(3, gTrainerBattleOpponent_B); CopyTrainerHillTrainerText(TRAINER_HILL_TEXT_PLAYER_LOST, gTrainerBattleOpponent_B);
toCpy = gStringVar4; toCpy = gStringVar4;
} }
break; break;
+13 -12
View File
@@ -1,25 +1,18 @@
#include "global.h" #include "global.h"
#include "constants/trainers.h"
#include "battle.h" #include "battle.h"
#include "constants/battle_setup.h"
#include "battle_setup.h" #include "battle_setup.h"
#include "battle_transition.h" #include "battle_transition.h"
#include "main.h" #include "main.h"
#include "task.h" #include "task.h"
#include "safari_zone.h" #include "safari_zone.h"
#include "script.h" #include "script.h"
#include "constants/game_stat.h"
#include "event_data.h" #include "event_data.h"
#include "constants/species.h"
#include "constants/songs.h"
#include "metatile_behavior.h" #include "metatile_behavior.h"
#include "constants/maps.h"
#include "field_player_avatar.h" #include "field_player_avatar.h"
#include "fieldmap.h" #include "fieldmap.h"
#include "random.h" #include "random.h"
#include "starter_choose.h" #include "starter_choose.h"
#include "script_pokemon_80F8.h" #include "script_pokemon_80F8.h"
#include "constants/items.h"
#include "palette.h" #include "palette.h"
#include "window.h" #include "window.h"
#include "event_object_movement.h" #include "event_object_movement.h"
@@ -42,10 +35,18 @@
#include "fldeff_misc.h" #include "fldeff_misc.h"
#include "field_control_avatar.h" #include "field_control_avatar.h"
#include "mirage_tower.h" #include "mirage_tower.h"
#include "constants/map_types.h"
#include "constants/battle_frontier.h"
#include "field_screen_effect.h" #include "field_screen_effect.h"
#include "data.h" #include "data.h"
#include "constants/battle_frontier.h"
#include "constants/battle_setup.h"
#include "constants/game_stat.h"
#include "constants/items.h"
#include "constants/songs.h"
#include "constants/map_types.h"
#include "constants/maps.h"
#include "constants/species.h"
#include "constants/trainers.h"
#include "constants/trainer_hill.h"
enum enum
{ {
@@ -1140,7 +1141,7 @@ const u8 *BattleSetup_ConfigureTrainerBattle(const u8 *data)
case TRAINER_BATTLE_SET_TRAINER_B: case TRAINER_BATTLE_SET_TRAINER_B:
TrainerBattleLoadArgs(sTrainerBOrdinaryBattleParams, data); TrainerBattleLoadArgs(sTrainerBOrdinaryBattleParams, data);
return NULL; return NULL;
case TRAINER_BATTLE_12: case TRAINER_BATTLE_HILL:
if (gApproachingTrainerId == 0) if (gApproachingTrainerId == 0)
{ {
TrainerBattleLoadArgs(sOrdinaryBattleParams, data); TrainerBattleLoadArgs(sOrdinaryBattleParams, data);
@@ -1364,9 +1365,9 @@ void ShowTrainerIntroSpeech(void)
else if (InTrainerHillChallenge()) else if (InTrainerHillChallenge())
{ {
if (gNoOfApproachingTrainers == 0 || gNoOfApproachingTrainers == 1) if (gNoOfApproachingTrainers == 0 || gNoOfApproachingTrainers == 1)
CopyTrainerHillTrainerText(2, LocalIdToHillTrainerId(gSpecialVar_LastTalked)); CopyTrainerHillTrainerText(TRAINER_HILL_TEXT_INTRO, LocalIdToHillTrainerId(gSpecialVar_LastTalked));
else else
CopyTrainerHillTrainerText(2, LocalIdToHillTrainerId(gEventObjects[gApproachingTrainers[gApproachingTrainerId].eventObjectId].localId)); CopyTrainerHillTrainerText(TRAINER_HILL_TEXT_INTRO, LocalIdToHillTrainerId(gEventObjects[gApproachingTrainers[gApproachingTrainerId].eventObjectId].localId));
sub_80982B8(); sub_80982B8();
} }
+60 -59
View File
@@ -1,16 +1,17 @@
#define TRAINER_HILL_OTID 0x10000000 #define TRAINER_HILL_OTID 0x10000000
static const struct TrHillTag gUnknown_0862609C = { static const struct TrHillTag sDataTagEReader = {
.unkField_0 = 4, .trainerType = HILL_TRAINER_TYPE_EREADER,
.unused1 = 1, .unused1 = 1,
.numFloors = 2, .numFloors = 2,
.checksum = 0x0 .checksum = 0x0
}; };
static const struct TrHillFloor gUnknown_0862609C_floors[] = { // In the JP Version of Trainer Hill, if there was an odd number of E-Reader trainers then one would be paired with an NPC
static const struct TrHillFloor sDataTagEReader_Floors[] = {
[0] = { [0] = {
.unk0 = 0, .trainerNum1 = 0,
.unk1 = 0, .trainerNum2 = 0,
.trainers = { .trainers = {
[0] = { [0] = {
.name = __("シゲノブ$$$$ "), .name = __("シゲノブ$$$$ "),
@@ -33,7 +34,7 @@ static const struct TrHillFloor gUnknown_0862609C_floors[] = {
.speedEV = 100, .speedEV = 100,
.spAttackEV = 0, .spAttackEV = 0,
.spDefenseEV = 100, .spDefenseEV = 100,
.otId = 0x10000000, .otId = TRAINER_HILL_OTID,
.hpIV = 5, .hpIV = 5,
.attackIV = 5, .attackIV = 5,
.defenseIV = 5, .defenseIV = 5,
@@ -57,7 +58,7 @@ static const struct TrHillFloor gUnknown_0862609C_floors[] = {
.speedEV = 0, .speedEV = 0,
.spAttackEV = 150, .spAttackEV = 150,
.spDefenseEV = 120, .spDefenseEV = 120,
.otId = 0x10000000, .otId = TRAINER_HILL_OTID,
.hpIV = 5, .hpIV = 5,
.attackIV = 5, .attackIV = 5,
.defenseIV = 5, .defenseIV = 5,
@@ -81,7 +82,7 @@ static const struct TrHillFloor gUnknown_0862609C_floors[] = {
.speedEV = 0, .speedEV = 0,
.spAttackEV = 0, .spAttackEV = 0,
.spDefenseEV = 200, .spDefenseEV = 200,
.otId = 0x10000000, .otId = TRAINER_HILL_OTID,
.hpIV = 5, .hpIV = 5,
.attackIV = 5, .attackIV = 5,
.defenseIV = 5, .defenseIV = 5,
@@ -122,7 +123,7 @@ static const struct TrHillFloor gUnknown_0862609C_floors[] = {
.speedEV = 0, .speedEV = 0,
.spAttackEV = 100, .spAttackEV = 100,
.spDefenseEV = 100, .spDefenseEV = 100,
.otId = 0x10000000, .otId = TRAINER_HILL_OTID,
.hpIV = 5, .hpIV = 5,
.attackIV = 5, .attackIV = 5,
.defenseIV = 5, .defenseIV = 5,
@@ -146,7 +147,7 @@ static const struct TrHillFloor gUnknown_0862609C_floors[] = {
.speedEV = 0, .speedEV = 0,
.spAttackEV = 100, .spAttackEV = 100,
.spDefenseEV = 100, .spDefenseEV = 100,
.otId = 0x10000000, .otId = TRAINER_HILL_OTID,
.hpIV = 5, .hpIV = 5,
.attackIV = 5, .attackIV = 5,
.defenseIV = 5, .defenseIV = 5,
@@ -170,7 +171,7 @@ static const struct TrHillFloor gUnknown_0862609C_floors[] = {
.speedEV = 0, .speedEV = 0,
.spAttackEV = 100, .spAttackEV = 100,
.spDefenseEV = 100, .spDefenseEV = 100,
.otId = 0x10000000, .otId = TRAINER_HILL_OTID,
.hpIV = 5, .hpIV = 5,
.attackIV = 5, .attackIV = 5,
.defenseIV = 5, .defenseIV = 5,
@@ -194,8 +195,8 @@ static const struct TrHillFloor gUnknown_0862609C_floors[] = {
} }
}, },
[1] = { [1] = {
.unk0 = 0, .trainerNum1 = 0,
.unk1 = 0, .trainerNum2 = 0,
.trainers = { .trainers = {
[0] = { [0] = {
.name = __("シゲゾウ$$$$ "), .name = __("シゲゾウ$$$$ "),
@@ -218,7 +219,7 @@ static const struct TrHillFloor gUnknown_0862609C_floors[] = {
.speedEV = 120, .speedEV = 120,
.spAttackEV = 150, .spAttackEV = 150,
.spDefenseEV = 0, .spDefenseEV = 0,
.otId = 0x10000000, .otId = TRAINER_HILL_OTID,
.hpIV = 5, .hpIV = 5,
.attackIV = 5, .attackIV = 5,
.defenseIV = 5, .defenseIV = 5,
@@ -242,7 +243,7 @@ static const struct TrHillFloor gUnknown_0862609C_floors[] = {
.speedEV = 0, .speedEV = 0,
.spAttackEV = 100, .spAttackEV = 100,
.spDefenseEV = 100, .spDefenseEV = 100,
.otId = 0x10000000, .otId = TRAINER_HILL_OTID,
.hpIV = 5, .hpIV = 5,
.attackIV = 5, .attackIV = 5,
.defenseIV = 5, .defenseIV = 5,
@@ -266,7 +267,7 @@ static const struct TrHillFloor gUnknown_0862609C_floors[] = {
.speedEV = 0, .speedEV = 0,
.spAttackEV = 110, .spAttackEV = 110,
.spDefenseEV = 100, .spDefenseEV = 100,
.otId = 0x10000000, .otId = TRAINER_HILL_OTID,
.hpIV = 5, .hpIV = 5,
.attackIV = 5, .attackIV = 5,
.defenseIV = 5, .defenseIV = 5,
@@ -307,7 +308,7 @@ static const struct TrHillFloor gUnknown_0862609C_floors[] = {
.speedEV = 0, .speedEV = 0,
.spAttackEV = 110, .spAttackEV = 110,
.spDefenseEV = 100, .spDefenseEV = 100,
.otId = 0x10000000, .otId = TRAINER_HILL_OTID,
.hpIV = 5, .hpIV = 5,
.attackIV = 5, .attackIV = 5,
.defenseIV = 5, .defenseIV = 5,
@@ -331,7 +332,7 @@ static const struct TrHillFloor gUnknown_0862609C_floors[] = {
.speedEV = 100, .speedEV = 100,
.spAttackEV = 110, .spAttackEV = 110,
.spDefenseEV = 100, .spDefenseEV = 100,
.otId = 0x10000000, .otId = TRAINER_HILL_OTID,
.hpIV = 5, .hpIV = 5,
.attackIV = 5, .attackIV = 5,
.defenseIV = 5, .defenseIV = 5,
@@ -355,7 +356,7 @@ static const struct TrHillFloor gUnknown_0862609C_floors[] = {
.speedEV = 80, .speedEV = 80,
.spAttackEV = 80, .spAttackEV = 80,
.spDefenseEV = 80, .spDefenseEV = 80,
.otId = 0x10000000, .otId = TRAINER_HILL_OTID,
.hpIV = 5, .hpIV = 5,
.attackIV = 5, .attackIV = 5,
.defenseIV = 5, .defenseIV = 5,
@@ -382,18 +383,18 @@ static const struct TrHillFloor gUnknown_0862609C_floors[] = {
static const struct TrHillTag sDataTagNormal = static const struct TrHillTag sDataTagNormal =
{ {
.unkField_0 = 8, .trainerType = HILL_TRAINER_TYPE_NPC,
.unused1 = 2, .unused1 = 2,
.numFloors = 4, .numFloors = 4,
.checksum = 0x00051E05 .checksum = 0x00051E05
}; };
static const struct TrHillFloor sDataTagNormal_floors[] = static const struct TrHillFloor sDataTagNormal_Floors[] =
{ {
[0] = [0] =
{ {
.unk0 = 0x11, .trainerNum1 = 17,
.unk1 = 0x12, .trainerNum2 = 18,
.trainers = .trainers =
{ {
[0] = [0] =
@@ -694,8 +695,8 @@ static const struct TrHillFloor sDataTagNormal_floors[] =
}, },
[1] = [1] =
{ {
.unk0 = 0x13, .trainerNum1 = 19,
.unk1 = 0x14, .trainerNum2 = 20,
.trainers = .trainers =
{ {
[0] = [0] =
@@ -999,8 +1000,8 @@ static const struct TrHillFloor sDataTagNormal_floors[] =
}, },
[2] = [2] =
{ {
.unk0 = 0x15, .trainerNum1 = 21,
.unk1 = 0x16, .trainerNum2 = 22,
.trainers = .trainers =
{ {
[0] = [0] =
@@ -1303,8 +1304,8 @@ static const struct TrHillFloor sDataTagNormal_floors[] =
}, },
[3] = [3] =
{ {
.unk0 = 0x17, .trainerNum1 = 23,
.unk1 = 0x18, .trainerNum2 = 24,
.trainers = .trainers =
{ {
[0] = [0] =
@@ -1602,17 +1603,17 @@ static const struct TrHillFloor sDataTagNormal_floors[] =
static const struct TrHillTag sDataTagVariety = static const struct TrHillTag sDataTagVariety =
{ {
.unkField_0 = 8, .trainerType = HILL_TRAINER_TYPE_NPC,
.unused1 = 1, .unused1 = 1,
.numFloors = 4, .numFloors = 4,
.checksum = 0x00054C15 .checksum = 0x00054C15
}; };
static const struct TrHillFloor sDataTagVariety_floors[] = { static const struct TrHillFloor sDataTagVariety_Floors[] = {
[0] = [0] =
{ {
.unk0 = 0x29, .trainerNum1 = 41,
.unk1 = 0x2A, .trainerNum2 = 42,
.trainers = .trainers =
{ {
[0] = [0] =
@@ -1904,8 +1905,8 @@ static const struct TrHillFloor sDataTagVariety_floors[] = {
}, },
[1] = [1] =
{ {
.unk0 = 0x2B, .trainerNum1 = 43,
.unk1 = 0x2C, .trainerNum2 = 44,
.trainers = .trainers =
{ {
[0] = [0] =
@@ -2227,8 +2228,8 @@ static const struct TrHillFloor sDataTagVariety_floors[] = {
}, },
[2] = [2] =
{ {
.unk0 = 0x2D, .trainerNum1 = 45,
.unk1 = 0x2E, .trainerNum2 = 46,
.trainers = .trainers =
{ {
[0] = [0] =
@@ -2531,8 +2532,8 @@ static const struct TrHillFloor sDataTagVariety_floors[] = {
}, },
[3] = [3] =
{ {
.unk0 = 0x2F, .trainerNum1 = 47,
.unk1 = 0x30, .trainerNum2 = 48,
.trainers = .trainers =
{ {
[0] = [0] =
@@ -2828,17 +2829,17 @@ static const struct TrHillFloor sDataTagVariety_floors[] = {
static const struct TrHillTag sDataTagUnique = static const struct TrHillTag sDataTagUnique =
{ {
.unkField_0 = 8, .trainerType = HILL_TRAINER_TYPE_NPC,
.unused1 = 3, .unused1 = 3,
.numFloors = 4, .numFloors = 4,
.checksum = 0x000652F3 .checksum = 0x000652F3
}; };
static const struct TrHillFloor sDataTagUnique_floors[] = { static const struct TrHillFloor sDataTagUnique_Floors[] = {
[0] = [0] =
{ {
.unk0 = 0x31, .trainerNum1 = 49,
.unk1 = 0x32, .trainerNum2 = 50,
.trainers = .trainers =
{ {
[0] = [0] =
@@ -3135,8 +3136,8 @@ static const struct TrHillFloor sDataTagUnique_floors[] = {
}, },
[1] = [1] =
{ {
.unk0 = 0x33, .trainerNum1 = 51,
.unk1 = 0x34, .trainerNum2 = 52,
.trainers = .trainers =
{ {
[0] = [0] =
@@ -3439,8 +3440,8 @@ static const struct TrHillFloor sDataTagUnique_floors[] = {
}, },
[2] = [2] =
{ {
.unk0 = 0x35, .trainerNum1 = 53,
.unk1 = 0x36, .trainerNum2 = 54,
.trainers = .trainers =
{ {
[0] = [0] =
@@ -3743,8 +3744,8 @@ static const struct TrHillFloor sDataTagUnique_floors[] = {
}, },
[3] = [3] =
{ {
.unk0 = 0x38, .trainerNum1 = 56,
.unk1 = 0x37, .trainerNum2 = 55,
.trainers = .trainers =
{ {
[0] = [0] =
@@ -4039,17 +4040,17 @@ static const struct TrHillFloor sDataTagUnique_floors[] = {
static const struct TrHillTag sDataTagExpert = static const struct TrHillTag sDataTagExpert =
{ {
.unkField_0 = 8, .trainerType = HILL_TRAINER_TYPE_NPC,
.unused1 = 1, .unused1 = 1,
.numFloors = 4, .numFloors = 4,
.checksum = 0x00061F3F .checksum = 0x00061F3F
}; };
static const struct TrHillFloor sDataTagExpert_floors[] = { static const struct TrHillFloor sDataTagExpert_Floors[] = {
[0] = [0] =
{ {
.unk0 = 0x39, .trainerNum1 = 57,
.unk1 = 0x3A, .trainerNum2 = 58,
.trainers = .trainers =
{ {
[0] = [0] =
@@ -4353,8 +4354,8 @@ static const struct TrHillFloor sDataTagExpert_floors[] = {
}, },
[1] = [1] =
{ {
.unk0 = 0x3B, .trainerNum1 = 59,
.unk1 = 0x3C, .trainerNum2 = 60,
.trainers = .trainers =
{ {
[0] = [0] =
@@ -4658,8 +4659,8 @@ static const struct TrHillFloor sDataTagExpert_floors[] = {
}, },
[2] = [2] =
{ {
.unk0 = 0x3D, .trainerNum1 = 61,
.unk1 = 0x3E, .trainerNum2 = 62,
.trainers = .trainers =
{ {
[0] = [0] =
@@ -4963,8 +4964,8 @@ static const struct TrHillFloor sDataTagExpert_floors[] = {
}, },
[3] = [3] =
{ {
.unk0 = 0x3F, .trainerNum1 = 63,
.unk1 = 0x40, .trainerNum2 = 64,
.trainers = .trainers =
{ {
[0] = [0] =
+3 -3
View File
@@ -448,7 +448,7 @@ static bool32 TryWriteTrainerHill_r(struct EReaderTrainerHillSet *ttdata, struct
AGB_ASSERT_EX(ttdata->id == 0, "cereader_tool.c", 452); AGB_ASSERT_EX(ttdata->id == 0, "cereader_tool.c", 452);
memset(buffer2, 0, 0x1000); memset(buffer2, 0, 0x1000);
buffer2->unkField_0 = ttdata->count; buffer2->trainerType = ttdata->count;
buffer2->unused1 = sub_81D38D4(); buffer2->unused1 = sub_81D38D4();
buffer2->numFloors = (ttdata->count + 1) / 2; buffer2->numFloors = (ttdata->count + 1) / 2;
@@ -456,13 +456,13 @@ static bool32 TryWriteTrainerHill_r(struct EReaderTrainerHillSet *ttdata, struct
{ {
if (!(i & 1)) if (!(i & 1))
{ {
buffer2->floors[i / 2].unk0 = ttdata->unk_8[i].unk0; buffer2->floors[i / 2].trainerNum1 = ttdata->unk_8[i].unk0;
buffer2->floors[i / 2].display = ttdata->unk_8[i].unk14C; buffer2->floors[i / 2].display = ttdata->unk_8[i].unk14C;
buffer2->floors[i / 2].trainers[0] = ttdata->unk_8[i].unk4; buffer2->floors[i / 2].trainers[0] = ttdata->unk_8[i].unk4;
} }
else else
{ {
buffer2->floors[i / 2].unk1 = ttdata->unk_8[i].unk0; buffer2->floors[i / 2].trainerNum2 = ttdata->unk_8[i].unk0;
buffer2->floors[i / 2].trainers[1] = ttdata->unk_8[i].unk4; buffer2->floors[i / 2].trainers[1] = ttdata->unk_8[i].unk4;
} }
} }
+5 -8
View File
@@ -33,6 +33,7 @@
#include "constants/map_types.h" #include "constants/map_types.h"
#include "constants/maps.h" #include "constants/maps.h"
#include "constants/songs.h" #include "constants/songs.h"
#include "constants/trainer_hill.h"
static EWRAM_DATA u8 sWildEncounterImmunitySteps = 0; static EWRAM_DATA u8 sWildEncounterImmunitySteps = 0;
static EWRAM_DATA u16 sPreviousPlayerMetatileBehavior = 0; static EWRAM_DATA u16 sPreviousPlayerMetatileBehavior = 0;
@@ -792,20 +793,16 @@ static void SetupWarp(struct MapHeader *unused, s8 warpEventId, struct MapPositi
if (trainerHillMapId) if (trainerHillMapId)
{ {
if (trainerHillMapId == sub_81D6490()) if (trainerHillMapId == GetNumFloorsInTrainerHillChallenge())
{ {
if (warpEventId == 0) if (warpEventId == 0)
{
warpEvent = &gMapHeader.events->warps[0]; warpEvent = &gMapHeader.events->warps[0];
}
else else
{ warpEvent = SetWarpDestinationTrainerHill4F();
warpEvent = sub_81D6120();
}
} }
else if (trainerHillMapId == 5) else if (trainerHillMapId == TRAINER_HILL_ROOF)
{ {
warpEvent = sub_81D6134(warpEventId); warpEvent = SetWarpDestinationTrainerHillFinalFloor(warpEventId);
} }
else else
{ {
+1 -1
View File
@@ -75,7 +75,7 @@ void InitBattlePyramidMap(bool8 setPlayerPosition)
void InitTrainerHillMap(void) void InitTrainerHillMap(void)
{ {
CpuFastFill(0x03ff03ff, gBackupMapData, sizeof(gBackupMapData)); CpuFastFill(0x03ff03ff, gBackupMapData, sizeof(gBackupMapData));
sub_81D5FB4(gBackupMapData); GenerateTrainerHillFloorLayout(gBackupMapData);
} }
static void InitMapLayoutData(struct MapHeader *mapHeader) static void InitMapLayoutData(struct MapHeader *mapHeader)
+4 -3
View File
@@ -64,6 +64,7 @@
#include "constants/region_map_sections.h" #include "constants/region_map_sections.h"
#include "constants/songs.h" #include "constants/songs.h"
#include "constants/species.h" #include "constants/species.h"
#include "constants/trainer_hill.h"
#include "constants/weather.h" #include "constants/weather.h"
#define PLAYER_TRADING_STATE_IDLE 0x80 #define PLAYER_TRADING_STATE_IDLE 0x80
@@ -854,7 +855,7 @@ static void mli0_load_map(u32 a1)
if (gMapHeader.mapLayoutId == LAYOUT_BATTLE_FRONTIER_BATTLE_PYRAMID_EMPTY_SQUARE) if (gMapHeader.mapLayoutId == LAYOUT_BATTLE_FRONTIER_BATTLE_PYRAMID_EMPTY_SQUARE)
LoadBattlePyramidEventObjectTemplates(); LoadBattlePyramidEventObjectTemplates();
else if (InTrainerHill()) else if (InTrainerHill())
sub_81D5DF8(); LoadTrainerHillEventObjectTemplates();
else else
LoadEventObjTemplatesFromHeader(); LoadEventObjTemplatesFromHeader();
} }
@@ -1721,8 +1722,8 @@ void CB2_ContinueSavedGame(void)
trainerHillMapId = GetCurrentTrainerHillMapId(); trainerHillMapId = GetCurrentTrainerHillMapId();
if (gMapHeader.mapLayoutId == LAYOUT_BATTLE_FRONTIER_BATTLE_PYRAMID_EMPTY_SQUARE) if (gMapHeader.mapLayoutId == LAYOUT_BATTLE_FRONTIER_BATTLE_PYRAMID_EMPTY_SQUARE)
LoadBattlePyramidFloorEventObjectScripts(); LoadBattlePyramidFloorEventObjectScripts();
else if (trainerHillMapId != 0 && trainerHillMapId != 6) else if (trainerHillMapId != 0 && trainerHillMapId != TRAINER_HILL_ENTRANCE)
sub_81D5F48(); LoadTrainerHillFloorEventObjectScripts();
else else
LoadSaveblockEventObjScripts(); LoadSaveblockEventObjScripts();
+243 -218
View File
@@ -22,6 +22,7 @@
#include "trainer_hill.h" #include "trainer_hill.h"
#include "window.h" #include "window.h"
#include "util.h" #include "util.h"
#include "constants/battle_ai.h"
#include "constants/event_object_movement_constants.h" #include "constants/event_object_movement_constants.h"
#include "constants/event_objects.h" #include "constants/event_objects.h"
#include "constants/items.h" #include "constants/items.h"
@@ -45,7 +46,7 @@ struct TrHillStruct2
{ {
u8 floorId; u8 floorId;
struct TrHillTag tag; struct TrHillTag tag;
struct TrHillFloor floors[4]; struct TrHillFloor floors[NUM_TRAINER_HILL_FLOORS];
}; };
static EWRAM_DATA struct TrHillStruct2 *sHillData = NULL; static EWRAM_DATA struct TrHillStruct2 *sHillData = NULL;
@@ -54,30 +55,30 @@ EWRAM_DATA u32 *gTrainerHillVBlankCounter = NULL;
// This file's functions. // This file's functions.
static void TrainerHillStartChallenge(void); static void TrainerHillStartChallenge(void);
static void sub_81D58D8(void); static void GetOwnerState(void);
static void sub_81D5924(void); static void GiveChallengePrize(void);
static void sub_81D59D0(void); static void CheckFinalTime(void);
static void TrainerHillResumeTimer(void); static void TrainerHillResumeTimer(void);
static void TrainerHillSetPlayerLost(void); static void TrainerHillSetPlayerLost(void);
static void TrainerHillGetChallengeStatus(void); static void TrainerHillGetChallengeStatus(void);
static void sub_81D5B2C(void); static void BufferChallengeTime(void);
static void sub_81D5BBC(void); static void GetAllFloorsUsed(void);
static void sub_81D5C00(void); static void ClearVarResult(void);
static void GetInTrainerHill(void); static void IsTrainerHillChallengeActive(void);
static void sub_81D62B4(void); static void ShowTrainerHillPostBattleText(void);
static void sub_81D64AC(void); static void SetAllTrainerFlags(void);
static void sub_81D64DC(void); static void GetGameSaved(void);
static void sub_81D64FC(void); static void SetGameSaved(void);
static void sub_81D6518(void); static void ClearGameSaved(void);
static void sub_81D6568(void); static void GetChallengeWon(void);
static void TrainerHillSetTag(void); static void TrainerHillSetTag(void);
static void SetUpDataStruct(void); static void SetUpDataStruct(void);
static void FreeDataStruct(void); static void FreeDataStruct(void);
static void nullsub_2(void); static void nullsub_2(void);
static void SetTimerValue(u32 *dst, u32 val); static void SetTimerValue(u32 *dst, u32 val);
static u32 GetTimerValue(u32 *src); static u32 GetTimerValue(u32 *src);
static void sub_81D642C(struct Pokemon *mon, u8 level); static void SetTrainerHillMonLevel(struct Pokemon *mon, u8 level);
static u16 sub_81D6640(void); static u16 GetPrizeItemId(void);
// const data // const data
#include "data/battle_frontier/trainer_hill.h" #include "data/battle_frontier/trainer_hill.h"
@@ -86,7 +87,7 @@ struct
{ {
u8 trainerClass; u8 trainerClass;
u8 musicId; u8 musicId;
} static const gUnknown_0862A3B4[] = } static const sTrainerClassesAndMusic[] =
{ {
{TRAINER_CLASS_TEAM_AQUA, TRAINER_ENCOUNTER_MUSIC_AQUA}, {TRAINER_CLASS_TEAM_AQUA, TRAINER_ENCOUNTER_MUSIC_AQUA},
{TRAINER_CLASS_AQUA_ADMIN, TRAINER_ENCOUNTER_MUSIC_AQUA}, {TRAINER_CLASS_AQUA_ADMIN, TRAINER_ENCOUNTER_MUSIC_AQUA},
@@ -144,63 +145,64 @@ struct
{TRAINER_CLASS_SCHOOL_KID, TRAINER_ENCOUNTER_MUSIC_MALE}, {TRAINER_CLASS_SCHOOL_KID, TRAINER_ENCOUNTER_MUSIC_MALE},
}; };
static const u16 gUnknown_0862A48C[] = {ITEM_RARE_CANDY, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; static const u16 sPrizeListRareCandy1[] = {ITEM_RARE_CANDY, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL};
static const u16 gUnknown_0862A498[] = {ITEM_LUXURY_BALL, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; static const u16 sPrizeListLuxuryBall1[] = {ITEM_LUXURY_BALL, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL};
static const u16 gUnknown_0862A4A4[] = {ITEM_MAX_REVIVE, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; static const u16 sPrizeListMaxRevive1[] = {ITEM_MAX_REVIVE, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL};
static const u16 gUnknown_0862A4B0[] = {ITEM_MAX_ETHER, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; static const u16 sPrizeListMaxEther1[] = {ITEM_MAX_ETHER, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL};
static const u16 gUnknown_0862A4BC[] = {ITEM_ELIXIR, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; static const u16 sPrizeListElixir1[] = {ITEM_ELIXIR, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL};
static const u16 gUnknown_0862A4C8[] = {ITEM_TM05_ROAR, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; static const u16 sPrizeListRoar[] = {ITEM_TM05_ROAR, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL};
static const u16 gUnknown_0862A4D4[] = {ITEM_TM36_SLUDGE_BOMB, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; static const u16 sPrizeListSludgeBomb[] = {ITEM_TM36_SLUDGE_BOMB, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL};
static const u16 gUnknown_0862A4E0[] = {ITEM_TM06_TOXIC, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; static const u16 sPrizeListToxic[] = {ITEM_TM06_TOXIC, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL};
static const u16 gUnknown_0862A4EC[] = {ITEM_TM11_SUNNY_DAY, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; static const u16 sPrizeListSunnyDay[] = {ITEM_TM11_SUNNY_DAY, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL};
static const u16 gUnknown_0862A4F8[] = {ITEM_TM26_EARTHQUAKE, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; static const u16 sPrizeListEarthQuake[] = {ITEM_TM26_EARTHQUAKE, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL};
static const u16 gUnknown_0862A504[] = {ITEM_RARE_CANDY, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL};
static const u16 gUnknown_0862A510[] = {ITEM_LUXURY_BALL, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL};
static const u16 gUnknown_0862A51C[] = {ITEM_MAX_REVIVE, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL};
static const u16 gUnknown_0862A528[] = {ITEM_MAX_ETHER, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL};
static const u16 gUnknown_0862A534[] = {ITEM_ELIXIR, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL};
static const u16 gUnknown_0862A540[] = {ITEM_TM31_BRICK_BREAK, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL};
static const u16 gUnknown_0862A54C[] = {ITEM_TM41_TORMENT, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL};
static const u16 gUnknown_0862A558[] = {ITEM_TM48_SKILL_SWAP, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL};
static const u16 gUnknown_0862A564[] = {ITEM_TM19_GIGA_DRAIN, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL};
static const u16 gUnknown_0862A570[] = {ITEM_TM45_ATTRACT, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL};
static const u16 *const gUnknown_0862A57C[] = static const u16 sPrizeListRareCandy2[] = {ITEM_RARE_CANDY, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL};
static const u16 sPrizeListLuxuryBall2[] = {ITEM_LUXURY_BALL, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL};
static const u16 sPrizeListMaxRevive2[] = {ITEM_MAX_REVIVE, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL};
static const u16 sPrizeListMaxEther2[] = {ITEM_MAX_ETHER, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL};
static const u16 sPrizeListElixir2[] = {ITEM_ELIXIR, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL};
static const u16 sPrizeListBrickBreak[] = {ITEM_TM31_BRICK_BREAK, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL};
static const u16 sPrizeListTorment[] = {ITEM_TM41_TORMENT, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL};
static const u16 sPrizeListSkillSwap[] = {ITEM_TM48_SKILL_SWAP, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL};
static const u16 sPrizeListGigaSwap[] = {ITEM_TM19_GIGA_DRAIN, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL};
static const u16 sPrizeListAttract[] = {ITEM_TM45_ATTRACT, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL};
static const u16 *const sPrizeLists1[NUM_TRAINER_HILL_PRIZE_LISTS] =
{ {
gUnknown_0862A48C, sPrizeListRareCandy1,
gUnknown_0862A498, sPrizeListLuxuryBall1,
gUnknown_0862A4A4, sPrizeListMaxRevive1,
gUnknown_0862A4B0, sPrizeListMaxEther1,
gUnknown_0862A4BC, sPrizeListElixir1,
gUnknown_0862A4C8, sPrizeListRoar,
gUnknown_0862A4D4, sPrizeListSludgeBomb,
gUnknown_0862A4E0, sPrizeListToxic,
gUnknown_0862A4EC, sPrizeListSunnyDay,
gUnknown_0862A4F8 sPrizeListEarthQuake
}; };
static const u16 *const gUnknown_0862A5A4[] = static const u16 *const sPrizeLists2[NUM_TRAINER_HILL_PRIZE_LISTS] =
{ {
gUnknown_0862A504, sPrizeListRareCandy2,
gUnknown_0862A510, sPrizeListLuxuryBall2,
gUnknown_0862A51C, sPrizeListMaxRevive2,
gUnknown_0862A528, sPrizeListMaxEther2,
gUnknown_0862A534, sPrizeListElixir2,
gUnknown_0862A540, sPrizeListBrickBreak,
gUnknown_0862A54C, sPrizeListTorment,
gUnknown_0862A558, sPrizeListSkillSwap,
gUnknown_0862A564, sPrizeListGigaSwap,
gUnknown_0862A570 sPrizeListAttract
}; };
static const u16 *const *const gUnknown_0862A5CC[] = static const u16 *const *const sPrizeListSets[] =
{ {
gUnknown_0862A57C, sPrizeLists1,
gUnknown_0862A5A4 sPrizeLists2
}; };
static const u16 gUnknown_0862A5D4[] = INCBIN_U16("graphics/pokenav/862A5D4.gbapal"); static const u16 sUnknown_0862A5D4[] = INCBIN_U16("graphics/pokenav/862A5D4.gbapal");
static const u8 sRecordWinColors[] = {0, 2, 3}; static const u8 sRecordWinColors[] = {TEXT_COLOR_TRANSPARENT, TEXT_COLOR_DARK_GREY, TEXT_COLOR_LIGHT_GREY};
static const struct TrHillTag *const sDataPerTag[] = static const struct TrHillTag *const sDataPerTag[] =
{ {
@@ -221,24 +223,24 @@ static const u8 *const sFloorStrings[] =
static void (* const sHillFunctions[])(void) = static void (* const sHillFunctions[])(void) =
{ {
TrainerHillStartChallenge, [TRAINER_HILL_FUNC_START] = TrainerHillStartChallenge,
sub_81D58D8, [TRAINER_HILL_FUNC_GET_OWNER_STATE] = GetOwnerState,
sub_81D5924, [TRAINER_HILL_FUNC_GIVE_PRIZE] = GiveChallengePrize,
sub_81D59D0, [TRAINER_HILL_FUNC_CHECK_FINAL_TIME] = CheckFinalTime,
TrainerHillResumeTimer, [TRAINER_HILL_FUNC_RESUME_TIMER] = TrainerHillResumeTimer,
TrainerHillSetPlayerLost, [TRAINER_HILL_FUNC_SET_LOST] = TrainerHillSetPlayerLost,
TrainerHillGetChallengeStatus, [TRAINER_HILL_FUNC_GET_CHALLENGE_STATUS] = TrainerHillGetChallengeStatus,
sub_81D5B2C, [TRAINER_HILL_FUNC_GET_CHALLENGE_TIME] = BufferChallengeTime,
sub_81D5BBC, [TRAINER_HILL_FUNC_GET_ALL_FLOORS_USED] = GetAllFloorsUsed,
sub_81D5C00, [TRAINER_HILL_FUNC_CLEAR_RESULT] = ClearVarResult,
GetInTrainerHill, [TRAINER_HILL_FUNC_IN_CHALLENGE] = IsTrainerHillChallengeActive,
sub_81D62B4, [TRAINER_HILL_FUNC_POST_BATTLE_TEXT] = ShowTrainerHillPostBattleText,
sub_81D64AC, [TRAINER_HILL_FUNC_SET_ALL_TRAINER_FLAGS] = SetAllTrainerFlags,
sub_81D64DC, [TRAINER_HILL_FUNC_GET_GAME_SAVED] = GetGameSaved,
sub_81D64FC, [TRAINER_HILL_FUNC_SET_GAME_SAVED] = SetGameSaved,
sub_81D6518, [TRAINER_HILL_FUNC_CLEAR_GAME_SAVED] = ClearGameSaved,
sub_81D6568, [TRAINER_HILL_FUNC_GET_WON] = GetChallengeWon,
TrainerHillSetTag, [TRAINER_HILL_FUNC_SET_TAG] = TrainerHillSetTag,
}; };
static const u8 *const sTagMatchStrings[] = static const u8 *const sTagMatchStrings[] =
@@ -249,7 +251,7 @@ static const u8 *const sTagMatchStrings[] =
gText_ExpertTagMatch, gText_ExpertTagMatch,
}; };
static const struct EventObjectTemplate gUnknown_0862A670 = static const struct EventObjectTemplate sTrainerEventObjectTemplate =
{ {
.graphicsId = EVENT_OBJ_GFX_RIVAL_BRENDAN_NORMAL, .graphicsId = EVENT_OBJ_GFX_RIVAL_BRENDAN_NORMAL,
.elevation = 3, .elevation = 3,
@@ -259,8 +261,18 @@ static const struct EventObjectTemplate gUnknown_0862A670 =
.trainerType = 1, .trainerType = 1,
}; };
static const u32 gUnknown_0862A688[] = {MAP_NUM(TRAINER_HILL_2F), MAP_NUM(TRAINER_HILL_3F), MAP_NUM(TRAINER_HILL_4F), MAP_NUM(TRAINER_HILL_ROOF)}; static const u32 sNextFloorMapNum[NUM_TRAINER_HILL_FLOORS] =
static const u8 gUnknown_0862A698[][3] = {{0, 1, 2}, {3, 4, 5}}; {
MAP_NUM(TRAINER_HILL_2F),
MAP_NUM(TRAINER_HILL_3F),
MAP_NUM(TRAINER_HILL_4F),
MAP_NUM(TRAINER_HILL_ROOF)
};
static const u8 sTrainerPartySlots[][PARTY_SIZE / 2] =
{
{0, 1, 2},
{3, 4, 5}
};
// code // code
void CallTrainerHillFunction(void) void CallTrainerHillFunction(void)
@@ -274,8 +286,8 @@ void ResetTrainerHillResults(void)
{ {
s32 i; s32 i;
gSaveBlock2Ptr->frontier.field_EF9_1 = 0; gSaveBlock2Ptr->frontier.savedGame = FALSE;
gSaveBlock2Ptr->frontier.field_EF9_0 = 0; gSaveBlock2Ptr->frontier.neverRead = 0;
gSaveBlock1Ptr->trainerHill.bestTime = 0; gSaveBlock1Ptr->trainerHill.bestTime = 0;
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
SetTimerValue(&gSaveBlock1Ptr->trainerHillTimes[i], HILL_MAX_TIME); SetTimerValue(&gSaveBlock1Ptr->trainerHillTimes[i], HILL_MAX_TIME);
@@ -366,16 +378,16 @@ void CopyTrainerHillTrainerText(u8 which, u16 trainerId)
switch (which) switch (which)
{ {
case 2: case TRAINER_HILL_TEXT_INTRO:
FrontierSpeechToString(sHillData->floors[floorId].trainers[id].speechBefore); FrontierSpeechToString(sHillData->floors[floorId].trainers[id].speechBefore);
break; break;
case 3: case TRAINER_HILL_TEXT_PLAYER_LOST:
FrontierSpeechToString(sHillData->floors[floorId].trainers[id].speechWin); FrontierSpeechToString(sHillData->floors[floorId].trainers[id].speechWin);
break; break;
case 4: case TRAINER_HILL_TEXT_PLAYER_WON:
FrontierSpeechToString(sHillData->floors[floorId].trainers[id].speechLose); FrontierSpeechToString(sHillData->floors[floorId].trainers[id].speechLose);
break; break;
case 5: case TRAINER_HILL_TEXT_AFTER:
FrontierSpeechToString(sHillData->floors[floorId].trainers[id].speechAfter); FrontierSpeechToString(sHillData->floors[floorId].trainers[id].speechAfter);
break; break;
} }
@@ -391,42 +403,42 @@ static void TrainerHillStartChallenge(void)
else else
gSaveBlock1Ptr->trainerHill.field_3D6E_0f = 0; gSaveBlock1Ptr->trainerHill.field_3D6E_0f = 0;
gSaveBlock1Ptr->trainerHill.field_3D6C = 0; gSaveBlock1Ptr->trainerHill.neverRead = 0;
SetTrainerHillVBlankCounter(&gSaveBlock1Ptr->trainerHill.timer); SetTrainerHillVBlankCounter(&gSaveBlock1Ptr->trainerHill.timer);
gSaveBlock1Ptr->trainerHill.timer = 0; gSaveBlock1Ptr->trainerHill.timer = 0;
gSaveBlock1Ptr->trainerHill.field_3D6E_0c = 0; gSaveBlock1Ptr->trainerHill.spokeToOwner = 0;
gSaveBlock1Ptr->trainerHill.field_3D6E_0b = 0; gSaveBlock1Ptr->trainerHill.checkedFinalTime = 0;
gSaveBlock1Ptr->trainerHill.maybeECardScanDuringChallenge = 0; gSaveBlock1Ptr->trainerHill.maybeECardScanDuringChallenge = 0;
gSaveBlock2Ptr->frontier.field_EE0 = 0; gSaveBlock2Ptr->frontier.trainerFlags = 0;
gBattleOutcome = 0; gBattleOutcome = 0;
gSaveBlock1Ptr->trainerHill.field_3D6E_0a = 0; gSaveBlock1Ptr->trainerHill.receivedPrize = 0;
} }
static void sub_81D58D8(void) static void GetOwnerState(void)
{ {
ClearTrainerHillVBlankCounter(); ClearTrainerHillVBlankCounter();
gSpecialVar_Result = 0; gSpecialVar_Result = 0;
if (gSaveBlock1Ptr->trainerHill.field_3D6E_0c) if (gSaveBlock1Ptr->trainerHill.spokeToOwner)
gSpecialVar_Result++; gSpecialVar_Result++;
if (gSaveBlock1Ptr->trainerHill.field_3D6E_0a && gSaveBlock1Ptr->trainerHill.field_3D6E_0b) if (gSaveBlock1Ptr->trainerHill.receivedPrize && gSaveBlock1Ptr->trainerHill.checkedFinalTime)
gSpecialVar_Result++; gSpecialVar_Result++;
gSaveBlock1Ptr->trainerHill.field_3D6E_0c = 1; gSaveBlock1Ptr->trainerHill.spokeToOwner = TRUE;
} }
static void sub_81D5924(void) static void GiveChallengePrize(void)
{ {
u16 itemId = sub_81D6640(); u16 itemId = GetPrizeItemId();
if (sHillData->tag.numFloors != 4 || gSaveBlock1Ptr->trainerHill.field_3D6E_0a) if (sHillData->tag.numFloors != NUM_TRAINER_HILL_FLOORS || gSaveBlock1Ptr->trainerHill.receivedPrize)
{ {
gSpecialVar_Result = 2; gSpecialVar_Result = 2;
} }
else if (AddBagItem(itemId, 1) == TRUE) else if (AddBagItem(itemId, 1) == TRUE)
{ {
CopyItemName(itemId, gStringVar2); CopyItemName(itemId, gStringVar2);
gSaveBlock1Ptr->trainerHill.field_3D6E_0a = 1; gSaveBlock1Ptr->trainerHill.receivedPrize = TRUE;
gSaveBlock2Ptr->frontier.field_EF9_0 = 0; gSaveBlock2Ptr->frontier.neverRead = 0;
gSpecialVar_Result = 0; gSpecialVar_Result = 0;
} }
else else
@@ -435,9 +447,12 @@ static void sub_81D5924(void)
} }
} }
static void sub_81D59D0(void) // Either the bestTime and Timer field names are incorrect or something weird is going on
// Because when gSpecialVar_Result == 0 after this call the player is complimented on their fast time
// And when gSpecialVar_Result == 1 theyre told that they werent very quick
static void CheckFinalTime(void)
{ {
if (gSaveBlock1Ptr->trainerHill.field_3D6E_0b) if (gSaveBlock1Ptr->trainerHill.checkedFinalTime)
{ {
gSpecialVar_Result = 2; gSpecialVar_Result = 2;
} }
@@ -452,12 +467,12 @@ static void sub_81D59D0(void)
gSpecialVar_Result = 1; gSpecialVar_Result = 1;
} }
gSaveBlock1Ptr->trainerHill.field_3D6E_0b = 1; gSaveBlock1Ptr->trainerHill.checkedFinalTime = TRUE;
} }
static void TrainerHillResumeTimer(void) static void TrainerHillResumeTimer(void)
{ {
if (!gSaveBlock1Ptr->trainerHill.field_3D6E_0c) if (!gSaveBlock1Ptr->trainerHill.spokeToOwner)
{ {
if (gSaveBlock1Ptr->trainerHill.timer >= HILL_MAX_TIME) if (gSaveBlock1Ptr->trainerHill.timer >= HILL_MAX_TIME)
gSaveBlock1Ptr->trainerHill.timer = HILL_MAX_TIME; gSaveBlock1Ptr->trainerHill.timer = HILL_MAX_TIME;
@@ -468,7 +483,7 @@ static void TrainerHillResumeTimer(void)
static void TrainerHillSetPlayerLost(void) static void TrainerHillSetPlayerLost(void)
{ {
gSaveBlock1Ptr->trainerHill.hasLost = 1; gSaveBlock1Ptr->trainerHill.hasLost = TRUE;
} }
static void TrainerHillGetChallengeStatus(void) static void TrainerHillGetChallengeStatus(void)
@@ -476,7 +491,7 @@ static void TrainerHillGetChallengeStatus(void)
if (gSaveBlock1Ptr->trainerHill.hasLost) if (gSaveBlock1Ptr->trainerHill.hasLost)
{ {
// The player lost their last match. // The player lost their last match.
gSaveBlock1Ptr->trainerHill.hasLost = 0; gSaveBlock1Ptr->trainerHill.hasLost = FALSE;
gSpecialVar_Result = TRAINER_HILL_PLAYER_STATUS_LOST; gSpecialVar_Result = TRAINER_HILL_PLAYER_STATUS_LOST;
} }
else if (gSaveBlock1Ptr->trainerHill.maybeECardScanDuringChallenge) else if (gSaveBlock1Ptr->trainerHill.maybeECardScanDuringChallenge)
@@ -492,7 +507,7 @@ static void TrainerHillGetChallengeStatus(void)
} }
} }
static void sub_81D5B2C(void) static void BufferChallengeTime(void)
{ {
s32 total, minutes, secondsWhole, secondsFraction; s32 total, minutes, secondsWhole, secondsFraction;
@@ -511,23 +526,26 @@ static void sub_81D5B2C(void)
ConvertIntToDecimalStringN(gStringVar3, secondsFraction, STR_CONV_MODE_LEADING_ZEROS, 2); ConvertIntToDecimalStringN(gStringVar3, secondsFraction, STR_CONV_MODE_LEADING_ZEROS, 2);
} }
static void sub_81D5BBC(void) // Returns TRUE if all 4 floors are used
// Returns FALSE otherwise, and buffers the number of floors used
static void GetAllFloorsUsed(void)
{ {
SetUpDataStruct(); SetUpDataStruct();
if (sHillData->tag.numFloors != 4) if (sHillData->tag.numFloors != NUM_TRAINER_HILL_FLOORS)
{ {
ConvertIntToDecimalStringN(gStringVar1, sHillData->tag.numFloors, STR_CONV_MODE_LEFT_ALIGN, 1); ConvertIntToDecimalStringN(gStringVar1, sHillData->tag.numFloors, STR_CONV_MODE_LEFT_ALIGN, 1);
gSpecialVar_Result = 0; gSpecialVar_Result = FALSE;
} }
else else
{ {
gSpecialVar_Result = 1; gSpecialVar_Result = TRUE;
} }
FreeDataStruct(); FreeDataStruct();
} }
static void sub_81D5C00(void) // May have been dummied. Every time this is called a conditional for var result occurs afterwards
static void ClearVarResult(void)
{ {
SetUpDataStruct(); SetUpDataStruct();
gSpecialVar_Result = 0; gSpecialVar_Result = 0;
@@ -538,7 +556,7 @@ bool8 InTrainerHillChallenge(void)
{ {
if (VarGet(VAR_TRAINER_HILL_IS_ACTIVE) == 0) if (VarGet(VAR_TRAINER_HILL_IS_ACTIVE) == 0)
return FALSE; return FALSE;
else if (gSaveBlock1Ptr->trainerHill.field_3D6E_0c) else if (gSaveBlock1Ptr->trainerHill.spokeToOwner)
return FALSE; return FALSE;
else if (GetCurrentTrainerHillMapId() != 0) else if (GetCurrentTrainerHillMapId() != 0)
return TRUE; return TRUE;
@@ -546,12 +564,12 @@ bool8 InTrainerHillChallenge(void)
return FALSE; return FALSE;
} }
static void GetInTrainerHill(void) static void IsTrainerHillChallengeActive(void)
{ {
if (!InTrainerHillChallenge()) if (!InTrainerHillChallenge())
gSpecialVar_Result = 0; gSpecialVar_Result = FALSE;
else else
gSpecialVar_Result = 1; gSpecialVar_Result = TRUE;
} }
void nullsub_129(void) void nullsub_129(void)
@@ -611,12 +629,12 @@ static void SetTimerValue(u32 *dst, u32 val)
*dst = val; *dst = val;
} }
void sub_81D5DF8(void) void LoadTrainerHillEventObjectTemplates(void)
{ {
u8 i, floorId; u8 i, floorId;
struct EventObjectTemplate *eventTemplates = gSaveBlock1Ptr->eventObjectTemplates; struct EventObjectTemplate *eventTemplates = gSaveBlock1Ptr->eventObjectTemplates;
if (!sub_81D5F48()) if (!LoadTrainerHillFloorEventObjectScripts())
return; return;
SetUpDataStruct(); SetUpDataStruct();
@@ -629,7 +647,7 @@ void sub_81D5DF8(void)
{ {
u8 bits; u8 bits;
eventTemplates[i] = gUnknown_0862A670; eventTemplates[i] = sTrainerEventObjectTemplate;
eventTemplates[i].localId = i + 1; eventTemplates[i].localId = i + 1;
eventTemplates[i].graphicsId = FacilityClassToGraphicsId(sHillData->floors[floorId].trainers[i].facilityClass); eventTemplates[i].graphicsId = FacilityClassToGraphicsId(sHillData->floors[floorId].trainers[i].facilityClass);
eventTemplates[i].x = sHillData->floors[floorId].display.coords[i] & 0xF; eventTemplates[i].x = sHillData->floors[floorId].display.coords[i] & 0xF;
@@ -637,16 +655,17 @@ void sub_81D5DF8(void)
bits = i << 2; bits = i << 2;
eventTemplates[i].movementType = ((sHillData->floors[floorId].display.direction >> bits) & 0xF) + MOVEMENT_TYPE_FACE_UP; eventTemplates[i].movementType = ((sHillData->floors[floorId].display.direction >> bits) & 0xF) + MOVEMENT_TYPE_FACE_UP;
eventTemplates[i].trainerRange_berryTreeId = (sHillData->floors[floorId].display.range >> bits) & 0xF; eventTemplates[i].trainerRange_berryTreeId = (sHillData->floors[floorId].display.range >> bits) & 0xF;
eventTemplates[i].script = EventScript_2C83F0; eventTemplates[i].script = TrainerHill_EventScript_TrainerBattle;
gSaveBlock2Ptr->frontier.trainerIds[i] = i + 1; gSaveBlock2Ptr->frontier.trainerIds[i] = i + 1;
} }
FreeDataStruct(); FreeDataStruct();
} }
bool32 sub_81D5F48(void) bool32 LoadTrainerHillFloorEventObjectScripts(void)
{ {
SetUpDataStruct(); SetUpDataStruct();
// Something may have been dummied here
FreeDataStruct(); FreeDataStruct();
return TRUE; return TRUE;
} }
@@ -657,8 +676,8 @@ static u32 sub_81D5F58(u8 floorId, u32 bit, u32 arg2, u32 arg3)
{ {
u32 var0, var1, var2, var3; u32 var0, var1, var2, var3;
var0 = (sHillData->floors[floorId].unk3A0[arg2] >> (15 - bit)) & 1; var0 = (sHillData->floors[floorId].display.unk3A0[arg2] >> (15 - bit)) & 1;
var1 = sHillData->floors[floorId].data[arg2 * arg3 + bit]; var1 = sHillData->floors[floorId].display.data[arg2 * arg3 + bit];
var3 = 0x200; var3 = 0x200;
var2 = 0x3000; var2 = 0x3000;
@@ -716,20 +735,20 @@ static u32 sub_81D5F58(u8 floorId, u32 bit, u32 arg2, u32 arg3)
} }
#endif // NONMATCHING #endif // NONMATCHING
void sub_81D5FB4(u16 *mapArg) void GenerateTrainerHillFloorLayout(u16 *mapArg)
{ {
s32 i, j; s32 i, j;
u16 *src, *dst; u16 *src, *dst;
u8 mapId = GetCurrentTrainerHillMapId(); u8 mapId = GetCurrentTrainerHillMapId();
if (mapId == 6) if (mapId == TRAINER_HILL_ENTRANCE)
{ {
InitMapFromSavedGame(); InitMapFromSavedGame();
return; return;
} }
SetUpDataStruct(); SetUpDataStruct();
if (mapId == 5) if (mapId == TRAINER_HILL_ROOF)
{ {
InitMapFromSavedGame(); InitMapFromSavedGame();
FreeDataStruct(); FreeDataStruct();
@@ -766,9 +785,9 @@ bool32 InTrainerHill(void)
bool32 ret; bool32 ret;
if (gMapHeader.mapLayoutId == LAYOUT_TRAINER_HILL_1F if (gMapHeader.mapLayoutId == LAYOUT_TRAINER_HILL_1F
|| gMapHeader.mapLayoutId == LAYOUT_TRAINER_HILL_2F || gMapHeader.mapLayoutId == LAYOUT_TRAINER_HILL_2F
|| gMapHeader.mapLayoutId == LAYOUT_TRAINER_HILL_3F || gMapHeader.mapLayoutId == LAYOUT_TRAINER_HILL_3F
|| gMapHeader.mapLayoutId == LAYOUT_TRAINER_HILL_4F) || gMapHeader.mapLayoutId == LAYOUT_TRAINER_HILL_4F)
ret = TRUE; ret = TRUE;
else else
ret = FALSE; ret = FALSE;
@@ -778,58 +797,61 @@ bool32 InTrainerHill(void)
u8 GetCurrentTrainerHillMapId(void) u8 GetCurrentTrainerHillMapId(void)
{ {
u8 ret; u8 mapId;
if (gMapHeader.mapLayoutId == LAYOUT_TRAINER_HILL_1F) if (gMapHeader.mapLayoutId == LAYOUT_TRAINER_HILL_1F)
ret = 1; mapId = TRAINER_HILL_1F;
else if (gMapHeader.mapLayoutId == LAYOUT_TRAINER_HILL_2F) else if (gMapHeader.mapLayoutId == LAYOUT_TRAINER_HILL_2F)
ret = 2; mapId = TRAINER_HILL_2F;
else if (gMapHeader.mapLayoutId == LAYOUT_TRAINER_HILL_3F) else if (gMapHeader.mapLayoutId == LAYOUT_TRAINER_HILL_3F)
ret = 3; mapId = TRAINER_HILL_3F;
else if (gMapHeader.mapLayoutId == LAYOUT_TRAINER_HILL_4F) else if (gMapHeader.mapLayoutId == LAYOUT_TRAINER_HILL_4F)
ret = 4; mapId = TRAINER_HILL_4F;
else if (gMapHeader.mapLayoutId == LAYOUT_TRAINER_HILL_ROOF) else if (gMapHeader.mapLayoutId == LAYOUT_TRAINER_HILL_ROOF)
ret = 5; mapId = TRAINER_HILL_ROOF;
else if (gMapHeader.mapLayoutId == LAYOUT_TRAINER_HILL_ENTRANCE) else if (gMapHeader.mapLayoutId == LAYOUT_TRAINER_HILL_ENTRANCE)
ret = 6; mapId = TRAINER_HILL_ENTRANCE;
else else
ret = 0; mapId = 0;
return ret; return mapId;
} }
static bool32 sub_81D6100(void) // Unused
static bool32 OnTrainerHillRoof(void)
{ {
bool32 ret; bool32 onRoof;
if (gMapHeader.mapLayoutId == LAYOUT_TRAINER_HILL_ROOF) if (gMapHeader.mapLayoutId == LAYOUT_TRAINER_HILL_ROOF)
ret = TRUE; onRoof = TRUE;
else else
ret = FALSE; onRoof = FALSE;
return ret; return onRoof;
} }
const struct WarpEvent* sub_81D6120(void) const struct WarpEvent* SetWarpDestinationTrainerHill4F(void)
{ {
const struct MapHeader *header = Overworld_GetMapHeaderByGroupAndId(MAP_GROUP(TRAINER_HILL_4F), MAP_NUM(TRAINER_HILL_4F)); const struct MapHeader *header = Overworld_GetMapHeaderByGroupAndId(MAP_GROUP(TRAINER_HILL_4F), MAP_NUM(TRAINER_HILL_4F));
return &header->events->warps[1]; return &header->events->warps[1];
} }
const struct WarpEvent* sub_81D6134(u8 warpEventId) // For warping from the roof in challenges where the 4F is not the final challenge floor
// This would only occur in an E-Reader challenge, which is exclusive to JP Emerald
const struct WarpEvent* SetWarpDestinationTrainerHillFinalFloor(u8 warpEventId)
{ {
u8 id; u8 numFloors;
const struct MapHeader *header; const struct MapHeader *header;
if (warpEventId == 1) if (warpEventId == 1)
return &gMapHeader.events->warps[1]; return &gMapHeader.events->warps[1];
id = sub_81D6490(); numFloors = GetNumFloorsInTrainerHillChallenge();
if (id == 0 || id >= 5) if (numFloors == 0 || numFloors > NUM_TRAINER_HILL_FLOORS)
id = 4; numFloors = NUM_TRAINER_HILL_FLOORS;
header = Overworld_GetMapHeaderByGroupAndId(MAP_GROUP(TRAINER_HILL_4F), gUnknown_0862A688[id - 1]); header = Overworld_GetMapHeaderByGroupAndId(MAP_GROUP(TRAINER_HILL_4F), sNextFloorMapNum[numFloors - 1]);
return &header->events->warps[0]; return &header->events->warps[0];
} }
@@ -843,7 +865,7 @@ bool8 GetHillTrainerFlag(u8 eventObjectId)
u32 floorId = GetFloorId() * 2; u32 floorId = GetFloorId() * 2;
u8 bitId = gEventObjects[eventObjectId].localId - 1 + floorId; u8 bitId = gEventObjects[eventObjectId].localId - 1 + floorId;
return gSaveBlock2Ptr->frontier.field_EE0 & gBitTable[bitId]; return gSaveBlock2Ptr->frontier.trainerFlags & gBitTable[bitId];
} }
void SetHillTrainerFlag(void) void SetHillTrainerFlag(void)
@@ -855,7 +877,7 @@ void SetHillTrainerFlag(void)
{ {
if (gSaveBlock2Ptr->frontier.trainerIds[i] == gTrainerBattleOpponent_A) if (gSaveBlock2Ptr->frontier.trainerIds[i] == gTrainerBattleOpponent_A)
{ {
gSaveBlock2Ptr->frontier.field_EE0 |= gBitTable[floorId + i]; gSaveBlock2Ptr->frontier.trainerFlags |= gBitTable[floorId + i];
break; break;
} }
} }
@@ -866,7 +888,7 @@ void SetHillTrainerFlag(void)
{ {
if (gSaveBlock2Ptr->frontier.trainerIds[i] == gTrainerBattleOpponent_B) if (gSaveBlock2Ptr->frontier.trainerIds[i] == gTrainerBattleOpponent_B)
{ {
gSaveBlock2Ptr->frontier.field_EE0 |= gBitTable[floorId + i]; gSaveBlock2Ptr->frontier.trainerFlags |= gBitTable[floorId + i];
break; break;
} }
} }
@@ -875,19 +897,19 @@ void SetHillTrainerFlag(void)
const u8 *GetTrainerHillTrainerScript(void) const u8 *GetTrainerHillTrainerScript(void)
{ {
return EventScript_2C83F0; return TrainerHill_EventScript_TrainerBattle;
} }
static void sub_81D62B4(void) static void ShowTrainerHillPostBattleText(void)
{ {
CopyTrainerHillTrainerText(5, gSpecialVar_LastTalked); CopyTrainerHillTrainerText(TRAINER_HILL_TEXT_AFTER, gSpecialVar_LastTalked);
sub_80982B8(); sub_80982B8();
} }
static void sub_81D62CC(u16 trainerId, u8 firstMonId) static void CreateNPCTrainerHillParty(u16 trainerId, u8 firstMonId)
{ {
u8 trId, level; u8 trId, level;
s32 i, floorId, arrId; s32 i, floorId, partySlot;
if (trainerId == 0 || trainerId > 2) if (trainerId == 0 || trainerId > 2)
return; return;
@@ -896,13 +918,13 @@ static void sub_81D62CC(u16 trainerId, u8 firstMonId)
SetUpDataStruct(); SetUpDataStruct();
level = GetHighestLevelInPlayerParty(); level = GetHighestLevelInPlayerParty();
floorId = GetFloorId(); floorId = GetFloorId();
for (i = firstMonId, arrId = 0; i < firstMonId + 3; i++, arrId++) for (i = firstMonId, partySlot = 0; i < firstMonId + 3; i++, partySlot++)
{ {
u8 id = gUnknown_0862A698[trId][arrId]; u8 id = sTrainerPartySlots[trId][partySlot];
struct Pokemon *mon = &gEnemyParty[i]; struct Pokemon *mon = &gEnemyParty[i];
CreateBattleTowerMon(mon, &sHillData->floors[floorId].trainers[trId].mons[id]); CreateBattleTowerMon(mon, &sHillData->floors[floorId].trainers[trId].mons[id]);
sub_81D642C(mon, level); SetTrainerHillMonLevel(mon, level);
} }
FreeDataStruct(); FreeDataStruct();
@@ -911,22 +933,22 @@ static void sub_81D62CC(u16 trainerId, u8 firstMonId)
void FillHillTrainerParty(void) void FillHillTrainerParty(void)
{ {
ZeroEnemyPartyMons(); ZeroEnemyPartyMons();
sub_81D62CC(gTrainerBattleOpponent_A, 0); CreateNPCTrainerHillParty(gTrainerBattleOpponent_A, 0);
} }
void FillHillTrainersParties(void) void FillHillTrainersParties(void)
{ {
ZeroEnemyPartyMons(); ZeroEnemyPartyMons();
sub_81D62CC(gTrainerBattleOpponent_A, 0); CreateNPCTrainerHillParty(gTrainerBattleOpponent_A, 0);
sub_81D62CC(gTrainerBattleOpponent_B, 3); CreateNPCTrainerHillParty(gTrainerBattleOpponent_B, 3);
} }
// This function is unused, but my best guess is // This function is unused, but my best guess is
// it was supposed to return AI scripts for trainer // it was supposed to return AI scripts for trainer
// hill trainers. // hill trainers.
u32 sub_81D63C4(void) u32 GetTrainerHillAIFlags(void)
{ {
return 7; return (AI_SCRIPT_CHECK_BAD_MOVE | AI_SCRIPT_TRY_TO_FAINT | AI_SCRIPT_CHECK_VIABILITY);
} }
u8 GetTrainerEncounterMusicIdInTrainerHill(u16 trainerId) u8 GetTrainerEncounterMusicIdInTrainerHill(u16 trainerId)
@@ -939,16 +961,16 @@ u8 GetTrainerEncounterMusicIdInTrainerHill(u16 trainerId)
facilityClass = sHillData->floors[sHillData->floorId].trainers[trId].facilityClass; facilityClass = sHillData->floors[sHillData->floorId].trainers[trId].facilityClass;
FreeDataStruct(); FreeDataStruct();
for (i = 0; i < ARRAY_COUNT(gUnknown_0862A3B4); i++) for (i = 0; i < ARRAY_COUNT(sTrainerClassesAndMusic); i++)
{ {
if (gUnknown_0862A3B4[i].trainerClass == gFacilityClassToTrainerClass[facilityClass]) if (sTrainerClassesAndMusic[i].trainerClass == gFacilityClassToTrainerClass[facilityClass])
return gUnknown_0862A3B4[i].musicId; return sTrainerClassesAndMusic[i].musicId;
} }
return 0; return 0;
} }
static void sub_81D642C(struct Pokemon *mon, u8 level) static void SetTrainerHillMonLevel(struct Pokemon *mon, u8 level)
{ {
u16 species = GetMonData(mon, MON_DATA_SPECIES, NULL); u16 species = GetMonData(mon, MON_DATA_SPECIES, NULL);
u32 exp = gExperienceTables[gBaseStats[species].growthRate][level]; u32 exp = gExperienceTables[gBaseStats[species].growthRate][level];
@@ -958,61 +980,63 @@ static void sub_81D642C(struct Pokemon *mon, u8 level)
CalculateMonStats(mon); CalculateMonStats(mon);
} }
u8 sub_81D6490(void) u8 GetNumFloorsInTrainerHillChallenge(void)
{ {
u8 ret; u8 floors;
SetUpDataStruct(); SetUpDataStruct();
ret = sHillData->tag.numFloors; floors = sHillData->tag.numFloors;
FreeDataStruct(); FreeDataStruct();
return ret; return floors;
} }
static void sub_81D64AC(void) static void SetAllTrainerFlags(void)
{ {
gSaveBlock2Ptr->frontier.field_EE0 = 0xFF; gSaveBlock2Ptr->frontier.trainerFlags = 0xFF;
} }
// Palette never loaded, sub_81D6534 always FALSE
void sub_81D64C0(void) void sub_81D64C0(void)
{ {
if (sub_81D6534() == TRUE) if (sub_81D6534() == TRUE)
LoadPalette(gUnknown_0862A5D4, 0x70, 0x20); LoadPalette(sUnknown_0862A5D4, 0x70, 0x20);
} }
static void sub_81D64DC(void) static void GetGameSaved(void)
{ {
gSpecialVar_Result = gSaveBlock2Ptr->frontier.field_EF9_1; gSpecialVar_Result = gSaveBlock2Ptr->frontier.savedGame;
} }
static void sub_81D64FC(void) static void SetGameSaved(void)
{ {
gSaveBlock2Ptr->frontier.field_EF9_1 = 1; gSaveBlock2Ptr->frontier.savedGame = TRUE;
} }
static void sub_81D6518(void) static void ClearGameSaved(void)
{ {
gSaveBlock2Ptr->frontier.field_EF9_1 = 0; gSaveBlock2Ptr->frontier.savedGame = FALSE;
} }
// Always FALSE
bool32 sub_81D6534(void) bool32 sub_81D6534(void)
{ {
if (!InTrainerHillChallenge() || GetCurrentTrainerHillMapId() == 6) if (!InTrainerHillChallenge() || GetCurrentTrainerHillMapId() == TRAINER_HILL_ENTRANCE)
return FALSE; return FALSE;
sub_81D5C00(); ClearVarResult();
if (gSpecialVar_Result == 0) if (gSpecialVar_Result == 0)
return FALSE; return FALSE;
else else
return TRUE; return TRUE;
} }
static void sub_81D6568(void) static void GetChallengeWon(void)
{ {
if (gSaveBlock1Ptr->trainerHill.hasLost) if (gSaveBlock1Ptr->trainerHill.hasLost)
gSpecialVar_Result = 0; gSpecialVar_Result = FALSE;
else else
gSpecialVar_Result = 1; gSpecialVar_Result = TRUE;
} }
static void TrainerHillSetTag(void) static void TrainerHillSetTag(void)
@@ -1021,49 +1045,50 @@ static void TrainerHillSetTag(void)
gSaveBlock1Ptr->trainerHill.bestTime = gSaveBlock1Ptr->trainerHillTimes[gSpecialVar_0x8005]; gSaveBlock1Ptr->trainerHill.bestTime = gSaveBlock1Ptr->trainerHillTimes[gSpecialVar_0x8005];
} }
static u8 sub_81D65E8(u8 arg0) static u8 GetPrizeListId(bool8 npcChallenge)
{ {
u8 var, i, modBy; u8 prizeListId, i, modBy;
var = 0; prizeListId = 0;
for (i = 0; i < 4; i++) for (i = 0; i < NUM_TRAINER_HILL_FLOORS; i++)
{ {
var ^= sHillData->floors[i].unk0 & 0x1F; prizeListId ^= sHillData->floors[i].trainerNum1 & 0x1F;
var ^= sHillData->floors[i].unk1 & 0x1F; prizeListId ^= sHillData->floors[i].trainerNum2 & 0x1F;
} }
if (arg0) // Not possible to win TMs from E-Reader challenges
modBy = 10; if (npcChallenge)
modBy = NUM_TRAINER_HILL_PRIZE_LISTS;
else else
modBy = 5; modBy = NUM_TRAINER_HILL_PRIZE_LISTS / 2;
var %= modBy; prizeListId %= modBy;
return var; return prizeListId;
} }
static u16 sub_81D6640(void) static u16 GetPrizeItemId(void)
{ {
u8 i; u8 i;
const u16 *ptr; const u16 *prizeList;
s32 var = 0, var2, minutes, id; s32 var = 0, prizeListSetId, minutes, id;
for (i = 0; i < 4; i++) for (i = 0; i < NUM_TRAINER_HILL_FLOORS; i++)
{ {
var += sHillData->floors[i].unk0; var += sHillData->floors[i].trainerNum1;
var += sHillData->floors[i].unk1; var += sHillData->floors[i].trainerNum2;
} }
var2 = var / 256; prizeListSetId = var / 256;
var2 %= 2; prizeListSetId %= 2;
if (FlagGet(FLAG_SYS_GAME_CLEAR) && sHillData->tag.unkField_0 == 8) if (FlagGet(FLAG_SYS_GAME_CLEAR) && sHillData->tag.trainerType == HILL_TRAINER_TYPE_NPC)
i = sub_81D65E8(1); i = GetPrizeListId(TRUE);
else else
i = sub_81D65E8(0); i = GetPrizeListId(FALSE);
if (gSaveBlock1Ptr->trainerHill.tag == HILL_TAG_EXPERT) if (gSaveBlock1Ptr->trainerHill.tag == HILL_TAG_EXPERT)
i = (i + 1) % 10; i = (i + 1) % NUM_TRAINER_HILL_PRIZE_LISTS;
ptr = gUnknown_0862A5CC[var2][i]; prizeList = sPrizeListSets[prizeListSetId][i];
minutes = (signed)(gSaveBlock1Ptr->trainerHill.timer) / (60 * 60); minutes = (signed)(gSaveBlock1Ptr->trainerHill.timer) / (60 * 60);
if (minutes < 12) if (minutes < 12)
id = 0; id = 0;
@@ -1078,5 +1103,5 @@ static u16 sub_81D6640(void)
else else
id = 5; id = 5;
return ptr[id]; return prizeList[id];
} }