summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPikalaxALT <PikalaxALT@gmail.com>2020-03-25 20:40:44 -0400
committerPikalaxALT <PikalaxALT@gmail.com>2020-03-25 20:40:44 -0400
commit9cb08e34750ad591daf69900d9f857cb8a4ddfbe (patch)
tree2a26856c1fb56f59d81a916b7412d0942b066f61 /src
parentadc7a0b65a16f8fcbbadd527980950dec351b9cd (diff)
Document player avatar fields
Diffstat (limited to 'src')
-rw-r--r--src/event_object_movement.c2
-rw-r--r--src/field_control_avatar.c8
-rw-r--r--src/field_player_avatar.c64
-rw-r--r--src/item_use.c2
4 files changed, 39 insertions, 37 deletions
diff --git a/src/event_object_movement.c b/src/event_object_movement.c
index c326b2d01..11d15ea98 100644
--- a/src/event_object_movement.c
+++ b/src/event_object_movement.c
@@ -2207,7 +2207,7 @@ bool8 ObjectEventIsTrainerAndCloseToPlayer(struct ObjectEvent *objectEvent)
s16 minY;
s16 maxY;
- if (!TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_DASH))
+ if (!TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_WATERING))
{
return FALSE;
}
diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c
index 891af3e90..ee413df2d 100644
--- a/src/field_control_avatar.c
+++ b/src/field_control_avatar.c
@@ -105,11 +105,11 @@ void FieldGetPlayerInput(struct FieldInput *input, u16 newKeys, u16 heldKeys)
{
if (GetPlayerSpeed() != 4)
{
- if ((newKeys & START_BUTTON) && !(gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_MVMT_IS_FORCED))
+ if ((newKeys & START_BUTTON) && !(gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_FISHING))
input->pressedStartButton = TRUE;
if (gQuestLogState != QL_STATE_2 && gQuestLogState != QL_STATE_3)
{
- if (!(gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_MVMT_IS_FORCED))
+ if (!(gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_FISHING))
{
if (newKeys & SELECT_BUTTON)
input->pressedSelectButton = TRUE;
@@ -625,7 +625,7 @@ static bool8 TryStartStepBasedScript(struct MapPosition *position, u16 metatileB
return TRUE;
if (TryStartStepCountScript(metatileBehavior) == TRUE)
return TRUE;
- if (!(gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_MVMT_IS_FORCED) && !MetatileBehavior_IsForcedMovementTile(metatileBehavior) && UpdateRepelCounter() == TRUE)
+ if (!(gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_FISHING) && !MetatileBehavior_IsForcedMovementTile(metatileBehavior) && UpdateRepelCounter() == TRUE)
return TRUE;
return FALSE;
}
@@ -655,7 +655,7 @@ static bool8 TryStartStepCountScript(u16 metatileBehavior)
UpdateHappinessStepCounter();
- if (!(gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_MVMT_IS_FORCED) && !MetatileBehavior_IsForcedMovementTile(metatileBehavior))
+ if (!(gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_FISHING) && !MetatileBehavior_IsForcedMovementTile(metatileBehavior))
{
if (sub_810C4EC() == TRUE)
{
diff --git a/src/field_player_avatar.c b/src/field_player_avatar.c
index 4d474db2f..d308dcaba 100644
--- a/src/field_player_avatar.c
+++ b/src/field_player_avatar.c
@@ -182,7 +182,7 @@ static void npc_clear_strange_bits(struct ObjectEvent *objEvent)
objEvent->inanimate = 0;
objEvent->disableAnim = 0;
objEvent->facingDirectionLocked = 0;
- gPlayerAvatar.flags &= ~PLAYER_AVATAR_FLAG_DASH;
+ gPlayerAvatar.flags &= ~PLAYER_AVATAR_FLAG_WATERING;
}
static void MovePlayerAvatarUsingKeypadInput(u8 direction, u16 newKeys, u16 heldKeys)
@@ -197,12 +197,12 @@ static void MovePlayerAvatarUsingKeypadInput(u8 direction, u16 newKeys, u16 held
static void PlayerAllowForcedMovementIfMovingSameDirection(void)
{
if (gPlayerAvatar.runningState == MOVING)
- gPlayerAvatar.flags &= ~PLAYER_AVATAR_FLAG_FORCED_MVMT_DISABLED;
+ gPlayerAvatar.flags &= ~PLAYER_AVATAR_FLAG_FIELD_MOVE;
}
static bool8 sub_805B528(void)
{
- if ((gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_MVMT_IS_FORCED) && MetatileBehavior_IsSpinTile(gPlayerAvatar.unk1C))
+ if ((gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_FISHING) && MetatileBehavior_IsSpinTile(gPlayerAvatar.lastSpinTile))
{
gUnknown_2036E30 = &gObjectEvents[gPlayerAvatar.objectEventId];
if (gUnknown_2036E30->heldMovementFinished)
@@ -213,10 +213,10 @@ static bool8 sub_805B528(void)
}
if (MetatileBehavior_IsSpinTile(gUnknown_2036E30->currentMetatileBehavior))
{
- gPlayerAvatar.unk1C = gUnknown_2036E30->currentMetatileBehavior;
+ gPlayerAvatar.lastSpinTile = gUnknown_2036E30->currentMetatileBehavior;
}
ObjectEventClearHeldMovement(gUnknown_2036E30);
- sub_805C2CC(gPlayerAvatar.unk1C);
+ sub_805C2CC(gPlayerAvatar.lastSpinTile);
}
return TRUE;
}
@@ -255,14 +255,14 @@ static bool8 TryDoMetatileBehaviorForcedMovement(void)
{
int i;
u8 behavior;
- if (!(gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_FORCED_MVMT_DISABLED))
+ if (!(gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_FIELD_MOVE))
{
behavior = gObjectEvents[gPlayerAvatar.objectEventId].currentMetatileBehavior;
for (i = 0; sForcedMovementFuncs[i].unk0 != NULL; i++)
{
if (sForcedMovementFuncs[i].unk0(behavior))
{
- gPlayerAvatar.unk1C = behavior;
+ gPlayerAvatar.lastSpinTile = behavior;
return sForcedMovementFuncs[i].unk4();
}
}
@@ -278,14 +278,14 @@ static bool8 TryDoMetatileBehaviorForcedMovement(void)
static bool8 ForcedMovement_None(void)
{
- if (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_MVMT_IS_FORCED)
+ if (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_FISHING)
{
struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
playerObjEvent->facingDirectionLocked = FALSE;
playerObjEvent->enableAnim = TRUE;
SetObjectEventDirection(playerObjEvent, playerObjEvent->facingDirection);
- gPlayerAvatar.flags &= ~PLAYER_AVATAR_FLAG_MVMT_IS_FORCED;
+ gPlayerAvatar.flags &= ~PLAYER_AVATAR_FLAG_FISHING;
}
return FALSE;
}
@@ -295,7 +295,7 @@ static u8 DoForcedMovement(u8 direction, MovementAction movementAction)
struct PlayerAvatar *playerAvatar = &gPlayerAvatar;
u8 collision = CheckForPlayerAvatarCollision(direction);
- playerAvatar->flags |= PLAYER_AVATAR_FLAG_MVMT_IS_FORCED;
+ playerAvatar->flags |= PLAYER_AVATAR_FLAG_FISHING;
if (collision)
{
ForcedMovement_None();
@@ -307,7 +307,7 @@ static u8 DoForcedMovement(u8 direction, MovementAction movementAction)
{
if (collision == COLLISION_LEDGE_JUMP)
PlayerJumpLedge(direction);
- playerAvatar->flags |= PLAYER_AVATAR_FLAG_MVMT_IS_FORCED;
+ playerAvatar->flags |= PLAYER_AVATAR_FLAG_FISHING;
playerAvatar->runningState = MOVING;
return 1;
}
@@ -518,7 +518,7 @@ static void PlayerNotOnBikeMoving(u8 direction, u16 heldKeys)
PlayerRunSlow(direction);
else
PlayerRun(direction);
- gPlayerAvatar.flags |= PLAYER_AVATAR_FLAG_DASH;
+ gPlayerAvatar.flags |= PLAYER_AVATAR_FLAG_WATERING;
return;
}
else
@@ -676,25 +676,25 @@ static void CheckAcroBikeCollision(s16 x, s16 y, u8 metatileBehavior, u8 *collis
void SetPlayerAvatarTransitionFlags(bool16 flags)
{
- gPlayerAvatar.unk1 |= flags;
+ gPlayerAvatar.transitionFlags |= flags;
DoPlayerAvatarTransition();
}
static void (*const gUnknown_835B844[])(struct ObjectEvent *) = {
- PlayerAvatarTransition_Normal,
- PlayerAvatarTransition_Bike,
- PlayerAvatarTransition_Bike,
- PlayerAvatarTransition_Surfing,
- PlayerAvatarTransition_Underwater,
- PlayerAvatarTransition_ReturnToField,
- PlayerAvatarTransition_Dummy,
- PlayerAvatarTransition_Dummy
+ [PLAYER_AVATAR_STATE_NORMAL] = PlayerAvatarTransition_Normal,
+ [PLAYER_AVATAR_STATE_MACH_BIKE] = PlayerAvatarTransition_Bike,
+ [PLAYER_AVATAR_STATE_ACRO_BIKE] = PlayerAvatarTransition_Bike,
+ [PLAYER_AVATAR_STATE_SURFING] = PlayerAvatarTransition_Surfing,
+ [PLAYER_AVATAR_STATE_UNDERWATER] = PlayerAvatarTransition_Underwater,
+ [PLAYER_AVATAR_STATE_FIELD_MOVE] = PlayerAvatarTransition_ReturnToField,
+ [PLAYER_AVATAR_STATE_FISHING] = PlayerAvatarTransition_Dummy,
+ [PLAYER_AVATAR_STATE_WATERING] = PlayerAvatarTransition_Dummy
};
static void DoPlayerAvatarTransition(void)
{
u8 i;
- u8 flags = gPlayerAvatar.unk1;
+ u8 flags = gPlayerAvatar.transitionFlags;
if (flags != 0)
{
@@ -703,7 +703,7 @@ static void DoPlayerAvatarTransition(void)
if (flags & 1)
gUnknown_835B844[i](&gObjectEvents[gPlayerAvatar.objectEventId]);
}
- gPlayerAvatar.unk1 = 0;
+ gPlayerAvatar.transitionFlags = 0;
}
}
@@ -738,7 +738,7 @@ static void PlayerAvatarTransition_Underwater(struct ObjectEvent * playerObjEven
static void PlayerAvatarTransition_ReturnToField(struct ObjectEvent * playerObjEvent)
{
- gPlayerAvatar.flags |= PLAYER_AVATAR_FLAG_FORCED_MVMT_DISABLED;
+ gPlayerAvatar.flags |= PLAYER_AVATAR_FLAG_FIELD_MOVE;
}
void sub_805BEB8(void)
@@ -1229,7 +1229,7 @@ void ClearPlayerAvatarInfo(void)
void SetPlayerAvatarStateMask(u8 flags)
{
- gPlayerAvatar.flags &= (PLAYER_AVATAR_FLAG_DASH | PLAYER_AVATAR_FLAG_MVMT_IS_FORCED | PLAYER_AVATAR_FLAG_FORCED_MVMT_DISABLED);
+ gPlayerAvatar.flags &= (PLAYER_AVATAR_FLAG_WATERING | PLAYER_AVATAR_FLAG_FISHING | PLAYER_AVATAR_FLAG_FIELD_MOVE);
gPlayerAvatar.flags |= flags;
}
@@ -1277,7 +1277,7 @@ void SetPlayerAvatarExtraStateTransition(u8 graphicsId, u8 b)
{
u8 unk = GetPlayerAvatarStateTransitionByGraphicsId(graphicsId, gPlayerAvatar.gender);
- gPlayerAvatar.unk1 |= unk | b;
+ gPlayerAvatar.transitionFlags |= unk | b;
DoPlayerAvatarTransition();
}
@@ -1310,7 +1310,7 @@ void InitPlayerAvatar(s16 x, s16 y, u8 direction, u8 gender)
gPlayerAvatar.objectEventId = objectEventId;
gPlayerAvatar.spriteId = objectEvent->spriteId;
gPlayerAvatar.gender = gender;
- SetPlayerAvatarStateMask(PLAYER_AVATAR_FLAG_FORCED_MVMT_DISABLED | PLAYER_AVATAR_FLAG_ON_FOOT);
+ SetPlayerAvatarStateMask(PLAYER_AVATAR_FLAG_FIELD_MOVE | PLAYER_AVATAR_FLAG_ON_FOOT);
}
void SetPlayerInvisibility(bool8 invisible)
@@ -1482,7 +1482,7 @@ static bool8 PlayerAvatar_DoSecretBaseMatJump(struct Task *task, struct ObjectEv
if (task->data[1] > 1)
{
gPlayerAvatar.preventStep = FALSE;
- gPlayerAvatar.unk1 |= 0x20;
+ gPlayerAvatar.transitionFlags |= PLAYER_AVATAR_FLAG_FIELD_MOVE;
DestroyTask(FindTaskIdByFunc(DoPlayerAvatarSecretBaseMatJump));
}
}
@@ -1990,6 +1990,7 @@ void AlignFishingAnimationFrames(struct Sprite * playerSprite)
#define tFinalFacingDirection data[5]
#define tPriority data[6]
#define tSubpriority data[7]
+#define tLandingDelay data[8]
static const u8 sTeleportFacingDirectionSequence[] = {
[DIR_SOUTH] = DIR_WEST,
@@ -2111,14 +2112,14 @@ static void Task_TeleportWarpInPlayerAnim(u8 taskId)
if (sprite->pos1.y >= tYpos)
{
sprite->pos1.y = tYpos;
- data[8] = 0;
+ tLandingDelay = 0;
tState++;
}
break;
case 2:
TeleportAnim_RotatePlayer(object, &tRotationTimer);
- data[8]++;
- if (data[8] > 8)
+ tLandingDelay++;
+ if (tLandingDelay > 8)
{
tState++;
}
@@ -2153,6 +2154,7 @@ static u8 TeleportAnim_RotatePlayer(struct ObjectEvent *object, s16 *a1)
return sTeleportFacingDirectionSequence[object->facingDirection];
}
+#undef tLandingDelay
#undef tSubpriority
#undef tPriority
#undef tFinalFacingDirection
diff --git a/src/item_use.c b/src/item_use.c
index ea7005f4e..df3dbaceb 100644
--- a/src/item_use.c
+++ b/src/item_use.c
@@ -308,7 +308,7 @@ static bool8 ItemUseCheckFunc_Rod(void)
if (MetatileBehavior_IsWaterfall(behavior))
return FALSE;
- if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_4))
+ if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_UNDERWATER))
return FALSE;
if (!TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_SURFING))
{