diff --git a/asm/macros/event.inc b/asm/macros/event.inc index c4bbda645f..399ad6104f 100644 --- a/asm/macros/event.inc +++ b/asm/macros/event.inc @@ -2379,7 +2379,7 @@ .macro setmonball ballId:req special ChoosePartyMon waitstate - setvar VAR_TEMP_1, \ballId + setvar VAR_0x8005, \ballId special SetMonBall .endm @@ -2387,19 +2387,25 @@ NO_PARTY_SCREEN = TRUE @ Check if the Player has \speciesId in their party. - .macro checkforspecies speciesId:req, silent:req, script:req - .if \silent == OPEN_PARTY_SCREEN + .macro checkspecies speciesId:req, mode:req + setvar VAR_0x8005, \speciesId + .if \mode == OPEN_PARTY_SCREEN special ChoosePartyMon waitstate - specialvar VAR_RESULT, ScriptGetPartyMonSpecies - goto_if_eq VAR_RESULT, \speciesId, \script + specialvar VAR_RESULT, CheckChosenMonMatchDesiredSpecie .else - setvar VAR_TEMP_1, \speciesId - specialvar VAR_RESULT, CheckPartyForMon - goto_if_eq VAR_RESULT, TRUE, \script + specialvar VAR_RESULT, CheckPartyHasSpecie .endif .endm + .macro checkspecies_choose speciesId:req + checkspecies \speciesId, OPEN_PARTY_SCREEN + .endm + + .macro checkspecies_auto speciesId:req + checkspecies \speciesId, NO_PARTY_SCREEN + .endm + @ Gets the facing direction of a given event object and stores it in the variable \dest. .macro getobjectfacingdirection evObjId:req, dest:req setvar VAR_TEMP_1, \evObjId diff --git a/data/specials.inc b/data/specials.inc index 7b391cc968..ed88d42eae 100644 --- a/data/specials.inc +++ b/data/specials.inc @@ -558,5 +558,6 @@ gSpecials:: def_special CheckObjectAtXY def_special Script_GetSetPokedexFlag def_special SetMonBall - def_special CheckPartyForMon + def_special CheckPartyHasSpecie + def_special CheckChosenMonMatchDesiredSpecie def_special Script_GetObjectFacingDirection diff --git a/src/field_specials.c b/src/field_specials.c index a161ba3c44..e58d861f54 100644 --- a/src/field_specials.c +++ b/src/field_specials.c @@ -4325,18 +4325,23 @@ bool32 Script_GetSetPokedexFlag(void) void SetMonBall(void) { - u16 ballId = VarGet(VAR_TEMP_1); + u32 ballId = gSpecialVar_0x8005; SetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_POKEBALL, &ballId); } -bool8 CheckPartyForMon(void) +bool32 CheckPartyHasSpecie(void) { - int i; - for (i = 0; i < CalculatePlayerPartyCount(); i++) - { - if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES) == VarGet(VAR_TEMP_1)) + 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); +} +