diff --git a/asm/macros/frscrcmd.inc b/asm/macros/frscrcmd.inc index 71f045c971..43a9246f5c 100644 --- a/asm/macros/frscrcmd.inc +++ b/asm/macros/frscrcmd.inc @@ -922,74 +922,74 @@ .byte \index .endm - .macro FrontierScrCmd_AA - .short FRSCRCMD_AA + .macro InitWFCFacilitySelector + .short FRSCRCMD_INITWFCFACILITYSELECTOR .endm - .macro FrontierScrCmd_AB - .short FRSCRCMD_AB + .macro FreeWFCFacilitySelector + .short FRSCRCMD_FREEWFCFACILITYSELECTOR .endm - .macro FrontierScrCmd_AC arg0, arg1, arg2, arg3 - .short FRSCRCMD_AC - .short \arg0 + .macro WFCFacilitySelector_SendCommMessage command, arg1, arg2, success + .short FRSCRCMD_WFCFACILITYSELECTOR_SENDCOMMMESSAGE + .short \command .short \arg1 .short \arg2 - .short \arg3 + .short \success .endm - .macro FrontierScrCmd_AD arg0 - .short FRSCRCMD_AD - .short \arg0 + .macro WFCFacilitySelector_WaitForCommResponses unused + .short FRSCRCMD_WFCFACILITYSELECTOR_WAITFORCOMMRESPONSES + .short \unused .endm - .macro FrontierScrCmd_AE arg0, arg1 - .short FRSCRCMD_AE - .short \arg0 - .short \arg1 + .macro CheckIfSameFacilityChosen facility, result + .short FRSCRCMD_CHECKIFSAMEFACILITYCHOSEN + .short \facility + .short \result .endm - .macro FrontierScrCmd_AF arg0, arg1, arg2 - .short FRSCRCMD_AF - .short \arg0 - .short \arg1 - .short \arg2 + .macro ManageFacilitySelectorSubApp unused, action, result + .short FRSCRCMD_MANAGEFACILITYSELECTORSUBAPP + .short \unused + .short \action + .short \result .endm - .macro FrontierScrCmd_B0 arg0, arg1 - .short FRSCRCMD_B0 - .short \arg0 - .short \arg1 + .macro GetSelectedPartyMenuSlots selectedSlot1, selectedSlot2 + .short FRSCRCMD_GETSELECTEDPARTYMENUSLOTS + .short \selectedSlot1 + .short \selectedSlot2 .endm - .macro FrontierScrCmd_B1 arg0 - .short FRSCRCMD_B1 - .short \arg0 + .macro CheckIfPartnerDroppedOut didDropOut + .short FRSCRCMD_CHECKIFPARTNERDROPPEDOUT + .short \didDropOut .endm - .macro FrontierScrCmd_B2 arg0, arg1, arg2, arg3 - .short FRSCRCMD_B2 - .byte \arg0 + .macro CallWFCFacilitySelectorFunction command, arg1, arg2, returnVar + .short FRSCRCMD_CALLWFCFACILITYSELECTORFUNCTION + .byte \command .byte \arg1 .byte \arg2 - .short \arg3 + .short \returnVar .endm - .macro FrontierScrCmd_B3 - .short FRSCRCMD_B3 + .macro InitBattleTower + .short FRSCRCMD_INITBATTLETOWER .endm - .macro FrontierScrCmd_B4 arg0 - .short FRSCRCMD_B4 - .short \arg0 + .macro SendTowerTrainerIDList success + .short FRSCRCMD_SENDTOWERTRAINERIDLIST + .short \success .endm - .macro FrontierScrCmd_B5 - .short FRSCRCMD_B5 + .macro WaitForTowerTrainerIDListResponses + .short FRSCRCMD_WAITFORTOWERTRAINERIDLISTRESPONSES .endm - .macro ClearTowerStruct - .short FRSCRCMD_CLEARTOWERSTRUCT + .macro FreeBattleTower + .short FRSCRCMD_FREEBATTLETOWER .endm .macro SetWiFiListHostFriendCurrentDate diff --git a/generated/text_banks.txt b/generated/text_banks.txt index b91f3aa237..85a414d86d 100644 --- a/generated/text_banks.txt +++ b/generated/text_banks.txt @@ -13,7 +13,7 @@ TEXT_BANK_COMMUNICATION_CLUB TEXT_BANK_BALL_SEAL_NAMES TEXT_BANK_BALL_SEAL_NAMES_PLURAL TEXT_BANK_MAIN_MENU_ALERTS -TEXT_BANK_UNK_0015 +TEXT_BANK_WFC_FACILITY_SELECTOR TEXT_BANK_BATTLE_FRONTIER_RECORDS TEXT_BANK_BG_EVENTS TEXT_BANK_POKEMON_STORAGE_SYSTEM diff --git a/include/battle_frontier.h b/include/battle_frontier.h index 1af33addfe..d7868b9bfc 100644 --- a/include/battle_frontier.h +++ b/include/battle_frontier.h @@ -17,7 +17,7 @@ extern const ApplicationManagerTemplate gBattleFrontierAppTemplate; FieldFrontierDTO *BattleFrontier_GetFieldData(BattleFrontier *frontier); FrontierGraphics *BattleFrontier_GetGraphics(BattleFrontier *frontier); void *BattleFrontier_GetFacilityStruct(BattleFrontier *frontier); -void BattleFrontier_SetFacilityStruct(BattleFrontier *frontier, void *param1); +void BattleFrontier_SetFacilityStruct(BattleFrontier *frontier, void *facilityData); void sub_0209B988(BattleFrontier *frontier, const ApplicationManagerTemplate *param1, void *param2, int param3, UnkFuncPtr_0209B988 param4); void sub_0209B9B4(BattleFrontier *frontier); void sub_0209B9BC(BattleFrontier *frontier, u16 sceneID, u16 param2); @@ -26,6 +26,6 @@ UnkStruct_ov104_0223C634 *sub_0209B9D0(BattleFrontier *frontier); UnkStruct_ov104_0223C634 *sub_0209B9D4(BattleFrontier *frontier, int param1); UnkStruct_ov104_0223D3B0 *sub_0209B9E0(BattleFrontier *frontier); void sub_0209B9EC(BattleFrontier *frontier); -FieldFrontierDTO *sub_0209BA18(FieldSystem *fieldSystem, void *param1); +FieldFrontierDTO *BattleFrontier_LaunchWFCFacilitySelector(FieldSystem *fieldSystem, void *data); #endif // POKEPLATINUM_BATTLE_FRONTIER_H diff --git a/include/constants/battle_frontier.h b/include/constants/battle_frontier.h index e942932dbf..3f05cd1ef1 100644 --- a/include/constants/battle_frontier.h +++ b/include/constants/battle_frontier.h @@ -16,11 +16,21 @@ enum BattleFrontierScene { FRONTIER_SCENE_CASTLE_CORRIDOR, FRONTIER_SCENE_CASTLE_BATTLE_ROOM, FRONTIER_SCENE_13, - FRONTIER_SCENE_14, + FRONTIER_SCENE_WFC_FACILITY_SELECTOR, FRONTIER_SCENE_ARCADE_CORRIDOR, FRONTIER_SCENE_ARCADE_BATTLE_ROOM, }; +enum BattleFacility { + FACILITY_TOWER = 1, + FACILITY_FACTORY, + FACILITY_FACTORY_OPEN, + FACILITY_CASTLE, + FACILITY_HALL, + FACILITY_ARCADE, + MAX_FACILITIES, +}; + #define FRONTIER_CHALLENGE_SINGLE 0 #define FRONTIER_CHALLENGE_DOUBLE 1 #define FRONTIER_CHALLENGE_MULTI 2 @@ -30,12 +40,6 @@ enum BattleFrontierScene { #define FRONTIER_NEXT_BATTLE_SILVER 1 #define FRONTIER_NEXT_BATTLE_GOLD 2 -#define FRONTIER_RECORDS_APP_TOWER 1 -#define FRONTIER_RECORDS_APP_FACTORY 2 -#define FRONTIER_RECORDS_APP_CASTLE 4 -#define FRONTIER_RECORDS_APP_HALL 5 -#define FRONTIER_RECORDS_APP_ARCADE 6 - #define FACTORY_BATTLES_PER_ROUND 7 #define FACTORY_STREAK_SILVER_BATTLE 21 #define FACTORY_STREAK_GOLD_BATTLE 49 @@ -120,4 +124,15 @@ enum BattleFrontierScene { #define ARCADE_EFFECT_CATEGORY_BONUS 3 #define NUM_ARCADE_EFFECT_CATEGORIES 4 +#define WFC_SELECTOR_SETUP_PARTY_MENU 0 +#define WFC_SELECTOR_PROCESS_PARTY_MENU 1 +#define WFC_SELECTOR_SETUP_MON_SUMMARY 2 +#define WFC_SELECTOR_PROCESS_MON_SUMMARY 3 + +#define WFC_SELECTOR_COMM_FACILITY_AND_STREAK 0 +#define WFC_SELECTOR_COMM_DID_DROP_OUT 1 +#define WFC_SELECTOR_COMM_SELECTED_MONS 2 +#define WFC_SELECTOR_COMM_STREAK_DELETION_CHOICE 4 +#define WFC_SELECTOR_COMM_PLAY_AGAIN_CHOICE 5 + #endif // POKEPLATINUM_CONSTANTS_BATTLE_FRONTIER_H diff --git a/include/constants/wfc_facility_selector_functions.h b/include/constants/wfc_facility_selector_functions.h new file mode 100644 index 0000000000..00cda60a26 --- /dev/null +++ b/include/constants/wfc_facility_selector_functions.h @@ -0,0 +1,20 @@ +#ifndef POKEPLATINUM_CONSTANTS_WFC_FACILITY_SELECTOR_FUNCTIONS_H +#define POKEPLATINUM_CONSTANTS_WFC_FACILITY_SELECTOR_FUNCTIONS_H + +enum WFCFacilitySelectorFunction { + WFCFS_FUNC_INIT_COMM_MANAGER = 0, + WFCFS_FUNC_GET_PARTNERS_FIRST_PICK, + WFCFS_FUNC_CHECK_MON_SELECTIONS_VALID, + WFCFS_FUNC_CHECK_HALL_STREAK_ACTIVE, + WFCFS_FUNC_CHECK_HALL_STREAK_SPECIES, + WFCFS_FUNC_GET_SELECTED_SPECIES, + WFCFS_FUNC_CLEAR_ACTIVE_HALL_STREAK, + WFCFS_FUNC_SET_SELECTED_FACILITY, + WFCFS_FUNC_GET_PARTNERS_STREAK_DELETION_CHOICE, + WFCFS_FUNC_GET_SELECTED_FACILITY, + WFCFS_FUNC_CHECK_PARTNER_PLAYING_AGAIN, + WFCFS_FUNC_CLEAR_STREAK_IF_NOT_MATCHING, + WFCFS_FUNC_CLEAR_LATEST_STREAK, + WFCFS_FUNC_CLEAR_PARTY_MENU_SELECTIONS, +}; +#endif // POKEPLATINUM_CONSTANTS_WFC_FACILITY_SELECTOR_FUNCTIONS_H diff --git a/include/data/scripts/frscrcmd.h b/include/data/scripts/frscrcmd.h index c772f1837b..cdb8fa8dfd 100644 --- a/include/data/scripts/frscrcmd.h +++ b/include/data/scripts/frscrcmd.h @@ -5,210 +5,210 @@ #include "data/scripts/cmd_table.h" -ScriptCommand(FRSCRCMD_NOOP, FrontierScrCmd_Noop) -ScriptCommand(FRSCRCMD_END, FrontierScrCmd_End) -ScriptCommand(FRSCRCMD_02, FrontierScrCmd_02) -ScriptCommand(FRSCRCMD_03, FrontierScrCmd_03) -ScriptCommand(FRSCRCMD_04, FrontierScrCmd_04) -ScriptCommand(FRSCRCMD_WAITTIME, FrontierScrCmd_WaitTime) -ScriptCommand(FRSCRCMD_SETVARFROMVALUE, FrontierScrCmd_SetVarFromValue) -ScriptCommand(FRSCRCMD_SETVARFROMVAR, FrontierScrCmd_SetVarFromVar) -ScriptCommand(FRSCRCMD_ADDVAR, FrontierScrCmd_AddVar) -ScriptCommand(FRSCRCMD_SUBVAR, FrontierScrCmd_SubVar) -ScriptCommand(FRSCRCMD_GOTO, FrontierScrCmd_GoTo) -ScriptCommand(FRSCRCMD_GOTOIF, FrontierScrCmd_GoToIf) -ScriptCommand(FRSCRCMD_CALL, FrontierScrCmd_Call) -ScriptCommand(FRSCRCMD_RETURN, FrontierScrCmd_Return) -ScriptCommand(FRSCRCMD_CALLIF, FrontierScrCmd_CallIf) -ScriptCommand(FRSCRCMD_MESSAGEINSTANT, FrontierScrCmd_MessageInstant) -ScriptCommand(FRSCRCMD_MESSAGENOSKIP, FrontierScrCmd_MessageNoSkip) -ScriptCommand(FRSCRCMD_MESSAGE, FrontierScrCmd_Message) -ScriptCommand(FRSCRCMD_CLOSEMESSAGE, FrontierScrCmd_CloseMessage) -ScriptCommand(FRSCRCMD_FADESCREEN, FrontierScrCmd_FadeScreen) -ScriptCommand(FRSCRCMD_WAITFADESCREEN, FrontierScrCmd_WaitFadeScreen) -ScriptCommand(FRSCRCMD_INITGLOBALTEXTMENU, FrontierScrCmd_InitGlobalTextMenu) -ScriptCommand(FRSCRCMD_INITLOCALTEXTMENU, FrontierScrCmd_InitLocalTextMenu) -ScriptCommand(FRSCRCMD_ADDMENUENTRY, FrontierScrCmd_AddMenuEntry) -ScriptCommand(FRSCRCMD_ADDMENUENTRYWITHDESC, FrontierScrCmd_AddMenuEntryWithDesc) -ScriptCommand(FRSCRCMD_SHOWMENU, FrontierScrCmd_ShowMenu) -ScriptCommand(FRSCRCMD_INITGLOBALTEXTLISTMENU, FrontierScrCmd_InitGlobalTextListMenu) -ScriptCommand(FRSCRCMD_INITLOCALTEXTLISTMENU, FrontierScrCmd_InitLocalTextListMenu) -ScriptCommand(FRSCRCMD_ADDLISTMENUENTRY, FrontierScrCmd_AddListMenuEntry) -ScriptCommand(FRSCRCMD_SHOWLISTMENU, FrontierScrCmd_ShowListMenu) -ScriptCommand(FRSCRCMD_FREELISTMENU, FrontierScrCmd_FreeListMenu) -ScriptCommand(FRSCRCMD_SHOWYESNOMENU, FrontierScrCmd_ShowYesNoMenu) -ScriptCommand(FRSCRCMD_COMPAREVARTOVALUE, FrontierScrCmd_CompareVarToValue) -ScriptCommand(FRSCRCMD_COMPAREVARTOVAR, FrontierScrCmd_CompareVarToVar) -ScriptCommand(FRSCRCMD_22, FrontierScrCmd_22) -ScriptCommand(FRSCRCMD_23, FrontierScrCmd_23) -ScriptCommand(FRSCRCMD_24, FrontierScrCmd_24) -ScriptCommand(FRSCRCMD_25, FrontierScrCmd_25) -ScriptCommand(FRSCRCMD_26, FrontierScrCmd_26) -ScriptCommand(FRSCRCMD_DUMMY27, FrontierScrCmd_Dummy27) -ScriptCommand(FRSCRCMD_APPLYMOVEMENT, FrontierScrCmd_ApplyMovement) -ScriptCommand(FRSCRCMD_WAITMOVEMENT, FrontierScrCmd_WaitMovement) -ScriptCommand(FRSCRCMD_2A, FrontierScrCmd_2A) -ScriptCommand(FRSCRCMD_2B, FrontierScrCmd_2B) -ScriptCommand(FRSCRCMD_2C, FrontierScrCmd_2C) -ScriptCommand(FRSCRCMD_2D, FrontierScrCmd_2D) -ScriptCommand(FRSCRCMD_2E, FrontierScrCmd_2E) -ScriptCommand(FRSCRCMD_2F, FrontierScrCmd_2F) -ScriptCommand(FRSCRCMD_30, FrontierScrCmd_30) -ScriptCommand(FRSCRCMD_31, FrontierScrCmd_31) -ScriptCommand(FRSCRCMD_32, FrontierScrCmd_32) -ScriptCommand(FRSCRCMD_33, FrontierScrCmd_33) -ScriptCommand(FRSCRCMD_34, FrontierScrCmd_34) -ScriptCommand(FRSCRCMD_SYNCCONNECTEDPLAYERS, FrontierScrCmd_SyncConnectedPlayers) -ScriptCommand(FRSCRCMD_CLEARRECEIVEDTEMPDATAALLPLAYERS, FrontierScrCmd_ClearReceivedTempDataAllPlayers) -ScriptCommand(FRSCRCMD_ENDCOMMUNICATION, FrontierScrCmd_EndCommunication) -ScriptCommand(FRSCRCMD_GETRANDOM, FrontierScrCmd_GetRandom) -ScriptCommand(FRSCRCMD_HEALPARTY, FrontierScrCmd_HealParty) -ScriptCommand(FRSCRCMD_WAITABPRESS, FrontierScrCmd_WaitABPress) -ScriptCommand(FRSCRCMD_WAITABPRESSTIME, FrontierScrCmd_WaitABPressTime) -ScriptCommand(FRSCRCMD_DUMMY3C, FrontierScrCmd_Dummy3C) -ScriptCommand(FRSCRCMD_SETSYSTEMVAR, FrontierScrCmd_SetSystemVar) -ScriptCommand(FRSCRCMD_GETSYSTEMVAR, FrontierScrCmd_GetSystemVar) -ScriptCommand(FRSCRCMD_3F, FrontierScrCmd_3F) -ScriptCommand(FRSCRCMD_GETPLAYEROBJEVENTGFX, FrontierScrCmd_GetPlayerObjEventGfx) -ScriptCommand(FRSCRCMD_INITPARTICLESYSTEM, FrontierScrCmd_InitParticleSystem) -ScriptCommand(FRSCRCMD_FREEPARTICLESYSTEM, FrontierScrCmd_FreeParticleSystem) -ScriptCommand(FRSCRCMD_CREATEPARTICLESYSTEMEMITTER, FrontierScrCmd_CreateParticleSystemEmitter) -ScriptCommand(FRSCRCMD_WAITFORPARTICLESYSTEMEMITTERS, FrontierScrCmd_WaitForParticleSystemEmitters) -ScriptCommand(FRSCRCMD_45, FrontierScrCmd_45) -ScriptCommand(FRSCRCMD_46, FrontierScrCmd_46) -ScriptCommand(FRSCRCMD_47, FrontierScrCmd_47) -ScriptCommand(FRSCRCMD_INCREMENTRECORDVALUE, FrontierScrCmd_IncrementRecordValue) -ScriptCommand(FRSCRCMD_ADDTORECORDVALUE, FrontierScrCmd_AddToRecordValue) -ScriptCommand(FRSCRCMD_INCREMENTTRAINERSCORE, FrontierScrCmd_IncrementTrainerScore) -ScriptCommand(FRSCRCMD_4B, FrontierScrCmd_4B) -ScriptCommand(FRSCRCMD_4C, FrontierScrCmd_4C) -ScriptCommand(FRSCRCMD_4D, FrontierScrCmd_4D) -ScriptCommand(FRSCRCMD_4E, FrontierScrCmd_4E) -ScriptCommand(FRSCRCMD_4F, FrontierScrCmd_4F) -ScriptCommand(FRSCRCMD_SHOWCASTLEPOINTSWINDOWS, FrontierScrCmd_ShowCastlePointsWindows) -ScriptCommand(FRSCRCMD_CLEARCASTLEPOINTSWINDOWS, FrontierScrCmd_ClearCastlePointsWindows) -ScriptCommand(FRSCRCMD_REPRINTCASTLEPOINTSINFO, FrontierScrCmd_ReprintCastlePointsInfo) -ScriptCommand(FRSCRCMD_53, FrontierScrCmd_53) -ScriptCommand(FRSCRCMD_54, FrontierScrCmd_54) -ScriptCommand(FRSCRCMD_PLAYSOUNDEFFECT, FrontierScrCmd_PlaySoundEffect) -ScriptCommand(FRSCRCMD_STOPSOUNDEFFECT, FrontierScrCmd_StopSoundEffect) -ScriptCommand(FRSCRCMD_WAITSOUNDEFFECT, FrontierScrCmd_WaitSoundEffect) -ScriptCommand(FRSCRCMD_PLAYFANFARE, FrontierScrCmd_PlayFanfare) -ScriptCommand(FRSCRCMD_WAITFANFARE, FrontierScrCmd_WaitFanfare) -ScriptCommand(FRSCRCMD_PLAYBGM, FrontierScrCmd_PlayBGM) -ScriptCommand(FRSCRCMD_STOPBGM, FrontierScrCmd_StopBGM) -ScriptCommand(FRSCRCMD_INITBATTLEFACTORY, FrontierScrCmd_InitBattleFactory) -ScriptCommand(FRSCRCMD_BATTLEFACTORY_LOADTRAINERSFORROUND, FrontierScrCmd_BattleFactory_LoadTrainersForRound) -ScriptCommand(FRSCRCMD_FREEBATTLEFACTORY, FrontierScrCmd_FreeBattleFactory) -ScriptCommand(FRSCRCMD_OPENBATTLEFACTORYAPPINITIAL, FrontierScrCmd_OpenBattleFactoryAppInitial) -ScriptCommand(FRSCRCMD_BATTLEFACTORY_CLEANUPBATTLE, FrontierScrCmd_BattleFactory_CleanupBattle) -ScriptCommand(FRSCRCMD_BATTLEFACTORY_STARTBATTLE, FrontierScrCmd_BattleFactory_StartBattle) -ScriptCommand(FRSCRCMD_OPENBATTLEFACTORYAPPFORTRADE, FrontierScrCmd_OpenBattleFactoryAppForTrade) -ScriptCommand(FRSCRCMD_ADDSELECTEDRENTALSTOPARTY, FrontierScrCmd_AddSelectedRentalsToParty) -ScriptCommand(FRSCRCMD_BATTLEFACTORY_SETUPNEXTOPPONENT, FrontierScrCmd_BattleFactory_SetupNextOpponent) -ScriptCommand(FRSCRCMD_BATTLEFACTORY_APPLYTRADE, FrontierScrCmd_BattleFactory_ApplyTrade) -ScriptCommand(FRSCRCMD_BATTLEFACTORY_SETUPNEXTOPPONENTSPARTY, FrontierScrCmd_BattleFactory_SetupNextOpponentsParty) -ScriptCommand(FRSCRCMD_CALLBATTLEFACTORYFUNCTION, FrontierScrCmd_CallBattleFactoryFunction) -ScriptCommand(FRSCRCMD_BATTLEFACTORY_CHECKWONBATTLE, FrontierScrCmd_BattleFactory_CheckWonBattle) -ScriptCommand(FRSCRCMD_BATTLEFACTORY_SENDCOMMMESSAGE, FrontierScrCmd_BattleFactory_SendCommMessage) -ScriptCommand(FRSCRCMD_BATTLEFACTORY_WAITFORCOMMRESPONSES, FrontierScrCmd_BattleFactory_WaitForCommResponses) -ScriptCommand(FRSCRCMD_BATTLEFACTORY_PRINTTRAINERINTRO, FrontierScrCmd_BattleFactory_PrintTrainerIntro) -ScriptCommand(FRSCRCMD_INITNEWBATTLERECORDING, FrontierScrCmd_InitNewBattleRecording) -ScriptCommand(FRSCRCMD_6D, FrontierScrCmd_6D) -ScriptCommand(FRSCRCMD_6E, FrontierScrCmd_6E) -ScriptCommand(FRSCRCMD_FREEBATTLERECORDING, FrontierScrCmd_FreeBattleRecording) -ScriptCommand(FRSCRCMD_70, FrontierScrCmd_70) -ScriptCommand(FRSCRCMD_71, FrontierScrCmd_71) -ScriptCommand(FRSCRCMD_72, FrontierScrCmd_72) -ScriptCommand(FRSCRCMD_73, FrontierScrCmd_73) -ScriptCommand(FRSCRCMD_SAVEDATAEXTRAINIT, FrontierScrCmd_SaveDataExtraInit) -ScriptCommand(FRSCRCMD_GETMISCSAVEBLOCKINITFLAG, FrontierScrCmd_GetMiscSaveBlockInitFlag) -ScriptCommand(FRSCRCMD_BATTLEHALL_UPDATEWINRECORD, FrontierScrCmd_BattleHall_UpdateWinRecord) -ScriptCommand(FRSCRCMD_SHOWSAVINGICON, FrontierScrCmd_ShowSavingIcon) -ScriptCommand(FRSCRCMD_HIDESAVINGICON, FrontierScrCmd_HideSavingIcon) -ScriptCommand(FRSCRCMD_BUFFERITEMNAME, FrontierScrCmd_BufferItemName) -ScriptCommand(FRSCRCMD_BUFFERNUMBER, FrontierScrCmd_BufferNumber) -ScriptCommand(FRSCRCMD_BUFFERPLAYERNAME, FrontierScrCmd_BufferPlayerName) -ScriptCommand(FRSCRCMD_BUFFERPARTNERNAME, FrontierScrCmd_BufferPartnerName) -ScriptCommand(FRSCRCMD_BUFFERMOVENAME, FrontierScrCmd_BufferMoveName) -ScriptCommand(FRSCRCMD_BUFFERSPECIESNAME, FrontierScrCmd_BufferSpeciesName) -ScriptCommand(FRSCRCMD_BUFFERTYPENAME, FrontierScrCmd_BufferTypeName) -ScriptCommand(FRSCRCMD_BUFFERRIVALNAME, FrontierScrCmd_BufferRivalName) -ScriptCommand(FRSCRCMD_GETNUMBATTLEPOINTS, FrontierScrCmd_GetNumBattlePoints) -ScriptCommand(FRSCRCMD_GIVEBATTLEPOINTS, FrontierScrCmd_GiveBattlePoints) -ScriptCommand(FRSCRCMD_REMOTEBATTLEPOINTS, FrontierScrCmd_RemoteBattlePoints) -ScriptCommand(FRSCRCMD_CALLBATTLETOWERFUNCTION, FrontierScrCmd_CallBattleTowerFunction) -ScriptCommand(FRSCRCMD_85, FrontierScrCmd_85) -ScriptCommand(FRSCRCMD_FREETOWERSTRUCT, FrontierScrCmd_FreeTowerStruct) -ScriptCommand(FRSCRCMD_BATTLETOWER_STARTBATTLE, FrontierScrCmd_BattleTower_StartBattle) -ScriptCommand(FRSCRCMD_BATTLETOWER_CHECKWONBATTLE, FrontierScrCmd_BattleTower_CheckWonBattle) -ScriptCommand(FRSCRCMD_89, FrontierScrCmd_89) -ScriptCommand(FRSCRCMD_8A, FrontierScrCmd_8A) -ScriptCommand(FRSCRCMD_INITBATTLEHALL, FrontierScrCmd_InitBattleHall) -ScriptCommand(FRSCRCMD_BATTLEHALL_SETUP_NEXT_OPPONENT, FrontierScrCmd_BattleHall_SetupNextOpponent) -ScriptCommand(FRSCRCMD_FREEBATTLEHALL, FrontierScrCmd_FreeBattleHall) -ScriptCommand(FRSCRCMD_OPENBATTLEHALLAPP, FrontierScrCmd_OpenBattleHallApp) -ScriptCommand(FRSCRCMD_BATTLEHALL_CLEANUPBATTLE, FrontierScrCmd_BattleHall_CleanupBattle) -ScriptCommand(FRSCRCMD_BATTLEHALL_STARTBATTLE, FrontierScrCmd_BattleHall_StartBattle) -ScriptCommand(FRSCRCMD_CALLBATTLEHALLFUNCTION, FrontierScrCmd_CallBattleHallFunction) -ScriptCommand(FRSCRCMD_BATTLEHALL_CHECKWONBATTLE, FrontierScrCmd_BattleHall_CheckWonBattle) -ScriptCommand(FRSCRCMD_BATTLEHALL_SENDCOMMMESSAGE, FrontierScrCmd_BattleHall_SendCommMessage) -ScriptCommand(FRSCRCMD_94, FrontierScrCmd_94) -ScriptCommand(FRSCRCMD_BATTLEHALL_PRINTTRAINERINTRO, FrontierScrCmd_BattleHall_PrintTrainerIntro) -ScriptCommand(FRSCRCMD_DUMMY96, FrontierScrCmd_Dummy96) -ScriptCommand(FRSCRCMD_INITBATTLECASTLE, FrontierScrCmd_InitBattleCastle) -ScriptCommand(FRSCRCMD_LOADTRAINERSFORROUND, FrontierScrCmd_LoadTrainersForRound) -ScriptCommand(FRSCRCMD_FREEBATTLECASTLE, FrontierScrCmd_FreeBattleCastle) -ScriptCommand(FRSCRCMD_OPENBATTLECASTLESELFAPP, FrontierScrCmd_OpenBattleCastleSelfApp) -ScriptCommand(FRSCRCMD_BATTLECASTLE_CLEANUPBATTLE, FrontierScrCmd_BattleCastle_CleanupBattle) -ScriptCommand(FRSCRCMD_BATTLECASTLE_STARTBATTLE, FrontierScrCmd_BattleCastle_StartBattle) -ScriptCommand(FRSCRCMD_OPENBATTLECASTLEOPPONENTAPP, FrontierScrCmd_OpenBattleCastleOpponentApp) -ScriptCommand(FRSCRCMD_BATTLECASTLE_SETUPFIRSTOPPONENT, FrontierScrCmd_BattleCastle_SetupFirstOpponent) -ScriptCommand(FRSCRCMD_BATTLECASTLE_SETUPNEXTOPPONENT, FrontierScrCmd_BattleCastle_SetupNextOpponent) -ScriptCommand(FRSCRCMD_CALLBATTLECASTLEFUNCTION, FrontierScrCmd_CallBattleCastleFunction) -ScriptCommand(FRSCRCMD_BATTLECASTLE_CHECKWONBATTLE, FrontierScrCmd_BattleCastle_CheckWonBattle) -ScriptCommand(FRSCRCMD_BATTLECASTLE_SENDCOMMMESSAGE, FrontierScrCmd_BattleCastle_SendCommMessage) -ScriptCommand(FRSCRCMD_BATTLECASTLE_WAITFORCOMMRESPONSES, FrontierScrCmd_BattleCastle_WaitForCommResponses) -ScriptCommand(FRSCRCMD_DUMMYOPENBATTLECASTLEAPP, FrontierScrCmd_DummyOpenBattleCastleApp) -ScriptCommand(FRSCRCMD_A5, FrontierScrCmd_A5) -ScriptCommand(FRSCRCMD_GETCURRENTCASTLEPOINTS, FrontierScrCmd_GetCurrentCastlePoints) -ScriptCommand(FRSCRCMD_SPENDCASTLEPOINTS, FrontierScrCmd_SpendCastlePoints) -ScriptCommand(FRSCRCMD_RECEIVECASTLEPOINTS, FrontierScrCmd_ReceiveCastlePoints) -ScriptCommand(FRSCRCMD_BATTLECASTLE_PRINTRAINERINTRO, FrontierScrCmd_BattleCastle_PrintTrainerIntro) -ScriptCommand(FRSCRCMD_AA, FrontierScrCmd_AA) -ScriptCommand(FRSCRCMD_AB, FrontierScrCmd_AB) -ScriptCommand(FRSCRCMD_AC, FrontierScrCmd_AC) -ScriptCommand(FRSCRCMD_AD, FrontierScrCmd_AD) -ScriptCommand(FRSCRCMD_AE, FrontierScrCmd_AE) -ScriptCommand(FRSCRCMD_AF, FrontierScrCmd_AF) -ScriptCommand(FRSCRCMD_B0, FrontierScrCmd_B0) -ScriptCommand(FRSCRCMD_B1, FrontierScrCmd_B1) -ScriptCommand(FRSCRCMD_B2, FrontierScrCmd_B2) -ScriptCommand(FRSCRCMD_B3, FrontierScrCmd_B3) -ScriptCommand(FRSCRCMD_B4, FrontierScrCmd_B4) -ScriptCommand(FRSCRCMD_B5, FrontierScrCmd_B5) -ScriptCommand(FRSCRCMD_CLEARTOWERSTRUCT, FrontierScrCmd_ClearTowerStruct) -ScriptCommand(FRSCRCMD_SETWIFILISTHOSTFRIENDCURRENTDATE, FrontierScrCmd_SetWiFiListHostFriendCurrentDate) -ScriptCommand(FRSCRCMD_INITBATTLEARCADE, FrontierScrCmd_InitBattleArcade) -ScriptCommand(FRSCRCMD_BATTLEARCADE_LOADTRAINERSFORROUND, FrontierScrCmd_BattleArcade_LoadTrainersForRound) -ScriptCommand(FRSCRCMD_FREEBATTLEARCADE, FrontierScrCmd_FreeBattleArcade) -ScriptCommand(FRSCRCMD_BATTLEARCADE_CLEANUPBATTLE, FrontierScrCmd_BattleArcade_CleanupBattle) -ScriptCommand(FRSCRCMD_BATTLEARCADE_STARTBATTLE, FrontierScrCmd_BattleArcade_StartBattle) -ScriptCommand(FRSCRCMD_BATTLEARCADE_SETUPFIRSTOPPONENT, FrontierScrCmd_BattleArcade_SetupFirstOpponent) -ScriptCommand(FRSCRCMD_BATTLEARCADE_SETUPNEXTOPPONENT, FrontierScrCmd_BattleArcade_SetupNextOpponent) -ScriptCommand(FRSCRCMD_CALLBATTLEARCADEFUNCTION, FrontierScrCmd_CallBattleArcadeFunction) -ScriptCommand(FRSCRCMD_BATTLEARCADE_CHECKWONBATTLE, FrontierScrCmd_BattleArcade_CheckWonBattle) -ScriptCommand(FRSCRCMD_BATTLEARCADE_SENDCOMMMESSAGE, FrontierScrCmd_BattleArcade_SendCommMessage) -ScriptCommand(FRSCRCMD_BATTLEARCADE_WAITFORCOMMRESPONSES, FrontierScrCmd_BattleArcade_WaitForCommResponses) -ScriptCommand(FRSCRCMD_OPENBATTLEARCADEAPP, FrontierScrCmd_OpenBattleArcadeApp) -ScriptCommand(FRSCRCMD_BATTLEARCADE_PRINTTRAINERINFO, FrontierScrCmd_BattleArcade_PrintTrainerIntro) -ScriptCommand(FRSCRCMD_APPLYARCADEEFFECT, FrontierScrCmd_ApplyArcadeEffect) -ScriptCommand(FRSCRCMD_SETITEMDRAWFLAG, FrontierScrCmd_SetItemDrawFlag) -ScriptCommand(FRSCRCMD_C7, FrontierScrCmd_C7) -ScriptCommand(FRSCRCMD_C8, FrontierScrCmd_C8) -ScriptCommand(FRSCRCMD_C9, FrontierScrCmd_C9) -ScriptCommand(FRSCRCMD_SETMENUXORIGINSIDE, FrontierScrCmd_SetMenuXOriginSide) -ScriptCommand(FRSCRCMD_SETMENUYORIGINSIDE, FrontierScrCmd_SetMenuYOriginSide) +ScriptCommand(FRSCRCMD_NOOP, FrontierScrCmd_Noop) +ScriptCommand(FRSCRCMD_END, FrontierScrCmd_End) +ScriptCommand(FRSCRCMD_02, FrontierScrCmd_02) +ScriptCommand(FRSCRCMD_03, FrontierScrCmd_03) +ScriptCommand(FRSCRCMD_04, FrontierScrCmd_04) +ScriptCommand(FRSCRCMD_WAITTIME, FrontierScrCmd_WaitTime) +ScriptCommand(FRSCRCMD_SETVARFROMVALUE, FrontierScrCmd_SetVarFromValue) +ScriptCommand(FRSCRCMD_SETVARFROMVAR, FrontierScrCmd_SetVarFromVar) +ScriptCommand(FRSCRCMD_ADDVAR, FrontierScrCmd_AddVar) +ScriptCommand(FRSCRCMD_SUBVAR, FrontierScrCmd_SubVar) +ScriptCommand(FRSCRCMD_GOTO, FrontierScrCmd_GoTo) +ScriptCommand(FRSCRCMD_GOTOIF, FrontierScrCmd_GoToIf) +ScriptCommand(FRSCRCMD_CALL, FrontierScrCmd_Call) +ScriptCommand(FRSCRCMD_RETURN, FrontierScrCmd_Return) +ScriptCommand(FRSCRCMD_CALLIF, FrontierScrCmd_CallIf) +ScriptCommand(FRSCRCMD_MESSAGEINSTANT, FrontierScrCmd_MessageInstant) +ScriptCommand(FRSCRCMD_MESSAGENOSKIP, FrontierScrCmd_MessageNoSkip) +ScriptCommand(FRSCRCMD_MESSAGE, FrontierScrCmd_Message) +ScriptCommand(FRSCRCMD_CLOSEMESSAGE, FrontierScrCmd_CloseMessage) +ScriptCommand(FRSCRCMD_FADESCREEN, FrontierScrCmd_FadeScreen) +ScriptCommand(FRSCRCMD_WAITFADESCREEN, FrontierScrCmd_WaitFadeScreen) +ScriptCommand(FRSCRCMD_INITGLOBALTEXTMENU, FrontierScrCmd_InitGlobalTextMenu) +ScriptCommand(FRSCRCMD_INITLOCALTEXTMENU, FrontierScrCmd_InitLocalTextMenu) +ScriptCommand(FRSCRCMD_ADDMENUENTRY, FrontierScrCmd_AddMenuEntry) +ScriptCommand(FRSCRCMD_ADDMENUENTRYWITHDESC, FrontierScrCmd_AddMenuEntryWithDesc) +ScriptCommand(FRSCRCMD_SHOWMENU, FrontierScrCmd_ShowMenu) +ScriptCommand(FRSCRCMD_INITGLOBALTEXTLISTMENU, FrontierScrCmd_InitGlobalTextListMenu) +ScriptCommand(FRSCRCMD_INITLOCALTEXTLISTMENU, FrontierScrCmd_InitLocalTextListMenu) +ScriptCommand(FRSCRCMD_ADDLISTMENUENTRY, FrontierScrCmd_AddListMenuEntry) +ScriptCommand(FRSCRCMD_SHOWLISTMENU, FrontierScrCmd_ShowListMenu) +ScriptCommand(FRSCRCMD_FREELISTMENU, FrontierScrCmd_FreeListMenu) +ScriptCommand(FRSCRCMD_SHOWYESNOMENU, FrontierScrCmd_ShowYesNoMenu) +ScriptCommand(FRSCRCMD_COMPAREVARTOVALUE, FrontierScrCmd_CompareVarToValue) +ScriptCommand(FRSCRCMD_COMPAREVARTOVAR, FrontierScrCmd_CompareVarToVar) +ScriptCommand(FRSCRCMD_22, FrontierScrCmd_22) +ScriptCommand(FRSCRCMD_23, FrontierScrCmd_23) +ScriptCommand(FRSCRCMD_24, FrontierScrCmd_24) +ScriptCommand(FRSCRCMD_25, FrontierScrCmd_25) +ScriptCommand(FRSCRCMD_26, FrontierScrCmd_26) +ScriptCommand(FRSCRCMD_DUMMY27, FrontierScrCmd_Dummy27) +ScriptCommand(FRSCRCMD_APPLYMOVEMENT, FrontierScrCmd_ApplyMovement) +ScriptCommand(FRSCRCMD_WAITMOVEMENT, FrontierScrCmd_WaitMovement) +ScriptCommand(FRSCRCMD_2A, FrontierScrCmd_2A) +ScriptCommand(FRSCRCMD_2B, FrontierScrCmd_2B) +ScriptCommand(FRSCRCMD_2C, FrontierScrCmd_2C) +ScriptCommand(FRSCRCMD_2D, FrontierScrCmd_2D) +ScriptCommand(FRSCRCMD_2E, FrontierScrCmd_2E) +ScriptCommand(FRSCRCMD_2F, FrontierScrCmd_2F) +ScriptCommand(FRSCRCMD_30, FrontierScrCmd_30) +ScriptCommand(FRSCRCMD_31, FrontierScrCmd_31) +ScriptCommand(FRSCRCMD_32, FrontierScrCmd_32) +ScriptCommand(FRSCRCMD_33, FrontierScrCmd_33) +ScriptCommand(FRSCRCMD_34, FrontierScrCmd_34) +ScriptCommand(FRSCRCMD_SYNCCONNECTEDPLAYERS, FrontierScrCmd_SyncConnectedPlayers) +ScriptCommand(FRSCRCMD_CLEARRECEIVEDTEMPDATAALLPLAYERS, FrontierScrCmd_ClearReceivedTempDataAllPlayers) +ScriptCommand(FRSCRCMD_ENDCOMMUNICATION, FrontierScrCmd_EndCommunication) +ScriptCommand(FRSCRCMD_GETRANDOM, FrontierScrCmd_GetRandom) +ScriptCommand(FRSCRCMD_HEALPARTY, FrontierScrCmd_HealParty) +ScriptCommand(FRSCRCMD_WAITABPRESS, FrontierScrCmd_WaitABPress) +ScriptCommand(FRSCRCMD_WAITABPRESSTIME, FrontierScrCmd_WaitABPressTime) +ScriptCommand(FRSCRCMD_DUMMY3C, FrontierScrCmd_Dummy3C) +ScriptCommand(FRSCRCMD_SETSYSTEMVAR, FrontierScrCmd_SetSystemVar) +ScriptCommand(FRSCRCMD_GETSYSTEMVAR, FrontierScrCmd_GetSystemVar) +ScriptCommand(FRSCRCMD_3F, FrontierScrCmd_3F) +ScriptCommand(FRSCRCMD_GETPLAYEROBJEVENTGFX, FrontierScrCmd_GetPlayerObjEventGfx) +ScriptCommand(FRSCRCMD_INITPARTICLESYSTEM, FrontierScrCmd_InitParticleSystem) +ScriptCommand(FRSCRCMD_FREEPARTICLESYSTEM, FrontierScrCmd_FreeParticleSystem) +ScriptCommand(FRSCRCMD_CREATEPARTICLESYSTEMEMITTER, FrontierScrCmd_CreateParticleSystemEmitter) +ScriptCommand(FRSCRCMD_WAITFORPARTICLESYSTEMEMITTERS, FrontierScrCmd_WaitForParticleSystemEmitters) +ScriptCommand(FRSCRCMD_45, FrontierScrCmd_45) +ScriptCommand(FRSCRCMD_46, FrontierScrCmd_46) +ScriptCommand(FRSCRCMD_47, FrontierScrCmd_47) +ScriptCommand(FRSCRCMD_INCREMENTRECORDVALUE, FrontierScrCmd_IncrementRecordValue) +ScriptCommand(FRSCRCMD_ADDTORECORDVALUE, FrontierScrCmd_AddToRecordValue) +ScriptCommand(FRSCRCMD_INCREMENTTRAINERSCORE, FrontierScrCmd_IncrementTrainerScore) +ScriptCommand(FRSCRCMD_4B, FrontierScrCmd_4B) +ScriptCommand(FRSCRCMD_4C, FrontierScrCmd_4C) +ScriptCommand(FRSCRCMD_4D, FrontierScrCmd_4D) +ScriptCommand(FRSCRCMD_4E, FrontierScrCmd_4E) +ScriptCommand(FRSCRCMD_4F, FrontierScrCmd_4F) +ScriptCommand(FRSCRCMD_SHOWCASTLEPOINTSWINDOWS, FrontierScrCmd_ShowCastlePointsWindows) +ScriptCommand(FRSCRCMD_CLEARCASTLEPOINTSWINDOWS, FrontierScrCmd_ClearCastlePointsWindows) +ScriptCommand(FRSCRCMD_REPRINTCASTLEPOINTSINFO, FrontierScrCmd_ReprintCastlePointsInfo) +ScriptCommand(FRSCRCMD_53, FrontierScrCmd_53) +ScriptCommand(FRSCRCMD_54, FrontierScrCmd_54) +ScriptCommand(FRSCRCMD_PLAYSOUNDEFFECT, FrontierScrCmd_PlaySoundEffect) +ScriptCommand(FRSCRCMD_STOPSOUNDEFFECT, FrontierScrCmd_StopSoundEffect) +ScriptCommand(FRSCRCMD_WAITSOUNDEFFECT, FrontierScrCmd_WaitSoundEffect) +ScriptCommand(FRSCRCMD_PLAYFANFARE, FrontierScrCmd_PlayFanfare) +ScriptCommand(FRSCRCMD_WAITFANFARE, FrontierScrCmd_WaitFanfare) +ScriptCommand(FRSCRCMD_PLAYBGM, FrontierScrCmd_PlayBGM) +ScriptCommand(FRSCRCMD_STOPBGM, FrontierScrCmd_StopBGM) +ScriptCommand(FRSCRCMD_INITBATTLEFACTORY, FrontierScrCmd_InitBattleFactory) +ScriptCommand(FRSCRCMD_BATTLEFACTORY_LOADTRAINERSFORROUND, FrontierScrCmd_BattleFactory_LoadTrainersForRound) +ScriptCommand(FRSCRCMD_FREEBATTLEFACTORY, FrontierScrCmd_FreeBattleFactory) +ScriptCommand(FRSCRCMD_OPENBATTLEFACTORYAPPINITIAL, FrontierScrCmd_OpenBattleFactoryAppInitial) +ScriptCommand(FRSCRCMD_BATTLEFACTORY_CLEANUPBATTLE, FrontierScrCmd_BattleFactory_CleanupBattle) +ScriptCommand(FRSCRCMD_BATTLEFACTORY_STARTBATTLE, FrontierScrCmd_BattleFactory_StartBattle) +ScriptCommand(FRSCRCMD_OPENBATTLEFACTORYAPPFORTRADE, FrontierScrCmd_OpenBattleFactoryAppForTrade) +ScriptCommand(FRSCRCMD_ADDSELECTEDRENTALSTOPARTY, FrontierScrCmd_AddSelectedRentalsToParty) +ScriptCommand(FRSCRCMD_BATTLEFACTORY_SETUPNEXTOPPONENT, FrontierScrCmd_BattleFactory_SetupNextOpponent) +ScriptCommand(FRSCRCMD_BATTLEFACTORY_APPLYTRADE, FrontierScrCmd_BattleFactory_ApplyTrade) +ScriptCommand(FRSCRCMD_BATTLEFACTORY_SETUPNEXTOPPONENTSPARTY, FrontierScrCmd_BattleFactory_SetupNextOpponentsParty) +ScriptCommand(FRSCRCMD_CALLBATTLEFACTORYFUNCTION, FrontierScrCmd_CallBattleFactoryFunction) +ScriptCommand(FRSCRCMD_BATTLEFACTORY_CHECKWONBATTLE, FrontierScrCmd_BattleFactory_CheckWonBattle) +ScriptCommand(FRSCRCMD_BATTLEFACTORY_SENDCOMMMESSAGE, FrontierScrCmd_BattleFactory_SendCommMessage) +ScriptCommand(FRSCRCMD_BATTLEFACTORY_WAITFORCOMMRESPONSES, FrontierScrCmd_BattleFactory_WaitForCommResponses) +ScriptCommand(FRSCRCMD_BATTLEFACTORY_PRINTTRAINERINTRO, FrontierScrCmd_BattleFactory_PrintTrainerIntro) +ScriptCommand(FRSCRCMD_INITNEWBATTLERECORDING, FrontierScrCmd_InitNewBattleRecording) +ScriptCommand(FRSCRCMD_6D, FrontierScrCmd_6D) +ScriptCommand(FRSCRCMD_6E, FrontierScrCmd_6E) +ScriptCommand(FRSCRCMD_FREEBATTLERECORDING, FrontierScrCmd_FreeBattleRecording) +ScriptCommand(FRSCRCMD_70, FrontierScrCmd_70) +ScriptCommand(FRSCRCMD_71, FrontierScrCmd_71) +ScriptCommand(FRSCRCMD_72, FrontierScrCmd_72) +ScriptCommand(FRSCRCMD_73, FrontierScrCmd_73) +ScriptCommand(FRSCRCMD_SAVEDATAEXTRAINIT, FrontierScrCmd_SaveDataExtraInit) +ScriptCommand(FRSCRCMD_GETMISCSAVEBLOCKINITFLAG, FrontierScrCmd_GetMiscSaveBlockInitFlag) +ScriptCommand(FRSCRCMD_BATTLEHALL_UPDATEWINRECORD, FrontierScrCmd_BattleHall_UpdateWinRecord) +ScriptCommand(FRSCRCMD_SHOWSAVINGICON, FrontierScrCmd_ShowSavingIcon) +ScriptCommand(FRSCRCMD_HIDESAVINGICON, FrontierScrCmd_HideSavingIcon) +ScriptCommand(FRSCRCMD_BUFFERITEMNAME, FrontierScrCmd_BufferItemName) +ScriptCommand(FRSCRCMD_BUFFERNUMBER, FrontierScrCmd_BufferNumber) +ScriptCommand(FRSCRCMD_BUFFERPLAYERNAME, FrontierScrCmd_BufferPlayerName) +ScriptCommand(FRSCRCMD_BUFFERPARTNERNAME, FrontierScrCmd_BufferPartnerName) +ScriptCommand(FRSCRCMD_BUFFERMOVENAME, FrontierScrCmd_BufferMoveName) +ScriptCommand(FRSCRCMD_BUFFERSPECIESNAME, FrontierScrCmd_BufferSpeciesName) +ScriptCommand(FRSCRCMD_BUFFERTYPENAME, FrontierScrCmd_BufferTypeName) +ScriptCommand(FRSCRCMD_BUFFERRIVALNAME, FrontierScrCmd_BufferRivalName) +ScriptCommand(FRSCRCMD_GETNUMBATTLEPOINTS, FrontierScrCmd_GetNumBattlePoints) +ScriptCommand(FRSCRCMD_GIVEBATTLEPOINTS, FrontierScrCmd_GiveBattlePoints) +ScriptCommand(FRSCRCMD_REMOTEBATTLEPOINTS, FrontierScrCmd_RemoteBattlePoints) +ScriptCommand(FRSCRCMD_CALLBATTLETOWERFUNCTION, FrontierScrCmd_CallBattleTowerFunction) +ScriptCommand(FRSCRCMD_85, FrontierScrCmd_85) +ScriptCommand(FRSCRCMD_FREETOWERSTRUCT, FrontierScrCmd_FreeTowerStruct) +ScriptCommand(FRSCRCMD_BATTLETOWER_STARTBATTLE, FrontierScrCmd_BattleTower_StartBattle) +ScriptCommand(FRSCRCMD_BATTLETOWER_CHECKWONBATTLE, FrontierScrCmd_BattleTower_CheckWonBattle) +ScriptCommand(FRSCRCMD_89, FrontierScrCmd_89) +ScriptCommand(FRSCRCMD_8A, FrontierScrCmd_8A) +ScriptCommand(FRSCRCMD_INITBATTLEHALL, FrontierScrCmd_InitBattleHall) +ScriptCommand(FRSCRCMD_BATTLEHALL_SETUP_NEXT_OPPONENT, FrontierScrCmd_BattleHall_SetupNextOpponent) +ScriptCommand(FRSCRCMD_FREEBATTLEHALL, FrontierScrCmd_FreeBattleHall) +ScriptCommand(FRSCRCMD_OPENBATTLEHALLAPP, FrontierScrCmd_OpenBattleHallApp) +ScriptCommand(FRSCRCMD_BATTLEHALL_CLEANUPBATTLE, FrontierScrCmd_BattleHall_CleanupBattle) +ScriptCommand(FRSCRCMD_BATTLEHALL_STARTBATTLE, FrontierScrCmd_BattleHall_StartBattle) +ScriptCommand(FRSCRCMD_CALLBATTLEHALLFUNCTION, FrontierScrCmd_CallBattleHallFunction) +ScriptCommand(FRSCRCMD_BATTLEHALL_CHECKWONBATTLE, FrontierScrCmd_BattleHall_CheckWonBattle) +ScriptCommand(FRSCRCMD_BATTLEHALL_SENDCOMMMESSAGE, FrontierScrCmd_BattleHall_SendCommMessage) +ScriptCommand(FRSCRCMD_94, FrontierScrCmd_94) +ScriptCommand(FRSCRCMD_BATTLEHALL_PRINTTRAINERINTRO, FrontierScrCmd_BattleHall_PrintTrainerIntro) +ScriptCommand(FRSCRCMD_DUMMY96, FrontierScrCmd_Dummy96) +ScriptCommand(FRSCRCMD_INITBATTLECASTLE, FrontierScrCmd_InitBattleCastle) +ScriptCommand(FRSCRCMD_LOADTRAINERSFORROUND, FrontierScrCmd_LoadTrainersForRound) +ScriptCommand(FRSCRCMD_FREEBATTLECASTLE, FrontierScrCmd_FreeBattleCastle) +ScriptCommand(FRSCRCMD_OPENBATTLECASTLESELFAPP, FrontierScrCmd_OpenBattleCastleSelfApp) +ScriptCommand(FRSCRCMD_BATTLECASTLE_CLEANUPBATTLE, FrontierScrCmd_BattleCastle_CleanupBattle) +ScriptCommand(FRSCRCMD_BATTLECASTLE_STARTBATTLE, FrontierScrCmd_BattleCastle_StartBattle) +ScriptCommand(FRSCRCMD_OPENBATTLECASTLEOPPONENTAPP, FrontierScrCmd_OpenBattleCastleOpponentApp) +ScriptCommand(FRSCRCMD_BATTLECASTLE_SETUPFIRSTOPPONENT, FrontierScrCmd_BattleCastle_SetupFirstOpponent) +ScriptCommand(FRSCRCMD_BATTLECASTLE_SETUPNEXTOPPONENT, FrontierScrCmd_BattleCastle_SetupNextOpponent) +ScriptCommand(FRSCRCMD_CALLBATTLECASTLEFUNCTION, FrontierScrCmd_CallBattleCastleFunction) +ScriptCommand(FRSCRCMD_BATTLECASTLE_CHECKWONBATTLE, FrontierScrCmd_BattleCastle_CheckWonBattle) +ScriptCommand(FRSCRCMD_BATTLECASTLE_SENDCOMMMESSAGE, FrontierScrCmd_BattleCastle_SendCommMessage) +ScriptCommand(FRSCRCMD_BATTLECASTLE_WAITFORCOMMRESPONSES, FrontierScrCmd_BattleCastle_WaitForCommResponses) +ScriptCommand(FRSCRCMD_DUMMYOPENBATTLECASTLEAPP, FrontierScrCmd_DummyOpenBattleCastleApp) +ScriptCommand(FRSCRCMD_A5, FrontierScrCmd_A5) +ScriptCommand(FRSCRCMD_GETCURRENTCASTLEPOINTS, FrontierScrCmd_GetCurrentCastlePoints) +ScriptCommand(FRSCRCMD_SPENDCASTLEPOINTS, FrontierScrCmd_SpendCastlePoints) +ScriptCommand(FRSCRCMD_RECEIVECASTLEPOINTS, FrontierScrCmd_ReceiveCastlePoints) +ScriptCommand(FRSCRCMD_BATTLECASTLE_PRINTRAINERINTRO, FrontierScrCmd_BattleCastle_PrintTrainerIntro) +ScriptCommand(FRSCRCMD_INITWFCFACILITYSELECTOR, FrontierScrCmd_InitWFCFacilitySelector) +ScriptCommand(FRSCRCMD_FREEWFCFACILITYSELECTOR, FrontierScrCmd_FreeWFCFacilitySelector) +ScriptCommand(FRSCRCMD_WFCFACILITYSELECTOR_SENDCOMMMESSAGE, FrontierScrCmd_WFCFacilitySelector_SendCommMessage) +ScriptCommand(FRSCRCMD_WFCFACILITYSELECTOR_WAITFORCOMMRESPONSES, FrontierScrCmd_WFCFacilitySelector_WaitForCommResponses) +ScriptCommand(FRSCRCMD_CHECKIFSAMEFACILITYCHOSEN, FrontierScrCmd_CheckIfSameFacilityChosen) +ScriptCommand(FRSCRCMD_MANAGEFACILITYSELECTORSUBAPP, FrontierScrCmd_ManageFacilitySelectorSubApp) +ScriptCommand(FRSCRCMD_GETSELECTEDPARTYMENUSLOTS, FrontierScrCmd_GetSelectedPartyMenuSlots) +ScriptCommand(FRSCRCMD_CHECKIFPARTNERDROPPEDOUT, FrontierScrCmd_CheckIfPartnerDroppedOut) +ScriptCommand(FRSCRCMD_CALLWFCFACILITYSELECTORFUNCTION, FrontierScrCmd_CallWFCFacilitySelectorFunction) +ScriptCommand(FRSCRCMD_INITBATTLETOWER, FrontierScrCmd_InitBattleTower) +ScriptCommand(FRSCRCMD_SENDTOWERTRAINERIDLIST, FrontierScrCmd_SendTowerTrainerIDList) +ScriptCommand(FRSCRCMD_WAITFORTOWERTRAINERIDLISTRESPONSES, FrontierScrCmd_WaitForTowerTrainerIDListResponses) +ScriptCommand(FRSCRCMD_FREEBATTLETOWER, FrontierScrCmd_FreeBattleTower) +ScriptCommand(FRSCRCMD_SETWIFILISTHOSTFRIENDCURRENTDATE, FrontierScrCmd_SetWiFiListHostFriendCurrentDate) +ScriptCommand(FRSCRCMD_INITBATTLEARCADE, FrontierScrCmd_InitBattleArcade) +ScriptCommand(FRSCRCMD_BATTLEARCADE_LOADTRAINERSFORROUND, FrontierScrCmd_BattleArcade_LoadTrainersForRound) +ScriptCommand(FRSCRCMD_FREEBATTLEARCADE, FrontierScrCmd_FreeBattleArcade) +ScriptCommand(FRSCRCMD_BATTLEARCADE_CLEANUPBATTLE, FrontierScrCmd_BattleArcade_CleanupBattle) +ScriptCommand(FRSCRCMD_BATTLEARCADE_STARTBATTLE, FrontierScrCmd_BattleArcade_StartBattle) +ScriptCommand(FRSCRCMD_BATTLEARCADE_SETUPFIRSTOPPONENT, FrontierScrCmd_BattleArcade_SetupFirstOpponent) +ScriptCommand(FRSCRCMD_BATTLEARCADE_SETUPNEXTOPPONENT, FrontierScrCmd_BattleArcade_SetupNextOpponent) +ScriptCommand(FRSCRCMD_CALLBATTLEARCADEFUNCTION, FrontierScrCmd_CallBattleArcadeFunction) +ScriptCommand(FRSCRCMD_BATTLEARCADE_CHECKWONBATTLE, FrontierScrCmd_BattleArcade_CheckWonBattle) +ScriptCommand(FRSCRCMD_BATTLEARCADE_SENDCOMMMESSAGE, FrontierScrCmd_BattleArcade_SendCommMessage) +ScriptCommand(FRSCRCMD_BATTLEARCADE_WAITFORCOMMRESPONSES, FrontierScrCmd_BattleArcade_WaitForCommResponses) +ScriptCommand(FRSCRCMD_OPENBATTLEARCADEAPP, FrontierScrCmd_OpenBattleArcadeApp) +ScriptCommand(FRSCRCMD_BATTLEARCADE_PRINTTRAINERINFO, FrontierScrCmd_BattleArcade_PrintTrainerIntro) +ScriptCommand(FRSCRCMD_APPLYARCADEEFFECT, FrontierScrCmd_ApplyArcadeEffect) +ScriptCommand(FRSCRCMD_SETITEMDRAWFLAG, FrontierScrCmd_SetItemDrawFlag) +ScriptCommand(FRSCRCMD_C7, FrontierScrCmd_C7) +ScriptCommand(FRSCRCMD_C8, FrontierScrCmd_C8) +ScriptCommand(FRSCRCMD_C9, FrontierScrCmd_C9) +ScriptCommand(FRSCRCMD_SETMENUXORIGINSIDE, FrontierScrCmd_SetMenuXOriginSide) +ScriptCommand(FRSCRCMD_SETMENUYORIGINSIDE, FrontierScrCmd_SetMenuYOriginSide) // clang-format on diff --git a/include/overlay104/frscrcmd_wfc_facility_selector.h b/include/overlay104/frscrcmd_wfc_facility_selector.h new file mode 100644 index 0000000000..f05153009e --- /dev/null +++ b/include/overlay104/frscrcmd_wfc_facility_selector.h @@ -0,0 +1,20 @@ +#ifndef POKEPLATINUM_FRSCRCMD_WFC_FACILITY_SELECTOR_H +#define POKEPLATINUM_FRSCRCMD_WFC_FACILITY_SELECTOR_H + +#include "overlay104/defs.h" + +BOOL FrontierScrCmd_InitWFCFacilitySelector(FrontierScriptContext *ctx); +BOOL FrontierScrCmd_FreeWFCFacilitySelector(FrontierScriptContext *ctx); +BOOL FrontierScrCmd_WFCFacilitySelector_SendCommMessage(FrontierScriptContext *ctx); +BOOL FrontierScrCmd_WFCFacilitySelector_WaitForCommResponses(FrontierScriptContext *ctx); +BOOL FrontierScrCmd_CheckIfSameFacilityChosen(FrontierScriptContext *ctx); +BOOL FrontierScrCmd_ManageFacilitySelectorSubApp(FrontierScriptContext *ctx); +BOOL FrontierScrCmd_GetSelectedPartyMenuSlots(FrontierScriptContext *ctx); +BOOL FrontierScrCmd_CheckIfPartnerDroppedOut(FrontierScriptContext *ctx); +BOOL FrontierScrCmd_CallWFCFacilitySelectorFunction(FrontierScriptContext *ctx); +BOOL FrontierScrCmd_InitBattleTower(FrontierScriptContext *ctx); +BOOL FrontierScrCmd_SendTowerTrainerIDList(FrontierScriptContext *ctx); +BOOL FrontierScrCmd_WaitForTowerTrainerIDListResponses(FrontierScriptContext *ctx); +BOOL FrontierScrCmd_FreeBattleTower(FrontierScriptContext *ctx); + +#endif // POKEPLATINUM_FRSCRCMD_WFC_FACILITY_SELECTOR_H diff --git a/include/overlay104/ov104_022395F0.h b/include/overlay104/ov104_022395F0.h deleted file mode 100644 index 7ff0cb5aa2..0000000000 --- a/include/overlay104/ov104_022395F0.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef POKEPLATINUM_OV104_022395F0_H -#define POKEPLATINUM_OV104_022395F0_H - -#include "overlay104/defs.h" - -BOOL FrontierScrCmd_AA(FrontierScriptContext *param0); -BOOL FrontierScrCmd_AB(FrontierScriptContext *param0); -BOOL FrontierScrCmd_AC(FrontierScriptContext *param0); -BOOL FrontierScrCmd_AD(FrontierScriptContext *param0); -BOOL FrontierScrCmd_AE(FrontierScriptContext *param0); -BOOL FrontierScrCmd_AF(FrontierScriptContext *param0); -BOOL FrontierScrCmd_B0(FrontierScriptContext *param0); -BOOL FrontierScrCmd_B1(FrontierScriptContext *param0); -BOOL FrontierScrCmd_B2(FrontierScriptContext *param0); -BOOL FrontierScrCmd_B3(FrontierScriptContext *param0); -BOOL FrontierScrCmd_B4(FrontierScriptContext *param0); -BOOL FrontierScrCmd_B5(FrontierScriptContext *param0); -BOOL FrontierScrCmd_ClearTowerStruct(FrontierScriptContext *ctx); - -#endif // POKEPLATINUM_OV104_022395F0_H diff --git a/include/overlay104/ov104_02239C58.h b/include/overlay104/ov104_02239C58.h deleted file mode 100644 index 33447a6842..0000000000 --- a/include/overlay104/ov104_02239C58.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef POKEPLATINUM_OV104_02239C58_H -#define POKEPLATINUM_OV104_02239C58_H - -#include "struct_decls/battle_frontier_decl.h" -#include "struct_defs/struct_0209BBA4.h" - -#include "savedata.h" - -UnkStruct_0209BBA4 *ov104_02239C58(SaveData *saveData); -void ov104_02239C7C(UnkStruct_0209BBA4 *param0); -BOOL ov104_02239C88(UnkStruct_0209BBA4 *param0, u16 param1, u16 param2, u16 param3); -void ov104_02239CD0(BattleFrontier *param0, UnkStruct_0209BBA4 *param1, u16 param2); - -#endif // POKEPLATINUM_OV104_02239C58_H diff --git a/include/overlay104/ov104_0223C164.h b/include/overlay104/ov104_0223C164.h deleted file mode 100644 index 6f37c9b694..0000000000 --- a/include/overlay104/ov104_0223C164.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef POKEPLATINUM_OV104_0223C164_H -#define POKEPLATINUM_OV104_0223C164_H - -#include "overlay104/struct_ov104_0223C23C_decl.h" - -#include "bg_window.h" - -UnkStruct_ov104_0223C23C *ov104_0223C164(BgConfig *param0); -void ov104_0223C23C(UnkStruct_ov104_0223C23C *param0); -u16 ov104_0223C264(u8 param0); -u16 ov104_0223C29C(u8 param0); - -#endif // POKEPLATINUM_OV104_0223C164_H diff --git a/include/overlay104/struct_ov104_0223C23C_decl.h b/include/overlay104/struct_ov104_0223C23C_decl.h deleted file mode 100644 index 9c67ca024b..0000000000 --- a/include/overlay104/struct_ov104_0223C23C_decl.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_OV104_0223C23C_DECL_H -#define POKEPLATINUM_STRUCT_OV104_0223C23C_DECL_H - -typedef struct UnkStruct_ov104_0223C23C_t UnkStruct_ov104_0223C23C; - -#endif // POKEPLATINUM_STRUCT_OV104_0223C23C_DECL_H diff --git a/include/overlay104/wfc_facility_selector.h b/include/overlay104/wfc_facility_selector.h new file mode 100644 index 0000000000..74c132cf46 --- /dev/null +++ b/include/overlay104/wfc_facility_selector.h @@ -0,0 +1,47 @@ +#ifndef POKEPLATINUM_WFC_FACILITY_SELECTOR_H +#define POKEPLATINUM_WFC_FACILITY_SELECTOR_H + +#include "struct_decls/battle_frontier_decl.h" + +#include "applications/party_menu/defs.h" +#include "applications/pokemon_summary_screen/main.h" +#include "field/field_system.h" + +#include "savedata.h" + +typedef struct WFCFacilitySelector { + SaveData *saveData; + void *unused; + u16 commBuffer[40]; + u8 partnerGender; + u8 partnerDroppedOut; + u16 unused2[8]; + u8 selectedMonSlots[4]; + u8 partnersSelectedFacility; + u8 msgsReceived; + u8 unused3; + u8 partnerNotPlayingAgain; + u16 partnersLatestStreak; + u16 partnersStreakDeletionChoice; + u16 selectedSpecies[4]; + u16 selectedItems[4]; + u16 partnersSelectedSpecies[4]; + u16 partnersSelectedItems[4]; + FieldSystem *fieldSystem; + u8 unused4; + u8 dummy; + u8 unused5; + u8 selectedMonSlot; + u8 selectedFacility; + u8 partyMenuSelectionOrder[4]; + PartyMenu *partyMenu; + PokemonSummary *summaryApp; + u16 *subAppResult; +} WFCFacilitySelector; + +WFCFacilitySelector *WFCFacilitySelector_Init(SaveData *saveData); +void WFCFacilitySelector_Free(WFCFacilitySelector *selector); +BOOL WFCFacilitySelector_SendCommMessage(WFCFacilitySelector *selector, u16 command, u16 arg1, u16 arg2); +void WFCFacilitySelector_ManageSubApp(BattleFrontier *frontier, WFCFacilitySelector *selector, u16 action); + +#endif // POKEPLATINUM_WFC_FACILITY_SELECTOR_H diff --git a/include/overlay104/wfc_facility_selector_helpers.h b/include/overlay104/wfc_facility_selector_helpers.h new file mode 100644 index 0000000000..868d726db5 --- /dev/null +++ b/include/overlay104/wfc_facility_selector_helpers.h @@ -0,0 +1,24 @@ +#ifndef POKEPLATINUM_WFC_FACILITY_SELECTOR_HELPERS_H +#define POKEPLATINUM_WFC_FACILITY_SELECTOR_HELPERS_H + +#include "bg_window.h" +#include "sys_task_manager.h" + +typedef struct WFCFacilitySelectorMonitorFlicker { + SysTask *task; + BgConfig *bgConfig; + u16 monitorState; + u16 delay; +} WFCFacilitySelectorMonitorFlicker; + +typedef struct WFCFacilitySelectorEffects { + BgConfig *unused; + WFCFacilitySelectorMonitorFlicker *flicker; +} WFCFacilitySelectorEffects; + +WFCFacilitySelectorEffects *WFCFacilitySelectorEffects_Init(BgConfig *bgConfig); +void WFCFacilitySelectorEffects_Free(WFCFacilitySelectorEffects *effects); +u16 BattleFrontier_GetWFCLatestStreakIndex(u8 facility); +u16 BattleFrontier_GetWFCStreakActiveIndex(u8 facility); + +#endif // POKEPLATINUM_WFC_FACILITY_SELECTOR_HELPERS_H diff --git a/include/struct_defs/battle_tower.h b/include/struct_defs/battle_tower.h index 5ad22f081e..ed9f21aa2f 100644 --- a/include/struct_defs/battle_tower.h +++ b/include/struct_defs/battle_tower.h @@ -48,7 +48,7 @@ typedef struct BattleTower { u16 unk_884[35]; int wonBattle; FieldBattleDTO *dto; - u8 unk_8D4; + u8 msgsReceived; u8 unk_8D5; u8 unk_8D6; u8 unk_8D7; diff --git a/include/struct_defs/struct_0209BBA4.h b/include/struct_defs/struct_0209BBA4.h deleted file mode 100644 index 74ac2ffa1a..0000000000 --- a/include/struct_defs/struct_0209BBA4.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0209BBA4_H -#define POKEPLATINUM_STRUCT_0209BBA4_H - -#include "applications/party_menu/defs.h" -#include "applications/pokemon_summary_screen/main.h" -#include "field/field_system_decl.h" - -#include "savedata.h" - -typedef struct { - SaveData *saveData; - void *unk_04; - u16 unk_08[40]; - u8 unk_58; - u8 unk_59; - u16 unk_5A[8]; - u8 unk_6A[4]; - u8 unk_6E; - u8 unk_6F; - u8 unk_70; - u8 unk_71; - u16 unk_72; - u16 unk_74; - u16 unk_76[4]; - u16 unk_7E[4]; - u16 unk_86[4]; - u16 unk_8E[4]; - FieldSystem *fieldSystem; - u8 unk_9C; - u8 unk_9D; - u8 unk_9E; - u8 unk_9F; - u8 unk_A0; - u8 unk_A1[4]; - PartyMenu *partyMenu; - PokemonSummary *unk_AC; - u16 *unk_B0; -} UnkStruct_0209BBA4; - -#endif // POKEPLATINUM_STRUCT_0209BBA4_H diff --git a/include/unk_0209BA80.h b/include/unk_0209BA80.h index 5bdb75ac30..b7d2ec30bf 100644 --- a/include/unk_0209BA80.h +++ b/include/unk_0209BA80.h @@ -2,14 +2,15 @@ #define POKEPLATINUM_UNK_0209BA80_H #include "struct_defs/battle_tower.h" -#include "struct_defs/struct_0209BBA4.h" + +#include "overlay104/wfc_facility_selector.h" void sub_0209BA80(void *param0); -BOOL sub_0209BB08(BattleTower *battleTower); -BOOL sub_0209BBA4(UnkStruct_0209BBA4 *param0); -BOOL sub_0209BC1C(UnkStruct_0209BBA4 *param0, u16 param1); -BOOL sub_0209BC64(UnkStruct_0209BBA4 *param0, u16 param1, u16 param2); -BOOL sub_0209BD68(UnkStruct_0209BBA4 *param0, u16 param1); -BOOL sub_0209BDB0(UnkStruct_0209BBA4 *param0, u16 param1); +BOOL BattleTower_SendTrainerIDListCmd(BattleTower *battleTower); +BOOL WFCFacilitySelector_SendFacilityAndLatestStreak(WFCFacilitySelector *selector); +BOOL WFCFacilitySelector_SendDidDropOutCmd(WFCFacilitySelector *selector, u16 didDropOut); +BOOL WFCFacilitySelector_SendSelectedMons(WFCFacilitySelector *selector, u16 selectedSlot1, u16 selectedSlot2); +BOOL WFCFacilitySelector_SendStreakDeletionChoice(WFCFacilitySelector *selector, u16 streakDeletionChoice); +BOOL WFCFacilitySelector_SendPlayAgainChoice(WFCFacilitySelector *selector, u16 notPlayingAgain); #endif // POKEPLATINUM_UNK_0209BA80_H diff --git a/platinum.us/main.lsf b/platinum.us/main.lsf index c50be2a5b4..ffadef8960 100644 --- a/platinum.us/main.lsf +++ b/platinum.us/main.lsf @@ -1551,14 +1551,14 @@ Overlay overlay104 Object main.nef.p/src_overlay104_frscrcmd_sound.c.o Object main.nef.p/src_overlay104_frscrcmd_battle_tower.c.o Object main.nef.p/src_overlay104_ov104_022394A4.c.o - Object main.nef.p/src_overlay104_ov104_022395F0.c.o - Object main.nef.p/src_overlay104_ov104_02239C58.c.o + Object main.nef.p/src_overlay104_frscrcmd_wfc_facility_selector.c.o + Object main.nef.p/src_overlay104_wfc_facility_selector.c.o Object main.nef.p/src_overlay104_ov104_0223A0C4.c.o Object main.nef.p/src_overlay104_battle_factory_helpers.c.o Object main.nef.p/src_overlay104_battle_hall_helpers.c.o Object main.nef.p/src_overlay104_battle_castle_helpers.c.o Object main.nef.p/src_overlay104_battle_arcade_helpers.c.o - Object main.nef.p/src_overlay104_ov104_0223C164.c.o + Object main.nef.p/src_overlay104_wfc_facility_selector_helpers.c.o Object main.nef.p/src_overlay104_frontier_graphics.c.o Object main.nef.p/src_overlay104_frontier_particle_system.c.o Object main.nef.p/src_overlay104_ov104_0223D768.c.o diff --git a/res/field/frontier_scripts/fr_script.order b/res/field/frontier_scripts/fr_script.order index 5af2a8f936..0fb4aad950 100644 --- a/res/field/frontier_scripts/fr_script.order +++ b/res/field/frontier_scripts/fr_script.order @@ -8,4 +8,4 @@ frontier_scripts_battle_tower_corridor frontier_scripts_battle_tower_corridor_multi frontier_scripts_battle_tower_battle_room frontier_scripts_battle_tower_multi_battle_room -frontier_scripts_unknown_10 +frontier_scripts_wfc_facility_selector diff --git a/res/field/frontier_scripts/frontier_scripts_battle_arcade.s b/res/field/frontier_scripts/frontier_scripts_battle_arcade.s index 43bd9fdf98..faddbc2bac 100644 --- a/res/field/frontier_scripts/frontier_scripts_battle_arcade.s +++ b/res/field/frontier_scripts/frontier_scripts_battle_arcade.s @@ -3125,7 +3125,7 @@ _2E86: _2E90: FreeBattleRecording FreeBattleArcade - FrontierScrCmd_04 FRONTIER_SCENE_14, 1 + FrontierScrCmd_04 FRONTIER_SCENE_WFC_FACILITY_SELECTOR, 1 End _2E9C: diff --git a/res/field/frontier_scripts/frontier_scripts_battle_castle.s b/res/field/frontier_scripts/frontier_scripts_battle_castle.s index 9f09b131db..6ba61e3cda 100644 --- a/res/field/frontier_scripts/frontier_scripts_battle_castle.s +++ b/res/field/frontier_scripts/frontier_scripts_battle_castle.s @@ -1829,7 +1829,7 @@ _1948: _1952: FreeBattleRecording FreeBattleCastle - FrontierScrCmd_04 FRONTIER_SCENE_14, 1 + FrontierScrCmd_04 FRONTIER_SCENE_WFC_FACILITY_SELECTOR, 1 End _195E: diff --git a/res/field/frontier_scripts/frontier_scripts_battle_factory.s b/res/field/frontier_scripts/frontier_scripts_battle_factory.s index 5b33b6a3e8..fc47010f1a 100644 --- a/res/field/frontier_scripts/frontier_scripts_battle_factory.s +++ b/res/field/frontier_scripts/frontier_scripts_battle_factory.s @@ -1412,7 +1412,7 @@ _1368: CallBattleFactoryFunction BF_FUNC_STOP_CORRIDOR_ANIMATION, 0, 0, VAR_0x8008 FreeBattleRecording FreeBattleFactory - FrontierScrCmd_04 FRONTIER_SCENE_14, 1 + FrontierScrCmd_04 FRONTIER_SCENE_WFC_FACILITY_SELECTOR, 1 End _137B: diff --git a/res/field/frontier_scripts/frontier_scripts_battle_hall.s b/res/field/frontier_scripts/frontier_scripts_battle_hall.s index ca62250ebc..3f8546321e 100644 --- a/res/field/frontier_scripts/frontier_scripts_battle_hall.s +++ b/res/field/frontier_scripts/frontier_scripts_battle_hall.s @@ -1252,7 +1252,7 @@ _1071: _107B: FreeBattleRecording FreeBattleHall - FrontierScrCmd_04 FRONTIER_SCENE_14, 1 + FrontierScrCmd_04 FRONTIER_SCENE_WFC_FACILITY_SELECTOR, 1 End _1087: diff --git a/res/field/frontier_scripts/frontier_scripts_battle_tower_multi_battle_room.s b/res/field/frontier_scripts/frontier_scripts_battle_tower_multi_battle_room.s index 16a1522f9b..ff72e99283 100644 --- a/res/field/frontier_scripts/frontier_scripts_battle_tower_multi_battle_room.s +++ b/res/field/frontier_scripts/frontier_scripts_battle_tower_multi_battle_room.s @@ -393,8 +393,8 @@ _04D1: Return _04D5: - ClearTowerStruct - FrontierScrCmd_04 FRONTIER_SCENE_14, 1 + FreeBattleTower + FrontierScrCmd_04 FRONTIER_SCENE_WFC_FACILITY_SELECTOR, 1 End _04DF: diff --git a/res/field/frontier_scripts/frontier_scripts_unknown_10.s b/res/field/frontier_scripts/frontier_scripts_unknown_10.s deleted file mode 100644 index bb60485ff2..0000000000 --- a/res/field/frontier_scripts/frontier_scripts_unknown_10.s +++ /dev/null @@ -1,584 +0,0 @@ -# include "macros/frscrcmd.inc" -# include "res/text/bank/unk_0015.h" -# include "constants/battle_frontier.h" - - .data - - .long _0039 - 4 - .long _08D9 - 4 - .short 0xFD13 - - .balign 4, 0 -_000C: - .short 0xEEEE - .byte 0x00 - .short 0xEEEF - .byte 0x00 - .short 0xFD13 - - .balign 4, 0 -_0014: - .short 0x0000 - .short 0xEEEE - .byte 0x01 - .short 0x0070 - .short 0x0070 - .byte 0x00 - .byte 0x00 - .short 0x0002 - .short 0xEEEF - .byte 0x00 - .short 0x0070 - .short 0x0040 - .byte 0x01 - .byte 0x00 - .byte 0x00 - .short 0x0003 - .short 0xEEEF - .byte 0x00 - .short 0x0080 - .short 0x0040 - .byte 0x01 - .byte 0x00 - .byte 0x01 - .short 0xFD13 - -_0039: - HealParty - PlayBGM SEQ_BF_TOWWER_sseq - FrontierScrCmd_AA - WaitTime 1, VAR_0x8008 - FrontierScrCmd_B2 0, 0, 0, VAR_0x8008 - WaitTime 1, VAR_0x8008 - ClearReceivedTempDataAllPlayers - SyncConnectedPlayers 176 - ClearReceivedTempDataAllPlayers - FrontierScrCmd_22 _000C - FrontierScrCmd_24 _0014 - GoTo _0070 - End - -_0070: - FadeScreenIn - GoTo _0084 - End - -_0084: - Message pl_msg_00000015_00000 - InitLocalTextListMenu 31, 5, 0, 1, VAR_0x8008 - SetMenuXOriginSide 1 - AddListMenuEntry pl_msg_00000015_00026, 255, 1 - AddListMenuEntry pl_msg_00000015_00027, 255, 2 - AddListMenuEntry pl_msg_00000015_00028, 255, 4 - AddListMenuEntry pl_msg_00000015_00029, 255, 5 - AddListMenuEntry pl_msg_00000015_00030, 255, 6 - AddListMenuEntry pl_msg_00000015_00031, 255, 7 - ShowListMenu - GoToIfEq VAR_0x8008, 1, _010E - GoToIfEq VAR_0x8008, 2, _012F - GoToIfEq VAR_0x8008, 4, _01CA - GoToIfEq VAR_0x8008, 5, _01F1 - GoToIfEq VAR_0x8008, 6, _0218 - GoTo _023F - End - -_010E: - FrontierScrCmd_B2 7, 1, 0, VAR_0x8008 - SetVar VAR_0x8004, 0 - SetVar VAR_0x8009, 1 - SetSystemVar VAR_MAP_LOCAL_0x03, 0 - GoTo _0254 - End - -_012F: - SetSystemVar VAR_BATTLE_FACTORY_CHALLENGE_TYPE, FRONTIER_CHALLENGE_MULTI_WFC - SetSystemVar VAR_MAP_LOCAL_0x03, 0 - GoTo _0143 - End - -_0143: - Message pl_msg_00000015_00014 - InitLocalTextMenu 31, 11, 0, TRUE, VAR_0x8008 - SetMenuXOriginSide 1 - AddMenuEntry pl_msg_00000015_00032, 0 - AddMenuEntry pl_msg_00000015_00033, 1 - AddMenuEntry pl_msg_00000015_00031, 2 - ShowMenu - GoToIfEq VAR_0x8008, 0, _0188 - GoToIfEq VAR_0x8008, 1, _01A9 - GoTo _0084 - End - -_0188: - FrontierScrCmd_B2 7, 2, 0, VAR_0x8008 - SetVar VAR_0x8004, 0 - SetVar VAR_0x8009, 2 - SetSystemVar VAR_BATTLE_FACTORY_CHALLENGE_LEVEL, 0 - GoTo _0254 - End - -_01A9: - FrontierScrCmd_B2 7, 3, 0, VAR_0x8008 - SetVar VAR_0x8004, 0 - SetVar VAR_0x8009, 3 - SetSystemVar VAR_BATTLE_FACTORY_CHALLENGE_LEVEL, 1 - GoTo _0254 - End - -_01CA: - FrontierScrCmd_B2 7, 4, 0, VAR_0x8008 - SetVar VAR_0x8004, 0 - SetVar VAR_0x8009, 4 - SetSystemVar VAR_BATTLE_CASTLE_CHALLENGE_TYPE, FRONTIER_CHALLENGE_MULTI_WFC - SetSystemVar VAR_MAP_LOCAL_0x03, 0 - GoTo _0254 - End - -_01F1: - FrontierScrCmd_B2 7, 5, 0, VAR_0x8008 - SetVar VAR_0x8004, 0 - SetVar VAR_0x8009, 5 - SetSystemVar VAR_BATTLE_HALL_CHALLENGE_TYPE, FRONTIER_CHALLENGE_MULTI_WFC - SetSystemVar VAR_MAP_LOCAL_0x03, 0 - GoTo _0254 - End - -_0218: - FrontierScrCmd_B2 7, 6, 0, VAR_0x8008 - SetVar VAR_0x8004, 0 - SetVar VAR_0x8009, 6 - SetSystemVar VAR_BATTLE_ARCADE_CHALLENGE_TYPE, FRONTIER_CHALLENGE_MULTI_WFC - SetSystemVar VAR_MAP_LOCAL_0x03, 0 - GoTo _0254 - End - -_023F: - FrontierScrCmd_B2 7, 7, 0, VAR_0x8008 - SetVar VAR_0x8004, 1 - GoTo _0254 - End - -_0254: - MessageNoSkip pl_msg_00000015_00004 - GoTo _0260 - End - -_0260: - SetVar VAR_0x800A, 1 - FrontierScrCmd_AC VAR_0x800A, VAR_0x8004, 0, VAR_0x8008 - GoToIfEq VAR_0x8008, 0, _0260 - FrontierScrCmd_AD VAR_0x800A - ClearReceivedTempDataAllPlayers - FrontierScrCmd_B2 9, 0, 0, VAR_0x8008 - GoToIfEq VAR_0x8008, 7, _09C0 - FrontierScrCmd_B1 VAR_0x8008 - GoToIfEq VAR_0x8008, 1, _02B8 - ClearReceivedTempDataAllPlayers - SyncConnectedPlayers 170 - ClearReceivedTempDataAllPlayers - GoTo _02C0 - End - -_02B8: - GoTo _09AD - End - -_02C0: - SetVar VAR_0x800A, 0 - FrontierScrCmd_AC VAR_0x800A, 0, 0, VAR_0x8008 - GoToIfEq VAR_0x8008, 0, _02C0 - FrontierScrCmd_AD VAR_0x800A - ClearReceivedTempDataAllPlayers - FrontierScrCmd_AE VAR_0x8009, VAR_0x8008 - GoToIfEq VAR_0x8008, 1, _0302 - Message pl_msg_00000015_00003 - GoTo _0084 - End - -_0302: - FrontierScrCmd_B2 9, 0, 0, VAR_0x8008 - GoToIfEq VAR_0x8008, 1, _0345 - GoToIfEq VAR_0x8008, 5, _0345 - GoToIfEq VAR_0x8008, 4, _0345 - GoToIfEq VAR_0x8008, 6, _0345 - GoTo _0758 - End - -_0345: - Message pl_msg_00000015_00002 - FadeScreenOut - CloseMessage - FrontierScrCmd_B2 13, 0, 0, VAR_0x8008 - GoTo _037E - End - -_0366: - FrontierScrCmd_AF VAR_0x8009, 2, VAR_0x8008 - FrontierScrCmd_AF VAR_0x8009, 3, VAR_0x8008 - GoTo _037E - End - -_037E: - FrontierScrCmd_AF VAR_0x8009, 0, VAR_0x8008 - FrontierScrCmd_AF VAR_0x8009, 1, VAR_0x8008 - GoToIfEq VAR_0x8008, 2, _0366 - FrontierScrCmd_B0 VAR_0x8002, VAR_0x8005 - SetSystemVar VAR_MAP_LOCAL_0x02, VAR_0x8002 - SetSystemVar VAR_MAP_LOCAL_0x05, VAR_0x8005 - FadeScreenIn - GoTo _03C1 - End - -_03C1: - MessageNoSkip pl_msg_00000015_00004 - GoTo _03CD - End - -_03CD: - SetVar VAR_0x800A, 2 - FrontierScrCmd_AC VAR_0x800A, VAR_0x8002, VAR_0x8005, VAR_0x8008 - GoToIfEq VAR_0x8008, 0, _03CD - FrontierScrCmd_AD VAR_0x800A - ClearReceivedTempDataAllPlayers - GoToIfEq VAR_0x8002, 255, _0084 - FrontierScrCmd_B2 1, 0, 0, VAR_0x8008 - GoToIfEq VAR_0x8008, 0, _044E - FrontierScrCmd_B2 9, 0, 0, VAR_0x8008 - GoToIfEq VAR_0x8008, 1, _045D - GoToIfEq VAR_0x8008, 5, _04F9 - GoToIfEq VAR_0x8008, 4, _0620 - GoToIfEq VAR_0x8008, 6, _06BC - End - -_044E: - BufferPartnerName 0 - Message pl_msg_00000015_00001 - GoTo _0084 - End - -_045D: - FrontierScrCmd_B2 2, 1, 0, VAR_0x8008 - SetVar FR_VAR_0x8010, VAR_0x8008 - GoToIfEq FR_VAR_0x8010, 1, _0499 - GoToIfEq FR_VAR_0x8010, 2, _04B4 - GoToIfEq FR_VAR_0x8010, 3, _04CF - GoTo _0758 - End - -_0499: - FrontierScrCmd_B2 5, 0, 0, VAR_0x8008 - BufferSpeciesName 0, VAR_0x8008 - Message pl_msg_00000015_00006 - GoTo _0084 - End - -_04B4: - FrontierScrCmd_B2 5, 1, 0, VAR_0x8008 - BufferSpeciesName 0, VAR_0x8008 - Message pl_msg_00000015_00006 - GoTo _0084 - End - -_04CF: - FrontierScrCmd_B2 5, 0, 0, VAR_0x8008 - BufferSpeciesName 0, VAR_0x8008 - FrontierScrCmd_B2 5, 1, 0, VAR_0x8008 - BufferSpeciesName 1, VAR_0x8008 - Message pl_msg_00000015_00007 - GoTo _0084 - End - -_04F9: - FrontierScrCmd_B2 2, 5, 0, VAR_0x8008 - GoToIfEq VAR_0x8008, 1, _0614 - Call _081C - GoToIfEq FR_VAR_0x800F, 0, _0766 - FrontierScrCmd_B2 3, 0, 0, VAR_0x8008 - GoToIfEq VAR_0x8008, 0, _0758 - FrontierScrCmd_B2 4, 0, 0, VAR_0x800B - BufferSpeciesName 0, VAR_0x800B - FrontierScrCmd_B2 5, 0, 0, VAR_0x8008 - BufferSpeciesName 1, VAR_0x8008 - GoToIfEq VAR_0x8008, VAR_0x800B, _0758 - GoTo _0567 - End - -_0567: - Message pl_msg_00000015_00015 - InitLocalTextMenu 25, 13, 1, TRUE, VAR_0x8008 - AddMenuEntry pl_msg_00000015_00016, 0 - AddMenuEntry pl_msg_00000015_00017, 1 - ShowMenu - MessageNoSkip pl_msg_00000015_00024 - SetVar VAR_0x800B, VAR_0x8008 - GoTo _0593 - End - -_0593: - SetVar VAR_0x800A, 4 - FrontierScrCmd_AC VAR_0x800A, VAR_0x800B, 0, VAR_0x8008 - GoToIfEq VAR_0x8008, 0, _0593 - FrontierScrCmd_AD VAR_0x800A - ClearReceivedTempDataAllPlayers - FrontierScrCmd_B2 8, 0, 0, VAR_0x8008 - GoToIfEq VAR_0x8008, 1, _05F9 - GoToIfEq VAR_0x8008, -2, _05F9 - GoToIfEq VAR_0x800B, 1, _05F9 - GoToIfEq VAR_0x800B, -2, _05F9 - GoTo _0605 - End - -_05F9: - Message pl_msg_00000015_00018 - GoTo _0084 - End - -_0605: - FrontierScrCmd_B2 6, 0, 0, VAR_0x8008 - GoTo _0758 - End - -_0614: - Message pl_msg_00000015_00011 - GoTo _0084 - End - -_0620: - FrontierScrCmd_B2 2, 4, 0, VAR_0x8008 - SetVar FR_VAR_0x8010, VAR_0x8008 - GoToIfEq FR_VAR_0x8010, 1, _065C - GoToIfEq FR_VAR_0x8010, 2, _0677 - GoToIfEq FR_VAR_0x8010, 3, _0692 - GoTo _0758 - End - -_065C: - FrontierScrCmd_B2 5, 0, 0, VAR_0x8008 - BufferSpeciesName 0, VAR_0x8008 - Message pl_msg_00000015_00009 - GoTo _0084 - End - -_0677: - FrontierScrCmd_B2 5, 1, 0, VAR_0x8008 - BufferSpeciesName 0, VAR_0x8008 - Message pl_msg_00000015_00009 - GoTo _0084 - End - -_0692: - FrontierScrCmd_B2 5, 0, 0, VAR_0x8008 - BufferSpeciesName 0, VAR_0x8008 - FrontierScrCmd_B2 5, 1, 0, VAR_0x8008 - BufferSpeciesName 1, VAR_0x8008 - Message pl_msg_00000015_00010 - GoTo _0084 - End - -_06BC: - FrontierScrCmd_B2 2, 6, 0, VAR_0x8008 - SetVar FR_VAR_0x8010, VAR_0x8008 - GoToIfEq FR_VAR_0x8010, 1, _06F8 - GoToIfEq FR_VAR_0x8010, 2, _0713 - GoToIfEq FR_VAR_0x8010, 3, _072E - GoTo _0758 - End - -_06F8: - FrontierScrCmd_B2 5, 0, 0, VAR_0x8008 - BufferSpeciesName 0, VAR_0x8008 - Message pl_msg_00000015_00009 - GoTo _0084 - End - -_0713: - FrontierScrCmd_B2 5, 1, 0, VAR_0x8008 - BufferSpeciesName 0, VAR_0x8008 - Message pl_msg_00000015_00009 - GoTo _0084 - End - -_072E: - FrontierScrCmd_B2 5, 0, 0, VAR_0x8008 - BufferSpeciesName 0, VAR_0x8008 - FrontierScrCmd_B2 5, 1, 0, VAR_0x8008 - BufferSpeciesName 1, VAR_0x8008 - Message pl_msg_00000015_00010 - GoTo _0084 - End - -_0758: - Call _081C - GoTo _0766 - End - -_0766: - FrontierScrCmd_B2 12, 0, 0, VAR_0x8008 - SetSystemVar VAR_WIFI_FRONTIER_CLEARED, VAR_0x8008 - ClearReceivedTempDataAllPlayers - SyncConnectedPlayers 175 - ClearReceivedTempDataAllPlayers - MessageInstant pl_msg_00000015_00019 - ShowSavingIcon - FrontierScrCmd_73 VAR_0x8008 - HideSavingIcon - PlaySoundEffect SEQ_SE_DP_SAVE_sseq - WaitSoundEffect SEQ_SE_DP_SAVE_sseq - MessageNoSkip pl_msg_00000015_00020 - WaitTime 10, VAR_0x8008 - ClearReceivedTempDataAllPlayers - SyncConnectedPlayers 171 - ClearReceivedTempDataAllPlayers - CloseMessage - FadeScreenOut - FrontierScrCmd_25 0 - FrontierScrCmd_25 2 - FrontierScrCmd_25 3 - IncrementRecordValue RECORD_TIMES_STARTED_BATTLE_FRONTIER_CHALLENGE - FrontierScrCmd_B2 9, 0, 0, VAR_0x8008 - SetVar FR_VAR_0x8010, VAR_0x8008 - GoToIfEq FR_VAR_0x8010, 1, _0842 - GoToIfEq FR_VAR_0x8010, 2, _0879 - GoToIfEq FR_VAR_0x8010, 3, _0879 - GoToIfEq FR_VAR_0x8010, 5, _088D - GoToIfEq FR_VAR_0x8010, 4, _08A1 - GoToIfEq FR_VAR_0x8010, 6, _08B5 - End - -_081C: - FrontierScrCmd_B2 11, 0, 0, VAR_0x8008 - SetVar FR_VAR_0x800F, VAR_0x8008 - CallIfEq VAR_0x8008, 0, _0838 - Return - -_0838: - Message pl_msg_00000015_00005 - MessageNoSkip pl_msg_00000015_00004 - Return - -_0842: - FrontierScrCmd_B3 - SetSystemVar VAR_BATTLE_TOWER_MULTI_BATTLE_ROOM_LOAD_ACTION, 1 - Call _08D3 - GoTo _0858 - End - -_0858: - FrontierScrCmd_B4 VAR_0x8008 - GoToIfEq VAR_0x8008, 0, _0858 - FrontierScrCmd_B5 - Call _08C9 - FrontierScrCmd_04 FRONTIER_SCENE_TOWER_MULTI_CORRIDOR, 0 - End - -_0879: - FrontierScrCmd_AB - PlayBGM SEQ_PL_BF_FACTORY_sseq - Call _08C9 - FrontierScrCmd_04 FRONTIER_SCENE_FACTORY_CORRIDOR, 0 - End - -_088D: - FrontierScrCmd_AB - PlayBGM SEQ_PL_BF_STAGE_sseq - Call _08C9 - FrontierScrCmd_04 FRONTIER_SCENE_HALL_CORRIDOR, 0 - End - -_08A1: - FrontierScrCmd_AB - PlayBGM SEQ_PL_BF_CASTLE02_sseq - Call _08C9 - FrontierScrCmd_04 FRONTIER_SCENE_CASTLE_CORRIDOR, 0 - End - -_08B5: - FrontierScrCmd_AB - PlayBGM SEQ_PL_BF_ROULETTE_sseq - Call _08C9 - FrontierScrCmd_04 FRONTIER_SCENE_ARCADE_CORRIDOR, 0 - End - -_08C9: - ClearReceivedTempDataAllPlayers - SyncConnectedPlayers 173 - ClearReceivedTempDataAllPlayers - Return - -_08D3: - ClearReceivedTempDataAllPlayers - SyncConnectedPlayers 174 - -_08D9: - ClearReceivedTempDataAllPlayers - Return - -_08DD: - SetWiFiListHostFriendCurrentDate - FrontierScrCmd_AA - WaitTime 1, VAR_0x8008 - FrontierScrCmd_B2 0, 0, 0, VAR_0x8008 - WaitTime 1, VAR_0x8008 - ClearReceivedTempDataAllPlayers - SyncConnectedPlayers 177 - ClearReceivedTempDataAllPlayers - FrontierScrCmd_22 _000C - FrontierScrCmd_24 _0014 - PlayBGM SEQ_BF_TOWWER_sseq - FadeScreenIn - BufferPartnerName 0 - Message pl_msg_00000015_00021 - ShowYesNoMenu VAR_0x8008, MENU_YES - GoToIfEq VAR_0x8008, 0, _0939 - GoTo _094B - End - -_0939: - MessageNoSkip pl_msg_00000015_00024 - SetVar VAR_0x800B, 0 - GoTo _095D - End - -_094B: - MessageNoSkip pl_msg_00000015_00024 - SetVar VAR_0x800B, 1 - GoTo _095D - End - -_095D: - SetVar VAR_0x800A, 5 - FrontierScrCmd_AC VAR_0x800A, VAR_0x800B, 0, VAR_0x8008 - GoToIfEq VAR_0x8008, 0, _095D - FrontierScrCmd_AD VAR_0x800A - ClearReceivedTempDataAllPlayers - FrontierScrCmd_B1 VAR_0x8008 - FrontierScrCmd_B2 10, 0, 0, VAR_0x8008 - GoToIfEq VAR_0x8008, 1, _09AD - GoToIfEq VAR_0x800B, 1, _09C0 - GoTo _0084 - End - -_09AD: - BufferPartnerName 0 - MessageNoSkip pl_msg_00000015_00025 - MessageNoSkip pl_msg_00000015_00004 - GoTo _09C0 - End - -_09C0: - ClearReceivedTempDataAllPlayers - SyncConnectedPlayers 172 - ClearReceivedTempDataAllPlayers - CloseMessage - GoTo _09D2 - End - -_09D2: - FadeScreenOut - FrontierScrCmd_AB - ClearReceivedTempDataAllPlayers - SyncConnectedPlayers 178 - ClearReceivedTempDataAllPlayers - FrontierScrCmd_02 - - .balign 4, 0 diff --git a/res/field/frontier_scripts/frontier_scripts_wfc_facility_selector.s b/res/field/frontier_scripts/frontier_scripts_wfc_facility_selector.s new file mode 100644 index 0000000000..0241b28b72 --- /dev/null +++ b/res/field/frontier_scripts/frontier_scripts_wfc_facility_selector.s @@ -0,0 +1,585 @@ +# include "macros/frscrcmd.inc" +# include "res/text/bank/wfc_facility_selector.h" +# include "constants/battle_frontier.h" +# include "constants/wfc_facility_selector_functions.h" + + .data + + .long _0039 - 4 + .long _08D9 - 4 + .short 0xFD13 + + .balign 4, 0 +_000C: + .short 0xEEEE + .byte 0x00 + .short 0xEEEF + .byte 0x00 + .short 0xFD13 + + .balign 4, 0 +_0014: + .short 0x0000 + .short 0xEEEE + .byte 0x01 + .short 0x0070 + .short 0x0070 + .byte 0x00 + .byte 0x00 + .short 0x0002 + .short 0xEEEF + .byte 0x00 + .short 0x0070 + .short 0x0040 + .byte 0x01 + .byte 0x00 + .byte 0x00 + .short 0x0003 + .short 0xEEEF + .byte 0x00 + .short 0x0080 + .short 0x0040 + .byte 0x01 + .byte 0x00 + .byte 0x01 + .short 0xFD13 + +_0039: + HealParty + PlayBGM SEQ_BF_TOWWER_sseq + InitWFCFacilitySelector + WaitTime 1, VAR_0x8008 + CallWFCFacilitySelectorFunction WFCFS_FUNC_INIT_COMM_MANAGER, 0, 0, VAR_0x8008 + WaitTime 1, VAR_0x8008 + ClearReceivedTempDataAllPlayers + SyncConnectedPlayers 176 + ClearReceivedTempDataAllPlayers + FrontierScrCmd_22 _000C + FrontierScrCmd_24 _0014 + GoTo _0070 + End + +_0070: + FadeScreenIn + GoTo _0084 + End + +_0084: + Message WFCFacilitySelector_Text_WhichFacility + InitLocalTextListMenu 31, 5, 0, 1, VAR_0x8008 + SetMenuXOriginSide 1 + AddListMenuEntry WFCFacilitySelector_Text_BattleTower, 255, 1 + AddListMenuEntry WFCFacilitySelector_Text_BattleFactory, 255, 2 + AddListMenuEntry WFCFacilitySelector_Text_BattleCastle, 255, 4 + AddListMenuEntry WFCFacilitySelector_Text_BattleHall, 255, 5 + AddListMenuEntry WFCFacilitySelector_Text_BattleArcade, 255, 6 + AddListMenuEntry WFCFacilitySelector_Text_Cancel, 255, 7 + ShowListMenu + GoToIfEq VAR_0x8008, 1, _010E + GoToIfEq VAR_0x8008, 2, _012F + GoToIfEq VAR_0x8008, 4, _01CA + GoToIfEq VAR_0x8008, 5, _01F1 + GoToIfEq VAR_0x8008, 6, _0218 + GoTo _023F + End + +_010E: + CallWFCFacilitySelectorFunction WFCFS_FUNC_SET_SELECTED_FACILITY, FACILITY_TOWER, 0, VAR_0x8008 + SetVar VAR_0x8004, FALSE + SetVar VAR_0x8009, FACILITY_TOWER + SetSystemVar VAR_MAP_LOCAL_0x03, 0 + GoTo _0254 + End + +_012F: + SetSystemVar VAR_BATTLE_FACTORY_CHALLENGE_TYPE, FRONTIER_CHALLENGE_MULTI_WFC + SetSystemVar VAR_MAP_LOCAL_0x03, 0 + GoTo _0143 + End + +_0143: + Message WFCFacilitySelector_Text_ChooseLevel50OrOpen + InitLocalTextMenu 31, 11, 0, TRUE, VAR_0x8008 + SetMenuXOriginSide 1 + AddMenuEntry WFCFacilitySelector_Text_Level50, 0 + AddMenuEntry WFCFacilitySelector_Text_OpenLevel, 1 + AddMenuEntry WFCFacilitySelector_Text_Cancel, 2 + ShowMenu + GoToIfEq VAR_0x8008, 0, _0188 + GoToIfEq VAR_0x8008, 1, _01A9 + GoTo _0084 + End + +_0188: + CallWFCFacilitySelectorFunction WFCFS_FUNC_SET_SELECTED_FACILITY, FACILITY_FACTORY, 0, VAR_0x8008 + SetVar VAR_0x8004, FALSE + SetVar VAR_0x8009, FACILITY_FACTORY + SetSystemVar VAR_BATTLE_FACTORY_CHALLENGE_LEVEL, 0 + GoTo _0254 + End + +_01A9: + CallWFCFacilitySelectorFunction WFCFS_FUNC_SET_SELECTED_FACILITY, FACILITY_FACTORY_OPEN, 0, VAR_0x8008 + SetVar VAR_0x8004, FALSE + SetVar VAR_0x8009, FACILITY_FACTORY_OPEN + SetSystemVar VAR_BATTLE_FACTORY_CHALLENGE_LEVEL, 1 + GoTo _0254 + End + +_01CA: + CallWFCFacilitySelectorFunction WFCFS_FUNC_SET_SELECTED_FACILITY, FACILITY_CASTLE, 0, VAR_0x8008 + SetVar VAR_0x8004, FALSE + SetVar VAR_0x8009, FACILITY_CASTLE + SetSystemVar VAR_BATTLE_CASTLE_CHALLENGE_TYPE, FRONTIER_CHALLENGE_MULTI_WFC + SetSystemVar VAR_MAP_LOCAL_0x03, 0 + GoTo _0254 + End + +_01F1: + CallWFCFacilitySelectorFunction WFCFS_FUNC_SET_SELECTED_FACILITY, FACILITY_HALL, 0, VAR_0x8008 + SetVar VAR_0x8004, FALSE + SetVar VAR_0x8009, FACILITY_HALL + SetSystemVar VAR_BATTLE_HALL_CHALLENGE_TYPE, FRONTIER_CHALLENGE_MULTI_WFC + SetSystemVar VAR_MAP_LOCAL_0x03, 0 + GoTo _0254 + End + +_0218: + CallWFCFacilitySelectorFunction WFCFS_FUNC_SET_SELECTED_FACILITY, FACILITY_ARCADE, 0, VAR_0x8008 + SetVar VAR_0x8004, FALSE + SetVar VAR_0x8009, FACILITY_ARCADE + SetSystemVar VAR_BATTLE_ARCADE_CHALLENGE_TYPE, FRONTIER_CHALLENGE_MULTI_WFC + SetSystemVar VAR_MAP_LOCAL_0x03, 0 + GoTo _0254 + End + +_023F: + CallWFCFacilitySelectorFunction WFCFS_FUNC_SET_SELECTED_FACILITY, MAX_FACILITIES, 0, VAR_0x8008 + SetVar VAR_0x8004, TRUE + GoTo _0254 + End + +_0254: + MessageNoSkip WFCFacilitySelector_Text_PleaseWait + GoTo _0260 + End + +_0260: + SetVar VAR_0x800A, WFC_SELECTOR_COMM_DID_DROP_OUT + WFCFacilitySelector_SendCommMessage VAR_0x800A, VAR_0x8004, 0, VAR_0x8008 + GoToIfEq VAR_0x8008, 0, _0260 + WFCFacilitySelector_WaitForCommResponses VAR_0x800A + ClearReceivedTempDataAllPlayers + CallWFCFacilitySelectorFunction WFCFS_FUNC_GET_SELECTED_FACILITY, 0, 0, VAR_0x8008 + GoToIfEq VAR_0x8008, MAX_FACILITIES, _09C0 + CheckIfPartnerDroppedOut VAR_0x8008 + GoToIfEq VAR_0x8008, TRUE, _02B8 + ClearReceivedTempDataAllPlayers + SyncConnectedPlayers 170 + ClearReceivedTempDataAllPlayers + GoTo _02C0 + End + +_02B8: + GoTo _09AD + End + +_02C0: + SetVar VAR_0x800A, WFC_SELECTOR_COMM_FACILITY_AND_STREAK + WFCFacilitySelector_SendCommMessage VAR_0x800A, 0, 0, VAR_0x8008 + GoToIfEq VAR_0x8008, 0, _02C0 + WFCFacilitySelector_WaitForCommResponses VAR_0x800A + ClearReceivedTempDataAllPlayers + CheckIfSameFacilityChosen VAR_0x8009, VAR_0x8008 + GoToIfEq VAR_0x8008, TRUE, _0302 + Message WFCFacilitySelector_Text_DifferentFacilitiesChosen + GoTo _0084 + End + +_0302: + CallWFCFacilitySelectorFunction WFCFS_FUNC_GET_SELECTED_FACILITY, 0, 0, VAR_0x8008 + GoToIfEq VAR_0x8008, FACILITY_TOWER, _0345 + GoToIfEq VAR_0x8008, FACILITY_HALL, _0345 + GoToIfEq VAR_0x8008, FACILITY_CASTLE, _0345 + GoToIfEq VAR_0x8008, FACILITY_ARCADE, _0345 + GoTo _0758 + End + +_0345: + Message WFCFacilitySelector_Text_ChoosePokemon + FadeScreenOut + CloseMessage + CallWFCFacilitySelectorFunction WFCFS_FUNC_CLEAR_PARTY_MENU_SELECTIONS, 0, 0, VAR_0x8008 + GoTo _037E + End + +_0366: + ManageFacilitySelectorSubApp VAR_0x8009, WFC_SELECTOR_SETUP_MON_SUMMARY, VAR_0x8008 + ManageFacilitySelectorSubApp VAR_0x8009, WFC_SELECTOR_PROCESS_MON_SUMMARY, VAR_0x8008 + GoTo _037E + End + +_037E: + ManageFacilitySelectorSubApp VAR_0x8009, WFC_SELECTOR_SETUP_PARTY_MENU, VAR_0x8008 + ManageFacilitySelectorSubApp VAR_0x8009, WFC_SELECTOR_PROCESS_PARTY_MENU, VAR_0x8008 + GoToIfEq VAR_0x8008, 2, _0366 + GetSelectedPartyMenuSlots VAR_0x8002, VAR_0x8005 + SetSystemVar VAR_MAP_LOCAL_0x02, VAR_0x8002 + SetSystemVar VAR_MAP_LOCAL_0x05, VAR_0x8005 + FadeScreenIn + GoTo _03C1 + End + +_03C1: + MessageNoSkip WFCFacilitySelector_Text_PleaseWait + GoTo _03CD + End + +_03CD: + SetVar VAR_0x800A, WFC_SELECTOR_COMM_SELECTED_MONS + WFCFacilitySelector_SendCommMessage VAR_0x800A, VAR_0x8002, VAR_0x8005, VAR_0x8008 + GoToIfEq VAR_0x8008, 0, _03CD + WFCFacilitySelector_WaitForCommResponses VAR_0x800A + ClearReceivedTempDataAllPlayers + GoToIfEq VAR_0x8002, 255, _0084 + CallWFCFacilitySelectorFunction WFCFS_FUNC_GET_PARTNERS_FIRST_PICK, 0, 0, VAR_0x8008 + GoToIfEq VAR_0x8008, 0, _044E + CallWFCFacilitySelectorFunction WFCFS_FUNC_GET_SELECTED_FACILITY, 0, 0, VAR_0x8008 + GoToIfEq VAR_0x8008, FACILITY_TOWER, _045D + GoToIfEq VAR_0x8008, FACILITY_HALL, _04F9 + GoToIfEq VAR_0x8008, FACILITY_CASTLE, _0620 + GoToIfEq VAR_0x8008, FACILITY_ARCADE, _06BC + End + +_044E: + BufferPartnerName 0 + Message WFCFacilitySelector_Text_PlayerDroppedOut + GoTo _0084 + End + +_045D: + CallWFCFacilitySelectorFunction WFCFS_FUNC_CHECK_MON_SELECTIONS_VALID, FACILITY_TOWER, 0, VAR_0x8008 + SetVar FR_VAR_0x8010, VAR_0x8008 + GoToIfEq FR_VAR_0x8010, 1, _0499 + GoToIfEq FR_VAR_0x8010, 2, _04B4 + GoToIfEq FR_VAR_0x8010, 3, _04CF + GoTo _0758 + End + +_0499: + CallWFCFacilitySelectorFunction WFCFS_FUNC_GET_SELECTED_SPECIES, 0, 0, VAR_0x8008 + BufferSpeciesName 0, VAR_0x8008 + Message WFCFacilitySelector_Text_SamePokemonChosen + GoTo _0084 + End + +_04B4: + CallWFCFacilitySelectorFunction WFCFS_FUNC_GET_SELECTED_SPECIES, 1, 0, VAR_0x8008 + BufferSpeciesName 0, VAR_0x8008 + Message WFCFacilitySelector_Text_SamePokemonChosen + GoTo _0084 + End + +_04CF: + CallWFCFacilitySelectorFunction WFCFS_FUNC_GET_SELECTED_SPECIES, 0, 0, VAR_0x8008 + BufferSpeciesName 0, VAR_0x8008 + CallWFCFacilitySelectorFunction WFCFS_FUNC_GET_SELECTED_SPECIES, 1, 0, VAR_0x8008 + BufferSpeciesName 1, VAR_0x8008 + Message WFCFacilitySelector_Text_SameTwoPokemonChosen + GoTo _0084 + End + +_04F9: + CallWFCFacilitySelectorFunction WFCFS_FUNC_CHECK_MON_SELECTIONS_VALID, FACILITY_HALL, 0, VAR_0x8008 + GoToIfEq VAR_0x8008, 1, _0614 + Call _081C + GoToIfEq FR_VAR_0x800F, 0, _0766 + CallWFCFacilitySelectorFunction WFCFS_FUNC_CHECK_HALL_STREAK_ACTIVE, 0, 0, VAR_0x8008 + GoToIfEq VAR_0x8008, 0, _0758 + CallWFCFacilitySelectorFunction WFCFS_FUNC_CHECK_HALL_STREAK_SPECIES, 0, 0, VAR_0x800B + BufferSpeciesName 0, VAR_0x800B + CallWFCFacilitySelectorFunction WFCFS_FUNC_GET_SELECTED_SPECIES, 0, 0, VAR_0x8008 + BufferSpeciesName 1, VAR_0x8008 + GoToIfEq VAR_0x8008, VAR_0x800B, _0758 + GoTo _0567 + End + +_0567: + Message WFCFacilitySelector_Text_ConfirmStreakDeletion + InitLocalTextMenu 25, 13, 1, TRUE, VAR_0x8008 + AddMenuEntry WFCFacilitySelector_Text_Yes, MENU_YES + AddMenuEntry WFCFacilitySelector_Text_No, MENU_NO + ShowMenu + MessageNoSkip WFCFacilitySelector_Text_WaitingForFriend + SetVar VAR_0x800B, VAR_0x8008 + GoTo _0593 + End + +_0593: + SetVar VAR_0x800A, WFC_SELECTOR_COMM_STREAK_DELETION_CHOICE + WFCFacilitySelector_SendCommMessage VAR_0x800A, VAR_0x800B, 0, VAR_0x8008 + GoToIfEq VAR_0x8008, 0, _0593 + WFCFacilitySelector_WaitForCommResponses VAR_0x800A + ClearReceivedTempDataAllPlayers + CallWFCFacilitySelectorFunction WFCFS_FUNC_GET_PARTNERS_STREAK_DELETION_CHOICE, 0, 0, VAR_0x8008 + GoToIfEq VAR_0x8008, MENU_NO, _05F9 + GoToIfEq VAR_0x8008, MENU_CANCEL, _05F9 + GoToIfEq VAR_0x800B, MENU_NO, _05F9 + GoToIfEq VAR_0x800B, MENU_CANCEL, _05F9 + GoTo _0605 + End + +_05F9: + Message WFCFacilitySelector_Text_RemakeSelection + GoTo _0084 + End + +_0605: + CallWFCFacilitySelectorFunction WFCFS_FUNC_CLEAR_ACTIVE_HALL_STREAK, 0, 0, VAR_0x8008 + GoTo _0758 + End + +_0614: + Message WFCFacilitySelector_Text_MustChooseSamePokemon + GoTo _0084 + End + +_0620: + CallWFCFacilitySelectorFunction WFCFS_FUNC_CHECK_MON_SELECTIONS_VALID, FACILITY_CASTLE, 0, VAR_0x8008 + SetVar FR_VAR_0x8010, VAR_0x8008 + GoToIfEq FR_VAR_0x8010, 1, _065C + GoToIfEq FR_VAR_0x8010, 2, _0677 + GoToIfEq FR_VAR_0x8010, 3, _0692 + GoTo _0758 + End + +_065C: + CallWFCFacilitySelectorFunction WFCFS_FUNC_GET_SELECTED_SPECIES, 0, 0, VAR_0x8008 + BufferSpeciesName 0, VAR_0x8008 + Message WFCFacilitySelector_Text_SamePokemonChosen2 + GoTo _0084 + End + +_0677: + CallWFCFacilitySelectorFunction WFCFS_FUNC_GET_SELECTED_SPECIES, 1, 0, VAR_0x8008 + BufferSpeciesName 0, VAR_0x8008 + Message WFCFacilitySelector_Text_SamePokemonChosen2 + GoTo _0084 + End + +_0692: + CallWFCFacilitySelectorFunction WFCFS_FUNC_GET_SELECTED_SPECIES, 0, 0, VAR_0x8008 + BufferSpeciesName 0, VAR_0x8008 + CallWFCFacilitySelectorFunction WFCFS_FUNC_GET_SELECTED_SPECIES, 1, 0, VAR_0x8008 + BufferSpeciesName 1, VAR_0x8008 + Message WFCFacilitySelector_Text_SameTwoPokemonChosen2 + GoTo _0084 + End + +_06BC: + CallWFCFacilitySelectorFunction WFCFS_FUNC_CHECK_MON_SELECTIONS_VALID, FACILITY_ARCADE, 0, VAR_0x8008 + SetVar FR_VAR_0x8010, VAR_0x8008 + GoToIfEq FR_VAR_0x8010, 1, _06F8 + GoToIfEq FR_VAR_0x8010, 2, _0713 + GoToIfEq FR_VAR_0x8010, 3, _072E + GoTo _0758 + End + +_06F8: + CallWFCFacilitySelectorFunction WFCFS_FUNC_GET_SELECTED_SPECIES, 0, 0, VAR_0x8008 + BufferSpeciesName 0, VAR_0x8008 + Message WFCFacilitySelector_Text_SamePokemonChosen2 + GoTo _0084 + End + +_0713: + CallWFCFacilitySelectorFunction WFCFS_FUNC_GET_SELECTED_SPECIES, 1, 0, VAR_0x8008 + BufferSpeciesName 0, VAR_0x8008 + Message WFCFacilitySelector_Text_SamePokemonChosen2 + GoTo _0084 + End + +_072E: + CallWFCFacilitySelectorFunction WFCFS_FUNC_GET_SELECTED_SPECIES, 0, 0, VAR_0x8008 + BufferSpeciesName 0, VAR_0x8008 + CallWFCFacilitySelectorFunction WFCFS_FUNC_GET_SELECTED_SPECIES, 1, 0, VAR_0x8008 + BufferSpeciesName 1, VAR_0x8008 + Message WFCFacilitySelector_Text_SameTwoPokemonChosen2 + GoTo _0084 + End + +_0758: + Call _081C + GoTo _0766 + End + +_0766: + CallWFCFacilitySelectorFunction WFCFS_FUNC_CLEAR_LATEST_STREAK, 0, 0, VAR_0x8008 + SetSystemVar VAR_WIFI_FRONTIER_CLEARED, VAR_0x8008 + ClearReceivedTempDataAllPlayers + SyncConnectedPlayers 175 + ClearReceivedTempDataAllPlayers + MessageInstant WFCFacilitySelector_Text_Saving + ShowSavingIcon + FrontierScrCmd_73 VAR_0x8008 + HideSavingIcon + PlaySoundEffect SEQ_SE_DP_SAVE_sseq + WaitSoundEffect SEQ_SE_DP_SAVE_sseq + MessageNoSkip WFCFacilitySelector_Text_GoodLuck + WaitTime 10, VAR_0x8008 + ClearReceivedTempDataAllPlayers + SyncConnectedPlayers 171 + ClearReceivedTempDataAllPlayers + CloseMessage + FadeScreenOut + FrontierScrCmd_25 0 + FrontierScrCmd_25 2 + FrontierScrCmd_25 3 + IncrementRecordValue RECORD_TIMES_STARTED_BATTLE_FRONTIER_CHALLENGE + CallWFCFacilitySelectorFunction WFCFS_FUNC_GET_SELECTED_FACILITY, 0, 0, VAR_0x8008 + SetVar FR_VAR_0x8010, VAR_0x8008 + GoToIfEq FR_VAR_0x8010, FACILITY_TOWER, _0842 + GoToIfEq FR_VAR_0x8010, FACILITY_FACTORY, _0879 + GoToIfEq FR_VAR_0x8010, FACILITY_FACTORY_OPEN, _0879 + GoToIfEq FR_VAR_0x8010, FACILITY_HALL, _088D + GoToIfEq FR_VAR_0x8010, FACILITY_CASTLE, _08A1 + GoToIfEq FR_VAR_0x8010, FACILITY_ARCADE, _08B5 + End + +_081C: + CallWFCFacilitySelectorFunction WFCFS_FUNC_CLEAR_STREAK_IF_NOT_MATCHING, 0, 0, VAR_0x8008 + SetVar FR_VAR_0x800F, VAR_0x8008 + CallIfEq VAR_0x8008, 0, _0838 + Return + +_0838: + Message WFCFacilitySelector_Text_WinStreaksDontMatch + MessageNoSkip WFCFacilitySelector_Text_PleaseWait + Return + +_0842: + InitBattleTower + SetSystemVar VAR_BATTLE_TOWER_MULTI_BATTLE_ROOM_LOAD_ACTION, 1 + Call _08D3 + GoTo _0858 + End + +_0858: + SendTowerTrainerIDList VAR_0x8008 + GoToIfEq VAR_0x8008, 0, _0858 + WaitForTowerTrainerIDListResponses + Call _08C9 + FrontierScrCmd_04 FRONTIER_SCENE_TOWER_MULTI_CORRIDOR, 0 + End + +_0879: + FreeWFCFacilitySelector + PlayBGM SEQ_PL_BF_FACTORY_sseq + Call _08C9 + FrontierScrCmd_04 FRONTIER_SCENE_FACTORY_CORRIDOR, 0 + End + +_088D: + FreeWFCFacilitySelector + PlayBGM SEQ_PL_BF_STAGE_sseq + Call _08C9 + FrontierScrCmd_04 FRONTIER_SCENE_HALL_CORRIDOR, 0 + End + +_08A1: + FreeWFCFacilitySelector + PlayBGM SEQ_PL_BF_CASTLE02_sseq + Call _08C9 + FrontierScrCmd_04 FRONTIER_SCENE_CASTLE_CORRIDOR, 0 + End + +_08B5: + FreeWFCFacilitySelector + PlayBGM SEQ_PL_BF_ROULETTE_sseq + Call _08C9 + FrontierScrCmd_04 FRONTIER_SCENE_ARCADE_CORRIDOR, 0 + End + +_08C9: + ClearReceivedTempDataAllPlayers + SyncConnectedPlayers 173 + ClearReceivedTempDataAllPlayers + Return + +_08D3: + ClearReceivedTempDataAllPlayers + SyncConnectedPlayers 174 + +_08D9: + ClearReceivedTempDataAllPlayers + Return + +_08DD: + SetWiFiListHostFriendCurrentDate + InitWFCFacilitySelector + WaitTime 1, VAR_0x8008 + CallWFCFacilitySelectorFunction WFCFS_FUNC_INIT_COMM_MANAGER, 0, 0, VAR_0x8008 + WaitTime 1, VAR_0x8008 + ClearReceivedTempDataAllPlayers + SyncConnectedPlayers 177 + ClearReceivedTempDataAllPlayers + FrontierScrCmd_22 _000C + FrontierScrCmd_24 _0014 + PlayBGM SEQ_BF_TOWWER_sseq + FadeScreenIn + BufferPartnerName 0 + Message WFCFacilitySelector_Text_PlayAgain + ShowYesNoMenu VAR_0x8008, MENU_YES + GoToIfEq VAR_0x8008, MENU_YES, _0939 + GoTo _094B + End + +_0939: + MessageNoSkip WFCFacilitySelector_Text_WaitingForFriend + SetVar VAR_0x800B, 0 + GoTo _095D + End + +_094B: + MessageNoSkip WFCFacilitySelector_Text_WaitingForFriend + SetVar VAR_0x800B, 1 + GoTo _095D + End + +_095D: + SetVar VAR_0x800A, WFC_SELECTOR_COMM_PLAY_AGAIN_CHOICE + WFCFacilitySelector_SendCommMessage VAR_0x800A, VAR_0x800B, 0, VAR_0x8008 + GoToIfEq VAR_0x8008, 0, _095D + WFCFacilitySelector_WaitForCommResponses VAR_0x800A + ClearReceivedTempDataAllPlayers + CheckIfPartnerDroppedOut VAR_0x8008 + CallWFCFacilitySelectorFunction WFCFS_FUNC_CHECK_PARTNER_PLAYING_AGAIN, 0, 0, VAR_0x8008 + GoToIfEq VAR_0x8008, 1, _09AD + GoToIfEq VAR_0x800B, 1, _09C0 + GoTo _0084 + End + +_09AD: + BufferPartnerName 0 + MessageNoSkip WFCFacilitySelector_Text_PlayerDroppedOut2 + MessageNoSkip WFCFacilitySelector_Text_PleaseWait + GoTo _09C0 + End + +_09C0: + ClearReceivedTempDataAllPlayers + SyncConnectedPlayers 172 + ClearReceivedTempDataAllPlayers + CloseMessage + GoTo _09D2 + End + +_09D2: + FadeScreenOut + FreeWFCFacilitySelector + ClearReceivedTempDataAllPlayers + SyncConnectedPlayers 178 + ClearReceivedTempDataAllPlayers + FrontierScrCmd_02 + + .balign 4, 0 diff --git a/res/field/frontier_scripts/meson.build b/res/field/frontier_scripts/meson.build index e252fbb764..3baed22afd 100644 --- a/res/field/frontier_scripts/meson.build +++ b/res/field/frontier_scripts/meson.build @@ -19,7 +19,7 @@ fr_script_narc = custom_target('fr_script.narc', 'frontier_scripts_battle_tower_corridor_multi.s', 'frontier_scripts_battle_tower_battle_room.s', 'frontier_scripts_battle_tower_multi_battle_room.s', - 'frontier_scripts_unknown_10.s', + 'frontier_scripts_wfc_facility_selector.s', ), extra_args: ['--out-dir', fr_script_private_dir], depends: [ diff --git a/res/field/scripts/scripts_battle_frontier_records.s b/res/field/scripts/scripts_battle_frontier_records.s index ca55a692d2..890556690a 100644 --- a/res/field/scripts/scripts_battle_frontier_records.s +++ b/res/field/scripts/scripts_battle_frontier_records.s @@ -16,7 +16,7 @@ FrontierRecords_BattleTower: PlaySE SE_CONFIRM_sseq_3 LockAll - SetVar VAR_0x8000, FRONTIER_RECORDS_APP_TOWER + SetVar VAR_0x8000, FACILITY_TOWER GoTo FrontierRecords_BattleTowerMenus End @@ -33,7 +33,7 @@ FrontierRecords_BattleTowerMenus: FrontierRecords_BattleTowerDupe: PlaySE SE_CONFIRM_sseq_3 LockAll - SetVar VAR_0x8000, FRONTIER_RECORDS_APP_TOWER + SetVar VAR_0x8000, FACILITY_TOWER GoTo FrontierRecords_BattleTowerMenusDupe End @@ -50,7 +50,7 @@ FrontierRecords_BattleTowerMenusDupe: FrontierRecords_BattleFactory: PlaySE SE_CONFIRM_sseq_3 LockAll - SetVar VAR_0x8000, FRONTIER_RECORDS_APP_FACTORY + SetVar VAR_0x8000, FACILITY_FACTORY GoTo FrontierRecords_BattleFactoryMenus End @@ -67,7 +67,7 @@ FrontierRecords_BattleFactoryMenus: FrontierRecords_BattleHall: PlaySE SE_CONFIRM_sseq_3 LockAll - SetVar VAR_0x8000, FRONTIER_RECORDS_APP_HALL + SetVar VAR_0x8000, FACILITY_HALL GoTo FrontierRecords_BattleHallMenus End @@ -118,7 +118,7 @@ FrontierRecords_SelectPokemonWithStartingLetter: FrontierRecords_BattleCastle: PlaySE SE_CONFIRM_sseq_3 LockAll - SetVar VAR_0x8000, FRONTIER_RECORDS_APP_CASTLE + SetVar VAR_0x8000, FACILITY_CASTLE GoTo FrontierRecords_BattleCastleMenus End @@ -135,7 +135,7 @@ FrontierRecords_BattleCastleMenus: FrontierRecords_BattleArcade: PlaySE SE_CONFIRM_sseq_3 LockAll - SetVar VAR_0x8000, FRONTIER_RECORDS_APP_ARCADE + SetVar VAR_0x8000, FACILITY_ARCADE GoTo FrontierRecords_BattleArcadeMenus End diff --git a/res/graphics/frontier/backgrounds/frontier_backgrounds.order b/res/graphics/frontier/backgrounds/frontier_backgrounds.order index a17b4ee309..35448fd2f7 100644 --- a/res/graphics/frontier/backgrounds/frontier_backgrounds.order +++ b/res/graphics/frontier/backgrounds/frontier_backgrounds.order @@ -125,8 +125,8 @@ battle_frontier_records_app.NSCR.lz frontier_records_app.NCGR.lz battle_frontier_app_sub.NCGR.lz battle_frontier_app_sub.NSCR.lz -unknown_10.NCGR.lz -unknown_10.NSCR.lz +wfc_facility_selector.NCGR.lz +wfc_facility_selector.NSCR.lz battle_factory.NCLR battle_factory_app.NCLR battle_hall_battle_room.NCLR @@ -170,4 +170,4 @@ battle_arcade_app_sub.NCLR battle_arcade_screen_default.NCLR frontier_records_app.NCLR battle_frontier_app_sub.NCLR -unknown_10.NCLR +wfc_facility_selector.NCLR diff --git a/res/graphics/frontier/backgrounds/meson.build b/res/graphics/frontier/backgrounds/meson.build index ce23fac852..d238809a8d 100644 --- a/res/graphics/frontier/backgrounds/meson.build +++ b/res/graphics/frontier/backgrounds/meson.build @@ -83,7 +83,7 @@ frontier_tilemaps = lz_gen.process(files( 'battle_arcade_app_sub.NSCR', 'battle_frontier_records_app.NSCR', 'battle_frontier_app_sub.NSCR', - 'unknown_10.NSCR', + 'wfc_facility_selector.NSCR', )) frontier_background_tiles = ncgr_lz_gen.process( @@ -141,7 +141,7 @@ arcade_screen_tiles = ncgr_lz_gen.process( 'battle_arcade_screen_get_1_bp.png', 'battle_arcade_screen_no_event.png', 'battle_arcade_screen_get_3_bp.png', - 'unknown_10.png', + 'wfc_facility_selector.png', ), extra_args: [ '-sopc', @@ -200,7 +200,7 @@ extended_palettes = [ ['battle_arcade_screen_no_event_0.pal', '1', '1'], ['battle_arcade_screen_get_3_bp_0.pal', '1', '1'], ['battle_arcade_screen_default_0.pal', '2', '0'], - ['unknown_10_0.pal', '4', '0'], + ['wfc_facility_selector_0.pal', '4', '0'], ] extended_nclrs = [] diff --git a/res/graphics/frontier/backgrounds/unknown_10.NSCR b/res/graphics/frontier/backgrounds/wfc_facility_selector.NSCR similarity index 100% rename from res/graphics/frontier/backgrounds/unknown_10.NSCR rename to res/graphics/frontier/backgrounds/wfc_facility_selector.NSCR diff --git a/res/graphics/frontier/backgrounds/unknown_10.png b/res/graphics/frontier/backgrounds/wfc_facility_selector.png similarity index 100% rename from res/graphics/frontier/backgrounds/unknown_10.png rename to res/graphics/frontier/backgrounds/wfc_facility_selector.png diff --git a/res/graphics/frontier/backgrounds/unknown_10_0.pal b/res/graphics/frontier/backgrounds/wfc_facility_selector_0.pal similarity index 100% rename from res/graphics/frontier/backgrounds/unknown_10_0.pal rename to res/graphics/frontier/backgrounds/wfc_facility_selector_0.pal diff --git a/res/graphics/frontier/backgrounds/unknown_10_1.pal b/res/graphics/frontier/backgrounds/wfc_facility_selector_1.pal similarity index 100% rename from res/graphics/frontier/backgrounds/unknown_10_1.pal rename to res/graphics/frontier/backgrounds/wfc_facility_selector_1.pal diff --git a/res/graphics/frontier/backgrounds/unknown_10_2.pal b/res/graphics/frontier/backgrounds/wfc_facility_selector_2.pal similarity index 100% rename from res/graphics/frontier/backgrounds/unknown_10_2.pal rename to res/graphics/frontier/backgrounds/wfc_facility_selector_2.pal diff --git a/res/graphics/frontier/backgrounds/unknown_10_3.pal b/res/graphics/frontier/backgrounds/wfc_facility_selector_3.pal similarity index 100% rename from res/graphics/frontier/backgrounds/unknown_10_3.pal rename to res/graphics/frontier/backgrounds/wfc_facility_selector_3.pal diff --git a/res/text/unk_0015.json b/res/text/wfc_facility_selector.json similarity index 63% rename from res/text/unk_0015.json rename to res/text/wfc_facility_selector.json index 29ab5733c8..a53819348a 100644 --- a/res/text/unk_0015.json +++ b/res/text/wfc_facility_selector.json @@ -2,25 +2,25 @@ "key": 24832, "messages": [ { - "id": "pl_msg_00000015_00000", + "id": "WFCFacilitySelector_Text_WhichFacility", "en_US": [ "Which facility would you like to\n", "challenge?" ] }, { - "id": "pl_msg_00000015_00001", + "id": "WFCFacilitySelector_Text_PlayerDroppedOut", "en_US": "{STRVAR_1 3, 0, 0} has dropped out.\r" }, { - "id": "pl_msg_00000015_00002", + "id": "WFCFacilitySelector_Text_ChoosePokemon", "en_US": [ "Please choose the Pokémon you wish to\n", "enter with." ] }, { - "id": "pl_msg_00000015_00003", + "id": "WFCFacilitySelector_Text_DifferentFacilitiesChosen", "en_US": [ "You have chosen a different facility\n", "and/or level setting from your friend.\f", @@ -28,11 +28,11 @@ ] }, { - "id": "pl_msg_00000015_00004", + "id": "WFCFacilitySelector_Text_PleaseWait", "en_US": "Please wait a moment." }, { - "id": "pl_msg_00000015_00005", + "id": "WFCFacilitySelector_Text_WinStreaksDontMatch", "en_US": [ "Your win-streak record does not match\n", "your friend’s record.\r", @@ -41,7 +41,7 @@ ] }, { - "id": "pl_msg_00000015_00006", + "id": "WFCFacilitySelector_Text_SamePokemonChosen", "en_US": [ "Both you and your friend have chosen\n", "{STRVAR_1 0, 0, 0}.\r", @@ -50,7 +50,7 @@ ] }, { - "id": "pl_msg_00000015_00007", + "id": "WFCFacilitySelector_Text_SameTwoPokemonChosen", "en_US": [ "Both you and your friend have chosen\n", "{STRVAR_1 0, 0, 0} and {STRVAR_1 0, 1, 0}.\r", @@ -59,11 +59,11 @@ ] }, { - "id": "pl_msg_00000015_00008", + "id": "WFCFacilitySelector_Text_Dummy", "garbage": 50 }, { - "id": "pl_msg_00000015_00009", + "id": "WFCFacilitySelector_Text_SamePokemonChosen2", "en_US": [ "Both you and your friend have chosen\n", "{STRVAR_1 0, 0, 0}.\r", @@ -72,7 +72,7 @@ ] }, { - "id": "pl_msg_00000015_00010", + "id": "WFCFacilitySelector_Text_SameTwoPokemonChosen2", "en_US": [ "Both you and your friend have chosen\n", "{STRVAR_1 0, 0, 0} and {STRVAR_1 0, 1, 0}.\r", @@ -81,29 +81,29 @@ ] }, { - "id": "pl_msg_00000015_00011", + "id": "WFCFacilitySelector_Text_MustChooseSamePokemon", "en_US": [ "You and your friend must choose the\n", "same kind of Pokémon to battle.\r" ] }, { - "id": "pl_msg_00000015_00012", + "id": "WFCFacilitySelector_Text_Dummy2", "garbage": 54 }, { - "id": "pl_msg_00000015_00013", + "id": "WFCFacilitySelector_Text_Dummy3", "garbage": 60 }, { - "id": "pl_msg_00000015_00014", + "id": "WFCFacilitySelector_Text_ChooseLevel50OrOpen", "en_US": [ "Which would you like to challenge,\n", "Level 50 cap or Open Level?" ] }, { - "id": "pl_msg_00000015_00015", + "id": "WFCFacilitySelector_Text_ConfirmStreakDeletion", "en_US": [ "There is already an ongoing winning\n", "streak by {STRVAR_1 0, 0, 0}.\r", @@ -113,84 +113,84 @@ ] }, { - "id": "pl_msg_00000015_00016", + "id": "WFCFacilitySelector_Text_Yes", "en_US": "YES" }, { - "id": "pl_msg_00000015_00017", + "id": "WFCFacilitySelector_Text_No", "en_US": "NO" }, { - "id": "pl_msg_00000015_00018", + "id": "WFCFacilitySelector_Text_RemakeSelection", "en_US": "Please make your selection again.\r" }, { - "id": "pl_msg_00000015_00019", + "id": "WFCFacilitySelector_Text_Saving", "en_US": [ "Saving...\n", "Don’t turn off the power." ] }, { - "id": "pl_msg_00000015_00020", + "id": "WFCFacilitySelector_Text_GoodLuck", "en_US": "Good luck!" }, { - "id": "pl_msg_00000015_00021", + "id": "WFCFacilitySelector_Text_PlayAgain", "en_US": [ "Would you like to play with {STRVAR_1 3, 0, 0}\n", "again?" ] }, { - "id": "pl_msg_00000015_00022", + "id": "WFCFacilitySelector_Text_Dummy4", "garbage": 2 }, { - "id": "pl_msg_00000015_00023", + "id": "WFCFacilitySelector_Text_Dummy5", "garbage": 3 }, { - "id": "pl_msg_00000015_00024", + "id": "WFCFacilitySelector_Text_WaitingForFriend", "en_US": [ "Awaiting your friend’s selection.\n", "Please wait a moment." ] }, { - "id": "pl_msg_00000015_00025", + "id": "WFCFacilitySelector_Text_PlayerDroppedOut2", "en_US": "{STRVAR_1 3, 0, 0} has dropped out.\r" }, { - "id": "pl_msg_00000015_00026", + "id": "WFCFacilitySelector_Text_BattleTower", "en_US": "BATTLE TOWER" }, { - "id": "pl_msg_00000015_00027", + "id": "WFCFacilitySelector_Text_BattleFactory", "en_US": "BATTLE FACTORY" }, { - "id": "pl_msg_00000015_00028", + "id": "WFCFacilitySelector_Text_BattleCastle", "en_US": "BATTLE CASTLE" }, { - "id": "pl_msg_00000015_00029", + "id": "WFCFacilitySelector_Text_BattleHall", "en_US": "BATTLE HALL" }, { - "id": "pl_msg_00000015_00030", + "id": "WFCFacilitySelector_Text_BattleArcade", "en_US": "BATTLE ARCADE" }, { - "id": "pl_msg_00000015_00031", + "id": "WFCFacilitySelector_Text_Cancel", "en_US": "CANCEL" }, { - "id": "pl_msg_00000015_00032", + "id": "WFCFacilitySelector_Text_Level50", "en_US": "LEVEL 50" }, { - "id": "pl_msg_00000015_00033", + "id": "WFCFacilitySelector_Text_OpenLevel", "en_US": "OPEN LEVEL" } ] diff --git a/src/applications/frontier/records/main.c b/src/applications/frontier/records/main.c index 01b656eaab..2e9c05cf38 100644 --- a/src/applications/frontier/records/main.c +++ b/src/applications/frontier/records/main.c @@ -379,20 +379,20 @@ static u8 GetWindowGroup(u8 facility) u8 windowGroup = 0; switch (facility) { - case FRONTIER_RECORDS_APP_FACTORY: - case 3: + case FACILITY_FACTORY: + case FACILITY_FACTORY_OPEN: windowGroup = WINDOW_GROUP_FACTORY; break; - case FRONTIER_RECORDS_APP_HALL: + case FACILITY_HALL: windowGroup = WINDOW_GROUP_HALL; break; - case FRONTIER_RECORDS_APP_CASTLE: + case FACILITY_CASTLE: windowGroup = WINDOW_GROUP_CASTLE; break; - case FRONTIER_RECORDS_APP_ARCADE: + case FACILITY_ARCADE: windowGroup = WINDOW_GROUP_ARCADE; break; - case FRONTIER_RECORDS_APP_TOWER: + case FACILITY_TOWER: windowGroup = WINDOW_GROUP_TOWER; break; } @@ -462,21 +462,21 @@ static void SetStringTemplateNumber(FrontierRecordsApp *app, u32 idx, s32 num) static void DisplayRecords(FrontierRecordsApp *app) { switch (app->facility) { - case FRONTIER_RECORDS_APP_FACTORY: - case 3: + case FACILITY_FACTORY: + case FACILITY_FACTORY_OPEN: DisplayBattleFactoryLevel50Record(app); DisplayBattleFactoryOpenLevelRecord(app); break; - case FRONTIER_RECORDS_APP_HALL: + case FACILITY_HALL: DisplayBattleHallRecord(app); break; - case FRONTIER_RECORDS_APP_CASTLE: + case FACILITY_CASTLE: DisplayBattleCastleRecord(app); break; - case FRONTIER_RECORDS_APP_ARCADE: + case FACILITY_ARCADE: DisplayBattleArcadeRecord(app); break; - case FRONTIER_RECORDS_APP_TOWER: + case FACILITY_TOWER: if (app->challengeType == FRONTIER_CHALLENGE_SINGLE || app->challengeType == FRONTIER_CHALLENGE_DOUBLE) { DisplayBattleTowerSoloRecord(app); } else { diff --git a/src/battle_frontier.c b/src/battle_frontier.c index 27e6992b6a..08b342f3d8 100644 --- a/src/battle_frontier.c +++ b/src/battle_frontier.c @@ -299,13 +299,13 @@ void sub_0209B9EC(BattleFrontier *frontier) } } -FieldFrontierDTO *sub_0209BA18(FieldSystem *fieldSystem, void *param1) +FieldFrontierDTO *BattleFrontier_LaunchWFCFacilitySelector(FieldSystem *fieldSystem, void *data) { FieldFrontierDTO *fieldData = Heap_AllocAtEnd(HEAP_ID_FIELD2, sizeof(FieldFrontierDTO)); MI_CpuClear8(fieldData, sizeof(FieldFrontierDTO)); - fieldData->facilityData = param1; + fieldData->facilityData = data; fieldData->options = SaveData_GetOptions(fieldSystem->saveData); fieldData->saveData = fieldSystem->saveData; fieldData->journalEntry = fieldSystem->journalEntry; @@ -314,7 +314,7 @@ FieldFrontierDTO *sub_0209BA18(FieldSystem *fieldSystem, void *param1) fieldData->unk_14 = 0; fieldData->unk_18 = 0; fieldData->mapHeaderID = fieldSystem->location->mapHeaderID; - fieldData->sceneID = FRONTIER_SCENE_14; + fieldData->sceneID = FRONTIER_SCENE_WFC_FACILITY_SELECTOR; fieldData->fieldSystem = fieldSystem; FieldSystem_StartChildProcess(fieldSystem, &gBattleFrontierAppTemplate, fieldData); diff --git a/src/meson.build b/src/meson.build index cc9230c759..980c08fe54 100644 --- a/src/meson.build +++ b/src/meson.build @@ -935,14 +935,14 @@ pokeplatinum_c = files( 'overlay104/frscrcmd_sound.c', 'overlay104/frscrcmd_battle_tower.c', 'overlay104/ov104_022394A4.c', - 'overlay104/ov104_022395F0.c', - 'overlay104/ov104_02239C58.c', + 'overlay104/frscrcmd_wfc_facility_selector.c', + 'overlay104/wfc_facility_selector.c', 'overlay104/ov104_0223A0C4.c', 'overlay104/battle_factory_helpers.c', 'overlay104/battle_hall_helpers.c', 'overlay104/battle_castle_helpers.c', 'overlay104/battle_arcade_helpers.c', - 'overlay104/ov104_0223C164.c', + 'overlay104/wfc_facility_selector_helpers.c', 'overlay104/frontier_graphics.c', 'overlay104/frontier_particle_system.c', 'overlay104/ov104_0223D768.c', diff --git a/src/overlay104/frontier_scenes.c b/src/overlay104/frontier_scenes.c index 066a163fea..75fdf81c81 100644 --- a/src/overlay104/frontier_scenes.c +++ b/src/overlay104/frontier_scenes.c @@ -6,8 +6,8 @@ #include "generated/text_banks.h" #include "graphics/frontier/backgrounds/frontier_backgrounds.naix" -#include "overlay104/ov104_0223C164.h" #include "overlay104/ov104_0223D9E4.h" +#include "overlay104/wfc_facility_selector_helpers.h" #include "bg_window.h" #include "gx_layers.h" @@ -50,8 +50,8 @@ static void BattleFactoryCorridorSceneSetup(FrontierGraphics *graphics, void **s static void BattleFactoryCorridorSceneDestroy(FrontierGraphics *graphics, void **sceneData); static void BattleFactoryBattleRoomSceneSetup(FrontierGraphics *graphics, void **sceneData); static void BattleFactoryBattleRoomSceneDestroy(FrontierGraphics *graphics, void **sceneData); -static void ov104_0222EC90(FrontierGraphics *graphics, void **sceneData); -static void ov104_0222ECA0(FrontierGraphics *graphics, void **sceneData); +static void WFCFacilitySelectorSceneSetup(FrontierGraphics *graphics, void **sceneData); +static void WFCFacilitySelectorSceneDestroy(FrontierGraphics *graphics, void **sceneData); static void BattleCastleBattleRoomSceneSetup(FrontierGraphics *graphics, void **sceneData); static void BattleCastleBattleRoomSceneDestroy(FrontierGraphics *graphics, void **sceneData); @@ -308,18 +308,18 @@ static const FrontierScene sFrontierScenes[] = { .unk_22 = 1, .unk_23 = 1, }, - [FRONTIER_SCENE_14] = { + [FRONTIER_SCENE_WFC_FACILITY_SELECTOR] = { .bgMode = GX_BGMODE_5, - .setupFunc = ov104_0222EC90, - .destroyFunc = ov104_0222ECA0, - .scriptID = frontier_scripts_unknown_10, - .textBankID = TEXT_BANK_UNK_0015, + .setupFunc = WFCFacilitySelectorSceneSetup, + .destroyFunc = WFCFacilitySelectorSceneDestroy, + .scriptID = frontier_scripts_wfc_facility_selector, + .textBankID = TEXT_BANK_WFC_FACILITY_SELECTOR, .bgmID = SEQ_BF_TOWWER_sseq, .screenSize = BG_SCREEN_SIZE_256x256, .narcID = NARC_INDEX_FRONTIER_BACKGROUNDS, - .tilemapIdx = unknown_10_NSCR_lz, - .tilesIdx = unknown_10_NCGR_lz, - .plttIdx = unknown_10_NCLR, + .tilemapIdx = wfc_facility_selector_NSCR_lz, + .tilesIdx = wfc_facility_selector_NCGR_lz, + .plttIdx = wfc_facility_selector_NCLR, .subTilemapIdx = -1, .subTilesIdx = -1, .subPlttIdx = -1, @@ -481,14 +481,14 @@ static void BattleFactoryBattleRoomSceneDestroy(FrontierGraphics *graphics, void { } -static void ov104_0222EC90(FrontierGraphics *graphics, void **sceneData) +static void WFCFacilitySelectorSceneSetup(FrontierGraphics *graphics, void **sceneData) { - *sceneData = ov104_0223C164(graphics->bgConfig); + *sceneData = WFCFacilitySelectorEffects_Init(graphics->bgConfig); } -static void ov104_0222ECA0(FrontierGraphics *graphics, void **sceneData) +static void WFCFacilitySelectorSceneDestroy(FrontierGraphics *graphics, void **sceneData) { - ov104_0223C23C(*sceneData); + WFCFacilitySelectorEffects_Free(*sceneData); } static void BattleCastleBattleRoomSceneSetup(FrontierGraphics *graphics, void **sceneData) diff --git a/src/overlay104/frscrcmd.c b/src/overlay104/frscrcmd.c index 9afc48e511..d5db5bd412 100644 --- a/src/overlay104/frscrcmd.c +++ b/src/overlay104/frscrcmd.c @@ -31,8 +31,8 @@ #include "overlay104/frscrcmd_battle_hall.h" #include "overlay104/frscrcmd_battle_tower.h" #include "overlay104/frscrcmd_sound.h" +#include "overlay104/frscrcmd_wfc_facility_selector.h" #include "overlay104/ov104_02231F74.h" -#include "overlay104/ov104_022395F0.h" #include "overlay104/ov104_0223D768.h" #include "overlay104/ov104_0223D860.h" #include "overlay104/ov104_0223E894.h" diff --git a/src/overlay104/frscrcmd_wfc_facility_selector.c b/src/overlay104/frscrcmd_wfc_facility_selector.c new file mode 100644 index 0000000000..7cb45a3afa --- /dev/null +++ b/src/overlay104/frscrcmd_wfc_facility_selector.c @@ -0,0 +1,361 @@ +#include "overlay104/frscrcmd_wfc_facility_selector.h" + +#include +#include + +#include "constants/battle_tower.h" +#include "constants/wfc_facility_selector_functions.h" +#include "generated/battle_tower_modes.h" + +#include "struct_defs/battle_tower.h" +#include "struct_defs/wifi_battle_tower_data.h" + +#include "global/utility.h" +#include "overlay104/defs.h" +#include "overlay104/frontier_opponents.h" +#include "overlay104/frontier_script_context.h" +#include "overlay104/frscrcmd.h" +#include "overlay104/struct_ov104_02230BE4.h" +#include "overlay104/wfc_facility_selector.h" +#include "overlay104/wfc_facility_selector_helpers.h" + +#include "battle_frontier.h" +#include "battle_frontier_save.h" +#include "battle_frontier_stats.h" +#include "battle_hall_save.h" +#include "communication_system.h" +#include "heap.h" +#include "item_use_pokemon.h" +#include "party.h" +#include "scrcmd_battle_hall.h" +#include "unk_02049D08.h" +#include "unk_0209BA80.h" +#include "wifi_battle_tower_save.h" + +static BOOL WaitForCommResponses(FrontierScriptContext *ctx); +static BOOL WaitForTowerCommResponse(FrontierScriptContext *ctx); + +BOOL FrontierScrCmd_InitWFCFacilitySelector(FrontierScriptContext *ctx) +{ + FieldFrontierDTO *fieldData = BattleFrontier_GetFieldData(ctx->scriptMan->frontier); + WFCFacilitySelector *selector = WFCFacilitySelector_Init(fieldData->saveData); + + BattleFrontier_SetFacilityStruct(ctx->scriptMan->frontier, selector); + return FALSE; +} + +BOOL FrontierScrCmd_FreeWFCFacilitySelector(FrontierScriptContext *ctx) +{ + WFCFacilitySelector *selector = BattleFrontier_GetFacilityStruct(ctx->scriptMan->frontier); + WFCFacilitySelector_Free(selector); + + return FALSE; +} + +BOOL FrontierScrCmd_WFCFacilitySelector_SendCommMessage(FrontierScriptContext *ctx) +{ + u16 command = FrontierScriptContext_GetVar(ctx); + u16 arg1 = FrontierScriptContext_GetVar(ctx); + u16 arg2 = FrontierScriptContext_GetVar(ctx); + u16 *success = FrontierScriptContext_TryGetVarPointer(ctx); + + WFCFacilitySelector *selector = BattleFrontier_GetFacilityStruct(ctx->scriptMan->frontier); + *success = WFCFacilitySelector_SendCommMessage(selector, command, arg1, arg2); + + return TRUE; +} + +BOOL FrontierScrCmd_WFCFacilitySelector_WaitForCommResponses(FrontierScriptContext *ctx) +{ + ctx->data[0] = FrontierScriptContext_ReadHalfWord(ctx); + FrontierScriptContext_Pause(ctx, WaitForCommResponses); + + return TRUE; +} + +static BOOL WaitForCommResponses(FrontierScriptContext *ctx) +{ + WFCFacilitySelector *selector = BattleFrontier_GetFacilityStruct(ctx->scriptMan->frontier); + + if (selector->msgsReceived >= 2) { + selector->msgsReceived = 0; + return TRUE; + } + + return FALSE; +} + +BOOL FrontierScrCmd_CheckIfSameFacilityChosen(FrontierScriptContext *ctx) +{ + u16 facility = FrontierScriptContext_GetVar(ctx); + u16 *returnVar = FrontierScriptContext_TryGetVarPointer(ctx); + + WFCFacilitySelector *selector = BattleFrontier_GetFacilityStruct(ctx->scriptMan->frontier); + + if (facility == selector->partnersSelectedFacility) { + *returnVar = TRUE; + } else { + *returnVar = FALSE; + } + + return FALSE; +} + +BOOL FrontierScrCmd_ManageFacilitySelectorSubApp(FrontierScriptContext *ctx) +{ + UNUSED(FrontierScriptContext_GetVar(ctx)); + u16 action = FrontierScriptContext_GetVar(ctx); + u16 *result = FrontierScriptContext_TryGetVarPointer(ctx); + + WFCFacilitySelector *selector = BattleFrontier_GetFacilityStruct(ctx->scriptMan->frontier); + FieldFrontierDTO *fieldData = BattleFrontier_GetFieldData(ctx->scriptMan->frontier); + + selector->fieldSystem = fieldData->fieldSystem; + selector->subAppResult = result; + + WFCFacilitySelector_ManageSubApp(ctx->scriptMan->frontier, selector, action); + + return TRUE; +} + +BOOL FrontierScrCmd_GetSelectedPartyMenuSlots(FrontierScriptContext *ctx) +{ + u16 *selectedSlot1 = FrontierScriptContext_TryGetVarPointer(ctx); + u16 *selectedSlot2 = FrontierScriptContext_TryGetVarPointer(ctx); + + WFCFacilitySelector *selector = BattleFrontier_GetFacilityStruct(ctx->scriptMan->frontier); + + if (selector->partyMenu->selectedMonSlot == PARTY_MENU_SLOT_CANCEL) { + *selectedSlot1 = 0xff; + + for (int i = 0; i < 2; i++) { + selector->partyMenuSelectionOrder[i] = 0; + } + } else if (selector->partyMenu->selectedMonSlot == MAX_PARTY_SIZE) { + *selectedSlot1 = selector->partyMenu->selectionOrder[0]; + *selectedSlot1 -= 1; + + *selectedSlot2 = selector->partyMenu->selectionOrder[1]; + + if (*selectedSlot2 > 0) { + *selectedSlot2 -= 1; + } + } + + Heap_Free(selector->partyMenu); + selector->partyMenu = NULL; + + return FALSE; +} + +BOOL FrontierScrCmd_CheckIfPartnerDroppedOut(FrontierScriptContext *ctx) +{ + u16 *partnerDroppedOut = FrontierScriptContext_TryGetVarPointer(ctx); + + WFCFacilitySelector *selector = BattleFrontier_GetFacilityStruct(ctx->scriptMan->frontier); + *partnerDroppedOut = selector->partnerDroppedOut; + + return FALSE; +} + +BOOL FrontierScrCmd_CallWFCFacilitySelectorFunction(FrontierScriptContext *ctx) +{ + u8 command = FrontierScriptContext_ReadByte(ctx); + u8 arg1 = FrontierScriptContext_ReadByte(ctx); + u8 arg2 = FrontierScriptContext_ReadByte(ctx); + u16 *returnVar = FrontierScriptContext_TryGetVarPointer(ctx); + + WFCFacilitySelector *selector = BattleFrontier_GetFacilityStruct(ctx->scriptMan->frontier); + FieldFrontierDTO *fieldData = BattleFrontier_GetFieldData(ctx->scriptMan->frontier); + + switch (command) { + case WFCFS_FUNC_INIT_COMM_MANAGER: + sub_0209BA80(selector); + break; + case WFCFS_FUNC_GET_PARTNERS_FIRST_PICK: + *returnVar = selector->partnersSelectedSpecies[0]; + break; + case WFCFS_FUNC_CHECK_MON_SELECTIONS_VALID: + if (arg1 == FACILITY_TOWER) { + *returnVar = 0; + + if (selector->selectedSpecies[0] == selector->partnersSelectedSpecies[0] || selector->selectedSpecies[0] == selector->partnersSelectedSpecies[1]) { + *returnVar += 1; + } + + if (selector->selectedSpecies[1] == selector->partnersSelectedSpecies[0] || selector->selectedSpecies[1] == selector->partnersSelectedSpecies[1]) { + *returnVar += 2; + } + } else if (arg1 == FACILITY_HALL) { + if (selector->selectedSpecies[0] == selector->partnersSelectedSpecies[0]) { + *returnVar = 0; + } else { + *returnVar = 1; + } + } else if (arg1 == FACILITY_CASTLE || arg1 == FACILITY_ARCADE) { + *returnVar = 0; + + if (selector->selectedSpecies[0] == selector->partnersSelectedSpecies[0] || selector->selectedSpecies[0] == selector->partnersSelectedSpecies[1]) { + *returnVar += 1; + } + + if (selector->selectedSpecies[1] == selector->partnersSelectedSpecies[0] || selector->selectedSpecies[1] == selector->partnersSelectedSpecies[1]) { + *returnVar += 2; + } + } + + break; + case WFCFS_FUNC_CHECK_HALL_STREAK_ACTIVE: + *returnVar = BattleFrontierSave_GetStatAutoHostIdx(SaveData_GetBattleFrontier(fieldData->saveData), STAT_HALL_WFC_STREAK_ACTIVE); + break; + case WFCFS_FUNC_CHECK_HALL_STREAK_SPECIES: + *returnVar = BattleFrontierSave_GetStatAutoHostIdx(SaveData_GetBattleFrontier(fieldData->saveData), BattleFrontierStats_GetHallLatestSpeciesIndex(FRONTIER_CHALLENGE_MULTI_WFC)); + break; + case WFCFS_FUNC_GET_SELECTED_SPECIES: + *returnVar = selector->selectedSpecies[arg1]; + break; + case WFCFS_FUNC_CLEAR_ACTIVE_HALL_STREAK: + BattleHall_ClearActiveStreak(fieldData->saveData, BattleHallStreakFlags_Get(fieldData->saveData), FRONTIER_CHALLENGE_MULTI_WFC); + break; + case WFCFS_FUNC_SET_SELECTED_FACILITY: + selector->selectedFacility = arg1; + break; + case WFCFS_FUNC_GET_PARTNERS_STREAK_DELETION_CHOICE: + *returnVar = selector->partnersStreakDeletionChoice; + break; + case WFCFS_FUNC_GET_SELECTED_FACILITY: + *returnVar = selector->selectedFacility; + break; + case WFCFS_FUNC_CHECK_PARTNER_PLAYING_AGAIN: + *returnVar = selector->partnerNotPlayingAgain; + break; + case WFCFS_FUNC_CLEAR_STREAK_IF_NOT_MATCHING: { + *returnVar = TRUE; + u16 index = BattleFrontier_GetWFCLatestStreakIndex(selector->selectedFacility); + u16 latestStreak = BattleFrontierSave_GetStatAutoHostIdx(SaveData_GetBattleFrontier(selector->saveData), index); + + if (latestStreak != selector->partnersLatestStreak) { + BattleFrontierSave_SetStatAutoHostIdx(SaveData_GetBattleFrontier(selector->saveData), index, 0); + + index = BattleFrontier_GetWFCStreakActiveIndex(selector->selectedFacility); + BattleFrontierSave_SetStatAutoHostIdx(SaveData_GetBattleFrontier(selector->saveData), index, 0); + + *returnVar = FALSE; + } + } break; + case WFCFS_FUNC_CLEAR_LATEST_STREAK: { + u16 index = BattleFrontier_GetWFCStreakActiveIndex(selector->selectedFacility); + *returnVar = BattleFrontierSave_GetStatAutoHostIdx(SaveData_GetBattleFrontier(selector->saveData), index); + + if (*returnVar == FALSE) { + index = BattleFrontier_GetWFCLatestStreakIndex(selector->selectedFacility); + BattleFrontierSave_SetStatAutoHostIdx(SaveData_GetBattleFrontier(selector->saveData), index, 0); + + if (selector->selectedFacility == FACILITY_TOWER) { + WifiBattleTowerRecord *record = SaveData_GetWifiBattleTowerRecord(selector->saveData); + WifiBattleTowerRecord_UpdateRoomNum(record, BATTLE_TOWER_MODE_6, 2); + } + + if (selector->selectedFacility == FACILITY_CASTLE) { + BattleFrontierSave_SetStat(SaveData_GetBattleFrontier(selector->saveData), STAT_CASTLE_LATEST_CP_MULTI_WFC, BattleFrontierStats_GetHostFriendIdx(index), 0); + BattleFrontierSave_SetStat(SaveData_GetBattleFrontier(selector->saveData), STAT_CASTLE_SPENT_CP_MULTI_WFC, BattleFrontierStats_GetHostFriendIdx(index), 0); + } + + if (selector->selectedFacility == FACILITY_FACTORY) { + BattleFrontierSave_SetStatAutoHostIdx(SaveData_GetBattleFrontier(selector->saveData), BattleFrontierStats_GetFactoryLatestTradeCountIndex(FALSE, FRONTIER_CHALLENGE_MULTI_WFC), 0); + } + + if (selector->selectedFacility == FACILITY_FACTORY_OPEN) { + BattleFrontierSave_SetStatAutoHostIdx(SaveData_GetBattleFrontier(selector->saveData), BattleFrontierStats_GetFactoryLatestTradeCountIndex(TRUE, FRONTIER_CHALLENGE_MULTI_WFC), 0); + } + } else { + BattleFrontierSave_SetStatAutoHostIdx(SaveData_GetBattleFrontier(selector->saveData), index, 0); + } + } break; + case WFCFS_FUNC_CLEAR_PARTY_MENU_SELECTIONS: + for (int i = 0; i < 2; i++) { + selector->partyMenuSelectionOrder[i] = 0; + } + + selector->selectedMonSlot = 0; + break; + } + + return FALSE; +} + +BOOL FrontierScrCmd_InitBattleTower(FrontierScriptContext *ctx) +{ + + FieldFrontierDTO *fieldData = BattleFrontier_GetFieldData(ctx->scriptMan->frontier); + WFCFacilitySelector *selectorPtr = BattleFrontier_GetFacilityStruct(ctx->scriptMan->frontier); + + WFCFacilitySelector selector = *selectorPtr; + WFCFacilitySelector_Free(selectorPtr); + + BattleTower *battleTower = BattleTower_Init(fieldData->saveData, 0, BATTLE_TOWER_MODE_6); + BattleFrontier_SetFacilityStruct(ctx->scriptMan->frontier, battleTower); + + if (battleTower->challengeMode == BATTLE_TOWER_MODE_6) { + BattleFrontier_FlagGeonetLinkInfo(fieldData->saveData); + } + + for (int i = 0; i < battleTower->partySize; i++) { + battleTower->unk_2A[i] = selector.selectedMonSlots[i]; + battleTower->unk_2E[i] = selector.selectedSpecies[i]; + battleTower->unk_36[i] = selector.selectedItems[i]; + } + + battleTower->unk_16[0] = selector.partnersSelectedSpecies[0]; + battleTower->unk_16[1] = selector.partnersSelectedSpecies[1]; + battleTower->partnerGender = selector.partnerGender; + battleTower->partnerID = BT_PARTNERS_COUNT + battleTower->partnerGender; + + if (CommSys_CurNetId() == 0) { + sub_0204A4C8(battleTower, fieldData->saveData); + } + + Party_HealAllMembers(SaveData_GetParty(fieldData->saveData)); + sub_0209BA80(battleTower); + + battleTower->msgsReceived = 0; + + return FALSE; +} + +BOOL FrontierScrCmd_SendTowerTrainerIDList(FrontierScriptContext *ctx) +{ + u16 *success = FrontierScriptContext_TryGetVarPointer(ctx); + + BattleTower *battleTower = BattleFrontier_GetFacilityStruct(ctx->scriptMan->frontier); + *success = BattleTower_SendTrainerIDListCmd(battleTower); + + return TRUE; +} + +BOOL FrontierScrCmd_WaitForTowerTrainerIDListResponses(FrontierScriptContext *ctx) +{ + FrontierScriptContext_Pause(ctx, WaitForTowerCommResponse); + return TRUE; +} + +static BOOL WaitForTowerCommResponse(FrontierScriptContext *ctx) +{ + BattleTower *battleTower = BattleFrontier_GetFacilityStruct(ctx->scriptMan->frontier); + + if (battleTower->msgsReceived < 2) { + return FALSE; + } + + battleTower->msgsReceived = 0; + return TRUE; +} + +BOOL FrontierScrCmd_FreeBattleTower(FrontierScriptContext *ctx) +{ + BattleTower *battleTower = BattleFrontier_GetFacilityStruct(ctx->scriptMan->frontier); + BattleTower_Free(battleTower); + battleTower = NULL; + + return FALSE; +} diff --git a/src/overlay104/ov104_022395F0.c b/src/overlay104/ov104_022395F0.c deleted file mode 100644 index 2d6b02756e..0000000000 --- a/src/overlay104/ov104_022395F0.c +++ /dev/null @@ -1,381 +0,0 @@ -#include -#include -#include - -#include "constants/battle_tower.h" -#include "generated/battle_tower_modes.h" - -#include "struct_defs/battle_tower.h" -#include "struct_defs/struct_0209BBA4.h" -#include "struct_defs/wifi_battle_tower_data.h" - -#include "overlay104/defs.h" -#include "overlay104/frontier_opponents.h" -#include "overlay104/frontier_script_context.h" -#include "overlay104/frscrcmd.h" -#include "overlay104/ov104_02239C58.h" -#include "overlay104/ov104_0223C164.h" -#include "overlay104/struct_ov104_02230BE4.h" - -#include "battle_frontier.h" -#include "battle_frontier_save.h" -#include "battle_frontier_stats.h" -#include "battle_hall_save.h" -#include "communication_system.h" -#include "heap.h" -#include "item_use_pokemon.h" -#include "party.h" -#include "scrcmd_battle_hall.h" -#include "unk_02049D08.h" -#include "unk_0209BA80.h" -#include "wifi_battle_tower_save.h" - -static BOOL ov104_02239680(FrontierScriptContext *param0); -static BOOL ov104_02239C20(FrontierScriptContext *param0); - -BOOL FrontierScrCmd_AA(FrontierScriptContext *param0) -{ - FieldFrontierDTO *fieldData = BattleFrontier_GetFieldData(param0->scriptMan->frontier); - UnkStruct_0209BBA4 *v0 = ov104_02239C58(fieldData->saveData); - - BattleFrontier_SetFacilityStruct(param0->scriptMan->frontier, v0); - return 0; -} - -BOOL FrontierScrCmd_AB(FrontierScriptContext *param0) -{ - UnkStruct_0209BBA4 *v0 = BattleFrontier_GetFacilityStruct(param0->scriptMan->frontier); - ov104_02239C7C(v0); - - return 0; -} - -BOOL FrontierScrCmd_AC(FrontierScriptContext *param0) -{ - UnkStruct_0209BBA4 *v0; - u16 v1 = FrontierScriptContext_GetVar(param0); - u16 v2 = FrontierScriptContext_GetVar(param0); - u16 v3 = FrontierScriptContext_GetVar(param0); - u16 *v4 = FrontierScriptContext_TryGetVarPointer(param0); - - v0 = BattleFrontier_GetFacilityStruct(param0->scriptMan->frontier); - *v4 = ov104_02239C88(v0, v1, v2, v3); - - return 1; -} - -BOOL FrontierScrCmd_AD(FrontierScriptContext *param0) -{ - u16 v0 = FrontierScriptContext_ReadHalfWord(param0); - - param0->data[0] = v0; - FrontierScriptContext_Pause(param0, ov104_02239680); - - return 1; -} - -static BOOL ov104_02239680(FrontierScriptContext *param0) -{ - UnkStruct_0209BBA4 *v0 = BattleFrontier_GetFacilityStruct(param0->scriptMan->frontier); - - if (v0->unk_6F >= 2) { - v0->unk_6F = 0; - return 1; - } - - return 0; -} - -BOOL FrontierScrCmd_AE(FrontierScriptContext *param0) -{ - UnkStruct_0209BBA4 *v0; - u16 v1 = FrontierScriptContext_GetVar(param0); - u16 *v2 = FrontierScriptContext_TryGetVarPointer(param0); - - v0 = BattleFrontier_GetFacilityStruct(param0->scriptMan->frontier); - - if (v1 == v0->unk_6E) { - *v2 = 1; - } else { - *v2 = 0; - } - - return 0; -} - -BOOL FrontierScrCmd_AF(FrontierScriptContext *param0) -{ - UnkStruct_0209BBA4 *v0; - FieldFrontierDTO *fieldData; - u16 v2 = FrontierScriptContext_GetVar(param0); - u16 v3 = FrontierScriptContext_GetVar(param0); - u16 *v4 = FrontierScriptContext_TryGetVarPointer(param0); - - v0 = BattleFrontier_GetFacilityStruct(param0->scriptMan->frontier); - fieldData = BattleFrontier_GetFieldData(param0->scriptMan->frontier); - - v0->fieldSystem = fieldData->fieldSystem; - v0->unk_B0 = v4; - - ov104_02239CD0(param0->scriptMan->frontier, v0, v3); - - return 1; -} - -BOOL FrontierScrCmd_B0(FrontierScriptContext *param0) -{ - int v0; - UnkStruct_0209BBA4 *v1; - u16 v2; - u16 *v3 = FrontierScriptContext_TryGetVarPointer(param0); - u16 *v4 = FrontierScriptContext_TryGetVarPointer(param0); - - v1 = BattleFrontier_GetFacilityStruct(param0->scriptMan->frontier); - - if (v1->partyMenu->selectedMonSlot == 7) { - *v3 = 0xff; - - for (v0 = 0; v0 < 2; v0++) { - v1->unk_A1[v0] = 0; - } - } else if (v1->partyMenu->selectedMonSlot == 6) { - *v3 = v1->partyMenu->selectionOrder[0]; - *v3 -= 1; - - *v4 = v1->partyMenu->selectionOrder[1]; - - if (*v4 > 0) { - *v4 -= 1; - } - } - - Heap_Free(v1->partyMenu); - v1->partyMenu = NULL; - - return 0; -} - -BOOL FrontierScrCmd_B1(FrontierScriptContext *param0) -{ - UnkStruct_0209BBA4 *v0; - u16 *v1 = FrontierScriptContext_TryGetVarPointer(param0); - - v0 = BattleFrontier_GetFacilityStruct(param0->scriptMan->frontier); - *v1 = v0->unk_59; - - return 0; -} - -BOOL FrontierScrCmd_B2(FrontierScriptContext *param0) -{ - int v0; - u16 v1, v2; - WifiBattleTowerRecord *record; - UnkStruct_0209BBA4 *v4; - FieldFrontierDTO *fieldData; - u8 v6 = FrontierScriptContext_ReadByte(param0); - u8 v7 = FrontierScriptContext_ReadByte(param0); - u8 v8 = FrontierScriptContext_ReadByte(param0); - u16 *v9 = FrontierScriptContext_TryGetVarPointer(param0); - - v4 = BattleFrontier_GetFacilityStruct(param0->scriptMan->frontier); - fieldData = BattleFrontier_GetFieldData(param0->scriptMan->frontier); - - switch (v6) { - case 0: - sub_0209BA80(v4); - break; - case 1: - *v9 = v4->unk_86[0]; - break; - case 2: - if (v7 == 1) { - *v9 = 0; - - if ((v4->unk_76[0] == v4->unk_86[0]) || (v4->unk_76[0] == v4->unk_86[1])) { - *v9 += 1; - } - - if ((v4->unk_76[1] == v4->unk_86[0]) || (v4->unk_76[1] == v4->unk_86[1])) { - *v9 += 2; - } - } else if (v7 == 5) { - if (v4->unk_76[0] == v4->unk_86[0]) { - *v9 = 0; - } else { - *v9 = 1; - } - } else if ((v7 == 4) || (v7 == 6)) { - *v9 = 0; - - if ((v4->unk_76[0] == v4->unk_86[0]) || (v4->unk_76[0] == v4->unk_86[1])) { - *v9 += 1; - } - - if ((v4->unk_76[1] == v4->unk_86[0]) || (v4->unk_76[1] == v4->unk_86[1])) { - *v9 += 2; - } - } - - break; - - case 3: - *v9 = (u16)BattleFrontierSave_GetStatAutoHostIdx(SaveData_GetBattleFrontier(fieldData->saveData), STAT_HALL_WFC_STREAK_ACTIVE); - break; - case 4: - *v9 = BattleFrontierSave_GetStatAutoHostIdx(SaveData_GetBattleFrontier(fieldData->saveData), BattleFrontierStats_GetHallLatestSpeciesIndex(3)); - break; - case 5: - *v9 = v4->unk_76[v7]; - break; - case 6: - BattleHall_ClearActiveStreak(fieldData->saveData, BattleHallStreakFlags_Get(fieldData->saveData), 3); - break; - case 7: - v4->unk_A0 = v7; - break; - case 8: - *v9 = v4->unk_74; - break; - case 9: - *v9 = v4->unk_A0; - break; - case 10: - *v9 = v4->unk_71; - break; - case 11: - *v9 = 1; - v1 = ov104_0223C264(v4->unk_A0); - v2 = BattleFrontierSave_GetStatAutoHostIdx(SaveData_GetBattleFrontier(v4->saveData), v1); - - if (v2 != v4->unk_72) { - BattleFrontierSave_SetStatAutoHostIdx(SaveData_GetBattleFrontier(v4->saveData), v1, 0); - - v1 = ov104_0223C29C(v4->unk_A0); - BattleFrontierSave_SetStatAutoHostIdx(SaveData_GetBattleFrontier(v4->saveData), v1, 0); - - *v9 = 0; - } - break; - case 12: - v1 = ov104_0223C29C(v4->unk_A0); - *v9 = BattleFrontierSave_GetStatAutoHostIdx(SaveData_GetBattleFrontier(v4->saveData), v1); - - if (*v9 == 0) { - v1 = ov104_0223C264(v4->unk_A0); - BattleFrontierSave_SetStatAutoHostIdx(SaveData_GetBattleFrontier(v4->saveData), v1, 0); - - if (v4->unk_A0 == 1) { - record = SaveData_GetWifiBattleTowerRecord(v4->saveData); - WifiBattleTowerRecord_UpdateRoomNum(record, 6, 2); - } - - if (v4->unk_A0 == 4) { - BattleFrontierSave_SetStat(SaveData_GetBattleFrontier(v4->saveData), STAT_CASTLE_LATEST_CP_MULTI_WFC, BattleFrontierStats_GetHostFriendIdx(v1), 0); - BattleFrontierSave_SetStat(SaveData_GetBattleFrontier(v4->saveData), STAT_CASTLE_SPENT_CP_MULTI_WFC, BattleFrontierStats_GetHostFriendIdx(v1), 0); - } - - if (v4->unk_A0 == 2) { - BattleFrontierSave_SetStatAutoHostIdx(SaveData_GetBattleFrontier(v4->saveData), BattleFrontierStats_GetFactoryLatestTradeCountIndex(0, 3), 0); - } - - if (v4->unk_A0 == 3) { - BattleFrontierSave_SetStatAutoHostIdx(SaveData_GetBattleFrontier(v4->saveData), BattleFrontierStats_GetFactoryLatestTradeCountIndex(1, 3), 0); - } - } else { - BattleFrontierSave_SetStatAutoHostIdx(SaveData_GetBattleFrontier(v4->saveData), v1, 0); - } - break; - case 13: - for (v0 = 0; v0 < 2; v0++) { - v4->unk_A1[v0] = 0; - } - - v4->unk_9F = 0; - break; - } - - return 0; -} - -BOOL FrontierScrCmd_B3(FrontierScriptContext *param0) -{ - int v0; - BattleTower *battleTower; - FieldFrontierDTO *fieldData; - UnkStruct_0209BBA4 *v3; - UnkStruct_0209BBA4 v4; - - fieldData = BattleFrontier_GetFieldData(param0->scriptMan->frontier); - v3 = BattleFrontier_GetFacilityStruct(param0->scriptMan->frontier); - - v4 = *v3; - ov104_02239C7C(v3); - - battleTower = BattleTower_Init(fieldData->saveData, 0, BATTLE_TOWER_MODE_6); - BattleFrontier_SetFacilityStruct(param0->scriptMan->frontier, battleTower); - - if (battleTower->challengeMode == BATTLE_TOWER_MODE_6) { - BattleFrontier_FlagGeonetLinkInfo(fieldData->saveData); - } - - for (v0 = 0; v0 < battleTower->partySize; v0++) { - battleTower->unk_2A[v0] = v4.unk_6A[v0]; - battleTower->unk_2E[v0] = v4.unk_76[v0]; - battleTower->unk_36[v0] = v4.unk_7E[v0]; - } - - battleTower->unk_16[0] = v4.unk_86[0]; - battleTower->unk_16[1] = v4.unk_86[1]; - battleTower->partnerGender = v4.unk_58; - battleTower->partnerID = BT_PARTNERS_COUNT + battleTower->partnerGender; - - if (CommSys_CurNetId() == 0) { - sub_0204A4C8(battleTower, fieldData->saveData); - } - - Party_HealAllMembers(SaveData_GetParty(fieldData->saveData)); - sub_0209BA80(battleTower); - - battleTower->unk_8D4 = 0; - - return 0; -} - -BOOL FrontierScrCmd_B4(FrontierScriptContext *param0) -{ - BattleTower *battleTower; - u16 *v1 = FrontierScriptContext_TryGetVarPointer(param0); - - battleTower = BattleFrontier_GetFacilityStruct(param0->scriptMan->frontier); - *v1 = sub_0209BB08(battleTower); - - return 1; -} - -BOOL FrontierScrCmd_B5(FrontierScriptContext *param0) -{ - FrontierScriptContext_Pause(param0, ov104_02239C20); - return 1; -} - -static BOOL ov104_02239C20(FrontierScriptContext *param0) -{ - BattleTower *battleTower = BattleFrontier_GetFacilityStruct(param0->scriptMan->frontier); - - if (battleTower->unk_8D4 < 2) { - return 0; - } - - battleTower->unk_8D4 = 0; - return 1; -} - -BOOL FrontierScrCmd_ClearTowerStruct(FrontierScriptContext *ctx) -{ - BattleTower *battleTower = BattleFrontier_GetFacilityStruct(ctx->scriptMan->frontier); - BattleTower_Free(battleTower); - battleTower = NULL; - - return FALSE; -} diff --git a/src/overlay104/ov104_02239C58.c b/src/overlay104/ov104_02239C58.c deleted file mode 100644 index fd45164a73..0000000000 --- a/src/overlay104/ov104_02239C58.c +++ /dev/null @@ -1,222 +0,0 @@ -#include "overlay104/ov104_02239C58.h" - -#include -#include - -#include "struct_decls/battle_frontier_decl.h" -#include "struct_defs/struct_0209BBA4.h" - -#include "applications/party_menu/defs.h" -#include "applications/party_menu/main.h" -#include "applications/pokemon_summary_screen/main.h" -#include "field/field_system.h" - -#include "bag.h" -#include "battle_frontier.h" -#include "dexmode_checker.h" -#include "heap.h" -#include "mail.h" -#include "party.h" -#include "save_player.h" -#include "savedata.h" -#include "unk_0202D778.h" -#include "unk_0209BA80.h" - -#include "constdata/const_020F410C.h" - -void ov104_02239C7C(UnkStruct_0209BBA4 *param0); -BOOL ov104_02239C88(UnkStruct_0209BBA4 *param0, u16 param1, u16 param2, u16 param3); -void ov104_02239CD0(BattleFrontier *param0, UnkStruct_0209BBA4 *param1, u16 param2); -static void ov104_02239D1C(BattleFrontier *param0, UnkStruct_0209BBA4 *param1, FieldSystem *fieldSystem, int param3); -static void ov104_02239F38(BattleFrontier *param0, UnkStruct_0209BBA4 *param1, FieldSystem *fieldSystem, int param3); -static void ov104_02239FB0(BattleFrontier *param0, UnkStruct_0209BBA4 *param1, FieldSystem *fieldSystem, enum HeapID heapID); -static void ov104_0223A090(BattleFrontier *param0, UnkStruct_0209BBA4 *param1, FieldSystem *fieldSystem, int param3); - -UnkStruct_0209BBA4 *ov104_02239C58(SaveData *saveData) -{ - static UnkStruct_0209BBA4 *v0; - - v0 = Heap_Alloc(HEAP_ID_FIELD2, sizeof(UnkStruct_0209BBA4)); - MI_CpuClear8(v0, sizeof(UnkStruct_0209BBA4)); - - v0->saveData = saveData; - return v0; -} - -void ov104_02239C7C(UnkStruct_0209BBA4 *param0) -{ - if (param0 == NULL) { - return; - } - - Heap_Free(param0); - param0 = NULL; -} - -BOOL ov104_02239C88(UnkStruct_0209BBA4 *param0, u16 param1, u16 param2, u16 param3) -{ - int v0; - - switch (param1) { - case 0: - v0 = sub_0209BBA4(param0); - break; - case 1: - v0 = sub_0209BC1C(param0, param2); - break; - case 2: - v0 = sub_0209BC64(param0, param2, param3); - break; - case 4: - v0 = sub_0209BD68(param0, param2); - break; - case 5: - v0 = sub_0209BDB0(param0, param2); - break; - } - - return v0; -} - -void ov104_02239CD0(BattleFrontier *param0, UnkStruct_0209BBA4 *param1, u16 param2) -{ - FieldSystem *fieldSystem = param1->fieldSystem; - - switch (param2) { - case 0: - ov104_02239D1C(param0, param1, fieldSystem, 11); - break; - case 1: - ov104_02239F38(param0, param1, fieldSystem, 11); - break; - case 2: - ov104_02239FB0(param0, param1, fieldSystem, HEAP_ID_FIELD2); - break; - case 3: - ov104_0223A090(param0, param1, fieldSystem, 11); - break; - case 4: - return; - } -} - -static void ov104_02239D1C(BattleFrontier *param0, UnkStruct_0209BBA4 *param1, FieldSystem *fieldSystem, int param3) -{ - u8 v0; - - param1->partyMenu = Heap_Alloc(HEAP_ID_FIELD2, sizeof(PartyMenu)); - MI_CpuClearFast(param1->partyMenu, sizeof(PartyMenu)); - - param1->partyMenu->party = SaveData_GetParty(param1->saveData); - param1->partyMenu->bag = SaveData_GetBag(param1->saveData); - param1->partyMenu->mailbox = SaveData_GetMailbox(param1->saveData); - param1->partyMenu->options = SaveData_GetOptions(param1->saveData); - param1->partyMenu->type = PARTY_MENU_TYPE_BASIC; - - if (param1->unk_A0 == 1) { - param1->partyMenu->mode = PARTY_MENU_MODE_BATTLE_TOWER; - } else if (param1->unk_A0 == 5) { - param1->partyMenu->mode = PARTY_MENU_MODE_BATTLE_HALL; - } else if (param1->unk_A0 == 4) { - param1->partyMenu->mode = PARTY_MENU_MODE_BATTLE_CASTLE; - } else if (param1->unk_A0 == 6) { - param1->partyMenu->mode = PARTY_MENU_MODE_BATTLE_CASTLE; - } else { - GF_ASSERT(FALSE); - } - - param1->partyMenu->fieldSystem = fieldSystem; - param1->partyMenu->selectedMonSlot = param1->unk_9F; - - for (v0 = 0; v0 < 2; v0++) { - param1->partyMenu->selectionOrder[v0] = param1->unk_A1[v0]; - } - - if (param1->unk_A0 == 1) { - param1->partyMenu->minSelectionSlots = 2; - param1->partyMenu->maxSelectionSlots = 2; - param1->partyMenu->reqLevel = 100; - } else if (param1->unk_A0 == 5) { - param1->partyMenu->minSelectionSlots = 1; - param1->partyMenu->maxSelectionSlots = 1; - param1->partyMenu->reqLevel = 30; - } else if (param1->unk_A0 == 4) { - param1->partyMenu->minSelectionSlots = 2; - param1->partyMenu->maxSelectionSlots = 2; - param1->partyMenu->reqLevel = 100; - } else if (param1->unk_A0 == 6) { - param1->partyMenu->minSelectionSlots = 2; - param1->partyMenu->maxSelectionSlots = 2; - param1->partyMenu->reqLevel = 100; - } else { - GF_ASSERT(FALSE); - } - - sub_0209B988(param0, &gPokemonPartyAppTemplate, param1->partyMenu, 0, NULL); -} - -static void ov104_02239F38(BattleFrontier *param0, UnkStruct_0209BBA4 *param1, FieldSystem *fieldSystem, int param3) -{ - switch (param1->partyMenu->selectedMonSlot) { - case 7: - *param1->unk_B0 = 4; - param1->unk_9D = 4; - return; - case 6: - *param1->unk_B0 = 4; - param1->unk_9D = 4; - return; - default: - break; - } - - MI_CpuCopy8(param1->partyMenu->selectionOrder, param1->unk_A1, 2); - param1->unk_9F = param1->partyMenu->selectedMonSlot; - Heap_Free(param1->partyMenu); - - param1->partyMenu = NULL; - *param1->unk_B0 = 2; - param1->unk_9D = 2; -} - -static void ov104_02239FB0(BattleFrontier *param0, UnkStruct_0209BBA4 *param1, FieldSystem *fieldSystem, enum HeapID heapID) -{ - static const u8 visiblePages[] = { - SUMMARY_PAGE_INFO, - SUMMARY_PAGE_MEMO, - SUMMARY_PAGE_SKILLS, - SUMMARY_PAGE_CONDITION, - SUMMARY_PAGE_BATTLE_MOVES, - SUMMARY_PAGE_CONTEST_MOVES, - SUMMARY_PAGE_RIBBONS, - SUMMARY_PAGE_EXIT, - SUMMARY_PAGE_MAX, - }; - - param1->unk_AC = Heap_AllocAtEnd(heapID, sizeof(PokemonSummary)); - MI_CpuClear8(param1->unk_AC, sizeof(PokemonSummary)); - - param1->unk_AC->options = SaveData_GetOptions(param1->saveData); - param1->unk_AC->monData = SaveData_GetParty(param1->saveData); - param1->unk_AC->dexMode = SaveData_GetDexMode(param1->saveData); - param1->unk_AC->showContest = PokemonSummaryScreen_ShowContestData(param1->saveData); - param1->unk_AC->dataType = SUMMARY_DATA_PARTY_MON; - param1->unk_AC->monIndex = param1->unk_9F; - param1->unk_AC->monMax = (u8)Party_GetCurrentCount(param1->unk_AC->monData); - param1->unk_AC->move = 0; - param1->unk_AC->mode = SUMMARY_MODE_NORMAL; - param1->unk_AC->specialRibbons = SaveData_GetRibbons(param1->saveData); - - PokemonSummaryScreen_FlagVisiblePages(param1->unk_AC, visiblePages); - PokemonSummaryScreen_SetPlayerProfile(param1->unk_AC, SaveData_GetTrainerInfo(param1->saveData)); - sub_0209B988(param0, &gPokemonSummaryScreenApp, param1->unk_AC, 0, NULL); -} - -static void ov104_0223A090(BattleFrontier *param0, UnkStruct_0209BBA4 *param1, FieldSystem *fieldSystem, int param3) -{ - param1->unk_9F = param1->unk_AC->monIndex; - Heap_Free(param1->unk_AC); - param1->unk_AC = NULL; - *param1->unk_B0 = 0; - param1->unk_9D = 0; -} diff --git a/src/overlay104/ov104_0223C164.c b/src/overlay104/ov104_0223C164.c deleted file mode 100644 index 222c8cca23..0000000000 --- a/src/overlay104/ov104_0223C164.c +++ /dev/null @@ -1,167 +0,0 @@ -#include "overlay104/ov104_0223C164.h" - -#include -#include - -#include "overlay104/struct_ov104_0223C23C_decl.h" - -#include "bg_window.h" -#include "heap.h" -#include "sys_task.h" -#include "sys_task_manager.h" - -typedef struct { - SysTask *unk_00; - BgConfig *unk_04; - u16 unk_08; - u16 unk_0A; -} UnkStruct_ov104_0223C188; - -struct UnkStruct_ov104_0223C23C_t { - BgConfig *unk_00; - UnkStruct_ov104_0223C188 *unk_04; -}; - -UnkStruct_ov104_0223C23C *ov104_0223C164(BgConfig *param0); -static UnkStruct_ov104_0223C188 *ov104_0223C188(BgConfig *param0); -static void ov104_0223C1BC(SysTask *param0, void *param1); -static void ov104_0223C208(u16 *param0, u8 param1); - -UnkStruct_ov104_0223C23C *ov104_0223C164(BgConfig *param0) -{ - UnkStruct_ov104_0223C23C *v0 = Heap_Alloc(HEAP_ID_94, sizeof(UnkStruct_ov104_0223C23C)); - MI_CpuClear8(v0, sizeof(UnkStruct_ov104_0223C23C)); - v0->unk_04 = ov104_0223C188(param0); - - return v0; -} - -static UnkStruct_ov104_0223C188 *ov104_0223C188(BgConfig *param0) -{ - UnkStruct_ov104_0223C188 *v0 = Heap_Alloc(HEAP_ID_94, sizeof(UnkStruct_ov104_0223C188)); - MI_CpuClear8(v0, sizeof(UnkStruct_ov104_0223C188)); - - v0->unk_04 = param0; - v0->unk_08 = 0; - v0->unk_00 = SysTask_Start(ov104_0223C1BC, v0, (80000 - 500)); - - return v0; -} - -static void ov104_0223C1BC(SysTask *param0, void *param1) -{ - u32 v0; - u16 v1[4]; - UnkStruct_ov104_0223C188 *v2 = param1; - - if (v2->unk_0A < 2) { - v2->unk_0A++; - return; - } - - v2->unk_0A = 0; - v2->unk_08 ^= 1; - - ov104_0223C208(v1, v2->unk_08); - - Bg_LoadToTilemapRect(v2->unk_04, 3, v1, 14, 2, 2, 2); - Bg_ScheduleTilemapTransfer(v2->unk_04, 3); - - return; -} - -static void ov104_0223C208(u16 *param0, u8 param1) -{ - u32 v0, v1, v2, v3; - - if (param1 == 0) { - v3 = 12; - } else { - v3 = 14; - } - - for (v0 = 0; v0 < 2; v0++) { - for (v1 = 0; v1 < 2; v1++) { - v2 = ((0x10 * 6) + v0 * 0x10) + (v3 + v1); - - param0[(v0 * 2) + v1] = v2; - } - } - - return; -} - -void ov104_0223C23C(UnkStruct_ov104_0223C23C *param0); -static void ov104_0223C250(UnkStruct_ov104_0223C188 *param0); - -void ov104_0223C23C(UnkStruct_ov104_0223C23C *param0) -{ - ov104_0223C250(param0->unk_04); - Heap_Free(param0); - - return; -} - -static void ov104_0223C250(UnkStruct_ov104_0223C188 *param0) -{ - SysTask_Done(param0->unk_00); - Heap_Free(param0); - - return; -} - -u16 ov104_0223C264(u8 param0) -{ - u16 v0; - - switch (param0) { - case 2: - v0 = 115; - break; - case 3: - v0 = 119; - break; - case 4: - v0 = 135; - break; - case 5: - v0 = 123; - break; - case 6: - v0 = 143; - break; - case 1: - v0 = 113; - break; - } - - return v0; -} - -u16 ov104_0223C29C(u8 param0) -{ - u16 v0; - - switch (param0) { - case 2: - v0 = 102; - break; - case 3: - v0 = 104; - break; - case 4: - v0 = 108; - break; - case 5: - v0 = 106; - break; - case 6: - v0 = 110; - break; - case 1: - v0 = 100; - break; - } - - return v0; -} diff --git a/src/overlay104/wfc_facility_selector.c b/src/overlay104/wfc_facility_selector.c new file mode 100644 index 0000000000..a113500eca --- /dev/null +++ b/src/overlay104/wfc_facility_selector.c @@ -0,0 +1,217 @@ +#include "overlay104/wfc_facility_selector.h" + +#include + +#include "constants/battle_frontier.h" + +#include "struct_decls/battle_frontier_decl.h" + +#include "applications/party_menu/defs.h" +#include "applications/party_menu/main.h" +#include "applications/pokemon_summary_screen/main.h" +#include "field/field_system.h" + +#include "bag.h" +#include "battle_frontier.h" +#include "dexmode_checker.h" +#include "heap.h" +#include "mail.h" +#include "party.h" +#include "save_player.h" +#include "savedata.h" +#include "unk_0202D778.h" +#include "unk_0209BA80.h" + +#include "constdata/const_020F410C.h" + +static void SetupPartyMenu(BattleFrontier *frontier, WFCFacilitySelector *selector, FieldSystem *fieldSystem, enum HeapID heapID); +static void ProcessPartyMenuResults(BattleFrontier *frontier, WFCFacilitySelector *selector, FieldSystem *fieldSystem, enum HeapID heapID); +static void SetupSummaryApp(BattleFrontier *frontier, WFCFacilitySelector *selector, FieldSystem *fieldSystem, enum HeapID heapID); +static void ProcessSummaryAppResults(BattleFrontier *frontier, WFCFacilitySelector *selector, FieldSystem *fieldSystem, enum HeapID heapID); + +WFCFacilitySelector *WFCFacilitySelector_Init(SaveData *saveData) +{ + static WFCFacilitySelector *selector; + + selector = Heap_Alloc(HEAP_ID_FIELD2, sizeof(WFCFacilitySelector)); + MI_CpuClear8(selector, sizeof(WFCFacilitySelector)); + + selector->saveData = saveData; + return selector; +} + +void WFCFacilitySelector_Free(WFCFacilitySelector *selector) +{ + if (selector == NULL) { + return; + } + + Heap_Free(selector); + selector = NULL; +} + +BOOL WFCFacilitySelector_SendCommMessage(WFCFacilitySelector *selector, u16 command, u16 arg1, u16 arg2) +{ + int success; + + switch (command) { + case WFC_SELECTOR_COMM_FACILITY_AND_STREAK: + success = WFCFacilitySelector_SendFacilityAndLatestStreak(selector); + break; + case WFC_SELECTOR_COMM_DID_DROP_OUT: + success = WFCFacilitySelector_SendDidDropOutCmd(selector, arg1); + break; + case WFC_SELECTOR_COMM_SELECTED_MONS: + success = WFCFacilitySelector_SendSelectedMons(selector, arg1, arg2); + break; + case WFC_SELECTOR_COMM_STREAK_DELETION_CHOICE: + success = WFCFacilitySelector_SendStreakDeletionChoice(selector, arg1); + break; + case WFC_SELECTOR_COMM_PLAY_AGAIN_CHOICE: + success = WFCFacilitySelector_SendPlayAgainChoice(selector, arg1); + break; + } + + return success; +} + +void WFCFacilitySelector_ManageSubApp(BattleFrontier *frontier, WFCFacilitySelector *selector, u16 action) +{ + FieldSystem *fieldSystem = selector->fieldSystem; + + switch (action) { + case WFC_SELECTOR_SETUP_PARTY_MENU: + SetupPartyMenu(frontier, selector, fieldSystem, HEAP_ID_FIELD2); + break; + case WFC_SELECTOR_PROCESS_PARTY_MENU: + ProcessPartyMenuResults(frontier, selector, fieldSystem, HEAP_ID_FIELD2); + break; + case WFC_SELECTOR_SETUP_MON_SUMMARY: + SetupSummaryApp(frontier, selector, fieldSystem, HEAP_ID_FIELD2); + break; + case WFC_SELECTOR_PROCESS_MON_SUMMARY: + ProcessSummaryAppResults(frontier, selector, fieldSystem, HEAP_ID_FIELD2); + break; + case 4: + return; + } +} + +static void SetupPartyMenu(BattleFrontier *frontier, WFCFacilitySelector *selector, FieldSystem *fieldSystem, enum HeapID heapID) +{ + selector->partyMenu = Heap_Alloc(HEAP_ID_FIELD2, sizeof(PartyMenu)); + MI_CpuClearFast(selector->partyMenu, sizeof(PartyMenu)); + + selector->partyMenu->party = SaveData_GetParty(selector->saveData); + selector->partyMenu->bag = SaveData_GetBag(selector->saveData); + selector->partyMenu->mailbox = SaveData_GetMailbox(selector->saveData); + selector->partyMenu->options = SaveData_GetOptions(selector->saveData); + selector->partyMenu->type = PARTY_MENU_TYPE_BASIC; + + if (selector->selectedFacility == FACILITY_TOWER) { + selector->partyMenu->mode = PARTY_MENU_MODE_BATTLE_TOWER; + } else if (selector->selectedFacility == FACILITY_HALL) { + selector->partyMenu->mode = PARTY_MENU_MODE_BATTLE_HALL; + } else if (selector->selectedFacility == FACILITY_CASTLE) { + selector->partyMenu->mode = PARTY_MENU_MODE_BATTLE_CASTLE; + } else if (selector->selectedFacility == FACILITY_ARCADE) { + selector->partyMenu->mode = PARTY_MENU_MODE_BATTLE_CASTLE; + } else { + GF_ASSERT(FALSE); + } + + selector->partyMenu->fieldSystem = fieldSystem; + selector->partyMenu->selectedMonSlot = selector->selectedMonSlot; + + for (u8 i = 0; i < 2; i++) { + selector->partyMenu->selectionOrder[i] = selector->partyMenuSelectionOrder[i]; + } + + if (selector->selectedFacility == FACILITY_TOWER) { + selector->partyMenu->minSelectionSlots = 2; + selector->partyMenu->maxSelectionSlots = 2; + selector->partyMenu->reqLevel = 100; + } else if (selector->selectedFacility == FACILITY_HALL) { + selector->partyMenu->minSelectionSlots = 1; + selector->partyMenu->maxSelectionSlots = 1; + selector->partyMenu->reqLevel = 30; + } else if (selector->selectedFacility == FACILITY_CASTLE) { + selector->partyMenu->minSelectionSlots = 2; + selector->partyMenu->maxSelectionSlots = 2; + selector->partyMenu->reqLevel = 100; + } else if (selector->selectedFacility == FACILITY_ARCADE) { + selector->partyMenu->minSelectionSlots = 2; + selector->partyMenu->maxSelectionSlots = 2; + selector->partyMenu->reqLevel = 100; + } else { + GF_ASSERT(FALSE); + } + + sub_0209B988(frontier, &gPokemonPartyAppTemplate, selector->partyMenu, 0, NULL); +} + +static void ProcessPartyMenuResults(BattleFrontier *frontier, WFCFacilitySelector *selector, FieldSystem *fieldSystem, enum HeapID heapID) +{ + switch (selector->partyMenu->selectedMonSlot) { + case PARTY_MENU_SLOT_CANCEL: + *selector->subAppResult = 4; + selector->dummy = 4; + return; + case MAX_PARTY_SIZE: + *selector->subAppResult = 4; + selector->dummy = 4; + return; + default: + break; + } + + MI_CpuCopy8(selector->partyMenu->selectionOrder, selector->partyMenuSelectionOrder, 2); + selector->selectedMonSlot = selector->partyMenu->selectedMonSlot; + Heap_Free(selector->partyMenu); + + selector->partyMenu = NULL; + *selector->subAppResult = 2; + selector->dummy = 2; +} + +static void SetupSummaryApp(BattleFrontier *frontier, WFCFacilitySelector *selector, FieldSystem *fieldSystem, enum HeapID heapID) +{ + static const u8 visiblePages[] = { + SUMMARY_PAGE_INFO, + SUMMARY_PAGE_MEMO, + SUMMARY_PAGE_SKILLS, + SUMMARY_PAGE_CONDITION, + SUMMARY_PAGE_BATTLE_MOVES, + SUMMARY_PAGE_CONTEST_MOVES, + SUMMARY_PAGE_RIBBONS, + SUMMARY_PAGE_EXIT, + SUMMARY_PAGE_MAX, + }; + + selector->summaryApp = Heap_AllocAtEnd(heapID, sizeof(PokemonSummary)); + MI_CpuClear8(selector->summaryApp, sizeof(PokemonSummary)); + + selector->summaryApp->options = SaveData_GetOptions(selector->saveData); + selector->summaryApp->monData = SaveData_GetParty(selector->saveData); + selector->summaryApp->dexMode = SaveData_GetDexMode(selector->saveData); + selector->summaryApp->showContest = PokemonSummaryScreen_ShowContestData(selector->saveData); + selector->summaryApp->dataType = SUMMARY_DATA_PARTY_MON; + selector->summaryApp->monIndex = selector->selectedMonSlot; + selector->summaryApp->monMax = Party_GetCurrentCount(selector->summaryApp->monData); + selector->summaryApp->move = 0; + selector->summaryApp->mode = SUMMARY_MODE_NORMAL; + selector->summaryApp->specialRibbons = SaveData_GetRibbons(selector->saveData); + + PokemonSummaryScreen_FlagVisiblePages(selector->summaryApp, visiblePages); + PokemonSummaryScreen_SetPlayerProfile(selector->summaryApp, SaveData_GetTrainerInfo(selector->saveData)); + sub_0209B988(frontier, &gPokemonSummaryScreenApp, selector->summaryApp, 0, NULL); +} + +static void ProcessSummaryAppResults(BattleFrontier *frontier, WFCFacilitySelector *selector, FieldSystem *fieldSystem, enum HeapID heapID) +{ + selector->selectedMonSlot = selector->summaryApp->monIndex; + Heap_Free(selector->summaryApp); + selector->summaryApp = NULL; + *selector->subAppResult = 0; + selector->dummy = 0; +} diff --git a/src/overlay104/wfc_facility_selector_helpers.c b/src/overlay104/wfc_facility_selector_helpers.c new file mode 100644 index 0000000000..5fc4ab20e7 --- /dev/null +++ b/src/overlay104/wfc_facility_selector_helpers.c @@ -0,0 +1,139 @@ +#include "overlay104/wfc_facility_selector_helpers.h" + +#include + +#include "constants/battle_frontier.h" +#include "constants/battle_frontier_stats.h" + +#include "bg_window.h" +#include "heap.h" +#include "sys_task.h" +#include "sys_task_manager.h" + +#define TILESET_WIDTH 16 +#define DARK_TILES_OFFSET 12 +#define LIGHT_TILES_OFFSET 14 + +static WFCFacilitySelectorMonitorFlicker *WFCFacilitySelectorMonitorFlicker_Init(BgConfig *bgConfig); +static void Task_UpdateMonitorTiles(SysTask *task, void *taskData); +static void GetMonitorTileset(u16 *tiles, u8 tileset); +static void WFCFacilitySelectorMonitorFlicker_Free(WFCFacilitySelectorMonitorFlicker *flicker); + +WFCFacilitySelectorEffects *WFCFacilitySelectorEffects_Init(BgConfig *bgConfig) +{ + WFCFacilitySelectorEffects *effects = Heap_Alloc(HEAP_ID_94, sizeof(WFCFacilitySelectorEffects)); + MI_CpuClear8(effects, sizeof(WFCFacilitySelectorEffects)); + effects->flicker = WFCFacilitySelectorMonitorFlicker_Init(bgConfig); + + return effects; +} + +static WFCFacilitySelectorMonitorFlicker *WFCFacilitySelectorMonitorFlicker_Init(BgConfig *bgConfig) +{ + WFCFacilitySelectorMonitorFlicker *flicker = Heap_Alloc(HEAP_ID_94, sizeof(WFCFacilitySelectorMonitorFlicker)); + MI_CpuClear8(flicker, sizeof(WFCFacilitySelectorMonitorFlicker)); + + flicker->bgConfig = bgConfig; + flicker->monitorState = 0; + flicker->task = SysTask_Start(Task_UpdateMonitorTiles, flicker, 80000 - 500); + + return flicker; +} + +static void Task_UpdateMonitorTiles(SysTask *task, void *taskData) +{ + WFCFacilitySelectorMonitorFlicker *flicker = taskData; + + if (flicker->delay < 2) { + flicker->delay++; + return; + } + + flicker->delay = 0; + flicker->monitorState ^= 1; + + u16 tiles[4]; + GetMonitorTileset(tiles, flicker->monitorState); + + Bg_LoadToTilemapRect(flicker->bgConfig, BG_LAYER_MAIN_3, tiles, 14, 2, 2, 2); + Bg_ScheduleTilemapTransfer(flicker->bgConfig, BG_LAYER_MAIN_3); +} + +static void GetMonitorTileset(u16 *tiles, u8 tileset) +{ + u32 offset = tileset == 0 ? DARK_TILES_OFFSET : LIGHT_TILES_OFFSET; + + for (u32 r = 0; r < 2; r++) { + for (u32 c = 0; c < 2; c++) { + tiles[(r * 2) + c] = ((TILESET_WIDTH * 6) + r * TILESET_WIDTH) + (offset + c); + } + } +} + +void WFCFacilitySelectorEffects_Free(WFCFacilitySelectorEffects *effects) +{ + WFCFacilitySelectorMonitorFlicker_Free(effects->flicker); + Heap_Free(effects); +} + +static void WFCFacilitySelectorMonitorFlicker_Free(WFCFacilitySelectorMonitorFlicker *flicker) +{ + SysTask_Done(flicker->task); + Heap_Free(flicker); +} + +u16 BattleFrontier_GetWFCLatestStreakIndex(u8 facility) +{ + u16 index; + + switch (facility) { + case FACILITY_FACTORY: + index = STAT_FACTORY_LATEST_STREAK_50_MULTI_WFC; + break; + case FACILITY_FACTORY_OPEN: + index = STAT_FACTORY_LATEST_STREAK_OPEN_MULTI_WFC; + break; + case FACILITY_CASTLE: + index = STAT_CASTLE_LATEST_STREAK_MULTI_WFC; + break; + case FACILITY_HALL: + index = STAT_HALL_LATEST_STREAK_MULTI_WFC; + break; + case FACILITY_ARCADE: + index = STAT_ARCADE_LATEST_STREAK_MULTI_WFC; + break; + case FACILITY_TOWER: + index = STAT_TOWER_LATEST_STREAK_MODE_6; + break; + } + + return index; +} + +u16 BattleFrontier_GetWFCStreakActiveIndex(u8 facility) +{ + u16 index; + + switch (facility) { + case FACILITY_FACTORY: + index = STAT_FACTORY_50_WFC_STREAK_ACTIVE; + break; + case FACILITY_FACTORY_OPEN: + index = STAT_FACTORY_OPEN_WFC_STREAK_ACTIVE; + break; + case FACILITY_CASTLE: + index = STAT_CASTLE_WFC_STREAK_ACTIVE; + break; + case FACILITY_HALL: + index = STAT_HALL_WFC_STREAK_ACTIVE; + break; + case FACILITY_ARCADE: + index = STAT_ARCADE_WFC_STREAK_ACTIVE; + break; + case FACILITY_TOWER: + index = STAT_TOWER_WFC_STREAK_ACTIVE; + break; + } + + return index; +} diff --git a/src/unk_020494DC.c b/src/unk_020494DC.c index b17c5ed397..e0b3ba9b24 100644 --- a/src/unk_020494DC.c +++ b/src/unk_020494DC.c @@ -320,8 +320,8 @@ static BOOL sub_02049A20(ScriptContext *ctx) v0 = 2; } - if (battleTower->unk_8D4 == v0) { - battleTower->unk_8D4 = 0; + if (battleTower->msgsReceived == v0) { + battleTower->msgsReceived = 0; *v2 = battleTower->unk_8D8; return TRUE; diff --git a/src/unk_0207DA28.c b/src/unk_0207DA28.c index 0979202651..2c2f91e1b3 100644 --- a/src/unk_0207DA28.c +++ b/src/unk_0207DA28.c @@ -220,7 +220,7 @@ static BOOL sub_0207DA28(FieldTask *task) break; case 16: sub_0203632C(0); - v2->unk_10 = sub_0209BA18(fieldSystem, NULL); + v2->unk_10 = BattleFrontier_LaunchWFCFacilitySelector(fieldSystem, NULL); v2->unk_04++; break; case 17: diff --git a/src/unk_0209BA80.c b/src/unk_0209BA80.c index dc3b9ee853..bbe0d555ae 100644 --- a/src/unk_0209BA80.c +++ b/src/unk_0209BA80.c @@ -1,13 +1,11 @@ #include "unk_0209BA80.h" #include -#include #include "constants/battle_tower.h" #include "struct_defs/battle_tower.h" #include "struct_defs/comm_cmd_table.h" -#include "struct_defs/struct_0209BBA4.h" #include "applications/frontier/battle_arcade/main.h" #include "applications/frontier/battle_castle/opponent_app.h" @@ -15,7 +13,7 @@ #include "applications/frontier/battle_factory/main.h" #include "applications/frontier/battle_hall/main.h" #include "overlay104/frontier_communication.h" -#include "overlay104/ov104_0223C164.h" +#include "overlay104/wfc_facility_selector_helpers.h" #include "battle_frontier_save.h" #include "communication_system.h" @@ -24,19 +22,13 @@ #include "unk_02032798.h" static void sub_0209BA94(int param0, int param1, void *param2, void *param3); -BOOL sub_0209BB08(BattleTower *battleTower); -static void sub_0209BB34(int param0, int param1, void *param2, void *param3); +static void BattleTower_HandleTrainerIDListCmd(int netID, int unused, void *data, void *context); static void sub_0209BB68(int param0, int param1, void *param2, void *param3); -BOOL sub_0209BBA4(UnkStruct_0209BBA4 *param0); -void sub_0209BBEC(int param0, int param1, void *param2, void *param3); -BOOL sub_0209BC1C(UnkStruct_0209BBA4 *param0, u16 param1); -void sub_0209BC3C(int param0, int param1, void *param2, void *param3); -BOOL sub_0209BC64(UnkStruct_0209BBA4 *param0, u16 param1, u16 param2); -void sub_0209BD28(int param0, int param1, void *param2, void *param3); -BOOL sub_0209BD68(UnkStruct_0209BBA4 *param0, u16 param1); -void sub_0209BD88(int param0, int param1, void *param2, void *param3); -BOOL sub_0209BDB0(UnkStruct_0209BBA4 *param0, u16 param1); -void sub_0209BDD0(int param0, int param1, void *param2, void *param3); +static void WFCFacilitySelector_HandleFacilityAndStreakCmd(int netID, int unused, void *data, void *context); +static void WFCFacilitySelector_HandleDidDropOutCmd(int netID, int unused, void *data, void *context); +static void WFCFacilitySelector_HandleSelectedMonsCmd(int netID, int unused, void *data, void *context); +static void WFCFacilitySelector_HandleStreakDeletionChoiceCmd(int netID, int unused, void *data, void *context); +static void WFCFacilitySelector_HandlePlayAgainCmd(int netID, int unused, void *data, void *context); static const CommCmdTable Unk_020F8BF0[] = { { ov104_0222EF30, CommPacketSizeOf_Variable, NULL }, @@ -74,13 +66,13 @@ static const CommCmdTable Unk_020F8BF0[] = { { BattleCastleOpponentApp_HandlePurchaseInfoCmd, CommPacketSizeOf_Variable, NULL }, { BattleCastleOpponentApp_HandleUpdateCursorCmd, CommPacketSizeOf_Variable, NULL }, { BattleCastleOpponentApp_HandleExitAppCmd, CommPacketSizeOf_Variable, NULL }, - { sub_0209BBEC, CommPacketSizeOf_Variable, NULL }, - { sub_0209BC3C, CommPacketSizeOf_Variable, NULL }, - { sub_0209BD28, CommPacketSizeOf_Variable, NULL }, - { sub_0209BD88, CommPacketSizeOf_Variable, NULL }, - { sub_0209BDD0, CommPacketSizeOf_Variable, NULL }, + { WFCFacilitySelector_HandleFacilityAndStreakCmd, CommPacketSizeOf_Variable, NULL }, + { WFCFacilitySelector_HandleDidDropOutCmd, CommPacketSizeOf_Variable, NULL }, + { WFCFacilitySelector_HandleSelectedMonsCmd, CommPacketSizeOf_Variable, NULL }, + { WFCFacilitySelector_HandleStreakDeletionChoiceCmd, CommPacketSizeOf_Variable, NULL }, + { WFCFacilitySelector_HandlePlayAgainCmd, CommPacketSizeOf_Variable, NULL }, { sub_0209BA94, CommPacketSizeOf_Variable, NULL }, - { sub_0209BB34, CommPacketSizeOf_Variable, NULL }, + { BattleTower_HandleTrainerIDListCmd, CommPacketSizeOf_Variable, NULL }, { sub_0209BB68, CommPacketSizeOf_Variable, NULL }, { ov104_0222F8A0, CommPacketSizeOf_Variable, NULL }, { ArcadeCommunication_ReceiveTrainers, CommPacketSizeOf_Variable, NULL }, @@ -108,7 +100,7 @@ static void sub_0209BA94(int param0, int param1, void *param2, void *param3) v0 = 0; v1 = 0; - battleTower->unk_8D4++; + battleTower->msgsReceived++; if (CommSys_CurNetId() == param0) { return; @@ -132,33 +124,22 @@ static void sub_0209BA94(int param0, int param1, void *param2, void *param3) return; } -BOOL sub_0209BB08(BattleTower *battleTower) +BOOL BattleTower_SendTrainerIDListCmd(BattleTower *battleTower) { - int v0, v1; + int dataSize = BT_OPPONENTS_COUNT * 2 * sizeof(u16); + MI_CpuCopy8(battleTower->trainerIDs, battleTower->unk_83E, dataSize); - v1 = (14 * 2); - - MI_CpuCopy8(battleTower->trainerIDs, battleTower->unk_83E, v1); - - if (CommSys_SendData(63, battleTower->unk_83E, v1) == 1) { - v0 = 1; - } else { - v0 = 0; - } - - return v0; + return CommSys_SendData(63, battleTower->unk_83E, dataSize) == TRUE; } -static void sub_0209BB34(int param0, int param1, void *param2, void *param3) +static void BattleTower_HandleTrainerIDListCmd(int netID, int unused, void *data, void *context) { - int v0; - BattleTower *battleTower = param3; - const u16 *v2 = param2; + BattleTower *battleTower = context; + const u16 *trainerIDs = data; - v0 = 0; - battleTower->unk_8D4++; + battleTower->msgsReceived++; - if (CommSys_CurNetId() == param0) { + if (CommSys_CurNetId() == netID) { return; } @@ -166,8 +147,7 @@ static void sub_0209BB34(int param0, int param1, void *param2, void *param3) return; } - MI_CpuCopy8(v2, battleTower->trainerIDs, BT_OPPONENTS_COUNT * 2 * sizeof(u16)); - return; + MI_CpuCopy8(trainerIDs, battleTower->trainerIDs, BT_OPPONENTS_COUNT * 2 * sizeof(u16)); } static void sub_0209BB68(int param0, int param1, void *param2, void *param3) @@ -179,7 +159,7 @@ static void sub_0209BB68(int param0, int param1, void *param2, void *param3) v0 = 0; battleTower->unk_8D8 = 0; - battleTower->unk_8D4++; + battleTower->msgsReceived++; if (CommSys_CurNetId() == param0) { return; @@ -192,195 +172,136 @@ static void sub_0209BB68(int param0, int param1, void *param2, void *param3) return; } -BOOL sub_0209BBA4(UnkStruct_0209BBA4 *param0) +BOOL WFCFacilitySelector_SendFacilityAndLatestStreak(WFCFacilitySelector *selector) { - int v0, v1, v2; + selector->commBuffer[0] = selector->selectedFacility; - v1 = 40; - param0->unk_08[0] = param0->unk_A0; + int streakIndex = BattleFrontier_GetWFCLatestStreakIndex(selector->selectedFacility); + selector->commBuffer[1] = BattleFrontierSave_GetStatAutoHostIdx(SaveData_GetBattleFrontier(selector->saveData), streakIndex); - v2 = ov104_0223C264(param0->unk_A0); - param0->unk_08[1] = BattleFrontierSave_GetStatAutoHostIdx(SaveData_GetBattleFrontier(param0->saveData), v2); - - if (CommSys_SendData(57, param0->unk_08, v1) == 1) { - v0 = 1; - } else { - v0 = 0; - } - - return v0; + return CommSys_SendData(57, selector->commBuffer, 40) == TRUE; } -void sub_0209BBEC(int param0, int param1, void *param2, void *param3) +static void WFCFacilitySelector_HandleFacilityAndStreakCmd(int netID, int unused, void *data, void *context) { - u16 v0; - UnkStruct_0209BBA4 *v1 = param3; - const u16 *v2 = param2; + WFCFacilitySelector *selector = context; + const u16 *payload = data; - v1->unk_6F++; + selector->msgsReceived++; - if (CommSys_CurNetId() == param0) { + if (CommSys_CurNetId() == netID) { return; } - v1->unk_6E = (u8)v2[0]; - v1->unk_72 = v2[1]; - - return; + selector->partnersSelectedFacility = payload[0]; + selector->partnersLatestStreak = payload[1]; } -BOOL sub_0209BC1C(UnkStruct_0209BBA4 *param0, u16 param1) +BOOL WFCFacilitySelector_SendDidDropOutCmd(WFCFacilitySelector *selector, u16 didDropOut) { - int v0, v1 = 40; - param0->unk_08[0] = param1; - - if (CommSys_SendData(58, param0->unk_08, v1) == 1) { - v0 = 1; - } else { - v0 = 0; - } - - return v0; + selector->commBuffer[0] = didDropOut; + return CommSys_SendData(58, selector->commBuffer, 40) == TRUE; } -void sub_0209BC3C(int param0, int param1, void *param2, void *param3) +static void WFCFacilitySelector_HandleDidDropOutCmd(int netID, int unused, void *data, void *context) { - int v0; - UnkStruct_0209BBA4 *v1 = param3; - const u16 *v2 = param2; + WFCFacilitySelector *selector = context; + const u16 *payload = data; - v0 = 0; - v1->unk_6F++; + selector->msgsReceived++; - if (CommSys_CurNetId() == param0) { + if (CommSys_CurNetId() == netID) { return; } - v1->unk_59 = (u8)v2[0]; - return; + selector->partnerDroppedOut = payload[0]; } -BOOL sub_0209BC64(UnkStruct_0209BBA4 *param0, u16 param1, u16 param2) +BOOL WFCFacilitySelector_SendSelectedMons(WFCFacilitySelector *selector, u16 selectedSlot1, u16 selectedSlot2) { - int v0, v1; - Pokemon *v2; - Party *v3; + Party *party = SaveData_GetParty(selector->saveData); - v1 = 40; - v3 = SaveData_GetParty(param0->saveData); + selector->selectedMonSlots[0] = selectedSlot1; + selector->selectedMonSlots[1] = selectedSlot2; - param0->unk_6A[0] = param1; - param0->unk_6A[1] = param2; - - if (param1 == 0xff) { - param0->unk_76[0] = 0; - param0->unk_7E[0] = 0; - param0->unk_76[1] = 0; - param0->unk_7E[1] = 0; + if (selectedSlot1 == 0xff) { + selector->selectedSpecies[0] = 0; + selector->selectedItems[0] = 0; + selector->selectedSpecies[1] = 0; + selector->selectedItems[1] = 0; } else { - v2 = Party_GetPokemonBySlotIndex(v3, param1); + Pokemon *mon = Party_GetPokemonBySlotIndex(party, selectedSlot1); - param0->unk_76[0] = Pokemon_GetValue(v2, MON_DATA_SPECIES, NULL); - param0->unk_7E[0] = Pokemon_GetValue(v2, MON_DATA_HELD_ITEM, NULL); + selector->selectedSpecies[0] = Pokemon_GetValue(mon, MON_DATA_SPECIES, NULL); + selector->selectedItems[0] = Pokemon_GetValue(mon, MON_DATA_HELD_ITEM, NULL); - v2 = Party_GetPokemonBySlotIndex(v3, param2); + mon = Party_GetPokemonBySlotIndex(party, selectedSlot2); - param0->unk_76[1] = Pokemon_GetValue(v2, MON_DATA_SPECIES, NULL); - param0->unk_7E[1] = Pokemon_GetValue(v2, MON_DATA_HELD_ITEM, NULL); + selector->selectedSpecies[1] = Pokemon_GetValue(mon, MON_DATA_SPECIES, NULL); + selector->selectedItems[1] = Pokemon_GetValue(mon, MON_DATA_HELD_ITEM, NULL); } - param0->unk_08[0] = param0->unk_76[0]; - param0->unk_08[1] = param0->unk_7E[0]; - param0->unk_08[2] = param0->unk_76[1]; - param0->unk_08[3] = param0->unk_7E[1]; + selector->commBuffer[0] = selector->selectedSpecies[0]; + selector->commBuffer[1] = selector->selectedItems[0]; + selector->commBuffer[2] = selector->selectedSpecies[1]; + selector->commBuffer[3] = selector->selectedItems[1]; - if (CommSys_SendData(59, param0->unk_08, v1) == 1) { - v0 = 1; - } else { - v0 = 0; - } - - return v0; + return CommSys_SendData(59, selector->commBuffer, 40) == TRUE; } -void sub_0209BD28(int param0, int param1, void *param2, void *param3) +static void WFCFacilitySelector_HandleSelectedMonsCmd(int netID, int unused, void *data, void *context) { - UnkStruct_0209BBA4 *v0 = param3; - const u16 *v1 = param2; + WFCFacilitySelector *selector = context; + const u16 *payload = data; - v0->unk_6F++; + selector->msgsReceived++; - if (CommSys_CurNetId() == param0) { + if (CommSys_CurNetId() == netID) { return; } - v0->unk_86[0] = v1[0]; - v0->unk_8E[0] = v1[1]; - v0->unk_86[1] = v1[2]; - v0->unk_8E[1] = v1[3]; - - return; + selector->partnersSelectedSpecies[0] = payload[0]; + selector->partnersSelectedItems[0] = payload[1]; + selector->partnersSelectedSpecies[1] = payload[2]; + selector->partnersSelectedItems[1] = payload[3]; } -BOOL sub_0209BD68(UnkStruct_0209BBA4 *param0, u16 param1) +BOOL WFCFacilitySelector_SendStreakDeletionChoice(WFCFacilitySelector *selector, u16 streakDeletionChoice) { - int v0, v1 = 40; - - param0->unk_08[0] = param1; - - if (CommSys_SendData(60, param0->unk_08, v1) == 1) { - v0 = 1; - } else { - v0 = 0; - } - - return v0; + selector->commBuffer[0] = streakDeletionChoice; + return CommSys_SendData(60, selector->commBuffer, 40) == TRUE; } -void sub_0209BD88(int param0, int param1, void *param2, void *param3) +static void WFCFacilitySelector_HandleStreakDeletionChoiceCmd(int netID, int unused, void *data, void *context) { - int v0; - UnkStruct_0209BBA4 *v1 = param3; - const u16 *v2 = param2; + WFCFacilitySelector *selector = context; + const u16 *payload = data; - v0 = 0; - v1->unk_6F++; + selector->msgsReceived++; - if (CommSys_CurNetId() == param0) { + if (CommSys_CurNetId() == netID) { return; } - v1->unk_74 = v2[0]; - return; + selector->partnersStreakDeletionChoice = payload[0]; } -BOOL sub_0209BDB0(UnkStruct_0209BBA4 *param0, u16 param1) +BOOL WFCFacilitySelector_SendPlayAgainChoice(WFCFacilitySelector *selector, u16 notPlayingAgain) { - int v0, v1 = 40; - param0->unk_08[0] = param1; - - if (CommSys_SendData(61, param0->unk_08, v1) == 1) { - v0 = 1; - } else { - v0 = 0; - } - - return v0; + selector->commBuffer[0] = notPlayingAgain; + return CommSys_SendData(61, selector->commBuffer, 40) == TRUE; } -void sub_0209BDD0(int param0, int param1, void *param2, void *param3) +static void WFCFacilitySelector_HandlePlayAgainCmd(int netID, int unused, void *data, void *context) { - int v0; - UnkStruct_0209BBA4 *v1 = param3; - const u16 *v2 = param2; + WFCFacilitySelector *selector = context; + const u16 *payload = data; - v0 = 0; - v1->unk_6F++; + selector->msgsReceived++; - if (CommSys_CurNetId() == param0) { + if (CommSys_CurNetId() == netID) { return; } - v1->unk_71 = (u8)v2[0]; - return; + selector->partnerNotPlayingAgain = payload[0]; }