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"
typedef u32 (*LoopedTask)(s32 state);
typedef void (*PokenavListItemBufferFunc)(struct PokenavListItem *, u8 *);
struct PokenavMonListItem
{
@ -30,20 +29,22 @@ struct PokenavListItem
} item;
};
typedef void (*PokenavListBufferItemFunc)(struct PokenavListItem *, u8 *);
struct PokenavListTemplate
{
struct PokenavListItem * list;
u16 count;
u16 unk6;
u8 unk8;
u16 startIndex;
u8 itemSize;
u8 item_X;
u8 windowWidth;
u8 listTop;
u8 maxShowed;
u8 fillValue;
u8 fontId;
PokenavListItemBufferFunc bufferItemFunc;
void (*unk14)(u16 a0, u32 a1, u32 a2);
PokenavListBufferItemFunc bufferItemFunc;
void (*iconDrawFunc)(u16 windowId, u32 listItemId, u32 baseTile);
};
struct PokenavMonList
@ -87,7 +88,7 @@ enum
POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_MENU,
POKENAV_SUBSTRUCT_UNUSED,
POKENAV_SUBSTRUCT_REGION_MAP,
POKENAV_SUBSTRUCT_MATCH_CALL_LIST,
POKENAV_SUBSTRUCT_LIST,
POKENAV_SUBSTRUCT_MON_LIST,
POKENAV_SUBSTRUCT_COUNT,
};
@ -323,22 +324,22 @@ void SetPokenavVBlankCallback(void);
void SetVBlankCallback_(IntrCallback callback);
// 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);
bool32 sub_81C8224(void);
int MatchCall_MoveCursorUp(void);
int MatchCall_MoveCursorDown(void);
int MatchCall_PageDown(void);
int MatchCall_PageUp(void);
bool32 IsMonListLoopedTaskActive(void);
void ToggleMatchCallVerticalArrows(bool32 shouldHide);
void sub_81C8838(void);
int PokenavList_MoveCursorUp(void);
int PokenavList_MoveCursorDown(void);
int PokenavList_PageDown(void);
int PokenavList_PageUp(void);
bool32 IsMovePokenavListWindowTaskActive(void);
void PokenavList_ToggleVerticalArrows(bool32 shouldHide);
void PokenavList_DrawCurrentItemIcon(void);
void sub_81C877C(void);
bool32 IsMatchCallListTaskActive(void);
void PrintCheckPageInfo(s16 a0);
u32 GetMatchCallListTopIndex(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
bool32 MatchCall_HasCheckPage(u32 idx);
@ -415,7 +416,7 @@ 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);
const u8 *GetMatchCallMessageText(int index, bool8 *newRematchRequest);
u16 GetMatchCallOptionCursorPos(void);
u16 GetMatchCallOptionId(int arg0);
void BufferMatchCallNameAndDesc(struct PokenavMatchCallEntry * arg0, u8 *str);

View File

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

View File

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

View File

@ -346,15 +346,15 @@ int GetMatchCallTrainerPic(int 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);
*arg1 = 0;
*newRematchRequest = FALSE;
if (!Overworld_MapTypeAllowsTeleportAndFly(gMapHeader.mapType))
return gText_CallCantBeMadeHere;
if (!state->matchCallEntries[index].isSpecialTrainer)
*arg1 = SelectMatchCallMessage(GetTrainerIdxByRematchIdx(state->matchCallEntries[index].headerId), gStringVar4);
*newRematchRequest = SelectMatchCallMessage(GetTrainerIdxByRematchIdx(state->matchCallEntries[index].headerId), gStringVar4);
else
MatchCall_GetMessage(state->matchCallEntries[index].headerId, gStringVar4);

View File

@ -35,7 +35,7 @@ struct Pokenav_MatchCallGfx
u32 loopTaskId;
u8 filler8[6];
bool8 unkE;
u8 unkF;
bool8 newRematchRequest;
u16 locWindowId;
u16 infoBoxWindowId;
u16 msgBoxWindowId;
@ -55,7 +55,7 @@ struct Pokenav_MatchCallGfx
static bool32 GetCurrentLoopedTaskActive(void);
static u32 LoopedTask_OpenMatchCall(s32);
static void InitMatchCallPokenavListMenuTemplate(void);
static void CreateMatchCallList(void);
static void sub_81CBC1C(void);
static void FreeMatchCallSprites(void);
static void LoadCallWindowAndFade(struct Pokenav_MatchCallGfx *);
@ -359,10 +359,10 @@ static u32 LoopedTask_OpenMatchCall(s32 state)
if (FreeTempTileDataBuffersIfPossible() || !sub_81CAE28())
return LT_PAUSE;
InitMatchCallPokenavListMenuTemplate();
CreateMatchCallList();
return LT_INC_AND_PAUSE;
case 4:
if (sub_81C8224())
if (IsCreatePokenavListTaskActive())
return LT_PAUSE;
DrawMatchCallLeftColumnWindows(gfx);
@ -399,7 +399,7 @@ static u32 MatchCallListCursorDown(s32 state)
switch (state)
{
case 0:
switch (MatchCall_MoveCursorDown())
switch (PokenavList_MoveCursorDown())
{
case 0:
break;
@ -414,7 +414,7 @@ static u32 MatchCallListCursorDown(s32 state)
}
break;
case 1:
if (IsMonListLoopedTaskActive())
if (IsMovePokenavListWindowTaskActive())
return LT_PAUSE;
PrintMatchCallLocation(gfx, 0);
@ -436,7 +436,7 @@ static u32 MatchCallListCursorUp(s32 state)
switch (state)
{
case 0:
switch (MatchCall_MoveCursorUp())
switch (PokenavList_MoveCursorUp())
{
case 0:
break;
@ -451,7 +451,7 @@ static u32 MatchCallListCursorUp(s32 state)
}
break;
case 1:
if (IsMonListLoopedTaskActive())
if (IsMovePokenavListWindowTaskActive())
return LT_PAUSE;
PrintMatchCallLocation(gfx, 0);
@ -473,7 +473,7 @@ static u32 MatchCallListPageDown(s32 state)
switch (state)
{
case 0:
switch (MatchCall_PageDown())
switch (PokenavList_PageDown())
{
case 0:
break;
@ -488,7 +488,7 @@ static u32 MatchCallListPageDown(s32 state)
}
break;
case 1:
if (IsMonListLoopedTaskActive())
if (IsMovePokenavListWindowTaskActive())
return LT_PAUSE;
PrintMatchCallLocation(gfx, 0);
@ -510,7 +510,7 @@ static u32 MatchCallListPageUp(s32 state)
switch (state)
{
case 0:
switch (MatchCall_PageUp())
switch (PokenavList_PageUp())
{
case 0:
break;
@ -525,7 +525,7 @@ static u32 MatchCallListPageUp(s32 state)
}
break;
case 1:
if (IsMonListLoopedTaskActive())
if (IsMovePokenavListWindowTaskActive())
return LT_PAUSE;
PrintMatchCallLocation(gfx, 0);
@ -597,7 +597,7 @@ static u32 DoMatchCallMessage(s32 state)
switch (state)
{
case 0:
ToggleMatchCallVerticalArrows(TRUE);
PokenavList_ToggleVerticalArrows(TRUE);
DrawMsgBoxForMatchCallMsg(gfx);
return LT_INC_AND_PAUSE;
case 1:
@ -631,7 +631,7 @@ static u32 DoTrainerCloseByMessage(s32 state)
case 0:
PlaySE(SE_SELECT);
DrawMsgBoxForCloseByMsg(gfx);
ToggleMatchCallVerticalArrows(TRUE);
PokenavList_ToggleVerticalArrows(TRUE);
gfx->unkE = 1;
return LT_INC_AND_PAUSE;
case 1:
@ -685,14 +685,16 @@ static u32 CloseMatchCallMessage(s32 state)
}
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;
}
else
{
ToggleMatchCallVerticalArrows(FALSE);
PokenavList_ToggleVerticalArrows(FALSE);
result = LT_FINISH;
}
}
@ -704,7 +706,7 @@ static u32 CloseMatchCallMessage(s32 state)
}
else
{
ToggleMatchCallVerticalArrows(FALSE);
PokenavList_ToggleVerticalArrows(FALSE);
result = LT_FINISH;
}
break;
@ -867,28 +869,28 @@ static u32 ExitMatchCall(s32 state)
return LT_FINISH;
}
static void InitMatchCallPokenavListMenuTemplate(void)
static void CreateMatchCallList(void)
{
struct PokenavListTemplate template;
template.list = (struct PokenavListItem *)sub_81CAE94();
template.count = GetNumberRegistered();
template.unk8 = 4;
template.unk6 = 0;
template.itemSize = sizeof(struct PokenavListItem);
template.startIndex = 0;
template.item_X = 13;
template.windowWidth = 16;
template.listTop = 1;
template.maxShowed = 8;
template.fillValue = 3;
template.fontId = FONT_NARROW;
template.bufferItemFunc = (PokenavListItemBufferFunc)BufferMatchCallNameAndDesc;
template.unk14 = TryDrawRematchPokeballIcon;
sub_81C81D4(&sMatchCallBgTemplates[2], &template, 2);
template.bufferItemFunc = (PokenavListBufferItemFunc)BufferMatchCallNameAndDesc;
template.iconDrawFunc = TryDrawRematchPokeballIcon;
CreatePokenavList(&sMatchCallBgTemplates[2], &template, 2);
CreateTask(Task_FlashPokeballIcons, 7);
}
static void sub_81CBC1C(void)
{
sub_81C8234();
DestroyPokenavList();
DestroyTask(FindTaskIdByFunc(Task_FlashPokeballIcons));
}
@ -1137,7 +1139,7 @@ static bool32 WaitForTrainerIsCloseByText(struct Pokenav_MatchCallGfx *gfx)
static void PrintMatchCallMessage(struct Pokenav_MatchCallGfx *gfx)
{
int index = GetSelectedPokenavListIndex();
const u8 *str = GetMatchCallMessageText(index, &gfx->unkF);
const u8 *str = GetMatchCallMessageText(index, &gfx->newRematchRequest);
u8 speed = GetPlayerTextSpeedDelay();
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 AddRibbonsMonListWindow(struct Pokenav_RibbonsMonMenu *);
static void UpdateIndexNumberDisplay(struct Pokenav_RibbonsMonMenu *);
static void InitMonRibbonPokenavListMenuTemplate(void);
static void BufferRibbonMonInfoText(struct PokenavMonListItem *, u8 *);
static void CreateRibbonMonsList(void);
static void BufferRibbonMonInfoText(struct PokenavListItem *, u8 *);
static const LoopedTask sMonRibbonListLoopTaskFuncs[] =
{
@ -416,7 +416,7 @@ bool32 GetRibbonsMonCurrentLoopedTaskActive(void)
void FreeRibbonsMonMenu(void)
{
struct Pokenav_RibbonsMonMenu * menu = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_MON_MENU);
sub_81C8234();
DestroyPokenavList();
RemoveWindow(menu->winid);
FreePokenavSubstruct(POKENAV_SUBSTRUCT_RIBBONS_MON_MENU);
}
@ -447,10 +447,10 @@ static u32 LoopedTask_OpenRibbonsMonList(s32 state)
if (FreeTempTileDataBuffersIfPossible())
return LT_PAUSE;
CopyPaletteIntoBufferUnfaded(sMonRibbonListUi_Pal, 0x20, 0x20);
InitMonRibbonPokenavListMenuTemplate();
CreateRibbonMonsList();
return LT_INC_AND_PAUSE;
case 3:
if (sub_81C8224())
if (IsCreatePokenavListTaskActive())
return LT_PAUSE;
AddRibbonsMonListWindow(menu);
return LT_INC_AND_PAUSE;
@ -483,7 +483,7 @@ static u32 LoopedTask_RibbonsListMoveCursorUp(s32 state)
switch (state)
{
case 0:
switch (MatchCall_MoveCursorUp())
switch (PokenavList_MoveCursorUp())
{
case 0:
return LT_FINISH;
@ -496,7 +496,7 @@ static u32 LoopedTask_RibbonsListMoveCursorUp(s32 state)
}
return LT_INC_AND_PAUSE;
case 1:
if (IsMonListLoopedTaskActive())
if (IsMovePokenavListWindowTaskActive())
return LT_PAUSE;
// fallthrough
case 2:
@ -516,7 +516,7 @@ static u32 LoopedTask_RibbonsListMoveCursorDown(s32 state)
switch (state)
{
case 0:
switch (MatchCall_MoveCursorDown())
switch (PokenavList_MoveCursorDown())
{
case 0:
return LT_FINISH;
@ -529,7 +529,7 @@ static u32 LoopedTask_RibbonsListMoveCursorDown(s32 state)
}
return LT_INC_AND_PAUSE;
case 1:
if (IsMonListLoopedTaskActive())
if (IsMovePokenavListWindowTaskActive())
return LT_PAUSE;
// fallthrough
case 2:
@ -549,7 +549,7 @@ static u32 LoopedTask_RibbonsListMovePageUp(s32 state)
switch (state)
{
case 0:
switch (MatchCall_PageUp())
switch (PokenavList_PageUp())
{
case 0:
return LT_FINISH;
@ -562,7 +562,7 @@ static u32 LoopedTask_RibbonsListMovePageUp(s32 state)
}
return LT_INC_AND_PAUSE;
case 1:
if (IsMonListLoopedTaskActive())
if (IsMovePokenavListWindowTaskActive())
return LT_PAUSE;
// fallthrough
case 2:
@ -582,7 +582,7 @@ static u32 LoopedTask_RibbonsListMovePageDown(s32 state)
switch (state)
{
case 0:
switch (MatchCall_PageDown())
switch (PokenavList_PageDown())
{
case 0:
return LT_FINISH;
@ -595,7 +595,7 @@ static u32 LoopedTask_RibbonsListMovePageDown(s32 state)
}
return LT_INC_AND_PAUSE;
case 1:
if (IsMonListLoopedTaskActive())
if (IsMovePokenavListWindowTaskActive())
return LT_PAUSE;
// fallthrough
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);
}
static void InitMonRibbonPokenavListMenuTemplate(void)
static void CreateRibbonMonsList(void)
{
struct PokenavListTemplate template;
template.list = (struct PokenavListItem *)GetMonRibbonMonListData();
template.count = GetRibbonsMonListCount();
template.unk8 = 4;
template.unk6 = GetRibbonListMenuCurrIndex();
template.itemSize = sizeof(struct PokenavListItem);
template.startIndex = GetRibbonListMenuCurrIndex();
template.item_X = 13;
template.windowWidth = 17;
template.listTop = 1;
template.maxShowed = 8;
template.fillValue = 2;
template.fontId = FONT_NORMAL;
template.bufferItemFunc = (PokenavListItemBufferFunc)BufferRibbonMonInfoText;
template.unk14 = NULL;
sub_81C81D4(&sMonRibbonListBgTemplates[1], &template, 0);
template.bufferItemFunc = BufferRibbonMonInfoText;
template.iconDrawFunc = NULL;
CreatePokenavList(&sMonRibbonListBgTemplates[1], &template, 0);
}
// 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 level;
u8 * s;
const u8 * genderStr;
struct PokenavMonListItem * item = item0;
struct PokenavMonListItem * item = (struct PokenavMonListItem *)listItem;
// Mon is in party
if (item->boxId == TOTAL_BOXES_COUNT)