From 6a680b9b47168bb37784411048cd792590720ed9 Mon Sep 17 00:00:00 2001 From: Gamestabled Date: Tue, 17 Mar 2020 16:05:25 -0400 Subject: [PATCH 01/13] permissions --- tools/ido5.3_compiler/lib/libmalloc.so | Bin tools/ido5.3_compiler/lib/libmalloc_old.so | Bin tools/ido5.3_compiler/lib/rld | Bin tools/ido5.3_compiler/usr/bin/cc | Bin tools/ido5.3_compiler/usr/lib/as0 | Bin tools/ido5.3_compiler/usr/lib/as1 | Bin tools/ido5.3_compiler/usr/lib/cfe | Bin tools/ido5.3_compiler/usr/lib/crt1.o | Bin tools/ido5.3_compiler/usr/lib/err.english.cc | 0 tools/ido5.3_compiler/usr/lib/libc.so.1 | Bin tools/ido5.3_compiler/usr/lib/libexc.so | Bin tools/ido5.3_compiler/usr/lib/libgen.so | Bin tools/ido5.3_compiler/usr/lib/libm.so | Bin tools/ido5.3_compiler/usr/lib/ugen | Bin tools/ido5.3_compiler/usr/lib/ujoin | Bin tools/ido5.3_compiler/usr/lib/uld | Bin tools/ido5.3_compiler/usr/lib/umerge | Bin tools/ido5.3_compiler/usr/lib/uopt | Bin tools/ido5.3_compiler/usr/lib/usplit | Bin 19 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 tools/ido5.3_compiler/lib/libmalloc.so mode change 100644 => 100755 tools/ido5.3_compiler/lib/libmalloc_old.so mode change 100644 => 100755 tools/ido5.3_compiler/lib/rld mode change 100644 => 100755 tools/ido5.3_compiler/usr/bin/cc mode change 100644 => 100755 tools/ido5.3_compiler/usr/lib/as0 mode change 100644 => 100755 tools/ido5.3_compiler/usr/lib/as1 mode change 100644 => 100755 tools/ido5.3_compiler/usr/lib/cfe mode change 100644 => 100755 tools/ido5.3_compiler/usr/lib/crt1.o mode change 100644 => 100755 tools/ido5.3_compiler/usr/lib/err.english.cc mode change 100644 => 100755 tools/ido5.3_compiler/usr/lib/libc.so.1 mode change 100644 => 100755 tools/ido5.3_compiler/usr/lib/libexc.so mode change 100644 => 100755 tools/ido5.3_compiler/usr/lib/libgen.so mode change 100644 => 100755 tools/ido5.3_compiler/usr/lib/libm.so mode change 100644 => 100755 tools/ido5.3_compiler/usr/lib/ugen mode change 100644 => 100755 tools/ido5.3_compiler/usr/lib/ujoin mode change 100644 => 100755 tools/ido5.3_compiler/usr/lib/uld mode change 100644 => 100755 tools/ido5.3_compiler/usr/lib/umerge mode change 100644 => 100755 tools/ido5.3_compiler/usr/lib/uopt mode change 100644 => 100755 tools/ido5.3_compiler/usr/lib/usplit diff --git a/tools/ido5.3_compiler/lib/libmalloc.so b/tools/ido5.3_compiler/lib/libmalloc.so old mode 100644 new mode 100755 diff --git a/tools/ido5.3_compiler/lib/libmalloc_old.so b/tools/ido5.3_compiler/lib/libmalloc_old.so old mode 100644 new mode 100755 diff --git a/tools/ido5.3_compiler/lib/rld b/tools/ido5.3_compiler/lib/rld old mode 100644 new mode 100755 diff --git a/tools/ido5.3_compiler/usr/bin/cc b/tools/ido5.3_compiler/usr/bin/cc old mode 100644 new mode 100755 diff --git a/tools/ido5.3_compiler/usr/lib/as0 b/tools/ido5.3_compiler/usr/lib/as0 old mode 100644 new mode 100755 diff --git a/tools/ido5.3_compiler/usr/lib/as1 b/tools/ido5.3_compiler/usr/lib/as1 old mode 100644 new mode 100755 diff --git a/tools/ido5.3_compiler/usr/lib/cfe b/tools/ido5.3_compiler/usr/lib/cfe old mode 100644 new mode 100755 diff --git a/tools/ido5.3_compiler/usr/lib/crt1.o b/tools/ido5.3_compiler/usr/lib/crt1.o old mode 100644 new mode 100755 diff --git a/tools/ido5.3_compiler/usr/lib/err.english.cc b/tools/ido5.3_compiler/usr/lib/err.english.cc old mode 100644 new mode 100755 diff --git a/tools/ido5.3_compiler/usr/lib/libc.so.1 b/tools/ido5.3_compiler/usr/lib/libc.so.1 old mode 100644 new mode 100755 diff --git a/tools/ido5.3_compiler/usr/lib/libexc.so b/tools/ido5.3_compiler/usr/lib/libexc.so old mode 100644 new mode 100755 diff --git a/tools/ido5.3_compiler/usr/lib/libgen.so b/tools/ido5.3_compiler/usr/lib/libgen.so old mode 100644 new mode 100755 diff --git a/tools/ido5.3_compiler/usr/lib/libm.so b/tools/ido5.3_compiler/usr/lib/libm.so old mode 100644 new mode 100755 diff --git a/tools/ido5.3_compiler/usr/lib/ugen b/tools/ido5.3_compiler/usr/lib/ugen old mode 100644 new mode 100755 diff --git a/tools/ido5.3_compiler/usr/lib/ujoin b/tools/ido5.3_compiler/usr/lib/ujoin old mode 100644 new mode 100755 diff --git a/tools/ido5.3_compiler/usr/lib/uld b/tools/ido5.3_compiler/usr/lib/uld old mode 100644 new mode 100755 diff --git a/tools/ido5.3_compiler/usr/lib/umerge b/tools/ido5.3_compiler/usr/lib/umerge old mode 100644 new mode 100755 diff --git a/tools/ido5.3_compiler/usr/lib/uopt b/tools/ido5.3_compiler/usr/lib/uopt old mode 100644 new mode 100755 diff --git a/tools/ido5.3_compiler/usr/lib/usplit b/tools/ido5.3_compiler/usr/lib/usplit old mode 100644 new mode 100755 From 1eb36220e536635e0522cea8f863eac393a67672 Mon Sep 17 00:00:00 2001 From: Gamestabled Date: Wed, 18 Mar 2020 02:12:45 -0400 Subject: [PATCH 02/13] 6 functions matching --- .../z_bg_hidan_firewall.c | 253 +++++++++++++++++- .../z_bg_hidan_firewall.h | 39 ++- 2 files changed, 280 insertions(+), 12 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 e2c232da8d..5c3e181fcc 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 @@ -3,9 +3,25 @@ #define ROOM 0x00 #define FLAGS 0x00000000 -void BgHidanFirewall_Init(BgHidanFirewall* this, GlobalContext* globalCtx); -void BgHidanFirewall_Destroy(BgHidanFirewall* this, GlobalContext* globalCtx); -void BgHidanFirewall_Update(BgHidanFirewall* this, GlobalContext* globalCtx); +// 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, +// }, +// 0x001E, +// 0x0053, +// 0x0000, +// { +// 0x0000, 0x0000, 0x0000, +// }, +// }; /* const ActorInit Bg_Hidan_Firewall_InitVars = @@ -22,22 +38,241 @@ const ActorInit Bg_Hidan_Firewall_InitVars = NULL, }; */ -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Hidan_Firewall/BgHidanFirewall_Init.s") -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Hidan_Firewall/BgHidanFirewall_Destroy.s") +void BgHidanFirewall_Init(BgHidanFirewall* this, GlobalContext* globalCtx){ + + f32 scale; + scale = D_80886D84; + this->actor.scale.x = scale; + this->actor.scale.z = scale; + + scale = D_80886D88; + this->actor.scale.y = D_80886D88; + + this->ukn_150 = 0; + + ActorCollider_AllocCylinder(globalCtx, ((s32*)this+0x55));//TODO: fix this. multiple cylinders? + ActorCollider_InitCylinder(globalCtx, ((s32*)this+0x55), &this->actor, &D_80886CD0); + + this->ukn_19C = this->actor.posRot.pos.y; + + func_80061ED4(&this->actor.sub_98, 0, D_80886CFC); + + this->method = BgHidanFirewall_Idle; + return; +} + +void BgHidanFirewall_Destroy(BgHidanFirewall* this, GlobalContext* globalCtx) +{ + BgHidanFirewall* thing = this; + ActorCollider_FreeCylinder(globalCtx, (char*)this + 0x154);//TODO: fix this. multiple cylinders? +} + +// 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 temp_f0; +// u32 phi_return; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Hidan_Firewall/func_80886794.s") +// func_8002DBD0(&this->actor, sp18, &(globalCtx->actorCtx.actorList[2].first->posRot.pos)); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Hidan_Firewall/func_808867DC.s") +// phi_return = 0; +// if (fabsf(sp18->x) < 100.0f) +// { +// temp_f0 = fabsf(sp18->z); +// phi_return = temp_f0; +// if (temp_f0 < 120.0f) +// { +// phi_return = 1; +// } +// } +// return phi_return; +// } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Hidan_Firewall/func_80886810.s") +void BgHidanFirewall_Idle(BgHidanFirewall* this, GlobalContext* globalCtx) +{ + if (func_80886728(this, globalCtx) != 0) + { + this->actor.draw = func_80886B34; + this->actor.params = 5; + this->method = BgHidanFirewall_Countdown; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Hidan_Firewall/func_80886898.s") +void BgHidanFirewall_Countdown(BgHidanFirewall* this, GlobalContext* globalCtx) +{ + + if (this->actor.params != 0) + { + this->actor.params--; + } + if (this->actor.params == 0) + { + this->method = &func_80886810; + } +} + +void func_80886810(BgHidanFirewall* this, GlobalContext* globalCtx) +{ + if (func_80886728(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->method = BgHidanFirewall_Idle; + } + else + { + this->actor.params = 0; + } +} + +void func_80886898(BgHidanFirewall* this, GlobalContext* globalCtx) +{ + s16 phi_a3; + + if (func_8002E084(&this->actor, 0x4000) != 0) + { + phi_a3 = this->actor.shape.rot.y; + } + else + { + phi_a3 = (s16)(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* arg2) +// { +// f32 sp38; +// Vec3f* sp30 = &globalCtx->actorCtx.actorList[2].first->posRot.pos; +// f32 sp28; +// f32 temp_ret; +// f32 phi_f0; + +// func_8002DBD0((Actor*)this, &sp30, arg2); +// if (globalCtx->actorCtx.actorList[2].first->posRot.pos.x < -70.0f) +// { +// globalCtx->actorCtx.actorList[2].first->posRot.pos.x = -70.0f; +// } +// else +// { +// if (70.0f < globalCtx->actorCtx.actorList[2].first->posRot.pos.x) +// { +// phi_f0 = 70.0f; +// } +// else +// { +// phi_f0 = globalCtx->actorCtx.actorList[2].first->posRot.pos.x; +// } +// globalCtx->actorCtx.actorList[2].first->posRot.pos.x = (f32) phi_f0; +// } +// if (this->actor.params == 0) +// { +// if (0.0f < sp38) +// { +// sp38 = -25.0f; +// this->actor.params = -1; +// } +// else +// { +// sp38 = 25.0f; +// this->actor.params = 1; +// } +// } +// else +// { +// sp38 = this->actor.params * 25.0f; +// } +// sp28 = Math_Sins(this->actor.sub_B4.rot2.y); +// temp_ret = Math_Coss(this->actor.sub_B4.rot2.y); +// this->ukn_19A = (s16) ((this->actor.posRot.pos.x + (globalCtx->actorCtx.actorList[2].first->posRot.pos.x * temp_ret)) + (sp38 * sp28)); +// this->ukn_19E = (s16) ((this->actor.posRot.pos.z - (globalCtx->actorCtx.actorList[2].first->posRot.pos.x * sp28)) + (sp38 * 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 temp_t8; +// s32 phi_t8; + +// // s16 temp_t6 = this->ukn_150; +// s32 temp_t7 = (this->ukn_150 + 1); +// // temp_t8 = temp_t7 & 7; +// // phi_t8 = temp_t8; +// phi_t8 = temp_t7 & 7; + +// if (temp_t7 < 0) +// { +// // phi_t8 = temp_t8; +// // if (temp_t8 != 0) +// if (phi_t8 != 0) +// { +// phi_t8 = phi_t8 - 8; +// } +// } +// this->ukn_150 = phi_t8; +// if ((this->ukn_164 & 2) != 0) +// { +// this->ukn_164 = (this->ukn_164 & 0xfffd); +// func_80886898(this, globalCtx); +// } +// this->ukn_14C(this, globalCtx); +// if (&func_80886810 == this->ukn_14C) +// { +// func_808868FC(this, globalCtx); +// Actor_CollisionCheck_SetAT(globalCtx, &globalCtx->sub_11E60, &this->collision); +// Actor_CollisionCheck_SetOT(globalCtx, &globalCtx->sub_11E60, &this->collision); +// func_8002F974((Actor*)this, 0x2034); +// } +// } //Still working on this + +// 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); +// } 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 afde1bf451..37324588d2 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 @@ -4,12 +4,45 @@ #include #include -typedef struct +struct BgHidanFirewall; + +typedef void (*FirewallFunc)(struct BgHidanFirewall* this, GlobalContext* globalCtx); + +typedef struct BgHidanFirewall { - /* 0x0000 */ Actor actor; - /* 0x014C */ char unk_14C[0x54]; + /* 0x0000 */ Actor actor; + /* 0x014C */ FirewallFunc method; // idle, countdown, etc + /* 0x0150 */ s16 ukn_150; + /* 0x0152 */ s16 ukn_152; + /* 0x0154 */ ColliderCylinderMain* collider; + /* 0x0158 */ char ukn_158[0xC]; + /* 0x0164 */ u8 ukn_164; + /* 0x0165 */ char ukn_166[0x35]; + /* 0x019A */ s16 ukn_19A; + /* 0x019C */ s16 ukn_19C; + /* 0x019E */ s16 ukn_19E; } 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); +void BgHidanFirewall_Idle(BgHidanFirewall* this, GlobalContext* globalCtx); +void BgHidanFirewall_Countdown(BgHidanFirewall* this, GlobalContext* globalCtx); +void func_80886810(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); + +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 f32 D_80886D84; +extern f32 D_80886D88; +extern float D_80886D8C; +extern ColliderCylinderMain D_80886CD0; + #endif From e5a5f0a46d5fbe9db18e5152daac6f19a13f37c5 Mon Sep 17 00:00:00 2001 From: Gamestabled Date: Thu, 19 Mar 2020 00:32:57 -0400 Subject: [PATCH 03/13] changed some names --- .../z_bg_hidan_firewall.c | 97 +++++++++---------- .../z_bg_hidan_firewall.h | 17 ++-- 2 files changed, 51 insertions(+), 63 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 5c3e181fcc..ccf7600fda 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 @@ -50,16 +50,16 @@ void BgHidanFirewall_Init(BgHidanFirewall* this, GlobalContext* globalCtx){ scale = D_80886D88; this->actor.scale.y = D_80886D88; - this->ukn_150 = 0; + 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); - this->ukn_19C = this->actor.posRot.pos.y; + this->pos_19A.y = this->actor.posRot.pos.y; func_80061ED4(&this->actor.sub_98, 0, D_80886CFC); - this->method = BgHidanFirewall_Idle; + this->actionFunc = BgHidanFirewall_Wait; return; } @@ -74,31 +74,29 @@ void BgHidanFirewall_Destroy(BgHidanFirewall* this, GlobalContext* globalCtx) // s32 func_80886728(BgHidanFirewall* this, GlobalContext* globalCtx) // { // Vec3f* sp18; //TODO: where does this come from? -// f32 temp_f0; -// u32 phi_return; +// f32 phi_return; // func_8002DBD0(&this->actor, sp18, &(globalCtx->actorCtx.actorList[2].first->posRot.pos)); -// phi_return = 0; +// phi_return = 0.0f; // if (fabsf(sp18->x) < 100.0f) // { -// temp_f0 = fabsf(sp18->z); -// phi_return = temp_f0; -// if (temp_f0 < 120.0f) +// phi_return = fabsf(sp18->z); +// if (phi_return < 120.0f) // { -// phi_return = 1; +// phi_return = 1.401298464324817e-45f; // } // } // return phi_return; // } -void BgHidanFirewall_Idle(BgHidanFirewall* this, GlobalContext* globalCtx) +void BgHidanFirewall_Wait(BgHidanFirewall* this, GlobalContext* globalCtx) { if (func_80886728(this, globalCtx) != 0) { this->actor.draw = func_80886B34; this->actor.params = 5; - this->method = BgHidanFirewall_Countdown; + this->actionFunc = BgHidanFirewall_Countdown; } } @@ -111,7 +109,7 @@ void BgHidanFirewall_Countdown(BgHidanFirewall* this, GlobalContext* globalCtx) } if (this->actor.params == 0) { - this->method = &func_80886810; + this->actionFunc = &func_80886810; } } @@ -125,7 +123,7 @@ void func_80886810(BgHidanFirewall* this, GlobalContext* globalCtx) if (Math_ApproxF(&this->actor.scale.y, D_80886D8C, D_80886D8C) != 0) { this->actor.draw = 0; - this->method = BgHidanFirewall_Idle; + this->actionFunc = BgHidanFirewall_Wait; } else { @@ -149,91 +147,84 @@ void func_80886898(BgHidanFirewall* this, GlobalContext* globalCtx) } #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Hidan_Firewall/func_808868FC.s") -// void func_808868FC(BgHidanFirewall* this, GlobalContext* globalCtx, Vec3f* arg2) +// void func_808868FC(BgHidanFirewall* this, GlobalContext* globalCtx) // { -// f32 sp38; -// Vec3f* sp30 = &globalCtx->actorCtx.actorList[2].first->posRot.pos; -// f32 sp28; +// Vec3f* temp = &globalCtx->actorCtx.actorList[2].first->posRot.pos; +// Vec3f sp30; // f32 temp_ret; +// f32 sp28; // f32 phi_f0; -// func_8002DBD0((Actor*)this, &sp30, arg2); -// if (globalCtx->actorCtx.actorList[2].first->posRot.pos.x < -70.0f) +// func_8002DBD0(&this->actor, &sp30, temp); +// if (sp30.x < -70.0f) // { -// globalCtx->actorCtx.actorList[2].first->posRot.pos.x = -70.0f; +// sp30.x = -70.0f; // } // else // { -// if (70.0f < globalCtx->actorCtx.actorList[2].first->posRot.pos.x) +// if (70.0f < sp30.x) // { // phi_f0 = 70.0f; // } // else // { -// phi_f0 = globalCtx->actorCtx.actorList[2].first->posRot.pos.x; +// phi_f0 = sp30.x; // } -// globalCtx->actorCtx.actorList[2].first->posRot.pos.x = (f32) phi_f0; +// sp30.x = phi_f0; // } // if (this->actor.params == 0) // { -// if (0.0f < sp38) +// if (0.0f < sp30.z) // { -// sp38 = -25.0f; +// sp30.z = -25.0f; // this->actor.params = -1; // } // else // { -// sp38 = 25.0f; +// sp30.z = 25.0f; // this->actor.params = 1; // } // } // else // { -// sp38 = this->actor.params * 25.0f; +// sp30.z = this->actor.params * 25.0f; // } -// sp28 = Math_Sins(this->actor.sub_B4.rot2.y); -// temp_ret = Math_Coss(this->actor.sub_B4.rot2.y); -// this->ukn_19A = (s16) ((this->actor.posRot.pos.x + (globalCtx->actorCtx.actorList[2].first->posRot.pos.x * temp_ret)) + (sp38 * sp28)); -// this->ukn_19E = (s16) ((this->actor.posRot.pos.z - (globalCtx->actorCtx.actorList[2].first->posRot.pos.x * sp28)) + (sp38 * temp_ret)); +// 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 temp_t8; // s32 phi_t8; - -// // s16 temp_t6 = this->ukn_150; -// s32 temp_t7 = (this->ukn_150 + 1); +// u8 t; -// // temp_t8 = temp_t7 & 7; -// // phi_t8 = temp_t8; -// phi_t8 = temp_t7 & 7; +// phi_t8 = (((this->ukn_150)) + 1) & 7; +// t = this->ukn_164; -// if (temp_t7 < 0) +// if ((this->ukn_150) + 1 < 0 && phi_t8) // { -// // phi_t8 = temp_t8; -// // if (temp_t8 != 0) -// if (phi_t8 != 0) -// { -// phi_t8 = phi_t8 - 8; -// } +// phi_t8 -= 8; // } // this->ukn_150 = phi_t8; + // if ((this->ukn_164 & 2) != 0) // { -// this->ukn_164 = (this->ukn_164 & 0xfffd); +// this->ukn_164 &= 0xfffd; // func_80886898(this, globalCtx); // } -// this->ukn_14C(this, globalCtx); -// if (&func_80886810 == this->ukn_14C) +// this->actionFunc(this, globalCtx); +// if (&func_80886810 == this->actionFunc) // { // func_808868FC(this, globalCtx); -// Actor_CollisionCheck_SetAT(globalCtx, &globalCtx->sub_11E60, &this->collision); -// Actor_CollisionCheck_SetOT(globalCtx, &globalCtx->sub_11E60, &this->collision); -// func_8002F974((Actor*)this, 0x2034); +// Actor_CollisionCheck_SetAT(globalCtx, &globalCtx->sub_11E60, &this->collider); +// Actor_CollisionCheck_SetOT(globalCtx, &globalCtx->sub_11E60, &this->collider); +// func_8002F974(&this->actor, 0x2034); // } -// } //Still working on this +// } // BgHidanFirewall_Draw #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Hidan_Firewall/func_80886B34.s") 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 37324588d2..ddf2cc5af4 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 @@ -11,16 +11,13 @@ typedef void (*FirewallFunc)(struct BgHidanFirewall* this, GlobalContext* global typedef struct BgHidanFirewall { /* 0x0000 */ Actor actor; - /* 0x014C */ FirewallFunc method; // idle, countdown, etc - /* 0x0150 */ s16 ukn_150; - /* 0x0152 */ s16 ukn_152; + /* 0x014C */ FirewallFunc actionFunc; // idle, countdown, etc + /* 0x0150 */ s16 unk_150; /* 0x0154 */ ColliderCylinderMain* collider; - /* 0x0158 */ char ukn_158[0xC]; - /* 0x0164 */ u8 ukn_164; - /* 0x0165 */ char ukn_166[0x35]; - /* 0x019A */ s16 ukn_19A; - /* 0x019C */ s16 ukn_19C; - /* 0x019E */ s16 ukn_19E; + /* 0x0158 */ char unk_158[0xC]; + /* 0x0164 */ u8 unk_164; + /* 0x0165 */ char unk_166[0x35]; + /* 0x019A */ Vec3s pos_19A; } BgHidanFirewall; // size = 0x01A0 extern const ActorInit Bg_Hidan_Firewall_InitVars; @@ -28,7 +25,7 @@ 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); -void BgHidanFirewall_Idle(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 func_80886898(BgHidanFirewall* this, GlobalContext* globalCtx); From dda2641082d34504156760e6444ab9bc69954cef Mon Sep 17 00:00:00 2001 From: Gamestabled Date: Thu, 19 Mar 2020 04:57:37 -0400 Subject: [PATCH 04/13] begain work on EnAni --- .../z_bg_hidan_firewall.h | 4 +- src/overlays/actors/ovl_En_Ani/z_en_ani.c | 163 ++++++++++++++++-- src/overlays/actors/ovl_En_Ani/z_en_ani.h | 26 ++- 3 files changed, 178 insertions(+), 15 deletions(-) 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 ddf2cc5af4..96f693de37 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 @@ -6,12 +6,12 @@ struct BgHidanFirewall; -typedef void (*FirewallFunc)(struct BgHidanFirewall* this, GlobalContext* globalCtx); +typedef void FirewallFunc(struct BgHidanFirewall* this, GlobalContext* globalCtx); typedef struct BgHidanFirewall { /* 0x0000 */ Actor actor; - /* 0x014C */ FirewallFunc actionFunc; // idle, countdown, etc + /* 0x014C */ FirewallFunc* actionFunc; // idle, countdown, etc /* 0x0150 */ s16 unk_150; /* 0x0154 */ ColliderCylinderMain* collider; /* 0x0158 */ char unk_158[0xC]; diff --git a/src/overlays/actors/ovl_En_Ani/z_en_ani.c b/src/overlays/actors/ovl_En_Ani/z_en_ani.c index bf0cc6b585..eb8ddffcf8 100644 --- a/src/overlays/actors/ovl_En_Ani/z_en_ani.c +++ b/src/overlays/actors/ovl_En_Ani/z_en_ani.c @@ -3,10 +3,6 @@ #define ROOM 0x00 #define FLAGS 0x00000009 -void EnAni_Init(EnAni* this, GlobalContext* globalCtx); -void EnAni_Destroy(EnAni* this, GlobalContext* globalCtx); -void EnAni_Update(EnAni* this, GlobalContext* globalCtx); -void EnAni_Draw(EnAni* this, GlobalContext* globalCtx); /* const ActorInit En_Ani_InitVars = @@ -23,38 +19,181 @@ const ActorInit En_Ani_InitVars = (ActorFunc)EnAni_Draw, }; */ -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ani/func_809B0370.s") + +//EnAni_SetupAction +void func_809B0370(EnAni* this, ActorFunc actionFunc) +{ + this->actionFunc = actionFunc; +} #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ani/EnAni_Init.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ani/EnAni_Destroy.s") -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ani/func_809B04B4.s") +s32 func_809B04B4(EnAni* this, GlobalContext* globalCtx, u16 arg2) +{ + this->actor.textId = arg2; + this->unk_2A8 = (this->unk_2A8 | 1); + func_8002F2CC(&this->actor, globalCtx, 100.0f); + return 0; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ani/func_809B04F0.s") +void func_809B04F0(EnAni* this, GlobalContext* globalCtx) +{ + if (func_8002F334(&this->actor, globalCtx) != 0) + { + func_809B0370(this, func_809B064C); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ani/func_809B0524.s") +void func_809B0524(EnAni* this, GlobalContext* globalCtx) +{ + if (func_8002F334(&this->actor, globalCtx) != 0) + { + func_809B0370(this, func_809B07F8); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ani/func_809B0558.s") +void func_809B0558(EnAni* this, GlobalContext* globalCtx) +{ + if (func_8002F410(&this->actor, globalCtx) != 0) + { + this->actor.attachedA = 0; + if (LINK_IS_CHILD) + { + func_809B0370(this, func_809B04F0); + } + else + { + func_809B0370(this, func_809B0524); + } + gSaveContext.item_get_inf[1] = gSaveContext.item_get_inf[1] | 0x20; + return; + } + func_8002F434(&this->actor, globalCtx, GI_HEART_PIECE, 10000.0f, 200.0f); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ani/func_809B05F0.s") +void func_809B05F0(EnAni* this, GlobalContext* globalCtx) +{ + if (func_8002F334(this, globalCtx) != 0) + { + func_809B0370(this, func_809B0558); + } + func_8002F434(this, globalCtx, GI_HEART_PIECE, 10000.0f, 200.0f); +} #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ani/func_809B064C.s") +// void func_809B064C(EnAni* this, GlobalContext* globalCtx) +// { +// u16 phi_a2; +// s16 temp_v1; +// s32 temp_ret; + +// temp_ret = func_8006C360(globalCtx, 0xA); +// phi_a2 = temp_ret & 0xffff; + +// if (temp_ret == 0) +// { +// phi_a2 = 0x5050U; +// if (gSaveContext.night_flag != 0) +// { +// phi_a2 = 0x5051U; +// } +// } + +// temp_v1 = (this->actor.rotTowardsLinkY - this->actor.shape.rot.y); +// if (func_8002F194(&this->actor, globalCtx) != 0) +// { +// if (this->actor.textId == 0x5056) // "To get a good view..." +// { +// func_809B0370(this, func_809B04F0); +// return; +// } +// if (this->actor.textId == 0x5055) // "...I'll give you this as a memento." +// { + +// func_809B0370(this, func_809B05F0); +// return; +// } +// func_809B0370(this, func_809B04F0); +// return; +// } +// if (temp_v1 >= -0x36AF) +// { +// if (temp_v1 < 0) +// { +// if (this->actor.xzDistanceFromLink < 150.0f) +// { +// if (-80.0f < this->actor.yDistanceFromLink) +// { +// if ((gSaveContext.item_get_inf[1] & 0x20) == 0) +// { +// func_809B04B4(this, globalCtx, 0x5056); // "To get a good view..." +// return; +// } +// func_809B04B4(this, globalCtx, 0x5055); // "...I'll give you this as a memento." +// return; +// } +// } +// } +// } +// if (temp_v1 >= -0x3e7) +// { +// if (temp_v1 < 0x36b0) +// { +// if (this->actor.xzDistanceFromLink < 350.0f) +// { +// func_809B04B4(this, globalCtx, phi_a2); +// } +// } +// } +// } THIS IS SUPER CLOSE #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ani/func_809B07F8.s") -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ani/func_809B0988.s") +void func_809B0988(EnAni* this, GlobalContext* globalCtx) { } #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ani/func_809B0994.s") +// void func_809B0994(EnAni* this, GlobalContext* globalCtx) +// { +// if (globalCtx->csCtx.actorActions[0]->action == 4) +// { +// SkelAnime_ChangeAnimation(&this->skelAnime, 0x60070F0, 1.0f, 0.0f, (f32) SkelAnime_GetFrameCount(0x60070F0), 2, -4.0f); +// this->actor.shape.shadowDrawFunc = 0x8003B5EC; +// this->unk_2AA += 1; +// } +// } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ani/func_809B0A28.s") +void func_809B0A28(EnAni* this, GlobalContext* globalCtx) +{ + if (SkelAnime_FrameUpdateMatrix(&this->skelAnime) != 0) + { + this->unk_2AA += 1; + } +} #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ani/func_809B0A6C.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ani/EnAni_Update.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ani/func_809B0D90.s") +// ? func_809B0D90(s32 arg0, s32 arg1, ? arg2, ? arg3, void *arg4, void *arg5) +// { +// if (arg1 == 0xf) +// { +// arg4->unk0 = (s16) (arg4->unk0 + arg5->unk29E); +// arg4->unk4 = (s16) (arg4->unk4 + arg5->unk29C); +// } +// return 0; +// } #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ani/func_809B0DD4.s") +// void func_809B0DD4(s32 arg0, Actor* arg1, ? arg2, ? arg3) +// { +// if (arg1 == 0xf) +// { +// Matrix_MultVec3f(&D_809B0F74, &arg1->posRot2.pos); +// } +// } #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ani/EnAni_Draw.s") diff --git a/src/overlays/actors/ovl_En_Ani/z_en_ani.h b/src/overlays/actors/ovl_En_Ani/z_en_ani.h index 05b739e3d5..1b7bd4226f 100644 --- a/src/overlays/actors/ovl_En_Ani/z_en_ani.h +++ b/src/overlays/actors/ovl_En_Ani/z_en_ani.h @@ -7,9 +7,33 @@ typedef struct { /* 0x0000 */ Actor actor; - /* 0x014C */ char unk_14C[0x168]; + /* 0x014C */ char unk_14C[0x4C]; + /* 0x0198 */ SkelAnime skelAnime; + /* 0x01D8 */ char unk_19C[0xD0]; + /* 0x02A8 */ u16 unk_2A8; + /* 0x02AA */ u16 unk_2AA; + /* 0x02AC */ char unk_2AC[0x4]; + /* 0x02B0 */ ActorFunc actionFunc; } EnAni; // size = 0x02B4 extern const ActorInit En_Ani_InitVars; +void func_809B0370(EnAni* this, ActorFunc actionFunc); +void EnAni_Init(EnAni* this, GlobalContext* globalCtx); +void EnAni_Destroy(EnAni* this, GlobalContext* globalCtx); +s32 func_809B04B4(EnAni* this, GlobalContext* globalCtx, u16 arg2); +void func_809B04F0(EnAni* this, GlobalContext* globalCtx); +void func_809B0524(EnAni* this, GlobalContext* globalCtx); +void func_809B0558(EnAni* this, GlobalContext* globalCtx); +void func_809B05F0(EnAni* this, GlobalContext* globalCtx); +void func_809B064C(EnAni* this, GlobalContext* globalCtx); +void func_809B07F8(EnAni* this, GlobalContext* globalCtx); +void func_809B0988(EnAni* this, GlobalContext* globalCtx); + + + +void EnAni_Update(EnAni* this, GlobalContext* globalCtx); +void EnAni_Draw(EnAni* this, GlobalContext* globalCtx); + + #endif From a00a8bbaeb896bf12f115e6a0e636c09733c57ff Mon Sep 17 00:00:00 2001 From: Gamestabled Date: Sun, 5 Apr 2020 05:02:55 -0400 Subject: [PATCH 05/13] all functions match, now learning how to do data/rodata --- .../actors/z_bg_hidan_firewall.data.s | 12 +- .../z_bg_hidan_firewall.c | 318 +++++++++--------- .../z_bg_hidan_firewall.h | 24 +- undefined_syms.txt | 18 +- 4 files changed, 186 insertions(+), 186 deletions(-) diff --git a/data/overlays/actors/z_bg_hidan_firewall.data.s b/data/overlays/actors/z_bg_hidan_firewall.data.s index ff4314b4d1..1449400411 100644 --- a/data/overlays/actors/z_bg_hidan_firewall.data.s +++ b/data/overlays/actors/z_bg_hidan_firewall.data.s @@ -7,12 +7,12 @@ .section .data -glabel Bg_Hidan_Firewall_InitVars - .word 0x000C0100, 0x00000000, 0x002C0000, 0x000001A0 -.word BgHidanFirewall_Init -.word BgHidanFirewall_Destroy -.word BgHidanFirewall_Update -.word 0x00000000 +#glabel Bg_Hidan_Firewall_InitVars +# .word 0x000C0100, 0x00000000, 0x002C0000, 0x000001A0 +#.word BgHidanFirewall_Init +#.word BgHidanFirewall_Destroy +#.word BgHidanFirewall_Update +#.word 0x00000000 glabel D_80886CD0 .word 0x0A110009, 0x20010000, 0x00000000, 0x20000000, 0x01040000, 0xFFCFFFFF, 0x00000000, 0x19000100, 0x001E0053, 0x00000000, 0x00000000 glabel D_80886CFC 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 ccf7600fda..0b7eb1d580 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; +s32 BgHidanFirewall_Proximity(BgHidanFirewall* this, GlobalContext* globalCtx) +{ + Player* player; + Vec3f distance; + + player = PLAYER; + func_8002DBD0(&this->actor, &distance, &player->actor.posRot.pos); -// 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; -// } + 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; +void func_808868FC(BgHidanFirewall* this, GlobalContext* globalCtx) +{ + Player* player; + 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)); -// } + 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); -#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); -// } + 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 96f693de37..d67ffbc8a3 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 diff --git a/undefined_syms.txt b/undefined_syms.txt index c2d7779fd5..4568e85fdd 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -390,4 +390,20 @@ D_06009244 = 0x06009244; D_060041F4 = 0x060041F4; D_0600A054 = 0x0600A054; D_06008688 = 0x06008688; -D_04049210 = 0x04049210; \ No newline at end of file +D_04049210 = 0x04049210; + +// z_en_ani +D_060067B8 = 0x060067B8; +D_060070F0 = 0x060070F0; +D_8002B5EC = 0x8002B5EC; +D_060076EC = 0x060076EC; +D_060000F0 = 0x060000F0; + +// z_bg_hidan_firewall +D_0600DA80 = 0x0600DA80; + +// z_bg_breakwall +D_02014F80 = 0x02014F80; +D_801333E0 = 0x801333E0; +D_801333D4 = 0x801333D4; +D_801333E8 = 0x801333E8; \ No newline at end of file From 9a87ce3c0462c47ea82c08d890a1863b2f87e004 Mon Sep 17 00:00:00 2001 From: Gamestabled Date: Mon, 6 Apr 2020 02:38:53 -0400 Subject: [PATCH 06/13] firewall OK --- .../actors/z_bg_hidan_firewall.data.s | 12 +- spec | 2 - .../z_bg_hidan_firewall.c | 105 +++++++++--------- .../z_bg_hidan_firewall.h | 17 +-- undefined_syms.txt | 13 --- 5 files changed, 64 insertions(+), 85 deletions(-) diff --git a/data/overlays/actors/z_bg_hidan_firewall.data.s b/data/overlays/actors/z_bg_hidan_firewall.data.s index 1449400411..ff4314b4d1 100644 --- a/data/overlays/actors/z_bg_hidan_firewall.data.s +++ b/data/overlays/actors/z_bg_hidan_firewall.data.s @@ -7,12 +7,12 @@ .section .data -#glabel Bg_Hidan_Firewall_InitVars -# .word 0x000C0100, 0x00000000, 0x002C0000, 0x000001A0 -#.word BgHidanFirewall_Init -#.word BgHidanFirewall_Destroy -#.word BgHidanFirewall_Update -#.word 0x00000000 +glabel Bg_Hidan_Firewall_InitVars + .word 0x000C0100, 0x00000000, 0x002C0000, 0x000001A0 +.word BgHidanFirewall_Init +.word BgHidanFirewall_Destroy +.word BgHidanFirewall_Update +.word 0x00000000 glabel D_80886CD0 .word 0x0A110009, 0x20010000, 0x00000000, 0x20000000, 0x01040000, 0xFFCFFFFF, 0x00000000, 0x19000100, 0x001E0053, 0x00000000, 0x00000000 glabel D_80886CFC diff --git a/spec b/spec index 00c5891b03..ac772e35b1 100644 --- a/spec +++ b/spec @@ -963,8 +963,6 @@ endseg beginseg name "ovl_Bg_Hidan_Firewall" include "build/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.o" - include "build/data/overlays/actors/z_bg_hidan_firewall.data.o" - include "build/data/overlays/actors/z_bg_hidan_firewall.rodata.o" include "build/data/overlays/actors/z_bg_hidan_firewall.reloc.o" endseg 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 0b7eb1d580..f6eac5535b 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 @@ -1,42 +1,14 @@ +/* + * File: z_bg_hidan_firewall.c + * Overlay: ovl_Bg_Hidan_Firewall + * Description: Proximity Flame Wall +*/ + #include "z_bg_hidan_firewall.h" #define ROOM 0x00 #define FLAGS 0x00000000 -// 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, -// 0x001E, -// 0x0053, -// 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, @@ -51,25 +23,59 @@ const ActorInit Bg_Hidan_Firewall_InitVars = NULL, }; +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, + 0x001E, + 0x0053, + 0x00000000000000000000, +}; + +static SubActor98Init actor98InitData = +{ + 0x01, 0x0050, 0x0064, 0xFF, +}; + +u32 D_80886D04[] = { + 0x06015D20, + 0x06016120, + 0x06016520, + 0x06016920, + 0x06016D20, + 0x06017120, + 0x06017520, + 0x06017920, + 0x00000000, + 0x00000000, + 0x00000000, +}; + void BgHidanFirewall_Init(BgHidanFirewall* this, GlobalContext* globalCtx){ f32 scale; - scale = D_80886D84; + scale = 0.119999997318f; this->actor.scale.x = scale; this->actor.scale.z = scale; - scale = D_80886D88; - this->actor.scale.y = D_80886D88; + scale = 0.00999999977648f; + this->actor.scale.y = 0.00999999977648f; this->unk_150 = 0; ActorCollider_AllocCylinder(globalCtx, &this->collider); - ActorCollider_InitCylinder(globalCtx, &this->collider, &this->actor, &D_80886CD0); + ActorCollider_InitCylinder(globalCtx, &this->collider, &this->actor, &cylinderInitData); this->collider.dim.position.y = this->actor.posRot.pos.y; - func_80061ED4(&this->actor.sub_98, NULL, &D_80886CFC); + func_80061ED4(&this->actor.sub_98, NULL, &actor98InitData); this->actionFunc = BgHidanFirewall_Wait; return; @@ -129,7 +135,7 @@ void BgHidanFirewall_Erupt(BgHidanFirewall* this, GlobalContext* globalCtx) Math_ApproxF(&this->actor.scale.y, 0.1f, 0.024999999f); return; } - if (Math_ApproxF(&this->actor.scale.y, D_80886D8C, D_80886D8C) != 0) + if (Math_ApproxF(&this->actor.scale.y, 0.00999999977648f, 0.00999999977648f) != 0) { this->actor.draw = NULL; this->actionFunc = BgHidanFirewall_Wait; @@ -140,7 +146,7 @@ void BgHidanFirewall_Erupt(BgHidanFirewall* this, GlobalContext* globalCtx) } } -void func_80886898(BgHidanFirewall* this, GlobalContext* globalCtx) +void BgHidanFirewall_Collide(BgHidanFirewall* this, GlobalContext* globalCtx) { s16 phi_a3; @@ -155,7 +161,7 @@ void func_80886898(BgHidanFirewall* this, GlobalContext* globalCtx) func_8002F71C(globalCtx, this, 5.0f, phi_a3, 1.0f); } -void func_808868FC(BgHidanFirewall* this, GlobalContext* globalCtx) +void BgHidanFirewall_ColliderFollowPlayer(BgHidanFirewall* this, GlobalContext* globalCtx) { Player* player; Vec3f sp30; @@ -201,8 +207,8 @@ void func_808868FC(BgHidanFirewall* this, GlobalContext* globalCtx) } 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)); + 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) @@ -215,13 +221,13 @@ void BgHidanFirewall_Update(BgHidanFirewall* this, GlobalContext* globalCtx) if (this->collider.base.colliderFlags & 2) { this->collider.base.colliderFlags &= ~2; - func_80886898(this, globalCtx); + BgHidanFirewall_Collide(this, globalCtx); } this->actionFunc(this, globalCtx); if (this->actionFunc == BgHidanFirewall_Erupt) { - func_808868FC(this, globalCtx); + BgHidanFirewall_ColliderFollowPlayer(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); @@ -239,7 +245,7 @@ void BgHidanFirewall_Draw(BgHidanFirewall* this, GlobalContext* globalCtx) gfxCtx = globalCtx->state.gfxCtx; - func_800C6AC4(&gfx, globalCtx->state.gfxCtx, &D_80886D30, 0x1C0); + func_800C6AC4(&gfx, globalCtx->state.gfxCtx, "../z_bg_hidan_firewall.c", 0x1C0); gfxCtx->polyXlu.p = func_80093774(gfxCtx->polyXlu.p, 0x14); temp = &D_80886D04; @@ -247,9 +253,8 @@ void BgHidanFirewall_Draw(BgHidanFirewall* this, GlobalContext* globalCtx) 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); + gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_hidan_firewall.c", 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); + func_800C6B54(&gfx, globalCtx->state.gfxCtx, "../z_bg_hidan_firewall.c", 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 d67ffbc8a3..48f490f260 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 @@ -11,33 +11,22 @@ typedef void FirewallFunc(struct BgHidanFirewall* this, GlobalContext* globalCtx typedef struct BgHidanFirewall { /* 0x0000 */ Actor actor; - /* 0x014C */ FirewallFunc* actionFunc; // idle, countdown, etc + /* 0x014C */ FirewallFunc* actionFunc; /* 0x0150 */ s16 unk_150; /* 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 BgHidanFirewall_Proximity(BgHidanFirewall* this, GlobalContext* globalCtx); void BgHidanFirewall_Wait(BgHidanFirewall* this, GlobalContext* globalCtx); void BgHidanFirewall_Countdown(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_Collide(BgHidanFirewall* this, GlobalContext* globalCtx); +void BgHidanFirewall_ColliderFollowPlayer(BgHidanFirewall* this, GlobalContext* globalCtx); void BgHidanFirewall_Update(BgHidanFirewall* this, GlobalContext* globalCtx); void BgHidanFirewall_Draw(BgHidanFirewall* this, GlobalContext* globalCtx); -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 u32 D_0600DA80; -extern char D_80886D30; -extern char* D_80886D4C; -extern char* D_80886D68; #endif diff --git a/undefined_syms.txt b/undefined_syms.txt index 4568e85fdd..85597f291b 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -392,18 +392,5 @@ D_0600A054 = 0x0600A054; D_06008688 = 0x06008688; D_04049210 = 0x04049210; -// z_en_ani -D_060067B8 = 0x060067B8; -D_060070F0 = 0x060070F0; -D_8002B5EC = 0x8002B5EC; -D_060076EC = 0x060076EC; -D_060000F0 = 0x060000F0; - // z_bg_hidan_firewall D_0600DA80 = 0x0600DA80; - -// z_bg_breakwall -D_02014F80 = 0x02014F80; -D_801333E0 = 0x801333E0; -D_801333D4 = 0x801333D4; -D_801333E8 = 0x801333E8; \ No newline at end of file From 553329a9e6808442bfa3d71b84a074c4c08a3c4c Mon Sep 17 00:00:00 2001 From: chandler Date: Mon, 6 Apr 2020 03:15:25 -0400 Subject: [PATCH 07/13] reverting en_ani to PR firewall (im a git noob) --- src/overlays/actors/ovl_En_Ani/z_en_ani.c | 168 ++-------------------- src/overlays/actors/ovl_En_Ani/z_en_ani.h | 29 +--- 2 files changed, 16 insertions(+), 181 deletions(-) diff --git a/src/overlays/actors/ovl_En_Ani/z_en_ani.c b/src/overlays/actors/ovl_En_Ani/z_en_ani.c index eb8ddffcf8..a71924b895 100644 --- a/src/overlays/actors/ovl_En_Ani/z_en_ani.c +++ b/src/overlays/actors/ovl_En_Ani/z_en_ani.c @@ -1,12 +1,15 @@ #include "z_en_ani.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000009 +void EnAni_Init(EnAni* this, GlobalContext* globalCtx); +void EnAni_Destroy(EnAni* this, GlobalContext* globalCtx); +void EnAni_Update(EnAni* this, GlobalContext* globalCtx); +void EnAni_Draw(EnAni* this, GlobalContext* globalCtx); /* -const ActorInit En_Ani_InitVars = -{ +const ActorInit En_Ani_InitVars = { ACTOR_EN_ANI, ACTORTYPE_NPC, ROOM, @@ -19,181 +22,38 @@ const ActorInit En_Ani_InitVars = (ActorFunc)EnAni_Draw, }; */ - -//EnAni_SetupAction -void func_809B0370(EnAni* this, ActorFunc actionFunc) -{ - this->actionFunc = actionFunc; -} +#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ani/func_809B0370.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ani/EnAni_Init.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ani/EnAni_Destroy.s") -s32 func_809B04B4(EnAni* this, GlobalContext* globalCtx, u16 arg2) -{ - this->actor.textId = arg2; - this->unk_2A8 = (this->unk_2A8 | 1); - func_8002F2CC(&this->actor, globalCtx, 100.0f); - return 0; -} +#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ani/func_809B04B4.s") -void func_809B04F0(EnAni* this, GlobalContext* globalCtx) -{ - if (func_8002F334(&this->actor, globalCtx) != 0) - { - func_809B0370(this, func_809B064C); - } -} +#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ani/func_809B04F0.s") -void func_809B0524(EnAni* this, GlobalContext* globalCtx) -{ - if (func_8002F334(&this->actor, globalCtx) != 0) - { - func_809B0370(this, func_809B07F8); - } -} +#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ani/func_809B0524.s") -void func_809B0558(EnAni* this, GlobalContext* globalCtx) -{ - if (func_8002F410(&this->actor, globalCtx) != 0) - { - this->actor.attachedA = 0; - if (LINK_IS_CHILD) - { - func_809B0370(this, func_809B04F0); - } - else - { - func_809B0370(this, func_809B0524); - } - gSaveContext.item_get_inf[1] = gSaveContext.item_get_inf[1] | 0x20; - return; - } - func_8002F434(&this->actor, globalCtx, GI_HEART_PIECE, 10000.0f, 200.0f); -} +#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ani/func_809B0558.s") -void func_809B05F0(EnAni* this, GlobalContext* globalCtx) -{ - if (func_8002F334(this, globalCtx) != 0) - { - func_809B0370(this, func_809B0558); - } - func_8002F434(this, globalCtx, GI_HEART_PIECE, 10000.0f, 200.0f); -} +#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ani/func_809B05F0.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ani/func_809B064C.s") -// void func_809B064C(EnAni* this, GlobalContext* globalCtx) -// { -// u16 phi_a2; -// s16 temp_v1; -// s32 temp_ret; - -// temp_ret = func_8006C360(globalCtx, 0xA); -// phi_a2 = temp_ret & 0xffff; - -// if (temp_ret == 0) -// { -// phi_a2 = 0x5050U; -// if (gSaveContext.night_flag != 0) -// { -// phi_a2 = 0x5051U; -// } -// } - -// temp_v1 = (this->actor.rotTowardsLinkY - this->actor.shape.rot.y); -// if (func_8002F194(&this->actor, globalCtx) != 0) -// { -// if (this->actor.textId == 0x5056) // "To get a good view..." -// { -// func_809B0370(this, func_809B04F0); -// return; -// } -// if (this->actor.textId == 0x5055) // "...I'll give you this as a memento." -// { - -// func_809B0370(this, func_809B05F0); -// return; -// } -// func_809B0370(this, func_809B04F0); -// return; -// } -// if (temp_v1 >= -0x36AF) -// { -// if (temp_v1 < 0) -// { -// if (this->actor.xzDistanceFromLink < 150.0f) -// { -// if (-80.0f < this->actor.yDistanceFromLink) -// { -// if ((gSaveContext.item_get_inf[1] & 0x20) == 0) -// { -// func_809B04B4(this, globalCtx, 0x5056); // "To get a good view..." -// return; -// } -// func_809B04B4(this, globalCtx, 0x5055); // "...I'll give you this as a memento." -// return; -// } -// } -// } -// } -// if (temp_v1 >= -0x3e7) -// { -// if (temp_v1 < 0x36b0) -// { -// if (this->actor.xzDistanceFromLink < 350.0f) -// { -// func_809B04B4(this, globalCtx, phi_a2); -// } -// } -// } -// } THIS IS SUPER CLOSE #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ani/func_809B07F8.s") -void func_809B0988(EnAni* this, GlobalContext* globalCtx) { } +#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ani/func_809B0988.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ani/func_809B0994.s") -// void func_809B0994(EnAni* this, GlobalContext* globalCtx) -// { -// if (globalCtx->csCtx.actorActions[0]->action == 4) -// { -// SkelAnime_ChangeAnimation(&this->skelAnime, 0x60070F0, 1.0f, 0.0f, (f32) SkelAnime_GetFrameCount(0x60070F0), 2, -4.0f); -// this->actor.shape.shadowDrawFunc = 0x8003B5EC; -// this->unk_2AA += 1; -// } -// } -void func_809B0A28(EnAni* this, GlobalContext* globalCtx) -{ - if (SkelAnime_FrameUpdateMatrix(&this->skelAnime) != 0) - { - this->unk_2AA += 1; - } -} +#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ani/func_809B0A28.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ani/func_809B0A6C.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ani/EnAni_Update.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ani/func_809B0D90.s") -// ? func_809B0D90(s32 arg0, s32 arg1, ? arg2, ? arg3, void *arg4, void *arg5) -// { -// if (arg1 == 0xf) -// { -// arg4->unk0 = (s16) (arg4->unk0 + arg5->unk29E); -// arg4->unk4 = (s16) (arg4->unk4 + arg5->unk29C); -// } -// return 0; -// } #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ani/func_809B0DD4.s") -// void func_809B0DD4(s32 arg0, Actor* arg1, ? arg2, ? arg3) -// { -// if (arg1 == 0xf) -// { -// Matrix_MultVec3f(&D_809B0F74, &arg1->posRot2.pos); -// } -// } #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ani/EnAni_Draw.s") diff --git a/src/overlays/actors/ovl_En_Ani/z_en_ani.h b/src/overlays/actors/ovl_En_Ani/z_en_ani.h index 1b7bd4226f..45b7e37208 100644 --- a/src/overlays/actors/ovl_En_Ani/z_en_ani.h +++ b/src/overlays/actors/ovl_En_Ani/z_en_ani.h @@ -4,36 +4,11 @@ #include #include -typedef struct -{ +typedef struct { /* 0x0000 */ Actor actor; - /* 0x014C */ char unk_14C[0x4C]; - /* 0x0198 */ SkelAnime skelAnime; - /* 0x01D8 */ char unk_19C[0xD0]; - /* 0x02A8 */ u16 unk_2A8; - /* 0x02AA */ u16 unk_2AA; - /* 0x02AC */ char unk_2AC[0x4]; - /* 0x02B0 */ ActorFunc actionFunc; + /* 0x014C */ char unk_14C[0x168]; } EnAni; // size = 0x02B4 extern const ActorInit En_Ani_InitVars; -void func_809B0370(EnAni* this, ActorFunc actionFunc); -void EnAni_Init(EnAni* this, GlobalContext* globalCtx); -void EnAni_Destroy(EnAni* this, GlobalContext* globalCtx); -s32 func_809B04B4(EnAni* this, GlobalContext* globalCtx, u16 arg2); -void func_809B04F0(EnAni* this, GlobalContext* globalCtx); -void func_809B0524(EnAni* this, GlobalContext* globalCtx); -void func_809B0558(EnAni* this, GlobalContext* globalCtx); -void func_809B05F0(EnAni* this, GlobalContext* globalCtx); -void func_809B064C(EnAni* this, GlobalContext* globalCtx); -void func_809B07F8(EnAni* this, GlobalContext* globalCtx); -void func_809B0988(EnAni* this, GlobalContext* globalCtx); - - - -void EnAni_Update(EnAni* this, GlobalContext* globalCtx); -void EnAni_Draw(EnAni* this, GlobalContext* globalCtx); - - #endif From 78c65878ed809282cb1923419ee30d78323368d2 Mon Sep 17 00:00:00 2001 From: chandler Date: Mon, 6 Apr 2020 03:19:13 -0400 Subject: [PATCH 08/13] more fixing PR --- src/overlays/actors/ovl_En_Ani/z_en_ani.c | 5 +++-- src/overlays/actors/ovl_En_Ani/z_en_ani.h | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/overlays/actors/ovl_En_Ani/z_en_ani.c b/src/overlays/actors/ovl_En_Ani/z_en_ani.c index a71924b895..bf0cc6b585 100644 --- a/src/overlays/actors/ovl_En_Ani/z_en_ani.c +++ b/src/overlays/actors/ovl_En_Ani/z_en_ani.c @@ -1,6 +1,6 @@ #include "z_en_ani.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000009 void EnAni_Init(EnAni* this, GlobalContext* globalCtx); @@ -9,7 +9,8 @@ void EnAni_Update(EnAni* this, GlobalContext* globalCtx); void EnAni_Draw(EnAni* this, GlobalContext* globalCtx); /* -const ActorInit En_Ani_InitVars = { +const ActorInit En_Ani_InitVars = +{ ACTOR_EN_ANI, ACTORTYPE_NPC, ROOM, diff --git a/src/overlays/actors/ovl_En_Ani/z_en_ani.h b/src/overlays/actors/ovl_En_Ani/z_en_ani.h index 45b7e37208..05b739e3d5 100644 --- a/src/overlays/actors/ovl_En_Ani/z_en_ani.h +++ b/src/overlays/actors/ovl_En_Ani/z_en_ani.h @@ -4,7 +4,8 @@ #include #include -typedef struct { +typedef struct +{ /* 0x0000 */ Actor actor; /* 0x014C */ char unk_14C[0x168]; } EnAni; // size = 0x02B4 From 9864211cdcbd3af44b639fccfaee1a9dd9c3f772 Mon Sep 17 00:00:00 2001 From: chandler Date: Mon, 6 Apr 2020 16:41:05 -0400 Subject: [PATCH 09/13] made suggesed changes --- spec | 2 +- .../z_bg_hidan_firewall.c | 175 +++++++----------- .../z_bg_hidan_firewall.h | 17 +- 3 files changed, 74 insertions(+), 120 deletions(-) diff --git a/spec b/spec index 0ef4b9723d..b2114edd79 100644 --- a/spec +++ b/spec @@ -930,7 +930,7 @@ endseg beginseg name "ovl_Bg_Hidan_Firewall" include "build/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.o" - include "build/data/overlays/actors/z_bg_hidan_firewall.reloc.o" + include "build/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall_reloc.o" endseg beginseg 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 b211245cb0..41a614b088 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 @@ -2,15 +2,27 @@ * File: z_bg_hidan_firewall.c * Overlay: ovl_Bg_Hidan_Firewall * Description: Proximity Flame Wall -*/ + */ #include "z_bg_hidan_firewall.h" #define ROOM 0x00 #define FLAGS 0x00000000 -const ActorInit Bg_Hidan_Firewall_InitVars = -{ +void BgHidanFirewall_Init(BgHidanFirewall* this, GlobalContext* globalCtx); +void BgHidanFirewall_Destroy(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 BgHidanFirewall_Erupt(BgHidanFirewall* this, GlobalContext* globalCtx); +void BgHidanFirewall_Collide(BgHidanFirewall* this, GlobalContext* globalCtx); +void BgHidanFirewall_ColliderFollowPlayer(BgHidanFirewall* this, GlobalContext* globalCtx); +void BgHidanFirewall_Update(BgHidanFirewall* this, GlobalContext* globalCtx); +void BgHidanFirewall_Draw(BgHidanFirewall* this, GlobalContext* globalCtx); + +extern Gfx D_0600DA80; + +const ActorInit Bg_Hidan_Firewall_InitVars = { ACTOR_BG_HIDAN_FIREWALL, ACTORTYPE_BG, ROOM, @@ -23,27 +35,24 @@ const ActorInit Bg_Hidan_Firewall_InitVars = NULL, }; -static ColliderCylinderInit cylinderInitData = -{ +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, + 0x00, 0x00, 0x00, 0x00, 0x19, 0x00, 0x01, 0x00, - 0x001E, - 0x0053, + 0x001E, 0x0053, 0x00000000000000000000, }; -static SubActor98Init actor98InitData = -{ +static Sub98Init4 actor98InitData = { 0x01, 0x0050, 0x0064, 0xFF, }; -u32 D_80886D04[] = { +UNK_PTR D_80886D04[] = { 0x06015D20, 0x06016120, 0x06016520, @@ -51,16 +60,13 @@ u32 D_80886D04[] = { 0x06016D20, 0x06017120, 0x06017520, - 0x06017920, - 0x00000000, - 0x00000000, - 0x00000000, + 0x06017920, }; -void BgHidanFirewall_Init(BgHidanFirewall* this, GlobalContext* globalCtx){ - +void BgHidanFirewall_Init(BgHidanFirewall* this, GlobalContext* globalCtx) { + f32 scale; - + scale = 0.119999997318f; this->actor.scale.x = scale; this->actor.scale.z = scale; @@ -76,93 +82,73 @@ void BgHidanFirewall_Init(BgHidanFirewall* this, GlobalContext* globalCtx){ this->collider.dim.position.y = this->actor.posRot.pos.y; func_80061ED4(&this->actor.sub_98, NULL, &actor98InitData); - - this->actionFunc = BgHidanFirewall_Wait; - return; + + this->actionFunc = (ActorFunc)BgHidanFirewall_Wait; } -void BgHidanFirewall_Destroy(BgHidanFirewall* this, GlobalContext* globalCtx) -{ +void BgHidanFirewall_Destroy(BgHidanFirewall* this, GlobalContext* globalCtx) { BgHidanFirewall* thing = this; ActorCollider_FreeCylinder(globalCtx, &this->collider); } -s32 BgHidanFirewall_Proximity(BgHidanFirewall* this, GlobalContext* globalCtx) -{ +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) - { + if (fabsf(distance.x) < 100.0f) { + if (fabsf(distance.z) < 120.0f) { return 1; } } return 0; } -void BgHidanFirewall_Wait(BgHidanFirewall* this, GlobalContext* globalCtx) -{ - if (BgHidanFirewall_Proximity(this, globalCtx) != 0) - { +void BgHidanFirewall_Wait(BgHidanFirewall* this, GlobalContext* globalCtx) { + if (BgHidanFirewall_Proximity(this, globalCtx) != 0) { this->actor.draw = BgHidanFirewall_Draw; this->actor.params = 5; - this->actionFunc = BgHidanFirewall_Countdown; + this->actionFunc = (ActorFunc)BgHidanFirewall_Countdown; } } -void BgHidanFirewall_Countdown(BgHidanFirewall* this, GlobalContext* globalCtx) -{ +void BgHidanFirewall_Countdown(BgHidanFirewall* this, GlobalContext* globalCtx) { - if (this->actor.params != 0) - { + if (this->actor.params != 0) { this->actor.params--; } - if (this->actor.params == 0) - { - this->actionFunc = BgHidanFirewall_Erupt; + if (this->actor.params == 0) { + this->actionFunc = (ActorFunc)BgHidanFirewall_Erupt; } } -void BgHidanFirewall_Erupt(BgHidanFirewall* this, GlobalContext* globalCtx) -{ - if (BgHidanFirewall_Proximity(this, globalCtx) != 0) - { +void BgHidanFirewall_Erupt(BgHidanFirewall* this, GlobalContext* globalCtx) { + if (BgHidanFirewall_Proximity(this, globalCtx) != 0) { Math_ApproxF(&this->actor.scale.y, 0.1f, 0.024999999f); - return; - } - if (Math_ApproxF(&this->actor.scale.y, 0.00999999977648f, 0.00999999977648f) != 0) - { - this->actor.draw = NULL; - this->actionFunc = BgHidanFirewall_Wait; - } - else - { - this->actor.params = 0; + } else { + if (Math_ApproxF(&this->actor.scale.y, 0.00999999977648f, 0.00999999977648f) != 0) { + this->actor.draw = NULL; + this->actionFunc = (ActorFunc)BgHidanFirewall_Wait; + } else { + this->actor.params = 0; + } } } -void BgHidanFirewall_Collide(BgHidanFirewall* this, GlobalContext* globalCtx) -{ +void BgHidanFirewall_Collide(BgHidanFirewall* this, GlobalContext* globalCtx) { s16 phi_a3; - if (func_8002E084(&this->actor, 0x4000) != 0) - { + if (func_8002E084(&this->actor, 0x4000) != 0) { phi_a3 = this->actor.shape.rot.y; - } - else - { + } else { phi_a3 = this->actor.shape.rot.y + 0x8000; } func_8002F71C(globalCtx, this, 5.0f, phi_a3, 1.0f); } -void BgHidanFirewall_ColliderFollowPlayer(BgHidanFirewall* this, GlobalContext* globalCtx) -{ +void BgHidanFirewall_ColliderFollowPlayer(BgHidanFirewall* this, GlobalContext* globalCtx) { Player* player; Vec3f sp30; f32 temp_ret; @@ -171,62 +157,47 @@ void BgHidanFirewall_ColliderFollowPlayer(BgHidanFirewall* this, GlobalContext* player = PLAYER; - func_8002DBD0(&this->actor, &sp30, &player->actor.posRot.pos); - if (sp30.x < -70.0f) - { + func_8002DBD0(&this->actor, &sp30, &player->actor.posRot.pos); + if (sp30.x < -70.0f) { sp30.x = -70.0f; - } - else - { - if (70.0f < sp30.x) - { + } else { + if (70.0f < sp30.x) { phi_f0 = 70.0f; - } - else - { + } else { phi_f0 = sp30.x; } sp30.x = phi_f0; } - if (this->actor.params == 0) - { - if (0.0f < sp30.z) - { + if (this->actor.params == 0) { + if (0.0f < sp30.z) { sp30.z = -25.0f; this->actor.params = -1; - } - else - { + } else { sp30.z = 25.0f; this->actor.params = 1; } - } - else - { + } else { sp30.z = this->actor.params * 25.0f; } - sp28 = Math_Sins(this->actor.shape.rot.y); + 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) -{ +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) - { + if (this->collider.base.colliderFlags & 2) { this->collider.base.colliderFlags &= ~2; BgHidanFirewall_Collide(this, globalCtx); } this->actionFunc(this, globalCtx); - if (this->actionFunc == BgHidanFirewall_Erupt) - { + if (this->actionFunc == (ActorFunc)BgHidanFirewall_Erupt) { BgHidanFirewall_ColliderFollowPlayer(this, globalCtx); Actor_CollisionCheck_SetAT(globalCtx, &globalCtx->sub_11E60, &this->collider); Actor_CollisionCheck_SetOT(globalCtx, &globalCtx->sub_11E60, &this->collider); @@ -234,27 +205,25 @@ void BgHidanFirewall_Update(BgHidanFirewall* this, GlobalContext* globalCtx) } } -void BgHidanFirewall_Draw(BgHidanFirewall* this, GlobalContext* globalCtx) -{ - u32* temp; +void BgHidanFirewall_Draw(BgHidanFirewall* this, GlobalContext* globalCtx) { + UNK_PTR* temp; u32 pad; GraphicsContext* gfxCtx; - u32 pad1; - u32 pad2; - Gfx* gfx; + Gfx* dispRefs[3]; gfxCtx = globalCtx->state.gfxCtx; - func_800C6AC4(&gfx, globalCtx->state.gfxCtx, "../z_bg_hidan_firewall.c", 0x1C0); - gfxCtx->polyXlu.p = func_80093774(gfxCtx->polyXlu.p, 0x14); + Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_hidan_firewall.c", 448); + gfxCtx->polyXlu.p = Gfx_CallSetupDL(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, "../z_bg_hidan_firewall.c", 0x1CA), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_hidan_firewall.c", 458), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(gfxCtx->polyXlu.p++, &D_0600DA80); - func_800C6B54(&gfx, globalCtx->state.gfxCtx, "../z_bg_hidan_firewall.c", 0x1CF); + Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_hidan_firewall.c", 463); } 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 48f490f260..588345099a 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 @@ -6,27 +6,12 @@ struct BgHidanFirewall; -typedef void FirewallFunc(struct BgHidanFirewall* this, GlobalContext* globalCtx); - typedef struct BgHidanFirewall { /* 0x0000 */ Actor actor; - /* 0x014C */ FirewallFunc* actionFunc; + /* 0x014C */ ActorFunc actionFunc; /* 0x0150 */ s16 unk_150; /* 0x0154 */ ColliderCylinderMain collider; } BgHidanFirewall; // size = 0x01A0 -void BgHidanFirewall_Init(BgHidanFirewall* this, GlobalContext* globalCtx); -void BgHidanFirewall_Destroy(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 BgHidanFirewall_Erupt(BgHidanFirewall* this, GlobalContext* globalCtx); -void BgHidanFirewall_Collide(BgHidanFirewall* this, GlobalContext* globalCtx); -void BgHidanFirewall_ColliderFollowPlayer(BgHidanFirewall* this, GlobalContext* globalCtx); -void BgHidanFirewall_Update(BgHidanFirewall* this, GlobalContext* globalCtx); -void BgHidanFirewall_Draw(BgHidanFirewall* this, GlobalContext* globalCtx); - -extern u32 D_0600DA80; - #endif From bd23567bfd28c7d648dd9393c03b80c956d6ccc6 Mon Sep 17 00:00:00 2001 From: chandler Date: Mon, 6 Apr 2020 17:08:24 -0400 Subject: [PATCH 10/13] a couple more suggestions --- .../ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 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 41a614b088..c13b575a00 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 @@ -67,12 +67,12 @@ void BgHidanFirewall_Init(BgHidanFirewall* this, GlobalContext* globalCtx) { f32 scale; - scale = 0.119999997318f; + scale = 0.12f; this->actor.scale.x = scale; this->actor.scale.z = scale; - scale = 0.00999999977648f; - this->actor.scale.y = 0.00999999977648f; + scale = 0.01f; + this->actor.scale.y = 0.01f; this->unk_150 = 0; @@ -98,10 +98,8 @@ s32 BgHidanFirewall_Proximity(BgHidanFirewall* this, GlobalContext* globalCtx) { 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; - } + if (fabsf(distance.x) < 100.0f && fabsf(distance.z) < 120.0f) { + return 1; } return 0; } @@ -128,7 +126,7 @@ void BgHidanFirewall_Erupt(BgHidanFirewall* this, GlobalContext* globalCtx) { if (BgHidanFirewall_Proximity(this, globalCtx) != 0) { Math_ApproxF(&this->actor.scale.y, 0.1f, 0.024999999f); } else { - if (Math_ApproxF(&this->actor.scale.y, 0.00999999977648f, 0.00999999977648f) != 0) { + if (Math_ApproxF(&this->actor.scale.y, 0.01f, 0.01f) != 0) { this->actor.draw = NULL; this->actionFunc = (ActorFunc)BgHidanFirewall_Wait; } else { From 83caab6e680f952965b8fd39fa4ac8ad5799589d Mon Sep 17 00:00:00 2001 From: chandler Date: Mon, 6 Apr 2020 17:31:24 -0400 Subject: [PATCH 11/13] simplified a float --- src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 c13b575a00..96196356b7 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 @@ -124,7 +124,7 @@ void BgHidanFirewall_Countdown(BgHidanFirewall* this, GlobalContext* globalCtx) void BgHidanFirewall_Erupt(BgHidanFirewall* this, GlobalContext* globalCtx) { if (BgHidanFirewall_Proximity(this, globalCtx) != 0) { - Math_ApproxF(&this->actor.scale.y, 0.1f, 0.024999999f); + Math_ApproxF(&this->actor.scale.y, 0.1f, 0.01f/0.4f); } else { if (Math_ApproxF(&this->actor.scale.y, 0.01f, 0.01f) != 0) { this->actor.draw = NULL; From e14b6eefec0b87f8c4ccbd8f055811d73ef73ac4 Mon Sep 17 00:00:00 2001 From: chandler Date: Tue, 7 Apr 2020 11:03:10 -0400 Subject: [PATCH 12/13] made recently suggested changes --- .../z_bg_hidan_firewall.c | 18 +++++++++--------- .../z_bg_hidan_firewall.h | 5 +---- 2 files changed, 10 insertions(+), 13 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 96196356b7..e7238be66f 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 @@ -11,7 +11,7 @@ void BgHidanFirewall_Init(BgHidanFirewall* this, GlobalContext* globalCtx); void BgHidanFirewall_Destroy(BgHidanFirewall* this, GlobalContext* globalCtx); -s32 BgHidanFirewall_Proximity(BgHidanFirewall* this, GlobalContext* globalCtx); +s32 BgHidanFirewall_CheckProximity(BgHidanFirewall* this, GlobalContext* globalCtx); void BgHidanFirewall_Wait(BgHidanFirewall* this, GlobalContext* globalCtx); void BgHidanFirewall_Countdown(BgHidanFirewall* this, GlobalContext* globalCtx); void BgHidanFirewall_Erupt(BgHidanFirewall* this, GlobalContext* globalCtx); @@ -20,7 +20,7 @@ void BgHidanFirewall_ColliderFollowPlayer(BgHidanFirewall* this, GlobalContext* void BgHidanFirewall_Update(BgHidanFirewall* this, GlobalContext* globalCtx); void BgHidanFirewall_Draw(BgHidanFirewall* this, GlobalContext* globalCtx); -extern Gfx D_0600DA80; +extern Gfx D_0600DA80[]; const ActorInit Bg_Hidan_Firewall_InitVars = { ACTOR_BG_HIDAN_FIREWALL, @@ -45,7 +45,7 @@ static ColliderCylinderInit cylinderInitData = { 0x00, 0x00, 0x00, 0x00, 0x19, 0x00, 0x01, 0x00, 0x001E, 0x0053, - 0x00000000000000000000, + 0x0000, }; static Sub98Init4 actor98InitData = { @@ -91,7 +91,7 @@ void BgHidanFirewall_Destroy(BgHidanFirewall* this, GlobalContext* globalCtx) { ActorCollider_FreeCylinder(globalCtx, &this->collider); } -s32 BgHidanFirewall_Proximity(BgHidanFirewall* this, GlobalContext* globalCtx) { +s32 BgHidanFirewall_CheckProximity(BgHidanFirewall* this, GlobalContext* globalCtx) { Player* player; Vec3f distance; @@ -105,7 +105,7 @@ s32 BgHidanFirewall_Proximity(BgHidanFirewall* this, GlobalContext* globalCtx) { } void BgHidanFirewall_Wait(BgHidanFirewall* this, GlobalContext* globalCtx) { - if (BgHidanFirewall_Proximity(this, globalCtx) != 0) { + if (BgHidanFirewall_CheckProximity(this, globalCtx) != 0) { this->actor.draw = BgHidanFirewall_Draw; this->actor.params = 5; this->actionFunc = (ActorFunc)BgHidanFirewall_Countdown; @@ -123,7 +123,7 @@ void BgHidanFirewall_Countdown(BgHidanFirewall* this, GlobalContext* globalCtx) } void BgHidanFirewall_Erupt(BgHidanFirewall* this, GlobalContext* globalCtx) { - if (BgHidanFirewall_Proximity(this, globalCtx) != 0) { + if (BgHidanFirewall_CheckProximity(this, globalCtx) != 0) { Math_ApproxF(&this->actor.scale.y, 0.1f, 0.01f/0.4f); } else { if (Math_ApproxF(&this->actor.scale.y, 0.01f, 0.01f) != 0) { @@ -143,7 +143,7 @@ void BgHidanFirewall_Collide(BgHidanFirewall* this, GlobalContext* globalCtx) { } else { phi_a3 = this->actor.shape.rot.y + 0x8000; } - func_8002F71C(globalCtx, this, 5.0f, phi_a3, 1.0f); + func_8002F71C(globalCtx, &this->actor, 5.0f, phi_a3, 1.0f); } void BgHidanFirewall_ColliderFollowPlayer(BgHidanFirewall* this, GlobalContext* globalCtx) { @@ -214,14 +214,14 @@ void BgHidanFirewall_Draw(BgHidanFirewall* this, GlobalContext* globalCtx) { Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_hidan_firewall.c", 448); gfxCtx->polyXlu.p = Gfx_CallSetupDL(gfxCtx->polyXlu.p, 0x14); - temp = &D_80886D04; + 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, "../z_bg_hidan_firewall.c", 458), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyXlu.p++, &D_0600DA80); + gSPDisplayList(gfxCtx->polyXlu.p++, D_0600DA80); Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_hidan_firewall.c", 463); } 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 588345099a..2d994d8416 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 @@ -4,10 +4,7 @@ #include #include -struct BgHidanFirewall; - -typedef struct BgHidanFirewall -{ +typedef struct BgHidanFirewall { /* 0x0000 */ Actor actor; /* 0x014C */ ActorFunc actionFunc; /* 0x0150 */ s16 unk_150; From 2bf2cef35e2ff2dc9b994ecac80037ca3aa38aa3 Mon Sep 17 00:00:00 2001 From: chandler Date: Tue, 7 Apr 2020 11:51:12 -0400 Subject: [PATCH 13/13] small change in firewall.h --- src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 2d994d8416..32cc66c10f 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 @@ -4,7 +4,7 @@ #include #include -typedef struct BgHidanFirewall { +typedef struct { /* 0x0000 */ Actor actor; /* 0x014C */ ActorFunc actionFunc; /* 0x0150 */ s16 unk_150;