getobjectfacingdirection

This commit is contained in:
pkmnsnfrn 2024-08-11 19:27:18 -07:00
parent 262505589a
commit 7f5ecd8d0f
3 changed files with 14 additions and 0 deletions

View file

@ -2392,3 +2392,9 @@
goto_if_eq VAR_RESULT, TRUE, \script
.endif
.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
specialvar \dest, Script_GetObjectFacingDirection
.endm

View file

@ -562,3 +562,4 @@ gSpecials::
def_special SetCaughtMon
def_special SetMonBall
def_special CheckPartyForMon
def_special Script_GetObjectFacingDirection

View file

@ -10632,3 +10632,10 @@ void GetDaycareGraphics(struct ScriptContext *ctx)
}
gSpecialVar_Result = i;
}
u8 Script_GetObjectFacingDirection(void)
{
u8 objId = GetObjectEventIdByLocalId(VarGet(VAR_TEMP_1));
return gObjectEvents[objId].facingDirection;
}