From 3d4c2142ede06ff58b95441d9c09b5864161ab65 Mon Sep 17 00:00:00 2001 From: Mike-Goutokuji <83477269+mike-goutokuji@users.noreply.github.com> Date: Thu, 11 Jun 2026 23:39:53 -0400 Subject: [PATCH] Put tilemapBuffer in PokenavListSub, and rename PokenavListSub to PokenavListView PokenavListView best describes everything since it is related to graphics and what it shown. --- include/pokenav.h | 2 +- src/pokenav_list.c | 202 ++++++++++++++++++++++----------------------- 2 files changed, 102 insertions(+), 102 deletions(-) diff --git a/include/pokenav.h b/include/pokenav.h index b5488242348b..5ca3ef9b208f 100644 --- a/include/pokenav.h +++ b/include/pokenav.h @@ -324,7 +324,7 @@ void SetPokenavVBlankCallback(void); void SetVBlankCallback_(IntrCallback callback); // pokenav_list.c -bool32 CreatePokenavList(const struct BgTemplate *bgTemplate, struct PokenavListTemplate *listTemplate, s32 tileOffset); +bool32 CreatePokenavList(const struct BgTemplate *bgTemplate, struct PokenavListTemplate *listTemplate, u32 tileOffset); bool32 IsCreatePokenavListTaskActive(void); void DestroyPokenavList(void); u32 PokenavList_GetSelectedIndex(void); diff --git a/src/pokenav_list.c b/src/pokenav_list.c index 92e1f8ffd550..21549afbac4e 100644 --- a/src/pokenav_list.c +++ b/src/pokenav_list.c @@ -37,7 +37,7 @@ struct PokenavListWindowState { void *listPtr; }; -struct PokenavListSub +struct PokenavListView { struct PokenavListMenuWindow listWindow; u32 printStart; @@ -55,36 +55,36 @@ struct PokenavListSub struct Sprite *upArrow; struct Sprite *downArrow; u8 itemTextBuffer[64]; + u8 tilemapBuffer[BG_SCREEN_SIZE]; }; struct PokenavList { - struct PokenavListSub sub; - u8 tilemapBuffer[BG_SCREEN_SIZE]; + struct PokenavListView view; struct PokenavListWindowState windowState; s32 eraseIndex; u32 loopedTaskId; }; -static void InitPokenavListBg(struct PokenavList *); -static bool32 CopyPokenavListMenuTemplate(struct PokenavListSub *, const struct BgTemplate *, struct PokenavListTemplate *, s32); -static void InitPokenavListWindowState(struct PokenavListWindowState *, struct PokenavListTemplate *); +static void InitPokenavListBg(struct PokenavListView *); +static bool32 CopyPokenavListMenuTemplate(struct PokenavListView *, const struct BgTemplate *, const struct PokenavListTemplate *, u32); +static void InitPokenavListWindowState(struct PokenavListWindowState *, const struct PokenavListTemplate *); static void SpriteCB_UpArrow(struct Sprite *); static void SpriteCB_DownArrow(struct Sprite *); static void SpriteCB_RightArrow(struct Sprite *); -static void ToggleListArrows(struct PokenavListSub *, bool32); -static void DestroyListArrows(struct PokenavListSub *); -static void CreateListArrowSprites(struct PokenavListWindowState *, struct PokenavListSub *); +static void ToggleListArrows(struct PokenavListView *, bool32); +static void DestroyListArrows(struct PokenavListView *); +static void CreateListArrowSprites(const struct PokenavListWindowState *, struct PokenavListView *); static void LoadListArrowGfx(void); -static void PrintMatchCallFlavorText(struct PokenavListWindowState *, struct PokenavListSub *, u32); -static void PrintMatchCallFieldNames(struct PokenavListSub *, u32); -static void PrintMatchCallListTrainerName(struct PokenavListWindowState *, struct PokenavListSub *); -static void PrintCheckPageTrainerName(struct PokenavListWindowState *, struct PokenavListSub *); +static void PrintMatchCallFlavorText(struct PokenavListWindowState *, struct PokenavListView *, u32); +static void PrintMatchCallFieldNames(struct PokenavListView *, u32); +static void PrintMatchCallListTrainerName(struct PokenavListWindowState *, struct PokenavListView *); +static void PrintCheckPageTrainerName(struct PokenavListWindowState *, struct PokenavListView *); static void EraseListEntry(struct PokenavListMenuWindow *, s32, s32); -static void CreateMoveListWindowTask(s32, struct PokenavListSub *); -static void PrintListItems(void *, u32, u32, u32, u32, struct PokenavListSub *); -static void InitListItems(struct PokenavListWindowState *, struct PokenavListSub *); -static void InitPokenavListWindow(struct PokenavListMenuWindow *); +static void CreateMoveListWindowTask(s32, struct PokenavListView *); +static void PrintListItems(void *, u32, u32, u32, u32, struct PokenavListView *); +static void InitListItems(const struct PokenavListWindowState *, struct PokenavListView *); +static void InitPokenavListWindow(const struct PokenavListMenuWindow *); static u32 LoopedTask_CreatePokenavList(s32); static bool32 IsPrintListItemsTaskActive(void); static u32 LoopedTask_PrintListItems(s32); @@ -98,14 +98,14 @@ static const u32 sListArrow_Gfx[] = INCGFX_U32("graphics/pokenav/list_arrows.png static EWRAM_DATA u32 sMoveWindowDownIndex = 0; // Read, but pointlessly -bool32 CreatePokenavList(const struct BgTemplate *bgTemplate, struct PokenavListTemplate *listTemplate, s32 tileOffset) +bool32 CreatePokenavList(const struct BgTemplate *bgTemplate, struct PokenavListTemplate *listTemplate, u32 tileOffset) { struct PokenavList *list = AllocSubstruct(POKENAV_SUBSTRUCT_LIST, sizeof(struct PokenavList)); if (list == NULL) return FALSE; InitPokenavListWindowState(&list->windowState, listTemplate); - if (!CopyPokenavListMenuTemplate(&list->sub, bgTemplate, listTemplate, tileOffset)) + if (!CopyPokenavListMenuTemplate(&list->view, bgTemplate, listTemplate, tileOffset)) return FALSE; CreateLoopedTask(LoopedTask_CreatePokenavList, 6); @@ -120,8 +120,8 @@ bool32 IsCreatePokenavListTaskActive(void) void DestroyPokenavList(void) { struct PokenavList *list = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); - DestroyListArrows(&list->sub); - RemoveWindow(list->sub.listWindow.windowId); + DestroyListArrows(&list->view); + RemoveWindow(list->view.listWindow.windowId); FreePokenavSubstruct(POKENAV_SUBSTRUCT_LIST); } @@ -137,13 +137,13 @@ static u32 LoopedTask_CreatePokenavList(s32 state) switch (state) { case 0: - InitPokenavListBg(list); + InitPokenavListBg(&list->view); return LT_INC_AND_PAUSE; case 1: - InitPokenavListWindow(&list->sub.listWindow); + InitPokenavListWindow(&list->view.listWindow); return LT_INC_AND_PAUSE; case 2: - InitListItems(&list->windowState, &list->sub); + InitListItems(&list->windowState, &list->view); return LT_INC_AND_PAUSE; case 3: if (IsPrintListItemsTaskActive()) @@ -156,43 +156,43 @@ static u32 LoopedTask_CreatePokenavList(s32 state) return LT_INC_AND_CONTINUE; } case 4: - CreateListArrowSprites(&list->windowState, &list->sub); + CreateListArrowSprites(&list->windowState, &list->view); return LT_FINISH; default: return LT_FINISH; } } -static void InitPokenavListBg(struct PokenavList *list) +static void InitPokenavListBg(struct PokenavListView *view) { - u16 tileNum = (list->sub.listWindow.fillValue << 12) | list->sub.listWindow.tileOffset; - BgDmaFill(list->sub.listWindow.bg, PIXEL_FILL(1), list->sub.listWindow.tileOffset, 1); - BgDmaFill(list->sub.listWindow.bg, PIXEL_FILL(4), list->sub.listWindow.tileOffset + 1, 1); - SetBgTilemapBuffer(list->sub.listWindow.bg, list->tilemapBuffer); - FillBgTilemapBufferRect_Palette0(list->sub.listWindow.bg, tileNum, 0, 0, 32, 32); - ChangeBgY(list->sub.listWindow.bg, 0, BG_COORD_SET); - ChangeBgX(list->sub.listWindow.bg, 0, BG_COORD_SET); - ChangeBgY(list->sub.listWindow.bg, list->sub.listWindow.y << 11, BG_COORD_SUB); - CopyBgTilemapBufferToVram(list->sub.listWindow.bg); + u16 tileNum = (view->listWindow.fillValue << 12) | view->listWindow.tileOffset; + BgDmaFill(view->listWindow.bg, PIXEL_FILL(1), view->listWindow.tileOffset, 1); + BgDmaFill(view->listWindow.bg, PIXEL_FILL(4), view->listWindow.tileOffset + 1, 1); + SetBgTilemapBuffer(view->listWindow.bg, view->tilemapBuffer); + FillBgTilemapBufferRect_Palette0(view->listWindow.bg, tileNum, 0, 0, 32, 32); + ChangeBgY(view->listWindow.bg, 0, BG_COORD_SET); + ChangeBgX(view->listWindow.bg, 0, BG_COORD_SET); + ChangeBgY(view->listWindow.bg, view->listWindow.y << 11, BG_COORD_SUB); + CopyBgTilemapBufferToVram(view->listWindow.bg); } -static void InitPokenavListWindow(struct PokenavListMenuWindow *listWindow) +static void InitPokenavListWindow(const struct PokenavListMenuWindow *listWindow) { FillWindowPixelBuffer(listWindow->windowId, PIXEL_FILL(1)); PutWindowTilemap(listWindow->windowId); CopyWindowToVram(listWindow->windowId, COPYWIN_MAP); } -static void InitListItems(struct PokenavListWindowState *windowState, struct PokenavListSub *subPtr) +static void InitListItems(const struct PokenavListWindowState *windowState, struct PokenavListView *viewPtr) { s32 numToPrint = windowState->listLength - windowState->windowTopIndex; if (numToPrint > windowState->entriesOnscreen) numToPrint = windowState->entriesOnscreen; - PrintListItems(windowState->listPtr, windowState->windowTopIndex, numToPrint, windowState->listItemSize, 0, subPtr); + PrintListItems(windowState->listPtr, windowState->windowTopIndex, numToPrint, windowState->listItemSize, 0, viewPtr); } -static void PrintListItems(void *listPtr, u32 topIndex, u32 numItems, u32 itemSize, u32 printStart, struct PokenavListSub *list) +static void PrintListItems(void *listPtr, u32 topIndex, u32 numItems, u32 itemSize, u32 printStart, struct PokenavListView *list) { if (numItems == 0) return; @@ -214,7 +214,7 @@ static bool32 IsPrintListItemsTaskActive(void) static u32 LoopedTask_PrintListItems(s32 state) { u32 row; - struct PokenavListSub *listSub = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); + struct PokenavListView *listSub = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); switch (state) { @@ -274,7 +274,7 @@ static void MoveListWindow(s32 delta, bool32 printItems) if (windowState->windowTopIndex + delta < 0) delta = -1 * windowState->windowTopIndex; if (printItems) - PrintListItems(windowState->listPtr, windowState->windowTopIndex + delta, delta * -1, windowState->listItemSize, delta, &list->sub); + PrintListItems(windowState->listPtr, windowState->windowTopIndex + delta, delta * -1, windowState->listItemSize, delta, &list->view); } else if (printItems) { @@ -282,14 +282,14 @@ static void MoveListWindow(s32 delta, bool32 printItems) if (index + delta >= windowState->listLength) delta = windowState->listLength - index; - PrintListItems(windowState->listPtr, index, delta, windowState->listItemSize, windowState->entriesOnscreen, &list->sub); + PrintListItems(windowState->listPtr, index, delta, windowState->listItemSize, windowState->entriesOnscreen, &list->view); } - CreateMoveListWindowTask(delta, &list->sub); + CreateMoveListWindowTask(delta, &list->view); windowState->windowTopIndex += delta; } -static void CreateMoveListWindowTask(s32 delta, struct PokenavListSub *list) +static void CreateMoveListWindowTask(s32 delta, struct PokenavListView *list) { list->startBgY = GetBgY(list->listWindow.bg); list->endBgY = list->startBgY + (delta << 12); @@ -306,7 +306,7 @@ static u32 LoopedTask_MoveListWindow(s32 state) s32 oldY, newY; bool32 finished; struct PokenavList *list = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); - struct PokenavListSub *subPtr = &list->sub; + struct PokenavListView *viewPtr = &list->view; switch (state) { @@ -316,23 +316,23 @@ static u32 LoopedTask_MoveListWindow(s32 state) return LT_PAUSE; case 1: finished = FALSE; - oldY = GetBgY(subPtr->listWindow.bg); - newY = ChangeBgY(subPtr->listWindow.bg, 0x1000, subPtr->bgMoveType); - if (subPtr->bgMoveType == BG_COORD_SUB) + oldY = GetBgY(viewPtr->listWindow.bg); + newY = ChangeBgY(viewPtr->listWindow.bg, 0x1000, viewPtr->bgMoveType); + if (viewPtr->bgMoveType == BG_COORD_SUB) { - if ((oldY > subPtr->endBgY || oldY <= subPtr->startBgY) && newY <= subPtr->endBgY) + if ((oldY > viewPtr->endBgY || oldY <= viewPtr->startBgY) && newY <= viewPtr->endBgY) finished = TRUE; } else // BG_COORD_ADD { - if ((oldY < subPtr->endBgY || oldY >= subPtr->startBgY) && newY >= subPtr->endBgY) + if ((oldY < viewPtr->endBgY || oldY >= viewPtr->startBgY) && newY >= viewPtr->endBgY) finished = TRUE; } if (finished) { - subPtr->listWindow.unkA = (subPtr->listWindow.unkA + subPtr->moveDelta) & 0xF; - ChangeBgY(subPtr->listWindow.bg, subPtr->endBgY, BG_COORD_SET); + viewPtr->listWindow.unkA = (viewPtr->listWindow.unkA + viewPtr->moveDelta) & 0xF; + ChangeBgY(viewPtr->listWindow.bg, viewPtr->endBgY, BG_COORD_SET); return LT_FINISH; } return LT_PAUSE; @@ -343,7 +343,7 @@ static u32 LoopedTask_MoveListWindow(s32 state) bool32 PokenavList_IsMoveWindowTaskActive(void) { struct PokenavList *list = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); - return IsLoopedTaskActive(list->sub.loopedTaskId); + return IsLoopedTaskActive(list->view.loopedTaskId); } static struct PokenavListWindowState *GetPokenavListWindowState(void) @@ -492,8 +492,8 @@ void PokenavList_DrawCurrentItemIcon(void) { struct PokenavList *list = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); struct PokenavListWindowState *windowState = &list->windowState; - list->sub.iconDrawFunc(list->sub.listWindow.windowId, windowState->windowTopIndex + windowState->selectedIndexOffset, (list->sub.listWindow.unkA + windowState->selectedIndexOffset) & 0xF); - CopyWindowToVram(list->sub.listWindow.windowId, COPYWIN_MAP); + list->view.iconDrawFunc(list->view.listWindow.windowId, windowState->windowTopIndex + windowState->selectedIndexOffset, (list->view.listWindow.unkA + windowState->selectedIndexOffset) & 0xF); + CopyWindowToVram(list->view.listWindow.windowId, COPYWIN_MAP); } static u32 LoopedTask_EraseListForCheckPage(s32 state) @@ -503,11 +503,11 @@ static u32 LoopedTask_EraseListForCheckPage(s32 state) switch (state) { case 0: - ToggleListArrows(&list->sub, TRUE); + ToggleListArrows(&list->view, TRUE); // fall-through case 1: if (list->eraseIndex != list->windowState.selectedIndexOffset) - EraseListEntry(&list->sub.listWindow, list->eraseIndex, 1); + EraseListEntry(&list->view.listWindow, list->eraseIndex, 1); list->eraseIndex++; return LT_INC_AND_PAUSE; @@ -517,7 +517,7 @@ static u32 LoopedTask_EraseListForCheckPage(s32 state) if (list->eraseIndex != list->windowState.entriesOnscreen) return LT_SET_STATE(1); if (list->windowState.selectedIndexOffset != 0) - EraseListEntry(&list->sub.listWindow, list->eraseIndex, list->windowState.selectedIndexOffset); + EraseListEntry(&list->view.listWindow, list->eraseIndex, list->windowState.selectedIndexOffset); return LT_INC_AND_PAUSE; } @@ -552,28 +552,28 @@ static u32 LoopedTask_PrintCheckPageInfo(s32 state) switch (state) { case 0: - PrintCheckPageTrainerName(&list->windowState, &list->sub); + PrintCheckPageTrainerName(&list->windowState, &list->view); break; case 1: - PrintMatchCallFieldNames(&list->sub, 0); + PrintMatchCallFieldNames(&list->view, 0); break; case 2: - PrintMatchCallFlavorText(&list->windowState, &list->sub, CHECK_PAGE_STRATEGY); + PrintMatchCallFlavorText(&list->windowState, &list->view, CHECK_PAGE_STRATEGY); break; case 3: - PrintMatchCallFieldNames(&list->sub, 1); + PrintMatchCallFieldNames(&list->view, 1); break; case 4: - PrintMatchCallFlavorText(&list->windowState, &list->sub, CHECK_PAGE_POKEMON); + PrintMatchCallFlavorText(&list->windowState, &list->view, CHECK_PAGE_POKEMON); break; case 5: - PrintMatchCallFieldNames(&list->sub, 2); + PrintMatchCallFieldNames(&list->view, 2); break; case 6: - PrintMatchCallFlavorText(&list->windowState, &list->sub, CHECK_PAGE_INTRO_1); + PrintMatchCallFlavorText(&list->windowState, &list->view, CHECK_PAGE_INTRO_1); break; case 7: - PrintMatchCallFlavorText(&list->windowState, &list->sub, CHECK_PAGE_INTRO_2); + PrintMatchCallFlavorText(&list->windowState, &list->view, CHECK_PAGE_INTRO_2); break; default: return LT_FINISH; @@ -585,7 +585,7 @@ static u32 LoopedTask_ReshowListFromCheckPage(s32 state) { struct PokenavList *list; struct PokenavListWindowState *windowState; - struct PokenavListSub *subPtr; + struct PokenavListView *viewPtr; s32 r5, *ptr; if (IsDma3ManagerBusyWithBgCopy()) @@ -593,20 +593,20 @@ static u32 LoopedTask_ReshowListFromCheckPage(s32 state) list = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); windowState = &list->windowState; - subPtr = &list->sub; + viewPtr = &list->view; switch (state) { case 0: // Rewrite the name of the trainer whose check page was just being viewed. // This is done to erase the red background it had. - PrintMatchCallListTrainerName(windowState, subPtr); + PrintMatchCallListTrainerName(windowState, viewPtr); return LT_INC_AND_PAUSE; case 1: ptr = &list->eraseIndex; if (++(*ptr) < list->windowState.entriesOnscreen) { - EraseListEntry(&subPtr->listWindow, *ptr, 1); + EraseListEntry(&viewPtr->listWindow, *ptr, 1); return LT_PAUSE; } @@ -617,7 +617,7 @@ static u32 LoopedTask_ReshowListFromCheckPage(s32 state) { s32 r4 = windowState->windowTopIndex; r5 = -r4; - EraseListEntry(&subPtr->listWindow, r5, r4); + EraseListEntry(&viewPtr->listWindow, r5, r4); windowState->selectedIndexOffset = r4; *ptr = r5; return LT_INC_AND_PAUSE; @@ -629,7 +629,7 @@ static u32 LoopedTask_ReshowListFromCheckPage(s32 state) { s32 r4 = windowState->windowTopIndex + windowState->entriesOnscreen - windowState->listLength; r5 = -r4; - EraseListEntry(&subPtr->listWindow, r5, r4); + EraseListEntry(&viewPtr->listWindow, r5, r4); windowState->selectedIndexOffset = r4; *ptr = r5; return LT_INC_AND_PAUSE; @@ -647,7 +647,7 @@ static u32 LoopedTask_ReshowListFromCheckPage(s32 state) } return LT_PAUSE; case 4: - PrintListItems(windowState->listPtr, windowState->windowTopIndex + list->eraseIndex, 1, windowState->listItemSize, list->eraseIndex, &list->sub); + PrintListItems(windowState->listPtr, windowState->windowTopIndex + list->eraseIndex, 1, windowState->listItemSize, list->eraseIndex, &list->view); return LT_INC_AND_PAUSE; case 5: if (IsPrintListItemsTaskActive()) @@ -656,7 +656,7 @@ static u32 LoopedTask_ReshowListFromCheckPage(s32 state) return LT_INC_AND_CONTINUE; return LT_SET_STATE(4); case 6: - ToggleListArrows(subPtr, FALSE); + ToggleListArrows(viewPtr, FALSE); return LT_FINISH; } @@ -691,7 +691,7 @@ static void EraseListEntry(struct PokenavListMenuWindow *listWindow, s32 offset, } // Pointless -static void SetListMarginTile(struct PokenavListMenuWindow *listWindow, bool32 draw) +static void SetListMarginTile(const struct PokenavListMenuWindow *listWindow, bool32 draw) { u16 var; u16 *tilemapBuffer = (u16 *)GetBgTilemapBuffer(GetWindowAttribute(listWindow->windowId, WINDOW_BG)); @@ -707,7 +707,7 @@ static void SetListMarginTile(struct PokenavListMenuWindow *listWindow, bool32 d } // Print the trainer's name and title at the top of their check page -static void PrintCheckPageTrainerName(struct PokenavListWindowState *state, struct PokenavListSub *list) +static void PrintCheckPageTrainerName(struct PokenavListWindowState *state, struct PokenavListView *list) { u8 colors[3] = {TEXT_COLOR_TRANSPARENT, TEXT_COLOR_DARK_GRAY, TEXT_COLOR_LIGHT_RED}; @@ -720,7 +720,7 @@ static void PrintCheckPageTrainerName(struct PokenavListWindowState *state, stru } // Print the trainer's name and title for the list (to replace the check page name and title, which has a red background) -static void PrintMatchCallListTrainerName(struct PokenavListWindowState *state, struct PokenavListSub *list) +static void PrintMatchCallListTrainerName(struct PokenavListWindowState *state, struct PokenavListView *list) { list->bufferItemFunc(state->listPtr + state->listItemSize * state->windowTopIndex, list->itemTextBuffer); FillWindowPixelRect(list->listWindow.windowId, PIXEL_FILL(1), 0, list->listWindow.unkA * 16, list->listWindow.width * 8, 16); @@ -729,7 +729,7 @@ static void PrintMatchCallListTrainerName(struct PokenavListWindowState *state, CopyWindowToVram(list->listWindow.windowId, COPYWIN_FULL); } -static void PrintMatchCallFieldNames(struct PokenavListSub *list, u32 fieldId) +static void PrintMatchCallFieldNames(struct PokenavListView *list, u32 fieldId) { const u8 *fieldNames[] = { gText_PokenavMatchCall_Strategy, @@ -744,7 +744,7 @@ static void PrintMatchCallFieldNames(struct PokenavListSub *list, u32 fieldId) CopyWindowRectToVram(list->listWindow.windowId, COPYWIN_GFX, 0, top << 1, list->listWindow.width, 2); } -static void PrintMatchCallFlavorText(struct PokenavListWindowState *windowState, struct PokenavListSub *list, u32 checkPageEntry) +static void PrintMatchCallFlavorText(struct PokenavListWindowState *windowState, struct PokenavListView *list, u32 checkPageEntry) { // lines 1, 3, and 5 are the field names printed by PrintMatchCallFieldNames static const u8 lineOffsets[CHECK_PAGE_ENTRY_COUNT] = { @@ -844,7 +844,7 @@ static void LoadListArrowGfx(void) Pokenav_AllocAndLoadPalettes(sListArrowPalettes); } -static void CreateListArrowSprites(struct PokenavListWindowState *windowState, struct PokenavListSub *list) +static void CreateListArrowSprites(const struct PokenavListWindowState *windowState, struct PokenavListView *list) { u32 spriteId; s16 x; @@ -864,7 +864,7 @@ static void CreateListArrowSprites(struct PokenavListWindowState *windowState, s list->upArrow->callback = SpriteCB_UpArrow; } -static void DestroyListArrows(struct PokenavListSub *list) +static void DestroyListArrows(struct PokenavListView *list) { DestroySprite(list->rightArrow); DestroySprite(list->upArrow); @@ -873,7 +873,7 @@ static void DestroyListArrows(struct PokenavListSub *list) FreeSpritePaletteByTag(PALTAG_ARROW); } -static void ToggleListArrows(struct PokenavListSub *list, bool32 invisible) +static void ToggleListArrows(struct PokenavListView *list, bool32 invisible) { if (invisible) { @@ -941,15 +941,15 @@ static void SpriteCB_UpArrow(struct Sprite *sprite) void PokenavList_ToggleVerticalArrows(bool32 invisible) { struct PokenavList *list = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); - list->sub.upArrow->sInvisible = invisible; - list->sub.downArrow->sInvisible = invisible; + list->view.upArrow->sInvisible = invisible; + list->view.downArrow->sInvisible = invisible; } #undef sTimer #undef sOffset #undef sInvisible -static void InitPokenavListWindowState(struct PokenavListWindowState *dst, struct PokenavListTemplate *template) +static void InitPokenavListWindowState(struct PokenavListWindowState *dst, const struct PokenavListTemplate *template) { dst->listPtr = template->list; dst->windowTopIndex = template->startIndex; @@ -977,19 +977,19 @@ static void InitPokenavListWindowState(struct PokenavListWindowState *dst, struc } } -static bool32 CopyPokenavListMenuTemplate(struct PokenavListSub *dest, const struct BgTemplate *bgTemplate, struct PokenavListTemplate *template, s32 tileOffset) +static bool32 CopyPokenavListMenuTemplate(struct PokenavListView *view, const struct BgTemplate *bgTemplate, const struct PokenavListTemplate *template, u32 tileOffset) { struct WindowTemplate window; - dest->listWindow.bg = bgTemplate->bg; - dest->listWindow.tileOffset = tileOffset; - dest->bufferItemFunc = template->bufferItemFunc; - dest->iconDrawFunc = template->iconDrawFunc; - dest->listWindow.fillValue = template->fillValue; - dest->listWindow.x = template->item_X; - dest->listWindow.y = template->listTop; - dest->listWindow.width = template->windowWidth; - dest->listWindow.fontId = template->fontId; + view->listWindow.bg = bgTemplate->bg; + view->listWindow.tileOffset = tileOffset; + view->bufferItemFunc = template->bufferItemFunc; + view->iconDrawFunc = template->iconDrawFunc; + view->listWindow.fillValue = template->fillValue; + view->listWindow.x = template->item_X; + view->listWindow.y = template->listTop; + view->listWindow.width = template->windowWidth; + view->listWindow.fontId = template->fontId; window.bg = bgTemplate->bg; window.tilemapLeft = template->item_X; @@ -999,13 +999,13 @@ static bool32 CopyPokenavListMenuTemplate(struct PokenavListSub *dest, const str window.paletteNum = template->fillValue; window.baseBlock = tileOffset + 2; - dest->listWindow.windowId = AddWindow(&window); - if (dest->listWindow.windowId == WINDOW_NONE) + view->listWindow.windowId = AddWindow(&window); + if (view->listWindow.windowId == WINDOW_NONE) return FALSE; - dest->listWindow.unkA = 0; - dest->rightArrow = NULL; - dest->upArrow = NULL; - dest->downArrow = NULL; + view->listWindow.unkA = 0; + view->rightArrow = NULL; + view->upArrow = NULL; + view->downArrow = NULL; return 1; }