Improved checkspecies functions
This commit is contained in:
parent
abb17ea88b
commit
f0d5b68f70
3 changed files with 28 additions and 16 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue