diff --git a/spec b/spec index 8cba55b214..6740d7e1e8 100644 --- a/spec +++ b/spec @@ -2891,8 +2891,7 @@ beginseg name "ovl_Bg_Keikoku_Saku" compress include "build/src/overlays/actors/ovl_Bg_Keikoku_Saku/z_bg_keikoku_saku.o" - include "build/data/ovl_Bg_Keikoku_Saku/ovl_Bg_Keikoku_Saku.data.o" - include "build/data/ovl_Bg_Keikoku_Saku/ovl_Bg_Keikoku_Saku.reloc.o" + include "build/src/overlays/actors/ovl_Bg_Keikoku_Saku/ovl_Bg_Keikoku_Saku_reloc.o" endseg beginseg diff --git a/src/overlays/actors/ovl_Bg_Keikoku_Saku/z_bg_keikoku_saku.c b/src/overlays/actors/ovl_Bg_Keikoku_Saku/z_bg_keikoku_saku.c index 0e7488a9ab..24f18bb2f0 100644 --- a/src/overlays/actors/ovl_Bg_Keikoku_Saku/z_bg_keikoku_saku.c +++ b/src/overlays/actors/ovl_Bg_Keikoku_Saku/z_bg_keikoku_saku.c @@ -5,6 +5,7 @@ */ #include "z_bg_keikoku_saku.h" +#include "objects/object_keikoku_obj/object_keikoku_obj.h" #define FLAGS 0x00000000 @@ -15,7 +16,10 @@ void BgKeikokuSaku_Destroy(Actor* thisx, GlobalContext* globalCtx); void BgKeikokuSaku_Update(Actor* thisx, GlobalContext* globalCtx); void BgKeikokuSaku_Draw(Actor* thisx, GlobalContext* globalCtx); -#if 0 +void func_80A5389C(BgKeikokuSaku* this, GlobalContext* globalCtx); +void func_80A538E0(BgKeikokuSaku* this, GlobalContext* globalCtx); +void func_80A53994(BgKeikokuSaku* this, GlobalContext* globalCtx); + const ActorInit Bg_Keikoku_Saku_InitVars = { ACTOR_BG_KEIKOKU_SAKU, ACTORCAT_ITEMACTION, @@ -28,21 +32,71 @@ const ActorInit Bg_Keikoku_Saku_InitVars = { (ActorFunc)BgKeikokuSaku_Draw, }; -#endif +void BgKeikokuSaku_Init(Actor* thisx, GlobalContext* globalCtx) { + s32 pad; + BgKeikokuSaku* this = THIS; + CollisionHeader* colHeader = NULL; -extern UNK_TYPE D_06001640; -extern UNK_TYPE D_06002300; + DynaPolyActor_Init(&this->dyna, 0); + CollisionHeader_GetVirtual(&object_keikoku_obj_Colheader_002300, &colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->switchFlag = BGKEIKOKUSAKU_GET_SWITCHFLAG(thisx); + if (Flags_GetSwitch(globalCtx, this->switchFlag)) { + this->dyna.actor.world.pos.z = 2659.0f; + } else { + this->actionFunc = func_80A5389C; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Keikoku_Saku/BgKeikokuSaku_Init.s") +void BgKeikokuSaku_Destroy(Actor* thisx, GlobalContext* globalCtx) { + BgKeikokuSaku* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Keikoku_Saku/BgKeikokuSaku_Destroy.s") + DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Keikoku_Saku/func_80A5389C.s") +void func_80A5389C(BgKeikokuSaku* this, GlobalContext* globalCtx) { + if (Flags_GetSwitch(globalCtx, this->switchFlag)) { + this->actionFunc = func_80A538E0; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Keikoku_Saku/func_80A538E0.s") +void func_80A538E0(BgKeikokuSaku* this, GlobalContext* globalCtx) { + Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_METALGATE_OPEN - SFX_FLAG); + this->dyna.actor.world.pos.z -= 2.0f + BREG(8); + if (this->dyna.actor.world.pos.z < (BREG(9) + 2660.0f)) { + Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_BRIDGE_OPEN_STOP); + this->timer = 30; + this->actionFunc = func_80A53994; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Keikoku_Saku/func_80A53994.s") +void func_80A53994(BgKeikokuSaku* this, GlobalContext* globalCtx) { + if (this->timer == 0) { + this->actionFunc = func_80A5389C; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Keikoku_Saku/BgKeikokuSaku_Update.s") +void BgKeikokuSaku_Update(Actor* thisx, GlobalContext* globalCtx) { + BgKeikokuSaku* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Keikoku_Saku/BgKeikokuSaku_Draw.s") + if (this->timer) { + this->timer--; + } + this->dyna.actor.world.pos.x = BREG(5) + this->dyna.actor.home.pos.x; + this->dyna.actor.world.pos.y = BREG(6) + this->dyna.actor.home.pos.y; + this->dyna.actor.world.pos.z = BREG(7) + this->dyna.actor.home.pos.z; + this->dyna.actor.scale.x = (BREG(10) / 1000.0f) + 0.1f; + this->dyna.actor.scale.y = (BREG(11) / 1000.0f) + 0.1f; + this->dyna.actor.scale.z = (BREG(12) / 1000.0f) + 0.1f; + this->actionFunc(this, globalCtx); +} + +void BgKeikokuSaku_Draw(Actor* thisx, GlobalContext* globalCtx) { + OPEN_DISPS(globalCtx->state.gfxCtx); + + func_8012C2DC(globalCtx->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, object_keikoku_obj_DL_001640); + + CLOSE_DISPS(globalCtx->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_Bg_Keikoku_Saku/z_bg_keikoku_saku.h b/src/overlays/actors/ovl_Bg_Keikoku_Saku/z_bg_keikoku_saku.h index 6092edcb44..8fa6634609 100644 --- a/src/overlays/actors/ovl_Bg_Keikoku_Saku/z_bg_keikoku_saku.h +++ b/src/overlays/actors/ovl_Bg_Keikoku_Saku/z_bg_keikoku_saku.h @@ -3,17 +3,18 @@ #include "global.h" +#define BGKEIKOKUSAKU_GET_SWITCHFLAG(thisx) ((thisx)->params & 0x7F) + struct BgKeikokuSaku; typedef void (*BgKeikokuSakuActionFunc)(struct BgKeikokuSaku*, GlobalContext*); typedef struct BgKeikokuSaku { - /* 0x0000 */ Actor actor; - /* 0x0144 */ char unk_144[0x18]; - /* 0x015C */ BgKeikokuSakuActionFunc actionFunc; - /* 0x0160 */ char unk_160[0x4]; -} BgKeikokuSaku; // size = 0x164 - + /* 0x000 */ DynaPolyActor dyna; + /* 0x15C */ BgKeikokuSakuActionFunc actionFunc; + /* 0x160 */ s16 switchFlag; + /* 0x162 */ s16 timer; +} BgKeikokuSaku; // Size = 0x164 extern const ActorInit Bg_Keikoku_Saku_InitVars; #endif // Z_BG_KEIKOKU_SAKU_H diff --git a/undefined_syms.txt b/undefined_syms.txt index be8e812898..64a46e14c0 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -644,11 +644,6 @@ D_06012700 = 0x06012700; D_06012728 = 0x06012728; D_06012788 = 0x06012788; -// ovl_Bg_Keikoku_Saku - -D_06001640 = 0x06001640; -D_06002300 = 0x06002300; - // ovl_Bg_Kin2_Bombwall D_06000128 = 0x06000128;