diff --git a/data/maps/BattleFrontier_BattlePointExchangeServiceCorner/scripts.inc b/data/maps/BattleFrontier_BattlePointExchangeServiceCorner/scripts.inc index 1f0b1be93..87915cd2c 100644 --- a/data/maps/BattleFrontier_BattlePointExchangeServiceCorner/scripts.inc +++ b/data/maps/BattleFrontier_BattlePointExchangeServiceCorner/scripts.inc @@ -3,12 +3,12 @@ BattleFrontier_BattlePointExchangeServiceCorner_MapScripts:: @ 825F070 BattleFrontier_BattlePointExchangeServiceCorner_EventScript_25F071:: @ 825F071 msgbox BattleFrontier_BattlePointExchangeServiceCorner_Text_25F7FA, MSGBOX_DEFAULT - special sub_813A958 + special ShowBattlePointsWindow return BattleFrontier_BattlePointExchangeServiceCorner_EventScript_25F07D:: @ 825F07D msgbox BattleFrontier_BattlePointExchangeServiceCorner_Text_25FF12, MSGBOX_DEFAULT - special sub_813A988 + special CloseBattlePointsWindow release end @@ -41,7 +41,7 @@ BattleFrontier_BattlePointExchangeServiceCorner_EventScript_25F0E5:: @ 825F0E5 copyvar VAR_0x8004, VAR_0x8008 special TakeFrontierBattlePoints givedecoration VAR_0x8009 - special sub_813A8FC + special UpdateBattlePointsWindow playse SE_REGI msgbox BattleFrontier_BattlePointExchangeServiceCorner_Text_25FE45, MSGBOX_DEFAULT compare VAR_TEMP_2, 0 @@ -51,7 +51,7 @@ BattleFrontier_BattlePointExchangeServiceCorner_EventScript_25F0E5:: @ 825F0E5 BattleFrontier_BattlePointExchangeServiceCorner_EventScript_25F11D:: @ 825F11D msgbox BattleFrontier_BattlePointExchangeServiceCorner_Text_25FEB9, MSGBOX_DEFAULT - special sub_813A988 + special CloseBattlePointsWindow release end @@ -62,7 +62,7 @@ BattleFrontier_BattlePointExchangeServiceCorner_EventScript_25F12A:: @ 825F12A copyvar VAR_0x8004, VAR_0x8008 special TakeFrontierBattlePoints giveitem VAR_0x8009, 1 - special sub_813A8FC + special UpdateBattlePointsWindow playse SE_REGI msgbox BattleFrontier_BattlePointExchangeServiceCorner_Text_25FE72, MSGBOX_DEFAULT compare VAR_TEMP_2, 2 @@ -72,7 +72,7 @@ BattleFrontier_BattlePointExchangeServiceCorner_EventScript_25F12A:: @ 825F12A BattleFrontier_BattlePointExchangeServiceCorner_EventScript_25F166:: @ 825F166 msgbox BattleFrontier_BattlePointExchangeServiceCorner_Text_25FEE3, MSGBOX_DEFAULT - special sub_813A988 + special CloseBattlePointsWindow release end @@ -86,10 +86,10 @@ BattleFrontier_BattlePointExchangeServiceCorner_EventScript_25F173:: @ 825F173 BattleFrontier_BattlePointExchangeServiceCorner_EventScript_25F185:: @ 825F185 setvar VAR_0x8004, SCROLL_MULTI_BF_EXCHANGE_CORNER_DECOR_VENDOR_1 - special sub_813AA18 + special ShowFrontierExchangeCornerItemIconWindow special ShowScrollableMultichoice waitstate - special sub_813AA44 + special CloseFrontierExchangeCornerItemIconWindow switch VAR_RESULT case 0, BattleFrontier_BattlePointExchangeServiceCorner_EventScript_25F21E case 1, BattleFrontier_BattlePointExchangeServiceCorner_EventScript_25F241 @@ -205,10 +205,10 @@ BattleFrontier_BattlePointExchangeServiceCorner_EventScript_25F37C:: @ 825F37C BattleFrontier_BattlePointExchangeServiceCorner_EventScript_25F38E:: @ 825F38E setvar VAR_0x8004, SCROLL_MULTI_BF_EXCHANGE_CORNER_DECOR_VENDOR_2 - special sub_813AA18 + special ShowFrontierExchangeCornerItemIconWindow special ShowScrollableMultichoice waitstate - special sub_813AA44 + special CloseFrontierExchangeCornerItemIconWindow switch VAR_RESULT case 0, BattleFrontier_BattlePointExchangeServiceCorner_EventScript_25F3F0 case 1, BattleFrontier_BattlePointExchangeServiceCorner_EventScript_25F413 @@ -274,10 +274,10 @@ BattleFrontier_BattlePointExchangeServiceCorner_EventScript_25F49F:: @ 825F49F BattleFrontier_BattlePointExchangeServiceCorner_EventScript_25F4B1:: @ 825F4B1 setvar VAR_0x8004, SCROLL_MULTI_BF_EXCHANGE_CORNER_VITAMIN_VENDOR - special sub_813AA18 + special ShowFrontierExchangeCornerItemIconWindow special ShowScrollableMultichoice waitstate - special sub_813AA44 + special CloseFrontierExchangeCornerItemIconWindow switch VAR_RESULT case 0, BattleFrontier_BattlePointExchangeServiceCorner_EventScript_25F51E case 1, BattleFrontier_BattlePointExchangeServiceCorner_EventScript_25F541 @@ -353,10 +353,10 @@ BattleFrontier_BattlePointExchangeServiceCorner_EventScript_25F5F0:: @ 825F5F0 BattleFrontier_BattlePointExchangeServiceCorner_EventScript_25F602:: @ 825F602 setvar VAR_0x8004, SCROLL_MULTI_BF_EXCHANGE_CORNER_HOLD_ITEM_VENDOR - special sub_813AA18 + special ShowFrontierExchangeCornerItemIconWindow special ShowScrollableMultichoice waitstate - special sub_813AA44 + special CloseFrontierExchangeCornerItemIconWindow switch VAR_RESULT case 0, BattleFrontier_BattlePointExchangeServiceCorner_EventScript_25F690 case 1, BattleFrontier_BattlePointExchangeServiceCorner_EventScript_25F6B3 diff --git a/data/maps/BattleFrontier_Lounge2/scripts.inc b/data/maps/BattleFrontier_Lounge2/scripts.inc index 435eb4127..bc4880dd3 100644 --- a/data/maps/BattleFrontier_Lounge2/scripts.inc +++ b/data/maps/BattleFrontier_Lounge2/scripts.inc @@ -40,7 +40,7 @@ BattleFrontier_Lounge2_EventScript_26066D:: @ 826066D call_if_le BattleFrontier_Lounge2_EventScript_2606F8 compare VAR_FRONTIER_MANIAC_FACILITY, 4 call_if_ge BattleFrontier_Lounge2_EventScript_260701 - special sub_8139F20 + special ShowFrontierManiacMessage waitmessage waitbuttonpress release diff --git a/data/maps/BattleFrontier_Lounge3/scripts.inc b/data/maps/BattleFrontier_Lounge3/scripts.inc index 6ecfd75cb..73da6194e 100644 --- a/data/maps/BattleFrontier_Lounge3/scripts.inc +++ b/data/maps/BattleFrontier_Lounge3/scripts.inc @@ -14,7 +14,7 @@ BattleFrontier_Lounge3_EventScript_261D83:: @ 8261D83 end BattleFrontier_Lounge3_EventScript_261DAF:: @ 8261DAF - special sub_813A820 + special ShowFrontierGamblerLookingMessage waitmessage waitbuttonpress msgbox BattleFrontier_Lounge3_Text_262A60, MSGBOX_YESNO @@ -25,7 +25,7 @@ BattleFrontier_Lounge3_EventScript_261DAF:: @ 8261DAF goto_if_eq BattleFrontier_Lounge3_EventScript_261FA5 message BattleFrontier_Lounge3_Text_262B42 waitmessage - special sub_813A958 + special ShowBattlePointsWindow goto BattleFrontier_Lounge3_EventScript_261DE9 end @@ -33,10 +33,10 @@ BattleFrontier_Lounge3_EventScript_261DE9:: @ 8261DE9 multichoice 20, 4, 87, 0 copyvar VAR_FRONTIER_GAMBLER_AMOUNT_BET, VAR_RESULT switch VAR_RESULT - case 0, BattleFrontier_Lounge3_EventScript_261E30 - case 1, BattleFrontier_Lounge3_EventScript_261E3B - case 2, BattleFrontier_Lounge3_EventScript_261E46 - case 3, BattleFrontier_Lounge3_EventScript_261FAF + case FRONTIER_GAMBLER_BET_5, BattleFrontier_Lounge3_EventScript_261E30 + case FRONTIER_GAMBLER_BET_10, BattleFrontier_Lounge3_EventScript_261E3B + case FRONTIER_GAMBLER_BET_15, BattleFrontier_Lounge3_EventScript_261E46 + case FRONTIER_GAMBLER_BET_CANCEL, BattleFrontier_Lounge3_EventScript_261FAF case 127, BattleFrontier_Lounge3_EventScript_261FAF end @@ -68,18 +68,18 @@ BattleFrontier_Lounge3_EventScript_261E51:: @ 8261E51 BattleFrontier_Lounge3_EventScript_261E75:: @ 8261E75 copyvar VAR_0x8004, VAR_0x8008 special TakeFrontierBattlePoints - setvar VAR_FRONTIER_GAMBLER_PLACED_BET_F, 1 - special sub_813A8FC + setvar VAR_FRONTIER_GAMBLER_STATE, FRONTIER_GAMBLER_PLACED_BET + special UpdateBattlePointsWindow playse SE_REGI msgbox BattleFrontier_Lounge3_Text_262BE0, MSGBOX_DEFAULT goto BattleFrontier_Lounge3_EventScript_261E96 end BattleFrontier_Lounge3_EventScript_261E96:: @ 8261E96 - special sub_813A854 + special ShowFrontierGamblerGoMessage waitmessage waitbuttonpress - special sub_813A988 + special CloseBattlePointsWindow release end @@ -105,37 +105,37 @@ BattleFrontier_Lounge3_EventScript_261EEB:: @ 8261EEB BattleFrontier_Lounge3_EventScript_261EF9:: @ 8261EF9 msgbox BattleFrontier_Lounge3_Text_26346B, MSGBOX_DEFAULT - compare VAR_FRONTIER_GAMBLER_PLACED_BET_F, 1 + compare VAR_FRONTIER_GAMBLER_STATE, FRONTIER_GAMBLER_PLACED_BET goto_if_ge BattleFrontier_Lounge3_EventScript_261F12 goto BattleFrontier_Lounge3_EventScript_261DAF end BattleFrontier_Lounge3_EventScript_261F12:: @ 8261F12 - compare VAR_FRONTIER_GAMBLER_PLACED_BET_F, 1 + compare VAR_FRONTIER_GAMBLER_STATE, FRONTIER_GAMBLER_PLACED_BET goto_if_eq BattleFrontier_Lounge3_EventScript_261F9E - compare VAR_FRONTIER_GAMBLER_PLACED_BET_F, 2 + compare VAR_FRONTIER_GAMBLER_STATE, FRONTIER_GAMBLER_WON goto_if_eq BattleFrontier_Lounge3_EventScript_261F2E goto BattleFrontier_Lounge3_EventScript_261F71 end BattleFrontier_Lounge3_EventScript_261F2E:: @ 8261F2E msgbox BattleFrontier_Lounge3_Text_263334, MSGBOX_DEFAULT - compare VAR_FRONTIER_GAMBLER_AMOUNT_BET, 0 + compare VAR_FRONTIER_GAMBLER_AMOUNT_BET, FRONTIER_GAMBLER_BET_5 call_if_eq BattleFrontier_Lounge3_EventScript_261F80 - compare VAR_FRONTIER_GAMBLER_AMOUNT_BET, 1 + compare VAR_FRONTIER_GAMBLER_AMOUNT_BET, FRONTIER_GAMBLER_BET_10 call_if_eq BattleFrontier_Lounge3_EventScript_261F8A - compare VAR_FRONTIER_GAMBLER_AMOUNT_BET, 2 + compare VAR_FRONTIER_GAMBLER_AMOUNT_BET, FRONTIER_GAMBLER_BET_15 call_if_eq BattleFrontier_Lounge3_EventScript_261F94 msgbox BattleFrontier_Lounge3_Text_2633D4, 9 special GiveFrontierBattlePoints msgbox BattleFrontier_Lounge3_Text_2633F2, MSGBOX_DEFAULT - setvar VAR_FRONTIER_GAMBLER_PLACED_BET_F, 0 + setvar VAR_FRONTIER_GAMBLER_STATE, FRONTIER_GAMBLER_WAITING release end BattleFrontier_Lounge3_EventScript_261F71:: @ 8261F71 msgbox BattleFrontier_Lounge3_Text_263298, MSGBOX_DEFAULT - setvar VAR_FRONTIER_GAMBLER_PLACED_BET_F, 0 + setvar VAR_FRONTIER_GAMBLER_STATE, FRONTIER_GAMBLER_WAITING release end @@ -155,7 +155,7 @@ BattleFrontier_Lounge3_EventScript_261F94:: @ 8261F94 return BattleFrontier_Lounge3_EventScript_261F9E:: @ 8261F9E - special sub_813A854 + special ShowFrontierGamblerGoMessage waitmessage waitbuttonpress release @@ -167,7 +167,7 @@ BattleFrontier_Lounge3_EventScript_261FA5:: @ 8261FA5 end BattleFrontier_Lounge3_EventScript_261FAF:: @ 8261FAF - special sub_813A988 + special CloseBattlePointsWindow goto BattleFrontier_Lounge3_EventScript_261FA5 end diff --git a/data/maps/BattleFrontier_Lounge5/scripts.inc b/data/maps/BattleFrontier_Lounge5/scripts.inc index d762612a9..7080ec87d 100644 --- a/data/maps/BattleFrontier_Lounge5/scripts.inc +++ b/data/maps/BattleFrontier_Lounge5/scripts.inc @@ -16,7 +16,7 @@ BattleFrontier_Lounge5_EventScript_2645C6:: @ 82645C6 specialvar VAR_RESULT, ScriptGetPartyMonSpecies compare VAR_RESULT, SPECIES_EGG goto_if_eq BattleFrontier_Lounge5_EventScript_264603 - special sub_813A7B8 + special ShowNatureGirlMessage waitmessage waitbuttonpress release diff --git a/data/maps/BattleFrontier_Lounge7/scripts.inc b/data/maps/BattleFrontier_Lounge7/scripts.inc index 94585b618..4ea73e135 100644 --- a/data/maps/BattleFrontier_Lounge7/scripts.inc +++ b/data/maps/BattleFrontier_Lounge7/scripts.inc @@ -19,7 +19,7 @@ BattleFrontier_Lounge7_EventScript_265276:: @ 8265276 BattleFrontier_Lounge7_EventScript_265284:: @ 8265284 message BattleFrontier_Lounge7_Text_2658EF waitmessage - special sub_813A958 + special ShowBattlePointsWindow setvar VAR_TEMP_E, 0 setvar VAR_0x8004, SCROLL_MULTI_BF_MOVE_TUTOR_1 setvar VAR_0x8006, 0 @@ -133,7 +133,7 @@ BattleFrontier_Lounge7_EventScript_265466:: @ 8265466 BattleFrontier_Lounge7_EventScript_265474:: @ 8265474 message BattleFrontier_Lounge7_Text_2658EF waitmessage - special sub_813A958 + special ShowBattlePointsWindow setvar VAR_TEMP_E, 1 setvar VAR_0x8004, SCROLL_MULTI_BF_MOVE_TUTOR_2 setvar VAR_0x8006, 0 @@ -231,7 +231,7 @@ BattleFrontier_Lounge7_EventScript_26562A:: @ 826562A BattleFrontier_Lounge7_EventScript_265635:: @ 8265635 special sub_813ADB8 - special sub_813A988 + special CloseBattlePointsWindow msgbox BattleFrontier_Lounge7_Text_265A0E, MSGBOX_DEFAULT release end @@ -263,7 +263,7 @@ BattleFrontier_Lounge7_EventScript_265696:: @ 8265696 msgbox BattleFrontier_Lounge7_Text_26595A, MSGBOX_DEFAULT special sub_813AEB4 fadescreen 1 - special sub_813A988 + special CloseBattlePointsWindow special sub_813ADB8 special sub_81B892C waitstate diff --git a/data/specials.inc b/data/specials.inc index 25fb4fee3..499f21e0b 100644 --- a/data/specials.inc +++ b/data/specials.inc @@ -450,7 +450,7 @@ gSpecials:: @ 81DBA64 def_special sub_80F9160 def_special ShowRankingHallRecordsWindow def_special ScrollRankingHallRecordsWindow - def_special sub_8139F20 + def_special ShowFrontierManiacMessage def_special sub_80F9134 def_special sub_80F9154 def_special sub_80B3028 @@ -462,22 +462,22 @@ gSpecials:: @ 81DBA64 def_special sub_81B95E0 def_special sub_81B9620 def_special sub_813A76C - def_special sub_813A7B8 - def_special sub_813A958 - def_special sub_813A8FC - def_special sub_813A988 + def_special ShowNatureGirlMessage + def_special ShowBattlePointsWindow + def_special UpdateBattlePointsWindow + def_special CloseBattlePointsWindow def_special GiveFrontierBattlePoints def_special TakeFrontierBattlePoints def_special GetFrontierBattlePoints - def_special sub_813AA18 - def_special sub_813AA44 + def_special ShowFrontierExchangeCornerItemIconWindow + def_special CloseFrontierExchangeCornerItemIconWindow def_special DisplayBerryPowderVendorMenu def_special RemoveBerryPowderVendorMenu def_special HasEnoughBerryPowder def_special TakeBerryPowder def_special PrintPlayerBerryPowderAmount - def_special sub_813A820 - def_special sub_813A854 + def_special ShowFrontierGamblerLookingMessage + def_special ShowFrontierGamblerGoMessage def_special sub_813B7D8 def_special sub_81C72A4 def_special sp106_CreateStartMenu diff --git a/include/constants/field_specials.h b/include/constants/field_specials.h index 73d3fb272..e9042dba3 100644 --- a/include/constants/field_specials.h +++ b/include/constants/field_specials.h @@ -41,4 +41,33 @@ #define DEPT_STORE_FLOORNUM_11F 14 #define DEPT_STORE_FLOORNUM_ROOFTOP 15 +// Frontier Maniac +#define FRONTIER_MANIAC_BATTLE_TOWER_SINGLES 0 +#define FRONTIER_MANIAC_BATTLE_TOWER_DOUBLES 1 +#define FRONTIER_MANIAC_BATTLE_TOWER_MULTIS 2 +#define FRONTIER_MANIAC_BATTLE_TOWER_LINK_MULTIS 3 +#define FRONTIER_MANIAC_BATTLE_DOME 4 +#define FRONTIER_MANIAC_BATTLE_FACTORY 5 +#define FRONTIER_MANIAC_BATTLE_PALACE 6 +#define FRONTIER_MANIAC_BATTLE_ARENA 7 +#define FRONTIER_MANIAC_BATTLE_PIKE 8 +#define FRONTIER_MANIAC_BATTLE_PYRAMID 9 +#define FRONTIER_MANIAC_FACILITY_COUNT 10 + +#define FRONTIER_MANIAC_MESSAGE_COUNT 3 + +// Frontier Gambler +#define FRONTIER_GAMBLER_WAITING 0 +#define FRONTIER_GAMBLER_PLACED_BET 1 +#define FRONTIER_GAMBLER_WON 2 +#define FRONTIER_GAMBLER_LOST 3 + +#define FRONTIER_GAMBLER_BET_5 0 +#define FRONTIER_GAMBLER_BET_10 1 +#define FRONTIER_GAMBLER_BET_15 2 +#define FRONTIER_GAMBLER_BET_CANCEL 3 + +#define FRONTIER_GAMBLER_CHALLENGE_COUNT 12 + + #endif // GUARD_CONSTANTS_FIELD_SPECIALS_H diff --git a/include/constants/vars.h b/include/constants/vars.h index 6b213c8cc..dd07092b0 100644 --- a/include/constants/vars.h +++ b/include/constants/vars.h @@ -61,10 +61,10 @@ #define VAR_0x402E 0x402E #define VAR_FRONTIER_MANIAC_FACILITY 0x402F -#define VAR_FRONTIER_GAMBLER_FACILITY 0x4030 -#define VAR_FRONTIER_GAMBLER_SET_FACILITY_F 0x4031 +#define VAR_FRONTIER_GAMBLER_CHALLENGE 0x4030 +#define VAR_FRONTIER_GAMBLER_SET_CHALLENGE 0x4031 #define VAR_FRONTIER_GAMBLER_AMOUNT_BET 0x4032 -#define VAR_FRONTIER_GAMBLER_PLACED_BET_F 0x4033 +#define VAR_FRONTIER_GAMBLER_STATE 0x4033 #define VAR_DEOXYS_ROCK_STEP_COUNT 0x4034 #define VAR_DEOXYS_ROCK_LEVEL 0x4035 diff --git a/include/field_specials.h b/include/field_specials.h index b9babe4f9..938705afc 100644 --- a/include/field_specials.h +++ b/include/field_specials.h @@ -20,7 +20,7 @@ bool32 ShouldDoRivalRayquazaCall(void); bool32 CountSSTidalStep(u16 delta); u8 GetSSTidalLocation(s8 *mapGroup, s8 *mapNum, s16 *x, s16 *y); void ShowScrollableMultichoice(void); -void sub_813A878(u8 a0); +void FrontierGamblerSetWonOrLost(bool8 won); u8 sub_813BADC(u8 a0); bool8 InPokemonCenter(void); void SetShoalItemFlag(u16 v0); diff --git a/src/data/battle_frontier/battle_frontier_exchange_corner.h b/src/data/battle_frontier/battle_frontier_exchange_corner.h index 77d327b5a..bcb3cdd62 100644 --- a/src/data/battle_frontier/battle_frontier_exchange_corner.h +++ b/src/data/battle_frontier/battle_frontier_exchange_corner.h @@ -1,4 +1,4 @@ -static const u16 sBFExchangeCorner_Decor1[] = +static const u16 sFrontierExchangeCorner_Decor1[] = { DECOR_KISS_POSTER, DECOR_KISS_CUSHION, @@ -13,7 +13,7 @@ static const u16 sBFExchangeCorner_Decor1[] = 0xFFFF }; -static const u16 sBFExchangeCorner_Decor2[] = +static const u16 sFrontierExchangeCorner_Decor2[] = { DECOR_LAPRAS_DOLL, DECOR_SNORLAX_DOLL, @@ -23,7 +23,7 @@ static const u16 sBFExchangeCorner_Decor2[] = 0xFFFF }; -static const u16 sBFExchangeCorner_Vitamins[] = +static const u16 sFrontierExchangeCorner_Vitamins[] = { ITEM_PROTEIN, ITEM_CALCIUM, @@ -34,7 +34,7 @@ static const u16 sBFExchangeCorner_Vitamins[] = 0xFFFF }; -static const u16 sBFExchangeCorner_HoldItems[] = +static const u16 sFrontierExchangeCorner_HoldItems[] = { ITEM_LEFTOVERS, ITEM_WHITE_HERB, @@ -48,7 +48,7 @@ static const u16 sBFExchangeCorner_HoldItems[] = 0xFFFF }; -static const u8 *const sBFExchangeCorner_Decor1Descriptions[] = +static const u8 *const sFrontierExchangeCorner_Decor1Descriptions[] = { BattleFrontier_BattlePointExchangeServiceCorner_Text_2601AA, BattleFrontier_BattlePointExchangeServiceCorner_Text_2601D0, @@ -63,7 +63,7 @@ static const u8 *const sBFExchangeCorner_Decor1Descriptions[] = gText_Exit, }; -static const u8 *const sBFExchangeCorner_Decor2Descriptions[] = +static const u8 *const sFrontierExchangeCorner_Decor2Descriptions[] = { BattleFrontier_BattlePointExchangeServiceCorner_Text_26036C, BattleFrontier_BattlePointExchangeServiceCorner_Text_26036C, @@ -73,7 +73,7 @@ static const u8 *const sBFExchangeCorner_Decor2Descriptions[] = gText_Exit }; -static const u8 *const sBFExchangeCorner_VitaminsDescriptions[] = +static const u8 *const sFrontierExchangeCorner_VitaminsDescriptions[] = { BattleFrontier_BattlePointExchangeServiceCorner_Text_260397, BattleFrontier_BattlePointExchangeServiceCorner_Text_2603BE, @@ -84,7 +84,7 @@ static const u8 *const sBFExchangeCorner_VitaminsDescriptions[] = gText_Exit }; -static const u8 *const sBFExchangeCorner_HoldItemsDescriptions[] = +static const u8 *const sFrontierExchangeCorner_HoldItemsDescriptions[] = { BattleFrontier_BattlePointExchangeServiceCorner_Text_26047A, BattleFrontier_BattlePointExchangeServiceCorner_Text_2604AC, diff --git a/src/field_specials.c b/src/field_specials.c index 4acf6ba54..8db4ea9fb 100644 --- a/src/field_specials.c +++ b/src/field_specials.c @@ -66,15 +66,15 @@ EWRAM_DATA u8 gBikeCollisions = 0; static EWRAM_DATA u32 gBikeCyclingTimer = 0; static EWRAM_DATA u8 gUnknown_0203AB5C = 0; static EWRAM_DATA u8 sPetalburgGymSlidingDoorFrameCounter = 0; -static EWRAM_DATA u8 gUnknown_0203AB5E = 0; +static EWRAM_DATA u8 gTutorMoveAndElevatorWindowId = 0; static EWRAM_DATA u16 gLilycoveDeptStore_NeverRead = 0; static EWRAM_DATA u16 gLilycoveDeptStore_DefaultFloorChoice = 0; static EWRAM_DATA struct ListMenuItem *gUnknown_0203AB64 = NULL; static EWRAM_DATA u16 gUnknown_0203AB68 = 0; -static EWRAM_DATA u16 gUnknown_0203AB6A = 0; +static EWRAM_DATA u16 gFrontierExchangeCorner_NeverRead = 0; static EWRAM_DATA u8 gScrollableMultichoiceSprite = 0; -static EWRAM_DATA u8 gUnknown_0203AB6D = 0; -static EWRAM_DATA u8 gUnknown_0203AB6E = 0; +static EWRAM_DATA u8 gBattlePointsWindowId = 0; +static EWRAM_DATA u8 gFrontierExchangeCornerItemIconWindowId = 0; static EWRAM_DATA u8 gUnknown_0203AB6F = 0; static EWRAM_DATA u32 gUnknown_0203AB70 = 0; @@ -105,19 +105,19 @@ static void sub_8139AF4(u8 taskId); static void sub_8139C2C(u16 a1, bool8 descending); static void MoveElevatorWindowLights(u8 taskId); static void sub_813A2DC(u8 taskId); -static void sub_813AA60(u16 menu, u16 selection); +static void FillFrontierExchangeCornerWindow(u16 menu, u16 selection); static void ShowBattleFrontierTutorWindow(u8 menu, u16 selection); static void sub_813A42C(void); static void sub_813A4EC(u8 taskId); static void sub_813A694(u8 taskId); static void sub_813A46C(s32 itemIndex, bool8 onInit, struct ListMenu *list); -static void sub_813AC44(u16 menu, u16 selection); +static void HideFrontierExchangeCornerItemIcon(u16 menu, u16 unused); static void ShowBattleFrontierTutorMoveDescription(u8 menu, u16 selection); static void sub_813A570(u8 taskId); static void sub_813A738(u8 taskId); static void sub_813A600(u8 taskId); static void sub_813A664(u8 taskId); -static void ScrollMulti_ShowItemIcon(u16 item); +static void ShowFrontierExchangeCornerItemIcon(u16 item); static void Task_DeoxysRockInteraction(u8 taskId); static void ChangeDeoxysRockLevel(u8 a0); static void WaitForDeoxysRockMovement(u8 taskId); @@ -1886,23 +1886,23 @@ void sub_8139B60(void) { int xPos; - gUnknown_0203AB5E = AddWindow(&gElevatorFloor_WindowTemplate); - SetStandardWindowBorderStyle(gUnknown_0203AB5E, 0); + gTutorMoveAndElevatorWindowId = AddWindow(&gElevatorFloor_WindowTemplate); + SetStandardWindowBorderStyle(gTutorMoveAndElevatorWindowId, 0); xPos = GetStringCenterAlignXOffset(1, gText_ElevatorNowOn, 64); - AddTextPrinterParameterized(gUnknown_0203AB5E, 1, gText_ElevatorNowOn, xPos, 1, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(gTutorMoveAndElevatorWindowId, 1, gText_ElevatorNowOn, xPos, 1, TEXT_SPEED_FF, NULL); xPos = GetStringCenterAlignXOffset(1, gDeptStoreFloorNames[gSpecialVar_0x8005], 64); - AddTextPrinterParameterized(gUnknown_0203AB5E, 1, gDeptStoreFloorNames[gSpecialVar_0x8005], xPos, 17, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(gTutorMoveAndElevatorWindowId, 1, gDeptStoreFloorNames[gSpecialVar_0x8005], xPos, 17, TEXT_SPEED_FF, NULL); - PutWindowTilemap(gUnknown_0203AB5E); - CopyWindowToVram(gUnknown_0203AB5E, 3); + PutWindowTilemap(gTutorMoveAndElevatorWindowId); + CopyWindowToVram(gTutorMoveAndElevatorWindowId, 3); } void sub_8139C10(void) { - ClearStdWindowAndFrameToTransparent(gUnknown_0203AB5E, TRUE); - RemoveWindow(gUnknown_0203AB5E); + ClearStdWindowAndFrameToTransparent(gTutorMoveAndElevatorWindowId, TRUE); + RemoveWindow(gTutorMoveAndElevatorWindowId); } static void sub_8139C2C(u16 a1, bool8 descending) @@ -2051,57 +2051,110 @@ void UpdateFrontierManiac(u16 daysSince) { u16 *var = GetVarPointer(VAR_FRONTIER_MANIAC_FACILITY); *var += daysSince; - *var %= 10; + *var %= FRONTIER_MANIAC_FACILITY_COUNT; } -void sub_8139F20(void) +void ShowFrontierManiacMessage(void) { - static const u8 *const gUnknown_085B2C50[][3] = + static const u8 *const sFrontierManiacMessages[][FRONTIER_MANIAC_MESSAGE_COUNT] = { - { BattleFrontier_Lounge2_Text_260971, BattleFrontier_Lounge2_Text_260A1E, BattleFrontier_Lounge2_Text_260AE7 }, - { BattleFrontier_Lounge2_Text_2619AC, BattleFrontier_Lounge2_Text_261A91, BattleFrontier_Lounge2_Text_261B0C }, - { BattleFrontier_Lounge2_Text_261B95, BattleFrontier_Lounge2_Text_261B95, BattleFrontier_Lounge2_Text_261B95 }, - { BattleFrontier_Lounge2_Text_261C1A, BattleFrontier_Lounge2_Text_261C1A, BattleFrontier_Lounge2_Text_261C1A }, - { BattleFrontier_Lounge2_Text_260BC4, BattleFrontier_Lounge2_Text_260C6D, BattleFrontier_Lounge2_Text_260D3A }, - { BattleFrontier_Lounge2_Text_260E1E, BattleFrontier_Lounge2_Text_260EC7, BattleFrontier_Lounge2_Text_260F74 }, - { BattleFrontier_Lounge2_Text_2614E6, BattleFrontier_Lounge2_Text_261591, BattleFrontier_Lounge2_Text_26166F }, - { BattleFrontier_Lounge2_Text_261282, BattleFrontier_Lounge2_Text_261329, BattleFrontier_Lounge2_Text_261403 }, - { BattleFrontier_Lounge2_Text_261026, BattleFrontier_Lounge2_Text_2610CC, BattleFrontier_Lounge2_Text_261194 }, - { BattleFrontier_Lounge2_Text_26174D, BattleFrontier_Lounge2_Text_2617F9, BattleFrontier_Lounge2_Text_2618C4 }, + [FRONTIER_MANIAC_BATTLE_TOWER_SINGLES] = + { + BattleFrontier_Lounge2_Text_260971, + BattleFrontier_Lounge2_Text_260A1E, + BattleFrontier_Lounge2_Text_260AE7 + }, + [FRONTIER_MANIAC_BATTLE_TOWER_DOUBLES] = + { + BattleFrontier_Lounge2_Text_2619AC, + BattleFrontier_Lounge2_Text_261A91, + BattleFrontier_Lounge2_Text_261B0C + }, + [FRONTIER_MANIAC_BATTLE_TOWER_MULTIS] = + { + BattleFrontier_Lounge2_Text_261B95, + BattleFrontier_Lounge2_Text_261B95, + BattleFrontier_Lounge2_Text_261B95 + }, + [FRONTIER_MANIAC_BATTLE_TOWER_LINK_MULTIS] = + { + BattleFrontier_Lounge2_Text_261C1A, + BattleFrontier_Lounge2_Text_261C1A, + BattleFrontier_Lounge2_Text_261C1A + }, + [FRONTIER_MANIAC_BATTLE_DOME] = + { + BattleFrontier_Lounge2_Text_260BC4, + BattleFrontier_Lounge2_Text_260C6D, + BattleFrontier_Lounge2_Text_260D3A + }, + [FRONTIER_MANIAC_BATTLE_FACTORY] = + { + BattleFrontier_Lounge2_Text_260E1E, + BattleFrontier_Lounge2_Text_260EC7, + BattleFrontier_Lounge2_Text_260F74 + }, + [FRONTIER_MANIAC_BATTLE_PALACE] = + { + BattleFrontier_Lounge2_Text_2614E6, + BattleFrontier_Lounge2_Text_261591, + BattleFrontier_Lounge2_Text_26166F + }, + [FRONTIER_MANIAC_BATTLE_ARENA] = + { + BattleFrontier_Lounge2_Text_261282, + BattleFrontier_Lounge2_Text_261329, + BattleFrontier_Lounge2_Text_261403 + }, + [FRONTIER_MANIAC_BATTLE_PIKE] = + { + BattleFrontier_Lounge2_Text_261026, + BattleFrontier_Lounge2_Text_2610CC, + BattleFrontier_Lounge2_Text_261194 + }, + [FRONTIER_MANIAC_BATTLE_PYRAMID] = + { + BattleFrontier_Lounge2_Text_26174D, + BattleFrontier_Lounge2_Text_2617F9, + BattleFrontier_Lounge2_Text_2618C4 + }, }; - static const u8 gUnknown_085B2CC8[][2] = + static const u8 sFrontierManiacStreakThresholds[][FRONTIER_MANIAC_MESSAGE_COUNT - 1] = { - { 0x15, 0x38 }, - { 0x15, 0x23 }, - { 0xff, 0xff }, - { 0xff, 0xff }, - { 0x02, 0x04 }, - { 0x07, 0x15 }, - { 0x07, 0x15 }, - { 0x0e, 0x1c }, - { 0x0d, 0x70 }, - { 0x07, 0x38 } + [FRONTIER_MANIAC_BATTLE_TOWER_SINGLES] = { 21, 56 }, + [FRONTIER_MANIAC_BATTLE_TOWER_DOUBLES] = { 21, 35 }, + [FRONTIER_MANIAC_BATTLE_TOWER_MULTIS] = { 255, 255 }, + [FRONTIER_MANIAC_BATTLE_TOWER_LINK_MULTIS] = { 255, 255 }, + [FRONTIER_MANIAC_BATTLE_DOME] = { 2, 4 }, + [FRONTIER_MANIAC_BATTLE_FACTORY] = { 7, 21 }, + [FRONTIER_MANIAC_BATTLE_PALACE] = { 7, 21 }, + [FRONTIER_MANIAC_BATTLE_ARENA] = { 14, 28 }, + [FRONTIER_MANIAC_BATTLE_PIKE] = { 13, 112 }, //BUG: 112 (0x70) is probably a mistake; the Pike Queen is battled twice well before that + [FRONTIER_MANIAC_BATTLE_PYRAMID] = { 7, 56 } }; u8 i; u16 winStreak = 0; - u16 var = VarGet(VAR_FRONTIER_MANIAC_FACILITY); + u16 facility = VarGet(VAR_FRONTIER_MANIAC_FACILITY); - switch (var) + switch (facility) { - case 0 ... 3: - if (gSaveBlock2Ptr->frontier.towerWinStreaks[var][FRONTIER_LVL_50] - >= gSaveBlock2Ptr->frontier.towerWinStreaks[var][FRONTIER_LVL_OPEN]) + case FRONTIER_MANIAC_BATTLE_TOWER_SINGLES: + case FRONTIER_MANIAC_BATTLE_TOWER_DOUBLES: + case FRONTIER_MANIAC_BATTLE_TOWER_MULTIS: + case FRONTIER_MANIAC_BATTLE_TOWER_LINK_MULTIS: + if (gSaveBlock2Ptr->frontier.towerWinStreaks[facility][FRONTIER_LVL_50] + >= gSaveBlock2Ptr->frontier.towerWinStreaks[facility][FRONTIER_LVL_OPEN]) { - winStreak = gSaveBlock2Ptr->frontier.towerWinStreaks[var][FRONTIER_LVL_50]; + winStreak = gSaveBlock2Ptr->frontier.towerWinStreaks[facility][FRONTIER_LVL_50]; } else { - winStreak = gSaveBlock2Ptr->frontier.towerWinStreaks[var][FRONTIER_LVL_OPEN]; + winStreak = gSaveBlock2Ptr->frontier.towerWinStreaks[facility][FRONTIER_LVL_OPEN]; } break; - case 4: + case FRONTIER_MANIAC_BATTLE_DOME: if (gSaveBlock2Ptr->frontier.domeWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_50] >= gSaveBlock2Ptr->frontier.domeWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_OPEN]) { @@ -2112,7 +2165,7 @@ void sub_8139F20(void) winStreak = gSaveBlock2Ptr->frontier.domeWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_OPEN]; } break; - case 5: + case FRONTIER_MANIAC_BATTLE_FACTORY: if (gSaveBlock2Ptr->frontier.factoryWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_50] >= gSaveBlock2Ptr->frontier.factoryWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_OPEN]) { @@ -2123,7 +2176,7 @@ void sub_8139F20(void) winStreak = gSaveBlock2Ptr->frontier.factoryWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_OPEN]; } break; - case 6: + case FRONTIER_MANIAC_BATTLE_PALACE: if (gSaveBlock2Ptr->frontier.palaceWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_50] >= gSaveBlock2Ptr->frontier.palaceWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_OPEN]) { @@ -2134,7 +2187,7 @@ void sub_8139F20(void) winStreak = gSaveBlock2Ptr->frontier.palaceWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_OPEN]; } break; - case 7: + case FRONTIER_MANIAC_BATTLE_ARENA: if (gSaveBlock2Ptr->frontier.arenaWinStreaks[FRONTIER_LVL_50] >= gSaveBlock2Ptr->frontier.arenaWinStreaks[FRONTIER_LVL_OPEN]) { @@ -2145,7 +2198,7 @@ void sub_8139F20(void) winStreak = gSaveBlock2Ptr->frontier.arenaWinStreaks[FRONTIER_LVL_OPEN]; } break; - case 8: + case FRONTIER_MANIAC_BATTLE_PIKE: if (gSaveBlock2Ptr->frontier.pikeWinStreaks[FRONTIER_LVL_50] >= gSaveBlock2Ptr->frontier.pikeWinStreaks[FRONTIER_LVL_OPEN]) { @@ -2156,7 +2209,7 @@ void sub_8139F20(void) winStreak = gSaveBlock2Ptr->frontier.pikeWinStreaks[FRONTIER_LVL_OPEN]; } break; - case 9: + case FRONTIER_MANIAC_BATTLE_PYRAMID: if (gSaveBlock2Ptr->frontier.pyramidWinStreaks[FRONTIER_LVL_50] >= gSaveBlock2Ptr->frontier.pyramidWinStreaks[FRONTIER_LVL_OPEN]) { @@ -2169,16 +2222,16 @@ void sub_8139F20(void) break; } - for (i = 0; i < 2 && gUnknown_085B2CC8[var][i] < winStreak; i++); + for (i = 0; i < FRONTIER_MANIAC_MESSAGE_COUNT - 1 && sFrontierManiacStreakThresholds[facility][i] < winStreak; i++); - ShowFieldMessage(gUnknown_085B2C50[var][i]); + ShowFieldMessage(sFrontierManiacMessages[facility][i]); } // gSpecialVar_0x8005 and 0x8006 here are used by ShakeScreenInElevator void sub_813A080(void) { - static const u16 gUnknown_085B2CDC[] = { - 0x0007, 0x000e, 0x0015, 0x001c, 0x0023, 0x0031, 0x003f, 0x004d, 0x005b, 0x0000 + static const u16 sBattleTowerStreakThresholds[] = { + 7, 14, 21, 28, 35, 49, 63, 77, 91, 0 }; u8 i; @@ -2192,9 +2245,9 @@ void sub_813A080(void) return; } - for (i = 0; i < ARRAY_COUNT(gUnknown_085B2CDC) - 1; i++) + for (i = 0; i < ARRAY_COUNT(sBattleTowerStreakThresholds) - 1; i++) { - if (gUnknown_085B2CDC[i] > gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode]) + if (sBattleTowerStreakThresholds[i] > gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode]) { gSpecialVar_0x8005 = 4; gSpecialVar_0x8006 = i + 5; @@ -2521,10 +2574,10 @@ static void sub_813A2DC(u8 taskId) ScriptContext2_Enable(); gUnknown_0203AB68 = 0; gScrollableMultichoiceSprite = MAX_SPRITES; - sub_813AA60(task->data[11], 0); + FillFrontierExchangeCornerWindow(task->data[11], 0); ShowBattleFrontierTutorWindow(task->data[11], 0); gUnknown_0203AB64 = AllocZeroed(task->data[1] * 8); - gUnknown_0203AB6A = 0; + gFrontierExchangeCorner_NeverRead = 0; sub_813A42C(); for (unk1 = 0, i = 0; i < task->data[1]; i++) @@ -2599,10 +2652,10 @@ static void sub_813A46C(s32 itemIndex, bool8 onInit, struct ListMenu *list) ListMenuGetScrollAndRow(task->data[14], &selection, NULL); gUnknown_0203AB68 = selection; ListMenuGetCurrentItemArrayId(task->data[14], &selection); - sub_813AC44(task->data[11], gUnknown_0203AB6A); - sub_813AA60(task->data[11], selection); + HideFrontierExchangeCornerItemIcon(task->data[11], gFrontierExchangeCorner_NeverRead); + FillFrontierExchangeCornerWindow(task->data[11], selection); ShowBattleFrontierTutorMoveDescription(task->data[11], selection); - gUnknown_0203AB6A = selection; + gFrontierExchangeCorner_NeverRead = selection; } } @@ -2646,7 +2699,7 @@ static void sub_813A570(u8 taskId) u16 array; struct Task *task = &gTasks[taskId]; ListMenuGetCurrentItemArrayId(task->data[14], &array); - sub_813AC44(task->data[11], array); + HideFrontierExchangeCornerItemIcon(task->data[11], array); sub_813A738(taskId); DestroyListMenuTask(task->data[14], NULL, NULL); Free(gUnknown_0203AB64); @@ -2769,34 +2822,34 @@ void sub_813A76C(void) } } -void sub_813A7B8(void) +void ShowNatureGirlMessage(void) { - static const u8 *const gUnknown_085B3040[] = { - BattleFrontier_Lounge5_Text_26468D, - BattleFrontier_Lounge5_Text_2646E5, - BattleFrontier_Lounge5_Text_264741, - BattleFrontier_Lounge5_Text_2647A4, - BattleFrontier_Lounge5_Text_2647FC, - BattleFrontier_Lounge5_Text_264858, - BattleFrontier_Lounge5_Text_2648BE, - BattleFrontier_Lounge5_Text_264916, - BattleFrontier_Lounge5_Text_264972, - BattleFrontier_Lounge5_Text_2649D5, - BattleFrontier_Lounge5_Text_264A3F, - BattleFrontier_Lounge5_Text_264A9B, - BattleFrontier_Lounge5_Text_264AF3, - BattleFrontier_Lounge5_Text_264B5D, - BattleFrontier_Lounge5_Text_2648BE, - BattleFrontier_Lounge5_Text_264BC3, - BattleFrontier_Lounge5_Text_264C36, - BattleFrontier_Lounge5_Text_2648BE, - BattleFrontier_Lounge5_Text_264C95, - BattleFrontier_Lounge5_Text_264D01, - BattleFrontier_Lounge5_Text_264D6B, - BattleFrontier_Lounge5_Text_264DD7, - BattleFrontier_Lounge5_Text_264E33, - BattleFrontier_Lounge5_Text_264E8F, - BattleFrontier_Lounge5_Text_2648BE, + static const u8 *const sNatureGirlMessages[] = { + [NATURE_HARDY] = BattleFrontier_Lounge5_Text_26468D, + [NATURE_LONELY] = BattleFrontier_Lounge5_Text_2646E5, + [NATURE_BRAVE] = BattleFrontier_Lounge5_Text_264741, + [NATURE_ADAMANT] = BattleFrontier_Lounge5_Text_2647A4, + [NATURE_NAUGHTY] = BattleFrontier_Lounge5_Text_2647FC, + [NATURE_BOLD] = BattleFrontier_Lounge5_Text_264858, + [NATURE_DOCILE] = BattleFrontier_Lounge5_Text_2648BE, + [NATURE_RELAXED] = BattleFrontier_Lounge5_Text_264916, + [NATURE_IMPISH] = BattleFrontier_Lounge5_Text_264972, + [NATURE_LAX] = BattleFrontier_Lounge5_Text_2649D5, + [NATURE_TIMID] = BattleFrontier_Lounge5_Text_264A3F, + [NATURE_HASTY] = BattleFrontier_Lounge5_Text_264A9B, + [NATURE_SERIOUS] = BattleFrontier_Lounge5_Text_264AF3, + [NATURE_JOLLY] = BattleFrontier_Lounge5_Text_264B5D, + [NATURE_NAIVE] = BattleFrontier_Lounge5_Text_2648BE, + [NATURE_MODEST] = BattleFrontier_Lounge5_Text_264BC3, + [NATURE_MILD] = BattleFrontier_Lounge5_Text_264C36, + [NATURE_QUIET] = BattleFrontier_Lounge5_Text_2648BE, + [NATURE_BASHFUL] = BattleFrontier_Lounge5_Text_264C95, + [NATURE_RASH] = BattleFrontier_Lounge5_Text_264D01, + [NATURE_CALM] = BattleFrontier_Lounge5_Text_264D6B, + [NATURE_GENTLE] = BattleFrontier_Lounge5_Text_264DD7, + [NATURE_SASSY] = BattleFrontier_Lounge5_Text_264E33, + [NATURE_CAREFUL] = BattleFrontier_Lounge5_Text_264E8F, + [NATURE_QUIRKY] = BattleFrontier_Lounge5_Text_2648BE, }; u8 nature; @@ -2807,19 +2860,19 @@ void sub_813A7B8(void) } nature = GetNature(&gPlayerParty[gSpecialVar_0x8004]); - ShowFieldMessage(gUnknown_085B3040[nature]); + ShowFieldMessage(sNatureGirlMessages[nature]); } -void UpdateFrontierGambler(u16 a0) +void UpdateFrontierGambler(u16 daysSince) { - u16 *var = GetVarPointer(VAR_FRONTIER_GAMBLER_FACILITY); - *var += a0; - *var %= 12; + u16 *var = GetVarPointer(VAR_FRONTIER_GAMBLER_CHALLENGE); + *var += daysSince; + *var %= FRONTIER_GAMBLER_CHALLENGE_COUNT; } -void sub_813A820(void) +void ShowFrontierGamblerLookingMessage(void) { - static const u8 *const gUnknown_085B30A4[] = + static const u8 *const sFrontierGamblerLookingMessages[] = { BattleFrontier_Lounge3_Text_262261, BattleFrontier_Lounge3_Text_26230D, @@ -2835,14 +2888,14 @@ void sub_813A820(void) BattleFrontier_Lounge3_Text_2629BC, }; - u16 var = VarGet(VAR_FRONTIER_GAMBLER_FACILITY); - ShowFieldMessage(gUnknown_085B30A4[var]); - VarSet(VAR_FRONTIER_GAMBLER_SET_FACILITY_F, var); + u16 challenge = VarGet(VAR_FRONTIER_GAMBLER_CHALLENGE); + ShowFieldMessage(sFrontierGamblerLookingMessages[challenge]); + VarSet(VAR_FRONTIER_GAMBLER_SET_CHALLENGE, challenge); } -void sub_813A854(void) +void ShowFrontierGamblerGoMessage(void) { - static const u8 *const gUnknown_085B30D4[] = + static const u8 *const sFrontierGamblerGoMessages[] = { BattleFrontier_Lounge3_Text_262C04, BattleFrontier_Lounge3_Text_262C90, @@ -2858,10 +2911,10 @@ void sub_813A854(void) BattleFrontier_Lounge3_Text_263211, }; - ShowFieldMessage(gUnknown_085B30D4[VarGet(VAR_FRONTIER_GAMBLER_SET_FACILITY_F)]); + ShowFieldMessage(sFrontierGamblerGoMessages[VarGet(VAR_FRONTIER_GAMBLER_SET_CHALLENGE)]); } -void sub_813A878(u8 a0) +void FrontierGamblerSetWonOrLost(bool8 won) { static const u16 sFrontierChallenges[] = { @@ -2880,37 +2933,37 @@ void sub_813A878(u8 a0) }; u16 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE); - u16 challenge = VarGet(VAR_FRONTIER_GAMBLER_SET_FACILITY_F); + u16 challenge = VarGet(VAR_FRONTIER_GAMBLER_SET_CHALLENGE); u16 frontierFacilityId = VarGet(VAR_FRONTIER_FACILITY); - if (VarGet(VAR_FRONTIER_GAMBLER_PLACED_BET_F) == 1) + if (VarGet(VAR_FRONTIER_GAMBLER_STATE) == FRONTIER_GAMBLER_PLACED_BET) { if (sFrontierChallenges[challenge] == FRONTIER_CHALLENGE(frontierFacilityId, battleMode)) { - if (a0 != 0) + if (won != FALSE) { - VarSet(VAR_FRONTIER_GAMBLER_PLACED_BET_F, 2); + VarSet(VAR_FRONTIER_GAMBLER_STATE, FRONTIER_GAMBLER_WON); } else { - VarSet(VAR_FRONTIER_GAMBLER_PLACED_BET_F, 3); + VarSet(VAR_FRONTIER_GAMBLER_STATE, FRONTIER_GAMBLER_LOST); } } } } -void sub_813A8FC(void) +void UpdateBattlePointsWindow(void) { u8 string[32]; u32 x; StringCopy(ConvertIntToDecimalStringN(string, gSaveBlock2Ptr->frontier.battlePoints, STR_CONV_MODE_RIGHT_ALIGN, 4), gText_BP); x = GetStringRightAlignXOffset(1, string, 48); - AddTextPrinterParameterized(gUnknown_0203AB6D, 1, string, x, 1, 0, NULL); + AddTextPrinterParameterized(gBattlePointsWindowId, 1, string, x, 1, 0, NULL); } -void sub_813A958(void) +void ShowBattlePointsWindow(void) { - static const struct WindowTemplate gUnknown_085B311C = { + static const struct WindowTemplate sBattlePoints_WindowTemplate = { .bg = 0, .tilemapLeft = 1, .tilemapTop = 1, @@ -2920,16 +2973,16 @@ void sub_813A958(void) .baseBlock = 8, }; - gUnknown_0203AB6D = AddWindow(&gUnknown_085B311C); - SetStandardWindowBorderStyle(gUnknown_0203AB6D, 0); - sub_813A8FC(); - CopyWindowToVram(gUnknown_0203AB6D, 2); + gBattlePointsWindowId = AddWindow(&sBattlePoints_WindowTemplate); + SetStandardWindowBorderStyle(gBattlePointsWindowId, 0); + UpdateBattlePointsWindow(); + CopyWindowToVram(gBattlePointsWindowId, 2); } -void sub_813A988(void) +void CloseBattlePointsWindow(void) { - ClearStdWindowAndFrameToTransparent(gUnknown_0203AB6D, TRUE); - RemoveWindow(gUnknown_0203AB6D); + ClearStdWindowAndFrameToTransparent(gBattlePointsWindowId, TRUE); + RemoveWindow(gBattlePointsWindowId); } void TakeFrontierBattlePoints(void) @@ -2961,9 +3014,9 @@ u16 GetFrontierBattlePoints(void) return gSaveBlock2Ptr->frontier.battlePoints; } -void sub_813AA18(void) +void ShowFrontierExchangeCornerItemIconWindow(void) { - static const struct WindowTemplate gUnknown_085B3124 = { + static const struct WindowTemplate sFrontierExchangeCornerItemIcon_WindowTemplate = { .bg = 0, .tilemapLeft = 2, .tilemapTop = 9, @@ -2973,18 +3026,18 @@ void sub_813AA18(void) .baseBlock = 20, }; - gUnknown_0203AB6E = AddWindow(&gUnknown_085B3124); - SetStandardWindowBorderStyle(gUnknown_0203AB6E, 0); - CopyWindowToVram(gUnknown_0203AB6E, 2); + gFrontierExchangeCornerItemIconWindowId = AddWindow(&sFrontierExchangeCornerItemIcon_WindowTemplate); + SetStandardWindowBorderStyle(gFrontierExchangeCornerItemIconWindowId, 0); + CopyWindowToVram(gFrontierExchangeCornerItemIconWindowId, 2); } -void sub_813AA44(void) +void CloseFrontierExchangeCornerItemIconWindow(void) { - ClearStdWindowAndFrameToTransparent(gUnknown_0203AB6E, TRUE); - RemoveWindow(gUnknown_0203AB6E); + ClearStdWindowAndFrameToTransparent(gFrontierExchangeCornerItemIconWindowId, TRUE); + RemoveWindow(gFrontierExchangeCornerItemIconWindowId); } -static void sub_813AA60(u16 menu, u16 selection) +static void FillFrontierExchangeCornerWindow(u16 menu, u16 selection) { #include "data/battle_frontier/battle_frontier_exchange_corner.h" @@ -2994,44 +3047,44 @@ static void sub_813AA60(u16 menu, u16 selection) switch (menu) { case SCROLL_MULTI_BF_EXCHANGE_CORNER_DECOR_VENDOR_1: - AddTextPrinterParameterized2(0, 1, sBFExchangeCorner_Decor1Descriptions[selection], 0, NULL, 2, 1, 3); - if (sBFExchangeCorner_Decor1[selection] == 0xFFFF) + AddTextPrinterParameterized2(0, 1, sFrontierExchangeCorner_Decor1Descriptions[selection], 0, NULL, 2, 1, 3); + if (sFrontierExchangeCorner_Decor1[selection] == 0xFFFF) { - ScrollMulti_ShowItemIcon(sBFExchangeCorner_Decor1[selection]); + ShowFrontierExchangeCornerItemIcon(sFrontierExchangeCorner_Decor1[selection]); } else { FreeSpriteTilesByTag(5500); FreeSpritePaletteByTag(5500); - gScrollableMultichoiceSprite = AddDecorationIconObject(sBFExchangeCorner_Decor1[selection], 33, 88, 0, 5500, 5500); + gScrollableMultichoiceSprite = AddDecorationIconObject(sFrontierExchangeCorner_Decor1[selection], 33, 88, 0, 5500, 5500); } break; case SCROLL_MULTI_BF_EXCHANGE_CORNER_DECOR_VENDOR_2: - AddTextPrinterParameterized2(0, 1, sBFExchangeCorner_Decor2Descriptions[selection], 0, NULL, 2, 1, 3); - if (sBFExchangeCorner_Decor2[selection] == 0xFFFF) + AddTextPrinterParameterized2(0, 1, sFrontierExchangeCorner_Decor2Descriptions[selection], 0, NULL, 2, 1, 3); + if (sFrontierExchangeCorner_Decor2[selection] == 0xFFFF) { - ScrollMulti_ShowItemIcon(sBFExchangeCorner_Decor2[selection]); + ShowFrontierExchangeCornerItemIcon(sFrontierExchangeCorner_Decor2[selection]); } else { FreeSpriteTilesByTag(5500); FreeSpritePaletteByTag(5500); - gScrollableMultichoiceSprite = AddDecorationIconObject(sBFExchangeCorner_Decor2[selection], 33, 88, 0, 5500, 5500); + gScrollableMultichoiceSprite = AddDecorationIconObject(sFrontierExchangeCorner_Decor2[selection], 33, 88, 0, 5500, 5500); } break; case SCROLL_MULTI_BF_EXCHANGE_CORNER_VITAMIN_VENDOR: - AddTextPrinterParameterized2(0, 1, sBFExchangeCorner_VitaminsDescriptions[selection], 0, NULL, 2, 1, 3); - ScrollMulti_ShowItemIcon(sBFExchangeCorner_Vitamins[selection]); + AddTextPrinterParameterized2(0, 1, sFrontierExchangeCorner_VitaminsDescriptions[selection], 0, NULL, 2, 1, 3); + ShowFrontierExchangeCornerItemIcon(sFrontierExchangeCorner_Vitamins[selection]); break; case SCROLL_MULTI_BF_EXCHANGE_CORNER_HOLD_ITEM_VENDOR: - AddTextPrinterParameterized2(0, 1, sBFExchangeCorner_HoldItemsDescriptions[selection], 0, NULL, 2, 1, 3); - ScrollMulti_ShowItemIcon(sBFExchangeCorner_HoldItems[selection]); + AddTextPrinterParameterized2(0, 1, sFrontierExchangeCorner_HoldItemsDescriptions[selection], 0, NULL, 2, 1, 3); + ShowFrontierExchangeCornerItemIcon(sFrontierExchangeCorner_HoldItems[selection]); break; } } } -static void ScrollMulti_ShowItemIcon(u16 item) +static void ShowFrontierExchangeCornerItemIcon(u16 item) { FreeSpriteTilesByTag(5500); FreeSpritePaletteByTag(5500); @@ -3045,8 +3098,7 @@ static void ScrollMulti_ShowItemIcon(u16 item) } } -// selection is unused -static void sub_813AC44(u16 menu, u16 selection) +static void HideFrontierExchangeCornerItemIcon(u16 menu, u16 unused) { if (gScrollableMultichoiceSprite != MAX_SPRITES) { @@ -3120,8 +3172,8 @@ static void ShowBattleFrontierTutorWindow(u8 menu, u16 selection) { if (gSpecialVar_0x8006 == 0) { - gUnknown_0203AB5E = AddWindow(&sBattleFrontierTutor_WindowTemplate); - SetStandardWindowBorderStyle(gUnknown_0203AB5E, 0); + gTutorMoveAndElevatorWindowId = AddWindow(&sBattleFrontierTutor_WindowTemplate); + SetStandardWindowBorderStyle(gTutorMoveAndElevatorWindowId, 0); } ShowBattleFrontierTutorMoveDescription(menu, selection); } @@ -3161,22 +3213,22 @@ static void ShowBattleFrontierTutorMoveDescription(u8 menu, u16 selection) if (menu == SCROLL_MULTI_BF_MOVE_TUTOR_1 || menu == SCROLL_MULTI_BF_MOVE_TUTOR_2) { - FillWindowPixelRect(gUnknown_0203AB5E, PIXEL_FILL(1), 0, 0, 96, 48); + FillWindowPixelRect(gTutorMoveAndElevatorWindowId, PIXEL_FILL(1), 0, 0, 96, 48); if (menu == SCROLL_MULTI_BF_MOVE_TUTOR_2) { - AddTextPrinterParameterized(gUnknown_0203AB5E, 1, sBattleFrontier_TutorMoveDescriptions2[selection], 0, 1, 0, NULL); + AddTextPrinterParameterized(gTutorMoveAndElevatorWindowId, 1, sBattleFrontier_TutorMoveDescriptions2[selection], 0, 1, 0, NULL); } else { - AddTextPrinterParameterized(gUnknown_0203AB5E, 1, sBattleFrontier_TutorMoveDescriptions1[selection], 0, 1, 0, NULL); + AddTextPrinterParameterized(gTutorMoveAndElevatorWindowId, 1, sBattleFrontier_TutorMoveDescriptions1[selection], 0, 1, 0, NULL); } } } void sub_813ADB8(void) { - ClearStdWindowAndFrameToTransparent(gUnknown_0203AB5E, TRUE); - RemoveWindow(gUnknown_0203AB5E); + ClearStdWindowAndFrameToTransparent(gTutorMoveAndElevatorWindowId, TRUE); + RemoveWindow(gTutorMoveAndElevatorWindowId); } void sub_813ADD4(void) diff --git a/src/frontier_util.c b/src/frontier_util.c index 536e23e30..88e466e8c 100644 --- a/src/frontier_util.c +++ b/src/frontier_util.c @@ -794,15 +794,15 @@ static void sub_81A17A0(void) case 0: break; case 1: - sub_813A878(0); + FrontierGamblerSetWonOrLost(FALSE); VarSet(VAR_TEMP_0, gSaveBlock2Ptr->frontier.field_CA8); break; case 4: - sub_813A878(0); + FrontierGamblerSetWonOrLost(FALSE); VarSet(VAR_TEMP_0, gSaveBlock2Ptr->frontier.field_CA8); break; case 3: - sub_813A878(1); + FrontierGamblerSetWonOrLost(TRUE); VarSet(VAR_TEMP_0, gSaveBlock2Ptr->frontier.field_CA8); break; case 2: