Fix Menu and List Menu input defines

This commit is contained in:
DizzyEggg 2019-02-02 11:04:38 +01:00
parent 9d8a43a1fb
commit 23b240ab65
18 changed files with 72 additions and 70 deletions

View File

@ -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]

View File

@ -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);

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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);
}

View File

@ -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;

View File

@ -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)

View File

@ -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;

View File

@ -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;
}

View File

@ -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);
{
ItemStorage_DoItemSwap(taskId, TRUE);
}
break;
default:
ItemStorage_DoItemSwap(taskId, FALSE);

View File

@ -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)

View File

@ -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();

View File

@ -1105,7 +1105,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
@ -2176,7 +2176,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
@ -2340,7 +2340,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)

View File

@ -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;

View File

@ -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);

View File

@ -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)

View File

@ -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);