diff --git a/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.c b/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.c index 02c5f17af9..4f3ef6eef4 100644 --- a/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.c +++ b/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.c @@ -5,6 +5,7 @@ */ #include "z_bg_ganon_otyuka.h" +#include "../ovl_Boss_Ganon/z_boss_ganon.h" #include "vt.h" #define FLAGS 0x00000030 @@ -36,9 +37,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 1000, ICHAIN_STOP), }; -UNK_TYPE D_80876A64[] = { - 0x01020408, -}; +u8 D_80876A64[] = { 0x01, 0x02, 0x04, 0x08 }; UNK_TYPE D_80876A68[] = { 0x42F00000, 0x00000000, 0x00000000, 0xC2F00000, 0x00000000, 0x00000000, @@ -53,17 +52,14 @@ UNK_TYPE D_80876A9C[] = { 0x32140000, }; -UNK_TYPE D_80876AA0[] = { - 0x42700000, 0x00000000, 0x00000000, 0xC2700000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x42700000, 0x00000000, 0x00000000, 0xC2700000, +Vec3f D_80876AA0[] = { + { 60.0f, 0.0f, 0.0f }, + { -60.0f, 0.0f, 0.0f }, + { 0.0f, 0.0f, 60.0f }, + { 0.0f, 0.0f, -60.0f }, }; -UNK_TYPE D_80876AD0[] = { - 0x3FC90FDB, - 0xBFC90FDB, - 0x00000000, - 0x40490FDB, -}; +f32 D_80876AD0[] = { M_PI / 2, -M_PI / 2, 0.0f, M_PI }; #include "z_bg_ganon_otyuka_gfx.c" @@ -121,6 +117,7 @@ void BgGanonOtyuka_Destroy(Actor* thisx, GlobalContext* globalCtx) { BgGanonOtyuka* this = THIS; DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId); + osSyncPrintf(VT_FGCOL(GREEN)); osSyncPrintf("WHY !!!!!!!!!!!!!!!!\n"); osSyncPrintf(VT_RST); @@ -134,4 +131,152 @@ void BgGanonOtyuka_Destroy(Actor* thisx, GlobalContext* globalCtx) { #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Ganon_Otyuka/BgGanonOtyuka_Update.s") +#ifdef NON_MATCHING +void BgGanonOtyuka_Draw(Actor* thisx, GlobalContext* globalCtx) { + BgGanonOtyuka* this = THIS; + Camera* camera; + f32 spBC; + Gfx* spA8; + Gfx* temp_s0; + Gfx* temp_s0_3; + Gfx* temp_s1; + Gfx* temp_s1_2; + Gfx* temp_v0_2; + Gfx* temp_v0_3; + Gfx* temp_v1; + Gfx* temp_v1_2; + Gfx* temp_v1_3; + Gfx* temp_v1_4; + Gfx* temp_v1_5; + Gfx* temp_v1_6; + GraphicsContext* gfxCtx; + GraphicsContext* temp_s3; + s16 temp_s0_2; + s16 temp_s0_4; + u8 temp_a2; + Actor* boss; + Actor* prop; + Actor* temp_s4_4; + Actor* temp_s4_5; + void* temp_s4_6; + Gfx* phi_s2; + Gfx* phi_s1; + s16 phi_s0; + BgGanonOtyuka* phi_s4_3; + s16 phi_s0_2; + + camera = Gameplay_GetCamera(globalCtx, 0); + spBC = -30.0f; + gfxCtx = globalCtx->state.gfxCtx; + OPEN_DISPS(gfxCtx, "../z_bg_ganon_otyuka.c", 702); + boss = globalCtx->actorCtx.actorList[ACTORTYPE_BOSS].first; + if (boss != NULL) { + while (boss != NULL) { + if ((boss->id == ACTOR_BOSS_GANON) && (boss->params == 0)) { + BossGanon* ganon = (BossGanon*)boss; + + if (ganon->unk_198 != 0) { + spBC = -2000.0f; + } + + break; + } else { + boss = boss->next; + } + } + } + func_80093D18(globalCtx->state.gfxCtx); + gSPDisplayList(POLY_OPA_DISP++, D_80877328); + prop = globalCtx->actorCtx.actorList[ACTORTYPE_PROP].first; + if (prop != NULL) { + loop_8: + if ((prop->id == ACTOR_BG_GANON_OTYUKA) && (prop->projectedPos.z > spBC)) { + BgGanonOtyuka* otyuka = (BgGanonOtyuka*)prop; + + phi_s2 = D_80877408; + if (camera->eye.y > prop->posRot.pos.y) { + phi_s2 = D_808773B0; + } + Matrix_Translate(prop->posRot.pos.x, prop->posRot.pos.y, prop->posRot.pos.z, MTXMODE_NEW); + phi_s1 = NULL; + if (otyuka->unk_16A != 0) { + Matrix_RotateX((prop->shape.rot.x / 32768.0f) * 3.1415927f, MTXMODE_APPLY); + Matrix_RotateZ((prop->shape.rot.z / 32768.0f) * 3.1415927f, MTXMODE_APPLY); + phi_s1 = D_808773B0; + if (camera->eye.y > prop->posRot.pos.y) { + phi_s1 = D_80877408; + } + } + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_ganon_otyuka.c", 766), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, phi_s2); + + phi_s0 = 0; + if (phi_s1 != NULL) { + gSPDisplayList(POLY_OPA_DISP++, phi_s1); + phi_s0 = 0; + } + loop_17: + if ((D_80876A64[phi_s0] & otyuka->unk_16C) != 0) { + Matrix_Push(); + Matrix_Translate(D_80876AA0[phi_s0].x, 0.0f, D_80876AA0[phi_s0].z, MTXMODE_APPLY); + Matrix_RotateY(D_80876AD0[phi_s0], MTXMODE_APPLY); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_ganon_otyuka.c", 785), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, D_80877460); + Matrix_Pull(); + } + temp_s0_2 = phi_s0 + 1; + phi_s0 = temp_s0_2; + if ((s32)temp_s0_2 < 4) { + goto loop_17; + } + } + prop = prop->next; + if (temp_s4_4 != NULL) { + goto loop_8; + } + } + func_80093D84(globalCtx->state.gfxCtx); + temp_s4_5 = globalCtx->actorCtx.actorList[ACTORTYPE_PROP].first; + if (temp_s4_5 != 0) { + phi_s4_3 = temp_s4_5; + loop_23: + if ((temp_s4_5->id == ACTOR_BG_GANON_OTYUKA) && (temp_s4_5->projectedPos.z > -30.0f) && + (phi_s4_3->unk_16E != 0)) { + gSPSegment(POLY_XLU_DISP++, 0x08, + Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, temp_a2, 0, 32, 64, 1, temp_a2, 0, 32, 64)); + gDPPipeSync(POLY_XLU_DISP++); + temp_a2 = phi_s4_3->unk_16D * 4; + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, phi_s4_3->unk_174, phi_s4_3->unk_178, phi_s4_3->unk_17C, 0); + gDPSetEnvColor(POLY_XLU_DISP++, phi_s4_3->unk_180, phi_s4_3->unk_184, phi_s4_3->unk_188, 128); + Matrix_Translate(temp_s4_5->posRot.pos.x, 0.0f, temp_s4_5->posRot.pos.z, MTXMODE_NEW); + phi_s0_2 = (u16)0; + loop_27: + if ((D_80876A64[phi_s0_2] & phi_s4_3->unk_16B) != 0) { + Matrix_Push(); + Matrix_Translate(D_80876AA0[phi_s0_2].x, 0.0f, D_80876AA0[phi_s0_2].z, MTXMODE_APPLY); + Matrix_RotateY(D_80876AD0[phi_s0_2], MTXMODE_APPLY); + Matrix_Scale(0.3f, phi_s4_3->unk_170 * 0.3f, 0.3f, MTXMODE_APPLY); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_ganon_otyuka.c", 847), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, D_80877CF8); + Matrix_Pull(); + } + temp_s0_4 = phi_s0_2 + 1; + phi_s0_2 = temp_s0_4; + if ((s32)temp_s0_4 < 4) { + goto loop_27; + } + } + temp_s4_6 = temp_s4_5->next; + phi_s4_3 = temp_s4_6; + if (temp_s4_6 != NULL) { + goto loop_23; + } + } + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_ganon_otyuka.c", 857); +} +#else #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Ganon_Otyuka/BgGanonOtyuka_Draw.s") +#endif diff --git a/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.h b/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.h index f361718ed9..32603e546d 100644 --- a/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.h +++ b/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.h @@ -11,7 +11,20 @@ typedef void (*BgGanonOtyukaActionFunc)(struct BgGanonOtyuka*, GlobalContext*); typedef struct BgGanonOtyuka { /* 0x0000 */ DynaPolyActor dyna; /* 0x0164 */ BgGanonOtyukaActionFunc actionFunc; - /* 0x0168 */ char unk_168[0x24]; + /* 0x0168 */ char unk_168[0x02]; + /* 0x016A */ u8 unk_16A; + /* 0x016B */ u8 unk_16B; + /* 0x016C */ u8 unk_16C; + /* 0x016D */ u8 unk_16D; + /* 0x016E */ u8 unk_16E; + /* 0x016F */ char unk_16F[0x01]; + /* 0x0170 */ f32 unk_170; + /* 0x0174 */ f32 unk_174; + /* 0x0178 */ f32 unk_178; + /* 0x017C */ f32 unk_17C; + /* 0x0180 */ f32 unk_180; + /* 0x0184 */ f32 unk_184; + /* 0x0188 */ f32 unk_188; } BgGanonOtyuka; // size = 0x018C extern const ActorInit Bg_Ganon_Otyuka_InitVars; diff --git a/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.h b/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.h index 45cfa96766..cd80cdef22 100644 --- a/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.h +++ b/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.h @@ -6,12 +6,101 @@ struct BossGanon; +typedef void (*BossGanonActionFunc)(struct BossGanon*, GlobalContext*); + typedef struct BossGanon { /* 0x0000 */ Actor actor; - /* 0x014C */ char unk_14C[0x5CC]; - /* 0x0718 */ s16 organFadeTimer; - /* 0x071A */ char unk_71A[0x2]; -} BossGanon; // size = 0x071C + /* 0x014C */ s32 animBankIndex; + /* 0x0150 */ SkelAnime skelAnime; + /* 0x0194 */ BossGanonActionFunc actionFunc; + /* 0x0198 */ u8 unk_198; + /* 0x0199 */ u8 unk_199; + /* 0x019A */ u8 unk_19A; + /* 0x019B */ char unk_19B[0x1]; + /* 0x019C */ s16 unk_19C; // timer + /* 0x019E */ u8 unk_19E; + /* 0x019F */ u8 unk_19F; + /* 0x01A0 */ u8 unk_1A0; + /* 0x01A1 */ char unk_1A1[0x1]; + /* 0x01A2 */ s16 unk_1A2; + /* 0x01A4 */ s16 unk_1A4; + /* 0x01A6 */ s16 unk_1A6; // timer + /* 0x01A8 */ s16 unk_1A8; + /* 0x01AA */ s16 unk_1AA; + /* 0x01AC */ s16 unk_1AC; + /* 0x01AE */ s16 unk_1AE; + /* 0x01B0 */ char unk_1B0[0x6]; + /* 0x01B6 */ s16 timers[5]; + /* 0x01C0 */ u8 unk_1C0; // start reflecting + /* 0x01C1 */ char unk_1C1[0x1]; + /* 0x01C2 */ s16 unk_1C2; + /* 0x01C4 */ char unk_1C4[0x4]; + /* 0x01C8 */ f32 unk_1C8; + /* 0x01CC */ f32 animationLength; + /* 0x01D0 */ f32 unk_1D0; + /* 0x01D4 */ f32 unk_1D4; // triforce rgba? + /* 0x01D8 */ f32 unk_1D8; + /* 0x01DC */ f32 unk_1DC; + /* 0x01E0 */ f32 unk_1E0; + /* 0x01E4 */ f32 unk_1E4; + /* 0x01E8 */ f32 unk_1E8; + /* 0x01EC */ char unk_1EC[0x10]; + /* 0x01FC */ Vec3f unk_1FC; + /* 0x0208 */ char unk_208[0x4C]; + /* 0x0254 */ f32 unk_254; + /* 0x0258 */ f32 unk_258; + /* 0x025C */ u8 unk_25C; + /* 0x025D */ char unk_25D[0x3]; + /* 0x0260 */ Vec3f unk_260; // hand position? + /* 0x026C */ s16 unk_26C; // timer? + /* 0x026E */ char unk_26E[0x2]; + /* 0x0270 */ f32 unk_270; + /* 0x0274 */ u8 unk_274; + /* 0x0275 */ char unk_275[0x3]; + /* 0x0278 */ Vec3f unk_278; + /* 0x0284 */ f32 unk_284; + /* 0x0288 */ f32 unk_288; + /* 0x028C */ f32 unk_28C; + /* 0x0290 */ f32 unk_290; + /* 0x0294 */ f32 unk_294[15]; + /* 0x02D0 */ f32 unk_2D0; + /* 0x02D4 */ s16 unk_2D4; // timer + /* 0x02D6 */ char unk_2D6[0xE]; + /* 0x02E4 */ u8 unk_2E4; + /* 0x02E5 */ char unk_2E5[0x1]; + /* 0x02E6 */ s16 unk_2E6; // timer + /* 0x02E8 */ s16 unk_2E8; // timer + /* 0x02EC */ Vec3f unk_2EC[15]; + /* 0x03A0 */ char unk_3A0[0x270]; + /* 0x0610 */ ColliderCylinder collider; + /* 0x065C */ char unk_65C[0x10]; + /* 0x066C */ u8 unk_66C; + /* 0x066D */ char unk_66D[0x1]; + /* 0x066E */ s16 unk_66E; + /* 0x0670 */ char unk_670[0x4]; + /* 0x0674 */ u32 csTimer; + /* 0x0678 */ s16 introCsState; + /* 0x067A */ s16 csCamIndex; + /* 0x067C */ char unk_67C[0x4]; + /* 0x0680 */ Vec3f csCamEye; + /* 0x068C */ Vec3f csCamAt; + /* 0x0698 */ char unk_698[0xC]; + /* 0x06A4 */ Vec3f csCamEyeMaxStep; + /* 0x06B0 */ Vec3f csCamAtMaxStep; + /* 0x06BC */ Vec3f csCamTargetEye; + /* 0x06C8 */ char unk_6C8[0xC]; + /* 0x06D4 */ Vec3f csCamTargetAt; + /* 0x06E0 */ char unk_6E0[0xC]; + /* 0x06EC */ f32 csCamMaxStepScale; + /* 0x06F0 */ f32 csCamMovementScale; + /* 0x06F4 */ f32 csCamFov; + /* 0x06F8 */ char unk_6F8[0xC]; + /* 0x0704 */ f32 unk_704; + /* 0x0708 */ char unk_708[0x10]; + /* 0x0718 */ s16 organAlpha; + /* 0x071A */ s8 unk_71A; + /* 0x071A */ u8 unk_71B; +} BossGanon; // size = 0x71C extern const ActorInit Boss_Ganon_InitVars;