Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Player Docs: Player_ActionChange_6, Rolling and Put Away #1949

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

fig02
Copy link
Collaborator

@fig02 fig02 commented Apr 25, 2024

The first of many upcoming "action change" handler function docs.

This one is a bit awkward because it groups together some pretty unrelated behavior. They are related in that they are triggered by the A button. But these are by far not all actions triggered by the A button in general.

I chose to name the action change handler as Player_ActionChange_HandleRollingAndPutAway. This unfortunately omits one last behavior that this functions also handles-- toggling navi on and off. I chose to leave it out of the name because it is overall less important, and would make the name even longer.
Another route could be to try to name it after the fact that these actions revolve around the A button. But that seems less appealing for searching and readability.

My recommendation for how to review this is
Player_ActionChange_HandleRollingAndPutAway -> Player_TryRolling -> Player_SetupRoll -> Player_Action_Roll

Comment on lines 6048 to 6061
s32 Player_ActionChange_HandleRollingAndPutAway(Player* this, PlayState* play) {
if (!func_80833B54(this) && !sUpperBodyIsBusy && !(this->stateFlags1 & PLAYER_STATE1_23) &&
CHECK_BTN_ALL(sControlInput->press.button, BTN_A)) {
if (func_8083BC7C(this, play)) {
return 1;
}
if ((this->unk_837 == 0) && (this->heldItemAction >= PLAYER_IA_SWORD_MASTER)) {
if (Player_TryRolling(this, play)) {
return true;
} else if ((this->putAwayCooldownTimer == 0) && (this->heldItemAction >= PLAYER_IA_SWORD_MASTER)) {
Player_UseItem(play, this, ITEM_NONE);
} else {
this->stateFlags2 ^= PLAYER_STATE2_20;
this->stateFlags2 ^= PLAYER_STATE2_NAVI_ACTIVE;
}
}

return 0;
return false;
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically speaking, rolling is the only actual action that this "ActionChange" function concerns. The other things are "extra" and not handled by the main action system. So I could see an argument for naming the function after rolling only. The function comment can explain the "extra" functionality that is also controls. Would like to hear other thoughts.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually think this is probably for the better and will change it, but still would like to hear opinions

LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime,
GET_PLAYER_ANIM(PLAYER_ANIMGROUP_landing_roll, this->modelAnimType),
1.25f * D_808535E8);
}

s32 func_8083BC7C(Player* this, PlayState* play) {
s32 Player_TryRolling(Player* this, PlayState* play) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Player_TryRoll? I think these Try functions are somewhat common so maybe naming them after the action is more consistent

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants