From 1774416598c04452edc02c96b831d3a975ba4f67 Mon Sep 17 00:00:00 2001 From: Maide <34639600+Kelebek1@users.noreply.github.com> Date: Mon, 11 Oct 2021 14:21:17 +0100 Subject: [PATCH] En_Poh (#291) * En_Poh * PR * PR * Fix wrong float --- include/functions.h | 2 +- spec | 3 +- src/overlays/actors/ovl_En_Poh/z_en_poh.c | 965 ++++++++++++++++++++-- src/overlays/actors/ovl_En_Poh/z_en_poh.h | 27 +- tools/disasm/functions.txt | 4 +- 5 files changed, 914 insertions(+), 87 deletions(-) diff --git a/include/functions.h b/include/functions.h index 12bc349939..d6042e3f51 100644 --- a/include/functions.h +++ b/include/functions.h @@ -4002,7 +4002,7 @@ void func_801A5CFC(u16 sfxId, Vec3f* param_2, u8 param_3, f32* param_4, f32* par // void func_801A7168(void); // void func_801A7284(void); void func_801A72CC(Vec3f* uParm1); -// void func_801A7328(void); +void func_801A7328(Vec3f* pos, u16 sfxId); // void func_801A7484(void); // void func_801A75E8(void); // void func_801A7720(void); diff --git a/spec b/spec index 71bce5c379..44097c9131 100644 --- a/spec +++ b/spec @@ -4073,8 +4073,7 @@ beginseg name "ovl_En_Poh" compress include "build/src/overlays/actors/ovl_En_Poh/z_en_poh.o" - include "build/data/ovl_En_Poh/ovl_En_Poh.data.o" - include "build/data/ovl_En_Poh/ovl_En_Poh.reloc.o" + include "build/src/overlays/actors/ovl_En_Poh/ovl_En_Poh_reloc.o" endseg beginseg diff --git a/src/overlays/actors/ovl_En_Poh/z_en_poh.c b/src/overlays/actors/ovl_En_Poh/z_en_poh.c index ae56732b7d..161067b299 100644 --- a/src/overlays/actors/ovl_En_Poh/z_en_poh.c +++ b/src/overlays/actors/ovl_En_Poh/z_en_poh.c @@ -1,3 +1,9 @@ +/* + * File: z_en_poh.c + * Overlay: ovl_En_Poh + * Description: Poe + */ + #include "z_en_poh.h" #define FLAGS 0x00001205 @@ -10,23 +16,46 @@ void EnPoh_Update(Actor* thisx, GlobalContext* globalCtx); void EnPoh_Draw(Actor* thisx, GlobalContext* globalCtx); void func_80B2CAA4(EnPoh* this, GlobalContext* globalCtx); +void func_80B2CB60(EnPoh* this); void func_80B2CBBC(EnPoh* this, GlobalContext* globalCtx); +void func_80B2CD14(EnPoh* this); void func_80B2CD64(EnPoh* this, GlobalContext* globalCtx); +void func_80B2CEC8(EnPoh* this); void func_80B2CF28(EnPoh* this, GlobalContext* globalCtx); void func_80B2D07C(EnPoh* this, GlobalContext* globalCtx); +void func_80B2D0E8(EnPoh* this); void func_80B2D140(EnPoh* this, GlobalContext* globalCtx); +void func_80B2D2C0(EnPoh* this); void func_80B2D300(EnPoh* this, GlobalContext* globalCtx); void func_80B2D628(EnPoh* this, GlobalContext* globalCtx); +void func_80B2D694(EnPoh* this); void func_80B2D6EC(EnPoh* this, GlobalContext* globalCtx); void func_80B2D7D4(EnPoh* this, GlobalContext* globalCtx); void func_80B2D980(EnPoh* this, GlobalContext* globalCtx); +void func_80B2DAD0(EnPoh* this); void func_80B2DB44(EnPoh* this, GlobalContext* globalCtx); +void func_80B2DC50(EnPoh* this, GlobalContext* globalCtx); void func_80B2DD2C(EnPoh* this, GlobalContext* globalCtx); +void func_80B2E0B0(EnPoh* this); void func_80B2E180(EnPoh* this, GlobalContext* globalCtx); +void func_80B2E1D8(EnPoh* this); void func_80B2E230(EnPoh* this, GlobalContext* globalCtx); +void func_80B2E3B0(EnPoh* this); void func_80B2E3F8(EnPoh* this, GlobalContext* globalCtx); +void func_80B2F328(Actor* thisx, GlobalContext* globalCtx); +void func_80B2F37C(Actor* thisx, GlobalContext* globalCtx); + +extern AnimationHeader D_060001A8; +extern AnimationHeader D_060004EC; +extern AnimationHeader D_060006E0; +extern AnimationHeader D_06000A60; +extern AnimationHeader D_060011C4; +extern AnimationHeader D_060015B0; +extern Gfx D_06002608[]; +extern Gfx D_06002D28[]; +extern Gfx D_06003850[]; +extern SkeletonHeader D_060050D0; -#if 0 const ActorInit En_Poh_InitVars = { ACTOR_EN_POH, ACTORCAT_ENEMY, @@ -39,29 +68,54 @@ const ActorInit En_Poh_InitVars = { (ActorFunc)EnPoh_Draw, }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_80B2F680 = { - { COLTYPE_HIT3, AT_NONE, AC_NONE | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_CYLINDER, }, - { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xF7CBFFFE, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON | BUMP_HOOKABLE, OCELEM_ON, }, +static ColliderCylinderInit sCylinderInit = { + { + COLTYPE_HIT3, + AT_NONE, + AC_NONE | AC_TYPE_PLAYER, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_1, + COLSHAPE_CYLINDER, + }, + { + ELEMTYPE_UNK0, + { 0x00000000, 0x00, 0x00 }, + { 0xF7CBFFFE, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_ON | BUMP_HOOKABLE, + OCELEM_ON, + }, { 20, 40, 20, { 0, 0, 0 } }, }; -// static ColliderJntSphElementInit sJntSphElementsInit[1] = { -static ColliderJntSphElementInit D_80B2F6AC[1] = { +static ColliderJntSphElementInit sJntSphElementsInit[1] = { { - { ELEMTYPE_UNK0, { 0xF7CFFFFF, 0x00, 0x08 }, { 0x00000000, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_NONE, OCELEM_ON, }, + { + ELEMTYPE_UNK0, + { 0xF7CFFFFF, 0x00, 0x08 }, + { 0x00000000, 0x00, 0x00 }, + TOUCH_ON | TOUCH_SFX_NORMAL, + BUMP_NONE, + OCELEM_ON, + }, { 18, { { 0, 1400, 0 }, 10 }, 100 }, }, }; -// static ColliderJntSphInit sJntSphInit = { -static ColliderJntSphInit D_80B2F6D0 = { - { COLTYPE_HIT3, AT_ON | AT_TYPE_ENEMY, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_JNTSPH, }, - 1, D_80B2F6AC, // sJntSphElementsInit, +static ColliderJntSphInit sJntSphInit = { + { + COLTYPE_HIT3, + AT_ON | AT_TYPE_ENEMY, + AC_ON | AC_TYPE_PLAYER, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_1, + COLSHAPE_JNTSPH, + }, + 1, + sJntSphElementsInit, }; -// static DamageTable sDamageTable = { -static DamageTable D_80B2F6E0 = { +static DamageTable sDamageTable = { /* Deku Nut */ DMG_ENTRY(0, 0xF), /* Deku Stick */ DMG_ENTRY(1, 0x0), /* Horse trample */ DMG_ENTRY(0, 0x0), @@ -96,123 +150,874 @@ static DamageTable D_80B2F6E0 = { /* Powder Keg */ DMG_ENTRY(1, 0x0), }; -// sColChkInfoInit -static CollisionCheckInfoInit D_80B2F700 = { 3, 25, 50, 50 }; +static CollisionCheckInfoInit sColChkInfoInit = { 3, 25, 50, 50 }; -// static InitChainEntry sInitChain[] = { -static InitChainEntry D_80B2F708[] = { +static InitChainEntry sInitChain[] = { ICHAIN_S8(hintId, 68, ICHAIN_CONTINUE), ICHAIN_F32(targetArrowOffset, 3200, ICHAIN_STOP), }; -#endif +void EnPoh_Init(Actor* thisx, GlobalContext* globalCtx) { + EnPoh* this = THIS; + s32 pad; -extern ColliderCylinderInit D_80B2F680; -extern ColliderJntSphElementInit D_80B2F6AC[1]; -extern ColliderJntSphInit D_80B2F6D0; -extern DamageTable D_80B2F6E0; -extern CollisionCheckInfoInit D_80B2F700; -extern InitChainEntry D_80B2F708[]; + Actor_ProcessInitChain(&this->actor, sInitChain); + ActorShape_Init(&this->actor.shape, 0.0f, func_800B3FC0, 30.0f); + Collider_InitAndSetJntSph(globalCtx, &this->colliderSph, &this->actor, &sJntSphInit, this->colliderSphElements); + this->colliderSph.elements[0].dim.worldSphere.radius = 0; + this->colliderSph.elements[0].dim.worldSphere.center.x = this->actor.world.pos.x; + this->colliderSph.elements[0].dim.worldSphere.center.y = this->actor.world.pos.y; + this->colliderSph.elements[0].dim.worldSphere.center.z = this->actor.world.pos.z; + Collider_InitAndSetCylinder(globalCtx, &this->colliderCylinder, &this->actor, &sCylinderInit); + CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); + this->unk_18D = 32; + this->unk_190 = Rand_S16Offset(700, 300); + this->lightNode = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lightInfo); + Lights_PointGlowSetInfo(&this->lightInfo, this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z, + 255, 255, 255, 0); + SkelAnime_Init(globalCtx, &this->skelAnime, &D_060050D0, &D_06000A60, this->jointTable, this->morphTable, 21); + this->actor.bgCheckFlags |= 0x400; + func_80B2D0E8(this); +} -extern UNK_TYPE D_060001A8; -extern UNK_TYPE D_060004EC; -extern UNK_TYPE D_060006E0; -extern UNK_TYPE D_06000A60; -extern UNK_TYPE D_060011C4; -extern UNK_TYPE D_060015B0; -extern UNK_TYPE D_06002608; -extern UNK_TYPE D_06002D28; +void EnPoh_Destroy(Actor* thisx, GlobalContext* globalCtx) { + EnPoh* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/EnPoh_Init.s") + LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNode); + Collider_DestroyJntSph(globalCtx, &this->colliderSph); + Collider_DestroyCylinder(globalCtx, &this->colliderCylinder); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/EnPoh_Destroy.s") +void func_80B2C910(Vec3f* vec, GlobalContext* globalCtx) { + Camera* activeCam = ACTIVE_CAM; + Vec3f sp20; + f32 temp_f0; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2C910.s") + if (activeCam != NULL) { + Math_Vec3f_Diff(&activeCam->eye, &activeCam->at, &sp20); + temp_f0 = Math3D_Vec3fMagnitude(&sp20); + if (temp_f0 > 1.0f) { + temp_f0 = 11.0f / temp_f0; + } else { + temp_f0 = 11.0f; + } + Math_Vec3f_ScaleAndStore(&sp20, temp_f0, vec); + } else { + Math_Vec3f_Copy(vec, &D_801D15B0); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2C9B8.s") +void func_80B2C9B8(EnPoh* this, GlobalContext* globalCtx) { + Player* player = PLAYER; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2CA4C.s") + Math_StepToF(&this->actor.world.pos.y, player->actor.world.pos.y, 1.0f); + this->actor.world.pos.y += 2.5f * Math_SinS(this->unk_18D * 0x800); + if (this->unk_18D != 0) { + this->unk_18D--; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2CAA4.s") + if (!this->unk_18D) { + this->unk_18D = 32; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2CB60.s") +void func_80B2CA4C(EnPoh* this) { + SkelAnime_ChangeAnimDefaultRepeat(&this->skelAnime, &D_060015B0); + this->unk_18E = Rand_S16Offset(2, 3); + this->actionFunc = func_80B2CAA4; + this->actor.speedXZ = 0.0f; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2CBBC.s") +void func_80B2CAA4(EnPoh* this, GlobalContext* globalCtx) { + SkelAnime_FrameUpdateMatrix(&this->skelAnime); + if (func_801378B8(&this->skelAnime, 0.0f) && (this->unk_18E != 0)) { + this->unk_18E--; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2CD14.s") + func_80B2C9B8(this, globalCtx); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2CD64.s") + if (this->actor.xzDistToPlayer < 200.0f) { + func_80B2CD14(this); + } else if (this->unk_18E == 0) { + func_80B2CB60(this); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2CEC8.s") + if (this->unk_197 == 255) { + func_800B9010(&this->actor, NA_SE_EN_PO_FLY - SFX_FLAG); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2CF28.s") +void func_80B2CB60(EnPoh* this) { + SkelAnime_ChangeAnimDefaultRepeat(&this->skelAnime, &D_06000A60); + this->unk_18E = Rand_S16Offset(15, 3); + this->colliderCylinder.base.acFlags |= AC_ON; + this->actionFunc = func_80B2CBBC; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2CFF8.s") +void func_80B2CBBC(EnPoh* this, GlobalContext* globalCtx) { + SkelAnime_FrameUpdateMatrix(&this->skelAnime); + Math_StepToF(&this->actor.speedXZ, 1.0f, 0.2f); + if (func_801378B8(&this->skelAnime, 0.0f) && (this->unk_18E != 0)) { + this->unk_18E--; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2D07C.s") + if (Actor_XZDistanceToPoint(&this->actor, &this->actor.home.pos) > 400.0f) { + this->unk_192 = Actor_YawToPoint(&this->actor, &this->actor.home.pos); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2D0E8.s") + Math_ScaledStepToS(&this->actor.world.rot.y, this->unk_192, 0x71C); + func_80B2C9B8(this, globalCtx); + if ((this->actor.xzDistToPlayer < 200.0f) && (this->unk_18E < 19)) { + func_80B2CD14(this); + } else if (this->unk_18E == 0) { + if (Rand_ZeroOne() < 0.1f) { + func_80B2D694(this); + } else { + func_80B2CA4C(this); + } + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2D140.s") + if (this->unk_197 == 255) { + func_800B9010(&this->actor, NA_SE_EN_PO_FLY - SFX_FLAG); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2D2C0.s") +void func_80B2CD14(EnPoh* this) { + SkelAnime_ChangeAnimDefaultRepeat(&this->skelAnime, &D_06000A60); + this->actionFunc = func_80B2CD64; + this->unk_18E = 0; + this->actor.speedXZ = 2.0f; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2D300.s") +void func_80B2CD64(EnPoh* this, GlobalContext* globalCtx) { + Player* player = PLAYER; + s16 yawDiff; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2D5DC.s") + SkelAnime_FrameUpdateMatrix(&this->skelAnime); + if (this->unk_18E != 0) { + this->unk_18E--; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2D628.s") + yawDiff = this->actor.yawTowardsPlayer - player->actor.shape.rot.y; + if (yawDiff > 0x3000) { + Math_ScaledStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer + 0x3000, 0x71C); + } else if (yawDiff < -0x3000) { + Math_ScaledStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer - 0x3000, 0x71C); + } else { + Math_ScaledStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 0x71C); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2D694.s") + func_80B2C9B8(this, globalCtx); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2D6EC.s") + if (this->actor.xzDistToPlayer > 280.0f) { + func_80B2CB60(this); + } else if ((this->unk_18E == 0) && (this->actor.xzDistToPlayer < 140.0f) && + !Actor_IsLinkFacingActor(&this->actor, 0x2AAA, globalCtx)) { + func_80B2CEC8(this); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2D76C.s") + if (this->unk_197 == 255) { + func_800B9010(&this->actor, NA_SE_EN_PO_FLY - SFX_FLAG); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2D7D4.s") +void func_80B2CEC8(EnPoh* this) { + SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_060001A8, -6.0f); + this->unk_18E = 12; + this->actor.speedXZ = 0.0f; + Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_LAUGH); + this->actionFunc = func_80B2CF28; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2D924.s") +void func_80B2CF28(EnPoh* this, GlobalContext* globalCtx) { + SkelAnime_FrameUpdateMatrix(&this->skelAnime); + if (func_801378B8(&this->skelAnime, 0.0f)) { + Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_KANTERA); + if (this->unk_18E != 0) { + this->unk_18E--; + } + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2D980.s") + func_80B2C9B8(this, globalCtx); + if (this->unk_18E >= 10) { + Math_ScaledStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 0xAAA); + } else if (this->unk_18E == 9) { + this->actor.speedXZ = 5.0f; + this->skelAnime.animPlaybackSpeed = 2.0f; + } else if (this->unk_18E == 0) { + func_80B2CB60(this); + this->unk_18E = 0x17; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2DAD0.s") +void func_80B2CFF8(EnPoh* this) { + SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_060004EC, -6.0f); + func_800BE504(&this->actor, &this->colliderCylinder); + this->colliderCylinder.base.acFlags &= ~AC_ON; + this->actor.speedXZ = 5.0f; + func_800BCB70(&this->actor, 0x4000, 255, 0, 16); + this->actionFunc = func_80B2D07C; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2DB44.s") +void func_80B2D07C(EnPoh* this, GlobalContext* globalCtx) { + Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f); + if (SkelAnime_FrameUpdateMatrix(&this->skelAnime)) { + if (this->actor.colChkInfo.health != 0) { + func_80B2DAD0(this); + } else { + func_80B2D2C0(this); + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2DC50.s") +void func_80B2D0E8(EnPoh* this) { + this->unk_197 = 0; + this->actor.flags &= ~1; + SkelAnime_ChangeAnimPlaybackStop(&this->skelAnime, &D_060011C4, 0.0f); + this->actionFunc = func_80B2D140; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2DD2C.s") +void func_80B2D140(EnPoh* this, GlobalContext* globalCtx) { + if (SkelAnime_FrameUpdateMatrix(&this->skelAnime)) { + this->unk_197 = 255; + this->unk_190 = Rand_S16Offset(700, 300); + this->actor.flags |= 1; + func_80B2CB60(this); + } else if (this->skelAnime.animCurrentFrame > 10.0f) { + this->unk_197 = (this->skelAnime.animCurrentFrame - 10.0f) * 0.05f * 255.0f; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2DDF8.s") + if ((this->skelAnime.animPlaybackSpeed < 0.5f) && (this->actor.xzDistToPlayer < 280.0f)) { + Audio_PlayActorSound2(&this->actor, NA_SE_EN_STALKIDS_APPEAR); + this->skelAnime.animPlaybackSpeed = 1.0f; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2E0B0.s") +void func_80B2D2C0(EnPoh* this) { + this->actor.speedXZ = 0.0f; + this->actor.world.rot.y = this->actor.shape.rot.y; + this->unk_18E = 0; + this->actor.hintId = 0xFF; + this->actor.flags &= ~1; + this->actionFunc = func_80B2D300; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2E180.s") +void func_80B2D300(EnPoh* this, GlobalContext* globalCtx) { + static Vec3f D_80B2F710 = { 0.0f, 3.0f, 0.0f }; + Vec3f sp44; + f32 sp40; + s32 pad; + s16 sp3A; + s16 sp38; + s16 sp36; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2E1D8.s") + this->unk_18E++; + if (this->unk_18E < 8) { + sp38 = func_800DFCDC(ACTIVE_CAM) + 0x4800; + if (this->unk_18E < 5) { + sp3A = (this->unk_18E * 0x1000) - 0x4000; + sp44.y = (Math_SinS(sp3A) * 23.0f) + (this->actor.world.pos.y + 40.0f); + sp40 = Math_CosS(sp3A) * 23.0f; + sp44.x = (Math_SinS(sp38) * sp40) + this->actor.world.pos.x; + sp44.z = (Math_CosS(sp38) * sp40) + this->actor.world.pos.z; + } else { + sp44.y = this->actor.world.pos.y + 40.0f + (15.0f * (this->unk_18E - 5)); + sp44.x = (Math_SinS(sp38) * 23.0f) + this->actor.world.pos.x; + sp44.z = (Math_CosS(sp38) * 23.0f) + this->actor.world.pos.z; + } + sp36 = (this->unk_18E * 10) + 80; + func_800B3030(globalCtx, &sp44, &D_80B2F710, &D_801D15B0, sp36, 0, 2); + sp44.x = (2.0f * this->actor.world.pos.x) - sp44.x; + sp44.z = (2.0f * this->actor.world.pos.z) - sp44.z; + func_800B3030(globalCtx, &sp44, &D_80B2F710, &D_801D15B0, sp36, 0, 2); + sp44.x = this->actor.world.pos.x; + sp44.z = this->actor.world.pos.z; + func_800B3030(globalCtx, &sp44, &D_80B2F710, &D_801D15B0, sp36, 0, 2); + } else if (this->unk_18E == 28) { + func_80B2DC50(this, globalCtx); + } else if (this->unk_18E > 18) { + this->actor.scale.x = (28 - this->unk_18E) * 0.001f; + this->actor.scale.y = (28 - this->unk_18E) * 0.001f; + this->actor.scale.z = (28 - this->unk_18E) * 0.001f; + this->actor.world.pos.y += 5.0f; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2E230.s") + if (this->unk_18E < 18) { + func_800B9010(&this->actor, NA_SE_EN_COMMON_EXTINCT_LEV - SFX_FLAG); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2E3B0.s") + if (this->unk_18E == 18) { + Audio_PlayActorSound2(&this->actor, NA_SE_EN_WIZ_DISAPPEAR); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2E3F8.s") +void func_80B2D5DC(EnPoh* this) { + SkelAnime_ChangeAnimDefaultStop(&this->skelAnime, &D_06000A60); + this->actionFunc = func_80B2D628; + this->actor.speedXZ = -5.0f; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2E438.s") +void func_80B2D628(EnPoh* this, GlobalContext* globalCtx) { + if (SkelAnime_FrameUpdateMatrix(&this->skelAnime)) { + this->actor.world.rot.y = this->actor.shape.rot.y; + func_80B2CB60(this); + this->unk_18E = 23; + } else { + Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f); + this->actor.shape.rot.y += 0x1000; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2E55C.s") +void func_80B2D694(EnPoh* this) { + SkelAnime_ChangeAnimDefaultRepeat(&this->skelAnime, &D_060015B0); + this->unk_192 = BINANG_ROT180(this->actor.world.rot.y); + this->actionFunc = func_80B2D6EC; + this->actor.speedXZ = 0.0f; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2E6C0.s") +void func_80B2D6EC(EnPoh* this, GlobalContext* globalCtx) { + SkelAnime_FrameUpdateMatrix(&this->skelAnime); + if (Math_ScaledStepToS(&this->actor.world.rot.y, this->unk_192, 0x71C)) { + func_80B2CB60(this); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2E8E0.s") + if (this->actor.xzDistToPlayer < 200.0f) { + func_80B2CD14(this); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/EnPoh_Update.s") + func_80B2C9B8(this, globalCtx); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2ED14.s") +void func_80B2D76C(EnPoh* this) { + this->unk_18C = 32; + this->unk_192 = 0x2000; + this->actor.speedXZ = 0.0f; + this->actor.world.rot.y = this->actor.shape.rot.y; + Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_DISAPPEAR); + Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_LAUGH); + this->colliderCylinder.base.acFlags &= ~AC_ON; + this->actionFunc = func_80B2D7D4; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2EDD0.s") +void func_80B2D7D4(EnPoh* this, GlobalContext* globalCtx) { + if (this->unk_18C != 0) { + this->unk_18C--; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/EnPoh_Draw.s") + this->actor.world.rot.y += this->unk_192; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2F328.s") + if (this->unk_18C < 16) { + Math_ScaledStepToS(&this->unk_192, 0, 0x200); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2F37C.s") + func_80B2C9B8(this, globalCtx); + this->unk_197 = this->unk_18C * (255.0f / 32.0f); + if (this->unk_18C == 0) { + this->unk_190 = Rand_S16Offset(100, 50); + this->colliderCylinder.info.bumper.dmgFlags = 0x40001; + func_80B2CB60(this); + } +} + +void func_80B2D924(EnPoh* this) { + this->unk_18C = 0; + this->unk_192 = 0x2000; + this->actor.speedXZ = 0.0f; + Audio_PlayActorSound2(&this->actor, NA_SE_EN_STALKIDS_APPEAR); + Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_LAUGH); + this->colliderCylinder.base.acFlags &= ~AC_ON; + this->actionFunc = func_80B2D980; +} + +void func_80B2D980(EnPoh* this, GlobalContext* globalCtx) { + this->unk_18C++; + this->actor.world.rot.y -= this->unk_192; + if (this->unk_18C > 15) { + Math_ScaledStepToS(&this->unk_192, 0, 0x200); + } + + func_80B2C9B8(this, globalCtx); + this->unk_197 = this->unk_18C * (255.0f / 32.0f); + if (this->unk_18C == 32) { + this->unk_190 = Rand_S16Offset(700, 300); + this->unk_18C = 0; + this->colliderCylinder.info.bumper.dmgFlags = ~0x8340001; + func_80B2CB60(this); + } +} + +void func_80B2DAD0(EnPoh* this) { + SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_060006E0, -5.0f); + this->actor.speedXZ = 5.0f; + this->actor.world.rot.y = BINANG_ROT180(this->actor.shape.rot.y); + this->colliderCylinder.base.acFlags |= AC_ON; + this->unk_18E = 200; + this->actionFunc = func_80B2DB44; +} + +void func_80B2DB44(EnPoh* this, GlobalContext* globalCtx) { + f32 sp24; + + SkelAnime_FrameUpdateMatrix(&this->skelAnime); + sp24 = Math_SinS(this->unk_18D * 0x800) * 3.0f; + this->actor.world.pos.x -= sp24 * Math_CosS(this->actor.shape.rot.y); + this->actor.world.pos.z += sp24 * Math_SinS(this->actor.shape.rot.y); + Math_ScaledStepToS(&this->actor.world.rot.y, BINANG_ROT180(this->actor.yawTowardsPlayer), 0x71C); + func_80B2C9B8(this, globalCtx); + this->unk_18E--; + if ((this->unk_18E == 0) || (this->actor.xzDistToPlayer > 250.0f)) { + this->actor.world.rot.y = this->actor.shape.rot.y; + func_80B2CB60(this); + } + func_800B9010(&this->actor, NA_SE_EN_PO_AWAY - SFX_FLAG); +} + +void func_80B2DC50(EnPoh* this, GlobalContext* globalCtx) { + this->actor.update = func_80B2F328; + this->actor.draw = func_80B2F37C; + this->actor.shape.shadowDraw = NULL; + this->actor.world.pos.x = this->unk_3D8.wx; + this->actor.world.pos.y = this->unk_3D8.wy; + this->actor.world.pos.z = this->unk_3D8.wz; + Actor_SetScale(&this->actor, 0.01f); + this->actor.flags |= 0x10; + this->actor.gravity = -1.0f; + this->actor.shape.yOffset = 1500.0f; + this->actor.world.pos.y -= 15.0f; + this->actor.shape.rot.x = -0x8000; + func_800BC154(globalCtx, &globalCtx->actorCtx, &this->actor, 8); + this->actor.flags &= ~(0x4 | 0x1); + this->actionFunc = func_80B2DD2C; +} + +void func_80B2DD2C(EnPoh* this, GlobalContext* globalCtx) { + if ((this->actor.bgCheckFlags & 1) || (this->actor.floorHeight <= BGCHECK_Y_MIN)) { + EffectSsHahen_SpawnBurst(globalCtx, &this->actor.world.pos, 6.0f, 0, 1, 1, 15, OBJECT_PO, 10, D_06002D28); + func_80B2E0B0(this); + } + + Actor_SetVelocityAndMoveYRotationAndGravity(&this->actor); + Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 10.0f, 10.0f, 4); +} + +void func_80B2DDF8(EnPoh* this, s32 arg1) { + f32 temp_f2; + + this->unk_197 = CLAMP(this->unk_197 + arg1, 0, 255); + + if (arg1 < 0) { + temp_f2 = this->unk_197 * (1.0f / 255.0f); + this->actor.scale.x = this->actor.scale.z = (0.0056000003f * temp_f2) + 0.0014000001f; + this->actor.scale.y = (0.007f - (0.007f * temp_f2)) + 0.007f; + } else { + temp_f2 = 1.0f; + this->actor.scale.x = this->actor.scale.y = this->actor.scale.z = this->unk_197 * 0.000027450982f; + this->actor.world.pos.y = this->actor.home.pos.y + ((15.0f / 255.0f) * this->unk_197); + } + + this->unk_194 = 100.0f * temp_f2; + this->unk_195 = 0; + this->unk_196 = 150.0f * temp_f2; + Lights_PointNoGlowSetInfo(&this->lightInfo, this->actor.world.pos.x, this->actor.world.pos.y, + this->actor.world.pos.z, 100, 0, 150, this->unk_197 * (200.0f / 255.0f)); +} + +void func_80B2E0B0(EnPoh* this) { + Lights_PointNoGlowSetInfo(&this->lightInfo, this->actor.world.pos.x, this->actor.world.pos.y, + this->actor.world.pos.z, 0, 0, 0, 0); + this->unk_190 = 0; + this->actor.shape.rot.y = 0; + this->unk_194 = 0; + this->unk_197 = 0; + this->unk_195 = 0; + this->unk_196 = 200; + this->actor.shape.rot.x = 0; + this->actor.shape.yOffset = 0.0f; + this->actor.gravity = 0.0f; + this->actor.velocity.y = 0.0f; + this->actor.home.pos.y = this->actor.world.pos.y; + this->actor.scale.x = 0.0f; + this->actor.scale.y = 0.0f; + Audio_PlayActorSound2(&this->actor, NA_SE_EV_METAL_BOX_BOUND); + this->actionFunc = func_80B2E180; +} + +void func_80B2E180(EnPoh* this, GlobalContext* globalCtx) { + this->actor.home.pos.y += 2.0f; + func_80B2DDF8(this, 20); + if (this->unk_197 == 255) { + func_80B2E1D8(this); + } +} + +void func_80B2E1D8(EnPoh* this) { + this->actor.home.pos.y = this->actor.world.pos.y; + Actor_SetHeight(&this->actor, -10.0f); + this->unk_18E = 200; + this->unk_18D = 32; + this->actor.flags |= 1; + this->actionFunc = func_80B2E230; +} + +void func_80B2E230(EnPoh* this, GlobalContext* globalCtx) { + + if (Actor_HasParent(&this->actor, globalCtx)) { + Actor_MarkForDeath(&this->actor); + return; + } + + this->unk_18E--; + if (this->unk_18E == 0) { + func_80B2E3B0(this); + return; + } + + func_800B8A1C(&this->actor, globalCtx, 0xBA, 35.0f, 60.0f); + this->actor.world.pos.y = (Math_SinS(this->unk_18D * 0x800) * 5.0f) + this->actor.home.pos.y; + if (this->unk_18D) { + this->unk_18D--; + } + + if (this->unk_18D == 0) { + this->unk_18D = 32; + } + + Actor_SetHeight(&this->actor, -10.0f); + Lights_PointNoGlowSetInfo(&this->lightInfo, this->actor.world.pos.x, this->actor.world.pos.y, + this->actor.world.pos.z, 100, 0, 150, this->unk_197 * (40.0f / 51.0f)); +} + +void func_80B2E3B0(EnPoh* this) { + func_801A7328(&this->actor.projectedPos, NA_SE_EN_PO_BIG_CRY - SFX_FLAG); + Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_LAUGH); + this->actionFunc = func_80B2E3F8; +} + +void func_80B2E3F8(EnPoh* this, GlobalContext* globalCtx) { + func_80B2DDF8(this, -13); + if (this->unk_197 == 0) { + Actor_MarkForDeath(&this->actor); + } +} + +void func_80B2E438(EnPoh* this, GlobalContext* globalCtx) { + if (this->colliderCylinder.base.acFlags & AC_HIT) { + this->colliderCylinder.base.acFlags &= ~AC_HIT; + if (!Actor_ApplyDamage(&this->actor)) { + Enemy_StartFinishingBlow(globalCtx, &this->actor); + Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_DEAD); + } else if (this->actor.colChkInfo.damage != 0) { + Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_DAMAGE); + } + + if (this->actor.colChkInfo.damageEffect != 14) { + if (this->actor.colChkInfo.damageEffect == 15) { + func_80B2D924(this); + } else { + if (this->actor.colChkInfo.damageEffect == 4) { + this->unk_298 = 4.0f; + this->unk_29C = 0.45f; + Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, + this->colliderCylinder.info.bumper.hitPos.x, + this->colliderCylinder.info.bumper.hitPos.y, + this->colliderCylinder.info.bumper.hitPos.z, 0, 0, 0, CLEAR_TAG_LARGE_LIGHT_RAYS); + } + func_80B2CFF8(this); + } + } + } +} + +void func_80B2E55C(EnPoh* this) { + if ((this->actionFunc != func_80B2D980) && (this->actionFunc != func_80B2D7D4) && + (this->actionFunc != func_80B2D140)) { + if (this->unk_190 != 0) { + this->unk_190--; + } + + if (this->unk_197 == 255) { + if (this->actor.isTargeted) { + this->unk_18C++; + this->unk_18C = CLAMP_MAX(this->unk_18C, 20); + } else { + this->unk_18C = 0; + } + + if (((this->unk_18C == 20) || (this->unk_190 == 0)) && + ((this->actionFunc == func_80B2CAA4) || (this->actionFunc == func_80B2CBBC) || + (this->actionFunc == func_80B2CD64) || (this->actionFunc == func_80B2DB44) || + (this->actionFunc == func_80B2D6EC))) { + func_80B2D76C(this); + } + } else if ((this->unk_197 == 0) && (this->unk_190 == 0) && + ((this->actionFunc == func_80B2CAA4) || (this->actionFunc == func_80B2CBBC) || + (this->actionFunc == func_80B2CD64) || (this->actionFunc == func_80B2D6EC))) { + func_80B2D924(this); + } + } +} + +void func_80B2E6C0(EnPoh* this) { + if (this->actionFunc == func_80B2CF28) { + this->unk_194 = CLAMP_MAX((s16)(this->unk_194 + 5), 255); + this->unk_195 = CLAMP_MIN((s16)(this->unk_195 - 5), 50); + this->unk_196 = CLAMP_MIN((s16)(this->unk_196 - 5), 0); + } else if (this->actionFunc == func_80B2DB44) { + this->unk_194 = CLAMP_MAX((s16)(this->unk_194 + 5), 80); + this->unk_195 = CLAMP_MAX((s16)(this->unk_195 + 5), 255); + this->unk_196 = CLAMP_MAX((s16)(this->unk_196 + 5), 225); + } else if (this->actionFunc == func_80B2D07C) { + if ((this->actor.colorFilterTimer & 2) != 0) { + this->unk_194 = 0; + this->unk_195 = 0; + this->unk_196 = 0; + } else { + this->unk_194 = 80; + this->unk_195 = 255; + this->unk_196 = 225; + } + } else { + u8 temp; + + this->unk_194 = CLAMP_MAX((s16)(this->unk_194 + 5), 255); + this->unk_195 = CLAMP_MAX((s16)(this->unk_195 + 5), 255); + temp = this->unk_196; + if (this->unk_196 > 210) { + this->unk_196 = CLAMP_MIN((s16)(temp - 5), 210); + } else { + this->unk_196 = CLAMP_MAX((s16)(temp + 5), 210); + } + } +} + +void func_80B2E8E0(EnPoh* this) { + if ((this->actionFunc == func_80B2D140) && (this->skelAnime.animCurrentFrame < 12.0f)) { + this->unk_198 = this->unk_199 = this->unk_19A = (this->skelAnime.animCurrentFrame * 16.66f) + 55.0f; + this->unk_19B = this->skelAnime.animCurrentFrame * 16.666666f; + } else { + f32 rand = Rand_ZeroOne(); + + this->unk_198 = (s32)(rand * 30.0f) + 225; + this->unk_199 = (s32)(rand * 100.0f) + 155; + this->unk_19A = (s32)(rand * 160.0f) + 95; + this->unk_19B = 200; + } +} + +void EnPoh_Update(Actor* thisx, GlobalContext* globalCtx2) { + EnPoh* this = THIS; + GlobalContext* globalCtx = globalCtx2; + s32 pad; + + if (this->colliderSph.base.atFlags & AT_HIT) { + this->colliderSph.base.atFlags &= ~AT_HIT; + func_80B2D5DC(this); + } + + func_80B2E438(this, globalCtx); + func_80B2E55C(this); + this->actionFunc(this, globalCtx); + Actor_SetVelocityAndMoveYRotationAndGravity(&this->actor); + if ((this->actionFunc == func_80B2CF28) && (this->unk_18E < 10)) { + this->actor.flags |= 0x1000000; + CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderSph.base); + } + + Collider_UpdateCylinder(&this->actor, &this->colliderCylinder); + if (this->colliderCylinder.base.acFlags & AC_ON) { + CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderCylinder.base); + } + + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderCylinder.base); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderSph.base); + Actor_SetHeight(&this->actor, 42.0f); + + if ((this->actionFunc != func_80B2D07C) && (this->actionFunc != func_80B2D628)) { + if (this->actionFunc == func_80B2DB44) { + this->actor.shape.rot.y = BINANG_ROT180(this->actor.world.rot.y); + } else { + this->actor.shape.rot.y = this->actor.world.rot.y; + } + } + + func_80B2E8E0(this); + this->actor.shape.shadowAlpha = this->unk_197; + if (this->unk_298 > 0.0f) { + Math_StepToF(&this->unk_298, 0.0f, 0.05f); + if (this->unk_197 != 255) { + if (this->unk_197 * (1.0f / 255.0f) < this->unk_197) { + this->unk_298 = this->unk_197 * (1.0f / 255.0f); + } + } + + this->unk_29C = (this->unk_298 + 1.0f) * (9.0f / 40.0f); + this->unk_29C = CLAMP_MAX(this->unk_29C, 0.45f); + } +} + +s32 EnPoh_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, + Gfx** gfx) { + EnPoh* this = THIS; + + if ((this->unk_197 == 0) || (limbIndex == 18) || ((this->actionFunc == func_80B2D300) && (this->unk_18E >= 2))) { + *dList = NULL; + } + + if (limbIndex == 19) { + gDPPipeSync((*gfx)++); + gDPSetEnvColor((*gfx)++, this->unk_194, this->unk_195, this->unk_196, this->unk_197); + } + + return false; +} + +void EnPoh_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { + static s8 D_80B2F71C[] = { + -1, -1, -1, -1, 4, 5, -1, -1, -1, 0, 1, -1, -1, -1, -1, -1, 2, -1, -1, 3, -1, + }; + static Vec3f D_80B2F734[] = { + { -600.0f, 500.0f, 1700.0f }, + { -600.0f, 500.0f, -1700.0f }, + { 1000.0f, 1700.0f, 0.0f }, + }; + s32 temp_s3; + Vec3f sp60; + EnPoh* this = THIS; + s32 pad; + + Collider_UpdateSpheres(limbIndex, &this->colliderSph); + if ((this->actionFunc == func_80B2D300) && (this->unk_18E >= 2) && (limbIndex == 5)) { + gSPMatrix((*gfx)++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList((*gfx)++, D_06002608); + } + + if (limbIndex == 18) { + if ((this->actionFunc == func_80B2D300) && (this->unk_18E >= 19) && (this->actor.scale.x != 0.0f)) { + Matrix_Scale(0.01f / this->actor.scale.x, 0.01f / this->actor.scale.x, 0.01f / this->actor.scale.x, 1); + } + SysMatrix_CopyCurrentState(&this->unk_3D8); + func_80B2C910(&sp60, globalCtx); + Lights_PointGlowSetInfo(&this->lightInfo, this->colliderSph.elements[0].dim.worldSphere.center.x + (s32)sp60.x, + this->colliderSph.elements[0].dim.worldSphere.center.y + (s32)sp60.y, + this->colliderSph.elements[0].dim.worldSphere.center.z + (s32)sp60.z, this->unk_198, + this->unk_199, this->unk_19A, this->unk_19B * (200.0f / 255.0f)); + } + + temp_s3 = D_80B2F71C[limbIndex]; + if (temp_s3 != -1) { + if (temp_s3 < 4) { + SysMatrix_GetStateTranslation(&this->unk_2A0[temp_s3]); + } else if (temp_s3 == 4) { + SysMatrix_GetStateTranslationAndScaledX(2000.0f, &this->unk_2A0[temp_s3]); + } else { + s32 i; + Vec3f* vec = &this->unk_2A0[temp_s3 + 2]; + Vec3f* vec2 = &D_80B2F734[0]; + + SysMatrix_GetStateTranslationAndScaledX(-2000.0f, &this->unk_2A0[temp_s3]); + SysMatrix_GetStateTranslationAndScaledY(-2000.0f, &this->unk_2A0[temp_s3 + 1]); + + for (i = temp_s3 + 2; i < ARRAY_COUNT(this->unk_2A0); i++, vec++, vec2++) { + SysMatrix_MultiplyVector3fByState(vec2, vec); + } + } + } +} + +void EnPoh_Draw(Actor* thisx, GlobalContext* globalCtx) { + EnPoh* this = THIS; + Gfx* gfx; + + OPEN_DISPS(globalCtx->state.gfxCtx); + + func_80B2E6C0(this); + if ((this->unk_197 == 255) || (this->unk_197 == 0)) { + gfx = POLY_OPA_DISP; + + gSPDisplayList(&gfx[0], &sSetupDL[6 * 25]); + gDPSetEnvColor(&gfx[1], this->unk_194, this->unk_195, this->unk_196, this->unk_197); + gSPSegment(&gfx[2], 0x08, D_801AEFA0); + + gfx = SkelAnime_Draw2(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, EnPoh_OverrideLimbDraw, + EnPoh_PostLimbDraw, &this->actor, &gfx[3]); + + POLY_OPA_DISP = gfx; + } else { + gfx = POLY_XLU_DISP; + + gSPDisplayList(&gfx[0], &sSetupDL[6 * 25]); + gDPSetEnvColor(&gfx[1], 255, 255, 255, this->unk_197); + gSPSegment(&gfx[2], 0x08, D_801AEF88); + + POLY_XLU_DISP = SkelAnime_Draw2(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, + EnPoh_OverrideLimbDraw, EnPoh_PostLimbDraw, &this->actor, &gfx[3]); + + gfx = POLY_OPA_DISP; + gSPDisplayList(gfx++, &sSetupDL[6 * 25]); + } + + gDPPipeSync(&gfx[0]); + gDPSetEnvColor(&gfx[1], this->unk_198, this->unk_199, this->unk_19A, 255); + + SysMatrix_SetCurrentState(&this->unk_3D8); + + gSPMatrix(&gfx[2], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(&gfx[3], D_06002D28); + + POLY_OPA_DISP = &gfx[4]; + func_800BE680(globalCtx, &this->actor, this->unk_2A0, 10, this->actor.scale.x * 100.0f * this->unk_29C, 0.0f, + this->unk_298, 20); + + CLOSE_DISPS(globalCtx->state.gfxCtx); +} + +void func_80B2F328(Actor* thisx, GlobalContext* globalCtx) { + EnPoh* this = THIS; + + this->actionFunc(this, globalCtx); + if (this->actionFunc != func_80B2DD2C) { + this->unk_190++; + } + + func_80B2E8E0(this); +} + +void func_80B2F37C(Actor* thisx, GlobalContext* globalCtx) { + EnPoh* this = THIS; + s32 pad; + Vec3f sp7C; + Gfx* gfx; + + OPEN_DISPS(globalCtx->state.gfxCtx); + + if (this->actionFunc == func_80B2DD2C) { + gfx = POLY_OPA_DISP; + + gSPDisplayList(&gfx[0], &sSetupDL[6 * 25]); + gDPSetEnvColor(&gfx[1], this->unk_198, this->unk_199, this->unk_19A, 255); + + func_80B2C910(&sp7C, globalCtx); + Lights_PointGlowSetInfo(&this->lightInfo, this->actor.world.pos.x + sp7C.x, this->actor.world.pos.y + sp7C.y, + this->actor.world.pos.z + sp7C.z, this->unk_198, this->unk_199, this->unk_19A, 200); + + gSPMatrix(&gfx[2], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(&gfx[3], D_06002D28); + + POLY_OPA_DISP = &gfx[4]; + } else { + func_8012C2DC(globalCtx->state.gfxCtx); + + gSPSegment(POLY_XLU_DISP++, 0x08, + Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, (this->unk_190 * -8) & 0x1FF, + 0x20, 0x80)); + gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 170, 255, this->unk_197); + gDPSetEnvColor(POLY_XLU_DISP++, this->unk_194, this->unk_195, this->unk_196, 255); + + SysMatrix_InsertYRotation_f((func_800DFCDC(ACTIVE_CAM) + 0x8000) * (M_PI / 32768), MTXMODE_APPLY); + + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, D_06003850); + } + + CLOSE_DISPS(globalCtx->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_En_Poh/z_en_poh.h b/src/overlays/actors/ovl_En_Poh/z_en_poh.h index fe6776f603..fe579e027b 100644 --- a/src/overlays/actors/ovl_En_Poh/z_en_poh.h +++ b/src/overlays/actors/ovl_En_Poh/z_en_poh.h @@ -9,9 +9,32 @@ typedef void (*EnPohActionFunc)(struct EnPoh*, GlobalContext*); typedef struct EnPoh { /* 0x0000 */ Actor actor; - /* 0x0144 */ char unk_144[0x44]; + /* 0x0144 */ SkelAnime skelAnime; /* 0x0188 */ EnPohActionFunc actionFunc; - /* 0x018C */ char unk_18C[0x28C]; + /* 0x018C */ u8 unk_18C; + /* 0x018D */ u8 unk_18D; + /* 0x018E */ s16 unk_18E; + /* 0x0190 */ s16 unk_190; + /* 0x0192 */ s16 unk_192; + /* 0x0194 */ u8 unk_194; + /* 0x0195 */ u8 unk_195; + /* 0x0196 */ u8 unk_196; + /* 0x0197 */ u8 unk_197; + /* 0x0198 */ u8 unk_198; + /* 0x0199 */ u8 unk_199; + /* 0x019A */ u8 unk_19A; + /* 0x019B */ u8 unk_19B; + /* 0x019C */ Vec3s jointTable[21]; + /* 0x021A */ Vec3s morphTable[21]; + /* 0x0298 */ f32 unk_298; + /* 0x029C */ f32 unk_29C; + /* 0x02A0 */ Vec3f unk_2A0[10]; + /* 0x0318 */ LightNode* lightNode; + /* 0x031C */ LightInfo lightInfo; + /* 0x032C */ ColliderCylinder colliderCylinder; + /* 0x0378 */ ColliderJntSph colliderSph; + /* 0x0398 */ ColliderJntSphElement colliderSphElements[1]; + /* 0x03D8 */ MtxF unk_3D8; } EnPoh; // size = 0x418 extern const ActorInit En_Poh_InitVars; diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index ba1390e5c6..191840f324 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -13434,8 +13434,8 @@ 0x80B2E6C0:("func_80B2E6C0",), 0x80B2E8E0:("func_80B2E8E0",), 0x80B2EACC:("EnPoh_Update",), - 0x80B2ED14:("func_80B2ED14",), - 0x80B2EDD0:("func_80B2EDD0",), + 0x80B2ED14:("EnPoh_OverrideLimbDraw",), + 0x80B2EDD0:("EnPoh_PostLimbDraw",), 0x80B2F0A4:("EnPoh_Draw",), 0x80B2F328:("func_80B2F328",), 0x80B2F37C:("func_80B2F37C",),