Move pokenav list item union out of list struct

This commit is contained in:
GriffinR 2021-11-13 11:27:11 -05:00
parent 3b91d8fdaf
commit ec05157568
5 changed files with 20 additions and 17 deletions

View File

@ -6,6 +6,7 @@
#include "pokemon_storage_system.h"
typedef u32 (*LoopedTask)(s32 state);
typedef void (*PokenavListItemBufferFunc)(struct PokenavListItem *, u8 *);
struct PokenavMonListItem
{
@ -21,12 +22,17 @@ struct PokenavMatchCallEntry
u16 headerId;
};
struct PokenavListTemplate
struct PokenavListItem
{
union {
struct PokenavMonListItem *monList;
struct PokenavMatchCallEntry *matchCallEntries;
} list;
struct PokenavMonListItem mon;
struct PokenavMatchCallEntry call;
} item;
};
struct PokenavListTemplate
{
struct PokenavListItem * list;
u16 count;
u16 unk6;
u8 unk8;
@ -36,10 +42,7 @@ struct PokenavListTemplate
u8 maxShowed;
u8 fillValue;
u8 fontId;
union {
void (*bufferMonItemFunc)(struct PokenavMonListItem *, u8 *);
void (*bufferMatchCallItemFunc)(struct PokenavMatchCallEntry *, u8 *);
} listFunc;
PokenavListItemBufferFunc bufferItemFunc;
void (*unk14)(u16 a0, u32 a1, u32 a2);
};

View File

@ -672,7 +672,7 @@ static void InitConditionSearchListMenuTemplate(void)
{
struct PokenavListTemplate template;
template.list.monList = GetSearchResultsMonDataList();
template.list = (struct PokenavListItem *)GetSearchResultsMonDataList();
template.count = GetSearchResultsMonListCount();
template.unk8 = 4;
template.unk6 = GetSearchResultsCurrentListIndex();
@ -682,7 +682,7 @@ static void InitConditionSearchListMenuTemplate(void)
template.maxShowed = 8;
template.fillValue = 2;
template.fontId = FONT_NORMAL;
template.listFunc.bufferMonItemFunc = BufferSearchMonListItem;
template.bufferItemFunc = (PokenavListItemBufferFunc)BufferSearchMonListItem;
template.unk14 = NULL;
sub_81C81D4(&sConditionSearchResultBgTemplates[1], &template, 0);
}

View File

@ -870,7 +870,7 @@ static u32 ExitMatchCall(s32 state)
static void InitMatchCallPokenavListMenuTemplate(void)
{
struct PokenavListTemplate template;
template.list.matchCallEntries = sub_81CAE94();
template.list = (struct PokenavListItem *)sub_81CAE94();
template.count = GetNumberRegistered();
template.unk8 = 4;
template.unk6 = 0;
@ -880,7 +880,7 @@ static void InitMatchCallPokenavListMenuTemplate(void)
template.maxShowed = 8;
template.fillValue = 3;
template.fontId = FONT_NARROW;
template.listFunc.bufferMatchCallItemFunc = BufferMatchCallNameAndDesc;
template.bufferItemFunc = (PokenavListItemBufferFunc)BufferMatchCallNameAndDesc;
template.unk14 = TryDrawRematchPokeballIcon;
sub_81C81D4(&sMatchCallBgTemplates[2], &template, 2);
CreateTask(Task_FlashPokeballIcons, 7);

View File

@ -49,7 +49,7 @@ struct PokenavSub17Substruct
u32 loopedTaskId;
s32 unk2C;
u32 unk30;
void (*unk34)(struct PokenavMatchCallEntry *, u8*);
PokenavListItemBufferFunc unk34;
void (*unk38)(u16, u32, u32);
struct Sprite *rightArrow;
struct Sprite *upArrow;
@ -936,7 +936,7 @@ void ToggleMatchCallVerticalArrows(bool32 shouldHide)
void InitMatchCallWindowState(struct MatchCallWindowState *dst, struct PokenavListTemplate *template)
{
dst->unk10 = template->list.matchCallEntries;
dst->unk10 = template->list;
dst->windowTopIndex = template->unk6;
dst->listLength = template->count;
dst->unkC = template->unk8;
@ -968,7 +968,7 @@ static bool32 CopyPokenavListMenuTemplate(struct PokenavSub17Substruct *dest, co
dest->listWindow.bg = bgTemplate->bg;
dest->listWindow.unk6 = a3;
dest->unk34 = template->listFunc.bufferMatchCallItemFunc;
dest->unk34 = template->bufferItemFunc;
dest->unk38 = template->unk14;
dest->listWindow.unk1 = template->fillValue;
dest->listWindow.unk2 = template->item_X;

View File

@ -680,7 +680,7 @@ static void DrawListIndexNumber(s32 windowId, s32 index, s32 max)
static void InitMonRibbonPokenavListMenuTemplate(void)
{
struct PokenavListTemplate template;
template.list.monList = GetMonRibbonMonListData();
template.list = (struct PokenavListItem *)GetMonRibbonMonListData();
template.count = GetRibbonsMonListCount();
template.unk8 = 4;
template.unk6 = GetRibbonListMenuCurrIndex();
@ -690,7 +690,7 @@ static void InitMonRibbonPokenavListMenuTemplate(void)
template.maxShowed = 8;
template.fillValue = 2;
template.fontId = FONT_NORMAL;
template.listFunc.bufferMonItemFunc = BufferRibbonMonInfoText;
template.bufferItemFunc = (PokenavListItemBufferFunc)BufferRibbonMonInfoText;
template.unk14 = NULL;
sub_81C81D4(&sMonRibbonListBgTemplates[1], &template, 0);
}