From b07c6e0c120b8beb6b0459b4ac730198180a20b0 Mon Sep 17 00:00:00 2001 From: AZero13 <83477269+SiliconA-Z@users.noreply.github.com> Date: Sat, 28 Mar 2026 13:04:46 -0400 Subject: [PATCH] Fix fakematching in TextPrinterDrawDownArrow --- src/text.c | 77 ++++++++++++++++++++++++++---------------------------- 1 file changed, 37 insertions(+), 40 deletions(-) diff --git a/src/text.c b/src/text.c index baaefe2e6a4..fb12d15d030 100644 --- a/src/text.c +++ b/src/text.c @@ -473,50 +473,47 @@ void TextPrinterDrawDownArrow(struct TextPrinter *textPrinter) struct TextPrinterSubStruct *subStruct = &textPrinter->subUnion.sub; const u8 *arrowTiles; - if (gTextFlags.autoScroll == 0) - { - if (subStruct->downArrowDelay != 0) - { - subStruct->downArrowDelay = ((*(u32 *)&textPrinter->subUnion.sub) << 19 >> 27) - 1; // convoluted way of getting field_1, necessary to match - } - else - { - FillWindowPixelRect( - textPrinter->printerTemplate.windowId, - textPrinter->printerTemplate.bgColor << 4 | textPrinter->printerTemplate.bgColor, - textPrinter->printerTemplate.currentX, - textPrinter->printerTemplate.currentY, - 10, - 12); + if (gTextFlags.autoScroll) + return; - switch (gTextFlags.useAlternateDownArrow) - { - case 0: - default: - arrowTiles = sDownArrowTiles; - break; - case 1: - arrowTiles = &sDownArrowTiles[DARK_DOWN_ARROW_OFFSET]; - break; - } + if (subStruct->downArrowDelay != 0) + { + subStruct->downArrowDelay--; + return; + } - BlitBitmapRectToWindow( - textPrinter->printerTemplate.windowId, - arrowTiles, - sDownArrowYCoords[subStruct->downArrowYPosIdx], - 0, - 0x80, - 0x10, - textPrinter->printerTemplate.currentX, - textPrinter->printerTemplate.currentY, - 10, - 12); - CopyWindowToVram(textPrinter->printerTemplate.windowId, 0x2); + FillWindowPixelRect(textPrinter->printerTemplate.windowId, + textPrinter->printerTemplate.bgColor << 4 | textPrinter->printerTemplate.bgColor, + textPrinter->printerTemplate.currentX, + textPrinter->printerTemplate.currentY, + 10, + 12); - subStruct->downArrowDelay = CURSOR_DELAY; - subStruct->downArrowYPosIdx = (*(u32 *)subStruct << 17 >> 30) + 1; - } + switch (gTextFlags.useAlternateDownArrow) + { + case 0: + default: + arrowTiles = sDownArrowTiles; + break; + case 1: + arrowTiles = &sDownArrowTiles[DARK_DOWN_ARROW_OFFSET]; + break; } + + BlitBitmapRectToWindow(textPrinter->printerTemplate.windowId, + arrowTiles, + sDownArrowYCoords[subStruct->downArrowYPosIdx], + 0, + 0x80, + 0x10, + textPrinter->printerTemplate.currentX, + textPrinter->printerTemplate.currentY, + 10, + 12); + CopyWindowToVram(textPrinter->printerTemplate.windowId, 0x2); + + subStruct->downArrowDelay = CURSOR_DELAY; + subStruct->downArrowYPosIdx++; } void TextPrinterClearDownArrow(struct TextPrinter *textPrinter)