summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEthan Roseman <ethteck@gmail.com>2020-03-22 17:56:08 -0400
committerEthan Roseman <ethteck@gmail.com>2020-03-22 17:56:08 -0400
commit80bced5204831599abbd81bc25cfd272b041a64f (patch)
treeba7c7d6c0bd421f1dbd4e8cde7214303ec58ace8 /src
parentb372169893f1e66654b03d9d39b44a59893da8ec (diff)
Decompiled ovl_Bg_Gate_Shutter
Diffstat (limited to 'src')
-rw-r--r--src/overlays/actors/ovl_Bg_Gate_Shutter/z_bg_gate_shutter.c134
-rw-r--r--src/overlays/actors/ovl_Bg_Gate_Shutter/z_bg_gate_shutter.h11
2 files changed, 129 insertions, 16 deletions
diff --git a/src/overlays/actors/ovl_Bg_Gate_Shutter/z_bg_gate_shutter.c b/src/overlays/actors/ovl_Bg_Gate_Shutter/z_bg_gate_shutter.c
index baa83eb80..89d663788 100644
--- a/src/overlays/actors/ovl_Bg_Gate_Shutter/z_bg_gate_shutter.c
+++ b/src/overlays/actors/ovl_Bg_Gate_Shutter/z_bg_gate_shutter.c
@@ -1,14 +1,26 @@
+/*
+ * File: z_bg_gate_shutter.c
+ * Overlay: Bg_Gate_Shutter
+ * Description:
+*/
+
#include "z_bg_gate_shutter.h"
+#include <vt.h>
+
#define ROOM 0x00
#define FLAGS 0x00000000
-void BgGateShutter_Init(BgGateShutter* this, GlobalContext* globalCtx);
-void BgGateShutter_Destroy(BgGateShutter* this, GlobalContext* globalCtx);
-void BgGateShutter_Update(BgGateShutter* this, GlobalContext* globalCtx);
-void BgGateShutter_Draw(BgGateShutter* this, GlobalContext* globalCtx);
+static void BgGateShutter_Init(BgGateShutter* this, GlobalContext* globalCtx);
+static void BgGateShutter_Destroy(BgGateShutter* this, GlobalContext* globalCtx);
+static void BgGateShutter_Update(BgGateShutter* this, GlobalContext* globalCtx);
+static void BgGateShutter_Draw(BgGateShutter* this, GlobalContext* globalCtx);
+
+static void func_8087828C(BgGateShutter* this, GlobalContext* globalCtx);
+static void func_80878300(BgGateShutter* this, GlobalContext* globalCtx);
+static void func_808783AC(BgGateShutter* this, GlobalContext* globalCtx);
+static void func_808783D4(BgGateShutter* this, GlobalContext* globalCtx);
-/*
const ActorInit Bg_Gate_Shutter_InitVars =
{
ACTOR_BG_GATE_SHUTTER,
@@ -22,19 +34,113 @@ const ActorInit Bg_Gate_Shutter_InitVars =
(ActorFunc)BgGateShutter_Update,
(ActorFunc)BgGateShutter_Draw,
};
-*/
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Gate_Shutter/BgGateShutter_Init.s")
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Gate_Shutter/BgGateShutter_Destroy.s")
+extern UNK_PTR D_06001CD0;
+extern UNK_PTR D_06001DA8;
+
+static void BgGateShutter_Init(BgGateShutter* this, GlobalContext* globalCtx) {
+ s32 pad[2];
+ Actor* thisx = &this->dyna.actor;
+ s32 local_c = 0;
+
+ DynaPolyInfo_SetActorMove(thisx, 0);
+ DynaPolyInfo_Alloc(&D_06001DA8, &local_c);
+ this->dyna.dynaPolyId = DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, thisx, local_c);
+ this->somePosX = thisx->posRot.pos.x;
+ this->somePosY = thisx->posRot.pos.y;
+ this->somePosZ = thisx->posRot.pos.z;
+ if ((gSaveContext.inf_table[7] & 0x40) || (gSaveContext.event_chk_inf[4] & 0x20)) {
+ if (globalCtx->sceneNum == SCENE_SPOT01) {
+ thisx->posRot.pos.x = -89.0f;
+ thisx->posRot.pos.z = -1375.0f;
+ }
+ }
+ thisx->scale.x = 1.0f;
+ thisx->scale.y = 1.0f;
+ thisx->scale.z = 1.0f;
+ osSyncPrintf("\n\n");
+ osSyncPrintf(VT_FGCOL(GREEN) " ☆☆☆☆☆ 柵でたなぁ ☆☆☆☆☆ \n" VT_RST);
+ this->actionFunc = (ActorFunc)func_8087828C;
+}
+
+static void BgGateShutter_Destroy(BgGateShutter* this, GlobalContext* globalCtx) {
+ DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId);
+}
+
+static void func_8087828C(BgGateShutter* this, GlobalContext* globalCtx) {
+ if (this->unk_168 == 1) {
+ if (!(gSaveContext.inf_table[7] & 0x40)) {
+ this->unk_178 = 2;
+ this->actionFunc = (ActorFunc)func_80878300;
+ return;
+ }
+ }
+ if (this->unk_168 == 2) {
+ this->unk_178 = 2;
+ this->actionFunc = (ActorFunc)func_80878300;
+ return;
+ }
+ if (this->unk_168 < 0) {
+ this->unk_178 = 2;
+ this->actionFunc = (ActorFunc)func_808783D4;
+ }
+}
+
+static void func_80878300(BgGateShutter* this, GlobalContext* globalCtx) {
+ Actor* thisx = &this->dyna.actor;
+
+ if (this->unk_178 == 0) {
+ Audio_PlayActorSound2(thisx, 0x2067);
+ thisx->posRot.pos.x -= 2.0f;
+ Math_SmoothScaleMaxF(&thisx->posRot.pos.z, -1375.0f, 0.8f, 0.3f);
+ if (thisx->posRot.pos.x < -89.0f) {
+ Audio_PlayActorSound2(thisx, NA_SE_EV_BRIDGE_OPEN_STOP);
+ this->unk_178 = 0x1E;
+ this->actionFunc = (ActorFunc)func_808783AC;
+ }
+ }
+}
+
+static void func_808783AC(BgGateShutter* this, GlobalContext* globalCtx) {
+ if (this->unk_178 == 0) {
+ this->unk_168 = 0;
+ this->actionFunc = (ActorFunc)func_8087828C;
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Gate_Shutter/func_8087828C.s")
+static void func_808783D4(BgGateShutter* this, GlobalContext* globalCtx) {
+ Actor* thisx = &this->dyna.actor;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Gate_Shutter/func_80878300.s")
+ if (this->unk_178 == 0) {
+ Audio_PlayActorSound2(thisx, 0x2067);
+ thisx->posRot.pos.x += 2.0f;
+ Math_SmoothScaleMaxF(&thisx->posRot.pos.z, -1350.0f, 0.8f, 0.3f);
+ if (thisx->posRot.pos.x > 90.0f) {
+ thisx->posRot.pos.x = 91.0f;
+ Audio_PlayActorSound2(thisx, NA_SE_EV_BRIDGE_OPEN_STOP);
+ this->unk_178 = 30;
+ this->actionFunc = (ActorFunc)func_808783AC;
+ }
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Gate_Shutter/func_808783AC.s")
+static void BgGateShutter_Update(BgGateShutter* this, GlobalContext* globalCtx) {
+ if (this->unk_178 != 0) {
+ this->unk_178 -= 1;
+ }
+ this->actionFunc(this, globalCtx);
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Gate_Shutter/func_808783D4.s")
+static void BgGateShutter_Draw(BgGateShutter* this, GlobalContext* globalCtx) {
+ GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
+ Gfx* gfxArr[4];
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Gate_Shutter/BgGateShutter_Update.s")
+ func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_bg_gate_shutter.c", 323);
+ func_80093D18(globalCtx->state.gfxCtx);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Gate_Shutter/BgGateShutter_Draw.s")
+ gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_gate_shutter.c", 328),
+ G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPDisplayList(gfxCtx->polyOpa.p++, &D_06001CD0);
+
+ func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_bg_gate_shutter.c", 333);
+}
diff --git a/src/overlays/actors/ovl_Bg_Gate_Shutter/z_bg_gate_shutter.h b/src/overlays/actors/ovl_Bg_Gate_Shutter/z_bg_gate_shutter.h
index 0ba1fccc8..a567112cf 100644
--- a/src/overlays/actors/ovl_Bg_Gate_Shutter/z_bg_gate_shutter.h
+++ b/src/overlays/actors/ovl_Bg_Gate_Shutter/z_bg_gate_shutter.h
@@ -6,8 +6,15 @@
typedef struct
{
- /* 0x0000 */ Actor actor;
- /* 0x014C */ char unk_14C[0x30];
+ /* 0x0000 */ DynaPolyActor dyna;
+ /* 0x0164 */ ActorFunc actionFunc;
+ /* 0x0168 */ s16 unk_168;
+ /* 0x016A */ char unk_16A[0x2];
+ /* 0x016C */ f32 somePosX;
+ /* 0x0170 */ f32 somePosY;
+ /* 0x0174 */ f32 somePosZ;
+ /* 0x0178 */ s16 unk_178;
+ /* 0x017A */ char unk_17A[0x2];
} BgGateShutter; // size = 0x017C
extern const ActorInit Bg_Gate_Shutter_InitVars;