diff --git a/asm/rom_8011DC0.s b/asm/rom_8011DC0.s index 64c0210018..af7fdbf3df 100644 --- a/asm/rom_8011DC0.s +++ b/asm/rom_8011DC0.s @@ -731,7 +731,7 @@ _080171DC: _08017228: mov r3, r9 ldrb r0, [r3] - bl ListMenuHandleInputGetItemId + bl ListMenu_ProcessInput mov r8, r0 ldr r0, =gMain ldrh r1, [r0, 0x2E] @@ -847,7 +847,7 @@ _08017314: _0801731C: mov r3, r10 ldrb r0, [r3] - bl ListMenuHandleInputGetItemId + bl ListMenu_ProcessInput adds r1, r0, 0 ldr r0, =gMain ldrh r2, [r0, 0x2E] diff --git a/include/list_menu.h b/include/list_menu.h index 84c38306b6..ef23688d85 100644 --- a/include/list_menu.h +++ b/include/list_menu.h @@ -101,7 +101,7 @@ extern struct ListMenuTemplate gMultiuseListMenuTemplate; s32 DoMysteryGiftListMenu(struct WindowTemplate *windowTemplate, struct ListMenuTemplate *listMenuTemplate, u8 arg2, u16 tileNum, u16 palNum); u8 ListMenuInit(struct ListMenuTemplate *listMenuTemplate, u16 scrollOffset, u16 selectedRow); u8 ListMenuInitInRect(struct ListMenuTemplate *listMenuTemplate, struct ListMenuWindowRect *arg1, u16 scrollOffset, u16 selectedRow); -s32 ListMenuHandleInputGetItemId(u8 listTaskId); +s32 ListMenu_ProcessInput(u8 listTaskId); void DestroyListMenuTask(u8 listTaskId, u16 *scrollOffset, u16 *selectedRow); void RedrawListMenu(u8 listTaskId); void ChangeListMenuPals(u8 listTaskId, u8 cursorPal, u8 fillValue, u8 cursorShadowPal); diff --git a/src/battle_pyramid_bag.c b/src/battle_pyramid_bag.c index 50baf48fd2..9bed2ab438 100644 --- a/src/battle_pyramid_bag.c +++ b/src/battle_pyramid_bag.c @@ -853,7 +853,7 @@ static void Task_HandlePyramidBagInput(u8 taskId) } else { - s32 listId = ListMenuHandleInputGetItemId(data[0]); + s32 listId = ListMenu_ProcessInput(data[0]); ListMenuGetScrollAndRow(data[0], &gPyramidBagCursorData.scrollPosition, &gPyramidBagCursorData.cursorPosition); switch (listId) { @@ -945,9 +945,9 @@ static void HandleFewMenuActionsInput(u8 taskId) s32 id = Menu_ProcessInputNoWrap(); switch (id) { - case -2: + case MENU_NOTHING_CHOSEN: break; - case -1: + case MENU_B_PRESSED: PlaySE(SE_SELECT); sMenuActions[ACTION_CANCEL].func.void_u8(taskId); break; @@ -1285,7 +1285,7 @@ static void Task_ItemSwapHandleInput(u8 taskId) } else { - s32 id = ListMenuHandleInputGetItemId(data[0]); + s32 id = ListMenu_ProcessInput(data[0]); ListMenuGetScrollAndRow(data[0], &gPyramidBagCursorData.scrollPosition, &gPyramidBagCursorData.cursorPosition); sub_81C7028(FALSE); sub_81C704C(gPyramidBagCursorData.cursorPosition); diff --git a/src/daycare.c b/src/daycare.c index 6bdbd987e0..b75fab2924 100644 --- a/src/daycare.c +++ b/src/daycare.c @@ -1244,15 +1244,15 @@ static void DaycarePrintMonInfo(u8 windowId, s32 daycareSlotId, u8 y) static void Task_HandleDaycareLevelMenuInput(u8 taskId) { - u32 var = ListMenuHandleInputGetItemId(gTasks[taskId].tMenuListTaskId); + u32 input = ListMenu_ProcessInput(gTasks[taskId].tMenuListTaskId); if (gMain.newKeys & A_BUTTON) { - switch (var) + switch (input) { case 0: case 1: - gSpecialVar_Result = var; + gSpecialVar_Result = input; break; case 5: gSpecialVar_Result = 2; diff --git a/src/decoration.c b/src/decoration.c index c4c3d61713..5a688704f0 100644 --- a/src/decoration.c +++ b/src/decoration.c @@ -526,14 +526,14 @@ void sub_8126B80(u8 taskId) PlaySE(SE_SELECT); sSecretBasePCMenuActions[sSecretBasePCMenuCursorPos].func.void_u8(taskId); break; - case -2: + case MENU_NOTHING_CHOSEN: sSecretBasePCMenuCursorPos = Menu_GetCursorPos(); if ((s8)menuPos != sSecretBasePCMenuCursorPos) { sub_8126C08(); } break; - case -1: + case MENU_B_PRESSED: PlaySE(SE_SELECT); SecretBasePC_Cancel(taskId); break; @@ -713,12 +713,12 @@ void sub_8127088(u8 taskId) input = Menu_ProcessInput(); switch (input) { - case -1: + case MENU_B_PRESSED: case 8: PlaySE(SE_SELECT); sub_812719C(taskId); break; - case -2: + case MENU_NOTHING_CHOSEN: break; default: PlaySE(SE_SELECT); @@ -933,13 +933,13 @@ void sub_812764C(u8 taskId) data = gTasks[taskId].data; if (!gPaletteFade.active) { - input = ListMenuHandleInputGetItemId(data[13]); + input = ListMenu_ProcessInput(data[13]); ListMenuGetScrollAndRow(data[13], &sSecretBasePCSelectDecorPageNo, &sSecretBasePCSelectDecorLineNo); switch (input) { - case -1: + case LIST_NOTHING_CHOSEN: break; - case -2: + case LIST_B_PRESSED: PlaySE(SE_SELECT); SecretBasePC_SelectedDecorActions[data[11]][1](taskId); break; diff --git a/src/field_specials.c b/src/field_specials.c index 0dc1bf18b1..f2ebf2b8e2 100644 --- a/src/field_specials.c +++ b/src/field_specials.c @@ -2603,9 +2603,9 @@ static void sub_813A46C(s32 itemIndex, bool8 onInit, struct ListMenu *list) static void sub_813A4EC(u8 taskId) { struct Task *task = &gTasks[taskId]; - s32 itemId = ListMenuHandleInputGetItemId(task->data[14]); + s32 input = ListMenu_ProcessInput(task->data[14]); - switch (itemId) + switch (input) { case LIST_NOTHING_CHOSEN: break; @@ -2615,13 +2615,13 @@ static void sub_813A4EC(u8 taskId) sub_813A570(taskId); break; default: - gSpecialVar_Result = itemId; + gSpecialVar_Result = input; PlaySE(SE_SELECT); if (!task->data[6]) { sub_813A570(taskId); } - else if (itemId == task->data[1] - 1) + else if (input == task->data[1] - 1) { sub_813A570(taskId); } diff --git a/src/item_menu.c b/src/item_menu.c index a220f02efc..24a50aa9a0 100755 --- a/src/item_menu.c +++ b/src/item_menu.c @@ -1102,7 +1102,7 @@ void Task_BagMenu(u8 taskId) } else { - int listPosition = ListMenuHandleInputGetItemId(data[0]); + int listPosition = ListMenu_ProcessInput(data[0]); ListMenuGetScrollAndRow(data[0], scrollPos, cursorPos); switch (listPosition) { @@ -1304,7 +1304,7 @@ void bag_menu_swap_items(u8 taskId) void sub_81AC3C0(u8 taskId) { s16* data = gTasks[taskId].data; - int r7; + int input; if (sub_81221EC() != TRUE) { @@ -1316,15 +1316,15 @@ void sub_81AC3C0(u8 taskId) } else { - r7 = ListMenuHandleInputGetItemId(data[0]); + input = ListMenu_ProcessInput(data[0]); ListMenuGetScrollAndRow(data[0], &gUnknown_0203CE58.scrollPosition[gUnknown_0203CE58.pocket], &gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket]); sub_80D4FC8(0); sub_80D4FEC(gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket]); - switch (r7) + switch (input) { - case -1: + case LIST_NOTHING_CHOSEN: break; - case -2: + case LIST_B_PRESSED: PlaySE(SE_SELECT); if (gMain.newKeys & A_BUTTON) sub_81AC498(taskId); @@ -1546,9 +1546,9 @@ void Task_HandleInBattleItemMenuInput(u8 taskId) s8 r4 = Menu_ProcessInputNoWrap(); switch (r4) { - case -2: + case MENU_NOTHING_CHOSEN: break; - case -1: + case MENU_B_PRESSED: PlaySE(SE_SELECT); gUnknown_08613FB4[4].func.void_u8(taskId); break; diff --git a/src/learn_move.c b/src/learn_move.c index 4db83861e9..7a6916013a 100644 --- a/src/learn_move.c +++ b/src/learn_move.c @@ -638,7 +638,7 @@ static void HideSpritesAndPrintTeachText(bool8 a) static void HandleInput(bool8 showContest) { - s32 itemId = ListMenuHandleInputGetItemId(sLearnMoveStruct->listMenuTask); + s32 itemId = ListMenu_ProcessInput(sLearnMoveStruct->listMenuTask); ListMenuGetScrollAndRow(sLearnMoveStruct->listMenuTask, &sLearnMoveStruct2.listOffset, &sLearnMoveStruct2.listRow); switch (itemId) diff --git a/src/list_menu.c b/src/list_menu.c index 2476fae265..7a95476614 100644 --- a/src/list_menu.c +++ b/src/list_menu.c @@ -334,7 +334,7 @@ s32 DoMysteryGiftListMenu(struct WindowTemplate *windowTemplate, struct ListMenu sMysteryGiftLinkMenu.state = 1; break; case 1: - sMysteryGiftLinkMenu.currItemId = ListMenuHandleInputGetItemId(sMysteryGiftLinkMenu.listTaskId); + sMysteryGiftLinkMenu.currItemId = ListMenu_ProcessInput(sMysteryGiftLinkMenu.listTaskId); if (gMain.newKeys & A_BUTTON) { sMysteryGiftLinkMenu.state = 2; @@ -406,7 +406,7 @@ u8 ListMenuInitInRect(struct ListMenuTemplate *listMenuTemplate, struct ListMenu return taskId; } -s32 ListMenuHandleInputGetItemId(u8 listTaskId) +s32 ListMenu_ProcessInput(u8 listTaskId) { struct ListMenu *list = (void*) gTasks[listTaskId].data; diff --git a/src/mauville_old_man.c b/src/mauville_old_man.c index 1b4a252179..fd8e74c0a7 100644 --- a/src/mauville_old_man.c +++ b/src/mauville_old_man.c @@ -1182,9 +1182,9 @@ static void Task_StoryListMenu(u8 taskId) // Task_StoryListMenu break; case 1: selection = Menu_ProcessInput(); - if (selection == -2) + if (selection == MENU_NOTHING_CHOSEN) break; - if (selection == -1 || selection == GetFreeStorySlot()) + if (selection == MENU_B_PRESSED || selection == GetFreeStorySlot()) { gSpecialVar_Result = 0; } diff --git a/src/player_pc.c b/src/player_pc.c index 474cecaf53..0d08a5e7b2 100644 --- a/src/player_pc.c +++ b/src/player_pc.c @@ -355,11 +355,11 @@ static void PlayerPCProcessMenuInput(u8 taskId) else inputOptionId = Menu_ProcessInputNoWrap(); - switch(inputOptionId) + switch (inputOptionId) { - case -2: + case MENU_NOTHING_CHOSEN: break; - case -1: + case MENU_B_PRESSED: PlaySE(SE_SELECT); sub_8198070(data[4], FALSE); ClearWindowTilemap(data[4]); @@ -464,13 +464,13 @@ static void ItemStorageMenuProcessInput(u8 taskId) r5 = Menu_GetCursorPos(); inputOptionId = Menu_ProcessInput(); r2 = Menu_GetCursorPos(); - switch(inputOptionId) + switch (inputOptionId) { - case -2: + case MENU_NOTHING_CHOSEN: if (r5 != r2) ItemStorageMenuPrint(gPCText_OptionDescList[r2]); break; - case -1: + case MENU_B_PRESSED: PlaySE(SE_SELECT); ItemStorage_Exit(taskId); break; @@ -638,14 +638,14 @@ static void Mailbox_ProcessInput(u8 taskId) if (!gPaletteFade.active) { - inputOptionId = ListMenuHandleInputGetItemId(data[5]); + inputOptionId = ListMenu_ProcessInput(data[5]); ListMenuGetScrollAndRow(data[5], &(playerPCItemPageInfo.itemsAbove), &(playerPCItemPageInfo.cursorPos)); - switch(inputOptionId) + switch (inputOptionId) { - case -1: + case LIST_NOTHING_CHOSEN: break; - case -2: + case LIST_B_PRESSED: PlaySE(SE_SELECT); RemoveScrollIndicatorArrowPair(playerPCItemPageInfo.scrollIndicatorId); Mailbox_ReturnToPlayerPC(taskId); @@ -1145,13 +1145,13 @@ static void ItemStorage_ProcessInput(u8 taskId) } else { - id = ListMenuHandleInputGetItemId(data[5]); + id = ListMenu_ProcessInput(data[5]); ListMenuGetScrollAndRow(data[5], &(playerPCItemPageInfo.itemsAbove), &(playerPCItemPageInfo.cursorPos)); switch(id) { - case -1: + case LIST_NOTHING_CHOSEN: break; - case -2: + case LIST_B_PRESSED: PlaySE(SE_SELECT); ItemStorage_GoBackToPlayerPCMenu(taskId); break; @@ -1218,21 +1218,23 @@ static void sub_816C4FC(u8 taskId) ItemStorage_DoItemSwap(taskId, FALSE); return; } - id = ListMenuHandleInputGetItemId(data[5]); + id = ListMenu_ProcessInput(data[5]); ListMenuGetScrollAndRow(data[5], &(playerPCItemPageInfo.itemsAbove), &(playerPCItemPageInfo.cursorPos)); sub_81223FC(gUnknown_0203BCC4->spriteIds, 7, 0); sub_816C690(playerPCItemPageInfo.cursorPos); switch(id) { - case -1: + case LIST_NOTHING_CHOSEN: break; - case -2: + case LIST_B_PRESSED: if (gMain.newKeys & A_BUTTON) { ItemStorage_DoItemSwap(taskId, FALSE); } else + { ItemStorage_DoItemSwap(taskId, TRUE); + } break; default: ItemStorage_DoItemSwap(taskId, FALSE); diff --git a/src/pokeblock.c b/src/pokeblock.c index 7c07f96559..3fd4f34df4 100644 --- a/src/pokeblock.c +++ b/src/pokeblock.c @@ -998,7 +998,7 @@ static void Task_HandlePokeblockMenuInput(u8 taskId) else { u16 oldPosition = sSavedPokeblockData.lastItemPos; - s32 itemId = ListMenuHandleInputGetItemId(data[0]); + s32 itemId = ListMenu_ProcessInput(data[0]); ListMenuGetScrollAndRow(data[0], &sSavedPokeblockData.lastItemPage, &sSavedPokeblockData.lastItemPos); if (oldPosition != sSavedPokeblockData.lastItemPos) @@ -1044,7 +1044,7 @@ static void Task_HandlePokeblocksSwapInput(u8 taskId) { u16 i = sSavedPokeblockData.lastItemPage; u16 var = sSavedPokeblockData.lastItemPos; - s32 itemId = ListMenuHandleInputGetItemId(data[0]); + s32 itemId = ListMenu_ProcessInput(data[0]); ListMenuGetScrollAndRow(data[0], &sSavedPokeblockData.lastItemPage, &sSavedPokeblockData.lastItemPos); if (i != sSavedPokeblockData.lastItemPage || var != sSavedPokeblockData.lastItemPos) diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index 78fec2fc5f..c0aec4dddd 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -1753,7 +1753,7 @@ static void Task_PokemonStorageSystemPC(u8 taskId) task->data[2] = Menu_ProcessInput(); switch(task->data[2]) { - case -2: + case MENU_NOTHING_CHOSEN: task->data[3] = task->data[1]; if (gMain.newKeys & DPAD_UP && --task->data[3] < 0) task->data[3] = 4; @@ -1767,7 +1767,7 @@ static void Task_PokemonStorageSystemPC(u8 taskId) AddTextPrinterParameterized2(0, 1, gUnknown_085716C0[task->data[1]].desc, 0, NULL, 2, 1, 3); } break; - case -1: + case MENU_B_PRESSED: case 4: sub_819746C(task->data[15], TRUE); ScriptContext2_Disable(); diff --git a/src/rom_8011DC0.c b/src/rom_8011DC0.c index 3b679e1d98..9bdd861674 100644 --- a/src/rom_8011DC0.c +++ b/src/rom_8011DC0.c @@ -1103,7 +1103,7 @@ void sub_80134E8(u8 taskId) RedrawListMenu(data->listTaskId); break; case 0: - id = ListMenuHandleInputGetItemId(data->listTaskId); + id = ListMenu_ProcessInput(data->listTaskId); if (gMain.newKeys & A_BUTTON && id != -1) { // this unused variable along with the assignment is needed to match @@ -2174,7 +2174,7 @@ void sub_8014F48(u8 taskId) RedrawListMenu(data->listTaskId); break; case 0: - id = ListMenuHandleInputGetItemId(data->listTaskId); + id = ListMenu_ProcessInput(data->listTaskId); if (gMain.newKeys & A_BUTTON && id != -1) { // this unused variable along with the assignment is needed to match @@ -2338,7 +2338,7 @@ void sub_80152F4(u8 taskId) break; case 0: if (data->field_13 != 0) - id = ListMenuHandleInputGetItemId(data->listTaskId); + id = ListMenu_ProcessInput(data->listTaskId); if (data->field_14 > 120) { if (data->field_0->arr[0].field_1A_0 == 1 && !data->field_0->arr[0].unk.field_0.unk_0a_7) diff --git a/src/script_menu.c b/src/script_menu.c index a4f4c6086c..7180bfc607 100644 --- a/src/script_menu.c +++ b/src/script_menu.c @@ -1170,9 +1170,9 @@ static void Task_HandleMultichoiceInput(u8 taskId) sub_80E2A94(tMultichoiceId); } - if (selection != -2) + if (selection != MENU_NOTHING_CHOSEN) { - if (selection == -1) + if (selection == MENU_B_PRESSED) { if (tIgnoreBPress) return; diff --git a/src/secret_base.c b/src/secret_base.c index de5fae0777..adcab9cbc3 100644 --- a/src/secret_base.c +++ b/src/secret_base.c @@ -953,13 +953,13 @@ void sub_80E9E90(u8 taskId) s32 input; data = gTasks[taskId].data; - input = ListMenuHandleInputGetItemId(data[5]); + input = ListMenu_ProcessInput(data[5]); ListMenuGetScrollAndRow(data[5], &data[2], &data[1]); switch (input) { - case -1: + case LIST_NOTHING_CHOSEN: break; - case -2: + case LIST_B_PRESSED: PlaySE(SE_SELECT); DestroyListMenuTask(data[5], NULL, NULL); RemoveScrollIndicatorArrowPair(data[8]); @@ -1002,11 +1002,11 @@ void sub_80E9FB0(u8 taskId) input = Menu_ProcessInputNoWrap(); switch (input) { - case -1: + case MENU_B_PRESSED: PlaySE(SE_SELECT); sub_80EA18C(taskId); break; - case -2: + case MENU_NOTHING_CHOSEN: break; default: PlaySE(SE_SELECT); diff --git a/src/shop.c b/src/shop.c index c44cbca12e..8eefd5e97f 100755 --- a/src/shop.c +++ b/src/shop.c @@ -328,9 +328,9 @@ static void Task_ShopMenu(u8 taskId) s8 inputCode = Menu_ProcessInputNoWrap(); switch (inputCode) { - case LIST_B_PRESSED: + case MENU_NOTHING_CHOSEN: break; - case LIST_NOTHING_CHOSEN: + case MENU_B_PRESSED: PlaySE(SE_SELECT); Task_HandleShopMenuQuit(taskId); break; @@ -911,7 +911,7 @@ static void Task_BuyMenu(u8 taskId) if (!gPaletteFade.active) { - s32 itemId = ListMenuHandleInputGetItemId(tListTaskId); + s32 itemId = ListMenu_ProcessInput(tListTaskId); ListMenuGetScrollAndRow(tListTaskId, &gShopDataPtr->scrollOffset, &gShopDataPtr->selectedRow); switch (itemId) diff --git a/src/trader.c b/src/trader.c index e23efb4ce5..b5c159fb96 100644 --- a/src/trader.c +++ b/src/trader.c @@ -113,9 +113,9 @@ void Task_HandleGetDecorationMenuInput(u8 taskId) switch (input) { - case -2: + case MENU_NOTHING_CHOSEN: break; - case -1: + case MENU_B_PRESSED: case 4: PlaySE(SE_SELECT); sub_8133BE4(taskId, 0);