Improved dex flags functions

This commit is contained in:
pkmnsnfrn 2024-08-11 21:01:31 -07:00
parent ebae09f0a6
commit abb17ea88b
3 changed files with 19 additions and 28 deletions

View file

@ -2348,27 +2348,31 @@
@ Checks the state of the Pokédex Seen flag of the specified Pokemon
@ The result is stored in VAR_RESULT
.macro getseenmon species:req
setvar VAR_TEMP_1, \species
specialvar VAR_RESULT, GetSeenMon
setvar VAR_0x8005, \species
setvar VAR_0x8006, 0
specialvar VAR_RESULT, Script_GetSetPokedexFlag
.endm
@ Checks the state of the Pokédex Caught flag of the specified Pokemon
@ The result is stored in VAR_RESULT
.macro getcaughtmon species:req
setvar VAR_TEMP_1, \species
specialvar VAR_RESULT, GetCaughtMon
setvar VAR_0x8005, \species
setvar VAR_0x8006, 1
specialvar VAR_RESULT, Script_GetSetPokedexFlag
.endm
@ Sets the Pokédex Seen flag of the specified Pokemon
.macro setseenmon species:req
setvar VAR_TEMP_1, \species
special SetSeenMon
setvar VAR_0x8005, \species
setvar VAR_0x8006, 2
specialvar VAR_RESULT, Script_GetSetPokedexFlag
.endm
@ Sets the Pokédex Caught flag of the specified Pokemon
.macro setcaughtmon species:req
setvar VAR_TEMP_1, \species
special SetCaughtMon
setvar VAR_0x8005, \species
setvar VAR_0x8006, 3
specialvar VAR_RESULT, Script_GetSetPokedexFlag
.endm
@ Changes the caught ball of a selected Pokémon

View file

@ -556,10 +556,7 @@ gSpecials::
def_special Script_GetChosenMonDefensiveIVs
def_special GetObjectPosition
def_special CheckObjectAtXY
def_special GetSeenMon
def_special GetCaughtMon
def_special SetSeenMon
def_special SetCaughtMon
def_special Script_GetSetPokedexFlag
def_special SetMonBall
def_special CheckPartyForMon
def_special Script_GetObjectFacingDirection

View file

@ -4312,25 +4312,15 @@ bool32 CheckObjectAtXY(void)
return TRUE;
}
bool8 GetSeenMon(void)
bool32 Script_GetSetPokedexFlag(void)
{
return GetSetPokedexFlag(SpeciesToNationalPokedexNum(VarGet(VAR_TEMP_1)), FLAG_GET_SEEN);
}
u32 speciesId = SpeciesToNationalPokedexNum(gSpecialVar_0x8005);
bool32 desiredFlag = gSpecialVar_0x8006;
bool8 GetCaughtMon(void)
{
return GetSetPokedexFlag(SpeciesToNationalPokedexNum(VarGet(VAR_TEMP_1)), FLAG_GET_CAUGHT);
}
if (desiredFlag == FLAG_SET_CAUGHT)
GetSetPokedexFlag(speciesId,FLAG_SET_SEEN);
void SetSeenMon(void)
{
GetSetPokedexFlag(SpeciesToNationalPokedexNum(VarGet(VAR_TEMP_1)), FLAG_SET_SEEN);
}
void SetCaughtMon(void)
{
GetSetPokedexFlag(SpeciesToNationalPokedexNum(VarGet(VAR_TEMP_1)), FLAG_SET_SEEN);
GetSetPokedexFlag(SpeciesToNationalPokedexNum(VarGet(VAR_TEMP_1)), FLAG_SET_CAUGHT);
return GetSetPokedexFlag(speciesId,desiredFlag);
}
void SetMonBall(void)