summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEthan Roseman <ethteck@gmail.com>2021-02-15 14:33:41 -0500
committerGitHub <noreply@github.com>2021-02-15 14:33:41 -0500
commitecedc4f059bf04a1e5f2daa24001de41c905f287 (patch)
tree2c56c1bfa9bba4ec7f15ad70ca0c775670b4b6e0 /src
parent982c645167262f98869f05ee6b422010d0d2b60d (diff)
Decompiled ovl_Bg_Hidan_Hrock (#690)
* Fixing mkldscript.c for mac * 1 to go * merge update * almost * small update * updating API with master * NON_MATCHING * names of vars * almost matching Signed-off-by: angie <angheloalf95@gmail.com> * BgHidanHrock_Init matching Signed-off-by: Anghelo <angheloalf95@gmail.com> * renames * format * PR suggestions Co-authored-by: angie <angheloalf95@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/overlays/actors/ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.c180
-rw-r--r--src/overlays/actors/ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.h10
2 files changed, 175 insertions, 15 deletions
diff --git a/src/overlays/actors/ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.c b/src/overlays/actors/ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.c
index ff9ddc313..bc67de48b 100644
--- a/src/overlays/actors/ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.c
+++ b/src/overlays/actors/ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.c
@@ -15,9 +15,13 @@ void BgHidanHrock_Destroy(Actor* thisx, GlobalContext* globalCtx);
void BgHidanHrock_Update(Actor* thisx, GlobalContext* globalCtx);
void BgHidanHrock_Draw(Actor* thisx, GlobalContext* globalCtx);
+void func_8088960C(BgHidanHrock* this, GlobalContext* globalCtx);
+void func_808896B8(BgHidanHrock* this, GlobalContext* globalCtx);
+void func_808894A4(BgHidanHrock* this, GlobalContext* globalCtx);
+
extern UNK_TYPE D_0600D054;
+extern UNK_TYPE D_0600D188;
-/*
const ActorInit Bg_Hidan_Hrock_InitVars = {
ACTOR_BG_HIDAN_HROCK,
ACTORCAT_BG,
@@ -30,7 +34,7 @@ const ActorInit Bg_Hidan_Hrock_InitVars = {
(ActorFunc)BgHidanHrock_Draw,
};
-static ColliderTrisElementInit D_80889820[2] = {
+static ColliderTrisElementInit sTrisElementsInit[2] = {
{
{
ELEMTYPE_UNK0,
@@ -55,7 +59,7 @@ static ColliderTrisElementInit D_80889820[2] = {
},
};
-static ColliderTrisInit D_80889898 = {
+static ColliderTrisInit sTrisInit = {
{
COLTYPE_NONE,
AT_NONE,
@@ -65,21 +69,171 @@ static ColliderTrisInit D_80889898 = {
COLSHAPE_TRIS,
},
2,
- D_80889820,
+ sTrisElementsInit,
+};
+
+static InitChainEntry sInitChain[] = {
+ ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_CONTINUE),
+ ICHAIN_F32(gravity, -1, ICHAIN_STOP),
};
-*/
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Hidan_Hrock/BgHidanHrock_Init.s")
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Hidan_Hrock/BgHidanHrock_Destroy.s")
+void BgHidanHrock_Init(Actor* thisx, GlobalContext* globalCtx) {
+ BgHidanHrock* this = THIS;
+ ColliderTrisElementInit* colliderElementInit;
+ Vec3f vertices[3];
+ f32 cosRotY;
+ f32 sinRotY;
+ s32 i;
+ s32 j;
+ CollisionHeader* collisionHeader = NULL;
+
+ Actor_ProcessInitChain(thisx, sInitChain);
+ this->unk_16A = thisx->params & 0x3F;
+ thisx->params = (thisx->params >> 8) & 0xFF;
+ Collider_InitTris(globalCtx, &this->collider);
+ Collider_SetTris(globalCtx, &this->collider, thisx, &sTrisInit, this->colliderItems);
+ DynaPolyActor_Init(&this->dyna, DPM_UNK);
+
+ sinRotY = Math_SinS(thisx->shape.rot.y);
+ cosRotY = Math_CosS(thisx->shape.rot.y);
+
+ if (thisx->params == 0) {
+ sinRotY *= 1.5f;
+ cosRotY *= 1.5f;
+ }
+
+ for (i = 0; i < 2; i++) {
+ colliderElementInit = &sTrisInit.elements[i];
+
+ if (1) {
+ for (j = 0; j < 3; j++) {
+ Vec3f* vtx = &colliderElementInit->dim.vtx[j];
+
+ vertices[j].x = vtx->z * sinRotY + (thisx->home.pos.x + vtx->x * cosRotY);
+ vertices[j].y = vtx->y + thisx->home.pos.y;
+ vertices[j].z = vtx->z * cosRotY + (thisx->home.pos.z - vtx->x * sinRotY);
+ }
+ }
+ Collider_SetTrisVertices(&this->collider, i, &vertices[0], &vertices[1], &vertices[2]);
+ }
+
+ if (Flags_GetSwitch(globalCtx, this->unk_16A)) {
+ this->actionFunc = func_808894A4;
+ if (thisx->params == 0) {
+ thisx->world.pos.y -= 2800.0f;
+ thisx->uncullZoneForward = 3000.0f;
+ } else if (thisx->params == 1) {
+ thisx->world.pos.y -= 800.0f;
+ } else if (thisx->params == 2) {
+ thisx->world.pos.y -= 240.0f;
+ }
+ } else {
+ if (thisx->params == 0) {
+ thisx->flags |= 0x30;
+ thisx->uncullZoneForward = 3000.0f;
+ }
+ this->actionFunc = func_808896B8;
+ }
+
+ if (thisx->params == 0) {
+ CollisionHeader_GetVirtual(&D_0600D054, &collisionHeader);
+ } else {
+ CollisionHeader_GetVirtual(&D_0600D188, &collisionHeader);
+ }
+
+ this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, collisionHeader);
+}
+
+void BgHidanHrock_Destroy(Actor* thisx, GlobalContext* globalCtx) {
+ BgHidanHrock* this = THIS;
+
+ DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
+ Collider_DestroyTris(globalCtx, &this->collider);
+}
+
+void func_808894A4(BgHidanHrock* this, GlobalContext* globalCtx) {
+}
+
+void func_808894B0(BgHidanHrock* this, GlobalContext* globalCtx) {
+ if (this->unk_168 != 0) {
+ this->unk_168--;
+ }
+
+ this->dyna.actor.world.pos.x =
+ (Math_SinS(this->dyna.actor.world.rot.y + (this->unk_168 << 0xE)) * 5.0f) + this->dyna.actor.home.pos.x;
+ this->dyna.actor.world.pos.z =
+ (Math_CosS(this->dyna.actor.world.rot.y + (this->unk_168 << 0xE)) * 5.0f) + this->dyna.actor.home.pos.z;
+
+ if (!(this->unk_168 % 4)) {
+ func_800AA000(this->dyna.actor.xyzDistToPlayerSq, 180, 10, 100);
+ Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BLOCK_SHAKE);
+ }
+
+ if (this->unk_168 == 0) {
+ if (this->dyna.actor.params == 0) {
+ this->dyna.actor.home.pos.y -= 2800.0f;
+ } else if (this->dyna.actor.params == 1) {
+ this->dyna.actor.home.pos.y -= 800.0f;
+ } else {
+ this->dyna.actor.home.pos.y -= 240.0f;
+ }
+
+ this->actionFunc = func_8088960C;
+ this->dyna.actor.world.pos.x = this->dyna.actor.home.pos.x;
+ this->dyna.actor.world.pos.z = this->dyna.actor.home.pos.z;
+ }
+}
+
+void func_8088960C(BgHidanHrock* this, GlobalContext* globalCtx) {
+ this->dyna.actor.velocity.y++;
+
+ if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, this->dyna.actor.velocity.y)) {
+ this->dyna.actor.flags &= ~0x30;
+ Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND);
+
+ if (this->dyna.actor.params == 0) {
+ if (globalCtx->roomCtx.curRoom.num == 10) {
+ this->dyna.actor.room = 10;
+ } else {
+ Actor_Kill(&this->dyna.actor);
+ }
+ }
+
+ this->actionFunc = func_808894A4;
+ }
+}
+
+void func_808896B8(BgHidanHrock* this, GlobalContext* globalCtx) {
+ if (this->collider.base.acFlags & 2) {
+ this->collider.base.acFlags &= ~2;
+ this->actionFunc = func_808894B0;
+ this->dyna.actor.flags |= 0x10;
+
+ if (this->dyna.actor.params == 0) {
+ this->dyna.actor.room = -1;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Hidan_Hrock/func_808894A4.s")
+ this->unk_168 = 20;
+ Flags_SetSwitch(globalCtx, this->unk_16A);
+ } else {
+ CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Hidan_Hrock/func_808894B0.s")
+ if (func_8004356C(&this->dyna)) {
+ Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y - 5.0f, 1.0f);
+ } else {
+ Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, 1.0f);
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Hidan_Hrock/func_8088960C.s")
+void BgHidanHrock_Update(Actor* thisx, GlobalContext* globalCtx) {
+ BgHidanHrock* this = THIS;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Hidan_Hrock/func_808896B8.s")
+ this->actionFunc(this, globalCtx);
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Hidan_Hrock/BgHidanHrock_Update.s")
+void BgHidanHrock_Draw(Actor* thisx, GlobalContext* globalCtx) {
+ static Gfx* dlists[] = { 0x0600A240, 0x0600C838, 0x0600C838 };
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Hidan_Hrock/BgHidanHrock_Draw.s")
+ Gfx_DrawDListOpa(globalCtx, dlists[thisx->params]);
+}
diff --git a/src/overlays/actors/ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.h b/src/overlays/actors/ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.h
index 213abcca9..260f2f095 100644
--- a/src/overlays/actors/ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.h
+++ b/src/overlays/actors/ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.h
@@ -6,9 +6,15 @@
struct BgHidanHrock;
+typedef void (*BgHidanHrockActionFunc)(struct BgHidanHrock*, GlobalContext*);
+
typedef struct BgHidanHrock {
- /* 0x0000 */ Actor actor;
- /* 0x014C */ char unk_14C[0xF8];
+ /* 0x0000 */ DynaPolyActor dyna;
+ /* 0x0164 */ BgHidanHrockActionFunc actionFunc;
+ /* 0x0168 */ s16 unk_168;
+ /* 0x016A */ u8 unk_16A;
+ /* 0x016C */ ColliderTris collider;
+ /* 0x018C */ ColliderTrisElement colliderItems[2];
} BgHidanHrock; // size = 0x0244
extern const ActorInit Bg_Hidan_Hrock_InitVars;