1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-12-25 14:16:11 +00:00

Rename ANIM_FLAG_PLAYER_7 to ANIM_FLAG_OVERRIDE_MOVEMENT (#1969)

* rename and add comments

* format

* override movement

* format

* rework comments

* Remove whitespace at end of lines

---------

Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com>
This commit is contained in:
fig02 2024-06-25 15:50:01 -04:00 committed by GitHub
parent d8f2e9abc6
commit a599d7d548
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 42 additions and 26 deletions

View file

@ -99,6 +99,11 @@ typedef enum {
// Enables the movement of an actor in the Y-axis based on the current animation.
// This only has an effect if the "Actor Move" Anim Task is in use.
//
// This animation-driven movement does not replace "normal" movement from other sources
// such as speed/velocity and collisions. The actor should stop updating other sources of movement
// as required if they are preventing the animation from playing as intended.
// An option is to implement and use `ANIM_FLAG_OVERRIDE_MOVEMENT`.
#define ANIM_FLAG_UPDATE_Y (1 << 1)
// (player-only) Related to scaling an animation from/to child/adult
@ -110,8 +115,12 @@ typedef enum {
//
#define ANIM_FLAG_NO_MOVE (1 << 4)
// (player-only)
#define ANIM_FLAG_PLAYER_7 (1 << 7)
// Disables "normal" movement from sources like speed/velocity and collisions, which allows the
// animation to have full control over the actor's movement.
//
// Note that individual actors are responsible for implementing the functionality of this flag.
// In practice, Player is the only actor who implements this flag.
#define ANIM_FLAG_OVERRIDE_MOVEMENT (1 << 7)
typedef struct SkelAnime {
/* 0x00 */ u8 limbCount; // Number of limbs in the skeleton

View file

@ -2984,7 +2984,7 @@ s32 func_80835588(Player* this, PlayState* play) {
void func_808355DC(Player* this) {
this->stateFlags1 |= PLAYER_STATE1_17;
if (!(this->skelAnime.moveFlags & ANIM_FLAG_PLAYER_7) &&
if (!(this->skelAnime.moveFlags & ANIM_FLAG_OVERRIDE_MOVEMENT) &&
(this->actor.bgCheckFlags & BGCHECKFLAG_PLAYER_WALL_INTERACT) && (sShapeYawToTouchedWall < 0x2000)) {
this->yaw = this->actor.shape.rot.y = this->actor.wallYaw + 0x8000;
}
@ -3400,7 +3400,7 @@ s32 Player_UpdateUpperBody(Player* this, PlayState* play) {
Player_AnimPlayOnce(play, this, &gPlayerAnim_link_hook_fly_start);
Player_AnimReplaceApplyFlags(play, this,
ANIM_FLAG_UPDATE_XZ | ANIM_FLAG_UPDATE_Y | ANIM_FLAG_PLAYER_SETMOVE |
ANIM_FLAG_NO_MOVE | ANIM_FLAG_PLAYER_7);
ANIM_FLAG_NO_MOVE | ANIM_FLAG_OVERRIDE_MOVEMENT);
func_80832224(this);
this->yaw = this->actor.shape.rot.y;
this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND;
@ -5056,7 +5056,8 @@ s32 Player_ActionChange_1(Player* this, PlayState* play) {
func_80832224(this);
Player_AnimReplaceApplyFlags(play, this,
ANIM_REPLACE_APPLY_FLAG_9 | ANIM_FLAG_UPDATE_XZ | ANIM_FLAG_UPDATE_Y |
ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_PLAYER_7);
ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE |
ANIM_FLAG_OVERRIDE_MOVEMENT);
// If this door is the second half of a double door (spawned as child)
if (doorActor->parent != NULL) {
@ -5367,7 +5368,8 @@ s32 func_8083A6AC(Player* this, PlayState* play) {
this->stateFlags1 |= PLAYER_STATE1_21;
Player_AnimReplaceApplyFlags(play, this,
ANIM_FLAG_UPDATE_XZ | ANIM_FLAG_UPDATE_Y | ANIM_FLAG_PLAYER_2 |
ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_NO_MOVE | ANIM_FLAG_PLAYER_7);
ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_NO_MOVE |
ANIM_FLAG_OVERRIDE_MOVEMENT);
this->av2.actionVar2 = -1;
this->av1.actionVar1 = sp50;
@ -5412,7 +5414,7 @@ void func_8083AA10(Player* this, PlayState* play) {
return;
}
if (!(this->stateFlags3 & PLAYER_STATE3_1) && !(this->skelAnime.moveFlags & ANIM_FLAG_PLAYER_7) &&
if (!(this->stateFlags3 & PLAYER_STATE3_1) && !(this->skelAnime.moveFlags & ANIM_FLAG_OVERRIDE_MOVEMENT) &&
(Player_Action_8084411C != this->actionFunc) && (Player_Action_80844A44 != this->actionFunc)) {
if ((sPrevFloorProperty == FLOOR_PROPERTY_7) || (this->meleeWeaponState != 0)) {
@ -6722,7 +6724,7 @@ s32 Player_ActionChange_3(Player* this, PlayState* play) {
Player_AnimPlayOnce(play, this, D_80854578[temp].anim);
Player_AnimReplaceApplyFlags(play, this,
ANIM_FLAG_UPDATE_XZ | ANIM_FLAG_UPDATE_Y | ANIM_FLAG_PLAYER_SETMOVE |
ANIM_FLAG_NO_MOVE | ANIM_FLAG_PLAYER_7);
ANIM_FLAG_NO_MOVE | ANIM_FLAG_OVERRIDE_MOVEMENT);
this->actor.parent = this->rideActor;
func_80832224(this);
@ -6891,7 +6893,7 @@ s32 Player_ActionChange_2(Player* this, PlayState* play) {
Player_AnimReplaceApplyFlags(play, this,
ANIM_REPLACE_APPLY_FLAG_9 | ANIM_FLAG_UPDATE_XZ | ANIM_FLAG_UPDATE_Y |
ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE |
ANIM_FLAG_PLAYER_7);
ANIM_FLAG_OVERRIDE_MOVEMENT);
chest->unk_1F4 = 1;
Camera_RequestSetting(Play_GetCamera(play, CAM_ID_MAIN), CAM_SET_SLOW_CHEST_CS);
} else {
@ -7069,7 +7071,8 @@ s32 func_8083EC18(Player* this, PlayState* play, u32 wallFlags) {
Player_AnimPlayOnce(play, this, anim);
Player_AnimReplaceApplyFlags(play, this,
ANIM_FLAG_UPDATE_XZ | ANIM_FLAG_UPDATE_Y | ANIM_FLAG_PLAYER_2 |
ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_NO_MOVE | ANIM_FLAG_PLAYER_7);
ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_NO_MOVE |
ANIM_FLAG_OVERRIDE_MOVEMENT);
return true;
}
@ -7150,7 +7153,7 @@ s32 Player_TryEnteringCrawlspace(Player* this, PlayState* play, u32 interactWall
Player_AnimPlayOnce(play, this, &gPlayerAnim_link_child_tunnel_start);
Player_AnimReplaceApplyFlags(play, this,
ANIM_FLAG_UPDATE_XZ | ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE |
ANIM_FLAG_NO_MOVE | ANIM_FLAG_PLAYER_7);
ANIM_FLAG_NO_MOVE | ANIM_FLAG_OVERRIDE_MOVEMENT);
return true;
}
@ -7240,7 +7243,7 @@ s32 Player_TryLeavingCrawlspace(Player* this, PlayState* play) {
Player_AnimPlayOnce(play, this, &gPlayerAnim_link_child_tunnel_end);
Player_AnimReplaceApplyFlags(play, this,
ANIM_FLAG_UPDATE_XZ | ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE |
ANIM_FLAG_NO_MOVE | ANIM_FLAG_PLAYER_7);
ANIM_FLAG_NO_MOVE | ANIM_FLAG_OVERRIDE_MOVEMENT);
OnePointCutscene_Init(play, 9601, 999, NULL, CAM_ID_MAIN);
} else {
// Leaving a crawlspace backwards
@ -7250,7 +7253,7 @@ s32 Player_TryLeavingCrawlspace(Player* this, PlayState* play) {
0.0f);
Player_AnimReplaceApplyFlags(play, this,
ANIM_FLAG_UPDATE_XZ | ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE |
ANIM_FLAG_NO_MOVE | ANIM_FLAG_PLAYER_7);
ANIM_FLAG_NO_MOVE | ANIM_FLAG_OVERRIDE_MOVEMENT);
OnePointCutscene_Init(play, 9602, 999, NULL, CAM_ID_MAIN);
}
@ -9969,7 +9972,7 @@ void func_808467D4(PlayState* play, Player* this) {
0.0f);
Player_AnimReplaceApplyFlags(play, this,
ANIM_REPLACE_APPLY_FLAG_9 | ANIM_FLAG_UPDATE_XZ | ANIM_FLAG_UPDATE_Y |
ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_PLAYER_7);
ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_OVERRIDE_MOVEMENT);
if (LINK_IS_ADULT) {
func_80846720(play, this, 0);
}
@ -9980,7 +9983,7 @@ void func_808468A8(PlayState* play, Player* this) {
Player_SetupAction(play, this, Player_Action_8084F9A0, 0);
Player_AnimReplaceApplyFlags(play, this,
ANIM_FLAG_UPDATE_XZ | ANIM_FLAG_UPDATE_Y | ANIM_FLAG_PLAYER_SETMOVE |
ANIM_FLAG_NO_MOVE | ANIM_FLAG_PLAYER_7);
ANIM_FLAG_NO_MOVE | ANIM_FLAG_OVERRIDE_MOVEMENT);
}
void func_808468E8(PlayState* play, Player* this) {
@ -11136,7 +11139,7 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) {
Player_AnimPlayOnce(play, this, &gPlayerAnim_link_uma_wait_1);
Player_AnimReplaceApplyFlags(play, this,
ANIM_FLAG_UPDATE_XZ | ANIM_FLAG_UPDATE_Y | ANIM_FLAG_PLAYER_SETMOVE |
ANIM_FLAG_NO_MOVE | ANIM_FLAG_PLAYER_7);
ANIM_FLAG_NO_MOVE | ANIM_FLAG_OVERRIDE_MOVEMENT);
this->av2.actionVar2 = 99;
}
@ -11161,7 +11164,7 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) {
func_8084FF7C(this);
}
if (!(this->skelAnime.moveFlags & ANIM_FLAG_PLAYER_7)) {
if (!(this->skelAnime.moveFlags & ANIM_FLAG_OVERRIDE_MOVEMENT)) {
if (((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (sFloorType == FLOOR_TYPE_5) &&
(this->currentBoots != PLAYER_BOOTS_IRON)) ||
((this->currentBoots == PLAYER_BOOTS_HOVER) &&
@ -14546,7 +14549,8 @@ void func_808510D4(PlayState* play, Player* this, void* anim) {
void func_808510F4(PlayState* play, Player* this, void* anim) {
Player_AnimReplacePlayOnce(play, this, anim,
ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_NO_MOVE | ANIM_FLAG_PLAYER_7);
ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_NO_MOVE |
ANIM_FLAG_OVERRIDE_MOVEMENT);
}
void func_80851114(PlayState* play, Player* this, void* anim) {
@ -14555,7 +14559,8 @@ void func_80851114(PlayState* play, Player* this, void* anim) {
void func_80851134(PlayState* play, Player* this, void* anim) {
Player_AnimReplacePlayLoop(play, this, anim,
ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_NO_MOVE | ANIM_FLAG_PLAYER_7);
ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_NO_MOVE |
ANIM_FLAG_OVERRIDE_MOVEMENT);
}
void func_80851154(PlayState* play, Player* this, void* anim) {
@ -14802,7 +14807,7 @@ void func_808519EC(PlayState* play, Player* this, CsCmdActorCue* cue) {
Player_AnimPlayOnceAdjusted(play, this, this->ageProperties->unk_9C);
Player_AnimReplaceApplyFlags(play, this,
ANIM_REPLACE_APPLY_FLAG_9 | ANIM_FLAG_UPDATE_XZ | ANIM_FLAG_UPDATE_Y |
ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_PLAYER_7);
ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_OVERRIDE_MOVEMENT);
}
static struct_808551A4 D_808551A4[] = {
@ -14913,12 +14918,13 @@ void func_80851E28(PlayState* play, Player* this, CsCmdActorCue* cue) {
void func_80851E64(PlayState* play, Player* this, CsCmdActorCue* cue) {
Player_AnimReplacePlayOnceAdjusted(play, this, &gPlayerAnim_link_swimer_swim_get,
ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_NO_MOVE | ANIM_FLAG_PLAYER_7);
ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_NO_MOVE | ANIM_FLAG_OVERRIDE_MOVEMENT);
}
void func_80851E90(PlayState* play, Player* this, CsCmdActorCue* cue) {
Player_AnimReplacePlayOnce(play, this, &gPlayerAnim_clink_op3_negaeri,
ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_NO_MOVE | ANIM_FLAG_PLAYER_7);
ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_NO_MOVE |
ANIM_FLAG_OVERRIDE_MOVEMENT);
func_80832698(this, NA_SE_VO_LI_GROAN);
}
@ -14926,7 +14932,7 @@ void func_80851ECC(PlayState* play, Player* this, CsCmdActorCue* cue) {
if (LinkAnimation_Update(play, &this->skelAnime)) {
Player_AnimReplacePlayLoop(play, this, &gPlayerAnim_clink_op3_wait2,
ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_NO_MOVE |
ANIM_FLAG_PLAYER_7);
ANIM_FLAG_OVERRIDE_MOVEMENT);
}
}
@ -14954,7 +14960,7 @@ void func_80851FB0(PlayState* play, Player* this, CsCmdActorCue* cue) {
if (LinkAnimation_Update(play, &this->skelAnime)) {
Player_AnimReplacePlayLoop(play, this, &gPlayerAnim_clink_op3_wait3,
ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_NO_MOVE |
ANIM_FLAG_PLAYER_7);
ANIM_FLAG_OVERRIDE_MOVEMENT);
this->av2.actionVar2 = 1;
} else if (this->av2.actionVar2 == 0) {
Player_ProcessAnimSfxList(this, D_808551BC);
@ -14979,7 +14985,7 @@ void func_80852048(PlayState* play, Player* this, CsCmdActorCue* cue) {
void func_80852080(PlayState* play, Player* this, CsCmdActorCue* cue) {
Player_AnimReplacePlayOnceAdjusted(play, this, &gPlayerAnim_clink_demo_futtobi,
ANIM_FLAG_UPDATE_XZ | ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE |
ANIM_FLAG_NO_MOVE | ANIM_FLAG_PLAYER_7);
ANIM_FLAG_NO_MOVE | ANIM_FLAG_OVERRIDE_MOVEMENT);
func_80832698(this, NA_SE_VO_LI_FALL_L);
}
@ -15027,7 +15033,8 @@ void func_80852234(PlayState* play, Player* this, CsCmdActorCue* cue) {
}
void func_8085225C(PlayState* play, Player* this, CsCmdActorCue* cue) {
Player_AnimReplaceApplyFlags(play, this, ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_NO_MOVE | ANIM_FLAG_PLAYER_7);
Player_AnimReplaceApplyFlags(play, this,
ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_NO_MOVE | ANIM_FLAG_OVERRIDE_MOVEMENT);
}
void func_80852280(PlayState* play, Player* this, CsCmdActorCue* cue) {