Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Chooseboxmon special #5428

Open
wants to merge 4 commits into
base: upcoming
Choose a base branch
from
Open

Conversation

Artrios
Copy link

@Artrios Artrios commented Sep 23, 2024

Description

Adds a ChooseBoxMon special that can be used instead of ChoosePartyMon to select a Pokemon. This only provides functionality for ChooseBoxMon and does not modify any other functions to handle the results.

ChooseBoxMon returns the species selected in VAR_RESULT (for NPCs that ask to see specific Pokemon) and the Pc box cursor position/party slot id in VAR_0x8004 (as ChoosePartyMon uses that var for the party slot id).

The BoxMon data can be found by using these 3 functions

  • GetInPartyMenu which returns 1 if the Pokemon selected is in the party, 0 otherwise
  • GetSavedCursorPos returns either the party slot id of the slot id in the box
  • StorageGetCurrentBox returns the box id
    You can then use either &gPlayerParty[slotId] or &gPokemonStoragePtr->boxes[boxId][slotId] to get the Pokemon's data.

See this commit for an example of how to use this for the daycare.

Images

ChooseBoxMon

Discord contact info

paccy.

@hedara90 hedara90 added the new-feature Adds a feature label Sep 23, 2024
Copy link
Collaborator

@Bassoonian Bassoonian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simple code review, haven't tested this in practice yet

src/pokemon_storage_system.c Outdated Show resolved Hide resolved
@@ -6197,7 +6221,7 @@ static void SaveCursorPos(void)
sSavedCursorPosition = sCursorPosition;
}

static u8 GetSavedCursorPos(void)
u8 GetSavedCursorPos(void)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the point of this no longer being static if it isn't used outside of this file?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, this can be changed back to static. I was calling this in other files before I set the cursor position to gSpecialVar_0x8004

src/pokemon_storage_system.c Outdated Show resolved Hide resolved
src/pokemon_storage_system.c Outdated Show resolved Hide resolved
src/pokemon_storage_system.c Outdated Show resolved Hide resolved
src/pokemon_storage_system.c Outdated Show resolved Hide resolved
@@ -10210,3 +10247,14 @@ void UpdateSpeciesSpritePSS(struct BoxPokemon *boxMon)
}
sJustOpenedBag = FALSE;
}

u8 GetInPartyMenu(void)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is unused

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made it for determining if the pokemon was in the party or not from other files after the pokemon had been selected. Not sure if there was another way to determine this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-feature Adds a feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants