Skip to content

Commit

Permalink
Document miscellaneous functions
Browse files Browse the repository at this point in the history
Player_SpinAttack
Player_DoGenericPhysicsWithInput
Player_DoGenericPhysics
  • Loading branch information
SilviaFox committed Jan 11, 2025
1 parent ff5d719 commit 3b93d3d
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 28 deletions.
2 changes: 1 addition & 1 deletion include/game/stage/player.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ void sub_80232D0(Player *);
void sub_8023610(Player *);
void Player_TouchGround(Player *p);
void Player_80261D8(Player *p);
void sub_8027EF0(Player *p);
void Player_DoGenericPhysicsWithInput(Player *p);
void sub_8028204(Player *p);
void sub_80282EC(Player *p);
void sub_80283C4(Player *p);
Expand Down
34 changes: 17 additions & 17 deletions src/game/player_callbacks.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ void Player_SonicAmy_WindupSkidAttack(Player *p)
}
}

sub_8027EF0(p);
Player_DoGenericPhysicsWithInput(p);
}

void Player_SonicAmy_SkidAttack(Player *p)
Expand Down Expand Up @@ -265,7 +265,7 @@ void Player_SonicAmy_SkidAttack(Player *p)
}
}

sub_8027EF0(p);
Player_DoGenericPhysicsWithInput(p);

if (!(p->moveState & MOVESTATE_IN_AIR)) {
sub_8029FA4(p);
Expand Down Expand Up @@ -507,7 +507,7 @@ void Player_80123D0(Player *p)
PLAYERFN_SET(Player_TouchGround);
}

sub_8027EF0(p);
Player_DoGenericPhysicsWithInput(p);
}

void Player_SonicAmy_WindupStopNSlam(Player *p)
Expand Down Expand Up @@ -543,7 +543,7 @@ void Player_SonicAmy_StopNSlam_AfterGroundCollision(Player *p)

void Player_SonicAmy_StopNSlam_FallAfterCollision(Player *p)
{
sub_8027EF0(p);
Player_DoGenericPhysicsWithInput(p);

if (!(p->moveState & MOVESTATE_IN_AIR)) {
p->transition = PLTRANS_TOUCH_GROUND;
Expand All @@ -564,7 +564,7 @@ void Player_Sonic_HomingAttack(Player *p)
p->moveState &= ~MOVESTATE_BOOST_EFFECT_ON;
}

sub_8027EF0(p);
Player_DoGenericPhysicsWithInput(p);

if (!(p->moveState & MOVESTATE_IN_AIR)) {
// Hit ground instead of targeted enemy
Expand Down Expand Up @@ -719,7 +719,7 @@ void Player_Cream_ChaoAttack(Player *p)
}
}

sub_8027EF0(p);
Player_DoGenericPhysicsWithInput(p);
}

void Player_Cream_InitStepAttack(Player *p)
Expand Down Expand Up @@ -778,7 +778,7 @@ void Player_Cream_StepAttack(Player *p)
}
}

sub_8027EF0(p);
Player_DoGenericPhysicsWithInput(p);
}

// Mid-Air: Down-B
Expand All @@ -790,7 +790,7 @@ void Player_Cream_ChaoRollingAttack(Player *p)
}
}

sub_8027EF0(p);
Player_DoGenericPhysicsWithInput(p);

if (!(p->moveState & MOVESTATE_IN_AIR)) {
p->transition = PLTRANS_TOUCH_GROUND;
Expand All @@ -799,7 +799,7 @@ void Player_Cream_ChaoRollingAttack(Player *p)

void Player_Cream_WindupMidAirChaoAttack(Player *p)
{
sub_8027EF0(p);
Player_DoGenericPhysicsWithInput(p);

if (!(p->moveState & MOVESTATE_IN_AIR)) {
p->transition = PLTRANS_TOUCH_GROUND;
Expand Down Expand Up @@ -1005,7 +1005,7 @@ void Player_Tails_TailSwipe(Player *p)
PLAYERFN_SET(Player_TouchGround);
}

sub_8027EF0(p);
Player_DoGenericPhysicsWithInput(p);
}

/* Character: Knuckles */
Expand Down Expand Up @@ -1103,7 +1103,7 @@ void Player_Knuckles_PunchLeft(Player *p)
}
}

sub_8027EF0(p);
Player_DoGenericPhysicsWithInput(p);
}

void Player_Knuckles_PunchRight(Player *p)
Expand All @@ -1130,7 +1130,7 @@ void Player_Knuckles_PunchRight(Player *p)
}
}

sub_8027EF0(p);
Player_DoGenericPhysicsWithInput(p);
}

void Player_Knuckles_InitSpiralAttack(Player *p)
Expand Down Expand Up @@ -1178,7 +1178,7 @@ void Player_Knuckles_SpiralAttack(Player *p)
PLAYERFN_SET(Player_8013B6C);
}

sub_8027EF0(p);
Player_DoGenericPhysicsWithInput(p);
}

void Player_Knuckles_Glide_UpdateFrames(Player *p)
Expand Down Expand Up @@ -1816,7 +1816,7 @@ void Player_8013B6C(Player *p)
}
}

sub_8027EF0(p);
Player_DoGenericPhysicsWithInput(p);
}

void Player_Knuckles_Glide(Player *p)
Expand All @@ -1840,7 +1840,7 @@ void Player_Knuckles_GlideSoftLanding(Player *p)
p->transition = PLTRANS_TOUCH_GROUND;
}

sub_8027EF0(p);
Player_DoGenericPhysicsWithInput(p);
}

void Player_Knuckles_GlideHardLanding(Player *p)
Expand Down Expand Up @@ -1990,7 +1990,7 @@ void Player_Knuckles_DrillClaw(Player *p)

void Player_8013E34(Player *p)
{
sub_8027EF0(p);
Player_DoGenericPhysicsWithInput(p);

p->speedGroundX = 0;
p->speedAirX = 0;
Expand Down Expand Up @@ -2090,5 +2090,5 @@ void Player_Amy_HammerAttack(Player *p)
PLAYERFN_SET(Player_TouchGround);
}

sub_8027EF0(p);
Player_DoGenericPhysicsWithInput(p);
}
22 changes: 12 additions & 10 deletions src/game/stage/player.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ void Player_8026BCC(Player *);

s32 sub_8029BB8(Player *p, u8 *p1, s32 *out);

void Player_8025A0C(Player *p);
void Player_SpinAttack(Player *p);

void Player_Idle(Player *);
void Player_8025AB8(Player *);
Expand Down Expand Up @@ -3385,7 +3385,7 @@ void CallPlayerTransition(Player *p)
PLAYERFN_SET(Player_TouchGround);
} break;
case PLTRANS_PT2 - 1: {
PLAYERFN_SET(Player_8025A0C);
PLAYERFN_SET(Player_SpinAttack);
} break;
case PLTRANS_INIT_JUMP - 1: {
p->moveState &= ~(MOVESTATE_400000 | MOVESTATE_IGNORE_INPUT);
Expand Down Expand Up @@ -4194,7 +4194,7 @@ void Player_Crouch(Player *p)
}
}

void Player_8025A0C(Player *p)
void Player_SpinAttack(Player *p)
{
if (IS_BOSS_STAGE(gCurrentLevel)) {
if ((p->moveState & MOVESTATE_IN_AIR)) {
Expand Down Expand Up @@ -4547,7 +4547,7 @@ void Player_Spindash(Player *p)

p->speedGroundX = speed;

gPlayer.callback = Player_8025A0C;
gPlayer.callback = Player_SpinAttack;

m4aSongNumStart(SE_SPIN_DASH_RELEASE);
} else {
Expand Down Expand Up @@ -5461,7 +5461,8 @@ void Player_8027D3C(Player *p)
}
}

void sub_8027EF0(Player *p)
// Generic function for movement and collision, has aerial input, used in character aerial/landing states
void Player_DoGenericPhysicsWithAirInput(Player *p)
{
if (p->moveState & MOVESTATE_IN_AIR) {
sub_8023610(p);
Expand All @@ -5485,7 +5486,8 @@ void sub_8027EF0(Player *p)
}
}

void sub_802808C(Player *p)
// Generic function for movement and collision that doesn't allow player influence
void Player_DoGenericPhysics(Player *p)
{
if (p->moveState & MOVESTATE_IN_AIR) {
sub_80232D0(p);
Expand Down Expand Up @@ -6746,7 +6748,7 @@ bool32 Player_TryCrouchOrSpinAttack(Player *p)
return TRUE;
} else if (((u16)(p->speedGroundX + (Q(0.5) - 1)) > Q(1.0) - 2)
&& !(p->moveState & (MOVESTATE_1000000 | MOVESTATE_4 | MOVESTATE_IN_AIR))) {
PLAYERFN_SET(Player_8025A0C);
PLAYERFN_SET(Player_SpinAttack);
m4aSongNumStart(SE_SPIN_ATTACK);
return TRUE;
}
Expand Down Expand Up @@ -6799,7 +6801,7 @@ void Player_802A258(Player *p)
{
if (!(p->moveState & MOVESTATE_IN_AIR)) {
if (p->moveState & MOVESTATE_4)
Player_8025A0C(p);
Player_SpinAttack(p);
else
Player_TouchGround(p);
} else {
Expand Down Expand Up @@ -6846,10 +6848,10 @@ void Player_802A3B8(Player *p) { sub_802808C(p); }

void Player_802A3C4(Player *p)
{
sub_8027EF0(p);
Player_DoGenericPhysicsWithInput(p);

if (p->spriteInfoBody->s.frameFlags & SPRITE_FLAG_MASK_ANIM_OVER)
PLAYERFN_SET(Player_8025A0C);
PLAYERFN_SET(Player_SpinAttack);
}

void Player_CameraShift(Player *p) { Player_CameraShift_inline(p); }
Expand Down

0 comments on commit 3b93d3d

Please sign in to comment.