summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucas Shaw <lgs84@cornell.edu>2020-03-21 11:54:45 -0700
committerLucas Shaw <lgs84@cornell.edu>2020-03-21 11:54:45 -0700
commitf374ac8d2bea87dbfeb3fc263c2e654aa96be4c0 (patch)
tree427f8dba5bccf8dd12fcea43877ea8a8fc31d131
parent1ed67c4b218bb4228fcb02ecdd37ebb80a1394bb (diff)
started ovl_bg_toki_swd
-rw-r--r--asm/non_matchings/overlays/actors/ovl_Bg_Toki_Swd/BgTokiSwd_Init.s2
-rw-r--r--asm/non_matchings/overlays/actors/ovl_Bg_Toki_Swd/BgTokiSwd_SetupAction.s (renamed from asm/non_matchings/overlays/actors/ovl_Bg_Toki_Swd/func_808BAE40.s)2
-rw-r--r--asm/non_matchings/overlays/actors/ovl_Bg_Toki_Swd/func_808BAF40.s2
-rw-r--r--asm/non_matchings/overlays/actors/ovl_Bg_Toki_Swd/func_808BB0AC.s2
-rw-r--r--src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c130
-rw-r--r--src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.h3
-rw-r--r--undefined_syms.txt5
7 files changed, 131 insertions, 15 deletions
diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Toki_Swd/BgTokiSwd_Init.s b/asm/non_matchings/overlays/actors/ovl_Bg_Toki_Swd/BgTokiSwd_Init.s
index b1e064bbb..6f6709d68 100644
--- a/asm/non_matchings/overlays/actors/ovl_Bg_Toki_Swd/BgTokiSwd_Init.s
+++ b/asm/non_matchings/overlays/actors/ovl_Bg_Toki_Swd/BgTokiSwd_Init.s
@@ -13,7 +13,7 @@ glabel BgTokiSwd_Init
/* 00030 808BAE70 3C05808C */ lui $a1, %hi(func_808BAF40) ## $a1 = 808C0000
/* 00034 808BAE74 24A5AF40 */ addiu $a1, $a1, %lo(func_808BAF40) ## $a1 = 808BAF40
/* 00038 808BAE78 02002025 */ or $a0, $s0, $zero ## $a0 = 00000000
-/* 0003C 808BAE7C 0C22EB90 */ jal func_808BAE40
+/* 0003C 808BAE7C 0C22EB90 */ jal BgTokiSwd_SetupAction
/* 00040 808BAE80 E60400BC */ swc1 $f4, 0x00BC($s0) ## 000000BC
/* 00044 808BAE84 3C028016 */ lui $v0, 0x8016 ## $v0 = 80160000
/* 00048 808BAE88 2442E660 */ addiu $v0, $v0, 0xE660 ## $v0 = 8015E660
diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Toki_Swd/func_808BAE40.s b/asm/non_matchings/overlays/actors/ovl_Bg_Toki_Swd/BgTokiSwd_SetupAction.s
index cf2c1d0e5..9d8f50b11 100644
--- a/asm/non_matchings/overlays/actors/ovl_Bg_Toki_Swd/func_808BAE40.s
+++ b/asm/non_matchings/overlays/actors/ovl_Bg_Toki_Swd/BgTokiSwd_SetupAction.s
@@ -1,4 +1,4 @@
-glabel func_808BAE40
+glabel BgTokiSwd_SetupAction
/* 00000 808BAE40 03E00008 */ jr $ra
/* 00004 808BAE44 AC85014C */ sw $a1, 0x014C($a0) ## 0000014C
diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Toki_Swd/func_808BAF40.s b/asm/non_matchings/overlays/actors/ovl_Bg_Toki_Swd/func_808BAF40.s
index 9a2cf736a..ce23b22d6 100644
--- a/asm/non_matchings/overlays/actors/ovl_Bg_Toki_Swd/func_808BAF40.s
+++ b/asm/non_matchings/overlays/actors/ovl_Bg_Toki_Swd/func_808BAF40.s
@@ -71,7 +71,7 @@ glabel func_808BAF40
/* 001F8 808BB038 A2191414 */ sb $t9, 0x1414($s0) ## 8015FA74
/* 001FC 808BB03C 3C05808C */ lui $a1, %hi(func_808BB0AC) ## $a1 = 808C0000
/* 00200 808BB040 24A5B0AC */ addiu $a1, $a1, %lo(func_808BB0AC) ## $a1 = 808BB0AC
-/* 00204 808BB044 0C22EB90 */ jal func_808BAE40
+/* 00204 808BB044 0C22EB90 */ jal BgTokiSwd_SetupAction
/* 00208 808BB048 AC800118 */ sw $zero, 0x0118($a0) ## 00000118
/* 0020C 808BB04C 10000008 */ beq $zero, $zero, .L808BB070
/* 00210 808BB050 8E081360 */ lw $t0, 0x1360($s0) ## 8015F9C0
diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Toki_Swd/func_808BB0AC.s b/asm/non_matchings/overlays/actors/ovl_Bg_Toki_Swd/func_808BB0AC.s
index 714956b3c..1a0c1c6d9 100644
--- a/asm/non_matchings/overlays/actors/ovl_Bg_Toki_Swd/func_808BB0AC.s
+++ b/asm/non_matchings/overlays/actors/ovl_Bg_Toki_Swd/func_808BB0AC.s
@@ -22,7 +22,7 @@ glabel func_808BB0AC
/* 002B4 808BB0F4 AC8F0134 */ sw $t7, 0x0134($a0) ## 00000134
.L808BB0F8:
/* 002B8 808BB0F8 3C05808C */ lui $a1, %hi(func_808BB128) ## $a1 = 808C0000
-/* 002BC 808BB0FC 0C22EB90 */ jal func_808BAE40
+/* 002BC 808BB0FC 0C22EB90 */ jal BgTokiSwd_SetupAction
/* 002C0 808BB100 24A5B128 */ addiu $a1, $a1, %lo(func_808BB128) ## $a1 = 808BB128
/* 002C4 808BB104 10000005 */ beq $zero, $zero, .L808BB11C
/* 002C8 808BB108 8FBF0014 */ lw $ra, 0x0014($sp)
diff --git a/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c b/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c
index 4b7512817..57823bf2e 100644
--- a/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c
+++ b/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c
@@ -7,7 +7,8 @@ void BgTokiSwd_Init(BgTokiSwd* this, GlobalContext* globalCtx);
void BgTokiSwd_Destroy(BgTokiSwd* this, GlobalContext* globalCtx);
void BgTokiSwd_Update(BgTokiSwd* this, GlobalContext* globalCtx);
void BgTokiSwd_Draw(BgTokiSwd* this, GlobalContext* globalCtx);
-
+void func_808BAF40(BgTokiSwd* this, GlobalContext* globalCtx);
+void func_808BB0AC(BgTokiSwd* this, GlobalContext* globalCtx);
/*
const ActorInit Bg_Toki_Swd_InitVars =
{
@@ -23,18 +24,129 @@ const ActorInit Bg_Toki_Swd_InitVars =
(ActorFunc)BgTokiSwd_Draw,
};
*/
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Toki_Swd/func_808BAE40.s")
+//#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Toki_Swd/BgTokiSwd_SetupAction.s")
+void BgTokiSwd_SetupAction(BgTokiSwd* this, ActorFunc actionFunc)
+{
+ this->actionFunc = actionFunc;
+}
+//#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Toki_Swd/BgTokiSwd_Init.s")
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Toki_Swd/BgTokiSwd_Init.s")
+extern InitChainEntry D_808BC414;
+extern ColliderCylinderInit D_808BC3E0;
+extern SubActor98Init D_808BC40C;
+void BgTokiSwd_Init(BgTokiSwd* this, GlobalContext* globalCtx)
+{
+ ColliderCylinderMain* collision;
+ Actor* thisx = &this->actor;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Toki_Swd/BgTokiSwd_Destroy.s")
+ Actor_ProcessInitChain(thisx, &D_808BC414);
+ this->actor.shape.unk_08 = 800.0f;
+ BgTokiSwd_SetupAction(thisx, &func_808BAF40);
+ collision = &this->collider;
+ if (LINK_IS_ADULT)
+ {
+ thisx->draw = NULL;
+ }
+ if (gSaveContext.scene_setup_index == 5)
+ {
+ globalCtx->unk_11D30[0] = 0xFF;
+ }
+ ActorCollider_AllocCylinder(globalCtx, collision);
+ ActorCollider_InitCylinder(globalCtx, collision, thisx, &D_808BC3E0);
+ ActorCollider_Cylinder_Update(thisx, collision);
+ func_80061ED4(&thisx->sub_98, 0, &D_808BC40C);
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Toki_Swd/func_808BAF40.s")
+//#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Toki_Swd/BgTokiSwd_Destroy.s")
+void BgTokiSwd_Destroy(BgTokiSwd* this, GlobalContext* globalCtx)
+{
+ ColliderCylinderMain* collider = &this->collider;
+ ActorCollider_FreeCylinder(globalCtx, collider);
+}
+//#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Toki_Swd/func_808BAF40.s")
+extern D_808BBD90;
+extern D_808BB2F0;
+extern D_808BB7A0;
+void func_808BAF40(BgTokiSwd* this, GlobalContext* globalCtx)
+{
+ if (((gSaveContext.event_chk_inf[4] & 0x8000) == 0) && (gSaveContext.scene_setup_index < 4) &&
+ (func_8002E12C(&this->actor, 800.0f, 0x7530) != 0) && (func_800BFC84(globalCtx) == 0))
+ {
+ gSaveContext.event_chk_inf[4] |= 0x8000;
+ globalCtx->csCtx.segment = &D_808BBD90;
+ gSaveContext.cutscene_trigger = 1;
+ }
+ if (LINK_IS_CHILD || ((gSaveContext.event_chk_inf[5] & 0x20) != 0))
+ {
+ if (func_8002F410(&this->actor, globalCtx) != 0)
+ {
+ if (LINK_IS_CHILD)
+ {
+ Item_Give(globalCtx, 0x3C);
+ globalCtx->csCtx.segment = &D_808BB2F0;
+ }
+ else
+ {
+ globalCtx->csCtx.segment = &D_808BB7A0;
+ }
+ Audio_SetBGM(NA_BGM_STOP);
+ Audio_SetBGM(NA_SE_PL_BOUND_DIRT);
+ gSaveContext.cutscene_trigger = (u8)1;
+ this->actor.attachedA = 0;
+ BgTokiSwd_SetupAction(this, &func_808BB0AC);
+ }
+ else
+ {
+ if (func_8002E084(&this->actor, 0x2000) != 0)
+ {
+ func_8002F580(&this->actor, globalCtx);
+ }
+ }
+ }
+ if (gSaveContext.scene_setup_index == 5)
+ {
+ if (globalCtx->unk_11D30[0] > 0)
+ {
+ globalCtx->unk_11D30[0] = globalCtx->unk_11D30[0] - 1;
+ return;
+ }
+ globalCtx->unk_11D30[0] = 0;
+ }
+}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Toki_Swd/func_808BB0AC.s")
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Toki_Swd/func_808BB128.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Toki_Swd/BgTokiSwd_Update.s")
+//#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Toki_Swd/func_808BB128.s")
+void func_808BB128(BgTokiSwd* this, GlobalContext* globalCtx)
+{
+ if ((func_8006C4A4(globalCtx, 1) != 0) && (globalCtx->unk_11D30[0] < 0xFF))
+ {
+ globalCtx->unk_11D30[0] = globalCtx->unk_11D30[0] + 5;
+ }
+}
+//#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Toki_Swd/BgTokiSwd_Update.s")
+void BgTokiSwd_Update(BgTokiSwd* this, GlobalContext* globalCtx)
+{
+ this->actionFunc(&this->actor, globalCtx);
+ Actor_CollisionCheck_SetOT(globalCtx, &globalCtx->sub_11E60, &this->collider);
+}
+//#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Toki_Swd/BgTokiSwd_Draw.s")
+extern char D_808BC420[];
+extern char D_808BC434[];
+extern D_06001BD0;
+extern char D_808BC448[];
+void BgTokiSwd_Draw(BgTokiSwd* this, GlobalContext* globalCtx) {
+ Gfx* gfxArr[7];
+ GraphicsContext* gfxCtx;
+
+
+ gfxCtx = globalCtx->state.gfxCtx;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Toki_Swd/BgTokiSwd_Draw.s")
+ func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, &D_808BC420, 0x2D7);
+ func_80093D18(globalCtx->state.gfxCtx);
+ func_8002EBCC(&this->actor, globalCtx, 0);
+ gSPSegment(gfxCtx->polyOpa.p++, 0x08, Draw_TexScroll(globalCtx->state.gfxCtx, 0, -(globalCtx->gameplayFrames & 0x7F), 0x20, 0x20));
+ gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, D_808BC434, 0x2E6), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPDisplayList(gfxCtx->polyOpa.p++, &D_06001BD0);
+ func_800C6B54(gfxArr, globalCtx->state.gfxCtx, D_808BC448, 0x308);
+}
diff --git a/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.h b/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.h
index 535268eb2..efc0f885d 100644
--- a/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.h
+++ b/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.h
@@ -7,7 +7,8 @@
typedef struct
{
/* 0x0000 */ Actor actor;
- /* 0x014C */ char unk_14C[0x50];
+ /* 0x014C */ ActorFunc actionFunc;
+ /* 0x0150 */ ColliderCylinderMain collider;
} BgTokiSwd; // size = 0x019C
extern const ActorInit Bg_Toki_Swd_InitVars;
diff --git a/undefined_syms.txt b/undefined_syms.txt
index 92837d0b7..0d5822881 100644
--- a/undefined_syms.txt
+++ b/undefined_syms.txt
@@ -394,4 +394,7 @@ D_06008688 = 0x06008688;
D_04049210 = 0x04049210;
// z_obj_bombiwa
-D_060009E0 = 0x060009E0; \ No newline at end of file
+D_060009E0 = 0x060009E0;
+
+// z_bg_toki_swd
+D_06001BD0 = 0x06001BD0; \ No newline at end of file