From 31e4089a4b21e1be07cbc8d2c8e764d231953cc4 Mon Sep 17 00:00:00 2001 From: Maide <34639600+Kelebek1@users.noreply.github.com> Date: Thu, 4 Nov 2021 17:42:01 +0000 Subject: [PATCH] En_Goroiwa (3 non-matching) (#375) * En_Goroiwa * Fix names * Params * Revert PR --- include/functions.h | 6 +- spec | 5 +- .../actors/ovl_En_Goroiwa/z_en_goroiwa.c | 1609 ++++++++++++++++- .../actors/ovl_En_Goroiwa/z_en_goroiwa.h | 71 +- undefined_syms.txt | 12 + 5 files changed, 1625 insertions(+), 78 deletions(-) diff --git a/include/functions.h b/include/functions.h index 5a954660a3..ba2868e615 100644 --- a/include/functions.h +++ b/include/functions.h @@ -544,8 +544,8 @@ void func_800AE5A0(GlobalContext* globalCtx); // void func_800AE5E4(void); void func_800AE778(GlobalContext* globalCtx, Color_RGBA8* color, s16 param_3, s16 param_4); void func_800AE8EC(GlobalContext* globalCtx); -void func_800AE930(CollisionContext* colCtx, s32 param_2, float* param_3, f32 param_4, s16 param_5, CollisionPoly* param_6, s32 param_7); -// void func_800AEF44(void); +void func_800AE930(CollisionContext* colCtx, s32 param_2, Vec3f* param_3, f32 param_4, s16 param_5, CollisionPoly* param_6, s32 param_7); +void func_800AEF44(s32 arg0); void EffectTireMark_InitParticle(EffTireMarkParticle* particle); void EffectTireMark_Init(EffTireMarkParams* params, EffTireMarkInit* init); void EffectTireMark_Destroy(EffTireMarkParams* params); @@ -984,7 +984,7 @@ f32 func_800C4000(GlobalContext* globalCtx, CollisionContext* colCtx, s32* arg2, // void func_800C4058(void); f32 func_800C40B4(CollisionContext* colCtx, CollisionPoly** arg1, s32* arg2, Vec3f* pos); f32 func_800C411C(CollisionContext* colCtx, CollisionPoly** arg1, s32* arg2, Actor* actor, Vec3f* pos); -// void func_800C4188(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6); +f32 func_800C4188(GlobalContext* globalCtx, CollisionContext* colCtx, CollisionPoly** outPoly, s32* bgId, Actor* actor, Vec3f* pos); // void func_800C41E4(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6); // void func_800C4240(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6); // void func_800C42A8(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5); diff --git a/spec b/spec index fa3825d824..90deac25bc 100644 --- a/spec +++ b/spec @@ -1557,8 +1557,11 @@ beginseg name "ovl_En_Goroiwa" compress include "build/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.o" - include "build/data/ovl_En_Goroiwa/ovl_En_Goroiwa.data.o" +#ifdef NON_MATCHING + include "build/src/overlays/actors/ovl_En_Goroiwa/ovl_En_Goroiwa_reloc.o" +#else include "build/data/ovl_En_Goroiwa/ovl_En_Goroiwa.reloc.o" +#endif endseg beginseg diff --git a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c index e2ab6909c3..e06c886893 100644 --- a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c +++ b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c @@ -1,7 +1,7 @@ /* * File: z_en_goroiwa.c * Overlay: ovl_En_Goroiwa - * Description: Rolling boulder + * Description: Rolling boulders */ #include "z_en_goroiwa.h" @@ -15,7 +15,36 @@ void EnGoroiwa_Destroy(Actor* thisx, GlobalContext* globalCtx); void EnGoroiwa_Update(Actor* thisx, GlobalContext* globalCtx); void EnGoroiwa_Draw(Actor* thisx, GlobalContext* globalCtx); -#if 0 +void func_809419D0(EnGoroiwa* this); +void func_80941A10(EnGoroiwa* this, GlobalContext* globalCtx); +void func_809421E0(EnGoroiwa* this); +void func_8094220C(EnGoroiwa* this, GlobalContext* globalCtx); +void func_809425CC(EnGoroiwa* this); +void func_80942604(EnGoroiwa* this, GlobalContext* globalCtx); +void func_80941DB4(EnGoroiwa* this); +void func_80941E28(EnGoroiwa* this, GlobalContext* globalCtx); +void func_80941EB4(EnGoroiwa* this); +void func_80941F10(EnGoroiwa* this, GlobalContext* globalCtx); +void func_80941F54(EnGoroiwa* this); +void func_80941FA4(EnGoroiwa* this, GlobalContext* globalCtx); +void func_80942084(EnGoroiwa* this); +void func_809420F0(EnGoroiwa* this, GlobalContext* globalCtx); + +extern Gfx D_060032E0[]; +extern Gfx D_060082D0[]; +extern Gfx D_06005C20[]; +extern Gfx D_06003B40[]; +extern Gfx D_06008B90[]; +extern Gfx D_060042B0[]; +extern Gfx D_06004960[]; +extern Gfx D_06004EF0[]; +extern Gfx D_060003B0[]; +extern Gfx D_060028E0[]; +extern Gfx D_06002D70[]; +extern Gfx D_060072F0[]; +extern Gfx D_060077D0[]; +extern Gfx D_06007C60[]; + const ActorInit En_Goroiwa_InitVars = { ACTOR_EN_GOROIWA, ACTORCAT_PROP, @@ -28,141 +57,1577 @@ const ActorInit En_Goroiwa_InitVars = { (ActorFunc)EnGoroiwa_Draw, }; -// static ColliderJntSphElementInit sJntSphElementsInit[1] = { -static ColliderJntSphElementInit D_80942DC0[1] = { +static ColliderJntSphElementInit sJntSphElementsInit[1] = { { - { ELEMTYPE_UNK0, { 0x20000000, 0x00, 0x04 }, { 0x01C37BB6, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NONE, BUMP_ON, OCELEM_ON, }, + { + ELEMTYPE_UNK0, + { 0x20000000, 0x00, 0x04 }, + { 0x01C37BB6, 0x00, 0x00 }, + TOUCH_ON | TOUCH_SFX_NONE, + BUMP_ON, + OCELEM_ON, + }, { 0, { { 0, 0, 0 }, 58 }, 100 }, }, }; -// static ColliderJntSphInit sJntSphInit = { -static ColliderJntSphInit D_80942DE4 = { - { COLTYPE_METAL, AT_ON | AT_TYPE_ENEMY, AC_ON | AC_HARD | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_2, COLSHAPE_JNTSPH, }, - 1, D_80942DC0, // sJntSphElementsInit, +static ColliderJntSphInit sJntSphInit = { + { + COLTYPE_METAL, + AT_ON | AT_TYPE_ENEMY, + AC_ON | AC_HARD | AC_TYPE_PLAYER, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_2, + COLSHAPE_JNTSPH, + }, + 1, + sJntSphElementsInit, }; -// sColChkInfoInit -static CollisionCheckInfoInit D_80942DF4 = { 0, 12, 60, MASS_HEAVY }; +static CollisionCheckInfoInit sColChkInfoInit = { 0, 12, 60, MASS_HEAVY }; -// static InitChainEntry sInitChain[] = { -static InitChainEntry D_80942E78[] = { - ICHAIN_F32_DIV1000(gravity, -900, ICHAIN_CONTINUE), - ICHAIN_F32_DIV1000(minVelocityY, -26000, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneForward, 2000, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneScale, 160, ICHAIN_CONTINUE), +static f32 D_80942DFC[] = { + 10.0f, + 12.0f, + 14.0f, + 10.0f, +}; + +static Gfx* D_80942E0C[][3] = { + { D_060042B0, D_06004960, D_06004EF0 }, + { D_060003B0, D_060028E0, D_06002D70 }, + { D_060072F0, D_060077D0, D_06007C60 }, +}; + +static Color_RGBA8 D_80942E30[] = { + { 190, 195, 200, 255 }, + { 170, 130, 90, 255 }, +}; + +static Color_RGBA8 D_80942E38 = { 250, 250, 250, 255 }; + +static Color_RGBA8 D_80942E3C[] = { + { 130, 135, 140, 255 }, + { 100, 60, 20, 255 }, +}; + +static Color_RGBA8 D_80942E44 = { 180, 180, 180, 255 }; + +static Vec3f D_80942E48 = { 0.0f, 0.0f, 0.0f }; +static Vec3f D_80942E54 = { 0.0f, 0.3f, 0.0f }; +static Vec3f D_80942E60 = { 0.0f, 1.0f, 0.0f }; +static Vec3f D_80942E6C = { 0.0f, 0.0f, 1.0f }; + +static InitChainEntry sInitChain[] = { + ICHAIN_F32_DIV1000(gravity, -900, ICHAIN_CONTINUE), ICHAIN_F32_DIV1000(minVelocityY, -26000, ICHAIN_CONTINUE), + ICHAIN_F32(uncullZoneForward, 2000, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneScale, 160, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneDownward, 350, ICHAIN_STOP), }; +static UNK_TYPE D_80942E8C[] = { + 0x0000003B, + 0x1A1A2864, +}; + +void func_8093E8A0(EnGoroiwa* this) { + s32 params = ENGOROIWA_GET_3000(&this->actor); + f32 phi_f2; + + if (params == ENGOROIWA_3000_0) { + phi_f2 = 0.1f; + } else if (params == ENGOROIWA_3000_1) { + phi_f2 = 0.05f; + } else { + phi_f2 = (Rand_ZeroOne() * (f32)0.04) + 0.04f; + } + + Actor_SetScale(&this->actor, phi_f2); +} + +void func_8093E91C(EnGoroiwa* this) { + this->unk_1DC = this->actor.scale.x * 595.0f; +} + +void func_8093E938(EnGoroiwa* this) { + Sphere16* worldSphere = &this->collider.elements->dim.worldSphere; + + worldSphere->center.x = this->actor.world.pos.x; + worldSphere->center.y = this->actor.world.pos.y + this->unk_1DC; + worldSphere->center.z = this->actor.world.pos.z; + this->collider.elements->dim.worldSphere.radius = this->unk_1DC - 1.0f; +} + +void func_8093E9B0(EnGoroiwa* this, GlobalContext* globalCtx) { + s32 pad[2]; + s32 params = ENGOROIWA_GET_C000(&this->actor); + + Collider_InitJntSph(globalCtx, &this->collider); + Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); + func_8093E938(this); + this->collider.elements[0].dim.worldSphere.radius = this->unk_1DC - 1.0f; + + if ((params == ENGOROIWA_C000_1) || (params == ENGOROIWA_C000_2)) { + this->collider.elements[0].info.bumper.dmgFlags |= (0x4000 | 0x400 | 0x100); + if (params == ENGOROIWA_C000_1) { + this->collider.base.colType = COLTYPE_WOOD; + } else { + this->collider.elements[0].info.bumper.dmgFlags &= ~(0x400000 | 0x200 | 0x2); + this->collider.elements[0].info.bumper.dmgFlags |= (0x80000000 | 0x800 | 0x8); + this->collider.base.colType = COLTYPE_NONE; + } + } +} + +void func_8093EAB0(EnGoroiwa* this, u8 arg0) { + this->unk_1E5 &= ~7; + this->unk_1E5 |= arg0; +} + +s32 func_8093EAD4(Vec3f* arg0, Vec3f* arg1) { + f32 temp_f0 = Math3D_Vec3fMagnitude(arg1); + + if (temp_f0 < 0.001f) { + return false; + } + arg0->x = arg1->x * (1.0f / temp_f0); + arg0->y = arg1->y * (1.0f / temp_f0); + arg0->z = arg1->z * (1.0f / temp_f0); + return true; +} + +void func_8093EB58(EnGoroiwa* this, GlobalContext* globalCtx) { + this->unk_1E4 = (this->actor.home.rot.x >> 1) & 3; +} + +f32 func_8093EB74(EnGoroiwa* this, GlobalContext* globalCtx) { + s32 i; + Path* path = &globalCtx->setupPathList[ENGOROIWA_GET_FF(&this->actor)]; + s32 temp_s4 = path->count; + f32 temp_f20 = 0.0f; + Vec3f sp54; + Vec3f sp48; + + Math_Vec3s_ToVec3f(&sp48, &this->unk_1D0[0]); + + for (i = 1; i < temp_s4; i++) { + Math_Vec3f_Copy(&sp54, &sp48); + Math_Vec3s_ToVec3f(&sp48, &this->unk_1D0[i]); + temp_f20 += Math3D_Distance(&sp54, &sp48); + } + + return temp_f20; +} + +void func_8093EC50(EnGoroiwa* this) { + Vec3s* var = &this->unk_1D0[this->unk_1D8]; + Vec3f sp18; + + sp18.x = var->x; + sp18.y = var->y; + sp18.z = var->z; + this->actor.world.rot.y = Math_Vec3f_Yaw(&this->actor.world.pos, &sp18); +} + +void func_8093ECD4(EnGoroiwa* this) { + s32 params = ENGOROIWA_GET_300(&this->actor); + + if (this->unk_1D8 < 0) { + if ((params == ENGOROIWA_300_0) || (params == ENGOROIWA_300_1)) { + this->unk_1D8 = this->unk_1D4 - 1; + this->unk_1DA = -1; + this->unk_1D6 = this->unk_1D4; + } else if (params == ENGOROIWA_300_3) { + this->unk_1D6 = 0; + this->unk_1D8 = 1; + this->unk_1DA = 1; + } + } else if (this->unk_1D4 < this->unk_1D8) { + if ((params == ENGOROIWA_300_0) || (params == ENGOROIWA_300_1)) { + this->unk_1D6 = 0; + this->unk_1D8 = 1; + this->unk_1DA = 1; + } else if (params == ENGOROIWA_300_3) { + this->unk_1D6 = this->unk_1D4; + this->unk_1D8 = this->unk_1D4 - 1; + this->unk_1DA = -1; + } + } +} + +void func_8093ED80(EnGoroiwa* this) { + this->unk_1D6 = this->unk_1D8; + this->unk_1D8 += this->unk_1DA; + func_8093ECD4(this); +} + +void func_8093EDB0(EnGoroiwa* this) { + this->unk_1DA = -this->unk_1DA; + this->unk_1D6 = this->unk_1D8; + this->unk_1D8 += this->unk_1DA; +} + +void func_8093EDD8(EnGoroiwa* this, GlobalContext* globalCtx) { + this->unk_1D4 = globalCtx->setupPathList[ENGOROIWA_GET_FF(&this->actor)].count - 1; + this->unk_1D6 = 0; + this->unk_1D8 = 1; + this->unk_1DA = 1; +} + +void func_8093EE18(EnGoroiwa* this, GlobalContext* globalCtx) { + this->unk_1D4 = globalCtx->setupPathList[ENGOROIWA_GET_FF(&this->actor)].count - 1; + this->unk_1D6 = this->actor.home.rot.y; + this->unk_1D8 = this->unk_1D6 + 1; + this->unk_1DA = 1; +} + +void func_8093EE64(EnGoroiwa* this, s32 arg1) { + Vec3s* temp_v0 = &this->unk_1D0[arg1]; + + this->actor.world.pos.x = temp_v0->x; + this->actor.world.pos.y = temp_v0->y; + this->actor.world.pos.z = temp_v0->z; +} + +void func_8093EEBC(EnGoroiwa* this) { + this->unk_1B4.x = 1.0f; + this->unk_1C4 = 1.0f; + this->unk_1A8.x = 1.0f; +} + +s32 func_8093EEDC(EnGoroiwa* this) { + Vec3s* temp_v1 = &this->unk_1D0[this->unk_1D8]; + Vec3s* temp_v0 = &this->unk_1D0[this->unk_1D6]; + + if ((temp_v1->x == temp_v0->x) && (temp_v1->z == temp_v0->z)) { + if (temp_v0->y < temp_v1->y) { + return 1; + } + return -1; + } + return 0; +} + +void func_8093EF54(GlobalContext* globalCtx, Vec3f* arg1, Color_RGBA8* arg2, Color_RGBA8* arg3, f32 arg4) { + Vec3f spC4; + f32 temp_f0; + f32 temp_f20; + f32 temp_f24; + f32 temp_f26; + s32 temp_f16; + s16 phi_s0; + s16 temp; + f32 temp_f28; + f32 temp_f30; + s32 i; + + temp_f0 = (arg4 + 0.1f) * 0.5f; + temp_f16 = temp_f0 * 165.0f; + temp_f24 = 470.0f * arg4; + temp_f30 = 400.0f * arg4; + temp_f26 = 800.0f * temp_f0; + temp_f28 = 600.0f * temp_f0; + temp = 0x10000 / temp_f16; + + for (i = 0, phi_s0 = 0; i < temp_f16; i++, phi_s0 += temp) { + // clang-format off + temp_f20 = Rand_ZeroOne(); spC4.x = (Math_SinS(phi_s0) * (temp_f24 * ((temp_f20 * 0.5f) + 0.5f))) + arg1->x; + spC4.y = ((Rand_ZeroOne() - 0.5f) * temp_f30) + arg1->y; + temp_f20 = Rand_ZeroOne(); spC4.z = (Math_CosS(phi_s0) * (temp_f24 * ((temp_f20 * 0.5f) + 0.5f))) + arg1->z; + // clang-format on + + func_800B0E48(globalCtx, &spC4, &D_80942E48, &D_80942E54, arg2, arg3, (Rand_ZeroOne() * temp_f28) + temp_f26, + temp_f26); + } +} + +void func_8093F198(GlobalContext* globalCtx, Vec3f* arg1, f32 arg2) { + Vec3f sp74; + f32 temp_f20; + s32 temp_f16; + s16 temp_lo; + s16 phi_s0; + s32 i; + + temp_f16 = (arg2 + 0.1f) * 58.0f; + sp74.y = arg1->y; + temp_f20 = 550.0f * arg2; + temp_lo = 0x10000 / temp_f16; + + for (i = 0, phi_s0 = 0; i < temp_f16; i++, phi_s0 += temp_lo) { + sp74.x = (Math_SinS((s32)(Rand_ZeroOne() * temp_lo) + phi_s0) * temp_f20) + arg1->x; + sp74.z = (Math_CosS((s32)(Rand_ZeroOne() * temp_lo) + phi_s0) * temp_f20) + arg1->z; + EffectSsGSplash_Spawn(globalCtx, &sp74, NULL, NULL, 0, 0x15E); + } + + EffectSsGRipple_Spawn(globalCtx, arg1, 0x1F4, 0x384, 4); +} + +s32 func_8093F34C(EnGoroiwa* this) { + s32 pad[3]; + Vec3s* temp_v0; + f32 tempX; + f32 tempZ; + f32 x; + f32 z; + + Math_StepToF(&this->actor.speedXZ, D_80942DFC[this->unk_1E4], 0.3f); + Actor_SetVelocityYRotationAndGravity(&this->actor); + temp_v0 = &this->unk_1D0[this->unk_1D8]; + this->actor.velocity.y *= 0.97f; + x = temp_v0->x; + z = temp_v0->z; + + tempX = x - this->actor.world.pos.x; + tempZ = z - this->actor.world.pos.z; + + if (SQ(this->actor.speedXZ + 1.0f) < (SQ(tempX) + SQ(tempZ))) { + this->actor.world.pos.x += this->actor.velocity.x; + this->actor.world.pos.y += this->actor.velocity.y; + this->actor.world.pos.z += this->actor.velocity.z; + this->unk_1E5 &= ~0x40; + return false; + } + + this->actor.world.pos.x = x; + this->actor.world.pos.y += this->actor.velocity.y; + this->actor.world.pos.z = z; + this->unk_1E5 |= 0x40; + return true; +} + +s32 func_8093F498(EnGoroiwa* this) { + s32 pad; + f32 temp_f0; + Vec3f sp2C; + Vec3s* temp_v0 = &this->unk_1D0[this->unk_1D8]; + + sp2C.x = temp_v0->x; + sp2C.y = temp_v0->y; + sp2C.z = temp_v0->z; + + Math_StepToF(&this->actor.speedXZ, D_80942DFC[this->unk_1E4], 0.3f); + Math_Vec3f_Diff(&sp2C, &this->actor.world.pos, &this->actor.velocity); + + temp_f0 = Math3D_Vec3fMagnitude(&this->actor.velocity); + if ((this->actor.speedXZ + 1.0f) < temp_f0) { + Math_Vec3f_Scale(&this->actor.velocity, this->actor.speedXZ / temp_f0); + this->actor.world.pos.x += this->actor.velocity.x; + this->actor.world.pos.y += this->actor.velocity.y; + this->actor.world.pos.z += this->actor.velocity.z; + this->unk_1E5 &= ~0x40; + return false; + } + + this->actor.world.pos.x = sp2C.x; + this->actor.world.pos.y = sp2C.y; + this->actor.world.pos.z = sp2C.z; + this->unk_1E5 |= 0x40; + return true; +} + +s32 func_8093F5EC(EnGoroiwa* this) { + s32 pad; + Vec3s* sp18 = &this->unk_1D0[this->unk_1D8]; + + if (this->actor.velocity.y < 0.0f) { + this->actor.velocity.y = 0.0f; + } + + Math_StepToF(&this->actor.velocity.y, D_80942DFC[this->unk_1E4] * 0.5f, 0.18f); + this->actor.world.pos.x = sp18->x; + this->actor.world.pos.z = sp18->z; + + if (Math_StepToF(&this->actor.world.pos.y, sp18->y, fabsf(this->actor.velocity.y))) { + this->unk_1E5 |= 0x40; + return true; + } + + this->unk_1E5 &= ~0x40; + return false; +} + +s32 func_8093F6F8(EnGoroiwa* this, GlobalContext* globalCtx) { + f32 temp_f14; + Vec3s* sp80 = &this->unk_1D0[this->unk_1D8]; + f32 sp7C = sp80->y; + f32 sp78; + f32 temp_f2; + + Math_StepToF(&this->actor.velocity.y, -18.367346f, 1.0f); + this->actor.velocity.y *= 0.98f; + this->actor.world.pos.x = sp80->x; + this->actor.world.pos.z = sp80->z; + sp78 = this->actor.world.pos.y; + this->actor.world.pos.y += this->actor.velocity.y; + + if ((this->actor.velocity.y < 0.0f) && (this->actor.world.pos.y <= sp7C)) { + if (this->unk_1CA == 0) { + if (this->actor.xzDistToPlayer < 400.0f) { + s16 sp72 = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); + Quake_SetSpeed(sp72, 0x4350); + Quake_SetQuakeValues(sp72, 3, 0, 0, 0); + Quake_SetCountdown(sp72, 7); + } + + this->unk_1C4 = 0.0f; + + if (!(this->unk_1E5 & 0x20)) { + CollisionPoly* sp6C; + Vec3f sp60; + s32 pad[2]; + s32 sp54; + Vec3f sp48; + + sp60.x = this->actor.world.pos.x; + sp60.y = this->actor.world.pos.y + 50.0f; + sp60.z = this->actor.world.pos.z; + + temp_f14 = func_800C4188(globalCtx, &globalCtx->colCtx, &sp6C, &sp54, &this->actor, &sp60); + temp_f2 = temp_f14 - this->actor.world.pos.y; + + if (fabsf(temp_f2) < (fabsf(this->actor.velocity.y) + 0.01f)) { + if (this->actor.flags & 0x40) { + sp48.x = this->actor.world.pos.x; + sp48.y = temp_f14 + 10.0f; + sp48.z = this->actor.world.pos.z; + + func_8093EF54(globalCtx, &sp48, &D_80942E30[ENGOROIWA_GET_C000(&this->actor)], + &D_80942E3C[ENGOROIWA_GET_C000(&this->actor)], this->actor.scale.x); + } + Audio_PlayActorSound2(&this->actor, NA_SE_EV_BIGBALL_BOUND); + } + } + } + + if (this->unk_1CA > 0) { + this->unk_1E5 |= 0x40; + return true; + } + + this->unk_1CA++; + this->actor.velocity.y *= -0.3f; + this->actor.world.pos.y = sp7C - ((this->actor.world.pos.y - sp7C) * 0.3f); + } + + if (this->unk_1CA == 0) { + WaterBox* sp44; + f32 sp40; + + if (func_800CA1E8(globalCtx, &globalCtx->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &sp40, + &sp44)) { + if ((this->actor.world.pos.y + this->unk_1DC) <= sp40) { + this->unk_1E5 |= 0x20; + if (sp40 < (this->unk_1DC + sp78)) { + if (this->actor.flags & 0x40) { + Vec3f sp34; + + sp34.x = this->actor.world.pos.x; + sp34.y = sp40; + sp34.z = this->actor.world.pos.z; + func_8093F198(globalCtx, &sp34, this->actor.scale.x); + } + this->actor.velocity.y *= 0.2f; + } + + if (this->actor.velocity.y < -8.0f) { + this->actor.velocity.y = -8.0f; + } + } + } + } + + this->unk_1E5 &= ~0x40; + return false; +} + +#ifdef NON_MATCHING +// Stack +void func_8093FAA4(EnGoroiwa* this, GlobalContext* globalCtx) { + f32 temp; + f32 sp7C; + Vec3f sp70; + Vec3f sp64; + MtxF sp24; + + if (this->unk_1E5 & 0x10) { + sp7C = this->unk_1C0; + } else { + temp = Math3D_Distance(&this->actor.world.pos, &this->actor.prevPos); + this->unk_1C0 = temp / this->unk_1DC; + sp7C = this->unk_1C0; + } + + sp7C *= this->unk_1C4; + if (!(this->unk_1E5 & 0x10)) { + if (Math3D_LengthSquared(&this->actor.velocity) > 0.1f) { + Math_Vec3f_Copy(&this->unk_1A8, &this->actor.velocity); + } + } + + Math3D_CrossProduct(&D_80942E60, &this->unk_1A8, &sp70); + + if (func_8093EAD4(&sp64, &sp70)) { + this->unk_1B4 = sp64; + } else { + sp64 = this->unk_1B4; + } + + Matrix_InsertRotationAroundUnitVector_f(sp7C, &sp64, MTXMODE_NEW); + Matrix_RotateY(this->actor.shape.rot.y, MTXMODE_APPLY); + Matrix_InsertXRotation_s(this->actor.shape.rot.x, MTXMODE_APPLY); + Matrix_InsertZRotation_s(this->actor.shape.rot.z, MTXMODE_APPLY); + Matrix_CopyCurrentState(&sp24); + func_8018219C(&sp24, &this->actor.shape.rot, MTXMODE_NEW); +} +#else +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Goroiwa/func_8093FAA4.s") #endif -extern ColliderJntSphElementInit D_80942DC0[1]; -extern ColliderJntSphInit D_80942DE4; -extern CollisionCheckInfoInit D_80942DF4; -extern InitChainEntry D_80942E78[]; +void func_8093FC00(EnGoroiwa* this) { + s32 params = ENGOROIWA_GET_300(&this->actor); -extern UNK_TYPE D_060032E0; + func_8093ED80(this); + if (((params == ENGOROIWA_300_0) || (params == ENGOROIWA_300_1)) && + ((this->unk_1D6 == 0) || (this->unk_1D6 == this->unk_1D4))) { + func_8093EE64(this, this->unk_1D6); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Goroiwa/func_8093E8A0.s") +void func_8093FC6C(EnGoroiwa* this, GlobalContext* globalCtx) { + s32 i; + Vec3f spC0; + Vec3f spB4; + Vec3f spA8; + s16 temp_s3; + s16 phi_s0; + s16 temp; + s32 pad; + s32 sp80; + f32 temp_f20; + f32 temp_f22; + f32 temp_f24; + f32 temp_f28; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Goroiwa/func_8093E91C.s") + temp_f24 = (this->actor.scale.x + 0.1f) * 0.5f; + sp80 = temp_f24 * 150.0f; + temp_f28 = this->actor.scale.x * 600.0f; + temp = 0x10000 / sp80; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Goroiwa/func_8093E938.s") + for (i = 0, phi_s0 = 0; i < sp80; i++, phi_s0 += temp) { + temp_s3 = (u32)Rand_Next() >> 0x10; + temp_f20 = Math_SinS(temp_s3); + temp_f22 = Math_CosS(temp_s3); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Goroiwa/func_8093E9B0.s") + spC0.x = Math_SinS(phi_s0); + spC0.z = Math_CosS(phi_s0); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Goroiwa/func_8093EAB0.s") + spB4.x = 2.0f * spC0.x; + spB4.y = (2.0f * Rand_ZeroOne()) + 1.0f; + spB4.z = 2.0f * spC0.z; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Goroiwa/func_8093EAD4.s") + spC0.x *= temp_f22 * temp_f28; + spC0.y = temp_f20 * temp_f28; + spC0.z *= (temp_f22 * temp_f28); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Goroiwa/func_8093EB58.s") + spC0.x += this->actor.world.pos.x; + spC0.y += this->actor.world.pos.y; + spC0.z += this->actor.world.pos.z; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Goroiwa/func_8093EB74.s") + spA8.x = spB4.x * -0.02f; + spA8.y = spB4.y * -0.05f; + spA8.z = spB4.z * -0.02f; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Goroiwa/func_8093EC50.s") + EffectSsIceSmoke_Spawn(globalCtx, &spC0, &spB4, &spA8, + ((s32)(Rand_ZeroOne() * 170.0f) + 150) * temp_f24 * 10.0f); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Goroiwa/func_8093ECD4.s") + for (i = 0, phi_s0 = 0; i < sp80; i++, phi_s0 += temp) { + temp_f20 = (Rand_ZeroOne() * (450.0f * this->actor.scale.x)) + 50.0f; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Goroiwa/func_8093ED80.s") + spC0.x = Math_SinS(phi_s0); + spC0.z = Math_CosS(phi_s0); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Goroiwa/func_8093EDB0.s") + spB4.x = spC0.x * 30.0f * temp_f24; + spB4.y = 0.0f; + spB4.z = spC0.z * 30.0f * temp_f24; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Goroiwa/func_8093EDD8.s") + spA8.x = spB4.x * -0.02f; + spA8.y = 0.03f; + spA8.z = spB4.z * -0.02f; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Goroiwa/func_8093EE18.s") + spC0.x = (spC0.x * temp_f20) + this->actor.world.pos.x; + spC0.y = (Rand_ZeroOne() * 20.0f) + this->actor.world.pos.y; + spC0.z = (spC0.z * temp_f20) + this->actor.world.pos.z; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Goroiwa/func_8093EE64.s") + EffectSsIceSmoke_Spawn(globalCtx, &spC0, &spB4, &spA8, (s32)(Rand_ZeroOne() * 1400.0f * temp_f24) + 100); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Goroiwa/func_8093EEBC.s") +void func_80940090(EnGoroiwa* this, GlobalContext* globalCtx) { + s32 pad; + s32 pad2; + s32 i; + s32 sp120 = ENGOROIWA_GET_C000(&this->actor); + s32 phi_s0; + s32 phi_s3; + Vec3f sp10C; + Vec3f sp100; + Vec3f spF4; + s32 phi_s6; + f32 spEC; + Gfx* phi_s1; + s16 phi_s7; + f32 phi_f22; + s32 phi_s2; + s32 spD8; + s16 spA8; + f32 temp_f20; + s32 pad3; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Goroiwa/func_8093EEDC.s") + if (this->actor.flags & 0x40) { + spEC = (this->actor.scale.x + 0.1f) * 0.5f; + sp10C.x = this->actor.world.pos.x; + sp10C.y = this->actor.world.pos.y + this->unk_1DC; + sp10C.z = this->actor.world.pos.z; + if (1) {} + spD8 = spEC * 150.0f; + spA8 = 0x10000 / spD8; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Goroiwa/func_8093EF54.s") + for (i = 0, phi_s7 = 0; i < spD8; i++, phi_s7 += spA8) { + if ((i & 3) == 0) { + phi_f22 = 1.0f; + phi_s1 = D_80942E0C[sp120][2]; + phi_s2 = -0x118; + phi_s3 = 0; + phi_s0 = 0x40; + } else { + phi_s2 = -0x190; + if ((i & 3) == 1) { + phi_s1 = D_80942E0C[sp120][1]; + phi_s2 = -0x154; + phi_s3 = 0; + phi_f22 = 0.9f; + if (Rand_ZeroOne() < 0.4f) { + phi_s0 = 0x20; + } else { + phi_s0 = 0x40; + } + } else { + phi_s1 = D_80942E0C[sp120][0]; + phi_s3 = 1; + phi_f22 = 0.8f; + if (Rand_Next() > 0) { + phi_s0 = 0x21; + } else { + phi_s0 = 0x41; + } + } + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Goroiwa/func_8093F198.s") + temp_f20 = (Rand_ZeroOne() * this->actor.scale.x * 400.0f) + 20.0f; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Goroiwa/func_8093F34C.s") + sp100.x = Math_SinS((s32)(Rand_ZeroOne() * spA8) + phi_s7) * temp_f20; + sp100.y = (Rand_ZeroOne() - 0.4f) * temp_f20 * 1.6666666f; + sp100.z = Math_CosS((s32)(Rand_ZeroOne() * spA8) + phi_s7) * temp_f20; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Goroiwa/func_8093F498.s") + spF4.x = sp100.x * 0.16f * phi_f22; + spF4.y = (Rand_ZeroOne() * 16.0f) + 3.0f; + spF4.z = sp100.z * 0.16f * phi_f22; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Goroiwa/func_8093F5EC.s") + Math_Vec3f_Sum(&sp100, &sp10C, &sp100); + EffectSsKakera_Spawn(globalCtx, &sp100, &spF4, &sp100, phi_s2, phi_s0, 30, 0, 0, + ((Rand_ZeroOne() * 150.0f) + 300.0f) * this->actor.scale.x, phi_s3, 0, 0x32, -1, 0xEF, + phi_s1); + if (this->unk_1E6 == 0) { + sp100.x += ((Rand_ZeroOne() * 1200.0f) - 600.0f) * this->actor.scale.x; + sp100.y += ((Rand_ZeroOne() * 1400.0f) - 600.0f) * this->actor.scale.y; + sp100.z += ((Rand_ZeroOne() * 1200.0f) - 600.0f) * this->actor.scale.z; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Goroiwa/func_8093F6F8.s") + func_800B0E48(globalCtx, &sp100, &D_80942E48, &D_80942E54, &D_80942E30[sp120], &D_80942E3C[sp120], + (Rand_ZeroOne() * 50.0f) + (400.0f * spEC), (Rand_ZeroOne() * 60.0f) + (500.0f * spEC)); + } + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Goroiwa/func_8093FAA4.s") + if (this->unk_1E6 != 0) { + func_8093FC6C(this, globalCtx); + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Goroiwa/func_8093FC00.s") +#ifdef NON_MATCHING +// Stack +void func_80940588(GlobalContext* globalCtx, Vec3f* arg1, Gfx* arg2[], Color_RGBA8* arg3, Color_RGBA8* arg4, f32 arg5) { + Gfx* phi_s7; + Vec3f sp100; + Vec3f spF4; + Vec3f spE8; + f32 temp_f20; + s32 phi_fp; + s32 j; + s32 i; + s32 phi_s0; + s32 spD0; + s16 spCE; + s16 spC8; + f32 spB0; + f32 spAC; + s16 spA8; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Goroiwa/func_8093FC6C.s") + spD0 = (s32)(arg5 * 35.0f) + 6; + temp_f20 = (arg5 + 0.1f) * 0.5f; + spB0 = 550.0f * temp_f20; + spAC = 500.0f * temp_f20; + spA8 = 0x10000 / spD0; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Goroiwa/func_80940090.s") + for (i = 0, spCE = 0; i < spD0; i++, spCE += spA8) { + temp_f20 = (Rand_ZeroOne() * arg5 * 500.0f) + 20.0f; + sp100.x = Math_SinS((s32)(Rand_ZeroOne() * spA8) + spCE) * temp_f20; + sp100.y = (Rand_ZeroOne() - 0.4f) * temp_f20 * 1.6666666f; + sp100.z = Math_CosS((s32)(Rand_ZeroOne() * spA8) + spCE) * temp_f20; + + spF4.x = sp100.x * 0.19f; + spF4.y = (Rand_ZeroOne() * 16.0f) + 3.0f; + spF4.z = sp100.z * 0.19f; + + Math_Vec3f_Sum(&sp100, arg1, &sp100); + + if ((i & 3) == 0) { + phi_s7 = arg2[0]; + phi_fp = -0x190; + spC8 = 1; + if (Rand_Next() > 0) { + phi_s0 = 0x21; + } else { + phi_s0 = 0x41; + } + } else { + spC8 = 0; + if ((i & 3) == 1) { + phi_fp = -0x154; + phi_s7 = arg2[1]; + if (Rand_ZeroOne() < 0.4f) { + phi_s0 = 0x20; + } else { + phi_s0 = 0x40; + } + } else { + phi_fp = -0x118; + phi_s0 = 0x40; + phi_s7 = arg2[2]; + } + } + + EffectSsKakera_Spawn(globalCtx, &sp100, &spF4, &sp100, phi_fp, phi_s0, 30, 0, 0, + ((Rand_ZeroOne() * 100.0f) + 170.0f) * arg5, spC8, 0, 0x36, -1, 0xEF, phi_s7); + + for (j = 0; j < 2; j++) { + spE8.x = (((Rand_ZeroOne() * 1000.0f) - 500.0f) * arg5) + sp100.x; + spE8.y = (((Rand_ZeroOne() * 1300.0f) - 500.0f) * arg5) + sp100.y; + spE8.z = (((Rand_ZeroOne() * 1000.0f) - 500.0f) * arg5) + sp100.z; + func_800B0E48(globalCtx, &spE8, &D_80942E48, &D_80942E54, arg3, arg4, (Rand_ZeroOne() * 80.0f) + spB0, + (Rand_ZeroOne() * 70.0f) + spAC); + } + } +} +#else +void func_80940588(GlobalContext* globalCtx, Vec3f* arg1, Gfx* arg2[], Color_RGBA8* arg3, Color_RGBA8* arg4, f32 arg5); #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Goroiwa/func_80940588.s") +#endif -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Goroiwa/func_80940A1C.s") +void func_80940A1C(GlobalContext* globalCtx, Vec3f* arg1, Gfx** arg2, Color_RGBA8* arg3, Color_RGBA8* arg4, f32 arg5) { + s32 i; + Vec3f spE8; + Vec3f spDC; + s32 phi_s2; + s32 phi_s0; + s32 phi_s3; + Gfx* phi_s1; + s32 spC8; + f32 temp_f20; + f32 spAC; + s16 spA8; + s16 phi_s6; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Goroiwa/func_80940E38.s") + spC8 = (s32)(arg5 * 35.0f) + 5; + temp_f20 = (arg5 + 0.1f) * 0.5f; + spAC = 600.0f * temp_f20; + spA8 = 0x10000 / spC8; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Goroiwa/func_80941060.s") + for (i = 0, phi_s6 = 0; i < spC8; i++, phi_s6 += spA8) { + temp_f20 = (Rand_ZeroOne() * arg5 * 400.0f) + 20.0f; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Goroiwa/func_80941274.s") + spE8.x = Math_SinS((s32)(Rand_ZeroOne() * spA8) + phi_s6) * temp_f20; + spE8.y = (Rand_ZeroOne() - 0.2f) * temp_f20 * 0.8f; + spE8.z = Math_CosS((s32)(Rand_ZeroOne() * spA8) + phi_s6) * temp_f20; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Goroiwa/EnGoroiwa_Init.s") + spDC.x = spE8.x * 0.17f; + spDC.y = (Rand_ZeroOne() * 14.0f) + 3.0f; + spDC.z = spE8.z * 0.17f; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Goroiwa/EnGoroiwa_Destroy.s") + Math_Vec3f_Sum(&spE8, arg1, &spE8); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Goroiwa/func_8094156C.s") + if ((i & 3) == 0) { + phi_s1 = arg2[2]; + phi_s2 = -0x118; + phi_s3 = 0; + phi_s0 = 0x40; + } else { + phi_s3 = 1; + if ((i & 3) == 1) { + phi_s1 = arg2[1]; + phi_s2 = -0x154; + if (Rand_Next() > 0) { + phi_s0 = 0x21; + } else { + phi_s0 = 0x41; + } + } else { + phi_s1 = arg2[0]; + phi_s2 = -0x190; + if (Rand_Next() > 0) { + phi_s0 = 0x21; + } else { + phi_s0 = 0x41; + } + } + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Goroiwa/func_809419D0.s") + EffectSsKakera_Spawn(globalCtx, &spE8, &spDC, &spE8, phi_s2, phi_s0, 30, 0, 0, + ((Rand_ZeroOne() * 150.0f) + 250.0f) * arg5, phi_s3, 0, 0x36, -1, 0xEF, phi_s1); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Goroiwa/func_80941A10.s") + spE8.x += ((Rand_ZeroOne() * 800.0f) - 400.0f) * arg5; + spE8.y += ((Rand_ZeroOne() * 800.0f) - 250.0f) * arg5; + spE8.z += ((Rand_ZeroOne() * 800.0f) - 400.0f) * arg5; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Goroiwa/func_80941DB4.s") + func_800B0E48(globalCtx, &spE8, &D_80942E48, &D_80942E54, arg3, arg4, (Rand_ZeroOne() * 60.0f) + spAC, + (Rand_ZeroOne() * 30.0f) + spAC); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Goroiwa/func_80941E28.s") +void func_80940E38(EnGoroiwa* this, GlobalContext* globalCtx) { + f32 sp5C; + s32 pad; + f32 sp54; + Vec3f sp48; + s16 sp46; + s16 temp_a0; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Goroiwa/func_80941EB4.s") + if (this->actor.flags & 0x40) { + if (this->actor.xzDistToPlayer < 1000.0f) { + sp5C = (1000.0f - this->actor.xzDistToPlayer) * 0.0012f * (this->actor.speedXZ * 0.1f); + if (Rand_ZeroOne() < sp5C) { + this->unk_1CE += 20000; + sp46 = (s32)Rand_ZeroFloat(20000.0f) + this->unk_1CE; + temp_a0 = sp46 - this->actor.world.rot.y; + if (ABS(temp_a0) < 0x4000) { + sp54 = Math_CosS(temp_a0) * 1.6f * this->unk_1DC; + } else { + sp54 = this->unk_1DC; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Goroiwa/func_80941F10.s") + sp48.x = (Math_SinS(sp46) * sp54) + this->actor.world.pos.x; + sp48.y = this->actor.world.pos.y + 20.0f; + sp48.z = (Math_CosS(sp46) * sp54) + this->actor.world.pos.z; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Goroiwa/func_80941F54.s") + func_800B0E48(globalCtx, &sp48, &D_80942E48, &D_80942E54, &D_80942E38, &D_80942E44, + (Rand_ZeroOne() * 600.0f) + (600.0f * (this->actor.scale.x + 0.1f) * 0.5f), + (s32)(Rand_ZeroOne() * 50.0f) + 30); + } + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Goroiwa/func_80941FA4.s") +void func_80941060(EnGoroiwa* this, GlobalContext* globalCtx) { + Vec3f spAC; + Vec3f spA0; + Vec3f sp94; + Vec3s* vec = &this->collider.elements[0].info.bumper.hitPos; + s32 i; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Goroiwa/func_80942084.s") + for (i = 0; i < 4; i++) { + sp94.x = ((Rand_ZeroOne() * 14.0f) - 7.0f) + vec->x; + sp94.y = ((Rand_ZeroOne() * 14.0f) - 7.0f) + vec->y; + sp94.z = ((Rand_ZeroOne() * 14.0f) - 7.0f) + vec->z; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Goroiwa/func_809420F0.s") + spA0.x = (Rand_ZeroOne() - 0.5f) * 1.6f; + spA0.y = -0.8f; + spA0.z = (Rand_ZeroOne() - 0.5f) * 1.6f; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Goroiwa/func_809421E0.s") + spAC.x = spA0.x * -0.06f; + spAC.y = spA0.y * -0.06f; + spAC.z = spA0.z * -0.06f; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Goroiwa/func_8094220C.s") + func_800B0E48(globalCtx, &sp94, &spA0, &spAC, &D_80942E38, &D_80942E44, (s32)(Rand_ZeroOne() * 30.0f) + 15, + (s32)(Rand_ZeroOne() * 40.0f) + 30); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Goroiwa/func_809425CC.s") +void func_80941274(EnGoroiwa* this, GlobalContext* globalCtx) { + Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 30, NA_SE_EV_SNOWBALL_BROKEN); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Goroiwa/func_80942604.s") +void EnGoroiwa_Init(Actor* thisx, GlobalContext* globalCtx) { + EnGoroiwa* this = THIS; + f32 temp_f0; + s32 params = ENGOROIWA_GET_FF(&this->actor); + s32 sp28 = params * 8; + Path* sp2C = &globalCtx->setupPathList[params]; + Actor_ProcessInitChain(&this->actor, sInitChain); + this->actor.world.rot.x = 0; + this->actor.world.rot.z = 0; + this->actor.world.rot.y = Rand_Next() & 0xFFFF; + this->actor.shape.rot.y = this->actor.world.rot.y; + this->actor.shape.rot.x = 0; + this->actor.shape.rot.z = 0; + func_8093E8A0(this); + func_8093E91C(this); + func_8093E9B0(this, globalCtx); + + if (sp28 == 0x7F8) { + Actor_MarkForDeath(&this->actor); + return; + } + + if (sp2C->count < 2) { + Actor_MarkForDeath(&this->actor); + return; + } + + if ((this->actor.home.rot.y >= (sp2C->count - 1)) && (this->actor.home.rot.y < 0)) { + this->actor.home.rot.y = 0; + } + + CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); + ActorShape_Init(&this->actor.shape, 595.0f, func_800B3FC0, 9.4f); + this->actor.shape.shadowAlpha = 200; + func_8093EB58(this, globalCtx); + + this->unk_1D0 = (Vec3s*)Lib_SegmentedToVirtual(sp2C->points); + + func_8093EE18(this, globalCtx); + func_8093EE64(this, this->actor.home.rot.y); + func_8093EEBC(this); + func_8093EC50(this); + + if (ENGOROIWA_GET_3000(&this->actor) == ENGOROIWA_3000_2) { + temp_f0 = func_8093EB74(this, globalCtx); + + if (temp_f0 < 0.1f) { + this->unk_1E0 = 0.0f; + } else { + this->unk_1E0 = (D_80942DFC[this->unk_1E4] * ((s32)globalCtx->state.framerateDivisor * 0.5f)) / temp_f0; + this->unk_1E0 *= 0.020000001f; + if (this->unk_1E0 > 0.00037f) { + this->unk_1E0 = 0.00037f; + } else if (this->unk_1E0 < 0.00015f) { + this->unk_1E0 = 0.00015f; + } + } + } + + Effect_Add(globalCtx, &this->unk_248, 4, 0, 0, &D_80942E8C); + func_809419D0(this); +} + +void EnGoroiwa_Destroy(Actor* thisx, GlobalContext* globalCtx) { + EnGoroiwa* this = THIS; + + Collider_DestroyJntSph(globalCtx, &this->collider); + Effect_Destroy(globalCtx, this->unk_248); +} + +s32 func_8094156C(EnGoroiwa* this, GlobalContext* globalCtx) { + Actor* actor = &this->actor; + s32 params = ENGOROIWA_GET_C000(&this->actor); + EnGoroiwaStruct* ptr; + s32 i; + s32 phi_s0_2 = false; + Vec3f sp80; + + if ((this->collider.base.acFlags & AC_HIT) && ((params == ENGOROIWA_C000_1) || (params == ENGOROIWA_C000_2))) { + if (this->collider.elements->info.acHitInfo->toucher.dmgFlags & 0x4000) { + s16 sp7E = BINANG_SUB(actor->yawTowardsPlayer, this->actor.world.rot.y); + f32 temp; + f32 temp2; + f32 temp3; + + this->unk_1CC = 50; + this->unk_1E8[0].unk_1E = BINANG_SUB(this->actor.yawTowardsPlayer, 0x4000); + this->unk_1E8[0].unk_24 = Rand_ZeroOne() * -600.0f; + this->unk_1E8[1].unk_1E = BINANG_ADD(this->actor.yawTowardsPlayer, 0x4000); + this->unk_1E8[1].unk_24 = Rand_ZeroOne() * 600.0f; + + for (i = 0; i < ARRAY_COUNT(this->unk_1E8); i++) { + ptr = &this->unk_1E8[i]; + + ptr->unk_00.x = this->actor.world.pos.x; + ptr->unk_00.y = this->actor.world.pos.y + this->unk_1DC; + ptr->unk_00.z = this->actor.world.pos.z; + + temp = Rand_ZeroOne(); + temp2 = Math_SinS(ptr->unk_1E); + temp3 = Math_SinS(this->actor.world.rot.y); + + ptr->unk_0C = ((1.0f / D_80942DFC[this->unk_1E4]) * (temp3 * 14.0f * this->actor.speedXZ)) + + (temp2 * (temp + 5.0f)); + + ptr->unk_10 = (Rand_ZeroOne() * 11.0f) + 20.0f; + + temp = Rand_ZeroOne(); + temp2 = Math_CosS(ptr->unk_1E); + temp3 = Math_CosS(this->actor.world.rot.y); + ptr->unk_14 = ((1.0f / D_80942DFC[this->unk_1E4]) * ((temp3 * 14.0f) * this->actor.speedXZ)) + + (temp2 * (temp + 5.0f)); + + ptr->unk_1C = 0; + ptr->unk_20 = 0; + ptr->unk_22 = (s32)(Rand_ZeroOne() * 400.0f) + 1100; + + temp3 = Rand_ZeroOne(); + temp2 = Math_CosS(sp7E); + ptr->unk_26 = (s32)(temp2 * 3000.0f) + (s32)(600.0f * (temp3 - 0.5f)); + ptr->unk_2D = 0; + ptr->unk_2C = 0; + } + + func_809421E0(this); + sp80.x = this->actor.world.pos.x; + sp80.y = this->actor.world.pos.y + this->unk_1DC; + sp80.z = this->actor.world.pos.z; + func_80940588(globalCtx, &sp80, D_80942E0C[params], &D_80942E30[params], &D_80942E3C[params], + this->actor.scale.x); + func_80941274(this, globalCtx); + phi_s0_2 = true; + } else if (((params == ENGOROIWA_C000_1) && + (this->collider.elements->info.acHitInfo->toucher.dmgFlags & (0x400 | 0x100))) || + ((params == ENGOROIWA_C000_2) && (this->collider.elements->info.acHitInfo->toucher.dmgFlags & + (0x80000000 | 0x800 | 0x400 | 0x100 | 0x8)))) { + this->unk_1CC = 50; + if ((params == ENGOROIWA_C000_2) && (this->collider.elements->info.acHitInfo->toucher.dmgFlags & 0x800)) { + this->unk_1E6 = 1; + } + func_80940090(this, globalCtx); + func_80941274(this, globalCtx); + func_809425CC(this); + phi_s0_2 = true; + } else if ((params == ENGOROIWA_C000_2) && (this->unk_1E7 <= 0)) { + func_80941060(this, globalCtx); + this->unk_1E7 = 10; + } + } + + if (params == ENGOROIWA_C000_2) { + if (this->unk_1E7 > 0) { + this->unk_1E7--; + } + + if (phi_s0_2) { + Item_DropCollectibleRandom(globalCtx, NULL, &this->actor.world.pos, 0x20); + } + } + return phi_s0_2; +} + +void func_809419D0(EnGoroiwa* this) { + this->actionFunc = func_80941A10; + func_8093EAB0(this, 7); + this->unk_1C4 = 1.0f; +} + +void func_80941A10(EnGoroiwa* this, GlobalContext* globalCtx) { + static EnGoroiwaUnkFunc D_80942E94[] = { + &func_8093F498, + &func_8093F34C, + }; + static u16 D_80942E9C[][2] = { + { NA_SE_EV_BIGBALL_ROLL - SFX_FLAG, NA_SE_EV_BIGBALL_ROLL_SR - SFX_FLAG }, + { NA_SE_EV_BIGBALL_ROLL_2 - SFX_FLAG, NA_SE_EV_BIGBALL_ROLL_SR_2 - SFX_FLAG }, + { NA_SE_EV_BIGBALL_ROLL_3 - SFX_FLAG, NA_SE_EV_BIGBALL_ROLL_SR_3 - SFX_FLAG }, + { NA_SE_EV_BIGBALL_ROLL - SFX_FLAG, NA_SE_EV_BIGBALL_ROLL_SR - SFX_FLAG }, + }; + s32 pad; + Player* player = GET_PLAYER(globalCtx); + s32 sp44 = ENGOROIWA_GET_400(&this->actor); + s32 sp40 = ENGOROIWA_GET_3000(&this->actor); + s16 y; + s32 pad2; + + if (!func_8094156C(this, globalCtx)) { + if ((this->collider.base.atFlags & AT_HIT) && !(player->stateFlags3 & 0x80000)) { + s32 sp34 = this->actor.home.rot.z & 3; + + if (sp34 == 2) { + func_80940090(this, globalCtx); + if (sp40 == ENGOROIWA_3000_2) { + func_8093E8A0(this); + func_8093E91C(this); + } + func_80941274(this, globalCtx); + func_8093EDD8(this, globalCtx); + func_8093EE64(this, 0); + func_8093EEBC(this); + } else { + this->unk_1E5 &= ~8; + y = this->actor.yawTowardsPlayer - this->actor.world.rot.y; + if ((y > -0x4000) && (y < 0x4000)) { + this->unk_1E5 |= 8; + if (sp44 || (sp34 != 1)) { + func_8093EDB0(this); + } + } + } + + func_800B8D50(globalCtx, &this->actor, 2.0f, this->actor.yawTowardsPlayer, 0.0f, 0); + + if (sp34 == 2) { + func_80941EB4(this); + } else if (!sp44) { + func_80941EB4(this); + } else { + func_80941DB4(this); + } + + func_800B8E58(&player->actor, NA_SE_PL_BODY_HIT); + + if ((sp34 == 1) || (sp34 == 2)) { + this->unk_1CC = 50; + } + } else { + if (D_80942E94[sp44](this)) { + s32 sp30 = ENGOROIWA_GET_300(&this->actor); + + if ((sp30 == ENGOROIWA_300_1) && ((this->unk_1D8 == 0) || (this->unk_1D8 == this->unk_1D4))) { + func_80940090(this, globalCtx); + func_80941274(this, globalCtx); + } + + if (((sp30 == ENGOROIWA_300_1) || (sp30 == ENGOROIWA_300_0)) && (sp40 == ENGOROIWA_3000_2) && + ((this->unk_1D8 == 0) || (this->unk_1D8 == this->unk_1D4))) { + func_8093E8A0(this); + func_8093E91C(this); + } + + func_8093FC00(this); + + if ((sp30 == ENGOROIWA_300_3) && ((this->unk_1D6 == 0) || (this->unk_1D6 == this->unk_1D4))) { + func_80941EB4(this); + } else if (!sp44 && (this->unk_1D6 != 0) && (this->unk_1D6 != this->unk_1D4)) { + sp30 = func_8093EEDC(this); + if (sp30 > 0) { + func_80941F54(this); + } else if (sp30 < 0) { + func_80942084(this); + } else { + func_809419D0(this); + } + } else { + func_809419D0(this); + } + } + } + + if (this->actor.bgCheckFlags & 1) { + Audio_PlayActorSound2(&this->actor, D_80942E9C[this->unk_1E4][this->actor.home.rot.x & 1]); + } + } +} + +void func_80941DB4(EnGoroiwa* this) { + this->actionFunc = func_80941E28; + func_8093EAB0(this, 6); + this->actor.gravity = -0.86f; + this->actor.minVelocityY = -15.0f; + this->actor.speedXZ *= 0.15f; + this->actor.velocity.y = 5.0f; + this->unk_1C4 = 1.0f; +} + +void func_80941E28(EnGoroiwa* this, GlobalContext* globalCtx) { + func_8093F34C(this); + if ((this->actor.bgCheckFlags & 1) && (this->actor.velocity.y < 0.0f)) { + if ((this->unk_1E5 & 8) && ((this->actor.home.rot.z & 3) == 1)) { + func_8093EDB0(this); + } + func_80941EB4(this); + } +} + +void func_80941EB4(EnGoroiwa* this) { + static s16 D_80942EAC[] = { 20, 6, 20 }; + + this->actionFunc = func_80941F10; + this->actor.speedXZ = 0.0f; + func_8093EAB0(this, 6); + this->unk_1C8 = D_80942EAC[this->actor.home.rot.z & 3]; + this->unk_1C4 = 0.0f; +} + +void func_80941F10(EnGoroiwa* this, GlobalContext* globalCtx) { + if (!func_8094156C(this, globalCtx)) { + if (this->unk_1C8 > 0) { + this->unk_1C8--; + } else { + func_809419D0(this); + } + } +} + +void func_80941F54(EnGoroiwa* this) { + this->actionFunc = func_80941FA4; + func_8093EAB0(this, 7); + this->unk_1C4 = 0.0f; + this->actor.velocity.y = fabsf(this->actor.speedXZ) * 0.1f; +} + +void func_80941FA4(EnGoroiwa* this, GlobalContext* globalCtx) { + Player* player = GET_PLAYER(globalCtx); + + if (func_8094156C(this, globalCtx) == 0) { + if ((this->collider.base.atFlags & AT_HIT) && !(player->stateFlags3 & 0x80000)) { + func_800B8D50(globalCtx, &this->actor, 2.0f, this->actor.yawTowardsPlayer, 0.0f, 0); + func_800B8E58(&player->actor, NA_SE_PL_BODY_HIT); + if (((this->actor.home.rot.z & 3) == 1) || ((this->actor.home.rot.z & 3) == 2)) { + this->unk_1CC = 50; + } + } else if (func_8093F5EC(this)) { + func_8093FC00(this); + func_809419D0(this); + this->actor.speedXZ = 0.0f; + } + } +} + +void func_80942084(EnGoroiwa* this) { + this->actionFunc = func_809420F0; + func_8093EAB0(this, 7); + this->unk_1C4 = 0.3f; + this->unk_1CA = 0; + this->actor.velocity.y = fabsf(this->actor.speedXZ) * -0.3f; + this->unk_1E5 |= 0x10; + this->unk_1E5 &= ~0x20; +} + +void func_809420F0(EnGoroiwa* this, GlobalContext* globalCtx) { + Player* player = GET_PLAYER(globalCtx); + + if (func_8094156C(this, globalCtx) == 0) { + if ((this->collider.base.atFlags & AT_HIT) && !(player->stateFlags3 & 0x80000)) { + func_800B8D50(globalCtx, &this->actor, 2.0f, this->actor.yawTowardsPlayer, 0.0f, 0); + func_800B8E58(&player->actor, NA_SE_PL_BODY_HIT); + if (((this->actor.home.rot.z & 3) == 1) || ((this->actor.home.rot.z & 3) == 2)) { + this->unk_1CC = 50; + } + } else if (func_8093F6F8(this, globalCtx)) { + func_8093FC00(this); + func_809419D0(this); + this->unk_1E5 &= ~0x10; + this->actor.speedXZ = 0.0f; + } + } +} + +void func_809421E0(EnGoroiwa* this) { + this->actionFunc = func_8094220C; + func_8093EAB0(this, 0); +} + +void func_8094220C(EnGoroiwa* this, GlobalContext* globalCtx) { + s32 pad; + EnGoroiwaStruct* ptr; + s32 i; + s32 spD0; + Vec3f spC4; + Vec3f spB8; + f32 phi_f12; + f32 temp_f20; + f32 spAC; + s32 params; + Vec3f sp9C; + s16 sp9A; + + for (i = 0; i < ARRAY_COUNT(this->unk_1E8); i++) { + ptr = &this->unk_1E8[i]; + + if (!(ptr->unk_2D & 1)) { + ptr->unk_10 -= 6.0f; + if (ptr->unk_10 < -20.0f) { + ptr->unk_10 = -20.0f; + } + ptr->unk_00.x += ptr->unk_0C; + ptr->unk_00.y += ptr->unk_10; + ptr->unk_00.z += ptr->unk_14; + + ptr->unk_1C += ptr->unk_22; + ptr->unk_1E += ptr->unk_24; + ptr->unk_20 += ptr->unk_26; + + spC4.x = ptr->unk_00.x; + spC4.y = ptr->unk_00.y + 25.0f; + spC4.z = ptr->unk_00.z; + + ptr->unk_18 = func_800C411C(&globalCtx->colCtx, &ptr->unk_28, &spD0, &this->actor, &spC4); + + if (ptr->unk_10 <= 0.0f) { + Matrix_InsertRotation(ptr->unk_1C, ptr->unk_1E, ptr->unk_20, 0); + Matrix_MultiplyVector3fByState(&D_80942E6C, &spB8); + temp_f20 = this->unk_1DC * 0.9f; + + if (spB8.y > 0.0f) { + if (Math3D_AngleBetweenVectors(&D_80942E60, &spB8, &spAC)) { + phi_f12 = 1.0f; + } else { + phi_f12 = 1.0f - SQ(spAC); + } + + if (phi_f12 <= 0.0f) { + temp_f20 = 0.0f; + } else { + temp_f20 *= sqrtf(phi_f12); + } + } + + if (((ptr->unk_00.y + (this->unk_1DC - temp_f20)) < ptr->unk_18) || + (ptr->unk_18 < (BGCHECK_Y_MIN + 10))) { + params = ENGOROIWA_GET_C000(&this->actor); + ptr->unk_2D |= 1; + sp9C.x = ptr->unk_00.x; + sp9C.y = (ptr->unk_00.y - ptr->unk_10) + 10.0f; + sp9C.z = ptr->unk_00.z; + func_80940A1C(globalCtx, &sp9C, D_80942E0C[params], &D_80942E30[params], &D_80942E3C[params], + this->actor.scale.x); + } + } + } + } + + if ((this->unk_1E8[0].unk_2D & 1) && (this->unk_1E8[1].unk_2D & 1)) { + func_809425CC(this); + return; + } + + sp9A = this->actor.shape.shadowAlpha; + Math_StepToS(&sp9A, 0, 40); + this->actor.shape.shadowAlpha = sp9A; + + for (i = 0; i < ARRAY_COUNT(this->unk_1E8); i++) { + ptr = &this->unk_1E8[i]; + + if (ptr->unk_2D & 1) { + ptr->unk_2C = 0; + } else { + sp9A = ptr->unk_2C; + Math_StepToS(&sp9A, 160, 24); + ptr->unk_2C = sp9A; + } + } +} + +void func_809425CC(EnGoroiwa* this) { + this->actionFunc = func_80942604; + func_8093EAB0(this, 0); + this->unk_1C8 = 100; +} + +void func_80942604(EnGoroiwa* this, GlobalContext* globalCtx) { + s32 pad; + s16 sp22 = this->actor.shape.shadowAlpha; + + Math_StepToS(&sp22, 0, 40); + this->actor.shape.shadowAlpha = sp22; + if (this->unk_1C8 > 0) { + this->unk_1C8--; + } else { + Actor_MarkForDeath(&this->actor); + } +} + +#ifdef NON_MATCHING +// stack for params and colCtx +void EnGoroiwa_Update(Actor* thisx, GlobalContext* globalCtx) { + s32 pad; + EnGoroiwa* this = THIS; + Player* player = GET_PLAYER(globalCtx); + s32 sp60; + s32 sp5C = false; + Vec3f sp50; + f32 sp4C; + s32 sp48 = true; + + if (!(player->stateFlags1 & (0x30000000 | 0x80 | 0x40))) { + if (this->unk_1CC > 0) { + this->unk_1CC--; + } + + if ((ENGOROIWA_GET_3000(&this->actor) == ENGOROIWA_3000_2) && (this->actor.bgCheckFlags & 1) && + (this->actionFunc == func_80941A10) && (this->actor.speedXZ > 2.0f)) { + Math_StepToF(&this->actor.scale.x, 0.16f, + (this->actor.xzDistToPlayer < 400.0f) ? this->unk_1E0 * 1.4f : this->unk_1E0); + + this->actor.scale.y = this->actor.scale.x; + this->actor.scale.z = this->actor.scale.x; + func_8093E91C(this); + sp5C = true; + + if (this->actor.flags & 0x40) { + if (this->actor.floorPoly != NULL) { + u32 temp_v0_2 = func_800C99D4(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId); + + if ((temp_v0_2 == 14) || (temp_v0_2 == 15)) { + if (!(this->unk_1E5 & 0x40)) { + sp50.x = this->actor.world.pos.x; + sp50.y = this->actor.floorHeight; + sp50.z = this->actor.world.pos.z; + sp4C = (((Rand_ZeroOne() * 36.0f) + 250.0f) * this->actor.scale.x) + 10.0f; + func_800AE930(&globalCtx->colCtx, Effect_GetParams(this->unk_248), &sp50, sp4C, + this->actor.world.rot.y, this->actor.floorPoly, this->actor.floorBgId); + } + sp48 = false; + } + } + } + } + + if (sp48) { + func_800AEF44(Effect_GetParams(this->unk_248)); + } + + this->actionFunc(this, globalCtx); + + if (this->actor.update != NULL) { + func_8093EC50(this); + + if (sp5C) { + func_80940E38(this, globalCtx); + } + + switch (ENGOROIWA_GET_400(&this->actor)) { + case ENGOROIWA_400_1: + Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 0x1C); + break; + + case ENGOROIWA_400_0: + sp50.x = this->actor.world.pos.x; + sp50.y = this->actor.world.pos.y + 50.0f; + sp50.z = this->actor.world.pos.z; + this->actor.floorHeight = + func_800C411C(&globalCtx->colCtx, &this->actor.floorPoly, &sp60, &this->actor, &sp50); + if (this->actor.floorHeight > BGCHECK_Y_MIN) { + this->actor.floorBgId = sp60; + if (this->actor.world.pos.y <= (this->actor.floorHeight + 2.0f)) { + this->actor.bgCheckFlags |= 1; + } else { + this->actor.bgCheckFlags &= ~1; + } + } else { + this->actor.bgCheckFlags &= ~1; + this->actor.floorBgId = 50; + } + break; + } + + func_8093FAA4(this, globalCtx); + + if (this->actor.flags & 0x40) { + s32 params = ENGOROIWA_GET_C000(&this->actor); + + func_8093E938(this); + + if ((this->unk_1E5 & 1) && (this->unk_1CC <= 0) && + (!(player->stateFlags3 & 0x2000000) || (player->transformation != PLAYER_FORM_GORON) || + ((params != ENGOROIWA_C000_1) && (params != ENGOROIWA_C000_2)))) { + CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + } else { + this->collider.base.atFlags &= ~AT_HIT; + } + + if (this->unk_1E5 & 2) { + CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + } else { + this->collider.base.acFlags &= ~AC_HIT; + } + + if ((this->unk_1E5 & 4) && (this->unk_1CC <= 0)) { + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + } else { + this->collider.base.ocFlags1 &= ~OC1_HIT; + } + } else { + this->collider.base.atFlags &= ~AT_HIT; + this->collider.base.ocFlags1 &= ~OC1_HIT; + this->collider.base.acFlags &= ~AC_HIT; + } + } + } +} +#else #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Goroiwa/EnGoroiwa_Update.s") +#endif -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Goroiwa/func_80942B1C.s") +void func_80942B1C(EnGoroiwa* this, GlobalContext* globalCtx) { + s32 pad; + s32 pad2; + s32 i; + EnGoroiwaStruct* ptr; + s32 params = ENGOROIWA_GET_C000(&this->actor); + Gfx* phi_fp; + MtxF sp88; + Vec3s sp80; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Goroiwa/EnGoroiwa_Draw.s") + if (params == ENGOROIWA_C000_1) { + phi_fp = D_060032E0; + } else { + phi_fp = D_060082D0; + } + + for (i = 0; i < ARRAY_COUNT(this->unk_1E8); i++) { + ptr = &this->unk_1E8[i]; + + if (!(ptr->unk_2D & 1)) { + sp80.x = ptr->unk_1C; + sp80.y = ptr->unk_1E; + sp80.z = ptr->unk_20; + + Matrix_SetStateRotationAndTranslation(ptr->unk_00.x, ptr->unk_00.y, ptr->unk_00.z, &sp80); + Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, 1); + func_800BDFC0(globalCtx, phi_fp); + + if ((ptr->unk_28 != 0) && (ptr->unk_2C > 0)) { + OPEN_DISPS(globalCtx->state.gfxCtx); + + func_8012C448(globalCtx->state.gfxCtx); + + gDPSetCombineLERP(POLY_XLU_DISP++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, COMBINED, 0, 0, + 0, COMBINED); + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 0, 0, 0, ptr->unk_2C); + + func_800C0094(ptr->unk_28, ptr->unk_00.x, ptr->unk_18, ptr->unk_00.z, &sp88); + Matrix_SetCurrentState(&sp88); + Matrix_Scale(this->actor.scale.x * 7.5f, 1.0f, this->actor.scale.z * 7.5f, 1); + + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, D_04076BC0); + + CLOSE_DISPS(globalCtx->state.gfxCtx); + } + } + } +} + +void EnGoroiwa_Draw(Actor* thisx, GlobalContext* globalCtx) { + static Gfx* D_80942EB4[] = { + D_06005C20, + D_06003B40, + D_06008B90, + }; + EnGoroiwa* this = THIS; + s32 params = ENGOROIWA_GET_C000(&this->actor); + + if (this->actionFunc == func_8094220C) { + func_80942B1C(this, globalCtx); + } else if (this->actionFunc != func_80942604) { + func_800BDFC0(globalCtx, D_80942EB4[params]); + } +} diff --git a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.h b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.h index dfa60adf19..2a3ae2505f 100644 --- a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.h +++ b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.h @@ -6,12 +6,79 @@ struct EnGoroiwa; typedef void (*EnGoroiwaActionFunc)(struct EnGoroiwa*, GlobalContext*); +typedef s32 (*EnGoroiwaUnkFunc)(struct EnGoroiwa*); + +#define ENGOROIWA_GET_C000(thisx) (((thisx)->params >> 0xE) & 3) +#define ENGOROIWA_GET_3000(thisx) (((thisx)->params >> 0xC) & 3) +#define ENGOROIWA_GET_400(thisx) (((thisx)->params >> 0xA) & 1) +#define ENGOROIWA_GET_300(thisx) (((thisx)->params >> 0x8) & 3) +#define ENGOROIWA_GET_FF(thisx) ((thisx)->params & 0xFF) + +enum { + /* 0 */ ENGOROIWA_300_0, + /* 1 */ ENGOROIWA_300_1, + /* 3 */ ENGOROIWA_300_3 = 3, +}; + +enum { + /* 0 */ ENGOROIWA_400_0, + /* 1 */ ENGOROIWA_400_1, +}; + +enum { + /* 0 */ ENGOROIWA_3000_0, + /* 1 */ ENGOROIWA_3000_1, + /* 2 */ ENGOROIWA_3000_2, +}; + +enum { + /* 1 */ ENGOROIWA_C000_1 = 1, + /* 2 */ ENGOROIWA_C000_2, +}; + +typedef struct { + /* 0x00 */ Vec3f unk_00; + /* 0x0C */ f32 unk_0C; + /* 0x10 */ f32 unk_10; + /* 0x14 */ f32 unk_14; + /* 0x18 */ f32 unk_18; + /* 0x1C */ s16 unk_1C; + /* 0x1E */ s16 unk_1E; + /* 0x20 */ s16 unk_20; + /* 0x22 */ s16 unk_22; + /* 0x24 */ s16 unk_24; + /* 0x26 */ s16 unk_26; + /* 0x28 */ CollisionPoly* unk_28; + /* 0x2C */ u8 unk_2C; + /* 0x2D */ u8 unk_2D; +} EnGoroiwaStruct; // size = 0x30 typedef struct EnGoroiwa { /* 0x0000 */ Actor actor; - /* 0x0144 */ char unk_144[0x60]; + /* 0x0144 */ ColliderJntSph collider; + /* 0x0164 */ ColliderJntSphElement colliderElements[1]; /* 0x01A4 */ EnGoroiwaActionFunc actionFunc; - /* 0x01A8 */ char unk_1A8[0xA4]; + /* 0x01A8 */ Vec3f unk_1A8; + /* 0x01B4 */ Vec3f unk_1B4; + /* 0x01C0 */ f32 unk_1C0; + /* 0x01C4 */ f32 unk_1C4; + /* 0x01C8 */ s16 unk_1C8; + /* 0x01CA */ s16 unk_1CA; + /* 0x01CC */ s16 unk_1CC; + /* 0x01CE */ s16 unk_1CE; + /* 0x01D0 */ Vec3s* unk_1D0; + /* 0x01D4 */ s16 unk_1D4; + /* 0x01D6 */ s16 unk_1D6; + /* 0x01D8 */ s16 unk_1D8; + /* 0x01DA */ s16 unk_1DA; + /* 0x01DC */ f32 unk_1DC; + /* 0x01E0 */ f32 unk_1E0; + /* 0x01E4 */ s8 unk_1E4; + /* 0x01E5 */ u8 unk_1E5; + /* 0x01E6 */ s8 unk_1E6; + /* 0x01E7 */ s8 unk_1E7; + /* 0x01E8 */ EnGoroiwaStruct unk_1E8[2]; + /* 0x0248 */ s32 unk_248; } EnGoroiwa; // size = 0x24C extern const ActorInit En_Goroiwa_InitVars; diff --git a/undefined_syms.txt b/undefined_syms.txt index 0c7b231723..75a9b5cdc7 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -2388,6 +2388,18 @@ D_06014D00 = 0x06014D00; D_060032E0 = 0x060032E0; D_060082D0 = 0x060082D0; +D_06005C20 = 0x06005C20; +D_06003B40 = 0x06003B40; +D_06008B90 = 0x06008B90; +D_060042B0 = 0x060042B0; +D_06004960 = 0x06004960; +D_06004EF0 = 0x06004EF0; +D_060003B0 = 0x060003B0; +D_060028E0 = 0x060028E0; +D_06002D70 = 0x06002D70; +D_060072F0 = 0x060072F0; +D_060077D0 = 0x060077D0; +D_06007C60 = 0x06007C60; // ovl_En_Grasshopper