1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-04 15:04:31 +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

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