1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-28 19:25:27 +00:00

name action wrappers (#2261)

This commit is contained in:
fig02 2024-10-09 21:37:33 -04:00 committed by GitHub
parent ba9c60552b
commit 33251ccb51
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3453,23 +3453,41 @@ s32 Player_SetupAction(PlayState* play, Player* this, PlayerActionFunc actionFun
return 1; return 1;
} }
void func_80835DAC(PlayState* play, Player* this, PlayerActionFunc actionFunc, s32 flags) { /**
s32 temp; * Calls `Player_SetupAction` to setup a new action, but takes extra measures to
* preserve AnimMovement while doing so.
*/
void Player_SetupActionPreserveAnimMovement(PlayState* play, Player* this, PlayerActionFunc actionFunc, s32 flags) {
s32 savedMovementFlags;
temp = this->skelAnime.movementFlags; savedMovementFlags = this->skelAnime.movementFlags;
// Setting `skelAnime.movementFlags` to 0 will prevent `Player_FinishAnimMovement` from ending
// AnimMovement when `Player_SetupAction` is called.
this->skelAnime.movementFlags = 0; this->skelAnime.movementFlags = 0;
Player_SetupAction(play, this, actionFunc, flags); Player_SetupAction(play, this, actionFunc, flags);
this->skelAnime.movementFlags = temp; this->skelAnime.movementFlags = savedMovementFlags;
} }
void func_80835DE4(PlayState* play, Player* this, PlayerActionFunc actionFunc, s32 flags) { /**
s32 temp; * Calls `Player_SetupAction` to setup a new action, but takes extra measures to
* preserve the current itemAction while doing so.
*
* Note that `itemAction` must be PLAYER_IA_NONE or higher for the action change to take place.
*/
void Player_SetupActionPreserveItemAction(PlayState* play, Player* this, PlayerActionFunc actionFunc, s32 flags) {
s32 savedItemAction;
if (this->itemAction >= 0) { if (this->itemAction >= PLAYER_IA_NONE) {
temp = this->itemAction; savedItemAction = this->itemAction;
// Setting `itemAction` to `heldItemAction` will prevent `func_8008EC70` from running when
// `Player_SetupAction` is called.
this->itemAction = this->heldItemAction; this->itemAction = this->heldItemAction;
Player_SetupAction(play, this, actionFunc, flags); Player_SetupAction(play, this, actionFunc, flags);
this->itemAction = temp; this->itemAction = savedItemAction;
Player_SetModels(this, Player_ActionToModelGroup(this, this->itemAction)); Player_SetModels(this, Player_ActionToModelGroup(this, this->itemAction));
} }
} }
@ -5617,7 +5635,7 @@ void func_8083A0F4(PlayState* play, Player* this) {
} }
void func_8083A2F8(PlayState* play, Player* this) { void func_8083A2F8(PlayState* play, Player* this) {
func_80835DAC(play, this, Player_Action_8084B530, 0); Player_SetupActionPreserveAnimMovement(play, this, Player_Action_8084B530, 0);
this->stateFlags1 |= PLAYER_STATE1_6 | PLAYER_STATE1_29; this->stateFlags1 |= PLAYER_STATE1_6 | PLAYER_STATE1_29;
@ -5628,7 +5646,7 @@ void func_8083A2F8(PlayState* play, Player* this) {
} }
void func_8083A360(PlayState* play, Player* this) { void func_8083A360(PlayState* play, Player* this) {
func_80835DAC(play, this, Player_Action_8084CC98, 0); Player_SetupActionPreserveAnimMovement(play, this, Player_Action_8084CC98, 0);
} }
void func_8083A388(PlayState* play, Player* this) { void func_8083A388(PlayState* play, Player* this) {
@ -5639,7 +5657,7 @@ void func_8083A3B0(PlayState* play, Player* this) {
s32 sp1C = this->av2.actionVar2; s32 sp1C = this->av2.actionVar2;
s32 sp18 = this->av1.actionVar1; s32 sp18 = this->av1.actionVar1;
func_80835DAC(play, this, Player_Action_8084BF1C, 0); Player_SetupActionPreserveAnimMovement(play, this, Player_Action_8084BF1C, 0);
this->actor.velocity.y = 0.0f; this->actor.velocity.y = 0.0f;
this->av2.actionVar2 = sp1C; this->av2.actionVar2 = sp1C;
@ -5647,11 +5665,11 @@ void func_8083A3B0(PlayState* play, Player* this) {
} }
void func_8083A40C(PlayState* play, Player* this) { void func_8083A40C(PlayState* play, Player* this) {
func_80835DAC(play, this, Player_Action_8084C760, 0); Player_SetupActionPreserveAnimMovement(play, this, Player_Action_8084C760, 0);
} }
void func_8083A434(PlayState* play, Player* this) { void func_8083A434(PlayState* play, Player* this) {
func_80835DAC(play, this, Player_Action_8084E6D4, 0); Player_SetupActionPreserveAnimMovement(play, this, Player_Action_8084E6D4, 0);
this->stateFlags1 |= PLAYER_STATE1_10 | PLAYER_STATE1_29; this->stateFlags1 |= PLAYER_STATE1_10 | PLAYER_STATE1_29;
@ -5922,7 +5940,7 @@ void func_8083AE40(Player* this, s16 objectId) {
} }
void func_8083AF44(PlayState* play, Player* this, s32 magicSpell) { void func_8083AF44(PlayState* play, Player* this, s32 magicSpell) {
func_80835DE4(play, this, Player_Action_808507F4, 0); Player_SetupActionPreserveItemAction(play, this, Player_Action_808507F4, 0);
this->av1.actionVar1 = magicSpell - 3; this->av1.actionVar1 = magicSpell - 3;
@ -6025,7 +6043,7 @@ s32 Player_ActionHandler_13(Player* this, PlayState* play) {
(this->exchangeItemId == EXCH_ITEM_BOTTLE_BLUE_FIRE))))))) { (this->exchangeItemId == EXCH_ITEM_BOTTLE_BLUE_FIRE))))))) {
if ((play->actorCtx.titleCtx.delayTimer == 0) && (play->actorCtx.titleCtx.alpha == 0)) { if ((play->actorCtx.titleCtx.delayTimer == 0) && (play->actorCtx.titleCtx.alpha == 0)) {
func_80835DE4(play, this, Player_Action_8084F104, 0); Player_SetupActionPreserveItemAction(play, this, Player_Action_8084F104, 0);
if (sp2C >= 0) { if (sp2C >= 0) {
giEntry = &sGetItemTable[D_80854528[sp2C] - 1]; giEntry = &sGetItemTable[D_80854528[sp2C] - 1];
@ -6052,7 +6070,7 @@ s32 Player_ActionHandler_13(Player* this, PlayState* play) {
(this->itemAction == PLAYER_IA_MAGIC_BEAN))) { (this->itemAction == PLAYER_IA_MAGIC_BEAN))) {
if (this->exchangeItemId == EXCH_ITEM_MAGIC_BEAN) { if (this->exchangeItemId == EXCH_ITEM_MAGIC_BEAN) {
Inventory_ChangeAmmo(ITEM_MAGIC_BEAN, -1); Inventory_ChangeAmmo(ITEM_MAGIC_BEAN, -1);
func_80835DE4(play, this, Player_Action_8084279C, 0); Player_SetupActionPreserveItemAction(play, this, Player_Action_8084279C, 0);
this->stateFlags1 |= PLAYER_STATE1_29; this->stateFlags1 |= PLAYER_STATE1_29;
this->av2.actionVar2 = 0x50; this->av2.actionVar2 = 0x50;
this->av1.actionVar1 = -1; this->av1.actionVar1 = -1;
@ -6087,20 +6105,20 @@ s32 Player_ActionHandler_13(Player* this, PlayState* play) {
sp2C = Player_ActionToBottle(this, this->itemAction); sp2C = Player_ActionToBottle(this, this->itemAction);
if (sp2C >= 0) { if (sp2C >= 0) {
if (sp2C == 0xC) { if (sp2C == 0xC) {
func_80835DE4(play, this, Player_Action_8084EED8, 0); Player_SetupActionPreserveItemAction(play, this, Player_Action_8084EED8, 0);
Player_AnimPlayOnceAdjusted(play, this, &gPlayerAnim_link_bottle_bug_out); Player_AnimPlayOnceAdjusted(play, this, &gPlayerAnim_link_bottle_bug_out);
func_80835EA4(play, 3); func_80835EA4(play, 3);
} else if ((sp2C > 0) && (sp2C < 4)) { } else if ((sp2C > 0) && (sp2C < 4)) {
func_80835DE4(play, this, Player_Action_8084EFC0, 0); Player_SetupActionPreserveItemAction(play, this, Player_Action_8084EFC0, 0);
Player_AnimPlayOnceAdjusted(play, this, &gPlayerAnim_link_bottle_fish_out); Player_AnimPlayOnceAdjusted(play, this, &gPlayerAnim_link_bottle_fish_out);
func_80835EA4(play, (sp2C == 1) ? 1 : 5); func_80835EA4(play, (sp2C == 1) ? 1 : 5);
} else { } else {
func_80835DE4(play, this, Player_Action_8084EAC0, 0); Player_SetupActionPreserveItemAction(play, this, Player_Action_8084EAC0, 0);
Player_AnimChangeOnceMorphAdjusted(play, this, &gPlayerAnim_link_bottle_drink_demo_start); Player_AnimChangeOnceMorphAdjusted(play, this, &gPlayerAnim_link_bottle_drink_demo_start);
func_80835EA4(play, 2); func_80835EA4(play, 2);
} }
} else { } else {
func_80835DE4(play, this, Player_Action_8084E3C4, 0); Player_SetupActionPreserveItemAction(play, this, Player_Action_8084E3C4, 0);
Player_AnimPlayOnceAdjusted(play, this, &gPlayerAnim_link_normal_okarina_start); Player_AnimPlayOnceAdjusted(play, this, &gPlayerAnim_link_normal_okarina_start);
this->stateFlags2 |= PLAYER_STATE2_27; this->stateFlags2 |= PLAYER_STATE2_27;
func_80835EA4(play, (this->unk_6A8 != NULL) ? 0x5B : 0x5A); func_80835EA4(play, (this->unk_6A8 != NULL) ? 0x5B : 0x5A);
@ -7540,7 +7558,7 @@ s32 func_8083EC18(Player* this, PlayState* play, u32 wallFlags) {
} }
void func_8083F070(Player* this, LinkAnimationHeader* anim, PlayState* play) { void func_8083F070(Player* this, LinkAnimationHeader* anim, PlayState* play) {
func_80835DAC(play, this, Player_Action_8084C5F8, 0); Player_SetupActionPreserveAnimMovement(play, this, Player_Action_8084C5F8, 0);
LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, anim, (4.0f / 3.0f)); LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, anim, (4.0f / 3.0f));
} }
@ -8103,7 +8121,7 @@ void Player_Action_808407CC(Player* this, PlayState* play) {
} }
if (!Player_FriendlyLockOnOrParallel(this)) { if (!Player_FriendlyLockOnOrParallel(this)) {
func_80835DAC(play, this, Player_Action_80840BC8, 1); Player_SetupActionPreserveAnimMovement(play, this, Player_Action_80840BC8, 1);
this->yaw = this->actor.shape.rot.y; this->yaw = this->actor.shape.rot.y;
return; return;
} }
@ -13030,7 +13048,7 @@ s32 func_8084C9BC(Player* this, PlayState* play) {
if (EN_HORSE_CHECK_1(rideActor) || if (EN_HORSE_CHECK_1(rideActor) ||
(EN_HORSE_CHECK_4(rideActor) && CHECK_BTN_ALL(sControlInput->press.button, BTN_A))) { (EN_HORSE_CHECK_4(rideActor) && CHECK_BTN_ALL(sControlInput->press.button, BTN_A))) {
rideActor->actor.child = NULL; rideActor->actor.child = NULL;
func_80835DAC(play, this, Player_Action_8084D3E4, 0); Player_SetupActionPreserveAnimMovement(play, this, Player_Action_8084D3E4, 0);
this->unk_878 = sp34 - rideActor->actor.world.pos.y; this->unk_878 = sp34 - rideActor->actor.world.pos.y;
Player_AnimPlayOnce(play, this, Player_AnimPlayOnce(play, this,
(this->mountSide < 0) ? &gPlayerAnim_link_uma_left_down (this->mountSide < 0) ? &gPlayerAnim_link_uma_left_down