From d979ac3bf3924051de8bb4154e8398083535eabb Mon Sep 17 00:00:00 2001 From: Phlosioneer Date: Mon, 11 Feb 2019 00:05:20 -0500 Subject: Document main_menu state machine, name window constants The new names for the constants (and newly named functions) give a much better understanding of what the window system is trying to do. --- src/list_menu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/list_menu.c') diff --git a/src/list_menu.c b/src/list_menu.c index 7a9547661..6442debba 100644 --- a/src/list_menu.c +++ b/src/list_menu.c @@ -355,11 +355,11 @@ s32 DoMysteryGiftListMenu(struct WindowTemplate *windowTemplate, struct ListMenu switch (arg2) { case 0: // can never be reached, because of the if statement above - sub_819746C(sMysteryGiftLinkMenu.windowId, FALSE); + ClearWindowAndBorder(sMysteryGiftLinkMenu.windowId, FALSE); break; case 2: case 1: - sub_819746C(sMysteryGiftLinkMenu.windowId, FALSE); + ClearWindowAndBorder(sMysteryGiftLinkMenu.windowId, FALSE); break; } } -- cgit v1.2.3 From c96f8751cddf1a203bd5f310683ea35bf9cb8db2 Mon Sep 17 00:00:00 2001 From: Phlosioneer Date: Thu, 21 Feb 2019 23:27:12 -0500 Subject: Improve window palette macros --- src/list_menu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/list_menu.c') diff --git a/src/list_menu.c b/src/list_menu.c index 6442debba..83293890c 100644 --- a/src/list_menu.c +++ b/src/list_menu.c @@ -486,7 +486,7 @@ void RedrawListMenu(u8 listTaskId) { struct ListMenu *list = (void*) gTasks[listTaskId].data; - FillWindowPixelBuffer(list->template.windowId, (list->template.fillValue << 4) | (list->template.fillValue)); + FillWindowPixelBuffer(list->template.windowId, PALETTE_NUM_TO_FILL_VALUE(list->template.fillValue)); ListMenuPrintEntries(list, list->scrollOffset, 0, list->template.maxShowed); ListMenuDrawCursor(list); CopyWindowToVram(list->template.windowId, 2); @@ -584,7 +584,7 @@ static u8 ListMenuInitInternal(struct ListMenuTemplate *listMenuTemplate, u16 sc if (list->template.totalItems < list->template.maxShowed) list->template.maxShowed = list->template.totalItems; - FillWindowPixelBuffer(list->template.windowId, (list->template.fillValue << 4) | (list->template.fillValue)); + FillWindowPixelBuffer(list->template.windowId, PALETTE_NUM_TO_FILL_VALUE(list->template.fillValue)); ListMenuPrintEntries(list, list->scrollOffset, 0, list->template.maxShowed); ListMenuDrawCursor(list); ListMenuCallSelectionChangedCallback(list, TRUE); @@ -795,7 +795,7 @@ static void ListMenuScroll(struct ListMenu *list, u8 count, bool8 movingDown) { if (count >= list->template.maxShowed) { - FillWindowPixelBuffer(list->template.windowId, (list->template.fillValue << 4) | (list->template.fillValue)); + FillWindowPixelBuffer(list->template.windowId, PALETTE_NUM_TO_FILL_VALUE(list->template.fillValue)); ListMenuPrintEntries(list, list->scrollOffset, 0, list->template.maxShowed); } else -- cgit v1.2.3 From 199863f21f41b3a51d9a6302ca7c3c2864ee1c17 Mon Sep 17 00:00:00 2001 From: Phlosioneer Date: Thu, 21 Feb 2019 23:56:22 -0500 Subject: Replace more instances of fill values --- src/list_menu.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/list_menu.c') diff --git a/src/list_menu.c b/src/list_menu.c index 83293890c..656ab7a15 100644 --- a/src/list_menu.c +++ b/src/list_menu.c @@ -698,7 +698,7 @@ static void ListMenuErasePrintedCursor(struct ListMenu *list, u16 selectedRow) u8 width = GetMenuCursorDimensionByFont(list->template.fontId, 0); u8 height = GetMenuCursorDimensionByFont(list->template.fontId, 1); FillWindowPixelRect(list->template.windowId, - (list->template.fillValue << 4) | (list->template.fillValue), + PALETTE_NUM_TO_FILL_VALUE(list->template.fillValue), list->template.cursor_X, selectedRow * yMultiplier + list->template.upText_Y, width, @@ -806,26 +806,26 @@ static void ListMenuScroll(struct ListMenu *list, u8 count, bool8 movingDown) { u16 y, width, height; - ScrollWindow(list->template.windowId, 1, count * yMultiplier, (list->template.fillValue << 4) | (list->template.fillValue)); + ScrollWindow(list->template.windowId, 1, count * yMultiplier, PALETTE_NUM_TO_FILL_VALUE(list->template.fillValue)); ListMenuPrintEntries(list, list->scrollOffset, 0, count); y = (list->template.maxShowed * yMultiplier) + list->template.upText_Y; width = GetWindowAttribute(list->template.windowId, WINDOW_WIDTH) * 8; height = (GetWindowAttribute(list->template.windowId, WINDOW_HEIGHT) * 8) - y; FillWindowPixelRect(list->template.windowId, - (list->template.fillValue << 4) | (list->template.fillValue), + PALETTE_NUM_TO_FILL_VALUE(list->template.fillValue), 0, y, width, height); } else { u16 width; - ScrollWindow(list->template.windowId, 0, count * yMultiplier, (list->template.fillValue << 4) | (list->template.fillValue)); + ScrollWindow(list->template.windowId, 0, count * yMultiplier, PALETTE_NUM_TO_FILL_VALUE(list->template.fillValue)); ListMenuPrintEntries(list, list->scrollOffset + (list->template.maxShowed - count), list->template.maxShowed - count, count); width = GetWindowAttribute(list->template.windowId, WINDOW_WIDTH) * 8; FillWindowPixelRect(list->template.windowId, - (list->template.fillValue << 4) | (list->template.fillValue), + PALETTE_NUM_TO_FILL_VALUE(list->template.fillValue), 0, 0, width, list->template.upText_Y); } } -- cgit v1.2.3 From 44e92ce2596981c8d42b70922e5ae84d6b321ab1 Mon Sep 17 00:00:00 2001 From: Phlosioneer Date: Fri, 22 Feb 2019 01:40:11 -0500 Subject: Give window drawing functions better names --- src/list_menu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/list_menu.c') diff --git a/src/list_menu.c b/src/list_menu.c index 656ab7a15..b8e186348 100644 --- a/src/list_menu.c +++ b/src/list_menu.c @@ -355,11 +355,11 @@ s32 DoMysteryGiftListMenu(struct WindowTemplate *windowTemplate, struct ListMenu switch (arg2) { case 0: // can never be reached, because of the if statement above - ClearWindowAndBorder(sMysteryGiftLinkMenu.windowId, FALSE); + ClearStdWindowAndFrame(sMysteryGiftLinkMenu.windowId, FALSE); break; case 2: case 1: - ClearWindowAndBorder(sMysteryGiftLinkMenu.windowId, FALSE); + ClearStdWindowAndFrame(sMysteryGiftLinkMenu.windowId, FALSE); break; } } -- cgit v1.2.3 From 3716da5430a976d05afecdf82f43f14fc2584949 Mon Sep 17 00:00:00 2001 From: Phlosioneer Date: Sat, 2 Mar 2019 17:25:39 -0500 Subject: Rename macro with correct name for pixel values --- src/list_menu.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/list_menu.c') diff --git a/src/list_menu.c b/src/list_menu.c index b8e186348..51d7dcb15 100644 --- a/src/list_menu.c +++ b/src/list_menu.c @@ -486,7 +486,7 @@ void RedrawListMenu(u8 listTaskId) { struct ListMenu *list = (void*) gTasks[listTaskId].data; - FillWindowPixelBuffer(list->template.windowId, PALETTE_NUM_TO_FILL_VALUE(list->template.fillValue)); + FillWindowPixelBuffer(list->template.windowId, PIXEL_FILL(list->template.fillValue)); ListMenuPrintEntries(list, list->scrollOffset, 0, list->template.maxShowed); ListMenuDrawCursor(list); CopyWindowToVram(list->template.windowId, 2); @@ -584,7 +584,7 @@ static u8 ListMenuInitInternal(struct ListMenuTemplate *listMenuTemplate, u16 sc if (list->template.totalItems < list->template.maxShowed) list->template.maxShowed = list->template.totalItems; - FillWindowPixelBuffer(list->template.windowId, PALETTE_NUM_TO_FILL_VALUE(list->template.fillValue)); + FillWindowPixelBuffer(list->template.windowId, PIXEL_FILL(list->template.fillValue)); ListMenuPrintEntries(list, list->scrollOffset, 0, list->template.maxShowed); ListMenuDrawCursor(list); ListMenuCallSelectionChangedCallback(list, TRUE); @@ -698,7 +698,7 @@ static void ListMenuErasePrintedCursor(struct ListMenu *list, u16 selectedRow) u8 width = GetMenuCursorDimensionByFont(list->template.fontId, 0); u8 height = GetMenuCursorDimensionByFont(list->template.fontId, 1); FillWindowPixelRect(list->template.windowId, - PALETTE_NUM_TO_FILL_VALUE(list->template.fillValue), + PIXEL_FILL(list->template.fillValue), list->template.cursor_X, selectedRow * yMultiplier + list->template.upText_Y, width, @@ -795,7 +795,7 @@ static void ListMenuScroll(struct ListMenu *list, u8 count, bool8 movingDown) { if (count >= list->template.maxShowed) { - FillWindowPixelBuffer(list->template.windowId, PALETTE_NUM_TO_FILL_VALUE(list->template.fillValue)); + FillWindowPixelBuffer(list->template.windowId, PIXEL_FILL(list->template.fillValue)); ListMenuPrintEntries(list, list->scrollOffset, 0, list->template.maxShowed); } else @@ -806,26 +806,26 @@ static void ListMenuScroll(struct ListMenu *list, u8 count, bool8 movingDown) { u16 y, width, height; - ScrollWindow(list->template.windowId, 1, count * yMultiplier, PALETTE_NUM_TO_FILL_VALUE(list->template.fillValue)); + ScrollWindow(list->template.windowId, 1, count * yMultiplier, PIXEL_FILL(list->template.fillValue)); ListMenuPrintEntries(list, list->scrollOffset, 0, count); y = (list->template.maxShowed * yMultiplier) + list->template.upText_Y; width = GetWindowAttribute(list->template.windowId, WINDOW_WIDTH) * 8; height = (GetWindowAttribute(list->template.windowId, WINDOW_HEIGHT) * 8) - y; FillWindowPixelRect(list->template.windowId, - PALETTE_NUM_TO_FILL_VALUE(list->template.fillValue), + PIXEL_FILL(list->template.fillValue), 0, y, width, height); } else { u16 width; - ScrollWindow(list->template.windowId, 0, count * yMultiplier, PALETTE_NUM_TO_FILL_VALUE(list->template.fillValue)); + ScrollWindow(list->template.windowId, 0, count * yMultiplier, PIXEL_FILL(list->template.fillValue)); ListMenuPrintEntries(list, list->scrollOffset + (list->template.maxShowed - count), list->template.maxShowed - count, count); width = GetWindowAttribute(list->template.windowId, WINDOW_WIDTH) * 8; FillWindowPixelRect(list->template.windowId, - PALETTE_NUM_TO_FILL_VALUE(list->template.fillValue), + PIXEL_FILL(list->template.fillValue), 0, 0, width, list->template.upText_Y); } } -- cgit v1.2.3