diff --git a/data/event_scripts.s b/data/event_scripts.s index 2fd8a0a151..8d3a06e69e 100644 --- a/data/event_scripts.s +++ b/data/event_scripts.s @@ -1159,3 +1159,4 @@ EventScript_VsSeekerChargingDone:: .include "data/text/save.inc" .include "data/text/birch_speech.inc" .include "data/scripts/dexnav.inc" + .include "data/scripts/battle_frontier.inc" diff --git a/data/maps/BattleFrontier_BattleArenaLobby/scripts.inc b/data/maps/BattleFrontier_BattleArenaLobby/scripts.inc index 7969ca9eb7..fdcd609bc8 100644 --- a/data/maps/BattleFrontier_BattleArenaLobby/scripts.inc +++ b/data/maps/BattleFrontier_BattleArenaLobby/scripts.inc @@ -182,10 +182,14 @@ BattleFrontier_BattleArenaLobby_EventScript_NotEnoughValidMons:: BattleFrontier_BattleArenaLobby_EventScript_NotEnoughValidMonsLv50:: msgbox BattleFrontier_BattleArenaLobby_Text_NotEnoughValidMonsLv50, MSGBOX_DEFAULT + call BattleFrontier_ShowCaughtBannedSpecies + msgbox BattleFrontier_BattleArenaLobby_Text_NotEnoughValidMonsEnd, MSGBOX_DEFAULT goto BattleFrontier_BattleArenaLobby_EventScript_EndCancelChallenge BattleFrontier_BattleArenaLobby_EventScript_NotEnoughValidMonsLvOpen:: msgbox BattleFrontier_BattleArenaLobby_Text_NotEnoughValidMonsLvOpen, MSGBOX_DEFAULT + call BattleFrontier_ShowCaughtBannedSpecies + msgbox BattleFrontier_BattleArenaLobby_Text_NotEnoughValidMonsEnd, MSGBOX_DEFAULT goto BattleFrontier_BattleArenaLobby_EventScript_EndCancelChallenge BattleFrontier_BattleArenaLobby_EventScript_CancelChallengeSaveFailed:: @@ -409,7 +413,9 @@ BattleFrontier_BattleArenaLobby_Text_NotEnoughValidMonsLvOpen: .string "different kinds of POKéMON.\p" .string "They also must not hold the same\n" .string "kinds of items.\p" - .string "EGGS{STR_VAR_1} ineligible.\p" + .string "EGGS{STR_VAR_1}.$" + +BattleFrontier_BattleArenaLobby_Text_NotEnoughValidMonsEnd: .string "When you have made your preparations,\n" .string "please do return.$" @@ -423,9 +429,7 @@ BattleFrontier_BattleArenaLobby_Text_NotEnoughValidMonsLv50: .string "must all be Level 50 or lower.\p" .string "They also must not hold the same\n" .string "kinds of items.\p" - .string "EGGS{STR_VAR_1} ineligible.\p" - .string "When you have made your preparations,\n" - .string "please do return.$" + .string "EGGS{STR_VAR_1}.$" BattleFrontier_BattleArenaLobby_Text_GuideYouToArena: .string "I shall now guide you to\n" diff --git a/data/maps/BattleFrontier_BattleDomeLobby/scripts.inc b/data/maps/BattleFrontier_BattleDomeLobby/scripts.inc index cf6510189c..f3522ccfb6 100644 --- a/data/maps/BattleFrontier_BattleDomeLobby/scripts.inc +++ b/data/maps/BattleFrontier_BattleDomeLobby/scripts.inc @@ -210,10 +210,14 @@ BattleFrontier_BattleDomeLobby_EventScript_NotEnoughValidMons:: BattleFrontier_BattleDomeLobby_EventScript_NotEnoughValidMonsLv50:: msgbox BattleFrontier_BattleDomeLobby_Text_NotEnoughValidMonsLv50, MSGBOX_DEFAULT + call BattleFrontier_ShowCaughtBannedSpecies + msgbox BattleFrontier_BattleDomeLobby_Text_NotEnoughValidMonsEnd, MSGBOX_DEFAULT goto BattleFrontier_BattleDomeLobby_EventScript_EndCancelChallenge BattleFrontier_BattleDomeLobby_EventScript_NotEnoughValidMonsLvOpen:: msgbox BattleFrontier_BattleDomeLobby_Text_NotEnoughValidMonsLvOpen, MSGBOX_DEFAULT + call BattleFrontier_ShowCaughtBannedSpecies + msgbox BattleFrontier_BattleDomeLobby_Text_NotEnoughValidMonsEnd, MSGBOX_DEFAULT goto BattleFrontier_BattleDomeLobby_EventScript_EndCancelChallenge BattleFrontier_BattleDomeLobby_EventScript_CancelChallengeSaveFailed:: @@ -486,7 +490,9 @@ BattleFrontier_BattleDomeLobby_Text_NotEnoughValidMonsLvOpen: .string "You don't have three eligible POKéMON.\p" .string "Also, the POKéMON must be holding\n" .string "different kinds of items.\p" - .string "EGGS{STR_VAR_1} ineligible.\p" + .string "EGGS{STR_VAR_1}.$" + +BattleFrontier_BattleDomeLobby_Text_NotEnoughValidMonsEnd: .string "Please come see me when you are ready.$" BattleFrontier_BattleDomeLobby_Text_NotEnoughValidMonsLv50: @@ -496,8 +502,7 @@ BattleFrontier_BattleDomeLobby_Text_NotEnoughValidMonsLv50: .string "of Level 50 or less to enter.\p" .string "They also must be holding different\n" .string "kinds of items.\p" - .string "EGGS{STR_VAR_1} ineligible.\p" - .string "Please come see me when you are ready.$" + .string "EGGS{STR_VAR_1}.$" BattleFrontier_BattleDomeLobby_Text_ShowYouToBattleDome: .string "I will now show you to\n" diff --git a/data/maps/BattleFrontier_BattlePalaceLobby/scripts.inc b/data/maps/BattleFrontier_BattlePalaceLobby/scripts.inc index d80eaa49c2..9ef4479f2e 100644 --- a/data/maps/BattleFrontier_BattlePalaceLobby/scripts.inc +++ b/data/maps/BattleFrontier_BattlePalaceLobby/scripts.inc @@ -202,10 +202,14 @@ BattleFrontier_BattlePalaceLobby_EventScript_NotEnoughValidMons:: BattleFrontier_BattlePalaceLobby_EventScript_NotEnoughValidMonsLv50:: msgbox BattleFrontier_BattlePalaceLobby_Text_NotEnoughValidMonsLv50, MSGBOX_DEFAULT + call BattleFrontier_ShowCaughtBannedSpecies + msgbox BattleFrontier_BattlePalaceLobby_Text_NotEnoughValidMonsEnd, MSGBOX_DEFAULT goto BattleFrontier_BattlePalaceLobby_EventScript_EndCancelChallenge BattleFrontier_BattlePalaceLobby_EventScript_NotEnoughValidMonsLvOpen:: msgbox BattleFrontier_BattlePalaceLobby_Text_NotEnoughValidMonsLvOpen, MSGBOX_DEFAULT + call BattleFrontier_ShowCaughtBannedSpecies + msgbox BattleFrontier_BattlePalaceLobby_Text_NotEnoughValidMonsEnd, MSGBOX_DEFAULT goto BattleFrontier_BattlePalaceLobby_EventScript_EndCancelChallenge BattleFrontier_BattlePalaceLobby_EventScript_CancelChallengeSaveFailed:: @@ -427,7 +431,9 @@ BattleFrontier_BattlePalaceLobby_Text_NotEnoughValidMonsLv50: .string "Level 50 or lower.\p" .string "They also must not be holding\n" .string "the same kinds of items.\p" - .string "EGGS{STR_VAR_1} ineligible.\p" + .string "EGGS{STR_VAR_1}.$" + +BattleFrontier_BattlePalaceLobby_Text_NotEnoughValidMonsEnd: .string "Come back when you have made\n" .string "your preparations.$" @@ -439,9 +445,7 @@ BattleFrontier_BattlePalaceLobby_Text_NotEnoughValidMonsLvOpen: .string "different kinds of POKéMON.\p" .string "They also must not be holding\n" .string "the same kinds of items.\p" - .string "EGGS{STR_VAR_1} ineligible.\p" - .string "Come back when you have made\n" - .string "your preparations.$" + .string "EGGS{STR_VAR_1}.$" BattleFrontier_BattlePalaceLobby_Text_NowSelectThreeMons: .string "Good. Now, you must select your\n" diff --git a/data/maps/BattleFrontier_BattlePikeLobby/scripts.inc b/data/maps/BattleFrontier_BattlePikeLobby/scripts.inc index 6e72a30ec0..db00673550 100644 --- a/data/maps/BattleFrontier_BattlePikeLobby/scripts.inc +++ b/data/maps/BattleFrontier_BattlePikeLobby/scripts.inc @@ -172,10 +172,14 @@ BattleFrontier_BattlePikeLobby_EventScript_NotEnoughValidMons:: BattleFrontier_BattlePikeLobby_EventScript_NotEnoughValidMonsLv50:: msgbox BattleFrontier_BattlePikeLobby_Text_NotEnoughValidMonsLv50, MSGBOX_DEFAULT + call BattleFrontier_ShowCaughtBannedSpecies + msgbox BattleFrontier_BattlePikeLobby_Text_NotEnoughValidMonsEnd, MSGBOX_DEFAULT goto BattleFrontier_BattlePikeLobby_EventScript_EndCancelChallenge BattleFrontier_BattlePikeLobby_EventScript_NotEnoughValidMonsLvOpen:: msgbox BattleFrontier_BattlePikeLobby_Text_NotEnoughValidMonsLvOpen, MSGBOX_DEFAULT + call BattleFrontier_ShowCaughtBannedSpecies + msgbox BattleFrontier_BattlePikeLobby_Text_NotEnoughValidMonsEnd, MSGBOX_DEFAULT goto BattleFrontier_BattlePikeLobby_EventScript_EndCancelChallenge BattleFrontier_BattlePikeLobby_EventScript_CancelChallengeSaveFailed:: @@ -315,7 +319,9 @@ BattleFrontier_BattlePikeLobby_Text_NotEnoughValidMonsLv50: .string "of Level 50 or less to enter.\p" .string "They also must be holding different\n" .string "kinds of items.\p" - .string "EGGS{STR_VAR_1} ineligible.\p" + .string "EGGS{STR_VAR_1}.$" + +BattleFrontier_BattlePikeLobby_Text_NotEnoughValidMonsEnd: .string "Please come see me when\n" .string "you are ready…$" @@ -327,9 +333,7 @@ BattleFrontier_BattlePikeLobby_Text_NotEnoughValidMonsLvOpen: .string "POKéMON to enter.\p" .string "They also must be holding different\n" .string "kinds of items.\p" - .string "EGGS{STR_VAR_1} ineligible.\p" - .string "Please come see me when\n" - .string "you are ready…$" + .string "EGGS{STR_VAR_1}.$" BattleFrontier_BattlePikeLobby_Text_PleaseChooseThreeMons: .string "Please choose the three POKéMON\n" diff --git a/data/maps/BattleFrontier_BattlePyramidLobby/scripts.inc b/data/maps/BattleFrontier_BattlePyramidLobby/scripts.inc index a8f949ca58..75f3c37cd8 100644 --- a/data/maps/BattleFrontier_BattlePyramidLobby/scripts.inc +++ b/data/maps/BattleFrontier_BattlePyramidLobby/scripts.inc @@ -184,10 +184,14 @@ BattleFrontier_BattlePyramidLobby_EventScript_NotEnoughValidMons:: BattleFrontier_BattlePyramidLobby_EventScript_NotEnoughValidMonsLv50:: msgbox BattleFrontier_BattlePyramidLobby_Text_NotEnoughValidMonsLv50, MSGBOX_DEFAULT + call BattleFrontier_ShowCaughtBannedSpecies + msgbox BattleFrontier_BattlePyramidLobby_Text_NotEnoughValidMonsEnd, MSGBOX_DEFAULT goto BattleFrontier_BattlePyramidLobby_EventScript_EndCancelChallenge BattleFrontier_BattlePyramidLobby_EventScript_NotEnoughValidMonsLvOpen:: msgbox BattleFrontier_BattlePyramidLobby_Text_NotEnoughValidMonsLvOpen, MSGBOX_DEFAULT + call BattleFrontier_ShowCaughtBannedSpecies + msgbox BattleFrontier_BattlePyramidLobby_Text_NotEnoughValidMonsEnd, MSGBOX_DEFAULT goto BattleFrontier_BattlePyramidLobby_EventScript_EndCancelChallenge BattleFrontier_BattlePyramidLobby_EventScript_CancelChallengeSaveFailed:: @@ -573,9 +577,7 @@ BattleFrontier_BattlePyramidLobby_Text_NotEnoughValidMonsLvOpen: .string "POKéMON qualified for the challenge.\p" .string "Please also remember to take all\n" .string "items from your POKéMON.\p" - .string "EGGS{STR_VAR_1} ineligible.\p" - .string "When you are ready, please have\n" - .string "a word with me.$" + .string "EGGS{STR_VAR_1}.$" BattleFrontier_BattlePyramidLobby_Text_NotEnoughValidMonsLv50: .string "A slight problem, adventurer!\p" @@ -585,7 +587,9 @@ BattleFrontier_BattlePyramidLobby_Text_NotEnoughValidMonsLv50: .string "and each no higher than Level 50.\p" .string "Please also remember to take all\n" .string "items from your POKéMON.\p" - .string "EGGS{STR_VAR_1} ineligible.\p" + .string "EGGS{STR_VAR_1}.$" + +BattleFrontier_BattlePyramidLobby_Text_NotEnoughValidMonsEnd: .string "When you are ready, please have\n" .string "a word with me.$" diff --git a/data/maps/BattleFrontier_BattleTowerLobby/scripts.inc b/data/maps/BattleFrontier_BattleTowerLobby/scripts.inc index 945335f7b7..3240683f95 100644 --- a/data/maps/BattleFrontier_BattleTowerLobby/scripts.inc +++ b/data/maps/BattleFrontier_BattleTowerLobby/scripts.inc @@ -543,16 +543,22 @@ BattleFrontier_BattleTowerLobby_EventScript_NotEnoughValidMonsLv50:: case FRONTIER_MODE_SINGLES, BattleFrontier_BattleTowerLobby_EventScript_NotEnoughValidMonsLv50Singles case FRONTIER_MODE_DOUBLES, BattleFrontier_BattleTowerLobby_EventScript_NotEnoughValidMonsLv50Doubles msgbox BattleFrontier_BattleTowerLobby_Text_NotEnoughValidMonsLv50Multis, MSGBOX_DEFAULT + call BattleFrontier_ShowCaughtBannedSpecies + msgbox BattleFrontier_BattleTowerLobby_Text_NotEnoughValidMonsEnd, MSGBOX_DEFAULT goto BattleFrontier_BattleTowerLobby_EventScript_EndCancelChallenge end BattleFrontier_BattleTowerLobby_EventScript_NotEnoughValidMonsLv50Singles:: msgbox BattleFrontier_BattleTowerLobby_Text_NotEnoughValidMonsLv50Singles, MSGBOX_DEFAULT + call BattleFrontier_ShowCaughtBannedSpecies + msgbox BattleFrontier_BattleTowerLobby_Text_NotEnoughValidMonsEnd, MSGBOX_DEFAULT goto BattleFrontier_BattleTowerLobby_EventScript_EndCancelChallenge end BattleFrontier_BattleTowerLobby_EventScript_NotEnoughValidMonsLv50Doubles:: msgbox BattleFrontier_BattleTowerLobby_Text_NotEnoughValidMonsLv50Doubles, MSGBOX_DEFAULT + call BattleFrontier_ShowCaughtBannedSpecies + msgbox BattleFrontier_BattleTowerLobby_Text_NotEnoughValidMonsEnd, MSGBOX_DEFAULT goto BattleFrontier_BattleTowerLobby_EventScript_EndCancelChallenge end @@ -561,16 +567,22 @@ BattleFrontier_BattleTowerLobby_EventScript_NotEnoughValidMonsLvOpen:: case FRONTIER_MODE_SINGLES, BattleFrontier_BattleTowerLobby_EventScript_NotEnoughValidMonsLvOpenSingles case FRONTIER_MODE_DOUBLES, BattleFrontier_BattleTowerLobby_EventScript_NotEnoughValidMonsLvOpenDoubles msgbox BattleFrontier_BattleTowerLobby_Text_NotEnoughValidMonsLvOpenMultis, MSGBOX_DEFAULT + call BattleFrontier_ShowCaughtBannedSpecies + msgbox BattleFrontier_BattleTowerLobby_Text_NotEnoughValidMonsEnd, MSGBOX_DEFAULT goto BattleFrontier_BattleTowerLobby_EventScript_EndCancelChallenge end BattleFrontier_BattleTowerLobby_EventScript_NotEnoughValidMonsLvOpenSingles:: msgbox BattleFrontier_BattleTowerLobby_Text_NotEnoughValidMonsLvOpenSingles, MSGBOX_DEFAULT + call BattleFrontier_ShowCaughtBannedSpecies + msgbox BattleFrontier_BattleTowerLobby_Text_NotEnoughValidMonsEnd, MSGBOX_DEFAULT goto BattleFrontier_BattleTowerLobby_EventScript_EndCancelChallenge end BattleFrontier_BattleTowerLobby_EventScript_NotEnoughValidMonsLvOpenDoubles:: msgbox BattleFrontier_BattleTowerLobby_Text_NotEnoughValidMonsLvOpenDoubles, MSGBOX_DEFAULT + call BattleFrontier_ShowCaughtBannedSpecies + msgbox BattleFrontier_BattleTowerLobby_Text_NotEnoughValidMonsEnd, MSGBOX_DEFAULT goto BattleFrontier_BattleTowerLobby_EventScript_EndCancelChallenge end @@ -1083,7 +1095,9 @@ BattleFrontier_BattleTowerLobby_Text_NotEnoughValidMonsLv50: .string "of Level 50 or less to enter.\p" .string "They also must be holding different\n" .string "kinds of items.\p" - .string "EGGS{STR_VAR_1} ineligible.\p" + .string "EGGS{STR_VAR_1}.$" + +BattleFrontier_BattleTowerLobby_Text_NotEnoughValidMonsEnd: .string "Please come see me when you are ready.$" @ Unused @@ -1094,8 +1108,7 @@ BattleFrontier_BattleTowerLobby_Text_NotEnoughValidMonsLvOpen: .string "to enter.\p" .string "They also must be holding different\n" .string "kinds of items.\p" - .string "EGGS{STR_VAR_1} ineligible.\p" - .string "Please come see me when you are ready.$" + .string "EGGS{STR_VAR_1}.$" BattleFrontier_BattleTowerLobby_Text_NotEnoughValidMonsLv50Singles: .string "Excuse me!\p" @@ -1104,8 +1117,7 @@ BattleFrontier_BattleTowerLobby_Text_NotEnoughValidMonsLv50Singles: .string "of Level 50 or less to enter.\p" .string "They also must be holding different\n" .string "kinds of items.\p" - .string "EGGS{STR_VAR_1} ineligible.\p" - .string "Please come see me when you are ready.$" + .string "EGGS{STR_VAR_1}.$" BattleFrontier_BattleTowerLobby_Text_NotEnoughValidMonsLvOpenSingles: .string "Excuse me!\p" @@ -1114,8 +1126,7 @@ BattleFrontier_BattleTowerLobby_Text_NotEnoughValidMonsLvOpenSingles: .string "to enter.\p" .string "They also must be holding different\n" .string "kinds of items.\p" - .string "EGGS{STR_VAR_1} ineligible.\p" - .string "Please come see me when you are ready.$" + .string "EGGS{STR_VAR_1}.$" BattleFrontier_BattleTowerLobby_Text_NotEnoughValidMonsLv50Doubles: .string "Excuse me!\p" @@ -1124,8 +1135,7 @@ BattleFrontier_BattleTowerLobby_Text_NotEnoughValidMonsLv50Doubles: .string "of Level 50 or less to enter.\p" .string "They also must be holding different\n" .string "kinds of items.\p" - .string "EGGS{STR_VAR_1} ineligible.\p" - .string "Please come see me when you are ready.$" + .string "EGGS{STR_VAR_1}.$" BattleFrontier_BattleTowerLobby_Text_NotEnoughValidMonsLvOpenDoubles: .string "Excuse me!\p" @@ -1134,8 +1144,7 @@ BattleFrontier_BattleTowerLobby_Text_NotEnoughValidMonsLvOpenDoubles: .string "to enter.\p" .string "They also must be holding different\n" .string "kinds of items.\p" - .string "EGGS{STR_VAR_1} ineligible.\p" - .string "Please come see me when you are ready.$" + .string "EGGS{STR_VAR_1}.$" BattleFrontier_BattleTowerLobby_Text_NotEnoughValidMonsLv50Multis: .string "Excuse me!\p" @@ -1144,8 +1153,7 @@ BattleFrontier_BattleTowerLobby_Text_NotEnoughValidMonsLv50Multis: .string "of Level 50 or less to enter.\p" .string "They also must be holding different\n" .string "kinds of items.\p" - .string "EGGS{STR_VAR_1} ineligible.\p" - .string "Please come see me when you are ready.$" + .string "EGGS{STR_VAR_1}.$" BattleFrontier_BattleTowerLobby_Text_NotEnoughValidMonsLvOpenMultis: .string "Excuse me!\p" @@ -1154,8 +1162,7 @@ BattleFrontier_BattleTowerLobby_Text_NotEnoughValidMonsLvOpenMultis: .string "to enter.\p" .string "They also must be holding different\n" .string "kinds of items.\p" - .string "EGGS{STR_VAR_1} ineligible.\p" - .string "Please come see me when you are ready.$" + .string "EGGS{STR_VAR_1}.$" BattleFrontier_BattleTowerLobby_Text_WelcomSingleBattle: .string "Where the talents of TRAINERS\n" diff --git a/data/scripts/battle_frontier.inc b/data/scripts/battle_frontier.inc new file mode 100644 index 0000000000..cbfd1ac5ee --- /dev/null +++ b/data/scripts/battle_frontier.inc @@ -0,0 +1,13 @@ +BattleFrontier_ShowCaughtBannedSpecies:: + goto_if_eq VAR_0x8005, 0, BattleFrontier_ShowCaughtBannedSpeciesEnd + msgbox BattleFrontier_DoYouWantToSeeTheListOfCaughtBannedSpecies, MSGBOX_YESNO + goto_if_eq VAR_RESULT, NO, BattleFrontier_ShowCaughtBannedSpeciesEnd + callnative ShowBattleFrontierCaughtBannedSpecies + waitstate +BattleFrontier_ShowCaughtBannedSpeciesEnd: + return + + +BattleFrontier_DoYouWantToSeeTheListOfCaughtBannedSpecies: + .string "Do you want to see the list of\n" + .string "POKéMON species you can't bring?$" diff --git a/include/frontier_util.h b/include/frontier_util.h index 5494aa5f0b..cd99f7a181 100644 --- a/include/frontier_util.h +++ b/include/frontier_util.h @@ -25,5 +25,6 @@ u8 GetFrontierBrainMonNature(u8 monId); u8 GetFrontierBrainMonEvs(u8 monId, u8 evStatId); s32 GetFronterBrainSymbol(void); void ClearEnemyPartyAfterChallenge(void); +void ShowBattleFrontierCaughtBannedSpecies(void); #endif // GUARD_FRONTIER_UTIL_H diff --git a/include/list_menu.h b/include/list_menu.h index 184b9c416f..8d472320d6 100644 --- a/include/list_menu.h +++ b/include/list_menu.h @@ -76,8 +76,9 @@ struct ListMenuTemplate u8 lettersSpacing:3; u8 itemVerticalPadding:3; u8 scrollMultiple:2; // x40, x80 = xC0 - u8 fontId:6; // x1, x2, x4, x8, x10, x20 = x3F - u8 cursorKind:2; // x40, x80 + u8 fontId:5; // x1, x2, x4, x8, x10 = x1F + u8 cursorKind:2; // x20, x40 + u8 isDynamic:1; //Dynamic list doesn't store all items in memory but load them from ROM when necessary }; struct ListMenu diff --git a/include/strings.h b/include/strings.h index a9cddee25b..0b4227125a 100644 --- a/include/strings.h +++ b/include/strings.h @@ -942,6 +942,9 @@ extern const u8 gText_FrontierFacilityClearStreak[]; extern const u8 gText_FrontierFacilityRoomsCleared[]; extern const u8 gText_FrontierFacilityKOsStreak[]; extern const u8 gText_FrontierFacilityFloorsCleared[]; +extern const u8 gText_FrontierFacilityTotalCaughtSpeciesBanned[]; +extern const u8 gText_FrontierFacilityIncluding[]; +extern const u8 gText_FrontierFacilityAreInelegible[]; // Battle Tower. extern const u8 BattleFrontier_BattleTowerMultiPartnerRoom_Text_Apprentice1Intro[]; diff --git a/src/frontier_util.c b/src/frontier_util.c index 8fcf1221f3..50f0c67167 100644 --- a/src/frontier_util.c +++ b/src/frontier_util.c @@ -38,6 +38,7 @@ #include "constants/items.h" #include "constants/event_objects.h" #include "party_menu.h" +#include "list_menu.h" struct FrontierBrainMon { @@ -93,6 +94,9 @@ static void ShowArenaResultsWindow(void); static void ShowPyramidResultsWindow(void); static void ShowLinkContestResultsWindow(void); static void CopyFrontierBrainText(bool8 playerWonText); +static u16 *MakeCaughtBannesSpeciesList(u32 totalBannedSpecies); +static void PrintBannedSpeciesName(u8 windowId, u32 itemId, u8 y); +static void Task_BannedSpeciesWindowInput(u8 taskId); // battledBit: Flags to change the conversation when the Frontier Brain is encountered for a battle // First bit is has battled them before and not won yet, second bit is has battled them and won (obtained a Symbol) @@ -784,6 +788,58 @@ static const u8 *const sHallFacilityToRecordsText[] = [RANKING_HALL_TOWER_LINK] = gText_FrontierFacilityWinStreak, }; + +#define BANNED_SPECIES_SHOWN 6 + +static const struct ListMenuTemplate sCaughtBannedSpeciesListTemplate = +{ + .items = NULL, + .isDynamic = TRUE, + .moveCursorFunc = ListMenuDefaultCursorMoveFunc, + .itemPrintFunc = PrintBannedSpeciesName, + .maxShowed = BANNED_SPECIES_SHOWN, + .header_X = 0, + .item_X = 8, + .cursor_X = 0, + .upText_Y = 1, + .cursorPal = 2, + .fillValue = 1, + .cursorShadowPal = 3, + .lettersSpacing = 1, + .itemVerticalPadding = 0, + .scrollMultiple = LIST_NO_MULTIPLE_SCROLL, + .fontId = FONT_NORMAL, + .cursorKind = 0 +}; + +static const struct WindowTemplate sBannedSpeciesWindowTemplateMain = +{ + .bg = 0, + .tilemapLeft = 1, + .tilemapTop = 1, + .width = 12, + .height = 2 * BANNED_SPECIES_SHOWN, + .paletteNum = 15, + .baseBlock = 1, +}; + +#define TAG_LIST_ARROWS 5425 + +static const struct ScrollArrowsTemplate sCaughtBannedSpeciesScrollArrowsTemplate = +{ + .firstArrowType = SCROLL_ARROW_UP, + .firstX = 56, + .firstY = 8, + .secondArrowType = SCROLL_ARROW_DOWN, + .secondX = 56, + .secondY = 104, + .fullyUpThreshold = 0, + .fullyDownThreshold = 0, + .tileTag = TAG_LIST_ARROWS, + .palTag = TAG_LIST_ARROWS, + .palNum = 0, +}; + // code void CallFrontierUtilFunc(void) { @@ -1943,21 +1999,18 @@ static void CheckBattleTypeFlag(void) gSpecialVar_Result = FALSE; } -#define SPECIES_PER_LINE 3 - static void AppendCaughtBannedMonSpeciesName(u16 species, u8 count, s32 numBannedMonsCaught) { - if (numBannedMonsCaught == count) + if (count == 1) + ; + else if (numBannedMonsCaught == count) StringAppend(gStringVar1, gText_SpaceAndSpace); else if (numBannedMonsCaught > count) StringAppend(gStringVar1, gText_CommaSpace); - if ((count % SPECIES_PER_LINE) == 0) - { - if (count == SPECIES_PER_LINE) - StringAppend(gStringVar1, gText_NewLine); - else - StringAppend(gStringVar1, gText_LineBreak); - } + if (count == 3) + StringAppend(gStringVar1, gText_NewLine2); + else if (count == 6) + StringAppend(gStringVar1, gText_LineBreak); StringAppend(gStringVar1, GetSpeciesName(species)); } @@ -2053,46 +2106,60 @@ static void CheckPartyIneligibility(void) if (numEligibleMons < toChoose) { - u32 i; + u32 i, j; u32 baseSpecies = 0; u32 totalCaughtBanned = 0; - u32 caughtBanned[100] = {0}; + u32 totalPartyBanned = 0; + u32 partyBanned[PARTY_SIZE] = {0}; for (i = 0; i < NUM_SPECIES; i++) { - if (totalCaughtBanned >= ARRAY_COUNT(caughtBanned)) - break; baseSpecies = GET_BASE_SPECIES_ID(i); - if (baseSpecies == i) + if (baseSpecies == i && gSpeciesInfo[baseSpecies].isFrontierBanned) { - if (gSpeciesInfo[baseSpecies].isFrontierBanned) + if (GetSetPokedexFlag(SpeciesToNationalPokedexNum(baseSpecies), FLAG_GET_CAUGHT)) + totalCaughtBanned++; + } + } + + for (i = 0; i < PARTY_SIZE; i++) + { + u16 species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES_OR_EGG); + if (species == SPECIES_EGG || species == SPECIES_NONE) + continue; + if (gSpeciesInfo[GET_BASE_SPECIES_ID(species)].isFrontierBanned) + { + bool32 addToList = TRUE; + for (j = 0; j < totalPartyBanned; j++) + if (partyBanned[j] == species) + addToList = FALSE; + if (addToList) { - if (GetSetPokedexFlag(SpeciesToNationalPokedexNum(baseSpecies), FLAG_GET_CAUGHT)) - { - caughtBanned[totalCaughtBanned] = baseSpecies; - totalCaughtBanned++; - } + partyBanned[totalPartyBanned] = species; + totalPartyBanned++; } } } + gStringVar1[0] = EOS; gSpecialVar_0x8004 = TRUE; - for (i = 0; i < totalCaughtBanned; i++) - AppendCaughtBannedMonSpeciesName(caughtBanned[i], i+1, totalCaughtBanned); - if (totalCaughtBanned == 0) { - StringAppend(gStringVar1, gText_Space2); - StringAppend(gStringVar1, gText_Are); + StringAppend(gStringVar1, gText_FrontierFacilityAreInelegible); } else { - if (totalCaughtBanned % SPECIES_PER_LINE == SPECIES_PER_LINE - 1) - StringAppend(gStringVar1, gText_LineBreak); - else - StringAppend(gStringVar1, gText_Space2); - StringAppend(gStringVar1, gText_Are2); + ConvertIntToDecimalStringN(gStringVar2, totalCaughtBanned, STR_CONV_MODE_LEFT_ALIGN, 3); + StringExpandPlaceholders(gStringVar4, gText_FrontierFacilityTotalCaughtSpeciesBanned); + StringAppend(gStringVar1, gStringVar4); } + if (totalPartyBanned > 0) + { + StringAppend(gStringVar1, gText_FrontierFacilityIncluding); + for (i = 0; i < totalPartyBanned; i++) + AppendCaughtBannedMonSpeciesName(partyBanned[i], i+1, totalPartyBanned); + } + gSpecialVar_0x8005 = totalCaughtBanned; } else { @@ -2102,8 +2169,6 @@ static void CheckPartyIneligibility(void) #undef numEligibleMons } -#undef SPECIES_PER_LINE - static void ValidateVisitingTrainer(void) { ValidateEReaderTrainer(); @@ -2649,3 +2714,98 @@ void ClearEnemyPartyAfterChallenge() ZeroEnemyPartyMons(); } } + +#define tWindowId data[0] +#define tMenuTaskId data[1] +#define tArrowTaskId data[2] +#define tScrollOffset data[3] +#define tListPointerElemId 4 + +static u16 *MakeCaughtBannesSpeciesList(u32 totalBannedSpecies) +{ + u32 count = 0; + u16 *list = AllocZeroed(sizeof(u16) * totalBannedSpecies); + for (u32 i = 0; i < NUM_SPECIES; i++) + { + u32 baseSpecies = GET_BASE_SPECIES_ID(i); + if (baseSpecies == i && gSpeciesInfo[baseSpecies].isFrontierBanned) + { + if (GetSetPokedexFlag(SpeciesToNationalPokedexNum(baseSpecies), FLAG_GET_CAUGHT)) + { + list[count] = i; + count++; + } + } + } + return list; +} + +static void PrintBannedSpeciesName(u8 windowId, u32 itemId, u8 y) +{ + u8 colors[3] = { + sCaughtBannedSpeciesListTemplate.fillValue, + sCaughtBannedSpeciesListTemplate.cursorPal, + sCaughtBannedSpeciesListTemplate.cursorShadowPal + }; + u16 *list = (u16 *) GetWordTaskArg(gSpecialVar_0x8006, tListPointerElemId); + AddTextPrinterParameterized4(windowId, + sCaughtBannedSpeciesListTemplate.fontId, + sCaughtBannedSpeciesListTemplate.item_X, y, + sCaughtBannedSpeciesListTemplate.lettersSpacing, 0, colors, TEXT_SKIP_DRAW, + GetSpeciesName(list[itemId])); +} + +void ShowBattleFrontierCaughtBannedSpecies(void) +{ + u8 windowId; + struct ListMenuTemplate listTemplate = sCaughtBannedSpeciesListTemplate; + u32 totalCaughtBanned = gSpecialVar_0x8005; + listTemplate.totalItems = totalCaughtBanned; + + // create window + LoadMessageBoxAndBorderGfx(); + windowId = AddWindow(&sBannedSpeciesWindowTemplateMain); + DrawStdWindowFrame(windowId, FALSE); + listTemplate.windowId = windowId; + + u16 *listItems = MakeCaughtBannesSpeciesList(totalCaughtBanned); + u32 inputTaskId = CreateTask(Task_BannedSpeciesWindowInput, 3); + gTasks[inputTaskId].tWindowId = windowId; + gSpecialVar_0x8006 = inputTaskId; + SetWordTaskArg(inputTaskId, tListPointerElemId, (u32)listItems); + u32 menuTaskId = ListMenuInit(&listTemplate, 0, 0); + gTasks[inputTaskId].tMenuTaskId = menuTaskId; + gTasks[inputTaskId].tArrowTaskId = TASK_NONE; + if (listTemplate.totalItems > listTemplate.maxShowed) + { + gTempScrollArrowTemplate = sCaughtBannedSpeciesScrollArrowsTemplate; + gTempScrollArrowTemplate.fullyDownThreshold = listTemplate.totalItems - listTemplate.maxShowed; + gTasks[inputTaskId].tArrowTaskId = AddScrollIndicatorArrowPair(&gTempScrollArrowTemplate, (u16 *)&gTasks[inputTaskId].tScrollOffset); + } + + // draw everything + CopyWindowToVram(windowId, COPYWIN_FULL); +} + +static void Task_BannedSpeciesWindowInput(u8 taskId) +{ + ListMenu_ProcessInput(gTasks[taskId].tMenuTaskId); + ListMenuGetScrollAndRow(gTasks[taskId].tMenuTaskId, (u16 *)&gTasks[taskId].tScrollOffset, NULL); + if (JOY_NEW(B_BUTTON)) + { + ScriptContext_Enable(); + if (gTasks[taskId].tArrowTaskId < TASK_NONE) + RemoveScrollIndicatorArrowPair(gTasks[taskId].tArrowTaskId); + Free((struct ListItem *)(GetWordTaskArg(taskId, tListPointerElemId))); + DestroyListMenuTask(gTasks[taskId].tMenuTaskId, NULL, NULL); + ClearStdWindowAndFrame(gTasks[taskId].tWindowId, TRUE); + RemoveWindow(gTasks[taskId].tWindowId); + DestroyTask(taskId); + } +} + +#undef tWindowId +#undef tMenuTaskId +#undef tArrowTaskId +#undef tScrollOffset +#undef tListPointerElemId diff --git a/src/list_menu.c b/src/list_menu.c index 124d39ba43..6b8db8dafc 100644 --- a/src/list_menu.c +++ b/src/list_menu.c @@ -392,7 +392,10 @@ s32 ListMenu_ProcessInput(u8 listTaskId) if (JOY_NEW(A_BUTTON)) { - return list->template.items[list->scrollOffset + list->selectedRow].id; + if (list->template.isDynamic) + return list->scrollOffset + list->selectedRow; + else + return list->template.items[list->scrollOffset + list->selectedRow].id; } else if (JOY_NEW(B_BUTTON)) { @@ -612,7 +615,6 @@ static void ListMenuPrintEntries(struct ListMenu *list, u16 startIndex, u16 yOff s32 i; u8 x, y; u8 yMultiplier = GetFontAttribute(list->template.fontId, FONTATTR_MAX_LETTER_HEIGHT) + list->template.itemVerticalPadding; - for (i = 0; i < count; i++) { if (list->template.items[startIndex].id != LIST_HEADER) @@ -621,10 +623,16 @@ static void ListMenuPrintEntries(struct ListMenu *list, u16 startIndex, u16 yOff x = list->template.header_X; y = (yOffset + i) * yMultiplier + list->template.upText_Y; - if (list->template.itemPrintFunc != NULL) - list->template.itemPrintFunc(list->template.windowId, list->template.items[startIndex].id, y); - - ListMenuPrint(list, list->template.items[startIndex].name, x, y); + if (list->template.isDynamic) + { + list->template.itemPrintFunc(list->template.windowId, startIndex, y); + } + else + { + if (list->template.itemPrintFunc != NULL) + list->template.itemPrintFunc(list->template.windowId, list->template.items[startIndex].id, y); + ListMenuPrint(list, list->template.items[startIndex].name, x, y); + } startIndex++; } } @@ -711,7 +719,7 @@ static u8 ListMenuUpdateSelectedRowIndexAndScrollOffset(struct ListMenu *list, b while (selectedRow != 0) { selectedRow--; - if (list->template.items[scrollOffset + selectedRow].id != LIST_HEADER) + if (list->template.isDynamic || list->template.items[scrollOffset + selectedRow].id != LIST_HEADER) { list->selectedRow = selectedRow; return 1; @@ -725,7 +733,7 @@ static u8 ListMenuUpdateSelectedRowIndexAndScrollOffset(struct ListMenu *list, b while (selectedRow > newRow) { selectedRow--; - if (list->template.items[scrollOffset + selectedRow].id != LIST_HEADER) + if (list->template.isDynamic || list->template.items[scrollOffset + selectedRow].id != LIST_HEADER) { list->selectedRow = selectedRow; return 1; @@ -747,7 +755,7 @@ static u8 ListMenuUpdateSelectedRowIndexAndScrollOffset(struct ListMenu *list, b while (selectedRow < list->template.maxShowed - 1) { selectedRow++; - if (list->template.items[scrollOffset + selectedRow].id != LIST_HEADER) + if (list->template.isDynamic || list->template.items[scrollOffset + selectedRow].id != LIST_HEADER) { list->selectedRow = selectedRow; return 1; @@ -761,7 +769,7 @@ static u8 ListMenuUpdateSelectedRowIndexAndScrollOffset(struct ListMenu *list, b while (selectedRow < newRow) { selectedRow++; - if (list->template.items[scrollOffset + selectedRow].id != LIST_HEADER) + if (list->template.isDynamic || list->template.items[scrollOffset + selectedRow].id != LIST_HEADER) { list->selectedRow = selectedRow; return 1; @@ -825,16 +833,26 @@ bool8 ListMenuChangeSelectionFull(struct ListMenu *list, bool32 updateCursor, bo oldSelectedRow = list->selectedRow; cursorCount = 0; selectionChange = 0; + for (i = 0; i < count; i++) { - do + if (list->template.isDynamic) { u8 ret = ListMenuUpdateSelectedRowIndexAndScrollOffset(list, movingDown); selectionChange |= ret; - if (ret != 2) - break; cursorCount++; - } while (list->template.items[list->scrollOffset + list->selectedRow].id == LIST_HEADER); + } + else + { + do + { + u8 ret = ListMenuUpdateSelectedRowIndexAndScrollOffset(list, movingDown); + selectionChange |= ret; + if (ret != 2) + break; + cursorCount++; + } while (list->template.items[list->scrollOffset + list->selectedRow].id == LIST_HEADER); + } } if (updateCursor) diff --git a/src/strings.c b/src/strings.c index fd92b31e92..372af24456 100644 --- a/src/strings.c +++ b/src/strings.c @@ -972,6 +972,9 @@ ALIGNED(4) const u8 gText_FrontierFacilityRoomsCleared[] = _("Rooms cleared: {ST ALIGNED(4) const u8 gText_FrontierFacilityKOsStreak[] = _("KOs in a row: {STR_VAR_2}"); ALIGNED(4) const u8 gText_FrontierFacilityFloorsCleared[] = _("Floors cleared: {STR_VAR_2}"); ALIGNED(4) const u8 gText_123Dot[][3] = {_("1."), _("2."), _("3.")}; +const u8 gText_FrontierFacilityTotalCaughtSpeciesBanned[] = _(" and {STR_VAR_2} of the POKéMON species\nyou caught are inelegible"); +const u8 gText_FrontierFacilityIncluding[] = _(".\pThese include "); +const u8 gText_FrontierFacilityAreInelegible[] = _(" are inelegible"); const u8 gText_SavingDontTurnOff2[] = _("SAVING…\nDON'T TURN OFF THE POWER."); const u8 gText_BlenderMaxSpeedRecord[] = _("BERRY BLENDER\nMAXIMUM SPEED RECORD!");