diff --git a/assets/xml/objects/object_numa_obj.xml b/assets/xml/objects/object_numa_obj.xml index cc36fa1b80..e8035b3e86 100644 --- a/assets/xml/objects/object_numa_obj.xml +++ b/assets/xml/objects/object_numa_obj.xml @@ -1,4 +1,5 @@  + @@ -17,21 +18,24 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + diff --git a/spec b/spec index 12750b73fb..17a9ecc8dc 100644 --- a/spec +++ b/spec @@ -2629,8 +2629,7 @@ beginseg name "ovl_Bg_Numa_Hana" compress include "build/src/overlays/actors/ovl_Bg_Numa_Hana/z_bg_numa_hana.o" - include "build/data/ovl_Bg_Numa_Hana/ovl_Bg_Numa_Hana.data.o" - include "build/data/ovl_Bg_Numa_Hana/ovl_Bg_Numa_Hana.reloc.o" + include "build/src/overlays/actors/ovl_Bg_Numa_Hana/ovl_Bg_Numa_Hana_reloc.o" endseg beginseg diff --git a/src/overlays/actors/ovl_Bg_Numa_Hana/z_bg_numa_hana.c b/src/overlays/actors/ovl_Bg_Numa_Hana/z_bg_numa_hana.c index 62ae7ab8ac..bf556345f1 100644 --- a/src/overlays/actors/ovl_Bg_Numa_Hana/z_bg_numa_hana.c +++ b/src/overlays/actors/ovl_Bg_Numa_Hana/z_bg_numa_hana.c @@ -5,8 +5,10 @@ */ #include "z_bg_numa_hana.h" +#include "objects/object_numa_obj/object_numa_obj.h" +#include "objects/object_syokudai/object_syokudai.h" -#define FLAGS 0x00000410 +#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_400) #define THIS ((BgNumaHana*)thisx) @@ -15,14 +17,19 @@ void BgNumaHana_Destroy(Actor* thisx, GlobalContext* globalCtx); void BgNumaHana_Update(Actor* thisx, GlobalContext* globalCtx); void BgNumaHana_Draw(Actor* thisx, GlobalContext* globalCtx); -void func_80A1AA28(BgNumaHana* this, GlobalContext* globalCtx); -void func_80A1AA4C(BgNumaHana* this, GlobalContext* globalCtx); -void func_80A1AB00(BgNumaHana* this, GlobalContext* globalCtx); -void func_80A1ABF0(BgNumaHana* this, GlobalContext* globalCtx); -void func_80A1ACE0(BgNumaHana* this, GlobalContext* globalCtx); -void func_80A1AE1C(BgNumaHana* this, GlobalContext* globalCtx); +void BgNumaHana_SetupDoNothing(BgNumaHana* this); +void BgNumaHana_DoNothing(BgNumaHana* this, GlobalContext* globalCtx); +void BgNumaHana_SetupClosedIdle(BgNumaHana* this); +void BgNumaHana_ClosedIdle(BgNumaHana* this, GlobalContext* globalCtx); +void BgNumaHana_SetupUnfoldInnerPetals(BgNumaHana* this); +void BgNumaHana_UnfoldInnerPetals(BgNumaHana* this, GlobalContext* globalCtx); +void BgNumaHana_SetupUnfoldOuterPetals(BgNumaHana* this); +void BgNumaHana_UnfoldOuterPetals(BgNumaHana* this, GlobalContext* globalCtx); +void BgNumaHana_SetupRaiseFlower(BgNumaHana* this); +void BgNumaHana_RaiseFlower(BgNumaHana* this, GlobalContext* globalCtx); +void BgNumaHana_SetupOpenedIdle(BgNumaHana* this); +void BgNumaHana_OpenedIdle(BgNumaHana* this, GlobalContext* globalCtx); -#if 0 const ActorInit Bg_Numa_Hana_InitVars = { ACTOR_BG_NUMA_HANA, ACTORCAT_BG, @@ -35,63 +42,379 @@ const ActorInit Bg_Numa_Hana_InitVars = { (ActorFunc)BgNumaHana_Draw, }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_80A1B260 = { - { COLTYPE_METAL, AT_NONE, AC_ON | AC_HARD | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_2, COLSHAPE_CYLINDER, }, - { ELEMTYPE_UNK2, { 0x00000000, 0x00, 0x00 }, { 0x01CBFBB6, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON | BUMP_HOOKABLE, OCELEM_ON, }, +static ColliderCylinderInit sCylinderInit = { + { + COLTYPE_METAL, + AT_NONE, + AC_ON | AC_HARD | AC_TYPE_PLAYER, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_2, + COLSHAPE_CYLINDER, + }, + { + ELEMTYPE_UNK2, + { 0x00000000, 0x00, 0x00 }, + { 0x01CBFBB6, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_ON | BUMP_HOOKABLE, + OCELEM_ON, + }, { 18, 16, 0, { 0, 0, 0 } }, }; -// static InitChainEntry sInitChain[] = { -static InitChainEntry D_80A1B2A8[] = { +static FireObjInitParams sFireObjInit = { + 0.00405000010505f, 0.0500000007451f, 3, 1, 0, 0, 0, +}; + +static s16 sInitialAnglePerPetal[] = { 0x0000, 0x2AAA, 0x5555, 0x8000, 0xAAAA, 0xD555 }; + +static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneForward, 4000, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneScale, 800, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneDownward, 600, ICHAIN_STOP), }; -#endif +/** + * Spawns another wooden flower instance that handles the opened flower's collision. + * Returns true if this wooden flower instance was succesfully spawned. + */ +s32 BgNumaHana_SpawnOpenFlowerCollisionChild(BgNumaHana* this, GlobalContext* globalCtx) { + Actor* child; -extern ColliderCylinderInit D_80A1B260; -extern InitChainEntry D_80A1B2A8[]; + child = Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_BG_NUMA_HANA, + this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, + this->dyna.actor.shape.rot.x, this->dyna.actor.shape.rot.y, this->dyna.actor.shape.rot.z, + BG_NUMA_HANA_TYPE_OPEN_FLOWER_COLLISION); -extern UNK_TYPE D_06009FE0; -extern UNK_TYPE D_0600B928; + return child != NULL; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Numa_Hana/func_80A1A500.s") +void BgNumaHana_UpdatePetalPosRots(BgNumaHana* this) { + f32 outerPetalPosScale; + f32 innerPetalYPos; + f32 outerPetalYPos; + s16 angle; + WoodenFlowerPetalPosRot* innerPetalPosRot; + WoodenFlowerPetalPosRot* outerPetalPosRot; + s32 i; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Numa_Hana/func_80A1A56C.s") + innerPetalYPos = this->dyna.actor.world.pos.y + -10.0f; + angle = this->petalZRotation - 0x2000; + outerPetalPosScale = (Math_CosS(angle) * 77.42784f) + 74.95192f; + outerPetalYPos = (Math_SinS(this->petalZRotation) * 77.42784f) + this->dyna.actor.world.pos.y + -64.74976f; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Numa_Hana/func_80A1A750.s") + for (i = 0; i < ARRAY_COUNT(this->innerPetalPosRot); i++) { + innerPetalPosRot = &this->innerPetalPosRot[i]; + outerPetalPosRot = &this->outerPetalPosRot[i]; + angle = sInitialAnglePerPetal[i] + this->dyna.actor.shape.rot.y + 0x1555; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Numa_Hana/BgNumaHana_Init.s") + innerPetalPosRot->pos.x = (Math_SinS(angle) * 74.95192f) + this->dyna.actor.world.pos.x; + innerPetalPosRot->pos.y = innerPetalYPos; + innerPetalPosRot->pos.z = (Math_CosS(angle) * 74.95192f) + this->dyna.actor.world.pos.z; + innerPetalPosRot->rot.x = this->dyna.actor.shape.rot.x; + innerPetalPosRot->rot.y = angle - 0x4000; + innerPetalPosRot->rot.z = this->dyna.actor.shape.rot.z + this->petalZRotation; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Numa_Hana/BgNumaHana_Destroy.s") + outerPetalPosRot->pos.x = (Math_SinS(angle) * outerPetalPosScale) + this->dyna.actor.world.pos.x; + outerPetalPosRot->pos.y = outerPetalYPos; + outerPetalPosRot->pos.z = (Math_CosS(angle) * outerPetalPosScale) + this->dyna.actor.world.pos.z; + outerPetalPosRot->rot.x = innerPetalPosRot->rot.x; + outerPetalPosRot->rot.y = innerPetalPosRot->rot.y; + outerPetalPosRot->rot.z = innerPetalPosRot->rot.z + this->outerPetalZRotation; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Numa_Hana/func_80A1AA14.s") +/** + * As the pieces of the petals finish unfolding, they shake to appear + * as if they are "settling" into place. This function is responsible + * for computing the extra rotation for this "settling". + */ +void BgNumaHana_UpdateSettleRotation(s16* settleZRotation, s16* settleAngle, f32* settleScale, f32 scaleStep) { + *settleAngle += 0x32C8; + Math_StepToF(settleScale, 0.0f, scaleStep); + *settleZRotation += (s16)(Math_SinS(*settleAngle) * *settleScale); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Numa_Hana/func_80A1AA28.s") +void BgNumaHana_Init(Actor* thisx, GlobalContext* globalCtx) { + s32 pad; + DynaPolyActor* child; + s32 type; + BgNumaHana* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Numa_Hana/func_80A1AA38.s") + type = BG_NUMA_HANA_GET_TYPE(&this->dyna.actor); + Actor_ProcessInitChain(&this->dyna.actor, sInitChain); + DynaPolyActor_Init(&this->dyna, 3); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Numa_Hana/func_80A1AA4C.s") + if (type == BG_NUMA_HANA_TYPE_OPEN_FLOWER_COLLISION) { + DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &gWoodenFlowerOpenedFlowerCol); + BgNumaHana_SetupDoNothing(this); + this->dyna.actor.draw = NULL; + } else { + DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &gWoodenFlowerClosedFlowerCol); + FireObj_Init(globalCtx, &this->fire, &sFireObjInit, &this->dyna.actor); + Collider_InitCylinder(globalCtx, &this->torchCollider); + Collider_SetCylinder(globalCtx, &this->torchCollider, &this->dyna.actor, &sCylinderInit); + this->dyna.actor.colChkInfo.mass = MASS_IMMOVABLE; + if (!BgNumaHana_SpawnOpenFlowerCollisionChild(this, globalCtx)) { + Actor_MarkForDeath(&this->dyna.actor); + return; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Numa_Hana/func_80A1AAE8.s") + if (gSaveContext.weekEventReg[12] & 1) { + func_800C62BC(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Numa_Hana/func_80A1AB00.s") + this->petalZRotation = 0x2000; + this->innerPetalZRotation = 0x2000; + this->innerPetalZRotationalVelocity = 0; + this->settleZRotation = 0; + this->settleAngle = 0; + this->settleScale = 0.0f; + this->outerPetalZRotation = -0x4000; + this->outerPetalZRotationalVelocity = 0; + this->flowerRotationalVelocity = 0x147; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Numa_Hana/func_80A1ABD8.s") + this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + 210.0f; + FireObj_SetState2(&this->fire, 0.05f, 2); + Flags_SetSwitch(globalCtx, BG_NUMA_HANA_SWITCH_FLAG(&this->dyna.actor)); + BgNumaHana_SetupOpenedIdle(this); + } else { + child = (DynaPolyActor*)this->dyna.actor.child; + func_800C62BC(globalCtx, &globalCtx->colCtx.dyna, child->bgId); + Flags_UnsetSwitch(globalCtx, BG_NUMA_HANA_SWITCH_FLAG(&this->dyna.actor)); + BgNumaHana_SetupClosedIdle(this); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Numa_Hana/func_80A1ABF0.s") + BgNumaHana_UpdatePetalPosRots(this); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Numa_Hana/func_80A1ACCC.s") +void BgNumaHana_Destroy(Actor* thisx, GlobalContext* globalCtx) { + BgNumaHana* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Numa_Hana/func_80A1ACE0.s") + DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + if (BG_NUMA_HANA_GET_TYPE(&this->dyna.actor) == BG_NUMA_HANA_TYPE_NORMAL) { + FireObj_Destroy(globalCtx, &this->fire); + Collider_DestroyCylinder(globalCtx, &this->torchCollider); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Numa_Hana/func_80A1AE08.s") +void BgNumaHana_SetupDoNothing(BgNumaHana* this) { + this->actionFunc = BgNumaHana_DoNothing; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Numa_Hana/func_80A1AE1C.s") +void BgNumaHana_DoNothing(BgNumaHana* this, GlobalContext* globalCtx) { +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Numa_Hana/BgNumaHana_Update.s") +void BgNumaHana_SetupClosedIdle(BgNumaHana* this) { + this->actionFunc = BgNumaHana_ClosedIdle; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Numa_Hana/BgNumaHana_Draw.s") +/** + * This function waits for the torch to be lit. Once it is, it starts + * the cutscene where the petals unfold. + */ +void BgNumaHana_ClosedIdle(BgNumaHana* this, GlobalContext* globalCtx) { + if (this->fire.state != 3) { + Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_FLAME_IGNITION); + if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { + ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); + gSaveContext.weekEventReg[12] |= 1; + Flags_SetSwitch(globalCtx, BG_NUMA_HANA_SWITCH_FLAG(&this->dyna.actor)); + BgNumaHana_SetupUnfoldInnerPetals(this); + } else { + ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + } + } +} + +void BgNumaHana_SetupUnfoldInnerPetals(BgNumaHana* this) { + this->actionFunc = BgNumaHana_UnfoldInnerPetals; + this->transitionTimer = 0; +} + +/** + * Partially moves the flower to the "open" position by raising the "inner" + * parts of the petals that are closest to the stalk. + */ +void BgNumaHana_UnfoldInnerPetals(BgNumaHana* this, GlobalContext* globalCtx) { + Math_StepToS(&this->innerPetalZRotationalVelocity, 240, 14); + if (Math_ScaledStepToS(&this->innerPetalZRotation, 0x2000, this->innerPetalZRotationalVelocity)) { + if (this->transitionTimer >= 11) { + BgNumaHana_SetupUnfoldOuterPetals(this); + } else { + if (this->transitionTimer <= 0) { + this->settleZRotation = 0; + this->settleAngle = 0; + this->settleScale = 420.0f; + Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_FLOWERPETAL_STOP); + } + this->transitionTimer++; + } + } else { + func_800B9010(&this->dyna.actor, NA_SE_EV_FLOWERPETAL_MOVE - SFX_FLAG); + } + + BgNumaHana_UpdateSettleRotation(&this->settleZRotation, &this->settleAngle, &this->settleScale, 20.0f); + this->petalZRotation = this->innerPetalZRotation + this->settleZRotation; + BgNumaHana_UpdatePetalPosRots(this); +} + +void BgNumaHana_SetupUnfoldOuterPetals(BgNumaHana* this) { + this->actionFunc = BgNumaHana_UnfoldOuterPetals; + this->transitionTimer = 0; +} + +/** + * Partially moves the flower to the "open" position by lowering the "outer" + * parts of the petals that are furthest to the stalk. + */ +void BgNumaHana_UnfoldOuterPetals(BgNumaHana* this, GlobalContext* globalCtx) { + Math_StepToS(&this->outerPetalZRotationalVelocity, 240, 14); + if (Math_ScaledStepToS(&this->outerPetalZRotation, -0x4000, this->outerPetalZRotationalVelocity)) { + if (this->transitionTimer >= 11) { + BgNumaHana_SetupRaiseFlower(this); + } else { + if (this->transitionTimer <= 0) { + this->settleZRotation = 0; + this->settleAngle = 0x5120; + this->settleScale = 130.0f; + Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_FLOWERPETAL_STOP); + } + this->transitionTimer++; + } + } else { + func_800B9010(&this->dyna.actor, NA_SE_EV_FLOWERPETAL_MOVE - SFX_FLAG); + } + + BgNumaHana_UpdateSettleRotation(&this->settleZRotation, &this->settleAngle, &this->settleScale, 7.0f); + this->petalZRotation = this->innerPetalZRotation + this->settleZRotation; + BgNumaHana_UpdatePetalPosRots(this); +} + +void BgNumaHana_SetupRaiseFlower(BgNumaHana* this) { + this->actionFunc = BgNumaHana_RaiseFlower; +} + +/** + * This function slowly raises the flower to its final height and makes it start spinning. + */ +void BgNumaHana_RaiseFlower(BgNumaHana* this, GlobalContext* globalCtx) { + s32 pad; + DynaPolyActor* child; + + BgNumaHana_UpdateSettleRotation(&this->settleZRotation, &this->settleAngle, &this->settleScale, 10.0f); + this->petalZRotation = this->innerPetalZRotation + this->settleZRotation; + Math_StepToS(&this->flowerRotationalVelocity, 0x111, 0xA); + this->dyna.actor.shape.rot.y += this->flowerRotationalVelocity; + Math_StepToF(&this->dyna.actor.velocity.y, 3.0f, 0.3f); + + if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + 210.0f, + this->dyna.actor.velocity.y)) { + child = (DynaPolyActor*)this->dyna.actor.child; + + // Swaps out the "closed" flower collision for the "opened" collision. + func_800C6314(globalCtx, &globalCtx->colCtx.dyna, child->bgId); + func_800C62BC(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + + this->petalZRotation = 0x2000; + this->innerPetalZRotation = 0x2000; + this->innerPetalZRotationalVelocity = 0; + this->settleZRotation = 0; + this->settleAngle = 0; + this->outerPetalZRotation = -0x4000; + this->outerPetalZRotationalVelocity = 0; + this->flowerRotationalVelocity = 0x147; + this->settleScale = 0.0f; + + ActorCutscene_Stop(this->dyna.actor.cutscene); + BgNumaHana_SetupOpenedIdle(this); + } + + BgNumaHana_UpdatePetalPosRots(this); + func_800B9010(&this->dyna.actor, NA_SE_EV_FLOWER_ROLLING - SFX_FLAG); +} + +void BgNumaHana_SetupOpenedIdle(BgNumaHana* this) { + this->actionFunc = BgNumaHana_OpenedIdle; +} + +/** + * Spins the "opened" flower around the y-axis. + */ +void BgNumaHana_OpenedIdle(BgNumaHana* this, GlobalContext* globalCtx) { + this->dyna.actor.shape.rot.y += this->flowerRotationalVelocity; + this->petalZRotation = this->innerPetalZRotation + this->settleZRotation; + BgNumaHana_UpdatePetalPosRots(this); + func_800B9010(&this->dyna.actor, NA_SE_EV_FLOWER_ROLLING - SFX_FLAG); +} + +void BgNumaHana_Update(Actor* thisx, GlobalContext* globalCtx) { + s32 pad; + BgNumaHana* this = THIS; + s32 type = BG_NUMA_HANA_GET_TYPE(&this->dyna.actor); + Vec3f firePos; + + if (type == BG_NUMA_HANA_TYPE_NORMAL) { + firePos.x = this->dyna.actor.world.pos.x; + firePos.y = this->dyna.actor.world.pos.y + 10.5f; + firePos.z = this->dyna.actor.world.pos.z; + FireObj_SetPosition(&this->fire, &firePos); + FireObj_Update(globalCtx, &this->fire, &this->dyna.actor); + } + + this->actionFunc(this, globalCtx); + + if (type == BG_NUMA_HANA_TYPE_NORMAL) { + this->dyna.actor.child->shape.rot = this->dyna.actor.shape.rot; + Collider_UpdateCylinder(&this->dyna.actor, &this->torchCollider); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->torchCollider.base); + CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->torchCollider.base); + } +} + +void BgNumaHana_Draw(Actor* thisx, GlobalContext* globalCtx2) { + GlobalContext* globalCtx = globalCtx2; + BgNumaHana* this = THIS; + WoodenFlowerPetalPosRot* innerPetalPosRot; + WoodenFlowerPetalPosRot* outerPetalPosRot; + s32 objectIndex; + s32 i; + + OPEN_DISPS(globalCtx->state.gfxCtx); + + func_8012C28C(globalCtx->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, gWoodenFlowerStalkDL); + + for (i = 0; i < ARRAY_COUNT(this->innerPetalPosRot); i++) { + innerPetalPosRot = &this->innerPetalPosRot[i]; + outerPetalPosRot = &this->outerPetalPosRot[i]; + + Matrix_SetStateRotationAndTranslation(innerPetalPosRot->pos.x, innerPetalPosRot->pos.y, innerPetalPosRot->pos.z, + &innerPetalPosRot->rot); + Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, gWoodenFlowerInnerPetalDL); + + Matrix_SetStateRotationAndTranslation(outerPetalPosRot->pos.x, outerPetalPosRot->pos.y, outerPetalPosRot->pos.z, + &outerPetalPosRot->rot); + Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, gWoodenFlowerOuterPetalDL); + } + + objectIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_SYOKUDAI); + if ((objectIndex >= 0) && (Object_IsLoaded(&globalCtx->objectCtx, objectIndex))) { + Matrix_SetStateRotationAndTranslation(this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y - 64.5f, + this->dyna.actor.world.pos.z, &this->dyna.actor.shape.rot); + Matrix_Scale(1.5f, 1.5f, 1.5f, MTXMODE_APPLY); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[objectIndex].segment); + gSPDisplayList(POLY_OPA_DISP++, gObjectSyokudaiTypeNoSwitchDL); + } + + FireObj_Draw(globalCtx, &this->fire); + + CLOSE_DISPS(globalCtx->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_Bg_Numa_Hana/z_bg_numa_hana.h b/src/overlays/actors/ovl_Bg_Numa_Hana/z_bg_numa_hana.h index f4974860ae..19d30a34f1 100644 --- a/src/overlays/actors/ovl_Bg_Numa_Hana/z_bg_numa_hana.h +++ b/src/overlays/actors/ovl_Bg_Numa_Hana/z_bg_numa_hana.h @@ -3,15 +3,41 @@ #include "global.h" +#define BG_NUMA_HANA_GET_TYPE(thisx) ((thisx)->params & 1) +#define BG_NUMA_HANA_SWITCH_FLAG(thisx) (((thisx)->params >> 8) & 0x7F) + +typedef enum { + /* 0 */ BG_NUMA_HANA_TYPE_NORMAL, + /* 1 */ BG_NUMA_HANA_TYPE_OPEN_FLOWER_COLLISION, +} BgNumaHanaType; + struct BgNumaHana; typedef void (*BgNumaHanaActionFunc)(struct BgNumaHana*, GlobalContext*); +typedef struct { + /* 0x00 */ Vec3f pos; + /* 0x0C */ Vec3s rot; + /* 0x12 */ UNK_TYPE1 unk_12[0x2]; +} WoodenFlowerPetalPosRot; // size = 0x14 + typedef struct BgNumaHana { - /* 0x0000 */ Actor actor; - /* 0x0144 */ char unk_144[0xF0]; - /* 0x0234 */ BgNumaHanaActionFunc actionFunc; - /* 0x0238 */ char unk_238[0x108]; + /* 0x000 */ DynaPolyActor dyna; + /* 0x15C */ FireObj fire; + /* 0x1E8 */ ColliderCylinder torchCollider; + /* 0x234 */ BgNumaHanaActionFunc actionFunc; + /* 0x238 */ WoodenFlowerPetalPosRot innerPetalPosRot[6]; + /* 0x2B0 */ WoodenFlowerPetalPosRot outerPetalPosRot[6]; + /* 0x328 */ s16 petalZRotation; + /* 0x32A */ s16 innerPetalZRotation; + /* 0x32C */ s16 innerPetalZRotationalVelocity; + /* 0x32E */ s16 settleZRotation; + /* 0x330 */ s16 settleAngle; + /* 0x334 */ f32 settleScale; + /* 0x338 */ s16 outerPetalZRotation; + /* 0x33A */ s16 outerPetalZRotationalVelocity; + /* 0x33C */ s16 flowerRotationalVelocity; + /* 0x33E */ s16 transitionTimer; } BgNumaHana; // size = 0x340 extern const ActorInit Bg_Numa_Hana_InitVars; diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index cd1f5bf74c..560e9ee241 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -9787,23 +9787,23 @@ 0x80A1A220:("ObjRaillift_Draw",), 0x80A1A330:("ObjRaillift_DrawDekuFlowerPlatform",), 0x80A1A360:("ObjRaillift_DrawDekuFlowerPlatformColorful",), - 0x80A1A500:("func_80A1A500",), - 0x80A1A56C:("func_80A1A56C",), - 0x80A1A750:("func_80A1A750",), + 0x80A1A500:("BgNumaHana_SpawnOpenFlowerCollisionChild",), + 0x80A1A56C:("BgNumaHana_UpdatePetalPosRots",), + 0x80A1A750:("BgNumaHana_UpdateSettleRotation",), 0x80A1A7CC:("BgNumaHana_Init",), 0x80A1A9AC:("BgNumaHana_Destroy",), - 0x80A1AA14:("func_80A1AA14",), - 0x80A1AA28:("func_80A1AA28",), - 0x80A1AA38:("func_80A1AA38",), - 0x80A1AA4C:("func_80A1AA4C",), - 0x80A1AAE8:("func_80A1AAE8",), - 0x80A1AB00:("func_80A1AB00",), - 0x80A1ABD8:("func_80A1ABD8",), - 0x80A1ABF0:("func_80A1ABF0",), - 0x80A1ACCC:("func_80A1ACCC",), - 0x80A1ACE0:("func_80A1ACE0",), - 0x80A1AE08:("func_80A1AE08",), - 0x80A1AE1C:("func_80A1AE1C",), + 0x80A1AA14:("BgNumaHana_SetupDoNothing",), + 0x80A1AA28:("BgNumaHana_DoNothing",), + 0x80A1AA38:("BgNumaHana_SetupClosedIdle",), + 0x80A1AA4C:("BgNumaHana_ClosedIdle",), + 0x80A1AAE8:("BgNumaHana_SetupUnfoldInnerPetals",), + 0x80A1AB00:("BgNumaHana_UnfoldInnerPetals",), + 0x80A1ABD8:("BgNumaHana_SetupUnfoldOuterPetals",), + 0x80A1ABF0:("BgNumaHana_UnfoldOuterPetals",), + 0x80A1ACCC:("BgNumaHana_SetupRaiseFlower",), + 0x80A1ACE0:("BgNumaHana_RaiseFlower",), + 0x80A1AE08:("BgNumaHana_SetupOpenedIdle",), + 0x80A1AE1C:("BgNumaHana_OpenedIdle",), 0x80A1AE6C:("BgNumaHana_Update",), 0x80A1AF68:("BgNumaHana_Draw",), 0x80A1B3D0:("func_80A1B3D0",), diff --git a/undefined_syms.txt b/undefined_syms.txt index a74cedb848..3615fb295b 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -725,15 +725,6 @@ D_06000798 = 0x06000798; D_06000098 = 0x06000098; -// ovl_Bg_Numa_Hana - -D_06000870 = 0x06000870; -D_06009FE0 = 0x06009FE0; -D_0600A740 = 0x0600A740; -D_0600AB88 = 0x0600AB88; -D_0600B928 = 0x0600B928; -D_0600BE58 = 0x0600BE58; - // ovl_Bg_Open_Shutter D_060003E8 = 0x060003E8;