1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-13 04:39:36 +00:00

use clang, modify z64animation.h and z64dma.h to use open braces on newline

This commit is contained in:
KrimtonZ 2020-03-24 12:16:13 -05:00
parent 2b0b6a6c12
commit db3cfe1b61
11 changed files with 493 additions and 841 deletions

View file

@ -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

View file

@ -3,8 +3,7 @@
#include <ultra64.h>
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;

View file

@ -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;

View file

@ -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);
}

View file

@ -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);

File diff suppressed because it is too large Load diff

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);