From 9a63f1d4d13c39b4f30819489932023e6104d8e4 Mon Sep 17 00:00:00 2001 From: Roman971 Date: Tue, 24 Mar 2020 00:11:21 +0100 Subject: Run formatter with changes --- src/code/z_actor.c | 44 ++++++++++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 16 deletions(-) (limited to 'src/code/z_actor.c') diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 5fa59e19b..30645ee88 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -156,16 +156,19 @@ void ActorShadow_DrawFunc_Teardrop(Actor* actor, LightMapper* lightMapper, Globa if ((phi_f2 >= -1.0f) && (phi_f2 < 500.0f)) { phi_s0 = lightMapper->lights; - if (phi_f2 <= 0.0f) + if (phi_f2 <= 0.0f) { actor->shape.unk_15++; + } - if (30.0f < phi_f2) + if (30.0f < phi_f2) { phi_f2 = 30.0f; + } temp_f24 = actor->shape.unk_14 * (1.0f - (phi_f2 * (1.0f / 30))); - if (30.0f < phi_f2) + if (30.0f < phi_f2) { phi_f2 = 30.0f; + } temp_f20_2 = 1.0f - (phi_f2 * (1.0f / 70)); temp_f22_2 = (actor->shape.unk_10 * temp_f20_2) * actor->scale.x; @@ -187,8 +190,9 @@ void ActorShadow_DrawFunc_Teardrop(Actor* actor, LightMapper* lightMapper, Globa if (phi_s0->l.dir[1] > 0) { temp_a3 = (ABS(phi_s0->l.dir[1]) * ((phi_s0->l.col[0] + phi_s0->l.col[1]) + phi_s0->l.col[2])) - (phi_s2 * 8); - if (temp_a3 > 0) + if (temp_a3 > 0) { func_8002B66C(globalCtx, phi_s0, &spE8, temp_a3, temp_f24, temp_f22_2, temp_f20_2); + } } phi_s0++; } @@ -335,18 +339,20 @@ void func_8002C124(TargetContext* targetCtx, GlobalContext* globalCtx) { spCE = 0xFF; var1 = 1.0f; - if (targetCtx->unk_4B != 0) + if (targetCtx->unk_4B != 0) { spB8 = 1; - else + } else { spB8 = 3; + } if (actor != NULL) { Math_Vec3f_Copy(&targetCtx->targetCenterPos, &actor->posRot2.pos); var1 = (500.0f - targetCtx->unk_44) / 420.0f; } else { targetCtx->unk_48 -= 120; - if (targetCtx->unk_48 < 0) + if (targetCtx->unk_48 < 0) { targetCtx->unk_48 = 0; + } spCE = targetCtx->unk_48; } @@ -361,8 +367,9 @@ void func_8002C124(TargetContext* targetCtx, GlobalContext* globalCtx) { spBC.z = spBC.z * var1; targetCtx->unk_4C--; - if (targetCtx->unk_4C < 0) + if (targetCtx->unk_4C < 0) { targetCtx->unk_4C = 2; + } func_8002BE64(targetCtx, targetCtx->unk_4C, spBC.x, spBC.y, spBC.z); @@ -373,10 +380,11 @@ void func_8002C124(TargetContext* targetCtx, GlobalContext* globalCtx) { entry = &targetCtx->arr_50[spAC]; if (entry->unk_0C < 500.0f) { - if (entry->unk_0C <= 120.0f) + if (entry->unk_0C <= 120.0f) { var2 = 0.15f; - else + } else { var2 = ((entry->unk_0C - 120.0f) * 0.001f) + 0.15f; + } Matrix_Translate(entry->pos.x, entry->pos.y, 0.0f, MTXMODE_NEW); Matrix_Scale(var2, 0.15f, 1.0f, MTXMODE_APPLY); @@ -398,8 +406,9 @@ void func_8002C124(TargetContext* targetCtx, GlobalContext* globalCtx) { } spCE = spCE - (0xFF / 3); - if (spCE < 0) + if (spCE < 0) { spCE = 0; + } spAC = (spAC + 1) % 3; } } @@ -1437,14 +1446,16 @@ f32 func_8002EFC0(Actor* actor, Player* player, s16 arg2) { abs_var = ABS(var); if (player->unk_664 != NULL) { - if ((abs_var > 0x4000) || (actor->flags & 0x8000000)) + if ((abs_var > 0x4000) || (actor->flags & 0x8000000)) { return FLT_MAX; - else + } else { return actor->waterSurfaceDist - actor->waterSurfaceDist * 0.8f * ((0x4000 - abs_var) * 3.0517578125e-05f); + } } - if (abs_var > 0x2AAA) + if (abs_var > 0x2AAA) { return FLT_MAX; + } return actor->waterSurfaceDist; } @@ -1822,10 +1833,11 @@ void func_8002FBAC(GlobalContext* globalCtx) { func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_actor.c", 5308); if (gSaveContext.respawn[RESPAWN_MODE_TOP].data != 0) { - if (LINK_IS_ADULT) + if (LINK_IS_ADULT) { spD8 = 80.0f; - else + } else { spD8 = 60.0f; + } spD0 = 0xFF; spD4 = 1.0f; -- cgit v1.2.3 From ac4a51bf8fdc93221d4ba674351b683d0eedfd9b Mon Sep 17 00:00:00 2001 From: KrimtonZ Date: Tue, 24 Mar 2020 11:52:12 -0500 Subject: Rename SkelAnime functions, which in turn modified a bunch of actor functions. Move necessary skelanime function calls to functions.h, remove unnecessary skelanime functions from functions.h, other skelanime cleanup --- src/code/z_actor.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/code/z_actor.c') diff --git a/src/code/z_actor.c b/src/code/z_actor.c index be598da4a..01ff7ed32 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -910,7 +910,7 @@ void func_8002D9A4(Actor* actor, f32 arg1) { void func_8002D9F8(Actor* actor, UNK_PTR arg1) { Vec3f sp1C; - func_800A54FC(arg1, &sp1C, actor->shape.rot.y, actor); + func_800A54FC(arg1, &sp1C, actor->shape.rot.y); actor->posRot.pos.x += sp1C.x * actor->scale.x; actor->posRot.pos.y += sp1C.y * actor->scale.y; actor->posRot.pos.z += sp1C.z * actor->scale.z; @@ -3887,7 +3887,7 @@ 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 = func_800A273C(globalCtx, skelAnime->limbIndex, skelAnime->actorDrawTbl, skelAnime->dListCount, + 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); @@ -3906,7 +3906,7 @@ 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 = func_800A273C(globalCtx, skelAnime->limbIndex, skelAnime->actorDrawTbl, skelAnime->dListCount, + 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); -- cgit v1.2.3 From db3cfe1b61397a6656f4d92dd0835a589cf72c68 Mon Sep 17 00:00:00 2001 From: KrimtonZ Date: Tue, 24 Mar 2020 12:16:13 -0500 Subject: use clang, modify z64animation.h and z64dma.h to use open braces on newline --- src/code/z_actor.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/code/z_actor.c') diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 91bf21c5e..eec16df03 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); } -- cgit v1.2.3 From 8970968cfcfcfb86b70eec9b26528d7d9d2c160e Mon Sep 17 00:00:00 2001 From: KrimtonZ Date: Wed, 25 Mar 2020 10:51:25 -0500 Subject: name SkelAnime_InitLinkAnimetion, name load animation types and callbacks, rename several segement addresses in decompiled actors --- src/code/z_actor.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/code/z_actor.c') diff --git a/src/code/z_actor.c b/src/code/z_actor.c index eec16df03..9928be4d9 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -9,7 +9,7 @@ void ActorShape_Init(ActorShape* shape, f32 arg1, void* shadowDrawFunc, f32 arg3 shape->unk_14 = -1; } -void func_8002B200(Actor* actor, LightMapper* lightMapper, GlobalContext* globalCtx, u32 dlist, Color_RGBA8* color) { +void func_8002B200(Actor* actor, LightMapper* lightMapper, GlobalContext* globalCtx, Gfx* dlist, Color_RGBA8* color) { f32 temp1; f32 temp2; MtxF sp60; @@ -41,7 +41,7 @@ void func_8002B200(Actor* actor, LightMapper* lightMapper, GlobalContext* global func_80038A28(actor->floorPoly, actor->posRot.pos.x, actor->unk_80, actor->posRot.pos.z, &sp60); Matrix_Put(&sp60); - if (dlist != (u32)&D_04049210) { + if (dlist != D_04049210) { Matrix_RotateY(actor->shape.rot.y * (M_PI / 32768), MTXMODE_APPLY); } @@ -3898,7 +3898,7 @@ 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, + gfxCtx->polyOpa.p = SkelAnime_DrawSV2(globalCtx, skelAnime->skeleton, skelAnime->actorDrawTbl, skelAnime->dListCount, unkFunc1, unkFunc2, actor, gfxCtx->polyOpa.p); func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_actor.c", 8860); @@ -3917,7 +3917,7 @@ 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, + gfxCtx->polyXlu.p = SkelAnime_DrawSV2(globalCtx, skelAnime->skeleton, skelAnime->actorDrawTbl, skelAnime->dListCount, unkFunc1, unkFunc2, actor, gfxCtx->polyXlu.p); func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_actor.c", 8904); -- cgit v1.2.3 From 582b32d39c16fa565fd1cda320da2632abba4296 Mon Sep 17 00:00:00 2001 From: KrimtonZ Date: Wed, 25 Mar 2020 11:43:11 -0500 Subject: Fix Draw Callbacks, fix segmented address in z_en_bird --- src/code/z_actor.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/code/z_actor.c') diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 9928be4d9..49086f289 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -3884,8 +3884,8 @@ Gfx* func_80034B54(GraphicsContext* gfxCtx) { #pragma GLOBAL_ASM("asm/non_matchings/code/z_actor/func_80034B54.s") #endif -void func_80034BA0(GlobalContext* globalCtx, SkelAnime* skelAnime, void* unkFunc1, void* unkFunc2, Actor* actor, - s16 alpha) { +void func_80034BA0(GlobalContext* globalCtx, SkelAnime* skelAnime, SkelAnime_LimbUpdateMatrix2 unkFunc1, + SkelAnime_LimbAppendDlist2 unkFunc2, Actor* actor, s16 alpha) { GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; Gfx* gfxArr[4]; @@ -3904,8 +3904,8 @@ void func_80034BA0(GlobalContext* globalCtx, SkelAnime* skelAnime, void* unkFunc func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_actor.c", 8860); } -void func_80034CC4(GlobalContext* globalCtx, SkelAnime* skelAnime, void* unkFunc1, void* unkFunc2, Actor* actor, - s16 alpha) { +void func_80034CC4(GlobalContext* globalCtx, SkelAnime* skelAnime, SkelAnime_LimbUpdateMatrix2 unkFunc1, + SkelAnime_LimbAppendDlist2 unkFunc2, Actor* actor, s16 alpha) { GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; Gfx* gfxArr[4]; -- cgit v1.2.3