diff options
| author | fig02 <fig02srl@gmail.com> | 2020-03-25 11:39:04 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-03-25 11:39:04 -0400 |
| commit | 50dd042189682ff476f60fd45829db3bbf0d69e6 (patch) | |
| tree | 628fa0f24d957f21df4fbc316fc57fe4ca9fd0a4 /src | |
| parent | 80b0f9b5fefa6a08238d01a1e65805958740b9d3 (diff) | |
| parent | 7376fe5cad441ab6635d05dd017a7f3ce79e3916 (diff) | |
Merge pull request #36 from ethteck/ovl_Bg_Spot12_Gate
Decompiled ovl_Bg_Spot12_Gate
Diffstat (limited to 'src')
| -rw-r--r-- | src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.c | 136 | ||||
| -rw-r--r-- | src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.h | 5 |
2 files changed, 120 insertions, 21 deletions
diff --git a/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.c b/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.c index 65f8e8ef0..f8a190be0 100644 --- a/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.c +++ b/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.c @@ -1,14 +1,28 @@ +/* + * File: z_bg_spot12_gate.c + * Overlay: Bg_Spot12_Gate + * Description: + */ + #include "z_bg_spot12_gate.h" #define ROOM 0x00 #define FLAGS 0x00000000 -void BgSpot12Gate_Init(BgSpot12Gate* this, GlobalContext* globalCtx); -void BgSpot12Gate_Destroy(BgSpot12Gate* this, GlobalContext* globalCtx); -void BgSpot12Gate_Update(BgSpot12Gate* this, GlobalContext* globalCtx); -void BgSpot12Gate_Draw(BgSpot12Gate* this, GlobalContext* globalCtx); +static void BgSpot12Gate_Init(BgSpot12Gate* this, GlobalContext* globalCtx); +static void BgSpot12Gate_Destroy(BgSpot12Gate* this, GlobalContext* globalCtx); +static void BgSpot12Gate_Update(BgSpot12Gate* this, GlobalContext* globalCtx); +static void BgSpot12Gate_Draw(BgSpot12Gate* this, GlobalContext* globalCtx); + +static void func_808B30C0(BgSpot12Gate* this); +static void func_808B30D8(BgSpot12Gate* this, GlobalContext* globalCtx); +static void func_808B3134(BgSpot12Gate* this); +static void func_808B314C(BgSpot12Gate* this, GlobalContext* globalCtx); +static void func_808B317C(BgSpot12Gate* this); +static void func_808B318C(BgSpot12Gate* this, GlobalContext* globalCtx); +static void func_808B3274(BgSpot12Gate* this); +static void func_808B3298(BgSpot12Gate* this, GlobalContext* globalCtx); -/* const ActorInit Bg_Spot12_Gate_InitVars = { ACTOR_BG_SPOT12_GATE, ACTORTYPE_BG, @@ -21,29 +35,113 @@ const ActorInit Bg_Spot12_Gate_InitVars = { (ActorFunc)BgSpot12Gate_Update, (ActorFunc)BgSpot12Gate_Draw, }; -*/ -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B2F90.s") -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/BgSpot12Gate_Init.s") +static InitChainEntry initChain[] = { + ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_CONTINUE), + ICHAIN_F32(unk_F4, 2500, ICHAIN_CONTINUE), + ICHAIN_F32(unk_F8, 500, ICHAIN_CONTINUE), + ICHAIN_F32(unk_FC, 1200, ICHAIN_STOP), +}; + +extern UNK_TYPE D_06001080; +extern UNK_TYPE D_060011EC; + +static void func_808B2F90(BgSpot12Gate* this, GlobalContext* globalCtx, UNK_TYPE collision, DynaPolyMoveFlag flags) { + Actor* thisx = &this->dyna.actor; + s32 localC = 0; + s32 pad[2]; + + DynaPolyInfo_SetActorMove(thisx, flags); + DynaPolyInfo_Alloc(collision, &localC); + this->dyna.dynaPolyId = DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, thisx, localC); + if (this->dyna.dynaPolyId == 0x32) { + osSyncPrintf("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_spot12_gate.c", 145, + thisx->id, thisx->params); + } +} + +static void BgSpot12Gate_Init(BgSpot12Gate* this, GlobalContext* globalCtx) { + Actor* thisx = &this->dyna.actor; + + func_808B2F90(this, globalCtx, &D_060011EC, 0); + Actor_ProcessInitChain(thisx, initChain); + + if (Flags_GetSwitch(globalCtx, thisx->params & 0x3F)) { + func_808B3274(this); + } else { + func_808B30C0(this); + } +} + +static void BgSpot12Gate_Destroy(BgSpot12Gate* this, GlobalContext* globalCtx) { + DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId); +} + +static void func_808B30C0(BgSpot12Gate* this) { + Actor* thisx = &this->dyna.actor; + + this->actionFunc = (ActorFunc)func_808B30D8; + thisx->posRot.pos.y = thisx->initPosRot.pos.y; +} + +static void func_808B30D8(BgSpot12Gate* this, GlobalContext* globalCtx) { + Actor* thisx = &this->dyna.actor; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/BgSpot12Gate_Destroy.s") + if (Flags_GetSwitch(globalCtx, thisx->params & 0x3F)) { + func_808B3134(this); + func_800800F8(globalCtx, 0x1040, -0x63, thisx, 0); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B30C0.s") +static void func_808B3134(BgSpot12Gate* this) { + this->actionFunc = (ActorFunc)func_808B314C; + this->unk_168 = 0x28; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B30D8.s") +static void func_808B314C(BgSpot12Gate* this, GlobalContext* globalCtx) { + if (this->unk_168 <= 0) { + func_808B317C(this); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B3134.s") +static void func_808B317C(BgSpot12Gate* this) { + this->actionFunc = (ActorFunc)func_808B318C; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B314C.s") +static void func_808B318C(BgSpot12Gate* this, GlobalContext* globalCtx) { + Actor* thisx = &this->dyna.actor; + s32 var; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B317C.s") + Math_ApproxF(&thisx->velocity.y, 1.6f, 0.03f); + if (Math_ApproxF(&thisx->posRot.pos.y, thisx->initPosRot.pos.y + 200.0f, thisx->velocity.y)) { + func_808B3274(this); + var = func_80092F88(globalCtx->cameraCtx.activeCameraPtrs[globalCtx->cameraCtx.unk_5C0], 3); + func_80092DAC(var, -0x3CB0); + func_80092E70(var, 3, 0, 0, 0); + func_80092DF0(var, 0xC); + Audio_PlayActorSound2(thisx, NA_SE_EV_BRIDGE_OPEN_STOP); + } else { + func_8002F974(thisx, 0x2067); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B318C.s") +static void func_808B3274(BgSpot12Gate* this) { + Actor* thisx = &this->dyna.actor; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B3274.s") + this->actionFunc = (ActorFunc)func_808B3298; + thisx->posRot.pos.y = thisx->initPosRot.pos.y + 200.0f; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B3298.s") +static void func_808B3298(BgSpot12Gate* this, GlobalContext* globalCtx) { +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/BgSpot12Gate_Update.s") +static void BgSpot12Gate_Update(BgSpot12Gate* this, GlobalContext* globalCtx) { + if (this->unk_168 > 0) { + this->unk_168 -= 1; + } + this->actionFunc(this, globalCtx); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/BgSpot12Gate_Draw.s") +static void BgSpot12Gate_Draw(BgSpot12Gate* this, GlobalContext* globalCtx) { + Draw_DListOpa(globalCtx, &D_06001080); +} diff --git a/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.h b/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.h index 3a6d11ba2..9ba6dc086 100644 --- a/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.h +++ b/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.h @@ -5,8 +5,9 @@ #include <global.h> typedef struct { - /* 0x0000 */ Actor actor; - /* 0x014C */ char unk_14C[0x20]; + /* 0x0000 */ DynaPolyActor dyna; + /* 0x0164 */ ActorFunc actionFunc; + /* 0x0168 */ s16 unk_168; } BgSpot12Gate; // size = 0x016C extern const ActorInit Bg_Spot12_Gate_InitVars; |
