summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGamestabled <chandlerm2016@yahoo.com>2020-04-05 05:02:55 -0400
committerchandler <chandlerm2016@yahoo.com>2020-04-06 03:05:54 -0400
commita00a8bbaeb896bf12f115e6a0e636c09733c57ff (patch)
tree9fd601ec106fa037b4b374b99cd3bb05b287a90c /src
parentdda2641082d34504156760e6444ab9bc69954cef (diff)
all functions match, now learning how to do data/rodata
Diffstat (limited to 'src')
-rw-r--r--src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.c326
-rw-r--r--src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.h24
2 files changed, 167 insertions, 183 deletions
diff --git a/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.c b/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.c
index ccf7600fd..0b7eb1d58 100644
--- a/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.c
+++ b/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.c
@@ -5,25 +5,38 @@
// static ColliderCylinderInit cylinderInitData =
// {
-// {
-// 0x0A, 0x11, 0x00, 0x09,
-// 0x20, 0x01, { 0x00, 0x00, },
-// 0x00, { 0x00, 0x00, 0x00, },
-// 0x20000000,
-// 0x01, 0x04, { 0x00, 0x00, },
-// 0xFFCFFFFF,
-// { 0x00, 0x00, 0x00, 0x00, },
-// 0x19, 0x00, 0x01, 0x00,
-// },
+// 0x0A, 0x11, 0x00, 0x09,
+// 0x20, 0x01, 0x00, 0x00,
+// 0x00, 0x00, 0x00, 0x00,
+// 0x20000000,
+// 0x01, 0x04, 0x00, 0x00,
+// 0xFFCFFFFF,
+// 0x00, 0x00, 0x00, 0x00,
+// 0x19, 0x00, 0x01, 0x00,
// 0x001E,
// 0x0053,
-// 0x0000,
-// {
-// 0x0000, 0x0000, 0x0000,
-// },
+// 0x00000000000000000000,
+// };
+
+// static SubActor98Init actor98InitData =
+// {
+// 0x01, 0x0050, 0x0064, 0xFF,
+// };
+
+// u32 D_80886D04[] = {
+// 0x06015D20,
+// 0x06016120,
+// 0x06016520,
+// 0x06016920,
+// 0x06016D20,
+// 0x06017120,
+// 0x06017520,
+// 0x06017920,
+// 0x00000000,
+// 0x00000000,
+// 0x00000000,
// };
-/*
const ActorInit Bg_Hidan_Firewall_InitVars =
{
ACTOR_BG_HIDAN_FIREWALL,
@@ -37,12 +50,11 @@ const ActorInit Bg_Hidan_Firewall_InitVars =
(ActorFunc)BgHidanFirewall_Update,
NULL,
};
-*/
void BgHidanFirewall_Init(BgHidanFirewall* this, GlobalContext* globalCtx){
f32 scale;
-
+
scale = D_80886D84;
this->actor.scale.x = scale;
this->actor.scale.z = scale;
@@ -52,12 +64,12 @@ void BgHidanFirewall_Init(BgHidanFirewall* this, GlobalContext* globalCtx){
this->unk_150 = 0;
- ActorCollider_AllocCylinder(globalCtx, ((s32*)this+0x55));//TODO: fix this. multiple cylinders?
- ActorCollider_InitCylinder(globalCtx, ((s32*)this+0x55), &this->actor, &D_80886CD0);
+ ActorCollider_AllocCylinder(globalCtx, &this->collider);
+ ActorCollider_InitCylinder(globalCtx, &this->collider, &this->actor, &D_80886CD0);
- this->pos_19A.y = this->actor.posRot.pos.y;
+ this->collider.dim.position.y = this->actor.posRot.pos.y;
- func_80061ED4(&this->actor.sub_98, 0, D_80886CFC);
+ func_80061ED4(&this->actor.sub_98, NULL, &D_80886CFC);
this->actionFunc = BgHidanFirewall_Wait;
return;
@@ -66,35 +78,32 @@ void BgHidanFirewall_Init(BgHidanFirewall* this, GlobalContext* globalCtx){
void BgHidanFirewall_Destroy(BgHidanFirewall* this, GlobalContext* globalCtx)
{
BgHidanFirewall* thing = this;
- ActorCollider_FreeCylinder(globalCtx, (char*)this + 0x154);//TODO: fix this. multiple cylinders?
+ ActorCollider_FreeCylinder(globalCtx, &this->collider);
}
-// BgHidanFirewall_Proximity
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Hidan_Firewall/func_80886728.s")
-// s32 func_80886728(BgHidanFirewall* this, GlobalContext* globalCtx)
-// {
-// Vec3f* sp18; //TODO: where does this come from?
-// f32 phi_return;
-
-// func_8002DBD0(&this->actor, sp18, &(globalCtx->actorCtx.actorList[2].first->posRot.pos));
-
-// phi_return = 0.0f;
-// if (fabsf(sp18->x) < 100.0f)
-// {
-// phi_return = fabsf(sp18->z);
-// if (phi_return < 120.0f)
-// {
-// phi_return = 1.401298464324817e-45f;
-// }
-// }
-// return phi_return;
-// }
+s32 BgHidanFirewall_Proximity(BgHidanFirewall* this, GlobalContext* globalCtx)
+{
+ Player* player;
+ Vec3f distance;
+
+ player = PLAYER;
+ func_8002DBD0(&this->actor, &distance, &player->actor.posRot.pos);
+
+ if (fabsf(distance.x) < 100.0f)
+ {
+ if (fabsf(distance.z) < 120.0f)
+ {
+ return 1;
+ }
+ }
+ return 0;
+}
void BgHidanFirewall_Wait(BgHidanFirewall* this, GlobalContext* globalCtx)
{
- if (func_80886728(this, globalCtx) != 0)
+ if (BgHidanFirewall_Proximity(this, globalCtx) != 0)
{
- this->actor.draw = func_80886B34;
+ this->actor.draw = BgHidanFirewall_Draw;
this->actor.params = 5;
this->actionFunc = BgHidanFirewall_Countdown;
}
@@ -109,20 +118,20 @@ void BgHidanFirewall_Countdown(BgHidanFirewall* this, GlobalContext* globalCtx)
}
if (this->actor.params == 0)
{
- this->actionFunc = &func_80886810;
+ this->actionFunc = BgHidanFirewall_Erupt;
}
}
-void func_80886810(BgHidanFirewall* this, GlobalContext* globalCtx)
+void BgHidanFirewall_Erupt(BgHidanFirewall* this, GlobalContext* globalCtx)
{
- if (func_80886728(this, globalCtx) != 0)
+ if (BgHidanFirewall_Proximity(this, globalCtx) != 0)
{
Math_ApproxF(&this->actor.scale.y, 0.1f, 0.024999999f);
return;
}
if (Math_ApproxF(&this->actor.scale.y, D_80886D8C, D_80886D8C) != 0)
{
- this->actor.draw = 0;
+ this->actor.draw = NULL;
this->actionFunc = BgHidanFirewall_Wait;
}
else
@@ -141,129 +150,106 @@ void func_80886898(BgHidanFirewall* this, GlobalContext* globalCtx)
}
else
{
- phi_a3 = (s16)(this->actor.shape.rot.y + 0x8000);
+ phi_a3 = this->actor.shape.rot.y + 0x8000;
}
func_8002F71C(globalCtx, this, 5.0f, phi_a3, 1.0f);
}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Hidan_Firewall/func_808868FC.s")
-// void func_808868FC(BgHidanFirewall* this, GlobalContext* globalCtx)
-// {
-// Vec3f* temp = &globalCtx->actorCtx.actorList[2].first->posRot.pos;
-// Vec3f sp30;
-// f32 temp_ret;
-// f32 sp28;
-// f32 phi_f0;
-
-// func_8002DBD0(&this->actor, &sp30, temp);
-// if (sp30.x < -70.0f)
-// {
-// sp30.x = -70.0f;
-// }
-// else
-// {
-// if (70.0f < sp30.x)
-// {
-// phi_f0 = 70.0f;
-// }
-// else
-// {
-// phi_f0 = sp30.x;
-// }
-// sp30.x = phi_f0;
-// }
-// if (this->actor.params == 0)
-// {
-// if (0.0f < sp30.z)
-// {
-// sp30.z = -25.0f;
-// this->actor.params = -1;
-// }
-// else
-// {
-// sp30.z = 25.0f;
-// this->actor.params = 1;
-// }
-// }
-// else
-// {
-// sp30.z = this->actor.params * 25.0f;
-// }
-// sp28 = Math_Sins(this->actor.shape.rot.y);
-// temp_ret = Math_Coss(this->actor.shape.rot.y);
-// this->pos_19A.x = ((this->actor.posRot.pos.x + (sp30.x * temp_ret)) + (sp30.z * sp28));
-// this->pos_19A.z = ((this->actor.posRot.pos.z - (sp30.x * sp28)) + (sp30.z * temp_ret));
-// }
-
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Hidan_Firewall/BgHidanFirewall_Update.s")
-// void BgHidanFirewall_Update(BgHidanFirewall* this, GlobalContext* globalCtx)
-// {
-// s32 phi_t8;
-// u8 t;
-
-// phi_t8 = (((this->ukn_150)) + 1) & 7;
-// t = this->ukn_164;
-
-// if ((this->ukn_150) + 1 < 0 && phi_t8)
-// {
-// phi_t8 -= 8;
-// }
-// this->ukn_150 = phi_t8;
-
-// if ((this->ukn_164 & 2) != 0)
-// {
-// this->ukn_164 &= 0xfffd;
-// func_80886898(this, globalCtx);
-// }
-// this->actionFunc(this, globalCtx);
-// if (&func_80886810 == this->actionFunc)
-// {
-// func_808868FC(this, globalCtx);
-// Actor_CollisionCheck_SetAT(globalCtx, &globalCtx->sub_11E60, &this->collider);
-// Actor_CollisionCheck_SetOT(globalCtx, &globalCtx->sub_11E60, &this->collider);
-// func_8002F974(&this->actor, 0x2034);
-// }
-// }
-
-// BgHidanFirewall_Draw
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Hidan_Firewall/func_80886B34.s")
-// void func_80886B34(BgHidanFirewall* this, GlobalContext* globalCtx)
-// {
-// Gfx** sp38;
-// s32 sp28;
-// Gfx* temp_ret;
-// Gfx* temp_v0;
-// s32 temp_v0_2;
-// s32 temp_v0_3;
-// s32 temp_v0_4;
-// s32 temp_v0_5;
-// char* temp_a0;
-
-// func_800C6AC4(&sp38, globalCtx->gfxCtx, D_80886D30, 0x1c0);
-// temp_ret = func_80093774(globalCtx->gfxCtx->polyXlu.p, 0x14);
-// temp_v0 = temp_ret;
-// globalCtx->gfxCtx->polyXlu.p = temp_ret;
-// globalCtx->gfxCtx->polyXlu.p = (s32) (temp_v0 + 8);
-// temp_v0->unk0 = 0xdb060020;
-// temp_a0 = D_80886D04 + (this->ukn_150 * 4);
-// temp_v0->unk4 = (s32) (((*temp_a0 & 0xffffff) + ((char*)0x80160000 + (((*temp_a0 * 0x10) >> 0x1c) * 4))->unk6FA8) + 0x80000000);
-// temp_v0_2 = globalCtx->gfxCtx->polyXlu.p;
-// globalCtx->gfxCtx->polyXlu.p = (s32) (temp_v0_2 + 8);
-// temp_v0_2->unk0 = 0xfa000001;
-// temp_v0_2->unk4 = 0xffff0096;
-// temp_v0_3 = globalCtx->gfxCtx->polyXlu.p;
-// globalCtx->gfxCtx->polyXlu.p = (s32) (temp_v0_3 + 8);
-// temp_v0_3->unk0 = 0xfb000000;
-// temp_v0_3->unk4 = 0xff0000ff;
-// temp_v0_4 = globalCtx->gfxCtx->polyXlu.p;
-// globalCtx->gfxCtx->polyXlu.p = (s32) (temp_v0_4 + 8);
-// temp_v0_4->unk0 = 0xda380003;
-// sp28 = temp_v0_4;
-// sp28->unk4 = func_800D1A88(*arg1, &D_80886D4C, 0x1ca);
-// temp_v0_5 = globalCtx->gfxCtx->polyXlu.p;
-// globalCtx->gfxCtx->polyXlu.p = (s32) (temp_v0_5 + 8);
-// temp_v0_5->unk4 = (s32) (0x6010000 + 0xda80);
-// temp_v0_5->unk0 = 0xde000000;
-// func_800C6B54(&sp38, *arg1, &D_80886D68, 0x1cf);
-// }
+void func_808868FC(BgHidanFirewall* this, GlobalContext* globalCtx)
+{
+ Player* player;
+ Vec3f sp30;
+ f32 temp_ret;
+ f32 sp28;
+ f32 phi_f0;
+
+ player = PLAYER;
+
+ func_8002DBD0(&this->actor, &sp30, &player->actor.posRot.pos);
+ if (sp30.x < -70.0f)
+ {
+ sp30.x = -70.0f;
+ }
+ else
+ {
+ if (70.0f < sp30.x)
+ {
+ phi_f0 = 70.0f;
+ }
+ else
+ {
+ phi_f0 = sp30.x;
+ }
+ sp30.x = phi_f0;
+ }
+ if (this->actor.params == 0)
+ {
+ if (0.0f < sp30.z)
+ {
+ sp30.z = -25.0f;
+ this->actor.params = -1;
+ }
+ else
+ {
+ sp30.z = 25.0f;
+ this->actor.params = 1;
+ }
+ }
+ else
+ {
+ sp30.z = this->actor.params * 25.0f;
+ }
+ sp28 = Math_Sins(this->actor.shape.rot.y);
+ temp_ret = Math_Coss(this->actor.shape.rot.y);
+ this->collider.dim.position.x = ((this->actor.posRot.pos.x + (sp30.x * temp_ret)) + (sp30.z * sp28));
+ this->collider.dim.position.z = ((this->actor.posRot.pos.z - (sp30.x * sp28)) + (sp30.z * temp_ret));
+}
+
+void BgHidanFirewall_Update(BgHidanFirewall* this, GlobalContext* globalCtx)
+{
+ s32 pad1;
+ s32 pad2;
+
+ this->unk_150 = (this->unk_150 + 1) % 8;
+
+ if (this->collider.base.colliderFlags & 2)
+ {
+ this->collider.base.colliderFlags &= ~2;
+ func_80886898(this, globalCtx);
+ }
+
+ this->actionFunc(this, globalCtx);
+ if (this->actionFunc == BgHidanFirewall_Erupt)
+ {
+ func_808868FC(this, globalCtx);
+ Actor_CollisionCheck_SetAT(globalCtx, &globalCtx->sub_11E60, &this->collider);
+ Actor_CollisionCheck_SetOT(globalCtx, &globalCtx->sub_11E60, &this->collider);
+ func_8002F974(&this->actor, 0x2034);
+ }
+}
+
+void BgHidanFirewall_Draw(BgHidanFirewall* this, GlobalContext* globalCtx)
+{
+ u32* temp;
+ u32 pad;
+ GraphicsContext* gfxCtx;
+ u32 pad1;
+ u32 pad2;
+ Gfx* gfx;
+
+ gfxCtx = globalCtx->state.gfxCtx;
+
+ func_800C6AC4(&gfx, globalCtx->state.gfxCtx, &D_80886D30, 0x1C0);
+ gfxCtx->polyXlu.p = func_80093774(gfxCtx->polyXlu.p, 0x14);
+
+ temp = &D_80886D04;
+
+ gSPSegment(gfxCtx->polyXlu.p++, 0x08, SEGMENTED_TO_VIRTUAL(temp[this->unk_150]));
+ gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0x01, 0xFF, 0xFF, 0x00, 0x96);
+ gDPSetEnvColor(gfxCtx->polyXlu.p++, 0xFF, 0x00, 0x00, 0xFF);
+ gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, &D_80886D4C, 0x1CA), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPDisplayList(gfxCtx->polyXlu.p++, &D_0600DA80);
+
+
+ func_800C6B54(&gfx, globalCtx->state.gfxCtx, &D_80886D68, 0x1CF);
+}
diff --git a/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.h b/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.h
index 96f693de3..d67ffbc8a 100644
--- a/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.h
+++ b/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.h
@@ -13,33 +13,31 @@ typedef struct BgHidanFirewall
/* 0x0000 */ Actor actor;
/* 0x014C */ FirewallFunc* actionFunc; // idle, countdown, etc
/* 0x0150 */ s16 unk_150;
- /* 0x0154 */ ColliderCylinderMain* collider;
- /* 0x0158 */ char unk_158[0xC];
- /* 0x0164 */ u8 unk_164;
- /* 0x0165 */ char unk_166[0x35];
- /* 0x019A */ Vec3s pos_19A;
+ /* 0x0154 */ ColliderCylinderMain collider;
} BgHidanFirewall; // size = 0x01A0
extern const ActorInit Bg_Hidan_Firewall_InitVars;
void BgHidanFirewall_Init(BgHidanFirewall* this, GlobalContext* globalCtx);
void BgHidanFirewall_Destroy(BgHidanFirewall* this, GlobalContext* globalCtx);
-s32 func_80886728(BgHidanFirewall* this, GlobalContext* globalCtx);
+s32 BgHidanFirewall_Proximity(BgHidanFirewall* this, GlobalContext* globalCtx);
void BgHidanFirewall_Wait(BgHidanFirewall* this, GlobalContext* globalCtx);
void BgHidanFirewall_Countdown(BgHidanFirewall* this, GlobalContext* globalCtx);
-void func_80886810(BgHidanFirewall* this, GlobalContext* globalCtx);
+void BgHidanFirewall_Erupt(BgHidanFirewall* this, GlobalContext* globalCtx);
void func_80886898(BgHidanFirewall* this, GlobalContext* globalCtx);
void func_808868FC(BgHidanFirewall* this, GlobalContext* globalCtx);
void BgHidanFirewall_Update(BgHidanFirewall* this, GlobalContext* globalCtx);
-void func_80886B34(BgHidanFirewall* this, GlobalContext* globalCtx);
+void BgHidanFirewall_Draw(BgHidanFirewall* this, GlobalContext* globalCtx);
-extern char D_80886CFC[8];
-extern char D_80886D04[11 * 4];
-extern void func_80061ED4();
-extern char* D_80886D30; // "../z_bg_hidan_firewall.c
+extern ColliderCylinderMain D_80886CD0;
+extern SubActor98Init D_80886CFC;
+extern u32 D_80886D04[11];
extern f32 D_80886D84;
extern f32 D_80886D88;
extern float D_80886D8C;
-extern ColliderCylinderMain D_80886CD0;
+extern u32 D_0600DA80;
+extern char D_80886D30;
+extern char* D_80886D4C;
+extern char* D_80886D68;
#endif