diff options
Diffstat (limited to 'arm9/src')
-rw-r--r-- | arm9/src/list_menu.c | 43 | ||||
-rw-r--r-- | arm9/src/text.c | 4 |
2 files changed, 45 insertions, 2 deletions
diff --git a/arm9/src/list_menu.c b/arm9/src/list_menu.c index f54db302..59de2813 100644 --- a/arm9/src/list_menu.c +++ b/arm9/src/list_menu.c @@ -15,6 +15,9 @@ void ListMenuCallSelectionChangedCallback(struct ListMenu *, BOOL); extern void CopyWindowToVram(struct Window *); extern s32 GetFontAttribute(u8 fontId, s32 attr); extern void FillWindowPixelRect(struct Window *, u32 fillValue, u16 x, u16 y, u16 width, u16 height); +extern void ScrollWindow(struct Window *, u8, u8, u8); +extern u16 GetWindowWidth(struct Window *); +extern u16 GetWindowHeight(struct Window *); static inline u32 MakeFontColor(u32 fgPal, u32 shdwPal, u32 bgPal) { @@ -476,3 +479,43 @@ THUMB_FUNC u8 ListMenuUpdateSelectedRowIndexAndScrollOffset(struct ListMenu *lis } return 2; } + +THUMB_FUNC void ListMenuScroll(struct ListMenu * list, u8 count, u8 movingDown) +{ + if (count >= list->template.maxShowed) + { + FillWindowPixelBuffer(list->template.window, list->template.fillValue); + ListMenuPrintEntries(list, list->cursorPos, 0, list->template.maxShowed); + } + else + { + u8 yMultiplier = GetFontAttribute(list->template.fontId, 1) + list->template.itemVerticalPadding; + + if (!movingDown) + { + u16 y, width, height; + + ScrollWindow(list->template.window, 1, count * yMultiplier, (list->template.fillValue << 4) | list->template.fillValue); + ListMenuPrintEntries(list, list->cursorPos, 0, count); + + y = (list->template.maxShowed * yMultiplier) + list->template.upText_Y; + width = GetWindowWidth(list->template.window); + height = GetWindowHeight(list->template.window); + FillWindowPixelRect(list->template.window, + list->template.fillValue, + 0, y, width * 8, height * 8 - y); + } + else + { + u32 width; + + ScrollWindow(list->template.window, 0, count * yMultiplier, (list->template.fillValue << 4) | list->template.fillValue); + ListMenuPrintEntries(list, list->cursorPos + (list->template.maxShowed - count), list->template.maxShowed - count, count); + + width = GetWindowWidth(list->template.window); + FillWindowPixelRect(list->template.window, + list->template.fillValue, + 0, 0, width * 8, list->template.upText_Y); + } + } +} diff --git a/arm9/src/text.c b/arm9/src/text.c index 23e6ca67..926fa29f 100644 --- a/arm9/src/text.c +++ b/arm9/src/text.c @@ -24,7 +24,7 @@ extern u32 FontFunc(u8 fontId, struct TextPrinter *printer); extern void *FUN_02006BB0(u32 param0, u32 param1, u32 param2, struct TextPrinter **param3, u32 param4); -extern u32 FUN_0201AB0C(struct Window * window); +extern u32 GetWindowWidth(struct Window * window); extern void FUN_02019658(struct Window * param0, u32 param1, u32 param2, u32 param3, u32 param4, u32 param5, u32 param6, u32 param7, u32 param8, u32 param9); @@ -349,7 +349,7 @@ THUMB_FUNC void FUN_0201C1EC(struct TextPrinter *printer, u32 param1, u32 param2 printer->Unk2C = FUN_0201C1B0(); } u32 r6 = (u32)printer->Unk2C + param3 * (sizeof(struct TextPrinter) * 8); - u32 r2 = ((FUN_0201AB0C(window) - 3) << 0x13) >> 0x10; + u32 r2 = ((GetWindowWidth(window) - 3) << 0x13) >> 0x10; FUN_02019658(window, r6, 0, 0, 24, 32, r2, 0, 24, 32); } |