Skip to content

Commit

Permalink
Allow Party Menu with 0 Pokemon (#5997)
Browse files Browse the repository at this point in the history
  • Loading branch information
DizzyEggg authored Jan 11, 2025
1 parent 8821779 commit f15d898
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions include/constants/party_menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
#define PARTY_MSG_ALREADY_HOLDING_ONE 26
#define PARTY_MSG_WHICH_APPLIANCE 27
#define PARTY_MSG_CHOOSE_SECOND_FUSION 28
#define PARTY_MSG_NO_POKEMON 29
#define PARTY_MSG_NONE 127

// IDs for DisplayPartyPokemonDescriptionText, to display a message in the party pokemon's box
Expand Down
1 change: 1 addition & 0 deletions src/data/party_menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,7 @@ static const u8 *const sActionStringTable[] =
[PARTY_MSG_ALREADY_HOLDING_ONE] = gText_AlreadyHoldingOne,
[PARTY_MSG_WHICH_APPLIANCE] = gText_WhichAppliance,
[PARTY_MSG_CHOOSE_SECOND_FUSION] = gText_NextFusionMon,
[PARTY_MSG_NO_POKEMON] = COMPOUND_STRING("You have no POKéMON."),
};

static const u8 *const sDescriptionStringTable[] =
Expand Down
10 changes: 8 additions & 2 deletions src/party_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,9 @@ static void InitPartyMenu(u8 menuType, u8 layout, u8 partyAction, bool8 keepCurs
else if (gPartyMenu.slotId > PARTY_SIZE - 1 || GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_SPECIES) == SPECIES_NONE)
gPartyMenu.slotId = 0;

if (gPlayerPartyCount == 0)
gPartyMenu.slotId = PARTY_SIZE + 1; // Cancel

gTextFlags.autoScroll = 0;
CalculatePlayerPartyCount();
SetMainCallback2(CB2_InitPartyMenu);
Expand Down Expand Up @@ -982,7 +985,7 @@ static void RenderPartyMenuBox(u8 slot)
PutWindowTilemap(sPartyMenuBoxes[slot].windowId);
ScheduleBgCopyTilemapToVram(2);
}
else
else if (gPlayerPartyCount != 0)
{
if (GetMonData(&gPlayerParty[slot], MON_DATA_SPECIES) == SPECIES_NONE)
{
Expand Down Expand Up @@ -1656,7 +1659,7 @@ static u16 PartyMenuButtonHandler(s8 *slotPtr)
if (JOY_NEW(START_BUTTON))
return START_BUTTON;

if (movementDir)
if (movementDir && gPlayerPartyCount != 0)
{
UpdateCurrentPartySelection(slotPtr, movementDir);
return 0;
Expand Down Expand Up @@ -2667,6 +2670,9 @@ void DisplayPartyMenuStdMessage(u32 stringId)
stringId = PARTY_MSG_CHOOSE_MON_AND_CONFIRM;
else if (!ShouldUseChooseMonText())
stringId = PARTY_MSG_CHOOSE_MON_OR_CANCEL;

if (gPlayerPartyCount == 0)
stringId = PARTY_MSG_NO_POKEMON;
}
DrawStdFrameWithCustomTileAndPalette(*windowPtr, FALSE, 0x4F, 13);
StringExpandPlaceholders(gStringVar4, sActionStringTable[stringId]);
Expand Down

0 comments on commit f15d898

Please sign in to comment.