From 58c39701d5e58ebab0a4064284a7607df556379c Mon Sep 17 00:00:00 2001 From: mzxrules Date: Sun, 12 Jun 2022 20:43:13 -0400 Subject: [PATCH 01/11] 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; From 4d783cdd698a4c0020db7b047455592c1644ee68 Mon Sep 17 00:00:00 2001 From: mzxrules Date: Mon, 16 Jan 2023 04:49:16 -0500 Subject: [PATCH 02/11] Attempt all functions --- .../actors/ovl_En_Honotrap/z_en_honotrap.c | 500 ++++++++++++++++-- .../actors/ovl_En_Honotrap/z_en_honotrap.h | 9 +- 2 files changed, 461 insertions(+), 48 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 97804d2f4..3e56c0970 100644 --- a/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c +++ b/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c @@ -16,33 +16,44 @@ void EnHonotrap_Destroy(Actor* thisx, PlayState* play); void EnHonotrap_Update(Actor* thisx, PlayState* play); void EnHonotrap_Draw(Actor* thisx, PlayState* play); +void func_8092E5A4(Vec3f* arg0, Vec3f* arg1); +void func_8092E638(EnHonotrap* this, PlayState* play); +void func_8092E840(EnHonotrap* this, PlayState* play); +void func_8092E988(EnHonotrap* this, PlayState* play); +void func_8092EBC0(EnHonotrap* this); void func_8092EBDC(EnHonotrap* this, PlayState* play); +void func_8092EC9C(EnHonotrap* this); void func_8092ECF0(EnHonotrap* this, PlayState* play); +void func_8092EDC0(EnHonotrap* this); void func_8092EDD8(EnHonotrap* this, PlayState* play); +void func_8092EE08(EnHonotrap* this); void func_8092EE1C(EnHonotrap* this, PlayState* play); +void func_8092EE68(EnHonotrap* this); void func_8092EE90(EnHonotrap* this, PlayState* play); +void func_8092EF3C(EnHonotrap* this); void func_8092EF98(EnHonotrap* this, PlayState* play); +void func_8092F05C(EnHonotrap* this); void func_8092F074(EnHonotrap* this, PlayState* play); +void func_8092F0A4(EnHonotrap* this); void func_8092F0B8(EnHonotrap* this, PlayState* play); +void func_8092F0F8(EnHonotrap* this); void func_8092F10C(EnHonotrap* this, PlayState* play); +void func_8092F1A0(EnHonotrap* this); void func_8092F208(EnHonotrap* this, PlayState* play); +void func_8092F34C(EnHonotrap* this); void func_8092F3D8(EnHonotrap* this, PlayState* play); +void func_8092F5AC(EnHonotrap* this); void func_8092F5EC(EnHonotrap* this, PlayState* play); +void func_8092F7A8(EnHonotrap* this); void func_8092F7BC(EnHonotrap* this, PlayState* play); +void func_8092F854(EnHonotrap* this); void func_8092F878(EnHonotrap* this, PlayState* play); - -void func_8092E638(EnHonotrap* this, PlayState* play); // d -void func_8092E840(EnHonotrap* this, PlayState* play); // d -void func_8092E988(EnHonotrap* this, PlayState* play); // d void func_8092FE44(Actor* thisx, PlayState* play); void func_8092FEFC(Actor* thisx, PlayState* play); void func_80930030(Actor* thisx, PlayState* play); void func_80930190(Actor* thisx, PlayState* play); -void func_8092EBC0(EnHonotrap* this); -void func_8092EE68(EnHonotrap* this); -void func_8092F0F8(EnHonotrap* this); -void func_8092F854(EnHonotrap* this); +extern Gfx D_050085F0; #if 0 ActorInit En_Honotrap_InitVars = { @@ -101,9 +112,33 @@ extern ColliderCylinderInit D_809304AC; extern CollisionCheckInfoInit D_809304D8; extern InitChainEntry D_809304E0[]; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Honotrap/func_8092E510.s") +void func_8092E510(EnHonotrap* this, PlayState* play) { + s32 pad[3]; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Honotrap/func_8092E5A4.s") + Collider_UpdateCylinder(&this->actor, &this->collider.cyl); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.tris.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.tris.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.tris.base); + this->unk2C0 |= 1; + this->unk2C0 |= 2; + this->unk2C0 |= 4; +} + +void func_8092E5A4(Vec3f* arg0, Vec3f* arg1) { + f32 temp_fv0; + f32 temp_fv1; + + temp_fv0 = Math3D_Vec3fMagnitude(arg1); + if (temp_fv0 < 0.001f) { + arg0->x = arg0->y = 0.0f; + arg0->z = 1.0f; + return; + } + temp_fv1 = 1.0f / temp_fv0; + arg0->x = arg1->x * temp_fv1; + arg0->y = arg1->y * temp_fv1; + arg0->z = arg1->z * temp_fv1; +} // EnHonotrap_InitEye void func_8092E638(EnHonotrap* this, PlayState* play) { @@ -236,19 +271,66 @@ void func_8092EBC0(EnHonotrap* this) { this->unk222 = 3; } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Honotrap/func_8092EBDC.s") +void func_8092EBDC(EnHonotrap* this, PlayState* play) { + f32 temp_fv0; + s16 temp_v0; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Honotrap/func_8092EC9C.s") + if (this->actor.child != NULL) { + this->unk220 = 0xC8; + return; + } + if ((this->unk220 <= 0) && (this->actor.xzDistToPlayer < 750.0f)) { + temp_fv0 = this->actor.playerHeightRel; + if ((temp_fv0 < 0.0f) && (temp_fv0 > -700.0f)) { + temp_v0 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + if ((temp_v0 >= -0x3FFF) && (temp_v0 < 0x4000)) { + func_8092EC9C(this); + } + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Honotrap/func_8092ECF0.s") +void func_8092EC9C(EnHonotrap* this) { + this->actionFunc = func_8092ECF0; + Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 40); + this->unk220 = 30; + Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_RED_EYE); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Honotrap/func_8092EDC0.s") +void func_8092ECF0(EnHonotrap* this, PlayState* play) { + this->unk222 -= 1; + if (this->unk222 <= 0) { + func_8092EDC0(this); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_HONOTRAP, + (Math_SinS(this->actor.shape.rot.y) * 12.0f) + this->actor.home.pos.x, + this->actor.home.pos.y - 10.0f, + (Math_CosS(this->actor.shape.rot.y) * 12.0f) + this->actor.home.pos.z, + this->actor.home.rot.x, this->actor.home.rot.y, this->actor.home.rot.z, 1); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Honotrap/func_8092EDD8.s") +void func_8092EDC0(EnHonotrap* this) { + this->actionFunc = func_8092EDD8; + this->unk222 = 0; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Honotrap/func_8092EE08.s") +void func_8092EDD8(EnHonotrap* this, PlayState* play) { + if (this->unk220 <= 0) { + func_8092EE08(this); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Honotrap/func_8092EE1C.s") +void func_8092EE08(EnHonotrap* this) { + this->actionFunc = func_8092EE1C; +} + +void func_8092EE1C(EnHonotrap* this, PlayState* play) { + this->unk222 += 1; + if (this->unk222 >= 3) { + func_8092EBC0(this); + this->unk220 = 200; + } +} void func_8092EE68(EnHonotrap* this) { this->unk222 = 3; @@ -257,49 +339,372 @@ void func_8092EE68(EnHonotrap* this) { this->actionFunc = func_8092EE90; } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Honotrap/func_8092EE90.s") +void func_8092EE90(EnHonotrap* this, PlayState* play) { + f32 temp_fv0; + s16 temp_v0; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Honotrap/func_8092EF3C.s") + if ((this->unk220 <= 0) && (this->actor.xzDistToPlayer < 120.0f)) { + temp_fv0 = this->actor.playerHeightRel; + if ((temp_fv0 < 0.0f) && (temp_fv0 > -700.0f)) { + temp_v0 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + if ((temp_v0 >= -0x3FFF) && (temp_v0 < 0x4000)) { + func_8092EF3C(this); + } + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Honotrap/func_8092EF98.s") +void func_8092EF3C(EnHonotrap* this) { + Actor_PlaySfxAtPos(&this->actor, 0x2881U); + Actor_SetColorFilter(&this->actor, 0x4000U, 255, 0, 40); + this->unk220 = 0x28; + this->actionFunc = func_8092EF98; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Honotrap/func_8092F05C.s") +void func_8092EF98(EnHonotrap* this, PlayState* play) { + s32 pad; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Honotrap/func_8092F074.s") + this->unk222 -= 1; + if (this->unk222 <= 0) { + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_HONOTRAP, + (Math_SinS(this->actor.shape.rot.y) * 12.0f) + this->actor.home.pos.x, + this->actor.home.pos.y, + (Math_CosS(this->actor.shape.rot.y) * 12.0f) + this->actor.home.pos.z, + this->actor.home.rot.x, this->actor.home.rot.y, this->actor.home.rot.z, 4); + func_8092F05C(this); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Honotrap/func_8092F0A4.s") +void func_8092F05C(EnHonotrap* this) { + this->actionFunc = func_8092F074; + this->unk222 = 0; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Honotrap/func_8092F0B8.s") +void func_8092F074(EnHonotrap* this, PlayState* play) { + if (this->unk220 <= 0) { + func_8092F0A4(this); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Honotrap/func_8092F0F8.s") +void func_8092F0A4(EnHonotrap* this) { + this->actionFunc = func_8092F0B8; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Honotrap/func_8092F10C.s") +void func_8092F0B8(EnHonotrap* this, PlayState* play) { + this->unk222 += 1; + if (this->unk222 >= 3) { + func_8092EE68(this); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Honotrap/func_8092F1A0.s") +void func_8092F0F8(EnHonotrap* this) { + this->actionFunc = func_8092F10C; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Honotrap/func_8092F208.s") +void func_8092F10C(EnHonotrap* this, PlayState* play) { + f32 temp_fv0; + f32 var_fv0; + s32 temp_v0; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Honotrap/func_8092F34C.s") + if (this->actor.params == 1) { + var_fv0 = 0.004f; + } else { + var_fv0 = 0.0048f; + } + temp_v0 = Math_StepToF(&this->actor.scale.x, var_fv0, 0.0006f); + temp_fv0 = this->actor.scale.x; + this->actor.scale.y = temp_fv0; + this->actor.scale.z = temp_fv0; + if (temp_v0 != 0) { + if (this->actor.params == 1) { + func_8092F34C(this); + return; + } + func_8092F1A0(this); + } +} +void func_8092F1A0(EnHonotrap* this) { + this->unk220 = 0x28; + this->actor.velocity.y = 1.0f; + this->actor.velocity.x = 2.0f * Math_SinS(this->actor.world.rot.y); + this->actor.velocity.z = 2.0f * Math_CosS(this->actor.world.rot.y); + this->actionFunc = func_8092F208; +} + +void func_8092F208(EnHonotrap* this, PlayState* play) { + if ((this->collider.tris.base.atFlags & 2) || (this->unk220 <= 0)) { + if ((this->collider.tris.base.atFlags & 2) && !(this->collider.tris.base.atFlags & 4)) { + func_800B8D98(play, &this->actor, 5.0f, this->actor.yawTowardsPlayer, 0.0f); + } + this->actor.velocity.z = 0.0f; + this->actor.velocity.y = 0.0f; + this->actor.velocity.x = 0.0f; + func_8092F7A8(this); + return; + } + if (this->actor.velocity.y > 0.0f) { + this->actor.world.pos.x += this->actor.velocity.x; + this->actor.world.pos.z += this->actor.velocity.z; + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 12.0f, 0.0f, 5U); + } + if (Math_StepToF(&this->actor.world.pos.y, this->actor.floorHeight + 1.0f, this->actor.velocity.y) == 0) { + this->actor.velocity.y += 1.0f; + } else { + this->actor.velocity.y = 0.0f; + } + func_8092E510(this, play); +} + +void func_8092F34C(EnHonotrap* this) { + f32 temp_fv1; + + this->actionFunc = func_8092F3D8; + temp_fv1 = 1.0f / (Actor_DistanceToPoint(&this->actor, &this->unk228) + 1.0f); + this->actor.velocity.x = (this->unk228.x - this->actor.world.pos.x) * temp_fv1; + this->actor.velocity.y = (this->unk228.y - this->actor.world.pos.y) * temp_fv1; + this->actor.velocity.z = (this->unk228.z - this->actor.world.pos.z) * temp_fv1; + this->unk220 = 160; + this->unk234 = 0.0f; +} + +#ifdef NON_MATCHING +void func_8092F3D8(EnHonotrap* this, PlayState* play) { + s32 pad; + Vec3f sp60; + + s32 temp_s1; + Player* player; + + Vec3f sp4C; + Vec3f sp40; + Vec3f sp34; + + Math_StepToF(&this->unk234, 13.0f, 0.5f); + sp60.x = fabsf(this->unk234 * this->actor.velocity.x); + sp60.y = fabsf(this->unk234 * this->actor.velocity.y); + sp60.z = fabsf(this->unk234 * this->actor.velocity.z); + temp_s1 = 1; + temp_s1 &= Math_StepToF(&this->actor.world.pos.x, this->unk228.x, sp60.x); + temp_s1 &= Math_StepToF(&this->actor.world.pos.y, this->unk228.y, sp60.y); + temp_s1 &= Math_StepToF(&this->actor.world.pos.z, this->unk228.z, sp60.z); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 0.0f, 0x1DU); + + if (this->collider.tris.base.atFlags & 4) { + player = GET_PLAYER(play); + sp34.x = -player->shieldMf.xz; + sp34.y = -player->shieldMf.yz; + sp34.z = -player->shieldMf.zz; + func_8092E5A4(&sp4C, &sp34); + sp40 = this->actor.velocity; + func_80179F64(&sp40, &sp4C, &this->actor.velocity); + this->actor.speedXZ = this->unk234 * 0.5f; + this->actor.world.rot.y = Math_Atan2S_XY(this->actor.velocity.z, this->actor.velocity.x); + func_8092F7A8(this); + return; + } + if (this->collider.tris.base.atFlags & 2) { + this->actor.speedXZ = 0.0f; + this->actor.velocity.y = 0.0f; + func_8092F7A8(this); + return; + } + if (this->unk220 <= 0) { + func_8092F7A8(this); + return; + } + func_8092E510(this, play); + if (temp_s1 != 0) { + func_8092F5AC(this); + } +} +#else #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Honotrap/func_8092F3D8.s") +#endif -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Honotrap/func_8092F5AC.s") +void func_8092F5AC(EnHonotrap* this) { + this->actionFunc = func_8092F5EC; + this->actor.speedXZ = 0.0f; + this->actor.velocity.x = this->actor.velocity.y = this->actor.velocity.z = 0.0f; + this->unk220 = 100; + this->actor.world.rot.x = this->actor.world.rot.y = this->actor.world.rot.z = 0; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Honotrap/func_8092F5EC.s") +void func_8092F5EC(EnHonotrap* this, PlayState* play) { + s32 pad; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Honotrap/func_8092F7A8.s") + Math_ScaledStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 0x300); + Math_StepToF(&this->actor.speedXZ, 3.0f, 0.1f); + if (-this->actor.playerHeightRel < 10.0f) { + this->actor.gravity = 0.08f; + } else { + this->actor.gravity = -0.08f; + } + Actor_UpdateVelocityWithGravity(&this->actor); + if (this->actor.velocity.y > 1.0f) { + this->actor.velocity.y = 1.0f; + } + this->actor.velocity.y *= 0.95f; + Actor_UpdatePos(&this->actor); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 0.0f, 0x1DU); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Honotrap/func_8092F7BC.s") + if (this->collider.tris.base.atFlags & 4) { + Player* player = GET_PLAYER(play); + Vec3s sp30; + + Matrix_MtxFToYXZRot(&player->shieldMf, &sp30, 0); + this->actor.world.rot.y = ((sp30.y * 2) - this->actor.world.rot.y) + 0x8000; + func_8092F7A8(this); + } else if (this->collider.tris.base.atFlags & 2) { + this->actor.speedXZ *= 0.1f; + this->actor.velocity.y *= 0.1f; + func_8092F7A8(this); + } else if ((this->actor.bgCheckFlags & 8) || (this->unk220 <= 0)) { + func_8092F7A8(this); + } else { + func_8092E510(this, play); + } +} + +void func_8092F7A8(EnHonotrap* this) { + this->actionFunc = func_8092F7BC; +} + +void func_8092F7BC(EnHonotrap* this, PlayState* play) { + f32 temp_fv0; + s32 sp28 = Math_StepToF(&this->actor.scale.x, 0.0001f, 0.00015f); + temp_fv0 = this->actor.scale.x; + this->actor.scale.y = temp_fv0; + this->actor.scale.z = temp_fv0; + Actor_MoveWithGravity(&this->actor); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 0.0f, 0x1DU); + if (sp28 != 0) { + Actor_Kill(&this->actor); + } +} void func_8092F854(EnHonotrap* this) { this->actionFunc = func_8092F878; this->unk220 = 0x50; - this->unk23C.unk_08 = 0.0f; + this->unk23C.unk8 = 0.0f; } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Honotrap/func_8092F878.s") +void func_8092F878(EnHonotrap* this, PlayState* play) { + s32 var_v0; + EnHonotrap23C* sp98; + f32 var_fs0; + f32 temp_fs0; + f32 temp_fs1; + f32 sp88; + f32 sp84; + f32 sp80; + s32 sp7C; + s32 sp78; + f32 var_fs0_2; + Vec3f sp68; + EnHonotrapArr* var_s0; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Honotrap/EnHonotrap_Update.s") + sp98 = &this->unk23C; + sp78 = 0; + sp80 = fabsf(Math_CosS(Camera_GetCamDirPitch(play->cameraPtrs[play->activeCamId]))); + sp7C = (s32)(sp80 * -10.5f) - 10; + Math_StepToF(&sp98->unk0, 1.0f, 0.05f); + if (this->unk220 <= 40) { + sp78 = Math_StepToF(&sp98->unk4, 1.0f, 0.05f); + } else if (this->actor.parent == NULL) { + this->unk220 = 40; + } + for (var_v0 = 0; var_v0 < 6; var_v0++) { + sp98->unkC[var_v0].unk12 = 0; + } + + sp88 = Math_SinS(this->actor.shape.rot.y) * 120.0f; + sp84 = Math_CosS(this->actor.shape.rot.y) * 120.0f; + + sp98->unk8 += 0.050f * (1.0f - sp98->unk4); + + if (sp98->unk8 > 0.16666667f) { + sp98->unk8 -= 0.16666667f; + } + var_fs0 = sp98->unk4 + sp98->unk8; + + for (var_v0 = 0; var_v0 < 6 && (var_fs0 <= sp98->unk0); var_v0++) { + var_s0 = &sp98->unkC[var_v0]; + var_s0->unk12 = 1; + + var_s0->unk0.x = (f32)((sp88 * var_fs0) + this->actor.world.pos.x); + var_s0->unk0.y = (f32)this->actor.world.pos.y; + var_s0->unk0.z = (f32)((sp84 * var_fs0) + this->actor.world.pos.z); + + var_s0->unkC = Math_SinS((s16)(s32)(var_fs0 * 25486.223f)) * 1.6f; + if (var_s0->unkC > 1.0f) { + var_s0->unkC = 1.0f; + } else if (var_s0->unkC < 0.0f) { + var_s0->unkC = 0.0f; + } + + var_fs0 += 0.16666667f; + var_s0->unkC = (f32)(var_s0->unkC * (0.006f * (((1.0f - sp98->unk4) * 0.8f) + 0.2f))); + var_s0->unk_10 = (s16)(var_s0->unk_10 + sp7C); + var_s0->unk_10 = (s16)(var_s0->unk_10 & 0x1FF); + } + + if ((sp78 != 0) || (this->unk220 <= 0)) { + Actor_Kill(&this->actor); + return; + } + temp_fs0 = sp98->unk0 * 120.0f; + temp_fs1 = sp98->unk4 * 120.0f; + Actor_OffsetOfPointInActorCoords(&this->actor, &sp68, &GET_PLAYER(play)->actor.world.pos); + + if (sp68.z < temp_fs1) { + sp68.z = temp_fs1; + } else if (temp_fs0 < sp68.z) { + sp68.z = temp_fs0; + } + + var_fs0_2 = Math_SinS((s16)(s32)(sp68.z * 212.3852f)) * 1.6f; + if (var_fs0_2 > 1.0f) { + var_fs0_2 = 1.0f; + } + sp80 *= ((1.0f - sp98->unk4) * 0.8f) + 0.2f; + if (sp80 > 0.2f) { + this->collider.cyl.dim.pos.x = + (s16)(s32)((Math_SinS(this->actor.shape.rot.y) * sp68.z) + this->actor.world.pos.x); + this->collider.cyl.dim.pos.y = (s16)(s32)(this->actor.world.pos.y - (24.0f * var_fs0_2)); + this->collider.cyl.dim.pos.z = + (s16)(s32)((Math_CosS(this->actor.shape.rot.y) * sp68.z) + this->actor.world.pos.z); + this->collider.cyl.dim.radius = (s16)(s32)(15.0f * var_fs0_2); + this->collider.cyl.dim.height = (s16)(s32)(37.5f * var_fs0_2); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.tris.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.tris.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.tris.base); + } +} + +extern Vec3f D_809304EC; +extern Vec3f D_809304F8; + +void EnHonotrap_Update(Actor* thisx, PlayState* play) { + EnHonotrap* this = (EnHonotrap*)thisx; + + if (this->unk220 > 0) { + this->unk220 -= 1; + } + if ((this->actor.child != NULL) && (this->actor.child->update == NULL)) { + this->actor.child = NULL; + } + this->actionFunc(this, play); + if (this->collider.tris.base.acFlags & 2) { + EffectSsBomb2_SpawnLayered(play, &this->actor.world.pos, &D_809304EC, &D_809304F8, 15, 8); + Actor_Kill(&this->actor); + return; + } + if (this->unk222 < 3) { + this->collider.tris.base.acFlags &= ~AC_HIT; + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.tris.base); + } +} void func_8092FE44(Actor* thisx, PlayState* play) { EnHonotrap* this = (EnHonotrap*)thisx; @@ -307,7 +712,7 @@ void func_8092FE44(Actor* thisx, PlayState* play) { if (this->unk220 > 0) { this->unk220--; } - this->unk2C0 = 0; // + 23C + 0x10 + 0x64 + 0x10 = s8 + this->unk2C0 = 0; this->unk238 += 0x640; if (this->actor.params != 4) { this->actor.shape.yOffset = Math_SinS(this->unk238) * 1000.0f + 600.0f; @@ -335,7 +740,16 @@ void func_8092FEFC(Actor* thisx, PlayState* play) { this->actionFunc(this, play); } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Honotrap/EnHonotrap_Draw.s") +void EnHonotrap_Draw(Actor* thisx, PlayState* play) { + EnHonotrap* this = (EnHonotrap*)thisx; + + OPEN_DISPS(play->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); + gSPSegment(POLY_OPA_DISP++, 0x08, D_809303F0[this->unk222]); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, &D_050085F0); + CLOSE_DISPS(play->state.gfxCtx); +} void func_80930030(Actor* thisx, PlayState* play) { s32 pad; @@ -365,23 +779,21 @@ void func_80930190(Actor* thisx, PlayState* play) { func_8012C2DC(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 200, 0, 255); gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0); - func_800DFC90(&spB8, play->cameraPtrs[play->activeCamId]); + Camera_GetCamDir(&spB8, play->cameraPtrs[play->activeCamId]); 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(play->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, temp_s0->unk_10, 0x20, 0x80)); + gSPSegment(POLY_XLU_DISP++, 0x08, + Gfx_TwoTexScroll(play->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(play->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); } } 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 f53bdac73..d101d9506 100644 --- a/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.h +++ b/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.h @@ -23,8 +23,9 @@ typedef struct { } EnHonotrapArr; //size 0x14 typedef struct { - char unk0[0x8]; - f32 unk_08; + f32 unk0; + f32 unk4; + f32 unk8; EnHonotrapArr unkC[6]; } EnHonotrap23C; @@ -36,11 +37,11 @@ typedef struct EnHonotrap { /* 0x222 */ s16 unk222; /* 0x224 */ s16 unk224; /* 0x228 */ Vec3f unk228; - /* 0x234 */ char pad234[4]; + /* 0x234 */ f32 unk234; /* 0x238 */ s16 unk238; /* 0x23A */ s16 unk23A; /* 0x23C */ EnHonotrap23C unk23C; - /* 0x2C0 */ s8 unk2C0; + /* 0x2C0 */ u8 unk2C0; } EnHonotrap; // size = 0x2C4 #endif // Z_EN_HONOTRAP_H From 404dc163e11c340527d866852632eeb338438591 Mon Sep 17 00:00:00 2001 From: mzxrules Date: Mon, 9 Oct 2023 00:13:52 -0400 Subject: [PATCH 03/11] add flags, func_80930190 OK --- .../actors/ovl_En_Honotrap/z_en_honotrap.c | 51 ++++++++++--------- 1 file changed, 27 insertions(+), 24 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 1c4dec2e6..3cd6e0159 100644 --- a/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c +++ b/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c @@ -292,7 +292,7 @@ void func_8092EBDC(EnHonotrap* this, PlayState* play) { void func_8092EC9C(EnHonotrap* this) { this->actionFunc = func_8092ECF0; - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 40); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, 0, 40); this->unk220 = 30; Actor_PlaySfx(&this->actor, NA_SE_EV_RED_EYE); } @@ -355,8 +355,8 @@ void func_8092EE90(EnHonotrap* this, PlayState* play) { } void func_8092EF3C(EnHonotrap* this) { - Actor_PlaySfx(&this->actor, 0x2881U); - Actor_SetColorFilter(&this->actor, 0x4000U, 255, 0, 40); + Actor_PlaySfx(&this->actor, NA_SE_EV_RED_EYE); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, 0, 40); this->unk220 = 0x28; this->actionFunc = func_8092EF98; } @@ -433,8 +433,8 @@ void func_8092F1A0(EnHonotrap* this) { } void func_8092F208(EnHonotrap* this, PlayState* play) { - if ((this->collider.tris.base.atFlags & 2) || (this->unk220 <= 0)) { - if ((this->collider.tris.base.atFlags & 2) && !(this->collider.tris.base.atFlags & 4)) { + if ((this->collider.tris.base.atFlags & AT_HIT) || (this->unk220 <= 0)) { + if ((this->collider.tris.base.atFlags & AT_HIT) && !(this->collider.tris.base.atFlags & AT_BOUNCED)) { func_800B8D98(play, &this->actor, 5.0f, this->actor.yawTowardsPlayer, 0.0f); } this->actor.velocity.z = 0.0f; @@ -446,7 +446,7 @@ void func_8092F208(EnHonotrap* this, PlayState* play) { if (this->actor.velocity.y > 0.0f) { this->actor.world.pos.x += this->actor.velocity.x; this->actor.world.pos.z += this->actor.velocity.z; - Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 12.0f, 0.0f, 5U); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 12.0f, 0.0f, UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4); } if (Math_StepToF(&this->actor.world.pos.y, this->actor.floorHeight + 1.0f, this->actor.velocity.y) == 0) { this->actor.velocity.y += 1.0f; @@ -488,9 +488,11 @@ void func_8092F3D8(EnHonotrap* this, PlayState* play) { temp_s1 &= Math_StepToF(&this->actor.world.pos.x, this->unk228.x, sp60.x); temp_s1 &= Math_StepToF(&this->actor.world.pos.y, this->unk228.y, sp60.y); temp_s1 &= Math_StepToF(&this->actor.world.pos.z, this->unk228.z, sp60.z); - Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 0.0f, 0x1DU); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 0.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | + UPDBGCHECKINFO_FLAG_10); - if (this->collider.tris.base.atFlags & 4) { + if (this->collider.tris.base.atFlags & AT_BOUNCED) { player = GET_PLAYER(play); sp34.x = -player->shieldMf.xz; sp34.y = -player->shieldMf.yz; @@ -503,7 +505,7 @@ void func_8092F3D8(EnHonotrap* this, PlayState* play) { func_8092F7A8(this); return; } - if (this->collider.tris.base.atFlags & 2) { + if (this->collider.tris.base.atFlags & AT_HIT) { this->actor.speed = 0.0f; this->actor.velocity.y = 0.0f; func_8092F7A8(this); @@ -546,20 +548,22 @@ void func_8092F5EC(EnHonotrap* this, PlayState* play) { } this->actor.velocity.y *= 0.95f; Actor_UpdatePos(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 0.0f, 0x1DU); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 0.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | + UPDBGCHECKINFO_FLAG_10); - if (this->collider.tris.base.atFlags & 4) { + if (this->collider.tris.base.atFlags & AT_BOUNCED) { Player* player = GET_PLAYER(play); Vec3s sp30; Matrix_MtxFToYXZRot(&player->shieldMf, &sp30, 0); this->actor.world.rot.y = ((sp30.y * 2) - this->actor.world.rot.y) + 0x8000; func_8092F7A8(this); - } else if (this->collider.tris.base.atFlags & 2) { + } else if (this->collider.tris.base.atFlags & AT_HIT) { this->actor.speed *= 0.1f; this->actor.velocity.y *= 0.1f; func_8092F7A8(this); - } else if ((this->actor.bgCheckFlags & 8) || (this->unk220 <= 0)) { + } else if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || (this->unk220 <= 0)) { func_8092F7A8(this); } else { func_8092E510(this, play); @@ -577,7 +581,9 @@ void func_8092F7BC(EnHonotrap* this, PlayState* play) { this->actor.scale.y = temp_fv0; this->actor.scale.z = temp_fv0; Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 0.0f, 0x1DU); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 0.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | + UPDBGCHECKINFO_FLAG_10); if (sp28 != 0) { Actor_Kill(&this->actor); } @@ -695,7 +701,7 @@ void EnHonotrap_Update(Actor* thisx, PlayState* play) { this->actor.child = NULL; } this->actionFunc(this, play); - if (this->collider.tris.base.acFlags & 2) { + if (this->collider.tris.base.acFlags & AC_HIT) { EffectSsBomb2_SpawnLayered(play, &this->actor.world.pos, &D_809304EC, &D_809304F8, 15, 8); Actor_Kill(&this->actor); return; @@ -767,13 +773,14 @@ void func_80930030(Actor* thisx, PlayState* play) { CLOSE_DISPS(play->state.gfxCtx); } -#ifdef NON_MATCHING void func_80930190(Actor* thisx, PlayState* play) { - EnHonotrap* this = (EnHonotrap*)thisx; - Vec3s spB8; + s32 pad; + EnHonotrap* this; EnHonotrapArr* temp_s0; EnHonotrap23C* var_s3; s32 i; // s4 + s32 pad2; + Vec3s spB8; OPEN_DISPS(play->state.gfxCtx); Gfx_SetupDL25_Xlu(play->state.gfxCtx); @@ -781,6 +788,7 @@ void func_80930190(Actor* thisx, PlayState* play) { gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0); Camera_GetCamDir(&spB8, play->cameraPtrs[play->activeCamId]); spB8.y += 0x8000; + this = ((EnHonotrap*)thisx); var_s3 = &this->unk23C; for (i = 0; i < 6; i++) { temp_s0 = &var_s3->unkC[i]; @@ -789,9 +797,7 @@ void func_80930190(Actor* thisx, PlayState* play) { Gfx_TwoTexScroll(play->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, + Matrix_Scale(((fabsf(Math_SinS((s16)(spB8.y - thisx->shape.rot.y) >> 1)) * 0.2f) + 1.7f) * temp_s0->unkC, temp_s0->unkC, 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++, gEffFire1DL); @@ -799,6 +805,3 @@ void func_80930190(Actor* thisx, PlayState* play) { } CLOSE_DISPS(play->state.gfxCtx); } -#else -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Honotrap/func_80930190.s") -#endif From 5f057d56e0397222724910b8c71e36d936d9353d Mon Sep 17 00:00:00 2001 From: mzxrules Date: Mon, 9 Oct 2023 00:33:23 -0400 Subject: [PATCH 04/11] z_en_honotrap OK --- .../actors/ovl_En_Honotrap/z_en_honotrap.c | 58 +++++++++---------- 1 file changed, 26 insertions(+), 32 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 3cd6e0159..25cd1a782 100644 --- a/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c +++ b/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c @@ -468,61 +468,55 @@ void func_8092F34C(EnHonotrap* this) { this->unk234 = 0.0f; } -#ifdef NON_MATCHING void func_8092F3D8(EnHonotrap* this, PlayState* play) { - s32 pad; + Actor* thisx = &this->actor; Vec3f sp60; s32 temp_s1; - Player* player; - - Vec3f sp4C; - Vec3f sp40; - Vec3f sp34; Math_StepToF(&this->unk234, 13.0f, 0.5f); - sp60.x = fabsf(this->unk234 * this->actor.velocity.x); - sp60.y = fabsf(this->unk234 * this->actor.velocity.y); - sp60.z = fabsf(this->unk234 * this->actor.velocity.z); + sp60.x = fabsf(this->unk234 * thisx->velocity.x); + sp60.y = fabsf(this->unk234 * thisx->velocity.y); + sp60.z = fabsf(this->unk234 * thisx->velocity.z); temp_s1 = 1; - temp_s1 &= Math_StepToF(&this->actor.world.pos.x, this->unk228.x, sp60.x); - temp_s1 &= Math_StepToF(&this->actor.world.pos.y, this->unk228.y, sp60.y); - temp_s1 &= Math_StepToF(&this->actor.world.pos.z, this->unk228.z, sp60.z); - Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 0.0f, + temp_s1 &= Math_StepToF(&thisx->world.pos.x, this->unk228.x, sp60.x); + temp_s1 &= Math_StepToF(&thisx->world.pos.y, this->unk228.y, sp60.y); + temp_s1 &= Math_StepToF(&thisx->world.pos.z, this->unk228.z, sp60.z); + Actor_UpdateBgCheckInfo(play, thisx, 10.0f, 10.0f, 0.0f, UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | UPDBGCHECKINFO_FLAG_10); if (this->collider.tris.base.atFlags & AT_BOUNCED) { - player = GET_PLAYER(play); + Player* player = GET_PLAYER(play); + Vec3f sp4C; + Vec3f sp40; + Vec3f sp34; + sp34.x = -player->shieldMf.xz; sp34.y = -player->shieldMf.yz; sp34.z = -player->shieldMf.zz; func_8092E5A4(&sp4C, &sp34); - sp40 = this->actor.velocity; - func_80179F64(&sp40, &sp4C, &this->actor.velocity); - this->actor.speed = this->unk234 * 0.5f; - this->actor.world.rot.y = Math_Atan2S_XY(this->actor.velocity.z, this->actor.velocity.x); + sp40 = thisx->velocity; + func_80179F64(&sp40, &sp4C, &thisx->velocity); + thisx->speed = this->unk234 * 0.5f; + thisx->world.rot.y = Math_Atan2S_XY(thisx->velocity.z, thisx->velocity.x); func_8092F7A8(this); - return; } - if (this->collider.tris.base.atFlags & AT_HIT) { - this->actor.speed = 0.0f; - this->actor.velocity.y = 0.0f; + else if (this->collider.tris.base.atFlags & AT_HIT) { + thisx->speed = 0.0f; + thisx->velocity.y = 0.0f; func_8092F7A8(this); - return; } - if (this->unk220 <= 0) { + else if (this->unk220 <= 0) { func_8092F7A8(this); - return; } - func_8092E510(this, play); - if (temp_s1 != 0) { - func_8092F5AC(this); + else { + func_8092E510(this, play); + if (temp_s1 != 0) { + func_8092F5AC(this); + } } } -#else -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Honotrap/func_8092F3D8.s") -#endif void func_8092F5AC(EnHonotrap* this) { this->actionFunc = func_8092F5EC; From cc17013391a74ee32464a0d9cb830ea826c20c5b Mon Sep 17 00:00:00 2001 From: mzxrules Date: Wed, 11 Oct 2023 03:37:00 -0400 Subject: [PATCH 05/11] clean things up --- spec | 5 +- .../actors/ovl_En_Honotrap/z_en_honotrap.c | 782 +++++++++--------- .../actors/ovl_En_Honotrap/z_en_honotrap.h | 36 +- 3 files changed, 416 insertions(+), 407 deletions(-) diff --git a/spec b/spec index 339a701c8..4f21bc20a 100644 --- a/spec +++ b/spec @@ -656,7 +656,7 @@ beginseg include "build/src/overlays/gamestates/ovl_file_choose/z_file_choose_NES.o" #ifdef NON_MATCHING include "build/src/overlays/gamestates/ovl_file_choose/ovl_file_choose_reloc.o" - #else + #else include "build/data/ovl_file_choose/ovl_file_choose.reloc.o" #endif endseg @@ -1340,8 +1340,7 @@ beginseg name "ovl_En_Honotrap" compress include "build/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.o" - include "build/data/ovl_En_Honotrap/ovl_En_Honotrap.data.o" - include "build/data/ovl_En_Honotrap/ovl_En_Honotrap.reloc.o" + include "build/src/overlays/actors/ovl_En_Honotrap/ovl_En_Honotrap_reloc.o" endseg beginseg 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 25cd1a782..bf64f7048 100644 --- a/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c +++ b/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c @@ -6,56 +6,68 @@ #include "z_en_honotrap.h" #include "assets/objects/gameplay_keep/gameplay_keep.h" +#include "assets/objects/gameplay_dangeon_keep/gameplay_dangeon_keep.h" #define FLAGS (ACTOR_FLAG_10) -#define THIS ((EnHonotrap*)thisx) +#define HONOTRAP_AT_ACTIVE (1 << 0) +#define HONOTRAP_AC_ACTIVE (1 << 1) +#define HONOTRAP_OC_ACTIVE (1 << 2) + +typedef enum { + /* 0 */ HONOTRAP_EYE_OPEN, + /* 1 */ HONOTRAP_EYE_HALF, + /* 2 */ HONOTRAP_EYE_CLOSE, + /* 3 */ HONOTRAP_EYE_SHUT +} EnHonotrapEyeState; void EnHonotrap_Init(Actor* thisx, PlayState* play); void EnHonotrap_Destroy(Actor* thisx, PlayState* play); void EnHonotrap_Update(Actor* thisx, PlayState* play); void EnHonotrap_Draw(Actor* thisx, PlayState* play); -void func_8092E5A4(Vec3f* arg0, Vec3f* arg1); -void func_8092E638(EnHonotrap* this, PlayState* play); -void func_8092E840(EnHonotrap* this, PlayState* play); -void func_8092E988(EnHonotrap* this, PlayState* play); -void func_8092EBC0(EnHonotrap* this); -void func_8092EBDC(EnHonotrap* this, PlayState* play); -void func_8092EC9C(EnHonotrap* this); -void func_8092ECF0(EnHonotrap* this, PlayState* play); -void func_8092EDC0(EnHonotrap* this); -void func_8092EDD8(EnHonotrap* this, PlayState* play); -void func_8092EE08(EnHonotrap* this); -void func_8092EE1C(EnHonotrap* this, PlayState* play); -void func_8092EE68(EnHonotrap* this); -void func_8092EE90(EnHonotrap* this, PlayState* play); -void func_8092EF3C(EnHonotrap* this); -void func_8092EF98(EnHonotrap* this, PlayState* play); -void func_8092F05C(EnHonotrap* this); -void func_8092F074(EnHonotrap* this, PlayState* play); -void func_8092F0A4(EnHonotrap* this); -void func_8092F0B8(EnHonotrap* this, PlayState* play); -void func_8092F0F8(EnHonotrap* this); -void func_8092F10C(EnHonotrap* this, PlayState* play); -void func_8092F1A0(EnHonotrap* this); -void func_8092F208(EnHonotrap* this, PlayState* play); -void func_8092F34C(EnHonotrap* this); -void func_8092F3D8(EnHonotrap* this, PlayState* play); -void func_8092F5AC(EnHonotrap* this); -void func_8092F5EC(EnHonotrap* this, PlayState* play); -void func_8092F7A8(EnHonotrap* this); -void func_8092F7BC(EnHonotrap* this, PlayState* play); -void func_8092F854(EnHonotrap* this); -void func_8092F878(EnHonotrap* this, PlayState* play); -void func_8092FE44(Actor* thisx, PlayState* play); -void func_8092FEFC(Actor* thisx, PlayState* play); -void func_80930030(Actor* thisx, PlayState* play); -void func_80930190(Actor* thisx, PlayState* play); +void EnHonotrap_GetNormal(Vec3f* normal, Vec3f* vec); +void EnHonotrap_InitEye(EnHonotrap* this, PlayState* play); +void EnHonotrap_InitFlame(EnHonotrap* this, PlayState* play); +void EnHonotrap_InitFlameGroup(EnHonotrap* this, PlayState* play); +void EnHonotrap_SetupEyeIdle(EnHonotrap* this); +void EnHonotrap_EyeIdle(EnHonotrap* this, PlayState* play); +void EnHonotrap_SetupEyeOpen(EnHonotrap* this); +void EnHonotrap_EyeOpen(EnHonotrap* this, PlayState* play); +void EnHonotrap_SetupEyeAttack(EnHonotrap* this); +void EnHonotrap_EyeAttack(EnHonotrap* this, PlayState* play); +void EnHonotrap_SetupEyeClose(EnHonotrap* this); +void EnHonotrap_EyeClose(EnHonotrap* this, PlayState* play); +void EnHonotrap_SetupEyeIdle2(EnHonotrap* this); +void EnHonotrap_EyeIdle2(EnHonotrap* this, PlayState* play); +void EnHonotrap_SetupEyeOpen2(EnHonotrap* this); +void EnHonotrap_EyeOpen2(EnHonotrap* this, PlayState* play); +void EnHonotrap_SetupEyeAttack2(EnHonotrap* this); +void EnHonotrap_EyeAttack2(EnHonotrap* this, PlayState* play); +void EnHonotrap_SetupEyeClose2(EnHonotrap* this); +void EnHonotrap_EyeClose2(EnHonotrap* this, PlayState* play); +void EnHonotrap_SetupFlame(EnHonotrap* this); +void EnHonotrap_Flame(EnHonotrap* this, PlayState* play); +void EnHonotrap_SetupFlameDrop(EnHonotrap* this); +void EnHonotrap_FlameDrop(EnHonotrap* this, PlayState* play); +void EnHonotrap_SetupFlameMove(EnHonotrap* this); +void EnHonotrap_FlameMove(EnHonotrap* this, PlayState* play); +void EnHonotrap_SetupFlameChase(EnHonotrap* this); +void EnHonotrap_FlameChase(EnHonotrap* this, PlayState* play); +void EnHonotrap_SetupFlameVanish(EnHonotrap* this); +void EnHonotrap_FlameVanish(EnHonotrap* this, PlayState* play); +void EnHonotrap_SetupFlameGroup(EnHonotrap* this); +void EnHonotrap_FlameGroup(EnHonotrap* this, PlayState* play); +void EnHonotrap_UpdateFlame(Actor* thisx, PlayState* play); +void EnHonotrap_UpdateFlameGroup(Actor* thisx, PlayState* play); +void EnHonotrap_DrawFlame(Actor* thisx, PlayState* play); +void EnHonotrap_DrawFlameGroup(Actor* thisx, PlayState* play); -extern Gfx D_050085F0; +TexturePtr sSilverEyeTextures[4] = { gEyeSwitchSilverOpenTex, gEyeSwitchSilverHalfTex, gEyeSwitchSilverClosedTex, + gEyeSwitchSilverClosedTex }; + +s32 sIsFirstInitEye = true; -#if 0 ActorInit En_Honotrap_InitVars = { ACTOR_EN_HONOTRAP, ACTORCAT_PROP, @@ -68,169 +80,186 @@ ActorInit En_Honotrap_InitVars = { (ActorFunc)EnHonotrap_Draw, }; -// static ColliderTrisElementInit sTrisElementsInit[2] = { -static ColliderTrisElementInit D_80930424[2] = { +static ColliderTrisElementInit sTrisElementsInit[2] = { { - { ELEMTYPE_UNK4, { 0x00000000, 0x00, 0x00 }, { 0x00003820, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_NONE, }, + { + ELEMTYPE_UNK4, + { 0x00000000, 0x00, 0x00 }, + { 0x00003820, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_NONE, + }, { { { 0.0f, 23.0f, 8.5f }, { -23.0f, 0.0f, 8.5f }, { 0.0f, -23.0f, 8.5f } } }, }, { - { ELEMTYPE_UNK4, { 0x00000000, 0x00, 0x00 }, { 0x00003820, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_NONE, }, + { + ELEMTYPE_UNK4, + { 0x00000000, 0x00, 0x00 }, + { 0x00003820, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_NONE, + }, { { { 0.0f, 23.0f, 8.5f }, { 0.0f, -23.0f, 8.5f }, { 23.0f, 0.0f, 8.5f } } }, }, }; -// static ColliderTrisInit sTrisInit = { -static ColliderTrisInit D_8093049C = { - { COLTYPE_NONE, AT_NONE, AC_ON | AC_TYPE_PLAYER, OC1_NONE, OC2_NONE, COLSHAPE_TRIS, }, - ARRAY_COUNT(sTrisElementsInit), D_80930424, // sTrisElementsInit, +static ColliderTrisInit sTrisInit = { + { + COLTYPE_NONE, + AT_NONE, + AC_ON | AC_TYPE_PLAYER, + OC1_NONE, + OC2_NONE, + COLSHAPE_TRIS, + }, + ARRAY_COUNT(sTrisElementsInit), + sTrisElementsInit, }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_809304AC = { - { COLTYPE_NONE, AT_ON | AT_TYPE_ENEMY, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_2, COLSHAPE_CYLINDER, }, - { ELEMTYPE_UNK0, { 0xF7CFFFFF, 0x01, 0x04 }, { 0x00100000, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NONE, BUMP_ON, OCELEM_ON, }, +static ColliderCylinderInit sCylinderInit = { + { + COLTYPE_NONE, + AT_ON | AT_TYPE_ENEMY, + AC_ON | AC_TYPE_PLAYER, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_2, + COLSHAPE_CYLINDER, + }, + { + ELEMTYPE_UNK0, + { 0xF7CFFFFF, 0x01, 0x04 }, + { 0x00100000, 0x00, 0x00 }, + TOUCH_ON | TOUCH_SFX_NONE, + BUMP_ON, + OCELEM_ON, + }, { 10, 25, 0, { 0, 0, 0 } }, }; -// sColChkInfoInit -static CollisionCheckInfoInit D_809304D8 = { 0, 9, 23, 1 }; +static CollisionCheckInfoInit sColChkInfoInit = { 0, 9, 23, 1 }; -// static InitChainEntry sInitChain[] = { -static InitChainEntry D_809304E0[] = { +static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneForward, 4000, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneScale, 100, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneDownward, 100, ICHAIN_STOP), }; -#endif -extern Gfx* D_809303F0[4]; -extern s32 D_80930400; -extern ColliderTrisElementInit D_80930424[2]; -extern ColliderTrisInit D_8093049C; -extern ColliderCylinderInit D_809304AC; -extern CollisionCheckInfoInit D_809304D8; -extern InitChainEntry D_809304E0[]; - -void func_8092E510(EnHonotrap* this, PlayState* play) { +void EnHonotrap_FlameCollisionCheck(EnHonotrap* this, PlayState* play) { s32 pad[3]; Collider_UpdateCylinder(&this->actor, &this->collider.cyl); CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.tris.base); CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.tris.base); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.tris.base); - this->unk2C0 |= 1; - this->unk2C0 |= 2; - this->unk2C0 |= 4; + this->colChkFlags |= HONOTRAP_AT_ACTIVE; + this->colChkFlags |= HONOTRAP_AC_ACTIVE; + this->colChkFlags |= HONOTRAP_OC_ACTIVE; } -void func_8092E5A4(Vec3f* arg0, Vec3f* arg1) { - f32 temp_fv0; - f32 temp_fv1; +void EnHonotrap_GetNormal(Vec3f* normal, Vec3f* vec) { + f32 magnitude = Math3D_Vec3fMagnitude(vec); - temp_fv0 = Math3D_Vec3fMagnitude(arg1); - if (temp_fv0 < 0.001f) { - arg0->x = arg0->y = 0.0f; - arg0->z = 1.0f; - return; + if (magnitude < 0.001f) { + normal->x = normal->y = 0.0f; + normal->z = 1.0f; + } else { + normal->x = vec->x * (1.0f / magnitude); + normal->y = vec->y * (1.0f / magnitude); + normal->z = vec->z * (1.0f / magnitude); } - temp_fv1 = 1.0f / temp_fv0; - arg0->x = arg1->x * temp_fv1; - arg0->y = arg1->y * temp_fv1; - arg0->z = arg1->z * temp_fv1; } -// EnHonotrap_InitEye -void func_8092E638(EnHonotrap* this, PlayState* play) { +void EnHonotrap_InitEye(EnHonotrap* this, PlayState* play) { s32 i; s32 j; s32 k; f32 sin; f32 cos; - Vec3f sp70[3]; + Vec3f triangle[3]; Vec3f* vtx; sin = Math_SinS(this->actor.home.rot.y); cos = Math_CosS(this->actor.home.rot.y); Actor_SetScale(&this->actor, 0.1f); - if (D_80930400 != 0) { - D_80930400 = 0; - for (k = 0; k < 4; k++) { - D_809303F0[k] = Lib_SegmentedToVirtual(D_809303F0[k]); + if (sIsFirstInitEye) { + sIsFirstInitEye = false; + for (k = 0; k < ARRAY_COUNT(sSilverEyeTextures); k++) { + sSilverEyeTextures[k] = Lib_SegmentedToVirtual(sSilverEyeTextures[k]); } } Collider_InitTris(play, &this->collider.tris); - Collider_SetTris(play, &this->collider.tris, &this->actor, &D_8093049C, this->collider.elements); + Collider_SetTris(play, &this->collider.tris, &this->actor, &sTrisInit, this->collider.elements); for (i = 0; i < 2; i++) { - for (j = 0, vtx = sp70; j < 3; j++, vtx++) { - Vec3f* test = &D_8093049C.elements[i].dim.vtx[j]; + for (j = 0, vtx = triangle; j < 3; j++, vtx++) { + Vec3f* baseVtx = &sTrisInit.elements[i].dim.vtx[j]; - vtx->x = (test->z * sin) + (test->x * cos); - vtx->y = test->y; - vtx->z = (test->z * cos) - (test->x * sin); + vtx->x = (baseVtx->z * sin) + (baseVtx->x * cos); + vtx->y = baseVtx->y; + vtx->z = (baseVtx->z * cos) - (baseVtx->x * sin); Math_Vec3f_Sum(vtx, &this->actor.world.pos, vtx); } - Collider_SetTrisVertices(&this->collider.tris, i, &sp70[0], &sp70[1], &sp70[2]); + Collider_SetTrisVertices(&this->collider.tris, i, &triangle[0], &triangle[1], &triangle[2]); } Actor_SetFocus(&this->actor, 0.0f); - if (this->actor.params == 0) { - func_8092EBC0(this); - } else { - func_8092EE68(this); + if (this->actor.params == HONOTRAP_EYE) { + EnHonotrap_SetupEyeIdle(this); + } else { // HONOTRAP_EYE_MUTI_FLAME + EnHonotrap_SetupEyeIdle2(this); } } -// EnHonotrap_InitFlame -void func_8092E840(EnHonotrap* this, PlayState* play) { +void EnHonotrap_InitFlame(EnHonotrap* this, PlayState* play) { s32 pad[2]; s32 params; params = this->actor.params; Actor_SetScale(&this->actor, 0.0001f); Collider_InitCylinder(play, &this->collider.cyl); - Collider_SetCylinder(play, &this->collider.cyl, &this->actor, &D_809304AC); + Collider_SetCylinder(play, &this->collider.cyl, &this->actor, &sCylinderInit); Collider_UpdateCylinder(&this->actor, &this->collider.cyl); this->actor.terminalVelocity = -1.0f; - CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &D_809304D8); + CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->actor.shape.shadowAlpha = 0x80; - this->unk228 = GET_PLAYER(play)->actor.world.pos; - this->unk228.y += 10.0f; - this->unk23A = Rand_ZeroOne() * 511.0f; + this->targetPos = GET_PLAYER(play)->actor.world.pos; + this->targetPos.y += 10.0f; + this->flameScroll = Rand_ZeroOne() * 511.0f; Actor_PlaySfx(&this->actor, NA_SE_EV_FLAME_IGNITION); - if (params == 2) { + if (params == HONOTRAP_FLAME_DROP) { 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); + EnHonotrap_SetupFlame(this); } -void func_8092E988(EnHonotrap* this, PlayState* play) { - EnHonotrap23C* var_s2; - s32 var_s0; +void EnHonotrap_InitFlameGroup(EnHonotrap* this, PlayState* play) { + EnHonotrapFlameGroup* flameGroup; + s32 flameScroll; s32 i; Actor_SetScale(&this->actor, 0.0001f); Collider_InitCylinder(play, &this->collider.cyl); - Collider_SetCylinder(play, &this->collider.cyl, &this->actor, &D_809304AC); - CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &D_809304D8); + Collider_SetCylinder(play, &this->collider.cyl, &this->actor, &sCylinderInit); + CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); - 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; + flameScroll = Rand_ZeroOne() * 511.0f; + flameGroup = &this->flameGroup; + for (i = 0; i < ARRAY_COUNT(flameGroup->flameList); i++) { + flameGroup->flameList[i].flameScroll = flameScroll; + flameScroll += (s32)Rand_ZeroFloat(300.0f) + 100; + flameScroll &= 0x1FF; } Actor_PlaySfx(&this->actor, NA_SE_EV_FLAME_IGNITION); - func_8092F854(this); + EnHonotrap_SetupFlameGroup(this); } void EnHonotrap_Init(Actor* thisx, PlayState* play) { @@ -238,19 +267,19 @@ void EnHonotrap_Init(Actor* thisx, PlayState* play) { EnHonotrap* this = (EnHonotrap*)thisx; params = this->actor.params; - Actor_ProcessInitChain(&this->actor, D_809304E0); - if ((params == 0) || (params == 3)) { - func_8092E638(this, play); - } else if (params == 4) { - func_8092E988(this, play); - this->actor.update = func_8092FEFC; - this->actor.draw = func_80930190; + Actor_ProcessInitChain(&this->actor, sInitChain); + if ((params == HONOTRAP_EYE) || (params == HONOTRAP_EYE_MUTI_FLAME)) { + EnHonotrap_InitEye(this, play); + } else if (params == HONOTRAP_FLAME_GROUP) { + EnHonotrap_InitFlameGroup(this, play); + this->actor.update = EnHonotrap_UpdateFlameGroup; + this->actor.draw = EnHonotrap_DrawFlameGroup; this->actor.uncullZoneScale = 500.0f; this->actor.uncullZoneDownward = 500.0f; - } else { - func_8092E840(this, play); - this->actor.update = func_8092FE44; - this->actor.draw = func_80930030; + } else { // HONOTRAP_FLAME_MOVE, HONOTRAP_FLAME_DROP + EnHonotrap_InitFlame(this, play); + this->actor.update = EnHonotrap_UpdateFlame; + this->actor.draw = EnHonotrap_DrawFlame; } } @@ -259,188 +288,171 @@ void EnHonotrap_Destroy(Actor* thisx, PlayState* play) { EnHonotrap* this = (EnHonotrap*)thisx; params = this->actor.params; - if ((params == 0) || (params == 3)) { + if ((params == HONOTRAP_EYE) || (params == HONOTRAP_EYE_MUTI_FLAME)) { Collider_DestroyTris(play, &this->collider.tris); } else { Collider_DestroyCylinder(play, &this->collider.cyl); } } -void func_8092EBC0(EnHonotrap* this) { - this->actionFunc = func_8092EBDC; - this->unk222 = 3; +void EnHonotrap_SetupEyeIdle(EnHonotrap* this) { + this->actionFunc = EnHonotrap_EyeIdle; + this->eyeState = HONOTRAP_EYE_SHUT; } -void func_8092EBDC(EnHonotrap* this, PlayState* play) { - f32 temp_fv0; - s16 temp_v0; - +void EnHonotrap_EyeIdle(EnHonotrap* this, PlayState* play) { if (this->actor.child != NULL) { - this->unk220 = 0xC8; - return; - } - if ((this->unk220 <= 0) && (this->actor.xzDistToPlayer < 750.0f)) { - temp_fv0 = this->actor.playerHeightRel; - if ((temp_fv0 < 0.0f) && (temp_fv0 > -700.0f)) { - temp_v0 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - if ((temp_v0 >= -0x3FFF) && (temp_v0 < 0x4000)) { - func_8092EC9C(this); + this->timer = 200; + } else if ((this->timer <= 0) && (this->actor.xzDistToPlayer < 750.0f)) { + if ((this->actor.playerHeightRel < 0.0f) && (this->actor.playerHeightRel > -700.0f)) { + s16 angle = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + + if ((angle > -0x4000) && (angle < 0x4000)) { + EnHonotrap_SetupEyeOpen(this); } } } } -void func_8092EC9C(EnHonotrap* this) { - this->actionFunc = func_8092ECF0; - Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, 0, 40); - this->unk220 = 30; +void EnHonotrap_SetupEyeOpen(EnHonotrap* this) { + this->actionFunc = EnHonotrap_EyeOpen; + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 40); + this->timer = 30; Actor_PlaySfx(&this->actor, NA_SE_EV_RED_EYE); } -void func_8092ECF0(EnHonotrap* this, PlayState* play) { - this->unk222 -= 1; - if (this->unk222 <= 0) { - func_8092EDC0(this); +void EnHonotrap_EyeOpen(EnHonotrap* this, PlayState* play) { + this->eyeState--; + if (this->eyeState <= HONOTRAP_EYE_OPEN) { + EnHonotrap_SetupEyeAttack(this); Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_HONOTRAP, (Math_SinS(this->actor.shape.rot.y) * 12.0f) + this->actor.home.pos.x, this->actor.home.pos.y - 10.0f, (Math_CosS(this->actor.shape.rot.y) * 12.0f) + this->actor.home.pos.z, - this->actor.home.rot.x, this->actor.home.rot.y, this->actor.home.rot.z, 1); + this->actor.home.rot.x, this->actor.home.rot.y, this->actor.home.rot.z, HONOTRAP_FLAME_MOVE); } } -void func_8092EDC0(EnHonotrap* this) { - this->actionFunc = func_8092EDD8; - this->unk222 = 0; +void EnHonotrap_SetupEyeAttack(EnHonotrap* this) { + this->actionFunc = EnHonotrap_EyeAttack; + this->eyeState = HONOTRAP_EYE_OPEN; } -void func_8092EDD8(EnHonotrap* this, PlayState* play) { - if (this->unk220 <= 0) { - func_8092EE08(this); +void EnHonotrap_EyeAttack(EnHonotrap* this, PlayState* play) { + if (this->timer <= 0) { + EnHonotrap_SetupEyeClose(this); } } -void func_8092EE08(EnHonotrap* this) { - this->actionFunc = func_8092EE1C; +void EnHonotrap_SetupEyeClose(EnHonotrap* this) { + this->actionFunc = EnHonotrap_EyeClose; } -void func_8092EE1C(EnHonotrap* this, PlayState* play) { - this->unk222 += 1; - if (this->unk222 >= 3) { - func_8092EBC0(this); - this->unk220 = 200; +void EnHonotrap_EyeClose(EnHonotrap* this, PlayState* play) { + this->eyeState++; + if (this->eyeState >= HONOTRAP_EYE_SHUT) { + EnHonotrap_SetupEyeIdle(this); + this->timer = 200; } } -void func_8092EE68(EnHonotrap* this) { - this->unk222 = 3; - this->unk220 = 0x50; +void EnHonotrap_SetupEyeIdle2(EnHonotrap* this) { + this->eyeState = HONOTRAP_EYE_SHUT; + this->timer = 80; this->unk224 = 0; - this->actionFunc = func_8092EE90; + this->actionFunc = EnHonotrap_EyeIdle2; } -void func_8092EE90(EnHonotrap* this, PlayState* play) { - f32 temp_fv0; - s16 temp_v0; +void EnHonotrap_EyeIdle2(EnHonotrap* this, PlayState* play) { + if ((this->timer <= 0) && (this->actor.xzDistToPlayer < 120.0f)) { + if ((this->actor.playerHeightRel < 0.0f) && (this->actor.playerHeightRel > -700.0f)) { + s16 angle = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - if ((this->unk220 <= 0) && (this->actor.xzDistToPlayer < 120.0f)) { - temp_fv0 = this->actor.playerHeightRel; - if ((temp_fv0 < 0.0f) && (temp_fv0 > -700.0f)) { - temp_v0 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - if ((temp_v0 >= -0x3FFF) && (temp_v0 < 0x4000)) { - func_8092EF3C(this); + if ((angle > -0x4000) && (angle < 0x4000)) { + EnHonotrap_SetupEyeOpen2(this); } } } } -void func_8092EF3C(EnHonotrap* this) { +void EnHonotrap_SetupEyeOpen2(EnHonotrap* this) { Actor_PlaySfx(&this->actor, NA_SE_EV_RED_EYE); - Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, 0, 40); - this->unk220 = 0x28; - this->actionFunc = func_8092EF98; + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 40); + this->timer = 40; + this->actionFunc = EnHonotrap_EyeOpen2; } -void func_8092EF98(EnHonotrap* this, PlayState* play) { +void EnHonotrap_EyeOpen2(EnHonotrap* this, PlayState* play) { s32 pad; - this->unk222 -= 1; - if (this->unk222 <= 0) { - Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_HONOTRAP, - (Math_SinS(this->actor.shape.rot.y) * 12.0f) + this->actor.home.pos.x, - this->actor.home.pos.y, - (Math_CosS(this->actor.shape.rot.y) * 12.0f) + this->actor.home.pos.z, - this->actor.home.rot.x, this->actor.home.rot.y, this->actor.home.rot.z, 4); - func_8092F05C(this); + this->eyeState--; + if (this->eyeState <= HONOTRAP_EYE_OPEN) { + Actor_SpawnAsChild( + &play->actorCtx, &this->actor, play, ACTOR_EN_HONOTRAP, + (Math_SinS(this->actor.shape.rot.y) * 12.0f) + this->actor.home.pos.x, this->actor.home.pos.y, + (Math_CosS(this->actor.shape.rot.y) * 12.0f) + this->actor.home.pos.z, this->actor.home.rot.x, + this->actor.home.rot.y, this->actor.home.rot.z, HONOTRAP_FLAME_GROUP); + EnHonotrap_SetupEyeAttack2(this); } } -void func_8092F05C(EnHonotrap* this) { - this->actionFunc = func_8092F074; - this->unk222 = 0; +void EnHonotrap_SetupEyeAttack2(EnHonotrap* this) { + this->actionFunc = EnHonotrap_EyeAttack2; + this->eyeState = HONOTRAP_EYE_OPEN; } -void func_8092F074(EnHonotrap* this, PlayState* play) { - if (this->unk220 <= 0) { - func_8092F0A4(this); +void EnHonotrap_EyeAttack2(EnHonotrap* this, PlayState* play) { + if (this->timer <= 0) { + EnHonotrap_SetupEyeClose2(this); } } -void func_8092F0A4(EnHonotrap* this) { - this->actionFunc = func_8092F0B8; +void EnHonotrap_SetupEyeClose2(EnHonotrap* this) { + this->actionFunc = EnHonotrap_EyeClose2; } -void func_8092F0B8(EnHonotrap* this, PlayState* play) { - this->unk222 += 1; - if (this->unk222 >= 3) { - func_8092EE68(this); +void EnHonotrap_EyeClose2(EnHonotrap* this, PlayState* play) { + this->eyeState++; + if (this->eyeState >= HONOTRAP_EYE_SHUT) { + EnHonotrap_SetupEyeIdle2(this); } } -void func_8092F0F8(EnHonotrap* this) { - this->actionFunc = func_8092F10C; +void EnHonotrap_SetupFlame(EnHonotrap* this) { + this->actionFunc = EnHonotrap_Flame; } -void func_8092F10C(EnHonotrap* this, PlayState* play) { - f32 temp_fv0; - f32 var_fv0; - s32 temp_v0; +void EnHonotrap_Flame(EnHonotrap* this, PlayState* play) { + f32 targetScale = (this->actor.params == HONOTRAP_FLAME_MOVE) ? 0.004f : 0.0048f; + s32 targetReached = Math_StepToF(&this->actor.scale.x, targetScale, 0.0006f); - if (this->actor.params == 1) { - var_fv0 = 0.004f; - } else { - var_fv0 = 0.0048f; - } - temp_v0 = Math_StepToF(&this->actor.scale.x, var_fv0, 0.0006f); - temp_fv0 = this->actor.scale.x; - this->actor.scale.y = temp_fv0; - this->actor.scale.z = temp_fv0; - if (temp_v0 != 0) { - if (this->actor.params == 1) { - func_8092F34C(this); - return; + this->actor.scale.z = this->actor.scale.y = this->actor.scale.x; + if (targetReached) { + if (this->actor.params == HONOTRAP_FLAME_MOVE) { + EnHonotrap_SetupFlameMove(this); + } else { // HONOTRAP_FLAME_DROP + EnHonotrap_SetupFlameDrop(this); } - func_8092F1A0(this); } } -void func_8092F1A0(EnHonotrap* this) { - this->unk220 = 0x28; +void EnHonotrap_SetupFlameDrop(EnHonotrap* this) { + this->timer = 40; this->actor.velocity.y = 1.0f; this->actor.velocity.x = 2.0f * Math_SinS(this->actor.world.rot.y); this->actor.velocity.z = 2.0f * Math_CosS(this->actor.world.rot.y); - this->actionFunc = func_8092F208; + this->actionFunc = EnHonotrap_FlameDrop; } -void func_8092F208(EnHonotrap* this, PlayState* play) { - if ((this->collider.tris.base.atFlags & AT_HIT) || (this->unk220 <= 0)) { +void EnHonotrap_FlameDrop(EnHonotrap* this, PlayState* play) { + if ((this->collider.tris.base.atFlags & AT_HIT) || (this->timer <= 0)) { if ((this->collider.tris.base.atFlags & AT_HIT) && !(this->collider.tris.base.atFlags & AT_BOUNCED)) { func_800B8D98(play, &this->actor, 5.0f, this->actor.yawTowardsPlayer, 0.0f); } this->actor.velocity.z = 0.0f; this->actor.velocity.y = 0.0f; this->actor.velocity.x = 0.0f; - func_8092F7A8(this); + EnHonotrap_SetupFlameVanish(this); return; } if (this->actor.velocity.y > 0.0f) { @@ -448,94 +460,86 @@ void func_8092F208(EnHonotrap* this, PlayState* play) { this->actor.world.pos.z += this->actor.velocity.z; Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 12.0f, 0.0f, UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4); } - if (Math_StepToF(&this->actor.world.pos.y, this->actor.floorHeight + 1.0f, this->actor.velocity.y) == 0) { + if (!Math_StepToF(&this->actor.world.pos.y, this->actor.floorHeight + 1.0f, this->actor.velocity.y)) { this->actor.velocity.y += 1.0f; } else { this->actor.velocity.y = 0.0f; } - func_8092E510(this, play); + EnHonotrap_FlameCollisionCheck(this, play); } -void func_8092F34C(EnHonotrap* this) { - f32 temp_fv1; +void EnHonotrap_SetupFlameMove(EnHonotrap* this) { + f32 distInverse; - this->actionFunc = func_8092F3D8; - temp_fv1 = 1.0f / (Actor_WorldDistXYZToPoint(&this->actor, &this->unk228) + 1.0f); - this->actor.velocity.x = (this->unk228.x - this->actor.world.pos.x) * temp_fv1; - this->actor.velocity.y = (this->unk228.y - this->actor.world.pos.y) * temp_fv1; - this->actor.velocity.z = (this->unk228.z - this->actor.world.pos.z) * temp_fv1; - this->unk220 = 160; - this->unk234 = 0.0f; + this->actionFunc = EnHonotrap_FlameMove; + distInverse = 1.0f / (Actor_WorldDistXYZToPoint(&this->actor, &this->targetPos) + 1.0f); + this->actor.velocity.x = (this->targetPos.x - this->actor.world.pos.x) * distInverse; + this->actor.velocity.y = (this->targetPos.y - this->actor.world.pos.y) * distInverse; + this->actor.velocity.z = (this->targetPos.z - this->actor.world.pos.z) * distInverse; + this->speedMod = 0.0f; + this->timer = 160; } -void func_8092F3D8(EnHonotrap* this, PlayState* play) { +void EnHonotrap_FlameMove(EnHonotrap* this, PlayState* play) { Actor* thisx = &this->actor; - Vec3f sp60; + Vec3f speed; + s32 cond; - s32 temp_s1; - - Math_StepToF(&this->unk234, 13.0f, 0.5f); - sp60.x = fabsf(this->unk234 * thisx->velocity.x); - sp60.y = fabsf(this->unk234 * thisx->velocity.y); - sp60.z = fabsf(this->unk234 * thisx->velocity.z); - temp_s1 = 1; - temp_s1 &= Math_StepToF(&thisx->world.pos.x, this->unk228.x, sp60.x); - temp_s1 &= Math_StepToF(&thisx->world.pos.y, this->unk228.y, sp60.y); - temp_s1 &= Math_StepToF(&thisx->world.pos.z, this->unk228.z, sp60.z); + Math_StepToF(&this->speedMod, 13.0f, 0.5f); + speed.x = fabsf(this->speedMod * thisx->velocity.x); + speed.y = fabsf(this->speedMod * thisx->velocity.y); + speed.z = fabsf(this->speedMod * thisx->velocity.z); + cond = true; + cond &= Math_StepToF(&thisx->world.pos.x, this->targetPos.x, speed.x); + cond &= Math_StepToF(&thisx->world.pos.y, this->targetPos.y, speed.y); + cond &= Math_StepToF(&thisx->world.pos.z, this->targetPos.z, speed.z); Actor_UpdateBgCheckInfo(play, thisx, 10.0f, 10.0f, 0.0f, UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | UPDBGCHECKINFO_FLAG_10); if (this->collider.tris.base.atFlags & AT_BOUNCED) { Player* player = GET_PLAYER(play); - Vec3f sp4C; - Vec3f sp40; - Vec3f sp34; + Vec3f shieldNorm; + Vec3f tempVel; + Vec3f shieldVec; - sp34.x = -player->shieldMf.xz; - sp34.y = -player->shieldMf.yz; - sp34.z = -player->shieldMf.zz; - func_8092E5A4(&sp4C, &sp34); - sp40 = thisx->velocity; - func_80179F64(&sp40, &sp4C, &thisx->velocity); - thisx->speed = this->unk234 * 0.5f; + shieldVec.x = -player->shieldMf.xz; + shieldVec.y = -player->shieldMf.yz; + shieldVec.z = -player->shieldMf.zz; + EnHonotrap_GetNormal(&shieldNorm, &shieldVec); + tempVel = thisx->velocity; + func_80179F64(&tempVel, &shieldNorm, &thisx->velocity); + thisx->speed = this->speedMod * 0.5f; thisx->world.rot.y = Math_Atan2S_XY(thisx->velocity.z, thisx->velocity.x); - func_8092F7A8(this); - } - else if (this->collider.tris.base.atFlags & AT_HIT) { + EnHonotrap_SetupFlameVanish(this); + } else if (this->collider.tris.base.atFlags & AT_HIT) { thisx->speed = 0.0f; thisx->velocity.y = 0.0f; - func_8092F7A8(this); - } - else if (this->unk220 <= 0) { - func_8092F7A8(this); - } - else { - func_8092E510(this, play); - if (temp_s1 != 0) { - func_8092F5AC(this); + EnHonotrap_SetupFlameVanish(this); + } else if (this->timer <= 0) { + EnHonotrap_SetupFlameVanish(this); + } else { + EnHonotrap_FlameCollisionCheck(this, play); + if (cond != 0) { + EnHonotrap_SetupFlameChase(this); } } } -void func_8092F5AC(EnHonotrap* this) { - this->actionFunc = func_8092F5EC; +void EnHonotrap_SetupFlameChase(EnHonotrap* this) { + this->actionFunc = EnHonotrap_FlameChase; this->actor.speed = 0.0f; this->actor.velocity.x = this->actor.velocity.y = this->actor.velocity.z = 0.0f; - this->unk220 = 100; + this->timer = 100; this->actor.world.rot.x = this->actor.world.rot.y = this->actor.world.rot.z = 0; } -void func_8092F5EC(EnHonotrap* this, PlayState* play) { +void EnHonotrap_FlameChase(EnHonotrap* this, PlayState* play) { s32 pad; Math_ScaledStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 0x300); Math_StepToF(&this->actor.speed, 3.0f, 0.1f); - if (-this->actor.playerHeightRel < 10.0f) { - this->actor.gravity = 0.08f; - } else { - this->actor.gravity = -0.08f; - } + this->actor.gravity = (-this->actor.playerHeightRel < 10.0f) ? 0.08f : -0.08f; Actor_UpdateVelocityWithGravity(&this->actor); if (this->actor.velocity.y > 1.0f) { this->actor.velocity.y = 1.0f; @@ -548,113 +552,112 @@ void func_8092F5EC(EnHonotrap* this, PlayState* play) { if (this->collider.tris.base.atFlags & AT_BOUNCED) { Player* player = GET_PLAYER(play); - Vec3s sp30; + Vec3s shieldRot; - Matrix_MtxFToYXZRot(&player->shieldMf, &sp30, 0); - this->actor.world.rot.y = ((sp30.y * 2) - this->actor.world.rot.y) + 0x8000; - func_8092F7A8(this); + Matrix_MtxFToYXZRot(&player->shieldMf, &shieldRot, 0); + this->actor.world.rot.y = ((shieldRot.y * 2) - this->actor.world.rot.y) + 0x8000; + EnHonotrap_SetupFlameVanish(this); } else if (this->collider.tris.base.atFlags & AT_HIT) { this->actor.speed *= 0.1f; this->actor.velocity.y *= 0.1f; - func_8092F7A8(this); - } else if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || (this->unk220 <= 0)) { - func_8092F7A8(this); + EnHonotrap_SetupFlameVanish(this); + } else if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || (this->timer <= 0)) { + EnHonotrap_SetupFlameVanish(this); } else { - func_8092E510(this, play); + EnHonotrap_FlameCollisionCheck(this, play); } } -void func_8092F7A8(EnHonotrap* this) { - this->actionFunc = func_8092F7BC; +void EnHonotrap_SetupFlameVanish(EnHonotrap* this) { + this->actionFunc = EnHonotrap_FlameVanish; } -void func_8092F7BC(EnHonotrap* this, PlayState* play) { - f32 temp_fv0; - s32 sp28 = Math_StepToF(&this->actor.scale.x, 0.0001f, 0.00015f); - temp_fv0 = this->actor.scale.x; - this->actor.scale.y = temp_fv0; - this->actor.scale.z = temp_fv0; +void EnHonotrap_FlameVanish(EnHonotrap* this, PlayState* play) { + s32 pad; + s32 targetReached = Math_StepToF(&this->actor.scale.x, 0.0001f, 0.00015f); + + this->actor.scale.z = this->actor.scale.y = this->actor.scale.x; Actor_MoveWithGravity(&this->actor); Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 0.0f, UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | UPDBGCHECKINFO_FLAG_10); - if (sp28 != 0) { + if (targetReached) { Actor_Kill(&this->actor); } } -void func_8092F854(EnHonotrap* this) { - this->actionFunc = func_8092F878; - this->unk220 = 0x50; - this->unk23C.unk8 = 0.0f; +void EnHonotrap_SetupFlameGroup(EnHonotrap* this) { + this->actionFunc = EnHonotrap_FlameGroup; + this->timer = 80; + this->flameGroup.unk8 = 0.0f; } -void func_8092F878(EnHonotrap* this, PlayState* play) { - s32 var_v0; - EnHonotrap23C* sp98; +void EnHonotrap_FlameGroup(EnHonotrap* this, PlayState* play) { + s32 i; + EnHonotrapFlameGroup* flameGroup; f32 var_fs0; f32 temp_fs0; f32 temp_fs1; f32 sp88; f32 sp84; f32 sp80; - s32 sp7C; + s32 flameScrollDisplacement; s32 sp78; f32 var_fs0_2; Vec3f sp68; - EnHonotrapArr* var_s0; + EnHonotrapFlameElement* flameElem; - sp98 = &this->unk23C; + flameGroup = &this->flameGroup; sp78 = 0; sp80 = fabsf(Math_CosS(Camera_GetCamDirPitch(play->cameraPtrs[play->activeCamId]))); - sp7C = (s32)(sp80 * -10.5f) - 10; - Math_StepToF(&sp98->unk0, 1.0f, 0.05f); - if (this->unk220 <= 40) { - sp78 = Math_StepToF(&sp98->unk4, 1.0f, 0.05f); + flameScrollDisplacement = (s32)(sp80 * -10.5f) - 10; + Math_StepToF(&flameGroup->unk0, 1.0f, 0.05f); + if (this->timer <= 40) { + sp78 = Math_StepToF(&flameGroup->unk4, 1.0f, 0.05f); } else if (this->actor.parent == NULL) { - this->unk220 = 40; + this->timer = 40; } - for (var_v0 = 0; var_v0 < 6; var_v0++) { - sp98->unkC[var_v0].unk12 = 0; + for (i = 0; i < ARRAY_COUNT(flameGroup->flameList); i++) { + flameGroup->flameList[i].isDrawn = false; } sp88 = Math_SinS(this->actor.shape.rot.y) * 120.0f; sp84 = Math_CosS(this->actor.shape.rot.y) * 120.0f; - sp98->unk8 += 0.050f * (1.0f - sp98->unk4); + flameGroup->unk8 += 0.050f * (1.0f - flameGroup->unk4); - if (sp98->unk8 > 0.16666667f) { - sp98->unk8 -= 0.16666667f; + if (flameGroup->unk8 > 1.0f / 6) { + flameGroup->unk8 -= 1.0f / 6; } - var_fs0 = sp98->unk4 + sp98->unk8; + var_fs0 = flameGroup->unk4 + flameGroup->unk8; - for (var_v0 = 0; var_v0 < 6 && (var_fs0 <= sp98->unk0); var_v0++) { - var_s0 = &sp98->unkC[var_v0]; - var_s0->unk12 = 1; + for (i = 0; i < ARRAY_COUNT(flameGroup->flameList) && (var_fs0 <= flameGroup->unk0); i++) { + flameElem = &flameGroup->flameList[i]; + flameElem->isDrawn = true; - var_s0->unk0.x = (f32)((sp88 * var_fs0) + this->actor.world.pos.x); - var_s0->unk0.y = (f32)this->actor.world.pos.y; - var_s0->unk0.z = (f32)((sp84 * var_fs0) + this->actor.world.pos.z); + flameElem->pos.x = (sp88 * var_fs0) + this->actor.world.pos.x; + flameElem->pos.y = this->actor.world.pos.y; + flameElem->pos.z = (sp84 * var_fs0) + this->actor.world.pos.z; - var_s0->unkC = Math_SinS((s16)(s32)(var_fs0 * 25486.223f)) * 1.6f; - if (var_s0->unkC > 1.0f) { - var_s0->unkC = 1.0f; - } else if (var_s0->unkC < 0.0f) { - var_s0->unkC = 0.0f; + flameElem->unkC = Math_SinS((s16)(s32)(var_fs0 * 25486.223f)) * 1.6f; + if (flameElem->unkC > 1.0f) { + flameElem->unkC = 1.0f; + } else if (flameElem->unkC < 0.0f) { + flameElem->unkC = 0.0f; } - var_fs0 += 0.16666667f; - var_s0->unkC = (f32)(var_s0->unkC * (0.006f * (((1.0f - sp98->unk4) * 0.8f) + 0.2f))); - var_s0->unk_10 = (s16)(var_s0->unk_10 + sp7C); - var_s0->unk_10 = (s16)(var_s0->unk_10 & 0x1FF); + var_fs0 += 1.0f / 6; + flameElem->unkC *= (0.006f * (((1.0f - flameGroup->unk4) * 0.8f) + 0.2f)); + flameElem->flameScroll += flameScrollDisplacement; + flameElem->flameScroll &= 0x1FF; } - if ((sp78 != 0) || (this->unk220 <= 0)) { + if ((sp78 != 0) || (this->timer <= 0)) { Actor_Kill(&this->actor); return; } - temp_fs0 = sp98->unk0 * 120.0f; - temp_fs1 = sp98->unk4 * 120.0f; + temp_fs0 = flameGroup->unk0 * 120.0f; + temp_fs1 = flameGroup->unk4 * 120.0f; Actor_OffsetOfPointInActorCoords(&this->actor, &sp68, &GET_PLAYER(play)->actor.world.pos); if (sp68.z < temp_fs1) { @@ -667,7 +670,7 @@ void func_8092F878(EnHonotrap* this, PlayState* play) { if (var_fs0_2 > 1.0f) { var_fs0_2 = 1.0f; } - sp80 *= ((1.0f - sp98->unk4) * 0.8f) + 0.2f; + sp80 *= ((1.0f - flameGroup->unk4) * 0.8f) + 0.2f; if (sp80 > 0.2f) { this->collider.cyl.dim.pos.x = (s16)(s32)((Math_SinS(this->actor.shape.rot.y) * sp68.z) + this->actor.world.pos.x); @@ -682,60 +685,57 @@ void func_8092F878(EnHonotrap* this, PlayState* play) { } } -extern Vec3f D_809304EC; -extern Vec3f D_809304F8; - void EnHonotrap_Update(Actor* thisx, PlayState* play) { + static Vec3f velocity = { 0, 0, 0 }; + static Vec3f accel = { 0, 0.1, 0 }; EnHonotrap* this = (EnHonotrap*)thisx; - if (this->unk220 > 0) { - this->unk220 -= 1; + if (this->timer > 0) { + this->timer--; } if ((this->actor.child != NULL) && (this->actor.child->update == NULL)) { this->actor.child = NULL; } this->actionFunc(this, play); if (this->collider.tris.base.acFlags & AC_HIT) { - EffectSsBomb2_SpawnLayered(play, &this->actor.world.pos, &D_809304EC, &D_809304F8, 15, 8); + EffectSsBomb2_SpawnLayered(play, &this->actor.world.pos, &velocity, &accel, 15, 8); Actor_Kill(&this->actor); - return; - } - if (this->unk222 < 3) { + } else if (this->eyeState < HONOTRAP_EYE_SHUT) { this->collider.tris.base.acFlags &= ~AC_HIT; CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.tris.base); } } -void func_8092FE44(Actor* thisx, PlayState* play) { +void EnHonotrap_UpdateFlame(Actor* thisx, PlayState* play) { EnHonotrap* this = (EnHonotrap*)thisx; - if (this->unk220 > 0) { - this->unk220--; + if (this->timer > 0) { + this->timer--; } - this->unk2C0 = 0; - this->unk238 += 0x640; - if (this->actor.params != 4) { - this->actor.shape.yOffset = Math_SinS(this->unk238) * 1000.0f + 600.0f; + this->colChkFlags = 0; + this->bobPhase += 0x640; + if (this->actor.params != HONOTRAP_FLAME_GROUP) { + this->actor.shape.yOffset = Math_SinS(this->bobPhase) * 1000.0f + 600.0f; } Actor_SetFocus(&this->actor, 5.0f); Actor_PlaySfx(&this->actor, NA_SE_EV_BURN_OUT - SFX_FLAG); this->actionFunc(this, play); - this->unk23A -= 0x14; - this->unk23A &= 0x1FF; + this->flameScroll -= 20; + this->flameScroll &= 0x1FF; } -void func_8092FEFC(Actor* thisx, PlayState* play) { +void EnHonotrap_UpdateFlameGroup(Actor* thisx, PlayState* play) { EnHonotrap* this = (EnHonotrap*)thisx; - Actor* temp_v0; + Actor* parent; - temp_v0 = this->actor.parent; - if ((temp_v0 != NULL) && (temp_v0->update == NULL)) { + parent = this->actor.parent; + if ((parent != NULL) && (parent->update == NULL)) { this->actor.parent = NULL; } - if (this->unk220 > 0) { - this->unk220--; + if (this->timer > 0) { + this->timer--; } - this->unk238 += 0x640; + this->bobPhase += 0x640; Actor_PlaySfx(&this->actor, NA_SE_EV_BURN_OUT - SFX_FLAG); this->actionFunc(this, play); } @@ -745,20 +745,20 @@ void EnHonotrap_Draw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx); Gfx_SetupDL25_Opa(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x08, D_809303F0[this->unk222]); + gSPSegment(POLY_OPA_DISP++, 0x08, sSilverEyeTextures[this->eyeState]); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_OPA_DISP++, &D_050085F0); + gSPDisplayList(POLY_OPA_DISP++, &gEyeSwitchSilverDL); CLOSE_DISPS(play->state.gfxCtx); } -void func_80930030(Actor* thisx, PlayState* play) { +void EnHonotrap_DrawFlame(Actor* thisx, PlayState* play) { s32 pad; EnHonotrap* this = (EnHonotrap*)thisx; OPEN_DISPS(play->state.gfxCtx); Gfx_SetupDL25_Xlu(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, this->unk23A, 32, 128)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, this->flameScroll, 32, 128)); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 200, 0, 255); gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0); Matrix_RotateYS(Camera_GetCamDirYaw(play->cameraPtrs[play->activeCamId]) + 0x8000, MTXMODE_APPLY); @@ -767,32 +767,34 @@ void func_80930030(Actor* thisx, PlayState* play) { CLOSE_DISPS(play->state.gfxCtx); } -void func_80930190(Actor* thisx, PlayState* play) { +void EnHonotrap_DrawFlameGroup(Actor* thisx, PlayState* play) { s32 pad; EnHonotrap* this; - EnHonotrapArr* temp_s0; - EnHonotrap23C* var_s3; - s32 i; // s4 + EnHonotrapFlameElement* flameElem; + EnHonotrapFlameGroup* flameGroup; + s32 i; s32 pad2; - Vec3s spB8; + Vec3s camDir; OPEN_DISPS(play->state.gfxCtx); Gfx_SetupDL25_Xlu(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 200, 0, 255); gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0); - Camera_GetCamDir(&spB8, play->cameraPtrs[play->activeCamId]); - spB8.y += 0x8000; + Camera_GetCamDir(&camDir, play->cameraPtrs[play->activeCamId]); + camDir.y += 0x8000; this = ((EnHonotrap*)thisx); - 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(play->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); - Matrix_Scale(((fabsf(Math_SinS((s16)(spB8.y - thisx->shape.rot.y) >> 1)) * 0.2f) + 1.7f) * temp_s0->unkC, - temp_s0->unkC, 1.0f, MTXMODE_APPLY); + flameGroup = &this->flameGroup; + for (i = 0; i < ARRAY_COUNT(flameGroup->flameList); i++) { + flameElem = &flameGroup->flameList[i]; + if (flameElem->isDrawn) { + gSPSegment( + POLY_XLU_DISP++, 0x08, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, flameElem->flameScroll, 0x20, 0x80)); + Matrix_SetTranslateRotateYXZ(flameElem->pos.x, flameElem->pos.y - (4000.0f * flameElem->unkC), + flameElem->pos.z, &camDir); + Matrix_Scale(((fabsf(Math_SinS((s16)(camDir.y - thisx->shape.rot.y) >> 1)) * 0.2f) + 1.7f) * + flameElem->unkC, + flameElem->unkC, 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++, gEffFire1DL); } 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 d101d9506..7691ed643 100644 --- a/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.h +++ b/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.h @@ -16,32 +16,40 @@ typedef union { } EnHonotrapCollider; // size = 0xD8 typedef struct { - /* 0x00 */ Vec3f unk0; + /* 0x00 */ Vec3f pos; /* 0x0C */ f32 unkC; - /* 0x10 */ s16 unk_10; - /* 0x12 */ u8 unk12; -} EnHonotrapArr; //size 0x14 + /* 0x10 */ s16 flameScroll; + /* 0x12 */ u8 isDrawn; +} EnHonotrapFlameElement; //size 0x14 typedef struct { f32 unk0; f32 unk4; f32 unk8; - EnHonotrapArr unkC[6]; -} EnHonotrap23C; + EnHonotrapFlameElement flameList[6]; +} EnHonotrapFlameGroup; typedef struct EnHonotrap { /* 0x000 */ Actor actor; /* 0x144 */ EnHonotrapActionFunc actionFunc; /* 0x148 */ EnHonotrapCollider collider; - /* 0x220 */ s16 unk220; - /* 0x222 */ s16 unk222; + /* 0x220 */ s16 timer; + /* 0x222 */ s16 eyeState; /* 0x224 */ s16 unk224; - /* 0x228 */ Vec3f unk228; - /* 0x234 */ f32 unk234; - /* 0x238 */ s16 unk238; - /* 0x23A */ s16 unk23A; - /* 0x23C */ EnHonotrap23C unk23C; - /* 0x2C0 */ u8 unk2C0; + /* 0x228 */ Vec3f targetPos; + /* 0x234 */ f32 speedMod; + /* 0x238 */ s16 bobPhase; + /* 0x23A */ s16 flameScroll; + /* 0x23C */ EnHonotrapFlameGroup flameGroup; + /* 0x2C0 */ u8 colChkFlags; } EnHonotrap; // size = 0x2C4 +typedef enum { + HONOTRAP_EYE, + HONOTRAP_FLAME_MOVE, + HONOTRAP_FLAME_DROP, + HONOTRAP_EYE_MUTI_FLAME, + HONOTRAP_FLAME_GROUP +} EnHonotrapType; + #endif // Z_EN_HONOTRAP_H From b148f50c36774ae687296ec031a1be061fdc7f99 Mon Sep 17 00:00:00 2001 From: mzxrules Date: Thu, 12 Oct 2023 15:37:12 -0400 Subject: [PATCH 06/11] implement most suggestions --- .../actors/ovl_En_Honotrap/z_en_honotrap.c | 73 +++++++++---------- .../actors/ovl_En_Honotrap/z_en_honotrap.h | 28 +++---- 2 files changed, 50 insertions(+), 51 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 bf64f7048..8d8f5540d 100644 --- a/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c +++ b/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c @@ -18,7 +18,8 @@ typedef enum { /* 0 */ HONOTRAP_EYE_OPEN, /* 1 */ HONOTRAP_EYE_HALF, /* 2 */ HONOTRAP_EYE_CLOSE, - /* 3 */ HONOTRAP_EYE_SHUT + /* 3 */ HONOTRAP_EYE_SHUT, + /* 4 */ HONOTRAP_EYE_MAX } EnHonotrapEyeState; void EnHonotrap_Init(Actor* thisx, PlayState* play); @@ -63,10 +64,10 @@ void EnHonotrap_UpdateFlameGroup(Actor* thisx, PlayState* play); void EnHonotrap_DrawFlame(Actor* thisx, PlayState* play); void EnHonotrap_DrawFlameGroup(Actor* thisx, PlayState* play); -TexturePtr sSilverEyeTextures[4] = { gEyeSwitchSilverOpenTex, gEyeSwitchSilverHalfTex, gEyeSwitchSilverClosedTex, - gEyeSwitchSilverClosedTex }; +static TexturePtr sSilverEyeTextures[HONOTRAP_EYE_MAX] = { gEyeSwitchSilverOpenTex, gEyeSwitchSilverHalfTex, + gEyeSwitchSilverClosedTex, gEyeSwitchSilverClosedTex }; -s32 sIsFirstInitEye = true; +static s32 sIsFirstInitEye = true; ActorInit En_Honotrap_InitVars = { ACTOR_EN_HONOTRAP, @@ -207,18 +208,17 @@ void EnHonotrap_InitEye(EnHonotrap* this, PlayState* play) { Collider_SetTrisVertices(&this->collider.tris, i, &triangle[0], &triangle[1], &triangle[2]); } Actor_SetFocus(&this->actor, 0.0f); - if (this->actor.params == HONOTRAP_EYE) { + if (this->actor.params == HONOTRAP_TYPE_EYE) { EnHonotrap_SetupEyeIdle(this); - } else { // HONOTRAP_EYE_MUTI_FLAME + } else { // HONOTRAP_TYPE_EYE_MUTI_FLAME EnHonotrap_SetupEyeIdle2(this); } } void EnHonotrap_InitFlame(EnHonotrap* this, PlayState* play) { s32 pad[2]; - s32 params; + s32 params = this->actor.params; - params = this->actor.params; Actor_SetScale(&this->actor, 0.0001f); Collider_InitCylinder(play, &this->collider.cyl); Collider_SetCylinder(play, &this->collider.cyl, &this->actor, &sCylinderInit); @@ -226,12 +226,12 @@ void EnHonotrap_InitFlame(EnHonotrap* this, PlayState* play) { this->actor.terminalVelocity = -1.0f; CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); - this->actor.shape.shadowAlpha = 0x80; + this->actor.shape.shadowAlpha = 128; this->targetPos = GET_PLAYER(play)->actor.world.pos; this->targetPos.y += 10.0f; this->flameScroll = Rand_ZeroOne() * 511.0f; Actor_PlaySfx(&this->actor, NA_SE_EV_FLAME_IGNITION); - if (params == HONOTRAP_FLAME_DROP) { + if (params == HONOTRAP_TYPE_FLAME_DROP) { this->actor.room = -1; this->collider.cyl.dim.radius = 12; this->collider.cyl.dim.height = 30; @@ -268,15 +268,15 @@ void EnHonotrap_Init(Actor* thisx, PlayState* play) { params = this->actor.params; Actor_ProcessInitChain(&this->actor, sInitChain); - if ((params == HONOTRAP_EYE) || (params == HONOTRAP_EYE_MUTI_FLAME)) { + if ((params == HONOTRAP_TYPE_EYE) || (params == HONOTRAP_TYPE_EYE_MUTI_FLAME)) { EnHonotrap_InitEye(this, play); - } else if (params == HONOTRAP_FLAME_GROUP) { + } else if (params == HONOTRAP_TYPE_FLAME_GROUP) { EnHonotrap_InitFlameGroup(this, play); this->actor.update = EnHonotrap_UpdateFlameGroup; this->actor.draw = EnHonotrap_DrawFlameGroup; this->actor.uncullZoneScale = 500.0f; this->actor.uncullZoneDownward = 500.0f; - } else { // HONOTRAP_FLAME_MOVE, HONOTRAP_FLAME_DROP + } else { // HONOTRAP_TYPE_FLAME_MOVE, HONOTRAP_TYPE_FLAME_DROP EnHonotrap_InitFlame(this, play); this->actor.update = EnHonotrap_UpdateFlame; this->actor.draw = EnHonotrap_DrawFlame; @@ -288,7 +288,7 @@ void EnHonotrap_Destroy(Actor* thisx, PlayState* play) { EnHonotrap* this = (EnHonotrap*)thisx; params = this->actor.params; - if ((params == HONOTRAP_EYE) || (params == HONOTRAP_EYE_MUTI_FLAME)) { + if ((params == HONOTRAP_TYPE_EYE) || (params == HONOTRAP_TYPE_EYE_MUTI_FLAME)) { Collider_DestroyTris(play, &this->collider.tris); } else { Collider_DestroyCylinder(play, &this->collider.cyl); @@ -325,11 +325,11 @@ void EnHonotrap_EyeOpen(EnHonotrap* this, PlayState* play) { this->eyeState--; if (this->eyeState <= HONOTRAP_EYE_OPEN) { EnHonotrap_SetupEyeAttack(this); - Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_HONOTRAP, - (Math_SinS(this->actor.shape.rot.y) * 12.0f) + this->actor.home.pos.x, - this->actor.home.pos.y - 10.0f, - (Math_CosS(this->actor.shape.rot.y) * 12.0f) + this->actor.home.pos.z, - this->actor.home.rot.x, this->actor.home.rot.y, this->actor.home.rot.z, HONOTRAP_FLAME_MOVE); + Actor_SpawnAsChild( + &play->actorCtx, &this->actor, play, ACTOR_EN_HONOTRAP, + (Math_SinS(this->actor.shape.rot.y) * 12.0f) + this->actor.home.pos.x, this->actor.home.pos.y - 10.0f, + (Math_CosS(this->actor.shape.rot.y) * 12.0f) + this->actor.home.pos.z, this->actor.home.rot.x, + this->actor.home.rot.y, this->actor.home.rot.z, HONOTRAP_TYPE_FLAME_MOVE); } } @@ -391,7 +391,7 @@ void EnHonotrap_EyeOpen2(EnHonotrap* this, PlayState* play) { &play->actorCtx, &this->actor, play, ACTOR_EN_HONOTRAP, (Math_SinS(this->actor.shape.rot.y) * 12.0f) + this->actor.home.pos.x, this->actor.home.pos.y, (Math_CosS(this->actor.shape.rot.y) * 12.0f) + this->actor.home.pos.z, this->actor.home.rot.x, - this->actor.home.rot.y, this->actor.home.rot.z, HONOTRAP_FLAME_GROUP); + this->actor.home.rot.y, this->actor.home.rot.z, HONOTRAP_TYPE_FLAME_GROUP); EnHonotrap_SetupEyeAttack2(this); } } @@ -423,14 +423,14 @@ void EnHonotrap_SetupFlame(EnHonotrap* this) { } void EnHonotrap_Flame(EnHonotrap* this, PlayState* play) { - f32 targetScale = (this->actor.params == HONOTRAP_FLAME_MOVE) ? 0.004f : 0.0048f; + f32 targetScale = (this->actor.params == HONOTRAP_TYPE_FLAME_MOVE) ? 0.004f : 0.0048f; s32 targetReached = Math_StepToF(&this->actor.scale.x, targetScale, 0.0006f); this->actor.scale.z = this->actor.scale.y = this->actor.scale.x; if (targetReached) { - if (this->actor.params == HONOTRAP_FLAME_MOVE) { + if (this->actor.params == HONOTRAP_TYPE_FLAME_MOVE) { EnHonotrap_SetupFlameMove(this); - } else { // HONOTRAP_FLAME_DROP + } else { // HONOTRAP_TYPE_FLAME_DROP EnHonotrap_SetupFlameDrop(this); } } @@ -594,7 +594,7 @@ void EnHonotrap_SetupFlameGroup(EnHonotrap* this) { void EnHonotrap_FlameGroup(EnHonotrap* this, PlayState* play) { s32 i; - EnHonotrapFlameGroup* flameGroup; + EnHonotrapFlameGroup* flameGroup = &this->flameGroup; f32 var_fs0; f32 temp_fs0; f32 temp_fs1; @@ -602,14 +602,12 @@ void EnHonotrap_FlameGroup(EnHonotrap* this, PlayState* play) { f32 sp84; f32 sp80; s32 flameScrollDisplacement; - s32 sp78; + s32 sp78 = false; f32 var_fs0_2; Vec3f sp68; EnHonotrapFlameElement* flameElem; - flameGroup = &this->flameGroup; - sp78 = 0; - sp80 = fabsf(Math_CosS(Camera_GetCamDirPitch(play->cameraPtrs[play->activeCamId]))); + sp80 = fabsf(Math_CosS(Camera_GetCamDirPitch(GET_ACTIVE_CAM(play)))); flameScrollDisplacement = (s32)(sp80 * -10.5f) - 10; Math_StepToF(&flameGroup->unk0, 1.0f, 0.05f); if (this->timer <= 40) { @@ -652,7 +650,7 @@ void EnHonotrap_FlameGroup(EnHonotrap* this, PlayState* play) { flameElem->flameScroll &= 0x1FF; } - if ((sp78 != 0) || (this->timer <= 0)) { + if (sp78 || (this->timer <= 0)) { Actor_Kill(&this->actor); return; } @@ -686,8 +684,8 @@ void EnHonotrap_FlameGroup(EnHonotrap* this, PlayState* play) { } void EnHonotrap_Update(Actor* thisx, PlayState* play) { - static Vec3f velocity = { 0, 0, 0 }; - static Vec3f accel = { 0, 0.1, 0 }; + static Vec3f velocity = { 0.0f, 0.0f, 0.0f }; + static Vec3f accel = { 0.0f, 0.1f, 0.0f }; EnHonotrap* this = (EnHonotrap*)thisx; if (this->timer > 0) { @@ -700,7 +698,9 @@ void EnHonotrap_Update(Actor* thisx, PlayState* play) { if (this->collider.tris.base.acFlags & AC_HIT) { EffectSsBomb2_SpawnLayered(play, &this->actor.world.pos, &velocity, &accel, 15, 8); Actor_Kill(&this->actor); - } else if (this->eyeState < HONOTRAP_EYE_SHUT) { + return; + } + if (this->eyeState < HONOTRAP_EYE_SHUT) { this->collider.tris.base.acFlags &= ~AC_HIT; CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.tris.base); } @@ -714,7 +714,7 @@ void EnHonotrap_UpdateFlame(Actor* thisx, PlayState* play) { } this->colChkFlags = 0; this->bobPhase += 0x640; - if (this->actor.params != HONOTRAP_FLAME_GROUP) { + if (this->actor.params != HONOTRAP_TYPE_FLAME_GROUP) { this->actor.shape.yOffset = Math_SinS(this->bobPhase) * 1000.0f + 600.0f; } Actor_SetFocus(&this->actor, 5.0f); @@ -726,9 +726,8 @@ void EnHonotrap_UpdateFlame(Actor* thisx, PlayState* play) { void EnHonotrap_UpdateFlameGroup(Actor* thisx, PlayState* play) { EnHonotrap* this = (EnHonotrap*)thisx; - Actor* parent; + Actor* parent = this->actor.parent; - parent = this->actor.parent; if ((parent != NULL) && (parent->update == NULL)) { this->actor.parent = NULL; } @@ -761,7 +760,7 @@ void EnHonotrap_DrawFlame(Actor* thisx, PlayState* play) { Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, this->flameScroll, 32, 128)); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 200, 0, 255); gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0); - Matrix_RotateYS(Camera_GetCamDirYaw(play->cameraPtrs[play->activeCamId]) + 0x8000, MTXMODE_APPLY); + Matrix_RotateYS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x8000, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); CLOSE_DISPS(play->state.gfxCtx); @@ -780,7 +779,7 @@ void EnHonotrap_DrawFlameGroup(Actor* thisx, PlayState* play) { Gfx_SetupDL25_Xlu(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 200, 0, 255); gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0); - Camera_GetCamDir(&camDir, play->cameraPtrs[play->activeCamId]); + Camera_GetCamDir(&camDir, GET_ACTIVE_CAM(play)); camDir.y += 0x8000; this = ((EnHonotrap*)thisx); flameGroup = &this->flameGroup; 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 7691ed643..a954ea6d8 100644 --- a/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.h +++ b/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.h @@ -9,10 +9,10 @@ typedef void (*EnHonotrapActionFunc)(struct EnHonotrap*, PlayState*); typedef union { struct { - ColliderTris tris; - ColliderTrisElement elements[2]; + /* 0x00 */ ColliderTris tris; + /* 0x20 */ ColliderTrisElement elements[2]; }; - ColliderCylinder cyl; + /* 0x00 */ ColliderCylinder cyl; } EnHonotrapCollider; // size = 0xD8 typedef struct { @@ -20,14 +20,14 @@ typedef struct { /* 0x0C */ f32 unkC; /* 0x10 */ s16 flameScroll; /* 0x12 */ u8 isDrawn; -} EnHonotrapFlameElement; //size 0x14 +} EnHonotrapFlameElement; // size = 0x14 typedef struct { - f32 unk0; - f32 unk4; - f32 unk8; - EnHonotrapFlameElement flameList[6]; -} EnHonotrapFlameGroup; + /* 0x00 */ f32 unk0; + /* 0x04 */ f32 unk4; + /* 0x08 */ f32 unk8; + /* 0x0C */ EnHonotrapFlameElement flameList[6]; +} EnHonotrapFlameGroup; // size = 0x84; typedef struct EnHonotrap { /* 0x000 */ Actor actor; @@ -45,11 +45,11 @@ typedef struct EnHonotrap { } EnHonotrap; // size = 0x2C4 typedef enum { - HONOTRAP_EYE, - HONOTRAP_FLAME_MOVE, - HONOTRAP_FLAME_DROP, - HONOTRAP_EYE_MUTI_FLAME, - HONOTRAP_FLAME_GROUP + HONOTRAP_TYPE_EYE, + HONOTRAP_TYPE_FLAME_MOVE, + HONOTRAP_TYPE_FLAME_DROP, + HONOTRAP_TYPE_EYE_MUTI_FLAME, + HONOTRAP_TYPE_FLAME_GROUP } EnHonotrapType; #endif // Z_EN_HONOTRAP_H From efc9ad4f3dc3234d299f1882ad0dc4a3ffcb3077 Mon Sep 17 00:00:00 2001 From: mzxrules Date: Thu, 12 Oct 2023 22:07:44 -0400 Subject: [PATCH 07/11] space out OPEN/CLOSE_DISP --- src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c | 6 ++++++ 1 file changed, 6 insertions(+) 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 8d8f5540d..705fe3490 100644 --- a/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c +++ b/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c @@ -743,10 +743,12 @@ void EnHonotrap_Draw(Actor* thisx, PlayState* play) { EnHonotrap* this = (EnHonotrap*)thisx; OPEN_DISPS(play->state.gfxCtx); + Gfx_SetupDL25_Opa(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, sSilverEyeTextures[this->eyeState]); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, &gEyeSwitchSilverDL); + CLOSE_DISPS(play->state.gfxCtx); } @@ -755,6 +757,7 @@ void EnHonotrap_DrawFlame(Actor* thisx, PlayState* play) { EnHonotrap* this = (EnHonotrap*)thisx; OPEN_DISPS(play->state.gfxCtx); + Gfx_SetupDL25_Xlu(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, this->flameScroll, 32, 128)); @@ -763,6 +766,7 @@ void EnHonotrap_DrawFlame(Actor* thisx, PlayState* play) { Matrix_RotateYS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x8000, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); + CLOSE_DISPS(play->state.gfxCtx); } @@ -776,6 +780,7 @@ void EnHonotrap_DrawFlameGroup(Actor* thisx, PlayState* play) { Vec3s camDir; OPEN_DISPS(play->state.gfxCtx); + Gfx_SetupDL25_Xlu(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 200, 0, 255); gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0); @@ -798,5 +803,6 @@ void EnHonotrap_DrawFlameGroup(Actor* thisx, PlayState* play) { gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); } } + CLOSE_DISPS(play->state.gfxCtx); } From 60d953cac4a61c95769361972139997e40286e73 Mon Sep 17 00:00:00 2001 From: mzxrules Date: Mon, 16 Oct 2023 21:50:02 -0400 Subject: [PATCH 08/11] more improvements --- .../actors/ovl_En_Honotrap/z_en_honotrap.c | 19 ++++++++++++------- .../actors/ovl_En_Honotrap/z_en_honotrap.h | 18 +++++++++--------- 2 files changed, 21 insertions(+), 16 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 705fe3490..d3bc8eefe 100644 --- a/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c +++ b/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c @@ -64,8 +64,12 @@ void EnHonotrap_UpdateFlameGroup(Actor* thisx, PlayState* play); void EnHonotrap_DrawFlame(Actor* thisx, PlayState* play); void EnHonotrap_DrawFlameGroup(Actor* thisx, PlayState* play); -static TexturePtr sSilverEyeTextures[HONOTRAP_EYE_MAX] = { gEyeSwitchSilverOpenTex, gEyeSwitchSilverHalfTex, - gEyeSwitchSilverClosedTex, gEyeSwitchSilverClosedTex }; +static TexturePtr sSilverEyeTextures[HONOTRAP_EYE_MAX] = { + gEyeSwitchSilverOpenTex, + gEyeSwitchSilverHalfTex, + gEyeSwitchSilverClosedTex, + gEyeSwitchSilverClosedTex, +}; static s32 sIsFirstInitEye = true; @@ -81,7 +85,7 @@ ActorInit En_Honotrap_InitVars = { (ActorFunc)EnHonotrap_Draw, }; -static ColliderTrisElementInit sTrisElementsInit[2] = { +static ColliderTrisElementInit sTrisElementsInit[] = { { { ELEMTYPE_UNK4, @@ -187,7 +191,7 @@ void EnHonotrap_InitEye(EnHonotrap* this, PlayState* play) { if (sIsFirstInitEye) { sIsFirstInitEye = false; - for (k = 0; k < ARRAY_COUNT(sSilverEyeTextures); k++) { + for (k = 0; k < HONOTRAP_EYE_MAX; k++) { sSilverEyeTextures[k] = Lib_SegmentedToVirtual(sSilverEyeTextures[k]); } } @@ -684,8 +688,8 @@ void EnHonotrap_FlameGroup(EnHonotrap* this, PlayState* play) { } void EnHonotrap_Update(Actor* thisx, PlayState* play) { - static Vec3f velocity = { 0.0f, 0.0f, 0.0f }; - static Vec3f accel = { 0.0f, 0.1f, 0.0f }; + static Vec3f sVelocity = { 0.0f, 0.0f, 0.0f }; + static Vec3f sAccel = { 0.0f, 0.1f, 0.0f }; EnHonotrap* this = (EnHonotrap*)thisx; if (this->timer > 0) { @@ -696,7 +700,7 @@ void EnHonotrap_Update(Actor* thisx, PlayState* play) { } this->actionFunc(this, play); if (this->collider.tris.base.acFlags & AC_HIT) { - EffectSsBomb2_SpawnLayered(play, &this->actor.world.pos, &velocity, &accel, 15, 8); + EffectSsBomb2_SpawnLayered(play, &this->actor.world.pos, &sVelocity, &sAccel, 15, 8); Actor_Kill(&this->actor); return; } @@ -786,6 +790,7 @@ void EnHonotrap_DrawFlameGroup(Actor* thisx, PlayState* play) { gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0); Camera_GetCamDir(&camDir, GET_ACTIVE_CAM(play)); camDir.y += 0x8000; + //! FAKE: this = ((EnHonotrap*)thisx); flameGroup = &this->flameGroup; for (i = 0; i < ARRAY_COUNT(flameGroup->flameList); i++) { 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 a954ea6d8..db78f30ff 100644 --- a/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.h +++ b/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.h @@ -23,10 +23,10 @@ typedef struct { } EnHonotrapFlameElement; // size = 0x14 typedef struct { - /* 0x00 */ f32 unk0; - /* 0x04 */ f32 unk4; - /* 0x08 */ f32 unk8; - /* 0x0C */ EnHonotrapFlameElement flameList[6]; + /* 0x0 */ f32 unk0; + /* 0x4 */ f32 unk4; + /* 0x8 */ f32 unk8; + /* 0xC */ EnHonotrapFlameElement flameList[6]; } EnHonotrapFlameGroup; // size = 0x84; typedef struct EnHonotrap { @@ -45,11 +45,11 @@ typedef struct EnHonotrap { } EnHonotrap; // size = 0x2C4 typedef enum { - HONOTRAP_TYPE_EYE, - HONOTRAP_TYPE_FLAME_MOVE, - HONOTRAP_TYPE_FLAME_DROP, - HONOTRAP_TYPE_EYE_MUTI_FLAME, - HONOTRAP_TYPE_FLAME_GROUP + /* 0 */ HONOTRAP_TYPE_EYE, + /* 1 */ HONOTRAP_TYPE_FLAME_MOVE, + /* 2 */ HONOTRAP_TYPE_FLAME_DROP, + /* 3 */ HONOTRAP_TYPE_EYE_MUTI_FLAME, + /* 4 */ HONOTRAP_TYPE_FLAME_GROUP } EnHonotrapType; #endif // Z_EN_HONOTRAP_H From 6e37057cbd018e9d68d028daaf97ab95b2788a6f Mon Sep 17 00:00:00 2001 From: mzxrules Date: Wed, 25 Oct 2023 05:27:36 -0400 Subject: [PATCH 09/11] implement suggestions --- .../actors/ovl_En_Honotrap/z_en_honotrap.c | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 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 d3bc8eefe..8590aa676 100644 --- a/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c +++ b/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c @@ -47,8 +47,8 @@ void EnHonotrap_SetupEyeAttack2(EnHonotrap* this); void EnHonotrap_EyeAttack2(EnHonotrap* this, PlayState* play); void EnHonotrap_SetupEyeClose2(EnHonotrap* this); void EnHonotrap_EyeClose2(EnHonotrap* this, PlayState* play); -void EnHonotrap_SetupFlame(EnHonotrap* this); -void EnHonotrap_Flame(EnHonotrap* this, PlayState* play); +void EnHonotrap_SetupFlameGrow(EnHonotrap* this); +void EnHonotrap_FlameGrow(EnHonotrap* this, PlayState* play); void EnHonotrap_SetupFlameDrop(EnHonotrap* this); void EnHonotrap_FlameDrop(EnHonotrap* this, PlayState* play); void EnHonotrap_SetupFlameMove(EnHonotrap* this); @@ -241,7 +241,7 @@ void EnHonotrap_InitFlame(EnHonotrap* this, PlayState* play) { this->collider.cyl.dim.height = 30; this->actor.shape.yOffset = -1000.0f; } - EnHonotrap_SetupFlame(this); + EnHonotrap_SetupFlameGrow(this); } void EnHonotrap_InitFlameGroup(EnHonotrap* this, PlayState* play) { @@ -422,11 +422,11 @@ void EnHonotrap_EyeClose2(EnHonotrap* this, PlayState* play) { } } -void EnHonotrap_SetupFlame(EnHonotrap* this) { - this->actionFunc = EnHonotrap_Flame; +void EnHonotrap_SetupFlameGrow(EnHonotrap* this) { + this->actionFunc = EnHonotrap_FlameGrow; } -void EnHonotrap_Flame(EnHonotrap* this, PlayState* play) { +void EnHonotrap_FlameGrow(EnHonotrap* this, PlayState* play) { f32 targetScale = (this->actor.params == HONOTRAP_TYPE_FLAME_MOVE) ? 0.004f : 0.0048f; s32 targetReached = Math_StepToF(&this->actor.scale.x, targetScale, 0.0006f); @@ -776,9 +776,9 @@ void EnHonotrap_DrawFlame(Actor* thisx, PlayState* play) { void EnHonotrap_DrawFlameGroup(Actor* thisx, PlayState* play) { s32 pad; - EnHonotrap* this; + EnHonotrap* this = ((EnHonotrap*)thisx); EnHonotrapFlameElement* flameElem; - EnHonotrapFlameGroup* flameGroup; + EnHonotrapFlameGroup* flameGroup = &this->flameGroup; s32 i; s32 pad2; Vec3s camDir; @@ -790,9 +790,7 @@ void EnHonotrap_DrawFlameGroup(Actor* thisx, PlayState* play) { gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0); Camera_GetCamDir(&camDir, GET_ACTIVE_CAM(play)); camDir.y += 0x8000; - //! FAKE: - this = ((EnHonotrap*)thisx); - flameGroup = &this->flameGroup; + for (i = 0; i < ARRAY_COUNT(flameGroup->flameList); i++) { flameElem = &flameGroup->flameList[i]; if (flameElem->isDrawn) { From 04010f8903d4d6ba4b7f0f3215fff2f7a9c2f9d6 Mon Sep 17 00:00:00 2001 From: mzxrules Date: Wed, 25 Oct 2023 13:41:58 -0400 Subject: [PATCH 10/11] implement alf suggestions --- src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c | 6 ++---- 1 file changed, 2 insertions(+), 4 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 8590aa676..a1dc40263 100644 --- a/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c +++ b/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c @@ -180,13 +180,11 @@ void EnHonotrap_InitEye(EnHonotrap* this, PlayState* play) { s32 i; s32 j; s32 k; - f32 sin; - f32 cos; + f32 sin = Math_SinS(this->actor.home.rot.y); + f32 cos = Math_CosS(this->actor.home.rot.y); Vec3f triangle[3]; Vec3f* vtx; - sin = Math_SinS(this->actor.home.rot.y); - cos = Math_CosS(this->actor.home.rot.y); Actor_SetScale(&this->actor, 0.1f); if (sIsFirstInitEye) { From 87d182defbd469c6d85b6346c9a09a829e31c398 Mon Sep 17 00:00:00 2001 From: mzxrules Date: Wed, 25 Oct 2023 17:12:05 -0400 Subject: [PATCH 11/11] u substitution --- src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 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 a1dc40263..4ea4b410d 100644 --- a/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c +++ b/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c @@ -649,7 +649,7 @@ void EnHonotrap_FlameGroup(EnHonotrap* this, PlayState* play) { var_fs0 += 1.0f / 6; flameElem->unkC *= (0.006f * (((1.0f - flameGroup->unk4) * 0.8f) + 0.2f)); flameElem->flameScroll += flameScrollDisplacement; - flameElem->flameScroll &= 0x1FF; + flameElem->flameScroll %= 0x200u; } if (sp78 || (this->timer <= 0)) { @@ -723,7 +723,7 @@ void EnHonotrap_UpdateFlame(Actor* thisx, PlayState* play) { Actor_PlaySfx(&this->actor, NA_SE_EV_BURN_OUT - SFX_FLAG); this->actionFunc(this, play); this->flameScroll -= 20; - this->flameScroll &= 0x1FF; + this->flameScroll %= 0x200u; } void EnHonotrap_UpdateFlameGroup(Actor* thisx, PlayState* play) {