From ecd435cd84be9b986f60d00655b96b2b2c2d93bc Mon Sep 17 00:00:00 2001 From: pkmnsnfrn Date: Thu, 12 Sep 2024 20:45:14 -0700 Subject: [PATCH] Changed CheckChosenMOnMatchDesiredSpecies and CheckPartyHasSpecies to callnative --- asm/macros/event.inc | 7 ++++--- data/specials.inc | 2 -- src/field_specials.c | 16 ---------------- src/scrcmd.c | 21 +++++++++++++++++++++ 4 files changed, 25 insertions(+), 21 deletions(-) diff --git a/asm/macros/event.inc b/asm/macros/event.inc index b826b4c556..67b5e9b634 100644 --- a/asm/macros/event.inc +++ b/asm/macros/event.inc @@ -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 diff --git a/data/specials.inc b/data/specials.inc index e6a8860096..8233deda59 100644 --- a/data/specials.inc +++ b/data/specials.inc @@ -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 diff --git a/src/field_specials.c b/src/field_specials.c index 57bd0158a6..982d7a2924 100644 --- a/src/field_specials.c +++ b/src/field_specials.c @@ -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); -} - diff --git a/src/scrcmd.c b/src/scrcmd.c index f087d2d290..345d3b8bef 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -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); +} + +