mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 11:37:40 +01:00
Added quick party swap
This commit is contained in:
parent
5af3affc59
commit
c743e2b7ad
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user