diff --git a/graphics/interface/860F0B0.pal b/graphics/interface/hof_pc_topbar.pal similarity index 100% rename from graphics/interface/860F0B0.pal rename to graphics/interface/hof_pc_topbar.pal diff --git a/graphics/interface_fr/menu.png b/graphics/interface/menu_info.png similarity index 100% rename from graphics/interface_fr/menu.png rename to graphics/interface/menu_info.png diff --git a/graphics/interface_fr/menu1.pal b/graphics/interface/menu_info1.pal similarity index 100% rename from graphics/interface_fr/menu1.pal rename to graphics/interface/menu_info1.pal diff --git a/graphics/interface_fr/menu2.pal b/graphics/interface/menu_info2.pal similarity index 100% rename from graphics/interface_fr/menu2.pal rename to graphics/interface/menu_info2.pal diff --git a/graphics/interface_fr/menu3.pal b/graphics/interface/menu_info3.pal similarity index 100% rename from graphics/interface_fr/menu3.pal rename to graphics/interface/menu_info3.pal diff --git a/include/graphics.h b/include/graphics.h index a58b0f0f1..eeb8f65a3 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -3855,10 +3855,10 @@ extern const u32 gItemIcon_ReturnToFieldArrow[]; extern const u32 gItemIconPalette_ReturnToFieldArrow[]; //menu graphics -extern const u16 gFireRedMenuElements1_Pal[16]; -extern const u16 gFireRedMenuElements2_Pal[16]; -extern const u16 gFireRedMenuElements3_Pal[16]; -extern const u8 gFireRedMenuElements_Gfx[]; +extern const u16 gMenuInfoElements1_Pal[16]; +extern const u16 gMenuInfoElements2_Pal[16]; +extern const u16 gMenuInfoElements3_Pal[16]; +extern const u8 gMenuInfoElements_Gfx[]; // item menu graphics extern const u32 gBagScreen_Gfx[]; diff --git a/include/menu.h b/include/menu.h index cc65a51dc..3f9ccd721 100644 --- a/include/menu.h +++ b/include/menu.h @@ -66,7 +66,7 @@ void SetWindowTemplateFields(struct WindowTemplate* template, u8 priority, u8 ti void DrawStdFrameWithCustomTileAndPalette(u8 windowId, bool8 copyToVram, u16 tileStart, u8 palette); void ScheduleBgCopyTilemapToVram(u8 bgNum); void PrintMenuTable(u8 windowId, u8 itemCount, const struct MenuAction *strs); -u8 InitMenuInUpperLeftCornerPlaySoundWhenAPressed(u8 windowId, u8 numItems, u8 initialCursorPos); +u8 InitMenuInUpperLeftCornerNormal(u8 windowId, u8 numItems, u8 initialCursorPos); u8 Menu_GetCursorPos(void); s8 Menu_ProcessInput(void); s8 Menu_ProcessInputNoWrap(void); @@ -85,7 +85,6 @@ void AddTextPrinterParameterized4(u8 windowId, u8 fontId, u8 x, u8 y, u8 letterS void DrawDialogFrameWithCustomTileAndPalette(u8 windowId, bool8 copyToVram, u16 a2, u8 a3); void sub_81995E4(u8 windowId, u8 optionsNo, const struct MenuAction *actions, const u8 *actionIds); void ClearDialogWindowAndFrameToTransparent(u8 windowId, bool8 copyToVram); -u16 sub_8198AA4(u8, u8, u8, u8, u8, u8, u16); void *malloc_and_decompress(const void *src, u32 *sizeOut); u16 copy_decompressed_tile_data_to_vram(u8 bgId, const void *src, u16 size, u16 offset, u8 mode); void AddTextPrinterForMessage(bool8 allowSkippingDelayWithButtonPress); @@ -98,8 +97,8 @@ void ListMenuLoadStdPalAt(u8, u8); u8 Menu_MoveCursor(s8 cursorDelta); u8 Menu_MoveCursorNoWrapAround(s8 cursorDelta); void DrawStdWindowFrame(u8 windowId, bool8 CopyToVram); -u8 sub_81979C4(u8 a1); -u8 sub_81983AC(u8 windowId, u8 fontId, u8 left, u8 top, u8 cursorHeight, u8 numChoices, u8 initialCursorPos); +u8 AddStartMenuWindow(u8 numActions); +u8 InitMenuNormal(u8 windowId, u8 fontId, u8 left, u8 top, u8 cursorHeight, u8 numChoices, u8 initialCursorPos); void sub_819786C(u8 windowId, bool8 copyToVram); void AddTextPrinterForMessage_2(bool8 allowSkippingDelayWithButtonPress); void RemoveStartMenuWindow(void); @@ -111,20 +110,20 @@ u8 AddMapNamePopUpWindow(void); void AddTextPrinterParameterized5(u8 windowId, u8 fontId, const u8 *str, u8 left, u8 top, u8 speed, void (*callback)(struct TextPrinterTemplate *, u16), u8 letterSpacing, u8 lineSpacing); void SetBgTilemapPalette(u8 bgId, u8 left, u8 top, u8 width, u8 height, u8 palette); void sub_8199D3C(void *ptr, int delta, int width, int height, bool32 is8BPP); -void sub_8198204(const u8 *string, const u8 *string2, u8 a3, u8 a4, bool8 copyToVram); -void sub_8197AE8(bool8 copyToVram); +void EraseFieldMessageBox(bool8 copyToVram); void PrintMenuGridTable(u8 windowId, u8 optionWidth, u8 columns, u8 rows, const struct MenuAction *strs); s8 Menu_ProcessInputGridLayout(void); u8 InitMenuInUpperLeftCorner(u8 windowId, u8 itemCount, u8 initialCursorPos, bool8 APressMuted); s8 Menu_ProcessInputNoWrapAround_other(void); void CopyToBufferFromBgTilemap(u8 bgId, u16 *dest, u8 left, u8 top, u8 width, u8 height); -u8 sub_81980F0(u8 bg, u8 xPos, u8 yPos, u8 palette, u16 baseTile); -void sub_8198314(void); -void sub_8198180(const u8 *string, u8 a2, bool8 copyToVram); +u8 HofPCTopBar_AddWindow(u8 bg, u8 xPos, u8 yPos, u8 palette, u16 baseTile); +void HofPCTopBar_RemoveWindow(void); +void HofPCTopBar_Print(const u8 *string, u8 left, bool8 copyToVram); +void HofPCTopBar_PrintPair(const u8 *string, const u8 *string2, bool8 noBg, u8 left, bool8 copyToVram); void ResetBgPositions(void); void AddTextPrinterWithCustomSpeedForMessage(bool8 allowSkippingDelayWithButtonPress, u8 speed); void EraseYesNoWindow(void); -void PrintTextArray(u8 windowId, u8 fontId, u8 left, u8 top, u8 lineHeight, u8 itemCount, const struct MenuAction *strs); +void PrintMenuActionTextsAtPos(u8 windowId, u8 fontId, u8 left, u8 top, u8 lineHeight, u8 itemCount, const struct MenuAction *strs); void Menu_LoadStdPal(void); #endif // GUARD_MENU_H diff --git a/src/apprentice.c b/src/apprentice.c index 8421d4d8b..604891511 100644 --- a/src/apprentice.c +++ b/src/apprentice.c @@ -645,7 +645,7 @@ static void CreateApprenticeMenu(u8 menu) for (i = 0; i < count; i++) AddTextPrinterParameterized(windowId, FONT_NORMAL, strings[i], 8, (i * 16) + 1, TEXT_SPEED_FF, NULL); - InitMenuInUpperLeftCornerPlaySoundWhenAPressed(windowId, count, 0); + InitMenuInUpperLeftCornerNormal(windowId, count, 0); CreateChooseAnswerTask(TRUE, count, windowId); } diff --git a/src/battle_pyramid_bag.c b/src/battle_pyramid_bag.c index 7ba4c96e7..fdd3f0378 100644 --- a/src/battle_pyramid_bag.c +++ b/src/battle_pyramid_bag.c @@ -979,7 +979,7 @@ static void OpenContextMenu(u8 taskId) static void PrintMenuActionText_SingleRow(u8 windowId) { AddItemMenuActionTextPrinters(windowId, FONT_NARROW, 8, 1, 0, 0x10, gPyramidBagMenu->menuActionsCount, sMenuActions, gPyramidBagMenu->menuActionIds); - InitMenuInUpperLeftCornerPlaySoundWhenAPressed(windowId, gPyramidBagMenu->menuActionsCount, 0); + InitMenuInUpperLeftCornerNormal(windowId, gPyramidBagMenu->menuActionsCount, 0); } static void PrintMenuActionText_MultiRow(u8 windowId, u8 horizontalCount, u8 verticalCount) diff --git a/src/cable_club.c b/src/cable_club.c index ef1d9ff0d..7d16c5b41 100644 --- a/src/cable_club.c +++ b/src/cable_club.c @@ -1078,7 +1078,7 @@ static void Task_EnterCableClubSeat(u8 taskId) case 3: // Exit, failure SetLinkWaitingForScript(); - sub_8197AE8(TRUE); + EraseFieldMessageBox(TRUE); DestroyTask(taskId); EnableBothScriptContexts(); break; diff --git a/src/decoration.c b/src/decoration.c index 52d1054c9..3f93d9ccc 100644 --- a/src/decoration.c +++ b/src/decoration.c @@ -557,7 +557,7 @@ static void AddDecorationActionsWindow(void) { u8 windowId = AddDecorationWindow(WINDOW_MAIN_MENU); PrintMenuTable(windowId, ARRAY_COUNT(sDecorationMainMenuActions), sDecorationMainMenuActions); - InitMenuInUpperLeftCornerPlaySoundWhenAPressed(windowId, ARRAY_COUNT(sDecorationMainMenuActions), sDecorationActionsCursorPos); + InitMenuInUpperLeftCornerNormal(windowId, ARRAY_COUNT(sDecorationMainMenuActions), sDecorationActionsCursorPos); } static void InitDecorationActionsWindow(void) @@ -697,7 +697,7 @@ static void InitDecorationCategoriesWindow(u8 taskId) { u8 windowId = AddDecorationWindow(WINDOW_DECORATION_CATEGORIES); PrintDecorationCategoryMenuItems(taskId); - InitMenuInUpperLeftCornerPlaySoundWhenAPressed(windowId, DECORCAT_COUNT + 1, sCurDecorationCategory); + InitMenuInUpperLeftCornerNormal(windowId, DECORCAT_COUNT + 1, sCurDecorationCategory); gTasks[taskId].func = HandleDecorationCategoriesMenuInput; } @@ -705,7 +705,7 @@ static void ReinitDecorationCategoriesWindow(u8 taskId) { FillWindowPixelBuffer(sDecorMenuWindowIds[WINDOW_DECORATION_CATEGORIES], PIXEL_FILL(1)); PrintDecorationCategoryMenuItems(taskId); - InitMenuInUpperLeftCornerPlaySoundWhenAPressed(sDecorMenuWindowIds[WINDOW_DECORATION_CATEGORIES], DECORCAT_COUNT + 1, sCurDecorationCategory); + InitMenuInUpperLeftCornerNormal(sDecorMenuWindowIds[WINDOW_DECORATION_CATEGORIES], DECORCAT_COUNT + 1, sCurDecorationCategory); gTasks[taskId].func = HandleDecorationCategoriesMenuInput; } diff --git a/src/graphics.c b/src/graphics.c index b4e1dfabe..73825aebf 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -1272,10 +1272,10 @@ const u32 gPokedexAreaScreenAreaUnknown_Gfx[] = INCBIN_U32("graphics/pokedex/are // seems to be fire red leftovers, but the menu elements is reused in the item menu for TM descriptions. -const u16 gFireRedMenuElements1_Pal[] = INCBIN_U16("graphics/interface_fr/menu1.gbapal"); -const u16 gFireRedMenuElements2_Pal[] = INCBIN_U16("graphics/interface_fr/menu2.gbapal"); -const u16 gFireRedMenuElements3_Pal[] = INCBIN_U16("graphics/interface_fr/menu3.gbapal"); -const u8 gFireRedMenuElements_Gfx[] = INCBIN_U8("graphics/interface_fr/menu.4bpp"); //the types are reused for item menu +const u16 gMenuInfoElements1_Pal[] = INCBIN_U16("graphics/interface/menu_info1.gbapal"); +const u16 gMenuInfoElements2_Pal[] = INCBIN_U16("graphics/interface/menu_info2.gbapal"); +const u16 gMenuInfoElements3_Pal[] = INCBIN_U16("graphics/interface/menu_info3.gbapal"); +const u8 gMenuInfoElements_Gfx[] = INCBIN_U8("graphics/interface/menu_info.4bpp"); //the types are reused for item menu const u8 gBagMenuHMIcon_Gfx[] = INCBIN_U8("graphics/interface/hm.4bpp"); diff --git a/src/hall_of_fame.c b/src/hall_of_fame.c index 58e062d50..e977828f9 100644 --- a/src/hall_of_fame.c +++ b/src/hall_of_fame.c @@ -343,7 +343,6 @@ static const struct HallofFameMon sDummyFameMon = static const u8 sHallOfFame_SlotOrder[] = { 2, 1, 3, 6, 4, 5, - 0, 0 }; // code @@ -862,7 +861,7 @@ void CB2_DoHallOfFamePC(void) static void Task_HofPC_CopySaveData(u8 taskId) { - sub_81980F0(0, 0x1E, 0, 0xC, 0x226); + HofPCTopBar_AddWindow(0, 30, 0, 12, 0x226); if (Save_LoadGameData(SAVE_HALL_OF_FAME) != SAVE_STATUS_OK) { gTasks[taskId].func = Task_HofPC_PrintDataIsCorrupted; @@ -950,9 +949,9 @@ static void Task_HofPC_DrawSpritesPrintText(u8 taskId) StringExpandPlaceholders(gStringVar4, gText_HOFNumber); if (gTasks[taskId].tCurrTeamNo <= 0) - sub_8198204(gStringVar4, gText_PickCancel, 0, 0, TRUE); + HofPCTopBar_PrintPair(gStringVar4, gText_PickCancel, FALSE, 0, TRUE); else - sub_8198204(gStringVar4, gText_PickNextCancel, 0, 0, TRUE); + HofPCTopBar_PrintPair(gStringVar4, gText_PickNextCancel, FALSE, 0, TRUE); gTasks[taskId].func = Task_HofPC_PrintMonInfo; } @@ -1073,7 +1072,7 @@ static void Task_HofPC_HandleExit(u8 taskId) HideBg(0); HideBg(1); HideBg(3); - sub_8198314(); + HofPCTopBar_RemoveWindow(); FreeAllWindowBuffers(); UnsetBgTilemapBuffer(1); UnsetBgTilemapBuffer(3); @@ -1091,7 +1090,7 @@ static void Task_HofPC_HandleExit(u8 taskId) static void Task_HofPC_PrintDataIsCorrupted(u8 taskId) { - sub_8198180(gText_AButtonExit, 8, TRUE); + HofPCTopBar_Print(gText_AButtonExit, 8, TRUE); DrawDialogueFrame(0, 0); AddTextPrinterParameterized2(0, FONT_NORMAL, gText_HOFCorrupted, 0, NULL, 2, 1, 3); CopyWindowToVram(0, COPYWIN_FULL); diff --git a/src/item_menu.c b/src/item_menu.c index 1baa3965c..74e29fe87 100755 --- a/src/item_menu.c +++ b/src/item_menu.c @@ -1668,7 +1668,7 @@ static void OpenContextMenu(u8 taskId) static void PrintContextMenuItems(u8 windowId) { AddItemMenuActionTextPrinters(windowId, FONT_NARROW, 8, 1, 0, 16, gBagMenu->contextMenuNumItems, sItemMenuActions, gBagMenu->contextMenuItemsPtr); - InitMenuInUpperLeftCornerPlaySoundWhenAPressed(windowId, gBagMenu->contextMenuNumItems, 0); + InitMenuInUpperLeftCornerNormal(windowId, gBagMenu->contextMenuNumItems, 0); } static void PrintContextMenuItemGrid(u8 windowId, u8 columns, u8 rows) diff --git a/src/main_menu.c b/src/main_menu.c index bd7107963..5a9a48d70 100644 --- a/src/main_menu.c +++ b/src/main_menu.c @@ -2090,7 +2090,7 @@ static void NewGameBirchSpeech_ShowGenderMenu(void) DrawMainMenuWindowBorder(&gNewGameBirchSpeechTextWindows[1], 0xF3); FillWindowPixelBuffer(1, PIXEL_FILL(1)); PrintMenuTable(1, ARRAY_COUNT(sMenuActions_Gender), sMenuActions_Gender); - InitMenuInUpperLeftCornerPlaySoundWhenAPressed(1, 2, 0); + InitMenuInUpperLeftCornerNormal(1, 2, 0); PutWindowTilemap(1); CopyWindowToVram(1, COPYWIN_FULL); } diff --git a/src/mauville_old_man.c b/src/mauville_old_man.c index 2525e065a..751e5f91c 100644 --- a/src/mauville_old_man.c +++ b/src/mauville_old_man.c @@ -1346,7 +1346,7 @@ static void PrintStoryList(void) AddTextPrinterParameterized(sStorytellerWindowId, FONT_NORMAL, GetStoryTitleByStat(gameStatID), 8, 16 * i + 1, 0xFF, NULL); } AddTextPrinterParameterized(sStorytellerWindowId, FONT_NORMAL, gText_Exit, 8, 16 * i + 1, 0xFF, NULL); - InitMenuInUpperLeftCornerPlaySoundWhenAPressed(sStorytellerWindowId, GetFreeStorySlot() + 1, 0); + InitMenuInUpperLeftCornerNormal(sStorytellerWindowId, GetFreeStorySlot() + 1, 0); CopyWindowToVram(sStorytellerWindowId, COPYWIN_FULL); } diff --git a/src/menu.c b/src/menu.c index 7625f113c..94ad65e21 100644 --- a/src/menu.c +++ b/src/menu.c @@ -48,13 +48,24 @@ struct Menu bool8 APressMuted; }; +static u16 AddWindowParameterized(u8, u8, u8, u8, u8, u8, u16); +static void WindowFunc_DrawStandardFrame(u8, u8, u8, u8, u8, u8); +static void WindowFunc_DrawDialogueFrame(u8, u8, u8, u8, u8, u8); +static void WindowFunc_ClearStdWindowAndFrame(u8, u8, u8, u8, u8, u8); +static void WindowFunc_ClearDialogWindowAndFrame(u8, u8, u8, u8, u8, u8); +static void WindowFunc_DrawDialogFrameWithCustomTileAndPalette(u8, u8, u8, u8, u8, u8); +static void WindowFunc_ClearDialogWindowAndFrameNullPalette(u8, u8, u8, u8, u8, u8); +static void WindowFunc_DrawStdFrameWithCustomTileAndPalette(u8, u8, u8, u8, u8, u8); +static void WindowFunc_ClearStdWindowAndFrameToTransparent(u8, u8, u8, u8, u8, u8); +static void task_free_buf_after_copying_tile_data_to_vram(u8 taskId); + static EWRAM_DATA u8 sStartMenuWindowId = 0; static EWRAM_DATA u8 sMapNamePopupWindowId = 0; static EWRAM_DATA struct Menu sMenu = {0}; static EWRAM_DATA u16 sTileNum = 0; static EWRAM_DATA u8 sPaletteNum = 0; static EWRAM_DATA u8 sYesNoWindowId = 0; -static EWRAM_DATA u8 sWindowId = 0; +static EWRAM_DATA u8 sHofPCTopBarWindowId = 0; static EWRAM_DATA u16 sFiller = 0; // needed to align static EWRAM_DATA bool8 sScheduledBgCopiesToVram[4] = {FALSE}; static EWRAM_DATA u16 sTempTileDataBufferIdx = 0; @@ -94,10 +105,10 @@ static const struct WindowTemplate sYesNo_WindowTemplates = .baseBlock = 0x125 }; -const u16 gUnknown_0860F0B0[] = INCBIN_U16("graphics/interface/860F0B0.gbapal"); -const u8 sTextColors[] = { TEXT_DYNAMIC_COLOR_6, TEXT_COLOR_WHITE, TEXT_COLOR_DARK_GRAY }; +static const u16 sHofPC_TopBar_Pal[] = INCBIN_U16("graphics/interface/hof_pc_topbar.gbapal"); +static const u8 sTextColors[] = { TEXT_DYNAMIC_COLOR_6, TEXT_COLOR_WHITE, TEXT_COLOR_DARK_GRAY }; -// Table of move info icon offsets in graphics/interface_fr/menu.png +// Table of move info icon offsets in graphics/interface/menu_info.png static const struct MenuInfoIcon sMenuInfoIcons[] = { // { width, height, offset } { 12, 12, 0x00 }, // Unused @@ -128,18 +139,6 @@ static const struct MenuInfoIcon sMenuInfoIcons[] = [MENU_INFO_ICON_BALL_BLUE] = { 8, 8, 0xAF }, // For placed decorations in player's room }; - -// Forward declarations -void WindowFunc_DrawStandardFrame(u8, u8, u8, u8, u8, u8); -void WindowFunc_DrawDialogueFrame(u8, u8, u8, u8, u8, u8); -void WindowFunc_ClearStdWindowAndFrame(u8, u8, u8, u8, u8, u8); -void WindowFunc_ClearDialogWindowAndFrame(u8, u8, u8, u8, u8, u8); -void WindowFunc_DrawDialogFrameWithCustomTileAndPalette(u8, u8, u8, u8, u8, u8); -void WindowFunc_ClearDialogWindowAndFrameNullPalette(u8, u8, u8, u8, u8, u8); -void WindowFunc_DrawStdFrameWithCustomTileAndPalette(u8, u8, u8, u8, u8, u8); -void WindowFunc_ClearStdWindowAndFrameToTransparent(u8, u8, u8, u8, u8, u8); -void task_free_buf_after_copying_tile_data_to_vram(u8 taskId); - void InitStandardTextBoxWindows(void) { InitWindows(sStandardTextBox_WindowTemplates); @@ -249,7 +248,7 @@ void ClearStdWindowAndFrame(u8 windowId, bool8 copyToVram) CopyWindowToVram(windowId, COPYWIN_FULL); } -void WindowFunc_DrawStandardFrame(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 paletteNum) +static void WindowFunc_DrawStandardFrame(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 paletteNum) { int i; @@ -316,7 +315,7 @@ void WindowFunc_DrawStandardFrame(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width STD_WINDOW_PALETTE_NUM); } -void WindowFunc_DrawDialogueFrame(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 paletteNum) +static void WindowFunc_DrawDialogueFrame(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 paletteNum) { FillBgTilemapBufferRect(bg, DLG_WINDOW_BASE_TILE_NUM + 1, @@ -411,12 +410,12 @@ void WindowFunc_DrawDialogueFrame(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width DLG_WINDOW_PALETTE_NUM); } -void WindowFunc_ClearStdWindowAndFrame(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 paletteNum) +static void WindowFunc_ClearStdWindowAndFrame(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 paletteNum) { FillBgTilemapBufferRect(bg, 0, tilemapLeft - 1, tilemapTop - 1, width + 2, height + 2, STD_WINDOW_PALETTE_NUM); } -void WindowFunc_ClearDialogWindowAndFrame(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 paletteNum) +static void WindowFunc_ClearDialogWindowAndFrame(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 paletteNum) { FillBgTilemapBufferRect(bg, 0, tilemapLeft - 3, tilemapTop - 1, width + 6, height + 2, STD_WINDOW_PALETTE_NUM); } @@ -489,10 +488,10 @@ u8 GetPlayerTextSpeedDelay(void) return sTextSpeedFrameDelays[speed]; } -u8 sub_81979C4(u8 a1) +u8 AddStartMenuWindow(u8 numActions) { if (sStartMenuWindowId == WINDOW_NONE) - sStartMenuWindowId = sub_8198AA4(0, 0x16, 1, 7, (a1 * 2) + 2, 0xF, 0x139); + sStartMenuWindowId = AddWindowParameterized(0, 22, 1, 7, (numActions * 2) + 2, 15, 0x139); return sStartMenuWindowId; } @@ -525,7 +524,7 @@ static u16 GetStandardFrameBaseTileNum(void) u8 AddMapNamePopUpWindow(void) { if (sMapNamePopupWindowId == WINDOW_NONE) - sMapNamePopupWindowId = sub_8198AA4(0, 1, 1, 10, 3, 14, 0x107); + sMapNamePopupWindowId = AddWindowParameterized(0, 1, 1, 10, 3, 14, 0x107); return sMapNamePopupWindowId; } @@ -549,7 +548,7 @@ void AddTextPrinterWithCallbackForMessage(bool8 a1, void (*callback)(struct Text AddTextPrinterParameterized2(0, FONT_NORMAL, gStringVar4, GetPlayerTextSpeedDelay(), callback, 2, 1, 3); } -void sub_8197AE8(bool8 copyToVram) +void EraseFieldMessageBox(bool8 copyToVram) { FillBgTilemapBufferRect(0, 0, 0, 0, 32, 32, 0x11); if (copyToVram == TRUE) @@ -568,7 +567,7 @@ void DrawDialogFrameWithCustomTileAndPalette(u8 windowId, bool8 copyToVram, u16 } // Never used. -void DrawDialogFrameWithCustomTile(u8 windowId, bool8 copyToVram, u16 tileNum) +static void DrawDialogFrameWithCustomTile(u8 windowId, bool8 copyToVram, u16 tileNum) { sTileNum = tileNum; sPaletteNum = GetWindowAttribute(windowId, WINDOW_PALETTE_NUM); @@ -579,7 +578,7 @@ void DrawDialogFrameWithCustomTile(u8 windowId, bool8 copyToVram, u16 tileNum) CopyWindowToVram(windowId, COPYWIN_FULL); } -void WindowFunc_DrawDialogFrameWithCustomTileAndPalette(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 paletteNum) +static void WindowFunc_DrawDialogFrameWithCustomTileAndPalette(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 paletteNum) { FillBgTilemapBufferRect(bg, sTileNum + 1, @@ -684,7 +683,7 @@ void ClearDialogWindowAndFrameToTransparent(u8 windowId, bool8 copyToVram) CopyWindowToVram(windowId, COPYWIN_FULL); } -void WindowFunc_ClearDialogWindowAndFrameNullPalette(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 paletteNum) +static void WindowFunc_ClearDialogWindowAndFrameNullPalette(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 paletteNum) { FillBgTilemapBufferRect(bg, 0, tilemapLeft - 3, tilemapTop - 1, width + 6, height + 2, 0); } @@ -712,7 +711,7 @@ void DrawStdFrameWithCustomTile(u8 windowId, bool8 copyToVram, u16 baseTileNum) CopyWindowToVram(windowId, COPYWIN_FULL); } -void WindowFunc_DrawStdFrameWithCustomTileAndPalette(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 paletteNum) +static void WindowFunc_DrawStdFrameWithCustomTileAndPalette(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 paletteNum) { FillBgTilemapBufferRect(bg, sTileNum + 0, @@ -781,12 +780,13 @@ void ClearStdWindowAndFrameToTransparent(u8 windowId, bool8 copyToVram) CopyWindowToVram(windowId, COPYWIN_FULL); } -void WindowFunc_ClearStdWindowAndFrameToTransparent(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 paletteNum) +static void WindowFunc_ClearStdWindowAndFrameToTransparent(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 paletteNum) { FillBgTilemapBufferRect(bg, 0, tilemapLeft - 1, tilemapTop - 1, width + 2, height + 2, 0); } -u8 sub_81980F0(u8 bg, u8 xPos, u8 yPos, u8 palette, u16 baseTile) +// Creates the window used to display the info bar at the top of the HOF PC that shows the controls and team number. +u8 HofPCTopBar_AddWindow(u8 bg, u8 xPos, u8 yPos, u8 palette, u16 baseTile) { struct WindowTemplate window; memset(&window, 0, sizeof(window)); @@ -798,51 +798,54 @@ u8 sub_81980F0(u8 bg, u8 xPos, u8 yPos, u8 palette, u16 baseTile) window.tilemapTop = yPos; window.height = 2; - window.tilemapLeft = 0x1E - xPos; + window.tilemapLeft = 30 - xPos; window.width = xPos; window.paletteNum = palette; window.baseBlock = baseTile; - sWindowId = AddWindow(&window); + sHofPCTopBarWindowId = AddWindow(&window); if (palette > 15) palette = 15 * 16; else palette *= 16; - LoadPalette(gUnknown_0860F0B0, palette, sizeof(gUnknown_0860F0B0)); - return sWindowId; + LoadPalette(sHofPC_TopBar_Pal, palette, sizeof(sHofPC_TopBar_Pal)); + return sHofPCTopBarWindowId; } -void sub_8198180(const u8 *string, u8 a2, bool8 copyToVram) +// All the below functions checking WINDOW_NONE only handle failure of AddWindow in the above function. +// Because sHofPCTopBarWindowId is not initialized to WINDOW_NONE anywhere it does not handle +// the window not having been drawn yet. +void HofPCTopBar_Print(const u8 *string, u8 left, bool8 copyToVram) { u16 width = 0; - if (sWindowId != WINDOW_NONE) + if (sHofPCTopBarWindowId != WINDOW_NONE) { - PutWindowTilemap(sWindowId); - FillWindowPixelBuffer(sWindowId, PIXEL_FILL(15)); + PutWindowTilemap(sHofPCTopBarWindowId); + FillWindowPixelBuffer(sHofPCTopBarWindowId, PIXEL_FILL(15)); width = GetStringWidth(FONT_SMALL, string, 0); - AddTextPrinterParameterized3(sWindowId, + AddTextPrinterParameterized3(sHofPCTopBarWindowId, FONT_SMALL, - 0xEC - (GetWindowAttribute(sWindowId, WINDOW_TILEMAP_LEFT) * 8) - a2 - width, + 236 - (GetWindowAttribute(sHofPCTopBarWindowId, WINDOW_TILEMAP_LEFT) * 8) - left - width, 1, sTextColors, 0, string); if (copyToVram) - CopyWindowToVram(sWindowId, COPYWIN_FULL); + CopyWindowToVram(sHofPCTopBarWindowId, COPYWIN_FULL); } } -void sub_8198204(const u8 *string, const u8 *string2, u8 a3, u8 a4, bool8 copyToVram) +void HofPCTopBar_PrintPair(const u8 *string, const u8 *string2, bool8 noBg, u8 left, bool8 copyToVram) { u8 color[3]; u16 width = 0; - if (sWindowId != WINDOW_NONE) + if (sHofPCTopBarWindowId != WINDOW_NONE) { - if (a3 != 0) + if (noBg) { color[0] = TEXT_COLOR_TRANSPARENT; color[1] = TEXT_COLOR_WHITE; @@ -854,53 +857,55 @@ void sub_8198204(const u8 *string, const u8 *string2, u8 a3, u8 a4, bool8 copyTo color[1] = TEXT_COLOR_WHITE; color[2] = TEXT_COLOR_DARK_GRAY; } - PutWindowTilemap(sWindowId); - FillWindowPixelBuffer(sWindowId, PIXEL_FILL(15)); + PutWindowTilemap(sHofPCTopBarWindowId); + FillWindowPixelBuffer(sHofPCTopBarWindowId, PIXEL_FILL(15)); if (string2 != NULL) { width = GetStringWidth(FONT_SMALL, string2, 0); - AddTextPrinterParameterized3(sWindowId, + AddTextPrinterParameterized3(sHofPCTopBarWindowId, FONT_SMALL, - 0xEC - (GetWindowAttribute(sWindowId, WINDOW_TILEMAP_LEFT) * 8) - a4 - width, + 236 - (GetWindowAttribute(sHofPCTopBarWindowId, WINDOW_TILEMAP_LEFT) * 8) - left - width, 1, color, 0, string2); } - AddTextPrinterParameterized4(sWindowId, FONT_NORMAL, 4, 1, 0, 0, color, 0, string); + AddTextPrinterParameterized4(sHofPCTopBarWindowId, FONT_NORMAL, 4, 1, 0, 0, color, 0, string); if (copyToVram) - CopyWindowToVram(sWindowId, COPYWIN_FULL); + CopyWindowToVram(sHofPCTopBarWindowId, COPYWIN_FULL); } } -void sub_81982D8(void) +// Unused +static void HofPCTopBar_CopyToVram(void) { - if (sWindowId != WINDOW_NONE) - CopyWindowToVram(sWindowId, COPYWIN_FULL); + if (sHofPCTopBarWindowId != WINDOW_NONE) + CopyWindowToVram(sHofPCTopBarWindowId, COPYWIN_FULL); } -void sub_81982F0(void) +// Unused +static void HofPCTopBar_Clear(void) { - if (sWindowId != WINDOW_NONE) + if (sHofPCTopBarWindowId != WINDOW_NONE) { - FillWindowPixelBuffer(sWindowId, PIXEL_FILL(15)); - CopyWindowToVram(sWindowId, COPYWIN_FULL); + FillWindowPixelBuffer(sHofPCTopBarWindowId, PIXEL_FILL(15)); + CopyWindowToVram(sHofPCTopBarWindowId, COPYWIN_FULL); } } -void sub_8198314(void) +void HofPCTopBar_RemoveWindow(void) { - if (sWindowId != WINDOW_NONE) + if (sHofPCTopBarWindowId != WINDOW_NONE) { - FillWindowPixelBuffer(sWindowId, PIXEL_FILL(0)); - ClearWindowTilemap(sWindowId); - CopyWindowToVram(sWindowId, COPYWIN_FULL); - RemoveWindow(sWindowId); - sWindowId = WINDOW_NONE; + FillWindowPixelBuffer(sHofPCTopBarWindowId, PIXEL_FILL(0)); + ClearWindowTilemap(sHofPCTopBarWindowId); + CopyWindowToVram(sHofPCTopBarWindowId, COPYWIN_FULL); + RemoveWindow(sHofPCTopBarWindowId); + sHofPCTopBarWindowId = WINDOW_NONE; } } -u8 sub_8198348(u8 windowId, u8 fontId, u8 left, u8 top, u8 cursorHeight, u8 numChoices, u8 initialCursorPos, u8 a7) +static u8 InitMenu(u8 windowId, u8 fontId, u8 left, u8 top, u8 cursorHeight, u8 numChoices, u8 initialCursorPos, bool8 muteAPress) { s32 pos; @@ -911,7 +916,7 @@ u8 sub_8198348(u8 windowId, u8 fontId, u8 left, u8 top, u8 cursorHeight, u8 numC sMenu.windowId = windowId; sMenu.fontId = fontId; sMenu.optionHeight = cursorHeight; - sMenu.APressMuted = a7; + sMenu.APressMuted = muteAPress; pos = initialCursorPos; @@ -924,15 +929,17 @@ u8 sub_8198348(u8 windowId, u8 fontId, u8 left, u8 top, u8 cursorHeight, u8 numC return sMenu.cursorPos; } -u8 sub_81983AC(u8 windowId, u8 fontId, u8 left, u8 top, u8 cursorHeight, u8 numChoices, u8 initialCursorPos) +// There is no muted version of this, so the version that plays sound when A is pressed is the "Normal" one. +u8 InitMenuNormal(u8 windowId, u8 fontId, u8 left, u8 top, u8 cursorHeight, u8 numChoices, u8 initialCursorPos) { - return sub_8198348(windowId, fontId, left, top, cursorHeight, numChoices, initialCursorPos, 0); + return InitMenu(windowId, fontId, left, top, cursorHeight, numChoices, initialCursorPos, FALSE); } -u8 sub_81983EC(u8 windowId, u8 fontId, u8 left, u8 top, u8 numChoices, u8 initialCursorPos) +// Unused +static u8 InitMenuDefaultCursorHeight(u8 windowId, u8 fontId, u8 left, u8 top, u8 numChoices, u8 initialCursorPos) { u8 cursorHeight = GetMenuCursorDimensionByFont(fontId, 1); - return sub_81983AC(windowId, fontId, left, top, cursorHeight, numChoices, initialCursorPos); + return InitMenuNormal(windowId, fontId, left, top, cursorHeight, numChoices, initialCursorPos); } void RedrawMenuCursor(u8 oldPos, u8 newPos) @@ -1098,29 +1105,27 @@ s8 Menu_ProcessInputNoWrapAround_other(void) return MENU_NOTHING_CHOSEN; } -void PrintTextArray(u8 windowId, u8 fontId, u8 left, u8 top, u8 lineHeight, u8 itemCount, const struct MenuAction *menuActions) +void PrintMenuActionTextsAtPos(u8 windowId, u8 fontId, u8 left, u8 top, u8 lineHeight, u8 itemCount, const struct MenuAction *menuActions) { u8 i; for (i = 0; i < itemCount; i++) - { - AddTextPrinterParameterized(windowId, fontId, menuActions[i].text, left, (lineHeight * i) + top, 0xFF, NULL); - } + AddTextPrinterParameterized(windowId, fontId, menuActions[i].text, left, (lineHeight * i) + top, TEXT_SPEED_FF, NULL); CopyWindowToVram(windowId, COPYWIN_GFX); } -void sub_81987BC(u8 windowId, u8 fontId, u8 left, u8 top, u8 lineHeight, u8 itemCount, const struct MenuAction *menuActions, u8 a6, u8 a7) +// Unused +static void PrintMenuActionTextsWithSpacing(u8 windowId, u8 fontId, u8 left, u8 top, u8 lineHeight, u8 itemCount, const struct MenuAction *menuActions, u8 letterSpacing, u8 lineSpacing) { u8 i; for (i = 0; i < itemCount; i++) - { - AddTextPrinterParameterized5(windowId, fontId, menuActions[i].text, left, (lineHeight * i) + top, 0xFF, NULL, a6, a7); - } + AddTextPrinterParameterized5(windowId, fontId, menuActions[i].text, left, (lineHeight * i) + top, TEXT_SPEED_FF, NULL, letterSpacing, lineSpacing); CopyWindowToVram(windowId, COPYWIN_GFX); } -void sub_8198854(u8 windowId, u8 fontId, u8 lineHeight, u8 itemCount, const struct MenuAction *menuActions) +// Unused +static void PrintMenuActionTextsAtTop(u8 windowId, u8 fontId, u8 lineHeight, u8 itemCount, const struct MenuAction *menuActions) { - PrintTextArray(windowId, fontId, GetFontAttribute(fontId, 0), 1, lineHeight, itemCount, menuActions); + PrintMenuActionTextsAtPos(windowId, fontId, GetFontAttribute(fontId, FONTATTR_MAX_LETTER_WIDTH), 1, lineHeight, itemCount, menuActions); } void AddItemMenuActionTextPrinters(u8 windowId, u8 fontId, u8 left, u8 top, u8 letterSpacing, u8 lineHeight, u8 itemCount, const struct MenuAction *menuActions, const u8 *actionIds) @@ -1144,13 +1149,14 @@ void AddItemMenuActionTextPrinters(u8 windowId, u8 fontId, u8 left, u8 top, u8 l printer.currentChar = menuActions[actionIds[i]].text; printer.y = (lineHeight * i) + top; printer.currentY = printer.y; - AddTextPrinter(&printer, 0xFF, NULL); + AddTextPrinter(&printer, TEXT_SPEED_FF, NULL); } CopyWindowToVram(windowId, COPYWIN_GFX); } -void sub_81989B8(u8 windowId, u8 fontId, u8 lineHeight, u8 itemCount, const struct MenuAction *menuActions, const u8 *actionIds) +// Unused +static void AddItemMenuActionTextPrintersAtTop(u8 windowId, u8 fontId, u8 lineHeight, u8 itemCount, const struct MenuAction *menuActions, const u8 *actionIds) { AddItemMenuActionTextPrinters(windowId, fontId, GetFontAttribute(fontId, FONTATTR_MAX_LETTER_WIDTH), 1, GetFontAttribute(fontId, FONTATTR_LETTER_SPACING), lineHeight, itemCount, menuActions, actionIds); } @@ -1173,14 +1179,15 @@ struct WindowTemplate CreateWindowTemplate(u8 bg, u8 left, u8 top, u8 width, u8 return template; } -u16 sub_8198AA4(u8 bg, u8 left, u8 top, u8 width, u8 height, u8 paletteNum, u16 baseBlock) +u16 AddWindowParameterized(u8 bg, u8 left, u8 top, u8 width, u8 height, u8 paletteNum, u16 baseBlock) { struct WindowTemplate template; SetWindowTemplateFields(&template, bg, left, top, width, height, paletteNum, baseBlock); return AddWindow(&template); } -void sub_8198AF8(const struct WindowTemplate *window, u8 fontId, u8 left, u8 top, u16 baseTileNum, u8 paletteNum, u8 initialCursorPos) +// As opposed to CreateYesNoMenu, which has a hard-coded position. +static void CreateYesNoMenuAtPos(const struct WindowTemplate *window, u8 fontId, u8 left, u8 top, u16 baseTileNum, u8 paletteNum, u8 initialCursorPos) { struct TextPrinterTemplate printer; @@ -1203,12 +1210,12 @@ void sub_8198AF8(const struct WindowTemplate *window, u8 fontId, u8 left, u8 top AddTextPrinter(&printer, TEXT_SPEED_FF, NULL); - sub_81983AC(sYesNoWindowId, fontId, left, top, GetFontAttribute(fontId, FONTATTR_MAX_LETTER_HEIGHT), 2, initialCursorPos); + InitMenuNormal(sYesNoWindowId, fontId, left, top, GetFontAttribute(fontId, FONTATTR_MAX_LETTER_HEIGHT), 2, initialCursorPos); } -void sub_8198C34(const struct WindowTemplate *window, u8 fontId, u16 baseTileNum, u8 paletteNum) +static void CreateYesNoMenuInTopLeft(const struct WindowTemplate *window, u8 fontId, u16 baseTileNum, u8 paletteNum) { - sub_8198AF8(window, fontId, 0, 1, baseTileNum, paletteNum, 0); + CreateYesNoMenuAtPos(window, fontId, 0, 1, baseTileNum, paletteNum, 0); } s8 Menu_ProcessInputNoWrapClearOnChoose(void) @@ -1232,9 +1239,7 @@ void sub_8198C94(u8 windowId, u8 fontId, u8 left, u8 top, u8 a4, u8 a5, u8 a6, u for (i = 0; i < a7; i++) { for (j = 0; j < a6; j++) - { - AddTextPrinterParameterized(windowId, fontId, menuActions[(i * a6) + j].text, (a4 * j) + left, (a5 * i) + top, 0xFF, NULL); - } + AddTextPrinterParameterized(windowId, fontId, menuActions[(i * a6) + j].text, (a4 * j) + left, (a5 * i) + top, TEXT_SPEED_FF, NULL); } CopyWindowToVram(windowId, COPYWIN_GFX); } @@ -1268,7 +1273,7 @@ void PrintMenuActionGrid(u8 windowId, u8 fontId, u8 left, u8 top, u8 optionWidth printer.y = (GetFontAttribute(fontId, FONTATTR_MAX_LETTER_HEIGHT) * i) + top; printer.currentX = printer.x; printer.currentY = printer.y; - AddTextPrinter(&printer, 0xFF, NULL); + AddTextPrinter(&printer, TEXT_SPEED_FF, NULL); } } @@ -1593,7 +1598,8 @@ u8 InitMenuInUpperLeftCorner(u8 windowId, u8 itemCount, u8 initialCursorPos, boo return Menu_MoveCursor(0); } -u8 InitMenuInUpperLeftCornerPlaySoundWhenAPressed(u8 windowId, u8 itemCount, u8 initialCursorPos) +// There is no muted version of this function, so the version that plays sound when A is pressed is the "Normal" one. +u8 InitMenuInUpperLeftCornerNormal(u8 windowId, u8 itemCount, u8 initialCursorPos) { return InitMenuInUpperLeftCorner(windowId, itemCount, initialCursorPos, FALSE); } @@ -1603,9 +1609,7 @@ void PrintMenuTable(u8 windowId, u8 itemCount, const struct MenuAction *menuActi u32 i; for (i = 0; i < itemCount; i++) - { - AddTextPrinterParameterized(windowId, 1, menuActions[i].text, 8, (i * 16) + 1, 0xFF, NULL); - } + AddTextPrinterParameterized(windowId, 1, menuActions[i].text, 8, (i * 16) + 1, TEXT_SPEED_FF, NULL); CopyWindowToVram(windowId, COPYWIN_GFX); } @@ -1631,7 +1635,7 @@ void sub_81995E4(u8 windowId, u8 itemCount, const struct MenuAction *menuActions printer.currentChar = menuActions[actionIds[i]].text; printer.y = (i * 16) + 1; printer.currentY = (i * 16) + 1; - AddTextPrinter(&printer, 0xFF, NULL); + AddTextPrinter(&printer, TEXT_SPEED_FF, NULL); } CopyWindowToVram(windowId, COPYWIN_GFX); @@ -1658,8 +1662,8 @@ void CreateYesNoMenu(const struct WindowTemplate *window, u16 baseTileNum, u8 pa printer.letterSpacing = 0; printer.lineSpacing = 0; - AddTextPrinter(&printer, 0xFF, NULL); - InitMenuInUpperLeftCornerPlaySoundWhenAPressed(sYesNoWindowId, 2, initialCursorPos); + AddTextPrinter(&printer, TEXT_SPEED_FF, NULL); + InitMenuInUpperLeftCornerNormal(sYesNoWindowId, 2, initialCursorPos); } void PrintMenuGridTable(u8 windowId, u8 optionWidth, u8 columns, u8 rows, const struct MenuAction *menuActions) @@ -1669,7 +1673,7 @@ void PrintMenuGridTable(u8 windowId, u8 optionWidth, u8 columns, u8 rows, const for (i = 0; i < rows; i++) { for (j = 0; j < columns; j++) - AddTextPrinterParameterized(windowId, 1, menuActions[(i * columns) + j].text, (optionWidth * j) + 8, (i * 16) + 1, 0xFF, NULL); + AddTextPrinterParameterized(windowId, 1, menuActions[(i * columns) + j].text, (optionWidth * j) + 8, (i * 16) + 1, TEXT_SPEED_FF, NULL); } CopyWindowToVram(windowId, COPYWIN_GFX); } @@ -1698,7 +1702,7 @@ void sub_819983C(u8 windowId, u8 a4, u8 itemCount, u8 itemCount2, const struct M printer.y = (16 * i) + 1; printer.currentX = printer.x; printer.currentY = printer.y; - AddTextPrinter(&printer, 0xFF, NULL); + AddTextPrinter(&printer, TEXT_SPEED_FF, NULL); } } @@ -2008,7 +2012,7 @@ void PrintPlayerNameOnWindow(u8 windowId, const u8 *src, u16 x, u16 y) StringExpandPlaceholders(gStringVar4, src); - AddTextPrinterParameterized(windowId, 1, gStringVar4, x, y, 0xFF, 0); + AddTextPrinterParameterized(windowId, 1, gStringVar4, x, y, TEXT_SPEED_FF, 0); } // Unused. Similar to BlitBitmapRect4Bit. @@ -2105,13 +2109,13 @@ void ListMenuLoadStdPalAt(u8 palOffset, u8 palId) { case 0: default: - palette = gFireRedMenuElements1_Pal; + palette = gMenuInfoElements1_Pal; break; case 1: - palette = gFireRedMenuElements2_Pal; + palette = gMenuInfoElements2_Pal; break; case 2: - palette = gFireRedMenuElements3_Pal; + palette = gMenuInfoElements3_Pal; break; } @@ -2120,7 +2124,7 @@ void ListMenuLoadStdPalAt(u8 palOffset, u8 palId) void BlitMenuInfoIcon(u8 windowId, u8 iconId, u16 x, u16 y) { - BlitBitmapRectToWindow(windowId, gFireRedMenuElements_Gfx + sMenuInfoIcons[iconId].offset * 32, 0, 0, 128, 128, x, y, sMenuInfoIcons[iconId].width, sMenuInfoIcons[iconId].height); + BlitBitmapRectToWindow(windowId, &gMenuInfoElements_Gfx[sMenuInfoIcons[iconId].offset * 32], 0, 0, 128, 128, x, y, sMenuInfoIcons[iconId].width, sMenuInfoIcons[iconId].height); } void BufferSaveMenuText(u8 textId, u8 *dest, u8 color) diff --git a/src/party_menu.c b/src/party_menu.c index 609d5249f..fd112c995 100755 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -2481,7 +2481,7 @@ static u8 DisplaySelectionWindow(u8 windowType) AddTextPrinterParameterized4(sPartyMenuInternal->windowId[0], FONT_NORMAL, cursorDimension, (i * 16) + 1, letterSpacing, 0, sFontColorTable[fontColorsId], 0, sCursorOptions[sPartyMenuInternal->actions[i]].text); } - InitMenuInUpperLeftCorner(sPartyMenuInternal->windowId[0], sPartyMenuInternal->numActions, 0, 1); + InitMenuInUpperLeftCorner(sPartyMenuInternal->windowId[0], sPartyMenuInternal->numActions, 0, TRUE); ScheduleBgCopyTilemapToVram(2); return sPartyMenuInternal->windowId[0]; @@ -4508,7 +4508,7 @@ static void ShowMoveSelectWindow(u8 slot) if (move != MOVE_NONE) moveCount++; } - InitMenuInUpperLeftCornerPlaySoundWhenAPressed(windowId, moveCount, 0); + InitMenuInUpperLeftCornerNormal(windowId, moveCount, 0); ScheduleBgCopyTilemapToVram(2); } diff --git a/src/player_pc.c b/src/player_pc.c index 0742341ec..a4e55bf32 100644 --- a/src/player_pc.c +++ b/src/player_pc.c @@ -400,7 +400,7 @@ static void InitPlayerPCMenu(u8 taskId) tWindowId = AddWindow(&windowTemplate); SetStandardWindowBorderStyle(tWindowId, 0); sub_81995E4(tWindowId, sTopMenuNumOptions, sPlayerPCMenuActions, sTopMenuOptionOrder); - InitMenuInUpperLeftCornerPlaySoundWhenAPressed(tWindowId, sTopMenuNumOptions, 0); + InitMenuInUpperLeftCornerNormal(tWindowId, sTopMenuNumOptions, 0); ScheduleBgCopyTilemapToVram(0); gTasks[taskId].func = PlayerPCProcessMenuInput; } @@ -511,7 +511,7 @@ static void InitItemStorageMenu(u8 taskId, u8 var) tWindowId = AddWindow(&windowTemplate); SetStandardWindowBorderStyle(tWindowId, 0); PrintMenuTable(tWindowId, ARRAY_COUNT(sItemStorage_MenuActions), sItemStorage_MenuActions); - InitMenuInUpperLeftCornerPlaySoundWhenAPressed(tWindowId, 4, var); + InitMenuInUpperLeftCornerNormal(tWindowId, 4, var); ScheduleBgCopyTilemapToVram(0); ItemStorageMenuPrint(sItemStorage_OptionDescriptions[var]); } @@ -753,7 +753,7 @@ static void Mailbox_PrintMailOptions(u8 taskId) { u8 windowId = MailboxMenu_AddWindow(MAILBOXWIN_OPTIONS); PrintMenuTable(windowId, ARRAY_COUNT(gMailboxMailOptions), gMailboxMailOptions); - InitMenuInUpperLeftCornerPlaySoundWhenAPressed(windowId, 4, 0); + InitMenuInUpperLeftCornerNormal(windowId, 4, 0); ScheduleBgCopyTilemapToVram(0); gTasks[taskId].func = Mailbox_MailOptionsProcessInput; } diff --git a/src/pokeblock.c b/src/pokeblock.c index b5f1c9298..e07ad018e 100644 --- a/src/pokeblock.c +++ b/src/pokeblock.c @@ -1150,7 +1150,7 @@ static void ShowPokeblockActionsWindow(u8 taskId) DestroyScrollArrows(); DrawStdFrameWithCustomTileAndPalette(tWindowId, 0, 1, 0xE); sub_81995E4(tWindowId, sPokeblockMenu->numActions, sPokeblockMenuActions, sPokeblockMenu->pokeblockActionIds); - InitMenuInUpperLeftCornerPlaySoundWhenAPressed(tWindowId, sPokeblockMenu->numActions, 0); + InitMenuInUpperLeftCornerNormal(tWindowId, sPokeblockMenu->numActions, 0); PutWindowTilemap(tWindowId); ScheduleBgCopyTilemapToVram(1); diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index f936d8711..ec3555088 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -1699,7 +1699,7 @@ static void CreateMainMenu(u8 whichMenu, s16 *windowIdPtr) DrawStdWindowFrame(windowId, FALSE); PrintMenuTable(windowId, OPTIONS_COUNT, (void *)sMainMenuTexts); - InitMenuInUpperLeftCornerPlaySoundWhenAPressed(windowId, OPTIONS_COUNT, whichMenu); + InitMenuInUpperLeftCornerNormal(windowId, OPTIONS_COUNT, whichMenu); *windowIdPtr = windowId; } @@ -8024,7 +8024,7 @@ static void AddMenu(void) ClearWindowTilemap(sStorage->menuWindowId); DrawStdFrameWithCustomTileAndPalette(sStorage->menuWindowId, FALSE, 11, 14); PrintMenuTable(sStorage->menuWindowId, sStorage->menuItemsCount, (void*)sStorage->menuItems); - InitMenuInUpperLeftCornerPlaySoundWhenAPressed(sStorage->menuWindowId, sStorage->menuItemsCount, 0); + InitMenuInUpperLeftCornerNormal(sStorage->menuWindowId, sStorage->menuItemsCount, 0); ScheduleBgCopyTilemapToVram(0); sStorage->menuUnusedField = 0; } diff --git a/src/script_menu.c b/src/script_menu.c index 30aa4a063..8293b6f7a 100644 --- a/src/script_menu.c +++ b/src/script_menu.c @@ -109,7 +109,7 @@ static void DrawMultichoiceMenu(u8 left, u8 top, u8 multichoiceId, bool8 ignoreB windowId = CreateWindowFromRect(left, top, newWidth, count * 2); SetStandardWindowBorderStyle(windowId, 0); PrintMenuTable(windowId, count, actions); - InitMenuInUpperLeftCornerPlaySoundWhenAPressed(windowId, count, cursorPos); + InitMenuInUpperLeftCornerNormal(windowId, count, cursorPos); ScheduleBgCopyTilemapToVram(0); InitMultichoiceCheckWrap(ignoreBPress, count, windowId, multichoiceId); } @@ -372,7 +372,7 @@ static void CreatePCMultichoice(void) StringExpandPlaceholders(gStringVar4, gText_PlayersPC); PrintPlayerNameOnWindow(windowId, gStringVar4, y, 17); - InitMenuInUpperLeftCornerPlaySoundWhenAPressed(windowId, numChoices, 0); + InitMenuInUpperLeftCornerNormal(windowId, numChoices, 0); CopyWindowToVram(windowId, COPYWIN_FULL); InitMultichoiceCheckWrap(FALSE, numChoices, windowId, MULTI_PC); } @@ -532,7 +532,7 @@ static void CreateLilycoveSSTidalMultichoice(void) } } - InitMenuInUpperLeftCornerPlaySoundWhenAPressed(windowId, count, count - 1); + InitMenuInUpperLeftCornerNormal(windowId, count, count - 1); CopyWindowToVram(windowId, COPYWIN_FULL); InitMultichoiceCheckWrap(FALSE, count, windowId, MULTI_SSTIDAL_LILYCOVE); } @@ -696,7 +696,7 @@ static void CreateStartMenuForPokenavTutorial(void) AddTextPrinterParameterized(windowId, FONT_NORMAL, gText_MenuOptionSave, 8, 89, TEXT_SPEED_FF, NULL); AddTextPrinterParameterized(windowId, FONT_NORMAL, gText_MenuOptionOption, 8, 105, TEXT_SPEED_FF, NULL); AddTextPrinterParameterized(windowId, FONT_NORMAL, gText_MenuOptionExit, 8, 121, TEXT_SPEED_FF, NULL); - sub_81983AC(windowId, FONT_NORMAL, 0, 9, 16, ARRAY_COUNT(MultichoiceList_ForcedStartMenu), 0); + InitMenuNormal(windowId, FONT_NORMAL, 0, 9, 16, ARRAY_COUNT(MultichoiceList_ForcedStartMenu), 0); InitMultichoiceNoWrap(FALSE, ARRAY_COUNT(MultichoiceList_ForcedStartMenu), windowId, MULTI_FORCED_START_MENU); CopyWindowToVram(windowId, COPYWIN_FULL); } diff --git a/src/secret_base.c b/src/secret_base.c index 12f6df5ab..72560ee23 100644 --- a/src/secret_base.c +++ b/src/secret_base.c @@ -1028,7 +1028,7 @@ static void ShowRegistryMenuActions(u8 taskId) tActionWindowId = AddWindow(&template); SetStandardWindowBorderStyle(tActionWindowId, 0); PrintMenuTable(tActionWindowId, ARRAY_COUNT(sRegistryMenuActions), sRegistryMenuActions); - InitMenuInUpperLeftCornerPlaySoundWhenAPressed(tActionWindowId, 2, 0); + InitMenuInUpperLeftCornerNormal(tActionWindowId, 2, 0); ScheduleBgCopyTilemapToVram(0); gTasks[taskId].func = HandleRegistryMenuActionsInput; } diff --git a/src/shop.c b/src/shop.c index 43b7816f5..604abd1ab 100755 --- a/src/shop.c +++ b/src/shop.c @@ -301,7 +301,7 @@ static u8 CreateShopMenu(u8 martType) SetStandardWindowBorderStyle(sMartInfo.windowId, 0); PrintMenuTable(sMartInfo.windowId, numMenuItems, sMartInfo.menuActions); - InitMenuInUpperLeftCornerPlaySoundWhenAPressed(sMartInfo.windowId, numMenuItems, 0); + InitMenuInUpperLeftCornerNormal(sMartInfo.windowId, numMenuItems, 0); PutWindowTilemap(sMartInfo.windowId); CopyWindowToVram(sMartInfo.windowId, COPYWIN_MAP); diff --git a/src/start_menu.c b/src/start_menu.c index 1c0b006e6..0cf102efc 100644 --- a/src/start_menu.c +++ b/src/start_menu.c @@ -466,7 +466,7 @@ static bool32 InitStartMenuStep(void) break; case 2: LoadMessageBoxAndBorderGfx(); - DrawStdWindowFrame(sub_81979C4(sNumStartMenuActions), FALSE); + DrawStdWindowFrame(AddStartMenuWindow(sNumStartMenuActions), FALSE); sInitStartMenuData[1] = 0; sInitStartMenuData[0]++; break; @@ -482,7 +482,7 @@ static bool32 InitStartMenuStep(void) sInitStartMenuData[0]++; break; case 5: - sStartMenuCursorPos = sub_81983AC(GetStartMenuWindowId(), FONT_NORMAL, 0, 9, 16, sNumStartMenuActions, sStartMenuCursorPos); + sStartMenuCursorPos = InitMenuNormal(GetStartMenuWindowId(), FONT_NORMAL, 0, 9, 16, sNumStartMenuActions, sStartMenuCursorPos); CopyWindowToVram(GetStartMenuWindowId(), COPYWIN_MAP); return TRUE; } diff --git a/src/trade.c b/src/trade.c index 5716fdd84..603d92c87 100644 --- a/src/trade.c +++ b/src/trade.c @@ -1395,7 +1395,7 @@ static void TradeMenuProcessInput(void) DrawTextBorderOuter(1, 1, 14); FillWindowPixelBuffer(1, PIXEL_FILL(1)); PrintMenuTable(1, ARRAY_COUNT(sSelectTradeMonActions), sSelectTradeMonActions); - InitMenuInUpperLeftCornerPlaySoundWhenAPressed(1, 2, 0); + InitMenuInUpperLeftCornerNormal(1, 2, 0); PutWindowTilemap(1); CopyWindowToVram(1, COPYWIN_FULL); sTradeMenuData->tradeMenuFunc = TRADEMENUFUNC_SELECTED_MON; diff --git a/src/trader.c b/src/trader.c index c65d5ff87..1d4424e75 100644 --- a/src/trader.c +++ b/src/trader.c @@ -82,7 +82,7 @@ void CreateAvailableDecorationsMenu(u8 taskId) AddTextPrinterParameterized(data[3], FONT_NORMAL, gDecorations[trader->decorations[i]].name, 8, 16 * i + 1, 255, NULL); } AddTextPrinterParameterized(data[3], FONT_NORMAL, gText_Exit, 8, 16 * i + 1, 255, NULL); - InitMenuInUpperLeftCornerPlaySoundWhenAPressed(data[3], 5, 0); + InitMenuInUpperLeftCornerNormal(data[3], 5, 0); ScheduleBgCopyTilemapToVram(0); } diff --git a/src/union_room_chat.c b/src/union_room_chat.c index 96c2aa886..d2bce295b 100755 --- a/src/union_room_chat.c +++ b/src/union_room_chat.c @@ -2743,7 +2743,7 @@ static void AddYesNoMenuAt(u8 left, u8 top, u8 initialCursorPos) AddTextPrinterParameterized(sDisplay->yesNoMenuWindowId, FONT_NORMAL, gText_Yes, 8, 1, TEXT_SPEED_FF, NULL); AddTextPrinterParameterized(sDisplay->yesNoMenuWindowId, FONT_NORMAL, gText_No, 8, 17, TEXT_SPEED_FF, NULL); DrawTextBorderOuter(sDisplay->yesNoMenuWindowId, 1, 13); - InitMenuInUpperLeftCornerPlaySoundWhenAPressed(sDisplay->yesNoMenuWindowId, 2, initialCursorPos); + InitMenuInUpperLeftCornerNormal(sDisplay->yesNoMenuWindowId, 2, initialCursorPos); } } @@ -2987,8 +2987,8 @@ static void ShowKeyboardSwapMenu(void) { FillWindowPixelBuffer(3, PIXEL_FILL(1)); DrawTextBorderOuter(3, 1, 13); - PrintTextArray(3, FONT_SHORT, 8, 1, 14, 5, sKeyboardPageTitleTexts); - sub_81983AC(3, FONT_SHORT, 0, 1, 14, 5, GetCurrentKeyboardPage()); + PrintMenuActionTextsAtPos(3, FONT_SHORT, 8, 1, 14, 5, sKeyboardPageTitleTexts); + InitMenuNormal(3, FONT_SHORT, 0, 1, 14, 5, GetCurrentKeyboardPage()); PutWindowTilemap(3); }