static void ItemStorageMenuProcessInput(u8 var) { if (gMain.newAndRepeatedKeys & DPAD_UP) { PlaySE(SE_SELECT); Menu_MoveCursor(-1); ItemStorageMenuPrint(gPCText_OptionDescList[Menu_GetCursorPos()]); } else if (gMain.newAndRepeatedKeys & DPAD_DOWN) { PlaySE(SE_SELECT); Menu_MoveCursor(1); ItemStorageMenuPrint(gPCText_OptionDescList[Menu_GetCursorPos()]); } else if (gMain.newKeys & A_BUTTON) { PlaySE(SE_SELECT); gPCText_ItemPCOptionsText[Menu_GetCursorPos()].func(var); } else if (gMain.newKeys & B_BUTTON) { Menu_DestroyCursor(); PlaySE(SE_SELECT); gPCText_ItemPCOptionsText[ITEMPC_MENU_EXIT].func(var); } }
static void PlayerPCProcessMenuInput(u8 taskId) { if (gMain.newAndRepeatedKeys & DPAD_UP) { PlaySE(SE_SELECT); Menu_MoveCursor(-1); } else if (gMain.newAndRepeatedKeys & DPAD_DOWN) { PlaySE(SE_SELECT); Menu_MoveCursor(1); } else if (gMain.newKeys & A_BUTTON) { Menu_DestroyCursor(); PlaySE(SE_SELECT); sPlayerPCMenuActions[gPcItemMenuOptionOrder[Menu_GetCursorPos()]].func(taskId); } else if (gMain.newKeys & B_BUTTON) { Menu_DestroyCursor(); PlaySE(SE_SELECT); sPlayerPCMenuActions[gPcItemMenuOptionsNum[gPcItemMenuOptionOrder - 1]].func(taskId); // run EXIT. } }
static void sub_8089D94(u8 taskID) { if (!gPaletteFade.active) { if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_UP) { PlaySE(SE_SELECT); sPokeMenuCursorPos = Menu_MoveCursor(-1); sub_808B5B4(taskID); } else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_DOWN) { PlaySE(SE_SELECT); sPokeMenuCursorPos = Menu_MoveCursor(1); sub_808B5B4(taskID); } else if (gMain.newKeys & A_BUTTON) { PlaySE(SE_SELECT); sPokemonMenuActions[sPokeMenuOptionsOrder[sPokeMenuCursorPos]].func(taskID); sub_808B5B4(taskID); } else if (gMain.newKeys & B_BUTTON) { PokemonMenu_Cancel(taskID); sub_808B5B4(taskID); } } }
// Mailbox_ProcessInput static void Mailbox_ProcessInput(u8 taskId) { if(!gPaletteFade.active) { if(gMain.newAndRepeatedKeys & DPAD_UP) { if(eMailboxInfo.cursorPos != 0) { PlaySE(SE_SELECT); eMailboxInfo.cursorPos = Menu_MoveCursor(-1); } else if(eMailboxInfo.itemsAbove != 0) { PlaySE(SE_SELECT); eMailboxInfo.itemsAbove--; Mailbox_DrawMailList(taskId); } } else if(gMain.newAndRepeatedKeys & DPAD_DOWN) { if(eMailboxInfo.cursorPos != eMailboxInfo.pageItems - 1) { PlaySE(SE_SELECT); eMailboxInfo.cursorPos = Menu_MoveCursor(1); } else if(eMailboxInfo.itemsAbove + eMailboxInfo.cursorPos != eMailboxInfo.count) { PlaySE(SE_SELECT); eMailboxInfo.itemsAbove++; Mailbox_DrawMailList(taskId); } } else if(gMain.newKeys & A_BUTTON) { Menu_DestroyCursor(); PlaySE(SE_SELECT); if(eMailboxInfo.itemsAbove + eMailboxInfo.cursorPos == eMailboxInfo.count) { Mailbox_TurnOff(taskId); } else { Mailbox_CloseScrollIndicators(); TASK.FUNC = Mailbox_PrintWhatToDoWithPlayerMailText; } } else if(gMain.newKeys & B_BUTTON) { Menu_DestroyCursor(); PlaySE(SE_SELECT); Mailbox_TurnOff(taskId); } } }
// Handle input static void sub_812238C(u8 taskId) { if (!gPaletteFade.active) { if (gMain.newAndRepeatedKeys & 0x40) { if (Menu_GetCursorPos() != 0) { PlaySE(SE_SELECT); Menu_MoveCursor(-1); } return; } if (gMain.newAndRepeatedKeys & 0x80) { if (Menu_GetCursorPos() != 3) { PlaySE(SE_SELECT); Menu_MoveCursor(1); } return; } if (gMain.newKeys & A_BUTTON) { TaskFunc popupMenuFunc; PlaySE(SE_SELECT); popupMenuFunc = PartyMenuGetPopupMenuFunc( gTasks[taskId].data[4], sBattleTowerEntryMenu, sBattleTowerEntryMenuItems, Menu_GetCursorPos()); popupMenuFunc(taskId); return; } if (gMain.newKeys & B_BUTTON) { BattleTowerEntryMenuCallback_Exit(taskId); return; } } }
static void Mailbox_MailOptionsProcessInput(u8 taskId) { if(gMain.newAndRepeatedKeys & DPAD_UP) { PlaySE(SE_SELECT); Menu_MoveCursor(-1); } else if(gMain.newAndRepeatedKeys & DPAD_DOWN) { PlaySE(SE_SELECT); Menu_MoveCursor(1); } else if(gMain.newKeys & A_BUTTON) { PlaySE(SE_SELECT); gMailboxMailOptions[Menu_GetCursorPos()].func(taskId); } else if(gMain.newKeys & B_BUTTON) { PlaySE(SE_SELECT); Mailbox_Cancel(taskId); } }
static void ItemStorage_ProcessInput(u8 taskId) { s16 *data = TASK.data; s16 trueIndex; if (gMain.newAndRepeatedKeys & DPAD_UP) { if(PAGE_INDEX != 0) // did the cursor move physically upwards? { PlaySE(SE_SELECT); PAGE_INDEX = Menu_MoveCursor(-1); trueIndex = ITEMS_ABOVE_TOP + PAGE_INDEX; if (SWITCH_MODE_ACTIVE == FALSE) // are we not currently switching items? { if (trueIndex == NUM_ITEMS) // if the cursor is on top of cancel, print the go back to prev description. { ItemStorage_PrintItemPcResponse(ITEMPC_GO_BACK_TO_PREV); } else { ItemStorage_PrintItemPcResponse(gSaveBlock1.pcItems[trueIndex].itemId); } } } else // the page cursor is at the top. but we may not be at the top of the true index list, so do another check. { if (ITEMS_ABOVE_TOP == 0) // did the cursor not move due to being at the top of the list? return; PlaySE(SE_SELECT); ITEMS_ABOVE_TOP--; ItemStorage_DrawBothListAndDescription(taskId); if (SWITCH_MODE_ACTIVE != FALSE) Menu_MoveCursor(0); // don't move the cursor. it's at the top of the page index, but not the true index. } } else if(gMain.newAndRepeatedKeys & DPAD_DOWN) // _0813A306 { if(PAGE_INDEX != NUM_PAGE_ITEMS - 1) { PlaySE(SE_SELECT); PAGE_INDEX = Menu_MoveCursor(1); trueIndex = ITEMS_ABOVE_TOP + PAGE_INDEX; if(SWITCH_MODE_ACTIVE != FALSE) return; if (trueIndex == NUM_ITEMS) ItemStorage_PrintItemPcResponse(ITEMPC_GO_BACK_TO_PREV); // probably further down else ItemStorage_PrintItemPcResponse(gSaveBlock1.pcItems[trueIndex].itemId); } else if(ITEMS_ABOVE_TOP + PAGE_INDEX != NUM_ITEMS) { PlaySE(SE_SELECT); ITEMS_ABOVE_TOP++; ItemStorage_DrawBothListAndDescription(taskId); if (SWITCH_MODE_ACTIVE != FALSE) Menu_MoveCursor(0); } } else if(gMain.newKeys & SELECT_BUTTON) // _0813A3A0 { if (SWITCH_MODE_ACTIVE == FALSE) { if (PAGE_INDEX + ITEMS_ABOVE_TOP != NUM_ITEMS) // you cannot swap the Cancel button. { PlaySE(SE_SELECT); SWITCH_MODE_ACTIVE = TRUE; SWAP_ITEM_INDEX = ITEMS_ABOVE_TOP + PAGE_INDEX; ItemStorage_PrintItemPcResponse(ITEMPC_SWITCH_WHICH_ITEM); } // _0813A3DC ItemStorage_DrawItemList(taskId); } else // _0813A3E8 { PlaySE(SE_SELECT); ItemStorage_DoItemSwap(taskId, FALSE); ItemStorage_DrawBothListAndDescription(taskId); } } else if(gMain.newKeys & A_BUTTON) { PlaySE(SE_SELECT); if(SWITCH_MODE_ACTIVE == FALSE) { if(ITEMS_ABOVE_TOP + PAGE_INDEX != NUM_ITEMS) { ItemStorage_DoItemAction(taskId); } else { ItemStorage_GoBackToPlayerPCMenu(taskId); } } else { ItemStorage_DoItemSwap(taskId, FALSE); ItemStorage_DrawBothListAndDescription(taskId); } } else if(gMain.newKeys & B_BUTTON) { PlaySE(SE_SELECT); if(SWITCH_MODE_ACTIVE == FALSE) { Menu_DestroyCursor(); ItemStorage_GoBackToPlayerPCMenu(taskId); } else { ItemStorage_DoItemSwap(taskId, TRUE); ItemStorage_DrawBothListAndDescription(taskId); } } }