diff options
author | camthesaxman <cameronghall@cox.net> | 2018-01-09 14:26:15 -0600 |
---|---|---|
committer | camthesaxman <cameronghall@cox.net> | 2018-01-09 14:26:15 -0600 |
commit | 03b167a73e2f18fa79bbf0e6ffe11e0c35c12ad8 (patch) | |
tree | 502c26ec51aa55df4eb1ff4324ab90c3b0a0610a /src/engine | |
parent | 8869cbc98e2f8e761e9ff89182933643992e2bd7 (diff) |
more text/menu renaming
Diffstat (limited to 'src/engine')
-rw-r--r-- | src/engine/clear_save_data_menu.c | 6 | ||||
-rw-r--r-- | src/engine/link.c | 6 | ||||
-rw-r--r-- | src/engine/main_menu.c | 32 | ||||
-rw-r--r-- | src/engine/menu.c | 114 | ||||
-rw-r--r-- | src/engine/menu_cursor.c | 62 | ||||
-rw-r--r-- | src/engine/mystery_event_menu.c | 2 | ||||
-rw-r--r-- | src/engine/name_string_util.c | 4 | ||||
-rw-r--r-- | src/engine/naming_screen.c | 2 | ||||
-rw-r--r-- | src/engine/option_menu.c | 4 | ||||
-rw-r--r-- | src/engine/reset_rtc_screen.c | 2 | ||||
-rw-r--r-- | src/engine/save_failed_screen.c | 2 | ||||
-rw-r--r-- | src/engine/text.c | 58 | ||||
-rw-r--r-- | src/engine/trade.c | 44 | ||||
-rw-r--r-- | src/engine/trainer_card.c | 16 |
14 files changed, 186 insertions, 168 deletions
diff --git a/src/engine/clear_save_data_menu.c b/src/engine/clear_save_data_menu.c index 6a597690a..08fd5cd18 100644 --- a/src/engine/clear_save_data_menu.c +++ b/src/engine/clear_save_data_menu.c @@ -45,7 +45,7 @@ static void Task_InitMenu(u8 taskId) Menu_PrintText(gSystemText_ClearAllSaveDataPrompt, 3, 15); Menu_DrawStdWindowFrame(2, 1, 8, 6); - PrintMenuItems(3, 2, 2, gMenuYesNoItems); + Menu_PrintItems(3, 2, 2, gMenuYesNoItems); InitMenu(0, 3, 2, 2, 1, 5); gTasks[taskId].func = Task_ProcessMenuInput; @@ -53,7 +53,7 @@ static void Task_InitMenu(u8 taskId) static void Task_ProcessMenuInput(u8 taskId) { - switch (ProcessMenuInputNoWrap_()) + switch (Menu_ProcessInputNoWrap_()) { case 0: PlaySE(SE_SELECT); @@ -133,7 +133,7 @@ static u8 InitClearSaveDataScreen(void) ResetTasks(); ResetSpriteData(); - SetUpWindowConfig(&gWindowTemplate_81E6C3C); + Text_LoadWindowTemplate(&gWindowTemplate_81E6C3C); InitMenuWindow(&gWindowTemplate_81E6CE4); BeginNormalPaletteFade(-1, 0, 0x10, 0, 0xffff); diff --git a/src/engine/link.c b/src/engine/link.c index d52d0bb7a..34016d607 100644 --- a/src/engine/link.c +++ b/src/engine/link.c @@ -238,7 +238,7 @@ void LinkTestScreen(void) FreeAllSpritePalettes(); ResetTasks(); SetVBlankCallback(VBlankCB_LinkTest); - SetUpWindowConfig(&gWindowTemplate_81E6CE4); + Text_LoadWindowTemplate(&gWindowTemplate_81E6CE4); InitMenuWindow((struct WindowTemplate *)&gWindowTemplate_81E6CE4); ResetBlockSend(); gLinkType = 0x1111; @@ -1236,7 +1236,7 @@ void CB2_LinkError(void) FillPalette(0, 0, 2); ResetTasks(); SetVBlankCallback(VBlankCB_LinkTest); - SetUpWindowConfig(&gWindowTemplate_81E7198); + Text_LoadWindowTemplate(&gWindowTemplate_81E7198); InitMenuWindow((struct WindowTemplate *)&gWindowTemplate_81E7198); Menu_EraseScreen(); REG_BLDALPHA = 0; @@ -1260,7 +1260,7 @@ static void CB2_PrintErrorMessage(void) switch (gMain.state) { case 0: - MenuPrint_PixelCoords(gMultiText_LinkError, 20, 56, 1); + Menu_PrintTextPixelCoords(gMultiText_LinkError, 20, 56, 1); break; case 30: case 60: diff --git a/src/engine/main_menu.c b/src/engine/main_menu.c index 723886664..715570fe0 100644 --- a/src/engine/main_menu.c +++ b/src/engine/main_menu.c @@ -24,7 +24,7 @@ #include "unknown_task.h" #include "ewram.h" -#define BirchSpeechUpdateWindowText() ((u8)MenuUpdateWindowText_OverrideLineLength(24)) +#define BirchSpeechUpdateWindowText() ((u8)Menu_UpdateWindowTextOverrideLineLength(24)) extern struct PaletteFadeControl gPaletteFade; @@ -233,7 +233,7 @@ u32 InitMainMenu(u8 a1) ResetTasks(); ResetSpriteData(); FreeAllSpritePalettes(); - SetUpWindowConfig(&gWindowTemplate_81E6C3C); + Text_LoadWindowTemplate(&gWindowTemplate_81E6C3C); InitMenuWindow((struct WindowTemplate *)&gWindowTemplate_81E6CE4); if (a1) @@ -709,7 +709,7 @@ void PrintPlayTime(void) sub_8072C74(alignedPlayTime, playTime, 48, 1); Menu_PrintText(alignedPlayTime, 22, 3); #elif defined(GERMAN) - MenuPrint_PixelCoords(gMainMenuString_Time, 124, 24, TRUE); + Menu_PrintTextPixelCoords(gMainMenuString_Time, 124, 24, TRUE); FormatPlayTime(playTime, gSaveBlock2.playTimeHours, gSaveBlock2.playTimeMinutes, 1); sub_8072C74(alignedPlayTime, playTime, 40, 1); Menu_PrintText(alignedPlayTime, 23, 3); @@ -732,10 +732,10 @@ void PrintBadgeCount(void) #if defined(ENGLISH) Menu_PrintText(gMainMenuString_Badges, 16, 5); #elif defined(GERMAN) - MenuPrint_PixelCoords(gMainMenuString_Badges, 124, 40, TRUE); + Menu_PrintTextPixelCoords(gMainMenuString_Badges, 124, 40, TRUE); #endif ConvertIntToDecimalString(buffer, GetBadgeCount()); - MenuPrint_PixelCoords(buffer, 205, 40, 1); + Menu_PrintTextPixelCoords(buffer, 205, 40, 1); } #define tTrainerSpriteId data[2] @@ -750,7 +750,7 @@ void PrintBadgeCount(void) static void Task_NewGameSpeech1(u8 taskId) { - SetUpWindowConfig(&gWindowTemplate_81E6C3C); + Text_LoadWindowTemplate(&gWindowTemplate_81E6C3C); InitMenuWindow((struct WindowTemplate *)&gWindowTemplate_81E6CE4); REG_WIN0H = 0; REG_WIN0V = 0; @@ -857,7 +857,7 @@ static void Task_NewGameSpeech7(u8 taskId) //Go on to next sentence after frame 95 if (gTasks[taskId].tFrameCounter > 95) { - MenuSetText(gSystemText_NewPara); + Menu_SetText(gSystemText_NewPara); gTasks[taskId].func = Task_NewGameSpeech8; } } @@ -985,14 +985,14 @@ static void Task_NewGameSpeech16(u8 taskId) switch (GenderMenuProcessInput()) { case MALE: - HandleDestroyMenuCursors(); + Menu_DestroyCursor(); PlaySE(SE_SELECT); gSaveBlock2.playerGender = MALE; Menu_EraseWindowRect(2, 4, 8, 9); gTasks[taskId].func = Task_NewGameSpeech19; break; case FEMALE: - HandleDestroyMenuCursors(); + Menu_DestroyCursor(); PlaySE(SE_SELECT); gSaveBlock2.playerGender = FEMALE; Menu_EraseWindowRect(2, 4, 8, 9); @@ -1088,7 +1088,7 @@ static void Task_NewGameSpeech21(u8 taskId) case 2: case 3: case 4: - HandleDestroyMenuCursors(); + Menu_DestroyCursor(); PlaySE(SE_SELECT); Menu_EraseWindowRect(2, 1, 22, 12); SetPresetPlayerName(selection); @@ -1100,7 +1100,7 @@ static void Task_NewGameSpeech21(u8 taskId) gTasks[taskId].func = Task_NewGameSpeech22; break; case -1: //B button - HandleDestroyMenuCursors(); + Menu_DestroyCursor(); PlaySE(SE_SELECT); Menu_EraseWindowRect(2, 1, 22, 12); gTasks[taskId].func = Task_NewGameSpeech14; //Go back to gender menu @@ -1139,7 +1139,7 @@ static void Task_NewGameSpeech24(u8 taskId) //Handle yes/no menu selection static void Task_NewGameSpeech25(u8 taskId) { - switch (ProcessMenuInputNoWrap_()) + switch (Menu_ProcessInputNoWrap_()) { case 0: //YES PlaySE(SE_SELECT); @@ -1373,7 +1373,7 @@ void CB_ContinueNewGameSpeechPart2() FreeAllSpritePalettes(); AddBirchSpeechObjects(taskId); - SetUpWindowConfig(&gWindowTemplate_81E6C3C); + Text_LoadWindowTemplate(&gWindowTemplate_81E6C3C); InitMenuWindow((struct WindowTemplate *)&gWindowTemplate_81E6CE4); if (gSaveBlock2.playerGender != MALE) @@ -1664,7 +1664,7 @@ static void CreateGenderMenu(u8 left, u8 top) Menu_DrawStdWindowFrame(left, top, left + 6, top + 5); menuLeft = left + 1; menuTop = top + 1; - PrintMenuItems(menuLeft, menuTop, 2, gUnknown_081E79B0); + Menu_PrintItems(menuLeft, menuTop, 2, gUnknown_081E79B0); InitMenu(0, menuLeft, menuTop, 2, 0, 5); } @@ -1678,9 +1678,9 @@ static void CreateNameMenu(u8 left, u8 top) Menu_DrawStdWindowFrame(left, top, left + 10, top + 11); if (gSaveBlock2.playerGender == MALE) - PrintMenuItems(left + 1, top + 1, 5, gMalePresetNames); + Menu_PrintItems(left + 1, top + 1, 5, gMalePresetNames); else - PrintMenuItems(left + 1, top + 1, 5, gFemalePresetNames); + Menu_PrintItems(left + 1, top + 1, 5, gFemalePresetNames); InitMenu(0, left + 1, top + 1, 5, 0, 9); } diff --git a/src/engine/menu.c b/src/engine/menu.c index fe88bf4e4..86e20d0eb 100644 --- a/src/engine/menu.c +++ b/src/engine/menu.c @@ -26,11 +26,12 @@ struct Menu static void MultistepInitMenuWindowInternal(const struct WindowTemplate *, u16); static void InitMenuWindowInternal(const struct WindowTemplate *, u16); -static bool8 sub_80723D4(void); +static bool8 IsGridCursorMovementClamped(void); static u8 sub_8072484(u8, u8, u8, u8, u8, u8, u32); static u8 sub_80724F4(u8, u8, u8, const struct MenuAction[], u8); static void sub_8072620(u8, u8, u8, const struct MenuAction[], u8); static void sub_8072D18(u8, u8); +static void RedrawMenuCursor(u8, u8); static struct Menu gMenu; @@ -55,7 +56,7 @@ void CloseMenu(void) Menu_EraseScreen(); sub_8064E2C(); ScriptContext2_Disable(); - HandleDestroyMenuCursors(); + Menu_DestroyCursor(); } void AppendToList(u8 *list, u8 *pindex, u32 value) @@ -149,6 +150,7 @@ void BasicInitMenuWindow(const struct WindowTemplate *winTemplate) gMenuWindowPtr->tileDataStartOffset = gMenuTextTileOffset; } +// Prints void Menu_PrintText(const u8 *str, u8 left, u8 top) { Text_InitWindowAndPrintText(gMenuWindowPtr, str, gMenuTextTileOffset, left, top); @@ -156,7 +158,7 @@ void Menu_PrintText(const u8 *str, u8 left, u8 top) void Menu_EraseWindowRect(u8 left, u8 top, u8 right, u8 bottom) { - ZeroFillWindowRect(gMenuWindowPtr, left, top, right, bottom); + Text_EraseWindowRect(gMenuWindowPtr, left, top, right, bottom); } void Menu_BlankWindowRect(u8 left, u8 top, u8 right, u8 bottom) @@ -210,9 +212,9 @@ void MenuPrintMessageDefaultCoords(const u8 *str) Text_InitWindow8002EB0(gMenuWindowPtr, str, gMenuTextTileOffset, 2, 15); } -void MenuSetText(const u8 *str) +void Menu_SetText(const u8 *str) { - sub_8002E90(gMenuWindowPtr, str); + Text_SetWindowText(gMenuWindowPtr, str); } u8 Menu_UpdateWindowText(void) @@ -271,14 +273,14 @@ s8 Menu_ProcessInput(void) { PlaySE(SE_SELECT); if (gMenu.menu_field_7) - HandleDestroyMenuCursors(); + Menu_DestroyCursor(); return gMenu.cursorPos; } if (gMain.newKeys & B_BUTTON) { if (gMenu.menu_field_7) - HandleDestroyMenuCursors(); + Menu_DestroyCursor(); return -1; } @@ -306,14 +308,14 @@ s8 Menu_ProcessInputNoWrap(void) { PlaySE(SE_SELECT); if (gMenu.menu_field_7) - HandleDestroyMenuCursors(); + Menu_DestroyCursor(); return gMenu.cursorPos; } if (gMain.newKeys & B_BUTTON) { if (gMenu.menu_field_7) - HandleDestroyMenuCursors(); + Menu_DestroyCursor(); return -1; } @@ -353,11 +355,12 @@ u8 MoveMenuCursor3(s8 delta) return gMenu.cursorPos; } -u8 MoveMenuCursor4(s8 delta) +static u8 MoveMenuCursorGridLayout(s8 delta) { + // Don't move cursor if it is clamped if (gMenu.cursorPos + delta <= gMenu.maxCursorPos) { - if (sub_80723D4() == TRUE) + if (IsGridCursorMovementClamped() == TRUE) return gMenu.cursorPos; } else @@ -379,22 +382,35 @@ u8 MoveMenuCursor4(s8 delta) return gMenu.cursorPos; } -static bool8 sub_80723D4(void) +// Returns TRUE if the cursor is on an edge and cannot move in the pressed direction +static bool8 IsGridCursorMovementClamped(void) { - if ((gMain.newKeys & DPAD_UP) && gMenu.cursorPos < gMenu.width) - return TRUE; - - if ((gMain.newKeys & DPAD_DOWN) && gMenu.cursorPos >= (gMenu.maxCursorPos + 1) - gMenu.width) - return TRUE; - - if ((gMain.newKeys & DPAD_LEFT) - && ((gMenu.cursorPos - (gMenu.cursorPos % gMenu.width)) % gMenu.width == 1 // always false - || gMenu.cursorPos == 0 - || gMenu.cursorPos % gMenu.width == 0)) - return TRUE; - - if ((gMain.newKeys & DPAD_RIGHT) && gMenu.cursorPos % gMenu.width == gMenu.width - 1) - return TRUE; + if (gMain.newKeys & DPAD_UP) + { + // is cursor on first row? + if (gMenu.cursorPos < gMenu.width) + return TRUE; + } + if (gMain.newKeys & DPAD_DOWN) + { + // is cursor on last row? + if (gMenu.cursorPos >= gMenu.maxCursorPos + 1 - gMenu.width) + return TRUE; + } + if (gMain.newKeys & DPAD_LEFT) + { + // is cursor on first column? + if ((gMenu.cursorPos - gMenu.cursorPos % gMenu.width) % gMenu.width == 1 // always false + || gMenu.cursorPos == 0 // redundant + || gMenu.cursorPos % gMenu.width == 0) + return TRUE; + } + if (gMain.newKeys & DPAD_RIGHT) + { + // is cursor on last column? + if (gMenu.cursorPos % gMenu.width == gMenu.width - 1) + return TRUE; + } return FALSE; } @@ -518,7 +534,7 @@ s8 Menu_ProcessInputGridLayout(void) if (gMain.newKeys & A_BUTTON) { if (gMenu.menu_field_7) - HandleDestroyMenuCursors(); + Menu_DestroyCursor(); PlaySE(SE_SELECT); return Menu_GetCursorPos(); } @@ -526,44 +542,46 @@ s8 Menu_ProcessInputGridLayout(void) if (gMain.newKeys & B_BUTTON) { if (gMenu.menu_field_7) - HandleDestroyMenuCursors(); + Menu_DestroyCursor(); return -1; } if (gMain.newKeys & DPAD_UP) { PlaySE(SE_SELECT); - MoveMenuCursor4(-gMenu.width); + // Move up one whole row + MoveMenuCursorGridLayout(-gMenu.width); return -2; } else if (gMain.newKeys & DPAD_DOWN) { PlaySE(SE_SELECT); - MoveMenuCursor4(gMenu.width); + // Move down one whole column + MoveMenuCursorGridLayout(gMenu.width); return -2; } else if (gMain.newKeys & DPAD_LEFT) { PlaySE(SE_SELECT); - MoveMenuCursor4(-1); + MoveMenuCursorGridLayout(-1); return -2; } else if (gMain.newKeys & DPAD_RIGHT) { PlaySE(SE_SELECT); - MoveMenuCursor4(1); + MoveMenuCursorGridLayout(1); return -2; } return -2; } -u8 sub_807288C(u8 column) +u8 Menu_GetColumnXCoord(u8 column) { return gMenu.columnXCoords[column]; } -void PrintMenuItems(u8 left, u8 top, u8 menuItemCount, const struct MenuAction menuItems[]) +void Menu_PrintItems(u8 left, u8 top, u8 menuItemCount, const struct MenuAction menuItems[]) { u8 i; @@ -571,7 +589,7 @@ void PrintMenuItems(u8 left, u8 top, u8 menuItemCount, const struct MenuAction m Menu_PrintText(menuItems[i].text, left, top + 2 * i); } -void PrintMenuItemsReordered(u8 left, u8 top, u8 menuItemCount, const struct MenuAction2 menuItems[], const u8 *order) +void Menu_PrintItemsReordered(u8 left, u8 top, u8 menuItemCount, const struct MenuAction2 menuItems[], const u8 *order) { u8 i; @@ -581,7 +599,7 @@ void PrintMenuItemsReordered(u8 left, u8 top, u8 menuItemCount, const struct Men void InitYesNoMenu(u8 left, u8 top, u8 a3) { - PrintMenuItems(left + 1, top + 1, 2, gMenuYesNoItems); + Menu_PrintItems(left + 1, top + 1, 2, gMenuYesNoItems); InitMenu(0, left + 1, top + 1, 2, 0, a3); } @@ -592,14 +610,14 @@ void DisplayYesNoMenu(u8 left, u8 top, u32 a3) gMenu.menu_field_7 = a3 ? -1 : 0; } -s8 ProcessMenuInputNoWrap_(void) +s8 Menu_ProcessInputNoWrap_(void) { return Menu_ProcessInputNoWrap(); } -u8 MenuPrint_PixelCoords(const u8 *text, u8 left, u16 top, u8 a4) +u8 Menu_PrintTextPixelCoords(const u8 *text, u8 left, u16 top, u8 a4) { - return sub_8004D04(gMenuWindowPtr, text, gMenuTextTileOffset, left, top, a4); + return Text_InitWindow8004D04(gMenuWindowPtr, text, gMenuTextTileOffset, left, top, a4); } u8 sub_8072A18(const u8 *text, u8 left, u16 top, u8 width, u32 a5) @@ -712,7 +730,7 @@ _08072B3E:\n\ void MenuPrint_RightAligned(const u8 *str, u8 left, u8 top) { - sub_8004D38(gMenuWindowPtr, str, gMenuTextTileOffset, left, top); + Text_InitWindow8004D38(gMenuWindowPtr, str, gMenuTextTileOffset, left, top); } void sub_8072B80(const u8 *a1, u8 a2, u8 a3, const u8 *a4) @@ -725,7 +743,7 @@ void sub_8072B80(const u8 *a1, u8 a2, u8 a3, const u8 *a4) void sub_8072BD8(const u8 *a1, u8 a2, u8 a3, u16 a4) { - sub_8004DB0(gMenuWindowPtr, a1, gMenuTextTileOffset, a2, a3, a4); + Text_InitWindow8004DB0(gMenuWindowPtr, a1, gMenuTextTileOffset, a2, a3, a4); } u8 *sub_8072C14(u8 *a1, s32 a2, u8 a3, u8 a4) @@ -748,9 +766,9 @@ u8 sub_8072CA4(const u8 *str) return GetStringWidth(gMenuWindowPtr, str); } -u8 sub_8072CBC() +u8 Menu_GetTextWindowPaletteNum(void) { - return sub_8004E24(gMenuWindowPtr); + return Text_GetWindowPaletteNum(gMenuWindowPtr); } void Menu_GetTextColors(u8 *a1, u8 *a2, u8 *a3) @@ -758,7 +776,7 @@ void Menu_GetTextColors(u8 *a1, u8 *a2, u8 *a3) Text_GetTextColors(gMenuWindowPtr, a1, a2, a3); } -u32 MenuUpdateWindowText_OverrideLineLength(u8 lineLength) +u32 Menu_UpdateWindowTextOverrideLineLength(u8 lineLength) { return Text_UpdateWindowOverrideLineLength(gMenuWindowPtr, lineLength); } @@ -770,7 +788,7 @@ struct Window *unref_sub_8072D0C(void) static void sub_8072D18(u8 a1, u8 a2) { - sub_814A5C0(a1, 0xFFFF, 12, 11679, 8 * a2); + MenuCursor_Create814A5C0(a1, 0xFFFF, 12, 11679, 8 * a2); } u8 InitMenu(u8 cursorSubpriority, u8 left, u8 top, u8 numChoices, u8 cursorPos, u8 cursorWidth) @@ -797,9 +815,9 @@ u8 InitMenu(u8 cursorSubpriority, u8 left, u8 top, u8 numChoices, u8 cursorPos, return pos; } -void RedrawMenuCursor(u8 a1, u8 a2) +static void RedrawMenuCursor(u8 x, u8 y) { - sub_814A880((a1 + 1) * 8, 8 * a2); + MenuCursor_SetPos814A880((x + 1) * 8, 8 * y); } void unref_sub_8072DC0() @@ -817,7 +835,7 @@ void sub_8072DDC(u8 a1) sub_8072DCC(8 * a1); } -void HandleDestroyMenuCursors(void) +void Menu_DestroyCursor(void) { DestroyMenuCursor(); } diff --git a/src/engine/menu_cursor.c b/src/engine/menu_cursor.c index 960d3cc87..35116d40b 100644 --- a/src/engine/menu_cursor.c +++ b/src/engine/menu_cursor.c @@ -3,13 +3,13 @@ #include "palette.h" #include "sprite.h" -EWRAM_DATA u16 gUnknown_0203A360[0x10] = {}; -EWRAM_DATA struct Subsprite gMenuCursorSubsprites[10] = {0}; -EWRAM_DATA u8 gUnknown_0203A3D0 = 0; -EWRAM_DATA u8 gUnknown_0203A3D1 = 0; -EWRAM_DATA u8 gUnknown_0203A3D2 = 0; -EWRAM_DATA u8 gUnknown_0203A3D3 = 0; -EWRAM_DATA u8 gUnknown_0203A3D4 = 0; +EWRAM_DATA static u16 gUnknown_0203A360[0x10] = {}; +EWRAM_DATA static struct Subsprite gMenuCursorSubsprites[10] = {0}; +EWRAM_DATA static u8 gUnknown_0203A3D0 = 0; +EWRAM_DATA static u8 gUnknown_0203A3D1 = 0; +EWRAM_DATA static u8 gUnknown_0203A3D2 = 0; +EWRAM_DATA static u8 gUnknown_0203A3D3 = 0; +EWRAM_DATA static u8 gUnknown_0203A3D4 = 0; #if ENGLISH #include "../src/data/menu_cursor_en.h" @@ -26,7 +26,7 @@ void sub_814A590(void) gUnknown_0203A3D4 = 0; } -u8 sub_814A5C0(u8 a1, u16 a2, u8 a3, u16 a4, u8 a5) +u8 MenuCursor_Create814A5C0(u8 subpriority, u16 paletteTag, u8 a3, u16 a4, u8 a5) { int v9; struct Sprite *v10; @@ -35,34 +35,34 @@ u8 sub_814A5C0(u8 a1, u16 a2, u8 a3, u16 a4, u8 a5) DestroyMenuCursor(); v9 = 1; - if (a2 == 0xFFFF) + if (paletteTag == 0xFFFF) { gUnknown_0203A360[a3 & 0xF] = a4; if (LoadSpritePalette(&gUnknown_0842F240) != 0xFF) { - a2 = 0xFFF0; + paletteTag = 0xFFF0; v9 = 0; } } LoadSpriteSheetDeferred(&gUnknown_0842F140[a3 & 0xF]); - gUnknown_0203A3D0 = CreateSprite(&gSpriteTemplate_842F250[v9], 0, 0xA0, a1); - gUnknown_0203A3D1 = CreateSprite(&gSpriteTemplate_842F250[2], 0, 0xA0, a1); + gUnknown_0203A3D0 = CreateSprite(&gSpriteTemplate_842F250[v9], 0, 160, subpriority); + gUnknown_0203A3D1 = CreateSprite(&gSpriteTemplate_842F250[2], 0, 160, subpriority); if (gUnknown_0203A3D0 != 0x40) { v10 = &gSprites[gUnknown_0203A3D0]; - if (a2 == 0xFFFF) + if (paletteTag == 0xFFFF) v10->oam.paletteNum = 0; else - v10->oam.paletteNum = IndexOfSpritePaletteTag(a2); + v10->oam.paletteNum = IndexOfSpritePaletteTag(paletteTag); } if (gUnknown_0203A3D1 != 0x40) { v10 = &gSprites[gUnknown_0203A3D1]; - if (a2 == 0xFFFF) + if (paletteTag == 0xFFFF) v10->oam.paletteNum = 0; else - v10->oam.paletteNum = IndexOfSpritePaletteTag(a2); + v10->oam.paletteNum = IndexOfSpritePaletteTag(paletteTag); if (!(REG_DISPCNT & (DISPCNT_WIN0_ON | DISPCNT_WIN1_ON))) *(u8 *)(REG_ADDR_WINOUT) |= 0x1F; @@ -75,12 +75,13 @@ u8 sub_814A5C0(u8 a1, u16 a2, u8 a3, u16 a4, u8 a5) return gUnknown_0203A3D0; } -u8 sub_814A758(u8 a1, u8 a2, u8 a3, u8 a4) +// unused +u8 sub_814A758(u8 subpriority, u8 a2, u8 a3, u8 a4) { u8 result; struct Sprite *spr; - result = sub_814A5C0(a1, 0, a3, 0, a4); + result = MenuCursor_Create814A5C0(subpriority, 0, a3, 0, a4); if (result != 0x40) { spr = &gSprites[gUnknown_0203A3D0]; @@ -128,7 +129,7 @@ void DestroyMenuCursor(void) return; } -void sub_814A880(u8 a1, u8 a2) +void MenuCursor_SetPos814A880(u8 a1, u8 a2) { struct Sprite *spr; @@ -685,49 +686,48 @@ void unref_sub_814ABE4(int a1) return; } -u8 CreateBlendedOutlineCursor(u8 a1, u16 a2, u8 a3, u16 a4, u8 a5) +u8 CreateBlendedOutlineCursor(u8 subpriority, u16 paletteTag, u8 a3, u16 a4, u8 a5) { int v8; struct Sprite *spr; - u8 var1 = gUnknown_0203A3D2; - if (var1 != 0x40) - sub_814AD44(); + if (gUnknown_0203A3D2 != 0x40) + MenuCursor_Destroy814AD44(); v8 = 1; - if (a2 == 0xFFFF) + if (paletteTag == 0xFFFF) { gUnknown_0203A360[a3 & 0xF] = a4; if (LoadSpritePalette(&gUnknown_0842F248) != 0xFF ) { - a2 = 0xFFF1; + paletteTag = 0xFFF1; v8 = 0; } } LoadSpriteSheetDeferred(&gUnknown_0842F1C0[a3 & 0xF]); #if ENGLISH - gUnknown_0203A3D2 = CreateSprite(&gSpriteTemplate_842F298[v8], 0, 160, a1); + gUnknown_0203A3D2 = CreateSprite(&gSpriteTemplate_842F298[v8], 0, 160, subpriority); #elif GERMAN - gUnknown_0203A3D2 = CreateSprite(&gSpriteTemplate_842F298[v8], 0, 161, a1); + gUnknown_0203A3D2 = CreateSprite(&gSpriteTemplate_842F298[v8], 0, 161, subpriority); #endif if (gUnknown_0203A3D2 != 0x40) { spr = &gSprites[gUnknown_0203A3D2]; - if (a2 == 0xFFFF) + if (paletteTag == 0xFFFF) spr->oam.paletteNum = 0; else - spr->oam.paletteNum = IndexOfSpritePaletteTag(a2); + spr->oam.paletteNum = IndexOfSpritePaletteTag(paletteTag); } sub_814ADF4(a5); return gUnknown_0203A3D2; } -void sub_814AD44(void) +void MenuCursor_Destroy814AD44(void) { if (gUnknown_0203A3D2 != 0x40) { @@ -738,7 +738,7 @@ void sub_814AD44(void) return; } -void sub_814AD7C(u8 a1, u8 a2) +void MenuCursor_SetPos814AD7C(u8 a1, u8 a2) { struct Sprite *spr; if (gUnknown_0203A3D2 != 0x40) diff --git a/src/engine/mystery_event_menu.c b/src/engine/mystery_event_menu.c index 278760233..b7b7c047e 100644 --- a/src/engine/mystery_event_menu.c +++ b/src/engine/mystery_event_menu.c @@ -45,7 +45,7 @@ void CB2_InitMysteryEventMenu(void) FreeAllSpritePalettes(); ResetTasks(); SetVBlankCallback(VBlankCB); - SetUpWindowConfig(&gWindowTemplate_81E6CE4); + Text_LoadWindowTemplate(&gWindowTemplate_81E6CE4); InitMenuWindow(&gWindowTemplate_81E6CE4); Menu_EraseScreen(); REG_DISPCNT = DISPCNT_MODE_0 | DISPCNT_OBJ_1D_MAP | DISPCNT_BG0_ON; diff --git a/src/engine/name_string_util.c b/src/engine/name_string_util.c index f1a935453..32e9358e1 100644 --- a/src/engine/name_string_util.c +++ b/src/engine/name_string_util.c @@ -7,7 +7,7 @@ void PadNameString(u8 *a1, u8 a2) { u8 i; - StripExtCtrlCodes(a1); + Text_StripExtCtrlCodes(a1); i = StringLength(a1); if (a2 == 0xFC) @@ -36,5 +36,5 @@ void SanitizeNameString(u8 *a1) if (StringLength(a1) < 6) ConvertInternationalString(a1, 1); else - StripExtCtrlCodes(a1); + Text_StripExtCtrlCodes(a1); } diff --git a/src/engine/naming_screen.c b/src/engine/naming_screen.c index 880187dc0..eddfdeda5 100644 --- a/src/engine/naming_screen.c +++ b/src/engine/naming_screen.c @@ -325,7 +325,7 @@ static void NamingScreen_Init(void) static void NamingScreen_SetUpWindow(void) { - SetUpWindowConfig(&gWindowTemplate_81E6E88); + Text_LoadWindowTemplate(&gWindowTemplate_81E6E88); InitMenuWindow(&gWindowTemplate_81E6E88); } diff --git a/src/engine/option_menu.c b/src/engine/option_menu.c index 2b9412e45..868830880 100644 --- a/src/engine/option_menu.c +++ b/src/engine/option_menu.c @@ -116,7 +116,7 @@ void CB2_InitOptionMenu(void) gMain.state++; break; case 2: - SetUpWindowConfig(&gWindowTemplate_81E71B4); + Text_LoadWindowTemplate(&gWindowTemplate_81E71B4); gMain.state++; break; case 3: @@ -313,7 +313,7 @@ static void DrawOptionMenuChoice(const u8 *text, u8 x, u8 y, u8 style) dst[2] = style; dst[i] = EOS; - MenuPrint_PixelCoords(dst, x, y, 1); + Menu_PrintTextPixelCoords(dst, x, y, 1); } static u8 TextSpeed_ProcessInput(u8 selection) diff --git a/src/engine/reset_rtc_screen.c b/src/engine/reset_rtc_screen.c index 37b1c767e..6e9efd342 100644 --- a/src/engine/reset_rtc_screen.c +++ b/src/engine/reset_rtc_screen.c @@ -443,7 +443,7 @@ void CB2_InitResetRtcScreen(void) ResetSpriteData(); ResetTasks(); ResetPaletteFade(); - SetUpWindowConfig(&gWindowTemplate_81E6CE4); + Text_LoadWindowTemplate(&gWindowTemplate_81E6CE4); InitMenuWindow(&gWindowTemplate_81E6CE4); REG_DISPCNT = 4352; SetVBlankCallback(VBlankCB_ResetRtcScreen); diff --git a/src/engine/save_failed_screen.c b/src/engine/save_failed_screen.c index 4609f3fd8..64b84a2f7 100644 --- a/src/engine/save_failed_screen.c +++ b/src/engine/save_failed_screen.c @@ -120,7 +120,7 @@ static void CB2_SaveFailedScreen(void) ResetPaletteFade(); LoadPalette(&gBirchBagGrassPal, 0, sizeof(gBirchBagGrassPal)); LoadPalette(&gSaveFailedClockPal, 0x100, sizeof(gSaveFailedClockPal)); - SetUpWindowConfig(&gWindowTemplate_81E6C3C); + Text_LoadWindowTemplate(&gWindowTemplate_81E6C3C); InitMenuWindow(&gWindowTemplate_81E6CE4); Menu_DrawStdWindowFrame(13, CLOCK_WIN_TOP, 16, CLOCK_WIN_TOP + 3); // clock window Menu_DrawStdWindowFrame(1, MSG_WIN_TOP, 28, 19); // message window diff --git a/src/engine/text.c b/src/engine/text.c index 15a535ff0..fe18a6d79 100644 --- a/src/engine/text.c +++ b/src/engine/text.c @@ -97,7 +97,7 @@ static void AddToCursorX(struct Window *, u8); static void AddToCursorY(struct Window *, u8); static void ClipLeft(struct Window *); static void ClipRight(struct Window *); -static void InitColors(struct Window *); +static void SetWindowDefaultColors(struct Window *); static void SetWindowBackgroundColor(struct Window *, u8); static void SetWindowShadowColor(struct Window *, u8); static void SetWindowForegroundColor(struct Window *, u8); @@ -786,7 +786,7 @@ const struct WindowTemplate gWindowTemplate_81E6DA8 = BG_SCREEN_ADDR(11), // tilemap }; -const struct WindowTemplate WindowConfig_TrainerCard_Back_Values = +const struct WindowTemplate gWindowTemplate_TrainerCard_Back_Values = { 0, // BG number 2, // BG character base block @@ -807,7 +807,7 @@ const struct WindowTemplate WindowConfig_TrainerCard_Back_Values = BG_SCREEN_ADDR(30), // tilemap }; -const struct WindowTemplate WindowConfig_TrainerCard_Back_Labels = +const struct WindowTemplate gWindowTemplate_TrainerCard_Back_Labels = { 0, // BG number 2, // BG character base block @@ -1752,7 +1752,7 @@ void LoadFontDefaultPalette(const struct WindowTemplate *winTemplate) LoadPalette(gFontDefaultPalette, 16 * winTemplate->paletteNum, 32); } -void SetUpWindowConfig(const struct WindowTemplate *winTemplate) +void Text_LoadWindowTemplate(const struct WindowTemplate *winTemplate) { UpdateBGRegs(winTemplate); ClearBGMem(winTemplate); @@ -1952,7 +1952,7 @@ void Text_InitWindowWithTemplate(struct Window *win, const struct WindowTemplate win->height = winTemplate->height; win->tileData = winTemplate->tileData; win->tilemap = winTemplate->tilemap; - InitColors(win); + SetWindowDefaultColors(win); SetWindowBackgroundColor(win, winTemplate->backgroundColor); SetWindowShadowColor(win, winTemplate->shadowColor); SetWindowForegroundColor(win, winTemplate->foregroundColor); @@ -1986,7 +1986,7 @@ void Text_InitWindow(struct Window *win, const u8 *text, u16 tileDataStartOffset win->downArrowCounter = 0; win->tileData = winTemplate->tileData; win->tilemap = winTemplate->tilemap; - InitColors(win); + SetWindowDefaultColors(win); SetWindowBackgroundColor(win, winTemplate->backgroundColor); SetWindowShadowColor(win, winTemplate->shadowColor); SetWindowForegroundColor(win, winTemplate->foregroundColor); @@ -2007,7 +2007,7 @@ void Text_InitWindow8002E4C(struct Window *win, const u8 *text, u16 tileDataStar ClipLeft(win); } -void sub_8002E90(struct Window *win, const u8 *text) +void Text_SetWindowText(struct Window *win, const u8 *text) { win->state = WIN_STATE_NORMAL; win->text = text; @@ -2364,7 +2364,7 @@ u8 sub_8003490(struct Window *win, u8 c, u16 tileDataStartOffset, u8 left, u8 to void sub_80034D4(u8 *tileData, const u8 *text) { - sub_8004E3C(&gWindowTemplate_81E6C74, tileData, text); + Text_InitWindow8004E3C(&gWindowTemplate_81E6C74, tileData, text); } u8 sub_80034EC(u8 *str) @@ -2905,7 +2905,7 @@ static void ClipRight(struct Window *win) } } -static void InitColors(struct Window *win) +static void SetWindowDefaultColors(struct Window *win) { u32 i; @@ -3334,7 +3334,7 @@ void DrawWindowRect_DefaultPalette(struct Window *win, u16 tileNum, u8 left, u8 } // Fills the whole window area with tilemapEntry -void FillWindowRect(struct Window *win, u16 tilemapEntry, u8 left, u8 top, u8 right, u8 bottom) +void Text_FillWindowRect(struct Window *win, u16 tilemapEntry, u8 left, u8 top, u8 right, u8 bottom) { u16 *buffer = &win->tilemap[top * 32]; while (top++ <= bottom) @@ -3346,20 +3346,20 @@ void FillWindowRect(struct Window *win, u16 tilemapEntry, u8 left, u8 top, u8 ri } } -void FillWindowRect_DefaultPalette(struct Window *win, u16 tileNum, u8 left, u8 top, u8 right, u8 bottom) +void Text_FillWindowRectDefPalette(struct Window *win, u16 tileNum, u8 left, u8 top, u8 right, u8 bottom) { - FillWindowRect(win, (win->paletteNum << 12) | tileNum, left, top, right, bottom); + Text_FillWindowRect(win, (win->paletteNum << 12) | tileNum, left, top, right, bottom); } -void ZeroFillWindowRect(struct Window *win, u8 left, u8 top, u8 right, u8 bottom) +void Text_EraseWindowRect(struct Window *win, u8 left, u8 top, u8 right, u8 bottom) { - FillWindowRect_DefaultPalette(win, 0, left, top, right, bottom); + Text_FillWindowRectDefPalette(win, 0, left, top, right, bottom); } void Text_BlankWindowRect(struct Window *win, u8 left, u8 top, u8 right, u8 bottom) { u16 tileNum = GetBlankTileNum(win); - FillWindowRect_DefaultPalette(win, tileNum, left, top, right, bottom); + Text_FillWindowRectDefPalette(win, tileNum, left, top, right, bottom); } static u16 GetBlankTileNum(struct Window *win) @@ -3666,13 +3666,13 @@ u8 GetStringWidth(struct Window *win, const u8 *s) return width; } -u8 sub_8004D04(struct Window *win, const u8 *text, u16 tileDataStartOffset, u8 left, u16 top, u32 a6) +u8 Text_InitWindow8004D04(struct Window *win, const u8 *text, u16 tileDataStartOffset, u8 left, u16 top, u32 a6) { Text_InitWindow8002E4C(win, text, tileDataStartOffset, left, top, a6); return Text_PrintWindow8002F44(win); } -u8 sub_8004D38(struct Window *win, const u8 *text, u16 tileDataStartOffset, u8 left, u8 top) +u8 Text_InitWindow8004D38(struct Window *win, const u8 *text, u16 tileDataStartOffset, u8 left, u8 top) { u8 width = GetStringWidth(win, text); Text_InitWindow(win, text, tileDataStartOffset, left - ((u32)(width + 7) >> 3), top); @@ -3684,7 +3684,7 @@ u8 sub_8004D38(struct Window *win, const u8 *text, u16 tileDataStartOffset, u8 l return Text_PrintWindow8002F44(win); } -u8 sub_8004DB0(struct Window *win, const u8 *text, u16 tileDataStartOffset, u8 left, u8 top, u16 a6) +u8 Text_InitWindow8004DB0(struct Window *win, const u8 *text, u16 tileDataStartOffset, u8 left, u8 top, u16 a6) { register u32 val asm("r5") = (u8)((a6 >> 1) - (GetStringWidth(win, text) >> 1)); left += (val >> 3); @@ -3694,7 +3694,7 @@ u8 sub_8004DB0(struct Window *win, const u8 *text, u16 tileDataStartOffset, u8 l return Text_PrintWindow8002F44(win); } -u8 sub_8004E24(struct Window *win) +u8 Text_GetWindowPaletteNum(struct Window *win) { return win->paletteNum; } @@ -3706,7 +3706,7 @@ void Text_GetTextColors(struct Window *win, u8 *foreground, u8 *background, u8 * *shadow = win->shadowColor; } -void sub_8004E3C(const struct WindowTemplate *winTemplate, u8 *tileData, const u8 *text) +void Text_InitWindow8004E3C(const struct WindowTemplate *winTemplate, u8 *tileData, const u8 *text) { sTempWindow.template = winTemplate; Text_InitWindow(&sTempWindow, text, 0, 0, 0); @@ -3727,11 +3727,11 @@ void ConvertInternationalString(u8 *s, u8 language) { u8 i; - StripExtCtrlCodes(s); + Text_StripExtCtrlCodes(s); i = StringLength(s); - s[i++] = 0xFC; + s[i++] = EXT_CTRL_CODE_BEGIN; s[i++] = 22; - s[i++] = 0xFF; + s[i++] = EOS; i--; @@ -3741,18 +3741,18 @@ void ConvertInternationalString(u8 *s, u8 language) i--; } - s[0] = 0xFC; + s[0] = EXT_CTRL_CODE_BEGIN; s[1] = 21; } } -void StripExtCtrlCodes(u8 *str) +void Text_StripExtCtrlCodes(u8 *str) { u16 srcIndex = 0; u16 destIndex = 0; - while (str[srcIndex] != 0xFF) + while (str[srcIndex] != EOS) { - if (str[srcIndex] == 0xFC) + if (str[srcIndex] == EXT_CTRL_CODE_BEGIN) { srcIndex++; srcIndex += GetExtCtrlCodeLength(str[srcIndex]); @@ -3762,12 +3762,12 @@ void StripExtCtrlCodes(u8 *str) str[destIndex++] = str[srcIndex++]; } } - str[destIndex] = 0xFF; + str[destIndex] = EOS; } static const u8 *SkipExtCtrlCode(const u8 *s) { - while (*s == 0xFC) + while (*s == EXT_CTRL_CODE_BEGIN) { s++; s += GetExtCtrlCodeLength(*s); diff --git a/src/engine/trade.c b/src/engine/trade.c index 30e22b8d5..3a14adaca 100644 --- a/src/engine/trade.c +++ b/src/engine/trade.c @@ -1088,7 +1088,7 @@ static void sub_8047EC0(void) sub_804A964(&gUnknown_03004824->unk_00c8, BG_SCREEN_ADDR(5)); SetVBlankCallback(sub_80489F4); InitMenuWindow(&gWindowTemplate_81E6CE4); - SetUpWindowConfig(&gWindowTemplate_81E6F84); + Text_LoadWindowTemplate(&gWindowTemplate_81E6F84); Text_InitWindowWithTemplate(&gUnknown_03004824->window, &gWindowTemplate_81E6F84); gUnknown_03004824->unk_007a = TextWindow_SetBaseTileNum(20); TextWindow_LoadStdFrameGraphics(&gUnknown_03004824->window); @@ -1157,7 +1157,7 @@ static void sub_8047EC0(void) break; case 6: CalculateEnemyPartyCount(); - FillWindowRect_DefaultPalette(&gUnknown_03004824->window, 0, 0, 0, 29, 19); + Text_FillWindowRectDefPalette(&gUnknown_03004824->window, 0, 0, 0, 29, 19); REG_DISPCNT = 0; gUnknown_03004824->partyCounts[0] = gPlayerPartyCount; gUnknown_03004824->partyCounts[1] = gEnemyPartyCount; @@ -1268,7 +1268,7 @@ static void sub_80484F4(void) sub_804A964(&gUnknown_03004824->unk_00c8, BG_SCREEN_ADDR(5)); SetVBlankCallback(sub_80489F4); InitMenuWindow(&gWindowTemplate_81E6CE4); - SetUpWindowConfig(&gWindowTemplate_81E6F84); + Text_LoadWindowTemplate(&gWindowTemplate_81E6F84); Text_InitWindowWithTemplate(&gUnknown_03004824->window, &gWindowTemplate_81E6F84); gUnknown_03004824->unk_007a = TextWindow_SetBaseTileNum(20); TextWindow_LoadStdFrameGraphics(&gUnknown_03004824->window); @@ -2097,7 +2097,7 @@ static void sub_8049680(void) if (gUnknown_03004824->tradeMenuCursorPosition < PARTY_SIZE) { TextWindow_DrawStdFrame(&gUnknown_03004824->window, 18, 14, 28, 19); - PrintMenuItems(19, 15, 2, (const struct MenuAction *)gUnknown_0820C320); + Menu_PrintItems(19, 15, 2, (const struct MenuAction *)gUnknown_0820C320); InitMenu(0, 19, 15, 2, 0, 9); gUnknown_03004824->unk_007b = 1; } @@ -2126,7 +2126,7 @@ static void sub_8049680(void) static void sub_8049804(void) { - HandleDestroyMenuCursors(); + Menu_DestroyCursor(); sub_804A80C(); gUnknown_03004824->unk_007b = 0; gSprites[gUnknown_03004824->tradeMenuCursorSpriteIdx].invisible = FALSE; @@ -2464,8 +2464,8 @@ static void sub_8049ED4(u8 a0) StoreSpriteCallbackInData(&gSprites[gUnknown_03004824->partyIcons[whichParty][whichPokemon]], sub_809D62C); gUnknown_03004824->unk_0080[a0] ++; sub_8078A34(&gSprites[gUnknown_03004824->partyIcons[whichParty][whichPokemon]]); - HandleDestroyMenuCursors(); - FillWindowRect_DefaultPalette(&gUnknown_03004824->window, 0, gUnknown_0820C330[whichParty][0], 0, gUnknown_0820C330[whichParty][1], 19); + Menu_DestroyCursor(); + Text_FillWindowRectDefPalette(&gUnknown_03004824->window, 0, gUnknown_0820C330[whichParty][0], 0, gUnknown_0820C330[whichParty][1], 19); sub_804A96C_alt(&gUnknown_03004824->unk_00c8, 15 * a0, 0, gTradePartyBoxTilemap, 15, 17, 0); if (whichParty == 0) { @@ -2692,7 +2692,7 @@ static void sub_8049ED4(u8 a0) "\tlsls r0, 2\n" "\tadds r0, r7\n" "\tbl sub_8078A34\n" - "\tbl HandleDestroyMenuCursors\n" + "\tbl Menu_DestroyCursor\n" "\tldr r3, _0804A09C @ =gUnknown_03004824\n" "\tldr r0, [r3]\n" "\tadds r0, 0x4\n" @@ -2708,7 +2708,7 @@ static void sub_8049ED4(u8 a0) "\tstr r1, [sp, 0x4]\n" "\tmovs r1, 0\n" "\tmovs r3, 0\n" - "\tbl FillWindowRect_DefaultPalette\n" + "\tbl Text_FillWindowRectDefPalette\n" "\tldr r1, _0804A09C @ =gUnknown_03004824\n" "\tldr r0, [r1]\n" "\tadds r0, 0xC8\n" @@ -3337,7 +3337,7 @@ static void sub_804A740(u8 whichParty) static void sub_804A80C(void) { - FillWindowRect_DefaultPalette(&gUnknown_03004824->window, 0, gUnknown_0820C330[1][0], 0, gUnknown_0820C330[1][1], 19); + Text_FillWindowRectDefPalette(&gUnknown_03004824->window, 0, gUnknown_0820C330[1][0], 0, gUnknown_0820C330[1][1], 19); sub_804A41C(1); } @@ -3345,7 +3345,7 @@ static void sub_804A840(u8 whichParty) { if (whichParty == 0) { - FillWindowRect_DefaultPalette(&gUnknown_03004824->window, 0, gUnknown_0820C330[0][0], 0, gUnknown_0820C330[0][1], 19); + Text_FillWindowRectDefPalette(&gUnknown_03004824->window, 0, gUnknown_0820C330[0][0], 0, gUnknown_0820C330[0][1], 19); sub_804A96C_alt(&gUnknown_03004824->unk_00c8, 0, 0, gTradePartyBoxTilemap, 15, 17, 0); sub_804A6DC(0); sub_804A41C(0); @@ -3354,8 +3354,8 @@ static void sub_804A840(u8 whichParty) } else { - HandleDestroyMenuCursors(); - FillWindowRect_DefaultPalette(&gUnknown_03004824->window, 0, gUnknown_0820C330[1][0], 0, gUnknown_0820C330[1][1], 19); + Menu_DestroyCursor(); + Text_FillWindowRectDefPalette(&gUnknown_03004824->window, 0, gUnknown_0820C330[1][0], 0, gUnknown_0820C330[1][1], 19); sub_804A96C_alt(&gUnknown_03004824->unk_00c8, 15, 0, gTradePartyBoxTilemap, 15, 17, 0); sub_804A6DC(1); sub_804A41C(1); @@ -3806,7 +3806,7 @@ static void sub_804AFB8(const struct WindowTemplate *windowConfig, u8 *dest, con tileBuffer = gTileBuffer; CpuFill16(0, tileBuffer, size * 0x80); CpuFill16(0, tileBuffer + windowConfig->width * 0x20, size * 0x80); - sub_8004E3C(windowConfig, tileBuffer, src); + Text_InitWindow8004E3C(windowConfig, tileBuffer, src); for (i = 0; i < size; i ++) { CpuCopy16(&tileBuffer[32 * (i * 4)], &dest[32 * (i * 8)], 0x80); @@ -4028,7 +4028,7 @@ static void sub_804B41C(void) FreeAllSpritePalettes(); SetVBlankCallback(sub_804B210); sub_804B228(); - SetUpWindowConfig(&gWindowTemplate_81E6F84); + Text_LoadWindowTemplate(&gWindowTemplate_81E6F84); Text_InitWindowWithTemplate(&gUnknown_03004828->window, &gWindowTemplate_81E6F84); gUnknown_03004828->textWindowBaseTileNum = TextWindow_SetBaseTileNum(2); TextWindow_LoadStdFrameGraphics(&gUnknown_03004828->window); @@ -4184,7 +4184,7 @@ static __attribute__((naked)) void sub_804B41C(void) "\tbl sub_804B228\n" "\tldr r4, _0804B57C @ =gWindowTemplate_81E6F84\n" "\tadds r0, r4, 0\n" - "\tbl SetUpWindowConfig\n" + "\tbl Text_LoadWindowTemplate\n" "\tldr r0, [r6]\n" "\tadds r0, 0x4\n" "\tadds r1, r4, 0\n" @@ -4531,7 +4531,7 @@ static void sub_804B790(void) FreeAllSpritePalettes(); SetVBlankCallback(sub_804B210); sub_804B228(); - SetUpWindowConfig(&gWindowTemplate_81E717C); + Text_LoadWindowTemplate(&gWindowTemplate_81E717C); Text_InitWindowWithTemplate(&gUnknown_03004828->window, &gWindowTemplate_81E717C); gUnknown_03004828->textWindowBaseTileNum = TextWindow_SetBaseTileNum(2); TextWindow_LoadStdFrameGraphics(&gUnknown_03004828->window); @@ -4852,7 +4852,7 @@ static bool8 sub_804C29C(void) { gUnknown_03004828->unk_0102 = sub_8047580(gUnknown_03004828->pokePicSpriteIdxs[0], gSprites[gUnknown_03004828->pokePicSpriteIdxs[0]].oam.paletteNum, 0x78, 0x20, 0x2, 0x1, 0x14, 0xfffff); gUnknown_03004828->unk_00c4 ++; - ZeroFillWindowRect(&gUnknown_03004828->window, 0, 0, 29, 19); + Text_EraseWindowRect(&gUnknown_03004828->window, 0, 0, 29, 19); StringExpandPlaceholders(gStringVar4, gTradeText_ByeBye); Text_InitWindowAndPrintText(&gUnknown_03004828->window, gStringVar4, gUnknown_03004828->textWindowBaseTileNum, 2, 15); } @@ -5199,7 +5199,7 @@ static bool8 sub_804C29C(void) break; case 67: REG_DISPCNT = DISPCNT_MODE_0 | DISPCNT_OBJ_1D_MAP | DISPCNT_BG0_ON | DISPCNT_BG1_ON | DISPCNT_BG2_ON | DISPCNT_OBJ_ON; - ZeroFillWindowRect(&gUnknown_03004828->window, 0, 0, 29, 19); + Text_EraseWindowRect(&gUnknown_03004828->window, 0, 0, 29, 19); StringExpandPlaceholders(gStringVar4, gTradeText_SentOverPoke); Text_InitWindowAndPrintText(&gUnknown_03004828->window, gStringVar4, gUnknown_03004828->textWindowBaseTileNum, 2, 15); gUnknown_03004828->unk_00c4 ++; @@ -5213,7 +5213,7 @@ static bool8 sub_804C29C(void) if (gUnknown_03004828->unk_00c0 == 0xf0) { gUnknown_03004828->unk_00c4 ++; - ZeroFillWindowRect(&gUnknown_03004828->window, 0, 0, 29, 19); + Text_EraseWindowRect(&gUnknown_03004828->window, 0, 0, 29, 19); StringExpandPlaceholders(gStringVar4, gTradeText_TakeGoodCare); Text_InitWindowAndPrintText(&gUnknown_03004828->window, gStringVar4, gUnknown_03004828->textWindowBaseTileNum, 2, 15); gUnknown_03004828->unk_00c0 = 0; @@ -5536,7 +5536,7 @@ static void sub_804DC88(void) case 0: gUnknown_03004828 = &ewram_2010000.unk_0f000; gMain.state ++; - ZeroFillWindowRect(&gUnknown_03004828->window, 0, 0, 29, 19); + Text_EraseWindowRect(&gUnknown_03004828->window, 0, 0, 29, 19); StringExpandPlaceholders(gStringVar4, gOtherText_LinkStandby2); Text_InitWindowAndPrintText(&gUnknown_03004828->window, gStringVar4, gUnknown_03004828->textWindowBaseTileNum, 2, 15); break; @@ -5564,7 +5564,7 @@ static void sub_804DC88(void) break; case 2: gMain.state = 50; - ZeroFillWindowRect(&gUnknown_03004828->window, 0, 0, 29, 19); + Text_EraseWindowRect(&gUnknown_03004828->window, 0, 0, 29, 19); Text_InitWindowAndPrintText(&gUnknown_03004828->window, gSystemText_Saving, gUnknown_03004828->textWindowBaseTileNum, 2, 15); break; case 50: diff --git a/src/engine/trainer_card.c b/src/engine/trainer_card.c index da9dd7179..70942fc29 100644 --- a/src/engine/trainer_card.c +++ b/src/engine/trainer_card.c @@ -565,8 +565,8 @@ void sub_80937A4() void sub_80937BC() { - SetUpWindowConfig(&WindowConfig_TrainerCard_Back_Values); - MultistepInitMenuWindowBegin(&WindowConfig_TrainerCard_Back_Values); + Text_LoadWindowTemplate(&gWindowTemplate_TrainerCard_Back_Values); + MultistepInitMenuWindowBegin(&gWindowTemplate_TrainerCard_Back_Values); } static void sub_80937D8() @@ -678,7 +678,7 @@ bool8 sub_8093980(struct Task *task) static void sub_80939A4(void) { CreateTask(sub_80939DC, 0); - BasicInitMenuWindow(&WindowConfig_TrainerCard_Back_Values); + BasicInitMenuWindow(&gWindowTemplate_TrainerCard_Back_Values); } static void sub_80939C0(void) @@ -1317,7 +1317,7 @@ static void sub_8094140(void) { u8 *buffer; - BasicInitMenuWindow(&WindowConfig_TrainerCard_Back_Values); + BasicInitMenuWindow(&gWindowTemplate_TrainerCard_Back_Values); buffer = gStringVar1; StringCopy(buffer, ewram0_2.var_64.playerName); @@ -1332,7 +1332,7 @@ static void sub_8094140(void) static void sub_8094188(void) { - BasicInitMenuWindow(&WindowConfig_TrainerCard_Back_Values); + BasicInitMenuWindow(&gWindowTemplate_TrainerCard_Back_Values); TrainerCard_Back_PrintName(); TrainerCard_Back_PrintHallOfFameTime_Label(); TrainerCard_Back_PrintLinkBattlesLabel(); @@ -1341,7 +1341,7 @@ static void sub_8094188(void) TrainerCard_Back_PrintLinkPokeblocks_Label(); TrainerCard_Back_PrintPokemonTrades_Label(); - BasicInitMenuWindow(&WindowConfig_TrainerCard_Back_Labels); + BasicInitMenuWindow(&gWindowTemplate_TrainerCard_Back_Labels); TrainerCard_Back_PrintHallOfFameTime(); TrainerCard_Back_PrintLinkBattles(); TrainerCard_Back_PrintBattleTower(); @@ -1489,10 +1489,10 @@ static void TrainerCard_Back_PrintBattleTower(void) if (ewram0_2.var_a != 0) { sub_8072C44(buffer, ewram0_2.var_64.battleTowerWins, 24, 1); - MenuPrint_PixelCoords(buffer, 112, 120, 0); + Menu_PrintTextPixelCoords(buffer, 112, 120, 0); sub_8072C44(buffer, ewram0_2.var_64.battleTowerLosses, 24, 1); - MenuPrint_PixelCoords(buffer, 149, 120, 0); + Menu_PrintTextPixelCoords(buffer, 149, 120, 0); } } |