From 9e59afca88cda7c2ba909170bf97c1e5ffd83e93 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Wed, 2 Nov 2022 13:53:27 -0400 Subject: [PATCH] Document DrawHelpMessageWindowTiles --- include/help_message.h | 2 +- src/help_message.c | 27 ++++++++++++++------------- src/help_system.c | 2 +- src/party_menu.c | 2 +- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/include/help_message.h b/include/help_message.h index 61b3787b2..b75abc77e 100644 --- a/include/help_message.h +++ b/include/help_message.h @@ -7,6 +7,6 @@ void DestroyHelpMessageWindow(u8 a0); u8 CreateHelpMessageWindow(void); void PrintTextOnHelpMessageWindow(const u8 * text, u8 mode); void MapNamePopupWindowIdSetDummy(void); -void sub_8112F18(u8 windowId); +void DrawHelpMessageWindowTilesById(u8 windowId); #endif //GUARD_HELP_MESSAGE_H diff --git a/src/help_message.c b/src/help_message.c index bb8975844..425ce88ac 100644 --- a/src/help_message.c +++ b/src/help_message.c @@ -47,13 +47,14 @@ void DestroyHelpMessageWindow(u8 a0) } } -void sub_8112F18(u8 windowId) +// Creates the bottom bar window that displays help text for e.g. the options in the Start menu +void DrawHelpMessageWindowTilesById(u8 windowId) { const u8 *ptr = gHelpMessageWindow_Gfx; u8 *buffer; u8 i, j; u8 width, height; - u8 k; + u8 tileId; width = (u8)GetWindowAttribute(windowId, WINDOW_WIDTH); height = (u8)GetWindowAttribute(windowId, WINDOW_HEIGHT); @@ -66,15 +67,15 @@ void sub_8112F18(u8 windowId) { for (j = 0; j < width; j++) { - if (i == 0) - k = 0; - else if (i == height - 1) - k = 14; - else - k = 5; + if (i == 0) // Top row + tileId = 0; + else if (i == height - 1) // Bottom row + tileId = 14; + else // Middle row + tileId = 5; CpuCopy32( - &ptr[k * 0x20], - &buffer[(i * width + j) * 0x20], + &ptr[tileId * 32], + &buffer[(i * width + j) * 32], 32 ); } @@ -84,9 +85,9 @@ void sub_8112F18(u8 windowId) } } -static void sub_8112FD0(void) +static void DrawHelpMessageWindowTiles(void) { - sub_8112F18(sHelpMessageWindowId); + DrawHelpMessageWindowTilesById(sHelpMessageWindowId); } static const u8 sHelpMessageTextColors[3] = {TEXT_COLOR_TRANSPARENT, TEXT_DYNAMIC_COLOR_1, TEXT_COLOR_DARK_GRAY}; @@ -98,7 +99,7 @@ static void PrintHelpMessageText(const u8 *text) void PrintTextOnHelpMessageWindow(const u8 *text, u8 mode) { - sub_8112FD0(); + DrawHelpMessageWindowTiles(); PrintHelpMessageText(text); if (mode) CopyWindowToVram(sHelpMessageWindowId, mode); diff --git a/src/help_system.c b/src/help_system.c index f29359354..b178fd6ab 100644 --- a/src/help_system.c +++ b/src/help_system.c @@ -1646,7 +1646,7 @@ static const u8 *const sHelpSystemSubmenuItemLists[HELPCONTEXT_COUNT * (TOPIC_CO NULL, NULL, NULL, NULL, NULL // HELPCONTEXT_UNUSED }; -static const u16 unref_845BCB0[] = INCBIN_U16("graphics/help_system/unused.bin"); +static const u16 sUnused[] = INCBIN_U16("graphics/help_system/unused.bin"); static const u8 sHelpSystemContextTopicOrder[TOPIC_COUNT] = { TOPIC_ABOUT_GAME, diff --git a/src/party_menu.c b/src/party_menu.c index 400761801..f9f51c887 100644 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -2636,7 +2636,7 @@ static void ToggleFieldMoveDescriptionWindow(u8 action) { if (ptr->windowId[2] == WINDOW_NONE) ptr->windowId[2] = AddWindow(&sFieldMoveDescriptionWindowTemplate); - sub_8112F18(ptr->windowId[2]); + DrawHelpMessageWindowTilesById(ptr->windowId[2]); letterSpacing = GetFontAttribute(FONT_2, FONTATTR_LETTER_SPACING); AddTextPrinterParameterized4(ptr->windowId[2], FONT_2, 3, 6, letterSpacing, 0, sFontColorTable[5], 0, sFieldMoveDescriptionTable[action - CURSOR_OPTION_FIELD_MOVES]); PutWindowTilemap(ptr->windowId[2]);