diff --git a/include/z64animation.h b/include/z64animation.h index 7f9b047ef1..a54f137d2a 100755 --- a/include/z64animation.h +++ b/include/z64animation.h @@ -11,21 +11,18 @@ struct GlobalContext; struct Actor; -typedef struct -{ +typedef struct { /* 0x000 */ u32 limbs[1]; // One ore more limbs, index 0 is the root limb. } SkelLimbTable; // Size >= 4 -typedef struct -{ +typedef struct { /* 0x000 */ Vec3s translation; // Translation relative to parent limb. root limb is a tranlation for entire model. /* 0x006 */ u8 firstChildIndex; // The first child's index into the limb table. /* 0x007 */ u8 nextLimbIndex; // The parent limb's next limb index into the limb table. /* 0x008 */ Gfx* displayLists[1]; // Display lists for the limb. Index 0 is the normal display list, index 1 is the far model display list. } SkelLimbEntry; // Size = 0xC or 0x10 -typedef struct -{ +typedef struct { /* 0x000 */ u32 limbIndexSeg; // Segment address of SkelLimbIndex. /* 0x004 */ u8 limbCount; // Number of limbs in the model. /* 0x005 */ char pad[3]; // Padding. @@ -33,8 +30,7 @@ typedef struct /* 0x009 */ char pad2[3]; // Padding. } SkelAnimeLimbHeader; // Size = 0xC -typedef struct SkelAnime -{ +typedef struct SkelAnime { /* 0x00 */ u8 limbCount; // joint_Num /* 0x01 */ u8 unk_01; // state? 00 = loop 02 = don't loop ? /* 0x02 */ u8 dListCount; @@ -64,15 +60,13 @@ typedef struct SkelAnime typedef s16 AnimationRotationValue; -typedef struct -{ +typedef struct { /* 0x000 */ u16 x; /* 0x002 */ u16 y; /* 0x004 */ u16 z; } AnimationRotationIndex; // size = 0x06 -typedef struct -{ +typedef struct { /* 0x000 */ s16 frameCount; /* 0x002 */ s16 unk_02; /* 0x004 */ u32 rotationValueSeg; // referenced as tbl @@ -90,15 +84,13 @@ typedef enum { ANIMATION_TYPE5 } AnimationType; -typedef struct -{ +typedef struct { /* 0x000 */ DmaRequest req; /* 0x020 */ OSMesgQueue msgQueue; /* 0x038 */ OSMesg msg; } AnimationEntryType0; -typedef struct -{ +typedef struct { /* 0x000 */ u8 unk_00; /* 0x001 */ u8 vecCount; /* 0x002 */ char pad[2]; @@ -107,8 +99,7 @@ typedef struct /* 0x00C */ char unk_0C[0x30]; } AnimationEntryType1; -typedef struct -{ +typedef struct { /* 0x000 */ u8 unk_00; /* 0x001 */ u8 unk_01; /* 0x002 */ char pad[2]; @@ -118,8 +109,7 @@ typedef struct /* 0x010 */ char unk_10[0x2C]; } AnimationEntryType2; -typedef struct -{ +typedef struct { /* 0x000 */ u8 unk_00; /* 0x001 */ u8 vecCount; /* 0x002 */ char pad[2]; @@ -129,8 +119,7 @@ typedef struct /* 0x010 */ char unk_10[0x2C]; } AnimationEntryType3; -typedef struct -{ +typedef struct { /* 0x000 */ u8 unk_00; /* 0x001 */ u8 vecCount; /* 0x002 */ char unk_02[0x2]; @@ -140,21 +129,18 @@ typedef struct /* 0x010 */ char unk_10[0x2C]; } AnimationEntryType4; -typedef struct -{ +typedef struct { /* 0x000 */ struct Actor* actor; /* 0x004 */ SkelAnime* skelAnime; /* 0x008 */ f32 unk_08; /* 0x00C */ char unk_0C[0x30]; } AnimationEntryType5; -typedef struct -{ +typedef struct { /* 0x000 */ u8 raw[0x3C]; } AnimationEntryRaw; -typedef union -{ +typedef union { AnimationEntryRaw raw; AnimationEntryType0 type0; AnimationEntryType1 type1; @@ -164,23 +150,20 @@ typedef union AnimationEntryType5 type5; } AnimationEntryType; -typedef struct -{ +typedef struct { /* 0x000 */ u8 type; /* 0x001 */ u8 unk_01; /* 0x002 */ char pad[2]; /* 0x004 */ AnimationEntryType types; } AnimationEntry; // size = 0x40 -typedef struct AnimationContext -{ +typedef struct AnimationContext { s16 animationCount; char unk_02[2]; AnimationEntry entries[0x32]; } AnimationContext; -typedef struct -{ +typedef struct { u16 frameCount; char pad[2]; u32 animationSegAddress; @@ -200,7 +183,6 @@ typedef void (*SkelAnime_LimbAppendDlist2)(struct GlobalContext* globalCtx, s32 typedef void (*AnimationEntryCallback)(struct GlobalContext*, AnimationEntryType*); - extern u32 link_animetion_segment; #endif diff --git a/include/z64dma.h b/include/z64dma.h index b0285261ad..b4e4607f68 100755 --- a/include/z64dma.h +++ b/include/z64dma.h @@ -3,8 +3,7 @@ #include -typedef struct -{ +typedef struct { /* 0x00 */ u32 vromAddr; // VROM address (source) /* 0x04 */ void* dramAddr; // DRAM address (destination) /* 0x08 */ u32 size; // File Transfer size @@ -15,8 +14,7 @@ typedef struct /* 0x1C */ OSMesg notifyMsg; // Completion notification message } DmaRequest; // size = 0x20 -typedef struct -{ +typedef struct { /* 0x00 */ u32 vromStart; /* 0x04 */ u32 vromEnd; /* 0x08 */ u32 romStart; diff --git a/src/code/sys_matrix.c b/src/code/sys_matrix.c index 0d1ed55e72..fd474f1fc0 100644 --- a/src/code/sys_matrix.c +++ b/src/code/sys_matrix.c @@ -22,52 +22,41 @@ MtxF gMtxFClear = MtxF* sMatrixStack; // "Matrix_stack" MtxF* sCurrentMatrix; // "Matrix_now" -void Matrix_Init(GameState* gameState) -{ +void Matrix_Init(GameState* gameState) { sCurrentMatrix = Game_Alloc(gameState, 20 * sizeof(MtxF), "../sys_matrix.c", 153); sMatrixStack = sCurrentMatrix; } -void Matrix_Push(void) -{ +void Matrix_Push(void) { Matrix_MtxFCopy(sCurrentMatrix + 1, sCurrentMatrix); sCurrentMatrix++; } -void Matrix_Pull(void) -{ +void Matrix_Pull(void) { sCurrentMatrix--; - if (sCurrentMatrix < sMatrixStack) - { + if (sCurrentMatrix < sMatrixStack) { __assert("Matrix_now >= Matrix_stack", "../sys_matrix.c", 176); } } -void Matrix_Get(MtxF* dest) -{ +void Matrix_Get(MtxF* dest) { Matrix_MtxFCopy(dest, sCurrentMatrix); } -void Matrix_Put(MtxF* src) -{ +void Matrix_Put(MtxF* src) { Matrix_MtxFCopy(sCurrentMatrix, src); } -MtxF* Matrix_GetCurrent(void) -{ +MtxF* Matrix_GetCurrent(void) { return sCurrentMatrix; } -void Matrix_Mult(MtxF* mf, u8 mode) -{ +void Matrix_Mult(MtxF* mf, u8 mode) { MtxF* cmf = Matrix_GetCurrent(); - if (mode == MTXMODE_APPLY) - { + if (mode == MTXMODE_APPLY) { func_800A6FA0(cmf, mf, cmf); - } - else - { + } else { Matrix_MtxFCopy(sCurrentMatrix, mf); } } @@ -77,8 +66,7 @@ void Matrix_Translate(f32 x, f32 y, f32 z, u8 mode) { f32 tx; f32 ty; - if (mode == MTXMODE_APPLY) - { + if (mode == MTXMODE_APPLY) { tx = cmf->xx; ty = cmf->yx; cmf->wx += tx * x + ty * y + cmf->zx * z; @@ -91,19 +79,15 @@ void Matrix_Translate(f32 x, f32 y, f32 z, u8 mode) { tx = cmf->xw; ty = cmf->yw; cmf->ww += tx * x + ty * y + cmf->zw * z; - } - else - { + } else { func_800A7A24(cmf, x, y, z); } } -void Matrix_Scale(f32 x, f32 y, f32 z, u8 mode) -{ +void Matrix_Scale(f32 x, f32 y, f32 z, u8 mode) { MtxF* cmf = sCurrentMatrix; - if (mode == MTXMODE_APPLY) - { + if (mode == MTXMODE_APPLY) { cmf->xx *= x; cmf->xy *= x; cmf->xz *= x; @@ -116,25 +100,20 @@ void Matrix_Scale(f32 x, f32 y, f32 z, u8 mode) cmf->xw *= x; cmf->yw *= y; cmf->zw *= z; - } - else - { + } else { func_800A76A4(cmf, x, y, z); } } -void Matrix_RotateX(f32 x, u8 mode) -{ +void Matrix_RotateX(f32 x, u8 mode) { MtxF* cmf; f32 sin; f32 cos; f32 temp1; f32 temp2; - if (mode == MTXMODE_APPLY) - { - if (x != 0) - { + if (mode == MTXMODE_APPLY) { + if (x != 0) { cmf = sCurrentMatrix; sin = sinf(x); @@ -160,18 +139,13 @@ void Matrix_RotateX(f32 x, u8 mode) cmf->yw = temp1 * cos + temp2 * sin; cmf->zw = temp2 * cos - temp1 * sin; } - } - else - { + } else { cmf = sCurrentMatrix; - if (x != 0) - { + if (x != 0) { sin = sinf(x); cos = cosf(x); - } - else - { + } else { sin = 0.0f; cos = 1.0f; } @@ -195,18 +169,15 @@ void Matrix_RotateX(f32 x, u8 mode) } } -void Matrix_RotateY(f32 y, u8 mode) -{ +void Matrix_RotateY(f32 y, u8 mode) { MtxF* cmf; f32 sin; f32 cos; f32 temp1; f32 temp2; - if (mode == MTXMODE_APPLY) - { - if (y != 0) - { + if (mode == MTXMODE_APPLY) { + if (y != 0) { cmf = sCurrentMatrix; sin = sinf(y); @@ -232,18 +203,13 @@ void Matrix_RotateY(f32 y, u8 mode) cmf->xw = temp1 * cos - temp2 * sin; cmf->zw = temp1 * sin + temp2 * cos; } - } - else - { + } else { cmf = sCurrentMatrix; - if (y != 0) - { + if (y != 0) { sin = sinf(y); cos = cosf(y); - } - else - { + } else { sin = 0.0f; cos = 1.0f; } @@ -267,18 +233,15 @@ void Matrix_RotateY(f32 y, u8 mode) } } -void Matrix_RotateZ(f32 z, u8 mode) -{ +void Matrix_RotateZ(f32 z, u8 mode) { MtxF* cmf; f32 sin; f32 cos; f32 temp1; f32 temp2; - if (mode == MTXMODE_APPLY) - { - if (z != 0) - { + if (mode == MTXMODE_APPLY) { + if (z != 0) { cmf = sCurrentMatrix; sin = sinf(z); @@ -339,7 +302,7 @@ void Matrix_RotateZ(f32 z, u8 mode) * rotates that matrix by `y` degrees, then rotates that matrix * by `x` degrees. * Original Name: Matrix_RotateXYZ, changed to reflect rotation order. -*/ + */ void Matrix_RotateZYX(s16 x, s16 y, s16 z, u8 mode) { MtxF* cmf = sCurrentMatrix; f32 temp1; @@ -428,9 +391,8 @@ void Matrix_RotateZYX(s16 x, s16 y, s16 z, u8 mode) { /* * Translates the top of the matrix stack by `translation` units, * then rotates that matrix by `rotation` in Z-Y-X order -*/ -void Matrix_TranslateThenRotateZYX(Vec3f* translation, Vec3s* rotation) -{ + */ +void Matrix_TranslateThenRotateZYX(Vec3f* translation, Vec3s* rotation) { MtxF* cmf = sCurrentMatrix; f32 sin; f32 cos; diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 91bf21c5ed..eec16df032 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -3898,8 +3898,8 @@ void func_80034BA0(GlobalContext* globalCtx, SkelAnime* skelAnime, void* unkFunc gDPPipeSync(gfxCtx->polyOpa.p++); gSPSegment(gfxCtx->polyOpa.p++, 0x0C, func_80034B28(globalCtx->state.gfxCtx)); - gfxCtx->polyOpa.p = SkelAnime_DrawSV2(globalCtx, skelAnime->limbIndex, skelAnime->actorDrawTbl, skelAnime->dListCount, - unkFunc1, unkFunc2, actor, gfxCtx->polyOpa.p); + gfxCtx->polyOpa.p = SkelAnime_DrawSV2(globalCtx, skelAnime->limbIndex, skelAnime->actorDrawTbl, + skelAnime->dListCount, unkFunc1, unkFunc2, actor, gfxCtx->polyOpa.p); func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_actor.c", 8860); } @@ -3917,8 +3917,8 @@ void func_80034CC4(GlobalContext* globalCtx, SkelAnime* skelAnime, void* unkFunc gDPSetEnvColor(gfxCtx->polyXlu.p++, 0x00, 0x00, 0x00, alpha); gSPSegment(gfxCtx->polyXlu.p++, 0x0C, func_80034B54(globalCtx->state.gfxCtx)); - gfxCtx->polyXlu.p = SkelAnime_DrawSV2(globalCtx, skelAnime->limbIndex, skelAnime->actorDrawTbl, skelAnime->dListCount, - unkFunc1, unkFunc2, actor, gfxCtx->polyXlu.p); + gfxCtx->polyXlu.p = SkelAnime_DrawSV2(globalCtx, skelAnime->limbIndex, skelAnime->actorDrawTbl, + skelAnime->dListCount, unkFunc1, unkFunc2, actor, gfxCtx->polyXlu.p); func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_actor.c", 8904); } diff --git a/src/code/z_sample.c b/src/code/z_sample.c index 2f4f3fc6fb..9b9fa95593 100644 --- a/src/code/z_sample.c +++ b/src/code/z_sample.c @@ -34,10 +34,11 @@ void Sample_Draw(SampleContext* this) { gfxCtx->polyOpa.p = func_80093708(gfxCtx->polyOpa.p, 0xFF, 0xFF, 0xFF, 0, 0, 0); func_80093D18(gfxCtx); - + gDPSetCycleType(gfxCtx->polyOpa.p++, G_CYC_1CYCLE); gDPSetRenderMode(gfxCtx->polyOpa.p++, G_RM_AA_ZB_OPA_SURF, G_RM_AA_ZB_OPA_SURF2); - gDPSetCombineLERP(gfxCtx->polyOpa.p++, 0, 0, 0, PRIMITIVE, 0, 0, 0, PRIMITIVE, 0, 0, 0, PRIMITIVE, 0, 0, 0, PRIMITIVE); + gDPSetCombineLERP(gfxCtx->polyOpa.p++, 0, 0, 0, PRIMITIVE, 0, 0, 0, PRIMITIVE, 0, 0, 0, PRIMITIVE, 0, 0, 0, + PRIMITIVE); gDPSetPrimColor(gfxCtx->polyOpa.p++, 0, 0, 0xFF, 0xFF, 0x00, 0x00); func_800C6B54(gfxArr, gfxCtx, "../z_sample.c", 111); diff --git a/src/code/z_skelanime.c b/src/code/z_skelanime.c index 9066a226cd..7001c8fcad 100644 --- a/src/code/z_skelanime.c +++ b/src/code/z_skelanime.c @@ -1,8 +1,8 @@ #include #include -s32 func_800A3D70(GlobalContext*,SkelAnime*); -s32 func_800A3E0C(GlobalContext*,SkelAnime*); +s32 func_800A3D70(GlobalContext*, SkelAnime*); +s32 func_800A3E0C(GlobalContext*, SkelAnime*); s32 func_800A4D9C(SkelAnime* skelAnime); s32 func_800A4EE0(SkelAnime* skelAnime); s32 func_800A4E38(SkelAnime* skelAnime); @@ -16,23 +16,18 @@ void func_800A3874(GlobalContext* globalCtx, AnimationEntryType5* entry); //.data u32 D_8012A480 = 0; -static AnimationEntryCallback D_8012A484[] = -{ - (AnimationEntryCallback)&func_800A3678, - (AnimationEntryCallback)&func_800A36A4, - (AnimationEntryCallback)&func_800A3714, - (AnimationEntryCallback)&func_800A3770, - (AnimationEntryCallback)&func_800A37F0, - (AnimationEntryCallback)&func_800A3874, +static AnimationEntryCallback D_8012A484[] = { + (AnimationEntryCallback)&func_800A3678, (AnimationEntryCallback)&func_800A36A4, + (AnimationEntryCallback)&func_800A3714, (AnimationEntryCallback)&func_800A3770, + (AnimationEntryCallback)&func_800A37F0, (AnimationEntryCallback)&func_800A3874, }; //.bss u32 D_801600B0; -void SkelAnime_LodDrawLimb(GlobalContext* globalCtx, s32 limbIndex, u32* limbTable , Vec3s* actorDrawTable, +void SkelAnime_LodDrawLimb(GlobalContext* globalCtx, s32 limbIndex, u32* limbTable, Vec3s* actorDrawTable, SkelAnime_LimbUpdateMatrix updateMtxFunc, SkelAnime_LimbAppendDlist appendDlistFunc, - Actor* actor, s32 dListIndex) -{ + Actor* actor, s32 dListIndex) { SkelLimbEntry* limbEntry; Gfx* dList; Vec3f pos; @@ -52,42 +47,34 @@ void SkelAnime_LodDrawLimb(GlobalContext* globalCtx, s32 limbIndex, u32* limbTab pos.z = limbEntry->translation.z; dList = limbEntry->displayLists[dListIndex]; - if ((updateMtxFunc == NULL) || (updateMtxFunc(globalCtx, limbIndex, &dList, &pos, &rot, actor) == 0)) - { + if ((updateMtxFunc == NULL) || (updateMtxFunc(globalCtx, limbIndex, &dList, &pos, &rot, actor) == 0)) { Matrix_TranslateThenRotateZYX(&pos, &rot); - if (dList != NULL) - { - do - { - if(1) - { - gSPMatrix(gfxCtx->polyOpa.p++, - Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_skelanime.c", 0x325), + if (dList != NULL) { + do { + if (1) { + gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_skelanime.c", 0x325), G_MTX_LOAD); gSPDisplayList(gfxCtx->polyOpa.p++, dList); } - } while(0); + } while (0); } } - if (appendDlistFunc != NULL) - { + if (appendDlistFunc != NULL) { appendDlistFunc(globalCtx, limbIndex, &dList, &rot, actor); } - if (limbEntry->firstChildIndex != LIMB_DONE) - { - SkelAnime_LodDrawLimb(globalCtx, limbEntry->firstChildIndex, limbTable, actorDrawTable, - updateMtxFunc, appendDlistFunc, actor, dListIndex); + if (limbEntry->firstChildIndex != LIMB_DONE) { + SkelAnime_LodDrawLimb(globalCtx, limbEntry->firstChildIndex, limbTable, actorDrawTable, updateMtxFunc, + appendDlistFunc, actor, dListIndex); } Matrix_Pull(); - if (limbEntry->nextLimbIndex != LIMB_DONE) - { - SkelAnime_LodDrawLimb(globalCtx, limbEntry->nextLimbIndex, limbTable, actorDrawTable, - updateMtxFunc, appendDlistFunc, actor, dListIndex); + if (limbEntry->nextLimbIndex != LIMB_DONE) { + SkelAnime_LodDrawLimb(globalCtx, limbEntry->nextLimbIndex, limbTable, actorDrawTable, updateMtxFunc, + appendDlistFunc, actor, dListIndex); } func_800C6B54(gfx, globalCtx->state.gfxCtx, "../z_skelanime.c", 0x335); @@ -95,8 +82,7 @@ void SkelAnime_LodDrawLimb(GlobalContext* globalCtx, s32 limbIndex, u32* limbTab void SkelAnime_LodDraw(GlobalContext* globalCtx, u32* limbIndex, Vec3s* actorDrawTable, SkelAnime_LimbUpdateMatrix updateMtxFunc, SkelAnime_LimbAppendDlist appendDlistFunc, - Actor* actor, s32 dListIndex) -{ + Actor* actor, s32 dListIndex) { SkelLimbEntry* limbEntry; char pad[4]; Gfx* dList; @@ -105,8 +91,7 @@ void SkelAnime_LodDraw(GlobalContext* globalCtx, u32* limbIndex, Vec3s* actorDra GraphicsContext* gfxCtx; Gfx* gfx[4]; - if (limbIndex == NULL) - { + if (limbIndex == NULL) { osSyncPrintf("\x1b[31m"); osSyncPrintf("Si2_Lod_draw():skelがNULLです。\n"); osSyncPrintf("\x1b[m"); @@ -117,33 +102,29 @@ void SkelAnime_LodDraw(GlobalContext* globalCtx, u32* limbIndex, Vec3s* actorDra Matrix_Push(); limbEntry = SEGMENTED_TO_VIRTUAL(*limbIndex); - pos.x = (f32) actorDrawTable->x; - pos.y = (f32) actorDrawTable->y; - pos.z = (f32) actorDrawTable->z; + pos.x = (f32)actorDrawTable->x; + pos.y = (f32)actorDrawTable->y; + pos.z = (f32)actorDrawTable->z; rot = actorDrawTable[1]; dList = limbEntry->displayLists[dListIndex]; - if ((updateMtxFunc == NULL) || (updateMtxFunc(globalCtx, 1, &dList, &pos, &rot, actor) == 0)) - { + if ((updateMtxFunc == NULL) || (updateMtxFunc(globalCtx, 1, &dList, &pos, &rot, actor) == 0)) { Matrix_TranslateThenRotateZYX(&pos, &rot); - if (dList != NULL) - { - gSPMatrix(gfxCtx->polyOpa.p++, - Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_skelanime.c", 0x371), + if (dList != NULL) { + gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_skelanime.c", 0x371), G_MTX_LOAD); gSPDisplayList(gfxCtx->polyOpa.p++, dList); } } - if (appendDlistFunc != NULL) - { + if (appendDlistFunc != NULL) { appendDlistFunc(globalCtx, 1, &dList, &rot, actor); } - if (limbEntry->firstChildIndex != 0xFF) - { - SkelAnime_LodDrawLimb(globalCtx, limbEntry->firstChildIndex, limbIndex, actorDrawTable, updateMtxFunc, appendDlistFunc, actor, dListIndex); + if (limbEntry->firstChildIndex != 0xFF) { + SkelAnime_LodDrawLimb(globalCtx, limbEntry->firstChildIndex, limbIndex, actorDrawTable, updateMtxFunc, + appendDlistFunc, actor, dListIndex); } Matrix_Pull(); @@ -153,8 +134,7 @@ void SkelAnime_LodDraw(GlobalContext* globalCtx, u32* limbIndex, Vec3s* actorDra #ifdef NON_MATCHING void SkelAnime_LodDrawLimbSV(GlobalContext* globalCtx, s32 limbIndex, u32* limbTable, Vec3s* actorDrawTable, SkelAnime_LimbUpdateMatrix updateMtxFunc, SkelAnime_LimbAppendDlist appendDlistFunc, - Actor* actor, s32 dListIndex, Mtx** mtx) -{ + Actor* actor, s32 dListIndex, Mtx** mtx) { SkelLimbEntry* limbEntry; Gfx* dList[2]; Vec3f pos; @@ -174,40 +154,34 @@ void SkelAnime_LodDrawLimbSV(GlobalContext* globalCtx, s32 limbIndex, u32* limbT pos.z = limbEntry->translation.z; dList[1] = dList[0] = limbEntry->displayLists[dListIndex]; - if ((updateMtxFunc == NULL) || (updateMtxFunc(globalCtx, limbIndex, &dList[1], &pos, &rot, actor) == 0)) - { + if ((updateMtxFunc == NULL) || (updateMtxFunc(globalCtx, limbIndex, &dList[1], &pos, &rot, actor) == 0)) { Matrix_TranslateThenRotateZYX(&pos, &rot); - if (dList[1] != NULL) - { - Matrix_ToMtx(*mtx, "../z_skelanime.c", 945); gfxCtx = globalCtx->state.gfxCtx; + if (dList[1] != NULL) { + Matrix_ToMtx(*mtx, "../z_skelanime.c", 945); + gfxCtx = globalCtx->state.gfxCtx; func_800C6AC4(gfx, globalCtx->state.gfxCtx, "../z_skelanime.c", 946); gSPMatrix(gfxCtx->polyOpa.p++, *mtx, G_MTX_LOAD); gSPDisplayList(gfxCtx->polyOpa.p++, dList[1]); func_800C6B54(gfx, globalCtx->state.gfxCtx, "../z_skelanime.c", 949); (*mtx)++; - } - else if (dList[0] != 0) - { + } else if (dList[0] != 0) { Matrix_ToMtx(*mtx, "../z_skelanime.c", 954); (*mtx)++; } } - if (appendDlistFunc != NULL) - { + if (appendDlistFunc != NULL) { appendDlistFunc(globalCtx, limbIndex, &dList[0], &rot, actor); } - if (limbEntry->firstChildIndex != LIMB_DONE) - { - SkelAnime_LodDrawLimbSV(globalCtx, limbEntry->firstChildIndex, limbTable, actorDrawTable, - updateMtxFunc, appendDlistFunc, actor, dListIndex, mtx); + if (limbEntry->firstChildIndex != LIMB_DONE) { + SkelAnime_LodDrawLimbSV(globalCtx, limbEntry->firstChildIndex, limbTable, actorDrawTable, updateMtxFunc, + appendDlistFunc, actor, dListIndex, mtx); } Matrix_Pull(); - if (limbEntry->nextLimbIndex != LIMB_DONE) - { - SkelAnime_LodDrawLimbSV(globalCtx, limbEntry->nextLimbIndex, limbTable, - actorDrawTable, updateMtxFunc, appendDlistFunc, actor, dListIndex, mtx); + if (limbEntry->nextLimbIndex != LIMB_DONE) { + SkelAnime_LodDrawLimbSV(globalCtx, limbEntry->nextLimbIndex, limbTable, actorDrawTable, updateMtxFunc, + appendDlistFunc, actor, dListIndex, mtx); } } #else @@ -217,9 +191,8 @@ void SkelAnime_LodDrawLimbSV(GlobalContext* globalCtx, s32 limbIndex, u32* limbT #ifdef NON_MATCHING void SkelAnime_LodDrawSV(GlobalContext* globalCtx, u32* limbTable, Vec3s* actorDrawTable, s32 limbCount, SkelAnime_LimbUpdateMatrix updateMtxFunc, SkelAnime_LimbAppendDlist appendDlistFunc, - Actor* actor, s32 dListIndex) -{ - SkelLimbEntry *limbEntry; + Actor* actor, s32 dListIndex) { + SkelLimbEntry* limbEntry; Gfx* dList[2]; Vec3f pos; Vec3s rot; @@ -227,16 +200,13 @@ void SkelAnime_LodDrawSV(GlobalContext* globalCtx, u32* limbTable, Vec3s* actorD GraphicsContext* gfxCtx; Gfx* gfx[4]; - do - { - if(1) - { + do { + if (1) { mtx = Graph_Alloc(globalCtx->state.gfxCtx, limbCount * 0x40); } - } while(0); + } while (0); - if (limbTable == NULL) - { + if (limbTable == NULL) { osSyncPrintf("\x1b[31m"); osSyncPrintf("Si2_Lod_draw_SV():skelがNULLです。\n"); osSyncPrintf("\x1b[m"); @@ -255,35 +225,29 @@ void SkelAnime_LodDrawSV(GlobalContext* globalCtx, u32* limbTable, Vec3s* actorD rot = actorDrawTable[1]; - dList[1] = dList[0] = limbEntry->displayLists[dListIndex]; + dList[1] = dList[0] = limbEntry->displayLists[dListIndex]; - if ((updateMtxFunc == 0) || (updateMtxFunc(globalCtx, 1, &dList[1], &pos, &rot, actor) == 0)) - { + if ((updateMtxFunc == 0) || (updateMtxFunc(globalCtx, 1, &dList[1], &pos, &rot, actor) == 0)) { Matrix_TranslateThenRotateZYX(&pos, &rot); - if (dList[1] != NULL) - { + if (dList[1] != NULL) { Matrix_ToMtx(mtx, "../z_skelanime.c", 1033); gSPMatrix(gfxCtx->polyOpa.p++, mtx, G_MTX_LOAD); gSPDisplayList(gfxCtx->polyOpa.p++, dList[1]); mtx++; - } - else - { - if (dList[0] != NULL) - { + } else { + if (dList[0] != NULL) { Matrix_ToMtx(mtx, "../z_skelanime.c", 1040); mtx++; } } } - if (appendDlistFunc != NULL) - { + if (appendDlistFunc != NULL) { appendDlistFunc(globalCtx, 1, &dList[0], &rot, actor); } - if (limbEntry->firstChildIndex != LIMB_DONE) - { - SkelAnime_LodDrawLimbSV(globalCtx, limbEntry->firstChildIndex, limbTable, actorDrawTable, updateMtxFunc, appendDlistFunc, actor, dListIndex, &mtx); + if (limbEntry->firstChildIndex != LIMB_DONE) { + SkelAnime_LodDrawLimbSV(globalCtx, limbEntry->firstChildIndex, limbTable, actorDrawTable, updateMtxFunc, + appendDlistFunc, actor, dListIndex, &mtx); } Matrix_Pull(); @@ -296,8 +260,7 @@ void SkelAnime_LodDrawSV(GlobalContext* globalCtx, u32* limbTable, Vec3s* actorD void SkelAnime_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, u32* limbTable, Vec3s* actorDrawTable, SkelAnime_LimbUpdateMatrix updateMtxFunc, SkelAnime_LimbAppendDlist appendDlistFunc, - Actor* actor) -{ + Actor* actor) { SkelLimbEntry* limbEntry; Gfx* dList; Vec3f pos; @@ -313,53 +276,45 @@ void SkelAnime_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, u32* limbTable, limbEntry = SEGMENTED_TO_VIRTUAL(limbTable[limbIndex]); limbIndex++; rot = actorDrawTable[limbIndex]; - pos.x = (f32) limbEntry->translation.x; - pos.y = (f32) limbEntry->translation.y; - pos.z = (f32) limbEntry->translation.z; + pos.x = (f32)limbEntry->translation.x; + pos.y = (f32)limbEntry->translation.y; + pos.z = (f32)limbEntry->translation.z; dList = limbEntry->displayLists[0]; - if ((updateMtxFunc == NULL) || (updateMtxFunc(globalCtx, limbIndex, &dList, &pos, &rot, actor) == 0)) - { + if ((updateMtxFunc == NULL) || (updateMtxFunc(globalCtx, limbIndex, &dList, &pos, &rot, actor) == 0)) { Matrix_TranslateThenRotateZYX(&pos, &rot); - if (dList != NULL) - { - do - { - if(1) - { - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_skelanime.c", 1103), G_MTX_LOAD); + if (dList != NULL) { + do { + if (1) { + gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_skelanime.c", 1103), + G_MTX_LOAD); gSPDisplayList(gfxCtx->polyOpa.p++, dList); } - } while(0); + } while (0); } } - if (appendDlistFunc != NULL) - { + if (appendDlistFunc != NULL) { appendDlistFunc(globalCtx, limbIndex, &dList, &rot, actor); } - if (limbEntry->firstChildIndex != LIMB_DONE) - { - SkelAnime_DrawLimb(globalCtx, limbEntry->firstChildIndex, limbTable, - actorDrawTable, updateMtxFunc, appendDlistFunc, actor); + if (limbEntry->firstChildIndex != LIMB_DONE) { + SkelAnime_DrawLimb(globalCtx, limbEntry->firstChildIndex, limbTable, actorDrawTable, updateMtxFunc, + appendDlistFunc, actor); } Matrix_Pull(); - if (limbEntry->nextLimbIndex != LIMB_DONE) - { - SkelAnime_DrawLimb(globalCtx, limbEntry->nextLimbIndex, limbTable, - actorDrawTable, updateMtxFunc, appendDlistFunc, actor); + if (limbEntry->nextLimbIndex != LIMB_DONE) { + SkelAnime_DrawLimb(globalCtx, limbEntry->nextLimbIndex, limbTable, actorDrawTable, updateMtxFunc, + appendDlistFunc, actor); } func_800C6B54(gfx, globalCtx->state.gfxCtx, "../z_skelanime.c", 1121); } void SkelAnime_Draw(GlobalContext* globalCtx, u32* limbTable, Vec3s* actorDrawTable, - SkelAnime_LimbUpdateMatrix updateMtxFunc, SkelAnime_LimbAppendDlist appendDlistFunc, - Actor* actor) -{ + SkelAnime_LimbUpdateMatrix updateMtxFunc, SkelAnime_LimbAppendDlist appendDlistFunc, Actor* actor) { SkelLimbEntry* rootLimb; char pad[4]; Gfx* dList; @@ -368,8 +323,7 @@ void SkelAnime_Draw(GlobalContext* globalCtx, u32* limbTable, Vec3s* actorDrawTa GraphicsContext* gfxCtx; Gfx* gfx[4]; - if (limbTable == NULL) - { + if (limbTable == NULL) { osSyncPrintf("\x1b[31m"); osSyncPrintf("Si2_draw():skelがNULLです。\n"); // Si2_draw (): skel is NULL. osSyncPrintf("\x1b[m"); @@ -382,32 +336,29 @@ void SkelAnime_Draw(GlobalContext* globalCtx, u32* limbTable, Vec3s* actorDrawTa Matrix_Push(); rootLimb = SEGMENTED_TO_VIRTUAL(*limbTable); - pos.x = (f32) actorDrawTable[0].x; - pos.y = (f32) actorDrawTable[0].y; - pos.z = (f32) actorDrawTable[0].z; + pos.x = (f32)actorDrawTable[0].x; + pos.y = (f32)actorDrawTable[0].y; + pos.z = (f32)actorDrawTable[0].z; rot = actorDrawTable[1]; dList = rootLimb->displayLists[0]; - if ((updateMtxFunc == NULL) || (updateMtxFunc(globalCtx, 1, &dList, &pos, &rot, actor) == 0)) - { + if ((updateMtxFunc == NULL) || (updateMtxFunc(globalCtx, 1, &dList, &pos, &rot, actor) == 0)) { Matrix_TranslateThenRotateZYX(&pos, &rot); - if (dList != NULL) - { - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_skelanime.c", 1176), G_MTX_LOAD); + if (dList != NULL) { + gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_skelanime.c", 1176), + G_MTX_LOAD); gSPDisplayList(gfxCtx->polyOpa.p++, dList); } } - if (appendDlistFunc != NULL) - { + if (appendDlistFunc != NULL) { appendDlistFunc(globalCtx, 1, &dList, &rot, actor); } - if (rootLimb->firstChildIndex != LIMB_DONE) - { - SkelAnime_DrawLimb(globalCtx, rootLimb->firstChildIndex, limbTable, - actorDrawTable, updateMtxFunc, appendDlistFunc, actor); + if (rootLimb->firstChildIndex != LIMB_DONE) { + SkelAnime_DrawLimb(globalCtx, rootLimb->firstChildIndex, limbTable, actorDrawTable, updateMtxFunc, + appendDlistFunc, actor); } Matrix_Pull(); @@ -416,14 +367,13 @@ void SkelAnime_Draw(GlobalContext* globalCtx, u32* limbTable, Vec3s* actorDrawTa } #ifdef NON_MATCHING -void SkelAnime_DrawLimbSV(GlobalContext *globalCtx, u32 limbIndex, u32* limbTable, Vec3s* actorDrawTable, +void SkelAnime_DrawLimbSV(GlobalContext* globalCtx, u32 limbIndex, u32* limbTable, Vec3s* actorDrawTable, SkelAnime_LimbUpdateMatrix updateMtxFunc, SkelAnime_LimbAppendDlist appendDlistFunc, - Actor* actor, Mtx** limbMatricies) -{ + Actor* actor, Mtx** limbMatricies) { Gfx* limbDlist[2]; Vec3f limbPos; Vec3s limbRot; - GraphicsContext *gfxCtx; + GraphicsContext* gfxCtx; Gfx* sp34[3]; SkelLimbEntry* limbEntry; @@ -433,49 +383,43 @@ void SkelAnime_DrawLimbSV(GlobalContext *globalCtx, u32 limbIndex, u32* limbTabl limbEntry = SEGMENTED_TO_VIRTUAL(limbTable[limbIndex]); limbRot = actorDrawTable[++limbIndex]; - limbPos.x = (f32) limbEntry->pos.x; - limbPos.y = (f32) limbEntry->pos.y; - limbPos.z = (f32) limbEntry->pos.z; + limbPos.x = (f32)limbEntry->pos.x; + limbPos.y = (f32)limbEntry->pos.y; + limbPos.z = (f32)limbEntry->pos.z; limbDlist[0] = limbEntry->dList; limbDlist[1] = limbEntry->dList; - if ((updateMtxFunc == NULL) || (updateMtxFunc(globalCtx, limbIndex, &limbDlist[0], &limbPos, &limbRot, actor) == 0)) - { + if ((updateMtxFunc == NULL) || + (updateMtxFunc(globalCtx, limbIndex, &limbDlist[0], &limbPos, &limbRot, actor) == 0)) { Matrix_TranslateThenRotateZYX(&limbPos, &limbRot); - if (limbDlist[0] != NULL) - { + if (limbDlist[0] != NULL) { Matrix_ToMtx(*limbMatricies, "../z_skelanime.c", 0x4DA); gSPMatrix(gfxCtx->polyOpa.p++, *limbMatricies, G_MTX_LOAD); gSPDisplayList(gfxCtx->polyOpa.p++, &limbDlist[0]); (*limbMatricies)++; - } - else - { - if (&limbDlist[1] != 0) - { + } else { + if (&limbDlist[1] != 0) { Matrix_ToMtx(*limbMatricies, "../z_skelanime.c", 0x4E1); (*limbMatricies)++; } } } - if (appendDlistFunc != NULL) - { + if (appendDlistFunc != NULL) { appendDlistFunc(globalCtx, limbIndex, &limbDlist[1], &limbRot, actor); } - if (limbEntry->firstChildIndex != LIMB_DONE) - { - SkelAnime_DrawLimbSV(globalCtx, limbEntry->firstChildIndex, limbTable, actorDrawTable, updateMtxFunc, appendDlistFunc, actor, limbMatricies); + if (limbEntry->firstChildIndex != LIMB_DONE) { + SkelAnime_DrawLimbSV(globalCtx, limbEntry->firstChildIndex, limbTable, actorDrawTable, updateMtxFunc, + appendDlistFunc, actor, limbMatricies); } Matrix_Pull(); - if (limbEntry->nextLimbIndex != LIMB_DONE) - { - SkelAnime_DrawLimbSV(globalCtx, limbEntry->nextLimbIndex, limbTable, actorDrawTable, - updateMtxFunc, appendDlistFunc, actor, limbMatricies); + if (limbEntry->nextLimbIndex != LIMB_DONE) { + SkelAnime_DrawLimbSV(globalCtx, limbEntry->nextLimbIndex, limbTable, actorDrawTable, updateMtxFunc, + appendDlistFunc, actor, limbMatricies); } func_800C6B54(sp34, globalCtx->state.gfxCtx, "../z_skelanime.c", 0x4F1); @@ -487,22 +431,20 @@ void SkelAnime_DrawLimbSV(GlobalContext *globalCtx, u32 limbIndex, u32* limbTabl #ifdef NON_MATCHING void SkelAnime_DrawSV(GlobalContext* globalCtx, u32* limbTable, Vec3s* actorDrawTable, u32 dListCount, SkelAnime_LimbUpdateMatrix updateMtxFunc, SkelAnime_LimbAppendDlist appendDlistFunc, - Actor* actor) -{ - SkelLimbEntry *rootLimb; + Actor* actor) { + SkelLimbEntry* rootLimb; Gfx* skelDlist[2]; Vec3f pos; Vec3s rot; GraphicsContext* gfxCtx; Mtx* limbMatricies; - Gfx *gfx[5]; + Gfx* gfx[5]; limbMatricies = Graph_Alloc(globalCtx->state.gfxCtx, dListCount << 6); - if (limbTable == NULL) - { + if (limbTable == NULL) { osSyncPrintf("\x1b[31m"); - osSyncPrintf("Si2_draw_SV():skelがNULLです。\n"); //Si2_draw_SV (): skel is NULL. + osSyncPrintf("Si2_draw_SV():skelがNULLです。\n"); // Si2_draw_SV (): skel is NULL. osSyncPrintf("\x1b[m"); return; } @@ -515,43 +457,36 @@ void SkelAnime_DrawSV(GlobalContext* globalCtx, u32* limbTable, Vec3s* actorDraw Matrix_Push(); rootLimb = SEGMENTED_TO_VIRTUAL(*limbTable); - pos.x = (f32) actorDrawTable[0].x; - pos.y = (f32) actorDrawTable[0].y; - pos.z = (f32) actorDrawTable[0].z; + pos.x = (f32)actorDrawTable[0].x; + pos.y = (f32)actorDrawTable[0].y; + pos.z = (f32)actorDrawTable[0].z; rot = actorDrawTable[1]; skelDlist[0] = skelDlist[1] = rootLimb->dList; - if ((updateMtxFunc == NULL) || (updateMtxFunc(globalCtx, 1, &skelDlist[0], &pos, &rot, actor) == 0)) - { + if ((updateMtxFunc == NULL) || (updateMtxFunc(globalCtx, 1, &skelDlist[0], &pos, &rot, actor) == 0)) { Matrix_TranslateThenRotateZYX(&pos, &rot); - if (skelDlist[0] != NULL) - { + if (skelDlist[0] != NULL) { Matrix_ToMtx(limbMatricies, "../z_skelanime.c", 1327); gSPMatrix(gfxCtx->polyOpa.p++, limbMatricies, G_MTX_LOAD); gSPDisplayList(gfxCtx->polyOpa.p++, skelDlist[0]); limbMatricies++; - } - else - { - if (skelDlist[1] != 0) - { + } else { + if (skelDlist[1] != 0) { Matrix_ToMtx(limbMatricies, "../z_skelanime.c", 1334); limbMatricies++; } } } - if (appendDlistFunc != 0) - { + if (appendDlistFunc != 0) { appendDlistFunc(globalCtx, 1, &skelDlist[1], &rot, actor); } - if (rootLimb->firstChildIndex != LIMB_DONE) - { - SkelAnime_DrawLimbSV(globalCtx, rootLimb->firstChildIndex, limbTable, actorDrawTable, - updateMtxFunc, appendDlistFunc, actor, &limbMatricies); + if (rootLimb->firstChildIndex != LIMB_DONE) { + SkelAnime_DrawLimbSV(globalCtx, rootLimb->firstChildIndex, limbTable, actorDrawTable, updateMtxFunc, + appendDlistFunc, actor, &limbMatricies); } Matrix_Pull(); @@ -566,13 +501,12 @@ void SkelAnime_DrawSV(GlobalContext* globalCtx, u32* limbTable, Vec3s* actorDraw * Copies the rotation values from the rotation value table, indexed by the rotation index table * When a rotation index is >= the animation limit, the output rotation value is copied from the frame's * rotation value list, otherwise it is copied from the initial rotation value list -*/ -void SkelAnime_AnimateFrame(u32 animation, s32 currentFrame, s32 limbCount, Vec3s *dst) -{ + */ +void SkelAnime_AnimateFrame(u32 animation, s32 currentFrame, s32 limbCount, Vec3s* dst) { AnimationRotationIndex* index; AnimationRotationValue* rotationValueTable; AnimationRotationValue* frameRotationValueTable; - AnimationHeader *animationHeader; + AnimationHeader* animationHeader; s32 i; u16 limit; @@ -583,17 +517,17 @@ void SkelAnime_AnimateFrame(u32 animation, s32 currentFrame, s32 limbCount, Vec3 frameRotationValueTable = &rotationValueTable[currentFrame]; limit = animationHeader->limit; - for(i = 0; i < limbCount; i++, dst++, index++) - { - if ((dst == NULL) || (index == NULL) || - (frameRotationValueTable == NULL) || - (rotationValueTable == NULL)) - { - if(1) { } // Necessary to match. - LogUtils_LogThreadId("../z_skelanime.c", 1392); osSyncPrintf("out = %08x\n", dst); - LogUtils_LogThreadId("../z_skelanime.c", 1393); osSyncPrintf("ref_tbl = %08x\n", index); - LogUtils_LogThreadId("../z_skelanime.c", 1394); osSyncPrintf("frame_tbl = %08x\n", frameRotationValueTable); - LogUtils_LogThreadId("../z_skelanime.c", 1395); osSyncPrintf("tbl = %08x\n", rotationValueTable); + for (i = 0; i < limbCount; i++, dst++, index++) { + if ((dst == NULL) || (index == NULL) || (frameRotationValueTable == NULL) || (rotationValueTable == NULL)) { + if (1) {} // Necessary to match. + LogUtils_LogThreadId("../z_skelanime.c", 1392); + osSyncPrintf("out = %08x\n", dst); + LogUtils_LogThreadId("../z_skelanime.c", 1393); + osSyncPrintf("ref_tbl = %08x\n", index); + LogUtils_LogThreadId("../z_skelanime.c", 1394); + osSyncPrintf("frame_tbl = %08x\n", frameRotationValueTable); + LogUtils_LogThreadId("../z_skelanime.c", 1395); + osSyncPrintf("tbl = %08x\n", rotationValueTable); } dst->x = index->x >= limit ? frameRotationValueTable[index->x] : rotationValueTable[index->x]; @@ -602,14 +536,12 @@ void SkelAnime_AnimateFrame(u32 animation, s32 currentFrame, s32 limbCount, Vec3 } } -s16 func_800A1FC8(u32 animationSeg) -{ +s16 func_800A1FC8(u32 animationSeg) { AnimationHeader* animation = (u16*)SEGMENTED_TO_VIRTUAL(animationSeg); return animation->frameCount; } -s32 SkelAnime_GetFrameCount(u32 animationSeg) -{ +s32 SkelAnime_GetFrameCount(u32 animationSeg) { AnimationHeader* animation = (u16*)SEGMENTED_TO_VIRTUAL(animationSeg); return (s16)((u16)animation->frameCount - 1); @@ -617,8 +549,7 @@ s32 SkelAnime_GetFrameCount(u32 animationSeg) Gfx* SkelAnime_Draw2Limb(GlobalContext* globalCtx, s32 limbIndex, u32* limbTable, Vec3s* actorDrawTable, SkelAnime_LimbUpdateMatrix2 updateMtxFunc, SkelAnime_LimbAppendDlist2 appendDlistFunc, - Actor* actor, Gfx* gfx) -{ + Actor* actor, Gfx* gfx) { SkelLimbEntry* limbEntry; Gfx* dList; Vec3f pos; @@ -637,33 +568,28 @@ Gfx* SkelAnime_Draw2Limb(GlobalContext* globalCtx, s32 limbIndex, u32* limbTable dList = limbEntry->displayLists[0]; - if ((updateMtxFunc == NULL) || (updateMtxFunc(globalCtx, limbIndex, &dList, &pos, &rot, actor, &gfx) == 0)) - { + if ((updateMtxFunc == NULL) || (updateMtxFunc(globalCtx, limbIndex, &dList, &pos, &rot, actor, &gfx) == 0)) { Matrix_TranslateThenRotateZYX(&pos, &rot); - if (dList != NULL) - { + if (dList != NULL) { gSPMatrix(gfx++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_skelanime.c", 0x5D1), G_MTX_LOAD); gSPDisplayList(gfx++, dList); } } - if (appendDlistFunc != NULL) - { + if (appendDlistFunc != NULL) { appendDlistFunc(globalCtx, limbIndex, &dList, &rot, actor, &gfx); } - if (limbEntry->firstChildIndex != LIMB_DONE) - { - gfx = SkelAnime_Draw2Limb(globalCtx, limbEntry->firstChildIndex, limbTable, actorDrawTable, - updateMtxFunc, appendDlistFunc, actor, gfx); + if (limbEntry->firstChildIndex != LIMB_DONE) { + gfx = SkelAnime_Draw2Limb(globalCtx, limbEntry->firstChildIndex, limbTable, actorDrawTable, updateMtxFunc, + appendDlistFunc, actor, gfx); } Matrix_Pull(); - if (limbEntry->nextLimbIndex != LIMB_DONE) - { - gfx = SkelAnime_Draw2Limb(globalCtx, limbEntry->nextLimbIndex, limbTable, actorDrawTable, - updateMtxFunc, appendDlistFunc, actor, gfx); + if (limbEntry->nextLimbIndex != LIMB_DONE) { + gfx = SkelAnime_Draw2Limb(globalCtx, limbEntry->nextLimbIndex, limbTable, actorDrawTable, updateMtxFunc, + appendDlistFunc, actor, gfx); } return gfx; @@ -673,15 +599,13 @@ Gfx* SkelAnime_Draw2Limb(GlobalContext* globalCtx, s32 limbIndex, u32* limbTable // Some regalloc, and nonmatching stack usage Gfx* SkelAnime_Draw2(GlobalContext* globalCtx, u32* limbTable, Vec3s* actorDrawTable, SkelAnime_LimbUpdateMatrix2 updateMtxFunc, SkelAnime_LimbAppendDlist2 appendDlistFunc, - Actor* actor, Gfx* gfx) -{ + Actor* actor, Gfx* gfx) { SkelLimbEntry* limbEntry; Vec3f pos; Vec3s rot; Gfx* dList; - if (limbTable == NULL) - { + if (limbTable == NULL) { osSyncPrintf("\x1b[31m"); osSyncPrintf("Si2_draw2():skelがNULLです。NULLを返します。\n"); osSyncPrintf("\x1b[m"); @@ -700,25 +624,21 @@ Gfx* SkelAnime_Draw2(GlobalContext* globalCtx, u32* limbTable, Vec3s* actorDrawT dList = limbEntry->displayLists[0]; - if ((updateMtxFunc == NULL) || (updateMtxFunc(globalCtx, 1, &dList, &pos, &rot, actor, &gfx) == 0)) - { + if ((updateMtxFunc == NULL) || (updateMtxFunc(globalCtx, 1, &dList, &pos, &rot, actor, &gfx) == 0)) { Matrix_TranslateThenRotateZYX(&pos, &rot); - if (dList != NULL) - { + if (dList != NULL) { gSPMatrix(gfx++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_skelanime.c", 0x616), G_MTX_LOAD); gSPDisplayList(gfx++, dList); } } - if (appendDlistFunc != NULL) - { + if (appendDlistFunc != NULL) { appendDlistFunc(globalCtx, 1, &dList, &rot, actor, &gfx); } - if (limbEntry->firstChildIndex != LIMB_DONE) - { - gfx = SkelAnime_Draw2Limb(globalCtx, limbEntry->firstChildIndex, limbTable, actorDrawTable, - updateMtxFunc, appendDlistFunc, actor, gfx); + if (limbEntry->firstChildIndex != LIMB_DONE) { + gfx = SkelAnime_Draw2Limb(globalCtx, limbEntry->firstChildIndex, limbTable, actorDrawTable, updateMtxFunc, + appendDlistFunc, actor, gfx); } Matrix_Pull(); @@ -731,8 +651,7 @@ Gfx* SkelAnime_Draw2(GlobalContext* globalCtx, u32* limbTable, Vec3s* actorDrawT Gfx* SkelAnime_DrawLimbSV2(GlobalContext* globalCtx, s32 limbIndex, u32* limbTable, Vec3s* actorDrawTable, SkelAnime_LimbUpdateMatrix2 updateMtxFunc, SkelAnime_LimbAppendDlist2 appendDlistFunc, - Actor* actor, Mtx** mtx, Gfx* gfx) -{ + Actor* actor, Mtx** mtx, Gfx* gfx) { SkelLimbEntry* limbEntry; Gfx* dList1; Gfx* dList2; @@ -751,39 +670,33 @@ Gfx* SkelAnime_DrawLimbSV2(GlobalContext* globalCtx, s32 limbIndex, u32* limbTab pos.z = limbEntry->translation.z; dList1 = dList2 = limbEntry->displayLists[0]; - if ((updateMtxFunc == NULL) || (updateMtxFunc(globalCtx, limbIndex, &dList1, &pos, &rot, actor, &gfx) == 0)) - { + if ((updateMtxFunc == NULL) || (updateMtxFunc(globalCtx, limbIndex, &dList1, &pos, &rot, actor, &gfx) == 0)) { Matrix_TranslateThenRotateZYX(&pos, &rot); - if (dList1 != NULL) - { + if (dList1 != NULL) { Matrix_ToMtx(*mtx, "../z_skelanime.c", 0x657); gSPMatrix(gfx++, *mtx, G_MTX_LOAD); gSPDisplayList(gfx++, dList1); (*mtx)++; - } - else - { - if (dList2 != NULL) - { + } else { + if (dList2 != NULL) { Matrix_ToMtx(*mtx, "../z_skelanime.c", 0x65E); (*mtx)++; } } } - if (appendDlistFunc != 0) - { + if (appendDlistFunc != 0) { appendDlistFunc(globalCtx, limbIndex, &dList2, &rot, actor, &gfx); } - if (limbEntry->firstChildIndex != LIMB_DONE) - { - gfx = SkelAnime_DrawLimbSV2(globalCtx, limbEntry->firstChildIndex, limbTable, actorDrawTable, updateMtxFunc, appendDlistFunc, actor, mtx, gfx); + if (limbEntry->firstChildIndex != LIMB_DONE) { + gfx = SkelAnime_DrawLimbSV2(globalCtx, limbEntry->firstChildIndex, limbTable, actorDrawTable, updateMtxFunc, + appendDlistFunc, actor, mtx, gfx); } Matrix_Pull(); - if (limbEntry->nextLimbIndex != LIMB_DONE) - { - gfx = SkelAnime_DrawLimbSV2(globalCtx, limbEntry->nextLimbIndex, limbTable, actorDrawTable, updateMtxFunc, appendDlistFunc, actor, mtx, gfx); + if (limbEntry->nextLimbIndex != LIMB_DONE) { + gfx = SkelAnime_DrawLimbSV2(globalCtx, limbEntry->nextLimbIndex, limbTable, actorDrawTable, updateMtxFunc, + appendDlistFunc, actor, mtx, gfx); } return gfx; @@ -791,8 +704,7 @@ Gfx* SkelAnime_DrawLimbSV2(GlobalContext* globalCtx, s32 limbIndex, u32* limbTab Gfx* SkelAnime_DrawSV2(GlobalContext* globalCtx, u32* limbTable, Vec3s* actorDrawTable, s32 dListCount, SkelAnime_LimbUpdateMatrix2 updateMtxFunc, SkelAnime_LimbAppendDlist2 appendDlistFunc, - Actor* actor, Gfx* gfx) -{ + Actor* actor, Gfx* gfx) { SkelLimbEntry* limbEntry; char pad[4]; Gfx* dList1; @@ -802,8 +714,7 @@ Gfx* SkelAnime_DrawSV2(GlobalContext* globalCtx, u32* limbTable, Vec3s* actorDra Mtx* mtx; mtx = Graph_Alloc(globalCtx->state.gfxCtx, dListCount * sizeof(*mtx)); - if (limbTable == NULL) - { + if (limbTable == NULL) { osSyncPrintf("\x1b[31m"); osSyncPrintf("Si2_draw2_SV():skelがNULLです。NULLを返します。\n"); osSyncPrintf("\x1b[m"); @@ -822,31 +733,24 @@ Gfx* SkelAnime_DrawSV2(GlobalContext* globalCtx, u32* limbTable, Vec3s* actorDra dList1 = dList2 = limbEntry->displayLists[0]; - if ((updateMtxFunc == NULL) || (updateMtxFunc(globalCtx, 1, &dList1, &pos, &rot, actor, &gfx) == 0)) - { + if ((updateMtxFunc == NULL) || (updateMtxFunc(globalCtx, 1, &dList1, &pos, &rot, actor, &gfx) == 0)) { Matrix_TranslateThenRotateZYX(&pos, &rot); - if (dList1 != NULL) - { + if (dList1 != NULL) { Matrix_ToMtx(mtx, "../z_skelanime.c", 0x6AE); gSPMatrix(gfx++, mtx, G_MTX_LOAD); gSPDisplayList(gfx++, dList1); mtx++; - } - else - { - if (dList2 != NULL) - { + } else { + if (dList2 != NULL) { Matrix_ToMtx(mtx, "../z_skelanime.c", 0x6B5); mtx++; } } } - if (appendDlistFunc != NULL) - { + if (appendDlistFunc != NULL) { appendDlistFunc(globalCtx, 1, &dList2, &rot, actor, &gfx); } - if (limbEntry->firstChildIndex != LIMB_DONE) - { + if (limbEntry->firstChildIndex != LIMB_DONE) { gfx = SkelAnime_DrawLimbSV2(globalCtx, limbEntry->firstChildIndex, limbTable, actorDrawTable, updateMtxFunc, appendDlistFunc, actor, &mtx, gfx); } @@ -859,22 +763,19 @@ Gfx* SkelAnime_DrawSV2(GlobalContext* globalCtx, u32* limbTable, Vec3s* actorDra // Seems to be some kind of rotations update, somewhat large. #pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A29BC.s") -s16 func_800A2DBC(u32 animationSeg) -{ +s16 func_800A2DBC(u32 animationSeg) { AnimationHeader* animation = SEGMENTED_TO_VIRTUAL(animationSeg); return animation->unk_02; } -s16 func_800A2DF4(u32 animationSeg) -{ +s16 func_800A2DF4(u32 animationSeg) { AnimationHeader* animation = SEGMENTED_TO_VIRTUAL(animationSeg); return animation->frameCount; } -s16 func_800A2E2C(u32 animationSeg) -{ +s16 func_800A2E2C(u32 animationSeg) { AnimationHeader* animation = SEGMENTED_TO_VIRTUAL(animationSeg); return (s16)(animation->frameCount - 1); @@ -883,31 +784,25 @@ s16 func_800A2E2C(u32 animationSeg) // Very large update function #pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A2E70.s") -void func_800A32EC(u16* arg0) -{ +void func_800A32EC(u16* arg0) { *arg0 = 0; } -void func_800A32F4(s32 arg0) -{ +void func_800A32F4(s32 arg0) { D_801600B0 *= 2; } -void func_800A3310(void* arg0) -{ +void func_800A3310(void* arg0) { u32* D_8012A480Ptr = &D_8012A480; *D_8012A480Ptr |= D_801600B0; } - -AnimationEntry* SkelAnime_NextEntry(AnimationContext* animationCtx, AnimationType type) -{ - AnimationEntry *entry; +AnimationEntry* SkelAnime_NextEntry(AnimationContext* animationCtx, AnimationType type) { + AnimationEntry* entry; s16 index = animationCtx->animationCount; - if (index >= 0x32) - { + if (index >= 0x32) { return NULL; } animationCtx->animationCount = index + 1; @@ -918,32 +813,28 @@ AnimationEntry* SkelAnime_NextEntry(AnimationContext* animationCtx, AnimationTyp /* * The next 6 functions are coordinate with the AnimationType enum -*/ + */ -void func_800A336C(GlobalContext* globalCtx, u32 linkAnimetionSeg, s32 frame, s32 limbCount, void* ram) -{ +void func_800A336C(GlobalContext* globalCtx, u32 linkAnimetionSeg, s32 frame, s32 limbCount, void* ram) { AnimationEntry* entry; - LinkAnimetionEntry *linkAnimetionEntry; + LinkAnimetionEntry* linkAnimetionEntry; char pad[4]; entry = SkelAnime_NextEntry(&globalCtx->animationCtx, ANIMATION_TYPE0); - if (entry != NULL) - { + if (entry != NULL) { linkAnimetionEntry = SEGMENTED_TO_VIRTUAL(linkAnimetionSeg); osCreateMesgQueue(&entry->types.type0.msgQueue, &entry->types.type0.msg, 1); - DmaMgr_SendRequest2(&entry->types.type0.req, ram, LINK_ANIMETION_OFFSET(linkAnimetionEntry->animationSegAddress, ((sizeof(Vec3s) * limbCount + 2) * frame)), - sizeof(Vec3s) * limbCount + 2, 0, &entry->types.type0.msgQueue, NULL, - "../z_skelanime.c" , 0x7D4); + DmaMgr_SendRequest2( + &entry->types.type0.req, ram, + LINK_ANIMETION_OFFSET(linkAnimetionEntry->animationSegAddress, ((sizeof(Vec3s) * limbCount + 2) * frame)), + sizeof(Vec3s) * limbCount + 2, 0, &entry->types.type0.msgQueue, NULL, "../z_skelanime.c", 0x7D4); } } -void func_800A3478(GlobalContext* globalCtx, s32 vecCount, - Vec3s* dst, Vec3s* src) -{ +void func_800A3478(GlobalContext* globalCtx, s32 vecCount, Vec3s* dst, Vec3s* src) { AnimationEntry* entry = SkelAnime_NextEntry(&globalCtx->animationCtx, ANIMATION_TYPE1); - if (entry != NULL) - { + if (entry != NULL) { entry->types.type1.unk_00 = D_801600B0; entry->types.type1.vecCount = vecCount; entry->types.type1.dst = dst; @@ -951,12 +842,9 @@ void func_800A3478(GlobalContext* globalCtx, s32 vecCount, } } -void func_800A34DC(GlobalContext* globalCtx, s32 arg1, - Vec3s* arg2, Vec3s* arg3, f32 arg4) -{ +void func_800A34DC(GlobalContext* globalCtx, s32 arg1, Vec3s* arg2, Vec3s* arg3, f32 arg4) { AnimationEntry* entry = SkelAnime_NextEntry(&globalCtx->animationCtx, ANIMATION_TYPE2); - if (entry != NULL) - { + if (entry != NULL) { entry->types.type2.unk_00 = D_801600B0; entry->types.type2.unk_01 = arg1; entry->types.type2.unk_04 = arg2; @@ -965,12 +853,9 @@ void func_800A34DC(GlobalContext* globalCtx, s32 arg1, } } -void func_800A3548(GlobalContext* globalCtx, s32 vecCount, - s32 dst, s32 src, s32 index) -{ +void func_800A3548(GlobalContext* globalCtx, s32 vecCount, s32 dst, s32 src, s32 index) { AnimationEntry* entry = SkelAnime_NextEntry(&globalCtx->animationCtx, ANIMATION_TYPE3); - if (entry != NULL) - { + if (entry != NULL) { entry->types.type3.unk_00 = D_801600B0; entry->types.type3.vecCount = vecCount; entry->types.type3.dst = dst; @@ -979,12 +864,9 @@ void func_800A3548(GlobalContext* globalCtx, s32 vecCount, } } -void func_800A35B4(GlobalContext* globalCtx, s32 vecCount, - Vec3s* dst, Vec3s* src, u8* index) -{ +void func_800A35B4(GlobalContext* globalCtx, s32 vecCount, Vec3s* dst, Vec3s* src, u8* index) { AnimationEntry* entry = SkelAnime_NextEntry(&globalCtx->animationCtx, ANIMATION_TYPE4); - if (entry != NULL) - { + if (entry != NULL) { entry->types.type4.unk_00 = D_801600B0; entry->types.type4.vecCount = vecCount; entry->types.type4.dst = dst; @@ -993,12 +875,9 @@ void func_800A35B4(GlobalContext* globalCtx, s32 vecCount, } } -void func_800A3620(GlobalContext* globalCtx, Actor* actor, - SkelAnime* skelAnime, f32 arg3) -{ - AnimationEntry* entry = SkelAnime_NextEntry(&globalCtx->animationCtx, ANIMATION_TYPE5); - if (entry != NULL) - { +void func_800A3620(GlobalContext* globalCtx, Actor* actor, SkelAnime* skelAnime, f32 arg3) { + AnimationEntry* entry = SkelAnime_NextEntry(&globalCtx->animationCtx, ANIMATION_TYPE5); + if (entry != NULL) { entry->types.type5.actor = actor; entry->types.type5.skelAnime = skelAnime; entry->types.type5.unk_08 = arg3; @@ -1007,83 +886,64 @@ void func_800A3620(GlobalContext* globalCtx, Actor* actor, /* The next functions are callbacks to loading animations */ -void func_800A3678(GlobalContext* globalCtx, AnimationEntryType0* entry) -{ +void func_800A3678(GlobalContext* globalCtx, AnimationEntryType0* entry) { osRecvMesg(&entry->msgQueue, NULL, OS_MESG_BLOCK); } -void func_800A36A4(GlobalContext* globalCtx, AnimationEntryType1* entry) -{ +void func_800A36A4(GlobalContext* globalCtx, AnimationEntryType1* entry) { s32 i; Vec3s* dst; Vec3s* src; AnimationEntryRaw* genericEntry = (AnimationEntryRaw*)entry; - if ((genericEntry->raw[0] & D_8012A480) != 0) - { + if ((genericEntry->raw[0] & D_8012A480) != 0) { return; } - for(dst = entry->dst, src = entry->src, i = 0; - i < genericEntry->raw[1]; - i++) - { + for (dst = entry->dst, src = entry->src, i = 0; i < genericEntry->raw[1]; i++) { *dst++ = *src++; } } -void func_800A3714(GlobalContext* globalCtx, AnimationEntryType2* entry) -{ - if ((entry->unk_00 & D_8012A480) == 0) - { +void func_800A3714(GlobalContext* globalCtx, AnimationEntryType2* entry) { + if ((entry->unk_00 & D_8012A480) == 0) { func_800A2E70(entry->unk_01, entry->unk_04, entry->unk_04, entry->unk_08, entry->unk_0C); } } -void func_800A3770(GlobalContext* globalCtx, AnimationEntryType3* entry) -{ +void func_800A3770(GlobalContext* globalCtx, AnimationEntryType3* entry) { s32 i; Vec3s* dst; Vec3s* src; u8* index; AnimationEntryRaw* rawEntry = (AnimationEntryRaw*)entry; - if ((rawEntry->raw[0] & D_8012A480) == 0) - { - for(dst = entry->dst, src = entry->src, index = entry->index, i = 0; - i < rawEntry->raw[1]; i++, dst++, src++) - { - if(*index++) - { + if ((rawEntry->raw[0] & D_8012A480) == 0) { + for (dst = entry->dst, src = entry->src, index = entry->index, i = 0; i < rawEntry->raw[1]; i++, dst++, src++) { + if (*index++) { *dst = *src; } } } } -void func_800A37F0(GlobalContext* globalCtx, AnimationEntryType4* entry) -{ +void func_800A37F0(GlobalContext* globalCtx, AnimationEntryType4* entry) { s32 i; Vec3s* dst; Vec3s* src; u8* index; AnimationEntryRaw* rawEntry = (AnimationEntryRaw*)entry; - if ((rawEntry->raw[0] & D_8012A480) == 0) - { - for(dst = entry->dst, src = entry->src, index = entry->index, i = 0; - i < rawEntry->raw[1]; i++, dst++, src++) - { - if(*index++ < 1U) - { + if ((rawEntry->raw[0] & D_8012A480) == 0) { + for (dst = entry->dst, src = entry->src, index = entry->index, i = 0; i < rawEntry->raw[1]; i++, dst++, src++) { + if (*index++ < 1U) { *dst = *src; } } } } -void func_800A3874(GlobalContext* globalCtx, AnimationEntryType5* entry) -{ +void func_800A3874(GlobalContext* globalCtx, AnimationEntryType5* entry) { char pad[4]; Actor* actor = entry->actor; Vec3f pos; @@ -1094,12 +954,10 @@ void func_800A3874(GlobalContext* globalCtx, AnimationEntryType5* entry) actor->posRot.pos.z += pos.z * actor->scale.z; } -void func_800A390C(GlobalContext* globalCtx, AnimationContext* animationCtx) -{ +void func_800A390C(GlobalContext* globalCtx, AnimationContext* animationCtx) { AnimationEntry* entry; - for(entry = animationCtx->entries; animationCtx->animationCount != 0; entry++, animationCtx->animationCount--) - { + for (entry = animationCtx->entries; animationCtx->animationCount != 0; entry++, animationCtx->animationCount--) { D_8012A484[entry->type](globalCtx, &entry->types); } @@ -1107,11 +965,10 @@ void func_800A390C(GlobalContext* globalCtx, AnimationContext* animationCtx) D_8012A480 = 0; } -void func_800A39AC(GlobalContext* globalCtx, SkelAnime *skelAnime, u32 limbHeaderSeg, u32* animation, - s32 flags, Vec3s* actorDrawTbl, Vec3s* arg6, s32 limbBufCount) -{ +void func_800A39AC(GlobalContext* globalCtx, SkelAnime* skelAnime, u32 limbHeaderSeg, u32* animation, s32 flags, + Vec3s* actorDrawTbl, Vec3s* arg6, s32 limbBufCount) { char pad[8]; - SkelAnimeLimbHeader *limbHeader; + SkelAnimeLimbHeader* limbHeader; size_t allocSize; s32 limbCount; s32 headerCount; @@ -1121,12 +978,10 @@ void func_800A39AC(GlobalContext* globalCtx, SkelAnime *skelAnime, u32 limbHeade skelAnime->unk_34 = flags; limbCount = (flags & 2) != 0 ? headerCount : 1; - if ((flags & 1) != 0) - { + if ((flags & 1) != 0) { limbCount += headerCount; } - if ((flags & 4) != 0) - { + if ((flags & 4) != 0) { limbCount += headerCount; } @@ -1136,20 +991,15 @@ void func_800A39AC(GlobalContext* globalCtx, SkelAnime *skelAnime, u32 limbHeade allocSize = limbCount * sizeof(Vec3s); skelAnime->limbIndex = SEGMENTED_TO_VIRTUAL(limbHeader->limbIndexSeg); - if ((flags & 8) != 0) - { + if ((flags & 8) != 0) { allocSize += 2; } - if (actorDrawTbl == NULL) - { + if (actorDrawTbl == NULL) { skelAnime->actorDrawTbl = ZeldaArena_MallocDebug(allocSize, "../z_skelanime.c", 2364); skelAnime->unk_24 = ZeldaArena_MallocDebug(allocSize, "../z_skelanime.c", 2365); - } - else - { - if (limbBufCount != limbCount) - { + } else { + if (limbBufCount != limbCount) { __assert("joint_buff_num == joint_num", "../z_skelanime.c", 2369); } @@ -1157,61 +1007,53 @@ void func_800A39AC(GlobalContext* globalCtx, SkelAnime *skelAnime, u32 limbHeade skelAnime->unk_24 = (Vec3s*)ALIGN16((u32)arg6); } - if ((skelAnime->actorDrawTbl == NULL) || (skelAnime->unk_24 == NULL)) - { + if ((skelAnime->actorDrawTbl == NULL) || (skelAnime->unk_24 == NULL)) { osSyncPrintf("\x1b[31m"); - osSyncPrintf("Skeleton_Info_Rom_SV_ct メモリアロケーションエラー\n"); //Skeleton_Info_Rom_SV_ct Memory allocation error + osSyncPrintf( + "Skeleton_Info_Rom_SV_ct メモリアロケーションエラー\n"); // Skeleton_Info_Rom_SV_ct Memory allocation error osSyncPrintf("\x1b[m"); } func_800A3F08(globalCtx, skelAnime, animation, 1.0f, 0.0f, 0.0f, 0, 0.0f); } -void func_800A3B8C(SkelAnime* skelAnime) -{ - if (skelAnime->unk_01 < 2) - { +void func_800A3B8C(SkelAnime* skelAnime) { + if (skelAnime->unk_01 < 2) { skelAnime->animUpdate = &func_800A3D70; - } - else - { + } else { skelAnime->animUpdate = &func_800A3E0C; } skelAnime->unk_28 = 0.0f; } -void func_800A3BC0(GlobalContext* globalCtx, SkelAnime* skelAnime) -{ +void func_800A3BC0(GlobalContext* globalCtx, SkelAnime* skelAnime) { skelAnime->animUpdate(globalCtx, skelAnime); } -s32 func_800A3BE4(GlobalContext* globalCtx, SkelAnime* skelAnime) -{ +s32 func_800A3BE4(GlobalContext* globalCtx, SkelAnime* skelAnime) { f32 prevUnk28 = skelAnime->unk_28; f32 updateRate = R_UPDATE_RATE * 0.5f; skelAnime->unk_28 -= skelAnime->unk_2C * updateRate; - if (skelAnime->unk_28 <= 0.0f) - { + if (skelAnime->unk_28 <= 0.0f) { func_800A3B8C(skelAnime); } - func_800A34DC(globalCtx, skelAnime->limbCount, skelAnime->actorDrawTbl, skelAnime->unk_24, 1.0f - (skelAnime->unk_28 / prevUnk28)); + func_800A34DC(globalCtx, skelAnime->limbCount, skelAnime->actorDrawTbl, skelAnime->unk_24, + 1.0f - (skelAnime->unk_28 / prevUnk28)); return 0; } -void func_800A3C9C(GlobalContext* globalCtx, SkelAnime* skelAnime) -{ +void func_800A3C9C(GlobalContext* globalCtx, SkelAnime* skelAnime) { f32 updateRate; - func_800A336C(globalCtx, skelAnime->animCurrent, skelAnime->animCurrentFrame, skelAnime->limbCount, skelAnime->actorDrawTbl); - if (skelAnime->unk_28 != 0) - { + func_800A336C(globalCtx, skelAnime->animCurrent, skelAnime->animCurrentFrame, skelAnime->limbCount, + skelAnime->actorDrawTbl); + if (skelAnime->unk_28 != 0) { updateRate = R_UPDATE_RATE * 0.5f; skelAnime->unk_28 -= skelAnime->unk_2C * updateRate; - if (skelAnime->unk_28 <= 0.0f) - { + if (skelAnime->unk_28 <= 0.0f) { skelAnime->unk_28 = 0.0f; return; } @@ -1219,18 +1061,14 @@ void func_800A3C9C(GlobalContext* globalCtx, SkelAnime* skelAnime) } } -s32 func_800A3D70(GlobalContext* globalCtx, SkelAnime* skelAnime) -{ +s32 func_800A3D70(GlobalContext* globalCtx, SkelAnime* skelAnime) { f32 updateRate = R_UPDATE_RATE * 0.5f; skelAnime->animCurrentFrame += skelAnime->animPlaybackSpeed * updateRate; - if (skelAnime->animCurrentFrame < 0.0f) - { + if (skelAnime->animCurrentFrame < 0.0f) { skelAnime->animCurrentFrame += skelAnime->unk_14; - } - else - { - if (skelAnime->unk_14 <= skelAnime->animCurrentFrame){ + } else { + if (skelAnime->unk_14 <= skelAnime->animCurrentFrame) { skelAnime->animCurrentFrame -= skelAnime->unk_14; } } @@ -1238,30 +1076,21 @@ s32 func_800A3D70(GlobalContext* globalCtx, SkelAnime* skelAnime) return 0; } -s32 func_800A3E0C(GlobalContext* globalCtx, SkelAnime* skelAnime) -{ +s32 func_800A3E0C(GlobalContext* globalCtx, SkelAnime* skelAnime) { f32 updateRate = R_UPDATE_RATE * 0.5f; - if (skelAnime->animCurrentFrame == skelAnime->animFrameCount) - { + if (skelAnime->animCurrentFrame == skelAnime->animFrameCount) { func_800A3C9C(globalCtx, skelAnime); return 1; } skelAnime->animCurrentFrame += skelAnime->animPlaybackSpeed * updateRate; - if (0.0f < ((skelAnime->animCurrentFrame - skelAnime->animFrameCount) * skelAnime->animPlaybackSpeed)) - { + if (0.0f < ((skelAnime->animCurrentFrame - skelAnime->animFrameCount) * skelAnime->animPlaybackSpeed)) { skelAnime->animCurrentFrame = skelAnime->animFrameCount; - } - else - { - if (skelAnime->animCurrentFrame < 0.0f) - { + } else { + if (skelAnime->animCurrentFrame < 0.0f) { skelAnime->animCurrentFrame += skelAnime->unk_14; - } - else - { - if (skelAnime->unk_14 <= skelAnime->animCurrentFrame) - { + } else { + if (skelAnime->unk_14 <= skelAnime->animCurrentFrame) { skelAnime->animCurrentFrame -= skelAnime->unk_14; } } @@ -1270,40 +1099,30 @@ s32 func_800A3E0C(GlobalContext* globalCtx, SkelAnime* skelAnime) return 0; } - -void func_800A3EE8(GlobalContext* globalCtx, SkelAnime* skelAnime, f32 arg2) -{ +void func_800A3EE8(GlobalContext* globalCtx, SkelAnime* skelAnime, f32 arg2) { skelAnime->unk_28 = 1.0f; skelAnime->unk_2C = 1.0f / arg2; } #ifdef NON_MATCHING -void func_800A3F08(GlobalContext* globalCtx, SkelAnime* skelAnime, u32* animation, f32 playbackSpeed, - f32 arg4, f32 frameCount, u8 arg6, f32 arg7) -{ +void func_800A3F08(GlobalContext* globalCtx, SkelAnime* skelAnime, u32* animation, f32 playbackSpeed, f32 arg4, + f32 frameCount, u8 arg6, f32 arg7) { skelAnime->unk_01 = arg6; - if ((arg7 != 0.0f) && - ((animation == skelAnime->animCurrent) || (arg4 != skelAnime->animCurrentFrame))) - { - if(arg7 < 0.0f) - { + if ((arg7 != 0.0f) && ((animation == skelAnime->animCurrent) || (arg4 != skelAnime->animCurrentFrame))) { + if (arg7 < 0.0f) { func_800A3B8C(skelAnime); SkelAnime_CopyVec3s(skelAnime, skelAnime->unk_24, skelAnime->actorDrawTbl); arg7 = -arg7; - } - else - { + } else { skelAnime->animUpdate = &func_800A3BE4; - func_800A336C(globalCtx, animation, (s32) arg4, skelAnime->limbCount, skelAnime->unk_24); + func_800A336C(globalCtx, animation, (s32)arg4, skelAnime->limbCount, skelAnime->unk_24); } skelAnime->unk_28 = 1.0f; skelAnime->unk_2C = 1.0f / arg7; - } - else - { + } else { func_800A3B8C(skelAnime); - func_800A336C(globalCtx, animation, (s32) arg4, skelAnime->limbCount, skelAnime->actorDrawTbl); + func_800A336C(globalCtx, animation, (s32)arg4, skelAnime->limbCount, skelAnime->actorDrawTbl); skelAnime->unk_28 = 0.0f; } @@ -1318,54 +1137,46 @@ void func_800A3F08(GlobalContext* globalCtx, SkelAnime* skelAnime, u32* animatio #pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A3F08.s") #endif -void func_800A407C(GlobalContext* globalCtx, SkelAnime* skelAnime, u32 animation) -{ - func_800A3F08(globalCtx, skelAnime, animation, 1.0f, 0.0f, (f32) SkelAnime_GetFrameCount(animation), 2, 0.0f); +void func_800A407C(GlobalContext* globalCtx, SkelAnime* skelAnime, u32 animation) { + func_800A3F08(globalCtx, skelAnime, animation, 1.0f, 0.0f, (f32)SkelAnime_GetFrameCount(animation), 2, 0.0f); } -void func_800A40DC(GlobalContext* globalCtx, SkelAnime* skelAnime, u32 animation, f32 playbackSpeed) -{ - func_800A3F08(globalCtx, skelAnime, animation, playbackSpeed, 0.0f, (f32) SkelAnime_GetFrameCount(animation), 2, 0.0f); +void func_800A40DC(GlobalContext* globalCtx, SkelAnime* skelAnime, u32 animation, f32 playbackSpeed) { + func_800A3F08(globalCtx, skelAnime, animation, playbackSpeed, 0.0f, (f32)SkelAnime_GetFrameCount(animation), 2, + 0.0f); } -void func_800A4140(GlobalContext* globalCtx, SkelAnime* skelAnime, u32 animation) -{ - func_800A3F08(globalCtx, skelAnime, animation, 1.0f, 0.0f, (f32) SkelAnime_GetFrameCount(animation), 0, 0.0f); +void func_800A4140(GlobalContext* globalCtx, SkelAnime* skelAnime, u32 animation) { + func_800A3F08(globalCtx, skelAnime, animation, 1.0f, 0.0f, (f32)SkelAnime_GetFrameCount(animation), 0, 0.0f); } -void func_800A419C(GlobalContext* globalCtx, SkelAnime* skelAnime, u32 animation, f32 playbackSpeed) -{ - func_800A3F08(globalCtx, skelAnime, animation, playbackSpeed, 0.0f, (f32)SkelAnime_GetFrameCount(animation), 0, 0.0f); +void func_800A419C(GlobalContext* globalCtx, SkelAnime* skelAnime, u32 animation, f32 playbackSpeed) { + func_800A3F08(globalCtx, skelAnime, animation, playbackSpeed, 0.0f, (f32)SkelAnime_GetFrameCount(animation), 0, + 0.0f); } -void func_800A41FC(GlobalContext* globalCtx, SkelAnime* skelAnime) -{ +void func_800A41FC(GlobalContext* globalCtx, SkelAnime* skelAnime) { func_800A3478(globalCtx, skelAnime->limbCount, skelAnime->unk_24, skelAnime->actorDrawTbl); } -void func_800A422C(GlobalContext* globalCtx, SkelAnime* skelAnime) -{ +void func_800A422C(GlobalContext* globalCtx, SkelAnime* skelAnime) { func_800A3478(globalCtx, skelAnime->limbCount, skelAnime->actorDrawTbl, skelAnime->unk_24); } -void func_800A425C(GlobalContext* globalCtx, SkelAnime* skelAnime, u32 animation, f32 frame) -{ +void func_800A425C(GlobalContext* globalCtx, SkelAnime* skelAnime, u32 animation, f32 frame) { func_800A336C(globalCtx, animation, (s32)frame, skelAnime->limbCount, skelAnime->unk_24); } -void func_800A42A0(GlobalContext* globalCtx, SkelAnime* skelAnime, u32 animation, f32 frame) -{ +void func_800A42A0(GlobalContext* globalCtx, SkelAnime* skelAnime, u32 animation, f32 frame) { func_800A336C(globalCtx, animation, (s32)frame, skelAnime->limbCount, skelAnime->actorDrawTbl); } -void func_800A42E4(GlobalContext* globalCtx, SkelAnime* skelAnime, f32 arg2) -{ +void func_800A42E4(GlobalContext* globalCtx, SkelAnime* skelAnime, f32 arg2) { func_800A34DC(globalCtx, skelAnime->limbCount, skelAnime->actorDrawTbl, skelAnime->unk_24, arg2); } -void func_800A431C(GlobalContext* globalCtx, SkelAnime* skelAnime, u32 animationSeg, - f32 frame, s32 arg4, f32 arg5, f32 arg6, s32 arg7) -{ +void func_800A431C(GlobalContext* globalCtx, SkelAnime* skelAnime, u32 animationSeg, f32 frame, s32 arg4, f32 arg5, + f32 arg6, s32 arg7) { s32 alignedAddr; func_800A336C(globalCtx, animationSeg, (s32)frame, skelAnime->limbCount, skelAnime->actorDrawTbl); @@ -1375,9 +1186,8 @@ void func_800A431C(GlobalContext* globalCtx, SkelAnime* skelAnime, u32 animation func_800A34DC(globalCtx, skelAnime->limbCount, skelAnime->actorDrawTbl, alignedAddr, arg6); } -void func_800A43B8(GlobalContext* globalCtx, SkelAnime *skelAnime, u32 animation, - f32 frame, s32 arg4, f32 arg5, f32 arg6, s32 arg7) -{ +void func_800A43B8(GlobalContext* globalCtx, SkelAnime* skelAnime, u32 animation, f32 frame, s32 arg4, f32 arg5, + f32 arg6, s32 arg7) { s32 alignedAddr; func_800A336C(globalCtx, animation, (s32)frame, skelAnime->limbCount, skelAnime->unk_24); @@ -1388,177 +1198,149 @@ void func_800A43B8(GlobalContext* globalCtx, SkelAnime *skelAnime, u32 animation func_800A34DC(globalCtx, skelAnime->limbCount, skelAnime->unk_24, alignedAddr, arg6); } -void func_800A4454(SkelAnime* skelAnime) -{ +void func_800A4454(SkelAnime* skelAnime) { skelAnime->unk_01 = 2; func_800A3B8C(skelAnime); } -s32 func_800A4478(SkelAnime* skelAnime, f32 arg1, f32 updateRate) -{ +s32 func_800A4478(SkelAnime* skelAnime, f32 arg1, f32 updateRate) { f32 updateSpeed; f32 temp_f12; f32 nextFrame; updateSpeed = skelAnime->animPlaybackSpeed * updateRate; nextFrame = skelAnime->animCurrentFrame - updateSpeed; - if (nextFrame < 0.0f) - { + if (nextFrame < 0.0f) { nextFrame += skelAnime->unk_14; - } - else - { - if (skelAnime->unk_14 <= nextFrame) - { + } else { + if (skelAnime->unk_14 <= nextFrame) { nextFrame -= skelAnime->unk_14; } } - if (arg1 == 0.0f) - { - if (0.0f < updateSpeed) - { + if (arg1 == 0.0f) { + if (0.0f < updateSpeed) { arg1 = skelAnime->unk_14; } } temp_f12 = (nextFrame + updateSpeed) - arg1; - if (0.0f <= (temp_f12 * updateSpeed)) - { - if (((temp_f12 - updateSpeed) * updateSpeed) < 0.0f) - { + if (0.0f <= (temp_f12 * updateSpeed)) { + if (((temp_f12 - updateSpeed) * updateSpeed) < 0.0f) { return 1; } } return 0; } -s32 func_800A4530(SkelAnime* skelAnime, f32 arg1) -{ +s32 func_800A4530(SkelAnime* skelAnime, f32 arg1) { f32 updateRate = R_UPDATE_RATE * 0.5f; return func_800A4478(skelAnime, arg1, updateRate); } -void SkelAnime_Init(GlobalContext* globalCtx, SkelAnime* skelAnime, u32 limbHeaderSeg, - u32 animation, Vec3s* actorDrawTable, s32 arg5, s32 limbCount) -{ +void SkelAnime_Init(GlobalContext* globalCtx, SkelAnime* skelAnime, u32 limbHeaderSeg, u32 animation, + Vec3s* actorDrawTable, s32 arg5, s32 limbCount) { SkelAnimeLimbHeader* limbHeader; limbHeader = SEGMENTED_TO_VIRTUAL(limbHeaderSeg); skelAnime->limbCount = limbHeader->limbCount + 1; skelAnime->limbIndex = SEGMENTED_TO_VIRTUAL(limbHeader->limbIndexSeg); - if (actorDrawTable == NULL) - { - skelAnime->actorDrawTbl = ZeldaArena_MallocDebug(skelAnime->limbCount * sizeof(*skelAnime->actorDrawTbl), "../z_skelanime.c", 2968); - skelAnime->unk_24 = ZeldaArena_MallocDebug(skelAnime->limbCount * sizeof(*skelAnime->unk_24), "../z_skelanime.c", 2969); - } - else - { - if (limbCount != skelAnime->limbCount) - { + if (actorDrawTable == NULL) { + skelAnime->actorDrawTbl = + ZeldaArena_MallocDebug(skelAnime->limbCount * sizeof(*skelAnime->actorDrawTbl), "../z_skelanime.c", 2968); + skelAnime->unk_24 = + ZeldaArena_MallocDebug(skelAnime->limbCount * sizeof(*skelAnime->unk_24), "../z_skelanime.c", 2969); + } else { + if (limbCount != skelAnime->limbCount) { __assert("joint_buff_num == this->joint_num", "../z_skelanime.c", 2973); } skelAnime->actorDrawTbl = actorDrawTable; skelAnime->unk_24 = arg5; } - if ((skelAnime->actorDrawTbl == NULL) || (skelAnime->unk_24 == NULL)) - { + if ((skelAnime->actorDrawTbl == NULL) || (skelAnime->unk_24 == NULL)) { osSyncPrintf("\x1b[31m"); osSyncPrintf("Skeleton_Info2_ct メモリアロケーションエラー\n"); // Skeleton_Info2_ct memory allocation error osSyncPrintf("\x1b[m"); } - if (animation != 0) - { + if (animation != 0) { SkelAnime_ChangeAnimationDefault(skelAnime, animation); } } -void SkelAnime_InitSV(GlobalContext* globalCtx, SkelAnime* skelAnime, u32 limbHeaderSeg, - u32 animation, Vec3s* actorDrawTable, s32 arg5, s32 limbCount) -{ - SkelAnimeLimbHeader *limbHeader; +void SkelAnime_InitSV(GlobalContext* globalCtx, SkelAnime* skelAnime, u32 limbHeaderSeg, u32 animation, + Vec3s* actorDrawTable, s32 arg5, s32 limbCount) { + SkelAnimeLimbHeader* limbHeader; limbHeader = SEGMENTED_TO_VIRTUAL(limbHeaderSeg); skelAnime->limbCount = limbHeader->limbCount + 1; skelAnime->dListCount = limbHeader->dListCount; skelAnime->limbIndex = SEGMENTED_TO_VIRTUAL(limbHeader->limbIndexSeg); - if (actorDrawTable == NULL) - { - skelAnime->actorDrawTbl = ZeldaArena_MallocDebug(skelAnime->limbCount * sizeof(*skelAnime->actorDrawTbl), - "../z_skelanime.c", 3047); + if (actorDrawTable == NULL) { + skelAnime->actorDrawTbl = + ZeldaArena_MallocDebug(skelAnime->limbCount * sizeof(*skelAnime->actorDrawTbl), "../z_skelanime.c", 3047); - skelAnime->unk_24 = ZeldaArena_MallocDebug(skelAnime->limbCount * sizeof(*skelAnime->unk_24), - "../z_skelanime.c", 3048); - } - else - { - if (limbCount != skelAnime->limbCount) - { + skelAnime->unk_24 = + ZeldaArena_MallocDebug(skelAnime->limbCount * sizeof(*skelAnime->unk_24), "../z_skelanime.c", 3048); + } else { + if (limbCount != skelAnime->limbCount) { __assert("joint_buff_num == this->joint_num", "../z_skelanime.c", 0xBEC); } skelAnime->actorDrawTbl = actorDrawTable; skelAnime->unk_24 = arg5; } - if ((skelAnime->actorDrawTbl == NULL) || (skelAnime->unk_24 == NULL)) - { + if ((skelAnime->actorDrawTbl == NULL) || (skelAnime->unk_24 == NULL)) { osSyncPrintf("\x1b[31m"); - osSyncPrintf("Skeleton_Info_Rom_SV_ct メモリアロケーションエラー\n"); // Skeleton_Info_Rom_SV_ct Memory allocation error + osSyncPrintf( + "Skeleton_Info_Rom_SV_ct メモリアロケーションエラー\n"); // Skeleton_Info_Rom_SV_ct Memory allocation error osSyncPrintf("\x1b[m"); } - if (animation != 0) - { + if (animation != 0) { SkelAnime_ChangeAnimationDefault(skelAnime, animation); } } -void SkelAnime_InitSkin(GlobalContext* globalCtx, SkelAnime *skelAnime, - u32 limbHeaderSeg, u32 animation) -{ - SkelAnimeLimbHeader *limbHeader; +void SkelAnime_InitSkin(GlobalContext* globalCtx, SkelAnime* skelAnime, u32 limbHeaderSeg, u32 animation) { + SkelAnimeLimbHeader* limbHeader; limbHeader = SEGMENTED_TO_VIRTUAL(limbHeaderSeg); skelAnime->limbCount = limbHeader->limbCount + 1; skelAnime->limbIndex = SEGMENTED_TO_VIRTUAL(limbHeader->limbIndexSeg); - skelAnime->actorDrawTbl = ZeldaArena_MallocDebug(skelAnime->limbCount * sizeof(*skelAnime->actorDrawTbl), "../z_skelanime.c", 3120); - skelAnime->unk_24 = ZeldaArena_MallocDebug(skelAnime->limbCount * sizeof(*skelAnime->unk_24), "../z_skelanime.c", 3121); - if ((skelAnime->actorDrawTbl == NULL) || (skelAnime->unk_24 == NULL)) - { + skelAnime->actorDrawTbl = + ZeldaArena_MallocDebug(skelAnime->limbCount * sizeof(*skelAnime->actorDrawTbl), "../z_skelanime.c", 3120); + skelAnime->unk_24 = + ZeldaArena_MallocDebug(skelAnime->limbCount * sizeof(*skelAnime->unk_24), "../z_skelanime.c", 3121); + if ((skelAnime->actorDrawTbl == NULL) || (skelAnime->unk_24 == NULL)) { osSyncPrintf("\x1b[31m"); - osSyncPrintf("Skeleton_Info2_skin2_ct メモリアロケーションエラー\n"); //Skeleton_Info2_skin2_ct Memory allocation error + osSyncPrintf( + "Skeleton_Info2_skin2_ct メモリアロケーションエラー\n"); // Skeleton_Info2_skin2_ct Memory allocation error osSyncPrintf("\x1b[m"); } - if (animation != 0) - { + if (animation != 0) { SkelAnime_ChangeAnimationDefault(skelAnime, animation); } } -void func_800A49B0(SkelAnime* skelAnime) -{ - if (skelAnime->unk_01 < 2) - { +void func_800A49B0(SkelAnime* skelAnime) { + if (skelAnime->unk_01 < 2) { skelAnime->animUpdate = &func_800A4D9C; return; } - if (skelAnime->unk_01 < 4) - { + if (skelAnime->unk_01 < 4) { skelAnime->animUpdate = &func_800A4EE0; return; } skelAnime->animUpdate = &func_800A4E38; } - -s32 SkelAnime_FrameUpdateMatrix(SkelAnime* skelAnime){ +s32 SkelAnime_FrameUpdateMatrix(SkelAnime* skelAnime) { return skelAnime->animUpdate(skelAnime); } #ifdef NON_MATCHING -s32 func_800A4A20(SkelAnime* skelAnime) -{ +s32 func_800A4A20(SkelAnime* skelAnime) { f32 sp2C; f32 temp_f12; f32 phi_f0; @@ -1566,14 +1348,14 @@ s32 func_800A4A20(SkelAnime* skelAnime) temp_f12 = skelAnime->unk_28; skelAnime->unk_28 -= skelAnime->unk_2C * (R_UPDATE_RATE * 0.33333334f); phi_f0 = skelAnime->unk_28; - if (skelAnime->unk_28 <= 0.0f) - { + if (skelAnime->unk_28 <= 0.0f) { sp2C = temp_f12; func_800A49B0(skelAnime); skelAnime->unk_28 = 0.0f; phi_f0 = skelAnime->unk_28; } - func_800A2E70(skelAnime->limbCount, skelAnime->actorDrawTbl, skelAnime->actorDrawTbl, skelAnime->unk_24, 1.0f - (phi_f0 / temp_f12)); + func_800A2E70(skelAnime->limbCount, skelAnime->actorDrawTbl, skelAnime->actorDrawTbl, skelAnime->unk_24, + 1.0f - (phi_f0 / temp_f12)); return 0; } #else @@ -1581,8 +1363,7 @@ s32 func_800A4A20(SkelAnime* skelAnime) #endif #ifdef NON_MATCHING -s32 func_800A4AD8(SkelAnime* skelAnime) -{ +s32 func_800A4AD8(SkelAnime* skelAnime) { f32 sp28; s16 temp_a1; s16 temp_a2; @@ -1590,31 +1371,25 @@ s32 func_800A4AD8(SkelAnime* skelAnime) temp_a2 = (s16)(skelAnime->unk_28 * 16384.0f); skelAnime->unk_28 -= skelAnime->unk_2C * (R_UPDATE_RATE * 0.33333334f); - if (skelAnime->unk_28 <= 0.0f) - { + if (skelAnime->unk_28 <= 0.0f) { func_800A49B0(skelAnime); skelAnime->unk_28 = 0.0f; } temp_a1 = (s16)(skelAnime->unk_28 * 16384.0f); - if (skelAnime->unk_03 < 0) - { + if (skelAnime->unk_03 < 0) { sp28 = 1.0f - Math_Coss(temp_a2); phi_f2 = 1.0f - Math_Coss(temp_a1); - } - else - { + } else { sp28 = Math_Sins(temp_a2); phi_f2 = Math_Sins(temp_a1); } - if (phi_f2 != 0.0f) - { + if (phi_f2 != 0.0f) { phi_f2 /= sp28; - } - else - { + } else { phi_f2 = 0.0f; } - func_800A2E70(skelAnime->limbCount, skelAnime->actorDrawTbl, skelAnime->actorDrawTbl, skelAnime->unk_24, 1.0f - phi_f2); + func_800A2E70(skelAnime->limbCount, skelAnime->actorDrawTbl, skelAnime->actorDrawTbl, skelAnime->unk_24, + 1.0f - phi_f2); return 0; } #else @@ -1622,8 +1397,7 @@ s32 func_800A4AD8(SkelAnime* skelAnime) #endif #ifdef NON_MATCHING -void func_800A4C58(SkelAnime* skelAnime) -{ +void func_800A4C58(SkelAnime* skelAnime) { char pad[6]; f32 temp_f0; f32 temp_f10; @@ -1631,30 +1405,28 @@ void func_800A4C58(SkelAnime* skelAnime) s32 temp_f8; f32 temp_f2; - SkelAnime_AnimateFrame(skelAnime->animCurrent, (s32) skelAnime->animCurrentFrame, skelAnime->limbCount, skelAnime->actorDrawTbl); - if ((skelAnime->unk_01 & 1) != 0) - { - temp_f8 = (s32) skelAnime->animCurrentFrame; + SkelAnime_AnimateFrame(skelAnime->animCurrent, (s32)skelAnime->animCurrentFrame, skelAnime->limbCount, + skelAnime->actorDrawTbl); + if ((skelAnime->unk_01 & 1) != 0) { + temp_f8 = (s32)skelAnime->animCurrentFrame; temp_f10 = temp_f8; temp_f8++; temp_f2 = skelAnime->animCurrentFrame - temp_f10; - if (temp_f8 >= (s32) skelAnime->unk_14) - { + if (temp_f8 >= (s32)skelAnime->unk_14) { temp_f8 = 0; } SkelAnime_AnimateFrame(skelAnime->animCurrent, temp_f8, skelAnime->limbCount, sp38); func_800A2E70(skelAnime->limbCount, skelAnime->actorDrawTbl, skelAnime->actorDrawTbl, sp38, temp_f2); } - if (skelAnime->unk_28 != 0) - { + if (skelAnime->unk_28 != 0) { skelAnime->unk_28 -= skelAnime->unk_2C * (R_UPDATE_RATE * 0.33333334f); temp_f0 = skelAnime->unk_28; - if (temp_f0 <= 0.0f) - { + if (temp_f0 <= 0.0f) { skelAnime->unk_28 = 0.0f; return; } - func_800A2E70(skelAnime->limbCount, skelAnime->actorDrawTbl, skelAnime->actorDrawTbl, skelAnime->unk_24, skelAnime->unk_28); + func_800A2E70(skelAnime->limbCount, skelAnime->actorDrawTbl, skelAnime->actorDrawTbl, skelAnime->unk_24, + skelAnime->unk_28); } } #else @@ -1663,15 +1435,11 @@ void func_800A4C58(SkelAnime* skelAnime) #undef NON_MATCHING #ifdef NON_MATCHING -s32 func_800A4D9C(SkelAnime* skelAnime) -{ +s32 func_800A4D9C(SkelAnime* skelAnime) { skelAnime->animCurrentFrame += (R_UPDATE_RATE * 0.33333334f) + skelAnime->animPlaybackSpeed; - if (skelAnime->animCurrentFrame < 0.0f) - { + if (skelAnime->animCurrentFrame < 0.0f) { skelAnime->animCurrentFrame += skelAnime->unk_14; - } - else if (skelAnime->unk_14 <= skelAnime->animCurrentFrame) - { + } else if (skelAnime->unk_14 <= skelAnime->animCurrentFrame) { skelAnime->animCurrentFrame -= skelAnime->unk_14; } func_800A4C58(skelAnime); @@ -1683,17 +1451,12 @@ s32 func_800A4D9C(SkelAnime* skelAnime) #undef NON_MATCHING #ifdef NON_MATCHING -s32 func_800A4E38(SkelAnime* skelAnime) -{ +s32 func_800A4E38(SkelAnime* skelAnime) { skelAnime->animCurrentFrame += skelAnime->animPlaybackSpeed * (R_UPDATE_RATE * 0.33333334f); - if (skelAnime->animCurrentFrame < skelAnime->unk_0C) - { + if (skelAnime->animCurrentFrame < skelAnime->unk_0C) { skelAnime->animCurrentFrame = (skelAnime->animCurrentFrame - skelAnime->unk_0C) + skelAnime->animFrameCount; - } - else - { - if (skelAnime->animFrameCount <= skelAnime->animCurrentFrame) - { + } else { + if (skelAnime->animFrameCount <= skelAnime->animCurrentFrame) { skelAnime->animCurrentFrame = (skelAnime->animCurrentFrame - skelAnime->animFrameCount) + skelAnime->unk_0C; } } @@ -1705,33 +1468,25 @@ s32 func_800A4E38(SkelAnime* skelAnime) #endif #undef NON_MATCHING -s32 func_800A4EE0(SkelAnime *skelAnime) -{ +s32 func_800A4EE0(SkelAnime* skelAnime) { f32 temp_f14; - temp_f14 = (f32) R_UPDATE_RATE * 0.33333334f; - if (skelAnime->animCurrentFrame == skelAnime->animFrameCount) - { + temp_f14 = (f32)R_UPDATE_RATE * 0.33333334f; + if (skelAnime->animCurrentFrame == skelAnime->animFrameCount) { - SkelAnime_AnimateFrame(skelAnime->animCurrent, (s32)skelAnime->animCurrentFrame, skelAnime->limbCount, skelAnime->actorDrawTbl); + SkelAnime_AnimateFrame(skelAnime->animCurrent, (s32)skelAnime->animCurrentFrame, skelAnime->limbCount, + skelAnime->actorDrawTbl); func_800A4C58(skelAnime); return 1; } skelAnime->animCurrentFrame += skelAnime->animPlaybackSpeed * temp_f14; - if (0.0f < ((skelAnime->animCurrentFrame - skelAnime->animFrameCount) * skelAnime->animPlaybackSpeed)) - { + if (0.0f < ((skelAnime->animCurrentFrame - skelAnime->animFrameCount) * skelAnime->animPlaybackSpeed)) { skelAnime->animCurrentFrame = skelAnime->animFrameCount; - } - else - { - if (skelAnime->animCurrentFrame < 0.0f) - { + } else { + if (skelAnime->animCurrentFrame < 0.0f) { skelAnime->animCurrentFrame += skelAnime->unk_14; - } - else - { - if (skelAnime->unk_14 <= skelAnime->animCurrentFrame) - { + } else { + if (skelAnime->unk_14 <= skelAnime->animCurrentFrame) { skelAnime->animCurrentFrame -= skelAnime->unk_14; } } @@ -1741,37 +1496,26 @@ s32 func_800A4EE0(SkelAnime *skelAnime) } #ifdef NON_MATCHING -void SkelAnime_ChangeAnimationImpl(SkelAnime* skelAnime, u32 animation, f32 playbackSpeed, - f32 unk0, f32 frameCount, u8 unk1, f32 transitionRate, s8 unk2) -{ +void SkelAnime_ChangeAnimationImpl(SkelAnime* skelAnime, u32 animation, f32 playbackSpeed, f32 unk0, f32 frameCount, + u8 unk1, f32 transitionRate, s8 unk2) { skelAnime->unk_01 = unk1; - if ((transitionRate != 0.0f) && - ((animation != skelAnime->animCurrent) || (unk0 != skelAnime->animCurrentFrame))) - { - if (transitionRate < 0.0f) - { + if ((transitionRate != 0.0f) && ((animation != skelAnime->animCurrent) || (unk0 != skelAnime->animCurrentFrame))) { + if (transitionRate < 0.0f) { func_800A49B0(skelAnime); SkelAnime_CopyVec3s(skelAnime, skelAnime->unk_24, skelAnime->actorDrawTbl); transitionRate = -transitionRate; - } - else - { - if (unk2 != 0) - { + } else { + if (unk2 != 0) { skelAnime->mtxUpdate = (void*)&func_800A4AD8; skelAnime->unk_03 = unk2; - } - else - { + } else { skelAnime->mtxUpdate = (void*)&func_800A4A20; } SkelAnime_AnimateFrame(animation, (s32)unk0, skelAnime->limbCount, skelAnime->actorDrawTbl); } skelAnime->unk_28 = 1.0f; skelAnime->unk_2C = 1.0f / transitionRate; - } - else - { + } else { func_800A49B0(skelAnime); SkelAnime_AnimateFrame(animation, (s32)unk0, skelAnime->limbCount, skelAnime->actorDrawTbl); skelAnime->unk_28 = 0.0f; @@ -1780,16 +1524,12 @@ void SkelAnime_ChangeAnimationImpl(SkelAnime* skelAnime, u32 animation, f32 play skelAnime->animCurrent = animation; skelAnime->unk_0C = unk0; skelAnime->animFrameCount = frameCount; - skelAnime->unk_14 = (f32) func_800A1FC8(animation); - if (skelAnime->unk_01 >= 4) - { + skelAnime->unk_14 = (f32)func_800A1FC8(animation); + if (skelAnime->unk_01 >= 4) { skelAnime->animCurrentFrame = 0.0f; - } - else - { + } else { skelAnime->animCurrentFrame = unk0; - if (skelAnime->unk_01 < 2) - { + if (skelAnime->unk_01 < 2) { skelAnime->animFrameCount = skelAnime->unk_14 - 1.0f; } } @@ -1800,46 +1540,39 @@ void SkelAnime_ChangeAnimationImpl(SkelAnime* skelAnime, u32 animation, f32 play #endif #undef NON_MATCHING -void SkelAnime_ChangeAnimation(SkelAnime* skelAnime, u32 animation, f32 playbackSpeed, - f32 unk0, f32 frameCount, u8 unk1, f32 transitionRate) -{ +void SkelAnime_ChangeAnimation(SkelAnime* skelAnime, u32 animation, f32 playbackSpeed, f32 unk0, f32 frameCount, + u8 unk1, f32 transitionRate) { SkelAnime_ChangeAnimationImpl(skelAnime, animation, playbackSpeed, unk0, frameCount, unk1, transitionRate, 0); } -void func_800A51E8(SkelAnime* skelAnime, u32 animation) -{ +void func_800A51E8(SkelAnime* skelAnime, u32 animation) { SkelAnime_ChangeAnimation(skelAnime, animation, 1.0f, 0.0f, (f32)SkelAnime_GetFrameCount(animation), 2, 0.0f); } -void func_800A5240(SkelAnime* skelAnime, u32 animation, f32 transitionRate) -{ - SkelAnime_ChangeAnimation(skelAnime, animation, 1.0f, 0, - (f32)SkelAnime_GetFrameCount(animation), 2, transitionRate); +void func_800A5240(SkelAnime* skelAnime, u32 animation, f32 transitionRate) { + SkelAnime_ChangeAnimation(skelAnime, animation, 1.0f, 0, (f32)SkelAnime_GetFrameCount(animation), 2, + transitionRate); } -void func_800A529C(SkelAnime* skelAnime, u32 animation, f32 playbackSpeed) -{ - SkelAnime_ChangeAnimation(skelAnime, animation, playbackSpeed, 0.0f, - (f32)SkelAnime_GetFrameCount(animation), 2, 0.0f); +void func_800A529C(SkelAnime* skelAnime, u32 animation, f32 playbackSpeed) { + SkelAnime_ChangeAnimation(skelAnime, animation, playbackSpeed, 0.0f, (f32)SkelAnime_GetFrameCount(animation), 2, + 0.0f); } -void SkelAnime_ChangeAnimationDefault(SkelAnime* skelAnime, u32 animation) -{ - SkelAnime_ChangeAnimation(skelAnime, animation, 1.0f, 0.0f, (f32) SkelAnime_GetFrameCount(animation), 0, 0.0f); +void SkelAnime_ChangeAnimationDefault(SkelAnime* skelAnime, u32 animation) { + SkelAnime_ChangeAnimation(skelAnime, animation, 1.0f, 0.0f, (f32)SkelAnime_GetFrameCount(animation), 0, 0.0f); } -void SkelAnime_ChangeAnimationTransitionRate(SkelAnime* skelAnime, u32 animation, f32 transitionRate) -{ +void SkelAnime_ChangeAnimationTransitionRate(SkelAnime* skelAnime, u32 animation, f32 transitionRate) { SkelAnime_ChangeAnimation(skelAnime, animation, 1.0f, 0.0f, 0.0f, 0, transitionRate); } -void SkelAnime_ChangeAnimationPlaybackSpeed(SkelAnime* skelAnime, u32 animation, f32 playbackSpeed) -{ - SkelAnime_ChangeAnimation(skelAnime, animation, playbackSpeed, 0.0f, (f32) SkelAnime_GetFrameCount(animation), 0, 0.0f); +void SkelAnime_ChangeAnimationPlaybackSpeed(SkelAnime* skelAnime, u32 animation, f32 playbackSpeed) { + SkelAnime_ChangeAnimation(skelAnime, animation, playbackSpeed, 0.0f, (f32)SkelAnime_GetFrameCount(animation), 0, + 0.0f); } -void func_800A53DC(SkelAnime* skelAnime) -{ +void func_800A53DC(SkelAnime* skelAnime) { skelAnime->unk_01 = 2; skelAnime->animFrameCount = skelAnime->unk_14; func_800A49B0(skelAnime); @@ -1847,8 +1580,7 @@ void func_800A53DC(SkelAnime* skelAnime) #ifdef NON_MATCHING // regalloc -void func_800A5408(SkelAnime* skelAnime) -{ +void func_800A5408(SkelAnime* skelAnime) { f32 animPlaybackSpeed = skelAnime->animPlaybackSpeed; f32 unk_C = skelAnime->unk_0C; f32 frameCount = skelAnime->animFrameCount; @@ -1861,43 +1593,34 @@ void func_800A5408(SkelAnime* skelAnime) #pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A5408.s") #endif -void func_800A5428(SkelAnime* skelAnime, Vec3s* dst, Vec3s* src, u8* index) -{ +void func_800A5428(SkelAnime* skelAnime, Vec3s* dst, Vec3s* src, u8* index) { s32 i; - for(i = 0; i < skelAnime->limbCount; i++, dst++, src++) - { - if(*index++) - { + for (i = 0; i < skelAnime->limbCount; i++, dst++, src++) { + if (*index++) { *dst = *src; } } } -void func_800A5490(SkelAnime* skelAnime, Vec3s* dst, Vec3s* src, u8* arg3) -{ +void func_800A5490(SkelAnime* skelAnime, Vec3s* dst, Vec3s* src, u8* arg3) { s32 i; - for(i = 0;i < skelAnime->limbCount; i++, dst++, src++) - { - if(*arg3++ < 1U){ + for (i = 0; i < skelAnime->limbCount; i++, dst++, src++) { + if (*arg3++ < 1U) { *dst = *src; } } } -void func_800A54FC(SkelAnime* skelAnime, Vec3f* pos, s16 angle) -{ +void func_800A54FC(SkelAnime* skelAnime, Vec3f* pos, s16 angle) { f32 x; f32 z; f32 sin; f32 cos; - if((skelAnime->unk_35 & 0x10) != 0) - { + if ((skelAnime->unk_35 & 0x10) != 0) { pos->z = 0.0f; pos->x = 0.0f; - } - else - { + } else { x = (f32)skelAnime->actorDrawTbl->x; z = (f32)skelAnime->actorDrawTbl->z; sin = Math_Sins(angle); @@ -1917,55 +1640,41 @@ void func_800A54FC(SkelAnime* skelAnime, Vec3f* pos, s16 angle) skelAnime->actorDrawTbl->x = skelAnime->unk_3E; skelAnime->unk_3C = skelAnime->actorDrawTbl->z; skelAnime->actorDrawTbl->z = skelAnime->unk_42; - if((skelAnime->unk_35 & 2) != 0) - { - if((skelAnime->unk_35 & 0x10) != 0) - { + if ((skelAnime->unk_35 & 2) != 0) { + if ((skelAnime->unk_35 & 0x10) != 0) { pos->y = 0.0f; - } - else - { + } else { pos->y = (f32)(skelAnime->actorDrawTbl->y - skelAnime->unk_3A); } skelAnime->unk_3A = skelAnime->actorDrawTbl->y; skelAnime->actorDrawTbl->y = skelAnime->unk_40; - } - else - { + } else { pos->y = 0.0f; skelAnime->unk_3A = skelAnime->actorDrawTbl->y; } skelAnime->unk_35 &= ~0x10; } -s32 func_800A56C8(SkelAnime *skelAnime, f32 arg1) -{ +s32 func_800A56C8(SkelAnime* skelAnime, f32 arg1) { return func_800A4478(skelAnime, arg1, 1.0f); } -void SkelAnime_Free(SkelAnime *skelAnime, GlobalContext* globalCtx) -{ - if (skelAnime->actorDrawTbl != NULL) - { +void SkelAnime_Free(SkelAnime* skelAnime, GlobalContext* globalCtx) { + if (skelAnime->actorDrawTbl != NULL) { ZeldaArena_FreeDebug(skelAnime->actorDrawTbl, "../z_skelanime.c", 3729); - } - else - { + } else { osSyncPrintf("now_joint あきまへん!!\n"); // now_joint Akimane! ! } - if (skelAnime->unk_24 != NULL) - { + if (skelAnime->unk_24 != NULL) { ZeldaArena_FreeDebug(skelAnime->unk_24, "../z_skelanime.c", 3731); return; } osSyncPrintf("morf_joint あきまへん!!\n"); // "morf_joint Akimane !!" } -void SkelAnime_CopyVec3s(SkelAnime* skelAnime, Vec3s* dst, Vec3s* src) -{ +void SkelAnime_CopyVec3s(SkelAnime* skelAnime, Vec3s* dst, Vec3s* src) { s32 i; - for(i = 0; i < skelAnime->limbCount; i++) - { + for (i = 0; i < skelAnime->limbCount; i++) { *dst++ = *src++; } } diff --git a/src/overlays/actors/ovl_Demo_Go/z_demo_go.c b/src/overlays/actors/ovl_Demo_Go/z_demo_go.c index f4cd5301e0..318d74e3c7 100644 --- a/src/overlays/actors/ovl_Demo_Go/z_demo_go.c +++ b/src/overlays/actors/ovl_Demo_Go/z_demo_go.c @@ -344,7 +344,7 @@ void func_8097D29C(DemoGo* this, GlobalContext* globalCtx) { gSPSegment(gfxCtx->polyOpa.p++, 0x09, SEGMENTED_TO_VIRTUAL(srcSegment9)); SkelAnime_DrawSV(globalCtx, skelAnime->limbIndex, skelAnime->actorDrawTbl, skelAnime->dListCount, NULL, NULL, - &this->actor); + &this->actor); func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_demo_go.c", 746); } diff --git a/src/overlays/actors/ovl_En_Dog/z_en_dog.c b/src/overlays/actors/ovl_En_Dog/z_en_dog.c index 8c818f41c6..d3839913f2 100644 --- a/src/overlays/actors/ovl_En_Dog/z_en_dog.c +++ b/src/overlays/actors/ovl_En_Dog/z_en_dog.c @@ -480,6 +480,6 @@ static void EnDog_Draw(EnDog* this, GlobalContext* globalCtx) { colors[this->actor.params & 0xF].b, colors[this->actor.params & 0xF].a); SkelAnime_DrawSV(globalCtx, this->skelAnime.limbIndex, this->skelAnime.actorDrawTbl, this->skelAnime.dListCount, - EnDog_Callback1, EnDog_Callback2, &this->actor); + EnDog_Callback1, EnDog_Callback2, &this->actor); func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_en_dog.c", 994); } diff --git a/src/overlays/actors/ovl_En_Ms/z_en_ms.c b/src/overlays/actors/ovl_En_Ms/z_en_ms.c index af7284e094..ea57b9ecf1 100644 --- a/src/overlays/actors/ovl_En_Ms/z_en_ms.c +++ b/src/overlays/actors/ovl_En_Ms/z_en_ms.c @@ -87,7 +87,7 @@ static void EnMs_Init(EnMs* this, GlobalContext* globalCtx) { } Actor_ProcessInitChain(&this->actor, initChain); SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06003DC0, &D_060005EC, &this->unkSkelAnimeStruct, &this->unk_1C6, - 9); // skelanime_mtx_init + 9); // skelanime_mtx_init ActorCollider_AllocCylinder(globalCtx, &this->collider); func_8005C450(globalCtx, &this->collider, this, &unk_col_80AB0320); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawFunc_Circle, 35.0f); @@ -191,6 +191,6 @@ static void EnMs_Update(EnMs* this, GlobalContext* globalCtx) { void EnMs_Draw(EnMs* this, GlobalContext* globalCtx) { func_80093D18(globalCtx->state.gfxCtx); - SkelAnime_DrawSV(globalCtx, this->skelAnime.limbIndex, this->skelAnime.actorDrawTbl, this->skelAnime.dListCount, 0, 0, - &this->actor); + SkelAnime_DrawSV(globalCtx, this->skelAnime.limbIndex, this->skelAnime.actorDrawTbl, this->skelAnime.dListCount, 0, + 0, &this->actor); } diff --git a/src/overlays/actors/ovl_En_Tk/z_en_tk.c b/src/overlays/actors/ovl_En_Tk/z_en_tk.c index 44369bbe6a..7dd4f8da32 100644 --- a/src/overlays/actors/ovl_En_Tk/z_en_tk.c +++ b/src/overlays/actors/ovl_En_Tk/z_en_tk.c @@ -770,7 +770,7 @@ void EnTk_Draw(EnTk* this, GlobalContext* globalCtx) { gSPSegment(gfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(eyeImages[thisAgain->eyeImageIdx])); SkelAnime_DrawSV(globalCtx, thisAgain->skelAnim.limbIndex, thisAgain->skelAnim.actorDrawTbl, - thisAgain->skelAnim.dListCount, func_80B1D278, func_80B1D2E4, &thisAgain->actor); + thisAgain->skelAnim.dListCount, func_80B1D278, func_80B1D2E4, &thisAgain->actor); func_800C6B54(pgdl, globalCtx->state.gfxCtx, "../z_en_tk.c", 1312); } diff --git a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c index c90558f893..521d742417 100644 --- a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c +++ b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c @@ -95,7 +95,7 @@ static void EnWallmas_Init(EnWallmas* this, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->actor, initChain); ActorShape_Init(&this->actor.shape, 0, NULL, 0.5f); SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06008FB0, &D_06009DB0, &this->unkSkelAnimeStruct, &this->unk_22e, - 0x19); + 0x19); ActorCollider_AllocCylinder(globalCtx, &this->colCylinder); ActorCollider_InitCylinder(globalCtx, &this->colCylinder, &this->actor, &colCylinderInit); @@ -631,7 +631,7 @@ static void EnWallmas_Draw(EnWallmas* this, GlobalContext* globalCtx) { if (this->actionFunc != (ActorFunc)&EnWallmas_WaitToDrop) { func_80093D18(globalCtx->state.gfxCtx); SkelAnime_DrawSV(globalCtx, this->skelAnime.limbIndex, this->skelAnime.actorDrawTbl, this->skelAnime.dListCount, - &EnWallMas_UpdatePos, &EnWallmas_DrawOpa, &this->actor); + &EnWallMas_UpdatePos, &EnWallmas_DrawOpa, &this->actor); } EnWallmas_DrawXlu(this, globalCtx);