Add MAP_OFFSET
This commit is contained in:
@@ -1242,8 +1242,8 @@ static u8 InitObjectEventStateFromTemplate(struct ObjectEventTemplate *template,
|
||||
return OBJECT_EVENTS_COUNT;
|
||||
objectEvent = &gObjectEvents[objectEventId];
|
||||
ClearObjectEvent(objectEvent);
|
||||
x = template->x + 7;
|
||||
y = template->y + 7;
|
||||
x = template->x + MAP_OFFSET;
|
||||
y = template->y + MAP_OFFSET;
|
||||
objectEvent->active = TRUE;
|
||||
objectEvent->triggerGroundEffectsOnMove = TRUE;
|
||||
objectEvent->graphicsId = template->graphicsId;
|
||||
@@ -1469,8 +1469,8 @@ u8 SpawnSpecialObjectEventParameterized(u8 graphicsId, u8 movementBehavior, u8 l
|
||||
{
|
||||
struct ObjectEventTemplate objectEventTemplate;
|
||||
|
||||
x -= 7;
|
||||
y -= 7;
|
||||
x -= MAP_OFFSET;
|
||||
y -= MAP_OFFSET;
|
||||
objectEventTemplate.localId = localId;
|
||||
objectEventTemplate.graphicsId = graphicsId;
|
||||
objectEventTemplate.inConnection = 0;
|
||||
@@ -1560,8 +1560,8 @@ u8 CreateObjectSprite(u8 graphicsId, u8 objectEventId, s16 x, s16 y, u8 z, u8 di
|
||||
graphicsInfo = GetObjectEventGraphicsInfo(graphicsId);
|
||||
MakeObjectTemplateFromObjectEventGraphicsInfo(graphicsId, UpdateObjectEventSprite, &spriteTemplate, &subspriteTables);
|
||||
*(u16 *)&spriteTemplate.paletteTag = TAG_NONE;
|
||||
x += 7;
|
||||
y += 7;
|
||||
x += MAP_OFFSET;
|
||||
y += MAP_OFFSET;
|
||||
SetSpritePosToOffsetMapCoords(&x, &y, 8, 16);
|
||||
spriteId = CreateSpriteAtEnd(&spriteTemplate, x, y, 0);
|
||||
if (spriteId != MAX_SPRITES)
|
||||
@@ -1606,9 +1606,9 @@ void TrySpawnObjectEvents(s16 cameraX, s16 cameraY)
|
||||
if (gMapHeader.events != NULL)
|
||||
{
|
||||
s16 left = gSaveBlock1Ptr->pos.x - 2;
|
||||
s16 right = gSaveBlock1Ptr->pos.x + 17;
|
||||
s16 right = gSaveBlock1Ptr->pos.x + MAP_OFFSET_W + 2;
|
||||
s16 top = gSaveBlock1Ptr->pos.y;
|
||||
s16 bottom = gSaveBlock1Ptr->pos.y + 16;
|
||||
s16 bottom = gSaveBlock1Ptr->pos.y + MAP_OFFSET_H + 2;
|
||||
|
||||
if (InBattlePyramid())
|
||||
objectCount = GetNumBattlePyramidObjectEvents();
|
||||
@@ -1620,8 +1620,8 @@ void TrySpawnObjectEvents(s16 cameraX, s16 cameraY)
|
||||
for (i = 0; i < objectCount; i++)
|
||||
{
|
||||
struct ObjectEventTemplate *template = &gSaveBlock1Ptr->objectEventTemplates[i];
|
||||
s16 npcX = template->x + 7;
|
||||
s16 npcY = template->y + 7;
|
||||
s16 npcX = template->x + MAP_OFFSET;
|
||||
s16 npcY = template->y + MAP_OFFSET;
|
||||
|
||||
if (top <= npcY && bottom >= npcY && left <= npcX && right >= npcX
|
||||
&& !FlagGet(template->flagId))
|
||||
@@ -2120,8 +2120,8 @@ void TryMoveObjectEventToMapCoords(u8 localId, u8 mapNum, u8 mapGroup, s16 x, s1
|
||||
u8 objectEventId;
|
||||
if (!TryGetObjectEventIdByLocalIdAndMap(localId, mapNum, mapGroup, &objectEventId))
|
||||
{
|
||||
x += 7;
|
||||
y += 7;
|
||||
x += MAP_OFFSET;
|
||||
y += MAP_OFFSET;
|
||||
MoveObjectEventToMapCoords(&gObjectEvents[objectEventId], x, y);
|
||||
}
|
||||
}
|
||||
@@ -2470,8 +2470,8 @@ void OverrideTemplateCoordsForObjectEvent(const struct ObjectEvent *objectEvent)
|
||||
objectEventTemplate = GetBaseTemplateForObjectEvent(objectEvent);
|
||||
if (objectEventTemplate != NULL)
|
||||
{
|
||||
objectEventTemplate->x = objectEvent->currentCoords.x - 7;
|
||||
objectEventTemplate->y = objectEvent->currentCoords.y - 7;
|
||||
objectEventTemplate->x = objectEvent->currentCoords.x - MAP_OFFSET;
|
||||
objectEventTemplate->y = objectEvent->currentCoords.y - MAP_OFFSET;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user