diff --git a/include/z64animation.h b/include/z64animation.h index c89925c9be..618c80de1f 100755 --- a/include/z64animation.h +++ b/include/z64animation.h @@ -140,7 +140,11 @@ typedef struct { struct SkelAnime { /* 0x00 */ u8 limbCount; // joint_Num - /* 0x01 */ u8 unk_01; // state? 00 = loop 02 = don't loop ? + /* modes 0 and 1 repeat the animation indefinitely + * modes 2 and 3 play the animaton once then stop + * modes >= 4 play the animation once, and always start at frame 0. + */ + /* 0x01 */ u8 mode; /* 0x02 */ u8 dListCount; /* 0x03 */ s8 unk_03; /* 0x04 */ Skeleton* skeleton; @@ -151,8 +155,8 @@ struct SkelAnime { GenericAnimationHeader* genericSeg; }; /* 0x0C */ f32 initialFrame; - /* 0x10 */ f32 animFrameCount; // ending frame? - /* 0x14 */ f32 totalFrames; // Loop frame? + /* 0x10 */ f32 animFrameCount; + /* 0x14 */ f32 totalFrames; /* 0x18 */ f32 animCurrentFrame; /* 0x1C */ f32 animPlaybackSpeed; /* 0x20 */ Vec3s* actorDrawTbl; // now_joint diff --git a/src/code/z_skelanime.c b/src/code/z_skelanime.c index 3f3220ee9c..f986f8417a 100644 --- a/src/code/z_skelanime.c +++ b/src/code/z_skelanime.c @@ -15,7 +15,7 @@ void SkelAnime_AnimationType2Loaded(GlobalContext* globalCtx, AnimationEntryType void SkelAnime_AnimationType3Loaded(GlobalContext* globalCtx, AnimationEntryType3* entry); void SkelAnime_AnimationType4Loaded(GlobalContext* globalCtx, AnimationEntryType4* entry); void SkelAnime_AnimationType5Loaded(GlobalContext* globalCtx, AnimationEntryType5* entry); -#define NON_MATCHING +//#define NON_MATCHING //.data u32 D_8012A480 = 0; static AnimationEntryCallback sAnimationLoadDone[] = { @@ -149,7 +149,7 @@ void SkelAnime_LodDrawLimbSV(GlobalContext* globalCtx, s32 limbIndex, Skeleton* Vec3f pos; Vec3s rot; GraphicsContext* gfxCtx; - Gfx* gfx[3]; + Gfx* gfx[4]; Matrix_Push(); @@ -381,7 +381,7 @@ void SkelAnime_DrawLimbSV(GlobalContext* globalCtx, s32 limbIndex, Skeleton* ske Vec3f pos; Vec3s rot; GraphicsContext* gfxCtx; - Gfx* gfx[3]; + Gfx* gfx[4]; gfxCtx = globalCtx->state.gfxCtx; func_800C6AC4(gfx, globalCtx->state.gfxCtx, "../z_skelanime.c", 1214); @@ -1057,7 +1057,7 @@ void SkelAnime_InitLinkAnimetion(GlobalContext* globalCtx, SkelAnime* skelAnime, } void func_800A3B8C(SkelAnime* skelAnime) { - if (skelAnime->unk_01 < 2) { + if (skelAnime->mode < 2) { skelAnime->animUpdate = &func_800A3D70; } else { skelAnime->animUpdate = &func_800A3E0C; @@ -1142,9 +1142,9 @@ void func_800A3EE8(GlobalContext* globalCtx, SkelAnime* skelAnime, f32 transitio void SkelAnime_LinkChangeAnimation(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimetionEntry* linkAnimetionEntrySeg, f32 playbackSpeed, f32 frame, - f32 frameCount, u8 arg6, f32 transitionRate) { + f32 frameCount, u8 animationMode, f32 transitionRate) { - skelAnime->unk_01 = arg6; + skelAnime->mode = animationMode; if ((transitionRate != 0.0f) && ((linkAnimetionEntrySeg != skelAnime->linkAnimetionSeg) || (frame != skelAnime->animCurrentFrame))) { if (transitionRate < 0) { @@ -1244,7 +1244,7 @@ void func_800A43B8(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimetion } void func_800A4454(SkelAnime* skelAnime) { - skelAnime->unk_01 = 2; + skelAnime->mode = 2; func_800A3B8C(skelAnime); } @@ -1370,9 +1370,9 @@ void SkelAnime_InitSkin(GlobalContext* globalCtx, SkelAnime* skelAnime, Skeleton } void func_800A49B0(SkelAnime* skelAnime) { - if (skelAnime->unk_01 < 2) { + if (skelAnime->mode < 2) { skelAnime->animUpdate = &func_800A4D9C; - } else if (skelAnime->unk_01 < 4) { + } else if (skelAnime->mode < 4) { skelAnime->animUpdate = &func_800A4EE0; } else { skelAnime->animUpdate = &func_800A4E38; @@ -1522,8 +1522,8 @@ s32 func_800A4EE0(SkelAnime* skelAnime) { } void SkelAnime_ChangeAnimationImpl(SkelAnime* skelAnime, AnimationHeader* animationSeg, f32 playbackSpeed, f32 frame, - f32 frameCount, u8 unk1, f32 transitionRate, s8 unk2) { - skelAnime->unk_01 = unk1; + f32 frameCount, u8 animationType, f32 transitionRate, s8 unk2) { + skelAnime->mode = animationType; if ((transitionRate != 0.0f) && ((animationSeg != skelAnime->animCurrentSeg) || (frame != skelAnime->animCurrentFrame))) { if (transitionRate < 0) { @@ -1551,11 +1551,11 @@ void SkelAnime_ChangeAnimationImpl(SkelAnime* skelAnime, AnimationHeader* animat skelAnime->initialFrame = frame; skelAnime->animFrameCount = frameCount; skelAnime->totalFrames = SkelAnime_GetTotalFrames(&animationSeg->genericHeader); - if (skelAnime->unk_01 >= 4) { + if (skelAnime->mode >= 4) { skelAnime->animCurrentFrame = 0.0f; } else { skelAnime->animCurrentFrame = frame; - if (skelAnime->unk_01 < 2) { + if (skelAnime->mode < 2) { skelAnime->animFrameCount = skelAnime->totalFrames - 1.0f; } } @@ -1597,7 +1597,7 @@ void SkelAnime_ChangeAnimationPlaybackSpeed(SkelAnime* skelAnime, AnimationHeade } void func_800A53DC(SkelAnime* skelAnime) { - skelAnime->unk_01 = 2; + skelAnime->mode = 2; skelAnime->animFrameCount = skelAnime->totalFrames; func_800A49B0(skelAnime); }