Changed Scripot_GetObjectFacingDirection to callnative

This commit is contained in:
pkmnsnfrn 2024-09-14 06:32:47 -07:00
parent 510af1bee6
commit a509f28038
4 changed files with 15 additions and 8 deletions

View file

@ -2421,6 +2421,13 @@
@ Gets the facing direction of a given event object and stores it in the variable \dest.
.macro getobjectfacingdirection localId:req, dest:req
setvar VAR_0x8005, \localId
specialvar \dest, Script_GetObjectFacingDirection
callnative Script_GetObjectFacingDirection
.2byte \localId
.byte \dest
.endm
@ .macro checkobjectat x:req, y:req, dest = VAR_RESULT
@ callnative Script_CheckObjectAtXY
@ .2byte \x
@ .2byte \y
@ .2byte \dest

View file

@ -554,4 +554,3 @@ gSpecials::
def_special Script_GetChosenMonDefensiveEVs
def_special Script_GetChosenMonOffensiveIVs
def_special Script_GetChosenMonDefensiveIVs
def_special Script_GetObjectFacingDirection

View file

@ -10633,8 +10633,3 @@ void GetDaycareGraphics(struct ScriptContext *ctx)
gSpecialVar_Result = i;
}
u32 Script_GetObjectFacingDirection(void)
{
return gObjectEvents[GetObjectEventIdByLocalId(gSpecialVar_0x8005)].facingDirection;
}

View file

@ -2520,4 +2520,10 @@ void Script_CheckChosenMonMatchDesiredSpecie(struct ScriptContext *ctx)
gSpecialVar_Result = (GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_SPECIES) == givenSpecies);
}
void Script_GetObjectFacingDirection(struct ScriptContext *ctx)
{
u32 objectId = VarGet(ScriptReadHalfword(ctx));
u16 *varPointer = GetVarPointer(ScriptReadHalfword(ctx));
*varPointer = gObjectEvents[GetObjectEventIdByLocalId(objectId)].facingDirection;
}