RemoveFieldObjectIfOutsideView

This commit is contained in:
PikalaxALT
2017-09-07 17:41:56 -04:00
parent 341a4735bc
commit 44be18e1df
2 changed files with 21 additions and 69 deletions

View File

@@ -764,3 +764,24 @@ void RemoveFieldObjectsOutsideView(void)
}
}
}
void RemoveFieldObjectIfOutsideView(struct MapObject *mapObject)
{
s16 left;
s16 right;
s16 top;
s16 bottom;
left = gSaveBlock1Ptr->pos.x - 2;
right = gSaveBlock1Ptr->pos.x + 17;
top = gSaveBlock1Ptr->pos.y;
bottom = gSaveBlock1Ptr->pos.y + 16;
if (mapObject->coords2.x >= left && mapObject->coords2.x <= right
&& mapObject->coords2.y >= top && mapObject->coords2.y <= bottom)
return;
if (mapObject->coords1.x >= left && mapObject->coords1.x <= right
&& mapObject->coords1.y >= top && mapObject->coords1.y <= bottom)
return;
RemoveFieldObject(mapObject);
}