diff --git a/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c b/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c index bbfecc301f..bb1ea7aeec 100644 --- a/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c +++ b/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c @@ -6,6 +6,8 @@ #include "z_bg_po_event.h" +#include "overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.h" + #include "libc64/qrand.h" #include "array_count.h" #include "gfx.h" @@ -353,7 +355,7 @@ void BgPoEvent_BlockIdle(BgPoEvent* this, PlayState* play) { if ((this->type == 0) && (this->index == 0)) { amy = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_PO_SISTERS, this->dyna.actor.world.pos.x + 30.0f, this->dyna.actor.world.pos.y - 30.0f, this->dyna.actor.world.pos.z + 30.0f, 0, - this->dyna.actor.shape.rot.y, 0, this->dyna.actor.params + 0x300); + this->dyna.actor.shape.rot.y, 0, this->dyna.actor.params + EN_PO_SISTERS_PARAM(AMY)); if (amy != NULL) { OnePointCutscene_Init(play, 3170, 30, amy, CAM_ID_MAIN); } @@ -549,7 +551,8 @@ void BgPoEvent_PaintingPresent(BgPoEvent* this, PlayState* play) { } else if (this->collider.base.acFlags & AC_HIT) { if (!BgPoEvent_NextPainting(this)) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_PO_SISTERS, thisx->world.pos.x, thisx->world.pos.y - 40.0f, - thisx->world.pos.z, 0, thisx->shape.rot.y, 0, thisx->params + ((this->type - 1) << 8)); + thisx->world.pos.z, 0, thisx->shape.rot.y, 0, + thisx->params + EN_PO_SISTERS_PARAM_N((this->type - 1))); OnePointCutscene_Init(play, 3160, 80, thisx, CAM_ID_MAIN); Sfx_PlaySfxCentered(NA_SE_SY_CORRECT_CHIME); diff --git a/src/overlays/actors/ovl_Bg_Po_Syokudai/z_bg_po_syokudai.c b/src/overlays/actors/ovl_Bg_Po_Syokudai/z_bg_po_syokudai.c index 0c1ce9924d..c88e575dc4 100644 --- a/src/overlays/actors/ovl_Bg_Po_Syokudai/z_bg_po_syokudai.c +++ b/src/overlays/actors/ovl_Bg_Po_Syokudai/z_bg_po_syokudai.c @@ -6,6 +6,8 @@ #include "z_bg_po_syokudai.h" +#include "overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.h" + #include "libc64/qrand.h" #include "gfx.h" #include "gfx_setupdl.h" @@ -116,7 +118,8 @@ void BgPoSyokudai_Init(Actor* thisx, PlayState* play) { } else if (!Flags_GetSwitch(play, POE_TORCH_FLAG + POE_FLAME_PURPLE) && !Flags_GetSwitch(play, 0x1B)) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_PO_SISTERS, thisx->world.pos.x, thisx->world.pos.y + 52.0f, - thisx->world.pos.z, 0, 0, 0, (this->flameColor << 8) + thisx->params + 0x1000); + thisx->world.pos.z, 0, 0, 0, + EN_PO_SISTERS_PARAM_N(this->flameColor) + thisx->params + EN_PO_SISTERS_INTRO_PARAM); } else if (!Flags_GetSwitch(play, thisx->params)) { if (play->envCtx.lightSettingOverride == LIGHT_SETTING_OVERRIDE_NONE) { 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 299b0df33a..f20f794b8e 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 @@ -35,46 +35,46 @@ void EnPoSisters_Destroy(Actor* thisx, PlayState* play); void EnPoSisters_Update(Actor* thisx, PlayState* play); void EnPoSisters_Draw(Actor* thisx, PlayState* play); -void func_80ADA094(EnPoSisters* this, PlayState* play); -void func_80ADA4A8(EnPoSisters* this, PlayState* play); -void func_80ADA530(EnPoSisters* this, PlayState* play); -void func_80ADA6A0(EnPoSisters* this, PlayState* play); -void func_80ADA7F0(EnPoSisters* this, PlayState* play); -void func_80ADA8C0(EnPoSisters* this, PlayState* play); -void func_80ADA9E8(EnPoSisters* this, PlayState* play); -void func_80ADAAA4(EnPoSisters* this, PlayState* play); -void func_80ADAC70(EnPoSisters* this, PlayState* play); -void func_80ADAD54(EnPoSisters* this, PlayState* play); -void func_80ADAE6C(EnPoSisters* this, PlayState* play); -void func_80ADAFC0(EnPoSisters* this, PlayState* play); -void func_80ADB17C(EnPoSisters* this, PlayState* play); -void func_80ADB2B8(EnPoSisters* this, PlayState* play); -void func_80ADB338(EnPoSisters* this, PlayState* play); -void func_80ADB9F0(EnPoSisters* this, PlayState* play); -void func_80ADB4B0(EnPoSisters* this, PlayState* play); -void func_80ADB51C(EnPoSisters* this, PlayState* play); -void func_80ADB770(EnPoSisters* this, PlayState* play); -void func_80ADBB6C(EnPoSisters* this, PlayState* play); -void func_80ADBBF4(EnPoSisters* this, PlayState* play); -void func_80ADBC88(EnPoSisters* this, PlayState* play); -void func_80ADBD38(EnPoSisters* this, PlayState* play); -void func_80ADBD8C(EnPoSisters* this, PlayState* play); -void func_80ADBEE8(EnPoSisters* this, PlayState* play); -void func_80ADBF58(EnPoSisters* this, PlayState* play); +void EnPoSisters_SetupIntro(EnPoSisters* this, PlayState* play); +void EnPoSisters_FightState3(EnPoSisters* this, PlayState* play); +void EnPoSisters_FightState1(EnPoSisters* this, PlayState* play); +void EnPoSisters_FightState2(EnPoSisters* this, PlayState* play); +void EnPoSisters_FightState4(EnPoSisters* this, PlayState* play); +void EnPoSisters_MegFightStep2(EnPoSisters* this, PlayState* play); +void EnPoSisters_OnATHit(EnPoSisters* this, PlayState* play); +void EnPoSisters_Hit(EnPoSisters* this, PlayState* play); +void EnPoSisters_Hit2(EnPoSisters* this, PlayState* play); +void EnPoSisters_Vanish(EnPoSisters* this, PlayState* play); +void EnPoSisters_Reveal(EnPoSisters* this, PlayState* play); +void EnPoSisters_ReleaseFlame(EnPoSisters* this, PlayState* play); +void EnPoSisters_Die(EnPoSisters* this, PlayState* play); +void EnPoSisters_MegMourns(EnPoSisters* this, PlayState* play); +void EnPoSisters_MegUpdate(EnPoSisters* this, PlayState* play); +void EnPoSisters_SisterAppear(EnPoSisters* this, PlayState* play); +void EnPoSisters_MegIntroStep1(EnPoSisters* this, PlayState* play); +void EnPoSisters_MegIntroStep2(EnPoSisters* this, PlayState* play); +void EnPoSisters_MegFightStep1(EnPoSisters* this, PlayState* play); +void EnPoSisters_JoelleBethMove(EnPoSisters* this, PlayState* play); +void EnPoSisters_JoelleBethWait(EnPoSisters* this, PlayState* play); +void EnPoSisters_IntroStep1(EnPoSisters* this, PlayState* play); +void EnPoSisters_IntroStep2(EnPoSisters* this, PlayState* play); +void EnPoSisters_IntroStep3(EnPoSisters* this, PlayState* play); +void EnPoSisters_IntroStep4(EnPoSisters* this, PlayState* play); +void EnPoSisters_IntroStep5(EnPoSisters* this, PlayState* play); -void func_80AD9AA8(EnPoSisters* this, PlayState* play); -void func_80AD9C24(EnPoSisters* this, PlayState* play); +void EnPoSisters_SetupMeg(EnPoSisters* this, PlayState* play); +void EnPoSisters_SetupDecoy(EnPoSisters* this, PlayState* play); -void func_80AD9D44(EnPoSisters* this); +void EnPoSisters_SetupSister(EnPoSisters* this); -static Color_RGBA8 D_80ADD6F0[4] = { +static Color_RGBA8 sTorchLightColors[4] = { { 255, 170, 255, 255 }, { 255, 200, 0, 255 }, { 0, 170, 255, 255 }, { 170, 255, 0, 255 }, }; -static Color_RGBA8 D_80ADD700[4] = { +static Color_RGBA8 sTorchFlameColors[4] = { { 100, 0, 255, 255 }, { 255, 0, 0, 255 }, { 0, 0, 255, 255 }, @@ -115,84 +115,67 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit sColChkInfoInit = { 10, 25, 60, 40 }; +typedef enum EnPoSisterFlags { + EN_PO_SISTERS_FLAG_ACCOL = 1 << 0, // set AC collision + EN_PO_SISTERS_FLAG_ROTATE = 1 << 1, // set shape.rot.y to world.rot.y + EN_PO_SISTERS_FLAG_VANISH = 1 << 2, // tick vanishTimer, then disappear if 0. + EN_PO_SISTERS_FLAG_HOVER = 1 << 3, // hover up and down a few units towards y-target + EN_PO_SISTERS_FLAG_BGCHECK = 1 << 4, // BGCheck floors and walls + EN_PO_SISTERS_FLAG_UPDATEMASK = (EN_PO_SISTERS_FLAG_ACCOL | EN_PO_SISTERS_FLAG_ROTATE | EN_PO_SISTERS_FLAG_VANISH | + EN_PO_SISTERS_FLAG_HOVER | EN_PO_SISTERS_FLAG_BGCHECK), + EN_PO_SISTERS_FLAG_TORCH = 1 << 5, // manipulate torch flames + EN_PO_SISTERS_FLAG_SPIN = 1 << 6, // the real Meg spins as a tell + EN_PO_SISTERS_FLAG_NOMTXF = 1 << 7, // don't read or write torchMtxF +} EnPoSisterFlags; + +typedef enum PoeSisDamageEffect { + EN_PO_SISTERS_DMG_EFF_OTHER, + EN_PO_SISTERS_DMG_EFF_SWORD = 14, + EN_PO_SISTERS_DMG_EFF_NUT, +} PoeSisDamageEffect; + static DamageTable sDamageTable = { - /* Deku nut */ DMG_ENTRY(0, 0xF), - /* Deku stick */ DMG_ENTRY(2, 0x0), - /* Slingshot */ DMG_ENTRY(1, 0x0), - /* Explosive */ DMG_ENTRY(2, 0x0), - /* Boomerang */ DMG_ENTRY(0, 0x0), - /* Normal arrow */ DMG_ENTRY(2, 0x0), - /* Hammer swing */ DMG_ENTRY(2, 0x0), - /* Hookshot */ DMG_ENTRY(2, 0x0), - /* Kokiri sword */ DMG_ENTRY(1, 0xE), - /* Master sword */ DMG_ENTRY(2, 0xE), - /* Giant's Knife */ DMG_ENTRY(4, 0xE), - /* Fire arrow */ DMG_ENTRY(2, 0x0), - /* Ice arrow */ DMG_ENTRY(2, 0x0), - /* Light arrow */ DMG_ENTRY(2, 0x0), - /* Unk arrow 1 */ DMG_ENTRY(2, 0x0), - /* Unk arrow 2 */ DMG_ENTRY(2, 0x0), - /* Unk arrow 3 */ DMG_ENTRY(2, 0x0), - /* Fire magic */ DMG_ENTRY(0, 0x0), - /* Ice magic */ DMG_ENTRY(0, 0x0), - /* Light magic */ DMG_ENTRY(0, 0x0), - /* Shield */ DMG_ENTRY(0, 0x0), - /* Mirror Ray */ DMG_ENTRY(0, 0x0), - /* Kokiri spin */ DMG_ENTRY(1, 0xE), - /* Giant spin */ DMG_ENTRY(4, 0xE), - /* Master spin */ DMG_ENTRY(2, 0xE), - /* Kokiri jump */ DMG_ENTRY(2, 0xE), - /* Giant jump */ DMG_ENTRY(8, 0xE), - /* Master jump */ DMG_ENTRY(4, 0xE), - /* Unknown 1 */ DMG_ENTRY(0, 0x0), - /* Unblockable */ DMG_ENTRY(0, 0x0), - /* Hammer jump */ DMG_ENTRY(4, 0x0), - /* Unknown 2 */ DMG_ENTRY(0, 0x0), + /* Deku nut */ DMG_ENTRY(0, EN_PO_SISTERS_DMG_EFF_NUT), + /* Deku stick */ DMG_ENTRY(2, EN_PO_SISTERS_DMG_EFF_OTHER), + /* Slingshot */ DMG_ENTRY(1, EN_PO_SISTERS_DMG_EFF_OTHER), + /* Explosive */ DMG_ENTRY(2, EN_PO_SISTERS_DMG_EFF_OTHER), + /* Boomerang */ DMG_ENTRY(0, EN_PO_SISTERS_DMG_EFF_OTHER), + /* Normal arrow */ DMG_ENTRY(2, EN_PO_SISTERS_DMG_EFF_OTHER), + /* Hammer swing */ DMG_ENTRY(2, EN_PO_SISTERS_DMG_EFF_OTHER), + /* Hookshot */ DMG_ENTRY(2, EN_PO_SISTERS_DMG_EFF_OTHER), + /* Kokiri sword */ DMG_ENTRY(1, EN_PO_SISTERS_DMG_EFF_SWORD), + /* Master sword */ DMG_ENTRY(2, EN_PO_SISTERS_DMG_EFF_SWORD), + /* Giant's Knife */ DMG_ENTRY(4, EN_PO_SISTERS_DMG_EFF_SWORD), + /* Fire arrow */ DMG_ENTRY(2, EN_PO_SISTERS_DMG_EFF_OTHER), + /* Ice arrow */ DMG_ENTRY(2, EN_PO_SISTERS_DMG_EFF_OTHER), + /* Light arrow */ DMG_ENTRY(2, EN_PO_SISTERS_DMG_EFF_OTHER), + /* Unk arrow 1 */ DMG_ENTRY(2, EN_PO_SISTERS_DMG_EFF_OTHER), + /* Unk arrow 2 */ DMG_ENTRY(2, EN_PO_SISTERS_DMG_EFF_OTHER), + /* Unk arrow 3 */ DMG_ENTRY(2, EN_PO_SISTERS_DMG_EFF_OTHER), + /* Fire magic */ DMG_ENTRY(0, EN_PO_SISTERS_DMG_EFF_OTHER), + /* Ice magic */ DMG_ENTRY(0, EN_PO_SISTERS_DMG_EFF_OTHER), + /* Light magic */ DMG_ENTRY(0, EN_PO_SISTERS_DMG_EFF_OTHER), + /* Shield */ DMG_ENTRY(0, EN_PO_SISTERS_DMG_EFF_OTHER), + /* Mirror Ray */ DMG_ENTRY(0, EN_PO_SISTERS_DMG_EFF_OTHER), + /* Kokiri spin */ DMG_ENTRY(1, EN_PO_SISTERS_DMG_EFF_SWORD), + /* Giant spin */ DMG_ENTRY(4, EN_PO_SISTERS_DMG_EFF_SWORD), + /* Master spin */ DMG_ENTRY(2, EN_PO_SISTERS_DMG_EFF_SWORD), + /* Kokiri jump */ DMG_ENTRY(2, EN_PO_SISTERS_DMG_EFF_SWORD), + /* Giant jump */ DMG_ENTRY(8, EN_PO_SISTERS_DMG_EFF_SWORD), + /* Master jump */ DMG_ENTRY(4, EN_PO_SISTERS_DMG_EFF_SWORD), + /* Unknown 1 */ DMG_ENTRY(0, EN_PO_SISTERS_DMG_EFF_OTHER), + /* Unblockable */ DMG_ENTRY(0, EN_PO_SISTERS_DMG_EFF_OTHER), + /* Hammer jump */ DMG_ENTRY(4, EN_PO_SISTERS_DMG_EFF_OTHER), + /* Unknown 2 */ DMG_ENTRY(0, EN_PO_SISTERS_DMG_EFF_OTHER), }; -static s32 D_80ADD784 = 0; +static s32 sIntroVar = 0; static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 7, ICHAIN_CONTINUE), ICHAIN_F32(lockOnArrowOffset, 6000, ICHAIN_STOP), }; -static Vec3f sZeroVector = { 0.0f, 0.0f, 0.0f }; - -static s16 D_80ADD79C[4] = { 0xB000, 0xD000, 0x5000, 0x3000 }; - -static Vec3s D_80ADD7A4[4] = { - { -22, 337, -1704 }, - { -431, 879, -3410 }, - { 549, 879, -3410 }, - { 1717, 515, -1340 }, -}; - -static Vec3f D_80ADD7BC = { 120.0f, 250.0f, -1420.0f }; - -static Gfx* D_80ADD7C8[4] = { - gPoeSistersMegBodyDL, - gPoeSistersJoelleBodyDL, - gPoeSistersBethBodyDL, - gPoeSistersAmyBodyDL, -}; - -static Gfx* D_80ADD7D8[4] = { - gPoeSistersMegFaceDL, - gPoeSistersJoelleFaceDL, - gPoeSistersBethFaceDL, - gPoSistersAmyFaceDL, -}; - -static Color_RGBA8 D_80ADD7E8[4] = { - { 80, 0, 100, 0 }, - { 80, 15, 0, 0 }, - { 0, 70, 50, 0 }, - { 70, 70, 0, 0 }, -}; - -static Vec3f D_80ADD7F8 = { 1000.0f, -1700.0f, 0.0f }; - void EnPoSisters_Init(Actor* thisx, PlayState* play) { EnPoSisters* this = (EnPoSisters*)thisx; s32 pad; @@ -201,41 +184,41 @@ void EnPoSisters_Init(Actor* thisx, PlayState* play) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 50.0f); SkelAnime_Init(play, &this->skelAnime, &gPoeSistersSkel, &gPoeSistersSwayAnim, this->jointTable, this->morphTable, 12); - this->unk_22E.r = 255; - this->unk_22E.g = 255; - this->unk_22E.b = 210; - this->unk_22E.a = 255; + this->color.r = 255; + this->color.g = 255; + this->color.b = 210; + this->color.a = 255; this->lightNode = LightContext_InsertLight(play, &play->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_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); - this->unk_194 = PARAMS_GET_U(thisx->params, 8, 2); - this->actor.naviEnemyId = this->unk_194 + NAVI_ENEMY_POE_SISTER_MEG; + this->sisterID = POE_SISTER_GET_ID(thisx); + this->actor.naviEnemyId = this->sisterID + NAVI_ENEMY_POE_SISTER_MEG; if (1) {} - this->unk_195 = PARAMS_GET_U(thisx->params, 10, 2); - this->unk_196 = 32; - this->unk_197 = 20; - this->unk_198 = 1; - this->unk_199 = 32; - this->unk_294 = 110.0f; + this->decoyID = POE_SISTER_GET_DECOY(thisx); + this->hoverPulse = 32; + this->vanishTimer = 20; + this->torchFlames = 1; + this->flags = EN_PO_SISTERS_FLAG_TORCH; + this->circleDist = 110.0f; this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; - if (PARAMS_GET_NOSHIFT(this->actor.params, 12, 1)) { - func_80ADA094(this, play); - } else if (this->unk_194 == 0) { - if (this->unk_195 == 0) { + if (POE_SISTER_GET_INTRO(this)) { + EnPoSisters_SetupIntro(this, play); + } else if (this->sisterID == EN_PO_SISTERS_MEG) { + if (this->decoyID == 0) { this->collider.base.ocFlags1 = OC1_ON | OC1_TYPE_PLAYER; - func_80AD9AA8(this, play); + EnPoSisters_SetupMeg(this, play); } else { this->actor.flags &= ~(ACTOR_FLAG_HOOKSHOT_PULLS_ACTOR | ACTOR_FLAG_CAN_ATTACH_TO_ARROW); this->collider.elem.elemMaterial = ELEM_MATERIAL_UNK4; this->collider.elem.acDmgInfo.dmgFlags |= DMG_DEKU_NUT; this->collider.base.ocFlags1 = OC1_NONE; - func_80AD9C24(this, NULL); + EnPoSisters_SetupDecoy(this, NULL); } } else { - func_80AD9D44(this); + EnPoSisters_SetupSister(this); } this->actor.params &= 0x3F; } @@ -244,179 +227,183 @@ void EnPoSisters_Destroy(Actor* thisx, PlayState* play) { EnPoSisters* this = (EnPoSisters*)thisx; LightContext_RemoveLight(play, &play->lightCtx, this->lightNode); - if (this->unk_194 == 0 && this->unk_195 == 0) { + if (this->sisterID == EN_PO_SISTERS_MEG && this->decoyID == 0) { func_800F5B58(); } Collider_DestroyCylinder(play, &this->collider); } -void func_80AD9240(EnPoSisters* this, s32 arg1, Vec3f* arg2) { - f32 temp_f20 = SQ(arg1) * 0.1f; +void EnPoSisters_MoveTorchFlames(EnPoSisters* this, s32 height, Vec3f* pos) { + f32 spread = SQ(height) * 0.1f; Vec3f* vec; s32 i; - for (i = 0; i < this->unk_198; i++) { - vec = &this->unk_234[i]; - vec->x = arg2->x + Math_SinS((s16)(this->actor.shape.rot.y + (this->unk_19A * 0x800) + i * 0x2000)) * temp_f20; - vec->z = arg2->z + Math_CosS((s16)(this->actor.shape.rot.y + (this->unk_19A * 0x800) + i * 0x2000)) * temp_f20; - vec->y = arg2->y + arg1; + for (i = 0; i < this->torchFlames; i++) { + vec = &this->torchPos[i]; + vec->x = pos->x + Math_SinS((s16)(this->actor.shape.rot.y + (this->timer * 0x800) + i * 0x2000)) * spread; + vec->z = pos->z + Math_CosS((s16)(this->actor.shape.rot.y + (this->timer * 0x800) + i * 0x2000)) * spread; + vec->y = pos->y + height; } } -void func_80AD9368(EnPoSisters* this) { +void EnPoSisters_FightSetup3(EnPoSisters* this) { Animation_MorphToLoop(&this->skelAnime, &gPoeSistersSwayAnim, -3.0f); - this->unk_19A = Rand_S16Offset(2, 3); - this->actionFunc = func_80ADA4A8; + this->timer = Rand_S16Offset(2, 3); + this->actionFunc = EnPoSisters_FightState3; this->actor.speed = 0.0f; } -void func_80AD93C4(EnPoSisters* this) { - if (this->actionFunc != func_80ADA6A0) { +void EnPoSisters_SetupFight(EnPoSisters* this) { + if (this->actionFunc != EnPoSisters_FightState2) { Animation_MorphToLoop(&this->skelAnime, &gPoeSistersFloatAnim, -3.0f); } - this->unk_19A = Rand_S16Offset(0xF, 3); - this->unk_199 |= 7; - this->actionFunc = func_80ADA530; + this->timer = Rand_S16Offset(15, 3); + this->flags |= EN_PO_SISTERS_FLAG_VANISH | EN_PO_SISTERS_FLAG_ROTATE | EN_PO_SISTERS_FLAG_ACCOL; + this->actionFunc = EnPoSisters_FightState1; } -void func_80AD943C(EnPoSisters* this) { - this->actionFunc = func_80ADA6A0; +void EnPoSisters_SetupFight2(EnPoSisters* this) { + this->actionFunc = EnPoSisters_FightState2; } -void func_80AD944C(EnPoSisters* this) { - if (this->unk_22E.a != 0) { +void EnPoSisters_SetupFight4(EnPoSisters* this) { + if (this->color.a != 0) { this->collider.base.colMaterial = COL_MATERIAL_METAL; this->collider.base.acFlags |= AC_HARD; } Animation_MorphToLoop(&this->skelAnime, &gPoeSistersAttackAnim, -5.0f); this->actor.speed = 0.0f; - this->unk_19A = Animation_GetLastFrame(&gPoeSistersAttackAnim) * 3 + 3; - this->unk_199 &= ~2; - this->actionFunc = func_80ADA7F0; + this->timer = Animation_GetLastFrame(&gPoeSistersAttackAnim) * 3 + 3; + this->flags &= ~EN_PO_SISTERS_FLAG_ROTATE; + this->actionFunc = EnPoSisters_FightState4; } -void func_80AD94E0(EnPoSisters* this) { +void EnPoSisters_MegFightSetup2(EnPoSisters* this) { this->actor.speed = 5.0f; - if (this->unk_194 == 0) { + if (this->sisterID == EN_PO_SISTERS_MEG) { this->collider.base.colMaterial = COL_MATERIAL_METAL; this->collider.base.acFlags |= AC_HARD; Animation_MorphToLoop(&this->skelAnime, &gPoeSistersAttackAnim, -5.0f); } - this->unk_19A = 5; + this->timer = 5; this->actor.world.rot.y = this->actor.yawTowardsPlayer; - this->unk_199 |= 8; - this->actionFunc = func_80ADA8C0; + this->flags |= EN_PO_SISTERS_FLAG_HOVER; + this->actionFunc = EnPoSisters_MegFightStep2; } -void func_80AD9568(EnPoSisters* this) { +void EnPoSisters_SetupOnATHit(EnPoSisters* this) { Animation_MorphToLoop(&this->skelAnime, &gPoeSistersFloatAnim, -3.0f); this->actor.world.rot.y = this->actor.yawTowardsPlayer + 0x8000; - if (this->unk_194 != 0) { + if (this->sisterID != EN_PO_SISTERS_MEG) { this->collider.base.colMaterial = COL_MATERIAL_HIT3; this->collider.base.acFlags &= ~AC_HARD; } - this->actionFunc = func_80ADA9E8; + this->actionFunc = EnPoSisters_OnATHit; } -void func_80AD95D8(EnPoSisters* this) { +void EnPoSisters_SetupHit(EnPoSisters* this) { Animation_MorphToPlayOnce(&this->skelAnime, &gPoeSistersDamagedAnim, -3.0f); if (this->collider.base.ac != NULL) { this->actor.world.rot.y = (this->collider.elem.acHitElem->atDmgInfo.dmgFlags & (DMG_ARROW | DMG_SLINGSHOT)) ? this->collider.base.ac->world.rot.y : Actor_WorldYawTowardActor(&this->actor, this->collider.base.ac) + 0x8000; } - if (this->unk_194 != 0) { + if (this->sisterID != EN_PO_SISTERS_MEG) { this->actor.speed = 10.0f; } - this->unk_199 &= ~0xB; + this->flags &= ~(EN_PO_SISTERS_FLAG_HOVER | EN_PO_SISTERS_FLAG_ROTATE | EN_PO_SISTERS_FLAG_ACCOL); Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 16); - this->actionFunc = func_80ADAAA4; + this->actionFunc = EnPoSisters_Hit; } -void func_80AD96A4(EnPoSisters* this) { +void EnPoSisters_SetupHit2(EnPoSisters* this) { Animation_MorphToLoop(&this->skelAnime, &gPoeSistersFleeAnim, -3.0f); this->actor.world.rot.y = this->actor.shape.rot.y + 0x8000; - this->unk_19A = 5; - this->unk_199 |= 0xB; + this->timer = 5; + this->flags |= EN_PO_SISTERS_FLAG_HOVER | EN_PO_SISTERS_FLAG_ROTATE | EN_PO_SISTERS_FLAG_ACCOL; this->actor.speed = 5.0f; - this->actionFunc = func_80ADAC70; + this->actionFunc = EnPoSisters_Hit2; } -void func_80AD9718(EnPoSisters* this) { +void EnPoSisters_SetupVanish(EnPoSisters* this) { Animation_Change(&this->skelAnime, &gPoeSistersAppearDisappearAnim, 1.5f, 0.0f, Animation_GetLastFrame(&gPoeSistersAppearDisappearAnim), ANIMMODE_ONCE, -3.0f); this->actor.speed = 0.0f; - this->unk_19C = 100; + this->sisterVar = 100; this->actor.world.rot.y = this->actor.shape.rot.y; - this->unk_199 &= ~5; + this->flags &= ~(EN_PO_SISTERS_FLAG_VANISH | EN_PO_SISTERS_FLAG_ACCOL); Actor_PlaySfx(&this->actor, NA_SE_EN_PO_DISAPPEAR); Actor_PlaySfx(&this->actor, NA_SE_EN_PO_LAUGH2); - this->actionFunc = func_80ADAD54; + this->actionFunc = EnPoSisters_Vanish; } -void func_80AD97C8(EnPoSisters* this, PlayState* play) { +void EnPoSisters_CircleUpdate(EnPoSisters* this, PlayState* play) { Player* player = GET_PLAYER(play); - f32 sp20; + f32 dist; - if (this->unk_195 == 0 || this->actionFunc != func_80ADAAA4) { + if (this->decoyID == 0 || this->actionFunc != EnPoSisters_Hit) { if ((player->meleeWeaponState == 0 || player->meleeWeaponAnimation >= PLAYER_MWA_SPIN_ATTACK_1H) && player->actor.world.pos.y - player->actor.floorHeight < 1.0f) { - Math_StepToF(&this->unk_294, 110.0f, 3.0f); + Math_StepToF(&this->circleDist, 110.0f, 3.0f); } else { - Math_StepToF(&this->unk_294, 170.0f, 10.0f); + Math_StepToF(&this->circleDist, 170.0f, 10.0f); } - sp20 = this->unk_294; - } else if (this->unk_195 != 0) { - sp20 = this->actor.parent->xzDistToPlayer; + dist = this->circleDist; + } else if (this->decoyID != 0) { + dist = this->actor.parent->xzDistToPlayer; } - this->actor.world.pos.x = (Math_SinS(this->actor.shape.rot.y + 0x8000) * sp20) + player->actor.world.pos.x; - this->actor.world.pos.z = (Math_CosS(this->actor.shape.rot.y + 0x8000) * sp20) + player->actor.world.pos.z; + this->actor.world.pos.x = (Math_SinS(this->actor.shape.rot.y + 0x8000) * dist) + player->actor.world.pos.x; + this->actor.world.pos.z = (Math_CosS(this->actor.shape.rot.y + 0x8000) * dist) + player->actor.world.pos.z; } -void func_80AD98F4(EnPoSisters* this, PlayState* play) { +void EnPoSisters_SetupReveal(EnPoSisters* this, PlayState* play) { Animation_Change(&this->skelAnime, &gPoeSistersAppearDisappearAnim, 1.5f, 0.0f, Animation_GetLastFrame(&gPoeSistersAppearDisappearAnim), ANIMMODE_ONCE, -3.0f); - if (this->unk_194 == 0) { - this->unk_294 = 110.0f; - func_80AD97C8(this, play); - this->unk_22E.a = 0; + if (this->sisterID == EN_PO_SISTERS_MEG) { + this->circleDist = 110.0f; + EnPoSisters_CircleUpdate(this, play); + this->color.a = 0; this->actor.draw = EnPoSisters_Draw; } else { this->actor.world.rot.y = this->actor.shape.rot.y; } - this->unk_19A = 15; + this->timer = 15; this->actor.speed = 0.0f; Actor_PlaySfx(&this->actor, NA_SE_EN_PO_APPEAR); - this->unk_199 &= ~1; - this->actionFunc = func_80ADAE6C; + this->flags &= ~EN_PO_SISTERS_FLAG_ACCOL; + this->actionFunc = EnPoSisters_Reveal; } -void func_80AD99D4(EnPoSisters* this, PlayState* play) { - this->unk_19A = 0; +void EnPoSisters_SetupDie(EnPoSisters* this, PlayState* play) { + this->timer = 0; this->actor.speed = 0.0f; this->actor.world.pos.y += 42.0f; this->actor.shape.yOffset = -6000.0f; this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; - this->unk_199 = 0; - this->actionFunc = func_80ADAFC0; + this->flags = 0; + this->actionFunc = EnPoSisters_ReleaseFlame; OnePointCutscene_Init(play, 3190, 999, &this->actor, CAM_ID_MAIN); } -void func_80AD9A54(EnPoSisters* this, PlayState* play) { - this->unk_19A = 0; - this->actor.world.pos.y = this->unk_234[0].y; +void EnPoSisters_ItemDrop(EnPoSisters* this, PlayState* play) { + this->timer = 0; + this->actor.world.pos.y = this->torchPos[0].y; Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x80); - this->actionFunc = func_80ADB17C; + this->actionFunc = EnPoSisters_Die; } -// Meg spawning fakes -void func_80AD9AA8(EnPoSisters* this, PlayState* play) { - Actor* actor1 = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_PO_SISTERS, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0x400); - Actor* actor2 = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_PO_SISTERS, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0x800); - Actor* actor3 = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_PO_SISTERS, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0xC00); +/* Meg will spawn 3 decoys and begin weeping. + (or destroy the decoys and herself if one decoy fails.) */ +void EnPoSisters_SetupMeg(EnPoSisters* this, PlayState* play) { + Actor* actor1 = + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_PO_SISTERS, this->actor.world.pos.x, this->actor.world.pos.y, + this->actor.world.pos.z, 0, 0, 0, EN_PO_SISTERS_DECOY_PARAM(1)); + Actor* actor2 = + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_PO_SISTERS, this->actor.world.pos.x, this->actor.world.pos.y, + this->actor.world.pos.z, 0, 0, 0, EN_PO_SISTERS_DECOY_PARAM(2)); + Actor* actor3 = + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_PO_SISTERS, this->actor.world.pos.x, this->actor.world.pos.y, + this->actor.world.pos.z, 0, 0, 0, EN_PO_SISTERS_DECOY_PARAM(3)); s32 pad; s32 pad1; @@ -436,19 +423,20 @@ void func_80AD9AA8(EnPoSisters* this, PlayState* play) { actor2->parent = &this->actor; actor1->parent = &this->actor; Animation_PlayLoop(&this->skelAnime, &gPoeSistersMegCryAnim); - this->unk_198 = 0; - this->unk_199 = 160; - this->actionFunc = func_80ADB2B8; + this->torchFlames = 0; + this->flags = EN_PO_SISTERS_FLAG_NOMTXF | EN_PO_SISTERS_FLAG_TORCH; + this->actionFunc = EnPoSisters_MegMourns; } } -void func_80AD9C24(EnPoSisters* this, PlayState* play) { +void EnPoSisters_SetupDecoy(EnPoSisters* this, PlayState* play) { + static Vec3f sZeroVector = { 0.0f, 0.0f, 0.0f }; Vec3f vec; this->actor.draw = NULL; this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; - this->unk_19C = 100; - this->unk_199 = 32; + this->sisterVar = 100; + this->flags = EN_PO_SISTERS_FLAG_TORCH; this->collider.base.colMaterial = COL_MATERIAL_HIT3; this->collider.base.acFlags &= ~AC_HARD; if (play != NULL) { @@ -459,156 +447,164 @@ void func_80AD9C24(EnPoSisters* this, PlayState* play) { 0); } Lights_PointSetColorAndRadius(&this->lightInfo, 0, 0, 0, 0); - this->actionFunc = func_80ADB338; + this->actionFunc = EnPoSisters_MegUpdate; } -void func_80AD9D44(EnPoSisters* this) { - if (this->unk_194 == 3) { +void EnPoSisters_SetupSister(EnPoSisters* this) { + if (this->sisterID == EN_PO_SISTERS_AMY) { Animation_PlayOnce(&this->skelAnime, &gPoeSistersAppearDisappearAnim); Actor_PlaySfx(&this->actor, NA_SE_EN_PO_APPEAR); } else { Animation_Change(&this->skelAnime, &gPoeSistersAppearDisappearAnim, 0.5f, 0.0f, Animation_GetLastFrame(&gPoeSistersAppearDisappearAnim), ANIMMODE_ONCE_INTERP, 0.0f); } - this->unk_22E.a = 0; - this->unk_199 = 32; - this->actionFunc = func_80ADB9F0; + this->color.a = 0; + this->flags = EN_PO_SISTERS_FLAG_TORCH; + this->actionFunc = EnPoSisters_SisterAppear; } -void func_80AD9DF0(EnPoSisters* this, PlayState* play) { +void EnPoSisters_MegSetupIntro(EnPoSisters* this, PlayState* play) { Animation_MorphToPlayOnce(&this->skelAnime, &gPoeSistersAppearDisappearAnim, -5.0f); - this->unk_198 = 1; - this->unk_199 &= ~0x80; - this->actionFunc = func_80ADB4B0; + this->torchFlames = 1; + this->flags &= ~EN_PO_SISTERS_FLAG_NOMTXF; + this->actionFunc = EnPoSisters_MegIntroStep1; OnePointCutscene_Init(play, 3180, 156, &this->actor, CAM_ID_MAIN); } -void func_80AD9E60(EnPoSisters* this) { +void EnPoSisters_SetupMegDecoy(EnPoSisters* this) { Animation_MorphToLoop(&this->skelAnime, &gPoeSistersFloatAnim, -3.0f); - this->unk_19A = Animation_GetLastFrame(&gPoeSistersFloatAnim) * 7 + 7; + this->timer = Animation_GetLastFrame(&gPoeSistersFloatAnim) * 7 + 7; if (this->actor.parent != NULL) { this->actor.world.pos = this->actor.parent->world.pos; this->actor.shape.rot.y = this->actor.parent->shape.rot.y; } else { this->actor.shape.rot.y = this->actor.yawTowardsPlayer; - this->unk_19A++; + this->timer++; } - if (this->unk_195 == 0) { + if (this->decoyID == 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_PO_LAUGH2); } - this->actionFunc = func_80ADB51C; + this->actionFunc = EnPoSisters_MegIntroStep2; } -void func_80AD9F1C(EnPoSisters* this) { +void EnPoSisters_SetupMegFight(EnPoSisters* this) { Animation_MorphToLoop(&this->skelAnime, &gPoeSistersFloatAnim, -3.0f); - this->unk_22E.a = 255; - this->unk_19A = 300; - this->unk_19C = 3; - this->unk_199 |= 9; + this->color.a = 255; + this->timer = 300; + this->sisterVar = 3; + this->flags |= EN_PO_SISTERS_FLAG_HOVER | EN_PO_SISTERS_FLAG_ACCOL; this->actor.flags |= ACTOR_FLAG_ATTENTION_ENABLED; - this->actionFunc = func_80ADB770; + this->actionFunc = EnPoSisters_MegFightStep1; } -void func_80AD9F90(EnPoSisters* this) { - if (this->unk_194 == 1) { +void EnPoSisters_JoelleBethInit(EnPoSisters* this) { + if (this->sisterID == EN_PO_SISTERS_JOELLE) { + // Joelle's target pos when revealed this->actor.home.pos.x = -632.0f; this->actor.home.pos.z = -3440.0f; - } else { + } else { // Beth's target pos when revealed this->actor.home.pos.x = 752.0f; this->actor.home.pos.z = -3440.0f; } Animation_PlayLoop(&this->skelAnime, &gPoeSistersFloatAnim); - this->unk_199 |= 0xA; - this->actionFunc = func_80ADBB6C; + this->flags |= EN_PO_SISTERS_FLAG_HOVER | EN_PO_SISTERS_FLAG_ROTATE; + this->actionFunc = EnPoSisters_JoelleBethMove; this->actor.speed = 5.0f; } -void func_80ADA028(EnPoSisters* this) { +void EnPoSister_JoelleBethSetupWait(EnPoSisters* this) { Animation_MorphToLoop(&this->skelAnime, &gPoeSistersSwayAnim, -3.0f); - this->unk_22E.a = 255; - this->unk_199 |= 0x15; + this->color.a = 255; + this->flags |= EN_PO_SISTERS_FLAG_BGCHECK | EN_PO_SISTERS_FLAG_VANISH | EN_PO_SISTERS_FLAG_ACCOL; this->actor.flags |= ACTOR_FLAG_ATTENTION_ENABLED; - this->actionFunc = func_80ADBBF4; + this->actionFunc = EnPoSisters_JoelleBethWait; this->actor.speed = 0.0f; } -void func_80ADA094(EnPoSisters* this, PlayState* play) { - D_80ADD784 = 0; - this->unk_22E.a = 0; - this->unk_199 = 128; - this->unk_19A = 50; - this->unk_234[0] = this->actor.home.pos; +void EnPoSisters_SetupIntro(EnPoSisters* this, PlayState* play) { + sIntroVar = 0; + this->color.a = 0; + this->flags = EN_PO_SISTERS_FLAG_NOMTXF; + this->timer = 50; + this->torchPos[0] = this->actor.home.pos; Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_PROP); - this->actionFunc = func_80ADBC88; + this->actionFunc = EnPoSisters_IntroStep1; } -void func_80ADA10C(EnPoSisters* this) { +void EnPoSisters_SetupIntro2(EnPoSisters* this) { s32 i; - this->unk_198 = ARRAY_COUNT(this->unk_234); - for (i = 0; i < ARRAY_COUNT(this->unk_234); i++) { - this->unk_234[i] = this->unk_234[0]; + this->torchFlames = ARRAY_COUNT(this->torchPos); + for (i = 0; i < ARRAY_COUNT(this->torchPos); i++) { + this->torchPos[i] = this->torchPos[0]; } - this->actionFunc = func_80ADBD38; + this->actionFunc = EnPoSisters_IntroStep2; } -void func_80ADA1B8(EnPoSisters* this) { +/* Setup reveal of Pos Sisters in intro scene */ +void EnPoSisters_SetupIntro3(EnPoSisters* this) { Animation_Change(&this->skelAnime, &gPoeSistersAppearDisappearAnim, 0.833f, 0.0f, Animation_GetLastFrame(&gPoeSistersAppearDisappearAnim), ANIMMODE_ONCE_INTERP, 0.0f); - if (this->unk_194 == 0 || this->unk_194 == 1) { - this->unk_19A = 40; + if (this->sisterID == EN_PO_SISTERS_MEG || this->sisterID == EN_PO_SISTERS_JOELLE) { + this->timer = 40; // Meg and Joelle appear first } else { - this->unk_19A = 76; + this->timer = 76; // followed by Beth and Amy } - this->unk_198 = 0; - D_80ADD784 = 0; - this->actionFunc = func_80ADBD8C; + this->torchFlames = 0; + sIntroVar = 0; + this->actionFunc = EnPoSisters_IntroStep3; } -void func_80ADA25C(EnPoSisters* this) { +void EnPoSisters_SetupIntro4(EnPoSisters* this) { Animation_PlayLoop(&this->skelAnime, &gPoeSistersSwayAnim); - this->unk_198 = 8; - this->unk_19A = 32; - func_80AD9240(this, this->unk_19A, &this->actor.home.pos); - this->actionFunc = func_80ADBEE8; + this->torchFlames = 8; + this->timer = 32; + EnPoSisters_MoveTorchFlames(this, this->timer, &this->actor.home.pos); + this->actionFunc = EnPoSisters_IntroStep4; } -void func_80ADA2BC(EnPoSisters* this, PlayState* play) { +void EnPoSisters_SetupIntro5(EnPoSisters* this, PlayState* play) { + // y-rotations when leaving foyer at end of intro scene + static s16 sIntroExitFacings[4] = { 0xB000, 0xD000, 0x5000, 0x3000 }; + Animation_MorphToLoop(&this->skelAnime, &gPoeSistersFloatAnim, -3.0f); - this->unk_198 = 0; - this->unk_199 = 40; - this->unk_19A = 90; - this->unk_196 = 32; - this->actor.world.rot.y = D_80ADD79C[this->unk_194]; + this->torchFlames = 0; + this->flags = EN_PO_SISTERS_FLAG_HOVER | EN_PO_SISTERS_FLAG_TORCH; + this->timer = 90; + this->hoverPulse = 32; + this->actor.world.rot.y = sIntroExitFacings[this->sisterID]; this->actor.home.pos.y = this->actor.world.pos.y; - if (this->unk_194 == 0) { + if (this->sisterID == EN_PO_SISTERS_MEG) { Flags_SetSwitch(play, 0x1B); } Actor_PlaySfx(&this->actor, NA_SE_EV_FLAME_IGNITION); - this->actionFunc = func_80ADBF58; + this->actionFunc = EnPoSisters_IntroStep5; } -void func_80ADA35C(EnPoSisters* this, PlayState* play) { +void EnPoSisters_Hover(EnPoSisters* this, PlayState* play) { f32 targetY; Player* player = GET_PLAYER(play); - if (this->actionFunc == func_80ADBF58) { + if (this->actionFunc == EnPoSisters_IntroStep5) { targetY = this->actor.home.pos.y; - } else if (this->unk_194 == 0 || this->unk_194 == 3) { + } else if (this->sisterID == EN_PO_SISTERS_MEG || this->sisterID == EN_PO_SISTERS_AMY) { targetY = player->actor.world.pos.y + 5.0f; } else { + // Beth and Joelle are hard-coded to the worldspace-y + // at the botttom of their rooms' staircase targetY = 832.0f; } Math_ApproachF(&this->actor.world.pos.y, targetY, 0.5f, 3.0f); - if (!this->unk_196) { - this->unk_196 = 32; + if (!this->hoverPulse) { + this->hoverPulse = 32; } - if (this->unk_196 != 0) { - this->unk_196--; + if (this->hoverPulse != 0) { + this->hoverPulse--; } - this->actor.world.pos.y += (2.0f + 0.5f * Rand_ZeroOne()) * Math_SinS(this->unk_196 * 0x800); - if (this->unk_22E.a == 255 && this->actionFunc != func_80ADA8C0 && this->actionFunc != func_80ADA7F0) { - if (this->actionFunc == func_80ADAC70) { + this->actor.world.pos.y += (2.0f + 0.5f * Rand_ZeroOne()) * Math_SinS(this->hoverPulse * 0x800); + if (this->color.a == 255 && this->actionFunc != EnPoSisters_MegFightStep2 && + this->actionFunc != EnPoSisters_FightState4) { + if (this->actionFunc == EnPoSisters_Hit2) { Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_PO_AWAY - SFX_FLAG); } else { Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_PO_FLY - SFX_FLAG); @@ -616,87 +612,87 @@ void func_80ADA35C(EnPoSisters* this, PlayState* play) { } } -void func_80ADA4A8(EnPoSisters* this, PlayState* play) { +void EnPoSisters_FightState3(EnPoSisters* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (Animation_OnFrame(&this->skelAnime, 0.0f) && this->unk_19A != 0) { - this->unk_19A--; + if (Animation_OnFrame(&this->skelAnime, 0.0f) && this->timer != 0) { + this->timer--; } - if (this->unk_19A == 0 || this->actor.xzDistToPlayer < 200.0f) { - func_80AD93C4(this); + if (this->timer == 0 || this->actor.xzDistToPlayer < 200.0f) { + EnPoSisters_SetupFight(this); } } -void func_80ADA530(EnPoSisters* this, PlayState* play) { +void EnPoSisters_FightState1(EnPoSisters* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_StepToF(&this->actor.speed, 1.0f, 0.2f); - if (Animation_OnFrame(&this->skelAnime, 0.0f) && this->unk_19A != 0) { - this->unk_19A--; + if (Animation_OnFrame(&this->skelAnime, 0.0f) && this->timer != 0) { + this->timer--; } if (this->actor.xzDistToPlayer < 200.0f && fabsf(this->actor.yDistToPlayer + 5.0f) < 30.0f) { - func_80AD943C(this); - } else if (this->unk_19A == 0 && Math_StepToF(&this->actor.speed, 0.0f, 0.2f) != 0) { - func_80AD9368(this); + EnPoSisters_SetupFight2(this); + } else if (this->timer == 0 && Math_StepToF(&this->actor.speed, 0.0f, 0.2f) != 0) { + EnPoSisters_FightSetup3(this); } if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { Math_ScaledStepToS(&this->actor.world.rot.y, Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos), - 0x71C); + 1820); } else if (Actor_WorldDistXZToPoint(&this->actor, &this->actor.home.pos) > 300.0f) { Math_ScaledStepToS(&this->actor.world.rot.y, Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos), - 0x71C); + 1820); } } -void func_80ADA6A0(EnPoSisters* this, PlayState* play) { +void EnPoSisters_FightState2(EnPoSisters* this, PlayState* play) { Player* player = GET_PLAYER(play); - s16 temp_v0; + s16 yawDiff; SkelAnime_Update(&this->skelAnime); - temp_v0 = this->actor.yawTowardsPlayer - player->actor.shape.rot.y; + yawDiff = this->actor.yawTowardsPlayer - player->actor.shape.rot.y; Math_StepToF(&this->actor.speed, 2.0f, 0.2f); - if (temp_v0 > 0x3000) { - Math_ScaledStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer + 0x3000, 0x71C); - } else if (temp_v0 < -0x3000) { - Math_ScaledStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer - 0x3000, 0x71C); + if (yawDiff > 0x3000) { + Math_ScaledStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer + 0x3000, 1820); + } else if (yawDiff < -0x3000) { + Math_ScaledStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer - 0x3000, 1820); } else { - Math_ScaledStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 0x71C); + Math_ScaledStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 1820); } if (this->actor.xzDistToPlayer < 160.0f && fabsf(this->actor.yDistToPlayer + 5.0f) < 30.0f) { - func_80AD944C(this); + EnPoSisters_SetupFight4(this); } else if (this->actor.xzDistToPlayer > 240.0f) { - func_80AD93C4(this); + EnPoSisters_SetupFight(this); } } -void func_80ADA7F0(EnPoSisters* this, PlayState* play) { +void EnPoSisters_FightState4(EnPoSisters* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (this->unk_19A != 0) { - this->unk_19A--; + if (this->timer != 0) { + this->timer--; } - this->actor.shape.rot.y += 384.0f * ((this->skelAnime.endFrame + 1.0f) * 3.0f - this->unk_19A); - if (this->unk_19A == 18 || this->unk_19A == 7) { + this->actor.shape.rot.y += 384.0f * ((this->skelAnime.endFrame + 1.0f) * 3.0f - this->timer); + if (this->timer == 18 || this->timer == 7) { Actor_PlaySfx(&this->actor, NA_SE_EN_PO_ROLL); } - if (this->unk_19A == 0) { - func_80AD94E0(this); + if (this->timer == 0) { + EnPoSisters_MegFightSetup2(this); } } -void func_80ADA8C0(EnPoSisters* this, PlayState* play) { +void EnPoSisters_MegFightStep2(EnPoSisters* this, PlayState* play) { s32 pad; SkelAnime_Update(&this->skelAnime); - if (Animation_OnFrame(&this->skelAnime, 0.0f) && this->unk_19A != 0) { - this->unk_19A--; + if (Animation_OnFrame(&this->skelAnime, 0.0f) && this->timer != 0) { + this->timer--; } this->actor.shape.rot.y += (384.0f * this->skelAnime.endFrame) * 3.0f; - if (this->unk_19A == 0 && ABS((s16)(this->actor.shape.rot.y - this->actor.world.rot.y)) < 0x1000) { - if (this->unk_194 != 0) { + if (this->timer == 0 && ABS((s16)(this->actor.shape.rot.y - this->actor.world.rot.y)) < 0x1000) { + if (this->sisterID != EN_PO_SISTERS_MEG) { this->collider.base.colMaterial = COL_MATERIAL_HIT3; this->collider.base.acFlags &= ~AC_HARD; - func_80AD93C4(this); + EnPoSisters_SetupFight(this); } else { Actor_PlaySfx(&this->actor, NA_SE_EN_PO_LAUGH2); - func_80AD9C24(this, play); + EnPoSisters_SetupDecoy(this, play); } } if (Animation_OnFrame(&this->skelAnime, 1.0f)) { @@ -704,157 +700,168 @@ void func_80ADA8C0(EnPoSisters* this, PlayState* play) { } } -void func_80ADA9E8(EnPoSisters* this, PlayState* play) { +void EnPoSisters_OnATHit(EnPoSisters* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); this->actor.shape.rot.y -= (this->actor.speed * 10.0f) * 128.0f; if (Math_StepToF(&this->actor.speed, 0.0f, 0.1f) != 0) { this->actor.world.rot.y = this->actor.shape.rot.y; - if (this->unk_194 != 0) { - func_80AD93C4(this); + if (this->sisterID != EN_PO_SISTERS_MEG) { + EnPoSisters_SetupFight(this); } else { Actor_PlaySfx(&this->actor, NA_SE_EN_PO_LAUGH2); - func_80AD9C24(this, play); + EnPoSisters_SetupDecoy(this, play); } } } -void func_80ADAAA4(EnPoSisters* this, PlayState* play) { +void EnPoSisters_Hit(EnPoSisters* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime) && !(this->actor.flags & ACTOR_FLAG_ATTACHED_TO_ARROW)) { if (this->actor.colChkInfo.health != 0) { - if (this->unk_194 != 0) { - func_80AD96A4(this); - } else if (this->unk_195 != 0) { - func_80AD9C24(this, NULL); + if (this->sisterID != EN_PO_SISTERS_MEG) { + EnPoSisters_SetupHit2(this); + } else if (this->decoyID != 0) { + EnPoSisters_SetupDecoy(this, NULL); } else { - func_80AD9C24(this, play); + EnPoSisters_SetupDecoy(this, play); } } else { - func_80AD99D4(this, play); + EnPoSisters_SetupDie(this, play); } } - if (this->unk_195 != 0) { + if (this->decoyID != 0) { Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.parent->shape.rot.y, - (this->unk_195 == 2) ? 0x800 : 0x400); - this->unk_22E.a = ((this->skelAnime.endFrame - this->skelAnime.curFrame) * 255.0f) / this->skelAnime.endFrame; + (this->decoyID == 2) ? 0x800 : 0x400); + this->color.a = ((this->skelAnime.endFrame - this->skelAnime.curFrame) * 255.0f) / this->skelAnime.endFrame; this->actor.world.pos.y = this->actor.parent->world.pos.y; - func_80AD97C8(this, play); - } else if (this->unk_194 != 0) { + EnPoSisters_CircleUpdate(this, play); + } else if (this->sisterID != EN_PO_SISTERS_MEG) { Math_StepToF(&this->actor.speed, 0.0f, 0.5f); } } -void func_80ADAC70(EnPoSisters* this, PlayState* play) { +void EnPoSisters_Hit2(EnPoSisters* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_ScaledStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer + 0x8000, 1820); - if (Animation_OnFrame(&this->skelAnime, 0.0f) && this->unk_19A != 0) { - this->unk_19A--; + if (Animation_OnFrame(&this->skelAnime, 0.0f) && this->timer != 0) { + this->timer--; } if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->actor.world.rot.y = this->actor.shape.rot.y; - this->unk_199 |= 2; - func_80AD9718(this); - } else if (this->unk_19A == 0 && 240.0f < this->actor.xzDistToPlayer) { + this->flags |= EN_PO_SISTERS_FLAG_ROTATE; + EnPoSisters_SetupVanish(this); + } else if (this->timer == 0 && 240.0f < this->actor.xzDistToPlayer) { this->actor.world.rot.y = this->actor.shape.rot.y; - func_80AD93C4(this); + EnPoSisters_SetupFight(this); } } -void func_80ADAD54(EnPoSisters* this, PlayState* play) { +void EnPoSisters_Vanish(EnPoSisters* this, PlayState* play) { s32 endFrame; if (SkelAnime_Update(&this->skelAnime)) { - this->unk_22E.a = 0; + this->color.a = 0; this->collider.elem.acDmgInfo.dmgFlags = DMG_MAGIC_ICE | DMG_MAGIC_FIRE | DMG_DEKU_NUT; - func_80AD93C4(this); + EnPoSisters_SetupFight(this); } else { endFrame = this->skelAnime.endFrame; - this->unk_22E.a = ((endFrame - this->skelAnime.curFrame) * 255.0f) / endFrame; + this->color.a = ((endFrame - this->skelAnime.curFrame) * 255.0f) / endFrame; } } -void func_80ADAE6C(EnPoSisters* this, PlayState* play) { +void EnPoSisters_Reveal(EnPoSisters* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { - this->unk_22E.a = 255; - if (this->unk_194 != 0) { - this->unk_199 |= 1; + this->color.a = 255; + if (this->sisterID != EN_PO_SISTERS_MEG) { + this->flags |= EN_PO_SISTERS_FLAG_ACCOL; this->collider.elem.acDmgInfo.dmgFlags = (DMG_SWORD | DMG_ARROW | DMG_HAMMER | DMG_MAGIC_ICE | DMG_MAGIC_FIRE | DMG_HOOKSHOT | DMG_EXPLOSIVE | DMG_DEKU_STICK); - if (this->unk_19A != 0) { - this->unk_19A--; + if (this->timer != 0) { + this->timer--; } - if (this->unk_19A == 0) { - this->unk_197 = 20; - func_80AD93C4(this); + if (this->timer == 0) { + this->vanishTimer = 20; + EnPoSisters_SetupFight(this); } } else { - func_80AD9F1C(this); + EnPoSisters_SetupMegFight(this); } } else { - this->unk_22E.a = (this->skelAnime.curFrame * 255.0f) / this->skelAnime.endFrame; - if (this->unk_194 == 0) { - func_80AD97C8(this, play); + this->color.a = (this->skelAnime.curFrame * 255.0f) / this->skelAnime.endFrame; + if (this->sisterID == EN_PO_SISTERS_MEG) { + EnPoSisters_CircleUpdate(this, play); } } } -void func_80ADAFC0(EnPoSisters* this, PlayState* play) { +/* animate the torch flame after dealing the killing blow */ +void EnPoSisters_ReleaseFlame(EnPoSisters* this, PlayState* play) { s32 i; - this->unk_19A++; - this->unk_198 = CLAMP_MAX(this->unk_198 + 1, 8); - for (i = this->unk_198 - 1; i > 0; i--) { - this->unk_234[i] = this->unk_234[i - 1]; + this->timer++; + this->torchFlames = CLAMP_MAX(this->torchFlames + 1, 8); + for (i = this->torchFlames - 1; i > 0; i--) { + this->torchPos[i] = this->torchPos[i - 1]; } - this->unk_234[0].x = - (Math_SinS((this->actor.shape.rot.y + this->unk_19A * 0x3000) - 0x4000) * (3000.0f * this->actor.scale.x)) + + this->torchPos[0].x = + (Math_SinS((this->actor.shape.rot.y + this->timer * 0x3000) - 0x4000) * (3000.0f * this->actor.scale.x)) + this->actor.world.pos.x; - this->unk_234[0].z = - (Math_CosS((this->actor.shape.rot.y + this->unk_19A * 0x3000) - 0x4000) * (3000.0f * this->actor.scale.x)) + + this->torchPos[0].z = + (Math_CosS((this->actor.shape.rot.y + this->timer * 0x3000) - 0x4000) * (3000.0f * this->actor.scale.x)) + this->actor.world.pos.z; - if (this->unk_19A < 8) { - this->unk_234[0].y = this->unk_234[1].y - 9.0f; + if (this->timer < 8) { + this->torchPos[0].y = this->torchPos[1].y - 9.0f; } else { - this->unk_234[0].y = this->unk_234[1].y + 2.0f; - if (this->unk_19A >= 16) { + this->torchPos[0].y = this->torchPos[1].y + 2.0f; + if (this->timer >= 16) { if (Math_StepToF(&this->actor.scale.x, 0.0f, 0.001f) != 0) { - func_80AD9A54(this, play); + EnPoSisters_ItemDrop(this, play); } this->actor.scale.z = this->actor.scale.x; this->actor.scale.y = this->actor.scale.x; } } - if (this->unk_19A == 16) { + if (this->timer == 16) { Actor_PlaySfx(&this->actor, NA_SE_EN_PO_DEAD2); } } -void func_80ADB17C(EnPoSisters* this, PlayState* play) { - this->unk_19A++; - if (this->unk_19A == 64) { +/* Show the flame moving back to the proper torch */ +void EnPoSisters_Die(EnPoSisters* this, PlayState* play) { + // positions for torches to be lit during death cutscene + static Vec3s sDeathTorchPos[4] = { + { -22, 337, -1704 }, + { -431, 879, -3410 }, + { 549, 879, -3410 }, + { 1717, 515, -1340 }, + }; + + this->timer++; + if (this->timer == 64) { Flags_SetSwitch(play, this->actor.params); SfxSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 30, NA_SE_EV_FLAME_IGNITION); - if (this->unk_194 == 0) { + if (this->sisterID == EN_PO_SISTERS_MEG) { Flags_UnsetSwitch(play, 0x1B); } play->envCtx.lightSettingOverride = LIGHT_SETTING_OVERRIDE_NONE; Sfx_PlaySfxCentered(NA_SE_SY_CORRECT_CHIME); Actor_Kill(&this->actor); - } else if (this->unk_19A < 32) { - func_80AD9240(this, this->unk_19A, &this->actor.world.pos); + } else if (this->timer < 32) { + EnPoSisters_MoveTorchFlames(this, this->timer, &this->actor.world.pos); } else { - func_80AD9240(this, 64 - this->unk_19A, &this->actor.world.pos); + EnPoSisters_MoveTorchFlames(this, 64 - this->timer, &this->actor.world.pos); } - if (this->unk_19A == 32) { - this->actor.world.pos.x = D_80ADD7A4[this->unk_194].x; - this->actor.world.pos.y = D_80ADD7A4[this->unk_194].y; - this->actor.world.pos.z = D_80ADD7A4[this->unk_194].z; + if (this->timer == 32) { + this->actor.world.pos.x = sDeathTorchPos[this->sisterID].x; + this->actor.world.pos.y = sDeathTorchPos[this->sisterID].y; + this->actor.world.pos.z = sDeathTorchPos[this->sisterID].z; } } -void func_80ADB2B8(EnPoSisters* this, PlayState* play) { +/* Meg weeps as she is the last remaining sister until Link aproaches */ +void EnPoSisters_MegMourns(EnPoSisters* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->actor.xzDistToPlayer < 130.0f) { - func_80AD9DF0(this, play); + EnPoSisters_MegSetupIntro(this, play); } if (Animation_OnFrame(&this->skelAnime, 0.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EN_PO_CRY); @@ -862,322 +869,334 @@ void func_80ADB2B8(EnPoSisters* this, PlayState* play) { this->actor.shape.rot.y = this->actor.yawTowardsPlayer; } -void func_80ADB338(EnPoSisters* this, PlayState* play) { +/* Upate func for Meg and her decoys */ +void EnPoSisters_MegUpdate(EnPoSisters* this, PlayState* play) { Player* player = GET_PLAYER(play); EnPoSisters* realMeg = (EnPoSisters*)this->actor.parent; - if (this->unk_195 == 0) { + if (this->decoyID == 0) { if (Actor_WorldDistXZToPoint(&player->actor, &this->actor.home.pos) < 600.0f) { - if (this->unk_19C != 0) { - this->unk_19C--; + if (this->sisterVar != 0) { + this->sisterVar--; } } else { - this->unk_19C = 100; + this->sisterVar = 100; } - if (this->unk_19C == 0) { + if (this->sisterVar == 0) { this->actor.shape.rot.y = (s32)(4.0f * Rand_ZeroOne()) * 0x4000 + this->actor.yawTowardsPlayer; this->actor.world.pos.y = player->actor.world.pos.y + 5.0f; - func_80AD98F4(this, play); + EnPoSisters_SetupReveal(this, play); } } else { - if (realMeg->actionFunc == func_80ADB51C) { + if (realMeg->actionFunc == EnPoSisters_MegIntroStep2) { this->actor.draw = EnPoSisters_Draw; - func_80AD9E60(this); - } else if (realMeg->actionFunc == func_80ADAE6C) { - this->actor.shape.rot.y = this->actor.parent->shape.rot.y + this->unk_195 * 0x4000; + EnPoSisters_SetupMegDecoy(this); + } else if (realMeg->actionFunc == EnPoSisters_Reveal) { + this->actor.shape.rot.y = this->actor.parent->shape.rot.y + this->decoyID * 0x4000; this->actor.world.pos.y = player->actor.world.pos.y + 5.0f; - func_80AD98F4(this, play); - } else if (realMeg->actionFunc == func_80ADAFC0) { - Actor_Kill(&this->actor); + EnPoSisters_SetupReveal(this, play); + } else if (realMeg->actionFunc == EnPoSisters_ReleaseFlame) { + Actor_Kill(&this->actor); // destroy the decoys once Meg's defeated } } } -void func_80ADB4B0(EnPoSisters* this, PlayState* play) { +void EnPoSisters_MegIntroStep1(EnPoSisters* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { - func_80AD9E60(this); + EnPoSisters_SetupMegDecoy(this); } - func_80AD97C8(this, play); + EnPoSisters_CircleUpdate(this, play); this->actor.world.pos.y += 1.0f; Actor_SetFocus(&this->actor, 40.0f); } -void func_80ADB51C(EnPoSisters* this, PlayState* play) { +/* Meg reveals and moves decoys back and forth */ +void EnPoSisters_MegIntroStep2(EnPoSisters* this, PlayState* play) { f32 temp_f2; - s16 phi_v0; - s16 phi_a2; - u8 temp; + s16 sign; + s16 step; + u8 ID; SkelAnime_Update(&this->skelAnime); temp_f2 = this->skelAnime.endFrame * 0.5f; - this->unk_22E.a = (fabsf(temp_f2 - this->skelAnime.curFrame) * 255.0f) / temp_f2; - if (this->unk_19A != 0) { - this->unk_19A -= 1; + this->color.a = (fabsf(temp_f2 - this->skelAnime.curFrame) * 255.0f) / temp_f2; + if (this->timer != 0) { + this->timer -= 1; } - if (this->unk_19A == 0) { + if (this->timer == 0) { this->actor.world.rot.y = this->actor.shape.rot.y += 0x4000 * (s32)(Rand_ZeroOne() * 4.0f); - if (this->unk_195 == 0) { + if (this->decoyID == 0) { func_800F5ACC(NA_BGM_MINI_BOSS); } - func_80AD9F1C(this); + EnPoSisters_SetupMegFight(this); } else { this->actor.world.pos.y += 0.1f; - temp = this->unk_195; - if (temp != 0) { - if (this->unk_19A > 90) { - phi_v0 = 1; - phi_a2 = 64; - } else if (this->unk_19A > 70) { - phi_v0 = 0; - phi_a2 = 64; - } else if (this->unk_19A > 55) { - phi_v0 = 1; - phi_a2 = 96; - } else if (this->unk_19A > 40) { - phi_v0 = 0; - phi_a2 = 96; + ID = this->decoyID; + if (ID != 0) { + if (this->timer > 90) { + sign = 1; + step = 64; + } else if (this->timer > 70) { + sign = 0; + step = 64; + } else if (this->timer > 55) { + sign = 1; + step = 96; + } else if (this->timer > 40) { + sign = 0; + step = 96; } else { - phi_v0 = 1; - phi_a2 = 256; + sign = 1; + step = 256; } - if (this->unk_195 == 2) { - phi_a2 *= 2; + if (this->decoyID == 2) { + step *= 2; // second decoy shows up further to her right, first on Link's left } Math_ScaledStepToS(&this->actor.shape.rot.y, - this->actor.parent->shape.rot.y + (this->unk_195 * 0x4000) * phi_v0, phi_a2); - } else if (this->unk_19A == 70 || this->unk_19A == 40) { + this->actor.parent->shape.rot.y + (this->decoyID * 0x4000) * sign, step); + } else if (this->timer == 70 || this->timer == 40) { Actor_PlaySfx(&this->actor, NA_SE_EN_PO_LAUGH2); } } - func_80AD97C8(this, play); + EnPoSisters_CircleUpdate(this, play); Actor_SetFocus(&this->actor, 40.0f); } -void func_80ADB770(EnPoSisters* this, PlayState* play) { +void EnPoSisters_MegFightStep1(EnPoSisters* this, PlayState* play) { s32 temp_v0; s32 phi_a0; - if (this->unk_19A != 0) { - this->unk_19A--; + if (this->timer != 0) { + this->timer--; } - if (this->unk_19C > 0) { - if (this->unk_19A >= 16) { + if (this->sisterVar > 0) { + if (this->timer >= 16) { SkelAnime_Update(&this->skelAnime); - if (this->unk_195 == 0) { - if (ABS((s16)(16 - this->unk_196)) < 14) { + if (this->decoyID == 0) { + if (ABS((s16)(16 - this->hoverPulse)) < 14) { this->actor.shape.rot.y += - (0x580 - (this->unk_19C * 0x180)) * fabsf(Math_SinS(this->unk_196 * 0x800)); + (0x580 - (this->sisterVar * 0x180)) * fabsf(Math_SinS(this->hoverPulse * 0x800)); } - if (this->unk_19A >= 284 || this->unk_19A < 31) { - this->unk_199 |= 0x40; + if (this->timer >= 284 || this->timer < 31) { + this->flags |= EN_PO_SISTERS_FLAG_SPIN; } else { - this->unk_199 &= ~0x40; + this->flags &= ~EN_PO_SISTERS_FLAG_SPIN; } } else { - this->actor.shape.rot.y = (s16)(this->actor.parent->shape.rot.y + (this->unk_195 * 0x4000)); + this->actor.shape.rot.y = (s16)(this->actor.parent->shape.rot.y + (this->decoyID * 0x4000)); } } } - if (this->unk_195 == 0) { - if (this->unk_19A >= 284 || (this->unk_19A < 31 && this->unk_19A >= 16)) { - this->unk_199 |= 0x40; + if (this->decoyID == 0) { + if (this->timer >= 284 || (this->timer < 31 && this->timer >= 16)) { + this->flags |= EN_PO_SISTERS_FLAG_SPIN; } else { - this->unk_199 &= ~0x40; + this->flags &= ~EN_PO_SISTERS_FLAG_SPIN; } } if (Actor_WorldDistXZToPoint(&GET_PLAYER(play)->actor, &this->actor.home.pos) > 600.0f) { - this->unk_199 &= ~0x40; - func_80AD9C24(this, play); - } else if (this->unk_19A == 0) { - if (this->unk_195 == 0) { - func_80AD94E0(this); + this->flags &= ~EN_PO_SISTERS_FLAG_SPIN; + EnPoSisters_SetupDecoy(this, play); + } else if (this->timer == 0) { + if (this->decoyID == 0) { + EnPoSisters_MegFightSetup2(this); } else { - func_80AD9C24(this, play); + EnPoSisters_SetupDecoy(this, play); } - } else if (this->unk_195 != 0) { + } else if (this->decoyID != 0) { EnPoSisters* realMeg = (EnPoSisters*)this->actor.parent; - if (realMeg->actionFunc == func_80ADAAA4) { - func_80AD95D8(this); + if (realMeg->actionFunc == EnPoSisters_Hit) { + EnPoSisters_SetupHit(this); } - } else if (this->unk_19C == 0) { - this->unk_19C = -15; - } else if (this->unk_19C < 0) { - this->unk_19C++; - if (this->unk_19C == 0) { - func_80AD94E0(this); + } else if (this->sisterVar == 0) { + this->sisterVar = -15; + } else if (this->sisterVar < 0) { + this->sisterVar++; + if (this->sisterVar == 0) { + EnPoSisters_MegFightSetup2(this); } } - func_80AD97C8(this, play); + EnPoSisters_CircleUpdate(this, play); } -void func_80ADB9F0(EnPoSisters* this, PlayState* play) { +/* Setup Beth, Joelle and Amy revealing themselves from their hiding spots. + also establishes origins for them to move towards and prepare to fight. */ +void EnPoSisters_SisterAppear(EnPoSisters* this, PlayState* play) { f32 div; if (SkelAnime_Update(&this->skelAnime)) { - this->unk_22E.a = 255; - if (this->unk_194 == 3) { + this->color.a = 255; + if (this->sisterID == EN_PO_SISTERS_AMY) { this->actor.flags |= ACTOR_FLAG_ATTENTION_ENABLED; this->actor.home.pos.x = 1992.0f; this->actor.home.pos.z = -1440.0f; - this->unk_199 |= 0x18; - func_80AD93C4(this); + this->flags |= EN_PO_SISTERS_FLAG_HOVER | EN_PO_SISTERS_FLAG_BGCHECK; + EnPoSisters_SetupFight(this); } else { - func_80AD9F90(this); + EnPoSisters_JoelleBethInit(this); } } else { div = this->skelAnime.curFrame / this->skelAnime.endFrame; - this->unk_22E.a = 255.0f * div; + this->color.a = 255.0f * div; } - if (this->unk_194 != 3 && Animation_OnFrame(&this->skelAnime, 1.0f)) { + if (this->sisterID != EN_PO_SISTERS_AMY && Animation_OnFrame(&this->skelAnime, 1.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EN_PO_APPEAR); } Actor_SetFocus(&this->actor, 40.0f); } -void func_80ADBB6C(EnPoSisters* this, PlayState* play) { +/* Joelle and Beth move to thier respective worldspace marks once revealed */ +void EnPoSisters_JoelleBethMove(EnPoSisters* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Actor_WorldDistXZToPoint(&this->actor, &this->actor.home.pos) < 10.0f) { - func_80ADA028(this); + EnPoSister_JoelleBethSetupWait(this); } else { Math_ScaledStepToS(&this->actor.world.rot.y, Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos), 1820); } } -void func_80ADBBF4(EnPoSisters* this, PlayState* play) { +/* Joelle and Beth wait at the bottom of the stairs for Link. */ +void EnPoSisters_JoelleBethWait(EnPoSisters* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_ScaledStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 1820); if (this->actor.xzDistToPlayer < 240.0f && fabsf(this->actor.yDistToPlayer + 5.0f) < 30.0f) { - func_80AD93C4(this); + EnPoSisters_SetupFight(this); } } -void func_80ADBC88(EnPoSisters* this, PlayState* play) { - if (D_80ADD784 != 0 || !Player_InCsMode(play)) { - if (this->unk_19A != 0) { - this->unk_19A--; +void EnPoSisters_IntroStep1(EnPoSisters* this, PlayState* play) { + if (sIntroVar != 0 || !Player_InCsMode(play)) { + if (this->timer != 0) { + this->timer--; } - if (this->unk_19A == 30) { - if (this->unk_194 == 0) { + if (this->timer == 30) { + if (this->sisterID == EN_PO_SISTERS_MEG) { OnePointCutscene_Init(play, 3140, 999, NULL, CAM_ID_MAIN); } - D_80ADD784 = 1; + sIntroVar = 1; } - if (this->unk_19A == 0) { - func_80ADA10C(this); + if (this->timer == 0) { + EnPoSisters_SetupIntro2(this); } } Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_TORCH - SFX_FLAG); } -void func_80ADBD38(EnPoSisters* this, PlayState* play) { - this->unk_19A++; - func_80AD9240(this, this->unk_19A, &this->actor.home.pos); - if (this->unk_19A == 32) { - func_80ADA1B8(this); +void EnPoSisters_IntroStep2(EnPoSisters* this, PlayState* play) { + this->timer++; + EnPoSisters_MoveTorchFlames(this, this->timer, &this->actor.home.pos); + if (this->timer == 32) { + EnPoSisters_SetupIntro3(this); } } -void func_80ADBD8C(EnPoSisters* this, PlayState* play) { - this->unk_19A--; - if (this->unk_19A == 0) { +void EnPoSisters_IntroStep3(EnPoSisters* this, PlayState* play) { + this->timer--; + if (this->timer == 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_PO_APPEAR); - this->unk_199 &= ~0x80; + this->flags &= ~EN_PO_SISTERS_FLAG_NOMTXF; } - if (this->unk_19A <= 0) { + if (this->timer <= 0) { if (SkelAnime_Update(&this->skelAnime)) { - this->unk_22E.a = 255; - D_80ADD784 |= (1 << this->unk_194); + this->color.a = 255; + sIntroVar |= (1 << this->sisterID); } else { - this->unk_22E.a = (this->skelAnime.curFrame * 255.0f) / this->skelAnime.endFrame; + this->color.a = (this->skelAnime.curFrame * 255.0f) / this->skelAnime.endFrame; } } - if (D_80ADD784 == 15) { - func_80ADA25C(this); + if (sIntroVar == 15) { + EnPoSisters_SetupIntro4(this); } } -void func_80ADBEE8(EnPoSisters* this, PlayState* play) { +void EnPoSisters_IntroStep4(EnPoSisters* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (this->unk_19A != 0) { - this->unk_19A--; + if (this->timer != 0) { + this->timer--; } - func_80AD9240(this, this->unk_19A, &this->actor.home.pos); - if (this->unk_19A == 0) { - func_80ADA2BC(this, play); + EnPoSisters_MoveTorchFlames(this, this->timer, &this->actor.home.pos); + if (this->timer == 0) { + EnPoSisters_SetupIntro5(this, play); } } -void func_80ADBF58(EnPoSisters* this, PlayState* play) { +void EnPoSisters_IntroStep5(EnPoSisters* this, PlayState* play) { + // position of laugh at the end of sisters' intro animation + static Vec3f sIntroLaughPos = { 120.0f, 250.0f, -1420.0f }; + SkelAnime_Update(&this->skelAnime); - this->unk_19A--; + this->timer--; Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.world.rot.y, 0x500); - if (this->unk_19A == 0 && this->unk_194 == 0) { + if (this->timer == 0 && this->sisterID == EN_PO_SISTERS_MEG) { play->envCtx.lightSettingOverride = 4; } - if (this->unk_19A < 0) { + if (this->timer < 0) { Math_StepToF(&this->actor.speed, 5.0f, 0.2f); } - if (this->unk_19A == -70 && this->unk_194 == 1) { - SfxSource_PlaySfxAtFixedWorldPos(play, &D_80ADD7BC, 40, NA_SE_EN_PO_LAUGH); + if (this->timer == -70 && this->sisterID == EN_PO_SISTERS_JOELLE) { + SfxSource_PlaySfxAtFixedWorldPos(play, &sIntroLaughPos, 40, NA_SE_EN_PO_LAUGH); } - if (this->unk_19A < -120) { + if (this->timer < -120) { Actor_Kill(&this->actor); } } -void func_80ADC034(EnPoSisters* this, PlayState* play) { - if (this->actor.isLockedOn && this->unk_22E.a == 255) { - if (this->unk_197 != 0) { - this->unk_197--; +void EnPoSisters_TickVanish(EnPoSisters* this, PlayState* play) { + if (this->actor.isLockedOn && this->color.a == 255) { + if (this->vanishTimer != 0) { + this->vanishTimer--; } } else { - this->unk_197 = 20; + this->vanishTimer = 20; } - if (this->unk_22E.a == 0) { - if (this->unk_19C != 0) { - this->unk_19C--; + if (this->color.a == 0) { + if (this->sisterVar != 0) { + this->sisterVar--; } } - if (this->actionFunc != func_80ADA7F0 && this->actionFunc != func_80ADA8C0 && this->actionFunc != func_80ADAAA4) { - if (this->unk_197 == 0) { - func_80AD9718(this); - } else if (this->unk_19C == 0 && this->unk_22E.a == 0) { - func_80AD98F4(this, play); + if (this->actionFunc != EnPoSisters_FightState4 && this->actionFunc != EnPoSisters_MegFightStep2 && + this->actionFunc != EnPoSisters_Hit) { + if (this->vanishTimer == 0) { + EnPoSisters_SetupVanish(this); + } else if (this->sisterVar == 0 && this->color.a == 0) { + EnPoSisters_SetupReveal(this, play); } } } -void func_80ADC10C(EnPoSisters* this, PlayState* play) { - Vec3f sp24; +void EnPoSisters_CheckDamage(EnPoSisters* this, PlayState* play) { + Vec3f itemPos; if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; Actor_SetDropFlag(&this->actor, &this->collider.elem, true); - if (this->unk_195 != 0) { - ((EnPoSisters*)this->actor.parent)->unk_19C--; + if (this->decoyID != 0) { + ((EnPoSisters*)this->actor.parent)->sisterVar--; Actor_PlaySfx(&this->actor, NA_SE_EN_PO_LAUGH2); - func_80AD9C24(this, play); + EnPoSisters_SetupDecoy(this, play); if (Rand_ZeroOne() < 0.2f) { - sp24.x = this->actor.world.pos.x; - sp24.y = this->actor.world.pos.y; - sp24.z = this->actor.world.pos.z; - Item_DropCollectible(play, &sp24, ITEM00_ARROWS_SMALL); + itemPos.x = this->actor.world.pos.x; + itemPos.y = this->actor.world.pos.y; + itemPos.z = this->actor.world.pos.z; + Item_DropCollectible(play, &itemPos, ITEM00_ARROWS_SMALL); } } else if (this->collider.base.colMaterial == COL_MATERIAL_METAL || - (this->actor.colChkInfo.damageReaction == 0 && this->actor.colChkInfo.damage == 0)) { - if (this->unk_194 == 0) { + (this->actor.colChkInfo.damageReaction == EN_PO_SISTERS_DMG_EFF_OTHER && + this->actor.colChkInfo.damage == 0)) { + if (this->sisterID == EN_PO_SISTERS_MEG) { this->actor.freezeTimer = 0; } - } else if (this->actor.colChkInfo.damageReaction == 0xF) { + } else if (this->actor.colChkInfo.damageReaction == EN_PO_SISTERS_DMG_EFF_NUT) { this->actor.world.rot.y = this->actor.shape.rot.y; - this->unk_199 |= 2; - func_80AD98F4(this, play); - } else if (this->unk_194 == 0 && this->actor.colChkInfo.damageReaction == 0xE && - this->actionFunc == func_80ADB770) { - if (this->unk_19C == 0) { - this->unk_19C = -45; + this->flags |= EN_PO_SISTERS_FLAG_ROTATE; + EnPoSisters_SetupReveal(this, play); + } else if (this->sisterID == EN_PO_SISTERS_MEG && + this->actor.colChkInfo.damageReaction == EN_PO_SISTERS_DMG_EFF_SWORD && + this->actionFunc == EnPoSisters_MegFightStep1) { + if (this->sisterVar == 0) { + this->sisterVar = -45; } } else { if (Actor_ApplyDamage(&this->actor) != 0) { @@ -1186,7 +1205,7 @@ void func_80ADC10C(EnPoSisters* this, PlayState* play) { Enemy_StartFinishingBlow(play, &this->actor); Actor_PlaySfx(&this->actor, NA_SE_EN_PO_SISTER_DEAD); } - func_80AD95D8(this); + EnPoSisters_SetupHit(this); } } } @@ -1198,20 +1217,20 @@ void EnPoSisters_Update(Actor* thisx, PlayState* play) { if (this->collider.base.atFlags & AT_HIT) { this->collider.base.atFlags &= ~AT_HIT; - func_80AD9568(this); + EnPoSisters_SetupOnATHit(this); } - func_80ADC10C(this, play); - if (this->unk_199 & 4) { - func_80ADC034(this, play); + EnPoSisters_CheckDamage(this, play); + if (this->flags & EN_PO_SISTERS_FLAG_VANISH) { + EnPoSisters_TickVanish(this, play); } this->actionFunc(this, play); - if (this->unk_199 & 0x1F) { - if (this->unk_199 & 8) { - func_80ADA35C(this, play); + if (this->flags & EN_PO_SISTERS_FLAG_UPDATEMASK) { + if (this->flags & EN_PO_SISTERS_FLAG_HOVER) { + EnPoSisters_Hover(this, play); } Actor_MoveXZGravity(&this->actor); - if (this->unk_199 & 0x10) { + if (this->flags & EN_PO_SISTERS_FLAG_BGCHECK) { Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); } else { @@ -1226,133 +1245,157 @@ void EnPoSisters_Update(Actor* thisx, PlayState* play) { } Collider_UpdateCylinder(&this->actor, &this->collider); - if (this->actionFunc == func_80ADA8C0 || this->actionFunc == func_80ADA7F0) { - this->unk_198++; - this->unk_198 = CLAMP_MAX(this->unk_198, 8); - } else if (this->actionFunc != func_80ADAFC0) { - temp = this->unk_198 - 1; - this->unk_198 = CLAMP_MIN(temp, 1); + if (this->actionFunc == EnPoSisters_MegFightStep2 || this->actionFunc == EnPoSisters_FightState4) { + this->torchFlames++; + this->torchFlames = CLAMP_MAX(this->torchFlames, 8); + } else if (this->actionFunc != EnPoSisters_ReleaseFlame) { + temp = this->torchFlames - 1; + this->torchFlames = CLAMP_MIN(temp, 1); } - if (this->actionFunc == func_80ADA8C0) { + if (this->actionFunc == EnPoSisters_MegFightStep2) { this->actor.flags |= ACTOR_FLAG_SFX_FOR_PLAYER_BODY_HIT; CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } - if (this->unk_199 & 1) { + if (this->flags & EN_PO_SISTERS_FLAG_ACCOL) { CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } - if (this->actionFunc != func_80ADB338) { + if (this->actionFunc != EnPoSisters_MegUpdate) { CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } Actor_SetFocus(&this->actor, 40.0f); - if (this->actionFunc == func_80ADAC70) { + if (this->actionFunc == EnPoSisters_Hit2) { this->actor.shape.rot.y = this->actor.world.rot.y + 0x8000; - } else if (this->unk_199 & 2) { + } else if (this->flags & EN_PO_SISTERS_FLAG_ROTATE) { this->actor.shape.rot.y = this->actor.world.rot.y; } } } -void func_80ADC55C(EnPoSisters* this) { - s16 temp_var; +/* set eye color based on sister's animation. */ +void EnPoSisters_TintEyes(EnPoSisters* this) { + s16 temp_b; if (this->skelAnime.animation == &gPoeSistersAttackAnim) { - this->unk_22E.r = CLAMP_MAX((s16)(this->unk_22E.r + 5), 255); - this->unk_22E.g = CLAMP_MIN((s16)(this->unk_22E.g - 5), 50); - temp_var = this->unk_22E.b - 5; - this->unk_22E.b = CLAMP_MIN(temp_var, 0); + this->color.r = CLAMP_MAX((s16)(this->color.r + 5), 255); + this->color.g = CLAMP_MIN((s16)(this->color.g - 5), 50); + temp_b = this->color.b - 5; + this->color.b = CLAMP_MIN(temp_b, 0); } else if (this->skelAnime.animation == &gPoeSistersFleeAnim) { - this->unk_22E.r = CLAMP_MAX((s16)(this->unk_22E.r + 5), 80); - this->unk_22E.g = CLAMP_MAX((s16)(this->unk_22E.g + 5), 255); - temp_var = this->unk_22E.b + 5; - this->unk_22E.b = CLAMP_MAX(temp_var, 225); + this->color.r = CLAMP_MAX((s16)(this->color.r + 5), 80); + this->color.g = CLAMP_MAX((s16)(this->color.g + 5), 255); + temp_b = this->color.b + 5; + this->color.b = CLAMP_MAX(temp_b, 225); } else if (this->skelAnime.animation == &gPoeSistersDamagedAnim) { if (this->actor.colorFilterTimer & 2) { - this->unk_22E.r = 0; - this->unk_22E.g = 0; - this->unk_22E.b = 0; + this->color.r = 0; + this->color.g = 0; + this->color.b = 0; } else { - this->unk_22E.r = 80; - this->unk_22E.g = 255; - this->unk_22E.b = 225; + this->color.r = 80; + this->color.g = 255; + this->color.b = 225; } } else { - this->unk_22E.r = CLAMP_MAX((s16)(this->unk_22E.r + 5), 255); - this->unk_22E.g = CLAMP_MAX((s16)(this->unk_22E.g + 5), 255); - if (this->unk_22E.b > 210) { - temp_var = this->unk_22E.b - 5; - this->unk_22E.b = CLAMP_MIN(temp_var, 210); + this->color.r = CLAMP_MAX((s16)(this->color.r + 5), 255); + this->color.g = CLAMP_MAX((s16)(this->color.g + 5), 255); + if (this->color.b > 210) { + temp_b = this->color.b - 5; + this->color.b = CLAMP_MIN(temp_b, 210); } else { - temp_var = this->unk_22E.b + 5; - this->unk_22E.b = CLAMP_MAX(temp_var, 210); + temp_b = this->color.b + 5; + this->color.b = CLAMP_MAX(temp_b, 210); } } } s32 EnPoSisters_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfxP) { + static Gfx* sSisterBodies[4] = { + gPoeSistersMegBodyDL, + gPoeSistersJoelleBodyDL, + gPoeSistersBethBodyDL, + gPoeSistersAmyBodyDL, + }; + + static Gfx* sSisterFaces[4] = { + gPoeSistersMegFaceDL, + gPoeSistersJoelleFaceDL, + gPoeSistersBethFaceDL, + gPoSistersAmyFaceDL, + }; + + static Color_RGBA8 sLimb11Colors[4] = { + { 80, 0, 100, 0 }, + { 80, 15, 0, 0 }, + { 0, 70, 50, 0 }, + { 70, 70, 0, 0 }, + }; + EnPoSisters* this = (EnPoSisters*)thisx; Color_RGBA8* color; - if (limbIndex == 1 && (this->unk_199 & 0x40)) { - if (this->unk_19A >= 284) { - rot->x += (this->unk_19A * 0x1000) - 0x11C000; + if (limbIndex == 1 && (this->flags & EN_PO_SISTERS_FLAG_SPIN)) { + if (this->timer >= 284) { + rot->x += (this->timer * 0x1000) - 0x11C000; } else { - rot->x += (this->unk_19A * 0x1000) - 0xF000; + rot->x += (this->timer * 0x1000) - 0xF000; } } - if (this->unk_22E.a == 0 || limbIndex == 8 || (this->actionFunc == func_80ADAFC0 && this->unk_19A >= 8)) { + if (this->color.a == 0 || limbIndex == 8 || (this->actionFunc == EnPoSisters_ReleaseFlame && this->timer >= 8)) { *dList = NULL; } else if (limbIndex == 9) { - *dList = D_80ADD7C8[this->unk_194]; + *dList = sSisterBodies[this->sisterID]; } else if (limbIndex == 10) { - *dList = D_80ADD7D8[this->unk_194]; + *dList = sSisterFaces[this->sisterID]; gDPPipeSync((*gfxP)++); - gDPSetEnvColor((*gfxP)++, this->unk_22E.r, this->unk_22E.g, this->unk_22E.b, this->unk_22E.a); + gDPSetEnvColor((*gfxP)++, this->color.r, this->color.g, this->color.b, this->color.a); } else if (limbIndex == 11) { - color = &D_80ADD7E8[this->unk_194]; + color = &sLimb11Colors[this->sisterID]; gDPPipeSync((*gfxP)++); - gDPSetEnvColor((*gfxP)++, color->r, color->g, color->b, this->unk_22E.a); + gDPSetEnvColor((*gfxP)++, color->r, color->g, color->b, this->color.a); } return false; } void EnPoSisters_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfxP) { + static Vec3f sTorchVec = { 1000.0f, -1700.0f, 0.0f }; + EnPoSisters* this = (EnPoSisters*)thisx; s32 i; s32 pad; - if (this->actionFunc == func_80ADAFC0 && this->unk_19A >= 8 && limbIndex == 9) { + if (this->actionFunc == EnPoSisters_ReleaseFlame && this->timer >= 8 && limbIndex == 9) { MATRIX_FINALIZE_AND_LOAD((*gfxP)++, play->state.gfxCtx, "../z_en_po_sisters.c", 2876); gSPDisplayList((*gfxP)++, gPoSistersBurnDL); } - if (limbIndex == 8 && this->actionFunc != func_80ADB2B8) { - if (this->unk_199 & 0x20) { - for (i = this->unk_198 - 1; i > 0; i--) { - this->unk_234[i] = this->unk_234[i - 1]; + if (limbIndex == 8 && this->actionFunc != EnPoSisters_MegMourns) { + if (this->flags & EN_PO_SISTERS_FLAG_TORCH) { + for (i = this->torchFlames - 1; i > 0; i--) { + this->torchPos[i] = this->torchPos[i - 1]; } - Matrix_MultVec3f(&D_80ADD7F8, &this->unk_234[0]); - } else if (this->actionFunc == func_80ADBD8C) { - Matrix_MultVec3f(&D_80ADD7F8, &this->actor.home.pos); + Matrix_MultVec3f(&sTorchVec, &this->torchPos[0]); + } else if (this->actionFunc == EnPoSisters_IntroStep3) { + Matrix_MultVec3f(&sTorchVec, &this->actor.home.pos); } - if (this->unk_198 > 0) { - Color_RGBA8* color = &D_80ADD6F0[this->unk_194]; - f32 temp_f2 = Rand_ZeroOne() * 0.3f + 0.7f; + if (this->torchFlames > 0) { + Color_RGBA8* color = &sTorchLightColors[this->sisterID]; + f32 flicker = Rand_ZeroOne() * 0.3f + 0.7f; - if (this->actionFunc == func_80ADB17C || this->actionFunc == func_80ADBD38 || - this->actionFunc == func_80ADBEE8) { - Lights_PointNoGlowSetInfo(&this->lightInfo, this->unk_234[0].x, this->unk_234[0].y + 15.0f, - this->unk_234[0].z, color->r * temp_f2, color->g * temp_f2, - color->b * temp_f2, 200); + if (this->actionFunc == EnPoSisters_Die || this->actionFunc == EnPoSisters_IntroStep2 || + this->actionFunc == EnPoSisters_IntroStep4) { + Lights_PointNoGlowSetInfo(&this->lightInfo, this->torchPos[0].x, this->torchPos[0].y + 15.0f, + this->torchPos[0].z, color->r * flicker, color->g * flicker, + color->b * flicker, 200); } else { - Lights_PointGlowSetInfo(&this->lightInfo, this->unk_234[0].x, this->unk_234[0].y + 15.0f, - this->unk_234[0].z, color->r * temp_f2, color->g * temp_f2, color->b * temp_f2, + Lights_PointGlowSetInfo(&this->lightInfo, this->torchPos[0].x, this->torchPos[0].y + 15.0f, + this->torchPos[0].z, color->r * flicker, color->g * flicker, color->b * flicker, 200); } } else { Lights_PointSetColorAndRadius(&this->lightInfo, 0, 0, 0, 0); } - if (!(this->unk_199 & 0x80)) { - Matrix_Get(&this->unk_2F8); + if (!(this->flags & EN_PO_SISTERS_FLAG_NOMTXF)) { + Matrix_Get(&this->torchMtxF); } } } @@ -1360,74 +1403,74 @@ void EnPoSisters_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s void EnPoSisters_Draw(Actor* thisx, PlayState* play) { EnPoSisters* this = (EnPoSisters*)thisx; s32 pad1; - f32 phi_f20; + f32 scale; s32 i; - u8 phi_s5; - Color_RGBA8* temp_s1 = &D_80ADD700[this->unk_194]; - Color_RGBA8* temp_s7 = &D_80ADD6F0[this->unk_194]; + u8 alpha; + Color_RGBA8* fireColor = &sTorchFlameColors[this->sisterID]; + Color_RGBA8* lightColor = &sTorchLightColors[this->sisterID]; s32 pad2; OPEN_DISPS(play->state.gfxCtx, "../z_en_po_sisters.c", 2989); - func_80ADC55C(this); + EnPoSisters_TintEyes(this); Gfx_SetupDL_25Opa(play->state.gfxCtx); Gfx_SetupDL_25Xlu(play->state.gfxCtx); - if (this->unk_22E.a == 255 || this->unk_22E.a == 0) { - gDPSetEnvColor(POLY_OPA_DISP++, this->unk_22E.r, this->unk_22E.g, this->unk_22E.b, this->unk_22E.a); + if (this->color.a == 255 || this->color.a == 0) { + gDPSetEnvColor(POLY_OPA_DISP++, this->color.r, this->color.g, this->color.b, this->color.a); gSPSegment(POLY_OPA_DISP++, 0x09, D_80116280 + 2); POLY_OPA_DISP = SkelAnime_Draw(play, 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_22E.a); + gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 255, this->color.a); gSPSegment(POLY_XLU_DISP++, 0x09, D_80116280); POLY_XLU_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnPoSisters_OverrideLimbDraw, EnPoSisters_PostLimbDraw, &this->actor, POLY_XLU_DISP); } - if (!(this->unk_199 & 0x80)) { - Matrix_Put(&this->unk_2F8); + if (!(this->flags & EN_PO_SISTERS_FLAG_NOMTXF)) { + Matrix_Put(&this->torchMtxF); MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, play->state.gfxCtx, "../z_en_po_sisters.c", 3034); gSPDisplayList(POLY_OPA_DISP++, gPoSistersTorchDL); } gSPSegment(POLY_XLU_DISP++, 0x08, Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, 0, 0, 0x20, 0x40, 1, 0, (play->gameplayFrames * -20) % 512, 0x20, 0x80)); - gDPSetEnvColor(POLY_XLU_DISP++, temp_s1->r, temp_s1->g, temp_s1->b, temp_s1->a); - if (this->actionFunc == func_80ADB17C) { - if (this->unk_19A < 32) { - phi_s5 = ((32 - this->unk_19A) * 255) / 32; - phi_f20 = 0.0056000003f; + gDPSetEnvColor(POLY_XLU_DISP++, fireColor->r, fireColor->g, fireColor->b, fireColor->a); + if (this->actionFunc == EnPoSisters_Die) { + if (this->timer < 32) { + alpha = ((32 - this->timer) * 255) / 32; + scale = 0.0056000003f; } else { - phi_s5 = (this->unk_19A * 255 - 8160) / 32; - phi_f20 = 0.0027f; + alpha = (this->timer * 255 - 8160) / 32; + scale = 0.0027f; } - } else if (this->actionFunc == func_80ADBD38) { - phi_s5 = ((32 - this->unk_19A) * 255) / 32; - phi_f20 = 0.0027f; - } else if (this->actionFunc == func_80ADBEE8) { - phi_s5 = ((32 - this->unk_19A) * 255) / 32; - phi_f20 = 0.0035f; - } else if (this->actionFunc == func_80ADBC88) { - // phi_s5 initialized in loop below - phi_f20 = 0.0027f; + } else if (this->actionFunc == EnPoSisters_IntroStep2) { + alpha = ((32 - this->timer) * 255) / 32; + scale = 0.0027f; + } else if (this->actionFunc == EnPoSisters_IntroStep4) { + alpha = ((32 - this->timer) * 255) / 32; + scale = 0.0035f; + } else if (this->actionFunc == EnPoSisters_IntroStep1) { + // alpha initialized in loop below + scale = 0.0027f; } else { - // phi_s5 initialized in loop below - phi_f20 = this->actor.scale.x * 0.5f; + // alpha initialized in loop below + scale = this->actor.scale.x * 0.5f; } - for (i = 0; i < this->unk_198; i++) { - if (this->actionFunc != func_80ADB17C && this->actionFunc != func_80ADBD38 && - this->actionFunc != func_80ADBEE8) { - phi_s5 = -i * 31 + 248; + for (i = 0; i < this->torchFlames; i++) { + if (this->actionFunc != EnPoSisters_Die && this->actionFunc != EnPoSisters_IntroStep2 && + this->actionFunc != EnPoSisters_IntroStep4) { + alpha = -i * 31 + 248; } gDPPipeSync(POLY_XLU_DISP++); - gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, temp_s7->r, temp_s7->g, temp_s7->b, phi_s5); - Matrix_Translate(this->unk_234[i].x, this->unk_234[i].y, this->unk_234[i].z, MTXMODE_NEW); + gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, lightColor->r, lightColor->g, lightColor->b, alpha); + Matrix_Translate(this->torchPos[i].x, this->torchPos[i].y, this->torchPos[i].z, MTXMODE_NEW); Matrix_RotateZYX(0, (s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x8000), 0, MTXMODE_APPLY); - if (this->actionFunc == func_80ADAFC0) { - phi_f20 = (this->unk_19A - i) * 0.025f + 0.5f; - phi_f20 = CLAMP(phi_f20, 0.5f, 0.8f) * 0.007f; + if (this->actionFunc == EnPoSisters_ReleaseFlame) { + scale = (this->timer - i) * 0.025f + 0.5f; + scale = CLAMP(scale, 0.5f, 0.8f) * 0.007f; } - Matrix_Scale(phi_f20, phi_f20, phi_f20, MTXMODE_APPLY); + Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx, "../z_en_po_sisters.c", 3132); gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); } 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 fdfd734360..b0e1be7dec 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 @@ -13,23 +13,39 @@ typedef struct EnPoSisters { /* 0x0000 */ Actor actor; /* 0x014C */ SkelAnime skelAnime; /* 0x0190 */ EnPoSistersActionFunc actionFunc; - /* 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 */ s16 unk_19A; - /* 0x019A */ s16 unk_19C; + /* 0x0194 */ u8 sisterID; // which Poe sister this is + /* 0x0195 */ u8 decoyID; // if non-zero, index of Meg's decoy + /* 0x0196 */ u8 hoverPulse; + /* 0x0197 */ u8 vanishTimer; + /* 0x0198 */ u8 torchFlames; // number of torch flames to draw + /* 0x0199 */ u8 flags; // uses EnPoSisterFlags + /* 0x019A */ s16 timer; // timer used for various situations + /* 0x019C */ s16 sisterVar; // Used as a decoy counter for Meg, her sisters a reveal timer /* 0x019E */ Vec3s jointTable[12]; /* 0x01E6 */ Vec3s morphTable[12]; - /* 0x022E */ Color_RGBA8 unk_22E; - /* 0x0234 */ Vec3f unk_234[8]; - /* 0x0294 */ f32 unk_294; + /* 0x022E */ Color_RGBA8 color; // (rgb) for eyes, (a) for rest of body + /* 0x0234 */ Vec3f torchPos[8]; // positions of the torch flame and smaller circling flames + /* 0x0294 */ f32 circleDist; // distance of Meg when circling Link. /* 0x0298 */ LightNode* lightNode; /* 0x029C */ LightInfo lightInfo; /* 0x02AC */ ColliderCylinder collider; - /* 0x02F8 */ MtxF unk_2F8; + /* 0x02F8 */ MtxF torchMtxF; } EnPoSisters; // size = 0x0338 +typedef enum EnPoSisterNames { + EN_PO_SISTERS_MEG, // purple sister, circles Link with decoys + EN_PO_SISTERS_JOELLE, // red sister, hides in portraits + EN_PO_SISTERS_BETH, // blue sister, hides in portraits + EN_PO_SISTERS_AMY, // green sister, hides in block puzzle +} EnPoSisterNames; + +#define POE_SISTER_GET_ID(x) PARAMS_GET_U(x->params, 8, 2) +#define POE_SISTER_GET_DECOY(x) PARAMS_GET_U(x->params, 10, 2) +#define POE_SISTER_GET_INTRO(x) PARAMS_GET_NOSHIFT(x->actor.params, 12, 1) + +#define EN_PO_SISTERS_PARAM_N(n) (n << 8) // param for which sister by number +#define EN_PO_SISTERS_PARAM(name) (EN_PO_SISTERS_##name << 8) // param for which sister by name +#define EN_PO_SISTERS_DECOY_PARAM(n) (n << 10) // param for Meg's decoys +#define EN_PO_SISTERS_INTRO_PARAM (1 << 12) // param for Poe Sisters when first entering foyer + #endif