Added checkobjectat
This commit is contained in:
parent
811b5d286e
commit
0784f9fa74
@ -2334,3 +2334,10 @@
|
||||
setvar VAR_0x8001, \posType
|
||||
special GetObjectPosition
|
||||
.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
|
||||
.endm
|
||||
|
||||
@ -555,3 +555,4 @@ gSpecials::
|
||||
def_special Script_GetChosenMonOffensiveIVs
|
||||
def_special Script_GetChosenMonDefensiveIVs
|
||||
def_special GetObjectPosition
|
||||
def_special CheckObjectAtXY
|
||||
|
||||
@ -4294,3 +4294,19 @@ void GetObjectPosition(void)
|
||||
*y = objTemplate->y;
|
||||
}
|
||||
}
|
||||
|
||||
// special to check if there is any object at a given position
|
||||
u16 CheckObjectAtXY(void)
|
||||
{
|
||||
u16 x = gSpecialVar_0x8005 + 7;
|
||||
u16 y = gSpecialVar_0x8006 + 7;
|
||||
u32 i;
|
||||
|
||||
for (i = 0; i < OBJECT_EVENTS_COUNT; i++)
|
||||
{
|
||||
if (gObjectEvents[i].active && gObjectEvents[i].currentCoords.x == x && gObjectEvents[i].currentCoords.y == y)
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user