summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarcus Huderle <huderlem@gmail.com>2018-05-23 09:26:22 -0500
committerMarcus Huderle <huderlem@gmail.com>2018-05-23 09:26:22 -0500
commit22e6e3532900b2470d0134f1347981d77828b22c (patch)
treed8cea366e68eca40bac0a6c0edf0c85a27eda520 /src
parent612f62725a2ed3be07f688f867aca3eb7579ab19 (diff)
Label all of MapObject struct members, and ground effect flags
Diffstat (limited to 'src')
-rw-r--r--src/battle/battle_setup.c2
-rw-r--r--src/berry.c4
-rw-r--r--src/bike.c74
-rw-r--r--src/event_object_movement.c1089
-rw-r--r--src/field_effect.c106
-rw-r--r--src/field_effect_helpers.c47
-rw-r--r--src/field_player_avatar.c232
-rw-r--r--src/field_special_scene.c2
-rw-r--r--src/field_specials.c2
-rw-r--r--src/fldeff_decoration.c4
-rw-r--r--src/item_use.c2
-rw-r--r--src/map_obj_lock.c4
-rw-r--r--src/overworld.c56
-rw-r--r--src/shop.c8
-rw-r--r--src/trainer_see.c68
15 files changed, 852 insertions, 848 deletions
diff --git a/src/battle/battle_setup.c b/src/battle/battle_setup.c
index 10ac4f78c..9e03b5d2d 100644
--- a/src/battle/battle_setup.c
+++ b/src/battle/battle_setup.c
@@ -1045,7 +1045,7 @@ void sub_8082524(void)
{
struct MapObject *mapObject = &gMapObjects[gSelectedMapObject];
- npc_set_running_behaviour_etc(mapObject, npc_running_behaviour_by_direction(mapObject->mapobj_unk_18));
+ npc_set_running_behaviour_etc(mapObject, npc_running_behaviour_by_direction(mapObject->facingDirection));
}
u8 ScrSpecial_GetTrainerBattleMode(void)
diff --git a/src/berry.c b/src/berry.c
index 349703299..8829407da 100644
--- a/src/berry.c
+++ b/src/berry.c
@@ -1545,8 +1545,8 @@ void ResetBerryTreeSparkleFlags(void)
{
if (gMapObjects[i].active && gMapObjects[i].animPattern == 12) // is the object an active berry tree?
{
- cam_left = gMapObjects[i].coords2.x;
- cam_top = gMapObjects[i].coords2.y;
+ cam_left = gMapObjects[i].currentCoords.x;
+ cam_top = gMapObjects[i].currentCoords.y;
if (left <= cam_left && cam_left <= right && top <= cam_top && cam_top <= bottom)
ResetBerryTreeSparkleFlag(gMapObjects[i].trainerRange_berryTreeId);
}
diff --git a/src/bike.c b/src/bike.c
index 28439e6bb..25419c6cf 100644
--- a/src/bike.c
+++ b/src/bike.c
@@ -199,14 +199,14 @@ static void MachBikeTransition_TurnDirection(u8 direction)
{
struct MapObject *playerMapObj = &gMapObjects[gPlayerAvatar.mapObjectId];
- if (CanBikeFaceDirOnMetatile(direction, playerMapObj->mapobj_unk_1E))
+ if (CanBikeFaceDirOnMetatile(direction, playerMapObj->currentMetatileBehavior))
{
PlayerTurnInPlace(direction);
Bike_SetBikeStill();
}
else
{
- MachBikeTransition_FaceDirection(playerMapObj->mapobj_unk_18);
+ MachBikeTransition_FaceDirection(playerMapObj->facingDirection);
}
}
@@ -215,13 +215,13 @@ static void MachBikeTransition_TrySpeedUp(u8 direction)
struct MapObject *playerMapObj = &gMapObjects[gPlayerAvatar.mapObjectId];
u8 collision;
- if (CanBikeFaceDirOnMetatile(direction, playerMapObj->mapobj_unk_1E) == FALSE)
+ if (CanBikeFaceDirOnMetatile(direction, playerMapObj->currentMetatileBehavior) == FALSE)
{
// we cannot go forward, so either slow down or, if we are stopped, idle face direction.
if (gPlayerAvatar.bikeSpeed)
- MachBikeTransition_TrySlowDown(playerMapObj->placeholder18);
+ MachBikeTransition_TrySlowDown(playerMapObj->movementDirection);
else
- MachBikeTransition_FaceDirection(playerMapObj->placeholder18);
+ MachBikeTransition_FaceDirection(playerMapObj->movementDirection);
}
else
{
@@ -393,7 +393,7 @@ static u8 AcroBikeHandleInputWheelieStanding(u8 *newDirection, u16 newKeys, u16
{
// B button was released.
gPlayerAvatar.bikeFrameCounter = 0;
- if (!MetatileBehavior_IsBumpySlope(playerMapObj->mapobj_unk_1E))
+ if (!MetatileBehavior_IsBumpySlope(playerMapObj->currentMetatileBehavior))
{
// Go back to normal on flat ground
*newDirection = direction;
@@ -436,7 +436,7 @@ static u8 AcroBikeHandleInputBunnyHop(u8 *newDirection, u16 newKeys, u16 heldKey
{
// B button was released
Bike_SetBikeStill();
- if (MetatileBehavior_IsBumpySlope(playerMapObj->mapobj_unk_1E))
+ if (MetatileBehavior_IsBumpySlope(playerMapObj->currentMetatileBehavior))
{
// even though B was released, dont undo the wheelie on the bumpy slope.
gPlayerAvatar.acroBikeState = ACRO_STATE_WHEELIE_STANDING;
@@ -483,7 +483,7 @@ static u8 AcroBikeHandleInputWheelieMoving(u8 *newDirection, u16 newKeys, u16 he
{
// we were moving on a wheelie, but we let go while moving. reset bike still status
Bike_SetBikeStill();
- if (!MetatileBehavior_IsBumpySlope(playerMapObj->mapobj_unk_1E))
+ if (!MetatileBehavior_IsBumpySlope(playerMapObj->currentMetatileBehavior))
{
// we let go of B and arent on a bumpy slope, set state to normal because now we need to handle this
gPlayerAvatar.acroBikeState = ACRO_STATE_NORMAL;
@@ -531,8 +531,8 @@ static u8 AcroBikeHandleInputSidewaysJump(u8 *ptr, u16 newKeys, u16 heldKeys)
{
struct MapObject *playerMapObj = &gMapObjects[gPlayerAvatar.mapObjectId];
- playerMapObj->mapobj_bit_9 = 0;
- FieldObjectSetDirection(playerMapObj, playerMapObj->mapobj_unk_18);
+ playerMapObj->facingDirectionLocked = 0;
+ FieldObjectSetDirection(playerMapObj, playerMapObj->facingDirection);
gPlayerAvatar.acroBikeState = ACRO_STATE_NORMAL;
return CheckMovementInputAcroBike(ptr, newKeys, heldKeys);
}
@@ -552,8 +552,8 @@ static void AcroBikeTransition_TurnDirection(u8 direction)
{
struct MapObject *playerMapObj = &gMapObjects[gPlayerAvatar.mapObjectId];
- if (CanBikeFaceDirOnMetatile(direction, playerMapObj->mapobj_unk_1E) == 0)
- direction = playerMapObj->placeholder18;
+ if (CanBikeFaceDirOnMetatile(direction, playerMapObj->currentMetatileBehavior) == 0)
+ direction = playerMapObj->movementDirection;
PlayerFaceDirection(direction);
}
@@ -562,9 +562,9 @@ static void AcroBikeTransition_Moving(u8 direction)
u8 collision;
struct MapObject *playerMapObj = &gMapObjects[gPlayerAvatar.mapObjectId];
- if (CanBikeFaceDirOnMetatile(direction, playerMapObj->mapobj_unk_1E) == 0)
+ if (CanBikeFaceDirOnMetatile(direction, playerMapObj->currentMetatileBehavior) == 0)
{
- AcroBikeTransition_FaceDirection(playerMapObj->placeholder18);
+ AcroBikeTransition_FaceDirection(playerMapObj->movementDirection);
return;
}
collision = get_some_collision(direction);
@@ -585,8 +585,8 @@ static void AcroBikeTransition_NormalToWheelie(u8 direction)
{
struct MapObject *playerMapObj = &gMapObjects[gPlayerAvatar.mapObjectId];
- if (CanBikeFaceDirOnMetatile(direction, playerMapObj->mapobj_unk_1E) == 0)
- direction = playerMapObj->placeholder18;
+ if (CanBikeFaceDirOnMetatile(direction, playerMapObj->currentMetatileBehavior) == 0)
+ direction = playerMapObj->movementDirection;
PlayerStartWheelie(direction);
}
@@ -594,8 +594,8 @@ static void AcroBikeTransition_WheelieToNormal(u8 direction)
{
struct MapObject *playerMapObj = &gMapObjects[gPlayerAvatar.mapObjectId];
- if (CanBikeFaceDirOnMetatile(direction, playerMapObj->mapobj_unk_1E) == 0)
- direction = playerMapObj->placeholder18;
+ if (CanBikeFaceDirOnMetatile(direction, playerMapObj->currentMetatileBehavior) == 0)
+ direction = playerMapObj->movementDirection;
PlayerEndWheelie(direction);
}
@@ -603,8 +603,8 @@ static void AcroBikeTransition_WheelieIdle(u8 direction)
{
struct MapObject *playerMapObj = &gMapObjects[gPlayerAvatar.mapObjectId];
- if (CanBikeFaceDirOnMetatile(direction, playerMapObj->mapobj_unk_1E) == 0)
- direction = playerMapObj->placeholder18;
+ if (CanBikeFaceDirOnMetatile(direction, playerMapObj->currentMetatileBehavior) == 0)
+ direction = playerMapObj->movementDirection;
PlayerIdleWheelie(direction);
}
@@ -612,8 +612,8 @@ static void AcroBikeTransition_WheelieHoppingStanding(u8 direction)
{
struct MapObject *playerMapObj = &gMapObjects[gPlayerAvatar.mapObjectId];
- if (CanBikeFaceDirOnMetatile(direction, playerMapObj->mapobj_unk_1E) == 0)
- direction = playerMapObj->placeholder18;
+ if (CanBikeFaceDirOnMetatile(direction, playerMapObj->currentMetatileBehavior) == 0)
+ direction = playerMapObj->movementDirection;
PlayerStandingHoppingWheelie(direction);
}
@@ -622,9 +622,9 @@ static void AcroBikeTransition_WheelieHoppingMoving(u8 direction)
u8 var;
struct MapObject *playerMapObj = &gMapObjects[gPlayerAvatar.mapObjectId];
- if (CanBikeFaceDirOnMetatile(direction, playerMapObj->mapobj_unk_1E) == 0)
+ if (CanBikeFaceDirOnMetatile(direction, playerMapObj->currentMetatileBehavior) == 0)
{
- AcroBikeTransition_WheelieHoppingStanding(playerMapObj->placeholder18);
+ AcroBikeTransition_WheelieHoppingStanding(playerMapObj->movementDirection);
return;
}
var = get_some_collision(direction);
@@ -674,7 +674,7 @@ static void AcroBikeTransition_SideJump(u8 direction)
}
playerMapObj = &gMapObjects[gPlayerAvatar.mapObjectId];
PlaySE(SE_JITE_PYOKO);
- playerMapObj->mapobj_bit_9 = 1;
+ playerMapObj->facingDirectionLocked = 1;
PlayerSetAnimId(sub_80608A4(direction), 2);
}
@@ -688,9 +688,9 @@ static void AcroBikeTransition_WheelieMoving(u8 direction)
u8 var;
struct MapObject *playerMapObj = &gMapObjects[gPlayerAvatar.mapObjectId];
- if (CanBikeFaceDirOnMetatile(direction, playerMapObj->mapobj_unk_1E) == 0)
+ if (CanBikeFaceDirOnMetatile(direction, playerMapObj->currentMetatileBehavior) == 0)
{
- PlayerIdleWheelie(playerMapObj->placeholder18);
+ PlayerIdleWheelie(playerMapObj->movementDirection);
return;
}
var = get_some_collision(direction);
@@ -706,7 +706,7 @@ static void AcroBikeTransition_WheelieMoving(u8 direction)
}
else if (var <= 4)
{
- if (MetatileBehavior_IsBumpySlope(playerMapObj->mapobj_unk_1E))
+ if (MetatileBehavior_IsBumpySlope(playerMapObj->currentMetatileBehavior))
PlayerIdleWheelie(direction);
else
sub_80595DC(direction); //hit wall?
@@ -722,9 +722,9 @@ static void AcroBikeTransition_WheelieRisingMoving(u8 direction)
u8 var;
struct MapObject *playerMapObj = &gMapObjects[gPlayerAvatar.mapObjectId];
- if (CanBikeFaceDirOnMetatile(direction, playerMapObj->mapobj_unk_1E) == 0)
+ if (CanBikeFaceDirOnMetatile(direction, playerMapObj->currentMetatileBehavior) == 0)
{
- PlayerStartWheelie(playerMapObj->placeholder18);
+ PlayerStartWheelie(playerMapObj->movementDirection);
return;
}
var = get_some_collision(direction);
@@ -740,7 +740,7 @@ static void AcroBikeTransition_WheelieRisingMoving(u8 direction)
}
else if (var <= 4)
{
- if (MetatileBehavior_IsBumpySlope(playerMapObj->mapobj_unk_1E))
+ if (MetatileBehavior_IsBumpySlope(playerMapObj->currentMetatileBehavior))
PlayerIdleWheelie(direction);
else
sub_80595DC(direction); //hit wall?
@@ -756,9 +756,9 @@ static void AcroBikeTransition_WheelieLoweringMoving(u8 direction)
u8 var;
struct MapObject *playerMapObj = &gMapObjects[gPlayerAvatar.mapObjectId];
- if (CanBikeFaceDirOnMetatile(direction, playerMapObj->mapobj_unk_1E) == 0)
+ if (CanBikeFaceDirOnMetatile(direction, playerMapObj->currentMetatileBehavior) == 0)
{
- PlayerEndWheelie(playerMapObj->placeholder18);
+ PlayerEndWheelie(playerMapObj->movementDirection);
return;
}
var = get_some_collision(direction);
@@ -885,8 +885,8 @@ static u8 get_some_collision(u8 direction)
u8 metatitleBehavior;
struct MapObject *playerMapObj = &gMapObjects[gPlayerAvatar.mapObjectId];
- x = playerMapObj->coords2.x;
- y = playerMapObj->coords2.y;
+ x = playerMapObj->currentCoords.x;
+ y = playerMapObj->currentCoords.y;
MoveCoords(direction, &x, &y);
metatitleBehavior = MapGridGetMetatileBehaviorAt(x, y);
return Bike_CheckCollisionTryAdvanceCollisionCount(playerMapObj, x, y, direction, metatitleBehavior);
@@ -970,7 +970,7 @@ bool8 IsBikingDisallowedByPlayer(void)
s16 x, y;
u8 tileBehavior;
- if (!(gPlayerAvatar.flags & (PLAYER_AVATAR_FLAG_SURFING | PLAYER_AVATAR_FLAG_4)))
+ if (!(gPlayerAvatar.flags & (PLAYER_AVATAR_FLAG_SURFING | PLAYER_AVATAR_FLAG_UNDERWATER)))
{
PlayerGetDestCoords(&x, &y);
tileBehavior = MapGridGetMetatileBehaviorAt(x, y);
@@ -982,7 +982,7 @@ bool8 IsBikingDisallowedByPlayer(void)
bool8 player_should_look_direction_be_enforced_upon_movement(void)
{
- if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_ACRO_BIKE) != FALSE && MetatileBehavior_IsBumpySlope(gMapObjects[gPlayerAvatar.mapObjectId].mapobj_unk_1E) != FALSE)
+ if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_ACRO_BIKE) != FALSE && MetatileBehavior_IsBumpySlope(gMapObjects[gPlayerAvatar.mapObjectId].currentMetatileBehavior) != FALSE)
return FALSE;
else
return TRUE;
diff --git a/src/event_object_movement.c b/src/event_object_movement.c
index bc52fba74..78ed41d77 100644
--- a/src/event_object_movement.c
+++ b/src/event_object_movement.c
@@ -1918,7 +1918,7 @@ void npc_clear_ids_and_state(struct MapObject *mapObj)
mapObj->localId = 0xFF;
mapObj->mapNum = 0xFF;
mapObj->mapGroup = 0xFF;
- mapObj->mapobj_unk_1C = 0xFF;
+ mapObj->animId = 0xFF;
}
void npcs_clear_ids_and_state(void)
@@ -1994,7 +1994,7 @@ u8 GetFieldObjectIdByXY(s16 x, s16 y)
for (i = 0; i < 16; i++)
{
- if (gMapObjects[i].active && gMapObjects[i].coords2.x == x && gMapObjects[i].coords2.y == y)
+ if (gMapObjects[i].active && gMapObjects[i].currentCoords.x == x && gMapObjects[i].currentCoords.y == y)
break;
}
return i;
@@ -2038,27 +2038,27 @@ u8 InitFieldObjectStateFromTemplate(struct MapObjectTemplate *template, u8 b, u8
r3 = template->x + 7;
r2 = template->y + 7;
mapObj->active = TRUE;
- mapObj->mapobj_bit_2 = TRUE;
+ mapObj->triggerGroundEffectsOnMove = TRUE;
mapObj->graphicsId = template->graphicsId;
mapObj->animPattern = template->movementType;
mapObj->localId = template->localId;
mapObj->mapNum = b;
asm("":::"r6");
mapObj->mapGroup = c;
- mapObj->coords1.x = r3;
- mapObj->coords1.y = r2;
- mapObj->coords2.x = r3;
- mapObj->coords2.y = r2;
- mapObj->coords3.x = r3;
- mapObj->coords3.y = r2;
- mapObj->mapobj_unk_0B_0 = template->elevation;
- mapObj->elevation = template->elevation;
+ mapObj->initialCoords.x = r3;
+ mapObj->initialCoords.y = r2;
+ mapObj->currentCoords.x = r3;
+ mapObj->currentCoords.y = r2;
+ mapObj->previousCoords.x = r3;
+ mapObj->previousCoords.y = r2;
+ mapObj->currentElevation = template->elevation;
+ mapObj->previousElevation = template->elevation;
mapObj->range.as_nybbles.x = template->unkA_0;
mapObj->range.as_nybbles.y = template->unkA_4;
mapObj->trainerType = template->unkC;
mapObj->trainerRange_berryTreeId = template->unkE;
- mapObj->mapobj_unk_20 = gUnknown_0836DC09[template->movementType];
- FieldObjectSetDirection((struct MapObject *)mapObj, mapObj->mapobj_unk_20);
+ mapObj->previousMovementDirection = gUnknown_0836DC09[template->movementType];
+ FieldObjectSetDirection((struct MapObject *)mapObj, mapObj->previousMovementDirection);
asm("":::"r5","r6");
FieldObjectHandleDynamicGraphicsId((struct MapObject *)mapObj);
if (gUnknown_0836DBBC[mapObj->animPattern] != 0)
@@ -2171,7 +2171,7 @@ u8 sub_805AFCC(struct MapObjectTemplate *mapObjTemplate, struct SpriteTemplate *
else if (gfxInfo->paletteSlot == 10)
npc_load_two_palettes__and_record(gfxInfo->paletteTag1, gfxInfo->paletteSlot);
if (mapObject->animPattern == 0x4C)
- mapObject->mapobj_bit_13 = TRUE;
+ mapObject->invisible = TRUE;
#ifdef NONMATCHING
sprTemplate->paletteTag = 0xFFFF;
@@ -2188,7 +2188,7 @@ u8 sub_805AFCC(struct MapObjectTemplate *mapObjTemplate, struct SpriteTemplate *
return 16;
}
sprite = &gSprites[spriteId];
- sub_8060388(e + mapObject->coords2.x, f + mapObject->coords2.y, &sprite->pos1.x, &sprite->pos1.y);
+ sub_8060388(e + mapObject->currentCoords.x, f + mapObject->currentCoords.y, &sprite->pos1.x, &sprite->pos1.y);
sprite->centerToCornerVecX = -(gfxInfo->width >> 1);
sprite->centerToCornerVecY = -(gfxInfo->height >> 1);
sprite->pos1.x += 8;
@@ -2197,10 +2197,10 @@ u8 sub_805AFCC(struct MapObjectTemplate *mapObjTemplate, struct SpriteTemplate *
sprite->coordOffsetEnabled = TRUE;
sprite->data[0] = mapObjectId;
mapObject->spriteId = spriteId;
- mapObject->mapobj_bit_12 = gfxInfo->inanimate;
- if (!mapObject->mapobj_bit_12)
- StartSpriteAnim(sprite, FieldObjectDirectionToImageAnimId(mapObject->mapobj_unk_18));
- SetObjectSubpriorityByZCoord(mapObject->elevation, sprite, 1);
+ mapObject->inanimate = gfxInfo->inanimate;
+ if (!mapObject->inanimate)
+ StartSpriteAnim(sprite, FieldObjectDirectionToImageAnimId(mapObject->facingDirection));
+ SetObjectSubpriorityByZCoord(mapObject->previousElevation, sprite, 1);
sub_80634D0(mapObject, sprite);
return mapObjectId;
}
@@ -2402,8 +2402,8 @@ void RemoveFieldObjectsOutsideView(void)
{
struct MapObject *mapObject = &gMapObjects[i];
- if (mapObject->active && !mapObject->mapobj_bit_16)
- RemoveFieldObjectIfOutsideView(mapObject);
+ if (mapObject->active && !mapObject->isPlayer)
+ RemoveFieldObjectIfOutsideView(mapObject);
}
}
}
@@ -2415,11 +2415,11 @@ void RemoveFieldObjectIfOutsideView(struct MapObject *mapObject)
s16 r4 = gSaveBlock1.pos.y;
s16 r6 = gSaveBlock1.pos.y + 16;
- if (mapObject->coords2.x >= r7 && mapObject->coords2.x <= r5
- && mapObject->coords2.y >= r4 && mapObject->coords2.y <= r6)
+ if (mapObject->currentCoords.x >= r7 && mapObject->currentCoords.x <= r5
+ && mapObject->currentCoords.y >= r4 && mapObject->currentCoords.y <= r6)
return;
- if (mapObject->coords1.x >= r7 && mapObject->coords1.x <= r5
- && mapObject->coords1.y >= r4 && mapObject->coords1.y <= r6)
+ if (mapObject->initialCoords.x >= r7 && mapObject->initialCoords.x <= r5
+ && mapObject->initialCoords.y >= r4 && mapObject->initialCoords.y <= r6)
return;
RemoveFieldObject(mapObject);
}
@@ -2485,7 +2485,7 @@ void sub_805B75C(u8 a, s16 b, s16 c)
{
struct Sprite *sprite = &gSprites[spriteId];
- sub_8060388(b + mapObject->coords2.x, c + mapObject->coords2.y, &sprite->pos1.x, &sprite->pos1.y);
+ sub_8060388(b + mapObject->currentCoords.x, c + mapObject->currentCoords.y, &sprite->pos1.x, &sprite->pos1.y);
sprite->centerToCornerVecX = -(gfxInfo->width >> 1);
sprite->centerToCornerVecY = -(gfxInfo->height >> 1);
sprite->pos1.x += 8;
@@ -2494,7 +2494,7 @@ void sub_805B75C(u8 a, s16 b, s16 c)
if (mapObject->animPattern == 11)
{
SetPlayerAvatarFieldObjectIdAndObjectId(a, spriteId);
- mapObject->mapobj_unk_1B = sub_8126B54();
+ mapObject->warpArrowSpriteId = sub_8126B54();
}
if (subspriteTables != NULL)
SetSubspriteTables(sprite, subspriteTables);
@@ -2502,23 +2502,23 @@ void sub_805B75C(u8 a, s16 b, s16 c)
sprite->coordOffsetEnabled = TRUE;
sprite->data[0] = a;
mapObject->spriteId = spriteId;
- if (!mapObject->mapobj_bit_12 && mapObject->animPattern != 11)
- StartSpriteAnim(sprite, FieldObjectDirectionToImageAnimId(mapObject->mapobj_unk_18));
+ if (!mapObject->inanimate && mapObject->animPattern != 11)
+ StartSpriteAnim(sprite, FieldObjectDirectionToImageAnimId(mapObject->facingDirection));
sub_805B914(mapObject);
- SetObjectSubpriorityByZCoord(mapObject->elevation, sprite, 1);
+ SetObjectSubpriorityByZCoord(mapObject->previousElevation, sprite, 1);
}
}
void sub_805B914(struct MapObject *mapObject)
{
- mapObject->mapobj_bit_1 = FALSE;
- mapObject->mapobj_bit_2 = TRUE;
- mapObject->mapobj_bit_22 = FALSE;
- mapObject->mapobj_bit_17 = FALSE;
- mapObject->mapobj_bit_18 = FALSE;
- mapObject->mapobj_bit_19 = FALSE;
- mapObject->mapobj_bit_20 = FALSE;
- mapObject->mapobj_bit_21 = FALSE;
+ mapObject->regularAnimActive = FALSE;
+ mapObject->triggerGroundEffectsOnMove = TRUE;
+ mapObject->hasShadow = FALSE;
+ mapObject->hasReflection = FALSE;
+ mapObject->inShortGrass = FALSE;
+ mapObject->inShallowFlowingWater = FALSE;
+ mapObject->inSandPile = FALSE;
+ mapObject->inHotSprings = FALSE;
FieldObjectClearAnim(mapObject);
}
@@ -2547,14 +2547,14 @@ void sub_805B980(struct MapObject *mapObject, u8 graphicsId)
sprite->anims = gfxInfo->anims;
sprite->subspriteTables = gfxInfo->subspriteTables;
sprite->oam.paletteNum = gfxInfo->paletteSlot;
- mapObject->mapobj_bit_12 = gfxInfo->inanimate;
+ mapObject->inanimate = gfxInfo->inanimate;
mapObject->graphicsId = graphicsId;
- sub_80603CC(mapObject->coords2.x, mapObject->coords2.y, &sprite->pos1.x, &sprite->pos1.y);
+ sub_80603CC(mapObject->currentCoords.x, mapObject->currentCoords.y, &sprite->pos1.x, &sprite->pos1.y);
sprite->centerToCornerVecX = -(gfxInfo->width >> 1);
sprite->centerToCornerVecY = -(gfxInfo->height >> 1);
sprite->pos1.x += 8;
sprite->pos1.y += 16 + sprite->centerToCornerVecY;
- if (mapObject->mapobj_bit_15)
+ if (mapObject->trackedByCamera)
CameraObjectReset1();
}
@@ -2569,9 +2569,9 @@ void unref_sub_805BA80(u8 localId, u8 mapNum, u8 mapGroup, u8 graphicsId)
void FieldObjectTurn(struct MapObject *mapObject, u8 direction)
{
FieldObjectSetDirection(mapObject, direction);
- if (!mapObject->mapobj_bit_12)
+ if (!mapObject->inanimate)
{
- StartSpriteAnim(&gSprites[mapObject->spriteId], FieldObjectDirectionToImageAnimId(mapObject->mapobj_unk_18));
+ StartSpriteAnim(&gSprites[mapObject->spriteId], FieldObjectDirectionToImageAnimId(mapObject->facingDirection));
SeekSpriteAnim(&gSprites[mapObject->spriteId], 0);
}
}
@@ -2594,12 +2594,12 @@ void get_berry_tree_graphics(struct MapObject *mapObject, struct Sprite *sprite)
u8 treeStage;
u8 treeId;
- mapObject->mapobj_bit_13 = TRUE;
+ mapObject->invisible = TRUE;
sprite->invisible = TRUE;
treeStage = GetStageByBerryTreeId(mapObject->trainerRange_berryTreeId);
if (treeStage != 0)
{
- mapObject->mapobj_bit_13 = FALSE;
+ mapObject->invisible = FALSE;
sprite->invisible = FALSE;
treeId = GetBerryTypeByBerryTreeId(mapObject->trainerRange_berryTreeId) - 1;
treeStage--;
@@ -2632,7 +2632,7 @@ void npc_by_local_id_and_map_set_field_1_bit_x20(u8 localId, u8 mapNum, u8 mapGr
u8 mapObjectId;
if (!TryGetFieldObjectIdByLocalIdAndMap(localId, mapNum, mapGroup, &mapObjectId))
- gMapObjects[mapObjectId].mapobj_bit_13 = d;
+ gMapObjects[mapObjectId].invisible = d;
}
void FieldObjectGetLocalIdAndMap(struct MapObject *mapObject, void *localId, void *mapNum, void *mapGroup)
@@ -2651,7 +2651,7 @@ void sub_805BCC0(s16 x, s16 y)
if (mapObjectId != 16)
{
mapObject = &gMapObjects[mapObjectId];
- mapObject->mapobj_bit_2 = TRUE;
+ mapObject->triggerGroundEffectsOnMove = TRUE;
}
}
@@ -2665,7 +2665,7 @@ void sub_805BCF0(u8 localId, u8 mapNum, u8 mapGroup, u8 subpriority)
{
mapObject = &gMapObjects[mapObjectId];
sprite = &gSprites[mapObject->spriteId];
- mapObject->mapobj_bit_26 = TRUE;
+ mapObject->fixedPriority = TRUE;
sprite->subpriority = subpriority;
}
}
@@ -2678,8 +2678,8 @@ void sub_805BD48(u8 localId, u8 mapNum, u8 mapGroup)
if (!TryGetFieldObjectIdByLocalIdAndMap(localId, mapNum, mapGroup, &mapObjectId))
{
mapObject = &gMapObjects[mapObjectId];
- mapObject->mapobj_bit_26 = FALSE;
- mapObject->mapobj_bit_2 = TRUE;
+ mapObject->fixedPriority = FALSE;
+ mapObject->triggerGroundEffectsOnMove = TRUE;
}
}
@@ -2785,26 +2785,26 @@ void npc_load_two_palettes__and_record(u16 a, u8 b)
void unref_sub_805C014(struct MapObject *mapObject, s16 x, s16 y)
{
- mapObject->coords3.x = mapObject->coords2.x;
- mapObject->coords3.y = mapObject->coords2.y;
- mapObject->coords2.x += x;
- mapObject->coords2.y += y;
+ mapObject->previousCoords.x = mapObject->currentCoords.x;
+ mapObject->previousCoords.y = mapObject->currentCoords.y;
+ mapObject->currentCoords.x += x;
+ mapObject->currentCoords.y += y;
}
void npc_coords_shift(struct MapObject *mapObject, s16 x, s16 y)
{
- mapObject->coords3.x = mapObject->coords2.x;
- mapObject->coords3.y = mapObject->coords2.y;
- mapObject->coords2.x = x;
- mapObject->coords2.y = y;
+ mapObject->previousCoords.x = mapObject->currentCoords.x;
+ mapObject->previousCoords.y = mapObject->currentCoords.y;
+ mapObject->currentCoords.x = x;
+ mapObject->currentCoords.y = y;
}
void npc_coords_set(struct MapObject *mapObject, s16 x, s16 y)
{
- mapObject->coords3.x = x;
- mapObject->coords3.y = y;
- mapObject->coords2.x = x;
- mapObject->coords2.y = y;
+ mapObject->previousCoords.x = x;
+ mapObject->previousCoords.y = y;
+ mapObject->currentCoords.x = x;
+ mapObject->currentCoords.y = y;
}
void sub_805C058(struct MapObject *mapObject, s16 x, s16 y)
@@ -2813,13 +2813,13 @@ void sub_805C058(struct MapObject *mapObject, s16 x, s16 y)
const struct MapObjectGraphicsInfo *gfxInfo = GetFieldObjectGraphicsInfo(mapObject->graphicsId);
npc_coords_set(mapObject, x, y);
- sub_80603CC(mapObject->coords2.x, mapObject->coords2.y, &sprite->pos1.x, &sprite->pos1.y);
+ sub_80603CC(mapObject->currentCoords.x, mapObject->currentCoords.y, &sprite->pos1.x, &sprite->pos1.y);
sprite->centerToCornerVecX = -(gfxInfo->width >> 1);
sprite->centerToCornerVecY = -(gfxInfo->height >> 1);
sprite->pos1.x += 8;
sprite->pos1.y += 16 + sprite->centerToCornerVecY;
sub_805B914(mapObject);
- if (mapObject->mapobj_bit_15)
+ if (mapObject->trackedByCamera)
CameraObjectReset1();
}
@@ -2837,7 +2837,7 @@ void sub_805C0F8(u8 localId, u8 mapNum, u8 mapGroup, s16 x, s16 y)
void npc_coords_shift_still(struct MapObject *mapObject)
{
- npc_coords_shift(mapObject, mapObject->coords2.x, mapObject->coords2.y);
+ npc_coords_shift(mapObject, mapObject->currentCoords.x, mapObject->currentCoords.y);
}
void UpdateFieldObjectCoordsForCameraUpdate(void)
@@ -2855,12 +2855,12 @@ void UpdateFieldObjectCoordsForCameraUpdate(void)
if (gMapObjects[i].active)
{
- gMapObjects[i].coords1.x -= deltaX;
- gMapObjects[i].coords1.y -= deltaY;
- gMapObjects[i].coords2.x -= deltaX;
- gMapObjects[i].coords2.y -= deltaY;
- gMapObjects[i].coords3.x -= deltaX;
- gMapObjects[i].coords3.y -= deltaY;
+ gMapObjects[i].initialCoords.x -= deltaX;
+ gMapObjects[i].initialCoords.y -= deltaY;
+ gMapObjects[i].currentCoords.x -= deltaX;
+ gMapObjects[i].currentCoords.y -= deltaY;
+ gMapObjects[i].previousCoords.x -= deltaX;
+ gMapObjects[i].previousCoords.y -= deltaY;
}
}
}
@@ -2874,7 +2874,7 @@ u8 GetFieldObjectIdByXYZ(u16 x, u16 y, u8 z)
for (i = 0; i < 16; i++)
{
- if (gMapObjects[i].active && gMapObjects[i].coords2.x == x && gMapObjects[i].coords2.y == y
+ if (gMapObjects[i].active && gMapObjects[i].currentCoords.x == x && gMapObjects[i].currentCoords.y == y
&& FieldObjectDoesZCoordMatch(&gMapObjects[i], z))
return i;
}
@@ -2883,8 +2883,8 @@ u8 GetFieldObjectIdByXYZ(u16 x, u16 y, u8 z)
bool8 FieldObjectDoesZCoordMatch(struct MapObject *mapObject, u8 z)
{
- if (mapObject->mapobj_unk_0B_0 != 0 && z != 0
- && mapObject->mapobj_unk_0B_0 != z)
+ if (mapObject->currentElevation != 0 && z != 0
+ && mapObject->currentElevation != z)
return FALSE;
else
return TRUE;
@@ -3030,13 +3030,13 @@ u8 obj_unfreeze(struct Sprite *src, s16 x, s16 y, u8 subpriority)
void FieldObjectSetDirection(struct MapObject *mapObject, u8 direction)
{
- mapObject->mapobj_unk_20 = mapObject->mapobj_unk_18;
- if (!mapObject->mapobj_bit_9)
+ mapObject->previousMovementDirection = mapObject->facingDirection;
+ if (!mapObject->facingDirectionLocked)
{
s8 _direction = direction; //needed for the asm to match
- mapObject->mapobj_unk_18 = _direction;
+ mapObject->facingDirection = _direction;
}
- mapObject->placeholder18 = direction;
+ mapObject->movementDirection = direction;
}
u8 *GetFieldObjectScriptPointerByLocalIdAndMap(u8 localId, u8 mapNum, u8 mapGroup)
@@ -3141,8 +3141,8 @@ void sub_805C754(struct MapObject *mapObject)
if (template != NULL)
{
- template->x = mapObject->coords2.x - 7;
- template->y = mapObject->coords2.y - 7;
+ template->x = mapObject->currentCoords.x - 7;
+ template->y = mapObject->currentCoords.y - 7;
}
}
@@ -3201,7 +3201,7 @@ extern void FieldObjectSetRegularAnim(struct MapObject *, struct Sprite *, u8);
u8 sub_805C904(struct MapObject *mapObject, struct Sprite *sprite)
{
- FieldObjectSetRegularAnim(mapObject, sprite, GetFaceDirectionAnimId(mapObject->mapobj_unk_18));
+ FieldObjectSetRegularAnim(mapObject, sprite, GetFaceDirectionAnimId(mapObject->facingDirection));
sprite->data[1] = 2;
return 1;
}
@@ -3251,8 +3251,8 @@ u8 sub_805C98C(struct MapObject *mapObject, struct Sprite *sprite)
u8 sub_805C9D8(struct MapObject *mapObject, struct Sprite *sprite)
{
- FieldObjectSetRegularAnim(mapObject, sprite, GetGoSpeed0AnimId(mapObject->placeholder18));
- mapObject->mapobj_bit_1 = 1;
+ FieldObjectSetRegularAnim(mapObject, sprite, GetGoSpeed0AnimId(mapObject->movementDirection));
+ mapObject->regularAnimActive = 1;
sprite->data[1] = 6;
return 1;
}
@@ -3261,7 +3261,7 @@ u8 sub_805CA08(struct MapObject *mapObject, struct Sprite *sprite)
{
if (FieldObjectExecRegularAnim(mapObject, sprite) != 0)
{
- mapObject->mapobj_bit_1 = 0;
+ mapObject->regularAnimActive = 0;
sprite->data[1] = 1;
}
return 0;
@@ -3286,8 +3286,8 @@ u8 FieldObjectIsTrainerAndCloseToPlayer(struct MapObject *mapObject)
return 0;
}
PlayerGetDestCoords(&x, &y);
- objx = mapObject->coords2.x;
- objy = mapObject->coords2.y;
+ objx = mapObject->currentCoords.x;
+ objy = mapObject->currentCoords.y;
minx = objx - mapObject->trainerRange_berryTreeId;
miny = objy - mapObject->trainerRange_berryTreeId;
maxx = objx + mapObject->trainerRange_berryTreeId;
@@ -3489,8 +3489,8 @@ u8 sub_805CD60(struct MapObject *mapObject, u8 a1)
return 0;
}
PlayerGetDestCoords(&x, &y);
- x -= mapObject->coords2.x;
- y -= mapObject->coords2.y;
+ x -= mapObject->currentCoords.x;
+ y -= mapObject->currentCoords.y;
x2 = x;
y2 = y;
if (x2 < 0)
@@ -3515,7 +3515,7 @@ u8 sub_805CE2C(struct MapObject *mapObject, struct Sprite *sprite)
u8 sub_805CE40(struct MapObject *mapObject, struct Sprite *sprite)
{
- FieldObjectSetRegularAnim(mapObject, sprite, GetFaceDirectionAnimId(mapObject->mapobj_unk_18));
+ FieldObjectSetRegularAnim(mapObject, sprite, GetFaceDirectionAnimId(mapObject->facingDirection));
sprite->data[1] = 2;
return 1;
}
@@ -3525,7 +3525,7 @@ u8 sub_805CE6C(struct MapObject *mapObject, struct Sprite *sprite)
if (FieldObjectExecRegularAnim(mapObject, sprite) != 0)
{
sub_8064820(sprite, gUnknown_0837520C[Random() & 3]);
- mapObject->mapobj_bit_1 = 0;
+ mapObject->regularAnimActive = 0;
sprite->data[1] = 3;
}
return 0;
@@ -3567,7 +3567,7 @@ u8 sub_805CF6C(struct MapObject *mapObject, struct Sprite *sprite)
u8 sub_805CF80(struct MapObject *mapObject, struct Sprite *sprite)
{
- FieldObjectSetRegularAnim(mapObject, sprite, GetFaceDirectionAnimId(mapObject->mapobj_unk_18));
+ FieldObjectSetRegularAnim(mapObject, sprite, GetFaceDirectionAnimId(mapObject->facingDirection));
sprite->data[1] = 2;
return 1;
}
@@ -3610,8 +3610,8 @@ u8 sub_805D008(struct MapObject *mapObject, struct Sprite *sprite)
u8 sub_805D054(struct MapObject *mapObject, struct Sprite *sprite)
{
- FieldObjectSetRegularAnim(mapObject, sprite, GetGoSpeed0AnimId(mapObject->placeholder18));
- mapObject->mapobj_bit_1 = 1;
+ FieldObjectSetRegularAnim(mapObject, sprite, GetGoSpeed0AnimId(mapObject->movementDirection));
+ mapObject->regularAnimActive = 1;
sprite->data[1] = 6;
return 1;
}
@@ -3620,7 +3620,7 @@ u8 sub_805D084(struct MapObject *mapObject, struct Sprite *sprite)
{
if (FieldObjectExecRegularAnim(mapObject, sprite) != 0)
{
- mapObject->mapobj_bit_1 = 0;
+ mapObject->regularAnimActive = 0;
sprite->data[1] = 1;
}
return 0;
@@ -3637,7 +3637,7 @@ u8 sub_805D0F0(struct MapObject *mapObject, struct Sprite *sprite)
u8 sub_805D104(struct MapObject *mapObject, struct Sprite *sprite)
{
- FieldObjectSetRegularAnim(mapObject, sprite, GetFaceDirectionAnimId(mapObject->mapobj_unk_18));
+ FieldObjectSetRegularAnim(mapObject, sprite, GetFaceDirectionAnimId(mapObject->facingDirection));
sprite->data[1] = 2;
return 1;
}
@@ -3680,8 +3680,8 @@ u8 sub_805D18C(struct MapObject *mapObject, struct Sprite *sprite)
u8 sub_805D1D8(struct MapObject *mapObject, struct Sprite *sprite)
{
- FieldObjectSetRegularAnim(mapObject, sprite, GetGoSpeed0AnimId(mapObject->placeholder18));
- mapObject->mapobj_bit_1 = 1;
+ FieldObjectSetRegularAnim(mapObject, sprite, GetGoSpeed0AnimId(mapObject->movementDirection));
+ mapObject->regularAnimActive = 1;
sprite->data[1] = 6;
return 1;
}
@@ -3690,7 +3690,7 @@ u8 sub_805D208(struct MapObject *mapObject, struct Sprite *sprite)
{
if (FieldObjectExecRegularAnim(mapObject, sprite) != 0)
{
- mapObject->mapobj_bit_1 = 0;
+ mapObject->regularAnimActive = 0;
sprite->data[1] = 1;
}
return 0;
@@ -3701,7 +3701,7 @@ fieldmap_object_cb(sub_805D230, sub_805D254, gUnknown_083752C4);
u8 sub_805D274(struct MapObject *mapObject, struct Sprite *sprite)
{
npc_reset(mapObject, sprite);
- FieldObjectSetRegularAnim(mapObject, sprite, GetFaceDirectionAnimId(mapObject->mapobj_unk_18));
+ FieldObjectSetRegularAnim(mapObject, sprite, GetFaceDirectionAnimId(mapObject->facingDirection));
sprite->data[1] = 1;
return 1;
}
@@ -3718,7 +3718,7 @@ u8 sub_805D2A0(struct MapObject *mapObject, struct Sprite *sprite)
u8 sub_805D2C0(struct MapObject *mapObject, struct Sprite *sprite)
{
- mapObject->mapobj_bit_1 = 0;
+ mapObject->regularAnimActive = 0;
return 0;
}
@@ -3745,15 +3745,15 @@ u8 do_berry_tree_growth_sparkle_1(struct MapObject *mapObject, struct Sprite *sp
{
u8 berryTreeStage;
npc_reset(mapObject, sprite);
- mapObject->mapobj_bit_13 = 1;
+ mapObject->invisible = 1;
sprite->invisible = 1;
berryTreeStage = GetStageByBerryTreeId(mapObject->trainerRange_berryTreeId);
if (!berryTreeStage)
{
if (!(sprite->data[7] & 4) && sprite->animNum == 4)
{
- gFieldEffectArguments[0] = mapObject->coords2.x;
- gFieldEffectArguments[1] = mapObject->coords2.y;
+ gFieldEffectArguments[0] = mapObject->currentCoords.x;
+ gFieldEffectArguments[1] = mapObject->currentCoords.y;
gFieldEffectArguments[2] = sprite->subpriority - 1;
gFieldEffectArguments[3] = sprite->oam.priority;
FieldEffectStart(FLDEFF_BERRY_TREE_GROWTH_SPARKLE);
@@ -3761,7 +3761,7 @@ u8 do_berry_tree_growth_sparkle_1(struct MapObject *mapObject, struct Sprite *sp
}
return 0;
}
- mapObject->mapobj_bit_13 = 0;
+ mapObject->invisible = 0;
sprite->invisible = 0;
berryTreeStage--;
if (sprite->animNum != berryTreeStage)
@@ -3787,12 +3787,12 @@ u8 sub_805D3EC(struct MapObject *mapObject, struct Sprite *sprite)
u8 do_berry_tree_growth_sparkle_2(struct MapObject *mapObject, struct Sprite *sprite)
{
- mapObject->mapobj_bit_1 = 1;
+ mapObject->regularAnimActive = 1;
sprite->data[1] = 3;
sprite->data[2] = 0;
sprite->data[7] |= 2;
- gFieldEffectArguments[0] = mapObject->coords2.x;
- gFieldEffectArguments[1] = mapObject->coords2.y;
+ gFieldEffectArguments[0] = mapObject->currentCoords.x;
+ gFieldEffectArguments[1] = mapObject->currentCoords.y;
gFieldEffectArguments[2] = sprite->subpriority - 1;
gFieldEffectArguments[3] = sprite->oam.priority;
FieldEffectStart(FLDEFF_BERRY_TREE_GROWTH_SPARKLE);
@@ -3802,7 +3802,7 @@ u8 do_berry_tree_growth_sparkle_2(struct MapObject *mapObject, struct Sprite *sp
u8 sub_805D458(struct MapObject *mapObject, struct Sprite *sprite)
{
sprite->data[2]++;
- mapObject->mapobj_bit_13 = ((sprite->data[2] & 0x2) >> 1);
+ mapObject->invisible = ((sprite->data[2] & 0x2) >> 1);
sprite->animPaused = 1;
if (sprite->data[2] > 64)
{
@@ -3817,7 +3817,7 @@ u8 sub_805D458(struct MapObject *mapObject, struct Sprite *sprite)
u8 sub_805D4A8(struct MapObject *mapObject, struct Sprite *sprite)
{
sprite->data[2]++;
- mapObject->mapobj_bit_13 = ((sprite->data[2] & 0x2) >> 1);
+ mapObject->invisible = ((sprite->data[2] & 0x2) >> 1);
sprite->animPaused = 1;
if (sprite->data[2] > 64)
{
@@ -3839,7 +3839,7 @@ u8 sub_805D538(struct MapObject *mapObject, struct Sprite *sprite)
u8 sub_805D54C(struct MapObject *mapObject, struct Sprite *sprite)
{
- FieldObjectSetRegularAnim(mapObject, sprite, GetFaceDirectionAnimId(mapObject->mapobj_unk_18));
+ FieldObjectSetRegularAnim(mapObject, sprite, GetFaceDirectionAnimId(mapObject->facingDirection));
sprite->data[1] = 2;
return 1;
}
@@ -3849,7 +3849,7 @@ u8 sub_805D578(struct MapObject *mapObject, struct Sprite *sprite)
if (FieldObjectExecRegularAnim(mapObject, sprite))
{
sub_8064820(sprite, gUnknown_0837520C[Random() & 3]);
- mapObject->mapobj_bit_1 = 0;
+ mapObject->regularAnimActive = 0;
sprite->data[1] = 3;
}
return 0;
@@ -3891,7 +3891,7 @@ u8 sub_805D678(struct MapObject *mapObject, struct Sprite *sprite)
u8 sub_805D68C(struct MapObject *mapObject, struct Sprite *sprite)
{
- FieldObjectSetRegularAnim(mapObject, sprite, GetFaceDirectionAnimId(mapObject->mapobj_unk_18));
+ FieldObjectSetRegularAnim(mapObject, sprite, GetFaceDirectionAnimId(mapObject->facingDirection));
sprite->data[1] = 2;
return 1;
}
@@ -3901,7 +3901,7 @@ u8 sub_805D6B8(struct MapObject *mapObject, struct Sprite *sprite)
if (FieldObjectExecRegularAnim(mapObject, sprite))
{
sub_8064820(sprite, gUnknown_0837520C[Random() & 3]);
- mapObject->mapobj_bit_1 = 0;
+ mapObject->regularAnimActive = 0;
sprite->data[1] = 3;
}
return 0;
@@ -3943,7 +3943,7 @@ u8 sub_805D7B8(struct MapObject *mapObject, struct Sprite *sprite)
u8 sub_805D7CC(struct MapObject *mapObject, struct Sprite *sprite)
{
- FieldObjectSetRegularAnim(mapObject, sprite, GetFaceDirectionAnimId(mapObject->mapobj_unk_18));
+ FieldObjectSetRegularAnim(mapObject, sprite, GetFaceDirectionAnimId(mapObject->facingDirection));
sprite->data[1] = 2;
return 1;
}
@@ -3953,7 +3953,7 @@ u8 sub_805D7F8(struct MapObject *mapObject, struct Sprite *sprite)
if (FieldObjectExecRegularAnim(mapObject, sprite))
{
sub_8064820(sprite, gUnknown_0837521C[Random() & 3]);
- mapObject->mapobj_bit_1 = 0;
+ mapObject->regularAnimActive = 0;
sprite->data[1] = 3;
}
return 0;
@@ -3995,7 +3995,7 @@ u8 sub_805D8F8(struct MapObject *mapObject, struct Sprite *sprite)
u8 sub_805D90C(struct MapObject *mapObject, struct Sprite *sprite)
{
- FieldObjectSetRegularAnim(mapObject, sprite, GetFaceDirectionAnimId(mapObject->mapobj_unk_18));
+ FieldObjectSetRegularAnim(mapObject, sprite, GetFaceDirectionAnimId(mapObject->facingDirection));
sprite->data[1] = 2;
return 1;
}
@@ -4005,7 +4005,7 @@ u8 sub_805D938(struct MapObject *mapObject, struct Sprite *sprite)
if (FieldObjectExecRegularAnim(mapObject, sprite))
{
sub_8064820(sprite, gUnknown_0837521C[Random() & 3]);
- mapObject->mapobj_bit_1 = 0;
+ mapObject->regularAnimActive = 0;
sprite->data[1] = 3;
}
return 0;
@@ -4047,7 +4047,7 @@ u8 sub_805DA38(struct MapObject *mapObject, struct Sprite *sprite)
u8 sub_805DA4C(struct MapObject *mapObject, struct Sprite *sprite)
{
- FieldObjectSetRegularAnim(mapObject, sprite, GetFaceDirectionAnimId(mapObject->mapobj_unk_18));
+ FieldObjectSetRegularAnim(mapObject, sprite, GetFaceDirectionAnimId(mapObject->facingDirection));
sprite->data[1] = 2;
return 1;
}
@@ -4057,7 +4057,7 @@ u8 sub_805DA78(struct MapObject *mapObject, struct Sprite *sprite)
if (FieldObjectExecRegularAnim(mapObject, sprite))
{
sub_8064820(sprite, gUnknown_0837521C[Random() & 3]);
- mapObject->mapobj_bit_1 = 0;
+ mapObject->regularAnimActive = 0;
sprite->data[1] = 3;
}
return 0;
@@ -4099,7 +4099,7 @@ u8 sub_805DB78(struct MapObject *mapObject, struct Sprite *sprite)
u8 sub_805DB8C(struct MapObject *mapObject, struct Sprite *sprite)
{
- FieldObjectSetRegularAnim(mapObject, sprite, GetFaceDirectionAnimId(mapObject->mapobj_unk_18));
+ FieldObjectSetRegularAnim(mapObject, sprite, GetFaceDirectionAnimId(mapObject->facingDirection));
sprite->data[1] = 2;
return 1;
}
@@ -4109,7 +4109,7 @@ u8 sub_805DBB8(struct MapObject *mapObject, struct Sprite *sprite)
if (FieldObjectExecRegularAnim(mapObject, sprite))
{
sub_8064820(sprite, gUnknown_0837521C[Random() & 3]);
- mapObject->mapobj_bit_1 = 0;
+ mapObject->regularAnimActive = 0;
sprite->data[1] = 3;
}
return 0;
@@ -4151,7 +4151,7 @@ u8 sub_805DCB8(struct MapObject *mapObject, struct Sprite *sprite)
u8 sub_805DCCC(struct MapObject *mapObject, struct Sprite *sprite)
{
- FieldObjectSetRegularAnim(mapObject, sprite, GetFaceDirectionAnimId(mapObject->mapobj_unk_18));
+ FieldObjectSetRegularAnim(mapObject, sprite, GetFaceDirectionAnimId(mapObject->facingDirection));
sprite->data[1] = 2;
return 1;
}
@@ -4161,7 +4161,7 @@ u8 sub_805DCF8(struct MapObject *mapObject, struct Sprite *sprite)
if (FieldObjectExecRegularAnim(mapObject, sprite))
{
sub_8064820(sprite, gUnknown_0837521C[Random() & 3]);
- mapObject->mapobj_bit_1 = 0;
+ mapObject->regularAnimActive = 0;
sprite->data[1] = 3;
}
return 0;
@@ -4203,7 +4203,7 @@ u8 sub_805DDF8(struct MapObject *mapObject, struct Sprite *sprite)
u8 sub_805DE0C(struct MapObject *mapObject, struct Sprite *sprite)
{
- FieldObjectSetRegularAnim(mapObject, sprite, GetFaceDirectionAnimId(mapObject->mapobj_unk_18));
+ FieldObjectSetRegularAnim(mapObject, sprite, GetFaceDirectionAnimId(mapObject->facingDirection));
sprite->data[1] = 2;
return 1;
}
@@ -4213,7 +4213,7 @@ u8 sub_805DE38(struct MapObject *mapObject, struct Sprite *sprite)
if (FieldObjectExecRegularAnim(mapObject, sprite))
{
sub_8064820(sprite, gUnknown_0837521C[Random() & 3]);
- mapObject->mapobj_bit_1 = 0;
+ mapObject->regularAnimActive = 0;
sprite->data[1] = 3;
}
return 0;
@@ -4255,7 +4255,7 @@ u8 sub_805DF38(struct MapObject *mapObject, struct Sprite *sprite)
u8 sub_805DF4C(struct MapObject *mapObject, struct Sprite *sprite)
{
- FieldObjectSetRegularAnim(mapObject, sprite, GetFaceDirectionAnimId(mapObject->mapobj_unk_18));
+ FieldObjectSetRegularAnim(mapObject, sprite, GetFaceDirectionAnimId(mapObject->facingDirection));
sprite->data[1] = 2;
return 1;
}
@@ -4265,7 +4265,7 @@ u8 sub_805DF78(struct MapObject *mapObject, struct Sprite *sprite)
if (FieldObjectExecRegularAnim(mapObject, sprite))
{
sub_8064820(sprite, gUnknown_0837521C[Random() & 3]);
- mapObject->mapobj_bit_1 = 0;
+ mapObject->regularAnimActive = 0;
sprite->data[1] = 3;
}
return 0;
@@ -4307,7 +4307,7 @@ u8 sub_805E078(struct MapObject *mapObject, struct Sprite *sprite)
u8 sub_805E08C(struct MapObject *mapObject, struct Sprite *sprite)
{
- FieldObjectSetRegularAnim(mapObject, sprite, GetFaceDirectionAnimId(mapObject->mapobj_unk_18));
+ FieldObjectSetRegularAnim(mapObject, sprite, GetFaceDirectionAnimId(mapObject->facingDirection));
sprite->data[1] = 2;
return 1;
}
@@ -4317,7 +4317,7 @@ u8 sub_805E0B8(struct MapObject *mapObject, struct Sprite *sprite)
if (FieldObjectExecRegularAnim(mapObject, sprite))
{
sub_8064820(sprite, gUnknown_0837521C[Random() & 3]);
- mapObject->mapobj_bit_1 = 0;
+ mapObject->regularAnimActive = 0;
sprite->data[1] = 3;
}
return 0;
@@ -4353,7 +4353,7 @@ fieldmap_object_cb(sub_805E174, sub_805E198, gUnknown_083753CC);
u8 sub_805E1B8(struct MapObject *mapObject, struct Sprite *sprite)
{
npc_reset(mapObject, sprite);
- FieldObjectSetRegularAnim(mapObject, sprite, GetFaceDirectionAnimId(mapObject->mapobj_unk_18));
+ FieldObjectSetRegularAnim(mapObject, sprite, GetFaceDirectionAnimId(mapObject->facingDirection));
sprite->data[1] = 1;
return 1;
}
@@ -4385,7 +4385,7 @@ u8 sub_805E234(struct MapObject *mapObject, struct Sprite *sprite)
direction = sub_805CD60(mapObject, 0);
if (direction == 0)
{
- direction = directions[mapObject->mapobj_unk_18];
+ direction = directions[mapObject->facingDirection];
}
FieldObjectSetDirection(mapObject, direction);
sprite->data[1] = 0;
@@ -4397,7 +4397,7 @@ fieldmap_object_cb(sub_805E278, sub_803E29C, gUnknown_083753E4);
u8 sub_805E2BC(struct MapObject *mapObject, struct Sprite *sprite)
{
npc_reset(mapObject, sprite);
- FieldObjectSetRegularAnim(mapObject, sprite, GetFaceDirectionAnimId(mapObject->mapobj_unk_18));
+ FieldObjectSetRegularAnim(mapObject, sprite, GetFaceDirectionAnimId(mapObject->facingDirection));
sprite->data[1] = 1;
return 1;
}
@@ -4429,7 +4429,7 @@ u8 sub_805E338(struct MapObject *mapObject, struct Sprite *sprite)
direction = sub_805CD60(mapObject, 0);
if (direction == 0)
{
- direction = directions[mapObject->mapobj_unk_18];
+ direction = directions[mapObject->facingDirection];
}
FieldObjectSetDirection(mapObject, direction);
sprite->data[1] = 0;
@@ -4449,7 +4449,7 @@ u8 sub_805E3D4(struct MapObject *mapObject, struct Sprite *sprite)
{
u8 direction;
direction = gUnknown_0836DC09[mapObject->animPattern];
- if (mapObject->mapobj_unk_21 != 0)
+ if (mapObject->directionSequenceIndex != 0)
{
direction = GetOppositeDirection(direction);
}
@@ -4462,26 +4462,26 @@ u8 sub_805E40C(struct MapObject *mapObject, struct Sprite *sprite)
{
u8 v0;
u8 goSpeed0AnimId;
- if (mapObject->mapobj_unk_21 && mapObject->coords1.x == mapObject->coords2.x && mapObject->coords1.y == mapObject->coords2.y)
+ if (mapObject->directionSequenceIndex && mapObject->initialCoords.x == mapObject->currentCoords.x && mapObject->initialCoords.y == mapObject->currentCoords.y)
{
- mapObject->mapobj_unk_21 = 0;
- FieldObjectSetDirection(mapObject, GetOppositeDirection(mapObject->placeholder18));
+ mapObject->directionSequenceIndex = 0;
+ FieldObjectSetDirection(mapObject, GetOppositeDirection(mapObject->movementDirection));
}
- v0 = sub_805FF20(mapObject, mapObject->placeholder18);
- goSpeed0AnimId = GetGoSpeed0AnimId(mapObject->placeholder18);
+ v0 = sub_805FF20(mapObject, mapObject->movementDirection);
+ goSpeed0AnimId = GetGoSpeed0AnimId(mapObject->movementDirection);
if (v0 == 1)
{
- mapObject->mapobj_unk_21 ++;
- FieldObjectSetDirection(mapObject, GetOppositeDirection(mapObject->placeholder18));
- goSpeed0AnimId = GetGoSpeed0AnimId(mapObject->placeholder18);
- v0 = sub_805FF20(mapObject, mapObject->placeholder18);
+ mapObject->directionSequenceIndex ++;
+ FieldObjectSetDirection(mapObject, GetOppositeDirection(mapObject->movementDirection));
+ goSpeed0AnimId = GetGoSpeed0AnimId(mapObject->movementDirection);
+ v0 = sub_805FF20(mapObject, mapObject->movementDirection);
}
if (v0 != 0)
{
- goSpeed0AnimId = GetStepInPlaceDelay16AnimId(mapObject->mapobj_unk_18);
+ goSpeed0AnimId = GetStepInPlaceDelay16AnimId(mapObject->facingDirection);
}
FieldObjectSetRegularAnim(mapObject, sprite, goSpeed0AnimId);
- mapObject->mapobj_bit_1 = 1;
+ mapObject->regularAnimActive = 1;
sprite->data[1] = 3;
return 1;
}
@@ -4490,7 +4490,7 @@ u8 sub_805E4C4(struct MapObject *mapObject, struct Sprite *sprite)
{
if (FieldObjectExecRegularAnim(mapObject, sprite))
{
- mapObject->mapobj_bit_1 = 0;
+ mapObject->regularAnimActive = 0;
sprite->data[1] = 1;
}
return 0;
@@ -4507,26 +4507,26 @@ u8 MoveFieldObjectInNextDirectionInSequence(struct MapObject *mapObject, struct
{
u8 v0;
u8 goSpeed0AnimId;
- if (mapObject->mapobj_unk_21 == 3 && mapObject->coords1.x == mapObject->coords2.x && mapObject->coords1.y == mapObject->coords2.y)
+ if (mapObject->directionSequenceIndex == 3 && mapObject->initialCoords.x == mapObject->currentCoords.x && mapObject->initialCoords.y == mapObject->currentCoords.y)
{
- mapObject->mapobj_unk_21 = 0;
+ mapObject->directionSequenceIndex = 0;
}
- FieldObjectSetDirection(mapObject, directionSequence[mapObject->mapobj_unk_21]);
- goSpeed0AnimId = GetGoSpeed0AnimId(mapObject->placeholder18);
- v0 = sub_805FF20(mapObject, mapObject->placeholder18);
+ FieldObjectSetDirection(mapObject, directionSequence[mapObject->directionSequenceIndex]);
+ goSpeed0AnimId = GetGoSpeed0AnimId(mapObject->movementDirection);
+ v0 = sub_805FF20(mapObject, mapObject->movementDirection);
if (v0 == 1)
{
- mapObject->mapobj_unk_21 ++;
- FieldObjectSetDirection(mapObject, directionSequence[mapObject->mapobj_unk_21]);
- goSpeed0AnimId = GetGoSpeed0AnimId(mapObject->placeholder18);
- v0 = sub_805FF20(mapObject, mapObject->placeholder18);
+ mapObject->directionSequenceIndex++;
+ FieldObjectSetDirection(mapObject, directionSequence[mapObject->directionSequenceIndex]);
+ goSpeed0AnimId = GetGoSpeed0AnimId(mapObject->movementDirection);
+ v0 = sub_805FF20(mapObject, mapObject->movementDirection);
}
if (v0 != 0)
{
- goSpeed0AnimId = GetStepInPlaceDelay16AnimId(mapObject->mapobj_unk_18);
+ goSpeed0AnimId = GetStepInPlaceDelay16AnimId(mapObject->facingDirection);
}
FieldObjectSetRegularAnim(mapObject, sprite, goSpeed0AnimId);
- mapObject->mapobj_bit_1 = 1;
+ mapObject->regularAnimActive = 1;
sprite->data[1] = 2;
return 1;
}
@@ -4535,7 +4535,7 @@ u8 sub_805E5B4(struct MapObject *mapObject, struct Sprite *sprite)
{
if (FieldObjectExecRegularAnim(mapObject, sprite))
{
- mapObject->mapobj_bit_1 = 0;
+ mapObject->regularAnimActive = 0;
sprite->data[1] = 1;
}
return 0;
@@ -4547,9 +4547,9 @@ u8 sub_805E620(struct MapObject *mapObject, struct Sprite *sprite)
{
u8 directions[4];
memcpy(directions, gUnknown_08375418, 4);
- if (mapObject->mapobj_unk_21 == 2 && mapObject->coords1.x == mapObject->coords2.x)
+ if (mapObject->directionSequenceIndex == 2 && mapObject->initialCoords.x == mapObject->currentCoords.x)
{
- mapObject->mapobj_unk_21 = 3;
+ mapObject->directionSequenceIndex = 3;
}
return MoveFieldObjectInNextDirectionInSequence(mapObject, sprite, directions);
}
@@ -4560,9 +4560,9 @@ u8 sub_805E6AC(struct MapObject *mapObject, struct Sprite *sprite)
{
u8 directions[4];
memcpy(directions, gUnknown_08375428, 4);
- if (mapObject->mapobj_unk_21 == 1 && mapObject->coords1.x == mapObject->coords2.x)
+ if (mapObject->directionSequenceIndex == 1 && mapObject->initialCoords.x == mapObject->currentCoords.x)
{
- mapObject->mapobj_unk_21 = 2;
+ mapObject->directionSequenceIndex = 2;
}
return MoveFieldObjectInNextDirectionInSequence(mapObject, sprite, directions);
}
@@ -4573,9 +4573,9 @@ u8 sub_805E738(struct MapObject *mapObject, struct Sprite *sprite)
{
u8 directions[4];
memcpy(directions, gUnknown_08375438, 4);
- if (mapObject->mapobj_unk_21 == 1 && mapObject->coords1.y == mapObject->coords2.y)
+ if (mapObject->directionSequenceIndex == 1 && mapObject->initialCoords.y == mapObject->currentCoords.y)
{
- mapObject->mapobj_unk_21 = 2;
+ mapObject->directionSequenceIndex = 2;
}
return MoveFieldObjectInNextDirectionInSequence(mapObject, sprite, directions);
}
@@ -4586,9 +4586,9 @@ u8 sub_805E7C4(struct MapObject *mapObject, struct Sprite *sprite)
{
u8 directions[4];
memcpy(directions, gUnknown_08375448, 4);
- if (mapObject->mapobj_unk_21 == 2 && mapObject->coords1.y == mapObject->coords2.y)
+ if (mapObject->directionSequenceIndex == 2 && mapObject->initialCoords.y == mapObject->currentCoords.y)
{
- mapObject->mapobj_unk_21 = 3;
+ mapObject->directionSequenceIndex = 3;
}
return MoveFieldObjectInNextDirectionInSequence(mapObject, sprite, directions);
}
@@ -4601,9 +4601,9 @@ u8 sub_805E850(struct MapObject *mapObject, struct Sprite *sprite)
{
u8 directions[4];
memcpy(directions, gUnknown_08375458, 4);
- if (mapObject->mapobj_unk_21 == 2 && mapObject->coords1.x == mapObject->coords2.x)
+ if (mapObject->directionSequenceIndex == 2 && mapObject->initialCoords.x == mapObject->currentCoords.x)
{
- mapObject->mapobj_unk_21 = 3;
+ mapObject->directionSequenceIndex = 3;
}
return MoveFieldObjectInNextDirectionInSequence(mapObject, sprite, directions);
}
@@ -4614,9 +4614,9 @@ u8 sub_805E8DC(struct MapObject *mapObject, struct Sprite *sprite)
{
u8 directions[4];
memcpy(directions, gUnknown_08375468, 4);
- if (mapObject->mapobj_unk_21 == 1 && mapObject->coords1.x == mapObject->coords2.x)
+ if (mapObject->directionSequenceIndex == 1 && mapObject->initialCoords.x == mapObject->currentCoords.x)
{
- mapObject->mapobj_unk_21 = 2;
+ mapObject->directionSequenceIndex = 2;
}
return MoveFieldObjectInNextDirectionInSequence(mapObject, sprite, directions);
}
@@ -4627,9 +4627,9 @@ u8 sub_805E968(struct MapObject *mapObject, struct Sprite *sprite)
{
u8 directions[4];
memcpy(directions, gUnknown_08375240, 4);
- if (mapObject->mapobj_unk_21 == 1 && mapObject->coords1.y == mapObject->coords2.y)
+ if (mapObject->directionSequenceIndex == 1 && mapObject->initialCoords.y == mapObject->currentCoords.y)
{
- mapObject->mapobj_unk_21 = 2;
+ mapObject->directionSequenceIndex = 2;
}
return MoveFieldObjectInNextDirectionInSequence(mapObject, sprite, directions);
}
@@ -4640,9 +4640,9 @@ u8 sub_805E9F4(struct MapObject *mapObject, struct Sprite *sprite)
{
u8 directions[4];
memcpy(directions, gUnknown_08375484, 4);
- if (mapObject->mapobj_unk_21 == 2 && mapObject->coords1.y == mapObject->coords2.y)
+ if (mapObject->directionSequenceIndex == 2 && mapObject->initialCoords.y == mapObject->currentCoords.y)
{
- mapObject->mapobj_unk_21 = 3;
+ mapObject->directionSequenceIndex = 3;
}
return MoveFieldObjectInNextDirectionInSequence(mapObject, sprite, directions);
}
@@ -4653,9 +4653,9 @@ u8 sub_805EA80(struct MapObject *mapObject, struct Sprite *sprite)
{
u8 directions[4];
memcpy(directions, gUnknown_08375494, 4);
- if (mapObject->mapobj_unk_21 == 2 && mapObject->coords1.y == mapObject->coords2.y)
+ if (mapObject->directionSequenceIndex == 2 && mapObject->initialCoords.y == mapObject->currentCoords.y)
{
- mapObject->mapobj_unk_21 = 3;
+ mapObject->directionSequenceIndex = 3;
}
return MoveFieldObjectInNextDirectionInSequence(mapObject, sprite, directions);
}
@@ -4666,9 +4666,9 @@ u8 sub_805EB0C(struct MapObject *mapObject, struct Sprite *sprite)
{
u8 directions[4];
memcpy(directions, gUnknown_083754A4, 4);
- if (mapObject->mapobj_unk_21 == 1 && mapObject->coords1.y == mapObject->coords2.y)
+ if (mapObject->directionSequenceIndex == 1 && mapObject->initialCoords.y == mapObject->currentCoords.y)
{
- mapObject->mapobj_unk_21 = 2;
+ mapObject->directionSequenceIndex = 2;
}
return MoveFieldObjectInNextDirectionInSequence(mapObject, sprite, directions);
}
@@ -4679,9 +4679,9 @@ u8 sub_805EB98(struct MapObject *mapObject, struct Sprite *sprite)
{
u8 directions[4];
memcpy(directions, gUnknown_083754B4, 4);
- if (mapObject->mapobj_unk_21 == 1 && mapObject->coords1.x == mapObject->coords2.x)
+ if (mapObject->directionSequenceIndex == 1 && mapObject->initialCoords.x == mapObject->currentCoords.x)
{
- mapObject->mapobj_unk_21 = 2;
+ mapObject->directionSequenceIndex = 2;
}
return MoveFieldObjectInNextDirectionInSequence(mapObject, sprite, directions);
}
@@ -4692,9 +4692,9 @@ u8 sub_805EC24(struct MapObject *mapObject, struct Sprite *sprite)
{
u8 directions[4];
memcpy(directions, gUnknown_083754C4, 4);
- if (mapObject->mapobj_unk_21 == 2 && mapObject->coords1.x == mapObject->coords2.x)
+ if (mapObject->directionSequenceIndex == 2 && mapObject->initialCoords.x == mapObject->currentCoords.x)
{
- mapObject->mapobj_unk_21 = 3;
+ mapObject->directionSequenceIndex = 3;
}
return MoveFieldObjectInNextDirectionInSequence(mapObject, sprite, directions);
}
@@ -4705,9 +4705,9 @@ u8 sub_805ECB0(struct MapObject *mapObject, struct Sprite *sprite)
{
u8 directions[4];
memcpy(directions, gUnknown_083754D4, 4);
- if (mapObject->mapobj_unk_21 == 2 && mapObject->coords1.y == mapObject->coords2.y)
+ if (mapObject->directionSequenceIndex == 2 && mapObject->initialCoords.y == mapObject->currentCoords.y)
{
- mapObject->mapobj_unk_21 = 3;
+ mapObject->directionSequenceIndex = 3;
}
return MoveFieldObjectInNextDirectionInSequence(mapObject, sprite, directions);
}
@@ -4718,9 +4718,9 @@ u8 sub_805ED3C(struct MapObject *mapObject, struct Sprite *sprite)
{
u8 directions[4];
memcpy(directions, gUnknown_083754E4, 4);
- if (mapObject->mapobj_unk_21 == 1 && mapObject->coords1.y == mapObject->coords2.y)
+ if (mapObject->directionSequenceIndex == 1 && mapObject->initialCoords.y == mapObject->currentCoords.y)
{
- mapObject->mapobj_unk_21 = 2;
+ mapObject->directionSequenceIndex = 2;
}
return MoveFieldObjectInNextDirectionInSequence(mapObject, sprite, directions);
}
@@ -4731,9 +4731,9 @@ u8 sub_805EDC8(struct MapObject *mapObject, struct Sprite *sprite)
{
u8 directions[4];
memcpy(directions, gUnknown_083754F4, 4);
- if (mapObject->mapobj_unk_21 == 1 && mapObject->coords1.x == mapObject->coords2.x)
+ if (mapObject->directionSequenceIndex == 1 && mapObject->initialCoords.x == mapObject->currentCoords.x)
{
- mapObject->mapobj_unk_21 = 2;
+ mapObject->directionSequenceIndex = 2;
}
return MoveFieldObjectInNextDirectionInSequence(mapObject, sprite, directions);
}
@@ -4744,9 +4744,9 @@ u8 sub_805EE54(struct MapObject *mapObject, struct Sprite *sprite)
{
u8 directions[4];
memcpy(directions, gUnknown_08375504, 4);
- if (mapObject->mapobj_unk_21 == 2 && mapObject->coords1.x == mapObject->coords2.x)
+ if (mapObject->directionSequenceIndex == 2 && mapObject->initialCoords.x == mapObject->currentCoords.x)
{
- mapObject->mapobj_unk_21 = 3;
+ mapObject->directionSequenceIndex = 3;
}
return MoveFieldObjectInNextDirectionInSequence(mapObject, sprite, directions);
}
@@ -4757,9 +4757,9 @@ u8 sub_805EEE0(struct MapObject *mapObject, struct Sprite *sprite)
{
u8 directions[4];
memcpy(directions, gUnknown_08375514, 4);
- if (mapObject->mapobj_unk_21 == 2 && mapObject->coords1.y == mapObject->coords2.y)
+ if (mapObject->directionSequenceIndex == 2 && mapObject->initialCoords.y == mapObject->currentCoords.y)
{
- mapObject->mapobj_unk_21 = 3;
+ mapObject->directionSequenceIndex = 3;
}
return MoveFieldObjectInNextDirectionInSequence(mapObject, sprite, directions);
}
@@ -4770,9 +4770,9 @@ u8 sub_805EF6C(struct MapObject *mapObject, struct Sprite *sprite)
{
u8 directions[4];
memcpy(directions, gUnknown_08375524, 4);
- if (mapObject->mapobj_unk_21 == 2 && mapObject->coords1.y == mapObject->coords2.y)
+ if (mapObject->directionSequenceIndex == 2 && mapObject->initialCoords.y == mapObject->currentCoords.y)
{
- mapObject->mapobj_unk_21 = 3;
+ mapObject->directionSequenceIndex = 3;
}
return MoveFieldObjectInNextDirectionInSequence(mapObject, sprite, directions);
}
@@ -4783,9 +4783,9 @@ u8 sub_805EFF8(struct MapObject *mapObject, struct Sprite *sprite)
{
u8 directions[4];
memcpy(directions, gUnknown_08375534, 4);
- if (mapObject->mapobj_unk_21 == 2 && mapObject->coords1.x == mapObject->coords2.x)
+ if (mapObject->directionSequenceIndex == 2 && mapObject->initialCoords.x == mapObject->currentCoords.x)
{
- mapObject->mapobj_unk_21 = 3;
+ mapObject->directionSequenceIndex = 3;
}
return MoveFieldObjectInNextDirectionInSequence(mapObject, sprite, directions);
}
@@ -4796,9 +4796,9 @@ u8 sub_805F084(struct MapObject *mapObject, struct Sprite *sprite)
{
u8 directions[4];
memcpy(directions, gUnknown_08375544, 4);
- if (mapObject->mapobj_unk_21 == 2 && mapObject->coords1.x == mapObject->coords2.x)
+ if (mapObject->directionSequenceIndex == 2 && mapObject->initialCoords.x == mapObject->currentCoords.x)
{
- mapObject->mapobj_unk_21 = 3;
+ mapObject->directionSequenceIndex = 3;
}
return MoveFieldObjectInNextDirectionInSequence(mapObject, sprite, directions);
}
@@ -4809,9 +4809,9 @@ u8 sub_805F110(struct MapObject *mapObject, struct Sprite *sprite)
{
u8 directions[4];
memcpy(directions, gUnknown_08375554, 4);
- if (mapObject->mapobj_unk_21 == 2 && mapObject->coords1.y == mapObject->coords2.y)
+ if (mapObject->directionSequenceIndex == 2 && mapObject->initialCoords.y == mapObject->currentCoords.y)
{
- mapObject->mapobj_unk_21 = 3;
+ mapObject->directionSequenceIndex = 3;
}
return MoveFieldObjectInNextDirectionInSequence(mapObject, sprite, directions);
}
@@ -4822,9 +4822,9 @@ u8 sub_805F19C(struct MapObject *mapObject, struct Sprite *sprite)
{
u8 directions[4];
memcpy(directions, gUnknown_08375564, 4);
- if (mapObject->mapobj_unk_21 == 2 && mapObject->coords1.y == mapObject->coords2.y)
+ if (mapObject->directionSequenceIndex == 2 && mapObject->initialCoords.y == mapObject->currentCoords.y)
{
- mapObject->mapobj_unk_21 = 3;
+ mapObject->directionSequenceIndex = 3;
}
return MoveFieldObjectInNextDirectionInSequence(mapObject, sprite, directions);
}
@@ -4835,9 +4835,9 @@ u8 sub_805F228(struct MapObject *mapObject, struct Sprite *sprite)
{
u8 directions[4];
memcpy(directions, gUnknown_08375574, 4);
- if (mapObject->mapobj_unk_21 == 2 && mapObject->coords1.x == mapObject->coords2.x)
+ if (mapObject->directionSequenceIndex == 2 && mapObject->initialCoords.x == mapObject->currentCoords.x)
{
- mapObject->mapobj_unk_21 = 3;
+ mapObject->directionSequenceIndex = 3;
}
return MoveFieldObjectInNextDirectionInSequence(mapObject, sprite, directions);
}
@@ -4848,9 +4848,9 @@ u8 sub_805F2B4(struct MapObject *mapObject, struct Sprite *sprite)
{
u8 directions[4];
memcpy(directions, gUnknown_08375584, 4);
- if (mapObject->mapobj_unk_21 == 2 && mapObject->coords1.x == mapObject->coords2.x)
+ if (mapObject->directionSequenceIndex == 2 && mapObject->initialCoords.x == mapObject->currentCoords.x)
{
- mapObject->mapobj_unk_21 = 3;
+ mapObject->directionSequenceIndex = 3;
}
return MoveFieldObjectInNextDirectionInSequence(mapObject, sprite, directions);
};
@@ -4860,9 +4860,9 @@ fieldmap_object_cb(sub_805F2FC, sub_805F320, gUnknown_08375588);
u8 mss_npc_reset_oampriv3_1_unk2_unk3(struct MapObject *mapObject, struct Sprite *sprite)
{
npc_reset(mapObject, sprite);
- if (mapObject->mapobj_unk_21 == 0)
+ if (mapObject->directionSequenceIndex == 0)
{
- mapObject->mapobj_unk_21 = player_get_direction_lower_nybble();
+ mapObject->directionSequenceIndex = player_get_direction_lower_nybble();
}
sprite->data[1] = 1;
return 1;
@@ -4870,7 +4870,7 @@ u8 mss_npc_reset_oampriv3_1_unk2_unk3(struct MapObject *mapObject, struct Sprite
u8 sub_805F364(struct MapObject *mapObject, struct Sprite *sprite)
{
- if (gMapObjects[gPlayerAvatar.mapObjectId].mapobj_unk_1C == 0xFF || gPlayerAvatar.tileTransitionState == T_TILE_CENTER)
+ if (gMapObjects[gPlayerAvatar.mapObjectId].animId == 0xFF || gPlayerAvatar.tileTransitionState == T_TILE_CENTER)
{
return 0;
}
@@ -4881,7 +4881,7 @@ u8 sub_805F3C4(struct MapObject *mapObject, struct Sprite *sprite)
{
if (FieldObjectExecRegularAnim(mapObject, sprite))
{
- mapObject->mapobj_bit_1 = 0;
+ mapObject->regularAnimActive = 0;
sprite->data[1] = 1;
}
return 0;
@@ -4894,8 +4894,8 @@ bool8 sub_805F3EC(struct MapObject *mapObject, struct Sprite *sprite, u8 a2, boo
bool8 sub_805F3F0(struct MapObject *mapObject, struct Sprite *sprite, u8 a2, bool8 a3(u8))
{
- FieldObjectSetRegularAnim(mapObject, sprite, GetFaceDirectionAnimId(state_to_direction(gUnknown_0836DC09[mapObject->animPattern], mapObject->mapobj_unk_21, a2)));
- mapObject->mapobj_bit_1 = 1;
+ FieldObjectSetRegularAnim(mapObject, sprite, GetFaceDirectionAnimId(state_to_direction(gUnknown_0836DC09[mapObject->animPattern], mapObject->directionSequenceIndex, a2)));
+ mapObject->regularAnimActive = 1;
sprite->data[1] = 2;
return 1;
}
@@ -4907,14 +4907,14 @@ bool8 sub_805F438(struct MapObject *mapObject, struct Sprite *sprite, u8 a2, boo
s16 y;
direction = a2;
- direction = state_to_direction(gUnknown_0836DC09[mapObject->animPattern], mapObject->mapobj_unk_21, direction);
+ direction = state_to_direction(gUnknown_0836DC09[mapObject->animPattern], mapObject->directionSequenceIndex, direction);
FieldObjectMoveDestCoords(mapObject, direction, &x, &y);
FieldObjectSetRegularAnim(mapObject, sprite, GetGoSpeed0AnimId(direction));
if (npc_block_way(mapObject, x, y, direction) || (a3 != NULL && !a3(MapGridGetMetatileBehaviorAt(x, y))))
{
FieldObjectSetRegularAnim(mapObject, sprite, GetFaceDirectionAnimId(direction));
}
- mapObject->mapobj_bit_1 = 1;
+ mapObject->regularAnimActive = 1;
sprite->data[1] = 2;
return 1;
}
@@ -4926,14 +4926,14 @@ bool8 sub_805F4F0(struct MapObject *mapObject, struct Sprite *sprite, u8 playerD
s16 y;
direction = playerDirection;
- direction = state_to_direction(gUnknown_0836DC09[mapObject->animPattern], mapObject->mapobj_unk_21, direction);
+ direction = state_to_direction(gUnknown_0836DC09[mapObject->animPattern], mapObject->directionSequenceIndex, direction);
FieldObjectMoveDestCoords(mapObject, direction, &x, &y);
FieldObjectSetRegularAnim(mapObject, sprite, sub_8060744(direction));
if (npc_block_way(mapObject, x, y, direction) || (tileCB != NULL && !tileCB(MapGridGetMetatileBehaviorAt(x, y))))
{
FieldObjectSetRegularAnim(mapObject, sprite, GetFaceDirectionAnimId(direction));
}
- mapObject->mapobj_bit_1 = TRUE;
+ mapObject->regularAnimActive = TRUE;
sprite->data[1] = 2;
return TRUE;
}
@@ -4945,14 +4945,14 @@ bool8 sub_805F5A8(struct MapObject *mapObject, struct Sprite *sprite, u8 playerD
s16 y;
direction = playerDirection;
- direction = state_to_direction(gUnknown_0836DC09[mapObject->animPattern], mapObject->mapobj_unk_21, direction);
+ direction = state_to_direction(gUnknown_0836DC09[mapObject->animPattern], mapObject->directionSequenceIndex, direction);
FieldObjectMoveDestCoords(mapObject, direction, &x, &y);
FieldObjectSetRegularAnim(mapObject, sprite, sub_806079C(direction));
if (npc_block_way(mapObject, x, y, direction) || (tileCB != NULL && !tileCB(MapGridGetMetatileBehaviorAt(x, y))))
{
FieldObjectSetRegularAnim(mapObject, sprite, GetFaceDirectionAnimId(direction));
}
- mapObject->mapobj_bit_1 = TRUE;
+ mapObject->regularAnimActive = TRUE;
sprite->data[1] = 2;
return TRUE;
}
@@ -4964,14 +4964,14 @@ bool8 sub_805F660(struct MapObject *mapObject, struct Sprite *sprite, u8 playerD
s16 y;
direction = playerDirection;
- direction = state_to_direction(gUnknown_0836DC09[mapObject->animPattern], mapObject->mapobj_unk_21, direction);
+ direction = state_to_direction(gUnknown_0836DC09[mapObject->animPattern], mapObject->directionSequenceIndex, direction);
FieldObjectMoveDestCoords(mapObject, direction, &x, &y);
FieldObjectSetRegularAnim(mapObject, sprite, sub_80607C8(direction));
if (npc_block_way(mapObject, x, y, direction) || (tileCB != NULL && !tileCB(MapGridGetMetatileBehaviorAt(x, y))))
{
FieldObjectSetRegularAnim(mapObject, sprite, GetFaceDirectionAnimId(direction));
}
- mapObject->mapobj_bit_1 = TRUE;
+ mapObject->regularAnimActive = TRUE;
sprite->data[1] = 2;
return TRUE;
}
@@ -4981,9 +4981,9 @@ bool8 cph_IM_DIFFERENT(struct MapObject *mapObject, struct Sprite *sprite, u8 pl
u32 direction;
direction = playerDirection;
- direction = state_to_direction(gUnknown_0836DC09[mapObject->animPattern], mapObject->mapobj_unk_21, direction);
+ direction = state_to_direction(gUnknown_0836DC09[mapObject->animPattern], mapObject->directionSequenceIndex, direction);
FieldObjectSetRegularAnim(mapObject, sprite, sub_806084C(direction));
- mapObject->mapobj_bit_1 = TRUE;
+ mapObject->regularAnimActive = TRUE;
sprite->data[1] = 2;
return TRUE;
}
@@ -4995,14 +4995,14 @@ bool8 sub_805F760(struct MapObject *mapObject, struct Sprite *sprite, u8 playerD
s16 y;
direction = playerDirection;
- direction = state_to_direction(gUnknown_0836DC09[mapObject->animPattern], mapObject->mapobj_unk_21, direction);
+ direction = state_to_direction(gUnknown_0836DC09[mapObject->animPattern], mapObject->directionSequenceIndex, direction);
FieldObjectMoveDestCoords(mapObject, direction, &x, &y);
FieldObjectSetRegularAnim(mapObject, sprite, sub_80608A4(direction));
if (npc_block_way(mapObject, x, y, direction) || (tileCB != NULL && !tileCB(MapGridGetMetatileBehaviorAt(x, y))))
{
FieldObjectSetRegularAnim(mapObject, sprite, GetFaceDirectionAnimId(direction));
}
- mapObject->mapobj_bit_1 = TRUE;
+ mapObject->regularAnimActive = TRUE;
sprite->data[1] = 2;
return TRUE;
}
@@ -5014,16 +5014,16 @@ bool8 oac_hopping(struct MapObject *mapObject, struct Sprite *sprite, u8 playerD
s16 y;
direction = playerDirection;
- direction = state_to_direction(gUnknown_0836DC09[mapObject->animPattern], mapObject->mapobj_unk_21, direction);
- x = mapObject->coords2.x;
- y = mapObject->coords2.y;
+ direction = state_to_direction(gUnknown_0836DC09[mapObject->animPattern], mapObject->directionSequenceIndex, direction);
+ x = mapObject->currentCoords.x;
+ y = mapObject->currentCoords.y;
sub_8060320(direction, &x, &y, 2, 2);
FieldObjectSetRegularAnim(mapObject, sprite, GetJumpLedgeAnimId(direction));
if (npc_block_way(mapObject, x, y, direction) || (tileCB != NULL && !tileCB(MapGridGetMetatileBehaviorAt(x, y))))
{
FieldObjectSetRegularAnim(mapObject, sprite, GetFaceDirectionAnimId(direction));
}
- mapObject->mapobj_bit_1 = TRUE;
+ mapObject->regularAnimActive = TRUE;
sprite->data[1] = 2;
return TRUE;
}
@@ -5032,7 +5032,7 @@ fieldmap_object_cb(sub_805F8E0, sub_805F904, gUnknown_083755C0);
u8 mss_08062EA4(struct MapObject *mapObject, struct Sprite *sprite)
{
- if (gMapObjects[gPlayerAvatar.mapObjectId].mapobj_unk_1C == 0xFF || gPlayerAvatar.tileTransitionState == T_TILE_CENTER)
+ if (gMapObjects[gPlayerAvatar.mapObjectId].animId == 0xFF || gPlayerAvatar.tileTransitionState == T_TILE_CENTER)
{
return 0;
}
@@ -5045,11 +5045,11 @@ void FieldObjectCB_TreeDisguise(struct Sprite *sprite)
{
struct MapObject *mapObject;
mapObject = &gMapObjects[sprite->data[0]];
- if (mapObject->mapobj_unk_21 == 0 || (mapObject->mapobj_unk_21 == 1 && sprite->data[7] == 0))
+ if (mapObject->directionSequenceIndex == 0 || (mapObject->directionSequenceIndex == 1 && sprite->data[7] == 0))
{
FieldObjectGetLocalIdAndMap(mapObject, &gFieldEffectArguments[0], &gFieldEffectArguments[1], &gFieldEffectArguments[2]);
- mapObject->mapobj_unk_1A = FieldEffectStart(FLDEFF_TREE_DISGUISE);
- mapObject->mapobj_unk_21 = 1;
+ mapObject->fieldEffectSpriteId = FieldEffectStart(FLDEFF_TREE_DISGUISE);
+ mapObject->directionSequenceIndex = 1;
sprite->data[7] ++;
}
meta_step(&gMapObjects[sprite->data[0]], sprite, sub_805F9F8);
@@ -5065,11 +5065,11 @@ void FieldObjectCB_MountainDisguise(struct Sprite *sprite)
{
struct MapObject *mapObject;
mapObject = &gMapObjects[sprite->data[0]];
- if (mapObject->mapobj_unk_21 == 0 || (mapObject->mapobj_unk_21 == 1 && sprite->data[7] == 0))
+ if (mapObject->directionSequenceIndex == 0 || (mapObject->directionSequenceIndex == 1 && sprite->data[7] == 0))
{
FieldObjectGetLocalIdAndMap(mapObject, &gFieldEffectArguments[0], &gFieldEffectArguments[1], &gFieldEffectArguments[2]);
- mapObject->mapobj_unk_1A = FieldEffectStart(FLDEFF_MOUNTAIN_DISGUISE);
- mapObject->mapobj_unk_21 = 1;
+ mapObject->fieldEffectSpriteId = FieldEffectStart(FLDEFF_MOUNTAIN_DISGUISE);
+ mapObject->directionSequenceIndex = 1;
sprite->data[7] ++;
}
meta_step(&gMapObjects[sprite->data[0]], sprite, sub_805F9F8);
@@ -5081,7 +5081,7 @@ void FieldObjectCB_Hidden1(struct Sprite *sprite)
{
if (sprite->data[7] == 0)
{
- gMapObjects[sprite->data[0]].mapobj_bit_26 = 1;
+ gMapObjects[sprite->data[0]].fixedPriority = 1;
sprite->subspriteMode = 2;
sprite->oam.priority = 3;
sprite->data[7] ++;
@@ -5114,7 +5114,7 @@ fieldmap_object_cb(sub_805FB20, sub_805FB44, gUnknown_083755D0);
u8 sub_805FB64(struct MapObject *mapObject, struct Sprite *sprite)
{
npc_reset(mapObject, sprite);
- FieldObjectSetRegularAnim(mapObject, sprite, GetStepInPlaceDelay16AnimId(mapObject->mapobj_unk_18));
+ FieldObjectSetRegularAnim(mapObject, sprite, GetStepInPlaceDelay16AnimId(mapObject->facingDirection));
sprite->data[1] = 1;
return 1;
}
@@ -5124,7 +5124,7 @@ fieldmap_object_cb(sub_805FB90, sub_805FBB4, gUnknown_083755D8);
u8 sub_805FBD4(struct MapObject *mapObject, struct Sprite *sprite)
{
npc_reset(mapObject, sprite);
- FieldObjectSetRegularAnim(mapObject, sprite, GetStepInPlaceDelay8AnimId(mapObject->mapobj_unk_18));
+ FieldObjectSetRegularAnim(mapObject, sprite, GetStepInPlaceDelay8AnimId(mapObject->facingDirection));
sprite->data[1] = 1;
return 1;
}
@@ -5134,7 +5134,7 @@ fieldmap_object_cb(sub_805FC00, sub_805FC24, gUnknown_083755E0);
u8 sub_805FC44(struct MapObject *mapObject, struct Sprite *sprite)
{
npc_reset(mapObject, sprite);
- FieldObjectSetRegularAnim(mapObject, sprite, GetStepInPlaceDelay4AnimId(mapObject->mapobj_unk_18));
+ FieldObjectSetRegularAnim(mapObject, sprite, GetStepInPlaceDelay4AnimId(mapObject->facingDirection));
sprite->data[1] = 1;
return 1;
}
@@ -5144,8 +5144,8 @@ fieldmap_object_cb(sub_805FC70, sub_805FC94, gUnknown_083755E8);
u8 sub_805FCB4(struct MapObject *mapObject, struct Sprite *sprite)
{
npc_reset(mapObject, sprite);
- FieldObjectSetRegularAnim(mapObject, sprite, GetFaceDirectionAnimId(mapObject->mapobj_unk_18));
- mapObject->mapobj_bit_13 = 1;
+ FieldObjectSetRegularAnim(mapObject, sprite, GetFaceDirectionAnimId(mapObject->facingDirection));
+ mapObject->invisible = 1;
sprite->data[1] = 1;
return 1;
}
@@ -5162,7 +5162,7 @@ u8 sub_805FCE8(struct MapObject *mapObject, struct Sprite *sprite)
u8 sub_805FD08(struct MapObject *mapObject, struct Sprite *sprite)
{
- mapObject->mapobj_bit_1 = 0;
+ mapObject->regularAnimActive = 0;
return 0;
}
@@ -5170,10 +5170,10 @@ void sub_805FC70(struct Sprite *sprite);
void npc_reset(struct MapObject *mapObject, struct Sprite *sprite)
{
- mapObject->mapobj_bit_1 = 0;
- mapObject->mapobj_bit_6 = 0;
- mapObject->mapobj_bit_7 = 0;
- mapObject->mapobj_unk_1C = 0xff;
+ mapObject->regularAnimActive = 0;
+ mapObject->specialAnimActive = 0;
+ mapObject->specialAnimFinished = 0;
+ mapObject->animId = 0xff;
sprite->data[1] = 0;
}
@@ -5254,7 +5254,7 @@ u8 get_run_image_anim_num(u8 direction)
void sub_805FE28(struct MapObject *mapObject, struct Sprite *sprite, u8 animNum)
{
- if (!mapObject->mapobj_bit_12)
+ if (!mapObject->inanimate)
{
sprite->animNum = animNum;
if (sprite->animCmdIndex == 1)
@@ -5271,7 +5271,7 @@ void sub_805FE28(struct MapObject *mapObject, struct Sprite *sprite, u8 animNum)
void sub_805FE64(struct MapObject *mapObject, struct Sprite *sprite, u8 animNum)
{
u8 animCmdIndex;
- if (!mapObject->mapobj_bit_12)
+ if (!mapObject->inanimate)
{
sprite->animNum = animNum;
animCmdIndex = 3;
@@ -5303,8 +5303,8 @@ u8 sub_805FE90(s16 a0, s16 a1, s16 a2, s16 a3)
void npc_set_running_behaviour_etc(struct MapObject *mapObject, u8 animPattern)
{
mapObject->animPattern = animPattern;
- mapObject->mapobj_unk_21 = 0;
- mapObject->animId = 0;
+ mapObject->directionSequenceIndex = 0;
+ mapObject->playerAnimId = 0;
gSprites[mapObject->spriteId].callback = gUnknown_0836DA88[animPattern];
gSprites[mapObject->spriteId].data[1] = 0;
}
@@ -5318,8 +5318,8 @@ u8 sub_805FF20(struct MapObject *mapObject, u8 direction)
{
s16 x;
s16 y;
- x = mapObject->coords2.x;
- y = mapObject->coords2.y;
+ x = mapObject->currentCoords.x;
+ y = mapObject->currentCoords.y;
MoveCoords(direction, &x, &y);
return npc_block_way(mapObject, x, y, direction);
}
@@ -5336,9 +5336,9 @@ u8 npc_block_way(struct MapObject *mapObject, s16 x, s16 y, u32 dirn)
return 1;
else if (MapGridIsImpassableAt(x, y) || GetMapBorderIdAt(x, y) == -1 || IsMetatileDirectionallyImpassable(mapObject, x, y, direction))
return 2;
- else if (mapObject->mapobj_bit_15 && !CanCameraMoveInDirection(direction))
+ else if (mapObject->trackedByCamera && !CanCameraMoveInDirection(direction))
return 2;
- else if (IsZCoordMismatchAt(mapObject->mapobj_unk_0B_0, x, y))
+ else if (IsZCoordMismatchAt(mapObject->currentElevation, x, y))
return 3;
else if (DoesObjectCollideWithObjectAt(mapObject, x, y))
return 4;
@@ -5351,9 +5351,9 @@ u8 sub_8060024(struct MapObject *mapObject, s16 x, s16 y, u8 direction)
if (IsCoordOutsideFieldObjectMovementRect(mapObject, x, y))
flags |= 1;
- if (MapGridIsImpassableAt(x, y) || GetMapBorderIdAt(x, y) == -1 || IsMetatileDirectionallyImpassable(mapObject, x, y, direction) || (mapObject->mapobj_bit_15 && !CanCameraMoveInDirection(direction)))
+ if (MapGridIsImpassableAt(x, y) || GetMapBorderIdAt(x, y) == -1 || IsMetatileDirectionallyImpassable(mapObject, x, y, direction) || (mapObject->trackedByCamera && !CanCameraMoveInDirection(direction)))
flags |= 2;
- if (IsZCoordMismatchAt(mapObject->mapobj_unk_0B_0, x, y))
+ if (IsZCoordMismatchAt(mapObject->currentElevation, x, y))
flags |= 4;
if (DoesObjectCollideWithObjectAt(mapObject, x, y))
flags |= 8;
@@ -5367,15 +5367,15 @@ bool8 IsCoordOutsideFieldObjectMovementRect(struct MapObject *mapObject, s16 x,
if (mapObject->range.as_nybbles.x != 0)
{
- minv = mapObject->coords1.x - (mapObject->range.as_nybbles.x);
- maxv = mapObject->coords1.x + (mapObject->range.as_nybbles.x);
+ minv = mapObject->initialCoords.x - (mapObject->range.as_nybbles.x);
+ maxv = mapObject->initialCoords.x + (mapObject->range.as_nybbles.x);
if (minv > x || maxv < x)
return TRUE;
}
if (mapObject->range.as_nybbles.y != 0)
{
- minv = mapObject->coords1.y - (mapObject->range.as_nybbles.y);
- maxv = mapObject->coords1.y + (mapObject->range.as_nybbles.y);
+ minv = mapObject->initialCoords.y - (mapObject->range.as_nybbles.y);
+ maxv = mapObject->initialCoords.y + (mapObject->range.as_nybbles.y);
if (minv > y || maxv < y)
return TRUE;
}
@@ -5384,7 +5384,7 @@ bool8 IsCoordOutsideFieldObjectMovementRect(struct MapObject *mapObject, s16 x,
bool8 IsMetatileDirectionallyImpassable(struct MapObject *mapObject, s16 x, s16 y, u8 direction)
{
- if (gUnknown_08375684[direction - 1](mapObject->mapobj_unk_1E) || gUnknown_08375694[direction - 1](MapGridGetMetatileBehaviorAt(x, y)))
+ if (gUnknown_08375684[direction - 1](mapObject->currentMetatileBehavior) || gUnknown_08375694[direction - 1](MapGridGetMetatileBehaviorAt(x, y)))
{
return 1;
}
@@ -5401,8 +5401,8 @@ static bool8 DoesObjectCollideWithObjectAt(struct MapObject *mapObject, s16 x, s
if (mapObject2->active && mapObject2 != mapObject)
{
- if (((mapObject2->coords2.x == x && mapObject2->coords2.y == y) || (mapObject2->coords3.x == x && mapObject2->coords3.y == y))
- && AreZCoordsCompatible(mapObject->mapobj_unk_0B_0, mapObject2->mapobj_unk_0B_0))
+ if (((mapObject2->currentCoords.x == x && mapObject2->currentCoords.y == y) || (mapObject2->previousCoords.x == x && mapObject2->previousCoords.y == y))
+ && AreZCoordsCompatible(mapObject->currentElevation, mapObject2->currentElevation))
return TRUE;
}
}
@@ -5531,14 +5531,14 @@ void GetFieldObjectMovingCameraOffset(s16 *x, s16 *y)
void FieldObjectMoveDestCoords(struct MapObject *mapObject, u32 direction, s16 *x, s16 *y)
{
u8 newDirn = direction;
- *x = mapObject->coords2.x;
- *y = mapObject->coords2.y;
+ *x = mapObject->currentCoords.x;
+ *y = mapObject->currentCoords.y;
MoveCoords(newDirn, x, y);
}
bool8 FieldObjectIsSpecialAnimOrDirectionSequenceAnimActive(struct MapObject *mapObject)
{
- if (mapObject->mapobj_bit_1 || mapObject->mapobj_bit_6)
+ if (mapObject->regularAnimActive || mapObject->specialAnimActive)
{
return TRUE;
}
@@ -5547,7 +5547,7 @@ bool8 FieldObjectIsSpecialAnimOrDirectionSequenceAnimActive(struct MapObject *ma
bool8 FieldObjectIsSpecialAnimActive(struct MapObject *mapObject)
{
- if (mapObject->mapobj_bit_6 && mapObject->mapobj_unk_1C != 0xff)
+ if (mapObject->specialAnimActive && mapObject->animId != 0xff)
{
return TRUE;
}
@@ -5561,9 +5561,9 @@ bool8 FieldObjectSetSpecialAnim(struct MapObject *mapObject, u8 specialAnimId)
return TRUE;
}
UnfreezeMapObject(mapObject);
- mapObject->mapobj_unk_1C = specialAnimId;
- mapObject->mapobj_bit_6 = 1;
- mapObject->mapobj_bit_7 = 0;
+ mapObject->animId = specialAnimId;
+ mapObject->specialAnimActive = 1;
+ mapObject->specialAnimFinished = 0;
gSprites[mapObject->spriteId].data[2] = 0;
return FALSE;
}
@@ -5576,7 +5576,7 @@ void FieldObjectForceSetSpecialAnim(struct MapObject *mapObject, u8 specialAnimI
void FieldObjectClearAnimIfSpecialAnimActive(struct MapObject *mapObject)
{
- if (mapObject->mapobj_bit_6)
+ if (mapObject->specialAnimActive)
{
FieldObjectClearAnim(mapObject);
}
@@ -5584,17 +5584,17 @@ void FieldObjectClearAnimIfSpecialAnimActive(struct MapObject *mapObject)
void FieldObjectClearAnim(struct MapObject *mapObject)
{
- mapObject->mapobj_unk_1C = 0xFF;
- mapObject->mapobj_bit_6 = 0;
- mapObject->mapobj_bit_7 = 0;
+ mapObject->animId = 0xFF;
+ mapObject->specialAnimActive = 0;
+ mapObject->specialAnimFinished = 0;
gSprites[mapObject->spriteId].data[1] = 0;
gSprites[mapObject->spriteId].data[2] = 0;
}
bool8 FieldObjectCheckIfSpecialAnimFinishedOrInactive(struct MapObject *mapObject)
{
- if (mapObject->mapobj_bit_6)
- return mapObject->mapobj_bit_7;
+ if (mapObject->specialAnimActive)
+ return mapObject->specialAnimFinished;
return 0x10;
}
@@ -5611,9 +5611,9 @@ bool8 FieldObjectClearAnimIfSpecialAnimFinished(struct MapObject *mapObject)
u8 FieldObjectGetSpecialAnim(struct MapObject *mapObject)
{
- if (mapObject->mapobj_bit_6)
+ if (mapObject->specialAnimActive)
{
- return mapObject->mapobj_unk_1C;
+ return mapObject->animId;
}
return 0xFF;
}
@@ -5633,13 +5633,12 @@ void meta_step(struct MapObject *mapObject, struct Sprite *sprite, u8 (*callback
if (FieldObjectIsSpecialAnimActive(mapObject))
{
FieldObjectExecSpecialAnim(mapObject, sprite);
- } else
+ }
+ else if (!mapObject->frozen)
{
- if (!mapObject->mapobj_bit_8)
- {
- while (callback(mapObject, sprite));
- }
+ while (callback(mapObject, sprite));
}
+
DoGroundEffects_OnBeginStep(mapObject, sprite);
DoGroundEffects_OnFinishStep(mapObject, sprite);
npc_obj_transfer_image_anim_pause_flag(mapObject, sprite);
@@ -5822,17 +5821,17 @@ u32 state_to_direction(u8 a0, u32 a1, u32 a2)
void FieldObjectExecSpecialAnim(struct MapObject *mapObject, struct Sprite *sprite)
{
- if (gUnknown_08375778[mapObject->mapobj_unk_1C][sprite->data[2]](mapObject, sprite))
+ if (gUnknown_08375778[mapObject->animId][sprite->data[2]](mapObject, sprite))
{
- mapObject->mapobj_bit_7 = 1;
+ mapObject->specialAnimFinished = 1;
}
}
bool8 FieldObjectExecRegularAnim(struct MapObject *mapObject, struct Sprite *sprite)
{
- if (gUnknown_08375778[mapObject->mapobj_unk_1C][sprite->data[2]](mapObject, sprite))
+ if (gUnknown_08375778[mapObject->animId][sprite->data[2]](mapObject, sprite))
{
- mapObject->mapobj_unk_1C = 0xFF;
+ mapObject->animId = 0xFF;
sprite->data[2] = 0;
return 1;
}
@@ -5841,7 +5840,7 @@ bool8 FieldObjectExecRegularAnim(struct MapObject *mapObject, struct Sprite *spr
void FieldObjectSetRegularAnim(struct MapObject *mapObject, struct Sprite *sprite, u8 animId)
{
- mapObject->mapobj_unk_1C = animId;
+ mapObject->animId = animId;
sprite->data[2] = 0;
}
@@ -5849,7 +5848,7 @@ void an_look_any(struct MapObject *mapObject, struct Sprite *sprite, u8 directio
{
FieldObjectSetDirection(mapObject, direction);
npc_coords_shift_still(mapObject);
- sub_805FE64(mapObject, sprite, get_go_image_anim_num(mapObject->mapobj_unk_18));
+ sub_805FE64(mapObject, sprite, get_go_image_anim_num(mapObject->facingDirection));
sprite->animPaused = 1;
sprite->data[2] = 1;
}
@@ -5882,14 +5881,14 @@ void sub_8060D20(struct MapObject *mapObject, struct Sprite *sprite, u8 directio
{
s16 x;
s16 y;
- x = mapObject->coords2.x;
- y = mapObject->coords2.y;
+ x = mapObject->currentCoords.x;
+ y = mapObject->currentCoords.y;
FieldObjectSetDirection(mapObject, direction);
MoveCoords(direction, &x, &y);
npc_coords_shift(mapObject, x, y);
oamt_npc_ministep_reset(sprite, direction, a3);
sprite->animPaused = 0;
- mapObject->mapobj_bit_2 = 1;
+ mapObject->triggerGroundEffectsOnMove = 1;
sprite->data[2] = 1;
}
@@ -5900,13 +5899,13 @@ void do_go_anim(struct MapObject *mapObject, struct Sprite *sprite, u8 direction
u8 (*const functions[5])(u8);
memcpy((void *)functions, gUnknown_083759C0, sizeof(gUnknown_083759C0));
sub_8060D20(mapObject, sprite, direction, a3);
- sub_805FE28(mapObject, sprite, functions[a3](mapObject->mapobj_unk_18));
+ sub_805FE28(mapObject, sprite, functions[a3](mapObject->facingDirection));
}
void do_run_anim(struct MapObject *mapObject, struct Sprite *sprite, u8 direction)
{
sub_8060D20(mapObject, sprite, direction, 1);
- sub_805FE28(mapObject, sprite, get_run_image_anim_num(mapObject->mapobj_unk_18));
+ sub_805FE28(mapObject, sprite, get_run_image_anim_num(mapObject->facingDirection));
}
bool8 obj_npc_ministep(struct Sprite *);
@@ -5916,7 +5915,7 @@ bool8 npc_obj_ministep_stop_on_arrival(struct MapObject *mapObject, struct Sprit
if (obj_npc_ministep(sprite))
{
npc_coords_shift_still(mapObject);
- mapObject->mapobj_bit_3 = 1;
+ mapObject->triggerGroundEffectsOnStop = 1;
sprite->animPaused = 1;
return 1;
}
@@ -5927,21 +5926,21 @@ void sub_8060E68(struct MapObject *mapObject, struct Sprite *sprite, u8 directio
{
s16 x;
s16 y;
- x = mapObject->coords2.x;
- y = mapObject->coords2.y;
+ x = mapObject->currentCoords.x;
+ y = mapObject->currentCoords.y;
FieldObjectSetDirection(mapObject, direction);
MoveCoords(direction, &x, &y);
npc_coords_shift(mapObject, x, y);
sub_806467C(sprite, direction);
sprite->animPaused = 0;
- mapObject->mapobj_bit_2 = 1;
+ mapObject->triggerGroundEffectsOnMove = 1;
sprite->data[2] = 1;
}
void sub_8060ED8(struct MapObject *mapObject, struct Sprite *sprite, u8 direction)
{
sub_8060E68(mapObject, sprite, direction);
- sub_805FE28(mapObject, sprite, get_go_image_anim_num(mapObject->mapobj_unk_18));
+ sub_805FE28(mapObject, sprite, get_go_image_anim_num(mapObject->facingDirection));
}
bool8 an_walk_any_2(struct MapObject *mapObject, struct Sprite *sprite)
@@ -5949,7 +5948,7 @@ bool8 an_walk_any_2(struct MapObject *mapObject, struct Sprite *sprite)
if (sub_806468C(sprite))
{
npc_coords_shift_still(mapObject);
- mapObject->mapobj_bit_3 = 1;
+ mapObject->triggerGroundEffectsOnStop = 1;
sprite->animPaused = 1;
return TRUE;
}
@@ -6110,18 +6109,18 @@ void sub_806113C(struct MapObject *mapObject, struct Sprite *sprite, u8 directio
y = 0;
FieldObjectSetDirection(mapObject, direction);
sub_8060320(direction, &x, &y, vSPp4[a4], vSPp4[a4]);
- npc_coords_shift(mapObject, mapObject->coords2.x + x, mapObject->coords2.y + y);
+ npc_coords_shift(mapObject, mapObject->currentCoords.x + x, mapObject->currentCoords.y + y);
sub_80646E4(sprite, direction, a4, a5);
sprite->data[2] = 1;
sprite->animPaused = 0;
- mapObject->mapobj_bit_2 = 1;
- mapObject->mapobj_bit_4 = 1;
+ mapObject->triggerGroundEffectsOnMove = 1;
+ mapObject->disableCoveringGroundEffects = 1;
}
void maybe_shadow_1(struct MapObject *mapObject, struct Sprite *sprite, u8 direction, u8 a4, u8 a5)
{
sub_806113C(mapObject, sprite, direction, a4, a5);
- sub_805FE28(mapObject, sprite, get_go_image_anim_num(mapObject->mapobj_unk_18));
+ sub_805FE28(mapObject, sprite, get_go_image_anim_num(mapObject->facingDirection));
DoShadowFieldEffect(mapObject);
}
@@ -6137,15 +6136,15 @@ u8 sub_806123C(struct MapObject *mapObject, struct Sprite *sprite, u8 (*const ca
{
x = 0;
y = 0;
- sub_8060320(mapObject->placeholder18, &x, &y, vSPp4[sprite->data[4]], vSPp4[sprite->data[4]]);
- npc_coords_shift(mapObject, mapObject->coords2.x + x, mapObject->coords2.y + y);
- mapObject->mapobj_bit_2 = 1;
- mapObject->mapobj_bit_4 = 1;
+ sub_8060320(mapObject->movementDirection, &x, &y, vSPp4[sprite->data[4]], vSPp4[sprite->data[4]]);
+ npc_coords_shift(mapObject, mapObject->currentCoords.x + x, mapObject->currentCoords.y + y);
+ mapObject->triggerGroundEffectsOnMove = 1;
+ mapObject->disableCoveringGroundEffects = 1;
} else if (retval == 0xff)
{
npc_coords_shift_still(mapObject);
- mapObject->mapobj_bit_3 = 1;
- mapObject->mapobj_bit_5 = 1;
+ mapObject->triggerGroundEffectsOnStop = 1;
+ mapObject->landingJump = 1;
sprite->animPaused = 1;
}
return retval;
@@ -6192,8 +6191,8 @@ bool8 sub_8061358(struct MapObject *mapObject, struct Sprite *sprite)
}
return FALSE;
}
- FieldObjectSetDirection(mapObject, GetOppositeDirection(mapObject->placeholder18));
- sub_805FE64(mapObject, sprite, get_go_image_anim_num(mapObject->mapobj_unk_18));
+ FieldObjectSetDirection(mapObject, GetOppositeDirection(mapObject->movementDirection));
+ sub_805FE64(mapObject, sprite, get_go_image_anim_num(mapObject->facingDirection));
return FALSE;
}
@@ -6212,7 +6211,7 @@ bool8 sub_80613D4(struct MapObject *mapObject, struct Sprite *sprite)
{
if (sub_8061328(mapObject, sprite))
{
- mapObject->mapobj_bit_22 = 0;
+ mapObject->hasShadow = 0;
sprite->data[2] = 2;
return TRUE;
}
@@ -6229,7 +6228,7 @@ bool8 sub_806142C(struct MapObject *mapObject, struct Sprite *sprite)
{
if (sub_8061328(mapObject, sprite))
{
- mapObject->mapobj_bit_22 = 0;
+ mapObject->hasShadow = 0;
sprite->data[2] = 2;
return TRUE;
}
@@ -6246,7 +6245,7 @@ bool8 sub_8061484(struct MapObject *mapObject, struct Sprite *sprite)
{
if (sub_8061328(mapObject, sprite))
{
- mapObject->mapobj_bit_22 = 0;
+ mapObject->hasShadow = 0;
sprite->data[2] = 2;
return TRUE;
}
@@ -6263,7 +6262,7 @@ bool8 sub_80614DC(struct MapObject *mapObject, struct Sprite *sprite)
{
if (sub_8061328(mapObject, sprite))
{
- mapObject->mapobj_bit_22 = 0;
+ mapObject->hasShadow = 0;
sprite->data[2] = 2;
return TRUE;
}
@@ -6813,7 +6812,7 @@ void npc_set_direction_and_anim__an_proceed(struct MapObject *mapObject, struct
bool8 sub_8061F24(struct MapObject *mapObject, struct Sprite *sprite)
{
- npc_set_direction_and_anim__an_proceed(mapObject, sprite, mapObject->placeholder18, sprite->animNum);
+ npc_set_direction_and_anim__an_proceed(mapObject, sprite, mapObject->movementDirection, sprite->animNum);
return FALSE;
}
@@ -6848,7 +6847,7 @@ bool8 sub_8061FB0(struct MapObject *mapObject, struct Sprite *sprite)
if (sub_8061340(mapObject, sprite))
{
sprite->data[2] = 2;
- mapObject->mapobj_bit_5 = 0;
+ mapObject->landingJump = 0;
return TRUE;
}
return FALSE;
@@ -6867,7 +6866,7 @@ bool8 sub_8061FF8(struct MapObject *mapObject, struct Sprite *sprite)
if (sub_8061340(mapObject, sprite))
{
sprite->data[2] = 2;
- mapObject->mapobj_bit_5 = 0;
+ mapObject->landingJump = 0;
return TRUE;
}
return FALSE;
@@ -6886,7 +6885,7 @@ bool8 sub_8062040(struct MapObject *mapObject, struct Sprite *sprite)
if (sub_8061340(mapObject, sprite))
{
sprite->data[2] = 2;
- mapObject->mapobj_bit_5 = 0;
+ mapObject->landingJump = 0;
return TRUE;
}
return FALSE;
@@ -6905,7 +6904,7 @@ bool8 sub_8062088(struct MapObject *mapObject, struct Sprite *sprite)
if (sub_8061340(mapObject, sprite))
{
sprite->data[2] = 2;
- mapObject->mapobj_bit_5 = 0;
+ mapObject->landingJump = 0;
return TRUE;
}
return FALSE;
@@ -6916,7 +6915,7 @@ bool8 sub_80620B0(struct MapObject *mapObject, struct Sprite *sprite)
u8 objectId;
if (!TryGetFieldObjectIdByLocalIdAndMap(0xFF, MAP_GROUP(PETALBURG_CITY), MAP_NUM(PETALBURG_CITY), &objectId))
{
- an_look_any(mapObject, sprite, sub_805FE90(mapObject->coords2.x, mapObject->coords2.y, gMapObjects[objectId].coords2.x, gMapObjects[objectId].coords2.y));
+ an_look_any(mapObject, sprite, sub_805FE90(mapObject->currentCoords.x, mapObject->currentCoords.y, gMapObjects[objectId].currentCoords.x, gMapObjects[objectId].currentCoords.y));
}
sprite->data[2] = 1;
return TRUE;
@@ -6927,7 +6926,7 @@ bool8 sub_806210C(struct MapObject *mapObject, struct Sprite *sprite)
u8 objectId;
if (!TryGetFieldObjectIdByLocalIdAndMap(0xFF, MAP_GROUP(PETALBURG_CITY), MAP_NUM(PETALBURG_CITY), &objectId))
{
- an_look_any(mapObject, sprite, GetOppositeDirection(sub_805FE90(mapObject->coords2.x, mapObject->coords2.y, gMapObjects[objectId].coords2.x, gMapObjects[objectId].coords2.y)));
+ an_look_any(mapObject, sprite, GetOppositeDirection(sub_805FE90(mapObject->currentCoords.x, mapObject->currentCoords.y, gMapObjects[objectId].currentCoords.x, gMapObjects[objectId].currentCoords.y)));
}
sprite->data[2] = 1;
return TRUE;
@@ -6935,14 +6934,14 @@ bool8 sub_806210C(struct MapObject *mapObject, struct Sprite *sprite)
bool8 sub_8062170(struct MapObject *mapObject, struct Sprite *sprite)
{
- mapObject->mapobj_bit_9 = 1;
+ mapObject->facingDirectionLocked = 1;
sprite->data[2] = 1;
return TRUE;
}
bool8 sub_8062180(struct MapObject *mapObject, struct Sprite *sprite)
{
- mapObject->mapobj_bit_9 = 0;
+ mapObject->facingDirectionLocked = 0;
sprite->data[2] = 1;
return TRUE;
}
@@ -6959,7 +6958,7 @@ bool8 sub_80621BC(struct MapObject *mapObject, struct Sprite *sprite)
{
if (sub_8061328(mapObject, sprite))
{
- mapObject->mapobj_bit_22 = 0;
+ mapObject->hasShadow = 0;
sprite->data[2] = 2;
return TRUE;
}
@@ -6978,7 +6977,7 @@ bool8 sub_8062214(struct MapObject *mapObject, struct Sprite *sprite)
{
if (sub_8061328(mapObject, sprite))
{
- mapObject->mapobj_bit_22 = 0;
+ mapObject->hasShadow = 0;
sprite->data[2] = 2;
return TRUE;
}
@@ -6997,7 +6996,7 @@ bool8 sub_806226C(struct MapObject *mapObject, struct Sprite *sprite)
{
if (sub_8061328(mapObject, sprite))
{
- mapObject->mapobj_bit_22 = 0;
+ mapObject->hasShadow = 0;
sprite->data[2] = 2;
return TRUE;
}
@@ -7016,7 +7015,7 @@ bool8 sub_80622C4(struct MapObject *mapObject, struct Sprite *sprite)
{
if (sub_8061328(mapObject, sprite))
{
- mapObject->mapobj_bit_22 = 0;
+ mapObject->hasShadow = 0;
sprite->data[2] = 2;
return TRUE;
}
@@ -7035,7 +7034,7 @@ bool8 sub_806231C(struct MapObject *mapObject, struct Sprite *sprite)
{
if (sub_8061328(mapObject, sprite))
{
- mapObject->mapobj_bit_22 = 0;
+ mapObject->hasShadow = 0;
sprite->data[2] = 2;
return TRUE;
}
@@ -7054,7 +7053,7 @@ bool8 sub_8062374(struct MapObject *mapObject, struct Sprite *sprite)
{
if (sub_8061328(mapObject, sprite))
{
- mapObject->mapobj_bit_22 = 0;
+ mapObject->hasShadow = 0;
sprite->data[2] = 2;
return TRUE;
}
@@ -7073,7 +7072,7 @@ bool8 sub_80623CC(struct MapObject *mapObject, struct Sprite *sprite)
{
if (sub_8061328(mapObject, sprite))
{
- mapObject->mapobj_bit_22 = 0;
+ mapObject->hasShadow = 0;
sprite->data[2] = 2;
return TRUE;
}
@@ -7092,7 +7091,7 @@ bool8 sub_8062424(struct MapObject *mapObject, struct Sprite *sprite)
{
if (sub_8061328(mapObject, sprite))
{
- mapObject->mapobj_bit_22 = 0;
+ mapObject->hasShadow = 0;
sprite->data[2] = 2;
return TRUE;
}
@@ -7111,7 +7110,7 @@ bool8 sub_806247C(struct MapObject *mapObject, struct Sprite *sprite)
{
if (sub_8061358(mapObject, sprite))
{
- mapObject->mapobj_bit_22 = 0;
+ mapObject->hasShadow = 0;
sprite->data[2] = 2;
return TRUE;
}
@@ -7130,7 +7129,7 @@ bool8 sub_80624D4(struct MapObject *mapObject, struct Sprite *sprite)
{
if (sub_8061358(mapObject, sprite))
{
- mapObject->mapobj_bit_22 = 0;
+ mapObject->hasShadow = 0;
sprite->data[2] = 2;
return TRUE;
}
@@ -7149,7 +7148,7 @@ bool8 sub_806252C(struct MapObject *mapObject, struct Sprite *sprite)
{
if (sub_8061358(mapObject, sprite))
{
- mapObject->mapobj_bit_22 = 0;
+ mapObject->hasShadow = 0;
sprite->data[2] = 2;
return TRUE;
}
@@ -7168,7 +7167,7 @@ bool8 sub_8062584(struct MapObject *mapObject, struct Sprite *sprite)
{
if (sub_8061358(mapObject, sprite))
{
- mapObject->mapobj_bit_22 = 0;
+ mapObject->hasShadow = 0;
sprite->data[2] = 2;
return TRUE;
}
@@ -7189,42 +7188,42 @@ bool8 sub_80625C8(struct MapObject *mapObject, struct Sprite *sprite)
bool8 sub_80625D8(struct MapObject *mapObject, struct Sprite *sprite)
{
- mapObject->mapobj_bit_25 = 0;
+ mapObject->disableJumpLandingGroundEffect = 0;
sprite->data[2] = 1;
return TRUE;
}
bool8 sub_80625E8(struct MapObject *mapObject, struct Sprite *sprite)
{
- mapObject->mapobj_bit_25 = 1;
+ mapObject->disableJumpLandingGroundEffect = 1;
sprite->data[2] = 1;
return TRUE;
}
bool8 sub_80625F8(struct MapObject *mapObject, struct Sprite *sprite)
{
- mapObject->mapobj_bit_12 = 1;
+ mapObject->inanimate = 1;
sprite->data[2] = 1;
return TRUE;
}
bool8 sub_8062608(struct MapObject *mapObject, struct Sprite *sprite)
{
- mapObject->mapobj_bit_12 = GetFieldObjectGraphicsInfo(mapObject->graphicsId)->inanimate;
+ mapObject->inanimate = GetFieldObjectGraphicsInfo(mapObject->graphicsId)->inanimate;
sprite->data[2] = 1;
return TRUE;
}
bool8 sub_8062634(struct MapObject *mapObject, struct Sprite *sprite)
{
- mapObject->mapobj_bit_13 = 1;
+ mapObject->invisible = 1;
sprite->data[2] = 1;
return TRUE;
}
bool8 sub_8062644(struct MapObject *mapObject, struct Sprite *sprite)
{
- mapObject->mapobj_bit_13 = 0;
+ mapObject->invisible = 0;
sprite->data[2] = 1;
return TRUE;
}
@@ -7304,10 +7303,10 @@ bool8 sub_8062740(struct MapObject *mapObject, struct Sprite *sprite)
bool8 sub_8062764(struct MapObject *mapObject, struct Sprite *sprite)
{
- mapObject->mapobj_bit_13 ^= 1;
+ mapObject->invisible ^= 1;
if (sub_8064824(sprite))
{
- mapObject->mapobj_bit_13 = 1;
+ mapObject->invisible = 1;
sprite->data[2] = 3;
}
return FALSE;
@@ -7332,10 +7331,10 @@ bool8 sub_80627BC(struct MapObject *mapObject, struct Sprite *sprite)
bool8 sub_80627E0(struct MapObject *mapObject, struct Sprite *sprite)
{
- mapObject->mapobj_bit_13 ^= 1;
+ mapObject->invisible ^= 1;
if (sub_8064824(sprite))
{
- mapObject->mapobj_bit_13 = 1;
+ mapObject->invisible = 1;
sprite->data[2] = 3;
}
return FALSE;
@@ -7343,14 +7342,14 @@ bool8 sub_80627E0(struct MapObject *mapObject, struct Sprite *sprite)
bool8 sub_806281C(struct MapObject *mapObject, struct Sprite *sprite)
{
- mapObject->mapobj_bit_26 = 1;
+ mapObject->fixedPriority = 1;
sprite->data[2] = 1;
return TRUE;
}
bool8 sub_806282C(struct MapObject *mapObject, struct Sprite *sprite)
{
- mapObject->mapobj_bit_26 = 0;
+ mapObject->fixedPriority = 0;
sprite->data[2] = 1;
return TRUE;
}
@@ -7538,7 +7537,7 @@ bool8 sub_8062BFC(struct MapObject *mapObject, struct Sprite *sprite)
{
if (sub_8061328(mapObject, sprite))
{
- mapObject->mapobj_bit_22 = 0;
+ mapObject->hasShadow = 0;
sprite->data[2] = 2;
return TRUE;
}
@@ -7557,7 +7556,7 @@ bool8 sub_8062C54(struct MapObject *mapObject, struct Sprite *sprite)
{
if (sub_8061328(mapObject, sprite))
{
- mapObject->mapobj_bit_22 = 0;
+ mapObject->hasShadow = 0;
sprite->data[2] = 2;
return TRUE;
}
@@ -7576,7 +7575,7 @@ bool8 sub_8062CAC(struct MapObject *mapObject, struct Sprite *sprite)
{
if (sub_8061328(mapObject, sprite))
{
- mapObject->mapobj_bit_22 = 0;
+ mapObject->hasShadow = 0;
sprite->data[2] = 2;
return TRUE;
}
@@ -7595,7 +7594,7 @@ bool8 sub_8062D04(struct MapObject *mapObject, struct Sprite *sprite)
{
if (sub_8061328(mapObject, sprite))
{
- mapObject->mapobj_bit_22 = 0;
+ mapObject->hasShadow = 0;
sprite->data[2] = 2;
return TRUE;
}
@@ -7614,7 +7613,7 @@ bool8 sub_8062D5C(struct MapObject *mapObject, struct Sprite *sprite)
{
if (sub_8061328(mapObject, sprite))
{
- mapObject->mapobj_bit_22 = 0;
+ mapObject->hasShadow = 0;
sprite->data[2] = 2;
return TRUE;
}
@@ -7633,7 +7632,7 @@ bool8 sub_8062DB4(struct MapObject *mapObject, struct Sprite *sprite)
{
if (sub_8061328(mapObject, sprite))
{
- mapObject->mapobj_bit_22 = 0;
+ mapObject->hasShadow = 0;
sprite->data[2] = 2;
return TRUE;
}
@@ -7652,7 +7651,7 @@ bool8 sub_8062E0C(struct MapObject *mapObject, struct Sprite *sprite)
{
if (sub_8061328(mapObject, sprite))
{
- mapObject->mapobj_bit_22 = 0;
+ mapObject->hasShadow = 0;
sprite->data[2] = 2;
return TRUE;
}
@@ -7671,7 +7670,7 @@ bool8 sub_8062E64(struct MapObject *mapObject, struct Sprite *sprite)
{
if (sub_8061328(mapObject, sprite))
{
- mapObject->mapobj_bit_22 = 0;
+ mapObject->hasShadow = 0;
sprite->data[2] = 2;
return TRUE;
}
@@ -7690,7 +7689,7 @@ bool8 sub_8062EBC(struct MapObject *mapObject, struct Sprite *sprite)
{
if (sub_8061328(mapObject, sprite))
{
- mapObject->mapobj_bit_22 = 0;
+ mapObject->hasShadow = 0;
sprite->data[2] = 2;
return TRUE;
}
@@ -7709,7 +7708,7 @@ bool8 sub_8062F14(struct MapObject *mapObject, struct Sprite *sprite)
{
if (sub_8061328(mapObject, sprite))
{
- mapObject->mapobj_bit_22 = 0;
+ mapObject->hasShadow = 0;
sprite->data[2] = 2;
return TRUE;
}
@@ -7728,7 +7727,7 @@ bool8 sub_8062F6C(struct MapObject *mapObject, struct Sprite *sprite)
{
if (sub_8061328(mapObject, sprite))
{
- mapObject->mapobj_bit_22 = 0;
+ mapObject->hasShadow = 0;
sprite->data[2] = 2;
return TRUE;
}
@@ -7747,7 +7746,7 @@ bool8 sub_8062FC4(struct MapObject *mapObject, struct Sprite *sprite)
{
if (sub_8061328(mapObject, sprite))
{
- mapObject->mapobj_bit_22 = 0;
+ mapObject->hasShadow = 0;
sprite->data[2] = 2;
return TRUE;
}
@@ -7781,7 +7780,7 @@ bool8 sub_8063098(struct MapObject *mapObject, struct Sprite *sprite)
void sub_80630D0(struct MapObject *mapObject, struct Sprite *sprite, u8 direction, u8 a3)
{
sub_8060D20(mapObject, sprite, direction, a3);
- StartSpriteAnim(sprite, sub_805FD98(mapObject->mapobj_unk_18));
+ StartSpriteAnim(sprite, sub_805FD98(mapObject->facingDirection));
SeekSpriteAnim(sprite, 0);
}
@@ -7860,7 +7859,7 @@ bool8 sub_80631E8(struct MapObject *mapObject, struct Sprite *sprite)
void sub_8063208(struct MapObject *mapObject, struct Sprite *sprite, u8 direction, u8 a3)
{
sub_8060D20(mapObject, sprite, direction, a3);
- sub_805FE28(mapObject, sprite, sub_805FDD8(mapObject->mapobj_unk_18));
+ sub_805FE28(mapObject, sprite, sub_805FDD8(mapObject->facingDirection));
}
bool8 sub_8063258(struct MapObject *, struct Sprite *);
@@ -7938,7 +7937,7 @@ bool8 sub_8063318(struct MapObject *mapObject, struct Sprite *sprite)
void sub_8063338(struct MapObject *mapObject, struct Sprite *sprite, u8 direction, u8 a3)
{
sub_8060D20(mapObject, sprite, direction, a3);
- StartSpriteAnim(sprite, sub_805FDB8(mapObject->mapobj_unk_18));
+ StartSpriteAnim(sprite, sub_805FDB8(mapObject->facingDirection));
SeekSpriteAnim(sprite, 0);
}
@@ -8027,7 +8026,7 @@ bool8 sub_8063474(struct MapObject *mapObject, struct Sprite *sprite)
void npc_obj_transfer_image_anim_pause_flag(struct MapObject *mapObject, struct Sprite *sprite)
{
- if (mapObject->mapobj_bit_10)
+ if (mapObject->disableAnim)
{
sprite->animPaused = 1;
}
@@ -8035,11 +8034,11 @@ void npc_obj_transfer_image_anim_pause_flag(struct MapObject *mapObject, struct
void sub_80634A0(struct MapObject *mapObject, struct Sprite *sprite)
{
- if (mapObject->mapobj_bit_11)
+ if (mapObject->enableAnim)
{
sprite->animPaused = 0;
- mapObject->mapobj_bit_10 = 0;
- mapObject->mapobj_bit_11 = 0;
+ mapObject->disableAnim = 0;
+ mapObject->enableAnim = 0;
}
}
@@ -8060,7 +8059,7 @@ void sub_80634E8(struct MapObject *mapObject, struct Sprite *sprite)
s16 x2;
s16 y2;
const struct MapObjectGraphicsInfo *graphicsInfo;
- mapObject->mapobj_bit_14 = 0;
+ mapObject->offScreen = 0;
graphicsInfo = GetFieldObjectGraphicsInfo(mapObject->graphicsId);
if (sprite->coordOffsetEnabled)
{
@@ -8075,11 +8074,11 @@ void sub_80634E8(struct MapObject *mapObject, struct Sprite *sprite)
y2 = graphicsInfo->height + y; // similarly offending line
if ((s16)x >= 0x100 || x2 < -0x10)
{
- mapObject->mapobj_bit_14 = 1;
+ mapObject->offScreen = 1;
}
if ((s16)y >= 0xB0 || y2 < -0x10)
{
- mapObject->mapobj_bit_14 = 1;
+ mapObject->offScreen = 1;
}
}
#else
@@ -8208,7 +8207,7 @@ _080635C0:\n\
void UpdateMapObjSpriteVisibility(struct MapObject *mapObject, struct Sprite *sprite)
{
sprite->invisible = 0;
- if (mapObject->mapobj_bit_13 || mapObject->mapobj_bit_14)
+ if (mapObject->invisible || mapObject->offScreen)
{
sprite->invisible = 1;
}
@@ -8219,14 +8218,14 @@ static void DoTracksGroundEffect_Footprints(struct MapObject *mapObj, struct Spr
static void DoTracksGroundEffect_BikeTireTracks(
struct MapObject *mapObj, struct Sprite *sprite, u8);
void GroundEffect_SpawnOnTallGrass(struct MapObject *mapObj, struct Sprite *sprite);
-void sub_8063E94(struct MapObject *mapObj, struct Sprite *sprite);
-void sub_8063EE0(struct MapObject *mapObj, struct Sprite *sprite);
-void sub_8063F2C(struct MapObject *mapObj, struct Sprite *sprite);
+void GroundEffect_MoveOnTallGrass(struct MapObject *mapObj, struct Sprite *sprite);
+void GroundEffect_SpawnOnLongGrass(struct MapObject *mapObj, struct Sprite *sprite);
+void GroundEffect_MoveOnLongGrass(struct MapObject *mapObj, struct Sprite *sprite);
void GroundEffect_WaterReflection(struct MapObject *mapObj, struct Sprite *sprite);
void GroundEffect_IceReflection(struct MapObject *mapObj, struct Sprite *sprite);
void GroundEffect_FlowingWater(struct MapObject *mapObj, struct Sprite *sprite);
-void sub_8063FA0(struct MapObject *mapObj, struct Sprite *sprite);
-void sub_8063FCC(struct MapObject *mapObj, struct Sprite *sprite);
+void GroundEffect_SandTracks(struct MapObject *mapObj, struct Sprite *sprite);
+void GroundEffect_DeepSandTracks(struct MapObject *mapObj, struct Sprite *sprite);
void GroundEffect_Ripple(struct MapObject *mapObj, struct Sprite *sprite);
void GroundEffect_StepOnPuddle(struct MapObject *mapObj, struct Sprite *sprite);
void GroundEffect_SandPile(struct MapObject *mapObj, struct Sprite *sprite);
@@ -8281,160 +8280,160 @@ static void GetAllGroundEffectFlags_OnFinishStep(struct MapObject *mapObj, u32 *
void FieldObjectUpdateMetatileBehaviors(struct MapObject *mapObj)
{
- mapObj->mapobj_unk_1F = MapGridGetMetatileBehaviorAt(mapObj->coords3.x, mapObj->coords3.y);
- mapObj->mapobj_unk_1E = MapGridGetMetatileBehaviorAt(mapObj->coords2.x, mapObj->coords2.y);
+ mapObj->previousMetatileBehavior = MapGridGetMetatileBehaviorAt(mapObj->previousCoords.x, mapObj->previousCoords.y);
+ mapObj->currentMetatileBehavior = MapGridGetMetatileBehaviorAt(mapObj->currentCoords.x, mapObj->currentCoords.y);
}
void GetGroundEffectFlags_Reflection(struct MapObject *mapObj, u32 *flags)
{
- u32 reflectionFlags[2] = { 0x00000020, 0x00000010 };
+ u32 reflectionFlags[2] = { GROUND_EFFECT_FLAG_REFLECTION, GROUND_EFFECT_FLAG_ICE_REFLECTION };
u8 type = FieldObjectCheckForReflectiveSurface(mapObj);
if (type)
{
- if (!mapObj->mapobj_bit_17)
+ if (!mapObj->hasReflection)
{
- mapObj->mapobj_bit_17 = 0;
- mapObj->mapobj_bit_17 = 1;
+ mapObj->hasReflection = 0;
+ mapObj->hasReflection = 1;
*flags |= reflectionFlags[type - 1];
}
}
else
{
- mapObj->mapobj_bit_17 = 0;
+ mapObj->hasReflection = 0;
}
}
void GetGroundEffectFlags_TallGrassOnSpawn(struct MapObject *mapObj, u32 *flags)
{
- if (MetatileBehavior_IsTallGrass(mapObj->mapobj_unk_1E))
- *flags |= 0x1;
+ if (MetatileBehavior_IsTallGrass(mapObj->currentMetatileBehavior))
+ *flags |= GROUND_EFFECT_FLAG_TALL_GRASS_ON_SPAWN;
}
void GetGroundEffectFlags_TallGrassOnBeginStep(struct MapObject *mapObj, u32 *flags)
{
- if (MetatileBehavior_IsTallGrass(mapObj->mapobj_unk_1E))
- *flags |= 0x2;
+ if (MetatileBehavior_IsTallGrass(mapObj->currentMetatileBehavior))
+ *flags |= GROUND_EFFECT_FLAG_TALL_GRASS_ON_MOVE;
}
void GetGroundEffectFlags_LongGrassOnSpawn(struct MapObject *mapObj, u32 *flags)
{
- if (MetatileBehavior_IsLongGrass(mapObj->mapobj_unk_1E))
- *flags |= 0x4;
+ if (MetatileBehavior_IsLongGrass(mapObj->currentMetatileBehavior))
+ *flags |= GROUND_EFFECT_FLAG_LONG_GRASS_ON_SPAWN;
}
void GetGroundEffectFlags_LongGrassOnBeginStep(struct MapObject *mapObj, u32 *flags)
{
- if (MetatileBehavior_IsLongGrass(mapObj->mapobj_unk_1E))
- *flags |= 0x8;
+ if (MetatileBehavior_IsLongGrass(mapObj->currentMetatileBehavior))
+ *flags |= GROUND_EFFECT_FLAG_LONG_GRASS_ON_MOVE;
}
void GetGroundEffectFlags_Tracks(struct MapObject *mapObj, u32 *flags)
{
- if (MetatileBehavior_IsDeepSand(mapObj->mapobj_unk_1F))
+ if (MetatileBehavior_IsDeepSand(mapObj->previousMetatileBehavior))
{
- *flags |= 0x100;
+ *flags |= GROUND_EFFECT_FLAG_DEEP_SAND;
}
- else if (MetatileBehavior_IsSandOrDeepSand(mapObj->mapobj_unk_1F)
- || MetatileBehavior_IsUnusedFootprintMetatile(mapObj->mapobj_unk_1F))
+ else if (MetatileBehavior_IsSandOrDeepSand(mapObj->previousMetatileBehavior)
+ || MetatileBehavior_IsUnusedFootprintMetatile(mapObj->previousMetatileBehavior))
{
- *flags |= 0x80;
+ *flags |= GROUND_EFFECT_FLAG_SAND;
}
}
void GetGroundEffectFlags_SandPile(struct MapObject *mapObj, u32 *flags)
{
- if (MetatileBehavior_IsDeepSand(mapObj->mapobj_unk_1E)
- && MetatileBehavior_IsDeepSand(mapObj->mapobj_unk_1F))
+ if (MetatileBehavior_IsDeepSand(mapObj->currentMetatileBehavior)
+ && MetatileBehavior_IsDeepSand(mapObj->previousMetatileBehavior))
{
- if (!mapObj->mapobj_bit_20)
+ if (!mapObj->inSandPile)
{
- mapObj->mapobj_bit_20 = 0;
- mapObj->mapobj_bit_20 = 1;
- *flags |= 0x800;
+ mapObj->inSandPile = 0;
+ mapObj->inSandPile = 1;
+ *flags |= GROUND_EFFECT_FLAG_SAND_PILE;
}
}
else
{
- mapObj->mapobj_bit_20 = 0;
+ mapObj->inSandPile = 0;
}
}
void GetGroundEffectFlags_ShallowFlowingWater(struct MapObject *mapObj, u32 *flags)
{
- if ((MetatileBehavior_IsShallowFlowingWater(mapObj->mapobj_unk_1E)
- && MetatileBehavior_IsShallowFlowingWater(mapObj->mapobj_unk_1F))
- || (MetatileBehavior_IsPacifidlogLog(mapObj->mapobj_unk_1E)
- && MetatileBehavior_IsPacifidlogLog(mapObj->mapobj_unk_1F)))
+ if ((MetatileBehavior_IsShallowFlowingWater(mapObj->currentMetatileBehavior)
+ && MetatileBehavior_IsShallowFlowingWater(mapObj->previousMetatileBehavior))
+ || (MetatileBehavior_IsPacifidlogLog(mapObj->currentMetatileBehavior)
+ && MetatileBehavior_IsPacifidlogLog(mapObj->previousMetatileBehavior)))
{
- if (!mapObj->mapobj_bit_19)
+ if (!mapObj->inShallowFlowingWater)
{
- mapObj->mapobj_bit_19 = 0;
- mapObj->mapobj_bit_19 = 1;
- *flags |= 0x40;
+ mapObj->inShallowFlowingWater = 0;
+ mapObj->inShallowFlowingWater = 1;
+ *flags |= GROUND_EFFECT_FLAG_SHALLOW_FLOWING_WATER;
}
}
else
{
- mapObj->mapobj_bit_19 = 0;
+ mapObj->inShallowFlowingWater = 0;
}
}
void GetGroundEffectFlags_Puddle(struct MapObject *mapObj, u32 *flags)
{
- if (MetatileBehavior_IsPuddle(mapObj->mapobj_unk_1E)
- && MetatileBehavior_IsPuddle(mapObj->mapobj_unk_1F))
+ if (MetatileBehavior_IsPuddle(mapObj->currentMetatileBehavior)
+ && MetatileBehavior_IsPuddle(mapObj->previousMetatileBehavior))
{
- *flags |= 0x400;
+ *flags |= GROUND_EFFECT_FLAG_PUDDLE;
}
}
void GetGroundEffectFlags_Ripple(struct MapObject *mapObj, u32 *flags)
{
- if (MetatileBehavior_HasRipples(mapObj->mapobj_unk_1E))
- *flags |= 0x200;
+ if (MetatileBehavior_HasRipples(mapObj->currentMetatileBehavior))
+ *flags |= GROUND_EFFECT_FLAG_RIPPLES;
}
void GetGroundEffectFlags_ShortGrass(struct MapObject *mapObj, u32 *flags)
{
- if (MetatileBehavior_IsShortGrass(mapObj->mapobj_unk_1E)
- && MetatileBehavior_IsShortGrass(mapObj->mapobj_unk_1F))
+ if (MetatileBehavior_IsShortGrass(mapObj->currentMetatileBehavior)
+ && MetatileBehavior_IsShortGrass(mapObj->previousMetatileBehavior))
{
- if (!mapObj->mapobj_bit_18)
+ if (!mapObj->inShortGrass)
{
- mapObj->mapobj_bit_18 = 0;
- mapObj->mapobj_bit_18 = 1;
- *flags |= 0x20000;
+ mapObj->inShortGrass = 0;
+ mapObj->inShortGrass = 1;
+ *flags |= GROUND_EFFECT_FLAG_SHORT_GRASS;
}
}
else
{
- mapObj->mapobj_bit_18 = 0;
+ mapObj->inShortGrass = 0;
}
}
void GetGroundEffectFlags_HotSprings(struct MapObject *mapObj, u32 *flags)
{
- if (MetatileBehavior_IsHotSprings(mapObj->mapobj_unk_1E)
- && MetatileBehavior_IsHotSprings(mapObj->mapobj_unk_1F))
+ if (MetatileBehavior_IsHotSprings(mapObj->currentMetatileBehavior)
+ && MetatileBehavior_IsHotSprings(mapObj->previousMetatileBehavior))
{
- if (!mapObj->mapobj_bit_21)
+ if (!mapObj->inHotSprings)
{
- mapObj->mapobj_bit_21 = 0;
- mapObj->mapobj_bit_21 = 1;
- *flags |= 0x40000;
+ mapObj->inHotSprings = 0;
+ mapObj->inHotSprings = 1;
+ *flags |= GROUND_EFFECT_FLAG_HOT_SPRINGS;
}
}
else
{
- mapObj->mapobj_bit_21 = 0;
+ mapObj->inHotSprings = 0;
}
}
void GetGroundEffectFlags_Seaweed(struct MapObject *mapObj, u32 *flags)
{
- if (MetatileBehavior_IsSeaweed(mapObj->mapobj_unk_1E))
- *flags |= 0x80000;
+ if (MetatileBehavior_IsSeaweed(mapObj->currentMetatileBehavior))
+ *flags |= GROUND_EFFECT_FLAG_SEAWEED;
}
void GetGroundEffectFlags_JumpLanding(struct MapObject *mapObj, u32 *flags)
@@ -8451,21 +8450,21 @@ void GetGroundEffectFlags_JumpLanding(struct MapObject *mapObj, u32 *flags)
};
static const u32 jumpLandingFlags[] = {
- 0x00001000, // Landing in tall grass
- 0x00002000, // Landing in long grass
- 0x00004000, // Landing on puddle
- 0x00008000, // Landing on surfable water or underwater
- 0x00004000, // Landing on shallow flowing water
- 0x00010000, // Landing on any other type of ground
+ GROUND_EFFECT_FLAG_LAND_IN_TALL_GRASS,
+ GROUND_EFFECT_FLAG_LAND_IN_LONG_GRASS,
+ GROUND_EFFECT_FLAG_LAND_IN_SHALLOW_WATER,
+ GROUND_EFFECT_FLAG_LAND_IN_DEEP_WATER,
+ GROUND_EFFECT_FLAG_LAND_IN_SHALLOW_WATER,
+ GROUND_EFFECT_FLAG_LAND_ON_NORMAL_GROUND,
};
- if (mapObj->mapobj_bit_5 && !mapObj->mapobj_bit_25)
+ if (mapObj->landingJump && !mapObj->disableJumpLandingGroundEffect)
{
u8 i;
- for (i = 0; i < 6; i++)
+ for (i = 0; i < ARRAY_COUNT(metatileFuncs); i++)
{
- if (metatileFuncs[i](mapObj->mapobj_unk_1E))
+ if (metatileFuncs[i](mapObj->currentMetatileBehavior))
{
*flags |= jumpLandingFlags[i];
return;
@@ -8495,14 +8494,14 @@ u8 FieldObjectCheckForReflectiveSurface(struct MapObject *mapObj)
for (i = 0, one = 1; i < height; i++)
{
- RETURN_REFLECTION_TYPE_AT(mapObj->coords2.x, mapObj->coords2.y + one + i)
- RETURN_REFLECTION_TYPE_AT(mapObj->coords3.x, mapObj->coords3.y + one + i)
+ RETURN_REFLECTION_TYPE_AT(mapObj->currentCoords.x, mapObj->currentCoords.y + one + i)
+ RETURN_REFLECTION_TYPE_AT(mapObj->previousCoords.x, mapObj->previousCoords.y + one + i)
for (j = 1; j < width; j++)
{
- RETURN_REFLECTION_TYPE_AT(mapObj->coords2.x + j, mapObj->coords2.y + one + i)
- RETURN_REFLECTION_TYPE_AT(mapObj->coords2.x - j, mapObj->coords2.y + one + i)
- RETURN_REFLECTION_TYPE_AT(mapObj->coords3.x + j, mapObj->coords3.y + one + i)
- RETURN_REFLECTION_TYPE_AT(mapObj->coords3.x - j, mapObj->coords3.y + one + i)
+ RETURN_REFLECTION_TYPE_AT(mapObj->currentCoords.x + j, mapObj->currentCoords.y + one + i)
+ RETURN_REFLECTION_TYPE_AT(mapObj->currentCoords.x - j, mapObj->currentCoords.y + one + i)
+ RETURN_REFLECTION_TYPE_AT(mapObj->previousCoords.x + j, mapObj->previousCoords.y + one + i)
+ RETURN_REFLECTION_TYPE_AT(mapObj->previousCoords.x - j, mapObj->previousCoords.y + one + i)
}
}
return 0;
@@ -8548,18 +8547,18 @@ u8 GetLedgeJumpDirection(s16 x, s16 y, u8 z)
void FieldObjectSetSpriteOamTableForLongGrass(struct MapObject *mapObj, struct Sprite *sprite)
{
- if (mapObj->mapobj_bit_4)
+ if (mapObj->disableCoveringGroundEffects)
return;
- if (!MetatileBehavior_IsLongGrass(mapObj->mapobj_unk_1E))
+ if (!MetatileBehavior_IsLongGrass(mapObj->currentMetatileBehavior))
return;
- if (!MetatileBehavior_IsLongGrass(mapObj->mapobj_unk_1F))
+ if (!MetatileBehavior_IsLongGrass(mapObj->previousMetatileBehavior))
return;
sprite->subspriteTableNum = 4;
- if (ZCoordToPriority(mapObj->elevation) == 1)
+ if (ZCoordToPriority(mapObj->previousElevation) == 1)
sprite->subspriteTableNum = 5;
}
@@ -8601,13 +8600,13 @@ static const u8 sFieldObjectPriorities_08376070[] = {
void FieldObjectUpdateZCoordAndPriority(struct MapObject *mapObj, struct Sprite *sprite)
{
- if (mapObj->mapobj_bit_26)
+ if (mapObj->fixedPriority)
return;
FieldObjectUpdateZCoord(mapObj);
- sprite->subspriteTableNum = sFieldObjectPriorities_08376070[mapObj->elevation];
- sprite->oam.priority = sFieldObjectPriorities_08376060[mapObj->elevation];
+ sprite->subspriteTableNum = sFieldObjectPriorities_08376070[mapObj->previousElevation];
+ sprite->oam.priority = sFieldObjectPriorities_08376060[mapObj->previousElevation];
}
void InitObjectPriorityByZCoord(struct Sprite *sprite, u8 z)
@@ -8623,16 +8622,16 @@ u8 ZCoordToPriority(u8 z)
void FieldObjectUpdateZCoord(struct MapObject *mapObj)
{
- u8 z = MapGridGetZCoordAt(mapObj->coords2.x, mapObj->coords2.y);
- u8 z2 = MapGridGetZCoordAt(mapObj->coords3.x, mapObj->coords3.y);
+ u8 z = MapGridGetZCoordAt(mapObj->currentCoords.x, mapObj->currentCoords.y);
+ u8 z2 = MapGridGetZCoordAt(mapObj->previousCoords.x, mapObj->previousCoords.y);
if (z == 0xF || z2 == 0xF)
return;
- mapObj->mapobj_unk_0B_0 = z;
+ mapObj->currentElevation = z;
if (z != 0 && z != 0xF)
- mapObj->elevation = z;
+ mapObj->previousElevation = z;
}
void SetObjectSubpriorityByZCoord(u8 a, struct Sprite *sprite, u8 b)
@@ -8647,10 +8646,10 @@ void SetObjectSubpriorityByZCoord(u8 a, struct Sprite *sprite, u8 b)
void FieldObjectUpdateSubpriority(struct MapObject *mapObj, struct Sprite *sprite)
{
- if (mapObj->mapobj_bit_26)
+ if (mapObj->fixedPriority)
return;
- SetObjectSubpriorityByZCoord(mapObj->elevation, sprite, 1);
+ SetObjectSubpriorityByZCoord(mapObj->previousElevation, sprite, 1);
}
bool8 AreZCoordsCompatible(u8 a, u8 b)
@@ -8666,9 +8665,9 @@ bool8 AreZCoordsCompatible(u8 a, u8 b)
void GroundEffect_SpawnOnTallGrass(struct MapObject *mapObj, struct Sprite *sprite)
{
- gFieldEffectArguments[0] = mapObj->coords2.x;
- gFieldEffectArguments[1] = mapObj->coords2.y;
- gFieldEffectArguments[2] = mapObj->elevation;
+ gFieldEffectArguments[0] = mapObj->currentCoords.x;
+ gFieldEffectArguments[1] = mapObj->currentCoords.y;
+ gFieldEffectArguments[2] = mapObj->previousElevation;
gFieldEffectArguments[3] = 2;
gFieldEffectArguments[4] = mapObj->localId << 8 | mapObj->mapNum;
gFieldEffectArguments[5] = mapObj->mapGroup;
@@ -8677,11 +8676,11 @@ void GroundEffect_SpawnOnTallGrass(struct MapObject *mapObj, struct Sprite *spri
FieldEffectStart(FLDEFF_TALL_GRASS);
}
-void sub_8063E94(struct MapObject *mapObj, struct Sprite *sprite)
+void GroundEffect_MoveOnTallGrass(struct MapObject *mapObj, struct Sprite *sprite)
{
- gFieldEffectArguments[0] = mapObj->coords2.x;
- gFieldEffectArguments[1] = mapObj->coords2.y;
- gFieldEffectArguments[2] = mapObj->elevation;
+ gFieldEffectArguments[0] = mapObj->currentCoords.x;
+ gFieldEffectArguments[1] = mapObj->currentCoords.y;
+ gFieldEffectArguments[2] = mapObj->previousElevation;
gFieldEffectArguments[3] = 2;
gFieldEffectArguments[4] = mapObj->localId << 8 | mapObj->mapNum;
gFieldEffectArguments[5] = mapObj->mapGroup;
@@ -8690,11 +8689,11 @@ void sub_8063E94(struct MapObject *mapObj, struct Sprite *sprite)
FieldEffectStart(FLDEFF_TALL_GRASS);
}
-void sub_8063EE0(struct MapObject *mapObj, struct Sprite *sprite)
+void GroundEffect_SpawnOnLongGrass(struct MapObject *mapObj, struct Sprite *sprite)
{
- gFieldEffectArguments[0] = mapObj->coords2.x;
- gFieldEffectArguments[1] = mapObj->coords2.y;
- gFieldEffectArguments[2] = mapObj->elevation;
+ gFieldEffectArguments[0] = mapObj->currentCoords.x;
+ gFieldEffectArguments[1] = mapObj->currentCoords.y;
+ gFieldEffectArguments[2] = mapObj->previousElevation;
gFieldEffectArguments[3] = 2;
gFieldEffectArguments[4] = mapObj->localId << 8 | mapObj->mapNum;
gFieldEffectArguments[5] = mapObj->mapGroup;
@@ -8703,11 +8702,11 @@ void sub_8063EE0(struct MapObject *mapObj, struct Sprite *sprite)
FieldEffectStart(FLDEFF_LONG_GRASS);
}
-void sub_8063F2C(struct MapObject *mapObj, struct Sprite *sprite)
+void GroundEffect_MoveOnLongGrass(struct MapObject *mapObj, struct Sprite *sprite)
{
- gFieldEffectArguments[0] = mapObj->coords2.x;
- gFieldEffectArguments[1] = mapObj->coords2.y;
- gFieldEffectArguments[2] = mapObj->elevation;
+ gFieldEffectArguments[0] = mapObj->currentCoords.x;
+ gFieldEffectArguments[1] = mapObj->currentCoords.y;
+ gFieldEffectArguments[2] = mapObj->previousElevation;
gFieldEffectArguments[3] = 2;
gFieldEffectArguments[4] = (mapObj->localId << 8) | mapObj->mapNum;
gFieldEffectArguments[5] = mapObj->mapGroup;
@@ -8735,13 +8734,13 @@ static void (*const gUnknown_08376080[])(struct MapObject *mapObj, struct Sprite
nullsub, DoTracksGroundEffect_Footprints, DoTracksGroundEffect_BikeTireTracks,
};
-void sub_8063FA0(struct MapObject *mapObj, struct Sprite *sprite)
+void GroundEffect_SandTracks(struct MapObject *mapObj, struct Sprite *sprite)
{
const struct MapObjectGraphicsInfo *info = GetFieldObjectGraphicsInfo(mapObj->graphicsId);
gUnknown_08376080[info->tracks](mapObj, sprite, 0);
}
-void sub_8063FCC(struct MapObject *mapObj, struct Sprite *sprite)
+void GroundEffect_DeepSandTracks(struct MapObject *mapObj, struct Sprite *sprite)
{
const struct MapObjectGraphicsInfo *info = GetFieldObjectGraphicsInfo(mapObj->graphicsId);
gUnknown_08376080[info->tracks](mapObj, sprite, 1);
@@ -8759,11 +8758,11 @@ static void DoTracksGroundEffect_Footprints(struct MapObject *mapObj, struct Spr
FLDEFF_DEEP_SAND_FOOTPRINTS
};
- gFieldEffectArguments[0] = mapObj->coords3.x;
- gFieldEffectArguments[1] = mapObj->coords3.y;
+ gFieldEffectArguments[0] = mapObj->previousCoords.x;
+ gFieldEffectArguments[1] = mapObj->previousCoords.y;
gFieldEffectArguments[2] = 149;
gFieldEffectArguments[3] = 2;
- gFieldEffectArguments[4] = mapObj->mapobj_unk_18;
+ gFieldEffectArguments[4] = mapObj->facingDirection;
FieldEffectStart(sandFootprints_FieldEffectData[a]);
}
@@ -8783,14 +8782,14 @@ static void DoTracksGroundEffect_BikeTireTracks(
6, 7, 3, 4,
};
- if (mapObj->coords2.x != mapObj->coords3.x || mapObj->coords2.y != mapObj->coords3.y)
+ if (mapObj->currentCoords.x != mapObj->previousCoords.x || mapObj->currentCoords.y != mapObj->previousCoords.y)
{
- gFieldEffectArguments[0] = mapObj->coords3.x;
- gFieldEffectArguments[1] = mapObj->coords3.y;
+ gFieldEffectArguments[0] = mapObj->previousCoords.x;
+ gFieldEffectArguments[1] = mapObj->previousCoords.y;
gFieldEffectArguments[2] = 149;
gFieldEffectArguments[3] = 2;
gFieldEffectArguments[4] =
- bikeTireTracks_Transitions[mapObj->mapobj_unk_20][mapObj->mapobj_unk_18 - 5];
+ bikeTireTracks_Transitions[mapObj->previousMovementDirection][mapObj->facingDirection - 5];
FieldEffectStart(FLDEFF_BIKE_TIRE_TRACKS);
}
}
@@ -8814,14 +8813,14 @@ void GroundEffect_JumpOnTallGrass(struct MapObject *mapObj, struct Sprite *sprit
{
u8 spriteId;
- gFieldEffectArguments[0] = mapObj->coords2.x;
- gFieldEffectArguments[1] = mapObj->coords2.y;
- gFieldEffectArguments[2] = mapObj->elevation;
+ gFieldEffectArguments[0] = mapObj->currentCoords.x;
+ gFieldEffectArguments[1] = mapObj->currentCoords.y;
+ gFieldEffectArguments[2] = mapObj->previousElevation;
gFieldEffectArguments[3] = 2;
FieldEffectStart(FLDEFF_JUMP_TALL_GRASS);
spriteId = sub_8126FF0(
- mapObj->localId, mapObj->mapNum, mapObj->mapGroup, mapObj->coords2.x, mapObj->coords2.y);
+ mapObj->localId, mapObj->mapNum, mapObj->mapGroup, mapObj->currentCoords.x, mapObj->currentCoords.y);
if (spriteId == MAX_SPRITES)
GroundEffect_SpawnOnTallGrass(mapObj, sprite);
@@ -8829,36 +8828,36 @@ void GroundEffect_JumpOnTallGrass(struct MapObject *mapObj, struct Sprite *sprit
void GroundEffect_JumpOnLongGrass(struct MapObject *mapObj, struct Sprite *sprite)
{
- gFieldEffectArguments[0] = mapObj->coords2.x;
- gFieldEffectArguments[1] = mapObj->coords2.y;
- gFieldEffectArguments[2] = mapObj->elevation;
+ gFieldEffectArguments[0] = mapObj->currentCoords.x;
+ gFieldEffectArguments[1] = mapObj->currentCoords.y;
+ gFieldEffectArguments[2] = mapObj->previousElevation;
gFieldEffectArguments[3] = 2;
FieldEffectStart(FLDEFF_JUMP_LONG_GRASS);
}
void GroundEffect_JumpOnShallowWater(struct MapObject *mapObj, struct Sprite *sprite)
{
- gFieldEffectArguments[0] = mapObj->coords2.x;
- gFieldEffectArguments[1] = mapObj->coords2.y;
- gFieldEffectArguments[2] = mapObj->elevation;
+ gFieldEffectArguments[0] = mapObj->currentCoords.x;
+ gFieldEffectArguments[1] = mapObj->currentCoords.y;
+ gFieldEffectArguments[2] = mapObj->previousElevation;
gFieldEffectArguments[3] = sprite->oam.priority;
FieldEffectStart(FLDEFF_JUMP_SMALL_SPLASH);
}
void GroundEffect_JumpOnWater(struct MapObject *mapObj, struct Sprite *sprite)
{
- gFieldEffectArguments[0] = mapObj->coords2.x;
- gFieldEffectArguments[1] = mapObj->coords2.y;
- gFieldEffectArguments[2] = mapObj->elevation;
+ gFieldEffectArguments[0] = mapObj->currentCoords.x;
+ gFieldEffectArguments[1] = mapObj->currentCoords.y;
+ gFieldEffectArguments[2] = mapObj->previousElevation;
gFieldEffectArguments[3] = sprite->oam.priority;
FieldEffectStart(FLDEFF_JUMP_BIG_SPLASH);
}
void GroundEffect_JumpLandingDust(struct MapObject *mapObj, struct Sprite *sprite)
{
- gFieldEffectArguments[0] = mapObj->coords2.x;
- gFieldEffectArguments[1] = mapObj->coords2.y;
- gFieldEffectArguments[2] = mapObj->elevation;
+ gFieldEffectArguments[0] = mapObj->currentCoords.x;
+ gFieldEffectArguments[1] = mapObj->currentCoords.y;
+ gFieldEffectArguments[2] = mapObj->previousElevation;
gFieldEffectArguments[3] = sprite->oam.priority;
FieldEffectStart(FLDEFF_DUST);
}
@@ -8875,21 +8874,21 @@ void GroundEffect_HotSprings(struct MapObject *mapObj, struct Sprite *sprite)
void GroundEffect_Seaweed(struct MapObject *mapObj, struct Sprite *sprite)
{
- gFieldEffectArguments[0] = mapObj->coords2.x;
- gFieldEffectArguments[1] = mapObj->coords2.y;
+ gFieldEffectArguments[0] = mapObj->currentCoords.x;
+ gFieldEffectArguments[1] = mapObj->currentCoords.y;
FieldEffectStart(FLDEFF_BUBBLES);
}
-static void (*const gUnknown_083760A0[])(struct MapObject *mapObj, struct Sprite *sprite) = {
+static void (*const sGroundEffectFuncs[])(struct MapObject *mapObj, struct Sprite *sprite) = {
GroundEffect_SpawnOnTallGrass,
- sub_8063E94,
- sub_8063EE0,
- sub_8063F2C,
+ GroundEffect_MoveOnTallGrass,
+ GroundEffect_SpawnOnLongGrass,
+ GroundEffect_MoveOnLongGrass,
GroundEffect_WaterReflection,
GroundEffect_IceReflection,
GroundEffect_FlowingWater,
- sub_8063FA0,
- sub_8063FCC,
+ GroundEffect_SandTracks,
+ GroundEffect_DeepSandTracks,
GroundEffect_Ripple,
GroundEffect_StepOnPuddle,
GroundEffect_SandPile,
@@ -8903,45 +8902,49 @@ static void (*const gUnknown_083760A0[])(struct MapObject *mapObj, struct Sprite
GroundEffect_Seaweed
};
-void sub_8064218(struct MapObject *mapObj, struct Sprite *sprite, u32 flags)
+static void StartTriggeredGroundEffects(struct MapObject *mapObj, struct Sprite *sprite, u32 flags)
{
u8 i;
- for (i = 0; i < ARRAY_COUNT(gUnknown_083760A0); i++, flags >>= 1)
+ for (i = 0; i < ARRAY_COUNT(sGroundEffectFuncs); i++, flags >>= 1)
if (flags & 1)
- gUnknown_083760A0[i](mapObj, sprite);
+ sGroundEffectFuncs[i](mapObj, sprite);
}
void filters_out_some_ground_effects(struct MapObject *mapObj, u32 *flags)
{
- if (mapObj->mapobj_bit_4)
+ if (mapObj->disableCoveringGroundEffects)
{
- mapObj->mapobj_bit_18 = 0;
- mapObj->mapobj_bit_20 = 0;
- mapObj->mapobj_bit_19 = 0;
- mapObj->mapobj_bit_21 = 0;
- *flags &= 0xFFF9F7BD;
+ mapObj->inShortGrass = 0;
+ mapObj->inSandPile = 0;
+ mapObj->inShallowFlowingWater = 0;
+ mapObj->inHotSprings = 0;
+ *flags &= ~(GROUND_EFFECT_FLAG_HOT_SPRINGS
+ | GROUND_EFFECT_FLAG_SHORT_GRASS
+ | GROUND_EFFECT_FLAG_SAND_PILE
+ | GROUND_EFFECT_FLAG_SHALLOW_FLOWING_WATER
+ | GROUND_EFFECT_FLAG_TALL_GRASS_ON_MOVE);
}
}
void FilterOutStepOnPuddleGroundEffectIfJumping(struct MapObject *mapObj, u32 *flags)
{
- if (mapObj->mapobj_bit_5)
- *flags &= 0xFFFFFBFF;
+ if (mapObj->landingJump)
+ *flags &= ~GROUND_EFFECT_FLAG_PUDDLE;
}
void DoGroundEffects_OnSpawn(struct MapObject *mapObj, struct Sprite *sprite)
{
u32 flags;
- if (mapObj->mapobj_bit_2)
+ if (mapObj->triggerGroundEffectsOnMove)
{
flags = 0;
FieldObjectUpdateZCoordAndPriority(mapObj, sprite);
GetAllGroundEffectFlags_OnSpawn(mapObj, &flags);
FieldObjectSetSpriteOamTableForLongGrass(mapObj, sprite);
- sub_8064218(mapObj, sprite, flags);
- mapObj->mapobj_bit_2 = 0;
- mapObj->mapobj_bit_4 = 0;
+ StartTriggeredGroundEffects(mapObj, sprite, flags);
+ mapObj->triggerGroundEffectsOnMove = 0;
+ mapObj->disableCoveringGroundEffects = 0;
}
}
@@ -8949,16 +8952,16 @@ void DoGroundEffects_OnBeginStep(struct MapObject *mapObj, struct Sprite *sprite
{
u32 flags;
- if (mapObj->mapobj_bit_2)
+ if (mapObj->triggerGroundEffectsOnMove)
{
flags = 0;
FieldObjectUpdateZCoordAndPriority(mapObj, sprite);
GetAllGroundEffectFlags_OnBeginStep(mapObj, &flags);
FieldObjectSetSpriteOamTableForLongGrass(mapObj, sprite);
filters_out_some_ground_effects(mapObj, &flags);
- sub_8064218(mapObj, sprite, flags);
- mapObj->mapobj_bit_2 = 0;
- mapObj->mapobj_bit_4 = 0;
+ StartTriggeredGroundEffects(mapObj, sprite, flags);
+ mapObj->triggerGroundEffectsOnMove = 0;
+ mapObj->disableCoveringGroundEffects = 0;
}
}
@@ -8966,16 +8969,16 @@ void DoGroundEffects_OnFinishStep(struct MapObject *mapObj, struct Sprite *sprit
{
u32 flags;
- if (mapObj->mapobj_bit_3)
+ if (mapObj->triggerGroundEffectsOnStop)
{
flags = 0;
FieldObjectUpdateZCoordAndPriority(mapObj, sprite);
GetAllGroundEffectFlags_OnFinishStep(mapObj, &flags);
FieldObjectSetSpriteOamTableForLongGrass(mapObj, sprite);
FilterOutStepOnPuddleGroundEffectIfJumping(mapObj, &flags);
- sub_8064218(mapObj, sprite, flags);
- mapObj->mapobj_bit_3 = 0;
- mapObj->mapobj_bit_5 = 0;
+ StartTriggeredGroundEffects(mapObj, sprite, flags);
+ mapObj->triggerGroundEffectsOnStop = 0;
+ mapObj->landingJump = 0;
}
}
@@ -9070,15 +9073,15 @@ const s8 *const gUnknown_083761D0[] = {
bool8 FreezeMapObject(struct MapObject *mapObject)
{
- if (mapObject->mapobj_bit_6 || mapObject->mapobj_bit_8)
+ if (mapObject->specialAnimActive || mapObject->frozen)
{
return TRUE;
}
else
{
- mapObject->mapobj_bit_8 = 1;
- mapObject->mapobj_bit_23 = gSprites[mapObject->spriteId].animPaused;
- mapObject->mapobj_bit_24 = gSprites[mapObject->spriteId].affineAnimPaused;
+ mapObject->frozen = 1;
+ mapObject->spriteAnimPausedBackup = gSprites[mapObject->spriteId].animPaused;
+ mapObject->spriteAffineAnimPausedBackup = gSprites[mapObject->spriteId].affineAnimPaused;
gSprites[mapObject->spriteId].animPaused = 1;
gSprites[mapObject->spriteId].affineAnimPaused = 1;
return FALSE;
@@ -9103,11 +9106,11 @@ void FreezeMapObjectsExceptOne(u8 a1)
void UnfreezeMapObject(struct MapObject *mapObject)
{
- if (mapObject->active && mapObject->mapobj_bit_8)
+ if (mapObject->active && mapObject->frozen)
{
- mapObject->mapobj_bit_8 = 0;
- gSprites[mapObject->spriteId].animPaused = mapObject->mapobj_bit_23;
- gSprites[mapObject->spriteId].affineAnimPaused = mapObject->mapobj_bit_24;
+ mapObject->frozen = 0;
+ gSprites[mapObject->spriteId].animPaused = mapObject->spriteAnimPausedBackup;
+ gSprites[mapObject->spriteId].affineAnimPaused = mapObject->spriteAffineAnimPausedBackup;
}
}
@@ -9343,9 +9346,9 @@ u32 oe_exec_and_other_stuff(u8 fieldEffectId, struct MapObject *mapObject)
void DoShadowFieldEffect(struct MapObject *mapObject)
{
- if (!mapObject->mapobj_bit_22)
+ if (!mapObject->hasShadow)
{
- mapObject->mapobj_bit_22 = 1;
+ mapObject->hasShadow = 1;
oe_exec_and_other_stuff(FLDEFF_SHADOW, mapObject);
}
}
diff --git a/src/field_effect.c b/src/field_effect.c
index 1617d8f51..51d1a1a0a 100644
--- a/src/field_effect.c
+++ b/src/field_effect.c
@@ -1118,7 +1118,7 @@ void mapldr_08084390(void)
Overworld_PlaySpecialMapMusic();
pal_fill_black();
CreateTask(c3_080843F8, 0);
- gMapObjects[gPlayerAvatar.mapObjectId].mapobj_bit_13 = 1;
+ gMapObjects[gPlayerAvatar.mapObjectId].invisible = 1;
if (gPlayerAvatar.flags & 0x08)
{
FieldObjectTurn(&gMapObjects[gPlayerAvatar.mapObjectId], DIR_WEST);
@@ -1178,11 +1178,11 @@ bool8 sub_80867AC(struct Task *task) // gUnknown_0839F2CC[0]
playerObject = &gMapObjects[gPlayerAvatar.mapObjectId];
playerSprite = &gSprites[gPlayerAvatar.spriteId];
CameraObjectReset2();
- gMapObjects[gPlayerAvatar.mapObjectId].mapobj_bit_13 = 1;
+ gMapObjects[gPlayerAvatar.mapObjectId].invisible = 1;
gPlayerAvatar.preventStep = TRUE;
FieldObjectSetSpecialAnim(playerObject, GetFaceDirectionAnimId(player_get_direction_lower_nybble()));
task->data[4] = playerSprite->subspriteMode;
- playerObject->mapobj_bit_26 = 1;
+ playerObject->fixedPriority = 1;
playerSprite->oam.priority = 1;
playerSprite->subspriteMode = 2;
task->data[0]++;
@@ -1207,7 +1207,7 @@ bool8 sub_8086870(struct Task *task) // gUnknown_0839F2CC[2]
sprite->pos2.y = -(sprite->pos1.y + sprite->centerToCornerVecY + gSpriteCoordOffsetY + centerToCornerVecY);
task->data[1] = 1;
task->data[2] = 0;
- gMapObjects[gPlayerAvatar.mapObjectId].mapobj_bit_13 = 0;
+ gMapObjects[gPlayerAvatar.mapObjectId].invisible = 0;
PlaySE(SE_RU_HYUU);
task->data[0]++;
return FALSE;
@@ -1232,15 +1232,15 @@ bool8 sub_80868E4(struct Task *task)
if (task->data[3] == 0 && sprite->pos2.y >= -16)
{
task->data[3]++;
- mapObject->mapobj_bit_26 = 0;
+ mapObject->fixedPriority = 0;
sprite->subspriteMode = task->data[4];
- mapObject->mapobj_bit_2 = 1;
+ mapObject->triggerGroundEffectsOnMove = 1;
}
if (sprite->pos2.y >= 0)
{
PlaySE(SE_W070);
- mapObject->mapobj_bit_3 = 1;
- mapObject->mapobj_bit_5 = 1;
+ mapObject->triggerGroundEffectsOnStop = 1;
+ mapObject->landingJump = 1;
sprite->pos2.y = 0;
task->data[0]++;
}
@@ -1611,7 +1611,7 @@ bool8 sub_8087058(struct Task *task, struct MapObject *mapObject)
{
return FALSE;
}
- if (MetatileBehavior_IsWaterfall(mapObject->mapobj_unk_1E))
+ if (MetatileBehavior_IsWaterfall(mapObject->currentMetatileBehavior))
{
task->data[0] = 3;
return TRUE;
@@ -1663,7 +1663,7 @@ bool8 dive_3_unknown(struct Task *task)
PlayerGetDestCoords(&mapPosition.x, &mapPosition.y);
if (!FieldEffectActiveListContains(FLDEFF_FIELD_MOVE_SHOW_MON))
{
- dive_warp(&mapPosition, gMapObjects[gPlayerAvatar.mapObjectId].mapobj_unk_1E);
+ dive_warp(&mapPosition, gMapObjects[gPlayerAvatar.mapObjectId].currentMetatileBehavior);
DestroyTask(FindTaskIdByFunc(Task_Dive));
FieldEffectActiveListRemove(FLDEFF_USE_DIVE);
}
@@ -1689,7 +1689,7 @@ bool8 sub_808722C(struct Task *task, struct MapObject *mapObject, struct Sprite
CameraObjectReset2();
SetCameraPanningCallback(NULL);
gPlayerAvatar.preventStep = TRUE;
- mapObject->mapobj_bit_26 = 1;
+ mapObject->fixedPriority = 1;
task->data[1] = 1;
task->data[0]++;
return TRUE;
@@ -1712,8 +1712,8 @@ bool8 sub_8087298(struct Task *task, struct MapObject *mapObject, struct Sprite
{
sprite->pos2.y = 0;
task->data[3] = 1;
- gFieldEffectArguments[0] = mapObject->coords2.x;
- gFieldEffectArguments[1] = mapObject->coords2.y;
+ gFieldEffectArguments[0] = mapObject->currentCoords.x;
+ gFieldEffectArguments[1] = mapObject->currentCoords.y;
gFieldEffectArguments[2] = sprite->subpriority - 1;
gFieldEffectArguments[3] = sprite->oam.priority;
FieldEffectStart(FLDEFF_LAVARIDGE_GYM_WARP);
@@ -1754,7 +1754,7 @@ bool8 sub_80872E4(struct Task *task, struct MapObject *mapObject, struct Sprite
if (task->data[5] == 0 && sprite->pos2.y < -0x10)
{
task->data[5]++;
- mapObject->mapobj_bit_26 = 1;
+ mapObject->fixedPriority = 1;
sprite->oam.priority = 1;
sprite->subspriteMode = 2;
}
@@ -1806,7 +1806,7 @@ bool8 sub_80874CC(struct Task *task, struct MapObject *mapObject, struct Sprite
CameraObjectReset2();
FreezeMapObjects();
gPlayerAvatar.preventStep = TRUE;
- mapObject->mapobj_bit_13 = 1;
+ mapObject->invisible = 1;
task->data[0]++;
return FALSE;
}
@@ -1815,8 +1815,8 @@ bool8 sub_80874FC(struct Task *task, struct MapObject *mapObject, struct Sprite
{
if (IsWeatherNotFadingIn())
{
- gFieldEffectArguments[0] = mapObject->coords2.x;
- gFieldEffectArguments[1] = mapObject->coords2.y;
+ gFieldEffectArguments[0] = mapObject->currentCoords.x;
+ gFieldEffectArguments[1] = mapObject->currentCoords.y;
gFieldEffectArguments[2] = sprite->subpriority - 1;
gFieldEffectArguments[3] = sprite->oam.priority;
task->data[1] = FieldEffectStart(FLDEFF_POP_OUT_OF_ASH);
@@ -1831,7 +1831,7 @@ bool8 sub_8087548(struct Task *task, struct MapObject *mapObject, struct Sprite
if (sprite->animCmdIndex > 1)
{
task->data[0]++;
- mapObject->mapobj_bit_13 = 0;
+ mapObject->invisible = 0;
CameraObjectReset1();
PlaySE(SE_W091);
FieldObjectSetSpecialAnim(mapObject, sub_80608A4(DIR_EAST));
@@ -1889,7 +1889,7 @@ bool8 sub_80876C8(struct Task *task, struct MapObject *mapObject, struct Sprite
FreezeMapObjects();
CameraObjectReset2();
gPlayerAvatar.preventStep = TRUE;
- mapObject->mapobj_bit_26 = 1;
+ mapObject->fixedPriority = 1;
task->data[0]++;
return FALSE;
}
@@ -1900,8 +1900,8 @@ bool8 sub_80876F8(struct Task *task, struct MapObject *mapObject, struct Sprite
{
if (task->data[1] > 3)
{
- gFieldEffectArguments[0] = mapObject->coords2.x;
- gFieldEffectArguments[1] = mapObject->coords2.y;
+ gFieldEffectArguments[0] = mapObject->currentCoords.x;
+ gFieldEffectArguments[1] = mapObject->currentCoords.y;
gFieldEffectArguments[2] = sprite->subpriority - 1;
gFieldEffectArguments[3] = sprite->oam.priority;
task->data[1] = FieldEffectStart(FLDEFF_POP_OUT_OF_ASH);
@@ -1909,7 +1909,7 @@ bool8 sub_80876F8(struct Task *task, struct MapObject *mapObject, struct Sprite
} else
{
task->data[1]++;
- FieldObjectSetSpecialAnim(mapObject, GetStepInPlaceDelay4AnimId(mapObject->mapobj_unk_18));
+ FieldObjectSetSpecialAnim(mapObject, GetStepInPlaceDelay4AnimId(mapObject->facingDirection));
PlaySE(SE_FU_ZUZUZU);
}
}
@@ -1920,7 +1920,7 @@ bool8 sub_8087774(struct Task *task, struct MapObject *mapObject, struct Sprite
{
if (gSprites[task->data[1]].animCmdIndex == 2)
{
- mapObject->mapobj_bit_13 = 1;
+ mapObject->invisible = 1;
task->data[0]++;
}
return FALSE;
@@ -2011,7 +2011,7 @@ void sub_8087914(struct Task *task)
DestroyTask(FindTaskIdByFunc(sub_80878C4));
} else if (task->data[1] == 0 || (--task->data[1]) == 0)
{
- FieldObjectSetSpecialAnim(mapObject, GetFaceDirectionAnimId(unknown_0839F380[mapObject->mapobj_unk_18]));
+ FieldObjectSetSpecialAnim(mapObject, GetFaceDirectionAnimId(unknown_0839F380[mapObject->facingDirection]));
if (task->data[2] < 12)
{
task->data[2]++;
@@ -2035,7 +2035,7 @@ void mapldr_080859D4(void)
ScriptContext2_Enable();
FreezeMapObjects();
gFieldCallback = NULL;
- gMapObjects[gPlayerAvatar.mapObjectId].mapobj_bit_13 = 1;
+ gMapObjects[gPlayerAvatar.mapObjectId].invisible = 1;
CreateTask(sub_8087A74, 0);
}
@@ -2065,20 +2065,20 @@ void sub_8087AC8(struct Task *task)
}
if (task->data[2] >= 32 && task->data[15] == player_get_direction_lower_nybble())
{
- mapObject->mapobj_bit_13 = 0;
+ mapObject->invisible = 0;
ScriptContext2_Disable();
UnfreezeMapObjects();
DestroyTask(FindTaskIdByFunc(sub_8087A74));
return;
}
- FieldObjectSetSpecialAnim(mapObject, GetFaceDirectionAnimId(unknown_0839F380[mapObject->mapobj_unk_18]));
+ FieldObjectSetSpecialAnim(mapObject, GetFaceDirectionAnimId(unknown_0839F380[mapObject->facingDirection]));
if (task->data[2] < 32)
{
task->data[2]++;
}
task->data[1] = task->data[2] >> 2;
}
- mapObject->mapobj_bit_13 ^= 1;
+ mapObject->invisible ^= 1;
}
static void ExecuteTeleportFieldEffectTask(u8);
@@ -2120,11 +2120,11 @@ static void TeleportFieldEffectTask2(struct Task *task)
struct MapObject *mapObject = &gMapObjects[gPlayerAvatar.mapObjectId];
if (task->data[1] == 0 || (--task->data[1]) == 0)
{
- FieldObjectTurn(mapObject, spinDirections[mapObject->mapobj_unk_18]);
+ FieldObjectTurn(mapObject, spinDirections[mapObject->facingDirection]);
task->data[1] = 8;
task->data[2]++;
}
- if (task->data[2] > 7 && task->data[15] == mapObject->mapobj_unk_18)
+ if (task->data[2] > 7 && task->data[15] == mapObject->facingDirection)
{
task->data[0]++;
task->data[1] = 4;
@@ -2142,7 +2142,7 @@ static void TeleportFieldEffectTask3(struct Task *task)
if ((--task->data[1]) <= 0)
{
task->data[1] = 4;
- FieldObjectTurn(mapObject, spinDirections[mapObject->mapobj_unk_18]);
+ FieldObjectTurn(mapObject, spinDirections[mapObject->facingDirection]);
}
sprite->pos1.y -= task->data[3];
task->data[4] += task->data[3];
@@ -2183,7 +2183,7 @@ static void mapldr_08085D88(void)
ScriptContext2_Enable();
FreezeMapObjects();
gFieldCallback = NULL;
- gMapObjects[gPlayerAvatar.mapObjectId].mapobj_bit_13 = 1;
+ gMapObjects[gPlayerAvatar.mapObjectId].invisible = 1;
CameraObjectReset2();
CreateTask(sub_8087E1C, 0);
}
@@ -2208,7 +2208,7 @@ void sub_8087E4C(struct Task *task)
sprite = &gSprites[gPlayerAvatar.spriteId];
centerToCornerVecY = -(sprite->centerToCornerVecY << 1);
sprite->pos2.y = -(sprite->pos1.y + sprite->centerToCornerVecY + gSpriteCoordOffsetY + centerToCornerVecY);
- gMapObjects[gPlayerAvatar.mapObjectId].mapobj_bit_13 = 0;
+ gMapObjects[gPlayerAvatar.mapObjectId].invisible = 0;
task->data[0]++;
task->data[1] = 8;
task->data[2] = 1;
@@ -2228,7 +2228,7 @@ void sub_8087ED8(struct Task *task)
if (task->data[13] == 0)
{
task->data[13]++;
- mapObject->mapobj_bit_2 = 1;
+ mapObject->triggerGroundEffectsOnMove = 1;
sprite->subspriteMode = task->data[14];
}
} else
@@ -2246,7 +2246,7 @@ void sub_8087ED8(struct Task *task)
if ((--task->data[2]) == 0)
{
task->data[2] = 4;
- FieldObjectTurn(mapObject, unknown_0839F380[mapObject->mapobj_unk_18]);
+ FieldObjectTurn(mapObject, unknown_0839F380[mapObject->facingDirection]);
}
if (sprite->pos2.y >= 0)
{
@@ -2263,9 +2263,9 @@ void sub_8087FDC(struct Task *task)
struct MapObject *mapObject = &gMapObjects[gPlayerAvatar.mapObjectId];
if ((--task->data[1]) == 0)
{
- FieldObjectTurn(mapObject, unknown_0839F380[mapObject->mapobj_unk_18]);
+ FieldObjectTurn(mapObject, unknown_0839F380[mapObject->facingDirection]);
task->data[1] = 8;
- if ((++task->data[2]) > 4 && task->data[14] == mapObject->mapobj_unk_18)
+ if ((++task->data[2]) > 4 && task->data[14] == mapObject->facingDirection)
{
ScriptContext2_Disable();
CameraObjectReset1();
@@ -2825,7 +2825,7 @@ void sub_8088984(struct Task *task)
gPlayerAvatar.preventStep = TRUE;
SetPlayerAvatarStateMask(8);
PlayerGetDestCoords(&task->data[1], &task->data[2]);
- MoveCoords(gMapObjects[gPlayerAvatar.mapObjectId].placeholder18, &task->data[1], &task->data[2]);
+ MoveCoords(gMapObjects[gPlayerAvatar.mapObjectId].movementDirection, &task->data[1], &task->data[2]);
task->data[0]++;
}
@@ -2861,11 +2861,11 @@ void sub_8088A78(struct Task *task)
mapObject = &gMapObjects[gPlayerAvatar.mapObjectId];
sub_805B980(mapObject, GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_SURFING));
FieldObjectClearAnimIfSpecialAnimFinished(mapObject);
- FieldObjectSetSpecialAnim(mapObject, sub_80608D0(mapObject->placeholder18));
+ FieldObjectSetSpecialAnim(mapObject, sub_80608D0(mapObject->movementDirection));
gFieldEffectArguments[0] = task->data[1];
gFieldEffectArguments[1] = task->data[2];
gFieldEffectArguments[2] = gPlayerAvatar.mapObjectId;
- mapObject->mapobj_unk_1A = FieldEffectStart(FLDEFF_SURF_BLOB);
+ mapObject->fieldEffectSpriteId = FieldEffectStart(FLDEFF_SURF_BLOB);
task->data[0]++;
}
}
@@ -2878,8 +2878,8 @@ void sub_8088AF4(struct Task *task)
{
gPlayerAvatar.preventStep = FALSE;
gPlayerAvatar.flags &= 0xdf;
- FieldObjectSetSpecialAnim(mapObject, GetFaceDirectionAnimId(mapObject->placeholder18));
- sub_8127ED0(mapObject->mapobj_unk_1A, 1);
+ FieldObjectSetSpecialAnim(mapObject, GetFaceDirectionAnimId(mapObject->movementDirection));
+ sub_8127ED0(mapObject->fieldEffectSpriteId, 1);
UnfreezeMapObjects();
ScriptContext2_Disable();
FieldEffectActiveListRemove(FLDEFF_USE_SURF);
@@ -2993,8 +2993,8 @@ void sub_8088D3C(struct Task *task)
mapObject = &gMapObjects[gPlayerAvatar.mapObjectId];
if (task->data[15] & 0x08)
{
- sub_8127ED0(mapObject->mapobj_unk_1A, 2);
- sub_8127EFC(mapObject->mapobj_unk_1A, 0);
+ sub_8127ED0(mapObject->fieldEffectSpriteId, 2);
+ sub_8127EFC(mapObject->fieldEffectSpriteId, 0);
}
task->data[1] = sub_8088F60();
task->data[0]++;
@@ -3032,11 +3032,11 @@ void sub_8088E2C(struct Task *task)
mapObject = &gMapObjects[gPlayerAvatar.mapObjectId];
sub_805B980(mapObject, GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_SURFING));
StartSpriteAnim(&gSprites[mapObject->spriteId], 0x16);
- mapObject->mapobj_bit_12 = 1;
+ mapObject->inanimate = 1;
FieldObjectSetSpecialAnim(mapObject, 0x48);
if (task->data[15] & 0x08)
{
- DestroySprite(&gSprites[mapObject->mapobj_unk_1A]);
+ DestroySprite(&gSprites[mapObject->fieldEffectSpriteId]);
}
task->data[0]++;
task->data[2] = 0;
@@ -3050,8 +3050,8 @@ void sub_8088EB4(struct Task *task)
{
mapObject = &gMapObjects[gPlayerAvatar.mapObjectId];
FieldObjectClearAnimIfSpecialAnimActive(mapObject);
- mapObject->mapobj_bit_12 = 0;
- mapObject->mapobj_bit_22 = 0;
+ mapObject->inanimate = 0;
+ mapObject->hasShadow = 0;
sub_8088FFC(task->data[1], mapObject->spriteId);
CameraObjectReset2();
task->data[0]++;
@@ -3268,13 +3268,13 @@ void sub_80892A0(struct Task *task)
SetPlayerAvatarStateMask(0x01);
if (task->data[15] & 0x08)
{
- sub_8127ED0(mapObject->mapobj_unk_1A, 0);
+ sub_8127ED0(mapObject->fieldEffectSpriteId, 0);
}
sub_805B980(mapObject, GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_SURFING));
CameraObjectReset2();
FieldObjectTurn(mapObject, DIR_WEST);
StartSpriteAnim(&gSprites[mapObject->spriteId], 0x16);
- mapObject->mapobj_bit_13 = 0;
+ mapObject->invisible = 0;
task->data[1] = sub_8088F60();
sub_8088FC0(task->data[1]);
sub_8088FFC(task->data[1], mapObject->spriteId);
@@ -3337,8 +3337,8 @@ void sub_8089414(struct Task *task)
{
mapObject = &gMapObjects[gPlayerAvatar.mapObjectId];
sprite = &gSprites[mapObject->spriteId];
- mapObject->mapobj_bit_12 = 0;
- sub_805C058(mapObject, mapObject->coords2.x, mapObject->coords2.y);
+ mapObject->inanimate = 0;
+ sub_805C058(mapObject, mapObject->currentCoords.x, mapObject->currentCoords.y);
sprite->pos2.x = 0;
sprite->pos2.y = 0;
sprite->coordOffsetEnabled = 1;
@@ -3378,7 +3378,7 @@ void fishE(struct Task *task)
if (task->data[15] & 0x08)
{
state = PLAYER_AVATAR_STATE_SURFING;
- sub_8127ED0(mapObject->mapobj_unk_1A, 1);
+ sub_8127ED0(mapObject->fieldEffectSpriteId, 1);
}
sub_805B980(mapObject, GetPlayerAvatarGraphicsIdByStateId(state));
FieldObjectTurn(mapObject, DIR_SOUTH);
diff --git a/src/field_effect_helpers.c b/src/field_effect_helpers.c
index be7bcec27..ea3225564 100644
--- a/src/field_effect_helpers.c
+++ b/src/field_effect_helpers.c
@@ -62,7 +62,7 @@ static void npc_pal_op(struct MapObject *mapObject, struct Sprite *sprite)
u8 whichElement;
u16 unk_8041e2c[] = {0x0c, 0x1c, 0x2c};
sprite->data[2] = 0;
- if (!GetFieldObjectGraphicsInfo(mapObject->graphicsId)->disableReflectionPaletteLoad && ((whichElement = sub_8057450(mapObject->mapobj_unk_1F)) || (whichElement = sub_8057450(mapObject->mapobj_unk_1E))))
+ if (!GetFieldObjectGraphicsInfo(mapObject->graphicsId)->disableReflectionPaletteLoad && ((whichElement = sub_8057450(mapObject->previousMetatileBehavior)) || (whichElement = sub_8057450(mapObject->currentMetatileBehavior))))
{
sprite->data[2] = unk_8041e2c[whichElement - 1];
npc_pal_op_A(mapObject, sprite->oam.paletteNum);
@@ -115,7 +115,7 @@ static void sub_81269E0(struct Sprite *sprite)
mapObject = &gMapObjects[sprite->data[0]];
oldSprite = &gSprites[mapObject->spriteId];
- if (!mapObject->active || !mapObject->mapobj_bit_17 || mapObject->localId != sprite->data[1])
+ if (!mapObject->active || !mapObject->hasReflection || mapObject->localId != sprite->data[1])
{
sprite->inUse = FALSE;
}
@@ -239,7 +239,7 @@ void oamc_shadow(struct Sprite *sprite)
sprite->oam.priority = linkedSprite->oam.priority;
sprite->pos1.x = linkedSprite->pos1.x;
sprite->pos1.y = linkedSprite->pos1.y + sprite->data[3];
- if (!mapObject->active || !mapObject->mapobj_bit_22 || MetatileBehavior_IsPokeGrass(mapObject->mapobj_unk_1E) || MetatileBehavior_IsSurfableWaterOrUnderwater(mapObject->mapobj_unk_1E) || MetatileBehavior_IsSurfableWaterOrUnderwater(mapObject->mapobj_unk_1F) || MetatileBehavior_IsReflective(mapObject->mapobj_unk_1E) || MetatileBehavior_IsReflective(mapObject->mapobj_unk_1F))
+ if (!mapObject->active || !mapObject->hasShadow || MetatileBehavior_IsPokeGrass(mapObject->currentMetatileBehavior) || MetatileBehavior_IsSurfableWaterOrUnderwater(mapObject->currentMetatileBehavior) || MetatileBehavior_IsSurfableWaterOrUnderwater(mapObject->previousMetatileBehavior) || MetatileBehavior_IsReflective(mapObject->currentMetatileBehavior) || MetatileBehavior_IsReflective(mapObject->previousMetatileBehavior))
{
FieldEffectStop(sprite, FLDEFF_SHADOW);
}
@@ -304,7 +304,7 @@ void unc_grass_normal(struct Sprite *sprite)
else
{
mapObject = &gMapObjects[mapObjectId];
- if ((mapObject->coords2.x != sprite->data[1] || mapObject->coords2.y != sprite->data[2]) && (mapObject->coords3.x != sprite->data[1] || mapObject->coords3.y != sprite->data[2]))
+ if ((mapObject->currentCoords.x != sprite->data[1] || mapObject->currentCoords.y != sprite->data[2]) && (mapObject->previousCoords.x != sprite->data[1] || mapObject->previousCoords.y != sprite->data[2]))
{
sprite->data[7] = TRUE;
}
@@ -413,7 +413,7 @@ void unc_grass_tall(struct Sprite *sprite)
else
{
mapObject = &gMapObjects[mapObjectId];
- if ((mapObject->coords2.x != sprite->data[1] || mapObject->coords2.y != sprite->data[2]) && (mapObject->coords3.x != sprite->data[1] || mapObject->coords3.y != sprite->data[2]))
+ if ((mapObject->currentCoords.x != sprite->data[1] || mapObject->currentCoords.y != sprite->data[2]) && (mapObject->previousCoords.x != sprite->data[1] || mapObject->previousCoords.y != sprite->data[2]))
{
sprite->data[7] = TRUE;
}
@@ -472,7 +472,7 @@ void sub_8127334(struct Sprite *sprite)
const struct MapObjectGraphicsInfo *graphicsInfo;
struct Sprite *linkedSprite;
- if (TryGetFieldObjectIdByLocalIdAndMap(sprite->data[0], sprite->data[1], sprite->data[2], &mapObjectId) || !gMapObjects[mapObjectId].mapobj_bit_18)
+ if (TryGetFieldObjectIdByLocalIdAndMap(sprite->data[0], sprite->data[1], sprite->data[2], &mapObjectId) || !gMapObjects[mapObjectId].inShortGrass)
{
FieldEffectStop(sprite, FLDEFF_SHORT_GRASS);
}
@@ -699,7 +699,7 @@ static void sub_81278D8(struct Sprite *sprite)
struct Sprite *linkedSprite;
struct MapObject *mapObject;
- if (TryGetFieldObjectIdByLocalIdAndMap(sprite->data[0], sprite->data[1], sprite->data[2], &mapObjectId) || !gMapObjects[mapObjectId].mapobj_bit_19)
+ if (TryGetFieldObjectIdByLocalIdAndMap(sprite->data[0], sprite->data[1], sprite->data[2], &mapObjectId) || !gMapObjects[mapObjectId].inShallowFlowingWater)
{
FieldEffectStop(sprite, FLDEFF_FEET_IN_FLOWING_WATER);
}
@@ -711,10 +711,10 @@ static void sub_81278D8(struct Sprite *sprite)
sprite->pos1.y = linkedSprite->pos1.y;
sprite->subpriority = linkedSprite->subpriority;
sub_806487C(sprite, FALSE);
- if (mapObject->coords2.x != sprite->data[3] || mapObject->coords2.y != sprite->data[4])
+ if (mapObject->currentCoords.x != sprite->data[3] || mapObject->currentCoords.y != sprite->data[4])
{
- sprite->data[3] = mapObject->coords2.x;
- sprite->data[4] = mapObject->coords2.y;
+ sprite->data[3] = mapObject->currentCoords.x;
+ sprite->data[4] = mapObject->currentCoords.y;
if (!sprite->invisible)
{
PlaySE(SE_MIZU);
@@ -769,7 +769,7 @@ void sub_8127A7C(struct Sprite *sprite)
const struct MapObjectGraphicsInfo *graphicsInfo;
struct Sprite *linkedSprite;
- if (TryGetFieldObjectIdByLocalIdAndMap(sprite->data[0], sprite->data[1], sprite->data[2], &mapObjectId) || !gMapObjects[mapObjectId].mapobj_bit_21)
+ if (TryGetFieldObjectIdByLocalIdAndMap(sprite->data[0], sprite->data[1], sprite->data[2], &mapObjectId) || !gMapObjects[mapObjectId].inHotSprings)
{
FieldEffectStop(sprite, FLDEFF_HOT_SPRINGS_WATER);
}
@@ -914,7 +914,7 @@ static void sub_8127DD0(struct Sprite *sprite)
sprite->animPaused = FALSE;
MapGridSetMetatileIdAt(sprite->data[1], sprite->data[2], sprite->data[3]);
CurrentMapDrawMetatileAt(sprite->data[1], sprite->data[2]);
- gMapObjects[gPlayerAvatar.mapObjectId].mapobj_bit_2 = TRUE;
+ gMapObjects[gPlayerAvatar.mapObjectId].triggerGroundEffectsOnMove = TRUE;
sprite->data[0] = 2;
}
@@ -997,7 +997,7 @@ static void sub_8127FD4(struct MapObject *mapObject, struct Sprite *sprite)
u8 unk_8041E54[] = {0, 0, 1, 2, 3};
if (sub_8127F64(sprite) == 0)
{
- StartSpriteAnimIfDifferent(sprite, unk_8041E54[mapObject->placeholder18]);
+ StartSpriteAnimIfDifferent(sprite, unk_8041E54[mapObject->movementDirection]);
}
}
@@ -1008,8 +1008,8 @@ static void sub_812800C(struct MapObject *mapObject, struct Sprite *sprite)
s16 y;
u8 i;
- x = mapObject->coords2.x;
- y = mapObject->coords2.y;
+ x = mapObject->currentCoords.x;
+ y = mapObject->currentCoords.y;
if (sprite->pos2.y == 0 && (x != sprite->data[6] || y != sprite->data[7]))
{
sprite->data[5] = sprite->pos2.y;
@@ -1217,7 +1217,7 @@ void sub_81282E0(struct Sprite *sprite)
s16 x;
s16 y;
- if (TryGetFieldObjectIdByLocalIdAndMap(sprite->data[0], sprite->data[1], sprite->data[2], &mapObjectId) || !gMapObjects[mapObjectId].mapobj_bit_20)
+ if (TryGetFieldObjectIdByLocalIdAndMap(sprite->data[0], sprite->data[1], sprite->data[2], &mapObjectId) || !gMapObjects[mapObjectId].inSandPile)
{
FieldEffectStop(sprite, FLDEFF_SAND_PILE);
}
@@ -1338,7 +1338,7 @@ void sub_81285AC(struct Sprite *sprite)
{
FieldEffectStop(sprite, sprite->data[1]);
}
- // else {
+
graphicsInfo = GetFieldObjectGraphicsInfo(gMapObjects[mapObjectId].graphicsId);
linkedSprite = &gSprites[gMapObjects[mapObjectId].spriteId];
sprite->invisible = linkedSprite->invisible;
@@ -1358,14 +1358,13 @@ void sub_81285AC(struct Sprite *sprite)
{
FieldEffectStop(sprite, sprite->data[1]);
}
- // }
}
void sub_812869C(struct MapObject *mapObject)
{
- if (mapObject->mapobj_unk_21 == 1)
+ if (mapObject->directionSequenceIndex == 1)
{
- gSprites[mapObject->mapobj_unk_1A].data[0] ++;
+ gSprites[mapObject->fieldEffectSpriteId].data[0] ++;
}
}
@@ -1373,18 +1372,18 @@ bool8 sub_81286C4(struct MapObject *mapObject)
{
struct Sprite *sprite;
- if (mapObject->mapobj_unk_21 == 2)
+ if (mapObject->directionSequenceIndex == 2)
{
return TRUE;
}
- if (mapObject->mapobj_unk_21 == 0)
+ if (mapObject->directionSequenceIndex == 0)
{
return TRUE;
}
- sprite = &gSprites[mapObject->mapobj_unk_1A];
+ sprite = &gSprites[mapObject->fieldEffectSpriteId];
if (sprite->data[7])
{
- mapObject->mapobj_unk_21 = 2;
+ mapObject->directionSequenceIndex = 2;
sprite->data[0] ++;
return TRUE;
}
diff --git a/src/field_player_avatar.c b/src/field_player_avatar.c
index 29f20dfa0..b17816f6d 100644
--- a/src/field_player_avatar.c
+++ b/src/field_player_avatar.c
@@ -123,7 +123,7 @@ static void (*const gUnknown_0830FC14[])(struct MapObject *) =
nullsub_49,
nullsub_49,
};
-static bool8 (*const gUnknown_0830FC34[])(u8) =
+static bool8 (*const sArrowWarpMetatileBehaviorChecks[])(u8) =
{
MetatileBehavior_IsSouthArrowWarp,
MetatileBehavior_IsNorthArrowWarp,
@@ -171,7 +171,7 @@ static const u8 gUnknown_0830FC64[2][5][2] =
{MAP_OBJ_GFX_MAY_UNDERWATER, 16},
}
};
-static bool8 (*const gUnknown_0830FC78[])(u8) = //Duplicate of gUnknown_0830FC34
+static bool8 (*const sArrowWarpMetatileBehaviorChecks2[])(u8) = //Duplicate of sArrowWarpMetatileBehaviorChecks
{
MetatileBehavior_IsSouthArrowWarp,
MetatileBehavior_IsNorthArrowWarp,
@@ -226,7 +226,7 @@ static bool8 sub_8058854(struct MapObject *playerMapObj, u8 direction)
{
u8 specialAnim = FieldObjectGetSpecialAnim(playerMapObj);
- if (specialAnim > 24 && specialAnim < 29 && direction != DIR_NONE && playerMapObj->placeholder18 != direction)
+ if (specialAnim > 24 && specialAnim < 29 && direction != DIR_NONE && playerMapObj->movementDirection != direction)
{
FieldObjectClearAnim(playerMapObj);
return FALSE;
@@ -239,11 +239,11 @@ static bool8 sub_8058854(struct MapObject *playerMapObj, u8 direction)
return FALSE;
}
-static void npc_clear_strange_bits(struct MapObject *a)
+static void npc_clear_strange_bits(struct MapObject *mapObj)
{
- a->mapobj_bit_12 = 0;
- a->mapobj_bit_10 = 0;
- a->mapobj_bit_9 = 0;
+ mapObj->inanimate = 0;
+ mapObj->disableAnim = 0;
+ mapObj->facingDirectionLocked = 0;
gPlayerAvatar.flags &= ~PLAYER_AVATAR_FLAG_DASH;
}
@@ -265,7 +265,7 @@ static void PlayerAllowForcedMovementIfMovingSameDirection(void)
static bool8 TryDoMetatileBehaviorForcedMovement(void)
{
#if DEBUG
- if (gUnknown_020297ED != 0 && (gMain.heldKeys & 0x100))
+ if (gUnknown_020297ED != 0 && (gMain.heldKeys & R_BUTTON))
return 0;
#endif
return gUnknown_0830FBA0[GetForcedMovementByMetatileBehavior()]();
@@ -277,7 +277,7 @@ static u8 GetForcedMovementByMetatileBehavior(void)
if (!(gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_5))
{
- u8 r5 = gMapObjects[gPlayerAvatar.mapObjectId].mapobj_unk_1E;
+ u8 r5 = gMapObjects[gPlayerAvatar.mapObjectId].currentMetatileBehavior;
for (i = 0; i < 18; i++)
{
@@ -294,9 +294,9 @@ bool8 ForcedMovement_None(void)
{
struct MapObject *playerMapObj = &gMapObjects[gPlayerAvatar.mapObjectId];
- playerMapObj->mapobj_bit_9 = 0;
- playerMapObj->mapobj_bit_11 = 1;
- FieldObjectSetDirection(playerMapObj, playerMapObj->mapobj_unk_18);
+ playerMapObj->facingDirectionLocked = 0;
+ playerMapObj->enableAnim = 1;
+ FieldObjectSetDirection(playerMapObj, playerMapObj->facingDirection);
gPlayerAvatar.flags &= ~PLAYER_AVATAR_FLAG_6;
}
return FALSE;
@@ -336,8 +336,8 @@ static u8 DoForcedMovementInCurrentDirection(void (*a)(u8))
{
struct MapObject *playerMapObj = &gMapObjects[gPlayerAvatar.mapObjectId];
- playerMapObj->mapobj_bit_10 = 1;
- return DoForcedMovement(playerMapObj->placeholder18, a);
+ playerMapObj->disableAnim = 1;
+ return DoForcedMovement(playerMapObj->movementDirection, a);
}
bool8 ForcedMovement_Slip(void)
@@ -347,71 +347,71 @@ bool8 ForcedMovement_Slip(void)
bool8 sub_8058AAC(void)
{
- return DoForcedMovement(1, PlayerGoSpeed1);
+ return DoForcedMovement(DIR_SOUTH, PlayerGoSpeed1);
}
bool8 sub_8058AC4(void)
{
- return DoForcedMovement(2, PlayerGoSpeed1);
+ return DoForcedMovement(DIR_NORTH, PlayerGoSpeed1);
}
bool8 sub_8058ADC(void)
{
- return DoForcedMovement(3, PlayerGoSpeed1);
+ return DoForcedMovement(DIR_WEST, PlayerGoSpeed1);
}
bool8 sub_8058AF4(void)
{
- return DoForcedMovement(4, PlayerGoSpeed1);
+ return DoForcedMovement(DIR_EAST, PlayerGoSpeed1);
}
bool8 sub_8058B0C(void)
{
- return DoForcedMovement(1, npc_use_some_d2s);
+ return DoForcedMovement(DIR_SOUTH, npc_use_some_d2s);
}
bool8 sub_8058B24(void)
{
- return DoForcedMovement(2, npc_use_some_d2s);
+ return DoForcedMovement(DIR_NORTH, npc_use_some_d2s);
}
bool8 sub_8058B3C(void)
{
- return DoForcedMovement(3, npc_use_some_d2s);
+ return DoForcedMovement(DIR_WEST, npc_use_some_d2s);
}
bool8 sub_8058B54(void)
{
- return DoForcedMovement(4, npc_use_some_d2s);
+ return DoForcedMovement(DIR_EAST, npc_use_some_d2s);
}
static u8 ForcedMovement_Slide(u8 direction, void (*b)(u8))
{
struct MapObject *playerMapObj = &gMapObjects[gPlayerAvatar.mapObjectId];
- playerMapObj->mapobj_bit_10 = 1;
- playerMapObj->mapobj_bit_9 = 1;
+ playerMapObj->disableAnim = 1;
+ playerMapObj->facingDirectionLocked = 1;
return DoForcedMovement(direction, b);
}
bool8 ForcedMovement_SlideSouth(void)
{
- return ForcedMovement_Slide(1, PlayerGoSpeed2);
+ return ForcedMovement_Slide(DIR_SOUTH, PlayerGoSpeed2);
}
bool8 ForcedMovement_SlideNorth(void)
{
- return ForcedMovement_Slide(2, PlayerGoSpeed2);
+ return ForcedMovement_Slide(DIR_NORTH, PlayerGoSpeed2);
}
bool8 ForcedMovement_SlideWest(void)
{
- return ForcedMovement_Slide(3, PlayerGoSpeed2);
+ return ForcedMovement_Slide(DIR_WEST, PlayerGoSpeed2);
}
bool8 ForcedMovement_SlideEast(void)
{
- return ForcedMovement_Slide(4, PlayerGoSpeed2);
+ return ForcedMovement_Slide(DIR_EAST, PlayerGoSpeed2);
}
bool8 ForcedMovement_MatJump(void)
@@ -430,10 +430,10 @@ bool8 ForcedMovement_MuddySlope(void)
{
struct MapObject *playerMapObj = &gMapObjects[gPlayerAvatar.mapObjectId];
- if (playerMapObj->placeholder18 != 2 || GetPlayerSpeed() <= 3)
+ if (playerMapObj->movementDirection != DIR_NORTH || GetPlayerSpeed() <= 3)
{
Bike_UpdateBikeCounterSpeed(0);
- playerMapObj->mapobj_bit_9 = 1;
+ playerMapObj->facingDirectionLocked = 1;
return DoForcedMovement(1, PlayerGoSpeed2);
}
else
@@ -500,8 +500,8 @@ void sub_8058D0C(u8 direction, u16 heldKeys)
PlayerGoSpeed2(direction);
return;
}
- if (!(gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_4) && (heldKeys & B_BUTTON) && FlagGet(FLAG_SYS_B_DASH)
- && IsRunningDisallowed(gMapObjects[gPlayerAvatar.mapObjectId].mapobj_unk_1E) == 0)
+ if (!(gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_UNDERWATER) && (heldKeys & B_BUTTON) && FlagGet(FLAG_SYS_B_DASH)
+ && IsRunningDisallowed(gMapObjects[gPlayerAvatar.mapObjectId].currentMetatileBehavior) == 0)
{
sub_805940C(direction);
gPlayerAvatar.flags |= PLAYER_AVATAR_FLAG_DASH;
@@ -518,8 +518,8 @@ static u8 CheckForPlayerAvatarCollision(u8 direction)
s16 x, y;
struct MapObject *playerMapObj = &gMapObjects[gPlayerAvatar.mapObjectId];
- x = playerMapObj->coords2.x;
- y = playerMapObj->coords2.y;
+ x = playerMapObj->currentCoords.x;
+ y = playerMapObj->currentCoords.y;
MoveCoords(direction, &x, &y);
return CheckForFieldObjectCollision(playerMapObj, x, y, direction, MapGridGetMetatileBehaviorAt(x, y));
}
@@ -581,8 +581,8 @@ static u8 sub_8058F6C(s16 a, s16 b, u8 c)
{
if (gMapObjects[mapObjectId].graphicsId == 0x57)
{
- a = gMapObjects[mapObjectId].coords2.x;
- b = gMapObjects[mapObjectId].coords2.y;
+ a = gMapObjects[mapObjectId].currentCoords.x;
+ b = gMapObjects[mapObjectId].currentCoords.y;
MoveCoords(c, &a, &b);
if (npc_block_way(&gMapObjects[mapObjectId], a, b, c) == 0
&& MetatileBehavior_IsNonAnimDoor(MapGridGetMetatileBehaviorAt(a, b)) == 0)
@@ -642,58 +642,58 @@ static void DoPlayerAvatarTransition(void)
}
}
-void nullsub_49(struct MapObject *a)
+void nullsub_49(struct MapObject *mapObj)
{
}
-void PlayerAvatarTransition_Normal(struct MapObject *a)
+void PlayerAvatarTransition_Normal(struct MapObject *mapObj)
{
- sub_805B980(a, GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_NORMAL));
- FieldObjectTurn(a, a->placeholder18);
- SetPlayerAvatarStateMask(1);
+ sub_805B980(mapObj, GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_NORMAL));
+ FieldObjectTurn(mapObj, mapObj->movementDirection);
+ SetPlayerAvatarStateMask(PLAYER_AVATAR_FLAG_ON_FOOT);
}
-void PlayerAvatarTransition_MachBike(struct MapObject *a)
+void PlayerAvatarTransition_MachBike(struct MapObject *mapObj)
{
- sub_805B980(a, GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_MACH_BIKE));
- FieldObjectTurn(a, a->placeholder18);
- SetPlayerAvatarStateMask(2);
+ sub_805B980(mapObj, GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_MACH_BIKE));
+ FieldObjectTurn(mapObj, mapObj->movementDirection);
+ SetPlayerAvatarStateMask(PLAYER_AVATAR_FLAG_MACH_BIKE);
BikeClearState(0, 0);
}
-void PlayerAvatarTransition_AcroBike(struct MapObject *a)
+void PlayerAvatarTransition_AcroBike(struct MapObject *mapObj)
{
- sub_805B980(a, GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_ACRO_BIKE));
- FieldObjectTurn(a, a->placeholder18);
- SetPlayerAvatarStateMask(4);
+ sub_805B980(mapObj, GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_ACRO_BIKE));
+ FieldObjectTurn(mapObj, mapObj->movementDirection);
+ SetPlayerAvatarStateMask(PLAYER_AVATAR_FLAG_ACRO_BIKE);
BikeClearState(0, 0);
Bike_HandleBumpySlopeJump();
}
-void PlayerAvatarTransition_Surfing(struct MapObject *a)
+void PlayerAvatarTransition_Surfing(struct MapObject *mapObj)
{
u8 unk;
- sub_805B980(a, GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_SURFING));
- FieldObjectTurn(a, a->placeholder18);
- SetPlayerAvatarStateMask(8);
- gFieldEffectArguments[0] = a->coords2.x;
- gFieldEffectArguments[1] = a->coords2.y;
+ sub_805B980(mapObj, GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_SURFING));
+ FieldObjectTurn(mapObj, mapObj->movementDirection);
+ SetPlayerAvatarStateMask(PLAYER_AVATAR_FLAG_SURFING);
+ gFieldEffectArguments[0] = mapObj->currentCoords.x;
+ gFieldEffectArguments[1] = mapObj->currentCoords.y;
gFieldEffectArguments[2] = gPlayerAvatar.mapObjectId;
unk = FieldEffectStart(FLDEFF_SURF_BLOB);
- a->mapobj_unk_1A = unk;
+ mapObj->fieldEffectSpriteId = unk;
sub_8127ED0(unk, 1);
}
-void PlayerAvatarTransition_Underwater(struct MapObject *a)
+void PlayerAvatarTransition_Underwater(struct MapObject *mapObj)
{
- sub_805B980(a, GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_UNDERWATER));
- FieldObjectTurn(a, a->placeholder18);
- SetPlayerAvatarStateMask(16);
- a->mapobj_unk_1A = sub_8128124(a->spriteId);
+ sub_805B980(mapObj, GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_UNDERWATER));
+ FieldObjectTurn(mapObj, mapObj->movementDirection);
+ SetPlayerAvatarStateMask(PLAYER_AVATAR_FLAG_UNDERWATER);
+ mapObj->fieldEffectSpriteId = sub_8128124(mapObj->spriteId);
}
-void sub_80591F4(struct MapObject *a)
+void sub_80591F4(struct MapObject *mapObj)
{
gPlayerAvatar.flags |= PLAYER_AVATAR_FLAG_5;
}
@@ -718,7 +718,7 @@ void sub_8059204(void)
static bool8 player_is_anim_in_certain_ranges(void)
{
- u8 unk = gMapObjects[gPlayerAvatar.mapObjectId].mapobj_unk_1C;
+ u8 unk = gMapObjects[gPlayerAvatar.mapObjectId].animId;
if (unk < 4
|| (unk >= 16 && unk < 0x15)
@@ -750,12 +750,12 @@ static bool8 PlayerCheckIfAnimFinishedOrInactive(void)
static void player_set_x22(u8 a)
{
- gMapObjects[gPlayerAvatar.mapObjectId].animId = a;
+ gMapObjects[gPlayerAvatar.mapObjectId].playerAnimId = a;
}
u8 player_get_x22(void)
{
- return gMapObjects[gPlayerAvatar.mapObjectId].animId;
+ return gMapObjects[gPlayerAvatar.mapObjectId].playerAnimId;
}
static void sub_8059348(u8 a)
@@ -833,7 +833,7 @@ void sub_80594C0(void)
if (gPlayerAvatar.tileTransitionState == T_TILE_CENTER || gPlayerAvatar.tileTransitionState == T_NOT_MOVING)
{
if (player_should_look_direction_be_enforced_upon_movement())
- sub_8059348(GetFaceDirectionAnimId(gMapObjects[gPlayerAvatar.mapObjectId].mapobj_unk_18));
+ sub_8059348(GetFaceDirectionAnimId(gMapObjects[gPlayerAvatar.mapObjectId].facingDirection));
}
}
@@ -907,9 +907,9 @@ void sub_8059630(u8 a)
static void PlayCollisionSoundIfNotFacingWarp(u8 a)
{
s16 x, y;
- u8 unk = gMapObjects[gPlayerAvatar.mapObjectId].mapobj_unk_1E;
+ u8 metatileBehavior = gMapObjects[gPlayerAvatar.mapObjectId].currentMetatileBehavior;
- if (!gUnknown_0830FC34[a - 1](unk))
+ if (!sArrowWarpMetatileBehaviorChecks[a - 1](metatileBehavior))
{
if (a == 2)
{
@@ -924,30 +924,30 @@ static void PlayCollisionSoundIfNotFacingWarp(u8 a)
void GetXYCoordsOneStepInFrontOfPlayer(s16 *x, s16 *y)
{
- *x = gMapObjects[gPlayerAvatar.mapObjectId].coords2.x;
- *y = gMapObjects[gPlayerAvatar.mapObjectId].coords2.y;
+ *x = gMapObjects[gPlayerAvatar.mapObjectId].currentCoords.x;
+ *y = gMapObjects[gPlayerAvatar.mapObjectId].currentCoords.y;
MoveCoords(player_get_direction_lower_nybble(), x, y);
}
void PlayerGetDestCoords(s16 *x, s16 *y)
{
- *x = gMapObjects[gPlayerAvatar.mapObjectId].coords2.x;
- *y = gMapObjects[gPlayerAvatar.mapObjectId].coords2.y;
+ *x = gMapObjects[gPlayerAvatar.mapObjectId].currentCoords.x;
+ *y = gMapObjects[gPlayerAvatar.mapObjectId].currentCoords.y;
}
u8 player_get_direction_lower_nybble(void)
{
- return gMapObjects[gPlayerAvatar.mapObjectId].mapobj_unk_18;
+ return gMapObjects[gPlayerAvatar.mapObjectId].facingDirection;
}
u8 player_get_direction_upper_nybble(void)
{
- return gMapObjects[gPlayerAvatar.mapObjectId].placeholder18;
+ return gMapObjects[gPlayerAvatar.mapObjectId].movementDirection;
}
u8 PlayerGetZCoord(void)
{
- return gMapObjects[gPlayerAvatar.mapObjectId].elevation;
+ return gMapObjects[gPlayerAvatar.mapObjectId].previousElevation;
}
void unref_sub_8059790(s16 a, s16 b)
@@ -980,7 +980,7 @@ void sub_80597F4(void)
struct MapObject *playerMapObj = &gMapObjects[gPlayerAvatar.mapObjectId];
npc_clear_strange_bits(playerMapObj);
- FieldObjectSetDirection(playerMapObj, playerMapObj->mapobj_unk_18);
+ FieldObjectSetDirection(playerMapObj, playerMapObj->facingDirection);
if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_MACH_BIKE | PLAYER_AVATAR_FLAG_ACRO_BIKE))
{
Bike_HandleBumpySlopeJump();
@@ -1067,11 +1067,11 @@ bool8 IsPlayerSurfingNorth(void)
bool8 IsPlayerFacingSurfableFishableWater(void)
{
struct MapObject *playerMapObj = &gMapObjects[gPlayerAvatar.mapObjectId];
- s16 x = playerMapObj->coords2.x;
- s16 y = playerMapObj->coords2.y;
+ s16 x = playerMapObj->currentCoords.x;
+ s16 y = playerMapObj->currentCoords.y;
- MoveCoords(playerMapObj->mapobj_unk_18, &x, &y);
- if (npc_block_way(playerMapObj, x, y, playerMapObj->mapobj_unk_18) == 3 && PlayerGetZCoord() == 3
+ MoveCoords(playerMapObj->facingDirection, &x, &y);
+ if (npc_block_way(playerMapObj, x, y, playerMapObj->facingDirection) == 3 && PlayerGetZCoord() == 3
&& MetatileBehavior_IsSurfableFishableWater(MapGridGetMetatileBehaviorAt(x, y)))
return TRUE;
else
@@ -1083,10 +1083,10 @@ void ClearPlayerAvatarInfo(void)
memset(&gPlayerAvatar, 0, sizeof(struct PlayerAvatar));
}
-void SetPlayerAvatarStateMask(u8 a)
+void SetPlayerAvatarStateMask(u8 flags)
{
- gPlayerAvatar.flags &= 0xE0;
- gPlayerAvatar.flags |= a;
+ gPlayerAvatar.flags &= (PLAYER_AVATAR_FLAG_DASH | PLAYER_AVATAR_FLAG_6 | PLAYER_AVATAR_FLAG_5);
+ gPlayerAvatar.flags |= flags;
}
static u8 GetPlayerAvatarStateTransitionByGraphicsId(u8 a, u8 gender)
@@ -1142,8 +1142,8 @@ void InitPlayerAvatar(s16 x, s16 y, u8 direction, u8 gender)
playerMapObjTemplate.flagId = 0;
mapObjectId = SpawnSpecialFieldObject(&playerMapObjTemplate);
mapObject = &gMapObjects[mapObjectId];
- mapObject->mapobj_bit_16 = 1;
- mapObject->mapobj_unk_1B = sub_8126B54();
+ mapObject->isPlayer = 1;
+ mapObject->warpArrowSpriteId = sub_8126B54();
FieldObjectTurn(mapObject, direction);
ClearPlayerAvatarInfo();
gPlayerAvatar.runningState = NOT_MOVING;
@@ -1151,14 +1151,14 @@ void InitPlayerAvatar(s16 x, s16 y, u8 direction, u8 gender)
gPlayerAvatar.mapObjectId = mapObjectId;
gPlayerAvatar.spriteId = mapObject->spriteId;
gPlayerAvatar.gender = gender;
- SetPlayerAvatarStateMask(0x21);
+ SetPlayerAvatarStateMask(PLAYER_AVATAR_FLAG_5 | PLAYER_AVATAR_FLAG_ON_FOOT);
}
void sub_8059B88(u8 a)
{
- gMapObjects[gPlayerAvatar.mapObjectId].mapobj_bit_13 = a;
+ gMapObjects[gPlayerAvatar.mapObjectId].invisible = a;
if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_SURFING))
- gSprites[gMapObjects[gPlayerAvatar.mapObjectId].mapobj_unk_1A].invisible = a;
+ gSprites[gMapObjects[gPlayerAvatar.mapObjectId].fieldEffectSpriteId].invisible = a;
}
void sub_8059BF4(void)
@@ -1186,25 +1186,25 @@ void sub_8059D08(u8 direction)
StartSpriteAnim(&gSprites[gPlayerAvatar.spriteId], FieldObjectDirectionToImageAnimId(direction));
}
-static void sub_8059D60(struct MapObject *a)
+static void sub_8059D60(struct MapObject *mapObject)
{
s16 x;
s16 y;
- u8 r6;
- u8 r8 = a->mapobj_unk_1E;
+ u8 direction;
+ u8 metatileBehavior = mapObject->currentMetatileBehavior;
- for (x = 0, r6 = 1; x < 4; x++, r6++)
+ for (x = 0, direction = DIR_SOUTH; x < 4; x++, direction++)
{
- if (gUnknown_0830FC78[x](r8) && r6 == a->placeholder18)
+ if (sArrowWarpMetatileBehaviorChecks2[x](metatileBehavior) && direction == mapObject->movementDirection)
{
- x = a->coords2.x;
- y = a->coords2.y;
- MoveCoords(r6, &x, &y);
- sub_8126BC4(a->mapobj_unk_1B, r6, x, y);
+ x = mapObject->currentCoords.x;
+ y = mapObject->currentCoords.y;
+ MoveCoords(direction, &x, &y);
+ sub_8126BC4(mapObject->warpArrowSpriteId, direction, x, y);
return;
}
}
- objid_set_invisible(a->mapobj_unk_1B);
+ objid_set_invisible(mapObject->warpArrowSpriteId);
}
/* Strength */
@@ -1245,9 +1245,9 @@ u8 sub_8059EA4(struct Task *task, struct MapObject *b, struct MapObject *c)
FieldObjectClearAnimIfSpecialAnimFinished(c);
FieldObjectSetSpecialAnim(b, GetStepInPlaceDelay16AnimId((u8)task->data[2]));
FieldObjectSetSpecialAnim(c, GetSimpleGoAnimId((u8)task->data[2]));
- gFieldEffectArguments[0] = c->coords2.x;
- gFieldEffectArguments[1] = c->coords2.y;
- gFieldEffectArguments[2] = c->elevation;
+ gFieldEffectArguments[0] = c->currentCoords.x;
+ gFieldEffectArguments[1] = c->currentCoords.y;
+ gFieldEffectArguments[2] = c->previousElevation;
gFieldEffectArguments[3] = gSprites[c->spriteId].oam.priority;
FieldEffectStart(FLDEFF_DUST);
PlaySE(SE_W070);
@@ -1292,7 +1292,7 @@ u8 PlayerAvatar_DoSecretBaseMatJump(struct Task *task, struct MapObject *mapObje
if (FieldObjectClearAnimIfSpecialAnimFinished(mapObject))
{
PlaySE(SE_DANSA);
- FieldObjectSetSpecialAnim(mapObject, sub_806084C(mapObject->mapobj_unk_18));
+ FieldObjectSetSpecialAnim(mapObject, sub_806084C(mapObject->facingDirection));
task->data[1]++;
if (task->data[1] > 1)
{
@@ -1324,7 +1324,7 @@ static void sub_805A08C(u8 taskId)
u8 sub_805A0D8(struct Task *task, struct MapObject *mapObject)
{
task->data[0]++;
- task->data[1] = mapObject->placeholder18;
+ task->data[1] = mapObject->movementDirection;
gPlayerAvatar.preventStep = TRUE;
ScriptContext2_Enable();
PlaySE(SE_TK_WARPIN);
@@ -1339,7 +1339,7 @@ u8 sub_805A100(struct Task *task, struct MapObject *mapObject)
{
u8 direction;
- FieldObjectSetSpecialAnim(mapObject, GetFaceDirectionAnimId(direction = directions[mapObject->placeholder18 - 1]));
+ FieldObjectSetSpecialAnim(mapObject, GetFaceDirectionAnimId(direction = directions[mapObject->movementDirection - 1]));
if (direction == (u8)task->data[1])
task->data[2]++;
task->data[0]++;
@@ -1402,7 +1402,7 @@ static void taskFF_0805D1D4(u8 taskId)
if (!FieldObjectClearAnimIfSpecialAnimFinished(playerMapObj))
return;
}
- sub_8127ED0(playerMapObj->mapobj_unk_1A, 2);
+ sub_8127ED0(playerMapObj->fieldEffectSpriteId, 2);
FieldObjectSetSpecialAnim(playerMapObj, sub_80608D0((u8)gTasks[taskId].data[0]));
gTasks[taskId].func = sub_805A2D0;
}
@@ -1414,10 +1414,10 @@ static void sub_805A2D0(u8 taskId)
if (FieldObjectClearAnimIfSpecialAnimFinished(playerMapObj))
{
sub_805B980(playerMapObj, GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_NORMAL));
- FieldObjectSetSpecialAnim(playerMapObj, GetFaceDirectionAnimId(playerMapObj->mapobj_unk_18));
+ FieldObjectSetSpecialAnim(playerMapObj, GetFaceDirectionAnimId(playerMapObj->facingDirection));
gPlayerAvatar.preventStep = FALSE;
ScriptContext2_Disable();
- DestroySprite(&gSprites[playerMapObj->mapobj_unk_1A]);
+ DestroySprite(&gSprites[playerMapObj->fieldEffectSpriteId]);
DestroyTask(taskId);
}
}
@@ -1496,8 +1496,8 @@ u8 Fishing2(struct Task *task)
task->tPlayerGfxId = gMapObjects[gPlayerAvatar.mapObjectId].graphicsId;
playerMapObj = &gMapObjects[gPlayerAvatar.mapObjectId];
FieldObjectClearAnimIfSpecialAnimActive(playerMapObj);
- playerMapObj->mapobj_bit_11 = 1;
- sub_8059C3C(playerMapObj->mapobj_unk_18);
+ playerMapObj->enableAnim = 1;
+ sub_8059C3C(playerMapObj->facingDirection);
task->tStep++;
return 0;
}
@@ -1652,9 +1652,9 @@ u8 Fishing11(struct Task *task)
struct MapObject *playerMapObj = &gMapObjects[gPlayerAvatar.mapObjectId];
sub_805B980(playerMapObj, task->tPlayerGfxId);
- FieldObjectTurn(playerMapObj, playerMapObj->placeholder18);
+ FieldObjectTurn(playerMapObj, playerMapObj->movementDirection);
if (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_SURFING)
- sub_8127F28(gMapObjects[gPlayerAvatar.mapObjectId].mapobj_unk_1A, 0, 0);
+ sub_8127F28(gMapObjects[gPlayerAvatar.mapObjectId].fieldEffectSpriteId, 0, 0);
gSprites[gPlayerAvatar.spriteId].pos2.x = 0;
gSprites[gPlayerAvatar.spriteId].pos2.y = 0;
Menu_EraseScreen();
@@ -1711,9 +1711,9 @@ u8 Fishing15(struct Task *task)
struct MapObject *playerMapObj = &gMapObjects[gPlayerAvatar.mapObjectId];
sub_805B980(playerMapObj, task->tPlayerGfxId);
- FieldObjectTurn(playerMapObj, playerMapObj->placeholder18);
+ FieldObjectTurn(playerMapObj, playerMapObj->movementDirection);
if (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_SURFING)
- sub_8127F28(gMapObjects[gPlayerAvatar.mapObjectId].mapobj_unk_1A, 0, 0);
+ sub_8127F28(gMapObjects[gPlayerAvatar.mapObjectId].fieldEffectSpriteId, 0, 0);
gSprites[gPlayerAvatar.spriteId].pos2.x = 0;
gSprites[gPlayerAvatar.spriteId].pos2.y = 0;
task->tStep++;
@@ -1771,7 +1771,7 @@ static void sub_805A954(void)
if (animType == 10 || animType == 11)
playerSprite->pos2.y = 8;
if (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_SURFING)
- sub_8127F28(gMapObjects[gPlayerAvatar.mapObjectId].mapobj_unk_1A, 1, playerSprite->pos2.y);
+ sub_8127F28(gMapObjects[gPlayerAvatar.mapObjectId].fieldEffectSpriteId, 1, playerSprite->pos2.y);
}
#if DEBUG
@@ -1787,8 +1787,8 @@ u8 debug_sub_805F2B0(u8 a)
u8 debug_sub_805F2DC(u8 a)
{
if (a == 0)
- PlayerFaceDirection(gMapObjects[gPlayerAvatar.mapObjectId].placeholder18);
- else if (gMapObjects[gPlayerAvatar.mapObjectId].mapobj_bit_15 && !CanCameraMoveInDirection(a))
+ PlayerFaceDirection(gMapObjects[gPlayerAvatar.mapObjectId].movementDirection);
+ else if (gMapObjects[gPlayerAvatar.mapObjectId].trackedByCamera && !CanCameraMoveInDirection(a))
PlayerOnBikeCollide(a);
else
PlayerGoSpeed4(a);
diff --git a/src/field_special_scene.c b/src/field_special_scene.c
index 2010ebcf4..c710547d3 100644
--- a/src/field_special_scene.c
+++ b/src/field_special_scene.c
@@ -365,7 +365,7 @@ void sub_80C78A0(void)
void sub_80C791C(void)
{
sub_80C78A0();
- gMapObjects[gPlayerAvatar.mapObjectId].mapobj_bit_13 = TRUE;
+ gMapObjects[gPlayerAvatar.mapObjectId].invisible = TRUE;
pal_fill_black();
CreateTask(Task_HandlePorthole, 80);
ScriptContext2_Enable();
diff --git a/src/field_specials.c b/src/field_specials.c
index 4eeb23dd4..4bb9ad801 100644
--- a/src/field_specials.c
+++ b/src/field_specials.c
@@ -1759,7 +1759,7 @@ void GlassWorkshopUpdateScrollIndicators(u8 newPos, u8 maxItems)
void SpawnCameraDummy(void)
{
u8 mapObjectId = SpawnSpecialFieldObjectParametrized(7, 8, 0x7f, gSaveBlock1.pos.x + 7, gSaveBlock1.pos.y + 7, 3);
- gMapObjects[mapObjectId].mapobj_bit_13 = 1;
+ gMapObjects[mapObjectId].invisible = 1;
CameraObjectSetFollowedObjectId(gMapObjects[mapObjectId].spriteId);
}
diff --git a/src/fldeff_decoration.c b/src/fldeff_decoration.c
index 467e7bca4..8295a2fe0 100644
--- a/src/fldeff_decoration.c
+++ b/src/fldeff_decoration.c
@@ -236,8 +236,8 @@ void SpriteCB_YellowCave4Sparkle(struct Sprite *sprite)
void DoYellowCave4Sparkle(void)
{
- s16 x = gMapObjects[gPlayerAvatar.mapObjectId].coords2.x;
- s16 y = gMapObjects[gPlayerAvatar.mapObjectId].coords2.y;
+ s16 x = gMapObjects[gPlayerAvatar.mapObjectId].currentCoords.x;
+ s16 y = gMapObjects[gPlayerAvatar.mapObjectId].currentCoords.y;
u8 spriteId;
sub_8060470(&x, &y, 8, 4);
diff --git a/src/item_use.c b/src/item_use.c
index 97ef83ddc..9638588fe 100644
--- a/src/item_use.c
+++ b/src/item_use.c
@@ -220,7 +220,7 @@ bool32 CanFish(void)
if (MetatileBehavior_IsWaterfall(tileBehavior))
return FALSE;
- if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_4))
+ if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_UNDERWATER))
return FALSE;
if (!TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_SURFING))
diff --git a/src/map_obj_lock.c b/src/map_obj_lock.c
index 3bd25dbdf..bac306cd8 100644
--- a/src/map_obj_lock.c
+++ b/src/map_obj_lock.c
@@ -52,7 +52,7 @@ void sub_8064D38(u8 taskId)
sub_80594C0();
task->data[0] = 1;
}
- if (!task->data[1] && !gMapObjects[gSelectedMapObject].mapobj_bit_1)
+ if (!task->data[1] && !gMapObjects[gSelectedMapObject].regularAnimActive)
{
FreezeMapObject(&gMapObjects[gSelectedMapObject]);
task->data[1] = 1;
@@ -79,7 +79,7 @@ void LockSelectedMapObject(void)
u8 taskId;
FreezeMapObjectsExceptOne(gSelectedMapObject);
taskId = CreateTask(sub_8064D38, 80);
- if (!gMapObjects[gSelectedMapObject].mapobj_bit_1)
+ if (!gMapObjects[gSelectedMapObject].regularAnimActive)
{
FreezeMapObject(&gMapObjects[gSelectedMapObject]);
gTasks[taskId].data[1] = 1;
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]++;
diff --git a/src/shop.c b/src/shop.c
index 14878c0a0..62c8c9a87 100644
--- a/src/shop.c
+++ b/src/shop.c
@@ -459,13 +459,13 @@ static void Shop_LoadViewportObjects(void)
gMartViewportObjects[r8][MAP_OBJ_ID] = mapObjId;
gMartViewportObjects[r8][X_COORD] = x;
gMartViewportObjects[r8][Y_COORD] = y;
- if (gMapObjects[mapObjId].mapobj_unk_18 == 1)
+ if (gMapObjects[mapObjId].facingDirection == DIR_SOUTH)
gMartViewportObjects[r8][ANIM_NUM] = 0;
- if (gMapObjects[mapObjId].mapobj_unk_18 == 2)
+ if (gMapObjects[mapObjId].facingDirection == DIR_NORTH)
gMartViewportObjects[r8][ANIM_NUM] = 1;
- if (gMapObjects[mapObjId].mapobj_unk_18 == 3)
+ if (gMapObjects[mapObjId].facingDirection == DIR_WEST)
gMartViewportObjects[r8][ANIM_NUM] = 2;
- if (gMapObjects[mapObjId].mapobj_unk_18 == 4)
+ if (gMapObjects[mapObjId].facingDirection == DIR_EAST)
gMartViewportObjects[r8][ANIM_NUM] = 3;
r8++;
}
diff --git a/src/trainer_see.c b/src/trainer_see.c
index f79d6b9e4..2501d2c7f 100644
--- a/src/trainer_see.c
+++ b/src/trainer_see.c
@@ -84,8 +84,8 @@ static bool8 TrainerCanApproachPlayer(struct MapObject *trainerObj)
PlayerGetDestCoords(&x, &y);
if (trainerObj->trainerType == 1) // can only see in one direction
{
- approachDistance = sDirectionalApproachDistanceFuncs[trainerObj->mapobj_unk_18 - 1](trainerObj, trainerObj->trainerRange_berryTreeId, x, y);
- return CheckPathBetweenTrainerAndPlayer(trainerObj, approachDistance, trainerObj->mapobj_unk_18);
+ approachDistance = sDirectionalApproachDistanceFuncs[trainerObj->facingDirection - 1](trainerObj, trainerObj->trainerRange_berryTreeId, x, y);
+ return CheckPathBetweenTrainerAndPlayer(trainerObj, approachDistance, trainerObj->facingDirection);
}
else // can see in all directions
{
@@ -102,10 +102,10 @@ static bool8 TrainerCanApproachPlayer(struct MapObject *trainerObj)
// Returns how far south the player is from trainer. 0 if out of trainer's sight.
static u8 GetTrainerApproachDistanceSouth(struct MapObject *trainerObj, s16 range, s16 x, s16 y)
{
- if (trainerObj->coords2.x == x
- && y > trainerObj->coords2.y
- && y <= trainerObj->coords2.y + range)
- return (y - trainerObj->coords2.y);
+ if (trainerObj->currentCoords.x == x
+ && y > trainerObj->currentCoords.y
+ && y <= trainerObj->currentCoords.y + range)
+ return (y - trainerObj->currentCoords.y);
else
return 0;
}
@@ -113,10 +113,10 @@ static u8 GetTrainerApproachDistanceSouth(struct MapObject *trainerObj, s16 rang
// Returns how far north the player is from trainer. 0 if out of trainer's sight.
static u8 GetTrainerApproachDistanceNorth(struct MapObject *trainerObj, s16 range, s16 x, s16 y)
{
- if (trainerObj->coords2.x == x
- && y < trainerObj->coords2.y
- && y >= trainerObj->coords2.y - range)
- return (trainerObj->coords2.y - y);
+ if (trainerObj->currentCoords.x == x
+ && y < trainerObj->currentCoords.y
+ && y >= trainerObj->currentCoords.y - range)
+ return (trainerObj->currentCoords.y - y);
else
return 0;
}
@@ -124,10 +124,10 @@ static u8 GetTrainerApproachDistanceNorth(struct MapObject *trainerObj, s16 rang
// Returns how far west the player is from trainer. 0 if out of trainer's sight.
static u8 GetTrainerApproachDistanceWest(struct MapObject *trainerObj, s16 range, s16 x, s16 y)
{
- if (trainerObj->coords2.y == y
- && x < trainerObj->coords2.x
- && x >= trainerObj->coords2.x - range)
- return (trainerObj->coords2.x - x);
+ if (trainerObj->currentCoords.y == y
+ && x < trainerObj->currentCoords.x
+ && x >= trainerObj->currentCoords.x - range)
+ return (trainerObj->currentCoords.x - x);
else
return 0;
}
@@ -135,10 +135,10 @@ static u8 GetTrainerApproachDistanceWest(struct MapObject *trainerObj, s16 range
// Returns how far east the player is from trainer. 0 if out of trainer's sight.
static u8 GetTrainerApproachDistanceEast(struct MapObject *trainerObj, s16 range, s16 x, s16 y)
{
- if (trainerObj->coords2.y == y
- && x > trainerObj->coords2.x
- && x <= trainerObj->coords2.x + range)
- return (x - trainerObj->coords2.x);
+ if (trainerObj->currentCoords.y == y
+ && x > trainerObj->currentCoords.x
+ && x <= trainerObj->currentCoords.x + range)
+ return (x - trainerObj->currentCoords.x);
else
return 0;
}
@@ -160,8 +160,8 @@ static bool8 CheckPathBetweenTrainerAndPlayer(struct MapObject *trainerObj, u8 a
if (approachDistance == 0)
return FALSE;
- x = trainerObj->coords2.x;
- y = trainerObj->coords2.y;
+ x = trainerObj->currentCoords.x;
+ y = trainerObj->currentCoords.y;
for (i = 0; i <= approachDistance - 1; i++, MoveCoords(direction, &x, &y))
{
@@ -265,7 +265,7 @@ static bool8 sub_8084398(u8 taskId, struct Task *task, struct MapObject *trainer
FieldObjectGetLocalIdAndMap(trainerObj, &gFieldEffectArguments[0], &gFieldEffectArguments[1], &gFieldEffectArguments[2]);
FieldEffectStart(FLDEFF_EXCLAMATION_MARK_ICON_1);
- direction = GetFaceDirectionAnimId(trainerObj->mapobj_unk_18);
+ direction = GetFaceDirectionAnimId(trainerObj->facingDirection);
FieldObjectSetSpecialAnim(trainerObj, direction);
task->data[0]++;
return TRUE;
@@ -294,7 +294,7 @@ static bool8 sub_808441C(u8 taskId, struct Task *task, struct MapObject *trainer
{
if (task->data[3])
{
- FieldObjectSetSpecialAnim(trainerObj, GetGoSpeed0AnimId(trainerObj->mapobj_unk_18));
+ FieldObjectSetSpecialAnim(trainerObj, GetGoSpeed0AnimId(trainerObj->facingDirection));
task->data[3]--;
}
else
@@ -313,8 +313,8 @@ static bool8 sub_8084478(u8 taskId, struct Task *task, struct MapObject *trainer
if (FieldObjectIsSpecialAnimOrDirectionSequenceAnimActive(trainerObj) && !FieldObjectClearAnimIfSpecialAnimFinished(trainerObj))
return FALSE;
- npc_set_running_behaviour_etc(trainerObj, npc_running_behaviour_by_direction(trainerObj->mapobj_unk_18));
- sub_805C774(trainerObj, npc_running_behaviour_by_direction(trainerObj->mapobj_unk_18));
+ npc_set_running_behaviour_etc(trainerObj, npc_running_behaviour_by_direction(trainerObj->facingDirection));
+ sub_805C774(trainerObj, npc_running_behaviour_by_direction(trainerObj->facingDirection));
sub_805C754(trainerObj);
playerObj = &gMapObjects[gPlayerAvatar.mapObjectId];
@@ -322,7 +322,7 @@ static bool8 sub_8084478(u8 taskId, struct Task *task, struct MapObject *trainer
return FALSE;
sub_80597E8();
- FieldObjectSetSpecialAnim(&gMapObjects[gPlayerAvatar.mapObjectId], GetFaceDirectionAnimId(GetOppositeDirection(trainerObj->mapobj_unk_18)));
+ FieldObjectSetSpecialAnim(&gMapObjects[gPlayerAvatar.mapObjectId], GetFaceDirectionAnimId(GetOppositeDirection(trainerObj->facingDirection)));
task->data[0]++;
return FALSE;
}
@@ -371,8 +371,8 @@ static bool8 sub_80845FC(u8 taskId, struct Task *task, struct MapObject *trainer
{
if (FieldObjectCheckIfSpecialAnimFinishedOrInactive(trainerObj))
{
- gFieldEffectArguments[0] = trainerObj->coords2.x;
- gFieldEffectArguments[1] = trainerObj->coords2.y;
+ gFieldEffectArguments[0] = trainerObj->currentCoords.x;
+ gFieldEffectArguments[1] = trainerObj->currentCoords.y;
gFieldEffectArguments[2] = gSprites[trainerObj->spriteId].subpriority - 1;
gFieldEffectArguments[3] = 2;
task->data[4] = FieldEffectStart(FLDEFF_POP_OUT_OF_ASH);
@@ -387,13 +387,13 @@ static bool8 sub_8084654(u8 taskId, struct Task *task, struct MapObject *trainer
if (gSprites[task->data[4]].animCmdIndex == 2)
{
- trainerObj->mapobj_bit_26 = 0;
- trainerObj->mapobj_bit_2 = 1;
+ trainerObj->fixedPriority = 0;
+ trainerObj->triggerGroundEffectsOnMove = 1;
sprite = &gSprites[trainerObj->spriteId];
sprite->oam.priority = 2;
FieldObjectClearAnimIfSpecialAnimFinished(trainerObj);
- FieldObjectSetSpecialAnim(trainerObj, sub_806084C(trainerObj->mapobj_unk_18));
+ FieldObjectSetSpecialAnim(trainerObj, sub_806084C(trainerObj->facingDirection));
task->data[0]++;
}
return FALSE;
@@ -430,12 +430,14 @@ void sub_80846E4(u8 taskId)
gTrainerSeeFuncList2[task->data[0]](taskId, task, mapObj);
if (task->data[0] == 3 && !FieldEffectActiveListContains(49))
{
- npc_set_running_behaviour_etc(mapObj, npc_running_behaviour_by_direction(mapObj->mapobj_unk_18));
- sub_805C774(mapObj, npc_running_behaviour_by_direction(mapObj->mapobj_unk_18));
+ npc_set_running_behaviour_etc(mapObj, npc_running_behaviour_by_direction(mapObj->facingDirection));
+ sub_805C774(mapObj, npc_running_behaviour_by_direction(mapObj->facingDirection));
DestroyTask(taskId);
}
else
- mapObj->mapobj_bit_7 = 0;
+ {
+ mapObj->specialAnimFinished = 0;
+ }
}
void sub_8084794(struct MapObject *var)