From 58c39701d5e58ebab0a4064284a7607df556379c Mon Sep 17 00:00:00 2001 From: mzxrules Date: Sun, 12 Jun 2022 20:43:13 -0400 Subject: [PATCH] match first couple of funcs --- .../actors/ovl_En_Honotrap/z_en_honotrap.c | 247 +++++++++++++++++- .../actors/ovl_En_Honotrap/z_en_honotrap.h | 36 ++- 2 files changed, 268 insertions(+), 15 deletions(-) diff --git a/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c b/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c index aaea88252..0b2d38c7a 100644 --- a/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c +++ b/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c @@ -5,6 +5,7 @@ */ #include "z_en_honotrap.h" +#include "assets/objects/gameplay_keep/gameplay_keep.h" #define FLAGS (ACTOR_FLAG_10) @@ -30,6 +31,19 @@ void func_8092F5EC(EnHonotrap* this, GlobalContext* globalCtx); void func_8092F7BC(EnHonotrap* this, GlobalContext* globalCtx); void func_8092F878(EnHonotrap* this, GlobalContext* globalCtx); +void func_8092E638(EnHonotrap* this, GlobalContext* globalCtx); // d +void func_8092E840(EnHonotrap* this, GlobalContext* globalCtx); // d +void func_8092E988(EnHonotrap* this, GlobalContext* globalCtx); // d +void func_8092FE44(Actor* thisx, GlobalContext* globalCtx); +void func_8092FEFC(Actor* thisx, GlobalContext* globalCtx); +void func_80930030(Actor* thisx, GlobalContext* globalCtx); +void func_80930190(Actor* thisx, GlobalContext* globalCtx); + +void func_8092EBC0(EnHonotrap* this); +void func_8092EE68(EnHonotrap* this); +void func_8092F0F8(EnHonotrap* this); +void func_8092F854(EnHonotrap* this); + #if 0 const ActorInit En_Honotrap_InitVars = { ACTOR_EN_HONOTRAP, @@ -79,7 +93,8 @@ static InitChainEntry D_809304E0[] = { }; #endif - +extern Gfx* D_809303F0[4]; +extern s32 D_80930400; extern ColliderTrisElementInit D_80930424[2]; extern ColliderTrisInit D_8093049C; extern ColliderCylinderInit D_809304AC; @@ -90,17 +105,136 @@ extern InitChainEntry D_809304E0[]; #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Honotrap/func_8092E5A4.s") -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Honotrap/func_8092E638.s") +// EnHonotrap_InitEye +void func_8092E638(EnHonotrap* this, GlobalContext* globalCtx) { + s32 i; + s32 j; + s32 k; + f32 sin; + f32 cos; + Vec3f sp70[3]; + Vec3f* vtx; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Honotrap/func_8092E840.s") + sin = Math_SinS(this->actor.home.rot.y); + cos = Math_CosS(this->actor.home.rot.y); + Actor_SetScale(&this->actor, 0.1f); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Honotrap/func_8092E988.s") + if (D_80930400 != 0) { + D_80930400 = 0; + for (k = 0; k < 4; k++) { + D_809303F0[k] = Lib_SegmentedToVirtual(D_809303F0[k]); + } + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Honotrap/EnHonotrap_Init.s") + Collider_InitTris(globalCtx, &this->collider.tris); + Collider_SetTris(globalCtx, &this->collider.tris, &this->actor, &D_8093049C, this->collider.elements); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Honotrap/EnHonotrap_Destroy.s") + for (i = 0; i < 2; i++) { + for (j = 0, vtx = sp70; j < 3; j++, vtx++) { + Vec3f* test = &D_8093049C.elements[i].dim.vtx[j]; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Honotrap/func_8092EBC0.s") + vtx->x = (test->z * sin) + (test->x * cos); + vtx->y = test->y; + vtx->z = (test->z * cos) - (test->x * sin); + + Math_Vec3f_Sum(vtx, &this->actor.world.pos, vtx); + } + Collider_SetTrisVertices(&this->collider.tris, i, &sp70[0], &sp70[1], &sp70[2]); + } + Actor_SetFocus(&this->actor, 0.0f); + if (this->actor.params == 0) { + func_8092EBC0(this); + } else { + func_8092EE68(this); + } +} + +// EnHonotrap_InitFlame +void func_8092E840(EnHonotrap* this, GlobalContext* globalCtx) { + s32 pad[2]; + s32 params; + + params = this->actor.params; + Actor_SetScale(&this->actor, 0.0001f); + Collider_InitCylinder(globalCtx, &this->collider.cyl); + Collider_SetCylinder(globalCtx, &this->collider.cyl, &this->actor, &D_809304AC); + Collider_UpdateCylinder(&this->actor, &this->collider.cyl); + this->actor.terminalVelocity = -1.0f; + CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &D_809304D8); + ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); + this->actor.shape.shadowAlpha = 0x80; + this->unk228 = GET_PLAYER(globalCtx)->actor.world.pos; + this->unk228.y += 10.0f; + this->unk23A = Rand_ZeroOne() * 511.0f; + Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_FLAME_IGNITION); + if (params == 2) { + this->actor.room = -1; + this->collider.cyl.dim.radius = 12; + this->collider.cyl.dim.height = 30; + this->actor.shape.yOffset = -1000.0f; + } + func_8092F0F8(this); +} + +void func_8092E988(EnHonotrap* this, GlobalContext* globalCtx) { + EnHonotrap23C* var_s2; + s32 var_s0; + s32 i; + + Actor_SetScale(&this->actor, 0.0001f); + Collider_InitCylinder(globalCtx, &this->collider.cyl); + Collider_SetCylinder(globalCtx, &this->collider.cyl, &this->actor, &D_809304AC); + CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &D_809304D8); + + var_s0 = Rand_ZeroOne() * 511.0f; + var_s2 = &this->unk23C; + for (i = 0; i < 6; i++) { + var_s2->unkC[i].unk_10 = var_s0; + var_s0 += (s32)Rand_ZeroFloat(300.0f) + 0x64; + var_s0 &= 0x1FF; + } + + Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_FLAME_IGNITION); + func_8092F854(this); +} + +void EnHonotrap_Init(Actor* thisx, GlobalContext* globalCtx) { + s32 params; + EnHonotrap* this = (EnHonotrap*)thisx; + + params = this->actor.params; + Actor_ProcessInitChain(&this->actor, D_809304E0); + if ((params == 0) || (params == 3)) { + func_8092E638(this, globalCtx); + } else if (params == 4) { + func_8092E988(this, globalCtx); + this->actor.update = func_8092FEFC; + this->actor.draw = func_80930190; + this->actor.uncullZoneScale = 500.0f; + this->actor.uncullZoneDownward = 500.0f; + } else { + func_8092E840(this, globalCtx); + this->actor.update = func_8092FE44; + this->actor.draw = func_80930030; + } +} + +void EnHonotrap_Destroy(Actor* thisx, GlobalContext* globalCtx) { + s16 params; + EnHonotrap* this = (EnHonotrap*)thisx; + + params = this->actor.params; + if ((params == 0) || (params == 3)) { + Collider_DestroyTris(globalCtx, &this->collider.tris); + } else { + Collider_DestroyCylinder(globalCtx, &this->collider.cyl); + } +} + +void func_8092EBC0(EnHonotrap* this) { + this->actionFunc = func_8092EBDC; + this->unk222 = 3; +} #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Honotrap/func_8092EBDC.s") @@ -116,7 +250,12 @@ extern InitChainEntry D_809304E0[]; #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Honotrap/func_8092EE1C.s") -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Honotrap/func_8092EE68.s") +void func_8092EE68(EnHonotrap* this) { + this->unk222 = 3; + this->unk220 = 0x50; + this->unk224 = 0; + this->actionFunc = func_8092EE90; +} #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Honotrap/func_8092EE90.s") @@ -152,18 +291,102 @@ extern InitChainEntry D_809304E0[]; #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Honotrap/func_8092F7BC.s") -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Honotrap/func_8092F854.s") +void func_8092F854(EnHonotrap* this) { + this->actionFunc = func_8092F878; + this->unk220 = 0x50; + this->unk23C.unk_08 = 0.0f; +} #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Honotrap/func_8092F878.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Honotrap/EnHonotrap_Update.s") -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Honotrap/func_8092FE44.s") +void func_8092FE44(Actor* thisx, GlobalContext* globalCtx) { + EnHonotrap* this = (EnHonotrap*)thisx; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Honotrap/func_8092FEFC.s") + if (this->unk220 > 0) { + this->unk220--; + } + this->unk2C0 = 0; // + 23C + 0x10 + 0x64 + 0x10 = s8 + this->unk238 += 0x640; + if (this->actor.params != 4) { + this->actor.shape.yOffset = Math_SinS(this->unk238) * 1000.0f + 600.0f; + } + Actor_SetFocus(&this->actor, 5.0f); + Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BURN_OUT - SFX_FLAG); + this->actionFunc(this, globalCtx); + this->unk23A -= 0x14; + this->unk23A &= 0x1FF; +} + +void func_8092FEFC(Actor* thisx, GlobalContext* globalCtx) { + EnHonotrap* this = (EnHonotrap*)thisx; + Actor* temp_v0; + + temp_v0 = this->actor.parent; + if ((temp_v0 != NULL) && (temp_v0->update == NULL)) { + this->actor.parent = NULL; + } + if (this->unk220 > 0) { + this->unk220--; + } + this->unk238 += 0x640; + Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BURN_OUT - SFX_FLAG); + this->actionFunc(this, globalCtx); +} #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Honotrap/EnHonotrap_Draw.s") -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Honotrap/func_80930030.s") +void func_80930030(Actor* thisx, GlobalContext* globalCtx) { + s32 pad; + EnHonotrap* this = (EnHonotrap*)thisx; + OPEN_DISPS(globalCtx->state.gfxCtx); + func_8012C2DC(globalCtx->state.gfxCtx); + gSPSegment(POLY_XLU_DISP++, 0x08, + Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, this->unk23A, 32, 128)); + gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 200, 0, 255); + gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0); + Matrix_RotateYS(Camera_GetCamDirYaw(globalCtx->cameraPtrs[globalCtx->activeCamera]) + 0x8000, MTXMODE_APPLY); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, gGameplayKeepDrawFlameDL); + CLOSE_DISPS(globalCtx->state.gfxCtx); +} + +#ifdef NON_MATCHING +void func_80930190(Actor* thisx, GlobalContext* globalCtx) { + EnHonotrap* this = (EnHonotrap*)thisx; + Vec3s spB8; + EnHonotrapArr* temp_s0; + EnHonotrap23C* var_s3; + s32 i; // s4 + + OPEN_DISPS(globalCtx->state.gfxCtx); + func_8012C2DC(globalCtx->state.gfxCtx); + gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 200, 0, 255); + gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0); + func_800DFC90(&spB8, globalCtx->cameraPtrs[globalCtx->activeCamera]); + spB8.y += 0x8000; + var_s3 = &this->unk23C; + for (i = 0; i < 6; i++) { + temp_s0 = &var_s3->unkC[i]; + if (temp_s0->unk12 != 0) { + gSPSegment( + POLY_XLU_DISP++, 0x08, + Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, temp_s0->unk_10, 0x20, 0x80)); + Matrix_SetTranslateRotateYXZ(temp_s0->unk0.x, temp_s0->unk0.y - (4000.0f * temp_s0->unkC), temp_s0->unk0.z, + &spB8); + // temp_fa1 = temp_s0->unkC; + Matrix_Scale(((fabsf(Math_SinS((s16)(spB8.y - this->actor.shape.rot.y) >> 1)) * 0.2f) + 1.7f) * + temp_s0->unkC, + temp_s0->unkC, 1.0f, MTXMODE_APPLY); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, gGameplayKeepDrawFlameDL); + } + } + CLOSE_DISPS(globalCtx->state.gfxCtx); +} +#else #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Honotrap/func_80930190.s") +#endif diff --git a/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.h b/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.h index f9983e26a..2e3174648 100644 --- a/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.h +++ b/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.h @@ -7,10 +7,40 @@ struct EnHonotrap; typedef void (*EnHonotrapActionFunc)(struct EnHonotrap*, GlobalContext*); +typedef union { + struct { + ColliderTris tris; + ColliderTrisElement elements[2]; + }; + ColliderCylinder cyl; +} EnHonotrapCollider; // size = 0xD8 + +typedef struct { + /* 0x00 */ Vec3f unk0; + /* 0x0C */ f32 unkC; + /* 0x10 */ s16 unk_10; + /* 0x12 */ u8 unk12; +} EnHonotrapArr; //size 0x14 + +typedef struct { + char unk0[0x8]; + f32 unk_08; + EnHonotrapArr unkC[6]; +} EnHonotrap23C; + typedef struct EnHonotrap { - /* 0x0000 */ Actor actor; - /* 0x0144 */ EnHonotrapActionFunc actionFunc; - /* 0x0148 */ char unk_148[0x17C]; + /* 0x000 */ Actor actor; + /* 0x144 */ EnHonotrapActionFunc actionFunc; + /* 0x148 */ EnHonotrapCollider collider; + /* 0x220 */ s16 unk220; + /* 0x222 */ s16 unk222; + /* 0x224 */ s16 unk224; + /* 0x228 */ Vec3f unk228; + /* 0x234 */ char pad234[4]; + /* 0x238 */ s16 unk238; + /* 0x23A */ s16 unk23A; + /* 0x23C */ EnHonotrap23C unk23C; + /* 0x2C0 */ s8 unk2C0; } EnHonotrap; // size = 0x2C4 extern const ActorInit En_Honotrap_InitVars;