diff options
author | GriffinR <griffin.richards@comcast.net> | 2019-09-17 18:01:20 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-17 18:01:20 -0400 |
commit | 58b8d7c297576846aeef4173bbe8a6a71608ad98 (patch) | |
tree | 319f3958ba9d39b05eac1d8ca5d4937c1224577d | |
parent | 945d3d3a27f6e5005e5481bb2ad36f1a2a220d3d (diff) | |
parent | 459fca289caa2be09864412c82a868862978f082 (diff) |
Merge branch 'master' into document-eventscripts
49 files changed, 1234 insertions, 991 deletions
diff --git a/common_syms/field_specials.txt b/common_syms/field_specials.txt index 25d874a65..7adb3f669 100644 --- a/common_syms/field_specials.txt +++ b/common_syms/field_specials.txt @@ -1 +1 @@ -gUnknown_030061D0 +gScrollableMultichoice_ListMenuTemplate diff --git a/data/event_scripts.s b/data/event_scripts.s index 412d68eff..5d59eb75c 100644 --- a/data/event_scripts.s +++ b/data/event_scripts.s @@ -7,6 +7,7 @@ #include "constants/event_objects.h" #include "constants/event_object_movement_constants.h" #include "constants/field_effects.h" +#include "constants/field_specials.h" #include "constants/flags.h" #include "constants/game_stat.h" #include "constants/decorations.h" @@ -1130,7 +1131,7 @@ Std_FindItem:: @ 8271BFD EventScript_PickItemUp:: @ 8271C3A removeobject VAR_LAST_TALKED giveitem VAR_0x8004, VAR_0x8005 - specialvar VAR_RESULT, sub_81398C0 + specialvar VAR_RESULT, BufferTMHMMoveName copyvar VAR_0x8008, VAR_RESULT compare VAR_0x8008, 1 call_if_eq EventScript_271C8F @@ -1182,7 +1183,7 @@ EventScript_HiddenItemScript:: @ 8271CB7 EventScript_271CE8:: @ 8271CE8 copyvar VAR_0x8008, VAR_0x8004 copyvar VAR_0x8004, VAR_0x8005 - specialvar VAR_RESULT, sub_81398C0 + specialvar VAR_RESULT, BufferTMHMMoveName compare VAR_RESULT, 1 goto_if_eq EventScript_271D0E compare VAR_RESULT, 0 @@ -2545,34 +2546,34 @@ LittlerootTown_ProfessorBirchsLab_EventScript_2737A0:: @ 82737A0 MossdeepCity_StevensHouse_EventScript_2737A0:: @ 82737A0 Route119_WeatherInstitute_2F_EventScript_2737A0:: @ 82737A0 RustboroCity_DevonCorp_2F_EventScript_2737A0:: @ 82737A0 - bufferboxname 0, VAR_STORAGE_UNKNOWN + bufferboxname 0, VAR_PC_BOX_TO_SEND_MON bufferspeciesname 1, VAR_TEMP_1 call_if_unset FLAG_SYS_PC_LANETTE, LittlerootTown_ProfessorBirchsLab_EventScript_2737BB call_if_set FLAG_SYS_PC_LANETTE, LittlerootTown_ProfessorBirchsLab_EventScript_2737E6 return LittlerootTown_ProfessorBirchsLab_EventScript_2737BB:: @ 82737BB - specialvar VAR_RESULT, sub_813B21C + specialvar VAR_RESULT, ShouldShowBoxWasFullMessage compare VAR_RESULT, 1 goto_if_eq LittlerootTown_ProfessorBirchsLab_EventScript_2737D4 msgbox gText_PkmnTransferredSomeonesPC, MSGBOX_DEFAULT return LittlerootTown_ProfessorBirchsLab_EventScript_2737D4:: @ 82737D4 - specialvar VAR_RESULT, get_unknown_box_id + specialvar VAR_RESULT, GetPCBoxToSendMon bufferboxname 2, VAR_RESULT msgbox gText_PkmnBoxSomeonesPCFull, MSGBOX_DEFAULT return LittlerootTown_ProfessorBirchsLab_EventScript_2737E6:: @ 82737E6 - specialvar VAR_RESULT, sub_813B21C + specialvar VAR_RESULT, ShouldShowBoxWasFullMessage compare VAR_RESULT, 1 goto_if_eq LittlerootTown_ProfessorBirchsLab_EventScript_2737FF msgbox gText_PkmnTransferredLanettesPC, MSGBOX_DEFAULT return LittlerootTown_ProfessorBirchsLab_EventScript_2737FF:: @ 82737FF - specialvar VAR_RESULT, get_unknown_box_id + specialvar VAR_RESULT, GetPCBoxToSendMon bufferboxname 2, VAR_RESULT msgbox gText_PkmnBoxLanettesPCFull, MSGBOX_DEFAULT return @@ -2591,7 +2592,7 @@ EventScript_Questionnaire:: @ 827381B call Common_ShowEasyChatScreen lock faceplayer - specialvar VAR_0x8008, sub_813B490 + specialvar VAR_0x8008, GetMartEmployeeObjectEventId compare VAR_0x8004, 1 goto_if_eq EventScript_27386D compare VAR_0x8004, 2 diff --git a/data/maps/BattleFrontier_BattlePointExchangeServiceCorner/scripts.inc b/data/maps/BattleFrontier_BattlePointExchangeServiceCorner/scripts.inc index 3ebb57ff9..87915cd2c 100644 --- a/data/maps/BattleFrontier_BattlePointExchangeServiceCorner/scripts.inc +++ b/data/maps/BattleFrontier_BattlePointExchangeServiceCorner/scripts.inc @@ -3,17 +3,17 @@ BattleFrontier_BattlePointExchangeServiceCorner_MapScripts:: @ 825F070 BattleFrontier_BattlePointExchangeServiceCorner_EventScript_25F071:: @ 825F071 msgbox BattleFrontier_BattlePointExchangeServiceCorner_Text_25F7FA, MSGBOX_DEFAULT - special sub_813A958 + special ShowBattlePointsWindow return BattleFrontier_BattlePointExchangeServiceCorner_EventScript_25F07D:: @ 825F07D msgbox BattleFrontier_BattlePointExchangeServiceCorner_Text_25FF12, MSGBOX_DEFAULT - special sub_813A988 + special CloseBattlePointsWindow release end BattleFrontier_BattlePointExchangeServiceCorner_EventScript_25F08A:: @ 825F08A - specialvar VAR_TEMP_1, sub_813AA04 + specialvar VAR_TEMP_1, GetFrontierBattlePoints compare VAR_TEMP_1, VAR_0x8008 goto_if_ge BattleFrontier_BattlePointExchangeServiceCorner_EventScript_25F0C9 msgbox BattleFrontier_BattlePointExchangeServiceCorner_Text_25FE86, MSGBOX_DEFAULT @@ -39,9 +39,9 @@ BattleFrontier_BattlePointExchangeServiceCorner_EventScript_25F0E5:: @ 825F0E5 compare VAR_RESULT, 0 goto_if_eq BattleFrontier_BattlePointExchangeServiceCorner_EventScript_25F11D copyvar VAR_0x8004, VAR_0x8008 - special sub_813A9A4 + special TakeFrontierBattlePoints givedecoration VAR_0x8009 - special sub_813A8FC + special UpdateBattlePointsWindow playse SE_REGI msgbox BattleFrontier_BattlePointExchangeServiceCorner_Text_25FE45, MSGBOX_DEFAULT compare VAR_TEMP_2, 0 @@ -51,7 +51,7 @@ BattleFrontier_BattlePointExchangeServiceCorner_EventScript_25F0E5:: @ 825F0E5 BattleFrontier_BattlePointExchangeServiceCorner_EventScript_25F11D:: @ 825F11D msgbox BattleFrontier_BattlePointExchangeServiceCorner_Text_25FEB9, MSGBOX_DEFAULT - special sub_813A988 + special CloseBattlePointsWindow release end @@ -60,9 +60,9 @@ BattleFrontier_BattlePointExchangeServiceCorner_EventScript_25F12A:: @ 825F12A compare VAR_RESULT, 0 goto_if_eq BattleFrontier_BattlePointExchangeServiceCorner_EventScript_25F166 copyvar VAR_0x8004, VAR_0x8008 - special sub_813A9A4 + special TakeFrontierBattlePoints giveitem VAR_0x8009, 1 - special sub_813A8FC + special UpdateBattlePointsWindow playse SE_REGI msgbox BattleFrontier_BattlePointExchangeServiceCorner_Text_25FE72, MSGBOX_DEFAULT compare VAR_TEMP_2, 2 @@ -72,7 +72,7 @@ BattleFrontier_BattlePointExchangeServiceCorner_EventScript_25F12A:: @ 825F12A BattleFrontier_BattlePointExchangeServiceCorner_EventScript_25F166:: @ 825F166 msgbox BattleFrontier_BattlePointExchangeServiceCorner_Text_25FEE3, MSGBOX_DEFAULT - special sub_813A988 + special CloseBattlePointsWindow release end @@ -85,11 +85,11 @@ BattleFrontier_BattlePointExchangeServiceCorner_EventScript_25F173:: @ 825F173 end BattleFrontier_BattlePointExchangeServiceCorner_EventScript_25F185:: @ 825F185 - setvar VAR_0x8004, 3 - special sub_813AA18 - special sub_813A128 + setvar VAR_0x8004, SCROLL_MULTI_BF_EXCHANGE_CORNER_DECOR_VENDOR_1 + special ShowFrontierExchangeCornerItemIconWindow + special ShowScrollableMultichoice waitstate - special sub_813AA44 + special CloseFrontierExchangeCornerItemIconWindow switch VAR_RESULT case 0, BattleFrontier_BattlePointExchangeServiceCorner_EventScript_25F21E case 1, BattleFrontier_BattlePointExchangeServiceCorner_EventScript_25F241 @@ -204,11 +204,11 @@ BattleFrontier_BattlePointExchangeServiceCorner_EventScript_25F37C:: @ 825F37C end BattleFrontier_BattlePointExchangeServiceCorner_EventScript_25F38E:: @ 825F38E - setvar VAR_0x8004, 4 - special sub_813AA18 - special sub_813A128 + setvar VAR_0x8004, SCROLL_MULTI_BF_EXCHANGE_CORNER_DECOR_VENDOR_2 + special ShowFrontierExchangeCornerItemIconWindow + special ShowScrollableMultichoice waitstate - special sub_813AA44 + special CloseFrontierExchangeCornerItemIconWindow switch VAR_RESULT case 0, BattleFrontier_BattlePointExchangeServiceCorner_EventScript_25F3F0 case 1, BattleFrontier_BattlePointExchangeServiceCorner_EventScript_25F413 @@ -273,11 +273,11 @@ BattleFrontier_BattlePointExchangeServiceCorner_EventScript_25F49F:: @ 825F49F end BattleFrontier_BattlePointExchangeServiceCorner_EventScript_25F4B1:: @ 825F4B1 - setvar VAR_0x8004, 5 - special sub_813AA18 - special sub_813A128 + setvar VAR_0x8004, SCROLL_MULTI_BF_EXCHANGE_CORNER_VITAMIN_VENDOR + special ShowFrontierExchangeCornerItemIconWindow + special ShowScrollableMultichoice waitstate - special sub_813AA44 + special CloseFrontierExchangeCornerItemIconWindow switch VAR_RESULT case 0, BattleFrontier_BattlePointExchangeServiceCorner_EventScript_25F51E case 1, BattleFrontier_BattlePointExchangeServiceCorner_EventScript_25F541 @@ -352,11 +352,11 @@ BattleFrontier_BattlePointExchangeServiceCorner_EventScript_25F5F0:: @ 825F5F0 end BattleFrontier_BattlePointExchangeServiceCorner_EventScript_25F602:: @ 825F602 - setvar VAR_0x8004, 6 - special sub_813AA18 - special sub_813A128 + setvar VAR_0x8004, SCROLL_MULTI_BF_EXCHANGE_CORNER_HOLD_ITEM_VENDOR + special ShowFrontierExchangeCornerItemIconWindow + special ShowScrollableMultichoice waitstate - special sub_813AA44 + special CloseFrontierExchangeCornerItemIconWindow switch VAR_RESULT case 0, BattleFrontier_BattlePointExchangeServiceCorner_EventScript_25F690 case 1, BattleFrontier_BattlePointExchangeServiceCorner_EventScript_25F6B3 diff --git a/data/maps/BattleFrontier_BattlePyramidLobby/scripts.inc b/data/maps/BattleFrontier_BattlePyramidLobby/scripts.inc index 003582e1f..1860efd16 100644 --- a/data/maps/BattleFrontier_BattlePyramidLobby/scripts.inc +++ b/data/maps/BattleFrontier_BattlePyramidLobby/scripts.inc @@ -318,7 +318,7 @@ BattleFrontier_BattlePyramidLobby_EventScript_250B91:: @ 8250B91 BattleFrontier_BattlePyramidLobby_EventScript_250BA4:: @ 8250BA4 copyvar VAR_0x8004, VAR_RESULT - special sub_813B968 + special GetBattlePyramidHint switch VAR_RESULT case 0, BattleFrontier_BattlePyramidLobby_EventScript_250C8E case 1, BattleFrontier_BattlePyramidLobby_EventScript_250C97 diff --git a/data/maps/BattleFrontier_BattleTowerBattleRoom2/scripts.inc b/data/maps/BattleFrontier_BattleTowerBattleRoom2/scripts.inc index c2659b407..ecd7ac78a 100644 --- a/data/maps/BattleFrontier_BattleTowerBattleRoom2/scripts.inc +++ b/data/maps/BattleFrontier_BattleTowerBattleRoom2/scripts.inc @@ -25,7 +25,7 @@ BattleFrontier_BattleTowerBattleRoom2_EventScript_248F29:: @ 8248F29 return BattleFrontier_BattleTowerBattleRoom2_EventScript_248F2F:: @ 8248F2F - special sub_813A76C + special SetBattleTowerLinkPlayerGfx return BattleFrontier_BattleTowerBattleRoom2_MapScript2_248F33: @ 8248F33 diff --git a/data/maps/BattleFrontier_BattleTowerCorridor2/scripts.inc b/data/maps/BattleFrontier_BattleTowerCorridor2/scripts.inc index 5b4732ffb..6e3e05959 100644 --- a/data/maps/BattleFrontier_BattleTowerCorridor2/scripts.inc +++ b/data/maps/BattleFrontier_BattleTowerCorridor2/scripts.inc @@ -25,7 +25,7 @@ BattleFrontier_BattleTowerCorridor2_EventScript_248D8B:: @ 8248D8B return BattleFrontier_BattleTowerCorridor2_EventScript_248D91:: @ 8248D91 - special sub_813A76C + special SetBattleTowerLinkPlayerGfx return BattleFrontier_BattleTowerCorridor2_MapScript2_248D95: @ 8248D95 diff --git a/data/maps/BattleFrontier_BattleTowerElevator/scripts.inc b/data/maps/BattleFrontier_BattleTowerElevator/scripts.inc index 0e94d9154..f84ec194d 100644 --- a/data/maps/BattleFrontier_BattleTowerElevator/scripts.inc +++ b/data/maps/BattleFrontier_BattleTowerElevator/scripts.inc @@ -12,9 +12,9 @@ BattleFrontier_BattleTowerElevator_EventScript_2419F0:: @ 82419F0 applymovement 1, BattleFrontier_BattleTowerElevator_Movement_241A86 applymovement EVENT_OBJ_ID_PLAYER, BattleFrontier_BattleTowerElevator_Movement_241A8A waitmovement 0 - special sub_813A080 + special BufferBattleTowerElevatorFloors waitse - special ShakeScreenInElevator + special MoveElevator waitstate delay 48 applymovement 1, BattleFrontier_BattleTowerElevator_Movement_241A8E diff --git a/data/maps/BattleFrontier_Lounge1/scripts.inc b/data/maps/BattleFrontier_Lounge1/scripts.inc index 581cbd31e..dee3fd431 100644 --- a/data/maps/BattleFrontier_Lounge1/scripts.inc +++ b/data/maps/BattleFrontier_Lounge1/scripts.inc @@ -31,7 +31,7 @@ BattleFrontier_Lounge1_EventScript_25E7BF:: @ 825E7BF specialvar VAR_RESULT, ScriptGetPartyMonSpecies compare VAR_RESULT, SPECIES_EGG goto_if_eq BattleFrontier_Lounge1_EventScript_25E7FF - special sub_8139D98 + special BufferVarsForIVRater compare VAR_0x8005, 90 goto_if_le BattleFrontier_Lounge1_EventScript_25E87F compare VAR_0x8005, 120 diff --git a/data/maps/BattleFrontier_Lounge2/scripts.inc b/data/maps/BattleFrontier_Lounge2/scripts.inc index 435eb4127..bc4880dd3 100644 --- a/data/maps/BattleFrontier_Lounge2/scripts.inc +++ b/data/maps/BattleFrontier_Lounge2/scripts.inc @@ -40,7 +40,7 @@ BattleFrontier_Lounge2_EventScript_26066D:: @ 826066D call_if_le BattleFrontier_Lounge2_EventScript_2606F8 compare VAR_FRONTIER_MANIAC_FACILITY, 4 call_if_ge BattleFrontier_Lounge2_EventScript_260701 - special sub_8139F20 + special ShowFrontierManiacMessage waitmessage waitbuttonpress release diff --git a/data/maps/BattleFrontier_Lounge3/scripts.inc b/data/maps/BattleFrontier_Lounge3/scripts.inc index 7977e75b4..73da6194e 100644 --- a/data/maps/BattleFrontier_Lounge3/scripts.inc +++ b/data/maps/BattleFrontier_Lounge3/scripts.inc @@ -14,7 +14,7 @@ BattleFrontier_Lounge3_EventScript_261D83:: @ 8261D83 end BattleFrontier_Lounge3_EventScript_261DAF:: @ 8261DAF - special sub_813A820 + special ShowFrontierGamblerLookingMessage waitmessage waitbuttonpress msgbox BattleFrontier_Lounge3_Text_262A60, MSGBOX_YESNO @@ -25,7 +25,7 @@ BattleFrontier_Lounge3_EventScript_261DAF:: @ 8261DAF goto_if_eq BattleFrontier_Lounge3_EventScript_261FA5 message BattleFrontier_Lounge3_Text_262B42 waitmessage - special sub_813A958 + special ShowBattlePointsWindow goto BattleFrontier_Lounge3_EventScript_261DE9 end @@ -33,10 +33,10 @@ BattleFrontier_Lounge3_EventScript_261DE9:: @ 8261DE9 multichoice 20, 4, 87, 0 copyvar VAR_FRONTIER_GAMBLER_AMOUNT_BET, VAR_RESULT switch VAR_RESULT - case 0, BattleFrontier_Lounge3_EventScript_261E30 - case 1, BattleFrontier_Lounge3_EventScript_261E3B - case 2, BattleFrontier_Lounge3_EventScript_261E46 - case 3, BattleFrontier_Lounge3_EventScript_261FAF + case FRONTIER_GAMBLER_BET_5, BattleFrontier_Lounge3_EventScript_261E30 + case FRONTIER_GAMBLER_BET_10, BattleFrontier_Lounge3_EventScript_261E3B + case FRONTIER_GAMBLER_BET_15, BattleFrontier_Lounge3_EventScript_261E46 + case FRONTIER_GAMBLER_BET_CANCEL, BattleFrontier_Lounge3_EventScript_261FAF case 127, BattleFrontier_Lounge3_EventScript_261FAF end @@ -56,7 +56,7 @@ BattleFrontier_Lounge3_EventScript_261E46:: @ 8261E46 end BattleFrontier_Lounge3_EventScript_261E51:: @ 8261E51 - specialvar VAR_TEMP_1, sub_813AA04 + specialvar VAR_TEMP_1, GetFrontierBattlePoints compare VAR_TEMP_1, VAR_0x8008 goto_if_ge BattleFrontier_Lounge3_EventScript_261E75 msgbox BattleFrontier_Lounge3_Text_262B6E, MSGBOX_DEFAULT @@ -67,19 +67,19 @@ BattleFrontier_Lounge3_EventScript_261E51:: @ 8261E51 BattleFrontier_Lounge3_EventScript_261E75:: @ 8261E75 copyvar VAR_0x8004, VAR_0x8008 - special sub_813A9A4 - setvar VAR_FRONTIER_GAMBLER_PLACED_BET_F, 1 - special sub_813A8FC + special TakeFrontierBattlePoints + setvar VAR_FRONTIER_GAMBLER_STATE, FRONTIER_GAMBLER_PLACED_BET + special UpdateBattlePointsWindow playse SE_REGI msgbox BattleFrontier_Lounge3_Text_262BE0, MSGBOX_DEFAULT goto BattleFrontier_Lounge3_EventScript_261E96 end BattleFrontier_Lounge3_EventScript_261E96:: @ 8261E96 - special sub_813A854 + special ShowFrontierGamblerGoMessage waitmessage waitbuttonpress - special sub_813A988 + special CloseBattlePointsWindow release end @@ -105,37 +105,37 @@ BattleFrontier_Lounge3_EventScript_261EEB:: @ 8261EEB BattleFrontier_Lounge3_EventScript_261EF9:: @ 8261EF9 msgbox BattleFrontier_Lounge3_Text_26346B, MSGBOX_DEFAULT - compare VAR_FRONTIER_GAMBLER_PLACED_BET_F, 1 + compare VAR_FRONTIER_GAMBLER_STATE, FRONTIER_GAMBLER_PLACED_BET goto_if_ge BattleFrontier_Lounge3_EventScript_261F12 goto BattleFrontier_Lounge3_EventScript_261DAF end BattleFrontier_Lounge3_EventScript_261F12:: @ 8261F12 - compare VAR_FRONTIER_GAMBLER_PLACED_BET_F, 1 + compare VAR_FRONTIER_GAMBLER_STATE, FRONTIER_GAMBLER_PLACED_BET goto_if_eq BattleFrontier_Lounge3_EventScript_261F9E - compare VAR_FRONTIER_GAMBLER_PLACED_BET_F, 2 + compare VAR_FRONTIER_GAMBLER_STATE, FRONTIER_GAMBLER_WON goto_if_eq BattleFrontier_Lounge3_EventScript_261F2E goto BattleFrontier_Lounge3_EventScript_261F71 end BattleFrontier_Lounge3_EventScript_261F2E:: @ 8261F2E msgbox BattleFrontier_Lounge3_Text_263334, MSGBOX_DEFAULT - compare VAR_FRONTIER_GAMBLER_AMOUNT_BET, 0 + compare VAR_FRONTIER_GAMBLER_AMOUNT_BET, FRONTIER_GAMBLER_BET_5 call_if_eq BattleFrontier_Lounge3_EventScript_261F80 - compare VAR_FRONTIER_GAMBLER_AMOUNT_BET, 1 + compare VAR_FRONTIER_GAMBLER_AMOUNT_BET, FRONTIER_GAMBLER_BET_10 call_if_eq BattleFrontier_Lounge3_EventScript_261F8A - compare VAR_FRONTIER_GAMBLER_AMOUNT_BET, 2 + compare VAR_FRONTIER_GAMBLER_AMOUNT_BET, FRONTIER_GAMBLER_BET_15 call_if_eq BattleFrontier_Lounge3_EventScript_261F94 msgbox BattleFrontier_Lounge3_Text_2633D4, 9 - special sub_813A9D0 + special GiveFrontierBattlePoints msgbox BattleFrontier_Lounge3_Text_2633F2, MSGBOX_DEFAULT - setvar VAR_FRONTIER_GAMBLER_PLACED_BET_F, 0 + setvar VAR_FRONTIER_GAMBLER_STATE, FRONTIER_GAMBLER_WAITING release end BattleFrontier_Lounge3_EventScript_261F71:: @ 8261F71 msgbox BattleFrontier_Lounge3_Text_263298, MSGBOX_DEFAULT - setvar VAR_FRONTIER_GAMBLER_PLACED_BET_F, 0 + setvar VAR_FRONTIER_GAMBLER_STATE, FRONTIER_GAMBLER_WAITING release end @@ -155,7 +155,7 @@ BattleFrontier_Lounge3_EventScript_261F94:: @ 8261F94 return BattleFrontier_Lounge3_EventScript_261F9E:: @ 8261F9E - special sub_813A854 + special ShowFrontierGamblerGoMessage waitmessage waitbuttonpress release @@ -167,7 +167,7 @@ BattleFrontier_Lounge3_EventScript_261FA5:: @ 8261FA5 end BattleFrontier_Lounge3_EventScript_261FAF:: @ 8261FAF - special sub_813A988 + special CloseBattlePointsWindow goto BattleFrontier_Lounge3_EventScript_261FA5 end diff --git a/data/maps/BattleFrontier_Lounge5/map.json b/data/maps/BattleFrontier_Lounge5/map.json index 698569d9b..3847e6691 100644 --- a/data/maps/BattleFrontier_Lounge5/map.json +++ b/data/maps/BattleFrontier_Lounge5/map.json @@ -24,7 +24,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "BattleFrontier_Lounge5_EventScript_2645C6", + "script": "BattleFrontier_Lounge5_EventScript_NatureGirl", "flag": "0" }, { diff --git a/data/maps/BattleFrontier_Lounge5/scripts.inc b/data/maps/BattleFrontier_Lounge5/scripts.inc index d762612a9..020c8fdfb 100644 --- a/data/maps/BattleFrontier_Lounge5/scripts.inc +++ b/data/maps/BattleFrontier_Lounge5/scripts.inc @@ -1,34 +1,34 @@ BattleFrontier_Lounge5_MapScripts:: @ 82645C5 .byte 0 -BattleFrontier_Lounge5_EventScript_2645C6:: @ 82645C6 +BattleFrontier_Lounge5_EventScript_NatureGirl:: @ 82645C6 lock faceplayer - msgbox BattleFrontier_Lounge5_Text_264632, MSGBOX_YESNO + msgbox BattleFrontier_Lounge5_Text_NatureGirlGreeting, MSGBOX_YESNO compare VAR_RESULT, 0 - goto_if_eq BattleFrontier_Lounge5_EventScript_26460D + goto_if_eq BattleFrontier_Lounge5_EventScript_NatureGirlNoneShown special sub_81B94B0 waitstate lock faceplayer compare VAR_0x8004, 255 - goto_if_eq BattleFrontier_Lounge5_EventScript_26460D + goto_if_eq BattleFrontier_Lounge5_EventScript_NatureGirlNoneShown specialvar VAR_RESULT, ScriptGetPartyMonSpecies compare VAR_RESULT, SPECIES_EGG - goto_if_eq BattleFrontier_Lounge5_EventScript_264603 - special sub_813A7B8 + goto_if_eq BattleFrontier_Lounge5_EventScript_NatureGirlEgg + special ShowNatureGirlMessage waitmessage waitbuttonpress release end -BattleFrontier_Lounge5_EventScript_264603:: @ 8264603 - msgbox BattleFrontier_Lounge5_Text_264EEE, MSGBOX_DEFAULT +BattleFrontier_Lounge5_EventScript_NatureGirlEgg:: @ 8264603 + msgbox BattleFrontier_Lounge5_Text_NatureGirlEgg, MSGBOX_DEFAULT release end -BattleFrontier_Lounge5_EventScript_26460D:: @ 826460D - msgbox BattleFrontier_Lounge5_Text_26467F, MSGBOX_DEFAULT +BattleFrontier_Lounge5_EventScript_NatureGirlNoneShown:: @ 826460D + msgbox BattleFrontier_Lounge5_Text_NatureGirlNoneShown, MSGBOX_DEFAULT release end @@ -44,149 +44,149 @@ BattleFrontier_Lounge5_EventScript_264629:: @ 8264629 msgbox BattleFrontier_Lounge5_Text_264FAB, MSGBOX_NPC end -BattleFrontier_Lounge5_Text_264632:: @ 8264632 +BattleFrontier_Lounge5_Text_NatureGirlGreeting:: @ 8264632 .string "Ehehe!\n" .string "I can tell what POKéMON are thinking!\p" .string "Please!\n" .string "Can I see your POKéMON?$" -BattleFrontier_Lounge5_Text_26467F:: @ 826467F +BattleFrontier_Lounge5_Text_NatureGirlNoneShown:: @ 826467F .string "Boo!\n" .string "Cheapie!$" -BattleFrontier_Lounge5_Text_26468D:: @ 826468D +BattleFrontier_Lounge5_Text_NatureGirlHardy:: @ 826468D .string "Hmhm…\p" .string "This one says it likes to battle!\n" .string "It will battle even if it has a lot\l" .string "of ouchies!$" -BattleFrontier_Lounge5_Text_2646E5:: @ 82646E5 +BattleFrontier_Lounge5_Text_NatureGirlLonely:: @ 82646E5 .string "Hmhm…\p" .string "This one says it likes to be sneaky!\n" .string "But if it gets enough ouchies,\l" .string "it will hit back!$" -BattleFrontier_Lounge5_Text_264741:: @ 8264741 +BattleFrontier_Lounge5_Text_NatureGirlBrave:: @ 8264741 .string "Hmhm…\p" .string "This one says it likes to battle!\n" .string "But if it gets enough ouchies,\l" .string "it will worry about itself!$" -BattleFrontier_Lounge5_Text_2647A4:: @ 82647A4 +BattleFrontier_Lounge5_Text_NatureGirlAdamant:: @ 82647A4 .string "Hmhm…\p" .string "This one says it likes to battle!\n" .string "It will battle even if it has a lot\l" .string "of ouchies!$" -BattleFrontier_Lounge5_Text_2647FC:: @ 82647FC +BattleFrontier_Lounge5_Text_NatureGirlNaughty:: @ 82647FC .string "Hmhm…\p" .string "This one says it looks after itself!\n" .string "But if it gets enough ouchies,\l" .string "it will hit back!$" -BattleFrontier_Lounge5_Text_264858:: @ 8264858 +BattleFrontier_Lounge5_Text_NatureGirlBold:: @ 8264858 .string "Hmhm…\p" .string "This one says it likes to be sneaky!\n" .string "But if it gets enough ouchies,\l" .string "it will worry about itself!$" -BattleFrontier_Lounge5_Text_2648BE:: @ 82648BE +BattleFrontier_Lounge5_Text_NatureGirlDocileNaiveQuietQuirky:: @ 82648BE .string "Hmhm…\p" .string "This one says it likes to battle!\n" .string "It will battle even if it has a lot\l" .string "of ouchies!$" -BattleFrontier_Lounge5_Text_264916:: @ 8264916 +BattleFrontier_Lounge5_Text_NatureGirlRelaxed:: @ 8264916 .string "Hmhm…\p" .string "This one says it likes to be sneaky!\n" .string "But if it gets enough ouchies,\l" .string "it will hit back!$" -BattleFrontier_Lounge5_Text_264972:: @ 8264972 +BattleFrontier_Lounge5_Text_NatureGirlImpish:: @ 8264972 .string "Hmhm…\p" .string "This one says it likes to battle!\n" .string "But if it gets enough ouchies,\l" .string "it will worry about itself!$" -BattleFrontier_Lounge5_Text_2649D5:: @ 82649D5 +BattleFrontier_Lounge5_Text_NatureGirlLax:: @ 82649D5 .string "Hmhm…\p" .string "This one says it likes to be sneaky!\n" .string "It says it likes to be sneaky even\l" .string "if it has a lot of ouchies!$" -BattleFrontier_Lounge5_Text_264A3F:: @ 8264A3F +BattleFrontier_Lounge5_Text_NatureGirlTimid:: @ 8264A3F .string "Hmhm…\p" .string "This one says it likes to battle!\n" .string "But if it gets enough ouchies,\l" .string "it will turn sneaky!$" -BattleFrontier_Lounge5_Text_264A9B:: @ 8264A9B +BattleFrontier_Lounge5_Text_NatureGirlHasty:: @ 8264A9B .string "Hmhm…\p" .string "This one says it likes to battle!\n" .string "It will battle even if it has a lot\l" .string "of ouchies!$" -BattleFrontier_Lounge5_Text_264AF3:: @ 8264AF3 +BattleFrontier_Lounge5_Text_NatureGirlSerious:: @ 8264AF3 .string "Hmhm…\p" .string "This one says it likes to be sneaky!\n" .string "It says it likes to be sneaky even\l" .string "if it has a lot of ouchies!$" -BattleFrontier_Lounge5_Text_264B5D:: @ 8264B5D +BattleFrontier_Lounge5_Text_NatureGirlJolly:: @ 8264B5D .string "Hmhm…\p" .string "This one says it likes to be sneaky!\n" .string "But if it gets enough ouchies,\l" .string "it will worry about itself!$" -BattleFrontier_Lounge5_Text_264BC3:: @ 8264BC3 +BattleFrontier_Lounge5_Text_NatureGirlModest:: @ 8264BC3 .string "Hmhm…\p" .string "This one says it looks after itself!\n" .string "It says it worries about itself whether\l" .string "or not it has a lot of ouchies!$" -BattleFrontier_Lounge5_Text_264C36:: @ 8264C36 +BattleFrontier_Lounge5_Text_NatureGirlMild:: @ 8264C36 .string "Hmhm…\p" .string "This one says it looks after itself!\n" .string "But if it gets enough ouchies,\l" .string "it will turn sneaky!$" -BattleFrontier_Lounge5_Text_264C95:: @ 8264C95 +BattleFrontier_Lounge5_Text_NatureGirlBashful:: @ 8264C95 .string "Hmhm…\p" .string "This one says it looks after itself!\n" .string "It says it worries about itself even\l" .string "if it has a lot of ouchies!$" -BattleFrontier_Lounge5_Text_264D01:: @ 8264D01 +BattleFrontier_Lounge5_Text_NatureGirlRash:: @ 8264D01 .string "Hmhm…\p" .string "This one says it likes to be sneaky!\n" .string "It says it likes to be sneaky even\l" .string "if it has a lot of ouchies!$" -BattleFrontier_Lounge5_Text_264D6B:: @ 8264D6B +BattleFrontier_Lounge5_Text_NatureGirlCalm:: @ 8264D6B .string "Hmhm…\p" .string "This one says it looks after itself!\n" .string "It says it worries about itself even\l" .string "if it has a lot of ouchies!$" -BattleFrontier_Lounge5_Text_264DD7:: @ 8264DD7 +BattleFrontier_Lounge5_Text_NatureGirlGentle:: @ 8264DD7 .string "Hmhm…\p" .string "This one says it looks after itself!\n" .string "But if it gets enough ouchies,\l" .string "it will hit back!$" -BattleFrontier_Lounge5_Text_264E33:: @ 8264E33 +BattleFrontier_Lounge5_Text_NatureGirlSassy:: @ 8264E33 .string "Hmhm…\p" .string "This one says it likes to battle!\n" .string "But if it gets enough ouchies,\l" .string "it will turn sneaky!$" -BattleFrontier_Lounge5_Text_264E8F:: @ 8264E8F +BattleFrontier_Lounge5_Text_NatureGirlCareful:: @ 8264E8F .string "Hmhm…\p" .string "This one says it looks after itself!\n" .string "But if it gets enough ouchies,\l" .string "it will turn sneaky!$" -BattleFrontier_Lounge5_Text_264EEE:: @ 8264EEE +BattleFrontier_Lounge5_Text_NatureGirlEgg:: @ 8264EEE .string "That's silly! An EGG is asleep!\n" .string "I can't talk to it!$" diff --git a/data/maps/BattleFrontier_Lounge7/scripts.inc b/data/maps/BattleFrontier_Lounge7/scripts.inc index 1339b54c9..5b3f88dcf 100644 --- a/data/maps/BattleFrontier_Lounge7/scripts.inc +++ b/data/maps/BattleFrontier_Lounge7/scripts.inc @@ -19,11 +19,11 @@ BattleFrontier_Lounge7_EventScript_265276:: @ 8265276 BattleFrontier_Lounge7_EventScript_265284:: @ 8265284 message BattleFrontier_Lounge7_Text_2658EF waitmessage - special sub_813A958 + special ShowBattlePointsWindow setvar VAR_TEMP_E, 0 - setvar VAR_0x8004, 9 + setvar VAR_0x8004, SCROLL_MULTI_BF_MOVE_TUTOR_1 setvar VAR_0x8006, 0 - special sub_813A128 + special ShowScrollableMultichoice waitstate copyvar VAR_TEMP_D, VAR_RESULT switch VAR_RESULT @@ -45,9 +45,9 @@ BattleFrontier_Lounge7_EventScript_26532F:: @ 826532F message BattleFrontier_Lounge7_Text_2658EF waitmessage setvar VAR_TEMP_E, 0 - setvar VAR_0x8004, 9 + setvar VAR_0x8004, SCROLL_MULTI_BF_MOVE_TUTOR_1 setvar VAR_0x8006, 1 - special sub_813A128 + special ShowScrollableMultichoice waitstate copyvar VAR_TEMP_D, VAR_RESULT switch VAR_RESULT @@ -133,11 +133,11 @@ BattleFrontier_Lounge7_EventScript_265466:: @ 8265466 BattleFrontier_Lounge7_EventScript_265474:: @ 8265474 message BattleFrontier_Lounge7_Text_2658EF waitmessage - special sub_813A958 + special ShowBattlePointsWindow setvar VAR_TEMP_E, 1 - setvar VAR_0x8004, 10 + setvar VAR_0x8004, SCROLL_MULTI_BF_MOVE_TUTOR_2 setvar VAR_0x8006, 0 - special sub_813A128 + special ShowScrollableMultichoice waitstate copyvar VAR_TEMP_D, VAR_RESULT switch VAR_RESULT @@ -159,9 +159,9 @@ BattleFrontier_Lounge7_EventScript_26551F:: @ 826551F message BattleFrontier_Lounge7_Text_2658EF waitmessage setvar VAR_TEMP_E, 1 - setvar VAR_0x8004, 10 + setvar VAR_0x8004, SCROLL_MULTI_BF_MOVE_TUTOR_2 setvar VAR_0x8006, 1 - special sub_813A128 + special ShowScrollableMultichoice waitstate copyvar VAR_TEMP_D, VAR_RESULT switch VAR_RESULT @@ -230,8 +230,8 @@ BattleFrontier_Lounge7_EventScript_26562A:: @ 826562A end BattleFrontier_Lounge7_EventScript_265635:: @ 8265635 - special sub_813ADB8 - special sub_813A988 + special CloseBattleFrontierTutorWindow + special CloseBattlePointsWindow msgbox BattleFrontier_Lounge7_Text_265A0E, MSGBOX_DEFAULT release end @@ -241,16 +241,18 @@ BattleFrontier_Lounge7_EventScript_265645:: @ 8265645 release end +@ VAR_0x8004 here is used to determine which move name to buffer +@ VAR_0x8005 here is used to determine which move tutor was spoken to BattleFrontier_Lounge7_EventScript_26564F:: @ 826564F copyvar VAR_0x8004, VAR_TEMP_D copyvar VAR_0x8005, VAR_TEMP_E - special sub_813AC7C + special BufferBattleFrontierTutorMoveName buffernumberstring 1, VAR_0x8008 copyvar VAR_0x8004, VAR_TEMP_C msgbox BattleFrontier_Lounge7_Text_265921, MSGBOX_YESNO compare VAR_RESULT, 0 goto_if_eq BattleFrontier_Lounge7_EventScript_2656CA - specialvar VAR_TEMP_1, sub_813AA04 + specialvar VAR_TEMP_1, GetFrontierBattlePoints compare VAR_TEMP_1, VAR_0x8008 goto_if_ge BattleFrontier_Lounge7_EventScript_265696 msgbox BattleFrontier_Lounge7_Text_265997, MSGBOX_DEFAULT @@ -259,17 +261,17 @@ BattleFrontier_Lounge7_EventScript_26564F:: @ 826564F BattleFrontier_Lounge7_EventScript_265696:: @ 8265696 msgbox BattleFrontier_Lounge7_Text_26595A, MSGBOX_DEFAULT - special sub_813AEB4 + special GetBattleFrontierTutorMoveIndex fadescreen 1 - special sub_813A988 - special sub_813ADB8 + special CloseBattlePointsWindow + special CloseBattleFrontierTutorWindow special sub_81B892C waitstate compare VAR_RESULT, 0 goto_if_eq BattleFrontier_Lounge7_EventScript_265645 msgbox BattleFrontier_Lounge7_Text_2659C7, MSGBOX_DEFAULT copyvar VAR_0x8004, VAR_0x8008 - special sub_813A9A4 + special TakeFrontierBattlePoints release end diff --git a/data/maps/BattleFrontier_ReceptionGate/scripts.inc b/data/maps/BattleFrontier_ReceptionGate/scripts.inc index 5f0952cb0..f342655dc 100644 --- a/data/maps/BattleFrontier_ReceptionGate/scripts.inc +++ b/data/maps/BattleFrontier_ReceptionGate/scripts.inc @@ -136,8 +136,8 @@ BattleFrontier_ReceptionGate_EventScript_266310:: @ 8266310 BattleFrontier_ReceptionGate_EventScript_266320:: @ 8266320 message BattleFrontier_ReceptionGate_Text_26689D waitmessage - setvar VAR_0x8004, 8 - special sub_813A128 + setvar VAR_0x8004, SCROLL_MULTI_BF_RECEPTIONIST + special ShowScrollableMultichoice waitstate switch VAR_RESULT case 0, BattleFrontier_ReceptionGate_EventScript_2663AE diff --git a/data/maps/BattleFrontier_ScottsHouse/scripts.inc b/data/maps/BattleFrontier_ScottsHouse/scripts.inc index 6ff8fc146..b59adefcc 100644 --- a/data/maps/BattleFrontier_ScottsHouse/scripts.inc +++ b/data/maps/BattleFrontier_ScottsHouse/scripts.inc @@ -218,7 +218,7 @@ BattleFrontier_ScottsHouse_EventScript_2639E9:: @ 82639E9 end BattleFrontier_ScottsHouse_EventScript_2639F8:: @ 82639F8 - special sub_813A9D0 + special GiveFrontierBattlePoints msgbox BattleFrontier_ScottsHouse_Text_263CB0, 9 msgbox BattleFrontier_ScottsHouse_Text_263CD0, MSGBOX_DEFAULT setflag FLAG_SCOTT_GIVES_BATTLE_POINTS diff --git a/data/maps/LilycoveCity_DepartmentStoreElevator/scripts.inc b/data/maps/LilycoveCity_DepartmentStoreElevator/scripts.inc index 172fc3a25..70de434a8 100644 --- a/data/maps/LilycoveCity_DepartmentStoreElevator/scripts.inc +++ b/data/maps/LilycoveCity_DepartmentStoreElevator/scripts.inc @@ -7,11 +7,11 @@ LilycoveCity_DepartmentStoreElevator_EventScript_220624:: @ 8220624 setvar VAR_0x8004, 0 call_if_unset FLAG_TEMP_2, LilycoveCity_DepartmentStoreElevator_EventScript_2207FC copyvar VAR_0x8005, VAR_DEPT_STORE_FLOOR - special sub_8139B60 + special ShowDeptStoreElevatorFloorSelect message gText_WhichFloorWouldYouLike waitmessage setvar VAR_0x8004, 0 - specialvar VAR_RESULT, sub_81399F4 + specialvar VAR_RESULT, GetDeptStoreDefaultFloorChoice switch VAR_RESULT case 0, LilycoveCity_DepartmentStoreElevator_EventScript_220689 case 1, LilycoveCity_DepartmentStoreElevator_EventScript_220695 @@ -57,72 +57,72 @@ LilycoveCity_DepartmentStoreElevator_EventScript_2206C5:: @ 82206C5 end LilycoveCity_DepartmentStoreElevator_EventScript_220718:: @ 8220718 - setvar VAR_0x8006, 4 + setvar VAR_0x8006, DEPT_STORE_FLOORNUM_1F setdynamicwarp MAP_LILYCOVE_CITY_DEPARTMENT_STORE_1F, 255, 2, 1 - compare VAR_DEPT_STORE_FLOOR, 4 + compare VAR_DEPT_STORE_FLOOR, DEPT_STORE_FLOORNUM_1F goto_if_eq LilycoveCity_DepartmentStoreElevator_EventScript_2207E0 call LilycoveCity_DepartmentStoreElevator_EventScript_2207E5 - setvar VAR_DEPT_STORE_FLOOR, 4 + setvar VAR_DEPT_STORE_FLOOR, DEPT_STORE_FLOORNUM_1F goto LilycoveCity_DepartmentStoreElevator_EventScript_2207E0 end LilycoveCity_DepartmentStoreElevator_EventScript_220740:: @ 8220740 - setvar VAR_0x8006, 5 + setvar VAR_0x8006, DEPT_STORE_FLOORNUM_2F setdynamicwarp MAP_LILYCOVE_CITY_DEPARTMENT_STORE_2F, 255, 2, 1 - compare VAR_DEPT_STORE_FLOOR, 5 + compare VAR_DEPT_STORE_FLOOR, DEPT_STORE_FLOORNUM_2F goto_if_eq LilycoveCity_DepartmentStoreElevator_EventScript_2207E0 call LilycoveCity_DepartmentStoreElevator_EventScript_2207E5 - setvar VAR_DEPT_STORE_FLOOR, 5 + setvar VAR_DEPT_STORE_FLOOR, DEPT_STORE_FLOORNUM_2F goto LilycoveCity_DepartmentStoreElevator_EventScript_2207E0 end LilycoveCity_DepartmentStoreElevator_EventScript_220768:: @ 8220768 - setvar VAR_0x8006, 6 + setvar VAR_0x8006, DEPT_STORE_FLOORNUM_3F setdynamicwarp MAP_LILYCOVE_CITY_DEPARTMENT_STORE_3F, 255, 2, 1 - compare VAR_DEPT_STORE_FLOOR, 6 + compare VAR_DEPT_STORE_FLOOR, DEPT_STORE_FLOORNUM_3F goto_if_eq LilycoveCity_DepartmentStoreElevator_EventScript_2207E0 call LilycoveCity_DepartmentStoreElevator_EventScript_2207E5 - setvar VAR_DEPT_STORE_FLOOR, 6 + setvar VAR_DEPT_STORE_FLOOR, DEPT_STORE_FLOORNUM_3F goto LilycoveCity_DepartmentStoreElevator_EventScript_2207E0 end LilycoveCity_DepartmentStoreElevator_EventScript_220790:: @ 8220790 - setvar VAR_0x8006, 7 + setvar VAR_0x8006, DEPT_STORE_FLOORNUM_4F setdynamicwarp MAP_LILYCOVE_CITY_DEPARTMENT_STORE_4F, 255, 2, 1 - compare VAR_DEPT_STORE_FLOOR, 7 + compare VAR_DEPT_STORE_FLOOR, DEPT_STORE_FLOORNUM_4F goto_if_eq LilycoveCity_DepartmentStoreElevator_EventScript_2207E0 call LilycoveCity_DepartmentStoreElevator_EventScript_2207E5 - setvar VAR_DEPT_STORE_FLOOR, 7 + setvar VAR_DEPT_STORE_FLOOR, DEPT_STORE_FLOORNUM_4F goto LilycoveCity_DepartmentStoreElevator_EventScript_2207E0 end LilycoveCity_DepartmentStoreElevator_EventScript_2207B8:: @ 82207B8 - setvar VAR_0x8006, 8 + setvar VAR_0x8006, DEPT_STORE_FLOORNUM_5F setdynamicwarp MAP_LILYCOVE_CITY_DEPARTMENT_STORE_5F, 255, 2, 1 - compare VAR_DEPT_STORE_FLOOR, 8 + compare VAR_DEPT_STORE_FLOOR, DEPT_STORE_FLOORNUM_5F goto_if_eq LilycoveCity_DepartmentStoreElevator_EventScript_2207E0 call LilycoveCity_DepartmentStoreElevator_EventScript_2207E5 - setvar VAR_DEPT_STORE_FLOOR, 8 + setvar VAR_DEPT_STORE_FLOOR, DEPT_STORE_FLOORNUM_5F goto LilycoveCity_DepartmentStoreElevator_EventScript_2207E0 end LilycoveCity_DepartmentStoreElevator_EventScript_2207E0:: @ 82207E0 - special sub_8139C10 + special CloseDeptStoreElevatorWindow release end LilycoveCity_DepartmentStoreElevator_EventScript_2207E5:: @ 82207E5 - special sub_8139C10 + special CloseDeptStoreElevatorWindow closemessage applymovement VAR_LAST_TALKED, Common_Movement_WalkInPlaceDown waitmovement 0 waitse - special ShakeScreenInElevator + special MoveElevator waitstate setflag FLAG_TEMP_2 return LilycoveCity_DepartmentStoreElevator_EventScript_2207FC:: @ 82207FC - special SetDepartmentStoreFloorVar + special SetDeptStoreFloor return diff --git a/data/maps/LilycoveCity_PokemonTrainerFanClub/scripts.inc b/data/maps/LilycoveCity_PokemonTrainerFanClub/scripts.inc index 62fdd3427..948c447bf 100644 --- a/data/maps/LilycoveCity_PokemonTrainerFanClub/scripts.inc +++ b/data/maps/LilycoveCity_PokemonTrainerFanClub/scripts.inc @@ -558,8 +558,8 @@ LilycoveCity_PokemonTrainerFanClub_EventScript_21CE4D:: @ 821CE4D special BufferStreakTrainerText message LilycoveCity_PokemonTrainerFanClub_Text_281C95 waitmessage - setvar VAR_0x8004, 2 - special sub_813A128 + setvar VAR_0x8004, SCROLL_MULTI_POKEMON_FAN_CLUB_RATER + special ShowScrollableMultichoice waitstate setvar VAR_0x8004, 8 switch VAR_RESULT diff --git a/data/maps/MauvilleCity_GameCorner/scripts.inc b/data/maps/MauvilleCity_GameCorner/scripts.inc index a401841c2..03e3f6c70 100644 --- a/data/maps/MauvilleCity_GameCorner/scripts.inc +++ b/data/maps/MauvilleCity_GameCorner/scripts.inc @@ -288,7 +288,7 @@ MauvilleCity_GameCorner_EventScript_20FF77:: @ 820FF77 goto MauvilleCity_GameCorner_EventScript_20FF8A MauvilleCity_GameCorner_EventScript_20FF8A:: @ 820FF8A - special sub_81398C0 + special BufferTMHMMoveName msgbox MauvilleCity_GameCorner_Text_210629, MSGBOX_YESNO compare VAR_RESULT, 0 goto_if_eq MauvilleCity_GameCorner_EventScript_210118 diff --git a/data/maps/PetalburgCity_Gym/scripts.inc b/data/maps/PetalburgCity_Gym/scripts.inc index 09f93d132..6bc1426ae 100644 --- a/data/maps/PetalburgCity_Gym/scripts.inc +++ b/data/maps/PetalburgCity_Gym/scripts.inc @@ -418,7 +418,7 @@ PetalburgCity_Gym_EventScript_204E3B:: @ 8204E3B setflag FLAG_DEFEATED_PETALBURG_GYM setvar VAR_PETALBURG_GYM_STATE, 7 setflag FLAG_BADGE05_GET - special sub_813B9A0 + special ResetHealLocationFromDewford call PetalburgCity_Gym_EventScript_2721F8 setflag FLAG_HIDE_MAUVILLE_GYM_WATTSON clearflag FLAG_HIDE_MAUVILLE_CITY_WATTSON diff --git a/data/maps/Route113_GlassWorkshop/scripts.inc b/data/maps/Route113_GlassWorkshop/scripts.inc index 03f71d235..401a952ed 100644 --- a/data/maps/Route113_GlassWorkshop/scripts.inc +++ b/data/maps/Route113_GlassWorkshop/scripts.inc @@ -52,8 +52,8 @@ Route113_GlassWorkshop_EventScript_26ED9D:: @ 826ED9D Route113_GlassWorkshop_EventScript_26EDA7:: @ 826EDA7 setvar VAR_0x8009, 0 - setvar VAR_0x8004, 1 - special sub_813A128 + setvar VAR_0x8004, SCROLL_MULTI_GLASS_WORKSHOP_VENDOR + special ShowScrollableMultichoice waitstate switch VAR_RESULT case 0, Route113_GlassWorkshop_EventScript_26EE1E diff --git a/data/maps/SlateportCity/scripts.inc b/data/maps/SlateportCity/scripts.inc index 3c9d64015..1dab43fdf 100644 --- a/data/maps/SlateportCity/scripts.inc +++ b/data/maps/SlateportCity/scripts.inc @@ -748,8 +748,8 @@ SlateportCity_EventScript_1DD3C0:: @ 81DD3C0 SlateportCity_EventScript_1DD3CA:: @ 81DD3CA message SlateportCity_Text_1DEE67 waitmessage - setvar VAR_0x8004, 7 - special sub_813A128 + setvar VAR_0x8004, SCROLL_MULTI_BERRY_POWDER_VENDOR + special ShowScrollableMultichoice waitstate switch VAR_RESULT case 0, SlateportCity_EventScript_1DD46E diff --git a/data/maps/SootopolisCity/scripts.inc b/data/maps/SootopolisCity/scripts.inc index 668a18561..d481924a2 100644 --- a/data/maps/SootopolisCity/scripts.inc +++ b/data/maps/SootopolisCity/scripts.inc @@ -217,7 +217,7 @@ SootopolisCity_EventScript_1E5946:: @ 81E5946 setweather WEATHER_ALTERNATING doweather setvar VAR_0x8004, 0 - special sub_813B7D8 + special Script_DoRayquazaScene waitstate applymovement 10, Common_Movement_WalkInPlaceLeft applymovement 9, Common_Movement_WalkInPlaceRight @@ -317,7 +317,7 @@ SootopolisCity_EventScript_1E5A82:: @ 81E5A82 setweather WEATHER_ALTERNATING doweather setvar VAR_0x8004, 0 - special sub_813B7D8 + special Script_DoRayquazaScene waitstate applymovement 10, Common_Movement_WalkInPlaceLeft applymovement 9, Common_Movement_WalkInPlaceRight @@ -509,7 +509,7 @@ SootopolisCity_EventScript_1E5C1E:: @ 81E5C1E removeobject 10 addobject 11 setvar VAR_0x8004, 1 - special sub_813B7D8 + special Script_DoRayquazaScene waitstate playse SE_T_KAMI special SpawnCameraObject @@ -562,7 +562,7 @@ SootopolisCity_EventScript_1E5CCE:: @ 81E5CCE removeobject 10 addobject 11 setvar VAR_0x8004, 1 - special sub_813B7D8 + special Script_DoRayquazaScene waitstate special SpawnCameraObject applymovement EVENT_OBJ_ID_CAMERA, SootopolisCity_Movement_1E5E63 diff --git a/data/maps/TrainerHill_Elevator/scripts.inc b/data/maps/TrainerHill_Elevator/scripts.inc index ecc48a9e9..bf3d0f9f7 100644 --- a/data/maps/TrainerHill_Elevator/scripts.inc +++ b/data/maps/TrainerHill_Elevator/scripts.inc @@ -39,18 +39,20 @@ TrainerHill_Elevator_EventScript_269375:: @ 8269375 waitstate end +@ Unused TrainerHill_Elevator_EventScript_2693CE:: @ 82693CE goto TrainerHill_Elevator_EventScript_2693D4 end +@ Functionally unused TrainerHill_Elevator_EventScript_2693D4:: @ 82693D4 - special sub_8139C10 + special CloseDeptStoreElevatorWindow releaseall end TrainerHill_Elevator_EventScript_2693D9:: @ 82693D9 waitse - special ShakeScreenInElevator + special MoveElevator waitstate return diff --git a/data/maps/VerdanturfTown_BattleTentLobby/scripts.inc b/data/maps/VerdanturfTown_BattleTentLobby/scripts.inc index 15d0e5eb6..783d9ec85 100644 --- a/data/maps/VerdanturfTown_BattleTentLobby/scripts.inc +++ b/data/maps/VerdanturfTown_BattleTentLobby/scripts.inc @@ -332,8 +332,8 @@ VerdanturfTown_BattleTentLobby_EventScript_201B02:: @ 8201B02 VerdanturfTown_BattleTentLobby_EventScript_201B11:: @ 8201B11 message VerdanturfTown_BattleTentLobby_Text_24EF88 waitmessage - setvar VAR_0x8004, 12 - special sub_813A128 + setvar VAR_0x8004, SCROLL_MULTI_BATTLE_TENT_RULES + special ShowScrollableMultichoice waitstate switch VAR_RESULT case 0, VerdanturfTown_BattleTentLobby_EventScript_201B7E diff --git a/data/scripts/cable_club.inc b/data/scripts/cable_club.inc index 2fe90a4c9..e8d42f184 100644 --- a/data/scripts/cable_club.inc +++ b/data/scripts/cable_club.inc @@ -978,7 +978,7 @@ OldaleTown_PokemonCenter_2F_EventScript_27751B:: @ 827751B faceplayer setvar VAR_FRONTIER_FACILITY, 8 goto_if_unset FLAG_SYS_POKEDEX_GET, CableClub_EventScript_WirelessClubAdjustements - specialvar VAR_RESULT, sub_813990C + specialvar VAR_RESULT, IsBadEggInParty compare VAR_RESULT, 1 goto_if_eq OldaleTown_PokemonCenter_2F_EventScript_27731B copyvar VAR_0x8007, VAR_LAST_TALKED @@ -1086,7 +1086,7 @@ OldaleTown_PokemonCenter_2F_EventScript_2776A4:: @ 82776A4 faceplayer setvar VAR_FRONTIER_FACILITY, 9 goto_if_unset FLAG_SYS_POKEDEX_GET, CableClub_EventScript_WirelessClubAdjustements - specialvar VAR_RESULT, sub_813990C + specialvar VAR_RESULT, IsBadEggInParty compare VAR_RESULT, 1 goto_if_eq OldaleTown_PokemonCenter_2F_EventScript_27731B specialvar VAR_RESULT, IsWirelessAdapterConnected diff --git a/data/specials.inc b/data/specials.inc index cd6f128e1..fd5957356 100644 --- a/data/specials.inc +++ b/data/specials.inc @@ -227,7 +227,7 @@ gSpecials:: @ 81DBA64 def_special ShowPokedexRatingMessage def_special DoPCTurnOnEffect def_special DoPCTurnOffEffect - def_special SetDepartmentStoreFloorVar + def_special SetDeptStoreFloor def_special DoLotteryCornerComputerEffect def_special EndLotteryCornerComputerEffect def_special sub_81B951C @@ -284,8 +284,8 @@ gSpecials:: @ 81DBA64 def_special sub_80FB7A4 def_special DoSoftReset def_special GameClear - def_special ShakeScreenInElevator - def_special nullsub_55 + def_special MoveElevator + def_special ShowGlassWorkshopMenu def_special SpawnCameraObject def_special RemoveCameraObject def_special GetPokeblockNameByMonNature @@ -316,7 +316,7 @@ gSpecials:: @ 81DBA64 def_special CopyCurSecretBaseOwnerName_StrVar1 def_special ScriptCheckFreePokemonStorageSpace def_special DoSealedChamberShakingEffect1 - def_special sub_8139B60 + def_special ShowDeptStoreElevatorFloorSelect def_special GetShieldToyTVDecorationInfo def_special IsPokerusInParty def_special SetSootopolisGymCrackedIceMetatiles @@ -339,7 +339,7 @@ gSpecials:: @ 81DBA64 def_special ScriptGetMultiplayerId def_special ScriptGetPartyMonSpecies def_special sub_81B98DC - def_special nullsub_54 + def_special TryInitBattleTowerAwardManEventObject def_special MoveOutOfSecretBaseFromOutside def_special LoadPlayerBag def_special sub_80B05B4 @@ -356,7 +356,7 @@ gSpecials:: @ 81DBA64 def_special sub_80EE2CC def_special sub_80EE72C def_special sub_80EE7C0 - def_special nullsub_55 + def_special ShowGlassWorkshopMenu def_special PutFanClubSpecialOnTheAir def_special sub_80EED10 def_special sub_80EED34 @@ -422,7 +422,7 @@ gSpecials:: @ 81DBA64 def_special DoMirageTowerCeilingCrumble def_special SetMirageTowerVisibility def_special StartPlayerDescendMirageTower - def_special sub_81398C0 + def_special BufferTMHMMoveName def_special IsWirelessAdapterConnected def_special BerryBlenderLinkBecomeLeader def_special BerryBlenderLinkJoinGroup @@ -433,7 +433,7 @@ gSpecials:: @ 81DBA64 def_special sub_801DC20 def_special sub_81B8958 def_special sub_8018090 - def_special sub_813990C + def_special IsBadEggInParty def_special ValidateReceivedWonderCard def_special HasAtLeastOneBerry def_special sub_802C920 @@ -441,8 +441,8 @@ gSpecials:: @ 81DBA64 def_special sub_8027A5C def_special sub_8027AAC def_special sub_8139980 - def_special sub_81399F4 - def_special sub_8139D98 + def_special GetDeptStoreDefaultFloorChoice + def_special BufferVarsForIVRater def_special sub_80F905C def_special sub_800B518 def_special sub_80F90DC @@ -450,43 +450,43 @@ gSpecials:: @ 81DBA64 def_special sub_80F9160 def_special ShowRankingHallRecordsWindow def_special ScrollRankingHallRecordsWindow - def_special sub_8139F20 + def_special ShowFrontierManiacMessage def_special sub_80F9134 def_special sub_80F9154 def_special sub_80B3028 - def_special sub_813A128 + def_special ShowScrollableMultichoice def_special sub_813A630 - def_special sub_813A080 + def_special BufferBattleTowerElevatorFloors def_special sub_81C6A94 def_special sub_81C4F24 def_special sub_81B95E0 def_special sub_81B9620 - def_special sub_813A76C - def_special sub_813A7B8 - def_special sub_813A958 - def_special sub_813A8FC - def_special sub_813A988 - def_special sub_813A9D0 - def_special sub_813A9A4 - def_special sub_813AA04 - def_special sub_813AA18 - def_special sub_813AA44 + def_special SetBattleTowerLinkPlayerGfx + def_special ShowNatureGirlMessage + def_special ShowBattlePointsWindow + def_special UpdateBattlePointsWindow + def_special CloseBattlePointsWindow + def_special GiveFrontierBattlePoints + def_special TakeFrontierBattlePoints + def_special GetFrontierBattlePoints + def_special ShowFrontierExchangeCornerItemIconWindow + def_special CloseFrontierExchangeCornerItemIconWindow def_special DisplayBerryPowderVendorMenu def_special RemoveBerryPowderVendorMenu def_special HasEnoughBerryPowder def_special TakeBerryPowder def_special PrintPlayerBerryPowderAmount - def_special sub_813A820 - def_special sub_813A854 - def_special sub_813B7D8 + def_special ShowFrontierGamblerLookingMessage + def_special ShowFrontierGamblerGoMessage + def_special Script_DoRayquazaScene def_special sub_81C72A4 def_special sp106_CreateStartMenu def_special CountPlayerTrainerStars - def_special sub_813AC7C - def_special sub_813ADB8 + def_special BufferBattleFrontierTutorMoveName + def_special CloseBattleFrontierTutorWindow def_special sub_813ADD4 def_special sub_81B892C - def_special sub_813AEB4 + def_special GetBattleFrontierTutorMoveIndex def_special sub_813AF48 def_special DoDeoxysRockInteraction def_special sub_813B1D0 @@ -495,13 +495,13 @@ gSpecials:: @ 81DBA64 def_special StartMirageTowerShake def_special StartMirageTowerFossilFallAndSink def_special ChangeBoxPokemonNickname - def_special get_unknown_box_id - def_special sub_813B21C + def_special GetPCBoxToSendMon + def_special ShouldShowBoxWasFullMessage def_special SetMatchCallRegisteredFlag def_special sub_8175280 def_special CreateUnusualWeatherEvent def_special GetUnusualWeatherMapNameAndType - def_special sub_813B490 + def_special GetMartEmployeeObjectEventId def_special sub_80A08CC def_special Unused_SetWeatherSunny def_special sub_81AFDA0 @@ -516,7 +516,7 @@ gSpecials:: @ 81DBA64 def_special sub_813B568 def_special sub_813B534 def_special CallTrainerHillFunction - def_special sub_813B7D8 + def_special Script_DoRayquazaScene @ Listed twice def_special sub_813B80C def_special sub_81D4BEC def_special sub_80224D0 @@ -524,14 +524,14 @@ gSpecials:: @ 81DBA64 def_special DoWaldaNamingScreen def_special TryGetWallpaperWithWaldaPhrase def_special PlayerNotAtTrainerHillEntrance - def_special sub_813B968 + def_special GetBattlePyramidHint def_special sub_80F8B94 def_special ShowTrainerHillRecords def_special sub_80B4808 - def_special sub_813B9A0 + def_special ResetHealLocationFromDewford def_special sub_81B9918 def_special sub_80722E0 def_special TryPrepareSecondApproachingTrainer def_special RemoveRecordsWindow - def_special sub_8139C10 + def_special CloseDeptStoreElevatorWindow def_special sub_80B3BC4 diff --git a/include/constants/battle_frontier.h b/include/constants/battle_frontier.h index 1224c0f31..d287dd2db 100644 --- a/include/constants/battle_frontier.h +++ b/include/constants/battle_frontier.h @@ -1,6 +1,8 @@ #ifndef GUARD_CONSTANTS_BATTLE_FRONTIER_H #define GUARD_CONSTANTS_BATTLE_FRONTIER_H +#define FRONTIER_CHALLENGE(facility, mode) ((facility << 8) + mode) + // Battle Frontier facility ids. #define FRONTIER_FACILITY_TOWER 0 #define FRONTIER_FACILITY_DOME 1 @@ -41,6 +43,36 @@ #define SPECIAL_BATTLE_PIKE_DOUBLE 9 #define SPECIAL_BATTLE_PYRAMID 10 +#define MAX_BATTLE_FRONTIER_POINTS 9999 + +// Frontier Maniac +#define FRONTIER_MANIAC_BATTLE_TOWER_SINGLES 0 +#define FRONTIER_MANIAC_BATTLE_TOWER_DOUBLES 1 +#define FRONTIER_MANIAC_BATTLE_TOWER_MULTIS 2 +#define FRONTIER_MANIAC_BATTLE_TOWER_LINK_MULTIS 3 +#define FRONTIER_MANIAC_BATTLE_DOME 4 +#define FRONTIER_MANIAC_BATTLE_FACTORY 5 +#define FRONTIER_MANIAC_BATTLE_PALACE 6 +#define FRONTIER_MANIAC_BATTLE_ARENA 7 +#define FRONTIER_MANIAC_BATTLE_PIKE 8 +#define FRONTIER_MANIAC_BATTLE_PYRAMID 9 +#define FRONTIER_MANIAC_FACILITY_COUNT 10 + +#define FRONTIER_MANIAC_MESSAGE_COUNT 3 + +// Frontier Gambler +#define FRONTIER_GAMBLER_WAITING 0 +#define FRONTIER_GAMBLER_PLACED_BET 1 +#define FRONTIER_GAMBLER_WON 2 +#define FRONTIER_GAMBLER_LOST 3 + +#define FRONTIER_GAMBLER_BET_5 0 +#define FRONTIER_GAMBLER_BET_10 1 +#define FRONTIER_GAMBLER_BET_15 2 +#define FRONTIER_GAMBLER_BET_CANCEL 3 + +#define FRONTIER_GAMBLER_CHALLENGE_COUNT 12 + // For 'ShowFacilityResultsWindow' function which is a part of the 'CallFrontierUtilFunc' special. #define RESULTS_LINK_CONTEST 7 diff --git a/include/constants/field_specials.h b/include/constants/field_specials.h new file mode 100644 index 000000000..5ec38d1d4 --- /dev/null +++ b/include/constants/field_specials.h @@ -0,0 +1,52 @@ +#ifndef GUARD_CONSTANTS_FIELD_SPECIALS_H +#define GUARD_CONSTANTS_FIELD_SPECIALS_H + +// PC Locations +#define PC_LOCATION_OTHER 0 +#define PC_LOCATION_BRENDANS_HOUSE 1 +#define PC_LOCATION_MAYS_HOUSE 2 + +// SS Tidal Locations +#define SS_TIDAL_LOCATION_OTHER 0 +#define SS_TIDAL_LOCATION_SLATEPORT 1 +#define SS_TIDAL_LOCATION_LILYCOVE 2 +#define SS_TIDAL_LOCATION_ROUTE124 3 +#define SS_TIDAL_LOCATION_ROUTE131 4 + +// Scrollable Multichoice Menus +#define SCROLL_MULTI_NONE 0 +#define SCROLL_MULTI_GLASS_WORKSHOP_VENDOR 1 +#define SCROLL_MULTI_POKEMON_FAN_CLUB_RATER 2 +#define SCROLL_MULTI_BF_EXCHANGE_CORNER_DECOR_VENDOR_1 3 +#define SCROLL_MULTI_BF_EXCHANGE_CORNER_DECOR_VENDOR_2 4 +#define SCROLL_MULTI_BF_EXCHANGE_CORNER_VITAMIN_VENDOR 5 +#define SCROLL_MULTI_BF_EXCHANGE_CORNER_HOLD_ITEM_VENDOR 6 +#define SCROLL_MULTI_BERRY_POWDER_VENDOR 7 +#define SCROLL_MULTI_BF_RECEPTIONIST 8 +#define SCROLL_MULTI_BF_MOVE_TUTOR_1 9 +#define SCROLL_MULTI_BF_MOVE_TUTOR_2 10 +#define SCROLL_MULTI_SS_TIDAL_DESTINATION 11 +#define SCROLL_MULTI_BATTLE_TENT_RULES 12 + +#define MAX_SCROLL_MULTI_ON_SCREEN 6 +#define MAX_SCROLL_MULTI_LENGTH 16 + +// Dept Store Floor Numbers +#define DEPT_STORE_FLOORNUM_B4F 0 +#define DEPT_STORE_FLOORNUM_B3F 1 +#define DEPT_STORE_FLOORNUM_B2F 2 +#define DEPT_STORE_FLOORNUM_B1F 3 +#define DEPT_STORE_FLOORNUM_1F 4 +#define DEPT_STORE_FLOORNUM_2F 5 +#define DEPT_STORE_FLOORNUM_3F 6 +#define DEPT_STORE_FLOORNUM_4F 7 +#define DEPT_STORE_FLOORNUM_5F 8 +#define DEPT_STORE_FLOORNUM_6F 9 +#define DEPT_STORE_FLOORNUM_7F 10 +#define DEPT_STORE_FLOORNUM_8F 11 +#define DEPT_STORE_FLOORNUM_9F 12 +#define DEPT_STORE_FLOORNUM_10F 13 +#define DEPT_STORE_FLOORNUM_11F 14 +#define DEPT_STORE_FLOORNUM_ROOFTOP 15 + +#endif // GUARD_CONSTANTS_FIELD_SPECIALS_H diff --git a/include/constants/flags.h b/include/constants/flags.h index 3dbf38780..f8b4a273f 100644 --- a/include/constants/flags.h +++ b/include/constants/flags.h @@ -1400,7 +1400,7 @@ #define FLAG_ENABLE_SHIP_BIRTH_ISLAND (SYSTEM_FLAGS + 0x75) #define FLAG_ENABLE_SHIP_FARAWAY_ISLAND (SYSTEM_FLAGS + 0x76) -#define FLAG_SYS_STORAGE_UNKNOWN_FLAG (SYSTEM_FLAGS + 0x77) +#define FLAG_SHOWN_BOX_WAS_FULL_MESSAGE (SYSTEM_FLAGS + 0x77) #define FLAG_ARRIVED_ON_FARAWAY_ISLAND (SYSTEM_FLAGS + 0x78) #define FLAG_ARRIVED_AT_MARINE_CAVE_EMERGE_SPOT (SYSTEM_FLAGS + 0x79) diff --git a/include/constants/vars.h b/include/constants/vars.h index 6b213c8cc..72b15654e 100644 --- a/include/constants/vars.h +++ b/include/constants/vars.h @@ -61,14 +61,14 @@ #define VAR_0x402E 0x402E #define VAR_FRONTIER_MANIAC_FACILITY 0x402F -#define VAR_FRONTIER_GAMBLER_FACILITY 0x4030 -#define VAR_FRONTIER_GAMBLER_SET_FACILITY_F 0x4031 +#define VAR_FRONTIER_GAMBLER_CHALLENGE 0x4030 +#define VAR_FRONTIER_GAMBLER_SET_CHALLENGE 0x4031 #define VAR_FRONTIER_GAMBLER_AMOUNT_BET 0x4032 -#define VAR_FRONTIER_GAMBLER_PLACED_BET_F 0x4033 +#define VAR_FRONTIER_GAMBLER_STATE 0x4033 #define VAR_DEOXYS_ROCK_STEP_COUNT 0x4034 #define VAR_DEOXYS_ROCK_LEVEL 0x4035 -#define VAR_STORAGE_UNKNOWN 0x4036 +#define VAR_PC_BOX_TO_SEND_MON 0x4036 #define VAR_UNUSUAL_WEATHER_LOCATION 0x4037 #define VAR_UNUSUAL_WEATHER_STEP_COUNTER 0x4038 #define VAR_SHOULD_END_UNUSUAL_WEATHER 0x4039 diff --git a/include/field_specials.h b/include/field_specials.h index b1a50c811..952081e93 100644 --- a/include/field_specials.h +++ b/include/field_specials.h @@ -5,8 +5,8 @@ extern bool8 gBikeCyclingChallenge; extern u8 gBikeCollisions; u8 GetLeadMonIndex(void); -u8 sub_813B260(void); -u16 get_unknown_box_id(void); +u8 IsDestinationBoxFull(void); +u16 GetPCBoxToSendMon(void); bool8 InMultiBattleRoom(void); void sub_813BF10(void); void IncrementBirthIslandRockStepCount(void); @@ -19,17 +19,17 @@ bool32 ShouldDoRoxanneCall(void); bool32 ShouldDoRivalRayquazaCall(void); bool32 CountSSTidalStep(u16 delta); u8 GetSSTidalLocation(s8 *mapGroup, s8 *mapNum, s16 *x, s16 *y); -void sub_813A128(void); -void sub_813A878(u8 a0); +void ShowScrollableMultichoice(void); +void FrontierGamblerSetWonOrLost(bool8 won); u8 sub_813BADC(u8 a0); -bool8 sub_813B9C0(void); -void SetShoalItemFlag(u16 v0); -void UpdateFrontierManiac(u16 a0); -void UpdateFrontierGambler(u16 a0); +bool8 InPokemonCenter(void); +void SetShoalItemFlag(u16 unused); +void UpdateFrontierManiac(u16 daysSince); +void UpdateFrontierGambler(u16 daysSince); void ResetCyclingRoadChallengeData(void); -bool8 warp0_in_pokecenter(void); +bool8 UsedPokemonCenterWarp(void); void ResetFanClub(void); -bool8 sub_813B21C(void); -void set_unknown_box_id(u8 id); +bool8 ShouldShowBoxWasFullMessage(void); +void SetPCBoxToSendMon(u8 boxId); #endif // GUARD_FIELD_SPECIALS_H diff --git a/include/global.tv.h b/include/global.tv.h index abb01d471..1cef057ae 100644 --- a/include/global.tv.h +++ b/include/global.tv.h @@ -4,8 +4,7 @@ enum { TVSHOW_OFF_AIR, - - TVSHOW_FAN_CLUB_LETTER = 1, + TVSHOW_FAN_CLUB_LETTER, TVSHOW_RECENT_HAPPENINGS, TVSHOW_PKMN_FAN_CLUB_OPINIONS, TVSHOW_UNKN_SHOWTYPE_04, diff --git a/include/party_menu.h b/include/party_menu.h index c9843e484..d76e50788 100644 --- a/include/party_menu.h +++ b/include/party_menu.h @@ -26,6 +26,41 @@ enum PARTY_GIVE_ITEM, }; +enum +{ + TUTOR_MOVE_MEGA_PUNCH, + TUTOR_MOVE_SWORDS_DANCE, + TUTOR_MOVE_MEGA_KICK, + TUTOR_MOVE_BODY_SLAM, + TUTOR_MOVE_DOUBLE_EDGE, + TUTOR_MOVE_COUNTER, + TUTOR_MOVE_SEISMIC_TOSS, + TUTOR_MOVE_MIMIC, + TUTOR_MOVE_METRONOME, + TUTOR_MOVE_SOFT_BOILED, + TUTOR_MOVE_DREAM_EATER, + TUTOR_MOVE_THUNDER_WAVE, + TUTOR_MOVE_EXPLOSION, + TUTOR_MOVE_ROCK_SLIDE, + TUTOR_MOVE_SUBSTITUTE, + TUTOR_MOVE_DYNAMIC_PUNCH, + TUTOR_MOVE_ROLLOUT, + TUTOR_MOVE_PSYCH_UP, + TUTOR_MOVE_SNORE, + TUTOR_MOVE_ICY_WIND, + TUTOR_MOVE_ENDURE, + TUTOR_MOVE_MUD_SLAP, + TUTOR_MOVE_ICE_PUNCH, + TUTOR_MOVE_SWAGGER, + TUTOR_MOVE_SLEEP_TALK, + TUTOR_MOVE_SWIFT, + TUTOR_MOVE_DEFENSE_CURL, + TUTOR_MOVE_THUNDER_PUNCH, + TUTOR_MOVE_FIRE_PUNCH, + TUTOR_MOVE_FURY_CUTTER, + TUTOR_MOVE_COUNT +}; + struct Struct203CEC8 { MainCallback exitCallback; diff --git a/include/slot_machine.h b/include/slot_machine.h index d441b7411..1b22e165f 100644 --- a/include/slot_machine.h +++ b/include/slot_machine.h @@ -4,6 +4,7 @@ #define NUM_REELS 3 #define REEL_NUM_TAGS 21 #define REEL_TAG_HEIGHT 24 +#define SLOT_MACHINE_COUNT 12 // Lucky Flags #define LUCKY_BIAS_REPLAY (1 << 0) diff --git a/include/strings.h b/include/strings.h index e31a97761..a7c3106d3 100644 --- a/include/strings.h +++ b/include/strings.h @@ -758,31 +758,29 @@ extern const u8 BattleFrontier_Lounge2_Text_26174D[]; extern const u8 BattleFrontier_Lounge2_Text_2617F9[]; extern const u8 BattleFrontier_Lounge2_Text_2618C4[]; -extern const u8 BattleFrontier_Lounge5_Text_26468D[]; -extern const u8 BattleFrontier_Lounge5_Text_2646E5[]; -extern const u8 BattleFrontier_Lounge5_Text_264741[]; -extern const u8 BattleFrontier_Lounge5_Text_2647A4[]; -extern const u8 BattleFrontier_Lounge5_Text_2647FC[]; -extern const u8 BattleFrontier_Lounge5_Text_264858[]; -extern const u8 BattleFrontier_Lounge5_Text_2648BE[]; -extern const u8 BattleFrontier_Lounge5_Text_264916[]; -extern const u8 BattleFrontier_Lounge5_Text_264972[]; -extern const u8 BattleFrontier_Lounge5_Text_2649D5[]; -extern const u8 BattleFrontier_Lounge5_Text_264A3F[]; -extern const u8 BattleFrontier_Lounge5_Text_264A9B[]; -extern const u8 BattleFrontier_Lounge5_Text_264AF3[]; -extern const u8 BattleFrontier_Lounge5_Text_264B5D[]; -extern const u8 BattleFrontier_Lounge5_Text_2648BE[]; -extern const u8 BattleFrontier_Lounge5_Text_264BC3[]; -extern const u8 BattleFrontier_Lounge5_Text_264C36[]; -extern const u8 BattleFrontier_Lounge5_Text_2648BE[]; -extern const u8 BattleFrontier_Lounge5_Text_264C95[]; -extern const u8 BattleFrontier_Lounge5_Text_264D01[]; -extern const u8 BattleFrontier_Lounge5_Text_264D6B[]; -extern const u8 BattleFrontier_Lounge5_Text_264DD7[]; -extern const u8 BattleFrontier_Lounge5_Text_264E33[]; -extern const u8 BattleFrontier_Lounge5_Text_264E8F[]; -extern const u8 BattleFrontier_Lounge5_Text_2648BE[]; +// Battle Frontier Nature Girl +extern const u8 BattleFrontier_Lounge5_Text_NatureGirlHardy[]; +extern const u8 BattleFrontier_Lounge5_Text_NatureGirlLonely[]; +extern const u8 BattleFrontier_Lounge5_Text_NatureGirlBrave[]; +extern const u8 BattleFrontier_Lounge5_Text_NatureGirlAdamant[]; +extern const u8 BattleFrontier_Lounge5_Text_NatureGirlNaughty[]; +extern const u8 BattleFrontier_Lounge5_Text_NatureGirlBold[]; +extern const u8 BattleFrontier_Lounge5_Text_NatureGirlDocileNaiveQuietQuirky[]; +extern const u8 BattleFrontier_Lounge5_Text_NatureGirlRelaxed[]; +extern const u8 BattleFrontier_Lounge5_Text_NatureGirlImpish[]; +extern const u8 BattleFrontier_Lounge5_Text_NatureGirlLax[]; +extern const u8 BattleFrontier_Lounge5_Text_NatureGirlTimid[]; +extern const u8 BattleFrontier_Lounge5_Text_NatureGirlHasty[]; +extern const u8 BattleFrontier_Lounge5_Text_NatureGirlSerious[]; +extern const u8 BattleFrontier_Lounge5_Text_NatureGirlJolly[]; +extern const u8 BattleFrontier_Lounge5_Text_NatureGirlModest[]; +extern const u8 BattleFrontier_Lounge5_Text_NatureGirlMild[]; +extern const u8 BattleFrontier_Lounge5_Text_NatureGirlBashful[]; +extern const u8 BattleFrontier_Lounge5_Text_NatureGirlRash[]; +extern const u8 BattleFrontier_Lounge5_Text_NatureGirlCalm[]; +extern const u8 BattleFrontier_Lounge5_Text_NatureGirlGentle[]; +extern const u8 BattleFrontier_Lounge5_Text_NatureGirlSassy[]; +extern const u8 BattleFrontier_Lounge5_Text_NatureGirlCareful[]; extern const u8 BattleFrontier_Lounge3_Text_262261[]; extern const u8 BattleFrontier_Lounge3_Text_26230D[]; diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 6f1b43240..4002852b7 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -10227,17 +10227,17 @@ static void atkF0_givecaughtmon(void) { if (GiveMonToPlayer(&gEnemyParty[gBattlerPartyIndexes[gBattlerAttacker ^ BIT_SIDE]]) != MON_GIVEN_TO_PARTY) { - if (!sub_813B21C()) + if (!ShouldShowBoxWasFullMessage()) { gBattleCommunication[MULTISTRING_CHOOSER] = 0; - StringCopy(gStringVar1, GetBoxNamePtr(VarGet(VAR_STORAGE_UNKNOWN))); + StringCopy(gStringVar1, GetBoxNamePtr(VarGet(VAR_PC_BOX_TO_SEND_MON))); GetMonData(&gEnemyParty[gBattlerPartyIndexes[gBattlerAttacker ^ BIT_SIDE]], MON_DATA_NICKNAME, gStringVar2); } else { - StringCopy(gStringVar1, GetBoxNamePtr(VarGet(VAR_STORAGE_UNKNOWN))); + StringCopy(gStringVar1, GetBoxNamePtr(VarGet(VAR_PC_BOX_TO_SEND_MON))); // box the mon was sent to GetMonData(&gEnemyParty[gBattlerPartyIndexes[gBattlerAttacker ^ BIT_SIDE]], MON_DATA_NICKNAME, gStringVar2); - StringCopy(gStringVar3, GetBoxNamePtr(get_unknown_box_id())); + StringCopy(gStringVar3, GetBoxNamePtr(GetPCBoxToSendMon())); //box the mon was going to be sent to gBattleCommunication[MULTISTRING_CHOOSER] = 2; } diff --git a/src/clock.c b/src/clock.c index 1e7c5f83e..125d403bb 100644 --- a/src/clock.c +++ b/src/clock.c @@ -25,7 +25,7 @@ static void InitTimeBasedEvents(void) void DoTimeBasedEvents(void) { - if (FlagGet(FLAG_SYS_CLOCK_SET) && !sub_813B9C0()) + if (FlagGet(FLAG_SYS_CLOCK_SET) && !InPokemonCenter()) { RtcCalcLocalTime(); UpdatePerDay(&gLocalTime); diff --git a/src/data/battle_frontier/battle_frontier_exchange_corner.h b/src/data/battle_frontier/battle_frontier_exchange_corner.h new file mode 100644 index 000000000..bcb3cdd62 --- /dev/null +++ b/src/data/battle_frontier/battle_frontier_exchange_corner.h @@ -0,0 +1,99 @@ +static const u16 sFrontierExchangeCorner_Decor1[] = +{ + DECOR_KISS_POSTER, + DECOR_KISS_CUSHION, + DECOR_SMOOCHUM_DOLL, + DECOR_TOGEPI_DOLL, + DECOR_MEOWTH_DOLL, + DECOR_CLEFAIRY_DOLL, + DECOR_DITTO_DOLL, + DECOR_CYNDAQUIL_DOLL, + DECOR_CHIKORITA_DOLL, + DECOR_TOTODILE_DOLL, + 0xFFFF +}; + +static const u16 sFrontierExchangeCorner_Decor2[] = +{ + DECOR_LAPRAS_DOLL, + DECOR_SNORLAX_DOLL, + DECOR_VENUSAUR_DOLL, + DECOR_CHARIZARD_DOLL, + DECOR_BLASTOISE_DOLL, + 0xFFFF +}; + +static const u16 sFrontierExchangeCorner_Vitamins[] = +{ + ITEM_PROTEIN, + ITEM_CALCIUM, + ITEM_IRON, + ITEM_ZINC, + ITEM_CARBOS, + ITEM_HP_UP, + 0xFFFF +}; + +static const u16 sFrontierExchangeCorner_HoldItems[] = +{ + ITEM_LEFTOVERS, + ITEM_WHITE_HERB, + ITEM_QUICK_CLAW, + ITEM_MENTAL_HERB, + ITEM_BRIGHT_POWDER, + ITEM_CHOICE_BAND, + ITEM_KINGS_ROCK, + ITEM_FOCUS_BAND, + ITEM_SCOPE_LENS, + 0xFFFF +}; + +static const u8 *const sFrontierExchangeCorner_Decor1Descriptions[] = +{ + BattleFrontier_BattlePointExchangeServiceCorner_Text_2601AA, + BattleFrontier_BattlePointExchangeServiceCorner_Text_2601D0, + BattleFrontier_BattlePointExchangeServiceCorner_Text_260201, + BattleFrontier_BattlePointExchangeServiceCorner_Text_26022F, + BattleFrontier_BattlePointExchangeServiceCorner_Text_26025B, + BattleFrontier_BattlePointExchangeServiceCorner_Text_260287, + BattleFrontier_BattlePointExchangeServiceCorner_Text_2602B5, + BattleFrontier_BattlePointExchangeServiceCorner_Text_2602E0, + BattleFrontier_BattlePointExchangeServiceCorner_Text_26030F, + BattleFrontier_BattlePointExchangeServiceCorner_Text_26033E, + gText_Exit, +}; + +static const u8 *const sFrontierExchangeCorner_Decor2Descriptions[] = +{ + BattleFrontier_BattlePointExchangeServiceCorner_Text_26036C, + BattleFrontier_BattlePointExchangeServiceCorner_Text_26036C, + BattleFrontier_BattlePointExchangeServiceCorner_Text_26036C, + BattleFrontier_BattlePointExchangeServiceCorner_Text_26036C, + BattleFrontier_BattlePointExchangeServiceCorner_Text_26036C, + gText_Exit +}; + +static const u8 *const sFrontierExchangeCorner_VitaminsDescriptions[] = +{ + BattleFrontier_BattlePointExchangeServiceCorner_Text_260397, + BattleFrontier_BattlePointExchangeServiceCorner_Text_2603BE, + BattleFrontier_BattlePointExchangeServiceCorner_Text_2603E6, + BattleFrontier_BattlePointExchangeServiceCorner_Text_26040E, + BattleFrontier_BattlePointExchangeServiceCorner_Text_260436, + BattleFrontier_BattlePointExchangeServiceCorner_Text_26045C, + gText_Exit +}; + +static const u8 *const sFrontierExchangeCorner_HoldItemsDescriptions[] = +{ + BattleFrontier_BattlePointExchangeServiceCorner_Text_26047A, + BattleFrontier_BattlePointExchangeServiceCorner_Text_2604AC, + BattleFrontier_BattlePointExchangeServiceCorner_Text_2604D8, + BattleFrontier_BattlePointExchangeServiceCorner_Text_26050F, + BattleFrontier_BattlePointExchangeServiceCorner_Text_260542, + BattleFrontier_BattlePointExchangeServiceCorner_Text_260575, + BattleFrontier_BattlePointExchangeServiceCorner_Text_2605A8, + BattleFrontier_BattlePointExchangeServiceCorner_Text_2605E2, + BattleFrontier_BattlePointExchangeServiceCorner_Text_260613, + gText_Exit +}; diff --git a/src/data/pokemon/tutor_learnsets.h b/src/data/pokemon/tutor_learnsets.h index 0a930e993..2c8c3b362 100644 --- a/src/data/pokemon/tutor_learnsets.h +++ b/src/data/pokemon/tutor_learnsets.h @@ -1,35 +1,4 @@ -#define TUTOR_MOVE_MEGA_PUNCH 0 -#define TUTOR_MOVE_SWORDS_DANCE 1 -#define TUTOR_MOVE_MEGA_KICK 2 -#define TUTOR_MOVE_BODY_SLAM 3 -#define TUTOR_MOVE_DOUBLE_EDGE 4 -#define TUTOR_MOVE_COUNTER 5 -#define TUTOR_MOVE_SEISMIC_TOSS 6 -#define TUTOR_MOVE_MIMIC 7 -#define TUTOR_MOVE_METRONOME 8 -#define TUTOR_MOVE_SOFT_BOILED 9 -#define TUTOR_MOVE_DREAM_EATER 10 -#define TUTOR_MOVE_THUNDER_WAVE 11 -#define TUTOR_MOVE_EXPLOSION 12 -#define TUTOR_MOVE_ROCK_SLIDE 13 -#define TUTOR_MOVE_SUBSTITUTE 14 -#define TUTOR_MOVE_DYNAMIC_PUNCH 15 -#define TUTOR_MOVE_ROLLOUT 16 -#define TUTOR_MOVE_PSYCH_UP 17 -#define TUTOR_MOVE_SNORE 18 -#define TUTOR_MOVE_ICY_WIND 19 -#define TUTOR_MOVE_ENDURE 20 -#define TUTOR_MOVE_MUD_SLAP 21 -#define TUTOR_MOVE_ICE_PUNCH 22 -#define TUTOR_MOVE_SWAGGER 23 -#define TUTOR_MOVE_SLEEP_TALK 24 -#define TUTOR_MOVE_SWIFT 25 -#define TUTOR_MOVE_DEFENSE_CURL 26 -#define TUTOR_MOVE_THUNDER_PUNCH 27 -#define TUTOR_MOVE_FIRE_PUNCH 28 -#define TUTOR_MOVE_FURY_CUTTER 29 - -const u16 gTutorMoves[] = +const u16 gTutorMoves[TUTOR_MOVE_COUNT] = { [TUTOR_MOVE_MEGA_PUNCH] = MOVE_MEGA_PUNCH, [TUTOR_MOVE_SWORDS_DANCE] = MOVE_SWORDS_DANCE, diff --git a/src/field_specials.c b/src/field_specials.c index e56d8f52c..18e938ede 100644 --- a/src/field_specials.c +++ b/src/field_specials.c @@ -35,6 +35,7 @@ #include "rtc.h" #include "script.h" #include "script_menu.h" +#include "slot_machine.h" #include "sound.h" #include "starter_choose.h" #include "string_util.h" @@ -44,9 +45,14 @@ #include "tv.h" #include "wallclock.h" #include "window.h" +#include "constants/battle_frontier.h" +#include "constants/decorations.h" #include "constants/event_objects.h" +#include "constants/event_object_movement_constants.h" #include "constants/field_effects.h" +#include "constants/field_specials.h" #include "constants/items.h" +#include "constants/heal_locations.h" #include "constants/map_types.h" #include "constants/maps.h" #include "constants/songs.h" @@ -60,29 +66,28 @@ EWRAM_DATA bool8 gBikeCyclingChallenge = FALSE; EWRAM_DATA u8 gBikeCollisions = 0; -static EWRAM_DATA u32 gBikeCyclingTimer = 0; -static EWRAM_DATA u8 gUnknown_0203AB5C = 0; +static EWRAM_DATA u32 sBikeCyclingTimer = 0; +static EWRAM_DATA u8 sUnknown_0203AB5C = 0; static EWRAM_DATA u8 sPetalburgGymSlidingDoorFrameCounter = 0; -static EWRAM_DATA u8 gUnknown_0203AB5E = 0; -static EWRAM_DATA u16 gUnknown_0203AB60 = 0; -static EWRAM_DATA u16 gUnknown_0203AB62 = 0; -static EWRAM_DATA struct ListMenuItem *gUnknown_0203AB64 = NULL; -static EWRAM_DATA u16 gUnknown_0203AB68 = 0; -static EWRAM_DATA u16 gUnknown_0203AB6A = 0; -static EWRAM_DATA u8 gUnknown_0203AB6C = 0; -static EWRAM_DATA u8 gUnknown_0203AB6D = 0; -static EWRAM_DATA u8 gUnknown_0203AB6E = 0; -static EWRAM_DATA u8 gUnknown_0203AB6F = 0; -static EWRAM_DATA u32 gUnknown_0203AB70 = 0; - -struct ListMenuTemplate gUnknown_030061D0; +static EWRAM_DATA u8 sTutorMoveAndElevatorWindowId = 0; +static EWRAM_DATA u16 sLilycoveDeptStore_NeverRead = 0; +static EWRAM_DATA u16 sLilycoveDeptStore_DefaultFloorChoice = 0; +static EWRAM_DATA struct ListMenuItem *sScrollableMultichoice_ListMenuItem = NULL; +static EWRAM_DATA u16 sScrollableMultichoice_ScrollOffset = 0; +static EWRAM_DATA u16 sFrontierExchangeCorner_NeverRead = 0; +static EWRAM_DATA u8 sScrollableMultichoice_ItemSpriteId = 0; +static EWRAM_DATA u8 sBattlePointsWindowId = 0; +static EWRAM_DATA u8 sFrontierExchangeCorner_ItemIconWindowId = 0; +static EWRAM_DATA u8 sPCBoxToSendMon = 0; +static EWRAM_DATA u32 sUnknown_0203AB70 = 0; + +struct ListMenuTemplate gScrollableMultichoice_ListMenuTemplate; extern const u16 gEventObjectPalette8[]; extern const u16 gEventObjectPalette17[]; extern const u16 gEventObjectPalette33[]; extern const u16 gEventObjectPalette34[]; - void UpdateMovedLilycoveFanClubMembers(void); void sub_813BF60(void); u16 GetNumMovedLilycoveFanClubMembers(void); @@ -99,23 +104,23 @@ static void Task_LotteryCornerComputerEffect(u8); static void LotteryCornerComputerEffect(struct Task *); static void sub_81395BC(u8 taskId); static void sub_8139620(u8 taskId); -static void sub_8139AF4(u8 taskId); -static void sub_8139C2C(u16 a1, u8 a2); -static void MoveElevatorWindowLights(u8 taskId); -static void sub_813A2DC(u8 taskId); -static void sub_813AA60(u16 a0, u16 a1); -static void sub_813ACE8(u8 a0, u16 a1); -static void sub_813A42C(void); -static void sub_813A4EC(u8 taskId); -static void sub_813A694(u8 taskId); -static void sub_813A46C(s32 itemIndex, bool8 onInit, struct ListMenu *list); -static void sub_813AC44(u16 a0, u16 a1); -static void sub_813AD34(u8 a0, u16 a1); -static void sub_813A570(u8 taskId); -static void sub_813A738(u8 taskId); +static void Task_MoveElevator(u8 taskId); +static void MoveElevatorWindowLights(u16 floorDelta, bool8 descending); +static void Task_MoveElevatorWindowLights(u8 taskId); +static void Task_ShowScrollableMultichoice(u8 taskId); +static void FillFrontierExchangeCornerWindowAndItemIcon(u16 menu, u16 selection); +static void ShowBattleFrontierTutorWindow(u8 menu, u16 selection); +static void InitScrollableMultichoice(void); +static void ScrollableMultichoice_ProcessInput(u8 taskId); +static void ScrollableMultichoice_UpdateScrollArrows(u8 taskId); +static void ScrollableMultichoice_MoveCursor(s32 itemIndex, bool8 onInit, struct ListMenu *list); +static void HideFrontierExchangeCornerItemIcon(u16 menu, u16 unused); +static void ShowBattleFrontierTutorMoveDescription(u8 menu, u16 selection); +static void CloseScrollableMultichoice(u8 taskId); +static void ScrollableMultichoice_RemoveScrollArrows(u8 taskId); static void sub_813A600(u8 taskId); static void sub_813A664(u8 taskId); -static void sub_813ABD4(u16 a0); +static void ShowFrontierExchangeCornerItemIcon(u16 item); static void Task_DeoxysRockInteraction(u8 taskId); static void ChangeDeoxysRockLevel(u8 a0); static void WaitForDeoxysRockMovement(u8 taskId); @@ -144,14 +149,14 @@ void ResetCyclingRoadChallengeData(void) { gBikeCyclingChallenge = FALSE; gBikeCollisions = 0; - gBikeCyclingTimer = 0; + sBikeCyclingTimer = 0; } void Special_BeginCyclingRoadChallenge(void) { gBikeCyclingChallenge = TRUE; gBikeCollisions = 0; - gBikeCyclingTimer = gMain.vblankCounter1; + sBikeCyclingTimer = gMain.vblankCounter1; } u16 GetPlayerAvatarBike(void) @@ -237,7 +242,7 @@ static void DetermineCyclingRoadResults(u32 numFrames, u8 numBikeCollisions) } void FinishCyclingRoadChallenge(void) { - const u32 numFrames = gMain.vblankCounter1 - gBikeCyclingTimer; + const u32 numFrames = gMain.vblankCounter1 - sBikeCyclingTimer; DetermineCyclingRoadResults(numFrames, gBikeCollisions); RecordCyclingRoadResults(numFrames, gBikeCollisions); @@ -310,16 +315,16 @@ u8 GetSSTidalLocation(s8 *mapGroup, s8 *mapNum, s16 *x, s16 *y) { case 1: case 8: - return 1; + return SS_TIDAL_LOCATION_SLATEPORT; case 3: case 9: - return 4; + return SS_TIDAL_LOCATION_ROUTE131; case 4: case 5: - return 2; + return SS_TIDAL_LOCATION_LILYCOVE; case 6: case 10: - return 3; + return SS_TIDAL_LOCATION_ROUTE124; case 2: if (*varCruiseStepCount < 60) { @@ -356,7 +361,7 @@ u8 GetSSTidalLocation(s8 *mapGroup, s8 *mapNum, s16 *x, s16 *y) } *mapGroup = MAP_GROUP(ROUTE132); *y = 20; - return 0; + return SS_TIDAL_LOCATION_OTHER; } bool32 ShouldDoWallyCall(void) @@ -419,10 +424,10 @@ bool32 ShouldDoScottCall(void) { switch (gMapHeader.mapType) { - case 1: - case 2: - case 3: - case 6: + case MAP_TYPE_TOWN: + case MAP_TYPE_CITY: + case MAP_TYPE_ROUTE: + case MAP_TYPE_OCEAN_ROUTE: if (++(*GetVarPointer(VAR_SCOTT_CALL_STEP_COUNTER)) < 10) { return FALSE; @@ -446,10 +451,10 @@ bool32 ShouldDoRoxanneCall(void) { switch (gMapHeader.mapType) { - case 1: - case 2: - case 3: - case 6: + case MAP_TYPE_TOWN: + case MAP_TYPE_CITY: + case MAP_TYPE_ROUTE: + case MAP_TYPE_OCEAN_ROUTE: if (++(*GetVarPointer(VAR_ROXANNE_CALL_STEP_COUNTER)) < 250) { return FALSE; @@ -473,10 +478,10 @@ bool32 ShouldDoRivalRayquazaCall(void) { switch (gMapHeader.mapType) { - case 1: - case 2: - case 3: - case 6: + case MAP_TYPE_TOWN: + case MAP_TYPE_CITY: + case MAP_TYPE_ROUTE: + case MAP_TYPE_OCEAN_ROUTE: if (++(*GetVarPointer(VAR_RIVAL_RAYQUAZA_CALL_STEP_COUNTER)) < 250) { return FALSE; @@ -516,8 +521,13 @@ void SpawnLinkPartnerEventObject(void) u8 j = 0; s16 x = 0; s16 y = 0; - u8 gUnknown_085B2B5C[] = {7, 9, 8, 10}; - s8 gUnknown_085B2B60[][2] = { + u8 movementTypes[] = { + MOVEMENT_TYPE_FACE_UP, + MOVEMENT_TYPE_FACE_LEFT, + MOVEMENT_TYPE_FACE_DOWN, + MOVEMENT_TYPE_FACE_RIGHT + }; + s8 coordOffsets[][2] = { { 0, 1}, { 1, 0}, { 0, -1}, @@ -577,10 +587,10 @@ void SpawnLinkPartnerEventObject(void) linkSpriteId = EVENT_OBJ_GFX_RIVAL_MAY_NORMAL; break; } - SpawnSpecialEventObjectParameterized(linkSpriteId, gUnknown_085B2B5C[j], 0xf0 - i, gUnknown_085B2B60[j][0] + x + 7, gUnknown_085B2B60[j][1] + y + 7, 0); - LoadLinkPartnerEventObjectSpritePalette(linkSpriteId, 0xf0 - i, i); + SpawnSpecialEventObjectParameterized(linkSpriteId, movementTypes[j], 240 - i, coordOffsets[j][0] + x + 7, coordOffsets[j][1] + y + 7, 0); + LoadLinkPartnerEventObjectSpritePalette(linkSpriteId, 240 - i, i); j++; - if (j == 4) + if (j == MAX_LINK_PLAYERS) { j = 0; } @@ -624,7 +634,8 @@ static void LoadLinkPartnerEventObjectSpritePalette(u8 graphicsId, u8 localEvent } } -static const struct UCoords8 sMauvilleGymSwitchCoords[] = { +static const struct UCoords8 sMauvilleGymSwitchCoords[] = +{ { 7, 22}, {11, 19}, {10, 16}, @@ -814,7 +825,7 @@ static const u16 sPetalburgGymSlidingDoorMetatiles[] = { void PetalburgGymSpecial1(void) { - gUnknown_0203AB5C = 0; + sUnknown_0203AB5C = 0; sPetalburgGymSlidingDoorFrameCounter = 0; PlaySE(SE_KI_GASYAN); CreateTask(Task_PetalburgGym, 8); @@ -822,10 +833,10 @@ void PetalburgGymSpecial1(void) static void Task_PetalburgGym(u8 taskId) { - if (gUnknown_085B2B78[sPetalburgGymSlidingDoorFrameCounter] == gUnknown_0203AB5C) + if (gUnknown_085B2B78[sPetalburgGymSlidingDoorFrameCounter] == sUnknown_0203AB5C) { PetalburgGymFunc(gSpecialVar_0x8004, sPetalburgGymSlidingDoorMetatiles[sPetalburgGymSlidingDoorFrameCounter]); - gUnknown_0203AB5C = 0; + sUnknown_0203AB5C = 0; if ((++sPetalburgGymSlidingDoorFrameCounter) == ARRAY_COUNT(sPetalburgGymSlidingDoorMetatiles)) { DestroyTask(taskId); @@ -834,7 +845,7 @@ static void Task_PetalburgGym(u8 taskId) } else { - gUnknown_0203AB5C++; + sUnknown_0203AB5C++; } } @@ -1077,36 +1088,35 @@ static void PCTurnOnEffect_0(struct Task *task) task->data[3]++; } -// enum pc location, -static void PCTurnOnEffect_1(s16 flag, s8 dx, s8 dy) +static void PCTurnOnEffect_1(s16 isPcTurnedOn, s8 dx, s8 dy) { u16 tileId = 0; - if (flag != 0) + if (isPcTurnedOn) { - if (gSpecialVar_0x8004 == 0) + if (gSpecialVar_0x8004 == PC_LOCATION_OTHER) { tileId = METATILE_ID(Building, PC_Off); } - else if (gSpecialVar_0x8004 == 1) + else if (gSpecialVar_0x8004 == PC_LOCATION_BRENDANS_HOUSE) { tileId = METATILE_ID(BrendansMaysHouse, BrendanPC_Off); } - else if (gSpecialVar_0x8004 == 2) + else if (gSpecialVar_0x8004 == PC_LOCATION_MAYS_HOUSE) { tileId = METATILE_ID(BrendansMaysHouse, MayPC_Off); } } else { - if (gSpecialVar_0x8004 == 0) + if (gSpecialVar_0x8004 == PC_LOCATION_OTHER) { tileId = METATILE_ID(Building, PC_On); } - else if (gSpecialVar_0x8004 == 1) + else if (gSpecialVar_0x8004 == PC_LOCATION_BRENDANS_HOUSE) { tileId = METATILE_ID(BrendansMaysHouse, BrendanPC_On); } - else if (gSpecialVar_0x8004 == 2) + else if (gSpecialVar_0x8004 == PC_LOCATION_MAYS_HOUSE) { tileId = METATILE_ID(BrendansMaysHouse, MayPC_On); } @@ -1294,7 +1304,7 @@ void IsGrassTypeInParty(void) void SpawnCameraObject(void) { - u8 obj = SpawnSpecialEventObjectParameterized(EVENT_OBJ_GFX_BOY_1, 8, EVENT_OBJ_ID_CAMERA, gSaveBlock1Ptr->pos.x + 7, gSaveBlock1Ptr->pos.y + 7, 3); + u8 obj = SpawnSpecialEventObjectParameterized(EVENT_OBJ_GFX_BOY_1, MOVEMENT_TYPE_FACE_DOWN, EVENT_OBJ_ID_CAMERA, gSaveBlock1Ptr->pos.x + 7, gSaveBlock1Ptr->pos.y + 7, 3); gEventObjects[obj].invisible = TRUE; CameraObjectSetFollowedObjectId(gEventObjects[obj].spriteId); } @@ -1327,16 +1337,16 @@ void BufferEReaderTrainerName(void) u16 GetSlotMachineId(void) { - static const u8 gUnknown_085B2B88[] = {12, 2, 4, 5, 1, 8, 7, 11, 3, 10, 9, 6}; - static const u8 gUnknown_085B2B94[] = {0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5}; - static const u8 gUnknown_085B2BA0[] = {3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5}; + static const u8 sSlotMachineRandomSeeds[] = {12, 2, 4, 5, 1, 8, 7, 11, 3, 10, 9, 6}; + static const u8 sSlotMachineIds[] = {0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5}; + static const u8 sSlotMachineServiceDayIds[] = {3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5}; - u32 v0 = gSaveBlock1Ptr->easyChatPairs[0].unk0_0 + gSaveBlock1Ptr->easyChatPairs[0].unk2 + gUnknown_085B2B88[gSpecialVar_0x8004]; - if (GetPriceReduction(2)) + u32 rnd = gSaveBlock1Ptr->easyChatPairs[0].unk0_0 + gSaveBlock1Ptr->easyChatPairs[0].unk2 + sSlotMachineRandomSeeds[gSpecialVar_0x8004]; + if (GetPriceReduction(POKENEWS_GAME_CORNER)) { - return gUnknown_085B2BA0[v0 % 12]; + return sSlotMachineServiceDayIds[rnd % SLOT_MACHINE_COUNT]; } - return gUnknown_085B2B94[v0 % 12]; + return sSlotMachineIds[rnd % SLOT_MACHINE_COUNT]; } bool8 FoundAbandonedShipRoom1Key(void) @@ -1434,7 +1444,7 @@ u8 TryUpdateRusturfTunnelState(void) return FALSE; } -void SetShoalItemFlag(u16 v0) +void SetShoalItemFlag(u16 unused) { FlagSet(FLAG_SYS_SHOAL_ITEM); } @@ -1442,7 +1452,7 @@ void SetShoalItemFlag(u16 v0) void PutZigzagoonInPlayerParty(void) { u16 monData; - CreateMon(&gPlayerParty[0], SPECIES_ZIGZAGOON, 7, 0x20, FALSE, 0, OT_ID_PLAYER_ID, 0); + CreateMon(&gPlayerParty[0], SPECIES_ZIGZAGOON, 7, 32, FALSE, 0, OT_ID_PLAYER_ID, 0); monData = TRUE; SetMonData(&gPlayerParty[0], MON_DATA_ABILITY_NUM, &monData); monData = MOVE_TACKLE; @@ -1529,7 +1539,7 @@ void SetRoute119Weather(void) { if (IsMapTypeOutdoors(GetLastUsedWarpMapType()) != TRUE) { - SetSav1Weather(20); + SetSav1Weather(WEATHER_ROUTE119_CYCLE); } } @@ -1537,7 +1547,7 @@ void SetRoute123Weather(void) { if (IsMapTypeOutdoors(GetLastUsedWarpMapType()) != TRUE) { - SetSav1Weather(21); + SetSav1Weather(WEATHER_ROUTE123_CYCLE); } } @@ -1560,9 +1570,10 @@ u16 ScriptGetPartyMonSpecies(void) return GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_SPECIES2, NULL); } -void nullsub_54(void) +// Removed for Emerald +void TryInitBattleTowerAwardManEventObject(void) { - + //TryInitLocalEventObject(6); } u16 GetDaysUntilPacifidlogTMAvailable(void) @@ -1653,7 +1664,7 @@ u16 sub_813986C(void) } } -bool8 sub_81398C0(void) +bool8 BufferTMHMMoveName(void) { if (gSpecialVar_0x8004 >= ITEM_TM01 && gSpecialVar_0x8004 <= ITEM_HM08) { @@ -1664,14 +1675,14 @@ bool8 sub_81398C0(void) return FALSE; } -bool8 sub_813990C(void) +bool8 IsBadEggInParty(void) { u8 partyCount = CalculatePlayerPartyCount(); u8 i; for (i = 0; i < partyCount; i++) { - if (GetMonData(&gPlayerParty[i], MON_DATA_SANITY_IS_BAD_EGG) == 1) + if (GetMonData(&gPlayerParty[i], MON_DATA_SANITY_IS_BAD_EGG) == TRUE) return TRUE; } @@ -1693,7 +1704,8 @@ void sub_8139980(void) SetCameraPanning(8, 0); } -const struct WindowTemplate gUnknown_085B2BAC = { +const struct WindowTemplate gElevatorFloor_WindowTemplate = +{ .bg = 0, .tilemapLeft = 21, .tilemapTop = 1, @@ -1703,23 +1715,24 @@ const struct WindowTemplate gUnknown_085B2BAC = { .baseBlock = 8, }; -const u8 *const gElevatorFloorsTable[] = { - gText_B4F, - gText_B3F, - gText_B2F, - gText_B1F, - gText_1F, - gText_2F, - gText_3F, - gText_4F, - gText_5F, - gText_6F, - gText_7F, - gText_8F, - gText_9F, - gText_10F, - gText_11F, - gText_Rooftop +const u8 *const gDeptStoreFloorNames[] = +{ + [DEPT_STORE_FLOORNUM_B4F] = gText_B4F, + [DEPT_STORE_FLOORNUM_B3F] = gText_B3F, + [DEPT_STORE_FLOORNUM_B2F] = gText_B2F, + [DEPT_STORE_FLOORNUM_B1F] = gText_B1F, + [DEPT_STORE_FLOORNUM_1F] = gText_1F, + [DEPT_STORE_FLOORNUM_2F] = gText_2F, + [DEPT_STORE_FLOORNUM_3F] = gText_3F, + [DEPT_STORE_FLOORNUM_4F] = gText_4F, + [DEPT_STORE_FLOORNUM_5F] = gText_5F, + [DEPT_STORE_FLOORNUM_6F] = gText_6F, + [DEPT_STORE_FLOORNUM_7F] = gText_7F, + [DEPT_STORE_FLOORNUM_8F] = gText_8F, + [DEPT_STORE_FLOORNUM_9F] = gText_9F, + [DEPT_STORE_FLOORNUM_10F] = gText_10F, + [DEPT_STORE_FLOORNUM_11F] = gText_11F, + [DEPT_STORE_FLOORNUM_ROOFTOP] = gText_Rooftop }; static const u16 sElevatorWindowTiles_Ascending[][3] = @@ -1760,104 +1773,105 @@ static const u16 sElevatorWindowTiles_Descending[][3] = }, }; -void SetDepartmentStoreFloorVar(void) +void SetDeptStoreFloor(void) { u8 deptStoreFloor; switch (gSaveBlock1Ptr->dynamicWarp.mapNum) { case MAP_NUM(LILYCOVE_CITY_DEPARTMENT_STORE_1F): - deptStoreFloor = 4; + deptStoreFloor = DEPT_STORE_FLOORNUM_1F; break; case MAP_NUM(LILYCOVE_CITY_DEPARTMENT_STORE_2F): - deptStoreFloor = 5; + deptStoreFloor = DEPT_STORE_FLOORNUM_2F; break; case MAP_NUM(LILYCOVE_CITY_DEPARTMENT_STORE_3F): - deptStoreFloor = 6; + deptStoreFloor = DEPT_STORE_FLOORNUM_3F; break; case MAP_NUM(LILYCOVE_CITY_DEPARTMENT_STORE_4F): - deptStoreFloor = 7; + deptStoreFloor = DEPT_STORE_FLOORNUM_4F; break; case MAP_NUM(LILYCOVE_CITY_DEPARTMENT_STORE_5F): - deptStoreFloor = 8; + deptStoreFloor = DEPT_STORE_FLOORNUM_5F; break; case MAP_NUM(LILYCOVE_CITY_DEPARTMENT_STORE_ROOFTOP): - deptStoreFloor = 15; + deptStoreFloor = DEPT_STORE_FLOORNUM_ROOFTOP; break; default: - deptStoreFloor = 4; + deptStoreFloor = DEPT_STORE_FLOORNUM_1F; break; } VarSet(VAR_DEPT_STORE_FLOOR, deptStoreFloor); } -u16 sub_81399F4(void) +u16 GetDeptStoreDefaultFloorChoice(void) { - gUnknown_0203AB60 = 0; - gUnknown_0203AB62 = 0; + sLilycoveDeptStore_NeverRead = 0; + sLilycoveDeptStore_DefaultFloorChoice = 0; if (gSaveBlock1Ptr->dynamicWarp.mapGroup == MAP_GROUP(LILYCOVE_CITY_DEPARTMENT_STORE_1F)) { switch (gSaveBlock1Ptr->dynamicWarp.mapNum) { case MAP_NUM(LILYCOVE_CITY_DEPARTMENT_STORE_5F): - gUnknown_0203AB60 = 0; - gUnknown_0203AB62 = 0; + sLilycoveDeptStore_NeverRead = 0; + sLilycoveDeptStore_DefaultFloorChoice = 0; break; case MAP_NUM(LILYCOVE_CITY_DEPARTMENT_STORE_4F): - gUnknown_0203AB60 = 0; - gUnknown_0203AB62 = 1; + sLilycoveDeptStore_NeverRead = 0; + sLilycoveDeptStore_DefaultFloorChoice = 1; break; case MAP_NUM(LILYCOVE_CITY_DEPARTMENT_STORE_3F): - gUnknown_0203AB60 = 0; - gUnknown_0203AB62 = 2; + sLilycoveDeptStore_NeverRead = 0; + sLilycoveDeptStore_DefaultFloorChoice = 2; break; case MAP_NUM(LILYCOVE_CITY_DEPARTMENT_STORE_2F): - gUnknown_0203AB60 = 0; - gUnknown_0203AB62 = 3; + sLilycoveDeptStore_NeverRead = 0; + sLilycoveDeptStore_DefaultFloorChoice = 3; break; case MAP_NUM(LILYCOVE_CITY_DEPARTMENT_STORE_1F): - gUnknown_0203AB60 = 0; - gUnknown_0203AB62 = 4; + sLilycoveDeptStore_NeverRead = 0; + sLilycoveDeptStore_DefaultFloorChoice = 4; break; } } - return gUnknown_0203AB62; + return sLilycoveDeptStore_DefaultFloorChoice; } -void ShakeScreenInElevator(void) +void MoveElevator(void) { - static const u8 gUnknown_085B2C18[] = { 0x08, 0x10, 0x18, 0x20, 0x26, 0x2e, 0x34, 0x38, 0x39 }; + static const u8 sElevatorTripLength[] = { 8, 16, 24, 32, 38, 46, 52, 56, 57 }; - s16 *data = gTasks[CreateTask(sub_8139AF4, 9)].data; + s16 *data = gTasks[CreateTask(Task_MoveElevator, 9)].data; u16 floorDelta; data[1] = 0; data[2] = 0; data[4] = 1; + // descending if (gSpecialVar_0x8005 > gSpecialVar_0x8006) { floorDelta = gSpecialVar_0x8005 - gSpecialVar_0x8006; - data[6] = 1; + data[6] = TRUE; } else { floorDelta = gSpecialVar_0x8006 - gSpecialVar_0x8005; - data[6] = 0; + data[6] = FALSE; } if (floorDelta > 8) floorDelta = 8; - data[5] = gUnknown_085B2C18[floorDelta]; + data[5] = sElevatorTripLength[floorDelta]; SetCameraPanningCallback(NULL); - sub_8139C2C(floorDelta, data[6]); + MoveElevatorWindowLights(floorDelta, data[6]); PlaySE(SE_ELEBETA); } -static void sub_8139AF4(u8 taskId) +static void Task_MoveElevator(u8 taskId) { s16 *data = gTasks[taskId].data; data[1]++; @@ -1867,6 +1881,8 @@ static void sub_8139AF4(u8 taskId) data[2]++; data[4] = -data[4]; SetCameraPanning(0, data[4]); + + // arrived at floor if (data[2] == data[5]) { PlaySE(SE_PINPON); @@ -1877,44 +1893,44 @@ static void sub_8139AF4(u8 taskId) } } -void sub_8139B60(void) +void ShowDeptStoreElevatorFloorSelect(void) { int xPos; - gUnknown_0203AB5E = AddWindow(&gUnknown_085B2BAC); - SetStandardWindowBorderStyle(gUnknown_0203AB5E, 0); + sTutorMoveAndElevatorWindowId = AddWindow(&gElevatorFloor_WindowTemplate); + SetStandardWindowBorderStyle(sTutorMoveAndElevatorWindowId, 0); xPos = GetStringCenterAlignXOffset(1, gText_ElevatorNowOn, 64); - AddTextPrinterParameterized(gUnknown_0203AB5E, 1, gText_ElevatorNowOn, xPos, 1, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(sTutorMoveAndElevatorWindowId, 1, gText_ElevatorNowOn, xPos, 1, TEXT_SPEED_FF, NULL); - xPos = GetStringCenterAlignXOffset(1, gElevatorFloorsTable[gSpecialVar_0x8005], 64); - AddTextPrinterParameterized(gUnknown_0203AB5E, 1, gElevatorFloorsTable[gSpecialVar_0x8005], xPos, 17, TEXT_SPEED_FF, NULL); + xPos = GetStringCenterAlignXOffset(1, gDeptStoreFloorNames[gSpecialVar_0x8005], 64); + AddTextPrinterParameterized(sTutorMoveAndElevatorWindowId, 1, gDeptStoreFloorNames[gSpecialVar_0x8005], xPos, 17, TEXT_SPEED_FF, NULL); - PutWindowTilemap(gUnknown_0203AB5E); - CopyWindowToVram(gUnknown_0203AB5E, 3); + PutWindowTilemap(sTutorMoveAndElevatorWindowId); + CopyWindowToVram(sTutorMoveAndElevatorWindowId, 3); } -void sub_8139C10(void) +void CloseDeptStoreElevatorWindow(void) { - ClearStdWindowAndFrameToTransparent(gUnknown_0203AB5E, TRUE); - RemoveWindow(gUnknown_0203AB5E); + ClearStdWindowAndFrameToTransparent(sTutorMoveAndElevatorWindowId, TRUE); + RemoveWindow(sTutorMoveAndElevatorWindowId); } -static void sub_8139C2C(u16 a1, bool8 descending) +static void MoveElevatorWindowLights(u16 floorDelta, bool8 descending) { - static const u8 gUnknown_085B2C21[] = { 0x03, 0x06, 0x09, 0x0c, 0x0f, 0x12, 0x15, 0x18, 0x1b }; + static const u8 sElevatorLightCycles[] = { 3, 6, 9, 12, 15, 18, 21, 24, 27 }; - if (FuncIsActiveTask(MoveElevatorWindowLights) != TRUE) + if (FuncIsActiveTask(Task_MoveElevatorWindowLights) != TRUE) { - u8 taskId = CreateTask(MoveElevatorWindowLights, 8); + u8 taskId = CreateTask(Task_MoveElevatorWindowLights, 8); gTasks[taskId].data[0] = 0; gTasks[taskId].data[1] = 0; gTasks[taskId].data[2] = descending; - gTasks[taskId].data[3] = gUnknown_085B2C21[a1]; + gTasks[taskId].data[3] = sElevatorLightCycles[floorDelta]; } } -static void MoveElevatorWindowLights(u8 taskId) +static void Task_MoveElevatorWindowLights(u8 taskId) { u8 x, y; s16 *data = gTasks[taskId].data; @@ -1922,6 +1938,8 @@ static void MoveElevatorWindowLights(u8 taskId) if (data[1] == 6) { data[0]++; + + // ascending if (data[2] == FALSE) { for (y = 0; y < 3; y++) @@ -1932,6 +1950,7 @@ static void MoveElevatorWindowLights(u8 taskId) } } } + // descending else { for (y = 0; y < 3; y++) @@ -1952,7 +1971,7 @@ static void MoveElevatorWindowLights(u8 taskId) data[1]++; } -void sub_8139D98(void) +void BufferVarsForIVRater(void) { u8 i; u32 ivStorage[NUM_STATS]; @@ -1993,16 +2012,37 @@ void sub_8139D98(void) } } -bool8 warp0_in_pokecenter(void) -{ - static const u16 gUnknown_085B2C2A[] = { 0x0202, 0x0301, 0x0405, 0x0504, 0x0604, 0x0700, 0x0804, 0x090b, 0x0a05, 0x0b05, 0x0c02, 0x0d06, 0x0e03, 0x0f02, 0x100c, 0x100a, 0x1a35, 0x193c, 0xFFFF }; +bool8 UsedPokemonCenterWarp(void) +{ + static const u16 sPokemonCenters[] = + { + MAP_OLDALE_TOWN_POKEMON_CENTER_1F, + MAP_DEWFORD_TOWN_POKEMON_CENTER_1F, + MAP_LAVARIDGE_TOWN_POKEMON_CENTER_1F, + MAP_FALLARBOR_TOWN_POKEMON_CENTER_1F, + MAP_VERDANTURF_TOWN_POKEMON_CENTER_1F, + MAP_PACIFIDLOG_TOWN_POKEMON_CENTER_1F, + MAP_PETALBURG_CITY_POKEMON_CENTER_1F, + MAP_SLATEPORT_CITY_POKEMON_CENTER_1F, + MAP_MAUVILLE_CITY_POKEMON_CENTER_1F, + MAP_RUSTBORO_CITY_POKEMON_CENTER_1F, + MAP_FORTREE_CITY_POKEMON_CENTER_1F, + MAP_LILYCOVE_CITY_POKEMON_CENTER_1F, + MAP_MOSSDEEP_CITY_POKEMON_CENTER_1F, + MAP_SOOTOPOLIS_CITY_POKEMON_CENTER_1F, + MAP_EVER_GRANDE_CITY_POKEMON_CENTER_1F, + MAP_EVER_GRANDE_CITY_POKEMON_LEAGUE_1F, + MAP_BATTLE_FRONTIER_POKEMON_CENTER_1F, + MAP_UNION_ROOM, + 0xFFFF + }; int i; u16 map = (gLastUsedWarp.mapGroup << 8) + gLastUsedWarp.mapNum; - for (i = 0; gUnknown_085B2C2A[i] != 0xFFFF; i++) + for (i = 0; sPokemonCenters[i] != 0xFFFF; i++) { - if (gUnknown_085B2C2A[i] == map) + if (sPokemonCenters[i] == map) return TRUE; } @@ -2018,130 +2058,191 @@ bool32 PlayerNotAtTrainerHillEntrance(void) return TRUE; } -void UpdateFrontierManiac(u16 a0) +void UpdateFrontierManiac(u16 daysSince) { u16 *var = GetVarPointer(VAR_FRONTIER_MANIAC_FACILITY); - *var += a0; - *var %= 10; -} - -void sub_8139F20(void) -{ - static const u8 *const gUnknown_085B2C50[][3] = { - { BattleFrontier_Lounge2_Text_260971, BattleFrontier_Lounge2_Text_260A1E, BattleFrontier_Lounge2_Text_260AE7 }, - { BattleFrontier_Lounge2_Text_2619AC, BattleFrontier_Lounge2_Text_261A91, BattleFrontier_Lounge2_Text_261B0C }, - { BattleFrontier_Lounge2_Text_261B95, BattleFrontier_Lounge2_Text_261B95, BattleFrontier_Lounge2_Text_261B95 }, - { BattleFrontier_Lounge2_Text_261C1A, BattleFrontier_Lounge2_Text_261C1A, BattleFrontier_Lounge2_Text_261C1A }, - { BattleFrontier_Lounge2_Text_260BC4, BattleFrontier_Lounge2_Text_260C6D, BattleFrontier_Lounge2_Text_260D3A }, - { BattleFrontier_Lounge2_Text_260E1E, BattleFrontier_Lounge2_Text_260EC7, BattleFrontier_Lounge2_Text_260F74 }, - { BattleFrontier_Lounge2_Text_2614E6, BattleFrontier_Lounge2_Text_261591, BattleFrontier_Lounge2_Text_26166F }, - { BattleFrontier_Lounge2_Text_261282, BattleFrontier_Lounge2_Text_261329, BattleFrontier_Lounge2_Text_261403 }, - { BattleFrontier_Lounge2_Text_261026, BattleFrontier_Lounge2_Text_2610CC, BattleFrontier_Lounge2_Text_261194 }, - { BattleFrontier_Lounge2_Text_26174D, BattleFrontier_Lounge2_Text_2617F9, BattleFrontier_Lounge2_Text_2618C4 }, + *var += daysSince; + *var %= FRONTIER_MANIAC_FACILITY_COUNT; +} + +void ShowFrontierManiacMessage(void) +{ + static const u8 *const sFrontierManiacMessages[][FRONTIER_MANIAC_MESSAGE_COUNT] = + { + [FRONTIER_MANIAC_BATTLE_TOWER_SINGLES] = + { + BattleFrontier_Lounge2_Text_260971, + BattleFrontier_Lounge2_Text_260A1E, + BattleFrontier_Lounge2_Text_260AE7 + }, + [FRONTIER_MANIAC_BATTLE_TOWER_DOUBLES] = + { + BattleFrontier_Lounge2_Text_2619AC, + BattleFrontier_Lounge2_Text_261A91, + BattleFrontier_Lounge2_Text_261B0C + }, + [FRONTIER_MANIAC_BATTLE_TOWER_MULTIS] = + { + BattleFrontier_Lounge2_Text_261B95, + BattleFrontier_Lounge2_Text_261B95, + BattleFrontier_Lounge2_Text_261B95 + }, + [FRONTIER_MANIAC_BATTLE_TOWER_LINK_MULTIS] = + { + BattleFrontier_Lounge2_Text_261C1A, + BattleFrontier_Lounge2_Text_261C1A, + BattleFrontier_Lounge2_Text_261C1A + }, + [FRONTIER_MANIAC_BATTLE_DOME] = + { + BattleFrontier_Lounge2_Text_260BC4, + BattleFrontier_Lounge2_Text_260C6D, + BattleFrontier_Lounge2_Text_260D3A + }, + [FRONTIER_MANIAC_BATTLE_FACTORY] = + { + BattleFrontier_Lounge2_Text_260E1E, + BattleFrontier_Lounge2_Text_260EC7, + BattleFrontier_Lounge2_Text_260F74 + }, + [FRONTIER_MANIAC_BATTLE_PALACE] = + { + BattleFrontier_Lounge2_Text_2614E6, + BattleFrontier_Lounge2_Text_261591, + BattleFrontier_Lounge2_Text_26166F + }, + [FRONTIER_MANIAC_BATTLE_ARENA] = + { + BattleFrontier_Lounge2_Text_261282, + BattleFrontier_Lounge2_Text_261329, + BattleFrontier_Lounge2_Text_261403 + }, + [FRONTIER_MANIAC_BATTLE_PIKE] = + { + BattleFrontier_Lounge2_Text_261026, + BattleFrontier_Lounge2_Text_2610CC, + BattleFrontier_Lounge2_Text_261194 + }, + [FRONTIER_MANIAC_BATTLE_PYRAMID] = + { + BattleFrontier_Lounge2_Text_26174D, + BattleFrontier_Lounge2_Text_2617F9, + BattleFrontier_Lounge2_Text_2618C4 + }, }; - static const u8 gUnknown_085B2CC8[][2] = { - { 0x15, 0x38 }, - { 0x15, 0x23 }, - { 0xff, 0xff }, - { 0xff, 0xff }, - { 0x02, 0x04 }, - { 0x07, 0x15 }, - { 0x07, 0x15 }, - { 0x0e, 0x1c }, - { 0x0d, 0x70 }, - { 0x07, 0x38 } + static const u8 sFrontierManiacStreakThresholds[][FRONTIER_MANIAC_MESSAGE_COUNT - 1] = + { + [FRONTIER_MANIAC_BATTLE_TOWER_SINGLES] = { 21, 56 }, + [FRONTIER_MANIAC_BATTLE_TOWER_DOUBLES] = { 21, 35 }, + [FRONTIER_MANIAC_BATTLE_TOWER_MULTIS] = { 255, 255 }, + [FRONTIER_MANIAC_BATTLE_TOWER_LINK_MULTIS] = { 255, 255 }, + [FRONTIER_MANIAC_BATTLE_DOME] = { 2, 4 }, + [FRONTIER_MANIAC_BATTLE_FACTORY] = { 7, 21 }, + [FRONTIER_MANIAC_BATTLE_PALACE] = { 7, 21 }, + [FRONTIER_MANIAC_BATTLE_ARENA] = { 14, 28 }, + [FRONTIER_MANIAC_BATTLE_PIKE] = { 13, 112 }, //BUG: 112 (0x70) is probably a mistake; the Pike Queen is battled twice well before that + [FRONTIER_MANIAC_BATTLE_PYRAMID] = { 7, 56 } }; u8 i; - u16 unk = 0; - u16 var = VarGet(VAR_FRONTIER_MANIAC_FACILITY); - switch (var) + u16 winStreak = 0; + u16 facility = VarGet(VAR_FRONTIER_MANIAC_FACILITY); + + switch (facility) { - case 0: - case 1: - case 2: - case 3: - if (gSaveBlock2Ptr->frontier.towerWinStreaks[var][0] >= gSaveBlock2Ptr->frontier.towerWinStreaks[var][1]) + case FRONTIER_MANIAC_BATTLE_TOWER_SINGLES: + case FRONTIER_MANIAC_BATTLE_TOWER_DOUBLES: + case FRONTIER_MANIAC_BATTLE_TOWER_MULTIS: + case FRONTIER_MANIAC_BATTLE_TOWER_LINK_MULTIS: + if (gSaveBlock2Ptr->frontier.towerWinStreaks[facility][FRONTIER_LVL_50] + >= gSaveBlock2Ptr->frontier.towerWinStreaks[facility][FRONTIER_LVL_OPEN]) { - unk = gSaveBlock2Ptr->frontier.towerWinStreaks[var][0]; + winStreak = gSaveBlock2Ptr->frontier.towerWinStreaks[facility][FRONTIER_LVL_50]; } else { - unk = gSaveBlock2Ptr->frontier.towerWinStreaks[var][1]; + winStreak = gSaveBlock2Ptr->frontier.towerWinStreaks[facility][FRONTIER_LVL_OPEN]; } break; - case 4: - if (gSaveBlock2Ptr->frontier.domeWinStreaks[0][0] >= gSaveBlock2Ptr->frontier.domeWinStreaks[0][1]) + case FRONTIER_MANIAC_BATTLE_DOME: + if (gSaveBlock2Ptr->frontier.domeWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_50] + >= gSaveBlock2Ptr->frontier.domeWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_OPEN]) { - unk = gSaveBlock2Ptr->frontier.domeWinStreaks[0][0]; + winStreak = gSaveBlock2Ptr->frontier.domeWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_50]; } else { - unk = gSaveBlock2Ptr->frontier.domeWinStreaks[0][1]; + winStreak = gSaveBlock2Ptr->frontier.domeWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_OPEN]; } break; - case 5: - if (gSaveBlock2Ptr->frontier.factoryWinStreaks[0][0] >= gSaveBlock2Ptr->frontier.factoryWinStreaks[0][1]) + case FRONTIER_MANIAC_BATTLE_FACTORY: + if (gSaveBlock2Ptr->frontier.factoryWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_50] + >= gSaveBlock2Ptr->frontier.factoryWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_OPEN]) { - unk = gSaveBlock2Ptr->frontier.factoryWinStreaks[0][0]; + winStreak = gSaveBlock2Ptr->frontier.factoryWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_50]; } else { - unk = gSaveBlock2Ptr->frontier.factoryWinStreaks[0][1]; + winStreak = gSaveBlock2Ptr->frontier.factoryWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_OPEN]; } break; - case 6: - if (gSaveBlock2Ptr->frontier.palaceWinStreaks[0][0] >= gSaveBlock2Ptr->frontier.palaceWinStreaks[0][1]) + case FRONTIER_MANIAC_BATTLE_PALACE: + if (gSaveBlock2Ptr->frontier.palaceWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_50] + >= gSaveBlock2Ptr->frontier.palaceWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_OPEN]) { - unk = gSaveBlock2Ptr->frontier.palaceWinStreaks[0][0]; + winStreak = gSaveBlock2Ptr->frontier.palaceWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_50]; } else { - unk = gSaveBlock2Ptr->frontier.palaceWinStreaks[0][1]; + winStreak = gSaveBlock2Ptr->frontier.palaceWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_OPEN]; } break; - case 7: - if (gSaveBlock2Ptr->frontier.arenaWinStreaks[0] >= gSaveBlock2Ptr->frontier.arenaWinStreaks[1]) + case FRONTIER_MANIAC_BATTLE_ARENA: + if (gSaveBlock2Ptr->frontier.arenaWinStreaks[FRONTIER_LVL_50] + >= gSaveBlock2Ptr->frontier.arenaWinStreaks[FRONTIER_LVL_OPEN]) { - unk = gSaveBlock2Ptr->frontier.arenaWinStreaks[0]; + winStreak = gSaveBlock2Ptr->frontier.arenaWinStreaks[FRONTIER_LVL_50]; } else { - unk = gSaveBlock2Ptr->frontier.arenaWinStreaks[1]; + winStreak = gSaveBlock2Ptr->frontier.arenaWinStreaks[FRONTIER_LVL_OPEN]; } break; - case 8: - if (gSaveBlock2Ptr->frontier.pikeWinStreaks[0] >= gSaveBlock2Ptr->frontier.pikeWinStreaks[1]) + case FRONTIER_MANIAC_BATTLE_PIKE: + if (gSaveBlock2Ptr->frontier.pikeWinStreaks[FRONTIER_LVL_50] + >= gSaveBlock2Ptr->frontier.pikeWinStreaks[FRONTIER_LVL_OPEN]) { - unk = gSaveBlock2Ptr->frontier.pikeWinStreaks[0]; + winStreak = gSaveBlock2Ptr->frontier.pikeWinStreaks[FRONTIER_LVL_50]; } else { - unk = gSaveBlock2Ptr->frontier.pikeWinStreaks[1]; + winStreak = gSaveBlock2Ptr->frontier.pikeWinStreaks[FRONTIER_LVL_OPEN]; } break; - case 9: - if (gSaveBlock2Ptr->frontier.pyramidWinStreaks[0] >= gSaveBlock2Ptr->frontier.pyramidWinStreaks[1]) + case FRONTIER_MANIAC_BATTLE_PYRAMID: + if (gSaveBlock2Ptr->frontier.pyramidWinStreaks[FRONTIER_LVL_50] + >= gSaveBlock2Ptr->frontier.pyramidWinStreaks[FRONTIER_LVL_OPEN]) { - unk = gSaveBlock2Ptr->frontier.pyramidWinStreaks[0]; + winStreak = gSaveBlock2Ptr->frontier.pyramidWinStreaks[FRONTIER_LVL_50]; } else { - unk = gSaveBlock2Ptr->frontier.pyramidWinStreaks[1]; + winStreak = gSaveBlock2Ptr->frontier.pyramidWinStreaks[FRONTIER_LVL_OPEN]; } break; } - for (i = 0; i < 2 && gUnknown_085B2CC8[var][i] < unk; i++); + for (i = 0; i < FRONTIER_MANIAC_MESSAGE_COUNT - 1 && sFrontierManiacStreakThresholds[facility][i] < winStreak; i++); - ShowFieldMessage(gUnknown_085B2C50[var][i]); + ShowFieldMessage(sFrontierManiacMessages[facility][i]); } -void sub_813A080(void) +// gSpecialVar_0x8005 and 0x8006 here are used by MoveElevator +void BufferBattleTowerElevatorFloors(void) { - static const u16 gUnknown_085B2CDC[] = { - 0x0007, 0x000e, 0x0015, 0x001c, 0x0023, 0x0031, 0x003f, 0x004d, 0x005b, 0x0000 + static const u16 sBattleTowerStreakThresholds[] = { + 7, 14, 21, 28, 35, 49, 63, 77, 91, 0 }; u8 i; @@ -2155,9 +2256,9 @@ void sub_813A080(void) return; } - for (i = 0; i < 9; i++) + for (i = 0; i < ARRAY_COUNT(sBattleTowerStreakThresholds) - 1; i++) { - if (gUnknown_085B2CDC[i] > gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode]) + if (sBattleTowerStreakThresholds[i] > gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode]) { gSpecialVar_0x8005 = 4; gSpecialVar_0x8006 = i + 5; @@ -2169,15 +2270,16 @@ void sub_813A080(void) gSpecialVar_0x8006 = 12; } -void sub_813A128(void) +// data[1]: number of options in the multichoice +void ShowScrollableMultichoice(void) { - u8 taskId = CreateTask(sub_813A2DC, 8); + u8 taskId = CreateTask(Task_ShowScrollableMultichoice, 8); struct Task *task = &gTasks[taskId]; task->data[11] = gSpecialVar_0x8004; switch (gSpecialVar_0x8004) { - case 0: + case SCROLL_MULTI_NONE: task->data[0] = 1; task->data[1] = 1; task->data[2] = 1; @@ -2187,8 +2289,8 @@ void sub_813A128(void) task->data[6] = 0; task->data[15] = taskId; break; - case 1: - task->data[0] = 5; + case SCROLL_MULTI_GLASS_WORKSHOP_VENDOR: + task->data[0] = MAX_SCROLL_MULTI_ON_SCREEN - 1; task->data[1] = 8; task->data[2] = 1; task->data[3] = 1; @@ -2197,8 +2299,8 @@ void sub_813A128(void) task->data[6] = 0; task->data[15] = taskId; break; - case 2: - task->data[0] = 6; + case SCROLL_MULTI_POKEMON_FAN_CLUB_RATER: + task->data[0] = MAX_SCROLL_MULTI_ON_SCREEN; task->data[1] = 12; task->data[2] = 1; task->data[3] = 1; @@ -2207,8 +2309,8 @@ void sub_813A128(void) task->data[6] = 0; task->data[15] = taskId; break; - case 3: - task->data[0] = 6; + case SCROLL_MULTI_BF_EXCHANGE_CORNER_DECOR_VENDOR_1: + task->data[0] = MAX_SCROLL_MULTI_ON_SCREEN; task->data[1] = 11; task->data[2] = 14; task->data[3] = 1; @@ -2217,8 +2319,8 @@ void sub_813A128(void) task->data[6] = 0; task->data[15] = taskId; break; - case 4: - task->data[0] = 6; + case SCROLL_MULTI_BF_EXCHANGE_CORNER_DECOR_VENDOR_2: + task->data[0] = MAX_SCROLL_MULTI_ON_SCREEN; task->data[1] = 6; task->data[2] = 14; task->data[3] = 1; @@ -2227,8 +2329,8 @@ void sub_813A128(void) task->data[6] = 0; task->data[15] = taskId; break; - case 5: - task->data[0] = 6; + case SCROLL_MULTI_BF_EXCHANGE_CORNER_VITAMIN_VENDOR: + task->data[0] = MAX_SCROLL_MULTI_ON_SCREEN; task->data[1] = 7; task->data[2] = 14; task->data[3] = 1; @@ -2237,8 +2339,8 @@ void sub_813A128(void) task->data[6] = 0; task->data[15] = taskId; break; - case 6: - task->data[0] = 6; + case SCROLL_MULTI_BF_EXCHANGE_CORNER_HOLD_ITEM_VENDOR: + task->data[0] = MAX_SCROLL_MULTI_ON_SCREEN; task->data[1] = 10; task->data[2] = 14; task->data[3] = 1; @@ -2247,8 +2349,8 @@ void sub_813A128(void) task->data[6] = 0; task->data[15] = taskId; break; - case 7: - task->data[0] = 6; + case SCROLL_MULTI_BERRY_POWDER_VENDOR: + task->data[0] = MAX_SCROLL_MULTI_ON_SCREEN; task->data[1] = 12; task->data[2] = 15; task->data[3] = 1; @@ -2257,8 +2359,8 @@ void sub_813A128(void) task->data[6] = 0; task->data[15] = taskId; break; - case 8: - task->data[0] = 6; + case SCROLL_MULTI_BF_RECEPTIONIST: + task->data[0] = MAX_SCROLL_MULTI_ON_SCREEN; task->data[1] = 10; task->data[2] = 17; task->data[3] = 1; @@ -2267,9 +2369,9 @@ void sub_813A128(void) task->data[6] = 0; task->data[15] = taskId; break; - case 9: - case 10: - task->data[0] = 6; + case SCROLL_MULTI_BF_MOVE_TUTOR_1: + case SCROLL_MULTI_BF_MOVE_TUTOR_2: + task->data[0] = MAX_SCROLL_MULTI_ON_SCREEN; task->data[1] = 11; task->data[2] = 15; task->data[3] = 1; @@ -2278,8 +2380,8 @@ void sub_813A128(void) task->data[6] = 0; task->data[15] = taskId; break; - case 11: - task->data[0] = 6; + case SCROLL_MULTI_SS_TIDAL_DESTINATION: + task->data[0] = MAX_SCROLL_MULTI_ON_SCREEN; task->data[1] = 7; task->data[2] = 19; task->data[3] = 1; @@ -2288,8 +2390,8 @@ void sub_813A128(void) task->data[6] = 0; task->data[15] = taskId; break; - case 12: - task->data[0] = 6; + case SCROLL_MULTI_BATTLE_TENT_RULES: + task->data[0] = MAX_SCROLL_MULTI_ON_SCREEN; task->data[1] = 7; task->data[2] = 17; task->data[3] = 1; @@ -2305,25 +2407,13 @@ void sub_813A128(void) } } -static const u8 *const gUnknown_085B2CF0[][16] = { +static const u8 *const sScrollableMenuOptions[][MAX_SCROLL_MULTI_LENGTH] = +{ + [SCROLL_MULTI_NONE] = { - gText_Exit, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL + gText_Exit }, + [SCROLL_MULTI_GLASS_WORKSHOP_VENDOR] = { gText_BlueFlute, gText_YellowFlute, @@ -2332,16 +2422,9 @@ static const u8 *const gUnknown_085B2CF0[][16] = { gText_BlackFlute, gText_PrettyChair, gText_PrettyDesk, - gText_Exit, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL + gText_Exit }, + [SCROLL_MULTI_POKEMON_FAN_CLUB_RATER] = { gText_0Pts, gText_10Pts, @@ -2354,12 +2437,9 @@ static const u8 *const gUnknown_085B2CF0[][16] = { gText_80Pts, gText_90Pts, gText_100Pts, - gText_QuestionMark, - NULL, - NULL, - NULL, - NULL + gText_QuestionMark }, + [SCROLL_MULTI_BF_EXCHANGE_CORNER_DECOR_VENDOR_1] = { gText_KissPoster16BP, gText_KissCushion32BP, @@ -2371,31 +2451,18 @@ static const u8 *const gUnknown_085B2CF0[][16] = { gText_CyndaquilDoll80BP, gText_ChikoritaDoll80BP, gText_TotodileDoll80BP, - gText_Exit, - NULL, - NULL, - NULL, - NULL, - NULL + gText_Exit }, + [SCROLL_MULTI_BF_EXCHANGE_CORNER_DECOR_VENDOR_2] = { gText_LaprasDoll128BP, gText_SnorlaxDoll128BP, gText_VenusaurDoll256BP, gText_CharizardDoll256BP, gText_BlastoiseDoll256BP, - gText_Exit, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL + gText_Exit }, + [SCROLL_MULTI_BF_EXCHANGE_CORNER_VITAMIN_VENDOR] = { gText_Protein1BP, gText_Calcium1BP, @@ -2403,17 +2470,9 @@ static const u8 *const gUnknown_085B2CF0[][16] = { gText_Zinc1BP, gText_Carbos1BP, gText_HpUp1BP, - gText_Exit, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL + gText_Exit }, + [SCROLL_MULTI_BF_EXCHANGE_CORNER_HOLD_ITEM_VENDOR] = { gText_Leftovers48BP, gText_WhiteHerb48BP, @@ -2424,14 +2483,9 @@ static const u8 *const gUnknown_085B2CF0[][16] = { gText_KingsRock64BP, gText_FocusBand64BP, gText_ScopeLens64BP, - gText_Exit, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL + gText_Exit }, + [SCROLL_MULTI_BERRY_POWDER_VENDOR] = { gText_EnergyPowder50, gText_EnergyRoot80, @@ -2444,12 +2498,9 @@ static const u8 *const gUnknown_085B2CF0[][16] = { gText_Zinc1000, gText_HPUp1000, gText_PPUp3000, - gText_Exit, - NULL, - NULL, - NULL, - NULL + gText_Exit }, + [SCROLL_MULTI_BF_RECEPTIONIST] = { gText_BattleTower2, gText_BattleDome, @@ -2460,14 +2511,9 @@ static const u8 *const gUnknown_085B2CF0[][16] = { gText_BattlePyramid, gText_RankingHall, gText_ExchangeService, - gText_Exit, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL + gText_Exit }, + [SCROLL_MULTI_BF_MOVE_TUTOR_1] = { gText_Softboiled16BP, gText_SeismicToss24BP, @@ -2479,13 +2525,9 @@ static const u8 *const gUnknown_085B2CF0[][16] = { gText_Counter48BP, gText_ThunderWave48BP, gText_SwordsDance48BP, - gText_Exit, - NULL, - NULL, - NULL, - NULL, - NULL + gText_Exit }, + [SCROLL_MULTI_BF_MOVE_TUTOR_2] = { gText_DefenseCurl16BP, gText_Snore24BP, @@ -2497,13 +2539,9 @@ static const u8 *const gUnknown_085B2CF0[][16] = { gText_IcePunch48BP, gText_ThunderPunch48BP, gText_FirePunch48BP, - gText_Exit, - NULL, - NULL, - NULL, - NULL, - NULL + gText_Exit }, + [SCROLL_MULTI_SS_TIDAL_DESTINATION] = { gText_SlateportCity, gText_BattleFrontier, @@ -2511,17 +2549,9 @@ static const u8 *const gUnknown_085B2CF0[][16] = { gText_NavelRock, gText_BirthIsland, gText_FarawayIsland, - gText_Exit, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL + gText_Exit }, + [SCROLL_MULTI_BATTLE_TENT_RULES] = { gText_BattleTrainers, gText_BattleBasics, @@ -2529,20 +2559,11 @@ static const u8 *const gUnknown_085B2CF0[][16] = { gText_PokemonMoves, gText_Underpowered, gText_WhenInDanger, - gText_Exit, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL + gText_Exit } }; -static void sub_813A2DC(u8 taskId) +static void Task_ShowScrollableMultichoice(u8 taskId) { u32 unk1; u8 i, windowId; @@ -2550,19 +2571,19 @@ static void sub_813A2DC(u8 taskId) struct Task *task = &gTasks[taskId]; ScriptContext2_Enable(); - gUnknown_0203AB68 = 0; - gUnknown_0203AB6C = 0x40; - sub_813AA60(task->data[11], 0); - sub_813ACE8(task->data[11], 0); - gUnknown_0203AB64 = AllocZeroed(task->data[1] * 8); - gUnknown_0203AB6A = 0; - sub_813A42C(); + sScrollableMultichoice_ScrollOffset = 0; + sScrollableMultichoice_ItemSpriteId = MAX_SPRITES; + FillFrontierExchangeCornerWindowAndItemIcon(task->data[11], 0); + ShowBattleFrontierTutorWindow(task->data[11], 0); + sScrollableMultichoice_ListMenuItem = AllocZeroed(task->data[1] * 8); + sFrontierExchangeCorner_NeverRead = 0; + InitScrollableMultichoice(); for (unk1 = 0, i = 0; i < task->data[1]; i++) { - const u8 *text = gUnknown_085B2CF0[gSpecialVar_0x8004][i]; - gUnknown_0203AB64[i].name = text; - gUnknown_0203AB64[i].id = i; + const u8 *text = sScrollableMenuOptions[gSpecialVar_0x8004][i]; + sScrollableMultichoice_ListMenuItem[i].name = text; + sScrollableMultichoice_ListMenuItem[i].id = i; unk1 = display_text_and_get_width(text, unk1); } @@ -2586,58 +2607,58 @@ static void sub_813A2DC(u8 taskId) task->data[13] = windowId; SetStandardWindowBorderStyle(windowId, 0); - gUnknown_030061D0.totalItems = task->data[1]; - gUnknown_030061D0.maxShowed = task->data[0]; - gUnknown_030061D0.windowId = task->data[13]; + gScrollableMultichoice_ListMenuTemplate.totalItems = task->data[1]; + gScrollableMultichoice_ListMenuTemplate.maxShowed = task->data[0]; + gScrollableMultichoice_ListMenuTemplate.windowId = task->data[13]; - sub_813A694(taskId); - task->data[14] = ListMenuInit(&gUnknown_030061D0, task->data[7], task->data[8]); + ScrollableMultichoice_UpdateScrollArrows(taskId); + task->data[14] = ListMenuInit(&gScrollableMultichoice_ListMenuTemplate, task->data[7], task->data[8]); schedule_bg_copy_tilemap_to_vram(0); - gTasks[taskId].func = sub_813A4EC; + gTasks[taskId].func = ScrollableMultichoice_ProcessInput; } -static void sub_813A42C(void) +static void InitScrollableMultichoice(void) { - gUnknown_030061D0.items = gUnknown_0203AB64; - gUnknown_030061D0.moveCursorFunc = sub_813A46C; - gUnknown_030061D0.itemPrintFunc = NULL; - gUnknown_030061D0.totalItems = 1; - gUnknown_030061D0.maxShowed = 1; - gUnknown_030061D0.windowId = 0; - gUnknown_030061D0.header_X = 0; - gUnknown_030061D0.item_X = 8; - gUnknown_030061D0.cursor_X = 0; - gUnknown_030061D0.upText_Y = 1; - gUnknown_030061D0.cursorPal = 2; - gUnknown_030061D0.fillValue = 1; - gUnknown_030061D0.cursorShadowPal = 3; - gUnknown_030061D0.lettersSpacing = 0; - gUnknown_030061D0.itemVerticalPadding = 0; - gUnknown_030061D0.scrollMultiple = 0; - gUnknown_030061D0.fontId = 1; - gUnknown_030061D0.cursorKind = 0; + gScrollableMultichoice_ListMenuTemplate.items = sScrollableMultichoice_ListMenuItem; + gScrollableMultichoice_ListMenuTemplate.moveCursorFunc = ScrollableMultichoice_MoveCursor; + gScrollableMultichoice_ListMenuTemplate.itemPrintFunc = NULL; + gScrollableMultichoice_ListMenuTemplate.totalItems = 1; + gScrollableMultichoice_ListMenuTemplate.maxShowed = 1; + gScrollableMultichoice_ListMenuTemplate.windowId = 0; + gScrollableMultichoice_ListMenuTemplate.header_X = 0; + gScrollableMultichoice_ListMenuTemplate.item_X = 8; + gScrollableMultichoice_ListMenuTemplate.cursor_X = 0; + gScrollableMultichoice_ListMenuTemplate.upText_Y = 1; + gScrollableMultichoice_ListMenuTemplate.cursorPal = 2; + gScrollableMultichoice_ListMenuTemplate.fillValue = 1; + gScrollableMultichoice_ListMenuTemplate.cursorShadowPal = 3; + gScrollableMultichoice_ListMenuTemplate.lettersSpacing = 0; + gScrollableMultichoice_ListMenuTemplate.itemVerticalPadding = 0; + gScrollableMultichoice_ListMenuTemplate.scrollMultiple = 0; + gScrollableMultichoice_ListMenuTemplate.fontId = 1; + gScrollableMultichoice_ListMenuTemplate.cursorKind = 0; } -static void sub_813A46C(s32 itemIndex, bool8 onInit, struct ListMenu *list) +static void ScrollableMultichoice_MoveCursor(s32 itemIndex, bool8 onInit, struct ListMenu *list) { u8 taskId; PlaySE(SE_SELECT); - taskId = FindTaskIdByFunc(sub_813A4EC); + taskId = FindTaskIdByFunc(ScrollableMultichoice_ProcessInput); if (taskId != 0xFF) { - u16 misc; + u16 selection; struct Task *task = &gTasks[taskId]; - ListMenuGetScrollAndRow(task->data[14], &misc, NULL); - gUnknown_0203AB68 = misc; - ListMenuGetCurrentItemArrayId(task->data[14], &misc); - sub_813AC44(task->data[11], gUnknown_0203AB6A); - sub_813AA60(task->data[11], misc); - sub_813AD34(task->data[11], misc); - gUnknown_0203AB6A = misc; + ListMenuGetScrollAndRow(task->data[14], &selection, NULL); + sScrollableMultichoice_ScrollOffset = selection; + ListMenuGetCurrentItemArrayId(task->data[14], &selection); + HideFrontierExchangeCornerItemIcon(task->data[11], sFrontierExchangeCorner_NeverRead); + FillFrontierExchangeCornerWindowAndItemIcon(task->data[11], selection); + ShowBattleFrontierTutorMoveDescription(task->data[11], selection); + sFrontierExchangeCorner_NeverRead = selection; } } -static void sub_813A4EC(u8 taskId) +static void ScrollableMultichoice_ProcessInput(u8 taskId) { struct Task *task = &gTasks[taskId]; s32 input = ListMenu_ProcessInput(task->data[14]); @@ -2649,22 +2670,22 @@ static void sub_813A4EC(u8 taskId) case LIST_CANCEL: gSpecialVar_Result = 0x7F; PlaySE(SE_SELECT); - sub_813A570(taskId); + CloseScrollableMultichoice(taskId); break; default: gSpecialVar_Result = input; PlaySE(SE_SELECT); if (!task->data[6]) { - sub_813A570(taskId); + CloseScrollableMultichoice(taskId); } else if (input == task->data[1] - 1) { - sub_813A570(taskId); + CloseScrollableMultichoice(taskId); } else { - sub_813A738(taskId); + ScrollableMultichoice_RemoveScrollArrows(taskId); task->func = sub_813A600; EnableBothScriptContexts(); } @@ -2672,15 +2693,15 @@ static void sub_813A4EC(u8 taskId) } } -static void sub_813A570(u8 taskId) +static void CloseScrollableMultichoice(u8 taskId) { - u16 array; + u16 selection; struct Task *task = &gTasks[taskId]; - ListMenuGetCurrentItemArrayId(task->data[14], &array); - sub_813AC44(task->data[11], array); - sub_813A738(taskId); + ListMenuGetCurrentItemArrayId(task->data[14], &selection); + HideFrontierExchangeCornerItemIcon(task->data[11], selection); + ScrollableMultichoice_RemoveScrollArrows(taskId); DestroyListMenuTask(task->data[14], NULL, NULL); - Free(gUnknown_0203AB64); + Free(sScrollableMultichoice_ListMenuItem); ClearStdWindowAndFrameToTransparent(task->data[13], 1); FillWindowPixelBuffer(task->data[13], PIXEL_FILL(0)); CopyWindowToVram(task->data[13], 2); @@ -2703,6 +2724,7 @@ static void sub_813A600(u8 taskId) } } +// Never called void sub_813A630(void) { u8 taskId = FindTaskIdByFunc(sub_813A600); @@ -2719,13 +2741,13 @@ void sub_813A630(void) static void sub_813A664(u8 taskId) { ScriptContext2_Enable(); - sub_813A694(taskId); - gTasks[taskId].func = sub_813A4EC; + ScrollableMultichoice_UpdateScrollArrows(taskId); + gTasks[taskId].func = ScrollableMultichoice_ProcessInput; } -static void sub_813A694(u8 taskId) +static void ScrollableMultichoice_UpdateScrollArrows(u8 taskId) { - static const struct ScrollArrowsTemplate gUnknown_085B3030 = { + static const struct ScrollArrowsTemplate sScrollableMultichoice_ScrollArrowsTemplate = { .firstArrowType = SCROLL_ARROW_UP, .firstX = 0, .firstY = 0, @@ -2740,7 +2762,7 @@ static void sub_813A694(u8 taskId) }; struct Task *task = &gTasks[taskId]; - struct ScrollArrowsTemplate template = gUnknown_085B3030; + struct ScrollArrowsTemplate template = sScrollableMultichoice_ScrollArrowsTemplate; if (task->data[0] != task->data[1]) { template.firstX = (task->data[4] / 2) * 8 + 12 + (task->data[2] - 1) * 8; @@ -2749,11 +2771,11 @@ static void sub_813A694(u8 taskId) template.secondY = task->data[5] * 8 + 10; template.fullyUpThreshold = 0; template.fullyDownThreshold = task->data[1] - task->data[0]; - task->data[12] = AddScrollIndicatorArrowPair(&template, &gUnknown_0203AB68); + task->data[12] = AddScrollIndicatorArrowPair(&template, &sScrollableMultichoice_ScrollOffset); } } -static void sub_813A738(u8 taskId) +static void ScrollableMultichoice_RemoveScrollArrows(u8 taskId) { struct Task *task = &gTasks[taskId]; if (task->data[0] != task->data[1]) @@ -2762,12 +2784,29 @@ static void sub_813A738(u8 taskId) } } -void nullsub_55(void) +// Removed for Emerald (replaced by ShowScrollableMultichoice) +void ShowGlassWorkshopMenu(void) { - + /* + u8 i; + ScriptContext2_Enable(); + Menu_DrawStdWindowFrame(0, 0, 10, 11); + InitMenu(0, 1, 1, 5, 0, 9); + gUnknown_0203925C = 0; + ClearVerticalScrollIndicatorPalettes(); + LoadScrollIndicatorPalette(); + sub_810F2B4(); + for (i = 0; i < 5; i++) + { + Menu_PrintText(gUnknown_083F83C0[i], 1, 2 * i + 1); + } + gUnknown_0203925B = 0; + gUnknown_0203925A = ARRAY_COUNT(gUnknown_083F83C0); + CreateTask(sub_810F118, 8); + */ } -void sub_813A76C(void) +void SetBattleTowerLinkPlayerGfx(void) { u8 i; for (i = 0; i < 2; i++) @@ -2783,34 +2822,34 @@ void sub_813A76C(void) } } -void sub_813A7B8(void) -{ - static const u8 *const gUnknown_085B3040[] = { - BattleFrontier_Lounge5_Text_26468D, - BattleFrontier_Lounge5_Text_2646E5, - BattleFrontier_Lounge5_Text_264741, - BattleFrontier_Lounge5_Text_2647A4, - BattleFrontier_Lounge5_Text_2647FC, - BattleFrontier_Lounge5_Text_264858, - BattleFrontier_Lounge5_Text_2648BE, - BattleFrontier_Lounge5_Text_264916, - BattleFrontier_Lounge5_Text_264972, - BattleFrontier_Lounge5_Text_2649D5, - BattleFrontier_Lounge5_Text_264A3F, - BattleFrontier_Lounge5_Text_264A9B, - BattleFrontier_Lounge5_Text_264AF3, - BattleFrontier_Lounge5_Text_264B5D, - BattleFrontier_Lounge5_Text_2648BE, - BattleFrontier_Lounge5_Text_264BC3, - BattleFrontier_Lounge5_Text_264C36, - BattleFrontier_Lounge5_Text_2648BE, - BattleFrontier_Lounge5_Text_264C95, - BattleFrontier_Lounge5_Text_264D01, - BattleFrontier_Lounge5_Text_264D6B, - BattleFrontier_Lounge5_Text_264DD7, - BattleFrontier_Lounge5_Text_264E33, - BattleFrontier_Lounge5_Text_264E8F, - BattleFrontier_Lounge5_Text_2648BE, +void ShowNatureGirlMessage(void) +{ + static const u8 *const sNatureGirlMessages[] = { + [NATURE_HARDY] = BattleFrontier_Lounge5_Text_NatureGirlHardy, + [NATURE_LONELY] = BattleFrontier_Lounge5_Text_NatureGirlLonely, + [NATURE_BRAVE] = BattleFrontier_Lounge5_Text_NatureGirlBrave, + [NATURE_ADAMANT] = BattleFrontier_Lounge5_Text_NatureGirlAdamant, + [NATURE_NAUGHTY] = BattleFrontier_Lounge5_Text_NatureGirlNaughty, + [NATURE_BOLD] = BattleFrontier_Lounge5_Text_NatureGirlBold, + [NATURE_DOCILE] = BattleFrontier_Lounge5_Text_NatureGirlDocileNaiveQuietQuirky, + [NATURE_RELAXED] = BattleFrontier_Lounge5_Text_NatureGirlRelaxed, + [NATURE_IMPISH] = BattleFrontier_Lounge5_Text_NatureGirlImpish, + [NATURE_LAX] = BattleFrontier_Lounge5_Text_NatureGirlLax, + [NATURE_TIMID] = BattleFrontier_Lounge5_Text_NatureGirlTimid, + [NATURE_HASTY] = BattleFrontier_Lounge5_Text_NatureGirlHasty, + [NATURE_SERIOUS] = BattleFrontier_Lounge5_Text_NatureGirlSerious, + [NATURE_JOLLY] = BattleFrontier_Lounge5_Text_NatureGirlJolly, + [NATURE_NAIVE] = BattleFrontier_Lounge5_Text_NatureGirlDocileNaiveQuietQuirky, + [NATURE_MODEST] = BattleFrontier_Lounge5_Text_NatureGirlModest, + [NATURE_MILD] = BattleFrontier_Lounge5_Text_NatureGirlMild, + [NATURE_QUIET] = BattleFrontier_Lounge5_Text_NatureGirlDocileNaiveQuietQuirky, + [NATURE_BASHFUL] = BattleFrontier_Lounge5_Text_NatureGirlBashful, + [NATURE_RASH] = BattleFrontier_Lounge5_Text_NatureGirlRash, + [NATURE_CALM] = BattleFrontier_Lounge5_Text_NatureGirlCalm, + [NATURE_GENTLE] = BattleFrontier_Lounge5_Text_NatureGirlGentle, + [NATURE_SASSY] = BattleFrontier_Lounge5_Text_NatureGirlSassy, + [NATURE_CAREFUL] = BattleFrontier_Lounge5_Text_NatureGirlCareful, + [NATURE_QUIRKY] = BattleFrontier_Lounge5_Text_NatureGirlDocileNaiveQuietQuirky, }; u8 nature; @@ -2821,19 +2860,20 @@ void sub_813A7B8(void) } nature = GetNature(&gPlayerParty[gSpecialVar_0x8004]); - ShowFieldMessage(gUnknown_085B3040[nature]); + ShowFieldMessage(sNatureGirlMessages[nature]); } -void UpdateFrontierGambler(u16 a0) +void UpdateFrontierGambler(u16 daysSince) { - u16 *var = GetVarPointer(VAR_FRONTIER_GAMBLER_FACILITY); - *var += a0; - *var %= 12; + u16 *var = GetVarPointer(VAR_FRONTIER_GAMBLER_CHALLENGE); + *var += daysSince; + *var %= FRONTIER_GAMBLER_CHALLENGE_COUNT; } -void sub_813A820(void) +void ShowFrontierGamblerLookingMessage(void) { - static const u8 *const gUnknown_085B30A4[] = { + static const u8 *const sFrontierGamblerLookingMessages[] = + { BattleFrontier_Lounge3_Text_262261, BattleFrontier_Lounge3_Text_26230D, BattleFrontier_Lounge3_Text_2623B9, @@ -2848,14 +2888,15 @@ void sub_813A820(void) BattleFrontier_Lounge3_Text_2629BC, }; - u16 var = VarGet(VAR_FRONTIER_GAMBLER_FACILITY); - ShowFieldMessage(gUnknown_085B30A4[var]); - VarSet(VAR_FRONTIER_GAMBLER_SET_FACILITY_F, var); + u16 challenge = VarGet(VAR_FRONTIER_GAMBLER_CHALLENGE); + ShowFieldMessage(sFrontierGamblerLookingMessages[challenge]); + VarSet(VAR_FRONTIER_GAMBLER_SET_CHALLENGE, challenge); } -void sub_813A854(void) +void ShowFrontierGamblerGoMessage(void) { - static const u8 *const gUnknown_085B30D4[] = { + static const u8 *const sFrontierGamblerGoMessages[] = + { BattleFrontier_Lounge3_Text_262C04, BattleFrontier_Lounge3_Text_262C90, BattleFrontier_Lounge3_Text_262D1C, @@ -2870,45 +2911,59 @@ void sub_813A854(void) BattleFrontier_Lounge3_Text_263211, }; - ShowFieldMessage(gUnknown_085B30D4[VarGet(VAR_FRONTIER_GAMBLER_SET_FACILITY_F)]); + ShowFieldMessage(sFrontierGamblerGoMessages[VarGet(VAR_FRONTIER_GAMBLER_SET_CHALLENGE)]); } -void sub_813A878(u8 a0) +void FrontierGamblerSetWonOrLost(bool8 won) { - static const u16 gUnknown_085B3104[] = {0x0000, 0x0001, 0x0002, 0x0100, 0x0101, 0x0400, 0x0401, 0x0200, 0x0201, 0x0300, 0x0500, 0x0600}; + static const u16 sFrontierChallenges[] = + { + FRONTIER_CHALLENGE(FRONTIER_FACILITY_TOWER, FRONTIER_MODE_SINGLES), + FRONTIER_CHALLENGE(FRONTIER_FACILITY_TOWER, FRONTIER_MODE_DOUBLES), + FRONTIER_CHALLENGE(FRONTIER_FACILITY_TOWER, FRONTIER_MODE_MULTIS), + FRONTIER_CHALLENGE(FRONTIER_FACILITY_DOME, FRONTIER_MODE_SINGLES), + FRONTIER_CHALLENGE(FRONTIER_FACILITY_DOME, FRONTIER_MODE_DOUBLES), + FRONTIER_CHALLENGE(FRONTIER_FACILITY_FACTORY, FRONTIER_MODE_SINGLES), + FRONTIER_CHALLENGE(FRONTIER_FACILITY_FACTORY, FRONTIER_MODE_DOUBLES), + FRONTIER_CHALLENGE(FRONTIER_FACILITY_PALACE, FRONTIER_MODE_SINGLES), + FRONTIER_CHALLENGE(FRONTIER_FACILITY_PALACE, FRONTIER_MODE_DOUBLES), + FRONTIER_CHALLENGE(FRONTIER_FACILITY_ARENA, FRONTIER_MODE_SINGLES), + FRONTIER_CHALLENGE(FRONTIER_FACILITY_PIKE, FRONTIER_MODE_SINGLES), + FRONTIER_CHALLENGE(FRONTIER_FACILITY_PYRAMID, FRONTIER_MODE_SINGLES) + }; u16 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE); - u16 var2 = VarGet(VAR_FRONTIER_GAMBLER_SET_FACILITY_F); + u16 challenge = VarGet(VAR_FRONTIER_GAMBLER_SET_CHALLENGE); u16 frontierFacilityId = VarGet(VAR_FRONTIER_FACILITY); - if (VarGet(VAR_FRONTIER_GAMBLER_PLACED_BET_F) == 1) + if (VarGet(VAR_FRONTIER_GAMBLER_STATE) == FRONTIER_GAMBLER_PLACED_BET) { - if (gUnknown_085B3104[var2] == (frontierFacilityId << 8) + battleMode) + if (sFrontierChallenges[challenge] == FRONTIER_CHALLENGE(frontierFacilityId, battleMode)) { - if (a0 != 0) + if (won) { - VarSet(VAR_FRONTIER_GAMBLER_PLACED_BET_F, 2); + VarSet(VAR_FRONTIER_GAMBLER_STATE, FRONTIER_GAMBLER_WON); } else { - VarSet(VAR_FRONTIER_GAMBLER_PLACED_BET_F, 3); + VarSet(VAR_FRONTIER_GAMBLER_STATE, FRONTIER_GAMBLER_LOST); } } } } -void sub_813A8FC(void) +void UpdateBattlePointsWindow(void) { u8 string[32]; u32 x; StringCopy(ConvertIntToDecimalStringN(string, gSaveBlock2Ptr->frontier.battlePoints, STR_CONV_MODE_RIGHT_ALIGN, 4), gText_BP); x = GetStringRightAlignXOffset(1, string, 48); - AddTextPrinterParameterized(gUnknown_0203AB6D, 1, string, x, 1, 0, NULL); + AddTextPrinterParameterized(sBattlePointsWindowId, 1, string, x, 1, 0, NULL); } -void sub_813A958(void) +void ShowBattlePointsWindow(void) { - static const struct WindowTemplate gUnknown_085B311C = { + static const struct WindowTemplate sBattlePoints_WindowTemplate = { .bg = 0, .tilemapLeft = 1, .tilemapTop = 1, @@ -2918,19 +2973,19 @@ void sub_813A958(void) .baseBlock = 8, }; - gUnknown_0203AB6D = AddWindow(&gUnknown_085B311C); - SetStandardWindowBorderStyle(gUnknown_0203AB6D, 0); - sub_813A8FC(); - CopyWindowToVram(gUnknown_0203AB6D, 2); + sBattlePointsWindowId = AddWindow(&sBattlePoints_WindowTemplate); + SetStandardWindowBorderStyle(sBattlePointsWindowId, 0); + UpdateBattlePointsWindow(); + CopyWindowToVram(sBattlePointsWindowId, 2); } -void sub_813A988(void) +void CloseBattlePointsWindow(void) { - ClearStdWindowAndFrameToTransparent(gUnknown_0203AB6D, TRUE); - RemoveWindow(gUnknown_0203AB6D); + ClearStdWindowAndFrameToTransparent(sBattlePointsWindowId, TRUE); + RemoveWindow(sBattlePointsWindowId); } -void sub_813A9A4(void) +void TakeFrontierBattlePoints(void) { if (gSaveBlock2Ptr->frontier.battlePoints < gSpecialVar_0x8004) { @@ -2942,11 +2997,11 @@ void sub_813A9A4(void) } } -void sub_813A9D0(void) +void GiveFrontierBattlePoints(void) { - if (gSaveBlock2Ptr->frontier.battlePoints + gSpecialVar_0x8004 > 9999) + if (gSaveBlock2Ptr->frontier.battlePoints + gSpecialVar_0x8004 > MAX_BATTLE_FRONTIER_POINTS) { - gSaveBlock2Ptr->frontier.battlePoints = 9999; + gSaveBlock2Ptr->frontier.battlePoints = MAX_BATTLE_FRONTIER_POINTS; } else { @@ -2954,14 +3009,14 @@ void sub_813A9D0(void) } } -u16 sub_813AA04(void) +u16 GetFrontierBattlePoints(void) { return gSaveBlock2Ptr->frontier.battlePoints; } -void sub_813AA18(void) +void ShowFrontierExchangeCornerItemIconWindow(void) { - static const struct WindowTemplate gUnknown_085B3124 = { + static const struct WindowTemplate sFrontierExchangeCorner_ItemIconWindowTemplate = { .bg = 0, .tilemapLeft = 2, .tilemapTop = 9, @@ -2971,159 +3026,139 @@ void sub_813AA18(void) .baseBlock = 20, }; - gUnknown_0203AB6E = AddWindow(&gUnknown_085B3124); - SetStandardWindowBorderStyle(gUnknown_0203AB6E, 0); - CopyWindowToVram(gUnknown_0203AB6E, 2); + sFrontierExchangeCorner_ItemIconWindowId = AddWindow(&sFrontierExchangeCorner_ItemIconWindowTemplate); + SetStandardWindowBorderStyle(sFrontierExchangeCorner_ItemIconWindowId, 0); + CopyWindowToVram(sFrontierExchangeCorner_ItemIconWindowId, 2); } -void sub_813AA44(void) +void CloseFrontierExchangeCornerItemIconWindow(void) { - ClearStdWindowAndFrameToTransparent(gUnknown_0203AB6E, TRUE); - RemoveWindow(gUnknown_0203AB6E); + ClearStdWindowAndFrameToTransparent(sFrontierExchangeCorner_ItemIconWindowId, TRUE); + RemoveWindow(sFrontierExchangeCorner_ItemIconWindowId); } -static void sub_813AA60(u16 a0, u16 a1) +static void FillFrontierExchangeCornerWindowAndItemIcon(u16 menu, u16 selection) { - static const u16 gUnknown_085B312C[] = { 0x004b, 0x0067, 0x0057, 0x004f, 0x0054, 0x0055, 0x0056, 0x0050, 0x0051, 0x0052, 0xFFFF }; - static const u16 gUnknown_085B3142[] = { 0x0071, 0x006f, 0x0072, 0x0073, 0x0074, 0xFFFF }; - static const u16 gUnknown_085B314E[] = { 0x0040, 0x0043, 0x0041, 0x0046, 0x0042, 0x003f, 0xFFFF }; - static const u16 gUnknown_085B315C[] = { 0x00c8, 0x00b4, 0x00b7, 0x00b9, 0x00b3, 0x00ba, 0x00bb, 0x00c4, 0x00c6, 0xFFFF }; - - static const u8 *const gUnknown_085B3170[] = { - BattleFrontier_BattlePointExchangeServiceCorner_Text_2601AA, - BattleFrontier_BattlePointExchangeServiceCorner_Text_2601D0, - BattleFrontier_BattlePointExchangeServiceCorner_Text_260201, - BattleFrontier_BattlePointExchangeServiceCorner_Text_26022F, - BattleFrontier_BattlePointExchangeServiceCorner_Text_26025B, - BattleFrontier_BattlePointExchangeServiceCorner_Text_260287, - BattleFrontier_BattlePointExchangeServiceCorner_Text_2602B5, - BattleFrontier_BattlePointExchangeServiceCorner_Text_2602E0, - BattleFrontier_BattlePointExchangeServiceCorner_Text_26030F, - BattleFrontier_BattlePointExchangeServiceCorner_Text_26033E, - gText_Exit, - }; - - static const u8 *const gUnknown_085B319C[] = { - BattleFrontier_BattlePointExchangeServiceCorner_Text_26036C, - BattleFrontier_BattlePointExchangeServiceCorner_Text_26036C, - BattleFrontier_BattlePointExchangeServiceCorner_Text_26036C, - BattleFrontier_BattlePointExchangeServiceCorner_Text_26036C, - BattleFrontier_BattlePointExchangeServiceCorner_Text_26036C, - gText_Exit - }; - - static const u8 *const gUnknown_085B31B4[] = { - BattleFrontier_BattlePointExchangeServiceCorner_Text_260397, - BattleFrontier_BattlePointExchangeServiceCorner_Text_2603BE, - BattleFrontier_BattlePointExchangeServiceCorner_Text_2603E6, - BattleFrontier_BattlePointExchangeServiceCorner_Text_26040E, - BattleFrontier_BattlePointExchangeServiceCorner_Text_260436, - BattleFrontier_BattlePointExchangeServiceCorner_Text_26045C, - gText_Exit - }; - - static const u8 *const gUnknown_085B31D0[] = { - BattleFrontier_BattlePointExchangeServiceCorner_Text_26047A, - BattleFrontier_BattlePointExchangeServiceCorner_Text_2604AC, - BattleFrontier_BattlePointExchangeServiceCorner_Text_2604D8, - BattleFrontier_BattlePointExchangeServiceCorner_Text_26050F, - BattleFrontier_BattlePointExchangeServiceCorner_Text_260542, - BattleFrontier_BattlePointExchangeServiceCorner_Text_260575, - BattleFrontier_BattlePointExchangeServiceCorner_Text_2605A8, - BattleFrontier_BattlePointExchangeServiceCorner_Text_2605E2, - BattleFrontier_BattlePointExchangeServiceCorner_Text_260613, - gText_Exit - }; + #include "data/battle_frontier/battle_frontier_exchange_corner.h" - if (a0 > 2 && a0 < 7) + if (menu > SCROLL_MULTI_POKEMON_FAN_CLUB_RATER && menu < SCROLL_MULTI_BERRY_POWDER_VENDOR) { FillWindowPixelRect(0, PIXEL_FILL(1), 0, 0, 216, 32); - switch (a0) + switch (menu) { - case 3: - AddTextPrinterParameterized2(0, 1, gUnknown_085B3170[a1], 0, NULL, 2, 1, 3); - if (gUnknown_085B312C[a1] == 0xFFFF) + case SCROLL_MULTI_BF_EXCHANGE_CORNER_DECOR_VENDOR_1: + AddTextPrinterParameterized2(0, 1, sFrontierExchangeCorner_Decor1Descriptions[selection], 0, NULL, 2, 1, 3); + if (sFrontierExchangeCorner_Decor1[selection] == 0xFFFF) { - sub_813ABD4(gUnknown_085B312C[a1]); + ShowFrontierExchangeCornerItemIcon(sFrontierExchangeCorner_Decor1[selection]); } else { FreeSpriteTilesByTag(5500); FreeSpritePaletteByTag(5500); - gUnknown_0203AB6C = AddDecorationIconObject(gUnknown_085B312C[a1], 33, 88, 0, 5500, 5500); + sScrollableMultichoice_ItemSpriteId = AddDecorationIconObject(sFrontierExchangeCorner_Decor1[selection], 33, 88, 0, 5500, 5500); } break; - case 4: - AddTextPrinterParameterized2(0, 1, gUnknown_085B319C[a1], 0, NULL, 2, 1, 3); - if (gUnknown_085B3142[a1] == 0xFFFF) + case SCROLL_MULTI_BF_EXCHANGE_CORNER_DECOR_VENDOR_2: + AddTextPrinterParameterized2(0, 1, sFrontierExchangeCorner_Decor2Descriptions[selection], 0, NULL, 2, 1, 3); + if (sFrontierExchangeCorner_Decor2[selection] == 0xFFFF) { - sub_813ABD4(gUnknown_085B3142[a1]); + ShowFrontierExchangeCornerItemIcon(sFrontierExchangeCorner_Decor2[selection]); } else { FreeSpriteTilesByTag(5500); FreeSpritePaletteByTag(5500); - gUnknown_0203AB6C = AddDecorationIconObject(gUnknown_085B3142[a1], 33, 88, 0, 5500, 5500); + sScrollableMultichoice_ItemSpriteId = AddDecorationIconObject(sFrontierExchangeCorner_Decor2[selection], 33, 88, 0, 5500, 5500); } break; - case 5: - AddTextPrinterParameterized2(0, 1, gUnknown_085B31B4[a1], 0, NULL, 2, 1, 3); - sub_813ABD4(gUnknown_085B314E[a1]); + case SCROLL_MULTI_BF_EXCHANGE_CORNER_VITAMIN_VENDOR: + AddTextPrinterParameterized2(0, 1, sFrontierExchangeCorner_VitaminsDescriptions[selection], 0, NULL, 2, 1, 3); + ShowFrontierExchangeCornerItemIcon(sFrontierExchangeCorner_Vitamins[selection]); break; - case 6: - AddTextPrinterParameterized2(0, 1, gUnknown_085B31D0[a1], 0, NULL, 2, 1, 3); - sub_813ABD4(gUnknown_085B315C[a1]); + case SCROLL_MULTI_BF_EXCHANGE_CORNER_HOLD_ITEM_VENDOR: + AddTextPrinterParameterized2(0, 1, sFrontierExchangeCorner_HoldItemsDescriptions[selection], 0, NULL, 2, 1, 3); + ShowFrontierExchangeCornerItemIcon(sFrontierExchangeCorner_HoldItems[selection]); break; } } } -static void sub_813ABD4(u16 a0) +static void ShowFrontierExchangeCornerItemIcon(u16 item) { FreeSpriteTilesByTag(5500); FreeSpritePaletteByTag(5500); - gUnknown_0203AB6C = AddItemIconSprite(5500, 5500, a0); + sScrollableMultichoice_ItemSpriteId = AddItemIconSprite(5500, 5500, item); - if (gUnknown_0203AB6C != MAX_SPRITES) + if (sScrollableMultichoice_ItemSpriteId != MAX_SPRITES) { - gSprites[gUnknown_0203AB6C].oam.priority = 0; - gSprites[gUnknown_0203AB6C].pos1.x = 36; - gSprites[gUnknown_0203AB6C].pos1.y = 92; + gSprites[sScrollableMultichoice_ItemSpriteId].oam.priority = 0; + gSprites[sScrollableMultichoice_ItemSpriteId].pos1.x = 36; + gSprites[sScrollableMultichoice_ItemSpriteId].pos1.y = 92; } } -static void sub_813AC44(u16 a0, u16 unused) +static void HideFrontierExchangeCornerItemIcon(u16 menu, u16 unused) { - if (gUnknown_0203AB6C != MAX_SPRITES) + if (sScrollableMultichoice_ItemSpriteId != MAX_SPRITES) { - switch (a0) + switch (menu) { - case 3 ... 6: - DestroySpriteAndFreeResources(&gSprites[gUnknown_0203AB6C]); + case SCROLL_MULTI_BF_EXCHANGE_CORNER_DECOR_VENDOR_1: + case SCROLL_MULTI_BF_EXCHANGE_CORNER_DECOR_VENDOR_2: + case SCROLL_MULTI_BF_EXCHANGE_CORNER_VITAMIN_VENDOR: + case SCROLL_MULTI_BF_EXCHANGE_CORNER_HOLD_ITEM_VENDOR: + DestroySpriteAndFreeResources(&gSprites[sScrollableMultichoice_ItemSpriteId]); break; } - gUnknown_0203AB6C = MAX_SPRITES; - } -} + sScrollableMultichoice_ItemSpriteId = MAX_SPRITES; + } +} + +static const u16 sBattleFrontier_TutorMoves1[] = +{ + MOVE_SOFT_BOILED, + MOVE_SEISMIC_TOSS, + MOVE_DREAM_EATER, + MOVE_MEGA_PUNCH, + MOVE_MEGA_KICK, + MOVE_BODY_SLAM, + MOVE_ROCK_SLIDE, + MOVE_COUNTER, + MOVE_THUNDER_WAVE, + MOVE_SWORDS_DANCE +}; -static const u16 gUnknown_085B31F8[] = { 0x0087, 0x0045, 0x008a, 0x0005, 0x0019, 0x0022, 0x009d, 0x0044, 0x0056, 0x000e }; -static const u16 gUnknown_085B320C[] = { 0x006f, 0x00ad, 0x00bd, 0x0081, 0x00c4, 0x00cb, 0x00f4, 0x0008, 0x0009, 0x0007 }; +static const u16 sBattleFrontier_TutorMoves2[] = +{ + MOVE_DEFENSE_CURL, + MOVE_SNORE, + MOVE_MUD_SLAP, + MOVE_SWIFT, + MOVE_ICY_WIND, + MOVE_ENDURE, + MOVE_PSYCH_UP, + MOVE_ICE_PUNCH, + MOVE_THUNDER_PUNCH, + MOVE_FIRE_PUNCH +}; -void sub_813AC7C(void) +void BufferBattleFrontierTutorMoveName(void) { if (gSpecialVar_0x8005 != 0) { - StringCopy(gStringVar1, gMoveNames[gUnknown_085B320C[gSpecialVar_0x8004]]); + StringCopy(gStringVar1, gMoveNames[sBattleFrontier_TutorMoves2[gSpecialVar_0x8004]]); } else { - StringCopy(gStringVar1, gMoveNames[gUnknown_085B31F8[gSpecialVar_0x8004]]); + StringCopy(gStringVar1, gMoveNames[sBattleFrontier_TutorMoves1[gSpecialVar_0x8004]]); } } -static void sub_813ACE8(u8 a0, u16 a1) +static void ShowBattleFrontierTutorWindow(u8 menu, u16 selection) { - static const struct WindowTemplate gUnknown_085B3220 = { + static const struct WindowTemplate sBattleFrontierTutor_WindowTemplate = + { .bg = 0, .tilemapLeft = 1, .tilemapTop = 7, @@ -3133,20 +3168,21 @@ static void sub_813ACE8(u8 a0, u16 a1) .baseBlock = 28, }; - if (a0 == 9 || a0 == 10) + if (menu == SCROLL_MULTI_BF_MOVE_TUTOR_1 || menu == SCROLL_MULTI_BF_MOVE_TUTOR_2) { if (gSpecialVar_0x8006 == 0) { - gUnknown_0203AB5E = AddWindow(&gUnknown_085B3220); - SetStandardWindowBorderStyle(gUnknown_0203AB5E, 0); + sTutorMoveAndElevatorWindowId = AddWindow(&sBattleFrontierTutor_WindowTemplate); + SetStandardWindowBorderStyle(sTutorMoveAndElevatorWindowId, 0); } - sub_813AD34(a0, a1); + ShowBattleFrontierTutorMoveDescription(menu, selection); } } -static void sub_813AD34(u8 a0, u16 a1) +static void ShowBattleFrontierTutorMoveDescription(u8 menu, u16 selection) { - static const u8 *const gUnknown_085B3228[] = { + static const u8 *const sBattleFrontier_TutorMoveDescriptions1[] = + { BattleFrontier_Lounge7_Text_265E30, BattleFrontier_Lounge7_Text_265E5B, BattleFrontier_Lounge7_Text_265E8A, @@ -3160,7 +3196,8 @@ static void sub_813AD34(u8 a0, u16 a1) gText_Exit, }; - static const u8 *const gUnknown_085B3254[] = { + static const u8 *const sBattleFrontier_TutorMoveDescriptions2[] = + { BattleFrontier_Lounge7_Text_26600A, BattleFrontier_Lounge7_Text_26603E, BattleFrontier_Lounge7_Text_266070, @@ -3174,26 +3211,27 @@ static void sub_813AD34(u8 a0, u16 a1) gText_Exit, }; - if (a0 == 9 || a0 == 10) + if (menu == SCROLL_MULTI_BF_MOVE_TUTOR_1 || menu == SCROLL_MULTI_BF_MOVE_TUTOR_2) { - FillWindowPixelRect(gUnknown_0203AB5E, PIXEL_FILL(1), 0, 0, 96, 48); - if (a0 == 10) + FillWindowPixelRect(sTutorMoveAndElevatorWindowId, PIXEL_FILL(1), 0, 0, 96, 48); + if (menu == SCROLL_MULTI_BF_MOVE_TUTOR_2) { - AddTextPrinterParameterized(gUnknown_0203AB5E, 1, gUnknown_085B3254[a1], 0, 1, 0, NULL); + AddTextPrinterParameterized(sTutorMoveAndElevatorWindowId, 1, sBattleFrontier_TutorMoveDescriptions2[selection], 0, 1, 0, NULL); } else { - AddTextPrinterParameterized(gUnknown_0203AB5E, 1, gUnknown_085B3228[a1], 0, 1, 0, NULL); + AddTextPrinterParameterized(sTutorMoveAndElevatorWindowId, 1, sBattleFrontier_TutorMoveDescriptions1[selection], 0, 1, 0, NULL); } } } -void sub_813ADB8(void) +void CloseBattleFrontierTutorWindow(void) { - ClearStdWindowAndFrameToTransparent(gUnknown_0203AB5E, TRUE); - RemoveWindow(gUnknown_0203AB5E); + ClearStdWindowAndFrameToTransparent(sTutorMoveAndElevatorWindowId, TRUE); + RemoveWindow(sTutorMoveAndElevatorWindowId); } +// Never called void sub_813ADD4(void) { u16 scrollOffset, selectedRow; @@ -3205,9 +3243,9 @@ void sub_813ADD4(void) ListMenuGetScrollAndRow(task->data[14], &scrollOffset, &selectedRow); SetStandardWindowBorderStyle(task->data[13], 0); - for (i = 0; i < 6; i++) + for (i = 0; i < MAX_SCROLL_MULTI_ON_SCREEN; i++) { - AddTextPrinterParameterized5(task->data[13], 1, gUnknown_085B2CF0[gSpecialVar_0x8004][scrollOffset + i], 10, i * 16, TEXT_SPEED_FF, NULL, 0, 0); + AddTextPrinterParameterized5(task->data[13], 1, sScrollableMenuOptions[gSpecialVar_0x8004][scrollOffset + i], 10, i * 16, TEXT_SPEED_FF, NULL, 0, 0); } AddTextPrinterParameterized(task->data[13], 1, gText_SelectorArrow, 0, selectedRow * 16, TEXT_SPEED_FF, NULL); @@ -3216,44 +3254,45 @@ void sub_813ADD4(void) } } -void sub_813AEB4(void) +void GetBattleFrontierTutorMoveIndex(void) { u8 i; - u16 temp1 = 0; - u16 temp2 = 0; + u16 moveTutor = 0; + u16 moveIndex = 0; gSpecialVar_0x8005 = 0; - temp1 = VarGet(VAR_TEMP_E); - temp2 = VarGet(VAR_TEMP_D); + moveTutor = VarGet(VAR_TEMP_E); + moveIndex = VarGet(VAR_TEMP_D); - if (temp1 != 0) + if (moveTutor != 0) { i = 0; do { - if (gTutorMoves[i] == gUnknown_085B320C[temp2]) + if (gTutorMoves[i] == sBattleFrontier_TutorMoves2[moveIndex]) { gSpecialVar_0x8005 = i; break; } i++; - } while (i < 30); + } while (i < TUTOR_MOVE_COUNT); } else { i = 0; do { - if (gTutorMoves[i] == gUnknown_085B31F8[temp2]) + if (gTutorMoves[i] == sBattleFrontier_TutorMoves1[moveIndex]) { gSpecialVar_0x8005 = i; break; } i++; - } while (i < 30); + } while (i < TUTOR_MOVE_COUNT); } } +// Never called void sub_813AF48(void) { u8 taskId = FindTaskIdByFunc(sub_813A600); @@ -3261,7 +3300,7 @@ void sub_813AF48(void) { struct Task *task = &gTasks[taskId]; DestroyListMenuTask(task->data[14], NULL, NULL); - Free(gUnknown_0203AB64); + Free(sScrollableMultichoice_ListMenuItem); ClearStdWindowAndFrameToTransparent(task->data[13], TRUE); FillWindowPixelBuffer(task->data[13], PIXEL_FILL(0)); ClearWindowTilemap(task->data[13]); @@ -3405,47 +3444,47 @@ void sub_813B1D0(void) BlendPalettes(0x04000000, 16, 0); } -void set_unknown_box_id(u8 id) +void SetPCBoxToSendMon(u8 boxId) { - gUnknown_0203AB6F = id; + sPCBoxToSendMon = boxId; } -u16 get_unknown_box_id(void) +u16 GetPCBoxToSendMon(void) { - return gUnknown_0203AB6F; + return sPCBoxToSendMon; } -bool8 sub_813B21C(void) +bool8 ShouldShowBoxWasFullMessage(void) { - if (FlagGet(FLAG_SYS_STORAGE_UNKNOWN_FLAG) == FALSE) + if (!FlagGet(FLAG_SHOWN_BOX_WAS_FULL_MESSAGE)) { - if (StorageGetCurrentBox() != VarGet(VAR_STORAGE_UNKNOWN)) + if (StorageGetCurrentBox() != VarGet(VAR_PC_BOX_TO_SEND_MON)) { - FlagSet(FLAG_SYS_STORAGE_UNKNOWN_FLAG); + FlagSet(FLAG_SHOWN_BOX_WAS_FULL_MESSAGE); return TRUE; } } return FALSE; } -bool8 sub_813B260(void) +bool8 IsDestinationBoxFull(void) { int box; int i; - set_unknown_box_id(VarGet(VAR_STORAGE_UNKNOWN)); + SetPCBoxToSendMon(VarGet(VAR_PC_BOX_TO_SEND_MON)); box = StorageGetCurrentBox(); do { for (i = 0; i < IN_BOX_COUNT; i++) { - if (GetBoxMonData(GetBoxedMonPtr(box, i), MON_DATA_SPECIES, 0) == 0) + if (GetBoxMonData(GetBoxedMonPtr(box, i), MON_DATA_SPECIES, 0) == SPECIES_NONE) { - if (get_unknown_box_id() != box) + if (GetPCBoxToSendMon() != box) { - FlagClear(FLAG_SYS_STORAGE_UNKNOWN_FLAG); + FlagClear(FLAG_SHOWN_BOX_WAS_FULL_MESSAGE); } - VarSet(VAR_STORAGE_UNKNOWN, box); - return sub_813B21C(); + VarSet(VAR_PC_BOX_TO_SEND_MON, box); + return ShouldShowBoxWasFullMessage(); } } @@ -3606,35 +3645,37 @@ void Unused_SetWeatherSunny(void) SetCurrentAndNextWeather(WEATHER_SUNNY); } -bool32 sub_813B490(void) -{ - static const u8 gUnknown_085B3420[][3] = { - { 0x02, 0x04, 0x01 }, - { 0x04, 0x04, 0x01 }, - { 0x05, 0x00, 0x01 }, - { 0x06, 0x03, 0x01 }, - { 0x08, 0x06, 0x01 }, - { 0x09, 0x0d, 0x01 }, - { 0x0a, 0x07, 0x01 }, - { 0x0b, 0x07, 0x01 }, - { 0x0c, 0x04, 0x01 }, - { 0x0e, 0x05, 0x01 }, - { 0x0f, 0x04, 0x01 }, - { 0x1a, 0x37, 0x01 } +// Always returns 1 +u32 GetMartEmployeeObjectEventId(void) +{ + static const u8 sPokeMarts[][3] = + { + { MAP_GROUP(OLDALE_TOWN_MART), MAP_NUM(OLDALE_TOWN_MART), 1 }, + { MAP_GROUP(LAVARIDGE_TOWN_MART), MAP_NUM(LAVARIDGE_TOWN_MART), 1 }, + { MAP_GROUP(FALLARBOR_TOWN_MART), MAP_NUM(FALLARBOR_TOWN_MART), 1 }, + { MAP_GROUP(VERDANTURF_TOWN_MART), MAP_NUM(VERDANTURF_TOWN_MART), 1 }, + { MAP_GROUP(PETALBURG_CITY_MART), MAP_NUM(PETALBURG_CITY_MART), 1 }, + { MAP_GROUP(SLATEPORT_CITY_MART), MAP_NUM(SLATEPORT_CITY_MART), 1 }, + { MAP_GROUP(MAUVILLE_CITY_MART), MAP_NUM(MAUVILLE_CITY_MART), 1 }, + { MAP_GROUP(RUSTBORO_CITY_MART), MAP_NUM(RUSTBORO_CITY_MART), 1 }, + { MAP_GROUP(FORTREE_CITY_MART), MAP_NUM(FORTREE_CITY_MART), 1 }, + { MAP_GROUP(MOSSDEEP_CITY_MART), MAP_NUM(MOSSDEEP_CITY_MART), 1 }, + { MAP_GROUP(SOOTOPOLIS_CITY_MART), MAP_NUM(SOOTOPOLIS_CITY_MART), 1 }, + { MAP_GROUP(BATTLE_FRONTIER_MART), MAP_NUM(BATTLE_FRONTIER_MART), 1 } }; u8 i; - for (i = 0; i < 12; i++) + for (i = 0; i < ARRAY_COUNT(sPokeMarts); i++) { - if (gSaveBlock1Ptr->location.mapGroup == gUnknown_085B3420[i][0]) + if (gSaveBlock1Ptr->location.mapGroup == sPokeMarts[i][0]) { - if (gSaveBlock1Ptr->location.mapNum == gUnknown_085B3420[i][1]) + if (gSaveBlock1Ptr->location.mapNum == sPokeMarts[i][1]) { - return gUnknown_085B3420[i][2]; + return sPokeMarts[i][2]; } } } - return TRUE; + return 1; } bool32 sub_813B4E0(void) @@ -3648,6 +3689,7 @@ bool32 sub_813B4E0(void) return FALSE; } +// Always returns FALSE bool32 sub_813B514(void) { if (!VarGet(VAR_ALWAYS_ZERO_0x403F)) @@ -3659,7 +3701,7 @@ bool32 sub_813B514(void) void sub_813B534(void) { - gUnknown_0203AB70 = gBattleTypeFlags; + sUnknown_0203AB70 = gBattleTypeFlags; gBattleTypeFlags = 0; if (!gReceivedRemoteLinkPlayers) { @@ -3793,14 +3835,14 @@ static void sub_813B57C(u8 taskId) { sub_800AC34(); } - gBattleTypeFlags = gUnknown_0203AB70; + gBattleTypeFlags = sUnknown_0203AB70; EnableBothScriptContexts(); DestroyTask(taskId); break; } } -void sub_813B7D8(void) +void Script_DoRayquazaScene(void) { if (gSpecialVar_0x8004 == 0) { @@ -3870,23 +3912,25 @@ static void _fwalk(u8 taskId) } } -void sub_813B968(void) +void GetBattlePyramidHint(void) { gSpecialVar_Result = gSpecialVar_0x8004 / 7; gSpecialVar_Result -= (gSpecialVar_Result / 20) * 20; } -void sub_813B9A0(void) +// Used to avoid a potential softlock if the player respawns on Dewford with no way off +void ResetHealLocationFromDewford(void) { if (gSaveBlock1Ptr->lastHealLocation.mapGroup == MAP_GROUP(DEWFORD_TOWN) && gSaveBlock1Ptr->lastHealLocation.mapNum == MAP_NUM(DEWFORD_TOWN)) { - SetLastHealLocationWarp(3); + SetLastHealLocationWarp(HEAL_LOCATION_PETALBURG_CITY); } } -bool8 sub_813B9C0(void) +bool8 InPokemonCenter(void) { - static const u16 gUnknown_085B3444[] = { + static const u16 sPokemonCenters[] = + { MAP_OLDALE_TOWN_POKEMON_CENTER_1F, MAP_DEWFORD_TOWN_POKEMON_CENTER_1F, MAP_LAVARIDGE_TOWN_POKEMON_CENTER_1F, @@ -3914,9 +3958,9 @@ bool8 sub_813B9C0(void) int i; u16 map = (gSaveBlock1Ptr->location.mapGroup << 8) + gSaveBlock1Ptr->location.mapNum; - for (i = 0; gUnknown_085B3444[i] != 0xFFFF; i++) + for (i = 0; sPokemonCenters[i] != 0xFFFF; i++) { - if (gUnknown_085B3444[i] == map) + if (sPokemonCenters[i] == map) { return TRUE; } diff --git a/src/frontier_util.c b/src/frontier_util.c index 536e23e30..88e466e8c 100644 --- a/src/frontier_util.c +++ b/src/frontier_util.c @@ -794,15 +794,15 @@ static void sub_81A17A0(void) case 0: break; case 1: - sub_813A878(0); + FrontierGamblerSetWonOrLost(FALSE); VarSet(VAR_TEMP_0, gSaveBlock2Ptr->frontier.field_CA8); break; case 4: - sub_813A878(0); + FrontierGamblerSetWonOrLost(FALSE); VarSet(VAR_TEMP_0, gSaveBlock2Ptr->frontier.field_CA8); break; case 3: - sub_813A878(1); + FrontierGamblerSetWonOrLost(TRUE); VarSet(VAR_TEMP_0, gSaveBlock2Ptr->frontier.field_CA8); break; case 2: diff --git a/src/naming_screen.c b/src/naming_screen.c index 7da7d99b0..472489a26 100644 --- a/src/naming_screen.c +++ b/src/naming_screen.c @@ -541,16 +541,16 @@ static void DisplaySentToPCMessage(void) { u8 stringToDisplay = 0; - if (!sub_813B260()) + if (!IsDestinationBoxFull()) { - StringCopy(gStringVar1, GetBoxNamePtr(VarGet(VAR_STORAGE_UNKNOWN))); + StringCopy(gStringVar1, GetBoxNamePtr(VarGet(VAR_PC_BOX_TO_SEND_MON))); StringCopy(gStringVar2, gNamingScreenData->destBuffer); } else { - StringCopy(gStringVar1, GetBoxNamePtr(VarGet(VAR_STORAGE_UNKNOWN))); + StringCopy(gStringVar1, GetBoxNamePtr(VarGet(VAR_PC_BOX_TO_SEND_MON))); StringCopy(gStringVar2, gNamingScreenData->destBuffer); - StringCopy(gStringVar3, GetBoxNamePtr(get_unknown_box_id())); + StringCopy(gStringVar3, GetBoxNamePtr(GetPCBoxToSendMon())); stringToDisplay = 2; } diff --git a/src/option_menu.c b/src/option_menu.c index 3ffb2738f..e0473b5c3 100644 --- a/src/option_menu.c +++ b/src/option_menu.c @@ -48,6 +48,13 @@ enum WIN_OPTIONS }; +#define YPOS_TEXTSPEED (MENUITEM_TEXTSPEED * 16) +#define YPOS_BATTLESCENE (MENUITEM_BATTLESCENE * 16) +#define YPOS_BATTLESTYLE (MENUITEM_BATTLESTYLE * 16) +#define YPOS_SOUND (MENUITEM_SOUND * 16) +#define YPOS_BUTTONMODE (MENUITEM_BUTTONMODE * 16) +#define YPOS_FRAMETYPE (MENUITEM_FRAMETYPE * 16) + // this file's functions static void Task_OptionMenuFadeIn(u8 taskId); static void Task_OptionMenuProcessInput(u8 taskId); @@ -80,13 +87,13 @@ static const u8 sEqualSignGfx[] = INCBIN_U8("graphics/misc/option_menu_equals_si static const u8 *const sOptionMenuItemsNames[MENUITEM_COUNT] = { - gText_TextSpeed, - gText_BattleScene, - gText_BattleStyle, - gText_Sound, - gText_ButtonMode, - gText_Frame, - gText_OptionMenuCancel, + [MENUITEM_TEXTSPEED] = gText_TextSpeed, + [MENUITEM_BATTLESCENE] = gText_BattleScene, + [MENUITEM_BATTLESTYLE] = gText_BattleStyle, + [MENUITEM_SOUND] = gText_Sound, + [MENUITEM_BUTTONMODE] = gText_ButtonMode, + [MENUITEM_FRAMETYPE] = gText_Frame, + [MENUITEM_CANCEL] = gText_OptionMenuCancel, }; static const struct WindowTemplate sOptionMenuWinTemplates[] = @@ -280,12 +287,12 @@ static void Task_OptionMenuProcessInput(u8 taskId) if (gTasks[taskId].data[TD_MENUSELECTION] > 0) gTasks[taskId].data[TD_MENUSELECTION]--; else - gTasks[taskId].data[TD_MENUSELECTION] = 6; + gTasks[taskId].data[TD_MENUSELECTION] = MENUITEM_CANCEL; HighlightOptionMenuItem(gTasks[taskId].data[TD_MENUSELECTION]); } else if (gMain.newKeys & DPAD_DOWN) { - if (gTasks[taskId].data[TD_MENUSELECTION] <= 5) + if (gTasks[taskId].data[TD_MENUSELECTION] < MENUITEM_CANCEL) gTasks[taskId].data[TD_MENUSELECTION]++; else gTasks[taskId].data[TD_MENUSELECTION] = 0; @@ -431,7 +438,7 @@ static void TextSpeed_DrawChoices(u8 selection) styles[2] = 0; styles[selection] = 1; - DrawOptionMenuChoice(gText_TextSpeedSlow, 104, 0, styles[0]); + DrawOptionMenuChoice(gText_TextSpeedSlow, 104, YPOS_TEXTSPEED, styles[0]); widthSlow = GetStringWidth(1, gText_TextSpeedSlow, 0); widthMid = GetStringWidth(1, gText_TextSpeedMid, 0); @@ -439,9 +446,9 @@ static void TextSpeed_DrawChoices(u8 selection) widthMid -= 94; xMid = (widthSlow - widthMid - widthFast) / 2 + 104; - DrawOptionMenuChoice(gText_TextSpeedMid, xMid, 0, styles[1]); + DrawOptionMenuChoice(gText_TextSpeedMid, xMid, YPOS_TEXTSPEED, styles[1]); - DrawOptionMenuChoice(gText_TextSpeedFast, GetStringRightAlignXOffset(1, gText_TextSpeedFast, 198), 0, styles[2]); + DrawOptionMenuChoice(gText_TextSpeedFast, GetStringRightAlignXOffset(1, gText_TextSpeedFast, 198), YPOS_TEXTSPEED, styles[2]); } static u8 BattleScene_ProcessInput(u8 selection) @@ -463,8 +470,8 @@ static void BattleScene_DrawChoices(u8 selection) styles[1] = 0; styles[selection] = 1; - DrawOptionMenuChoice(gText_BattleSceneOn, 104, 16, styles[0]); - DrawOptionMenuChoice(gText_BattleSceneOff, GetStringRightAlignXOffset(1, gText_BattleSceneOff, 198), 16, styles[1]); + DrawOptionMenuChoice(gText_BattleSceneOn, 104, YPOS_BATTLESCENE, styles[0]); + DrawOptionMenuChoice(gText_BattleSceneOff, GetStringRightAlignXOffset(1, gText_BattleSceneOff, 198), YPOS_BATTLESCENE, styles[1]); } static u8 BattleStyle_ProcessInput(u8 selection) @@ -486,8 +493,8 @@ static void BattleStyle_DrawChoices(u8 selection) styles[1] = 0; styles[selection] = 1; - DrawOptionMenuChoice(gText_BattleStyleShift, 104, 32, styles[0]); - DrawOptionMenuChoice(gText_BattleStyleSet, GetStringRightAlignXOffset(1, gText_BattleStyleSet, 198), 32, styles[1]); + DrawOptionMenuChoice(gText_BattleStyleShift, 104, YPOS_BATTLESTYLE, styles[0]); + DrawOptionMenuChoice(gText_BattleStyleSet, GetStringRightAlignXOffset(1, gText_BattleStyleSet, 198), YPOS_BATTLESTYLE, styles[1]); } static u8 Sound_ProcessInput(u8 selection) @@ -510,8 +517,8 @@ static void Sound_DrawChoices(u8 selection) styles[1] = 0; styles[selection] = 1; - DrawOptionMenuChoice(gText_SoundMono, 104, 48, styles[0]); - DrawOptionMenuChoice(gText_SoundStereo, GetStringRightAlignXOffset(1, gText_SoundStereo, 198), 48, styles[1]); + DrawOptionMenuChoice(gText_SoundMono, 104, YPOS_SOUND, styles[0]); + DrawOptionMenuChoice(gText_SoundStereo, GetStringRightAlignXOffset(1, gText_SoundStereo, 198), YPOS_SOUND, styles[1]); } static u8 FrameType_ProcessInput(u8 selection) @@ -568,8 +575,8 @@ static void FrameType_DrawChoices(u8 selection) text[i] = EOS; - DrawOptionMenuChoice(gText_FrameType, 104, 80, 0); - DrawOptionMenuChoice(text, 128, 80, 1); + DrawOptionMenuChoice(gText_FrameType, 104, YPOS_FRAMETYPE, 0); + DrawOptionMenuChoice(text, 128, YPOS_FRAMETYPE, 1); } static u8 ButtonMode_ProcessInput(u8 selection) @@ -605,7 +612,7 @@ static void ButtonMode_DrawChoices(u8 selection) styles[2] = 0; styles[selection] = 1; - DrawOptionMenuChoice(gText_ButtonTypeNormal, 104, 64, styles[0]); + DrawOptionMenuChoice(gText_ButtonTypeNormal, 104, YPOS_BUTTONMODE, styles[0]); widthNormal = GetStringWidth(1, gText_ButtonTypeNormal, 0); widthLR = GetStringWidth(1, gText_ButtonTypeLR, 0); @@ -613,9 +620,9 @@ static void ButtonMode_DrawChoices(u8 selection) widthLR -= 94; xLR = (widthNormal - widthLR - widthLA) / 2 + 104; - DrawOptionMenuChoice(gText_ButtonTypeLR, xLR, 64, styles[1]); + DrawOptionMenuChoice(gText_ButtonTypeLR, xLR, YPOS_BUTTONMODE, styles[1]); - DrawOptionMenuChoice(gText_ButtonTypeLEqualsA, GetStringRightAlignXOffset(1, gText_ButtonTypeLEqualsA, 198), 64, styles[2]); + DrawOptionMenuChoice(gText_ButtonTypeLEqualsA, GetStringRightAlignXOffset(1, gText_ButtonTypeLEqualsA, 198), YPOS_BUTTONMODE, styles[2]); } static void DrawTextOption(void) diff --git a/src/overworld.c b/src/overworld.c index 51d9ad9b5..0cac8390a 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -1759,7 +1759,7 @@ void CB2_ContinueSavedGame(void) static void FieldClearVBlankHBlankCallbacks(void) { - if (warp0_in_pokecenter() == TRUE) + if (UsedPokemonCenterWarp() == TRUE) CloseLink(); if (gWirelessCommType != 0) diff --git a/src/pokemon.c b/src/pokemon.c index 4833f2db6..29358b22f 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -4329,7 +4329,7 @@ u8 SendMonToPC(struct Pokemon* mon) { s32 boxNo, boxPos; - set_unknown_box_id(VarGet(VAR_STORAGE_UNKNOWN)); + SetPCBoxToSendMon(VarGet(VAR_PC_BOX_TO_SEND_MON)); boxNo = StorageGetCurrentBox(); @@ -4344,9 +4344,9 @@ u8 SendMonToPC(struct Pokemon* mon) CopyMon(checkingMon, &mon->box, sizeof(mon->box)); gSpecialVar_MonBoxId = boxNo; gSpecialVar_MonBoxPos = boxPos; - if (get_unknown_box_id() != boxNo) - FlagClear(FLAG_SYS_STORAGE_UNKNOWN_FLAG); - VarSet(VAR_STORAGE_UNKNOWN, boxNo); + if (GetPCBoxToSendMon() != boxNo) + FlagClear(FLAG_SHOWN_BOX_WAS_FULL_MESSAGE); + VarSet(VAR_PC_BOX_TO_SEND_MON, boxNo); return MON_GIVEN_TO_PC; } } diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index 4cd1a4772..fa9e61504 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -453,7 +453,7 @@ EWRAM_DATA static bool8 sInPartyMenu = 0; EWRAM_DATA static u8 sCurrentBoxOption = 0; EWRAM_DATA static u8 gUnknown_02039D0E = 0; EWRAM_DATA static u8 sWhichToReshow = 0; -EWRAM_DATA static u8 gUnknown_02039D10 = 0; +EWRAM_DATA static u8 sLastUsedBox = 0; EWRAM_DATA static u16 gUnknown_02039D12 = 0; EWRAM_DATA static struct Pokemon gUnknown_02039D14 = {0}; EWRAM_DATA static s8 sBoxCursorArea = 0; @@ -2167,7 +2167,7 @@ static void Cb2_EnterPSS(u8 boxOption) gUnknown_02039D12 = 0; sPSSData->state = 0; sPSSData->taskId = CreateTask(Cb_InitPSS, 3); - gUnknown_02039D10 = StorageGetCurrentBox(); + sLastUsedBox = StorageGetCurrentBox(); SetMainCallback2(Cb2_PSS); } } @@ -4366,10 +4366,10 @@ static bool8 DoShowPartyMenu(void) static void sub_80CABE0(void) { - if (gUnknown_02039D10 != StorageGetCurrentBox()) + if (sLastUsedBox != StorageGetCurrentBox()) { - FlagClear(FLAG_SYS_STORAGE_UNKNOWN_FLAG); - VarSet(VAR_STORAGE_UNKNOWN, StorageGetCurrentBox()); + FlagClear(FLAG_SHOWN_BOX_WAS_FULL_MESSAGE); + VarSet(VAR_PC_BOX_TO_SEND_MON, StorageGetCurrentBox()); } } diff --git a/src/region_map.c b/src/region_map.c index a98964e5c..ea2cbfa6a 100644 --- a/src/region_map.c +++ b/src/region_map.c @@ -24,6 +24,7 @@ #include "region_map.h" #include "constants/region_map_sections.h" #include "heal_location.h" +#include "constants/field_specials.h" #include "constants/heal_locations.h" #include "constants/map_types.h" #include "constants/rgb.h" @@ -1144,20 +1145,20 @@ static void RegionMap_InitializeStateBasedOnSSTidalLocation(void) x = 0; switch (GetSSTidalLocation(&mapGroup, &mapNum, &xOnMap, &yOnMap)) { - case 1: + case SS_TIDAL_LOCATION_SLATEPORT: gRegionMap->mapSecId = MAPSEC_SLATEPORT_CITY; break; - case 2: + case SS_TIDAL_LOCATION_LILYCOVE: gRegionMap->mapSecId = MAPSEC_LILYCOVE_CITY; break; - case 3: + case SS_TIDAL_LOCATION_ROUTE124: gRegionMap->mapSecId = MAPSEC_ROUTE_124; break; - case 4: + case SS_TIDAL_LOCATION_ROUTE131: gRegionMap->mapSecId = MAPSEC_ROUTE_131; break; default: - case 0: + case SS_TIDAL_LOCATION_OTHER: mapHeader = Overworld_GetMapHeaderByGroupAndId(mapGroup, mapNum); gRegionMap->mapSecId = mapHeader->regionMapSectionId; diff --git a/src/script_menu.c b/src/script_menu.c index c1dc2af63..c31c8d76b 100644 --- a/src/script_menu.c +++ b/src/script_menu.c @@ -13,6 +13,7 @@ #include "strings.h" #include "task.h" #include "text.h" +#include "constants/field_specials.h" #include "constants/items.h" #include "constants/songs.h" @@ -1493,8 +1494,8 @@ static void sub_80E2578(void) count = temp; if (count == 7) { - gSpecialVar_0x8004 = 11; - sub_813A128(); + gSpecialVar_0x8004 = SCROLL_MULTI_SS_TIDAL_DESTINATION; + ShowScrollableMultichoice(); } else { @@ -2786,11 +2786,11 @@ bool8 GetPriceReduction(u8 newsKind) { u8 i; - if (newsKind == 0) + if (newsKind == POKENEWS_NONE) { return FALSE; } - for (i = 0; i < 16; i ++) + for (i = 0; i < POKE_NEWS_COUNT; i ++) { if (gSaveBlock1Ptr->pokeNews[i].kind == newsKind) { |