From c9a89ae2bb1a5e158246c1158088d994716f8d89 Mon Sep 17 00:00:00 2001 From: StickyThwomp <89738536+StickyThwomp@users.noreply.github.com> Date: Tue, 9 May 2023 14:15:45 -0500 Subject: [PATCH] Matched last remaining function in z_en_tru.c. (#1237) * Matched last remaining function in z_en_tru.c. (Also touched up other similar functions for uniformity) * Fix spec file, revert unnecessary deltas, and change variable ordering. --- spec | 6 +- src/overlays/actors/ovl_En_Tru/z_en_tru.c | 181 +++++++++++----------- 2 files changed, 91 insertions(+), 96 deletions(-) diff --git a/spec b/spec index 481fd099dd..358a061ab2 100644 --- a/spec +++ b/spec @@ -2962,11 +2962,7 @@ beginseg name "ovl_En_Tru" compress include "build/src/overlays/actors/ovl_En_Tru/z_en_tru.o" - #ifdef NON_MATCHING - include "build/src/overlays/actors/ovl_En_Tru/ovl_En_Tru_reloc.o" - #else - include "build/data/ovl_En_Tru/ovl_En_Tru.reloc.o" - #endif + include "build/src/overlays/actors/ovl_En_Tru/ovl_En_Tru_reloc.o" endseg beginseg diff --git a/src/overlays/actors/ovl_En_Tru/z_en_tru.c b/src/overlays/actors/ovl_En_Tru/z_en_tru.c index bb146784de..2ba130869b 100644 --- a/src/overlays/actors/ovl_En_Tru/z_en_tru.c +++ b/src/overlays/actors/ovl_En_Tru/z_en_tru.c @@ -93,8 +93,14 @@ ActorInit En_Tru_InitVars = { static Vec3f D_80A8B250 = { 0.0f, 0.02f, 0.0f }; static Color_RGBA8 D_80A8B25C[] = { - { 255, 20, 60, 0 }, { 255, 235, 160, 0 }, { 20, 60, 255, 0 }, - { 100, 100, 100, 0 }, { 255, 255, 200, 0 }, { 100, 100, 100, 0 }, + { 255, 20, 60, 0 }, + { 255, 235, 160, 0 }, + { 20, 60, 255, 0 }, +}; +static Color_RGBA8 D_80A8B268[] = { + { 100, 100, 100, 0 }, + { 255, 255, 200, 0 }, + { 100, 100, 100, 0 }, }; static f32 D_80A8B274[] = { 60.0f, 255.0f, 60.0f }; @@ -176,33 +182,33 @@ void func_80A85788(EnTruUnkStruct* arg0, PlayState* play) { func_8012C2DC(play->state.gfxCtx); for (i = 0; i < 30; i++, arg0++) { - if (arg0->unk_00 == 1) { - f32 alpha; + f32 alpha; - if (!flag) { - gSPDisplayList(POLY_XLU_DISP++, D_80A89000); - flag = true; - } - - do { - alpha = (f32)arg0->unk_02 / arg0->unk_01; - alpha *= 255.0f; - } while (0); - - gDPPipeSync(POLY_XLU_DISP++); - gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 255, 128); - gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, (u8)alpha); - gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, -arg0->unk_02 * 5, 32, 64, 1, 0, 0, 32, 32)); - - Matrix_Translate(arg0->unk_04.x, arg0->unk_04.y, arg0->unk_04.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&play->billboardMtxF); - Matrix_Scale(arg0->unk_28, arg0->unk_28, 1.0f, MTXMODE_APPLY); - Matrix_Translate(0.0f, 14.0f, 0.0f, MTXMODE_APPLY); - - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_XLU_DISP++, D_80A890A8); + if (arg0->unk_00 != 1) { + continue; } + + if (!flag) { + gSPDisplayList(POLY_XLU_DISP++, D_80A89000); + flag = true; + } + + alpha = (f32)arg0->unk_02 / arg0->unk_01; + alpha *= 255.0f; + + gDPPipeSync(POLY_XLU_DISP++); + gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 255, 128); + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, (u8)alpha); + gSPSegment(POLY_XLU_DISP++, 0x08, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, -arg0->unk_02 * 5, 32, 64, 1, 0, 0, 32, 32)); + + Matrix_Translate(arg0->unk_04.x, arg0->unk_04.y, arg0->unk_04.z, MTXMODE_NEW); + Matrix_ReplaceRotation(&play->billboardMtxF); + Matrix_Scale(arg0->unk_28, arg0->unk_28, 1.0f, MTXMODE_APPLY); + Matrix_Translate(0.0f, 14.0f, 0.0f, MTXMODE_APPLY); + + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, D_80A890A8); } CLOSE_DISPS(play->state.gfxCtx); @@ -227,38 +233,38 @@ void func_80A85AA4(EnTruUnkStruct* arg0, Vec3f* arg1, f32 arg2, f32 arg3, f32 ar } void func_80A85BCC(EnTruUnkStruct* arg0, PlayState* play) { + GraphicsContext* gfxCtx = play->state.gfxCtx; s32 i; s32 flag = false; OPEN_DISPS(play->state.gfxCtx); - if (play) {} func_8012C2DC(play->state.gfxCtx); for (i = 0; i < 30; i++, arg0++) { - if (arg0->unk_00 == 2) { - f32 alpha; + f32 alpha; - if (!flag) { - gDPPipeSync(POLY_XLU_DISP++); - gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 200, 0); - flag = true; - } - - do { - alpha = (f32)arg0->unk_02 / arg0->unk_01; - alpha *= 255.0f; - } while (0); - - gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 200, (u8)alpha); - - Matrix_Translate(arg0->unk_04.x, arg0->unk_04.y, arg0->unk_04.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&play->billboardMtxF); - Matrix_Scale(arg0->unk_28, arg0->unk_28, 1.0f, MTXMODE_APPLY); - - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_XLU_DISP++, D_80A8A108); + if (arg0->unk_00 != 2) { + continue; } + + if (!flag) { + gDPPipeSync(POLY_XLU_DISP++); + gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 200, 0); + flag = true; + } + + alpha = (f32)arg0->unk_02 / arg0->unk_01; + alpha *= 255.0f; + + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 200, (u8)alpha); + + Matrix_Translate(arg0->unk_04.x, arg0->unk_04.y, arg0->unk_04.z, MTXMODE_NEW); + Matrix_ReplaceRotation(&play->billboardMtxF); + Matrix_Scale(arg0->unk_28, arg0->unk_28, 1.0f, MTXMODE_APPLY); + + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, D_80A8A108); } CLOSE_DISPS(play->state.gfxCtx); @@ -282,11 +288,10 @@ void func_80A85E2C(EnTruUnkStruct* arg0, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, } } -#ifdef NON_MATCHING -// s8/s6 flipped, same deal as above functions but the same fixes don't work void func_80A85F84(EnTruUnkStruct* arg0, PlayState* play) { - u8 flag = false; + GraphicsContext* gfxCtx = play->state.gfxCtx; s32 i; + s32 flag = false; OPEN_DISPS(play->state.gfxCtx); @@ -295,50 +300,44 @@ void func_80A85F84(EnTruUnkStruct* arg0, PlayState* play) { for (i = 0; i < 30; i++, arg0++) { f32 alpha; s32 index; - - if ((arg0->unk_00 == 3) || (arg0->unk_00 == 4) || (arg0->unk_00 == 5)) { - if (!flag) { - POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0); - gSPDisplayList(POLY_XLU_DISP++, gKoumeDustMaterialDL); - flag = true; - } - - Matrix_Push(); - - do { - alpha = (f32)arg0->unk_02 / arg0->unk_01; - alpha *= D_80A8B274[arg0->unk_00 - 3]; - } while (0); - - gDPSetCombineLERP(POLY_XLU_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, PRIMITIVE, 0, TEXEL0, 0, - COMBINED, 0, SHADE, 0, 0, 0, 0, COMBINED); - gDPSetRenderMode(POLY_XLU_DISP++, G_RM_FOG_SHADE_A, G_RM_ZB_CLD_SURF2); - gSPSetGeometryMode(POLY_XLU_DISP++, G_FOG | G_LIGHTING); - gDPPipeSync(POLY_XLU_DISP++); - gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, D_80A8B25C[arg0->unk_00 - 3].r, D_80A8B25C[arg0->unk_00 - 3].g, - D_80A8B25C[arg0->unk_00 - 3].b, (u8)alpha); - gDPSetEnvColor(POLY_XLU_DISP++, D_80A8B25C[arg0->unk_00 - 3].r, D_80A8B25C[arg0->unk_00 - 3].g, - D_80A8B25C[arg0->unk_00 - 3].b, 0); - - Matrix_Translate(arg0->unk_04.x, arg0->unk_04.y, arg0->unk_04.z, MTXMODE_NEW); - Matrix_Scale(arg0->unk_28, arg0->unk_28, 1.0f, MTXMODE_APPLY); - Matrix_ReplaceRotation(&play->billboardMtxF); - - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - index = ((f32)arg0->unk_02 / arg0->unk_01) * 8.0f; - gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(sDustTextures[index])); - gSPDisplayList(POLY_XLU_DISP++, gKoumeDustModelDL); - - Matrix_Pop(); + if ((arg0->unk_00 != 3) && (arg0->unk_00 != 4) && (arg0->unk_00 != 5)) { + continue; } + + if (!flag) { + POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0); + gSPDisplayList(POLY_XLU_DISP++, gKoumeDustMaterialDL); + flag = true; + } + + Matrix_Push(); + + alpha = (f32)arg0->unk_02 / arg0->unk_01; + alpha *= D_80A8B274[arg0->unk_00 - 3]; + + gDPSetCombineLERP(POLY_XLU_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, PRIMITIVE, 0, TEXEL0, 0, + COMBINED, 0, SHADE, 0, 0, 0, 0, COMBINED); + gDPSetRenderMode(POLY_XLU_DISP++, G_RM_FOG_SHADE_A, G_RM_ZB_CLD_SURF2); + gSPSetGeometryMode(POLY_XLU_DISP++, G_FOG | G_LIGHTING); + gDPPipeSync(POLY_XLU_DISP++); + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, D_80A8B25C[arg0->unk_00 - 3].r, D_80A8B25C[arg0->unk_00 - 3].g, + D_80A8B25C[arg0->unk_00 - 3].b, (u8)alpha); + gDPSetEnvColor(POLY_XLU_DISP++, D_80A8B268[arg0->unk_00 - 3].r, D_80A8B268[arg0->unk_00 - 3].g, + D_80A8B268[arg0->unk_00 - 3].b, 0); + + Matrix_Translate(arg0->unk_04.x, arg0->unk_04.y, arg0->unk_04.z, MTXMODE_NEW); + Matrix_Scale(arg0->unk_28, arg0->unk_28, 1.0f, MTXMODE_APPLY); + Matrix_ReplaceRotation(&play->billboardMtxF); + + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + index = ((f32)arg0->unk_02 / arg0->unk_01) * 8.0f; + gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(sDustTextures[index])); + gSPDisplayList(POLY_XLU_DISP++, gKoumeDustModelDL); + Matrix_Pop(); } CLOSE_DISPS(play->state.gfxCtx); } -#else -void func_80A85F84(EnTruUnkStruct* arg0, PlayState* play); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tru/func_80A85F84.s") -#endif s32 func_80A86384(EnTruUnkStruct* arg0, Vec3f* arg1) { s32 i;