Changed CheckChosenMOnMatchDesiredSpecies and CheckPartyHasSpecies to callnative

This commit is contained in:
pkmnsnfrn 2024-09-12 20:45:14 -07:00
parent c2db77c4f6
commit ecd435cd84
4 changed files with 25 additions and 21 deletions

View file

@ -2404,13 +2404,14 @@
@ Check if the Player has \speciesId in their party. OPEN_PARTY_SCREEN will have the player select a mon from their party. NO_PARTY_SCREEN will automatically check every mon in the player's party.
.macro checkspecies speciesId:req, mode=NO_PARTY_SCREEN
setvar VAR_0x8005, \speciesId
.if \mode == OPEN_PARTY_SCREEN
special ChoosePartyMon
waitstate
specialvar VAR_RESULT, CheckChosenMonMatchDesiredSpecie
callnative CheckChosenMonMatchDesiredSpecie
.2byte \speciesId
.else
specialvar VAR_RESULT, CheckPartyHasSpecie
callnative CheckPartyHasSpecie
.2byte \speciesId
.endif
.endm

View file

@ -554,6 +554,4 @@ gSpecials::
def_special Script_GetChosenMonDefensiveEVs
def_special Script_GetChosenMonOffensiveIVs
def_special Script_GetChosenMonDefensiveIVs
def_special CheckPartyHasSpecie
def_special CheckChosenMonMatchDesiredSpecie
def_special Script_GetObjectFacingDirection

View file

@ -4278,19 +4278,3 @@ void PreparePartyForSkyBattle(void)
CompactPartySlots();
}
bool32 CheckPartyHasSpecie(void)
{
u32 partyIndex;
for (partyIndex = 0; partyIndex < CalculatePlayerPartyCount(); partyIndex++)
if (GetMonData(&gPlayerParty[partyIndex], MON_DATA_SPECIES) == gSpecialVar_0x8005)
return TRUE;
return FALSE;
}
bool32 CheckChosenMonMatchDesiredSpecie(void)
{
return (GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_SPECIES) == gSpecialVar_0x8005);
}

View file

@ -2539,3 +2539,24 @@ void Script_GetSetPokedexFlag(struct ScriptContext *ctx)
gSpecialVar_Result = GetSetPokedexFlag(speciesId,desiredFlag);
}
void CheckPartyHasSpecie(struct ScriptContext *ctx)
{
u32 partyIndex;
u32 givenSpecies = VarGet(ScriptReadHalfword(ctx));
u32 hasSpecies = FALSE;
for (partyIndex = 0; partyIndex < CalculatePlayerPartyCount(); partyIndex++)
if (GetMonData(&gPlayerParty[partyIndex], MON_DATA_SPECIES) == givenSpecies)
hasSpecies = TRUE;
gSpecialVar_Result = hasSpecies;
}
void CheckChosenMonMatchDesiredSpecie(struct ScriptContext *ctx)
{
u32 givenSpecies = VarGet(ScriptReadHalfword(ctx));
gSpecialVar_Result = (GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_SPECIES) == givenSpecies);
}