1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-12 18:01:16 +00:00

Revamp "AnimationContext" Docs, now called "AnimTaskQueue" (#1941)

* start using task terminology

* more docs

* format

* cleanups

* MoveActor -> ActorMove

* missed a couple

* hopefully the last changes

* comment explaining the group change

* some review

* dragorn review

* remove accidental file

* fix matching issue, now use while loop
This commit is contained in:
fig02 2024-06-18 23:46:36 -04:00 committed by GitHub
parent 7332e8ee76
commit 06bbdf88f1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 310 additions and 262 deletions

View file

@ -177,19 +177,19 @@ void DemoEc_UpdateBgFlags(DemoEc* this, PlayState* play) {
void func_8096D594(DemoEc* this, PlayState* play) {
this->skelAnime.moveFlags |= ANIM_FLAG_0 | ANIM_FLAG_UPDATE_Y;
AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, 1.0f);
AnimTaskQueue_AddActorMove(play, &this->actor, &this->skelAnime, 1.0f);
}
void func_8096D5D4(DemoEc* this, PlayState* play) {
this->skelAnime.baseTransl = this->skelAnime.jointTable[0];
this->skelAnime.prevTransl = this->skelAnime.jointTable[0];
this->skelAnime.moveFlags |= ANIM_FLAG_0 | ANIM_FLAG_UPDATE_Y;
AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, 1.0f);
AnimTaskQueue_AddActorMove(play, &this->actor, &this->skelAnime, 1.0f);
}
void func_8096D64C(DemoEc* this, PlayState* play) {
this->skelAnime.moveFlags |= ANIM_FLAG_0 | ANIM_FLAG_UPDATE_Y;
AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, 1.0f);
AnimTaskQueue_AddActorMove(play, &this->actor, &this->skelAnime, 1.0f);
}
void DemoEc_UpdateEyes(DemoEc* this) {

View file

@ -55,7 +55,7 @@ s32 DemoIk_CheckForCue(PlayState* play, u16 cueId, s32 cueChannel) {
void DemoIk_SetMove(DemoIk* this, PlayState* play) {
this->skelAnime.moveFlags |= ANIM_FLAG_0;
AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, 1.0f);
AnimTaskQueue_AddActorMove(play, &this->actor, &this->skelAnime, 1.0f);
}
void DemoIk_EndMove(DemoIk* this) {

View file

@ -338,7 +338,7 @@ void func_80A795C8(EnIn* this, PlayState* play) {
void func_80A79690(SkelAnime* skelAnime, EnIn* this, PlayState* play) {
if (skelAnime->baseTransl.y < skelAnime->jointTable[0].y) {
skelAnime->moveFlags |= ANIM_FLAG_0 | ANIM_FLAG_UPDATE_Y;
AnimationContext_SetMoveActor(play, &this->actor, skelAnime, 1.0f);
AnimTaskQueue_AddActorMove(play, &this->actor, skelAnime, 1.0f);
}
}

View file

@ -757,7 +757,7 @@ void EnNb_InitDemo6KInConfrontation(EnNb* this, PlayState* play) {
void func_80AB2688(EnNb* this, PlayState* play) {
this->skelAnime.moveFlags |= ANIM_FLAG_0;
AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, 1.0f);
AnimTaskQueue_AddActorMove(play, &this->actor, &this->skelAnime, 1.0f);
}
void func_80AB26C8(EnNb* this) {

View file

@ -392,7 +392,7 @@ s32 EnRu1_UpdateSkelAnime(EnRu1* this) {
void func_80AEB364(EnRu1* this, PlayState* play) {
this->skelAnime.moveFlags |= ANIM_FLAG_0;
AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, 1.0f);
AnimTaskQueue_AddActorMove(play, &this->actor, &this->skelAnime, 1.0f);
}
void func_80AEB3A4(EnRu1* this, PlayState* play) {
@ -463,7 +463,7 @@ void func_80AEB6E0(EnRu1* this, PlayState* play) {
if (skelAnime->baseTransl.y < skelAnime->jointTable[0].y) {
skelAnime->moveFlags |= ANIM_FLAG_0 | ANIM_FLAG_UPDATE_Y;
AnimationContext_SetMoveActor(play, &this->actor, skelAnime, 1.0f);
AnimTaskQueue_AddActorMove(play, &this->actor, skelAnime, 1.0f);
}
}
@ -474,7 +474,7 @@ void func_80AEB738(EnRu1* this, PlayState* play) {
skelAnime->prevTransl = skelAnime->jointTable[0];
if (skelAnime->baseTransl.y < skelAnime->jointTable[0].y) {
skelAnime->moveFlags |= ANIM_FLAG_0 | ANIM_FLAG_UPDATE_Y;
AnimationContext_SetMoveActor(play, &this->actor, skelAnime, 1.0f);
AnimTaskQueue_AddActorMove(play, &this->actor, skelAnime, 1.0f);
}
}

View file

@ -61,7 +61,7 @@ void func_80862FA8(EnTest* this, PlayState* play);
s32 EnTest_ReactToProjectile(PlayState* play, EnTest* this);
static u8 sJointCopyFlags[] = {
static u8 sUpperBodyLimbCopyMap[] = {
false, // STALFOS_LIMB_NONE
false, // STALFOS_LIMB_ROOT
false, // STALFOS_LIMB_UPPERBODY_ROOT
@ -1742,15 +1742,15 @@ void EnTest_Update(Actor* thisx, PlayState* play) {
case 1:
Animation_Change(&this->upperSkelanime, &gStalfosBlockWithShieldAnim, 2.0f, 0.0f,
Animation_GetLastFrame(&gStalfosBlockWithShieldAnim), 2, 2.0f);
AnimationContext_SetCopyTrue(play, this->skelAnime.limbCount, this->skelAnime.jointTable,
this->upperSkelanime.jointTable, sJointCopyFlags);
AnimTaskQueue_AddCopyUsingMap(play, this->skelAnime.limbCount, this->skelAnime.jointTable,
this->upperSkelanime.jointTable, sUpperBodyLimbCopyMap);
this->unk_7DE++;
break;
case 2:
SkelAnime_Update(&this->upperSkelanime);
SkelAnime_CopyFrameTableTrue(&this->skelAnime, this->skelAnime.jointTable,
this->upperSkelanime.jointTable, sJointCopyFlags);
this->upperSkelanime.jointTable, sUpperBodyLimbCopyMap);
break;
case 3:
@ -1769,7 +1769,7 @@ void EnTest_Update(Actor* thisx, PlayState* play) {
this->upperSkelanime.jointTable, this->skelAnime.jointTable,
1.0f - (this->upperSkelanime.morphWeight / oldWeight));
SkelAnime_CopyFrameTableTrue(&this->skelAnime, this->skelAnime.jointTable,
this->upperSkelanime.jointTable, sJointCopyFlags);
this->upperSkelanime.jointTable, sUpperBodyLimbCopyMap);
break;
}

View file

@ -255,20 +255,20 @@ void func_80B3C8CC(EnXc* this, PlayState* play) {
if (skelAnime->jointTable[0].y >= skelAnime->baseTransl.y) {
skelAnime->moveFlags |= ANIM_FLAG_0 | ANIM_FLAG_UPDATE_Y;
AnimationContext_SetMoveActor(play, &this->actor, skelAnime, 1.0f);
AnimTaskQueue_AddActorMove(play, &this->actor, skelAnime, 1.0f);
}
}
void func_80B3C924(EnXc* this, PlayState* play) {
this->skelAnime.moveFlags |= ANIM_FLAG_0 | ANIM_FLAG_UPDATE_Y;
AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, 1.0f);
AnimTaskQueue_AddActorMove(play, &this->actor, &this->skelAnime, 1.0f);
}
void func_80B3C964(EnXc* this, PlayState* play) {
this->skelAnime.baseTransl = this->skelAnime.jointTable[0];
this->skelAnime.prevTransl = this->skelAnime.jointTable[0];
this->skelAnime.moveFlags |= ANIM_FLAG_0 | ANIM_FLAG_UPDATE_Y;
AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, 1.0f);
AnimTaskQueue_AddActorMove(play, &this->actor, &this->skelAnime, 1.0f);
}
void func_80B3C9DC(EnXc* this) {

View file

@ -346,7 +346,7 @@ void func_80B4B834(CsCmdActorCue* cue, Vec3f* dest) {
void func_80B4B874(EnZl1* this, PlayState* play) {
this->skelAnime.moveFlags |= ANIM_FLAG_0;
AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, 1.0f);
AnimTaskQueue_AddActorMove(play, &this->actor, &this->skelAnime, 1.0f);
}
void func_80B4B8B4(EnZl1* this, PlayState* play) {

View file

@ -299,7 +299,7 @@ void EnZl4_UpdateFace(EnZl4* this) {
void EnZl4_SetMove(EnZl4* this, PlayState* play) {
this->skelAnime.moveFlags |= ANIM_FLAG_0;
AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, 1.0f);
AnimTaskQueue_AddActorMove(play, &this->actor, &this->skelAnime, 1.0f);
}
void func_80B5BB78(EnZl4* this, PlayState* play) {

View file

@ -1989,7 +1989,7 @@ void Player_AnimReplaceApplyFlags(PlayState* play, Player* this, s32 flags) {
this->skelAnime.moveFlags = flags & 0xFF;
Player_ZeroSpeedXZ(this);
AnimationContext_DisableQueue(play);
AnimTaskQueue_DisableTransformTasksForGroup(play);
}
void Player_AnimReplacePlayOnceSetSpeed(PlayState* play, Player* this, LinkAnimationHeader* anim, s32 flags,
@ -3071,8 +3071,8 @@ s32 func_808358F0(Player* this, PlayState* play) {
if ((func_808334E4(this) == animSeg) || (func_80833528(this) == animSeg) || (func_808335B0(this) == animSeg) ||
(func_808335F4(this) == animSeg)) {
AnimationContext_SetCopyAll(play, this->skelAnime.limbCount, this->upperSkelAnime.jointTable,
this->skelAnime.jointTable);
AnimTaskQueue_AddCopy(play, this->skelAnime.limbCount, this->upperSkelAnime.jointTable,
this->skelAnime.jointTable);
} else {
LinkAnimation_Update(play, &this->upperSkelAnime);
}
@ -3425,22 +3425,22 @@ s32 Player_UpdateUpperBody(Player* this, PlayState* play) {
// The functionality contained within this block of code is never used in practice
// because `upperAnimInterpWeight` is always 0.
if ((func_80833350(this) == 0) || (this->speedXZ != 0.0f)) {
AnimationContext_SetCopyFalse(play, this->skelAnime.limbCount, this->upperSkelAnime.jointTable,
this->skelAnime.jointTable, sUpperBodyLimbCopyMap);
AnimTaskQueue_AddCopyUsingMapInverted(play, this->skelAnime.limbCount, this->upperSkelAnime.jointTable,
this->skelAnime.jointTable, sUpperBodyLimbCopyMap);
}
Math_StepToF(&this->upperAnimInterpWeight, 0.0f, 0.25f);
AnimationContext_SetInterp(play, this->skelAnime.limbCount, this->skelAnime.jointTable,
this->upperSkelAnime.jointTable, 1.0f - this->upperAnimInterpWeight);
AnimTaskQueue_AddInterp(play, this->skelAnime.limbCount, this->skelAnime.jointTable,
this->upperSkelAnime.jointTable, 1.0f - this->upperAnimInterpWeight);
} else if ((func_80833350(this) == 0) || (this->speedXZ != 0.0f)) {
// Only copy the upper body animation to the upper body limbs in the main skeleton.
// Doing so allows the main skeleton to play its own animation for the lower body limbs.
AnimationContext_SetCopyTrue(play, this->skelAnime.limbCount, this->skelAnime.jointTable,
this->upperSkelAnime.jointTable, sUpperBodyLimbCopyMap);
AnimTaskQueue_AddCopyUsingMap(play, this->skelAnime.limbCount, this->skelAnime.jointTable,
this->upperSkelAnime.jointTable, sUpperBodyLimbCopyMap);
} else {
// Copy all of the upper body animation into the whole main skeleton.
// The upper body has full control of all limbs.
AnimationContext_SetCopyAll(play, this->skelAnime.limbCount, this->skelAnime.jointTable,
this->upperSkelAnime.jointTable);
AnimTaskQueue_AddCopy(play, this->skelAnime.limbCount, this->skelAnime.jointTable,
this->upperSkelAnime.jointTable);
}
return true;
@ -4650,7 +4650,7 @@ s32 Player_ActionChange_12(Player* this, PlayState* play) {
this->actor.bgCheckFlags |= BGCHECKFLAG_GROUND;
LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, anim, 1.3f);
AnimationContext_DisableQueue(play);
AnimTaskQueue_DisableTransformTasksForGroup(play);
this->actor.shape.rot.y = this->yaw = this->actor.wallYaw + 0x8000;
@ -8105,10 +8105,10 @@ void Player_Action_80841BA8(Player* this, PlayState* play) {
LinkAnimation_Update(play, &this->skelAnime);
if (Player_HoldsTwoHandedWeapon(this)) {
AnimationContext_SetLoadFrame(play, func_80833338(this), 0, this->skelAnime.limbCount,
this->skelAnime.morphTable);
AnimationContext_SetCopyTrue(play, this->skelAnime.limbCount, this->skelAnime.jointTable,
this->skelAnime.morphTable, sUpperBodyLimbCopyMap);
AnimTaskQueue_AddLoadPlayerFrame(play, func_80833338(this), 0, this->skelAnime.limbCount,
this->skelAnime.morphTable);
AnimTaskQueue_AddCopyUsingMap(play, this->skelAnime.limbCount, this->skelAnime.jointTable,
this->skelAnime.morphTable, sUpperBodyLimbCopyMap);
}
Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_CURVED, play);
@ -9033,7 +9033,7 @@ void Player_Action_8084411C(Player* this, PlayState* play) {
} else if ((this->ledgeClimbType >= PLAYER_LEDGE_CLIMB_2) && (this->yDistToLedge < 150.0f) &&
(((this->actor.world.pos.y - this->actor.floorHeight) + this->yDistToLedge) >
(70.0f * this->ageProperties->unk_08))) {
AnimationContext_DisableQueue(play);
AnimTaskQueue_DisableTransformTasksForGroup(play);
if (this->stateFlags1 & PLAYER_STATE1_2) {
func_80832698(this, NA_SE_VO_LI_HOOKSHOT_HANG);
} else {
@ -11345,9 +11345,9 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) {
Player_UpdateCamAndSeqModes(play, this);
if (this->skelAnime.moveFlags & ANIM_FLAG_PLAYER_SETMOVE) {
AnimationContext_SetMoveActor(
play, &this->actor, &this->skelAnime,
(this->skelAnime.moveFlags & ANIM_FLAG_PLAYER_2) ? 1.0f : this->ageProperties->unk_08);
AnimTaskQueue_AddActorMove(play, &this->actor, &this->skelAnime,
(this->skelAnime.moveFlags & ANIM_FLAG_PLAYER_2) ? 1.0f
: this->ageProperties->unk_08);
}
Player_UpdateShapeYaw(this, play);
@ -11417,8 +11417,10 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) {
}
}
}
AnimationContext_SetNextQueue(play);
// Because Player updates early relative to most actors, his animation tasks will belong to group 0.
// Task group 1 is set here at the end of Player's update, meaning tasks that get added by other
// actors will be in a different group.
AnimTaskQueue_SetNextGroup(play);
}
Math_Vec3f_Copy(&this->actor.home.pos, &this->actor.world.pos);
@ -12635,8 +12637,7 @@ void Player_Action_8084CC98(Player* this, PlayState* play) {
LinkAnimation_AnimateFrame(play, &this->skelAnime);
}
AnimationContext_SetCopyAll(play, this->skelAnime.limbCount, this->skelAnime.morphTable,
this->skelAnime.jointTable);
AnimTaskQueue_AddCopy(play, this->skelAnime.limbCount, this->skelAnime.morphTable, this->skelAnime.jointTable);
if ((play->csCtx.state != CS_STATE_IDLE) || (this->csAction != PLAYER_CSACTION_NONE)) {
if (this->csAction == PLAYER_CSACTION_7) {
@ -12674,16 +12675,16 @@ void Player_Action_8084CC98(Player* this, PlayState* play) {
func_80832698(this, NA_SE_VO_LI_LASH);
}
AnimationContext_SetCopyAll(play, this->skelAnime.limbCount, this->skelAnime.jointTable,
this->upperSkelAnime.jointTable);
AnimTaskQueue_AddCopy(play, this->skelAnime.limbCount, this->skelAnime.jointTable,
this->upperSkelAnime.jointTable);
} else {
if (LinkAnimation_OnFrame(&this->upperSkelAnime, 10.0f)) {
Player_PlaySfx(this, NA_SE_IT_LASH);
func_80832698(this, NA_SE_VO_LI_LASH);
}
AnimationContext_SetCopyTrue(play, this->skelAnime.limbCount, this->skelAnime.jointTable,
this->upperSkelAnime.jointTable, sUpperBodyLimbCopyMap);
AnimTaskQueue_AddCopyUsingMap(play, this->skelAnime.limbCount, this->skelAnime.jointTable,
this->upperSkelAnime.jointTable, sUpperBodyLimbCopyMap);
}
} else {
LinkAnimationHeader* anim = NULL;