summaryrefslogtreecommitdiff
path: root/src/overworld.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/overworld.c')
-rw-r--r--src/overworld.c56
1 files changed, 28 insertions, 28 deletions
diff --git a/src/overworld.c b/src/overworld.c
index 8b2dfb74d..98bb43add 100644
--- a/src/overworld.c
+++ b/src/overworld.c
@@ -671,7 +671,7 @@ void walkrun_find_lowest_active_bit_in_bitfield(void)
gUnknown_02029810.player_field_0 = 4;
else if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_SURFING))
gUnknown_02029810.player_field_0 = 8;
- else if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_4))
+ else if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_UNDERWATER))
gUnknown_02029810.player_field_0 = 16;
else
gUnknown_02029810.player_field_0 = 1;
@@ -1854,7 +1854,7 @@ void sub_8054E20(void)
void sub_8054E34(void)
{
- gMapObjects[gPlayerAvatar.mapObjectId].mapobj_bit_15 = 1;
+ gMapObjects[gPlayerAvatar.mapObjectId].trackedByCamera = 1;
InitCameraUpdateCallback(gPlayerAvatar.spriteId);
}
@@ -2505,7 +2505,7 @@ void SpawnLinkPlayerMapObject(u8 linkPlayerId, s16 x, s16 y, u8 a4)
linkPlayerMapObj->mode = 0;
mapObj->active = 1;
- mapObj->mapobj_bit_1 = a4;
+ mapObj->regularAnimActive = a4;
mapObj->range.as_byte = 2;
mapObj->spriteId = 64;
@@ -2514,12 +2514,12 @@ void SpawnLinkPlayerMapObject(u8 linkPlayerId, s16 x, s16 y, u8 a4)
void InitLinkPlayerMapObjectPos(struct MapObject *mapObj, s16 x, s16 y)
{
- mapObj->coords2.x = x;
- mapObj->coords2.y = y;
- mapObj->coords3.x = x;
- mapObj->coords3.y = y;
- sub_80603CC(x, y, &mapObj->coords1.x, &mapObj->coords1.y);
- mapObj->coords1.x += 8;
+ mapObj->currentCoords.x = x;
+ mapObj->currentCoords.y = y;
+ mapObj->previousCoords.x = x;
+ mapObj->previousCoords.y = y;
+ sub_80603CC(x, y, &mapObj->initialCoords.x, &mapObj->initialCoords.y);
+ mapObj->initialCoords.x += 8;
FieldObjectUpdateZCoord(mapObj);
}
@@ -2555,8 +2555,8 @@ void sub_8055B08(u8 linkPlayerId, u16 *x, u16 *y)
{
u8 mapObjId = gLinkPlayerMapObjects[linkPlayerId].mapObjId;
struct MapObject *mapObj = &gMapObjects[mapObjId];
- *x = mapObj->coords2.x;
- *y = mapObj->coords2.y;
+ *x = mapObj->currentCoords.x;
+ *y = mapObj->currentCoords.y;
}
u8 sub_8055B30(u8 linkPlayerId)
@@ -2570,14 +2570,14 @@ u8 sub_8055B50(u8 linkPlayerId)
{
u8 mapObjId = gLinkPlayerMapObjects[linkPlayerId].mapObjId;
struct MapObject *mapObj = &gMapObjects[mapObjId];
- return mapObj->mapobj_unk_0B_0;
+ return mapObj->currentElevation;
}
s32 unref_sub_8055B74(u8 linkPlayerId)
{
u8 mapObjId = gLinkPlayerMapObjects[linkPlayerId].mapObjId;
struct MapObject *mapObj = &gMapObjects[mapObjId];
- return 16 - (s8)mapObj->mapobj_unk_21;
+ return 16 - (s8)mapObj->directionSequenceIndex;
}
u8 GetLinkPlayerIdAt(s16 x, s16 y)
@@ -2589,7 +2589,7 @@ u8 GetLinkPlayerIdAt(s16 x, s16 y)
&& (gLinkPlayerMapObjects[i].mode == 0 || gLinkPlayerMapObjects[i].mode == 2))
{
struct MapObject *mapObj = &gMapObjects[gLinkPlayerMapObjects[i].mapObjId];
- if (mapObj->coords2.x == x && mapObj->coords2.y == y)
+ if (mapObj->currentCoords.x == x && mapObj->currentCoords.y == y)
return i;
}
}
@@ -2605,7 +2605,7 @@ void sub_8055BFC(u8 linkPlayerId, u8 a2)
if (linkPlayerMapObj->active)
{
if (a2 > 10)
- mapObj->mapobj_bit_2 = 1;
+ mapObj->triggerGroundEffectsOnMove = 1;
else
gUnknown_082166D8[gUnknown_082166A0[linkPlayerMapObj->mode](linkPlayerMapObj, mapObj, a2)](linkPlayerMapObj, mapObj);
}
@@ -2644,7 +2644,7 @@ static u8 sub_8055CB0(struct LinkPlayerMapObject *linkPlayerMapObj, struct MapOb
}
else
{
- mapObj->mapobj_unk_21 = 16;
+ mapObj->directionSequenceIndex = 16;
npc_coords_shift(mapObj, x, y);
FieldObjectUpdateZCoord(mapObj);
return 1;
@@ -2664,10 +2664,10 @@ static void sub_8055D30(struct LinkPlayerMapObject *linkPlayerMapObj, struct Map
static void sub_8055D38(struct LinkPlayerMapObject *linkPlayerMapObj, struct MapObject *mapObj)
{
- mapObj->mapobj_unk_21--;
+ mapObj->directionSequenceIndex--;
linkPlayerMapObj->mode = 1;
- MoveCoords(mapObj->range.as_byte, &mapObj->coords1.x, &mapObj->coords1.y);
- if (!mapObj->mapobj_unk_21)
+ MoveCoords(mapObj->range.as_byte, &mapObj->initialCoords.x, &mapObj->initialCoords.y);
+ if (!mapObj->directionSequenceIndex)
{
npc_coords_shift_still(mapObj);
linkPlayerMapObj->mode = 2;
@@ -2701,8 +2701,8 @@ u8 LinkPlayerDetectCollision(u8 selfMapObjId, u8 a2, s16 x, s16 y)
{
if (i != selfMapObjId)
{
- if ((gMapObjects[i].coords2.x == x && gMapObjects[i].coords2.y == y)
- || (gMapObjects[i].coords3.x == x && gMapObjects[i].coords3.y == y))
+ if ((gMapObjects[i].currentCoords.x == x && gMapObjects[i].currentCoords.y == y)
+ || (gMapObjects[i].previousCoords.x == x && gMapObjects[i].previousCoords.y == y))
{
return 1;
}
@@ -2720,12 +2720,12 @@ void CreateLinkPlayerSprite(u8 linkPlayerId)
if (linkPlayerMapObj->active)
{
- u8 val = GetRivalAvatarGraphicsIdByStateIdAndGender(PLAYER_AVATAR_STATE_NORMAL, mapObj->mapobj_bit_1);
+ u8 val = GetRivalAvatarGraphicsIdByStateIdAndGender(PLAYER_AVATAR_STATE_NORMAL, mapObj->regularAnimActive);
mapObj->spriteId = AddPseudoFieldObject(val, SpriteCB_LinkPlayer, 0, 0, 0);
sprite = &gSprites[mapObj->spriteId];
sprite->coordOffsetEnabled = TRUE;
sprite->data[0] = linkPlayerId;
- mapObj->mapobj_bit_2 = 0;
+ mapObj->triggerGroundEffectsOnMove = 0;
}
}
@@ -2733,16 +2733,16 @@ void SpriteCB_LinkPlayer(struct Sprite *sprite)
{
struct LinkPlayerMapObject *linkPlayerMapObj = &gLinkPlayerMapObjects[sprite->data[0]];
struct MapObject *mapObj = &gMapObjects[linkPlayerMapObj->mapObjId];
- sprite->pos1.x = mapObj->coords1.x;
- sprite->pos1.y = mapObj->coords1.y;
- SetObjectSubpriorityByZCoord(mapObj->elevation, sprite, 1);
- sprite->oam.priority = ZCoordToPriority(mapObj->elevation);
+ sprite->pos1.x = mapObj->initialCoords.x;
+ sprite->pos1.y = mapObj->initialCoords.y;
+ SetObjectSubpriorityByZCoord(mapObj->previousElevation, sprite, 1);
+ sprite->oam.priority = ZCoordToPriority(mapObj->previousElevation);
if (!linkPlayerMapObj->mode)
StartSpriteAnim(sprite, FieldObjectDirectionToImageAnimId(mapObj->range.as_byte));
else
StartSpriteAnimIfDifferent(sprite, get_go_image_anim_num(mapObj->range.as_byte));
sub_806487C(sprite, 0);
- if (mapObj->mapobj_bit_2)
+ if (mapObj->triggerGroundEffectsOnMove)
{
sprite->invisible = ((sprite->data[7] & 4) >> 2);
sprite->data[7]++;