Allow Party Menu with 0 Pokemon (#5997)

This commit is contained in:
DizzyEggg 2025-01-11 12:14:31 +01:00 committed by GitHub
parent 8821779815
commit f15d89893e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 10 additions and 2 deletions

View File

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

View File

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

View File

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