diff --git a/assets/xml/objects/object_keikoku_demo.xml b/assets/xml/objects/object_keikoku_demo.xml index 994b682f3b..3a0a20b657 100644 --- a/assets/xml/objects/object_keikoku_demo.xml +++ b/assets/xml/objects/object_keikoku_demo.xml @@ -1,21 +1,65 @@  + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/overlays/actors/ovl_Dm_Opstage/z_dm_opstage.c b/src/overlays/actors/ovl_Dm_Opstage/z_dm_opstage.c index 0ee7b3ed47..4e3915af0c 100644 --- a/src/overlays/actors/ovl_Dm_Opstage/z_dm_opstage.c +++ b/src/overlays/actors/ovl_Dm_Opstage/z_dm_opstage.c @@ -1,7 +1,7 @@ /* * File: z_dm_opstage.c * Overlay: ovl_Dm_Opstage - * Description: Lost Woods cutscene objects + * Description: Lost Woods Cutscene Trees and Floor */ #include "z_dm_opstage.h" @@ -44,14 +44,17 @@ void DmOpstage_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DmOpstage_SetupAction(this, DmOpstage_FollowCutsceneScript); Actor_SetScale(&this->dyna.actor, 0.1f); - if (DMOPSTAGE_GET_TYPE(&this->dyna.actor) == DM_OPSTAGE_TYPE_FLOOR) { + + if (DMOPSTAGE_GET_TYPE(&this->dyna.actor) == DMOPSTAGE_TYPE_GROUND) { DynaPolyActor_Init(&this->dyna, 0); - DynaPolyActor_LoadMesh(play, &this->dyna, &object_keikoku_demo_Colheader_001C98); + DynaPolyActor_LoadMesh(play, &this->dyna, &gKeikokuDemoFloorColliderHeader); } - if (DMOPSTAGE_GET_TYPE(&this->dyna.actor) > DM_OPSTAGE_TYPE_FLOOR) { - this->pos.x = this->dyna.actor.world.pos.x; - this->pos.y = this->dyna.actor.world.pos.y; - this->pos.z = this->dyna.actor.world.pos.z; + + if (DMOPSTAGE_GET_TYPE(&this->dyna.actor) > DMOPSTAGE_TYPE_GROUND) { + // trees move their world pos to map origin/center, then draw at their starting position + this->drawOffset.x = this->dyna.actor.world.pos.x; + this->drawOffset.y = this->dyna.actor.world.pos.y; + this->drawOffset.z = this->dyna.actor.world.pos.z; this->dyna.actor.world.pos.x = 0.0f; this->dyna.actor.world.pos.y = 0.0f; this->dyna.actor.world.pos.z = 0.0f; @@ -61,7 +64,7 @@ void DmOpstage_Init(Actor* thisx, PlayState* play) { void DmOpstage_Destroy(Actor* thisx, PlayState* play) { DmOpstage* this = THIS; - if (DMOPSTAGE_GET_TYPE(&this->dyna.actor) == DM_OPSTAGE_TYPE_FLOOR) { + if (DMOPSTAGE_GET_TYPE(&this->dyna.actor) == DMOPSTAGE_TYPE_GROUND) { DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } } @@ -69,7 +72,7 @@ void DmOpstage_Destroy(Actor* thisx, PlayState* play) { void DmOpstage_FollowCutsceneScript(DmOpstage* this, PlayState* play) { s32 actionIndex; - if (DMOPSTAGE_GET_TYPE(&this->dyna.actor) == DM_OPSTAGE_TYPE_FLOOR) { + if (DMOPSTAGE_GET_TYPE(&this->dyna.actor) == DMOPSTAGE_TYPE_GROUND) { if (Cutscene_CheckActorAction(play, 0x73)) { actionIndex = Cutscene_GetActorActionIndex(play, 0x73); if (play->csCtx.actorActions[actionIndex]->action == 2) { @@ -81,9 +84,10 @@ void DmOpstage_FollowCutsceneScript(DmOpstage* this, PlayState* play) { } Cutscene_ActorTranslateAndYaw(&this->dyna.actor, play, actionIndex); } - } else if (Cutscene_CheckActorAction(play, DMOPSTAGE_GET_08(&this->dyna.actor) + 0x74)) { - Cutscene_ActorTranslateAndYaw(&this->dyna.actor, play, - Cutscene_GetActorActionIndex(play, DMOPSTAGE_GET_08(&this->dyna.actor) + 0x74)); + } else if (Cutscene_CheckActorAction(play, DMOPSTAGE_GET_ACTORACTION(&this->dyna.actor) + 0x74)) { + Cutscene_ActorTranslateAndYaw( + &this->dyna.actor, play, + Cutscene_GetActorActionIndex(play, DMOPSTAGE_GET_ACTORACTION(&this->dyna.actor) + 0x74)); } } @@ -92,6 +96,8 @@ void DmOpstage_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); if ((play->sceneNum == SCENE_SPOT00) && (gSaveContext.sceneSetupIndex == 0) && (play->csCtx.frames == 480)) { + // This actor is responsible for playing the fairy sound during the exposition in the intro, + // during the transition to Lost Woods, before Ocarina gets stolen. func_8019F128(NA_SE_EV_NAVY_FLY_REBIRTH); } } @@ -99,31 +105,34 @@ void DmOpstage_Update(Actor* thisx, PlayState* play) { void DmOpstage_Draw(Actor* thisx, PlayState* play) { DmOpstage* this = THIS; - if (DMOPSTAGE_GET_TYPE(&this->dyna.actor) > DM_OPSTAGE_TYPE_FLOOR) { - Matrix_Translate(this->dyna.actor.world.pos.x + this->pos.x, this->dyna.actor.world.pos.y + this->pos.y, - this->dyna.actor.world.pos.z + this->pos.z, MTXMODE_NEW); + if (DMOPSTAGE_GET_TYPE(&this->dyna.actor) > DMOPSTAGE_TYPE_GROUND) { + // Assumption: worldPos is being manipulated by cutscene + Matrix_Translate(this->dyna.actor.world.pos.x + this->drawOffset.x, + this->dyna.actor.world.pos.y + this->drawOffset.y, + this->dyna.actor.world.pos.z + this->drawOffset.z, MTXMODE_NEW); Matrix_RotateYS(this->dyna.actor.world.rot.y, MTXMODE_APPLY); Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY); } + switch (DMOPSTAGE_GET_TYPE(&this->dyna.actor)) { - case DM_OPSTAGE_TYPE_FLOOR: - Gfx_DrawDListOpa(play, object_keikoku_demo_DL_000978); - Gfx_DrawDListXlu(play, object_keikoku_demo_DL_000970); + case DMOPSTAGE_TYPE_GROUND: + Gfx_DrawDListOpa(play, gKeikokuDemoFloorDL); + Gfx_DrawDListXlu(play, gKeikokuDemoFloorEmptyDL); break; - case DM_OPSTAGE_TYPE_TREE1: - Gfx_DrawDListOpa(play, object_keikoku_demo_DL_002878); - Gfx_DrawDListXlu(play, object_keikoku_demo_DL_002870); + case DMOPSTAGE_TYPE_ROOT_TREE: + Gfx_DrawDListOpa(play, gKeikokuDemoTallTreeWithRootBaseDL); + Gfx_DrawDListXlu(play, gKeikokuDemoTallTreeWithRootBaseEmptyDL); break; - case DM_OPSTAGE_TYPE_TREE2: - Gfx_DrawDListOpa(play, object_keikoku_demo_DL_003068); - Gfx_DrawDListXlu(play, object_keikoku_demo_DL_003060); + case DMOPSTAGE_TYPE_CUT_TREE: + Gfx_DrawDListOpa(play, gKeikokuDemoTallTreeCutDL); + Gfx_DrawDListXlu(play, gKeikokuDemoTallTreeCutEmptyDL); break; - case DM_OPSTAGE_TYPE_TREE3: - Gfx_DrawDListOpa(play, object_keikoku_demo_DL_003728); - Gfx_DrawDListXlu(play, object_keikoku_demo_DL_003720); + case DMOPSTAGE_TYPE_STRAIGHT_TREE: + Gfx_DrawDListOpa(play, gKeikokuDemoTallTreeStraightDL); + Gfx_DrawDListXlu(play, gKeikokuDemoTallTreeStraightEmptyDL); break; } } diff --git a/src/overlays/actors/ovl_Dm_Opstage/z_dm_opstage.h b/src/overlays/actors/ovl_Dm_Opstage/z_dm_opstage.h index a8f4b0c607..073efa1bfe 100644 --- a/src/overlays/actors/ovl_Dm_Opstage/z_dm_opstage.h +++ b/src/overlays/actors/ovl_Dm_Opstage/z_dm_opstage.h @@ -3,26 +3,27 @@ #include "global.h" -#define DMOPSTAGE_GET_TYPE(thisx) (((thisx)->params & 0xFF)) -#define DMOPSTAGE_GET_08(thisx) (((thisx)->params >> 8) & 0xFF) +#define DMOPSTAGE_GET_TYPE(thisx) ((thisx)->params & 0xFF) +#define DMOPSTAGE_GET_ACTORACTION(thisx) (((thisx)->params >> 8) & 0xFF) struct DmOpstage; typedef void (*DmOpstageActionFunc)(struct DmOpstage*, PlayState*); + +typedef enum { + /* 0 */ DMOPSTAGE_TYPE_GROUND, + /* 1 */ DMOPSTAGE_TYPE_ROOT_TREE, + /* 2 */ DMOPSTAGE_TYPE_CUT_TREE, + /* 3 */ DMOPSTAGE_TYPE_STRAIGHT_TREE, +} DmOpStageTypes; + typedef struct DmOpstage { /* 0x000 */ DynaPolyActor dyna; /* 0x15C */ UNK_TYPE1 pad_15C[0x44]; /* 0x1A0 */ DmOpstageActionFunc actionFunc; - /* 0x1A4 */ Vec3f pos; + /* 0x1A4 */ Vec3f drawOffset; } DmOpstage; // size = 0x1B0 -typedef enum { - /* 0 */ DM_OPSTAGE_TYPE_FLOOR, - /* 1 */ DM_OPSTAGE_TYPE_TREE1, - /* 2 */ DM_OPSTAGE_TYPE_TREE2, - /* 3 */ DM_OPSTAGE_TYPE_TREE3, -} DmOpStageTypes; - extern const ActorInit Dm_Opstage_InitVars; #endif // Z_DM_OPSTAGE_H