diff options
Diffstat (limited to 'src/menu.c')
-rw-r--r-- | src/menu.c | 58 |
1 files changed, 36 insertions, 22 deletions
diff --git a/src/menu.c b/src/menu.c index 8a4b4fce5..0e5d1b856 100644 --- a/src/menu.c +++ b/src/menu.c @@ -65,13 +65,27 @@ static const u8 gUnknown_0860F094[] = { 8, 4, 1 }; static const struct WindowTemplate gUnknown_0860F098[] = { - { 0x00, 0x02, 0x0F, 0x1B, 0x04, 0x0F, 0x194 }, + { + .priority = 0, + .tilemapLeft = 2, + .tilemapTop = 15, + .width = 27, + .height = 4, + .paletteNum = 15, + .baseBlock = 0x194 + }, DUMMY_WIN_TEMPLATE }; static const struct WindowTemplate gUnknown_0860F0A8 = { - 0x00, 0x15, 0x09, 0x05, 0x04, 0x0F, 0x125 + .priority = 0, + .tilemapLeft = 21, + .tilemapTop = 9, + .width = 5, + .height = 4, + .paletteNum = 15, + .baseBlock = 0x125 }; const u16 gUnknown_0860F0B0[] = INCBIN_U16("graphics/interface/860F0B0.gbapal"); @@ -143,13 +157,13 @@ void sub_8197200(void) sub_81973A4(); } -u16 sub_8197224(void) +u16 RunTextPrintersAndIsPrinter0Active(void) { RunTextPrinters(); return IsTextPrinterActive(0); } -u16 AddTextPrinterParameterized(u8 windowId, u8 fontId, const u8 *str, u8 speed, void (*callback)(struct TextSubPrinter *, u16), u8 fgColor, u8 bgColor, u8 shadowColor) +u16 AddTextPrinterParameterized2(u8 windowId, u8 fontId, const u8 *str, u8 speed, void (*callback)(struct TextSubPrinter *, u16), u8 fgColor, u8 bgColor, u8 shadowColor) { struct TextSubPrinter printer; @@ -175,19 +189,19 @@ void AddTextPrinterForMessage(bool8 allowSkippingDelayWithButtonPress) { void (*callback)(struct TextSubPrinter *, u16) = NULL; gTextFlags.flag_0 = allowSkippingDelayWithButtonPress; - AddTextPrinterParameterized(0, 1, gStringVar4, GetPlayerTextSpeed(), callback, 2, 1, 3); + AddTextPrinterParameterized2(0, 1, gStringVar4, GetPlayerTextSpeed(), callback, 2, 1, 3); } void AddTextPrinterForMessage_2(bool8 allowSkippingDelayWithButtonPress) { gTextFlags.flag_0 = allowSkippingDelayWithButtonPress; - AddTextPrinterParameterized(0, 1, gStringVar4, GetPlayerTextSpeed(), NULL, 2, 1, 3); + AddTextPrinterParameterized2(0, 1, gStringVar4, GetPlayerTextSpeed(), NULL, 2, 1, 3); } void AddTextPrinterWithCustomSpeedForMessage(bool8 allowSkippingDelayWithButtonPress, u8 speed) { gTextFlags.flag_0 = allowSkippingDelayWithButtonPress; - AddTextPrinterParameterized(0, 1, gStringVar4, speed, NULL, 2, 1, 3); + AddTextPrinterParameterized2(0, 1, gStringVar4, speed, NULL, 2, 1, 3); } void sub_81973A4(void) @@ -525,7 +539,7 @@ void RemoveMapNamePopUpWindow(void) void AddTextPrinterWithCallbackForMessage(bool8 a1, void (*callback)(struct TextSubPrinter *, u16)) { gTextFlags.flag_0 = a1; - AddTextPrinterParameterized(0, 1, gStringVar4, GetPlayerTextSpeed(), callback, 2, 1, 3); + AddTextPrinterParameterized2(0, 1, gStringVar4, GetPlayerTextSpeed(), callback, 2, 1, 3); } void sub_8197AE8(bool8 copyToVram) @@ -799,7 +813,7 @@ void sub_8198180(const u8 *string, u8 a2, bool8 copyToVram) PutWindowTilemap(gUnknown_0203CDA0); FillWindowPixelBuffer(gUnknown_0203CDA0, 0xFF); width = GetStringWidth(0, string, 0); - box_print(gUnknown_0203CDA0, + AddTextPrinterParameterized3(gUnknown_0203CDA0, 0, 0xEC - (GetWindowAttribute(gUnknown_0203CDA0, WINDOW_TILEMAP_LEFT) * 8) - a2 - width, 1, @@ -835,7 +849,7 @@ void sub_8198204(const u8 *string, const u8 *string2, u8 a3, u8 a4, bool8 copyTo if (string2 != NULL) { width = GetStringWidth(0, string2, 0); - box_print(gUnknown_0203CDA0, + AddTextPrinterParameterized3(gUnknown_0203CDA0, 0, 0xEC - (GetWindowAttribute(gUnknown_0203CDA0, WINDOW_TILEMAP_LEFT) * 8) - a4 - width, 1, @@ -843,7 +857,7 @@ void sub_8198204(const u8 *string, const u8 *string2, u8 a3, u8 a4, bool8 copyTo 0, string2); } - AddTextPrinterParameterized2(gUnknown_0203CDA0, 1, 4, 1, 0, 0, color, 0, string); + AddTextPrinterParameterized4(gUnknown_0203CDA0, 1, 4, 1, 0, 0, color, 0, string); if (copyToVram) CopyWindowToVram(gUnknown_0203CDA0, 3); } @@ -918,7 +932,7 @@ void RedrawMenuCursor(u8 oldPos, u8 newPos) width = GetMenuCursorDimensionByFont(gUnknown_0203CD90.fontId, 0); height = GetMenuCursorDimensionByFont(gUnknown_0203CD90.fontId, 1); FillWindowPixelRect(gUnknown_0203CD90.windowId, 0x11, gUnknown_0203CD90.left, gUnknown_0203CD90.optionHeight * oldPos + gUnknown_0203CD90.top, width, height); - PrintTextOnWindow(gUnknown_0203CD90.windowId, gUnknown_0203CD90.fontId, gText_SelectorArrow3, gUnknown_0203CD90.left, gUnknown_0203CD90.optionHeight * newPos + gUnknown_0203CD90.top, 0, 0); + AddTextPrinterParameterized(gUnknown_0203CD90.windowId, gUnknown_0203CD90.fontId, gText_SelectorArrow3, gUnknown_0203CD90.left, gUnknown_0203CD90.optionHeight * newPos + gUnknown_0203CD90.top, 0, 0); } u8 MoveMenuCursor(s8 cursorDelta) @@ -1079,7 +1093,7 @@ void PrintTextArray(u8 windowId, u8 fontId, u8 left, u8 top, u8 lineHeight, u8 i u8 i; for (i = 0; i < itemCount; i++) { - PrintTextOnWindow(windowId, fontId, strs[i].text, left, (lineHeight * i) + top, 0xFF, NULL); + AddTextPrinterParameterized(windowId, fontId, strs[i].text, left, (lineHeight * i) + top, 0xFF, NULL); } CopyWindowToVram(windowId, 2); } @@ -1089,7 +1103,7 @@ void sub_81987BC(u8 windowId, u8 fontId, u8 left, u8 top, u8 lineHeight, u8 item u8 i; for (i = 0; i < itemCount; i++) { - sub_8199F74(windowId, fontId, strs[i].text, left, (lineHeight * i) + top, 0xFF, NULL, a6, a7); + AddTextPrinterParameterized5(windowId, fontId, strs[i].text, left, (lineHeight * i) + top, 0xFF, NULL, a6, a7); } CopyWindowToVram(windowId, 2); } @@ -1209,7 +1223,7 @@ void sub_8198C94(u8 windowId, u8 fontId, u8 left, u8 top, u8 a4, u8 a5, u8 a6, u { for (j = 0; j < a6; j++) { - PrintTextOnWindow(windowId, fontId, strs[(i * a6) + j].text, (a4 * j) + left, (a5 * i) + top, 0xFF, NULL); + AddTextPrinterParameterized(windowId, fontId, strs[(i * a6) + j].text, (a4 * j) + left, (a5 * i) + top, 0xFF, NULL); } } CopyWindowToVram(windowId, 2); @@ -1303,7 +1317,7 @@ void sub_8199060(u8 oldCursorPos, u8 newCursorPos) cursorHeight); xPos = (newCursorPos % gUnknown_0203CD90.horizontalCount) * gUnknown_0203CD90.optionWidth + gUnknown_0203CD90.left; yPos = (newCursorPos / gUnknown_0203CD90.horizontalCount) * gUnknown_0203CD90.optionHeight + gUnknown_0203CD90.top; - PrintTextOnWindow(gUnknown_0203CD90.windowId, + AddTextPrinterParameterized(gUnknown_0203CD90.windowId, gUnknown_0203CD90.fontId, gText_SelectorArrow3, xPos, @@ -1588,7 +1602,7 @@ void PrintMenuTable(u8 windowId, u8 itemCount, const struct MenuAction *strs) for (i = 0; i < itemCount; i++) { - PrintTextOnWindow(windowId, 1, strs[i].text, 8, (i * 16) + 1, 0xFF, NULL); + AddTextPrinterParameterized(windowId, 1, strs[i].text, 8, (i * 16) + 1, 0xFF, NULL); } CopyWindowToVram(windowId, 2); @@ -1654,7 +1668,7 @@ void sub_81997AC(u8 windowId, u8 a4, u8 a6, u8 a7, const struct MenuAction *strs { for (j = 0; j < a6; j++) { - PrintTextOnWindow(windowId, 1, strs[(i * a6) + j].text, (a4 * j) + 8, (i * 16) + 1, 0xFF, NULL); + AddTextPrinterParameterized(windowId, 1, strs[(i * a6) + j].text, (a4 * j) + 8, (i * 16) + 1, 0xFF, NULL); } } CopyWindowToVram(windowId, 2); @@ -1925,7 +1939,7 @@ void sub_8199DF0(u32 bg, u8 a1, int a2, int a3) RequestDma3Fill(a1 << 24 | a1 << 16 | a1 << 8 | a1, addr + VRAM, a3 * temp, 1); } -void box_print(u8 windowId, u8 fontId, u8 left, u8 top, const u8 *color, s8 speed, const u8 *str) +void AddTextPrinterParameterized3(u8 windowId, u8 fontId, u8 left, u8 top, const u8 *color, s8 speed, const u8 *str) { struct TextSubPrinter printer; @@ -1946,7 +1960,7 @@ void box_print(u8 windowId, u8 fontId, u8 left, u8 top, const u8 *color, s8 spee AddTextPrinter(&printer, speed, NULL); } -void AddTextPrinterParameterized2(u8 windowId, u8 fontId, u8 left, u8 top, u8 letterSpacing, u8 lineSpacing, const u8 *color, s8 speed, const u8 *str) +void AddTextPrinterParameterized4(u8 windowId, u8 fontId, u8 left, u8 top, u8 letterSpacing, u8 lineSpacing, const u8 *color, s8 speed, const u8 *str) { struct TextSubPrinter printer; @@ -1967,7 +1981,7 @@ void AddTextPrinterParameterized2(u8 windowId, u8 fontId, u8 left, u8 top, u8 le AddTextPrinter(&printer, speed, NULL); } -void sub_8199F74(u8 windowId, u8 fontId, const u8 *str, u8 left, u8 top, u8 speed, void (*callback)(struct TextSubPrinter *, u16), u8 letterSpacing, u8 lineSpacing) +void AddTextPrinterParameterized5(u8 windowId, u8 fontId, const u8 *str, u8 left, u8 top, u8 speed, void (*callback)(struct TextSubPrinter *, u16), u8 letterSpacing, u8 lineSpacing) { struct TextSubPrinter printer; @@ -1997,7 +2011,7 @@ void PrintPlayerNameOnWindow(u8 windowId, const u8 *src, u16 x, u16 y) StringExpandPlaceholders(gStringVar4, src); - PrintTextOnWindow(windowId, 1, gStringVar4, x, y, 0xFF, 0); + AddTextPrinterParameterized(windowId, 1, gStringVar4, x, y, 0xFF, 0); } //Screw this function, it's long and unreferenced and ugh |