From 829d1d4c2a37a1e241d5473782a3319cb08f0625 Mon Sep 17 00:00:00 2001 From: Maide <34639600+Kelebek1@users.noreply.github.com> Date: Sun, 31 Oct 2021 19:07:08 +0000 Subject: [PATCH] En_Po_Sisters (#345) * En_Po_Sisters * Tharo magic * Rebase * PR * Fix make and actorfixer * Format --- spec | 3 +- .../ovl_En_Po_Sisters/z_en_po_sisters.c | 1138 ++++++++++++++++- .../ovl_En_Po_Sisters/z_en_po_sisters.h | 30 +- tools/actorfixer.py | 17 + tools/disasm/functions.txt | 4 +- undefined_syms.txt | 8 + 6 files changed, 1125 insertions(+), 75 deletions(-) diff --git a/spec b/spec index ce47434ad3..5f3ff06b18 100644 --- a/spec +++ b/spec @@ -3975,8 +3975,7 @@ beginseg name "ovl_En_Po_Sisters" compress include "build/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.o" - include "build/data/ovl_En_Po_Sisters/ovl_En_Po_Sisters.data.o" - include "build/data/ovl_En_Po_Sisters/ovl_En_Po_Sisters.reloc.o" + include "build/src/overlays/actors/ovl_En_Po_Sisters/ovl_En_Po_Sisters_reloc.o" endseg beginseg diff --git a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c index 50aba0d7be..4ec78d0339 100644 --- a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c +++ b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c @@ -1,3 +1,9 @@ +/* + * File: z_en_po_sisters.c + * Overlay: ovl_En_Po_Sisters + * Description: Poe Sisters + */ + #include "z_en_po_sisters.h" #define FLAGS 0x00005015 @@ -9,24 +15,69 @@ void EnPoSisters_Destroy(Actor* thisx, GlobalContext* globalCtx); void EnPoSisters_Update(Actor* thisx, GlobalContext* globalCtx); void EnPoSisters_Draw(Actor* thisx, GlobalContext* globalCtx); +void func_80B1AA88(EnPoSisters* this); void func_80B1AAE8(EnPoSisters* this, GlobalContext* globalCtx); void func_80B1ABB8(EnPoSisters* this, GlobalContext* globalCtx); +void func_80B1AC40(EnPoSisters* this); void func_80B1ACB8(EnPoSisters* this, GlobalContext* globalCtx); +void func_80B1AE28(EnPoSisters* this); void func_80B1AE3C(EnPoSisters* this, GlobalContext* globalCtx); +void func_80B1AF8C(EnPoSisters* this); void func_80B1B020(EnPoSisters* this, GlobalContext* globalCtx); +void func_80B1B0E0(EnPoSisters* this); void func_80B1B168(EnPoSisters* this, GlobalContext* globalCtx); void func_80B1B2F0(EnPoSisters* this, GlobalContext* globalCtx); void func_80B1B444(EnPoSisters* this, GlobalContext* globalCtx); +void func_80B1B5B4(EnPoSisters* this); void func_80B1B628(EnPoSisters* this, GlobalContext* globalCtx); +void func_80B1B70C(EnPoSisters* this); void func_80B1B7BC(EnPoSisters* this, GlobalContext* globalCtx); +void func_80B1B860(EnPoSisters* this, GlobalContext* globalCtx); void func_80B1B940(EnPoSisters* this, GlobalContext* globalCtx); +void func_80B1BA3C(EnPoSisters* this); void func_80B1BA90(EnPoSisters* this, GlobalContext* globalCtx); +void func_80B1BC4C(EnPoSisters* this, GlobalContext* globalCtx); void func_80B1BCA0(EnPoSisters* this, GlobalContext* globalCtx); +void func_80B1BCF0(EnPoSisters* this, GlobalContext* globalCtx); +void func_80B1BE4C(EnPoSisters* this, s32 arg1); void func_80B1BF2C(EnPoSisters* this, GlobalContext* globalCtx); +void func_80B1C030(EnPoSisters* this); void func_80B1C0A4(EnPoSisters* this, GlobalContext* globalCtx); +void func_80B1C2E8(EnPoSisters* this); void func_80B1C340(EnPoSisters* this, GlobalContext* globalCtx); -#if 0 +extern AnimationHeader D_06000114; +extern AnimationHeader D_060008C0; +extern AnimationHeader D_06000A54; +extern AnimationHeader D_06000D40; +extern AnimationHeader D_0600119C; +extern AnimationHeader D_060014CC; +extern Gfx D_06001CB0[]; +extern Gfx D_06001DE0[]; +extern Gfx D_060027B0[]; +extern Gfx D_06002EB8[]; +extern Gfx D_06002F88[]; +extern Gfx D_06003628[]; +extern Gfx D_06003880[]; +extern Gfx D_06003DC8[]; +extern Gfx D_06004020[]; +extern Gfx D_060046E0[]; +extern SkeletonHeader D_060065C8; + +static Color_RGBA8 D_80B1DA30[] = { + { 255, 170, 255, 255 }, + { 255, 200, 0, 255 }, + { 0, 170, 255, 255 }, + { 170, 255, 0, 255 }, +}; + +static Color_RGBA8 D_80B1DA40[] = { + { 100, 0, 255, 255 }, + { 255, 0, 0, 255 }, + { 0, 0, 255, 255 }, + { 0, 150, 0, 255 }, +}; + const ActorInit En_Po_Sisters_InitVars = { ACTOR_EN_PO_SISTERS, ACTORCAT_ENEMY, @@ -39,18 +90,29 @@ const ActorInit En_Po_Sisters_InitVars = { (ActorFunc)EnPoSisters_Draw, }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_80B1DA70 = { - { COLTYPE_HIT3, AT_ON | AT_TYPE_ENEMY, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_CYLINDER, }, - { ELEMTYPE_UNK0, { 0xF7CFFFFF, 0x00, 0x08 }, { 0xF7CBFFFE, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON | BUMP_HOOKABLE, OCELEM_ON, }, +static ColliderCylinderInit sCylinderInit = { + { + COLTYPE_HIT3, + AT_ON | AT_TYPE_ENEMY, + AC_ON | AC_TYPE_PLAYER, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_1, + COLSHAPE_CYLINDER, + }, + { + ELEMTYPE_UNK0, + { 0xF7CFFFFF, 0x00, 0x08 }, + { 0xF7CBFFFE, 0x00, 0x00 }, + TOUCH_ON | TOUCH_SFX_NORMAL, + BUMP_ON | BUMP_HOOKABLE, + OCELEM_ON, + }, { 18, 60, 15, { 0, 0, 0 } }, }; -// sColChkInfoInit -static CollisionCheckInfoInit D_80B1DA9C = { 6, 25, 60, 50 }; +static CollisionCheckInfoInit sColChkInfoInit = { 6, 25, 60, 50 }; -// static DamageTable sDamageTable = { -static DamageTable D_80B1DAA4 = { +static DamageTable sDamageTable = { /* Deku Nut */ DMG_ENTRY(0, 0xF), /* Deku Stick */ DMG_ENTRY(1, 0x0), /* Horse trample */ DMG_ENTRY(1, 0x0), @@ -85,114 +147,1052 @@ static DamageTable D_80B1DAA4 = { /* Powder Keg */ DMG_ENTRY(1, 0x0), }; -// static InitChainEntry sInitChain[] = { -static InitChainEntry D_80B1DAC4[] = { +static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 7, ICHAIN_CONTINUE), ICHAIN_F32(targetArrowOffset, 6000, ICHAIN_STOP), }; -#endif +void EnPoSisters_Init(Actor* thisx, GlobalContext* globalCtx) { + s32 pad; + EnPoSisters* this = THIS; -extern ColliderCylinderInit D_80B1DA70; -extern CollisionCheckInfoInit D_80B1DA9C; -extern DamageTable D_80B1DAA4; -extern InitChainEntry D_80B1DAC4[]; + Actor_ProcessInitChain(&this->actor, sInitChain); + ActorShape_Init(&this->actor.shape, 0.0f, func_800B3FC0, 50.0f); + SkelAnime_Init(globalCtx, &this->skelAnime, &D_060065C8, &D_060014CC, this->jointTable, this->morphTable, 12); + this->unk_226 = 255; + this->unk_227 = 255; + this->unk_228 = 210; + this->unk_229 = 255; + 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, 0, + 0, 0, 0); + Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); + this->unk_18C = ENPOSISTERS_GET_300(thisx); + this->actor.hintId = this->unk_18C + 80; + this->unk_18D = ENPOSISTERS_GET_C00(thisx); + this->unk_18E = 32; + this->unk_18F = 20; + this->unk_190 = 1; + this->unk_191 = 0x20; + this->unk_2EC = 110.0f; + thisx->flags &= ~1; -extern UNK_TYPE D_06000114; -extern UNK_TYPE D_060008C0; -extern UNK_TYPE D_06000A54; -extern UNK_TYPE D_06000D40; -extern UNK_TYPE D_0600119C; -extern UNK_TYPE D_060014CC; -extern UNK_TYPE D_060027B0; -extern UNK_TYPE D_060046E0; + if (ENPOSISTERS_GET_1000(&this->actor)) { + func_80B1AA88(this); + } else if (this->unk_18C == 0) { + if (this->unk_18D == 0) { + this->actor.colChkInfo.health = 8; + this->collider.info.toucher.damage = 16; + this->collider.base.ocFlags1 = (OC1_TYPE_PLAYER | OC1_ON); + func_80B1BCF0(this, globalCtx); + func_80B1C2E8(this); + } else { + this->actor.flags &= ~(0x4000 | 0x200); + this->collider.info.elemType = ELEMTYPE_UNK4; + this->collider.info.bumper.dmgFlags |= (0x40000 | 0x1); + this->collider.base.ocFlags1 = OC1_NONE; + func_80B1BE4C(this, false); + } + } else { + func_80B1C2E8(this); + } + this->actor.params &= 0xFF; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Po_Sisters/EnPoSisters_Init.s") +void EnPoSisters_Destroy(Actor* thisx, GlobalContext* globalCtx) { + EnPoSisters* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Po_Sisters/EnPoSisters_Destroy.s") + LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNode); + Collider_DestroyCylinder(globalCtx, &this->collider); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Po_Sisters/func_80B1A648.s") +void func_80B1A648(EnPoSisters* this, s32 arg1, Vec3f* pos) { + s32 i; + Vec3f* ptr; + f32 temp_f20 = arg1; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Po_Sisters/func_80B1A768.s") + for (i = 0; i < this->unk_190; i++) { + ptr = &this->unk_22C[i]; + ptr->x = Math_SinS(this->actor.shape.rot.y + (this->unk_192 * 0x800) + (i * 0x2000)) * (SQ(temp_f20) * 0.1f) + + pos->x; + ptr->z = Math_CosS(this->actor.shape.rot.y + (this->unk_192 * 0x800) + (i * 0x2000)) * (SQ(temp_f20) * 0.1f) + + pos->z; + ptr->y = pos->y + temp_f20; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Po_Sisters/func_80B1A894.s") +void func_80B1A768(EnPoSisters* this, GlobalContext* globalCtx) { + Player* player = GET_PLAYER(globalCtx); + f32 sp20; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Po_Sisters/func_80B1A9B0.s") + if ((this->unk_18D == 0) || (this->actionFunc != func_80B1B444)) { + if (((player->swordState == 0) || (player->swordAnimation >= 30)) && + ((player->actor.world.pos.y - player->actor.floorHeight) < 1.0f)) { + Math_StepToF(&this->unk_2EC, 110.0f, 3.0f); + } else { + Math_StepToF(&this->unk_2EC, 170.0f, 10.0f); + } + sp20 = this->unk_2EC; + } else if (this->unk_18D != 0) { + sp20 = this->actor.parent->xzDistToPlayer; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Po_Sisters/func_80B1AA88.s") + this->actor.world.pos.x = (Math_SinS(BINANG_ROT180(this->actor.shape.rot.y)) * sp20) + player->actor.world.pos.x; + this->actor.world.pos.z = (Math_CosS(BINANG_ROT180(this->actor.shape.rot.y)) * sp20) + player->actor.world.pos.z; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Po_Sisters/func_80B1AAE8.s") +void func_80B1A894(EnPoSisters* this, GlobalContext* globalCtx) { + Player* player = GET_PLAYER(globalCtx); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Po_Sisters/func_80B1AB5C.s") + Math_ApproachF(&this->actor.world.pos.y, player->actor.world.pos.y + 5.0f, 0.5f, 3.0f); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Po_Sisters/func_80B1ABB8.s") + if (this->unk_18E == 0) { + this->unk_18E = 32; + if (this->unk_18E) {} + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Po_Sisters/func_80B1AC40.s") + if (this->unk_18E != 0) { + this->unk_18E--; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Po_Sisters/func_80B1ACB8.s") + this->actor.world.pos.y += (2.0f + (0.5f * Rand_ZeroOne())) * Math_SinS(this->unk_18E * 0x800); + if ((this->unk_229 == 255) && (this->actionFunc != func_80B1B168) && (this->actionFunc != func_80B1B020)) { + if (this->actionFunc == func_80B1B628) { + func_800B9010(&this->actor, NA_SE_EN_PO_AWAY - SFX_FLAG); + } else { + func_800B9010(&this->actor, NA_SE_EN_PO_FLY - SFX_FLAG); + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Po_Sisters/func_80B1AE28.s") +void func_80B1A9B0(EnPoSisters* this, GlobalContext* globalCtx) { + if (this->actor.isTargeted && (this->unk_229 == 255)) { + if (this->unk_18F != 0) { + this->unk_18F--; + } + } else { + this->unk_18F = 20; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Po_Sisters/func_80B1AE3C.s") + if (this->unk_229 == 0) { + if (this->unk_194 != 0) { + this->unk_194--; + } + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Po_Sisters/func_80B1AF8C.s") + if ((this->actionFunc != func_80B1B020) && (this->actionFunc != func_80B1B168) && + (this->actionFunc != func_80B1B444)) { + if (this->unk_18F == 0) { + func_80B1B70C(this); + } else if ((this->unk_194 == 0) && (this->unk_229 == 0)) { + func_80B1B860(this, globalCtx); + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Po_Sisters/func_80B1B020.s") +void func_80B1AA88(EnPoSisters* this) { + Animation_MorphToLoop(&this->skelAnime, &D_060014CC, -3.0f); + this->actor.speedXZ = 0.0f; + this->unk_192 = Rand_S16Offset(100, 50); + this->actionFunc = func_80B1AAE8; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Po_Sisters/func_80B1B0E0.s") +void func_80B1AAE8(EnPoSisters* this, GlobalContext* globalCtx) { + SkelAnime_Update(&this->skelAnime); + if (DECR(this->unk_192) == 0) { + this->unk_192 = Rand_S16Offset(100, 50); + Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_LAUGH2); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Po_Sisters/func_80B1B168.s") +void func_80B1AB5C(EnPoSisters* this) { + Animation_MorphToLoop(&this->skelAnime, &D_060014CC, -3.0f); + this->unk_192 = Rand_S16Offset(2, 3); + this->actor.speedXZ = 0.0f; + this->actionFunc = func_80B1ABB8; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Po_Sisters/func_80B1B280.s") +void func_80B1ABB8(EnPoSisters* this, GlobalContext* globalCtx) { + SkelAnime_Update(&this->skelAnime); + if (Animation_OnFrame(&this->skelAnime, 0.0f)) { + if (this->unk_192 != 0) { + this->unk_192--; + } + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Po_Sisters/func_80B1B2F0.s") + if ((this->unk_192 == 0) || (this->actor.xzDistToPlayer < 600.0f)) { + func_80B1AC40(this); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Po_Sisters/func_80B1B3A8.s") +void func_80B1AC40(EnPoSisters* this) { + if (this->actionFunc != func_80B1AE3C) { + Animation_MorphToLoop(&this->skelAnime, &D_06000D40, -3.0f); + } + this->unk_192 = Rand_S16Offset(15, 3); + this->unk_191 |= (0x6 | 0x1); + this->actionFunc = func_80B1ACB8; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Po_Sisters/func_80B1B444.s") +void func_80B1ACB8(EnPoSisters* this, GlobalContext* globalCtx) { + SkelAnime_Update(&this->skelAnime); + Math_StepToF(&this->actor.speedXZ, 1.0f, 0.2f); + if (Animation_OnFrame(&this->skelAnime, 0.0f)) { + if (this->unk_192 != 0) { + this->unk_192--; + } + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Po_Sisters/func_80B1B5B4.s") + if ((this->actor.xzDistToPlayer < 600.0f) && (fabsf(this->actor.yDistToPlayer + 5.0f) < 30.0f)) { + func_80B1AE28(this); + } else if ((this->unk_192 == 0) && Math_StepToF(&this->actor.speedXZ, 0.0f, 0.2f)) { + func_80B1AB5C(this); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Po_Sisters/func_80B1B628.s") + if (this->actor.bgCheckFlags & 8) { + Math_ScaledStepToS(&this->actor.world.rot.y, Actor_YawToPoint(&this->actor, &this->actor.home.pos), 0x71C); + } else if (Actor_XZDistanceToPoint(&this->actor, &this->actor.home.pos) > 600.0f) { + Math_ScaledStepToS(&this->actor.world.rot.y, Actor_YawToPoint(&this->actor, &this->actor.home.pos), 0x71C); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Po_Sisters/func_80B1B70C.s") +void func_80B1AE28(EnPoSisters* this) { + this->actionFunc = func_80B1AE3C; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Po_Sisters/func_80B1B7BC.s") +void func_80B1AE3C(EnPoSisters* this, GlobalContext* globalCtx) { + Player* player = GET_PLAYER(globalCtx); + s16 sp22; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Po_Sisters/func_80B1B860.s") + SkelAnime_Update(&this->skelAnime); + sp22 = this->actor.yawTowardsPlayer - player->actor.shape.rot.y; + Math_StepToF(&this->actor.speedXZ, 2.0f, 0.2f); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Po_Sisters/func_80B1B940.s") + if (sp22 > 0x3000) { + Math_ScaledStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer + 0x3000, 0x71C); + } else if (sp22 < -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_Po_Sisters/func_80B1BA3C.s") + if ((this->actor.xzDistToPlayer < 320.0f) && (fabsf(this->actor.yDistToPlayer + 5.0f) < 30.0f)) { + func_80B1AF8C(this); + } else if (this->actor.xzDistToPlayer > 720.0f) { + func_80B1AC40(this); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Po_Sisters/func_80B1BA90.s") +void func_80B1AF8C(EnPoSisters* this) { + if (this->unk_229 != 0) { + this->collider.base.colType = COLTYPE_METAL; + this->collider.base.acFlags |= AC_HARD; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Po_Sisters/func_80B1BC4C.s") + Animation_MorphToLoop(&this->skelAnime, &D_06000114, -5.0f); + this->actor.speedXZ = 0.0f; + this->unk_192 = Animation_GetLastFrame(&D_06000114.common) * 3 + 3; + this->unk_191 &= ~2; + this->actionFunc = func_80B1B020; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Po_Sisters/func_80B1BCA0.s") +void func_80B1B020(EnPoSisters* this, GlobalContext* globalCtx) { + SkelAnime_Update(&this->skelAnime); + if (this->unk_192 != 0) { + this->unk_192--; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Po_Sisters/func_80B1BCF0.s") + this->actor.shape.rot.y += ((s32)((this->skelAnime.endFrame + 1.0f) * 3.0f) - this->unk_192) * 0x180; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Po_Sisters/func_80B1BE4C.s") + if ((this->unk_192 == 18) || (this->unk_192 == 7)) { + Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_ROLL); + } else if (this->unk_192 == 0) { + func_80B1B0E0(this); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Po_Sisters/func_80B1BF2C.s") +void func_80B1B0E0(EnPoSisters* this) { + this->actor.speedXZ = 5.0f; + if (this->unk_18C == 0) { + this->collider.base.colType = COLTYPE_METAL; + this->collider.base.acFlags |= AC_HARD; + Animation_MorphToLoop(&this->skelAnime, &D_06000114, -5.0f); + } + this->unk_192 = 5; + this->actor.world.rot.y = this->actor.yawTowardsPlayer; + this->unk_191 |= 8; + this->actionFunc = func_80B1B168; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Po_Sisters/func_80B1C030.s") +void func_80B1B168(EnPoSisters* this, GlobalContext* globalCtx) { + SkelAnime_Update(&this->skelAnime); + if (Animation_OnFrame(&this->skelAnime, 0.0f)) { + if (this->unk_192 != 0) { + this->unk_192--; + } + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Po_Sisters/func_80B1C0A4.s") + this->actor.shape.rot.y += (s32)(1152.0f * this->skelAnime.endFrame); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Po_Sisters/func_80B1C2E8.s") + if (this->unk_192 == 0) { + s16 rotY = this->actor.shape.rot.y - this->actor.world.rot.y; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Po_Sisters/func_80B1C340.s") + if (ABS_ALT(rotY) < 0x1000) { + if (this->unk_18C != 0) { + this->collider.base.colType = COLTYPE_HIT3; + this->collider.base.acFlags &= ~AC_HARD; + func_80B1AC40(this); + } else { + Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_LAUGH2); + func_80B1BE4C(this, globalCtx); + } + } + } + if (Animation_OnFrame(&this->skelAnime, 1.0f)) { + Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_ROLL); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Po_Sisters/func_80B1C408.s") +void func_80B1B280(EnPoSisters* this) { + Animation_MorphToLoop(&this->skelAnime, &D_06000D40, -3.0f); + this->actor.world.rot.y = BINANG_ROT180(this->actor.yawTowardsPlayer); + if (this->unk_18C != 0) { + this->collider.base.colType = COLTYPE_HIT3; + this->collider.base.acFlags &= ~AC_HARD; + } + this->actionFunc = func_80B1B2F0; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Po_Sisters/EnPoSisters_Update.s") +void func_80B1B2F0(EnPoSisters* this, GlobalContext* globalCtx) { + SkelAnime_Update(&this->skelAnime); + this->actor.shape.rot.y -= (s16)(this->actor.speedXZ * 10.0f * 128.0f); + if (Math_StepToF(&this->actor.speedXZ, 0.0f, 0.1f)) { + this->actor.world.rot.y = this->actor.shape.rot.y; + if (this->unk_18C != 0) { + func_80B1AC40(this); + } else { + Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_LAUGH2); + func_80B1BE4C(this, globalCtx); + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Po_Sisters/func_80B1C974.s") +void func_80B1B3A8(EnPoSisters* this) { + Animation_MorphToPlayOnce(&this->skelAnime, &D_060008C0, -3.0f); + if (this->collider.base.ac != NULL) { + func_800BE504(&this->actor, &this->collider); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Po_Sisters/func_80B1CB44.s") + if (this->unk_18C != 0) { + this->actor.speedXZ = 10.0f; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Po_Sisters/func_80B1CD34.s") + this->unk_191 &= ~(0x8 | 0x2 | 0x1); + func_800BCB70(&this->actor, 0x4000, 255, 0, 16); + this->actionFunc = func_80B1B444; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Po_Sisters/EnPoSisters_Draw.s") +void func_80B1B444(EnPoSisters* this, GlobalContext* globalCtx) { + s32 temp_f18; + + if (SkelAnime_Update(&this->skelAnime) && !(this->actor.flags & 0x8000)) { + if (this->actor.colChkInfo.health != 0) { + if (this->unk_18C != 0) { + func_80B1B5B4(this); + } else if (this->unk_18D != 0) { + func_80B1BE4C(this, 0); + } else { + func_80B1BE4C(this, globalCtx); + } + } else { + func_80B1BA3C(this); + } + } + + if (this->unk_18D != 0) { + Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.parent->shape.rot.y, + (this->unk_18D == 2) ? 0x800 : 0x400); + temp_f18 = ((this->skelAnime.endFrame - this->skelAnime.curFrame) * 255.0f) / this->skelAnime.endFrame; + this->unk_229 = CLAMP(temp_f18, 0, 255); + this->actor.world.pos.y = this->actor.parent->world.pos.y; + func_80B1A768(this, globalCtx); + } else if (this->unk_18C != 0) { + Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f); + } +} + +void func_80B1B5B4(EnPoSisters* this) { + Animation_MorphToLoop(&this->skelAnime, &D_06000A54, -3.0f); + this->actor.world.rot.y = BINANG_ROT180(this->actor.shape.rot.y); + this->unk_192 = 5; + this->unk_191 |= (0x8 | 0x2 | 0x1); + this->actor.speedXZ = 5.0f; + this->actionFunc = func_80B1B628; +} + +void func_80B1B628(EnPoSisters* this, GlobalContext* globalCtx) { + SkelAnime_Update(&this->skelAnime); + Math_ScaledStepToS(&this->actor.world.rot.y, BINANG_ROT180(this->actor.yawTowardsPlayer), 0x71C); + if (Animation_OnFrame(&this->skelAnime, 0.0f)) { + if (this->unk_192 != 0) { + this->unk_192--; + } + } + + if (this->actor.bgCheckFlags & 8) { + this->actor.world.rot.y = this->actor.shape.rot.y; + this->unk_191 |= 2; + func_80B1B70C(this); + } else if ((this->unk_192 == 0) && (this->actor.xzDistToPlayer > 480.0f)) { + this->actor.world.rot.y = this->actor.shape.rot.y; + func_80B1AC40(this); + } +} + +void func_80B1B70C(EnPoSisters* this) { + Animation_Change(&this->skelAnime, &D_0600119C, 1.5f, 0.0f, Animation_GetLastFrame(&D_0600119C.common), 2, -3.0f); + this->unk_194 = 100; + this->actor.speedXZ = 0.0f; + this->actor.world.rot.y = this->actor.shape.rot.y; + this->unk_191 &= ~(0x4 | 0x1); + Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_DISAPPEAR); + Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_LAUGH2); + this->actionFunc = func_80B1B7BC; +} + +void func_80B1B7BC(EnPoSisters* this, GlobalContext* globalCtx) { + s32 temp_f18; + + if (SkelAnime_Update(&this->skelAnime)) { + this->unk_229 = 0; + this->collider.info.bumper.dmgFlags = (0x40000 | 0x1); + func_80B1AC40(this); + } else { + temp_f18 = ((this->skelAnime.endFrame - this->skelAnime.curFrame) * 255.0f) / this->skelAnime.endFrame; + this->unk_229 = CLAMP(temp_f18, 0, 255); + } +} + +void func_80B1B860(EnPoSisters* this, GlobalContext* globalCtx) { + Animation_Change(&this->skelAnime, &D_0600119C, 1.5f, 0.0f, Animation_GetLastFrame(&D_0600119C.common), 2, -3.0f); + if (this->unk_18C == 0) { + this->unk_2EC = 110.0f; + func_80B1A768(this, globalCtx); + this->unk_229 = 0; + this->actor.draw = EnPoSisters_Draw; + } else { + this->actor.world.rot.y = this->actor.shape.rot.y; + } + + this->unk_192 = 15; + this->actor.speedXZ = 0.0f; + Audio_PlayActorSound2(&this->actor, NA_SE_EN_STALKIDS_APPEAR); + this->unk_191 &= ~0x1; + this->actionFunc = func_80B1B940; +} + +void func_80B1B940(EnPoSisters* this, GlobalContext* globalCtx) { + if (SkelAnime_Update(&this->skelAnime) != 0) { + this->unk_229 = 255; + if (this->unk_18C != 0) { + this->unk_191 |= 1; + this->collider.info.bumper.dmgFlags = ~(0x8000000 | 0x200000 | 0x100000 | 0x40000 | 0x1); + if (this->unk_192 != 0) { + this->unk_192--; + } + + if (this->unk_192 == 0) { + this->unk_18F = 20; + func_80B1AC40(this); + } + } else { + func_80B1C030(this); + } + } else { + s32 temp_f18 = (this->skelAnime.curFrame * 255.0f) / this->skelAnime.endFrame; + + this->unk_229 = CLAMP(temp_f18, 0, 255); + if (this->unk_18C == 0) { + func_80B1A768(this, globalCtx); + } + } +} + +void func_80B1BA3C(EnPoSisters* this) { + this->unk_192 = 0; + this->actor.speedXZ = 0.0f; + this->actor.world.pos.y += 42.0f; + this->actor.shape.yOffset = -6000.0f; + this->actor.flags &= ~1; + this->unk_191 = 0; + this->actionFunc = func_80B1BA90; +} + +void func_80B1BA90(EnPoSisters* this, GlobalContext* globalCtx) { + s32 i; + s32 end = this->unk_190; + + this->unk_192++; + end++; + if (end > ARRAY_COUNT(this->unk_22C)) { + this->unk_190 = 8; + } else { + this->unk_190 = end; + } + + for (end = this->unk_190 - 1; end > 0; end--) { + this->unk_22C[end] = this->unk_22C[end - 1]; + } + + this->unk_22C[0].x = + (Math_SinS((this->actor.shape.rot.y + (this->unk_192 * 0x3000)) - 0x4000) * (3000.0f * this->actor.scale.x)) + + this->actor.world.pos.x; + this->unk_22C[0].z = + (Math_CosS((this->actor.shape.rot.y + (this->unk_192 * 0x3000)) - 0x4000) * (3000.0f * this->actor.scale.x)) + + this->actor.world.pos.z; + if (this->unk_192 < 8) { + this->unk_22C[0].y = this->unk_22C[1].y - 9.0f; + } else { + this->unk_22C[0].y = this->unk_22C[1].y + 2.0f; + if (this->unk_192 >= 16) { + if (Math_StepToF(&this->actor.scale.x, 0.0f, 0.001f)) { + func_80B1BC4C(this, globalCtx); + } + this->actor.scale.z = this->actor.scale.x; + this->actor.scale.y = this->actor.scale.x; + } + } + + if (this->unk_192 == 16) { + Audio_PlayActorSound2(&this->actor, NA_SE_EN_WIZ_DISAPPEAR); + } +} + +void func_80B1BC4C(EnPoSisters* this, GlobalContext* globalCtx) { + this->unk_192 = 0; + this->actor.world.pos.y = this->unk_22C[0].y; + Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x80); + this->actionFunc = func_80B1BCA0; +} + +void func_80B1BCA0(EnPoSisters* this, GlobalContext* globalCtx) { + this->unk_192++; + if (this->unk_192 == 32) { + Actor_MarkForDeath(&this->actor); + } else { + func_80B1A648(this, this->unk_192, &this->actor.world.pos); + } +} + +void func_80B1BCF0(EnPoSisters* this, GlobalContext* globalCtx) { + Actor* sp4C = + Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_PO_SISTERS, this->actor.world.pos.x, + this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0x400); + Actor* sp48 = + Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_PO_SISTERS, this->actor.world.pos.x, + this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0x800); + Actor* sp44 = + Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_PO_SISTERS, this->actor.world.pos.x, + this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0xC00); + + if ((sp4C == NULL) || (sp48 == NULL) || (sp44 == NULL)) { + if (sp4C != NULL) { + Actor_MarkForDeath(sp4C); + } + + if (sp48 != NULL) { + Actor_MarkForDeath(sp48); + } + + if (sp44 != NULL) { + Actor_MarkForDeath(sp44); + } + Actor_MarkForDeath(&this->actor); + } +} + +void func_80B1BE4C(EnPoSisters* this, s32 arg1) { + Vec3f sp34; + + this->actor.draw = NULL; + this->actor.flags &= ~1; + this->unk_194 = 100; + this->unk_191 = 0x20; + this->collider.base.colType = COLTYPE_HIT3; + this->collider.base.acFlags &= ~AC_HARD; + if (arg1) { + sp34.x = this->actor.world.pos.x; + sp34.y = this->actor.world.pos.y + 45.0f; + sp34.z = this->actor.world.pos.z; + func_800B3030(arg1, &sp34, &D_801D15B0, &D_801D15B0, 150, 0, 3); + } + Lights_PointSetColorAndRadius(&this->lightInfo, 0, 0, 0, 0); + this->actionFunc = func_80B1BF2C; +} + +void func_80B1BF2C(EnPoSisters* this, GlobalContext* globalCtx) { + Player* player = GET_PLAYER(globalCtx); + EnPoSisters* parent = (EnPoSisters*)this->actor.parent; + + if (this->unk_18D == 0) { + if (this->unk_194 != 0) { + this->unk_194--; + } + + if (this->unk_194 == 0) { + s32 rand = Rand_ZeroFloat(4.0f); + + this->actor.shape.rot.y = (rand * 0x4000) + this->actor.yawTowardsPlayer; + this->actor.world.pos.y = player->actor.world.pos.y + 5.0f; + func_80B1B860(this, globalCtx); + } + } else if (parent->actionFunc == func_80B1B940) { + this->actor.shape.rot.y = this->actor.parent->shape.rot.y + (this->unk_18D * 0x4000); + this->actor.world.pos.y = player->actor.world.pos.y + 5.0f; + func_80B1B860(this, globalCtx); + } else if (parent->actionFunc == func_80B1BA90) { + Actor_MarkForDeath(&this->actor); + } +} + +void func_80B1C030(EnPoSisters* this) { + Animation_MorphToLoop(&this->skelAnime, &D_06000D40, -3.0f); + this->unk_229 = 255; + this->unk_192 = 300; + this->unk_194 = 3; + this->unk_191 |= (0x8 | 0x1); + this->actor.flags |= 1; + this->actionFunc = func_80B1C0A4; +} + +void func_80B1C0A4(EnPoSisters* this, GlobalContext* globalCtx) { + EnPoSisters* parent; + + if (this->unk_192 != 0) { + this->unk_192--; + } + + if (this->unk_194 > 0) { + if (this->unk_192 >= 16) { + SkelAnime_Update(&this->skelAnime); + if (this->unk_18D == 0) { + if (ABS_ALT(16 - this->unk_18E) < 14) { + this->actor.shape.rot.y += + (s16)((0x580 - (this->unk_194 * 0x180)) * fabsf(Math_SinS(this->unk_18E * 0x800))); + } + + if ((this->unk_192 >= 284) || (this->unk_192 < 31)) { + this->unk_191 |= 0x40; + } else { + this->unk_191 &= ~0x40; + } + } else { + this->actor.shape.rot.y = this->actor.parent->shape.rot.y + (this->unk_18D * 0x4000); + } + } + } + + if (this->unk_18D == 0) { + if ((this->unk_192 >= 284) || ((this->unk_192 < 31) && (this->unk_192 >= 16))) { + this->unk_191 |= 0x40; + } else { + this->unk_191 &= ~0x40; + } + } + + if (this->unk_192 == 0) { + if (this->unk_18D == 0) { + func_80B1B0E0(this); + } else { + func_80B1BE4C(this, globalCtx); + } + } else if (this->unk_18D != 0) { + parent = (EnPoSisters*)this->actor.parent; + if (parent->actionFunc == func_80B1B444) { + func_80B1B3A8(this); + } + } else if (this->unk_194 == 0) { + this->unk_194 = -15; + } else if (this->unk_194 < 0) { + this->unk_194++; + if (this->unk_194 == 0) { + func_80B1B0E0(this); + } + } + func_80B1A768(this, globalCtx); +} + +void func_80B1C2E8(EnPoSisters* this) { + Animation_PlayOnce(&this->skelAnime, &D_0600119C); + Audio_PlayActorSound2(&this->actor, NA_SE_EN_STALKIDS_APPEAR); + this->unk_229 = 0; + this->unk_191 = 0x20; + this->actionFunc = func_80B1C340; +} + +void func_80B1C340(EnPoSisters* this, GlobalContext* globalCtx) { + if (SkelAnime_Update(&this->skelAnime)) { + this->unk_229 = 255; + this->actor.flags |= 1; + this->unk_191 |= (0x10 | 0x8); + if (this->unk_18C == 0) { + func_80B1BE4C(this, globalCtx); + } else { + func_80B1AC40(this); + } + } else { + f32 temp = this->skelAnime.curFrame / this->skelAnime.endFrame; + s32 temp_f16 = 255.0f * temp; + + this->unk_229 = CLAMP(temp_f16, 0, 255); + } +} + +void func_80B1C408(EnPoSisters* this, GlobalContext* globalCtx) { + Vec3f sp3C; + + if (this->collider.base.acFlags & AC_HIT) { + this->collider.base.acFlags &= ~AC_HIT; + func_800BE258(&this->actor, &this->collider.info); + + if (this->unk_18D != 0) { + ((EnPoSisters*)this->actor.parent)->unk_194--; + Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_LAUGH2); + func_80B1BE4C(this, globalCtx); + if (Rand_ZeroOne() < 0.2f) { + sp3C.x = this->actor.world.pos.x; + sp3C.y = this->actor.world.pos.y; + sp3C.z = this->actor.world.pos.z; + Item_DropCollectible(globalCtx, &sp3C, ITEM00_ARROWS_10); + } + } else if (this->collider.base.colType != 9) { + if (this->actor.colChkInfo.damageEffect == 0xF) { + this->actor.world.rot.y = this->actor.shape.rot.y; + this->unk_191 |= 2; + func_80B1B860(this, globalCtx); + } else if ((this->unk_18C == 0) && (this->actor.colChkInfo.damageEffect == 0xE) && + (this->actionFunc == func_80B1C0A4)) { + if (this->unk_194 == 0) { + this->unk_194 = -45; + } + } else { + if (Actor_ApplyDamage(&this->actor)) { + Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_DAMAGE); + } else { + Enemy_StartFinishingBlow(globalCtx, &this->actor); + Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_SISTER_DEAD); + } + + if (this->actor.colChkInfo.damageEffect == 4) { + this->unk_2F0 = 4.0f; + this->unk_2F4 = 0.5f; + Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, + this->collider.info.bumper.hitPos.x, this->collider.info.bumper.hitPos.y, + this->collider.info.bumper.hitPos.z, 0, 0, 0, CLEAR_TAG_LARGE_LIGHT_RAYS); + } + func_80B1B3A8(this); + } + } + } +} + +void EnPoSisters_Update(Actor* thisx, GlobalContext* globalCtx) { + s32 pad; + EnPoSisters* this = THIS; + f32 temp_f2; + Vec3f sp40; + s32 sp3C; + + if (this->collider.base.atFlags & AT_HIT) { + this->collider.base.atFlags &= ~AT_HIT; + func_80B1B280(this); + } + + func_80B1C408(this, globalCtx); + if (this->unk_191 & 0x4) { + func_80B1A9B0(this, globalCtx); + } + + this->actionFunc(this, globalCtx); + + if (this->unk_191 & 0x8) { + func_80B1A894(this, globalCtx); + } + + Actor_SetVelocityAndMoveYRotationAndGravity(&this->actor); + + if (this->unk_191 & 0x10) { + Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 0.0f, 5); + } else { + sp40.x = this->actor.world.pos.x; + sp40.y = this->actor.world.pos.y + 10.0f; + sp40.z = this->actor.world.pos.z; + this->actor.floorHeight = func_800C411C(&globalCtx->colCtx, &this->actor.floorPoly, &sp3C, &this->actor, &sp40); + } + + this->actor.shape.shadowAlpha = this->unk_229; + Actor_SetHeight(&this->actor, 40.0f); + + if (this->unk_2F0 > 0.0f) { + Math_StepToF(&this->unk_2F0, 0.0f, 0.05f); + if (this->unk_229 != 255) { + temp_f2 = this->unk_229 * (1.0f / 255); + if (temp_f2 < this->unk_229) { + this->unk_2F0 = temp_f2; + } + } + + this->unk_2F4 = (this->unk_2F0 + 1.0f) * 0.25f; + this->unk_2F4 = CLAMP_MAX(this->unk_2F4, 0.5f); + } + + if (this->unk_191 & (0x10 | 0x8 | 0x4 | 0x2 | 0x1)) { + Collider_UpdateCylinder(&this->actor, &this->collider); + if ((this->actionFunc == func_80B1B168) || (this->actionFunc == func_80B1B020)) { + this->unk_190++; + this->unk_190 = CLAMP_MAX(this->unk_190, ARRAY_COUNT(this->unk_22C)); + } else if (this->actionFunc != func_80B1BA90) { + this->unk_190 = CLAMP_MIN(this->unk_190 - 1, 1); + } + + if (this->actionFunc == func_80B1B168) { + this->actor.flags |= 0x1000000; + CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + } + + if (this->unk_191 & 0x1) { + CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + } + + if (this->actionFunc != func_80B1BF2C) { + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + } + + if (this->actionFunc == func_80B1B628) { + this->actor.shape.rot.y = BINANG_ROT180(this->actor.world.rot.y); + } else if (this->unk_191 & 0x2) { + this->actor.shape.rot.y = this->actor.world.rot.y; + } + } +} + +void func_80B1C974(EnPoSisters* this) { + if (this->skelAnime.animation == &D_06000114) { + this->unk_226 = CLAMP_MAX(this->unk_226 + 5, 255); + this->unk_227 = CLAMP_MIN(this->unk_227 - 5, 50); + this->unk_228 = CLAMP_MIN(this->unk_228 - 5, 0); + } else if (this->skelAnime.animation == &D_06000A54) { + this->unk_226 = CLAMP_MAX(this->unk_226 + 5, 80); + this->unk_227 = CLAMP_MAX(this->unk_227 + 5, 255); + this->unk_228 = CLAMP_MAX(this->unk_228 + 5, 225); + } else if (this->skelAnime.animation == &D_060008C0) { + if (this->actor.colorFilterTimer & 0x2) { + this->unk_226 = 0; + this->unk_227 = 0; + this->unk_228 = 0; + } else { + this->unk_226 = 80; + this->unk_227 = 255; + this->unk_228 = 225; + } + } else { + this->unk_226 = CLAMP_MAX(this->unk_226 + 5, 255); + this->unk_227 = CLAMP_MAX(this->unk_227 + 5, 255); + + if (this->unk_228 > 210) { + if (this->unk_228 && this->unk_228 && this->unk_228) {} + this->unk_228 = CLAMP_MIN(this->unk_228 - 5, 210); + } else { + this->unk_228 = CLAMP_MAX(this->unk_228 + 5, 210); + } + } +} + +s32 EnPoSisters_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, + Actor* thisx, Gfx** gfx) { + static Gfx* D_80B1DACC[] = { + D_06001DE0, + D_06002F88, + D_06003628, + D_06003DC8, + }; + static Gfx* D_80B1DADC[] = { + D_06001CB0, + D_06002EB8, + D_06003880, + D_06004020, + }; + static Color_RGBA8 D_80B1DAEC[] = { + { 80, 0, 100, 0 }, + { 80, 15, 0, 0 }, + { 0, 70, 50, 0 }, + { 70, 70, 0, 0 }, + }; + EnPoSisters* this = THIS; + + if ((limbIndex == 1) && (this->unk_191 & 0x40)) { + if (this->unk_192 >= 284) { + rot->x += (this->unk_192 - 284) * 0x1000; + } else { + rot->x += (this->unk_192 - 15) * 0x1000; + } + } + + if ((this->unk_229 == 0) || (limbIndex == 8) || ((this->actionFunc == func_80B1BA90) && (this->unk_192 >= 8))) { + *dList = NULL; + } else if (limbIndex == 9) { + *dList = D_80B1DACC[this->unk_18C]; + } else if (limbIndex == 10) { + *dList = D_80B1DADC[this->unk_18C]; + + gDPPipeSync((*gfx)++); + gDPSetEnvColor((*gfx)++, this->unk_226, this->unk_227, this->unk_228, this->unk_229); + } else if (limbIndex == 11) { + Color_RGBA8* colour = &D_80B1DAEC[this->unk_18C]; + + gDPPipeSync((*gfx)++); + gDPSetEnvColor((*gfx)++, colour->r, colour->g, colour->b, this->unk_229); + } + + return false; +} + +void EnPoSisters_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, + Gfx** gfx) { + static Vec3f D_80B1DAFC = { 1000.0f, -1700.0f, 0.0f }; + static s8 D_80B1DB08[] = { + -1, -1, 0, 1, 2, -1, 3, -1, -1, -1, -1, -1, + }; + EnPoSisters* this = THIS; + s32 end; + f32 temp_f2; + + if (D_80B1DB08[limbIndex] != -1) { + Matrix_GetStateTranslation(&this->unk_28C[D_80B1DB08[limbIndex]]); + } else if (limbIndex == 9) { + Matrix_GetStateTranslationAndScaledY(-2500.0f, &this->unk_28C[4]); + Matrix_GetStateTranslationAndScaledY(3000.0f, &this->unk_28C[5]); + } else if (limbIndex == 10) { + Matrix_GetStateTranslationAndScaledY(-4000.0f, &this->unk_28C[6]); + } else if (limbIndex == 11) { + Matrix_GetStateTranslationAndScaledX(3000.0f, &this->unk_28C[7]); + } + + if ((this->actionFunc == func_80B1BA90) && (this->unk_192 >= 8) && (limbIndex == 9)) { + gSPMatrix((*gfx)++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList((*gfx)++, D_060046E0); + } + + if (limbIndex == 8) { + if (this->unk_191 & 0x20) { + for (end = this->unk_190 - 1; end > 0; end--) { + this->unk_22C[end] = this->unk_22C[end - 1]; + } + + Matrix_MultiplyVector3fByState(&D_80B1DAFC, this->unk_22C); + } + + if (this->unk_190 > 0) { + Color_RGBA8* sp38 = &D_80B1DA30[this->unk_18C]; + + temp_f2 = Rand_ZeroFloat(0.3f) + 0.7f; + + if (this->actionFunc == func_80B1BCA0) { + Lights_PointNoGlowSetInfo(&this->lightInfo, this->unk_22C[0].x, this->unk_22C[0].y + 15.0f, + this->unk_22C[0].z, sp38->r * temp_f2, sp38->g * temp_f2, sp38->b * temp_f2, + 200); + } else { + Lights_PointGlowSetInfo(&this->lightInfo, this->unk_22C[0].x, this->unk_22C[0].y + 15.0f, + this->unk_22C[0].z, sp38->r * temp_f2, sp38->g * temp_f2, sp38->b * temp_f2, + 200); + } + } else { + Lights_PointSetColorAndRadius(&this->lightInfo, 0, 0, 0, 0); + } + + if (!(this->unk_191 & 0x80)) { + Matrix_CopyCurrentState(&this->unk_358); + } + } +} + +void EnPoSisters_Draw(Actor* thisx, GlobalContext* globalCtx) { + EnPoSisters* this = THIS; + Color_RGBA8* temp_s1 = &D_80B1DA40[this->unk_18C]; + Color_RGBA8* temp_s7 = &D_80B1DA30[this->unk_18C]; + s32 pad; + s32 i; + s32 phi_s5; + f32 phi_f20; + s32 pad2; + + OPEN_DISPS(globalCtx->state.gfxCtx); + + func_80B1C974(this); + func_8012C28C(globalCtx->state.gfxCtx); + func_8012C2DC(globalCtx->state.gfxCtx); + + if ((this->unk_229 == 255) || (this->unk_229 == 0)) { + gDPSetEnvColor(POLY_OPA_DISP++, this->unk_226, this->unk_227, this->unk_228, this->unk_229); + gSPSegment(POLY_OPA_DISP++, 0x09, D_801AEFA0); + POLY_OPA_DISP = + SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + EnPoSisters_OverrideLimbDraw, EnPoSisters_PostLimbDraw, &this->actor, POLY_OPA_DISP); + } else { + gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 255, this->unk_229); + gSPSegment(POLY_XLU_DISP++, 0x09, D_801AEF88); + POLY_XLU_DISP = + SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + EnPoSisters_OverrideLimbDraw, EnPoSisters_PostLimbDraw, &this->actor, POLY_XLU_DISP); + } + + if (!(this->unk_191 & 0x80)) { + Matrix_SetCurrentState(&this->unk_358); + + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, D_060027B0); + } + + gSPSegment(POLY_XLU_DISP++, 0x08, + Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, (globalCtx->gameplayFrames * -20) % 512, + 32, 128)); + gDPSetEnvColor(POLY_XLU_DISP++, temp_s1->r, temp_s1->g, temp_s1->b, temp_s1->a); + + if (this->actionFunc == func_80B1BCA0) { + phi_s5 = (((-this->unk_192 * 255) + 0x1FE0) / 32) & 0xFF; + phi_f20 = 0.0056000003f; + } else { + phi_s5 = 0; + phi_f20 = this->actor.scale.x * 0.5f; + } + + for (i = 0; i < this->unk_190; i++) { + if (this->actionFunc != func_80B1BCA0) { + phi_s5 = ((-i * 31) + 248) & 0xFF; + } + + gDPPipeSync(POLY_XLU_DISP++); + gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, temp_s7->r, temp_s7->g, temp_s7->b, phi_s5); + + Matrix_InsertTranslation(this->unk_22C[i].x, this->unk_22C[i].y, this->unk_22C[i].z, MTXMODE_NEW); + Matrix_InsertRotation(0, BINANG_ROT180(func_800DFCDC(GET_ACTIVE_CAM(globalCtx))), 0, MTXMODE_APPLY); + + if (this->actionFunc == func_80B1BA90) { + f32 phi_f0; + + phi_f20 = ((this->unk_192 - i) * 0.025f) + 0.5f; + phi_f0 = CLAMP(phi_f20, 0.5f, 0.8f); + phi_f20 = phi_f0 * 0.007f; + } + Matrix_Scale(phi_f20, phi_f20, phi_f20, 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_0407D590); + } + + func_800BE680(globalCtx, &this->actor, this->unk_28C, ARRAY_COUNT(this->unk_28C), + this->actor.scale.x * 142.857131958f * this->unk_2F4, 0.0f, this->unk_2F0, 20); + + CLOSE_DISPS(globalCtx->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.h b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.h index 75ad55a00f..741ebbcce0 100644 --- a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.h +++ b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.h @@ -7,11 +7,37 @@ struct EnPoSisters; typedef void (*EnPoSistersActionFunc)(struct EnPoSisters*, GlobalContext*); +#define ENPOSISTERS_GET_300(thisx) (((thisx)->params >> 8) & 3) +#define ENPOSISTERS_GET_C00(thisx) (((thisx)->params >> 0xA) & 3) +#define ENPOSISTERS_GET_1000(thisx) ((thisx)->params & 0x1000) + typedef struct EnPoSisters { /* 0x0000 */ Actor actor; - /* 0x0144 */ char unk_144[0x44]; + /* 0x0144 */ SkelAnime skelAnime; /* 0x0188 */ EnPoSistersActionFunc actionFunc; - /* 0x018C */ char unk_18C[0x20C]; + /* 0x018C */ u8 unk_18C; + /* 0x018D */ u8 unk_18D; + /* 0x018E */ u8 unk_18E; + /* 0x018F */ u8 unk_18F; + /* 0x0190 */ u8 unk_190; + /* 0x0191 */ u8 unk_191; + /* 0x0192 */ s16 unk_192; + /* 0x0194 */ s16 unk_194; + /* 0x0196 */ Vec3s jointTable[12]; + /* 0x01DE */ Vec3s morphTable[12]; + /* 0x0226 */ u8 unk_226; + /* 0x0227 */ u8 unk_227; + /* 0x0228 */ u8 unk_228; + /* 0x0229 */ u8 unk_229; + /* 0x022C */ Vec3f unk_22C[8]; + /* 0x028C */ Vec3f unk_28C[8]; + /* 0x02EC */ f32 unk_2EC; + /* 0x02F0 */ f32 unk_2F0; + /* 0x02F4 */ f32 unk_2F4; + /* 0x02F8 */ LightNode* lightNode; + /* 0x02FC */ LightInfo lightInfo; + /* 0x030C */ ColliderCylinder collider; + /* 0x0358 */ MtxF unk_358; } EnPoSisters; // size = 0x398 extern const ActorInit En_Po_Sisters_InitVars; diff --git a/tools/actorfixer.py b/tools/actorfixer.py index 20b260d333..24e0d0ad5a 100755 --- a/tools/actorfixer.py +++ b/tools/actorfixer.py @@ -170,6 +170,23 @@ animdict = { "skelanime.prevFrameRot": "skelanime.prevRot", "skelanime.prevFramePos": "skelanime.prevTransl", "skelanime.unk3E": "skelanime.baseTransl", + + "skelAnime.unk03": "skelAnime.taper", + "skelAnime.animCurrentSeg": "skelAnime.animation", + "skelAnime.initialFrame": "skelAnime.startFrame", + "skelAnime.animFrameCount": "skelAnime.endFrame", + "skelAnime.totalFrames": "skelAnime.animLength", + "skelAnime.animCurrentFrame": "skelAnime.curFrame", + "skelAnime.animPlaybackSpeed": "skelAnime.playSpeed", + "skelAnime.limbDrawTbl": "skelAnime.jointTable", + "skelAnime.transitionDrawTbl": "skelAnime.morphTable", + "skelAnime.transCurrentFrame": "skelAnime.morphWeight", + "skelAnime.transitionStep": "skelAnime.morphRate", + "skelAnime.animUpdate": "skelAnime.update", + "skelAnime.flags": "skelAnime.moveFlags", + "skelAnime.prevFrameRot": "skelAnime.prevRot", + "skelAnime.prevFramePos": "skelAnime.prevTransl", + "skelAnime.unk3E": "skelAnime.baseTransl", } def replace_anim(file): diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index be268d88aa..c158bd87f4 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -13201,8 +13201,8 @@ 0x80B1C408:("func_80B1C408",), 0x80B1C61C:("EnPoSisters_Update",), 0x80B1C974:("func_80B1C974",), - 0x80B1CB44:("func_80B1CB44",), - 0x80B1CD34:("func_80B1CD34",), + 0x80B1CB44:("EnPoSisters_OverrideLimbDraw",), + 0x80B1CD34:("EnPoSisters_PostLimbDraw",), 0x80B1D484:("EnPoSisters_Draw",), 0x80B1DEB0:("EnPp_Init",), 0x80B1E234:("EnPp_Destroy",), diff --git a/undefined_syms.txt b/undefined_syms.txt index 392a5a74eb..9636e0534a 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -3186,7 +3186,15 @@ D_06000A54 = 0x06000A54; D_06000D40 = 0x06000D40; D_0600119C = 0x0600119C; D_060014CC = 0x060014CC; +D_06001CB0 = 0x06001CB0; +D_06001DE0 = 0x06001DE0; D_060027B0 = 0x060027B0; +D_06002EB8 = 0x06002EB8; +D_06002F88 = 0x06002F88; +D_06003628 = 0x06003628; +D_06003880 = 0x06003880; +D_06003DC8 = 0x06003DC8; +D_06004020 = 0x06004020; D_060046E0 = 0x060046E0; D_060065C8 = 0x060065C8;