Changed CheckObjectAtXY to callnative
This commit is contained in:
parent
10bb349b8c
commit
be7938f322
4 changed files with 29 additions and 29 deletions
|
@ -2365,10 +2365,11 @@
|
|||
.endm
|
||||
|
||||
@ checks if there is any object at a given position
|
||||
.macro checkobjectat x:req, y:req
|
||||
setorcopyvar VAR_0x8005, \x
|
||||
setorcopyvar VAR_0x8006, \y
|
||||
specialvar VAR_RESULT, CheckObjectAtXY
|
||||
.macro checkobjectat x:req, y:req, dest = VAR_RESULT
|
||||
callnative CheckObjectAtXY
|
||||
.2byte \x
|
||||
.2byte \y
|
||||
.2byte \dest
|
||||
.endm
|
||||
|
||||
@ Checks the state of the Pokédex Seen flag of the specified Pokemon
|
||||
|
|
|
@ -554,7 +554,6 @@ gSpecials::
|
|||
def_special Script_GetChosenMonDefensiveEVs
|
||||
def_special Script_GetChosenMonOffensiveIVs
|
||||
def_special Script_GetChosenMonDefensiveIVs
|
||||
def_special CheckObjectAtXY
|
||||
def_special Script_GetSetPokedexFlag
|
||||
def_special CheckPartyHasSpecie
|
||||
def_special CheckChosenMonMatchDesiredSpecie
|
||||
|
|
|
@ -4278,27 +4278,6 @@ void PreparePartyForSkyBattle(void)
|
|||
CompactPartySlots();
|
||||
}
|
||||
|
||||
bool32 CheckObjectAtXY(void)
|
||||
{
|
||||
u32 x = gSpecialVar_0x8005 + 7;
|
||||
u32 y = gSpecialVar_0x8006 + 7;
|
||||
u32 i;
|
||||
|
||||
for (i = 0; i < OBJECT_EVENTS_COUNT; i++)
|
||||
{
|
||||
if (!gObjectEvents[i].active)
|
||||
continue;
|
||||
|
||||
if (gObjectEvents[i].currentCoords.x != x)
|
||||
continue;
|
||||
|
||||
if (gObjectEvents[i].currentCoords.y != y)
|
||||
continue;
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool32 Script_GetSetPokedexFlag(void)
|
||||
{
|
||||
u32 speciesId = SpeciesToNationalPokedexNum(gSpecialVar_0x8005);
|
||||
|
|
27
src/scrcmd.c
27
src/scrcmd.c
|
@ -2485,12 +2485,12 @@ void RemoveAllItem(struct ScriptContext *ctx)
|
|||
void GetObjectPosition(struct ScriptContext *ctx)
|
||||
{
|
||||
u32 localId = VarGet(ScriptReadHalfword(ctx));
|
||||
u32 useTemplate = gSpecialVar_0x8001;
|
||||
u32 useTemplate = VarGet(ScriptReadHalfword(ctx));
|
||||
u16 *x = &gSpecialVar_0x8007;
|
||||
u16 *y = &gSpecialVar_0x8008;
|
||||
u32 objectId;
|
||||
struct ObjectEvent* objEvent;
|
||||
|
||||
u16 *x = &gSpecialVar_0x8007;
|
||||
u16 *y = &gSpecialVar_0x8008;
|
||||
|
||||
if (useTemplate)
|
||||
{
|
||||
|
@ -2506,3 +2506,24 @@ void GetObjectPosition(struct ScriptContext *ctx)
|
|||
*y = objEvent->currentCoords.y - 7;
|
||||
}
|
||||
|
||||
bool32 CheckObjectAtXY(struct ScriptContext *ctx)
|
||||
{
|
||||
u32 x = VarGet(ScriptReadHalfword(ctx)) + 7;
|
||||
u32 y = VarGet(ScriptReadHalfword(ctx)) + 7;
|
||||
u32 i;
|
||||
|
||||
for (i = 0; i < OBJECT_EVENTS_COUNT; i++)
|
||||
{
|
||||
if (!gObjectEvents[i].active)
|
||||
continue;
|
||||
|
||||
if (gObjectEvents[i].currentCoords.x != x)
|
||||
continue;
|
||||
|
||||
if (gObjectEvents[i].currentCoords.y != y)
|
||||
continue;
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue