diff --git a/src/party_menu.c b/src/party_menu.c index 39e6b4fe8..b99fff1fb 100755 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -1273,6 +1273,9 @@ void Task_HandleChooseMonInput(u8 taskId) case B_BUTTON: // Selected Cancel / pressed B HandleChooseMonCancel(taskId, slotPtr); break; + case SELECT_BUTTON: // Quick Swap + DestroyTask(taskId); + break; case START_BUTTON: if (sPartyMenuInternal->chooseHalf) { @@ -1474,6 +1477,22 @@ static void Task_HandleCancelChooseMonYesNoInput(u8 taskId) } } +static bool8 IsInvalidPartyMenuActionType(u8 partyMenuType) +{ + return (partyMenuType == PARTY_ACTION_SEND_OUT + || partyMenuType == PARTY_ACTION_CANT_SWITCH + || partyMenuType == PARTY_ACTION_USE_ITEM + || partyMenuType == PARTY_ACTION_ABILITY_PREVENTS + || partyMenuType == PARTY_ACTION_GIVE_ITEM + || partyMenuType == PARTY_ACTION_GIVE_PC_ITEM + || partyMenuType == PARTY_ACTION_GIVE_MAILBOX_MAIL + || partyMenuType == PARTY_ACTION_SOFTBOILED + || partyMenuType == PARTY_ACTION_CHOOSE_AND_CLOSE + || partyMenuType == PARTY_ACTION_MOVE_TUTOR + || partyMenuType == PARTY_ACTION_MINIGAME + || partyMenuType == PARTY_ACTION_REUSABLE_ITEM); +} + static u16 PartyMenuButtonHandler(s8 *slotPtr) { s8 movementDir; @@ -1510,7 +1529,19 @@ static u16 PartyMenuButtonHandler(s8 *slotPtr) if (JOY_NEW(START_BUTTON)) return START_BUTTON; - + if (JOY_NEW(SELECT_BUTTON) && CalculatePlayerPartyCount() >= 2 && !IsInvalidPartyMenuActionType(gPartyMenu.action)) + { + if (gPartyMenu.menuType != PARTY_MENU_TYPE_FIELD) + return 0; + if (*slotPtr == PARTY_SIZE + 1) + return 0; + if (gPartyMenu.action != PARTY_ACTION_SWITCH) + { + CreateTask(CursorCb_Switch, 1); + return SELECT_BUTTON; + } + return A_BUTTON; // Select is allowed to act as the A Button while CursorCb_Switch is active. + } if (movementDir) { UpdateCurrentPartySelection(slotPtr, movementDir);