Continue pokenav list ui doc

This commit is contained in:
GriffinR 2021-11-13 12:52:41 -05:00
parent ec05157568
commit b3e593dff5
7 changed files with 419 additions and 402 deletions

View File

@ -6,7 +6,6 @@
#include "pokemon_storage_system.h" #include "pokemon_storage_system.h"
typedef u32 (*LoopedTask)(s32 state); typedef u32 (*LoopedTask)(s32 state);
typedef void (*PokenavListItemBufferFunc)(struct PokenavListItem *, u8 *);
struct PokenavMonListItem struct PokenavMonListItem
{ {
@ -30,20 +29,22 @@ struct PokenavListItem
} item; } item;
}; };
typedef void (*PokenavListBufferItemFunc)(struct PokenavListItem *, u8 *);
struct PokenavListTemplate struct PokenavListTemplate
{ {
struct PokenavListItem * list; struct PokenavListItem * list;
u16 count; u16 count;
u16 unk6; u16 startIndex;
u8 unk8; u8 itemSize;
u8 item_X; u8 item_X;
u8 windowWidth; u8 windowWidth;
u8 listTop; u8 listTop;
u8 maxShowed; u8 maxShowed;
u8 fillValue; u8 fillValue;
u8 fontId; u8 fontId;
PokenavListItemBufferFunc bufferItemFunc; PokenavListBufferItemFunc bufferItemFunc;
void (*unk14)(u16 a0, u32 a1, u32 a2); void (*iconDrawFunc)(u16 windowId, u32 listItemId, u32 baseTile);
}; };
struct PokenavMonList struct PokenavMonList
@ -87,7 +88,7 @@ enum
POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_MENU, POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_MENU,
POKENAV_SUBSTRUCT_UNUSED, POKENAV_SUBSTRUCT_UNUSED,
POKENAV_SUBSTRUCT_REGION_MAP, POKENAV_SUBSTRUCT_REGION_MAP,
POKENAV_SUBSTRUCT_MATCH_CALL_LIST, POKENAV_SUBSTRUCT_LIST,
POKENAV_SUBSTRUCT_MON_LIST, POKENAV_SUBSTRUCT_MON_LIST,
POKENAV_SUBSTRUCT_COUNT, POKENAV_SUBSTRUCT_COUNT,
}; };
@ -323,22 +324,22 @@ void SetPokenavVBlankCallback(void);
void SetVBlankCallback_(IntrCallback callback); void SetVBlankCallback_(IntrCallback callback);
// pokenav_match_call_ui.c // pokenav_match_call_ui.c
bool32 CreatePokenavList(const struct BgTemplate *bgTemplate, struct PokenavListTemplate *listTemplate, s32 tileOffset);
bool32 IsCreatePokenavListTaskActive(void);
void DestroyPokenavList(void);
u32 GetSelectedPokenavListIndex(void); u32 GetSelectedPokenavListIndex(void);
bool32 sub_81C8224(void); int PokenavList_MoveCursorUp(void);
int MatchCall_MoveCursorUp(void); int PokenavList_MoveCursorDown(void);
int MatchCall_MoveCursorDown(void); int PokenavList_PageDown(void);
int MatchCall_PageDown(void); int PokenavList_PageUp(void);
int MatchCall_PageUp(void); bool32 IsMovePokenavListWindowTaskActive(void);
bool32 IsMonListLoopedTaskActive(void); void PokenavList_ToggleVerticalArrows(bool32 shouldHide);
void ToggleMatchCallVerticalArrows(bool32 shouldHide); void PokenavList_DrawCurrentItemIcon(void);
void sub_81C8838(void);
void sub_81C877C(void); void sub_81C877C(void);
bool32 IsMatchCallListTaskActive(void); bool32 IsMatchCallListTaskActive(void);
void PrintCheckPageInfo(s16 a0); void PrintCheckPageInfo(s16 a0);
u32 GetMatchCallListTopIndex(void); u32 GetMatchCallListTopIndex(void);
void sub_81C87F0(void); void sub_81C87F0(void);
bool32 sub_81C81D4(const struct BgTemplate *arg0, struct PokenavListTemplate *arg1, s32 arg2);
void sub_81C8234(void);
// pokenav_match_call_data.c // pokenav_match_call_data.c
bool32 MatchCall_HasCheckPage(u32 idx); bool32 MatchCall_HasCheckPage(u32 idx);
@ -415,7 +416,7 @@ bool32 ShouldDrawRematchPokeballIcon(int index);
void ClearRematchPokeballIcon(u16 windowId, u32 a1); void ClearRematchPokeballIcon(u16 windowId, u32 a1);
int GetMatchCallTrainerPic(int index); int GetMatchCallTrainerPic(int index);
const u8 *GetMatchCallFlavorText(int index, int textType); const u8 *GetMatchCallFlavorText(int index, int textType);
const u8 *GetMatchCallMessageText(int index, u8 *arg1); const u8 *GetMatchCallMessageText(int index, bool8 *newRematchRequest);
u16 GetMatchCallOptionCursorPos(void); u16 GetMatchCallOptionCursorPos(void);
u16 GetMatchCallOptionId(int arg0); u16 GetMatchCallOptionId(int arg0);
void BufferMatchCallNameAndDesc(struct PokenavMatchCallEntry * arg0, u8 *str); void BufferMatchCallNameAndDesc(struct PokenavMatchCallEntry * arg0, u8 *str);

View File

@ -1499,7 +1499,7 @@ bool32 SelectMatchCallMessage(int trainerId, u8 *str)
{ {
u32 matchCallId; u32 matchCallId;
const struct MatchCallText *matchCallText; const struct MatchCallText *matchCallText;
bool32 retVal = FALSE; bool32 newRematchRequest = FALSE;
matchCallId = GetTrainerMatchCallId(trainerId); matchCallId = GetTrainerMatchCallId(trainerId);
sBattleFrontierStreakInfo.facilityId = 0; sBattleFrontierStreakInfo.facilityId = 0;
@ -1517,7 +1517,7 @@ bool32 SelectMatchCallMessage(int trainerId, u8 *str)
else if (ShouldTrainerRequestBattle(matchCallId)) else if (ShouldTrainerRequestBattle(matchCallId))
{ {
matchCallText = GetDifferentRouteMatchCallText(matchCallId, str); matchCallText = GetDifferentRouteMatchCallText(matchCallId, str);
retVal = TRUE; newRematchRequest = TRUE;
UpdateRematchIfDefeated(matchCallId); UpdateRematchIfDefeated(matchCallId);
} }
else if (Random() % 3) else if (Random() % 3)
@ -1532,7 +1532,7 @@ bool32 SelectMatchCallMessage(int trainerId, u8 *str)
} }
BuildMatchCallString(matchCallId, matchCallText, str); BuildMatchCallString(matchCallId, matchCallText, str);
return retVal; return newRematchRequest;
} }
static int GetTrainerMatchCallId(int trainerId) static int GetTrainerMatchCallId(int trainerId)

View File

@ -63,7 +63,7 @@ static bool32 GetSearchResultCurrentLoopedTaskActive(void);
static u32 LoopedTask_OpenConditionSearchResults(s32); static u32 LoopedTask_OpenConditionSearchResults(s32);
static void AddSearchResultListMenuWindow(struct Pokenav_SearchResultsGfx *); static void AddSearchResultListMenuWindow(struct Pokenav_SearchResultsGfx *);
static void PrintSearchResultListMenuItems(struct Pokenav_SearchResultsGfx *); static void PrintSearchResultListMenuItems(struct Pokenav_SearchResultsGfx *);
static void InitConditionSearchListMenuTemplate(void); static void CreateSearchResultsList(void);
static void BufferSearchMonListItem(struct PokenavMonListItem *, u8 *); static void BufferSearchMonListItem(struct PokenavMonListItem *, u8 *);
static const u32 sSearchMonDataIds[] = {MON_DATA_COOL, MON_DATA_BEAUTY, MON_DATA_CUTE, MON_DATA_SMART, MON_DATA_TOUGH}; static const u32 sSearchMonDataIds[] = {MON_DATA_COOL, MON_DATA_BEAUTY, MON_DATA_CUTE, MON_DATA_SMART, MON_DATA_TOUGH};
@ -415,7 +415,7 @@ bool32 GetSearchResultCurrentLoopedTaskActive(void)
void FreeSearchResultSubstruct2(void) void FreeSearchResultSubstruct2(void)
{ {
struct Pokenav_SearchResultsGfx *gfx = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULTS_GFX); struct Pokenav_SearchResultsGfx *gfx = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULTS_GFX);
sub_81C8234(); DestroyPokenavList();
RemoveWindow(gfx->winid); RemoveWindow(gfx->winid);
FreePokenavSubstruct(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULTS_GFX); FreePokenavSubstruct(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULTS_GFX);
} }
@ -444,10 +444,10 @@ static u32 LoopedTask_OpenConditionSearchResults(s32 state)
if (FreeTempTileDataBuffersIfPossible()) if (FreeTempTileDataBuffersIfPossible())
return LT_PAUSE; return LT_PAUSE;
CopyPaletteIntoBufferUnfaded(sListBg_Pal, 0x20, 32); CopyPaletteIntoBufferUnfaded(sListBg_Pal, 0x20, 32);
InitConditionSearchListMenuTemplate(); CreateSearchResultsList();
return LT_INC_AND_PAUSE; return LT_INC_AND_PAUSE;
case 3: case 3:
if (sub_81C8224()) if (IsCreatePokenavListTaskActive())
return LT_PAUSE; return LT_PAUSE;
AddSearchResultListMenuWindow(gfx); AddSearchResultListMenuWindow(gfx);
PrintHelpBarText(HELPBAR_CONDITION_MON_LIST); PrintHelpBarText(HELPBAR_CONDITION_MON_LIST);
@ -485,7 +485,7 @@ static u32 LoopedTask_MoveSearchListCursorUp(s32 state)
switch (state) switch (state)
{ {
case 0: case 0:
switch (MatchCall_MoveCursorUp()) switch (PokenavList_MoveCursorUp())
{ {
case 0: case 0:
return LT_FINISH; return LT_FINISH;
@ -498,7 +498,7 @@ static u32 LoopedTask_MoveSearchListCursorUp(s32 state)
} }
return LT_INC_AND_PAUSE; return LT_INC_AND_PAUSE;
case 1: case 1:
if (IsMonListLoopedTaskActive()) if (IsMovePokenavListWindowTaskActive())
return LT_PAUSE; return LT_PAUSE;
// fallthrough // fallthrough
case 2: case 2:
@ -518,7 +518,7 @@ static u32 LoopedTask_MoveSearchListCursorDown(s32 state)
switch (state) switch (state)
{ {
case 0: case 0:
switch (MatchCall_MoveCursorDown()) switch (PokenavList_MoveCursorDown())
{ {
case 0: case 0:
return LT_FINISH; return LT_FINISH;
@ -531,7 +531,7 @@ static u32 LoopedTask_MoveSearchListCursorDown(s32 state)
} }
return LT_INC_AND_PAUSE; return LT_INC_AND_PAUSE;
case 1: case 1:
if (IsMonListLoopedTaskActive()) if (IsMovePokenavListWindowTaskActive())
return LT_PAUSE; return LT_PAUSE;
// fallthrough // fallthrough
case 2: case 2:
@ -551,7 +551,7 @@ static u32 LoopedTask_MoveSearchListPageUp(s32 state)
switch (state) switch (state)
{ {
case 0: case 0:
switch (MatchCall_PageUp()) switch (PokenavList_PageUp())
{ {
case 0: case 0:
return LT_FINISH; return LT_FINISH;
@ -564,7 +564,7 @@ static u32 LoopedTask_MoveSearchListPageUp(s32 state)
} }
return LT_INC_AND_PAUSE; return LT_INC_AND_PAUSE;
case 1: case 1:
if (IsMonListLoopedTaskActive()) if (IsMovePokenavListWindowTaskActive())
return LT_PAUSE; return LT_PAUSE;
// fallthrough // fallthrough
case 2: case 2:
@ -584,7 +584,7 @@ static u32 LoopedTask_MoveSearchListPageDown(s32 state)
switch (state) switch (state)
{ {
case 0: case 0:
switch (MatchCall_PageDown()) switch (PokenavList_PageDown())
{ {
case 0: case 0:
return LT_FINISH; return LT_FINISH;
@ -597,7 +597,7 @@ static u32 LoopedTask_MoveSearchListPageDown(s32 state)
} }
return LT_INC_AND_PAUSE; return LT_INC_AND_PAUSE;
case 1: case 1:
if (IsMonListLoopedTaskActive()) if (IsMovePokenavListWindowTaskActive())
return LT_PAUSE; return LT_PAUSE;
// fallthrough // fallthrough
case 2: case 2:
@ -668,23 +668,23 @@ static void PrintSearchResultListMenuItems(struct Pokenav_SearchResultsGfx *gfx)
CopyWindowToVram(gfx->winid, COPYWIN_GFX); CopyWindowToVram(gfx->winid, COPYWIN_GFX);
} }
static void InitConditionSearchListMenuTemplate(void) static void CreateSearchResultsList(void)
{ {
struct PokenavListTemplate template; struct PokenavListTemplate template;
template.list = (struct PokenavListItem *)GetSearchResultsMonDataList(); template.list = (struct PokenavListItem *)GetSearchResultsMonDataList();
template.count = GetSearchResultsMonListCount(); template.count = GetSearchResultsMonListCount();
template.unk8 = 4; template.itemSize = sizeof(struct PokenavListItem);
template.unk6 = GetSearchResultsCurrentListIndex(); template.startIndex = GetSearchResultsCurrentListIndex();
template.item_X = 13; template.item_X = 13;
template.windowWidth = 17; template.windowWidth = 17;
template.listTop = 1; template.listTop = 1;
template.maxShowed = 8; template.maxShowed = 8;
template.fillValue = 2; template.fillValue = 2;
template.fontId = FONT_NORMAL; template.fontId = FONT_NORMAL;
template.bufferItemFunc = (PokenavListItemBufferFunc)BufferSearchMonListItem; template.bufferItemFunc = (PokenavListBufferItemFunc)BufferSearchMonListItem;
template.unk14 = NULL; template.iconDrawFunc = NULL;
sub_81C81D4(&sConditionSearchResultBgTemplates[1], &template, 0); CreatePokenavList(&sConditionSearchResultBgTemplates[1], &template, 0);
} }
static void BufferSearchMonListItem(struct PokenavMonListItem * item, u8 * dest) static void BufferSearchMonListItem(struct PokenavMonListItem * item, u8 * dest)

View File

@ -346,15 +346,15 @@ int GetMatchCallTrainerPic(int index)
return gFacilityClassToPicIndex[index]; return gFacilityClassToPicIndex[index];
} }
const u8 *GetMatchCallMessageText(int index, u8 *arg1) const u8 *GetMatchCallMessageText(int index, bool8 *newRematchRequest)
{ {
struct Pokenav3Struct *state = GetSubstructPtr(POKENAV_SUBSTRUCT_MATCH_CALL_MAIN); struct Pokenav3Struct *state = GetSubstructPtr(POKENAV_SUBSTRUCT_MATCH_CALL_MAIN);
*arg1 = 0; *newRematchRequest = FALSE;
if (!Overworld_MapTypeAllowsTeleportAndFly(gMapHeader.mapType)) if (!Overworld_MapTypeAllowsTeleportAndFly(gMapHeader.mapType))
return gText_CallCantBeMadeHere; return gText_CallCantBeMadeHere;
if (!state->matchCallEntries[index].isSpecialTrainer) if (!state->matchCallEntries[index].isSpecialTrainer)
*arg1 = SelectMatchCallMessage(GetTrainerIdxByRematchIdx(state->matchCallEntries[index].headerId), gStringVar4); *newRematchRequest = SelectMatchCallMessage(GetTrainerIdxByRematchIdx(state->matchCallEntries[index].headerId), gStringVar4);
else else
MatchCall_GetMessage(state->matchCallEntries[index].headerId, gStringVar4); MatchCall_GetMessage(state->matchCallEntries[index].headerId, gStringVar4);

View File

@ -35,7 +35,7 @@ struct Pokenav_MatchCallGfx
u32 loopTaskId; u32 loopTaskId;
u8 filler8[6]; u8 filler8[6];
bool8 unkE; bool8 unkE;
u8 unkF; bool8 newRematchRequest;
u16 locWindowId; u16 locWindowId;
u16 infoBoxWindowId; u16 infoBoxWindowId;
u16 msgBoxWindowId; u16 msgBoxWindowId;
@ -55,7 +55,7 @@ struct Pokenav_MatchCallGfx
static bool32 GetCurrentLoopedTaskActive(void); static bool32 GetCurrentLoopedTaskActive(void);
static u32 LoopedTask_OpenMatchCall(s32); static u32 LoopedTask_OpenMatchCall(s32);
static void InitMatchCallPokenavListMenuTemplate(void); static void CreateMatchCallList(void);
static void sub_81CBC1C(void); static void sub_81CBC1C(void);
static void FreeMatchCallSprites(void); static void FreeMatchCallSprites(void);
static void LoadCallWindowAndFade(struct Pokenav_MatchCallGfx *); static void LoadCallWindowAndFade(struct Pokenav_MatchCallGfx *);
@ -359,10 +359,10 @@ static u32 LoopedTask_OpenMatchCall(s32 state)
if (FreeTempTileDataBuffersIfPossible() || !sub_81CAE28()) if (FreeTempTileDataBuffersIfPossible() || !sub_81CAE28())
return LT_PAUSE; return LT_PAUSE;
InitMatchCallPokenavListMenuTemplate(); CreateMatchCallList();
return LT_INC_AND_PAUSE; return LT_INC_AND_PAUSE;
case 4: case 4:
if (sub_81C8224()) if (IsCreatePokenavListTaskActive())
return LT_PAUSE; return LT_PAUSE;
DrawMatchCallLeftColumnWindows(gfx); DrawMatchCallLeftColumnWindows(gfx);
@ -399,7 +399,7 @@ static u32 MatchCallListCursorDown(s32 state)
switch (state) switch (state)
{ {
case 0: case 0:
switch (MatchCall_MoveCursorDown()) switch (PokenavList_MoveCursorDown())
{ {
case 0: case 0:
break; break;
@ -414,7 +414,7 @@ static u32 MatchCallListCursorDown(s32 state)
} }
break; break;
case 1: case 1:
if (IsMonListLoopedTaskActive()) if (IsMovePokenavListWindowTaskActive())
return LT_PAUSE; return LT_PAUSE;
PrintMatchCallLocation(gfx, 0); PrintMatchCallLocation(gfx, 0);
@ -436,7 +436,7 @@ static u32 MatchCallListCursorUp(s32 state)
switch (state) switch (state)
{ {
case 0: case 0:
switch (MatchCall_MoveCursorUp()) switch (PokenavList_MoveCursorUp())
{ {
case 0: case 0:
break; break;
@ -451,7 +451,7 @@ static u32 MatchCallListCursorUp(s32 state)
} }
break; break;
case 1: case 1:
if (IsMonListLoopedTaskActive()) if (IsMovePokenavListWindowTaskActive())
return LT_PAUSE; return LT_PAUSE;
PrintMatchCallLocation(gfx, 0); PrintMatchCallLocation(gfx, 0);
@ -473,7 +473,7 @@ static u32 MatchCallListPageDown(s32 state)
switch (state) switch (state)
{ {
case 0: case 0:
switch (MatchCall_PageDown()) switch (PokenavList_PageDown())
{ {
case 0: case 0:
break; break;
@ -488,7 +488,7 @@ static u32 MatchCallListPageDown(s32 state)
} }
break; break;
case 1: case 1:
if (IsMonListLoopedTaskActive()) if (IsMovePokenavListWindowTaskActive())
return LT_PAUSE; return LT_PAUSE;
PrintMatchCallLocation(gfx, 0); PrintMatchCallLocation(gfx, 0);
@ -510,7 +510,7 @@ static u32 MatchCallListPageUp(s32 state)
switch (state) switch (state)
{ {
case 0: case 0:
switch (MatchCall_PageUp()) switch (PokenavList_PageUp())
{ {
case 0: case 0:
break; break;
@ -525,7 +525,7 @@ static u32 MatchCallListPageUp(s32 state)
} }
break; break;
case 1: case 1:
if (IsMonListLoopedTaskActive()) if (IsMovePokenavListWindowTaskActive())
return LT_PAUSE; return LT_PAUSE;
PrintMatchCallLocation(gfx, 0); PrintMatchCallLocation(gfx, 0);
@ -597,7 +597,7 @@ static u32 DoMatchCallMessage(s32 state)
switch (state) switch (state)
{ {
case 0: case 0:
ToggleMatchCallVerticalArrows(TRUE); PokenavList_ToggleVerticalArrows(TRUE);
DrawMsgBoxForMatchCallMsg(gfx); DrawMsgBoxForMatchCallMsg(gfx);
return LT_INC_AND_PAUSE; return LT_INC_AND_PAUSE;
case 1: case 1:
@ -631,7 +631,7 @@ static u32 DoTrainerCloseByMessage(s32 state)
case 0: case 0:
PlaySE(SE_SELECT); PlaySE(SE_SELECT);
DrawMsgBoxForCloseByMsg(gfx); DrawMsgBoxForCloseByMsg(gfx);
ToggleMatchCallVerticalArrows(TRUE); PokenavList_ToggleVerticalArrows(TRUE);
gfx->unkE = 1; gfx->unkE = 1;
return LT_INC_AND_PAUSE; return LT_INC_AND_PAUSE;
case 1: case 1:
@ -685,14 +685,16 @@ static u32 CloseMatchCallMessage(s32 state)
} }
else else
{ {
if (gfx->unkF) if (gfx->newRematchRequest)
{ {
sub_81C8838(); // This call was a new rematch request,
// add the Pokéball icon to their entry
PokenavList_DrawCurrentItemIcon();
result = LT_INC_AND_CONTINUE; result = LT_INC_AND_CONTINUE;
} }
else else
{ {
ToggleMatchCallVerticalArrows(FALSE); PokenavList_ToggleVerticalArrows(FALSE);
result = LT_FINISH; result = LT_FINISH;
} }
} }
@ -704,7 +706,7 @@ static u32 CloseMatchCallMessage(s32 state)
} }
else else
{ {
ToggleMatchCallVerticalArrows(FALSE); PokenavList_ToggleVerticalArrows(FALSE);
result = LT_FINISH; result = LT_FINISH;
} }
break; break;
@ -867,28 +869,28 @@ static u32 ExitMatchCall(s32 state)
return LT_FINISH; return LT_FINISH;
} }
static void InitMatchCallPokenavListMenuTemplate(void) static void CreateMatchCallList(void)
{ {
struct PokenavListTemplate template; struct PokenavListTemplate template;
template.list = (struct PokenavListItem *)sub_81CAE94(); template.list = (struct PokenavListItem *)sub_81CAE94();
template.count = GetNumberRegistered(); template.count = GetNumberRegistered();
template.unk8 = 4; template.itemSize = sizeof(struct PokenavListItem);
template.unk6 = 0; template.startIndex = 0;
template.item_X = 13; template.item_X = 13;
template.windowWidth = 16; template.windowWidth = 16;
template.listTop = 1; template.listTop = 1;
template.maxShowed = 8; template.maxShowed = 8;
template.fillValue = 3; template.fillValue = 3;
template.fontId = FONT_NARROW; template.fontId = FONT_NARROW;
template.bufferItemFunc = (PokenavListItemBufferFunc)BufferMatchCallNameAndDesc; template.bufferItemFunc = (PokenavListBufferItemFunc)BufferMatchCallNameAndDesc;
template.unk14 = TryDrawRematchPokeballIcon; template.iconDrawFunc = TryDrawRematchPokeballIcon;
sub_81C81D4(&sMatchCallBgTemplates[2], &template, 2); CreatePokenavList(&sMatchCallBgTemplates[2], &template, 2);
CreateTask(Task_FlashPokeballIcons, 7); CreateTask(Task_FlashPokeballIcons, 7);
} }
static void sub_81CBC1C(void) static void sub_81CBC1C(void)
{ {
sub_81C8234(); DestroyPokenavList();
DestroyTask(FindTaskIdByFunc(Task_FlashPokeballIcons)); DestroyTask(FindTaskIdByFunc(Task_FlashPokeballIcons));
} }
@ -1137,7 +1139,7 @@ static bool32 WaitForTrainerIsCloseByText(struct Pokenav_MatchCallGfx *gfx)
static void PrintMatchCallMessage(struct Pokenav_MatchCallGfx *gfx) static void PrintMatchCallMessage(struct Pokenav_MatchCallGfx *gfx)
{ {
int index = GetSelectedPokenavListIndex(); int index = GetSelectedPokenavListIndex();
const u8 *str = GetMatchCallMessageText(index, &gfx->unkF); const u8 *str = GetMatchCallMessageText(index, &gfx->newRematchRequest);
u8 speed = GetPlayerTextSpeedDelay(); u8 speed = GetPlayerTextSpeedDelay();
AddTextPrinterParameterized(gfx->msgBoxWindowId, FONT_NORMAL, str, 32, 1, speed, NULL); AddTextPrinterParameterized(gfx->msgBoxWindowId, FONT_NORMAL, str, 32, 1, speed, NULL);
} }

File diff suppressed because it is too large Load Diff

View File

@ -61,8 +61,8 @@ static u32 LoopedTask_RibbonsListOpenSummary(s32);
static void DrawListIndexNumber(s32, s32, s32); static void DrawListIndexNumber(s32, s32, s32);
static void AddRibbonsMonListWindow(struct Pokenav_RibbonsMonMenu *); static void AddRibbonsMonListWindow(struct Pokenav_RibbonsMonMenu *);
static void UpdateIndexNumberDisplay(struct Pokenav_RibbonsMonMenu *); static void UpdateIndexNumberDisplay(struct Pokenav_RibbonsMonMenu *);
static void InitMonRibbonPokenavListMenuTemplate(void); static void CreateRibbonMonsList(void);
static void BufferRibbonMonInfoText(struct PokenavMonListItem *, u8 *); static void BufferRibbonMonInfoText(struct PokenavListItem *, u8 *);
static const LoopedTask sMonRibbonListLoopTaskFuncs[] = static const LoopedTask sMonRibbonListLoopTaskFuncs[] =
{ {
@ -416,7 +416,7 @@ bool32 GetRibbonsMonCurrentLoopedTaskActive(void)
void FreeRibbonsMonMenu(void) void FreeRibbonsMonMenu(void)
{ {
struct Pokenav_RibbonsMonMenu * menu = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_MON_MENU); struct Pokenav_RibbonsMonMenu * menu = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_MON_MENU);
sub_81C8234(); DestroyPokenavList();
RemoveWindow(menu->winid); RemoveWindow(menu->winid);
FreePokenavSubstruct(POKENAV_SUBSTRUCT_RIBBONS_MON_MENU); FreePokenavSubstruct(POKENAV_SUBSTRUCT_RIBBONS_MON_MENU);
} }
@ -447,10 +447,10 @@ static u32 LoopedTask_OpenRibbonsMonList(s32 state)
if (FreeTempTileDataBuffersIfPossible()) if (FreeTempTileDataBuffersIfPossible())
return LT_PAUSE; return LT_PAUSE;
CopyPaletteIntoBufferUnfaded(sMonRibbonListUi_Pal, 0x20, 0x20); CopyPaletteIntoBufferUnfaded(sMonRibbonListUi_Pal, 0x20, 0x20);
InitMonRibbonPokenavListMenuTemplate(); CreateRibbonMonsList();
return LT_INC_AND_PAUSE; return LT_INC_AND_PAUSE;
case 3: case 3:
if (sub_81C8224()) if (IsCreatePokenavListTaskActive())
return LT_PAUSE; return LT_PAUSE;
AddRibbonsMonListWindow(menu); AddRibbonsMonListWindow(menu);
return LT_INC_AND_PAUSE; return LT_INC_AND_PAUSE;
@ -483,7 +483,7 @@ static u32 LoopedTask_RibbonsListMoveCursorUp(s32 state)
switch (state) switch (state)
{ {
case 0: case 0:
switch (MatchCall_MoveCursorUp()) switch (PokenavList_MoveCursorUp())
{ {
case 0: case 0:
return LT_FINISH; return LT_FINISH;
@ -496,7 +496,7 @@ static u32 LoopedTask_RibbonsListMoveCursorUp(s32 state)
} }
return LT_INC_AND_PAUSE; return LT_INC_AND_PAUSE;
case 1: case 1:
if (IsMonListLoopedTaskActive()) if (IsMovePokenavListWindowTaskActive())
return LT_PAUSE; return LT_PAUSE;
// fallthrough // fallthrough
case 2: case 2:
@ -516,7 +516,7 @@ static u32 LoopedTask_RibbonsListMoveCursorDown(s32 state)
switch (state) switch (state)
{ {
case 0: case 0:
switch (MatchCall_MoveCursorDown()) switch (PokenavList_MoveCursorDown())
{ {
case 0: case 0:
return LT_FINISH; return LT_FINISH;
@ -529,7 +529,7 @@ static u32 LoopedTask_RibbonsListMoveCursorDown(s32 state)
} }
return LT_INC_AND_PAUSE; return LT_INC_AND_PAUSE;
case 1: case 1:
if (IsMonListLoopedTaskActive()) if (IsMovePokenavListWindowTaskActive())
return LT_PAUSE; return LT_PAUSE;
// fallthrough // fallthrough
case 2: case 2:
@ -549,7 +549,7 @@ static u32 LoopedTask_RibbonsListMovePageUp(s32 state)
switch (state) switch (state)
{ {
case 0: case 0:
switch (MatchCall_PageUp()) switch (PokenavList_PageUp())
{ {
case 0: case 0:
return LT_FINISH; return LT_FINISH;
@ -562,7 +562,7 @@ static u32 LoopedTask_RibbonsListMovePageUp(s32 state)
} }
return LT_INC_AND_PAUSE; return LT_INC_AND_PAUSE;
case 1: case 1:
if (IsMonListLoopedTaskActive()) if (IsMovePokenavListWindowTaskActive())
return LT_PAUSE; return LT_PAUSE;
// fallthrough // fallthrough
case 2: case 2:
@ -582,7 +582,7 @@ static u32 LoopedTask_RibbonsListMovePageDown(s32 state)
switch (state) switch (state)
{ {
case 0: case 0:
switch (MatchCall_PageDown()) switch (PokenavList_PageDown())
{ {
case 0: case 0:
return LT_FINISH; return LT_FINISH;
@ -595,7 +595,7 @@ static u32 LoopedTask_RibbonsListMovePageDown(s32 state)
} }
return LT_INC_AND_PAUSE; return LT_INC_AND_PAUSE;
case 1: case 1:
if (IsMonListLoopedTaskActive()) if (IsMovePokenavListWindowTaskActive())
return LT_PAUSE; return LT_PAUSE;
// fallthrough // fallthrough
case 2: case 2:
@ -677,32 +677,32 @@ static void DrawListIndexNumber(s32 windowId, s32 index, s32 max)
AddTextPrinterParameterized(windowId, FONT_NORMAL, strbuf, x, 1, TEXT_SKIP_DRAW, NULL); AddTextPrinterParameterized(windowId, FONT_NORMAL, strbuf, x, 1, TEXT_SKIP_DRAW, NULL);
} }
static void InitMonRibbonPokenavListMenuTemplate(void) static void CreateRibbonMonsList(void)
{ {
struct PokenavListTemplate template; struct PokenavListTemplate template;
template.list = (struct PokenavListItem *)GetMonRibbonMonListData(); template.list = (struct PokenavListItem *)GetMonRibbonMonListData();
template.count = GetRibbonsMonListCount(); template.count = GetRibbonsMonListCount();
template.unk8 = 4; template.itemSize = sizeof(struct PokenavListItem);
template.unk6 = GetRibbonListMenuCurrIndex(); template.startIndex = GetRibbonListMenuCurrIndex();
template.item_X = 13; template.item_X = 13;
template.windowWidth = 17; template.windowWidth = 17;
template.listTop = 1; template.listTop = 1;
template.maxShowed = 8; template.maxShowed = 8;
template.fillValue = 2; template.fillValue = 2;
template.fontId = FONT_NORMAL; template.fontId = FONT_NORMAL;
template.bufferItemFunc = (PokenavListItemBufferFunc)BufferRibbonMonInfoText; template.bufferItemFunc = BufferRibbonMonInfoText;
template.unk14 = NULL; template.iconDrawFunc = NULL;
sub_81C81D4(&sMonRibbonListBgTemplates[1], &template, 0); CreatePokenavList(&sMonRibbonListBgTemplates[1], &template, 0);
} }
// Buffers the "Nickname gender/level" text for the ribbon mon list // Buffers the "Nickname gender/level" text for the ribbon mon list
static void BufferRibbonMonInfoText(struct PokenavMonListItem * item0, u8 * dest) static void BufferRibbonMonInfoText(struct PokenavListItem * listItem, u8 * dest)
{ {
u8 gender; u8 gender;
u8 level; u8 level;
u8 * s; u8 * s;
const u8 * genderStr; const u8 * genderStr;
struct PokenavMonListItem * item = item0; struct PokenavMonListItem * item = (struct PokenavMonListItem *)listItem;
// Mon is in party // Mon is in party
if (item->boxId == TOTAL_BOXES_COUNT) if (item->boxId == TOTAL_BOXES_COUNT)