diff --git a/include/gym_leader_rematch.h b/include/gym_leader_rematch.h index ac365a41a..81ce3da23 100644 --- a/include/gym_leader_rematch.h +++ b/include/gym_leader_rematch.h @@ -66,7 +66,7 @@ enum { REMATCH_TRENT, REMATCH_SAWYER, REMATCH_KIRA_AND_DAN, - REMATCH_WALLY_3, // Entries above WALLY are considered normal NPCs + REMATCH_WALLY_3, // Entries above WALLY are considered normal NPCs, from Wally below are special trainers REMATCH_ROXANNE, REMATCH_BRAWLY, REMATCH_WATTSON, @@ -83,8 +83,8 @@ enum { REMATCH_TABLE_ENTRIES // The total number of rematch entries. Must be last in enum }; -#define REMATCH_NORMAL_NPC_END REMATCH_WALLY_3 -#define REMATCH_ELITE_FOUR_ENTRIES REMATCH_SIDNEY +#define REMATCH_SPECIAL_TRAINER_START REMATCH_WALLY_3 +#define REMATCH_ELITE_FOUR_ENTRIES REMATCH_SIDNEY void UpdateGymLeaderRematch(void); diff --git a/include/match_call.h b/include/match_call.h index 52eab63ec..8214e03b7 100644 --- a/include/match_call.h +++ b/include/match_call.h @@ -15,7 +15,7 @@ void InitMatchCallCounters(void); bool32 TryStartMatchCall(void); bool32 IsMatchCallTaskActive(void); void StartMatchCallFromScript(u8 *message); -void sub_8197080(u8 *destStr); +void BufferPokedexRatingForMatchCall(u8 *destStr); bool32 SelectMatchCallMessage(int, u8 *); void sub_8197184(u32 windowId, u32 destOffset, u32 paletteId); void sub_81971C4(u32 windowId, u32 tileOffset, u32 paletteId); diff --git a/include/pokenav.h b/include/pokenav.h index c497c4b85..e2c2a4d08 100644 --- a/include/pokenav.h +++ b/include/pokenav.h @@ -32,9 +32,9 @@ struct PokenavSub18 enum { - POKENAV_MODE_NORMAL, // Chosen from Start menu. - POKENAV_MODE_FORCE_CALL_READY, // When player is forced to call Mr. Stone for pokenav tutorial - POKENAV_MODE_FORCE_CALL_EXIT, // Forced to exit fter being calling Mr. Stone for pokenav tutorial + POKENAV_MODE_NORMAL, // Chosen from Start menu. + POKENAV_MODE_FORCE_CALL_READY, // Pokenav tutorial before calling Mr. Stone + POKENAV_MODE_FORCE_CALL_EXIT, // Pokenav tutorial after calling Mr. Stone }; #define POKENAV_MENU_IDS_START 100000 @@ -57,6 +57,23 @@ enum POKENAV_MENU_E, }; +enum +{ + HELPBAR_NONE, + HELPBAR_MAP_ZOOMED_OUT, + HELPBAR_MAP_ZOOMED_IN, + HELPBAR_CONDITION_MON_LIST, + HELPBAR_CONDITION_MON_STATUS, + HELPBAR_CONDITION_MARKINGS, + HELPBAR_MC_TRAINER_LIST, + HELPBAR_MC_CALL_MENU, + HELPBAR_MC_CHECK_PAGE, + HELPBAR_RIBBONS_MON_LIST, + HELPBAR_RIBBONS_LIST, + HELPBAR_RIBBONS_CHECK, + HELPBAR_COUNT +}; + enum { MC_HEADER_MR_STONE, @@ -105,22 +122,25 @@ enum [CHECK_PAGE_INTRO_1] = gText_MatchCall##name##_Intro1, \ [CHECK_PAGE_INTRO_2] = gText_MatchCall##name##_Intro2} -#define POKENAV_MC_FUNC_NONE 0 -#define POKENAV_MC_FUNC_DOWN 1 -#define POKENAV_MC_FUNC_UP 2 -#define POKENAV_MC_FUNC_PG_DOWN 3 -#define POKENAV_MC_FUNC_PG_UP 4 -#define POKENAV_MC_FUNC_SELECT 5 -#define POKENAV_MC_FUNC_6 6 -#define POKENAV_MC_FUNC_7 7 -#define POKENAV_MC_FUNC_CALL_MSG 8 -#define POKENAV_MC_FUNC_NEARBY_MSG 9 -#define POKENAV_MC_FUNC_10 10 -#define POKENAV_MC_FUNC_11 11 -#define POKENAV_MC_FUNC_12 12 -#define POKENAV_MC_FUNC_13 13 -#define POKENAV_MC_FUNC_14 14 -#define POKENAV_MC_FUNC_EXIT 15 +enum +{ + POKENAV_MC_FUNC_NONE, + POKENAV_MC_FUNC_DOWN, + POKENAV_MC_FUNC_UP, + POKENAV_MC_FUNC_PG_DOWN, + POKENAV_MC_FUNC_PG_UP, + POKENAV_MC_FUNC_SELECT, + POKENAV_MC_FUNC_MOVE_OPTIONS_CURSOR, + POKENAV_MC_FUNC_CANCEL, + POKENAV_MC_FUNC_CALL_MSG, + POKENAV_MC_FUNC_NEARBY_MSG, + POKENAV_MC_FUNC_10, + POKENAV_MC_FUNC_SHOW_CHECK_PAGE, + POKENAV_MC_FUNC_CHECK_PAGE_UP, + POKENAV_MC_FUNC_CHECK_PAGE_DOWN, + POKENAV_MC_FUNC_EXIT_CHECK_PAGE, + POKENAV_MC_FUNC_EXIT +}; // pokenav.c void sub_81C7694(u32); @@ -168,7 +188,7 @@ void ToggleMatchCallVerticalArrows(bool32 shouldHide); void sub_81C8838(void); void sub_81C877C(void); bool32 sub_81C8820(void); -void sub_81C87AC(s16 a0); +void PrintCheckPageInfo(s16 a0); u32 GetMatchCallListTopIndex(void); void sub_81C87F0(void); bool32 sub_81C81D4(const struct BgTemplate *arg0, struct MatchCallListTemplate *arg1, s32 arg2); @@ -176,15 +196,15 @@ void sub_81C8234(void); // pokenav_match_call_data.c bool32 MatchCall_HasCheckPage(u32 idx); -u8 MatchCallMapSecGetByIndex(u32 idx); -bool32 sub_81D1BF8(u32 idx); -bool32 MatchCallFlagGetByIndex(u32 idx); +u8 MatchCall_GetMapSec(u32 idx); +bool32 MatchCall_HasRematchId(u32 idx); +bool32 MatchCall_GetEnabled(u32 idx); u32 MatchCall_GetRematchTableIdx(u32 idx); u32 GetTrainerIdxByRematchIdx(u32 rematchIdx); int MatchCall_GetOverrideFacilityClass(u32 idx); void MatchCall_GetMessage(u32 idx, u8 *dest); const u8 *MatchCall_GetOverrideFlavorText(u32 idx, u32 offset); -void sub_81D1A78(u32 idx, const u8 **desc, const u8 **name); +void MatchCall_GetNameAndDesc(u32 idx, const u8 **desc, const u8 **name); // pokenav_main_menu.c bool32 InitPokenavMainMenu(void); @@ -197,8 +217,8 @@ void sub_81C7AC0(s32 a0); bool32 sub_81C8010(void); void InitBgTemplates(const struct BgTemplate *templates, int count); bool32 IsPaletteFadeActive(void); -void sub_81C7BA4(u32 helpBarIndex); -bool32 IsDma3ManagerBusyWithBgCopy_(void); +void PrintHelpBarText(u32 textId); +bool32 WaitForHelpBar(void); void sub_81C78A0(void); bool32 MainMenuLoopedTaskIsBusy(void); void sub_81C7FDC(void); @@ -226,7 +246,7 @@ void sub_81C9430(void); int sub_81C9894(void); int sub_81C98A4(void); int sub_81C98B4(void); -u16 sub_81C98C4(void); +u16 GetHelpBarTextId(void); // pokenav_unk_2.c bool32 sub_81C9924(void); @@ -241,28 +261,28 @@ bool32 PokenavCallback_Init_11(void); u32 sub_81CAB24(void); void sub_81CAB38(void); int sub_81CAE28(void); -int sub_81CAE38(void); +int GetNumberRegistered(void); int sub_81CAE48(void); struct PokenavMonList *sub_81CAE94(void); -u16 sub_81CAEA4(int); -bool32 sub_81CAEBC(int index); +u16 GetMatchCallMapSec(int); +bool32 ShouldDrawRematchPokeballIcon(int index); +void ClearRematchPokeballIcon(u16 windowId, u32 a1); int GetMatchCallTrainerPic(int index); const u8 *GetMatchCallFlavorText(int index, int textType); const u8 *GetMatchCallMessageText(int index, u8 *arg1); -u16 sub_81CB01C(void); -u16 sub_81CB02C(int arg0); -void sub_81CB050(struct PokenavMonList * arg0, u8 *str); +u16 GetMatchCallOptionCursorPos(void); +u16 GetMatchCallOptionId(int arg0); +void BufferMatchCallNameAndDesc(struct PokenavMonList * arg0, u8 *str); u8 sub_81CB0C8(int rematchIndex); -int sub_81CB0E4(int index); +int GetIndexDeltaOfNextCheckPageDown(int index); +int GetIndexDeltaOfNextCheckPageUp(int index); bool32 IsRematchEntryRegistered(int index); -int sub_81CB128(int index); -// POKENAV_MC.c +// pokenav_unk_4.c bool32 sub_81CB260(void); void sub_81CB29C(s32 index); u32 sub_81CB2CC(void); void sub_81CB2E0(void); -void sub_81CBD48(u16 windowId, u32 a1); // pokenav_unk_5.c u32 PokenavCallback_Init_6(void); diff --git a/src/battle_setup.c b/src/battle_setup.c index 817f699f2..3234e8974 100644 --- a/src/battle_setup.c +++ b/src/battle_setup.c @@ -1582,7 +1582,7 @@ static bool32 UpdateRandomTrainerRematches(const struct RematchTrainer *table, u s32 i; bool32 ret = FALSE; - for (i = 0; i <= REMATCH_NORMAL_NPC_END; i++) + for (i = 0; i <= REMATCH_SPECIAL_TRAINER_START; i++) { if (table[i].mapGroup == mapGroup && table[i].mapNum == mapNum && !sub_80B1D94(i)) { @@ -1641,7 +1641,7 @@ static bool8 IsFirstTrainerIdReadyForRematch(const struct RematchTrainer *table, if (tableId == -1) return FALSE; - if (tableId >= 100) + if (tableId >= MAX_REMATCH_ENTRIES) return FALSE; if (gSaveBlock1Ptr->trainerRematches[tableId] == 0) return FALSE; @@ -1655,7 +1655,7 @@ static bool8 IsTrainerReadyForRematch_(const struct RematchTrainer *table, u16 t if (tableId == -1) return FALSE; - if (tableId >= 100) + if (tableId >= MAX_REMATCH_ENTRIES) return FALSE; if (gSaveBlock1Ptr->trainerRematches[tableId] == 0) return FALSE; diff --git a/src/match_call.c b/src/match_call.c index 8458bb31d..dac98e559 100644 --- a/src/match_call.c +++ b/src/match_call.c @@ -1060,7 +1060,7 @@ static bool32 SelectMatchCallTrainer(void) static u32 GetNumRegisteredNPCs(void) { u32 i, count; - for (i = 0, count = 0; i < REMATCH_NORMAL_NPC_END; i++) + for (i = 0, count = 0; i < REMATCH_SPECIAL_TRAINER_START; i++) { if (FlagGet(FLAG_MATCH_CALL_REGISTERED + i)) count++; @@ -1072,7 +1072,7 @@ static u32 GetNumRegisteredNPCs(void) static u32 GetActiveMatchCallTrainerId(u32 activeMatchCallId) { u32 i; - for (i = 0; i < REMATCH_NORMAL_NPC_END; i++) + for (i = 0; i < REMATCH_SPECIAL_TRAINER_START; i++) { if (FlagGet(FLAG_MATCH_CALL_REGISTERED + i)) { @@ -1384,7 +1384,7 @@ static u16 GetRematchTrainerLocation(int matchCallId) static u32 GetNumRematchTrainersFought(void) { u32 i, count; - for (i = 0, count = 0; i < REMATCH_NORMAL_NPC_END; i++) + for (i = 0, count = 0; i < REMATCH_SPECIAL_TRAINER_START; i++) { if (HasTrainerBeenFought(gRematchTable[i].trainerIds[0])) count++; @@ -1961,7 +1961,7 @@ static const u8 *const sBirchDexRatingTexts[] = gBirchDexRatingText_DexCompleted, }; -void sub_8197080(u8 *destStr) +void BufferPokedexRatingForMatchCall(u8 *destStr) { int numSeen, numCaught; u8 *str; diff --git a/src/pokenav_main_menu.c b/src/pokenav_main_menu.c index 4422a70e3..ea15a5198 100644 --- a/src/pokenav_main_menu.c +++ b/src/pokenav_main_menu.c @@ -41,7 +41,7 @@ struct PokenavMainMenuResources u32 (*unk4)(void); u32 unk8; u32 currentTaskId; - u32 unk10; + u32 helpBarWindowId; u32 unk14; struct Sprite *spinningPokenav; struct Sprite *leftHeaderSprites[2]; @@ -68,10 +68,10 @@ static void MoveLeftHeader(struct Sprite *sprite, s32 startX, s32 endX, s32 dura static void SpriteCB_MoveLeftHeader(struct Sprite *sprite); static void InitPokenavMainMenuResources(void); static void InitHoennMapHeaderSprites(void); -static void sub_81C7B74(void); +static void InitHelpBar(void); static u32 LoopedTask_ScrollMenuHeaderDown(s32 a0); static u32 LoopedTask_ScrollMenuHeaderUp(s32 a0); -static void sub_81C7BF8(u32 a0); +static void DrawHelpBar(u32 windowId); static void SpriteCB_SpinningPokenav(struct Sprite* sprite); static u32 LoopedTask_InitPokenavMenu(s32 a0); @@ -92,7 +92,7 @@ const struct BgTemplate gPokenavMainMenuBgTemplates[] = } }; -const struct WindowTemplate gUnknown_0861FA08[2] = +static const struct WindowTemplate sHelpBarWindowTemplate[] = { { .bg = 0, @@ -103,36 +103,28 @@ const struct WindowTemplate gUnknown_0861FA08[2] = .paletteNum = 0, .baseBlock = 0x36, }, - { - .bg = 0xFF, - .tilemapLeft = 0, - .tilemapTop = 0, - .width = 0, - .height = 0, - .paletteNum = 0, - .baseBlock = 0, - }, + DUMMY_WIN_TEMPLATE }; -const u8 *const sHelpBarTexts[12] = +static const u8 *const sHelpBarTexts[HELPBAR_COUNT] = { - gText_Pokenav_ClearButtonList, - gText_PokenavMap_ZoomedOutButtons, - gText_PokenavMap_ZoomedInButtons, - gText_PokenavCondition_MonListButtons, - gText_PokenavCondition_MonStatusButtons, - gText_PokenavCondition_MarkingButtons, - gText_PokenavMatchCall_TrainerListButtons, - gText_PokenavMatchCall_CallMenuButtons, - gText_PokenavMatchCall_CheckTrainerButtons, - gText_PokenavRibbons_MonListButtons, - gText_PokenavRibbons_RibbonListButtons, - gText_PokenavRibbons_RibbonCheckButtons, + [HELPBAR_NONE] = gText_Pokenav_ClearButtonList, + [HELPBAR_MAP_ZOOMED_OUT] = gText_PokenavMap_ZoomedOutButtons, + [HELPBAR_MAP_ZOOMED_IN] = gText_PokenavMap_ZoomedInButtons, + [HELPBAR_CONDITION_MON_LIST] = gText_PokenavCondition_MonListButtons, + [HELPBAR_CONDITION_MON_STATUS] = gText_PokenavCondition_MonStatusButtons, + [HELPBAR_CONDITION_MARKINGS] = gText_PokenavCondition_MarkingButtons, + [HELPBAR_MC_TRAINER_LIST] = gText_PokenavMatchCall_TrainerListButtons, + [HELPBAR_MC_CALL_MENU] = gText_PokenavMatchCall_CallMenuButtons, + [HELPBAR_MC_CHECK_PAGE] = gText_PokenavMatchCall_CheckTrainerButtons, + [HELPBAR_RIBBONS_MON_LIST] = gText_PokenavRibbons_MonListButtons, + [HELPBAR_RIBBONS_LIST] = gText_PokenavRibbons_RibbonListButtons, + [HELPBAR_RIBBONS_CHECK] = gText_PokenavRibbons_RibbonCheckButtons, }; -const u8 gMenuButtonReminderColor[3] = +static const u8 sHelpBarTextColors[3] = { - 4, 1, 2 + TEXT_COLOR_RED, TEXT_COLOR_WHITE, TEXT_COLOR_DARK_GREY }; static const struct CompressedSpriteSheet gSpinningPokenavSpriteSheet[] = @@ -386,7 +378,7 @@ static u32 LoopedTask_InitPokenavMenu(s32 a0) if (free_temp_tile_data_buffers_if_possible()) return LT_PAUSE; - sub_81C7B74(); + InitHelpBar(); return LT_INC_AND_PAUSE; case 3: if (IsDma3ManagerBusyWithBgCopy()) @@ -650,10 +642,10 @@ void sub_81C7AC0(s32 a0) BeginNormalPaletteFade(structPtr->unk14, -2, 16, 0, RGB_BLACK); break; case 2: - BeginNormalPaletteFade(0xFFFFFFFF, -2, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(0xFFFFFFFF, -2, 0, 16, RGB_BLACK); //out break; case 3: - BeginNormalPaletteFade(0xFFFFFFFF, -2, 16, 0, RGB_BLACK); + BeginNormalPaletteFade(0xFFFFFFFF, -2, 16, 0, RGB_BLACK); //in break; } } @@ -676,31 +668,31 @@ void InitBgTemplates(const struct BgTemplate *templates, int count) InitBgFromTemplate(templates++); } -static void sub_81C7B74(void) +static void InitHelpBar(void) { struct PokenavMainMenuResources *structPtr = GetSubstructPtr(0); - InitWindows(&gUnknown_0861FA08[0]); - structPtr->unk10 = 0; - sub_81C7BF8(structPtr->unk10); - PutWindowTilemap(structPtr->unk10); - CopyWindowToVram(structPtr->unk10, 3); // TODO: Use a defined constant here. + InitWindows(&sHelpBarWindowTemplate[0]); + structPtr->helpBarWindowId = 0; + DrawHelpBar(structPtr->helpBarWindowId); + PutWindowTilemap(structPtr->helpBarWindowId); + CopyWindowToVram(structPtr->helpBarWindowId, 3); // TODO: Use a defined constant here. } -void sub_81C7BA4(u32 helpBarIndex) +void PrintHelpBarText(u32 textId) { struct PokenavMainMenuResources *structPtr = GetSubstructPtr(0); - sub_81C7BF8(structPtr->unk10); - AddTextPrinterParameterized3(structPtr->unk10, 1, 0, 1, gMenuButtonReminderColor, 0, sHelpBarTexts[helpBarIndex]); + DrawHelpBar(structPtr->helpBarWindowId); + AddTextPrinterParameterized3(structPtr->helpBarWindowId, 1, 0, 1, sHelpBarTextColors, 0, sHelpBarTexts[textId]); } -bool32 IsDma3ManagerBusyWithBgCopy_(void) +bool32 WaitForHelpBar(void) { return IsDma3ManagerBusyWithBgCopy(); } -static void sub_81C7BF8(u32 windowId) +static void DrawHelpBar(u32 windowId) { FillWindowPixelBuffer(windowId, PIXEL_FILL(4)); FillWindowPixelRect(windowId, PIXEL_FILL(5), 0, 0, 0x80, 1); diff --git a/src/pokenav_match_call_data.c b/src/pokenav_match_call_data.c index 2460a2f37..34cc41bd2 100644 --- a/src/pokenav_match_call_data.c +++ b/src/pokenav_match_call_data.c @@ -11,14 +11,17 @@ #include "constants/region_map_sections.h" #include "constants/trainers.h" + +// NPC below means non-trainer character (no rematch or check page) +// Steven also uses this type but has a check page by using a MatchCallCheckPageOverride enum { - MC_TYPE_0, - MC_TYPE_1, + MC_TYPE_NPC, + MC_TYPE_TRAINER, MC_TYPE_WALLY, MC_TYPE_BIRCH, MC_TYPE_RIVAL, - MC_TYPE_5 + MC_TYPE_LEADER }; // Static type declarations @@ -35,7 +38,7 @@ struct MatchCallStructCommon { u16 flag; }; -struct MatchCallStruct0 { +struct MatchCallStructNPC { u8 type; u8 mapSec; u16 flag; @@ -44,7 +47,8 @@ struct MatchCallStruct0 { const match_call_text_data_t *textData; }; -struct MatchCallStruct1 { +// Shared by MC_TYPE_TRAINER and MC_TYPE_LEADER +struct MatchCallStructTrainer { u8 type; u8 mapSec; u16 flag; @@ -54,7 +58,7 @@ struct MatchCallStruct1 { const match_call_text_data_t *textData; }; -struct MatchCallSubstruct2 { +struct MatchCallLocationOverride { u16 flag; u8 mapSec; }; @@ -66,7 +70,7 @@ struct MatchCallWally { u16 rematchTableIdx; const u8 *desc; const match_call_text_data_t *textData; - const struct MatchCallSubstruct2 *locationData; + const struct MatchCallLocationOverride *locationData; }; struct MatchCallBirch { @@ -86,28 +90,17 @@ struct MatchCallRival { const match_call_text_data_t *textData; }; -// Note: Type1 and Type5 have identical struct layouts. -struct MatchCallStruct5 { - u8 type; - u8 mapSec; - u16 flag; - u16 rematchTableIdx; - const u8 *desc; - const u8 *name; - const match_call_text_data_t *textData; -}; - typedef union { const struct MatchCallStructCommon *common; - const struct MatchCallStruct0 *type0; - const struct MatchCallStruct1 *type1; + const struct MatchCallStructNPC *npc; + const struct MatchCallStructTrainer *trainer; const struct MatchCallWally *wally; const struct MatchCallBirch *birch; const struct MatchCallRival *rival; - const struct MatchCallStruct5 *type5; + const struct MatchCallStructTrainer *leader; } match_call_t; -struct MatchCallOverride { +struct MatchCallCheckPageOverride { u16 idx; u16 facilityClass; u32 flag; @@ -118,50 +111,50 @@ struct MatchCallOverride { // Static ROM declarations -static bool32 MatchCallGetFlag_Type0(match_call_t); -static bool32 MatchCallGetFlag_Type1(match_call_t); -static bool32 MatchCallGetFlag_Wally(match_call_t); -static bool32 MatchCallGetFlag_Birch(match_call_t); -static bool32 MatchCallGetFlag_Rival(match_call_t); +static bool32 MatchCall_GetEnabled_NPC(match_call_t); +static bool32 MatchCall_GetEnabled_Trainer(match_call_t); +static bool32 MatchCall_GetEnabled_Wally(match_call_t); +static bool32 MatchCall_GetEnabled_Birch(match_call_t); +static bool32 MatchCall_GetEnabled_Rival(match_call_t); -static u8 MatchCallGetMapSec_Type0(match_call_t); -static u8 MatchCallGetMapSec_Type1(match_call_t); -static u8 MatchCallGetMapSec_Wally(match_call_t); -static u8 MatchCallGetMapSec_Birch(match_call_t); -static u8 MatchCallGetMapSec_Rival(match_call_t); +static u8 MatchCall_GetMapSec_NPC(match_call_t); +static u8 MatchCall_GetMapSec_Trainer(match_call_t); +static u8 MatchCall_GetMapSec_Wally(match_call_t); +static u8 MatchCall_GetMapSec_Birch(match_call_t); +static u8 MatchCall_GetMapSec_Rival(match_call_t); -static bool32 MatchCall_IsRematchable_Type0(match_call_t); -static bool32 MatchCall_IsRematchable_Type1(match_call_t); +static bool32 MatchCall_IsRematchable_NPC(match_call_t); +static bool32 MatchCall_IsRematchable_Trainer(match_call_t); static bool32 MatchCall_IsRematchable_Wally(match_call_t); static bool32 MatchCall_IsRematchable_Birch(match_call_t); static bool32 MatchCall_IsRematchable_Rival(match_call_t); -static bool32 MatchCall_HasCheckPage_Type0(match_call_t); -static bool32 MatchCall_HasCheckPage_Type1(match_call_t); +static bool32 MatchCall_HasCheckPage_NPC(match_call_t); +static bool32 MatchCall_HasCheckPage_Trainer(match_call_t); static bool32 MatchCall_HasCheckPage_Wally(match_call_t); static bool32 MatchCall_HasCheckPage_Birch(match_call_t); static bool32 MatchCall_HasCheckPage_Rival(match_call_t); -static u32 MatchCall_GetRematchTableIdx_Type0(match_call_t); -static u32 MatchCall_GetRematchTableIdx_Type1(match_call_t); +static u32 MatchCall_GetRematchTableIdx_NPC(match_call_t); +static u32 MatchCall_GetRematchTableIdx_Trainer(match_call_t); static u32 MatchCall_GetRematchTableIdx_Wally(match_call_t); static u32 MatchCall_GetRematchTableIdx_Birch(match_call_t); static u32 MatchCall_GetRematchTableIdx_Rival(match_call_t); -static void MatchCall_GetMessage_Type0(match_call_t, u8 *); -static void MatchCall_GetMessage_Type1(match_call_t, u8 *); +static void MatchCall_GetMessage_NPC(match_call_t, u8 *); +static void MatchCall_GetMessage_Trainer(match_call_t, u8 *); static void MatchCall_GetMessage_Wally(match_call_t, u8 *); static void MatchCall_GetMessage_Birch(match_call_t, u8 *); static void MatchCall_GetMessage_Rival(match_call_t, u8 *); -static void MatchCall_GetNameAndDesc_Type0(match_call_t, const u8 **, const u8 **); -static void MatchCall_GetNameAndDesc_Type1(match_call_t, const u8 **, const u8 **); +static void MatchCall_GetNameAndDesc_NPC(match_call_t, const u8 **, const u8 **); +static void MatchCall_GetNameAndDesc_Trainer(match_call_t, const u8 **, const u8 **); static void MatchCall_GetNameAndDesc_Wally(match_call_t, const u8 **, const u8 **); static void MatchCall_GetNameAndDesc_Birch(match_call_t, const u8 **, const u8 **); static void MatchCall_GetNameAndDesc_Rival(match_call_t, const u8 **, const u8 **); static void MatchCall_BufferCallMessageText(const match_call_text_data_t *, u8 *); -static void sub_81D199C(const match_call_text_data_t *, u16, u8 *); +static void MatchCall_BufferCallMessageTextByRematchTeam(const match_call_text_data_t *, u16, u8 *); static void MatchCall_GetNameAndDescByRematchIdx(u32, const u8 **, const u8 **); extern const u8 MatchCall_Text_MrStone1[]; @@ -304,9 +297,9 @@ static const match_call_text_data_t sMrStoneTextScripts[] = { { NULL, 0xFFFF, 0xFFFF } }; -static const struct MatchCallStruct0 sMrStoneMatchCallHeader = +static const struct MatchCallStructNPC sMrStoneMatchCallHeader = { - .type = 0, + .type = MC_TYPE_NPC, .mapSec = MAPSEC_RUSTBORO_CITY, .flag = 0xFFFF, .desc = gText_MrStoneMatchCallDesc, @@ -327,9 +320,9 @@ static const match_call_text_data_t sNormanTextScripts[] = { { NULL, 0xFFFF, 0xFFFF } }; -static const struct MatchCallStruct5 sNormanMatchCallHeader = +static const struct MatchCallStructTrainer sNormanMatchCallHeader = { - .type = 5, + .type = MC_TYPE_LEADER, .mapSec = MAPSEC_PETALBURG_CITY, .flag = FLAG_ENABLE_NORMAN_MATCH_CALL, .rematchTableIdx = REMATCH_NORMAN, @@ -354,9 +347,9 @@ static const match_call_text_data_t sMomTextScripts[] = { { NULL, 0xFFFF, 0xFFFF } }; -static const struct MatchCallStruct0 sMomMatchCallHeader = +static const struct MatchCallStructNPC sMomMatchCallHeader = { - .type = 0, + .type = MC_TYPE_NPC, .mapSec = MAPSEC_LITTLEROOT_TOWN, .flag = FLAG_ENABLE_MOM_MATCH_CALL, .desc = gText_MomMatchCallDesc, @@ -375,9 +368,9 @@ static const match_call_text_data_t sStevenTextScripts[] = { { NULL, 0xFFFF, 0xFFFF }, }; -static const struct MatchCallStruct0 sStevenMatchCallHeader = +static const struct MatchCallStructNPC sStevenMatchCallHeader = { - .type = 0, + .type = MC_TYPE_NPC, .mapSec = MAPSEC_NONE, .flag = FLAG_REGISTERED_STEVEN_POKENAV, .desc = gText_StevenMatchCallDesc, @@ -454,7 +447,7 @@ static const match_call_text_data_t sWallyTextScripts[] = { { NULL, 0xFFFF, 0xFFFF } }; -const struct MatchCallSubstruct2 sWallyLocationData[] = { +const struct MatchCallLocationOverride sWallyLocationData[] = { { FLAG_HIDE_MAUVILLE_CITY_WALLY, MAPSEC_VERDANTURF_TOWN }, { FLAG_GROUDON_AWAKENED_MAGMA_HIDEOUT, MAPSEC_NONE }, { FLAG_HIDE_VICTORY_ROAD_ENTRANCE_WALLY, MAPSEC_VICTORY_ROAD }, @@ -484,7 +477,7 @@ static const match_call_text_data_t sScottTextScripts[] = { }; -static const struct MatchCallStruct0 sScottMatchCallHeader = +static const struct MatchCallStructNPC sScottMatchCallHeader = { .type = 0, .mapSec = MAPSEC_NONE, @@ -502,9 +495,9 @@ static const match_call_text_data_t sRoxanneTextScripts[] = { { NULL, 0xFFFF, 0xFFFF } }; -static const struct MatchCallStruct5 sRoxanneMatchCallHeader = +static const struct MatchCallStructTrainer sRoxanneMatchCallHeader = { - .type = 5, + .type = MC_TYPE_LEADER, .mapSec = MAPSEC_RUSTBORO_CITY, .flag = FLAG_ENABLE_ROXANNE_MATCH_CALL, .rematchTableIdx = REMATCH_ROXANNE, @@ -521,9 +514,9 @@ static const match_call_text_data_t sBrawlyTextScripts[] = { { NULL, 0xFFFF, 0xFFFF } }; -static const struct MatchCallStruct5 sBrawlyMatchCallHeader = +static const struct MatchCallStructTrainer sBrawlyMatchCallHeader = { - .type = 5, + .type = MC_TYPE_LEADER, .mapSec = MAPSEC_DEWFORD_TOWN, .flag = FLAG_ENABLE_BRAWLY_MATCH_CALL, .rematchTableIdx = REMATCH_BRAWLY, @@ -540,9 +533,9 @@ static const match_call_text_data_t sWattsonTextScripts[] = { { NULL, 0xFFFF, 0xFFFF } }; -static const struct MatchCallStruct5 sWattsonMatchCallHeader = +static const struct MatchCallStructTrainer sWattsonMatchCallHeader = { - .type = 5, + .type = MC_TYPE_LEADER, .mapSec = MAPSEC_MAUVILLE_CITY, .flag = FLAG_ENABLE_WATTSON_MATCH_CALL, .rematchTableIdx = REMATCH_WATTSON, @@ -559,9 +552,9 @@ static const match_call_text_data_t sFlanneryTextScripts[] = { { NULL, 0xFFFF, 0xFFFF } }; -static const struct MatchCallStruct5 sFlanneryMatchCallHeader = +static const struct MatchCallStructTrainer sFlanneryMatchCallHeader = { - .type = 5, + .type = MC_TYPE_LEADER, .mapSec = MAPSEC_LAVARIDGE_TOWN, .flag = FLAG_ENABLE_FLANNERY_MATCH_CALL, .rematchTableIdx = REMATCH_FLANNERY, @@ -578,9 +571,9 @@ static const match_call_text_data_t sWinonaTextScripts[] = { { NULL, 0xFFFF, 0xFFFF } }; -static const struct MatchCallStruct5 sWinonaMatchCallHeader = +static const struct MatchCallStructTrainer sWinonaMatchCallHeader = { - .type = 5, + .type = MC_TYPE_LEADER, .mapSec = MAPSEC_FORTREE_CITY, .flag = FLAG_ENABLE_WINONA_MATCH_CALL, .rematchTableIdx = REMATCH_WINONA, @@ -597,9 +590,9 @@ static const match_call_text_data_t sTateLizaTextScripts[] = { { NULL, 0xFFFF, 0xFFFF } }; -static const struct MatchCallStruct5 sTateLizaMatchCallHeader = +static const struct MatchCallStructTrainer sTateLizaMatchCallHeader = { - .type = 5, + .type = MC_TYPE_LEADER, .mapSec = MAPSEC_MOSSDEEP_CITY, .flag = FLAG_ENABLE_TATE_AND_LIZA_MATCH_CALL, .rematchTableIdx = REMATCH_TATE_AND_LIZA, @@ -616,9 +609,9 @@ static const match_call_text_data_t sJuanTextScripts[] = { { NULL, 0xFFFF, 0xFFFF } }; -static const struct MatchCallStruct5 sJuanMatchCallHeader = +static const struct MatchCallStructTrainer sJuanMatchCallHeader = { - .type = 5, + .type = MC_TYPE_LEADER, .mapSec = MAPSEC_SOOTOPOLIS_CITY, .flag = FLAG_ENABLE_JUAN_MATCH_CALL, .rematchTableIdx = REMATCH_JUAN, @@ -632,9 +625,9 @@ static const match_call_text_data_t sSidneyTextScripts[] = { { NULL, 0xFFFF, 0xFFFF } }; -static const struct MatchCallStruct5 sSidneyMatchCallHeader = +static const struct MatchCallStructTrainer sSidneyMatchCallHeader = { - .type = 5, + .type = MC_TYPE_LEADER, .mapSec = MAPSEC_EVER_GRANDE_CITY, .flag = FLAG_REMATCH_SIDNEY, .rematchTableIdx = REMATCH_SIDNEY, @@ -648,9 +641,9 @@ static const match_call_text_data_t sPhoebeTextScripts[] = { { NULL, 0xFFFF, 0xFFFF } }; -static const struct MatchCallStruct5 sPhoebeMatchCallHeader = +static const struct MatchCallStructTrainer sPhoebeMatchCallHeader = { - .type = 5, + .type = MC_TYPE_LEADER, .mapSec = MAPSEC_EVER_GRANDE_CITY, .flag = FLAG_REMATCH_PHOEBE, .rematchTableIdx = REMATCH_PHOEBE, @@ -664,9 +657,9 @@ static const match_call_text_data_t sGlaciaTextScripts[] = { { NULL, 0xFFFF, 0xFFFF } }; -static const struct MatchCallStruct5 sGlaciaMatchCallHeader = +static const struct MatchCallStructTrainer sGlaciaMatchCallHeader = { - .type = 5, + .type = MC_TYPE_LEADER, .mapSec = MAPSEC_EVER_GRANDE_CITY, .flag = FLAG_REMATCH_GLACIA, .rematchTableIdx = REMATCH_GLACIA, @@ -680,9 +673,9 @@ static const match_call_text_data_t sDrakeTextScripts[] = { { NULL, 0xFFFF, 0xFFFF } }; -static const struct MatchCallStruct5 sDrakeMatchCallHeader = +static const struct MatchCallStructTrainer sDrakeMatchCallHeader = { - .type = 5, + .type = MC_TYPE_LEADER, .mapSec = MAPSEC_EVER_GRANDE_CITY, .flag = FLAG_REMATCH_DRAKE, .rematchTableIdx = REMATCH_DRAKE, @@ -696,9 +689,9 @@ static const match_call_text_data_t sWallaceTextScripts[] = { { NULL, 0xFFFF, 0xFFFF } }; -static const struct MatchCallStruct5 sWallaceMatchCallHeader = +static const struct MatchCallStructTrainer sWallaceMatchCallHeader = { - .type = 5, + .type = MC_TYPE_LEADER, .mapSec = MAPSEC_EVER_GRANDE_CITY, .flag = FLAG_REMATCH_WALLACE, .rematchTableIdx = REMATCH_WALLACE, @@ -708,86 +701,86 @@ static const struct MatchCallStruct5 sWallaceMatchCallHeader = }; static const match_call_t sMatchCallHeaders[] = { - [MC_HEADER_MR_STONE] = {.type0 = &sMrStoneMatchCallHeader}, - [MC_HEADER_PROF_BIRCH] = {.birch = &sProfBirchMatchCallHeader}, - [MC_HEADER_BRENDAN] = {.rival = &sBrendanMatchCallHeader}, - [MC_HEADER_MAY] = {.rival = &sMayMatchCallHeader}, - [MC_HEADER_WALLY] = {.wally = &sWallyMatchCallHeader}, - [MC_HEADER_NORMAN] = {.type5 = &sNormanMatchCallHeader}, - [MC_HEADER_MOM] = {.type0 = &sMomMatchCallHeader}, - [MC_HEADER_STEVEN] = {.type0 = &sStevenMatchCallHeader}, - [MC_HEADER_SCOTT] = {.type0 = &sScottMatchCallHeader}, - [MC_HEADER_ROXANNE] = {.type5 = &sRoxanneMatchCallHeader}, - [MC_HEADER_BRAWLY] = {.type5 = &sBrawlyMatchCallHeader}, - [MC_HEADER_WATTSON] = {.type5 = &sWattsonMatchCallHeader}, - [MC_HEADER_FLANNERY] = {.type5 = &sFlanneryMatchCallHeader}, - [MC_HEADER_WINONA] = {.type5 = &sWinonaMatchCallHeader}, - [MC_HEADER_TATE_LIZA] = {.type5 = &sTateLizaMatchCallHeader}, - [MC_HEADER_JUAN] = {.type5 = &sJuanMatchCallHeader}, - [MC_HEADER_SIDNEY] = {.type5 = &sSidneyMatchCallHeader}, - [MC_HEADER_PHOEBE] = {.type5 = &sPhoebeMatchCallHeader}, - [MC_HEADER_GLACIA] = {.type5 = &sGlaciaMatchCallHeader}, - [MC_HEADER_DRAKE] = {.type5 = &sDrakeMatchCallHeader}, - [MC_HEADER_WALLACE] = {.type5 = &sWallaceMatchCallHeader} + [MC_HEADER_MR_STONE] = {.npc = &sMrStoneMatchCallHeader}, + [MC_HEADER_PROF_BIRCH] = {.birch = &sProfBirchMatchCallHeader}, + [MC_HEADER_BRENDAN] = {.rival = &sBrendanMatchCallHeader}, + [MC_HEADER_MAY] = {.rival = &sMayMatchCallHeader}, + [MC_HEADER_WALLY] = {.wally = &sWallyMatchCallHeader}, + [MC_HEADER_NORMAN] = {.leader = &sNormanMatchCallHeader}, + [MC_HEADER_MOM] = {.npc = &sMomMatchCallHeader}, + [MC_HEADER_STEVEN] = {.npc = &sStevenMatchCallHeader}, + [MC_HEADER_SCOTT] = {.npc = &sScottMatchCallHeader}, + [MC_HEADER_ROXANNE] = {.leader = &sRoxanneMatchCallHeader}, + [MC_HEADER_BRAWLY] = {.leader = &sBrawlyMatchCallHeader}, + [MC_HEADER_WATTSON] = {.leader = &sWattsonMatchCallHeader}, + [MC_HEADER_FLANNERY] = {.leader = &sFlanneryMatchCallHeader}, + [MC_HEADER_WINONA] = {.leader = &sWinonaMatchCallHeader}, + [MC_HEADER_TATE_LIZA] = {.leader = &sTateLizaMatchCallHeader}, + [MC_HEADER_JUAN] = {.leader = &sJuanMatchCallHeader}, + [MC_HEADER_SIDNEY] = {.leader = &sSidneyMatchCallHeader}, + [MC_HEADER_PHOEBE] = {.leader = &sPhoebeMatchCallHeader}, + [MC_HEADER_GLACIA] = {.leader = &sGlaciaMatchCallHeader}, + [MC_HEADER_DRAKE] = {.leader = &sDrakeMatchCallHeader}, + [MC_HEADER_WALLACE] = {.leader = &sWallaceMatchCallHeader} }; -static bool32 (*const sMatchCallGetFlagFuncs[])(match_call_t) = { - MatchCallGetFlag_Type0, - MatchCallGetFlag_Type1, - MatchCallGetFlag_Wally, - MatchCallGetFlag_Rival, - MatchCallGetFlag_Birch +static bool32 (*const sMatchCallGetEnabledFuncs[])(match_call_t) = { + MatchCall_GetEnabled_NPC, + MatchCall_GetEnabled_Trainer, + MatchCall_GetEnabled_Wally, + MatchCall_GetEnabled_Rival, + MatchCall_GetEnabled_Birch }; static u8 (*const sMatchCallGetMapSecFuncs[])(match_call_t) = { - MatchCallGetMapSec_Type0, - MatchCallGetMapSec_Type1, - MatchCallGetMapSec_Wally, - MatchCallGetMapSec_Rival, - MatchCallGetMapSec_Birch + MatchCall_GetMapSec_NPC, + MatchCall_GetMapSec_Trainer, + MatchCall_GetMapSec_Wally, + MatchCall_GetMapSec_Rival, + MatchCall_GetMapSec_Birch }; static bool32 (*const sMatchCall_IsRematchableFunctions[])(match_call_t) = { - MatchCall_IsRematchable_Type0, - MatchCall_IsRematchable_Type1, + MatchCall_IsRematchable_NPC, + MatchCall_IsRematchable_Trainer, MatchCall_IsRematchable_Wally, MatchCall_IsRematchable_Rival, MatchCall_IsRematchable_Birch }; static bool32 (*const sMatchCall_HasCheckPageFunctions[])(match_call_t) = { - MatchCall_HasCheckPage_Type0, - MatchCall_HasCheckPage_Type1, + MatchCall_HasCheckPage_NPC, + MatchCall_HasCheckPage_Trainer, MatchCall_HasCheckPage_Wally, MatchCall_HasCheckPage_Rival, MatchCall_HasCheckPage_Birch }; static u32 (*const sMatchCall_GetRematchTableIdxFunctions[])(match_call_t) = { - MatchCall_GetRematchTableIdx_Type0, - MatchCall_GetRematchTableIdx_Type1, + MatchCall_GetRematchTableIdx_NPC, + MatchCall_GetRematchTableIdx_Trainer, MatchCall_GetRematchTableIdx_Wally, MatchCall_GetRematchTableIdx_Rival, MatchCall_GetRematchTableIdx_Birch }; static void (*const sMatchCall_GetMessageFunctions[])(match_call_t, u8 *) = { - MatchCall_GetMessage_Type0, - MatchCall_GetMessage_Type1, + MatchCall_GetMessage_NPC, + MatchCall_GetMessage_Trainer, MatchCall_GetMessage_Wally, MatchCall_GetMessage_Rival, MatchCall_GetMessage_Birch }; static void (*const sMatchCall_GetNameAndDescFunctions[])(match_call_t, const u8 **, const u8 **) = { - MatchCall_GetNameAndDesc_Type0, - MatchCall_GetNameAndDesc_Type1, + MatchCall_GetNameAndDesc_NPC, + MatchCall_GetNameAndDesc_Trainer, MatchCall_GetNameAndDesc_Wally, MatchCall_GetNameAndDesc_Rival, MatchCall_GetNameAndDesc_Birch }; -static const struct MatchCallOverride sMatchCallCheckPageOverrides[] = { +static const struct MatchCallCheckPageOverride sCheckPageOverrides[] = { { .idx = MC_HEADER_STEVEN, .facilityClass = FACILITY_CLASS_STEVEN, @@ -830,11 +823,11 @@ static u32 MatchCallGetFunctionIndex(match_call_t matchCall) { switch (matchCall.common->type) { - case MC_TYPE_0: default: + case MC_TYPE_NPC: return 0; - case MC_TYPE_1: - case MC_TYPE_5: + case MC_TYPE_TRAINER: + case MC_TYPE_LEADER: return 1; case MC_TYPE_WALLY: return 2; @@ -862,40 +855,40 @@ s32 GetRematchIdxByTrainerIdx(s32 trainerIdx) return -1; } -bool32 MatchCallFlagGetByIndex(u32 idx) +bool32 MatchCall_GetEnabled(u32 idx) { match_call_t matchCall; u32 i; - if (idx > ARRAY_COUNT(sMatchCallHeaders) - 1) + if (idx >= ARRAY_COUNT(sMatchCallHeaders)) return FALSE; matchCall = sMatchCallHeaders[idx]; i = MatchCallGetFunctionIndex(matchCall); - return sMatchCallGetFlagFuncs[i](matchCall); + return sMatchCallGetEnabledFuncs[i](matchCall); } -static bool32 MatchCallGetFlag_Type0(match_call_t matchCall) +static bool32 MatchCall_GetEnabled_NPC(match_call_t matchCall) { - if (matchCall.type0->flag == 0xFFFF) + if (matchCall.npc->flag == 0xFFFF) return TRUE; - return FlagGet(matchCall.type0->flag); + return FlagGet(matchCall.npc->flag); } -static bool32 MatchCallGetFlag_Type1(match_call_t matchCall) +static bool32 MatchCall_GetEnabled_Trainer(match_call_t matchCall) { - if (matchCall.type1->flag == 0xFFFF) + if (matchCall.trainer->flag == 0xFFFF) return TRUE; - return FlagGet(matchCall.type1->flag); + return FlagGet(matchCall.trainer->flag); } -static bool32 MatchCallGetFlag_Wally(match_call_t matchCall) +static bool32 MatchCall_GetEnabled_Wally(match_call_t matchCall) { if (matchCall.wally->flag == 0xFFFF) return TRUE; return FlagGet(matchCall.wally->flag); } -static bool32 MatchCallGetFlag_Rival(match_call_t matchCall) +static bool32 MatchCall_GetEnabled_Rival(match_call_t matchCall) { if (matchCall.rival->playerGender != gSaveBlock2Ptr->playerGender) return FALSE; @@ -904,34 +897,34 @@ static bool32 MatchCallGetFlag_Rival(match_call_t matchCall) return FlagGet(matchCall.rival->flag); } -static bool32 MatchCallGetFlag_Birch(match_call_t matchCall) +static bool32 MatchCall_GetEnabled_Birch(match_call_t matchCall) { return FlagGet(matchCall.birch->flag); } -u8 MatchCallMapSecGetByIndex(u32 idx) +u8 MatchCall_GetMapSec(u32 idx) { match_call_t matchCall; u32 i; - if (idx > ARRAY_COUNT(sMatchCallHeaders) - 1) + if (idx >= ARRAY_COUNT(sMatchCallHeaders)) return 0; matchCall = sMatchCallHeaders[idx]; i = MatchCallGetFunctionIndex(matchCall); return sMatchCallGetMapSecFuncs[i](matchCall); } -static u8 MatchCallGetMapSec_Type0(match_call_t matchCall) +static u8 MatchCall_GetMapSec_NPC(match_call_t matchCall) { - return matchCall.type0->mapSec; + return matchCall.npc->mapSec; } -static u8 MatchCallGetMapSec_Type1(match_call_t matchCall) +static u8 MatchCall_GetMapSec_Trainer(match_call_t matchCall) { - return matchCall.type1->mapSec; + return matchCall.trainer->mapSec; } -static u8 MatchCallGetMapSec_Wally(match_call_t matchCall) +static u8 MatchCall_GetMapSec_Wally(match_call_t matchCall) { s32 i; @@ -943,12 +936,12 @@ static u8 MatchCallGetMapSec_Wally(match_call_t matchCall) return matchCall.wally->locationData[i].mapSec; } -static u8 MatchCallGetMapSec_Rival(match_call_t matchCall) +static u8 MatchCall_GetMapSec_Rival(match_call_t matchCall) { return MAPSEC_NONE; } -static u8 MatchCallGetMapSec_Birch(match_call_t matchCall) +static u8 MatchCall_GetMapSec_Birch(match_call_t matchCall) { return MAPSEC_NONE; } @@ -958,23 +951,23 @@ bool32 MatchCall_IsRematchable(u32 idx) match_call_t matchCall; u32 i; - if (idx > ARRAY_COUNT(sMatchCallHeaders) - 1) + if (idx >= ARRAY_COUNT(sMatchCallHeaders)) return 0; matchCall = sMatchCallHeaders[idx]; i = MatchCallGetFunctionIndex(matchCall); return sMatchCall_IsRematchableFunctions[i](matchCall); } -static bool32 MatchCall_IsRematchable_Type0(match_call_t matchCall) +static bool32 MatchCall_IsRematchable_NPC(match_call_t matchCall) { return FALSE; } -static bool32 MatchCall_IsRematchable_Type1(match_call_t matchCall) +static bool32 MatchCall_IsRematchable_Trainer(match_call_t matchCall) { - if (matchCall.type1->rematchTableIdx >= REMATCH_ELITE_FOUR_ENTRIES) + if (matchCall.trainer->rematchTableIdx >= REMATCH_ELITE_FOUR_ENTRIES) return FALSE; - return gSaveBlock1Ptr->trainerRematches[matchCall.type1->rematchTableIdx] ? TRUE : FALSE; + return gSaveBlock1Ptr->trainerRematches[matchCall.trainer->rematchTableIdx] ? TRUE : FALSE; } static bool32 MatchCall_IsRematchable_Wally(match_call_t matchCall) @@ -997,26 +990,26 @@ bool32 MatchCall_HasCheckPage(u32 idx) match_call_t matchCall; u32 i; - if (idx > ARRAY_COUNT(sMatchCallHeaders) - 1) + if (idx >= ARRAY_COUNT(sMatchCallHeaders)) return FALSE; matchCall = sMatchCallHeaders[idx]; i = MatchCallGetFunctionIndex(matchCall); if (sMatchCall_HasCheckPageFunctions[i](matchCall)) return TRUE; - for (i = 0; i < ARRAY_COUNT(sMatchCallCheckPageOverrides); i++) + for (i = 0; i < ARRAY_COUNT(sCheckPageOverrides); i++) { - if (sMatchCallCheckPageOverrides[i].idx == idx) + if (sCheckPageOverrides[i].idx == idx) return TRUE; } return FALSE; } -static bool32 MatchCall_HasCheckPage_Type0(match_call_t matchCall) +static bool32 MatchCall_HasCheckPage_NPC(match_call_t matchCall) { return FALSE; } -static bool32 MatchCall_HasCheckPage_Type1(match_call_t matchCall) +static bool32 MatchCall_HasCheckPage_Trainer(match_call_t matchCall) { return TRUE; } @@ -1041,21 +1034,21 @@ u32 MatchCall_GetRematchTableIdx(u32 idx) match_call_t matchCall; u32 i; - if (idx > ARRAY_COUNT(sMatchCallHeaders) - 1) + if (idx >= ARRAY_COUNT(sMatchCallHeaders)) return REMATCH_TABLE_ENTRIES; matchCall = sMatchCallHeaders[idx]; i = MatchCallGetFunctionIndex(matchCall); return sMatchCall_GetRematchTableIdxFunctions[i](matchCall); } -static u32 MatchCall_GetRematchTableIdx_Type0(match_call_t matchCall) +static u32 MatchCall_GetRematchTableIdx_NPC(match_call_t matchCall) { return REMATCH_TABLE_ENTRIES; } -static u32 MatchCall_GetRematchTableIdx_Type1(match_call_t matchCall) +static u32 MatchCall_GetRematchTableIdx_Trainer(match_call_t matchCall) { - return matchCall.type1->rematchTableIdx; + return matchCall.trainer->rematchTableIdx; } static u32 MatchCall_GetRematchTableIdx_Wally(match_call_t matchCall) @@ -1078,24 +1071,25 @@ void MatchCall_GetMessage(u32 idx, u8 *dest) match_call_t matchCall; u32 i; - if (idx > ARRAY_COUNT(sMatchCallHeaders) - 1) + if (idx >= ARRAY_COUNT(sMatchCallHeaders)) return; matchCall = sMatchCallHeaders[idx]; i = MatchCallGetFunctionIndex(matchCall); sMatchCall_GetMessageFunctions[i](matchCall, dest); } -static void MatchCall_GetMessage_Type0(match_call_t matchCall, u8 *dest) +static void MatchCall_GetMessage_NPC(match_call_t matchCall, u8 *dest) { - MatchCall_BufferCallMessageText(matchCall.type0->textData, dest); + MatchCall_BufferCallMessageText(matchCall.npc->textData, dest); } -static void MatchCall_GetMessage_Type1(match_call_t matchCall, u8 *dest) +// This is the one functional difference between MC_TYPE_TRAINER and MC_TYPE_LEADER +static void MatchCall_GetMessage_Trainer(match_call_t matchCall, u8 *dest) { - if (matchCall.common->type != MC_TYPE_5) - MatchCall_BufferCallMessageText(matchCall.type1->textData, dest); + if (matchCall.common->type != MC_TYPE_LEADER) + MatchCall_BufferCallMessageText(matchCall.trainer->textData, dest); else - sub_81D199C(matchCall.type5->textData, matchCall.type5->rematchTableIdx, dest); + MatchCall_BufferCallMessageTextByRematchTeam(matchCall.leader->textData, matchCall.leader->rematchTableIdx, dest); } static void MatchCall_GetMessage_Wally(match_call_t matchCall, u8 *dest) @@ -1110,7 +1104,7 @@ static void MatchCall_GetMessage_Rival(match_call_t matchCall, u8 *dest) static void MatchCall_GetMessage_Birch(match_call_t matchCall, u8 *dest) { - sub_8197080(dest); + BufferPokedexRatingForMatchCall(dest); } static void MatchCall_BufferCallMessageText(const match_call_text_data_t *textData, u8 *dest) @@ -1131,7 +1125,7 @@ static void MatchCall_BufferCallMessageText(const match_call_text_data_t *textDa StringExpandPlaceholders(dest, textData[i].text); } -static void sub_81D199C(const match_call_text_data_t *textData, u16 idx, u8 *dest) +static void MatchCall_BufferCallMessageTextByRematchTeam(const match_call_text_data_t *textData, u16 idx, u8 *dest) { u32 i; for (i = 0; textData[i].text != NULL; i++) @@ -1168,32 +1162,32 @@ static void sub_81D199C(const match_call_text_data_t *textData, u16 idx, u8 *des } } -void sub_81D1A78(u32 idx, const u8 **desc, const u8 **name) +void MatchCall_GetNameAndDesc(u32 idx, const u8 **desc, const u8 **name) { match_call_t matchCall; u32 i; - if (idx > ARRAY_COUNT(sMatchCallHeaders) - 1) + if (idx >= ARRAY_COUNT(sMatchCallHeaders)) return; matchCall = sMatchCallHeaders[idx]; i = MatchCallGetFunctionIndex(matchCall); sMatchCall_GetNameAndDescFunctions[i](matchCall, desc, name); } -static void MatchCall_GetNameAndDesc_Type0(match_call_t matchCall, const u8 **desc, const u8 **name) +static void MatchCall_GetNameAndDesc_NPC(match_call_t matchCall, const u8 **desc, const u8 **name) { - *desc = matchCall.type0->desc; - *name = matchCall.type0->name; + *desc = matchCall.npc->desc; + *name = matchCall.npc->name; } -static void MatchCall_GetNameAndDesc_Type1(match_call_t matchCall, const u8 **desc, const u8 **name) +static void MatchCall_GetNameAndDesc_Trainer(match_call_t matchCall, const u8 **desc, const u8 **name) { match_call_t _matchCall = matchCall; - if (_matchCall.type1->name == NULL) - MatchCall_GetNameAndDescByRematchIdx(_matchCall.type1->rematchTableIdx, desc, name); + if (_matchCall.trainer->name == NULL) + MatchCall_GetNameAndDescByRematchIdx(_matchCall.trainer->rematchTableIdx, desc, name); else - *name = _matchCall.type1->name; - *desc = _matchCall.type1->desc; + *name = _matchCall.trainer->name; + *desc = _matchCall.trainer->desc; } static void MatchCall_GetNameAndDesc_Wally(match_call_t matchCall, const u8 **desc, const u8 **name) @@ -1225,21 +1219,21 @@ const u8 *MatchCall_GetOverrideFlavorText(u32 idx, u32 offset) { u32 i; - for (i = 0; i < ARRAY_COUNT(sMatchCallCheckPageOverrides); i++) + for (i = 0; i < ARRAY_COUNT(sCheckPageOverrides); i++) { - if (sMatchCallCheckPageOverrides[i].idx == idx) + if (sCheckPageOverrides[i].idx == idx) { while (1) { - if (i + 1 >= ARRAY_COUNT(sMatchCallCheckPageOverrides)) + if (i + 1 >= ARRAY_COUNT(sCheckPageOverrides)) break; - if (sMatchCallCheckPageOverrides[i + 1].idx != idx) + if (sCheckPageOverrides[i + 1].idx != idx) break; - if (!FlagGet(sMatchCallCheckPageOverrides[i + 1].flag)) + if (!FlagGet(sCheckPageOverrides[i + 1].flag)) break; i++; } - return sMatchCallCheckPageOverrides[i].flavorTexts[offset]; + return sCheckPageOverrides[i].flavorTexts[offset]; } } return NULL; @@ -1249,15 +1243,15 @@ int MatchCall_GetOverrideFacilityClass(u32 idx) { u32 i; - for (i = 0; i < ARRAY_COUNT(sMatchCallCheckPageOverrides); i++) + for (i = 0; i < ARRAY_COUNT(sCheckPageOverrides); i++) { - if (sMatchCallCheckPageOverrides[i].idx == idx) - return sMatchCallCheckPageOverrides[i].facilityClass; + if (sCheckPageOverrides[i].idx == idx) + return sCheckPageOverrides[i].facilityClass; } return -1; } -bool32 sub_81D1BF8(u32 idx) +bool32 MatchCall_HasRematchId(u32 idx) { int i; diff --git a/src/pokenav_match_call_ui.c b/src/pokenav_match_call_ui.c index 552bf2cb7..f6546ec50 100644 --- a/src/pokenav_match_call_ui.c +++ b/src/pokenav_match_call_ui.c @@ -91,7 +91,7 @@ u32 LoopedTask_sub_81C83F0(s32 state); u32 LoopedTask_sub_81C85A0(s32 state); u32 LoopedTask_sub_81C8870(s32 state); u32 LoopedTask_sub_81C8A28(s32 state); -u32 LoopedTask_sub_81C8958(s32 state); +u32 LoopedTask_PrintCheckPageInfo(s32 state); static const u16 sMatchcallArrowPaletteData[] = INCBIN_U16("graphics/pokenav/arrows_matchcall.gbapal"); static const u32 sMatchcallArrowSpriteSheetData[] = INCBIN_U32("graphics/pokenav/arrows_matchcall.4bpp.lz"); @@ -467,12 +467,12 @@ void sub_81C877C(void) structPtr->unk8A0 = CreateLoopedTask(LoopedTask_sub_81C8870, 6); } -void sub_81C87AC(s16 a0) +void PrintCheckPageInfo(s16 a0) { struct PokenavSub17 *structPtr = GetSubstructPtr(17); structPtr->unk888.windowTopIndex += a0; structPtr->unk89C = 0; - structPtr->unk8A0 = CreateLoopedTask(LoopedTask_sub_81C8958, 6); + structPtr->unk8A0 = CreateLoopedTask(LoopedTask_PrintCheckPageInfo, 6); } void sub_81C87F0(void) @@ -496,6 +496,7 @@ void sub_81C8838(void) CopyWindowToVram(structPtr->unk0.unk0.windowId, 1); } +// TODO: u32 LoopedTask_sub_81C8870(s32 state) { struct PokenavSub17 *structPtr = GetSubstructPtr(17); @@ -543,7 +544,7 @@ u32 LoopedTask_sub_81C8870(s32 state) return LT_FINISH; } -u32 LoopedTask_sub_81C8958(s32 state) +u32 LoopedTask_PrintCheckPageInfo(s32 state) { struct PokenavSub17 *structPtr = GetSubstructPtr(17); if (IsDma3ManagerBusyWithBgCopy()) @@ -683,7 +684,7 @@ void sub_81C8B70(struct UnknownSubSubStruct_0203CF40 *a0, s32 a1, s32 a2) } for (a2--; a2 != -1; a1 = (a1 + 1) & 0xF, a2--) - sub_81CBD48(a0->windowId, a1); + ClearRematchPokeballIcon(a0->windowId, a1); CopyWindowToVram(a0->windowId, 1); } diff --git a/src/pokenav_unk_1.c b/src/pokenav_unk_1.c index 7d531c2f7..8bf3ebd2a 100644 --- a/src/pokenav_unk_1.c +++ b/src/pokenav_unk_1.c @@ -64,7 +64,7 @@ bool32 PokenavCallback_Init_0(void) state->menuType = GetPokenavMainMenuType(); state->cursorPos = 0; state->descriptionId = 0; - state->helpBarIndex = 0; + state->helpBarIndex = HELPBAR_NONE; sub_81C939C(state); return TRUE; } @@ -78,7 +78,7 @@ bool32 PokenavCallback_Init_4(void) state->menuType = GetPokenavMainMenuType(); state->cursorPos = 2; state->descriptionId = 2; - state->helpBarIndex = 0; + state->helpBarIndex = HELPBAR_NONE; sub_81C939C(state); return TRUE; } @@ -105,7 +105,7 @@ bool32 PokenavCallback_Init_2(void) state->menuType = 3; state->cursorPos = 0; state->descriptionId = 5; - state->helpBarIndex = 0; + state->helpBarIndex = HELPBAR_NONE; sub_81C939C(state); return TRUE; } @@ -119,7 +119,7 @@ bool32 PokenavCallback_Init_3(void) state->menuType = 4; state->cursorPos = sub_81C76AC(); state->descriptionId = state->cursorPos + 8; - state->helpBarIndex = 0; + state->helpBarIndex = HELPBAR_NONE; sub_81C939C(state); return TRUE; } @@ -179,7 +179,7 @@ static u32 sub_81C943C(struct Pokenav1Struct *a0) switch (sDescriptionIds[a0->menuType][a0->cursorPos]) { case 0: - a0->helpBarIndex = gSaveBlock2Ptr->regionMapZoom ? 2 : 1; + a0->helpBarIndex = gSaveBlock2Ptr->regionMapZoom ? HELPBAR_MAP_ZOOMED_IN : HELPBAR_MAP_ZOOMED_OUT; sub_81C97B0(a0, POKENAV_MENU_6); return 8; case 1: @@ -189,13 +189,13 @@ static u32 sub_81C943C(struct Pokenav1Struct *a0) a0->callback = sub_81C963C; return 2; case 2: - a0->helpBarIndex = 6; + a0->helpBarIndex = HELPBAR_MC_TRAINER_LIST; sub_81C97B0(a0, POKENAV_MENU_B); return 8; case 3: if (CanViewRibbonsMenu()) { - a0->helpBarIndex = 9; + a0->helpBarIndex = HELPBAR_RIBBONS_MON_LIST; sub_81C97B0(a0, POKENAV_MENU_C); return 8; } @@ -224,7 +224,7 @@ static u32 sub_81C9520(struct Pokenav1Struct *a0) { if (sDescriptionIds[a0->menuType][a0->cursorPos] == 2) { - a0->helpBarIndex = 6; + a0->helpBarIndex = HELPBAR_MC_TRAINER_LIST; sub_81C97B0(a0, POKENAV_MENU_B); return 8; } @@ -259,7 +259,7 @@ static u32 sub_81C9588(struct Pokenav1Struct *a0) } else if (v0 == 2) { - a0->helpBarIndex = 6; + a0->helpBarIndex = HELPBAR_MC_TRAINER_LIST; sub_81C97B0(a0, POKENAV_MENU_B); return 8; } @@ -349,7 +349,7 @@ static u32 sub_81C96FC(struct Pokenav1Struct *a0) { sub_81C7694(v0 - 8); sub_81C97B0(a0, POKENAV_MENU_8); - a0->helpBarIndex = 3; + a0->helpBarIndex = HELPBAR_CONDITION_MON_LIST; return 8; } else @@ -459,7 +459,7 @@ int sub_81C98B4(void) return state->descriptionId; } -u16 sub_81C98C4(void) +u16 GetHelpBarTextId(void) { struct Pokenav1Struct *state = GetSubstructPtr(1); return state->helpBarIndex; diff --git a/src/pokenav_unk_10.c b/src/pokenav_unk_10.c index 0d82f1a9c..761f65c4b 100644 --- a/src/pokenav_unk_10.c +++ b/src/pokenav_unk_10.c @@ -576,7 +576,7 @@ u32 sub_81D0A6C(s32 state) return LT_PAUSE; case 7: sub_81D12D8(structPtr); - sub_81C7BA4(10); + PrintHelpBarText(HELPBAR_RIBBONS_LIST); return LT_INC_AND_PAUSE; case 8: if (!IsDma3ManagerBusyWithBgCopy()) @@ -670,7 +670,7 @@ u32 sub_81D0D2C(s32 state) if (!sub_81D1524(structPtr)) { sub_81D0EFC(structPtr); - sub_81C7BA4(11); + PrintHelpBarText(HELPBAR_RIBBONS_CHECK); return LT_INC_AND_PAUSE; } return LT_PAUSE; @@ -724,7 +724,7 @@ u32 sub_81D0E00(s32 state) if (!sub_81D1524(structPtr)) { sub_81D0E84(structPtr); - sub_81C7BA4(10); + PrintHelpBarText(HELPBAR_RIBBONS_LIST); return LT_INC_AND_PAUSE; } return LT_PAUSE; diff --git a/src/pokenav_unk_2.c b/src/pokenav_unk_2.c index ed9da0800..39c1f09a5 100644 --- a/src/pokenav_unk_2.c +++ b/src/pokenav_unk_2.c @@ -707,10 +707,10 @@ static u32 sub_81C9F28(s32 state) switch (state) { case 0: - sub_81C7BA4(sub_81C98C4()); + PrintHelpBarText(GetHelpBarTextId()); return LT_INC_AND_PAUSE; case 1: - if (IsDma3ManagerBusyWithBgCopy_()) + if (WaitForHelpBar()) return LT_PAUSE; sub_81C7880(); sub_81CA9C8(); diff --git a/src/pokenav_unk_3.c b/src/pokenav_unk_3.c index 6289bd2cb..183c2e424 100755 --- a/src/pokenav_unk_3.c +++ b/src/pokenav_unk_3.c @@ -15,17 +15,18 @@ #include "constants/flags.h" #include "constants/songs.h" -//#define ?? id1 -#define mapSec id2 // naming multi-purpose field -#define headerId data // naming multi-purpose field +// naming multi-purpose fields +#define isSpecialTrainer id1 // Gym Leaders, for example. As opposed to regular NPC +#define mapSec id2 +#define headerId data struct Pokenav3Struct { - u16 unk0; - u16 unk2; + u16 optionCursorPos; + u16 maxOptionId; const u8 *matchCallOptions; u16 headerId; - u16 unkA; + u16 numRegistered; u16 unkC; u32 unk10; u32 unk14; @@ -35,9 +36,9 @@ struct Pokenav3Struct static u32 CB2_HandleMatchCallInput(struct Pokenav3Struct *); static u32 sub_81CABFC(struct Pokenav3Struct *); -static u32 sub_81CAC04(struct Pokenav3Struct *); -static u32 sub_81CACB8(struct Pokenav3Struct *); -static u32 sub_81CACF8(struct Pokenav3Struct *); +static u32 CB2_HandleMatchCallOptionsInput(struct Pokenav3Struct *); +static u32 CB2_HandleCheckPageInput(struct Pokenav3Struct *); +static u32 CB2_HandleCallInput(struct Pokenav3Struct *); static u32 sub_81CAD20(s32); static bool32 sub_81CB1D0(void); @@ -95,18 +96,19 @@ static u32 CB2_HandleMatchCallInput(struct Pokenav3Struct *state) if (gMain.newKeys & A_BUTTON) { - state->callback = sub_81CAC04; - state->unk0 = 0; + state->callback = CB2_HandleMatchCallOptionsInput; + state->optionCursorPos = 0; selection = GetSelectedMatchCall(); - if (!state->matchCallEntries[selection].id1 || MatchCall_HasCheckPage(state->matchCallEntries[selection].headerId)) + + if (!state->matchCallEntries[selection].isSpecialTrainer || MatchCall_HasCheckPage(state->matchCallEntries[selection].headerId)) { state->matchCallOptions = sMatchCallOptionsHasCheckPage; - state->unk2 = 2; + state->maxOptionId = ARRAY_COUNT(sMatchCallOptionsHasCheckPage) - 1; } else { state->matchCallOptions = sMatchCallOptionsNoCheckPage; - state->unk2 = 1; + state->maxOptionId = ARRAY_COUNT(sMatchCallOptionsNoCheckPage) - 1; } return POKENAV_MC_FUNC_SELECT; @@ -134,68 +136,68 @@ static u32 sub_81CABFC(struct Pokenav3Struct *state) return POKENAV_MENU_4; } -static u32 sub_81CAC04(struct Pokenav3Struct *state) +static u32 CB2_HandleMatchCallOptionsInput(struct Pokenav3Struct *state) { - if ((gMain.newKeys & DPAD_UP) && state->unk0) + if ((gMain.newKeys & DPAD_UP) && state->optionCursorPos) { - state->unk0--; - return POKENAV_MC_FUNC_6; + state->optionCursorPos--; + return POKENAV_MC_FUNC_MOVE_OPTIONS_CURSOR; } - if ((gMain.newKeys & DPAD_DOWN) && state->unk0 < state->unk2) + if ((gMain.newKeys & DPAD_DOWN) && state->optionCursorPos < state->maxOptionId) { - state->unk0++; - return POKENAV_MC_FUNC_6; + state->optionCursorPos++; + return POKENAV_MC_FUNC_MOVE_OPTIONS_CURSOR; } if (gMain.newKeys & A_BUTTON) { - switch (state->matchCallOptions[state->unk0]) + switch (state->matchCallOptions[state->optionCursorPos]) { case MATCH_CALL_OPTION_CANCEL: state->callback = CB2_HandleMatchCallInput; - return POKENAV_MC_FUNC_7; + return POKENAV_MC_FUNC_CANCEL; case MATCH_CALL_OPTION_CALL: if (GetPokenavMode() == POKENAV_MODE_FORCE_CALL_READY) SetPokenavMode(POKENAV_MODE_FORCE_CALL_EXIT); - state->callback = sub_81CACF8; + state->callback = CB2_HandleCallInput; if (sub_81CB1D0()) return POKENAV_MC_FUNC_NEARBY_MSG; return POKENAV_MC_FUNC_CALL_MSG; case MATCH_CALL_OPTION_CHECK: - state->callback = sub_81CACB8; - return POKENAV_MC_FUNC_11; + state->callback = CB2_HandleCheckPageInput; + return POKENAV_MC_FUNC_SHOW_CHECK_PAGE; } } if (gMain.newKeys & B_BUTTON) { state->callback = CB2_HandleMatchCallInput; - return POKENAV_MC_FUNC_7; + return POKENAV_MC_FUNC_CANCEL; } return POKENAV_MC_FUNC_NONE; } -static u32 sub_81CACB8(struct Pokenav3Struct *state) +static u32 CB2_HandleCheckPageInput(struct Pokenav3Struct *state) { if (gMain.newAndRepeatedKeys & DPAD_UP) - return POKENAV_MC_FUNC_12; + return POKENAV_MC_FUNC_CHECK_PAGE_UP; if (gMain.newAndRepeatedKeys & DPAD_DOWN) - return POKENAV_MC_FUNC_13; + return POKENAV_MC_FUNC_CHECK_PAGE_DOWN; if (gMain.newKeys & B_BUTTON) { state->callback = CB2_HandleMatchCallInput; - return POKENAV_MC_FUNC_14; + return POKENAV_MC_FUNC_EXIT_CHECK_PAGE; } return POKENAV_MC_FUNC_NONE; } -static u32 sub_81CACF8(struct Pokenav3Struct *state) +static u32 CB2_HandleCallInput(struct Pokenav3Struct *state) { if (gMain.newKeys & (A_BUTTON | B_BUTTON)) { @@ -214,17 +216,17 @@ static u32 sub_81CAD20(s32 taskState) { case 0: state->headerId = 0; - state->unkA = 0; + state->numRegistered = 0; return LT_INC_AND_CONTINUE; case 1: for (i = 0, j = state->headerId; i < 30; i++, j++) { - if (MatchCallFlagGetByIndex(j)) + if (MatchCall_GetEnabled(j)) { - state->matchCallEntries[state->unkA].headerId = j; - state->matchCallEntries[state->unkA].id1 = TRUE; - state->matchCallEntries[state->unkA].mapSec = MatchCallMapSecGetByIndex(j); - state->unkA++; + state->matchCallEntries[state->numRegistered].headerId = j; + state->matchCallEntries[state->numRegistered].isSpecialTrainer = TRUE; + state->matchCallEntries[state->numRegistered].mapSec = MatchCall_GetMapSec(j); + state->numRegistered++; } if (++state->headerId >= MC_HEADER_COUNT) @@ -239,12 +241,12 @@ static u32 sub_81CAD20(s32 taskState) case 2: for (i = 0, j = state->headerId; i < 30; i++, j++) { - if (!sub_81D1BF8(state->headerId) && IsRematchEntryRegistered(state->headerId)) + if (!MatchCall_HasRematchId(state->headerId) && IsRematchEntryRegistered(state->headerId)) { - state->matchCallEntries[state->unkA].headerId = state->headerId; - state->matchCallEntries[state->unkA].id1 = FALSE; - state->matchCallEntries[state->unkA].mapSec = sub_81CB0C8(j); - state->unkA++; + state->matchCallEntries[state->numRegistered].headerId = state->headerId; + state->matchCallEntries[state->numRegistered].isSpecialTrainer = FALSE; + state->matchCallEntries[state->numRegistered].mapSec = sub_81CB0C8(j); + state->numRegistered++; } if (++state->headerId > REMATCH_TABLE_ENTRIES - 1) @@ -274,10 +276,10 @@ int sub_81CAE28(void) return state->unk10; } -int sub_81CAE38(void) +int GetNumberRegistered(void) { struct Pokenav3Struct *state = GetSubstructPtr(5); - return state->unkA; + return state->numRegistered; } int sub_81CAE48(void) @@ -289,14 +291,14 @@ int sub_81CAE48(void) int unref_sub_81CAE58(void) { struct Pokenav3Struct *state = GetSubstructPtr(5); - return state->unkA - state->unkC; + return state->numRegistered - state->unkC; } int unref_sub_81CAE6C(int arg0) { struct Pokenav3Struct *state = GetSubstructPtr(5); arg0 += state->unkC; - if (arg0 >= state->unkA) + if (arg0 >= state->numRegistered) return REMATCH_TABLE_ENTRIES; return state->matchCallEntries[arg0].headerId; @@ -308,16 +310,16 @@ struct PokenavMonList *sub_81CAE94(void) return state->matchCallEntries; } -u16 sub_81CAEA4(int index) +u16 GetMatchCallMapSec(int index) { struct Pokenav3Struct *state = GetSubstructPtr(5); return state->matchCallEntries[index].mapSec; } -bool32 sub_81CAEBC(int index) +bool32 ShouldDrawRematchPokeballIcon(int index) { struct Pokenav3Struct *state = GetSubstructPtr(5); - if (!state->matchCallEntries[index].id1) + if (!state->matchCallEntries[index].isSpecialTrainer) index = state->matchCallEntries[index].headerId; else index = MatchCall_GetRematchTableIdx(state->matchCallEntries[index].headerId); @@ -332,7 +334,7 @@ int GetMatchCallTrainerPic(int index) { int var0; struct Pokenav3Struct *state = GetSubstructPtr(5); - if (!state->matchCallEntries[index].id1) + if (!state->matchCallEntries[index].isSpecialTrainer) { index = GetTrainerIdxByRematchIdx(state->matchCallEntries[index].headerId); return gTrainers[index].trainerPic; @@ -357,7 +359,7 @@ const u8 *GetMatchCallMessageText(int index, u8 *arg1) if (!Overworld_MapTypeAllowsTeleportAndFly(gMapHeader.mapType)) return gText_CallCantBeMadeHere; - if (!state->matchCallEntries[index].id1) + if (!state->matchCallEntries[index].isSpecialTrainer) *arg1 = SelectMatchCallMessage(GetTrainerIdxByRematchIdx(state->matchCallEntries[index].headerId), gStringVar4); else MatchCall_GetMessage(state->matchCallEntries[index].headerId, gStringVar4); @@ -369,7 +371,7 @@ const u8 *GetMatchCallFlavorText(int index, int checkPageEntry) { int rematchId; struct Pokenav3Struct *state = GetSubstructPtr(5); - if (state->matchCallEntries[index].id1) + if (state->matchCallEntries[index].isSpecialTrainer) { rematchId = MatchCall_GetRematchTableIdx(state->matchCallEntries[index].headerId); if (rematchId == REMATCH_TABLE_ENTRIES) @@ -383,28 +385,28 @@ const u8 *GetMatchCallFlavorText(int index, int checkPageEntry) return gMatchCallFlavorTexts[rematchId][checkPageEntry]; } -u16 sub_81CB01C(void) +u16 GetMatchCallOptionCursorPos(void) { struct Pokenav3Struct *state = GetSubstructPtr(5); - return state->unk0; + return state->optionCursorPos; } -u16 sub_81CB02C(int arg0) +u16 GetMatchCallOptionId(int optionId) { struct Pokenav3Struct *state = GetSubstructPtr(5); - if (state->unk2 < arg0) + if (state->maxOptionId < optionId) return MATCH_CALL_OPTION_COUNT; - return state->matchCallOptions[arg0]; + return state->matchCallOptions[optionId]; } -void sub_81CB050(struct PokenavMonList * arg0, u8 *str) +void BufferMatchCallNameAndDesc(struct PokenavMonList *matchCallEntry, u8 *str) { const u8 *trainerName; const u8 *className; - if (!arg0->id1) + if (!matchCallEntry->isSpecialTrainer) { - int index = GetTrainerIdxByRematchIdx(arg0->headerId); + int index = GetTrainerIdxByRematchIdx(matchCallEntry->headerId); const struct Trainer *trainer = &gTrainers[index]; int class = trainer->trainerClass; className = gTrainerClassNames[class]; @@ -412,7 +414,7 @@ void sub_81CB050(struct PokenavMonList * arg0, u8 *str) } else { - sub_81D1A78(arg0->headerId, &className, &trainerName); + MatchCall_GetNameAndDesc(matchCallEntry->headerId, &className, &trainerName); } if (className && trainerName) @@ -433,13 +435,13 @@ u8 sub_81CB0C8(int rematchIndex) return Overworld_GetMapHeaderByGroupAndId(mapGroup, mapNum)->regionMapSectionId; } -int sub_81CB0E4(int index) +int GetIndexDeltaOfNextCheckPageDown(int index) { struct Pokenav3Struct *state = GetSubstructPtr(5); int count = 1; - while (++index < state->unkA) + while (++index < state->numRegistered) { - if (!state->matchCallEntries[index].id1) + if (!state->matchCallEntries[index].isSpecialTrainer) return count; if (MatchCall_HasCheckPage(state->matchCallEntries[index].headerId)) return count; @@ -450,13 +452,13 @@ int sub_81CB0E4(int index) return 0; } -int sub_81CB128(int index) +int GetIndexDeltaOfNextCheckPageUp(int index) { struct Pokenav3Struct *state = GetSubstructPtr(5); int count = -1; while (--index >= 0) { - if (!state->matchCallEntries[index].id1) + if (!state->matchCallEntries[index].isSpecialTrainer) return count; if (MatchCall_HasCheckPage(state->matchCallEntries[index].headerId)) return count; @@ -479,7 +481,7 @@ bool32 unref_sub_81CB16C(void) for (i = 0; i < MC_HEADER_COUNT; i++) { - if (MatchCallFlagGetByIndex(i)) + if (MatchCall_GetEnabled(i)) { int index = MatchCall_GetRematchTableIdx(i); if (gSaveBlock1Ptr->trainerRematches[index]) @@ -494,9 +496,9 @@ static bool32 sub_81CB1D0(void) { struct Pokenav3Struct *state = GetSubstructPtr(5); int selection = GetSelectedMatchCall(); - if (!state->matchCallEntries[selection].id1) + if (!state->matchCallEntries[selection].isSpecialTrainer) { - if (sub_81CAEA4(selection) == gMapHeader.regionMapSectionId) + if (GetMatchCallMapSec(selection) == gMapHeader.regionMapSectionId) { if (!gSaveBlock1Ptr->trainerRematches[state->matchCallEntries[selection].headerId]) return TRUE; @@ -506,7 +508,7 @@ static bool32 sub_81CB1D0(void) { if (state->matchCallEntries[selection].headerId == MC_HEADER_WATTSON) { - if (sub_81CAEA4(selection) == gMapHeader.regionMapSectionId + if (GetMatchCallMapSec(selection) == gMapHeader.regionMapSectionId && FlagGet(FLAG_BADGE05_GET) == TRUE) { if (!FlagGet(FLAG_WATTSON_REMATCH_AVAILABLE)) diff --git a/src/pokenav_unk_4.c b/src/pokenav_unk_4.c index b1cabe147..bc98d4f75 100755 --- a/src/pokenav_unk_4.c +++ b/src/pokenav_unk_4.c @@ -39,8 +39,8 @@ struct Pokenav4Struct u8 unused18; u8 unk19; u16 unk1A; - struct Sprite *unk1C; - struct Sprite *unk20; + struct Sprite *optionsCursorSprite; + struct Sprite *trainerPicSprite; u8 unk24[0x800]; u8 unk824[0x800]; u8 unk1024[0x800]; @@ -62,26 +62,26 @@ static void sub_81CC214(void); static void sub_81CBC38(int); static void PrintMatchCallSelectionOptions(struct Pokenav4Struct *); static bool32 sub_81CBFC4(struct Pokenav4Struct *); -static void sub_81CC344(struct Pokenav4Struct *, int); -static bool32 sub_81CC004(struct Pokenav4Struct *); -static void sub_81CBFF0(struct Pokenav4Struct *); -static void sub_81CC058(struct Pokenav4Struct *); -static bool32 sub_81CC0D0(struct Pokenav4Struct *); +static void UpdateCursorGfxPos(struct Pokenav4Struct *, int); +static bool32 IsDma3ManagerBusyWithBgCopy1(struct Pokenav4Struct *); +static void UpdateWindowsReturnToTrainerList(struct Pokenav4Struct *); +static void DrawMsgBoxForMatchCallMsg(struct Pokenav4Struct *); +static bool32 IsDma3ManagerBusyWithBgCopy2(struct Pokenav4Struct *); static void PrintCallingDots(struct Pokenav4Struct *); static bool32 WaitForCallingDotsText(struct Pokenav4Struct *); static void PrintMatchCallMessage(struct Pokenav4Struct *); static bool32 WaitForMatchCallMessageText(struct Pokenav4Struct *); -static void sub_81CC09C(struct Pokenav4Struct *); +static void DrawMsgBoxForCloseByMsg(struct Pokenav4Struct *); static void PrintTrainerIsCloseBy(struct Pokenav4Struct *); static bool32 WaitForTrainerIsCloseByText(struct Pokenav4Struct *); -static void sub_81CC1DC(struct Pokenav4Struct *); -static bool32 sub_81CC204(struct Pokenav4Struct *); -static void sub_81CC014(struct Pokenav4Struct *); -static void sub_81CC39C(struct Pokenav4Struct *); -static bool32 sub_81CC42C(struct Pokenav4Struct *); -static void sub_81CC420(struct Pokenav4Struct *); +static void DrawSpinningPokenavForCall(struct Pokenav4Struct *); +static bool32 WaitForSpinningPokenav(struct Pokenav4Struct *); +static void UpdateWindowsToShowCheckPage(struct Pokenav4Struct *); +static void LoadCheckPageTrainerPic(struct Pokenav4Struct *); +static bool32 WaitForTrainerPic(struct Pokenav4Struct *); +static void TrainerPicSlideOffscreen(struct Pokenav4Struct *); static void sub_81CBC64(u8 taskId); -static void sub_81CBCEC(u16 windowId, u32, u32); +static void TryDrawRematchPokeballIcon(u16 windowId, u32, u32); static void PrintNumberRegisteredLabel(u16 windowId); static void PrintNumberRegistered(u16 windowId); static void PrintNumberOfBattlesLabel(u16 windowId); @@ -90,39 +90,39 @@ static void PrintMatchCallInfoLabel(u16 windowId, const u8 *str, int top); static void PrintMatchCallInfoNumber(u16 windowId, const u8 *str, int top); static void sub_81CC2F0(struct Pokenav4Struct *, int); static void CloseMatchCallSelectOptionsWindow(struct Pokenav4Struct *); -static struct Sprite *sub_81CC370(void); -static void sub_81CC440(struct Sprite *sprite); -static void sub_81CC4A4(struct Sprite *sprite); -void sub_81CC34C(struct Sprite *sprite); +static struct Sprite *CreateTrainerPicSprite(void); +static void SpriteCB_TrainerPicSlideOnscreen(struct Sprite *sprite); +static void SpriteCB_TrainerPicSlideOffscreen(struct Sprite *sprite); +void SpriteCB_OptionsCursor(struct Sprite *sprite); u32 MatchCallListCursorDown(s32); u32 MatchCallListCursorUp(s32); u32 MatchCallListPageDown(s32); u32 MatchCallListPageUp(s32); u32 SelectMatchCallEntry(s32); -u32 sub_81CB734(s32); -u32 sub_81CB75C(s32); +u32 MoveMatchCallOptionsCursor(s32); +static u32 CancelMatchCallSelection(s32); u32 DoMatchCallMessage(s32); u32 DoTrainerCloseByMessage(s32); u32 sub_81CB888(s32); -u32 sub_81CB93C(s32); -u32 sub_81CBAD4(s32); -u32 sub_81CB9C8(s32); -u32 sub_81CBA68(s32); -u32 sub_81CBB74(s32); +u32 ShowCheckPage(s32); +u32 ShowCheckPageUp(s32); +u32 ShowCheckPageDown(s32); +u32 ExitCheckPage(s32); +u32 ExitMatchCall(s32); -extern const struct WindowTemplate gUnknown_08622808; -extern const struct SpriteTemplate gUnknown_08622830; -extern const struct SpriteTemplate gUnknown_08622850; +extern const struct WindowTemplate sCallMsgBoxWindowTemplate; +extern const struct SpriteTemplate sOptionsCursorSpriteTemplate; +extern const struct SpriteTemplate sTrainerPicSpriteTemplate; -const u16 gUnknown_08622510[] = INCBIN_U16("graphics/pokenav/ui_matchcall.gbapal"); -const u32 gUnknown_08622530[] = INCBIN_U32("graphics/pokenav/ui_matchcall.4bpp.lz"); -const u32 gUnknown_086225D4[] = INCBIN_U32("graphics/pokenav/ui_matchcall.bin.lz"); -const u16 gUnknown_08622698[] = INCBIN_U16("graphics/pokenav/arrow2.gbapal"); -const u32 gUnknown_086226B8[] = INCBIN_U32("graphics/pokenav/arrow2.4bpp.lz"); -const u16 gUnknown_086226E0[] = INCBIN_U16("graphics/pokenav/86226E0.gbapal"); -const u16 gUnknown_08622700[] = INCBIN_U16("graphics/pokenav/8622700.gbapal"); -const u16 gUnknown_08622720[] = INCBIN_U16("graphics/pokenav/pokeball_matchcall.gbapal"); -const u32 gUnknown_08622760[] = INCBIN_U32("graphics/pokenav/pokeball_matchcall.4bpp.lz"); +static const u16 sMatchCallUI_Pal[] = INCBIN_U16("graphics/pokenav/ui_matchcall.gbapal"); +static const u32 sMatchCallUI_Gfx[] = INCBIN_U32("graphics/pokenav/ui_matchcall.4bpp.lz"); +static const u32 sMatchCallUI_Tilemap[] = INCBIN_U32("graphics/pokenav/ui_matchcall.bin.lz"); +static const u16 gUnknown_08622698[] = INCBIN_U16("graphics/pokenav/arrow2.gbapal"); +static const u32 gUnknown_086226B8[] = INCBIN_U32("graphics/pokenav/arrow2.4bpp.lz"); +static const u16 gUnknown_086226E0[] = INCBIN_U16("graphics/pokenav/86226E0.gbapal"); +static const u16 gUnknown_08622700[] = INCBIN_U16("graphics/pokenav/8622700.gbapal"); +static const u16 gUnknown_08622720[] = INCBIN_U16("graphics/pokenav/pokeball_matchcall.gbapal"); +static const u32 gUnknown_08622760[] = INCBIN_U32("graphics/pokenav/pokeball_matchcall.4bpp.lz"); const struct BgTemplate gUnknown_0862278C[3] = { @@ -155,7 +155,7 @@ const struct BgTemplate gUnknown_0862278C[3] = } }; -const LoopedTask gUnknown_08622798[] = +static const LoopedTask sMatchCallLoopTaskFuncs[] = { [POKENAV_MC_FUNC_NONE] = NULL, [POKENAV_MC_FUNC_DOWN] = MatchCallListCursorDown, @@ -163,16 +163,16 @@ const LoopedTask gUnknown_08622798[] = [POKENAV_MC_FUNC_PG_DOWN] = MatchCallListPageDown, [POKENAV_MC_FUNC_PG_UP] = MatchCallListPageUp, [POKENAV_MC_FUNC_SELECT] = SelectMatchCallEntry, - [POKENAV_MC_FUNC_6] = sub_81CB734, - [POKENAV_MC_FUNC_7] = sub_81CB75C, + [POKENAV_MC_FUNC_MOVE_OPTIONS_CURSOR] = MoveMatchCallOptionsCursor, + [POKENAV_MC_FUNC_CANCEL] = CancelMatchCallSelection, [POKENAV_MC_FUNC_CALL_MSG] = DoMatchCallMessage, [POKENAV_MC_FUNC_NEARBY_MSG] = DoTrainerCloseByMessage, [POKENAV_MC_FUNC_10] = sub_81CB888, - [POKENAV_MC_FUNC_11] = sub_81CB93C, - [POKENAV_MC_FUNC_12] = sub_81CBAD4, - [POKENAV_MC_FUNC_13] = sub_81CB9C8, - [POKENAV_MC_FUNC_14] = sub_81CBA68, - [POKENAV_MC_FUNC_15] = sub_81CBB74 + [POKENAV_MC_FUNC_SHOW_CHECK_PAGE] = ShowCheckPage, + [POKENAV_MC_FUNC_CHECK_PAGE_UP] = ShowCheckPageUp, + [POKENAV_MC_FUNC_CHECK_PAGE_DOWN] = ShowCheckPageDown, + [POKENAV_MC_FUNC_EXIT_CHECK_PAGE] = ExitCheckPage, + [POKENAV_MC_FUNC_EXIT] = ExitMatchCall }; static const struct WindowTemplate sMatchCallLocationWindowTemplate = @@ -205,9 +205,9 @@ static const u8 *const sMatchCallOptionTexts[MATCH_CALL_OPTION_COUNT] = }; // The series of 5 dots that appear when someone is called with Match Call -const u8 gText_CallingDots[] = _("·{PAUSE 0x04}·{PAUSE 0x04}·{PAUSE 0x04}·{PAUSE 0x04}·\p"); +static const u8 sText_CallingDots[] = _("·{PAUSE 0x04}·{PAUSE 0x04}·{PAUSE 0x04}·{PAUSE 0x04}·\p"); -const struct WindowTemplate gUnknown_08622808 = +const struct WindowTemplate sCallMsgBoxWindowTemplate = { .bg = 1, .tilemapLeft = 1, @@ -223,13 +223,12 @@ const struct CompressedSpriteSheet gUnknown_08622810[1] = {gUnknown_086226B8, 0x40, 7} }; -const struct SpritePalette gUnknown_08622818[] = +const struct SpritePalette gUnknown_08622818[2] = { - {gUnknown_08622698, 12}, - {} + {gUnknown_08622698, 12} }; -const struct OamData gUnknown_08622828 = +static const struct OamData sOptionsCursorOamData = { .y = 0, .affineMode = 0, @@ -243,18 +242,18 @@ const struct OamData gUnknown_08622828 = .paletteNum = 0, }; -const struct SpriteTemplate gUnknown_08622830 = +static const struct SpriteTemplate sOptionsCursorSpriteTemplate = { .tileTag = 7, .paletteTag = 12, - .oam = &gUnknown_08622828, + .oam = &sOptionsCursorOamData, .anims = gDummySpriteAnimTable, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_81CC34C, + .callback = SpriteCB_OptionsCursor, }; -const struct OamData gUnknown_08622848 = +static const struct OamData sTrainerPicOamData = { .y = 0, .affineMode = 0, @@ -268,11 +267,11 @@ const struct OamData gUnknown_08622848 = .paletteNum = 0, }; -const struct SpriteTemplate gUnknown_08622850 = +static const struct SpriteTemplate sTrainerPicSpriteTemplate = { .tileTag = 8, .paletteTag = 13, - .oam = &gUnknown_08622848, + .oam = &sTrainerPicOamData, .anims = gDummySpriteAnimTable, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, @@ -294,7 +293,7 @@ bool32 sub_81CB260(void) void sub_81CB29C(s32 index) { struct Pokenav4Struct *state = GetSubstructPtr(6); - state->unk4 = CreateLoopedTask(gUnknown_08622798[index], 1); + state->unk4 = CreateLoopedTask(sMatchCallLoopTaskFuncs[index], 1); state->unk0 = sub_81CB310; } @@ -330,11 +329,11 @@ static u32 sub_81CB324(s32 taskState) InitBgTemplates(gUnknown_0862278C, ARRAY_COUNT(gUnknown_0862278C)); ChangeBgX(2, 0, 0); ChangeBgY(2, 0, 0); - decompress_and_copy_tile_data_to_vram(2, gUnknown_08622530, 0, 0, 0); + decompress_and_copy_tile_data_to_vram(2, sMatchCallUI_Gfx, 0, 0, 0); SetBgTilemapBuffer(2, state->unk1024); - CopyToBgTilemapBuffer(2, gUnknown_086225D4, 0, 0); + CopyToBgTilemapBuffer(2, sMatchCallUI_Tilemap, 0, 0); CopyBgTilemapBufferToVram(2); - CopyPaletteIntoBufferUnfaded(gUnknown_08622510, 0x20, 0x20); + CopyPaletteIntoBufferUnfaded(sMatchCallUI_Pal, 0x20, 0x20); CopyBgTilemapBufferToVram(2); return LT_INC_AND_PAUSE; case 1: @@ -550,7 +549,7 @@ u32 SelectMatchCallEntry(s32 taskState) case 0: PlaySE(SE_SELECT); PrintMatchCallSelectionOptions(state); - sub_81C7BA4(7); + PrintHelpBarText(HELPBAR_MC_CALL_MENU); return LT_INC_AND_PAUSE; case 1: if (sub_81CBFC4(state)) @@ -561,30 +560,30 @@ u32 SelectMatchCallEntry(s32 taskState) return LT_FINISH; } -u32 sub_81CB734(s32 taskState) +u32 MoveMatchCallOptionsCursor(s32 taskState) { struct Pokenav4Struct *state; - u16 var0; + u16 cursorPos; PlaySE(SE_SELECT); state = GetSubstructPtr(6); - var0 = sub_81CB01C(); - sub_81CC344(state, var0); + cursorPos = GetMatchCallOptionCursorPos(); + UpdateCursorGfxPos(state, cursorPos); return LT_FINISH; } -u32 sub_81CB75C(s32 taskState) +u32 CancelMatchCallSelection(s32 taskState) { struct Pokenav4Struct *state = GetSubstructPtr(6); switch (taskState) { case 0: PlaySE(SE_SELECT); - sub_81CBFF0(state); - sub_81C7BA4(6); + UpdateWindowsReturnToTrainerList(state); + PrintHelpBarText(HELPBAR_MC_TRAINER_LIST); return LT_INC_AND_PAUSE; case 1: - if (sub_81CC004(state)) + if (IsDma3ManagerBusyWithBgCopy1(state)) return LT_PAUSE; break; } @@ -599,10 +598,10 @@ u32 DoMatchCallMessage(s32 taskState) { case 0: ToggleMatchCallVerticalArrows(TRUE); - sub_81CC058(state); + DrawMsgBoxForMatchCallMsg(state); return LT_INC_AND_PAUSE; case 1: - if (sub_81CC0D0(state)) + if (IsDma3ManagerBusyWithBgCopy2(state)) return LT_PAUSE; PrintCallingDots(state); @@ -631,12 +630,12 @@ u32 DoTrainerCloseByMessage(s32 taskState) { case 0: PlaySE(SE_SELECT); - sub_81CC09C(state); + DrawMsgBoxForCloseByMsg(state); ToggleMatchCallVerticalArrows(TRUE); state->unkE = 1; return LT_INC_AND_PAUSE; case 1: - if (sub_81CC0D0(state)) + if (IsDma3ManagerBusyWithBgCopy2(state)) return LT_PAUSE; PrintTrainerIsCloseBy(state); @@ -664,23 +663,23 @@ u32 sub_81CB888(s32 taskState) PlaySE(SE_SELECT); break; case 1: - sub_81CC1DC(state); + DrawSpinningPokenavForCall(state); break; case 2: - if (sub_81CC204(state)) + if (WaitForSpinningPokenav(state)) result = LT_PAUSE; break; case 3: - sub_81CBFF0(state); + UpdateWindowsReturnToTrainerList(state); break; case 4: - if (sub_81CC004(state)) + if (IsDma3ManagerBusyWithBgCopy1(state)) result = LT_PAUSE; - sub_81C7BA4(6); + PrintHelpBarText(HELPBAR_MC_TRAINER_LIST); break; case 5: - if (IsDma3ManagerBusyWithBgCopy_()) + if (WaitForHelpBar()) { result = LT_PAUSE; } @@ -714,7 +713,7 @@ u32 sub_81CB888(s32 taskState) return result; } -u32 sub_81CB93C(s32 taskState) +u32 ShowCheckPage(s32 taskState) { struct Pokenav4Struct *state = GetSubstructPtr(6); switch (taskState) @@ -722,20 +721,20 @@ u32 sub_81CB93C(s32 taskState) case 0: PlaySE(SE_SELECT); sub_81C877C(); - sub_81CC014(state); + UpdateWindowsToShowCheckPage(state); return LT_INC_AND_PAUSE; case 1: - if (sub_81C8820() || sub_81CC004(state)) + if (sub_81C8820() || IsDma3ManagerBusyWithBgCopy1(state)) return LT_PAUSE; - sub_81C7BA4(8); + PrintHelpBarText(HELPBAR_MC_CHECK_PAGE); return LT_INC_AND_PAUSE; case 2: - sub_81C87AC(0); - sub_81CC39C(state); + PrintCheckPageInfo(0); + LoadCheckPageTrainerPic(state); return LT_INC_AND_PAUSE; case 3: - if (sub_81C8820() || sub_81CC42C(state) || IsDma3ManagerBusyWithBgCopy_()) + if (sub_81C8820() || WaitForTrainerPic(state) || WaitForHelpBar()) return LT_PAUSE; break; } @@ -743,38 +742,38 @@ u32 sub_81CB93C(s32 taskState) return LT_FINISH; } -u32 sub_81CB9C8(s32 taskState) +u32 ShowCheckPageDown(s32 taskState) { - int index; - int var0; + int topId; + int delta; struct Pokenav4Struct *state = GetSubstructPtr(6); switch (taskState) { case 0: - index = GetMatchCallListTopIndex(); - var0 = sub_81CB0E4(index); - if (var0) + topId = GetMatchCallListTopIndex(); + delta = GetIndexDeltaOfNextCheckPageDown(topId); + if (delta) { PlaySE(SE_SELECT); - state->unk16 = var0; - sub_81CC420(state); + state->unk16 = delta; + TrainerPicSlideOffscreen(state); return LT_INC_AND_PAUSE; } break; case 1: - if (sub_81CC42C(state)) + if (WaitForTrainerPic(state)) return LT_PAUSE; PrintMatchCallLocation(state, state->unk16); return LT_INC_AND_PAUSE; case 2: - sub_81C87AC(state->unk16); + PrintCheckPageInfo(state->unk16); return LT_INC_AND_PAUSE; case 3: - sub_81CC39C(state); + LoadCheckPageTrainerPic(state); return LT_INC_AND_PAUSE; case 4: - if (sub_81C8820() || sub_81CC42C(state)) + if (sub_81C8820() || WaitForTrainerPic(state)) return LT_PAUSE; break; } @@ -782,21 +781,21 @@ u32 sub_81CB9C8(s32 taskState) return LT_FINISH; } -u32 sub_81CBA68(s32 taskState) +u32 ExitCheckPage(s32 taskState) { struct Pokenav4Struct *state = GetSubstructPtr(6); switch (taskState) { case 0: PlaySE(SE_SELECT); - sub_81CC420(state); + TrainerPicSlideOffscreen(state); sub_81C87F0(); return LT_INC_AND_PAUSE; case 1: - if (sub_81C8820() || sub_81CC42C(state)) + if (sub_81C8820() || WaitForTrainerPic(state)) return LT_PAUSE; - sub_81C7BA4(6); + PrintHelpBarText(HELPBAR_MC_TRAINER_LIST); UpdateMatchCallInfoBox(state); return LT_INC_AND_PAUSE; case 2: @@ -808,38 +807,38 @@ u32 sub_81CBA68(s32 taskState) return LT_FINISH; } -u32 sub_81CBAD4(s32 taskState) +u32 ShowCheckPageUp(s32 taskState) { - int index; - int var0; + int topId; + int delta; struct Pokenav4Struct *state = GetSubstructPtr(6); switch (taskState) { case 0: - index = GetMatchCallListTopIndex(); - var0 = sub_81CB128(index); - if (var0) + topId = GetMatchCallListTopIndex(); + delta = GetIndexDeltaOfNextCheckPageUp(topId); + if (delta) { PlaySE(SE_SELECT); - state->unk16 = var0; - sub_81CC420(state); + state->unk16 = delta; + TrainerPicSlideOffscreen(state); return LT_INC_AND_PAUSE; } break; case 1: - if (sub_81CC42C(state)) + if (WaitForTrainerPic(state)) return LT_PAUSE; PrintMatchCallLocation(state, state->unk16); return LT_INC_AND_PAUSE; case 2: - sub_81C87AC(state->unk16); + PrintCheckPageInfo(state->unk16); return LT_INC_AND_PAUSE; case 3: - sub_81CC39C(state); + LoadCheckPageTrainerPic(state); return LT_INC_AND_PAUSE; case 4: - if (sub_81C8820() || sub_81CC42C(state)) + if (sub_81C8820() || WaitForTrainerPic(state)) return LT_PAUSE; break; } @@ -847,7 +846,7 @@ u32 sub_81CBAD4(s32 taskState) return LT_FINISH; } -u32 sub_81CBB74(s32 taskState) +u32 ExitMatchCall(s32 taskState) { switch (taskState) { @@ -872,7 +871,7 @@ static void sub_81CBBB8(void) { struct MatchCallListTemplate template; template.unk0 = sub_81CAE94(); - template.unk4 = sub_81CAE38(); + template.unk4 = GetNumberRegistered(); template.unk8 = 4; template.unk6 = 0; template.unk9 = 13; @@ -881,8 +880,8 @@ static void sub_81CBBB8(void) template.unkC = 8; template.unkD = 3; template.unkE = 7; - template.unk10 = sub_81CB050; - template.unk14 = sub_81CBCEC; + template.unk10 = BufferMatchCallNameAndDesc; + template.unk14 = TryDrawRematchPokeballIcon; sub_81C81D4(&gUnknown_0862278C[2], &template, 2); CreateTask(sub_81CBC64, 7); } @@ -914,12 +913,12 @@ static void sub_81CBC64(u8 taskId) } } -static void sub_81CBCEC(u16 windowId, u32 arg1, u32 arg2) +static void TryDrawRematchPokeballIcon(u16 windowId, u32 rematchId, u32 arg2) { u8 bg = GetWindowAttribute(windowId, WINDOW_BG); u16 *tilemap = GetBgTilemapBuffer(bg); tilemap += arg2 * 0x40 + 0x1D; - if (sub_81CAEBC(arg1)) + if (ShouldDrawRematchPokeballIcon(rematchId)) { tilemap[0] = 0x5000; tilemap[0x20] = 0x5001; @@ -931,7 +930,7 @@ static void sub_81CBCEC(u16 windowId, u32 arg1, u32 arg2) } } -void sub_81CBD48(u16 windowId, u32 arg0) +void ClearRematchPokeballIcon(u16 windowId, u32 arg0) { u8 bg = GetWindowAttribute(windowId, WINDOW_BG); u16 *tilemap = GetBgTilemapBuffer(bg); @@ -969,7 +968,7 @@ static void PrintNumberRegisteredLabel(u16 windowId) static void PrintNumberRegistered(u16 windowId) { u8 str[3]; - ConvertIntToDecimalStringN(str, sub_81CAE38(), STR_CONV_MODE_LEFT_ALIGN, 3); + ConvertIntToDecimalStringN(str, GetNumberRegistered(), STR_CONV_MODE_LEFT_ALIGN, 3); PrintMatchCallInfoNumber(windowId, str, 1); } @@ -1007,9 +1006,9 @@ static void PrintMatchCallLocation(struct Pokenav4Struct *state, int arg1) u8 mapName[32]; int x; int index = GetSelectedMatchCall() + arg1; - int regionMapSection = sub_81CAEA4(index); - if (regionMapSection != MAPSEC_NONE) - GetMapName(mapName, regionMapSection, 0); + int mapSec = GetMatchCallMapSec(index); + if (mapSec != MAPSEC_NONE) + GetMapName(mapName, mapSec, 0); else StringCopy(mapName, gText_Unknown); @@ -1025,7 +1024,7 @@ static void PrintMatchCallSelectionOptions(struct Pokenav4Struct *state) FillWindowPixelBuffer(state->infoBoxWindowId, PIXEL_FILL(1)); for (i = 0; i < MATCH_CALL_OPTION_COUNT; i++) { - int optionText = sub_81CB02C(i); + int optionText = GetMatchCallOptionId(i); if (optionText == MATCH_CALL_OPTION_COUNT) break; @@ -1039,25 +1038,25 @@ static bool32 sub_81CBFC4(struct Pokenav4Struct *state) { if (!IsDma3ManagerBusyWithBgCopy()) { - sub_81CC2F0(state, sub_81CB01C()); + sub_81CC2F0(state, GetMatchCallOptionCursorPos()); return FALSE; } return TRUE; } -static void sub_81CBFF0(struct Pokenav4Struct *state) +static void UpdateWindowsReturnToTrainerList(struct Pokenav4Struct *state) { CloseMatchCallSelectOptionsWindow(state); UpdateMatchCallInfoBox(state); } -static bool32 sub_81CC004(struct Pokenav4Struct *state) +static bool32 IsDma3ManagerBusyWithBgCopy1(struct Pokenav4Struct *state) { return IsDma3ManagerBusyWithBgCopy(); } -static void sub_81CC014(struct Pokenav4Struct *state) +static void UpdateWindowsToShowCheckPage(struct Pokenav4Struct *state) { CloseMatchCallSelectOptionsWindow(state); FillWindowPixelBuffer(state->infoBoxWindowId, PIXEL_FILL(1)); @@ -1066,12 +1065,12 @@ static void sub_81CC014(struct Pokenav4Struct *state) static void sub_81CC034(struct Pokenav4Struct *state) { - state->msgBoxWindowId = AddWindow(&gUnknown_08622808); + state->msgBoxWindowId = AddWindow(&sCallMsgBoxWindowTemplate); sub_8197184(state->msgBoxWindowId, 1, 4); sub_81C7B40(); } -static void sub_81CC058(struct Pokenav4Struct *state) +static void DrawMsgBoxForMatchCallMsg(struct Pokenav4Struct *state) { struct Sprite *sprite; sub_8197184(state->msgBoxWindowId, 1, 4); @@ -1085,7 +1084,7 @@ static void sub_81CC058(struct Pokenav4Struct *state) sprite->pos2.y = 0; } -static void sub_81CC09C(struct Pokenav4Struct *state) +static void DrawMsgBoxForCloseByMsg(struct Pokenav4Struct *state) { LoadUserWindowBorderGfx(state->msgBoxWindowId, 1, 0x40); DrawTextBorderOuter(state->msgBoxWindowId, 1, 4); @@ -1094,14 +1093,14 @@ static void sub_81CC09C(struct Pokenav4Struct *state) CopyWindowToVram(state->msgBoxWindowId, 3); } -static bool32 sub_81CC0D0(struct Pokenav4Struct *state) +static bool32 IsDma3ManagerBusyWithBgCopy2(struct Pokenav4Struct *state) { return IsDma3ManagerBusyWithBgCopy(); } static void PrintCallingDots(struct Pokenav4Struct *state) { - AddTextPrinterParameterized(state->msgBoxWindowId, 1, gText_CallingDots, 32, 1, 1, NULL); + AddTextPrinterParameterized(state->msgBoxWindowId, 1, sText_CallingDots, 32, 1, 1, NULL); } static bool32 WaitForCallingDotsText(struct Pokenav4Struct *state) @@ -1140,16 +1139,16 @@ static bool32 WaitForMatchCallMessageText(struct Pokenav4Struct *state) return IsTextPrinterActive(state->msgBoxWindowId); } -static void sub_81CC1DC(struct Pokenav4Struct *state) +static void DrawSpinningPokenavForCall(struct Pokenav4Struct *state) { ResumeSpinningPokenavSprite(); FillBgTilemapBufferRect_Palette0(1, 0, 0, 0, 32, 20); CopyBgTilemapBufferToVram(1); } -static bool32 sub_81CC204(struct Pokenav4Struct *state) +static bool32 WaitForSpinningPokenav(struct Pokenav4Struct *state) { - return IsDma3ManagerBusyWithBgCopy(); + return IsDma3ManagerBusyWithBgCopy(); } static void sub_81CC214(void) @@ -1163,24 +1162,24 @@ static void sub_81CC214(void) LoadCompressedSpriteSheet(&gUnknown_08622810[i]); Pokenav_AllocAndLoadPalettes(gUnknown_08622818); - state->unk1C = NULL; + state->optionsCursorSprite = NULL; spriteSheet.data = state->unk1828; spriteSheet.size = 0x800; spriteSheet.tag = 8; state->unk1824 = (u8 *)OBJ_VRAM0 + LoadSpriteSheet(&spriteSheet) * 0x20; paletteNum = AllocSpritePalette(13); state->unk1A = 0x100 + paletteNum * 0x10; - state->unk20 = sub_81CC370(); - state->unk20->invisible = 1; + state->trainerPicSprite = CreateTrainerPicSprite(); + state->trainerPicSprite->invisible = TRUE; } static void sub_81CC2B4(void) { struct Pokenav4Struct *state = GetSubstructPtr(6); - if (state->unk1C) - DestroySprite(state->unk1C); - if (state->unk20) - DestroySprite(state->unk20); + if (state->optionsCursorSprite) + DestroySprite(state->optionsCursorSprite); + if (state->trainerPicSprite) + DestroySprite(state->trainerPicSprite); FreeSpriteTilesByTag(8); FreeSpriteTilesByTag(7); @@ -1190,26 +1189,26 @@ static void sub_81CC2B4(void) static void sub_81CC2F0(struct Pokenav4Struct *state, int top) { - if (!state->unk1C) + if (!state->optionsCursorSprite) { - u8 spriteId = CreateSprite(&gUnknown_08622830, 4, 80, 5); - state->unk1C = &gSprites[spriteId]; - sub_81CC344(state, top); + u8 spriteId = CreateSprite(&sOptionsCursorSpriteTemplate, 4, 80, 5); + state->optionsCursorSprite = &gSprites[spriteId]; + UpdateCursorGfxPos(state, top); } } static void CloseMatchCallSelectOptionsWindow(struct Pokenav4Struct *state) { - DestroySprite(state->unk1C); - state->unk1C = NULL; + DestroySprite(state->optionsCursorSprite); + state->optionsCursorSprite = NULL; } -static void sub_81CC344(struct Pokenav4Struct *state, int top) +static void UpdateCursorGfxPos(struct Pokenav4Struct *state, int top) { - state->unk1C->pos2.y = top * 16; + state->optionsCursorSprite->pos2.y = top * 16; } -void sub_81CC34C(struct Sprite *sprite) +void SpriteCB_OptionsCursor(struct Sprite *sprite) { if (++sprite->data[0] > 3) { @@ -1218,13 +1217,13 @@ void sub_81CC34C(struct Sprite *sprite) } } -static struct Sprite *sub_81CC370(void) +static struct Sprite *CreateTrainerPicSprite(void) { - u8 spriteId = CreateSprite(&gUnknown_08622850, 44, 104, 6); + u8 spriteId = CreateSprite(&sTrainerPicSpriteTemplate, 44, 104, 6); return &gSprites[spriteId]; } -static void sub_81CC39C(struct Pokenav4Struct *state) +static void LoadCheckPageTrainerPic(struct Pokenav4Struct *state) { u16 cursor; int trainerPic = GetMatchCallTrainerPic(GetSelectedMatchCall()); @@ -1234,23 +1233,23 @@ static void sub_81CC39C(struct Pokenav4Struct *state) LZ77UnCompWram(gTrainerFrontPicPaletteTable[trainerPic].data, state->unk2028); cursor = RequestDma3Copy(state->unk1828, state->unk1824, 0x800, 1); LoadPalette(state->unk2028, state->unk1A, 0x20); - state->unk20->data[0] = 0; - state->unk20->data[7] = cursor; - state->unk20->callback = sub_81CC440; + state->trainerPicSprite->data[0] = 0; + state->trainerPicSprite->data[7] = cursor; + state->trainerPicSprite->callback = SpriteCB_TrainerPicSlideOnscreen; } } -static void sub_81CC420(struct Pokenav4Struct *state) +static void TrainerPicSlideOffscreen(struct Pokenav4Struct *state) { - state->unk20->callback = sub_81CC4A4; + state->trainerPicSprite->callback = SpriteCB_TrainerPicSlideOffscreen; } -static bool32 sub_81CC42C(struct Pokenav4Struct *state) +static bool32 WaitForTrainerPic(struct Pokenav4Struct *state) { - return state->unk20->callback != SpriteCallbackDummy; + return state->trainerPicSprite->callback != SpriteCallbackDummy; } -static void sub_81CC440(struct Sprite *sprite) +static void SpriteCB_TrainerPicSlideOnscreen(struct Sprite *sprite) { switch (sprite->data[0]) { @@ -1258,7 +1257,7 @@ static void sub_81CC440(struct Sprite *sprite) if (CheckForSpaceForDma3Request(sprite->data[7]) != -1) { sprite->pos2.x = -80; - sprite->invisible = 0; + sprite->invisible = FALSE; sprite->data[0]++; } break; @@ -1273,12 +1272,12 @@ static void sub_81CC440(struct Sprite *sprite) } } -static void sub_81CC4A4(struct Sprite *sprite) +static void SpriteCB_TrainerPicSlideOffscreen(struct Sprite *sprite) { sprite->pos2.x -= 8; if (sprite->pos2.x <= -80) { - sprite->invisible = 1; + sprite->invisible = TRUE; sprite->callback = SpriteCallbackDummy; } } diff --git a/src/pokenav_unk_5.c b/src/pokenav_unk_5.c index 03ac05d4d..a1fd6cb72 100755 --- a/src/pokenav_unk_5.c +++ b/src/pokenav_unk_5.c @@ -401,10 +401,10 @@ u32 sub_81CC878(s32 taskState) if (sub_8123514() || sub_81CCC88()) return 2; - sub_81C7BA4(1); + PrintHelpBarText(HELPBAR_MAP_ZOOMED_OUT); return 0; case 2: - if (IsDma3ManagerBusyWithBgCopy_()) + if (WaitForHelpBar()) return 2; sub_81C7E14(4); @@ -434,10 +434,10 @@ u32 sub_81CC8D8(s32 taskState) if (sub_8123514() || sub_81CCC88()) return 2; - sub_81C7BA4(2); + PrintHelpBarText(HELPBAR_MAP_ZOOMED_IN); return 0; case 3: - if (IsDma3ManagerBusyWithBgCopy_()) + if (WaitForHelpBar()) return 2; sub_81C7E14(5); diff --git a/src/pokenav_unk_7.c b/src/pokenav_unk_7.c index 34432a077..af4519738 100644 --- a/src/pokenav_unk_7.c +++ b/src/pokenav_unk_7.c @@ -195,8 +195,8 @@ u32 sub_81CDE94(s32 state) { case 0: if (sub_81CD3C4() != TRUE) - return 2; - return 0; + return LT_PAUSE; + return LT_INC_AND_PAUSE; case 1: InitBgTemplates(gUnknown_08623358, ARRAY_COUNT(gUnknown_08623358)); ChangeBgX(1, 0, 0); @@ -209,15 +209,15 @@ u32 sub_81CDE94(s32 state) SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG2 | BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_BG3); SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(11, 4)); decompress_and_copy_tile_data_to_vram(3, gPokenavCondition_Gfx, 0, 0, 0); - return 0; + return LT_INC_AND_PAUSE; case 2: if (free_temp_tile_data_buffers_if_possible()) - return 2; + return LT_PAUSE; decompress_and_copy_tile_data_to_vram(2, gUnknown_08623228, 0, 0, 0); - return 0; + return LT_INC_AND_PAUSE; case 3: if (free_temp_tile_data_buffers_if_possible()) - return 2; + return LT_PAUSE; LZ77UnCompVram(gPokenavCondition_Tilemap, structPtr->tilemapBuffers[0]); SetBgTilemapBuffer(3, structPtr->tilemapBuffers[0]); @@ -228,26 +228,26 @@ u32 sub_81CDE94(s32 state) CopyPaletteIntoBufferUnfaded(gPokenavCondition_Pal, 0x10, 0x20); CopyPaletteIntoBufferUnfaded(gUnknown_08623208, 0xF0, 0x20); structPtr->unk1814 = -80; - return 0; + return LT_INC_AND_PAUSE; case 4: if (free_temp_tile_data_buffers_if_possible()) - return 2; + return LT_PAUSE; LZ77UnCompVram(gUnknown_0862323C, structPtr->tilemapBuffers[2]); SetBgTilemapBuffer(2, structPtr->tilemapBuffers[2]); CopyBgTilemapBufferToVram(2); CopyPaletteIntoBufferUnfaded(gUnknown_086231E8, 0x30, 0x20); sub_81D21DC(2); - return 0; + return LT_INC_AND_PAUSE; case 5: sub_8199DF0(1, 0, 0, 1); sub_8199DF0(1, 17, 1, 1); CpuFill32(0, structPtr->tilemapBuffers[1], BG_SCREEN_SIZE); SetBgTilemapBuffer(1, structPtr->tilemapBuffers[1]); - return 0; + return LT_INC_AND_PAUSE; case 6: if (free_temp_tile_data_buffers_if_possible()) - return 2; + return LT_PAUSE; structPtr->unk1820 = AddWindow(&gUnknown_08623364); if (sub_81CDD5C() == TRUE) @@ -257,29 +257,29 @@ u32 sub_81CDE94(s32 state) structPtr->unk1823 = AddWindow(&gUnknown_0862337C); } DeactivateAllTextPrinters(); - return 0; + return LT_INC_AND_PAUSE; case 7: sub_81CED30(0); - return 0; + return LT_INC_AND_PAUSE; case 8: sub_81CE9E4(); - return 0; + return LT_INC_AND_PAUSE; case 9: if (sub_81CDD5C() == TRUE) sub_81CE934(); - return 0; + return LT_INC_AND_PAUSE; case 10: sub_81CE754(0, sub_81CDC84(), TRUE); - return 0; + return LT_INC_AND_PAUSE; case 11: sub_81CE754(1, sub_81CDC84(), TRUE); - return 0; + return LT_INC_AND_PAUSE; case 12: sub_81CE754(2, sub_81CDC84(), TRUE); - return 0; + return LT_INC_AND_PAUSE; case 13: if (sub_81CE754(3, sub_81CDC84(), TRUE) != TRUE) - return 2; + return LT_PAUSE; PutWindowTilemap(structPtr->unk1820); if (sub_81CDD5C() == TRUE) { @@ -287,14 +287,14 @@ u32 sub_81CDE94(s32 state) PutWindowTilemap(structPtr->unk1822); PutWindowTilemap(structPtr->unk1823); } - return 0; + return LT_INC_AND_PAUSE; case 14: ShowBg(1); HideBg(2); ShowBg(3); if (sub_81CDD5C() == TRUE) - sub_81C7BA4(4); - return 0; + PrintHelpBarText(HELPBAR_CONDITION_MON_STATUS); + return LT_INC_AND_PAUSE; case 15: sub_81C7AC0(1); if (!sub_81CDD5C()) @@ -303,25 +303,25 @@ u32 sub_81CDE94(s32 state) sub_81C7FA0(1, TRUE, 0); sub_81C7FA0(6, TRUE, 0); } - return 0; + return LT_INC_AND_PAUSE; case 16: if (IsPaletteFadeActive()) - return 2; + return LT_PAUSE; if (!sub_81CDD5C() && sub_81C8010()) - return 2; + return LT_PAUSE; SetVBlankCallback_(sub_81CEE44); - return 0; + return LT_INC_AND_PAUSE; case 17: sub_81CEE90(); sub_81D20AC(sub_81CDC70()); - return 0; + return LT_INC_AND_PAUSE; case 18: if (sub_81D20BC(sub_81CDC70())) - return 2; - return 0; + return LT_PAUSE; + return LT_INC_AND_PAUSE; case 19: sub_81CEE74(TRUE); - return 0; + return LT_INC_AND_PAUSE; case 20: if (!sub_81D3178(sub_81CDC70(), &structPtr->unk1814)) { @@ -329,12 +329,12 @@ u32 sub_81CDE94(s32 state) if (sub_81CDD5C() == TRUE || sub_81CDC60() != sub_81CDC50()) sub_81D3480(structPtr->unk28e0, structPtr->unk1816, sub_81CDDB0()); - return 4; + return LT_FINISH; } - return 2; + return LT_PAUSE; } - return 4; + return LT_FINISH; } u32 sub_81CE2D0(s32 state) @@ -367,7 +367,7 @@ u32 sub_81CE2D0(s32 state) return 1; } - return 4; + return LT_FINISH; } u32 sub_81CE37C(s32 state) @@ -424,7 +424,7 @@ u32 sub_81CE37C(s32 state) return 2; } - return 4; + return LT_FINISH; } u32 sub_81CE4D8(s32 state) @@ -468,7 +468,7 @@ u32 sub_81CE4D8(s32 state) return 2; } - return 4; + return LT_FINISH; } u32 sub_81CE5E4(s32 state) @@ -506,7 +506,7 @@ u32 sub_81CE5E4(s32 state) return 2; } - return 4; + return LT_FINISH; } u32 sub_81CE6BC(s32 state) @@ -514,18 +514,18 @@ u32 sub_81CE6BC(s32 state) switch (state) { case 0: - sub_811FAA4(sub_81CDD7C(), 0xb0, 0x20); + sub_811FAA4(sub_81CDD7C(), 176, 32); return 1; case 1: - sub_81C7BA4(5); + PrintHelpBarText(HELPBAR_CONDITION_MARKINGS); return 1; case 2: - if (IsDma3ManagerBusyWithBgCopy_() == TRUE) + if (WaitForHelpBar() == TRUE) return 2; return 1; } - return 4; + return LT_FINISH; } u32 sub_81CE700(s32 state) @@ -536,18 +536,18 @@ u32 sub_81CE700(s32 state) sub_811FAF8(); return 1; case 1: - sub_81C7BA4(4); + PrintHelpBarText(HELPBAR_CONDITION_MON_STATUS); return 1; case 2: - if (IsDma3ManagerBusyWithBgCopy_() == TRUE) + if (WaitForHelpBar() == TRUE) return 2; return 1; } - return 4; + return LT_FINISH; } -u8 *sub_81CE738(u8 *dst, u16 num) +static u8 *UnusedPrintNumberString(u8 *dst, u16 num) { u8 *txtPtr = ConvertIntToDecimalStringN(dst, num, STR_CONV_MODE_RIGHT_ALIGN, 4); txtPtr = StringCopy(txtPtr, gText_Number2); diff --git a/src/pokenav_unk_8.c b/src/pokenav_unk_8.c index f3d0b76f9..6871292bf 100644 --- a/src/pokenav_unk_8.c +++ b/src/pokenav_unk_8.c @@ -435,7 +435,7 @@ static u32 sub_81CF418(s32 state) if (sub_81C8224()) return LT_PAUSE; sub_81CF7C8(unk); - sub_81C7BA4(3); + PrintHelpBarText(HELPBAR_CONDITION_MON_LIST); return LT_INC_AND_PAUSE; case 4: if (free_temp_tile_data_buffers_if_possible()) diff --git a/src/pokenav_unk_9.c b/src/pokenav_unk_9.c index e8078ea02..2f7d37382 100644 --- a/src/pokenav_unk_9.c +++ b/src/pokenav_unk_9.c @@ -448,7 +448,7 @@ static u32 sub_81CFEB8(s32 state) return LT_PAUSE; ShowBg(2); HideBg(3); - sub_81C7BA4(9); + PrintHelpBarText(HELPBAR_RIBBONS_MON_LIST); sub_81C7AC0(1); if (!unk->unkC) {