diff options
author | YamaArashi <shadow962@live.com> | 2016-09-05 19:41:05 -0700 |
---|---|---|
committer | YamaArashi <shadow962@live.com> | 2016-09-05 19:41:05 -0700 |
commit | 079989e1bb3333381d3e90246550d20a2f46caa9 (patch) | |
tree | b879369a784c6eeabeed4c9101f6ac25d8eee03c /src | |
parent | 80b3dc30e6784c40791997dc6284c5069caeb27c (diff) |
rename menu functions
Diffstat (limited to 'src')
-rw-r--r-- | src/link.c | 8 | ||||
-rw-r--r-- | src/main_menu.c | 142 | ||||
-rw-r--r-- | src/menu.c | 274 |
3 files changed, 212 insertions, 212 deletions
diff --git a/src/link.c b/src/link.c index a5d848b83..0fa1f4673 100644 --- a/src/link.c +++ b/src/link.c @@ -27,7 +27,7 @@ struct LinkTestBGInfo u32 dummy_C; }; -extern void sub_8071C4C(const struct WindowConfig *); +extern void InitMenuWindowConfig(const struct WindowConfig *); extern void sub_80516C4(u8, u16); extern u8 unk_2000000[]; @@ -237,7 +237,7 @@ static void LinkTestScreen(void) ResetTasks(); SetVBlankCallback(VBlankCB_LinkTest); SetUpWindowConfig(&gWindowConfig_81E6CE4); - sub_8071C4C(&gWindowConfig_81E6CE4); + InitMenuWindowConfig(&gWindowConfig_81E6CE4); ResetBlockSend(); gLinkType = 0x1111; OpenLink(); @@ -1224,8 +1224,8 @@ void CB2_LinkError(void) ResetTasks(); SetVBlankCallback(VBlankCB_LinkTest); SetUpWindowConfig(&gWindowConfig_81E7198); - sub_8071C4C(&gWindowConfig_81E7198); - sub_8071EF4(); + InitMenuWindowConfig(&gWindowConfig_81E7198); + MenuZeroFillScreen(); REG_BLDALPHA = 0; REG_BG0VOFS = 0; REG_BG0HOFS = 0; diff --git a/src/main_menu.c b/src/main_menu.c index 830894c7b..246cf72a3 100644 --- a/src/main_menu.c +++ b/src/main_menu.c @@ -8,8 +8,8 @@ #include "palette.h" #include "string_util.h" -extern u8 sub_8072080(void); -extern void Print(u8 *, u8, u8); +extern u8 MenuUpdateWindowText(void); +extern void MenuPrint(u8 *, u8, u8); extern void CB2_ContinueSavedGame(void); extern void CB2_InitMysteryEventMenu(void); extern void CB2_InitOptionMenu(void); @@ -21,21 +21,21 @@ extern u8 *sub_8072C14(u8 *, s32, u8, u8); extern u8 sub_80729D8(u8 *, u8, u16, u8); extern u8 GetBadgeCount(void); extern void Task_Birch1(u8); -void AddTextPrinterWithCallbackForMessage(const u8 *string, u8 a, u8 b); +void MenuPrintMessage(const u8 *string, u8 a, u8 b); u8 sub_8072CF4(u8 a); void sub_8072DEC(void); u8 sub_8075374(void); -void sub_807206C(u32); +void MenuSetText(u32); void cry_related(u16, u8); void audio_play(u8 a); -void Reset(u8 a, u8 b, u8 c, u8 d); +void MenuZeroFillWindowRect(u8 a, u8 b, u8 c, u8 d); u8 GetMenuCursorPos(void); void DoNamingScreen(u8 r0, struct SaveBlock2 *r1, u16 r2, u16 r3, u8 s0, MainCallback s4); -void sub_8072974(u8 r0, u8 r1, u32 r2); -s8 FillWindowPixelBuffer(void); +void DisplayYesNoMenu(u8 r0, u8 r1, u32 r2); +s8 ProcessMenuInputNoWrap_(void); void c2_load_new_map_2(void); void LZ77UnCompVram(const void *src, void *dest); -void sub_8071C4C(const struct WindowConfig *); +void InitMenuWindowConfig(const struct WindowConfig *); void CB2_MainMenu(void); void VBlankCB_MainMenu(void); void DecompressPicFromTable_2(const struct SpriteSheet *, u8, u8, void *, void *, u32); @@ -43,7 +43,7 @@ void LoadCompressedObjectPalette(const struct SpritePalette *); void gpu_pal_obj_decompress_and_apply(u16, u8); u8 AddNewGameBirchObject(u8, u8, u8); u8 sub_80859BC(u8, u16, u16, u8, void *); -void DrawDefaultWindow(u8 a, u8 b, u8 c, u8 d); +void MenuDrawTextWindow(u8 a, u8 b, u8 c, u8 d); extern struct PaletteFadeControl gPaletteFade; extern u8 gSaveFileDeletedMessage[]; @@ -139,7 +139,7 @@ u32 InitMainMenu(u8 a1) ResetSpriteData(); FreeAllSpritePalettes(); SetUpWindowConfig(&gWindowConfig_81E6C3C); - sub_8071C4C(&gWindowConfig_81E6CE4); + InitMenuWindowConfig(&gWindowConfig_81E6CE4); if (a1) BeginNormalPaletteFade(-1, 0, 0x10, 0, 0x0000); // fade to black @@ -197,16 +197,16 @@ void Task_CheckSave(u8 taskId) gTasks[taskId].func = Task_CheckRtc; break; case 2: - DrawDefaultWindow(2, 14, 27, 19); - AddTextPrinterWithCallbackForMessage(gSaveFileDeletedMessage, 3, 15); + MenuDrawTextWindow(2, 14, 27, 19); + MenuPrintMessage(gSaveFileDeletedMessage, 3, 15); REG_WIN0H = WIN_RANGE(17, 223); REG_WIN0V = WIN_RANGE(113, 159); gTasks[taskId].data[0] = 0; gTasks[taskId].func = Task_WaitForSaveErrorAck; break; case 255: - DrawDefaultWindow(2, 14, 27, 19); - AddTextPrinterWithCallbackForMessage(gSaveFileCorruptMessage, 3, 15); + MenuDrawTextWindow(2, 14, 27, 19); + MenuPrintMessage(gSaveFileCorruptMessage, 3, 15); REG_WIN0H = WIN_RANGE(17, 223); REG_WIN0V = WIN_RANGE(113, 159); gTasks[taskId].data[0] = 1; @@ -223,8 +223,8 @@ void Task_CheckSave(u8 taskId) gTasks[taskId].func = Task_CheckRtc; break; case 4: - DrawDefaultWindow(2, 14, 27, 19); - AddTextPrinterWithCallbackForMessage(gBoardNotInstalledMessage, 3, 15); + MenuDrawTextWindow(2, 14, 27, 19); + MenuPrintMessage(gBoardNotInstalledMessage, 3, 15); REG_WIN0H = WIN_RANGE(17, 223); REG_WIN0V = WIN_RANGE(113, 159); gTasks[taskId].data[0] = 0; @@ -235,11 +235,11 @@ void Task_CheckSave(u8 taskId) void Task_WaitForSaveErrorAck(u8 taskId) { - if (sub_8072080()) + if (MenuUpdateWindowText()) { if (gMain.newKeys & A_BUTTON) { - Reset(2, 14, 27, 19); + MenuZeroFillWindowRect(2, 14, 27, 19); gTasks[taskId].func = Task_CheckRtc; } } @@ -263,8 +263,8 @@ void Task_CheckRtc(u8 taskId) } else { - DrawDefaultWindow(2, 14, 27, 19); - AddTextPrinterWithCallbackForMessage(gBatteryDryMessage, 3, 15); + MenuDrawTextWindow(2, 14, 27, 19); + MenuPrintMessage(gBatteryDryMessage, 3, 15); REG_WIN0H = WIN_RANGE(17, 223); REG_WIN0V = WIN_RANGE(113, 159); gTasks[taskId].func = Task_WaitForRtcErrorAck; @@ -274,11 +274,11 @@ void Task_CheckRtc(u8 taskId) void Task_WaitForRtcErrorAck(u8 taskId) { - if (sub_8072080()) + if (MenuUpdateWindowText()) { if ( gMain.newKeys & 1 ) { - Reset(2, 14, 27, 19); + MenuZeroFillWindowRect(2, 14, 27, 19); gTasks[taskId].func = Task_DrawMainMenu; } } @@ -316,28 +316,28 @@ void Task_DrawMainMenu(u8 taskId) { case 0: default: - DrawDefaultWindow(1, 0, 28, 3); + MenuDrawTextWindow(1, 0, 28, 3); PrintMainMenuItem(gMainMenuString_NewGame, 2, 1); - DrawDefaultWindow(1, 4, 28, 7); + MenuDrawTextWindow(1, 4, 28, 7); PrintMainMenuItem(gMainMenuString_Option, 2, 5); break; case 1: - DrawDefaultWindow(1, 0, 28, 7); + MenuDrawTextWindow(1, 0, 28, 7); PrintMainMenuItem(gMainMenuString_Continue, 2, 1); - DrawDefaultWindow(1, 8, 28, 11); + MenuDrawTextWindow(1, 8, 28, 11); PrintMainMenuItem(gMainMenuString_NewGame, 2, 9); - DrawDefaultWindow(1, 12, 28, 15); + MenuDrawTextWindow(1, 12, 28, 15); PrintMainMenuItem(gMainMenuString_Option, 2, 13); PrintSaveFileInfo(); break; case 2: - DrawDefaultWindow(1, 0, 28, 7); + MenuDrawTextWindow(1, 0, 28, 7); PrintMainMenuItem(gMainMenuString_Continue, 2, 1); - DrawDefaultWindow(1, 8, 28, 11); + MenuDrawTextWindow(1, 8, 28, 11); PrintMainMenuItem(gMainMenuString_NewGame, 2, 9); - DrawDefaultWindow(1, 12, 28, 15); + MenuDrawTextWindow(1, 12, 28, 15); PrintMainMenuItem(gMainMenuString_MysteryEvents, 2, 13); - DrawDefaultWindow(1, 16, 28, 19); + MenuDrawTextWindow(1, 16, 28, 19); PrintMainMenuItem(gMainMenuString_Option, 2, 0x11); PrintSaveFileInfo(); break; @@ -582,7 +582,7 @@ void PrintMainMenuItem(u8 *text, u8 left, u8 top) buffer[29] = EOS; - Print(buffer, left, top); + MenuPrint(buffer, left, top); } void PrintSaveFileInfo(void) @@ -595,8 +595,8 @@ void PrintSaveFileInfo(void) void PrintPlayerName(void) { - Print(gMainMenuString_Player, 2, 3); - Print(gSaveBlock2.playerName, 9, 3); + MenuPrint(gMainMenuString_Player, 2, 3); + MenuPrint(gSaveBlock2.playerName, 9, 3); } void PrintPlayTime(void) @@ -604,26 +604,26 @@ void PrintPlayTime(void) u8 playTime[16]; u8 alignedPlayTime[32]; - Print(gMainMenuString_Time, 16, 3); + MenuPrint(gMainMenuString_Time, 16, 3); FormatPlayTime(playTime, gSaveBlock2.playTimeHours, gSaveBlock2.playTimeMinutes, 1); sub_8072C74(alignedPlayTime, playTime, 48, 1); - Print(alignedPlayTime, 22, 3); + MenuPrint(alignedPlayTime, 22, 3); } void PrintPokedexCount(void) { u8 buffer[16]; - Print(gMainMenuString_Pokedex, 2, 5); + MenuPrint(gMainMenuString_Pokedex, 2, 5); sub_8072C14(buffer, GetPokedexSeenCount(), 18, 0); - Print(buffer, 9, 5); + MenuPrint(buffer, 9, 5); } void PrintBadgeCount(void) { u8 buffer[16]; - Print(gMainMenuString_Badges, 16, 5); + MenuPrint(gMainMenuString_Badges, 16, 5); ConvertIntToDecimalString(buffer, GetBadgeCount()); sub_80729D8(buffer, 205, 40, 1); } @@ -721,7 +721,7 @@ void set_default_player_name(u8 a); void Task_Birch1(u8 taskId) { SetUpWindowConfig(&gWindowConfig_81E6C3C); - sub_8071C4C(&gWindowConfig_81E6CE4); + InitMenuWindowConfig(&gWindowConfig_81E6CE4); REG_WIN0H = 0; REG_WIN0V = 0; REG_WININ = 0; @@ -791,8 +791,8 @@ void task_new_game_prof_birch_speech_3(u8 taskId) } else { - DrawDefaultWindow(0x2, 0xD, 0x1B, 0x12); - AddTextPrinterWithCallbackForMessage(gUnknown_081C6D78, 0x3, 0xE); + MenuDrawTextWindow(0x2, 0xD, 0x1B, 0x12); + MenuPrintMessage(gUnknown_081C6D78, 0x3, 0xE); task->func = task_new_game_prof_birch_speech_4; } } @@ -805,7 +805,7 @@ void task_new_game_prof_birch_speech_4(u8 taskId) struct Task *tasks = gTasks; struct Task *task = &tasks[taskId]; task->func = task_new_game_prof_birch_speech_5; - AddTextPrinterWithCallbackForMessage(gUnknown_081C6DF8, 0x3, 0xE); + MenuPrintMessage(gUnknown_081C6DF8, 0x3, 0xE); } } @@ -844,7 +844,7 @@ void task_new_game_prof_birch_speech_7(u8 taskId) if(task->data[7] > 0x5F) { - sub_807206C((u32)&gUnknown_0840DFF7); + MenuSetText((u32)&gUnknown_0840DFF7); task->func = task_new_game_prof_birch_speech_8; } } @@ -865,7 +865,7 @@ void task_new_game_prof_birch_speech_8(u8 taskId) { if(sub_8072CF4(0x18)) { - AddTextPrinterWithCallbackForMessage(gUnknown_081C6E1A, 0x3, 0xE); + MenuPrintMessage(gUnknown_081C6E1A, 0x3, 0xE); gTasks[taskId].func = task_new_game_prof_birch_speech_9; } } @@ -874,8 +874,8 @@ void task_new_game_prof_birch_speech_9(u8 taskId) { if(sub_8072CF4(0x18)) { - DrawDefaultWindow(0x2, 0xD, 0x1B, 0x12); - AddTextPrinterWithCallbackForMessage(gUnknown_081C6FCB, 0x3, 0xE); + MenuDrawTextWindow(0x2, 0xD, 0x1B, 0x12); + MenuPrintMessage(gUnknown_081C6FCB, 0x3, 0xE); gTasks[taskId].func = task_new_game_prof_birch_speech_10; } } @@ -962,8 +962,8 @@ void task_new_game_prof_birch_speech_13(u8 taskId) void task_new_game_prof_birch_speech_14(u8 taskId) { - DrawDefaultWindow(2, 0xD, 0x1B, 0x12); - AddTextPrinterWithCallbackForMessage(gUnknown_081C6FD8, 3, 14); + MenuDrawTextWindow(2, 0xD, 0x1B, 0x12); + MenuPrintMessage(gUnknown_081C6FD8, 3, 14); gTasks[taskId].func = task_new_game_prof_birch_speech_15; } @@ -986,14 +986,14 @@ void task_new_game_prof_birch_speech_16(u8 taskId) sub_8072DEC(); audio_play(5); gSaveBlock2.playerGender = MALE; - Reset(2, 4, 8, 9); + MenuZeroFillWindowRect(2, 4, 8, 9); gTasks[taskId].func = sub_800A974; break; case FEMALE: sub_8072DEC(); audio_play(5); gSaveBlock2.playerGender = FEMALE; - Reset(2, 4, 8, 9); + MenuZeroFillWindowRect(2, 4, 8, 9); gTasks[taskId].func = sub_800A974; break; } @@ -1060,8 +1060,8 @@ void task_new_game_prof_birch_speech_18(u8 taskId) void sub_800A974(u8 taskId) { - DrawDefaultWindow(2, 13, 27, 18); - AddTextPrinterWithCallbackForMessage(gUnknown_081C6FFA, 3, 14); + MenuDrawTextWindow(2, 13, 27, 18); + MenuPrintMessage(gUnknown_081C6FFA, 3, 14); gTasks[taskId].func = Task_800A9B4; } @@ -1086,7 +1086,7 @@ void sub_800A9EC(u8 taskId) case 4: sub_8072DEC(); audio_play(5); - Reset(2, 1, 22, 12); + MenuZeroFillWindowRect(2, 1, 22, 12); set_default_player_name(n); gTasks[taskId].func = task_new_game_prof_birch_speech_part2_1; break; @@ -1098,7 +1098,7 @@ void sub_800A9EC(u8 taskId) case -1: sub_8072DEC(); audio_play(5); - Reset(2, 1, 22, 12); + MenuZeroFillWindowRect(2, 1, 22, 12); gTasks[taskId].func = task_new_game_prof_birch_speech_14; break; } @@ -1115,9 +1115,9 @@ void sub_800AAAC(u8 taskId) void task_new_game_prof_birch_speech_part2_1(u8 taskId) { - DrawDefaultWindow(2, 13, 27, 18); + MenuDrawTextWindow(2, 13, 27, 18); StringExpandPlaceholders(gStringVar4, gUnknown_081C7017); - AddTextPrinterWithCallbackForMessage(gStringVar4, 3, 14); + MenuPrintMessage(gStringVar4, 3, 14); gTasks[taskId].func = sub_800AB38; } @@ -1125,18 +1125,18 @@ void sub_800AB38(u8 taskId) { if(sub_8072CF4(0x18)) { - sub_8072974(2, 1, 1); + DisplayYesNoMenu(2, 1, 1); gTasks[taskId].func = task_new_game_prof_birch_speech_part2_4; } } void task_new_game_prof_birch_speech_part2_4(u8 taskId) { - switch (FillWindowPixelBuffer()) + switch (ProcessMenuInputNoWrap_()) { case 0: audio_play(5); - Reset(2, 1, 8, 7); + MenuZeroFillWindowRect(2, 1, 8, 7); gSprites[gTasks[taskId].data[2]].oam.objMode = ST_OAM_OBJ_BLEND; sub_800B458(taskId, 2); sub_800B614(taskId, 1); @@ -1145,7 +1145,7 @@ void task_new_game_prof_birch_speech_part2_4(u8 taskId) case -1: case 1: audio_play(5); - Reset(2, 1, 8, 7); + MenuZeroFillWindowRect(2, 1, 8, 7); gTasks[taskId].func = task_new_game_prof_birch_speech_14; break; } @@ -1190,9 +1190,9 @@ void task_new_game_prof_birch_speech_part2_6(u8 taskId) sub_800B534(taskId, 2); sub_800B6C0(taskId, 1); - DrawDefaultWindow(2, 13, 27, 18); + MenuDrawTextWindow(2, 13, 27, 18); StringExpandPlaceholders(gStringVar4, gUnknown_081C7025); - AddTextPrinterWithCallbackForMessage(gStringVar4, 3, 14); + MenuPrintMessage(gStringVar4, 3, 14); gTasks[taskId].func = task_new_game_prof_birch_speech_part2_7; } } @@ -1258,8 +1258,8 @@ void task_new_game_prof_birch_speech_part2_8(u8 taskId) sub_800B534(taskId, 2); sub_800B6C0(taskId, 1); - DrawDefaultWindow(2, 13, 27, 18); - AddTextPrinterWithCallbackForMessage(gUnknown_081C7074, 3, 14); + MenuDrawTextWindow(2, 13, 27, 18); + MenuPrintMessage(gUnknown_081C7074, 3, 14); gTasks[taskId].func = task_new_game_prof_birch_speech_part2_9; } } @@ -1363,7 +1363,7 @@ void new_game_prof_birch_speech_part2_start() AddBirchSpeechObjects(taskId); SetUpWindowConfig(&gWindowConfig_81E6C3C); - sub_8071C4C(&gWindowConfig_81E6CE4); + InitMenuWindowConfig(&gWindowConfig_81E6CE4); if (gSaveBlock2.playerGender != MALE) { @@ -1612,10 +1612,10 @@ void sub_800B6C0(u8 a1, u8 a2) void CreateGenderMenu(u8 left, u8 top) { u8 menuLeft, menuTop; - DrawDefaultWindow(left, top, left + 6, top + 5); + MenuDrawTextWindow(left, top, left + 6, top + 5); menuLeft = left + 1; menuTop = top + 1; - PrintStringArray(menuLeft, menuTop, 2, gUnknown_081E79B0); + PrintMenuItems(menuLeft, menuTop, 2, gUnknown_081E79B0); InitMenu(0, menuLeft, menuTop, 2, 0, 5); } @@ -1626,15 +1626,15 @@ s8 GenderMenuProcessInput(void) void CreateNameMenu(u8 left, u8 top) { - DrawDefaultWindow(left, top, left + 10, top + 11); + MenuDrawTextWindow(left, top, left + 10, top + 11); if (gSaveBlock2.playerGender == MALE) { - PrintStringArray((u8)(left + 1), (u8)(top + 1), 5, gUnknown_081E79C0); + PrintMenuItems((u8)(left + 1), (u8)(top + 1), 5, gUnknown_081E79C0); } else { - PrintStringArray((u8)(left + 1), (u8)(top + 1), 5, gUnknown_081E79E8); + PrintMenuItems((u8)(left + 1), (u8)(top + 1), 5, gUnknown_081E79E8); } InitMenu(0, (u8)(left + 1), (u8)(top + 1), 5, 0, 9); diff --git a/src/menu.c b/src/menu.c index 0e9c34c69..6533b59cf 100644 --- a/src/menu.c +++ b/src/menu.c @@ -17,33 +17,33 @@ struct Menu u8 columnXCoords[8]; }; -void sub_8071C4C(struct WindowConfig *); -void sub_8071C58(struct WindowConfig *); -void sub_8071C64(struct WindowConfig *, u16); -bool32 sub_8071C94(void); -void sub_8071D48(struct WindowConfig *, u16); +void InitMenuWindowConfig(struct WindowConfig *); +void MultistepInitMenuWindowConfigBegin(struct WindowConfig *); +void MultistepInitMenuWindowConfigInternal(struct WindowConfig *, u16); +bool32 MultistepInitMenuWindowConfigContinue(void); +void InitMenuWindowConfigInternal(struct WindowConfig *, u16); void unref_sub_8071DA4(struct WindowConfig *, u16); -void sub_8071E00(u8); -void GetMapNamePopUpWindowId(void); -void sub_8071E2C(struct WindowConfig *); -void Print(u8 *, u8, u8); -void Reset(u8, u8, u8, u8); -void sub_8071EBC(u8, u8, u8, u8); -void sub_8071EF4(void); -void DrawDefaultWindow(u8, u8, u8, u8); +void MenuLoadTextWindowGraphics_OverrideFrameType(u8); +void MenuLoadTextWindowGraphics(void); +void BasicInitMenuWindowConfig(struct WindowConfig *); +void MenuPrint(u8 *, u8, u8); +void MenuZeroFillWindowRect(u8, u8, u8, u8); +void MenuFillWindowRectWithBlankTile(u8, u8, u8, u8); +void MenuZeroFillScreen(void); +void MenuDrawTextWindow(u8, u8, u8, u8); void sub_8071F40(u8 *); void sub_8071F60(u8, u8, u8, u8); u16 unref_sub_8071F98(u8, u8); void unref_sub_8071FBC(u16, u8, u8, u8, u8); -void sub_8071FFC(void); -void AddTextPrinterWithCallbackForMessage(u8 *, u8, u8); +void MenuDisplayMessageBox(void); +void MenuPrintMessage(u8 *, u8, u8); void sub_8072044(u8 *); -void sub_807206C(u8 *); -u8 sub_8072080(void); +void MenuSetText(u8 *); +u8 MenuUpdateWindowText(void); u8 unref_sub_8072098(void); void sub_80720B0(void); u8 MoveMenuCursor(s8); -u8 MoveMenuCursorNoWrapAround(s8); +u8 MoveMenuCursorNoWrap(s8); u8 GetMenuCursorPos(void); s8 ProcessMenuInput(void); s8 ProcessMenuInputNoWrap(void); @@ -56,18 +56,18 @@ void sub_8072620(u8, u8, u8, u8*[][2], u8); void sub_807274C(u8, u8, u8, u8, u8*[][2], u8, u32); s8 sub_80727CC(void); u8 sub_807288C(u8); -void PrintStringArray(u8, u8, u8, u8*[][2]); -void sub_80728E4(u8, u8, u8, u8*[][2], u8*); -void sub_807292C(u8, u8, u8); -void sub_8072974(u8, u8, u32); -s8 FillWindowPixelBuffer(void); +void PrintMenuItems(u8, u8, u8, u8*[][2]); +void PrintMenuItemsReordered(u8, u8, u8, u8*[][2], u8*); +void InitYesNoMenu(u8, u8, u8); +void DisplayYesNoMenu(u8, u8, u32); +s8 ProcessMenuInputNoWrap_(void); u8 sub_80729D8(u8 *, u8, u16, u8); u8 sub_8072A18(u8 *, u8, u16, u8, u32); u8 unref_sub_8072A5C(u8 *, u8 *, u8, u16, u8, u32); int sub_8072AB0(u8 *, u8, u16, u8, u8, u32); -void PrintCoinsString(u8 *, u8, u8); +void sub_8072B4C(u8 *, u8, u8); void sub_8072B80(u8 *, u8, u8, u8 *); -void Free(u8 *, u8, u8, u16); +void sub_8072BD8(u8 *, u8, u8, u16); u8 *sub_8072C14(u8 *, s32, u8, u8); u8 *sub_8072C44(u8 *, s32, u8, u8); u8 *sub_8072C74(u8 *, u8 *, u8, u8); @@ -92,56 +92,56 @@ extern void sub_814A7FC(void); static struct Menu gMenu; -extern struct Window stru_202E908; -extern struct Window *dword_202E9C8; -extern u8 byte_202E9CC; -extern u16 word_202E9CE; -extern u16 word_202E9D0; -extern u16 word_202E9D2; -extern u16 word_202E9D4; +extern struct Window gMenuWindow; +extern struct Window *gMenuWindowPtr; +extern u8 gMenuMultistepInitState; +extern u16 gMenuTextTileOffset; +extern u16 gMenuTextWindowTileOffset; +extern u16 gMenuTextWindowContentTileOffset; +extern u16 gMenuMessageBoxContentTileOffset; extern const u8 *gUnknown_08376D74[][2]; -void sub_8071C4C(struct WindowConfig *a1) +void InitMenuWindowConfig(struct WindowConfig *winConfig) { - sub_8071D48(a1, 1); + InitMenuWindowConfigInternal(winConfig, 1); } -void sub_8071C58(struct WindowConfig *a1) +void MultistepInitMenuWindowConfigBegin(struct WindowConfig *winConfig) { - sub_8071C64(a1, 1); + MultistepInitMenuWindowConfigInternal(winConfig, 1); } -void sub_8071C64(struct WindowConfig *a1, u16 a2) +void MultistepInitMenuWindowConfigInternal(struct WindowConfig *winConfig, u16 tileOffset) { - byte_202E9CC = 0; - word_202E9CE = a2; - dword_202E9C8 = &stru_202E908; - InitWindowFromConfig(&stru_202E908, a1); + gMenuMultistepInitState = 0; + gMenuTextTileOffset = tileOffset; + gMenuWindowPtr = &gMenuWindow; + InitWindowFromConfig(&gMenuWindow, winConfig); } -bool32 sub_8071C94(void) +bool32 MultistepInitMenuWindowConfigContinue(void) { - switch (byte_202E9CC) + switch (gMenuMultistepInitState) { case 0: - byte_202E9CC++; + gMenuMultistepInitState++; return 0; case 1: - word_202E9D0 = MultistepInitWindowTileData(dword_202E9C8, word_202E9CE); + gMenuTextWindowTileOffset = MultistepInitWindowTileData(gMenuWindowPtr, gMenuTextTileOffset); goto next; case 2: if (!MultistepLoadFont()) goto fail; goto next; case 3: - word_202E9D2 = SetTextWindowBaseTileNum(word_202E9D0); + gMenuTextWindowContentTileOffset = SetTextWindowBaseTileNum(gMenuTextWindowTileOffset); next: - byte_202E9CC++; + gMenuMultistepInitState++; return 0; case 4: - LoadTextWindowGraphics(dword_202E9C8); - word_202E9D4 = SetMessageBoxBaseTileNum(word_202E9D2); + LoadTextWindowGraphics(gMenuWindowPtr); + gMenuMessageBoxContentTileOffset = SetMessageBoxBaseTileNum(gMenuTextWindowContentTileOffset); return 1; default: fail: @@ -149,123 +149,123 @@ bool32 sub_8071C94(void) } } -void sub_8071D48(struct WindowConfig *a1, u16 a2) +void InitMenuWindowConfigInternal(struct WindowConfig *winConfig, u16 tileOffset) { - dword_202E9C8 = &stru_202E908; - InitWindowFromConfig(&stru_202E908, a1); - word_202E9CE = a2; - word_202E9D0 = InitWindowTileData(dword_202E9C8, word_202E9CE); - word_202E9D2 = SetTextWindowBaseTileNum(word_202E9D0); - LoadTextWindowGraphics(dword_202E9C8); - word_202E9D4 = SetMessageBoxBaseTileNum(word_202E9D2); + gMenuWindowPtr = &gMenuWindow; + InitWindowFromConfig(&gMenuWindow, winConfig); + gMenuTextTileOffset = tileOffset; + gMenuTextWindowTileOffset = InitWindowTileData(gMenuWindowPtr, gMenuTextTileOffset); + gMenuTextWindowContentTileOffset = SetTextWindowBaseTileNum(gMenuTextWindowTileOffset); + LoadTextWindowGraphics(gMenuWindowPtr); + gMenuMessageBoxContentTileOffset = SetMessageBoxBaseTileNum(gMenuTextWindowContentTileOffset); } -void unref_sub_8071DA4(struct WindowConfig *a1, u16 a2) +void unref_sub_8071DA4(struct WindowConfig *winConfig, u16 tileOffset) { - dword_202E9C8 = &stru_202E908; - InitWindowFromConfig(&stru_202E908, a1); - word_202E9D0 = a2; - word_202E9D2 = SetTextWindowBaseTileNum(word_202E9D0); - LoadTextWindowGraphics(dword_202E9C8); - word_202E9CE = SetMessageBoxBaseTileNum(word_202E9D2); - word_202E9D4 = InitWindowTileData(dword_202E9C8, word_202E9CE); + gMenuWindowPtr = &gMenuWindow; + InitWindowFromConfig(&gMenuWindow, winConfig); + gMenuTextWindowTileOffset = tileOffset; + gMenuTextWindowContentTileOffset = SetTextWindowBaseTileNum(gMenuTextWindowTileOffset); + LoadTextWindowGraphics(gMenuWindowPtr); + gMenuTextTileOffset = SetMessageBoxBaseTileNum(gMenuTextWindowContentTileOffset); + gMenuMessageBoxContentTileOffset = InitWindowTileData(gMenuWindowPtr, gMenuTextTileOffset); } -void sub_8071E00(u8 a1) +void MenuLoadTextWindowGraphics_OverrideFrameType(u8 frameType) { - LoadTextWindowGraphics_OverrideFrameType(dword_202E9C8, a1); + LoadTextWindowGraphics_OverrideFrameType(gMenuWindowPtr, frameType); } -void GetMapNamePopUpWindowId(void) +void MenuLoadTextWindowGraphics(void) { - LoadTextWindowGraphics(dword_202E9C8); + LoadTextWindowGraphics(gMenuWindowPtr); } -void sub_8071E2C(struct WindowConfig *a1) +void BasicInitMenuWindowConfig(struct WindowConfig *winConfig) { - InitWindowFromConfig(dword_202E9C8, a1); - dword_202E9C8->tileDataStartOffset = word_202E9CE; + InitWindowFromConfig(gMenuWindowPtr, winConfig); + gMenuWindowPtr->tileDataStartOffset = gMenuTextTileOffset; } -void Print(u8 *str, u8 left, u8 top) +void MenuPrint(u8 *str, u8 left, u8 top) { - sub_8003460(dword_202E9C8, str, word_202E9CE, left, top); + sub_8003460(gMenuWindowPtr, str, gMenuTextTileOffset, left, top); } -void Reset(u8 a1, u8 a2, u8 a3, u8 a4) +void MenuZeroFillWindowRect(u8 a1, u8 a2, u8 a3, u8 a4) { - ZeroFillWindowRect(dword_202E9C8, a1, a2, a3, a4); + ZeroFillWindowRect(gMenuWindowPtr, a1, a2, a3, a4); } -void sub_8071EBC(u8 left, u8 top, u8 right, u8 bottom) +void MenuFillWindowRectWithBlankTile(u8 left, u8 top, u8 right, u8 bottom) { - FillWindowRectWithBlankTile(dword_202E9C8, left, top, right, bottom); + FillWindowRectWithBlankTile(gMenuWindowPtr, left, top, right, bottom); } -void sub_8071EF4(void) +void MenuZeroFillScreen(void) { - Reset(0, 0, 29, 19); + MenuZeroFillWindowRect(0, 0, 29, 19); } -void DrawDefaultWindow(u8 left, u8 top, u8 right, u8 bottom) +void MenuDrawTextWindow(u8 left, u8 top, u8 right, u8 bottom) { - DrawTextWindow(dword_202E9C8, left, top, right, bottom); + DrawTextWindow(gMenuWindowPtr, left, top, right, bottom); } void sub_8071F40(u8 *str) { - DrawDefaultWindow(2, 14, 28, 19); - Print(str, 3, 15); + MenuDrawTextWindow(2, 14, 28, 19); + MenuPrint(str, 3, 15); } void sub_8071F60(u8 a1, u8 a2, u8 a3, u8 a4) { - sub_8003490(dword_202E9C8, a1, word_202E9CE, a2, a3); + sub_8003490(gMenuWindowPtr, a1, gMenuTextTileOffset, a2, a3); } u16 unref_sub_8071F98(u8 x, u8 y) { - return GetWindowTilemapEntry(dword_202E9C8, x, y); + return GetWindowTilemapEntry(gMenuWindowPtr, x, y); } void unref_sub_8071FBC(u16 a1, u8 a2, u8 a3, u8 a4, u8 a5) { - DrawWindowRect(dword_202E9C8, a1, a2, a3, a4, a5); + DrawWindowRect(gMenuWindowPtr, a1, a2, a3, a4, a5); } -void sub_8071FFC(void) +void MenuDisplayMessageBox(void) { - DisplayMessageBox(dword_202E9C8); + DisplayMessageBox(gMenuWindowPtr); } -void AddTextPrinterWithCallbackForMessage(u8 *str, u8 a2, u8 a3) +void MenuPrintMessage(u8 *str, u8 left, u8 top) { - sub_8002EB0(dword_202E9C8, str, word_202E9CE, a2, a3); + sub_8002EB0(gMenuWindowPtr, str, gMenuTextTileOffset, left, top); } void sub_8072044(u8 *str) { - sub_8002EB0(dword_202E9C8, str, word_202E9CE, 2, 15); + sub_8002EB0(gMenuWindowPtr, str, gMenuTextTileOffset, 2, 15); } -void sub_807206C(u8 *str) +void MenuSetText(u8 *str) { - sub_8002E90(dword_202E9C8, str); + sub_8002E90(gMenuWindowPtr, str); } -u8 sub_8072080(void) +u8 MenuUpdateWindowText(void) { - return sub_80035AC(dword_202E9C8); + return sub_80035AC(gMenuWindowPtr); } u8 unref_sub_8072098(void) { - return sub_8003418(dword_202E9C8); + return sub_8003418(gMenuWindowPtr); } void sub_80720B0(void) { - ClearWindowTextLines(dword_202E9C8); + ClearWindowTextLines(gMenuWindowPtr); } u8 MoveMenuCursor(s8 delta) @@ -283,7 +283,7 @@ u8 MoveMenuCursor(s8 delta) return gMenu.cursorPos; } -u8 MoveMenuCursorNoWrapAround(s8 delta) +u8 MoveMenuCursorNoWrap(s8 delta) { s32 newPos = gMenu.cursorPos + delta; @@ -357,18 +357,18 @@ s8 ProcessMenuInputNoWrap(void) if (gMain.newKeys & DPAD_UP) { - if (cursorPos != MoveMenuCursorNoWrapAround(-1)) + if (cursorPos != MoveMenuCursorNoWrap(-1)) audio_play(SE_SELECT); return -2; } else if (gMain.newKeys & DPAD_DOWN) { - if (cursorPos != MoveMenuCursorNoWrapAround(1)) + if (cursorPos != MoveMenuCursorNoWrap(1)) audio_play(SE_SELECT); return -2; } - MoveMenuCursorNoWrapAround(0); + MoveMenuCursorNoWrap(0); return -2; } @@ -501,7 +501,7 @@ u8 sub_80724F4(u8 left, u8 top, u8 menuItemCount, u8 *menuItems[][2], u8 columnC totalWidth = (gMenu.columnXCoords[columnCount] + 1); right = left + totalWidth; - DrawDefaultWindow(left, top, right, bottom); + MenuDrawTextWindow(left, top, right, bottom); } return maxWidth; @@ -656,7 +656,7 @@ _080725EA:\n\ lsl r2, #24\n\ lsr r2, #24\n\ ldr r1, [sp, #0x4]\n\ - bl DrawDefaultWindow\n\ + bl MenuDrawTextWindow\n\ add r0, r7, #0\n\ add sp, #0xC\n\ pop {r3-r5}\n\ @@ -699,7 +699,7 @@ void sub_8072620(u8 left, u8 top, u8 menuItemCount, u8 *menuItems[][2], u8 colum u8 row = 0; u8 j; for (j = 0; i + j < menuItemCount; j += columnCount, row++) - Print(menuItems[i + j][0], left + gMenu.columnXCoords[i % columnCount], top + 2 * row); + MenuPrint(menuItems[i + j][0], left + gMenu.columnXCoords[i % columnCount], top + 2 * row); } } @@ -761,53 +761,53 @@ u8 sub_807288C(u8 column) return gMenu.columnXCoords[column]; } -void PrintStringArray(u8 left, u8 top, u8 menuItemCount, u8 *menuItems[][2]) +void PrintMenuItems(u8 left, u8 top, u8 menuItemCount, u8 *menuItems[][2]) { u8 i; for (i = 0; i < menuItemCount; i++) - Print(menuItems[i][0], left, top + 2 * i); + MenuPrint(menuItems[i][0], left, top + 2 * i); } -void sub_80728E4(u8 left, u8 top, u8 menuItemCount, u8 *menuItems[][2], u8 *order) +void PrintMenuItemsReordered(u8 left, u8 top, u8 menuItemCount, u8 *menuItems[][2], u8 *order) { u8 i; for (i = 0; i < menuItemCount; i++) - Print(menuItems[order[i]][0], left, top + 2 * i); + MenuPrint(menuItems[order[i]][0], left, top + 2 * i); } -void sub_807292C(u8 left, u8 top, u8 a3) +void InitYesNoMenu(u8 left, u8 top, u8 a3) { - PrintStringArray(left + 1, top + 1, 2, (void *)gUnknown_08376D74); + PrintMenuItems(left + 1, top + 1, 2, (void *)gUnknown_08376D74); InitMenu(0, left + 1, top + 1, 2, 0, a3); } -void sub_8072974(u8 left, u8 top, u32 a3) +void DisplayYesNoMenu(u8 left, u8 top, u32 a3) { - DrawDefaultWindow(left, top, left + 6, top + 5); - sub_807292C(left, top, 5); + MenuDrawTextWindow(left, top, left + 6, top + 5); + InitYesNoMenu(left, top, 5); gMenu.menu_field_7 = a3 ? -1 : 0; } -s8 FillWindowPixelBuffer(void) +s8 ProcessMenuInputNoWrap_(void) { return ProcessMenuInputNoWrap(); } -u8 sub_80729D8(u8 *a1, u8 a2, u16 a3, u8 a4) +u8 sub_80729D8(u8 *text, u8 left, u16 top, u8 a4) { - return sub_8004D04(dword_202E9C8, a1, word_202E9CE, a2, a3, a4); + return sub_8004D04(gMenuWindowPtr, text, gMenuTextTileOffset, left, top, a4); } -u8 sub_8072A18(u8 *a1, u8 a2, u16 a3, u8 a4, u32 a5) +u8 sub_8072A18(u8 *text, u8 left, u16 top, u8 width, u32 a5) { - return sub_8004FD0(dword_202E9C8, 0, a1, word_202E9CE, a2, a3, a4, a5); + return sub_8004FD0(gMenuWindowPtr, 0, text, gMenuTextTileOffset, left, top, width, a5); } -u8 unref_sub_8072A5C(u8 *a1, u8 *a2, u8 a3, u16 a4, u8 a5, u32 a6) +u8 unref_sub_8072A5C(u8 *dest, u8 *src, u8 left, u16 top, u8 width, u32 a6) { - return sub_8004FD0(dword_202E9C8, a1, a2, word_202E9CE, a3, a4, a5, a6); + return sub_8004FD0(gMenuWindowPtr, dest, src, gMenuTextTileOffset, left, top, width, a6); } __attribute__((naked)) @@ -876,7 +876,7 @@ int sub_8072AB0(u8 *str, u8 left, u16 top, u8 width, u8 height, u32 a6) lsl r3, #24\n\ lsr r3, #24\n\ mov r0, r12\n\ - bl sub_8071EBC\n\ + bl MenuFillWindowRectWithBlankTile\n\ _08072B34:\n\ add sp, #0x10\n\ pop {r3,r4}\n\ @@ -890,62 +890,62 @@ _08072B44: .4byte 0x0202e9c8\n\ _08072B48: .4byte 0x0202e9ce\n"); } -void PrintCoinsString(u8 *str, u8 left, u8 top) +void sub_8072B4C(u8 *str, u8 left, u8 top) { - sub_8004D38(dword_202E9C8, str, word_202E9CE, left, top); + sub_8004D38(gMenuWindowPtr, str, gMenuTextTileOffset, left, top); } void sub_8072B80(u8 *a1, u8 a2, u8 a3, u8 *a4) { u8 buffer[64]; - u8 width = GetStringWidth(dword_202E9C8, a4); - AlignString(dword_202E9C8, buffer, a1, width, 1); - sub_8003460(dword_202E9C8, buffer, word_202E9CE, a2, a3); + u8 width = GetStringWidth(gMenuWindowPtr, a4); + AlignString(gMenuWindowPtr, buffer, a1, width, 1); + sub_8003460(gMenuWindowPtr, buffer, gMenuTextTileOffset, a2, a3); } -void Free(u8 *a1, u8 a2, u8 a3, u16 a4) +void sub_8072BD8(u8 *a1, u8 a2, u8 a3, u16 a4) { - sub_8004DB0(dword_202E9C8, a1, word_202E9CE, a2, a3, a4); + sub_8004DB0(gMenuWindowPtr, a1, gMenuTextTileOffset, a2, a3, a4); } u8 *sub_8072C14(u8 *a1, s32 a2, u8 a3, u8 a4) { - return AlignInt1(dword_202E9C8, a1, a2, a3, a4); + return AlignInt1(gMenuWindowPtr, a1, a2, a3, a4); } u8 *sub_8072C44(u8 *a1, s32 a2, u8 a3, u8 a4) { - return AlignInt2(dword_202E9C8, a1, a2, a3, a4); + return AlignInt2(gMenuWindowPtr, a1, a2, a3, a4); } u8 *sub_8072C74(u8 *a1, u8 *a2, u8 a3, u8 a4) { - return AlignString(dword_202E9C8, a1, a2, a3, a4); + return AlignString(gMenuWindowPtr, a1, a2, a3, a4); } u8 sub_8072CA4(u8 *str) { - return GetStringWidth(dword_202E9C8, str); + return GetStringWidth(gMenuWindowPtr, str); } u8 sub_8072CBC() { - return sub_8004E24(dword_202E9C8); + return sub_8004E24(gMenuWindowPtr); } void sub_8072CD4(u8 *a1, u8 *a2, u8 *a3) { - sub_8004E28(dword_202E9C8, a1, a2, a3); + sub_8004E28(gMenuWindowPtr, a1, a2, a3); } u32 sub_8072CF4(u8 a1) { - return sub_80037C8(dword_202E9C8, a1); + return sub_80037C8(gMenuWindowPtr, a1); } struct Window *unref_sub_8072D0C(void) { - return dword_202E9C8; + return gMenuWindowPtr; } void sub_8072D18(u8 a1, u8 a2) |