summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGriffinR <griffin.g.richards@gmail.com>2021-11-13 11:27:11 -0500
committerGriffinR <griffin.g.richards@gmail.com>2021-11-13 11:27:11 -0500
commitec051575683a781d912ded5837936f409057539e (patch)
tree49aed161a5f560fa70688df87461040ca457e30b
parent3b91d8fdaf2a1e13c4af938dfb867d407ccb280f (diff)
Move pokenav list item union out of list struct
-rw-r--r--include/pokenav.h19
-rw-r--r--src/pokenav_conditions_search_results.c4
-rwxr-xr-xsrc/pokenav_match_call_2.c4
-rw-r--r--src/pokenav_match_call_ui.c6
-rw-r--r--src/pokenav_ribbons_list.c4
5 files changed, 20 insertions, 17 deletions
diff --git a/include/pokenav.h b/include/pokenav.h
index 254f9c7f7..68c33bf7c 100644
--- a/include/pokenav.h
+++ b/include/pokenav.h
@@ -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);
};
diff --git a/src/pokenav_conditions_search_results.c b/src/pokenav_conditions_search_results.c
index 2151fdc42..c58b22ecf 100644
--- a/src/pokenav_conditions_search_results.c
+++ b/src/pokenav_conditions_search_results.c
@@ -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);
}
diff --git a/src/pokenav_match_call_2.c b/src/pokenav_match_call_2.c
index ae900c61d..5f5792504 100755
--- a/src/pokenav_match_call_2.c
+++ b/src/pokenav_match_call_2.c
@@ -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);
diff --git a/src/pokenav_match_call_ui.c b/src/pokenav_match_call_ui.c
index 2cf6bf24e..8392b613c 100644
--- a/src/pokenav_match_call_ui.c
+++ b/src/pokenav_match_call_ui.c
@@ -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;
diff --git a/src/pokenav_ribbons_list.c b/src/pokenav_ribbons_list.c
index c07460bee..4233819a3 100644
--- a/src/pokenav_ribbons_list.c
+++ b/src/pokenav_ribbons_list.c
@@ -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);
}