Changed GetObjectPosition to callnative
This commit is contained in:
parent
22b0fdf5c3
commit
10bb349b8c
@ -2347,21 +2347,21 @@
|
|||||||
|
|
||||||
@ Stores the position of the given object in VAR_0x8007 (x) and VAR_0x8008 (y). Mode CURRENT_POSITION will take the object's current position. Mode TEMPLATE_POSITION will takje the object's template position.
|
@ Stores the position of the given object in VAR_0x8007 (x) and VAR_0x8008 (y). Mode CURRENT_POSITION will take the object's current position. Mode TEMPLATE_POSITION will takje the object's template position.
|
||||||
.macro getobjectxy localId:req, posType:req
|
.macro getobjectxy localId:req, posType:req
|
||||||
setvar VAR_0x8000, \localId
|
callnative GetObjectPosition
|
||||||
setvar VAR_0x8001, \posType
|
.2byte \localId
|
||||||
special GetObjectPosition
|
.2byte \posType
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
.macro getobjecttemplatexy localId:req
|
.macro getobjecttemplatexy localId:req, posType = TEMPLATE_POSITION
|
||||||
setvar VAR_0x8000, \localId
|
callnative GetObjectPosition
|
||||||
setvar VAR_0x8001, TEMPLATE_POSITION
|
.2byte \localId
|
||||||
special GetObjectPosition
|
.2byte \posType
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
.macro getobjectcurrentxy localId:req
|
.macro getobjectcurrentxy localId:req, posType = CURRENT_POSITION
|
||||||
setvar VAR_0x8000, \localId
|
callnative GetObjectPosition
|
||||||
setvar VAR_0x8001, CURRENT_POSITION
|
.2byte \localId
|
||||||
special GetObjectPosition
|
.2byte \posType
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
@ checks if there is any object at a given position
|
@ checks if there is any object at a given position
|
||||||
|
|||||||
@ -554,7 +554,6 @@ gSpecials::
|
|||||||
def_special Script_GetChosenMonDefensiveEVs
|
def_special Script_GetChosenMonDefensiveEVs
|
||||||
def_special Script_GetChosenMonOffensiveIVs
|
def_special Script_GetChosenMonOffensiveIVs
|
||||||
def_special Script_GetChosenMonDefensiveIVs
|
def_special Script_GetChosenMonDefensiveIVs
|
||||||
def_special GetObjectPosition
|
|
||||||
def_special CheckObjectAtXY
|
def_special CheckObjectAtXY
|
||||||
def_special Script_GetSetPokedexFlag
|
def_special Script_GetSetPokedexFlag
|
||||||
def_special CheckPartyHasSpecie
|
def_special CheckPartyHasSpecie
|
||||||
|
|||||||
@ -4278,30 +4278,6 @@ void PreparePartyForSkyBattle(void)
|
|||||||
CompactPartySlots();
|
CompactPartySlots();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetObjectPosition(void)
|
|
||||||
{
|
|
||||||
u32 localId = gSpecialVar_0x8000;
|
|
||||||
u32 useTemplate = gSpecialVar_0x8001;
|
|
||||||
u32 objectId;
|
|
||||||
struct ObjectEvent* objEvent;
|
|
||||||
|
|
||||||
u16 *x = &gSpecialVar_0x8007;
|
|
||||||
u16 *y = &gSpecialVar_0x8008;
|
|
||||||
|
|
||||||
if (useTemplate)
|
|
||||||
{
|
|
||||||
const struct ObjectEventTemplate *objTemplate = FindObjectEventTemplateByLocalId(localId, gSaveBlock1Ptr->objectEventTemplates, gMapHeader.events->objectEventCount);
|
|
||||||
*x = objTemplate->x;
|
|
||||||
*y = objTemplate->y;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
objectId = GetObjectEventIdByLocalId(localId);
|
|
||||||
objEvent = &gObjectEvents[objectId];
|
|
||||||
*x = objEvent->currentCoords.x - 7;
|
|
||||||
*y = objEvent->currentCoords.y - 7;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool32 CheckObjectAtXY(void)
|
bool32 CheckObjectAtXY(void)
|
||||||
{
|
{
|
||||||
u32 x = gSpecialVar_0x8005 + 7;
|
u32 x = gSpecialVar_0x8005 + 7;
|
||||||
|
|||||||
25
src/scrcmd.c
25
src/scrcmd.c
@ -2481,3 +2481,28 @@ void RemoveAllItem(struct ScriptContext *ctx)
|
|||||||
gSpecialVar_Result = count;
|
gSpecialVar_Result = count;
|
||||||
RemoveBagItem(itemId, count);
|
RemoveBagItem(itemId, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GetObjectPosition(struct ScriptContext *ctx)
|
||||||
|
{
|
||||||
|
u32 localId = VarGet(ScriptReadHalfword(ctx));
|
||||||
|
u32 useTemplate = gSpecialVar_0x8001;
|
||||||
|
u32 objectId;
|
||||||
|
struct ObjectEvent* objEvent;
|
||||||
|
|
||||||
|
u16 *x = &gSpecialVar_0x8007;
|
||||||
|
u16 *y = &gSpecialVar_0x8008;
|
||||||
|
|
||||||
|
if (useTemplate)
|
||||||
|
{
|
||||||
|
const struct ObjectEventTemplate *objTemplate = FindObjectEventTemplateByLocalId(localId, gSaveBlock1Ptr->objectEventTemplates, gMapHeader.events->objectEventCount);
|
||||||
|
*x = objTemplate->x;
|
||||||
|
*y = objTemplate->y;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
objectId = GetObjectEventIdByLocalId(localId);
|
||||||
|
objEvent = &gObjectEvents[objectId];
|
||||||
|
*x = objEvent->currentCoords.x - 7;
|
||||||
|
*y = objEvent->currentCoords.y - 7;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user