From a4f0d8ea88843041aad8697230300315cfa159cd Mon Sep 17 00:00:00 2001 From: engineer124 <47598039+engineer124@users.noreply.github.com> Date: Fri, 14 Oct 2022 21:05:20 -0400 Subject: [PATCH] Match 3 Functions (z_actor OK, z_mir_ray OK, z_mir_ray3 OK) (#1122) * match MirRay_ReflectedBeam * match Actor_DrawLensActors * match func_80B9E8D4 * void --- include/z64.h | 2 +- spec | 8 - src/code/z_actor.c | 226 ++++++------------ src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c | 137 ++++++----- src/overlays/actors/ovl_Mir_Ray3/z_mir_ray3.c | 42 ++-- 5 files changed, 165 insertions(+), 250 deletions(-) diff --git a/include/z64.h b/include/z64.h index da1f883237..4b2682b1b7 100644 --- a/include/z64.h +++ b/include/z64.h @@ -1089,7 +1089,7 @@ struct PlayState { /* 0x18B9C */ char unk_18B9C[0x2B8]; /* 0x18E54 */ SceneTableEntry* loadedScene; /* 0x18E58 */ char unk_18E58[0x10]; - /* 0x18E68 */ s32 unk_18E68; + /* 0x18E68 */ void* unk_18E68; /* 0x18E6C */ char unk_18E6C[0x3EC]; }; // size = 0x19258 diff --git a/spec b/spec index a960b8f6dd..a021c04f96 100644 --- a/spec +++ b/spec @@ -1196,11 +1196,7 @@ beginseg name "ovl_Mir_Ray" compress include "build/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.o" -#ifdef NON_MATCHING include "build/src/overlays/actors/ovl_Mir_Ray/ovl_Mir_Ray_reloc.o" -#else - include "build/data/ovl_Mir_Ray/ovl_Mir_Ray.reloc.o" -#endif endseg beginseg @@ -4170,11 +4166,7 @@ beginseg name "ovl_Mir_Ray3" compress include "build/src/overlays/actors/ovl_Mir_Ray3/z_mir_ray3.o" -#ifdef NON_MATCHING include "build/src/overlays/actors/ovl_Mir_Ray3/ovl_Mir_Ray3_reloc.o" -#else - include "build/data/ovl_Mir_Ray3/ovl_Mir_Ray3.reloc.o" -#endif endseg beginseg diff --git a/src/code/z_actor.c b/src/code/z_actor.c index c5783f4d75..01894f2693 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -2614,200 +2614,128 @@ void Actor_DrawLensOverlay(Gfx** gfxP, s32 lensMaskSize) { ((LENS_MASK_ACTIVE_SIZE - lensMaskSize) * 0.003f) + 1.0f); } -#ifdef NON_EQUIVALENT -void Actor_DrawLensActors(PlayState* play, s32 numActors, Actor** actors) { +void Actor_DrawLensActors(PlayState* play, s32 numInvisibleActors, Actor** invisibleActors) { + s32 dbgVar1; + s32 dbgVar2; s32 spB4; + Actor** invisibleActor; Gfx* spAC; - void* spA8; // pad - s32 spA4; - // void* sp34; - // Gfx* temp_s1_11; - // Gfx** temp_a0_2; - // Gfx** temp_a1; - // GraphicsContext* temp_s2; - // void* temp_s1_10; - // void* temp_s1_7; - // void* temp_s1_8; - // void* temp_s1_9; - // Gfx* phi_s1; - Gfx* phi_s1_2; - // void* phi_s1_4; + void* spA8; + void* spA4; + GraphicsContext* gfxCtx = play->state.gfxCtx; + Gfx* tmp; + s32 pad[2]; - OPEN_DISPS(play->state.gfxCtx); - // temp_s2 = play->state.gfxCtx; + dbgVar1 = true; + dbgVar2 = true; - if (numActors > 0) { - spAC = POLY_XLU_DISP; - // sp34 = play + 0x18000; + if (dbgVar1) { + dbgVar1 = numInvisibleActors > 0; + } + + OPEN_DISPS(gfxCtx); + + if (dbgVar1) { + tmp = POLY_XLU_DISP; + spA8 = gfxCtx->zbuffer; spA4 = play->unk_18E68; - PreRender_SetValues(&play->pauseBgPreRender, D_801FBBCC, D_801FBBCE, __gfxCtx->curFrameBuffer, - __gfxCtx->zbuffer); + if (dbgVar2) { + PreRender_SetValues(&play->pauseBgPreRender, D_801FBBCC, D_801FBBCE, gfxCtx->curFrameBuffer, spA8); - func_80170200(&play->pauseBgPreRender, &spAC, __gfxCtx->zbuffer, (void*)spA4); + spAC = tmp; + func_80170200(&play->pauseBgPreRender, &spAC, spA8, spA4); + tmp = spAC; + } - // spAC->words.w0 = 0xE7000000; - // spAC->words.w1 = 0; - // temp_s1_2 = spAC + 8; - gDPPipeSync(spAC++); + gDPPipeSync(tmp++); + gDPSetPrimDepth(tmp++, 0, 0); - // temp_s1_2->words.w0 = 0xEE000000; - // temp_s1_2->words.w1 = 0; - // temp_s1_3 = temp_s1_2 + 8; - gDPSetPrimDepth(spAC++, 0, 0); - - // temp_s1_3->words.w0 = 0xEF002C30; - // temp_s1_3->words.w1 = 0xAF504365; - // temp_s1_4 = temp_s1_3 + 8; - gDPSetOtherMode(spAC++, + gDPSetOtherMode(tmp++, G_AD_DISABLE | G_CD_MAGICSQ | G_CK_NONE | G_TC_FILT | G_TF_BILERP | G_TT_NONE | G_TL_TILE | G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, G_AC_THRESHOLD | G_ZS_PRIM | Z_UPD | IM_RD | CVG_DST_SAVE | ZMODE_OPA | FORCE_BL | GBL_c1(G_BL_CLR_BL, G_BL_0, G_BL_CLR_MEM, G_BL_1MA) | GBL_c2(G_BL_CLR_BL, G_BL_0, G_BL_CLR_MEM, G_BL_1MA)); - // temp_s1_4->words.w1 = 0xFF; - // temp_s1_4->words.w0 = 0xFA000000; - // temp_s1_5 = temp_s1_4 + 8; - gDPSetPrimColor(spAC++, 0, 0, 0, 0, 0, 255); - // temp_s1_5 = spAC; + gDPSetPrimColor(tmp++, 0, 0, 0, 0, 0, 255); if (play->roomCtx.curRoom.unk5 == 0) { - // temp_s1_5->words.w0 = 0xFC61E6C3; - // temp_s1_5->words.w1 = 0x11CF9FCF; - // phi_s1 = temp_s1_5 + 8; - gDPSetCombineLERP(spAC++, 1, TEXEL0, PRIMITIVE, 0, 1, TEXEL0, PRIMITIVE, 0, 1, TEXEL0, PRIMITIVE, 0, 1, + gDPSetCombineLERP(tmp++, 1, TEXEL0, PRIMITIVE, 0, 1, TEXEL0, PRIMITIVE, 0, 1, TEXEL0, PRIMITIVE, 0, 1, TEXEL0, PRIMITIVE, 0); } else { - // temp_s1_5->words.w0 = 0xFC119623; - // temp_s1_5->words.w1 = 0xFF2FFFFF; - // phi_s1 = temp_s1_5 + 8; - gDPSetCombineMode(spAC++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); + gDPSetCombineMode(tmp++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); } - // spAC = phi_s1; + spAC = tmp; Actor_DrawLensOverlay(&spAC, play->actorCtx.lensMaskSize); - phi_s1_2 = func_801660B8(play, spAC); + tmp = func_801660B8(play, spAC); - for (spB4 = 0; spB4 < numActors; spB4++, actors++) { - Actor_Draw(play, *actors); + for (spB4 = 0, invisibleActor = invisibleActors; spB4 < numInvisibleActors; spB4++, invisibleActor++) { + POLY_XLU_DISP = tmp; + Actor_Draw(play, *invisibleActor); + tmp = POLY_XLU_DISP; } - // temp_s0_2 = &play->pauseBgPreRender; + if (dbgVar2) { + gDPPipeSync(tmp++); - // phi_s1_2->words.w0 = 0xE7000000; - // phi_s1_2->words.w1 = 0; - // temp_s1_7 = phi_s1_2 + 8; - gDPPipeSync(phi_s1_2++); + gDPSetOtherMode(tmp++, + G_AD_DISABLE | G_CD_DISABLE | G_CK_NONE | G_TC_FILT | G_TF_BILERP | G_TT_NONE | G_TL_TILE | + G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, + G_AC_THRESHOLD | G_ZS_PRIM | AA_EN | IM_RD | CVG_DST_WRAP | ZMODE_OPA | CVG_X_ALPHA | + ALPHA_CVG_SEL | FORCE_BL | GBL_c1(G_BL_CLR_IN, G_BL_0, G_BL_CLR_MEM, G_BL_1) | + GBL_c2(G_BL_CLR_IN, G_BL_0, G_BL_CLR_MEM, G_BL_1)); - // temp_s1_7->unk_0 = 0xEF002CF0; - // temp_s1_7->unk_4 = 0xF5A714D; - // temp_s1_8 = temp_s1_7 + 8; - gDPSetOtherMode(phi_s1_2++, - G_AD_DISABLE | G_CD_DISABLE | G_CK_NONE | G_TC_FILT | G_TF_BILERP | G_TT_NONE | G_TL_TILE | - G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, - G_AC_THRESHOLD | G_ZS_PRIM | AA_EN | IM_RD | CVG_DST_WRAP | ZMODE_OPA | CVG_X_ALPHA | - ALPHA_CVG_SEL | FORCE_BL | GBL_c1(G_BL_CLR_IN, G_BL_0, G_BL_CLR_MEM, G_BL_1) | - GBL_c2(G_BL_CLR_IN, G_BL_0, G_BL_CLR_MEM, G_BL_1)); + gDPSetBlendColor(tmp++, 255, 255, 255, 0); + gDPSetPrimColor(tmp++, 0, 0xFF, 0, 0, 0, 32); - // temp_s1_8->unk_4 = -0x100; - // temp_s1_8->unk_0 = 0xF9000000; - // temp_s1_9 = temp_s1_8 + 8; - gDPSetBlendColor(phi_s1_2++, 255, 255, 255, 0); + if (play->roomCtx.curRoom.unk5 == 0) { + gDPSetCombineMode(tmp++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); + } else { + gDPSetCombineLERP(tmp++, 1, TEXEL0, PRIMITIVE, 0, 1, TEXEL0, PRIMITIVE, 0, 1, TEXEL0, PRIMITIVE, 0, 1, + TEXEL0, PRIMITIVE, 0); + } - // temp_s1_9->unk_4 = 0x20; - // temp_s1_9->unk_0 = 0xFA0000FF; - // temp_s1_10 = temp_s1_9 + 8; - gDPSetPrimColor(phi_s1_2++, 0, 0xFF, 0, 0, 0, 32); + gDPSetColorImage(tmp++, G_IM_FMT_RGBA, G_IM_SIZ_16b, play->pauseBgPreRender.width, spA4); - // temp_a0_2 = &spAC; - // if (sp34->unk_6E5 == 0) { - if (play->roomCtx.curRoom.unk5 == 0) { - // temp_s1_10->unk_0 = 0xFC119623; - // temp_s1_10->unk_4 = 0xFF2FFFFF; - // phi_s1_4 = temp_s1_10 + 8; - gDPSetCombineMode(phi_s1_2++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); - //} else { - } else { - // temp_s1_10->unk_4 = 0x11CF9FCF; - // temp_s1_10->unk_0 = 0xFC61E6C3; - // phi_s1_4 = temp_s1_10 + 8; - gDPSetCombineLERP(phi_s1_2++, 1, TEXEL0, PRIMITIVE, 0, 1, TEXEL0, PRIMITIVE, 0, 1, TEXEL0, PRIMITIVE, 0, 1, - TEXEL0, PRIMITIVE, 0); + spAC = tmp; + Actor_DrawLensOverlay(&spAC, play->actorCtx.lensMaskSize); + tmp = spAC; - //} + gDPPipeSync(tmp++); + gDPSetBlendColor(tmp++, 255, 255, 255, 8); + + gDPSetColorImage(tmp++, G_IM_FMT_RGBA, G_IM_SIZ_16b, play->pauseBgPreRender.width, + play->pauseBgPreRender.fbuf); + + spAC = tmp; + func_8016FDB8(&play->pauseBgPreRender, &spAC, (void*)spA4, spA8, 1); + tmp = spAC; } - // phi_s1_4->unk_0 = (s32) (((sp34->unk_B4C - 1) & 0xFFF) | 0xFF100000); - // temp_s1_11 = phi_s1_4 + 8; - // phi_s1_4->unk_4 = spA4; - gDPSetColorImage(phi_s1_2++, G_IM_FMT_RGBA, G_IM_SIZ_16b, ((play->pauseBgPreRender.width - 1) & 0xFFF), spA4); - // temp_s1_11 = phi_s1_2; - spAC = phi_s1_2; - - // spAC = temp_s1_11; - Actor_DrawLensOverlay(&spAC, (s32)play->actorCtx.lensMaskSize); - // temp_s1_11->words.w0 = 0xE7000000; - // temp_s1_11->words.w1 = 0; - // temp_s1_12 = temp_s1_11 + 8; - gDPPipeSync(spAC++); - - // temp_s1_12->words.w1 = -0xF8; - // temp_s1_12->words.w0 = 0xF9000000; - // temp_s1_13 = temp_s1_12 + 8; - gDPSetBlendColor(spAC++, 255, 255, 255, 8); - - // temp_s1_14 = temp_s1_13 + 8; - // temp_s1_13->words.w0 = ((sp34->unk_B4C - 1) & 0xFFF) | 0xFF100000; - // temp_s1_13->words.w1 = sp34->unk_B5C; - gDPSetColorImage(spAC++, G_IM_FMT_RGBA, G_IM_SIZ_16b, ((play->pauseBgPreRender.width - 1) & 0xFFF), - play->pauseBgPreRender.fbuf); - - // temp_a1 = &spAC; - // spAC = temp_s1_14; - // func_8016FDB8(&play->pauseBgPreRender, temp_a1, (void* ) spA4, spA8, 1U); - func_8016FDB8(&play->pauseBgPreRender, &spAC, (void*)spA4, __gfxCtx->zbuffer, 1U); - // - // POLY_OPA_DISP = temp_s1_14; - POLY_OPA_DISP = spAC; + POLY_XLU_DISP = tmp; } - // temp_s1_15 = OVERLAY_DISP; - // temp_s1_15->words.w0 = 0xE7000000; - // temp_s1_15->words.w1 = 0; - // temp_s1_16 = temp_s1_15 + 8; - spAC = OVERLAY_DISP; - gDPPipeSync(spAC++); + tmp = OVERLAY_DISP; - // temp_s1_16->words.w0 = 0xEF002C30; - // temp_s1_16->words.w1 = 0x00504345; - // temp_s1_17 = temp_s1_16 + 8; - gDPSetOtherMode(spAC++, + gDPPipeSync(tmp++); + + gDPSetOtherMode(tmp++, G_AD_DISABLE | G_CD_MAGICSQ | G_CK_NONE | G_TC_FILT | G_TF_BILERP | G_TT_NONE | G_TL_TILE | G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, G_AC_THRESHOLD | G_ZS_PRIM | G_RM_CLD_SURF | G_RM_CLD_SURF2); - // temp_s1_17->words.w0 = 0xFC61E6C3; - // temp_s1_17->words.w1 = 0x11CF9FCF; - // temp_s1_18 = temp_s1_17 + 8; - gDPSetCombineLERP(spAC++, 1, TEXEL0, PRIMITIVE, 0, 1, TEXEL0, PRIMITIVE, 0, 1, TEXEL0, PRIMITIVE, 0, 1, TEXEL0, + gDPSetCombineLERP(tmp++, 1, TEXEL0, PRIMITIVE, 0, 1, TEXEL0, PRIMITIVE, 0, 1, TEXEL0, PRIMITIVE, 0, 1, TEXEL0, PRIMITIVE, 0); + gDPSetPrimColor(tmp++, 0, 0, 74, 0, 0, 74); - // temp_s1_18->words.w0 = 0xFA000000; - // temp_s1_18->words.w1 = 0x4A00004A; - // spAC = temp_s1_18 + 8; - gDPSetPrimColor(spAC++, 0, 0, 74, 0, 0, 74); - - Actor_DrawLensOverlay(&spAC, (s32)play->actorCtx.lensMaskSize); - + spAC = tmp; + Actor_DrawLensOverlay(&spAC, play->actorCtx.lensMaskSize); OVERLAY_DISP = spAC; - CLOSE_DISPS(play->state.gfxCtx); + CLOSE_DISPS(gfxCtx); } -#else -void Actor_DrawLensActors(PlayState* play, s32 numActors, Actor** actors); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_actor/Actor_DrawLensActors.s") -#endif s32 func_800BA2D8(PlayState* play, Actor* actor) { return func_800BA2FC(play, actor, &actor->projectedPos, actor->projectedW); diff --git a/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c b/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c index 5160dc074e..dad2ccbc3d 100644 --- a/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c +++ b/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c @@ -483,8 +483,6 @@ void MirRay_RemoveSimilarReflections(MirRayShieldReflection* reflection) { } // Creates the reflected beam's collider (to interact with objects) and places and orients the shield images -#ifdef NON_MATCHING -// Beginning block re-ordered void MirRay_ReflectedBeam(MirRay* this, PlayState* play, MirRayShieldReflection* reflection) { Player* player = GET_PLAYER(play); s32 i; @@ -498,8 +496,6 @@ void MirRay_ReflectedBeam(MirRay* this, PlayState* play, MirRayShieldReflection* f32 spE8[3]; f32 normalVec[3]; MtxF* shieldMtx = &player->shieldMf; - Vec3f vecA; - Vec3f vecC; spE8[0] = -(shieldMtx->xz * this->reflectRange) * this->reflectIntensity * 400.0f; spE8[1] = -(shieldMtx->yz * this->reflectRange) * this->reflectIntensity * 400.0f; @@ -513,85 +509,86 @@ void MirRay_ReflectedBeam(MirRay* this, PlayState* play, MirRayShieldReflection* vecD.y = spE8[1] + vecB.y; vecD.z = spE8[2] + vecB.z; - vecA.x = vecB.x + (shieldMtx->xx * 300.0f); - vecA.y = vecB.y + (shieldMtx->yx * 300.0f); - vecA.z = vecB.z + (shieldMtx->zx * 300.0f); + { + Vec3f vecA; + Vec3f vecC; - vecC.x = vecD.x + (shieldMtx->xx * 300.0f); - vecC.y = vecD.y + (shieldMtx->yx * 300.0f); - vecC.z = vecD.z + (shieldMtx->zx * 300.0f); + vecA.x = vecB.x + (shieldMtx->xx * 300.0f); + vecA.y = vecB.y + (shieldMtx->yx * 300.0f); + vecA.z = vecB.z + (shieldMtx->zx * 300.0f); - Collider_SetQuadVertices(&this->collider2, &vecA, &vecB, &vecC, &vecD); + vecC.x = vecD.x + (shieldMtx->xx * 300.0f); + vecC.y = vecD.y + (shieldMtx->yx * 300.0f); + vecC.z = vecD.z + (shieldMtx->zx * 300.0f); - for (i = 0; i < 6; i++) { - if (reflection[i].reflectionPoly != NULL) { - normalVec[0] = COLPOLY_GET_NORMAL(reflection[i].reflectionPoly->normal.x); - normalVec[1] = COLPOLY_GET_NORMAL(reflection[i].reflectionPoly->normal.y); - normalVec[2] = COLPOLY_GET_NORMAL(reflection[i].reflectionPoly->normal.z); + Collider_SetQuadVertices(&this->collider2, &vecA, &vecB, &vecC, &vecD); - if (Math3D_LineSegVsPlane(normalVec[0], normalVec[1], normalVec[2], reflection[i].reflectionPoly->dist, - &vecB, &vecD, &sp118, 1)) { + for (i = 0; i < 6; i++) { + if (reflection[i].reflectionPoly != NULL) { + normalVec[0] = COLPOLY_GET_NORMAL(reflection[i].reflectionPoly->normal.x); + normalVec[1] = COLPOLY_GET_NORMAL(reflection[i].reflectionPoly->normal.y); + normalVec[2] = COLPOLY_GET_NORMAL(reflection[i].reflectionPoly->normal.z); - reflection[i].pos.x = sp118.x; - reflection[i].pos.y = sp118.y; - reflection[i].pos.z = sp118.z; + if (Math3D_LineSegVsPlane(normalVec[0], normalVec[1], normalVec[2], reflection[i].reflectionPoly->dist, + &vecB, &vecD, &sp118, 1)) { - temp_f0 = sqrtf(SQ(sp118.x - vecB.x) + SQ(sp118.y - vecB.y) + SQ(sp118.z - vecB.z)); + reflection[i].pos.x = sp118.x; + reflection[i].pos.y = sp118.y; + reflection[i].pos.z = sp118.z; - if (temp_f0 < (this->reflectIntensity * 600.0f)) { - reflection[i].opacity = 200; + temp_f0 = sqrtf(SQ(sp118.x - vecB.x) + SQ(sp118.y - vecB.y) + SQ(sp118.z - vecB.z)); + + if (temp_f0 < (this->reflectIntensity * 600.0f)) { + reflection[i].opacity = 200; + } else { + reflection[i].opacity = (s32)(800.0f - temp_f0); + } + + reflection[i].opacity = (s32)(reflection[i].opacity * 1.275f); + + sp10C.x = (shieldMtx->xx * 100.0f) + vecB.x; + sp10C.y = (shieldMtx->yx * 100.0f) + vecB.y; + sp10C.z = (shieldMtx->zx * 100.0f) + vecB.z; + + sp100.x = (spE8[0] * 4.0f) + sp10C.x; + sp100.y = (spE8[1] * 4.0f) + sp10C.y; + sp100.z = (spE8[2] * 4.0f) + sp10C.z; + + reflection[i].mtx.xx = reflection[i].mtx.yy = reflection[i].mtx.zz = reflection[i].mtx.ww = 1.0f; + + reflection[i].mtx.yx = reflection[i].mtx.zx = reflection[i].mtx.wx = reflection[i].mtx.xy = + reflection[i].mtx.zy = reflection[i].mtx.wy = reflection[i].mtx.xz = reflection[i].mtx.yz = + reflection[i].mtx.wz = reflection[i].mtx.xw = reflection[i].mtx.yw = reflection[i].mtx.zw = + 0.0f; + + if (Math3D_LineSegVsPlane(normalVec[0], normalVec[1], normalVec[2], + reflection[i].reflectionPoly->dist, &sp10C, &sp100, &intersection, 1)) { + reflection[i].mtx.xx = intersection.x - sp118.x; + reflection[i].mtx.yx = intersection.y - sp118.y; + reflection[i].mtx.zx = intersection.z - sp118.z; + } + + sp10C.x = (shieldMtx->xy * 100.0f) + vecB.x; + sp10C.y = (shieldMtx->yy * 100.0f) + vecB.y; + sp10C.z = (shieldMtx->zy * 100.0f) + vecB.z; + + sp100.x = (spE8[0] * 4.0f) + sp10C.x; + sp100.y = (spE8[1] * 4.0f) + sp10C.y; + sp100.z = (spE8[2] * 4.0f) + sp10C.z; + + if (Math3D_LineSegVsPlane(normalVec[0], normalVec[1], normalVec[2], + reflection[i].reflectionPoly->dist, &sp10C, &sp100, &intersection, 1)) { + reflection[i].mtx.xy = intersection.x - sp118.x; + reflection[i].mtx.yy = intersection.y - sp118.y; + reflection[i].mtx.zy = intersection.z - sp118.z; + } } else { - reflection[i].opacity = (s32)(800.0f - temp_f0); + reflection[i].reflectionPoly = NULL; } - - reflection[i].opacity = (s32)(reflection[i].opacity * 1.275f); - - sp10C.x = (shieldMtx->xx * 100.0f) + vecB.x; - sp10C.y = (shieldMtx->yx * 100.0f) + vecB.y; - sp10C.z = (shieldMtx->zx * 100.0f) + vecB.z; - - sp100.x = (spE8[0] * 4.0f) + sp10C.x; - sp100.y = (spE8[1] * 4.0f) + sp10C.y; - sp100.z = (spE8[2] * 4.0f) + sp10C.z; - - reflection[i].mtx.xx = reflection[i].mtx.yy = reflection[i].mtx.zz = reflection[i].mtx.ww = 1.0f; - - reflection[i].mtx.yx = reflection[i].mtx.zx = reflection[i].mtx.wx = reflection[i].mtx.xy = - reflection[i].mtx.zy = reflection[i].mtx.wy = reflection[i].mtx.xz = reflection[i].mtx.yz = - reflection[i].mtx.wz = reflection[i].mtx.xw = reflection[i].mtx.yw = reflection[i].mtx.zw = - 0.0f; - - if (Math3D_LineSegVsPlane(normalVec[0], normalVec[1], normalVec[2], reflection[i].reflectionPoly->dist, - &sp10C, &sp100, &intersection, 1)) { - reflection[i].mtx.xx = intersection.x - sp118.x; - reflection[i].mtx.yx = intersection.y - sp118.y; - reflection[i].mtx.zx = intersection.z - sp118.z; - } - - sp10C.x = (shieldMtx->xy * 100.0f) + vecB.x; - sp10C.y = (shieldMtx->yy * 100.0f) + vecB.y; - sp10C.z = (shieldMtx->zy * 100.0f) + vecB.z; - - sp100.x = (spE8[0] * 4.0f) + sp10C.x; - sp100.y = (spE8[1] * 4.0f) + sp10C.y; - sp100.z = (spE8[2] * 4.0f) + sp10C.z; - - if (Math3D_LineSegVsPlane(normalVec[0], normalVec[1], normalVec[2], reflection[i].reflectionPoly->dist, - &sp10C, &sp100, &intersection, 1)) { - reflection[i].mtx.xy = intersection.x - sp118.x; - reflection[i].mtx.yy = intersection.y - sp118.y; - reflection[i].mtx.zy = intersection.z - sp118.z; - } - } else { - reflection[i].reflectionPoly = NULL; } } } } -#else -void MirRay_ReflectedBeam(MirRay* this, PlayState* play, MirRayShieldReflection* reflection); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Mir_Ray/MirRay_ReflectedBeam.s") -#endif void MirRay_Draw(Actor* thisx, PlayState* play) { s32 pad; diff --git a/src/overlays/actors/ovl_Mir_Ray3/z_mir_ray3.c b/src/overlays/actors/ovl_Mir_Ray3/z_mir_ray3.c index 66a14a2a64..e327123d18 100644 --- a/src/overlays/actors/ovl_Mir_Ray3/z_mir_ray3.c +++ b/src/overlays/actors/ovl_Mir_Ray3/z_mir_ray3.c @@ -213,7 +213,6 @@ void func_80B9E7D0(MirRay3Struct* ptr) { } } -#ifdef NON_MATCHING void func_80B9E8D4(MirRay3* this, PlayState* play, MirRay3Struct* ptr) { Player* player = GET_PLAYER(play); s32 i; @@ -231,7 +230,6 @@ void func_80B9E8D4(MirRay3* this, PlayState* play, MirRay3Struct* ptr) { f32 temp_f2; Vec3f spD4; Vec3f spC8; - CollisionPoly* spC4; spF8[0] = -(shieldMf->mf[2][0] * this->unk_260) * this->unk_214 * 400.0f; spF8[1] = -(shieldMf->mf[2][1] * this->unk_260) * this->unk_214 * 400.0f; @@ -321,28 +319,28 @@ void func_80B9E8D4(MirRay3* this, PlayState* play, MirRay3Struct* ptr) { sp134.y = (spF8[1] * temp_f2) + sp140.y; sp134.z = (spF8[2] * temp_f2) + sp140.z; - if (!BgCheck_AnyLineTest1(&play->colCtx, &sp140, &sp134, &sp128, &spC4, 1)) { - Math_Vec3f_Copy(&sp128, &sp134); + { + CollisionPoly* spC4; + + if (!BgCheck_AnyLineTest1(&play->colCtx, &sp140, &sp134, &sp128, &spC4, 1)) { + Math_Vec3f_Copy(&sp128, &sp134); + } + + sp128.x += spF8[0] * 5.0f; + sp128.y += spF8[1] * 5.0f; + sp128.z += spF8[2] * 5.0f; + + spD4.x = (shieldMf->mf[0][0] * 300.0f) + sp140.x; + spD4.y = (shieldMf->mf[0][1] * 300.0f) + sp140.y; + spD4.z = (shieldMf->mf[0][2] * 300.0f) + sp140.z; + + spC8.x = (shieldMf->mf[0][0] * 300.0f) + sp128.x; + spC8.y = (shieldMf->mf[0][1] * 300.0f) + sp128.y; + spC8.z = (shieldMf->mf[0][2] * 300.0f) + sp128.z; + + Collider_SetQuadVertices(&this->colliderQuad, &spD4, &sp140, &spC8, &sp128); } - - sp128.x += spF8[0] * 5.0f; - sp128.y += spF8[1] * 5.0f; - sp128.z += spF8[2] * 5.0f; - - spD4.x = (shieldMf->mf[0][0] * 300.0f) + sp140.x; - spD4.y = (shieldMf->mf[0][1] * 300.0f) + sp140.y; - spD4.z = (shieldMf->mf[0][2] * 300.0f) + sp140.z; - - spC8.x = (shieldMf->mf[0][0] * 300.0f) + sp128.x; - spC8.y = (shieldMf->mf[0][1] * 300.0f) + sp128.y; - spC8.z = (shieldMf->mf[0][2] * 300.0f) + sp128.z; - - Collider_SetQuadVertices(&this->colliderQuad, &spD4, &sp140, &spC8, &sp128); } -#else -void func_80B9E8D4(MirRay3* this, PlayState* play, MirRay3Struct* ptr); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Mir_Ray3/func_80B9E8D4.s") -#endif void MirRay3_Draw(Actor* thisx, PlayState* play) { s32 pad[2];