summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrozlette <uberpanzermensch@gmail.com>2019-12-28 02:23:17 -0600
committerrozlette <uberpanzermensch@gmail.com>2019-12-28 02:23:17 -0600
commit7692d06fcdd19c6544780728922d27588088872d (patch)
tree817bde2c1d65e70d58b0de3c306b901d7e1c44e8 /src
parent6a74885a38f5b924e3453c7f9a807b441c71a19a (diff)
Decompile Bg_Ikana_Ray
Diffstat (limited to 'src')
-rw-r--r--src/actors/Bg_Ikana_Ray/z_bg_ikana_ray.c86
-rw-r--r--src/actors/ovl_Bg_Ikana_Ray_0x80BD53C0/ovl_Bg_Ikana_Ray_0x80BD53C0.c138
2 files changed, 86 insertions, 138 deletions
diff --git a/src/actors/Bg_Ikana_Ray/z_bg_ikana_ray.c b/src/actors/Bg_Ikana_Ray/z_bg_ikana_ray.c
new file mode 100644
index 000000000..95cbf079b
--- /dev/null
+++ b/src/actors/Bg_Ikana_Ray/z_bg_ikana_ray.c
@@ -0,0 +1,86 @@
+#include <ultra64.h>
+#include <global.h>
+
+ActorInitData bgIkanaRayInitData = {
+ 0x0256,
+ 6,
+ 0,
+ 0,
+ 0x0203,
+ 0, 0,
+ sizeof(ActorBgIkanaRay),
+ (actor_func)BgIkanaRay_Init,
+ (actor_func)BgIkanaRay_Fini,
+ (actor_func)BgIkanaRay_Main,
+ (actor_func)BgIkanaRay_Draw
+};
+
+// TODO better formatting
+ColCylinderInit bgIkanaRayCylinderInit = {
+ { 10, 33, 0, 0, 0, 1 },
+ { 0, { 0x00200000, 0, 0 }, { 0, 0, 0 }, 25, 0, 1 },
+ { 90, 420, 65116}
+};
+
+// TODO macro
+ActorInitVar bgIkanaRayCompInit[] = {
+ {1, 6, 0x0FC, 4000},
+ {1, 6, 0x100, 1000},
+ {1, 6, 0x104, 1000},
+ {0, 9, 0x058, 100}
+};
+
+void BgIkanaRay_Init(ActorBgIkanaRay* this, GlobalContext* ctxt) {
+ ColCylinder* collision = &this->collision;
+ u32 pad;
+
+ Lib_ApplyActorInitVars((Actor*)this, bgIkanaRayCompInit);
+
+ Collision_InitCylinderDefault(ctxt, collision);
+ Collision_InitCylinderWithData(ctxt, collision, (Actor*)this, &bgIkanaRayCylinderInit);
+ Collision_CylinderMoveToActor((Actor*)this, &this->collision);
+
+ this->animatedTextures = (AnimatedTexture*)Lib_PtrSegToVirt((u32)object_ikana_obj_001228);
+
+ if (Actor_GetSwitchFlag(ctxt, this->base.variable & 0x7F) != 0) {
+ BgIkanaRay_SetActivated(this);
+ } else {
+ BgIkanaRay_SetDeactivated(this);
+ }
+}
+
+void BgIkanaRay_Fini(ActorBgIkanaRay* this, GlobalContext* ctxt) {
+ ColCylinder* collision = &this->collision;
+ Collision_FiniCylinder(ctxt, collision);
+}
+
+void BgIkanaRay_SetDeactivated(ActorBgIkanaRay* this) {
+ this->base.draw = NULL;
+ this->base.flags |= 0x10;
+ this->update = (actor_func)BgIkanaRay_UpdateCheckForActivation;
+}
+
+void BgIkanaRay_UpdateCheckForActivation(ActorBgIkanaRay* this, GlobalContext* ctxt) {
+ if (Actor_GetSwitchFlag(ctxt, this->base.variable & 0x7F) != 0) {
+ BgIkanaRay_SetActivated(this);
+ }
+}
+
+void BgIkanaRay_SetActivated(ActorBgIkanaRay* this) {
+ this->base.draw = (actor_func)BgIkanaRay_Draw;
+ this->base.flags &= 0xFFFFFFEF;
+ this->update = (actor_func)BgIkanaRay_UpdateActivated;
+}
+
+void BgIkanaRay_UpdateActivated(ActorBgIkanaRay* this, GlobalContext* ctxt) {
+ Collision_AddAT(ctxt, &ctxt->collisionContext, &this->collision.base);
+}
+
+void BgIkanaRay_Main(ActorBgIkanaRay* this, GlobalContext* ctxt) {
+ this->update((Actor*)this, ctxt);
+}
+
+void BgIkanaRay_Draw(ActorBgIkanaRay* this, GlobalContext* ctxt) {
+ SceneProc_DrawAllSceneAnimatedTextures(ctxt, this->animatedTextures);
+ func_800BE03C(ctxt, object_ikana_obj_001100);
+}
diff --git a/src/actors/ovl_Bg_Ikana_Ray_0x80BD53C0/ovl_Bg_Ikana_Ray_0x80BD53C0.c b/src/actors/ovl_Bg_Ikana_Ray_0x80BD53C0/ovl_Bg_Ikana_Ray_0x80BD53C0.c
deleted file mode 100644
index 0fd1095fa..000000000
--- a/src/actors/ovl_Bg_Ikana_Ray_0x80BD53C0/ovl_Bg_Ikana_Ray_0x80BD53C0.c
+++ /dev/null
@@ -1,138 +0,0 @@
-#include <ultra64.h>
-#include <global.h>
-
-typedef struct z_ActorBgIkanaRay_s {
- /* 0x000 */ Actor baseActor;
- /* 0x144 */ UNK_TYPE unk144;
- /* 0x148 */ u8 pad5[0x48];
- /* 0x190 */ UNK_TYPE unk190;
- /* 0x194 */ void(*unk404)(struct z_ActorBgIkanaRay_s*, GlobalContext*);
-} z_ActorBgIkanaRay;
-
-void z_bg_ikana_ray_init(z_ActorBgIkanaRay* this, GlobalContext* ctxt);
-void z_bg_ikana_ray_fini(z_ActorBgIkanaRay* this, GlobalContext* ctxt);
-void z_bg_ikana_ray_main(z_ActorBgIkanaRay* this, GlobalContext* ctxt);
-void z_bg_ikana_ray_draw(z_ActorBgIkanaRay* this, GlobalContext* ctxt);
-void func_80BD5498(z_ActorBgIkanaRay* this);
-void func_80BD54BC(z_ActorBgIkanaRay* this, GlobalContext* ctxt);
-void func_80BD5500(z_ActorBgIkanaRay* this);
-void func_80BD5530(z_ActorBgIkanaRay* this, GlobalContext* ctxt);
-
-ActorInitData bgIkanaRayInitVar = {
- 0x0256,
- 6,
- 0,
- 0,
- 0x0203,
- sizeof(z_ActorBgIkanaRay),
- (actor_func)z_bg_ikana_ray_init,
- (actor_func)z_bg_ikana_ray_fini,
- (actor_func)z_bg_ikana_ray_main,
- (actor_func)z_bg_ikana_ray_draw
-};
-
-GLOBAL_ASM(
-.data
-glabel D_80BD55F0
-/* 000140 0x80BD55F0 */ .word 0x0A210000
-/* 000141 0x80BD55F4 */ .word 0x00010000
-/* 000142 0x80BD55F8 */ .word 0x00000000
-/* 000143 0x80BD55FC */ .word 0x00200000
-/* 000144 0x80BD5600 */ .word 0x00000000
-/* 000145 0x80BD5604 */ .word 0x00000000
-/* 000146 0x80BD5608 */ .word 0x00000000
-/* 000147 0x80BD560C */ .word 0x19000100
-/* 000148 0x80BD5610 */ .word 0x005A01A4
-/* 000149 0x80BD5614 */ .word 0xFE5C0000
-/* 000150 0x80BD5618 */ .word 0x00000000
-)
-
-// TODO macro
-ActorInitVar bgIkanaRayCompInit[] = {
- {1, 6, 0x0FC, 4000},
- {1, 6, 0x100, 1000},
- {1, 6, 0x104, 1000},
- {0, 9, 0x058, 100}
-};
-
-// Overlay info
-GLOBAL_ASM(
-.data
-glabel D_80BD562C
-/* 000155 0x80BD562C */ .word 0x00000000
-/* 000156 0x80BD5630 */ .word 0x00000210
-/* 000157 0x80BD5634 */ .word 0x00000060
-/* 000158 0x80BD5638 */ .word 0x00000000
-/* 000159 0x80BD563C */ .word 0x00000000
-/* 000160 0x80BD5640 */ .word 0x00000011
-/* 000161 0x80BD5644 */ .word 0x45000014
-/* 000162 0x80BD5648 */ .word 0x46000018
-/* 000163 0x80BD564C */ .word 0x45000034
-/* 000164 0x80BD5650 */ .word 0x46000038
-/* 000165 0x80BD5654 */ .word 0x44000080
-/* 000166 0x80BD5658 */ .word 0x44000090
-/* 000167 0x80BD565C */ .word 0x450000DC
-/* 000168 0x80BD5660 */ .word 0x460000E0
-/* 000169 0x80BD5664 */ .word 0x44000128
-/* 000170 0x80BD5668 */ .word 0x45000144
-/* 000171 0x80BD566C */ .word 0x46000150
-/* 000172 0x80BD5670 */ .word 0x4500014C
-/* 000173 0x80BD5674 */ .word 0x46000154
-/* 000174 0x80BD5678 */ .word 0x82000010
-/* 000175 0x80BD567C */ .word 0x82000014
-/* 000176 0x80BD5680 */ .word 0x82000018
-/* 000177 0x80BD5684 */ .word 0x8200001C
-)
-
-void z_bg_ikana_ray_init(z_ActorBgIkanaRay* this, GlobalContext* ctxt) {
- UNK_TYPE* sp24 = &this->unk144;
- u32 pad;
-
- func_800FFADC((Actor*)this, bgIkanaRayCompInit);
- func_800E119C(ctxt, sp24);
- func_800E130C(ctxt, sp24, (Actor*)this, &D_80BD55F0);
- func_800E7DF8((Actor*)this, &this->unk144);
- this->unk190 = func_80100504((UNK_TYPE)&D_06001228); // XXX: D_06001228 is probably a constant
-
- if (func_800B5BB0(ctxt, this->baseActor.unk1C & 0x7F) != 0) {
- func_80BD5500(this);
- } else {
- func_80BD5498(this);
- }
-}
-
-void z_bg_ikana_ray_fini(z_ActorBgIkanaRay* this, GlobalContext* ctxt) {
- UNK_TYPE* a1 = &this->unk144;
- func_800E11EC(ctxt, a1);
-}
-
-void func_80BD5498(z_ActorBgIkanaRay* this) {
- this->baseActor.drawFunc = NULL;
- this->baseActor.unk4 |= 0x10;
- this->unk404 = func_80BD54BC;
-}
-
-void func_80BD54BC(z_ActorBgIkanaRay* this, GlobalContext* ctxt) {
- if (func_800B5BB0(ctxt, this->baseActor.unk1C & 0x7F) != 0) {
- func_80BD5500(this);
- }
-}
-
-void func_80BD5500(z_ActorBgIkanaRay* this) {
- this->baseActor.drawFunc = (actor_func)z_bg_ikana_ray_draw;
- this->baseActor.unk4 &= 0xFFFFFFEF;
- this->unk404 = func_80BD5530;
-}
-
-void func_80BD5530(z_ActorBgIkanaRay* this, GlobalContext* ctxt) {
- func_800E2558(ctxt, &ctxt->unk18884, &this->unk144);
-}
-
-void z_bg_ikana_ray_main(z_ActorBgIkanaRay* this, GlobalContext* ctxt) {
- this->unk404(this, ctxt);
-}
-
-void z_bg_ikana_ray_draw(z_ActorBgIkanaRay* this, GlobalContext* ctxt) {
- func_80131758(ctxt, this->unk190);
- func_800BE03C(ctxt, (UNK_TYPE)&D_06001100); // XXX: D_06001100 is probably a constant
-}