summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEthan Roseman <ethteck@gmail.com>2020-10-12 20:44:22 -0400
committerGitHub <noreply@github.com>2020-10-12 20:44:22 -0400
commit08c4065a5e940d9ace0fff90d2818ed5788cb2ec (patch)
treee52ed0df3f25e432b2fda9b5f1c52da4db87d290 /src
parent5c631e31703df73c366c83f0bacc84edce2b7f6f (diff)
Decompiled ovl_Bg_Haka_MeganeBG (#448)
Diffstat (limited to 'src')
-rw-r--r--src/code/z_play.c2
-rw-r--r--src/code/z_prenmi.c2
-rw-r--r--src/code/z_sample.c2
-rw-r--r--src/overlays/actors/ovl_Bg_Gnd_Soulmeiro/z_bg_gnd_soulmeiro.c9
-rw-r--r--src/overlays/actors/ovl_Bg_Haka_MeganeBG/z_bg_haka_meganebg.c217
-rw-r--r--src/overlays/actors/ovl_Bg_Haka_MeganeBG/z_bg_haka_meganebg.h5
-rw-r--r--src/overlays/gamestates/ovl_opening/z_opening.c2
-rw-r--r--src/overlays/gamestates/ovl_select/z_select.c2
8 files changed, 207 insertions, 34 deletions
diff --git a/src/code/z_play.c b/src/code/z_play.c
index bbb77f7da..e9d964f7e 100644
--- a/src/code/z_play.c
+++ b/src/code/z_play.c
@@ -1332,7 +1332,7 @@ void Gameplay_Draw(GlobalContext* globalCtx) {
void Gameplay_Main(GameState* thisx) {
GlobalContext* globalCtx = (GlobalContext*)thisx;
-
+
D_8012D1F8 = &globalCtx->state.input[0];
DebugDisplay_Init();
diff --git a/src/code/z_prenmi.c b/src/code/z_prenmi.c
index 8de5bd213..985b1d3f2 100644
--- a/src/code/z_prenmi.c
+++ b/src/code/z_prenmi.c
@@ -41,7 +41,7 @@ void PreNMI_Draw(PreNMIContext* this) {
void PreNMI_Main(GameState* thisx) {
PreNMIContext* this = (PreNMIContext*)thisx;
-
+
PreNMI_Update(this);
PreNMI_Draw(this);
diff --git a/src/code/z_sample.c b/src/code/z_sample.c
index 7df885439..65e3cee20 100644
--- a/src/code/z_sample.c
+++ b/src/code/z_sample.c
@@ -87,7 +87,7 @@ void Sample_LoadTitleStatic(SampleContext* this) {
void Sample_Init(GameState* thisx) {
SampleContext* this = (SampleContext*)thisx;
-
+
this->state.main = Sample_Main;
this->state.destroy = Sample_Destroy;
R_UPDATE_RATE = 1;
diff --git a/src/overlays/actors/ovl_Bg_Gnd_Soulmeiro/z_bg_gnd_soulmeiro.c b/src/overlays/actors/ovl_Bg_Gnd_Soulmeiro/z_bg_gnd_soulmeiro.c
index 59b56620a..0dd69cefb 100644
--- a/src/overlays/actors/ovl_Bg_Gnd_Soulmeiro/z_bg_gnd_soulmeiro.c
+++ b/src/overlays/actors/ovl_Bg_Gnd_Soulmeiro/z_bg_gnd_soulmeiro.c
@@ -47,7 +47,6 @@ static InitChainEntry sInitChain[] = {
static Vec3f sZeroVec = { 0.0f, 0.0f, 0.0f };
-
Gfx* D_8087B578[] = { 0x06007C00, 0x06002320, 0x060035A0 };
void BgGndSoulmeiro_Init(Actor* thisx, GlobalContext* globalCtx) {
@@ -124,7 +123,7 @@ void func_8087AF38(BgGndSoulmeiro* this, GlobalContext* globalCtx) {
if (1) {}
- if ((this->unk_198 % 6) == 0) {
+ if ((this->unk_198 % 6) == 0) {
temp_2 = Math_Rand_ZeroOne() * (10922.0f); // This should be: 0x10000 / 6.0f
vecA.y = 0.0f;
vecB.y = this->actor.posRot.pos.y;
@@ -136,7 +135,7 @@ void func_8087AF38(BgGndSoulmeiro* this, GlobalContext* globalCtx) {
temp_4 = Math_Coss(temp_1);
vecB.x = this2->actor.posRot.pos.x + (120.0f * temp_3);
vecB.z = this2->actor.posRot.pos.z + (120.0f * temp_4);
- distXZ = Math_Vec3f_DistXZ(&this2->actor.initPosRot.pos, &vecB) * (1.0f / 120.f);
+ distXZ = Math_Vec3f_DistXZ(&this2->actor.initPosRot.pos, &vecB) * (1.0f / 120.f);
if (distXZ < 0.7f) {
temp_3 = Math_Sins(temp_1 + 0x8000);
temp_4 = Math_Coss(temp_1 + 0x8000);
@@ -148,8 +147,8 @@ void func_8087AF38(BgGndSoulmeiro* this, GlobalContext* globalCtx) {
vecA.x = 4.0f * temp_3 * distXZ;
vecA.y = 0.0f;
vecA.z = 4.0f * temp_4 * distXZ;
- EffectSsDeadDb_Spawn(globalCtx, &this->actor.initPosRot.pos, &vecA, &sZeroVec, 60, 6, 255, 255, 150,
- 170, 255, 0, 0, 1, 14, true);
+ EffectSsDeadDb_Spawn(globalCtx, &this->actor.initPosRot.pos, &vecA, &sZeroVec, 60, 6, 255, 255, 150, 170,
+ 255, 0, 0, 1, 14, true);
temp_2 += 0x2AAA;
}
}
diff --git a/src/overlays/actors/ovl_Bg_Haka_MeganeBG/z_bg_haka_meganebg.c b/src/overlays/actors/ovl_Bg_Haka_MeganeBG/z_bg_haka_meganebg.c
index f91ab1682..087d2f899 100644
--- a/src/overlays/actors/ovl_Bg_Haka_MeganeBG/z_bg_haka_meganebg.c
+++ b/src/overlays/actors/ovl_Bg_Haka_MeganeBG/z_bg_haka_meganebg.c
@@ -1,3 +1,9 @@
+/*
+ * File: z_bg_haka_meganebg.c
+ * Overlay: ovl_Bg_Haka_MeganeBG
+ * Description:
+ */
+
#include "z_bg_haka_meganebg.h"
#define FLAGS 0x00000000
@@ -9,12 +15,15 @@ void BgHakaMeganeBG_Destroy(Actor* thisx, GlobalContext* globalCtx);
void BgHakaMeganeBG_Update(Actor* thisx, GlobalContext* globalCtx);
void BgHakaMeganeBG_Draw(Actor* thisx, GlobalContext* globalCtx);
+void func_8087DFF8(BgHakaMeganeBG* this, GlobalContext* globalCtx);
+void func_8087E040(BgHakaMeganeBG* this, GlobalContext* globalCtx);
+void func_8087E10C(BgHakaMeganeBG* this, GlobalContext* globalCtx);
+void func_8087E1E0(BgHakaMeganeBG* this, GlobalContext* globalCtx);
void func_8087E258(BgHakaMeganeBG* this, GlobalContext* globalCtx);
void func_8087E288(BgHakaMeganeBG* this, GlobalContext* globalCtx);
void func_8087E2D8(BgHakaMeganeBG* this, GlobalContext* globalCtx);
void func_8087E34C(BgHakaMeganeBG* this, GlobalContext* globalCtx);
-/*
const ActorInit Bg_Haka_MeganeBG_InitVars = {
ACTOR_BG_HAKA_MEGANEBG,
ACTORTYPE_BG,
@@ -26,27 +35,193 @@ const ActorInit Bg_Haka_MeganeBG_InitVars = {
(ActorFunc)BgHakaMeganeBG_Update,
(ActorFunc)BgHakaMeganeBG_Draw,
};
-*/
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Haka_MeganeBG/BgHakaMeganeBG_Init.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Haka_MeganeBG/BgHakaMeganeBG_Destroy.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Haka_MeganeBG/func_8087DFF8.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Haka_MeganeBG/func_8087E040.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Haka_MeganeBG/func_8087E10C.s")
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Haka_MeganeBG/func_8087E1E0.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Haka_MeganeBG/func_8087E258.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Haka_MeganeBG/func_8087E288.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Haka_MeganeBG/func_8087E2D8.s")
+static InitChainEntry sInitChain[] = {
+ ICHAIN_F32(uncullZoneScale, 1000, ICHAIN_CONTINUE),
+ ICHAIN_F32(uncullZoneDownward, 1000, ICHAIN_CONTINUE),
+ ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP),
+};
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Haka_MeganeBG/func_8087E34C.s")
+// Unused
+static u32 D_8087E3FC[] = {
+ 0x00000000, 0x00000000, 0x00000000, 0xC8C800FF, 0xFF0000FF,
+};
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Haka_MeganeBG/BgHakaMeganeBG_Update.s")
+static Gfx* D_8087E410[] = {
+ 0x06008EB0,
+ 0x0600A1A0,
+ 0x06005000,
+ 0x06000040,
+};
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Haka_MeganeBG/BgHakaMeganeBG_Draw.s")
+extern UNK_TYPE D_06000118;
+extern UNK_TYPE D_06005334;
+extern Gfx D_06008EB0[];
+extern UNK_TYPE D_06009168;
+extern UNK_TYPE D_0600A7F4;
+
+void BgHakaMeganeBG_Init(Actor* thisx, GlobalContext* globalCtx) {
+ s32 pad;
+ BgHakaMeganeBG* this = THIS;
+ s32 localC = 0;
+
+ Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
+ this->unk_168 = (thisx->params >> 8) & 0xFF;
+ thisx->params &= 0xFF;
+
+ if (thisx->params == 2) {
+ DynaPolyInfo_SetActorMove(&this->dyna, 3);
+ thisx->flags |= 0x10;
+ DynaPolyInfo_Alloc(&D_06005334, &localC);
+ this->actionFunc = func_8087E258;
+ } else {
+ DynaPolyInfo_SetActorMove(&this->dyna, 1);
+
+ if (thisx->params == 0) {
+ DynaPolyInfo_Alloc(&D_06009168, &localC);
+ thisx->flags |= 0x80;
+ this->unk_16A = 20;
+ this->actionFunc = func_8087DFF8;
+ } else if (thisx->params == 3) {
+ DynaPolyInfo_Alloc(&D_06000118, &localC);
+ thisx->initPosRot.pos.y += 100.0f;
+
+ if (Flags_GetSwitch(globalCtx, this->unk_168)) {
+ this->actionFunc = func_8087E34C;
+ thisx->posRot.pos.y = thisx->initPosRot.pos.y;
+ } else {
+ thisx->flags |= 0x10;
+ this->actionFunc = func_8087E288;
+ }
+ } else {
+ DynaPolyInfo_Alloc(&D_0600A7F4, &localC);
+ this->unk_16A = 80;
+ this->actionFunc = func_8087E10C;
+ thisx->uncullZoneScale = 3000.0f;
+ thisx->uncullZoneDownward = 3000.0f;
+ }
+ }
+
+ this->dyna.dynaPolyId = DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, localC);
+}
+
+void BgHakaMeganeBG_Destroy(Actor* thisx, GlobalContext* globalCtx) {
+ BgHakaMeganeBG* this = THIS;
+
+ DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId);
+}
+
+void func_8087DFF8(BgHakaMeganeBG* this, GlobalContext* globalCtx) {
+ if (this->unk_16A != 0) {
+ this->unk_16A--;
+ }
+
+ if (this->unk_16A == 0) {
+ this->unk_16A = 40;
+ this->dyna.actor.posRot.rot.y += 0x8000;
+ this->actionFunc = func_8087E040;
+ }
+}
+
+void func_8087E040(BgHakaMeganeBG* this, GlobalContext* globalCtx) {
+ f32 xSub;
+
+ if (this->unk_16A != 0) {
+ this->unk_16A--;
+ }
+
+ xSub = (sinf(((this->unk_16A * 0.025f) + 0.5f) * M_PI) + 1.0f) * 160.0f;
+
+ if (this->dyna.actor.posRot.rot.y != this->dyna.actor.shape.rot.y) {
+ xSub = 320.0f - xSub;
+ }
+
+ this->dyna.actor.posRot.pos.x = this->dyna.actor.initPosRot.pos.x - xSub;
+
+ if (this->unk_16A == 0) {
+ this->unk_16A = 20;
+ this->actionFunc = func_8087DFF8;
+ }
+}
+
+void func_8087E10C(BgHakaMeganeBG* this, GlobalContext* globalCtx) {
+ this->dyna.actor.velocity.y += 1.0f;
+
+ if (this->dyna.actor.velocity.y > 20.0f) {
+ this->dyna.actor.velocity.y = 20.0f;
+ } else {
+ this->dyna.actor.velocity.y = this->dyna.actor.velocity.y;
+ }
+
+ if (this->unk_16A != 0) {
+ this->unk_16A--;
+ }
+
+ if (!Math_ApproxF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y - 640.0f,
+ this->dyna.actor.velocity.y)) {
+ func_8002F974(&this->dyna.actor, NA_SE_EV_CHINETRAP_DOWN - SFX_FLAG);
+ }
+
+ if (this->unk_16A == 0) {
+ this->unk_16A = 120;
+ this->actionFunc = func_8087E1E0;
+ this->dyna.actor.velocity.y = 0.0f;
+ }
+}
+
+void func_8087E1E0(BgHakaMeganeBG* this, GlobalContext* globalCtx) {
+ Math_ApproxF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y, 16.0f / 3.0f);
+ func_8002F974(&this->dyna.actor, NA_SE_EV_BRIDGE_CLOSE - SFX_FLAG);
+
+ if (this->unk_16A != 0) {
+ this->unk_16A--;
+ }
+
+ if (this->unk_16A == 0) {
+ this->unk_16A = 80;
+ this->actionFunc = func_8087E10C;
+ }
+}
+
+void func_8087E258(BgHakaMeganeBG* this, GlobalContext* globalCtx) {
+ this->dyna.actor.shape.rot.y += 0x180;
+ func_8002F974(&this->dyna.actor, NA_SE_EV_ELEVATOR_MOVE - SFX_FLAG);
+}
+
+void func_8087E288(BgHakaMeganeBG* this, GlobalContext* globalCtx) {
+ if (Flags_GetSwitch(globalCtx, this->unk_168)) {
+ func_80080480(globalCtx, &this->dyna.actor);
+ this->actionFunc = func_8087E2D8;
+ }
+}
+
+void func_8087E2D8(BgHakaMeganeBG* this, GlobalContext* globalCtx) {
+ Math_ApproxF(&this->dyna.actor.speedXZ, 30.0f, 2.0f);
+
+ if (Math_ApproxF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y, this->dyna.actor.speedXZ)) {
+ Actor_SetHeight(&this->dyna.actor, 50.0f);
+ this->actionFunc = func_8087E34C;
+ } else {
+ func_8002F974(&this->dyna.actor, NA_SE_EV_METALDOOR_OPEN);
+ }
+}
+
+void func_8087E34C(BgHakaMeganeBG* this, GlobalContext* globalCtx) {
+}
+
+void BgHakaMeganeBG_Update(Actor* thisx, GlobalContext* globalCtx) {
+ BgHakaMeganeBG* this = THIS;
+
+ this->actionFunc(this, globalCtx);
+}
+
+void BgHakaMeganeBG_Draw(Actor* thisx, GlobalContext* globalCtx) {
+ BgHakaMeganeBG* this = THIS;
+ s16 params = this->dyna.actor.params;
+
+ if (params == 0) {
+ Gfx_DrawDListXlu(globalCtx, D_06008EB0);
+ } else {
+ Gfx_DrawDListOpa(globalCtx, D_8087E410[params]);
+ }
+}
diff --git a/src/overlays/actors/ovl_Bg_Haka_MeganeBG/z_bg_haka_meganebg.h b/src/overlays/actors/ovl_Bg_Haka_MeganeBG/z_bg_haka_meganebg.h
index f407928cc..9c882a07c 100644
--- a/src/overlays/actors/ovl_Bg_Haka_MeganeBG/z_bg_haka_meganebg.h
+++ b/src/overlays/actors/ovl_Bg_Haka_MeganeBG/z_bg_haka_meganebg.h
@@ -11,9 +11,8 @@ typedef void (*BgHakaMeganeBGActionFunc)(struct BgHakaMeganeBG*, GlobalContext*)
typedef struct BgHakaMeganeBG {
/* 0x0000 */ DynaPolyActor dyna;
/* 0x0164 */ BgHakaMeganeBGActionFunc actionFunc;
- /* 0x0168 */ char unk_168[0x1];
- /* 0x0169 */ s8 unk_169; // objBankIndex ?
- /* 0x016A */ char unk_16A[0x2];
+ /* 0x0168 */ u8 unk_168;
+ /* 0x016A */ s16 unk_16A;
} BgHakaMeganeBG; // size = 0x016C
extern const ActorInit Bg_Haka_Meganebg_InitVars;
diff --git a/src/overlays/gamestates/ovl_opening/z_opening.c b/src/overlays/gamestates/ovl_opening/z_opening.c
index 9c29d880b..fa8ce9060 100644
--- a/src/overlays/gamestates/ovl_opening/z_opening.c
+++ b/src/overlays/gamestates/ovl_opening/z_opening.c
@@ -32,7 +32,7 @@ void Opening_Destroy(GameState* thisx) {
void Opening_Init(GameState* thisx) {
OpeningContext* this = (OpeningContext*)thisx;
-
+
R_UPDATE_RATE = 1;
Matrix_Init(&this->state);
View_Init(&this->view, this->state.gfxCtx);
diff --git a/src/overlays/gamestates/ovl_select/z_select.c b/src/overlays/gamestates/ovl_select/z_select.c
index 2a7d03d4f..6e34499cb 100644
--- a/src/overlays/gamestates/ovl_select/z_select.c
+++ b/src/overlays/gamestates/ovl_select/z_select.c
@@ -568,7 +568,7 @@ void Select_Draw(SelectContext* this) {
void Select_Main(GameState* thisx) {
SelectContext* this = (SelectContext*)thisx;
-
+
Select_UpdateMenu(this);
Select_Draw(this);
}