summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGriffinR <griffin.g.richards@gmail.com>2020-02-16 12:09:13 -0500
committerGitHub <noreply@github.com>2020-02-16 12:09:13 -0500
commit6bee17b4cecf000724d46bcc0116498a82acaae4 (patch)
tree6faf5928270f409cc866f82d2d195f36debd45dc
parent01de877fc86e8fe369314b7bda490b610342af6f (diff)
parent3b40ec23c7200a72b49c0cf0ede06e886a702aec (diff)
Merge branch 'master' into doc-tilesets
-rw-r--r--data/event_scripts.s68
-rw-r--r--data/maps/IndigoPlateau_Exterior/scripts.inc79
-rw-r--r--data/maps/IndigoPlateau_PokemonCenter_1F/map.json16
-rw-r--r--data/maps/IndigoPlateau_PokemonCenter_1F/scripts.inc32
-rw-r--r--data/maps/IndigoPlateau_PokemonCenter_1F/text.inc10
-rw-r--r--data/maps/PokemonLeague_AgathasRoom/map.json2
-rw-r--r--data/maps/PokemonLeague_AgathasRoom/scripts.inc66
-rw-r--r--data/maps/PokemonLeague_AgathasRoom/text.inc8
-rw-r--r--data/maps/PokemonLeague_BrunosRoom/map.json2
-rw-r--r--data/maps/PokemonLeague_BrunosRoom/scripts.inc88
-rw-r--r--data/maps/PokemonLeague_BrunosRoom/text.inc8
-rw-r--r--data/maps/PokemonLeague_ChampionsRoom/scripts.inc143
-rw-r--r--data/maps/PokemonLeague_ChampionsRoom/text.inc18
-rw-r--r--data/maps/PokemonLeague_HallOfFame/scripts.inc14
-rw-r--r--data/maps/PokemonLeague_HallOfFame/text.inc2
-rw-r--r--data/maps/PokemonLeague_LancesRoom/map.json2
-rw-r--r--data/maps/PokemonLeague_LancesRoom/scripts.inc100
-rw-r--r--data/maps/PokemonLeague_LancesRoom/text.inc8
-rw-r--r--data/maps/PokemonLeague_LoreleisRoom/map.json2
-rw-r--r--data/maps/PokemonLeague_LoreleisRoom/scripts.inc66
-rw-r--r--data/maps/PokemonLeague_LoreleisRoom/text.inc8
-rw-r--r--data/scripts/fame_checker.inc12
-rw-r--r--data/scripts/pokemon_league.inc64
-rw-r--r--data/text/fame_checker.inc2
-rw-r--r--include/constants/metatile_labels.h11
-rw-r--r--include/librfu.h10
-rw-r--r--src/librfu_rfu.c66
27 files changed, 474 insertions, 433 deletions
diff --git a/data/event_scripts.s b/data/event_scripts.s
index 6b9b97472..16c7fd86d 100644
--- a/data/event_scripts.s
+++ b/data/event_scripts.s
@@ -969,7 +969,7 @@ Text_HavePokedexRated:: @ 81A5C03
Text_ClosedLinkToProfOaksPC:: @ 81A5C2E
.string "Closed link to PROF. OAK's PC.$"
-Text_1A5C4D:: @ 81A5C4D
+Text_VoiceRangOutDontRunAway:: @ 81A5C4D
.string "Someone's voice rang out,\n"
.string "“Don't run away!”$"
@@ -1260,71 +1260,7 @@ EventScript_1A74F2:: @ 81A74F2
removeitem VAR_0x8004, 1
return
-EventScript_1A7506:: @ 81A7506
- applymovement OBJ_EVENT_ID_PLAYER, Movement_Delay32
- waitmovement 0
- playse SE_DOOR
- call EventScript_1A7538
- special DrawWholeMapView
- setflag FLAG_TEMP_4
- return
-
-EventScript_1A751F:: @ 81A751F
- applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkUp5
- waitmovement 0
- setflag FLAG_TEMP_2
- playse SE_KI_GASYAN
- call EventScript_1A759C
- special DrawWholeMapView
- return
-
-EventScript_1A7538:: @ 81A7538
- setmetatile 6, 1, 654, 1
- setmetatile 6, 2, 662, 0
- return
-
-EventScript_1A754B:: @ 81A754B
- lockall
- textcolor 0
- msgbox Text_1A5C4D
- closemessage
- applymovement OBJ_EVENT_ID_PLAYER, Movement_1A75D3
- waitmovement 0
- releaseall
- end
-
-EventScript_1A7563:: @ 81A7563
- applymovement OBJ_EVENT_ID_PLAYER, Movement_Delay32
- waitmovement 0
- playse SE_DOOR
- setmetatile 6, 4, 654, 1
- setmetatile 6, 5, 662, 0
- special DrawWholeMapView
- setflag FLAG_TEMP_4
- return
-
-EventScript_1A7589:: @ 81A7589
- setmetatile 6, 4, 654, 1
- setmetatile 6, 5, 662, 0
- return
-
-EventScript_1A759C:: @ 81A759C
- setmetatile 5, 11, 669, 1
- setmetatile 6, 11, 670, 1
- setmetatile 7, 11, 671, 1
- setmetatile 5, 12, 677, 1
- setmetatile 6, 12, 678, 1
- setmetatile 7, 12, 679, 1
- return
-
-Movement_1A75D3:: @ 81A75D3
- walk_up
- step_end
-
-EventScript_1A75D5:: @ 81A75D5
- special Special_PokemonLeagueLightingEffect
- return
-
+ .include "data/scripts/pokemon_league.inc"
.include "data/scripts/movement.inc"
.include "data/scripts/flavor_text.inc"
diff --git a/data/maps/IndigoPlateau_Exterior/scripts.inc b/data/maps/IndigoPlateau_Exterior/scripts.inc
index bc9827037..70831a754 100644
--- a/data/maps/IndigoPlateau_Exterior/scripts.inc
+++ b/data/maps/IndigoPlateau_Exterior/scripts.inc
@@ -1,3 +1,6 @@
+.equ LOCALID_RIVAL, 1
+.equ LOCALID_PROF_OAK, 2
+
IndigoPlateau_Exterior_MapScripts:: @ 816723B
map_script MAP_SCRIPT_ON_TRANSITION, IndigoPlateau_Exterior_OnTransition
map_script MAP_SCRIPT_ON_FRAME_TABLE, IndigoPlateau_Exterior_OnFrame
@@ -6,22 +9,23 @@ IndigoPlateau_Exterior_MapScripts:: @ 816723B
IndigoPlateau_Exterior_OnTransition:: @ 8167246
setworldmapflag FLAG_WORLD_MAP_INDIGO_PLATEAU_EXTERIOR
compare VAR_MAP_SCENE_INDIGO_PLATEAU_EXTERIOR, 1
- call_if_eq EventScript_IndigoPlateau_Exterior_PlayCreditsMusic
+ call_if_eq IndigoPlateau_Exterior_EventScript_PlayCreditsMusic
end
-EventScript_IndigoPlateau_Exterior_PlayCreditsMusic:: @ 8167255
+IndigoPlateau_Exterior_EventScript_PlayCreditsMusic:: @ 8167255
playbgm MUS_ENDING, 0
return
IndigoPlateau_Exterior_OnFrame:: @ 816725A
- map_script_2 VAR_MAP_SCENE_INDIGO_PLATEAU_EXTERIOR, 1, EventScript_IndigoPlateau_Exterior_Credits
+ map_script_2 VAR_MAP_SCENE_INDIGO_PLATEAU_EXTERIOR, 1, IndigoPlateau_Exterior_EventScript_Credits
.2byte 0
-EventScript_IndigoPlateau_Exterior_Credits:: @ 8167264
- @ After beating the champion, you are warped to the main
- @ entrance of Indigo Plateau. This script starts running
- @ immediately after your walking animation.
- @ The script is timed to the music.
+
+@ After beating the champion, you are warped to the main
+@ entrance of Indigo Plateau. This script starts running
+@ immediately after your walking animation.
+@ The script is timed to the music.
+IndigoPlateau_Exterior_EventScript_Credits:: @ 8167264
lockall
delay 105
@@ -29,60 +33,60 @@ EventScript_IndigoPlateau_Exterior_Credits:: @ 8167264
opendoor 11, 6
waitdooranim
special SpawnCameraObject
- addobject 1
- applymovement 1, Movement_167346
- applymovement OBJ_EVENT_ID_PLAYER, Movement_167337
+ addobject LOCALID_RIVAL
+ applymovement LOCALID_RIVAL, IndigoPlateau_Exterior_Movement_RivalExitBuilding
+ applymovement OBJ_EVENT_ID_PLAYER, IndigoPlateau_Exterior_Movement_PushPlayerOutOfWay
waitmovement 0
closedoor 11, 6
waitdooranim
@ Rival runs off
- applymovement OBJ_EVENT_ID_PLAYER, Movement_16731B
- applymovement 1, Movement_16733E
+ applymovement OBJ_EVENT_ID_PLAYER, IndigoPlateau_Exterior_Movement_PlayerWatchRivalLeave
+ applymovement LOCALID_RIVAL, IndigoPlateau_Exterior_Movement_RivalLeave
waitmovement 0
delay 100
@ Oak exits building
opendoor 11, 6
waitdooranim
- addobject 2
- applymovement 2, Movement_16735D
+ addobject LOCALID_PROF_OAK
+ applymovement LOCALID_PROF_OAK, IndigoPlateau_Exterior_Movement_OakExitBuilding
waitmovement 0
closedoor 11, 6
waitdooranim
delay 160
@ Oak looks at player, then walks off
- applymovement OBJ_EVENT_ID_PLAYER, Movement_16731F
- applymovement 2, Movement_167348
+ applymovement OBJ_EVENT_ID_PLAYER, IndigoPlateau_Exterior_Movement_PlayerWatchOakLeave
+ applymovement LOCALID_PROF_OAK, IndigoPlateau_Exterior_Movement_OakLeave
waitmovement 0
delay 100
- applymovement OBJ_EVENT_ID_PLAYER, Movement_16732E
+
+ @ Player begin to leave
+ applymovement OBJ_EVENT_ID_PLAYER, IndigoPlateau_Exterior_Movement_PlayerBeginLeave
waitmovement 0
delay 155
-
- @ Player turns to face the League
- applymovement OBJ_EVENT_ID_PLAYER, Movement_16733C
+ applymovement OBJ_EVENT_ID_PLAYER, IndigoPlateau_Exterior_Movement_PlayerFaceLeague
waitmovement 0
delay 90
@ Player runs off
- applymovement OBJ_EVENT_ID_PLAYER, Movement_167335
+ applymovement OBJ_EVENT_ID_PLAYER, IndigoPlateau_Exterior_Movement_PlayerTurnAround
waitmovement 0
- applymovement OBJ_EVENT_ID_PLAYER, Movement_167311
+ applymovement OBJ_EVENT_ID_PLAYER, IndigoPlateau_Exterior_Movement_PlayerLeave
waitmovement 0
@ Reset the map state and roll the credits
special RemoveCameraObject
setvar VAR_MAP_SCENE_INDIGO_PLATEAU_EXTERIOR, 0
- removeobject 1
- removeobject 2
+ removeobject LOCALID_RIVAL
+ removeobject LOCALID_PROF_OAK
special Special_Credits @ noreturn
waitstate
releaseall
end
-Movement_167311:: @ 8167311
+IndigoPlateau_Exterior_Movement_PlayerLeave:: @ 8167311
player_run_down
player_run_down
player_run_down
@@ -91,18 +95,19 @@ Movement_167311:: @ 8167311
player_run_down
step_end
-Movement_167318:: @ 8167318
+@ Unused
+IndigoPlateau_Exterior_Movement_PlayerExitBuilding:: @ 8167318
walk_down
walk_down
step_end
-Movement_16731B:: @ 816731B
+IndigoPlateau_Exterior_Movement_PlayerWatchRivalLeave:: @ 816731B
delay_16
delay_4
walk_in_place_fastest_down
step_end
-Movement_16731F:: @ 816731F
+IndigoPlateau_Exterior_Movement_PlayerWatchOakLeave:: @ 816731F
delay_8
walk_in_place_fastest_right
delay_16
@@ -119,7 +124,7 @@ Movement_16731F:: @ 816731F
walk_in_place_fastest_down
step_end
-Movement_16732E:: @ 816732E
+IndigoPlateau_Exterior_Movement_PlayerBeginLeave:: @ 816732E
walk_right
delay_16
walk_down
@@ -128,22 +133,22 @@ Movement_16732E:: @ 816732E
delay_16
step_end
-Movement_167335:: @ 8167335
+IndigoPlateau_Exterior_Movement_PlayerTurnAround:: @ 8167335
walk_in_place_fastest_down
step_end
-Movement_167337:: @ 8167337
+IndigoPlateau_Exterior_Movement_PushPlayerOutOfWay:: @ 8167337
face_right
lock_facing_direction
walk_left
unlock_facing_direction
step_end
-Movement_16733C:: @ 816733C
+IndigoPlateau_Exterior_Movement_PlayerFaceLeague:: @ 816733C
walk_in_place_fastest_up
step_end
-Movement_16733E:: @ 816733E
+IndigoPlateau_Exterior_Movement_RivalLeave:: @ 816733E
walk_fast_down
walk_fast_down
walk_fast_down
@@ -153,11 +158,11 @@ Movement_16733E:: @ 816733E
walk_fast_down
step_end
-Movement_167346:: @ 8167346
+IndigoPlateau_Exterior_Movement_RivalExitBuilding:: @ 8167346
walk_fast_down
step_end
-Movement_167348:: @ 8167348
+IndigoPlateau_Exterior_Movement_OakLeave:: @ 8167348
walk_in_place_fastest_left
delay_16
delay_16
@@ -180,6 +185,6 @@ Movement_167348:: @ 8167348
walk_down
step_end
-Movement_16735D:: @ 816735D
+IndigoPlateau_Exterior_Movement_OakExitBuilding:: @ 816735D
walk_down
step_end
diff --git a/data/maps/IndigoPlateau_PokemonCenter_1F/map.json b/data/maps/IndigoPlateau_PokemonCenter_1F/map.json
index f214403c3..e862a372e 100644
--- a/data/maps/IndigoPlateau_PokemonCenter_1F/map.json
+++ b/data/maps/IndigoPlateau_PokemonCenter_1F/map.json
@@ -23,7 +23,7 @@
"movement_range_y": 1,
"trainer_type": 0,
"trainer_sight_or_berry_tree_id": 0,
- "script": "IndigoPlateau_PokemonCenter_1F_EventScript_16EACC",
+ "script": "IndigoPlateau_PokemonCenter_1F_EventScript_Clerk",
"flag": "0"
},
{
@@ -36,7 +36,7 @@
"movement_range_y": 1,
"trainer_type": 0,
"trainer_sight_or_berry_tree_id": 0,
- "script": "IndigoPlateau_PokemonCenter_1F_EventScript_16EB06",
+ "script": "IndigoPlateau_PokemonCenter_1F_EventScript_Nurse",
"flag": "0"
},
{
@@ -49,7 +49,7 @@
"movement_range_y": 1,
"trainer_type": 0,
"trainer_sight_or_berry_tree_id": 0,
- "script": "IndigoPlateau_PokemonCenter_1F_EventScript_16EAC3",
+ "script": "IndigoPlateau_PokemonCenter_1F_EventScript_GymGuy",
"flag": "0"
},
{
@@ -62,7 +62,7 @@
"movement_range_y": 1,
"trainer_type": 0,
"trainer_sight_or_berry_tree_id": 0,
- "script": "IndigoPlateau_PokemonCenter_1F_EventScript_16EA8A",
+ "script": "IndigoPlateau_PokemonCenter_1F_EventScript_DoorGuard",
"flag": "0"
},
{
@@ -75,7 +75,7 @@
"movement_range_y": 1,
"trainer_type": 0,
"trainer_sight_or_berry_tree_id": 0,
- "script": "IndigoPlateau_PokemonCenter_1F_EventScript_1ACFAE",
+ "script": "IndigoPlateau_PokemonCenter_1F_EventScript_BlackBelt",
"flag": "FLAG_HIDE_POSTGAME_GOSSIPERS"
},
{
@@ -88,7 +88,7 @@
"movement_range_y": 1,
"trainer_type": 0,
"trainer_sight_or_berry_tree_id": 0,
- "script": "IndigoPlateau_PokemonCenter_1F_EventScript_1AD06C",
+ "script": "IndigoPlateau_PokemonCenter_1F_EventScript_PokemonJournal",
"flag": "FLAG_HIDE_POSTGAME_GOSSIPERS"
},
{
@@ -101,7 +101,7 @@
"movement_range_y": 1,
"trainer_type": 0,
"trainer_sight_or_berry_tree_id": 0,
- "script": "IndigoPlateau_PokemonCenter_1F_EventScript_1AD087",
+ "script": "IndigoPlateau_PokemonCenter_1F_EventScript_CooltrainerM",
"flag": "FLAG_HIDE_POSTGAME_GOSSIPERS"
},
{
@@ -114,7 +114,7 @@
"movement_range_y": 1,
"trainer_type": 0,
"trainer_sight_or_berry_tree_id": 0,
- "script": "IndigoPlateau_PokemonCenter_1F_EventScript_1AD06C",
+ "script": "IndigoPlateau_PokemonCenter_1F_EventScript_PokemonJournal",
"flag": "FLAG_HIDE_POSTGAME_GOSSIPERS"
}
],
diff --git a/data/maps/IndigoPlateau_PokemonCenter_1F/scripts.inc b/data/maps/IndigoPlateau_PokemonCenter_1F/scripts.inc
index 67a3e4f6a..e0523d2ee 100644
--- a/data/maps/IndigoPlateau_PokemonCenter_1F/scripts.inc
+++ b/data/maps/IndigoPlateau_PokemonCenter_1F/scripts.inc
@@ -7,52 +7,52 @@ IndigoPlateau_PokemonCenter_1F_OnTransition:: @ 816EA65
setrespawn SPAWN_INDIGO_PLATEAU
specialvar VAR_RESULT, IsNationalPokedexEnabled
compare VAR_RESULT, TRUE
- call_if_eq EventScript_16EA79
+ call_if_eq IndigoPlateau_PokemonCenter_1F_EventScript_CheckBlockDoor
end
-EventScript_16EA79:: @ 816EA79
+IndigoPlateau_PokemonCenter_1F_EventScript_CheckBlockDoor:: @ 816EA79
goto_if_set FLAG_SYS_CAN_LINK_WITH_RS, EventScript_Return
setobjectxyperm 4, 4, 2
return
-IndigoPlateau_PokemonCenter_1F_EventScript_16EA8A:: @ 816EA8A
+IndigoPlateau_PokemonCenter_1F_EventScript_DoorGuard:: @ 816EA8A
lock
faceplayer
specialvar VAR_RESULT, IsNationalPokedexEnabled
compare VAR_RESULT, TRUE
- goto_if_eq EventScript_16EAA6
- msgbox gUnknown_819A8D8
+ goto_if_eq IndigoPlateau_PokemonCenter_1F_EventScript_CheckSeviiIslandComplete
+ msgbox IndigoPlateau_PokemonCenter_1F_Text_FaceEliteFourGoodLuck
release
end
-EventScript_16EAA6:: @ 816EAA6
- goto_if_set FLAG_SYS_CAN_LINK_WITH_RS, EventScript_16EAB9
- msgbox gUnknown_819A943
+IndigoPlateau_PokemonCenter_1F_EventScript_CheckSeviiIslandComplete:: @ 816EAA6
+ goto_if_set FLAG_SYS_CAN_LINK_WITH_RS, IndigoPlateau_PokemonCenter_1F_EventScript_SeviiIslandComplete
+ msgbox IndigoPlateau_PokemonCenter_1F_Text_LoreleiIsAbsentClosedForTimeBeing
release
end
-EventScript_16EAB9:: @ 816EAB9
- msgbox gUnknown_819A8D8
+IndigoPlateau_PokemonCenter_1F_EventScript_SeviiIslandComplete:: @ 816EAB9
+ msgbox IndigoPlateau_PokemonCenter_1F_Text_FaceEliteFourGoodLuck
release
end
-IndigoPlateau_PokemonCenter_1F_EventScript_16EAC3:: @ 816EAC3
- msgbox gUnknown_819A837, MSGBOX_NPC
+IndigoPlateau_PokemonCenter_1F_EventScript_GymGuy:: @ 816EAC3
+ msgbox IndigoPlateau_PokemonCenter_1F_Text_GymGuyAdvice, MSGBOX_NPC
end
-IndigoPlateau_PokemonCenter_1F_EventScript_16EACC:: @ 816EACC
+IndigoPlateau_PokemonCenter_1F_EventScript_Clerk:: @ 816EACC
goto_if_questlog EventScript_ReleaseEnd
lock
faceplayer
message Text_MayIHelpYou
waitmessage
- pokemart Items_16EAF4
+ pokemart IndigoPlateau_PokemonCenter_1F_Items
msgbox Text_PleaseComeAgain
release
end
.align 2
-Items_16EAF4:: @ 816EAF4
+IndigoPlateau_PokemonCenter_1F_Items:: @ 816EAF4
.2byte ITEM_ULTRA_BALL
.2byte ITEM_GREAT_BALL
.2byte ITEM_FULL_RESTORE
@@ -64,7 +64,7 @@ Items_16EAF4:: @ 816EAF4
release
end
-IndigoPlateau_PokemonCenter_1F_EventScript_16EB06:: @ 816EB06
+IndigoPlateau_PokemonCenter_1F_EventScript_Nurse:: @ 816EB06
lock
faceplayer
call EventScript_PkmnCenterNurse
diff --git a/data/maps/IndigoPlateau_PokemonCenter_1F/text.inc b/data/maps/IndigoPlateau_PokemonCenter_1F/text.inc
index 6535f9588..192831d64 100644
--- a/data/maps/IndigoPlateau_PokemonCenter_1F/text.inc
+++ b/data/maps/IndigoPlateau_PokemonCenter_1F/text.inc
@@ -1,4 +1,4 @@
-gUnknown_819A837:: @ 819A837
+IndigoPlateau_PokemonCenter_1F_Text_GymGuyAdvice:: @ 819A837
.string "Yo!\n"
.string "Champ in the making!\p"
.string "At the POKéMON LEAGUE, you will\n"
@@ -8,13 +8,13 @@ gUnknown_819A837:: @ 819A837
.string "This is it!\n"
.string "Go for it!$"
-gUnknown_819A8D8:: @ 819A8D8
+IndigoPlateau_PokemonCenter_1F_Text_FaceEliteFourGoodLuck:: @ 819A8D8
.string "From here on, you face the\n"
.string "ELITE FOUR one by one.\p"
.string "If you win, a door opens to the\n"
.string "next TRAINER. Good luck!$"
-gUnknown_819A943:: @ 819A943
+IndigoPlateau_PokemonCenter_1F_Text_LoreleiIsAbsentClosedForTimeBeing:: @ 819A943
.string "I am so sorry, but you've wasted\n"
.string "your time coming here.\p"
.string "LORELEI of the ELITE FOUR is\n"
@@ -22,7 +22,7 @@ gUnknown_819A943:: @ 819A943
.string "As a result, the POKéMON LEAGUE is\n"
.string "closed for the time being.$"
-Text_19A9E7:: @ 819A9E7
+IndigoPlateau_PokemonCenter_1F_Text_AgathaWhuppedUs:: @ 819A9E7
.string "AGATHA's GHOST-type POKéMON are\n"
.string "horrifically terrifying in toughness.\p"
.string "I took my FIGHTING-type POKéMON\n"
@@ -34,7 +34,7 @@ Text_19A9E7:: @ 819A9E7
.string "It doesn't take anything to get\n"
.string "that scary lady hollering.$"
-Text_19AB16:: @ 819AB16
+IndigoPlateau_PokemonCenter_1F_Text_LancesCousinGymLeaderFarAway:: @ 819AB16
.string "Maybe becoming an ELITE FOUR\n"
.string "member is in the blood.\p"
.string "From what I've heard, LANCE has\n"
diff --git a/data/maps/PokemonLeague_AgathasRoom/map.json b/data/maps/PokemonLeague_AgathasRoom/map.json
index 064480ba0..f71b81bf0 100644
--- a/data/maps/PokemonLeague_AgathasRoom/map.json
+++ b/data/maps/PokemonLeague_AgathasRoom/map.json
@@ -23,7 +23,7 @@
"movement_range_y": 1,
"trainer_type": 0,
"trainer_sight_or_berry_tree_id": 0,
- "script": "PokemonLeague_AgathasRoom_EventScript_162877",
+ "script": "PokemonLeague_AgathasRoom_EventScript_Agatha",
"flag": "0"
}
],
diff --git a/data/maps/PokemonLeague_AgathasRoom/scripts.inc b/data/maps/PokemonLeague_AgathasRoom/scripts.inc
index 62293c1ec..202b9fda4 100644
--- a/data/maps/PokemonLeague_AgathasRoom/scripts.inc
+++ b/data/maps/PokemonLeague_AgathasRoom/scripts.inc
@@ -7,86 +7,84 @@ PokemonLeague_AgathasRoom_MapScripts:: @ 8162810
PokemonLeague_AgathasRoom_OnResume:: @ 8162825
setvar VAR_0x8004, 2
- call EventScript_1A75D5
+ call PokemonLeague_EventScript_DoLightingEffect
end
PokemonLeague_AgathasRoom_OnLoad:: @ 8162830
- call_if_set FLAG_DEFEATED_AGATHA, EventScript_16284B
+ call_if_set FLAG_DEFEATED_AGATHA, PokemonLeague_AgathasRoom_EventScript_SetDoorOpen
compare VAR_MAP_SCENE_POKEMON_LEAGUE, 3
- call_if_eq EventScript_162845
+ call_if_eq PokemonLeague_AgathasRoom_EventScript_CloseEntry
end
-EventScript_162845:: @ 8162845
- call EventScript_1A759C
+PokemonLeague_AgathasRoom_EventScript_CloseEntry:: @ 8162845
+ call PokemonLeague_EventScript_CloseEntry
return
-EventScript_16284B:: @ 816284B
- call EventScript_1A7538
+PokemonLeague_AgathasRoom_EventScript_SetDoorOpen:: @ 816284B
+ call PokemonLeague_EventScript_SetDoorOpen
return
PokemonLeague_AgathasRoom_OnWarp:: @ 8162851
- map_script_2 VAR_TEMP_1, 0, EventScript_16285B
+ map_script_2 VAR_TEMP_1, 0, PokemonLeague_AgathasRoom_EventScript_TurnPlayerNorth
.2byte 0
-EventScript_16285B:: @ 816285B
+PokemonLeague_AgathasRoom_EventScript_TurnPlayerNorth:: @ 816285B
turnobject OBJ_EVENT_ID_PLAYER, DIR_NORTH
end
PokemonLeague_AgathasRoom_OnFrame:: @ 8162860
- map_script_2 VAR_MAP_SCENE_POKEMON_LEAGUE, 2, EventScript_16286A
+ map_script_2 VAR_MAP_SCENE_POKEMON_LEAGUE, 2, PokemonLeague_AgathasRoom_EventScript_EnterRoom
.2byte 0
-EventScript_16286A:: @ 816286A
+PokemonLeague_AgathasRoom_EventScript_EnterRoom:: @ 816286A
lockall
- call EventScript_1A751F
+ call PokemonLeague_EventScript_EnterRoom
setvar VAR_MAP_SCENE_POKEMON_LEAGUE, 3
releaseall
end
-PokemonLeague_AgathasRoom_EventScript_162877:: @ 8162877
+PokemonLeague_AgathasRoom_EventScript_Agatha:: @ 8162877
lock
faceplayer
famechecker FAMECHECKER_AGATHA, FCPICKSTATE_COLORED, UpdatePickStateFromSpecialVar8005
- goto_if_set FLAG_DEFEATED_AGATHA, EventScript_162911
+ goto_if_set FLAG_DEFEATED_AGATHA, PokemonLeague_AgathasRoom_EventScript_PostBattle
famechecker FAMECHECKER_AGATHA, 0
famechecker FAMECHECKER_AGATHA, 4
famechecker FAMECHECKER_OAK, 4
- call_if_unset FLAG_SYS_GAME_CLEAR, EventScript_1628E9
- call_if_set FLAG_SYS_GAME_CLEAR, EventScript_1628F2
+ call_if_unset FLAG_SYS_GAME_CLEAR, PokemonLeague_AgathasRoom_EventScript_Intro
+ call_if_set FLAG_SYS_GAME_CLEAR, PokemonLeague_AgathasRoom_EventScript_RematchIntro
setflag FLAG_TEMP_3
setflag FLAG_TEMP_5
- call_if_unset FLAG_SYS_CAN_LINK_WITH_RS, EventScript_1628FB
- call_if_set FLAG_SYS_CAN_LINK_WITH_RS, EventScript_162906
+ call_if_unset FLAG_SYS_CAN_LINK_WITH_RS, PokemonLeague_AgathasRoom_EventScript_Battle
+ call_if_set FLAG_SYS_CAN_LINK_WITH_RS, PokemonLeague_AgathasRoom_EventScript_Rematch
clearflag FLAG_TEMP_5
- goto EventScript_16291B
-
-EventScript_1628E8:: @ 81628E8
+ goto PokemonLeague_AgathasRoom_EventScript_DefeatedAgatha
end
-EventScript_1628E9:: @ 81628E9
- msgbox gUnknown_817844D
+PokemonLeague_AgathasRoom_EventScript_Intro:: @ 81628E9
+ msgbox PokemonLeague_AgathasRoom_Text_Intro
return
-EventScript_1628F2:: @ 81628F2
- msgbox gUnknown_817858D
+PokemonLeague_AgathasRoom_EventScript_RematchIntro:: @ 81628F2
+ msgbox PokemonLeague_AgathasRoom_Text_RematchIntro
return
-EventScript_1628FB:: @ 81628FB
- trainerbattle_no_intro TRAINER_ELITE_FOUR_AGATHA, Text_1786D7
+PokemonLeague_AgathasRoom_EventScript_Battle:: @ 81628FB
+ trainerbattle_no_intro TRAINER_ELITE_FOUR_AGATHA, PokemonLeague_AgathasRoom_Text_Defeat
return
-EventScript_162906:: @ 8162906
- trainerbattle_no_intro TRAINER_ELITE_FOUR_AGATHA_2, Text_1786D7
+PokemonLeague_AgathasRoom_EventScript_Rematch:: @ 8162906
+ trainerbattle_no_intro TRAINER_ELITE_FOUR_AGATHA_2, PokemonLeague_AgathasRoom_Text_Defeat
return
-EventScript_162911:: @ 8162911
- msgbox gUnknown_8178700
+PokemonLeague_AgathasRoom_EventScript_PostBattle:: @ 8162911
+ msgbox PokemonLeague_AgathasRoom_Text_PostBattle
release
end
-EventScript_16291B:: @ 816291B
+PokemonLeague_AgathasRoom_EventScript_DefeatedAgatha:: @ 816291B
setflag FLAG_DEFEATED_AGATHA
- call EventScript_1A7506
- msgbox gUnknown_8178700
+ call PokemonLeague_EventScript_OpenDoor
+ msgbox PokemonLeague_AgathasRoom_Text_PostBattle
release
end
diff --git a/data/maps/PokemonLeague_AgathasRoom/text.inc b/data/maps/PokemonLeague_AgathasRoom/text.inc
index 8a29f185d..06a8af142 100644
--- a/data/maps/PokemonLeague_AgathasRoom/text.inc
+++ b/data/maps/PokemonLeague_AgathasRoom/text.inc
@@ -1,4 +1,4 @@
-gUnknown_817844D:: @ 817844D
+PokemonLeague_AgathasRoom_Text_Intro:: @ 817844D
.string "I am AGATHA of the ELITE FOUR.\p"
.string "I hear OAK's taken a lot of\n"
.string "interest in you, child.\p"
@@ -13,7 +13,7 @@ gUnknown_817844D:: @ 817844D
.string "{PLAYER}! I'll show you how a real\n"
.string "TRAINER battles!{PLAY_BGM}{MUS_EXEYE}$"
-gUnknown_817858D:: @ 817858D
+PokemonLeague_AgathasRoom_Text_RematchIntro:: @ 817858D
.string "I am AGATHA of the ELITE FOUR.\p"
.string "You're the child that OAK's taken\n"
.string "under his wing, aren't you?\p"
@@ -28,11 +28,11 @@ gUnknown_817858D:: @ 817858D
.string "{PLAYER}! I'll show you how a real\n"
.string "TRAINER battles!{PLAY_BGM}{MUS_EXEYE}$"
-Text_1786D7:: @ 81786D7
+PokemonLeague_AgathasRoom_Text_Defeat:: @ 81786D7
.string "Oh, my!\n"
.string "You're something special, child!$"
-gUnknown_8178700:: @ 8178700
+PokemonLeague_AgathasRoom_Text_PostBattle:: @ 8178700
.string "You win!\p"
.string "I see what the old duff sees in\n"
.string "you now.\p"
diff --git a/data/maps/PokemonLeague_BrunosRoom/map.json b/data/maps/PokemonLeague_BrunosRoom/map.json
index 29e23f75c..a84a63e19 100644
--- a/data/maps/PokemonLeague_BrunosRoom/map.json
+++ b/data/maps/PokemonLeague_BrunosRoom/map.json
@@ -23,7 +23,7 @@
"movement_range_y": 1,
"trainer_type": 0,
"trainer_sight_or_berry_tree_id": 0,
- "script": "PokemonLeague_BrunosRoom_EventScript_1626EC",
+ "script": "PokemonLeague_BrunosRoom_EventScript_Bruno",
"flag": "0"
}
],
diff --git a/data/maps/PokemonLeague_BrunosRoom/scripts.inc b/data/maps/PokemonLeague_BrunosRoom/scripts.inc
index 709b5ab03..123c73f51 100644
--- a/data/maps/PokemonLeague_BrunosRoom/scripts.inc
+++ b/data/maps/PokemonLeague_BrunosRoom/scripts.inc
@@ -7,118 +7,116 @@ PokemonLeague_BrunosRoom_MapScripts:: @ 8162685
PokemonLeague_BrunosRoom_OnResume:: @ 816269A
setvar VAR_0x8004, 1
- call EventScript_1A75D5
+ call PokemonLeague_EventScript_DoLightingEffect
end
PokemonLeague_BrunosRoom_OnLoad:: @ 81626A5
- call_if_set FLAG_DEFEATED_BRUNO, EventScript_1626C0
+ call_if_set FLAG_DEFEATED_BRUNO, PokemonLeague_BrunosRoom_EventScript_SetDoorOpen
compare VAR_MAP_SCENE_POKEMON_LEAGUE, 2
- call_if_eq EventScript_1626BA
+ call_if_eq PokemonLeague_BrunosRoom_EventScript_CloseEntry
end
-EventScript_1626BA:: @ 81626BA
- call EventScript_1A759C
+PokemonLeague_BrunosRoom_EventScript_CloseEntry:: @ 81626BA
+ call PokemonLeague_EventScript_CloseEntry
return
-EventScript_1626C0:: @ 81626C0
- call EventScript_1A7538
+PokemonLeague_BrunosRoom_EventScript_SetDoorOpen:: @ 81626C0
+ call PokemonLeague_EventScript_SetDoorOpen
return
PokemonLeague_BrunosRoom_OnWarp:: @ 81626C6
- map_script_2 VAR_TEMP_1, 0, EventScript_1626D0
+ map_script_2 VAR_TEMP_1, 0, PokemonLeague_BrunosRoom_EventScript_TurnPlayerNorth
.2byte 0
-EventScript_1626D0:: @ 81626D0
+PokemonLeague_BrunosRoom_EventScript_TurnPlayerNorth:: @ 81626D0
turnobject OBJ_EVENT_ID_PLAYER, DIR_NORTH
end
PokemonLeague_BrunosRoom_OnFrame:: @ 81626D5
- map_script_2 VAR_MAP_SCENE_POKEMON_LEAGUE, 1, EventScript_1626DF
+ map_script_2 VAR_MAP_SCENE_POKEMON_LEAGUE, 1, PokemonLeague_BrunosRoom_EventScript_EnterRoom
.2byte 0
-EventScript_1626DF:: @ 81626DF
+PokemonLeague_BrunosRoom_EventScript_EnterRoom:: @ 81626DF
lockall
- call EventScript_1A751F
+ call PokemonLeague_EventScript_EnterRoom
setvar VAR_MAP_SCENE_POKEMON_LEAGUE, 2
releaseall
end
-PokemonLeague_BrunosRoom_EventScript_1626EC:: @ 81626EC
+PokemonLeague_BrunosRoom_EventScript_Bruno:: @ 81626EC
lock
faceplayer
famechecker FAMECHECKER_BRUNO, FCPICKSTATE_COLORED, UpdatePickStateFromSpecialVar8005
- goto_if_set FLAG_DEFEATED_BRUNO, EventScript_162779
+ goto_if_set FLAG_DEFEATED_BRUNO, PokemonLeague_BrunosRoom_EventScript_PostBattle
famechecker FAMECHECKER_BRUNO, 0
famechecker FAMECHECKER_BRUNO, 1
- call_if_unset FLAG_SYS_GAME_CLEAR, EventScript_162751
- call_if_set FLAG_SYS_GAME_CLEAR, EventScript_16275A
+ call_if_unset FLAG_SYS_GAME_CLEAR, PokemonLeague_BrunosRoom_EventScript_Intro
+ call_if_set FLAG_SYS_GAME_CLEAR, PokemonLeague_BrunosRoom_EventScript_RematchIntro
setflag FLAG_TEMP_3
setflag FLAG_TEMP_5
- call_if_unset FLAG_SYS_CAN_LINK_WITH_RS, EventScript_162763
- call_if_set FLAG_SYS_CAN_LINK_WITH_RS, EventScript_16276E
+ call_if_unset FLAG_SYS_CAN_LINK_WITH_RS, PokemonLeague_BrunosRoom_EventScript_Battle
+ call_if_set FLAG_SYS_CAN_LINK_WITH_RS, PokemonLeague_BrunosRoom_EventScript_Rematch
clearflag FLAG_TEMP_5
- goto EventScript_1627B0
-
-EventScript_162750:: @ 8162750
+ goto PokemonLeague_BrunosRoom_EventScript_DefeatedBruno
end
-EventScript_162751:: @ 8162751
- msgbox gUnknown_817820F
+PokemonLeague_BrunosRoom_EventScript_Intro:: @ 8162751
+ msgbox PokemonLeague_BrunosRoom_Text_Intro
return
-EventScript_16275A:: @ 816275A
- msgbox gUnknown_817830C
+PokemonLeague_BrunosRoom_EventScript_RematchIntro:: @ 816275A
+ msgbox PokemonLeague_BrunosRoom_Text_RematchIntro
return
-EventScript_162763:: @ 8162763
- trainerbattle_no_intro TRAINER_ELITE_FOUR_BRUNO, Text_178409
+PokemonLeague_BrunosRoom_EventScript_Battle:: @ 8162763
+ trainerbattle_no_intro TRAINER_ELITE_FOUR_BRUNO, PokemonLeague_BrunosRoom_Text_Defeat
return
-EventScript_16276E:: @ 816276E
- trainerbattle_no_intro TRAINER_ELITE_FOUR_BRUNO_2, Text_178409
+PokemonLeague_BrunosRoom_EventScript_Rematch:: @ 816276E
+ trainerbattle_no_intro TRAINER_ELITE_FOUR_BRUNO_2, PokemonLeague_BrunosRoom_Text_Defeat
return
-EventScript_162779:: @ 8162779
- msgbox gUnknown_8178420
+PokemonLeague_BrunosRoom_EventScript_PostBattle:: @ 8162779
+ msgbox PokemonLeague_BrunosRoom_Text_PostBattle
closemessage
compare VAR_FACING, DIR_NORTH
- call_if_eq EventScript_1627FA
+ call_if_eq PokemonLeague_BrunosRoom_EventScript_BrunoLookAwayRight
compare VAR_FACING, DIR_SOUTH
- call_if_eq EventScript_1627EF
+ call_if_eq PokemonLeague_BrunosRoom_EventScript_BrunoLookAwayLeft
compare VAR_FACING, DIR_WEST
- call_if_eq EventScript_162805
+ call_if_eq PokemonLeague_BrunosRoom_EventScript_BrunoLookAwayDown
compare VAR_FACING, DIR_EAST
- call_if_eq EventScript_162805
+ call_if_eq PokemonLeague_BrunosRoom_EventScript_BrunoLookAwayDown
release
end
-EventScript_1627B0:: @ 81627B0
+PokemonLeague_BrunosRoom_EventScript_DefeatedBruno:: @ 81627B0
setflag FLAG_DEFEATED_BRUNO
- call EventScript_1A7506
- msgbox gUnknown_8178420
+ call PokemonLeague_EventScript_OpenDoor
+ msgbox PokemonLeague_BrunosRoom_Text_PostBattle
closemessage
compare VAR_FACING, DIR_NORTH
- call_if_eq EventScript_1627FA
+ call_if_eq PokemonLeague_BrunosRoom_EventScript_BrunoLookAwayRight
compare VAR_FACING, DIR_SOUTH
- call_if_eq EventScript_1627EF
+ call_if_eq PokemonLeague_BrunosRoom_EventScript_BrunoLookAwayLeft
compare VAR_FACING, DIR_WEST
- call_if_eq EventScript_162805
+ call_if_eq PokemonLeague_BrunosRoom_EventScript_BrunoLookAwayDown
compare VAR_FACING, DIR_EAST
- call_if_eq EventScript_162805
+ call_if_eq PokemonLeague_BrunosRoom_EventScript_BrunoLookAwayDown
release
end
-EventScript_1627EF:: @ 81627EF
+PokemonLeague_BrunosRoom_EventScript_BrunoLookAwayLeft:: @ 81627EF
applymovement 1, Movement_WalkInPlaceFastestLeft
waitmovement 0
return
-EventScript_1627FA:: @ 81627FA
+PokemonLeague_BrunosRoom_EventScript_BrunoLookAwayRight:: @ 81627FA
applymovement 1, Movement_WalkInPlaceFastestRight
waitmovement 0
return
-EventScript_162805:: @ 8162805
+PokemonLeague_BrunosRoom_EventScript_BrunoLookAwayDown:: @ 8162805
applymovement 1, Movement_WalkInPlaceFastestDown
waitmovement 0
return
diff --git a/data/maps/PokemonLeague_BrunosRoom/text.inc b/data/maps/PokemonLeague_BrunosRoom/text.inc
index 57c66a96b..4c6cb4561 100644
--- a/data/maps/PokemonLeague_BrunosRoom/text.inc
+++ b/data/maps/PokemonLeague_BrunosRoom/text.inc
@@ -1,4 +1,4 @@
-gUnknown_817820F:: @ 817820F
+PokemonLeague_BrunosRoom_Text_Intro:: @ 817820F
.string "I am BRUNO of the ELITE FOUR!\p"
.string "Through rigorous training, people\n"
.string "and POKéMON can become stronger\l"
@@ -11,7 +11,7 @@ gUnknown_817820F:: @ 817820F
.string "superior power!\p"
.string "Hoo hah!{PLAY_BGM}{MUS_EXEYE}$"
-gUnknown_817830C:: @ 817830C
+PokemonLeague_BrunosRoom_Text_RematchIntro:: @ 817830C
.string "I am BRUNO of the ELITE FOUR!\p"
.string "Through rigorous training, people\n"
.string "and POKéMON can become stronger\l"
@@ -24,11 +24,11 @@ gUnknown_817830C:: @ 817830C
.string "superior power!\p"
.string "Hoo hah!{PLAY_BGM}{MUS_EXEYE}$"
-Text_178409:: @ 8178409
+PokemonLeague_BrunosRoom_Text_Defeat:: @ 8178409
.string "Why?\n"
.string "How could I lose?$"
-gUnknown_8178420:: @ 8178420
+PokemonLeague_BrunosRoom_Text_PostBattle:: @ 8178420
.string "My job is done.\n"
.string "Go face your next challenge.$"
diff --git a/data/maps/PokemonLeague_ChampionsRoom/scripts.inc b/data/maps/PokemonLeague_ChampionsRoom/scripts.inc
index bf0283a1f..2821da205 100644
--- a/data/maps/PokemonLeague_ChampionsRoom/scripts.inc
+++ b/data/maps/PokemonLeague_ChampionsRoom/scripts.inc
@@ -1,3 +1,6 @@
+.equ LOCALID_RIVAL, 1
+.equ LOCALID_PROF_OAK, 2
+
PokemonLeague_ChampionsRoom_MapScripts:: @ 8162AE2
map_script MAP_SCRIPT_ON_WARP_INTO_MAP_TABLE, PokemonLeague_ChampionsRoom_OnWarp
map_script MAP_SCRIPT_ON_RESUME, PokemonLeague_ChampionsRoom_OnResume
@@ -6,91 +9,91 @@ PokemonLeague_ChampionsRoom_MapScripts:: @ 8162AE2
PokemonLeague_ChampionsRoom_OnResume:: @ 8162AF2
setvar VAR_0x8004, 4
- call EventScript_1A75D5
+ call PokemonLeague_EventScript_DoLightingEffect
compare VAR_STARTER_MON, 2
- call_if_eq EventScript_162B1E
+ call_if_eq PokemonLeague_ChampionsRoom_EventScript_CheckStopTriggerSquirtle
compare VAR_STARTER_MON, 1
- call_if_eq EventScript_162B31
+ call_if_eq PokemonLeague_ChampionsRoom_EventScript_CheckStopTriggerBulbasaur
compare VAR_STARTER_MON, 0
- call_if_eq EventScript_162B44
+ call_if_eq PokemonLeague_ChampionsRoom_EventScript_CheckStopTriggerCharmander
end
-EventScript_162B1E:: @ 8162B1E
- goto_if_defeated TRAINER_CHAMPION_FIRST_SQUIRTLE, EventScript_162B57
- goto_if_defeated TRAINER_CHAMPION_REMATCH_SQUIRTLE, EventScript_162B57
+PokemonLeague_ChampionsRoom_EventScript_CheckStopTriggerSquirtle:: @ 8162B1E
+ goto_if_defeated TRAINER_CHAMPION_FIRST_SQUIRTLE, PokemonLeague_ChampionsRoom_EventScript_StopSceneTrigger
+ goto_if_defeated TRAINER_CHAMPION_REMATCH_SQUIRTLE, PokemonLeague_ChampionsRoom_EventScript_StopSceneTrigger
return
-EventScript_162B31:: @ 8162B31
- goto_if_defeated TRAINER_CHAMPION_FIRST_BULBASAUR, EventScript_162B57
- goto_if_defeated TRAINER_CHAMPION_REMATCH_BULBASAUR, EventScript_162B57
+PokemonLeague_ChampionsRoom_EventScript_CheckStopTriggerBulbasaur:: @ 8162B31
+ goto_if_defeated TRAINER_CHAMPION_FIRST_BULBASAUR, PokemonLeague_ChampionsRoom_EventScript_StopSceneTrigger
+ goto_if_defeated TRAINER_CHAMPION_REMATCH_BULBASAUR, PokemonLeague_ChampionsRoom_EventScript_StopSceneTrigger
return
-EventScript_162B44:: @ 8162B44
- goto_if_defeated TRAINER_CHAMPION_FIRST_CHARMANDER, EventScript_162B57
- goto_if_defeated TRAINER_CHAMPION_REMATCH_CHARMANDER, EventScript_162B57
+PokemonLeague_ChampionsRoom_EventScript_CheckStopTriggerCharmander:: @ 8162B44
+ goto_if_defeated TRAINER_CHAMPION_FIRST_CHARMANDER, PokemonLeague_ChampionsRoom_EventScript_StopSceneTrigger
+ goto_if_defeated TRAINER_CHAMPION_REMATCH_CHARMANDER, PokemonLeague_ChampionsRoom_EventScript_StopSceneTrigger
return
-EventScript_162B57:: @ 8162B57
+PokemonLeague_ChampionsRoom_EventScript_StopSceneTrigger:: @ 8162B57
setvar VAR_TEMP_1, 1
return
PokemonLeague_ChampionsRoom_OnWarp:: @ 8162B5D
- map_script_2 VAR_TEMP_1, 0, EventScript_162B67
+ map_script_2 VAR_TEMP_1, 0, PokemonLeague_ChampionsRoom_EventScript_TurnPlayerNorth
.2byte 0
-EventScript_162B67:: @ 8162B67
+PokemonLeague_ChampionsRoom_EventScript_TurnPlayerNorth:: @ 8162B67
turnobject OBJ_EVENT_ID_PLAYER, DIR_NORTH
end
PokemonLeague_ChampionsRoom_OnFrame:: @ 8162B6C
- map_script_2 VAR_TEMP_1, 0, EventScript_162B76
+ map_script_2 VAR_TEMP_1, 0, PokemonLeague_ChampionsRoom_EventScript_EnterRoom
.2byte 0
-EventScript_162B76:: @ 8162B76
+PokemonLeague_ChampionsRoom_EventScript_EnterRoom:: @ 8162B76
lockall
textcolor 0
setflag FLAG_TEMP_2
- applymovement OBJ_EVENT_ID_PLAYER, Movement_162D07
+ applymovement OBJ_EVENT_ID_PLAYER, PokemonLeague_ChampionsRoom_Movement_PlayerEnter
waitmovement 0
delay 20
- call_if_unset FLAG_SYS_GAME_CLEAR, EventScript_162CB3
- call_if_set FLAG_SYS_GAME_CLEAR, EventScript_162CBC
- goto_if_questlog EventScript_162C68
+ call_if_unset FLAG_SYS_GAME_CLEAR, PokemonLeague_ChampionsRoom_EventScript_Intro
+ call_if_set FLAG_SYS_GAME_CLEAR, PokemonLeague_ChampionsRoom_EventScript_RematchIntro
+ goto_if_questlog PokemonLeague_ChampionsRoom_EventScript_QuestLogEnd
setflag FLAG_TEMP_3
setflag FLAG_TEMP_5
savebgm MUS_WIN_GYM
- call_if_unset FLAG_SYS_CAN_LINK_WITH_RS, EventScript_162C6F
- call_if_set FLAG_SYS_CAN_LINK_WITH_RS, EventScript_162C91
+ call_if_unset FLAG_SYS_CAN_LINK_WITH_RS, PokemonLeague_ChampionsRoom_EventScript_Battle
+ call_if_set FLAG_SYS_CAN_LINK_WITH_RS, PokemonLeague_ChampionsRoom_EventScript_Rematch
setflag FLAG_TEMP_4
clearflag FLAG_TEMP_5
setflag FLAG_DEFEATED_CHAMP
setflag FLAG_TEMP_4
- msgbox gUnknown_8178F2F
+ msgbox PokemonLeague_ChampionsRoom_Text_PostBattle
playbgm MUS_SLOWMASARA, 0
- addobject 2
- msgbox gUnknown_8178FC6
+ addobject LOCALID_PROF_OAK
+ msgbox PokemonLeague_ChampionsRoom_Text_OakPlayer
closemessage
- applymovement OBJ_EVENT_ID_PLAYER, Movement_162D1F
- applymovement 1, Movement_162D41
- applymovement 2, Movement_162D2A
+ applymovement OBJ_EVENT_ID_PLAYER, PokemonLeague_ChampionsRoom_Movement_PlayerWatchOakEnter
+ applymovement LOCALID_RIVAL, PokemonLeague_ChampionsRoom_Movement_RivalWatchOakEnter
+ applymovement LOCALID_PROF_OAK, PokemonLeague_ChampionsRoom_Movement_OakEnter
waitmovement 0
delay 25
specialvar VAR_RESULT, ScrSpecial_GetStarter
getspeciesname 0, VAR_RESULT
- msgbox gUnknown_8178FCF
- applymovement 2, Movement_WalkInPlaceFastestRight
- applymovement 1, Movement_WalkInPlaceFastestLeft
+ msgbox PokemonLeague_ChampionsRoom_Text_OakCongratulations
+ applymovement LOCALID_PROF_OAK, Movement_WalkInPlaceFastestRight
+ applymovement LOCALID_RIVAL, Movement_WalkInPlaceFastestLeft
waitmovement 0
- msgbox gUnknown_817908F
+ msgbox PokemonLeague_ChampionsRoom_Text_OakImDisappointedRival
closemessage
- applymovement 2, Movement_WalkInPlaceFastestDown
+ applymovement LOCALID_PROF_OAK, Movement_WalkInPlaceFastestDown
waitmovement 0
delay 20
- msgbox gUnknown_81791A3
+ msgbox PokemonLeague_ChampionsRoom_Text_OakPlayerComeWithMe
closemessage
delay 13
- applymovement 2, Movement_162D37
- applymovement OBJ_EVENT_ID_PLAYER, Movement_162D12
+ applymovement LOCALID_PROF_OAK, PokemonLeague_ChampionsRoom_Movement_OakExit
+ applymovement OBJ_EVENT_ID_PLAYER, PokemonLeague_ChampionsRoom_Movement_PlayerExit
waitmovement 0
setvar VAR_TEMP_1, 1
warp MAP_POKEMON_LEAGUE_HALL_OF_FAME, 255, 5, 12
@@ -98,62 +101,62 @@ EventScript_162B76:: @ 8162B76
releaseall
end
-EventScript_162C68:: @ 8162C68
- call EventScript_162B57
+PokemonLeague_ChampionsRoom_EventScript_QuestLogEnd:: @ 8162C68
+ call PokemonLeague_ChampionsRoom_EventScript_StopSceneTrigger
releaseall
end
-EventScript_162C6F:: @ 8162C6F
+PokemonLeague_ChampionsRoom_EventScript_Battle:: @ 8162C6F
compare VAR_STARTER_MON, 2
- call_if_eq EventScript_162CC5
+ call_if_eq PokemonLeague_ChampionsRoom_EventScript_BattleSquirtle
compare VAR_STARTER_MON, 1
- call_if_eq EventScript_162CD0
+ call_if_eq PokemonLeague_ChampionsRoom_EventScript_BattleBulbasaur
compare VAR_STARTER_MON, 0
- call_if_eq EventScript_162CDB
+ call_if_eq PokemonLeague_ChampionsRoom_EventScript_BattleCharmander
return
-EventScript_162C91:: @ 8162C91
+PokemonLeague_ChampionsRoom_EventScript_Rematch:: @ 8162C91
compare VAR_STARTER_MON, 2
- call_if_eq EventScript_162CE6
+ call_if_eq PokemonLeague_ChampionsRoom_EventScript_RematchSquirtle
compare VAR_STARTER_MON, 1
- call_if_eq EventScript_162CF1
+ call_if_eq PokemonLeague_ChampionsRoom_EventScript_RematchBulbasaur
compare VAR_STARTER_MON, 0
- call_if_eq EventScript_162CFC
+ call_if_eq PokemonLeague_ChampionsRoom_EventScript_RematchCharmander
return
-EventScript_162CB3:: @ 8162CB3
- msgbox gUnknown_8178B6C
+PokemonLeague_ChampionsRoom_EventScript_Intro:: @ 8162CB3
+ msgbox PokemonLeague_ChampionsRoom_Text_Intro
return
-EventScript_162CBC:: @ 8162CBC
- msgbox gUnknown_8178CD4
+PokemonLeague_ChampionsRoom_EventScript_RematchIntro:: @ 8162CBC
+ msgbox PokemonLeague_ChampionsRoom_Text_RematchIntro
return
-EventScript_162CC5:: @ 8162CC5
- trainerbattle_no_intro TRAINER_CHAMPION_FIRST_SQUIRTLE, Text_178E3F
+PokemonLeague_ChampionsRoom_EventScript_BattleSquirtle:: @ 8162CC5
+ trainerbattle_no_intro TRAINER_CHAMPION_FIRST_SQUIRTLE, PokemonLeague_ChampionsRoom_Text_Defeat
return
-EventScript_162CD0:: @ 8162CD0
- trainerbattle_no_intro TRAINER_CHAMPION_FIRST_BULBASAUR, Text_178E3F
+PokemonLeague_ChampionsRoom_EventScript_BattleBulbasaur:: @ 8162CD0
+ trainerbattle_no_intro TRAINER_CHAMPION_FIRST_BULBASAUR, PokemonLeague_ChampionsRoom_Text_Defeat
return
-EventScript_162CDB:: @ 8162CDB
- trainerbattle_no_intro TRAINER_CHAMPION_FIRST_CHARMANDER, Text_178E3F
+PokemonLeague_ChampionsRoom_EventScript_BattleCharmander:: @ 8162CDB
+ trainerbattle_no_intro TRAINER_CHAMPION_FIRST_CHARMANDER, PokemonLeague_ChampionsRoom_Text_Defeat
return
-EventScript_162CE6:: @ 8162CE6
- trainerbattle_no_intro TRAINER_CHAMPION_REMATCH_SQUIRTLE, Text_178E3F
+PokemonLeague_ChampionsRoom_EventScript_RematchSquirtle:: @ 8162CE6
+ trainerbattle_no_intro TRAINER_CHAMPION_REMATCH_SQUIRTLE, PokemonLeague_ChampionsRoom_Text_Defeat
return
-EventScript_162CF1:: @ 8162CF1
- trainerbattle_no_intro TRAINER_CHAMPION_REMATCH_BULBASAUR, Text_178E3F
+PokemonLeague_ChampionsRoom_EventScript_RematchBulbasaur:: @ 8162CF1
+ trainerbattle_no_intro TRAINER_CHAMPION_REMATCH_BULBASAUR, PokemonLeague_ChampionsRoom_Text_Defeat
return
-EventScript_162CFC:: @ 8162CFC
- trainerbattle_no_intro TRAINER_CHAMPION_REMATCH_CHARMANDER, Text_178E3F
+PokemonLeague_ChampionsRoom_EventScript_RematchCharmander:: @ 8162CFC
+ trainerbattle_no_intro TRAINER_CHAMPION_REMATCH_CHARMANDER, PokemonLeague_ChampionsRoom_Text_Defeat
return
-Movement_162D07:: @ 8162D07
+PokemonLeague_ChampionsRoom_Movement_PlayerEnter:: @ 8162D07
walk_up
walk_up
walk_up
@@ -166,7 +169,7 @@ Movement_162D07:: @ 8162D07
walk_up
step_end
-Movement_162D12:: @ 8162D12
+PokemonLeague_ChampionsRoom_Movement_PlayerExit:: @ 8162D12
delay_16
walk_left
walk_up
@@ -181,7 +184,7 @@ Movement_162D12:: @ 8162D12
set_invisible
step_end
-Movement_162D1F:: @ 8162D1F
+PokemonLeague_ChampionsRoom_Movement_PlayerWatchOakEnter:: @ 8162D1F
delay_8
walk_in_place_fastest_down
delay_16
@@ -194,7 +197,7 @@ Movement_162D1F:: @ 8162D1F
walk_in_place_fastest_left
step_end
-Movement_162D2A:: @ 8162D2A
+PokemonLeague_ChampionsRoom_Movement_OakEnter:: @ 8162D2A
delay_16
delay_16
walk_up
@@ -209,7 +212,7 @@ Movement_162D2A:: @ 8162D2A
delay_16
step_end
-Movement_162D37:: @ 8162D37
+PokemonLeague_ChampionsRoom_Movement_OakExit:: @ 8162D37
walk_up
walk_up
walk_right
@@ -221,7 +224,7 @@ Movement_162D37:: @ 8162D37
set_invisible
step_end
-Movement_162D41:: @ 8162D41
+PokemonLeague_ChampionsRoom_Movement_RivalWatchOakEnter:: @ 8162D41
delay_16
delay_16
delay_16
diff --git a/data/maps/PokemonLeague_ChampionsRoom/text.inc b/data/maps/PokemonLeague_ChampionsRoom/text.inc
index a99db09db..19ba16fa3 100644
--- a/data/maps/PokemonLeague_ChampionsRoom/text.inc
+++ b/data/maps/PokemonLeague_ChampionsRoom/text.inc
@@ -1,4 +1,4 @@
-gUnknown_8178B6C:: @ 8178B6C
+PokemonLeague_ChampionsRoom_Text_Intro:: @ 8178B6C
.string "{RIVAL}: Hey, {PLAYER}!\p"
.string "I was looking forward to seeing\n"
.string "you, {PLAYER}.\p"
@@ -16,7 +16,7 @@ gUnknown_8178B6C:: @ 8178B6C
.string "I am the most powerful TRAINER in\n"
.string "the world!$"
-gUnknown_8178CD4:: @ 8178CD4
+PokemonLeague_ChampionsRoom_Text_RematchIntro:: @ 8178CD4
.string "{RIVAL}: Hey, {PLAYER}!\p"
.string "You came back, {PLAYER}!\n"
.string "Hahah, that is so great!\p"
@@ -34,7 +34,7 @@ gUnknown_8178CD4:: @ 8178CD4
.string "I am the most powerful TRAINER in\n"
.string "the world!$"
-Text_178E3F:: @ 8178E3F
+PokemonLeague_ChampionsRoom_Text_Defeat:: @ 8178E3F
.string "NO!\n"
.string "That can't be!\l"
.string "You beat me at my best!\p"
@@ -43,7 +43,7 @@ Text_178E3F:: @ 8178E3F
.string "My reign is over already?\n"
.string "It's not fair!$"
-Text_178EC3:: @ 8178EC3
+PokemonLeague_ChampionsRoom_Text_Victory:: @ 8178EC3
.string "はーはッ!\n"
.string "かった! かった! かった!\p"
.string "{PLAYER}に まける ような\n"
@@ -54,7 +54,7 @@ Text_178EC3:: @ 8178EC3
.string "ほめて つかわす!\n"
.string "はーッ! はーはッはッ!$"
-gUnknown_8178F2F:: @ 8178F2F
+PokemonLeague_ChampionsRoom_Text_PostBattle:: @ 8178F2F
.string "Why?\n"
.string "Why did I lose?\p"
.string "I never made any mistakes raising\n"
@@ -63,10 +63,10 @@ gUnknown_8178F2F:: @ 8178F2F
.string "LEAGUE CHAMPION!\p"
.string "Although I don't like to admit it…$"
-gUnknown_8178FC6:: @ 8178FC6
+PokemonLeague_ChampionsRoom_Text_OakPlayer:: @ 8178FC6
.string "OAK: {PLAYER}!$"
-gUnknown_8178FCF:: @ 8178FCF
+PokemonLeague_ChampionsRoom_Text_OakCongratulations:: @ 8178FCF
.string "OAK: So, you've won!\n"
.string "Sincerely, congratulations!\p"
.string "You're the new POKéMON LEAGUE\n"
@@ -76,7 +76,7 @@ gUnknown_8178FCF:: @ 8178FCF
.string "on the POKéDEX.\p"
.string "{PLAYER}, you have come of age!$"
-gUnknown_817908F:: @ 817908F
+PokemonLeague_ChampionsRoom_Text_OakImDisappointedRival:: @ 817908F
.string "OAK: {RIVAL}…\n"
.string "I'm disappointed in you.\p"
.string "I came when I heard you'd beaten\n"
@@ -90,7 +90,7 @@ gUnknown_817908F:: @ 817908F
.string "Without them, you will never\n"
.string "become a CHAMP again!$"
-gUnknown_81791A3:: @ 81791A3
+PokemonLeague_ChampionsRoom_Text_OakPlayerComeWithMe:: @ 81791A3
.string "OAK: {PLAYER}.\p"
.string "You understand that your victory\n"
.string "was not just your own doing.\p"
diff --git a/data/maps/PokemonLeague_HallOfFame/scripts.inc b/data/maps/PokemonLeague_HallOfFame/scripts.inc
index 080e65ece..de838a669 100644
--- a/data/maps/PokemonLeague_HallOfFame/scripts.inc
+++ b/data/maps/PokemonLeague_HallOfFame/scripts.inc
@@ -12,26 +12,26 @@ EventScript_162D61:: @ 8162D61
end
PokemonLeague_HallOfFame_OnFrame:: @ 8162D66
- map_script_2 VAR_TEMP_1, 0, EventScript_162D70
+ map_script_2 VAR_TEMP_1, 0, PokemonLeague_HallOfFame_EventScript_EnterRoom
.2byte 0
-EventScript_162D70:: @ 8162D70
+PokemonLeague_HallOfFame_EventScript_EnterRoom:: @ 8162D70
lockall
textcolor 0
- applymovement OBJ_EVENT_ID_PLAYER, Movement_162DCD
+ applymovement OBJ_EVENT_ID_PLAYER, PokemonLeague_HallOfFame_Movement_EnterRoom
waitmovement 0
applymovement 1, Movement_WalkInPlaceFastestLeft
applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestRight
waitmovement 0
delay 18
- msgbox gUnknown_817922F
+ msgbox PokemonLeague_HallOfFame_Text_OakCongratulations
closemessage
applymovement 1, Movement_WalkInPlaceFastestUp
applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestUp
waitmovement 0
delay 20
- dofieldeffect 62
- waitfieldeffect 62
+ dofieldeffect FLDEFF_HALL_OF_FAME_RECORD
+ waitfieldeffect FLDEFF_HALL_OF_FAME_RECORD
delay 40
setvar VAR_TEMP_1, 1
call EventScript_1A651A
@@ -42,7 +42,7 @@ EventScript_162D70:: @ 8162D70
releaseall
end
-Movement_162DCD:: @ 8162DCD
+PokemonLeague_HallOfFame_Movement_EnterRoom:: @ 8162DCD
walk_up
walk_up
walk_up
diff --git a/data/maps/PokemonLeague_HallOfFame/text.inc b/data/maps/PokemonLeague_HallOfFame/text.inc
index 111f655cc..a5bc2e47a 100644
--- a/data/maps/PokemonLeague_HallOfFame/text.inc
+++ b/data/maps/PokemonLeague_HallOfFame/text.inc
@@ -1,4 +1,4 @@
-gUnknown_817922F:: @ 817922F
+PokemonLeague_HallOfFame_Text_OakCongratulations:: @ 817922F
.string "OAK: Er-hem!\n"
.string "Congratulations, {PLAYER}!\p"
.string "This floor is the POKéMON HALL OF\n"
diff --git a/data/maps/PokemonLeague_LancesRoom/map.json b/data/maps/PokemonLeague_LancesRoom/map.json
index 3e9571b83..47f3651e5 100644
--- a/data/maps/PokemonLeague_LancesRoom/map.json
+++ b/data/maps/PokemonLeague_LancesRoom/map.json
@@ -23,7 +23,7 @@
"movement_range_y": 1,
"trainer_type": 0,
"trainer_sight_or_berry_tree_id": 0,
- "script": "PokemonLeague_LancesRoom_EventScript_162A14",
+ "script": "PokemonLeague_LancesRoom_EventScript_Lance",
"flag": "0"
}
],
diff --git a/data/maps/PokemonLeague_LancesRoom/scripts.inc b/data/maps/PokemonLeague_LancesRoom/scripts.inc
index 56619200c..2328a777c 100644
--- a/data/maps/PokemonLeague_LancesRoom/scripts.inc
+++ b/data/maps/PokemonLeague_LancesRoom/scripts.inc
@@ -7,41 +7,41 @@ PokemonLeague_LancesRoom_MapScripts:: @ 816292D
PokemonLeague_LancesRoom_OnResume:: @ 8162942
setvar VAR_0x8004, 3
- call EventScript_1A75D5
+ call PokemonLeague_EventScript_DoLightingEffect
end
PokemonLeague_LancesRoom_OnLoad:: @ 816294D
compare VAR_MAP_SCENE_POKEMON_LEAGUE, 4
- call_if_eq EventScript_162962
- call_if_set FLAG_DEFEATED_LANCE, EventScript_162968
+ call_if_eq PokemonLeague_LancesRoom_EventScript_CloseEntry
+ call_if_set FLAG_DEFEATED_LANCE, PokemonLeague_LancesRoom_EventScript_SetDoorOpen
end
-EventScript_162962:: @ 8162962
- call EventScript_1629A8
+PokemonLeague_LancesRoom_EventScript_CloseEntry:: @ 8162962
+ call PokemonLeague_LancesRoom_EventScript_SetEntryClosed
return
-EventScript_162968:: @ 8162968
- call EventScript_1A7589
+PokemonLeague_LancesRoom_EventScript_SetDoorOpen:: @ 8162968
+ call PokemonLeague_EventScript_SetDoorOpenLance
return
PokemonLeague_LancesRoom_OnWarp:: @ 816296E
- map_script_2 VAR_TEMP_1, 0, EventScript_162978
+ map_script_2 VAR_TEMP_1, 0, PokemonLeague_LancesRoom_EventScript_TurnPlayerNorth
.2byte 0
-EventScript_162978:: @ 8162978
+PokemonLeague_LancesRoom_EventScript_TurnPlayerNorth:: @ 8162978
turnobject OBJ_EVENT_ID_PLAYER, DIR_NORTH
end
PokemonLeague_LancesRoom_OnFrame:: @ 816297D
- map_script_2 VAR_MAP_SCENE_POKEMON_LEAGUE, 3, EventScript_162987
+ map_script_2 VAR_MAP_SCENE_POKEMON_LEAGUE, 3, PokemonLeague_LancesRoom_EventScript_EnterRoom
.2byte 0
-EventScript_162987:: @ 8162987
+PokemonLeague_LancesRoom_EventScript_EnterRoom:: @ 8162987
lockall
- applymovement OBJ_EVENT_ID_PLAYER, Movement_1629F1
+ applymovement OBJ_EVENT_ID_PLAYER, PokemonLeague_LancesRoom_Movement_WalkThroughCorridor
waitmovement 0
setflag FLAG_TEMP_2
- call EventScript_1629A8
+ call PokemonLeague_LancesRoom_EventScript_SetEntryClosed
playse SE_KI_GASYAN
special DrawWholeMapView
waitse
@@ -49,18 +49,18 @@ EventScript_162987:: @ 8162987
releaseall
end
-EventScript_1629A8:: @ 81629A8
- setmetatile 5, 14, 669, 1
- setmetatile 6, 14, 670, 1
- setmetatile 7, 14, 671, 1
- setmetatile 5, 15, 677, 1
- setmetatile 6, 15, 678, 1
- setmetatile 7, 15, 679, 1
- setmetatile 6, 16, 785, 0
- setmetatile 7, 16, 785, 0
+PokemonLeague_LancesRoom_EventScript_SetEntryClosed:: @ 81629A8
+ setmetatile 5, 14, METATILE_PokemonLeague_Entry_TopLeft_Closed, 1
+ setmetatile 6, 14, METATILE_PokemonLeague_Entry_TopMid_Closed, 1
+ setmetatile 7, 14, METATILE_PokemonLeague_Entry_TopRight_Closed, 1
+ setmetatile 5, 15, METATILE_PokemonLeague_Entry_BottomLeft_Closed, 1
+ setmetatile 6, 15, METATILE_PokemonLeague_Entry_BottomMid_Closed, 1
+ setmetatile 7, 15, METATILE_PokemonLeague_Entry_BottomRight_Closed, 1
+ setmetatile 6, 16, METATILE_PokemonLeague_Floor_ShadeFull_Lance, 0
+ setmetatile 7, 16, METATILE_PokemonLeague_Floor_ShadeFull_Lance, 0
return
-Movement_1629F1:: @ 81629F1
+PokemonLeague_LancesRoom_Movement_WalkThroughCorridor:: @ 81629F1
walk_up
walk_up
walk_left
@@ -97,72 +97,70 @@ Movement_1629F1:: @ 81629F1
walk_up
step_end
-PokemonLeague_LancesRoom_EventScript_162A14:: @ 8162A14
+PokemonLeague_LancesRoom_EventScript_Lance:: @ 8162A14
lock
faceplayer
famechecker FAMECHECKER_LANCE, FCPICKSTATE_COLORED, UpdatePickStateFromSpecialVar8005
- goto_if_set FLAG_DEFEATED_LANCE, EventScript_162AA1
+ goto_if_set FLAG_DEFEATED_LANCE, PokemonLeague_LancesRoom_EventScript_PostBattle
famechecker FAMECHECKER_LANCE, 0
famechecker FAMECHECKER_LANCE, 1
- call_if_unset FLAG_SYS_GAME_CLEAR, EventScript_162A79
- call_if_set FLAG_SYS_GAME_CLEAR, EventScript_162A82
+ call_if_unset FLAG_SYS_GAME_CLEAR, PokemonLeague_LancesRoom_EventScript_Intro
+ call_if_set FLAG_SYS_GAME_CLEAR, PokemonLeague_LancesRoom_EventScript_RematchIntro
setflag FLAG_TEMP_3
setflag FLAG_TEMP_5
- call_if_unset FLAG_SYS_CAN_LINK_WITH_RS, EventScript_162A8B
- call_if_set FLAG_SYS_CAN_LINK_WITH_RS, EventScript_162A96
+ call_if_unset FLAG_SYS_CAN_LINK_WITH_RS, PokemonLeague_LancesRoom_EventScript_Battle
+ call_if_set FLAG_SYS_CAN_LINK_WITH_RS, PokemonLeague_LancesRoom_EventScript_Rematch
clearflag FLAG_TEMP_5
- goto EventScript_162AAB
-
-EventScript_162A78:: @ 8162A78
+ goto PokemonLeague_LancesRoom_EventScript_DefeatedLance
end
-EventScript_162A79:: @ 8162A79
- msgbox gUnknown_8178764
+PokemonLeague_LancesRoom_EventScript_Intro:: @ 8162A79
+ msgbox PokemonLeague_LancesRoom_Text_Intro
return
-EventScript_162A82:: @ 8162A82
- msgbox gUnknown_81788BD
+PokemonLeague_LancesRoom_EventScript_RematchIntro:: @ 8162A82
+ msgbox PokemonLeague_LancesRoom_Text_RematchIntro
return
-EventScript_162A8B:: @ 8162A8B
- trainerbattle_no_intro TRAINER_ELITE_FOUR_LANCE, Text_178A15
+PokemonLeague_LancesRoom_EventScript_Battle:: @ 8162A8B
+ trainerbattle_no_intro TRAINER_ELITE_FOUR_LANCE, PokemonLeague_LancesRoom_Text_Defeat
return
-EventScript_162A96:: @ 8162A96
- trainerbattle_no_intro TRAINER_ELITE_FOUR_LANCE_2, Text_178A15
+PokemonLeague_LancesRoom_EventScript_Rematch:: @ 8162A96
+ trainerbattle_no_intro TRAINER_ELITE_FOUR_LANCE_2, PokemonLeague_LancesRoom_Text_Defeat
return
-EventScript_162AA1:: @ 8162AA1
- msgbox gUnknown_8178A52
+PokemonLeague_LancesRoom_EventScript_PostBattle:: @ 8162AA1
+ msgbox PokemonLeague_LancesRoom_Text_PostBattle
release
end
-EventScript_162AAB:: @ 8162AAB
+PokemonLeague_LancesRoom_EventScript_DefeatedLance:: @ 8162AAB
setvar VAR_0x8004, 0
special Special_TryGainNewFanFromCounter
setflag FLAG_DEFEATED_LANCE
- call EventScript_1A7563
- msgbox gUnknown_8178A52
+ call PokemonLeague_EventScript_OpenDoorLance
+ msgbox PokemonLeague_LancesRoom_Text_PostBattle
closemessage
release
end
-EventScript_162AC6:: @ 8162AC6
- applymovement 1, Movement_162ADC
+PokemonLeague_LancesRoom_EventScript_LanceMoveOutOfWayLeft:: @ 8162AC6
+ applymovement 1, PokemonLeague_LancesRoom_Movement_LanceMoveOutOfWayLeft
waitmovement 0
return
-EventScript_162AD1:: @ 8162AD1
- applymovement 1, Movement_162ADF
+PokemonLeague_LancesRoom_EventScript_LanceMoveOutOfWayRight:: @ 8162AD1
+ applymovement 1, PokemonLeague_LancesRoom_Movement_LanceMoveOutOfWayRight
waitmovement 0
return
-Movement_162ADC:: @ 8162ADC
+PokemonLeague_LancesRoom_Movement_LanceMoveOutOfWayLeft:: @ 8162ADC
walk_left
walk_in_place_fastest_right
step_end
-Movement_162ADF:: @ 8162ADF
+PokemonLeague_LancesRoom_Movement_LanceMoveOutOfWayRight:: @ 8162ADF
walk_right
walk_in_place_fastest_left
step_end
diff --git a/data/maps/PokemonLeague_LancesRoom/text.inc b/data/maps/PokemonLeague_LancesRoom/text.inc
index 9565fd4d5..8c726875a 100644
--- a/data/maps/PokemonLeague_LancesRoom/text.inc
+++ b/data/maps/PokemonLeague_LancesRoom/text.inc
@@ -1,4 +1,4 @@
-gUnknown_8178764:: @ 8178764
+PokemonLeague_LancesRoom_Text_Intro:: @ 8178764
.string "Ah! I've heard about you,\n"
.string "{PLAYER}!\p"
.string "I lead the ELITE FOUR.\p"
@@ -14,7 +14,7 @@ gUnknown_8178764:: @ 8178764
.string "Your LEAGUE challenge ends with\n"
.string "me, {PLAYER}!{PLAY_BGM}{MUS_EXEYE}$"
-gUnknown_81788BD:: @ 81788BD
+PokemonLeague_LancesRoom_Text_RematchIntro:: @ 81788BD
.string "Ah!\n"
.string "So, you've returned, {PLAYER}!\p"
.string "I lead the ELITE FOUR.\p"
@@ -30,12 +30,12 @@ gUnknown_81788BD:: @ 81788BD
.string "Your LEAGUE challenge ends with\n"
.string "me, {PLAYER}!{PLAY_BGM}{MUS_EXEYE}$"
-Text_178A15:: @ 8178A15
+PokemonLeague_LancesRoom_Text_Defeat:: @ 8178A15
.string "That's it!\p"
.string "I hate to admit it, but you are a\n"
.string "POKéMON master!$"
-gUnknown_8178A52:: @ 8178A52
+PokemonLeague_LancesRoom_Text_PostBattle:: @ 8178A52
.string "I still can't believe my dragons\n"
.string "lost to you, {PLAYER}.\p"
.string "You are now the POKéMON LEAGUE\n"
diff --git a/data/maps/PokemonLeague_LoreleisRoom/map.json b/data/maps/PokemonLeague_LoreleisRoom/map.json
index 6801df803..f33c2a35b 100644
--- a/data/maps/PokemonLeague_LoreleisRoom/map.json
+++ b/data/maps/PokemonLeague_LoreleisRoom/map.json
@@ -23,7 +23,7 @@
"movement_range_y": 1,
"trainer_type": 0,
"trainer_sight_or_berry_tree_id": 0,
- "script": "PokemonLeague_LoreleisRoom_EventScript_1625DC",
+ "script": "PokemonLeague_LoreleisRoom_EventScript_Lorelei",
"flag": "0"
}
],
diff --git a/data/maps/PokemonLeague_LoreleisRoom/scripts.inc b/data/maps/PokemonLeague_LoreleisRoom/scripts.inc
index e95ecfd98..422029153 100644
--- a/data/maps/PokemonLeague_LoreleisRoom/scripts.inc
+++ b/data/maps/PokemonLeague_LoreleisRoom/scripts.inc
@@ -8,21 +8,21 @@ PokemonLeague_LoreleisRoom_MapScripts:: @ 816256C
PokemonLeague_LoreleisRoom_OnResume:: @ 8162586
setvar VAR_0x8004, 0
- call EventScript_1A75D5
+ call PokemonLeague_EventScript_DoLightingEffect
end
PokemonLeague_LoreleisRoom_OnLoad:: @ 8162591
- call_if_set FLAG_DEFEATED_LORELEI, EventScript_1625AC
+ call_if_set FLAG_DEFEATED_LORELEI, PokemonLeague_LoreleisRoom_EventScript_SetDoorOpen
compare VAR_MAP_SCENE_POKEMON_LEAGUE, 1
- call_if_eq EventScript_1625A6
+ call_if_eq PokemonLeague_LoreleisRoom_EventScript_CloseEntry
end
-EventScript_1625A6:: @ 81625A6
- call EventScript_1A759C
+PokemonLeague_LoreleisRoom_EventScript_CloseEntry:: @ 81625A6
+ call PokemonLeague_EventScript_CloseEntry
return
-EventScript_1625AC:: @ 81625AC
- call EventScript_1A7538
+PokemonLeague_LoreleisRoom_EventScript_SetDoorOpen:: @ 81625AC
+ call PokemonLeague_EventScript_SetDoorOpen
return
PokemonLeague_LoreleisRoom_OnTransition:: @ 81625B2
@@ -30,67 +30,65 @@ PokemonLeague_LoreleisRoom_OnTransition:: @ 81625B2
end
PokemonLeague_LoreleisRoom_OnWarp:: @ 81625B6
- map_script_2 VAR_TEMP_1, 0, EventScript_1625C0
+ map_script_2 VAR_TEMP_1, 0, PokemonLeague_LoreleisRoom_EventScript_TurnPlayerNorth
.2byte 0
-EventScript_1625C0:: @ 81625C0
+PokemonLeague_LoreleisRoom_EventScript_TurnPlayerNorth:: @ 81625C0
turnobject OBJ_EVENT_ID_PLAYER, DIR_NORTH
end
PokemonLeague_LoreleisRoom_OnFrame:: @ 81625C5
- map_script_2 VAR_MAP_SCENE_POKEMON_LEAGUE, 0, EventScript_1625CF
+ map_script_2 VAR_MAP_SCENE_POKEMON_LEAGUE, 0, PokemonLeague_LoreleisRoom_EventScript_EnterRoom
.2byte 0
-EventScript_1625CF:: @ 81625CF
+PokemonLeague_LoreleisRoom_EventScript_EnterRoom:: @ 81625CF
lockall
- call EventScript_1A751F
+ call PokemonLeague_EventScript_EnterRoom
setvar VAR_MAP_SCENE_POKEMON_LEAGUE, 1
releaseall
end
-PokemonLeague_LoreleisRoom_EventScript_1625DC:: @ 81625DC
+PokemonLeague_LoreleisRoom_EventScript_Lorelei:: @ 81625DC
lock
faceplayer
famechecker FAMECHECKER_LORELEI, FCPICKSTATE_COLORED, UpdatePickStateFromSpecialVar8005
- goto_if_set FLAG_DEFEATED_LORELEI, EventScript_162669
+ goto_if_set FLAG_DEFEATED_LORELEI, PokemonLeague_LoreleisRoom_EventScript_PostBattle
famechecker FAMECHECKER_LORELEI, 0
famechecker FAMECHECKER_LORELEI, 1
- call_if_unset FLAG_SYS_CAN_LINK_WITH_RS, EventScript_162641
- call_if_set FLAG_SYS_CAN_LINK_WITH_RS, EventScript_16264A
+ call_if_unset FLAG_SYS_CAN_LINK_WITH_RS, PokemonLeague_LoreleisRoom_EventScript_Intro
+ call_if_set FLAG_SYS_CAN_LINK_WITH_RS, PokemonLeague_LoreleisRoom_EventScript_RematchIntro
setflag FLAG_TEMP_3
setflag FLAG_TEMP_5
- call_if_unset FLAG_SYS_CAN_LINK_WITH_RS, EventScript_162653
- call_if_set FLAG_SYS_CAN_LINK_WITH_RS, EventScript_16265E
+ call_if_unset FLAG_SYS_CAN_LINK_WITH_RS, PokemonLeague_LoreleisRoom_EventScript_Battle
+ call_if_set FLAG_SYS_CAN_LINK_WITH_RS, PokemonLeague_LoreleisRoom_EventScript_Rematch
clearflag FLAG_TEMP_5
- goto EventScript_162673
-
-EventScript_162640:: @ 8162640
+ goto PokemonLeague_LoreleisRoom_EventScript_DefeatedLorelei
end
-EventScript_162641:: @ 8162641
- msgbox gUnknown_8177FA4
+PokemonLeague_LoreleisRoom_EventScript_Intro:: @ 8162641
+ msgbox PokemonLeague_LoreleisRoom_Text_Intro
return
-EventScript_16264A:: @ 816264A
- msgbox gUnknown_8178089
+PokemonLeague_LoreleisRoom_EventScript_RematchIntro:: @ 816264A
+ msgbox PokemonLeague_LoreleisRoom_Text_RematchIntro
return
-EventScript_162653:: @ 8162653
- trainerbattle_no_intro TRAINER_ELITE_FOUR_LORELEI, Text_178191
+PokemonLeague_LoreleisRoom_EventScript_Battle:: @ 8162653
+ trainerbattle_no_intro TRAINER_ELITE_FOUR_LORELEI, PokemonLeague_LoreleisRoom_Text_Defeat
return
-EventScript_16265E:: @ 816265E
- trainerbattle_no_intro TRAINER_ELITE_FOUR_LORELEI_2, Text_178191
+PokemonLeague_LoreleisRoom_EventScript_Rematch:: @ 816265E
+ trainerbattle_no_intro TRAINER_ELITE_FOUR_LORELEI_2, PokemonLeague_LoreleisRoom_Text_Defeat
return
-EventScript_162669:: @ 8162669
- msgbox gUnknown_81781B0
+PokemonLeague_LoreleisRoom_EventScript_PostBattle:: @ 8162669
+ msgbox PokemonLeague_LoreleisRoom_Text_PostBattle
release
end
-EventScript_162673:: @ 8162673
+PokemonLeague_LoreleisRoom_EventScript_DefeatedLorelei:: @ 8162673
setflag FLAG_DEFEATED_LORELEI
- call EventScript_1A7506
- msgbox gUnknown_81781B0
+ call PokemonLeague_EventScript_OpenDoor
+ msgbox PokemonLeague_LoreleisRoom_Text_PostBattle
release
end
diff --git a/data/maps/PokemonLeague_LoreleisRoom/text.inc b/data/maps/PokemonLeague_LoreleisRoom/text.inc
index 9619ab86b..55e67d764 100644
--- a/data/maps/PokemonLeague_LoreleisRoom/text.inc
+++ b/data/maps/PokemonLeague_LoreleisRoom/text.inc
@@ -1,4 +1,4 @@
-gUnknown_8177FA4:: @ 8177FA4
+PokemonLeague_LoreleisRoom_Text_Intro:: @ 8177FA4
.string "Welcome to the POKéMON LEAGUE.\p"
.string "I am LORELEI of the ELITE FOUR.\p"
.string "No one can best me when it comes\n"
@@ -9,7 +9,7 @@ gUnknown_8177FA4:: @ 8177FA4
.string "Hahaha!\n"
.string "Are you ready?{PLAY_BGM}{MUS_EXEYE}$"
-gUnknown_8178089:: @ 8178089
+PokemonLeague_LoreleisRoom_Text_RematchIntro:: @ 8178089
.string "Welcome to the POKéMON LEAGUE.\p"
.string "I, LORELEI of the ELITE FOUR,\n"
.string "have returned!\p"
@@ -22,10 +22,10 @@ gUnknown_8178089:: @ 8178089
.string "Hahaha!\n"
.string "Are you ready?{PLAY_BGM}{MUS_EXEYE}$"
-Text_178191:: @ 8178191
+PokemonLeague_LoreleisRoom_Text_Defeat:: @ 8178191
.string "…Things shouldn't be this way!$"
-gUnknown_81781B0:: @ 81781B0
+PokemonLeague_LoreleisRoom_Text_PostBattle:: @ 81781B0
.string "You're better than I thought.\n"
.string "Go on ahead.\p"
.string "You only got a taste of the\n"
diff --git a/data/scripts/fame_checker.inc b/data/scripts/fame_checker.inc
index 81e732d12..cae80438e 100644
--- a/data/scripts/fame_checker.inc
+++ b/data/scripts/fame_checker.inc
@@ -177,12 +177,12 @@ SevenIsland_SevaultCanyon_EventScript_1ACF95:: @ 81ACF95
release
end
-IndigoPlateau_PokemonCenter_1F_EventScript_1ACFAE:: @ 81ACFAE
+IndigoPlateau_PokemonCenter_1F_EventScript_BlackBelt:: @ 81ACFAE
lock
faceplayer
famechecker FAMECHECKER_AGATHA, 1
famechecker FAMECHECKER_AGATHA, 2
- msgbox Text_19A9E7
+ msgbox IndigoPlateau_PokemonCenter_1F_Text_AgathaWhuppedUs
release
end
@@ -235,20 +235,20 @@ CeladonCity_DepartmentStore_2F_EventScript_Woman:: @ 81AD053
release
end
-IndigoPlateau_PokemonCenter_1F_EventScript_1AD06C:: @ 81AD06C
+IndigoPlateau_PokemonCenter_1F_EventScript_PokemonJournal:: @ 81AD06C
lock
faceplayer
famechecker FAMECHECKER_LANCE, 4
textcolor 3
- msgbox gUnknown_81B1A31
+ msgbox PokemonJournal_Text_SpecialFeatureLance
release
end
-IndigoPlateau_PokemonCenter_1F_EventScript_1AD087:: @ 81AD087
+IndigoPlateau_PokemonCenter_1F_EventScript_CooltrainerM:: @ 81AD087
lock
faceplayer
famechecker FAMECHECKER_LANCE, 5
- msgbox Text_19AB16
+ msgbox IndigoPlateau_PokemonCenter_1F_Text_LancesCousinGymLeaderFarAway
release
end
diff --git a/data/scripts/pokemon_league.inc b/data/scripts/pokemon_league.inc
new file mode 100644
index 000000000..806e0976a
--- /dev/null
+++ b/data/scripts/pokemon_league.inc
@@ -0,0 +1,64 @@
+PokemonLeague_EventScript_OpenDoor:: @ 81A7506
+ applymovement OBJ_EVENT_ID_PLAYER, Movement_Delay32
+ waitmovement 0
+ playse SE_DOOR
+ call PokemonLeague_EventScript_SetDoorOpen
+ special DrawWholeMapView
+ setflag FLAG_TEMP_4
+ return
+
+PokemonLeague_EventScript_EnterRoom:: @ 81A751F
+ applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkUp5
+ waitmovement 0
+ setflag FLAG_TEMP_2
+ playse SE_KI_GASYAN
+ call PokemonLeague_EventScript_CloseEntry
+ special DrawWholeMapView
+ return
+
+PokemonLeague_EventScript_SetDoorOpen:: @ 81A7538
+ setmetatile 6, 1, METATILE_PokemonLeague_Door_Top_Open, 1
+ setmetatile 6, 2, METATILE_PokemonLeague_Door_Mid_Open, 0
+ return
+
+PokemonLeague_EventScript_PreventExit:: @ 81A754B
+ lockall
+ textcolor 0
+ msgbox Text_VoiceRangOutDontRunAway
+ closemessage
+ applymovement OBJ_EVENT_ID_PLAYER, PokemonLeague_Movement_ForcePlayerIn
+ waitmovement 0
+ releaseall
+ end
+
+PokemonLeague_EventScript_OpenDoorLance:: @ 81A7563
+ applymovement OBJ_EVENT_ID_PLAYER, Movement_Delay32
+ waitmovement 0
+ playse SE_DOOR
+ setmetatile 6, 4, METATILE_PokemonLeague_Door_Top_Open, 1
+ setmetatile 6, 5, METATILE_PokemonLeague_Door_Mid_Open, 0
+ special DrawWholeMapView
+ setflag FLAG_TEMP_4
+ return
+
+PokemonLeague_EventScript_SetDoorOpenLance:: @ 81A7589
+ setmetatile 6, 4, METATILE_PokemonLeague_Door_Top_Open, 1
+ setmetatile 6, 5, METATILE_PokemonLeague_Door_Mid_Open, 0
+ return
+
+PokemonLeague_EventScript_CloseEntry:: @ 81A759C
+ setmetatile 5, 11, METATILE_PokemonLeague_Entry_TopLeft_Closed, 1
+ setmetatile 6, 11, METATILE_PokemonLeague_Entry_TopMid_Closed, 1
+ setmetatile 7, 11, METATILE_PokemonLeague_Entry_TopRight_Closed, 1
+ setmetatile 5, 12, METATILE_PokemonLeague_Entry_BottomLeft_Closed, 1
+ setmetatile 6, 12, METATILE_PokemonLeague_Entry_BottomMid_Closed, 1
+ setmetatile 7, 12, METATILE_PokemonLeague_Entry_BottomRight_Closed, 1
+ return
+
+PokemonLeague_Movement_ForcePlayerIn:: @ 81A75D3
+ walk_up
+ step_end
+
+PokemonLeague_EventScript_DoLightingEffect:: @ 81A75D5
+ special Special_PokemonLeagueLightingEffect
+ return
diff --git a/data/text/fame_checker.inc b/data/text/fame_checker.inc
index 32417ef7f..a8226df05 100644
--- a/data/text/fame_checker.inc
+++ b/data/text/fame_checker.inc
@@ -1453,7 +1453,7 @@ gUnknown_81B19A8:: @ 81B19A8
.string "OAK were rivals who vied for\l"
.string "supremacy as TRAINERS.$"
-gUnknown_81B1A31:: @ 81B1A31
+PokemonJournal_Text_SpecialFeatureLance:: @ 81B1A31
.string "POKéMON JOURNAL\p"
.string "Special Feature:\n"
.string "ELITE FOUR's LANCE!\p"
diff --git a/include/constants/metatile_labels.h b/include/constants/metatile_labels.h
index 1b3af7b96..191982eb4 100644
--- a/include/constants/metatile_labels.h
+++ b/include/constants/metatile_labels.h
@@ -103,6 +103,17 @@
#define METATILE_CinnabarGym_Floor_WallLeftEdge 0x2CF
#define METATILE_CinnabarGym_Wall_RetractedBarrier 0x2D1
+// gTileset_PokemonLeague
+#define METATILE_PokemonLeague_Door_Top_Open 0x28E
+#define METATILE_PokemonLeague_Door_Mid_Open 0x296
+#define METATILE_PokemonLeague_Entry_TopLeft_Closed 0x29D
+#define METATILE_PokemonLeague_Entry_TopMid_Closed 0x29E
+#define METATILE_PokemonLeague_Entry_TopRight_Closed 0x29F
+#define METATILE_PokemonLeague_Entry_BottomLeft_Closed 0x2A5
+#define METATILE_PokemonLeague_Entry_BottomMid_Closed 0x2A6
+#define METATILE_PokemonLeague_Entry_BottomRight_Closed 0x2A7
+#define METATILE_PokemonLeague_Floor_ShadeFull_Lance 0x311
+
// gTileset_MtEmber
#define METATILE_MtEmber_CaveEntrance 0x346
diff --git a/include/librfu.h b/include/librfu.h
index 50dd1c3db..3c9d776f1 100644
--- a/include/librfu.h
+++ b/include/librfu.h
@@ -4,6 +4,8 @@
#include "global.h"
#include "main.h"
+#define LIBRFU_VERSION 1024
+
/* TODOs:
* - documentation
* - check if any field needs to be volatile
@@ -307,7 +309,11 @@ struct STWIStatus
u8 ackActiveCommand;
u8 timerSelect;
u8 unk_b;
- u32 timerState; // this field is s32 in emerald
+#if LIBRFU_VERSION >= 1026
+ s32 timerState;
+#else
+ u32 timerState;
+#endif
vu8 timerActive;
u8 unk_11;
vu16 error;
@@ -472,7 +478,7 @@ extern struct RfuFixed *gRfuFixed;
extern struct RfuSlotStatusNI *gRfuSlotStatusNI[RFU_CHILD_MAX];
extern struct RfuSlotStatusUNI *gRfuSlotStatusUNI[RFU_CHILD_MAX];
-// librfu_s32id
+// librfu_sio32id
s32 AgbRFU_checkID(u8 maxTries);
// Arguments with "bm..." specify slots of the form (0x01 << slot number) that are the object of a function operation.
diff --git a/src/librfu_rfu.c b/src/librfu_rfu.c
index 420fb7c9a..582060f78 100644
--- a/src/librfu_rfu.c
+++ b/src/librfu_rfu.c
@@ -108,20 +108,18 @@ static const struct LLSFStruct llsf_struct[2] = {
}
};
-#ifdef EMERALD
-static const char lib_ver[] = "RFU_V1026";
-#else
-static const char lib_ver[] = "RFU_V1024";
-#endif
+#define xstr(s) str(s)
+#define str(s) #s
+const char version_string[] = "RFU_V" xstr(LIBRFU_VERSION);
static const char str_checkMbootLL[] = "RFU-MBOOT";
-#define COPY(src, dst, size) do { \
- const u16 *_src = (const u16 *)(src); \
- u16 *_dst = (u16 *)(dst); \
- u16 _size = (size); \
- while (_size-- != 0) \
- *_dst++ = *_src++; \
+#define COPY(src, dst, iterator, size) do { \
+ const u16 *_src = (const u16 *)(src); \
+ u16 *_dst = (u16 *)(dst); \
+ (iterator) = (size); \
+ while ((iterator)-- != 0) \
+ *_dst++ = *_src++; \
} while (0)
u16 rfu_initializeAPI(u32 *APIBuffer, u16 buffByteSize, IntrFunc *sioIntrTable_p, bool8 copyInterruptToRam)
@@ -177,17 +175,17 @@ u16 rfu_initializeAPI(u32 *APIBuffer, u16 buffByteSize, IntrFunc *sioIntrTable_p
gRfuSlotStatusUNI[i]->recvBufferSize = 0;
}
// rfu_REQ_changeMasterSlave is the function next to rfu_STC_fastCopy
-#if LIBRFU_VERSION < 1028
+#if LIBRFU_VERSION < 1026
src = (const u16 *)((uintptr_t)&rfu_STC_fastCopy & ~1);
dst = gRfuFixed->fastCopyBuffer;
buffByteSizeMax = ((void *)rfu_REQ_changeMasterSlave - (void *)rfu_STC_fastCopy) / sizeof(u16);
while (buffByteSizeMax-- != 0)
*dst++ = *src++;
#else
- // register swap dst <--> buffByteSizeMax
COPY(
- (const u16 *)((uintptr_t)&rfu_STC_fastCopy & ~1),
+ (uintptr_t)&rfu_STC_fastCopy & ~1,
gRfuFixed->fastCopyBuffer,
+ buffByteSizeMax,
0x60 / sizeof(u16)
);
#endif
@@ -501,7 +499,7 @@ static void rfu_CB_configGameData(u8 reqCommand, u16 reqResult)
void rfu_REQ_startSearchChild(void)
{
u16 result;
-#if LIBRFU_VERSION >= 1028
+#if LIBRFU_VERSION >= 1026
u16 i;
for (i = 0; i < RFU_CHILD_MAX; i++)
{
@@ -591,14 +589,12 @@ static void rfu_STC_readChildList(void)
u8 numSlots = gRfuFixed->STWIBuffer->rxPacketAlloc.rfuPacket8.data[1];
u8 *data_p;
u8 i;
- u8 true_slots[RFU_CHILD_MAX];
u8 bm_slot_id;
-
-#if LIBRFU_VERSION >= 1028
-//#if 1
- // TODO: decompile this
+#if LIBRFU_VERSION < 1026
+ u8 true_slots[RFU_CHILD_MAX];
#endif
+#if LIBRFU_VERSION < 1026
if (numSlots != 0)
{
stwiParam = gRfuFixed->STWIBuffer->rxPacketAlloc.rfuPacket32.data[0];
@@ -612,6 +608,7 @@ static void rfu_STC_readChildList(void)
}
gRfuFixed->STWIBuffer->rxPacketAlloc.rfuPacket32.data[0] = stwiParam;
}
+#endif
for (data_p = &gRfuFixed->STWIBuffer->rxPacketAlloc.rfuPacket8.data[4];
numSlots != 0;
data_p += 4)
@@ -619,6 +616,7 @@ static void rfu_STC_readChildList(void)
bm_slot_id = data_p[2];
if (bm_slot_id < RFU_CHILD_MAX && !((gRfuLinkStatus->connSlotFlag >> bm_slot_id) & 1) && !((gRfuLinkStatus->linkLossSlotFlag >> bm_slot_id) & 1))
{
+ #if LIBRFU_VERSION < 1026
if (true_slots[bm_slot_id] != 0)
++gRfuStatic->lsFixedCount[bm_slot_id];
if (gRfuStatic->lsFixedCount[bm_slot_id] >= 4)
@@ -633,6 +631,17 @@ static void rfu_STC_readChildList(void)
gRfuStatic->flags &= 0x7F;
gRfuStatic->cidBak[bm_slot_id] = gRfuLinkStatus->partner[bm_slot_id].id;
}
+ #else
+ gRfuStatic->lsFixedCount[bm_slot_id] = 0xF0;
+ gRfuLinkStatus->strength[bm_slot_id] = 16;
+ gRfuLinkStatus->connSlotFlag |= 1 << bm_slot_id;
+ ++gRfuLinkStatus->connCount;
+ gRfuLinkStatus->partner[bm_slot_id].id = *(u16 *)data_p;
+ gRfuLinkStatus->partner[bm_slot_id].slot = bm_slot_id;
+ gRfuLinkStatus->parentChild = MODE_PARENT;
+ gRfuStatic->flags &= 0x7F;
+ gRfuStatic->cidBak[bm_slot_id] = gRfuLinkStatus->partner[bm_slot_id].id;
+ #endif
}
--numSlots;
}
@@ -881,7 +890,11 @@ u16 rfu_REQBN_watchLink(u16 reqCommandId, u8 *bmLinkLossSlot, u8 *linkLossReason
gRfuStatic->watchdogTimer = 360;
if (gRfuStatic->nowWatchInterval == 0)
{
+ #if LIBRFU_VERSION < 1026
gRfuStatic->nowWatchInterval = gRfuLinkStatus->watchInterval;
+ #else
+ gRfuStatic->nowWatchInterval = 4;
+ #endif
reasonMaybe = 1;
}
if ((u8)reqCommandId == ID_DISCONNECTED_AND_CHANGE_REQ)
@@ -934,6 +947,14 @@ u16 rfu_REQBN_watchLink(u16 reqCommandId, u8 *bmLinkLossSlot, u8 *linkLossReason
}
for (; i < RFU_CHILD_MAX; ++i)
{
+ #if LIBRFU_VERSION >= 1026
+ if (gRfuStatic->lsFixedCount[i] != 0)
+ {
+ gRfuStatic->lsFixedCount[i] -= 4;
+ if (gRfuLinkStatus->strength[i] <= 15)
+ gRfuLinkStatus->strength[i] = 16;
+ }
+ #endif
newLinkLossFlag = 1 << i;
if (reqResult == 0)
{
@@ -1041,6 +1062,9 @@ static void rfu_STC_removeLinkData(u8 bmConnectedPartnerId, u8 bmDisconnect)
u8 bmLinkLossFlag = 1 << bmConnectedPartnerId;
s32 bmLinkRetainedFlag;
+#if LIBRFU_VERSION >= 1026
+ gRfuStatic->lsFixedCount[bmConnectedPartnerId] = 0;
+#endif
if ((gRfuLinkStatus->connSlotFlag & bmLinkLossFlag) && gRfuLinkStatus->connCount != 0)
--gRfuLinkStatus->connCount;
gRfuLinkStatus->connSlotFlag &= bmLinkRetainedFlag = ~bmLinkLossFlag;
@@ -1421,7 +1445,7 @@ static u16 rfu_STC_setSendData_org(u8 ni_or_uni, u8 bmSendSlot, u8 subFrameSize,
slotStatus_NI->send.src = src;
slotStatus_NI->send.ack = 0;
slotStatus_NI->send.phase = 0;
- #ifndef NONMATCHING // to fix bm_slot_id, r3, frameSize, sending register roulette
+ #ifndef NONMATCHING // to fix r2, r3, r4, r5 register roulette
asm("":::"r2");
#endif
for (i = 0; i < WINDOW_COUNT; ++i)